diff --git a/main.js b/main.js
index dadc772..b5b6eb7 100644
--- a/main.js
+++ b/main.js
@@ -13,15 +13,15 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod3) => function __require() {
return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
};
-var __export = (target, all6) => {
- for (var name317 in all6)
- __defProp(target, name317, { get: all6[name317], enumerable: true });
+var __export = (target, all2) => {
+ for (var name317 in all2)
+ __defProp(target, name317, { get: all2[name317], enumerable: true });
};
var __copyProps = (to2, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
- for (let key3 of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to2, key3) && key3 !== except)
- __defProp(to2, key3, { get: () => from[key3], enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable });
+ for (let key2 of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to2, key2) && key2 !== except)
+ __defProp(to2, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
}
return to2;
};
@@ -32,14 +32,14 @@ var __toESM = (mod3, isNodeMode, target) => (target = mod3 != null ? __create(__
));
var __toCommonJS = (mod3) => __copyProps(__defProp({}, "__esModule", { value: true }), mod3);
var __toBinary = /* @__PURE__ */ (() => {
- var table2 = new Uint8Array(128);
+ var table = new Uint8Array(128);
for (var i4 = 0; i4 < 64; i4++)
- table2[i4 < 26 ? i4 + 65 : i4 < 52 ? i4 + 71 : i4 < 62 ? i4 - 4 : i4 * 4 - 205] = i4;
+ table[i4 < 26 ? i4 + 65 : i4 < 52 ? i4 + 71 : i4 < 62 ? i4 - 4 : i4 * 4 - 205] = i4;
return (base64) => {
var n3 = base64.length, bytes = new Uint8Array((n3 - (base64[n3 - 1] == "=") - (base64[n3 - 2] == "=")) * 3 / 4 | 0);
for (var i5 = 0, j = 0; i5 < n3; ) {
- var c0 = table2[base64.charCodeAt(i5++)], c1 = table2[base64.charCodeAt(i5++)];
- var c22 = table2[base64.charCodeAt(i5++)], c3 = table2[base64.charCodeAt(i5++)];
+ var c0 = table[base64.charCodeAt(i5++)], c1 = table[base64.charCodeAt(i5++)];
+ var c22 = table[base64.charCodeAt(i5++)], c3 = table[base64.charCodeAt(i5++)];
bytes[j++] = c0 << 2 | c1 >> 4;
bytes[j++] = c1 << 4 | c22 >> 2;
bytes[j++] = c22 << 6 | c3;
@@ -54,7 +54,7 @@ var require_react_production_min = __commonJS({
"use strict";
var l2 = Symbol.for("react.element");
var n3 = Symbol.for("react.portal");
- var p2 = Symbol.for("react.fragment");
+ var p = Symbol.for("react.fragment");
var q2 = Symbol.for("react.strict_mode");
var r2 = Symbol.for("react.profiler");
var t5 = Symbol.for("react.provider");
@@ -232,7 +232,7 @@ var require_react_production_min = __commonJS({
return a4;
} };
exports.Component = E2;
- exports.Fragment = p2;
+ exports.Fragment = p;
exports.Profiler = r2;
exports.PureComponent = G2;
exports.StrictMode = q2;
@@ -402,14 +402,14 @@ var require_moment = __commonJS({
function isDate4(input) {
return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
}
- function map6(arr, fn) {
+ function map4(arr, fn) {
var res = [], i4, arrLen = arr.length;
for (i4 = 0; i4 < arrLen; ++i4) {
res.push(fn(arr[i4], i4));
}
return res;
}
- function extend4(a4, b2) {
+ function extend3(a4, b2) {
for (var i4 in b2) {
if (hasOwnProp(b2, i4)) {
a4[i4] = b2[i4];
@@ -485,7 +485,7 @@ var require_moment = __commonJS({
function createInvalid(flags) {
var m4 = createUTC(NaN);
if (flags != null) {
- extend4(getParsingFlags(m4), flags);
+ extend3(getParsingFlags(m4), flags);
} else {
getParsingFlags(m4).userInvalidated = true;
}
@@ -557,19 +557,19 @@ var require_moment = __commonJS({
}
function deprecate(msg, fn) {
var firstTime = true;
- return extend4(function() {
+ return extend3(function() {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(null, msg);
}
if (firstTime) {
- var args = [], arg2, i4, key3, argLen = arguments.length;
+ var args = [], arg2, i4, key2, argLen = arguments.length;
for (i4 = 0; i4 < argLen; i4++) {
arg2 = "";
if (typeof arguments[i4] === "object") {
arg2 += "\n[" + i4 + "] ";
- for (key3 in arguments[0]) {
- if (hasOwnProp(arguments[0], key3)) {
- arg2 += key3 + ": " + arguments[0][key3] + ", ";
+ for (key2 in arguments[0]) {
+ if (hasOwnProp(arguments[0], key2)) {
+ arg2 += key2 + ": " + arguments[0][key2] + ", ";
}
}
arg2 = arg2.slice(0, -2);
@@ -619,13 +619,13 @@ var require_moment = __commonJS({
);
}
function mergeConfigs(parentConfig, childConfig) {
- var res = extend4({}, parentConfig), prop2;
+ var res = extend3({}, parentConfig), prop2;
for (prop2 in childConfig) {
if (hasOwnProp(childConfig, prop2)) {
if (isObject4(parentConfig[prop2]) && isObject4(childConfig[prop2])) {
res[prop2] = {};
- extend4(res[prop2], parentConfig[prop2]);
- extend4(res[prop2], childConfig[prop2]);
+ extend3(res[prop2], parentConfig[prop2]);
+ extend3(res[prop2], childConfig[prop2]);
} else if (childConfig[prop2] != null) {
res[prop2] = childConfig[prop2];
} else {
@@ -635,7 +635,7 @@ var require_moment = __commonJS({
}
for (prop2 in parentConfig) {
if (hasOwnProp(parentConfig, prop2) && !hasOwnProp(childConfig, prop2) && isObject4(parentConfig[prop2])) {
- res[prop2] = extend4({}, res[prop2]);
+ res[prop2] = extend3({}, res[prop2]);
}
}
return res;
@@ -645,11 +645,11 @@ var require_moment = __commonJS({
this.set(config4);
}
}
- var keys2;
+ var keys;
if (Object.keys) {
- keys2 = Object.keys;
+ keys = Object.keys;
} else {
- keys2 = function(obj) {
+ keys = function(obj) {
var i4, res = [];
for (i4 in obj) {
if (hasOwnProp(obj, i4)) {
@@ -667,12 +667,12 @@ var require_moment = __commonJS({
lastWeek: "[Last] dddd [at] LT",
sameElse: "L"
};
- function calendar(key3, mom, now2) {
- var output = this._calendar[key3] || this._calendar["sameElse"];
+ function calendar(key2, mom, now2) {
+ var output = this._calendar[key2] || this._calendar["sameElse"];
return isFunction3(output) ? output.call(mom, now2) : output;
}
- function zeroFill(number5, targetLength, forceSign) {
- var absNumber2 = "" + Math.abs(number5), zerosToFill = targetLength - absNumber2.length, sign5 = number5 >= 0;
+ function zeroFill(number4, targetLength, forceSign) {
+ var absNumber2 = "" + Math.abs(number4), zerosToFill = targetLength - absNumber2.length, sign5 = number4 >= 0;
return (sign5 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber2;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([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, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
@@ -755,26 +755,26 @@ var require_moment = __commonJS({
LLL: "MMMM D, YYYY h:mm A",
LLLL: "dddd, MMMM D, YYYY h:mm A"
};
- function longDateFormat(key3) {
- var format9 = this._longDateFormat[key3], formatUpper = this._longDateFormat[key3.toUpperCase()];
+ function longDateFormat(key2) {
+ var format9 = this._longDateFormat[key2], formatUpper = this._longDateFormat[key2.toUpperCase()];
if (format9 || !formatUpper) {
return format9;
}
- this._longDateFormat[key3] = formatUpper.match(formattingTokens).map(function(tok) {
+ this._longDateFormat[key2] = formatUpper.match(formattingTokens).map(function(tok) {
if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
return tok.slice(1);
}
return tok;
}).join("");
- return this._longDateFormat[key3];
+ return this._longDateFormat[key2];
}
var defaultInvalidDate = "Invalid date";
function invalidDate() {
return this._invalidDate;
}
var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
- function ordinal(number5) {
- return this._ordinal.replace("%d", number5);
+ function ordinal(number4) {
+ return this._ordinal.replace("%d", number4);
}
var defaultRelativeTime = {
future: "in %s",
@@ -794,9 +794,9 @@ var require_moment = __commonJS({
y: "a year",
yy: "%d years"
};
- function relativeTime(number5, withoutSuffix, string6, isFuture) {
- var output = this._relativeTime[string6];
- return isFunction3(output) ? output(number5, withoutSuffix, string6, isFuture) : output.replace(/%d/i, number5);
+ function relativeTime(number4, withoutSuffix, string4, isFuture) {
+ var output = this._relativeTime[string4];
+ return isFunction3(output) ? output(number4, withoutSuffix, string4, isFuture) : output.replace(/%d/i, number4);
}
function pastFuture(diff3, output) {
var format9 = this._relativeTime[diff3 > 0 ? "future" : "past"];
@@ -841,11 +841,11 @@ var require_moment = __commonJS({
function isLeapYear(year) {
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
- function absFloor(number5) {
- if (number5 < 0) {
- return Math.ceil(number5) || 0;
+ function absFloor(number4) {
+ if (number4 < 0) {
+ return Math.ceil(number4) || 0;
} else {
- return Math.floor(number5);
+ return Math.floor(number4);
}
}
function toInt(argumentForCoercion) {
@@ -1768,8 +1768,8 @@ var require_moment = __commonJS({
}
return minl;
}
- function normalizeLocale(key3) {
- return key3 ? key3.toLowerCase().replace("_", "-") : key3;
+ function normalizeLocale(key2) {
+ return key2 ? key2.toLowerCase().replace("_", "-") : key2;
}
function chooseLocale(names) {
var i4 = 0, j, next, locale3, split;
@@ -1809,20 +1809,20 @@ var require_moment = __commonJS({
}
return locales[name317];
}
- function getSetGlobalLocale(key3, values2) {
- var data3;
- if (key3) {
+ function getSetGlobalLocale(key2, values2) {
+ var data2;
+ if (key2) {
if (isUndefined2(values2)) {
- data3 = getLocale(key3);
+ data2 = getLocale(key2);
} else {
- data3 = defineLocale(key3, values2);
+ data2 = defineLocale(key2, values2);
}
- if (data3) {
- globalLocale = data3;
+ if (data2) {
+ globalLocale = data2;
} else {
if (typeof console !== "undefined" && console.warn) {
console.warn(
- "Locale " + key3 + " not found. Did you forget to load it?"
+ "Locale " + key2 + " not found. Did you forget to load it?"
);
}
}
@@ -1904,25 +1904,25 @@ var require_moment = __commonJS({
}
return locales[name317];
}
- function getLocale(key3) {
+ function getLocale(key2) {
var locale3;
- if (key3 && key3._locale && key3._locale._abbr) {
- key3 = key3._locale._abbr;
+ if (key2 && key2._locale && key2._locale._abbr) {
+ key2 = key2._locale._abbr;
}
- if (!key3) {
+ if (!key2) {
return globalLocale;
}
- if (!isArray5(key3)) {
- locale3 = loadLocale(key3);
+ if (!isArray5(key2)) {
+ locale3 = loadLocale(key2);
if (locale3) {
return locale3;
}
- key3 = [key3];
+ key2 = [key2];
}
- return chooseLocale(key3);
+ return chooseLocale(key2);
}
function listLocales() {
- return keys2(locales);
+ return keys(locales);
}
function checkOverflow(m4) {
var overflow, a4 = m4._a;
@@ -1978,7 +1978,7 @@ var require_moment = __commonJS({
PST: -8 * 60
};
function configFromISO(config4) {
- var i4, l2, string6 = config4._i, match5 = extendedIsoRegex.exec(string6) || basicIsoRegex.exec(string6), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
+ var i4, l2, string4 = config4._i, match5 = extendedIsoRegex.exec(string4) || basicIsoRegex.exec(string4), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
if (match5) {
getParsingFlags(config4).iso = true;
for (i4 = 0, l2 = isoDatesLen; i4 < l2; i4++) {
@@ -2249,19 +2249,19 @@ var require_moment = __commonJS({
}
config4._a = [];
getParsingFlags(config4).empty = true;
- var string6 = "" + config4._i, i4, parsedInput, tokens2, token2, skipped, stringLength = string6.length, totalParsedInputLength = 0, era, tokenLen;
+ var string4 = "" + config4._i, i4, parsedInput, tokens2, token2, skipped, stringLength = string4.length, totalParsedInputLength = 0, era, tokenLen;
tokens2 = expandFormat(config4._f, config4._locale).match(formattingTokens) || [];
tokenLen = tokens2.length;
for (i4 = 0; i4 < tokenLen; i4++) {
token2 = tokens2[i4];
- parsedInput = (string6.match(getParseRegexForToken(token2, config4)) || [])[0];
+ parsedInput = (string4.match(getParseRegexForToken(token2, config4)) || [])[0];
if (parsedInput) {
- skipped = string6.substr(0, string6.indexOf(parsedInput));
+ skipped = string4.substr(0, string4.indexOf(parsedInput));
if (skipped.length > 0) {
getParsingFlags(config4).unusedInput.push(skipped);
}
- string6 = string6.slice(
- string6.indexOf(parsedInput) + parsedInput.length
+ string4 = string4.slice(
+ string4.indexOf(parsedInput) + parsedInput.length
);
totalParsedInputLength += parsedInput.length;
}
@@ -2277,8 +2277,8 @@ var require_moment = __commonJS({
}
}
getParsingFlags(config4).charsLeftOver = stringLength - totalParsedInputLength;
- if (string6.length > 0) {
- getParsingFlags(config4).unusedInput.push(string6);
+ if (string4.length > 0) {
+ getParsingFlags(config4).unusedInput.push(string4);
}
if (config4._a[HOUR] <= 12 && getParsingFlags(config4).bigHour === true && config4._a[HOUR] > 0) {
getParsingFlags(config4).bigHour = void 0;
@@ -2354,14 +2354,14 @@ var require_moment = __commonJS({
}
}
}
- extend4(config4, bestMoment || tempConfig);
+ extend3(config4, bestMoment || tempConfig);
}
function configFromObject(config4) {
if (config4._d) {
return;
}
var i4 = normalizeObjectUnits(config4._i), dayOrDate = i4.day === void 0 ? i4.date : i4.day;
- config4._a = map6(
+ config4._a = map4(
[i4.year, i4.month, dayOrDate, i4.hour, i4.minute, i4.second, i4.millisecond],
function(obj) {
return obj && parseInt(obj, 10);
@@ -2411,7 +2411,7 @@ var require_moment = __commonJS({
} else if (typeof input === "string") {
configFromString(config4);
} else if (isArray5(input)) {
- config4._a = map6(input.slice(0), function(obj) {
+ config4._a = map4(input.slice(0), function(obj) {
return parseInt(obj, 10);
});
configFromArray(config4);
@@ -2507,9 +2507,9 @@ var require_moment = __commonJS({
"millisecond"
];
function isDurationValid(m4) {
- var key3, unitHasDecimal = false, i4, orderLen = ordering.length;
- for (key3 in m4) {
- if (hasOwnProp(m4, key3) && !(indexOf.call(ordering, key3) !== -1 && (m4[key3] == null || !isNaN(m4[key3])))) {
+ var key2, unitHasDecimal = false, i4, orderLen = ordering.length;
+ for (key2 in m4) {
+ if (hasOwnProp(m4, key2) && !(indexOf.call(ordering, key2) !== -1 && (m4[key2] == null || !isNaN(m4[key2])))) {
return false;
}
}
@@ -2544,11 +2544,11 @@ var require_moment = __commonJS({
function isDuration(obj) {
return obj instanceof Duration;
}
- function absRound(number5) {
- if (number5 < 0) {
- return Math.round(-1 * number5) * -1;
+ function absRound(number4) {
+ if (number4 < 0) {
+ return Math.round(-1 * number4) * -1;
} else {
- return Math.round(number5);
+ return Math.round(number4);
}
}
function compareArrays(array1, array2, dontConvert) {
@@ -2579,8 +2579,8 @@ var require_moment = __commonJS({
config4._tzm = offsetFromString(matchShortOffset, input);
});
var chunkOffset = /([\+\-]|\d\d)/gi;
- function offsetFromString(matcher, string6) {
- var matches = (string6 || "").match(matcher), chunk, parts, minutes2;
+ function offsetFromString(matcher, string4) {
+ var matches = (string4 || "").match(matcher), chunk, parts, minutes2;
if (matches === null) {
return null;
}
@@ -2719,7 +2719,7 @@ var require_moment = __commonJS({
return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
- function createDuration(input, key3) {
+ function createDuration(input, key2) {
var duration = input, match5 = null, sign5, ret, diffRes;
if (isDuration(input)) {
duration = {
@@ -2729,8 +2729,8 @@ var require_moment = __commonJS({
};
} else if (isNumber4(input) || !isNaN(+input)) {
duration = {};
- if (key3) {
- duration[key3] = +input;
+ if (key2) {
+ duration[key2] = +input;
} else {
duration.milliseconds = +input;
}
@@ -2781,25 +2781,25 @@ var require_moment = __commonJS({
var res = inp && parseFloat(inp.replace(",", "."));
return (isNaN(res) ? 0 : res) * sign5;
}
- function positiveMomentsDifference(base3, other) {
+ function positiveMomentsDifference(base2, other) {
var res = {};
- res.months = other.month() - base3.month() + (other.year() - base3.year()) * 12;
- if (base3.clone().add(res.months, "M").isAfter(other)) {
+ res.months = other.month() - base2.month() + (other.year() - base2.year()) * 12;
+ if (base2.clone().add(res.months, "M").isAfter(other)) {
--res.months;
}
- res.milliseconds = +other - +base3.clone().add(res.months, "M");
+ res.milliseconds = +other - +base2.clone().add(res.months, "M");
return res;
}
- function momentsDifference(base3, other) {
+ function momentsDifference(base2, other) {
var res;
- if (!(base3.isValid() && other.isValid())) {
+ if (!(base2.isValid() && other.isValid())) {
return { milliseconds: 0, months: 0 };
}
- other = cloneWithOffset(other, base3);
- if (base3.isBefore(other)) {
- res = positiveMomentsDifference(base3, other);
+ other = cloneWithOffset(other, base2);
+ if (base2.isBefore(other)) {
+ res = positiveMomentsDifference(base2, other);
} else {
- res = positiveMomentsDifference(other, base3);
+ res = positiveMomentsDifference(other, base2);
res.milliseconds = -res.milliseconds;
res.months = -res.months;
}
@@ -3038,7 +3038,7 @@ var require_moment = __commonJS({
}
hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
- function toString5() {
+ function toString4() {
return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function toISOString(keepOffset) {
@@ -3106,12 +3106,12 @@ var require_moment = __commonJS({
function toNow(withoutSuffix) {
return this.to(createLocal(), withoutSuffix);
}
- function locale2(key3) {
+ function locale2(key2) {
var newLocaleData;
- if (key3 === void 0) {
+ if (key2 === void 0) {
return this._locale._abbr;
} else {
- newLocaleData = getLocale(key3);
+ newLocaleData = getLocale(key2);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
@@ -3120,11 +3120,11 @@ var require_moment = __commonJS({
}
var lang = deprecate(
"moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
- function(key3) {
- if (key3 === void 0) {
+ function(key2) {
+ if (key2 === void 0) {
return this.localeData();
} else {
- return this.locale(key3);
+ return this.locale(key2);
}
}
);
@@ -3307,7 +3307,7 @@ var require_moment = __commonJS({
return isValid2(this);
}
function parsingFlags() {
- return extend4({}, getParsingFlags(this));
+ return extend3({}, getParsingFlags(this));
}
function invalidAt() {
return getParsingFlags(this).overflow;
@@ -3749,7 +3749,7 @@ var require_moment = __commonJS({
};
}
proto.toJSON = toJSON;
- proto.toString = toString5;
+ proto.toString = toString4;
proto.unix = unix;
proto.valueOf = valueOf;
proto.creationData = creationData;
@@ -3817,8 +3817,8 @@ var require_moment = __commonJS({
function createInZone() {
return createLocal.apply(null, arguments).parseZone();
}
- function preParsePostFormat(string6) {
- return string6;
+ function preParsePostFormat(string4) {
+ return string4;
}
var proto$1 = Locale.prototype;
proto$1.calendar = calendar;
@@ -3853,18 +3853,18 @@ var require_moment = __commonJS({
proto$1.weekdaysMinRegex = weekdaysMinRegex;
proto$1.isPM = localeIsPM;
proto$1.meridiem = localeMeridiem;
- function get$1(format9, index3, field, setter) {
- var locale3 = getLocale(), utc = createUTC().set(setter, index3);
+ function get$1(format9, index2, field, setter) {
+ var locale3 = getLocale(), utc = createUTC().set(setter, index2);
return locale3[field](utc, format9);
}
- function listMonthsImpl(format9, index3, field) {
+ function listMonthsImpl(format9, index2, field) {
if (isNumber4(format9)) {
- index3 = format9;
+ index2 = format9;
format9 = void 0;
}
format9 = format9 || "";
- if (index3 != null) {
- return get$1(format9, index3, field, "month");
+ if (index2 != null) {
+ return get$1(format9, index2, 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, index3, field) {
+ function listWeekdaysImpl(localeSorted, format9, index2, field) {
if (typeof localeSorted === "boolean") {
if (isNumber4(format9)) {
- index3 = format9;
+ index2 = format9;
format9 = void 0;
}
format9 = format9 || "";
} else {
format9 = localeSorted;
- index3 = format9;
+ index2 = format9;
localeSorted = false;
if (isNumber4(format9)) {
- index3 = format9;
+ index2 = format9;
format9 = void 0;
}
format9 = format9 || "";
}
var locale3 = getLocale(), shift = localeSorted ? locale3._week.dow : 0, i4, out = [];
- if (index3 != null) {
- return get$1(format9, (index3 + shift) % 7, field, "day");
+ if (index2 != null) {
+ return get$1(format9, (index2 + 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, index3) {
- return listMonthsImpl(format9, index3, "months");
+ function listMonths(format9, index2) {
+ return listMonthsImpl(format9, index2, "months");
}
- function listMonthsShort(format9, index3) {
- return listMonthsImpl(format9, index3, "monthsShort");
+ function listMonthsShort(format9, index2) {
+ return listMonthsImpl(format9, index2, "monthsShort");
}
- function listWeekdays(localeSorted, format9, index3) {
- return listWeekdaysImpl(localeSorted, format9, index3, "weekdays");
+ function listWeekdays(localeSorted, format9, index2) {
+ return listWeekdaysImpl(localeSorted, format9, index2, "weekdays");
}
- function listWeekdaysShort(localeSorted, format9, index3) {
- return listWeekdaysImpl(localeSorted, format9, index3, "weekdaysShort");
+ function listWeekdaysShort(localeSorted, format9, index2) {
+ return listWeekdaysImpl(localeSorted, format9, index2, "weekdaysShort");
}
- function listWeekdaysMin(localeSorted, format9, index3) {
- return listWeekdaysImpl(localeSorted, format9, index3, "weekdaysMin");
+ function listWeekdaysMin(localeSorted, format9, index2) {
+ return listWeekdaysImpl(localeSorted, format9, index2, "weekdaysMin");
}
getSetGlobalLocale("en", {
eras: [
@@ -3933,9 +3933,9 @@ var require_moment = __commonJS({
}
],
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
- ordinal: function(number5) {
- var b2 = number5 % 10, output = toInt(number5 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th";
- return number5 + output;
+ ordinal: function(number4) {
+ var b2 = number4 % 10, output = toInt(number4 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th";
+ return number4 + output;
}
});
hooks.lang = deprecate(
@@ -3948,16 +3948,16 @@ var require_moment = __commonJS({
);
var mathAbs = Math.abs;
function abs3() {
- var data3 = this._data;
+ var data2 = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
- data3.milliseconds = mathAbs(data3.milliseconds);
- data3.seconds = mathAbs(data3.seconds);
- data3.minutes = mathAbs(data3.minutes);
- data3.hours = mathAbs(data3.hours);
- data3.months = mathAbs(data3.months);
- data3.years = mathAbs(data3.years);
+ data2.milliseconds = mathAbs(data2.milliseconds);
+ data2.seconds = mathAbs(data2.seconds);
+ data2.minutes = mathAbs(data2.minutes);
+ data2.hours = mathAbs(data2.hours);
+ data2.months = mathAbs(data2.months);
+ data2.years = mathAbs(data2.years);
return this;
}
function addSubtract$1(duration, input, value, direction) {
@@ -3973,36 +3973,36 @@ var require_moment = __commonJS({
function subtract$1(input, value) {
return addSubtract$1(this, input, value, -1);
}
- function absCeil(number5) {
- if (number5 < 0) {
- return Math.floor(number5);
+ function absCeil(number4) {
+ if (number4 < 0) {
+ return Math.floor(number4);
} else {
- return Math.ceil(number5);
+ return Math.ceil(number4);
}
}
function bubble() {
- var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data3 = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
+ var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data2 = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) {
milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5;
days2 = 0;
months2 = 0;
}
- data3.milliseconds = milliseconds2 % 1e3;
+ data2.milliseconds = milliseconds2 % 1e3;
seconds2 = absFloor(milliseconds2 / 1e3);
- data3.seconds = seconds2 % 60;
+ data2.seconds = seconds2 % 60;
minutes2 = absFloor(seconds2 / 60);
- data3.minutes = minutes2 % 60;
+ data2.minutes = minutes2 % 60;
hours2 = absFloor(minutes2 / 60);
- data3.hours = hours2 % 24;
+ data2.hours = hours2 % 24;
days2 += absFloor(hours2 / 24);
monthsFromDays = absFloor(daysToMonths(days2));
months2 += monthsFromDays;
days2 -= absCeil(monthsToDays(monthsFromDays));
years2 = absFloor(months2 / 12);
months2 %= 12;
- data3.days = days2;
- data3.months = months2;
- data3.years = years2;
+ data2.days = days2;
+ data2.months = months2;
+ data2.years = years2;
return this;
}
function daysToMonths(days2) {
@@ -4085,8 +4085,8 @@ var require_moment = __commonJS({
w: null,
M: 11
};
- function substituteTimeAgo(string6, number5, withoutSuffix, isFuture, locale3) {
- return locale3.relativeTime(number5 || 1, !!withoutSuffix, string6, isFuture);
+ function substituteTimeAgo(string4, number4, withoutSuffix, isFuture, locale3) {
+ return locale3.relativeTime(number4 || 1, !!withoutSuffix, string4, isFuture);
}
function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale3) {
var duration = createDuration(posNegDuration).abs(), seconds2 = round3(duration.as("s")), minutes2 = round3(duration.as("m")), hours2 = round3(duration.as("h")), days2 = round3(duration.as("d")), months2 = round3(duration.as("M")), weeks2 = round3(duration.as("w")), years2 = round3(duration.as("y")), a4 = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2];
@@ -4592,7 +4592,7 @@ var require_lodash = __commonJS({
var freeParseFloat = parseFloat, freeParseInt = parseInt;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
- var root4 = freeGlobal || freeSelf || Function("return this")();
+ var root = freeGlobal || freeSelf || Function("return this")();
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
var moduleExports = freeModule && freeModule.exports === freeExports;
@@ -4622,17 +4622,17 @@ var require_lodash = __commonJS({
return func.apply(thisArg, args);
}
function arrayAggregator(array, setter, iteratee, accumulator) {
- var index3 = -1, length = array == null ? 0 : array.length;
- while (++index3 < length) {
- var value = array[index3];
+ var index2 = -1, length = array == null ? 0 : array.length;
+ while (++index2 < length) {
+ var value = array[index2];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
function arrayEach(array, iteratee) {
- var index3 = -1, length = array == null ? 0 : array.length;
- while (++index3 < length) {
- if (iteratee(array[index3], index3, array) === false) {
+ var index2 = -1, length = array == null ? 0 : array.length;
+ while (++index2 < length) {
+ if (iteratee(array[index2], index2, array) === false) {
break;
}
}
@@ -4648,19 +4648,19 @@ var require_lodash = __commonJS({
return array;
}
function arrayEvery(array, predicate) {
- var index3 = -1, length = array == null ? 0 : array.length;
- while (++index3 < length) {
- if (!predicate(array[index3], index3, array)) {
+ var index2 = -1, length = array == null ? 0 : array.length;
+ while (++index2 < length) {
+ if (!predicate(array[index2], index2, array)) {
return false;
}
}
return true;
}
function arrayFilter(array, predicate) {
- var index3 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
- while (++index3 < length) {
- var value = array[index3];
- if (predicate(value, index3, array)) {
+ var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
+ while (++index2 < length) {
+ var value = array[index2];
+ if (predicate(value, index2, 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 index3 = -1, length = array == null ? 0 : array.length;
- while (++index3 < length) {
- if (comparator(value, array[index3])) {
+ var index2 = -1, length = array == null ? 0 : array.length;
+ while (++index2 < length) {
+ if (comparator(value, array[index2])) {
return true;
}
}
return false;
}
function arrayMap(array, iteratee) {
- var index3 = -1, length = array == null ? 0 : array.length, result = Array(length);
- while (++index3 < length) {
- result[index3] = iteratee(array[index3], index3, array);
+ var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
+ while (++index2 < length) {
+ result[index2] = iteratee(array[index2], index2, array);
}
return result;
}
function arrayPush(array, values2) {
- var index3 = -1, length = values2.length, offset2 = array.length;
- while (++index3 < length) {
- array[offset2 + index3] = values2[index3];
+ var index2 = -1, length = values2.length, offset2 = array.length;
+ while (++index2 < length) {
+ array[offset2 + index2] = values2[index2];
}
return array;
}
function arrayReduce(array, iteratee, accumulator, initAccum) {
- var index3 = -1, length = array == null ? 0 : array.length;
+ var index2 = -1, length = array == null ? 0 : array.length;
if (initAccum && length) {
- accumulator = array[++index3];
+ accumulator = array[++index2];
}
- while (++index3 < length) {
- accumulator = iteratee(accumulator, array[index3], index3, array);
+ while (++index2 < length) {
+ accumulator = iteratee(accumulator, array[index2], index2, array);
}
return accumulator;
}
@@ -4714,36 +4714,36 @@ var require_lodash = __commonJS({
return accumulator;
}
function arraySome(array, predicate) {
- var index3 = -1, length = array == null ? 0 : array.length;
- while (++index3 < length) {
- if (predicate(array[index3], index3, array)) {
+ var index2 = -1, length = array == null ? 0 : array.length;
+ while (++index2 < length) {
+ if (predicate(array[index2], index2, array)) {
return true;
}
}
return false;
}
var asciiSize = baseProperty("length");
- function asciiToArray(string6) {
- return string6.split("");
+ function asciiToArray(string4) {
+ return string4.split("");
}
- function asciiWords(string6) {
- return string6.match(reAsciiWord) || [];
+ function asciiWords(string4) {
+ return string4.match(reAsciiWord) || [];
}
function baseFindKey(collection, predicate, eachFunc) {
var result;
- eachFunc(collection, function(value, key3, collection2) {
- if (predicate(value, key3, collection2)) {
- result = key3;
+ eachFunc(collection, function(value, key2, collection2) {
+ if (predicate(value, key2, collection2)) {
+ result = key2;
return false;
}
});
return result;
}
function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index3 = fromIndex + (fromRight ? 1 : -1);
- while (fromRight ? index3-- : ++index3 < length) {
- if (predicate(array[index3], index3, array)) {
- return index3;
+ var length = array.length, index2 = fromIndex + (fromRight ? 1 : -1);
+ while (fromRight ? index2-- : ++index2 < length) {
+ if (predicate(array[index2], index2, array)) {
+ return index2;
}
}
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 index3 = fromIndex - 1, length = array.length;
- while (++index3 < length) {
- if (comparator(array[index3], value)) {
- return index3;
+ var index2 = fromIndex - 1, length = array.length;
+ while (++index2 < length) {
+ if (comparator(array[index2], value)) {
+ return index2;
}
}
return -1;
@@ -4767,19 +4767,19 @@ var require_lodash = __commonJS({
var length = array == null ? 0 : array.length;
return length ? baseSum(array, iteratee) / length : NAN;
}
- function baseProperty(key3) {
+ function baseProperty(key2) {
return function(object) {
- return object == null ? undefined2 : object[key3];
+ return object == null ? undefined2 : object[key2];
};
}
function basePropertyOf(object) {
- return function(key3) {
- return object == null ? undefined2 : object[key3];
+ return function(key2) {
+ return object == null ? undefined2 : object[key2];
};
}
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
- eachFunc(collection, function(value, index3, collection2) {
- accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index3, collection2);
+ eachFunc(collection, function(value, index2, collection2) {
+ accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index2, collection2);
});
return accumulator;
}
@@ -4792,9 +4792,9 @@ var require_lodash = __commonJS({
return array;
}
function baseSum(array, iteratee) {
- var result, index3 = -1, length = array.length;
- while (++index3 < length) {
- var current3 = iteratee(array[index3]);
+ var result, index2 = -1, length = array.length;
+ while (++index2 < length) {
+ var current3 = iteratee(array[index2]);
if (current3 !== undefined2) {
result = result === undefined2 ? current3 : result + current3;
}
@@ -4802,19 +4802,19 @@ var require_lodash = __commonJS({
return result;
}
function baseTimes(n3, iteratee) {
- var index3 = -1, result = Array(n3);
- while (++index3 < n3) {
- result[index3] = iteratee(index3);
+ var index2 = -1, result = Array(n3);
+ while (++index2 < n3) {
+ result[index2] = iteratee(index2);
}
return result;
}
function baseToPairs(object, props) {
- return arrayMap(props, function(key3) {
- return [key3, object[key3]];
+ return arrayMap(props, function(key2) {
+ return [key2, object[key2]];
});
}
- function baseTrim(string6) {
- return string6 ? string6.slice(0, trimmedEndIndex(string6) + 1).replace(reTrimStart, "") : string6;
+ function baseTrim(string4) {
+ return string4 ? string4.slice(0, trimmedEndIndex(string4) + 1).replace(reTrimStart, "") : string4;
}
function baseUnary(func) {
return function(value) {
@@ -4822,24 +4822,24 @@ var require_lodash = __commonJS({
};
}
function baseValues(object, props) {
- return arrayMap(props, function(key3) {
- return object[key3];
+ return arrayMap(props, function(key2) {
+ return object[key2];
});
}
- function cacheHas(cache2, key3) {
- return cache2.has(key3);
+ function cacheHas(cache2, key2) {
+ return cache2.has(key2);
}
function charsStartIndex(strSymbols, chrSymbols) {
- var index3 = -1, length = strSymbols.length;
- while (++index3 < length && baseIndexOf(chrSymbols, strSymbols[index3], 0) > -1) {
+ var index2 = -1, length = strSymbols.length;
+ while (++index2 < length && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
}
- return index3;
+ return index2;
}
function charsEndIndex(strSymbols, chrSymbols) {
- var index3 = strSymbols.length;
- while (index3-- && baseIndexOf(chrSymbols, strSymbols[index3], 0) > -1) {
+ var index2 = strSymbols.length;
+ while (index2-- && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
}
- return index3;
+ return index2;
}
function countHolders(array, placeholder2) {
var length = array.length, result = 0;
@@ -4855,26 +4855,26 @@ var require_lodash = __commonJS({
function escapeStringChar(chr) {
return "\\" + stringEscapes[chr];
}
- function getValue(object, key3) {
- return object == null ? undefined2 : object[key3];
+ function getValue(object, key2) {
+ return object == null ? undefined2 : object[key2];
}
- function hasUnicode(string6) {
- return reHasUnicode.test(string6);
+ function hasUnicode(string4) {
+ return reHasUnicode.test(string4);
}
- function hasUnicodeWord(string6) {
- return reHasUnicodeWord.test(string6);
+ function hasUnicodeWord(string4) {
+ return reHasUnicodeWord.test(string4);
}
function iteratorToArray(iterator) {
- var data3, result = [];
- while (!(data3 = iterator.next()).done) {
- result.push(data3.value);
+ var data2, result = [];
+ while (!(data2 = iterator.next()).done) {
+ result.push(data2.value);
}
return result;
}
- function mapToArray(map6) {
- var index3 = -1, result = Array(map6.size);
- map6.forEach(function(value, key3) {
- result[++index3] = [key3, value];
+ function mapToArray(map4) {
+ var index2 = -1, result = Array(map4.size);
+ map4.forEach(function(value, key2) {
+ result[++index2] = [key2, value];
});
return result;
}
@@ -4884,81 +4884,81 @@ var require_lodash = __commonJS({
};
}
function replaceHolders(array, placeholder2) {
- var index3 = -1, length = array.length, resIndex = 0, result = [];
- while (++index3 < length) {
- var value = array[index3];
+ var index2 = -1, length = array.length, resIndex = 0, result = [];
+ while (++index2 < length) {
+ var value = array[index2];
if (value === placeholder2 || value === PLACEHOLDER) {
- array[index3] = PLACEHOLDER;
- result[resIndex++] = index3;
+ array[index2] = PLACEHOLDER;
+ result[resIndex++] = index2;
}
}
return result;
}
function setToArray(set) {
- var index3 = -1, result = Array(set.size);
+ var index2 = -1, result = Array(set.size);
set.forEach(function(value) {
- result[++index3] = value;
+ result[++index2] = value;
});
return result;
}
function setToPairs(set) {
- var index3 = -1, result = Array(set.size);
+ var index2 = -1, result = Array(set.size);
set.forEach(function(value) {
- result[++index3] = [value, value];
+ result[++index2] = [value, value];
});
return result;
}
function strictIndexOf(array, value, fromIndex) {
- var index3 = fromIndex - 1, length = array.length;
- while (++index3 < length) {
- if (array[index3] === value) {
- return index3;
+ var index2 = fromIndex - 1, length = array.length;
+ while (++index2 < length) {
+ if (array[index2] === value) {
+ return index2;
}
}
return -1;
}
function strictLastIndexOf(array, value, fromIndex) {
- var index3 = fromIndex + 1;
- while (index3--) {
- if (array[index3] === value) {
- return index3;
+ var index2 = fromIndex + 1;
+ while (index2--) {
+ if (array[index2] === value) {
+ return index2;
}
}
- return index3;
+ return index2;
}
- function stringSize(string6) {
- return hasUnicode(string6) ? unicodeSize(string6) : asciiSize(string6);
+ function stringSize(string4) {
+ return hasUnicode(string4) ? unicodeSize(string4) : asciiSize(string4);
}
- function stringToArray(string6) {
- return hasUnicode(string6) ? unicodeToArray(string6) : asciiToArray(string6);
+ function stringToArray(string4) {
+ return hasUnicode(string4) ? unicodeToArray(string4) : asciiToArray(string4);
}
- function trimmedEndIndex(string6) {
- var index3 = string6.length;
- while (index3-- && reWhitespace.test(string6.charAt(index3))) {
+ function trimmedEndIndex(string4) {
+ var index2 = string4.length;
+ while (index2-- && reWhitespace.test(string4.charAt(index2))) {
}
- return index3;
+ return index2;
}
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
- function unicodeSize(string6) {
+ function unicodeSize(string4) {
var result = reUnicode.lastIndex = 0;
- while (reUnicode.test(string6)) {
+ while (reUnicode.test(string4)) {
++result;
}
return result;
}
- function unicodeToArray(string6) {
- return string6.match(reUnicode) || [];
+ function unicodeToArray(string4) {
+ return string4.match(reUnicode) || [];
}
- function unicodeWords(string6) {
- return string6.match(reUnicodeWord) || [];
+ function unicodeWords(string4) {
+ return string4.match(reUnicodeWord) || [];
}
var runInContext = function runInContext2(context) {
- context = context == null ? root4 : _15.defaults(root4.Object(), context, _15.pick(root4, contextProps));
+ context = context == null ? root : _15.defaults(root.Object(), context, _15.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__"];
var funcToString = funcProto.toString;
- var hasOwnProperty4 = objectProto.hasOwnProperty;
+ var hasOwnProperty3 = objectProto.hasOwnProperty;
var idCounter = 0;
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
@@ -4966,11 +4966,11 @@ var require_lodash = __commonJS({
}();
var nativeObjectToString = objectProto.toString;
var objectCtorString = funcToString.call(Object2);
- var oldDash = root4._;
+ var oldDash = root._;
var reIsNative = RegExp2(
- "^" + funcToString.call(hasOwnProperty4).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
+ "^" + funcToString.call(hasOwnProperty3).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
- var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice2 = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
+ var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
var defineProperty = function() {
try {
var func = getNative(Object2, "defineProperty");
@@ -4979,7 +4979,7 @@ var require_lodash = __commonJS({
} catch (e5) {
}
}();
- var ctxClearTimeout = context.clearTimeout !== root4.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root4.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root4.setTimeout && context.setTimeout;
+ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
var metaMap = WeakMap2 && new WeakMap2();
@@ -4991,7 +4991,7 @@ var require_lodash = __commonJS({
if (value instanceof LodashWrapper) {
return value;
}
- if (hasOwnProperty4.call(value, "__wrapped__")) {
+ if (hasOwnProperty3.call(value, "__wrapped__")) {
return wrapperClone(value);
}
}
@@ -5066,17 +5066,17 @@ 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, index3 = 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, index2 = 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) {
- index3 += dir;
- var iterIndex = -1, value = array[index3];
+ index2 += dir;
+ var iterIndex = -1, value = array[index2];
while (++iterIndex < iterLength) {
- var data3 = iteratees[iterIndex], iteratee2 = data3.iteratee, type = data3.type, computed = iteratee2(value);
+ var data2 = iteratees[iterIndex], iteratee2 = data2.iteratee, type = data2.type, computed = iteratee2(value);
if (type == LAZY_MAP_FLAG) {
value = computed;
} else if (!computed) {
@@ -5094,10 +5094,10 @@ var require_lodash = __commonJS({
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
function Hash(entries) {
- var index3 = -1, length = entries == null ? 0 : entries.length;
+ var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
- while (++index3 < length) {
- var entry = entries[index3];
+ while (++index2 < length) {
+ var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
@@ -5105,27 +5105,27 @@ var require_lodash = __commonJS({
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
- function hashDelete(key3) {
- var result2 = this.has(key3) && delete this.__data__[key3];
+ function hashDelete(key2) {
+ var result2 = this.has(key2) && delete this.__data__[key2];
this.size -= result2 ? 1 : 0;
return result2;
}
- function hashGet(key3) {
- var data3 = this.__data__;
+ function hashGet(key2) {
+ var data2 = this.__data__;
if (nativeCreate) {
- var result2 = data3[key3];
+ var result2 = data2[key2];
return result2 === HASH_UNDEFINED ? undefined2 : result2;
}
- return hasOwnProperty4.call(data3, key3) ? data3[key3] : undefined2;
+ return hasOwnProperty3.call(data2, key2) ? data2[key2] : undefined2;
}
- function hashHas(key3) {
- var data3 = this.__data__;
- return nativeCreate ? data3[key3] !== undefined2 : hasOwnProperty4.call(data3, key3);
+ function hashHas(key2) {
+ var data2 = this.__data__;
+ return nativeCreate ? data2[key2] !== undefined2 : hasOwnProperty3.call(data2, key2);
}
- function hashSet(key3, value) {
- var data3 = this.__data__;
- this.size += this.has(key3) ? 0 : 1;
- data3[key3] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
+ function hashSet(key2, value) {
+ var data2 = this.__data__;
+ this.size += this.has(key2) ? 0 : 1;
+ data2[key2] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
return this;
}
Hash.prototype.clear = hashClear;
@@ -5134,10 +5134,10 @@ var require_lodash = __commonJS({
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
- var index3 = -1, length = entries == null ? 0 : entries.length;
+ var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
- while (++index3 < length) {
- var entry = entries[index3];
+ while (++index2 < length) {
+ var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
@@ -5145,34 +5145,34 @@ var require_lodash = __commonJS({
this.__data__ = [];
this.size = 0;
}
- function listCacheDelete(key3) {
- var data3 = this.__data__, index3 = assocIndexOf(data3, key3);
- if (index3 < 0) {
+ function listCacheDelete(key2) {
+ var data2 = this.__data__, index2 = assocIndexOf(data2, key2);
+ if (index2 < 0) {
return false;
}
- var lastIndex = data3.length - 1;
- if (index3 == lastIndex) {
- data3.pop();
+ var lastIndex = data2.length - 1;
+ if (index2 == lastIndex) {
+ data2.pop();
} else {
- splice2.call(data3, index3, 1);
+ splice.call(data2, index2, 1);
}
--this.size;
return true;
}
- function listCacheGet(key3) {
- var data3 = this.__data__, index3 = assocIndexOf(data3, key3);
- return index3 < 0 ? undefined2 : data3[index3][1];
+ function listCacheGet(key2) {
+ var data2 = this.__data__, index2 = assocIndexOf(data2, key2);
+ return index2 < 0 ? undefined2 : data2[index2][1];
}
- function listCacheHas(key3) {
- return assocIndexOf(this.__data__, key3) > -1;
+ function listCacheHas(key2) {
+ return assocIndexOf(this.__data__, key2) > -1;
}
- function listCacheSet(key3, value) {
- var data3 = this.__data__, index3 = assocIndexOf(data3, key3);
- if (index3 < 0) {
+ function listCacheSet(key2, value) {
+ var data2 = this.__data__, index2 = assocIndexOf(data2, key2);
+ if (index2 < 0) {
++this.size;
- data3.push([key3, value]);
+ data2.push([key2, value]);
} else {
- data3[index3][1] = value;
+ data2[index2][1] = value;
}
return this;
}
@@ -5182,10 +5182,10 @@ var require_lodash = __commonJS({
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
- var index3 = -1, length = entries == null ? 0 : entries.length;
+ var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
- while (++index3 < length) {
- var entry = entries[index3];
+ while (++index2 < length) {
+ var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
@@ -5197,21 +5197,21 @@ var require_lodash = __commonJS({
"string": new Hash()
};
}
- function mapCacheDelete(key3) {
- var result2 = getMapData(this, key3)["delete"](key3);
+ function mapCacheDelete(key2) {
+ var result2 = getMapData(this, key2)["delete"](key2);
this.size -= result2 ? 1 : 0;
return result2;
}
- function mapCacheGet(key3) {
- return getMapData(this, key3).get(key3);
+ function mapCacheGet(key2) {
+ return getMapData(this, key2).get(key2);
}
- function mapCacheHas(key3) {
- return getMapData(this, key3).has(key3);
+ function mapCacheHas(key2) {
+ return getMapData(this, key2).has(key2);
}
- function mapCacheSet(key3, value) {
- var data3 = getMapData(this, key3), size3 = data3.size;
- data3.set(key3, value);
- this.size += data3.size == size3 ? 0 : 1;
+ function mapCacheSet(key2, value) {
+ var data2 = getMapData(this, key2), size3 = data2.size;
+ data2.set(key2, value);
+ this.size += data2.size == size3 ? 0 : 1;
return this;
}
MapCache.prototype.clear = mapCacheClear;
@@ -5220,10 +5220,10 @@ var require_lodash = __commonJS({
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values3) {
- var index3 = -1, length = values3 == null ? 0 : values3.length;
+ var index2 = -1, length = values3 == null ? 0 : values3.length;
this.__data__ = new MapCache();
- while (++index3 < length) {
- this.add(values3[index3]);
+ while (++index2 < length) {
+ this.add(values3[index2]);
}
}
function setCacheAdd(value) {
@@ -5236,37 +5236,37 @@ var require_lodash = __commonJS({
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function Stack2(entries) {
- var data3 = this.__data__ = new ListCache(entries);
- this.size = data3.size;
+ var data2 = this.__data__ = new ListCache(entries);
+ this.size = data2.size;
}
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
- function stackDelete(key3) {
- var data3 = this.__data__, result2 = data3["delete"](key3);
- this.size = data3.size;
+ function stackDelete(key2) {
+ var data2 = this.__data__, result2 = data2["delete"](key2);
+ this.size = data2.size;
return result2;
}
- function stackGet(key3) {
- return this.__data__.get(key3);
+ function stackGet(key2) {
+ return this.__data__.get(key2);
}
- function stackHas(key3) {
- return this.__data__.has(key3);
+ function stackHas(key2) {
+ return this.__data__.has(key2);
}
- function stackSet(key3, value) {
- var data3 = this.__data__;
- if (data3 instanceof ListCache) {
- var pairs = data3.__data__;
+ function stackSet(key2, value) {
+ var data2 = this.__data__;
+ if (data2 instanceof ListCache) {
+ var pairs = data2.__data__;
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
- pairs.push([key3, value]);
- this.size = ++data3.size;
+ pairs.push([key2, value]);
+ this.size = ++data2.size;
return this;
}
- data3 = this.__data__ = new MapCache(pairs);
+ data2 = this.__data__ = new MapCache(pairs);
}
- data3.set(key3, value);
- this.size = data3.size;
+ data2.set(key2, value);
+ this.size = data2.size;
return this;
}
Stack2.prototype.clear = stackClear;
@@ -5275,10 +5275,10 @@ var require_lodash = __commonJS({
Stack2.prototype.has = stackHas;
Stack2.prototype.set = stackSet;
function arrayLikeKeys(value, inherited) {
- var isArr = isArray5(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
- for (var key3 in value) {
- if ((inherited || hasOwnProperty4.call(value, key3)) && !(skipIndexes && (key3 == "length" || isBuff && (key3 == "offset" || key3 == "parent") || isType && (key3 == "buffer" || key3 == "byteLength" || key3 == "byteOffset") || isIndex2(key3, length)))) {
- result2.push(key3);
+ var isArr = isArray5(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
+ for (var key2 in value) {
+ if ((inherited || hasOwnProperty3.call(value, key2)) && !(skipIndexes && (key2 == "length" || isBuff && (key2 == "offset" || key2 == "parent") || isType && (key2 == "buffer" || key2 == "byteLength" || key2 == "byteOffset") || isIndex2(key2, length)))) {
+ result2.push(key2);
}
}
return result2;
@@ -5293,72 +5293,72 @@ var require_lodash = __commonJS({
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
}
- function assignMergeValue(object, key3, value) {
- if (value !== undefined2 && !eq(object[key3], value) || value === undefined2 && !(key3 in object)) {
- baseAssignValue(object, key3, value);
+ function assignMergeValue(object, key2, value) {
+ if (value !== undefined2 && !eq(object[key2], value) || value === undefined2 && !(key2 in object)) {
+ baseAssignValue(object, key2, value);
}
}
- function assignValue(object, key3, value) {
- var objValue = object[key3];
- if (!(hasOwnProperty4.call(object, key3) && eq(objValue, value)) || value === undefined2 && !(key3 in object)) {
- baseAssignValue(object, key3, value);
+ function assignValue(object, key2, value) {
+ var objValue = object[key2];
+ if (!(hasOwnProperty3.call(object, key2) && eq(objValue, value)) || value === undefined2 && !(key2 in object)) {
+ baseAssignValue(object, key2, value);
}
}
- function assocIndexOf(array, key3) {
+ function assocIndexOf(array, key2) {
var length = array.length;
while (length--) {
- if (eq(array[length][0], key3)) {
+ if (eq(array[length][0], key2)) {
return length;
}
}
return -1;
}
function baseAggregator(collection, setter, iteratee2, accumulator) {
- baseEach(collection, function(value, key3, collection2) {
+ baseEach(collection, function(value, key2, collection2) {
setter(accumulator, value, iteratee2(value), collection2);
});
return accumulator;
}
function baseAssign(object, source) {
- return object && copyObject(source, keys2(source), object);
+ return object && copyObject(source, keys(source), object);
}
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
- function baseAssignValue(object, key3, value) {
- if (key3 == "__proto__" && defineProperty) {
- defineProperty(object, key3, {
+ function baseAssignValue(object, key2, value) {
+ if (key2 == "__proto__" && defineProperty) {
+ defineProperty(object, key2, {
"configurable": true,
"enumerable": true,
"value": value,
"writable": true
});
} else {
- object[key3] = value;
+ object[key2] = value;
}
}
function baseAt(object, paths) {
- var index3 = -1, length = paths.length, result2 = Array2(length), skip = object == null;
- while (++index3 < length) {
- result2[index3] = skip ? undefined2 : get2(object, paths[index3]);
+ var index2 = -1, length = paths.length, result2 = Array2(length), skip = object == null;
+ while (++index2 < length) {
+ result2[index2] = skip ? undefined2 : get2(object, paths[index2]);
}
return result2;
}
- function baseClamp(number5, lower, upper) {
- if (number5 === number5) {
+ function baseClamp(number4, lower, upper) {
+ if (number4 === number4) {
if (upper !== undefined2) {
- number5 = number5 <= upper ? number5 : upper;
+ number4 = number4 <= upper ? number4 : upper;
}
if (lower !== undefined2) {
- number5 = number5 >= lower ? number5 : lower;
+ number4 = number4 >= lower ? number4 : lower;
}
}
- return number5;
+ return number4;
}
- function baseClone(value, bitmask, customizer, key3, object, stack) {
+ function baseClone(value, bitmask, customizer, key2, object, stack) {
var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
- result2 = object ? customizer(value, key3, object, stack) : customizer(value);
+ result2 = object ? customizer(value, key2, object, stack) : customizer(value);
}
if (result2 !== undefined2) {
return result2;
@@ -5374,7 +5374,7 @@ var require_lodash = __commonJS({
}
} else {
var tag2 = getTag2(value), isFunc = tag2 == funcTag || tag2 == genTag;
- if (isBuffer2(value)) {
+ if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag2 == objectTag || tag2 == argsTag || isFunc && !object) {
@@ -5400,23 +5400,23 @@ var require_lodash = __commonJS({
result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap2(value)) {
- value.forEach(function(subValue, key4) {
- result2.set(key4, baseClone(subValue, bitmask, customizer, key4, value, stack));
+ value.forEach(function(subValue, key3) {
+ result2.set(key3, baseClone(subValue, bitmask, customizer, key3, value, stack));
});
}
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys2;
+ var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
var props = isArr ? undefined2 : keysFunc(value);
- arrayEach(props || value, function(subValue, key4) {
+ arrayEach(props || value, function(subValue, key3) {
if (props) {
- key4 = subValue;
- subValue = value[key4];
+ key3 = subValue;
+ subValue = value[key3];
}
- assignValue(result2, key4, baseClone(subValue, bitmask, customizer, key4, value, stack));
+ assignValue(result2, key3, baseClone(subValue, bitmask, customizer, key3, value, stack));
});
return result2;
}
function baseConforms(source) {
- var props = keys2(source);
+ var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
@@ -5428,8 +5428,8 @@ var require_lodash = __commonJS({
}
object = Object2(object);
while (length--) {
- var key3 = props[length], predicate = source[key3], value = object[key3];
- if (value === undefined2 && !(key3 in object) || !predicate(value)) {
+ var key2 = props[length], predicate = source[key2], value = object[key2];
+ if (value === undefined2 && !(key2 in object) || !predicate(value)) {
return false;
}
}
@@ -5444,7 +5444,7 @@ var require_lodash = __commonJS({
}, wait);
}
function baseDifference(array, values3, iteratee2, comparator) {
- var index3 = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values3.length;
+ var index2 = -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 (++index3 < length) {
- var value = array[index3], computed = iteratee2 == null ? value : iteratee2(value);
+ while (++index2 < length) {
+ var value = array[index2], 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, index3, collection2) {
- result2 = !!predicate(value, index3, collection2);
+ baseEach(collection, function(value, index2, collection2) {
+ result2 = !!predicate(value, index2, collection2);
return result2;
});
return result2;
}
function baseExtremum(array, iteratee2, comparator) {
- var index3 = -1, length = array.length;
- while (++index3 < length) {
- var value = array[index3], current3 = iteratee2(value);
+ var index2 = -1, length = array.length;
+ while (++index2 < length) {
+ var value = array[index2], 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, index3, collection2) {
- if (predicate(value, index3, collection2)) {
+ baseEach(collection, function(value, index2, collection2) {
+ if (predicate(value, index2, collection2)) {
result2.push(value);
}
});
return result2;
}
function baseFlatten(array, depth, predicate, isStrict, result2) {
- var index3 = -1, length = array.length;
+ var index2 = -1, length = array.length;
predicate || (predicate = isFlattenable);
result2 || (result2 = []);
- while (++index3 < length) {
- var value = array[index3];
+ while (++index2 < length) {
+ var value = array[index2];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
baseFlatten(value, depth - 1, predicate, isStrict, result2);
@@ -5543,23 +5543,23 @@ var require_lodash = __commonJS({
var baseFor = createBaseFor();
var baseForRight = createBaseFor(true);
function baseForOwn(object, iteratee2) {
- return object && baseFor(object, iteratee2, keys2);
+ return object && baseFor(object, iteratee2, keys);
}
function baseForOwnRight(object, iteratee2) {
- return object && baseForRight(object, iteratee2, keys2);
+ return object && baseForRight(object, iteratee2, keys);
}
function baseFunctions(object, props) {
- return arrayFilter(props, function(key3) {
- return isFunction3(object[key3]);
+ return arrayFilter(props, function(key2) {
+ return isFunction3(object[key2]);
});
}
- function baseGet(object, path3) {
- path3 = castPath(path3, object);
- var index3 = 0, length = path3.length;
- while (object != null && index3 < length) {
- object = object[toKey(path3[index3++])];
+ function baseGet(object, path2) {
+ path2 = castPath(path2, object);
+ var index2 = 0, length = path2.length;
+ while (object != null && index2 < length) {
+ object = object[toKey(path2[index2++])];
}
- return index3 && index3 == length ? object : undefined2;
+ return index2 && index2 == length ? object : undefined2;
}
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result2 = keysFunc(object);
@@ -5574,14 +5574,14 @@ var require_lodash = __commonJS({
function baseGt(value, other) {
return value > other;
}
- function baseHas(object, key3) {
- return object != null && hasOwnProperty4.call(object, key3);
+ function baseHas(object, key2) {
+ return object != null && hasOwnProperty3.call(object, key2);
}
- function baseHasIn(object, key3) {
- return object != null && key3 in Object2(object);
+ function baseHasIn(object, key2) {
+ return object != null && key2 in Object2(object);
}
- function baseInRange(number5, start, end) {
- return number5 >= nativeMin(start, end) && number5 < nativeMax(start, end);
+ function baseInRange(number4, start, end) {
+ return number4 >= nativeMin(start, end) && number4 < nativeMax(start, end);
}
function baseIntersection(arrays, iteratee2, comparator) {
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
@@ -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 index3 = -1, seen = caches[0];
+ var index2 = -1, seen = caches[0];
outer:
- while (++index3 < length && result2.length < maxLength) {
- var value = array[index3], computed = iteratee2 ? iteratee2(value) : value;
+ while (++index2 < length && result2.length < maxLength) {
+ var value = array[index2], computed = iteratee2 ? iteratee2(value) : value;
value = comparator || value !== 0 ? value : 0;
if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
othIndex = othLength;
@@ -5616,15 +5616,15 @@ var require_lodash = __commonJS({
return result2;
}
function baseInverter(object, setter, iteratee2, accumulator) {
- baseForOwn(object, function(value, key3, object2) {
- setter(accumulator, iteratee2(value), key3, object2);
+ baseForOwn(object, function(value, key2, object2) {
+ setter(accumulator, iteratee2(value), key2, object2);
});
return accumulator;
}
- function baseInvoke(object, path3, args) {
- path3 = castPath(path3, object);
- object = parent(object, path3);
- var func = object == null ? object : object[toKey(last(path3))];
+ function baseInvoke(object, path2, args) {
+ path2 = castPath(path2, object);
+ object = parent(object, path2);
+ var func = object == null ? object : object[toKey(last(path2))];
return func == null ? undefined2 : apply2(func, object, args);
}
function baseIsArguments(value) {
@@ -5650,8 +5650,8 @@ var require_lodash = __commonJS({
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
- if (isSameTag && isBuffer2(object)) {
- if (!isBuffer2(other)) {
+ if (isSameTag && isBuffer(object)) {
+ if (!isBuffer(other)) {
return false;
}
objIsArr = true;
@@ -5662,7 +5662,7 @@ var require_lodash = __commonJS({
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty4.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty4.call(other, "__wrapped__");
+ var objIsWrapped = objIsObj && hasOwnProperty3.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty3.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack2());
@@ -5679,28 +5679,28 @@ var require_lodash = __commonJS({
return isObjectLike2(value) && getTag2(value) == mapTag;
}
function baseIsMatch(object, source, matchData, customizer) {
- var index3 = matchData.length, length = index3, noCustomizer = !customizer;
+ var index2 = matchData.length, length = index2, noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object2(object);
- while (index3--) {
- var data3 = matchData[index3];
- if (noCustomizer && data3[2] ? data3[1] !== object[data3[0]] : !(data3[0] in object)) {
+ while (index2--) {
+ var data2 = matchData[index2];
+ if (noCustomizer && data2[2] ? data2[1] !== object[data2[0]] : !(data2[0] in object)) {
return false;
}
}
- while (++index3 < length) {
- data3 = matchData[index3];
- var key3 = data3[0], objValue = object[key3], srcValue = data3[1];
- if (noCustomizer && data3[2]) {
- if (objValue === undefined2 && !(key3 in object)) {
+ while (++index2 < length) {
+ data2 = matchData[index2];
+ var key2 = data2[0], objValue = object[key2], srcValue = data2[1];
+ if (noCustomizer && data2[2]) {
+ if (objValue === undefined2 && !(key2 in object)) {
return false;
}
} else {
var stack = new Stack2();
if (customizer) {
- var result2 = customizer(objValue, srcValue, key3, object, source, stack);
+ var result2 = customizer(objValue, srcValue, key2, object, source, stack);
}
if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
return false;
@@ -5742,9 +5742,9 @@ var require_lodash = __commonJS({
return nativeKeys(object);
}
var result2 = [];
- for (var key3 in Object2(object)) {
- if (hasOwnProperty4.call(object, key3) && key3 != "constructor") {
- result2.push(key3);
+ for (var key2 in Object2(object)) {
+ if (hasOwnProperty3.call(object, key2) && key2 != "constructor") {
+ result2.push(key2);
}
}
return result2;
@@ -5754,9 +5754,9 @@ var require_lodash = __commonJS({
return nativeKeysIn(object);
}
var isProto = isPrototype(object), result2 = [];
- for (var key3 in object) {
- if (!(key3 == "constructor" && (isProto || !hasOwnProperty4.call(object, key3)))) {
- result2.push(key3);
+ for (var key2 in object) {
+ if (!(key2 == "constructor" && (isProto || !hasOwnProperty3.call(object, key2)))) {
+ result2.push(key2);
}
}
return result2;
@@ -5765,9 +5765,9 @@ var require_lodash = __commonJS({
return value < other;
}
function baseMap(collection, iteratee2) {
- var index3 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : [];
- baseEach(collection, function(value, key3, collection2) {
- result2[++index3] = iteratee2(value, key3, collection2);
+ var index2 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : [];
+ baseEach(collection, function(value, key2, collection2) {
+ result2[++index2] = iteratee2(value, key2, collection2);
});
return result2;
}
@@ -5780,42 +5780,42 @@ var require_lodash = __commonJS({
return object === source || baseIsMatch(object, source, matchData);
};
}
- function baseMatchesProperty(path3, srcValue) {
- if (isKey(path3) && isStrictComparable(srcValue)) {
- return matchesStrictComparable(toKey(path3), srcValue);
+ function baseMatchesProperty(path2, srcValue) {
+ if (isKey(path2) && isStrictComparable(srcValue)) {
+ return matchesStrictComparable(toKey(path2), srcValue);
}
return function(object) {
- var objValue = get2(object, path3);
- return objValue === undefined2 && objValue === srcValue ? hasIn(object, path3) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
+ var objValue = get2(object, path2);
+ return objValue === undefined2 && objValue === srcValue ? hasIn(object, path2) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
- baseFor(source, function(srcValue, key3) {
+ baseFor(source, function(srcValue, key2) {
stack || (stack = new Stack2());
if (isObject4(srcValue)) {
- baseMergeDeep(object, source, key3, srcIndex, baseMerge, customizer, stack);
+ baseMergeDeep(object, source, key2, srcIndex, baseMerge, customizer, stack);
} else {
- var newValue = customizer ? customizer(safeGet(object, key3), srcValue, key3 + "", object, source, stack) : undefined2;
+ var newValue = customizer ? customizer(safeGet(object, key2), srcValue, key2 + "", object, source, stack) : undefined2;
if (newValue === undefined2) {
newValue = srcValue;
}
- assignMergeValue(object, key3, newValue);
+ assignMergeValue(object, key2, newValue);
}
}, keysIn);
}
- function baseMergeDeep(object, source, key3, srcIndex, mergeFunc, customizer, stack) {
- var objValue = safeGet(object, key3), srcValue = safeGet(source, key3), stacked = stack.get(srcValue);
+ function baseMergeDeep(object, source, key2, srcIndex, mergeFunc, customizer, stack) {
+ var objValue = safeGet(object, key2), srcValue = safeGet(source, key2), stacked = stack.get(srcValue);
if (stacked) {
- assignMergeValue(object, key3, stacked);
+ assignMergeValue(object, key2, stacked);
return;
}
- var newValue = customizer ? customizer(objValue, srcValue, key3 + "", object, source, stack) : undefined2;
+ var newValue = customizer ? customizer(objValue, srcValue, key2 + "", object, source, stack) : undefined2;
var isCommon = newValue === undefined2;
if (isCommon) {
- var isArr = isArray5(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
+ var isArr = isArray5(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray5(objValue)) {
@@ -5831,7 +5831,7 @@ var require_lodash = __commonJS({
} else {
newValue = [];
}
- } else if (isPlainObject3(srcValue) || isArguments(srcValue)) {
+ } else if (isPlainObject2(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
@@ -5847,7 +5847,7 @@ var require_lodash = __commonJS({
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack["delete"](srcValue);
}
- assignMergeValue(object, key3, newValue);
+ assignMergeValue(object, key2, newValue);
}
function baseNth(array, n3) {
var length = array.length;
@@ -5870,53 +5870,53 @@ var require_lodash = __commonJS({
} else {
iteratees = [identity2];
}
- var index3 = -1;
+ var index2 = -1;
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
- var result2 = baseMap(collection, function(value, key3, collection2) {
+ var result2 = baseMap(collection, function(value, key2, collection2) {
var criteria = arrayMap(iteratees, function(iteratee2) {
return iteratee2(value);
});
- return { "criteria": criteria, "index": ++index3, "value": value };
+ return { "criteria": criteria, "index": ++index2, "value": value };
});
return baseSortBy(result2, function(object, other) {
return compareMultiple(object, other, orders);
});
}
function basePick(object, paths) {
- return basePickBy(object, paths, function(value, path3) {
- return hasIn(object, path3);
+ return basePickBy(object, paths, function(value, path2) {
+ return hasIn(object, path2);
});
}
function basePickBy(object, paths, predicate) {
- var index3 = -1, length = paths.length, result2 = {};
- while (++index3 < length) {
- var path3 = paths[index3], value = baseGet(object, path3);
- if (predicate(value, path3)) {
- baseSet(result2, castPath(path3, object), value);
+ var index2 = -1, length = paths.length, result2 = {};
+ while (++index2 < length) {
+ var path2 = paths[index2], value = baseGet(object, path2);
+ if (predicate(value, path2)) {
+ baseSet(result2, castPath(path2, object), value);
}
}
return result2;
}
- function basePropertyDeep(path3) {
+ function basePropertyDeep(path2) {
return function(object) {
- return baseGet(object, path3);
+ return baseGet(object, path2);
};
}
function basePullAll(array, values3, iteratee2, comparator) {
- var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index3 = -1, length = values3.length, seen = array;
+ var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index2 = -1, length = values3.length, seen = array;
if (array === values3) {
values3 = copyArray(values3);
}
if (iteratee2) {
seen = arrayMap(array, baseUnary(iteratee2));
}
- while (++index3 < length) {
- var fromIndex = 0, value = values3[index3], computed = iteratee2 ? iteratee2(value) : value;
+ while (++index2 < length) {
+ var fromIndex = 0, value = values3[index2], computed = iteratee2 ? iteratee2(value) : value;
while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
- splice2.call(seen, fromIndex, 1);
+ splice.call(seen, fromIndex, 1);
}
- splice2.call(array, fromIndex, 1);
+ splice.call(array, fromIndex, 1);
}
}
return array;
@@ -5924,13 +5924,13 @@ var require_lodash = __commonJS({
function basePullAt(array, indexes) {
var length = array ? indexes.length : 0, lastIndex = length - 1;
while (length--) {
- var index3 = indexes[length];
- if (length == lastIndex || index3 !== previous2) {
- var previous2 = index3;
- if (isIndex2(index3)) {
- splice2.call(array, index3, 1);
+ var index2 = indexes[length];
+ if (length == lastIndex || index2 !== previous) {
+ var previous = index2;
+ if (isIndex2(index2)) {
+ splice.call(array, index2, 1);
} else {
- baseUnset(array, index3);
+ baseUnset(array, index2);
}
}
}
@@ -5940,25 +5940,25 @@ var require_lodash = __commonJS({
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
}
function baseRange(start, end, step, fromRight) {
- var index3 = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length);
+ var index2 = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length);
while (length--) {
- result2[fromRight ? length : ++index3] = start;
+ result2[fromRight ? length : ++index2] = start;
start += step;
}
return result2;
}
- function baseRepeat(string6, n3) {
+ function baseRepeat(string4, n3) {
var result2 = "";
- if (!string6 || n3 < 1 || n3 > MAX_SAFE_INTEGER2) {
+ if (!string4 || n3 < 1 || n3 > MAX_SAFE_INTEGER2) {
return result2;
}
do {
if (n3 % 2) {
- result2 += string6;
+ result2 += string4;
}
n3 = nativeFloor(n3 / 2);
if (n3) {
- string6 += string6;
+ string4 += string4;
}
} while (n3);
return result2;
@@ -5973,38 +5973,38 @@ var require_lodash = __commonJS({
var array = values2(collection);
return shuffleSelf(array, baseClamp(n3, 0, array.length));
}
- function baseSet(object, path3, value, customizer) {
+ function baseSet(object, path2, value, customizer) {
if (!isObject4(object)) {
return object;
}
- path3 = castPath(path3, object);
- var index3 = -1, length = path3.length, lastIndex = length - 1, nested = object;
- while (nested != null && ++index3 < length) {
- var key3 = toKey(path3[index3]), newValue = value;
- if (key3 === "__proto__" || key3 === "constructor" || key3 === "prototype") {
+ 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;
+ if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") {
return object;
}
- if (index3 != lastIndex) {
- var objValue = nested[key3];
- newValue = customizer ? customizer(objValue, key3, nested) : undefined2;
+ if (index2 != lastIndex) {
+ var objValue = nested[key2];
+ newValue = customizer ? customizer(objValue, key2, nested) : undefined2;
if (newValue === undefined2) {
- newValue = isObject4(objValue) ? objValue : isIndex2(path3[index3 + 1]) ? [] : {};
+ newValue = isObject4(objValue) ? objValue : isIndex2(path2[index2 + 1]) ? [] : {};
}
}
- assignValue(nested, key3, newValue);
- nested = nested[key3];
+ assignValue(nested, key2, newValue);
+ nested = nested[key2];
}
return object;
}
- var baseSetData = !metaMap ? identity2 : function(func, data3) {
- metaMap.set(func, data3);
+ var baseSetData = !metaMap ? identity2 : function(func, data2) {
+ metaMap.set(func, data2);
return func;
};
- var baseSetToString = !defineProperty ? identity2 : function(func, string6) {
+ var baseSetToString = !defineProperty ? identity2 : function(func, string4) {
return defineProperty(func, "toString", {
"configurable": true,
"enumerable": false,
- "value": constant(string6),
+ "value": constant(string4),
"writable": true
});
};
@@ -6012,7 +6012,7 @@ var require_lodash = __commonJS({
return shuffleSelf(values2(collection));
}
function baseSlice(array, start, end) {
- var index3 = -1, length = array.length;
+ var index2 = -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 (++index3 < length) {
- result2[index3] = array[index3 + start];
+ while (++index2 < length) {
+ result2[index2] = array[index2 + start];
}
return result2;
}
function baseSome(collection, predicate) {
var result2;
- baseEach(collection, function(value, index3, collection2) {
- result2 = predicate(value, index3, collection2);
+ baseEach(collection, function(value, index2, collection2) {
+ result2 = predicate(value, index2, collection2);
return !result2;
});
return !!result2;
@@ -6082,10 +6082,10 @@ var require_lodash = __commonJS({
return nativeMin(high, MAX_ARRAY_INDEX);
}
function baseSortedUniq(array, iteratee2) {
- 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 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 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 index3 = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
+ var index2 = -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 (++index3 < length) {
- var value = array[index3], computed = iteratee2 ? iteratee2(value) : value;
+ while (++index2 < length) {
+ var value = array[index2], computed = iteratee2 ? iteratee2(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
@@ -6154,19 +6154,19 @@ var require_lodash = __commonJS({
}
return result2;
}
- function baseUnset(object, path3) {
- path3 = castPath(path3, object);
- object = parent(object, path3);
- return object == null || delete object[toKey(last(path3))];
+ function baseUnset(object, path2) {
+ path2 = castPath(path2, object);
+ object = parent(object, path2);
+ return object == null || delete object[toKey(last(path2))];
}
- function baseUpdate(object, path3, updater, customizer) {
- return baseSet(object, path3, updater(baseGet(object, path3)), customizer);
+ function baseUpdate(object, path2, updater, customizer) {
+ return baseSet(object, path2, updater(baseGet(object, path2)), customizer);
}
function baseWhile(array, predicate, isDrop, fromRight) {
- var length = array.length, index3 = fromRight ? length : -1;
- while ((fromRight ? index3-- : ++index3 < length) && predicate(array[index3], index3, array)) {
+ var length = array.length, index2 = fromRight ? length : -1;
+ while ((fromRight ? index2-- : ++index2 < length) && predicate(array[index2], index2, array)) {
}
- return isDrop ? baseSlice(array, fromRight ? 0 : index3, fromRight ? index3 + 1 : length) : baseSlice(array, fromRight ? index3 + 1 : 0, fromRight ? length : index3);
+ return isDrop ? baseSlice(array, fromRight ? 0 : index2, fromRight ? index2 + 1 : length) : baseSlice(array, fromRight ? index2 + 1 : 0, fromRight ? length : index2);
}
function baseWrapperValue(value, actions) {
var result2 = value;
@@ -6182,22 +6182,22 @@ var require_lodash = __commonJS({
if (length < 2) {
return length ? baseUniq(arrays[0]) : [];
}
- var index3 = -1, result2 = Array2(length);
- while (++index3 < length) {
- var array = arrays[index3], othIndex = -1;
+ var index2 = -1, result2 = Array2(length);
+ while (++index2 < length) {
+ var array = arrays[index2], othIndex = -1;
while (++othIndex < length) {
- if (othIndex != index3) {
- result2[index3] = baseDifference(result2[index3] || array, arrays[othIndex], iteratee2, comparator);
+ if (othIndex != index2) {
+ result2[index2] = baseDifference(result2[index2] || array, arrays[othIndex], iteratee2, comparator);
}
}
}
return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
}
function baseZipObject(props, values3, assignFunc) {
- 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);
+ 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);
}
return result2;
}
@@ -6211,7 +6211,7 @@ var require_lodash = __commonJS({
if (isArray5(value)) {
return value;
}
- return isKey(value, object) ? [value] : stringToPath(toString5(value));
+ return isKey(value, object) ? [value] : stringToPath(toString4(value));
}
var castRest = baseRest;
function castSlice(array, start, end) {
@@ -6220,14 +6220,14 @@ var require_lodash = __commonJS({
return !start && end >= length ? array : baseSlice(array, start, end);
}
var clearTimeout2 = ctxClearTimeout || function(id3) {
- return root4.clearTimeout(id3);
+ return root.clearTimeout(id3);
};
- function cloneBuffer(buffer2, isDeep) {
+ function cloneBuffer(buffer, isDeep) {
if (isDeep) {
- return buffer2.slice();
+ return buffer.slice();
}
- var length = buffer2.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer2.constructor(length);
- buffer2.copy(result2);
+ var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
+ buffer.copy(result2);
return result2;
}
function cloneArrayBuffer(arrayBuffer) {
@@ -6236,8 +6236,8 @@ var require_lodash = __commonJS({
return result2;
}
function cloneDataView(dataView, isDeep) {
- var buffer2 = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
- return new dataView.constructor(buffer2, dataView.byteOffset, dataView.byteLength);
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
function cloneRegExp(regexp) {
var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
@@ -6248,8 +6248,8 @@ var require_lodash = __commonJS({
return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
}
function cloneTypedArray(typedArray, isDeep) {
- var buffer2 = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length);
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
function compareAscending(value, other) {
if (value !== other) {
@@ -6265,15 +6265,15 @@ var require_lodash = __commonJS({
return 0;
}
function compareMultiple(object, other, orders) {
- 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]);
+ 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]);
if (result2) {
- if (index3 >= ordersLength) {
+ if (index2 >= ordersLength) {
return result2;
}
- var order2 = orders[index3];
- return result2 * (order2 == "desc" ? -1 : 1);
+ var order = orders[index2];
+ return result2 * (order == "desc" ? -1 : 1);
}
}
return object.index - other.index;
@@ -6310,27 +6310,27 @@ var require_lodash = __commonJS({
return result2;
}
function copyArray(source, array) {
- var index3 = -1, length = source.length;
+ var index2 = -1, length = source.length;
array || (array = Array2(length));
- while (++index3 < length) {
- array[index3] = source[index3];
+ while (++index2 < length) {
+ array[index2] = source[index2];
}
return array;
}
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
- var index3 = -1, length = props.length;
- while (++index3 < length) {
- var key3 = props[index3];
- var newValue = customizer ? customizer(object[key3], source[key3], key3, object, source) : undefined2;
+ var index2 = -1, length = props.length;
+ while (++index2 < length) {
+ var key2 = props[index2];
+ var newValue = customizer ? customizer(object[key2], source[key2], key2, object, source) : undefined2;
if (newValue === undefined2) {
- newValue = source[key3];
+ newValue = source[key2];
}
if (isNew) {
- baseAssignValue(object, key3, newValue);
+ baseAssignValue(object, key2, newValue);
} else {
- assignValue(object, key3, newValue);
+ assignValue(object, key2, newValue);
}
}
return object;
@@ -6349,17 +6349,17 @@ var require_lodash = __commonJS({
}
function createAssigner(assigner) {
return baseRest(function(object, sources) {
- var index3 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
+ var index2 = -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 (++index3 < length) {
- var source = sources[index3];
+ while (++index2 < length) {
+ var source = sources[index2];
if (source) {
- assigner(object, source, index3, customizer);
+ assigner(object, source, index2, customizer);
}
}
return object;
@@ -6373,9 +6373,9 @@ var require_lodash = __commonJS({
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee2);
}
- var length = collection.length, index3 = fromRight ? length : -1, iterable = Object2(collection);
- while (fromRight ? index3-- : ++index3 < length) {
- if (iteratee2(iterable[index3], index3, iterable) === false) {
+ var length = collection.length, index2 = fromRight ? length : -1, iterable = Object2(collection);
+ while (fromRight ? index2-- : ++index2 < length) {
+ if (iteratee2(iterable[index2], index2, iterable) === false) {
break;
}
}
@@ -6384,10 +6384,10 @@ var require_lodash = __commonJS({
}
function createBaseFor(fromRight) {
return function(object, iteratee2, keysFunc) {
- var index3 = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
+ var index2 = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
while (length--) {
- var key3 = props[fromRight ? length : ++index3];
- if (iteratee2(iterable[key3], key3, iterable) === false) {
+ var key2 = props[fromRight ? length : ++index2];
+ if (iteratee2(iterable[key2], key2, iterable) === false) {
break;
}
}
@@ -6397,23 +6397,23 @@ var require_lodash = __commonJS({
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
- var fn = this && this !== root4 && this instanceof wrapper ? Ctor : func;
+ var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
function createCaseFirst(methodName) {
- return function(string6) {
- string6 = toString5(string6);
- var strSymbols = hasUnicode(string6) ? stringToArray(string6) : undefined2;
- var chr = strSymbols ? strSymbols[0] : string6.charAt(0);
- var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string6.slice(1);
+ return function(string4) {
+ string4 = toString4(string4);
+ var strSymbols = hasUnicode(string4) ? stringToArray(string4) : undefined2;
+ var chr = strSymbols ? strSymbols[0] : string4.charAt(0);
+ var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string4.slice(1);
return chr[methodName]() + trailing;
};
}
function createCompounder(callback) {
- return function(string6) {
- return arrayReduce(words(deburr(string6).replace(reApos, "")), callback, "");
+ return function(string4) {
+ return arrayReduce(words(deburr(string4).replace(reApos, "")), callback, "");
};
}
function createCtor(Ctor) {
@@ -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), index3 = length, placeholder2 = getHolder(wrapper);
- while (index3--) {
- args[index3] = arguments[index3];
+ var length = arguments.length, args = Array2(length), index2 = length, placeholder2 = getHolder(wrapper);
+ while (index2--) {
+ args[index2] = arguments[index2];
}
var holders = length < 3 && args[0] !== placeholder2 && args[length - 1] !== placeholder2 ? [] : replaceHolders(args, placeholder2);
length -= holders.length;
@@ -6464,7 +6464,7 @@ var require_lodash = __commonJS({
arity - length
);
}
- var fn = this && this !== root4 && this instanceof wrapper ? Ctor : func;
+ var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
return apply2(fn, this, args);
}
return wrapper;
@@ -6474,23 +6474,23 @@ var require_lodash = __commonJS({
var iterable = Object2(collection);
if (!isArrayLike(collection)) {
var iteratee2 = getIteratee(predicate, 3);
- collection = keys2(collection);
- predicate = function(key3) {
- return iteratee2(iterable[key3], key3, iterable);
+ collection = keys(collection);
+ predicate = function(key2) {
+ return iteratee2(iterable[key2], key2, iterable);
};
}
- var index3 = findIndexFunc(collection, predicate, fromIndex);
- return index3 > -1 ? iterable[iteratee2 ? collection[index3] : index3] : undefined2;
+ var index2 = findIndexFunc(collection, predicate, fromIndex);
+ return index2 > -1 ? iterable[iteratee2 ? collection[index2] : index2] : undefined2;
};
}
function createFlow(fromRight) {
return flatRest(function(funcs) {
- var length = funcs.length, index3 = length, prereq = LodashWrapper.prototype.thru;
+ var length = funcs.length, index2 = length, prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
- while (index3--) {
- var func = funcs[index3];
+ while (index2--) {
+ var func = funcs[index2];
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
@@ -6498,12 +6498,12 @@ var require_lodash = __commonJS({
var wrapper = new LodashWrapper([], true);
}
}
- index3 = wrapper ? index3 : length;
- while (++index3 < length) {
- func = funcs[index3];
- var funcName = getFuncName(func), data3 = funcName == "wrapper" ? getData(func) : undefined2;
- if (data3 && isLaziable(data3[0]) && data3[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data3[4].length && data3[9] == 1) {
- wrapper = wrapper[getFuncName(data3[0])].apply(wrapper, data3[3]);
+ index2 = wrapper ? index2 : length;
+ while (++index2 < length) {
+ func = funcs[index2];
+ 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]);
} else {
wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
}
@@ -6513,9 +6513,9 @@ var require_lodash = __commonJS({
if (wrapper && args.length == 1 && isArray5(value)) {
return wrapper.plant(value).value();
}
- var index4 = 0, result2 = length ? funcs[index4].apply(this, args) : value;
- while (++index4 < length) {
- result2 = funcs[index4].call(this, result2);
+ var index3 = 0, result2 = length ? funcs[index3].apply(this, args) : value;
+ while (++index3 < length) {
+ result2 = funcs[index3].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), index3 = length;
- while (index3--) {
- args[index3] = arguments[index3];
+ var length = arguments.length, args = Array2(length), index2 = length;
+ while (index2--) {
+ args[index2] = arguments[index2];
}
if (isCurried) {
var placeholder2 = getHolder(wrapper), holdersCount = countHolders(args, placeholder2);
@@ -6563,7 +6563,7 @@ var require_lodash = __commonJS({
if (isAry && ary2 < length) {
args.length = ary2;
}
- if (this && this !== root4 && this instanceof wrapper) {
+ if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
@@ -6623,7 +6623,7 @@ var require_lodash = __commonJS({
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
- var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root4 && this instanceof wrapper ? Ctor : func;
+ var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
@@ -6687,15 +6687,15 @@ var require_lodash = __commonJS({
}
function createRound2(methodName) {
var func = Math2[methodName];
- return function(number5, precision) {
- number5 = toNumber(number5);
+ return function(number4, precision) {
+ number4 = toNumber(number4);
precision = precision == null ? 0 : nativeMin(toInteger2(precision), 292);
- if (precision && nativeIsFinite(number5)) {
- var pair2 = (toString5(number5) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision));
- pair2 = (toString5(value) + "e").split("e");
+ if (precision && nativeIsFinite(number4)) {
+ var pair2 = (toString4(number4) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision));
+ pair2 = (toString4(value) + "e").split("e");
return +(pair2[0] + "e" + (+pair2[1] - precision));
}
- return func(number5);
+ return func(number4);
};
}
var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop3 : function(values3) {
@@ -6730,7 +6730,7 @@ var require_lodash = __commonJS({
var partialsRight = partials, holdersRight = holders;
partials = holders = undefined2;
}
- var data3 = isBindKey ? undefined2 : getData(func);
+ var data2 = isBindKey ? undefined2 : getData(func);
var newData = [
func,
bitmask,
@@ -6743,8 +6743,8 @@ var require_lodash = __commonJS({
ary2,
arity
];
- if (data3) {
- mergeData(newData, data3);
+ if (data2) {
+ mergeData(newData, data2);
}
func = newData[0];
bitmask = newData[1];
@@ -6764,16 +6764,16 @@ var require_lodash = __commonJS({
} else {
result2 = createHybrid.apply(undefined2, newData);
}
- var setter = data3 ? baseSetData : setData;
+ var setter = data2 ? baseSetData : setData;
return setWrapToString(setter(result2, newData), func, bitmask);
}
- function customDefaultsAssignIn(objValue, srcValue, key3, object) {
- if (objValue === undefined2 || eq(objValue, objectProto[key3]) && !hasOwnProperty4.call(object, key3)) {
+ function customDefaultsAssignIn(objValue, srcValue, key2, object) {
+ if (objValue === undefined2 || eq(objValue, objectProto[key2]) && !hasOwnProperty3.call(object, key2)) {
return srcValue;
}
return objValue;
}
- function customDefaultsMerge(objValue, srcValue, key3, object, source, stack) {
+ function customDefaultsMerge(objValue, srcValue, key2, object, source, stack) {
if (isObject4(objValue) && isObject4(srcValue)) {
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
@@ -6782,7 +6782,7 @@ var require_lodash = __commonJS({
return objValue;
}
function customOmitClone(value) {
- return isPlainObject3(value) ? undefined2 : value;
+ return isPlainObject2(value) ? undefined2 : value;
}
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
@@ -6794,13 +6794,13 @@ var require_lodash = __commonJS({
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
- var index3 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
+ var index2 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
stack.set(array, other);
stack.set(other, array);
- while (++index3 < arrLength) {
- var arrValue = array[index3], othValue = other[index3];
+ while (++index2 < arrLength) {
+ var arrValue = array[index2], othValue = other[index2];
if (customizer) {
- var compared = isPartial ? customizer(othValue, arrValue, index3, other, array, stack) : customizer(arrValue, othValue, index3, array, other, stack);
+ var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
}
if (compared !== undefined2) {
if (compared) {
@@ -6850,10 +6850,10 @@ var require_lodash = __commonJS({
case stringTag:
return object == other + "";
case mapTag:
- var convert2 = mapToArray;
+ var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
- convert2 || (convert2 = setToArray);
+ convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
@@ -6863,7 +6863,7 @@ var require_lodash = __commonJS({
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other);
- var result2 = equalArrays(convert2(object), convert2(other), bitmask, customizer, equalFunc, stack);
+ var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack["delete"](object);
return result2;
case symbolTag:
@@ -6878,10 +6878,10 @@ var require_lodash = __commonJS({
if (objLength != othLength && !isPartial) {
return false;
}
- var index3 = objLength;
- while (index3--) {
- var key3 = objProps[index3];
- if (!(isPartial ? key3 in other : hasOwnProperty4.call(other, key3))) {
+ var index2 = objLength;
+ while (index2--) {
+ var key2 = objProps[index2];
+ if (!(isPartial ? key2 in other : hasOwnProperty3.call(other, key2))) {
return false;
}
}
@@ -6894,17 +6894,17 @@ var require_lodash = __commonJS({
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
- while (++index3 < objLength) {
- key3 = objProps[index3];
- var objValue = object[key3], othValue = other[key3];
+ while (++index2 < objLength) {
+ key2 = objProps[index2];
+ var objValue = object[key2], othValue = other[key2];
if (customizer) {
- var compared = isPartial ? customizer(othValue, objValue, key3, other, object, stack) : customizer(objValue, othValue, key3, object, other, stack);
+ var compared = isPartial ? customizer(othValue, objValue, key2, other, object, stack) : customizer(objValue, othValue, key2, object, other, stack);
}
if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result2 = false;
break;
}
- skipCtor || (skipCtor = key3 == "constructor");
+ skipCtor || (skipCtor = key2 == "constructor");
}
if (result2 && !skipCtor) {
var objCtor = object.constructor, othCtor = other.constructor;
@@ -6920,7 +6920,7 @@ var require_lodash = __commonJS({
return setToString(overRest(func, undefined2, flatten4), func + "");
}
function getAllKeys(object) {
- return baseGetAllKeys(object, keys2, getSymbols);
+ return baseGetAllKeys(object, keys, getSymbols);
}
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
@@ -6929,17 +6929,17 @@ var require_lodash = __commonJS({
return metaMap.get(func);
};
function getFuncName(func) {
- var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty4.call(realNames, result2) ? array.length : 0;
+ var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty3.call(realNames, result2) ? array.length : 0;
while (length--) {
- var data3 = array[length], otherFunc = data3.func;
+ var data2 = array[length], otherFunc = data2.func;
if (otherFunc == null || otherFunc == func) {
- return data3.name;
+ return data2.name;
}
}
return result2;
}
function getHolder(func) {
- var object = hasOwnProperty4.call(lodash, "placeholder") ? lodash : func;
+ var object = hasOwnProperty3.call(lodash, "placeholder") ? lodash : func;
return object.placeholder;
}
function getIteratee() {
@@ -6947,24 +6947,24 @@ var require_lodash = __commonJS({
result2 = result2 === iteratee ? baseIteratee : result2;
return arguments.length ? result2(arguments[0], arguments[1]) : result2;
}
- function getMapData(map7, key3) {
- var data3 = map7.__data__;
- return isKeyable(key3) ? data3[typeof key3 == "string" ? "string" : "hash"] : data3.map;
+ function getMapData(map5, key2) {
+ var data2 = map5.__data__;
+ return isKeyable(key2) ? data2[typeof key2 == "string" ? "string" : "hash"] : data2.map;
}
function getMatchData(object) {
- var result2 = keys2(object), length = result2.length;
+ var result2 = keys(object), length = result2.length;
while (length--) {
- var key3 = result2[length], value = object[key3];
- result2[length] = [key3, value, isStrictComparable(value)];
+ var key2 = result2[length], value = object[key2];
+ result2[length] = [key2, value, isStrictComparable(value)];
}
return result2;
}
- function getNative(object, key3) {
- var value = getValue(object, key3);
+ function getNative(object, key2) {
+ var value = getValue(object, key2);
return baseIsNative(value) ? value : undefined2;
}
function getRawTag(value) {
- var isOwn = hasOwnProperty4.call(value, symToStringTag), tag2 = value[symToStringTag];
+ var isOwn = hasOwnProperty3.call(value, symToStringTag), tag2 = value[symToStringTag];
try {
value[symToStringTag] = undefined2;
var unmasked = true;
@@ -7019,10 +7019,10 @@ var require_lodash = __commonJS({
};
}
function getView(start, end, transforms) {
- var index3 = -1, length = transforms.length;
- while (++index3 < length) {
- var data3 = transforms[index3], size3 = data3.size;
- switch (data3.type) {
+ var index2 = -1, length = transforms.length;
+ while (++index2 < length) {
+ var data2 = transforms[index2], size3 = data2.size;
+ switch (data2.type) {
case "drop":
start += size3;
break;
@@ -7043,25 +7043,25 @@ var require_lodash = __commonJS({
var match2 = source.match(reWrapDetails);
return match2 ? match2[1].split(reSplitDetails) : [];
}
- function hasPath(object, path3, hasFunc) {
- path3 = castPath(path3, object);
- var index3 = -1, length = path3.length, result2 = false;
- while (++index3 < length) {
- var key3 = toKey(path3[index3]);
- if (!(result2 = object != null && hasFunc(object, key3))) {
+ 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]);
+ if (!(result2 = object != null && hasFunc(object, key2))) {
break;
}
- object = object[key3];
+ object = object[key2];
}
- if (result2 || ++index3 != length) {
+ if (result2 || ++index2 != length) {
return result2;
}
length = object == null ? 0 : object.length;
- return !!length && isLength(length) && isIndex2(key3, length) && (isArray5(object) || isArguments(object));
+ return !!length && isLength(length) && isIndex2(key2, length) && (isArray5(object) || isArguments(object));
}
function initCloneArray(array) {
var length = array.length, result2 = new array.constructor(length);
- if (length && typeof array[0] == "string" && hasOwnProperty4.call(array, "index")) {
+ if (length && typeof array[0] == "string" && hasOwnProperty3.call(array, "index")) {
result2.index = array.index;
result2.input = array.input;
}
@@ -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, index3, object) {
+ function isIterateeCall(value, index2, object) {
if (!isObject4(object)) {
return false;
}
- var type = typeof index3;
- if (type == "number" ? isArrayLike(object) && isIndex2(index3, object.length) : type == "string" && index3 in object) {
- return eq(object[index3], value);
+ var type = typeof index2;
+ if (type == "number" ? isArrayLike(object) && isIndex2(index2, object.length) : type == "string" && index2 in object) {
+ return eq(object[index2], value);
}
return false;
}
@@ -7153,8 +7153,8 @@ var require_lodash = __commonJS({
if (func === other) {
return true;
}
- var data3 = getData(other);
- return !!data3 && func === data3[0];
+ var data2 = getData(other);
+ return !!data2 && func === data2[0];
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
@@ -7167,65 +7167,65 @@ var require_lodash = __commonJS({
function isStrictComparable(value) {
return value === value && !isObject4(value);
}
- function matchesStrictComparable(key3, srcValue) {
+ function matchesStrictComparable(key2, srcValue) {
return function(object) {
if (object == null) {
return false;
}
- return object[key3] === srcValue && (srcValue !== undefined2 || key3 in Object2(object));
+ return object[key2] === srcValue && (srcValue !== undefined2 || key2 in Object2(object));
};
}
function memoizeCapped(func) {
- var result2 = memoize2(func, function(key3) {
+ var result2 = memoize2(func, function(key2) {
if (cache2.size === MAX_MEMOIZE_SIZE) {
cache2.clear();
}
- return key3;
+ return key2;
});
var cache2 = result2.cache;
return result2;
}
- function mergeData(data3, source) {
- var bitmask = data3[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
- var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data3[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
+ function mergeData(data2, source) {
+ var bitmask = data2[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
+ var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data2[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
if (!(isCommon || isCombo)) {
- return data3;
+ return data2;
}
if (srcBitmask & WRAP_BIND_FLAG) {
- data3[2] = source[2];
+ data2[2] = source[2];
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
var value = source[3];
if (value) {
- var partials = data3[3];
- data3[3] = partials ? composeArgs(partials, value, source[4]) : value;
- data3[4] = partials ? replaceHolders(data3[3], PLACEHOLDER) : source[4];
+ var partials = data2[3];
+ data2[3] = partials ? composeArgs(partials, value, source[4]) : value;
+ data2[4] = partials ? replaceHolders(data2[3], PLACEHOLDER) : source[4];
}
value = source[5];
if (value) {
- partials = data3[5];
- data3[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
- data3[6] = partials ? replaceHolders(data3[5], PLACEHOLDER) : source[6];
+ partials = data2[5];
+ data2[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
+ data2[6] = partials ? replaceHolders(data2[5], PLACEHOLDER) : source[6];
}
value = source[7];
if (value) {
- data3[7] = value;
+ data2[7] = value;
}
if (srcBitmask & WRAP_ARY_FLAG) {
- data3[8] = data3[8] == null ? source[8] : nativeMin(data3[8], source[8]);
+ data2[8] = data2[8] == null ? source[8] : nativeMin(data2[8], source[8]);
}
- if (data3[9] == null) {
- data3[9] = source[9];
+ if (data2[9] == null) {
+ data2[9] = source[9];
}
- data3[0] = source[0];
- data3[1] = newBitmask;
- return data3;
+ data2[0] = source[0];
+ data2[1] = newBitmask;
+ return data2;
}
function nativeKeysIn(object) {
var result2 = [];
if (object != null) {
- for (var key3 in Object2(object)) {
- result2.push(key3);
+ for (var key2 in Object2(object)) {
+ result2.push(key2);
}
}
return result2;
@@ -7236,42 +7236,42 @@ var require_lodash = __commonJS({
function overRest(func, start, transform2) {
start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
return function() {
- var args = arguments, index3 = -1, length = nativeMax(args.length - start, 0), array = Array2(length);
- while (++index3 < length) {
- array[index3] = args[start + index3];
+ var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array2(length);
+ while (++index2 < length) {
+ array[index2] = args[start + index2];
}
- index3 = -1;
+ index2 = -1;
var otherArgs = Array2(start + 1);
- while (++index3 < start) {
- otherArgs[index3] = args[index3];
+ while (++index2 < start) {
+ otherArgs[index2] = args[index2];
}
otherArgs[start] = transform2(array);
return apply2(func, this, otherArgs);
};
}
- function parent(object, path3) {
- return path3.length < 2 ? object : baseGet(object, baseSlice(path3, 0, -1));
+ function parent(object, path2) {
+ return path2.length < 2 ? object : baseGet(object, baseSlice(path2, 0, -1));
}
function reorder(array, indexes) {
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
while (length--) {
- var index3 = indexes[length];
- array[length] = isIndex2(index3, arrLength) ? oldArray[index3] : undefined2;
+ var index2 = indexes[length];
+ array[length] = isIndex2(index2, arrLength) ? oldArray[index2] : undefined2;
}
return array;
}
- function safeGet(object, key3) {
- if (key3 === "constructor" && typeof object[key3] === "function") {
+ function safeGet(object, key2) {
+ if (key2 === "constructor" && typeof object[key2] === "function") {
return;
}
- if (key3 == "__proto__") {
+ if (key2 == "__proto__") {
return;
}
- return object[key3];
+ return object[key2];
}
var setData = shortOut(baseSetData);
var setTimeout2 = ctxSetTimeout || function(func, wait) {
- return root4.setTimeout(func, wait);
+ return root.setTimeout(func, wait);
};
var setToString = shortOut(baseSetToString);
function setWrapToString(wrapper, reference, bitmask) {
@@ -7294,23 +7294,23 @@ var require_lodash = __commonJS({
};
}
function shuffleSelf(array, size3) {
- var index3 = -1, length = array.length, lastIndex = length - 1;
+ var index2 = -1, length = array.length, lastIndex = length - 1;
size3 = size3 === undefined2 ? length : size3;
- while (++index3 < size3) {
- var rand = baseRandom(index3, lastIndex), value = array[rand];
- array[rand] = array[index3];
- array[index3] = value;
+ while (++index2 < size3) {
+ var rand = baseRandom(index2, lastIndex), value = array[rand];
+ array[rand] = array[index2];
+ array[index2] = value;
}
array.length = size3;
return array;
}
- var stringToPath = memoizeCapped(function(string6) {
+ var stringToPath = memoizeCapped(function(string4) {
var result2 = [];
- if (string6.charCodeAt(0) === 46) {
+ if (string4.charCodeAt(0) === 46) {
result2.push("");
}
- string6.replace(rePropName, function(match2, number5, quote, subString) {
- result2.push(quote ? subString.replace(reEscapeChar, "$1") : number5 || match2);
+ string4.replace(rePropName, function(match2, number4, quote, subString) {
+ result2.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match2);
});
return result2;
});
@@ -7363,16 +7363,16 @@ var require_lodash = __commonJS({
if (!length || size3 < 1) {
return [];
}
- var index3 = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size3));
- while (index3 < length) {
- result2[resIndex++] = baseSlice(array, index3, index3 += size3);
+ var index2 = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size3));
+ while (index2 < length) {
+ result2[resIndex++] = baseSlice(array, index2, index2 += size3);
}
return result2;
}
function compact(array) {
- var index3 = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
- while (++index3 < length) {
- var value = array[index3];
+ var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
+ while (++index2 < length) {
+ var value = array[index2];
if (value) {
result2[resIndex++] = value;
}
@@ -7384,9 +7384,9 @@ var require_lodash = __commonJS({
if (!length) {
return [];
}
- var args = Array2(length - 1), array = arguments[0], index3 = length;
- while (index3--) {
- args[index3 - 1] = arguments[index3];
+ var args = Array2(length - 1), array = arguments[0], index2 = length;
+ while (index2--) {
+ args[index2 - 1] = arguments[index2];
}
return arrayPush(isArray5(array) ? copyArray(array) : [array], baseFlatten(args, 1));
}
@@ -7446,23 +7446,23 @@ var require_lodash = __commonJS({
if (!length) {
return -1;
}
- var index3 = fromIndex == null ? 0 : toInteger2(fromIndex);
- if (index3 < 0) {
- index3 = nativeMax(length + index3, 0);
+ var index2 = fromIndex == null ? 0 : toInteger2(fromIndex);
+ if (index2 < 0) {
+ index2 = nativeMax(length + index2, 0);
}
- return baseFindIndex(array, getIteratee(predicate, 3), index3);
+ return baseFindIndex(array, getIteratee(predicate, 3), index2);
}
function findLastIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
- var index3 = length - 1;
+ var index2 = length - 1;
if (fromIndex !== undefined2) {
- index3 = toInteger2(fromIndex);
- index3 = fromIndex < 0 ? nativeMax(length + index3, 0) : nativeMin(index3, length - 1);
+ index2 = toInteger2(fromIndex);
+ index2 = fromIndex < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1);
}
- return baseFindIndex(array, getIteratee(predicate, 3), index3, true);
+ return baseFindIndex(array, getIteratee(predicate, 3), index2, true);
}
function flatten4(array) {
var length = array == null ? 0 : array.length;
@@ -7481,14 +7481,14 @@ var require_lodash = __commonJS({
return baseFlatten(array, depth);
}
function fromPairs(pairs) {
- var index3 = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
- while (++index3 < length) {
- var pair2 = pairs[index3];
+ var index2 = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
+ while (++index2 < length) {
+ var pair2 = pairs[index2];
result2[pair2[0]] = pair2[1];
}
return result2;
}
- function head2(array) {
+ function head(array) {
return array && array.length ? array[0] : undefined2;
}
function indexOf(array, value, fromIndex) {
@@ -7496,11 +7496,11 @@ var require_lodash = __commonJS({
if (!length) {
return -1;
}
- var index3 = fromIndex == null ? 0 : toInteger2(fromIndex);
- if (index3 < 0) {
- index3 = nativeMax(length + index3, 0);
+ var index2 = fromIndex == null ? 0 : toInteger2(fromIndex);
+ if (index2 < 0) {
+ index2 = nativeMax(length + index2, 0);
}
- return baseIndexOf(array, value, index3);
+ return baseIndexOf(array, value, index2);
}
function initial(array) {
var length = array == null ? 0 : array.length;
@@ -7527,7 +7527,7 @@ var require_lodash = __commonJS({
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
});
- function join4(array, separator) {
+ function join2(array, separator) {
return array == null ? "" : nativeJoin.call(array, separator);
}
function last(array) {
@@ -7539,12 +7539,12 @@ var require_lodash = __commonJS({
if (!length) {
return -1;
}
- var index3 = length;
+ var index2 = length;
if (fromIndex !== undefined2) {
- index3 = toInteger2(fromIndex);
- index3 = index3 < 0 ? nativeMax(length + index3, 0) : nativeMin(index3, length - 1);
+ index2 = toInteger2(fromIndex);
+ index2 = index2 < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1);
}
- return value === value ? strictLastIndexOf(array, value, index3) : baseFindIndex(array, baseIsNaN, index3, true);
+ return value === value ? strictLastIndexOf(array, value, index2) : baseFindIndex(array, baseIsNaN, index2, 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(index3) {
- return isIndex2(index3, length) ? +index3 : index3;
+ basePullAt(array, arrayMap(indexes, function(index2) {
+ return isIndex2(index2, length) ? +index2 : index2;
}).sort(compareAscending));
return result2;
});
@@ -7571,13 +7571,13 @@ var require_lodash = __commonJS({
if (!(array && array.length)) {
return result2;
}
- var index3 = -1, indexes = [], length = array.length;
+ var index2 = -1, indexes = [], length = array.length;
predicate = getIteratee(predicate, 3);
- while (++index3 < length) {
- var value = array[index3];
- if (predicate(value, index3, array)) {
+ while (++index2 < length) {
+ var value = array[index2];
+ if (predicate(value, index2, array)) {
result2.push(value);
- indexes.push(index3);
+ indexes.push(index2);
}
}
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 index3 = baseSortedIndex(array, value);
- if (index3 < length && eq(array[index3], value)) {
- return index3;
+ var index2 = baseSortedIndex(array, value);
+ if (index2 < length && eq(array[index2], value)) {
+ return index2;
}
}
return -1;
@@ -7625,9 +7625,9 @@ var require_lodash = __commonJS({
function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
- var index3 = baseSortedIndex(array, value, true) - 1;
- if (eq(array[index3], value)) {
- return index3;
+ var index2 = baseSortedIndex(array, value, true) - 1;
+ if (eq(array[index2], value)) {
+ return index2;
}
}
return -1;
@@ -7700,8 +7700,8 @@ var require_lodash = __commonJS({
return true;
}
});
- return baseTimes(length, function(index3) {
- return arrayMap(array, baseProperty(index3));
+ return baseTimes(length, function(index2) {
+ return arrayMap(array, baseProperty(index2));
});
}
function unzipWith(array, iteratee2) {
@@ -7801,14 +7801,14 @@ var require_lodash = __commonJS({
clone6.__index__ = 0;
clone6.__values__ = undefined2;
if (result2) {
- previous2.__wrapped__ = clone6;
+ previous.__wrapped__ = clone6;
} else {
result2 = clone6;
}
- var previous2 = clone6;
+ var previous = clone6;
parent2 = parent2.__wrapped__;
}
- previous2.__wrapped__ = value;
+ previous.__wrapped__ = value;
return result2;
}
function wrapperReverse() {
@@ -7831,11 +7831,11 @@ var require_lodash = __commonJS({
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
- var countBy = createAggregator(function(result2, value, key3) {
- if (hasOwnProperty4.call(result2, key3)) {
- ++result2[key3];
+ var countBy = createAggregator(function(result2, value, key2) {
+ if (hasOwnProperty3.call(result2, key2)) {
+ ++result2[key2];
} else {
- baseAssignValue(result2, key3, 1);
+ baseAssignValue(result2, key2, 1);
}
});
function every2(collection, predicate, guard) {
@@ -7849,17 +7849,17 @@ var require_lodash = __commonJS({
var func = isArray5(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
}
- var find3 = createFind(findIndex3);
+ var find2 = createFind(findIndex3);
var findLast = createFind(findLastIndex);
function flatMap(collection, iteratee2) {
- return baseFlatten(map6(collection, iteratee2), 1);
+ return baseFlatten(map4(collection, iteratee2), 1);
}
function flatMapDeep(collection, iteratee2) {
- return baseFlatten(map6(collection, iteratee2), INFINITY2);
+ return baseFlatten(map4(collection, iteratee2), INFINITY2);
}
function flatMapDepth(collection, iteratee2, depth) {
depth = depth === undefined2 ? 1 : toInteger2(depth);
- return baseFlatten(map6(collection, iteratee2), depth);
+ return baseFlatten(map4(collection, iteratee2), depth);
}
function forEach3(collection, iteratee2) {
var func = isArray5(collection) ? arrayEach : baseEach;
@@ -7869,11 +7869,11 @@ var require_lodash = __commonJS({
var func = isArray5(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee2, 3));
}
- var groupBy2 = createAggregator(function(result2, value, key3) {
- if (hasOwnProperty4.call(result2, key3)) {
- result2[key3].push(value);
+ var groupBy2 = createAggregator(function(result2, value, key2) {
+ if (hasOwnProperty3.call(result2, key2)) {
+ result2[key2].push(value);
} else {
- baseAssignValue(result2, key3, [value]);
+ baseAssignValue(result2, key2, [value]);
}
});
function includes(collection, value, fromIndex, guard) {
@@ -7885,17 +7885,17 @@ 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, path3, args) {
- var index3 = -1, isFunc = typeof path3 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
+ var invokeMap = baseRest(function(collection, path2, args) {
+ var index2 = -1, isFunc = typeof path2 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
baseEach(collection, function(value) {
- result2[++index3] = isFunc ? apply2(path3, value, args) : baseInvoke(value, path3, args);
+ result2[++index2] = isFunc ? apply2(path2, value, args) : baseInvoke(value, path2, args);
});
return result2;
});
- var keyBy = createAggregator(function(result2, value, key3) {
- baseAssignValue(result2, key3, value);
+ var keyBy = createAggregator(function(result2, value, key2) {
+ baseAssignValue(result2, key2, value);
});
- function map6(collection, iteratee2) {
+ function map4(collection, iteratee2) {
var func = isArray5(collection) ? arrayMap : baseMap;
return func(collection, getIteratee(iteratee2, 3));
}
@@ -7912,8 +7912,8 @@ var require_lodash = __commonJS({
}
return baseOrderBy(collection, iteratees, orders);
}
- var partition = createAggregator(function(result2, value, key3) {
- result2[key3 ? 0 : 1].push(value);
+ var partition = createAggregator(function(result2, value, key2) {
+ result2[key2 ? 0 : 1].push(value);
}, function() {
return [[], []];
});
@@ -7979,7 +7979,7 @@ var require_lodash = __commonJS({
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
var now = ctxNow || function() {
- return root4.Date.now();
+ return root.Date.now();
};
function after(n3, func) {
if (typeof func != "function") {
@@ -8021,13 +8021,13 @@ var require_lodash = __commonJS({
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
- var bindKey = baseRest(function(object, key3, partials) {
+ var bindKey = baseRest(function(object, key2, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
- return createWrap(key3, bitmask, object, partials, holders);
+ return createWrap(key2, bitmask, object, partials, holders);
});
function curry(func, arity, guard) {
arity = guard ? undefined2 : arity;
@@ -8131,17 +8131,17 @@ var require_lodash = __commonJS({
function flip(func) {
return createWrap(func, WRAP_FLIP_FLAG);
}
- function memoize2(func, resolver2) {
- if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
+ function memoize2(func, resolver) {
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
var memoized = function() {
- var args = arguments, key3 = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
- if (cache2.has(key3)) {
- return cache2.get(key3);
+ var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache;
+ if (cache2.has(key2)) {
+ return cache2.get(key2);
}
var result2 = func.apply(this, args);
- memoized.cache = cache2.set(key3, result2) || cache2;
+ memoized.cache = cache2.set(key2, result2) || cache2;
return result2;
};
memoized.cache = new (memoize2.Cache || MapCache)();
@@ -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 index3 = -1, length = nativeMin(args.length, funcsLength);
- while (++index3 < length) {
- args[index3] = transforms[index3].call(this, args[index3]);
+ var index2 = -1, length = nativeMin(args.length, funcsLength);
+ while (++index2 < length) {
+ args[index2] = transforms[index2].call(this, args[index2]);
}
return apply2(func, this, args);
});
@@ -8230,7 +8230,7 @@ var require_lodash = __commonJS({
function unary(func) {
return ary(func, 1);
}
- function wrap3(value, wrapper) {
+ function wrap(value, wrapper) {
return partial(castFunction(wrapper), value);
}
function castArray() {
@@ -8255,7 +8255,7 @@ var require_lodash = __commonJS({
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
}
function conformsTo(object, source) {
- return source == null || baseConformsTo(object, source, keys2(source));
+ return source == null || baseConformsTo(object, source, keys(source));
}
function eq(value, other) {
return value === other || value !== value && other !== other;
@@ -8267,7 +8267,7 @@ var require_lodash = __commonJS({
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value) {
- return isObjectLike2(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
+ return isObjectLike2(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
};
var isArray5 = Array2.isArray;
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
@@ -8280,16 +8280,16 @@ var require_lodash = __commonJS({
function isBoolean3(value) {
return value === true || value === false || isObjectLike2(value) && baseGetTag(value) == boolTag;
}
- var isBuffer2 = nativeIsBuffer || stubFalse;
+ var isBuffer = nativeIsBuffer || stubFalse;
var isDate4 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
function isElement(value) {
- return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject3(value);
+ return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject2(value);
}
function isEmpty(value) {
if (value == null) {
return true;
}
- if (isArrayLike(value) && (isArray5(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray(value) || isArguments(value))) {
+ if (isArrayLike(value) && (isArray5(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
return !value.length;
}
var tag2 = getTag2(value);
@@ -8299,8 +8299,8 @@ var require_lodash = __commonJS({
if (isPrototype(value)) {
return !baseKeys(value).length;
}
- for (var key3 in value) {
- if (hasOwnProperty4.call(value, key3)) {
+ for (var key2 in value) {
+ if (hasOwnProperty3.call(value, key2)) {
return false;
}
}
@@ -8319,7 +8319,7 @@ var require_lodash = __commonJS({
return false;
}
var tag2 = baseGetTag(value);
- return tag2 == errorTag || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject3(value);
+ return tag2 == errorTag || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject2(value);
}
function isFinite2(value) {
return typeof value == "number" && nativeIsFinite(value);
@@ -8370,7 +8370,7 @@ var require_lodash = __commonJS({
function isNumber4(value) {
return typeof value == "number" || isObjectLike2(value) && baseGetTag(value) == numberTag;
}
- function isPlainObject3(value) {
+ function isPlainObject2(value) {
if (!isObjectLike2(value) || baseGetTag(value) != objectTag) {
return false;
}
@@ -8378,7 +8378,7 @@ var require_lodash = __commonJS({
if (proto === null) {
return true;
}
- var Ctor = hasOwnProperty4.call(proto, "constructor") && proto.constructor;
+ var Ctor = hasOwnProperty3.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
var isRegExp2 = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
@@ -8461,17 +8461,17 @@ var require_lodash = __commonJS({
function toSafeInteger(value) {
return value ? baseClamp(toInteger2(value), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value === 0 ? value : 0;
}
- function toString5(value) {
+ function toString4(value) {
return value == null ? "" : baseToString2(value);
}
var assign = createAssigner(function(object, source) {
if (isPrototype(source) || isArrayLike(source)) {
- copyObject(source, keys2(source), object);
+ copyObject(source, keys(source), object);
return;
}
- for (var key3 in source) {
- if (hasOwnProperty4.call(source, key3)) {
- assignValue(object, key3, source[key3]);
+ for (var key2 in source) {
+ if (hasOwnProperty3.call(source, key2)) {
+ assignValue(object, key2, source[key2]);
}
}
});
@@ -8482,31 +8482,31 @@ var require_lodash = __commonJS({
copyObject(source, keysIn(source), object, customizer);
});
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
- copyObject(source, keys2(source), object, customizer);
+ copyObject(source, keys(source), object, customizer);
});
var at2 = flatRest(baseAt);
- function create3(prototype, properties3) {
+ function create2(prototype, properties3) {
var result2 = baseCreate(prototype);
return properties3 == null ? result2 : baseAssign(result2, properties3);
}
var defaults = baseRest(function(object, sources) {
object = Object2(object);
- var index3 = -1;
+ var index2 = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
- while (++index3 < length) {
- var source = sources[index3];
+ while (++index2 < length) {
+ var source = sources[index2];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
- var key3 = props[propsIndex];
- var value = object[key3];
- if (value === undefined2 || eq(value, objectProto[key3]) && !hasOwnProperty4.call(object, key3)) {
- object[key3] = source[key3];
+ var key2 = props[propsIndex];
+ var value = object[key2];
+ if (value === undefined2 || eq(value, objectProto[key2]) && !hasOwnProperty3.call(object, key2)) {
+ object[key2] = source[key2];
}
}
}
@@ -8535,39 +8535,39 @@ var require_lodash = __commonJS({
return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
}
function functions(object) {
- return object == null ? [] : baseFunctions(object, keys2(object));
+ return object == null ? [] : baseFunctions(object, keys(object));
}
function functionsIn(object) {
return object == null ? [] : baseFunctions(object, keysIn(object));
}
- function get2(object, path3, defaultValue2) {
- var result2 = object == null ? undefined2 : baseGet(object, path3);
+ function get2(object, path2, defaultValue2) {
+ var result2 = object == null ? undefined2 : baseGet(object, path2);
return result2 === undefined2 ? defaultValue2 : result2;
}
- function has(object, path3) {
- return object != null && hasPath(object, path3, baseHas);
+ function has(object, path2) {
+ return object != null && hasPath(object, path2, baseHas);
}
- function hasIn(object, path3) {
- return object != null && hasPath(object, path3, baseHasIn);
+ function hasIn(object, path2) {
+ return object != null && hasPath(object, path2, baseHasIn);
}
- var invert = createInverter(function(result2, value, key3) {
+ var invert = createInverter(function(result2, value, key2) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
- result2[value] = key3;
+ result2[value] = key2;
}, constant(identity2));
- var invertBy = createInverter(function(result2, value, key3) {
+ var invertBy = createInverter(function(result2, value, key2) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
- if (hasOwnProperty4.call(result2, value)) {
- result2[value].push(key3);
+ if (hasOwnProperty3.call(result2, value)) {
+ result2[value].push(key2);
} else {
- result2[value] = [key3];
+ result2[value] = [key2];
}
}, getIteratee);
var invoke = baseRest(baseInvoke);
- function keys2(object) {
+ function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
function keysIn(object) {
@@ -8576,20 +8576,20 @@ var require_lodash = __commonJS({
function mapKeys(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
- baseForOwn(object, function(value, key3, object2) {
- baseAssignValue(result2, iteratee2(value, key3, object2), value);
+ baseForOwn(object, function(value, key2, object2) {
+ baseAssignValue(result2, iteratee2(value, key2, object2), value);
});
return result2;
}
function mapValues(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
- baseForOwn(object, function(value, key3, object2) {
- baseAssignValue(result2, key3, iteratee2(value, key3, object2));
+ baseForOwn(object, function(value, key2, object2) {
+ baseAssignValue(result2, key2, iteratee2(value, key2, object2));
});
return result2;
}
- var merge2 = createAssigner(function(object, source, srcIndex) {
+ var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
});
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -8601,10 +8601,10 @@ var require_lodash = __commonJS({
return result2;
}
var isDeep = false;
- paths = arrayMap(paths, function(path3) {
- path3 = castPath(path3, object);
- isDeep || (isDeep = path3.length > 1);
- return path3;
+ paths = arrayMap(paths, function(path2) {
+ path2 = castPath(path2, object);
+ isDeep || (isDeep = path2.length > 1);
+ return path2;
});
copyObject(object, getAllKeysIn(object), result2);
if (isDeep) {
@@ -8630,38 +8630,38 @@ var require_lodash = __commonJS({
return [prop2];
});
predicate = getIteratee(predicate);
- return basePickBy(object, props, function(value, path3) {
- return predicate(value, path3[0]);
+ return basePickBy(object, props, function(value, path2) {
+ return predicate(value, path2[0]);
});
}
- function result(object, path3, defaultValue2) {
- path3 = castPath(path3, object);
- var index3 = -1, length = path3.length;
+ function result(object, path2, defaultValue2) {
+ path2 = castPath(path2, object);
+ var index2 = -1, length = path2.length;
if (!length) {
length = 1;
object = undefined2;
}
- while (++index3 < length) {
- var value = object == null ? undefined2 : object[toKey(path3[index3])];
+ while (++index2 < length) {
+ var value = object == null ? undefined2 : object[toKey(path2[index2])];
if (value === undefined2) {
- index3 = length;
+ index2 = length;
value = defaultValue2;
}
object = isFunction3(value) ? value.call(object) : value;
}
return object;
}
- function set(object, path3, value) {
- return object == null ? object : baseSet(object, path3, value);
+ function set(object, path2, value) {
+ return object == null ? object : baseSet(object, path2, value);
}
- function setWith(object, path3, value, customizer) {
+ function setWith(object, path2, value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
- return object == null ? object : baseSet(object, path3, value, customizer);
+ return object == null ? object : baseSet(object, path2, value, customizer);
}
- var toPairs = createToPairs(keys2);
+ var toPairs = createToPairs(keys);
var toPairsIn = createToPairs(keysIn);
function transform(object, iteratee2, accumulator) {
- var isArr = isArray5(object), isArrLike = isArr || isBuffer2(object) || isTypedArray(object);
+ var isArr = isArray5(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
iteratee2 = getIteratee(iteratee2, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
@@ -8673,28 +8673,28 @@ var require_lodash = __commonJS({
accumulator = {};
}
}
- (isArrLike ? arrayEach : baseForOwn)(object, function(value, index3, object2) {
- return iteratee2(accumulator, value, index3, object2);
+ (isArrLike ? arrayEach : baseForOwn)(object, function(value, index2, object2) {
+ return iteratee2(accumulator, value, index2, object2);
});
return accumulator;
}
- function unset(object, path3) {
- return object == null ? true : baseUnset(object, path3);
+ function unset(object, path2) {
+ return object == null ? true : baseUnset(object, path2);
}
- function update(object, path3, updater) {
- return object == null ? object : baseUpdate(object, path3, castFunction(updater));
+ function update(object, path2, updater) {
+ return object == null ? object : baseUpdate(object, path2, castFunction(updater));
}
- function updateWith(object, path3, updater, customizer) {
+ function updateWith(object, path2, updater, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
- return object == null ? object : baseUpdate(object, path3, castFunction(updater), customizer);
+ return object == null ? object : baseUpdate(object, path2, castFunction(updater), customizer);
}
function values2(object) {
- return object == null ? [] : baseValues(object, keys2(object));
+ return object == null ? [] : baseValues(object, keys(object));
}
function valuesIn(object) {
return object == null ? [] : baseValues(object, keysIn(object));
}
- function clamp3(number5, lower, upper) {
+ function clamp3(number4, lower, upper) {
if (upper === undefined2) {
upper = lower;
lower = undefined2;
@@ -8707,9 +8707,9 @@ var require_lodash = __commonJS({
lower = toNumber(lower);
lower = lower === lower ? lower : 0;
}
- return baseClamp(toNumber(number5), lower, upper);
+ return baseClamp(toNumber(number4), lower, upper);
}
- function inRange(number5, start, end) {
+ function inRange(number4, start, end) {
start = toFinite(start);
if (end === undefined2) {
end = start;
@@ -8717,8 +8717,8 @@ var require_lodash = __commonJS({
} else {
end = toFinite(end);
}
- number5 = toNumber(number5);
- return baseInRange(number5, start, end);
+ number4 = toNumber(number4);
+ return baseInRange(number4, start, end);
}
function random3(lower, upper, floating) {
if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
@@ -8756,129 +8756,129 @@ var require_lodash = __commonJS({
}
return baseRandom(lower, upper);
}
- var camelCase = createCompounder(function(result2, word, index3) {
+ var camelCase = createCompounder(function(result2, word, index2) {
word = word.toLowerCase();
- return result2 + (index3 ? capitalize(word) : word);
+ return result2 + (index2 ? capitalize(word) : word);
});
- function capitalize(string6) {
- return upperFirst(toString5(string6).toLowerCase());
+ function capitalize(string4) {
+ return upperFirst(toString4(string4).toLowerCase());
}
- function deburr(string6) {
- string6 = toString5(string6);
- return string6 && string6.replace(reLatin, deburrLetter).replace(reComboMark, "");
+ function deburr(string4) {
+ string4 = toString4(string4);
+ return string4 && string4.replace(reLatin, deburrLetter).replace(reComboMark, "");
}
- function endsWith2(string6, target, position3) {
- string6 = toString5(string6);
+ function endsWith2(string4, target, position) {
+ string4 = toString4(string4);
target = baseToString2(target);
- var length = string6.length;
- position3 = position3 === undefined2 ? length : baseClamp(toInteger2(position3), 0, length);
- var end = position3;
- position3 -= target.length;
- return position3 >= 0 && string6.slice(position3, end) == target;
- }
- function escape2(string6) {
- string6 = toString5(string6);
- return string6 && reHasUnescapedHtml.test(string6) ? string6.replace(reUnescapedHtml, escapeHtmlChar) : string6;
- }
- function escapeRegExp(string6) {
- string6 = toString5(string6);
- return string6 && reHasRegExpChar.test(string6) ? string6.replace(reRegExpChar, "\\$&") : string6;
- }
- var kebabCase = createCompounder(function(result2, word, index3) {
- return result2 + (index3 ? "-" : "") + word.toLowerCase();
+ var length = string4.length;
+ position = position === undefined2 ? length : baseClamp(toInteger2(position), 0, length);
+ var end = position;
+ position -= target.length;
+ return position >= 0 && string4.slice(position, end) == target;
+ }
+ function escape2(string4) {
+ string4 = toString4(string4);
+ return string4 && reHasUnescapedHtml.test(string4) ? string4.replace(reUnescapedHtml, escapeHtmlChar) : string4;
+ }
+ function escapeRegExp(string4) {
+ string4 = toString4(string4);
+ return string4 && reHasRegExpChar.test(string4) ? string4.replace(reRegExpChar, "\\$&") : string4;
+ }
+ var kebabCase = createCompounder(function(result2, word, index2) {
+ return result2 + (index2 ? "-" : "") + word.toLowerCase();
});
- var lowerCase = createCompounder(function(result2, word, index3) {
- return result2 + (index3 ? " " : "") + word.toLowerCase();
+ var lowerCase = createCompounder(function(result2, word, index2) {
+ return result2 + (index2 ? " " : "") + word.toLowerCase();
});
var lowerFirst = createCaseFirst("toLowerCase");
- function pad(string6, length, chars) {
- string6 = toString5(string6);
+ function pad(string4, length, chars) {
+ string4 = toString4(string4);
length = toInteger2(length);
- var strLength = length ? stringSize(string6) : 0;
+ var strLength = length ? stringSize(string4) : 0;
if (!length || strLength >= length) {
- return string6;
+ return string4;
}
var mid = (length - strLength) / 2;
- return createPadding(nativeFloor(mid), chars) + string6 + createPadding(nativeCeil(mid), chars);
+ return createPadding(nativeFloor(mid), chars) + string4 + createPadding(nativeCeil(mid), chars);
}
- function padEnd(string6, length, chars) {
- string6 = toString5(string6);
+ function padEnd(string4, length, chars) {
+ string4 = toString4(string4);
length = toInteger2(length);
- var strLength = length ? stringSize(string6) : 0;
- return length && strLength < length ? string6 + createPadding(length - strLength, chars) : string6;
+ var strLength = length ? stringSize(string4) : 0;
+ return length && strLength < length ? string4 + createPadding(length - strLength, chars) : string4;
}
- function padStart(string6, length, chars) {
- string6 = toString5(string6);
+ function padStart(string4, length, chars) {
+ string4 = toString4(string4);
length = toInteger2(length);
- var strLength = length ? stringSize(string6) : 0;
- return length && strLength < length ? createPadding(length - strLength, chars) + string6 : string6;
+ var strLength = length ? stringSize(string4) : 0;
+ return length && strLength < length ? createPadding(length - strLength, chars) + string4 : string4;
}
- function parseInt2(string6, radix, guard) {
+ function parseInt2(string4, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
- return nativeParseInt(toString5(string6).replace(reTrimStart, ""), radix || 0);
+ return nativeParseInt(toString4(string4).replace(reTrimStart, ""), radix || 0);
}
- function repeat(string6, n3, guard) {
- if (guard ? isIterateeCall(string6, n3, guard) : n3 === undefined2) {
+ function repeat(string4, n3, guard) {
+ if (guard ? isIterateeCall(string4, n3, guard) : n3 === undefined2) {
n3 = 1;
} else {
n3 = toInteger2(n3);
}
- return baseRepeat(toString5(string6), n3);
+ return baseRepeat(toString4(string4), n3);
}
function replace() {
- var args = arguments, string6 = toString5(args[0]);
- return args.length < 3 ? string6 : string6.replace(args[1], args[2]);
+ var args = arguments, string4 = toString4(args[0]);
+ return args.length < 3 ? string4 : string4.replace(args[1], args[2]);
}
- var snakeCase = createCompounder(function(result2, word, index3) {
- return result2 + (index3 ? "_" : "") + word.toLowerCase();
+ var snakeCase = createCompounder(function(result2, word, index2) {
+ return result2 + (index2 ? "_" : "") + word.toLowerCase();
});
- function split(string6, separator, limit) {
- if (limit && typeof limit != "number" && isIterateeCall(string6, separator, limit)) {
+ function split(string4, separator, limit) {
+ if (limit && typeof limit != "number" && isIterateeCall(string4, separator, limit)) {
separator = limit = undefined2;
}
limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
- string6 = toString5(string6);
- if (string6 && (typeof separator == "string" || separator != null && !isRegExp2(separator))) {
+ string4 = toString4(string4);
+ if (string4 && (typeof separator == "string" || separator != null && !isRegExp2(separator))) {
separator = baseToString2(separator);
- if (!separator && hasUnicode(string6)) {
- return castSlice(stringToArray(string6), 0, limit);
+ if (!separator && hasUnicode(string4)) {
+ return castSlice(stringToArray(string4), 0, limit);
}
}
- return string6.split(separator, limit);
+ return string4.split(separator, limit);
}
- var startCase = createCompounder(function(result2, word, index3) {
- return result2 + (index3 ? " " : "") + upperFirst(word);
+ var startCase = createCompounder(function(result2, word, index2) {
+ return result2 + (index2 ? " " : "") + upperFirst(word);
});
- function startsWith(string6, target, position3) {
- string6 = toString5(string6);
- position3 = position3 == null ? 0 : baseClamp(toInteger2(position3), 0, string6.length);
+ function startsWith(string4, target, position) {
+ string4 = toString4(string4);
+ position = position == null ? 0 : baseClamp(toInteger2(position), 0, string4.length);
target = baseToString2(target);
- return string6.slice(position3, position3 + target.length) == target;
+ return string4.slice(position, position + target.length) == target;
}
- function template2(string6, options, guard) {
+ function template2(string4, options, guard) {
var settings = lodash.templateSettings;
- if (guard && isIterateeCall(string6, options, guard)) {
+ if (guard && isIterateeCall(string4, options, guard)) {
options = undefined2;
}
- string6 = toString5(string6);
+ string4 = toString4(string4);
options = assignInWith({}, options, settings, customDefaultsAssignIn);
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
- var isEscaping, isEvaluating, index3 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
+ 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 reDelimiters = RegExp2(
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
"g"
);
- var sourceURL = "//# sourceURL=" + (hasOwnProperty4.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
- string6.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) {
+ var sourceURL = "//# sourceURL=" + (hasOwnProperty3.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
+ string4.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) {
interpolateValue || (interpolateValue = esTemplateValue);
- source += string6.slice(index3, offset2).replace(reUnescapedString, escapeStringChar);
+ source += string4.slice(index2, offset2).replace(reUnescapedString, escapeStringChar);
if (escapeValue) {
isEscaping = true;
source += "' +\n__e(" + escapeValue + ") +\n'";
@@ -8890,11 +8890,11 @@ var require_lodash = __commonJS({
if (interpolateValue) {
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
}
- index3 = offset2 + match2.length;
+ index2 = offset2 + match2.length;
return match2;
});
source += "';\n";
- var variable = hasOwnProperty4.call(options, "variable") && options.variable;
+ var variable = hasOwnProperty3.call(options, "variable") && options.variable;
if (!variable) {
source = "with (obj) {\n" + source + "\n}\n";
} else if (reForbiddenIdentifierChars.test(variable)) {
@@ -8912,76 +8912,76 @@ var require_lodash = __commonJS({
return result2;
}
function toLower(value) {
- return toString5(value).toLowerCase();
+ return toString4(value).toLowerCase();
}
function toUpper(value) {
- return toString5(value).toUpperCase();
+ return toString4(value).toUpperCase();
}
- function trim(string6, chars, guard) {
- string6 = toString5(string6);
- if (string6 && (guard || chars === undefined2)) {
- return baseTrim(string6);
+ function trim(string4, chars, guard) {
+ string4 = toString4(string4);
+ if (string4 && (guard || chars === undefined2)) {
+ return baseTrim(string4);
}
- if (!string6 || !(chars = baseToString2(chars))) {
- return string6;
+ if (!string4 || !(chars = baseToString2(chars))) {
+ return string4;
}
- var strSymbols = stringToArray(string6), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
+ var strSymbols = stringToArray(string4), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join("");
}
- function trimEnd(string6, chars, guard) {
- string6 = toString5(string6);
- if (string6 && (guard || chars === undefined2)) {
- return string6.slice(0, trimmedEndIndex(string6) + 1);
+ function trimEnd(string4, chars, guard) {
+ string4 = toString4(string4);
+ if (string4 && (guard || chars === undefined2)) {
+ return string4.slice(0, trimmedEndIndex(string4) + 1);
}
- if (!string6 || !(chars = baseToString2(chars))) {
- return string6;
+ if (!string4 || !(chars = baseToString2(chars))) {
+ return string4;
}
- var strSymbols = stringToArray(string6), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
+ var strSymbols = stringToArray(string4), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
return castSlice(strSymbols, 0, end).join("");
}
- function trimStart(string6, chars, guard) {
- string6 = toString5(string6);
- if (string6 && (guard || chars === undefined2)) {
- return string6.replace(reTrimStart, "");
+ function trimStart(string4, chars, guard) {
+ string4 = toString4(string4);
+ if (string4 && (guard || chars === undefined2)) {
+ return string4.replace(reTrimStart, "");
}
- if (!string6 || !(chars = baseToString2(chars))) {
- return string6;
+ if (!string4 || !(chars = baseToString2(chars))) {
+ return string4;
}
- var strSymbols = stringToArray(string6), start = charsStartIndex(strSymbols, stringToArray(chars));
+ var strSymbols = stringToArray(string4), start = charsStartIndex(strSymbols, stringToArray(chars));
return castSlice(strSymbols, start).join("");
}
- function truncate2(string6, options) {
- var length = DEFAULT_TRUNC_LENGTH, omission2 = DEFAULT_TRUNC_OMISSION;
+ function truncate2(string4, options) {
+ var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
if (isObject4(options)) {
var separator = "separator" in options ? options.separator : separator;
length = "length" in options ? toInteger2(options.length) : length;
- omission2 = "omission" in options ? baseToString2(options.omission) : omission2;
+ omission = "omission" in options ? baseToString2(options.omission) : omission;
}
- string6 = toString5(string6);
- var strLength = string6.length;
- if (hasUnicode(string6)) {
- var strSymbols = stringToArray(string6);
+ string4 = toString4(string4);
+ var strLength = string4.length;
+ if (hasUnicode(string4)) {
+ var strSymbols = stringToArray(string4);
strLength = strSymbols.length;
}
if (length >= strLength) {
- return string6;
+ return string4;
}
- var end = length - stringSize(omission2);
+ var end = length - stringSize(omission);
if (end < 1) {
- return omission2;
+ return omission;
}
- var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string6.slice(0, end);
+ var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string4.slice(0, end);
if (separator === undefined2) {
- return result2 + omission2;
+ return result2 + omission;
}
if (strSymbols) {
end += result2.length - end;
}
if (isRegExp2(separator)) {
- if (string6.slice(end).search(separator)) {
+ if (string4.slice(end).search(separator)) {
var match2, substring = result2;
if (!separator.global) {
- separator = RegExp2(separator.source, toString5(reFlags.exec(separator)) + "g");
+ separator = RegExp2(separator.source, toString4(reFlags.exec(separator)) + "g");
}
separator.lastIndex = 0;
while (match2 = separator.exec(substring)) {
@@ -8989,29 +8989,29 @@ var require_lodash = __commonJS({
}
result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
}
- } else if (string6.indexOf(baseToString2(separator), end) != end) {
- var index3 = result2.lastIndexOf(separator);
- if (index3 > -1) {
- result2 = result2.slice(0, index3);
+ } else if (string4.indexOf(baseToString2(separator), end) != end) {
+ var index2 = result2.lastIndexOf(separator);
+ if (index2 > -1) {
+ result2 = result2.slice(0, index2);
}
}
- return result2 + omission2;
+ return result2 + omission;
}
- function unescape(string6) {
- string6 = toString5(string6);
- return string6 && reHasEscapedHtml.test(string6) ? string6.replace(reEscapedHtml, unescapeHtmlChar) : string6;
+ function unescape(string4) {
+ string4 = toString4(string4);
+ return string4 && reHasEscapedHtml.test(string4) ? string4.replace(reEscapedHtml, unescapeHtmlChar) : string4;
}
- var upperCase = createCompounder(function(result2, word, index3) {
- return result2 + (index3 ? " " : "") + word.toUpperCase();
+ var upperCase = createCompounder(function(result2, word, index2) {
+ return result2 + (index2 ? " " : "") + word.toUpperCase();
});
var upperFirst = createCaseFirst("toUpperCase");
- function words(string6, pattern, guard) {
- string6 = toString5(string6);
+ function words(string4, pattern, guard) {
+ string4 = toString4(string4);
pattern = guard ? undefined2 : pattern;
if (pattern === undefined2) {
- return hasUnicodeWord(string6) ? unicodeWords(string6) : asciiWords(string6);
+ return hasUnicodeWord(string4) ? unicodeWords(string4) : asciiWords(string4);
}
- return string6.match(pattern) || [];
+ return string4.match(pattern) || [];
}
var attempt = baseRest(function(func, args) {
try {
@@ -9021,9 +9021,9 @@ var require_lodash = __commonJS({
}
});
var bindAll = flatRest(function(object, methodNames) {
- arrayEach(methodNames, function(key3) {
- key3 = toKey(key3);
- baseAssignValue(object, key3, bind(object[key3], object));
+ arrayEach(methodNames, function(key2) {
+ key2 = toKey(key2);
+ baseAssignValue(object, key2, bind(object[key2], object));
});
return object;
});
@@ -9036,9 +9036,9 @@ var require_lodash = __commonJS({
return [toIteratee(pair2[0]), pair2[1]];
});
return baseRest(function(args) {
- var index3 = -1;
- while (++index3 < length) {
- var pair2 = pairs[index3];
+ var index2 = -1;
+ while (++index2 < length) {
+ var pair2 = pairs[index2];
if (apply2(pair2[0], this, args)) {
return apply2(pair2[1], this, args);
}
@@ -9056,7 +9056,7 @@ var require_lodash = __commonJS({
function defaultTo(value, defaultValue2) {
return value == null || value !== value ? defaultValue2 : value;
}
- var flow3 = createFlow();
+ var flow = createFlow();
var flowRight = createFlow(true);
function identity2(value) {
return value;
@@ -9067,26 +9067,26 @@ var require_lodash = __commonJS({
function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}
- function matchesProperty(path3, srcValue) {
- return baseMatchesProperty(path3, baseClone(srcValue, CLONE_DEEP_FLAG));
+ function matchesProperty(path2, srcValue) {
+ return baseMatchesProperty(path2, baseClone(srcValue, CLONE_DEEP_FLAG));
}
- var method = baseRest(function(path3, args) {
+ var method = baseRest(function(path2, args) {
return function(object) {
- return baseInvoke(object, path3, args);
+ return baseInvoke(object, path2, args);
};
});
var methodOf = baseRest(function(object, args) {
- return function(path3) {
- return baseInvoke(object, path3, args);
+ return function(path2) {
+ return baseInvoke(object, path2, args);
};
});
function mixin2(object, source, options) {
- var props = keys2(source), methodNames = baseFunctions(source, props);
+ var props = keys(source), methodNames = baseFunctions(source, props);
if (options == null && !(isObject4(source) && (methodNames.length || !props.length))) {
options = source;
source = object;
object = this;
- methodNames = baseFunctions(source, keys2(source));
+ methodNames = baseFunctions(source, keys(source));
}
var chain3 = !(isObject4(options) && "chain" in options) || !!options.chain, isFunc = isFunction3(object);
arrayEach(methodNames, function(methodName) {
@@ -9108,8 +9108,8 @@ var require_lodash = __commonJS({
return object;
}
function noConflict() {
- if (root4._ === this) {
- root4._ = oldDash;
+ if (root._ === this) {
+ root._ = oldDash;
}
return this;
}
@@ -9124,12 +9124,12 @@ var require_lodash = __commonJS({
var over = createOver(arrayMap);
var overEvery = createOver(arrayEvery);
var overSome = createOver(arraySome);
- function property(path3) {
- return isKey(path3) ? baseProperty(toKey(path3)) : basePropertyDeep(path3);
+ function property(path2) {
+ return isKey(path2) ? baseProperty(toKey(path2)) : basePropertyDeep(path2);
}
function propertyOf(object) {
- return function(path3) {
- return object == null ? undefined2 : baseGet(object, path3);
+ return function(path2) {
+ return object == null ? undefined2 : baseGet(object, path2);
};
}
var range2 = createRange2();
@@ -9154,12 +9154,12 @@ var require_lodash = __commonJS({
if (n3 < 1 || n3 > MAX_SAFE_INTEGER2) {
return [];
}
- var index3 = MAX_ARRAY_LENGTH, length = nativeMin(n3, MAX_ARRAY_LENGTH);
+ var index2 = MAX_ARRAY_LENGTH, length = nativeMin(n3, MAX_ARRAY_LENGTH);
iteratee2 = getIteratee(iteratee2);
n3 -= MAX_ARRAY_LENGTH;
var result2 = baseTimes(length, iteratee2);
- while (++index3 < n3) {
- iteratee2(index3);
+ while (++index2 < n3) {
+ iteratee2(index2);
}
return result2;
}
@@ -9167,11 +9167,11 @@ var require_lodash = __commonJS({
if (isArray5(value)) {
return arrayMap(value, toKey);
}
- return isSymbol(value) ? [value] : copyArray(stringToPath(toString5(value)));
+ return isSymbol(value) ? [value] : copyArray(stringToPath(toString4(value)));
}
function uniqueId3(prefix) {
var id3 = ++idCounter;
- return toString5(prefix) + id3;
+ return toString4(prefix) + id3;
}
var add4 = createMathOperation(function(augend, addend) {
return augend + addend;
@@ -9232,7 +9232,7 @@ var require_lodash = __commonJS({
lodash.conforms = conforms;
lodash.constant = constant;
lodash.countBy = countBy;
- lodash.create = create3;
+ lodash.create = create2;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce7;
@@ -9256,7 +9256,7 @@ var require_lodash = __commonJS({
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
lodash.flip = flip;
- lodash.flow = flow3;
+ lodash.flow = flow;
lodash.flowRight = flowRight;
lodash.fromPairs = fromPairs;
lodash.functions = functions;
@@ -9271,15 +9271,15 @@ var require_lodash = __commonJS({
lodash.invokeMap = invokeMap;
lodash.iteratee = iteratee;
lodash.keyBy = keyBy;
- lodash.keys = keys2;
+ lodash.keys = keys;
lodash.keysIn = keysIn;
- lodash.map = map6;
+ lodash.map = map4;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize2;
- lodash.merge = merge2;
+ lodash.merge = merge;
lodash.mergeWith = mergeWith;
lodash.method = method;
lodash.methodOf = methodOf;
@@ -9353,7 +9353,7 @@ var require_lodash = __commonJS({
lodash.valuesIn = valuesIn;
lodash.without = without;
lodash.words = words;
- lodash.wrap = wrap3;
+ lodash.wrap = wrap;
lodash.xor = xor2;
lodash.xorBy = xorBy;
lodash.xorWith = xorWith;
@@ -9385,7 +9385,7 @@ var require_lodash = __commonJS({
lodash.escape = escape2;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every2;
- lodash.find = find3;
+ lodash.find = find2;
lodash.findIndex = findIndex3;
lodash.findKey = findKey2;
lodash.findLast = findLast;
@@ -9403,7 +9403,7 @@ var require_lodash = __commonJS({
lodash.gte = gte;
lodash.has = has;
lodash.hasIn = hasIn;
- lodash.head = head2;
+ lodash.head = head;
lodash.identity = identity2;
lodash.includes = includes;
lodash.indexOf = indexOf;
@@ -9415,7 +9415,7 @@ var require_lodash = __commonJS({
lodash.isArrayLike = isArrayLike;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean3;
- lodash.isBuffer = isBuffer2;
+ lodash.isBuffer = isBuffer;
lodash.isDate = isDate4;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty;
@@ -9436,7 +9436,7 @@ var require_lodash = __commonJS({
lodash.isNumber = isNumber4;
lodash.isObject = isObject4;
lodash.isObjectLike = isObjectLike2;
- lodash.isPlainObject = isPlainObject3;
+ lodash.isPlainObject = isPlainObject2;
lodash.isRegExp = isRegExp2;
lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
@@ -9446,7 +9446,7 @@ var require_lodash = __commonJS({
lodash.isUndefined = isUndefined2;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
- lodash.join = join4;
+ lodash.join = join2;
lodash.kebabCase = kebabCase;
lodash.last = last;
lodash.lastIndexOf = lastIndexOf;
@@ -9505,7 +9505,7 @@ var require_lodash = __commonJS({
lodash.toLower = toLower;
lodash.toNumber = toNumber;
lodash.toSafeInteger = toSafeInteger;
- lodash.toString = toString5;
+ lodash.toString = toString4;
lodash.toUpper = toUpper;
lodash.trim = trim;
lodash.trimEnd = trimEnd;
@@ -9517,11 +9517,11 @@ var require_lodash = __commonJS({
lodash.upperFirst = upperFirst;
lodash.each = forEach3;
lodash.eachRight = forEachRight;
- lodash.first = head2;
+ lodash.first = head;
mixin2(lodash, function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
- if (!hasOwnProperty4.call(lodash.prototype, methodName)) {
+ if (!hasOwnProperty3.call(lodash.prototype, methodName)) {
source[methodName] = func;
}
});
@@ -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, index3) {
+ arrayEach(["drop", "take"], function(methodName, index2) {
LazyWrapper.prototype[methodName] = function(n3) {
n3 = n3 === undefined2 ? 1 : nativeMax(toInteger2(n3), 0);
- var result2 = this.__filtered__ && !index3 ? new LazyWrapper(this) : this.clone();
+ var result2 = this.__filtered__ && !index2 ? 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, index3) {
- var type = index3 + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
+ arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) {
+ var type = index2 + 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, index3) {
- var takeName = "take" + (index3 ? "Right" : "");
+ arrayEach(["head", "last"], function(methodName, index2) {
+ var takeName = "take" + (index2 ? "Right" : "");
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
- arrayEach(["initial", "tail"], function(methodName, index3) {
- var dropName = "drop" + (index3 ? "" : "Right");
+ arrayEach(["initial", "tail"], function(methodName, index2) {
+ var dropName = "drop" + (index2 ? "" : "Right");
LazyWrapper.prototype[methodName] = function() {
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
};
@@ -9582,12 +9582,12 @@ var require_lodash = __commonJS({
LazyWrapper.prototype.findLast = function(predicate) {
return this.reverse().find(predicate);
};
- LazyWrapper.prototype.invokeMap = baseRest(function(path3, args) {
- if (typeof path3 == "function") {
+ LazyWrapper.prototype.invokeMap = baseRest(function(path2, args) {
+ if (typeof path2 == "function") {
return new LazyWrapper(this);
}
return this.map(function(value) {
- return baseInvoke(value, path3, args);
+ return baseInvoke(value, path2, args);
});
});
LazyWrapper.prototype.reject = function(predicate) {
@@ -9660,11 +9660,11 @@ var require_lodash = __commonJS({
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
- var key3 = lodashFunc.name + "";
- if (!hasOwnProperty4.call(realNames, key3)) {
- realNames[key3] = [];
+ var key2 = lodashFunc.name + "";
+ if (!hasOwnProperty3.call(realNames, key2)) {
+ realNames[key2] = [];
}
- realNames[key3].push({ "name": methodName, "func": lodashFunc });
+ realNames[key2].push({ "name": methodName, "func": lodashFunc });
}
});
realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
@@ -9689,7 +9689,7 @@ var require_lodash = __commonJS({
};
var _15 = runInContext();
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
- root4._ = _15;
+ root._ = _15;
define(function() {
return _15;
});
@@ -9697,7 +9697,7 @@ var require_lodash = __commonJS({
(freeModule.exports = _15)._ = _15;
freeExports._ = _15;
} else {
- root4._ = _15;
+ root._ = _15;
}
}).call(exports);
}
@@ -9751,13 +9751,13 @@ var require_scheduler_production_min = __commonJS({
return l2.now();
};
} else {
- p2 = Date, q2 = p2.now();
+ p = Date, q2 = p.now();
exports.unstable_now = function() {
- return p2.now() - q2;
+ return p.now() - q2;
};
}
var l2;
- var p2;
+ var p;
var q2;
var r2 = [];
var t5 = [];
@@ -9992,7 +9992,7 @@ var require_react_dom_production_min = __commonJS({
"use strict";
var aa = require_react();
var ca = require_scheduler();
- function p2(a4) {
+ function p(a4) {
for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a4, c3 = 1; c3 < arguments.length; c3++)
b2 += "&args[]=" + encodeURIComponent(arguments[c3]);
return "Minified React error #" + a4 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
@@ -10479,7 +10479,7 @@ var require_react_dom_production_min = __commonJS({
}
function gb(a4, b2) {
if (null != b2.dangerouslySetInnerHTML)
- throw Error(p2(91));
+ throw Error(p(91));
return A({}, b2, { value: void 0, defaultValue: void 0, children: "" + a4._wrapperState.initialValue });
}
function hb(a4, b2) {
@@ -10489,10 +10489,10 @@ var require_react_dom_production_min = __commonJS({
b2 = b2.defaultValue;
if (null != c3) {
if (null != b2)
- throw Error(p2(92));
+ throw Error(p(92));
if (eb(c3)) {
if (1 < c3.length)
- throw Error(p2(93));
+ throw Error(p(93));
c3 = c3[0];
}
b2 = c3;
@@ -10621,15 +10621,15 @@ var require_react_dom_production_min = __commonJS({
function ub(a4, b2) {
if (b2) {
if (tb[a4] && (null != b2.children || null != b2.dangerouslySetInnerHTML))
- throw Error(p2(137, a4));
+ throw Error(p(137, a4));
if (null != b2.dangerouslySetInnerHTML) {
if (null != b2.children)
- throw Error(p2(60));
+ throw Error(p(60));
if ("object" !== typeof b2.dangerouslySetInnerHTML || !("__html" in b2.dangerouslySetInnerHTML))
- throw Error(p2(61));
+ throw Error(p(61));
}
if (null != b2.style && "object" !== typeof b2.style)
- throw Error(p2(62));
+ throw Error(p(62));
}
}
function vb(a4, b2) {
@@ -10661,7 +10661,7 @@ var require_react_dom_production_min = __commonJS({
function Bb(a4) {
if (a4 = Cb(a4)) {
if ("function" !== typeof yb)
- throw Error(p2(280));
+ throw Error(p(280));
var b2 = a4.stateNode;
b2 && (b2 = Db(b2), yb(a4.stateNode, a4.type, b2));
}
@@ -10726,7 +10726,7 @@ var require_react_dom_production_min = __commonJS({
if (a4)
return null;
if (c3 && "function" !== typeof c3)
- throw Error(p2(231, b2, typeof c3));
+ throw Error(p(231, b2, typeof c3));
return c3;
}
var Lb = false;
@@ -10771,7 +10771,7 @@ var require_react_dom_production_min = __commonJS({
Ob = false;
Pb = null;
} else
- throw Error(p2(198));
+ throw Error(p(198));
Qb || (Qb = true, Rb = l2);
}
}
@@ -10799,14 +10799,14 @@ var require_react_dom_production_min = __commonJS({
}
function Xb(a4) {
if (Vb(a4) !== a4)
- throw Error(p2(188));
+ throw Error(p(188));
}
function Yb(a4) {
var b2 = a4.alternate;
if (!b2) {
b2 = Vb(a4);
if (null === b2)
- throw Error(p2(188));
+ throw Error(p(188));
return b2 !== a4 ? null : a4;
}
for (var c3 = a4, d4 = b2; ; ) {
@@ -10830,7 +10830,7 @@ var require_react_dom_production_min = __commonJS({
return Xb(e5), b2;
f2 = f2.sibling;
}
- throw Error(p2(188));
+ throw Error(p(188));
}
if (c3.return !== d4.return)
c3 = e5, d4 = f2;
@@ -10867,14 +10867,14 @@ var require_react_dom_production_min = __commonJS({
h3 = h3.sibling;
}
if (!g)
- throw Error(p2(189));
+ throw Error(p(189));
}
}
if (c3.alternate !== d4)
- throw Error(p2(190));
+ throw Error(p(190));
}
if (3 !== c3.tag)
- throw Error(p2(188));
+ throw Error(p(188));
return c3.stateNode.current === c3 ? a4 : b2;
}
function Zb(a4) {
@@ -11232,7 +11232,7 @@ var require_react_dom_production_min = __commonJS({
Vc(c3), null === c3.blockedOn && Qc.shift();
}
var cd = ua.ReactCurrentBatchConfig;
- var dd2 = true;
+ var dd = true;
function ed(a4, b2, c3, d4) {
var e5 = C, f2 = cd.transition;
cd.transition = null;
@@ -11252,7 +11252,7 @@ var require_react_dom_production_min = __commonJS({
}
}
function fd(a4, b2, c3, d4) {
- if (dd2) {
+ if (dd) {
var e5 = Yc(a4, b2, c3, d4);
if (null === e5)
hd(a4, b2, d4, id3, c3), Sc(a4, d4);
@@ -12227,7 +12227,7 @@ var require_react_dom_production_min = __commonJS({
function Af(a4, b2, c3) {
b2 = zf(b2);
if (zf(a4) !== b2 && c3)
- throw Error(p2(425));
+ throw Error(p(425));
}
function Bf() {
}
@@ -12331,7 +12331,7 @@ var require_react_dom_production_min = __commonJS({
function ue(a4) {
if (5 === a4.tag || 6 === a4.tag)
return a4.stateNode;
- throw Error(p2(33));
+ throw Error(p(33));
}
function Db(a4) {
return a4[Pf] || null;
@@ -12376,7 +12376,7 @@ var require_react_dom_production_min = __commonJS({
}
function ag(a4, b2, c3) {
if (H3.current !== Vf)
- throw Error(p2(168));
+ throw Error(p(168));
G2(H3, b2);
G2(Wf, c3);
}
@@ -12388,7 +12388,7 @@ var require_react_dom_production_min = __commonJS({
d4 = d4.getChildContext();
for (var e5 in d4)
if (!(e5 in b2))
- throw Error(p2(108, Ra(a4) || "Unknown", e5));
+ throw Error(p(108, Ra(a4) || "Unknown", e5));
return A({}, c3, d4);
}
function cg(a4) {
@@ -12401,7 +12401,7 @@ var require_react_dom_production_min = __commonJS({
function dg(a4, b2, c3) {
var d4 = a4.stateNode;
if (!d4)
- throw Error(p2(169));
+ throw Error(p(169));
c3 ? (a4 = bg(a4, b2, Xf), d4.__reactInternalMemoizedMergedChildContext = a4, E2(Wf), E2(H3), G2(H3, a4)) : E2(Wf);
G2(Wf, c3);
}
@@ -12518,14 +12518,14 @@ var require_react_dom_production_min = __commonJS({
var c3 = b2;
if (!Cg(a4, b2)) {
if (Dg(a4))
- throw Error(p2(418));
+ throw Error(p(418));
b2 = Lf(c3.nextSibling);
var d4 = xg;
b2 && Cg(a4, b2) ? Ag(d4, c3) : (a4.flags = a4.flags & -4097 | 2, I2 = false, xg = a4);
}
} else {
if (Dg(a4))
- throw Error(p2(418));
+ throw Error(p(418));
a4.flags = a4.flags & -4097 | 2;
I2 = false;
xg = a4;
@@ -12546,7 +12546,7 @@ var require_react_dom_production_min = __commonJS({
(b2 = 3 !== a4.tag) && !(b2 = 5 !== a4.tag) && (b2 = a4.type, b2 = "head" !== b2 && "body" !== b2 && !Ef(a4.type, a4.memoizedProps));
if (b2 && (b2 = yg)) {
if (Dg(a4))
- throw Hg(), Error(p2(418));
+ throw Hg(), Error(p(418));
for (; b2; )
Ag(a4, b2), b2 = Lf(b2.nextSibling);
}
@@ -12555,7 +12555,7 @@ var require_react_dom_production_min = __commonJS({
a4 = a4.memoizedState;
a4 = null !== a4 ? a4.dehydrated : null;
if (!a4)
- throw Error(p2(317));
+ throw Error(p(317));
a: {
a4 = a4.nextSibling;
for (b2 = 0; a4; ) {
@@ -12632,7 +12632,7 @@ var require_react_dom_production_min = __commonJS({
if (Pg !== a4)
if (a4 = { context: a4, memoizedValue: b2, next: null }, null === Og) {
if (null === Ng)
- throw Error(p2(308));
+ throw Error(p(308));
Og = a4;
Ng.dependencies = { lanes: 0, firstContext: a4 };
} else
@@ -12809,7 +12809,7 @@ var require_react_dom_production_min = __commonJS({
d4.callback = null;
d4 = c3;
if ("function" !== typeof e5)
- throw Error(p2(191, e5));
+ throw Error(p(191, e5));
e5.call(d4);
}
}
@@ -12890,11 +12890,11 @@ var require_react_dom_production_min = __commonJS({
c3 = c3._owner;
if (c3) {
if (1 !== c3.tag)
- throw Error(p2(309));
+ throw Error(p(309));
var d4 = c3.stateNode;
}
if (!d4)
- throw Error(p2(147, a4));
+ throw Error(p(147, a4));
var e5 = d4, f2 = "" + a4;
if (null !== b2 && null !== b2.ref && "function" === typeof b2.ref && b2.ref._stringRef === f2)
return b2.ref;
@@ -12907,15 +12907,15 @@ var require_react_dom_production_min = __commonJS({
return b2;
}
if ("string" !== typeof a4)
- throw Error(p2(284));
+ throw Error(p(284));
if (!c3._owner)
- throw Error(p2(290, a4));
+ throw Error(p(290, a4));
}
return a4;
}
function th(a4, b2) {
a4 = Object.prototype.toString.call(b2);
- throw Error(p2(31, "[object Object]" === a4 ? "object with keys {" + Object.keys(b2).join(", ") + "}" : a4));
+ throw Error(p(31, "[object Object]" === a4 ? "object with keys {" + Object.keys(b2).join(", ") + "}" : a4));
}
function uh(a4) {
var b2 = a4._init;
@@ -13087,10 +13087,10 @@ var require_react_dom_production_min = __commonJS({
function t5(e6, g2, h4, k3) {
var l3 = Ka(h4);
if ("function" !== typeof l3)
- throw Error(p2(150));
+ throw Error(p(150));
h4 = l3.call(h4);
if (null == h4)
- throw Error(p2(151));
+ throw Error(p(151));
for (var u3 = l3 = null, m5 = g2, w2 = g2 = 0, x2 = null, n4 = h4.next(); null !== m5 && !n4.done; w2++, n4 = h4.next()) {
m5.index > w2 ? (x2 = m5, m5 = null) : x2 = m5.sibling;
var t6 = r2(e6, m5, n4.value, k3);
@@ -13201,7 +13201,7 @@ var require_react_dom_production_min = __commonJS({
var Gh = Uf(Dh);
function Hh(a4) {
if (a4 === Dh)
- throw Error(p2(174));
+ throw Error(p(174));
return a4;
}
function Ih(a4, b2) {
@@ -13278,7 +13278,7 @@ var require_react_dom_production_min = __commonJS({
var Uh = 0;
var Vh = 0;
function Q3() {
- throw Error(p2(321));
+ throw Error(p(321));
}
function Wh(a4, b2) {
if (null === b2)
@@ -13302,7 +13302,7 @@ var require_react_dom_production_min = __commonJS({
Th = false;
Uh = 0;
if (25 <= f2)
- throw Error(p2(301));
+ throw Error(p(301));
f2 += 1;
P3 = O2 = null;
b2.updateQueue = null;
@@ -13316,7 +13316,7 @@ var require_react_dom_production_min = __commonJS({
P3 = O2 = N = null;
Sh = false;
if (b2)
- throw Error(p2(300));
+ throw Error(p(300));
return a4;
}
function bi() {
@@ -13340,7 +13340,7 @@ var require_react_dom_production_min = __commonJS({
P3 = b2, O2 = a4;
else {
if (null === a4)
- throw Error(p2(310));
+ throw Error(p(310));
O2 = a4;
a4 = { memoizedState: O2.memoizedState, baseState: O2.baseState, baseQueue: O2.baseQueue, queue: O2.queue, next: null };
null === P3 ? N.memoizedState = P3 = a4 : P3 = P3.next = a4;
@@ -13353,7 +13353,7 @@ var require_react_dom_production_min = __commonJS({
function fi(a4) {
var b2 = di(), c3 = b2.queue;
if (null === c3)
- throw Error(p2(311));
+ throw Error(p(311));
c3.lastRenderedReducer = a4;
var d4 = O2, e5 = d4.baseQueue, f2 = c3.pending;
if (null !== f2) {
@@ -13407,7 +13407,7 @@ var require_react_dom_production_min = __commonJS({
function gi(a4) {
var b2 = di(), c3 = b2.queue;
if (null === c3)
- throw Error(p2(311));
+ throw Error(p(311));
c3.lastRenderedReducer = a4;
var d4 = c3.dispatch, e5 = c3.pending, f2 = b2.memoizedState;
if (null !== e5) {
@@ -13432,9 +13432,9 @@ var require_react_dom_production_min = __commonJS({
ji(ki.bind(null, c3, d4, a4), [a4]);
if (d4.getSnapshot !== b2 || f2 || null !== P3 && P3.memoizedState.tag & 1) {
c3.flags |= 2048;
- li2(9, mi.bind(null, c3, d4, e5, b2), void 0, null);
+ li(9, mi.bind(null, c3, d4, e5, b2), void 0, null);
if (null === R2)
- throw Error(p2(349));
+ throw Error(p(349));
0 !== (Rh & 30) || ni(c3, b2, e5);
}
return e5;
@@ -13478,7 +13478,7 @@ var require_react_dom_production_min = __commonJS({
a4 = a4.dispatch = ri.bind(null, N, a4);
return [b2.memoizedState, a4];
}
- function li2(a4, b2, c3, d4) {
+ function li(a4, b2, c3, d4) {
a4 = { tag: a4, create: b2, destroy: c3, deps: d4, next: null };
b2 = N.updateQueue;
null === b2 ? (b2 = { lastEffect: null, stores: null }, N.updateQueue = b2, b2.lastEffect = a4.next = a4) : (c3 = b2.lastEffect, null === c3 ? b2.lastEffect = a4.next = a4 : (d4 = c3.next, c3.next = a4, a4.next = d4, b2.lastEffect = a4));
@@ -13490,7 +13490,7 @@ var require_react_dom_production_min = __commonJS({
function ti(a4, b2, c3, d4) {
var e5 = ci();
N.flags |= a4;
- e5.memoizedState = li2(1 | b2, c3, void 0, void 0 === d4 ? null : d4);
+ e5.memoizedState = li(1 | b2, c3, void 0, void 0 === d4 ? null : d4);
}
function ui(a4, b2, c3, d4) {
var e5 = di();
@@ -13500,12 +13500,12 @@ var require_react_dom_production_min = __commonJS({
var g = O2.memoizedState;
f2 = g.destroy;
if (null !== d4 && Wh(d4, g.deps)) {
- e5.memoizedState = li2(b2, c3, f2, d4);
+ e5.memoizedState = li(b2, c3, f2, d4);
return;
}
}
N.flags |= a4;
- e5.memoizedState = li2(1 | b2, c3, f2, d4);
+ e5.memoizedState = li(1 | b2, c3, f2, d4);
}
function vi(a4, b2) {
return ti(8390656, 8, a4, b2);
@@ -13675,12 +13675,12 @@ var require_react_dom_production_min = __commonJS({
var d4 = N, e5 = ci();
if (I2) {
if (void 0 === c3)
- throw Error(p2(407));
+ throw Error(p(407));
c3 = c3();
} else {
c3 = b2();
if (null === R2)
- throw Error(p2(349));
+ throw Error(p(349));
0 !== (Rh & 30) || ni(d4, b2, c3);
}
e5.memoizedState = c3;
@@ -13693,7 +13693,7 @@ var require_react_dom_production_min = __commonJS({
a4
), [a4]);
d4.flags |= 2048;
- li2(9, mi.bind(null, d4, f2, c3, b2), void 0, null);
+ li(9, mi.bind(null, d4, f2, c3, b2), void 0, null);
return c3;
}, useId: function() {
var a4 = ci(), b2 = R2.identifierPrefix;
@@ -14062,7 +14062,7 @@ var require_react_dom_production_min = __commonJS({
function sj(a4, b2, c3, d4, e5, f2, g) {
if (c3) {
if (b2.flags & 256)
- return b2.flags &= -257, d4 = Li(Error(p2(422))), tj(a4, b2, g, d4);
+ return b2.flags &= -257, d4 = Li(Error(p(422))), tj(a4, b2, g, d4);
if (null !== b2.memoizedState)
return b2.child = a4.child, b2.flags |= 128, null;
f2 = d4.fallback;
@@ -14086,7 +14086,7 @@ var require_react_dom_production_min = __commonJS({
if (d4)
var h3 = d4.dgst;
d4 = h3;
- f2 = Error(p2(419));
+ f2 = Error(p(419));
d4 = Li(f2, d4, void 0);
return tj(a4, b2, g, d4);
}
@@ -14134,7 +14134,7 @@ var require_react_dom_production_min = __commonJS({
0 !== e5 && e5 !== f2.retryLane && (f2.retryLane = e5, Zg(a4, e5), mh(d4, a4, e5, -1));
}
uj();
- d4 = Li(Error(p2(421)));
+ d4 = Li(Error(p(421)));
return tj(a4, b2, g, d4);
}
if ("$?" === e5.data)
@@ -14236,7 +14236,7 @@ var require_react_dom_production_min = __commonJS({
if (0 === (c3 & b2.childLanes))
return null;
if (null !== a4 && b2.child !== a4.child)
- throw Error(p2(153));
+ throw Error(p(153));
if (null !== b2.child) {
a4 = b2.child;
c3 = wh(a4, a4.pendingProps);
@@ -14455,7 +14455,7 @@ var require_react_dom_production_min = __commonJS({
else {
if (!d4) {
if (null === b2.stateNode)
- throw Error(p2(166));
+ throw Error(p(166));
S3(b2);
return null;
}
@@ -14661,7 +14661,7 @@ var require_react_dom_production_min = __commonJS({
Dj(a4, b2, a4.memoizedProps, d4);
else {
if ("string" !== typeof d4 && null === b2.stateNode)
- throw Error(p2(166));
+ throw Error(p(166));
c3 = Hh(Gh.current);
Hh(Eh.current);
if (Gg(b2)) {
@@ -14693,11 +14693,11 @@ var require_react_dom_production_min = __commonJS({
else if (f2 = Gg(b2), null !== d4 && null !== d4.dehydrated) {
if (null === a4) {
if (!f2)
- throw Error(p2(318));
+ throw Error(p(318));
f2 = b2.memoizedState;
f2 = null !== f2 ? f2.dehydrated : null;
if (!f2)
- throw Error(p2(317));
+ throw Error(p(317));
f2[Of] = b2;
} else
Ig(), 0 === (b2.flags & 128) && (b2.memoizedState = null), b2.flags |= 4;
@@ -14772,7 +14772,7 @@ var require_react_dom_production_min = __commonJS({
case 25:
return null;
}
- throw Error(p2(156, b2.tag));
+ throw Error(p(156, b2.tag));
}
function Jj(a4, b2) {
wg(b2);
@@ -14788,7 +14788,7 @@ var require_react_dom_production_min = __commonJS({
a4 = b2.memoizedState;
if (null !== a4 && null !== a4.dehydrated) {
if (null === b2.alternate)
- throw Error(p2(340));
+ throw Error(p(340));
Ig();
}
a4 = b2.flags;
@@ -14833,7 +14833,7 @@ var require_react_dom_production_min = __commonJS({
}
var Oj = false;
function Pj(a4, b2) {
- Cf = dd2;
+ Cf = dd;
a4 = Me();
if (Ne(a4)) {
if ("selectionStart" in a4)
@@ -14884,7 +14884,7 @@ var require_react_dom_production_min = __commonJS({
} else
c3 = null;
Df = { focusedElem: a4, selectionRange: c3 };
- dd2 = false;
+ dd = false;
for (V = b2; null !== V; )
if (b2 = V, a4 = b2.child, 0 !== (b2.subtreeFlags & 1028) && null !== a4)
a4.return = b2, V = a4;
@@ -14915,7 +14915,7 @@ var require_react_dom_production_min = __commonJS({
case 17:
break;
default:
- throw Error(p2(163));
+ throw Error(p(163));
}
} catch (F) {
W(b2, b2.return, F);
@@ -15138,7 +15138,7 @@ var require_react_dom_production_min = __commonJS({
h3 = h3.return;
}
if (null === X2)
- throw Error(p2(160));
+ throw Error(p(160));
ak(f2, g, e5);
X2 = null;
Yj = false;
@@ -15233,7 +15233,7 @@ var require_react_dom_production_min = __commonJS({
fk(a4);
if (d4 & 4) {
if (null === a4.stateNode)
- throw Error(p2(162));
+ throw Error(p(162));
e5 = a4.stateNode;
f2 = a4.memoizedProps;
try {
@@ -15371,7 +15371,7 @@ var require_react_dom_production_min = __commonJS({
}
c3 = c3.return;
}
- throw Error(p2(160));
+ throw Error(p(160));
}
switch (d4.tag) {
case 5:
@@ -15386,7 +15386,7 @@ var require_react_dom_production_min = __commonJS({
Wj(a4, h3, g);
break;
default:
- throw Error(p2(161));
+ throw Error(p(161));
}
} catch (k2) {
W(a4, a4.return, k2);
@@ -15506,7 +15506,7 @@ var require_react_dom_production_min = __commonJS({
case 25:
break;
default:
- throw Error(p2(163));
+ throw Error(p(163));
}
U || b2.flags & 512 && Sj(b2);
} catch (r2) {
@@ -15600,7 +15600,7 @@ var require_react_dom_production_min = __commonJS({
}
var mk = Math.ceil;
var nk = ua.ReactCurrentDispatcher;
- var ok2 = ua.ReactCurrentOwner;
+ var ok = ua.ReactCurrentOwner;
var pk = ua.ReactCurrentBatchConfig;
var K2 = 0;
var R2 = null;
@@ -15647,7 +15647,7 @@ var require_react_dom_production_min = __commonJS({
}
function mh(a4, b2, c3, d4) {
if (50 < zk)
- throw zk = 0, Ak = null, Error(p2(185));
+ throw zk = 0, Ak = null, Error(p(185));
Ac(a4, c3, d4);
if (0 === (K2 & 2) || a4 !== R2)
a4 === R2 && (0 === (K2 & 2) && (rk |= c3), 4 === T3 && Dk(a4, Z)), Ek(a4, d4), 1 === c3 && 0 === K2 && 0 === (b2.mode & 1) && (Hj = B2() + 500, fg && jg());
@@ -15691,7 +15691,7 @@ var require_react_dom_production_min = __commonJS({
Bk = -1;
Ck = 0;
if (0 !== (K2 & 6))
- throw Error(p2(327));
+ throw Error(p(327));
var c3 = a4.callbackNode;
if (Ik() && a4.callbackNode !== c3)
return null;
@@ -15735,7 +15735,7 @@ var require_react_dom_production_min = __commonJS({
switch (b2) {
case 0:
case 1:
- throw Error(p2(345));
+ throw Error(p(345));
case 2:
Qk(a4, uk, vk);
break;
@@ -15780,7 +15780,7 @@ var require_react_dom_production_min = __commonJS({
Qk(a4, uk, vk);
break;
default:
- throw Error(p2(329));
+ throw Error(p(329));
}
}
}
@@ -15843,7 +15843,7 @@ var require_react_dom_production_min = __commonJS({
}
function Fk(a4) {
if (0 !== (K2 & 6))
- throw Error(p2(327));
+ throw Error(p(327));
Ik();
var b2 = uc(a4, 0);
if (0 === (b2 & 1))
@@ -15856,7 +15856,7 @@ var require_react_dom_production_min = __commonJS({
if (1 === c3)
throw c3 = qk, Lk(a4, 0), Dk(a4, b2), Ek(a4, B2()), c3;
if (6 === c3)
- throw Error(p2(345));
+ throw Error(p(345));
a4.finishedWork = a4.current.alternate;
a4.finishedLanes = b2;
Qk(a4, uk, vk);
@@ -15970,7 +15970,7 @@ var require_react_dom_production_min = __commonJS({
P3 = O2 = N = null;
Th = false;
Uh = 0;
- ok2.current = null;
+ ok.current = null;
if (null === c3 || null === c3.return) {
T3 = 1;
qk = b2;
@@ -16008,7 +16008,7 @@ var require_react_dom_production_min = __commonJS({
uj();
break a;
}
- k2 = Error(p2(426));
+ k2 = Error(p(426));
}
} else if (I2 && h3.mode & 1) {
var J = Vi(g);
@@ -16084,7 +16084,7 @@ var require_react_dom_production_min = __commonJS({
K2 = c3;
nk.current = d4;
if (null !== Y2)
- throw Error(p2(261));
+ throw Error(p(261));
R2 = null;
Z = 0;
return T3;
@@ -16101,7 +16101,7 @@ var require_react_dom_production_min = __commonJS({
var b2 = Wk(a4.alternate, a4, gj);
a4.memoizedProps = a4.pendingProps;
null === b2 ? Tk(a4) : Y2 = b2;
- ok2.current = null;
+ ok.current = null;
}
function Tk(a4) {
var b2 = a4;
@@ -16151,7 +16151,7 @@ var require_react_dom_production_min = __commonJS({
Ik();
while (null !== xk);
if (0 !== (K2 & 6))
- throw Error(p2(327));
+ throw Error(p(327));
c3 = a4.finishedWork;
var e5 = a4.finishedLanes;
if (null === c3)
@@ -16159,7 +16159,7 @@ var require_react_dom_production_min = __commonJS({
a4.finishedWork = null;
a4.finishedLanes = 0;
if (c3 === a4.current)
- throw Error(p2(177));
+ throw Error(p(177));
a4.callbackNode = null;
a4.callbackPriority = 0;
var f2 = c3.lanes | c3.childLanes;
@@ -16177,11 +16177,11 @@ var require_react_dom_production_min = __commonJS({
C = 1;
var h3 = K2;
K2 |= 4;
- ok2.current = null;
+ ok.current = null;
Pj(a4, c3);
ek(c3, a4);
Oe(Df);
- dd2 = !!Cf;
+ dd = !!Cf;
Df = Cf = null;
a4.current = c3;
ik(c3, a4, e5);
@@ -16220,7 +16220,7 @@ var require_react_dom_production_min = __commonJS({
xk = null;
yk = 0;
if (0 !== (K2 & 6))
- throw Error(p2(331));
+ throw Error(p(331));
var e5 = K2;
K2 |= 4;
for (V = a4.current; null !== V; ) {
@@ -16406,7 +16406,7 @@ var require_react_dom_production_min = __commonJS({
d4 = a4.stateNode;
break;
default:
- throw Error(p2(314));
+ throw Error(p(314));
}
null !== d4 && d4.delete(b2);
Zk(a4, c3);
@@ -16460,7 +16460,7 @@ var require_react_dom_production_min = __commonJS({
b2 = aj(null, b2, d4, Lg(d4.type, a4), c3);
break a;
}
- throw Error(p2(
+ throw Error(p(
306,
d4,
""
@@ -16475,7 +16475,7 @@ var require_react_dom_production_min = __commonJS({
a: {
lj(b2);
if (null === a4)
- throw Error(p2(387));
+ throw Error(p(387));
d4 = b2.pendingProps;
f2 = b2.memoizedState;
e5 = f2.element;
@@ -16485,11 +16485,11 @@ var require_react_dom_production_min = __commonJS({
d4 = g.element;
if (f2.isDehydrated)
if (f2 = { element: d4, isDehydrated: false, cache: g.cache, pendingSuspenseBoundaries: g.pendingSuspenseBoundaries, transitions: g.transitions }, b2.updateQueue.baseState = f2, b2.memoizedState = f2, b2.flags & 256) {
- e5 = Ki(Error(p2(423)), b2);
+ e5 = Ki(Error(p(423)), b2);
b2 = mj(a4, b2, d4, c3, e5);
break a;
} else if (d4 !== e5) {
- e5 = Ki(Error(p2(424)), b2);
+ e5 = Ki(Error(p(424)), b2);
b2 = mj(a4, b2, d4, c3, e5);
break a;
} else
@@ -16572,7 +16572,7 @@ var require_react_dom_production_min = __commonJS({
else if (18 === f2.tag) {
g = f2.return;
if (null === g)
- throw Error(p2(341));
+ throw Error(p(341));
g.lanes |= c3;
h3 = g.alternate;
null !== h3 && (h3.lanes |= c3);
@@ -16615,7 +16615,7 @@ var require_react_dom_production_min = __commonJS({
case 22:
return ej(a4, b2, c3);
}
- throw Error(p2(156, b2.tag));
+ throw Error(p(156, b2.tag));
};
function Gk(a4, b2) {
return ac(a4, b2);
@@ -16714,7 +16714,7 @@ var require_react_dom_production_min = __commonJS({
d4 = null;
break a;
}
- throw Error(p2(130, null == a4 ? a4 : typeof a4, ""));
+ throw Error(p(130, null == a4 ? a4 : typeof a4, ""));
}
b2 = Bg(g, c3, b2, e5);
b2.elementType = a4;
@@ -16780,7 +16780,7 @@ var require_react_dom_production_min = __commonJS({
a4 = a4._reactInternals;
a: {
if (Vb(a4) !== a4 || 1 !== a4.tag)
- throw Error(p2(170));
+ throw Error(p(170));
var b2 = a4;
do {
switch (b2.tag) {
@@ -16795,7 +16795,7 @@ var require_react_dom_production_min = __commonJS({
}
b2 = b2.return;
} while (null !== b2);
- throw Error(p2(171));
+ throw Error(p(171));
}
if (1 === a4.tag) {
var c3 = a4.type;
@@ -16864,7 +16864,7 @@ var require_react_dom_production_min = __commonJS({
nl.prototype.render = ml.prototype.render = function(a4) {
var b2 = this._internalRoot;
if (null === b2)
- throw Error(p2(409));
+ throw Error(p(409));
gl(a4, b2, null, null);
};
nl.prototype.unmount = ml.prototype.unmount = function() {
@@ -17013,7 +17013,7 @@ var require_react_dom_production_min = __commonJS({
if (d4 !== a4 && d4.form === a4.form) {
var e5 = Db(d4);
if (!e5)
- throw Error(p2(90));
+ throw Error(p(90));
Wa(d4);
bb(d4, e5);
}
@@ -17048,12 +17048,12 @@ var require_react_dom_production_min = __commonJS({
exports.createPortal = function(a4, b2) {
var c3 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
if (!ol(b2))
- throw Error(p2(200));
+ throw Error(p(200));
return dl(a4, b2, null, c3);
};
exports.createRoot = function(a4, b2) {
if (!ol(a4))
- throw Error(p2(299));
+ throw Error(p(299));
var c3 = false, d4 = "", e5 = ll;
null !== b2 && void 0 !== b2 && (true === b2.unstable_strictMode && (c3 = true), void 0 !== b2.identifierPrefix && (d4 = b2.identifierPrefix), void 0 !== b2.onRecoverableError && (e5 = b2.onRecoverableError));
b2 = cl(a4, 1, false, null, null, c3, false, d4, e5);
@@ -17069,9 +17069,9 @@ var require_react_dom_production_min = __commonJS({
var b2 = a4._reactInternals;
if (void 0 === b2) {
if ("function" === typeof a4.render)
- throw Error(p2(188));
+ throw Error(p(188));
a4 = Object.keys(a4).join(",");
- throw Error(p2(268, a4));
+ throw Error(p(268, a4));
}
a4 = Zb(b2);
a4 = null === a4 ? null : a4.stateNode;
@@ -17082,12 +17082,12 @@ var require_react_dom_production_min = __commonJS({
};
exports.hydrate = function(a4, b2, c3) {
if (!pl(b2))
- throw Error(p2(200));
+ throw Error(p(200));
return sl(null, a4, b2, true, c3);
};
exports.hydrateRoot = function(a4, b2, c3) {
if (!ol(a4))
- throw Error(p2(405));
+ throw Error(p(405));
var d4 = null != c3 && c3.hydratedSources || null, e5 = false, f2 = "", g = ll;
null !== c3 && void 0 !== c3 && (true === c3.unstable_strictMode && (e5 = true), void 0 !== c3.identifierPrefix && (f2 = c3.identifierPrefix), void 0 !== c3.onRecoverableError && (g = c3.onRecoverableError));
b2 = fl(b2, null, a4, 1, null != c3 ? c3 : null, e5, false, f2, g);
@@ -17103,12 +17103,12 @@ var require_react_dom_production_min = __commonJS({
};
exports.render = function(a4, b2, c3) {
if (!pl(b2))
- throw Error(p2(200));
+ throw Error(p(200));
return sl(null, a4, b2, false, c3);
};
exports.unmountComponentAtNode = function(a4) {
if (!pl(a4))
- throw Error(p2(40));
+ throw Error(p(40));
return a4._reactRootContainer ? (Sk(function() {
sl(null, null, a4, false, function() {
a4._reactRootContainer = null;
@@ -17119,9 +17119,9 @@ var require_react_dom_production_min = __commonJS({
exports.unstable_batchedUpdates = Rk;
exports.unstable_renderSubtreeIntoContainer = function(a4, b2, c3, d4) {
if (!pl(c3))
- throw Error(p2(200));
+ throw Error(p(200));
if (null == a4 || void 0 === a4._reactInternals)
- throw Error(p2(38));
+ throw Error(p(38));
return sl(a4, b2, c3, false, d4);
};
exports.version = "18.2.0-next-9e3b772b8-20220608";
@@ -17161,7 +17161,7 @@ var require_typed_function = __commonJS({
typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory2() : typeof define === "function" && define.amd ? define(factory2) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2["'typed'"] = factory2());
})(exports, function() {
"use strict";
- function ok2() {
+ function ok() {
return true;
}
function notOk() {
@@ -17171,8 +17171,8 @@ var require_typed_function = __commonJS({
return void 0;
}
const NOT_TYPED_FUNCTION = "Argument is not a typed-function.";
- function create3() {
- function isPlainObject3(x2) {
+ function create2() {
+ function isPlainObject2(x2) {
return typeof x2 === "object" && x2 !== null && x2.constructor === Object;
}
const _types = [{
@@ -17210,7 +17210,7 @@ var require_typed_function = __commonJS({
}
}, {
name: "Object",
- test: isPlainObject3
+ test: isPlainObject2
}, {
name: "null",
test: function(x2) {
@@ -17224,7 +17224,7 @@ var require_typed_function = __commonJS({
}];
const anyType = {
name: "any",
- test: ok2,
+ test: ok,
isAny: true
};
let typeMap;
@@ -17358,10 +17358,10 @@ var require_typed_function = __commonJS({
}
throw new TypeError("Signature not found (signature: " + (fn.name || "unnamed") + "(" + stringifyParams(params, ", ") + "))");
}
- function find3(fn, signature, options) {
+ function find2(fn, signature, options) {
return findSignature(fn, signature, options).implementation;
}
- function convert2(value, typeName4) {
+ function convert(value, typeName4) {
const type = findType(typeName4);
if (type.test(value)) {
return value;
@@ -17380,7 +17380,7 @@ var require_typed_function = __commonJS({
}
function stringifyParams(params) {
let separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ",";
- return params.map((p2) => p2.name).join(separator);
+ return params.map((p) => p.name).join(separator);
}
function parseParam(param) {
const restParam = param.indexOf("...") === 0;
@@ -17469,7 +17469,7 @@ var require_typed_function = __commonJS({
}
function compileTest(param) {
if (!param || param.types.length === 0) {
- return ok2;
+ return ok;
} else if (param.types.length === 1) {
return findType(param.types[0].name).test;
} else if (param.types.length === 2) {
@@ -17543,11 +17543,11 @@ var require_typed_function = __commonJS({
}
}
}
- function getParamAtIndex(params, index3) {
- return index3 < params.length ? params[index3] : hasRestParam(params) ? last(params) : null;
+ function getParamAtIndex(params, index2) {
+ return index2 < params.length ? params[index2] : hasRestParam(params) ? last(params) : null;
}
- function getTypeSetAtIndex(params, index3) {
- const param = getParamAtIndex(params, index3);
+ function getTypeSetAtIndex(params, index2) {
+ const param = getParamAtIndex(params, index2);
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, index3) {
+ function mergeExpectedParams(signatures, index2) {
const typeSet = /* @__PURE__ */ new Set();
signatures.forEach((signature) => {
- const paramSet = getTypeSetAtIndex(signature.params, index3);
+ const paramSet = getTypeSetAtIndex(signature.params, index2);
let name317;
for (name317 of paramSet) {
typeSet.add(name317);
@@ -17571,25 +17571,25 @@ var require_typed_function = __commonJS({
let err, expected;
const _name = name317 || "unnamed";
let matchingSignatures = signatures;
- let index3;
- for (index3 = 0; index3 < args.length; index3++) {
+ let index2;
+ for (index2 = 0; index2 < args.length; index2++) {
const nextMatchingDefs = [];
matchingSignatures.forEach((signature) => {
- const param = getParamAtIndex(signature.params, index3);
+ const param = getParamAtIndex(signature.params, index2);
const test = compileTest(param);
- if ((index3 < signature.params.length || hasRestParam(signature.params)) && test(args[index3])) {
+ if ((index2 < signature.params.length || hasRestParam(signature.params)) && test(args[index2])) {
nextMatchingDefs.push(signature);
}
});
if (nextMatchingDefs.length === 0) {
- expected = mergeExpectedParams(matchingSignatures, index3);
+ expected = mergeExpectedParams(matchingSignatures, index2);
if (expected.length > 0) {
- const actualTypes = findTypeNames(args[index3]);
- err = new TypeError("Unexpected type of argument in function " + _name + " (expected: " + expected.join(" or ") + ", actual: " + actualTypes.join(" | ") + ", index: " + index3 + ")");
+ const actualTypes = findTypeNames(args[index2]);
+ err = new TypeError("Unexpected type of argument in function " + _name + " (expected: " + expected.join(" or ") + ", actual: " + actualTypes.join(" | ") + ", index: " + index2 + ")");
err.data = {
category: "wrongType",
fn: _name,
- index: index3,
+ index: index2,
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, index3);
+ expected = mergeExpectedParams(matchingSignatures, index2);
err = new TypeError("Too few arguments in function " + _name + " (expected: " + expected.join(" or ") + ", index: " + args.length + ")");
err.data = {
category: "tooFewArgs",
@@ -17791,7 +17791,7 @@ var require_typed_function = __commonJS({
}
function compileArgsPreprocessing(params, fn) {
let fnConvert = fn;
- if (params.some((p2) => p2.hasConversion)) {
+ if (params.some((p) => p.hasConversion)) {
const restParam = hasRestParam(params);
const compiledConversions = params.map(compileArgConversion);
fnConvert = function convertArgs() {
@@ -17865,9 +17865,9 @@ var require_typed_function = __commonJS({
}
}
function splitParams(params) {
- function _splitParams(params2, index3, paramsSoFar) {
- if (index3 < params2.length) {
- const param = params2[index3];
+ function _splitParams(params2, index2, paramsSoFar) {
+ if (index2 < params2.length) {
+ const param = params2[index2];
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, index3 + 1, paramsSoFar.concat([nextParam]));
+ return _splitParams(params2, index2 + 1, paramsSoFar.concat([nextParam]));
});
} else {
return [paramsSoFar];
@@ -18031,7 +18031,7 @@ var require_typed_function = __commonJS({
name: spName,
fn: functionIndex
});
- if (sp.every((p2) => !p2.hasConversion)) {
+ if (sp.every((p) => !p.hasConversion)) {
signaturesMap[spName] = functionIndex;
}
}
@@ -18055,23 +18055,23 @@ var require_typed_function = __commonJS({
}
const ok0 = signatures[0] && signatures[0].params.length <= 2 && !hasRestParam(signatures[0].params);
const ok1 = signatures[1] && signatures[1].params.length <= 2 && !hasRestParam(signatures[1].params);
- const ok22 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params);
+ const ok2 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params);
const ok3 = signatures[3] && signatures[3].params.length <= 2 && !hasRestParam(signatures[3].params);
const ok4 = signatures[4] && signatures[4].params.length <= 2 && !hasRestParam(signatures[4].params);
const ok5 = signatures[5] && signatures[5].params.length <= 2 && !hasRestParam(signatures[5].params);
- const allOk = ok0 && ok1 && ok22 && ok3 && ok4 && ok5;
+ const allOk = ok0 && ok1 && ok2 && ok3 && ok4 && ok5;
for (let i4 = 0; i4 < signatures.length; ++i4) {
signatures[i4].test = compileTests(signatures[i4].params);
}
const test00 = ok0 ? compileTest(signatures[0].params[0]) : notOk;
const test10 = ok1 ? compileTest(signatures[1].params[0]) : notOk;
- const test20 = ok22 ? compileTest(signatures[2].params[0]) : notOk;
+ const test20 = ok2 ? compileTest(signatures[2].params[0]) : notOk;
const test30 = ok3 ? compileTest(signatures[3].params[0]) : notOk;
const test40 = ok4 ? compileTest(signatures[4].params[0]) : notOk;
const test50 = ok5 ? compileTest(signatures[5].params[0]) : notOk;
const test01 = ok0 ? compileTest(signatures[0].params[1]) : notOk;
const test11 = ok1 ? compileTest(signatures[1].params[1]) : notOk;
- const test21 = ok22 ? compileTest(signatures[2].params[1]) : notOk;
+ const test21 = ok2 ? compileTest(signatures[2].params[1]) : notOk;
const test31 = ok3 ? compileTest(signatures[3].params[1]) : notOk;
const test41 = ok4 ? compileTest(signatures[4].params[1]) : notOk;
const test51 = ok5 ? compileTest(signatures[5].params[1]) : notOk;
@@ -18080,13 +18080,13 @@ var require_typed_function = __commonJS({
}
const fn0 = ok0 ? signatures[0].implementation : undef;
const fn1 = ok1 ? signatures[1].implementation : undef;
- const fn2 = ok22 ? signatures[2].implementation : undef;
+ const fn2 = ok2 ? signatures[2].implementation : undef;
const fn3 = ok3 ? signatures[3].implementation : undef;
const fn4 = ok4 ? signatures[4].implementation : undef;
const fn5 = ok5 ? signatures[5].implementation : undef;
const len0 = ok0 ? signatures[0].params.length : -1;
const len1 = ok1 ? signatures[1].params.length : -1;
- const len2 = ok22 ? signatures[2].params.length : -1;
+ const len2 = ok2 ? signatures[2].params.length : -1;
const len3 = ok3 ? signatures[3].params.length : -1;
const len4 = ok4 ? signatures[4].params.length : -1;
const len5 = ok5 ? signatures[5].params.length : -1;
@@ -18207,29 +18207,29 @@ var require_typed_function = __commonJS({
}
function getObjectName(obj) {
let name317;
- for (const key3 in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key3) && (isTypedFunction(obj[key3]) || typeof obj[key3].signature === "string")) {
- name317 = checkName(name317, obj[key3].name);
+ for (const key2 in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key2) && (isTypedFunction(obj[key2]) || typeof obj[key2].signature === "string")) {
+ name317 = checkName(name317, obj[key2].name);
}
}
return name317;
}
function mergeSignatures(dest, source) {
- let key3;
- for (key3 in source) {
- if (Object.prototype.hasOwnProperty.call(source, key3)) {
- if (key3 in dest) {
- if (source[key3] !== dest[key3]) {
- const err = new Error('Signature "' + key3 + '" is defined twice');
+ let key2;
+ for (key2 in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key2)) {
+ if (key2 in dest) {
+ if (source[key2] !== dest[key2]) {
+ const err = new Error('Signature "' + key2 + '" is defined twice');
err.data = {
- signature: key3,
- sourceFunction: source[key3],
- destFunction: dest[key3]
+ signature: key2,
+ sourceFunction: source[key2],
+ destFunction: dest[key2]
};
throw err;
}
}
- dest[key3] = source[key3];
+ dest[key2] = source[key2];
}
}
}
@@ -18250,7 +18250,7 @@ var require_typed_function = __commonJS({
} else if (isTypedFunction(item)) {
theseSignatures = item.signatures;
}
- } else if (isPlainObject3(item)) {
+ } else if (isPlainObject2(item)) {
theseSignatures = item;
if (!named) {
thisName = getObjectName(item);
@@ -18271,7 +18271,7 @@ var require_typed_function = __commonJS({
}
return createTypedFunction(name317 || "", allSignatures);
};
- typed3.create = create3;
+ typed3.create = create2;
typed3.createCount = saveTyped.createCount;
typed3.onMismatch = _onMismatch;
typed3.throwMismatchError = _onMismatch;
@@ -18282,9 +18282,9 @@ var require_typed_function = __commonJS({
typed3._findType = findType;
typed3.referTo = referTo;
typed3.referToSelf = referToSelf;
- typed3.convert = convert2;
+ typed3.convert = convert;
typed3.findSignature = findSignature;
- typed3.find = find3;
+ typed3.find = find2;
typed3.isTypedFunction = isTypedFunction;
typed3.warnAgainstDeprecatedThis = true;
typed3.addType = function(type, beforeObjectTest) {
@@ -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 index3 = to2.conversionsTo.indexOf(existingConversion);
- to2.conversionsTo.splice(index3, 1);
+ const index2 = to2.conversionsTo.indexOf(existingConversion);
+ to2.conversionsTo.splice(index2, 1);
};
typed3.resolve = function(tf, argList) {
if (!isTypedFunction(tf)) {
@@ -18347,7 +18347,7 @@ var require_typed_function = __commonJS({
};
return typed3;
}
- var typedFunction3 = create3();
+ var typedFunction3 = create2();
return typedFunction3;
});
}
@@ -18356,7 +18356,7 @@ var require_typed_function = __commonJS({
// node_modules/complex.js/complex.js
var require_complex = __commonJS({
"node_modules/complex.js/complex.js"(exports, module2) {
- (function(root4) {
+ (function(root) {
"use strict";
var cosh4 = Math.cosh || function(x2) {
return Math.abs(x2) < 1e-9 ? 1 - x2 : (Math.exp(x2) + Math.exp(-x2)) * 0.5;
@@ -18405,7 +18405,7 @@ var require_complex = __commonJS({
b2 = b2 / 2;
return 0.5 * Math.log(a4 * a4 + b2 * b2) + Math.LN2;
}
- var parse8 = function(a4, b2) {
+ var parse7 = function(a4, b2) {
var z2 = { "re": 0, "im": 0 };
if (a4 === void 0 || a4 === null) {
z2["re"] = z2["im"] = 0;
@@ -18495,7 +18495,7 @@ var require_complex = __commonJS({
if (!(this instanceof Complex3)) {
return new Complex3(a4, b2);
}
- var z2 = parse8(a4, b2);
+ var z2 = parse7(a4, b2);
this["re"] = z2["re"];
this["im"] = z2["im"];
}
@@ -19086,7 +19086,7 @@ var require_complex = __commonJS({
Complex3["Complex"] = Complex3;
module2["exports"] = Complex3;
} else {
- root4["Complex"] = Complex3;
+ root["Complex"] = Complex3;
}
})(exports);
}
@@ -19095,7 +19095,7 @@ var require_complex = __commonJS({
// node_modules/fraction.js/fraction.js
var require_fraction = __commonJS({
"node_modules/fraction.js/fraction.js"(exports, module2) {
- (function(root4) {
+ (function(root) {
"use strict";
var MAX_CYCLE_LEN = 2e3;
var P3 = {
@@ -19141,7 +19141,7 @@ var require_fraction = __commonJS({
}
return factors;
}
- var parse8 = function(p1, p2) {
+ var parse7 = function(p1, p2) {
var n3 = 0, d4 = 1, s4 = 1;
var v2 = 0, w2 = 0, x2 = 0, y3 = 1, z2 = 1;
var A = 0, B2 = 1;
@@ -19328,7 +19328,7 @@ var require_fraction = __commonJS({
}
;
function Fraction3(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
if (this instanceof Fraction3) {
a4 = gcd2(P3["d"], P3["n"]);
this["s"] = P3["s"];
@@ -19358,28 +19358,28 @@ var require_fraction = __commonJS({
return newFraction(-this["s"] * this["n"], this["d"]);
},
"add": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return newFraction(
this["s"] * this["n"] * P3["d"] + P3["s"] * this["d"] * P3["n"],
this["d"] * P3["d"]
);
},
"sub": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return newFraction(
this["s"] * this["n"] * P3["d"] - P3["s"] * this["d"] * P3["n"],
this["d"] * P3["d"]
);
},
"mul": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return newFraction(
this["s"] * P3["s"] * this["n"] * P3["n"],
this["d"] * P3["d"]
);
},
"div": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return newFraction(
this["s"] * P3["s"] * this["n"] * P3["d"],
this["d"] * P3["n"]
@@ -19395,7 +19395,7 @@ var require_fraction = __commonJS({
if (a4 === void 0) {
return newFraction(this["s"] * this["n"] % this["d"], 1);
}
- parse8(a4, b2);
+ parse7(a4, b2);
if (0 === P3["n"] && 0 === this["d"]) {
throw DivisionByZero();
}
@@ -19405,11 +19405,11 @@ var require_fraction = __commonJS({
);
},
"gcd": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return newFraction(gcd2(P3["n"], this["n"]) * gcd2(P3["d"], this["d"]), P3["d"] * this["d"]);
},
"lcm": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
if (P3["n"] === 0 && this["n"] === 0) {
return newFraction(0, 1);
}
@@ -19440,7 +19440,7 @@ var require_fraction = __commonJS({
return newFraction(this["s"] * this["d"], this["n"]);
},
"pow": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
if (P3["d"] === 1) {
if (P3["s"] < 0) {
return newFraction(Math.pow(this["s"] * this["d"], P3["n"]), Math.pow(this["n"], P3["n"]));
@@ -19484,11 +19484,11 @@ var require_fraction = __commonJS({
return newFraction(n3, d4);
},
"equals": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return this["s"] * this["n"] * P3["d"] === P3["s"] * P3["n"] * this["d"];
},
"compare": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
var t5 = this["s"] * this["n"] * P3["d"] - P3["s"] * P3["n"] * this["d"];
return (0 < t5) - (t5 < 0);
},
@@ -19511,7 +19511,7 @@ var require_fraction = __commonJS({
return this;
},
"divisible": function(a4, b2) {
- parse8(a4, b2);
+ parse7(a4, b2);
return !(!(P3["n"] * this["d"]) || this["n"] * P3["d"] % (P3["n"] * this["d"]));
},
"valueOf": function() {
@@ -19620,7 +19620,7 @@ var require_fraction = __commonJS({
Fraction3["Fraction"] = Fraction3;
module2["exports"] = Fraction3;
} else {
- root4["Fraction"] = Fraction3;
+ root["Fraction"] = Fraction3;
}
})(exports);
}
@@ -19669,9 +19669,9 @@ var require_dist = __commonJS({
var _extends2 = Object.assign || function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
- for (var key3 in source) {
- if (Object.prototype.hasOwnProperty.call(source, key3)) {
- target[key3] = source[key3];
+ for (var key2 in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key2)) {
+ target[key2] = source[key2];
}
}
}
@@ -19708,13 +19708,13 @@ var require_dist = __commonJS({
var escapeKeys = Object.keys(escapes);
var _loop = function _loop2() {
var specialCharFound = false;
- escapeKeys.forEach(function(key3, index3) {
+ escapeKeys.forEach(function(key2, index2) {
if (specialCharFound) {
return;
}
- if (runningStr.length >= key3.length && runningStr.slice(0, key3.length) === key3) {
- result += escapes[escapeKeys[index3]];
- runningStr = runningStr.slice(key3.length, runningStr.length);
+ if (runningStr.length >= key2.length && runningStr.slice(0, key2.length) === key2) {
+ result += escapes[escapeKeys[index2]];
+ runningStr = runningStr.slice(key2.length, runningStr.length);
specialCharFound = true;
}
});
@@ -19788,10 +19788,10 @@ var require_alea = __commonJS({
}
function Mash() {
var n3 = 4022871197;
- var mash = function(data3) {
- data3 = String(data3);
- for (var i4 = 0; i4 < data3.length; i4++) {
- n3 += data3.charCodeAt(i4);
+ var mash = function(data2) {
+ data2 = String(data2);
+ for (var i4 = 0; i4 < data2.length; i4++) {
+ n3 += data2.charCodeAt(i4);
var h3 = 0.02519603282416938 * n3;
n3 = h3 >>> 0;
h3 -= n3;
@@ -20261,13 +20261,13 @@ var require_seedrandom = __commonJS({
(function(global2, pool, math2) {
var width = 256, chunks = 6, digits2 = 52, rngname = "random", startdenom = math2.pow(width, chunks), significance = math2.pow(2, digits2), overflow = significance * 2, mask = width - 1, nodecrypto;
function seedrandom2(seed, options, callback) {
- var key3 = [];
+ var key2 = [];
options = options == true ? { entropy: true } : options || {};
var shortseed = mixkey(flatten4(
options.entropy ? [seed, tostring(pool)] : seed == null ? autoseed() : seed,
3
- ), key3);
- var arc4 = new ARC4(key3);
+ ), key2);
+ var arc4 = new ARC4(key2);
var prng = function() {
var n3 = arc4.g(chunks), d4 = startdenom, x2 = 0;
while (n3 < significance) {
@@ -20311,16 +20311,16 @@ var require_seedrandom = __commonJS({
options.state
);
}
- function ARC4(key3) {
- var t5, keylen = key3.length, me = this, i4 = 0, j = me.i = me.j = 0, s4 = me.S = [];
+ function ARC4(key2) {
+ var t5, keylen = key2.length, me = this, i4 = 0, j = me.i = me.j = 0, s4 = me.S = [];
if (!keylen) {
- key3 = [keylen++];
+ key2 = [keylen++];
}
while (i4 < width) {
s4[i4] = i4++;
}
for (i4 = 0; i4 < width; i4++) {
- s4[i4] = s4[j = mask & j + key3[i4 % keylen] + (t5 = s4[i4])];
+ s4[i4] = s4[j = mask & j + key2[i4 % keylen] + (t5 = s4[i4])];
s4[j] = t5;
}
(me.g = function(count3) {
@@ -20353,12 +20353,12 @@ var require_seedrandom = __commonJS({
}
return result.length ? result : typ == "string" ? obj : obj + "\0";
}
- function mixkey(seed, key3) {
+ function mixkey(seed, key2) {
var stringseed = seed + "", smear, j = 0;
while (j < stringseed.length) {
- key3[mask & j] = mask & (smear ^= key3[mask & j] * 19) + stringseed.charCodeAt(j++);
+ key2[mask & j] = mask & (smear ^= key2[mask & j] * 19) + stringseed.charCodeAt(j++);
}
- return tostring(key3);
+ return tostring(key2);
}
function autoseed() {
try {
@@ -20445,12 +20445,12 @@ var require_tiny_emitter = __commonJS({
return this.on(name317, listener, ctx);
},
emit: function(name317) {
- var data3 = [].slice.call(arguments, 1);
+ var data2 = [].slice.call(arguments, 1);
var evtArr = ((this.e || (this.e = {}))[name317] || []).slice();
var i4 = 0;
var len = evtArr.length;
for (i4; i4 < len; i4++) {
- evtArr[i4].fn.apply(evtArr[i4].ctx, data3);
+ evtArr[i4].fn.apply(evtArr[i4].ctx, data2);
}
return this;
},
@@ -20482,14 +20482,14 @@ var require_react_jsx_runtime_production_min = __commonJS({
var l2 = Symbol.for("react.fragment");
var m4 = Object.prototype.hasOwnProperty;
var n3 = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
- var p2 = { key: true, ref: true, __self: true, __source: true };
+ var p = { key: true, ref: true, __self: true, __source: true };
function q2(c3, a4, g) {
var b2, d4 = {}, e5 = null, h3 = null;
void 0 !== g && (e5 = "" + g);
void 0 !== a4.key && (e5 = "" + a4.key);
void 0 !== a4.ref && (h3 = a4.ref);
for (b2 in a4)
- m4.call(a4, b2) && !p2.hasOwnProperty(b2) && (d4[b2] = a4[b2]);
+ m4.call(a4, b2) && !p.hasOwnProperty(b2) && (d4[b2] = a4[b2]);
if (c3 && c3.defaultProps)
for (b2 in a4 = c3.defaultProps, a4)
void 0 === d4[b2] && (d4[b2] = a4[b2]);
@@ -20543,9 +20543,9 @@ var require_classnames = __commonJS({
return arg2.toString();
}
var classes2 = "";
- for (var key3 in arg2) {
- if (hasOwn3.call(arg2, key3) && arg2[key3]) {
- classes2 = appendClass(classes2, key3);
+ for (var key2 in arg2) {
+ if (hasOwn3.call(arg2, key2) && arg2[key2]) {
+ classes2 = appendClass(classes2, key2);
}
}
return classes2;
@@ -20573,247 +20573,6 @@ var require_classnames = __commonJS({
}
});
-// node_modules/react-style-object-to-css/lib/CSSProperty.js
-var require_CSSProperty = __commonJS({
- "node_modules/react-style-object-to-css/lib/CSSProperty.js"(exports, module2) {
- "use strict";
- var isUnitlessNumber = {
- boxFlex: true,
- boxFlexGroup: true,
- columnCount: true,
- flex: true,
- flexGrow: true,
- flexPositive: true,
- flexShrink: true,
- flexNegative: true,
- fontWeight: true,
- lineClamp: true,
- lineHeight: true,
- opacity: true,
- order: true,
- orphans: true,
- widows: true,
- zIndex: true,
- zoom: true,
- fillOpacity: true,
- strokeDashoffset: true,
- strokeOpacity: true,
- strokeWidth: true
- };
- function prefixKey(prefix, key3) {
- return prefix + key3.charAt(0).toUpperCase() + key3.substring(1);
- }
- var prefixes = ["Webkit", "ms", "Moz", "O"];
- Object.keys(isUnitlessNumber).forEach(function(prop2) {
- prefixes.forEach(function(prefix) {
- isUnitlessNumber[prefixKey(prefix, prop2)] = isUnitlessNumber[prop2];
- });
- });
- var shorthandPropertyExpansions = {
- background: {
- backgroundImage: true,
- backgroundPosition: true,
- backgroundRepeat: true,
- backgroundColor: true
- },
- border: {
- borderWidth: true,
- borderStyle: true,
- borderColor: true
- },
- borderBottom: {
- borderBottomWidth: true,
- borderBottomStyle: true,
- borderBottomColor: true
- },
- borderLeft: {
- borderLeftWidth: true,
- borderLeftStyle: true,
- borderLeftColor: true
- },
- borderRight: {
- borderRightWidth: true,
- borderRightStyle: true,
- borderRightColor: true
- },
- borderTop: {
- borderTopWidth: true,
- borderTopStyle: true,
- borderTopColor: true
- },
- font: {
- fontStyle: true,
- fontVariant: true,
- fontWeight: true,
- fontSize: true,
- lineHeight: true,
- fontFamily: true
- }
- };
- var CSSProperty = {
- isUnitlessNumber,
- shorthandPropertyExpansions
- };
- module2.exports = CSSProperty;
- }
-});
-
-// node_modules/react-style-object-to-css/lib/hyphenateStyleName.js
-var require_hyphenateStyleName = __commonJS({
- "node_modules/react-style-object-to-css/lib/hyphenateStyleName.js"(exports, module2) {
- "use strict";
- var msPattern = /^ms-/;
- var _uppercasePattern = /([A-Z])/g;
- function hyphenate(string6) {
- return string6.replace(_uppercasePattern, "-$1").toLowerCase();
- }
- function hyphenateStyleName(string6) {
- return hyphenate(string6).replace(msPattern, "-ms-");
- }
- module2.exports = hyphenateStyleName;
- }
-});
-
-// node_modules/react-style-object-to-css/index.js
-var require_react_style_object_to_css = __commonJS({
- "node_modules/react-style-object-to-css/index.js"(exports, module2) {
- "use strict";
- var isUnitlessNumber = require_CSSProperty().isUnitlessNumber;
- var hyphenateStyleName = require_hyphenateStyleName();
- var isArray5 = Array.isArray;
- var keys2 = Object.keys;
- var unquotedContentValueRegex = /^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/;
- function buildRule(key3, value) {
- if (!isUnitlessNumber[key3] && typeof value === "number") {
- value = "" + value + "px";
- } else if (key3 === "content" && !unquotedContentValueRegex.test(value)) {
- value = "'" + value.replace(/'/g, "\\'") + "'";
- }
- return hyphenateStyleName(key3) + ": " + value + "; ";
- }
- function styleToCssString(rules) {
- var result = "";
- if (!rules || keys2(rules).length === 0) {
- return result;
- }
- var styleKeys = keys2(rules);
- for (var j = 0, l2 = styleKeys.length; j < l2; j++) {
- var styleKey = styleKeys[j];
- var value = rules[styleKey];
- if (isArray5(value)) {
- for (var i4 = 0, len = value.length; i4 < len; i4++) {
- result += buildRule(styleKey, value[i4]);
- }
- } else {
- result += buildRule(styleKey, value);
- }
- }
- return result;
- }
- module2.exports = styleToCssString;
- }
-});
-
-// node_modules/is-buffer/index.js
-var require_is_buffer = __commonJS({
- "node_modules/is-buffer/index.js"(exports, module2) {
- module2.exports = function isBuffer2(obj) {
- return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
- };
- }
-});
-
-// node_modules/extend/index.js
-var require_extend = __commonJS({
- "node_modules/extend/index.js"(exports, module2) {
- "use strict";
- var hasOwn3 = Object.prototype.hasOwnProperty;
- var toStr = Object.prototype.toString;
- var defineProperty = Object.defineProperty;
- var gOPD = Object.getOwnPropertyDescriptor;
- var isArray5 = function isArray6(arr) {
- if (typeof Array.isArray === "function") {
- return Array.isArray(arr);
- }
- return toStr.call(arr) === "[object Array]";
- };
- var isPlainObject3 = function isPlainObject4(obj) {
- if (!obj || toStr.call(obj) !== "[object Object]") {
- return false;
- }
- var hasOwnConstructor = hasOwn3.call(obj, "constructor");
- var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn3.call(obj.constructor.prototype, "isPrototypeOf");
- if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
- return false;
- }
- var key3;
- for (key3 in obj) {
- }
- return typeof key3 === "undefined" || hasOwn3.call(obj, key3);
- };
- var setProperty = function setProperty2(target, options) {
- if (defineProperty && options.name === "__proto__") {
- defineProperty(target, options.name, {
- enumerable: true,
- configurable: true,
- value: options.newValue,
- writable: true
- });
- } else {
- target[options.name] = options.newValue;
- }
- };
- var getProperty = function getProperty2(obj, name317) {
- if (name317 === "__proto__") {
- if (!hasOwn3.call(obj, name317)) {
- return void 0;
- } else if (gOPD) {
- return gOPD(obj, name317).value;
- }
- }
- return obj[name317];
- };
- module2.exports = function extend4() {
- var options, name317, src, copy, copyIsArray, clone5;
- var target = arguments[0];
- var i4 = 1;
- var length = arguments.length;
- var deep = false;
- if (typeof target === "boolean") {
- deep = target;
- target = arguments[1] || {};
- i4 = 2;
- }
- if (target == null || typeof target !== "object" && typeof target !== "function") {
- target = {};
- }
- for (; i4 < length; ++i4) {
- options = arguments[i4];
- if (options != null) {
- for (name317 in options) {
- src = getProperty(target, name317);
- copy = getProperty(options, name317);
- if (target !== copy) {
- if (deep && copy && (isPlainObject3(copy) || (copyIsArray = isArray5(copy)))) {
- if (copyIsArray) {
- copyIsArray = false;
- clone5 = src && isArray5(src) ? src : [];
- } else {
- clone5 = src && isPlainObject3(src) ? src : {};
- }
- setProperty(target, { name: name317, newValue: extend4(deep, clone5, copy) });
- } else if (typeof copy !== "undefined") {
- setProperty(target, { name: name317, newValue: copy });
- }
- }
- }
- }
- }
- return target;
- };
- }
-});
-
// node_modules/react-error-boundary/dist/react-error-boundary.cjs.js
var require_react_error_boundary_cjs = __commonJS({
"node_modules/react-error-boundary/dist/react-error-boundary.cjs.js"(exports) {
@@ -20914,7 +20673,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, index3) => !Object.is(item, b2[index3]));
+ return a4.length !== b2.length || a4.some((item, index2) => !Object.is(item, b2[index2]));
}
function assertErrorBoundaryContext(value) {
if (value == null || typeof value.didCatch !== "boolean" || typeof value.resetErrorBoundary !== "function") {
@@ -21068,6 +20827,147 @@ var require_es = __commonJS({
}
});
+// node_modules/react-style-object-to-css/lib/CSSProperty.js
+var require_CSSProperty = __commonJS({
+ "node_modules/react-style-object-to-css/lib/CSSProperty.js"(exports, module2) {
+ "use strict";
+ var isUnitlessNumber = {
+ boxFlex: true,
+ boxFlexGroup: true,
+ columnCount: true,
+ flex: true,
+ flexGrow: true,
+ flexPositive: true,
+ flexShrink: true,
+ flexNegative: true,
+ fontWeight: true,
+ lineClamp: true,
+ lineHeight: true,
+ opacity: true,
+ order: true,
+ orphans: true,
+ widows: true,
+ zIndex: true,
+ zoom: true,
+ fillOpacity: true,
+ strokeDashoffset: true,
+ strokeOpacity: true,
+ strokeWidth: true
+ };
+ function prefixKey(prefix, key2) {
+ return prefix + key2.charAt(0).toUpperCase() + key2.substring(1);
+ }
+ var prefixes = ["Webkit", "ms", "Moz", "O"];
+ Object.keys(isUnitlessNumber).forEach(function(prop2) {
+ prefixes.forEach(function(prefix) {
+ isUnitlessNumber[prefixKey(prefix, prop2)] = isUnitlessNumber[prop2];
+ });
+ });
+ var shorthandPropertyExpansions = {
+ background: {
+ backgroundImage: true,
+ backgroundPosition: true,
+ backgroundRepeat: true,
+ backgroundColor: true
+ },
+ border: {
+ borderWidth: true,
+ borderStyle: true,
+ borderColor: true
+ },
+ borderBottom: {
+ borderBottomWidth: true,
+ borderBottomStyle: true,
+ borderBottomColor: true
+ },
+ borderLeft: {
+ borderLeftWidth: true,
+ borderLeftStyle: true,
+ borderLeftColor: true
+ },
+ borderRight: {
+ borderRightWidth: true,
+ borderRightStyle: true,
+ borderRightColor: true
+ },
+ borderTop: {
+ borderTopWidth: true,
+ borderTopStyle: true,
+ borderTopColor: true
+ },
+ font: {
+ fontStyle: true,
+ fontVariant: true,
+ fontWeight: true,
+ fontSize: true,
+ lineHeight: true,
+ fontFamily: true
+ }
+ };
+ var CSSProperty = {
+ isUnitlessNumber,
+ shorthandPropertyExpansions
+ };
+ module2.exports = CSSProperty;
+ }
+});
+
+// node_modules/react-style-object-to-css/lib/hyphenateStyleName.js
+var require_hyphenateStyleName = __commonJS({
+ "node_modules/react-style-object-to-css/lib/hyphenateStyleName.js"(exports, module2) {
+ "use strict";
+ var msPattern = /^ms-/;
+ var _uppercasePattern = /([A-Z])/g;
+ function hyphenate(string4) {
+ return string4.replace(_uppercasePattern, "-$1").toLowerCase();
+ }
+ function hyphenateStyleName(string4) {
+ return hyphenate(string4).replace(msPattern, "-ms-");
+ }
+ module2.exports = hyphenateStyleName;
+ }
+});
+
+// node_modules/react-style-object-to-css/index.js
+var require_react_style_object_to_css = __commonJS({
+ "node_modules/react-style-object-to-css/index.js"(exports, module2) {
+ "use strict";
+ var isUnitlessNumber = require_CSSProperty().isUnitlessNumber;
+ var hyphenateStyleName = require_hyphenateStyleName();
+ var isArray5 = Array.isArray;
+ var keys = Object.keys;
+ var unquotedContentValueRegex = /^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/;
+ function buildRule(key2, value) {
+ if (!isUnitlessNumber[key2] && typeof value === "number") {
+ value = "" + value + "px";
+ } else if (key2 === "content" && !unquotedContentValueRegex.test(value)) {
+ value = "'" + value.replace(/'/g, "\\'") + "'";
+ }
+ return hyphenateStyleName(key2) + ": " + value + "; ";
+ }
+ function styleToCssString(rules) {
+ var result = "";
+ if (!rules || keys(rules).length === 0) {
+ return result;
+ }
+ var styleKeys = keys(rules);
+ for (var j = 0, l2 = styleKeys.length; j < l2; j++) {
+ var styleKey = styleKeys[j];
+ var value = rules[styleKey];
+ if (isArray5(value)) {
+ for (var i4 = 0, len = value.length; i4 < len; i4++) {
+ result += buildRule(styleKey, value[i4]);
+ }
+ } else {
+ result += buildRule(styleKey, value);
+ }
+ }
+ return result;
+ }
+ module2.exports = styleToCssString;
+ }
+});
+
// node_modules/jszip/dist/jszip.min.js
var require_jszip_min = __commonJS({
"node_modules/jszip/dist/jszip.min.js"(exports, module2) {
@@ -21105,20 +21005,20 @@ var require_jszip_min = __commonJS({
return u3;
}({ 1: [function(e5, t5, r2) {
"use strict";
- var d4 = e5("./utils"), c3 = e5("./support"), p2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ var d4 = e5("./utils"), c3 = e5("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
r2.encode = function(e6) {
for (var t6, r3, n3, i4, s4, a4, o2, h3 = [], u3 = 0, l2 = e6.length, f2 = l2, c4 = "string" !== d4.getTypeOf(e6); u3 < e6.length; )
- f2 = l2 - u3, n3 = c4 ? (t6 = e6[u3++], r3 = u3 < l2 ? e6[u3++] : 0, u3 < l2 ? e6[u3++] : 0) : (t6 = e6.charCodeAt(u3++), r3 = u3 < l2 ? e6.charCodeAt(u3++) : 0, u3 < l2 ? e6.charCodeAt(u3++) : 0), i4 = t6 >> 2, s4 = (3 & t6) << 4 | r3 >> 4, a4 = 1 < f2 ? (15 & r3) << 2 | n3 >> 6 : 64, o2 = 2 < f2 ? 63 & n3 : 64, h3.push(p2.charAt(i4) + p2.charAt(s4) + p2.charAt(a4) + p2.charAt(o2));
+ f2 = l2 - u3, n3 = c4 ? (t6 = e6[u3++], r3 = u3 < l2 ? e6[u3++] : 0, u3 < l2 ? e6[u3++] : 0) : (t6 = e6.charCodeAt(u3++), r3 = u3 < l2 ? e6.charCodeAt(u3++) : 0, u3 < l2 ? e6.charCodeAt(u3++) : 0), i4 = t6 >> 2, s4 = (3 & t6) << 4 | r3 >> 4, a4 = 1 < f2 ? (15 & r3) << 2 | n3 >> 6 : 64, o2 = 2 < f2 ? 63 & n3 : 64, h3.push(p.charAt(i4) + p.charAt(s4) + p.charAt(a4) + p.charAt(o2));
return h3.join("");
}, r2.decode = function(e6) {
var t6, r3, n3, i4, s4, a4, o2 = 0, h3 = 0, u3 = "data:";
if (e6.substr(0, u3.length) === u3)
throw new Error("Invalid base64 input, it looks like a data url.");
var l2, f2 = 3 * (e6 = e6.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
- if (e6.charAt(e6.length - 1) === p2.charAt(64) && f2--, e6.charAt(e6.length - 2) === p2.charAt(64) && f2--, f2 % 1 != 0)
+ if (e6.charAt(e6.length - 1) === p.charAt(64) && f2--, e6.charAt(e6.length - 2) === p.charAt(64) && f2--, f2 % 1 != 0)
throw new Error("Invalid base64 input, bad content length.");
for (l2 = c3.uint8array ? new Uint8Array(0 | f2) : new Array(0 | f2); o2 < e6.length; )
- t6 = p2.indexOf(e6.charAt(o2++)) << 2 | (i4 = p2.indexOf(e6.charAt(o2++))) >> 4, r3 = (15 & i4) << 4 | (s4 = p2.indexOf(e6.charAt(o2++))) >> 2, n3 = (3 & s4) << 6 | (a4 = p2.indexOf(e6.charAt(o2++))), l2[h3++] = t6, 64 !== s4 && (l2[h3++] = r3), 64 !== a4 && (l2[h3++] = n3);
+ t6 = p.indexOf(e6.charAt(o2++)) << 2 | (i4 = p.indexOf(e6.charAt(o2++))) >> 4, r3 = (15 & i4) << 4 | (s4 = p.indexOf(e6.charAt(o2++))) >> 2, n3 = (3 & s4) << 6 | (a4 = p.indexOf(e6.charAt(o2++))), l2[h3++] = t6, 64 !== s4 && (l2[h3++] = r3), 64 !== a4 && (l2[h3++] = n3);
return l2;
};
}, { "./support": 30, "./utils": 32 }], 2: [function(e5, t5, r2) {
@@ -21212,7 +21112,7 @@ var require_jszip_min = __commonJS({
return n4;
}
function n3(e6, t6, 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, p2 = 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)), _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 };
t6 && !r3 || (x2.crc32 = e6.crc32, x2.compressedSize = e6.compressedSize, x2.uncompressedSize = e6.uncompressedSize);
var S3 = 0;
t6 && (S3 |= 8), l2 || !_15 && !g || (S3 |= 2048);
@@ -21222,9 +21122,9 @@ var require_jszip_min = __commonJS({
return e7 || (r4 = t7 ? 16893 : 33204), (65535 & r4) << 16;
}(h3.unixPermissions, w2)) : (C = 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(p2), 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(), _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);
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(C, 2) + E2 + A(p2.length, 2) + "\0\0\0\0" + A(z2, 4) + A(n4, 4) + f2 + b2 + p2 };
+ 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(C, 2) + E2 + A(p.length, 2) + "\0\0\0\0" + A(z2, 4) + A(n4, 4) + f2 + b2 + p };
}
var I2 = e5("../utils"), i4 = e5("../stream/GenericWorker"), O2 = e5("../utf8"), B2 = e5("../crc32"), R2 = e5("../signature");
function s4(e6, t6, r3, n4) {
@@ -21422,11 +21322,11 @@ var require_jszip_min = __commonJS({
var a5 = "string" === i5 && false === s5.binary && false === s5.base64;
r3 && void 0 !== r3.binary || (s5.binary = !a5), (t6 instanceof c3 && 0 === t6.uncompressedSize || s5.dir || !t6 || 0 === t6.length) && (s5.base64 = false, s5.binary = true, t6 = "", s5.compression = "STORE", i5 = "string");
var o3 = null;
- o3 = t6 instanceof c3 || t6 instanceof l2 ? t6 : p2.isNode && p2.isStream(t6) ? new m4(e6, t6) : u3.prepareContent(e6, t6, s5.binary, s5.optimizedBinaryString, s5.base64);
+ o3 = t6 instanceof c3 || t6 instanceof l2 ? t6 : p.isNode && p.isStream(t6) ? new m4(e6, t6) : u3.prepareContent(e6, t6, s5.binary, s5.optimizedBinaryString, s5.base64);
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"), p2 = 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"), _15 = function(e6) {
"/" === e6.slice(-1) && (e6 = e6.substring(0, e6.length - 1));
var t6 = e6.lastIndexOf("/");
return 0 < t6 ? e6.substring(0, t6) : "";
@@ -22313,12 +22213,12 @@ var require_jszip_min = __commonJS({
function i5(e7) {
r3 || (r3 = true, l2.resolve(t6, e7));
}
- var s5 = p2(function() {
+ var s5 = p(function() {
e6(i5, n4);
});
"error" === s5.status && n4(s5.value);
}
- function p2(e6, t6) {
+ function p(e6, t6) {
var r3 = {};
try {
r3.value = e6(t6), r3.status = "success";
@@ -22357,7 +22257,7 @@ var require_jszip_min = __commonJS({
}, h3.prototype.otherCallRejected = function(e6) {
f2(this.promise, this.onRejected, e6);
}, l2.resolve = function(e6, t6) {
- var r3 = p2(c3, t6);
+ var r3 = p(c3, t6);
if ("error" === r3.status)
return l2.reject(e6, r3.value);
var n4 = r3.value;
@@ -22423,9 +22323,9 @@ var require_jszip_min = __commonJS({
}, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e5, t5, r2) {
"use strict";
var a4 = e5("./zlib/deflate"), o2 = e5("./utils/common"), h3 = e5("./utils/strings"), i4 = e5("./zlib/messages"), s4 = e5("./zlib/zstream"), u3 = Object.prototype.toString, l2 = 0, f2 = -1, c3 = 0, d4 = 8;
- function p2(e6) {
- if (!(this instanceof p2))
- return new p2(e6);
+ function p(e6) {
+ if (!(this instanceof p))
+ return new p(e6);
this.options = o2.assign({ level: f2, method: d4, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c3, to: "" }, e6 || {});
var t6 = this.options;
t6.raw && 0 < t6.windowBits ? t6.windowBits = -t6.windowBits : t6.gzip && 0 < t6.windowBits && t6.windowBits < 16 && (t6.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s4(), this.strm.avail_out = 0;
@@ -22440,12 +22340,12 @@ var require_jszip_min = __commonJS({
}
}
function n3(e6, t6) {
- var r3 = new p2(t6);
+ var r3 = new p(t6);
if (r3.push(e6, true), r3.err)
throw r3.msg || i4[r3.err];
return r3.result;
}
- p2.prototype.push = function(e6, t6) {
+ p.prototype.push = function(e6, t6) {
var r3, n4, i5 = this.strm, s5 = this.options.chunkSize;
if (this.ended)
return false;
@@ -22456,18 +22356,18 @@ var require_jszip_min = __commonJS({
0 !== i5.avail_out && (0 !== i5.avail_in || 4 !== n4 && 2 !== n4) || ("string" === this.options.to ? this.onData(h3.buf2binstring(o2.shrinkBuf(i5.output, i5.next_out))) : this.onData(o2.shrinkBuf(i5.output, i5.next_out)));
} while ((0 < i5.avail_in || 0 === i5.avail_out) && 1 !== r3);
return 4 === n4 ? (r3 = a4.deflateEnd(this.strm), this.onEnd(r3), this.ended = true, r3 === l2) : 2 !== n4 || (this.onEnd(l2), !(i5.avail_out = 0));
- }, p2.prototype.onData = function(e6) {
+ }, p.prototype.onData = function(e6) {
this.chunks.push(e6);
- }, p2.prototype.onEnd = function(e6) {
+ }, p.prototype.onEnd = function(e6) {
e6 === l2 && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o2.flattenChunks(this.chunks)), this.chunks = [], this.err = e6, this.msg = this.strm.msg;
- }, r2.Deflate = p2, r2.deflate = n3, r2.deflateRaw = function(e6, t6) {
+ }, r2.Deflate = p, r2.deflate = n3, r2.deflateRaw = function(e6, t6) {
return (t6 = t6 || {}).raw = true, n3(e6, t6);
}, r2.gzip = function(e6, t6) {
return (t6 = t6 || {}).gzip = true, n3(e6, t6);
};
}, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e5, t5, r2) {
"use strict";
- var c3 = e5("./zlib/inflate"), d4 = e5("./utils/common"), p2 = 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"), _15 = Object.prototype.toString;
function a4(e6) {
if (!(this instanceof a4))
return new a4(e6);
@@ -22489,11 +22389,11 @@ 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 = t6 === ~~t6 ? t6 : true === t6 ? m4.Z_FINISH : m4.Z_NO_FLUSH, "string" == typeof e6 ? h3.input = p2.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 = t6 === ~~t6 ? t6 : true === t6 ? 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;
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 ? p2.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]" === _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)
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 = p2.utf8border(h3.output, h3.next_out), s5 = h3.next_out - i5, a5 = p2.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);
+ 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);
return r3 === m4.Z_STREAM_END && (n4 = m4.Z_FINISH), n4 === m4.Z_FINISH ? (r3 = c3.inflateEnd(this.strm), this.onEnd(r3), this.ended = true, r3 === m4.Z_OK) : n4 !== m4.Z_SYNC_FLUSH || (this.onEnd(m4.Z_OK), !(h3.avail_out = 0));
}, a4.prototype.onData = function(e6) {
@@ -22629,7 +22529,7 @@ var require_jszip_min = __commonJS({
};
}, {}], 46: [function(e5, t5, r2) {
"use strict";
- var h3, c3 = e5("../utils/common"), u3 = e5("./trees"), d4 = e5("./adler32"), p2 = 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, C = 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, _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, C = 42, E2 = 113, A = 1, I2 = 2, O2 = 3, B2 = 4;
function R2(e6, t6) {
return e6.msg = n3[t6], t6;
}
@@ -22654,17 +22554,17 @@ var require_jszip_min = __commonJS({
e6.pending_buf[e6.pending++] = t6 >>> 8 & 255, e6.pending_buf[e6.pending++] = 255 & t6;
}
function L2(e6, t6) {
- var r3, n4, i5 = e6.max_chain_length, s5 = e6.strstart, a5 = e6.prev_length, o3 = e6.nice_match, h4 = e6.strstart > e6.w_size - z2 ? e6.strstart - (e6.w_size - z2) : 0, u4 = e6.window, l3 = e6.w_mask, f3 = e6.prev, c4 = e6.strstart + S3, d5 = u4[s5 + a5 - 1], p3 = u4[s5 + a5];
+ var r3, n4, i5 = e6.max_chain_length, s5 = e6.strstart, a5 = e6.prev_length, o3 = e6.nice_match, h4 = e6.strstart > e6.w_size - z2 ? e6.strstart - (e6.w_size - z2) : 0, u4 = e6.window, l3 = e6.w_mask, f3 = e6.prev, c4 = e6.strstart + S3, d5 = u4[s5 + a5 - 1], p2 = u4[s5 + a5];
e6.prev_length >= e6.good_match && (i5 >>= 2), o3 > e6.lookahead && (o3 = e6.lookahead);
do {
- if (u4[(r3 = t6) + a5] === p3 && u4[r3 + a5 - 1] === d5 && u4[r3] === u4[s5] && u4[++r3] === u4[s5 + 1]) {
+ if (u4[(r3 = t6) + a5] === p2 && u4[r3 + a5 - 1] === d5 && u4[r3] === u4[s5] && u4[++r3] === u4[s5 + 1]) {
s5 += 2, r3++;
do {
} while (u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && s5 < c4);
if (n4 = S3 - (c4 - s5), s5 = c4 - S3, a5 < n4) {
if (e6.match_start = t6, o3 <= (a5 = n4))
break;
- d5 = u4[s5 + a5 - 1], p3 = u4[s5 + a5];
+ d5 = u4[s5 + a5 - 1], p2 = u4[s5 + a5];
}
}
} while ((t6 = f3[t6 & l3]) > h4 && 0 != --i5);
@@ -22682,7 +22582,7 @@ var require_jszip_min = __commonJS({
}
if (0 === e6.strm.avail_in)
break;
- if (a5 = e6.strm, o3 = e6.window, h4 = e6.strstart + e6.lookahead, u4 = i5, l3 = void 0, l3 = a5.avail_in, u4 < l3 && (l3 = u4), r3 = 0 === l3 ? 0 : (a5.avail_in -= l3, c3.arraySet(o3, a5.input, a5.next_in, l3, h4), 1 === a5.state.wrap ? a5.adler = d4(a5.adler, o3, l3, h4) : 2 === a5.state.wrap && (a5.adler = p2(a5.adler, o3, l3, h4)), a5.next_in += l3, a5.total_in += l3, l3), e6.lookahead += r3, e6.lookahead + e6.insert >= x2)
+ if (a5 = e6.strm, o3 = e6.window, h4 = e6.strstart + e6.lookahead, u4 = i5, l3 = void 0, l3 = a5.avail_in, u4 < l3 && (l3 = u4), r3 = 0 === l3 ? 0 : (a5.avail_in -= l3, c3.arraySet(o3, a5.input, a5.next_in, l3, h4), 1 === a5.state.wrap ? a5.adler = d4(a5.adler, o3, l3, h4) : 2 === a5.state.wrap && (a5.adler = p(a5.adler, o3, l3, h4)), a5.next_in += l3, a5.total_in += l3, l3), e6.lookahead += r3, e6.lookahead + e6.insert >= x2)
for (s5 = e6.strstart - e6.insert, e6.ins_h = e6.window[s5], e6.ins_h = (e6.ins_h << e6.hash_shift ^ e6.window[s5 + 1]) & e6.hash_mask; e6.insert && (e6.ins_h = (e6.ins_h << e6.hash_shift ^ e6.window[s5 + x2 - 1]) & e6.hash_mask, e6.prev[s5 & e6.w_mask] = e6.head[e6.ins_h], e6.head[e6.ins_h] = s5, s5++, e6.insert--, !(e6.lookahead + e6.insert < x2)); )
;
} while (e6.lookahead < z2 && 0 !== e6.strm.avail_in);
@@ -22785,42 +22685,42 @@ var require_jszip_min = __commonJS({
return R2(e6, 0 === e6.avail_out ? -5 : _15);
if (n4.strm = e6, r3 = n4.last_flush, n4.last_flush = t6, n4.status === C)
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 = p2(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);
+ 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);
else {
var a5 = v2 + (n4.w_bits - 8 << 4) << 8;
a5 |= (2 <= n4.strategy || n4.level < 2 ? 0 : n4.level < 6 ? 1 : 6 === n4.level ? 2 : 3) << 6, 0 !== n4.strstart && (a5 |= 32), a5 += 31 - a5 % 31, n4.status = E2, P3(n4, a5), 0 !== n4.strstart && (P3(n4, e6.adler >>> 16), P3(n4, 65535 & e6.adler)), e6.adler = 1;
}
if (69 === n4.status)
if (n4.gzhead.extra) {
- for (i5 = n4.pending; n4.gzindex < (65535 & n4.gzhead.extra.length) && (n4.pending !== n4.pending_buf_size || (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending !== n4.pending_buf_size)); )
+ for (i5 = n4.pending; n4.gzindex < (65535 & n4.gzhead.extra.length) && (n4.pending !== n4.pending_buf_size || (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending !== n4.pending_buf_size)); )
U(n4, 255 & n4.gzhead.extra[n4.gzindex]), n4.gzindex++;
- n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), n4.gzindex === n4.gzhead.extra.length && (n4.gzindex = 0, n4.status = 73);
+ n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), n4.gzindex === n4.gzhead.extra.length && (n4.gzindex = 0, n4.status = 73);
} else
n4.status = 73;
if (73 === n4.status)
if (n4.gzhead.name) {
i5 = n4.pending;
do {
- if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) {
+ if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) {
s5 = 1;
break;
}
s5 = n4.gzindex < n4.gzhead.name.length ? 255 & n4.gzhead.name.charCodeAt(n4.gzindex++) : 0, U(n4, s5);
} while (0 !== s5);
- n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.gzindex = 0, n4.status = 91);
+ n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.gzindex = 0, n4.status = 91);
} else
n4.status = 91;
if (91 === n4.status)
if (n4.gzhead.comment) {
i5 = n4.pending;
do {
- if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) {
+ if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) {
s5 = 1;
break;
}
s5 = n4.gzindex < n4.gzhead.comment.length ? 255 & n4.gzhead.comment.charCodeAt(n4.gzindex++) : 0, U(n4, s5);
} while (0 !== s5);
- n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.status = 103);
+ n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.status = 103);
} else
n4.status = 103;
if (103 === n4.status && (n4.gzhead.hcrc ? (n4.pending + 2 > n4.pending_buf_size && F(e6), n4.pending + 2 <= n4.pending_buf_size && (U(n4, 255 & e6.adler), U(n4, e6.adler >> 8 & 255), e6.adler = 0, n4.status = E2)) : n4.status = E2), 0 !== n4.pending) {
@@ -22891,14 +22791,14 @@ var require_jszip_min = __commonJS({
}, {}], 48: [function(e5, t5, r2) {
"use strict";
t5.exports = function(e6, t6) {
- var r3, n3, i4, s4, a4, o2, h3, u3, l2, f2, c3, d4, p2, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C;
- r3 = e6.state, n3 = e6.next_in, z2 = e6.input, i4 = n3 + (e6.avail_in - 5), s4 = e6.next_out, C = e6.output, a4 = s4 - (t6 - 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, p2 = 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, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C;
+ r3 = e6.state, n3 = e6.next_in, z2 = e6.input, i4 = n3 + (e6.avail_in - 5), s4 = e6.next_out, C = e6.output, a4 = s4 - (t6 - 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;
e:
do {
- p2 < 15 && (d4 += z2[n3++] << p2, p2 += 8, d4 += z2[n3++] << p2, p2 += 8), v2 = m4[d4 & g];
+ p < 15 && (d4 += z2[n3++] << p, p += 8, d4 += z2[n3++] << p, p += 8), v2 = m4[d4 & g];
t:
for (; ; ) {
- if (d4 >>>= y3 = v2 >>> 24, p2 -= y3, 0 === (y3 = v2 >>> 16 & 255))
+ if (d4 >>>= y3 = v2 >>> 24, p -= y3, 0 === (y3 = v2 >>> 16 & 255))
C[s4++] = 65535 & v2;
else {
if (!(16 & y3)) {
@@ -22913,10 +22813,10 @@ var require_jszip_min = __commonJS({
e6.msg = "invalid literal/length code", r3.mode = 30;
break e;
}
- w2 = 65535 & v2, (y3 &= 15) && (p2 < y3 && (d4 += z2[n3++] << p2, p2 += 8), w2 += d4 & (1 << y3) - 1, d4 >>>= y3, p2 -= y3), p2 < 15 && (d4 += z2[n3++] << p2, p2 += 8, d4 += z2[n3++] << p2, p2 += 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 = _15[d4 & b2];
r:
for (; ; ) {
- if (d4 >>>= y3 = v2 >>> 24, p2 -= y3, !(16 & (y3 = v2 >>> 16 & 255))) {
+ if (d4 >>>= y3 = v2 >>> 24, p -= y3, !(16 & (y3 = v2 >>> 16 & 255))) {
if (0 == (64 & y3)) {
v2 = _15[(65535 & v2) + (d4 & (1 << y3) - 1)];
continue r;
@@ -22924,11 +22824,11 @@ var require_jszip_min = __commonJS({
e6.msg = "invalid distance code", r3.mode = 30;
break e;
}
- if (k2 = 65535 & v2, p2 < (y3 &= 15) && (d4 += z2[n3++] << p2, (p2 += 8) < y3 && (d4 += z2[n3++] << p2, p2 += 8)), h3 < (k2 += d4 & (1 << y3) - 1)) {
+ if (k2 = 65535 & v2, p < (y3 &= 15) && (d4 += z2[n3++] << p, (p += 8) < y3 && (d4 += z2[n3++] << p, p += 8)), h3 < (k2 += d4 & (1 << y3) - 1)) {
e6.msg = "invalid distance too far back", r3.mode = 30;
break e;
}
- if (d4 >>>= y3, p2 -= y3, (y3 = s4 - a4) < k2) {
+ if (d4 >>>= y3, p -= y3, (y3 = s4 - a4) < k2) {
if (l2 < (y3 = k2 - y3) && r3.sane) {
e6.msg = "invalid distance too far back", r3.mode = 30;
break e;
@@ -22968,7 +22868,7 @@ var require_jszip_min = __commonJS({
break;
}
} while (n3 < i4 && s4 < o2);
- n3 -= w2 = p2 >> 3, d4 &= (1 << (p2 -= w2 << 3)) - 1, e6.next_in = n3, e6.next_out = s4, e6.avail_in = n3 < i4 ? i4 - n3 + 5 : 5 - (n3 - i4), e6.avail_out = s4 < o2 ? o2 - s4 + 257 : 257 - (s4 - o2), r3.hold = d4, r3.bits = p2;
+ n3 -= w2 = p >> 3, d4 &= (1 << (p -= w2 << 3)) - 1, e6.next_in = n3, e6.next_out = s4, e6.avail_in = n3 < i4 ? i4 - n3 + 5 : 5 - (n3 - i4), e6.avail_out = s4 < o2 ? o2 - s4 + 257 : 257 - (s4 - o2), r3.hold = d4, r3.bits = p;
};
}, {}], 49: [function(e5, t5, r2) {
"use strict";
@@ -23020,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, t6) {
- var r3, n4, i5, s5, a5, o3, h4, u4, l3, f3, c4, d4, p2, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C = 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, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C = 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;
@@ -23373,10 +23273,10 @@ var require_jszip_min = __commonJS({
e6.msg = "invalid distance too far back", r3.mode = 30;
break;
}
- p2 = d4 > r3.wnext ? (d4 -= r3.wnext, r3.wsize - d4) : r3.wnext - d4, d4 > r3.length && (d4 = r3.length), m4 = r3.window;
+ p = d4 > r3.wnext ? (d4 -= r3.wnext, r3.wsize - d4) : r3.wnext - d4, d4 > r3.length && (d4 = r3.length), m4 = r3.window;
} else
- m4 = i5, p2 = a5 - r3.offset, d4 = r3.length;
- for (h4 < d4 && (d4 = h4), h4 -= d4, r3.length -= d4; i5[a5++] = m4[p2++], --d4; )
+ m4 = i5, p = a5 - r3.offset, d4 = r3.length;
+ for (h4 < d4 && (d4 = h4), h4 -= d4, r3.length -= d4; i5[a5++] = m4[p++], --d4; )
;
0 === r3.length && (r3.mode = 21);
break;
@@ -23442,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];
t5.exports = function(e6, t6, r3, n3, i4, s4, a4, o2) {
- var h3, u3, l2, f2, c3, d4, p2, m4, _15, g = o2.bits, b2 = 0, v2 = 0, y3 = 0, w2 = 0, k2 = 0, x2 = 0, S3 = 0, z2 = 0, C = 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, _15, g = o2.bits, b2 = 0, v2 = 0, y3 = 0, w2 = 0, k2 = 0, x2 = 0, S3 = 0, z2 = 0, C = 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++)
@@ -23465,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 = (C = 1 << (x2 = k2)) - 1, 1 === e6 && 852 < C || 2 === e6 && 592 < C)
return 1;
for (; ; ) {
- for (p2 = 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)] = p2 << 24 | m4 << 16 | _15 | 0, 0 !== u3; )
+ 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 (h3 = 1 << b2 - 1; E2 & h3; )
h3 >>= 1;
@@ -23494,7 +23394,7 @@ var require_jszip_min = __commonJS({
for (var t6 = e6.length; 0 <= --t6; )
e6[t6] = 0;
}
- var s4 = 0, a4 = 29, u3 = 256, l2 = u3 + 1 + a4, f2 = 30, c3 = 19, _15 = 2 * l2 + 1, g = 15, d4 = 16, p2 = 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, _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));
n3(z2);
var C = new Array(2 * f2);
n3(C);
@@ -23577,18 +23477,18 @@ var require_jszip_min = __commonJS({
for (i5 = h4; r3 = e6.heap[1], e6.heap[1] = e6.heap[e6.heap_len--], G2(e6, s5, 1), n4 = e6.heap[1], e6.heap[--e6.heap_max] = r3, e6.heap[--e6.heap_max] = n4, s5[2 * i5] = s5[2 * r3] + s5[2 * n4], e6.depth[i5] = (e6.depth[r3] >= e6.depth[n4] ? e6.depth[r3] : e6.depth[n4]) + 1, s5[2 * r3 + 1] = s5[2 * n4 + 1] = i5, e6.heap[1] = i5++, G2(e6, s5, 1), 2 <= e6.heap_len; )
;
e6.heap[--e6.heap_max] = e6.heap[1], function(e7, t7) {
- var r4, n5, i6, s6, a6, o4, h5 = t7.dyn_tree, u5 = t7.max_code, l3 = t7.stat_desc.static_tree, f3 = t7.stat_desc.has_stree, c4 = t7.stat_desc.extra_bits, d5 = t7.stat_desc.extra_base, p3 = t7.stat_desc.max_length, m5 = 0;
+ var r4, n5, i6, s6, a6, o4, h5 = t7.dyn_tree, u5 = t7.max_code, l3 = t7.stat_desc.static_tree, f3 = t7.stat_desc.has_stree, c4 = t7.stat_desc.extra_bits, d5 = t7.stat_desc.extra_base, p2 = t7.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++)
- p3 < (s6 = h5[2 * h5[2 * (n5 = e7.heap[r4]) + 1] + 1] + 1) && (s6 = p3, 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)));
+ 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 {
- for (s6 = p3 - 1; 0 === e7.bl_count[s6]; )
+ for (s6 = p2 - 1; 0 === e7.bl_count[s6]; )
s6--;
- e7.bl_count[s6]--, e7.bl_count[s6 + 1] += 2, e7.bl_count[p3]--, m5 -= 2;
+ e7.bl_count[s6]--, e7.bl_count[s6 + 1] += 2, e7.bl_count[p2]--, m5 -= 2;
} while (0 < m5);
- for (s6 = p3; 0 !== s6; s6--)
+ for (s6 = p2; 0 !== s6; s6--)
for (n5 = e7.bl_count[s6]; 0 !== n5; )
u5 < (i6 = e7.heap[--r4]) || (h5[2 * i6 + 1] !== s6 && (e7.opt_len += (s6 - h5[2 * i6 + 1]) * h5[2 * i6], h5[2 * i6 + 1] = s6), n5--);
}
@@ -23642,7 +23542,7 @@ var require_jszip_min = __commonJS({
z2[2 * e7 + 1] = 8, e7++, s5[8]++;
for (Z(z2, l2 + 1, s5), e7 = 0; e7 < f2; e7++)
C[2 * e7 + 1] = 5, C[2 * e7] = j(e7, 5);
- O2 = new D2(z2, w2, u3 + 1, l2, g), B2 = new D2(C, k2, 0, f2, g), R2 = new D2(new Array(0), x2, 0, c3, p2);
+ O2 = new D2(z2, w2, u3 + 1, l2, g), B2 = new D2(C, k2, 0, f2, g), R2 = new D2(new Array(0), x2, 0, c3, p);
}(), q2 = true), e6.l_desc = new F(e6.dyn_ltree, O2), e6.d_desc = new F(e6.dyn_dtree, B2), e6.bl_desc = new F(e6.bl_tree, R2), e6.bi_buf = 0, e6.bi_valid = 0, W(e6);
}, r2._tr_stored_block = J, r2._tr_flush_block = function(e6, t6, r3, n4) {
var i5, s5, a5 = 0;
@@ -23816,8 +23716,8 @@ var require_sql_wasm = __commonJS({
}
}
function b2(g, m4) {
- for (var n3 = [], p2 = 0; p2 < g; p2 += 1) {
- var v2 = l2(m4 + 4 * p2, "i32"), y3 = kc(v2);
+ for (var n3 = [], p = 0; p < g; p += 1) {
+ var v2 = l2(m4 + 4 * p, "i32"), y3 = kc(v2);
if (1 === y3 || 2 === y3)
v2 = lc(v2);
else if (3 === y3)
@@ -23854,13 +23754,13 @@ var require_sql_wasm = __commonJS({
function f2(g) {
this.filename = "dbfile_" + (4294967295 * Math.random() >>> 0);
if (null != g) {
- var m4 = this.filename, n3 = "/", p2 = m4;
- n3 && (n3 = "string" == typeof n3 ? n3 : ea(n3), p2 = m4 ? z2(n3 + "/" + m4) : n3);
+ var m4 = this.filename, n3 = "/", p = m4;
+ n3 && (n3 = "string" == typeof n3 ? n3 : ea(n3), p = m4 ? z2(n3 + "/" + m4) : n3);
m4 = fa(
true,
true
);
- p2 = ha(p2, (void 0 !== m4 ? m4 : 438) & 4095 | 32768, 0);
+ p = ha(p, (void 0 !== m4 ? m4 : 438) & 4095 | 32768, 0);
if (g) {
if ("string" == typeof g) {
n3 = Array(g.length);
@@ -23868,11 +23768,11 @@ var require_sql_wasm = __commonJS({
n3[v2] = g.charCodeAt(v2);
g = n3;
}
- ia(p2, m4 | 146);
- n3 = ja(p2, 577);
+ ia(p, m4 | 146);
+ n3 = ja(p, 577);
ka(n3, g, 0, g.length, 0);
la(n3);
- ia(p2, m4);
+ ia(p, m4);
}
}
this.handleError(q2(this.filename, h3));
@@ -23937,28 +23837,28 @@ var require_sql_wasm = __commonJS({
null == g && (g = this.Ja, this.Ja += 1);
var m4 = Bc(this.La, g);
g = Ac(this.La, g);
- for (var n3 = new Uint8Array(m4), p2 = 0; p2 < m4; p2 += 1)
- n3[p2] = r2[g + p2];
+ for (var n3 = new Uint8Array(m4), p = 0; p < m4; p += 1)
+ n3[p] = r2[g + p];
return n3;
};
c3.prototype.get = function(g, m4) {
m4 = m4 || {};
null != g && this.bind(g) && this.step();
g = [];
- for (var n3 = yc(this.La), p2 = 0; p2 < n3; p2 += 1)
- switch (Cc(this.La, p2)) {
+ for (var n3 = yc(this.La), p = 0; p < n3; p += 1)
+ switch (Cc(this.La, p)) {
case 1:
- var v2 = m4.useBigInt ? this.Cb(p2) : this.sb(p2);
+ var v2 = m4.useBigInt ? this.Cb(p) : this.sb(p);
g.push(v2);
break;
case 2:
- g.push(this.sb(p2));
+ g.push(this.sb(p));
break;
case 3:
- g.push(this.Db(p2));
+ g.push(this.Db(p));
break;
case 4:
- g.push(this.getBlob(p2));
+ g.push(this.getBlob(p));
break;
default:
g.push(null);
@@ -23973,8 +23873,8 @@ var require_sql_wasm = __commonJS({
c3.prototype.getAsObject = function(g, m4) {
g = this.get(g, m4);
m4 = this.getColumnNames();
- for (var n3 = {}, p2 = 0; p2 < m4.length; p2 += 1)
- n3[m4[p2]] = g[p2];
+ for (var n3 = {}, p = 0; p < m4.length; p += 1)
+ n3[m4[p]] = g[p];
return n3;
};
c3.prototype.getSQL = function() {
@@ -24039,8 +23939,8 @@ var require_sql_wasm = __commonJS({
c3.prototype.yb = function(g) {
var m4 = this;
Object.keys(g).forEach(function(n3) {
- var p2 = uc(m4.La, n3);
- 0 !== p2 && m4.ob(g[n3], p2);
+ var p = uc(m4.La, n3);
+ 0 !== p && m4.ob(g[n3], p);
});
return true;
};
@@ -24082,8 +23982,8 @@ var require_sql_wasm = __commonJS({
this.Ua = new c3(n3, this.db);
this.db.Za[n3] = this.Ua;
return { value: this.Ua, done: false };
- } catch (p2) {
- throw this.ib = C(this.eb), this.gb(), p2;
+ } catch (p) {
+ throw this.ib = C(this.eb), this.gb(), p;
} finally {
qa(g);
}
@@ -24115,7 +24015,7 @@ var require_sql_wasm = __commonJS({
f2.prototype.exec = function(g, m4, n3) {
if (!this.db)
throw "Database closed";
- var p2 = oa(), v2 = null;
+ var p = oa(), v2 = null;
try {
var y3 = ca(g) + 1, L2 = B2(y3);
t5(g, r2, L2, y3);
@@ -24139,11 +24039,11 @@ var require_sql_wasm = __commonJS({
} catch (na) {
throw v2 && v2.free(), na;
} finally {
- qa(p2);
+ qa(p);
}
};
- f2.prototype.each = function(g, m4, n3, p2, v2) {
- "function" === typeof m4 && (p2 = n3, n3 = m4, m4 = void 0);
+ f2.prototype.each = function(g, m4, n3, p, v2) {
+ "function" === typeof m4 && (p = n3, n3 = m4, m4 = void 0);
g = this.prepare(g, m4);
try {
for (; g.step(); )
@@ -24151,8 +24051,8 @@ var require_sql_wasm = __commonJS({
} finally {
g.free();
}
- if ("function" === typeof p2)
- return p2();
+ if ("function" === typeof p)
+ return p();
};
f2.prototype.prepare = function(g, m4) {
pa(h3);
@@ -24195,15 +24095,15 @@ var require_sql_wasm = __commonJS({
};
f2.prototype.create_function = function(g, m4) {
Object.prototype.hasOwnProperty.call(this.Na, g) && (ra(this.Na[g]), delete this.Na[g]);
- var n3 = ua(function(p2, v2, y3) {
+ var n3 = ua(function(p, v2, y3) {
v2 = b2(v2, y3);
try {
var L2 = m4.apply(null, v2);
} catch (G2) {
- xa(p2, G2, -1);
+ xa(p, G2, -1);
return;
}
- a4(p2, L2);
+ a4(p, L2);
}, "viii");
this.Na[g] = n3;
this.handleError(rb(this.db, g, m4.length, 1, 0, n3, 0, 0, 0));
@@ -24212,7 +24112,7 @@ var require_sql_wasm = __commonJS({
f2.prototype.create_aggregate = function(g, m4) {
var n3 = m4.init || function() {
return null;
- }, p2 = m4.finalize || function(H3) {
+ }, p = m4.finalize || function(H3) {
return H3;
}, v2 = m4.step;
if (!v2)
@@ -24234,7 +24134,7 @@ var require_sql_wasm = __commonJS({
}, "viii"), G2 = ua(function(H3) {
var I2 = sb(H3, 1);
try {
- var na = p2(y3[I2]);
+ var na = p(y3[I2]);
} catch (Z) {
delete y3[I2];
xa(H3, Z, -1);
@@ -26213,11 +26113,11 @@ var require_pica = __commonJS({
var a4 = new Error("Cannot find module '" + i5 + "'");
throw a4.code = "MODULE_NOT_FOUND", a4;
}
- var p2 = n3[i5] = { exports: {} };
- e5[i5][0].call(p2.exports, function(r3) {
+ var p = n3[i5] = { exports: {} };
+ e5[i5][0].call(p.exports, function(r3) {
var n4 = e5[i5][1][r3];
return o2(n4 || r3);
- }, p2, p2.exports, r2, e5, n3, t5);
+ }, p, p.exports, r2, e5, n3, t5);
}
return n3[i5].exports;
}
@@ -26645,9 +26545,9 @@ var require_pica = __commonJS({
return;
}
for (var ptr = target_offset, i4 = 0; i4 < src.length; i4++) {
- var data3 = src[i4];
- target[ptr++] = data3 & 255;
- target[ptr++] = data3 >> 8 & 255;
+ var data2 = src[i4];
+ target[ptr++] = data2 & 255;
+ target[ptr++] = data2 >> 8 & 255;
}
}
module4.exports = function resize_wasm(options) {
@@ -26784,8 +26684,8 @@ var require_pica = __commonJS({
}, {}], 13: [function(_dereq_, module4, exports3) {
"use strict";
var GC_INTERVAL = 100;
- function Pool(create3, idle) {
- this.create = create3;
+ function Pool(create2, idle) {
+ this.create = create2;
this.available = [];
this.acquired = {};
this.lastId = 1;
@@ -26932,15 +26832,15 @@ var require_pica = __commonJS({
function objClass(obj) {
return Object.prototype.toString.call(obj);
}
- module4.exports.isCanvas = function isCanvas(element3) {
- var cname = objClass(element3);
+ module4.exports.isCanvas = function isCanvas(element) {
+ var cname = objClass(element);
return cname === "[object HTMLCanvasElement]" || cname === "[object OffscreenCanvas]" || cname === "[object Canvas]";
};
- module4.exports.isImage = function isImage(element3) {
- return objClass(element3) === "[object HTMLImageElement]";
+ module4.exports.isImage = function isImage(element) {
+ return objClass(element) === "[object HTMLImageElement]";
};
- module4.exports.isImageBitmap = function isImageBitmap(element3) {
- return objClass(element3) === "[object ImageBitmap]";
+ module4.exports.isImageBitmap = function isImageBitmap(element) {
+ return objClass(element) === "[object ImageBitmap]";
};
module4.exports.limiter = function limiter(concurrency) {
var active = 0, queue = [];
@@ -27020,8 +26920,8 @@ var require_pica = __commonJS({
return self2.postMessage(false);
});
}
- var code3 = btoa("(".concat(workerPayload.toString(), ")(self);"));
- var w2 = new Worker("data:text/javascript;base64,".concat(code3));
+ var code = btoa("(".concat(workerPayload.toString(), ")(self);"));
+ var w2 = new Worker("data:text/javascript;base64,".concat(code));
w2.onmessage = function(ev) {
return resolve2(ev.data);
};
@@ -27062,11 +26962,11 @@ var require_pica = __commonJS({
resolve2(false);
return;
}
- var image3 = new Image();
- image3.src = "data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z";
- image3.onload = function() {
- createImageBitmap(image3, 0, 0, image3.width, image3.height).then(function(bitmap) {
- if (bitmap.width === image3.width && bitmap.height === image3.height) {
+ var image = new Image();
+ image.src = "data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z";
+ image.onload = function() {
+ createImageBitmap(image, 0, 0, image.width, image.height).then(function(bitmap) {
+ if (bitmap.width === image.width && bitmap.height === image.height) {
resolve2(true);
} else {
resolve2(false);
@@ -27075,7 +26975,7 @@ var require_pica = __commonJS({
return resolve2(false);
});
};
- image3.onerror = function() {
+ image.onerror = function() {
return resolve2(false);
};
});
@@ -27100,9 +27000,9 @@ var require_pica = __commonJS({
}
if (!mathLib)
mathLib = new MathLib(ev.data.features);
- var data3 = mathLib.resizeAndUnsharp(tileOpts);
+ var data2 = mathLib.resizeAndUnsharp(tileOpts);
if (returnBitmap) {
- var toImageData = new ImageData(new Uint8ClampedArray(data3), tileOpts.toWidth, tileOpts.toHeight);
+ var toImageData = new ImageData(new Uint8ClampedArray(data2), tileOpts.toWidth, tileOpts.toHeight);
var _canvas = new OffscreenCanvas(tileOpts.toWidth, tileOpts.toHeight);
var _ctx = _canvas.getContext("2d");
_ctx.putImageData(toImageData, 0, 0);
@@ -27113,8 +27013,8 @@ var require_pica = __commonJS({
});
} else {
postMessage({
- data: data3
- }, [data3.buffer]);
+ data: data2
+ }, [data2.buffer]);
}
};
};
@@ -27282,10 +27182,10 @@ var require_pica = __commonJS({
}
return this.__cache[name317];
};
- MultiMath.prototype.__align = function align(number5, base3) {
- base3 = base3 || 8;
- var reminder = number5 % base3;
- return number5 + (reminder ? base3 - reminder : 0);
+ MultiMath.prototype.__align = function align(number4, base2) {
+ base2 = base2 || 8;
+ var reminder = number4 % base2;
+ return number4 + (reminder ? base2 - reminder : 0);
};
module4.exports = MultiMath;
}, { "./lib/base64decode": 20, "./lib/wa_detect": 21, "object-assign": 22 }], 20: [function(_dereq_, module4, exports3) {
@@ -27340,7 +27240,7 @@ var require_pica = __commonJS({
}, {}], 22: [function(_dereq_, module4, exports3) {
"use strict";
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
- var hasOwnProperty4 = Object.prototype.hasOwnProperty;
+ var hasOwnProperty3 = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject2(val) {
if (val === null || val === void 0) {
@@ -27386,9 +27286,9 @@ var require_pica = __commonJS({
var symbols;
for (var s4 = 1; s4 < arguments.length; s4++) {
from = Object(arguments[s4]);
- for (var key3 in from) {
- if (hasOwnProperty4.call(from, key3)) {
- to2[key3] = from[key3];
+ for (var key2 in from) {
+ if (hasOwnProperty3.call(from, key2)) {
+ to2[key2] = from[key2];
}
}
if (getOwnPropertySymbols) {
@@ -27406,15 +27306,15 @@ var require_pica = __commonJS({
var bundleFn = arguments[3];
var sources = arguments[4];
var cache2 = arguments[5];
- var stringify5 = JSON.stringify;
+ var stringify3 = JSON.stringify;
module4.exports = function(fn, options) {
var wkey;
var cacheKeys = Object.keys(cache2);
for (var i4 = 0, l2 = cacheKeys.length; i4 < l2; i4++) {
- var key3 = cacheKeys[i4];
- var exp3 = cache2[key3].exports;
+ var key2 = cacheKeys[i4];
+ var exp3 = cache2[key2].exports;
if (exp3 === fn || exp3 && exp3.default === fn) {
- wkey = key3;
+ wkey = key2;
break;
}
}
@@ -27422,8 +27322,8 @@ var require_pica = __commonJS({
wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);
var wcache = {};
for (var i4 = 0, l2 = cacheKeys.length; i4 < l2; i4++) {
- var key3 = cacheKeys[i4];
- wcache[key3] = key3;
+ var key2 = cacheKeys[i4];
+ wcache[key2] = key2;
}
sources[wkey] = [
"function(require,module,exports){" + fn + "(self); }",
@@ -27434,23 +27334,23 @@ var require_pica = __commonJS({
var scache = {};
scache[wkey] = wkey;
sources[skey] = [
- "function(require,module,exports){var f = require(" + stringify5(wkey) + ");(f.default ? f.default : f)(self);}",
+ "function(require,module,exports){var f = require(" + stringify3(wkey) + ");(f.default ? f.default : f)(self);}",
scache
];
var workerSources = {};
resolveSources(skey);
- function resolveSources(key4) {
- workerSources[key4] = true;
- for (var depPath in sources[key4][1]) {
- var depKey = sources[key4][1][depPath];
+ function resolveSources(key3) {
+ workerSources[key3] = true;
+ for (var depPath in sources[key3][1]) {
+ var depKey = sources[key3][1][depPath];
if (!workerSources[depKey]) {
resolveSources(depKey);
}
}
}
- var src = "(" + bundleFn + ")({" + Object.keys(workerSources).map(function(key4) {
- return stringify5(key4) + ":[" + sources[key4][0] + "," + stringify5(sources[key4][1]) + "]";
- }).join(",") + "},{},[" + stringify5(skey) + "])";
+ var src = "(" + bundleFn + ")({" + Object.keys(workerSources).map(function(key3) {
+ return stringify3(key3) + ":[" + sources[key3][0] + "," + stringify3(sources[key3][1]) + "]";
+ }).join(",") + "},{},[" + stringify3(skey) + "])";
var URL2 = window.URL || window.webkitURL || window.mozURL || window.msURL;
var blob = new Blob([src], { type: "text/javascript" });
if (options && options.bare) {
@@ -27951,9 +27851,9 @@ var require_pica = __commonJS({
opts.unsharpRadius = 2;
opts.canceled = false;
if (opts.cancelToken) {
- opts.cancelToken = opts.cancelToken.then(function(data3) {
+ opts.cancelToken = opts.cancelToken.then(function(data2) {
opts.canceled = true;
- throw data3;
+ throw data2;
}, function(err) {
opts.canceled = true;
throw err;
@@ -28035,7 +27935,7 @@ __export(main_exports, {
module.exports = __toCommonJS(main_exports);
// src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx
-var import_state11 = require("@codemirror/state");
+var import_state10 = require("@codemirror/state");
var import_view10 = require("@codemirror/view");
// src/adapters/obsidian/ui/editors/markdownView/tooltip.ts
@@ -28242,12 +28142,12 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass(
};
}
writeMeasure(measured) {
- const { editor, space: space3 } = measured;
+ const { editor, space: space2 } = measured;
const others = [];
for (let i4 = 0; i4 < this.manager.tooltips.length; i4++) {
const tooltip = this.manager.tooltips[i4], tView = this.manager.tooltipViews[i4], { dom } = tView;
const pos = measured.pos[i4], size2 = measured.size[i4];
- if (!pos || pos.bottom <= Math.max(editor.top, space3.top) || pos.top >= Math.min(editor.bottom, space3.bottom) || pos.right < Math.max(editor.left, space3.left) - 0.1 || pos.left > Math.min(editor.right, space3.right) + 0.1) {
+ if (!pos || pos.bottom <= Math.max(editor.top, space2.top) || pos.top >= Math.min(editor.bottom, space2.bottom) || pos.right < Math.max(editor.left, space2.left) - 0.1 || pos.left > Math.min(editor.right, space2.right) + 0.1) {
dom.style.top = Outside;
continue;
}
@@ -28255,15 +28155,15 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass(
const arrowHeight = arrow ? 7 /* Size */ : 0;
const width = size2.right - size2.left, height = size2.bottom - size2.top;
const offset2 = tView.offset || noOffset, ltr = this.view.textDirection == import_view.Direction.LTR;
- const left = size2.width > space3.right - space3.left ? ltr ? space3.left : space3.right - size2.width : ltr ? Math.min(
+ const left = size2.width > space2.right - space2.left ? ltr ? space2.left : space2.right - size2.width : ltr ? Math.min(
pos.left - (arrow ? 14 /* Offset */ : 0) + offset2.x,
- space3.right - width
+ space2.right - width
) : Math.max(
- space3.left,
+ space2.left,
pos.left - width + (arrow ? 14 /* Offset */ : 0) - offset2.x
);
let above = !!tooltip.above;
- if (!tooltip.strictSide && (above ? pos.top - (size2.bottom - size2.top) - offset2.y < space3.top : pos.bottom + (size2.bottom - size2.top) + offset2.y > space3.bottom) && above == space3.bottom - pos.bottom > pos.top - space3.top)
+ if (!tooltip.strictSide && (above ? pos.top - (size2.bottom - size2.top) - offset2.y < space2.top : pos.bottom + (size2.bottom - size2.top) + offset2.y > space2.bottom) && above == space2.bottom - pos.bottom > pos.top - space2.top)
above = !above;
let top = above ? pos.top - height - arrowHeight - offset2.y : pos.bottom + arrowHeight + offset2.y;
const right = left + width;
@@ -28604,24 +28504,24 @@ function hoverTooltip(source, options = {}) {
create() {
return null;
},
- update(value, tr2) {
- if (value && options.hideOnChange && (tr2.docChanged || tr2.selection))
+ update(value, tr) {
+ if (value && options.hideOnChange && (tr.docChanged || tr.selection))
return null;
- for (const effect of tr2.effects) {
+ for (const effect of tr.effects) {
if (effect.is(setHover)) {
return effect.value;
}
if (effect.is(closeHoverTooltipEffect))
return null;
}
- if (value && tr2.docChanged) {
- const newPos = tr2.changes.mapPos(value.pos, -1, import_state.MapMode.TrackDel);
+ if (value && tr.docChanged) {
+ const newPos = tr.changes.mapPos(value.pos, -1, import_state.MapMode.TrackDel);
if (newPos == null)
return null;
const copy = Object.assign(/* @__PURE__ */ Object.create(null), value);
copy.pos = newPos;
if (value.end != null)
- copy.end = tr2.changes.mapPos(value.end);
+ copy.end = tr.changes.mapPos(value.end);
return copy;
}
return value;
@@ -28689,17 +28589,17 @@ var portalTypeAnnotation = import_state2.Annotation.define();
var flowIDAnnotation = import_state2.Annotation.define();
var flowIDStateField = import_state2.StateField.define({
create: () => void 0,
- update(value, tr2) {
- if (tr2.annotation(flowIDAnnotation))
- return tr2.annotation(flowIDAnnotation);
+ update(value, tr) {
+ if (tr.annotation(flowIDAnnotation))
+ return tr.annotation(flowIDAnnotation);
return value;
}
});
var flowTypeStateField = import_state2.StateField.define({
create: (state) => "none",
- update(value, tr2) {
- if (tr2.annotation(portalTypeAnnotation))
- return tr2.annotation(portalTypeAnnotation);
+ update(value, tr) {
+ if (tr.annotation(portalTypeAnnotation))
+ return tr.annotation(portalTypeAnnotation);
return value;
}
});
@@ -29610,20 +29510,20 @@ var T = class {
var i18n_default = new T().texts;
// src/core/utils/spaces/space.ts
-var pathIsSpace = (superstate, path3) => {
- if (!path3)
+var pathIsSpace = (superstate, path2) => {
+ if (!path2)
return false;
- return superstate.spacesIndex.has(path3);
+ return superstate.spacesIndex.has(path2);
};
-var spaceFolderPathFromSpace = (path3, manager) => {
+var spaceFolderPathFromSpace = (path2, manager) => {
if (manager.superstate.settings.spacesMDBInHidden) {
- if (path3 == "/")
+ if (path2 == "/")
return ".space/";
- return path3 + ".space/";
+ return path2 + ".space/";
}
- return path3;
+ return path2;
};
-var folderForTagSpace = (space3, settings) => settings.spacesFolder + "/" + space3;
+var folderForTagSpace = (space2, settings) => settings.spacesFolder + "/" + space2;
// src/core/types/context.ts
var PathPropertyName = "File";
@@ -29643,11 +29543,11 @@ function toInteger(dirtyNumber) {
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
return NaN;
}
- var number5 = Number(dirtyNumber);
- if (isNaN(number5)) {
- return number5;
+ var number4 = Number(dirtyNumber);
+ if (isNaN(number4)) {
+ return number4;
}
- return number5 < 0 ? Math.ceil(number5) : Math.floor(number5);
+ return number4 < 0 ? Math.ceil(number4) : Math.floor(number4);
}
// node_modules/date-fns/esm/_lib/requiredArgs/index.js
@@ -30122,9 +30022,9 @@ function getUTCWeek(dirtyDate, options) {
}
// node_modules/date-fns/esm/_lib/addLeadingZeros/index.js
-function addLeadingZeros(number5, targetLength) {
- var sign4 = number5 < 0 ? "-" : "";
- var output = Math.abs(number5).toString();
+function addLeadingZeros(number4, targetLength) {
+ var sign4 = number4 < 0 ? "-" : "";
+ var output = Math.abs(number4).toString();
while (output.length < targetLength) {
output = "0" + output;
}
@@ -31041,8 +30941,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 index3 = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
- return valuesArray[index3];
+ var index2 = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
+ return valuesArray[index2];
};
}
@@ -31133,19 +31033,19 @@ var formattingDayPeriodValues = {
}
};
var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
- var number5 = Number(dirtyNumber);
- var rem100 = number5 % 100;
+ var number4 = Number(dirtyNumber);
+ var rem100 = number4 % 100;
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
- return number5 + "st";
+ return number4 + "st";
case 2:
- return number5 + "nd";
+ return number4 + "nd";
case 3:
- return number5 + "rd";
+ return number4 + "rd";
}
}
- return number5 + "th";
+ return number4 + "th";
};
var localize = {
ordinalNumber,
@@ -31179,25 +31079,25 @@ var localize_default = localize;
// node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
function buildMatchFn(args) {
- return function(string6) {
+ return function(string4) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var width = options.width;
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
- var matchResult = string6.match(matchPattern);
+ var matchResult = string4.match(matchPattern);
if (!matchResult) {
return null;
}
var matchedString = matchResult[0];
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
- var key3 = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
+ var key2 = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
return pattern.test(matchedString);
}) : findKey(parsePatterns, function(pattern) {
return pattern.test(matchedString);
});
var value;
- value = args.valueCallback ? args.valueCallback(key3) : key3;
+ value = args.valueCallback ? args.valueCallback(key2) : key2;
value = options.valueCallback ? options.valueCallback(value) : value;
- var rest = string6.slice(matchedString.length);
+ var rest = string4.slice(matchedString.length);
return {
value,
rest
@@ -31205,17 +31105,17 @@ function buildMatchFn(args) {
};
}
function findKey(object, predicate) {
- for (var key3 in object) {
- if (object.hasOwnProperty(key3) && predicate(object[key3])) {
- return key3;
+ for (var key2 in object) {
+ if (object.hasOwnProperty(key2) && predicate(object[key2])) {
+ return key2;
}
}
return void 0;
}
function findIndex(array, predicate) {
- for (var key3 = 0; key3 < array.length; key3++) {
- if (predicate(array[key3])) {
- return key3;
+ for (var key2 = 0; key2 < array.length; key2++) {
+ if (predicate(array[key2])) {
+ return key2;
}
}
return void 0;
@@ -31223,18 +31123,18 @@ function findIndex(array, predicate) {
// node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
function buildMatchPatternFn(args) {
- return function(string6) {
+ return function(string4) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- var matchResult = string6.match(args.matchPattern);
+ var matchResult = string4.match(args.matchPattern);
if (!matchResult)
return null;
var matchedString = matchResult[0];
- var parseResult = string6.match(args.parsePattern);
+ var parseResult = string4.match(args.parsePattern);
if (!parseResult)
return null;
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
value = options.valueCallback ? options.valueCallback(value) : value;
- var rest = string6.slice(matchedString.length);
+ var rest = string4.slice(matchedString.length);
return {
value,
rest
@@ -31315,8 +31215,8 @@ var match = {
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
- valueCallback: function valueCallback2(index3) {
- return index3 + 1;
+ valueCallback: function valueCallback2(index2) {
+ return index2 + 1;
}
}),
month: buildMatchFn({
@@ -31575,17 +31475,17 @@ function toPropertyKey(t5) {
}
// node_modules/@babel/runtime/helpers/esm/defineProperty.js
-function _defineProperty(obj, key3, value) {
- key3 = toPropertyKey(key3);
- if (key3 in obj) {
- Object.defineProperty(obj, key3, {
+function _defineProperty(obj, key2, value) {
+ key2 = toPropertyKey(key2);
+ if (key2 in obj) {
+ Object.defineProperty(obj, key2, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else {
- obj[key3] = value;
+ obj[key2] = value;
}
return obj;
}
@@ -31824,21 +31724,21 @@ function setYear(dirtyDate, dirtyYear) {
}
// src/utils/array.ts
-var insert = (arr, index3, newItem) => !index3 || index3 <= 0 ? [
+var insert = (arr, index2, newItem) => !index2 || index2 <= 0 ? [
newItem,
...arr
] : [
- ...arr.slice(0, index3),
+ ...arr.slice(0, index2),
newItem,
- ...arr.slice(index3)
+ ...arr.slice(index2)
];
-var insertMulti = (arr, index3, newItem) => !index3 || index3 <= 0 ? [
+var insertMulti = (arr, index2, newItem) => !index2 || index2 <= 0 ? [
...newItem,
...arr
] : [
- ...arr.slice(0, index3),
+ ...arr.slice(0, index2),
...newItem,
- ...arr.slice(index3)
+ ...arr.slice(index2)
];
var uniq = (a4) => [...new Set(a4)];
var uniqCaseInsensitive = (a4) => [
@@ -31855,12 +31755,12 @@ var uniqueNameFromString = (name317, cols) => {
}
return newName;
};
-var onlyUniqueProp = (prop2) => (value, index3, self2) => {
- return self2.findIndex((v2) => value[prop2] == v2[prop2]) === index3;
+var onlyUniqueProp = (prop2) => (value, index2, self2) => {
+ return self2.findIndex((v2) => value[prop2] == v2[prop2]) === index2;
};
-var orderArrayByArrayWithKey = (array, order2, key3) => {
+var orderArrayByArrayWithKey = (array, order, key2) => {
return array.sort(function(a4, b2) {
- const A = order2.indexOf(a4[key3]), B2 = order2.indexOf(b2[key3]);
+ const A = order.indexOf(a4[key2]), B2 = order.indexOf(b2[key2]);
if (A > B2) {
if (A != -1 && B2 == -1) {
return -1;
@@ -31876,7 +31776,7 @@ var orderArrayByArrayWithKey = (array, order2, key3) => {
};
// src/utils/properties.ts
-var detectPropertyType = (value, key3) => {
+var detectPropertyType = (value, key2) => {
if (value instanceof Date) {
return "date";
}
@@ -31887,7 +31787,7 @@ var detectPropertyType = (value, key3) => {
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
return "date";
}
- if (key3 == "tag" || key3 == "tags") {
+ if (key2 == "tag" || key2 == "tags") {
return "tags-multi";
}
if (/\[\[.*?\]\]/.test(value)) {
@@ -31904,13 +31804,13 @@ var detectPropertyType = (value, key3) => {
if (typeof value === "string" && value.indexOf(",") > -1) {
arrayValue = parseMultiString(value);
}
- if (key3 == "tag" || key3 == "tags") {
+ if (key2 == "tag" || key2 == "tags") {
return "tags-multi";
}
if (arrayValue.length == 1 && Array.isArray(arrayValue[0]) && arrayValue[0].length == 1 && typeof arrayValue[0][0] === "string") {
return "link";
}
- const types2 = uniq(arrayValue.map((f2) => detectPropertyType(f2, key3)));
+ const types2 = uniq(arrayValue.map((f2) => detectPropertyType(f2, key2)));
if (types2.length == 1 && types2[0] == "link") {
return "link-multi";
}
@@ -32043,8 +31943,8 @@ var parseProperty = (field, value) => {
break;
case "duration":
return serializeMultiDisplayString(Object.keys(value.values).reduce(
- (p2, c3) => [
- ...p2,
+ (p, c3) => [
+ ...p,
...value.values[c3] > 0 ? [value.values[c3] + " " + c3] : []
],
[]
@@ -32102,20 +32002,20 @@ var safelyParseJSON = (json) => {
}
return parsed;
};
-var parseLinkString = (string6) => {
- if (!string6)
+var parseLinkString = (string4) => {
+ if (!string4)
return "";
- const match2 = /\[\[(.*?)\]\]/g.exec(string6);
- const stringValue = match2?.length > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string6;
+ const match2 = /\[\[(.*?)\]\]/g.exec(string4);
+ const stringValue = match2?.length > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string4;
if (stringValue)
return stringValue;
- return string6;
+ return string4;
};
// src/core/utils/strings.ts
-var defaultString = (value, string6) => {
+var defaultString = (value, string4) => {
if (!value || value.length == 0)
- return string6;
+ return string4;
return value;
};
function ensureArray(value) {
@@ -32185,12 +32085,12 @@ var removeQuotes = (s4) => {
}
};
var initiateString = (s4, defaultString2) => !s4 || s4.length == 0 ? defaultString2 : s4;
-var removeLeadingSlash = (path3) => path3.charAt(0) == "/" ? path3.substring(1) : path3;
-var pathToParentPath = (path3) => removeLeadingSlash(path3.substring(0, path3.lastIndexOf("/"))) || path3;
+var removeLeadingSlash = (path2) => path2.charAt(0) == "/" ? path2.substring(1) : path2;
+var pathToParentPath = (path2) => removeLeadingSlash(path2.substring(0, path2.lastIndexOf("/"))) || path2;
// src/utils/path.ts
-var schemaForPath = (superstate, path3) => {
- const uri = superstate.spaceManager.uriByString(path3);
+var schemaForPath = (superstate, path2) => {
+ const uri = superstate.spaceManager.uriByString(path2);
if (uri.refType == "context") {
return superstate.contextsIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref);
}
@@ -32201,49 +32101,49 @@ var schemaForPath = (superstate, path3) => {
return superstate.actionsIndex.get(uri.path)?.find((s4) => s4.schema.id == uri.ref)?.schema;
}
};
-var removeTrailingSlashFromFolder = (path3) => path3 == "/" ? path3 : path3.slice(-1) == "/" ? path3.substring(0, path3.length - 1) : path3;
-var pathDisplayName = (path3, superstate) => {
- if (!path3)
+var removeTrailingSlashFromFolder = (path2) => path2 == "/" ? path2 : path2.slice(-1) == "/" ? path2.substring(0, path2.length - 1) : path2;
+var pathDisplayName = (path2, superstate) => {
+ if (!path2)
return "";
- const uri = superstate.spaceManager.uriByString(path3);
+ const uri = superstate.spaceManager.uriByString(path2);
if (uri.refType) {
- const schema = schemaForPath(superstate, path3);
+ const schema = schemaForPath(superstate, path2);
if (schema) {
return schema.name;
}
}
- return superstate.pathsIndex.get(path3)?.name || path3;
+ return superstate.pathsIndex.get(path2)?.name || path2;
};
-var folderPathToString = (path3) => removeLeadingSlash(path3.substring(path3.lastIndexOf("/"))) || path3;
-var getParentFolderPaths = (path3) => {
+var folderPathToString = (path2) => removeLeadingSlash(path2.substring(path2.lastIndexOf("/"))) || path2;
+var getParentFolderPaths = (path2) => {
const folderPaths = [];
- const parts = path3.split("/");
+ const parts = path2.split("/");
let current3 = "";
for (let i4 = 0; i4 < parts.length; i4++) {
current3 += `${i4 === 0 ? "" : "/"}` + parts[i4];
- if (current3 != path3) {
+ if (current3 != path2) {
folderPaths.push(current3);
}
}
return folderPaths;
};
-var pathToString = (path3) => {
- if (path3.lastIndexOf("/") != -1) {
- if (path3.lastIndexOf(".") != -1)
+var pathToString = (path2) => {
+ if (path2.lastIndexOf("/") != -1) {
+ if (path2.lastIndexOf(".") != -1)
return removeLeadingSlash(
- path3.substring(
- path3.lastIndexOf("/") + 1,
- path3.lastIndexOf(".")
+ path2.substring(
+ path2.lastIndexOf("/") + 1,
+ path2.lastIndexOf(".")
)
);
- return path3.substring(path3.lastIndexOf("/") + 1);
+ return path2.substring(path2.lastIndexOf("/") + 1);
}
- if (path3.lastIndexOf(".") != -1) {
- return path3.substring(0, path3.lastIndexOf("."));
+ if (path2.lastIndexOf(".") != -1) {
+ return path2.substring(0, path2.lastIndexOf("."));
}
- return path3;
+ return path2;
};
-var pathNameToString = (path3) => path3.substring(0, path3.lastIndexOf(".")) || path3;
+var pathNameToString = (path2) => path2.substring(0, path2.lastIndexOf(".")) || path2;
var getParentPathFromString = (file) => {
const indexOfLastSlash = file.lastIndexOf("/");
if (indexOfLastSlash == -1) {
@@ -32259,8 +32159,8 @@ var parseURI = (uri) => {
const parseQuery2 = (queryString) => {
const query2 = {};
queryString.split("&").forEach((param) => {
- const [key3, value] = param.split("=");
- query2[decodeURIComponent(key3)] = decodeURIComponent(value);
+ const [key2, value] = param.split("=");
+ query2[decodeURIComponent(key2)] = decodeURIComponent(value);
});
return query2;
};
@@ -32273,8 +32173,8 @@ var parseURI = (uri) => {
return "action";
return null;
};
- let space3 = null;
- let path3 = null;
+ let space2 = null;
+ let path2 = null;
let alias = null;
let reference = null;
let refType = null;
@@ -32286,15 +32186,15 @@ var parseURI = (uri) => {
if (spaceStr.charAt(0) == "#") {
const endIndex = spaceStr.lastIndexOf("/#");
if (endIndex != -1) {
- space3 = spaceStr.slice(0, endIndex);
+ space2 = spaceStr.slice(0, endIndex);
uri = spaceStr.slice(endIndex);
} else {
- space3 = spaceStr;
+ space2 = spaceStr;
uri = "/";
}
} else {
const spaceParts = spaceStr.split("/");
- space3 = spaceParts[0];
+ space2 = spaceParts[0];
uri = spaceParts.slice(1).join("/") || "";
}
}
@@ -32323,10 +32223,10 @@ var parseURI = (uri) => {
alias = uri.slice(lastPipeIndex + 1);
uri = uri.slice(0, lastPipeIndex);
}
- path3 = uri;
+ path2 = uri;
return {
- basePath: removeTrailingSlashFromFolder(`${space3 ? `${scheme}://${space3}/${path3 != "/" ? path3 : ""}` : path3}`),
- authority: space3,
+ basePath: removeTrailingSlashFromFolder(`${space2 ? `${scheme}://${space2}/${path2 != "/" ? path2 : ""}` : path2}`),
+ authority: space2,
fullPath,
scheme,
path: removeTrailingSlashFromFolder(uri),
@@ -32337,18 +32237,18 @@ var parseURI = (uri) => {
query
};
};
-var movePath = (path3, newParent) => {
- const parts = path3.split("/");
+var movePath = (path2, newParent) => {
+ const parts = path2.split("/");
const newPath = newParent + "/" + parts[parts.length - 1];
return newPath;
};
-var renamePathWithoutExtension = (path3, newName) => {
- const dir = path3.substring(0, path3.lastIndexOf("/"));
+var renamePathWithoutExtension = (path2, newName) => {
+ const dir = path2.substring(0, path2.lastIndexOf("/"));
return dir.length > 0 ? `${dir}/${newName}` : `${newName}`;
};
-var renamePathWithExtension = (path3, newName) => {
- const dir = path3.substring(0, path3.lastIndexOf("/"));
- const ext = path3.lastIndexOf(".") != -1 ? path3.substring(path3.lastIndexOf(".")) : "";
+var renamePathWithExtension = (path2, newName) => {
+ const dir = path2.substring(0, path2.lastIndexOf("/"));
+ const ext = path2.lastIndexOf(".") != -1 ? path2.substring(path2.lastIndexOf(".")) : "";
return dir.length > 0 ? `${dir}/${newName}${ext}` : `${newName}${ext}`;
};
@@ -32364,13 +32264,13 @@ var renamePathByName = async (superstate, oldPath, newName) => {
return superstate.spaceManager.renamePath(oldPath, renamePathWithExtension(oldPath, newName));
}
};
-var hidePath = async (superstate, path3) => {
+var hidePath = async (superstate, path2) => {
superstate.settings.hiddenFiles = uniq([
...superstate.settings.hiddenFiles,
- path3
+ path2
]);
superstate.saveSettings();
- superstate.reloadPath(path3, true).then((f2) => superstate.dispatchEvent("superstateUpdated", null));
+ superstate.reloadPath(path2, true).then((f2) => superstate.dispatchEvent("superstateUpdated", null));
};
var hidePaths = async (superstate, paths) => {
superstate.settings.hiddenFiles = uniq([
@@ -32378,25 +32278,25 @@ var hidePaths = async (superstate, paths) => {
...paths
]);
superstate.saveSettings();
- Promise.all(paths.map((path3) => {
- superstate.reloadPath(path3, true);
+ Promise.all(paths.map((path2) => {
+ superstate.reloadPath(path2, true);
})).then((f2) => superstate.dispatchEvent("superstateUpdated", null));
};
-var deletePath = async (superstate, path3) => {
- superstate.spaceManager.deletePath(path3);
- superstate.onPathDeleted(path3);
+var deletePath = async (superstate, path2) => {
+ superstate.spaceManager.deletePath(path2);
+ superstate.onPathDeleted(path2);
};
var movePathToSpace = async (superstate, oldPath, newParent) => {
return superstate.spaceManager.renamePath(oldPath, movePath(oldPath, newParent));
};
-var convertPathToSpace = async (superstate, path3, open) => {
- const pathState = superstate.pathsIndex.get(path3);
+var convertPathToSpace = async (superstate, path2, open) => {
+ const pathState = superstate.pathsIndex.get(path2);
if (!pathState) {
return;
}
const newPath = pathState.parent + "/" + pathState.name;
await superstate.spaceManager.createSpace(pathState.name, pathState.parent, {});
- await superstate.spaceManager.renamePath(path3, newPath + "/" + pathState.metadata?.file?.name + ".md");
+ await superstate.spaceManager.renamePath(path2, newPath + "/" + pathState.metadata?.file?.name + ".md");
if (open) {
superstate.ui.openPath(newPath, false);
}
@@ -32406,7 +32306,7 @@ var convertPathToSpace = async (superstate, path3, open) => {
var import_lodash = __toESM(require_lodash());
// src/core/schemas/parseFieldValue.ts
-var allActions = (superstate, path3) => {
+var allActions = (superstate, path2) => {
const stringForType = (type) => {
if (type == "builtin") {
return "Builtin";
@@ -32416,14 +32316,14 @@ var allActions = (superstate, path3) => {
}
return "Action";
};
- return [...(superstate.actionsIndex.get(path3) ?? []).map((g) => ({ name: g.schema.name, description: "Action", value: `${path3}/#;${g.schema.id}`, section: "Action" })) ?? [], ...[...superstate.cli.allCommands()].map((g) => ({ name: g.schema.name, description: stringForType(g.schema.type), value: g.path, section: stringForType(g.schema.type) }))];
+ return [...(superstate.actionsIndex.get(path2) ?? []).map((g) => ({ name: g.schema.name, description: "Action", value: `${path2}/#;${g.schema.id}`, section: "Action" })) ?? [], ...[...superstate.cli.allCommands()].map((g) => ({ name: g.schema.name, description: stringForType(g.schema.type), value: g.path, section: stringForType(g.schema.type) }))];
};
var convertFileProp = ({ field, value }) => {
if (value == "ctime")
return { value: `parseDate(prop('${field}')['metadata']['file']['${value}'])`, type: "date" };
return { value: `prop('${field}')['metadata']['file']['${value}']`, type: "string" };
};
-var parseFieldValue = (value, type, superstate, path3) => {
+var parseFieldValue = (value, type, superstate, path2) => {
let valueProp = safelyParseJSON(value);
if (valueProp) {
if (type == "fileprop") {
@@ -32436,12 +32336,12 @@ var parseFieldValue = (value, type, superstate, path3) => {
} else if (valueProp.source == "$links") {
valueProp.options = superstate.spaceManager.allPaths().map((f2) => ({ name: f2, value: f2 }));
} else if (valueProp.source == "$super") {
- valueProp.options = allActions(superstate, path3);
+ valueProp.options = allActions(superstate, path2);
} else if (valueProp.source == "$properties") {
- valueProp.options = superstate.contextsIndex.get(path3)?.cols?.map((f2) => ({ name: f2.name, value: f2.name })) ?? [];
+ valueProp.options = superstate.contextsIndex.get(path2)?.cols?.map((f2) => ({ name: f2.name, value: f2.name })) ?? [];
}
}
- return [...fieldTypeForType(type).configKeys ?? [], "alias", "default"].reduce((p2, c3) => ({ ...p2, [c3]: valueProp[c3] }), {});
+ return [...fieldTypeForType(type).configKeys ?? [], "alias", "default"].reduce((p, c3) => ({ ...p, [c3]: valueProp[c3] }), {});
}
if (!type)
return {};
@@ -32709,7 +32609,7 @@ var defaultContextFields = {
}
]
};
-var defaultFieldsForContext = (space3) => {
+var defaultFieldsForContext = (space2) => {
return defaultContextFields;
};
var defaultTableFields = [
@@ -32735,7 +32635,7 @@ var defaultTagFields = {
}
]
};
-var defaultMDBTableForContext = (space3) => {
+var defaultMDBTableForContext = (space2) => {
return defaultFolderMDBTable;
};
var defaultFolderMDBTable = {
@@ -32754,13 +32654,13 @@ var defaultTagMDBTable = {
rows: []
};
var fieldsToTable = (fields, schemas) => {
- return fields.filter((s4) => schemas.find((g) => g.id == s4.schemaId && g.type == "db")).reduce((p2, c3) => {
+ return fields.filter((s4) => schemas.find((g) => g.id == s4.schemaId && g.type == "db")).reduce((p, c3) => {
return {
- ...p2,
- ...p2[c3.schemaId] ? {
+ ...p,
+ ...p[c3.schemaId] ? {
[c3.schemaId]: {
- uniques: c3.unique == "true" ? [...p2[c3.schemaId].uniques, c3.name] : p2[c3.schemaId].uniques,
- cols: [...p2[c3.schemaId].cols, c3.name],
+ uniques: c3.unique == "true" ? [...p[c3.schemaId].uniques, c3.name] : p[c3.schemaId].uniques,
+ cols: [...p[c3.schemaId].cols, c3.name],
rows: []
}
} : {
@@ -32773,7 +32673,7 @@ var fieldsToTable = (fields, schemas) => {
};
}, {});
};
-var defaultTablesForContext = (space3) => {
+var defaultTablesForContext = (space2) => {
return defaultFolderTables;
};
var defaultFolderTables = {
@@ -32794,27 +32694,27 @@ var defaultTagTables = {
};
// src/core/utils/contexts/optionValuesForColumn.ts
-var optionValuesForColumn = (column2, table2) => {
+var optionValuesForColumn = (column2, table) => {
return uniq(
- table2?.rows.reduce((p2, c3) => {
+ table?.rows.reduce((p, c3) => {
if (!(0, import_lodash.isString)(c3[column2]))
- return [...p2];
- return [...p2, ...parseMultiString(c3[column2])];
+ return [...p];
+ return [...p, ...parseMultiString(c3[column2])];
}, []) ?? []
);
};
-var defaultTableDataForContext = (superstate, space3) => {
- const paths = [...superstate.getSpaceItems(space3.path, true)];
+var defaultTableDataForContext = (superstate, space2) => {
+ const paths = [...superstate.getSpaceItems(space2.path, true)];
return {
- ...defaultMDBTableForContext(space3),
+ ...defaultMDBTableForContext(space2),
rows: paths.map((f2) => ({ [PathPropertyName]: f2.path }))
};
};
-var createNewRow = (mdb, row2, index3) => {
- if (index3) {
+var createNewRow = (mdb, row2, index2) => {
+ if (index2) {
return {
...mdb,
- rows: insert(mdb.rows, index3, row2)
+ rows: insert(mdb.rows, index2, row2)
};
}
return {
@@ -32837,8 +32737,8 @@ var renameTag = async (superstate, tag2, toTag) => {
const tags3 = getAllSubtags(superstate, tag2);
const newTag = ensureTag(validateName(toTag));
const paths = superstate.spaceManager.pathsForTag(tag2);
- for (const path3 of paths) {
- superstate.spaceManager.renameTag(path3, tag2, newTag);
+ for (const path2 of paths) {
+ superstate.spaceManager.renameTag(path2, tag2, newTag);
}
await renameTagSpacePath(superstate, tag2, newTag);
for (const subtag of tags3) {
@@ -32870,34 +32770,34 @@ var getAllSubtags = (superstate, tag2) => {
var tagToTagPath = (tag2) => {
return encodeSpaceName(ensureTag(tag2));
};
-var tagPathToTag = (string6) => {
- return pathToString(string6).replace(/\+/g, "/");
+var tagPathToTag = (string4) => {
+ return pathToString(string4).replace(/\+/g, "/");
};
var ensureTag = (tag2) => {
if (!tag2)
return null;
- let string6 = tag2;
- if (string6.charAt(0) != "#")
- string6 = "#" + string6;
- return string6;
+ let string4 = tag2;
+ if (string4.charAt(0) != "#")
+ string4 = "#" + string4;
+ return string4;
};
-var stringFromTag = (string6) => {
- if (string6.charAt(0) == "#") {
- if (string6.charAt(1) == "#") {
- return string6.substring(2, string6.length);
+var stringFromTag = (string4) => {
+ if (string4.charAt(0) == "#") {
+ if (string4.charAt(1) == "#") {
+ return string4.substring(2, string4.length);
}
- return string6.substring(1, string6.length);
+ return string4.substring(1, string4.length);
}
- return string6;
+ return string4;
};
// src/core/spaceManager/filesystemAdapter/spaceInfo.ts
var fileSystemSpaceInfoFromTag = (manager, tag2, readOnly) => {
- const path3 = tagSpacePathFromTag(tag2);
+ const path2 = tagSpacePathFromTag(tag2);
const folderPath = manager.superstate.settings.spacesFolder + "/" + tagToTagPath(tag2);
return {
name: tag2,
- path: path3,
+ path: path2,
isRemote: false,
readOnly,
folderPath,
@@ -33014,34 +32914,34 @@ var SpaceManager = class {
this.saveSystemCommand = (lib, action) => {
return this.primarySpaceAdapter.saveSystemCommand(lib, action).then((f2) => this.superstate.reloadSystemActions());
};
- this.onPathCreated = async (path3) => {
- this.superstate.onPathCreated(path3);
+ this.onPathCreated = async (path2) => {
+ this.superstate.onPathCreated(path2);
};
- this.onPathDeleted = async (path3) => {
- this.superstate.onPathDeleted(path3);
+ this.onPathDeleted = async (path2) => {
+ this.superstate.onPathDeleted(path2);
};
- this.onPathChanged = async (path3, oldPath) => {
- this.superstate.onPathRename(oldPath, path3);
+ this.onPathChanged = async (path2, oldPath) => {
+ this.superstate.onPathRename(oldPath, path2);
};
- this.onSpaceCreated = async (path3) => {
- if (path3.startsWith(this.superstate.settings.spacesFolder)) {
- this.onSpaceCreated(path3.replace(this.superstate.settings.spacesFolder, "spaces:/"));
+ this.onSpaceCreated = async (path2) => {
+ if (path2.startsWith(this.superstate.settings.spacesFolder)) {
+ this.onSpaceCreated(path2.replace(this.superstate.settings.spacesFolder, "spaces:/"));
return;
}
- const space3 = await this.superstate.reloadSpace(this.spaceInfoForPath(path3), null, true);
- await this.superstate.onSpaceDefinitionChanged(space3);
- await this.superstate.onPathCreated(path3);
+ const space2 = await this.superstate.reloadSpace(this.spaceInfoForPath(path2), null, true);
+ await this.superstate.onSpaceDefinitionChanged(space2);
+ await this.superstate.onPathCreated(path2);
};
- this.onSpaceRenamed = async (path3, oldPath) => {
- await this.superstate.onSpaceRenamed(oldPath, this.spaceInfoForPath(path3));
- await this.superstate.onPathRename(oldPath, path3);
+ this.onSpaceRenamed = async (path2, oldPath) => {
+ await this.superstate.onSpaceRenamed(oldPath, this.spaceInfoForPath(path2));
+ await this.superstate.onPathRename(oldPath, path2);
};
- this.onSpaceDeleted = async (path3) => {
- this.superstate.onSpaceDeleted(path3);
- this.superstate.onPathDeleted(path3);
+ this.onSpaceDeleted = async (path2) => {
+ this.superstate.onSpaceDeleted(path2);
+ this.superstate.onPathDeleted(path2);
};
- this.onPathPropertyChanged = async (path3) => {
- this.superstate.onMetadataChange(path3);
+ this.onPathPropertyChanged = async (path2) => {
+ this.superstate.onMetadataChange(path2);
};
this.spaceTypeByString = (uri) => {
if (uri.fullPath == tagsSpacePath) {
@@ -33067,27 +32967,27 @@ var SpaceManager = class {
saveSpaceTemplate(frames, name317) {
return this.primarySpaceAdapter.saveSpaceTemplate(frames, name317);
}
- resolvePath(path3, source) {
- if (!source || !path3)
- return path3;
- if (path3.indexOf("http") == 0)
- return path3;
- if (path3.indexOf("./") == 0 && source) {
+ resolvePath(path2, source) {
+ if (!source || !path2)
+ return path2;
+ if (path2.indexOf("http") == 0)
+ return path2;
+ if (path2.indexOf("./") == 0 && source) {
if (this.superstate.spacesIndex.has(source))
- return source + path3.slice(1);
- return source.slice(0, source.lastIndexOf("/")) + path3.slice(1);
- } else if (path3.indexOf("../") == 0 && source) {
+ return source + path2.slice(1);
+ return source.slice(0, source.lastIndexOf("/")) + path2.slice(1);
+ } else if (path2.indexOf("../") == 0 && source) {
const sourceParts = source.split("/");
- const pathParts = path3.split("/");
+ const pathParts = path2.split("/");
while (pathParts[0] === "..") {
sourceParts.pop();
pathParts.shift();
}
return [...sourceParts, ...pathParts].join("/");
}
- if (this.superstate.spacesIndex.has(path3))
- return path3;
- return this.primarySpaceAdapter.resolvePath(path3, source) ?? path3;
+ if (this.superstate.spacesIndex.has(path2))
+ return path2;
+ return this.primarySpaceAdapter.resolvePath(path2, source) ?? path2;
}
uriByString(uri, source) {
if (!uri)
@@ -33105,8 +33005,8 @@ var SpaceManager = class {
keysForCacheType(type) {
return this.primarySpaceAdapter.keysForCacheType(type);
}
- pathExists(path3) {
- return this.primarySpaceAdapter.pathExists(path3);
+ pathExists(path2) {
+ return this.primarySpaceAdapter.pathExists(path2);
}
addSpaceAdapter(spaceAdapter, primary) {
spaceAdapter.initiateAdapter(this);
@@ -33114,62 +33014,62 @@ var SpaceManager = class {
this.primarySpaceAdapter = spaceAdapter;
this.spaceAdapters.push(spaceAdapter);
}
- adapterForPath(path3) {
- const uri = this.uriByString(path3);
+ adapterForPath(path2) {
+ const uri = this.uriByString(path2);
if (!uri)
return this.primarySpaceAdapter;
return this.spaceAdapters.find((f2) => f2.schemes.includes(uri.scheme)) ?? this.primarySpaceAdapter;
}
- createSpace(name317, parentPath, definition3) {
- return this.adapterForPath(parentPath).createSpace(name317, parentPath, definition3);
+ createSpace(name317, parentPath, definition) {
+ return this.adapterForPath(parentPath).createSpace(name317, parentPath, definition);
}
- saveSpace(path3, definition3, properties3) {
- return this.adapterForPath(path3).saveSpace(path3, definition3, properties3);
+ saveSpace(path2, definition, properties3) {
+ return this.adapterForPath(path2).saveSpace(path2, definition, properties3);
}
- renameSpace(path3, newPath) {
- return this.adapterForPath(path3).renameSpace(path3, newPath);
+ renameSpace(path2, newPath) {
+ return this.adapterForPath(path2).renameSpace(path2, newPath);
}
- deleteSpace(path3) {
- return this.adapterForPath(path3).deleteSpace(path3);
+ deleteSpace(path2) {
+ return this.adapterForPath(path2).deleteSpace(path2);
}
- childrenForSpace(path3) {
- return this.adapterForPath(path3).childrenForSpace(path3);
+ childrenForSpace(path2) {
+ return this.adapterForPath(path2).childrenForSpace(path2);
}
- contextForSpace(path3) {
- return this.adapterForPath(path3).contextForSpace(path3);
+ contextForSpace(path2) {
+ return this.adapterForPath(path2).contextForSpace(path2);
}
- async tablesForSpace(path3) {
- return this.adapterForPath(path3).tablesForSpace(path3);
+ async tablesForSpace(path2) {
+ return this.adapterForPath(path2).tablesForSpace(path2);
}
- spaceInitiated(path3) {
- return this.adapterForPath(path3).spaceInitiated(path3);
+ spaceInitiated(path2) {
+ return this.adapterForPath(path2).spaceInitiated(path2);
}
- contextInitiated(path3) {
- return this.adapterForPath(path3).contextInitiated(path3);
+ contextInitiated(path2) {
+ return this.adapterForPath(path2).contextInitiated(path2);
}
- readTable(path3, schema) {
- return this.adapterForPath(path3).readTable(path3, schema);
+ readTable(path2, schema) {
+ return this.adapterForPath(path2).readTable(path2, schema);
}
- createTable(path3, schema) {
- return this.adapterForPath(path3).createTable(path3, schema).then((f2) => this.superstate.reloadContextByPath(path3));
+ createTable(path2, schema) {
+ return this.adapterForPath(path2).createTable(path2, schema).then((f2) => this.superstate.reloadContextByPath(path2));
}
- saveTableSchema(path3, schemaId, saveSchema) {
- return this.adapterForPath(path3).saveTableSchema(path3, schemaId, saveSchema).then((f2) => {
+ saveTableSchema(path2, schemaId, saveSchema) {
+ return this.adapterForPath(path2).saveTableSchema(path2, schemaId, saveSchema).then((f2) => {
if (f2)
- return this.superstate.reloadContextByPath(path3);
+ return this.superstate.reloadContextByPath(path2);
return f2;
});
}
- saveTable(path3, table2, force) {
- return this.adapterForPath(path3).saveTable(path3, table2, force).then((f2) => {
+ saveTable(path2, table, force) {
+ return this.adapterForPath(path2).saveTable(path2, table, force).then((f2) => {
if (f2)
- return this.superstate.reloadContextByPath(path3);
+ return this.superstate.reloadContextByPath(path2);
return f2;
});
}
- deleteTable(path3, name317) {
- return this.adapterForPath(path3).deleteTable(path3, name317).then((f2) => {
- return this.superstate.reloadContextByPath(path3);
+ deleteTable(path2, name317) {
+ return this.adapterForPath(path2).deleteTable(path2, name317).then((f2) => {
+ return this.superstate.reloadContextByPath(path2);
});
}
readAllKits() {
@@ -33178,50 +33078,50 @@ var SpaceManager = class {
readAllTemplates() {
return this.primarySpaceAdapter.readAllTemplates();
}
- readAllTables(path3) {
- return this.primarySpaceAdapter.readAllTables(path3);
+ readAllTables(path2) {
+ return this.primarySpaceAdapter.readAllTables(path2);
}
- framesForSpace(path3) {
- return this.adapterForPath(path3).framesForSpace(path3);
+ framesForSpace(path2) {
+ return this.adapterForPath(path2).framesForSpace(path2);
}
- readFrame(path3, schema) {
- return this.adapterForPath(path3).readFrame(path3, schema);
+ readFrame(path2, schema) {
+ return this.adapterForPath(path2).readFrame(path2, schema);
}
- readAllFrames(path3) {
- return this.adapterForPath(path3).readAllFrames(path3);
+ readAllFrames(path2) {
+ return this.adapterForPath(path2).readAllFrames(path2);
}
- createFrame(path3, schema) {
- return this.adapterForPath(path3).createFrame(path3, schema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path3)));
+ createFrame(path2, schema) {
+ return this.adapterForPath(path2).createFrame(path2, schema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path2)));
}
- deleteFrame(path3, name317) {
- return this.adapterForPath(path3).deleteFrame(path3, name317);
+ deleteFrame(path2, name317) {
+ return this.adapterForPath(path2).deleteFrame(path2, name317);
}
- saveFrameSchema(path3, schemaId, saveSchema) {
- return this.adapterForPath(path3).saveFrameSchema(path3, schemaId, saveSchema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path3)));
+ saveFrameSchema(path2, schemaId, saveSchema) {
+ return this.adapterForPath(path2).saveFrameSchema(path2, schemaId, saveSchema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path2)));
}
- saveFrame(path3, frame) {
- return this.adapterForPath(path3).saveFrame(path3, frame).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path3))).then((f2) => this.superstate.dispatchEvent("frameStateUpdated", { path: this.spaceInfoForPath(path3).path, schemaId: frame.schema.id }));
+ saveFrame(path2, frame) {
+ return this.adapterForPath(path2).saveFrame(path2, frame).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path2))).then((f2) => this.superstate.dispatchEvent("frameStateUpdated", { path: this.spaceInfoForPath(path2).path, schemaId: frame.schema.id }));
}
- commandsForSpace(path3) {
- return this.adapterForPath(path3).commandsForSpace(path3);
+ commandsForSpace(path2) {
+ return this.adapterForPath(path2).commandsForSpace(path2);
}
- runCommand(path3, name317, instance) {
- return this.adapterForPath(path3).runCommand(path3, name317, instance);
+ runCommand(path2, name317, instance) {
+ return this.adapterForPath(path2).runCommand(path2, name317, instance);
}
- createCommand(path3, schema) {
- return this.adapterForPath(path3).createCommand(path3, schema).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path3)));
+ createCommand(path2, schema) {
+ return this.adapterForPath(path2).createCommand(path2, schema).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path2)));
}
- deleteCommand(path3, name317) {
- return this.adapterForPath(path3).deleteCommand(path3, name317).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path3)));
+ deleteCommand(path2, name317) {
+ return this.adapterForPath(path2).deleteCommand(path2, name317).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path2)));
}
- saveCommand(path3, schemaId, saveCommand) {
- return this.adapterForPath(path3).saveCommand(path3, schemaId, saveCommand).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path3)));
+ saveCommand(path2, schemaId, saveCommand) {
+ return this.adapterForPath(path2).saveCommand(path2, schemaId, saveCommand).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path2)));
}
allPaths(type) {
return this.primarySpaceAdapter.allPaths(type);
}
- createItemAtPath(parent, type, name317, content5) {
- return this.adapterForPath(parent).createItemAtPath(parent, type, name317, content5);
+ createItemAtPath(parent, type, name317, content3) {
+ return this.adapterForPath(parent).createItemAtPath(parent, type, name317, content3);
}
renamePath(oldPath, newPath) {
return this.adapterForPath(oldPath).renamePath(oldPath, newPath);
@@ -33229,80 +33129,80 @@ var SpaceManager = class {
copyPath(source, destination, newName) {
return this.adapterForPath(source).copyPath(source, destination, newName);
}
- getPathInfo(path3) {
- return this.adapterForPath(path3).getPathInfo(path3);
+ getPathInfo(path2) {
+ return this.adapterForPath(path2).getPathInfo(path2);
}
- deletePath(path3) {
- return this.adapterForPath(path3).deletePath(path3);
+ deletePath(path2) {
+ return this.adapterForPath(path2).deletePath(path2);
}
- readPath(path3) {
- return this.adapterForPath(path3).readPath(path3);
+ readPath(path2) {
+ return this.adapterForPath(path2).readPath(path2);
}
- writeToPath(path3, content5, binary) {
- return this.adapterForPath(path3).writeToPath(path3, content5, binary);
+ writeToPath(path2, content3, binary) {
+ return this.adapterForPath(path2).writeToPath(path2, content3, binary);
}
- parentPathForPath(path3) {
- return this.adapterForPath(path3).parentPathForPath(path3);
+ parentPathForPath(path2) {
+ return this.adapterForPath(path2).parentPathForPath(path2);
}
- readPathCache(path3) {
- return this.adapterForPath(path3).readPathCache(path3);
+ readPathCache(path2) {
+ return this.adapterForPath(path2).readPathCache(path2);
}
allSpaces() {
return this.primarySpaceAdapter.allSpaces();
}
- spaceInfoForPath(path3) {
- return this.adapterForPath(path3).spaceInfoForPath(path3);
+ spaceInfoForPath(path2) {
+ return this.adapterForPath(path2).spaceInfoForPath(path2);
}
- spaceDefForSpace(path3) {
- return this.adapterForPath(path3).spaceDefForSpace(path3);
+ spaceDefForSpace(path2) {
+ return this.adapterForPath(path2).spaceDefForSpace(path2);
}
- readLabel(path3) {
- return this.adapterForPath(path3).readLabel(path3);
+ readLabel(path2) {
+ return this.adapterForPath(path2).readLabel(path2);
}
- saveLabel(path3, key3, value) {
- return this.adapterForPath(path3).saveLabel(path3, key3, value);
+ saveLabel(path2, key2, value) {
+ return this.adapterForPath(path2).saveLabel(path2, key2, value);
}
- addProperty(path3, property) {
- return this.adapterForPath(path3).addProperty(path3, property);
+ addProperty(path2, property) {
+ return this.adapterForPath(path2).addProperty(path2, property);
}
- saveProperties(path3, properties3) {
- if (!path3)
+ saveProperties(path2, properties3) {
+ if (!path2)
return;
- return this.adapterForPath(path3).saveProperties(path3, properties3);
+ return this.adapterForPath(path2).saveProperties(path2, properties3);
}
- readProperties(path3) {
- return this.adapterForPath(path3).readProperties(path3);
+ readProperties(path2) {
+ return this.adapterForPath(path2).readProperties(path2);
}
- renameProperty(path3, property, newProperty) {
- return this.adapterForPath(path3).renameProperty(path3, property, newProperty);
+ renameProperty(path2, property, newProperty) {
+ return this.adapterForPath(path2).renameProperty(path2, property, newProperty);
}
- deleteProperty(path3, property) {
- return this.adapterForPath(path3).deleteProperty(path3, property);
+ deleteProperty(path2, property) {
+ return this.adapterForPath(path2).deleteProperty(path2, property);
}
- addSpaceProperty(path3, property) {
- return this.adapterForPath(path3).addSpaceProperty(path3, property).then((f2) => this.superstate.reloadContextByPath(path3));
+ addSpaceProperty(path2, property) {
+ return this.adapterForPath(path2).addSpaceProperty(path2, property).then((f2) => this.superstate.reloadContextByPath(path2));
}
- deleteSpaceProperty(path3, property) {
- return this.adapterForPath(path3).deleteSpaceProperty(path3, property).then((f2) => this.superstate.reloadContextByPath(path3));
+ deleteSpaceProperty(path2, property) {
+ return this.adapterForPath(path2).deleteSpaceProperty(path2, property).then((f2) => this.superstate.reloadContextByPath(path2));
}
- saveSpaceProperty(path3, property, oldProperty) {
- return this.adapterForPath(path3).saveSpaceProperty(path3, property, oldProperty).then((f2) => {
+ saveSpaceProperty(path2, property, oldProperty) {
+ return this.adapterForPath(path2).saveSpaceProperty(path2, property, oldProperty).then((f2) => {
if (oldProperty.name != property.name) {
- this.superstate.contextsIndex.get(path3).paths.forEach((f3) => {
+ this.superstate.contextsIndex.get(path2).paths.forEach((f3) => {
this.renameProperty(f3, oldProperty.name, property.name);
});
}
- return this.superstate.reloadContextByPath(path3);
+ return this.superstate.reloadContextByPath(path2);
});
}
- addTag(path3, tag2) {
- return this.adapterForPath(path3).addTag(path3, tag2);
+ addTag(path2, tag2) {
+ return this.adapterForPath(path2).addTag(path2, tag2);
}
- deleteTag(path3, tag2) {
- return this.adapterForPath(path3).deleteTag(path3, tag2);
+ deleteTag(path2, tag2) {
+ return this.adapterForPath(path2).deleteTag(path2, tag2);
}
- renameTag(path3, tag2, newTag) {
- return this.adapterForPath(path3).renameTag(path3, tag2, newTag);
+ renameTag(path2, tag2, newTag) {
+ return this.adapterForPath(path2).renameTag(path2, tag2, newTag);
}
readTags() {
return this.primarySpaceAdapter.readTags();
@@ -33310,8 +33210,8 @@ var SpaceManager = class {
pathsForTag(tag2) {
return this.primarySpaceAdapter.pathsForTag(tag2);
}
- childrenForPath(path3, type) {
- return this.adapterForPath(path3).childrenForPath(path3, type);
+ childrenForPath(path2, type) {
+ return this.adapterForPath(path2).childrenForPath(path2, type);
}
readWaypoints() {
return this.primarySpaceAdapter.readWaypoints();
@@ -33321,55 +33221,55 @@ var SpaceManager = class {
this.superstate.dispatchEvent("superstateUpdated", null);
return this.primarySpaceAdapter.saveWaypoints(waypoints);
}
- readTemplates(path3) {
- return this.adapterForPath(path3).readTemplates(path3);
+ readTemplates(path2) {
+ return this.adapterForPath(path2).readTemplates(path2);
}
- saveTemplate(path3, space3) {
- return this.adapterForPath(path3).saveTemplate(path3, space3).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space3), null, true));
+ saveTemplate(path2, space2) {
+ return this.adapterForPath(path2).saveTemplate(path2, space2).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space2), null, true));
}
- deleteTemplate(template2, space3) {
- return this.primarySpaceAdapter.deleteTemplate(template2, space3).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space3), null, true));
+ deleteTemplate(template2, space2) {
+ return this.primarySpaceAdapter.deleteTemplate(template2, space2).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space2), null, true));
}
};
// src/core/utils/contexts/links.ts
-var valueContainsLink = (link3, value) => {
- return parseMultiString(value).some((f2) => link3 == parseLinkString(f2));
+var valueContainsLink = (link, value) => {
+ return parseMultiString(value).some((f2) => link == parseLinkString(f2));
};
-var replaceLinkInValue = (link3, newLink, value) => {
- return serializeMultiString(parseMultiString(value).map((f2) => parseLinkString(f2) == link3 ? newLink : link3));
+var replaceLinkInValue = (link, newLink, value) => {
+ return serializeMultiString(parseMultiString(value).map((f2) => parseLinkString(f2) == link ? newLink : link));
};
-var removeLinkInValue = (link3, value) => {
- return serializeMultiString(parseMultiString(value).filter((f2) => f2 != link3));
+var removeLinkInValue = (link, value) => {
+ return serializeMultiString(parseMultiString(value).filter((f2) => f2 != link));
};
var linkColumns = (cols) => {
return cols.filter((f2) => f2.type.startsWith("link") || f2.type.startsWith("context"));
};
-var removeLinksInRow = (manager, row2, link3, cols) => {
+var removeLinksInRow = (manager, row2, link, cols) => {
if (cols.length == 0) {
return row2;
}
- const deltaRow = cols.reduce((p2, c3) => {
- if (valueContainsLink(link3, row2[c3.name])) {
- const newValue = removeLinkInValue(link3, row2[c3.name]);
+ const deltaRow = cols.reduce((p, c3) => {
+ if (valueContainsLink(link, row2[c3.name])) {
+ const newValue = removeLinkInValue(link, row2[c3.name]);
manager.saveProperties(row2[PathPropertyName], { [c3.name]: parseMDBValue(c3.type, newValue) });
- return { ...p2, [c3.name]: newValue };
+ return { ...p, [c3.name]: newValue };
}
- return p2;
+ return p;
}, {});
return { ...row2, ...deltaRow };
};
-var renameLinksInRow = (manager, row2, link3, newLink, cols) => {
+var renameLinksInRow = (manager, row2, link, newLink, cols) => {
if (cols.length == 0) {
return row2;
}
- const deltaRow = cols.reduce((p2, c3) => {
- if (valueContainsLink(link3, row2[c3.name])) {
- const newValue = replaceLinkInValue(link3, newLink, row2[c3.name]);
+ const deltaRow = cols.reduce((p, c3) => {
+ if (valueContainsLink(link, row2[c3.name])) {
+ const newValue = replaceLinkInValue(link, newLink, row2[c3.name]);
manager.saveProperties(row2[PathPropertyName], { [c3.name]: parseMDBValue(c3.type, newValue) });
- return { ...p2, [c3.name]: newValue };
+ return { ...p, [c3.name]: newValue };
}
- return p2;
+ return p;
}, {});
return { ...row2, ...deltaRow };
};
@@ -33399,7 +33299,7 @@ var removeRowsForPath = (spaceTable, paths) => {
)
};
};
-var reorderRowsForPath = (spaceTable, paths, index3) => {
+var reorderRowsForPath = (spaceTable, paths, index2) => {
const rows = spaceTable.rows.filter(
(f2) => paths.includes(f2[PathPropertyName])
);
@@ -33407,7 +33307,7 @@ var reorderRowsForPath = (spaceTable, paths, index3) => {
...spaceTable,
rows: insertMulti(spaceTable.rows.filter(
(f2) => !paths.includes(f2[PathPropertyName])
- ), index3, rows)
+ ), index2, rows)
};
};
@@ -33428,19 +33328,19 @@ function useCombinedRefs() {
refs[_key] = arguments[_key];
}
return (0, import_react.useMemo)(
- () => (node2) => {
- refs.forEach((ref2) => ref2(node2));
+ () => (node) => {
+ refs.forEach((ref2) => ref2(node));
},
refs
);
}
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
-function isWindow(element3) {
- const elementString = Object.prototype.toString.call(element3);
+function isWindow(element) {
+ const elementString = Object.prototype.toString.call(element);
return elementString === "[object Window]" || elementString === "[object global]";
}
-function isNode(node2) {
- return "nodeType" in node2;
+function isNode(node) {
+ return "nodeType" in node;
}
function getWindow(target) {
var _target$ownerDocument, _target$ownerDocument2;
@@ -33455,20 +33355,20 @@ function getWindow(target) {
}
return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
}
-function isDocument(node2) {
+function isDocument(node) {
const {
Document
- } = getWindow(node2);
- return node2 instanceof Document;
+ } = getWindow(node);
+ return node instanceof Document;
}
-function isHTMLElement(node2) {
- if (isWindow(node2)) {
+function isHTMLElement(node) {
+ if (isWindow(node)) {
return false;
}
- return node2 instanceof getWindow(node2).HTMLElement;
+ return node instanceof getWindow(node).HTMLElement;
}
-function isSVGElement(node2) {
- return node2 instanceof getWindow(node2).SVGElement;
+function isSVGElement(node) {
+ return node instanceof getWindow(node).SVGElement;
}
function getOwnerDocument(target) {
if (!target) {
@@ -33539,17 +33439,17 @@ function useLazyMemo(callback, dependencies314) {
}
function useNodeRef(onChange) {
const onChangeHandler = useEvent(onChange);
- const node2 = (0, import_react.useRef)(null);
+ const node = (0, import_react.useRef)(null);
const setNodeRef = (0, import_react.useCallback)(
- (element3) => {
- if (element3 !== node2.current) {
- onChangeHandler == null ? void 0 : onChangeHandler(element3, node2.current);
+ (element) => {
+ if (element !== node.current) {
+ onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);
}
- node2.current = element3;
+ node.current = element;
},
[]
);
- return [node2, setNodeRef];
+ return [node, setNodeRef];
}
function usePrevious(value) {
const ref2 = (0, import_react.useRef)();
@@ -33576,10 +33476,10 @@ function createAdjustmentFn(modifier) {
}
return adjustments.reduce((accumulator, adjustment) => {
const entries = Object.entries(adjustment);
- for (const [key3, valueAdjustment] of entries) {
- const value = accumulator[key3];
+ for (const [key2, valueAdjustment] of entries) {
+ const value = accumulator[key2];
if (value != null) {
- accumulator[key3] = value + modifier * valueAdjustment;
+ accumulator[key2] = value + modifier * valueAdjustment;
}
}
return accumulator;
@@ -33686,11 +33586,11 @@ var CSS = /* @__PURE__ */ Object.freeze({
}
});
var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
-function findFirstFocusableNode(element3) {
- if (element3.matches(SELECTOR)) {
- return element3;
+function findFirstFocusableNode(element) {
+ if (element.matches(SELECTOR)) {
+ return element;
}
- return element3.querySelector(SELECTOR);
+ return element.querySelector(SELECTOR);
}
// node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js
@@ -34050,8 +33950,8 @@ var closestCorners = (_ref) => {
const rect = droppableRects.get(id3);
if (rect) {
const rectCorners = cornersOfRectangle(rect);
- const distances = corners.reduce((accumulator, corner, index3) => {
- return accumulator + distanceBetween(rectCorners[index3], corner);
+ const distances = corners.reduce((accumulator, corner, index2) => {
+ return accumulator + distanceBetween(rectCorners[index2], corner);
}, 0);
const effectiveDistance = Number((distances / 4).toFixed(4));
collisions.push({
@@ -34185,16 +34085,16 @@ function inverseTransform(rect, transform, transformOrigin) {
var defaultOptions2 = {
ignoreTransform: false
};
-function getClientRect(element3, options) {
+function getClientRect(element, options) {
if (options === void 0) {
options = defaultOptions2;
}
- let rect = element3.getBoundingClientRect();
+ let rect = element.getBoundingClientRect();
if (options.ignoreTransform) {
const {
transform,
transformOrigin
- } = getWindow(element3).getComputedStyle(element3);
+ } = getWindow(element).getComputedStyle(element);
if (transform) {
rect = inverseTransform(rect, transform, transformOrigin);
}
@@ -34216,14 +34116,14 @@ function getClientRect(element3, options) {
right
};
}
-function getTransformAgnosticClientRect(element3) {
- return getClientRect(element3, {
+function getTransformAgnosticClientRect(element) {
+ return getClientRect(element, {
ignoreTransform: true
});
}
-function getWindowClientRect(element3) {
- const width = element3.innerWidth;
- const height = element3.innerHeight;
+function getWindowClientRect(element) {
+ const width = element.innerWidth;
+ const height = element.innerHeight;
return {
top: 0,
left: 0,
@@ -34233,15 +34133,15 @@ function getWindowClientRect(element3) {
height
};
}
-function isFixed(node2, computedStyle) {
+function isFixed(node, computedStyle) {
if (computedStyle === void 0) {
- computedStyle = getWindow(node2).getComputedStyle(node2);
+ computedStyle = getWindow(node).getComputedStyle(node);
}
return computedStyle.position === "fixed";
}
-function isScrollable(element3, computedStyle) {
+function isScrollable(element, computedStyle) {
if (computedStyle === void 0) {
- computedStyle = getWindow(element3).getComputedStyle(element3);
+ computedStyle = getWindow(element).getComputedStyle(element);
}
const overflowRegex = /(auto|scroll|overlay)/;
const properties3 = ["overflow", "overflowX", "overflowY"];
@@ -34250,79 +34150,79 @@ function isScrollable(element3, computedStyle) {
return typeof value === "string" ? overflowRegex.test(value) : false;
});
}
-function getScrollableAncestors(element3, limit) {
+function getScrollableAncestors(element, limit) {
const scrollParents = [];
- function findScrollableAncestors(node2) {
+ function findScrollableAncestors(node) {
if (limit != null && scrollParents.length >= limit) {
return scrollParents;
}
- if (!node2) {
+ if (!node) {
return scrollParents;
}
- if (isDocument(node2) && node2.scrollingElement != null && !scrollParents.includes(node2.scrollingElement)) {
- scrollParents.push(node2.scrollingElement);
+ if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {
+ scrollParents.push(node.scrollingElement);
return scrollParents;
}
- if (!isHTMLElement(node2) || isSVGElement(node2)) {
+ if (!isHTMLElement(node) || isSVGElement(node)) {
return scrollParents;
}
- if (scrollParents.includes(node2)) {
+ if (scrollParents.includes(node)) {
return scrollParents;
}
- const computedStyle = getWindow(element3).getComputedStyle(node2);
- if (node2 !== element3) {
- if (isScrollable(node2, computedStyle)) {
- scrollParents.push(node2);
+ const computedStyle = getWindow(element).getComputedStyle(node);
+ if (node !== element) {
+ if (isScrollable(node, computedStyle)) {
+ scrollParents.push(node);
}
}
- if (isFixed(node2, computedStyle)) {
+ if (isFixed(node, computedStyle)) {
return scrollParents;
}
- return findScrollableAncestors(node2.parentNode);
+ return findScrollableAncestors(node.parentNode);
}
- if (!element3) {
+ if (!element) {
return scrollParents;
}
- return findScrollableAncestors(element3);
+ return findScrollableAncestors(element);
}
-function getFirstScrollableAncestor(node2) {
- const [firstScrollableAncestor] = getScrollableAncestors(node2, 1);
+function getFirstScrollableAncestor(node) {
+ const [firstScrollableAncestor] = getScrollableAncestors(node, 1);
return firstScrollableAncestor != null ? firstScrollableAncestor : null;
}
-function getScrollableElement(element3) {
- if (!canUseDOM || !element3) {
+function getScrollableElement(element) {
+ if (!canUseDOM || !element) {
return null;
}
- if (isWindow(element3)) {
- return element3;
+ if (isWindow(element)) {
+ return element;
}
- if (!isNode(element3)) {
+ if (!isNode(element)) {
return null;
}
- if (isDocument(element3) || element3 === getOwnerDocument(element3).scrollingElement) {
+ if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
return window;
}
- if (isHTMLElement(element3)) {
- return element3;
+ if (isHTMLElement(element)) {
+ return element;
}
return null;
}
-function getScrollXCoordinate(element3) {
- if (isWindow(element3)) {
- return element3.scrollX;
+function getScrollXCoordinate(element) {
+ if (isWindow(element)) {
+ return element.scrollX;
}
- return element3.scrollLeft;
+ return element.scrollLeft;
}
-function getScrollYCoordinate(element3) {
- if (isWindow(element3)) {
- return element3.scrollY;
+function getScrollYCoordinate(element) {
+ if (isWindow(element)) {
+ return element.scrollY;
}
- return element3.scrollTop;
+ return element.scrollTop;
}
-function getScrollCoordinates(element3) {
+function getScrollCoordinates(element) {
return {
- x: getScrollXCoordinate(element3),
- y: getScrollYCoordinate(element3)
+ x: getScrollXCoordinate(element),
+ y: getScrollYCoordinate(element)
};
}
var Direction2;
@@ -34330,11 +34230,11 @@ var Direction2;
Direction3[Direction3["Forward"] = 1] = "Forward";
Direction3[Direction3["Backward"] = -1] = "Backward";
})(Direction2 || (Direction2 = {}));
-function isDocumentScrollingElement(element3) {
- if (!canUseDOM || !element3) {
+function isDocumentScrollingElement(element) {
+ if (!canUseDOM || !element) {
return false;
}
- return element3 === document.scrollingElement;
+ return element === document.scrollingElement;
}
function getScrollPosition(scrollingContainer) {
const minScroll = {
@@ -34419,8 +34319,8 @@ function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref,
speed
};
}
-function getScrollElementRect(element3) {
- if (element3 === document.scrollingElement) {
+function getScrollElementRect(element) {
+ if (element === document.scrollingElement) {
const {
innerWidth: innerWidth2,
innerHeight: innerHeight2
@@ -34439,36 +34339,36 @@ function getScrollElementRect(element3) {
left,
right,
bottom
- } = element3.getBoundingClientRect();
+ } = element.getBoundingClientRect();
return {
top,
left,
right,
bottom,
- width: element3.clientWidth,
- height: element3.clientHeight
+ width: element.clientWidth,
+ height: element.clientHeight
};
}
function getScrollOffsets(scrollableAncestors) {
- return scrollableAncestors.reduce((acc, node2) => {
- return add(acc, getScrollCoordinates(node2));
+ return scrollableAncestors.reduce((acc, node) => {
+ return add(acc, getScrollCoordinates(node));
}, defaultCoordinates);
}
function getScrollXOffset(scrollableAncestors) {
- return scrollableAncestors.reduce((acc, node2) => {
- return acc + getScrollXCoordinate(node2);
+ return scrollableAncestors.reduce((acc, node) => {
+ return acc + getScrollXCoordinate(node);
}, 0);
}
function getScrollYOffset(scrollableAncestors) {
- return scrollableAncestors.reduce((acc, node2) => {
- return acc + getScrollYCoordinate(node2);
+ return scrollableAncestors.reduce((acc, node) => {
+ return acc + getScrollYCoordinate(node);
}, 0);
}
-function scrollIntoViewIfNeeded(element3, measure) {
+function scrollIntoViewIfNeeded(element, measure) {
if (measure === void 0) {
measure = getClientRect;
}
- if (!element3) {
+ if (!element) {
return;
}
const {
@@ -34476,13 +34376,13 @@ function scrollIntoViewIfNeeded(element3, measure) {
left,
bottom,
right
- } = measure(element3);
- const firstScrollableAncestor = getFirstScrollableAncestor(element3);
+ } = measure(element);
+ const firstScrollableAncestor = getFirstScrollableAncestor(element);
if (!firstScrollableAncestor) {
return;
}
if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {
- element3.scrollIntoView({
+ element.scrollIntoView({
block: "center",
inline: "center"
});
@@ -34490,7 +34390,7 @@ function scrollIntoViewIfNeeded(element3, measure) {
}
var properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
var Rect = class {
- constructor(rect, element3) {
+ constructor(rect, element) {
this.rect = void 0;
this.width = void 0;
this.height = void 0;
@@ -34498,20 +34398,20 @@ var Rect = class {
this.bottom = void 0;
this.right = void 0;
this.left = void 0;
- const scrollableAncestors = getScrollableAncestors(element3);
+ const scrollableAncestors = getScrollableAncestors(element);
const scrollOffsets = getScrollOffsets(scrollableAncestors);
this.rect = {
...rect
};
this.width = rect.width;
this.height = rect.height;
- for (const [axis, keys2, getScrollOffset] of properties) {
- for (const key3 of keys2) {
- Object.defineProperty(this, key3, {
+ for (const [axis, keys, getScrollOffset] of properties) {
+ for (const key2 of keys) {
+ Object.defineProperty(this, key2, {
get: () => {
const currentOffsets = getScrollOffset(scrollableAncestors);
const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
- return this.rect[key3] + scrollOffsetsDeltla;
+ return this.rect[key2] + scrollOffsetsDeltla;
},
enumerable: true
});
@@ -34653,9 +34553,9 @@ var KeyboardSensor = class {
activeNode,
onStart
} = this.props;
- const node2 = activeNode.node.current;
- if (node2) {
- scrollIntoViewIfNeeded(node2);
+ const node = activeNode.node.current;
+ if (node) {
+ scrollIntoViewIfNeeded(node);
}
onStart(defaultCoordinates);
}
@@ -34672,13 +34572,13 @@ var KeyboardSensor = class {
scrollBehavior = "smooth"
} = options;
const {
- code: code3
+ code
} = event;
- if (keyboardCodes.end.includes(code3)) {
+ if (keyboardCodes.end.includes(code)) {
this.handleEnd(event);
return;
}
- if (keyboardCodes.cancel.includes(code3)) {
+ if (keyboardCodes.cancel.includes(code)) {
this.handleCancel(event);
return;
}
@@ -34812,9 +34712,9 @@ KeyboardSensor.activators = [{
active
} = _ref2;
const {
- code: code3
+ code
} = event.nativeEvent;
- if (keyboardCodes.start.includes(code3)) {
+ if (keyboardCodes.start.includes(code)) {
const activator = active.activatorNode.current;
if (activator && event.target !== activator) {
return false;
@@ -35132,7 +35032,7 @@ function useAutoScroller(_ref) {
draggingRect,
enabled,
interval = 5,
- order: order2 = TraversalOrder.TreeOrder,
+ order = TraversalOrder.TreeOrder,
pointerCoordinates,
scrollableAncestors,
scrollableAncestorRects,
@@ -35175,7 +35075,7 @@ function useAutoScroller(_ref) {
const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
scrollContainer.scrollBy(scrollLeft, scrollTop);
}, []);
- const sortedScrollableAncestors = (0, import_react3.useMemo)(() => order2 === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order2, scrollableAncestors]);
+ const sortedScrollableAncestors = (0, import_react3.useMemo)(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);
(0, import_react3.useEffect)(
() => {
if (!enabled || !scrollableAncestors.length || !rect) {
@@ -35186,8 +35086,8 @@ function useAutoScroller(_ref) {
if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
continue;
}
- const index3 = scrollableAncestors.indexOf(scrollContainer);
- const scrollContainerRect = scrollableAncestorRects[index3];
+ const index2 = scrollableAncestors.indexOf(scrollContainer);
+ const scrollContainerRect = scrollableAncestorRects[index2];
if (!scrollContainerRect) {
continue;
}
@@ -35275,14 +35175,14 @@ function useScrollIntent(_ref2) {
}
function useCachedNode(draggableNodes, id3) {
const draggableNode = id3 !== null ? draggableNodes.get(id3) : void 0;
- const node2 = draggableNode ? draggableNode.node.current : null;
+ const node = draggableNode ? draggableNode.node.current : null;
return useLazyMemo((cachedNode) => {
var _ref;
if (id3 === null) {
return null;
}
- return (_ref = node2 != null ? node2 : cachedNode) != null ? _ref : null;
- }, [node2, id3]);
+ return (_ref = node != null ? node : cachedNode) != null ? _ref : null;
+ }, [node, id3]);
}
function useCombineActivators(sensors, getSyntheticHandler) {
return (0, import_react3.useMemo)(() => sensors.reduce((accumulator, sensor) => {
@@ -35342,23 +35242,23 @@ function useDroppableMeasuring(containers, _ref) {
return defaultValue;
}
if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
- const map6 = /* @__PURE__ */ new Map();
+ const map4 = /* @__PURE__ */ new Map();
for (let container of containers) {
if (!container) {
continue;
}
if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
- map6.set(container.id, container.rect.current);
+ map4.set(container.id, container.rect.current);
continue;
}
- const node2 = container.node.current;
- const rect = node2 ? new Rect(measure(node2), node2) : null;
+ const node = container.node.current;
+ const rect = node ? new Rect(measure(node), node) : null;
container.rect.current = rect;
if (rect) {
- map6.set(container.id, rect);
+ map4.set(container.id, rect);
}
}
- return map6;
+ return map4;
}
return previousValue;
}, [containers, queue, dragging, disabled, measure]);
@@ -35421,8 +35321,8 @@ function useInitialValue(value, computeFn) {
return typeof computeFn === "function" ? computeFn(value) : value;
}, [computeFn, value]);
}
-function useInitialRect(node2, measure) {
- return useInitialValue(node2, measure);
+function useInitialRect(node, measure) {
+ return useInitialValue(node, measure);
}
function useMutationObserver(_ref) {
let {
@@ -35435,9 +35335,9 @@ function useMutationObserver(_ref) {
return void 0;
}
const {
- MutationObserver
+ MutationObserver: MutationObserver2
} = window;
- return new MutationObserver(handleMutations);
+ return new MutationObserver2(handleMutations);
}, [handleMutations, disabled]);
(0, import_react3.useEffect)(() => {
return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
@@ -35467,17 +35367,17 @@ function useResizeObserver(_ref) {
}, [resizeObserver]);
return resizeObserver;
}
-function defaultMeasure(element3) {
- return new Rect(getClientRect(element3), element3);
+function defaultMeasure(element) {
+ return new Rect(getClientRect(element), element);
}
-function useRect(element3, measure, fallbackRect) {
+function useRect(element, measure, fallbackRect) {
if (measure === void 0) {
measure = defaultMeasure;
}
const [rect, measureRect] = (0, import_react3.useReducer)(reducer3, null);
const mutationObserver = useMutationObserver({
callback(records) {
- if (!element3) {
+ if (!element) {
return;
}
for (const record of records) {
@@ -35485,7 +35385,7 @@ function useRect(element3, measure, fallbackRect) {
type,
target
} = record;
- if (type === "childList" && target instanceof HTMLElement && target.contains(element3)) {
+ if (type === "childList" && target instanceof HTMLElement && target.contains(element)) {
measureRect();
break;
}
@@ -35497,8 +35397,8 @@ function useRect(element3, measure, fallbackRect) {
});
useIsomorphicLayoutEffect(() => {
measureRect();
- if (element3) {
- resizeObserver == null ? void 0 : resizeObserver.observe(element3);
+ if (element) {
+ resizeObserver == null ? void 0 : resizeObserver.observe(element);
mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {
childList: true,
subtree: true
@@ -35507,17 +35407,17 @@ function useRect(element3, measure, fallbackRect) {
resizeObserver == null ? void 0 : resizeObserver.disconnect();
mutationObserver == null ? void 0 : mutationObserver.disconnect();
}
- }, [element3]);
+ }, [element]);
return rect;
function reducer3(currentRect) {
- if (!element3) {
+ if (!element) {
return null;
}
- if (element3.isConnected === false) {
+ if (element.isConnected === false) {
var _ref;
return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
}
- const newRect = measure(element3);
+ const newRect = measure(element);
if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
return currentRect;
}
@@ -35529,20 +35429,20 @@ function useRectDelta(rect) {
return getRectDelta(rect, initialRect);
}
var defaultValue$1 = [];
-function useScrollableAncestors(node2) {
- const previousNode = (0, import_react3.useRef)(node2);
+function useScrollableAncestors(node) {
+ const previousNode = (0, import_react3.useRef)(node);
const ancestors = useLazyMemo((previousValue) => {
- if (!node2) {
+ if (!node) {
return defaultValue$1;
}
- if (previousValue && previousValue !== defaultValue$1 && node2 && previousNode.current && node2.parentNode === previousNode.current.parentNode) {
+ if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {
return previousValue;
}
- return getScrollableAncestors(node2);
- }, [node2]);
+ return getScrollableAncestors(node);
+ }, [node]);
(0, import_react3.useEffect)(() => {
- previousNode.current = node2;
- }, [node2]);
+ previousNode.current = node;
+ }, [node]);
return ancestors;
}
function useScrollOffsets(elements) {
@@ -35565,8 +35465,8 @@ function useScrollOffsets(elements) {
const previousElements = prevElements.current;
if (elements !== previousElements) {
cleanup(previousElements);
- const entries = elements.map((element3) => {
- const scrollableElement = getScrollableElement(element3);
+ const entries = elements.map((element) => {
+ const scrollableElement = getScrollableElement(element);
if (scrollableElement) {
scrollableElement.addEventListener("scroll", handleScroll, {
passive: true
@@ -35583,8 +35483,8 @@ function useScrollOffsets(elements) {
cleanup(previousElements);
};
function cleanup(elements2) {
- elements2.forEach((element3) => {
- const scrollableElement = getScrollableElement(element3);
+ elements2.forEach((element) => {
+ const scrollableElement = getScrollableElement(element);
scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll);
});
}
@@ -35658,8 +35558,8 @@ function useSyntheticListeners(listeners, id3) {
}, {});
}, [listeners, id3]);
}
-function useWindowRect(element3) {
- return (0, import_react3.useMemo)(() => element3 ? getWindowClientRect(element3) : null, [element3]);
+function useWindowRect(element) {
+ return (0, import_react3.useMemo)(() => element ? getWindowClientRect(element) : null, [element]);
}
var defaultValue$2 = [];
function useRects(elements, measure) {
@@ -35677,7 +35577,7 @@ function useRects(elements, measure) {
}
useIsomorphicLayoutEffect(() => {
if (elements.length) {
- elements.forEach((element3) => resizeObserver == null ? void 0 : resizeObserver.observe(element3));
+ elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
} else {
resizeObserver == null ? void 0 : resizeObserver.disconnect();
measureRects();
@@ -35688,18 +35588,18 @@ function useRects(elements, measure) {
if (!elements.length) {
return defaultValue$2;
}
- return elements.map((element3) => isDocumentScrollingElement(element3) ? windowRect : new Rect(measure(element3), element3));
+ return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
}
}
-function getMeasurableNode(node2) {
- if (!node2) {
+function getMeasurableNode(node) {
+ if (!node) {
return null;
}
- if (node2.children.length > 1) {
- return node2;
+ if (node.children.length > 1) {
+ return node;
}
- const firstChild = node2.children[0];
- return isHTMLElement(firstChild) ? firstChild : node2;
+ const firstChild = node.children[0];
+ return isHTMLElement(firstChild) ? firstChild : node;
}
function useDragOverlayMeasuring(_ref) {
let {
@@ -35726,13 +35626,13 @@ function useDragOverlayMeasuring(_ref) {
const resizeObserver = useResizeObserver({
callback: handleResize
});
- const handleNodeChange = (0, import_react3.useCallback)((element3) => {
- const node2 = getMeasurableNode(element3);
+ const handleNodeChange = (0, import_react3.useCallback)((element) => {
+ const node = getMeasurableNode(element);
resizeObserver == null ? void 0 : resizeObserver.disconnect();
- if (node2) {
- resizeObserver == null ? void 0 : resizeObserver.observe(node2);
+ if (node) {
+ resizeObserver == null ? void 0 : resizeObserver.observe(node);
}
- setRect(node2 ? measure(node2) : null);
+ setRect(node ? measure(node) : null);
}, [measure, resizeObserver]);
const [nodeRef, setRef] = useNodeRef(handleNodeChange);
return (0, import_react3.useMemo)(() => ({
@@ -35888,13 +35788,13 @@ function reducer(state, action) {
};
case Action.RegisterDroppable: {
const {
- element: element3
+ element
} = action;
const {
id: id3
- } = element3;
+ } = element;
const containers = new DroppableContainersMap(state.droppable.containers);
- containers.set(id3, element3);
+ containers.set(id3, element);
return {
...state,
droppable: {
@@ -35906,16 +35806,16 @@ function reducer(state, action) {
case Action.SetDroppableDisabled: {
const {
id: id3,
- key: key3,
+ key: key2,
disabled
} = action;
- const element3 = state.droppable.containers.get(id3);
- if (!element3 || key3 !== element3.key) {
+ const element = state.droppable.containers.get(id3);
+ if (!element || key2 !== element.key) {
return state;
}
const containers = new DroppableContainersMap(state.droppable.containers);
containers.set(id3, {
- ...element3,
+ ...element,
disabled
});
return {
@@ -35929,10 +35829,10 @@ function reducer(state, action) {
case Action.UnregisterDroppable: {
const {
id: id3,
- key: key3
+ key: key2
} = action;
- const element3 = state.droppable.containers.get(id3);
- if (!element3 || key3 !== element3.key) {
+ const element = state.droppable.containers.get(id3);
+ if (!element || key2 !== element.key) {
return state;
}
const containers = new DroppableContainersMap(state.droppable.containers);
@@ -35978,17 +35878,17 @@ function RestoreFocus(_ref) {
}
const {
activatorNode,
- node: node2
+ node
} = draggableNode;
- if (!activatorNode.current && !node2.current) {
+ if (!activatorNode.current && !node.current) {
return;
}
requestAnimationFrame(() => {
- for (const element3 of [activatorNode.current, node2.current]) {
- if (!element3) {
+ for (const element of [activatorNode.current, node.current]) {
+ if (!element) {
continue;
}
- const focusableNode = findFirstFocusableNode(element3);
+ const focusableNode = findFirstFocusableNode(element);
if (focusableNode) {
focusableNode.focus();
break;
@@ -36054,11 +35954,11 @@ function useLayoutShiftScrollCompensation(_ref) {
if (initialized.current || !initialRect) {
return;
}
- const node2 = activeNode == null ? void 0 : activeNode.node.current;
- if (!node2 || node2.isConnected === false) {
+ const node = activeNode == null ? void 0 : activeNode.node.current;
+ if (!node || node.isConnected === false) {
return;
}
- const rect = measure(node2);
+ const rect = measure(node);
const rectDelta = getRectDelta(rect, initialRect);
if (!x2) {
rectDelta.x = 0;
@@ -36068,7 +35968,7 @@ function useLayoutShiftScrollCompensation(_ref) {
}
initialized.current = true;
if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
- const firstScrollableAncestor = getFirstScrollableAncestor(node2);
+ const firstScrollableAncestor = getFirstScrollableAncestor(node);
if (firstScrollableAncestor) {
firstScrollableAncestor.scrollBy({
top: rectDelta.y,
@@ -36117,7 +36017,7 @@ var DndContext = /* @__PURE__ */ (0, import_react3.memo)(function DndContext2(_r
containers: droppableContainers
}
} = state;
- const node2 = activeId ? draggableNodes.get(activeId) : null;
+ const node = activeId ? draggableNodes.get(activeId) : null;
const activeRects = (0, import_react3.useRef)({
initial: null,
translated: null
@@ -36126,10 +36026,10 @@ var DndContext = /* @__PURE__ */ (0, import_react3.memo)(function DndContext2(_r
var _node$data;
return activeId != null ? {
id: activeId,
- data: (_node$data = node2 == null ? void 0 : node2.data) != null ? _node$data : defaultData,
+ data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,
rect: activeRects
} : null;
- }, [activeId, node2]);
+ }, [activeId, node]);
const activeRef = (0, import_react3.useRef)(null);
const [activeSensor, setActiveSensor] = (0, import_react3.useState)(null);
const [activatorEvent, setActivatorEvent] = (0, import_react3.useState)(null);
@@ -36542,11 +36442,11 @@ var ID_PREFIX = "Droppable";
function useDraggable(_ref) {
let {
id: id3,
- data: data3,
+ data: data2,
disabled = false,
attributes
} = _ref;
- const key3 = useUniqueId(ID_PREFIX);
+ const key2 = useUniqueId(ID_PREFIX);
const {
activators,
activatorEvent,
@@ -36563,22 +36463,22 @@ function useDraggable(_ref) {
} = attributes != null ? attributes : {};
const isDragging = (active == null ? void 0 : active.id) === id3;
const transform = (0, import_react3.useContext)(isDragging ? ActiveDraggableContext : NullContext);
- const [node2, setNodeRef] = useNodeRef();
+ const [node, setNodeRef] = useNodeRef();
const [activatorNode, setActivatorNodeRef] = useNodeRef();
const listeners = useSyntheticListeners(activators, id3);
- const dataRef = useLatestValue(data3);
+ const dataRef = useLatestValue(data2);
useIsomorphicLayoutEffect(
() => {
draggableNodes.set(id3, {
id: id3,
- key: key3,
- node: node2,
+ key: key2,
+ node,
activatorNode,
data: dataRef
});
return () => {
- const node3 = draggableNodes.get(id3);
- if (node3 && node3.key === key3) {
+ const node2 = draggableNodes.get(id3);
+ if (node2 && node2.key === key2) {
draggableNodes.delete(id3);
}
};
@@ -36600,7 +36500,7 @@ function useDraggable(_ref) {
attributes: memoizedAttributes,
isDragging,
listeners: disabled ? void 0 : listeners,
- node: node2,
+ node,
over,
setNodeRef,
setActivatorNodeRef,
@@ -36616,19 +36516,19 @@ var defaultResizeObserverConfig = {
};
function useDroppable(_ref) {
let {
- data: data3,
+ data: data2,
disabled = false,
id: id3,
resizeObserverConfig
} = _ref;
- const key3 = useUniqueId(ID_PREFIX$1);
+ const key2 = useUniqueId(ID_PREFIX$1);
const {
active,
dispatch,
over,
measureDroppableContainers
} = (0, import_react3.useContext)(InternalContext);
- const previous2 = (0, import_react3.useRef)({
+ const previous = (0, import_react3.useRef)({
disabled
});
const resizeObserverConnected = (0, import_react3.useRef)(false);
@@ -36676,7 +36576,7 @@ function useDroppable(_ref) {
}
}, [resizeObserver]);
const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
- const dataRef = useLatestValue(data3);
+ const dataRef = useLatestValue(data2);
(0, import_react3.useEffect)(() => {
if (!resizeObserver || !nodeRef.current) {
return;
@@ -36691,7 +36591,7 @@ function useDroppable(_ref) {
type: Action.RegisterDroppable,
element: {
id: id3,
- key: key3,
+ key: key2,
disabled,
node: nodeRef,
rect,
@@ -36700,23 +36600,23 @@ function useDroppable(_ref) {
});
return () => dispatch({
type: Action.UnregisterDroppable,
- key: key3,
+ key: key2,
id: id3
});
},
[id3]
);
(0, import_react3.useEffect)(() => {
- if (disabled !== previous2.current.disabled) {
+ if (disabled !== previous.current.disabled) {
dispatch({
type: Action.SetDroppableDisabled,
id: id3,
- key: key3,
+ key: key2,
disabled
});
- previous2.current.disabled = disabled;
+ previous.current.disabled = disabled;
}
- }, [id3, key3, disabled, dispatch]);
+ }, [id3, key2, disabled, dispatch]);
return {
active,
rect,
@@ -36732,25 +36632,25 @@ function AnimationManager(_ref) {
children
} = _ref;
const [clonedChildren, setClonedChildren] = (0, import_react3.useState)(null);
- const [element3, setElement] = (0, import_react3.useState)(null);
+ const [element, setElement] = (0, import_react3.useState)(null);
const previousChildren = usePrevious(children);
if (!children && !clonedChildren && previousChildren) {
setClonedChildren(previousChildren);
}
useIsomorphicLayoutEffect(() => {
- if (!element3) {
+ if (!element) {
return;
}
- const key3 = clonedChildren == null ? void 0 : clonedChildren.key;
+ const key2 = clonedChildren == null ? void 0 : clonedChildren.key;
const id3 = clonedChildren == null ? void 0 : clonedChildren.props.id;
- if (key3 == null || id3 == null) {
+ if (key2 == null || id3 == null) {
setClonedChildren(null);
return;
}
- Promise.resolve(animation(id3, element3)).then(() => {
+ Promise.resolve(animation(id3, element)).then(() => {
setClonedChildren(null);
});
- }, [animation, clonedChildren, element3]);
+ }, [animation, clonedChildren, element]);
return import_react3.default.createElement(import_react3.default.Fragment, null, children, clonedChildren ? (0, import_react3.cloneElement)(clonedChildren, {
ref: setElement
}) : null);
@@ -36827,20 +36727,20 @@ var defaultDropAnimationSideEffects = (options) => (_ref) => {
className
} = options;
if (styles2 != null && styles2.active) {
- for (const [key3, value] of Object.entries(styles2.active)) {
+ for (const [key2, value] of Object.entries(styles2.active)) {
if (value === void 0) {
continue;
}
- originalStyles[key3] = active.node.style.getPropertyValue(key3);
- active.node.style.setProperty(key3, value);
+ originalStyles[key2] = active.node.style.getPropertyValue(key2);
+ active.node.style.setProperty(key2, value);
}
}
if (styles2 != null && styles2.dragOverlay) {
- for (const [key3, value] of Object.entries(styles2.dragOverlay)) {
+ for (const [key2, value] of Object.entries(styles2.dragOverlay)) {
if (value === void 0) {
continue;
}
- dragOverlay.node.style.setProperty(key3, value);
+ dragOverlay.node.style.setProperty(key2, value);
}
}
if (className != null && className.active) {
@@ -36850,8 +36750,8 @@ var defaultDropAnimationSideEffects = (options) => (_ref) => {
dragOverlay.node.classList.add(className.dragOverlay);
}
return function cleanup() {
- for (const [key3, value] of Object.entries(originalStyles)) {
- active.node.style.setProperty(key3, value);
+ for (const [key2, value] of Object.entries(originalStyles)) {
+ active.node.style.setProperty(key2, value);
}
if (className != null && className.active) {
active.node.classList.remove(className.active);
@@ -36890,7 +36790,7 @@ function useDropAnimation(_ref3) {
droppableContainers,
measuringConfiguration
} = _ref3;
- return useEvent((id3, node2) => {
+ return useEvent((id3, node) => {
if (config4 === null) {
return;
}
@@ -36902,13 +36802,13 @@ function useDropAnimation(_ref3) {
if (!activeNode) {
return;
}
- const measurableNode = getMeasurableNode(node2);
+ const measurableNode = getMeasurableNode(node);
if (!measurableNode) {
return;
}
const {
transform
- } = getWindow(node2).getComputedStyle(node2);
+ } = getWindow(node).getComputedStyle(node);
const parsedTransform = parseTransform(transform);
if (!parsedTransform) {
return;
@@ -36924,7 +36824,7 @@ function useDropAnimation(_ref3) {
},
draggableNodes,
dragOverlay: {
- node: node2,
+ node,
rect: measuringConfiguration.dragOverlay.measure(measurableNode)
},
droppableContainers,
@@ -37035,7 +36935,7 @@ var DragOverlay = /* @__PURE__ */ import_react3.default.memo((_ref) => {
windowRect
} = useDndContext();
const transform = (0, import_react3.useContext)(ActiveDraggableContext);
- const key3 = useKey(active == null ? void 0 : active.id);
+ const key2 = useKey(active == null ? void 0 : active.id);
const modifiedTransform = applyModifiers(modifiers, {
activatorEvent,
active,
@@ -37059,8 +36959,8 @@ var DragOverlay = /* @__PURE__ */ import_react3.default.memo((_ref) => {
const ref2 = initialRect ? dragOverlay.setRef : void 0;
return import_react3.default.createElement(NullifiedContextProvider, null, import_react3.default.createElement(AnimationManager, {
animation: dropAnimation
- }, active && key3 ? import_react3.default.createElement(PositionedOverlay, {
- key: key3,
+ }, active && key2 ? import_react3.default.createElement(PositionedOverlay, {
+ key: key2,
id: active.id,
ref: ref2,
as: wrapperElement,
@@ -37084,16 +36984,16 @@ function arrayMove(array, from, to2) {
return newArray;
}
function getSortedRects(items, rects) {
- return items.reduce((accumulator, id3, index3) => {
+ return items.reduce((accumulator, id3, index2) => {
const rect = rects.get(id3);
if (rect) {
- accumulator[index3] = rect;
+ accumulator[index2] = rect;
}
return accumulator;
}, Array(items.length));
}
-function isValidIndex(index3) {
- return index3 !== null && index3 >= 0;
+function isValidIndex(index2) {
+ return index2 !== null && index2 >= 0;
}
function itemsEqual(a4, b2) {
if (a4 === b2) {
@@ -37123,11 +37023,11 @@ var rectSortingStrategy = (_ref) => {
rects,
activeIndex,
overIndex,
- index: index3
+ index: index2
} = _ref;
const newRects = arrayMove(rects, overIndex, activeIndex);
- const oldRect = rects[index3];
- const newRect = newRects[index3];
+ const oldRect = rects[index2];
+ const newRect = newRects[index2];
if (!newRect || !oldRect) {
return null;
}
@@ -37147,7 +37047,7 @@ var verticalListSortingStrategy = (_ref) => {
let {
activeIndex,
activeNodeRect: fallbackActiveRect,
- index: index3,
+ index: index2,
rects,
overIndex
} = _ref;
@@ -37155,7 +37055,7 @@ var verticalListSortingStrategy = (_ref) => {
if (!activeNodeRect) {
return null;
}
- if (index3 === activeIndex) {
+ if (index2 === activeIndex) {
const overIndexRect = rects[overIndex];
if (!overIndexRect) {
return null;
@@ -37166,15 +37066,15 @@ var verticalListSortingStrategy = (_ref) => {
...defaultScale$1
};
}
- const itemGap = getItemGap$1(rects, index3, activeIndex);
- if (index3 > activeIndex && index3 <= overIndex) {
+ const itemGap = getItemGap$1(rects, index2, activeIndex);
+ if (index2 > activeIndex && index2 <= overIndex) {
return {
x: 0,
y: -activeNodeRect.height - itemGap,
...defaultScale$1
};
}
- if (index3 < activeIndex && index3 >= overIndex) {
+ if (index2 < activeIndex && index2 >= overIndex) {
return {
x: 0,
y: activeNodeRect.height + itemGap,
@@ -37187,14 +37087,14 @@ var verticalListSortingStrategy = (_ref) => {
...defaultScale$1
};
};
-function getItemGap$1(clientRects, index3, activeIndex) {
- const currentRect = clientRects[index3];
- const previousRect = clientRects[index3 - 1];
- const nextRect = clientRects[index3 + 1];
+function getItemGap$1(clientRects, index2, activeIndex) {
+ const currentRect = clientRects[index2];
+ const previousRect = clientRects[index2 - 1];
+ const nextRect = clientRects[index2 + 1];
if (!currentRect) {
return 0;
}
- if (activeIndex < index3) {
+ if (activeIndex < index2) {
return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;
}
return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;
@@ -37279,7 +37179,7 @@ var defaultAnimateLayoutChanges = (_ref2) => {
containerId,
isSorting,
wasDragging,
- index: index3,
+ index: index2,
items,
newIndex,
previousItems,
@@ -37289,13 +37189,13 @@ var defaultAnimateLayoutChanges = (_ref2) => {
if (!transition || !wasDragging) {
return false;
}
- if (previousItems !== items && index3 === newIndex) {
+ if (previousItems !== items && index2 === newIndex) {
return false;
}
if (isSorting) {
return true;
}
- return newIndex !== index3 && containerId === previousContainerId;
+ return newIndex !== index2 && containerId === previousContainerId;
};
var defaultTransition2 = {
duration: 200,
@@ -37313,17 +37213,17 @@ var defaultAttributes = {
function useDerivedTransform(_ref) {
let {
disabled,
- index: index3,
- node: node2,
+ index: index2,
+ node,
rect
} = _ref;
const [derivedTransform, setDerivedtransform] = (0, import_react4.useState)(null);
- const previousIndex = (0, import_react4.useRef)(index3);
+ const previousIndex = (0, import_react4.useRef)(index2);
useIsomorphicLayoutEffect(() => {
- if (!disabled && index3 !== previousIndex.current && node2.current) {
+ if (!disabled && index2 !== previousIndex.current && node.current) {
const initial = rect.current;
if (initial) {
- const current3 = getClientRect(node2.current, {
+ const current3 = getClientRect(node.current, {
ignoreTransform: true
});
const delta = {
@@ -37337,10 +37237,10 @@ function useDerivedTransform(_ref) {
}
}
}
- if (index3 !== previousIndex.current) {
- previousIndex.current = index3;
+ if (index2 !== previousIndex.current) {
+ previousIndex.current = index2;
}
- }, [disabled, index3, node2, rect]);
+ }, [disabled, index2, node, rect]);
(0, import_react4.useEffect)(() => {
if (derivedTransform) {
setDerivedtransform(null);
@@ -37372,24 +37272,24 @@ function useSortable(_ref) {
strategy: globalStrategy
} = (0, import_react4.useContext)(Context);
const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
- const index3 = items.indexOf(id3);
- const data3 = (0, import_react4.useMemo)(() => ({
+ const index2 = items.indexOf(id3);
+ const data2 = (0, import_react4.useMemo)(() => ({
sortable: {
containerId,
- index: index3,
+ index: index2,
items
},
...customData
- }), [containerId, customData, index3, items]);
+ }), [containerId, customData, index2, items]);
const itemsAfterCurrentSortable = (0, import_react4.useMemo)(() => items.slice(items.indexOf(id3)), [items, id3]);
const {
rect,
- node: node2,
+ node,
isOver,
setNodeRef: setDroppableNodeRef
} = useDroppable({
id: id3,
- data: data3,
+ data: data2,
disabled: disabled.droppable,
resizeObserverConfig: {
updateMeasurementsFor: itemsAfterCurrentSortable,
@@ -37409,7 +37309,7 @@ function useSortable(_ref) {
transform
} = useDraggable({
id: id3,
- data: data3,
+ data: data2,
attributes: {
...defaultAttributes,
...userDefinedAttributes
@@ -37427,63 +37327,63 @@ function useSortable(_ref) {
activeNodeRect,
activeIndex,
overIndex,
- index: index3
+ index: index2
}) : null;
const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({
id: id3,
items,
activeIndex,
overIndex
- }) : index3;
+ }) : index2;
const activeId = active == null ? void 0 : active.id;
- const previous2 = (0, import_react4.useRef)({
+ const previous = (0, import_react4.useRef)({
activeId,
items,
newIndex,
containerId
});
- const itemsHaveChanged = items !== previous2.current.items;
+ const itemsHaveChanged = items !== previous.current.items;
const shouldAnimateLayoutChanges = animateLayoutChanges({
active,
containerId,
isDragging,
isSorting,
id: id3,
- index: index3,
+ index: index2,
items,
- newIndex: previous2.current.newIndex,
- previousItems: previous2.current.items,
- previousContainerId: previous2.current.containerId,
+ newIndex: previous.current.newIndex,
+ previousItems: previous.current.items,
+ previousContainerId: previous.current.containerId,
transition,
- wasDragging: previous2.current.activeId != null
+ wasDragging: previous.current.activeId != null
});
const derivedTransform = useDerivedTransform({
disabled: !shouldAnimateLayoutChanges,
- index: index3,
- node: node2,
+ index: index2,
+ node,
rect
});
(0, import_react4.useEffect)(() => {
- if (isSorting && previous2.current.newIndex !== newIndex) {
- previous2.current.newIndex = newIndex;
+ if (isSorting && previous.current.newIndex !== newIndex) {
+ previous.current.newIndex = newIndex;
}
- if (containerId !== previous2.current.containerId) {
- previous2.current.containerId = containerId;
+ if (containerId !== previous.current.containerId) {
+ previous.current.containerId = containerId;
}
- if (items !== previous2.current.items) {
- previous2.current.items = items;
+ if (items !== previous.current.items) {
+ previous.current.items = items;
}
}, [isSorting, newIndex, containerId, items]);
(0, import_react4.useEffect)(() => {
- if (activeId === previous2.current.activeId) {
+ if (activeId === previous.current.activeId) {
return;
}
- if (activeId && !previous2.current.activeId) {
- previous2.current.activeId = activeId;
+ if (activeId && !previous.current.activeId) {
+ previous.current.activeId = activeId;
return;
}
const timeoutId = setTimeout(() => {
- previous2.current.activeId = activeId;
+ previous.current.activeId = activeId;
}, 50);
return () => clearTimeout(timeoutId);
}, [activeId]);
@@ -37491,16 +37391,16 @@ function useSortable(_ref) {
active,
activeIndex,
attributes,
- data: data3,
+ data: data2,
rect,
- index: index3,
+ index: index2,
newIndex,
items,
isOver,
isSorting,
isDragging,
listeners,
- node: node2,
+ node,
overIndex,
over,
setNodeRef,
@@ -37511,7 +37411,7 @@ function useSortable(_ref) {
transition: getTransition()
};
function getTransition() {
- if (derivedTransform || itemsHaveChanged && previous2.current.newIndex === index3) {
+ if (derivedTransform || itemsHaveChanged && previous.current.newIndex === index2) {
return disabledTransition;
}
if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {
@@ -37543,8 +37443,8 @@ function hasSortableData(entry) {
if (!entry) {
return false;
}
- const data3 = entry.data.current;
- if (data3 && "sortable" in data3 && typeof data3.sortable === "object" && "containerId" in data3.sortable && "items" in data3.sortable && "index" in data3.sortable) {
+ const data2 = entry.data.current;
+ if (data2 && "sortable" in data2 && typeof data2.sortable === "object" && "containerId" in data2.sortable && "items" in data2.sortable && "index" in data2.sortable) {
return true;
}
return false;
@@ -37616,7 +37516,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((element3, index3) => scrollableAncestors[index3] !== element3);
+ const hasDifferentScrollAncestors = newScrollAncestors.some((element, index2) => scrollableAncestors[index2] !== element);
const hasSameContainer = isSameContainer(activeDroppable, newDroppable);
const isAfterActive = isAfter2(activeDroppable, newDroppable);
const offset2 = hasDifferentScrollAncestors || !hasSameContainer ? {
@@ -37796,15 +37696,15 @@ var showMenu = (props) => {
return;
hasBeenCalled = true;
setTimeout(() => {
- root4.unmount();
+ root.unmount();
document.body.removeChild(portalElement);
}, 50);
};
};
const hide = hideFunction();
- const root4 = props.ui.createRoot(portalElement);
+ const root = props.ui.createRoot(portalElement);
const updateRoot = (newProps) => {
- root4.render(
+ root.render(
/* @__PURE__ */ import_react5.default.createElement(MenuWrapper, {
rect: props.rect,
ui: props.ui,
@@ -37925,14 +37825,14 @@ var InputManager = class {
this.events[eventName] = listeners.filter((l2) => l2 !== listener);
}
}
- emit(eventName, data3) {
+ emit(eventName, data2) {
const listeners = this.events[eventName];
if (listeners) {
let propagate = false;
listeners.slice().reverse().forEach((listener) => {
if (propagate)
return;
- propagate = listener(data3);
+ propagate = listener(data2);
});
}
}
@@ -37978,12 +37878,12 @@ var UIManager2 = class {
availableViews() {
return this.mainFrame.availableViews();
}
- setActivePath(path3) {
- this.activePath = path3;
- this.eventsDispatch.dispatchEvent("activePathChanged", path3);
+ setActivePath(path2) {
+ this.activePath = path2;
+ this.eventsDispatch.dispatchEvent("activePathChanged", path2);
}
- setActiveSelection(path3, content5) {
- this.eventsDispatch.dispatchEvent("activeSelectionChanged", { path: path3, content: content5 });
+ setActiveSelection(path2, content3) {
+ this.eventsDispatch.dispatchEvent("activeSelectionChanged", { path: path2, content: content3 });
}
mainMenu(el, superstate) {
this.mainFrame.mainMenu(el, superstate);
@@ -37994,8 +37894,8 @@ var UIManager2 = class {
allViews() {
return [];
}
- viewsByPath(path3) {
- return this.mainFrame.viewsByPath(path3);
+ viewsByPath(path2) {
+ return this.mainFrame.viewsByPath(path2);
}
static create(adapter, adapters) {
return new UIManager2(adapter, adapters);
@@ -38009,12 +37909,12 @@ var UIManager2 = class {
openCustomMenu(rect, fc, props, defaultAnchor = "right") {
return showMenu({ rect, anchor: defaultAnchor, ui: this, fc, props });
}
- notify(content5, destination) {
+ notify(content3, destination) {
if (destination == "console") {
- console.log(content5);
+ console.log(content3);
return;
}
- this.mainFrame.openToast(content5);
+ this.mainFrame.openToast(content3);
}
error(error) {
console.log(error);
@@ -38025,11 +37925,11 @@ var UIManager2 = class {
openModal(title, modal, className, props) {
return this.mainFrame.openModal(title, modal, className, props);
}
- openPopover(position3, popover) {
- this.mainFrame.openPopover(position3, popover);
+ openPopover(position, popover) {
+ this.mainFrame.openPopover(position, popover);
}
- openPath(path3, newLeaf, source, props) {
- this.mainFrame.openPath(path3, newLeaf, source, props);
+ openPath(path2, newLeaf, source, props) {
+ this.mainFrame.openPath(path2, newLeaf, source, props);
}
primaryInteractionType() {
return this.mainFrame.primaryInteractionType();
@@ -38046,10 +37946,10 @@ var UIManager2 = class {
allStickers() {
return this.mainFrame.allStickers();
}
- getUIPath(path3, thumbnail) {
- if (!path3)
+ getUIPath(path2, thumbnail) {
+ if (!path2)
return null;
- return this.mainFrame.getUIPath(path3, thumbnail);
+ return this.mainFrame.getUIPath(path2, thumbnail);
}
dragStarted(e5, paths) {
this.mainFrame.dragStarted(e5, paths);
@@ -38089,67 +37989,67 @@ var keywords$1 = {
var keywordRelationalOperator = /^in(stanceof)?$/;
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
-function isInAstralSet(code3, set) {
+function isInAstralSet(code, set) {
var pos = 65536;
for (var i4 = 0; i4 < set.length; i4 += 2) {
pos += set[i4];
- if (pos > code3) {
+ if (pos > code) {
return false;
}
pos += set[i4 + 1];
- if (pos >= code3) {
+ if (pos >= code) {
return true;
}
}
return false;
}
-function isIdentifierStart(code3, astral) {
- if (code3 < 65) {
- return code3 === 36;
+function isIdentifierStart(code, astral) {
+ if (code < 65) {
+ return code === 36;
}
- if (code3 < 91) {
+ if (code < 91) {
return true;
}
- if (code3 < 97) {
- return code3 === 95;
+ if (code < 97) {
+ return code === 95;
}
- if (code3 < 123) {
+ if (code < 123) {
return true;
}
- if (code3 <= 65535) {
- return code3 >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code3));
+ if (code <= 65535) {
+ return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
- return isInAstralSet(code3, astralIdentifierStartCodes);
+ return isInAstralSet(code, astralIdentifierStartCodes);
}
-function isIdentifierChar(code3, astral) {
- if (code3 < 48) {
- return code3 === 36;
+function isIdentifierChar(code, astral) {
+ if (code < 48) {
+ return code === 36;
}
- if (code3 < 58) {
+ if (code < 58) {
return true;
}
- if (code3 < 65) {
+ if (code < 65) {
return false;
}
- if (code3 < 91) {
+ if (code < 91) {
return true;
}
- if (code3 < 97) {
- return code3 === 95;
+ if (code < 97) {
+ return code === 95;
}
- if (code3 < 123) {
+ if (code < 123) {
return true;
}
- if (code3 <= 65535) {
- return code3 >= 170 && nonASCIIidentifier.test(String.fromCharCode(code3));
+ if (code <= 65535) {
+ return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
- return isInAstralSet(code3, astralIdentifierStartCodes) || isInAstralSet(code3, astralIdentifierCodes);
+ return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
var TokenType = function TokenType2(label, conf) {
if (conf === void 0)
@@ -38258,16 +38158,16 @@ var types$1 = {
};
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
var lineBreakG = new RegExp(lineBreak.source, "g");
-function isNewLine(code3) {
- return code3 === 10 || code3 === 13 || code3 === 8232 || code3 === 8233;
+function isNewLine(code) {
+ return code === 10 || code === 13 || code === 8232 || code === 8233;
}
-function nextLineBreak(code3, from, end) {
+function nextLineBreak(code, from, end) {
if (end === void 0)
- end = code3.length;
+ end = code.length;
for (var i4 = from; i4 < end; i4++) {
- var next = code3.charCodeAt(i4);
+ var next = code.charCodeAt(i4);
if (isNewLine(next)) {
- return i4 < end - 1 && next === 13 && code3.charCodeAt(i4 + 1) === 10 ? i4 + 2 : i4 + 1;
+ return i4 < end - 1 && next === 13 && code.charCodeAt(i4 + 1) === 10 ? i4 + 2 : i4 + 1;
}
}
return -1;
@@ -38287,12 +38187,12 @@ var regexpCache = /* @__PURE__ */ Object.create(null);
function wordsRegexp(words) {
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
}
-function codePointToString(code3) {
- if (code3 <= 65535) {
- return String.fromCharCode(code3);
+function codePointToString(code) {
+ if (code <= 65535) {
+ return String.fromCharCode(code);
}
- code3 -= 65536;
- return String.fromCharCode((code3 >> 10) + 55296, (code3 & 1023) + 56320);
+ code -= 65536;
+ return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
}
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
var Position = function Position2(line, col) {
@@ -38302,11 +38202,11 @@ var Position = function Position2(line, col) {
Position.prototype.offset = function offset(n3) {
return new Position(this.line, this.column + n3);
};
-var SourceLocation = function SourceLocation2(p2, start, end) {
+var SourceLocation = function SourceLocation2(p, start, end) {
this.start = start;
this.end = end;
- if (p2.sourceFile !== null) {
- this.source = p2.sourceFile;
+ if (p.sourceFile !== null) {
+ this.source = p.sourceFile;
}
};
function getLineInfo(input, offset2) {
@@ -38375,20 +38275,20 @@ function getOptions(opts) {
return options;
}
function pushComment(options, array) {
- return function(block, text7, start, end, startLoc, endLoc) {
- var comment4 = {
+ return function(block, text2, start, end, startLoc, endLoc) {
+ var comment3 = {
type: block ? "Block" : "Line",
- value: text7,
+ value: text2,
start,
end
};
if (options.locations) {
- comment4.loc = new SourceLocation(this, startLoc, endLoc);
+ comment3.loc = new SourceLocation(this, startLoc, endLoc);
}
if (options.ranges) {
- comment4.range = [start, end];
+ comment3.range = [start, end];
}
- array.push(comment4);
+ array.push(comment3);
};
}
var SCOPE_TOP = 1;
@@ -38460,9 +38360,9 @@ var Parser = function Parser2(options, input, startPos) {
};
var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
Parser.prototype.parse = function parse() {
- var node2 = this.options.program || this.startNode();
+ var node = this.options.program || this.startNode();
this.nextToken();
- return this.parseTopLevel(node2);
+ return this.parseTopLevel(node);
};
prototypeAccessors.inFunction.get = function() {
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
@@ -38657,25 +38557,25 @@ pp$9.isSimpleAssignTarget = function(expr) {
return expr.type === "Identifier" || expr.type === "MemberExpression";
};
var pp$8 = Parser.prototype;
-pp$8.parseTopLevel = function(node2) {
+pp$8.parseTopLevel = function(node) {
var exports = /* @__PURE__ */ Object.create(null);
- if (!node2.body) {
- node2.body = [];
+ if (!node.body) {
+ node.body = [];
}
while (this.type !== types$1.eof) {
var stmt = this.parseStatement(null, true, exports);
- node2.body.push(stmt);
+ node.body.push(stmt);
}
if (this.inModule) {
- for (var i4 = 0, list4 = Object.keys(this.undefinedExports); i4 < list4.length; i4 += 1) {
- var name317 = list4[i4];
+ for (var i4 = 0, list = Object.keys(this.undefinedExports); i4 < list.length; i4 += 1) {
+ var name317 = list[i4];
this.raiseRecoverable(this.undefinedExports[name317].start, "Export '" + name317 + "' is not defined");
}
}
- this.adaptDirectivePrologue(node2.body);
+ this.adaptDirectivePrologue(node.body);
this.next();
- node2.sourceType = this.options.sourceType;
- return this.finishNode(node2, "Program");
+ node.sourceType = this.options.sourceType;
+ return this.finishNode(node, "Program");
};
var loopLabel = { kind: "loop" };
var switchLabel = { kind: "switch" };
@@ -38720,7 +38620,7 @@ pp$8.isAsyncFunction = function() {
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320));
};
pp$8.parseStatement = function(context, topLevel, exports) {
- var starttype = this.type, node2 = this.startNode(), kind;
+ var starttype = this.type, node = this.startNode(), kind;
if (this.isLet(context)) {
starttype = types$1._var;
kind = "let";
@@ -38728,48 +38628,48 @@ pp$8.parseStatement = function(context, topLevel, exports) {
switch (starttype) {
case types$1._break:
case types$1._continue:
- return this.parseBreakContinueStatement(node2, starttype.keyword);
+ return this.parseBreakContinueStatement(node, starttype.keyword);
case types$1._debugger:
- return this.parseDebuggerStatement(node2);
+ return this.parseDebuggerStatement(node);
case types$1._do:
- return this.parseDoStatement(node2);
+ return this.parseDoStatement(node);
case types$1._for:
- return this.parseForStatement(node2);
+ return this.parseForStatement(node);
case types$1._function:
if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) {
this.unexpected();
}
- return this.parseFunctionStatement(node2, false, !context);
+ return this.parseFunctionStatement(node, false, !context);
case types$1._class:
if (context) {
this.unexpected();
}
- return this.parseClass(node2, true);
+ return this.parseClass(node, true);
case types$1._if:
- return this.parseIfStatement(node2);
+ return this.parseIfStatement(node);
case types$1._return:
- return this.parseReturnStatement(node2);
+ return this.parseReturnStatement(node);
case types$1._switch:
- return this.parseSwitchStatement(node2);
+ return this.parseSwitchStatement(node);
case types$1._throw:
- return this.parseThrowStatement(node2);
+ return this.parseThrowStatement(node);
case types$1._try:
- return this.parseTryStatement(node2);
+ return this.parseTryStatement(node);
case types$1._const:
case types$1._var:
kind = kind || this.value;
if (context && kind !== "var") {
this.unexpected();
}
- return this.parseVarStatement(node2, kind);
+ return this.parseVarStatement(node, kind);
case types$1._while:
- return this.parseWhileStatement(node2);
+ return this.parseWhileStatement(node);
case types$1._with:
- return this.parseWithStatement(node2);
+ return this.parseWithStatement(node);
case types$1.braceL:
- return this.parseBlock(true, node2);
+ return this.parseBlock(true, node);
case types$1.semi:
- return this.parseEmptyStatement(node2);
+ return this.parseEmptyStatement(node);
case types$1._export:
case types$1._import:
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
@@ -38777,7 +38677,7 @@ pp$8.parseStatement = function(context, topLevel, exports) {
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
if (nextCh === 40 || nextCh === 46) {
- return this.parseExpressionStatement(node2, this.parseExpression());
+ return this.parseExpressionStatement(node, this.parseExpression());
}
}
if (!this.options.allowImportExportEverywhere) {
@@ -38788,71 +38688,71 @@ pp$8.parseStatement = function(context, topLevel, exports) {
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
}
- return starttype === types$1._import ? this.parseImport(node2) : this.parseExport(node2, exports);
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports);
default:
if (this.isAsyncFunction()) {
if (context) {
this.unexpected();
}
this.next();
- return this.parseFunctionStatement(node2, true, !context);
+ return this.parseFunctionStatement(node, true, !context);
}
var maybeName = this.value, expr = this.parseExpression();
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
- return this.parseLabeledStatement(node2, maybeName, expr, context);
+ return this.parseLabeledStatement(node, maybeName, expr, context);
} else {
- return this.parseExpressionStatement(node2, expr);
+ return this.parseExpressionStatement(node, expr);
}
}
};
-pp$8.parseBreakContinueStatement = function(node2, keyword3) {
+pp$8.parseBreakContinueStatement = function(node, keyword3) {
var isBreak = keyword3 === "break";
this.next();
if (this.eat(types$1.semi) || this.insertSemicolon()) {
- node2.label = null;
+ node.label = null;
} else if (this.type !== types$1.name) {
this.unexpected();
} else {
- node2.label = this.parseIdent();
+ node.label = this.parseIdent();
this.semicolon();
}
var i4 = 0;
for (; i4 < this.labels.length; ++i4) {
var lab = this.labels[i4];
- if (node2.label == null || lab.name === node2.label.name) {
+ if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) {
break;
}
- if (node2.label && isBreak) {
+ if (node.label && isBreak) {
break;
}
}
}
if (i4 === this.labels.length) {
- this.raise(node2.start, "Unsyntactic " + keyword3);
+ this.raise(node.start, "Unsyntactic " + keyword3);
}
- return this.finishNode(node2, isBreak ? "BreakStatement" : "ContinueStatement");
+ return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
-pp$8.parseDebuggerStatement = function(node2) {
+pp$8.parseDebuggerStatement = function(node) {
this.next();
this.semicolon();
- return this.finishNode(node2, "DebuggerStatement");
+ return this.finishNode(node, "DebuggerStatement");
};
-pp$8.parseDoStatement = function(node2) {
+pp$8.parseDoStatement = function(node) {
this.next();
this.labels.push(loopLabel);
- node2.body = this.parseStatement("do");
+ node.body = this.parseStatement("do");
this.labels.pop();
this.expect(types$1._while);
- node2.test = this.parseParenExpression();
+ node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6) {
this.eat(types$1.semi);
} else {
this.semicolon();
}
- return this.finishNode(node2, "DoWhileStatement");
+ return this.finishNode(node, "DoWhileStatement");
};
-pp$8.parseForStatement = function(node2) {
+pp$8.parseForStatement = function(node) {
this.next();
var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
this.labels.push(loopLabel);
@@ -38862,7 +38762,7 @@ pp$8.parseForStatement = function(node2) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
- return this.parseFor(node2, null);
+ return this.parseFor(node, null);
}
var isLet = this.isLet();
if (this.type === types$1._var || this.type === types$1._const || isLet) {
@@ -38877,15 +38777,15 @@ pp$8.parseForStatement = function(node2) {
this.unexpected(awaitAt);
}
} else {
- node2.await = awaitAt > -1;
+ node.await = awaitAt > -1;
}
}
- return this.parseForIn(node2, init$1);
+ return this.parseForIn(node, init$1);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
- return this.parseFor(node2, init$1);
+ return this.parseFor(node, init$1);
}
var startsWithLet = this.isContextual("let"), isForOf = false;
var refDestructuringErrors = new DestructuringErrors();
@@ -38897,7 +38797,7 @@ pp$8.parseForStatement = function(node2) {
this.unexpected(awaitAt);
}
} else {
- node2.await = awaitAt > -1;
+ node.await = awaitAt > -1;
}
}
if (startsWithLet && isForOf) {
@@ -38905,43 +38805,43 @@ pp$8.parseForStatement = function(node2) {
}
this.toAssignable(init, false, refDestructuringErrors);
this.checkLValPattern(init);
- return this.parseForIn(node2, init);
+ return this.parseForIn(node, init);
} else {
this.checkExpressionErrors(refDestructuringErrors, true);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
- return this.parseFor(node2, init);
+ return this.parseFor(node, init);
};
-pp$8.parseFunctionStatement = function(node2, isAsync, declarationPosition) {
+pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
this.next();
- return this.parseFunction(node2, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
+ return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
};
-pp$8.parseIfStatement = function(node2) {
+pp$8.parseIfStatement = function(node) {
this.next();
- node2.test = this.parseParenExpression();
- node2.consequent = this.parseStatement("if");
- node2.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
- return this.finishNode(node2, "IfStatement");
+ node.test = this.parseParenExpression();
+ node.consequent = this.parseStatement("if");
+ node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
+ return this.finishNode(node, "IfStatement");
};
-pp$8.parseReturnStatement = function(node2) {
+pp$8.parseReturnStatement = function(node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
this.raise(this.start, "'return' outside of function");
}
this.next();
if (this.eat(types$1.semi) || this.insertSemicolon()) {
- node2.argument = null;
+ node.argument = null;
} else {
- node2.argument = this.parseExpression();
+ node.argument = this.parseExpression();
this.semicolon();
}
- return this.finishNode(node2, "ReturnStatement");
+ return this.finishNode(node, "ReturnStatement");
};
-pp$8.parseSwitchStatement = function(node2) {
+pp$8.parseSwitchStatement = function(node) {
this.next();
- node2.discriminant = this.parseParenExpression();
- node2.cases = [];
+ node.discriminant = this.parseParenExpression();
+ node.cases = [];
this.expect(types$1.braceL);
this.labels.push(switchLabel);
this.enterScope(0);
@@ -38952,7 +38852,7 @@ pp$8.parseSwitchStatement = function(node2) {
if (cur) {
this.finishNode(cur, "SwitchCase");
}
- node2.cases.push(cur = this.startNode());
+ node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
@@ -38978,16 +38878,16 @@ pp$8.parseSwitchStatement = function(node2) {
}
this.next();
this.labels.pop();
- return this.finishNode(node2, "SwitchStatement");
+ return this.finishNode(node, "SwitchStatement");
};
-pp$8.parseThrowStatement = function(node2) {
+pp$8.parseThrowStatement = function(node) {
this.next();
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) {
this.raise(this.lastTokEnd, "Illegal newline after throw");
}
- node2.argument = this.parseExpression();
+ node.argument = this.parseExpression();
this.semicolon();
- return this.finishNode(node2, "ThrowStatement");
+ return this.finishNode(node, "ThrowStatement");
};
var empty$1 = [];
pp$8.parseCatchClauseParam = function() {
@@ -38998,10 +38898,10 @@ pp$8.parseCatchClauseParam = function() {
this.expect(types$1.parenR);
return param;
};
-pp$8.parseTryStatement = function(node2) {
+pp$8.parseTryStatement = function(node) {
this.next();
- node2.block = this.parseBlock();
- node2.handler = null;
+ node.block = this.parseBlock();
+ node.handler = null;
if (this.type === types$1._catch) {
var clause = this.startNode();
this.next();
@@ -39016,44 +38916,44 @@ pp$8.parseTryStatement = function(node2) {
}
clause.body = this.parseBlock(false);
this.exitScope();
- node2.handler = this.finishNode(clause, "CatchClause");
+ node.handler = this.finishNode(clause, "CatchClause");
}
- node2.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
- if (!node2.handler && !node2.finalizer) {
- this.raise(node2.start, "Missing catch or finally clause");
+ node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
+ if (!node.handler && !node.finalizer) {
+ this.raise(node.start, "Missing catch or finally clause");
}
- return this.finishNode(node2, "TryStatement");
+ return this.finishNode(node, "TryStatement");
};
-pp$8.parseVarStatement = function(node2, kind, allowMissingInitializer) {
+pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
this.next();
- this.parseVar(node2, false, kind, allowMissingInitializer);
+ this.parseVar(node, false, kind, allowMissingInitializer);
this.semicolon();
- return this.finishNode(node2, "VariableDeclaration");
+ return this.finishNode(node, "VariableDeclaration");
};
-pp$8.parseWhileStatement = function(node2) {
+pp$8.parseWhileStatement = function(node) {
this.next();
- node2.test = this.parseParenExpression();
+ node.test = this.parseParenExpression();
this.labels.push(loopLabel);
- node2.body = this.parseStatement("while");
+ node.body = this.parseStatement("while");
this.labels.pop();
- return this.finishNode(node2, "WhileStatement");
+ return this.finishNode(node, "WhileStatement");
};
-pp$8.parseWithStatement = function(node2) {
+pp$8.parseWithStatement = function(node) {
if (this.strict) {
this.raise(this.start, "'with' in strict mode");
}
this.next();
- node2.object = this.parseParenExpression();
- node2.body = this.parseStatement("with");
- return this.finishNode(node2, "WithStatement");
+ node.object = this.parseParenExpression();
+ node.body = this.parseStatement("with");
+ return this.finishNode(node, "WithStatement");
};
-pp$8.parseEmptyStatement = function(node2) {
+pp$8.parseEmptyStatement = function(node) {
this.next();
- return this.finishNode(node2, "EmptyStatement");
+ return this.finishNode(node, "EmptyStatement");
};
-pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) {
- for (var i$1 = 0, list4 = this.labels; i$1 < list4.length; i$1 += 1) {
- var label = list4[i$1];
+pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
+ for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) {
+ var label = list[i$1];
if (label.name === maybeName) {
this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}
@@ -39061,7 +38961,7 @@ pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) {
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
for (var i4 = this.labels.length - 1; i4 >= 0; i4--) {
var label$1 = this.labels[i4];
- if (label$1.statementStart === node2.start) {
+ if (label$1.statementStart === node.start) {
label$1.statementStart = this.start;
label$1.kind = kind;
} else {
@@ -39069,29 +38969,29 @@ pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) {
}
}
this.labels.push({ name: maybeName, kind, statementStart: this.start });
- node2.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
+ node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
this.labels.pop();
- node2.label = expr;
- return this.finishNode(node2, "LabeledStatement");
+ node.label = expr;
+ return this.finishNode(node, "LabeledStatement");
};
-pp$8.parseExpressionStatement = function(node2, expr) {
- node2.expression = expr;
+pp$8.parseExpressionStatement = function(node, expr) {
+ node.expression = expr;
this.semicolon();
- return this.finishNode(node2, "ExpressionStatement");
+ return this.finishNode(node, "ExpressionStatement");
};
-pp$8.parseBlock = function(createNewLexicalScope, node2, exitStrict) {
+pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
if (createNewLexicalScope === void 0)
createNewLexicalScope = true;
- if (node2 === void 0)
- node2 = this.startNode();
- node2.body = [];
+ if (node === void 0)
+ node = this.startNode();
+ node.body = [];
this.expect(types$1.braceL);
if (createNewLexicalScope) {
this.enterScope(0);
}
while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
- node2.body.push(stmt);
+ node.body.push(stmt);
}
if (exitStrict) {
this.strict = false;
@@ -39100,21 +39000,21 @@ pp$8.parseBlock = function(createNewLexicalScope, node2, exitStrict) {
if (createNewLexicalScope) {
this.exitScope();
}
- return this.finishNode(node2, "BlockStatement");
+ return this.finishNode(node, "BlockStatement");
};
-pp$8.parseFor = function(node2, init) {
- node2.init = init;
+pp$8.parseFor = function(node, init) {
+ node.init = init;
this.expect(types$1.semi);
- node2.test = this.type === types$1.semi ? null : this.parseExpression();
+ node.test = this.type === types$1.semi ? null : this.parseExpression();
this.expect(types$1.semi);
- node2.update = this.type === types$1.parenR ? null : this.parseExpression();
+ node.update = this.type === types$1.parenR ? null : this.parseExpression();
this.expect(types$1.parenR);
- node2.body = this.parseStatement("for");
+ node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
- return this.finishNode(node2, "ForStatement");
+ return this.finishNode(node, "ForStatement");
};
-pp$8.parseForIn = function(node2, init) {
+pp$8.parseForIn = function(node, init) {
var isForIn = this.type === types$1._in;
this.next();
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
@@ -39123,17 +39023,17 @@ pp$8.parseForIn = function(node2, init) {
(isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"
);
}
- node2.left = init;
- node2.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
+ node.left = init;
+ node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
this.expect(types$1.parenR);
- node2.body = this.parseStatement("for");
+ node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
- return this.finishNode(node2, isForIn ? "ForInStatement" : "ForOfStatement");
+ return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
};
-pp$8.parseVar = function(node2, isFor, kind, allowMissingInitializer) {
- node2.declarations = [];
- node2.kind = kind;
+pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
+ node.declarations = [];
+ node.kind = kind;
for (; ; ) {
var decl = this.startNode();
this.parseVarId(decl, kind);
@@ -39146,12 +39046,12 @@ pp$8.parseVar = function(node2, isFor, kind, allowMissingInitializer) {
} else {
decl.init = null;
}
- node2.declarations.push(this.finishNode(decl, "VariableDeclarator"));
+ node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(types$1.comma)) {
break;
}
}
- return node2;
+ return node;
};
pp$8.parseVarId = function(decl, kind) {
decl.id = this.parseBindingAtom();
@@ -39160,80 +39060,80 @@ pp$8.parseVarId = function(decl, kind) {
var FUNC_STATEMENT = 1;
var FUNC_HANGING_STATEMENT = 2;
var FUNC_NULLABLE_ID = 4;
-pp$8.parseFunction = function(node2, statement, allowExpressionBody, isAsync, forInit) {
- this.initFunction(node2);
+pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
+ this.initFunction(node);
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) {
this.unexpected();
}
- node2.generator = this.eat(types$1.star);
+ node.generator = this.eat(types$1.star);
}
if (this.options.ecmaVersion >= 8) {
- node2.async = !!isAsync;
+ node.async = !!isAsync;
}
if (statement & FUNC_STATEMENT) {
- node2.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent();
- if (node2.id && !(statement & FUNC_HANGING_STATEMENT)) {
- this.checkLValSimple(node2.id, this.strict || node2.generator || node2.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
+ node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent();
+ if (node.id && !(statement & FUNC_HANGING_STATEMENT)) {
+ this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
}
}
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
- this.enterScope(functionFlags(node2.async, node2.generator));
+ this.enterScope(functionFlags(node.async, node.generator));
if (!(statement & FUNC_STATEMENT)) {
- node2.id = this.type === types$1.name ? this.parseIdent() : null;
+ node.id = this.type === types$1.name ? this.parseIdent() : null;
}
- this.parseFunctionParams(node2);
- this.parseFunctionBody(node2, allowExpressionBody, false, forInit);
+ this.parseFunctionParams(node);
+ this.parseFunctionBody(node, allowExpressionBody, false, forInit);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
- return this.finishNode(node2, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
+ return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
};
-pp$8.parseFunctionParams = function(node2) {
+pp$8.parseFunctionParams = function(node) {
this.expect(types$1.parenL);
- node2.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
};
-pp$8.parseClass = function(node2, isStatement) {
+pp$8.parseClass = function(node, isStatement) {
this.next();
var oldStrict = this.strict;
this.strict = true;
- this.parseClassId(node2, isStatement);
- this.parseClassSuper(node2);
+ this.parseClassId(node, isStatement);
+ this.parseClassSuper(node);
var privateNameMap = this.enterClassBody();
var classBody = this.startNode();
var hadConstructor = false;
classBody.body = [];
this.expect(types$1.braceL);
while (this.type !== types$1.braceR) {
- var element3 = this.parseClassElement(node2.superClass !== null);
- if (element3) {
- classBody.body.push(element3);
- if (element3.type === "MethodDefinition" && element3.kind === "constructor") {
+ var element = this.parseClassElement(node.superClass !== null);
+ if (element) {
+ classBody.body.push(element);
+ if (element.type === "MethodDefinition" && element.kind === "constructor") {
if (hadConstructor) {
- this.raiseRecoverable(element3.start, "Duplicate constructor in the same class");
+ this.raiseRecoverable(element.start, "Duplicate constructor in the same class");
}
hadConstructor = true;
- } else if (element3.key && element3.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element3)) {
- this.raiseRecoverable(element3.key.start, "Identifier '#" + element3.key.name + "' has already been declared");
+ } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
+ this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared");
}
}
}
this.strict = oldStrict;
this.next();
- node2.body = this.finishNode(classBody, "ClassBody");
+ node.body = this.finishNode(classBody, "ClassBody");
this.exitClassBody();
- return this.finishNode(node2, isStatement ? "ClassDeclaration" : "ClassExpression");
+ return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp$8.parseClassElement = function(constructorAllowsSuper) {
if (this.eat(types$1.semi)) {
return null;
}
var ecmaVersion = this.options.ecmaVersion;
- var node2 = this.startNode();
+ var node = this.startNode();
var keyName = "";
var isGenerator = false;
var isAsync = false;
@@ -39241,8 +39141,8 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
var isStatic = false;
if (this.eatContextual("static")) {
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
- this.parseClassStaticBlock(node2);
- return node2;
+ this.parseClassStaticBlock(node);
+ return node;
}
if (this.isClassElementNameStart() || this.type === types$1.star) {
isStatic = true;
@@ -39250,7 +39150,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
keyName = "static";
}
}
- node2.static = isStatic;
+ node.static = isStatic;
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
isAsync = true;
@@ -39272,51 +39172,51 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
}
}
if (keyName) {
- node2.computed = false;
- node2.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
- node2.key.name = keyName;
- this.finishNode(node2.key, "Identifier");
+ node.computed = false;
+ node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
+ node.key.name = keyName;
+ this.finishNode(node.key, "Identifier");
} else {
- this.parseClassElementName(node2);
+ this.parseClassElementName(node);
}
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
- var isConstructor = !node2.static && checkKeyName(node2, "constructor");
+ var isConstructor = !node.static && checkKeyName(node, "constructor");
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
if (isConstructor && kind !== "method") {
- this.raise(node2.key.start, "Constructor can't have get/set modifier");
+ this.raise(node.key.start, "Constructor can't have get/set modifier");
}
- node2.kind = isConstructor ? "constructor" : kind;
- this.parseClassMethod(node2, isGenerator, isAsync, allowsDirectSuper);
+ node.kind = isConstructor ? "constructor" : kind;
+ this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
} else {
- this.parseClassField(node2);
+ this.parseClassField(node);
}
- return node2;
+ return node;
};
pp$8.isClassElementNameStart = function() {
return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword;
};
-pp$8.parseClassElementName = function(element3) {
+pp$8.parseClassElementName = function(element) {
if (this.type === types$1.privateId) {
if (this.value === "constructor") {
this.raise(this.start, "Classes can't have an element named '#constructor'");
}
- element3.computed = false;
- element3.key = this.parsePrivateIdent();
+ element.computed = false;
+ element.key = this.parsePrivateIdent();
} else {
- this.parsePropertyName(element3);
+ this.parsePropertyName(element);
}
};
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
- var key3 = method.key;
+ var key2 = method.key;
if (method.kind === "constructor") {
if (isGenerator) {
- this.raise(key3.start, "Constructor can't be a generator");
+ this.raise(key2.start, "Constructor can't be a generator");
}
if (isAsync) {
- this.raise(key3.start, "Constructor can't be an async method");
+ this.raise(key2.start, "Constructor can't be an async method");
}
} else if (method.static && checkKeyName(method, "prototype")) {
- this.raise(key3.start, "Classes may not have a static property named prototype");
+ this.raise(key2.start, "Classes may not have a static property named prototype");
}
var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
if (method.kind === "get" && value.params.length !== 0) {
@@ -39348,40 +39248,40 @@ pp$8.parseClassField = function(field) {
this.semicolon();
return this.finishNode(field, "PropertyDefinition");
};
-pp$8.parseClassStaticBlock = function(node2) {
- node2.body = [];
+pp$8.parseClassStaticBlock = function(node) {
+ node.body = [];
var oldLabels = this.labels;
this.labels = [];
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
- node2.body.push(stmt);
+ node.body.push(stmt);
}
this.next();
this.exitScope();
this.labels = oldLabels;
- return this.finishNode(node2, "StaticBlock");
+ return this.finishNode(node, "StaticBlock");
};
-pp$8.parseClassId = function(node2, isStatement) {
+pp$8.parseClassId = function(node, isStatement) {
if (this.type === types$1.name) {
- node2.id = this.parseIdent();
+ node.id = this.parseIdent();
if (isStatement) {
- this.checkLValSimple(node2.id, BIND_LEXICAL, false);
+ this.checkLValSimple(node.id, BIND_LEXICAL, false);
}
} else {
if (isStatement === true) {
this.unexpected();
}
- node2.id = null;
+ node.id = null;
}
};
-pp$8.parseClassSuper = function(node2) {
- node2.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
+pp$8.parseClassSuper = function(node) {
+ node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
};
pp$8.enterClassBody = function() {
- var element3 = { declared: /* @__PURE__ */ Object.create(null), used: [] };
- this.privateNameStack.push(element3);
- return element3.declared;
+ var element = { declared: /* @__PURE__ */ Object.create(null), used: [] };
+ this.privateNameStack.push(element);
+ return element.declared;
};
pp$8.exitClassBody = function() {
var ref2 = this.privateNameStack.pop();
@@ -39403,12 +39303,12 @@ pp$8.exitClassBody = function() {
}
}
};
-function isPrivateNameConflicted(privateNameMap, element3) {
- var name317 = element3.key.name;
+function isPrivateNameConflicted(privateNameMap, element) {
+ var name317 = element.key.name;
var curr = privateNameMap[name317];
var next = "true";
- if (element3.type === "MethodDefinition" && (element3.kind === "get" || element3.kind === "set")) {
- next = (element3.static ? "s" : "i") + element3.kind;
+ if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
+ next = (element.static ? "s" : "i") + element.kind;
}
if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") {
privateNameMap[name317] = "true";
@@ -39420,71 +39320,71 @@ function isPrivateNameConflicted(privateNameMap, element3) {
return true;
}
}
-function checkKeyName(node2, name317) {
- var computed = node2.computed;
- var key3 = node2.key;
- return !computed && (key3.type === "Identifier" && key3.name === name317 || key3.type === "Literal" && key3.value === name317);
+function checkKeyName(node, name317) {
+ var computed = node.computed;
+ var key2 = node.key;
+ return !computed && (key2.type === "Identifier" && key2.name === name317 || key2.type === "Literal" && key2.value === name317);
}
-pp$8.parseExportAllDeclaration = function(node2, exports) {
+pp$8.parseExportAllDeclaration = function(node, exports) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
- node2.exported = this.parseModuleExportName();
- this.checkExport(exports, node2.exported, this.lastTokStart);
+ node.exported = this.parseModuleExportName();
+ this.checkExport(exports, node.exported, this.lastTokStart);
} else {
- node2.exported = null;
+ node.exported = null;
}
}
this.expectContextual("from");
if (this.type !== types$1.string) {
this.unexpected();
}
- node2.source = this.parseExprAtom();
+ node.source = this.parseExprAtom();
this.semicolon();
- return this.finishNode(node2, "ExportAllDeclaration");
+ return this.finishNode(node, "ExportAllDeclaration");
};
-pp$8.parseExport = function(node2, exports) {
+pp$8.parseExport = function(node, exports) {
this.next();
if (this.eat(types$1.star)) {
- return this.parseExportAllDeclaration(node2, exports);
+ return this.parseExportAllDeclaration(node, exports);
}
if (this.eat(types$1._default)) {
this.checkExport(exports, "default", this.lastTokStart);
- node2.declaration = this.parseExportDefaultDeclaration();
- return this.finishNode(node2, "ExportDefaultDeclaration");
+ node.declaration = this.parseExportDefaultDeclaration();
+ return this.finishNode(node, "ExportDefaultDeclaration");
}
if (this.shouldParseExportStatement()) {
- node2.declaration = this.parseExportDeclaration(node2);
- if (node2.declaration.type === "VariableDeclaration") {
- this.checkVariableExport(exports, node2.declaration.declarations);
+ node.declaration = this.parseExportDeclaration(node);
+ if (node.declaration.type === "VariableDeclaration") {
+ this.checkVariableExport(exports, node.declaration.declarations);
} else {
- this.checkExport(exports, node2.declaration.id, node2.declaration.id.start);
+ this.checkExport(exports, node.declaration.id, node.declaration.id.start);
}
- node2.specifiers = [];
- node2.source = null;
+ node.specifiers = [];
+ node.source = null;
} else {
- node2.declaration = null;
- node2.specifiers = this.parseExportSpecifiers(exports);
+ node.declaration = null;
+ node.specifiers = this.parseExportSpecifiers(exports);
if (this.eatContextual("from")) {
if (this.type !== types$1.string) {
this.unexpected();
}
- node2.source = this.parseExprAtom();
+ node.source = this.parseExprAtom();
} else {
- for (var i4 = 0, list4 = node2.specifiers; i4 < list4.length; i4 += 1) {
- var spec = list4[i4];
+ for (var i4 = 0, list = node.specifiers; i4 < list.length; i4 += 1) {
+ var spec = list[i4];
this.checkUnreserved(spec.local);
this.checkLocalExport(spec.local);
if (spec.local.type === "Literal") {
this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
}
}
- node2.source = null;
+ node.source = null;
}
this.semicolon();
}
- return this.finishNode(node2, "ExportNamedDeclaration");
+ return this.finishNode(node, "ExportNamedDeclaration");
};
-pp$8.parseExportDeclaration = function(node2) {
+pp$8.parseExportDeclaration = function(node) {
return this.parseStatement(null);
};
pp$8.parseExportDefaultDeclaration = function() {
@@ -39522,8 +39422,8 @@ pp$8.checkPatternExport = function(exports, pat) {
if (type === "Identifier") {
this.checkExport(exports, pat, pat.start);
} else if (type === "ObjectPattern") {
- for (var i4 = 0, list4 = pat.properties; i4 < list4.length; i4 += 1) {
- var prop2 = list4[i4];
+ for (var i4 = 0, list = pat.properties; i4 < list.length; i4 += 1) {
+ var prop2 = list[i4];
this.checkPatternExport(exports, prop2);
}
} else if (type === "ArrayPattern") {
@@ -39545,8 +39445,8 @@ pp$8.checkVariableExport = function(exports, decls) {
if (!exports) {
return;
}
- for (var i4 = 0, list4 = decls; i4 < list4.length; i4 += 1) {
- var decl = list4[i4];
+ for (var i4 = 0, list = decls; i4 < list.length; i4 += 1) {
+ var decl = list[i4];
this.checkPatternExport(exports, decl.id);
}
};
@@ -39554,15 +39454,15 @@ pp$8.shouldParseExportStatement = function() {
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
};
pp$8.parseExportSpecifier = function(exports) {
- var node2 = this.startNode();
- node2.local = this.parseModuleExportName();
- node2.exported = this.eatContextual("as") ? this.parseModuleExportName() : node2.local;
+ var node = this.startNode();
+ node.local = this.parseModuleExportName();
+ node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
this.checkExport(
exports,
- node2.exported,
- node2.exported.start
+ node.exported,
+ node.exported.start
);
- return this.finishNode(node2, "ExportSpecifier");
+ return this.finishNode(node, "ExportSpecifier");
};
pp$8.parseExportSpecifiers = function(exports) {
var nodes = [], first = true;
@@ -39580,44 +39480,44 @@ pp$8.parseExportSpecifiers = function(exports) {
}
return nodes;
};
-pp$8.parseImport = function(node2) {
+pp$8.parseImport = function(node) {
this.next();
if (this.type === types$1.string) {
- node2.specifiers = empty$1;
- node2.source = this.parseExprAtom();
+ node.specifiers = empty$1;
+ node.source = this.parseExprAtom();
} else {
- node2.specifiers = this.parseImportSpecifiers();
+ node.specifiers = this.parseImportSpecifiers();
this.expectContextual("from");
- node2.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
+ node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
- return this.finishNode(node2, "ImportDeclaration");
+ return this.finishNode(node, "ImportDeclaration");
};
pp$8.parseImportSpecifier = function() {
- var node2 = this.startNode();
- node2.imported = this.parseModuleExportName();
+ var node = this.startNode();
+ node.imported = this.parseModuleExportName();
if (this.eatContextual("as")) {
- node2.local = this.parseIdent();
+ node.local = this.parseIdent();
} else {
- this.checkUnreserved(node2.imported);
- node2.local = node2.imported;
+ this.checkUnreserved(node.imported);
+ node.local = node.imported;
}
- this.checkLValSimple(node2.local, BIND_LEXICAL);
- return this.finishNode(node2, "ImportSpecifier");
+ this.checkLValSimple(node.local, BIND_LEXICAL);
+ return this.finishNode(node, "ImportSpecifier");
};
pp$8.parseImportDefaultSpecifier = function() {
- var node2 = this.startNode();
- node2.local = this.parseIdent();
- this.checkLValSimple(node2.local, BIND_LEXICAL);
- return this.finishNode(node2, "ImportDefaultSpecifier");
+ var node = this.startNode();
+ node.local = this.parseIdent();
+ this.checkLValSimple(node.local, BIND_LEXICAL);
+ return this.finishNode(node, "ImportDefaultSpecifier");
};
pp$8.parseImportNamespaceSpecifier = function() {
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
this.expectContextual("as");
- node2.local = this.parseIdent();
- this.checkLValSimple(node2.local, BIND_LEXICAL);
- return this.finishNode(node2, "ImportNamespaceSpecifier");
+ node.local = this.parseIdent();
+ this.checkLValSimple(node.local, BIND_LEXICAL);
+ return this.finishNode(node, "ImportNamespaceSpecifier");
};
pp$8.parseImportSpecifiers = function() {
var nodes = [], first = true;
@@ -39664,12 +39564,12 @@ pp$8.isDirectiveCandidate = function(statement) {
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === '"' || this.input[statement.start] === "'");
};
var pp$7 = Parser.prototype;
-pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) {
- if (this.options.ecmaVersion >= 6 && node2) {
- switch (node2.type) {
+pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
+ if (this.options.ecmaVersion >= 6 && node) {
+ switch (node.type) {
case "Identifier":
- if (this.inAsync && node2.name === "await") {
- this.raise(node2.start, "Cannot use 'await' as identifier inside an async function");
+ if (this.inAsync && node.name === "await") {
+ this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
}
break;
case "ObjectPattern":
@@ -39678,12 +39578,12 @@ pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) {
case "RestElement":
break;
case "ObjectExpression":
- node2.type = "ObjectPattern";
+ node.type = "ObjectPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
- for (var i4 = 0, list4 = node2.properties; i4 < list4.length; i4 += 1) {
- var prop2 = list4[i4];
+ for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) {
+ var prop2 = list[i4];
this.toAssignable(prop2, isBinding);
if (prop2.type === "RestElement" && (prop2.argument.type === "ArrayPattern" || prop2.argument.type === "ObjectPattern")) {
this.raise(prop2.argument.start, "Unexpected token");
@@ -39691,50 +39591,50 @@ pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) {
}
break;
case "Property":
- if (node2.kind !== "init") {
- this.raise(node2.key.start, "Object pattern can't contain getter or setter");
+ if (node.kind !== "init") {
+ this.raise(node.key.start, "Object pattern can't contain getter or setter");
}
- this.toAssignable(node2.value, isBinding);
+ this.toAssignable(node.value, isBinding);
break;
case "ArrayExpression":
- node2.type = "ArrayPattern";
+ node.type = "ArrayPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
- this.toAssignableList(node2.elements, isBinding);
+ this.toAssignableList(node.elements, isBinding);
break;
case "SpreadElement":
- node2.type = "RestElement";
- this.toAssignable(node2.argument, isBinding);
- if (node2.argument.type === "AssignmentPattern") {
- this.raise(node2.argument.start, "Rest elements cannot have a default value");
+ node.type = "RestElement";
+ this.toAssignable(node.argument, isBinding);
+ if (node.argument.type === "AssignmentPattern") {
+ this.raise(node.argument.start, "Rest elements cannot have a default value");
}
break;
case "AssignmentExpression":
- if (node2.operator !== "=") {
- this.raise(node2.left.end, "Only '=' operator can be used for specifying default value.");
+ if (node.operator !== "=") {
+ this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
- node2.type = "AssignmentPattern";
- delete node2.operator;
- this.toAssignable(node2.left, isBinding);
+ node.type = "AssignmentPattern";
+ delete node.operator;
+ this.toAssignable(node.left, isBinding);
break;
case "ParenthesizedExpression":
- this.toAssignable(node2.expression, isBinding, refDestructuringErrors);
+ this.toAssignable(node.expression, isBinding, refDestructuringErrors);
break;
case "ChainExpression":
- this.raiseRecoverable(node2.start, "Optional chaining cannot appear in left-hand side");
+ this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
if (!isBinding) {
break;
}
default:
- this.raise(node2.start, "Assigning to rvalue");
+ this.raise(node.start, "Assigning to rvalue");
}
} else if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
- return node2;
+ return node;
};
pp$7.toAssignableList = function(exprList, isBinding) {
var end = exprList.length;
@@ -39753,28 +39653,28 @@ pp$7.toAssignableList = function(exprList, isBinding) {
return exprList;
};
pp$7.parseSpread = function(refDestructuringErrors) {
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
- node2.argument = this.parseMaybeAssign(false, refDestructuringErrors);
- return this.finishNode(node2, "SpreadElement");
+ node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
+ return this.finishNode(node, "SpreadElement");
};
pp$7.parseRestBinding = function() {
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
if (this.options.ecmaVersion === 6 && this.type !== types$1.name) {
this.unexpected();
}
- node2.argument = this.parseBindingAtom();
- return this.finishNode(node2, "RestElement");
+ node.argument = this.parseBindingAtom();
+ return this.finishNode(node, "RestElement");
};
pp$7.parseBindingAtom = function() {
if (this.options.ecmaVersion >= 6) {
switch (this.type) {
case types$1.bracketL:
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
- node2.elements = this.parseBindingList(types$1.bracketR, true, true);
- return this.finishNode(node2, "ArrayPattern");
+ node.elements = this.parseBindingList(types$1.bracketR, true, true);
+ return this.finishNode(node, "ArrayPattern");
case types$1.braceL:
return this.parseObj(true);
}
@@ -39821,10 +39721,10 @@ pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) {
return left;
}
- var node2 = this.startNodeAt(startPos, startLoc);
- node2.left = left;
- node2.right = this.parseMaybeAssign();
- return this.finishNode(node2, "AssignmentPattern");
+ var node = this.startNodeAt(startPos, startLoc);
+ node.left = left;
+ node.right = this.parseMaybeAssign();
+ return this.finishNode(node, "AssignmentPattern");
};
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
if (bindingType === void 0)
@@ -39872,8 +39772,8 @@ pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
bindingType = BIND_NONE;
switch (expr.type) {
case "ObjectPattern":
- for (var i4 = 0, list4 = expr.properties; i4 < list4.length; i4 += 1) {
- var prop2 = list4[i4];
+ for (var i4 = 0, list = expr.properties; i4 < list.length; i4 += 1) {
+ var prop2 = list[i4];
this.checkLValInnerPattern(prop2, bindingType, checkClashes);
}
break;
@@ -39919,8 +39819,8 @@ var types = {
b_tmpl: new TokContext("${", false),
p_stat: new TokContext("(", false),
p_expr: new TokContext("(", true),
- q_tmpl: new TokContext("`", true, true, function(p2) {
- return p2.tryReadTemplateToken();
+ q_tmpl: new TokContext("`", true, true, function(p) {
+ return p.tryReadTemplateToken();
}),
f_stat: new TokContext("function", false),
f_expr: new TokContext("function", true),
@@ -40030,11 +39930,11 @@ types$1.backQuote.updateContext = function() {
};
types$1.star.updateContext = function(prevType) {
if (prevType === types$1._function) {
- var index3 = this.context.length - 1;
- if (this.context[index3] === types.f_expr) {
- this.context[index3] = types.f_expr_gen;
+ var index2 = this.context.length - 1;
+ if (this.context[index2] === types.f_expr) {
+ this.context[index2] = types.f_expr_gen;
} else {
- this.context[index3] = types.f_gen;
+ this.context[index2] = types.f_gen;
}
}
this.exprAllowed = true;
@@ -40056,14 +39956,14 @@ pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) {
if (this.options.ecmaVersion >= 6 && (prop2.computed || prop2.method || prop2.shorthand)) {
return;
}
- var key3 = prop2.key;
+ var key2 = prop2.key;
var name317;
- switch (key3.type) {
+ switch (key2.type) {
case "Identifier":
- name317 = key3.name;
+ name317 = key2.name;
break;
case "Literal":
- name317 = String(key3.value);
+ name317 = String(key2.value);
break;
default:
return;
@@ -40074,10 +39974,10 @@ pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) {
if (propHash.proto) {
if (refDestructuringErrors) {
if (refDestructuringErrors.doubleProto < 0) {
- refDestructuringErrors.doubleProto = key3.start;
+ refDestructuringErrors.doubleProto = key2.start;
}
} else {
- this.raiseRecoverable(key3.start, "Redefinition of __proto__ property");
+ this.raiseRecoverable(key2.start, "Redefinition of __proto__ property");
}
}
propHash.proto = true;
@@ -40094,7 +39994,7 @@ pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) {
redefinition = other.init || other[kind];
}
if (redefinition) {
- this.raiseRecoverable(key3.start, "Redefinition of property");
+ this.raiseRecoverable(key2.start, "Redefinition of property");
}
} else {
other = propHash[name317] = {
@@ -40109,12 +40009,12 @@ pp$5.parseExpression = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
if (this.type === types$1.comma) {
- var node2 = this.startNodeAt(startPos, startLoc);
- node2.expressions = [expr];
+ var node = this.startNodeAt(startPos, startLoc);
+ node.expressions = [expr];
while (this.eat(types$1.comma)) {
- node2.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
+ node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
}
- return this.finishNode(node2, "SequenceExpression");
+ return this.finishNode(node, "SequenceExpression");
}
return expr;
};
@@ -40146,8 +40046,8 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
left = afterLeftParse.call(this, left, startPos, startLoc);
}
if (this.type.isAssign) {
- var node2 = this.startNodeAt(startPos, startLoc);
- node2.operator = this.value;
+ var node = this.startNodeAt(startPos, startLoc);
+ node.operator = this.value;
if (this.type === types$1.eq) {
left = this.toAssignable(left, false, refDestructuringErrors);
}
@@ -40162,13 +40062,13 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
} else {
this.checkLValSimple(left);
}
- node2.left = left;
+ node.left = left;
this.next();
- node2.right = this.parseMaybeAssign(forInit);
+ node.right = this.parseMaybeAssign(forInit);
if (oldDoubleProto > -1) {
refDestructuringErrors.doubleProto = oldDoubleProto;
}
- return this.finishNode(node2, "AssignmentExpression");
+ return this.finishNode(node, "AssignmentExpression");
} else {
if (ownDestructuringErrors) {
this.checkExpressionErrors(refDestructuringErrors, true);
@@ -40189,12 +40089,12 @@ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
return expr;
}
if (this.eat(types$1.question)) {
- var node2 = this.startNodeAt(startPos, startLoc);
- node2.test = expr;
- node2.consequent = this.parseMaybeAssign();
+ var node = this.startNodeAt(startPos, startLoc);
+ node.test = expr;
+ node.consequent = this.parseMaybeAssign();
this.expect(types$1.colon);
- node2.alternate = this.parseMaybeAssign(forInit);
- return this.finishNode(node2, "ConditionalExpression");
+ node.alternate = this.parseMaybeAssign(forInit);
+ return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
@@ -40219,11 +40119,11 @@ pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
this.next();
var startPos = this.start, startLoc = this.startLoc;
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
- var node2 = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
+ var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) {
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
}
- return this.parseExprOp(node2, leftStartPos, leftStartLoc, minPrec, forInit);
+ return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit);
}
}
return left;
@@ -40232,11 +40132,11 @@ pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
if (right.type === "PrivateIdentifier") {
this.raise(right.start, "Private identifier can only be left side of binary expression");
}
- var node2 = this.startNodeAt(startPos, startLoc);
- node2.left = left;
- node2.operator = op;
- node2.right = right;
- return this.finishNode(node2, logical ? "LogicalExpression" : "BinaryExpression");
+ var node = this.startNodeAt(startPos, startLoc);
+ node.left = left;
+ node.operator = op;
+ node.right = right;
+ return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
};
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
var startPos = this.start, startLoc = this.startLoc, expr;
@@ -40244,22 +40144,22 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
expr = this.parseAwait(forInit);
sawUnary = true;
} else if (this.type.prefix) {
- var node2 = this.startNode(), update = this.type === types$1.incDec;
- node2.operator = this.value;
- node2.prefix = true;
+ var node = this.startNode(), update = this.type === types$1.incDec;
+ node.operator = this.value;
+ node.prefix = true;
this.next();
- node2.argument = this.parseMaybeUnary(null, true, update, forInit);
+ node.argument = this.parseMaybeUnary(null, true, update, forInit);
this.checkExpressionErrors(refDestructuringErrors, true);
if (update) {
- this.checkLValSimple(node2.argument);
- } else if (this.strict && node2.operator === "delete" && node2.argument.type === "Identifier") {
- this.raiseRecoverable(node2.start, "Deleting local variable in strict mode");
- } else if (node2.operator === "delete" && isPrivateFieldAccess(node2.argument)) {
- this.raiseRecoverable(node2.start, "Private fields can not be deleted");
+ this.checkLValSimple(node.argument);
+ } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") {
+ this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
+ } else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) {
+ this.raiseRecoverable(node.start, "Private fields can not be deleted");
} else {
sawUnary = true;
}
- expr = this.finishNode(node2, update ? "UpdateExpression" : "UnaryExpression");
+ expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (!sawUnary && this.type === types$1.privateId) {
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) {
this.unexpected();
@@ -40293,8 +40193,8 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
return expr;
}
};
-function isPrivateFieldAccess(node2) {
- return node2.type === "MemberExpression" && node2.property.type === "PrivateIdentifier" || node2.type === "ChainExpression" && isPrivateFieldAccess(node2.expression);
+function isPrivateFieldAccess(node) {
+ return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression);
}
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
var startPos = this.start, startLoc = this.startLoc;
@@ -40316,23 +40216,23 @@ pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
}
return result;
};
-pp$5.parseSubscripts = function(base3, startPos, startLoc, noCalls, forInit) {
- var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base3.type === "Identifier" && base3.name === "async" && this.lastTokEnd === base3.end && !this.canInsertSemicolon() && base3.end - base3.start === 5 && this.potentialArrowAt === base3.start;
+pp$5.parseSubscripts = function(base2, startPos, startLoc, noCalls, forInit) {
+ var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base2.type === "Identifier" && base2.name === "async" && this.lastTokEnd === base2.end && !this.canInsertSemicolon() && base2.end - base2.start === 5 && this.potentialArrowAt === base2.start;
var optionalChained = false;
while (true) {
- var element3 = this.parseSubscript(base3, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
- if (element3.optional) {
+ var element = this.parseSubscript(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
+ if (element.optional) {
optionalChained = true;
}
- if (element3 === base3 || element3.type === "ArrowFunctionExpression") {
+ if (element === base2 || element.type === "ArrowFunctionExpression") {
if (optionalChained) {
var chainNode = this.startNodeAt(startPos, startLoc);
- chainNode.expression = element3;
- element3 = this.finishNode(chainNode, "ChainExpression");
+ chainNode.expression = element;
+ element = this.finishNode(chainNode, "ChainExpression");
}
- return element3;
+ return element;
}
- base3 = element3;
+ base2 = element;
}
};
pp$5.shouldParseAsyncArrow = function() {
@@ -40341,7 +40241,7 @@ pp$5.shouldParseAsyncArrow = function() {
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit);
};
-pp$5.parseSubscript = function(base3, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
+pp$5.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
var optionalSupported = this.options.ecmaVersion >= 11;
var optional = optionalSupported && this.eat(types$1.questionDot);
if (noCalls && optional) {
@@ -40349,21 +40249,21 @@ pp$5.parseSubscript = function(base3, startPos, startLoc, noCalls, maybeAsyncArr
}
var computed = this.eat(types$1.bracketL);
if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) {
- var node2 = this.startNodeAt(startPos, startLoc);
- node2.object = base3;
+ var node = this.startNodeAt(startPos, startLoc);
+ node.object = base2;
if (computed) {
- node2.property = this.parseExpression();
+ node.property = this.parseExpression();
this.expect(types$1.bracketR);
- } else if (this.type === types$1.privateId && base3.type !== "Super") {
- node2.property = this.parsePrivateIdent();
+ } else if (this.type === types$1.privateId && base2.type !== "Super") {
+ node.property = this.parsePrivateIdent();
} else {
- node2.property = this.parseIdent(this.options.allowReserved !== "never");
+ node.property = this.parseIdent(this.options.allowReserved !== "never");
}
- node2.computed = !!computed;
+ node.computed = !!computed;
if (optionalSupported) {
- node2.optional = optional;
+ node.optional = optional;
}
- base3 = this.finishNode(node2, "MemberExpression");
+ base2 = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.eat(types$1.parenL)) {
var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
@@ -40386,46 +40286,46 @@ pp$5.parseSubscript = function(base3, startPos, startLoc, noCalls, maybeAsyncArr
this.awaitPos = oldAwaitPos || this.awaitPos;
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
var node$1 = this.startNodeAt(startPos, startLoc);
- node$1.callee = base3;
+ node$1.callee = base2;
node$1.arguments = exprList;
if (optionalSupported) {
node$1.optional = optional;
}
- base3 = this.finishNode(node$1, "CallExpression");
+ base2 = this.finishNode(node$1, "CallExpression");
} else if (this.type === types$1.backQuote) {
if (optional || optionalChained) {
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
}
var node$2 = this.startNodeAt(startPos, startLoc);
- node$2.tag = base3;
+ node$2.tag = base2;
node$2.quasi = this.parseTemplate({ isTagged: true });
- base3 = this.finishNode(node$2, "TaggedTemplateExpression");
+ base2 = this.finishNode(node$2, "TaggedTemplateExpression");
}
- return base3;
+ return base2;
};
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
if (this.type === types$1.slash) {
this.readRegexp();
}
- var node2, canBeArrow = this.potentialArrowAt === this.start;
+ var node, canBeArrow = this.potentialArrowAt === this.start;
switch (this.type) {
case types$1._super:
if (!this.allowSuper) {
this.raise(this.start, "'super' keyword outside a method");
}
- node2 = this.startNode();
+ node = this.startNode();
this.next();
if (this.type === types$1.parenL && !this.allowDirectSuper) {
- this.raise(node2.start, "super() call outside constructor of a subclass");
+ this.raise(node.start, "super() call outside constructor of a subclass");
}
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) {
this.unexpected();
}
- return this.finishNode(node2, "Super");
+ return this.finishNode(node, "Super");
case types$1._this:
- node2 = this.startNode();
+ node = this.startNode();
this.next();
- return this.finishNode(node2, "ThisExpression");
+ return this.finishNode(node, "ThisExpression");
case types$1.name:
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
var id3 = this.parseIdent(false);
@@ -40448,20 +40348,20 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
return id3;
case types$1.regexp:
var value = this.value;
- node2 = this.parseLiteral(value.value);
- node2.regex = { pattern: value.pattern, flags: value.flags };
- return node2;
+ node = this.parseLiteral(value.value);
+ node.regex = { pattern: value.pattern, flags: value.flags };
+ return node;
case types$1.num:
case types$1.string:
return this.parseLiteral(this.value);
case types$1._null:
case types$1._true:
case types$1._false:
- node2 = this.startNode();
- node2.value = this.type === types$1._null ? null : this.type === types$1._true;
- node2.raw = this.type.keyword;
+ node = this.startNode();
+ node.value = this.type === types$1._null ? null : this.type === types$1._true;
+ node.raw = this.type.keyword;
this.next();
- return this.finishNode(node2, "Literal");
+ return this.finishNode(node, "Literal");
case types$1.parenL:
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
if (refDestructuringErrors) {
@@ -40474,17 +40374,17 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
}
return expr;
case types$1.bracketL:
- node2 = this.startNode();
+ node = this.startNode();
this.next();
- node2.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
- return this.finishNode(node2, "ArrayExpression");
+ node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
+ return this.finishNode(node, "ArrayExpression");
case types$1.braceL:
this.overrideContext(types.b_expr);
return this.parseObj(false, refDestructuringErrors);
case types$1._function:
- node2 = this.startNode();
+ node = this.startNode();
this.next();
- return this.parseFunction(node2, 0);
+ return this.parseFunction(node, 0);
case types$1._class:
return this.parseClass(this.startNode(), false);
case types$1._new:
@@ -40505,25 +40405,25 @@ pp$5.parseExprAtomDefault = function() {
this.unexpected();
};
pp$5.parseExprImport = function(forNew) {
- var node2 = this.startNode();
+ var node = this.startNode();
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword import");
}
this.next();
if (this.type === types$1.parenL && !forNew) {
- return this.parseDynamicImport(node2);
+ return this.parseDynamicImport(node);
} else if (this.type === types$1.dot) {
- var meta3 = this.startNodeAt(node2.start, node2.loc && node2.loc.start);
+ var meta3 = this.startNodeAt(node.start, node.loc && node.loc.start);
meta3.name = "import";
- node2.meta = this.finishNode(meta3, "Identifier");
- return this.parseImportMeta(node2);
+ node.meta = this.finishNode(meta3, "Identifier");
+ return this.parseImportMeta(node);
} else {
this.unexpected();
}
};
-pp$5.parseDynamicImport = function(node2) {
+pp$5.parseDynamicImport = function(node) {
this.next();
- node2.source = this.parseMaybeAssign();
+ node.source = this.parseMaybeAssign();
if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
@@ -40532,32 +40432,32 @@ pp$5.parseDynamicImport = function(node2) {
this.unexpected(errorPos);
}
}
- return this.finishNode(node2, "ImportExpression");
+ return this.finishNode(node, "ImportExpression");
};
-pp$5.parseImportMeta = function(node2) {
+pp$5.parseImportMeta = function(node) {
this.next();
var containsEsc = this.containsEsc;
- node2.property = this.parseIdent(true);
- if (node2.property.name !== "meta") {
- this.raiseRecoverable(node2.property.start, "The only valid meta property for import is 'import.meta'");
+ node.property = this.parseIdent(true);
+ if (node.property.name !== "meta") {
+ this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
}
if (containsEsc) {
- this.raiseRecoverable(node2.start, "'import.meta' must not contain escaped characters");
+ this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
}
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) {
- this.raiseRecoverable(node2.start, "Cannot use 'import.meta' outside a module");
+ this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module");
}
- return this.finishNode(node2, "MetaProperty");
+ return this.finishNode(node, "MetaProperty");
};
pp$5.parseLiteral = function(value) {
- var node2 = this.startNode();
- node2.value = value;
- node2.raw = this.input.slice(this.start, this.end);
- if (node2.raw.charCodeAt(node2.raw.length - 1) === 110) {
- node2.bigint = node2.raw.slice(0, -1).replace(/_/g, "");
+ var node = this.startNode();
+ node.value = value;
+ node.raw = this.input.slice(this.start, this.end);
+ if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
+ node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
}
this.next();
- return this.finishNode(node2, "Literal");
+ return this.finishNode(node, "Literal");
};
pp$5.parseParenExpression = function() {
this.expect(types$1.parenL);
@@ -40643,34 +40543,34 @@ pp$5.parseNew = function() {
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword new");
}
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
- var meta3 = this.startNodeAt(node2.start, node2.loc && node2.loc.start);
+ var meta3 = this.startNodeAt(node.start, node.loc && node.loc.start);
meta3.name = "new";
- node2.meta = this.finishNode(meta3, "Identifier");
+ node.meta = this.finishNode(meta3, "Identifier");
this.next();
var containsEsc = this.containsEsc;
- node2.property = this.parseIdent(true);
- if (node2.property.name !== "target") {
- this.raiseRecoverable(node2.property.start, "The only valid meta property for new is 'new.target'");
+ node.property = this.parseIdent(true);
+ if (node.property.name !== "target") {
+ this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
}
if (containsEsc) {
- this.raiseRecoverable(node2.start, "'new.target' must not contain escaped characters");
+ this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
}
if (!this.allowNewDotTarget) {
- this.raiseRecoverable(node2.start, "'new.target' can only be used in functions and class static block");
+ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block");
}
- return this.finishNode(node2, "MetaProperty");
+ return this.finishNode(node, "MetaProperty");
}
var startPos = this.start, startLoc = this.startLoc;
- node2.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
+ node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
if (this.eat(types$1.parenL)) {
- node2.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
+ node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
} else {
- node2.arguments = empty;
+ node.arguments = empty;
}
- return this.finishNode(node2, "NewExpression");
+ return this.finishNode(node, "NewExpression");
};
pp$5.parseTemplateElement = function(ref2) {
var isTagged = ref2.isTagged;
@@ -40699,29 +40599,29 @@ pp$5.parseTemplate = function(ref2) {
var isTagged = ref2.isTagged;
if (isTagged === void 0)
isTagged = false;
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
- node2.expressions = [];
+ node.expressions = [];
var curElt = this.parseTemplateElement({ isTagged });
- node2.quasis = [curElt];
+ node.quasis = [curElt];
while (!curElt.tail) {
if (this.type === types$1.eof) {
this.raise(this.pos, "Unterminated template literal");
}
this.expect(types$1.dollarBraceL);
- node2.expressions.push(this.parseExpression());
+ node.expressions.push(this.parseExpression());
this.expect(types$1.braceR);
- node2.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
+ node.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
}
this.next();
- return this.finishNode(node2, "TemplateLiteral");
+ return this.finishNode(node, "TemplateLiteral");
};
pp$5.isAsyncProp = function(prop2) {
return !prop2.computed && prop2.key.type === "Identifier" && prop2.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
};
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
- var node2 = this.startNode(), first = true, propHash = {};
- node2.properties = [];
+ var node = this.startNode(), first = true, propHash = {};
+ node.properties = [];
this.next();
while (!this.eat(types$1.braceR)) {
if (!first) {
@@ -40736,9 +40636,9 @@ pp$5.parseObj = function(isPattern, refDestructuringErrors) {
if (!isPattern) {
this.checkPropClash(prop2, propHash, refDestructuringErrors);
}
- node2.properties.push(prop2);
+ node.properties.push(prop2);
}
- return this.finishNode(node2, isPattern ? "ObjectPattern" : "ObjectExpression");
+ return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
var prop2 = this.startNode(), isGenerator, isAsync, startPos, startLoc;
@@ -40853,67 +40753,67 @@ pp$5.parsePropertyName = function(prop2) {
}
return prop2.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
};
-pp$5.initFunction = function(node2) {
- node2.id = null;
+pp$5.initFunction = function(node) {
+ node.id = null;
if (this.options.ecmaVersion >= 6) {
- node2.generator = node2.expression = false;
+ node.generator = node.expression = false;
}
if (this.options.ecmaVersion >= 8) {
- node2.async = false;
+ node.async = false;
}
};
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
- var node2 = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
- this.initFunction(node2);
+ var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
+ this.initFunction(node);
if (this.options.ecmaVersion >= 6) {
- node2.generator = isGenerator;
+ node.generator = isGenerator;
}
if (this.options.ecmaVersion >= 8) {
- node2.async = !!isAsync;
+ node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
- this.enterScope(functionFlags(isAsync, node2.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
+ this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
this.expect(types$1.parenL);
- node2.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
- this.parseFunctionBody(node2, false, true, false);
+ this.parseFunctionBody(node, false, true, false);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
- return this.finishNode(node2, "FunctionExpression");
+ return this.finishNode(node, "FunctionExpression");
};
-pp$5.parseArrowExpression = function(node2, params, isAsync, forInit) {
+pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
- this.initFunction(node2);
+ this.initFunction(node);
if (this.options.ecmaVersion >= 8) {
- node2.async = !!isAsync;
+ node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
- node2.params = this.toAssignableList(params, true);
- this.parseFunctionBody(node2, true, false, forInit);
+ node.params = this.toAssignableList(params, true);
+ this.parseFunctionBody(node, true, false, forInit);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
- return this.finishNode(node2, "ArrowFunctionExpression");
+ return this.finishNode(node, "ArrowFunctionExpression");
};
-pp$5.parseFunctionBody = function(node2, isArrowFunction, isMethod, forInit) {
+pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
var isExpression2 = isArrowFunction && this.type !== types$1.braceL;
var oldStrict = this.strict, useStrict = false;
if (isExpression2) {
- node2.body = this.parseMaybeAssign(forInit);
- node2.expression = true;
- this.checkParams(node2, false);
+ node.body = this.parseMaybeAssign(forInit);
+ node.expression = true;
+ this.checkParams(node, false);
} else {
- var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node2.params);
+ var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
if (!oldStrict || nonSimple) {
useStrict = this.strictDirective(this.end);
if (useStrict && nonSimple) {
- this.raiseRecoverable(node2.start, "Illegal 'use strict' directive in function with non-simple parameter list");
+ this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
}
}
var oldLabels = this.labels;
@@ -40921,30 +40821,30 @@ pp$5.parseFunctionBody = function(node2, isArrowFunction, isMethod, forInit) {
if (useStrict) {
this.strict = true;
}
- this.checkParams(node2, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node2.params));
- if (this.strict && node2.id) {
- this.checkLValSimple(node2.id, BIND_OUTSIDE);
+ this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
+ if (this.strict && node.id) {
+ this.checkLValSimple(node.id, BIND_OUTSIDE);
}
- node2.body = this.parseBlock(false, void 0, useStrict && !oldStrict);
- node2.expression = false;
- this.adaptDirectivePrologue(node2.body.body);
+ node.body = this.parseBlock(false, void 0, useStrict && !oldStrict);
+ node.expression = false;
+ this.adaptDirectivePrologue(node.body.body);
this.labels = oldLabels;
}
this.exitScope();
};
pp$5.isSimpleParamList = function(params) {
- for (var i4 = 0, list4 = params; i4 < list4.length; i4 += 1) {
- var param = list4[i4];
+ for (var i4 = 0, list = params; i4 < list.length; i4 += 1) {
+ var param = list[i4];
if (param.type !== "Identifier") {
return false;
}
}
return true;
};
-pp$5.checkParams = function(node2, allowDuplicates) {
+pp$5.checkParams = function(node, allowDuplicates) {
var nameHash = /* @__PURE__ */ Object.create(null);
- for (var i4 = 0, list4 = node2.params; i4 < list4.length; i4 += 1) {
- var param = list4[i4];
+ for (var i4 = 0, list = node.params; i4 < list.length; i4 += 1) {
+ var param = list[i4];
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
}
};
@@ -41005,73 +40905,73 @@ pp$5.checkUnreserved = function(ref2) {
}
};
pp$5.parseIdent = function(liberal) {
- var node2 = this.parseIdentNode();
+ var node = this.parseIdentNode();
this.next(!!liberal);
- this.finishNode(node2, "Identifier");
+ this.finishNode(node, "Identifier");
if (!liberal) {
- this.checkUnreserved(node2);
- if (node2.name === "await" && !this.awaitIdentPos) {
- this.awaitIdentPos = node2.start;
+ this.checkUnreserved(node);
+ if (node.name === "await" && !this.awaitIdentPos) {
+ this.awaitIdentPos = node.start;
}
}
- return node2;
+ return node;
};
pp$5.parseIdentNode = function() {
- var node2 = this.startNode();
+ var node = this.startNode();
if (this.type === types$1.name) {
- node2.name = this.value;
+ node.name = this.value;
} else if (this.type.keyword) {
- node2.name = this.type.keyword;
- if ((node2.name === "class" || node2.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
+ node.name = this.type.keyword;
+ if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
this.context.pop();
}
this.type = types$1.name;
} else {
this.unexpected();
}
- return node2;
+ return node;
};
pp$5.parsePrivateIdent = function() {
- var node2 = this.startNode();
+ var node = this.startNode();
if (this.type === types$1.privateId) {
- node2.name = this.value;
+ node.name = this.value;
} else {
this.unexpected();
}
this.next();
- this.finishNode(node2, "PrivateIdentifier");
+ this.finishNode(node, "PrivateIdentifier");
if (this.options.checkPrivateFields) {
if (this.privateNameStack.length === 0) {
- this.raise(node2.start, "Private field '#" + node2.name + "' must be declared in an enclosing class");
+ this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
} else {
- this.privateNameStack[this.privateNameStack.length - 1].used.push(node2);
+ this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
}
}
- return node2;
+ return node;
};
pp$5.parseYield = function(forInit) {
if (!this.yieldPos) {
this.yieldPos = this.start;
}
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) {
- node2.delegate = false;
- node2.argument = null;
+ node.delegate = false;
+ node.argument = null;
} else {
- node2.delegate = this.eat(types$1.star);
- node2.argument = this.parseMaybeAssign(forInit);
+ node.delegate = this.eat(types$1.star);
+ node.argument = this.parseMaybeAssign(forInit);
}
- return this.finishNode(node2, "YieldExpression");
+ return this.finishNode(node, "YieldExpression");
};
pp$5.parseAwait = function(forInit) {
if (!this.awaitPos) {
this.awaitPos = this.start;
}
- var node2 = this.startNode();
+ var node = this.startNode();
this.next();
- node2.argument = this.parseMaybeUnary(null, true, false, forInit);
- return this.finishNode(node2, "AwaitExpression");
+ node.argument = this.parseMaybeUnary(null, true, false, forInit);
+ return this.finishNode(node, "AwaitExpression");
};
var pp$4 = Parser.prototype;
pp$4.raise = function(pos, message) {
@@ -41191,27 +41091,27 @@ pp$2.startNode = function() {
pp$2.startNodeAt = function(pos, loc) {
return new Node(this, pos, loc);
};
-function finishNodeAt(node2, type, pos, loc) {
- node2.type = type;
- node2.end = pos;
+function finishNodeAt(node, type, pos, loc) {
+ node.type = type;
+ node.end = pos;
if (this.options.locations) {
- node2.loc.end = loc;
+ node.loc.end = loc;
}
if (this.options.ranges) {
- node2.range[1] = pos;
+ node.range[1] = pos;
}
- return node2;
+ return node;
}
-pp$2.finishNode = function(node2, type) {
- return finishNodeAt.call(this, node2, type, this.lastTokEnd, this.lastTokEndLoc);
+pp$2.finishNode = function(node, type) {
+ return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
};
-pp$2.finishNodeAt = function(node2, type, pos, loc) {
- return finishNodeAt.call(this, node2, type, pos, loc);
+pp$2.finishNodeAt = function(node, type, pos, loc) {
+ return finishNodeAt.call(this, node, type, pos, loc);
};
-pp$2.copyNode = function(node2) {
- var newNode2 = new Node(this, node2.start, this.startLoc);
- for (var prop2 in node2) {
- newNode2[prop2] = node2[prop2];
+pp$2.copyNode = function(node) {
+ var newNode2 = new Node(this, node.start, this.startLoc);
+ for (var prop2 in node) {
+ newNode2[prop2] = node[prop2];
}
return newNode2;
};
@@ -41268,13 +41168,13 @@ function buildUnicodeData(ecmaVersion) {
d4.nonBinary.sc = d4.nonBinary.Script;
d4.nonBinary.scx = d4.nonBinary.Script_Extensions;
}
-for (i4 = 0, list4 = [9, 10, 11, 12, 13, 14]; i4 < list4.length; i4 += 1) {
- ecmaVersion = list4[i4];
+for (i4 = 0, list = [9, 10, 11, 12, 13, 14]; i4 < list.length; i4 += 1) {
+ ecmaVersion = list[i4];
buildUnicodeData(ecmaVersion);
}
var ecmaVersion;
var i4;
-var list4;
+var list;
var pp$1 = Parser.prototype;
var RegExpValidationState = function RegExpValidationState2(parser3) {
this.parser = parser3;
@@ -41371,8 +41271,8 @@ RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
if (forceU === void 0)
forceU = false;
var pos = this.pos;
- for (var i4 = 0, list4 = chs; i4 < list4.length; i4 += 1) {
- var ch = list4[i4];
+ for (var i4 = 0, list = chs; i4 < list.length; i4 += 1) {
+ var ch = list[i4];
var current3 = this.at(pos, forceU);
if (current3 === -1 || current3 !== ch) {
return false;
@@ -41434,8 +41334,8 @@ pp$1.regexp_pattern = function(state) {
if (state.maxBackReference > state.numCapturingParens) {
state.raise("Invalid escape");
}
- for (var i4 = 0, list4 = state.backReferenceNames; i4 < list4.length; i4 += 1) {
- var name317 = list4[i4];
+ for (var i4 = 0, list = state.backReferenceNames; i4 < list.length; i4 += 1) {
+ var name317 = list[i4];
if (state.groupNames.indexOf(name317) === -1) {
state.raise("Invalid named capture referenced");
}
@@ -42283,16 +42183,16 @@ pp$1.regexp_eatFixedHexDigits = function(state, length) {
}
return true;
};
-var Token = function Token2(p2) {
- this.type = p2.type;
- this.value = p2.value;
- this.start = p2.start;
- this.end = p2.end;
- if (p2.options.locations) {
- this.loc = new SourceLocation(p2, p2.startLoc, p2.endLoc);
+var Token = function Token2(p) {
+ this.type = p.type;
+ this.value = p.value;
+ this.start = p.start;
+ this.end = p.end;
+ if (p.options.locations) {
+ this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
}
- if (p2.options.ranges) {
- this.range = [p2.start, p2.end];
+ if (p.options.ranges) {
+ this.range = [p.start, p.end];
}
};
var pp = Parser.prototype;
@@ -42345,19 +42245,19 @@ pp.nextToken = function() {
this.readToken(this.fullCharCodeAtPos());
}
};
-pp.readToken = function(code3) {
- if (isIdentifierStart(code3, this.options.ecmaVersion >= 6) || code3 === 92) {
+pp.readToken = function(code) {
+ if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92) {
return this.readWord();
}
- return this.getTokenFromCode(code3);
+ return this.getTokenFromCode(code);
};
pp.fullCharCodeAtPos = function() {
- var code3 = this.input.charCodeAt(this.pos);
- if (code3 <= 55295 || code3 >= 56320) {
- return code3;
+ var code = this.input.charCodeAt(this.pos);
+ if (code <= 55295 || code >= 56320) {
+ return code;
}
var next = this.input.charCodeAt(this.pos + 1);
- return next <= 56319 || next >= 57344 ? code3 : (code3 << 10) + next - 56613888;
+ return next <= 56319 || next >= 57344 ? code : (code << 10) + next - 56613888;
};
pp.skipBlockComment = function() {
var startLoc = this.options.onComment && this.curPosition();
@@ -42479,11 +42379,11 @@ pp.readToken_slash = function() {
}
return this.finishOp(types$1.slash, 1);
};
-pp.readToken_mult_modulo_exp = function(code3) {
+pp.readToken_mult_modulo_exp = function(code) {
var next = this.input.charCodeAt(this.pos + 1);
var size2 = 1;
- var tokentype = code3 === 42 ? types$1.star : types$1.modulo;
- if (this.options.ecmaVersion >= 7 && code3 === 42 && next === 42) {
+ var tokentype = code === 42 ? types$1.star : types$1.modulo;
+ if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
++size2;
tokentype = types$1.starstar;
next = this.input.charCodeAt(this.pos + 2);
@@ -42493,21 +42393,21 @@ pp.readToken_mult_modulo_exp = function(code3) {
}
return this.finishOp(tokentype, size2);
};
-pp.readToken_pipe_amp = function(code3) {
+pp.readToken_pipe_amp = function(code) {
var next = this.input.charCodeAt(this.pos + 1);
- if (next === code3) {
+ if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) {
return this.finishOp(types$1.assign, 3);
}
}
- return this.finishOp(code3 === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
+ return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
- return this.finishOp(code3 === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
+ return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
};
pp.readToken_caret = function() {
var next = this.input.charCodeAt(this.pos + 1);
@@ -42516,9 +42416,9 @@ pp.readToken_caret = function() {
}
return this.finishOp(types$1.bitwiseXOR, 1);
};
-pp.readToken_plus_min = function(code3) {
+pp.readToken_plus_min = function(code) {
var next = this.input.charCodeAt(this.pos + 1);
- if (next === code3) {
+ if (next === code) {
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
this.skipLineComment(3);
this.skipSpace();
@@ -42531,17 +42431,17 @@ pp.readToken_plus_min = function(code3) {
}
return this.finishOp(types$1.plusMin, 1);
};
-pp.readToken_lt_gt = function(code3) {
+pp.readToken_lt_gt = function(code) {
var next = this.input.charCodeAt(this.pos + 1);
var size2 = 1;
- if (next === code3) {
- size2 = code3 === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
+ if (next === code) {
+ size2 = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.pos + size2) === 61) {
return this.finishOp(types$1.assign, size2 + 1);
}
return this.finishOp(types$1.bitShift, size2);
}
- if (next === 33 && code3 === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) {
+ if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) {
this.skipLineComment(4);
this.skipSpace();
return this.nextToken();
@@ -42551,16 +42451,16 @@ pp.readToken_lt_gt = function(code3) {
}
return this.finishOp(types$1.relational, size2);
};
-pp.readToken_eq_excl = function(code3) {
+pp.readToken_eq_excl = function(code) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) {
return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
}
- if (code3 === 61 && next === 62 && this.options.ecmaVersion >= 6) {
+ if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) {
this.pos += 2;
return this.finishToken(types$1.arrow);
}
- return this.finishOp(code3 === 61 ? types$1.eq : types$1.prefix, 1);
+ return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
};
pp.readToken_question = function() {
var ecmaVersion = this.options.ecmaVersion;
@@ -42586,18 +42486,18 @@ pp.readToken_question = function() {
};
pp.readToken_numberSign = function() {
var ecmaVersion = this.options.ecmaVersion;
- var code3 = 35;
+ var code = 35;
if (ecmaVersion >= 13) {
++this.pos;
- code3 = this.fullCharCodeAtPos();
- if (isIdentifierStart(code3, true) || code3 === 92) {
+ code = this.fullCharCodeAtPos();
+ if (isIdentifierStart(code, true) || code === 92) {
return this.finishToken(types$1.privateId, this.readWord1());
}
}
- this.raise(this.pos, "Unexpected character '" + codePointToString(code3) + "'");
+ this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
-pp.getTokenFromCode = function(code3) {
- switch (code3) {
+pp.getTokenFromCode = function(code) {
+ switch (code) {
case 46:
return this.readToken_dot();
case 40:
@@ -42658,26 +42558,26 @@ pp.getTokenFromCode = function(code3) {
return this.readNumber(false);
case 34:
case 39:
- return this.readString(code3);
+ return this.readString(code);
case 47:
return this.readToken_slash();
case 37:
case 42:
- return this.readToken_mult_modulo_exp(code3);
+ return this.readToken_mult_modulo_exp(code);
case 124:
case 38:
- return this.readToken_pipe_amp(code3);
+ return this.readToken_pipe_amp(code);
case 94:
return this.readToken_caret();
case 43:
case 45:
- return this.readToken_plus_min(code3);
+ return this.readToken_plus_min(code);
case 60:
case 62:
- return this.readToken_lt_gt(code3);
+ return this.readToken_lt_gt(code);
case 61:
case 33:
- return this.readToken_eq_excl(code3);
+ return this.readToken_eq_excl(code);
case 63:
return this.readToken_question();
case 126:
@@ -42685,7 +42585,7 @@ pp.getTokenFromCode = function(code3) {
case 35:
return this.readToken_numberSign();
}
- this.raise(this.pos, "Unexpected character '" + codePointToString(code3) + "'");
+ this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
pp.finishOp = function(type, size2) {
var str = this.input.slice(this.pos, this.pos + size2);
@@ -42739,8 +42639,8 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
var start = this.pos, total = 0, lastCode = 0;
for (var i4 = 0, e5 = len == null ? Infinity : len; i4 < e5; ++i4, ++this.pos) {
- var code3 = this.input.charCodeAt(this.pos), val = void 0;
- if (allowSeparators && code3 === 95) {
+ var code = this.input.charCodeAt(this.pos), val = void 0;
+ if (allowSeparators && code === 95) {
if (isLegacyOctalNumericLiteral) {
this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
}
@@ -42750,22 +42650,22 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
if (i4 === 0) {
this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
}
- lastCode = code3;
+ lastCode = code;
continue;
}
- if (code3 >= 97) {
- val = code3 - 97 + 10;
- } else if (code3 >= 65) {
- val = code3 - 65 + 10;
- } else if (code3 >= 48 && code3 <= 57) {
- val = code3 - 48;
+ if (code >= 97) {
+ val = code - 97 + 10;
+ } else if (code >= 65) {
+ val = code - 65 + 10;
+ } else if (code >= 48 && code <= 57) {
+ val = code - 48;
} else {
val = Infinity;
}
if (val >= radix) {
break;
}
- lastCode = code3;
+ lastCode = code;
total = total * radix + val;
}
if (allowSeparators && lastCode === 95) {
@@ -42845,21 +42745,21 @@ pp.readNumber = function(startsWithDot) {
return this.finishToken(types$1.num, val);
};
pp.readCodePoint = function() {
- var ch = this.input.charCodeAt(this.pos), code3;
+ var ch = this.input.charCodeAt(this.pos), code;
if (ch === 123) {
if (this.options.ecmaVersion < 6) {
this.unexpected();
}
var codePos = ++this.pos;
- code3 = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
+ code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
++this.pos;
- if (code3 > 1114111) {
+ if (code > 1114111) {
this.invalidStringToken(codePos, "Code point out of bounds");
}
} else {
- code3 = this.readHexChar(4);
+ code = this.readHexChar(4);
}
- return code3;
+ return code;
};
pp.readString = function(quote) {
var out = "", chunkStart = ++this.pos;
@@ -42908,11 +42808,11 @@ pp.tryReadTemplateToken = function() {
}
this.inTemplateElement = false;
};
-pp.invalidStringToken = function(position3, message) {
+pp.invalidStringToken = function(position, message) {
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
throw INVALID_TEMPLATE_ESCAPE_ERROR;
} else {
- this.raise(position3, message);
+ this.raise(position, message);
}
};
pp.readTmplToken = function() {
@@ -43125,11 +43025,11 @@ var import_lodash2 = __toESM(require_lodash());
function deepOmit(obj, keysToOmit) {
const keysToOmitIndex = import_lodash2.default.keyBy(Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit]);
function omitFromObject(obj2) {
- return import_lodash2.default.transform(obj2, function(result, value, key3) {
- if (key3 in keysToOmitIndex) {
+ return import_lodash2.default.transform(obj2, function(result, value, key2) {
+ if (key2 in keysToOmitIndex) {
return;
}
- result[key3] = import_lodash2.default.isObject(value) ? omitFromObject(value) : value;
+ result[key2] = import_lodash2.default.isObject(value) ? omitFromObject(value) : value;
});
}
return omitFromObject(obj);
@@ -43148,9 +43048,9 @@ var renameKey = (object, oldKey, newKey) => {
};
function applyFunctionToObject(object, func) {
const newObject = {};
- for (const key3 in object) {
- if (Object.prototype.hasOwnProperty.call(object, key3)) {
- newObject[key3] = func(object[key3], key3);
+ for (const key2 in object) {
+ if (Object.prototype.hasOwnProperty.call(object, key2)) {
+ newObject[key2] = func(object[key2], key2);
}
}
return newObject;
@@ -43184,36 +43084,36 @@ var stringIsConst = (str) => {
const isNumber4 = !isNaN(parseFloat(fixedStr)) && !isNaN(fixedStr);
return hasQuotesAtStartEndOnly || isNumber4 || fixedStr == "false" || fixedStr == "true" || str == null || str == "";
};
-var kitWithProps = (root4, props, styles2, actions) => {
- return frameRootWithProps({ ...root4, node: { ...root4.node, type: "frame", ref: "spaces://$kit/#*" + root4.id }, children: [] }, props, styles2, actions);
+var kitWithProps = (root, props, styles2, actions) => {
+ return frameRootWithProps({ ...root, node: { ...root.node, type: "frame", ref: "spaces://$kit/#*" + root.id }, children: [] }, props, styles2, actions);
};
-var frameRootWithProps = (root4, props, styles2, actions) => {
+var frameRootWithProps = (root, props, styles2, actions) => {
return {
- ...root4,
+ ...root,
node: {
- ...root4.node,
+ ...root.node,
props: {
- ...root4.node.props,
+ ...root.node.props,
...props
},
styles: {
- ...root4.node.styles,
+ ...root.node.styles,
...styles2
},
actions: {
- ...root4.node.actions,
+ ...root.node.actions,
...actions
}
}
};
};
-var newUniqueNode = (node2, parent, otherNodes, schemaId) => {
+var newUniqueNode = (node, parent, otherNodes, schemaId) => {
const id3 = uniqueNameFromString(
- node2.node.id,
+ node.node.id,
otherNodes.map((f2) => f2.id)
);
return {
- ...node2.node,
+ ...node.node,
id: id3,
schemaId,
parentId: parent
@@ -43233,8 +43133,8 @@ var generateCodeForProp = (value, isClosure, type) => {
}
return func;
};
-var buildExecutable = (root4) => {
- const treeNode = { ...root4, execActions: {}, execProps: {}, execStyles: {}, execPropsOptions: {} };
+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`);
treeNode.execPropsOptions.props = sortedKeys.map((f2) => {
@@ -43262,55 +43162,55 @@ var buildExecutable = (root4) => {
}
return treeNode;
};
-function extractDependencies(code3) {
+function extractDependencies(code) {
const dependencies314 = [];
- function visit2(node2, parts = []) {
- if (node2.type === "Identifier") {
- parts.push(node2.name);
+ function visit(node, parts = []) {
+ if (node.type === "Identifier") {
+ parts.push(node.name);
return parts;
- } else if (node2.type === "MemberExpression") {
- const objectParts = visit2(node2.object, parts);
- if (objectParts && node2.computed) {
- if (node2.property.type === "Literal") {
- objectParts.push(String(node2.property.value));
+ } else if (node.type === "MemberExpression") {
+ const objectParts = visit(node.object, parts);
+ if (objectParts && node.computed) {
+ if (node.property.type === "Literal") {
+ objectParts.push(String(node.property.value));
return objectParts;
- } else if (node2.property.type === "Identifier") {
- objectParts.push(node2.property.name);
+ } else if (node.property.type === "Identifier") {
+ objectParts.push(node.property.name);
return objectParts;
- } else if (node2.property.type === "MemberExpression") {
- explore(node2.property);
+ } else if (node.property.type === "MemberExpression") {
+ explore(node.property);
return objectParts;
} else {
return null;
}
} else if (objectParts) {
- return visit2(node2.property, objectParts);
+ return visit(node.property, objectParts);
}
- } else if (node2.type === "Literal") {
- parts.push(String(node2.value));
+ } else if (node.type === "Literal") {
+ parts.push(String(node.value));
return parts;
- } else if (node2.type === "ChainExpression" || node2.type == "ExpressionStatement") {
- explore(node2.expression);
+ } else if (node.type === "ChainExpression" || node.type == "ExpressionStatement") {
+ explore(node.expression);
return;
- } else if (node2.type === "CallExpression") {
- explore(node2);
+ } else if (node.type === "CallExpression") {
+ explore(node);
return;
}
return null;
}
- function explore(node2) {
- if (node2.type === "MemberExpression") {
- const parts = visit2(node2);
+ function explore(node) {
+ if (node.type === "MemberExpression") {
+ const parts = visit(node);
if (parts) {
dependencies314.push(parts);
}
return;
}
- for (const key3 in node2) {
- if (typeof node2[key3] === "object" && node2[key3] !== null) {
- explore(node2[key3]);
- } else if (Array.isArray(node2[key3])) {
- for (const item of node2[key3]) {
+ for (const key2 in node) {
+ if (typeof node[key2] === "object" && node[key2] !== null) {
+ explore(node[key2]);
+ } else if (Array.isArray(node[key2])) {
+ for (const item of node[key2]) {
if (typeof item === "object" && item !== null) {
explore(item);
}
@@ -43319,7 +43219,7 @@ function extractDependencies(code3) {
}
}
try {
- const ast = parse3(code3.replace("return ", ""), { ecmaVersion: 2020 });
+ const ast = parse3(code.replace("return ", ""), { ecmaVersion: 2020 });
explore(ast);
} catch (e5) {
return [];
@@ -43330,238 +43230,238 @@ function sortKeysByDependencies(codeBlockStore, identifier) {
const graph = /* @__PURE__ */ new Map();
const dependencies314 = /* @__PURE__ */ new Map();
const allDependencies = /* @__PURE__ */ new Map();
- for (const key3 in codeBlockStore) {
- const code3 = codeBlockStore[key3];
- const extractedDependencies = extractDependencies(code3);
+ for (const key2 in codeBlockStore) {
+ const code = codeBlockStore[key2];
+ const extractedDependencies = extractDependencies(code);
const localDependencies = extractedDependencies.filter((dep) => {
return dep.slice(0, -1).join(".") === identifier;
});
- dependencies314.set(key3, localDependencies);
- allDependencies.set(key3, extractedDependencies);
- if (!graph.has(key3)) {
- graph.set(key3, /* @__PURE__ */ new Set());
+ dependencies314.set(key2, localDependencies);
+ allDependencies.set(key2, extractedDependencies);
+ if (!graph.has(key2)) {
+ graph.set(key2, /* @__PURE__ */ new Set());
}
for (const dep of localDependencies) {
const depStr = dep[dep.length - 1];
- if (depStr === key3)
+ if (depStr === key2)
continue;
- graph.get(key3).add(depStr);
+ graph.get(key2).add(depStr);
}
}
const visited = /* @__PURE__ */ new Set();
const result = [];
const temp = /* @__PURE__ */ new Set();
- const visit2 = (key3) => {
- if (temp.has(key3))
+ const visit = (key2) => {
+ if (temp.has(key2))
throw new Error("Circular dependency detected");
- if (!visited.has(key3)) {
- temp.add(key3);
- const edges = graph.get(key3) || /* @__PURE__ */ new Set();
+ if (!visited.has(key2)) {
+ temp.add(key2);
+ const edges = graph.get(key2) || /* @__PURE__ */ new Set();
for (const dep of edges) {
- visit2(dep);
+ visit(dep);
}
- visited.add(key3);
- temp.delete(key3);
- result.push(key3);
+ visited.add(key2);
+ temp.delete(key2);
+ result.push(key2);
}
};
- for (const key3 in codeBlockStore) {
- if (!visited.has(key3)) {
- visit2(key3);
+ for (const key2 in codeBlockStore) {
+ if (!visited.has(key2)) {
+ visit(key2);
}
}
return { sortedKeys: result, dependencies: allDependencies };
}
// node_modules/acorn-walk/dist/walk.mjs
-function simple(node2, visitors, baseVisitor, state, override) {
+function simple(node, visitors, baseVisitor, state, override) {
if (!baseVisitor) {
baseVisitor = base;
}
- (function c3(node3, st, override2) {
- var type = override2 || node3.type;
- baseVisitor[type](node3, st, c3);
+ (function c3(node2, st, override2) {
+ var type = override2 || node2.type;
+ baseVisitor[type](node2, st, c3);
if (visitors[type]) {
- visitors[type](node3, st);
+ visitors[type](node2, st);
}
- })(node2, state, override);
+ })(node, state, override);
}
-function ancestor(node2, visitors, baseVisitor, state, override) {
+function ancestor(node, visitors, baseVisitor, state, override) {
var ancestors = [];
if (!baseVisitor) {
baseVisitor = base;
}
- (function c3(node3, st, override2) {
- var type = override2 || node3.type;
- var isNew = node3 !== ancestors[ancestors.length - 1];
+ (function c3(node2, st, override2) {
+ var type = override2 || node2.type;
+ var isNew = node2 !== ancestors[ancestors.length - 1];
if (isNew) {
- ancestors.push(node3);
+ ancestors.push(node2);
}
- baseVisitor[type](node3, st, c3);
+ baseVisitor[type](node2, st, c3);
if (visitors[type]) {
- visitors[type](node3, st || ancestors, ancestors);
+ visitors[type](node2, st || ancestors, ancestors);
}
if (isNew) {
ancestors.pop();
}
- })(node2, state, override);
+ })(node, state, override);
}
-function skipThrough(node2, st, c3) {
- c3(node2, st);
+function skipThrough(node, st, c3) {
+ c3(node, st);
}
function ignore(_node, _st, _c) {
}
var base = {};
-base.Program = base.BlockStatement = base.StaticBlock = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.body; i4 < list4.length; i4 += 1) {
- var stmt = list4[i4];
+base.Program = base.BlockStatement = base.StaticBlock = function(node, st, c3) {
+ for (var i4 = 0, list = node.body; i4 < list.length; i4 += 1) {
+ var stmt = list[i4];
c3(stmt, st, "Statement");
}
};
base.Statement = skipThrough;
base.EmptyStatement = ignore;
-base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = function(node2, st, c3) {
- return c3(node2.expression, st, "Expression");
+base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = function(node, st, c3) {
+ return c3(node.expression, st, "Expression");
};
-base.IfStatement = function(node2, st, c3) {
- c3(node2.test, st, "Expression");
- c3(node2.consequent, st, "Statement");
- if (node2.alternate) {
- c3(node2.alternate, st, "Statement");
+base.IfStatement = function(node, st, c3) {
+ c3(node.test, st, "Expression");
+ c3(node.consequent, st, "Statement");
+ if (node.alternate) {
+ c3(node.alternate, st, "Statement");
}
};
-base.LabeledStatement = function(node2, st, c3) {
- return c3(node2.body, st, "Statement");
+base.LabeledStatement = function(node, st, c3) {
+ return c3(node.body, st, "Statement");
};
base.BreakStatement = base.ContinueStatement = ignore;
-base.WithStatement = function(node2, st, c3) {
- c3(node2.object, st, "Expression");
- c3(node2.body, st, "Statement");
+base.WithStatement = function(node, st, c3) {
+ c3(node.object, st, "Expression");
+ c3(node.body, st, "Statement");
};
-base.SwitchStatement = function(node2, st, c3) {
- c3(node2.discriminant, st, "Expression");
- for (var i$1 = 0, list$1 = node2.cases; i$1 < list$1.length; i$1 += 1) {
+base.SwitchStatement = function(node, st, c3) {
+ c3(node.discriminant, st, "Expression");
+ for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
var cs = list$1[i$1];
if (cs.test) {
c3(cs.test, st, "Expression");
}
- for (var i4 = 0, list4 = cs.consequent; i4 < list4.length; i4 += 1) {
- var cons = list4[i4];
+ for (var i4 = 0, list = cs.consequent; i4 < list.length; i4 += 1) {
+ var cons = list[i4];
c3(cons, st, "Statement");
}
}
};
-base.SwitchCase = function(node2, st, c3) {
- if (node2.test) {
- c3(node2.test, st, "Expression");
+base.SwitchCase = function(node, st, c3) {
+ if (node.test) {
+ c3(node.test, st, "Expression");
}
- for (var i4 = 0, list4 = node2.consequent; i4 < list4.length; i4 += 1) {
- var cons = list4[i4];
+ for (var i4 = 0, list = node.consequent; i4 < list.length; i4 += 1) {
+ var cons = list[i4];
c3(cons, st, "Statement");
}
};
-base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function(node2, st, c3) {
- if (node2.argument) {
- c3(node2.argument, st, "Expression");
+base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function(node, st, c3) {
+ if (node.argument) {
+ c3(node.argument, st, "Expression");
}
};
-base.ThrowStatement = base.SpreadElement = function(node2, st, c3) {
- return c3(node2.argument, st, "Expression");
+base.ThrowStatement = base.SpreadElement = function(node, st, c3) {
+ return c3(node.argument, st, "Expression");
};
-base.TryStatement = function(node2, st, c3) {
- c3(node2.block, st, "Statement");
- if (node2.handler) {
- c3(node2.handler, st);
+base.TryStatement = function(node, st, c3) {
+ c3(node.block, st, "Statement");
+ if (node.handler) {
+ c3(node.handler, st);
}
- if (node2.finalizer) {
- c3(node2.finalizer, st, "Statement");
+ if (node.finalizer) {
+ c3(node.finalizer, st, "Statement");
}
};
-base.CatchClause = function(node2, st, c3) {
- if (node2.param) {
- c3(node2.param, st, "Pattern");
+base.CatchClause = function(node, st, c3) {
+ if (node.param) {
+ c3(node.param, st, "Pattern");
}
- c3(node2.body, st, "Statement");
+ c3(node.body, st, "Statement");
};
-base.WhileStatement = base.DoWhileStatement = function(node2, st, c3) {
- c3(node2.test, st, "Expression");
- c3(node2.body, st, "Statement");
+base.WhileStatement = base.DoWhileStatement = function(node, st, c3) {
+ c3(node.test, st, "Expression");
+ c3(node.body, st, "Statement");
};
-base.ForStatement = function(node2, st, c3) {
- if (node2.init) {
- c3(node2.init, st, "ForInit");
+base.ForStatement = function(node, st, c3) {
+ if (node.init) {
+ c3(node.init, st, "ForInit");
}
- if (node2.test) {
- c3(node2.test, st, "Expression");
+ if (node.test) {
+ c3(node.test, st, "Expression");
}
- if (node2.update) {
- c3(node2.update, st, "Expression");
+ if (node.update) {
+ c3(node.update, st, "Expression");
}
- c3(node2.body, st, "Statement");
+ c3(node.body, st, "Statement");
};
-base.ForInStatement = base.ForOfStatement = function(node2, st, c3) {
- c3(node2.left, st, "ForInit");
- c3(node2.right, st, "Expression");
- c3(node2.body, st, "Statement");
+base.ForInStatement = base.ForOfStatement = function(node, st, c3) {
+ c3(node.left, st, "ForInit");
+ c3(node.right, st, "Expression");
+ c3(node.body, st, "Statement");
};
-base.ForInit = function(node2, st, c3) {
- if (node2.type === "VariableDeclaration") {
- c3(node2, st);
+base.ForInit = function(node, st, c3) {
+ if (node.type === "VariableDeclaration") {
+ c3(node, st);
} else {
- c3(node2, st, "Expression");
+ c3(node, st, "Expression");
}
};
base.DebuggerStatement = ignore;
-base.FunctionDeclaration = function(node2, st, c3) {
- return c3(node2, st, "Function");
+base.FunctionDeclaration = function(node, st, c3) {
+ return c3(node, st, "Function");
};
-base.VariableDeclaration = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.declarations; i4 < list4.length; i4 += 1) {
- var decl = list4[i4];
+base.VariableDeclaration = function(node, st, c3) {
+ for (var i4 = 0, list = node.declarations; i4 < list.length; i4 += 1) {
+ var decl = list[i4];
c3(decl, st);
}
};
-base.VariableDeclarator = function(node2, st, c3) {
- c3(node2.id, st, "Pattern");
- if (node2.init) {
- c3(node2.init, st, "Expression");
+base.VariableDeclarator = function(node, st, c3) {
+ c3(node.id, st, "Pattern");
+ if (node.init) {
+ c3(node.init, st, "Expression");
}
};
-base.Function = function(node2, st, c3) {
- if (node2.id) {
- c3(node2.id, st, "Pattern");
+base.Function = function(node, st, c3) {
+ if (node.id) {
+ c3(node.id, st, "Pattern");
}
- for (var i4 = 0, list4 = node2.params; i4 < list4.length; i4 += 1) {
- var param = list4[i4];
+ for (var i4 = 0, list = node.params; i4 < list.length; i4 += 1) {
+ var param = list[i4];
c3(param, st, "Pattern");
}
- c3(node2.body, st, node2.expression ? "Expression" : "Statement");
+ c3(node.body, st, node.expression ? "Expression" : "Statement");
};
-base.Pattern = function(node2, st, c3) {
- if (node2.type === "Identifier") {
- c3(node2, st, "VariablePattern");
- } else if (node2.type === "MemberExpression") {
- c3(node2, st, "MemberPattern");
+base.Pattern = function(node, st, c3) {
+ if (node.type === "Identifier") {
+ c3(node, st, "VariablePattern");
+ } else if (node.type === "MemberExpression") {
+ c3(node, st, "MemberPattern");
} else {
- c3(node2, st);
+ c3(node, st);
}
};
base.VariablePattern = ignore;
base.MemberPattern = skipThrough;
-base.RestElement = function(node2, st, c3) {
- return c3(node2.argument, st, "Pattern");
+base.RestElement = function(node, st, c3) {
+ return c3(node.argument, st, "Pattern");
};
-base.ArrayPattern = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.elements; i4 < list4.length; i4 += 1) {
- var elt = list4[i4];
+base.ArrayPattern = function(node, st, c3) {
+ for (var i4 = 0, list = node.elements; i4 < list.length; i4 += 1) {
+ var elt = list[i4];
if (elt) {
c3(elt, st, "Pattern");
}
}
};
-base.ObjectPattern = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.properties; i4 < list4.length; i4 += 1) {
- var prop2 = list4[i4];
+base.ObjectPattern = function(node, st, c3) {
+ for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) {
+ var prop2 = list[i4];
if (prop2.type === "Property") {
if (prop2.computed) {
c3(prop2.key, st, "Expression");
@@ -43574,122 +43474,122 @@ base.ObjectPattern = function(node2, st, c3) {
};
base.Expression = skipThrough;
base.ThisExpression = base.Super = base.MetaProperty = ignore;
-base.ArrayExpression = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.elements; i4 < list4.length; i4 += 1) {
- var elt = list4[i4];
+base.ArrayExpression = function(node, st, c3) {
+ for (var i4 = 0, list = node.elements; i4 < list.length; i4 += 1) {
+ var elt = list[i4];
if (elt) {
c3(elt, st, "Expression");
}
}
};
-base.ObjectExpression = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.properties; i4 < list4.length; i4 += 1) {
- var prop2 = list4[i4];
+base.ObjectExpression = function(node, st, c3) {
+ for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) {
+ var prop2 = list[i4];
c3(prop2, st);
}
};
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
-base.SequenceExpression = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.expressions; i4 < list4.length; i4 += 1) {
- var expr = list4[i4];
+base.SequenceExpression = function(node, st, c3) {
+ for (var i4 = 0, list = node.expressions; i4 < list.length; i4 += 1) {
+ var expr = list[i4];
c3(expr, st, "Expression");
}
};
-base.TemplateLiteral = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.quasis; i4 < list4.length; i4 += 1) {
- var quasi = list4[i4];
+base.TemplateLiteral = function(node, st, c3) {
+ for (var i4 = 0, list = node.quasis; i4 < list.length; i4 += 1) {
+ var quasi = list[i4];
c3(quasi, st);
}
- for (var i$1 = 0, list$1 = node2.expressions; i$1 < list$1.length; i$1 += 1) {
+ for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) {
var expr = list$1[i$1];
c3(expr, st, "Expression");
}
};
base.TemplateElement = ignore;
-base.UnaryExpression = base.UpdateExpression = function(node2, st, c3) {
- c3(node2.argument, st, "Expression");
-};
-base.BinaryExpression = base.LogicalExpression = function(node2, st, c3) {
- c3(node2.left, st, "Expression");
- c3(node2.right, st, "Expression");
-};
-base.AssignmentExpression = base.AssignmentPattern = function(node2, st, c3) {
- c3(node2.left, st, "Pattern");
- c3(node2.right, st, "Expression");
-};
-base.ConditionalExpression = function(node2, st, c3) {
- c3(node2.test, st, "Expression");
- c3(node2.consequent, st, "Expression");
- c3(node2.alternate, st, "Expression");
-};
-base.NewExpression = base.CallExpression = function(node2, st, c3) {
- c3(node2.callee, st, "Expression");
- if (node2.arguments) {
- for (var i4 = 0, list4 = node2.arguments; i4 < list4.length; i4 += 1) {
- var arg2 = list4[i4];
+base.UnaryExpression = base.UpdateExpression = function(node, st, c3) {
+ c3(node.argument, st, "Expression");
+};
+base.BinaryExpression = base.LogicalExpression = function(node, st, c3) {
+ c3(node.left, st, "Expression");
+ c3(node.right, st, "Expression");
+};
+base.AssignmentExpression = base.AssignmentPattern = function(node, st, c3) {
+ c3(node.left, st, "Pattern");
+ c3(node.right, st, "Expression");
+};
+base.ConditionalExpression = function(node, st, c3) {
+ c3(node.test, st, "Expression");
+ c3(node.consequent, st, "Expression");
+ c3(node.alternate, st, "Expression");
+};
+base.NewExpression = base.CallExpression = function(node, st, c3) {
+ c3(node.callee, st, "Expression");
+ if (node.arguments) {
+ for (var i4 = 0, list = node.arguments; i4 < list.length; i4 += 1) {
+ var arg2 = list[i4];
c3(arg2, st, "Expression");
}
}
};
-base.MemberExpression = function(node2, st, c3) {
- c3(node2.object, st, "Expression");
- if (node2.computed) {
- c3(node2.property, st, "Expression");
+base.MemberExpression = function(node, st, c3) {
+ c3(node.object, st, "Expression");
+ if (node.computed) {
+ c3(node.property, st, "Expression");
}
};
-base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function(node2, st, c3) {
- if (node2.declaration) {
- c3(node2.declaration, st, node2.type === "ExportNamedDeclaration" || node2.declaration.id ? "Statement" : "Expression");
+base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function(node, st, c3) {
+ if (node.declaration) {
+ c3(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression");
}
- if (node2.source) {
- c3(node2.source, st, "Expression");
+ if (node.source) {
+ c3(node.source, st, "Expression");
}
};
-base.ExportAllDeclaration = function(node2, st, c3) {
- if (node2.exported) {
- c3(node2.exported, st);
+base.ExportAllDeclaration = function(node, st, c3) {
+ if (node.exported) {
+ c3(node.exported, st);
}
- c3(node2.source, st, "Expression");
+ c3(node.source, st, "Expression");
};
-base.ImportDeclaration = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.specifiers; i4 < list4.length; i4 += 1) {
- var spec = list4[i4];
+base.ImportDeclaration = function(node, st, c3) {
+ for (var i4 = 0, list = node.specifiers; i4 < list.length; i4 += 1) {
+ var spec = list[i4];
c3(spec, st);
}
- c3(node2.source, st, "Expression");
+ c3(node.source, st, "Expression");
};
-base.ImportExpression = function(node2, st, c3) {
- c3(node2.source, st, "Expression");
+base.ImportExpression = function(node, st, c3) {
+ c3(node.source, st, "Expression");
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
-base.TaggedTemplateExpression = function(node2, st, c3) {
- c3(node2.tag, st, "Expression");
- c3(node2.quasi, st, "Expression");
+base.TaggedTemplateExpression = function(node, st, c3) {
+ c3(node.tag, st, "Expression");
+ c3(node.quasi, st, "Expression");
};
-base.ClassDeclaration = base.ClassExpression = function(node2, st, c3) {
- return c3(node2, st, "Class");
+base.ClassDeclaration = base.ClassExpression = function(node, st, c3) {
+ return c3(node, st, "Class");
};
-base.Class = function(node2, st, c3) {
- if (node2.id) {
- c3(node2.id, st, "Pattern");
+base.Class = function(node, st, c3) {
+ if (node.id) {
+ c3(node.id, st, "Pattern");
}
- if (node2.superClass) {
- c3(node2.superClass, st, "Expression");
+ if (node.superClass) {
+ c3(node.superClass, st, "Expression");
}
- c3(node2.body, st);
+ c3(node.body, st);
};
-base.ClassBody = function(node2, st, c3) {
- for (var i4 = 0, list4 = node2.body; i4 < list4.length; i4 += 1) {
- var elt = list4[i4];
+base.ClassBody = function(node, st, c3) {
+ for (var i4 = 0, list = node.body; i4 < list.length; i4 += 1) {
+ var elt = list[i4];
c3(elt, st);
}
};
-base.MethodDefinition = base.PropertyDefinition = base.Property = function(node2, st, c3) {
- if (node2.computed) {
- c3(node2.key, st, "Expression");
+base.MethodDefinition = base.PropertyDefinition = base.Property = function(node, st, c3) {
+ if (node.computed) {
+ c3(node.key, st, "Expression");
}
- if (node2.value) {
- c3(node2.value, st, "Expression");
+ if (node.value) {
+ c3(node.value, st, "Expression");
}
};
@@ -43778,8 +43678,8 @@ function formatSequence(state, nodes) {
}
state.write(")");
}
-function expressionNeedsParenthesis(state, node2, parentNode, isRightHand) {
- const nodePrecedence = state.expressionsPrecedence[node2.type];
+function expressionNeedsParenthesis(state, node, parentNode, isRightHand) {
+ const nodePrecedence = state.expressionsPrecedence[node.type];
if (nodePrecedence === NEEDS_PARENTHESES) {
return true;
}
@@ -43790,29 +43690,29 @@ function expressionNeedsParenthesis(state, node2, parentNode, isRightHand) {
if (nodePrecedence !== 13 && nodePrecedence !== 14) {
return false;
}
- if (node2.operator === "**" && parentNode.operator === "**") {
+ if (node.operator === "**" && parentNode.operator === "**") {
return !isRightHand;
}
- if (nodePrecedence === 13 && parentNodePrecedence === 13 && (node2.operator === "??" || parentNode.operator === "??")) {
+ if (nodePrecedence === 13 && parentNodePrecedence === 13 && (node.operator === "??" || parentNode.operator === "??")) {
return true;
}
if (isRightHand) {
- return OPERATOR_PRECEDENCE[node2.operator] <= OPERATOR_PRECEDENCE[parentNode.operator];
+ return OPERATOR_PRECEDENCE[node.operator] <= OPERATOR_PRECEDENCE[parentNode.operator];
}
- return OPERATOR_PRECEDENCE[node2.operator] < OPERATOR_PRECEDENCE[parentNode.operator];
+ return OPERATOR_PRECEDENCE[node.operator] < OPERATOR_PRECEDENCE[parentNode.operator];
}
-function formatExpression(state, node2, parentNode, isRightHand) {
+function formatExpression(state, node, parentNode, isRightHand) {
const { generator } = state;
- if (expressionNeedsParenthesis(state, node2, parentNode, isRightHand)) {
+ if (expressionNeedsParenthesis(state, node, parentNode, isRightHand)) {
state.write("(");
- generator[node2.type](node2, state);
+ generator[node.type](node, state);
state.write(")");
} else {
- generator[node2.type](node2, state);
+ generator[node.type](node, state);
}
}
-function reindent(state, text7, indent, lineEnd) {
- const lines = text7.split("\n");
+function reindent(state, text2, indent, lineEnd) {
+ const lines = text2.split("\n");
const end = lines.length - 1;
state.write(lines[0].trim());
if (end > 0) {
@@ -43826,19 +43726,19 @@ function reindent(state, text7, indent, lineEnd) {
function formatComments(state, comments, indent, lineEnd) {
const { length } = comments;
for (let i4 = 0; i4 < length; i4++) {
- const comment4 = comments[i4];
+ const comment3 = comments[i4];
state.write(indent);
- if (comment4.type[0] === "L") {
- state.write("// " + comment4.value.trim() + "\n", comment4);
+ if (comment3.type[0] === "L") {
+ state.write("// " + comment3.value.trim() + "\n", comment3);
} else {
state.write("/*");
- reindent(state, comment4.value, indent, lineEnd);
+ reindent(state, comment3.value, indent, lineEnd);
state.write("*/" + lineEnd);
}
}
}
-function hasCallExpression(node2) {
- let currentNode = node2;
+function hasCallExpression(node) {
+ let currentNode = node;
while (currentNode != null) {
const { type } = currentNode;
if (type[0] === "C" && type[1] === "a") {
@@ -43850,10 +43750,10 @@ function hasCallExpression(node2) {
}
}
}
-function formatVariableDeclaration(state, node2) {
+function formatVariableDeclaration(state, node) {
const { generator } = state;
- const { declarations } = node2;
- state.write(node2.kind + " ");
+ const { declarations } = node;
+ state.write(node.kind + " ");
const { length } = declarations;
if (length > 0) {
generator.VariableDeclarator(declarations[0], state);
@@ -43870,13 +43770,13 @@ var BinaryExpression;
var ArrayExpression;
var BlockStatement;
var GENERATOR = {
- Program(node2, state) {
+ Program(node, state) {
const indent = state.indent.repeat(state.indentLevel);
const { lineEnd, writeComments } = state;
- if (writeComments && node2.comments != null) {
- formatComments(state, node2.comments, indent, lineEnd);
+ if (writeComments && node.comments != null) {
+ formatComments(state, node.comments, indent, lineEnd);
}
- const statements = node2.body;
+ const statements = node.body;
const { length } = statements;
for (let i4 = 0; i4 < length; i4++) {
const statement = statements[i4];
@@ -43887,20 +43787,20 @@ var GENERATOR = {
this[statement.type](statement, state);
state.write(lineEnd);
}
- if (writeComments && node2.trailingComments != null) {
- formatComments(state, node2.trailingComments, indent, lineEnd);
+ if (writeComments && node.trailingComments != null) {
+ formatComments(state, node.trailingComments, indent, lineEnd);
}
},
- BlockStatement: BlockStatement = function(node2, state) {
+ BlockStatement: BlockStatement = function(node, state) {
const indent = state.indent.repeat(state.indentLevel++);
const { lineEnd, writeComments } = state;
const statementIndent = indent + state.indent;
state.write("{");
- const statements = node2.body;
+ const statements = node.body;
if (statements != null && statements.length > 0) {
state.write(lineEnd);
- if (writeComments && node2.comments != null) {
- formatComments(state, node2.comments, statementIndent, lineEnd);
+ if (writeComments && node.comments != null) {
+ formatComments(state, node.comments, statementIndent, lineEnd);
}
const { length } = statements;
for (let i4 = 0; i4 < length; i4++) {
@@ -43914,84 +43814,84 @@ var GENERATOR = {
}
state.write(indent);
} else {
- if (writeComments && node2.comments != null) {
+ if (writeComments && node.comments != null) {
state.write(lineEnd);
- formatComments(state, node2.comments, statementIndent, lineEnd);
+ formatComments(state, node.comments, statementIndent, lineEnd);
state.write(indent);
}
}
- if (writeComments && node2.trailingComments != null) {
- formatComments(state, node2.trailingComments, statementIndent, lineEnd);
+ if (writeComments && node.trailingComments != null) {
+ formatComments(state, node.trailingComments, statementIndent, lineEnd);
}
state.write("}");
state.indentLevel--;
},
ClassBody: BlockStatement,
- StaticBlock(node2, state) {
+ StaticBlock(node, state) {
state.write("static ");
- this.BlockStatement(node2, state);
+ this.BlockStatement(node, state);
},
- EmptyStatement(node2, state) {
+ EmptyStatement(node, state) {
state.write(";");
},
- ExpressionStatement(node2, state) {
- const precedence = state.expressionsPrecedence[node2.expression.type];
- if (precedence === NEEDS_PARENTHESES || precedence === 3 && node2.expression.left.type[0] === "O") {
+ ExpressionStatement(node, state) {
+ const precedence = state.expressionsPrecedence[node.expression.type];
+ if (precedence === NEEDS_PARENTHESES || precedence === 3 && node.expression.left.type[0] === "O") {
state.write("(");
- this[node2.expression.type](node2.expression, state);
+ this[node.expression.type](node.expression, state);
state.write(")");
} else {
- this[node2.expression.type](node2.expression, state);
+ this[node.expression.type](node.expression, state);
}
state.write(";");
},
- IfStatement(node2, state) {
+ IfStatement(node, state) {
state.write("if (");
- this[node2.test.type](node2.test, state);
+ this[node.test.type](node.test, state);
state.write(") ");
- this[node2.consequent.type](node2.consequent, state);
- if (node2.alternate != null) {
+ this[node.consequent.type](node.consequent, state);
+ if (node.alternate != null) {
state.write(" else ");
- this[node2.alternate.type](node2.alternate, state);
+ this[node.alternate.type](node.alternate, state);
}
},
- LabeledStatement(node2, state) {
- this[node2.label.type](node2.label, state);
+ LabeledStatement(node, state) {
+ this[node.label.type](node.label, state);
state.write(": ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
},
- BreakStatement(node2, state) {
+ BreakStatement(node, state) {
state.write("break");
- if (node2.label != null) {
+ if (node.label != null) {
state.write(" ");
- this[node2.label.type](node2.label, state);
+ this[node.label.type](node.label, state);
}
state.write(";");
},
- ContinueStatement(node2, state) {
+ ContinueStatement(node, state) {
state.write("continue");
- if (node2.label != null) {
+ if (node.label != null) {
state.write(" ");
- this[node2.label.type](node2.label, state);
+ this[node.label.type](node.label, state);
}
state.write(";");
},
- WithStatement(node2, state) {
+ WithStatement(node, state) {
state.write("with (");
- this[node2.object.type](node2.object, state);
+ this[node.object.type](node.object, state);
state.write(") ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
},
- SwitchStatement(node2, state) {
+ SwitchStatement(node, state) {
const indent = state.indent.repeat(state.indentLevel++);
const { lineEnd, writeComments } = state;
state.indentLevel++;
const caseIndent = indent + state.indent;
const statementIndent = caseIndent + state.indent;
state.write("switch (");
- this[node2.discriminant.type](node2.discriminant, state);
+ this[node.discriminant.type](node.discriminant, state);
state.write(") {" + lineEnd);
- const { cases: occurences } = node2;
+ const { cases: occurences } = node;
const { length: occurencesCount } = occurences;
for (let i4 = 0; i4 < occurencesCount; i4++) {
const occurence = occurences[i4];
@@ -44020,24 +43920,24 @@ var GENERATOR = {
state.indentLevel -= 2;
state.write(indent + "}");
},
- ReturnStatement(node2, state) {
+ ReturnStatement(node, state) {
state.write("return");
- if (node2.argument) {
+ if (node.argument) {
state.write(" ");
- this[node2.argument.type](node2.argument, state);
+ this[node.argument.type](node.argument, state);
}
state.write(";");
},
- ThrowStatement(node2, state) {
+ ThrowStatement(node, state) {
state.write("throw ");
- this[node2.argument.type](node2.argument, state);
+ this[node.argument.type](node.argument, state);
state.write(";");
},
- TryStatement(node2, state) {
+ TryStatement(node, state) {
state.write("try ");
- this[node2.block.type](node2.block, state);
- if (node2.handler) {
- const { handler } = node2;
+ this[node.block.type](node.block, state);
+ if (node.handler) {
+ const { handler } = node;
if (handler.param == null) {
state.write(" catch ");
} else {
@@ -44047,28 +43947,28 @@ var GENERATOR = {
}
this[handler.body.type](handler.body, state);
}
- if (node2.finalizer) {
+ if (node.finalizer) {
state.write(" finally ");
- this[node2.finalizer.type](node2.finalizer, state);
+ this[node.finalizer.type](node.finalizer, state);
}
},
- WhileStatement(node2, state) {
+ WhileStatement(node, state) {
state.write("while (");
- this[node2.test.type](node2.test, state);
+ this[node.test.type](node.test, state);
state.write(") ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
},
- DoWhileStatement(node2, state) {
+ DoWhileStatement(node, state) {
state.write("do ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
state.write(" while (");
- this[node2.test.type](node2.test, state);
+ this[node.test.type](node.test, state);
state.write(");");
},
- ForStatement(node2, state) {
+ ForStatement(node, state) {
state.write("for (");
- if (node2.init != null) {
- const { init } = node2;
+ if (node.init != null) {
+ const { init } = node;
if (init.type[0] === "V") {
formatVariableDeclaration(state, init);
} else {
@@ -44076,75 +43976,75 @@ var GENERATOR = {
}
}
state.write("; ");
- if (node2.test) {
- this[node2.test.type](node2.test, state);
+ if (node.test) {
+ this[node.test.type](node.test, state);
}
state.write("; ");
- if (node2.update) {
- this[node2.update.type](node2.update, state);
+ if (node.update) {
+ this[node.update.type](node.update, state);
}
state.write(") ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
},
- ForInStatement: ForInStatement = function(node2, state) {
- state.write(`for ${node2.await ? "await " : ""}(`);
- const { left } = node2;
+ ForInStatement: ForInStatement = function(node, state) {
+ state.write(`for ${node.await ? "await " : ""}(`);
+ const { left } = node;
if (left.type[0] === "V") {
formatVariableDeclaration(state, left);
} else {
this[left.type](left, state);
}
- state.write(node2.type[3] === "I" ? " in " : " of ");
- this[node2.right.type](node2.right, state);
+ state.write(node.type[3] === "I" ? " in " : " of ");
+ this[node.right.type](node.right, state);
state.write(") ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
},
ForOfStatement: ForInStatement,
- DebuggerStatement(node2, state) {
- state.write("debugger;", node2);
+ DebuggerStatement(node, state) {
+ state.write("debugger;", node);
},
- FunctionDeclaration: FunctionDeclaration = function(node2, state) {
+ FunctionDeclaration: FunctionDeclaration = function(node, state) {
state.write(
- (node2.async ? "async " : "") + (node2.generator ? "function* " : "function ") + (node2.id ? node2.id.name : ""),
- node2
+ (node.async ? "async " : "") + (node.generator ? "function* " : "function ") + (node.id ? node.id.name : ""),
+ node
);
- formatSequence(state, node2.params);
+ formatSequence(state, node.params);
state.write(" ");
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
},
FunctionExpression: FunctionDeclaration,
- VariableDeclaration(node2, state) {
- formatVariableDeclaration(state, node2);
+ VariableDeclaration(node, state) {
+ formatVariableDeclaration(state, node);
state.write(";");
},
- VariableDeclarator(node2, state) {
- this[node2.id.type](node2.id, state);
- if (node2.init != null) {
+ VariableDeclarator(node, state) {
+ this[node.id.type](node.id, state);
+ if (node.init != null) {
state.write(" = ");
- this[node2.init.type](node2.init, state);
+ this[node.init.type](node.init, state);
}
},
- ClassDeclaration(node2, state) {
- state.write("class " + (node2.id ? `${node2.id.name} ` : ""), node2);
- if (node2.superClass) {
+ ClassDeclaration(node, state) {
+ state.write("class " + (node.id ? `${node.id.name} ` : ""), node);
+ if (node.superClass) {
state.write("extends ");
- const { superClass } = node2;
+ const { superClass } = node;
const { type } = superClass;
const precedence = state.expressionsPrecedence[type];
if ((type[0] !== "C" || type[1] !== "l" || type[5] !== "E") && (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.ClassExpression)) {
state.write("(");
- this[node2.superClass.type](superClass, state);
+ this[node.superClass.type](superClass, state);
state.write(")");
} else {
this[superClass.type](superClass, state);
}
state.write(" ");
}
- this.ClassBody(node2.body, state);
+ this.ClassBody(node.body, state);
},
- ImportDeclaration(node2, state) {
+ ImportDeclaration(node, state) {
state.write("import ");
- const { specifiers } = node2;
+ const { specifiers } = node;
const { length } = specifiers;
let i4 = 0;
if (length > 0) {
@@ -44183,28 +44083,28 @@ var GENERATOR = {
}
state.write(" from ");
}
- this.Literal(node2.source, state);
+ this.Literal(node.source, state);
state.write(";");
},
- ImportExpression(node2, state) {
+ ImportExpression(node, state) {
state.write("import(");
- this[node2.source.type](node2.source, state);
+ this[node.source.type](node.source, state);
state.write(")");
},
- ExportDefaultDeclaration(node2, state) {
+ ExportDefaultDeclaration(node, state) {
state.write("export default ");
- this[node2.declaration.type](node2.declaration, state);
- if (state.expressionsPrecedence[node2.declaration.type] != null && node2.declaration.type[0] !== "F") {
+ this[node.declaration.type](node.declaration, state);
+ if (state.expressionsPrecedence[node.declaration.type] != null && node.declaration.type[0] !== "F") {
state.write(";");
}
},
- ExportNamedDeclaration(node2, state) {
+ ExportNamedDeclaration(node, state) {
state.write("export ");
- if (node2.declaration) {
- this[node2.declaration.type](node2.declaration, state);
+ if (node.declaration) {
+ this[node.declaration.type](node.declaration, state);
} else {
state.write("{");
- const { specifiers } = node2, { length } = specifiers;
+ const { specifiers } = node, { length } = specifiers;
if (length > 0) {
for (let i4 = 0; ; ) {
const specifier = specifiers[i4];
@@ -44221,93 +44121,93 @@ var GENERATOR = {
}
}
state.write("}");
- if (node2.source) {
+ if (node.source) {
state.write(" from ");
- this.Literal(node2.source, state);
+ this.Literal(node.source, state);
}
state.write(";");
}
},
- ExportAllDeclaration(node2, state) {
- if (node2.exported != null) {
- state.write("export * as " + node2.exported.name + " from ");
+ ExportAllDeclaration(node, state) {
+ if (node.exported != null) {
+ state.write("export * as " + node.exported.name + " from ");
} else {
state.write("export * from ");
}
- this.Literal(node2.source, state);
+ this.Literal(node.source, state);
state.write(";");
},
- MethodDefinition(node2, state) {
- if (node2.static) {
+ MethodDefinition(node, state) {
+ if (node.static) {
state.write("static ");
}
- const kind = node2.kind[0];
+ const kind = node.kind[0];
if (kind === "g" || kind === "s") {
- state.write(node2.kind + " ");
+ state.write(node.kind + " ");
}
- if (node2.value.async) {
+ if (node.value.async) {
state.write("async ");
}
- if (node2.value.generator) {
+ if (node.value.generator) {
state.write("*");
}
- if (node2.computed) {
+ if (node.computed) {
state.write("[");
- this[node2.key.type](node2.key, state);
+ this[node.key.type](node.key, state);
state.write("]");
} else {
- this[node2.key.type](node2.key, state);
+ this[node.key.type](node.key, state);
}
- formatSequence(state, node2.value.params);
+ formatSequence(state, node.value.params);
state.write(" ");
- this[node2.value.body.type](node2.value.body, state);
+ this[node.value.body.type](node.value.body, state);
},
- ClassExpression(node2, state) {
- this.ClassDeclaration(node2, state);
+ ClassExpression(node, state) {
+ this.ClassDeclaration(node, state);
},
- ArrowFunctionExpression(node2, state) {
- state.write(node2.async ? "async " : "", node2);
- const { params } = node2;
+ ArrowFunctionExpression(node, state) {
+ state.write(node.async ? "async " : "", node);
+ const { params } = node;
if (params != null) {
if (params.length === 1 && params[0].type[0] === "I") {
state.write(params[0].name, params[0]);
} else {
- formatSequence(state, node2.params);
+ formatSequence(state, node.params);
}
}
state.write(" => ");
- if (node2.body.type[0] === "O") {
+ if (node.body.type[0] === "O") {
state.write("(");
- this.ObjectExpression(node2.body, state);
+ this.ObjectExpression(node.body, state);
state.write(")");
} else {
- this[node2.body.type](node2.body, state);
+ this[node.body.type](node.body, state);
}
},
- ThisExpression(node2, state) {
- state.write("this", node2);
+ ThisExpression(node, state) {
+ state.write("this", node);
},
- Super(node2, state) {
- state.write("super", node2);
+ Super(node, state) {
+ state.write("super", node);
},
- RestElement: RestElement = function(node2, state) {
+ RestElement: RestElement = function(node, state) {
state.write("...");
- this[node2.argument.type](node2.argument, state);
+ this[node.argument.type](node.argument, state);
},
SpreadElement: RestElement,
- YieldExpression(node2, state) {
- state.write(node2.delegate ? "yield*" : "yield");
- if (node2.argument) {
+ YieldExpression(node, state) {
+ state.write(node.delegate ? "yield*" : "yield");
+ if (node.argument) {
state.write(" ");
- this[node2.argument.type](node2.argument, state);
+ this[node.argument.type](node.argument, state);
}
},
- AwaitExpression(node2, state) {
- state.write("await ", node2);
- formatExpression(state, node2.argument, node2);
+ AwaitExpression(node, state) {
+ state.write("await ", node);
+ formatExpression(state, node.argument, node);
},
- TemplateLiteral(node2, state) {
- const { quasis, expressions } = node2;
+ TemplateLiteral(node, state) {
+ const { quasis, expressions } = node;
state.write("`");
const { length } = expressions;
for (let i4 = 0; i4 < length; i4++) {
@@ -44322,26 +44222,26 @@ var GENERATOR = {
state.write(quasi.value.raw, quasi);
state.write("`");
},
- TemplateElement(node2, state) {
- state.write(node2.value.raw, node2);
+ TemplateElement(node, state) {
+ state.write(node.value.raw, node);
},
- TaggedTemplateExpression(node2, state) {
- formatExpression(state, node2.tag, node2);
- this[node2.quasi.type](node2.quasi, state);
+ TaggedTemplateExpression(node, state) {
+ formatExpression(state, node.tag, node);
+ this[node.quasi.type](node.quasi, state);
},
- ArrayExpression: ArrayExpression = function(node2, state) {
+ ArrayExpression: ArrayExpression = function(node, state) {
state.write("[");
- if (node2.elements.length > 0) {
- const { elements } = node2, { length } = elements;
+ if (node.elements.length > 0) {
+ const { elements } = node, { length } = elements;
for (let i4 = 0; ; ) {
- const element3 = elements[i4];
- if (element3 != null) {
- this[element3.type](element3, state);
+ const element = elements[i4];
+ if (element != null) {
+ this[element.type](element, state);
}
if (++i4 < length) {
state.write(", ");
} else {
- if (element3 == null) {
+ if (element == null) {
state.write(", ");
}
break;
@@ -44351,18 +44251,18 @@ var GENERATOR = {
state.write("]");
},
ArrayPattern: ArrayExpression,
- ObjectExpression(node2, state) {
+ ObjectExpression(node, state) {
const indent = state.indent.repeat(state.indentLevel++);
const { lineEnd, writeComments } = state;
const propertyIndent = indent + state.indent;
state.write("{");
- if (node2.properties.length > 0) {
+ if (node.properties.length > 0) {
state.write(lineEnd);
- if (writeComments && node2.comments != null) {
- formatComments(state, node2.comments, propertyIndent, lineEnd);
+ if (writeComments && node.comments != null) {
+ formatComments(state, node.comments, propertyIndent, lineEnd);
}
const comma = "," + lineEnd;
- const { properties: properties3 } = node2, { length } = properties3;
+ const { properties: properties3 } = node, { length } = properties3;
for (let i4 = 0; ; ) {
const property = properties3[i4];
if (writeComments && property.comments != null) {
@@ -44377,21 +44277,21 @@ var GENERATOR = {
}
}
state.write(lineEnd);
- if (writeComments && node2.trailingComments != null) {
- formatComments(state, node2.trailingComments, propertyIndent, lineEnd);
+ if (writeComments && node.trailingComments != null) {
+ formatComments(state, node.trailingComments, propertyIndent, lineEnd);
}
state.write(indent + "}");
} else if (writeComments) {
- if (node2.comments != null) {
+ if (node.comments != null) {
state.write(lineEnd);
- formatComments(state, node2.comments, propertyIndent, lineEnd);
- if (node2.trailingComments != null) {
- formatComments(state, node2.trailingComments, propertyIndent, lineEnd);
+ formatComments(state, node.comments, propertyIndent, lineEnd);
+ if (node.trailingComments != null) {
+ formatComments(state, node.trailingComments, propertyIndent, lineEnd);
}
state.write(indent + "}");
- } else if (node2.trailingComments != null) {
+ } else if (node.trailingComments != null) {
state.write(lineEnd);
- formatComments(state, node2.trailingComments, propertyIndent, lineEnd);
+ formatComments(state, node.trailingComments, propertyIndent, lineEnd);
state.write(indent + "}");
} else {
state.write("}");
@@ -44401,48 +44301,48 @@ var GENERATOR = {
}
state.indentLevel--;
},
- Property(node2, state) {
- if (node2.method || node2.kind[0] !== "i") {
- this.MethodDefinition(node2, state);
+ Property(node, state) {
+ if (node.method || node.kind[0] !== "i") {
+ this.MethodDefinition(node, state);
} else {
- if (!node2.shorthand) {
- if (node2.computed) {
+ if (!node.shorthand) {
+ if (node.computed) {
state.write("[");
- this[node2.key.type](node2.key, state);
+ this[node.key.type](node.key, state);
state.write("]");
} else {
- this[node2.key.type](node2.key, state);
+ this[node.key.type](node.key, state);
}
state.write(": ");
}
- this[node2.value.type](node2.value, state);
+ this[node.value.type](node.value, state);
}
},
- PropertyDefinition(node2, state) {
- if (node2.static) {
+ PropertyDefinition(node, state) {
+ if (node.static) {
state.write("static ");
}
- if (node2.computed) {
+ if (node.computed) {
state.write("[");
}
- this[node2.key.type](node2.key, state);
- if (node2.computed) {
+ this[node.key.type](node.key, state);
+ if (node.computed) {
state.write("]");
}
- if (node2.value == null) {
- if (node2.key.type[0] !== "F") {
+ if (node.value == null) {
+ if (node.key.type[0] !== "F") {
state.write(";");
}
return;
}
state.write(" = ");
- this[node2.value.type](node2.value, state);
+ this[node.value.type](node.value, state);
state.write(";");
},
- ObjectPattern(node2, state) {
+ ObjectPattern(node, state) {
state.write("{");
- if (node2.properties.length > 0) {
- const { properties: properties3 } = node2, { length } = properties3;
+ if (node.properties.length > 0) {
+ const { properties: properties3 } = node, { length } = properties3;
for (let i4 = 0; ; ) {
this[properties3[i4].type](properties3[i4], state);
if (++i4 < length) {
@@ -44454,18 +44354,18 @@ var GENERATOR = {
}
state.write("}");
},
- SequenceExpression(node2, state) {
- formatSequence(state, node2.expressions);
+ SequenceExpression(node, state) {
+ formatSequence(state, node.expressions);
},
- UnaryExpression(node2, state) {
- if (node2.prefix) {
+ UnaryExpression(node, state) {
+ if (node.prefix) {
const {
operator: operator3,
argument,
argument: { type }
- } = node2;
+ } = node;
state.write(operator3);
- const needsParentheses = expressionNeedsParenthesis(state, argument, node2);
+ const needsParentheses = expressionNeedsParenthesis(state, argument, node);
if (!needsParentheses && (operator3.length > 1 || type[0] === "U" && (type[1] === "n" || type[1] === "p") && argument.prefix && argument.operator[0] === operator3 && (operator3 === "+" || operator3 === "-"))) {
state.write(" ");
}
@@ -44477,44 +44377,44 @@ var GENERATOR = {
this[type](argument, state);
}
} else {
- this[node2.argument.type](node2.argument, state);
- state.write(node2.operator);
+ this[node.argument.type](node.argument, state);
+ state.write(node.operator);
}
},
- UpdateExpression(node2, state) {
- if (node2.prefix) {
- state.write(node2.operator);
- this[node2.argument.type](node2.argument, state);
+ UpdateExpression(node, state) {
+ if (node.prefix) {
+ state.write(node.operator);
+ this[node.argument.type](node.argument, state);
} else {
- this[node2.argument.type](node2.argument, state);
- state.write(node2.operator);
+ this[node.argument.type](node.argument, state);
+ state.write(node.operator);
}
},
- AssignmentExpression(node2, state) {
- this[node2.left.type](node2.left, state);
- state.write(" " + node2.operator + " ");
- this[node2.right.type](node2.right, state);
+ AssignmentExpression(node, state) {
+ this[node.left.type](node.left, state);
+ state.write(" " + node.operator + " ");
+ this[node.right.type](node.right, state);
},
- AssignmentPattern(node2, state) {
- this[node2.left.type](node2.left, state);
+ AssignmentPattern(node, state) {
+ this[node.left.type](node.left, state);
state.write(" = ");
- this[node2.right.type](node2.right, state);
+ this[node.right.type](node.right, state);
},
- BinaryExpression: BinaryExpression = function(node2, state) {
- const isIn = node2.operator === "in";
+ BinaryExpression: BinaryExpression = function(node, state) {
+ const isIn = node.operator === "in";
if (isIn) {
state.write("(");
}
- formatExpression(state, node2.left, node2, false);
- state.write(" " + node2.operator + " ");
- formatExpression(state, node2.right, node2, true);
+ formatExpression(state, node.left, node, false);
+ state.write(" " + node.operator + " ");
+ formatExpression(state, node.right, node, true);
if (isIn) {
state.write(")");
}
},
LogicalExpression: BinaryExpression,
- ConditionalExpression(node2, state) {
- const { test } = node2;
+ ConditionalExpression(node, state) {
+ const { test } = node;
const precedence = state.expressionsPrecedence[test.type];
if (precedence === NEEDS_PARENTHESES || precedence <= state.expressionsPrecedence.ConditionalExpression) {
state.write("(");
@@ -44524,87 +44424,87 @@ var GENERATOR = {
this[test.type](test, state);
}
state.write(" ? ");
- this[node2.consequent.type](node2.consequent, state);
+ this[node.consequent.type](node.consequent, state);
state.write(" : ");
- this[node2.alternate.type](node2.alternate, state);
+ this[node.alternate.type](node.alternate, state);
},
- NewExpression(node2, state) {
+ NewExpression(node, state) {
state.write("new ");
- const precedence = state.expressionsPrecedence[node2.callee.type];
- if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression || hasCallExpression(node2.callee)) {
+ const precedence = state.expressionsPrecedence[node.callee.type];
+ if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression || hasCallExpression(node.callee)) {
state.write("(");
- this[node2.callee.type](node2.callee, state);
+ this[node.callee.type](node.callee, state);
state.write(")");
} else {
- this[node2.callee.type](node2.callee, state);
+ this[node.callee.type](node.callee, state);
}
- formatSequence(state, node2["arguments"]);
+ formatSequence(state, node["arguments"]);
},
- CallExpression(node2, state) {
- const precedence = state.expressionsPrecedence[node2.callee.type];
+ CallExpression(node, state) {
+ const precedence = state.expressionsPrecedence[node.callee.type];
if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression) {
state.write("(");
- this[node2.callee.type](node2.callee, state);
+ this[node.callee.type](node.callee, state);
state.write(")");
} else {
- this[node2.callee.type](node2.callee, state);
+ this[node.callee.type](node.callee, state);
}
- if (node2.optional) {
+ if (node.optional) {
state.write("?.");
}
- formatSequence(state, node2["arguments"]);
+ formatSequence(state, node["arguments"]);
},
- ChainExpression(node2, state) {
- this[node2.expression.type](node2.expression, state);
+ ChainExpression(node, state) {
+ this[node.expression.type](node.expression, state);
},
- MemberExpression(node2, state) {
- const precedence = state.expressionsPrecedence[node2.object.type];
+ MemberExpression(node, state) {
+ const precedence = state.expressionsPrecedence[node.object.type];
if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.MemberExpression) {
state.write("(");
- this[node2.object.type](node2.object, state);
+ this[node.object.type](node.object, state);
state.write(")");
} else {
- this[node2.object.type](node2.object, state);
+ this[node.object.type](node.object, state);
}
- if (node2.computed) {
- if (node2.optional) {
+ if (node.computed) {
+ if (node.optional) {
state.write("?.");
}
state.write("[");
- this[node2.property.type](node2.property, state);
+ this[node.property.type](node.property, state);
state.write("]");
} else {
- if (node2.optional) {
+ if (node.optional) {
state.write("?.");
} else {
state.write(".");
}
- this[node2.property.type](node2.property, state);
+ this[node.property.type](node.property, state);
}
},
- MetaProperty(node2, state) {
- state.write(node2.meta.name + "." + node2.property.name, node2);
+ MetaProperty(node, state) {
+ state.write(node.meta.name + "." + node.property.name, node);
},
- Identifier(node2, state) {
- state.write(node2.name, node2);
+ Identifier(node, state) {
+ state.write(node.name, node);
},
- PrivateIdentifier(node2, state) {
- state.write(`#${node2.name}`, node2);
+ PrivateIdentifier(node, state) {
+ state.write(`#${node.name}`, node);
},
- Literal(node2, state) {
- if (node2.raw != null) {
- state.write(node2.raw, node2);
- } else if (node2.regex != null) {
- this.RegExpLiteral(node2, state);
- } else if (node2.bigint != null) {
- state.write(node2.bigint + "n", node2);
+ Literal(node, state) {
+ if (node.raw != null) {
+ state.write(node.raw, node);
+ } else if (node.regex != null) {
+ this.RegExpLiteral(node, state);
+ } else if (node.bigint != null) {
+ state.write(node.bigint + "n", node);
} else {
- state.write(stringify(node2.value), node2);
+ state.write(stringify(node.value), node);
}
},
- RegExpLiteral(node2, state) {
- const { regex } = node2;
- state.write(`/${regex.pattern}/${regex.flags}`, node2);
+ RegExpLiteral(node, state) {
+ const { regex } = node;
+ state.write(`/${regex.pattern}/${regex.flags}`, node);
}
};
var EMPTY_OBJECT = {};
@@ -44638,39 +44538,39 @@ var State = class {
};
}
}
- write(code3) {
- this.output += code3;
+ write(code) {
+ this.output += code;
}
- writeToStream(code3) {
- this.output.write(code3);
+ writeToStream(code) {
+ this.output.write(code);
}
- writeAndMap(code3, node2) {
- this.output += code3;
- this.map(code3, node2);
+ writeAndMap(code, node) {
+ this.output += code;
+ this.map(code, node);
}
- writeToStreamAndMap(code3, node2) {
- this.output.write(code3);
- this.map(code3, node2);
+ writeToStreamAndMap(code, node) {
+ this.output.write(code);
+ this.map(code, node);
}
- map(code3, node2) {
- if (node2 != null) {
- const { type } = node2;
+ map(code, node) {
+ if (node != null) {
+ const { type } = node;
if (type[0] === "L" && type[2] === "n") {
this.column = 0;
this.line++;
return;
}
- if (node2.loc != null) {
+ if (node.loc != null) {
const { mapping } = this;
- mapping.original = node2.loc.start;
- mapping.name = node2.name;
+ mapping.original = node.loc.start;
+ mapping.name = node.name;
this.sourceMap.addMapping(mapping);
}
- if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node2.value === "string") {
- const { length: length2 } = code3;
+ if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node.value === "string") {
+ const { length: length2 } = code;
let { column: column2, line } = this;
for (let i4 = 0; i4 < length2; i4++) {
- if (code3[i4] === "\n") {
+ if (code[i4] === "\n") {
column2 = 0;
line++;
} else {
@@ -44682,10 +44582,10 @@ var State = class {
return;
}
}
- const { length } = code3;
+ const { length } = code;
const { lineEnd } = this;
if (length > 0) {
- if (this.lineEndSize > 0 && (lineEnd.length === 1 ? code3[length - 1] === lineEnd : code3.endsWith(lineEnd))) {
+ if (this.lineEndSize > 0 && (lineEnd.length === 1 ? code[length - 1] === lineEnd : code.endsWith(lineEnd))) {
this.line += this.lineEndSize;
this.column = 0;
} else {
@@ -44697,16 +44597,16 @@ var State = class {
return this.output;
}
};
-function generate(node2, options) {
+function generate(node, options) {
const state = new State(options);
- state.generator[node2.type](node2, state);
+ state.generator[node.type](node, state);
return state.output;
}
// src/core/utils/frames/linker.ts
-var preprocessCode = (code3, oldName, newName) => {
- let string6;
- let codeBlock = ensureString(code3);
+var preprocessCode = (code, oldName, newName) => {
+ let string4;
+ let codeBlock = ensureString(code);
const isMultiLine = codeBlock.includes("\n");
let hasReturn = false;
if (isMultiLine) {
@@ -44719,78 +44619,78 @@ var preprocessCode = (code3, oldName, newName) => {
try {
const ast = parse3(codeBlock, { ecmaVersion: 2020, locations: true });
ancestor(ast, {
- Identifier(node2, ancestors) {
+ Identifier(node, ancestors) {
const parent = ancestors[ancestors.length - 2];
- if (parent.type !== "MemberExpression" || parent.object === node2) {
- if (node2.name == oldName) {
- node2.name = newName;
+ if (parent.type !== "MemberExpression" || parent.object === node) {
+ if (node.name == oldName) {
+ node.name = newName;
}
}
},
- Property(node2) {
- if (node2.key.type === "Identifier" && node2.key.name === oldName) {
- node2.key.name = newName;
+ Property(node) {
+ if (node.key.type === "Identifier" && node.key.name === oldName) {
+ node.key.name = newName;
}
},
- ObjectExpression(node2) {
- node2.properties.forEach((property) => {
+ ObjectExpression(node) {
+ node.properties.forEach((property) => {
if (property.key.type === "Identifier" && property.key.name === oldName) {
property.key.name = newName;
}
});
}
});
- string6 = generate(ast).trimEnd();
+ string4 = generate(ast).trimEnd();
} catch (e5) {
- console.log(e5, code3, name);
- string6 = `"error"`;
+ console.log(e5, code, name);
+ string4 = `"error"`;
}
if (isMultiLine && hasReturn) {
- const lines = string6.split("\n").filter((line) => line.trim() !== "");
+ const lines = string4.split("\n").filter((line) => line.trim() !== "");
lines[lines.length - 1] = `return ${lines[lines.length - 1]}`;
- string6 = lines.join("\n");
+ string4 = lines.join("\n");
}
- return string6;
+ return string4;
};
-var relinkProps = (oldParent, newParent, node2, rootId) => {
+var relinkProps = (oldParent, newParent, node, rootId) => {
return {
- ...node2,
- id: node2.id == oldParent ? newParent : node2.id,
- parentId: node2.id == rootId ? node2.parentId : node2.parentId == oldParent ? newParent : node2.parentId,
- ref: node2.ref == oldParent ? newParent : node2.ref,
- props: Object.keys(node2?.props ?? {}).reduce(
- (p2, c3) => {
+ ...node,
+ id: node.id == oldParent ? newParent : node.id,
+ parentId: node.id == rootId ? node.parentId : node.parentId == oldParent ? newParent : node.parentId,
+ ref: node.ref == oldParent ? newParent : node.ref,
+ props: Object.keys(node?.props ?? {}).reduce(
+ (p, c3) => {
return {
- ...p2,
- [c3]: preprocessCode(node2.props[c3], oldParent, newParent)
+ ...p,
+ [c3]: preprocessCode(node.props[c3], oldParent, newParent)
};
},
- node2.props
+ node.props
),
- actions: Object.keys(node2?.actions ?? {}).reduce(
- (p2, c3) => {
+ actions: Object.keys(node?.actions ?? {}).reduce(
+ (p, c3) => {
return {
- ...p2,
- [c3]: preprocessCode(node2.actions[c3], oldParent, newParent)
+ ...p,
+ [c3]: preprocessCode(node.actions[c3], oldParent, newParent)
};
},
- node2.actions
+ node.actions
),
- styles: Object.keys(node2?.styles ?? {}).reduce(
- (p2, c3) => {
+ styles: Object.keys(node?.styles ?? {}).reduce(
+ (p, c3) => {
return {
- ...p2,
- [c3]: preprocessCode(node2.styles[c3], oldParent, newParent)
+ ...p,
+ [c3]: preprocessCode(node.styles[c3], oldParent, newParent)
};
},
- node2.styles
+ node.styles
)
};
};
var linkNodes = (parent, schemaId, props, flattenedTree, uniqueID) => {
const assignIDs = (parent2, nodes) => {
- const [newNodes, newID] = nodes.reduce((p2, c3, i4) => {
- const [oldNodes, id3] = p2;
+ const [newNodes, newID] = nodes.reduce((p, c3, i4) => {
+ const [oldNodes, id3] = p;
const newNodeID = c3.parentId ? c3.id + id3 : parent2.id;
const newNode2 = {
...c3.parentId == "" ? parent2 : oldNodes[i4],
@@ -44808,7 +44708,7 @@ var linkNodes = (parent, schemaId, props, flattenedTree, uniqueID) => {
var linkTreeNodes = (parent, uniqueID) => {
const relinkProps2 = (oldParent, newParent, treenode) => {
let children;
- const node2 = treenode.node;
+ const node = treenode.node;
if (treenode.children) {
children = treenode.children.map((child) => relinkProps2(oldParent, newParent, child));
}
@@ -44817,42 +44717,42 @@ var linkTreeNodes = (parent, uniqueID) => {
children,
node: {
...treenode.node,
- parentId: node2.parentId == oldParent ? newParent : node2.parentId,
- props: Object.keys(node2?.props ?? {}).reduce(
- (p2, c3) => {
+ parentId: node.parentId == oldParent ? newParent : node.parentId,
+ props: Object.keys(node?.props ?? {}).reduce(
+ (p, c3) => {
return {
- ...p2,
- [c3]: preprocessCode(node2.props[c3], oldParent, newParent)
+ ...p,
+ [c3]: preprocessCode(node.props[c3], oldParent, newParent)
};
},
- node2.props
+ node.props
),
- actions: Object.keys(node2?.actions ?? {}).reduce(
- (p2, c3) => {
+ actions: Object.keys(node?.actions ?? {}).reduce(
+ (p, c3) => {
return {
- ...p2,
- [c3]: preprocessCode(node2.actions[c3], oldParent, newParent)
+ ...p,
+ [c3]: preprocessCode(node.actions[c3], oldParent, newParent)
};
},
- node2.actions
+ node.actions
),
- styles: Object.keys(node2?.styles ?? {}).reduce(
- (p2, c3) => {
+ styles: Object.keys(node?.styles ?? {}).reduce(
+ (p, c3) => {
return {
- ...p2,
- [c3]: preprocessCode(node2.styles[c3], oldParent, newParent)
+ ...p,
+ [c3]: preprocessCode(node.styles[c3], oldParent, newParent)
};
},
- node2.styles
+ node.styles
)
}
};
};
- const assignIDs = (parent2, node2, uniqueID2) => {
- const assignIDToTree = (parent3, node3, id3) => {
- const newNodeID = node3.node.parentId ? node3.id + id3 : parent3.id;
- let newNode2 = { ...node3, node: { ...node3.node, id: newNodeID }, id: newNodeID };
- newNode2 = relinkProps2(node3.id, newNodeID, newNode2);
+ const assignIDs = (parent2, node, uniqueID2) => {
+ const assignIDToTree = (parent3, node2, id3) => {
+ const newNodeID = node2.node.parentId ? node2.id + id3 : parent3.id;
+ let newNode2 = { ...node2, node: { ...node2.node, id: newNodeID }, id: newNodeID };
+ newNode2 = relinkProps2(node2.id, newNodeID, newNode2);
if (newNode2.children) {
const [newChildren, newID] = newNode2.children.reduce(
(acc, child, i4) => {
@@ -44867,7 +44767,7 @@ var linkTreeNodes = (parent, uniqueID) => {
}
return [newNode2, id3 + 1];
};
- return assignIDToTree(parent2, node2, uniqueID2);
+ return assignIDToTree(parent2, node, uniqueID2);
};
return assignIDs(parent, parent, uniqueID);
};
@@ -44910,7 +44810,7 @@ var parseLinkedPropertyToValue = (property) => {
var parseContextNode = (pathString) => {
if (!pathString || stringIsConst(pathString))
return null;
- const path3 = [];
+ const path2 = [];
const isMultiLine = pathString.includes("\n");
if (isMultiLine) {
const lines = pathString.split("\n").filter((line) => line.trim() !== "");
@@ -44920,31 +44820,31 @@ var parseContextNode = (pathString) => {
try {
const ast = parse3(pathString, { ecmaVersion: 2020 });
simple(ast, {
- MemberExpression(node2) {
- if (node2.object.type === "Identifier" && !path3.includes(node2.object.name)) {
- path3.push(node2.object.name);
+ MemberExpression(node) {
+ if (node.object.type === "Identifier" && !path2.includes(node.object.name)) {
+ path2.push(node.object.name);
}
- if (node2.computed) {
- path3.push(node2.property.value);
+ if (node.computed) {
+ path2.push(node.property.value);
} else {
- path3.push(node2.property.name);
+ path2.push(node.property.name);
}
}
});
} catch (e5) {
console.log(e5);
}
- if (path3.length < 3)
+ if (path2.length < 3)
return null;
return {
- context: path3[1],
- prop: path3[2]
+ context: path2[1],
+ prop: path2[2]
};
};
var parseLinkedNode = (pathString) => {
if (!pathString || stringIsConst(pathString))
return null;
- const path3 = [];
+ const path2 = [];
const isMultiLine = pathString.includes("\n");
if (isMultiLine) {
const lines = pathString.split("\n").filter((line) => line.trim() !== "");
@@ -44954,28 +44854,28 @@ var parseLinkedNode = (pathString) => {
try {
const ast = parse3(pathString, { ecmaVersion: 2020 });
simple(ast, {
- MemberExpression(node2) {
- if (node2.object.type === "Identifier" && !path3.includes(node2.object.name)) {
- path3.push(node2.object.name);
+ MemberExpression(node) {
+ if (node.object.type === "Identifier" && !path2.includes(node.object.name)) {
+ path2.push(node.object.name);
}
- if (node2.computed) {
- path3.push(node2.property.value);
+ if (node.computed) {
+ path2.push(node.property.value);
} else {
- path3.push(node2.property.name);
+ path2.push(node.property.name);
}
}
});
} catch (e5) {
console.log(e5);
}
- if (path3.length < 3)
+ if (path2.length < 3)
return null;
return {
- node: path3[0],
- prop: path3[2]
+ node: path2[0],
+ prop: path2[2]
};
};
-var saveFrameRoot = async (superstate, tableData, space3, frameRoot) => {
+var saveFrameRoot = async (superstate, tableData, space2, frameRoot) => {
if (!tableData)
return;
const treeNodes = flattenToFrameNodes(frameRoot, tableData.schema.id);
@@ -44986,17 +44886,17 @@ var saveFrameRoot = async (superstate, tableData, space3, frameRoot) => {
...treeNodes
].map((f2) => nodeToFrame(relinkProps("$root", tableData.schema.id, f2, tableData.schema.id)))
};
- await superstate.spaceManager.saveFrame(space3.path, newTable);
+ await superstate.spaceManager.saveFrame(space2.path, newTable);
};
-var replaceFrameWithFrameRoot = async (superstate, space3, schema, root4) => {
- return superstate.spaceManager.readFrame(space3.path, schema).then(
- (tagDB) => saveFrameRoot(superstate, tagDB, space3, root4)
+var replaceFrameWithFrameRoot = async (superstate, space2, schema, root) => {
+ return superstate.spaceManager.readFrame(space2.path, schema).then(
+ (tagDB) => saveFrameRoot(superstate, tagDB, space2, root)
);
};
var mdbFrameToDBTables = (tables, uniques) => {
- return Object.keys(tables).reduce((p2, c3) => {
+ return Object.keys(tables).reduce((p, c3) => {
return {
- ...p2,
+ ...p,
[c3]: {
uniques: defaultFrameSchema.uniques,
cols: defaultFrameSchema.cols,
@@ -45043,42 +44943,42 @@ var calculateEditorProps = (props, treeNode) => {
};
};
var getFrameNodesByPath = (superstate, ref2) => {
- const path3 = superstate.spaceManager.uriByString(ref2);
- if (!path3)
+ const path2 = superstate.spaceManager.uriByString(ref2);
+ if (!path2)
return;
- if (path3.authority == "$kit") {
- const kit = superstate.kit.find((f2) => f2.def.id == path3.ref);
+ if (path2.authority == "$kit") {
+ const kit = superstate.kit.find((f2) => f2.def.id == path2.ref);
if (!kit)
return;
return rootToFrame(kit);
}
- const context = superstate.framesIndex.get(path3.basePath);
- return context?.frames[path3.ref];
+ const context = superstate.framesIndex.get(path2.basePath);
+ return context?.frames[path2.ref];
};
-function flattenToFrameNodes(root4, schemaId) {
+function flattenToFrameNodes(root, schemaId) {
const flattenedTree = [];
const ids2 = [];
- function traverseAndFlatten(node2, parent) {
- const id3 = uniqueNameFromString(node2.node.id, ids2);
+ function traverseAndFlatten(node, parent) {
+ const id3 = uniqueNameFromString(node.node.id, ids2);
ids2.push(id3);
- flattenedTree.push({ ...node2.node, id: id3, parentId: parent, schemaId });
- (node2.children ?? []).forEach((child) => {
+ flattenedTree.push({ ...node.node, id: id3, parentId: parent, schemaId });
+ (node.children ?? []).forEach((child) => {
traverseAndFlatten(child, id3);
});
}
- traverseAndFlatten(root4, "");
+ traverseAndFlatten(root, "");
return flattenedTree;
}
-function insertFrameChildren(root4, newChildren) {
- function traverseAndInsert(node2) {
+function insertFrameChildren(root, newChildren) {
+ function traverseAndInsert(node) {
return {
- ...node2,
- children: node2.node.type === "content" && newChildren.length > 0 ? newChildren.map((f2) => ({ ...f2, node: { ...f2.node, parentId: node2.id } })) : node2.children.map((child) => {
+ ...node,
+ children: node.node.type === "content" && newChildren.length > 0 ? newChildren.map((f2) => ({ ...f2, node: { ...f2.node, parentId: node.id } })) : node.children.map((child) => {
return traverseAndInsert(child);
})
};
}
- const newRoot = traverseAndInsert(root4);
+ const newRoot = traverseAndInsert(root);
return newRoot;
}
var expandNode = (treeNode, id3, superstate) => {
@@ -45112,30 +45012,30 @@ var expandNode = (treeNode, id3, superstate) => {
}
return [treeNode, id3];
};
-var expandFrame = (node2, superstate, uniqueID = 0, editorProps) => {
- const [children, lastID] = node2.children.reduce((f2, c3) => {
+var expandFrame = (node, superstate, uniqueID = 0, editorProps) => {
+ const [children, lastID] = node.children.reduce((f2, c3) => {
const [nodes, id3] = f2;
- const _editorProps = calculateEditorProps({ ...editorProps, parentType: node2.node.type, parentLastChildID: node2.children[node2.children.length - 1]?.id }, c3);
+ const _editorProps = calculateEditorProps({ ...editorProps, parentType: node.node.type, parentLastChildID: node.children[node.children.length - 1]?.id }, c3);
const [newNode3, fid] = expandFrame(c3, superstate, id3 + 1, _editorProps);
return [[...nodes, newNode3], fid + 1];
}, [[], uniqueID]);
- const [newNode2, newID] = expandNode({ ...node2, children, editorProps }, lastID, superstate);
+ const [newNode2, newID] = expandNode({ ...node, children, editorProps }, lastID, superstate);
return [{
...newNode2,
editorProps: calculateEditorProps(newNode2.editorProps, newNode2)
}, newID];
};
-var linkProps = (fields, root4) => {
- const props = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: "" }), {});
- const types2 = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3.type }), {});
- const propsValue = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3.value }), {});
- const propsAttrs = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3.attrs }), {});
- return { ...root4, node: {
- ...root4.node,
- props: { ...props, ...root4.node.props },
- types: { ...types2, ...root4.node.types },
- propsValue: { ...propsValue, ...root4.node.propsValue },
- propsAttrs: { ...propsAttrs, ...root4.node.propsAttrs }
+var linkProps = (fields, root) => {
+ const props = fields.reduce((p, c3) => ({ ...p, [c3.name]: "" }), {});
+ const types2 = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3.type }), {});
+ const propsValue = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3.value }), {});
+ const propsAttrs = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3.attrs }), {});
+ return { ...root, node: {
+ ...root.node,
+ props: { ...props, ...root.node.props },
+ types: { ...types2, ...root.node.types },
+ propsValue: { ...propsValue, ...root.node.propsValue },
+ propsAttrs: { ...propsAttrs, ...root.node.propsAttrs }
} };
};
var applyPropsToState = (state, props, rootID) => import_lodash4.default.cloneDeep({
@@ -45173,39 +45073,39 @@ var buildRootFromMDBFrame = (superstate, frame, editorProps = defaultFrameEditor
};
var buildRoot = (schema, fields, nodes, superstate, editorProps = defaultFrameEditorProps) => {
const rootNode = nodes.find((f2) => f2.id == schema.id) ?? schemaToRoot(schema);
- const root4 = buildFrameTree(rootNode, nodes, superstate, nodes.length, false, { ...editorProps, rootId: schema.id })[0];
- return root4 && buildExecutable(linkProps(fields, root4));
+ const root = buildFrameTree(rootNode, nodes, superstate, nodes.length, false, { ...editorProps, rootId: schema.id })[0];
+ return root && buildExecutable(linkProps(fields, root));
};
-var propertiesForNode = (node2) => Object.keys(node2.types).map((f2) => ({
- type: node2.types[f2],
+var propertiesForNode = (node) => Object.keys(node.types).map((f2) => ({
+ type: node.types[f2],
name: f2,
schemaId: f2,
- value: node2.propsValue?.[f2],
- attrs: node2.propsAttrs?.[f2]
+ value: node.propsValue?.[f2],
+ attrs: node.propsAttrs?.[f2]
}));
-var buildFrameTree = (root4, nodes, superstate, uniqueID = 0, isRef, editorProps = defaultFrameEditorProps, dontExpand) => {
- const rootNode = { node: root4, id: root4.id, children: [], isRef, editorProps, parent: null };
- const idToNodeMap = { [root4.id]: rootNode };
- nodes.forEach((node2) => {
- idToNodeMap[node2.id] = { id: node2.id, node: node2, children: [], isRef, editorProps, parent: null };
- });
- nodes.forEach((node2) => {
- if (node2.parentId) {
- idToNodeMap[node2.id].parent = idToNodeMap[node2.parentId];
- const parentNode = idToNodeMap[node2.parentId];
+var buildFrameTree = (root, nodes, superstate, uniqueID = 0, isRef, editorProps = defaultFrameEditorProps, dontExpand) => {
+ const rootNode = { node: root, id: root.id, children: [], isRef, editorProps, parent: null };
+ const idToNodeMap = { [root.id]: rootNode };
+ nodes.forEach((node) => {
+ idToNodeMap[node.id] = { id: node.id, node, children: [], isRef, editorProps, parent: null };
+ });
+ nodes.forEach((node) => {
+ if (node.parentId) {
+ idToNodeMap[node.id].parent = idToNodeMap[node.parentId];
+ const parentNode = idToNodeMap[node.parentId];
if (parentNode) {
- parentNode.children.push({ ...idToNodeMap[node2.id], editorProps: { ...editorProps, parentType: parentNode.node.type, parentLastChildID: parentNode.children[parentNode.children.length - 1]?.id } });
+ parentNode.children.push({ ...idToNodeMap[node.id], editorProps: { ...editorProps, parentType: parentNode.node.type, parentLastChildID: parentNode.children[parentNode.children.length - 1]?.id } });
parentNode.children.sort((a4, b2) => a4.node.rank - b2.node.rank);
}
} else {
- if (node2.id == root4.id)
- rootNode.node = idToNodeMap[node2.id].node;
+ if (node.id == root.id)
+ rootNode.node = idToNodeMap[node.id].node;
}
});
if (dontExpand) {
- return [idToNodeMap[root4.id], uniqueID];
+ return [idToNodeMap[root.id], uniqueID];
}
- const [treeNode, newID] = expandFrame(idToNodeMap[root4.id], superstate, uniqueID, editorProps);
+ const [treeNode, newID] = expandFrame(idToNodeMap[root.id], superstate, uniqueID, editorProps);
return [treeNode, newID];
};
var findParent = (tree, targetId, parentId = null) => {
@@ -45265,21 +45165,21 @@ var valueAliasForType = (type) => {
var nodeToPropValue = (type) => {
return type == "container" || type == "group" || type == "content" || type == "frame" ? {} : { value: JSON.stringify({ alias: valueAliasForType(type) }) };
};
-var rootToFrame = (root4, schemaId) => {
+var rootToFrame = (root, schemaId) => {
if (!schemaId)
- schemaId = root4.node.id;
+ schemaId = root.node.id;
return {
- schema: { id: schemaId, name: root4.node.name, type: "frame", def: JSON.stringify(root4.def) },
- cols: Object.keys(root4.node.types ?? {}).map((f2) => {
+ schema: { id: schemaId, name: root.node.name, type: "frame", def: JSON.stringify(root.def) },
+ cols: Object.keys(root.node.types ?? {}).map((f2) => {
return {
name: f2,
schemaId,
- type: root4.node.types[f2],
- value: root4.node.propsValue?.[f2],
- attrs: root4.node.propsAttrs?.[f2]
+ type: root.node.types[f2],
+ value: root.node.propsValue?.[f2],
+ attrs: root.node.propsAttrs?.[f2]
};
}),
- rows: flattenToFrameNodes({ ...root4, id: schemaId, node: { ...root4.node, id: schemaId } }, schemaId).map((f2) => nodeToFrame(relinkProps("$root", schemaId, f2, schemaId)))
+ rows: flattenToFrameNodes({ ...root, id: schemaId, node: { ...root.node, id: schemaId } }, schemaId).map((f2) => nodeToFrame(relinkProps("$root", schemaId, f2, schemaId)))
};
};
@@ -45310,11 +45210,11 @@ var frameToNode = (frame) => {
propsValue: nodeToPropValue(frame.type)
};
};
-var nodeToFrame = (node2) => {
- const { contexts, styles: styles2, props, actions, ...otherProps } = node2;
+var nodeToFrame = (node) => {
+ const { contexts, styles: styles2, props, actions, ...otherProps } = node;
return {
...otherProps,
- rank: node2.rank?.toString() ?? "0",
+ rank: node.rank?.toString() ?? "0",
contexts: JSON.stringify(contexts),
styles: JSON.stringify(styles2),
actions: JSON.stringify(actions),
@@ -45662,11 +45562,11 @@ var DefaultSpaceCols = [{ name: "space", type: "space", schemaId: "main", value:
}) }];
// src/core/utils/contexts/context.ts
-var contextPathFromPath = (superstate, path3) => {
- const uri = superstate.spaceManager.uriByString(path3);
+var contextPathFromPath = (superstate, path2) => {
+ const uri = superstate.spaceManager.uriByString(path2);
if (!uri)
return null;
- const space3 = uri.basePath;
+ const space2 = uri.basePath;
const spaceState = superstate.spacesIndex.get(uri.basePath);
if (!spaceState)
return null;
@@ -45676,18 +45576,18 @@ var contextPathFromPath = (superstate, path3) => {
let viewName;
if (uri.refType == "frame") {
view = uri.ref;
- const frame = superstate.framesIndex.get(space3);
+ const frame = superstate.framesIndex.get(space2);
if (view && frame) {
viewName = frame.schemas.find((f2) => f2.id == view)?.name;
schema = safelyParseJSON(frame.schemas.find((f2) => f2.id == view)?.def)?.db;
- schemaName = superstate.contextsIndex.get(space3)?.schemas.find((f2) => f2.id == schema)?.name;
+ schemaName = superstate.contextsIndex.get(space2)?.schemas.find((f2) => f2.id == schema)?.name;
}
} else if (uri.refType == "context") {
schema = uri.ref;
- schemaName = superstate.contextsIndex.get(space3)?.schemas.find((f2) => f2.id == schema)?.name;
+ schemaName = superstate.contextsIndex.get(space2)?.schemas.find((f2) => f2.id == schema)?.name;
}
return {
- space: space3,
+ space: space2,
spaceName: spaceState.name,
schema,
schemaName,
@@ -45695,16 +45595,16 @@ var contextPathFromPath = (superstate, path3) => {
viewName
};
};
-var processTable = async (manager, space3, table2, processor) => {
- const contextDB = await manager.readTable(space3.path, table2);
+var processTable = async (manager, space2, table, processor) => {
+ const contextDB = await manager.readTable(space2.path, table);
if (contextDB) {
- await processor(contextDB, space3);
+ await processor(contextDB, space2);
}
};
-var processContext = async (manager, space3, processor) => {
- const contextDB = await manager.contextForSpace(space3.path);
+var processContext = async (manager, space2, processor) => {
+ const contextDB = await manager.contextForSpace(space2.path);
if (contextDB) {
- await processor(contextDB, space3);
+ await processor(contextDB, space2);
}
};
var saveContext = async (manager, spaceInfo, newTable, force) => {
@@ -45732,25 +45632,25 @@ var updateValue = (folder, lookupField, lookupValue, field, value) => {
)
};
};
-var insertRowsIfUnique = (folder, rows, index3) => {
- return { ...folder, rows: index3 ? insertMulti(folder.rows, index3, rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName]))) : [...rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName])), ...folder.rows] };
+var insertRowsIfUnique = (folder, rows, index2) => {
+ return { ...folder, rows: index2 ? insertMulti(folder.rows, index2, rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName]))) : [...rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName])), ...folder.rows] };
};
-var insertRows = (folder, rows, index3) => {
- return { ...folder, rows: index3 ? insertMulti(folder.rows, index3, rows) : [...folder.rows, ...rows] };
+var insertRows = (folder, rows, index2) => {
+ return { ...folder, rows: index2 ? insertMulti(folder.rows, index2, rows) : [...folder.rows, ...rows] };
};
-var updateRowAtIndex = (folder, row2, index3) => {
- return { ...folder, rows: folder.rows.map((f2, i4) => i4 == index3 ? row2 : f2) };
+var updateRowAtIndex = (folder, row2, index2) => {
+ return { ...folder, rows: folder.rows.map((f2, i4) => i4 == index2 ? row2 : f2) };
};
-var updateTableValue = async (manager, space3, schema, index3, field, value, rank) => {
+var updateTableValue = async (manager, space2, schema, index2, field, value, rank) => {
processTable(
manager,
- space3,
+ space2,
schema,
async (f2) => {
let newMDB = {
...f2,
rows: f2.rows.map(
- (f3, i4) => i4 == index3 ? {
+ (f3, i4) => i4 == index2 ? {
...f3,
[field]: value
} : f3
@@ -45759,30 +45659,30 @@ var updateTableValue = async (manager, space3, schema, index3, field, value, ran
if (rank)
newMDB = {
...newMDB,
- rows: arrayMove(newMDB.rows, index3, rank)
+ rows: arrayMove(newMDB.rows, index2, rank)
};
if (!import_lodash5.default.isEqual(f2, newMDB)) {
- await saveContext(manager, space3, newMDB);
+ await saveContext(manager, space2, newMDB);
}
return newMDB;
}
);
};
-var updateContextValue = async (manager, space3, path3, field, value, _updateFunction, rank) => {
- manager.contextForSpace(space3.path).then(
+var updateContextValue = async (manager, space2, path2, field, value, _updateFunction, rank) => {
+ manager.contextForSpace(space2.path).then(
(f2) => {
const updateFunction = _updateFunction ?? updateValue;
- let newMDB = updateFunction(f2, PathPropertyName, path3, field, value);
+ let newMDB = updateFunction(f2, PathPropertyName, path2, field, value);
if (rank)
- newMDB = reorderRowsForPath(newMDB, [path3], rank);
- return saveContext(manager, space3, newMDB).then((f3) => newMDB);
+ newMDB = reorderRowsForPath(newMDB, [path2], rank);
+ return saveContext(manager, space2, newMDB).then((f3) => newMDB);
}
);
};
var insertContextItems = async (manager, newPaths, t5) => {
- const saveNewContextRows = async (tag2, space3) => {
+ const saveNewContextRows = async (tag2, space2) => {
const newRow = newPaths.map((newPath) => ({ [PathPropertyName]: newPath }));
- await saveContext(manager, space3, insertRowsIfUnique(tag2, newRow));
+ await saveContext(manager, space2, insertRowsIfUnique(tag2, newRow));
};
const spaceInfo = manager.spaceInfoForPath(t5);
await manager.contextForSpace(t5).then(
@@ -45790,18 +45690,18 @@ var insertContextItems = async (manager, newPaths, t5) => {
);
};
var getPathProperties = async (superstate, _path, cols) => {
- let path3 = _path;
- if (superstate.spacesIndex.has(path3)) {
- path3 = superstate.spacesIndex.get(path3).defPath;
+ let path2 = _path;
+ if (superstate.spacesIndex.has(path2)) {
+ path2 = superstate.spacesIndex.get(path2).defPath;
}
- const properties3 = await superstate.spaceManager.readProperties(path3);
+ const properties3 = await superstate.spaceManager.readProperties(path2);
if (!properties3)
return {};
- return Object.keys(properties3).reduce((p2, c3) => {
+ return Object.keys(properties3).reduce((p, c3) => {
if (cols.includes(c3)) {
- return { ...p2, [c3]: properties3[c3] };
+ return { ...p, [c3]: properties3[c3] };
}
- return p2;
+ return p;
}, {});
};
var getContextProperties = (superstate, context) => {
@@ -45813,17 +45713,17 @@ var getContextProperties = (superstate, context) => {
}
return superstate.contextsIndex.get(context)?.cols ?? [];
};
-var updateContextWithProperties = async (superstate, path3, spaces2) => {
+var updateContextWithProperties = async (superstate, path2, spaces2) => {
const updatePath = async (mdb) => {
- const objectExists = mdb.rows.some((item) => item[PathPropertyName] === path3);
+ const objectExists = mdb.rows.some((item) => item[PathPropertyName] === path2);
const properties3 = await getPathProperties(
superstate,
- path3,
+ path2,
mdb.cols.map((f2) => f2.name)
);
if (objectExists) {
return mdb.rows.map(
- (f2) => f2[PathPropertyName] == path3 ? {
+ (f2) => f2[PathPropertyName] == path2 ? {
...f2,
...properties3
} : f2
@@ -45832,21 +45732,21 @@ var updateContextWithProperties = async (superstate, path3, spaces2) => {
return [
...mdb.rows,
{
- [PathPropertyName]: path3,
+ [PathPropertyName]: path2,
...properties3
}
];
}
};
- const promises = spaces2.map((space3) => {
- return processContext(superstate.spaceManager, space3, async (mdb, space4) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(superstate.spaceManager, space2, async (mdb, space3) => {
const newRows = await updatePath(mdb);
const newDB = {
...mdb,
rows: newRows
};
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(superstate.spaceManager, space4, newDB);
+ await saveContext(superstate.spaceManager, space3, newDB);
}
return newDB;
});
@@ -45854,23 +45754,23 @@ var updateContextWithProperties = async (superstate, path3, spaces2) => {
await Promise.all(promises);
return;
};
-var updateTableRow = async (manager, space3, table2, index3, row2) => {
- return processTable(manager, space3, table2, async (mdb, space4) => {
- const newDB = updateRowAtIndex(mdb, row2, index3);
+var updateTableRow = async (manager, space2, table, index2, row2) => {
+ return processTable(manager, space2, table, async (mdb, space3) => {
+ const newDB = updateRowAtIndex(mdb, row2, index2);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
};
-var updateValueInContext = async (manager, row2, field, value, space3) => {
+var updateValueInContext = async (manager, row2, field, value, space2) => {
const changeTagInContextMDB = (mdb) => {
return { ...mdb, rows: mdb.rows.map((f2) => f2[PathPropertyName] == row2 ? { ...f2, [field]: value } : f2) };
};
- return processContext(manager, space3, async (mdb, space4) => {
+ return processContext(manager, space2, async (mdb, space3) => {
const newDB = changeTagInContextMDB(mdb);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
@@ -45880,11 +45780,11 @@ var renameTagInContexts = async (manager, oldTag, newTag, spaces2) => {
const cols = mdb.cols.map((f2) => f2.type.startsWith("context") && f2.value == oldTag ? { ...f2, value: newTag } : f2);
return { ...mdb, cols };
};
- const promises = spaces2.map((space3) => {
- return processContext(manager, space3, async (mdb, space4) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(manager, space2, async (mdb, space3) => {
const newDB = changeTagInContextMDB(mdb);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
@@ -45896,61 +45796,61 @@ var removeTagInContexts = async (manager, tag2, spaces2) => {
const cols = mdb.cols.map((f2) => f2.type.startsWith("context") && f2.value == tag2 ? { ...f2, type: "link-multi" } : f2);
return { ...mdb, cols };
};
- const promises = spaces2.map((space3) => {
- return processContext(manager, space3, async (mdb, space4) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(manager, space2, async (mdb, space3) => {
const newDB = deleteTagInContextMDB(mdb);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
});
return Promise.all(promises);
};
-var addRowInTable = async (manager, row2, context, table2, index3) => {
- return processTable(manager, context, table2, async (mdb, space3) => {
- const newDB = insertRows(mdb, [row2], index3);
+var addRowInTable = async (manager, row2, context, table, index2) => {
+ return processTable(manager, context, table, async (mdb, space2) => {
+ const newDB = insertRows(mdb, [row2], index2);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space3, newDB);
+ await saveContext(manager, space2, newDB);
}
return newDB;
});
};
-var deleteRowInTable = async (manager, context, table2, index3) => {
- return processTable(manager, context, table2, async (mdb, space3) => {
- const newDB = { ...mdb, rows: mdb.rows.filter((f2, i4) => i4 != index3) };
+var deleteRowInTable = async (manager, context, table, index2) => {
+ return processTable(manager, context, table, async (mdb, space2) => {
+ const newDB = { ...mdb, rows: mdb.rows.filter((f2, i4) => i4 != index2) };
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space3, newDB);
+ await saveContext(manager, space2, newDB);
}
return newDB;
});
};
var renameLinkInContexts = async (manager, oldPath, newPath, spaces2) => {
- const promises = spaces2.map((space3) => {
- return processContext(manager, space3, async (mdb, space4) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(manager, space2, async (mdb, space3) => {
const linkCols = linkColumns(mdb.cols);
const newDB = {
...mdb,
rows: mdb.rows.map((r2) => renameLinksInRow(manager, r2, oldPath, newPath, linkCols))
};
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
});
return Promise.all(promises);
};
-var removeLinkInContexts = async (manager, path3, spaces2) => {
- const promises = spaces2.map((space3) => {
- return processContext(manager, space3, async (mdb, space4) => {
+var removeLinkInContexts = async (manager, path2, spaces2) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(manager, space2, async (mdb, space3) => {
const linkCols = linkColumns(mdb.cols);
const newDB = {
...mdb,
- rows: mdb.rows.map((r2) => removeLinksInRow(manager, r2, path3, linkCols))
+ rows: mdb.rows.map((r2) => removeLinksInRow(manager, r2, path2, linkCols))
};
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
@@ -45958,40 +45858,40 @@ var removeLinkInContexts = async (manager, path3, spaces2) => {
return Promise.all(promises);
};
var renamePathInContexts = async (manager, oldPath, newPath, spaces2) => {
- const promises = spaces2.map((space3) => {
- return processContext(manager, space3, async (mdb, space4) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(manager, space2, async (mdb, space3) => {
const newDB = renameRowForPath(mdb, oldPath, newPath);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
});
return Promise.all(promises);
};
-var removePathInContexts = async (manager, path3, spaces2) => {
- const promises = spaces2.map((space3) => {
- return processContext(manager, space3, async (mdb, space4) => {
- const newDB = removeRowForPath(mdb, path3);
+var removePathInContexts = async (manager, path2, spaces2) => {
+ const promises = spaces2.map((space2) => {
+ return processContext(manager, space2, async (mdb, space3) => {
+ const newDB = removeRowForPath(mdb, path2);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
- await saveContext(manager, space4, newDB);
+ await saveContext(manager, space3, newDB);
}
return newDB;
});
});
return Promise.all(promises);
};
-var reorderPathsInContext = async (manager, paths, index3, space3) => {
- return processContext(manager, space3, async (mdb, context) => {
- const newDB = reorderRowsForPath(mdb, paths, index3);
+var reorderPathsInContext = async (manager, paths, index2, space2) => {
+ return processContext(manager, space2, async (mdb, context) => {
+ const newDB = reorderRowsForPath(mdb, paths, index2);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
await saveContext(manager, context, newDB, true);
}
return newDB;
});
};
-var removePathsInContext = async (manager, paths, space3) => {
- return processContext(manager, space3, async (mdb, context) => {
+var removePathsInContext = async (manager, paths, space2) => {
+ return processContext(manager, space2, async (mdb, context) => {
const newDB = removeRowsForPath(mdb, paths);
if (!import_lodash5.default.isEqual(mdb, newDB)) {
await saveContext(manager, context, newDB);
@@ -46073,13 +45973,13 @@ var import_react8 = __toESM(require_react());
// src/utils/stickers.ts
var emojiFromString = (emoji) => {
- let html7;
+ let html;
try {
- html7 = unifiedToNative(emoji);
+ html = unifiedToNative(emoji);
} catch {
- html7 = emoji;
+ html = emoji;
}
- return html7;
+ return html;
};
function parseStickerString(input) {
if (!input) {
@@ -46092,8 +45992,8 @@ function parseStickerString(input) {
return ["", input];
}
}
-var unifiedToNative = (unified2) => {
- const unicodes = unified2.split("-");
+var unifiedToNative = (unified) => {
+ const unicodes = unified.split("-");
const codePoints = unicodes.map((u3) => `0x${u3}`);
return String.fromCodePoint(...codePoints);
};
@@ -46121,7 +46021,7 @@ var StickerModal = (props) => {
);
const [page, setPage] = (0, import_react8.useState)(1);
const loadNextPage = (0, import_react8.useCallback)(() => {
- setPage((p2) => p2 + 1);
+ setPage((p) => p + 1);
}, [page]);
const loaderRef = (0, import_react8.useRef)(null);
(0, import_react8.useEffect)(() => {
@@ -46211,9 +46111,9 @@ function _extends() {
_extends = Object.assign ? Object.assign.bind() : function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
- for (var key3 in source) {
- if (Object.prototype.hasOwnProperty.call(source, key3)) {
- target[key3] = source[key3];
+ for (var key2 in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key2)) {
+ target[key2] = source[key2];
}
}
}
@@ -46324,8 +46224,8 @@ function isConditionalNode(x2) {
function isConstantNode(x2) {
return x2 && x2.isConstantNode === true && x2.constructor.prototype.isNode === true || false;
}
-function rule2Node(node2) {
- return isConstantNode(node2) || isOperatorNode(node2) && node2.args.length === 1 && isConstantNode(node2.args[0]) && "-+~".includes(node2.op);
+function rule2Node(node) {
+ return isConstantNode(node) || isOperatorNode(node) && node.args.length === 1 && isConstantNode(node.args[0]) && "-+~".includes(node.op);
}
function isFunctionAssignmentNode(x2) {
return x2 && x2.isFunctionAssignmentNode === true && x2.constructor.prototype.isNode === true || false;
@@ -46399,9 +46299,9 @@ function clone(x2) {
}
function mapObject(object, callback) {
var clone5 = {};
- for (var key3 in object) {
- if (hasOwnProperty2(object, key3)) {
- clone5[key3] = callback(object[key3]);
+ for (var key2 in object) {
+ if (hasOwnProperty2(object, key2)) {
+ clone5[key2] = callback(object[key2]);
}
}
return clone5;
@@ -46519,16 +46419,16 @@ function isLegacyFactory(object) {
function pickShallow(object, properties3) {
var copy = {};
for (var i4 = 0; i4 < properties3.length; i4++) {
- var key3 = properties3[i4];
- var value = object[key3];
+ var key2 = properties3[i4];
+ var value = object[key2];
if (value !== void 0) {
- copy[key3] = value;
+ copy[key2] = value;
}
}
return copy;
}
function values(object) {
- return Object.keys(object).map((key3) => object[key3]);
+ return Object.keys(object).map((key2) => object[key2]);
}
// node_modules/mathjs/lib/esm/core/function/config.js
@@ -46551,9 +46451,9 @@ function configFactory(config4, emit) {
}
_config.MATRIX_OPTIONS = MATRIX_OPTIONS;
_config.NUMBER_OPTIONS = NUMBER_OPTIONS;
- Object.keys(DEFAULT_CONFIG).forEach((key3) => {
- Object.defineProperty(_config, key3, {
- get: () => config4[key3],
+ Object.keys(DEFAULT_CONFIG).forEach((key2) => {
+ Object.defineProperty(_config, key2, {
+ get: () => config4[key2],
enumerable: true,
configurable: true
});
@@ -46995,13 +46895,13 @@ var cbrt = Math.cbrt || function cbrt2(x2) {
var expm1 = Math.expm1 || function expm12(x2) {
return x2 >= 2e-4 || x2 <= -2e-4 ? Math.exp(x2) - 1 : x2 + x2 * x2 / 2 + x2 * x2 * x2 / 6;
};
-function formatNumberToBase(n3, base3, size2) {
+function formatNumberToBase(n3, base2, size2) {
var prefixes = {
2: "0b",
8: "0o",
16: "0x"
};
- var prefix = prefixes[base3];
+ var prefix = prefixes[base2];
var suffix = "";
if (size2) {
if (size2 < 1) {
@@ -47026,7 +46926,7 @@ function formatNumberToBase(n3, base3, size2) {
n3 = -n3;
sign4 = "-";
}
- return "".concat(sign4).concat(prefix).concat(n3.toString(base3)).concat(suffix);
+ return "".concat(sign4).concat(prefix).concat(n3.toString(base2)).concat(suffix);
}
function format2(value, options) {
if (typeof options === "function") {
@@ -47163,17 +47063,17 @@ function toFixed(value, precision) {
var splitValue = splitNumber(value);
var rounded = typeof precision === "number" ? roundDigits(splitValue, splitValue.exponent + 1 + precision) : splitValue;
var c3 = rounded.coefficients;
- var p2 = rounded.exponent + 1;
- var pp2 = p2 + (precision || 0);
+ var p = rounded.exponent + 1;
+ var pp2 = p + (precision || 0);
if (c3.length < pp2) {
c3 = c3.concat(zeros(pp2 - c3.length));
}
- if (p2 < 0) {
- c3 = zeros(-p2 + 1).concat(c3);
- p2 = 1;
+ if (p < 0) {
+ c3 = zeros(-p + 1).concat(c3);
+ p = 1;
}
- if (p2 < c3.length) {
- c3.splice(p2, 0, p2 === 0 ? "0." : ".");
+ if (p < c3.length) {
+ c3.splice(p, 0, p === 0 ? "0." : ".");
}
return rounded.sign + c3.join("");
}
@@ -47322,7 +47222,7 @@ function _toNumberOrDefault(value, defaultValue2) {
}
// node_modules/mathjs/lib/esm/utils/bignumber/formatter.js
-function formatBigNumberToBase(n3, base3, size2) {
+function formatBigNumberToBase(n3, base2, size2) {
var BigNumberCtor = n3.constructor;
var big2 = new BigNumberCtor(2);
var suffix = "";
@@ -47344,7 +47244,7 @@ function formatBigNumberToBase(n3, base3, size2) {
}
suffix = "i".concat(size2);
}
- switch (base3) {
+ switch (base2) {
case 2:
return "".concat(n3.toBinary()).concat(suffix);
case 8:
@@ -47352,7 +47252,7 @@ function formatBigNumberToBase(n3, base3, size2) {
case 16:
return "".concat(n3.toHexadecimal()).concat(suffix);
default:
- throw new Error("Base ".concat(base3, " not supported "));
+ throw new Error("Base ".concat(base2, " not supported "));
}
}
function format3(value, options) {
@@ -47435,10 +47335,10 @@ function _toNumberOrDefault2(value, defaultValue2) {
}
// node_modules/mathjs/lib/esm/utils/string.js
-function endsWith(text7, search3) {
- var start = text7.length - search3.length;
- var end = text7.length;
- return text7.substring(start, end) === search3;
+function endsWith(text2, search2) {
+ var start = text2.length - search2.length;
+ var end = text2.length;
+ return text2.substring(start, end) === search2;
}
function format4(value, options) {
var result = _format(value, options);
@@ -47476,8 +47376,8 @@ function _format(value, options) {
} else if (value && value.toString(options) !== {}.toString()) {
return value.toString(options);
} else {
- var entries = Object.keys(value).map((key3) => {
- return stringify2(key3) + ": " + format4(value[key3], options);
+ var entries = Object.keys(value).map((key2) => {
+ return stringify2(key2) + ": " + format4(value[key2], options);
});
return "{" + entries.join(", ") + "}";
}
@@ -47485,11 +47385,11 @@ function _format(value, options) {
return String(value);
}
function stringify2(value) {
- var text7 = String(value);
+ var text2 = String(value);
var escaped = "";
var i4 = 0;
- while (i4 < text7.length) {
- var c3 = text7.charAt(i4);
+ while (i4 < text2.length) {
+ var c3 = text2.charAt(i4);
escaped += c3 in controlCharacters ? controlCharacters[c3] : c3;
i4++;
}
@@ -47505,9 +47405,9 @@ var controlCharacters = {
" ": "\\t"
};
function escape(value) {
- var text7 = String(value);
- text7 = text7.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">");
- return text7;
+ var text2 = String(value);
+ text2 = text2.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">");
+ return text2;
}
function formatArray(array, options) {
if (Array.isArray(array)) {
@@ -47555,11 +47455,11 @@ DimensionError.prototype.name = "DimensionError";
DimensionError.prototype.isDimensionError = true;
// node_modules/mathjs/lib/esm/error/IndexError.js
-function IndexError(index3, min5, max5) {
+function IndexError(index2, min5, max5) {
if (!(this instanceof IndexError)) {
throw new SyntaxError("Constructor must be called with the new operator");
}
- this.index = index3;
+ this.index = index2;
if (arguments.length < 3) {
this.min = 0;
this.max = min5;
@@ -47623,28 +47523,28 @@ function validate(array, size2) {
_validate(array, size2, 0);
}
}
-function validateIndexSourceSize(value, index3) {
+function validateIndexSourceSize(value, index2) {
var valueSize = value.isMatrix ? value._size : arraySize(value);
- var sourceSize = index3._sourceSize;
+ var sourceSize = index2._sourceSize;
sourceSize.forEach((sourceDim, i4) => {
if (sourceDim !== null && sourceDim !== valueSize[i4]) {
throw new DimensionError(sourceDim, valueSize[i4]);
}
});
}
-function validateIndex(index3, length) {
- if (index3 !== void 0) {
- if (!isNumber(index3) || !isInteger(index3)) {
- throw new TypeError("Index must be an integer (value: " + index3 + ")");
+function validateIndex(index2, length) {
+ if (index2 !== void 0) {
+ if (!isNumber(index2) || !isInteger(index2)) {
+ throw new TypeError("Index must be an integer (value: " + index2 + ")");
}
- if (index3 < 0 || typeof length === "number" && index3 >= length) {
- throw new IndexError(index3, length);
+ if (index2 < 0 || typeof length === "number" && index2 >= length) {
+ throw new IndexError(index2, length);
}
}
}
-function isEmptyIndex(index3) {
- for (var i4 = 0; i4 < index3._dimensions.length; ++i4) {
- var dimension = index3._dimensions[i4];
+function isEmptyIndex(index2) {
+ for (var i4 = 0; i4 < index2._dimensions.length; ++i4) {
+ var dimension = index2._dimensions[i4];
if (dimension._data && isArray2(dimension._data)) {
if (dimension._size[0] === 0) {
return true;
@@ -48020,11 +47920,11 @@ function clone2(array) {
}
// node_modules/mathjs/lib/esm/utils/factory.js
-function factory(name317, dependencies314, create3, meta3) {
+function factory(name317, dependencies314, create2, meta3) {
function assertAndCreate(scope) {
var deps = pickShallow(scope, dependencies314.map(stripOptionalNotation));
assertDependencies(name317, dependencies314, scope);
- return create3(deps);
+ return create2(deps);
}
assertAndCreate.isFactory = true;
assertAndCreate.fn = name317;
@@ -48132,30 +48032,30 @@ var ObjectWrappingMap = class {
keys() {
return Object.keys(this.wrappedObject).values();
}
- get(key3) {
- return getSafeProperty(this.wrappedObject, key3);
+ get(key2) {
+ return getSafeProperty(this.wrappedObject, key2);
}
- set(key3, value) {
- setSafeProperty(this.wrappedObject, key3, value);
+ set(key2, value) {
+ setSafeProperty(this.wrappedObject, key2, value);
return this;
}
- has(key3) {
- return hasSafeProperty(this.wrappedObject, key3);
+ has(key2) {
+ return hasSafeProperty(this.wrappedObject, key2);
}
entries() {
- return mapIterator(this.keys(), (key3) => [key3, this.get(key3)]);
+ return mapIterator(this.keys(), (key2) => [key2, this.get(key2)]);
}
forEach(callback) {
- for (var key3 of this.keys()) {
- callback(this.get(key3), key3, this);
+ for (var key2 of this.keys()) {
+ callback(this.get(key2), key2, this);
}
}
- delete(key3) {
- delete this.wrappedObject[key3];
+ delete(key2) {
+ delete this.wrappedObject[key2];
}
clear() {
- for (var key3 of this.keys()) {
- this.delete(key3);
+ for (var key2 of this.keys()) {
+ this.delete(key2);
}
}
get size() {
@@ -48169,33 +48069,33 @@ var PartitionedMap = class {
this.bKeys = bKeys;
this[Symbol.iterator] = this.entries;
}
- get(key3) {
- return this.bKeys.has(key3) ? this.b.get(key3) : this.a.get(key3);
+ get(key2) {
+ return this.bKeys.has(key2) ? this.b.get(key2) : this.a.get(key2);
}
- set(key3, value) {
- if (this.bKeys.has(key3)) {
- this.b.set(key3, value);
+ set(key2, value) {
+ if (this.bKeys.has(key2)) {
+ this.b.set(key2, value);
} else {
- this.a.set(key3, value);
+ this.a.set(key2, value);
}
return this;
}
- has(key3) {
- return this.b.has(key3) || this.a.has(key3);
+ has(key2) {
+ return this.b.has(key2) || this.a.has(key2);
}
keys() {
return (/* @__PURE__ */ new Set([...this.a.keys(), ...this.b.keys()]))[Symbol.iterator]();
}
entries() {
- return mapIterator(this.keys(), (key3) => [key3, this.get(key3)]);
+ return mapIterator(this.keys(), (key2) => [key2, this.get(key2)]);
}
forEach(callback) {
- for (var key3 of this.keys()) {
- callback(this.get(key3), key3, this);
+ for (var key2 of this.keys()) {
+ callback(this.get(key2), key2, this);
}
}
- delete(key3) {
- return this.bKeys.has(key3) ? this.b.delete(key3) : this.a.delete(key3);
+ delete(key2) {
+ return this.bKeys.has(key2) ? this.b.delete(key2) : this.a.delete(key2);
}
clear() {
this.a.clear();
@@ -48231,14 +48131,14 @@ function createMap(mapOrObject) {
}
throw new Error("createMap can create maps from objects or Maps");
}
-function toObject(map6) {
- if (map6 instanceof ObjectWrappingMap) {
- return map6.wrappedObject;
+function toObject(map4) {
+ if (map4 instanceof ObjectWrappingMap) {
+ return map4.wrappedObject;
}
var object = {};
- for (var key3 of map6.keys()) {
- var value = map6.get(key3);
- setSafeProperty(object, key3, value);
+ for (var key2 of map4.keys()) {
+ var value = map4.get(key2);
+ setSafeProperty(object, key2, value);
}
return object;
}
@@ -48429,7 +48329,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
typed3.addConversions([{
from: "number",
to: "BigNumber",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!BigNumber2) {
throwNoBignumber(x2);
}
@@ -48441,7 +48341,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "number",
to: "Complex",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!Complex3) {
throwNoComplex(x2);
}
@@ -48450,7 +48350,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "BigNumber",
to: "Complex",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!Complex3) {
throwNoComplex(x2);
}
@@ -48459,13 +48359,13 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "Fraction",
to: "BigNumber",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
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 convert2(x2) {
+ convert: function convert(x2) {
if (!Complex3) {
throwNoComplex(x2);
}
@@ -48474,7 +48374,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "number",
to: "Fraction",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!Fraction3) {
throwNoFraction(x2);
}
@@ -48487,7 +48387,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "string",
to: "number",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
var n3 = Number(x2);
if (isNaN(n3)) {
throw new Error('Cannot convert "' + x2 + '" to a number');
@@ -48497,7 +48397,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "string",
to: "BigNumber",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!BigNumber2) {
throwNoBignumber(x2);
}
@@ -48510,7 +48410,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "string",
to: "Fraction",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!Fraction3) {
throwNoFraction(x2);
}
@@ -48523,7 +48423,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "string",
to: "Complex",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!Complex3) {
throwNoComplex(x2);
}
@@ -48536,13 +48436,13 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "boolean",
to: "number",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
return +x2;
}
}, {
from: "boolean",
to: "BigNumber",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!BigNumber2) {
throwNoBignumber(x2);
}
@@ -48551,7 +48451,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "boolean",
to: "Fraction",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
if (!Fraction3) {
throwNoFraction(x2);
}
@@ -48560,13 +48460,13 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "boolean",
to: "string",
- convert: function convert2(x2) {
+ convert: function convert(x2) {
return String(x2);
}
}, {
from: "Array",
to: "Matrix",
- convert: function convert2(array) {
+ convert: function convert(array) {
if (!DenseMatrix2) {
throwNoMatrix();
}
@@ -48575,7 +48475,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create
}, {
from: "Matrix",
to: "Array",
- convert: function convert2(matrix2) {
+ convert: function convert(matrix2) {
return matrix2.valueOf();
}
}]);
@@ -48823,11 +48723,11 @@ P.greaterThanOrEqualTo = P.gte = function(y3) {
return k2 == 1 || k2 === 0;
};
P.hyperbolicCosine = P.cosh = function() {
- var k2, n3, pr, rm, len, x2 = this, Ctor = x2.constructor, one5 = new Ctor(1);
+ var k2, n3, pr, rm, len, x2 = this, Ctor = x2.constructor, one = new Ctor(1);
if (!x2.isFinite())
return new Ctor(x2.s ? 1 / 0 : NaN);
if (x2.isZero())
- return one5;
+ return one;
pr = Ctor.precision;
rm = Ctor.rounding;
Ctor.precision = pr + Math.max(x2.e, x2.sd()) + 4;
@@ -48844,7 +48744,7 @@ P.hyperbolicCosine = P.cosh = function() {
var cosh2_x, i4 = k2, d8 = new Ctor(8);
for (; i4--; ) {
cosh2_x = x2.times(x2);
- x2 = one5.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
+ x2 = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
}
return finalise(x2, Ctor.precision = pr, Ctor.rounding = rm, true);
};
@@ -49041,17 +48941,17 @@ P.lessThan = P.lt = function(y3) {
P.lessThanOrEqualTo = P.lte = function(y3) {
return this.cmp(y3) < 1;
};
-P.logarithm = P.log = function(base3) {
+P.logarithm = P.log = function(base2) {
var isBase10, d4, denominator, k2, inf, num, sd, r2, arg2 = this, Ctor = arg2.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5;
- if (base3 == null) {
- base3 = new Ctor(10);
+ if (base2 == null) {
+ base2 = new Ctor(10);
isBase10 = true;
} else {
- base3 = new Ctor(base3);
- d4 = base3.d;
- if (base3.s < 0 || !d4 || !d4[0] || base3.eq(1))
+ base2 = new Ctor(base2);
+ d4 = base2.d;
+ if (base2.s < 0 || !d4 || !d4[0] || base2.eq(1))
return new Ctor(NaN);
- isBase10 = base3.eq(10);
+ isBase10 = base2.eq(10);
}
d4 = arg2.d;
if (arg2.s < 0 || !d4 || !d4[0] || arg2.eq(1)) {
@@ -49069,13 +48969,13 @@ P.logarithm = P.log = function(base3) {
external = false;
sd = pr + guard;
num = naturalLogarithm(arg2, sd);
- denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base3, sd);
+ denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base2, sd);
r2 = divide(num, denominator, sd, 1);
if (checkRoundingDigits(r2.d, k2 = pr, rm)) {
do {
sd += 10;
num = naturalLogarithm(arg2, sd);
- denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base3, sd);
+ denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base2, sd);
r2 = divide(num, denominator, sd, 1);
if (!inf) {
if (+digitsToString(r2.d).slice(k2 + 1, k2 + 15) + 1 == 1e14) {
@@ -49751,12 +49651,12 @@ function cosine(Ctor, x2) {
return x2;
}
var divide = function() {
- function multiplyInteger(x2, k2, base3) {
+ function multiplyInteger(x2, k2, base2) {
var temp, carry = 0, i4 = x2.length;
for (x2 = x2.slice(); i4--; ) {
temp = x2[i4] * k2 + carry;
- x2[i4] = temp % base3 | 0;
- carry = temp / base3 | 0;
+ x2[i4] = temp % base2 | 0;
+ carry = temp / base2 | 0;
}
if (carry)
x2.unshift(carry);
@@ -49776,28 +49676,28 @@ var divide = function() {
}
return r2;
}
- function subtract3(a4, b2, aL, base3) {
+ function subtract3(a4, b2, aL, base2) {
var i4 = 0;
for (; aL--; ) {
a4[aL] -= i4;
i4 = a4[aL] < b2[aL] ? 1 : 0;
- a4[aL] = i4 * base3 + a4[aL] - b2[aL];
+ a4[aL] = i4 * base2 + a4[aL] - b2[aL];
}
for (; !a4[0] && a4.length > 1; )
a4.shift();
}
- return function(x2, y3, pr, rm, dp, base3) {
+ return function(x2, y3, pr, rm, dp, base2) {
var cmp, e5, i4, k2, logBase, more, prod2, prodL, q2, qd, rem, remL, rem0, sd, t5, xi, xL, yd0, yL, yz, Ctor = x2.constructor, sign4 = x2.s == y3.s ? 1 : -1, xd = x2.d, yd = y3.d;
if (!xd || !xd[0] || !yd || !yd[0]) {
return new Ctor(
!x2.s || !y3.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : xd && xd[0] == 0 || !yd ? sign4 * 0 : sign4 / 0
);
}
- if (base3) {
+ if (base2) {
logBase = 1;
e5 = x2.e - y3.e;
} else {
- base3 = BASE;
+ base2 = BASE;
logBase = LOG_BASE;
e5 = mathfloor(x2.e / logBase) - mathfloor(y3.e / logBase);
}
@@ -49828,16 +49728,16 @@ var divide = function() {
yd = yd[0];
sd++;
for (; (i4 < xL || k2) && sd--; i4++) {
- t5 = k2 * base3 + (xd[i4] || 0);
+ t5 = k2 * base2 + (xd[i4] || 0);
qd[i4] = t5 / yd | 0;
k2 = t5 % yd | 0;
}
more = k2 || i4 < xL;
} else {
- k2 = base3 / (yd[0] + 1) | 0;
+ k2 = base2 / (yd[0] + 1) | 0;
if (k2 > 1) {
- yd = multiplyInteger(yd, k2, base3);
- xd = multiplyInteger(xd, k2, base3);
+ yd = multiplyInteger(yd, k2, base2);
+ xd = multiplyInteger(xd, k2, base2);
yL = yd.length;
xL = xd.length;
}
@@ -49849,7 +49749,7 @@ var divide = function() {
yz = yd.slice();
yz.unshift(0);
yd0 = yd[0];
- if (yd[1] >= base3 / 2)
+ if (yd[1] >= base2 / 2)
++yd0;
do {
k2 = 0;
@@ -49857,18 +49757,18 @@ var divide = function() {
if (cmp < 0) {
rem0 = rem[0];
if (yL != remL)
- rem0 = rem0 * base3 + (rem[1] || 0);
+ rem0 = rem0 * base2 + (rem[1] || 0);
k2 = rem0 / yd0 | 0;
if (k2 > 1) {
- if (k2 >= base3)
- k2 = base3 - 1;
- prod2 = multiplyInteger(yd, k2, base3);
+ if (k2 >= base2)
+ k2 = base2 - 1;
+ prod2 = multiplyInteger(yd, k2, base2);
prodL = prod2.length;
remL = rem.length;
cmp = compare2(prod2, rem, prodL, remL);
if (cmp == 1) {
k2--;
- subtract3(prod2, yL < prodL ? yz : yd, prodL, base3);
+ subtract3(prod2, yL < prodL ? yz : yd, prodL, base2);
}
} else {
if (k2 == 0)
@@ -49878,13 +49778,13 @@ var divide = function() {
prodL = prod2.length;
if (prodL < remL)
prod2.unshift(0);
- subtract3(rem, prod2, remL, base3);
+ subtract3(rem, prod2, remL, base2);
if (cmp == -1) {
remL = rem.length;
cmp = compare2(yd, rem, yL, remL);
if (cmp < 1) {
k2++;
- subtract3(rem, yL < remL ? yz : yd, remL, base3);
+ subtract3(rem, yL < remL ? yz : yd, remL, base2);
}
}
remL = rem.length;
@@ -50284,7 +50184,7 @@ function parseDecimal(x2, str) {
return x2;
}
function parseOther(x2, str) {
- var base3, Ctor, divisor, i4, isFloat, len, p2, xd, xe;
+ var base2, Ctor, divisor, i4, isFloat, len, p, xd, xe;
if (str.indexOf("_") > -1) {
str = str.replace(/(\d)_(?=\d)/g, "$1");
if (isDecimal.test(str))
@@ -50297,18 +50197,18 @@ function parseOther(x2, str) {
return x2;
}
if (isHex.test(str)) {
- base3 = 16;
+ base2 = 16;
str = str.toLowerCase();
} else if (isBinary.test(str)) {
- base3 = 2;
+ base2 = 2;
} else if (isOctal.test(str)) {
- base3 = 8;
+ base2 = 8;
} else {
throw Error(invalidArgument + str);
}
i4 = str.search(/p/i);
if (i4 > 0) {
- p2 = +str.slice(i4 + 1);
+ p = +str.slice(i4 + 1);
str = str.substring(2, i4);
} else {
str = str.slice(2);
@@ -50320,9 +50220,9 @@ function parseOther(x2, str) {
str = str.replace(".", "");
len = str.length;
i4 = len - i4;
- divisor = intPow(Ctor, new Ctor(base3), i4, i4 * 2);
+ divisor = intPow(Ctor, new Ctor(base2), i4, i4 * 2);
}
- xd = convertBase(str, base3, BASE);
+ xd = convertBase(str, base2, BASE);
xe = xd.length - 1;
for (i4 = xe; xd[i4] === 0; --i4)
xd.pop();
@@ -50333,8 +50233,8 @@ function parseOther(x2, str) {
external = false;
if (isFloat)
x2 = divide(x2, divisor, len * 4);
- if (p2)
- x2 = x2.times(Math.abs(p2) < 54 ? mathpow(2, p2) : Decimal.pow(2, p2));
+ if (p)
+ x2 = x2.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
external = true;
return x2;
}
@@ -50407,7 +50307,7 @@ function toLessThanHalfPi(Ctor, x2) {
return x2.minus(pi3).abs();
}
function toStringBinary(x2, baseOut, sd, rm) {
- var base3, e5, i4, k2, len, roundUp, str, xd, y3, Ctor = x2.constructor, isExp = sd !== void 0;
+ var base2, e5, i4, k2, len, roundUp, str, xd, y3, Ctor = x2.constructor, isExp = sd !== void 0;
if (isExp) {
checkInt32(sd, 1, MAX_DIGITS);
if (rm === void 0)
@@ -50424,23 +50324,23 @@ function toStringBinary(x2, baseOut, sd, rm) {
str = finiteToString(x2);
i4 = str.indexOf(".");
if (isExp) {
- base3 = 2;
+ base2 = 2;
if (baseOut == 16) {
sd = sd * 4 - 3;
} else if (baseOut == 8) {
sd = sd * 3 - 2;
}
} else {
- base3 = baseOut;
+ base2 = baseOut;
}
if (i4 >= 0) {
str = str.replace(".", "");
y3 = new Ctor(1);
y3.e = str.length - i4;
- y3.d = convertBase(finiteToString(y3), 10, base3);
+ y3.d = convertBase(finiteToString(y3), 10, base2);
y3.e = y3.d.length;
}
- xd = convertBase(str, 10, base3);
+ xd = convertBase(str, 10, base2);
e5 = len = xd.length;
for (; xd[--len] == 0; )
xd.pop();
@@ -50453,18 +50353,18 @@ function toStringBinary(x2, baseOut, sd, rm) {
x2 = new Ctor(x2);
x2.d = xd;
x2.e = e5;
- x2 = divide(x2, y3, sd, rm, 0, base3);
+ x2 = divide(x2, y3, sd, rm, 0, base2);
xd = x2.d;
e5 = x2.e;
roundUp = inexact;
}
i4 = xd[sd];
- k2 = base3 / 2;
+ k2 = base2 / 2;
roundUp = roundUp || xd[sd + 1] !== void 0;
roundUp = rm < 4 ? (i4 !== void 0 || roundUp) && (rm === 0 || rm === (x2.s < 0 ? 3 : 2)) : i4 > k2 || i4 === k2 && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x2.s < 0 ? 8 : 7));
xd.length = sd;
if (roundUp) {
- for (; ++xd[--sd] > base3 - 1; ) {
+ for (; ++xd[--sd] > base2 - 1; ) {
xd[sd] = 0;
if (!sd) {
++e5;
@@ -50482,7 +50382,7 @@ function toStringBinary(x2, baseOut, sd, rm) {
i4 = baseOut == 16 ? 4 : 3;
for (--len; len % i4; len++)
str += "0";
- xd = convertBase(str, base3, baseOut);
+ xd = convertBase(str, base2, baseOut);
for (len = xd.length; !xd[len - 1]; --len)
;
for (i4 = 1, str = "1."; i4 < len; i4++)
@@ -50578,7 +50478,7 @@ function clamp(x2, min5, max5) {
function config3(obj) {
if (!obj || typeof obj !== "object")
throw Error(decimalError + "Object expected");
- var i4, p2, v2, useDefaults = obj.defaults === true, ps = [
+ var i4, p, v2, useDefaults = obj.defaults === true, ps = [
"precision",
1,
MAX_DIGITS,
@@ -50602,30 +50502,30 @@ function config3(obj) {
9
];
for (i4 = 0; i4 < ps.length; i4 += 3) {
- if (p2 = ps[i4], useDefaults)
- this[p2] = DEFAULTS[p2];
- if ((v2 = obj[p2]) !== void 0) {
+ if (p = ps[i4], useDefaults)
+ this[p] = DEFAULTS[p];
+ if ((v2 = obj[p]) !== void 0) {
if (mathfloor(v2) === v2 && v2 >= ps[i4 + 1] && v2 <= ps[i4 + 2])
- this[p2] = v2;
+ this[p] = v2;
else
- throw Error(invalidArgument + p2 + ": " + v2);
+ throw Error(invalidArgument + p + ": " + v2);
}
}
- if (p2 = "crypto", useDefaults)
- this[p2] = DEFAULTS[p2];
- if ((v2 = obj[p2]) !== void 0) {
+ if (p = "crypto", useDefaults)
+ this[p] = DEFAULTS[p];
+ if ((v2 = obj[p]) !== void 0) {
if (v2 === true || v2 === false || v2 === 0 || v2 === 1) {
if (v2) {
if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
- this[p2] = true;
+ this[p] = true;
} else {
throw Error(cryptoUnavailable);
}
} else {
- this[p2] = false;
+ this[p] = false;
}
} else {
- throw Error(invalidArgument + p2 + ": " + v2);
+ throw Error(invalidArgument + p + ": " + v2);
}
}
return this;
@@ -50637,7 +50537,7 @@ function cosh2(x2) {
return new this(x2).cosh();
}
function clone3(obj) {
- var i4, p2, ps;
+ var i4, p, ps;
function Decimal2(v2) {
var e5, i5, t5, x2 = this;
if (!(x2 instanceof Decimal2))
@@ -50774,8 +50674,8 @@ function clone3(obj) {
if (obj.defaults !== true) {
ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"];
for (i4 = 0; i4 < ps.length; )
- if (!obj.hasOwnProperty(p2 = ps[i4++]))
- obj[p2] = this[p2];
+ if (!obj.hasOwnProperty(p = ps[i4++]))
+ obj[p] = this[p];
}
}
Decimal2.config(obj);
@@ -51173,10 +51073,10 @@ var createRangeClass = /* @__PURE__ */ factory(name6, dependencies6, () => {
var nums = args.map(function(arg2) {
return parseFloat(arg2);
});
- var invalid4 = nums.some(function(num) {
+ var invalid2 = nums.some(function(num) {
return isNaN(num);
});
- if (invalid4) {
+ if (invalid2) {
return null;
}
switch (nums.length) {
@@ -51252,15 +51152,15 @@ var createRangeClass = /* @__PURE__ */ factory(name6, dependencies6, () => {
};
Range3.prototype.map = function(callback) {
var array = [];
- this.forEach(function(value, index3, obj) {
- array[index3[0]] = callback(value, index3, obj);
+ this.forEach(function(value, index2, obj) {
+ array[index2[0]] = callback(value, index2, obj);
});
return array;
};
Range3.prototype.toArray = function() {
var array = [];
- this.forEach(function(value, index3) {
- array[index3[0]] = value;
+ this.forEach(function(value, index2) {
+ array[index2[0]] = value;
});
return array;
};
@@ -51311,16 +51211,16 @@ var createMatrixClass = /* @__PURE__ */ factory(name7, dependencies7, () => {
Matrix2.prototype.datatype = function() {
throw new Error("Cannot invoke datatype on a Matrix interface");
};
- Matrix2.prototype.create = function(data3, datatype) {
+ Matrix2.prototype.create = function(data2, datatype) {
throw new Error("Cannot invoke create on a Matrix interface");
};
- Matrix2.prototype.subset = function(index3, replacement, defaultValue2) {
+ Matrix2.prototype.subset = function(index2, replacement, defaultValue2) {
throw new Error("Cannot invoke subset on a Matrix interface");
};
- Matrix2.prototype.get = function(index3) {
+ Matrix2.prototype.get = function(index2) {
throw new Error("Cannot invoke get on a Matrix interface");
};
- Matrix2.prototype.set = function(index3, value, defaultValue2) {
+ Matrix2.prototype.set = function(index2, value, defaultValue2) {
throw new Error("Cannot invoke set on a Matrix interface");
};
Matrix2.prototype.resize = function(size2, defaultValue2) {
@@ -51364,55 +51264,55 @@ var createMatrixClass = /* @__PURE__ */ factory(name7, dependencies7, () => {
// node_modules/mathjs/lib/esm/utils/lruQueue.js
function lruQueue(limit) {
var size2 = 0;
- var base3 = 1;
+ var base2 = 1;
var queue = /* @__PURE__ */ Object.create(null);
- var map6 = /* @__PURE__ */ Object.create(null);
- var index3 = 0;
+ var map4 = /* @__PURE__ */ Object.create(null);
+ var index2 = 0;
var del = function del2(id3) {
- var oldIndex = map6[id3];
+ var oldIndex = map4[id3];
if (!oldIndex)
return;
delete queue[oldIndex];
- delete map6[id3];
+ delete map4[id3];
--size2;
- if (base3 !== oldIndex)
+ if (base2 !== oldIndex)
return;
if (!size2) {
- index3 = 0;
- base3 = 1;
+ index2 = 0;
+ base2 = 1;
return;
}
- while (!Object.prototype.hasOwnProperty.call(queue, ++base3)) {
+ while (!Object.prototype.hasOwnProperty.call(queue, ++base2)) {
}
};
limit = Math.abs(limit);
return {
hit: function hit(id3) {
- var oldIndex = map6[id3];
- var nuIndex = ++index3;
+ var oldIndex = map4[id3];
+ var nuIndex = ++index2;
queue[nuIndex] = id3;
- map6[id3] = nuIndex;
+ map4[id3] = nuIndex;
if (!oldIndex) {
++size2;
if (size2 <= limit)
return void 0;
- id3 = queue[base3];
+ id3 = queue[base2];
del(id3);
return id3;
}
delete queue[oldIndex];
- if (base3 !== oldIndex)
+ if (base2 !== oldIndex)
return void 0;
- while (!Object.prototype.hasOwnProperty.call(queue, ++base3)) {
+ while (!Object.prototype.hasOwnProperty.call(queue, ++base2)) {
}
return void 0;
},
delete: del,
clear: function clear() {
- size2 = index3 = 0;
- base3 = 1;
+ size2 = index2 = 0;
+ base2 = 1;
queue = /* @__PURE__ */ Object.create(null);
- map6 = /* @__PURE__ */ Object.create(null);
+ map4 = /* @__PURE__ */ Object.create(null);
}
};
}
@@ -51461,35 +51361,35 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
var {
Matrix: Matrix2
} = _ref;
- function DenseMatrix2(data3, datatype) {
+ function DenseMatrix2(data2, datatype) {
if (!(this instanceof DenseMatrix2)) {
throw new SyntaxError("Constructor must be called with the new operator");
}
if (datatype && !isString2(datatype)) {
throw new Error("Invalid datatype: " + datatype);
}
- if (isMatrix(data3)) {
- if (data3.type === "DenseMatrix") {
- this._data = clone(data3._data);
- this._size = clone(data3._size);
- this._datatype = datatype || data3._datatype;
+ if (isMatrix(data2)) {
+ if (data2.type === "DenseMatrix") {
+ this._data = clone(data2._data);
+ this._size = clone(data2._size);
+ this._datatype = datatype || data2._datatype;
} else {
- this._data = data3.toArray();
- this._size = data3.size();
- this._datatype = datatype || data3._datatype;
+ this._data = data2.toArray();
+ this._size = data2.size();
+ this._datatype = datatype || data2._datatype;
}
- } else if (data3 && isArray2(data3.data) && isArray2(data3.size)) {
- this._data = data3.data;
- this._size = data3.size;
+ } else if (data2 && isArray2(data2.data) && isArray2(data2.size)) {
+ this._data = data2.data;
+ this._size = data2.size;
validate(this._data, this._size);
- this._datatype = datatype || data3.datatype;
- } else if (isArray2(data3)) {
- this._data = preprocess2(data3);
+ this._datatype = datatype || data2.datatype;
+ } else if (isArray2(data2)) {
+ this._data = preprocess(data2);
this._size = arraySize(this._data);
validate(this._data, this._size);
this._datatype = datatype;
- } else if (data3) {
- throw new TypeError("Unsupported type of data (" + typeOf(data3) + ")");
+ } else if (data2) {
+ throw new TypeError("Unsupported type of data (" + typeOf(data2) + ")");
} else {
this._data = [];
this._size = [0];
@@ -51497,8 +51397,8 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
}
}
DenseMatrix2.prototype = new Matrix2();
- DenseMatrix2.prototype.createDenseMatrix = function(data3, datatype) {
- return new DenseMatrix2(data3, datatype);
+ DenseMatrix2.prototype.createDenseMatrix = function(data2, datatype) {
+ return new DenseMatrix2(data2, datatype);
};
Object.defineProperty(DenseMatrix2, "name", {
value: "DenseMatrix"
@@ -51515,104 +51415,104 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
DenseMatrix2.prototype.datatype = function() {
return this._datatype;
};
- DenseMatrix2.prototype.create = function(data3, datatype) {
- return new DenseMatrix2(data3, datatype);
+ DenseMatrix2.prototype.create = function(data2, datatype) {
+ return new DenseMatrix2(data2, datatype);
};
- DenseMatrix2.prototype.subset = function(index3, replacement, defaultValue2) {
+ DenseMatrix2.prototype.subset = function(index2, replacement, defaultValue2) {
switch (arguments.length) {
case 1:
- return _get(this, index3);
+ return _get(this, index2);
case 2:
case 3:
- return _set(this, index3, replacement, defaultValue2);
+ return _set(this, index2, replacement, defaultValue2);
default:
throw new SyntaxError("Wrong number of arguments");
}
};
- DenseMatrix2.prototype.get = function(index3) {
- if (!isArray2(index3)) {
+ DenseMatrix2.prototype.get = function(index2) {
+ if (!isArray2(index2)) {
throw new TypeError("Array expected");
}
- if (index3.length !== this._size.length) {
- throw new DimensionError(index3.length, this._size.length);
+ if (index2.length !== this._size.length) {
+ throw new DimensionError(index2.length, this._size.length);
}
- for (var x2 = 0; x2 < index3.length; x2++) {
- validateIndex(index3[x2], this._size[x2]);
+ for (var x2 = 0; x2 < index2.length; x2++) {
+ validateIndex(index2[x2], this._size[x2]);
}
- var data3 = this._data;
- for (var i4 = 0, ii = index3.length; i4 < ii; i4++) {
- var indexI = index3[i4];
- validateIndex(indexI, data3.length);
- data3 = data3[indexI];
+ var data2 = this._data;
+ for (var i4 = 0, ii = index2.length; i4 < ii; i4++) {
+ var indexI = index2[i4];
+ validateIndex(indexI, data2.length);
+ data2 = data2[indexI];
}
- return data3;
+ return data2;
};
- DenseMatrix2.prototype.set = function(index3, value, defaultValue2) {
- if (!isArray2(index3)) {
+ DenseMatrix2.prototype.set = function(index2, value, defaultValue2) {
+ if (!isArray2(index2)) {
throw new TypeError("Array expected");
}
- if (index3.length < this._size.length) {
- throw new DimensionError(index3.length, this._size.length, "<");
+ if (index2.length < this._size.length) {
+ throw new DimensionError(index2.length, this._size.length, "<");
}
var i4, ii, indexI;
- var size2 = index3.map(function(i5) {
+ var size2 = index2.map(function(i5) {
return i5 + 1;
});
_fit(this, size2, defaultValue2);
- var data3 = this._data;
- for (i4 = 0, ii = index3.length - 1; i4 < ii; i4++) {
- indexI = index3[i4];
- validateIndex(indexI, data3.length);
- data3 = data3[indexI];
- }
- indexI = index3[index3.length - 1];
- validateIndex(indexI, data3.length);
- data3[indexI] = value;
+ var data2 = this._data;
+ for (i4 = 0, ii = index2.length - 1; i4 < ii; i4++) {
+ indexI = index2[i4];
+ validateIndex(indexI, data2.length);
+ data2 = data2[indexI];
+ }
+ indexI = index2[index2.length - 1];
+ validateIndex(indexI, data2.length);
+ data2[indexI] = value;
return this;
};
- function _get(matrix2, index3) {
- if (!isIndex(index3)) {
+ function _get(matrix2, index2) {
+ if (!isIndex(index2)) {
throw new TypeError("Invalid index");
}
- var isScalar = index3.isScalar();
+ var isScalar = index2.isScalar();
if (isScalar) {
- return matrix2.get(index3.min());
+ return matrix2.get(index2.min());
} else {
- var size2 = index3.size();
+ var size2 = index2.size();
if (size2.length !== matrix2._size.length) {
throw new DimensionError(size2.length, matrix2._size.length);
}
- var min5 = index3.min();
- var max5 = index3.max();
+ var min5 = index2.min();
+ var max5 = index2.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, index3, size2.length, 0), matrix2._datatype);
+ return new DenseMatrix2(_getSubmatrix(matrix2._data, index2, size2.length, 0), matrix2._datatype);
}
}
- function _getSubmatrix(data3, index3, dims, dim) {
+ function _getSubmatrix(data2, index2, dims, dim) {
var last = dim === dims - 1;
- var range2 = index3.dimension(dim);
+ var range2 = index2.dimension(dim);
if (last) {
return range2.map(function(i4) {
- validateIndex(i4, data3.length);
- return data3[i4];
+ validateIndex(i4, data2.length);
+ return data2[i4];
}).valueOf();
} else {
return range2.map(function(i4) {
- validateIndex(i4, data3.length);
- var child = data3[i4];
- return _getSubmatrix(child, index3, dims, dim + 1);
+ validateIndex(i4, data2.length);
+ var child = data2[i4];
+ return _getSubmatrix(child, index2, dims, dim + 1);
}).valueOf();
}
}
- function _set(matrix2, index3, submatrix, defaultValue2) {
- if (!index3 || index3.isIndex !== true) {
+ function _set(matrix2, index2, submatrix, defaultValue2) {
+ if (!index2 || index2.isIndex !== true) {
throw new TypeError("Invalid index");
}
- var iSize = index3.size();
- var isScalar = index3.isScalar();
+ var iSize = index2.size();
+ var isScalar = index2.isScalar();
var sSize;
if (isMatrix(submatrix)) {
sSize = submatrix.size();
@@ -51624,7 +51524,7 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
if (sSize.length !== 0) {
throw new TypeError("Scalar expected");
}
- matrix2.set(index3.min(), submatrix, defaultValue2);
+ matrix2.set(index2.min(), submatrix, defaultValue2);
} else {
if (!deepStrictEqual(sSize, iSize)) {
try {
@@ -51655,28 +51555,28 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
if (!deepStrictEqual(iSize, sSize)) {
throw new DimensionError(iSize, sSize, ">");
}
- var size2 = index3.max().map(function(i5) {
+ var size2 = index2.max().map(function(i5) {
return i5 + 1;
});
_fit(matrix2, size2, defaultValue2);
var dims = iSize.length;
var dim = 0;
- _setSubmatrix(matrix2._data, index3, submatrix, dims, dim);
+ _setSubmatrix(matrix2._data, index2, submatrix, dims, dim);
}
return matrix2;
}
- function _setSubmatrix(data3, index3, submatrix, dims, dim) {
+ function _setSubmatrix(data2, index2, submatrix, dims, dim) {
var last = dim === dims - 1;
- var range2 = index3.dimension(dim);
+ var range2 = index2.dimension(dim);
if (last) {
range2.forEach(function(dataIndex, subIndex) {
validateIndex(dataIndex);
- data3[dataIndex] = submatrix[subIndex[0]];
+ data2[dataIndex] = submatrix[subIndex[0]];
});
} else {
range2.forEach(function(dataIndex, subIndex) {
validateIndex(dataIndex);
- _setSubmatrix(data3[dataIndex], index3, submatrix[subIndex[0]], dims, dim + 1);
+ _setSubmatrix(data2[dataIndex], index2, submatrix[subIndex[0]], dims, dim + 1);
});
}
}
@@ -51740,48 +51640,48 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
DenseMatrix2.prototype.map = function(callback) {
var me = this;
var args = maxArgumentCount(callback);
- var recurse = function recurse2(value, index3) {
+ var recurse = function recurse2(value, index2) {
if (isArray2(value)) {
return value.map(function(child, i4) {
- return recurse2(child, index3.concat(i4));
+ return recurse2(child, index2.concat(i4));
});
} else {
if (args === 1) {
return callback(value);
} else if (args === 2) {
- return callback(value, index3);
+ return callback(value, index2);
} else {
- return callback(value, index3, me);
+ return callback(value, index2, me);
}
}
};
- var data3 = recurse(this._data, []);
- var datatype = this._datatype !== void 0 ? getArrayDataType(data3, typeOf) : void 0;
- return new DenseMatrix2(data3, datatype);
+ var data2 = recurse(this._data, []);
+ var datatype = this._datatype !== void 0 ? getArrayDataType(data2, typeOf) : void 0;
+ return new DenseMatrix2(data2, datatype);
};
DenseMatrix2.prototype.forEach = function(callback) {
var me = this;
- var recurse = function recurse2(value, index3) {
+ var recurse = function recurse2(value, index2) {
if (isArray2(value)) {
value.forEach(function(child, i4) {
- recurse2(child, index3.concat(i4));
+ recurse2(child, index2.concat(i4));
});
} else {
- callback(value, index3, me);
+ callback(value, index2, me);
}
};
recurse(this._data, []);
};
DenseMatrix2.prototype[Symbol.iterator] = function* () {
- var recurse = function* recurse2(value, index3) {
+ var recurse = function* recurse2(value, index2) {
if (isArray2(value)) {
for (var i4 = 0; i4 < value.length; i4++) {
- yield* recurse2(value[i4], index3.concat(i4));
+ yield* recurse2(value[i4], index2.concat(i4));
}
} else {
yield {
value,
- index: index3
+ index: index2
};
}
};
@@ -51793,8 +51693,8 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
if (s4.length !== 2) {
throw new TypeError("Rows can only be returned for a 2D matrix.");
}
- var data3 = this._data;
- for (var row2 of data3) {
+ var data2 = this._data;
+ for (var row2 of data2) {
result.push(new DenseMatrix2([row2], this._datatype));
}
return result;
@@ -51806,9 +51706,9 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
if (s4.length !== 2) {
throw new TypeError("Rows can only be returned for a 2D matrix.");
}
- var data3 = this._data;
+ var data2 = this._data;
var _loop = function _loop2(i5) {
- var col = data3.map((row2) => [row2[i5]]);
+ var col = data2.map((row2) => [row2[i5]]);
result.push(new DenseMatrix2(col, _this._datatype));
};
for (var i4 = 0; i4 < s4[1]; i4++) {
@@ -51852,12 +51752,12 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
var rows = this._size[0];
var columns = this._size[1];
var n3 = Math.min(rows - kSub, columns - kSuper);
- var data3 = [];
+ var data2 = [];
for (var i4 = 0; i4 < n3; i4++) {
- data3[i4] = this._data[i4 + kSub][i4 + kSuper];
+ data2[i4] = this._data[i4 + kSub][i4 + kSuper];
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [n3],
datatype: this._datatype
});
@@ -51917,15 +51817,15 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
if (!defaultValue2) {
defaultValue2 = isBigNumber(_value(0)) ? _value(0).mul(0) : 0;
}
- var data3 = [];
+ var data2 = [];
if (size2.length > 0) {
- data3 = resize(data3, size2, defaultValue2);
+ data2 = resize(data2, size2, defaultValue2);
for (var d4 = 0; d4 < n3; d4++) {
- data3[d4 + kSub][d4 + kSuper] = _value(d4);
+ data2[d4 + kSub][d4 + kSuper] = _value(d4);
}
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [rows, columns]
});
};
@@ -51944,19 +51844,19 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref
DenseMatrix2._swapRows(i4, j, this._data);
return this;
};
- DenseMatrix2._swapRows = function(i4, j, data3) {
- var vi = data3[i4];
- data3[i4] = data3[j];
- data3[j] = vi;
+ DenseMatrix2._swapRows = function(i4, j, data2) {
+ var vi = data2[i4];
+ data2[i4] = data2[j];
+ data2[j] = vi;
};
- function preprocess2(data3) {
- if (isMatrix(data3)) {
- return preprocess2(data3.valueOf());
+ function preprocess(data2) {
+ if (isMatrix(data2)) {
+ return preprocess(data2.valueOf());
}
- if (isArray2(data3)) {
- return data3.map(preprocess2);
+ if (isArray2(data2)) {
+ return data2.map(preprocess);
}
- return data3;
+ return data2;
}
return DenseMatrix2;
}, {
@@ -52058,7 +51958,7 @@ function _reduce(mat, dim, callback) {
return ret;
}
}
-function scatter(a4, j, w2, x2, u3, mark2, cindex, f2, inverse, update, value) {
+function scatter(a4, j, w2, x2, u3, mark, cindex, f2, inverse, update, value) {
var avalues = a4._values;
var aindex = a4._index;
var aptr = a4._ptr;
@@ -52066,28 +51966,28 @@ function scatter(a4, j, w2, x2, u3, mark2, cindex, f2, inverse, update, value) {
if (x2) {
for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = aindex[k2];
- if (w2[i4] !== mark2) {
- w2[i4] = mark2;
+ if (w2[i4] !== mark) {
+ w2[i4] = mark;
cindex.push(i4);
if (update) {
x2[i4] = inverse ? f2(avalues[k2], value) : f2(value, avalues[k2]);
- u3[i4] = mark2;
+ u3[i4] = mark;
} else {
x2[i4] = avalues[k2];
}
} else {
x2[i4] = inverse ? f2(avalues[k2], x2[i4]) : f2(x2[i4], avalues[k2]);
- u3[i4] = mark2;
+ u3[i4] = mark;
}
}
} else {
for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = aindex[k2];
- if (w2[i4] !== mark2) {
- w2[i4] = mark2;
+ if (w2[i4] !== mark) {
+ w2[i4] = mark;
cindex.push(i4);
} else {
- u3[i4] = mark2;
+ u3[i4] = mark;
}
}
}
@@ -52212,15 +52112,15 @@ function modNumber(x2, y3) {
}
modNumber.signature = n2;
function nthRootNumber(a4) {
- var root4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
- var inv2 = root4 < 0;
+ var root = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
+ var inv2 = root < 0;
if (inv2) {
- root4 = -root4;
+ root = -root;
}
- if (root4 === 0) {
+ if (root === 0) {
throw new Error("Root must be non-zero");
}
- if (a4 < 0 && Math.abs(root4) % 2 !== 1) {
+ if (a4 < 0 && Math.abs(root) % 2 !== 1) {
throw new Error("Root must be odd when a is negative.");
}
if (a4 === 0) {
@@ -52229,7 +52129,7 @@ function nthRootNumber(a4) {
if (!isFinite(a4)) {
return inv2 ? 0 : a4;
}
- var x2 = Math.pow(Math.abs(a4), 1 / root4);
+ var x2 = Math.pow(Math.abs(a4), 1 / root);
x2 = a4 < 0 ? -x2 : x2;
return inv2 ? 1 / x2 : x2;
}
@@ -52468,12 +52368,12 @@ function lgammaNumber(n3) {
return Math.log(Math.PI / Math.sin(Math.PI * n3)) - lgammaNumber(1 - n3);
}
n3 = n3 - 1;
- var base3 = n3 + lgammaG + 0.5;
+ var base2 = n3 + lgammaG + 0.5;
var sum4 = lgammaSeries[0];
for (var i4 = lgammaN - 1; i4 >= 1; i4--) {
sum4 += lgammaSeries[i4] / (n3 + i4);
}
- return lnSqrt2PI + (n3 + 0.5) * Math.log(base3) - base3 + Math.log(sum4);
+ return lnSqrt2PI + (n3 + 0.5) * Math.log(base2) - base2 + Math.log(sum4);
}
lgammaNumber.signature = "number";
@@ -52656,7 +52556,7 @@ var createHasNumericValue = /* @__PURE__ */ factory(name13, dependencies13, (_re
} = _ref;
return typed3(name13, {
boolean: () => true,
- string: function string6(x2) {
+ string: function string4(x2) {
return x2.trim().length > 0 && !isNaN(Number(x2));
},
any: function any(x2) {
@@ -52840,25 +52740,25 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
equalScalar: equalScalar2,
Matrix: Matrix2
} = _ref;
- function SparseMatrix2(data3, datatype) {
+ function SparseMatrix2(data2, datatype) {
if (!(this instanceof SparseMatrix2)) {
throw new SyntaxError("Constructor must be called with the new operator");
}
if (datatype && !isString2(datatype)) {
throw new Error("Invalid datatype: " + datatype);
}
- if (isMatrix(data3)) {
- _createFromMatrix(this, data3, datatype);
- } else if (data3 && isArray2(data3.index) && isArray2(data3.ptr) && isArray2(data3.size)) {
- this._values = data3.values;
- this._index = data3.index;
- this._ptr = data3.ptr;
- this._size = data3.size;
- this._datatype = datatype || data3.datatype;
- } else if (isArray2(data3)) {
- _createFromArray(this, data3, datatype);
- } else if (data3) {
- throw new TypeError("Unsupported type of data (" + typeOf(data3) + ")");
+ if (isMatrix(data2)) {
+ _createFromMatrix(this, data2, datatype);
+ } else if (data2 && isArray2(data2.index) && isArray2(data2.ptr) && isArray2(data2.size)) {
+ this._values = data2.values;
+ this._index = data2.index;
+ this._ptr = data2.ptr;
+ this._size = data2.size;
+ this._datatype = datatype || data2.datatype;
+ } else if (isArray2(data2)) {
+ _createFromArray(this, data2, datatype);
+ } else if (data2) {
+ throw new TypeError("Unsupported type of data (" + typeOf(data2) + ")");
} else {
this._values = [];
this._index = [];
@@ -52878,12 +52778,12 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
_createFromArray(matrix2, source.valueOf(), datatype || source._datatype);
}
}
- function _createFromArray(matrix2, data3, datatype) {
+ function _createFromArray(matrix2, data2, datatype) {
matrix2._values = [];
matrix2._index = [];
matrix2._ptr = [];
matrix2._datatype = datatype;
- var rows = data3.length;
+ var rows = data2.length;
var columns = 0;
var eq = equalScalar2;
var zero = 0;
@@ -52896,7 +52796,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
do {
matrix2._ptr.push(matrix2._index.length);
for (var i4 = 0; i4 < rows; i4++) {
- var row2 = data3[i4];
+ var row2 = data2[i4];
if (isArray2(row2)) {
if (j === 0 && columns < row2.length) {
columns = row2.length;
@@ -52925,8 +52825,8 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
matrix2._size = [rows, columns];
}
SparseMatrix2.prototype = new Matrix2();
- SparseMatrix2.prototype.createSparseMatrix = function(data3, datatype) {
- return new SparseMatrix2(data3, datatype);
+ SparseMatrix2.prototype.createSparseMatrix = function(data2, datatype) {
+ return new SparseMatrix2(data2, datatype);
};
Object.defineProperty(SparseMatrix2, "name", {
value: "SparseMatrix"
@@ -52943,24 +52843,24 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
SparseMatrix2.prototype.datatype = function() {
return this._datatype;
};
- SparseMatrix2.prototype.create = function(data3, datatype) {
- return new SparseMatrix2(data3, datatype);
+ SparseMatrix2.prototype.create = function(data2, datatype) {
+ return new SparseMatrix2(data2, datatype);
};
SparseMatrix2.prototype.density = function() {
var rows = this._size[0];
var columns = this._size[1];
return rows !== 0 && columns !== 0 ? this._index.length / (rows * columns) : 0;
};
- SparseMatrix2.prototype.subset = function(index3, replacement, defaultValue2) {
+ SparseMatrix2.prototype.subset = function(index2, replacement, defaultValue2) {
if (!this._values) {
throw new Error("Cannot invoke subset on a Pattern only matrix");
}
switch (arguments.length) {
case 1:
- return _getsubset(this, index3);
+ return _getsubset(this, index2);
case 2:
case 3:
- return _setsubset(this, index3, replacement, defaultValue2);
+ return _setsubset(this, index2, replacement, defaultValue2);
default:
throw new SyntaxError("Wrong number of arguments");
}
@@ -52996,35 +52896,35 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
w2[i5] = true;
});
var values2 = mvalues ? [] : void 0;
- var index3 = [];
+ var index2 = [];
var ptr = [];
columns.forEach(function(j) {
- ptr.push(index3.length);
+ ptr.push(index2.length);
for (k2 = mptr[j], kk = mptr[j + 1]; k2 < kk; k2++) {
i4 = mindex[k2];
if (w2[i4] === true) {
- index3.push(pv[i4]);
+ index2.push(pv[i4]);
if (values2) {
values2.push(mvalues[k2]);
}
}
}
});
- ptr.push(index3.length);
+ ptr.push(index2.length);
return new SparseMatrix2({
values: values2,
- index: index3,
+ index: index2,
ptr,
size: size2,
datatype: matrix2._datatype
});
}
- function _setsubset(matrix2, index3, submatrix, defaultValue2) {
- if (!index3 || index3.isIndex !== true) {
+ function _setsubset(matrix2, index2, submatrix, defaultValue2) {
+ if (!index2 || index2.isIndex !== true) {
throw new TypeError("Invalid index");
}
- var iSize = index3.size();
- var isScalar = index3.isScalar();
+ var iSize = index2.size();
+ var isScalar = index2.isScalar();
var sSize;
if (isMatrix(submatrix)) {
sSize = submatrix.size();
@@ -53036,7 +52936,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
if (sSize.length !== 0) {
throw new TypeError("Scalar expected");
}
- matrix2.set(index3.min(), submatrix, defaultValue2);
+ matrix2.set(index2.min(), submatrix, defaultValue2);
} else {
if (iSize.length !== 1 && iSize.length !== 2) {
throw new DimensionError(iSize.length, matrix2._size.length, "<");
@@ -53057,14 +52957,14 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
throw new DimensionError(iSize, sSize, ">");
}
if (iSize.length === 1) {
- var range2 = index3.dimension(0);
+ var range2 = index2.dimension(0);
range2.forEach(function(dataIndex, subIndex) {
validateIndex(dataIndex);
matrix2.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue2);
});
} else {
- var firstDimensionRange = index3.dimension(0);
- var secondDimensionRange = index3.dimension(1);
+ var firstDimensionRange = index2.dimension(0);
+ var secondDimensionRange = index2.dimension(1);
firstDimensionRange.forEach(function(firstDataIndex, firstSubIndex) {
validateIndex(firstDataIndex);
secondDimensionRange.forEach(function(secondDataIndex, secondSubIndex) {
@@ -53076,18 +52976,18 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
}
return matrix2;
}
- SparseMatrix2.prototype.get = function(index3) {
- if (!isArray2(index3)) {
+ SparseMatrix2.prototype.get = function(index2) {
+ if (!isArray2(index2)) {
throw new TypeError("Array expected");
}
- if (index3.length !== this._size.length) {
- throw new DimensionError(index3.length, this._size.length);
+ if (index2.length !== this._size.length) {
+ throw new DimensionError(index2.length, this._size.length);
}
if (!this._values) {
throw new Error("Cannot invoke get on a Pattern only matrix");
}
- var i4 = index3[0];
- var j = index3[1];
+ var i4 = index2[0];
+ var j = index2[1];
validateIndex(i4, this._size[0]);
validateIndex(j, this._size[1]);
var k2 = _getValueIndex(i4, this._ptr[j], this._ptr[j + 1], this._index);
@@ -53096,18 +52996,18 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
}
return 0;
};
- SparseMatrix2.prototype.set = function(index3, v2, defaultValue2) {
- if (!isArray2(index3)) {
+ SparseMatrix2.prototype.set = function(index2, v2, defaultValue2) {
+ if (!isArray2(index2)) {
throw new TypeError("Array expected");
}
- if (index3.length !== this._size.length) {
- throw new DimensionError(index3.length, this._size.length);
+ if (index2.length !== this._size.length) {
+ throw new DimensionError(index2.length, this._size.length);
}
if (!this._values) {
throw new Error("Cannot invoke set on a Pattern only matrix");
}
- var i4 = index3[0];
- var j = index3[1];
+ var i4 = index2[0];
+ var j = index2[1];
var rows = this._size[0];
var columns = this._size[1];
var eq = equalScalar2;
@@ -53137,27 +53037,27 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
}
return this;
};
- function _getValueIndex(i4, top, bottom, index3) {
+ function _getValueIndex(i4, top, bottom, index2) {
if (bottom - top === 0) {
return bottom;
}
for (var r2 = top; r2 < bottom; r2++) {
- if (index3[r2] === i4) {
+ if (index2[r2] === i4) {
return r2;
}
}
return top;
}
- function _remove(k2, j, values2, index3, ptr) {
+ function _remove(k2, j, values2, index2, ptr) {
values2.splice(k2, 1);
- index3.splice(k2, 1);
+ index2.splice(k2, 1);
for (var x2 = j + 1; x2 < ptr.length; x2++) {
ptr[x2]--;
}
}
- function _insert(k2, i4, j, v2, values2, index3, ptr) {
+ function _insert(k2, i4, j, v2, values2, index2, ptr) {
values2.splice(k2, 0, v2);
- index3.splice(k2, 0, i4);
+ index2.splice(k2, 0, i4);
for (var x2 = j + 1; x2 < ptr.length; x2++) {
ptr[x2]++;
}
@@ -53216,10 +53116,10 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
for (j = 0; j < c3; j++) {
matrix2._ptr[j] = matrix2._ptr[j] + n3;
k2 = matrix2._ptr[j + 1] + n3;
- var p2 = 0;
- for (i4 = r2; i4 < rows; i4++, p2++) {
- matrix2._values.splice(k2 + p2, 0, value);
- matrix2._index.splice(k2 + p2, 0, i4);
+ var p = 0;
+ for (i4 = r2; i4 < rows; i4++, p++) {
+ matrix2._values.splice(k2 + p, 0, value);
+ matrix2._index.splice(k2 + p, 0, i4);
n3++;
}
}
@@ -53331,7 +53231,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
};
function _map3(matrix2, minRow, maxRow, minColumn, maxColumn, callback, skipZeros) {
var values2 = [];
- var index3 = [];
+ var index2 = [];
var ptr = [];
var eq = equalScalar2;
var zero = 0;
@@ -53343,7 +53243,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
v2 = callback(v2, x2, y3);
if (!eq(v2, zero)) {
values2.push(v2);
- index3.push(x2);
+ index2.push(x2);
}
};
for (var j = minColumn; j <= maxColumn; j++) {
@@ -53372,7 +53272,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
ptr.push(values2.length);
return new SparseMatrix2({
values: values2,
- index: index3,
+ index: index2,
ptr,
size: [maxRow - minRow + 1, maxColumn - minColumn + 1]
});
@@ -53428,7 +53328,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
SparseMatrix2.prototype.valueOf = function() {
return _toArray(this._values, this._index, this._ptr, this._size, false);
};
- function _toArray(values2, index3, ptr, size2, copy) {
+ function _toArray(values2, index2, ptr, size2, copy) {
var rows = size2[0];
var columns = size2[1];
var a4 = [];
@@ -53443,7 +53343,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
var k0 = ptr[j];
var k1 = ptr[j + 1];
for (var k2 = k0; k2 < k1; k2++) {
- i4 = index3[k2];
+ i4 = index2[k2];
a4[i4][j] = values2 ? copy ? clone(values2[k2]) : values2[k2] : 1;
}
}
@@ -53494,7 +53394,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
var columns = this._size[1];
var n3 = Math.min(rows - kSub, columns - kSuper);
var values2 = [];
- var index3 = [];
+ var index2 = [];
var ptr = [];
ptr[0] = 0;
for (var j = kSuper; j < columns && values2.length < n3; j++) {
@@ -53504,7 +53404,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
var i4 = this._index[x2];
if (i4 === j - kSuper + kSub) {
values2.push(this._values[x2]);
- index3[values2.length - 1] = i4 - kSub;
+ index2[values2.length - 1] = i4 - kSub;
break;
}
}
@@ -53512,7 +53412,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
ptr.push(values2.length);
return new SparseMatrix2({
values: values2,
- index: index3,
+ index: index2,
ptr,
size: [n3, 1]
});
@@ -53579,7 +53479,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
};
}
var values2 = [];
- var index3 = [];
+ var index2 = [];
var ptr = [];
for (var j = 0; j < columns; j++) {
ptr.push(values2.length);
@@ -53587,7 +53487,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
if (i4 >= 0 && i4 < n3) {
var v2 = _value(i4);
if (!eq(v2, zero)) {
- index3.push(i4 + kSub);
+ index2.push(i4 + kSub);
values2.push(v2);
}
}
@@ -53595,7 +53495,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
ptr.push(values2.length);
return new SparseMatrix2({
values: values2,
- index: index3,
+ index: index2,
ptr,
size: [rows, columns]
});
@@ -53612,20 +53512,20 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
SparseMatrix2._swapRows(i4, j, this._size[1], this._values, this._index, this._ptr);
return this;
};
- SparseMatrix2._forEachRow = function(j, values2, index3, ptr, callback) {
+ SparseMatrix2._forEachRow = function(j, values2, index2, ptr, callback) {
var k0 = ptr[j];
var k1 = ptr[j + 1];
for (var k2 = k0; k2 < k1; k2++) {
- callback(index3[k2], values2[k2]);
+ callback(index2[k2], values2[k2]);
}
};
- SparseMatrix2._swapRows = function(x2, y3, columns, values2, index3, ptr) {
+ SparseMatrix2._swapRows = function(x2, y3, columns, values2, index2, ptr) {
for (var j = 0; j < columns; j++) {
var k0 = ptr[j];
var k1 = ptr[j + 1];
- 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) {
+ 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) {
if (values2) {
var v2 = values2[kx];
values2[kx] = values2[ky];
@@ -53633,25 +53533,25 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_
}
continue;
}
- if (kx < k1 && index3[kx] === x2 && (ky >= k1 || index3[ky] !== y3)) {
+ if (kx < k1 && index2[kx] === x2 && (ky >= k1 || index2[ky] !== y3)) {
var vx = values2 ? values2[kx] : void 0;
- index3.splice(ky, 0, y3);
+ index2.splice(ky, 0, y3);
if (values2) {
values2.splice(ky, 0, vx);
}
- index3.splice(ky <= kx ? kx + 1 : kx, 1);
+ index2.splice(ky <= kx ? kx + 1 : kx, 1);
if (values2) {
values2.splice(ky <= kx ? kx + 1 : kx, 1);
}
continue;
}
- if (ky < k1 && index3[ky] === y3 && (kx >= k1 || index3[kx] !== x2)) {
+ if (ky < k1 && index2[ky] === y3 && (kx >= k1 || index2[kx] !== x2)) {
var vy = values2 ? values2[ky] : void 0;
- index3.splice(kx, 0, x2);
+ index2.splice(kx, 0, x2);
if (values2) {
values2.splice(kx, 0, vy);
}
- index3.splice(kx <= ky ? ky + 1 : ky, 1);
+ index2.splice(kx <= ky ? ky + 1 : ky, 1);
if (values2) {
values2.splice(kx <= ky ? ky + 1 : ky, 1);
}
@@ -53703,14 +53603,14 @@ var createNumber = /* @__PURE__ */ factory(name20, dependencies20, (_ref) => {
var {
typed: typed3
} = _ref;
- var number5 = typed3("number", {
+ var number4 = typed3("number", {
"": function _15() {
return 0;
},
- number: function number6(x2) {
+ number: function number5(x2) {
return x2;
},
- string: function string6(x2) {
+ string: function string4(x2) {
if (x2 === "NaN")
return NaN;
var nonDecimalNumberParts = getNonDecimalNumberParts(x2);
@@ -53756,10 +53656,10 @@ var createNumber = /* @__PURE__ */ factory(name20, dependencies20, (_ref) => {
},
"Array | Matrix": typed3.referToSelf((self2) => (x2) => deepMap(x2, self2))
});
- number5.fromJSON = function(json) {
+ number4.fromJSON = function(json) {
return parseFloat(json.value);
};
- return number5;
+ return number4;
});
// node_modules/mathjs/lib/esm/type/string.js
@@ -53777,10 +53677,10 @@ var createString = /* @__PURE__ */ factory(name21, dependencies21, (_ref) => {
null: function _null2(x2) {
return "null";
},
- boolean: function boolean3(x2) {
+ boolean: function boolean2(x2) {
return x2 + "";
},
- string: function string6(x2) {
+ string: function string4(x2) {
return x2;
},
"Array | Matrix": typed3.referToSelf((self2) => (x2) => deepMap(x2, self2)),
@@ -53801,10 +53701,10 @@ var createBoolean = /* @__PURE__ */ factory(name22, dependencies22, (_ref) => {
"": function _15() {
return false;
},
- boolean: function boolean3(x2) {
+ boolean: function boolean2(x2) {
return x2;
},
- number: function number5(x2) {
+ number: function number4(x2) {
return !!x2;
},
null: function _null2(x2) {
@@ -53813,7 +53713,7 @@ var createBoolean = /* @__PURE__ */ factory(name22, dependencies22, (_ref) => {
BigNumber: function BigNumber2(x2) {
return !x2.isZero();
},
- string: function string6(x2) {
+ string: function string4(x2) {
var lcase = x2.toLowerCase();
if (lcase === "true") {
return true;
@@ -53842,10 +53742,10 @@ var createBignumber = /* @__PURE__ */ factory(name23, dependencies23, (_ref) =>
"": function _15() {
return new BigNumber2(0);
},
- number: function number5(x2) {
+ number: function number4(x2) {
return new BigNumber2(x2 + "");
},
- string: function string6(x2) {
+ string: function string4(x2) {
var wordSizeSuffixMatch = x2.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);
if (wordSizeSuffixMatch) {
var size2 = wordSizeSuffixMatch[2];
@@ -53893,7 +53793,7 @@ var createComplex = /* @__PURE__ */ factory(name24, dependencies24, (_ref) => {
"": function _15() {
return Complex3.ZERO;
},
- number: function number5(x2) {
+ number: function number4(x2) {
return new Complex3(x2, 0);
},
"number, number": function numberNumber(re2, im2) {
@@ -53908,7 +53808,7 @@ var createComplex = /* @__PURE__ */ factory(name24, dependencies24, (_ref) => {
Complex: function Complex4(x2) {
return x2.clone();
},
- string: function string6(x2) {
+ string: function string4(x2) {
return Complex3(x2);
},
null: function _null2(x2) {
@@ -53936,13 +53836,13 @@ var createFraction = /* @__PURE__ */ factory(name25, dependencies25, (_ref) => {
Fraction: Fraction3
} = _ref;
return typed3("fraction", {
- number: function number5(x2) {
+ number: function number4(x2) {
if (!isFinite(x2) || isNaN(x2)) {
throw new Error(x2 + " cannot be represented as a fraction");
}
return new Fraction3(x2);
},
- string: function string6(x2) {
+ string: function string4(x2) {
return new Fraction3(x2);
},
"number, number": function numberNumber(numerator, denominator) {
@@ -53983,27 +53883,27 @@ var createMatrix = /* @__PURE__ */ factory(name26, dependencies26, (_ref) => {
"": function _15() {
return _create([]);
},
- string: function string6(format8) {
+ string: function string4(format8) {
return _create([], format8);
},
"string, string": function stringString(format8, datatype) {
return _create([], format8, datatype);
},
- Array: function Array2(data3) {
- return _create(data3);
+ Array: function Array2(data2) {
+ return _create(data2);
},
- Matrix: function Matrix3(data3) {
- return _create(data3, data3.storage());
+ Matrix: function Matrix3(data2) {
+ return _create(data2, data2.storage());
},
"Array | Matrix, string": _create,
"Array | Matrix, string, string": _create
});
- function _create(data3, format8, datatype) {
+ function _create(data2, format8, datatype) {
if (format8 === "dense" || format8 === "default" || format8 === void 0) {
- return new DenseMatrix2(data3, datatype);
+ return new DenseMatrix2(data2, datatype);
}
if (format8 === "sparse") {
- return new SparseMatrix2(data3, datatype);
+ return new SparseMatrix2(data2, datatype);
}
throw new TypeError("Unknown matrix type " + JSON.stringify(format8) + ".");
}
@@ -54046,11 +53946,11 @@ var createMatrixFromFunction = /* @__PURE__ */ factory(name27, dependencies27, (
m4 = matrix2(format8);
}
m4.resize(size2);
- m4.forEach(function(_15, index3) {
- var val = fn(index3);
+ m4.forEach(function(_15, index2) {
+ var val = fn(index2);
if (isZero2(val))
return;
- m4.set(index3, val);
+ m4.set(index2, val);
});
return m4;
}
@@ -54398,8 +54298,8 @@ var createCbrt = /* @__PURE__ */ factory(name37, dependencies37, (_ref) => {
var abs3 = x2.abs();
var principal = new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3).exp());
if (allRoots) {
- var all6 = [principal, new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 + Math.PI * 2 / 3).exp()), new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 - Math.PI * 2 / 3).exp())];
- return config4.matrix === "Array" ? all6 : matrix2(all6);
+ var all2 = [principal, new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 + Math.PI * 2 / 3).exp()), new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 - Math.PI * 2 / 3).exp())];
+ return config4.matrix === "Array" ? all2 : matrix2(all2);
} else {
return principal;
}
@@ -54452,16 +54352,16 @@ var createMatAlgo11xS0s = /* @__PURE__ */ factory(name38, dependencies38, (_ref)
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- b2 = typed3.convert(b2, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ b2 = typed3.convert(b2, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = [];
var cindex = [];
@@ -54483,7 +54383,7 @@ var createMatAlgo11xS0s = /* @__PURE__ */ factory(name38, dependencies38, (_ref)
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: dt2
+ datatype: dt
});
};
});
@@ -54507,28 +54407,28 @@ var createMatAlgo12xSfs = /* @__PURE__ */ factory(name39, dependencies39, (_ref)
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var cf = callback;
if (typeof adt === "string") {
- dt2 = adt;
- b2 = typed3.convert(b2, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ b2 = typed3.convert(b2, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cdata = [];
var x2 = [];
var w2 = [];
for (var j = 0; j < columns; j++) {
- var mark2 = j + 1;
+ var mark = j + 1;
for (var k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
var r2 = aindex[k2];
x2[r2] = avalues[k2];
- w2[r2] = mark2;
+ w2[r2] = mark;
}
for (var i4 = 0; i4 < rows; i4++) {
if (j === 0) {
cdata[i4] = [];
}
- if (w2[i4] === mark2) {
+ if (w2[i4] === mark) {
cdata[i4][j] = inverse ? cf(b2, x2[i4]) : cf(x2[i4], b2);
} else {
cdata[i4][j] = inverse ? cf(b2, 0) : cf(0, b2);
@@ -54538,7 +54438,7 @@ var createMatAlgo12xSfs = /* @__PURE__ */ factory(name39, dependencies39, (_ref)
return new DenseMatrix2({
data: cdata,
size: [rows, columns],
- datatype: dt2
+ datatype: dt
});
};
});
@@ -54554,18 +54454,18 @@ var createMatAlgo14xDs = /* @__PURE__ */ factory(name40, dependencies40, (_ref)
var adata = a4._data;
var asize = a4._size;
var adt = a4._datatype;
- var dt2;
+ var dt;
var cf = callback;
if (typeof adt === "string") {
- dt2 = adt;
- b2 = typed3.convert(b2, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ b2 = typed3.convert(b2, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cdata = asize.length > 0 ? _iterate(cf, 0, asize, asize[0], adata, b2, inverse) : [];
return a4.createDenseMatrix({
data: cdata,
size: clone(asize),
- datatype: dt2
+ datatype: dt
});
};
function _iterate(f2, level, s4, n3, av, bv, inverse) {
@@ -54593,7 +54493,7 @@ var createCeilNumber = /* @__PURE__ */ factory(name41, ["typed", "config", "roun
round: round3
} = _ref;
return typed3(name41, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (nearlyEqual(x2, round3(x2), config4.epsilon)) {
return round3(x2);
} else {
@@ -54604,10 +54504,10 @@ var createCeilNumber = /* @__PURE__ */ factory(name41, ["typed", "config", "roun
if (nearlyEqual(x2, round3(x2, n3), config4.epsilon)) {
return round3(x2, n3);
} else {
- var [number5, exponent] = "".concat(x2, "e").split("e");
- var result = Math.ceil(Number("".concat(number5, "e").concat(Number(exponent) + n3)));
- [number5, exponent] = "".concat(result, "e").split("e");
- return Number("".concat(number5, "e").concat(Number(exponent) - n3));
+ var [number4, exponent] = "".concat(x2, "e").split("e");
+ var result = Math.ceil(Number("".concat(number4, "e").concat(Number(exponent) + n3)));
+ [number4, exponent] = "".concat(result, "e").split("e");
+ return Number("".concat(number4, "e").concat(Number(exponent) - n3));
}
}
});
@@ -54771,7 +54671,7 @@ var createFixNumber = /* @__PURE__ */ factory(name45, ["typed", "ceil", "floor"]
floor: floor3
} = _ref;
return typed3(name45, {
- number: function number5(x2) {
+ number: function number4(x2) {
return x2 > 0 ? floor3(x2) : ceil3(x2);
},
"number, number": function numberNumber(x2, n3) {
@@ -54857,7 +54757,7 @@ var createFloorNumber = /* @__PURE__ */ factory(name46, ["typed", "config", "rou
round: round3
} = _ref;
return typed3(name46, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (nearlyEqual(x2, round3(x2), config4.epsilon)) {
return round3(x2);
} else {
@@ -54868,10 +54768,10 @@ var createFloorNumber = /* @__PURE__ */ factory(name46, ["typed", "config", "rou
if (nearlyEqual(x2, round3(x2, n3), config4.epsilon)) {
return round3(x2, n3);
} else {
- var [number5, exponent] = "".concat(x2, "e").split("e");
- var result = Math.floor(Number("".concat(number5, "e").concat(Number(exponent) + n3)));
- [number5, exponent] = "".concat(result, "e").split("e");
- return Number("".concat(number5, "e").concat(Number(exponent) - n3));
+ var [number4, exponent] = "".concat(x2, "e").split("e");
+ var result = Math.floor(Number("".concat(number4, "e").concat(Number(exponent) + n3)));
+ [number4, exponent] = "".concat(result, "e").split("e");
+ return Number("".concat(number4, "e").concat(Number(exponent) - n3));
}
}
});
@@ -54991,15 +54891,15 @@ var createMatAlgo02xDS0 = /* @__PURE__ */ factory(name47, dependencies47, (_ref)
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = [];
var cindex = [];
@@ -55021,7 +54921,7 @@ var createMatAlgo02xDS0 = /* @__PURE__ */ factory(name47, dependencies47, (_ref)
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt2 : void 0
+ datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : void 0
});
};
});
@@ -55053,13 +54953,13 @@ var createMatAlgo03xDSf = /* @__PURE__ */ factory(name48, dependencies48, (_ref)
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cdata = [];
for (var z2 = 0; z2 < rows; z2++) {
@@ -55068,14 +54968,14 @@ var createMatAlgo03xDSf = /* @__PURE__ */ factory(name48, dependencies48, (_ref)
var x2 = [];
var w2 = [];
for (var j = 0; j < columns; j++) {
- var mark2 = j + 1;
+ var mark = j + 1;
for (var k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) {
var i4 = bindex[k2];
x2[i4] = inverse ? cf(bvalues[k2], adata[i4][j]) : cf(adata[i4][j], bvalues[k2]);
- w2[i4] = mark2;
+ w2[i4] = mark;
}
for (var y3 = 0; y3 < rows; y3++) {
- if (w2[y3] === mark2) {
+ if (w2[y3] === mark) {
cdata[y3][j] = x2[y3];
} else {
cdata[y3][j] = inverse ? cf(zero, adata[y3][j]) : cf(adata[y3][j], zero);
@@ -55085,7 +54985,7 @@ var createMatAlgo03xDSf = /* @__PURE__ */ factory(name48, dependencies48, (_ref)
return denseMatrix.createDenseMatrix({
data: cdata,
size: [rows, columns],
- datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt2 : void 0
+ datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : void 0
});
};
});
@@ -55117,15 +55017,15 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = avalues && bvalues ? [] : void 0;
var cindex = [];
@@ -55137,21 +55037,21 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref
var i4, j, k2, k1;
for (j = 0; j < columns; j++) {
cptr[j] = cindex.length;
- var mark2 = j + 1;
+ var mark = j + 1;
for (k2 = aptr[j], k1 = aptr[j + 1]; k2 < k1; k2++) {
i4 = aindex[k2];
cindex.push(i4);
- wa[i4] = mark2;
+ wa[i4] = mark;
if (xa) {
xa[i4] = avalues[k2];
}
}
for (k2 = bptr[j], k1 = bptr[j + 1]; k2 < k1; k2++) {
i4 = bindex[k2];
- if (wa[i4] !== mark2) {
+ if (wa[i4] !== mark) {
cindex.push(i4);
}
- wb[i4] = mark2;
+ wb[i4] = mark;
if (xb) {
xb[i4] = bvalues[k2];
}
@@ -55162,9 +55062,9 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref
i4 = cindex[k2];
var wai = wa[i4];
var wbi = wb[i4];
- if (wai === mark2 || wbi === mark2) {
- var va = wai === mark2 ? xa[i4] : zero;
- var vb = wbi === mark2 ? xb[i4] : zero;
+ if (wai === mark || wbi === mark) {
+ var va = wai === mark ? xa[i4] : zero;
+ var vb = wbi === mark ? xb[i4] : zero;
var vc = cf(va, vb);
if (!eq(vc, zero)) {
cvalues.push(vc);
@@ -55182,7 +55082,7 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
};
});
@@ -55211,17 +55111,17 @@ var createMatAlgo13xDD = /* @__PURE__ */ factory(name50, dependencies50, (_ref)
}
csize[s4] = asize[s4];
}
- var dt2;
+ var dt;
var cf = callback;
if (typeof adt === "string" && adt === bdt) {
- dt2 = adt;
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ cf = typed3.find(callback, [dt, dt]);
}
var cdata = csize.length > 0 ? _iterate(cf, 0, csize, csize[0], adata, bdata) : [];
return a4.createDenseMatrix({
data: cdata,
size: csize,
- datatype: dt2
+ datatype: dt
});
};
function _iterate(f2, level, s4, n3, av, bv) {
@@ -55507,8 +55407,8 @@ var createMatAlgo01xDSid = /* @__PURE__ */ factory(name54, dependencies53, (_ref
}
var rows = asize[0];
var columns = asize[1];
- var dt2 = typeof adt === "string" && adt !== "mixed" && adt === bdt ? adt : void 0;
- var cf = dt2 ? typed3.find(callback, [dt2, dt2]) : callback;
+ var dt = typeof adt === "string" && adt !== "mixed" && adt === bdt ? adt : void 0;
+ var cf = dt ? typed3.find(callback, [dt, dt]) : callback;
var i4, j;
var cdata = [];
for (i4 = 0; i4 < rows; i4++) {
@@ -55517,14 +55417,14 @@ var createMatAlgo01xDSid = /* @__PURE__ */ factory(name54, dependencies53, (_ref
var x2 = [];
var w2 = [];
for (j = 0; j < columns; j++) {
- var mark2 = j + 1;
+ var mark = j + 1;
for (var k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = bindex[k2];
x2[i4] = inverse ? cf(bvalues[k2], adata[i4][j]) : cf(adata[i4][j], bvalues[k2]);
- w2[i4] = mark2;
+ w2[i4] = mark;
}
for (i4 = 0; i4 < rows; i4++) {
- if (w2[i4] === mark2) {
+ if (w2[i4] === mark) {
cdata[i4][j] = x2[i4];
} else {
cdata[i4][j] = adata[i4][j];
@@ -55534,7 +55434,7 @@ var createMatAlgo01xDSid = /* @__PURE__ */ factory(name54, dependencies53, (_ref
return denseMatrix.createDenseMatrix({
data: cdata,
size: [rows, columns],
- datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt2 : void 0
+ datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : void 0
});
};
});
@@ -55566,15 +55466,15 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = avalues && bvalues ? [] : void 0;
var cindex = [];
@@ -55586,18 +55486,18 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r
var i4, j, k2, k0, k1;
for (j = 0; j < columns; j++) {
cptr[j] = cindex.length;
- var mark2 = j + 1;
+ var mark = j + 1;
for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = aindex[k2];
cindex.push(i4);
- wa[i4] = mark2;
+ wa[i4] = mark;
if (xa) {
xa[i4] = avalues[k2];
}
}
for (k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = bindex[k2];
- if (wa[i4] === mark2) {
+ if (wa[i4] === mark) {
if (xa) {
var v2 = cf(xa[i4], bvalues[k2]);
if (!eq(v2, zero)) {
@@ -55608,7 +55508,7 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r
}
} else {
cindex.push(i4);
- wb[i4] = mark2;
+ wb[i4] = mark;
if (xb) {
xb[i4] = bvalues[k2];
}
@@ -55618,10 +55518,10 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r
k2 = cptr[j];
while (k2 < cindex.length) {
i4 = cindex[k2];
- if (wa[i4] === mark2) {
+ if (wa[i4] === mark) {
cvalues[k2] = xa[i4];
k2++;
- } else if (wb[i4] === mark2) {
+ } else if (wb[i4] === mark) {
cvalues[k2] = xb[i4];
k2++;
} else {
@@ -55636,7 +55536,7 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
};
});
@@ -55660,28 +55560,28 @@ var createMatAlgo10xSids = /* @__PURE__ */ factory(name56, dependencies55, (_ref
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var cf = callback;
if (typeof adt === "string") {
- dt2 = adt;
- b2 = typed3.convert(b2, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ b2 = typed3.convert(b2, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cdata = [];
var x2 = [];
var w2 = [];
for (var j = 0; j < columns; j++) {
- var mark2 = j + 1;
+ var mark = j + 1;
for (var k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
var r2 = aindex[k2];
x2[r2] = avalues[k2];
- w2[r2] = mark2;
+ w2[r2] = mark;
}
for (var i4 = 0; i4 < rows; i4++) {
if (j === 0) {
cdata[i4] = [];
}
- if (w2[i4] === mark2) {
+ if (w2[i4] === mark) {
cdata[i4][j] = inverse ? cf(b2, x2[i4]) : cf(x2[i4], b2);
} else {
cdata[i4][j] = b2;
@@ -55691,7 +55591,7 @@ var createMatAlgo10xSids = /* @__PURE__ */ factory(name56, dependencies55, (_ref
return new DenseMatrix2({
data: cdata,
size: [rows, columns],
- datatype: dt2
+ datatype: dt
});
};
});
@@ -55719,7 +55619,7 @@ var dependencies56 = ["typed", "config", "round", "matrix", "equalScalar", "zero
var gcdTypes = "number | BigNumber | Fraction | Matrix | Array";
var gcdManyTypesSignature = "".concat(gcdTypes, ", ").concat(gcdTypes, ", ...").concat(gcdTypes);
function is1d(array) {
- return !array.some((element3) => Array.isArray(element3));
+ return !array.some((element) => Array.isArray(element));
}
var createGcd = /* @__PURE__ */ factory(name57, dependencies56, (_ref) => {
var {
@@ -55837,15 +55737,15 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = avalues && bvalues ? [] : void 0;
var cindex = [];
@@ -55855,14 +55755,14 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref
var u3 = [];
for (var j = 0; j < columns; j++) {
cptr[j] = cindex.length;
- var mark2 = j + 1;
- scatter(a4, j, w2, x2, u3, mark2, cindex, cf);
- scatter(b2, j, w2, x2, u3, mark2, cindex, cf);
+ var mark = j + 1;
+ scatter(a4, j, w2, x2, u3, mark, cindex, cf);
+ scatter(b2, j, w2, x2, u3, mark, cindex, cf);
if (x2) {
var k2 = cptr[j];
while (k2 < cindex.length) {
var i4 = cindex[k2];
- if (u3[i4] === mark2) {
+ if (u3[i4] === mark) {
var v2 = x2[i4];
if (!eq(v2, zero)) {
cvalues.push(v2);
@@ -55875,13 +55775,13 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref
}
}
} else {
- var p2 = cptr[j];
- while (p2 < cindex.length) {
- var r2 = cindex[p2];
- if (u3[r2] !== mark2) {
- cindex.splice(p2, 1);
+ var p = cptr[j];
+ while (p < cindex.length) {
+ var r2 = cindex[p];
+ if (u3[r2] !== mark) {
+ cindex.splice(p, 1);
} else {
- p2++;
+ p++;
}
}
}
@@ -55892,7 +55792,7 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
};
});
@@ -55972,7 +55872,7 @@ var createLog10 = /* @__PURE__ */ factory(name60, dependencies59, (_ref) => {
Complex: _Complex
} = _ref;
return typed3(name60, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= 0 || config4.predictable) {
return log10Number(x2);
} else {
@@ -56003,7 +55903,7 @@ var createLog2 = /* @__PURE__ */ factory(name61, dependencies60, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name61, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= 0 || config4.predictable) {
return log2Number(x2);
} else {
@@ -56127,13 +56027,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
var bdt = b2._datatype || b2.getDataType();
var alength = asize[0];
var bcolumns = bsize[1];
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
}
var c3 = [];
for (var j = 0; j < bcolumns; j++) {
@@ -56146,7 +56046,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
return a4.createDenseMatrix({
data: c3,
size: [bcolumns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
}
var _multiplyMatrixVector = typed3("_multiplyMatrixVector", {
@@ -56167,13 +56067,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
var bdt = b2._datatype || b2.getDataType();
var arows = asize[0];
var acolumns = asize[1];
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
}
var c3 = [];
for (var i4 = 0; i4 < arows; i4++) {
@@ -56187,7 +56087,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
return a4.createDenseMatrix({
data: c3,
size: [arows],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
}
function _multiplyDenseMatrixDenseMatrix(a4, b2) {
@@ -56200,13 +56100,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
var arows = asize[0];
var acolumns = asize[1];
var bcolumns = bsize[1];
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
}
var c3 = [];
for (var i4 = 0; i4 < arows; i4++) {
@@ -56223,7 +56123,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
return a4.createDenseMatrix({
data: c3,
size: [arows, bcolumns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
}
function _multiplyDenseMatrixSparseMatrix(a4, b2) {
@@ -56240,17 +56140,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
}
var arows = asize[0];
var bcolumns = bsize[1];
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
var eq = equalScalar2;
var zero = 0;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
}
var cvalues = [];
var cindex = [];
@@ -56260,7 +56160,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
index: cindex,
ptr: cptr,
size: [arows, bcolumns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
for (var jb = 0; jb < bcolumns; jb++) {
cptr[jb] = cindex.length;
@@ -56269,18 +56169,18 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
if (kb1 > kb0) {
var last = 0;
for (var i4 = 0; i4 < arows; i4++) {
- var mark2 = i4 + 1;
+ var mark = i4 + 1;
var cij = void 0;
for (var kb = kb0; kb < kb1; kb++) {
var ib = bindex[kb];
- if (last !== mark2) {
+ if (last !== mark) {
cij = mf(adata[i4][ib], bvalues[kb]);
- last = mark2;
+ last = mark;
} else {
cij = af(cij, mf(adata[i4][ib], bvalues[kb]));
}
}
- if (last === mark2 && !eq(cij, zero)) {
+ if (last === mark && !eq(cij, zero)) {
cindex.push(i4);
cvalues.push(cij);
}
@@ -56305,17 +56205,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
var cvalues = [];
var cindex = [];
var cptr = [];
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
var eq = equalScalar2;
var zero = 0;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
}
var x2 = [];
var w2 = [];
@@ -56335,9 +56235,9 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
}
}
}
- for (var p1 = cindex.length, p2 = 0; p2 < p1; p2++) {
- var ic = cindex[p2];
- cvalues[p2] = x2[ic];
+ for (var p1 = cindex.length, p = 0; p < p1; p++) {
+ var ic = cindex[p];
+ cvalues[p] = x2[ic];
}
cptr[1] = cindex.length;
return a4.createSparseMatrix({
@@ -56345,7 +56245,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
index: cindex,
ptr: cptr,
size: [arows, 1],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
}
function _multiplySparseMatrixDenseMatrix(a4, b2) {
@@ -56361,17 +56261,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
var arows = a4._size[0];
var brows = b2._size[0];
var bcolumns = b2._size[1];
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
var eq = equalScalar2;
var zero = 0;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
}
var cvalues = [];
var cindex = [];
@@ -56381,20 +56281,20 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
index: cindex,
ptr: cptr,
size: [arows, bcolumns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
var x2 = [];
var w2 = [];
for (var jb = 0; jb < bcolumns; jb++) {
cptr[jb] = cindex.length;
- var mark2 = jb + 1;
+ var mark = jb + 1;
for (var ib = 0; ib < brows; ib++) {
var vbij = bdata[ib][jb];
if (!eq(vbij, zero)) {
for (var ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {
var ia = aindex[ka];
- if (w2[ia] !== mark2) {
- w2[ia] = mark2;
+ if (w2[ia] !== mark) {
+ w2[ia] = mark;
cindex.push(ia);
x2[ia] = mf(vbij, avalues[ka]);
} else {
@@ -56403,9 +56303,9 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
}
}
}
- for (var p0 = cptr[jb], p1 = cindex.length, p2 = p0; p2 < p1; p2++) {
- var ic = cindex[p2];
- cvalues[p2] = x2[ic];
+ for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) {
+ var ic = cindex[p];
+ cvalues[p] = x2[ic];
}
}
cptr[bcolumns] = cindex.length;
@@ -56423,13 +56323,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
var arows = a4._size[0];
var bcolumns = b2._size[1];
var values2 = avalues && bvalues;
- var dt2;
+ var dt;
var af = addScalar2;
var mf = multiplyScalar2;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- dt2 = adt;
- af = typed3.find(addScalar2, [dt2, dt2]);
- mf = typed3.find(multiplyScalar2, [dt2, dt2]);
+ dt = adt;
+ af = typed3.find(addScalar2, [dt, dt]);
+ mf = typed3.find(multiplyScalar2, [dt, dt]);
}
var cvalues = values2 ? [] : void 0;
var cindex = [];
@@ -56439,21 +56339,21 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
index: cindex,
ptr: cptr,
size: [arows, bcolumns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
var x2 = values2 ? [] : void 0;
var w2 = [];
var ka, ka0, ka1, kb, kb0, kb1, ia, ib;
for (var jb = 0; jb < bcolumns; jb++) {
cptr[jb] = cindex.length;
- var mark2 = jb + 1;
+ var mark = jb + 1;
for (kb0 = bptr[jb], kb1 = bptr[jb + 1], kb = kb0; kb < kb1; kb++) {
ib = bindex[kb];
if (values2) {
for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {
ia = aindex[ka];
- if (w2[ia] !== mark2) {
- w2[ia] = mark2;
+ if (w2[ia] !== mark) {
+ w2[ia] = mark;
cindex.push(ia);
x2[ia] = mf(bvalues[kb], avalues[ka]);
} else {
@@ -56463,17 +56363,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => {
} else {
for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {
ia = aindex[ka];
- if (w2[ia] !== mark2) {
- w2[ia] = mark2;
+ if (w2[ia] !== mark) {
+ w2[ia] = mark;
cindex.push(ia);
}
}
}
}
if (values2) {
- for (var p0 = cptr[jb], p1 = cindex.length, p2 = p0; p2 < p1; p2++) {
- var ic = cindex[p2];
- cvalues[p2] = x2[ic];
+ for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) {
+ var ic = cindex[p];
+ cvalues[p] = x2[ic];
}
}
}
@@ -56606,21 +56506,21 @@ var createNthRoot = /* @__PURE__ */ factory(name64, dependencies63, (_ref) => {
Ss: matAlgo11xS0s,
sS: false
}));
- function _bigNthRoot(a4, root4) {
+ function _bigNthRoot(a4, root) {
var precision = _BigNumber.precision;
var Big = _BigNumber.clone({
precision: precision + 2
});
var zero = new _BigNumber(0);
- var one5 = new Big(1);
- var inv2 = root4.isNegative();
+ var one = new Big(1);
+ var inv2 = root.isNegative();
if (inv2) {
- root4 = root4.neg();
+ root = root.neg();
}
- if (root4.isZero()) {
+ if (root.isZero()) {
throw new Error("Root must be non-zero");
}
- if (a4.isNegative() && !root4.abs().mod(2).equals(1)) {
+ if (a4.isNegative() && !root.abs().mod(2).equals(1)) {
throw new Error("Root must be odd when a is negative.");
}
if (a4.isZero()) {
@@ -56629,9 +56529,9 @@ var createNthRoot = /* @__PURE__ */ factory(name64, dependencies63, (_ref) => {
if (!a4.isFinite()) {
return inv2 ? zero : a4;
}
- var x2 = a4.abs().pow(one5.div(root4));
+ var x2 = a4.abs().pow(one.div(root));
x2 = a4.isNeg() ? x2.neg() : x2;
- return new _BigNumber((inv2 ? one5.div(x2) : x2).toPrecision(precision));
+ return new _BigNumber((inv2 ? one.div(x2) : x2).toPrecision(precision));
}
});
@@ -56796,10 +56696,10 @@ var createXgcd = /* @__PURE__ */ factory(name69, dependencies68, (_ref) => {
var q2;
var r2;
var zero = new BigNumber2(0);
- var one5 = new BigNumber2(1);
+ var one = new BigNumber2(1);
var x2 = zero;
- var lastx = one5;
- var y3 = one5;
+ var lastx = one;
+ var y3 = one;
var lasty = zero;
if (!a4.isInt() || !b2.isInt()) {
throw new Error("Parameters in function xgcd must be integer numbers");
@@ -56890,15 +56790,15 @@ var createMatAlgo09xS0Sf = /* @__PURE__ */ factory(name71, dependencies70, (_ref
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = avalues && bvalues ? [] : void 0;
var cindex = [];
@@ -56908,18 +56808,18 @@ var createMatAlgo09xS0Sf = /* @__PURE__ */ factory(name71, dependencies70, (_ref
var i4, j, k2, k0, k1;
for (j = 0; j < columns; j++) {
cptr[j] = cindex.length;
- var mark2 = j + 1;
+ var mark = j + 1;
if (x2) {
for (k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = bindex[k2];
- w2[i4] = mark2;
+ w2[i4] = mark;
x2[i4] = bvalues[k2];
}
}
for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = aindex[k2];
if (x2) {
- var vb = w2[i4] === mark2 ? x2[i4] : zero;
+ var vb = w2[i4] === mark ? x2[i4] : zero;
var vc = cf(avalues[k2], vb);
if (!eq(vc, zero)) {
cindex.push(i4);
@@ -56936,7 +56836,7 @@ var createMatAlgo09xS0Sf = /* @__PURE__ */ factory(name71, dependencies70, (_ref
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
};
});
@@ -57361,13 +57261,13 @@ var createMatAlgo07xSSf = /* @__PURE__ */ factory(name76, dependencies75, (_ref)
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var i4, j;
var cdata = [];
@@ -57379,28 +57279,28 @@ var createMatAlgo07xSSf = /* @__PURE__ */ factory(name76, dependencies75, (_ref)
var wa = [];
var wb = [];
for (j = 0; j < columns; j++) {
- var mark2 = j + 1;
- _scatter(a4, j, wa, xa, mark2);
- _scatter(b2, j, wb, xb, mark2);
+ var mark = j + 1;
+ _scatter(a4, j, wa, xa, mark);
+ _scatter(b2, j, wb, xb, mark);
for (i4 = 0; i4 < rows; i4++) {
- var va = wa[i4] === mark2 ? xa[i4] : zero;
- var vb = wb[i4] === mark2 ? xb[i4] : zero;
+ var va = wa[i4] === mark ? xa[i4] : zero;
+ var vb = wb[i4] === mark ? xb[i4] : zero;
cdata[i4][j] = cf(va, vb);
}
}
return new DenseMatrix2({
data: cdata,
size: [rows, columns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
};
- function _scatter(m4, j, w2, x2, mark2) {
+ function _scatter(m4, j, w2, x2, mark) {
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
for (var k2 = ptr[j], k1 = ptr[j + 1]; k2 < k1; k2++) {
- var i4 = index3[k2];
- w2[i4] = mark2;
+ var i4 = index2[k2];
+ w2[i4] = mark;
x2[i4] = values2[k2];
}
}
@@ -57450,7 +57350,7 @@ var createArg = /* @__PURE__ */ factory(name78, dependencies77, (_ref) => {
typed: typed3
} = _ref;
return typed3(name78, {
- number: function number5(x2) {
+ number: function number4(x2) {
return Math.atan2(0, x2);
},
BigNumber: function BigNumber2(x2) {
@@ -57666,7 +57566,7 @@ var createConcat = /* @__PURE__ */ factory(name85, dependencies84, (_ref) => {
}
return asMatrix ? matrix2(res) : res;
},
- "...string": function string6(args) {
+ "...string": function string4(args) {
return args.join("");
}
});
@@ -57694,8 +57594,8 @@ var createColumn = /* @__PURE__ */ factory(name86, dependencies85, (_ref) => {
}
validateIndex(column2, value.size()[1]);
var rowRange = range2(0, value.size()[0]);
- var index3 = new Index2(rowRange, column2);
- var result = value.subset(index3);
+ var index2 = new Index2(rowRange, column2);
+ var result = value.subset(index2);
return isMatrix(result) ? result : matrix2([[result]]);
}
});
@@ -57710,7 +57610,7 @@ var createCount = /* @__PURE__ */ factory(name87, dependencies86, (_ref) => {
prod: prod2
} = _ref;
return typed3(name87, {
- string: function string6(x2) {
+ string: function string4(x2) {
return x2.length;
},
"Matrix | Array": function MatrixArray(x2) {
@@ -57851,14 +57751,14 @@ var createDiag = /* @__PURE__ */ factory(name89, dependencies88, (_ref) => {
// node_modules/mathjs/lib/esm/utils/applyCallback.js
var import_typed_function2 = __toESM(require_typed_function(), 1);
-function applyCallback(callback, value, index3, array, mappingFnName) {
+function applyCallback(callback, value, index2, array, mappingFnName) {
if (import_typed_function2.default.isTypedFunction(callback)) {
- var args3 = [value, index3, array];
+ var args3 = [value, index2, array];
var signature3 = import_typed_function2.default.resolve(callback, args3);
if (signature3) {
return tryWithArgs(signature3.implementation, args3);
}
- var args2 = [value, index3];
+ var args2 = [value, index2];
var signature2 = import_typed_function2.default.resolve(callback, args2);
if (signature2) {
return tryWithArgs(signature2.implementation, args2);
@@ -57870,7 +57770,7 @@ function applyCallback(callback, value, index3, array, mappingFnName) {
}
return tryWithArgs(callback, args3);
} else {
- return callback(value, index3, array);
+ return callback(value, index2, array);
}
function tryWithArgs(signature, args) {
try {
@@ -57881,12 +57781,12 @@ function applyCallback(callback, value, index3, array, mappingFnName) {
var argsDesc = [];
argsDesc.push("value: ".concat(typeOf(value)));
if (args.length >= 2) {
- argsDesc.push("index: ".concat(typeOf(index3)));
+ argsDesc.push("index: ".concat(typeOf(index2)));
}
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(index3)));
+ throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "".concat(callback.name, "(").concat(argsDesc.join(", "), ") at index ").concat(JSON.stringify(index2)));
} else {
throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "to function ".concat(callback.name, ": ").concat(err.message));
}
@@ -57913,8 +57813,8 @@ var createFilter = /* @__PURE__ */ factory(name90, dependencies89, (_ref) => {
});
});
function _filterCallback(x2, callback) {
- return filter(x2, function(value, index3, array) {
- return applyCallback(callback, value, [index3], array, "filter");
+ return filter(x2, function(value, index2, array) {
+ return applyCallback(callback, value, [index2], array, "filter");
});
}
@@ -57952,13 +57852,13 @@ var createForEach = /* @__PURE__ */ factory(name92, dependencies91, (_ref) => {
});
});
function _forEach(array, callback) {
- var recurse = function recurse2(value, index3) {
+ var recurse = function recurse2(value, index2) {
if (Array.isArray(value)) {
forEach(value, function(child, i4) {
- recurse2(child, index3.concat(i4));
+ recurse2(child, index2.concat(i4));
});
} else {
- return applyCallback(callback, value, index3, array, "forEach");
+ return applyCallback(callback, value, index2, array, "forEach");
}
};
recurse(array, []);
@@ -57997,7 +57897,7 @@ var createIdentity = /* @__PURE__ */ factory(name94, dependencies93, (_ref) => {
"": function _15() {
return config4.matrix === "Matrix" ? matrix2([]) : [];
},
- string: function string6(format8) {
+ string: function string4(format8) {
return matrix2(format8);
},
"number | BigNumber": function numberBigNumber(rows) {
@@ -58049,22 +57949,22 @@ var createIdentity = /* @__PURE__ */ factory(name94, dependencies93, (_ref) => {
if (!isInteger(cols) || cols < 1) {
throw new Error("Parameters in function identity must be positive integers");
}
- var one5 = Big ? new BigNumber2(1) : 1;
+ var one = Big ? new BigNumber2(1) : 1;
var defaultValue2 = Big ? new Big(0) : 0;
var size2 = [rows, cols];
if (format8) {
if (format8 === "sparse") {
- return SparseMatrix2.diagonal(size2, one5, 0, defaultValue2);
+ return SparseMatrix2.diagonal(size2, one, 0, defaultValue2);
}
if (format8 === "dense") {
- return DenseMatrix2.diagonal(size2, one5, 0, defaultValue2);
+ return DenseMatrix2.diagonal(size2, one, 0, defaultValue2);
}
throw new TypeError('Unknown matrix type "'.concat(format8, '"'));
}
var res = resize([], size2, defaultValue2);
var minimum = rows < cols ? rows : cols;
for (var d4 = 0; d4 < minimum; d4++) {
- res[d4][d4] = one5;
+ res[d4][d4] = one;
}
return res;
}
@@ -58132,13 +58032,13 @@ var createMap2 = /* @__PURE__ */ factory(name96, dependencies95, (_ref) => {
});
});
function _map(array, callback) {
- var recurse = function recurse2(value, index3) {
+ var recurse = function recurse2(value, index2) {
if (Array.isArray(value)) {
return value.map(function(child, i4) {
- return recurse2(child, index3.concat(i4));
+ return recurse2(child, index2.concat(i4));
});
} else {
- return applyCallback(callback, value, index3, array, "map");
+ return applyCallback(callback, value, index2, array, "map");
}
};
return recurse(array, []);
@@ -58152,7 +58052,7 @@ var createDiff = /* @__PURE__ */ factory(name97, dependencies96, (_ref) => {
typed: typed3,
matrix: matrix2,
subtract: subtract3,
- number: number5
+ number: number4
} = _ref;
return typed3(name97, {
"Array | Matrix": function ArrayMatrix(arr) {
@@ -58171,8 +58071,8 @@ var createDiff = /* @__PURE__ */ factory(name97, dependencies96, (_ref) => {
return _recursive(arr, dim);
}
},
- "Array, BigNumber": typed3.referTo("Array,number", (selfAn) => (arr, dim) => selfAn(arr, number5(dim))),
- "Matrix, BigNumber": typed3.referTo("Matrix,number", (selfMn) => (arr, dim) => selfMn(arr, number5(dim)))
+ "Array, BigNumber": typed3.referTo("Array,number", (selfAn) => (arr, dim) => selfAn(arr, number4(dim))),
+ "Matrix, BigNumber": typed3.referTo("Matrix,number", (selfMn) => (arr, dim) => selfMn(arr, number4(dim)))
});
function _recursive(arr, dim) {
if (isMatrix(arr)) {
@@ -58183,8 +58083,8 @@ var createDiff = /* @__PURE__ */ factory(name97, dependencies96, (_ref) => {
}
if (dim > 0) {
var result = [];
- arr.forEach((element3) => {
- result.push(_recursive(element3, dim - 1));
+ arr.forEach((element) => {
+ result.push(_recursive(element, dim - 1));
});
return result;
} else if (dim === 0) {
@@ -58283,10 +58183,10 @@ var createOnes = /* @__PURE__ */ factory(name98, dependencies97, (_ref) => {
}
function _normalize(size2) {
var hasBigNumbers = false;
- size2.forEach(function(value, index3, arr) {
+ size2.forEach(function(value, index2, arr) {
if (isBigNumber(value)) {
hasBigNumbers = true;
- arr[index3] = value.toNumber();
+ arr[index2] = value.toNumber();
}
});
return hasBigNumbers;
@@ -58398,10 +58298,10 @@ var createRange = /* @__PURE__ */ factory(name99, dependencies98, (_ref) => {
var nums = args.map(function(arg2) {
return Number(arg2);
});
- var invalid4 = nums.some(function(num) {
+ var invalid2 = nums.some(function(num) {
return isNaN(num);
});
- if (invalid4) {
+ if (invalid2) {
return null;
}
switch (nums.length) {
@@ -58581,7 +58481,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r
"": function _15() {
return config4.matrix === "Matrix" ? matrix2([]) : [];
},
- string: function string6(format8) {
+ string: function string4(format8) {
return matrix2(format8);
},
"number | BigNumber | Complex | Unit": function numberBigNumberComplexUnit(theta) {
@@ -58615,8 +58515,8 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r
var minusOne = Big ? new BigNumber2(-1) : -1;
var cosTheta = cos3(theta);
var sinTheta = sin3(theta);
- var data3 = [[cosTheta, multiplyScalar2(minusOne, sinTheta)], [sinTheta, cosTheta]];
- return _convertToFormat(data3, format8);
+ var data2 = [[cosTheta, multiplyScalar2(minusOne, sinTheta)], [sinTheta, cosTheta]];
+ return _convertToFormat(data2, format8);
}
function _validateVector(v2) {
var size2 = v2.size();
@@ -58625,19 +58525,19 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r
}
}
function _mul(array) {
- return array.reduce((p2, curr) => multiplyScalar2(p2, curr));
+ return array.reduce((p, curr) => multiplyScalar2(p, curr));
}
- function _convertToFormat(data3, format8) {
+ function _convertToFormat(data2, format8) {
if (format8) {
if (format8 === "sparse") {
- return new SparseMatrix2(data3);
+ return new SparseMatrix2(data2);
}
if (format8 === "dense") {
- return new DenseMatrix2(data3);
+ return new DenseMatrix2(data2);
}
throw new TypeError('Unknown matrix type "'.concat(format8, '"'));
}
- return data3;
+ return data2;
}
function _rotationMatrix3x3(theta, v2, format8) {
var normV = norm3(v2);
@@ -58645,13 +58545,13 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r
throw new RangeError("Rotation around zero vector");
}
var Big = isBigNumber(theta) ? BigNumber2 : null;
- var one5 = Big ? new Big(1) : 1;
+ var one = Big ? new Big(1) : 1;
var minusOne = Big ? new Big(-1) : -1;
var vx = Big ? new Big(v2.get([0]) / normV) : v2.get([0]) / normV;
var vy = Big ? new Big(v2.get([1]) / normV) : v2.get([1]) / normV;
var vz = Big ? new Big(v2.get([2]) / normV) : v2.get([2]) / normV;
var c3 = cos3(theta);
- var oneMinusC = addScalar2(one5, unaryMinus2(c3));
+ var oneMinusC = addScalar2(one, unaryMinus2(c3));
var s4 = sin3(theta);
var r11 = addScalar2(c3, _mul([vx, vx, oneMinusC]));
var r12 = addScalar2(_mul([vx, vy, oneMinusC]), _mul([minusOne, vz, s4]));
@@ -58662,8 +58562,8 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r
var r31 = addScalar2(_mul([vx, vz, oneMinusC]), _mul([minusOne, vy, s4]));
var r32 = addScalar2(_mul([vy, vz, oneMinusC]), _mul([vx, s4]));
var r33 = addScalar2(c3, _mul([vz, vz, oneMinusC]));
- var data3 = [[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]];
- return _convertToFormat(data3, format8);
+ var data2 = [[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]];
+ return _convertToFormat(data2, format8);
}
});
@@ -58689,8 +58589,8 @@ var createRow = /* @__PURE__ */ factory(name104, dependencies103, (_ref) => {
}
validateIndex(row2, value.size()[0]);
var columnRange = range2(0, value.size()[1]);
- var index3 = new Index2(row2, columnRange);
- var result = value.subset(index3);
+ var index2 = new Index2(row2, columnRange);
+ var result = value.subset(index2);
return isMatrix(result) ? result : matrix2([[result]]);
}
});
@@ -58709,7 +58609,7 @@ var createSize = /* @__PURE__ */ factory(name105, dependencies104, (_ref) => {
return x2.create(x2.size());
},
Array: arraySize,
- string: function string6(x2) {
+ string: function string4(x2) {
return config4.matrix === "Array" ? [x2.length] : matrix2([x2.length]);
},
"number | Complex | BigNumber | Unit | boolean | null": function numberComplexBigNumberUnitBooleanNull(x2) {
@@ -58751,56 +58651,56 @@ var createSubset = /* @__PURE__ */ factory(name107, dependencies106, (_ref) => {
add: add4
} = _ref;
return typed3(name107, {
- "Matrix, Index": function MatrixIndex(value, index3) {
- if (isEmptyIndex(index3)) {
+ "Matrix, Index": function MatrixIndex(value, index2) {
+ if (isEmptyIndex(index2)) {
return matrix2();
}
- validateIndexSourceSize(value, index3);
- return value.subset(index3);
+ validateIndexSourceSize(value, index2);
+ return value.subset(index2);
},
"Array, Index": typed3.referTo("Matrix, Index", function(subsetRef) {
- return function(value, index3) {
- var subsetResult = subsetRef(matrix2(value), index3);
- return index3.isScalar() ? subsetResult : subsetResult.valueOf();
+ return function(value, index2) {
+ var subsetResult = subsetRef(matrix2(value), index2);
+ return index2.isScalar() ? subsetResult : subsetResult.valueOf();
};
}),
"Object, Index": _getObjectProperty,
"string, Index": _getSubstring,
- "Matrix, Index, any, any": function MatrixIndexAnyAny(value, index3, replacement, defaultValue2) {
- if (isEmptyIndex(index3)) {
+ "Matrix, Index, any, any": function MatrixIndexAnyAny(value, index2, replacement, defaultValue2) {
+ if (isEmptyIndex(index2)) {
return value;
}
- validateIndexSourceSize(value, index3);
- return value.clone().subset(index3, _broadcastReplacement(replacement, index3), defaultValue2);
+ validateIndexSourceSize(value, index2);
+ return value.clone().subset(index2, _broadcastReplacement(replacement, index2), defaultValue2);
},
"Array, Index, any, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) {
- return function(value, index3, replacement, defaultValue2) {
- var subsetResult = subsetRef(matrix2(value), index3, replacement, defaultValue2);
+ return function(value, index2, replacement, defaultValue2) {
+ var subsetResult = subsetRef(matrix2(value), index2, replacement, defaultValue2);
return subsetResult.isMatrix ? subsetResult.valueOf() : subsetResult;
};
}),
"Array, Index, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) {
- return function(value, index3, replacement) {
- return subsetRef(matrix2(value), index3, replacement, void 0).valueOf();
+ return function(value, index2, replacement) {
+ return subsetRef(matrix2(value), index2, replacement, void 0).valueOf();
};
}),
"Matrix, Index, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) {
- return function(value, index3, replacement) {
- return subsetRef(value, index3, replacement, void 0);
+ return function(value, index2, replacement) {
+ return subsetRef(value, index2, replacement, void 0);
};
}),
"string, Index, string": _setSubstring,
"string, Index, string, string": _setSubstring,
"Object, Index, any": _setObjectProperty
});
- function _broadcastReplacement(replacement, index3) {
+ function _broadcastReplacement(replacement, index2) {
if (typeof replacement === "string") {
throw new Error("can't boradcast a string");
}
- if (index3._isScalar) {
+ if (index2._isScalar) {
return replacement;
}
- var indexSize = index3.size();
+ var indexSize = index2.size();
if (indexSize.every((d4) => d4 > 0)) {
try {
return add4(replacement, zeros3(indexSize));
@@ -58812,37 +58712,37 @@ var createSubset = /* @__PURE__ */ factory(name107, dependencies106, (_ref) => {
}
}
});
-function _getSubstring(str, index3) {
- if (!isIndex(index3)) {
+function _getSubstring(str, index2) {
+ if (!isIndex(index2)) {
throw new TypeError("Index expected");
}
- if (isEmptyIndex(index3)) {
+ if (isEmptyIndex(index2)) {
return "";
}
- validateIndexSourceSize(Array.from(str), index3);
- if (index3.size().length !== 1) {
- throw new DimensionError(index3.size().length, 1);
+ validateIndexSourceSize(Array.from(str), index2);
+ if (index2.size().length !== 1) {
+ throw new DimensionError(index2.size().length, 1);
}
var strLen = str.length;
- validateIndex(index3.min()[0], strLen);
- validateIndex(index3.max()[0], strLen);
- var range2 = index3.dimension(0);
+ validateIndex(index2.min()[0], strLen);
+ validateIndex(index2.max()[0], strLen);
+ var range2 = index2.dimension(0);
var substr = "";
range2.forEach(function(v2) {
substr += str.charAt(v2);
});
return substr;
}
-function _setSubstring(str, index3, replacement, defaultValue2) {
- if (!index3 || index3.isIndex !== true) {
+function _setSubstring(str, index2, replacement, defaultValue2) {
+ if (!index2 || index2.isIndex !== true) {
throw new TypeError("Index expected");
}
- if (isEmptyIndex(index3)) {
+ if (isEmptyIndex(index2)) {
return str;
}
- validateIndexSourceSize(Array.from(str), index3);
- if (index3.size().length !== 1) {
- throw new DimensionError(index3.size().length, 1);
+ validateIndexSourceSize(Array.from(str), index2);
+ if (index2.size().length !== 1) {
+ throw new DimensionError(index2.size().length, 1);
}
if (defaultValue2 !== void 0) {
if (typeof defaultValue2 !== "string" || defaultValue2.length !== 1) {
@@ -58851,14 +58751,14 @@ function _setSubstring(str, index3, replacement, defaultValue2) {
} else {
defaultValue2 = " ";
}
- var range2 = index3.dimension(0);
+ var range2 = index2.dimension(0);
var len = range2.size()[0];
if (len !== replacement.length) {
throw new DimensionError(range2.size()[0], replacement.length);
}
var strLen = str.length;
- validateIndex(index3.min()[0]);
- validateIndex(index3.max()[0]);
+ validateIndex(index2.min()[0]);
+ validateIndex(index2.max()[0]);
var chars = [];
for (var i4 = 0; i4 < strLen; i4++) {
chars[i4] = str.charAt(i4);
@@ -58875,32 +58775,32 @@ function _setSubstring(str, index3, replacement, defaultValue2) {
}
return chars.join("");
}
-function _getObjectProperty(object, index3) {
- if (isEmptyIndex(index3)) {
+function _getObjectProperty(object, index2) {
+ if (isEmptyIndex(index2)) {
return void 0;
}
- if (index3.size().length !== 1) {
- throw new DimensionError(index3.size(), 1);
+ if (index2.size().length !== 1) {
+ throw new DimensionError(index2.size(), 1);
}
- var key3 = index3.dimension(0);
- if (typeof key3 !== "string") {
+ var key2 = index2.dimension(0);
+ if (typeof key2 !== "string") {
throw new TypeError("String expected as index to retrieve an object property");
}
- return getSafeProperty(object, key3);
+ return getSafeProperty(object, key2);
}
-function _setObjectProperty(object, index3, replacement) {
- if (isEmptyIndex(index3)) {
+function _setObjectProperty(object, index2, replacement) {
+ if (isEmptyIndex(index2)) {
return object;
}
- if (index3.size().length !== 1) {
- throw new DimensionError(index3.size(), 1);
+ if (index2.size().length !== 1) {
+ throw new DimensionError(index2.size(), 1);
}
- var key3 = index3.dimension(0);
- if (typeof key3 !== "string") {
+ var key2 = index2.dimension(0);
+ if (typeof key2 !== "string") {
throw new TypeError("String expected as index to retrieve an object property");
}
var updated = clone(object);
- setSafeProperty(updated, key3, replacement);
+ setSafeProperty(updated, key2, replacement);
return updated;
}
@@ -58947,13 +58847,13 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) =
return c3;
}
function _denseTranspose(m4, rows, columns) {
- var data3 = m4._data;
+ var data2 = m4._data;
var transposed = [];
var transposedRow;
for (var j = 0; j < columns; j++) {
transposedRow = transposed[j] = [];
for (var i4 = 0; i4 < rows; i4++) {
- transposedRow[i4] = clone(data3[i4][j]);
+ transposedRow[i4] = clone(data2[i4][j]);
}
}
return m4.createDenseMatrix({
@@ -58964,7 +58864,7 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) =
}
function _sparseTranspose(m4, rows, columns) {
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
var cvalues = values2 ? [] : void 0;
var cindex = [];
@@ -58973,9 +58873,9 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) =
for (var x2 = 0; x2 < rows; x2++) {
w2[x2] = 0;
}
- var p2, l2, j;
- for (p2 = 0, l2 = index3.length; p2 < l2; p2++) {
- w2[index3[p2]]++;
+ var p, l2, j;
+ for (p = 0, l2 = index2.length; p < l2; p++) {
+ w2[index2[p]]++;
}
var sum4 = 0;
for (var i4 = 0; i4 < rows; i4++) {
@@ -58986,7 +58886,7 @@ var createTranspose = /* @__PURE__ */ factory(name108, 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[index3[k2]]++;
+ var q2 = w2[index2[k2]]++;
cindex[q2] = j;
if (values2) {
cvalues[q2] = clone(values2[k2]);
@@ -59073,10 +58973,10 @@ var createZeros = /* @__PURE__ */ factory(name110, dependencies109, (_ref) => {
}
function _normalize(size2) {
var hasBigNumbers = false;
- size2.forEach(function(value, index3, arr) {
+ size2.forEach(function(value, index2, arr) {
if (isBigNumber(value)) {
hasBigNumbers = true;
- arr[index3] = value.toNumber();
+ arr[index2] = value.toNumber();
}
});
return hasBigNumbers;
@@ -59160,10 +59060,10 @@ var createFft = /* @__PURE__ */ factory(name111, dependencies110, (_ref) => {
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)];
for (var k2 = 0; k2 < len / 2; k2++) {
- var p2 = ret[k2];
+ var p = ret[k2];
var q2 = multiplyScalar2(ret[k2 + len / 2], exp3(multiplyScalar2(multiplyScalar2(tau3, I2), divideScalar2(-k2, len))));
- ret[k2] = addScalar2(p2, q2);
- ret[k2 + len / 2] = addScalar2(p2, multiplyScalar2(-1, q2));
+ ret[k2] = addScalar2(p, q2);
+ ret[k2 + len / 2] = addScalar2(p, multiplyScalar2(-1, q2));
}
return ret;
} else {
@@ -59222,7 +59122,7 @@ var createSolveODE = /* @__PURE__ */ factory(name113, dependencies112, (_ref) =>
multiply: multiply2,
divide: divide3,
max: max5,
- map: map6,
+ map: map4,
abs: abs3,
isPositive: isPositive2,
isNegative: isNegative2,
@@ -59279,7 +59179,7 @@ var createSolveODE = /* @__PURE__ */ factory(name113, dependencies112, (_ref) =>
for (var i4 = 1; i4 < c3.length; ++i4) {
k2.push(f2(add4(t5[n3], multiply2(c3[i4], h3)), add4(y3[n3], multiply2(h3, a4[i4], k2))));
}
- var TE = max5(abs3(map6(multiply2(deltaB, k2), (X2) => isUnit(X2) ? X2.value : X2)));
+ var TE = max5(abs3(map4(multiply2(deltaB, k2), (X2) => isUnit(X2) ? X2.value : X2)));
if (TE < tol && tol / TE > 1 / 4) {
t5.push(add4(t5[n3], h3));
y3.push(add4(y3[n3], multiply2(h3, b2, k2)));
@@ -59415,7 +59315,7 @@ var createErf = /* @__PURE__ */ factory(name114, dependencies113, (_ref) => {
typed: typed3
} = _ref;
return typed3("name", {
- number: function number5(x2) {
+ number: function number4(x2) {
var y3 = Math.abs(x2);
if (y3 >= MAX_NUM) {
return sign(x2);
@@ -59755,14 +59655,14 @@ var createPrint = /* @__PURE__ */ factory(name122, dependencies121, (_ref) => {
});
});
function _print(template2, values2, options) {
- return template2.replace(printTemplate, function(original, key3) {
- var keys2 = key3.split(".");
- var value = values2[keys2.shift()];
+ return template2.replace(printTemplate, function(original, key2) {
+ var keys = key2.split(".");
+ var value = values2[keys.shift()];
if (value !== void 0 && value.isMatrix) {
value = value.toArray();
}
- while (keys2.length && value !== void 0) {
- var k2 = keys2.shift();
+ while (keys.length && value !== void 0) {
+ var k2 = keys.shift();
value = k2 ? value[k2] : value + ".";
}
if (value !== void 0) {
@@ -59805,7 +59705,7 @@ var createIsPrime = /* @__PURE__ */ factory(name124, dependencies123, (_ref) =>
typed: typed3
} = _ref;
return typed3(name124, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 * 0 !== 0) {
return false;
}
@@ -59839,15 +59739,15 @@ var createIsPrime = /* @__PURE__ */ factory(name124, dependencies123, (_ref) =>
}
return true;
}
- function modPow(base3, exponent, modulus) {
+ function modPow(base2, exponent, modulus) {
var accumulator = 1;
while (!exponent.eq(0)) {
if (exponent.mod(2).eq(0)) {
exponent = exponent.div(2);
- base3 = base3.mul(base3).mod(modulus);
+ base2 = base2.mul(base2).mod(modulus);
} else {
exponent = exponent.sub(1);
- accumulator = base3.mul(accumulator).mod(modulus);
+ accumulator = base2.mul(accumulator).mod(modulus);
}
}
return accumulator;
@@ -59967,7 +59867,7 @@ var createPow = /* @__PURE__ */ factory(name127, dependencies126, (_ref) => {
multiply: multiply2,
matrix: matrix2,
inv: inv2,
- number: number5,
+ number: number4,
fraction: fraction2,
Complex: Complex3
} = _ref;
@@ -60010,7 +59910,7 @@ var createPow = /* @__PURE__ */ factory(name127, dependencies126, (_ref) => {
if (config4.predictable && !isInteger(y3) && x2 < 0) {
try {
var yFrac = fraction2(y3);
- var yNum = number5(yFrac);
+ var yNum = number4(yFrac);
if (y3 === yNum || Math.abs((y3 - yNum) / y3) < 1e-14) {
if (yFrac.d % 2 === 1) {
return (yFrac.n % 2 === 0 ? 1 : -1) * Math.pow(-x2, y3);
@@ -60097,7 +59997,7 @@ var createRound = /* @__PURE__ */ factory(name128, dependencies127, (_ref) => {
return Math.abs(splitNumber(epsilon).exponent);
}
return typed3(name128, {
- number: function number5(x2) {
+ number: function number4(x2) {
var xEpsilon = roundNumber(x2, toExponent(config4.epsilon));
var xSelected = nearlyEqual(x2, xEpsilon, config4.epsilon) ? xEpsilon : x2;
return roundNumber(xSelected);
@@ -60217,7 +60117,7 @@ var createLog = /* @__PURE__ */ factory(name129, dependencies128, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name129, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= 0 || config4.predictable) {
return logNumber(x2);
} else {
@@ -60234,8 +60134,8 @@ var createLog = /* @__PURE__ */ factory(name129, dependencies128, (_ref) => {
return new Complex3(x2.toNumber(), 0).log();
}
},
- "any, any": typed3.referToSelf((self2) => (x2, base3) => {
- return divideScalar2(self2(x2), self2(base3));
+ "any, any": typed3.referToSelf((self2) => (x2, base2) => {
+ return divideScalar2(self2(x2), self2(base2));
})
});
});
@@ -60252,7 +60152,7 @@ var createLog1p = /* @__PURE__ */ factory(name130, dependencies129, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name130, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= -1 || config4.predictable) {
return log1p(x2);
} else {
@@ -60269,8 +60169,8 @@ var createLog1p = /* @__PURE__ */ factory(name130, dependencies129, (_ref) => {
}
},
"Array | Matrix": typed3.referToSelf((self2) => (x2) => deepMap(x2, self2)),
- "any, any": typed3.referToSelf((self2) => (x2, base3) => {
- return divideScalar2(self2(x2), log4(base3));
+ "any, any": typed3.referToSelf((self2) => (x2, base2) => {
+ return divideScalar2(self2(x2), log4(base2));
})
});
function _log1pComplex(x2) {
@@ -60298,12 +60198,12 @@ var createNthRoots = /* @__PURE__ */ factory(name131, dependencies130, (_ref) =>
}, function imagNeg(val) {
return new Complex3(0, -val);
}];
- function _nthComplexRoots(a4, root4) {
- if (root4 < 0)
+ function _nthComplexRoots(a4, root) {
+ if (root < 0)
throw new Error("Root must be greater than zero");
- if (root4 === 0)
+ if (root === 0)
throw new Error("Root must be non-zero");
- if (root4 % 1 !== 0)
+ if (root % 1 !== 0)
throw new Error("Root must be an integer");
if (a4 === 0 || a4.abs() === 0)
return [new Complex3(0, 0)];
@@ -60321,16 +60221,16 @@ var createNthRoots = /* @__PURE__ */ factory(name131, dependencies130, (_ref) =>
var arg2 = a4.arg();
var abs3 = a4.abs();
var roots = [];
- var r2 = Math.pow(abs3, 1 / root4);
- for (var k2 = 0; k2 < root4; k2++) {
- var halfPiFactor = (offset2 + 4 * k2) / root4;
+ var r2 = Math.pow(abs3, 1 / root);
+ for (var k2 = 0; k2 < root; k2++) {
+ var halfPiFactor = (offset2 + 4 * k2) / root;
if (halfPiFactor === Math.round(halfPiFactor)) {
roots.push(_calculateExactResult[halfPiFactor % 4](r2));
continue;
}
roots.push(new Complex3({
r: r2,
- phi: (arg2 + 2 * Math.PI * k2) / root4
+ phi: (arg2 + 2 * Math.PI * k2) / root
}));
}
return roots;
@@ -60454,7 +60354,7 @@ function createSolveValidation(_ref) {
if (rows !== columns) {
throw new RangeError("Matrix must be square (size: " + format4(mSize) + ")");
}
- var data3 = [];
+ var data2 = [];
if (isMatrix(b2)) {
var bSize = b2.size();
var bdata = b2._data;
@@ -60463,10 +60363,10 @@ function createSolveValidation(_ref) {
throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");
}
for (var i4 = 0; i4 < rows; i4++) {
- data3[i4] = [bdata[i4]];
+ data2[i4] = [bdata[i4]];
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [rows, 1],
datatype: b2._datatype
});
@@ -60477,12 +60377,12 @@ function createSolveValidation(_ref) {
}
if (isDenseMatrix(b2)) {
if (copy) {
- data3 = [];
+ data2 = [];
for (var _i = 0; _i < rows; _i++) {
- data3[_i] = [bdata[_i][0]];
+ data2[_i] = [bdata[_i][0]];
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [rows, 1],
datatype: b2._datatype
});
@@ -60491,17 +60391,17 @@ function createSolveValidation(_ref) {
}
if (isSparseMatrix(b2)) {
for (var _i2 = 0; _i2 < rows; _i2++) {
- data3[_i2] = [0];
+ data2[_i2] = [0];
}
var values2 = b2._values;
- var index3 = b2._index;
+ var index2 = b2._index;
var ptr = b2._ptr;
for (var k1 = ptr[1], k2 = ptr[0]; k2 < k1; k2++) {
- var _i3 = index3[k2];
- data3[_i3][0] = values2[k2];
+ var _i3 = index2[k2];
+ data2[_i3][0] = values2[k2];
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [rows, 1],
datatype: b2._datatype
});
@@ -60516,10 +60416,10 @@ function createSolveValidation(_ref) {
throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");
}
for (var _i4 = 0; _i4 < rows; _i4++) {
- data3[_i4] = [b2[_i4]];
+ data2[_i4] = [b2[_i4]];
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [rows, 1]
});
}
@@ -60528,10 +60428,10 @@ function createSolveValidation(_ref) {
throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");
}
for (var _i5 = 0; _i5 < rows; _i5++) {
- data3[_i5] = [b2[_i5][0]];
+ data2[_i5] = [b2[_i5][0]];
}
return new DenseMatrix2({
- data: data3,
+ data: data2,
size: [rows, 1]
});
}
@@ -60604,7 +60504,7 @@ var createLsolve = /* @__PURE__ */ factory(name134, dependencies133, (_ref) => {
var rows = m4._size[0];
var columns = m4._size[1];
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
var x2 = [];
for (var j = 0; j < columns; j++) {
@@ -60616,7 +60516,7 @@ var createLsolve = /* @__PURE__ */ factory(name134, dependencies133, (_ref) => {
var firstIndex = ptr[j];
var lastIndex = ptr[j + 1];
for (var k2 = firstIndex; k2 < lastIndex; k2++) {
- var i4 = index3[k2];
+ var i4 = index2[k2];
if (i4 === j) {
vjj = values2[k2];
} else if (i4 > j) {
@@ -60708,7 +60608,7 @@ var createUsolve = /* @__PURE__ */ factory(name135, dependencies134, (_ref) => {
var rows = m4._size[0];
var columns = m4._size[1];
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
var x2 = [];
for (var j = columns - 1; j >= 0; j--) {
@@ -60720,7 +60620,7 @@ var createUsolve = /* @__PURE__ */ factory(name135, dependencies134, (_ref) => {
var firstIndex = ptr[j];
var lastIndex = ptr[j + 1];
for (var k2 = lastIndex - 1; k2 >= firstIndex; k2--) {
- var i4 = index3[k2];
+ var i4 = index2[k2];
if (i4 === j) {
vjj = values2[k2];
} else if (i4 < j) {
@@ -60819,7 +60719,7 @@ var createLsolveAll = /* @__PURE__ */ factory(name136, dependencies135, (_ref) =
var rows = m4._size[0];
var columns = m4._size[1];
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
for (var i4 = 0; i4 < columns; i4++) {
var L2 = B2.length;
@@ -60831,7 +60731,7 @@ var createLsolveAll = /* @__PURE__ */ factory(name136, dependencies135, (_ref) =
var lastIndex = ptr[i4 + 1];
var Mii = 0;
for (var j = firstIndex; j < lastIndex; j++) {
- var J = index3[j];
+ var J = index2[j];
if (J === i4) {
Mii = values2[j];
} else if (J > i4) {
@@ -60942,7 +60842,7 @@ var createUsolveAll = /* @__PURE__ */ factory(name137, dependencies136, (_ref) =
var rows = m4._size[0];
var columns = m4._size[1];
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
for (var i4 = columns - 1; i4 >= 0; i4--) {
var L2 = B2.length;
@@ -60954,7 +60854,7 @@ var createUsolveAll = /* @__PURE__ */ factory(name137, dependencies136, (_ref) =
var lastIndex = ptr[i4 + 1];
var Mii = 0;
for (var j = lastIndex - 1; j >= firstIndex; j--) {
- var J = index3[j];
+ var J = index2[j];
if (J === i4) {
Mii = values2[j];
} else if (J < i4) {
@@ -61024,15 +60924,15 @@ var createMatAlgo08xS0Sid = /* @__PURE__ */ factory(name138, dependencies137, (_
}
var rows = asize[0];
var columns = asize[1];
- var dt2;
+ var dt;
var eq = equalScalar2;
var zero = 0;
var cf = callback;
if (typeof adt === "string" && adt === bdt && adt !== "mixed") {
- dt2 = adt;
- eq = typed3.find(equalScalar2, [dt2, dt2]);
- zero = typed3.convert(0, dt2);
- cf = typed3.find(callback, [dt2, dt2]);
+ dt = adt;
+ eq = typed3.find(equalScalar2, [dt, dt]);
+ zero = typed3.convert(0, dt);
+ cf = typed3.find(callback, [dt, dt]);
}
var cvalues = [];
var cindex = [];
@@ -61042,16 +60942,16 @@ var createMatAlgo08xS0Sid = /* @__PURE__ */ factory(name138, dependencies137, (_
var k2, k0, k1, i4;
for (var j = 0; j < columns; j++) {
cptr[j] = cindex.length;
- var mark2 = j + 1;
+ var mark = j + 1;
for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = aindex[k2];
- w2[i4] = mark2;
+ w2[i4] = mark;
x2[i4] = avalues[k2];
cindex.push(i4);
}
for (k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) {
i4 = bindex[k2];
- if (w2[i4] === mark2) {
+ if (w2[i4] === mark) {
x2[i4] = cf(x2[i4], bvalues[k2]);
}
}
@@ -61073,7 +60973,7 @@ var createMatAlgo08xS0Sid = /* @__PURE__ */ factory(name138, dependencies137, (_
index: cindex,
ptr: cptr,
size: [rows, columns],
- datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0
+ datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0
});
};
});
@@ -62153,21 +62053,21 @@ var createSort = /* @__PURE__ */ factory(name155, dependencies154, (_ref) => {
_matrixIsVector(x2);
return matrix2(x2.toArray().sort(_comparator2), x2.storage());
},
- "Array, string": function ArrayString(x2, order2) {
+ "Array, string": function ArrayString(x2, order) {
_arrayIsVector(x2);
- return x2.sort(_comparator(order2));
+ return x2.sort(_comparator(order));
},
- "Matrix, string": function MatrixString(x2, order2) {
+ "Matrix, string": function MatrixString(x2, order) {
_matrixIsVector(x2);
- return matrix2(x2.toArray().sort(_comparator(order2)), x2.storage());
+ return matrix2(x2.toArray().sort(_comparator(order)), x2.storage());
}
});
- function _comparator(order2) {
- if (order2 === "asc") {
+ function _comparator(order) {
+ if (order === "asc") {
return compareAsc;
- } else if (order2 === "desc") {
+ } else if (order === "desc") {
return compareDesc;
- } else if (order2 === "natural") {
+ } else if (order === "natural") {
return compareNatural2;
} else {
throw new Error('String "asc", "desc", or "natural" expected');
@@ -62297,28 +62197,28 @@ var createImmutableDenseMatrixClass = /* @__PURE__ */ factory(name158, dependenc
smaller: smaller2,
DenseMatrix: DenseMatrix2
} = _ref;
- function ImmutableDenseMatrix2(data3, datatype) {
+ function ImmutableDenseMatrix2(data2, datatype) {
if (!(this instanceof ImmutableDenseMatrix2)) {
throw new SyntaxError("Constructor must be called with the new operator");
}
if (datatype && !isString2(datatype)) {
throw new Error("Invalid datatype: " + datatype);
}
- if (isMatrix(data3) || isArray2(data3)) {
- var matrix2 = new DenseMatrix2(data3, datatype);
+ if (isMatrix(data2) || isArray2(data2)) {
+ var matrix2 = new DenseMatrix2(data2, datatype);
this._data = matrix2._data;
this._size = matrix2._size;
this._datatype = matrix2._datatype;
this._min = null;
this._max = null;
- } else if (data3 && isArray2(data3.data) && isArray2(data3.size)) {
- this._data = data3.data;
- this._size = data3.size;
- this._datatype = data3.datatype;
- this._min = typeof data3.min !== "undefined" ? data3.min : null;
- this._max = typeof data3.max !== "undefined" ? data3.max : null;
- } else if (data3) {
- throw new TypeError("Unsupported type of data (" + typeOf(data3) + ")");
+ } else if (data2 && isArray2(data2.data) && isArray2(data2.size)) {
+ this._data = data2.data;
+ this._size = data2.size;
+ this._datatype = data2.datatype;
+ this._min = typeof data2.min !== "undefined" ? data2.min : null;
+ this._max = typeof data2.max !== "undefined" ? data2.max : null;
+ } else if (data2) {
+ throw new TypeError("Unsupported type of data (" + typeOf(data2) + ")");
} else {
this._data = [];
this._size = [0];
@@ -62330,10 +62230,10 @@ var createImmutableDenseMatrixClass = /* @__PURE__ */ factory(name158, dependenc
ImmutableDenseMatrix2.prototype = new DenseMatrix2();
ImmutableDenseMatrix2.prototype.type = "ImmutableDenseMatrix";
ImmutableDenseMatrix2.prototype.isImmutableDenseMatrix = true;
- ImmutableDenseMatrix2.prototype.subset = function(index3) {
+ ImmutableDenseMatrix2.prototype.subset = function(index2) {
switch (arguments.length) {
case 1: {
- var m4 = DenseMatrix2.prototype.subset.call(this, index3);
+ var m4 = DenseMatrix2.prototype.subset.call(this, index2);
if (isMatrix(m4)) {
return new ImmutableDenseMatrix2({
data: m4._data,
@@ -62469,16 +62369,16 @@ var createIndexClass = /* @__PURE__ */ factory(name159, dependencies158, (_ref)
return new ImmutableDenseMatrix2(arg2);
}
Index2.prototype.clone = function() {
- var index3 = new Index2();
- index3._dimensions = clone(this._dimensions);
- index3._isScalar = this._isScalar;
- index3._sourceSize = this._sourceSize;
- return index3;
+ var index2 = new Index2();
+ index2._dimensions = clone(this._dimensions);
+ index2._isScalar = this._isScalar;
+ index2._sourceSize = this._sourceSize;
+ return index2;
};
Index2.create = function(ranges) {
- var index3 = new Index2();
- Index2.apply(index3, ranges);
- return index3;
+ var index2 = new Index2();
+ Index2.apply(index2, ranges);
+ return index2;
};
Index2.prototype.size = function() {
var size2 = [];
@@ -62583,28 +62483,28 @@ var createFibonacciHeapClass = /* @__PURE__ */ factory(name160, dependencies159,
}
FibonacciHeap2.prototype.type = "FibonacciHeap";
FibonacciHeap2.prototype.isFibonacciHeap = true;
- FibonacciHeap2.prototype.insert = function(key3, value) {
- var node2 = {
- key: key3,
+ FibonacciHeap2.prototype.insert = function(key2, value) {
+ var node = {
+ key: key2,
value,
degree: 0
};
if (this._minimum) {
var minimum = this._minimum;
- node2.left = minimum;
- node2.right = minimum.right;
- minimum.right = node2;
- node2.right.left = node2;
- if (smaller2(key3, minimum.key)) {
- this._minimum = node2;
+ node.left = minimum;
+ node.right = minimum.right;
+ minimum.right = node;
+ node.right.left = node;
+ if (smaller2(key2, minimum.key)) {
+ this._minimum = node;
}
} else {
- node2.left = node2;
- node2.right = node2;
- this._minimum = node2;
+ node.left = node;
+ node.right = node;
+ this._minimum = node;
}
this._size++;
- return node2;
+ return node;
};
FibonacciHeap2.prototype.size = function() {
return this._size;
@@ -62617,13 +62517,13 @@ var createFibonacciHeapClass = /* @__PURE__ */ factory(name160, dependencies159,
return this._size === 0;
};
FibonacciHeap2.prototype.extractMinimum = function() {
- var node2 = this._minimum;
- if (node2 === null) {
- return node2;
+ var node = this._minimum;
+ if (node === null) {
+ return node;
}
var minimum = this._minimum;
- var numberOfChildren = node2.degree;
- var x2 = node2.child;
+ var numberOfChildren = node.degree;
+ var x2 = node.child;
while (numberOfChildren > 0) {
var tempRight = x2.right;
x2.left.right = x2.right;
@@ -62636,79 +62536,79 @@ var createFibonacciHeapClass = /* @__PURE__ */ factory(name160, dependencies159,
x2 = tempRight;
numberOfChildren--;
}
- node2.left.right = node2.right;
- node2.right.left = node2.left;
- if (node2 === node2.right) {
+ node.left.right = node.right;
+ node.right.left = node.left;
+ if (node === node.right) {
minimum = null;
} else {
- minimum = node2.right;
+ minimum = node.right;
minimum = _findMinimumNode(minimum, this._size);
}
this._size--;
this._minimum = minimum;
- return node2;
+ return node;
};
- FibonacciHeap2.prototype.remove = function(node2) {
- this._minimum = _decreaseKey(this._minimum, node2, -1);
+ FibonacciHeap2.prototype.remove = function(node) {
+ this._minimum = _decreaseKey(this._minimum, node, -1);
this.extractMinimum();
};
- function _decreaseKey(minimum, node2, key3) {
- node2.key = key3;
- var parent = node2.parent;
- if (parent && smaller2(node2.key, parent.key)) {
- _cut(minimum, node2, parent);
+ function _decreaseKey(minimum, node, key2) {
+ node.key = key2;
+ var parent = node.parent;
+ if (parent && smaller2(node.key, parent.key)) {
+ _cut(minimum, node, parent);
_cascadingCut(minimum, parent);
}
- if (smaller2(node2.key, minimum.key)) {
- minimum = node2;
+ if (smaller2(node.key, minimum.key)) {
+ minimum = node;
}
return minimum;
}
- function _cut(minimum, node2, parent) {
- node2.left.right = node2.right;
- node2.right.left = node2.left;
+ function _cut(minimum, node, parent) {
+ node.left.right = node.right;
+ node.right.left = node.left;
parent.degree--;
- if (parent.child === node2) {
- parent.child = node2.right;
+ if (parent.child === node) {
+ parent.child = node.right;
}
if (parent.degree === 0) {
parent.child = null;
}
- node2.left = minimum;
- node2.right = minimum.right;
- minimum.right = node2;
- node2.right.left = node2;
- node2.parent = null;
- node2.mark = false;
+ node.left = minimum;
+ node.right = minimum.right;
+ minimum.right = node;
+ node.right.left = node;
+ node.parent = null;
+ node.mark = false;
}
- function _cascadingCut(minimum, node2) {
- var parent = node2.parent;
+ function _cascadingCut(minimum, node) {
+ var parent = node.parent;
if (!parent) {
return;
}
- if (!node2.mark) {
- node2.mark = true;
+ if (!node.mark) {
+ node.mark = true;
} else {
- _cut(minimum, node2, parent);
+ _cut(minimum, node, parent);
_cascadingCut(parent);
}
}
- var _linkNodes = function _linkNodes2(node2, parent) {
- node2.left.right = node2.right;
- node2.right.left = node2.left;
- node2.parent = parent;
+ var _linkNodes = function _linkNodes2(node, parent) {
+ node.left.right = node.right;
+ node.right.left = node.left;
+ node.parent = parent;
if (!parent.child) {
- parent.child = node2;
- node2.right = node2;
- node2.left = node2;
+ parent.child = node;
+ node.right = node;
+ node.left = node;
} else {
- node2.left = parent.child;
- node2.right = parent.child.right;
- parent.child.right = node2;
- node2.right.left = node2;
+ node.left = parent.child;
+ node.right = parent.child.right;
+ parent.child.right = node;
+ node.right.left = node;
}
parent.degree++;
- node2.mark = false;
+ node.mark = false;
};
function _findMinimumNode(minimum, size2) {
var arraySize2 = Math.floor(Math.log(size2) * oneOverLogPhi) + 1;
@@ -62792,51 +62692,51 @@ var createSpaClass = /* @__PURE__ */ factory(name161, dependencies160, (_ref) =>
Spa2.prototype.isSpa = true;
Spa2.prototype.set = function(i4, v2) {
if (!this._values[i4]) {
- var node2 = this._heap.insert(i4, v2);
- this._values[i4] = node2;
+ var node = this._heap.insert(i4, v2);
+ this._values[i4] = node;
} else {
this._values[i4].value = v2;
}
};
Spa2.prototype.get = function(i4) {
- var node2 = this._values[i4];
- if (node2) {
- return node2.value;
+ var node = this._values[i4];
+ if (node) {
+ return node.value;
}
return 0;
};
Spa2.prototype.accumulate = function(i4, v2) {
- var node2 = this._values[i4];
- if (!node2) {
- node2 = this._heap.insert(i4, v2);
- this._values[i4] = node2;
+ var node = this._values[i4];
+ if (!node) {
+ node = this._heap.insert(i4, v2);
+ this._values[i4] = node;
} else {
- node2.value = addScalar2(node2.value, v2);
+ node.value = addScalar2(node.value, v2);
}
};
Spa2.prototype.forEach = function(from, to2, callback) {
var heap = this._heap;
var values2 = this._values;
var nodes = [];
- var node2 = heap.extractMinimum();
- if (node2) {
- nodes.push(node2);
+ var node = heap.extractMinimum();
+ if (node) {
+ nodes.push(node);
}
- while (node2 && node2.key <= to2) {
- if (node2.key >= from) {
- if (!equalScalar2(node2.value, 0)) {
- callback(node2.key, node2.value, this);
+ while (node && node.key <= to2) {
+ if (node.key >= from) {
+ if (!equalScalar2(node.value, 0)) {
+ callback(node.key, node.value, this);
}
}
- node2 = heap.extractMinimum();
- if (node2) {
- nodes.push(node2);
+ node = heap.extractMinimum();
+ if (node) {
+ nodes.push(node);
}
}
for (var i4 = 0; i4 < nodes.length; i4++) {
var n3 = nodes[i4];
- node2 = heap.insert(n3.key, n3.value);
- values2[node2.key] = node2;
+ node = heap.insert(n3.key, n3.value);
+ values2[node.key] = node;
}
};
Spa2.prototype.swap = function(i4, j) {
@@ -62965,7 +62865,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
Unit2.prototype.constructor = Unit2;
Unit2.prototype.type = "Unit";
Unit2.prototype.isUnit = true;
- var text7, index3, c3;
+ var text2, index2, c3;
function skipWhitespace() {
while (c3 === " " || c3 === " ") {
next();
@@ -62978,50 +62878,50 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
return c4 >= "0" && c4 <= "9";
}
function next() {
- index3++;
- c3 = text7.charAt(index3);
+ index2++;
+ c3 = text2.charAt(index2);
}
- function revert2(oldIndex) {
- index3 = oldIndex;
- c3 = text7.charAt(index3);
+ function revert(oldIndex) {
+ index2 = oldIndex;
+ c3 = text2.charAt(index2);
}
function parseNumber() {
- var number5 = "";
- var oldIndex = index3;
+ var number4 = "";
+ var oldIndex = index2;
if (c3 === "+") {
next();
} else if (c3 === "-") {
- number5 += c3;
+ number4 += c3;
next();
}
if (!isDigitDot(c3)) {
- revert2(oldIndex);
+ revert(oldIndex);
return null;
}
if (c3 === ".") {
- number5 += c3;
+ number4 += c3;
next();
if (!isDigit(c3)) {
- revert2(oldIndex);
+ revert(oldIndex);
return null;
}
} else {
while (isDigit(c3)) {
- number5 += c3;
+ number4 += c3;
next();
}
if (c3 === ".") {
- number5 += c3;
+ number4 += c3;
next();
}
}
while (isDigit(c3)) {
- number5 += c3;
+ number4 += c3;
next();
}
if (c3 === "E" || c3 === "e") {
var tentativeNumber = "";
- var tentativeIndex = index3;
+ var tentativeIndex = index2;
tentativeNumber += c3;
next();
if (c3 === "+" || c3 === "-") {
@@ -63029,16 +62929,16 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
next();
}
if (!isDigit(c3)) {
- revert2(tentativeIndex);
- return number5;
+ revert(tentativeIndex);
+ return number4;
}
- number5 = number5 + tentativeNumber;
+ number4 = number4 + tentativeNumber;
while (isDigit(c3)) {
- number5 += c3;
+ number4 += c3;
next();
}
}
- return number5;
+ return number4;
}
function parseUnit() {
var unitName = "";
@@ -63063,10 +62963,10 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
}
Unit2.parse = function(str, options) {
options = options || {};
- text7 = str;
- index3 = -1;
+ text2 = str;
+ index2 = -1;
c3 = "";
- if (typeof text7 !== "string") {
+ if (typeof text2 !== "string") {
throw new TypeError("Invalid argument in Unit.parse, string expected");
}
var unit3 = new Unit2();
@@ -63114,7 +63014,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
var oldC = c3;
uStr = parseUnit();
if (uStr === null) {
- throw new SyntaxError('Unexpected "' + oldC + '" in "' + text7 + '" at index ' + index3.toString());
+ throw new SyntaxError('Unexpected "' + oldC + '" in "' + text2 + '" at index ' + index2.toString());
}
} else {
break;
@@ -63127,11 +63027,11 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
skipWhitespace();
if (parseCharacter("^")) {
skipWhitespace();
- var p2 = parseNumber();
- if (p2 === null) {
+ var p = parseNumber();
+ if (p === null) {
throw new SyntaxError('In "' + str + '", "^" must be followed by a floating-point number');
}
- power *= p2;
+ power *= p;
}
unit3.units.push({
unit: res.unit,
@@ -63144,7 +63044,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
skipWhitespace();
while (c3 === ")") {
if (powerMultiplierStack.length === 0) {
- throw new SyntaxError('Unmatched ")" in "' + text7 + '" at index ' + index3.toString());
+ throw new SyntaxError('Unmatched ")" in "' + text2 + '" at index ' + index2.toString());
}
powerMultiplierStackProduct /= powerMultiplierStack.pop();
next();
@@ -63176,7 +63076,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
throw new SyntaxError('Trailing characters: "' + str + '"');
}
if (powerMultiplierStack.length !== 0) {
- throw new SyntaxError('Unmatched "(" in "' + text7 + '"');
+ throw new SyntaxError('Unmatched "(" in "' + text2 + '"');
}
if (unit3.units.length === 0 && !options.allowNoUnits) {
throw new SyntaxError('"' + str + '" contains no units');
@@ -63193,9 +63093,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
unit3.units = [];
for (var i4 = 0; i4 < this.units.length; i4++) {
unit3.units[i4] = {};
- for (var p2 in this.units[i4]) {
- if (hasOwnProperty2(this.units[i4], p2)) {
- unit3.units[i4][p2] = this.units[i4][p2];
+ for (var p in this.units[i4]) {
+ if (hasOwnProperty2(this.units[i4], p)) {
+ unit3.units[i4][p] = this.units[i4][p];
}
}
}
@@ -63215,11 +63115,11 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
return value;
}
var res = value;
- var convert2 = Unit2._getNumberConverter(typeOf(value));
+ var convert = Unit2._getNumberConverter(typeOf(value));
for (var i4 = 0; i4 < this.units.length; i4++) {
- var unitValue = convert2(this.units[i4].unit.value);
- var unitPrefixValue = convert2(this.units[i4].prefix.value);
- var unitPower = convert2(this.units[i4].power);
+ var unitValue = convert(this.units[i4].unit.value);
+ var unitPrefixValue = convert(this.units[i4].prefix.value);
+ var unitPower = convert(this.units[i4].power);
res = multiplyScalar2(res, pow3(multiplyScalar2(unitValue, unitPrefixValue), unitPower));
}
return res;
@@ -63229,11 +63129,11 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
return value;
}
var res = value;
- var convert2 = Unit2._getNumberConverter(typeOf(value));
+ var convert = Unit2._getNumberConverter(typeOf(value));
for (var i4 = 0; i4 < this.units.length; i4++) {
- var unitValue = convert2(this.units[i4].unit.value);
- var unitPrefixValue = convert2(this.units[i4].prefix.value);
- var unitPower = convert2(this.units[i4].power);
+ var unitValue = convert(this.units[i4].unit.value);
+ var unitPrefixValue = convert(this.units[i4].prefix.value);
+ var unitPower = convert(this.units[i4].power);
res = divideScalar2(res, pow3(multiplyScalar2(unitValue, unitPrefixValue), unitPower));
}
return res;
@@ -63271,15 +63171,15 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
Unit2.isValuelessUnit = function(name317) {
return _findUnit(name317) !== null;
};
- Unit2.prototype.hasBase = function(base3) {
- if (typeof base3 === "string") {
- base3 = BASE_UNITS[base3];
+ Unit2.prototype.hasBase = function(base2) {
+ if (typeof base2 === "string") {
+ base2 = BASE_UNITS[base2];
}
- if (!base3) {
+ if (!base2) {
return false;
}
for (var i4 = 0; i4 < BASE_DIMENSIONS.length; i4++) {
- if (Math.abs((this.dimensions[i4] || 0) - (base3.dimensions[i4] || 0)) > 1e-12) {
+ if (Math.abs((this.dimensions[i4] || 0) - (base2.dimensions[i4] || 0)) > 1e-12) {
return false;
}
}
@@ -63345,16 +63245,16 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
}
return getNumericIfUnitless(res);
};
- Unit2.prototype.pow = function(p2) {
+ Unit2.prototype.pow = function(p) {
var res = this.clone();
for (var i4 = 0; i4 < BASE_DIMENSIONS.length; i4++) {
- res.dimensions[i4] = (this.dimensions[i4] || 0) * p2;
+ res.dimensions[i4] = (this.dimensions[i4] || 0) * p;
}
for (var _i3 = 0; _i3 < res.units.length; _i3++) {
- res.units[_i3].power *= p2;
+ res.units[_i3].power *= p;
}
if (res.value !== null) {
- res.value = pow3(res.value, p2);
+ res.value = pow3(res.value, p);
} else {
res.value = null;
}
@@ -63374,9 +63274,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) {
ret.value = abs3(ret.value);
} else {
- var convert2 = ret._numberConverter();
- var unitValue = convert2(ret.units[0].unit.value);
- var nominalOffset = convert2(ret.units[0].unit.offset);
+ var convert = ret._numberConverter();
+ var unitValue = convert(ret.units[0].unit.value);
+ var nominalOffset = convert(ret.units[0].unit.offset);
var unitOffset = multiplyScalar2(unitValue, nominalOffset);
ret.value = subtractScalar2(abs3(addScalar2(ret.value, unitOffset)), unitOffset);
}
@@ -63407,14 +63307,14 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
if (this.value === null || this._isDerived() || this.units.length === 0 || other.units.length === 0 || this.units[0].unit.offset === other.units[0].unit.offset) {
other.value = clone(value);
} else {
- var convert2 = Unit2._getNumberConverter(typeOf(value));
+ var convert = Unit2._getNumberConverter(typeOf(value));
var thisUnitValue = this.units[0].unit.value;
var thisNominalOffset = this.units[0].unit.offset;
var thisUnitOffset = multiplyScalar2(thisUnitValue, thisNominalOffset);
var otherUnitValue = other.units[0].unit.value;
var otherNominalOffset = other.units[0].unit.offset;
var otherUnitOffset = multiplyScalar2(otherUnitValue, otherNominalOffset);
- other.value = addScalar2(value, convert2(subtractScalar2(thisUnitOffset, otherUnitOffset)));
+ other.value = addScalar2(value, convert(subtractScalar2(thisUnitOffset, otherUnitOffset)));
}
other.fixPrefix = true;
other.skipAutomaticSimplification = true;
@@ -63457,10 +63357,10 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
var ret = this.clone();
var proposedUnitList = [];
var matchingBase;
- for (var key4 in currentUnitSystem) {
- if (hasOwnProperty2(currentUnitSystem, key4)) {
- if (ret.hasBase(BASE_UNITS[key4])) {
- matchingBase = key4;
+ for (var key3 in currentUnitSystem) {
+ if (hasOwnProperty2(currentUnitSystem, key3)) {
+ if (ret.hasBase(BASE_UNITS[key3])) {
+ matchingBase = key3;
break;
}
}
@@ -63628,9 +63528,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
return bestPrefix;
bestDiff = Math.abs(bestDiff);
var prefixes = this.units[0].unit.prefixes;
- for (var p2 in prefixes) {
- if (hasOwnProperty2(prefixes, p2)) {
- var prefix = prefixes[p2];
+ for (var p in prefixes) {
+ if (hasOwnProperty2(prefixes, p)) {
+ var prefix = prefixes[p];
if (prefix.scientific) {
var diff2 = Math.abs(Math.log(absValue / Math.pow(prefix.value * absUnitValue, power)) / Math.LN10 - 1.2);
if (diff2 < bestDiff || diff2 === bestDiff && prefix.name.length < bestPrefix.name.length) {
@@ -64470,9 +64370,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 1]
}
};
- for (var key3 in BASE_UNITS) {
- if (hasOwnProperty2(BASE_UNITS, key3)) {
- BASE_UNITS[key3].key = key3;
+ for (var key2 in BASE_UNITS) {
+ if (hasOwnProperty2(BASE_UNITS, key2)) {
+ BASE_UNITS[key2].key = key2;
}
}
var BASE_UNIT_NONE = {};
@@ -65919,16 +65819,16 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
Complex: function Complex4(x2) {
return x2;
},
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 !== null && x2 !== void 0 && x2.isFraction)
return _number(x2);
return x2;
}
};
Unit2.prototype._numberConverter = function() {
- var convert2 = Unit2.typeConverters[this.valueType()];
- if (convert2) {
- return convert2;
+ var convert = Unit2.typeConverters[this.valueType()];
+ if (convert) {
+ return convert;
}
throw new TypeError('Unsupported Unit value type "' + this.valueType() + '"');
};
@@ -66009,17 +65909,17 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
var defUnit = null;
var aliases = [];
var offset2 = 0;
- var definition3;
+ var definition;
var prefixes;
var baseName;
if (obj && obj.type === "Unit") {
defUnit = obj.clone();
} else if (typeof obj === "string") {
if (obj !== "") {
- definition3 = obj;
+ definition = obj;
}
} else if (typeof obj === "object") {
- definition3 = obj.definition;
+ definition = obj.definition;
prefixes = obj.prefixes;
offset2 = obj.offset;
baseName = obj.baseName;
@@ -66036,17 +65936,17 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) =
}
}
}
- if (definition3 && typeof definition3 === "string" && !defUnit) {
+ if (definition && typeof definition === "string" && !defUnit) {
try {
- defUnit = Unit2.parse(definition3, {
+ defUnit = Unit2.parse(definition, {
allowNoUnits: true
});
} catch (ex) {
- ex.message = 'Could not create unit "' + name317 + '" from "' + definition3 + '": ' + ex.message;
+ ex.message = 'Could not create unit "' + name317 + '" from "' + definition + '": ' + ex.message;
throw ex;
}
- } else if (definition3 && definition3.type === "Unit") {
- defUnit = definition3.clone();
+ } else if (definition && definition.type === "Unit") {
+ defUnit = definition.clone();
}
aliases = aliases || [];
offset2 = offset2 || 0;
@@ -66168,7 +66068,7 @@ var createUnitFunction = /* @__PURE__ */ factory(name163, dependencies162, (_ref
Unit: function Unit3(x2) {
return x2.clone();
},
- string: function string6(x2) {
+ string: function string4(x2) {
if (Unit2.isValuelessUnit(x2)) {
return new Unit2(null, x2);
}
@@ -66198,14 +66098,14 @@ var createSparse = /* @__PURE__ */ factory(name164, dependencies163, (_ref) => {
"": function _15() {
return new SparseMatrix2([]);
},
- string: function string6(datatype) {
+ string: function string4(datatype) {
return new SparseMatrix2([], datatype);
},
- "Array | Matrix": function ArrayMatrix(data3) {
- return new SparseMatrix2(data3);
+ "Array | Matrix": function ArrayMatrix(data2) {
+ return new SparseMatrix2(data2);
},
- "Array | Matrix, string": function ArrayMatrixString(data3, datatype) {
- return new SparseMatrix2(data3, datatype);
+ "Array | Matrix, string": function ArrayMatrixString(data2, datatype) {
+ return new SparseMatrix2(data2, datatype);
}
});
});
@@ -66235,7 +66135,7 @@ var createCreateUnit = /* @__PURE__ */ factory(name165, dependencies164, (_ref)
obj[name317] = def;
return Unit2.createUnit(obj, {});
},
- string: function string6(name317) {
+ string: function string4(name317) {
var obj = {};
obj[name317] = {};
return Unit2.createUnit(obj, {});
@@ -66253,7 +66153,7 @@ var createAcos = /* @__PURE__ */ factory(name166, dependencies165, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name166, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= -1 && x2 <= 1 || config4.predictable) {
return Math.acos(x2);
} else {
@@ -66279,7 +66179,7 @@ var createAcosh = /* @__PURE__ */ factory(name167, dependencies166, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name167, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= 1 || config4.predictable) {
return acoshNumber(x2);
}
@@ -66327,7 +66227,7 @@ var createAcoth = /* @__PURE__ */ factory(name169, dependencies168, (_ref) => {
BigNumber: _BigNumber
} = _ref;
return typed3(name169, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= 1 || x2 <= -1 || config4.predictable) {
return acothNumber(x2);
}
@@ -66353,7 +66253,7 @@ var createAcsc = /* @__PURE__ */ factory(name170, dependencies169, (_ref) => {
BigNumber: _BigNumber
} = _ref;
return typed3(name170, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 <= -1 || x2 >= 1 || config4.predictable) {
return acscNumber(x2);
}
@@ -66398,7 +66298,7 @@ var createAsec = /* @__PURE__ */ factory(name172, dependencies171, (_ref) => {
BigNumber: _BigNumber
} = _ref;
return typed3(name172, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 <= -1 || x2 >= 1 || config4.predictable) {
return asecNumber(x2);
}
@@ -66424,7 +66324,7 @@ var createAsech = /* @__PURE__ */ factory(name173, dependencies172, (_ref) => {
BigNumber: _BigNumber
} = _ref;
return typed3(name173, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 <= 1 && x2 >= -1 || config4.predictable) {
var xInv = 1 / x2;
if (xInv > 0 || config4.predictable) {
@@ -66454,7 +66354,7 @@ var createAsin = /* @__PURE__ */ factory(name174, dependencies173, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name174, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 >= -1 && x2 <= 1 || config4.predictable) {
return Math.asin(x2);
} else {
@@ -66496,7 +66396,7 @@ var createAtan = /* @__PURE__ */ factory(name176, dependencies175, (_ref) => {
typed: typed3
} = _ref;
return typed3("atan", {
- number: function number5(x2) {
+ number: function number4(x2) {
return Math.atan(x2);
},
Complex: function Complex3(x2) {
@@ -66567,7 +66467,7 @@ var createAtanh = /* @__PURE__ */ factory(name178, dependencies177, (_ref) => {
Complex: Complex3
} = _ref;
return typed3(name178, {
- number: function number5(x2) {
+ number: function number4(x2) {
if (x2 <= 1 && x2 >= -1 || config4.predictable) {
return atanhNumber(x2);
}
@@ -67018,10 +66918,10 @@ var createSetPowerset = /* @__PURE__ */ factory(name197, dependencies196, (_ref)
}
var b2 = flatten(Array.isArray(a4) ? a4 : a4.toArray()).sort(compareNatural2);
var result = [];
- var number5 = 0;
- while (number5.toString(2).length <= b2.length) {
- result.push(_subset(b2, number5.toString(2).split("").reverse()));
- number5++;
+ var number4 = 0;
+ while (number4.toString(2).length <= b2.length) {
+ result.push(_subset(b2, number4.toString(2).split("").reverse()));
+ number4++;
}
return _sort(result);
}
@@ -67244,7 +67144,7 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
BigNumber: function BigNumber2(x2) {
return x2.abs();
},
- boolean: function boolean3(x2) {
+ boolean: function boolean2(x2) {
return Math.abs(x2);
},
Array: function Array2(x2) {
@@ -67253,11 +67153,11 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
Matrix: function Matrix2(x2) {
return _norm(x2, 2);
},
- "Array, number | BigNumber | string": function ArrayNumberBigNumberString(x2, p2) {
- return _norm(matrix2(x2), p2);
+ "Array, number | BigNumber | string": function ArrayNumberBigNumberString(x2, p) {
+ return _norm(matrix2(x2), p);
},
- "Matrix, number | BigNumber | string": function MatrixNumberBigNumberString(x2, p2) {
- return _norm(x2, p2);
+ "Matrix, number | BigNumber | string": function MatrixNumberBigNumberString(x2, p) {
+ return _norm(x2, p);
}
});
function _vectorNormPlusInfinity(x2) {
@@ -67280,23 +67180,23 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
}, true);
return ninf || 0;
}
- function _vectorNorm(x2, p2) {
- if (p2 === Number.POSITIVE_INFINITY || p2 === "inf") {
+ function _vectorNorm(x2, p) {
+ if (p === Number.POSITIVE_INFINITY || p === "inf") {
return _vectorNormPlusInfinity(x2);
}
- if (p2 === Number.NEGATIVE_INFINITY || p2 === "-inf") {
+ if (p === Number.NEGATIVE_INFINITY || p === "-inf") {
return _vectorNormMinusInfinity(x2);
}
- if (p2 === "fro") {
+ if (p === "fro") {
return _norm(x2, 2);
}
- if (typeof p2 === "number" && !isNaN(p2)) {
- if (!equalScalar2(p2, 0)) {
+ if (typeof p === "number" && !isNaN(p)) {
+ if (!equalScalar2(p, 0)) {
var n3 = 0;
x2.forEach(function(value) {
- n3 = add4(pow3(abs3(value), p2), n3);
+ n3 = add4(pow3(abs3(value), p), n3);
}, true);
- return pow3(n3, 1 / p2);
+ return pow3(n3, 1 / p);
}
return Number.POSITIVE_INFINITY;
}
@@ -67304,7 +67204,7 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
}
function _matrixNormFrobenius(x2) {
var fro = 0;
- x2.forEach(function(value, index3) {
+ x2.forEach(function(value, index2) {
fro = add4(fro, multiply2(value, conj2(value)));
});
return abs3(sqrt3(fro));
@@ -67312,8 +67212,8 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
function _matrixNormOne(x2) {
var c3 = [];
var maxc = 0;
- x2.forEach(function(value, index3) {
- var j = index3[1];
+ x2.forEach(function(value, index2) {
+ var j = index2[1];
var cj = add4(c3[j] || 0, abs3(value));
if (larger2(cj, maxc)) {
maxc = cj;
@@ -67336,8 +67236,8 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
function _matrixNormInfinity(x2) {
var r2 = [];
var maxr = 0;
- x2.forEach(function(value, index3) {
- var i4 = index3[0];
+ x2.forEach(function(value, index2) {
+ var i4 = index2[0];
var ri = add4(r2[i4] || 0, abs3(value));
if (larger2(ri, maxr)) {
maxr = ri;
@@ -67346,29 +67246,29 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => {
}, true);
return maxr;
}
- function _matrixNorm(x2, p2) {
- if (p2 === 1) {
+ function _matrixNorm(x2, p) {
+ if (p === 1) {
return _matrixNormOne(x2);
}
- if (p2 === Number.POSITIVE_INFINITY || p2 === "inf") {
+ if (p === Number.POSITIVE_INFINITY || p === "inf") {
return _matrixNormInfinity(x2);
}
- if (p2 === "fro") {
+ if (p === "fro") {
return _matrixNormFrobenius(x2);
}
- if (p2 === 2) {
+ if (p === 2) {
return _matrixNormTwo(x2);
}
- throw new Error("Unsupported parameter value " + p2);
+ throw new Error("Unsupported parameter value " + p);
}
- function _norm(x2, p2) {
+ function _norm(x2, p) {
var sizeX = x2.size();
if (sizeX.length === 1) {
- return _vectorNorm(x2, p2);
+ return _vectorNorm(x2, p);
}
if (sizeX.length === 2) {
if (sizeX[0] && sizeX[1]) {
- return _matrixNorm(x2, p2);
+ return _matrixNorm(x2, p);
} else {
throw new RangeError("Invalid matrix dimensions");
}
@@ -67426,9 +67326,9 @@ var createDot = /* @__PURE__ */ factory(name204, dependencies203, (_ref) => {
var add4 = addScalar2;
var mul2 = multiplyScalar2;
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
- var dt2 = adt;
- add4 = typed3.find(addScalar2, [dt2, dt2]);
- mul2 = typed3.find(multiplyScalar2, [dt2, dt2]);
+ var dt = adt;
+ add4 = typed3.find(addScalar2, [dt, dt]);
+ mul2 = typed3.find(multiplyScalar2, [dt, dt]);
}
if (!aIsColumn && !bIsColumn) {
var c3 = mul2(conj2(adata[0]), bdata[0]);
@@ -67513,11 +67413,11 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => {
});
function _denseTrace(m4) {
var size2 = m4._size;
- var data3 = m4._data;
+ var data2 = m4._data;
switch (size2.length) {
case 1:
if (size2[0] === 1) {
- return clone(data3[0]);
+ return clone(data2[0]);
}
throw new RangeError("Matrix must be square (size: " + format4(size2) + ")");
case 2: {
@@ -67526,7 +67426,7 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => {
if (rows === cols) {
var sum4 = 0;
for (var i4 = 0; i4 < rows; i4++) {
- sum4 = add4(sum4, data3[i4][i4]);
+ sum4 = add4(sum4, data2[i4][i4]);
}
return sum4;
} else {
@@ -67539,7 +67439,7 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => {
}
function _sparseTrace(m4) {
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
var size2 = m4._size;
var rows = size2[0];
@@ -67551,7 +67451,7 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => {
var k0 = ptr[j];
var k1 = ptr[j + 1];
for (var k2 = k0; k2 < k1; k2++) {
- var i4 = index3[k2];
+ var i4 = index2[k2];
if (i4 === j) {
sum4 = add4(sum4, values2[k2]);
break;
@@ -67645,25 +67545,25 @@ var createNode = /* @__PURE__ */ factory(name207, dependencies206, (_ref) => {
map(callback) {
throw new Error("Cannot run map on a Node interface");
}
- _ifNode(node2) {
- if (!isNode2(node2)) {
+ _ifNode(node) {
+ if (!isNode2(node)) {
throw new TypeError("Callback function must return a Node");
}
- return node2;
+ return node;
}
traverse(callback) {
callback(this, null, null);
- function _traverse(node2, callback2) {
- node2.forEach(function(child, path3, parent) {
- callback2(child, path3, parent);
+ function _traverse(node, callback2) {
+ node.forEach(function(child, path2, parent) {
+ callback2(child, path2, parent);
_traverse(child, callback2);
});
}
_traverse(this, callback);
}
transform(callback) {
- function _transform(child, path3, parent) {
- var replacement = callback(child, path3, parent);
+ function _transform(child, path2, parent) {
+ var replacement = callback(child, path2, parent);
if (replacement !== child) {
return replacement;
}
@@ -67673,9 +67573,9 @@ var createNode = /* @__PURE__ */ factory(name207, dependencies206, (_ref) => {
}
filter(callback) {
var nodes = [];
- this.traverse(function(node2, path3, parent) {
- if (callback(node2, path3, parent)) {
- nodes.push(node2);
+ this.traverse(function(node, path2, parent) {
+ if (callback(node, path2, parent)) {
+ nodes.push(node);
}
});
return nodes;
@@ -67684,8 +67584,8 @@ var createNode = /* @__PURE__ */ factory(name207, dependencies206, (_ref) => {
throw new Error("Cannot clone a Node interface");
}
cloneDeep() {
- return this.map(function(node2) {
- return node2.cloneDeep();
+ return this.map(function(node) {
+ return node.cloneDeep();
});
}
equals(other) {
@@ -67763,19 +67663,19 @@ function accessFactory(_ref) {
var {
subset: subset2
} = _ref;
- return function access(object, index3) {
+ return function access(object, index2) {
try {
if (Array.isArray(object)) {
- return subset2(object, index3);
+ return subset2(object, index2);
} else if (object && typeof object.subset === "function") {
- return object.subset(index3);
+ return object.subset(index2);
} else if (typeof object === "string") {
- return subset2(object, index3);
+ return subset2(object, index2);
} else if (typeof object === "object") {
- if (!index3.isObjectProperty()) {
+ if (!index2.isObjectProperty()) {
throw new TypeError("Cannot apply a numeric index as object property");
}
- return getSafeProperty(object, index3.getObjectProperty());
+ return getSafeProperty(object, index2.getObjectProperty());
} else {
throw new TypeError("Cannot apply index: unsupported type of object");
}
@@ -67796,20 +67696,20 @@ var createAccessorNode = /* @__PURE__ */ factory(name208, dependencies207, (_ref
var access = accessFactory({
subset: subset2
});
- function needParenthesis(node2) {
- return !(isAccessorNode(node2) || isArrayNode(node2) || isConstantNode(node2) || isFunctionNode(node2) || isObjectNode(node2) || isParenthesisNode(node2) || isSymbolNode(node2));
+ function needParenthesis(node) {
+ return !(isAccessorNode(node) || isArrayNode(node) || isConstantNode(node) || isFunctionNode(node) || isObjectNode(node) || isParenthesisNode(node) || isSymbolNode(node));
}
class AccessorNode2 extends Node4 {
- constructor(object, index3) {
+ constructor(object, index2) {
super();
if (!isNode2(object)) {
throw new TypeError('Node expected for parameter "object"');
}
- if (!isIndexNode(index3)) {
+ if (!isIndexNode(index2)) {
throw new TypeError('IndexNode expected for parameter "index"');
}
this.object = object;
- this.index = index3;
+ this.index = index2;
}
get name() {
if (this.index) {
@@ -67835,8 +67735,8 @@ var createAccessorNode = /* @__PURE__ */ factory(name208, dependencies207, (_ref
} else {
return function evalAccessorNode(scope, args, context) {
var object = evalObject(scope, args, context);
- var index3 = evalIndex(scope, args, object);
- return access(object, index3);
+ var index2 = evalIndex(scope, args, object);
+ return access(object, index2);
};
}
}
@@ -67932,8 +67832,8 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) =
}
forEach(callback) {
for (var i4 = 0; i4 < this.items.length; i4++) {
- var node2 = this.items[i4];
- callback(node2, "items[" + i4 + "]", this);
+ var node = this.items[i4];
+ callback(node, "items[" + i4 + "]", this);
}
}
map(callback) {
@@ -67947,8 +67847,8 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) =
return new ArrayNode2(this.items.slice(0));
}
_toString(options) {
- var items = this.items.map(function(node2) {
- return node2.toString(options);
+ var items = this.items.map(function(node) {
+ return node.toString(options);
});
return "[" + items.join(", ") + "]";
}
@@ -67962,8 +67862,8 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) =
return new ArrayNode2(json.items);
}
_toHTML(options) {
- var items = this.items.map(function(node2) {
- return node2.toHTML(options);
+ var items = this.items.map(function(node) {
+ return node.toHTML(options);
});
return '[' + items.join(',') + ']';
}
@@ -67972,11 +67872,11 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) =
var mixedItems = items.some(isArrayNode) && !items.every(isArrayNode);
var itemsFormRow = nested || mixedItems;
var itemSep = itemsFormRow ? "&" : "\\\\";
- var itemsTex = items.map(function(node2) {
- if (node2.items) {
- return itemsToTex(node2.items, !nested);
+ var itemsTex = items.map(function(node) {
+ if (node.items) {
+ return itemsToTex(node.items, !nested);
} else {
- return node2.toTex(options);
+ return node.toTex(options);
}
}).join(itemSep);
return mixedItems || !itemsFormRow || itemsFormRow && !nested ? "\\begin{bmatrix}" + itemsTex + "\\end{bmatrix}" : itemsTex;
@@ -67997,23 +67897,23 @@ function assignFactory(_ref) {
subset: subset2,
matrix: matrix2
} = _ref;
- return function assign(object, index3, value) {
+ return function assign(object, index2, value) {
try {
if (Array.isArray(object)) {
- var result = matrix2(object).subset(index3, value).valueOf();
- result.forEach((item, index4) => {
- object[index4] = item;
+ var result = matrix2(object).subset(index2, value).valueOf();
+ result.forEach((item, index3) => {
+ object[index3] = item;
});
return object;
} else if (object && typeof object.subset === "function") {
- return object.subset(index3, value);
+ return object.subset(index2, value);
} else if (typeof object === "string") {
- return subset2(object, index3, value);
+ return subset2(object, index2, value);
} else if (typeof object === "object") {
- if (!index3.isObjectProperty()) {
+ if (!index2.isObjectProperty()) {
throw TypeError("Cannot apply a numeric index as object property");
}
- setSafeProperty(object, index3.getObjectProperty(), value);
+ setSafeProperty(object, index2.getObjectProperty(), value);
return object;
} else {
throw new TypeError("Cannot apply index: unsupported type of object");
@@ -68217,17 +68117,17 @@ var properties2 = [{
function unwrapParen(_node, parenthesis) {
if (!parenthesis || parenthesis !== "auto")
return _node;
- var node2 = _node;
- while (isParenthesisNode(node2))
- node2 = node2.content;
- return node2;
+ var node = _node;
+ while (isParenthesisNode(node))
+ node = node.content;
+ return node;
}
function getPrecedence(_node, parenthesis, implicit, parent) {
- var node2 = _node;
+ var node = _node;
if (parenthesis !== "keep") {
- node2 = _node.getContent();
+ node = _node.getContent();
}
- var identifier = node2.getIdentifier();
+ var identifier = node.getIdentifier();
var precedence = null;
for (var i4 = 0; i4 < properties2.length; i4++) {
if (identifier in properties2[i4]) {
@@ -68235,8 +68135,8 @@ function getPrecedence(_node, parenthesis, implicit, parent) {
break;
}
}
- if (identifier === "OperatorNode:multiply" && node2.implicit && implicit !== "show") {
- var leftArg = unwrapParen(node2.args[0], parenthesis);
+ if (identifier === "OperatorNode:multiply" && node.implicit && implicit !== "show") {
+ var leftArg = unwrapParen(node.args[0], parenthesis);
if (!(isConstantNode(leftArg) && parent && parent.getIdentifier() === "OperatorNode:divide" && rule2Node(unwrapParen(parent.args[0], parenthesis))) && !(leftArg.getIdentifier() === "OperatorNode:divide" && rule2Node(unwrapParen(leftArg.args[0], parenthesis)) && isConstantNode(unwrapParen(leftArg.args[1])))) {
precedence += 1;
}
@@ -68244,16 +68144,16 @@ function getPrecedence(_node, parenthesis, implicit, parent) {
return precedence;
}
function getAssociativity(_node, parenthesis) {
- var node2 = _node;
+ var node = _node;
if (parenthesis !== "keep") {
- node2 = _node.getContent();
+ node = _node.getContent();
}
- var identifier = node2.getIdentifier();
- var index3 = getPrecedence(node2, parenthesis);
- if (index3 === null) {
+ var identifier = node.getIdentifier();
+ var index2 = getPrecedence(node, parenthesis);
+ if (index2 === null) {
return null;
}
- var property = properties2[index3][identifier];
+ var property = properties2[index2][identifier];
if (hasOwnProperty2(property, "associativity")) {
if (property.associativity === "left") {
return "left";
@@ -68270,11 +68170,11 @@ function isAssociativeWith(nodeA, nodeB, parenthesis) {
var b2 = parenthesis !== "keep" ? nodeA.getContent() : nodeB;
var identifierA = a4.getIdentifier();
var identifierB = b2.getIdentifier();
- var index3 = getPrecedence(a4, parenthesis);
- if (index3 === null) {
+ var index2 = getPrecedence(a4, parenthesis);
+ if (index2 === null) {
return null;
}
- var property = properties2[index3][identifierA];
+ var property = properties2[index2][identifierA];
if (hasOwnProperty2(property, "associativeWith") && property.associativeWith instanceof Array) {
for (var i4 = 0; i4 < property.associativeWith.length; i4++) {
if (property.associativeWith[i4] === identifierB) {
@@ -68315,20 +68215,20 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r
subset: subset2,
matrix: matrix2
});
- function needParenthesis(node2, parenthesis, implicit) {
+ function needParenthesis(node, parenthesis, implicit) {
if (!parenthesis) {
parenthesis = "keep";
}
- var precedence = getPrecedence(node2, parenthesis, implicit);
- var exprPrecedence = getPrecedence(node2.value, parenthesis, implicit);
+ var precedence = getPrecedence(node, parenthesis, implicit);
+ var exprPrecedence = getPrecedence(node.value, parenthesis, implicit);
return parenthesis === "all" || exprPrecedence !== null && exprPrecedence <= precedence;
}
class AssignmentNode2 extends Node4 {
- constructor(object, index3, value) {
+ constructor(object, index2, value) {
super();
this.object = object;
- this.index = value ? index3 : null;
- this.value = value || index3;
+ this.index = value ? index2 : null;
+ this.value = value || index2;
if (!isSymbolNode(object) && !isAccessorNode(object)) {
throw new TypeError('SymbolNode or AccessorNode expected as "object"');
}
@@ -68381,8 +68281,8 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r
return function evalAssignmentNode(scope, args, context) {
var childObject = evalObject(scope, args, context);
var value = evalValue(scope, args, context);
- var index3 = evalIndex(scope, args, childObject);
- scope.set(name317, assign(childObject, index3, value));
+ var index2 = evalIndex(scope, args, childObject);
+ scope.set(name317, assign(childObject, index2, value));
return value;
};
} else {
@@ -68392,9 +68292,9 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r
return function evalAssignmentNode(scope, args, context) {
var parent = evalParentObject(scope, args, context);
var childObject = getSafeProperty(parent, parentProp);
- var index3 = evalIndex(scope, args, childObject);
+ var index2 = evalIndex(scope, args, childObject);
var value = evalValue(scope, args, context);
- setSafeProperty(parent, parentProp, assign(childObject, index3, value));
+ setSafeProperty(parent, parentProp, assign(childObject, index2, value));
return value;
};
} else {
@@ -68403,9 +68303,9 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r
var parent = evalParentObject(scope, args, context);
var parentIndex = evalParentIndex(scope, args, parent);
var childObject = access(parent, parentIndex);
- var index3 = evalIndex(scope, args, childObject);
+ var index2 = evalIndex(scope, args, childObject);
var value = evalValue(scope, args, context);
- assign(parent, parentIndex, assign(childObject, index3, value));
+ assign(parent, parentIndex, assign(childObject, index2, value));
return value;
};
}
@@ -68420,21 +68320,21 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r
}
map(callback) {
var object = this._ifNode(callback(this.object, "object", this));
- var index3 = this.index ? this._ifNode(callback(this.index, "index", this)) : null;
+ var index2 = this.index ? this._ifNode(callback(this.index, "index", this)) : null;
var value = this._ifNode(callback(this.value, "value", this));
- return new AssignmentNode2(object, index3, value);
+ return new AssignmentNode2(object, index2, value);
}
clone() {
return new AssignmentNode2(this.object, this.index, this.value);
}
_toString(options) {
var object = this.object.toString(options);
- var index3 = this.index ? this.index.toString(options) : "";
+ var index2 = 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 + index3 + " = " + value;
+ return object + index2 + " = " + value;
}
toJSON() {
return {
@@ -68449,21 +68349,21 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r
}
_toHTML(options) {
var object = this.object.toHTML(options);
- var index3 = this.index ? this.index.toHTML(options) : "";
+ var index2 = 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 + index3 + '=' + value;
+ return object + index2 + '=' + value;
}
_toTex(options) {
var object = this.object.toTex(options);
- var index3 = this.index ? this.index.toTex(options) : "";
+ var index2 = 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 + index3 + "=" + value;
+ return object + index2 + "=" + value;
}
}
_defineProperty(AssignmentNode2, "name", name210);
@@ -68487,15 +68387,15 @@ var createBlockNode = /* @__PURE__ */ factory(name211, dependencies210, (_ref) =
if (!Array.isArray(blocks))
throw new Error("Array expected");
this.blocks = blocks.map(function(block) {
- var node2 = block && block.node;
+ var node = block && block.node;
var visible = block && block.visible !== void 0 ? block.visible : true;
- if (!isNode2(node2))
+ if (!isNode2(node))
throw new TypeError('Property "node" must be a Node');
if (typeof visible !== "boolean") {
throw new TypeError('Property "visible" must be a boolean');
}
return {
- node: node2,
+ node,
visible
};
});
@@ -68533,9 +68433,9 @@ var createBlockNode = /* @__PURE__ */ factory(name211, dependencies210, (_ref) =
var blocks = [];
for (var i4 = 0; i4 < this.blocks.length; i4++) {
var block = this.blocks[i4];
- var node2 = this._ifNode(callback(block.node, "blocks[" + i4 + "].node", this));
+ var node = this._ifNode(callback(block.node, "blocks[" + i4 + "].node", this));
blocks[i4] = {
- node: node2,
+ node,
visible: block.visible
};
}
@@ -69109,8 +69009,8 @@ var latexFunctions = {
to: {
2: "\\left(${args[0]}".concat(latexOperators.to, "${args[1]}\\right)")
},
- numeric: function numeric(node2, options) {
- return node2.args[0].toTex();
+ numeric: function numeric(node, options) {
+ return node.args[0].toTex();
},
number: {
0: "0",
@@ -69148,8 +69048,8 @@ var defaultTemplate = "\\mathrm{${name}}\\left(${args}\\right)";
var latexUnits = {
deg: "^\\circ"
};
-function escapeLatex(string6) {
- return (0, import_escape_latex.default)(string6, {
+function escapeLatex(string4) {
+ return (0, import_escape_latex.default)(string4, {
preserveFormatting: true
});
}
@@ -69242,9 +69142,9 @@ var createConstantNode = /* @__PURE__ */ factory(name213, dependencies212, (_ref
if (!finite) {
return this.value.valueOf() < 0 ? "-\\infty" : "\\infty";
}
- var index3 = value.toLowerCase().indexOf("e");
- if (index3 !== -1) {
- return value.substring(0, index3) + "\\cdot10^{" + value.substring(index3 + 1) + "}";
+ var index2 = value.toLowerCase().indexOf("e");
+ if (index2 !== -1) {
+ return value.substring(0, index2) + "\\cdot10^{" + value.substring(index2 + 1) + "}";
}
return value;
}
@@ -69270,9 +69170,9 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(name214, dependencies
typed: typed3,
Node: Node4
} = _ref;
- function needParenthesis(node2, parenthesis, implicit) {
- var precedence = getPrecedence(node2, parenthesis, implicit);
- var exprPrecedence = getPrecedence(node2.expr, parenthesis, implicit);
+ function needParenthesis(node, parenthesis, implicit) {
+ var precedence = getPrecedence(node, parenthesis, implicit);
+ var exprPrecedence = getPrecedence(node.expr, parenthesis, implicit);
return parenthesis === "all" || exprPrecedence !== null && exprPrecedence <= precedence;
}
class FunctionAssignmentNode2 extends Node4 {
@@ -69362,10 +69262,10 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(name214, dependencies
return {
mathjs: name214,
name: this.name,
- params: this.params.map(function(param, index3) {
+ params: this.params.map(function(param, index2) {
return {
name: param,
- type: types2[index3]
+ type: types2[index2]
};
}),
expr: this.expr
@@ -69430,7 +69330,7 @@ var createIndexNode = /* @__PURE__ */ factory(name215, dependencies214, (_ref) =
}
_compile(math2, argNames) {
var evalDimensions = map(this.dimensions, function(dimension, i4) {
- var needsEnd = dimension.filter((node2) => node2.isSymbolNode && node2.name === "end").length > 0;
+ var needsEnd = dimension.filter((node) => node.isSymbolNode && node.name === "end").length > 0;
if (needsEnd) {
var childArgNames = Object.create(argNames);
childArgNames.end = true;
@@ -69448,12 +69348,12 @@ var createIndexNode = /* @__PURE__ */ factory(name215, dependencies214, (_ref) =
return dimension._compile(math2, argNames);
}
});
- var index3 = getSafeProperty(math2, "index");
+ var index2 = getSafeProperty(math2, "index");
return function evalIndexNode(scope, args, context) {
var dimensions = map(evalDimensions, function(evalDimension) {
return evalDimension(scope, args, context);
});
- return index3(...dimensions);
+ return index2(...dimensions);
};
}
forEach(callback) {
@@ -69527,8 +69427,8 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref)
super();
this.properties = properties3 || {};
if (properties3) {
- if (!(typeof properties3 === "object") || !Object.keys(properties3).every(function(key3) {
- return isNode2(properties3[key3]);
+ if (!(typeof properties3 === "object") || !Object.keys(properties3).every(function(key2) {
+ return isNode2(properties3[key2]);
})) {
throw new TypeError("Object containing Nodes expected");
}
@@ -69542,11 +69442,11 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref)
}
_compile(math2, argNames) {
var evalEntries = {};
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- var stringifiedKey = stringify2(key3);
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ var stringifiedKey = stringify2(key2);
var parsedKey = JSON.parse(stringifiedKey);
- var prop2 = getSafeProperty(this.properties, key3);
+ var prop2 = getSafeProperty(this.properties, key2);
evalEntries[parsedKey] = prop2._compile(math2, argNames);
}
}
@@ -69561,35 +69461,35 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref)
};
}
forEach(callback) {
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- callback(this.properties[key3], "properties[" + stringify2(key3) + "]", this);
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ callback(this.properties[key2], "properties[" + stringify2(key2) + "]", this);
}
}
}
map(callback) {
var properties3 = {};
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- properties3[key3] = this._ifNode(callback(this.properties[key3], "properties[" + stringify2(key3) + "]", this));
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ properties3[key2] = this._ifNode(callback(this.properties[key2], "properties[" + stringify2(key2) + "]", this));
}
}
return new ObjectNode2(properties3);
}
clone() {
var properties3 = {};
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- properties3[key3] = this.properties[key3];
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ properties3[key2] = this.properties[key2];
}
}
return new ObjectNode2(properties3);
}
_toString(options) {
var entries = [];
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- entries.push(stringify2(key3) + ": " + this.properties[key3].toString(options));
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ entries.push(stringify2(key2) + ": " + this.properties[key2].toString(options));
}
}
return "{" + entries.join(", ") + "}";
@@ -69605,18 +69505,18 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref)
}
_toHTML(options) {
var entries = [];
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- entries.push('' + escape(key3) + ':' + this.properties[key3].toHTML(options));
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ entries.push('' + escape(key2) + ':' + this.properties[key2].toHTML(options));
}
}
return '{' + entries.join(',') + '}';
}
_toTex(options) {
var entries = [];
- for (var key3 in this.properties) {
- if (hasOwnProperty2(this.properties, key3)) {
- entries.push("\\mathbf{" + key3 + ":} & " + this.properties[key3].toTex(options) + "\\\\");
+ for (var key2 in this.properties) {
+ if (hasOwnProperty2(this.properties, key2)) {
+ entries.push("\\mathbf{" + key2 + ":} & " + this.properties[key2].toTex(options) + "\\\\");
}
}
var tex = "\\left\\{\\begin{array}{ll}" + entries.join("\n") + "\\end{array}\\right\\}";
@@ -69655,10 +69555,10 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
}
return false;
}
- function calculateNecessaryParentheses(root4, parenthesis, implicit, args, latex) {
- var precedence = getPrecedence(root4, parenthesis, implicit);
- var associativity = getAssociativity(root4, parenthesis);
- if (parenthesis === "all" || args.length > 2 && root4.getIdentifier() !== "OperatorNode:add" && root4.getIdentifier() !== "OperatorNode:multiply") {
+ function calculateNecessaryParentheses(root, parenthesis, implicit, args, latex) {
+ var precedence = getPrecedence(root, parenthesis, implicit);
+ var associativity = getAssociativity(root, parenthesis);
+ if (parenthesis === "all" || args.length > 2 && root.getIdentifier() !== "OperatorNode:add" && root.getIdentifier() !== "OperatorNode:multiply") {
return args.map(function(arg2) {
switch (arg2.getContent().type) {
case "ArrayNode":
@@ -69678,16 +69578,16 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
break;
case 1:
{
- var operandPrecedence = getPrecedence(args[0], parenthesis, implicit, root4);
+ var operandPrecedence = getPrecedence(args[0], parenthesis, implicit, root);
if (latex && operandPrecedence !== null) {
var operandIdentifier;
var rootIdentifier;
if (parenthesis === "keep") {
operandIdentifier = args[0].getIdentifier();
- rootIdentifier = root4.getIdentifier();
+ rootIdentifier = root.getIdentifier();
} else {
operandIdentifier = args[0].getContent().getIdentifier();
- rootIdentifier = root4.getContent().getIdentifier();
+ rootIdentifier = root.getContent().getIdentifier();
}
if (properties2[precedence][rootIdentifier].latexLeftParens === false) {
result = [false];
@@ -69712,8 +69612,8 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
case 2:
{
var lhsParens;
- var lhsPrecedence = getPrecedence(args[0], parenthesis, implicit, root4);
- var assocWithLhs = isAssociativeWith(root4, args[0], parenthesis);
+ var lhsPrecedence = getPrecedence(args[0], parenthesis, implicit, root);
+ var assocWithLhs = isAssociativeWith(root, args[0], parenthesis);
if (lhsPrecedence === null) {
lhsParens = false;
} else if (lhsPrecedence === precedence && associativity === "right" && !assocWithLhs) {
@@ -69724,8 +69624,8 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
lhsParens = false;
}
var rhsParens;
- var rhsPrecedence = getPrecedence(args[1], parenthesis, implicit, root4);
- var assocWithRhs = isAssociativeWith(root4, args[1], parenthesis);
+ var rhsPrecedence = getPrecedence(args[1], parenthesis, implicit, root);
+ var assocWithRhs = isAssociativeWith(root, args[1], parenthesis);
if (rhsPrecedence === null) {
rhsParens = false;
} else if (rhsPrecedence === precedence && associativity === "left" && !assocWithRhs) {
@@ -69740,13 +69640,13 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
var lhsIdentifier;
var rhsIdentifier;
if (parenthesis === "keep") {
- _rootIdentifier = root4.getIdentifier();
- lhsIdentifier = root4.args[0].getIdentifier();
- rhsIdentifier = root4.args[1].getIdentifier();
+ _rootIdentifier = root.getIdentifier();
+ lhsIdentifier = root.args[0].getIdentifier();
+ rhsIdentifier = root.args[1].getIdentifier();
} else {
- _rootIdentifier = root4.getContent().getIdentifier();
- lhsIdentifier = root4.args[0].getContent().getIdentifier();
- rhsIdentifier = root4.args[1].getContent().getIdentifier();
+ _rootIdentifier = root.getContent().getIdentifier();
+ lhsIdentifier = root.args[0].getContent().getIdentifier();
+ rhsIdentifier = root.args[1].getContent().getIdentifier();
}
if (lhsPrecedence !== null) {
if (properties2[precedence][_rootIdentifier].latexLeftParens === false) {
@@ -69769,10 +69669,10 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
}
break;
default:
- if (root4.getIdentifier() === "OperatorNode:add" || root4.getIdentifier() === "OperatorNode:multiply") {
+ if (root.getIdentifier() === "OperatorNode:add" || root.getIdentifier() === "OperatorNode:multiply") {
result = args.map(function(arg2) {
- var argPrecedence = getPrecedence(arg2, parenthesis, implicit, root4);
- var assocWithArg = isAssociativeWith(root4, arg2, parenthesis);
+ var argPrecedence = getPrecedence(arg2, parenthesis, implicit, root);
+ var assocWithArg = isAssociativeWith(root, arg2, parenthesis);
var argAssociativity = getAssociativity(arg2, parenthesis);
if (argPrecedence === null) {
return false;
@@ -69786,7 +69686,7 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
}
break;
}
- if (args.length >= 2 && root4.getIdentifier() === "OperatorNode:multiply" && root4.implicit && parenthesis !== "all" && implicit === "hide") {
+ if (args.length >= 2 && root.getIdentifier() === "OperatorNode:multiply" && root.implicit && parenthesis !== "all" && implicit === "hide") {
for (var i4 = 1; i4 < result.length; ++i4) {
if (startsWithConstant(args[i4], parenthesis) && !result[i4 - 1] && (parenthesis !== "keep" || !isParenthesisNode(args[i4 - 1]))) {
result[i4] = true;
@@ -69908,9 +69808,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, 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, index3) {
+ var stringifiedArgs = args.map(function(arg2, index2) {
arg2 = arg2.toString(options);
- if (parens[index3]) {
+ if (parens[index2]) {
arg2 = "(" + arg2 + ")";
}
return arg2;
@@ -69966,9 +69866,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref
}
return lhs + '' + escape(this.op) + "" + rhs;
} else {
- var stringifiedArgs = args.map(function(arg2, index3) {
+ var stringifiedArgs = args.map(function(arg2, index2) {
arg2 = arg2.toHTML(options);
- if (parens[index3]) {
+ if (parens[index2]) {
arg2 = '(' + arg2 + ')';
}
return arg2;
@@ -70038,9 +69938,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, 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, index3) {
+ var texifiedArgs = args.map(function(arg2, index2) {
arg2 = arg2.toTex(options);
- if (parens[index3]) {
+ if (parens[index2]) {
arg2 = "\\left(".concat(arg2, "\\right)");
}
return arg2;
@@ -70074,12 +69974,12 @@ var createParenthesisNode = /* @__PURE__ */ factory(name218, dependencies217, (_
Node: Node4
} = _ref;
class ParenthesisNode2 extends Node4 {
- constructor(content5) {
+ constructor(content3) {
super();
- if (!isNode2(content5)) {
+ if (!isNode2(content3)) {
throw new TypeError('Node expected for parameter "content"');
}
- this.content = content5;
+ this.content = content3;
}
get type() {
return name218;
@@ -70097,8 +69997,8 @@ var createParenthesisNode = /* @__PURE__ */ factory(name218, dependencies217, (_
callback(this.content, "content", this);
}
map(callback) {
- var content5 = callback(this.content, "content", this);
- return new ParenthesisNode2(content5);
+ var content3 = callback(this.content, "content", this);
+ return new ParenthesisNode2(content3);
}
clone() {
return new ParenthesisNode2(this.content);
@@ -70145,16 +70045,16 @@ var createRangeNode = /* @__PURE__ */ factory(name219, dependencies218, (_ref) =
var {
Node: Node4
} = _ref;
- function calculateNecessaryParentheses(node2, parenthesis, implicit) {
- var precedence = getPrecedence(node2, parenthesis, implicit);
+ function calculateNecessaryParentheses(node, parenthesis, implicit) {
+ var precedence = getPrecedence(node, parenthesis, implicit);
var parens = {};
- var startPrecedence = getPrecedence(node2.start, parenthesis, implicit);
+ var startPrecedence = getPrecedence(node.start, parenthesis, implicit);
parens.start = startPrecedence !== null && startPrecedence <= precedence || parenthesis === "all";
- if (node2.step) {
- var stepPrecedence = getPrecedence(node2.step, parenthesis, implicit);
+ if (node.step) {
+ var stepPrecedence = getPrecedence(node.step, parenthesis, implicit);
parens.step = stepPrecedence !== null && stepPrecedence <= precedence || parenthesis === "all";
}
- var endPrecedence = getPrecedence(node2.end, parenthesis, implicit);
+ var endPrecedence = getPrecedence(node.end, parenthesis, implicit);
parens.end = endPrecedence !== null && endPrecedence <= precedence || parenthesis === "all";
return parens;
}
@@ -70180,8 +70080,8 @@ var createRangeNode = /* @__PURE__ */ factory(name219, dependencies218, (_ref) =
return true;
}
needsEnd() {
- var endSymbols = this.filter(function(node2) {
- return isSymbolNode(node2) && node2.name === "end";
+ var endSymbols = this.filter(function(node) {
+ return isSymbolNode(node) && node.name === "end";
});
return endSymbols.length > 0;
}
@@ -70337,7 +70237,7 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, dependencies219, (_r
}
_compile(math2, argNames) {
var self2 = this;
- var compiled = this.params.map((p2) => p2._compile(math2, argNames));
+ var compiled = this.params.map((p) => p._compile(math2, argNames));
return function evalRelationalNode(scope, args, context) {
var evalLhs;
var evalRhs = compiled[0](scope, args, context);
@@ -70364,9 +70264,9 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, 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(p2, index3) {
- var paramPrecedence = getPrecedence(p2, parenthesis, options && options.implicit);
- return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "(" + p2.toString(options) + ")" : p2.toString(options);
+ var paramStrings = this.params.map(function(p, index2) {
+ var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit);
+ return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "(" + p.toString(options) + ")" : p.toString(options);
});
var ret = paramStrings[0];
for (var i4 = 0; i4 < this.conditionals.length; i4++) {
@@ -70388,9 +70288,9 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, 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(p2, index3) {
- var paramPrecedence = getPrecedence(p2, parenthesis, options && options.implicit);
- return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? '(' + p2.toHTML(options) + ')' : p2.toHTML(options);
+ var paramStrings = this.params.map(function(p, index2) {
+ var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit);
+ return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? '(' + p.toHTML(options) + ')' : p.toHTML(options);
});
var ret = paramStrings[0];
for (var i4 = 0; i4 < this.conditionals.length; i4++) {
@@ -70401,9 +70301,9 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, 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(p2, index3) {
- var paramPrecedence = getPrecedence(p2, parenthesis, options && options.implicit);
- return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "\\left(" + p2.toTex(options) + "\right)" : p2.toTex(options);
+ var paramStrings = this.params.map(function(p, index2) {
+ var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit);
+ return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "\\left(" + p.toTex(options) + "\right)" : p.toTex(options);
});
var ret = paramStrings[0];
for (var i4 = 0; i4 < this.conditionals.length; i4++) {
@@ -70533,7 +70433,7 @@ var createFunctionNode = /* @__PURE__ */ factory(name222, dependencies221, (_ref
var strin = (entity) => format4(entity, {
truncate: 78
});
- function expandTemplate(template2, node2, options) {
+ function expandTemplate(template2, node, options) {
var latex = "";
var regex = /\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi;
var inputPos = 0;
@@ -70546,7 +70446,7 @@ var createFunctionNode = /* @__PURE__ */ factory(name222, dependencies221, (_ref
inputPos++;
} else {
inputPos += match2[0].length;
- var property = node2[match2[1]];
+ var property = node[match2[1]];
if (!property) {
throw new ReferenceError("Template: Property " + match2[1] + " does not exist.");
}
@@ -70559,11 +70459,11 @@ var createFunctionNode = /* @__PURE__ */ factory(name222, dependencies221, (_ref
if (isNode2(property)) {
latex += property.toTex(options);
} else if (Array.isArray(property)) {
- latex += property.map(function(arg2, index3) {
+ latex += property.map(function(arg2, index2) {
if (isNode2(arg2)) {
return arg2.toTex(options);
}
- throw new TypeError("Template: " + match2[1] + "[" + index3 + "] is not a Node.");
+ throw new TypeError("Template: " + match2[1] + "[" + index2 + "] is not a Node.");
}).join(",");
} else {
throw new TypeError("Template: " + match2[1] + " has to be a Node, String or array of Nodes");
@@ -70843,8 +70743,8 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
RelationalNode: RelationalNode2,
SymbolNode: SymbolNode2
} = _ref;
- var parse8 = typed3(name223, {
- string: function string6(expression) {
+ var parse7 = typed3(name223, {
+ string: function string4(expression) {
return parseStart(expression, {});
},
"Array | Matrix": function ArrayMatrix(expressions) {
@@ -70975,7 +70875,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
next(state);
}
}
- if (parse8.isWhitespace(currentCharacter(state), state.nestingLevel)) {
+ if (parse7.isWhitespace(currentCharacter(state), state.nestingLevel)) {
next(state);
} else {
break;
@@ -71015,7 +70915,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
next(state);
return;
}
- if (parse8.isDigitDot(c1)) {
+ if (parse7.isDigitDot(c1)) {
state.tokenType = TOKENTYPE.NUMBER;
var _c = currentString(state, 2);
if (_c === "0b" || _c === "0o" || _c === "0x") {
@@ -71023,21 +70923,21 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
next(state);
state.token += currentCharacter(state);
next(state);
- while (parse8.isHexDigit(currentCharacter(state))) {
+ while (parse7.isHexDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
if (currentCharacter(state) === ".") {
state.token += ".";
next(state);
- while (parse8.isHexDigit(currentCharacter(state))) {
+ while (parse7.isHexDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
} else if (currentCharacter(state) === "i") {
state.token += "i";
next(state);
- while (parse8.isDigit(currentCharacter(state))) {
+ while (parse7.isDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
@@ -71047,40 +70947,40 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
if (currentCharacter(state) === ".") {
state.token += currentCharacter(state);
next(state);
- if (!parse8.isDigit(currentCharacter(state))) {
+ if (!parse7.isDigit(currentCharacter(state))) {
state.tokenType = TOKENTYPE.DELIMITER;
return;
}
} else {
- while (parse8.isDigit(currentCharacter(state))) {
+ while (parse7.isDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
- if (parse8.isDecimalMark(currentCharacter(state), nextCharacter(state))) {
+ if (parse7.isDecimalMark(currentCharacter(state), nextCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
}
- while (parse8.isDigit(currentCharacter(state))) {
+ while (parse7.isDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
if (currentCharacter(state) === "E" || currentCharacter(state) === "e") {
- if (parse8.isDigit(nextCharacter(state)) || nextCharacter(state) === "-" || nextCharacter(state) === "+") {
+ if (parse7.isDigit(nextCharacter(state)) || nextCharacter(state) === "-" || nextCharacter(state) === "+") {
state.token += currentCharacter(state);
next(state);
if (currentCharacter(state) === "+" || currentCharacter(state) === "-") {
state.token += currentCharacter(state);
next(state);
}
- if (!parse8.isDigit(currentCharacter(state))) {
+ if (!parse7.isDigit(currentCharacter(state))) {
throw createSyntaxError(state, 'Digit expected, got "' + currentCharacter(state) + '"');
}
- while (parse8.isDigit(currentCharacter(state))) {
+ while (parse7.isDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
- if (parse8.isDecimalMark(currentCharacter(state), nextCharacter(state))) {
+ if (parse7.isDecimalMark(currentCharacter(state), nextCharacter(state))) {
throw createSyntaxError(state, 'Digit expected, got "' + currentCharacter(state) + '"');
}
} else if (nextCharacter(state) === ".") {
@@ -71090,8 +70990,8 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
return;
}
- if (parse8.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) {
- while (parse8.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse8.isDigit(currentCharacter(state))) {
+ if (parse7.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) {
+ while (parse7.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse7.isDigit(currentCharacter(state))) {
state.token += currentCharacter(state);
next(state);
}
@@ -71120,28 +71020,28 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
function closeParams(state) {
state.nestingLevel--;
}
- parse8.isAlpha = function isAlpha(c3, cPrev, cNext) {
- return parse8.isValidLatinOrGreek(c3) || parse8.isValidMathSymbol(c3, cNext) || parse8.isValidMathSymbol(cPrev, c3);
+ parse7.isAlpha = function isAlpha(c3, cPrev, cNext) {
+ return parse7.isValidLatinOrGreek(c3) || parse7.isValidMathSymbol(c3, cNext) || parse7.isValidMathSymbol(cPrev, c3);
};
- parse8.isValidLatinOrGreek = function isValidLatinOrGreek(c3) {
+ parse7.isValidLatinOrGreek = function isValidLatinOrGreek(c3) {
return /^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(c3);
};
- parse8.isValidMathSymbol = function isValidMathSymbol(high, low) {
+ parse7.isValidMathSymbol = function isValidMathSymbol(high, low) {
return /^[\uD835]$/.test(high) && /^[\uDC00-\uDFFF]$/.test(low) && /^[^\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(low);
};
- parse8.isWhitespace = function isWhitespace(c3, nestingLevel) {
+ parse7.isWhitespace = function isWhitespace(c3, nestingLevel) {
return c3 === " " || c3 === " " || c3 === "\n" && nestingLevel > 0;
};
- parse8.isDecimalMark = function isDecimalMark(c3, cNext) {
+ parse7.isDecimalMark = function isDecimalMark(c3, cNext) {
return c3 === "." && cNext !== "/" && cNext !== "*" && cNext !== "^";
};
- parse8.isDigitDot = function isDigitDot(c3) {
+ parse7.isDigitDot = function isDigitDot(c3) {
return c3 >= "0" && c3 <= "9" || c3 === ".";
};
- parse8.isDigit = function isDigit(c3) {
+ parse7.isDigit = function isDigit(c3) {
return c3 >= "0" && c3 <= "9";
};
- parse8.isHexDigit = function isHexDigit2(c3) {
+ parse7.isHexDigit = function isHexDigit2(c3) {
return c3 >= "0" && c3 <= "9" || c3 >= "a" && c3 <= "f" || c3 >= "A" && c3 <= "F";
};
function parseStart(expression, extraNodes) {
@@ -71151,7 +71051,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
extraNodes
});
getToken(state);
- var node2 = parseBlock(state);
+ var node = parseBlock(state);
if (state.token !== "") {
if (state.tokenType === TOKENTYPE.DELIMITER) {
throw createError(state, "Unexpected operator " + state.token);
@@ -71159,35 +71059,35 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
throw createSyntaxError(state, 'Unexpected part "' + state.token + '"');
}
}
- return node2;
+ return node;
}
function parseBlock(state) {
- var node2;
+ var node;
var blocks = [];
var visible;
if (state.token !== "" && state.token !== "\n" && state.token !== ";") {
- node2 = parseAssignment(state);
+ node = parseAssignment(state);
if (state.comment) {
- node2.comment = state.comment;
+ node.comment = state.comment;
}
}
while (state.token === "\n" || state.token === ";") {
- if (blocks.length === 0 && node2) {
+ if (blocks.length === 0 && node) {
visible = state.token !== ";";
blocks.push({
- node: node2,
+ node,
visible
});
}
getToken(state);
if (state.token !== "\n" && state.token !== ";" && state.token !== "") {
- node2 = parseAssignment(state);
+ node = parseAssignment(state);
if (state.comment) {
- node2.comment = state.comment;
+ node.comment = state.comment;
}
visible = state.token !== ";";
blocks.push({
- node: node2,
+ node,
visible
});
}
@@ -71195,40 +71095,40 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
if (blocks.length > 0) {
return new BlockNode2(blocks);
} else {
- if (!node2) {
- node2 = new ConstantNode3(void 0);
+ if (!node) {
+ node = new ConstantNode3(void 0);
if (state.comment) {
- node2.comment = state.comment;
+ node.comment = state.comment;
}
}
- return node2;
+ return node;
}
}
function parseAssignment(state) {
- var name317, args, value, valid2;
- var node2 = parseConditional(state);
+ var name317, args, value, valid;
+ var node = parseConditional(state);
if (state.token === "=") {
- if (isSymbolNode(node2)) {
- name317 = node2.name;
+ if (isSymbolNode(node)) {
+ name317 = node.name;
getTokenSkipNewline(state);
value = parseAssignment(state);
return new AssignmentNode2(new SymbolNode2(name317), value);
- } else if (isAccessorNode(node2)) {
+ } else if (isAccessorNode(node)) {
getTokenSkipNewline(state);
value = parseAssignment(state);
- return new AssignmentNode2(node2.object, node2.index, value);
- } else if (isFunctionNode(node2) && isSymbolNode(node2.fn)) {
- valid2 = true;
+ return new AssignmentNode2(node.object, node.index, value);
+ } else if (isFunctionNode(node) && isSymbolNode(node.fn)) {
+ valid = true;
args = [];
- name317 = node2.name;
- node2.args.forEach(function(arg2, index3) {
+ name317 = node.name;
+ node.args.forEach(function(arg2, index2) {
if (isSymbolNode(arg2)) {
- args[index3] = arg2.name;
+ args[index2] = arg2.name;
} else {
- valid2 = false;
+ valid = false;
}
});
- if (valid2) {
+ if (valid) {
getTokenSkipNewline(state);
value = parseAssignment(state);
return new FunctionAssignmentNode2(name317, args, value);
@@ -71236,73 +71136,73 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
throw createSyntaxError(state, "Invalid left hand side of assignment operator =");
}
- return node2;
+ return node;
}
function parseConditional(state) {
- var node2 = parseLogicalOr(state);
+ var node = parseLogicalOr(state);
while (state.token === "?") {
var prev = state.conditionalLevel;
state.conditionalLevel = state.nestingLevel;
getTokenSkipNewline(state);
- var condition = node2;
+ var condition = node;
var trueExpr = parseAssignment(state);
if (state.token !== ":")
throw createSyntaxError(state, "False part of conditional expression expected");
state.conditionalLevel = null;
getTokenSkipNewline(state);
var falseExpr = parseAssignment(state);
- node2 = new ConditionalNode2(condition, trueExpr, falseExpr);
+ node = new ConditionalNode2(condition, trueExpr, falseExpr);
state.conditionalLevel = prev;
}
- return node2;
+ return node;
}
function parseLogicalOr(state) {
- var node2 = parseLogicalXor(state);
+ var node = parseLogicalXor(state);
while (state.token === "or") {
getTokenSkipNewline(state);
- node2 = new OperatorNode2("or", "or", [node2, parseLogicalXor(state)]);
+ node = new OperatorNode2("or", "or", [node, parseLogicalXor(state)]);
}
- return node2;
+ return node;
}
function parseLogicalXor(state) {
- var node2 = parseLogicalAnd(state);
+ var node = parseLogicalAnd(state);
while (state.token === "xor") {
getTokenSkipNewline(state);
- node2 = new OperatorNode2("xor", "xor", [node2, parseLogicalAnd(state)]);
+ node = new OperatorNode2("xor", "xor", [node, parseLogicalAnd(state)]);
}
- return node2;
+ return node;
}
function parseLogicalAnd(state) {
- var node2 = parseBitwiseOr(state);
+ var node = parseBitwiseOr(state);
while (state.token === "and") {
getTokenSkipNewline(state);
- node2 = new OperatorNode2("and", "and", [node2, parseBitwiseOr(state)]);
+ node = new OperatorNode2("and", "and", [node, parseBitwiseOr(state)]);
}
- return node2;
+ return node;
}
function parseBitwiseOr(state) {
- var node2 = parseBitwiseXor(state);
+ var node = parseBitwiseXor(state);
while (state.token === "|") {
getTokenSkipNewline(state);
- node2 = new OperatorNode2("|", "bitOr", [node2, parseBitwiseXor(state)]);
+ node = new OperatorNode2("|", "bitOr", [node, parseBitwiseXor(state)]);
}
- return node2;
+ return node;
}
function parseBitwiseXor(state) {
- var node2 = parseBitwiseAnd(state);
+ var node = parseBitwiseAnd(state);
while (state.token === "^|") {
getTokenSkipNewline(state);
- node2 = new OperatorNode2("^|", "bitXor", [node2, parseBitwiseAnd(state)]);
+ node = new OperatorNode2("^|", "bitXor", [node, parseBitwiseAnd(state)]);
}
- return node2;
+ return node;
}
function parseBitwiseAnd(state) {
- var node2 = parseRelational(state);
+ var node = parseRelational(state);
while (state.token === "&") {
getTokenSkipNewline(state);
- node2 = new OperatorNode2("&", "bitAnd", [node2, parseRelational(state)]);
+ node = new OperatorNode2("&", "bitAnd", [node, parseRelational(state)]);
}
- return node2;
+ return node;
}
function parseRelational(state) {
var params = [parseShift(state)];
@@ -71333,8 +71233,8 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
}
function parseShift(state) {
- var node2, name317, fn, params;
- node2 = parseConversion(state);
+ var node, name317, fn, params;
+ node = parseConversion(state);
var operators = {
"<<": "leftShift",
">>": "rightArithShift",
@@ -71344,14 +71244,14 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
name317 = state.token;
fn = operators[name317];
getTokenSkipNewline(state);
- params = [node2, parseConversion(state)];
- node2 = new OperatorNode2(name317, fn, params);
+ params = [node, parseConversion(state)];
+ node = new OperatorNode2(name317, fn, params);
}
- return node2;
+ return node;
}
function parseConversion(state) {
- var node2, name317, fn, params;
- node2 = parseRange(state);
+ var node, name317, fn, params;
+ node = parseRange(state);
var operators = {
to: "to",
in: "to"
@@ -71361,24 +71261,24 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
fn = operators[name317];
getTokenSkipNewline(state);
if (name317 === "in" && state.token === "") {
- node2 = new OperatorNode2("*", "multiply", [node2, new SymbolNode2("in")], true);
+ node = new OperatorNode2("*", "multiply", [node, new SymbolNode2("in")], true);
} else {
- params = [node2, parseRange(state)];
- node2 = new OperatorNode2(name317, fn, params);
+ params = [node, parseRange(state)];
+ node = new OperatorNode2(name317, fn, params);
}
}
- return node2;
+ return node;
}
function parseRange(state) {
- var node2;
+ var node;
var params = [];
if (state.token === ":") {
- node2 = new ConstantNode3(1);
+ node = new ConstantNode3(1);
} else {
- node2 = parseAddSubtract(state);
+ node = parseAddSubtract(state);
}
if (state.token === ":" && state.conditionalLevel !== state.nestingLevel) {
- params.push(node2);
+ params.push(node);
while (state.token === ":" && params.length < 3) {
getTokenSkipNewline(state);
if (state.token === ")" || state.token === "]" || state.token === "," || state.token === "") {
@@ -71388,16 +71288,16 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
}
if (params.length === 3) {
- node2 = new RangeNode2(params[0], params[2], params[1]);
+ node = new RangeNode2(params[0], params[2], params[1]);
} else {
- node2 = new RangeNode2(params[0], params[1]);
+ node = new RangeNode2(params[0], params[1]);
}
}
- return node2;
+ return node;
}
function parseAddSubtract(state) {
- var node2, name317, fn, params;
- node2 = parseMultiplyDivide(state);
+ var node, name317, fn, params;
+ node = parseMultiplyDivide(state);
var operators = {
"+": "add",
"-": "subtract"
@@ -71408,18 +71308,18 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
getTokenSkipNewline(state);
var rightNode = parseMultiplyDivide(state);
if (rightNode.isPercentage) {
- params = [node2, new OperatorNode2("*", "multiply", [node2, rightNode])];
+ params = [node, new OperatorNode2("*", "multiply", [node, rightNode])];
} else {
- params = [node2, rightNode];
+ params = [node, rightNode];
}
- node2 = new OperatorNode2(name317, fn, params);
+ node = new OperatorNode2(name317, fn, params);
}
- return node2;
+ return node;
}
function parseMultiplyDivide(state) {
- var node2, last, name317, fn;
- node2 = parseImplicitMultiplication(state);
- last = node2;
+ var node, last, name317, fn;
+ node = parseImplicitMultiplication(state);
+ last = node;
var operators = {
"*": "multiply",
".*": "dotMultiply",
@@ -71432,30 +71332,30 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
fn = operators[name317];
getTokenSkipNewline(state);
last = parseImplicitMultiplication(state);
- node2 = new OperatorNode2(name317, fn, [node2, last]);
+ node = new OperatorNode2(name317, fn, [node, last]);
} else {
break;
}
}
- return node2;
+ return node;
}
function parseImplicitMultiplication(state) {
- var node2, last;
- node2 = parseRule2(state);
- last = node2;
+ var node, last;
+ node = parseRule2(state);
+ last = node;
while (true) {
- if (state.tokenType === TOKENTYPE.SYMBOL || state.token === "in" && isConstantNode(node2) || state.tokenType === TOKENTYPE.NUMBER && !isConstantNode(last) && (!isOperatorNode(last) || last.op === "!") || state.token === "(") {
+ if (state.tokenType === TOKENTYPE.SYMBOL || state.token === "in" && isConstantNode(node) || state.tokenType === TOKENTYPE.NUMBER && !isConstantNode(last) && (!isOperatorNode(last) || last.op === "!") || state.token === "(") {
last = parseRule2(state);
- node2 = new OperatorNode2("*", "multiply", [node2, last], true);
+ node = new OperatorNode2("*", "multiply", [node, last], true);
} else {
break;
}
}
- return node2;
+ return node;
}
function parseRule2(state) {
- var node2 = parsePercentage(state);
- var last = node2;
+ var node = parsePercentage(state);
+ var last = node;
var tokenStates = [];
while (true) {
if (state.token === "/" && rule2Node(last)) {
@@ -71468,7 +71368,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
_extends(state, tokenStates.pop());
tokenStates.pop();
last = parsePercentage(state);
- node2 = new OperatorNode2("/", "divide", [node2, last]);
+ node = new OperatorNode2("/", "divide", [node, last]);
} else {
tokenStates.pop();
_extends(state, tokenStates.pop());
@@ -71482,11 +71382,11 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
break;
}
}
- return node2;
+ return node;
}
function parsePercentage(state) {
- var node2, name317, fn, params;
- node2 = parseUnary(state);
+ var node, name317, fn, params;
+ node = parseUnary(state);
var operators = {
"%": "mod",
mod: "mod"
@@ -71496,13 +71396,13 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
fn = operators[name317];
getTokenSkipNewline(state);
if (name317 === "%" && state.tokenType === TOKENTYPE.DELIMITER && state.token !== "(") {
- node2 = new OperatorNode2("/", "divide", [node2, new ConstantNode3(100)], false, true);
+ node = new OperatorNode2("/", "divide", [node, new ConstantNode3(100)], false, true);
} else {
- params = [node2, parseUnary(state)];
- node2 = new OperatorNode2(name317, fn, params);
+ params = [node, parseUnary(state)];
+ node = new OperatorNode2(name317, fn, params);
}
}
- return node2;
+ return node;
}
function parseUnary(state) {
var name317, params, fn;
@@ -71522,20 +71422,20 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
return parsePow(state);
}
function parsePow(state) {
- var node2, name317, fn, params;
- node2 = parseLeftHandOperators(state);
+ var node, name317, fn, params;
+ node = parseLeftHandOperators(state);
if (state.token === "^" || state.token === ".^") {
name317 = state.token;
fn = name317 === "^" ? "pow" : "dotPow";
getTokenSkipNewline(state);
- params = [node2, parseUnary(state)];
- node2 = new OperatorNode2(name317, fn, params);
+ params = [node, parseUnary(state)];
+ node = new OperatorNode2(name317, fn, params);
}
- return node2;
+ return node;
}
function parseLeftHandOperators(state) {
- var node2, name317, fn, params;
- node2 = parseCustomNodes(state);
+ var node, name317, fn, params;
+ node = parseCustomNodes(state);
var operators = {
"!": "factorial",
"'": "ctranspose"
@@ -71544,11 +71444,11 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
name317 = state.token;
fn = operators[name317];
getToken(state);
- params = [node2];
- node2 = new OperatorNode2(name317, fn, params);
- node2 = parseAccessors(state, node2);
+ params = [node];
+ node = new OperatorNode2(name317, fn, params);
+ node = parseAccessors(state, node);
}
- return node2;
+ return node;
}
function parseCustomNodes(state) {
var params = [];
@@ -71577,28 +71477,28 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
return parseSymbol(state);
}
function parseSymbol(state) {
- var node2, name317;
+ var node, name317;
if (state.tokenType === TOKENTYPE.SYMBOL || state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS) {
name317 = state.token;
getToken(state);
if (hasOwnProperty2(CONSTANTS, name317)) {
- node2 = new ConstantNode3(CONSTANTS[name317]);
+ node = new ConstantNode3(CONSTANTS[name317]);
} else if (NUMERIC_CONSTANTS.indexOf(name317) !== -1) {
- node2 = new ConstantNode3(numeric3(name317, "number"));
+ node = new ConstantNode3(numeric3(name317, "number"));
} else {
- node2 = new SymbolNode2(name317);
+ node = new SymbolNode2(name317);
}
- node2 = parseAccessors(state, node2);
- return node2;
+ node = parseAccessors(state, node);
+ return node;
}
return parseString(state);
}
- function parseAccessors(state, node2, types2) {
+ function parseAccessors(state, node, types2) {
var params;
while ((state.token === "(" || state.token === "[" || state.token === ".") && (!types2 || types2.indexOf(state.token) !== -1)) {
params = [];
if (state.token === "(") {
- if (isSymbolNode(node2) || isAccessorNode(node2)) {
+ if (isSymbolNode(node) || isAccessorNode(node)) {
openParams(state);
getToken(state);
if (state.token !== ")") {
@@ -71613,9 +71513,9 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
closeParams(state);
getToken(state);
- node2 = new FunctionNode3(node2, params);
+ node = new FunctionNode3(node, params);
} else {
- return node2;
+ return node;
}
} else if (state.token === "[") {
openParams(state);
@@ -71632,7 +71532,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
closeParams(state);
getToken(state);
- node2 = new AccessorNode2(node2, new IndexNode2(params));
+ node = new AccessorNode2(node, new IndexNode2(params));
} else {
getToken(state);
var isPropertyName = state.tokenType === TOKENTYPE.SYMBOL || state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS;
@@ -71642,18 +71542,18 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
params.push(new ConstantNode3(state.token));
getToken(state);
var dotNotation = true;
- node2 = new AccessorNode2(node2, new IndexNode2(params, dotNotation));
+ node = new AccessorNode2(node, new IndexNode2(params, dotNotation));
}
}
- return node2;
+ return node;
}
function parseString(state) {
- var node2, str;
+ var node, str;
if (state.token === '"' || state.token === "'") {
str = parseStringToken(state, state.token);
- node2 = new ConstantNode3(str);
- node2 = parseAccessors(state, node2);
- return node2;
+ node = new ConstantNode3(str);
+ node = parseAccessors(state, node);
+ return node;
}
return parseMatrix(state);
}
@@ -71751,15 +71651,15 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
function parseObject2(state) {
if (state.token === "{") {
openParams(state);
- var key3;
+ var key2;
var properties3 = {};
do {
getToken(state);
if (state.token !== "}") {
if (state.token === '"' || state.token === "'") {
- key3 = parseStringToken(state, state.token);
+ key2 = parseStringToken(state, state.token);
} else if (state.tokenType === TOKENTYPE.SYMBOL || state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS) {
- key3 = state.token;
+ key2 = state.token;
getToken(state);
} else {
throw createSyntaxError(state, "Symbol or string expected as object key");
@@ -71768,7 +71668,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
throw createSyntaxError(state, "Colon : expected after object key");
}
getToken(state);
- properties3[key3] = parseAssignment(state);
+ properties3[key2] = parseAssignment(state);
}
} while (state.token === ",");
if (state.token !== "}") {
@@ -71776,9 +71676,9 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
}
closeParams(state);
getToken(state);
- var node2 = new ObjectNode2(properties3);
- node2 = parseAccessors(state, node2);
- return node2;
+ var node = new ObjectNode2(properties3);
+ node = parseAccessors(state, node);
+ return node;
}
return parseNumber(state);
}
@@ -71792,19 +71692,19 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
return parseParentheses(state);
}
function parseParentheses(state) {
- var node2;
+ var node;
if (state.token === "(") {
openParams(state);
getToken(state);
- node2 = parseAssignment(state);
+ node = parseAssignment(state);
if (state.token !== ")") {
throw createSyntaxError(state, "Parenthesis ) expected");
}
closeParams(state);
getToken(state);
- node2 = new ParenthesisNode2(node2);
- node2 = parseAccessors(state, node2);
- return node2;
+ node = new ParenthesisNode2(node);
+ node = parseAccessors(state, node);
+ return node;
}
return parseEnd(state);
}
@@ -71833,9 +71733,9 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => {
typed3.addConversion({
from: "string",
to: "Node",
- convert: parse8
+ convert: parse7
});
- return parse8;
+ return parse7;
});
// node_modules/mathjs/lib/esm/expression/function/compile.js
@@ -71844,15 +71744,15 @@ var dependencies223 = ["typed", "parse"];
var createCompile = /* @__PURE__ */ factory(name224, dependencies223, (_ref) => {
var {
typed: typed3,
- parse: parse8
+ parse: parse7
} = _ref;
return typed3(name224, {
- string: function string6(expr) {
- return parse8(expr).compile();
+ string: function string4(expr) {
+ return parse7(expr).compile();
},
"Array | Matrix": function ArrayMatrix(expr) {
return deepMap(expr, function(entry) {
- return parse8(entry).compile();
+ return parse7(entry).compile();
});
}
});
@@ -71864,25 +71764,25 @@ var dependencies224 = ["typed", "parse"];
var createEvaluate = /* @__PURE__ */ factory(name225, dependencies224, (_ref) => {
var {
typed: typed3,
- parse: parse8
+ parse: parse7
} = _ref;
return typed3(name225, {
- string: function string6(expr) {
+ string: function string4(expr) {
var scope = createEmptyMap();
- return parse8(expr).compile().evaluate(scope);
+ return parse7(expr).compile().evaluate(scope);
},
"string, Map | Object": function stringMapObject(expr, scope) {
- return parse8(expr).compile().evaluate(scope);
+ return parse7(expr).compile().evaluate(scope);
},
"Array | Matrix": function ArrayMatrix(expr) {
var scope = createEmptyMap();
return deepMap(expr, function(entry) {
- return parse8(entry).compile().evaluate(scope);
+ return parse7(entry).compile().evaluate(scope);
});
},
"Array | Matrix, Map | Object": function ArrayMatrixMapObject(expr, scope) {
return deepMap(expr, function(entry) {
- return parse8(entry).compile().evaluate(scope);
+ return parse7(entry).compile().evaluate(scope);
});
}
});
@@ -71990,15 +71890,15 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
var rows = m4._size[0];
var columns = m4._size[1];
var n3 = Math.min(rows, columns);
- var data3 = clone(m4._data);
+ var data2 = clone(m4._data);
var ldata = [];
var lsize = [rows, n3];
var udata = [];
var usize = [n3, columns];
var i4, j, k2;
- var p2 = [];
+ var p = [];
for (i4 = 0; i4 < rows; i4++) {
- p2[i4] = i4;
+ p[i4] = i4;
}
for (j = 0; j < columns; j++) {
if (j > 0) {
@@ -72006,16 +71906,16 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
var min5 = Math.min(i4, j);
var s4 = 0;
for (k2 = 0; k2 < min5; k2++) {
- s4 = addScalar2(s4, multiplyScalar2(data3[i4][k2], data3[k2][j]));
+ s4 = addScalar2(s4, multiplyScalar2(data2[i4][k2], data2[k2][j]));
}
- data3[i4][j] = subtractScalar2(data3[i4][j], s4);
+ data2[i4][j] = subtractScalar2(data2[i4][j], s4);
}
}
var pi3 = j;
var pabsv = 0;
var vjj = 0;
for (i4 = j; i4 < rows; i4++) {
- var v2 = data3[i4][j];
+ var v2 = data2[i4][j];
var absv = abs3(v2);
if (larger2(absv, pabsv)) {
pi3 = i4;
@@ -72024,14 +71924,14 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
}
}
if (j !== pi3) {
- p2[j] = [p2[pi3], p2[pi3] = p2[j]][0];
- DenseMatrix2._swapRows(j, pi3, data3);
+ p[j] = [p[pi3], p[pi3] = p[j]][0];
+ DenseMatrix2._swapRows(j, pi3, data2);
}
if (j < rows) {
for (i4 = j + 1; i4 < rows; i4++) {
- var vij = data3[i4][j];
+ var vij = data2[i4][j];
if (!equalScalar2(vij, 0)) {
- data3[i4][j] = divideScalar2(data3[i4][j], vjj);
+ data2[i4][j] = divideScalar2(data2[i4][j], vjj);
}
}
}
@@ -72046,7 +71946,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
}
if (i4 < j) {
if (i4 < columns) {
- udata[i4][j] = data3[i4][j];
+ udata[i4][j] = data2[i4][j];
}
if (j < rows) {
ldata[i4][j] = 0;
@@ -72055,7 +71955,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
}
if (i4 === j) {
if (i4 < columns) {
- udata[i4][j] = data3[i4][j];
+ udata[i4][j] = data2[i4][j];
}
if (j < rows) {
ldata[i4][j] = 1;
@@ -72066,7 +71966,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
udata[i4][j] = 0;
}
if (j < rows) {
- ldata[i4][j] = data3[i4][j];
+ ldata[i4][j] = data2[i4][j];
}
}
}
@@ -72079,14 +71979,14 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
size: usize
});
var pv = [];
- for (i4 = 0, n3 = p2.length; i4 < n3; i4++) {
- pv[p2[i4]] = i4;
+ for (i4 = 0, n3 = p.length; i4 < n3; i4++) {
+ pv[p[i4]] = i4;
}
return {
L: l2,
U: u3,
p: pv,
- toString: function toString5() {
+ toString: function toString4() {
return "L: " + this.L.toString() + "\nU: " + this.U.toString() + "\nP: " + this.p;
}
};
@@ -72096,7 +71996,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
var columns = m4._size[1];
var n3 = Math.min(rows, columns);
var values2 = m4._values;
- var index3 = m4._index;
+ var index2 = m4._index;
var ptr = m4._ptr;
var lvalues = [];
var lindex = [];
@@ -72132,7 +72032,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
var k0 = ptr[j];
var k1 = ptr[j + 1];
for (k2 = k0; k2 < k1; k2++) {
- i4 = index3[k2];
+ i4 = index2[k2];
spa.set(pvCo[i4], values2[k2]);
}
if (j > 0) {
@@ -72193,7 +72093,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => {
size: usize
}),
p: pvCo,
- toString: function toString5() {
+ toString: function toString4() {
return "L: " + this.L.toString() + "\nU: " + this.U.toString() + "\nP: " + this.p;
}
};
@@ -72290,7 +72190,7 @@ var createQr = /* @__PURE__ */ factory(name229, dependencies228, (_ref) => {
return {
Q: Q3,
R: R2,
- toString: function toString5() {
+ toString: function toString4() {
return "Q: " + this.Q.toString() + "\nR: " + this.R.toString();
}
};
@@ -72349,17 +72249,17 @@ function csPermute(a4, pinv2, q2, values2) {
}
// node_modules/mathjs/lib/esm/function/algebra/sparse/csTdfs.js
-function csTdfs(j, k2, w2, head2, next, post, stack) {
+function csTdfs(j, k2, w2, head, next, post, stack) {
var top = 0;
w2[stack] = j;
while (top >= 0) {
- var p2 = w2[stack + top];
- var i4 = w2[head2 + p2];
+ var p = w2[stack + top];
+ var i4 = w2[head + p];
if (i4 === -1) {
top--;
- post[k2++] = p2;
+ post[k2++] = p;
} else {
- w2[head2 + p2] = w2[next + i4];
+ w2[head + p] = w2[next + i4];
++top;
w2[stack + top] = i4;
}
@@ -72376,24 +72276,24 @@ function csPost(parent, n3) {
var j;
var post = [];
var w2 = [];
- var head2 = 0;
+ var head = 0;
var next = n3;
var stack = 2 * n3;
for (j = 0; j < n3; j++) {
- w2[head2 + j] = -1;
+ w2[head + j] = -1;
}
for (j = n3 - 1; j >= 0; j--) {
if (parent[j] === -1) {
continue;
}
- w2[next + j] = w2[head2 + parent[j]];
- w2[head2 + parent[j]] = j;
+ w2[next + j] = w2[head + parent[j]];
+ w2[head + parent[j]] = j;
}
for (j = 0; j < n3; j++) {
if (parent[j] !== -1) {
continue;
}
- k2 = csTdfs(j, k2, w2, head2, next, post, stack);
+ k2 = csTdfs(j, k2, w2, head, next, post, stack);
}
return post;
}
@@ -72421,8 +72321,8 @@ function csEtree(a4, ata) {
for (var k2 = 0; k2 < n3; k2++) {
parent[k2] = -1;
w2[ancestor2 + k2] = -1;
- for (var p0 = aptr[k2], p1 = aptr[k2 + 1], p2 = p0; p2 < p1; p2++) {
- var r2 = aindex[p2];
+ for (var p0 = aptr[k2], p1 = aptr[k2 + 1], p = p0; p < p1; p++) {
+ var r2 = aindex[p];
i4 = ata ? w2[prev + r2] : r2;
for (; i4 !== -1 && i4 < k2; i4 = inext) {
inext = w2[ancestor2 + i4];
@@ -72448,13 +72348,13 @@ function csFkeep(a4, callback, other) {
var n3 = asize[1];
var nz = 0;
for (var j = 0; j < n3; j++) {
- var p2 = aptr[j];
+ var p = aptr[j];
aptr[j] = nz;
- for (; p2 < aptr[j + 1]; p2++) {
- if (callback(aindex[p2], j, avalues ? avalues[p2] : 1, other)) {
- aindex[nz] = aindex[p2];
+ for (; p < aptr[j + 1]; p++) {
+ if (callback(aindex[p], j, avalues ? avalues[p] : 1, other)) {
+ aindex[nz] = aindex[p];
if (avalues) {
- avalues[nz] = avalues[p2];
+ avalues[nz] = avalues[p];
}
nz++;
}
@@ -72482,8 +72382,8 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
multiply: multiply2,
transpose: transpose2
} = _ref;
- return function csAmd(order2, a4) {
- if (!a4 || order2 <= 0 || order2 > 3) {
+ return function csAmd(order, a4) {
+ if (!a4 || order <= 0 || order > 3) {
return null;
}
var asize = a4._size;
@@ -72492,7 +72392,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
var lemax = 0;
var dense = Math.max(16, 10 * Math.sqrt(n3));
dense = Math.min(n3 - 2, dense);
- var cm = _createTargetMatrix(order2, a4, m4, n3, dense);
+ var cm = _createTargetMatrix(order, a4, m4, n3, dense);
csFkeep(cm, _diag, null);
var cindex = cm._index;
var cptr = cm._ptr;
@@ -72502,38 +72402,38 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
var len = 0;
var nv = n3 + 1;
var next = 2 * (n3 + 1);
- var head2 = 3 * (n3 + 1);
+ var head = 3 * (n3 + 1);
var elen = 4 * (n3 + 1);
var degree = 5 * (n3 + 1);
var w2 = 6 * (n3 + 1);
var hhead = 7 * (n3 + 1);
var last = P3;
- var mark2 = _initializeQuotientGraph(n3, cptr, W, len, head2, last, next, hhead, nv, w2, elen, degree);
- var nel = _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head2, last, next);
+ var mark = _initializeQuotientGraph(n3, cptr, W, len, head, last, next, hhead, nv, w2, elen, degree);
+ var nel = _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head, last, next);
var mindeg = 0;
var i4, j, k2, k1, k22, e5, pj, ln2, nvi, pk, eln, p1, p2, pn, h3, d4;
while (nel < n3) {
- for (k2 = -1; mindeg < n3 && (k2 = W[head2 + mindeg]) === -1; mindeg++)
+ for (k2 = -1; mindeg < n3 && (k2 = W[head + mindeg]) === -1; mindeg++)
;
if (W[next + k2] !== -1) {
last[W[next + k2]] = -1;
}
- W[head2 + mindeg] = W[next + k2];
+ W[head + mindeg] = W[next + k2];
var elenk = W[elen + k2];
var nvk = W[nv + k2];
nel += nvk;
var dk = 0;
W[nv + k2] = -nvk;
- var p3 = cptr[k2];
- var pk1 = elenk === 0 ? p3 : cnz;
+ var p = cptr[k2];
+ var pk1 = elenk === 0 ? p : cnz;
var pk2 = pk1;
for (k1 = 1; k1 <= elenk + 1; k1++) {
if (k1 > elenk) {
e5 = k2;
- pj = p3;
+ pj = p;
ln2 = W[len + k2] - elenk;
} else {
- e5 = cindex[p3++];
+ e5 = cindex[p++];
pj = cptr[e5];
ln2 = W[len + e5];
}
@@ -72551,7 +72451,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
if (last[i4] !== -1) {
W[next + last[i4]] = W[next + i4];
} else {
- W[head2 + W[degree + i4]] = W[next + i4];
+ W[head + W[degree + i4]] = W[next + i4];
}
}
if (e5 !== k2) {
@@ -72566,17 +72466,17 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
cptr[k2] = pk1;
W[len + k2] = pk2 - pk1;
W[elen + k2] = -2;
- mark2 = _wclear(mark2, lemax, W, w2, n3);
+ mark = _wclear(mark, lemax, W, w2, n3);
for (pk = pk1; pk < pk2; pk++) {
i4 = cindex[pk];
if ((eln = W[elen + i4]) <= 0) {
continue;
}
nvi = -W[nv + i4];
- var wnvi = mark2 - nvi;
- for (p3 = cptr[i4], p1 = cptr[i4] + eln - 1; p3 <= p1; p3++) {
- e5 = cindex[p3];
- if (W[w2 + e5] >= mark2) {
+ var wnvi = mark - nvi;
+ for (p = cptr[i4], p1 = cptr[i4] + eln - 1; p <= p1; p++) {
+ e5 = cindex[p];
+ if (W[w2 + e5] >= mark) {
W[w2 + e5] -= nvi;
} else if (W[w2 + e5] !== 0) {
W[w2 + e5] = W[degree + e5] + wnvi;
@@ -72588,10 +72488,10 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
p1 = cptr[i4];
p2 = p1 + W[elen + i4] - 1;
pn = p1;
- for (h3 = 0, d4 = 0, p3 = p1; p3 <= p2; p3++) {
- e5 = cindex[p3];
+ for (h3 = 0, d4 = 0, p = p1; p <= p2; p++) {
+ e5 = cindex[p];
if (W[w2 + e5] !== 0) {
- var dext = W[w2 + e5] - mark2;
+ var dext = W[w2 + e5] - mark;
if (dext > 0) {
d4 += dext;
cindex[pn++] = e5;
@@ -72603,10 +72503,10 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
}
}
W[elen + i4] = pn - p1 + 1;
- var p32 = pn;
+ var p3 = pn;
var p4 = p1 + W[len + i4];
- for (p3 = p2 + 1; p3 < p4; p3++) {
- j = cindex[p3];
+ for (p = p2 + 1; p < p4; p++) {
+ j = cindex[p];
var nvj = W[nv + j];
if (nvj <= 0) {
continue;
@@ -72625,8 +72525,8 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
W[elen + i4] = -1;
} else {
W[degree + i4] = Math.min(W[degree + i4], d4);
- cindex[pn] = cindex[p32];
- cindex[p32] = cindex[p1];
+ cindex[pn] = cindex[p3];
+ cindex[p3] = cindex[p1];
cindex[p1] = k2;
W[len + i4] = pn - p1 + 1;
h3 = (h3 < 0 ? -h3 : h3) % n3;
@@ -72637,7 +72537,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
}
W[degree + k2] = dk;
lemax = Math.max(lemax, dk);
- mark2 = _wclear(mark2 + lemax, lemax, W, w2, n3);
+ mark = _wclear(mark + lemax, lemax, W, w2, n3);
for (pk = pk1; pk < pk2; pk++) {
i4 = cindex[pk];
if (W[nv + i4] >= 0) {
@@ -72646,21 +72546,21 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
h3 = last[i4];
i4 = W[hhead + h3];
W[hhead + h3] = -1;
- for (; i4 !== -1 && W[next + i4] !== -1; i4 = W[next + i4], mark2++) {
+ for (; i4 !== -1 && W[next + i4] !== -1; i4 = W[next + i4], mark++) {
ln2 = W[len + i4];
eln = W[elen + i4];
- for (p3 = cptr[i4] + 1; p3 <= cptr[i4] + ln2 - 1; p3++) {
- W[w2 + cindex[p3]] = mark2;
+ for (p = cptr[i4] + 1; p <= cptr[i4] + ln2 - 1; p++) {
+ W[w2 + cindex[p]] = mark;
}
var jlast = i4;
for (j = W[next + i4]; j !== -1; ) {
- var ok2 = W[len + j] === ln2 && W[elen + j] === eln;
- for (p3 = cptr[j] + 1; ok2 && p3 <= cptr[j] + ln2 - 1; p3++) {
- if (W[w2 + cindex[p3]] !== mark2) {
- ok2 = 0;
+ var ok = W[len + j] === ln2 && W[elen + j] === eln;
+ for (p = cptr[j] + 1; ok && p <= cptr[j] + ln2 - 1; p++) {
+ if (W[w2 + cindex[p]] !== mark) {
+ ok = 0;
}
}
- if (ok2) {
+ if (ok) {
cptr[j] = csFlip(i4);
W[nv + i4] += W[nv + j];
W[nv + j] = 0;
@@ -72674,7 +72574,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
}
}
}
- for (p3 = pk1, pk = pk1; pk < pk2; pk++) {
+ for (p = pk1, pk = pk1; pk < pk2; pk++) {
i4 = cindex[pk];
if ((nvi = -W[nv + i4]) <= 0) {
continue;
@@ -72682,72 +72582,72 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
W[nv + i4] = nvi;
d4 = W[degree + i4] + dk - nvi;
d4 = Math.min(d4, n3 - nel - nvi);
- if (W[head2 + d4] !== -1) {
- last[W[head2 + d4]] = i4;
+ if (W[head + d4] !== -1) {
+ last[W[head + d4]] = i4;
}
- W[next + i4] = W[head2 + d4];
+ W[next + i4] = W[head + d4];
last[i4] = -1;
- W[head2 + d4] = i4;
+ W[head + d4] = i4;
mindeg = Math.min(mindeg, d4);
W[degree + i4] = d4;
- cindex[p3++] = i4;
+ cindex[p++] = i4;
}
W[nv + k2] = nvk;
- if ((W[len + k2] = p3 - pk1) === 0) {
+ if ((W[len + k2] = p - pk1) === 0) {
cptr[k2] = -1;
W[w2 + k2] = 0;
}
if (elenk !== 0) {
- cnz = p3;
+ cnz = p;
}
}
for (i4 = 0; i4 < n3; i4++) {
cptr[i4] = csFlip(cptr[i4]);
}
for (j = 0; j <= n3; j++) {
- W[head2 + j] = -1;
+ W[head + j] = -1;
}
for (j = n3; j >= 0; j--) {
if (W[nv + j] > 0) {
continue;
}
- W[next + j] = W[head2 + cptr[j]];
- W[head2 + cptr[j]] = j;
+ W[next + j] = W[head + cptr[j]];
+ W[head + cptr[j]] = j;
}
for (e5 = n3; e5 >= 0; e5--) {
if (W[nv + e5] <= 0) {
continue;
}
if (cptr[e5] !== -1) {
- W[next + e5] = W[head2 + cptr[e5]];
- W[head2 + cptr[e5]] = e5;
+ W[next + e5] = W[head + cptr[e5]];
+ W[head + cptr[e5]] = e5;
}
}
for (k2 = 0, i4 = 0; i4 <= n3; i4++) {
if (cptr[i4] === -1) {
- k2 = csTdfs(i4, k2, W, head2, next, P3, w2);
+ k2 = csTdfs(i4, k2, W, head, next, P3, w2);
}
}
P3.splice(P3.length - 1, 1);
return P3;
};
- function _createTargetMatrix(order2, a4, m4, n3, dense) {
+ function _createTargetMatrix(order, a4, m4, n3, dense) {
var at2 = transpose2(a4);
- if (order2 === 1 && n3 === m4) {
+ if (order === 1 && n3 === m4) {
return add4(a4, at2);
}
- if (order2 === 2) {
+ if (order === 2) {
var tindex = at2._index;
var tptr = at2._ptr;
var p2 = 0;
for (var j = 0; j < m4; j++) {
- var p3 = tptr[j];
+ var p = tptr[j];
tptr[j] = p2;
- if (tptr[j + 1] - p3 > dense) {
+ if (tptr[j + 1] - p > dense) {
continue;
}
- for (var p1 = tptr[j + 1]; p3 < p1; p3++) {
- tindex[p2++] = tindex[p3];
+ for (var p1 = tptr[j + 1]; p < p1; p++) {
+ tindex[p2++] = tindex[p];
}
}
tptr[m4] = p2;
@@ -72756,13 +72656,13 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
}
return multiply2(at2, a4);
}
- function _initializeQuotientGraph(n3, cptr, W, len, head2, last, next, hhead, nv, w2, elen, degree) {
+ function _initializeQuotientGraph(n3, cptr, W, len, head, last, next, hhead, nv, w2, elen, degree) {
for (var k2 = 0; k2 < n3; k2++) {
W[len + k2] = cptr[k2 + 1] - cptr[k2];
}
W[len + n3] = 0;
for (var i4 = 0; i4 <= n3; i4++) {
- W[head2 + i4] = -1;
+ W[head + i4] = -1;
last[i4] = -1;
W[next + i4] = -1;
W[hhead + i4] = -1;
@@ -72771,13 +72671,13 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
W[elen + i4] = 0;
W[degree + i4] = W[len + i4];
}
- var mark2 = _wclear(0, 0, W, w2, n3);
+ var mark = _wclear(0, 0, W, w2, n3);
W[elen + n3] = -2;
cptr[n3] = -1;
W[w2 + n3] = 0;
- return mark2;
+ return mark;
}
- function _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head2, last, next) {
+ function _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head, last, next) {
var nel = 0;
for (var i4 = 0; i4 < n3; i4++) {
var d4 = W[degree + i4];
@@ -72793,26 +72693,26 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => {
cptr[i4] = csFlip(n3);
W[nv + n3]++;
} else {
- var h3 = W[head2 + d4];
+ var h3 = W[head + d4];
if (h3 !== -1) {
last[h3] = i4;
}
- W[next + i4] = W[head2 + d4];
- W[head2 + d4] = i4;
+ W[next + i4] = W[head + d4];
+ W[head + d4] = i4;
}
}
return nel;
}
- function _wclear(mark2, lemax, W, w2, n3) {
- if (mark2 < 2 || mark2 + lemax < 0) {
+ function _wclear(mark, lemax, W, w2, n3) {
+ if (mark < 2 || mark + lemax < 0) {
for (var k2 = 0; k2 < n3; k2++) {
if (W[w2 + k2] !== 0) {
W[w2 + k2] = 1;
}
}
- mark2 = 2;
+ mark = 2;
}
- return mark2;
+ return mark;
}
function _diag(i4, j) {
return i4 !== j;
@@ -72862,14 +72762,14 @@ var createCsCounts = /* @__PURE__ */ factory(name231, dependencies230, (_ref) =>
var asize = a4._size;
var m4 = asize[0];
var n3 = asize[1];
- var i4, j, k2, J, p2, p0, p1;
+ var i4, j, k2, J, p, p0, p1;
var s4 = 4 * n3 + (ata ? n3 + m4 + 1 : 0);
var w2 = [];
var ancestor2 = 0;
var maxfirst = n3;
var prevleaf = 2 * n3;
var first = 3 * n3;
- var head2 = 4 * n3;
+ var head = 4 * n3;
var next = 5 * n3 + 1;
for (k2 = 0; k2 < s4; k2++) {
w2[k2] = -1;
@@ -72890,11 +72790,11 @@ var createCsCounts = /* @__PURE__ */ factory(name231, dependencies230, (_ref) =>
w2[post[k2]] = k2;
}
for (i4 = 0; i4 < m4; i4++) {
- for (k2 = n3, p0 = tptr[i4], p1 = tptr[i4 + 1], p2 = p0; p2 < p1; p2++) {
- k2 = Math.min(k2, w2[tindex[p2]]);
+ for (k2 = n3, p0 = tptr[i4], p1 = tptr[i4 + 1], p = p0; p < p1; p++) {
+ k2 = Math.min(k2, w2[tindex[p]]);
}
- w2[next + i4] = w2[head2 + k2];
- w2[head2 + k2] = i4;
+ w2[next + i4] = w2[head + k2];
+ w2[head + k2] = i4;
}
}
for (i4 = 0; i4 < n3; i4++) {
@@ -72905,9 +72805,9 @@ var createCsCounts = /* @__PURE__ */ factory(name231, dependencies230, (_ref) =>
if (parent[j] !== -1) {
colcount[parent[j]]--;
}
- for (J = ata ? w2[head2 + k2] : j; J !== -1; J = ata ? w2[next + J] : -1) {
- for (p2 = tptr[J]; p2 < tptr[J + 1]; p2++) {
- i4 = tindex[p2];
+ for (J = ata ? w2[head + k2] : j; J !== -1; J = ata ? w2[next + J] : -1) {
+ for (p = tptr[J]; p < tptr[J + 1]; p++) {
+ i4 = tindex[p];
var r2 = csLeaf(i4, j, w2, first, maxfirst, prevleaf, ancestor2);
if (r2.jleaf >= 1) {
colcount[j]++;
@@ -72947,18 +72847,18 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => {
var csCounts = createCsCounts({
transpose: transpose2
});
- return function csSqr(order2, a4, qr2) {
+ return function csSqr(order, a4, qr2) {
var aptr = a4._ptr;
var asize = a4._size;
var n3 = asize[1];
var k2;
var s4 = {};
- s4.q = csAmd(order2, a4);
- if (order2 && !s4.q) {
+ s4.q = csAmd(order, a4);
+ if (order && !s4.q) {
return null;
}
if (qr2) {
- var c3 = order2 ? csPermute(a4, null, s4.q, 0) : a4;
+ var c3 = order ? csPermute(a4, null, s4.q, 0) : a4;
s4.parent = csEtree(c3, 1);
var post = csPost(s4.parent, n3);
s4.cp = csCounts(c3, s4.parent, post, 1);
@@ -72986,12 +72886,12 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => {
var leftmost = s4.leftmost;
var w2 = [];
var next = 0;
- var head2 = m4;
+ var head = m4;
var tail = m4 + n3;
var nque = m4 + 2 * n3;
- var i4, k2, p2, p0, p1;
+ var i4, k2, p, p0, p1;
for (k2 = 0; k2 < n3; k2++) {
- w2[head2 + k2] = -1;
+ w2[head + k2] = -1;
w2[tail + k2] = -1;
w2[nque + k2] = 0;
}
@@ -72999,8 +72899,8 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => {
leftmost[i4] = -1;
}
for (k2 = n3 - 1; k2 >= 0; k2--) {
- for (p0 = aptr[k2], p1 = aptr[k2 + 1], p2 = p0; p2 < p1; p2++) {
- leftmost[aindex[p2]] = k2;
+ for (p0 = aptr[k2], p1 = aptr[k2 + 1], p = p0; p < p1; p++) {
+ leftmost[aindex[p]] = k2;
}
}
for (i4 = m4 - 1; i4 >= 0; i4--) {
@@ -73012,13 +72912,13 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => {
if (w2[nque + k2]++ === 0) {
w2[tail + k2] = i4;
}
- w2[next + i4] = w2[head2 + k2];
- w2[head2 + k2] = i4;
+ w2[next + i4] = w2[head + k2];
+ w2[head + k2] = i4;
}
s4.lnz = 0;
s4.m2 = m4;
for (k2 = 0; k2 < n3; k2++) {
- i4 = w2[head2 + k2];
+ i4 = w2[head + k2];
s4.lnz++;
if (i4 < 0) {
i4 = s4.m2++;
@@ -73033,8 +72933,8 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => {
if (w2[nque + pa] === 0) {
w2[tail + pa] = w2[tail + k2];
}
- w2[next + w2[tail + k2]] = w2[head2 + pa];
- w2[head2 + pa] = w2[next + i4];
+ w2[next + w2[tail + k2]] = w2[head + pa];
+ w2[head + pa] = w2[next + i4];
w2[nque + pa] += w2[nque + k2];
}
}
@@ -73064,33 +72964,33 @@ function csUnflip(i4) {
// node_modules/mathjs/lib/esm/function/algebra/sparse/csDfs.js
function csDfs(j, g, top, xi, pinv2) {
- var index3 = g._index;
+ var index2 = g._index;
var ptr = g._ptr;
var size2 = g._size;
var n3 = size2[1];
- var i4, p2, p22;
- var head2 = 0;
+ var i4, p, p2;
+ var head = 0;
xi[0] = j;
- while (head2 >= 0) {
- j = xi[head2];
+ while (head >= 0) {
+ j = xi[head];
var jnew = pinv2 ? pinv2[j] : j;
if (!csMarked(ptr, j)) {
csMark(ptr, j);
- xi[n3 + head2] = jnew < 0 ? 0 : csUnflip(ptr[jnew]);
+ xi[n3 + head] = jnew < 0 ? 0 : csUnflip(ptr[jnew]);
}
var done = 1;
- for (p2 = xi[n3 + head2], p22 = jnew < 0 ? 0 : csUnflip(ptr[jnew + 1]); p2 < p22; p2++) {
- i4 = index3[p2];
+ for (p = xi[n3 + head], p2 = jnew < 0 ? 0 : csUnflip(ptr[jnew + 1]); p < p2; p++) {
+ i4 = index2[p];
if (csMarked(ptr, i4)) {
continue;
}
- xi[n3 + head2] = p2;
- xi[++head2] = i4;
+ xi[n3 + head] = p;
+ xi[++head] = i4;
done = 0;
break;
}
if (done) {
- head2--;
+ head--;
xi[--top] = j;
}
}
@@ -73104,16 +73004,16 @@ function csReach(g, b2, k2, xi, pinv2) {
var bindex = b2._index;
var bptr = b2._ptr;
var n3 = gsize[1];
- var p2, p0, p1;
+ var p, p0, p1;
var top = n3;
- for (p0 = bptr[k2], p1 = bptr[k2 + 1], p2 = p0; p2 < p1; p2++) {
- var i4 = bindex[p2];
+ for (p0 = bptr[k2], p1 = bptr[k2 + 1], p = p0; p < p1; p++) {
+ var i4 = bindex[p];
if (!csMarked(gptr, i4)) {
top = csDfs(i4, g, top, xi, pinv2);
}
}
- for (p2 = top; p2 < n3; p2++) {
- csMark(gptr, xi[p2]);
+ for (p = top; p < n3; p++) {
+ csMark(gptr, xi[p]);
}
return top;
}
@@ -73136,13 +73036,13 @@ var createCsSpsolve = /* @__PURE__ */ factory(name233, dependencies232, (_ref) =
var bvalues = b2._values;
var bindex = b2._index;
var bptr = b2._ptr;
- var p2, p0, p1, q2;
+ var p, p0, p1, q2;
var top = csReach(g, b2, k2, xi, pinv2);
- for (p2 = top; p2 < n3; p2++) {
- x2[xi[p2]] = 0;
+ for (p = top; p < n3; p++) {
+ x2[xi[p]] = 0;
}
- for (p0 = bptr[k2], p1 = bptr[k2 + 1], p2 = p0; p2 < p1; p2++) {
- x2[bindex[p2]] = bvalues[p2];
+ for (p0 = bptr[k2], p1 = bptr[k2 + 1], p = p0; p < p1; p++) {
+ x2[bindex[p]] = bvalues[p];
}
for (var px = top; px < n3; px++) {
var j = xi[px];
@@ -73153,11 +73053,11 @@ var createCsSpsolve = /* @__PURE__ */ factory(name233, dependencies232, (_ref) =
p0 = gptr[J];
p1 = gptr[J + 1];
x2[j] = divideScalar2(x2[j], gvalues[lo ? p0 : p1 - 1]);
- p2 = lo ? p0 + 1 : p0;
+ p = lo ? p0 + 1 : p0;
q2 = lo ? p1 : p1 - 1;
- for (; p2 < q2; p2++) {
- var i4 = gindex[p2];
- x2[i4] = subtract3(x2[i4], multiply2(gvalues[p2], x2[j]));
+ for (; p < q2; p++) {
+ var i4 = gindex[p];
+ x2[i4] = subtract3(x2[i4], multiply2(gvalues[p], x2[j]));
}
}
return top;
@@ -73215,7 +73115,7 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => {
size: [n3, n3]
});
var pinv2 = [];
- var i4, p2;
+ var i4, p;
var x2 = [];
var xi = [];
for (i4 = 0; i4 < n3; i4++) {
@@ -73232,8 +73132,8 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => {
var top = csSpsolve(L2, m4, col, xi, x2, pinv2, 1);
var ipiv = -1;
var a4 = -1;
- for (p2 = top; p2 < n3; p2++) {
- i4 = xi[p2];
+ for (p = top; p < n3; p++) {
+ i4 = xi[p];
if (pinv2[i4] < 0) {
var xabs = abs3(x2[i4]);
if (larger2(xabs, a4)) {
@@ -73257,8 +73157,8 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => {
pinv2[ipiv] = k2;
lindex[lnz] = ipiv;
lvalues[lnz++] = 1;
- for (p2 = top; p2 < n3; p2++) {
- i4 = xi[p2];
+ for (p = top; p < n3; p++) {
+ i4 = xi[p];
if (pinv2[i4] < 0) {
lindex[lnz] = i4;
lvalues[lnz++] = divideScalar2(x2[i4], pivot);
@@ -73268,8 +73168,8 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => {
}
lptr[n3] = lnz;
uptr[n3] = unz;
- for (p2 = 0; p2 < lnz; p2++) {
- lindex[p2] = pinv2[lindex[p2]];
+ for (p = 0; p < lnz; p++) {
+ lindex[p] = pinv2[lindex[p]];
}
lvalues.splice(lnz, lvalues.length - lnz);
lindex.splice(lnz, lindex.length - lnz);
@@ -73314,21 +73214,21 @@ var createSlu = /* @__PURE__ */ factory(name235, dependencies234, (_ref) => {
SparseMatrix: SparseMatrix2
});
return typed3(name235, {
- "SparseMatrix, number, number": function SparseMatrixNumberNumber(a4, order2, threshold) {
- if (!isInteger(order2) || order2 < 0 || order2 > 3) {
+ "SparseMatrix, number, number": function SparseMatrixNumberNumber(a4, order, threshold) {
+ if (!isInteger(order) || order < 0 || order > 3) {
throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");
}
if (threshold < 0 || threshold > 1) {
throw new Error("Partial pivoting threshold must be a number from 0 to 1");
}
- var s4 = csSqr(order2, a4, false);
+ var s4 = csSqr(order, a4, false);
var f2 = csLu(a4, s4, threshold);
return {
L: f2.L,
U: f2.U,
p: f2.pinv,
q: s4.q,
- toString: function toString5() {
+ toString: function toString4() {
return "L: " + this.L.toString() + "\nU: " + this.U.toString() + "\np: " + this.p.toString() + (this.q ? "\nq: " + this.q.toString() : "") + "\n";
}
};
@@ -73337,13 +73237,13 @@ var createSlu = /* @__PURE__ */ factory(name235, dependencies234, (_ref) => {
});
// node_modules/mathjs/lib/esm/function/algebra/sparse/csIpvec.js
-function csIpvec(p2, b2) {
+function csIpvec(p, b2) {
var k2;
var n3 = b2.length;
var x2 = [];
- if (p2) {
+ if (p) {
for (k2 = 0; k2 < n3; k2++) {
- x2[p2[k2]] = b2[k2];
+ x2[p[k2]] = b2[k2];
}
} else {
for (k2 = 0; k2 < n3; k2++) {
@@ -73384,8 +73284,8 @@ var createLusolve = /* @__PURE__ */ factory(name236, dependencies235, (_ref) =>
var d4 = lup2(a4);
return _lusolve(d4.L, d4.U, d4.p, null, b2);
},
- "SparseMatrix, Array | Matrix, number, number": function SparseMatrixArrayMatrixNumberNumber(a4, b2, order2, threshold) {
- var d4 = slu2(a4, order2, threshold);
+ "SparseMatrix, Array | Matrix, number, number": function SparseMatrixArrayMatrixNumberNumber(a4, b2, order, threshold) {
+ var d4 = slu2(a4, order, threshold);
return _lusolve(d4.L, d4.U, d4.p, d4.q, b2);
},
"Object, Array | Matrix": function ObjectArrayMatrix(d4, b2) {
@@ -73401,12 +73301,12 @@ var createLusolve = /* @__PURE__ */ factory(name236, dependencies235, (_ref) =>
}
throw new TypeError("Invalid Matrix LU decomposition");
}
- function _lusolve(l2, u3, p2, q2, b2) {
+ function _lusolve(l2, u3, p, q2, b2) {
l2 = _toMatrix(l2);
u3 = _toMatrix(u3);
- if (p2) {
+ if (p) {
b2 = solveValidation(l2, b2, true);
- b2._data = csIpvec(p2, b2._data);
+ b2._data = csIpvec(p, b2._data);
}
var y3 = lsolve2(l2, b2);
var x2 = usolve2(u3, y3);
@@ -73636,9 +73536,9 @@ var createChainClass = /* @__PURE__ */ factory(name239, dependencies238, (_ref)
Chain2.prototype[name317] = chainify(fn);
}
}
- function createLazyProxy(name317, resolver2) {
+ function createLazyProxy(name317, resolver) {
lazy(Chain2.prototype, name317, function outerResolver() {
- var fn = resolver2();
+ var fn = resolver();
if (typeof fn === "function") {
return chainify(fn);
}
@@ -73689,9 +73589,9 @@ var createChainClass = /* @__PURE__ */ factory(name239, dependencies238, (_ref)
};
Chain2.createProxy(math2);
if (on) {
- on("import", function(name317, resolver2, path3) {
- if (!path3) {
- createLazyProxy(name317, resolver2);
+ on("import", function(name317, resolver, path2) {
+ if (!path2) {
+ createLazyProxy(name317, resolver);
}
});
}
@@ -76589,12 +76489,12 @@ var createHelp = /* @__PURE__ */ factory(name240, dependencies239, (_ref) => {
Help: Help2
} = _ref;
return typed3(name240, {
- any: function any(search3) {
+ any: function any(search2) {
var prop2;
- var searchName = search3;
- if (typeof search3 !== "string") {
+ var searchName = search2;
+ if (typeof search2 !== "string") {
for (prop2 in mathWithTransform2) {
- if (hasOwnProperty2(mathWithTransform2, prop2) && search3 === mathWithTransform2[prop2]) {
+ if (hasOwnProperty2(mathWithTransform2, prop2) && search2 === mathWithTransform2[prop2]) {
searchName = prop2;
break;
}
@@ -77018,13 +76918,13 @@ function createComplexEigs(_ref) {
var big = type === "BigNumber";
var cplx = type === "Complex";
var realzero = big ? bignumber2(0) : 0;
- var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1;
+ var one = big ? bignumber2(1) : cplx ? complex2(1) : 1;
var realone = big ? bignumber2(1) : 1;
var radix = big ? bignumber2(10) : 2;
var radixSq = multiplyScalar2(radix, radix);
var Rdiag;
if (findVectors) {
- Rdiag = Array(N).fill(one5);
+ Rdiag = Array(N).fill(one);
}
var last = false;
while (!last) {
@@ -77129,7 +77029,7 @@ function createComplexEigs(_ref) {
function iterateUntilTriangular(A, N, prec, type, findVectors) {
var big = type === "BigNumber";
var cplx = type === "Complex";
- var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1;
+ var one = big ? bignumber2(1) : cplx ? complex2(1) : 1;
if (big) {
prec = bignumber2(prec);
}
@@ -77137,8 +77037,8 @@ function createComplexEigs(_ref) {
var lambdas = [];
var n3 = N;
var Sdiag = [];
- var Qtotal = findVectors ? diag2(Array(N).fill(one5)) : void 0;
- var Qpartial = findVectors ? diag2(Array(n3).fill(one5)) : void 0;
+ var Qtotal = findVectors ? diag2(Array(N).fill(one)) : void 0;
+ var Qpartial = findVectors ? diag2(Array(n3).fill(one)) : void 0;
var lastConvergenceBefore = 0;
while (lastConvergenceBefore <= 100) {
lastConvergenceBefore += 1;
@@ -77165,7 +77065,7 @@ function createComplexEigs(_ref) {
inflateMatrix(Qpartial, N);
Qtotal = multiply2(Qtotal, Qpartial);
if (n3 > 1) {
- Qpartial = diag2(Array(n3 - 1).fill(one5));
+ Qpartial = diag2(Array(n3 - 1).fill(one));
}
}
n3 -= 1;
@@ -77182,7 +77082,7 @@ function createComplexEigs(_ref) {
inflateMatrix(Qpartial, N);
Qtotal = multiply2(Qtotal, Qpartial);
if (n3 > 2) {
- Qpartial = diag2(Array(n3 - 2).fill(one5));
+ Qpartial = diag2(Array(n3 - 2).fill(one));
}
}
n3 -= 2;
@@ -77216,7 +77116,7 @@ function createComplexEigs(_ref) {
var big = type === "BigNumber";
var cplx = type === "Complex";
var zero = big ? bignumber2(0) : cplx ? complex2(0) : 0;
- var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1;
+ var one = big ? bignumber2(1) : cplx ? complex2(1) : 1;
var uniqueValues = [];
var multiplicities = [];
for (var lambda of values2) {
@@ -77231,7 +77131,7 @@ function createComplexEigs(_ref) {
var vectors = [];
var len = uniqueValues.length;
var b2 = Array(N).fill(zero);
- var E2 = diag2(Array(N).fill(one5));
+ var E2 = diag2(Array(N).fill(one));
var _loop = function _loop2() {
var lambda2 = uniqueValues[_i4];
var S3 = subtract3(U, multiply2(lambda2, E2));
@@ -77267,9 +77167,9 @@ function createComplexEigs(_ref) {
var big = type === "BigNumber";
var cplx = type === "Complex";
var zero = big ? bignumber2(0) : cplx ? complex2(0) : 0;
- var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1;
+ var one = big ? bignumber2(1) : cplx ? complex2(1) : 1;
if (smaller2(abs3(c3), prec)) {
- return [[one5, zero], [zero, one5]];
+ return [[one, zero], [zero, one]];
}
if (larger2(abs3(subtract3(l1, l2)), prec)) {
return [[subtract3(l1, d4), subtract3(l2, d4)], [c3, c3]];
@@ -77277,9 +77177,9 @@ function createComplexEigs(_ref) {
var na = subtract3(a4, l1);
var nd = subtract3(d4, l1);
if (smaller2(abs3(b2), prec) && smaller2(abs3(nd), prec)) {
- return [[na, one5], [c3, zero]];
+ return [[na, one], [c3, zero]];
} else {
- return [[b2, zero], [nd, one5]];
+ return [[b2, zero], [nd, one]];
}
}
function inflateMatrix(arr, N) {
@@ -77344,7 +77244,7 @@ function createComplexEigs(_ref) {
if (++i4 >= 10) {
return null;
}
- b2 = normalize3(c3);
+ b2 = normalize(c3);
}
return b2;
}
@@ -77359,7 +77259,7 @@ function createComplexEigs(_ref) {
v2 = v2.map((n3) => complex2(n3));
}
v2 = orthogonalComplement(v2, orthog);
- return normalize3(v2, type);
+ return normalize(v2, type);
}
function orthogonalComplement(v2, orthog) {
var vectorShape = size2(v2);
@@ -77372,11 +77272,11 @@ function createComplexEigs(_ref) {
function norm3(v2) {
return abs3(sqrt3(dot2(v2, v2)));
}
- function normalize3(v2, type) {
+ function normalize(v2, type) {
var big = type === "BigNumber";
var cplx = type === "Complex";
- var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1;
- return multiply2(divideScalar2(one5, norm3(v2)), v2);
+ var one = big ? bignumber2(1) : cplx ? complex2(1) : 1;
+ return multiply2(divideScalar2(one, norm3(v2)), v2);
}
return complexEigs;
}
@@ -77665,7 +77565,7 @@ var createEigs = /* @__PURE__ */ factory(name245, dependencies244, (_ref) => {
larger: larger2,
column: column2,
flatten: flatten4,
- number: number5,
+ number: number4,
complex: complex2,
sqrt: sqrt3,
diag: diag2,
@@ -77873,7 +77773,7 @@ var createEigs = /* @__PURE__ */ factory(name245, dependencies244, (_ref) => {
if (hasNumber) {
for (var _i3 = 0; _i3 < N; _i3++) {
for (var _j3 = 0; _j3 < N; _j3++) {
- arr[_i3][_j3] = number5(arr[_i3][_j3]);
+ arr[_i3][_j3] = number4(arr[_i3][_j3]);
}
}
return "number";
@@ -77979,7 +77879,7 @@ var createSqrtm = /* @__PURE__ */ factory(name247, dependencies246, (_ref) => {
abs: abs3,
add: add4,
multiply: multiply2,
- map: map6,
+ map: map4,
sqrt: sqrt3,
subtract: subtract3,
inv: inv2,
@@ -78011,7 +77911,7 @@ var createSqrtm = /* @__PURE__ */ factory(name247, dependencies246, (_ref) => {
switch (size3.length) {
case 1:
if (size3[0] === 1) {
- return map6(A, sqrt3);
+ return map4(A, sqrt3);
} else {
throw new RangeError("Matrix must be square (size: " + format4(size3) + ")");
}
@@ -78044,7 +77944,7 @@ var createSylvester = /* @__PURE__ */ factory(name248, dependencies247, (_ref) =
range: range2,
concat: concat3,
transpose: transpose2,
- index: index3,
+ index: index2,
subset: subset2,
add: add4,
subtract: subtract3,
@@ -78086,31 +77986,31 @@ var createSylvester = /* @__PURE__ */ factory(name248, dependencies247, (_ref) =
var G2 = sB.T;
var V = sB.U;
var D2 = multiply2(multiply2(transpose2(U), C), V);
- var all6 = range2(0, m4);
+ var all2 = range2(0, m4);
var y3 = [];
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, index3(k2 + 1, k2))) > 1e-5) {
- var RHS = vc(subset2(D2, index3(all6, k2)), subset2(D2, index3(all6, k2 + 1)));
+ 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)));
for (var j = 0; j < k2; j++) {
- RHS = add4(RHS, vc(multiply2(y3[j], subset2(G2, index3(j, k2))), multiply2(y3[j], subset2(G2, index3(j, k2 + 1)))));
+ RHS = add4(RHS, vc(multiply2(y3[j], subset2(G2, index2(j, k2))), multiply2(y3[j], subset2(G2, index2(j, 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 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 LHS = vc(hc(add4(F, gkk), gmk), hc(gkm, add4(F, gmm)));
var yAux = lusolve2(LHS, RHS);
- y3[k2] = yAux.subset(index3(range2(0, m4), 0));
- y3[k2 + 1] = yAux.subset(index3(range2(m4, 2 * m4), 0));
+ y3[k2] = yAux.subset(index2(range2(0, m4), 0));
+ y3[k2 + 1] = yAux.subset(index2(range2(m4, 2 * m4), 0));
k2++;
} else {
- var _RHS = subset2(D2, index3(all6, k2));
+ var _RHS = subset2(D2, index2(all2, k2));
for (var _j = 0; _j < k2; _j++) {
- _RHS = add4(_RHS, multiply2(y3[_j], subset2(G2, index3(_j, k2))));
+ _RHS = add4(_RHS, multiply2(y3[_j], subset2(G2, index2(_j, k2))));
}
- var _gkk = subset2(G2, index3(k2, k2));
+ var _gkk = subset2(G2, index2(k2, k2));
var _LHS = subtract3(F, multiply2(_gkk, identity2(m4)));
y3[k2] = lusolve2(_LHS, _RHS);
}
@@ -78415,10 +78315,10 @@ var createDistance = /* @__PURE__ */ factory(name252, dependencies251, (_ref) =>
return _isNumber(a4[0]) && _isNumber(a4[1]) && _isNumber(a4[2]) && _isNumber(a4[3]) && _isNumber(a4[4]) && _isNumber(a4[5]);
}
function _objectToArray(o2) {
- var keys2 = Object.keys(o2);
+ var keys = Object.keys(o2);
var a4 = [];
- for (var i4 = 0; i4 < keys2.length; i4++) {
- a4.push(o2[keys2[i4]]);
+ for (var i4 = 0; i4 < keys.length; i4++) {
+ a4.push(o2[keys[i4]]);
}
return a4;
}
@@ -78882,7 +78782,7 @@ var createMad = /* @__PURE__ */ factory(name258, dependencies257, (_ref) => {
var {
typed: typed3,
abs: abs3,
- map: map6,
+ map: map4,
median: median3,
subtract: subtract3
} = _ref;
@@ -78899,7 +78799,7 @@ var createMad = /* @__PURE__ */ factory(name258, dependencies257, (_ref) => {
}
try {
var med = median3(array);
- return median3(map6(array, function(value) {
+ return median3(map4(array, function(value) {
return abs3(subtract3(value, med));
}));
} catch (err) {
@@ -79012,21 +78912,21 @@ var createQuantileSeq = /* @__PURE__ */ factory(name260, dependencies259, (_ref)
isInteger: isInteger3
});
return typed3(name260, {
- "Array | Matrix, number | BigNumber": (data3, p2) => _quantileSeqProbNumber(data3, p2, false),
- "Array | Matrix, number | BigNumber, number": (data3, prob, dim) => _quantileSeqDim(data3, prob, false, dim, _quantileSeqProbNumber),
+ "Array | Matrix, number | BigNumber": (data2, p) => _quantileSeqProbNumber(data2, p, false),
+ "Array | Matrix, number | BigNumber, number": (data2, prob, dim) => _quantileSeqDim(data2, prob, false, dim, _quantileSeqProbNumber),
"Array | Matrix, number | BigNumber, boolean": _quantileSeqProbNumber,
- "Array | Matrix, number | BigNumber, boolean, number": (data3, prob, sorted, dim) => _quantileSeqDim(data3, prob, sorted, dim, _quantileSeqProbNumber),
- "Array | Matrix, Array | Matrix": (data3, p2) => _quantileSeqProbCollection(data3, p2, false),
- "Array | Matrix, Array | Matrix, number": (data3, prob, dim) => _quantileSeqDim(data3, prob, false, dim, _quantileSeqProbCollection),
+ "Array | Matrix, number | BigNumber, boolean, number": (data2, prob, sorted, dim) => _quantileSeqDim(data2, prob, sorted, dim, _quantileSeqProbNumber),
+ "Array | Matrix, Array | Matrix": (data2, p) => _quantileSeqProbCollection(data2, p, false),
+ "Array | Matrix, Array | Matrix, number": (data2, prob, dim) => _quantileSeqDim(data2, prob, false, dim, _quantileSeqProbCollection),
"Array | Matrix, Array | Matrix, boolean": _quantileSeqProbCollection,
- "Array | Matrix, Array | Matrix, boolean, number": (data3, prob, sorted, dim) => _quantileSeqDim(data3, prob, sorted, dim, _quantileSeqProbCollection)
+ "Array | Matrix, Array | Matrix, boolean, number": (data2, prob, sorted, dim) => _quantileSeqDim(data2, prob, sorted, dim, _quantileSeqProbCollection)
});
- function _quantileSeqDim(data3, prob, sorted, dim, fn) {
- return apply2(data3, dim, (x2) => fn(x2, prob, sorted));
+ function _quantileSeqDim(data2, prob, sorted, dim, fn) {
+ return apply2(data2, dim, (x2) => fn(x2, prob, sorted));
}
- function _quantileSeqProbNumber(data3, probOrN, sorted) {
+ function _quantileSeqProbNumber(data2, probOrN, sorted) {
var probArr;
- var dataArr = data3.valueOf();
+ var dataArr = data2.valueOf();
if (smaller2(probOrN, 0)) {
throw new Error("N/prob must be non-negative");
}
@@ -79049,8 +78949,8 @@ var createQuantileSeq = /* @__PURE__ */ factory(name260, dependencies259, (_ref)
return isNumber(probOrN) ? probArr : bignumber2(probArr);
}
}
- function _quantileSeqProbCollection(data3, probOrN, sorted) {
- var dataArr = data3.valueOf();
+ function _quantileSeqProbCollection(data2, probOrN, sorted) {
+ var dataArr = data2.valueOf();
var probOrNArr = probOrN.valueOf();
var probArr = [];
for (var i4 = 0; i4 < probOrNArr.length; ++i4) {
@@ -79064,11 +78964,11 @@ var createQuantileSeq = /* @__PURE__ */ factory(name260, dependencies259, (_ref)
if (len === 0) {
throw new Error("Cannot calculate quantile of an empty sequence");
}
- 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 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 left;
var right;
@@ -79094,7 +78994,7 @@ var dependencies260 = ["typed", "map", "sqrt", "variance"];
var createStd = /* @__PURE__ */ factory(name261, dependencies260, (_ref) => {
var {
typed: typed3,
- map: map6,
+ map: map4,
sqrt: sqrt3,
variance: variance2
} = _ref;
@@ -79114,7 +79014,7 @@ var createStd = /* @__PURE__ */ factory(name261, dependencies260, (_ref) => {
try {
var v2 = variance2.apply(null, arguments);
if (isCollection(v2)) {
- return map6(v2, sqrt3);
+ return map4(v2, sqrt3);
} else {
return sqrt3(v2);
}
@@ -79176,7 +79076,7 @@ var createCorr = /* @__PURE__ */ factory(name262, dependencies261, (_ref) => {
var n3 = A.length;
var sumX = sum4(A);
var sumY = sum4(B2);
- var sumXY = A.reduce((acc, x2, index3) => add4(acc, multiply2(x2, B2[index3])), 0);
+ var sumXY = A.reduce((acc, x2, index2) => add4(acc, multiply2(x2, B2[index2])), 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));
@@ -79198,20 +79098,20 @@ var createCombinations = /* @__PURE__ */ factory(name263, dependencies262, (_ref
var BigNumber2 = n3.constructor;
var result, i4;
var nMinusk = n3.minus(k2);
- var one5 = new BigNumber2(1);
+ var one = new BigNumber2(1);
if (!isPositiveInteger(n3) || !isPositiveInteger(k2)) {
throw new TypeError("Positive integer value expected in function combinations");
}
if (k2.gt(n3)) {
throw new TypeError("k must be less than n in function combinations");
}
- result = one5;
+ result = one;
if (k2.lt(nMinusk)) {
- for (i4 = one5; i4.lte(nMinusk); i4 = i4.plus(one5)) {
+ for (i4 = one; i4.lte(nMinusk); i4 = i4.plus(one)) {
result = result.times(k2.plus(i4)).dividedBy(i4);
}
} else {
- for (i4 = one5; i4.lte(k2); i4 = i4.plus(one5)) {
+ for (i4 = one; i4.lte(k2); i4 = i4.plus(one)) {
result = result.times(nMinusk.plus(i4)).dividedBy(i4);
}
}
@@ -79251,21 +79151,21 @@ var createCombinationsWithRep = /* @__PURE__ */ factory(name264, dependencies263
"BigNumber, BigNumber": function BigNumberBigNumber(n3, k2) {
var BigNumber2 = n3.constructor;
var result, i4;
- var one5 = new BigNumber2(1);
- var nMinusOne = n3.minus(one5);
+ var one = new BigNumber2(1);
+ var nMinusOne = n3.minus(one);
if (!isPositiveInteger2(n3) || !isPositiveInteger2(k2)) {
throw new TypeError("Positive integer value expected in function combinationsWithRep");
}
- if (n3.lt(one5)) {
+ if (n3.lt(one)) {
throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");
}
- result = one5;
+ result = one;
if (k2.lt(nMinusOne)) {
- for (i4 = one5; i4.lte(nMinusOne); i4 = i4.plus(one5)) {
+ for (i4 = one; i4.lte(nMinusOne); i4 = i4.plus(one)) {
result = result.times(k2.plus(i4)).dividedBy(i4);
}
} else {
- for (i4 = one5; i4.lte(k2); i4 = i4.plus(one5)) {
+ for (i4 = one; i4.lte(k2); i4 = i4.plus(one)) {
result = result.times(nMinusOne.plus(i4)).dividedBy(i4);
}
}
@@ -79334,12 +79234,12 @@ var createGamma = /* @__PURE__ */ factory(name265, dependencies264, (_ref) => {
if (n3 % 2 === 1) {
return n3.times(bigFactorial(new _BigNumber(n3 - 1)));
}
- var p2 = n3;
+ var p = n3;
var prod2 = new Big(n3);
var sum4 = n3.toNumber();
- while (p2 > 2) {
- p2 -= 2;
- sum4 += p2;
+ while (p > 2) {
+ p -= 2;
+ sum4 += p;
prod2 = prod2.times(sum4);
}
return new _BigNumber(prod2.toPrecision(_BigNumber.precision));
@@ -79427,7 +79327,7 @@ var createFactorial = /* @__PURE__ */ factory(name267, dependencies266, (_ref) =
gamma: gamma2
} = _ref;
return typed3(name267, {
- number: function number5(n3) {
+ number: function number4(n3) {
if (n3 < 0) {
throw new Error("Value must be non-negative");
}
@@ -79453,27 +79353,27 @@ var createKldivergence = /* @__PURE__ */ factory(name268, dependencies267, (_ref
divide: divide3,
sum: sum4,
multiply: multiply2,
- map: map6,
+ map: map4,
dotDivide: dotDivide2,
log: log4,
isNumeric: isNumeric2
} = _ref;
return typed3(name268, {
- "Array, Array": function ArrayArray(q2, p2) {
- return _kldiv(matrix2(q2), matrix2(p2));
+ "Array, Array": function ArrayArray(q2, p) {
+ return _kldiv(matrix2(q2), matrix2(p));
},
- "Matrix, Array": function MatrixArray(q2, p2) {
- return _kldiv(q2, matrix2(p2));
+ "Matrix, Array": function MatrixArray(q2, p) {
+ return _kldiv(q2, matrix2(p));
},
- "Array, Matrix": function ArrayMatrix(q2, p2) {
- return _kldiv(matrix2(q2), p2);
+ "Array, Matrix": function ArrayMatrix(q2, p) {
+ return _kldiv(matrix2(q2), p);
},
- "Matrix, Matrix": function MatrixMatrix(q2, p2) {
- return _kldiv(q2, p2);
+ "Matrix, Matrix": function MatrixMatrix(q2, p) {
+ return _kldiv(q2, p);
}
});
- function _kldiv(q2, p2) {
- var plength = p2.size().length;
+ function _kldiv(q2, p) {
+ var plength = p.size().length;
var qlength = q2.size().length;
if (plength > 1) {
throw new Error("first object must be one dimensional");
@@ -79488,13 +79388,13 @@ var createKldivergence = /* @__PURE__ */ factory(name268, dependencies267, (_ref
if (sumq === 0) {
throw new Error("Sum of elements in first object must be non zero");
}
- var sump = sum4(p2);
+ var sump = sum4(p);
if (sump === 0) {
throw new Error("Sum of elements in second object must be non zero");
}
var qnorm = divide3(q2, sum4(q2));
- var pnorm = divide3(p2, sum4(p2));
- var result = sum4(multiply2(qnorm, map6(dotDivide2(qnorm, pnorm), (x2) => log4(x2))));
+ var pnorm = divide3(p, sum4(p));
+ var result = sum4(multiply2(qnorm, map4(dotDivide2(qnorm, pnorm), (x2) => log4(x2))));
if (isNumeric2(result)) {
return result;
} else {
@@ -79562,8 +79462,8 @@ var createPermutations = /* @__PURE__ */ factory(name270, dependencies269, (_ref
if (k2.gt(n3)) {
throw new TypeError("second argument k must be less than or equal to first argument n");
}
- var one5 = n3.mul(0).add(1);
- result = one5;
+ var one = n3.mul(0).add(1);
+ result = one;
for (i4 = n3.minus(k2).plus(1); i4.lte(n3); i4 = i4.plus(1)) {
result = result.times(i4);
}
@@ -79614,9 +79514,9 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref)
"Array | Matrix, Object": function ArrayMatrixObject(possibles, options) {
return _pickRandom(possibles, options);
},
- "Array | Matrix, number": function ArrayMatrixNumber(possibles, number5) {
+ "Array | Matrix, number": function ArrayMatrixNumber(possibles, number4) {
return _pickRandom(possibles, {
- number: number5
+ number: number4
});
},
"Array | Matrix, Array | Matrix": function ArrayMatrixArrayMatrix(possibles, weights) {
@@ -79624,28 +79524,28 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref)
weights
});
},
- "Array | Matrix, Array | Matrix, number": function ArrayMatrixArrayMatrixNumber(possibles, weights, number5) {
+ "Array | Matrix, Array | Matrix, number": function ArrayMatrixArrayMatrixNumber(possibles, weights, number4) {
return _pickRandom(possibles, {
- number: number5,
+ number: number4,
weights
});
},
- "Array | Matrix, number, Array | Matrix": function ArrayMatrixNumberArrayMatrix(possibles, number5, weights) {
+ "Array | Matrix, number, Array | Matrix": function ArrayMatrixNumberArrayMatrix(possibles, number4, weights) {
return _pickRandom(possibles, {
- number: number5,
+ number: number4,
weights
});
}
});
function _pickRandom(possibles, _ref2) {
var {
- number: number5,
+ number: number4,
weights,
elementWise = true
} = _ref2;
- var single = typeof number5 === "undefined";
+ var single = typeof number4 === "undefined";
if (single) {
- number5 = 1;
+ number4 = 1;
}
var createMatrix2 = isMatrix(possibles) ? possibles.create : isMatrix(weights) ? weights.create : null;
possibles = possibles.valueOf();
@@ -79671,7 +79571,7 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref)
var length = possibles.length;
var result = [];
var pick;
- while (result.length < number5) {
+ while (result.length < number4) {
if (typeof weights === "undefined") {
pick = possibles[Math.floor(rng() * length)];
} else {
@@ -79692,18 +79592,18 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref)
// node_modules/mathjs/lib/esm/function/probability/util/randomMatrix.js
function randomMatrix(size2, random3) {
- var data3 = [];
+ var data2 = [];
size2 = size2.slice(0);
if (size2.length > 1) {
for (var i4 = 0, length = size2.shift(); i4 < length; i4++) {
- data3.push(randomMatrix(size2, random3));
+ data2.push(randomMatrix(size2, random3));
}
} else {
for (var _i = 0, _length = size2.shift(); _i < _length; _i++) {
- data3.push(random3());
+ data2.push(random3());
}
}
- return data3;
+ return data2;
}
// node_modules/mathjs/lib/esm/function/probability/random.js
@@ -79789,7 +79689,7 @@ var createStirlingS2 = /* @__PURE__ */ factory(name274, dependencies273, (_ref)
combinations: combinations2,
isNegative: isNegative2,
isInteger: isInteger3,
- number: number5,
+ number: number4,
bignumber: bignumber2,
larger: larger2
} = _ref;
@@ -79804,9 +79704,9 @@ var createStirlingS2 = /* @__PURE__ */ factory(name274, dependencies273, (_ref)
}
var big = !(isNumber(n3) && isNumber(k2));
var cache2 = big ? bigCache : smallCache;
- var make = big ? bignumber2 : number5;
- var nn = number5(n3);
- var nk = number5(k2);
+ var make = big ? bignumber2 : number4;
+ var nn = number4(n3);
+ var nk = number4(k2);
if (cache2[nn] && cache2[nn].length > nk) {
return cache2[nn][nk];
}
@@ -79909,12 +79809,12 @@ var name278 = "leafCount";
var dependencies277 = ["parse", "typed"];
var createLeafCount = /* @__PURE__ */ factory(name278, dependencies277, (_ref) => {
var {
- parse: parse8,
+ parse: parse7,
typed: typed3
} = _ref;
- function countLeaves(node2) {
+ function countLeaves(node) {
var count3 = 0;
- node2.forEach((n3) => {
+ node.forEach((n3) => {
count3 += countLeaves(n3);
});
return count3 || 1;
@@ -80075,13 +79975,13 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => {
}
return defaultContext[defaultName][property];
}
- function isCommutative(node2) {
+ function isCommutative(node) {
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultContext;
- return hasProperty(node2, "commutative", context);
+ return hasProperty(node, "commutative", context);
}
- function isAssociative(node2) {
+ function isAssociative(node) {
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultContext;
- return hasProperty(node2, "associative", context);
+ return hasProperty(node, "associative", context);
}
function mergeContext(primary, secondary) {
var merged = _objectSpread3({}, primary);
@@ -80094,21 +79994,21 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => {
}
return merged;
}
- function flatten4(node2, context) {
- if (!node2.args || node2.args.length === 0) {
- return node2;
+ function flatten4(node, context) {
+ if (!node.args || node.args.length === 0) {
+ return node;
}
- node2.args = allChildren(node2, context);
- for (var i4 = 0; i4 < node2.args.length; i4++) {
- flatten4(node2.args[i4], context);
+ node.args = allChildren(node, context);
+ for (var i4 = 0; i4 < node.args.length; i4++) {
+ flatten4(node.args[i4], context);
}
}
- function allChildren(node2, context) {
+ function allChildren(node, context) {
var op;
var children = [];
- var findChildren = function findChildren2(node3) {
- for (var i4 = 0; i4 < node3.args.length; i4++) {
- var child = node3.args[i4];
+ var findChildren = function findChildren2(node2) {
+ for (var i4 = 0; i4 < node2.args.length; i4++) {
+ var child = node2.args[i4];
if (isOperatorNode(child) && op === child.op) {
findChildren2(child);
} else {
@@ -80116,53 +80016,53 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => {
}
}
};
- if (isAssociative(node2, context)) {
- op = node2.op;
- findChildren(node2);
+ if (isAssociative(node, context)) {
+ op = node.op;
+ findChildren(node);
return children;
} else {
- return node2.args;
+ return node.args;
}
}
- function unflattenr(node2, context) {
- if (!node2.args || node2.args.length === 0) {
+ function unflattenr(node, context) {
+ if (!node.args || node.args.length === 0) {
return;
}
- var makeNode = createMakeNodeFunction(node2);
- var l2 = node2.args.length;
+ var makeNode = createMakeNodeFunction(node);
+ var l2 = node.args.length;
for (var i4 = 0; i4 < l2; i4++) {
- unflattenr(node2.args[i4], context);
+ unflattenr(node.args[i4], context);
}
- if (l2 > 2 && isAssociative(node2, context)) {
- var curnode = node2.args.pop();
- while (node2.args.length > 0) {
- curnode = makeNode([node2.args.pop(), curnode]);
+ if (l2 > 2 && isAssociative(node, context)) {
+ var curnode = node.args.pop();
+ while (node.args.length > 0) {
+ curnode = makeNode([node.args.pop(), curnode]);
}
- node2.args = curnode.args;
+ node.args = curnode.args;
}
}
- function unflattenl(node2, context) {
- if (!node2.args || node2.args.length === 0) {
+ function unflattenl(node, context) {
+ if (!node.args || node.args.length === 0) {
return;
}
- var makeNode = createMakeNodeFunction(node2);
- var l2 = node2.args.length;
+ var makeNode = createMakeNodeFunction(node);
+ var l2 = node.args.length;
for (var i4 = 0; i4 < l2; i4++) {
- unflattenl(node2.args[i4], context);
+ unflattenl(node.args[i4], context);
}
- if (l2 > 2 && isAssociative(node2, context)) {
- var curnode = node2.args.shift();
- while (node2.args.length > 0) {
- curnode = makeNode([curnode, node2.args.shift()]);
+ if (l2 > 2 && isAssociative(node, context)) {
+ var curnode = node.args.shift();
+ while (node.args.length > 0) {
+ curnode = makeNode([curnode, node.args.shift()]);
}
- node2.args = curnode.args;
+ node.args = curnode.args;
}
}
- function createMakeNodeFunction(node2) {
- if (isOperatorNode(node2)) {
+ function createMakeNodeFunction(node) {
+ if (isOperatorNode(node)) {
return function(args) {
try {
- return new OperatorNode2(node2.op, node2.fn, args, node2.implicit);
+ return new OperatorNode2(node.op, node.fn, args, node.implicit);
} catch (err) {
console.error(err);
return [];
@@ -80170,7 +80070,7 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => {
};
} else {
return function(args) {
- return new FunctionNode3(new SymbolNode2(node2.name), args);
+ return new FunctionNode3(new SymbolNode2(node.name), args);
};
}
}
@@ -80197,7 +80097,7 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
var {
config: config4,
typed: typed3,
- parse: parse8,
+ parse: parse7,
add: add4,
subtract: subtract3,
multiply: multiply2,
@@ -80260,9 +80160,9 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
simplify2.defaultContext = defaultContext;
simplify2.realContext = realContext;
simplify2.positiveContext = positiveContext;
- function removeParens(node2) {
- return node2.transform(function(node3, path3, parent) {
- return isParenthesisNode(node3) ? removeParens(node3.content) : node3;
+ function removeParens(node) {
+ return node.transform(function(node2, path2, parent) {
+ return isParenthesisNode(node2) ? removeParens(node2.content) : node2;
});
}
var SUPPORTED_CONSTANTS = {
@@ -80665,15 +80565,15 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
newRule.l = ruleObject.l;
newRule.r = ruleObject.r;
}
- newRule.l = removeParens(parse8(newRule.l));
- newRule.r = removeParens(parse8(newRule.r));
+ newRule.l = removeParens(parse7(newRule.l));
+ newRule.r = removeParens(parse7(newRule.r));
for (var prop2 of ["imposeContext", "repeat", "assuming"]) {
if (prop2 in ruleObject) {
newRule[prop2] = ruleObject[prop2];
}
}
if (ruleObject.evaluate) {
- newRule.evaluate = parse8(ruleObject.evaluate);
+ newRule.evaluate = parse7(ruleObject.evaluate);
}
if (isAssociative(newRule.l, context)) {
var nonCommutative = !isCommutative(newRule.l, context);
@@ -80788,18 +80688,18 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
}
return resNodes;
}
- function applyRule(node2, rule, context) {
+ function applyRule(node, rule, context) {
if (rule.assuming) {
for (var symbol in rule.assuming) {
for (var property in rule.assuming[symbol]) {
if (hasProperty(symbol, property, context) !== rule.assuming[symbol][property]) {
- return node2;
+ return node;
}
}
}
}
var mergedContext = mergeContext(rule.imposeContext, context);
- var res = node2;
+ var res = node;
if (res instanceof OperatorNode2 || res instanceof FunctionNode3) {
var newArgs = mapRule(res.args, rule, context);
if (newArgs !== res.args) {
@@ -80868,37 +80768,37 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
if (implicit && "implicit" in repl) {
res.implicit = true;
}
- res = res.transform(function(node3) {
- if (node3.isSymbolNode && hasOwnProperty2(matches.placeholders, node3.name)) {
- return matches.placeholders[node3.name].clone();
+ res = res.transform(function(node2) {
+ if (node2.isSymbolNode && hasOwnProperty2(matches.placeholders, node2.name)) {
+ return matches.placeholders[node2.name].clone();
} else {
- return node3;
+ return node2;
}
});
}
- if (rule.repeat && res !== node2) {
+ if (rule.repeat && res !== node) {
res = applyRule(res, rule, context);
}
return res;
}
- function getSplits(node2, context) {
+ function getSplits(node, context) {
var res = [];
var right, rightArgs;
- var makeNode = createMakeNodeFunction(node2);
- if (isCommutative(node2, context)) {
- for (var i4 = 0; i4 < node2.args.length; i4++) {
- rightArgs = node2.args.slice(0);
+ var makeNode = createMakeNodeFunction(node);
+ if (isCommutative(node, context)) {
+ for (var i4 = 0; i4 < node.args.length; i4++) {
+ rightArgs = node.args.slice(0);
rightArgs.splice(i4, 1);
right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);
- res.push(makeNode([node2.args[i4], right]));
+ res.push(makeNode([node.args[i4], right]));
}
} else {
- for (var _i = 1; _i < node2.args.length; _i++) {
- var left = node2.args[0];
+ for (var _i = 1; _i < node.args.length; _i++) {
+ var left = node.args[0];
if (_i > 1) {
- left = makeNode(node2.args.slice(0, _i));
+ left = makeNode(node.args.slice(0, _i));
}
- rightArgs = node2.args.slice(_i);
+ rightArgs = node.args.slice(_i);
right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);
res.push(makeNode([left, right]));
}
@@ -80916,11 +80816,11 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
} else if (!match2.placeholders) {
return match1;
}
- for (var key3 in match1.placeholders) {
- if (hasOwnProperty2(match1.placeholders, key3)) {
- res.placeholders[key3] = match1.placeholders[key3];
- if (hasOwnProperty2(match2.placeholders, key3)) {
- if (!_exactMatch(match1.placeholders[key3], match2.placeholders[key3])) {
+ for (var key2 in match1.placeholders) {
+ if (hasOwnProperty2(match1.placeholders, key2)) {
+ res.placeholders[key2] = match1.placeholders[key2];
+ if (hasOwnProperty2(match2.placeholders, key2)) {
+ if (!_exactMatch(match1.placeholders[key2], match2.placeholders[key2])) {
return null;
}
}
@@ -80933,15 +80833,15 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
}
return res;
}
- function combineChildMatches(list1, list22) {
+ function combineChildMatches(list1, list2) {
var res = [];
- if (list1.length === 0 || list22.length === 0) {
+ if (list1.length === 0 || list2.length === 0) {
return res;
}
var merged;
for (var i1 = 0; i1 < list1.length; i1++) {
- for (var i22 = 0; i22 < list22.length; i22++) {
- merged = mergeMatch(list1[i1], list22[i22]);
+ for (var i22 = 0; i22 < list2.length; i22++) {
+ merged = mergeMatch(list1[i1], list2[i22]);
if (merged) {
res.push(merged);
}
@@ -80965,49 +80865,49 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
}
return uniqueSets;
}
- function _ruleMatch(rule, node2, context, isSplit) {
+ function _ruleMatch(rule, node, context, isSplit) {
var res = [{
placeholders: {}
}];
- if (rule instanceof OperatorNode2 && node2 instanceof OperatorNode2 || rule instanceof FunctionNode3 && node2 instanceof FunctionNode3) {
+ if (rule instanceof OperatorNode2 && node instanceof OperatorNode2 || rule instanceof FunctionNode3 && node instanceof FunctionNode3) {
if (rule instanceof OperatorNode2) {
- if (rule.op !== node2.op || rule.fn !== node2.fn) {
+ if (rule.op !== node.op || rule.fn !== node.fn) {
return [];
}
} else if (rule instanceof FunctionNode3) {
- if (rule.name !== node2.name) {
+ if (rule.name !== node.name) {
return [];
}
}
- if (node2.args.length === 1 && rule.args.length === 1 || !isAssociative(node2, context) && node2.args.length === rule.args.length || isSplit) {
+ if (node.args.length === 1 && rule.args.length === 1 || !isAssociative(node, context) && node.args.length === rule.args.length || isSplit) {
var childMatches = [];
for (var i4 = 0; i4 < rule.args.length; i4++) {
- var childMatch = _ruleMatch(rule.args[i4], node2.args[i4], context);
+ var childMatch = _ruleMatch(rule.args[i4], node.args[i4], context);
if (childMatch.length === 0) {
break;
}
childMatches.push(childMatch);
}
if (childMatches.length !== rule.args.length) {
- if (!isCommutative(node2, context) || rule.args.length === 1) {
+ if (!isCommutative(node, context) || rule.args.length === 1) {
return [];
}
if (rule.args.length > 2) {
throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");
}
- var leftMatch = _ruleMatch(rule.args[0], node2.args[1], context);
+ var leftMatch = _ruleMatch(rule.args[0], node.args[1], context);
if (leftMatch.length === 0) {
return [];
}
- var rightMatch = _ruleMatch(rule.args[1], node2.args[0], context);
+ var rightMatch = _ruleMatch(rule.args[1], node.args[0], context);
if (rightMatch.length === 0) {
return [];
}
childMatches = [leftMatch, rightMatch];
}
res = mergeChildMatches(childMatches);
- } else if (node2.args.length >= 2 && rule.args.length === 2) {
- var splits = getSplits(node2, context);
+ } else if (node.args.length >= 2 && rule.args.length === 2) {
+ var splits = getSplits(node, context);
var splitMatches = [];
for (var _i2 = 0; _i2 < splits.length; _i2++) {
var matchSet = _ruleMatch(rule, splits[_i2], context, true);
@@ -81024,61 +80924,61 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
throw new Error("Symbol in rule has 0 length...!?");
}
if (SUPPORTED_CONSTANTS[rule.name]) {
- if (rule.name !== node2.name) {
+ if (rule.name !== node.name) {
return [];
}
} else {
switch (rule.name[1] >= "a" && rule.name[1] <= "z" ? rule.name.substring(0, 2) : rule.name[0]) {
case "n":
case "_p":
- res[0].placeholders[rule.name] = node2;
+ res[0].placeholders[rule.name] = node;
break;
case "c":
case "cl":
- if (isConstantNode(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (isConstantNode(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
break;
case "v":
- if (!isConstantNode(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (!isConstantNode(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
break;
case "vl":
- if (isSymbolNode(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (isSymbolNode(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
break;
case "cd":
- if (isNumericNode(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (isNumericNode(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
break;
case "vd":
- if (!isNumericNode(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (!isNumericNode(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
break;
case "ce":
- if (isConstantExpression(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (isConstantExpression(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
break;
case "ve":
- if (!isConstantExpression(node2)) {
- res[0].placeholders[rule.name] = node2;
+ if (!isConstantExpression(node)) {
+ res[0].placeholders[rule.name] = node;
} else {
return [];
}
@@ -81088,7 +80988,7 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
}
}
} else if (rule instanceof ConstantNode3) {
- if (!equal2(rule.value, node2.value)) {
+ if (!equal2(rule.value, node.value)) {
return [];
}
} else {
@@ -81096,30 +80996,30 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) =>
}
return res;
}
- function _exactMatch(p2, q2) {
- if (p2 instanceof ConstantNode3 && q2 instanceof ConstantNode3) {
- if (!equal2(p2.value, q2.value)) {
+ function _exactMatch(p, q2) {
+ if (p instanceof ConstantNode3 && q2 instanceof ConstantNode3) {
+ if (!equal2(p.value, q2.value)) {
return false;
}
- } else if (p2 instanceof SymbolNode2 && q2 instanceof SymbolNode2) {
- if (p2.name !== q2.name) {
+ } else if (p instanceof SymbolNode2 && q2 instanceof SymbolNode2) {
+ if (p.name !== q2.name) {
return false;
}
- } else if (p2 instanceof OperatorNode2 && q2 instanceof OperatorNode2 || p2 instanceof FunctionNode3 && q2 instanceof FunctionNode3) {
- if (p2 instanceof OperatorNode2) {
- if (p2.op !== q2.op || p2.fn !== q2.fn) {
+ } else if (p instanceof OperatorNode2 && q2 instanceof OperatorNode2 || p instanceof FunctionNode3 && q2 instanceof FunctionNode3) {
+ if (p instanceof OperatorNode2) {
+ if (p.op !== q2.op || p.fn !== q2.fn) {
return false;
}
- } else if (p2 instanceof FunctionNode3) {
- if (p2.name !== q2.name) {
+ } else if (p instanceof FunctionNode3) {
+ if (p.name !== q2.name) {
return false;
}
}
- if (p2.args.length !== q2.args.length) {
+ if (p.args.length !== q2.args.length) {
return false;
}
- for (var i4 = 0; i4 < p2.args.length; i4++) {
- if (!_exactMatch(p2.args[i4], q2.args[i4])) {
+ for (var i4 = 0; i4 < p.args.length; i4++) {
+ if (!_exactMatch(p.args[i4], q2.args[i4])) {
return false;
}
}
@@ -81162,7 +81062,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
SymbolNode: SymbolNode2
});
var simplifyConstant2 = typed3("simplifyConstant", {
- Node: (node2) => _ensureNode(foldFraction(node2, {})),
+ Node: (node) => _ensureNode(foldFraction(node, {})),
"Node, Object": function NodeObject(expr, options) {
return _ensureNode(foldFraction(expr, options));
}
@@ -81182,14 +81082,14 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
function _eval(fnname, args, options) {
try {
return mathWithTransform2[fnname].apply(null, args);
- } catch (ignore3) {
+ } catch (ignore2) {
args = args.map(_removeFractions);
return _toNumber(mathWithTransform2[fnname].apply(null, args), options);
}
}
var _toNode = typed3({
Fraction: _fractionToNode,
- number: function number5(n3) {
+ number: function number4(n3) {
if (n3 < 0) {
return unaryMinusNode(new ConstantNode3(-n3));
}
@@ -81204,7 +81104,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
Complex: function Complex3(s4) {
throw new Error("Cannot convert Complex number to Node");
},
- string: function string6(s4) {
+ string: function string4(s4) {
return new ConstantNode3(s4);
},
Matrix: function Matrix2(m4) {
@@ -81283,12 +81183,12 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
}
return new OperatorNode2("/", "divide", [n3, new ConstantNode3(f2.d)]);
}
- function _foldAccessor(obj, index3, options) {
- if (!isIndexNode(index3)) {
- return new AccessorNode2(_ensureNode(obj), _ensureNode(index3));
+ function _foldAccessor(obj, index2, options) {
+ if (!isIndexNode(index2)) {
+ return new AccessorNode2(_ensureNode(obj), _ensureNode(index2));
}
if (isArrayNode(obj) || isMatrix(obj)) {
- var remainingDims = Array.from(index3.dimensions);
+ var remainingDims = Array.from(index2.dimensions);
while (remainingDims.length > 0) {
if (isConstantNode(remainingDims[0]) && typeof remainingDims[0].value !== "string") {
var first = _toNumber(remainingDims.shift().value, options);
@@ -81327,23 +81227,23 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
break;
}
}
- if (remainingDims.length === index3.dimensions.length) {
- return new AccessorNode2(_ensureNode(obj), index3);
+ if (remainingDims.length === index2.dimensions.length) {
+ return new AccessorNode2(_ensureNode(obj), index2);
}
if (remainingDims.length > 0) {
- index3 = new IndexNode2(remainingDims);
- return new AccessorNode2(_ensureNode(obj), index3);
+ index2 = new IndexNode2(remainingDims);
+ return new AccessorNode2(_ensureNode(obj), index2);
}
return obj;
}
- if (isObjectNode(obj) && index3.dimensions.length === 1 && isConstantNode(index3.dimensions[0])) {
- var key3 = index3.dimensions[0].value;
- if (key3 in obj.properties) {
- return obj.properties[key3];
+ if (isObjectNode(obj) && index2.dimensions.length === 1 && isConstantNode(index2.dimensions[0])) {
+ var key2 = index2.dimensions[0].value;
+ if (key2 in obj.properties) {
+ return obj.properties[key2];
}
return new ConstantNode3();
}
- return new AccessorNode2(_ensureNode(obj), index3);
+ return new AccessorNode2(_ensureNode(obj), index2);
}
function foldOp(fn, args, makeNode, options) {
var first = args.shift();
@@ -81369,36 +81269,36 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
}
return makeNode([reduction[0], _toNode(reduction[1])]);
}
- function foldFraction(node2, options) {
- switch (node2.type) {
+ function foldFraction(node, options) {
+ switch (node.type) {
case "SymbolNode":
- return node2;
+ return node;
case "ConstantNode":
- switch (typeof node2.value) {
+ switch (typeof node.value) {
case "number":
- return _toNumber(node2.value, options);
+ return _toNumber(node.value, options);
case "string":
- return node2.value;
+ return node.value;
default:
- if (!isNaN(node2.value))
- return _toNumber(node2.value, options);
+ if (!isNaN(node.value))
+ return _toNumber(node.value, options);
}
- return node2;
+ return node;
case "FunctionNode":
- if (mathWithTransform2[node2.name] && mathWithTransform2[node2.name].rawArgs) {
- return node2;
+ if (mathWithTransform2[node.name] && mathWithTransform2[node.name].rawArgs) {
+ return node;
}
{
var operatorFunctions = ["add", "multiply"];
- if (operatorFunctions.indexOf(node2.name) === -1) {
- var args = node2.args.map((arg2) => foldFraction(arg2, options));
+ if (operatorFunctions.indexOf(node.name) === -1) {
+ var args = node.args.map((arg2) => foldFraction(arg2, options));
if (!args.some(isNode2)) {
try {
- return _eval(node2.name, args, options);
+ return _eval(node.name, args, options);
} catch (ignoreandcontinue) {
}
}
- if (node2.name === "size" && args.length === 1 && isArrayNode(args[0])) {
+ if (node.name === "size" && args.length === 1 && isArrayNode(args[0])) {
var sz = [];
var section = args[0];
while (isArrayNode(section)) {
@@ -81407,24 +81307,24 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
}
return matrix2(sz);
}
- return new FunctionNode3(node2.name, args.map(_ensureNode));
+ return new FunctionNode3(node.name, args.map(_ensureNode));
} else {
}
}
case "OperatorNode": {
- var fn = node2.fn.toString();
+ var fn = node.fn.toString();
var _args;
var res;
- var makeNode = createMakeNodeFunction(node2);
- if (isOperatorNode(node2) && node2.isUnary()) {
- _args = [foldFraction(node2.args[0], options)];
+ var makeNode = createMakeNodeFunction(node);
+ if (isOperatorNode(node) && node.isUnary()) {
+ _args = [foldFraction(node.args[0], options)];
if (!isNode2(_args[0])) {
res = _eval(fn, _args, options);
} else {
res = makeNode(_args);
}
- } else if (isAssociative(node2, options.context)) {
- _args = allChildren(node2, options.context);
+ } else if (isAssociative(node, options.context)) {
+ _args = allChildren(node, options.context);
_args = _args.map((arg2) => foldFraction(arg2, options));
if (isCommutative(fn, options.context)) {
var consts = [];
@@ -81447,29 +81347,29 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
res = foldOp(fn, _args, makeNode, options);
}
} else {
- _args = node2.args.map((arg2) => foldFraction(arg2, options));
+ _args = node.args.map((arg2) => foldFraction(arg2, options));
res = foldOp(fn, _args, makeNode, options);
}
return res;
}
case "ParenthesisNode":
- return foldFraction(node2.content, options);
+ return foldFraction(node.content, options);
case "AccessorNode":
- return _foldAccessor(foldFraction(node2.object, options), foldFraction(node2.index, options), options);
+ return _foldAccessor(foldFraction(node.object, options), foldFraction(node.index, options), options);
case "ArrayNode": {
- var foldItems = node2.items.map((item) => foldFraction(item, options));
+ var foldItems = node.items.map((item) => foldFraction(item, options));
if (foldItems.some(isNode2)) {
return new ArrayNode2(foldItems.map(_ensureNode));
}
return matrix2(foldItems);
}
case "IndexNode": {
- return new IndexNode2(node2.dimensions.map((n3) => simplifyConstant2(n3, options)));
+ return new IndexNode2(node.dimensions.map((n3) => simplifyConstant2(n3, options)));
}
case "ObjectNode": {
var foldProps = {};
- for (var prop2 in node2.properties) {
- foldProps[prop2] = simplifyConstant2(node2.properties[prop2], options);
+ for (var prop2 in node.properties) {
+ foldProps[prop2] = simplifyConstant2(node.properties[prop2], options);
}
return new ObjectNode2(foldProps);
}
@@ -81479,7 +81379,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, (
case "RangeNode":
case "ConditionalNode":
default:
- throw new Error("Unimplemented node type in simplifyConstant: ".concat(node2.type));
+ throw new Error("Unimplemented node type in simplifyConstant: ".concat(node.type));
}
}
return simplifyConstant2;
@@ -81491,7 +81391,7 @@ var dependencies281 = ["typed", "parse", "equal", "isZero", "add", "subtract", "
var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref) => {
var {
typed: typed3,
- parse: parse8,
+ parse: parse7,
equal: equal2,
isZero: isZero2,
add: add4,
@@ -81513,8 +81413,8 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
var node1 = new ConstantNode3(1);
var nodeT = new ConstantNode3(true);
var nodeF = new ConstantNode3(false);
- function isAlwaysBoolean(node2) {
- return isOperatorNode(node2) && ["and", "not", "or"].includes(node2.op);
+ function isAlwaysBoolean(node) {
+ return isOperatorNode(node) && ["and", "not", "or"].includes(node.op);
}
var {
hasProperty,
@@ -81543,30 +81443,30 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
return simpChild;
}
}
- var node2 = nodeToSimplify;
- if (isFunctionNode(node2)) {
- var op = getOperator(node2.name);
+ var node = nodeToSimplify;
+ if (isFunctionNode(node)) {
+ var op = getOperator(node.name);
if (op) {
- if (node2.args.length > 2 && hasProperty(node2, "associative", context)) {
- while (node2.args.length > 2) {
- var last = node2.args.pop();
- var seclast = node2.args.pop();
- node2.args.push(new OperatorNode2(op, node2.name, [last, seclast]));
+ if (node.args.length > 2 && hasProperty(node, "associative", context)) {
+ while (node.args.length > 2) {
+ var last = node.args.pop();
+ var seclast = node.args.pop();
+ node.args.push(new OperatorNode2(op, node.name, [last, seclast]));
}
}
- node2 = new OperatorNode2(op, node2.name, node2.args);
+ node = new OperatorNode2(op, node.name, node.args);
} else {
- return new FunctionNode3(_simplifyCore(node2.fn), node2.args.map((n3) => _simplifyCore(n3, options)));
+ return new FunctionNode3(_simplifyCore(node.fn), node.args.map((n3) => _simplifyCore(n3, options)));
}
}
- if (isOperatorNode(node2) && node2.isUnary()) {
- var a0 = _simplifyCore(node2.args[0], options);
- if (node2.op === "~") {
+ if (isOperatorNode(node) && node.isUnary()) {
+ var a0 = _simplifyCore(node.args[0], options);
+ if (node.op === "~") {
if (isOperatorNode(a0) && a0.isUnary() && a0.op === "~") {
return a0.args[0];
}
}
- if (node2.op === "not") {
+ if (node.op === "not") {
if (isOperatorNode(a0) && a0.isUnary() && a0.op === "not") {
if (isAlwaysBoolean(a0.args[0])) {
return a0.args[0];
@@ -81574,10 +81474,10 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
}
}
var finish = true;
- if (node2.op === "-") {
+ if (node.op === "-") {
if (isOperatorNode(a0)) {
if (a0.isBinary() && a0.fn === "subtract") {
- node2 = new OperatorNode2("-", "subtract", [a0.args[1], a0.args[0]]);
+ node = new OperatorNode2("-", "subtract", [a0.args[1], a0.args[0]]);
finish = false;
}
if (a0.isUnary() && a0.op === "-") {
@@ -81586,12 +81486,12 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
}
}
if (finish)
- return new OperatorNode2(node2.op, node2.fn, [a0]);
+ return new OperatorNode2(node.op, node.fn, [a0]);
}
- if (isOperatorNode(node2) && node2.isBinary()) {
- var _a = _simplifyCore(node2.args[0], options);
- var a1 = _simplifyCore(node2.args[1], options);
- if (node2.op === "+") {
+ if (isOperatorNode(node) && node.isBinary()) {
+ var _a = _simplifyCore(node.args[0], options);
+ var a1 = _simplifyCore(node.args[1], options);
+ if (node.op === "+") {
if (isConstantNode(_a) && isZero2(_a.value)) {
return a1;
}
@@ -81600,10 +81500,10 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
}
if (isOperatorNode(a1) && a1.isUnary() && a1.op === "-") {
a1 = a1.args[0];
- node2 = new OperatorNode2("-", "subtract", [_a, a1]);
+ node = new OperatorNode2("-", "subtract", [_a, a1]);
}
}
- if (node2.op === "-") {
+ if (node.op === "-") {
if (isOperatorNode(a1) && a1.isUnary() && a1.op === "-") {
return _simplifyCore(new OperatorNode2("+", "add", [_a, a1.args[0]]), options);
}
@@ -81613,9 +81513,9 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
if (isConstantNode(a1) && isZero2(a1.value)) {
return _a;
}
- return new OperatorNode2(node2.op, node2.fn, [_a, a1]);
+ return new OperatorNode2(node.op, node.fn, [_a, a1]);
}
- if (node2.op === "*") {
+ if (node.op === "*") {
if (isConstantNode(_a)) {
if (isZero2(_a.value)) {
return node0;
@@ -81629,22 +81529,22 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
} else if (equal2(a1.value, 1)) {
return _a;
}
- if (isCommutative(node2, context)) {
- return new OperatorNode2(node2.op, node2.fn, [a1, _a], node2.implicit);
+ if (isCommutative(node, context)) {
+ return new OperatorNode2(node.op, node.fn, [a1, _a], node.implicit);
}
}
- return new OperatorNode2(node2.op, node2.fn, [_a, a1], node2.implicit);
+ return new OperatorNode2(node.op, node.fn, [_a, a1], node.implicit);
}
- if (node2.op === "/") {
+ if (node.op === "/") {
if (isConstantNode(_a) && isZero2(_a.value)) {
return node0;
}
if (isConstantNode(a1) && equal2(a1.value, 1)) {
return _a;
}
- return new OperatorNode2(node2.op, node2.fn, [_a, a1]);
+ return new OperatorNode2(node.op, node.fn, [_a, a1]);
}
- if (node2.op === "^") {
+ if (node.op === "^") {
if (isConstantNode(a1)) {
if (isZero2(a1.value)) {
return node1;
@@ -81653,7 +81553,7 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
}
}
}
- if (node2.op === "and") {
+ if (node.op === "and") {
if (isConstantNode(_a)) {
if (_a.value) {
if (isAlwaysBoolean(a1))
@@ -81674,7 +81574,7 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
}
}
}
- if (node2.op === "or") {
+ if (node.op === "or") {
if (isConstantNode(_a)) {
if (_a.value) {
return nodeT;
@@ -81692,28 +81592,28 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref
}
}
}
- return new OperatorNode2(node2.op, node2.fn, [_a, a1]);
+ return new OperatorNode2(node.op, node.fn, [_a, a1]);
}
- if (isOperatorNode(node2)) {
- return new OperatorNode2(node2.op, node2.fn, node2.args.map((a4) => _simplifyCore(a4, options)));
+ if (isOperatorNode(node)) {
+ return new OperatorNode2(node.op, node.fn, node.args.map((a4) => _simplifyCore(a4, options)));
}
- if (isArrayNode(node2)) {
- return new ArrayNode2(node2.items.map((n3) => _simplifyCore(n3, options)));
+ if (isArrayNode(node)) {
+ return new ArrayNode2(node.items.map((n3) => _simplifyCore(n3, options)));
}
- if (isAccessorNode(node2)) {
- return new AccessorNode2(_simplifyCore(node2.object, options), _simplifyCore(node2.index, options));
+ if (isAccessorNode(node)) {
+ return new AccessorNode2(_simplifyCore(node.object, options), _simplifyCore(node.index, options));
}
- if (isIndexNode(node2)) {
- return new IndexNode2(node2.dimensions.map((n3) => _simplifyCore(n3, options)));
+ if (isIndexNode(node)) {
+ return new IndexNode2(node.dimensions.map((n3) => _simplifyCore(n3, options)));
}
- if (isObjectNode(node2)) {
+ if (isObjectNode(node)) {
var newProps = {};
- for (var prop2 in node2.properties) {
- newProps[prop2] = _simplifyCore(node2.properties[prop2], options);
+ for (var prop2 in node.properties) {
+ newProps[prop2] = _simplifyCore(node.properties[prop2], options);
}
return new ObjectNode2(newProps);
}
- return node2;
+ return node;
}
return typed3(name282, {
Node: _simplifyCore,
@@ -81727,48 +81627,48 @@ var dependencies282 = ["typed", "parse", "ConstantNode", "FunctionNode", "Operat
var createResolve = /* @__PURE__ */ factory(name283, dependencies282, (_ref) => {
var {
typed: typed3,
- parse: parse8,
+ parse: parse7,
ConstantNode: ConstantNode3,
FunctionNode: FunctionNode3,
OperatorNode: OperatorNode2,
ParenthesisNode: ParenthesisNode2
} = _ref;
- function _resolve(node2, scope) {
+ function _resolve(node, scope) {
var within = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new Set();
if (!scope) {
- return node2;
+ return node;
}
- if (isSymbolNode(node2)) {
- if (within.has(node2.name)) {
+ if (isSymbolNode(node)) {
+ if (within.has(node.name)) {
var variables = Array.from(within).join(", ");
throw new ReferenceError("recursive loop of variable definitions among {".concat(variables, "}"));
}
- var value = scope.get(node2.name);
+ var value = scope.get(node.name);
if (isNode2(value)) {
var nextWithin = new Set(within);
- nextWithin.add(node2.name);
+ nextWithin.add(node.name);
return _resolve(value, scope, nextWithin);
} else if (typeof value === "number") {
- return parse8(String(value));
+ return parse7(String(value));
} else if (value !== void 0) {
return new ConstantNode3(value);
} else {
- return node2;
+ return node;
}
- } else if (isOperatorNode(node2)) {
- var args = node2.args.map(function(arg2) {
+ } else if (isOperatorNode(node)) {
+ var args = node.args.map(function(arg2) {
return _resolve(arg2, scope, within);
});
- return new OperatorNode2(node2.op, node2.fn, args, node2.implicit);
- } else if (isParenthesisNode(node2)) {
- return new ParenthesisNode2(_resolve(node2.content, scope, within));
- } else if (isFunctionNode(node2)) {
- var _args = node2.args.map(function(arg2) {
+ return new OperatorNode2(node.op, node.fn, args, node.implicit);
+ } else if (isParenthesisNode(node)) {
+ return new ParenthesisNode2(_resolve(node.content, scope, within));
+ } else if (isFunctionNode(node)) {
+ var _args = node.args.map(function(arg2) {
return _resolve(arg2, scope, within);
});
- return new FunctionNode3(node2.name, _args);
+ return new FunctionNode3(node.name, _args);
}
- return node2.map((child) => _resolve(child, scope, within));
+ return node.map((child) => _resolve(child, scope, within));
}
return typed3("resolve", {
Node: _resolve,
@@ -81787,7 +81687,7 @@ var name284 = "symbolicEqual";
var dependencies283 = ["parse", "simplify", "typed", "OperatorNode"];
var createSymbolicEqual = /* @__PURE__ */ factory(name284, dependencies283, (_ref) => {
var {
- parse: parse8,
+ parse: parse7,
simplify: simplify2,
typed: typed3,
OperatorNode: OperatorNode2
@@ -81811,7 +81711,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
var {
typed: typed3,
config: config4,
- parse: parse8,
+ parse: parse7,
simplify: simplify2,
equal: equal2,
isZero: isZero2,
@@ -81834,7 +81734,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
typed3.addConversion({
from: "identifier",
to: "SymbolNode",
- convert: parse8
+ convert: parse7
});
var derivative2 = typed3(name285, {
"Node, SymbolNode": plainDerivative,
@@ -81843,7 +81743,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
typed3.removeConversion({
from: "identifier",
to: "SymbolNode",
- convert: parse8
+ convert: parse7
});
derivative2._simplify = true;
derivative2.toTex = function(deriv) {
@@ -81852,61 +81752,61 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
var _derivTex = typed3("_derivTex", {
"Node, SymbolNode": function NodeSymbolNode(expr, x2) {
if (isConstantNode(expr) && typeOf(expr.value) === "string") {
- return _derivTex(parse8(expr.value).toString(), x2.toString(), 1);
+ return _derivTex(parse7(expr.value).toString(), x2.toString(), 1);
} else {
return _derivTex(expr.toTex(), x2.toString(), 1);
}
},
"Node, ConstantNode": function NodeConstantNode(expr, x2) {
if (typeOf(x2.value) === "string") {
- return _derivTex(expr, parse8(x2.value));
+ return _derivTex(expr, parse7(x2.value));
} else {
throw new Error("The second parameter to 'derivative' is a non-string constant");
}
},
- "Node, SymbolNode, ConstantNode": function NodeSymbolNodeConstantNode(expr, x2, order2) {
- return _derivTex(expr.toString(), x2.name, order2.value);
+ "Node, SymbolNode, ConstantNode": function NodeSymbolNodeConstantNode(expr, x2, order) {
+ return _derivTex(expr.toString(), x2.name, order.value);
},
- "string, string, number": function stringStringNumber(expr, x2, order2) {
+ "string, string, number": function stringStringNumber(expr, x2, order) {
var d4;
- if (order2 === 1) {
+ if (order === 1) {
d4 = "{d\\over d" + x2 + "}";
} else {
- d4 = "{d^{" + order2 + "}\\over d" + x2 + "^{" + order2 + "}}";
+ d4 = "{d^{" + order + "}\\over d" + x2 + "^{" + order + "}}";
}
return d4 + "\\left[".concat(expr, "\\right]");
}
});
var constTag = typed3("constTag", {
- "Object, ConstantNode, string": function ObjectConstantNodeString(constNodes, node2) {
- constNodes[node2] = true;
+ "Object, ConstantNode, string": function ObjectConstantNodeString(constNodes, node) {
+ constNodes[node] = true;
return true;
},
- "Object, SymbolNode, string": function ObjectSymbolNodeString(constNodes, node2, varName) {
- if (node2.name !== varName) {
- constNodes[node2] = true;
+ "Object, SymbolNode, string": function ObjectSymbolNodeString(constNodes, node, varName) {
+ if (node.name !== varName) {
+ constNodes[node] = true;
return true;
}
return false;
},
- "Object, ParenthesisNode, string": function ObjectParenthesisNodeString(constNodes, node2, varName) {
- return constTag(constNodes, node2.content, varName);
+ "Object, ParenthesisNode, string": function ObjectParenthesisNodeString(constNodes, node, varName) {
+ return constTag(constNodes, node.content, varName);
},
- "Object, FunctionAssignmentNode, string": function ObjectFunctionAssignmentNodeString(constNodes, node2, varName) {
- if (node2.params.indexOf(varName) === -1) {
- constNodes[node2] = true;
+ "Object, FunctionAssignmentNode, string": function ObjectFunctionAssignmentNodeString(constNodes, node, varName) {
+ if (node.params.indexOf(varName) === -1) {
+ constNodes[node] = true;
return true;
}
- return constTag(constNodes, node2.expr, varName);
+ return constTag(constNodes, node.expr, varName);
},
- "Object, FunctionNode | OperatorNode, string": function ObjectFunctionNodeOperatorNodeString(constNodes, node2, varName) {
- if (node2.args.length > 0) {
- var isConst = constTag(constNodes, node2.args[0], varName);
- for (var i4 = 1; i4 < node2.args.length; ++i4) {
- isConst = constTag(constNodes, node2.args[i4], varName) && isConst;
+ "Object, FunctionNode | OperatorNode, string": function ObjectFunctionNodeOperatorNodeString(constNodes, node, varName) {
+ if (node.args.length > 0) {
+ var isConst = constTag(constNodes, node.args[0], varName);
+ for (var i4 = 1; i4 < node.args.length; ++i4) {
+ isConst = constTag(constNodes, node.args[i4], varName) && isConst;
}
if (isConst) {
- constNodes[node2] = true;
+ constNodes[node] = true;
return true;
}
}
@@ -81914,66 +81814,66 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
}
});
var _derivative = typed3("_derivative", {
- "ConstantNode, Object": function ConstantNodeObject(node2) {
+ "ConstantNode, Object": function ConstantNodeObject(node) {
return createConstantNode2(0);
},
- "SymbolNode, Object": function SymbolNodeObject(node2, constNodes) {
- if (constNodes[node2] !== void 0) {
+ "SymbolNode, Object": function SymbolNodeObject(node, constNodes) {
+ if (constNodes[node] !== void 0) {
return createConstantNode2(0);
}
return createConstantNode2(1);
},
- "ParenthesisNode, Object": function ParenthesisNodeObject(node2, constNodes) {
- return new ParenthesisNode2(_derivative(node2.content, constNodes));
+ "ParenthesisNode, Object": function ParenthesisNodeObject(node, constNodes) {
+ return new ParenthesisNode2(_derivative(node.content, constNodes));
},
- "FunctionAssignmentNode, Object": function FunctionAssignmentNodeObject(node2, constNodes) {
- if (constNodes[node2] !== void 0) {
+ "FunctionAssignmentNode, Object": function FunctionAssignmentNodeObject(node, constNodes) {
+ if (constNodes[node] !== void 0) {
return createConstantNode2(0);
}
- return _derivative(node2.expr, constNodes);
+ return _derivative(node.expr, constNodes);
},
- "FunctionNode, Object": function FunctionNodeObject(node2, constNodes) {
- if (constNodes[node2] !== void 0) {
+ "FunctionNode, Object": function FunctionNodeObject(node, constNodes) {
+ if (constNodes[node] !== void 0) {
return createConstantNode2(0);
}
- var arg0 = node2.args[0];
+ var arg0 = node.args[0];
var arg1;
var div2 = false;
var negative = false;
var funcDerivative;
- switch (node2.name) {
+ switch (node.name) {
case "cbrt":
div2 = true;
funcDerivative = new OperatorNode2("*", "multiply", [createConstantNode2(3), new OperatorNode2("^", "pow", [arg0, new OperatorNode2("/", "divide", [createConstantNode2(2), createConstantNode2(3)])])]);
break;
case "sqrt":
case "nthRoot":
- if (node2.args.length === 1) {
+ if (node.args.length === 1) {
div2 = true;
funcDerivative = new OperatorNode2("*", "multiply", [createConstantNode2(2), new FunctionNode3("sqrt", [arg0])]);
- } else if (node2.args.length === 2) {
- arg1 = new OperatorNode2("/", "divide", [createConstantNode2(1), node2.args[1]]);
- constNodes[arg1] = constNodes[node2.args[1]];
+ } else if (node.args.length === 2) {
+ arg1 = new OperatorNode2("/", "divide", [createConstantNode2(1), node.args[1]]);
+ constNodes[arg1] = constNodes[node.args[1]];
return _derivative(new OperatorNode2("^", "pow", [arg0, arg1]), constNodes);
}
break;
case "log10":
arg1 = createConstantNode2(10);
case "log":
- if (!arg1 && node2.args.length === 1) {
+ if (!arg1 && node.args.length === 1) {
funcDerivative = arg0.clone();
div2 = true;
- } else if (node2.args.length === 1 && arg1 || node2.args.length === 2 && constNodes[node2.args[1]] !== void 0) {
- funcDerivative = new OperatorNode2("*", "multiply", [arg0.clone(), new FunctionNode3("log", [arg1 || node2.args[1]])]);
+ } else if (node.args.length === 1 && arg1 || node.args.length === 2 && constNodes[node.args[1]] !== void 0) {
+ funcDerivative = new OperatorNode2("*", "multiply", [arg0.clone(), new FunctionNode3("log", [arg1 || node.args[1]])]);
div2 = true;
- } else if (node2.args.length === 2) {
- return _derivative(new OperatorNode2("/", "divide", [new FunctionNode3("log", [arg0]), new FunctionNode3("log", [node2.args[1]])]), constNodes);
+ } else if (node.args.length === 2) {
+ return _derivative(new OperatorNode2("/", "divide", [new FunctionNode3("log", [arg0]), new FunctionNode3("log", [node.args[1]])]), constNodes);
}
break;
case "pow":
- if (node2.args.length === 2) {
- constNodes[arg1] = constNodes[node2.args[1]];
- return _derivative(new OperatorNode2("^", "pow", [arg0, node2.args[1]]), constNodes);
+ if (node.args.length === 2) {
+ constNodes[arg1] = constNodes[node.args[1]];
+ return _derivative(new OperatorNode2("^", "pow", [arg0, node.args[1]]), constNodes);
}
break;
case "exp":
@@ -81989,11 +81889,11 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
funcDerivative = new OperatorNode2("^", "pow", [new FunctionNode3("sec", [arg0.clone()]), createConstantNode2(2)]);
break;
case "sec":
- funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("tan", [arg0.clone()])]);
+ funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("tan", [arg0.clone()])]);
break;
case "csc":
negative = true;
- funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("cot", [arg0.clone()])]);
+ funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("cot", [arg0.clone()])]);
break;
case "cot":
negative = true;
@@ -82037,11 +81937,11 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
break;
case "sech":
negative = true;
- funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("tanh", [arg0.clone()])]);
+ funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("tanh", [arg0.clone()])]);
break;
case "csch":
negative = true;
- funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("coth", [arg0.clone()])]);
+ funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("coth", [arg0.clone()])]);
break;
case "coth":
negative = true;
@@ -82079,7 +81979,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
break;
case "gamma":
default:
- throw new Error('Cannot process function "' + node2.name + '" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported');
+ throw new Error('Cannot process function "' + node.name + '" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported');
}
var op, func;
if (div2) {
@@ -82095,44 +81995,44 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
}
return new OperatorNode2(op, func, [chainDerivative, funcDerivative]);
},
- "OperatorNode, Object": function OperatorNodeObject(node2, constNodes) {
- if (constNodes[node2] !== void 0) {
+ "OperatorNode, Object": function OperatorNodeObject(node, constNodes) {
+ if (constNodes[node] !== void 0) {
return createConstantNode2(0);
}
- if (node2.op === "+") {
- return new OperatorNode2(node2.op, node2.fn, node2.args.map(function(arg2) {
+ if (node.op === "+") {
+ return new OperatorNode2(node.op, node.fn, node.args.map(function(arg2) {
return _derivative(arg2, constNodes);
}));
}
- if (node2.op === "-") {
- if (node2.isUnary()) {
- return new OperatorNode2(node2.op, node2.fn, [_derivative(node2.args[0], constNodes)]);
+ if (node.op === "-") {
+ if (node.isUnary()) {
+ return new OperatorNode2(node.op, node.fn, [_derivative(node.args[0], constNodes)]);
}
- if (node2.isBinary()) {
- return new OperatorNode2(node2.op, node2.fn, [_derivative(node2.args[0], constNodes), _derivative(node2.args[1], constNodes)]);
+ if (node.isBinary()) {
+ return new OperatorNode2(node.op, node.fn, [_derivative(node.args[0], constNodes), _derivative(node.args[1], constNodes)]);
}
}
- if (node2.op === "*") {
- var constantTerms = node2.args.filter(function(arg2) {
+ if (node.op === "*") {
+ var constantTerms = node.args.filter(function(arg2) {
return constNodes[arg2] !== void 0;
});
if (constantTerms.length > 0) {
- var nonConstantTerms = node2.args.filter(function(arg2) {
+ var nonConstantTerms = node.args.filter(function(arg2) {
return constNodes[arg2] === void 0;
});
var nonConstantNode = nonConstantTerms.length === 1 ? nonConstantTerms[0] : new OperatorNode2("*", "multiply", nonConstantTerms);
var newArgs = constantTerms.concat(_derivative(nonConstantNode, constNodes));
return new OperatorNode2("*", "multiply", newArgs);
}
- return new OperatorNode2("+", "add", node2.args.map(function(argOuter) {
- return new OperatorNode2("*", "multiply", node2.args.map(function(argInner) {
+ return new OperatorNode2("+", "add", node.args.map(function(argOuter) {
+ return new OperatorNode2("*", "multiply", node.args.map(function(argInner) {
return argInner === argOuter ? _derivative(argInner, constNodes) : argInner.clone();
}));
}));
}
- if (node2.op === "/" && node2.isBinary()) {
- var arg0 = node2.args[0];
- var arg1 = node2.args[1];
+ if (node.op === "/" && node.isBinary()) {
+ var arg0 = node.args[0];
+ var arg1 = node.args[1];
if (constNodes[arg1] !== void 0) {
return new OperatorNode2("/", "divide", [_derivative(arg0, constNodes), arg1]);
}
@@ -82141,14 +82041,14 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
}
return new OperatorNode2("/", "divide", [new OperatorNode2("-", "subtract", [new OperatorNode2("*", "multiply", [_derivative(arg0, constNodes), arg1.clone()]), new OperatorNode2("*", "multiply", [arg0.clone(), _derivative(arg1, constNodes)])]), new OperatorNode2("^", "pow", [arg1.clone(), createConstantNode2(2)])]);
}
- if (node2.op === "^" && node2.isBinary()) {
- var _arg = node2.args[0];
- var _arg2 = node2.args[1];
+ if (node.op === "^" && node.isBinary()) {
+ var _arg = node.args[0];
+ var _arg2 = node.args[1];
if (constNodes[_arg] !== void 0) {
if (isConstantNode(_arg) && (isZero2(_arg.value) || equal2(_arg.value, 1))) {
return createConstantNode2(0);
}
- return new OperatorNode2("*", "multiply", [node2, new OperatorNode2("*", "multiply", [new FunctionNode3("log", [_arg.clone()]), _derivative(_arg2.clone(), constNodes)])]);
+ return new OperatorNode2("*", "multiply", [node, new OperatorNode2("*", "multiply", [new FunctionNode3("log", [_arg.clone()]), _derivative(_arg2.clone(), constNodes)])]);
}
if (constNodes[_arg2] !== void 0) {
if (isConstantNode(_arg2)) {
@@ -82164,7 +82064,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref)
}
return new OperatorNode2("*", "multiply", [new OperatorNode2("^", "pow", [_arg.clone(), _arg2.clone()]), new OperatorNode2("+", "add", [new OperatorNode2("*", "multiply", [_derivative(_arg, constNodes), new OperatorNode2("/", "divide", [_arg2.clone(), _arg.clone()])]), new OperatorNode2("*", "multiply", [_derivative(_arg2, constNodes), new FunctionNode3("log", [_arg.clone()])])])]);
}
- throw new Error('Cannot process operator "' + node2.op + '" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported');
+ throw new Error('Cannot process operator "' + node.op + '" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported');
}
});
function createConstantNode2(value, valueType) {
@@ -82187,7 +82087,7 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref)
multiply: multiply2,
divide: divide3,
pow: pow3,
- parse: parse8,
+ parse: parse7,
simplifyConstant: simplifyConstant2,
simplifyCore: simplifyCore2,
simplify: simplify2,
@@ -82277,43 +82177,43 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref)
});
function polynomial(expr, scope, extended, rules) {
var variables = [];
- var node2 = simplify2(expr, rules, scope, {
+ var node = simplify2(expr, rules, scope, {
exactFractions: false
});
extended = !!extended;
var oper = "+-*" + (extended ? "/" : "");
- recPoly(node2);
+ recPoly(node);
var retFunc = {};
- retFunc.expression = node2;
+ retFunc.expression = node;
retFunc.variables = variables;
return retFunc;
- function recPoly(node3) {
- var tp = node3.type;
+ function recPoly(node2) {
+ var tp = node2.type;
if (tp === "FunctionNode") {
throw new Error("There is an unsolved function call");
} else if (tp === "OperatorNode") {
- if (node3.op === "^") {
- if (node3.args[1].type !== "ConstantNode" || !isInteger(parseFloat(node3.args[1].value))) {
+ if (node2.op === "^") {
+ if (node2.args[1].type !== "ConstantNode" || !isInteger(parseFloat(node2.args[1].value))) {
throw new Error("There is a non-integer exponent");
} else {
- recPoly(node3.args[0]);
+ recPoly(node2.args[0]);
}
} else {
- if (oper.indexOf(node3.op) === -1) {
- throw new Error("Operator " + node3.op + " invalid in polynomial expression");
+ if (oper.indexOf(node2.op) === -1) {
+ throw new Error("Operator " + node2.op + " invalid in polynomial expression");
}
- for (var i4 = 0; i4 < node3.args.length; i4++) {
- recPoly(node3.args[i4]);
+ for (var i4 = 0; i4 < node2.args.length; i4++) {
+ recPoly(node2.args[i4]);
}
}
} else if (tp === "SymbolNode") {
- var _name = node3.name;
+ var _name = node2.name;
var pos = variables.indexOf(_name);
if (pos === -1) {
variables.push(_name);
}
} else if (tp === "ParenthesisNode") {
- recPoly(node3.content);
+ recPoly(node2.content);
} else if (tp !== "ConstantNode") {
throw new Error("type " + tp + " is not allowed in polynomial expression");
}
@@ -82557,47 +82457,47 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref)
];
return setRules;
}
- function expandPower(node2, parent, indParent) {
- var tp = node2.type;
+ function expandPower(node, parent, indParent) {
+ var tp = node.type;
var internal = arguments.length > 1;
- if (tp === "OperatorNode" && node2.isBinary()) {
+ if (tp === "OperatorNode" && node.isBinary()) {
var does = false;
var val;
- if (node2.op === "^") {
- if ((node2.args[0].type === "ParenthesisNode" || node2.args[0].type === "OperatorNode") && node2.args[1].type === "ConstantNode") {
- val = parseFloat(node2.args[1].value);
+ if (node.op === "^") {
+ if ((node.args[0].type === "ParenthesisNode" || node.args[0].type === "OperatorNode") && node.args[1].type === "ConstantNode") {
+ val = parseFloat(node.args[1].value);
does = val >= 2 && isInteger(val);
}
}
if (does) {
if (val > 2) {
- var nEsqTopo = node2.args[0];
- var nDirTopo = new OperatorNode2("^", "pow", [node2.args[0].cloneDeep(), new ConstantNode3(val - 1)]);
- node2 = new OperatorNode2("*", "multiply", [nEsqTopo, nDirTopo]);
+ var nEsqTopo = node.args[0];
+ var nDirTopo = new OperatorNode2("^", "pow", [node.args[0].cloneDeep(), new ConstantNode3(val - 1)]);
+ node = new OperatorNode2("*", "multiply", [nEsqTopo, nDirTopo]);
} else {
- node2 = new OperatorNode2("*", "multiply", [node2.args[0], node2.args[0].cloneDeep()]);
+ node = new OperatorNode2("*", "multiply", [node.args[0], node.args[0].cloneDeep()]);
}
if (internal) {
if (indParent === "content") {
- parent.content = node2;
+ parent.content = node;
} else {
- parent.args[indParent] = node2;
+ parent.args[indParent] = node;
}
}
}
}
if (tp === "ParenthesisNode") {
- expandPower(node2.content, node2, "content");
+ expandPower(node.content, node, "content");
} else if (tp !== "ConstantNode" && tp !== "SymbolNode") {
- for (var i4 = 0; i4 < node2.args.length; i4++) {
- expandPower(node2.args[i4], node2, i4);
+ for (var i4 = 0; i4 < node.args.length; i4++) {
+ expandPower(node.args[i4], node, i4);
}
}
if (!internal) {
- return node2;
+ return node;
}
}
- function polyToCanonical(node2, coefficients) {
+ function polyToCanonical(node, coefficients) {
if (coefficients === void 0) {
coefficients = [];
}
@@ -82608,7 +82508,7 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref)
o2.fire = "";
var maxExpo = 0;
var varname = "";
- recurPol(node2, null, o2);
+ recurPol(node, null, o2);
maxExpo = coefficients.length - 1;
var first = true;
var no;
@@ -82645,43 +82545,43 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref)
} else {
return no;
}
- function recurPol(node3, noPai, o3) {
- var tp = node3.type;
+ function recurPol(node2, noPai, o3) {
+ var tp = node2.type;
if (tp === "FunctionNode") {
throw new Error("There is an unsolved function call");
} else if (tp === "OperatorNode") {
- if ("+-*^".indexOf(node3.op) === -1)
- throw new Error("Operator " + node3.op + " invalid");
+ if ("+-*^".indexOf(node2.op) === -1)
+ throw new Error("Operator " + node2.op + " invalid");
if (noPai !== null) {
- if ((node3.fn === "unaryMinus" || node3.fn === "pow") && noPai.fn !== "add" && noPai.fn !== "subtract" && noPai.fn !== "multiply") {
- throw new Error("Invalid " + node3.op + " placing");
+ if ((node2.fn === "unaryMinus" || node2.fn === "pow") && noPai.fn !== "add" && noPai.fn !== "subtract" && noPai.fn !== "multiply") {
+ throw new Error("Invalid " + node2.op + " placing");
}
- if ((node3.fn === "subtract" || node3.fn === "add" || node3.fn === "multiply") && noPai.fn !== "add" && noPai.fn !== "subtract") {
- throw new Error("Invalid " + node3.op + " placing");
+ if ((node2.fn === "subtract" || node2.fn === "add" || node2.fn === "multiply") && noPai.fn !== "add" && noPai.fn !== "subtract") {
+ throw new Error("Invalid " + node2.op + " placing");
}
- if ((node3.fn === "subtract" || node3.fn === "add" || node3.fn === "unaryMinus") && o3.noFil !== 0) {
- throw new Error("Invalid " + node3.op + " placing");
+ if ((node2.fn === "subtract" || node2.fn === "add" || node2.fn === "unaryMinus") && o3.noFil !== 0) {
+ throw new Error("Invalid " + node2.op + " placing");
}
}
- if (node3.op === "^" || node3.op === "*") {
- o3.fire = node3.op;
+ if (node2.op === "^" || node2.op === "*") {
+ o3.fire = node2.op;
}
- for (var _i = 0; _i < node3.args.length; _i++) {
- if (node3.fn === "unaryMinus")
+ for (var _i = 0; _i < node2.args.length; _i++) {
+ if (node2.fn === "unaryMinus")
o3.oper = "-";
- if (node3.op === "+" || node3.fn === "subtract") {
+ if (node2.op === "+" || node2.fn === "subtract") {
o3.fire = "";
o3.cte = 1;
- o3.oper = _i === 0 ? "+" : node3.op;
+ o3.oper = _i === 0 ? "+" : node2.op;
}
o3.noFil = _i;
- recurPol(node3.args[_i], node3, o3);
+ recurPol(node2.args[_i], node2, o3);
}
} else if (tp === "SymbolNode") {
- if (node3.name !== varname && varname !== "") {
+ if (node2.name !== varname && varname !== "") {
throw new Error("There is more than one variable");
}
- varname = node3.name;
+ varname = node2.name;
if (noPai === null) {
coefficients[1] = 1;
return;
@@ -82699,7 +82599,7 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref)
maxExpo = Math.max(1, maxExpo);
}
} else if (tp === "ConstantNode") {
- var valor = parseFloat(node3.value);
+ var valor = parseFloat(node2.value);
if (noPai === null) {
coefficients[0] = valor;
return;
@@ -82738,28 +82638,28 @@ var createZpk2tf = /* @__PURE__ */ factory(name287, dependencies286, (_ref) => {
add: add4,
multiply: multiply2,
Complex: Complex3,
- number: number5
+ number: number4
} = _ref;
return typed3(name287, {
- "Array,Array,number": function ArrayArrayNumber(z2, p2, k2) {
- return _zpk2tf(z2, p2, k2);
+ "Array,Array,number": function ArrayArrayNumber(z2, p, k2) {
+ return _zpk2tf(z2, p, k2);
},
- "Array,Array": function ArrayArray(z2, p2) {
- return _zpk2tf(z2, p2, 1);
+ "Array,Array": function ArrayArray(z2, p) {
+ return _zpk2tf(z2, p, 1);
},
- "Matrix,Matrix,number": function MatrixMatrixNumber(z2, p2, k2) {
- return _zpk2tf(z2.valueOf(), p2.valueOf(), k2);
+ "Matrix,Matrix,number": function MatrixMatrixNumber(z2, p, k2) {
+ return _zpk2tf(z2.valueOf(), p.valueOf(), k2);
},
- "Matrix,Matrix": function MatrixMatrix(z2, p2) {
- return _zpk2tf(z2.valueOf(), p2.valueOf(), 1);
+ "Matrix,Matrix": function MatrixMatrix(z2, p) {
+ return _zpk2tf(z2.valueOf(), p.valueOf(), 1);
}
});
- function _zpk2tf(z2, p2, k2) {
+ function _zpk2tf(z2, p, k2) {
if (z2.some((el) => el.type === "BigNumber")) {
- z2 = z2.map((el) => number5(el));
+ z2 = z2.map((el) => number4(el));
}
- if (p2.some((el) => el.type === "BigNumber")) {
- p2 = p2.map((el) => number5(el));
+ if (p.some((el) => el.type === "BigNumber")) {
+ p = p.map((el) => number4(el));
}
var num = [Complex3(1, 0)];
var den = [Complex3(1, 0)];
@@ -82769,8 +82669,8 @@ var createZpk2tf = /* @__PURE__ */ factory(name287, dependencies286, (_ref) => {
zero = Complex3(zero, 0);
num = _multiply(num, [Complex3(1, 0), Complex3(-zero.re, -zero.im)]);
}
- for (var _i = 0; _i < p2.length; _i++) {
- var pole = p2[_i];
+ for (var _i = 0; _i < p.length; _i++) {
+ var pole = p[_i];
if (typeof pole === "number")
pole = Complex3(pole, 0);
den = _multiply(den, [Complex3(1, 0), Complex3(-pole.re, -pole.im)]);
@@ -82895,7 +82795,7 @@ var createReviver = /* @__PURE__ */ factory(name289, dependencies288, (_ref) =>
var {
classes: classes2
} = _ref;
- return function reviver2(key3, value) {
+ return function reviver2(key2, value) {
var constructor = classes2[value && value.mathjs];
if (constructor && typeof constructor.fromJSON === "function") {
return constructor.fromJSON(value);
@@ -82908,7 +82808,7 @@ var createReviver = /* @__PURE__ */ factory(name289, dependencies288, (_ref) =>
var name290 = "replacer";
var dependencies289 = [];
var createReplacer = /* @__PURE__ */ factory(name290, dependencies289, () => {
- return function replacer2(key3, value) {
+ return function replacer2(key2, value) {
if (typeof value === "number" && (!isFinite(value) || isNaN(value))) {
return {
mathjs: "number",
@@ -83033,8 +82933,8 @@ var createUppercaseE = /* @__PURE__ */ factory("E", ["e"], (_ref15) => {
return e5;
});
var createVersion = /* @__PURE__ */ factory("version", [], () => version2);
-function recreateFactory(name317, dependencies314, create3) {
- return factory(name317, dependencies314, create3, {
+function recreateFactory(name317, dependencies314, create2) {
+ return factory(name317, dependencies314, create2, {
recreateOnConfigChange: true
});
}
@@ -83182,8 +83082,8 @@ var createColumnTransform = /* @__PURE__ */ factory(name292, dependencies291, (_
// node_modules/mathjs/lib/esm/expression/transform/utils/compileInlineExpression.js
function compileInlineExpression(expression, math2, scope) {
- var symbol = expression.filter(function(node2) {
- return isSymbolNode(node2) && !(node2.name in math2) && !scope.has(node2.name);
+ var symbol = expression.filter(function(node) {
+ return isSymbolNode(node) && !(node.name in math2) && !scope.has(node.name);
})[0];
if (!symbol) {
throw new Error('No undefined variable found in inline expression "' + expression + '"');
@@ -83235,8 +83135,8 @@ var createFilterTransform = /* @__PURE__ */ factory(name293, dependencies292, (_
isTransformFunction: true
});
function _filter(x2, callback) {
- return filter(x2, function(value, index3, array) {
- return applyCallback(callback, value, [index3 + 1], array, "filter");
+ return filter(x2, function(value, index2, array) {
+ return applyCallback(callback, value, [index2 + 1], array, "filter");
});
}
@@ -83264,13 +83164,13 @@ var createForEachTransform = /* @__PURE__ */ factory(name294, dependencies293, (
forEachTransform.rawArgs = true;
var _forEach2 = typed3("forEach", {
"Array | Matrix, function": function ArrayMatrixFunction(array, callback) {
- var recurse = function recurse2(value, index3) {
+ var recurse = function recurse2(value, index2) {
if (Array.isArray(value)) {
forEach(value, function(child, i4) {
- recurse2(child, index3.concat(i4 + 1));
+ recurse2(child, index2.concat(i4 + 1));
});
} else {
- return applyCallback(callback, value, index3, array, "forEach");
+ return applyCallback(callback, value, index2, array, "forEach");
}
};
recurse(array.valueOf(), []);
@@ -83343,10 +83243,10 @@ var createMapTransform = /* @__PURE__ */ factory(name296, dependencies295, (_ref
callback = compileInlineExpression(args[1], math2, scope);
}
}
- return map6(x2, callback);
+ return map4(x2, callback);
}
mapTransform.rawArgs = true;
- var map6 = typed3("map", {
+ var map4 = typed3("map", {
"Array, function": function ArrayFunction(x2, callback) {
return _map2(x2, callback, x2);
},
@@ -83359,13 +83259,13 @@ var createMapTransform = /* @__PURE__ */ factory(name296, dependencies295, (_ref
isTransformFunction: true
});
function _map2(array, callback, orig) {
- function recurse(value, index3) {
+ function recurse(value, index2) {
if (Array.isArray(value)) {
return map(value, function(child, i4) {
- return recurse(child, index3.concat(i4 + 1));
+ return recurse(child, index2.concat(i4 + 1));
});
} else {
- return applyCallback(callback, value, index3, orig, "map");
+ return applyCallback(callback, value, index2, orig, "map");
}
}
return recurse(array, []);
@@ -83620,14 +83520,14 @@ var createDiffTransform = /* @__PURE__ */ factory(name304, dependencies303, (_re
typed: typed3,
matrix: matrix2,
subtract: subtract3,
- number: number5,
+ number: number4,
bignumber: bignumber2
} = _ref;
var diff2 = createDiff({
typed: typed3,
matrix: matrix2,
subtract: subtract3,
- number: number5,
+ number: number4,
bignumber: bignumber2
});
return typed3(name304, {
@@ -83650,13 +83550,13 @@ var dependencies304 = ["typed", "map", "sqrt", "variance"];
var createStdTransform = /* @__PURE__ */ factory(name305, dependencies304, (_ref) => {
var {
typed: typed3,
- map: map6,
+ map: map4,
sqrt: sqrt3,
variance: variance2
} = _ref;
var std2 = createStd({
typed: typed3,
- map: map6,
+ map: map4,
sqrt: sqrt3,
variance: variance2
});
@@ -83742,9 +83642,9 @@ var createQuantileSeqTransform = /* @__PURE__ */ factory(name307, dependencies30
"Array | Matrix, number | BigNumber, boolean": quantileSeq2,
"Array | Matrix, number | BigNumber, boolean, number": (arr, prob, sorted, dim) => quantileSeq2(arr, prob, sorted, dimToZeroBase(dim)),
"Array | Matrix, Array | Matrix": quantileSeq2,
- "Array | Matrix, Array | Matrix, number": (data3, prob, dim) => quantileSeq2(data3, prob, dimToZeroBase(dim)),
+ "Array | Matrix, Array | Matrix, number": (data2, prob, dim) => quantileSeq2(data2, prob, dimToZeroBase(dim)),
"Array | Matrix, Array | Matrix, boolean": quantileSeq2,
- "Array | Matrix, Array | Matrix, boolean, number": (data3, prob, sorted, dim) => quantileSeq2(data3, prob, sorted, dimToZeroBase(dim))
+ "Array | Matrix, Array | Matrix, boolean, number": (data2, prob, sorted, dim) => quantileSeq2(data2, prob, sorted, dimToZeroBase(dim))
});
function dimToZeroBase(dim) {
return lastDimToZeroBase([[], dim])[1];
@@ -86616,7 +86516,7 @@ function importFactory(typed3, load, math2, importedFactories) {
math2[name317] = value;
delete importedFactories[name317];
_importTransform(name317, value);
- math2.emit("import", name317, function resolver2() {
+ math2.emit("import", name317, function resolver() {
return value;
});
return;
@@ -86625,7 +86525,7 @@ function importFactory(typed3, load, math2, importedFactories) {
math2[name317] = value;
delete importedFactories[name317];
_importTransform(name317, value);
- math2.emit("import", name317, function resolver2() {
+ math2.emit("import", name317, function resolver() {
return value;
});
return;
@@ -86677,7 +86577,7 @@ function importFactory(typed3, load, math2, importedFactories) {
var namespace = isTransformFunctionFactory(factory2) ? math2.expression.transform : math2;
var existingTransform = name317 in math2.expression.transform;
var existing = hasOwnProperty2(namespace, name317) ? namespace[name317] : void 0;
- var resolver2 = function resolver3() {
+ var resolver = function resolver2() {
var dependencies314 = {};
factory2.dependencies.map(stripOptionalNotation).forEach((dependency) => {
if (contains2(dependency, ".")) {
@@ -86710,7 +86610,7 @@ function importFactory(typed3, load, math2, importedFactories) {
}
};
if (!factory2.meta || factory2.meta.lazy !== false) {
- lazy(namespace, name317, resolver2);
+ lazy(namespace, name317, resolver);
if (existing && existingTransform) {
_deleteTransform(name317);
} else {
@@ -86719,7 +86619,7 @@ function importFactory(typed3, load, math2, importedFactories) {
}
}
} else {
- namespace[name317] = resolver2();
+ namespace[name317] = resolver();
if (existing && existingTransform) {
_deleteTransform(name317);
} else {
@@ -86729,7 +86629,7 @@ function importFactory(typed3, load, math2, importedFactories) {
}
}
importedFactories[name317] = factory2;
- math2.emit("import", name317, resolver2);
+ math2.emit("import", name317, resolver);
}
function isSupportedType(object) {
return typeof object === "function" || typeof object === "number" || typeof object === "string" || typeof object === "boolean" || object === null || isUnit(object) || isComplex(object) || isBigNumber(object) || isFraction(object) || isMatrix(object) || Array.isArray(object);
@@ -86738,15 +86638,15 @@ function importFactory(typed3, load, math2, importedFactories) {
return typeof fn === "function" && typeof fn.signature === "string";
}
function allowedInExpressions(name317) {
- return !hasOwnProperty2(unsafe2, name317);
+ return !hasOwnProperty2(unsafe, name317);
}
function factoryAllowedInExpressions(factory2) {
- return factory2.fn.indexOf(".") === -1 && !hasOwnProperty2(unsafe2, factory2.fn) && (!factory2.meta || !factory2.meta.isClass);
+ return factory2.fn.indexOf(".") === -1 && !hasOwnProperty2(unsafe, factory2.fn) && (!factory2.meta || !factory2.meta.isClass);
}
function isTransformFunctionFactory(factory2) {
return factory2 !== void 0 && factory2.meta !== void 0 && factory2.meta.isTransformFunction === true || false;
}
- var unsafe2 = {
+ var unsafe = {
expression: true,
type: true,
docs: true,
@@ -86825,9 +86725,9 @@ function create(factories, config4) {
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 index3 = legacyFactories.indexOf(factory2);
+ var index2 = legacyFactories.indexOf(factory2);
var instance;
- if (index3 === -1) {
+ if (index2 === -1) {
if (factory2.math === true) {
instance = factory2.factory(math2.type, configInternal, load, math2.typed, math2);
} else {
@@ -86836,7 +86736,7 @@ function create(factories, config4) {
legacyFactories.push(factory2);
legacyInstances.push(instance);
} else {
- instance = legacyInstances[index3];
+ instance = legacyInstances[index2];
}
return instance;
}
@@ -87115,15 +87015,15 @@ var formulas = {
str = format6(str);
return str.match(new RegExp(regex));
},
- "replace": (str, search3, replace) => {
+ "replace": (str, search2, replace) => {
str = format6(str);
- return str.replace(new RegExp(search3), replace);
+ return str.replace(new RegExp(search2), replace);
},
- "replaceAll": (str, search3, replace) => {
+ "replaceAll": (str, search2, replace) => {
str = format6(str);
- search3 = format6(search3);
+ search2 = format6(search2);
replace = format6(replace);
- return str.replace(new RegExp(search3, "g"), replace);
+ return str.replace(new RegExp(search2, "g"), replace);
},
"lower": (str) => {
str = format6(str);
@@ -87242,8 +87142,8 @@ var formulas = {
"timeStamp": (date) => {
return date.getTime();
},
- "at": (arr, index3) => {
- return arr[index3];
+ "at": (arr, index2) => {
+ return arr[index2];
},
"first": (arr) => {
return arr[0];
@@ -87286,15 +87186,15 @@ var formulas = {
};
// src/core/utils/formula/parser.ts
-var runFormulaWithContext = (runContext, paths, formula, properties3, values2, path3, emitError) => {
+var runFormulaWithContext = (runContext, paths, formula, properties3, values2, path2, emitError) => {
if (!formula)
return "";
const scope = /* @__PURE__ */ new Map();
Object.keys(values2).forEach((f2) => scope.set(f2, values2[f2]));
scope.set("$properties", properties3);
scope.set("$paths", paths);
- if (path3)
- scope.set("$current", path3);
+ if (path2)
+ scope.set("$current", path2);
let value;
try {
runContext.evaluate("current = current()", scope);
@@ -87308,8 +87208,8 @@ var runFormulaWithContext = (runContext, paths, formula, properties3, values2, p
};
// src/core/utils/tree.ts
-var nodeIsAncestorOfTarget = (path3, target) => {
- return target.startsWith(path3);
+var nodeIsAncestorOfTarget = (path2, target) => {
+ return target.startsWith(path2);
return false;
};
var compareByFieldDeep = (field, dir) => (_a, _b) => {
@@ -87346,17 +87246,17 @@ var compareByFieldNumerical = (field, dir) => (_a, _b) => {
};
// src/core/superstate/utils/tags.ts
-var deleteTagFromPath = (superstate, path3, tag2) => {
- if (superstate.spacesIndex.has(path3)) {
- return superstate.spaceManager.deleteTag(superstate.spacesIndex.get(path3).defPath, tag2);
+var deleteTagFromPath = (superstate, path2, tag2) => {
+ if (superstate.spacesIndex.has(path2)) {
+ return superstate.spaceManager.deleteTag(superstate.spacesIndex.get(path2).defPath, tag2);
}
- return superstate.spaceManager.deleteTag(path3, tag2);
+ return superstate.spaceManager.deleteTag(path2, tag2);
};
-var addTagToPath = (superstate, path3, tag2) => {
- if (superstate.spacesIndex.has(path3)) {
- return superstate.spaceManager.addTag(superstate.spacesIndex.get(path3).defPath, tag2);
+var addTagToPath = (superstate, path2, tag2) => {
+ if (superstate.spacesIndex.has(path2)) {
+ return superstate.spaceManager.addTag(superstate.spacesIndex.get(path2).defPath, tag2);
}
- return superstate.spaceManager.addTag(path3, tag2);
+ return superstate.spaceManager.addTag(path2, tag2);
};
var addTag = (superstate, tag2) => {
return superstate.spaceManager.createSpace(ensureTag(tag2), superstate.settings.spacesFolder, null);
@@ -87410,29 +87310,29 @@ var parseSpaceMetadata = (metadata, settings) => {
templateName: ensureString(metadata[spaceTemplateNameKey(settings)])
};
};
-var spaceToTreeNode = (path3, collapsed, sortable, depth, parentId, parentPath, childrenCount) => {
+var spaceToTreeNode = (path2, collapsed, sortable, depth, parentId, parentPath, childrenCount) => {
return {
- id: parentId ? parentId + "/" + path3.path : path3.path,
+ id: parentId ? parentId + "/" + path2.path : path2.path,
parentId,
depth,
index: 0,
space: parentPath,
- path: path3.path,
- item: path3,
- rank: path3?.rank,
+ path: path2.path,
+ item: path2,
+ rank: path2?.rank,
collapsed,
sortable,
childrenCount,
type: "space"
};
};
-var pathStateToTreeNode = (superstate, item, space3, path3, depth, i4, collapsed, sortable, childrenCount, parentId) => ({
+var pathStateToTreeNode = (superstate, item, space2, path2, depth, i4, collapsed, sortable, childrenCount, parentId) => ({
item,
- space: space3,
+ space: space2,
id: parentId + "/" + item.path,
parentId,
depth,
- path: path3,
+ path: path2,
index: i4,
collapsed,
sortable,
@@ -87463,21 +87363,21 @@ var spaceSortFn = (sortStrategy) => (a4, b2) => {
const fieldFunc = (obj) => obj?.metadata?.file?.[sortStrategy.field];
sortFns.push(compareByFieldDeep(fieldFunc, sortStrategy.asc));
}
- return sortFns.reduce((p2, c3) => {
- return p2 == 0 ? c3(a4, b2) : p2;
+ return sortFns.reduce((p, c3) => {
+ return p == 0 ? c3(a4, b2) : p;
}, 0);
};
-var updatePathRankInSpace = async (superstate, path3, rank, space3) => {
- const spaceState = superstate.spacesIndex.get(space3);
+var updatePathRankInSpace = async (superstate, path2, rank, space2) => {
+ const spaceState = superstate.spacesIndex.get(space2);
if (!spaceState)
return;
const fixedRank = rank;
- superstate.addToContextStateQueue(() => reorderPathsInContext(superstate.spaceManager, [path3], fixedRank, spaceState.space).then((f2) => {
+ superstate.addToContextStateQueue(() => reorderPathsInContext(superstate.spaceManager, [path2], fixedRank, spaceState.space).then((f2) => {
const promises = [...superstate.spacesMap.getInverse(spaceState.path)].map((f3) => superstate.reloadPath(f3));
return Promise.all(promises);
}).then((f2) => superstate.dispatchEvent("spaceStateUpdated", { path: spaceState.path })));
};
-var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index3, copy) => {
+var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index2, copy) => {
if (!item)
return;
const currentPathState = superstate.pathsIndex.get(item.path);
@@ -87493,29 +87393,29 @@ var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index3, copy
} else {
await superstate.spaceManager.renamePath(item.path, movePath(item.path, newParent));
}
- updatePathRankInSpace(superstate, newPath, index3, newParent);
+ updatePathRankInSpace(superstate, newPath, index2, newParent);
};
-var setTemplateInSpace = (superstate, path3, template2) => {
- saveSpaceMetadataValue(superstate, path3, "template", template2);
+var setTemplateInSpace = (superstate, path2, template2) => {
+ saveSpaceMetadataValue(superstate, path2, "template", template2);
};
-var setTemplateNameInSpace = (superstate, path3, templateName) => {
- saveSpaceMetadataValue(superstate, path3, "templateName", templateName);
+var setTemplateNameInSpace = (superstate, path2, templateName) => {
+ saveSpaceMetadataValue(superstate, path2, "templateName", templateName);
};
-var createSpace = async (superstate, path3, newSpace) => {
- const space3 = superstate.spacesIndex.get(path3);
+var createSpace = async (superstate, path2, newSpace) => {
+ const space2 = superstate.spacesIndex.get(path2);
let newSpaceCache;
- if (space3) {
- if (!superstate.pathsIndex.has(path3)) {
- return await superstate.reloadSpace(space3.space);
+ if (space2) {
+ if (!superstate.pathsIndex.has(path2)) {
+ return await superstate.reloadSpace(space2.space);
return;
}
if (newSpace) {
- newSpaceCache = await saveSpaceCache(superstate, space3.space, newSpace);
+ newSpaceCache = await saveSpaceCache(superstate, space2.space, newSpace);
} else {
return;
}
} else {
- const spaceInfo = superstate.spaceManager.spaceInfoForPath(path3);
+ const spaceInfo = superstate.spaceManager.spaceInfoForPath(path2);
if (spaceInfo.readOnly) {
return await superstate.reloadSpace(spaceInfo);
}
@@ -87530,23 +87430,23 @@ var createSpace = async (superstate, path3, newSpace) => {
superstate.onSpaceDefinitionChanged(newSpaceCache, null);
return newSpaceCache;
};
-var saveSpaceMetadataValue = async (superstate, space3, key3, value) => {
- superstate.spaceManager.saveSpace(space3, (metadata) => ({ ...metadata, [key3]: value }));
- const spaceCache = superstate.spacesIndex.get(space3);
- await superstate.updateSpaceMetadata(space3, { ...spaceCache.metadata, [key3]: value });
+var saveSpaceMetadataValue = async (superstate, space2, key2, value) => {
+ superstate.spaceManager.saveSpace(space2, (metadata) => ({ ...metadata, [key2]: value }));
+ const spaceCache = superstate.spacesIndex.get(space2);
+ await superstate.updateSpaceMetadata(space2, { ...spaceCache.metadata, [key2]: value });
};
-var saveSpaceProperties = async (superstate, space3, properties3) => {
- superstate.spaceManager.saveSpace(space3, (metadata) => metadata, properties3);
+var saveSpaceProperties = async (superstate, space2, properties3) => {
+ superstate.spaceManager.saveSpace(space2, (metadata) => metadata, properties3);
};
var saveSpaceCache = async (superstate, spaceInfo, metadata) => {
await superstate.spaceManager.saveSpace(spaceInfo.path, (oldMetadata) => ({ ...oldMetadata, ...metadata }));
return superstate.updateSpaceMetadata(spaceInfo.path, metadata);
};
-var addPathToSpaceAtIndex = async (superstate, space3, path3, rank) => {
- if (space3.type == "tag") {
- return addTagToPath(superstate, path3, space3.name);
+var addPathToSpaceAtIndex = async (superstate, space2, path2, rank) => {
+ if (space2.type == "tag") {
+ return addTagToPath(superstate, path2, space2.name);
} else {
- return pinPathToSpaceAtIndex(superstate, space3, path3, rank);
+ return pinPathToSpaceAtIndex(superstate, space2, path2, rank);
}
};
var defaultSpace = async (superstate, activeFile) => {
@@ -87563,21 +87463,21 @@ var defaultSpace = async (superstate, activeFile) => {
}
return spaceState;
};
-var pinPathToSpaceAtIndex = async (superstate, space3, path3, rank) => {
- if (path3 == space3.path) {
+var pinPathToSpaceAtIndex = async (superstate, space2, path2, rank) => {
+ if (path2 == space2.path) {
return;
}
- const spaceExists = ensureArray(space3.metadata.links) ?? [];
- const pathExists = spaceExists.find((f2) => f2 == path3);
+ const spaceExists = ensureArray(space2.metadata.links) ?? [];
+ const pathExists = spaceExists.find((f2) => f2 == path2);
if (!pathExists) {
- spaceExists.push(path3);
+ spaceExists.push(path2);
}
- await saveSpaceCache(superstate, space3.space, { ...space3.metadata, links: spaceExists });
- await superstate.reloadPath(path3, true).then((f2) => superstate.dispatchEvent("pathStateUpdated", { path: path3 }));
- updatePathRankInSpace(superstate, path3, rank, space3.path);
+ await saveSpaceCache(superstate, space2.space, { ...space2.metadata, links: spaceExists });
+ await superstate.reloadPath(path2, true).then((f2) => superstate.dispatchEvent("pathStateUpdated", { path: path2 }));
+ updatePathRankInSpace(superstate, path2, rank, space2.path);
};
-var removeSpace = async (superstate, space3) => {
- const spaceCache = superstate.spacesIndex.get(space3);
+var removeSpace = async (superstate, space2) => {
+ const spaceCache = superstate.spacesIndex.get(space2);
if (!spaceCache)
return;
if (spaceCache.type == "tag") {
@@ -87586,11 +87486,11 @@ var removeSpace = async (superstate, space3) => {
await deletePath(superstate, spaceCache.path);
}
};
-var updateSpaceSort = (superstate, path3, sort2) => {
- const space3 = superstate.spacesIndex.get(path3);
- if (space3)
- saveSpaceCache(superstate, space3.space, {
- ...space3.metadata,
+var updateSpaceSort = (superstate, path2, sort2) => {
+ const space2 = superstate.spacesIndex.get(path2);
+ if (space2)
+ saveSpaceCache(superstate, space2.space, {
+ ...space2.metadata,
sort: sort2
});
};
@@ -87606,63 +87506,63 @@ var toggleWaypoint = (superstate, spacePath, remove, rank) => {
}
superstate.saveSettings();
};
-var saveSpaceTemplate = async (superstate, path3, space3) => {
- const spaceCache = superstate.spacesIndex.get(space3);
+var saveSpaceTemplate = async (superstate, path2, space2) => {
+ const spaceCache = superstate.spacesIndex.get(space2);
if (!spaceCache)
return;
- await superstate.spaceManager.saveTemplate(path3, spaceCache.path);
+ await superstate.spaceManager.saveTemplate(path2, spaceCache.path);
superstate.ui.notify(i18n_default.notice.templateSaved + spaceCache.name);
};
var removePathsFromSpace = async (superstate, spacePath, paths) => {
- const space3 = superstate.spacesIndex.get(spacePath);
- if (!space3)
+ const space2 = superstate.spacesIndex.get(spacePath);
+ if (!space2)
return;
- if (space3.type == "default") {
- if (space3.path == "spaces://$waypoints") {
+ if (space2.type == "default") {
+ if (space2.path == "spaces://$waypoints") {
toggleWaypoint(superstate, paths[0], true);
return;
}
}
- if (space3.type == "tag") {
- paths.forEach((path3) => deleteTagFromPath(superstate, path3, space3.name));
- } else if (space3.type == "folder" || space3.type == "vault") {
- await saveSpaceMetadataValue(superstate, space3.path, "links", space3.metadata.links.filter((f2) => !paths.some((g) => g == f2)));
+ if (space2.type == "tag") {
+ paths.forEach((path2) => deleteTagFromPath(superstate, path2, space2.name));
+ } else if (space2.type == "folder" || space2.type == "vault") {
+ await saveSpaceMetadataValue(superstate, space2.path, "links", space2.metadata.links.filter((f2) => !paths.some((g) => g == f2)));
}
};
-var newTemplateInSpace = async (superstate, space3, name317, location) => {
+var newTemplateInSpace = async (superstate, space2, name317, location) => {
let newName;
try {
- if (space3.metadata.templateName?.length > 0) {
- const result = runFormulaWithContext(superstate.formulaContext, superstate.pathsIndex, space3.metadata.templateName, {}, {}, superstate.pathsIndex.get(space3.path));
+ if (space2.metadata.templateName?.length > 0) {
+ const result = runFormulaWithContext(superstate.formulaContext, superstate.pathsIndex, space2.metadata.templateName, {}, {}, superstate.pathsIndex.get(space2.path));
if (result?.length > 0)
newName = result;
}
} catch (e5) {
}
- if (!await superstate.spaceManager.pathExists(`${space3.path}/.space/templates/${name317}`)) {
- newPathInSpace(superstate, space3, "md", null, false, null, location);
+ if (!await superstate.spaceManager.pathExists(`${space2.path}/.space/templates/${name317}`)) {
+ newPathInSpace(superstate, space2, "md", null, false, null, location);
return;
}
- const newPath = await superstate.spaceManager.copyPath(`${space3.path}/.space/templates/${name317}`, space3.path, newName);
+ const newPath = await superstate.spaceManager.copyPath(`${space2.path}/.space/templates/${name317}`, space2.path, newName);
if (newPath)
superstate.ui.openPath(newPath, location);
};
-var newPathInSpace = async (superstate, space3, type, name317, dontOpen, content5, location) => {
+var newPathInSpace = async (superstate, space2, type, name317, dontOpen, content3, location) => {
let newPath;
- if (space3.type == "tag") {
+ if (space2.type == "tag") {
newPath = await superstate.spaceManager.createItemAtPath(
"/",
type,
name317,
- content5
+ content3
);
- await superstate.spaceManager.addTag(newPath, space3.name);
+ await superstate.spaceManager.addTag(newPath, space2.name);
} else {
newPath = await superstate.spaceManager.createItemAtPath(
- space3.path,
+ space2.path,
type,
name317,
- content5
+ content3
);
}
if (!dontOpen) {
@@ -87670,60 +87570,60 @@ var newPathInSpace = async (superstate, space3, type, name317, dontOpen, content
}
return newPath;
};
-var saveLabel = (superstate, path3, label, value) => {
- superstate.spaceManager.saveLabel(path3, label, value);
+var saveLabel = (superstate, path2, label, value) => {
+ superstate.spaceManager.saveLabel(path2, label, value);
};
-var saveProperties = (superstate, path3, properties3) => {
- if (superstate.spacesIndex.has(path3)) {
- saveSpaceProperties(superstate, path3, properties3);
+var saveProperties = (superstate, path2, properties3) => {
+ if (superstate.spacesIndex.has(path2)) {
+ saveSpaceProperties(superstate, path2, properties3);
} else {
- superstate.spaceManager.saveProperties(path3, properties3);
+ superstate.spaceManager.saveProperties(path2, properties3);
}
};
-var renameProperty = (superstate, path3, oldName, newName) => {
- if (superstate.spacesIndex.has(path3)) {
- superstate.spaceManager.renameProperty(superstate.spacesIndex.get(path3).defPath, oldName, newName);
+var renameProperty = (superstate, path2, oldName, newName) => {
+ if (superstate.spacesIndex.has(path2)) {
+ superstate.spaceManager.renameProperty(superstate.spacesIndex.get(path2).defPath, oldName, newName);
return;
}
- superstate.spaceManager.renameProperty(path3, oldName, newName);
+ superstate.spaceManager.renameProperty(path2, oldName, newName);
};
-var deleteProperty = (superstate, path3, name317) => {
- if (superstate.spacesIndex.has(path3)) {
- superstate.spaceManager.deleteProperty(superstate.spacesIndex.get(path3).defPath, name317);
+var deleteProperty = (superstate, path2, name317) => {
+ if (superstate.spacesIndex.has(path2)) {
+ superstate.spaceManager.deleteProperty(superstate.spacesIndex.get(path2).defPath, name317);
return;
}
- superstate.spaceManager.deleteProperty(path3, name317);
+ superstate.spaceManager.deleteProperty(path2, name317);
};
// src/core/superstate/utils/label.ts
-var savePathBanner = (superstate, path3, banner) => {
- if (superstate.spacesIndex.has(path3)) {
- saveProperties(superstate, superstate.spacesIndex.get(path3).defPath, {
+var savePathBanner = (superstate, path2, banner) => {
+ if (superstate.spacesIndex.has(path2)) {
+ saveProperties(superstate, superstate.spacesIndex.get(path2).defPath, {
[superstate.settings.fmKeyBanner]: banner
});
return;
}
- saveProperties(superstate, path3, {
+ saveProperties(superstate, path2, {
[superstate.settings.fmKeyBanner]: banner
});
};
-var savePathColor = async (superstate, path3, color3) => {
- if (superstate.spacesIndex.has(path3)) {
- saveSpaceProperties(superstate, path3, { [superstate.settings.fmKeyColor]: color3 });
+var savePathColor = async (superstate, path2, color2) => {
+ if (superstate.spacesIndex.has(path2)) {
+ saveSpaceProperties(superstate, path2, { [superstate.settings.fmKeyColor]: color2 });
return;
}
- saveLabel(superstate, path3, "color", color3);
+ saveLabel(superstate, path2, "color", color2);
};
-var savePathSticker = async (superstate, path3, sticker) => {
- if (superstate.spacesIndex.has(path3)) {
- saveSpaceProperties(superstate, path3, { [superstate.settings.fmKeySticker]: sticker });
+var savePathSticker = async (superstate, path2, sticker) => {
+ if (superstate.spacesIndex.has(path2)) {
+ saveSpaceProperties(superstate, path2, { [superstate.settings.fmKeySticker]: sticker });
return;
}
- saveLabel(superstate, path3, "sticker", sticker);
+ saveLabel(superstate, path2, "sticker", sticker);
};
-var updatePrimaryAlias = (superstate, path3, aliases, value) => {
+var updatePrimaryAlias = (superstate, path2, aliases, value) => {
const newValue = serializeMultiDisplayString([value, ...ensureArray(aliases).filter((f2) => f2 == value)]);
- saveProperties(superstate, path3, { [superstate.settings.fmKeyAlias]: parseMDBValue("option-multi", newValue) });
+ saveProperties(superstate, path2, { [superstate.settings.fmKeyAlias]: parseMDBValue("option-multi", newValue) });
};
// src/core/utils/dnd/dropPath.ts
@@ -87747,7 +87647,7 @@ var dropPathsInTree = async (superstate, paths, active, over, projected, flatten
dropPathsInSpaceAtIndex(superstate, droppable, newSpace, projected.sortable && newRank, modifier);
}
};
-var dropPathInTree = async (superstate, path3, active, over, projected, flattenedTree, activeSpaces, modifier) => {
+var dropPathInTree = async (superstate, path2, active, over, projected, flattenedTree, activeSpaces, modifier) => {
if (projected) {
const clonedItems = flattenedTree;
const overIndex = clonedItems.findIndex(({ id: id3 }) => id3 === over);
@@ -87756,7 +87656,7 @@ var dropPathInTree = async (superstate, path3, active, over, projected, flattene
const newSpace = projected.depth == 0 && !projected.insert ? null : clonedItems.find(({ id: id3 }) => id3 === parentId)?.item.path;
const newRank = parentId == null ? activeSpaces.findIndex((f2) => f2?.path == overItem.id) : parentId == overItem.id ? -1 : overItem.rank ?? -1;
if (!active) {
- dropPathInSpaceAtIndex(superstate, path3, null, newSpace, projected.sortable && newRank, modifier);
+ dropPathInSpaceAtIndex(superstate, path2, null, newSpace, projected.sortable && newRank, modifier);
return;
}
const activeIndex = clonedItems.findIndex(({ id: id3 }) => id3 === active);
@@ -87765,11 +87665,11 @@ var dropPathInTree = async (superstate, path3, active, over, projected, flattene
dropPathInSpaceAtIndex(superstate, activeItem.item.path, oldSpace, newSpace, projected.sortable && newRank, modifier);
}
};
-var reorderOpenSpace = (superstate, path3, index3) => {
+var reorderOpenSpace = (superstate, path2, index2) => {
const newWaypoint = superstate.waypoints[superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] };
- const currentIndex = newWaypoint.paths.findIndex((f2) => f2 == path3);
- const newIndex = currentIndex > index3 ? Math.max(0, index3 - 1) : index3;
- newWaypoint.paths = arrayMove(newWaypoint.paths, newWaypoint.paths.findIndex((f2) => f2 == path3), newIndex);
+ const currentIndex = newWaypoint.paths.findIndex((f2) => f2 == path2);
+ const newIndex = currentIndex > index2 ? Math.max(0, index2 - 1) : index2;
+ newWaypoint.paths = arrayMove(newWaypoint.paths, newWaypoint.paths.findIndex((f2) => f2 == path2), newIndex);
if (superstate.settings.currentWaypoint > superstate.waypoints.length) {
superstate.spaceManager.saveWaypoints([
...superstate.waypoints,
@@ -87781,72 +87681,72 @@ var reorderOpenSpace = (superstate, path3, index3) => {
);
superstate.spaceManager.saveWaypoints(newWaypoints);
};
-var dropPathInSpaceAtIndex = async (superstate, path3, oldSpacePath, newSpacePath, index3, modifier) => {
- const cache2 = superstate.pathsIndex.get(path3);
+var dropPathInSpaceAtIndex = async (superstate, path2, oldSpacePath, newSpacePath, index2, modifier) => {
+ const cache2 = superstate.pathsIndex.get(path2);
if (!cache2)
return false;
if (!newSpacePath) {
- reorderOpenSpace(superstate, path3, index3);
+ reorderOpenSpace(superstate, path2, index2);
return;
}
const newSpaceCache = superstate.spacesIndex.get(newSpacePath);
if (oldSpacePath == newSpacePath) {
- updatePathRankInSpace(superstate, path3, index3, newSpacePath);
+ updatePathRankInSpace(superstate, path2, index2, newSpacePath);
return;
}
if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") {
- if (modifier == "link" || nodeIsAncestorOfTarget(path3, newSpaceCache.path)) {
- pinPathToSpaceAtIndex(superstate, newSpaceCache, path3, index3);
+ if (modifier == "link" || nodeIsAncestorOfTarget(path2, newSpaceCache.path)) {
+ pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index2);
} else {
- movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path3), newSpaceCache.path, index3, modifier == "copy");
+ movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index2, modifier == "copy");
}
}
if (newSpaceCache.type == "tag") {
- addTagToPath(superstate, path3, newSpaceCache.name);
+ addTagToPath(superstate, path2, newSpaceCache.name);
}
if (oldSpacePath && oldSpacePath != newSpacePath) {
- removePathsFromSpace(superstate, oldSpacePath, [path3]);
+ removePathsFromSpace(superstate, oldSpacePath, [path2]);
}
};
-var dropPathsInSpaceAtIndex = async (superstate, paths, newSpacePath, index3, modifier) => {
+var dropPathsInSpaceAtIndex = async (superstate, paths, newSpacePath, index2, modifier) => {
const newSpaceCache = superstate.spacesIndex.get(newSpacePath);
if (!newSpaceCache)
return;
if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") {
- paths.forEach((path3) => {
- if (modifier == "link" || nodeIsAncestorOfTarget(path3, newSpaceCache.path)) {
- pinPathToSpaceAtIndex(superstate, newSpaceCache, path3, index3);
+ paths.forEach((path2) => {
+ if (modifier == "link" || nodeIsAncestorOfTarget(path2, newSpaceCache.path)) {
+ pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index2);
} else {
- movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path3), newSpaceCache.path, index3, modifier == "copy");
+ movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index2, modifier == "copy");
}
});
}
if (newSpaceCache.type == "tag") {
- paths.forEach((path3) => addTagToPath(superstate, path3, newSpaceCache.name));
+ paths.forEach((path2) => addTagToPath(superstate, path2, newSpaceCache.name));
}
};
// src/core/utils/emoji.ts
var saveIconsForPaths = (superstate, paths, icon) => {
- paths.forEach((path3) => {
- savePathSticker(superstate, path3, icon);
+ paths.forEach((path2) => {
+ savePathSticker(superstate, path2, icon);
});
};
var saveColorForPaths = (superstate, paths, icon) => {
- paths.forEach((path3) => {
- savePathColor(superstate, path3, icon);
+ paths.forEach((path2) => {
+ savePathColor(superstate, path2, icon);
});
};
-var savePathIcon = (superstate, path3, icon) => {
- savePathSticker(superstate, path3, icon);
+var savePathIcon = (superstate, path2, icon) => {
+ savePathSticker(superstate, path2, icon);
};
var removeIconsForPaths = (superstate, paths) => {
- paths.forEach((path3) => {
- savePathSticker(superstate, path3, "");
+ paths.forEach((path2) => {
+ savePathSticker(superstate, path2, "");
});
};
-var removePathIcon = (superstate, path3) => {
- savePathSticker(superstate, path3, "");
+var removePathIcon = (superstate, path2) => {
+ savePathSticker(superstate, path2, "");
};
// src/core/react/components/UI/Menus/navigator/pathContextMenu.tsx
@@ -87875,10 +87775,10 @@ var ConfirmationModal = (props) => {
// src/core/utils/color/gradient.ts
var typeName = (name317) => `${name317}-gradient(`;
var stringifyGradient = (gradient) => {
- let handlers2 = gradient.values;
- handlers2.sort((l2, r2) => l2.position - r2.position);
- handlers2 = handlers2.length == 1 ? [handlers2[0], handlers2[0]] : handlers2;
- const color3 = handlers2.map((handler) => `${handler.color} ${handler.position}%`).join(", ");
+ let handlers = gradient.values;
+ handlers.sort((l2, r2) => l2.position - r2.position);
+ handlers = handlers.length == 1 ? [handlers[0], handlers[0]] : handlers;
+ const color2 = handlers.map((handler) => `${handler.color} ${handler.position}%`).join(", ");
const tp = gradient.type;
const defDir = ["top", "left", "bottom", "right", "center"];
let ang = gradient.direction;
@@ -87888,7 +87788,7 @@ var stringifyGradient = (gradient) => {
if (["radial", "repeating-radial"].indexOf(tp) >= 0 && defDir.indexOf(ang) >= 0) {
ang = `circle at ${ang}`;
}
- return color3 ? `${tp}-gradient(${ang}, ${color3})` : "";
+ return color2 ? `${tp}-gradient(${ang}, ${color2})` : "";
};
var parseGradient = (value) => {
let type = null;
@@ -87919,11 +87819,11 @@ var parseGradient = (value) => {
direction,
values: values2.map((value2) => {
const hdlValues = value2.split(" ");
- const position3 = parseFloat(hdlValues.pop());
- const color3 = hdlValues.join("");
+ const position = parseFloat(hdlValues.pop());
+ const color2 = hdlValues.join("");
return {
- position: position3,
- color: color3
+ position,
+ color: color2
};
})
};
@@ -88008,14 +87908,14 @@ var ColorPicker = (props) => {
setValue(gradientString);
props.saveValue(gradientString);
};
- const updateColor = (color3) => {
- if (color3) {
- setValue(color3);
- setCurrentColor(color3);
+ const updateColor = (color2) => {
+ if (color2) {
+ setValue(color2);
+ setCurrentColor(color2);
}
let gradientObject;
try {
- gradientObject = parseGradient(color3);
+ gradientObject = parseGradient(color2);
const values2 = gradientObject.values.map((g) => {
const existingStop = gradient?.values.find(
(f2) => f2.position == g.position && f2.color == g.color
@@ -88033,7 +87933,7 @@ var ColorPicker = (props) => {
setGradient(gradientObject);
setCurrentColor(gradientObject.values[0].color);
} else {
- setCurrentColor(color3);
+ setCurrentColor(color2);
}
};
(0, import_react10.useEffect)(() => {
@@ -88173,7 +88073,7 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => {
name: i18n_default.menu.openFilePane,
icon: "ui//go-to-file",
onClick: (e6) => {
- paths.forEach((path3) => superstate.ui.openPath(path3, true));
+ paths.forEach((path2) => superstate.ui.openPath(path2, true));
}
});
menuOptions.push(menuSeparator);
@@ -88185,11 +88085,11 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => {
showSpacesMenu(
offset2,
superstate,
- (link3) => {
+ (link) => {
dropPathsInSpaceAtIndex(
superstate,
selectedPaths.map((f2) => f2.path),
- link3,
+ link,
-1,
"link"
);
@@ -88238,9 +88138,9 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => {
icon: "ui//paper-plane",
onClick: (e6) => {
const offset2 = e6.target.getBoundingClientRect();
- showSpacesMenu(offset2, superstate, (link3) => {
+ showSpacesMenu(offset2, superstate, (link) => {
paths.forEach((f2) => {
- movePathToSpace(superstate, f2, link3);
+ movePathToSpace(superstate, f2, link);
});
});
}
@@ -88281,8 +88181,8 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => {
);
return false;
};
-var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRename) => {
- const cache2 = superstate.pathsIndex.get(path3);
+var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRename) => {
+ const cache2 = superstate.pathsIndex.get(path2);
if (!cache2)
return;
const menuOptions = [];
@@ -88290,7 +88190,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
name: i18n_default.menu.openFilePane,
icon: "ui//go-to-file",
onClick: (e5) => {
- superstate.ui.openPath(path3, true);
+ superstate.ui.openPath(path2, true);
}
});
menuOptions.push(menuSeparator);
@@ -88302,8 +88202,8 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
showSpacesMenu(
offset2,
superstate,
- (link3) => {
- dropPathsInSpaceAtIndex(superstate, [path3], link3, -1, "link");
+ (link) => {
+ dropPathsInSpaceAtIndex(superstate, [path2], link, -1, "link");
},
true
);
@@ -88314,24 +88214,24 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
name: i18n_default.menu.changeToFolderNote,
icon: "ui//file-plus-2",
onClick: (e5) => {
- convertPathToSpace(superstate, path3, false);
+ convertPathToSpace(superstate, path2, false);
}
});
menuOptions.push({
name: "Save as Template",
icon: "ui//clipboard-add",
onClick: (e5) => {
- saveSpaceTemplate(superstate, path3, space3);
+ saveSpaceTemplate(superstate, path2, space2);
}
});
- if (space3 && space3 != cache2.parent) {
- const spaceCache = superstate.spacesIndex.get(space3);
+ if (space2 && space2 != cache2.parent) {
+ const spaceCache = superstate.spacesIndex.get(space2);
if (spaceCache) {
menuOptions.push({
name: i18n_default.menu.removeFromSpace,
icon: "ui//pin-off",
onClick: (e5) => {
- removePathsFromSpace(superstate, spaceCache.path, [path3]);
+ removePathsFromSpace(superstate, spaceCache.path, [path2]);
}
});
}
@@ -88347,7 +88247,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
superstate,
offset2,
"",
- (value) => savePathColor(superstate, path3, value)
+ (value) => savePathColor(superstate, path2, value)
);
}
});
@@ -88358,7 +88258,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react11.default.createElement(StickerModal_default, {
ui: superstate.ui,
hide: _props.hide,
- selectedSticker: (emoji) => savePathIcon(superstate, path3, emoji)
+ selectedSticker: (emoji) => savePathIcon(superstate, path2, emoji)
}));
}
});
@@ -88366,7 +88266,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
name: i18n_default.buttons.removeIcon,
icon: "ui//file-minus",
onClick: (e5) => {
- removePathIcon(superstate, path3);
+ removePathIcon(superstate, path2);
}
});
}
@@ -88381,7 +88281,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
saveLabel: i18n_default.buttons.rename,
value: cache2.name,
hide: _props.hide,
- saveValue: (v2) => renamePathByName(superstate, path3, v2)
+ saveValue: (v2) => renamePathByName(superstate, path2, v2)
})
);
}
@@ -88391,7 +88291,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
icon: "ui//documents",
onClick: (e5) => {
superstate.spaceManager.copyPath(
- path3,
+ path2,
`${cache2.parent}/${cache2.name} 1.${cache2.type}`
);
}
@@ -88401,9 +88301,9 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
icon: "ui//paper-plane",
onClick: (e5) => {
const offset2 = e5.target.getBoundingClientRect();
- showSpacesMenu(offset2, superstate, (link3) => {
- const item = superstate.pathsIndex.get(path3);
- superstate.spaceManager.renamePath(path3, movePath(path3, link3));
+ showSpacesMenu(offset2, superstate, (link) => {
+ const item = superstate.pathsIndex.get(path2);
+ superstate.spaceManager.renamePath(path2, movePath(path2, link));
});
}
});
@@ -88413,7 +88313,7 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
name: i18n_default.menu.revealInDefault,
icon: "ui//arrow-up-right",
onClick: (e5) => {
- superstate.ui.openPath(path3, "system");
+ superstate.ui.openPath(path2, "system");
}
});
menuOptions.push(menuSeparator);
@@ -88422,14 +88322,14 @@ var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRenam
name: i18n_default.menu.hide,
icon: "ui//eye-off",
onClick: (e5) => {
- hidePath(superstate, path3);
+ hidePath(superstate, path2);
}
});
menuOptions.push({
name: i18n_default.menu.delete,
icon: "ui//trash",
onClick: (e5) => {
- deletePath(superstate, path3);
+ deletePath(superstate, path2);
}
});
superstate.ui.openMenu(rect, defaultMenu(superstate.ui, menuOptions), anchor);
@@ -88527,14 +88427,14 @@ var NodeType = class {
}
return this.id == name317;
}
- static match(map6) {
+ static match(map4) {
let direct = /* @__PURE__ */ Object.create(null);
- for (let prop2 in map6)
+ for (let prop2 in map4)
for (let name317 of prop2.split(" "))
- direct[name317] = map6[prop2];
- return (node2) => {
- for (let groups = node2.prop(NodeProp.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) {
- let found = direct[i4 < 0 ? node2.name : groups[i4]];
+ direct[name317] = map4[prop2];
+ return (node) => {
+ for (let groups = node.prop(NodeProp.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) {
+ let found = direct[i4 < 0 ? node.name : groups[i4]];
if (found)
return found;
}
@@ -88617,14 +88517,14 @@ var Tree = class {
return new TreeNode2(this, 0, 0, null);
}
resolve(pos, side = 0) {
- let node2 = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);
- CachedNode.set(this, node2);
- return node2;
+ let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);
+ CachedNode.set(this, node);
+ return node;
}
resolveInner(pos, side = 0) {
- let node2 = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);
- CachedInnerNode.set(this, node2);
- return node2;
+ let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);
+ CachedInnerNode.set(this, node);
+ return node;
}
iterate(spec) {
let { enter, leave, from = 0, to: to2 = this.length } = spec;
@@ -88659,15 +88559,15 @@ var Tree = class {
balance(config4 = {}) {
return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config4.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
}
- static build(data3) {
- return buildTree(data3);
+ static build(data2) {
+ return buildTree(data2);
}
};
Tree.empty = new Tree(NodeType.none, [], [], 0);
var FlatBufferCursor = class {
- constructor(buffer2, index3) {
- this.buffer = buffer2;
- this.index = index3;
+ constructor(buffer, index2) {
+ this.buffer = buffer;
+ this.index = index2;
}
get id() {
return this.buffer[this.index - 4];
@@ -88692,8 +88592,8 @@ var FlatBufferCursor = class {
}
};
var TreeBuffer = class {
- constructor(buffer2, length, set) {
- this.buffer = buffer2;
+ constructor(buffer, length, set) {
+ this.buffer = buffer;
this.length = length;
this.set = set;
}
@@ -88702,31 +88602,31 @@ var TreeBuffer = class {
}
toString() {
let result = [];
- for (let index3 = 0; index3 < this.buffer.length; ) {
- result.push(this.childString(index3));
- index3 = this.buffer[index3 + 3];
+ for (let index2 = 0; index2 < this.buffer.length; ) {
+ result.push(this.childString(index2));
+ index2 = this.buffer[index2 + 3];
}
return result.join(",");
}
- childString(index3) {
- let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3];
+ childString(index2) {
+ let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3];
let type = this.set.types[id3], result = type.name;
if (/\W/.test(result) && !type.isError)
result = JSON.stringify(result);
- index3 += 4;
- if (endIndex == index3)
+ index2 += 4;
+ if (endIndex == index2)
return result;
let children = [];
- while (index3 < endIndex) {
- children.push(this.childString(index3));
- index3 = this.buffer[index3 + 3];
+ while (index2 < endIndex) {
+ children.push(this.childString(index2));
+ index2 = this.buffer[index2 + 3];
}
return result + "(" + children.join(",") + ")";
}
findChild(startIndex, endIndex, dir, pos, side) {
- let { buffer: buffer2 } = this, pick = -1;
- for (let i4 = startIndex; i4 != endIndex; i4 = buffer2[i4 + 3]) {
- if (checkSide(side, pos, buffer2[i4 + 1], buffer2[i4 + 2])) {
+ let { buffer } = this, pick = -1;
+ for (let i4 = startIndex; i4 != endIndex; i4 = buffer[i4 + 3]) {
+ if (checkSide(side, pos, buffer[i4 + 1], buffer[i4 + 2])) {
pick = i4;
if (dir > 0)
break;
@@ -88762,47 +88662,47 @@ function checkSide(side, pos, from, to2) {
return true;
}
}
-function enterUnfinishedNodesBefore(node2, pos) {
- let scan = node2.childBefore(pos);
+function enterUnfinishedNodesBefore(node, pos) {
+ let scan = node.childBefore(pos);
while (scan) {
let last = scan.lastChild;
if (!last || last.to != scan.to)
break;
if (last.type.isError && last.from == last.to) {
- node2 = scan;
+ node = scan;
scan = last.prevSibling;
} else {
scan = last;
}
}
- return node2;
+ return node;
}
-function resolveNode(node2, pos, side, overlays) {
+function resolveNode(node, pos, side, overlays) {
var _a;
- while (node2.from == node2.to || (side < 1 ? node2.from >= pos : node2.from > pos) || (side > -1 ? node2.to <= pos : node2.to < pos)) {
- let parent = !overlays && node2 instanceof TreeNode2 && node2.index < 0 ? null : node2.parent;
+ while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) {
+ let parent = !overlays && node instanceof TreeNode2 && node.index < 0 ? null : node.parent;
if (!parent)
- return node2;
- node2 = parent;
+ return node;
+ node = parent;
}
let mode2 = overlays ? 0 : IterMode.IgnoreOverlays;
if (overlays)
- for (let scan = node2, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
+ for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
if (scan instanceof TreeNode2 && scan.index < 0 && ((_a = parent.enter(pos, side, mode2)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)
- node2 = parent;
+ node = parent;
}
for (; ; ) {
- let inner = node2.enter(pos, side, mode2);
+ let inner = node.enter(pos, side, mode2);
if (!inner)
- return node2;
- node2 = inner;
+ return node;
+ node = inner;
}
}
var TreeNode2 = class {
- constructor(_tree, from, index3, _parent) {
+ constructor(_tree, from, index2, _parent) {
this._tree = _tree;
this.from = from;
- this.index = index3;
+ this.index = index2;
this._parent = _parent;
}
get type() {
@@ -88823,9 +88723,9 @@ var TreeNode2 = class {
if (next instanceof TreeBuffer) {
if (mode2 & IterMode.ExcludeBuffers)
continue;
- 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);
+ 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);
} else if (mode2 & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) {
let mounted;
if (!(mode2 & IterMode.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp.mounted)) && !mounted.overlay)
@@ -88918,8 +88818,8 @@ var TreeNode2 = class {
return matchNodeContext(this, context);
}
};
-function getChildren(node2, type, before, after) {
- let cur = node2.cursor(), result = [];
+function getChildren(node, type, before, after) {
+ let cur = node.cursor(), result = [];
if (!cur.firstChild())
return result;
if (before != null) {
@@ -88936,12 +88836,12 @@ function getChildren(node2, type, before, after) {
return after == null ? result : [];
}
}
-function matchNodeContext(node2, context, i4 = context.length - 1) {
- for (let p2 = node2.parent; i4 >= 0; p2 = p2.parent) {
- if (!p2)
+function matchNodeContext(node, context, i4 = context.length - 1) {
+ for (let p = node.parent; i4 >= 0; p = p.parent) {
+ if (!p)
return false;
- if (!p2.type.isAnonymous) {
- if (context[i4] && context[i4] != p2.name)
+ if (!p.type.isAnonymous) {
+ if (context[i4] && context[i4] != p.name)
return false;
i4--;
}
@@ -88949,19 +88849,19 @@ function matchNodeContext(node2, context, i4 = context.length - 1) {
return true;
}
var BufferContext = class {
- constructor(parent, buffer2, index3, start) {
+ constructor(parent, buffer, index2, start) {
this.parent = parent;
- this.buffer = buffer2;
- this.index = index3;
+ this.buffer = buffer;
+ this.index = index2;
this.start = start;
}
};
var BufferNode = class {
- constructor(context, _parent, index3) {
+ constructor(context, _parent, index2) {
this.context = context;
this._parent = _parent;
- this.index = index3;
- this.type = context.buffer.set.types[context.buffer.buffer[index3]];
+ this.index = index2;
+ this.type = context.buffer.set.types[context.buffer.buffer[index2]];
}
get name() {
return this.type.name;
@@ -88973,9 +88873,9 @@ var BufferNode = class {
return this.context.start + this.context.buffer.buffer[this.index + 2];
}
child(dir, pos, side) {
- let { buffer: buffer2 } = this.context;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.context.start, side);
- return index3 < 0 ? null : new BufferNode(this.context, this, index3);
+ 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);
}
get firstChild() {
return this.child(1, 0, 4);
@@ -88992,9 +88892,9 @@ var BufferNode = class {
enter(pos, side, mode2 = 0) {
if (mode2 & IterMode.ExcludeBuffers)
return null;
- let { buffer: buffer2 } = this.context;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side);
- return index3 < 0 ? null : new BufferNode(this.context, this, index3);
+ 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);
}
get parent() {
return this._parent || this.context.parent.nextSignificantParent();
@@ -89003,18 +88903,18 @@ var BufferNode = class {
return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4);
}
get nextSibling() {
- let { buffer: buffer2 } = this.context;
- let after = buffer2.buffer[this.index + 3];
- if (after < (this._parent ? buffer2.buffer[this._parent.index + 3] : buffer2.buffer.length))
+ let { buffer } = this.context;
+ let after = buffer.buffer[this.index + 3];
+ if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))
return new BufferNode(this.context, this._parent, after);
return this.externalSibling(1);
}
get prevSibling() {
- let { buffer: buffer2 } = this.context;
+ let { buffer } = this.context;
let parentStart = this._parent ? this._parent.index + 4 : 0;
if (this.index == parentStart)
return this.externalSibling(-1);
- return new BufferNode(this.context, this._parent, buffer2.findChild(parentStart, this.index, -1, 0, 4));
+ return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4));
}
cursor(mode2 = 0) {
return new TreeCursor(this, mode2);
@@ -89024,11 +88924,11 @@ var BufferNode = class {
}
toTree() {
let children = [], positions = [];
- let { buffer: buffer2 } = this.context;
- let startI = this.index + 4, endI = buffer2.buffer[this.index + 3];
+ let { buffer } = this.context;
+ let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
if (endI > startI) {
- let from = buffer2.buffer[this.index + 1], to2 = buffer2.buffer[this.index + 2];
- children.push(buffer2.slice(startI, endI, from, to2));
+ let from = buffer.buffer[this.index + 1], to2 = buffer.buffer[this.index + 2];
+ children.push(buffer.slice(startI, endI, from, to2));
positions.push(0);
}
return new Tree(this.type, children, positions, this.to - this.from);
@@ -89060,52 +88960,52 @@ var BufferNode = class {
}
};
var TreeCursor = class {
- constructor(node2, mode2 = 0) {
+ constructor(node, mode2 = 0) {
this.mode = mode2;
this.buffer = null;
this.stack = [];
this.index = 0;
this.bufferNode = null;
- if (node2 instanceof TreeNode2) {
- this.yieldNode(node2);
+ if (node instanceof TreeNode2) {
+ this.yieldNode(node);
} else {
- this._tree = node2.context.parent;
- this.buffer = node2.context;
- for (let n3 = node2._parent; n3; n3 = n3._parent)
+ this._tree = node.context.parent;
+ this.buffer = node.context;
+ for (let n3 = node._parent; n3; n3 = n3._parent)
this.stack.unshift(n3.index);
- this.bufferNode = node2;
- this.yieldBuf(node2.index);
+ this.bufferNode = node;
+ this.yieldBuf(node.index);
}
}
get name() {
return this.type.name;
}
- yieldNode(node2) {
- if (!node2)
+ yieldNode(node) {
+ if (!node)
return false;
- this._tree = node2;
- this.type = node2.type;
- this.from = node2.from;
- this.to = node2.to;
+ this._tree = node;
+ this.type = node.type;
+ this.from = node.from;
+ this.to = node.to;
return true;
}
- yieldBuf(index3, type) {
- this.index = index3;
- let { start, buffer: buffer2 } = this.buffer;
- this.type = type || buffer2.set.types[buffer2.buffer[index3]];
- this.from = start + buffer2.buffer[index3 + 1];
- this.to = start + buffer2.buffer[index3 + 2];
+ yieldBuf(index2, type) {
+ this.index = index2;
+ 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];
return true;
}
- yield(node2) {
- if (!node2)
+ yield(node) {
+ if (!node)
return false;
- if (node2 instanceof TreeNode2) {
+ if (node instanceof TreeNode2) {
this.buffer = null;
- return this.yieldNode(node2);
+ return this.yieldNode(node);
}
- this.buffer = node2.context;
- return this.yieldBuf(node2.index, node2.type);
+ this.buffer = node.context;
+ return this.yieldBuf(node.index, node.type);
}
toString() {
return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
@@ -89113,12 +89013,12 @@ var TreeCursor = class {
enterChild(dir, pos, side) {
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: buffer2 } = this.buffer;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.buffer.start, side);
- if (index3 < 0)
+ 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)
return false;
this.stack.push(this.index);
- return this.yieldBuf(index3);
+ return this.yieldBuf(index2);
}
firstChild() {
return this.enterChild(1, 0, 4);
@@ -89149,14 +89049,14 @@ var TreeCursor = class {
sibling(dir) {
if (!this.buffer)
return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode));
- let { buffer: buffer2 } = this.buffer, d4 = this.stack.length - 1;
+ let { buffer } = this.buffer, d4 = this.stack.length - 1;
if (dir < 0) {
let parentStart = d4 < 0 ? 0 : this.stack[d4] + 4;
if (this.index != parentStart)
- return this.yieldBuf(buffer2.findChild(parentStart, this.index, -1, 0, 4));
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4));
} else {
- let after = buffer2.buffer[this.index + 3];
- if (after < (d4 < 0 ? buffer2.buffer.length : buffer2.buffer[this.stack[d4] + 3]))
+ let after = buffer.buffer[this.index + 3];
+ if (after < (d4 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d4] + 3]))
return this.yieldBuf(after);
}
return d4 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false;
@@ -89168,23 +89068,23 @@ var TreeCursor = class {
return this.sibling(-1);
}
atLastNode(dir) {
- let index3, parent, { buffer: buffer2 } = this;
- if (buffer2) {
+ let index2, parent, { buffer } = this;
+ if (buffer) {
if (dir > 0) {
- if (this.index < buffer2.buffer.buffer.length)
+ if (this.index < buffer.buffer.buffer.length)
return false;
} else {
for (let i4 = 0; i4 < this.index; i4++)
- if (buffer2.buffer.buffer[i4 + 3] < this.index)
+ if (buffer.buffer.buffer[i4 + 3] < this.index)
return false;
}
- ({ index: index3, parent } = buffer2);
+ ({ index: index2, parent } = buffer);
} else {
- ({ index: index3, _parent: parent } = this._tree);
+ ({ index: index2, _parent: parent } = this._tree);
}
- 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) {
+ 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) {
let child = parent._tree.children[i4];
if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child))
return false;
@@ -89222,16 +89122,16 @@ var TreeCursor = class {
let cache2 = this.bufferNode, result = null, depth = 0;
if (cache2 && cache2.context == this.buffer) {
scan:
- for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) {
+ for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) {
for (let c3 = cache2; c3; c3 = c3._parent)
- if (c3.index == index3) {
- if (index3 == this.index)
+ if (c3.index == index2) {
+ if (index2 == this.index)
return c3;
result = c3;
depth = d4 + 1;
break scan;
}
- index3 = this.stack[--d4];
+ index2 = this.stack[--d4];
}
}
for (let i4 = depth; i4 < this.stack.length; i4++)
@@ -89269,11 +89169,11 @@ var TreeCursor = class {
matchContext(context) {
if (!this.buffer)
return matchNodeContext(this.node, context);
- let { buffer: buffer2 } = this.buffer, { types: types2 } = buffer2.set;
+ let { buffer } = this.buffer, { types: types2 } = buffer.set;
for (let i4 = context.length - 1, d4 = this.stack.length - 1; i4 >= 0; d4--) {
if (d4 < 0)
return matchNodeContext(this.node, context, i4);
- let type = types2[buffer2.buffer[this.stack[d4]]];
+ let type = types2[buffer.buffer[this.stack[d4]]];
if (!type.isAnonymous) {
if (context[i4] && context[i4] != type.name)
return false;
@@ -89286,10 +89186,10 @@ var TreeCursor = class {
function hasChild(tree) {
return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch));
}
-function buildTree(data3) {
+function buildTree(data2) {
var _a;
- let { buffer: buffer2, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data3;
- let cursor2 = Array.isArray(buffer2) ? new FlatBufferCursor(buffer2, buffer2.length) : buffer2;
+ let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data2;
+ let cursor2 = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer;
let types2 = nodeSet.types;
let contextHash = 0, lookAhead = 0;
function takeNode(parentStart, minPos, children2, positions2, inRepeat) {
@@ -89298,8 +89198,8 @@ function buildTree(data3) {
while (size2 < 0) {
cursor2.next();
if (size2 == -1) {
- let node3 = reused[id3];
- children2.push(node3);
+ let node2 = reused[id3];
+ children2.push(node2);
positions2.push(start - parentStart);
return;
} else if (size2 == -3) {
@@ -89312,15 +89212,15 @@ function buildTree(data3) {
throw new RangeError(`Unrecognized record size: ${size2}`);
}
}
- let type = types2[id3], node2, buffer3;
+ let type = types2[id3], node, buffer2;
let startPos = start - parentStart;
- if (end - start <= maxBufferLength && (buffer3 = findBufferSize(cursor2.pos - minPos, inRepeat))) {
- let data4 = new Uint16Array(buffer3.size - buffer3.skip);
- let endPos = cursor2.pos - buffer3.size, index3 = data4.length;
+ 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;
while (cursor2.pos > endPos)
- index3 = copyToBuffer(buffer3.start, data4, index3);
- node2 = new TreeBuffer(data4, end - buffer3.start, nodeSet);
- startPos = buffer3.start - parentStart;
+ index2 = copyToBuffer(buffer2.start, data3, index2);
+ node = new TreeBuffer(data3, end - buffer2.start, nodeSet);
+ startPos = buffer2.start - parentStart;
} else {
let endPos = cursor2.pos - size2;
cursor2.next();
@@ -89345,12 +89245,12 @@ function buildTree(data3) {
localPositions.reverse();
if (localInRepeat > -1 && lastGroup > 0) {
let make = makeBalanced(type);
- node2 = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);
+ node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);
} else {
- node2 = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);
+ node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);
}
}
- children2.push(node2);
+ children2.push(node);
positions2.push(startPos);
}
function makeBalanced(type) {
@@ -89365,14 +89265,14 @@ function buildTree(data3) {
return makeTree(type, children2, positions2, length2, lookAhead2);
};
}
- function makeRepeatLeaf(children2, positions2, base3, i4, from, to2, type, lookAhead2) {
+ function makeRepeatLeaf(children2, positions2, base2, i4, from, to2, type, lookAhead2) {
let localChildren = [], localPositions = [];
while (children2.length > i4) {
localChildren.push(children2.pop());
- localPositions.push(positions2.pop() + base3 - from);
+ localPositions.push(positions2.pop() + base2 - from);
}
children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to2 - from, lookAhead2 - to2));
- positions2.push(from - base3);
+ positions2.push(from - base2);
}
function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) {
if (contextHash) {
@@ -89429,48 +89329,48 @@ function buildTree(data3) {
}
return result.size > 4 ? result : void 0;
}
- function copyToBuffer(bufferStart, buffer3, index3) {
+ function copyToBuffer(bufferStart, buffer2, index2) {
let { id: id3, start, end, size: size2 } = cursor2;
cursor2.next();
if (size2 >= 0 && id3 < minRepeatType) {
- let startIndex = index3;
+ let startIndex = index2;
if (size2 > 4) {
let endPos = cursor2.pos - (size2 - 4);
while (cursor2.pos > endPos)
- index3 = copyToBuffer(bufferStart, buffer3, index3);
+ index2 = copyToBuffer(bufferStart, buffer2, index2);
}
- buffer3[--index3] = startIndex;
- buffer3[--index3] = end - bufferStart;
- buffer3[--index3] = start - bufferStart;
- buffer3[--index3] = id3;
+ buffer2[--index2] = startIndex;
+ buffer2[--index2] = end - bufferStart;
+ buffer2[--index2] = start - bufferStart;
+ buffer2[--index2] = id3;
} else if (size2 == -3) {
contextHash = id3;
} else if (size2 == -4) {
lookAhead = id3;
}
- return index3;
+ return index2;
}
let children = [], positions = [];
while (cursor2.pos > 0)
- takeNode(data3.start || 0, data3.bufferStart || 0, children, positions, -1);
- let length = (_a = data3.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
- return new Tree(types2[data3.topID], children.reverse(), positions.reverse(), length);
+ takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1);
+ let length = (_a = data2.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
+ return new Tree(types2[data2.topID], children.reverse(), positions.reverse(), length);
}
var nodeSizeCache = /* @__PURE__ */ new WeakMap();
-function nodeSize(balanceType, node2) {
- if (!balanceType.isAnonymous || node2 instanceof TreeBuffer || node2.type != balanceType)
+function nodeSize(balanceType, node) {
+ if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType)
return 1;
- let size2 = nodeSizeCache.get(node2);
+ let size2 = nodeSizeCache.get(node);
if (size2 == null) {
size2 = 1;
- for (let child of node2.children) {
+ for (let child of node.children) {
if (child.type != balanceType || !(child instanceof Tree)) {
size2 = 1;
break;
}
size2 += nodeSize(balanceType, child);
}
- nodeSizeCache.set(node2, size2);
+ nodeSizeCache.set(node, size2);
}
return size2;
}
@@ -89515,17 +89415,17 @@ var Parser4 = class {
return this.createParse(input, fragments || [], ranges);
}
parse(input, fragments, ranges) {
- let parse8 = this.startParse(input, fragments, ranges);
+ let parse7 = this.startParse(input, fragments, ranges);
for (; ; ) {
- let done = parse8.advance();
+ let done = parse7.advance();
if (done)
return done;
}
}
};
var StringInput = class {
- constructor(string6) {
- this.string = string6;
+ constructor(string4) {
+ this.string = string4;
}
get length() {
return this.string.length;
@@ -89544,14 +89444,14 @@ var stoppedInner = new NodeProp({ perNode: true });
// node_modules/@lezer/javascript/node_modules/@lezer/lr/dist/index.js
var Stack = class {
- constructor(p2, stack, state, reducePos, pos, score, buffer2, bufferBase, curContext, lookAhead = 0, parent) {
- this.p = p2;
+ constructor(p, stack, state, reducePos, pos, score, buffer, bufferBase, curContext, lookAhead = 0, parent) {
+ this.p = p;
this.stack = stack;
this.state = state;
this.reducePos = reducePos;
this.pos = pos;
this.score = score;
- this.buffer = buffer2;
+ this.buffer = buffer;
this.bufferBase = bufferBase;
this.curContext = curContext;
this.lookAhead = lookAhead;
@@ -89560,9 +89460,9 @@ var Stack = class {
toString() {
return `[${this.stack.filter((_15, i4) => i4 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`;
}
- static start(p2, state, pos = 0) {
- let cx = p2.parser.context;
- return new Stack(p2, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null);
+ static start(p, state, pos = 0) {
+ let cx = p.parser.context;
+ return new Stack(p, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null);
}
get context() {
return this.curContext ? this.curContext.context : null;
@@ -89584,20 +89484,20 @@ var Stack = class {
this.reduceContext(type, this.reducePos);
return;
}
- let base3 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0);
- let start = this.stack[base3 - 2];
- let bufferBase = this.stack[base3 - 1], count3 = this.bufferBase + this.buffer.length - bufferBase;
+ let base2 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0);
+ let start = this.stack[base2 - 2];
+ let bufferBase = this.stack[base2 - 1], count3 = this.bufferBase + this.buffer.length - bufferBase;
if (type < parser3.minRepeatTerm || action & 131072) {
let pos = parser3.stateFlag(this.state, 1) ? this.pos : this.reducePos;
this.storeNode(type, start, pos, count3 + 4, true);
}
if (action & 262144) {
- this.state = this.stack[base3];
+ this.state = this.stack[base2];
} else {
- let baseStateID = this.stack[base3 - 3];
+ let baseStateID = this.stack[base2 - 3];
this.state = parser3.getGoto(baseStateID, type, true);
}
- while (this.stack.length > base3)
+ while (this.stack.length > base2)
this.stack.pop();
this.reduceContext(type, start);
}
@@ -89620,21 +89520,21 @@ var Stack = class {
if (!isReduce || this.pos == end) {
this.buffer.push(term, start, end, size2);
} else {
- 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;
+ 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;
if (size2 > 4)
size2 -= 4;
}
- this.buffer[index3] = term;
- this.buffer[index3 + 1] = start;
- this.buffer[index3 + 2] = end;
- this.buffer[index3 + 3] = size2;
+ this.buffer[index2] = term;
+ this.buffer[index2 + 1] = start;
+ this.buffer[index2 + 2] = end;
+ this.buffer[index2 + 3] = size2;
}
}
shift(action, next, nextEnd) {
@@ -89666,15 +89566,15 @@ var Stack = class {
this.shift(action, next, nextEnd);
}
useNode(value, next) {
- let index3 = this.p.reused.length - 1;
- if (index3 < 0 || this.p.reused[index3] != value) {
+ let index2 = this.p.reused.length - 1;
+ if (index2 < 0 || this.p.reused[index2] != value) {
this.p.reused.push(value);
- index3++;
+ index2++;
}
let start = this.pos;
this.reducePos = this.pos = start + value.length;
this.pushState(next, start);
- this.buffer.push(index3, start, this.reducePos, -1);
+ this.buffer.push(index2, 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)));
}
@@ -89683,10 +89583,10 @@ var Stack = class {
let off = parent.buffer.length;
while (off > 0 && parent.buffer[off - 2] > parent.reducePos)
off -= 4;
- let buffer2 = parent.buffer.slice(off), base3 = parent.bufferBase + off;
- while (parent && base3 == parent.bufferBase)
+ let buffer = parent.buffer.slice(off), base2 = parent.bufferBase + off;
+ while (parent && base2 == parent.bufferBase)
parent = parent.parent;
- return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer2, base3, this.curContext, this.lookAhead, parent);
+ return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base2, this.curContext, this.lookAhead, parent);
}
recoverByDelete(next, nextEnd) {
let isNode3 = next <= this.p.parser.maxNode;
@@ -89865,10 +89765,10 @@ var SimulatedStack = class {
}
};
var StackBufferCursor = class {
- constructor(stack, pos, index3) {
+ constructor(stack, pos, index2) {
this.stack = stack;
this.pos = pos;
- this.index = index3;
+ this.index = index2;
this.buffer = stack.buffer;
if (this.index == 0)
this.maybeNext();
@@ -89935,19 +89835,19 @@ var InputStream = class {
this.readNext();
}
resolveOffset(offset2, assoc) {
- let range2 = this.range, index3 = this.rangeIndex;
+ let range2 = this.range, index2 = this.rangeIndex;
let pos = this.pos + offset2;
while (pos < range2.from) {
- if (!index3)
+ if (!index2)
return null;
- let next = this.ranges[--index3];
+ let next = this.ranges[--index2];
pos -= range2.from - next.to;
range2 = next;
}
while (assoc < 0 ? pos > range2.to : pos >= range2.to) {
- if (index3 == this.ranges.length - 1)
+ if (index2 == this.ranges.length - 1)
return null;
- let next = this.ranges[++index3];
+ let next = this.ranges[++index2];
pos += next.from - range2.to;
range2 = next;
}
@@ -90079,8 +89979,8 @@ var InputStream = class {
}
};
var TokenGroup = class {
- constructor(data3, id3) {
- this.data = data3;
+ constructor(data2, id3) {
+ this.data = data2;
this.id = id3;
}
token(input, stack) {
@@ -90096,31 +89996,31 @@ var ExternalTokenizer = class {
this.extend = !!options.extend;
}
};
-function readToken(data3, input, stack, group) {
+function readToken(data2, input, stack, group) {
let state = 0, groupMask = 1 << group, { parser: parser3 } = stack.p, { dialect } = parser3;
scan:
for (; ; ) {
- if ((groupMask & data3[state]) == 0)
+ if ((groupMask & data2[state]) == 0)
break;
- let accEnd = data3[state + 1];
+ let accEnd = data2[state + 1];
for (let i4 = state + 3; i4 < accEnd; i4 += 2)
- if ((data3[i4 + 1] & groupMask) > 0) {
- let term = data3[i4];
+ if ((data2[i4 + 1] & groupMask) > 0) {
+ let term = data2[i4];
if (dialect.allows(term) && (input.token.value == -1 || input.token.value == term || parser3.overrides(term, input.token.value))) {
input.acceptToken(term);
break;
}
}
- for (let next = input.next, low = 0, high = data3[state + 2]; low < high; ) {
+ for (let next = input.next, low = 0, high = data2[state + 2]; low < high; ) {
let mid = low + high >> 1;
- let index3 = accEnd + mid + (mid << 1);
- let from = data3[index3], to2 = data3[index3 + 1];
+ let index2 = accEnd + mid + (mid << 1);
+ let from = data2[index2], to2 = data2[index2 + 1];
if (next < from)
high = mid;
else if (next >= to2)
low = mid + 1;
else {
- state = data3[index3 + 2];
+ state = data2[index2 + 2];
input.advance();
continue scan;
}
@@ -90226,15 +90126,15 @@ var FragmentCursor = class {
this.nextFragment();
return null;
}
- let top = this.trees[last], index3 = this.index[last];
- if (index3 == top.children.length) {
+ let top = this.trees[last], index2 = this.index[last];
+ if (index2 == top.children.length) {
this.trees.pop();
this.start.pop();
this.index.pop();
continue;
}
- let next = top.children[index3];
- let start = this.start[last] + top.positions[index3];
+ let next = top.children[index2];
+ let start = this.start[last] + top.positions[index2];
if (start > pos) {
this.nextStart = start;
return null;
@@ -90319,10 +90219,10 @@ var TokenCache = class {
getMainToken(stack) {
if (this.mainToken)
return this.mainToken;
- let main = new CachedToken(), { pos, p: p2 } = stack;
+ let main = new CachedToken(), { pos, p } = stack;
main.start = pos;
- main.end = Math.min(pos + 1, p2.stream.end);
- main.value = pos == p2.stream.end ? p2.parser.eofTerm : 0;
+ main.end = Math.min(pos + 1, p.stream.end);
+ main.value = pos == p.stream.end ? p.parser.eofTerm : 0;
return main;
}
updateCachedToken(token, tokenizer2, stack) {
@@ -90345,33 +90245,33 @@ var TokenCache = class {
token.end = Math.min(stack.p.stream.end, stack.pos + 1);
}
}
- putAction(action, token, end, index3) {
- for (let i4 = 0; i4 < index3; i4 += 3)
+ putAction(action, token, end, index2) {
+ for (let i4 = 0; i4 < index2; i4 += 3)
if (this.actions[i4] == action)
- return index3;
- this.actions[index3++] = action;
- this.actions[index3++] = token;
- this.actions[index3++] = end;
- return index3;
- }
- addActions(stack, token, end, index3) {
- let { state } = stack, { parser: parser3 } = stack.p, { data: data3 } = parser3;
+ return index2;
+ this.actions[index2++] = action;
+ this.actions[index2++] = token;
+ this.actions[index2++] = end;
+ return index2;
+ }
+ addActions(stack, token, end, index2) {
+ 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) {
- if (data3[i4] == 65535) {
- if (data3[i4 + 1] == 1) {
- i4 = pair(data3, i4 + 2);
+ if (data2[i4] == 65535) {
+ if (data2[i4 + 1] == 1) {
+ i4 = pair(data2, i4 + 2);
} else {
- if (index3 == 0 && data3[i4 + 1] == 2)
- index3 = this.putAction(pair(data3, i4 + 2), token, end, index3);
+ if (index2 == 0 && data2[i4 + 1] == 2)
+ index2 = this.putAction(pair(data2, i4 + 2), token, end, index2);
break;
}
}
- if (data3[i4] == token)
- index3 = this.putAction(pair(data3, i4 + 1), token, end, index3);
+ if (data2[i4] == token)
+ index2 = this.putAction(pair(data2, i4 + 1), token, end, index2);
}
}
- return index3;
+ return index2;
}
};
var Rec;
@@ -90483,7 +90383,7 @@ var Parse = class {
}
advanceStack(stack, stacks, split) {
let start = stack.pos, { parser: parser3 } = this;
- let base3 = verbose ? this.stackID(stack) + " -> " : "";
+ let base2 = verbose ? this.stackID(stack) + " -> " : "";
if (this.stoppedAt != null && start > this.stoppedAt)
return stack.forceReduce() ? stack : null;
if (this.fragments) {
@@ -90493,7 +90393,7 @@ var Parse = class {
if (match2 > -1 && cached.length && (!strictCx || (cached.prop(NodeProp.contextHash) || 0) == cxHash)) {
stack.useNode(cached, match2);
if (verbose)
- console.log(base3 + this.stackID(stack) + ` (via reuse of ${parser3.getName(cached.type.id)})`);
+ console.log(base2 + this.stackID(stack) + ` (via reuse of ${parser3.getName(cached.type.id)})`);
return true;
}
if (!(cached instanceof Tree) || cached.children.length == 0 || cached.positions[0] > 0)
@@ -90509,7 +90409,7 @@ var Parse = class {
if (defaultReduce > 0) {
stack.reduce(defaultReduce);
if (verbose)
- console.log(base3 + this.stackID(stack) + ` (via always-reduce ${parser3.getName(defaultReduce & 65535)})`);
+ console.log(base2 + this.stackID(stack) + ` (via always-reduce ${parser3.getName(defaultReduce & 65535)})`);
return true;
}
if (stack.stack.length >= 15e3) {
@@ -90523,7 +90423,7 @@ var Parse = class {
let localStack = last ? stack : stack.split();
localStack.apply(action, term, end);
if (verbose)
- console.log(base3 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser3.getName(action & 65535)}`} for ${parser3.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
+ console.log(base2 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser3.getName(action & 65535)}`} for ${parser3.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
if (last)
return true;
else if (localStack.pos > start)
@@ -90548,19 +90448,19 @@ var Parse = class {
let finished = null, restarted = false;
for (let i4 = 0; i4 < stacks.length; i4++) {
let stack = stacks[i4], token = tokens[i4 << 1], tokenEnd = tokens[(i4 << 1) + 1];
- let base3 = verbose ? this.stackID(stack) + " -> " : "";
+ let base2 = verbose ? this.stackID(stack) + " -> " : "";
if (stack.deadEnd) {
if (restarted)
continue;
restarted = true;
stack.restart();
if (verbose)
- console.log(base3 + this.stackID(stack) + " (restarted)");
+ console.log(base2 + this.stackID(stack) + " (restarted)");
let done = this.advanceFully(stack, newStacks);
if (done)
continue;
}
- let force = stack.split(), forceBase = base3;
+ let force = stack.split(), forceBase = base2;
for (let j = 0; force.forceReduce() && j < 10; j++) {
if (verbose)
console.log(forceBase + this.stackID(force) + " (via force-reduce)");
@@ -90572,7 +90472,7 @@ var Parse = class {
}
for (let insert2 of stack.recoverByInsert(token)) {
if (verbose)
- console.log(base3 + this.stackID(insert2) + " (via recover-insert)");
+ console.log(base2 + this.stackID(insert2) + " (via recover-insert)");
this.advanceFully(insert2, newStacks);
}
if (this.stream.end > stack.pos) {
@@ -90582,7 +90482,7 @@ var Parse = class {
}
stack.recoverByDelete(token, tokenEnd);
if (verbose)
- console.log(base3 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`);
+ console.log(base2 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`);
pushStackDedup(stack, newStacks);
} else if (!finished || finished.score < stack.score) {
finished = stack;
@@ -90712,41 +90612,41 @@ var LRParser = class extends Parser4 {
this.top = this.topRules[Object.keys(this.topRules)[0]];
}
createParse(input, fragments, ranges) {
- let parse8 = new Parse(this, input, fragments, ranges);
+ let parse7 = new Parse(this, input, fragments, ranges);
for (let w2 of this.wrappers)
- parse8 = w2(parse8, input, fragments, ranges);
- return parse8;
+ parse7 = w2(parse7, input, fragments, ranges);
+ return parse7;
}
getGoto(state, term, loose = false) {
- let table2 = this.goto;
- if (term >= table2[0])
+ let table = this.goto;
+ if (term >= table[0])
return -1;
- for (let pos = table2[term + 1]; ; ) {
- let groupTag = table2[pos++], last = groupTag & 1;
- let target = table2[pos++];
+ for (let pos = table[term + 1]; ; ) {
+ let groupTag = table[pos++], last = groupTag & 1;
+ let target = table[pos++];
if (last && loose)
return target;
for (let end = pos + (groupTag >> 1); pos < end; pos++)
- if (table2[pos] == state)
+ if (table[pos] == state)
return target;
if (last)
return -1;
}
}
hasAction(state, terminal) {
- let data3 = this.data;
+ let data2 = this.data;
for (let set = 0; set < 2; set++) {
for (let i4 = this.stateSlot(state, set ? 2 : 1), next; ; i4 += 3) {
- if ((next = data3[i4]) == 65535) {
- if (data3[i4 + 1] == 1)
- next = data3[i4 = pair(data3, i4 + 2)];
- else if (data3[i4 + 1] == 2)
- return pair(data3, i4 + 2);
+ if ((next = data2[i4]) == 65535) {
+ if (data2[i4 + 1] == 1)
+ next = data2[i4 = pair(data2, i4 + 2)];
+ else if (data2[i4 + 1] == 2)
+ return pair(data2, i4 + 2);
else
break;
}
if (next == terminal || next == 0)
- return pair(data3, i4 + 1);
+ return pair(data2, i4 + 1);
}
}
return 0;
@@ -90855,11 +90755,11 @@ var LRParser = class extends Parser4 {
return new LRParser(spec);
}
};
-function pair(data3, off) {
- return data3[off] | data3[off + 1] << 16;
+function pair(data2, off) {
+ return data2[off] | data2[off + 1] << 16;
}
-function findOffset(data3, start, term) {
- for (let i4 = start, next; (next = data3[i4]) != 65535; i4++)
+function findOffset(data2, start, term) {
+ for (let i4 = start, next; (next = data2[i4]) != 65535; i4++)
if (next == term)
return i4 - start;
return -1;
@@ -90877,9 +90777,9 @@ function findFinished(stacks) {
// node_modules/@lezer/javascript/node_modules/@lezer/highlight/dist/index.js
var nextTagID = 0;
var Tag = class {
- constructor(set, base3, modified) {
+ constructor(set, base2, modified) {
this.set = set;
- this.base = base3;
+ this.base = base2;
this.modified = modified;
this.id = nextTagID++;
}
@@ -90908,17 +90808,17 @@ var Modifier = class {
this.instances = [];
this.id = nextModifierID++;
}
- static get(base3, mods) {
+ static get(base2, mods) {
if (!mods.length)
- return base3;
- let exists = mods[0].instances.find((t5) => t5.base == base3 && sameArray(mods, t5.modified));
+ return base2;
+ let exists = mods[0].instances.find((t5) => t5.base == base2 && sameArray(mods, t5.modified));
if (exists)
return exists;
- let set = [], tag2 = new Tag(set, base3, mods);
+ let set = [], tag2 = new Tag(set, base2, mods);
for (let m4 of mods)
m4.instances.push(tag2);
let configs = permute(mods);
- for (let parent of base3.set)
+ for (let parent of base2.set)
for (let config4 of configs)
set.push(Modifier.get(parent, config4));
return tag2;
@@ -90995,21 +90895,21 @@ var Rule = class {
}
};
function tagHighlighter(tags3, options) {
- let map6 = /* @__PURE__ */ Object.create(null);
+ let map4 = /* @__PURE__ */ Object.create(null);
for (let style of tags3) {
if (!Array.isArray(style.tag))
- map6[style.tag.id] = style.class;
+ map4[style.tag.id] = style.class;
else
for (let tag2 of style.tag)
- map6[tag2.id] = style.class;
+ map4[tag2.id] = style.class;
}
- let { scope, all: all6 = null } = options || {};
+ let { scope, all: all2 = null } = options || {};
return {
style: (tags4) => {
- let cls = all6;
+ let cls = all2;
for (let tag2 of tags4) {
for (let sub2 of tag2.set) {
- let tagClass = map6[sub2.id];
+ let tagClass = map4[sub2.id];
if (tagClass) {
cls = cls ? cls + " " + tagClass : tagClass;
break;
@@ -91434,14 +91334,14 @@ var NodeType2 = class {
}
return this.id == name317;
}
- static match(map6) {
+ static match(map4) {
let direct = /* @__PURE__ */ Object.create(null);
- for (let prop2 in map6)
+ for (let prop2 in map4)
for (let name317 of prop2.split(" "))
- direct[name317] = map6[prop2];
- return (node2) => {
- for (let groups = node2.prop(NodeProp2.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) {
- let found = direct[i4 < 0 ? node2.name : groups[i4]];
+ direct[name317] = map4[prop2];
+ return (node) => {
+ for (let groups = node.prop(NodeProp2.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) {
+ let found = direct[i4 < 0 ? node.name : groups[i4]];
if (found)
return found;
}
@@ -91500,14 +91400,14 @@ var Tree2 = class {
return new TreeNode3(this, 0, 0, null);
}
resolve(pos, side = 0) {
- let node2 = resolveNode2(CachedNode2.get(this) || this.topNode, pos, side, false);
- CachedNode2.set(this, node2);
- return node2;
+ let node = resolveNode2(CachedNode2.get(this) || this.topNode, pos, side, false);
+ CachedNode2.set(this, node);
+ return node;
}
resolveInner(pos, side = 0) {
- let node2 = resolveNode2(CachedInnerNode2.get(this) || this.topNode, pos, side, true);
- CachedInnerNode2.set(this, node2);
- return node2;
+ let node = resolveNode2(CachedInnerNode2.get(this) || this.topNode, pos, side, true);
+ CachedInnerNode2.set(this, node);
+ return node;
}
iterate(spec) {
let { enter, leave, from = 0, to: to2 = this.length } = spec;
@@ -91542,15 +91442,15 @@ var Tree2 = class {
balance(config4 = {}) {
return this.children.length <= 8 ? this : balanceRange2(NodeType2.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree2(this.type, children, positions, length, this.propValues), config4.makeTree || ((children, positions, length) => new Tree2(NodeType2.none, children, positions, length)));
}
- static build(data3) {
- return buildTree2(data3);
+ static build(data2) {
+ return buildTree2(data2);
}
};
Tree2.empty = new Tree2(NodeType2.none, [], [], 0);
var FlatBufferCursor2 = class {
- constructor(buffer2, index3) {
- this.buffer = buffer2;
- this.index = index3;
+ constructor(buffer, index2) {
+ this.buffer = buffer;
+ this.index = index2;
}
get id() {
return this.buffer[this.index - 4];
@@ -91575,8 +91475,8 @@ var FlatBufferCursor2 = class {
}
};
var TreeBuffer2 = class {
- constructor(buffer2, length, set) {
- this.buffer = buffer2;
+ constructor(buffer, length, set) {
+ this.buffer = buffer;
this.length = length;
this.set = set;
}
@@ -91585,31 +91485,31 @@ var TreeBuffer2 = class {
}
toString() {
let result = [];
- for (let index3 = 0; index3 < this.buffer.length; ) {
- result.push(this.childString(index3));
- index3 = this.buffer[index3 + 3];
+ for (let index2 = 0; index2 < this.buffer.length; ) {
+ result.push(this.childString(index2));
+ index2 = this.buffer[index2 + 3];
}
return result.join(",");
}
- childString(index3) {
- let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3];
+ childString(index2) {
+ let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3];
let type = this.set.types[id3], result = type.name;
if (/\W/.test(result) && !type.isError)
result = JSON.stringify(result);
- index3 += 4;
- if (endIndex == index3)
+ index2 += 4;
+ if (endIndex == index2)
return result;
let children = [];
- while (index3 < endIndex) {
- children.push(this.childString(index3));
- index3 = this.buffer[index3 + 3];
+ while (index2 < endIndex) {
+ children.push(this.childString(index2));
+ index2 = this.buffer[index2 + 3];
}
return result + "(" + children.join(",") + ")";
}
findChild(startIndex, endIndex, dir, pos, side) {
- let { buffer: buffer2 } = this, pick = -1;
- for (let i4 = startIndex; i4 != endIndex; i4 = buffer2[i4 + 3]) {
- if (checkSide2(side, pos, buffer2[i4 + 1], buffer2[i4 + 2])) {
+ let { buffer } = this, pick = -1;
+ for (let i4 = startIndex; i4 != endIndex; i4 = buffer[i4 + 3]) {
+ if (checkSide2(side, pos, buffer[i4 + 1], buffer[i4 + 2])) {
pick = i4;
if (dir > 0)
break;
@@ -91645,47 +91545,47 @@ function checkSide2(side, pos, from, to2) {
return true;
}
}
-function enterUnfinishedNodesBefore2(node2, pos) {
- let scan = node2.childBefore(pos);
+function enterUnfinishedNodesBefore2(node, pos) {
+ let scan = node.childBefore(pos);
while (scan) {
let last = scan.lastChild;
if (!last || last.to != scan.to)
break;
if (last.type.isError && last.from == last.to) {
- node2 = scan;
+ node = scan;
scan = last.prevSibling;
} else {
scan = last;
}
}
- return node2;
+ return node;
}
-function resolveNode2(node2, pos, side, overlays) {
+function resolveNode2(node, pos, side, overlays) {
var _a;
- while (node2.from == node2.to || (side < 1 ? node2.from >= pos : node2.from > pos) || (side > -1 ? node2.to <= pos : node2.to < pos)) {
- let parent = !overlays && node2 instanceof TreeNode3 && node2.index < 0 ? null : node2.parent;
+ while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) {
+ let parent = !overlays && node instanceof TreeNode3 && node.index < 0 ? null : node.parent;
if (!parent)
- return node2;
- node2 = parent;
+ return node;
+ node = parent;
}
let mode2 = overlays ? 0 : IterMode2.IgnoreOverlays;
if (overlays)
- for (let scan = node2, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
+ for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
if (scan instanceof TreeNode3 && scan.index < 0 && ((_a = parent.enter(pos, side, mode2)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)
- node2 = parent;
+ node = parent;
}
for (; ; ) {
- let inner = node2.enter(pos, side, mode2);
+ let inner = node.enter(pos, side, mode2);
if (!inner)
- return node2;
- node2 = inner;
+ return node;
+ node = inner;
}
}
var TreeNode3 = class {
- constructor(_tree, from, index3, _parent) {
+ constructor(_tree, from, index2, _parent) {
this._tree = _tree;
this.from = from;
- this.index = index3;
+ this.index = index2;
this._parent = _parent;
}
get type() {
@@ -91706,9 +91606,9 @@ var TreeNode3 = class {
if (next instanceof TreeBuffer2) {
if (mode2 & IterMode2.ExcludeBuffers)
continue;
- 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);
+ 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);
} 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)
@@ -91801,8 +91701,8 @@ var TreeNode3 = class {
return matchNodeContext2(this, context);
}
};
-function getChildren2(node2, type, before, after) {
- let cur = node2.cursor(), result = [];
+function getChildren2(node, type, before, after) {
+ let cur = node.cursor(), result = [];
if (!cur.firstChild())
return result;
if (before != null) {
@@ -91819,12 +91719,12 @@ function getChildren2(node2, type, before, after) {
return after == null ? result : [];
}
}
-function matchNodeContext2(node2, context, i4 = context.length - 1) {
- for (let p2 = node2.parent; i4 >= 0; p2 = p2.parent) {
- if (!p2)
+function matchNodeContext2(node, context, i4 = context.length - 1) {
+ for (let p = node.parent; i4 >= 0; p = p.parent) {
+ if (!p)
return false;
- if (!p2.type.isAnonymous) {
- if (context[i4] && context[i4] != p2.name)
+ if (!p.type.isAnonymous) {
+ if (context[i4] && context[i4] != p.name)
return false;
i4--;
}
@@ -91832,19 +91732,19 @@ function matchNodeContext2(node2, context, i4 = context.length - 1) {
return true;
}
var BufferContext2 = class {
- constructor(parent, buffer2, index3, start) {
+ constructor(parent, buffer, index2, start) {
this.parent = parent;
- this.buffer = buffer2;
- this.index = index3;
+ this.buffer = buffer;
+ this.index = index2;
this.start = start;
}
};
var BufferNode2 = class {
- constructor(context, _parent, index3) {
+ constructor(context, _parent, index2) {
this.context = context;
this._parent = _parent;
- this.index = index3;
- this.type = context.buffer.set.types[context.buffer.buffer[index3]];
+ this.index = index2;
+ this.type = context.buffer.set.types[context.buffer.buffer[index2]];
}
get name() {
return this.type.name;
@@ -91856,9 +91756,9 @@ var BufferNode2 = class {
return this.context.start + this.context.buffer.buffer[this.index + 2];
}
child(dir, pos, side) {
- let { buffer: buffer2 } = this.context;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.context.start, side);
- return index3 < 0 ? null : new BufferNode2(this.context, this, index3);
+ 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);
}
get firstChild() {
return this.child(1, 0, 4);
@@ -91875,9 +91775,9 @@ var BufferNode2 = class {
enter(pos, side, mode2 = 0) {
if (mode2 & IterMode2.ExcludeBuffers)
return null;
- let { buffer: buffer2 } = this.context;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side);
- return index3 < 0 ? null : new BufferNode2(this.context, this, index3);
+ 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);
}
get parent() {
return this._parent || this.context.parent.nextSignificantParent();
@@ -91886,18 +91786,18 @@ var BufferNode2 = class {
return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4);
}
get nextSibling() {
- let { buffer: buffer2 } = this.context;
- let after = buffer2.buffer[this.index + 3];
- if (after < (this._parent ? buffer2.buffer[this._parent.index + 3] : buffer2.buffer.length))
+ let { buffer } = this.context;
+ let after = buffer.buffer[this.index + 3];
+ if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))
return new BufferNode2(this.context, this._parent, after);
return this.externalSibling(1);
}
get prevSibling() {
- let { buffer: buffer2 } = this.context;
+ let { buffer } = this.context;
let parentStart = this._parent ? this._parent.index + 4 : 0;
if (this.index == parentStart)
return this.externalSibling(-1);
- return new BufferNode2(this.context, this._parent, buffer2.findChild(parentStart, this.index, -1, 0, 4));
+ return new BufferNode2(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4));
}
cursor(mode2 = 0) {
return new TreeCursor2(this, mode2);
@@ -91907,11 +91807,11 @@ var BufferNode2 = class {
}
toTree() {
let children = [], positions = [];
- let { buffer: buffer2 } = this.context;
- let startI = this.index + 4, endI = buffer2.buffer[this.index + 3];
+ let { buffer } = this.context;
+ let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
if (endI > startI) {
- let from = buffer2.buffer[this.index + 1], to2 = buffer2.buffer[this.index + 2];
- children.push(buffer2.slice(startI, endI, from, to2));
+ let from = buffer.buffer[this.index + 1], to2 = buffer.buffer[this.index + 2];
+ children.push(buffer.slice(startI, endI, from, to2));
positions.push(0);
}
return new Tree2(this.type, children, positions, this.to - this.from);
@@ -91943,52 +91843,52 @@ var BufferNode2 = class {
}
};
var TreeCursor2 = class {
- constructor(node2, mode2 = 0) {
+ constructor(node, mode2 = 0) {
this.mode = mode2;
this.buffer = null;
this.stack = [];
this.index = 0;
this.bufferNode = null;
- if (node2 instanceof TreeNode3) {
- this.yieldNode(node2);
+ if (node instanceof TreeNode3) {
+ this.yieldNode(node);
} else {
- this._tree = node2.context.parent;
- this.buffer = node2.context;
- for (let n3 = node2._parent; n3; n3 = n3._parent)
+ this._tree = node.context.parent;
+ this.buffer = node.context;
+ for (let n3 = node._parent; n3; n3 = n3._parent)
this.stack.unshift(n3.index);
- this.bufferNode = node2;
- this.yieldBuf(node2.index);
+ this.bufferNode = node;
+ this.yieldBuf(node.index);
}
}
get name() {
return this.type.name;
}
- yieldNode(node2) {
- if (!node2)
+ yieldNode(node) {
+ if (!node)
return false;
- this._tree = node2;
- this.type = node2.type;
- this.from = node2.from;
- this.to = node2.to;
+ this._tree = node;
+ this.type = node.type;
+ this.from = node.from;
+ this.to = node.to;
return true;
}
- yieldBuf(index3, type) {
- this.index = index3;
- let { start, buffer: buffer2 } = this.buffer;
- this.type = type || buffer2.set.types[buffer2.buffer[index3]];
- this.from = start + buffer2.buffer[index3 + 1];
- this.to = start + buffer2.buffer[index3 + 2];
+ yieldBuf(index2, type) {
+ this.index = index2;
+ 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];
return true;
}
- yield(node2) {
- if (!node2)
+ yield(node) {
+ if (!node)
return false;
- if (node2 instanceof TreeNode3) {
+ if (node instanceof TreeNode3) {
this.buffer = null;
- return this.yieldNode(node2);
+ return this.yieldNode(node);
}
- this.buffer = node2.context;
- return this.yieldBuf(node2.index, node2.type);
+ this.buffer = node.context;
+ return this.yieldBuf(node.index, node.type);
}
toString() {
return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
@@ -91996,12 +91896,12 @@ var TreeCursor2 = class {
enterChild(dir, pos, side) {
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: buffer2 } = this.buffer;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.buffer.start, side);
- if (index3 < 0)
+ 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)
return false;
this.stack.push(this.index);
- return this.yieldBuf(index3);
+ return this.yieldBuf(index2);
}
firstChild() {
return this.enterChild(1, 0, 4);
@@ -92032,14 +91932,14 @@ var TreeCursor2 = class {
sibling(dir) {
if (!this.buffer)
return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode));
- let { buffer: buffer2 } = this.buffer, d4 = this.stack.length - 1;
+ let { buffer } = this.buffer, d4 = this.stack.length - 1;
if (dir < 0) {
let parentStart = d4 < 0 ? 0 : this.stack[d4] + 4;
if (this.index != parentStart)
- return this.yieldBuf(buffer2.findChild(parentStart, this.index, -1, 0, 4));
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4));
} else {
- let after = buffer2.buffer[this.index + 3];
- if (after < (d4 < 0 ? buffer2.buffer.length : buffer2.buffer[this.stack[d4] + 3]))
+ let after = buffer.buffer[this.index + 3];
+ if (after < (d4 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d4] + 3]))
return this.yieldBuf(after);
}
return d4 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false;
@@ -92051,23 +91951,23 @@ var TreeCursor2 = class {
return this.sibling(-1);
}
atLastNode(dir) {
- let index3, parent, { buffer: buffer2 } = this;
- if (buffer2) {
+ let index2, parent, { buffer } = this;
+ if (buffer) {
if (dir > 0) {
- if (this.index < buffer2.buffer.buffer.length)
+ if (this.index < buffer.buffer.buffer.length)
return false;
} else {
for (let i4 = 0; i4 < this.index; i4++)
- if (buffer2.buffer.buffer[i4 + 3] < this.index)
+ if (buffer.buffer.buffer[i4 + 3] < this.index)
return false;
}
- ({ index: index3, parent } = buffer2);
+ ({ index: index2, parent } = buffer);
} else {
- ({ index: index3, _parent: parent } = this._tree);
+ ({ index: index2, _parent: parent } = this._tree);
}
- 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) {
+ 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) {
let child = parent._tree.children[i4];
if (this.mode & IterMode2.IncludeAnonymous || child instanceof TreeBuffer2 || !child.type.isAnonymous || hasChild2(child))
return false;
@@ -92105,16 +92005,16 @@ var TreeCursor2 = class {
let cache2 = this.bufferNode, result = null, depth = 0;
if (cache2 && cache2.context == this.buffer) {
scan:
- for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) {
+ for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) {
for (let c3 = cache2; c3; c3 = c3._parent)
- if (c3.index == index3) {
- if (index3 == this.index)
+ if (c3.index == index2) {
+ if (index2 == this.index)
return c3;
result = c3;
depth = d4 + 1;
break scan;
}
- index3 = this.stack[--d4];
+ index2 = this.stack[--d4];
}
}
for (let i4 = depth; i4 < this.stack.length; i4++)
@@ -92152,11 +92052,11 @@ var TreeCursor2 = class {
matchContext(context) {
if (!this.buffer)
return matchNodeContext2(this.node, context);
- let { buffer: buffer2 } = this.buffer, { types: types2 } = buffer2.set;
+ let { buffer } = this.buffer, { types: types2 } = buffer.set;
for (let i4 = context.length - 1, d4 = this.stack.length - 1; i4 >= 0; d4--) {
if (d4 < 0)
return matchNodeContext2(this.node, context, i4);
- let type = types2[buffer2.buffer[this.stack[d4]]];
+ let type = types2[buffer.buffer[this.stack[d4]]];
if (!type.isAnonymous) {
if (context[i4] && context[i4] != type.name)
return false;
@@ -92169,10 +92069,10 @@ var TreeCursor2 = class {
function hasChild2(tree) {
return tree.children.some((ch) => ch instanceof TreeBuffer2 || !ch.type.isAnonymous || hasChild2(ch));
}
-function buildTree2(data3) {
+function buildTree2(data2) {
var _a;
- let { buffer: buffer2, nodeSet, maxBufferLength = DefaultBufferLength2, reused = [], minRepeatType = nodeSet.types.length } = data3;
- let cursor2 = Array.isArray(buffer2) ? new FlatBufferCursor2(buffer2, buffer2.length) : buffer2;
+ let { buffer, nodeSet, maxBufferLength = DefaultBufferLength2, reused = [], minRepeatType = nodeSet.types.length } = data2;
+ let cursor2 = Array.isArray(buffer) ? new FlatBufferCursor2(buffer, buffer.length) : buffer;
let types2 = nodeSet.types;
let contextHash = 0, lookAhead = 0;
function takeNode(parentStart, minPos, children2, positions2, inRepeat) {
@@ -92181,8 +92081,8 @@ function buildTree2(data3) {
while (size2 < 0) {
cursor2.next();
if (size2 == -1) {
- let node3 = reused[id3];
- children2.push(node3);
+ let node2 = reused[id3];
+ children2.push(node2);
positions2.push(start - parentStart);
return;
} else if (size2 == -3) {
@@ -92195,15 +92095,15 @@ function buildTree2(data3) {
throw new RangeError(`Unrecognized record size: ${size2}`);
}
}
- let type = types2[id3], node2, buffer3;
+ let type = types2[id3], node, buffer2;
let startPos = start - parentStart;
- if (end - start <= maxBufferLength && (buffer3 = findBufferSize(cursor2.pos - minPos, inRepeat))) {
- let data4 = new Uint16Array(buffer3.size - buffer3.skip);
- let endPos = cursor2.pos - buffer3.size, index3 = data4.length;
+ 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;
while (cursor2.pos > endPos)
- index3 = copyToBuffer(buffer3.start, data4, index3);
- node2 = new TreeBuffer2(data4, end - buffer3.start, nodeSet);
- startPos = buffer3.start - parentStart;
+ index2 = copyToBuffer(buffer2.start, data3, index2);
+ node = new TreeBuffer2(data3, end - buffer2.start, nodeSet);
+ startPos = buffer2.start - parentStart;
} else {
let endPos = cursor2.pos - size2;
cursor2.next();
@@ -92228,12 +92128,12 @@ function buildTree2(data3) {
localPositions.reverse();
if (localInRepeat > -1 && lastGroup > 0) {
let make = makeBalanced(type);
- node2 = balanceRange2(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);
+ node = balanceRange2(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);
} else {
- node2 = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);
+ node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);
}
}
- children2.push(node2);
+ children2.push(node);
positions2.push(startPos);
}
function makeBalanced(type) {
@@ -92248,14 +92148,14 @@ function buildTree2(data3) {
return makeTree(type, children2, positions2, length2, lookAhead2);
};
}
- function makeRepeatLeaf(children2, positions2, base3, i4, from, to2, type, lookAhead2) {
+ function makeRepeatLeaf(children2, positions2, base2, i4, from, to2, type, lookAhead2) {
let localChildren = [], localPositions = [];
while (children2.length > i4) {
localChildren.push(children2.pop());
- localPositions.push(positions2.pop() + base3 - from);
+ localPositions.push(positions2.pop() + base2 - from);
}
children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to2 - from, lookAhead2 - to2));
- positions2.push(from - base3);
+ positions2.push(from - base2);
}
function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) {
if (contextHash) {
@@ -92312,48 +92212,48 @@ function buildTree2(data3) {
}
return result.size > 4 ? result : void 0;
}
- function copyToBuffer(bufferStart, buffer3, index3) {
+ function copyToBuffer(bufferStart, buffer2, index2) {
let { id: id3, start, end, size: size2 } = cursor2;
cursor2.next();
if (size2 >= 0 && id3 < minRepeatType) {
- let startIndex = index3;
+ let startIndex = index2;
if (size2 > 4) {
let endPos = cursor2.pos - (size2 - 4);
while (cursor2.pos > endPos)
- index3 = copyToBuffer(bufferStart, buffer3, index3);
+ index2 = copyToBuffer(bufferStart, buffer2, index2);
}
- buffer3[--index3] = startIndex;
- buffer3[--index3] = end - bufferStart;
- buffer3[--index3] = start - bufferStart;
- buffer3[--index3] = id3;
+ buffer2[--index2] = startIndex;
+ buffer2[--index2] = end - bufferStart;
+ buffer2[--index2] = start - bufferStart;
+ buffer2[--index2] = id3;
} else if (size2 == -3) {
contextHash = id3;
} else if (size2 == -4) {
lookAhead = id3;
}
- return index3;
+ return index2;
}
let children = [], positions = [];
while (cursor2.pos > 0)
- takeNode(data3.start || 0, data3.bufferStart || 0, children, positions, -1);
- let length = (_a = data3.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
- return new Tree2(types2[data3.topID], children.reverse(), positions.reverse(), length);
+ takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1);
+ let length = (_a = data2.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
+ return new Tree2(types2[data2.topID], children.reverse(), positions.reverse(), length);
}
var nodeSizeCache2 = /* @__PURE__ */ new WeakMap();
-function nodeSize2(balanceType, node2) {
- if (!balanceType.isAnonymous || node2 instanceof TreeBuffer2 || node2.type != balanceType)
+function nodeSize2(balanceType, node) {
+ if (!balanceType.isAnonymous || node instanceof TreeBuffer2 || node.type != balanceType)
return 1;
- let size2 = nodeSizeCache2.get(node2);
+ let size2 = nodeSizeCache2.get(node);
if (size2 == null) {
size2 = 1;
- for (let child of node2.children) {
+ for (let child of node.children) {
if (child.type != balanceType || !(child instanceof Tree2)) {
size2 = 1;
break;
}
size2 += nodeSize2(balanceType, child);
}
- nodeSizeCache2.set(node2, size2);
+ nodeSizeCache2.set(node, size2);
}
return size2;
}
@@ -92394,24 +92294,24 @@ var NodeWeakMap = class {
constructor() {
this.map = /* @__PURE__ */ new WeakMap();
}
- setBuffer(buffer2, index3, value) {
- let inner = this.map.get(buffer2);
+ setBuffer(buffer, index2, value) {
+ let inner = this.map.get(buffer);
if (!inner)
- this.map.set(buffer2, inner = /* @__PURE__ */ new Map());
- inner.set(index3, value);
+ this.map.set(buffer, inner = /* @__PURE__ */ new Map());
+ inner.set(index2, value);
}
- getBuffer(buffer2, index3) {
- let inner = this.map.get(buffer2);
- return inner && inner.get(index3);
+ getBuffer(buffer, index2) {
+ let inner = this.map.get(buffer);
+ return inner && inner.get(index2);
}
- set(node2, value) {
- if (node2 instanceof BufferNode2)
- this.setBuffer(node2.context.buffer, node2.index, value);
- else if (node2 instanceof TreeNode3)
- this.map.set(node2.tree, value);
+ set(node, value) {
+ if (node instanceof BufferNode2)
+ this.setBuffer(node.context.buffer, node.index, value);
+ else if (node instanceof TreeNode3)
+ this.map.set(node.tree, value);
}
- get(node2) {
- return node2 instanceof BufferNode2 ? this.getBuffer(node2.context.buffer, node2.index) : node2 instanceof TreeNode3 ? this.map.get(node2.tree) : void 0;
+ get(node) {
+ return node instanceof BufferNode2 ? this.getBuffer(node.context.buffer, node.index) : node instanceof TreeNode3 ? this.map.get(node.tree) : void 0;
}
cursorSet(cursor2, value) {
if (cursor2.buffer)
@@ -92474,8 +92374,8 @@ var ScopeNodes = /* @__PURE__ */ new Set([
"ForStatement"
]);
function defID(type) {
- return (node2, def) => {
- let id3 = node2.node.getChild("VariableDefinition");
+ return (node, def) => {
+ let id3 = node.node.getChild("VariableDefinition");
if (id3)
def(id3, type);
return true;
@@ -92489,38 +92389,38 @@ var gatherCompletions = {
EnumDeclaration: /* @__PURE__ */ defID("constant"),
TypeAliasDeclaration: /* @__PURE__ */ defID("type"),
NamespaceDeclaration: /* @__PURE__ */ defID("namespace"),
- VariableDefinition(node2, def) {
- if (!node2.matchContext(functionContext))
- def(node2, "variable");
+ VariableDefinition(node, def) {
+ if (!node.matchContext(functionContext))
+ def(node, "variable");
},
- TypeDefinition(node2, def) {
- def(node2, "type");
+ TypeDefinition(node, def) {
+ def(node, "type");
},
__proto__: null
};
-function getScope(doc, node2) {
- let cached = cache.get(node2);
+function getScope(doc, node) {
+ let cached = cache.get(node);
if (cached)
return cached;
let completions = [], top = true;
- function def(node3, type) {
- let name317 = doc.sliceString(node3.from, node3.to);
+ function def(node2, type) {
+ let name317 = doc.sliceString(node2.from, node2.to);
completions.push({ label: name317, type });
}
- node2.cursor(IterMode2.IncludeAnonymous).iterate((node3) => {
+ node.cursor(IterMode2.IncludeAnonymous).iterate((node2) => {
if (top) {
top = false;
- } else if (node3.name) {
- let gather = gatherCompletions[node3.name];
- if (gather && gather(node3, def) || ScopeNodes.has(node3.name))
+ } else if (node2.name) {
+ let gather = gatherCompletions[node2.name];
+ if (gather && gather(node2, def) || ScopeNodes.has(node2.name))
return false;
- } else if (node3.to - node3.from > 8192) {
- for (let c3 of getScope(doc, node3.node))
+ } else if (node2.to - node2.from > 8192) {
+ for (let c3 of getScope(doc, node2.node))
completions.push(c3);
return false;
}
});
- cache.set(node2, completions);
+ cache.set(node, completions);
return completions;
}
var Identifier = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/;
@@ -92606,25 +92506,25 @@ function elementName(doc, tree, max5 = doc.length) {
return name317 ? doc.sliceString(name317.from, Math.min(name317.to, max5)) : "";
}
var android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent);
-var autoCloseTags = /* @__PURE__ */ import_view2.EditorView.inputHandler.of((view, from, to2, text7) => {
- if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to2 || text7 != ">" && text7 != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1))
+var autoCloseTags = /* @__PURE__ */ import_view2.EditorView.inputHandler.of((view, from, to2, text2) => {
+ if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to2 || text2 != ">" && text2 != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1))
return false;
let { state } = view;
let changes = state.changeByRange((range2) => {
var _a, _b, _c;
- let { head: head2 } = range2, around2 = (0, import_language2.syntaxTree)(state).resolveInner(head2, -1), name317;
+ let { head } = range2, around2 = (0, import_language2.syntaxTree)(state).resolveInner(head, -1), name317;
if (around2.name == "JSXStartTag")
around2 = around2.parent;
- if (text7 == ">" && around2.name == "JSXFragmentTag") {
- return { range: import_state3.EditorSelection.cursor(head2 + 1), changes: { from: head2, insert: `><>` } };
- } else if (text7 == ">" && around2.name == "JSXIdentifier") {
- if (((_b = (_a = around2.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "JSXEndTag" && (name317 = elementName(state.doc, around2.parent, head2)))
- return { range: import_state3.EditorSelection.cursor(head2 + 1), changes: { from: head2, insert: `>${name317}>` } };
- } else if (text7 == "/" && around2.name == "JSXFragmentTag") {
- let empty3 = around2.parent, base3 = empty3 === null || empty3 === void 0 ? void 0 : empty3.parent;
- if (empty3.from == head2 - 1 && ((_c = base3.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "JSXEndTag" && (name317 = elementName(state.doc, base3 === null || base3 === void 0 ? void 0 : base3.firstChild, head2))) {
+ if (text2 == ">" && around2.name == "JSXFragmentTag") {
+ return { range: import_state3.EditorSelection.cursor(head + 1), changes: { from: head, insert: `><>` } };
+ } else if (text2 == ">" && around2.name == "JSXIdentifier") {
+ if (((_b = (_a = around2.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "JSXEndTag" && (name317 = elementName(state.doc, around2.parent, head)))
+ return { range: import_state3.EditorSelection.cursor(head + 1), changes: { from: head, insert: `>${name317}>` } };
+ } else if (text2 == "/" && around2.name == "JSXFragmentTag") {
+ let empty3 = around2.parent, base2 = empty3 === null || empty3 === void 0 ? void 0 : empty3.parent;
+ if (empty3.from == head - 1 && ((_c = base2.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "JSXEndTag" && (name317 = elementName(state.doc, base2 === null || base2 === void 0 ? void 0 : base2.firstChild, head))) {
let insert2 = `/${name317}>`;
- return { range: import_state3.EditorSelection.cursor(head2 + insert2.length), changes: { from: head2, insert: insert2 } };
+ return { range: import_state3.EditorSelection.cursor(head + insert2.length), changes: { from: head, insert: insert2 } };
}
}
return { range: range2 };
@@ -92726,14 +92626,14 @@ var NodeType3 = class {
}
return this.id == name317;
}
- static match(map6) {
+ static match(map4) {
let direct = /* @__PURE__ */ Object.create(null);
- for (let prop2 in map6)
+ for (let prop2 in map4)
for (let name317 of prop2.split(" "))
- direct[name317] = map6[prop2];
- return (node2) => {
- for (let groups = node2.prop(NodeProp3.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) {
- let found = direct[i4 < 0 ? node2.name : groups[i4]];
+ direct[name317] = map4[prop2];
+ return (node) => {
+ for (let groups = node.prop(NodeProp3.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) {
+ let found = direct[i4 < 0 ? node.name : groups[i4]];
if (found)
return found;
}
@@ -92792,14 +92692,14 @@ var Tree3 = class {
return new TreeNode4(this, 0, 0, null);
}
resolve(pos, side = 0) {
- let node2 = resolveNode3(CachedNode3.get(this) || this.topNode, pos, side, false);
- CachedNode3.set(this, node2);
- return node2;
+ let node = resolveNode3(CachedNode3.get(this) || this.topNode, pos, side, false);
+ CachedNode3.set(this, node);
+ return node;
}
resolveInner(pos, side = 0) {
- let node2 = resolveNode3(CachedInnerNode3.get(this) || this.topNode, pos, side, true);
- CachedInnerNode3.set(this, node2);
- return node2;
+ let node = resolveNode3(CachedInnerNode3.get(this) || this.topNode, pos, side, true);
+ CachedInnerNode3.set(this, node);
+ return node;
}
resolveStack(pos, side = 0) {
return stackIterator(this, pos, side);
@@ -92838,15 +92738,15 @@ var Tree3 = class {
balance(config4 = {}) {
return this.children.length <= 8 ? this : balanceRange3(NodeType3.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree3(this.type, children, positions, length, this.propValues), config4.makeTree || ((children, positions, length) => new Tree3(NodeType3.none, children, positions, length)));
}
- static build(data3) {
- return buildTree3(data3);
+ static build(data2) {
+ return buildTree3(data2);
}
};
Tree3.empty = new Tree3(NodeType3.none, [], [], 0);
var FlatBufferCursor3 = class {
- constructor(buffer2, index3) {
- this.buffer = buffer2;
- this.index = index3;
+ constructor(buffer, index2) {
+ this.buffer = buffer;
+ this.index = index2;
}
get id() {
return this.buffer[this.index - 4];
@@ -92871,8 +92771,8 @@ var FlatBufferCursor3 = class {
}
};
var TreeBuffer3 = class {
- constructor(buffer2, length, set) {
- this.buffer = buffer2;
+ constructor(buffer, length, set) {
+ this.buffer = buffer;
this.length = length;
this.set = set;
}
@@ -92881,31 +92781,31 @@ var TreeBuffer3 = class {
}
toString() {
let result = [];
- for (let index3 = 0; index3 < this.buffer.length; ) {
- result.push(this.childString(index3));
- index3 = this.buffer[index3 + 3];
+ for (let index2 = 0; index2 < this.buffer.length; ) {
+ result.push(this.childString(index2));
+ index2 = this.buffer[index2 + 3];
}
return result.join(",");
}
- childString(index3) {
- let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3];
+ childString(index2) {
+ let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3];
let type = this.set.types[id3], result = type.name;
if (/\W/.test(result) && !type.isError)
result = JSON.stringify(result);
- index3 += 4;
- if (endIndex == index3)
+ index2 += 4;
+ if (endIndex == index2)
return result;
let children = [];
- while (index3 < endIndex) {
- children.push(this.childString(index3));
- index3 = this.buffer[index3 + 3];
+ while (index2 < endIndex) {
+ children.push(this.childString(index2));
+ index2 = this.buffer[index2 + 3];
}
return result + "(" + children.join(",") + ")";
}
findChild(startIndex, endIndex, dir, pos, side) {
- let { buffer: buffer2 } = this, pick = -1;
- for (let i4 = startIndex; i4 != endIndex; i4 = buffer2[i4 + 3]) {
- if (checkSide3(side, pos, buffer2[i4 + 1], buffer2[i4 + 2])) {
+ let { buffer } = this, pick = -1;
+ for (let i4 = startIndex; i4 != endIndex; i4 = buffer[i4 + 3]) {
+ if (checkSide3(side, pos, buffer[i4 + 1], buffer[i4 + 2])) {
pick = i4;
if (dir > 0)
break;
@@ -92942,25 +92842,25 @@ function checkSide3(side, pos, from, to2) {
return true;
}
}
-function resolveNode3(node2, pos, side, overlays) {
+function resolveNode3(node, pos, side, overlays) {
var _a;
- while (node2.from == node2.to || (side < 1 ? node2.from >= pos : node2.from > pos) || (side > -1 ? node2.to <= pos : node2.to < pos)) {
- let parent = !overlays && node2 instanceof TreeNode4 && node2.index < 0 ? null : node2.parent;
+ while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) {
+ let parent = !overlays && node instanceof TreeNode4 && node.index < 0 ? null : node.parent;
if (!parent)
- return node2;
- node2 = parent;
+ return node;
+ node = parent;
}
let mode2 = overlays ? 0 : IterMode3.IgnoreOverlays;
if (overlays)
- for (let scan = node2, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
+ for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
if (scan instanceof TreeNode4 && scan.index < 0 && ((_a = parent.enter(pos, side, mode2)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)
- node2 = parent;
+ node = parent;
}
for (; ; ) {
- let inner = node2.enter(pos, side, mode2);
+ let inner = node.enter(pos, side, mode2);
if (!inner)
- return node2;
- node2 = inner;
+ return node;
+ node = inner;
}
}
var BaseNode = class {
@@ -92984,19 +92884,19 @@ var BaseNode = class {
return matchNodeContext3(this, context);
}
enterUnfinishedNodesBefore(pos) {
- let scan = this.childBefore(pos), node2 = this;
+ let scan = this.childBefore(pos), node = this;
while (scan) {
let last = scan.lastChild;
if (!last || last.to != scan.to)
break;
if (last.type.isError && last.from == last.to) {
- node2 = scan;
+ node = scan;
scan = last.prevSibling;
} else {
scan = last;
}
}
- return node2;
+ return node;
}
get node() {
return this;
@@ -93006,11 +92906,11 @@ var BaseNode = class {
}
};
var TreeNode4 = class extends BaseNode {
- constructor(_tree, from, index3, _parent) {
+ constructor(_tree, from, index2, _parent) {
super();
this._tree = _tree;
this.from = from;
- this.index = index3;
+ this.index = index2;
this._parent = _parent;
}
get type() {
@@ -93031,9 +92931,9 @@ var TreeNode4 = class extends BaseNode {
if (next instanceof TreeBuffer3) {
if (mode2 & IterMode3.ExcludeBuffers)
continue;
- 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);
+ 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);
} else if (mode2 & IterMode3.IncludeAnonymous || (!next.type.isAnonymous || hasChild3(next))) {
let mounted;
if (!(mode2 & IterMode3.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay)
@@ -93101,8 +93001,8 @@ var TreeNode4 = class extends BaseNode {
return this._tree.toString();
}
};
-function getChildren3(node2, type, before, after) {
- let cur = node2.cursor(), result = [];
+function getChildren3(node, type, before, after) {
+ let cur = node.cursor(), result = [];
if (!cur.firstChild())
return result;
if (before != null)
@@ -93120,12 +93020,12 @@ function getChildren3(node2, type, before, after) {
return after == null ? result : [];
}
}
-function matchNodeContext3(node2, context, i4 = context.length - 1) {
- for (let p2 = node2.parent; i4 >= 0; p2 = p2.parent) {
- if (!p2)
+function matchNodeContext3(node, context, i4 = context.length - 1) {
+ for (let p = node.parent; i4 >= 0; p = p.parent) {
+ if (!p)
return false;
- if (!p2.type.isAnonymous) {
- if (context[i4] && context[i4] != p2.name)
+ if (!p.type.isAnonymous) {
+ if (context[i4] && context[i4] != p.name)
return false;
i4--;
}
@@ -93133,10 +93033,10 @@ function matchNodeContext3(node2, context, i4 = context.length - 1) {
return true;
}
var BufferContext3 = class {
- constructor(parent, buffer2, index3, start) {
+ constructor(parent, buffer, index2, start) {
this.parent = parent;
- this.buffer = buffer2;
- this.index = index3;
+ this.buffer = buffer;
+ this.index = index2;
this.start = start;
}
};
@@ -93150,17 +93050,17 @@ var BufferNode3 = class extends BaseNode {
get to() {
return this.context.start + this.context.buffer.buffer[this.index + 2];
}
- constructor(context, _parent, index3) {
+ constructor(context, _parent, index2) {
super();
this.context = context;
this._parent = _parent;
- this.index = index3;
- this.type = context.buffer.set.types[context.buffer.buffer[index3]];
+ this.index = index2;
+ this.type = context.buffer.set.types[context.buffer.buffer[index2]];
}
child(dir, pos, side) {
- let { buffer: buffer2 } = this.context;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.context.start, side);
- return index3 < 0 ? null : new BufferNode3(this.context, this, index3);
+ 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);
}
get firstChild() {
return this.child(1, 0, 4);
@@ -93177,9 +93077,9 @@ var BufferNode3 = class extends BaseNode {
enter(pos, side, mode2 = 0) {
if (mode2 & IterMode3.ExcludeBuffers)
return null;
- let { buffer: buffer2 } = this.context;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side);
- return index3 < 0 ? null : new BufferNode3(this.context, this, index3);
+ 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);
}
get parent() {
return this._parent || this.context.parent.nextSignificantParent();
@@ -93188,29 +93088,29 @@ var BufferNode3 = class extends BaseNode {
return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4);
}
get nextSibling() {
- let { buffer: buffer2 } = this.context;
- let after = buffer2.buffer[this.index + 3];
- if (after < (this._parent ? buffer2.buffer[this._parent.index + 3] : buffer2.buffer.length))
+ let { buffer } = this.context;
+ let after = buffer.buffer[this.index + 3];
+ if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))
return new BufferNode3(this.context, this._parent, after);
return this.externalSibling(1);
}
get prevSibling() {
- let { buffer: buffer2 } = this.context;
+ let { buffer } = this.context;
let parentStart = this._parent ? this._parent.index + 4 : 0;
if (this.index == parentStart)
return this.externalSibling(-1);
- return new BufferNode3(this.context, this._parent, buffer2.findChild(parentStart, this.index, -1, 0, 4));
+ return new BufferNode3(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4));
}
get tree() {
return null;
}
toTree() {
let children = [], positions = [];
- let { buffer: buffer2 } = this.context;
- let startI = this.index + 4, endI = buffer2.buffer[this.index + 3];
+ let { buffer } = this.context;
+ let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
if (endI > startI) {
- let from = buffer2.buffer[this.index + 1];
- children.push(buffer2.slice(startI, endI, from));
+ let from = buffer.buffer[this.index + 1];
+ children.push(buffer.slice(startI, endI, from));
positions.push(0);
}
return new Tree3(this.type, children, positions, this.to - this.from);
@@ -93224,9 +93124,9 @@ function iterStack(heads) {
return null;
let pick = 0, picked = heads[0];
for (let i4 = 1; i4 < heads.length; i4++) {
- let node2 = heads[i4];
- if (node2.from > picked.from || node2.to < picked.to) {
- picked = node2;
+ let node = heads[i4];
+ if (node.from > picked.from || node.to < picked.to) {
+ picked = node;
pick = i4;
}
}
@@ -93239,9 +93139,9 @@ function iterStack(heads) {
return new StackIterator(newHeads, picked);
}
var StackIterator = class {
- constructor(heads, node2) {
+ constructor(heads, node) {
this.heads = heads;
- this.node = node2;
+ this.node = node;
}
get next() {
return iterStack(this.heads);
@@ -93257,8 +93157,8 @@ function stackIterator(tree, pos, side) {
} else {
let mount = MountedTree.get(scan.tree);
if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) {
- let root4 = new TreeNode4(mount.tree, mount.overlay[0].from + scan.from, -1, scan);
- (layers || (layers = [inner])).push(resolveNode3(root4, pos, side, false));
+ let root = new TreeNode4(mount.tree, mount.overlay[0].from + scan.from, -1, scan);
+ (layers || (layers = [inner])).push(resolveNode3(root, pos, side, false));
}
}
}
@@ -93268,49 +93168,49 @@ var TreeCursor3 = class {
get name() {
return this.type.name;
}
- constructor(node2, mode2 = 0) {
+ constructor(node, mode2 = 0) {
this.mode = mode2;
this.buffer = null;
this.stack = [];
this.index = 0;
this.bufferNode = null;
- if (node2 instanceof TreeNode4) {
- this.yieldNode(node2);
+ if (node instanceof TreeNode4) {
+ this.yieldNode(node);
} else {
- this._tree = node2.context.parent;
- this.buffer = node2.context;
- for (let n3 = node2._parent; n3; n3 = n3._parent)
+ this._tree = node.context.parent;
+ this.buffer = node.context;
+ for (let n3 = node._parent; n3; n3 = n3._parent)
this.stack.unshift(n3.index);
- this.bufferNode = node2;
- this.yieldBuf(node2.index);
+ this.bufferNode = node;
+ this.yieldBuf(node.index);
}
}
- yieldNode(node2) {
- if (!node2)
+ yieldNode(node) {
+ if (!node)
return false;
- this._tree = node2;
- this.type = node2.type;
- this.from = node2.from;
- this.to = node2.to;
+ this._tree = node;
+ this.type = node.type;
+ this.from = node.from;
+ this.to = node.to;
return true;
}
- yieldBuf(index3, type) {
- this.index = index3;
- let { start, buffer: buffer2 } = this.buffer;
- this.type = type || buffer2.set.types[buffer2.buffer[index3]];
- this.from = start + buffer2.buffer[index3 + 1];
- this.to = start + buffer2.buffer[index3 + 2];
+ yieldBuf(index2, type) {
+ this.index = index2;
+ 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];
return true;
}
- yield(node2) {
- if (!node2)
+ yield(node) {
+ if (!node)
return false;
- if (node2 instanceof TreeNode4) {
+ if (node instanceof TreeNode4) {
this.buffer = null;
- return this.yieldNode(node2);
+ return this.yieldNode(node);
}
- this.buffer = node2.context;
- return this.yieldBuf(node2.index, node2.type);
+ this.buffer = node.context;
+ return this.yieldBuf(node.index, node.type);
}
toString() {
return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
@@ -93318,12 +93218,12 @@ var TreeCursor3 = class {
enterChild(dir, pos, side) {
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: buffer2 } = this.buffer;
- let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.buffer.start, side);
- if (index3 < 0)
+ 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)
return false;
this.stack.push(this.index);
- return this.yieldBuf(index3);
+ return this.yieldBuf(index2);
}
firstChild() {
return this.enterChild(1, 0, 4);
@@ -93354,14 +93254,14 @@ var TreeCursor3 = class {
sibling(dir) {
if (!this.buffer)
return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode));
- let { buffer: buffer2 } = this.buffer, d4 = this.stack.length - 1;
+ let { buffer } = this.buffer, d4 = this.stack.length - 1;
if (dir < 0) {
let parentStart = d4 < 0 ? 0 : this.stack[d4] + 4;
if (this.index != parentStart)
- return this.yieldBuf(buffer2.findChild(parentStart, this.index, -1, 0, 4));
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4));
} else {
- let after = buffer2.buffer[this.index + 3];
- if (after < (d4 < 0 ? buffer2.buffer.length : buffer2.buffer[this.stack[d4] + 3]))
+ let after = buffer.buffer[this.index + 3];
+ if (after < (d4 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d4] + 3]))
return this.yieldBuf(after);
}
return d4 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false;
@@ -93373,23 +93273,23 @@ var TreeCursor3 = class {
return this.sibling(-1);
}
atLastNode(dir) {
- let index3, parent, { buffer: buffer2 } = this;
- if (buffer2) {
+ let index2, parent, { buffer } = this;
+ if (buffer) {
if (dir > 0) {
- if (this.index < buffer2.buffer.buffer.length)
+ if (this.index < buffer.buffer.buffer.length)
return false;
} else {
for (let i4 = 0; i4 < this.index; i4++)
- if (buffer2.buffer.buffer[i4 + 3] < this.index)
+ if (buffer.buffer.buffer[i4 + 3] < this.index)
return false;
}
- ({ index: index3, parent } = buffer2);
+ ({ index: index2, parent } = buffer);
} else {
- ({ index: index3, _parent: parent } = this._tree);
+ ({ index: index2, _parent: parent } = this._tree);
}
- 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) {
+ 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) {
let child = parent._tree.children[i4];
if (this.mode & IterMode3.IncludeAnonymous || child instanceof TreeBuffer3 || !child.type.isAnonymous || hasChild3(child))
return false;
@@ -93427,16 +93327,16 @@ var TreeCursor3 = class {
let cache2 = this.bufferNode, result = null, depth = 0;
if (cache2 && cache2.context == this.buffer) {
scan:
- for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) {
+ for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) {
for (let c3 = cache2; c3; c3 = c3._parent)
- if (c3.index == index3) {
- if (index3 == this.index)
+ if (c3.index == index2) {
+ if (index2 == this.index)
return c3;
result = c3;
depth = d4 + 1;
break scan;
}
- index3 = this.stack[--d4];
+ index2 = this.stack[--d4];
}
}
for (let i4 = depth; i4 < this.stack.length; i4++)
@@ -93474,11 +93374,11 @@ var TreeCursor3 = class {
matchContext(context) {
if (!this.buffer)
return matchNodeContext3(this.node, context);
- let { buffer: buffer2 } = this.buffer, { types: types2 } = buffer2.set;
+ let { buffer } = this.buffer, { types: types2 } = buffer.set;
for (let i4 = context.length - 1, d4 = this.stack.length - 1; i4 >= 0; d4--) {
if (d4 < 0)
return matchNodeContext3(this.node, context, i4);
- let type = types2[buffer2.buffer[this.stack[d4]]];
+ let type = types2[buffer.buffer[this.stack[d4]]];
if (!type.isAnonymous) {
if (context[i4] && context[i4] != type.name)
return false;
@@ -93491,10 +93391,10 @@ var TreeCursor3 = class {
function hasChild3(tree) {
return tree.children.some((ch) => ch instanceof TreeBuffer3 || !ch.type.isAnonymous || hasChild3(ch));
}
-function buildTree3(data3) {
+function buildTree3(data2) {
var _a;
- let { buffer: buffer2, nodeSet, maxBufferLength = DefaultBufferLength3, reused = [], minRepeatType = nodeSet.types.length } = data3;
- let cursor2 = Array.isArray(buffer2) ? new FlatBufferCursor3(buffer2, buffer2.length) : buffer2;
+ let { buffer, nodeSet, maxBufferLength = DefaultBufferLength3, reused = [], minRepeatType = nodeSet.types.length } = data2;
+ let cursor2 = Array.isArray(buffer) ? new FlatBufferCursor3(buffer, buffer.length) : buffer;
let types2 = nodeSet.types;
let contextHash = 0, lookAhead = 0;
function takeNode(parentStart, minPos, children2, positions2, inRepeat, depth) {
@@ -93503,8 +93403,8 @@ function buildTree3(data3) {
while (size2 < 0) {
cursor2.next();
if (size2 == -1) {
- let node3 = reused[id3];
- children2.push(node3);
+ let node2 = reused[id3];
+ children2.push(node2);
positions2.push(start - parentStart);
return;
} else if (size2 == -3) {
@@ -93517,15 +93417,15 @@ function buildTree3(data3) {
throw new RangeError(`Unrecognized record size: ${size2}`);
}
}
- let type = types2[id3], node2, buffer3;
+ let type = types2[id3], node, buffer2;
let startPos = start - parentStart;
- if (end - start <= maxBufferLength && (buffer3 = findBufferSize(cursor2.pos - minPos, inRepeat))) {
- let data4 = new Uint16Array(buffer3.size - buffer3.skip);
- let endPos = cursor2.pos - buffer3.size, index3 = data4.length;
+ 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;
while (cursor2.pos > endPos)
- index3 = copyToBuffer(buffer3.start, data4, index3);
- node2 = new TreeBuffer3(data4, end - buffer3.start, nodeSet);
- startPos = buffer3.start - parentStart;
+ index2 = copyToBuffer(buffer2.start, data3, index2);
+ node = new TreeBuffer3(data3, end - buffer2.start, nodeSet);
+ startPos = buffer2.start - parentStart;
} else {
let endPos = cursor2.pos - size2;
cursor2.next();
@@ -93552,12 +93452,12 @@ function buildTree3(data3) {
localPositions.reverse();
if (localInRepeat > -1 && lastGroup > 0) {
let make = makeBalanced(type);
- node2 = balanceRange3(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);
+ node = balanceRange3(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);
} else {
- node2 = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);
+ node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);
}
}
- children2.push(node2);
+ children2.push(node);
positions2.push(startPos);
}
function takeFlatNode(parentStart, minPos, children2, positions2) {
@@ -93578,15 +93478,15 @@ function buildTree3(data3) {
}
}
if (nodeCount) {
- let buffer3 = new Uint16Array(nodeCount * 4);
+ let buffer2 = new Uint16Array(nodeCount * 4);
let start = nodes[nodes.length - 2];
for (let i4 = nodes.length - 3, j = 0; i4 >= 0; i4 -= 3) {
- buffer3[j++] = nodes[i4];
- buffer3[j++] = nodes[i4 + 1] - start;
- buffer3[j++] = nodes[i4 + 2] - start;
- buffer3[j++] = j;
+ buffer2[j++] = nodes[i4];
+ buffer2[j++] = nodes[i4 + 1] - start;
+ buffer2[j++] = nodes[i4 + 2] - start;
+ buffer2[j++] = j;
}
- children2.push(new TreeBuffer3(buffer3, nodes[2] - start, nodeSet));
+ children2.push(new TreeBuffer3(buffer2, nodes[2] - start, nodeSet));
positions2.push(start - parentStart);
}
}
@@ -93602,14 +93502,14 @@ function buildTree3(data3) {
return makeTree(type, children2, positions2, length2, lookAhead2);
};
}
- function makeRepeatLeaf(children2, positions2, base3, i4, from, to2, type, lookAhead2) {
+ function makeRepeatLeaf(children2, positions2, base2, i4, from, to2, type, lookAhead2) {
let localChildren = [], localPositions = [];
while (children2.length > i4) {
localChildren.push(children2.pop());
- localPositions.push(positions2.pop() + base3 - from);
+ localPositions.push(positions2.pop() + base2 - from);
}
children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to2 - from, lookAhead2 - to2));
- positions2.push(from - base3);
+ positions2.push(from - base2);
}
function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) {
if (contextHash) {
@@ -93666,48 +93566,48 @@ function buildTree3(data3) {
}
return result.size > 4 ? result : void 0;
}
- function copyToBuffer(bufferStart, buffer3, index3) {
+ function copyToBuffer(bufferStart, buffer2, index2) {
let { id: id3, start, end, size: size2 } = cursor2;
cursor2.next();
if (size2 >= 0 && id3 < minRepeatType) {
- let startIndex = index3;
+ let startIndex = index2;
if (size2 > 4) {
let endPos = cursor2.pos - (size2 - 4);
while (cursor2.pos > endPos)
- index3 = copyToBuffer(bufferStart, buffer3, index3);
+ index2 = copyToBuffer(bufferStart, buffer2, index2);
}
- buffer3[--index3] = startIndex;
- buffer3[--index3] = end - bufferStart;
- buffer3[--index3] = start - bufferStart;
- buffer3[--index3] = id3;
+ buffer2[--index2] = startIndex;
+ buffer2[--index2] = end - bufferStart;
+ buffer2[--index2] = start - bufferStart;
+ buffer2[--index2] = id3;
} else if (size2 == -3) {
contextHash = id3;
} else if (size2 == -4) {
lookAhead = id3;
}
- return index3;
+ return index2;
}
let children = [], positions = [];
while (cursor2.pos > 0)
- takeNode(data3.start || 0, data3.bufferStart || 0, children, positions, -1, 0);
- let length = (_a = data3.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
- return new Tree3(types2[data3.topID], children.reverse(), positions.reverse(), length);
+ takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1, 0);
+ let length = (_a = data2.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
+ return new Tree3(types2[data2.topID], children.reverse(), positions.reverse(), length);
}
var nodeSizeCache3 = /* @__PURE__ */ new WeakMap();
-function nodeSize3(balanceType, node2) {
- if (!balanceType.isAnonymous || node2 instanceof TreeBuffer3 || node2.type != balanceType)
+function nodeSize3(balanceType, node) {
+ if (!balanceType.isAnonymous || node instanceof TreeBuffer3 || node.type != balanceType)
return 1;
- let size2 = nodeSizeCache3.get(node2);
+ let size2 = nodeSizeCache3.get(node);
if (size2 == null) {
size2 = 1;
- for (let child of node2.children) {
+ for (let child of node.children) {
if (child.type != balanceType || !(child instanceof Tree3)) {
size2 = 1;
break;
}
size2 += nodeSize3(balanceType, child);
}
- nodeSizeCache3.set(node2, size2);
+ nodeSizeCache3.set(node, size2);
}
return size2;
}
@@ -93749,9 +93649,9 @@ var stoppedInner3 = new NodeProp3({ perNode: true });
// node_modules/@lezer/highlight/dist/index.js
var nextTagID2 = 0;
var Tag2 = class {
- constructor(set, base3, modified) {
+ constructor(set, base2, modified) {
this.set = set;
- this.base = base3;
+ this.base = base2;
this.modified = modified;
this.id = nextTagID2++;
}
@@ -93780,17 +93680,17 @@ var Modifier2 = class {
this.instances = [];
this.id = nextModifierID2++;
}
- static get(base3, mods) {
+ static get(base2, mods) {
if (!mods.length)
- return base3;
- let exists = mods[0].instances.find((t5) => t5.base == base3 && sameArray2(mods, t5.modified));
+ return base2;
+ let exists = mods[0].instances.find((t5) => t5.base == base2 && sameArray2(mods, t5.modified));
if (exists)
return exists;
- let set = [], tag2 = new Tag2(set, base3, mods);
+ let set = [], tag2 = new Tag2(set, base2, mods);
for (let m4 of mods)
m4.instances.push(tag2);
let configs = powerSet(mods);
- for (let parent of base3.set)
+ for (let parent of base2.set)
if (!parent.modified.length)
for (let config4 of configs)
set.push(Modifier2.get(parent, config4));
@@ -93837,21 +93737,21 @@ var Rule2 = class {
};
Rule2.empty = new Rule2([], 2, null);
function tagHighlighter2(tags3, options) {
- let map6 = /* @__PURE__ */ Object.create(null);
+ let map4 = /* @__PURE__ */ Object.create(null);
for (let style of tags3) {
if (!Array.isArray(style.tag))
- map6[style.tag.id] = style.class;
+ map4[style.tag.id] = style.class;
else
for (let tag2 of style.tag)
- map6[tag2.id] = style.class;
+ map4[tag2.id] = style.class;
}
- let { scope, all: all6 = null } = options || {};
+ let { scope, all: all2 = null } = options || {};
return {
style: (tags4) => {
- let cls = all6;
+ let cls = all2;
for (let tag2 of tags4) {
for (let sub2 of tag2.set) {
- let tagClass = map6[sub2.id];
+ let tagClass = map4[sub2.id];
if (tagClass) {
cls = cls ? cls + " " + tagClass : tagClass;
break;
@@ -94069,8 +93969,8 @@ var createTheme = (_ref) => {
dark: theme === "dark"
});
var highlightStyle = import_language3.HighlightStyle.define(styles2);
- var extension2 = [themeExtension, (0, import_language3.syntaxHighlighting)(highlightStyle)];
- return extension2;
+ var extension = [themeExtension, (0, import_language3.syntaxHighlighting)(highlightStyle)];
+ return extension;
};
// node_modules/@uiw/codemirror-theme-abcdef/esm/index.js
@@ -94186,12 +94086,12 @@ function _objectWithoutPropertiesLoose(source, excluded) {
return {};
var target = {};
var sourceKeys = Object.keys(source);
- var key3, i4;
+ var key2, i4;
for (i4 = 0; i4 < sourceKeys.length; i4++) {
- key3 = sourceKeys[i4];
- if (excluded.indexOf(key3) >= 0)
+ key2 = sourceKeys[i4];
+ if (excluded.indexOf(key2) >= 0)
continue;
- target[key3] = source[key3];
+ target[key2] = source[key2];
}
return target;
}
@@ -94582,7 +94482,7 @@ function useCodeMirror(props) {
readOnly = false,
indentWithTab: defaultIndentWithTab = true,
basicSetup: defaultBasicSetup = true,
- root: root4,
+ root,
initialState: initialState2
} = props;
var [container, setContainer] = (0, import_react12.useState)();
@@ -94602,7 +94502,7 @@ function useCodeMirror(props) {
}
});
var updateListener = import_view8.EditorView.updateListener.of((vu) => {
- if (vu.docChanged && typeof onChange === "function" && !vu.transactions.some((tr2) => tr2.annotation(External))) {
+ if (vu.docChanged && typeof onChange === "function" && !vu.transactions.some((tr) => tr.annotation(External))) {
var doc = vu.state.doc;
var _value = doc.toString();
onChange(_value, vu);
@@ -94635,7 +94535,7 @@ function useCodeMirror(props) {
var viewCurrent = new import_view8.EditorView({
state: stateCurrent,
parent: container,
- root: root4
+ root
});
setView(viewCurrent);
onCreateEditor && onCreateEditor(viewCurrent, stateCurrent);
@@ -94721,7 +94621,7 @@ var ReactCodeMirror = /* @__PURE__ */ (0, import_react13.forwardRef)((props, ref
indentWithTab: indentWithTab2,
editable,
readOnly,
- root: root4,
+ root,
initialState: initialState2
} = props, other = _objectWithoutPropertiesLoose(props, _excluded);
var editor = (0, import_react13.useRef)(null);
@@ -94731,7 +94631,7 @@ var ReactCodeMirror = /* @__PURE__ */ (0, import_react13.forwardRef)((props, ref
container
} = useCodeMirror({
container: editor.current,
- root: root4,
+ root,
value,
autoFocus,
theme,
@@ -94863,9 +94763,9 @@ var executeNode = async (executable, results, contexts, api) => {
const actions = executeCodeBlocks(executable.node, "actions", executable.execActions, stylesResults);
return actions;
};
-var executeCode = (code3, environment) => {
- const isMultiLine = typeof code3 === "string" || code3 instanceof String ? code3.includes("\n") : false;
- const func = isMultiLine ? new Function(`with(this) { ${code3} }`) : new Function(`with(this) { return ${code3}; }`);
+var executeCode = (code, environment) => {
+ const isMultiLine = typeof code === "string" || code instanceof String ? code.includes("\n") : false;
+ const func = isMultiLine ? new Function(`with(this) { ${code} }`) : new Function(`with(this) { return ${code}; }`);
return func.call(environment);
};
var executePropsCodeBlocks = async (executable, results, contexts, api) => {
@@ -94878,51 +94778,51 @@ var executePropsCodeBlocks = async (executable, results, contexts, api) => {
styles: results.state[id3]?.styles ?? {}
};
environment.$contexts = contexts, environment.$api = api;
- for (const { name: key3, isConst } of executable.execPropsOptions.props) {
+ for (const { name: key2, isConst } of executable.execPropsOptions.props) {
try {
let result;
- if (key3 in (results.newState?.[id3]?.["props"] || {}) && isConst) {
- result = results.newState[id3]["props"][key3];
+ if (key2 in (results.newState?.[id3]?.["props"] || {}) && isConst) {
+ result = results.newState[id3]["props"][key2];
} else {
- result = codeBlockStore[key3]?.call(environment);
+ result = codeBlockStore[key2]?.call(environment);
}
if (result !== null) {
- environment[id3]["props"][key3] = result;
- results.state[id3]["props"][key3] = result;
+ environment[id3]["props"][key2] = result;
+ results.state[id3]["props"][key2] = result;
if (results.newState) {
results.newState[id3] = results.newState[id3] ?? { props: {}, styles: {}, actions: {} };
- results.newState[id3]["props"][key3] = result;
+ results.newState[id3]["props"][key2] = result;
}
} else {
- delete environment[id3]["props"][key3];
- delete results.state[id3]["props"][key3];
+ delete environment[id3]["props"][key2];
+ delete results.state[id3]["props"][key2];
if (results.newState?.[id3]) {
- delete results.newState[id3]["props"][key3];
+ delete results.newState[id3]["props"][key2];
}
}
} catch (error) {
- console.log(key3, error);
+ console.log(key2, error);
}
}
return results;
};
-function executeCodeBlocks(node2, type, codeBlockStore, results) {
- const { id: id3 } = node2;
- for (const key3 of Object.keys(codeBlockStore)) {
+function executeCodeBlocks(node, type, codeBlockStore, results) {
+ const { id: id3 } = node;
+ for (const key2 of Object.keys(codeBlockStore)) {
let result;
try {
- if (key3 in (results.newState?.[id3]?.[type] || {})) {
- result = results.newState[id3][type][key3];
+ if (key2 in (results.newState?.[id3]?.[type] || {})) {
+ result = results.newState[id3][type][key2];
} else {
- result = codeBlockStore[key3]?.call(results.state);
+ result = codeBlockStore[key2]?.call(results.state);
}
if (result !== null) {
- results.state[node2.id][type][key3] = result;
+ results.state[node.id][type][key2] = result;
} else {
- delete results.state[node2.id][type][key3];
+ delete results.state[node.id][type][key2];
}
} catch (error) {
- console.log(error, key3);
+ console.log(error, key2);
}
}
return results;
@@ -95111,8 +95011,8 @@ var filterFnTypes = {
// src/core/utils/commands/filter.ts
var filterForAny = (props, filters) => {
- return filters.reduce((p2, c3) => {
- if (p2 == true)
+ return filters.reduce((p, c3) => {
+ if (p == true)
return true;
return props ? filterForProps(props, c3) : false;
}, false);
@@ -95126,15 +95026,15 @@ var filterForProps = (props, def) => {
return result;
};
var filterPathsForAll = (props, filters) => {
- return filters.reduce((p2, c3) => {
- if (p2 == false)
+ return filters.reduce((p, c3) => {
+ if (p == false)
return false;
return props ? filterForProps(props, c3) : false;
}, true);
};
var resultForFilters = (filters, props) => {
- const pathInFilter = filters.reduce((p2, c3) => {
- if (!p2 || c3.filters.length == 0)
+ const pathInFilter = filters.reduce((p, c3) => {
+ if (!p || c3.filters.length == 0)
return false;
const result = c3.type == "any" ? filterForAny(props, c3.filters) : filterPathsForAll(props, c3.filters);
return result;
@@ -95162,7 +95062,7 @@ var runActionTree = async (superstate, actionTree, instance) => {
props: {
...actionTree?.props ?? {},
...Object.keys(actionTree.linked ?? {}).reduce(
- (p2, c3) => ({ ...p2, [c3]: instance.instanceProps[actionTree.linked[c3]] }),
+ (p, c3) => ({ ...p, [c3]: instance.instanceProps[actionTree.linked[c3]] }),
{}
),
...actionTree.result ? { [actionTree.result]: instance.result } : {}
@@ -95222,7 +95122,7 @@ var runActionTree = async (superstate, actionTree, instance) => {
// src/core/react/components/SpaceEditor/Actions/ActionTester.tsx
var ActionTester = (props) => {
- const path3 = props.superstate.pathsIndex.get(props.path);
+ const path2 = props.superstate.pathsIndex.get(props.path);
const [fieldValues, setFieldValues] = (0, import_react14.useState)({});
const [result, setResult] = (0, import_react14.useState)();
const [error, setError] = (0, import_react14.useState)();
@@ -95240,7 +95140,7 @@ var ActionTester = (props) => {
$api: props.superstate.api,
$contexts: {
$space: {
- path: path3
+ path: path2
},
$context: {}
},
@@ -95263,9 +95163,9 @@ var ActionTester = (props) => {
props.superstate.formulaContext,
props.superstate.pathsIndex,
props.code,
- props.fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}),
+ props.fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}),
values2,
- path3,
+ path2,
true
);
} catch (e5) {
@@ -95636,14 +95536,14 @@ var showPropertyMenu = (props) => {
};
// src/core/react/components/UI/Menus/menu/concerns/matchers.js
-function escapeForRegExp(string6) {
- return string6.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&");
+function escapeForRegExp(string4) {
+ return string4.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&");
}
-function matchAny(string6) {
- return new RegExp(escapeForRegExp(string6), "gi");
+function matchAny(string4) {
+ return new RegExp(escapeForRegExp(string4), "gi");
}
-function matchExact(string6) {
- return new RegExp(`^${escapeForRegExp(string6)}$`, "i");
+function matchExact(string4) {
+ return new RegExp(`^${escapeForRegExp(string4)}$`, "i");
}
// src/core/react/context/ContextEditorContext.tsx
@@ -95904,41 +95804,41 @@ var FramesMDBProvider = (props) => {
return frameData?.[frameSchema?.id];
}, [frameData, frameSchema]);
const { spaceInfo, readMode } = (0, import_react19.useContext)(SpaceContext);
- const deleteSchema = async (table2) => {
- if (table2.primary)
+ const deleteSchema = async (table) => {
+ if (table.primary)
return;
- await props.superstate.spaceManager.deleteFrame(spaceInfo.path, table2.id);
+ await props.superstate.spaceManager.deleteFrame(spaceInfo.path, table.id);
const newSchemaTable = {
...schemaTable,
- rows: schemaTable.rows.filter((f2) => f2.id != table2.id)
+ rows: schemaTable.rows.filter((f2) => f2.id != table.id)
};
setSchemaTable(newSchemaTable);
};
- const saveSchema = async (table2) => {
- const newSchema = schemaTable.rows.find((f2) => f2.id == table2.id) ? true : false;
+ const saveSchema = async (table) => {
+ const newSchema = schemaTable.rows.find((f2) => f2.id == table.id) ? true : false;
const newSchemaTable = newSchema ? {
...schemaTable,
rows: schemaTable.rows.map(
- (f2) => f2.id == table2.id ? frameSchemaToTableSchema(table2) : f2
+ (f2) => f2.id == table.id ? frameSchemaToTableSchema(table) : f2
)
} : {
...schemaTable,
- rows: [...schemaTable.rows, frameSchemaToTableSchema(table2)]
+ rows: [...schemaTable.rows, frameSchemaToTableSchema(table)]
};
if (!spaceInfo.readOnly) {
await props.superstate.spaceManager.saveFrameSchema(
spaceInfo.path,
- table2.id,
- () => frameSchemaToTableSchema(table2)
+ table.id,
+ () => frameSchemaToTableSchema(table)
);
}
- if (table2.id == frameSchema?.id) {
- setFrameSchema(table2);
+ if (table.id == frameSchema?.id) {
+ setFrameSchema(table);
setFrameData((f2) => ({
...f2,
- [table2.id]: {
- ...f2[table2.id],
- schema: frameSchemaToTableSchema(table2)
+ [table.id]: {
+ ...f2[table.id],
+ schema: frameSchemaToTableSchema(table)
}
}));
}
@@ -95954,7 +95854,7 @@ var FramesMDBProvider = (props) => {
}, [schemaTable]);
(0, import_react19.useEffect)(() => {
if (schemaTable) {
- setFrameSchema((p2) => {
+ setFrameSchema((p) => {
if (props.schema) {
const preselectSchema = mdbSchemaToFrameSchema(
schemaTable.rows.find(
@@ -95978,9 +95878,9 @@ var FramesMDBProvider = (props) => {
return newSchema;
}
} else {
- if (p2) {
+ if (p) {
return mdbSchemaToFrameSchema(
- schemaTable.rows?.find((g) => g.id == p2.id)
+ schemaTable.rows?.find((g) => g.id == p.id)
);
} else {
if (props.contextSchema) {
@@ -96005,7 +95905,7 @@ var FramesMDBProvider = (props) => {
}
}
}
- return p2;
+ return p;
});
}
}, [schemaTable, props.contextSchema, props.schema]);
@@ -96051,16 +95951,16 @@ var FramesMDBProvider = (props) => {
(0, import_react19.useEffect)(() => {
loadTables();
}, [spaceInfo, props.schema]);
- const saveFrame = async (newTable, track2 = true) => {
+ const saveFrame = async (newTable, track = true) => {
if (spaceInfo.readOnly)
return;
- if (track2) {
+ if (track) {
setHistory((prevHistory) => [...prevHistory, newTable]);
setFuture([]);
}
await props.superstate.spaceManager.saveFrame(spaceInfo.path, newTable).then((f2) => {
- setFrameData((p2) => ({
- ...p2,
+ setFrameData((p) => ({
+ ...p,
[newTable.schema.id]: newTable
}));
});
@@ -96209,7 +96109,7 @@ var ContextEditorProvider = (props) => {
);
return _views.length > 0 ? _views : frameSchema ? [frameSchema] : [];
}, [frameSchemas, frameSchema, dbSchema]);
- const defaultSchema2 = defaultContextTable;
+ const defaultSchema = defaultContextTable;
const contexts = spaceCache?.contexts ?? [];
const loadTables = async () => {
const schemas = await props.superstate.spaceManager.tablesForSpace(
@@ -96217,7 +96117,7 @@ var ContextEditorProvider = (props) => {
);
if (schemas)
setSchemaTable(() => ({
- ...defaultSchema2,
+ ...defaultSchema,
rows: schemas
}));
};
@@ -96312,8 +96212,8 @@ var ContextEditorProvider = (props) => {
() => tableData ? [
...tableData.cols.map((f2) => ({ ...f2, table: "" })) ?? [],
...dbSchema?.primary == "true" ? contexts.reduce(
- (p2, c3) => [
- ...p2,
+ (p, c3) => [
+ ...p,
...contextTable[c3]?.cols.filter((f2) => f2.primary != "true").map((f2) => ({ ...f2, table: c3 })) ?? []
],
[]
@@ -96321,9 +96221,9 @@ var ContextEditorProvider = (props) => {
] : [],
[tableData, contextTable, contexts, dbSchema]
);
- const data3 = (0, import_react20.useMemo)(
- () => tableData?.rows.map((r2, index3) => ({
- _index: index3.toString(),
+ const data2 = (0, import_react20.useMemo)(
+ () => tableData?.rows.map((r2, index2) => ({
+ _index: index2.toString(),
...r2,
...r2[PathPropertyName] ? {
[PathPropertyName]: props.superstate.spaceManager.resolvePath(
@@ -96331,7 +96231,7 @@ var ContextEditorProvider = (props) => {
spaceCache?.path
)
} : {},
- ...contexts.reduce((p2, c3) => {
+ ...contexts.reduce((p, c3) => {
const contextRowIndexByPath = contextTable[c3]?.rows.findIndex(
(f2) => f2[PathPropertyName] == r2[PathPropertyName]
) ?? -1;
@@ -96341,7 +96241,7 @@ var ContextEditorProvider = (props) => {
).reduce((pa, ca) => ({ ...pa, [ca + c3]: contextRowsByPath[ca] }), {
["_index" + c3]: contextRowIndexByPath.toString()
});
- return { ...p2, ...contextRowsWithKeysAppended };
+ return { ...p, ...contextRowsWithKeysAppended };
}, {})
})) ?? [],
[tableData, contextTable, cols, dbSchema, spaceCache]
@@ -96369,64 +96269,64 @@ var ContextEditorProvider = (props) => {
);
}, [cols, predicate]);
const filteredData = (0, import_react20.useMemo)(
- () => data3.filter((f2) => {
- return (predicate?.filters ?? []).reduce((p2, c3) => {
- return p2 ? filterReturnForCol(
+ () => data2.filter((f2) => {
+ return (predicate?.filters ?? []).reduce((p, c3) => {
+ return p ? filterReturnForCol(
cols.find((col) => col.name + col.table == c3.field),
c3,
f2,
spaceCache.properties
- ) : p2;
+ ) : p;
}, true);
}).filter(
(f2) => searchString?.length > 0 ? matchAny(searchString).test(
Object.keys(f2).filter((g) => g.charAt(0) != "_").map((g) => f2[g]).join("|")
) : true
).sort((a4, b2) => {
- return (predicate?.sort ?? []).reduce((p2, c3) => {
- return p2 == 0 ? sortReturnForCol(
+ return (predicate?.sort ?? []).reduce((p, c3) => {
+ return p == 0 ? sortReturnForCol(
cols.find((col) => col.name + col.table == c3.field),
c3,
a4,
b2
- ) : p2;
+ ) : p;
}, 0);
}),
- [predicate, data3, cols, searchString]
+ [predicate, data2, cols, searchString]
);
- const updateValue2 = (column2, value, table2, index3, path3) => {
- const col = (table2 == "" ? tableData : contextTable[table2])?.cols.find(
+ const updateValue2 = (column2, value, table, index2, path2) => {
+ const col = (table == "" ? tableData : contextTable[table])?.cols.find(
(f2) => f2.name == column2
);
if (col)
saveProperties(
props.superstate,
- path3 ?? tableData.rows[index3]?.[PathPropertyName],
+ path2 ?? tableData.rows[index2]?.[PathPropertyName],
{ [column2]: parseMDBValue(col.type, value) }
);
- if (table2 == "") {
+ if (table == "") {
saveDB({
...tableData,
rows: tableData.rows.map(
- (r2, i4) => i4 == index3 ? {
+ (r2, i4) => i4 == index2 ? {
...r2,
[column2]: value
} : r2
)
});
- } else if (contextTable[table2]) {
- const path4 = tableData.rows[index3][PathPropertyName];
+ } else if (contextTable[table]) {
+ const path3 = tableData.rows[index2][PathPropertyName];
saveContextDB(
{
- ...contextTable[table2],
- rows: contextTable[table2].rows.map(
- (r2, i4) => r2[PathPropertyName] == path4 ? {
+ ...contextTable[table],
+ rows: contextTable[table].rows.map(
+ (r2, i4) => r2[PathPropertyName] == path3 ? {
...r2,
[column2]: value
} : r2
)
},
- table2
+ table
);
}
};
@@ -96443,14 +96343,14 @@ var ContextEditorProvider = (props) => {
] : predicate.colsHidden.filter((s4) => s4 != col.name + col.table)
});
};
- const updateFieldValue = (column2, fieldValue, value, table2, index3, path3) => {
+ const updateFieldValue = (column2, fieldValue, value, table, index2, path2) => {
const col = tableData.cols.find((f2) => f2.name == column2);
saveProperties(
props.superstate,
- path3 ?? tableData.rows[index3]?.[PathPropertyName],
+ path2 ?? tableData.rows[index2]?.[PathPropertyName],
{ [column2]: parseMDBValue(col.type, value) }
);
- if (table2 == "") {
+ if (table == "") {
const newTable = {
...tableData,
cols: tableData.cols.map(
@@ -96460,32 +96360,32 @@ var ContextEditorProvider = (props) => {
} : m4
),
rows: tableData.rows.map(
- (r2, i4) => i4 == index3 ? {
+ (r2, i4) => i4 == index2 ? {
...r2,
[column2]: value
} : r2
)
};
saveDB(newTable);
- } else if (contextTable[table2]) {
- const path4 = tableData.rows[index3][PathPropertyName];
+ } else if (contextTable[table]) {
+ const path3 = tableData.rows[index2][PathPropertyName];
saveContextDB(
{
- ...contextTable[table2],
- cols: contextTable[table2].cols.map(
+ ...contextTable[table],
+ cols: contextTable[table].cols.map(
(m4) => m4.name == column2 ? {
...m4,
value: fieldValue
} : m4
),
- rows: contextTable[table2].rows.map(
- (r2, i4) => path4 == r2[PathPropertyName] ? {
+ rows: contextTable[table].rows.map(
+ (r2, i4) => path3 == r2[PathPropertyName] ? {
...r2,
[column2]: value
} : r2
)
},
- table2
+ table
);
}
};
@@ -96502,11 +96402,11 @@ var ContextEditorProvider = (props) => {
...rows.rows,
{
[PathPropertyName]: c3,
- ...properties3 ? fmKeys.reduce((p2, c4) => {
+ ...properties3 ? fmKeys.reduce((p, c4) => {
const value = parseProperty(c4, properties3[c4]);
if (value?.length > 0)
- return { ...p2, [c4]: value };
- return p2;
+ return { ...p, [c4]: value };
+ return p;
}, {}) : {}
}
]
@@ -96549,9 +96449,9 @@ var ContextEditorProvider = (props) => {
if (!(dbSchema?.primary == "true"))
return;
if (lastSelected) {
- const path3 = tableData.rows[parseInt(lastSelected)]?.[PathPropertyName];
- if (path3)
- props.superstate.ui.setActivePath(path3);
+ const path2 = tableData.rows[parseInt(lastSelected)]?.[PathPropertyName];
+ if (path2)
+ props.superstate.ui.setActivePath(path2);
} else {
props.superstate.ui.setActivePath(contextPath);
}
@@ -96584,10 +96484,10 @@ var ContextEditorProvider = (props) => {
};
(0, import_react20.useEffect)(() => {
if (predicate)
- setPredicate((p2) => ({
- ...p2,
+ setPredicate((p) => ({
+ ...p,
colsOrder: uniq([
- ...p2.colsOrder,
+ ...p.colsOrder,
...cols.filter((f2) => f2.hidden != "true").map((c3) => c3.name + c3.table)
])
}));
@@ -96608,11 +96508,11 @@ var ContextEditorProvider = (props) => {
};
const delColumn = (column2) => {
let mdbtable;
- const table2 = column2.table;
- if (table2 == "") {
+ const table = column2.table;
+ if (table == "") {
mdbtable = tableData;
- } else if (contextTable[table2]) {
- mdbtable = contextTable[table2];
+ } else if (contextTable[table]) {
+ mdbtable = contextTable[table];
}
const newFields = mdbtable.cols.filter(
(f2, i4) => f2.name != column2.name
@@ -96625,10 +96525,10 @@ var ContextEditorProvider = (props) => {
return rest;
})
};
- if (table2 == "") {
+ if (table == "") {
saveDB(newTable);
- } else if (contextTable[table2]) {
- saveContextDB(newTable, table2);
+ } else if (contextTable[table]) {
+ saveContextDB(newTable, table);
}
};
const newColumn = (col) => {
@@ -96640,11 +96540,11 @@ var ContextEditorProvider = (props) => {
...newColumn2,
name: sanitizeColumnName(newColumn2.name)
};
- const table2 = column2.table;
- if (table2 == "" || table2 == contextPath) {
+ const table = column2.table;
+ if (table == "" || table == contextPath) {
mdbtable = tableData;
- } else if (contextTable[table2]) {
- mdbtable = contextTable[table2];
+ } else if (contextTable[table]) {
+ mdbtable = contextTable[table];
}
if (column2.name == "") {
props.superstate.ui.notify(i18n_default.notice.noPropertyName);
@@ -96694,14 +96594,14 @@ var ContextEditorProvider = (props) => {
[oldColumn.name + oldColumn.table]: void 0
}
});
- if (table2 == "") {
+ if (table == "") {
if (dbSchema.id == defaultContextSchemaID) {
syncAllProperties(newTable);
} else {
saveDB(newTable);
}
- } else if (contextTable[table2]) {
- saveContextDB(newTable, table2);
+ } else if (contextTable[table]) {
+ saveContextDB(newTable, table);
}
return true;
};
@@ -96740,8 +96640,8 @@ var ContextEditorProvider = (props) => {
var import_react21 = __toESM(require_react());
function useCombinedRefs2(...refs) {
return (0, import_react21.useMemo)(
- () => (node2) => {
- refs.forEach((ref2) => ref2(node2));
+ () => (node) => {
+ refs.forEach((ref2) => ref2(node));
},
refs
);
@@ -96905,8 +96805,8 @@ var allCacheTypesForPaths = (superstate, paths) => {
return [];
;
const properties3 = {};
- for (const path3 of paths) {
- const f2 = superstate.pathsIndex.get(path3)?.metadata;
+ for (const path2 of paths) {
+ const f2 = superstate.pathsIndex.get(path2)?.metadata;
if (f2) {
Object.keys(f2).forEach((k2) => {
const type = detectPropertyType(f2[k2], k2);
@@ -96915,8 +96815,8 @@ var allCacheTypesForPaths = (superstate, paths) => {
});
}
}
- return Object.keys(properties3).reduce((p2, c3) => {
- return [...p2, { name: c3, type: properties3[c3][0] }];
+ return Object.keys(properties3).reduce((p, c3) => {
+ return [...p, { name: c3, type: properties3[c3][0] }];
}, []);
};
@@ -97302,9 +97202,9 @@ var SpacePropertyEditor = (props) => {
const [openNodes, setOpenNodes] = (0, import_react25.useState)([]);
const [overId, setOverId] = (0, import_react25.useState)("");
const contextProperties = (0, import_react25.useMemo)(() => {
- return props.contexts.reduce((p2, c3) => {
+ return props.contexts.reduce((p, c3) => {
return {
- ...p2,
+ ...p,
[c3]: {
path: props.superstate.pathsIndex.get(tagSpacePathFromTag(c3)),
space: props.superstate.spacesIndex.get(tagSpacePathFromTag(c3)),
@@ -97459,9 +97359,9 @@ var SpacePropertyEditor = (props) => {
}, /* @__PURE__ */ import_react25.default.createElement(SortableContext, {
items,
strategy: verticalListSortingStrategy
- }, items.map((value, index3) => {
+ }, items.map((value, index2) => {
return /* @__PURE__ */ import_react25.default.createElement(SortableItem, {
- key: index3,
+ key: index2,
id: value.id,
field: value,
superstate: props.superstate,
@@ -97567,35 +97467,35 @@ var import_react46 = __toESM(require_react());
var import_react45 = __toESM(require_react());
// src/core/utils/contexts/embed.ts
-var framePathForSpace = (space3, schema) => {
- if (space3.type == "folder") {
- return `${space3.path}/#*${schema}`;
+var framePathForSpace = (space2, schema) => {
+ if (space2.type == "folder") {
+ return `${space2.path}/#*${schema}`;
}
- if (space3.type == "vault") {
+ if (space2.type == "vault") {
return `/#*${schema}`;
}
- return `${space3.path}/#*${schema}`;
+ return `${space2.path}/#*${schema}`;
};
-var actionPathForSpace = (space3, schema) => {
- if (space3.type == "folder") {
- return `${space3.path}/#;${schema}`;
+var actionPathForSpace = (space2, schema) => {
+ if (space2.type == "folder") {
+ return `${space2.path}/#;${schema}`;
}
- if (space3.type == "vault") {
+ if (space2.type == "vault") {
return `/#;${schema}`;
}
- return `${space3.path}/#;${schema}`;
+ return `${space2.path}/#;${schema}`;
};
-var contextPathForSpace = (space3, schema) => {
- if (space3.type == "folder") {
- return `${space3.path}/#^${schema}`;
+var contextPathForSpace = (space2, schema) => {
+ if (space2.type == "folder") {
+ return `${space2.path}/#^${schema}`;
}
- if (space3.type == "vault") {
+ if (space2.type == "vault") {
return `/#^${schema}`;
}
- return `${space3.path}/#^${schema}`;
+ return `${space2.path}/#^${schema}`;
};
-var contextViewEmbedStringFromContext = (space3, schema) => `![![${framePathForSpace(space3, schema)}]]`;
-var contextEmbedStringFromContext = (space3, schema) => `![![${contextPathForSpace(space3, schema)}]]`;
+var contextViewEmbedStringFromContext = (space2, schema) => `![![${framePathForSpace(space2, schema)}]]`;
+var contextEmbedStringFromContext = (space2, schema) => `![![${contextPathForSpace(space2, schema)}]]`;
// src/core/react/components/SpaceEditor/ActionsList.tsx
var import_react26 = __toESM(require_react());
@@ -97746,8 +97646,8 @@ var import_react27 = __toESM(require_react());
var PathStickerView = (props) => {
const { pathState } = props;
const sticker = pathState?.label?.sticker;
- const color3 = pathState?.label?.color;
- const extension2 = pathState?.type;
+ const color2 = pathState?.label?.color;
+ const extension = pathState?.type;
const triggerStickerContextMenu = (e5) => {
if (!pathState)
return;
@@ -97802,8 +97702,8 @@ var PathStickerView = (props) => {
}) : /* @__PURE__ */ import_react27.default.createElement("button", {
"aria-label": i18n_default.buttons.changeIcon,
onContextMenu: triggerStickerContextMenu,
- style: color3?.length > 0 ? {
- "--label-color": `${color3}`,
+ style: color2?.length > 0 ? {
+ "--label-color": `${color2}`,
"--icon-color": `#ffffff`
} : {
"--icon-color": `var(--mk-ui-text-secondary)`
@@ -97846,18 +97746,18 @@ var PathStickerContainer = (props) => {
// src/core/react/components/UI/Crumbs/PathCrumb.tsx
var PathCrumb = (props) => {
- const path3 = (0, import_react28.useMemo)(
+ const path2 = (0, import_react28.useMemo)(
() => props.source && props.path ? props.superstate.spaceManager.resolvePath(props.path, props.source) : props.path,
[props.source, props.path]
);
const [cache2, setCache] = (0, import_react28.useState)(
- props.superstate.pathsIndex.get(path3)
+ props.superstate.pathsIndex.get(path2)
);
const reloadCache = () => {
- setCache(props.superstate.pathsIndex.get(path3));
+ setCache(props.superstate.pathsIndex.get(path2));
};
const reloadIcon = (payload) => {
- if (payload.path == path3) {
+ if (payload.path == path2) {
reloadCache();
}
};
@@ -97873,11 +97773,11 @@ var PathCrumb = (props) => {
reloadIcon
);
};
- }, [path3]);
+ }, [path2]);
return /* @__PURE__ */ import_react28.default.createElement("div", {
className: "mk-path",
- "aria-label": path3,
- onClick: () => props.superstate.ui.openPath(cache2?.path ?? path3, false),
+ "aria-label": path2,
+ onClick: () => props.superstate.ui.openPath(cache2?.path ?? path2, false),
onContextMenu: (e5) => cache2 && showPathContextMenu(props.superstate, cache2.path, null, {
x: e5.clientX,
y: e5.clientY,
@@ -97887,7 +97787,7 @@ var PathCrumb = (props) => {
}, cache2 && /* @__PURE__ */ import_react28.default.createElement(PathStickerView, {
superstate: props.superstate,
pathState: cache2
- }), /* @__PURE__ */ import_react28.default.createElement("span", null, (!props.hideName && cache2?.displayName) ?? path3), props.children);
+ }), /* @__PURE__ */ import_react28.default.createElement("span", null, (!props.hideName && cache2?.displayName) ?? path2), props.children);
};
// src/core/react/components/UI/Menus/properties/datePickerMenu.tsx
@@ -97899,9 +97799,9 @@ var __assign = function() {
__assign = Object.assign || function __assign4(t5) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
- for (var p2 in s4)
- if (Object.prototype.hasOwnProperty.call(s4, p2))
- t5[p2] = s4[p2];
+ for (var p in s4)
+ if (Object.prototype.hasOwnProperty.call(s4, p))
+ t5[p] = s4[p];
}
return t5;
};
@@ -97909,13 +97809,13 @@ var __assign = function() {
};
function __rest(s4, e5) {
var t5 = {};
- for (var p2 in s4)
- if (Object.prototype.hasOwnProperty.call(s4, p2) && e5.indexOf(p2) < 0)
- t5[p2] = s4[p2];
+ for (var p in s4)
+ if (Object.prototype.hasOwnProperty.call(s4, p) && e5.indexOf(p) < 0)
+ t5[p] = s4[p];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i4 = 0, p2 = Object.getOwnPropertySymbols(s4); i4 < p2.length; i4++) {
- if (e5.indexOf(p2[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p2[i4]))
- t5[p2[i4]] = s4[p2[i4]];
+ for (var i4 = 0, p = Object.getOwnPropertySymbols(s4); i4 < p.length; i4++) {
+ if (e5.indexOf(p[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p[i4]))
+ t5[p[i4]] = s4[p[i4]];
}
return t5;
}
@@ -97937,14 +97837,14 @@ function requireReactJsxRuntime_production_min() {
if (hasRequiredReactJsxRuntime_production_min)
return reactJsxRuntime_production_min;
hasRequiredReactJsxRuntime_production_min = 1;
- var f2 = import_react29.default, k2 = Symbol.for("react.element"), l2 = Symbol.for("react.fragment"), m4 = Object.prototype.hasOwnProperty, n3 = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p2 = { key: true, ref: true, __self: true, __source: true };
+ var f2 = import_react29.default, k2 = Symbol.for("react.element"), l2 = Symbol.for("react.fragment"), m4 = Object.prototype.hasOwnProperty, n3 = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
function q2(c3, a4, g) {
var b2, d4 = {}, e5 = null, h3 = null;
void 0 !== g && (e5 = "" + g);
void 0 !== a4.key && (e5 = "" + a4.key);
void 0 !== a4.ref && (h3 = a4.ref);
for (b2 in a4)
- m4.call(a4, b2) && !p2.hasOwnProperty(b2) && (d4[b2] = a4[b2]);
+ m4.call(a4, b2) && !p.hasOwnProperty(b2) && (d4[b2] = a4[b2]);
if (c3 && c3.defaultProps)
for (b2 in a4 = c3.defaultProps, a4)
void 0 === d4[b2] && (d4[b2] = a4[b2]);
@@ -98409,10 +98309,10 @@ function Caption(props) {
return jsxRuntimeExports.jsx("div", { className: classNames13.caption, style: styles2.caption, children: caption });
}
function Footer(props) {
- var _a = useDayPicker(), footer2 = _a.footer, styles2 = _a.styles, tfoot2 = _a.classNames.tfoot;
- if (!footer2)
+ var _a = useDayPicker(), footer = _a.footer, styles2 = _a.styles, tfoot = _a.classNames.tfoot;
+ if (!footer)
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
- return jsxRuntimeExports.jsx("tfoot", { className: tfoot2, style: styles2.tfoot, children: jsxRuntimeExports.jsx("tr", { children: jsxRuntimeExports.jsx("td", { colSpan: 8, children: footer2 }) }) });
+ return jsxRuntimeExports.jsx("tfoot", { className: tfoot, style: styles2.tfoot, children: jsxRuntimeExports.jsx("tr", { children: jsxRuntimeExports.jsx("td", { colSpan: 8, children: footer }) }) });
}
function getWeekdays(locale2, weekStartsOn, ISOWeek) {
var start = ISOWeek ? startOfISOWeek(new Date()) : startOfWeek(new Date(), { locale: locale2, weekStartsOn });
@@ -98469,10 +98369,10 @@ function SelectMultipleProviderInternal(_a) {
}
var selectedDays = selected ? __spreadArray([], selected, true) : [];
if (activeModifiers.selected) {
- var index3 = selectedDays.findIndex(function(selectedDay) {
+ var index2 = selectedDays.findIndex(function(selectedDay) {
return isSameDay(day, selectedDay);
});
- selectedDays.splice(index3, 1);
+ selectedDays.splice(index2, 1);
} else {
selectedDays.push(day);
}
@@ -98799,10 +98699,10 @@ function isMatch(day, matchers) {
});
}
function getActiveModifiers(day, modifiers, displayMonth) {
- var matchedModifiers = Object.keys(modifiers).reduce(function(result, key3) {
- var modifier = modifiers[key3];
+ var matchedModifiers = Object.keys(modifiers).reduce(function(result, key2) {
+ var modifier = modifiers[key2];
if (isMatch(day, modifier)) {
- result.push(key3);
+ result.push(key2);
}
return result;
}, []);
@@ -99227,15 +99127,15 @@ function Day(props) {
function WeekNumber(props) {
var weekNumber = props.number, dates = props.dates;
var _a = useDayPicker(), onWeekNumberClick = _a.onWeekNumberClick, styles2 = _a.styles, classNames13 = _a.classNames, locale2 = _a.locale, labelWeekNumber2 = _a.labels.labelWeekNumber, formatWeekNumber2 = _a.formatters.formatWeekNumber;
- var content5 = formatWeekNumber2(Number(weekNumber), { locale: locale2 });
+ var content3 = formatWeekNumber2(Number(weekNumber), { locale: locale2 });
if (!onWeekNumberClick) {
- return jsxRuntimeExports.jsx("span", { className: classNames13.weeknumber, style: styles2.weeknumber, children: content5 });
+ return jsxRuntimeExports.jsx("span", { className: classNames13.weeknumber, style: styles2.weeknumber, children: content3 });
}
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: classNames13.weeknumber, style: styles2.weeknumber, onClick: handleClick, children: content5 });
+ return jsxRuntimeExports.jsx(Button, { name: "week-number", "aria-label": label, className: classNames13.weeknumber, style: styles2.weeknumber, onClick: handleClick, children: content3 });
}
function Row(props) {
var _a, _b;
@@ -99397,11 +99297,11 @@ function Root(_a) {
classNames13.push(dayPicker.classNames.with_weeknumber);
}
var style = __assign(__assign({}, dayPicker.styles.root), dayPicker.style);
- var dataAttributes = Object.keys(initialProps).filter(function(key3) {
- return key3.startsWith("data-");
- }).reduce(function(attrs, key3) {
+ var dataAttributes = Object.keys(initialProps).filter(function(key2) {
+ return key2.startsWith("data-");
+ }).reduce(function(attrs, key2) {
var _a2;
- return __assign(__assign({}, attrs), (_a2 = {}, _a2[key3] = initialProps[key3], _a2));
+ return __assign(__assign({}, attrs), (_a2 = {}, _a2[key2] = initialProps[key2], _a2));
}, {});
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: classNames13.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) {
@@ -99584,8 +99484,8 @@ var import_react39 = __toESM(require_react());
// src/core/react/components/UI/Menus/navigator/showSpaceAddMenu.tsx
var import_react31 = __toESM(require_react());
-var defaultAddAction = (superstate, space3, location) => {
- if (space3?.path == "spaces://$tags") {
+var defaultAddAction = (superstate, space2, location) => {
+ if (space2?.path == "spaces://$tags") {
superstate.ui.openModal("New Tag", (props) => {
return /* @__PURE__ */ import_react31.default.createElement(InputModal, {
value: "",
@@ -99594,12 +99494,12 @@ var defaultAddAction = (superstate, space3, location) => {
saveValue: (value) => addTag(superstate, value)
});
});
- } else if (space3) {
- if (space3?.metadata.template?.length > 0) {
- newTemplateInSpace(superstate, space3, space3.metadata.template, location);
+ } else if (space2) {
+ if (space2?.metadata.template?.length > 0) {
+ newTemplateInSpace(superstate, space2, space2.metadata.template, location);
return;
} else {
- newPathInSpace(superstate, space3, "md", null, false, null, location);
+ newPathInSpace(superstate, space2, "md", null, false, null, location);
}
} else {
defaultSpace(
@@ -99611,9 +99511,9 @@ var defaultAddAction = (superstate, space3, location) => {
});
}
};
-var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => {
+var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => {
const menuOptions = [];
- if (space3.type == "default") {
+ if (space2.type == "default") {
menuOptions.push({
name: "New Tag",
icon: "ui//tags",
@@ -99635,7 +99535,7 @@ var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => {
onClick: (e5) => {
newPathInSpace(
superstate,
- space3,
+ space2,
"md",
superstate.settings.newNotePlaceholder,
dontOpen
@@ -99646,7 +99546,7 @@ var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => {
name: i18n_default.buttons.createCanvas,
icon: "ui//layout-dashboard",
onClick: (e5) => {
- newPathInSpace(superstate, space3, "canvas", null, dontOpen);
+ newPathInSpace(superstate, space2, "canvas", null, dontOpen);
}
});
menuOptions.push({
@@ -99660,7 +99560,7 @@ var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => {
value: "",
hide: props.hide,
saveValue: (v2) => {
- let pathState = superstate.pathsIndex.get(space3?.path);
+ let pathState = superstate.pathsIndex.get(space2?.path);
if (!pathState) {
pathState = superstate.pathsIndex.get("/");
}
@@ -99681,14 +99581,14 @@ var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => {
);
}
});
- if (space3.templates.length > 0) {
+ if (space2.templates.length > 0) {
menuOptions.push(menuSeparator);
- for (const template2 of space3.templates) {
+ for (const template2 of space2.templates) {
menuOptions.push({
name: template2,
icon: "ui//clipboard-pen",
onClick: (e5) => {
- newTemplateInSpace(superstate, space3, template2);
+ newTemplateInSpace(superstate, space2, template2);
}
});
}
@@ -99701,7 +99601,7 @@ var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => {
};
// src/core/react/components/UI/Menus/properties/propertyMenu.tsx
-var showSetValueMenu = (rect, superstate, property, onChangeValue, path3) => {
+var showSetValueMenu = (rect, superstate, property, onChangeValue, path2) => {
if (!property)
return;
if (property.type == "text") {
@@ -99719,7 +99619,7 @@ var showSetValueMenu = (rect, superstate, property, onChangeValue, path3) => {
0 /* None */
);
} else if (property.type == "option") {
- const options = parseFieldValue(property.value, property.type, superstate, path3)?.options ?? [];
+ const options = parseFieldValue(property.value, property.type, superstate, path2)?.options ?? [];
superstate.ui.openMenu(rect, {
...defaultMenu(superstate.ui, options),
saveOptions: (options2, value) => {
@@ -100025,18 +99925,18 @@ var FilterBar = (props) => {
} = (0, import_react38.useContext)(ContextEditorContext);
const { frameSchema, saveSchema, setFrameSchema } = (0, import_react38.useContext)(FramesMDBContext);
const properties3 = spaceCache?.propertyTypes ?? [];
- const propertiesForFrame = (path3) => {
- if (!path3)
+ const propertiesForFrame = (path2) => {
+ if (!path2)
return [];
- const uri = props.superstate.spaceManager.uriByString(path3);
+ const uri = props.superstate.spaceManager.uriByString(path2);
if (uri.authority == "$kit") {
- const node2 = props.superstate.kitFrames.get(uri.ref).node;
- return Object.keys(node2.types).map((f2) => ({
- type: node2.types[f2],
+ const node = props.superstate.kitFrames.get(uri.ref).node;
+ return Object.keys(node.types).map((f2) => ({
+ type: node.types[f2],
name: f2,
- attrs: JSON.stringify(node2.propsAttrs?.[f2]),
- schemaId: node2.schemaId,
- value: JSON.stringify(node2.propsValue?.[f2])
+ attrs: JSON.stringify(node.propsAttrs?.[f2]),
+ schemaId: node.schemaId,
+ value: JSON.stringify(node.propsValue?.[f2])
})).filter((f2) => !f2.name.startsWith("_"));
} else {
return props.superstate.framesIndex.get(uri.path)?.frames[uri.ref].cols.filter((f2) => !f2.name.startsWith("_"));
@@ -100129,9 +100029,9 @@ var FilterBar = (props) => {
colsHidden: []
});
};
- const removeFilter = (filter4, index3) => {
+ const removeFilter = (filter4, index2) => {
const pred = predicate ?? defaultPredicateForSchema(dbSchema);
- const newFilters = [...pred.filters.filter((f2, i4) => i4 != index3)];
+ const newFilters = [...pred.filters.filter((f2, i4) => i4 != index2)];
savePredicate({
filters: newFilters
});
@@ -100286,13 +100186,13 @@ var FilterBar = (props) => {
};
const selectSource = (e5) => {
const offset2 = e5.target.getBoundingClientRect();
- showSpacesMenu(offset2, props.superstate, (link3) => {
+ showSpacesMenu(offset2, props.superstate, (link) => {
const newSchema = {
...frameSchema,
name: frameSchema.name,
def: {
db: dbSchema.id,
- context: link3
+ context: link
},
type: "view"
};
@@ -100535,7 +100435,7 @@ var FilterBar = (props) => {
openSpaceEditorModal(props.superstate, sourceCache, 1);
}
};
- const changeFilterMenu = (e5, filter4, index3) => {
+ const changeFilterMenu = (e5, filter4, index2) => {
const offset2 = e5.target.getBoundingClientRect();
const saveFilter = (_15, newType) => {
const type = newType[0];
@@ -100546,7 +100446,7 @@ var FilterBar = (props) => {
};
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? newFilter : s4
+ (s4, i4) => i4 == index2 ? newFilter : s4
)
});
};
@@ -100693,13 +100593,13 @@ var FilterBar = (props) => {
"right"
);
};
- const selectFilterValue = (e5, filter4, index3) => {
+ const selectFilterValue = (e5, filter4, index2) => {
switch (filter4.fType ?? filterFnTypes[filter4.fn].valueType) {
case "property":
{
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? filter4 : s4
+ (s4, i4) => i4 == index2 ? filter4 : s4
)
});
}
@@ -100709,7 +100609,7 @@ var FilterBar = (props) => {
{
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? filter4 : s4
+ (s4, i4) => i4 == index2 ? filter4 : s4
)
});
}
@@ -100722,7 +100622,7 @@ var FilterBar = (props) => {
};
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? newFilter : s4
+ (s4, i4) => i4 == index2 ? newFilter : s4
)
});
};
@@ -100741,10 +100641,10 @@ var FilterBar = (props) => {
{
const col = cols.find((f2) => f2.name + f2.table == filter4.field);
if (col?.type.startsWith("context")) {
- const space3 = parseFieldValue(col.value, col.type)?.space;
- if (!space3)
+ const space2 = parseFieldValue(col.value, col.type)?.space;
+ if (!space2)
return;
- const contextData = props.superstate.contextsIndex.get(space3)?.paths ?? [];
+ const contextData = props.superstate.contextsIndex.get(space2)?.paths ?? [];
const offset3 = e5.target.getBoundingClientRect();
props.superstate.ui.openMenu(offset3, {
ui: props.superstate.ui,
@@ -100762,7 +100662,7 @@ var FilterBar = (props) => {
};
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? newFilter : s4
+ (s4, i4) => i4 == index2 ? newFilter : s4
)
});
},
@@ -100772,14 +100672,14 @@ var FilterBar = (props) => {
});
return;
}
- const saveValue = (link3) => {
+ const saveValue = (link) => {
const newFilter = {
...filter4,
- value: link3
+ value: link
};
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? newFilter : s4
+ (s4, i4) => i4 == index2 ? newFilter : s4
)
});
};
@@ -100787,8 +100687,8 @@ var FilterBar = (props) => {
showLinkMenu(
offset2,
props.superstate,
- (link3) => {
- saveValue(link3);
+ (link) => {
+ saveValue(link);
},
{ multi: true }
);
@@ -100805,7 +100705,7 @@ var FilterBar = (props) => {
};
savePredicate({
filters: (predicate?.filters ?? []).map(
- (s4, i4) => i4 == index3 ? newFilter : s4
+ (s4, i4) => i4 == index2 ? newFilter : s4
)
});
};
@@ -100824,10 +100724,10 @@ var FilterBar = (props) => {
showAll: true
});
} else if (col.type.startsWith("context")) {
- const space3 = parseFieldValue(col.value, col.type)?.space;
- if (!space3)
+ const space2 = parseFieldValue(col.value, col.type)?.space;
+ if (!space2)
return;
- const contextData = props.superstate.contextsIndex.get(space3)?.paths ?? [];
+ const contextData = props.superstate.contextsIndex.get(space2)?.paths ?? [];
const offset2 = e5.target.getBoundingClientRect();
props.superstate.ui.openMenu(offset2, {
ui: props.superstate.ui,
@@ -100848,8 +100748,8 @@ var FilterBar = (props) => {
showLinkMenu(
offset2,
props.superstate,
- (link3) => {
- saveOptions([link3], [link3]);
+ (link) => {
+ saveOptions([link], [link]);
},
{ multi: true }
);
@@ -101153,8 +101053,8 @@ var SpaceQuery = (props) => {
}
};
const addDefGroup = () => {
- setFilters((p2) => [
- ...p2,
+ setFilters((p) => [
+ ...p,
{
type: "any",
trueFalse: true,
@@ -101546,7 +101446,7 @@ var SpaceItems = (props) => {
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//live")
},
- onClick: () => setSmartSearch((p2) => !p2)
+ onClick: () => setSmartSearch((p) => !p)
}), /* @__PURE__ */ import_react40.default.createElement("button", {
className: "mk-button-new",
"aria-label": i18n_default.buttons.addItem,
@@ -101555,9 +101455,9 @@ var SpaceItems = (props) => {
showLinkMenu(
offset2,
props.superstate,
- (link3) => saveMetadata({
+ (link) => saveMetadata({
...metadata,
- links: [...metadata.links ?? [], link3]
+ links: [...metadata.links ?? [], link]
})
);
e5.stopPropagation();
@@ -101636,8 +101536,8 @@ var TemplatesList = (props) => {
}, [pathState]);
const newAction = (e5) => {
const offset2 = e5.target.getBoundingClientRect();
- showLinkMenu(offset2, props.superstate, (space3) => {
- saveSpaceTemplate(props.superstate, pathState.path, space3);
+ showLinkMenu(offset2, props.superstate, (space2) => {
+ saveSpaceTemplate(props.superstate, pathState.path, space2);
});
e5.stopPropagation();
};
@@ -101882,17 +101782,17 @@ var TableList = (props) => {
icon: "ui//move",
onClick: (e6) => {
const offset2 = e6.target.getBoundingClientRect();
- showSpacesMenu(offset2, props.superstate, (space3) => {
- const table2 = props.superstate.contextsIndex.get(spaceState.path).tables?.[_schema.id];
- table2.schema.id = uniqueNameFromString(
- sanitizeTableName(table2.schema.id),
- Object.keys(props.superstate.contextsIndex.get(space3).tables)
+ showSpacesMenu(offset2, props.superstate, (space2) => {
+ const table = props.superstate.contextsIndex.get(spaceState.path).tables?.[_schema.id];
+ table.schema.id = uniqueNameFromString(
+ sanitizeTableName(table.schema.id),
+ Object.keys(props.superstate.contextsIndex.get(space2).tables)
);
- table2.cols = table2.cols.map((f2) => ({
+ table.cols = table.cols.map((f2) => ({
...f2,
- schemaId: table2.schema.id
+ schemaId: table.schema.id
}));
- props.superstate.spaceManager.createTable(space3, table2.schema).then((f2) => props.superstate.spaceManager.saveTable(space3, table2));
+ props.superstate.spaceManager.createTable(space2, table.schema).then((f2) => props.superstate.spaceManager.saveTable(space2, table));
});
}
});
@@ -101907,23 +101807,23 @@ var TableList = (props) => {
hide: _props.hide,
saveLabel: "Save",
saveValue: (value) => {
- const table2 = props.superstate.contextsIndex.get(
+ const table = props.superstate.contextsIndex.get(
spaceState.path
).tables?.[_schema.id];
- table2.schema.id = uniqueNameFromString(
+ table.schema.id = uniqueNameFromString(
sanitizeTableName(value),
Object.keys(
props.superstate.contextsIndex.get(spaceState.path).tables
)
);
- table2.cols = table2.cols.map((f2) => ({
+ table.cols = table.cols.map((f2) => ({
...f2,
- schemaId: table2.schema.id
+ schemaId: table.schema.id
}));
- props.superstate.spaceManager.createTable(spaceState.path, table2.schema).then(
+ props.superstate.spaceManager.createTable(spaceState.path, table.schema).then(
(f2) => props.superstate.spaceManager.saveTable(
spaceState.path,
- table2
+ table
)
);
}
@@ -102005,7 +101905,7 @@ var TableList = (props) => {
// src/core/react/components/SpaceEditor/SpaceEditor.tsx
var SpaceEditor = (props) => {
- const [tab2, setTab] = (0, import_react45.useState)(
+ const [tab, setTab] = (0, import_react45.useState)(
props.space?.type == "tag" ? Math.max(1, props.tab) : props.tab
);
return /* @__PURE__ */ import_react45.default.createElement("div", {
@@ -102015,35 +101915,35 @@ var SpaceEditor = (props) => {
}, props.space?.type != "tag" && /* @__PURE__ */ import_react45.default.createElement("div", {
"aria-label": i18n_default.subViews.spaceItems,
onClick: () => setTab(0),
- className: `mk-tab ${tab2 == 0 ? "mk-active" : ""}`,
+ className: `mk-tab ${tab == 0 ? "mk-active" : ""}`,
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//file-stack")
}
}), /* @__PURE__ */ import_react45.default.createElement("div", {
"aria-label": i18n_default.subViews.spaceContext,
onClick: () => setTab(1),
- className: `mk-tab ${tab2 == 1 ? "mk-active" : ""}`,
+ className: `mk-tab ${tab == 1 ? "mk-active" : ""}`,
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//list")
}
}), /* @__PURE__ */ import_react45.default.createElement("div", {
"aria-label": i18n_default.subViews.spaceLists,
onClick: () => setTab(2),
- className: `mk-tab ${tab2 == 2 ? "mk-active" : ""}`,
+ className: `mk-tab ${tab == 2 ? "mk-active" : ""}`,
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//layout-list")
}
}), /* @__PURE__ */ import_react45.default.createElement("div", {
"aria-label": i18n_default.subViews.spaceActions,
onClick: () => setTab(3),
- className: `mk-tab ${tab2 == 3 ? "mk-active" : ""}`,
+ className: `mk-tab ${tab == 3 ? "mk-active" : ""}`,
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//mouse-pointer-click")
}
}), /* @__PURE__ */ import_react45.default.createElement("div", {
"aria-label": i18n_default.subViews.spaceTemplates,
onClick: () => setTab(4),
- className: `mk-tab ${tab2 == 4 ? "mk-active" : ""}`,
+ className: `mk-tab ${tab == 4 ? "mk-active" : ""}`,
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//clipboard-pen")
}
@@ -102053,22 +101953,22 @@ var SpaceEditor = (props) => {
readMode: false
}, /* @__PURE__ */ import_react45.default.createElement(SpaceProvider, {
superstate: props.superstate
- }, tab2 == 0 ? /* @__PURE__ */ import_react45.default.createElement(SpaceItems, {
+ }, tab == 0 ? /* @__PURE__ */ import_react45.default.createElement(SpaceItems, {
superstate: props.superstate,
space: props.space
- }) : tab2 == 1 ? /* @__PURE__ */ import_react45.default.createElement(FramesMDBProvider, {
+ }) : tab == 1 ? /* @__PURE__ */ import_react45.default.createElement(FramesMDBProvider, {
superstate: props.superstate
}, /* @__PURE__ */ import_react45.default.createElement(ContextEditorProvider, {
superstate: props.superstate
}, /* @__PURE__ */ import_react45.default.createElement(SpacePropertyEditorContext, {
superstate: props.superstate
- }))) : tab2 == 2 ? /* @__PURE__ */ import_react45.default.createElement(TableList, {
+ }))) : tab == 2 ? /* @__PURE__ */ import_react45.default.createElement(TableList, {
superstate: props.superstate,
hide: props.close
- }) : tab2 == 3 ? /* @__PURE__ */ import_react45.default.createElement(ActionsList, {
+ }) : tab == 3 ? /* @__PURE__ */ import_react45.default.createElement(ActionsList, {
superstate: props.superstate,
close: props.close
- }) : tab2 == 4 ? /* @__PURE__ */ import_react45.default.createElement(TemplatesList, {
+ }) : tab == 4 ? /* @__PURE__ */ import_react45.default.createElement(TemplatesList, {
superstate: props.superstate,
close: props.close
}) : /* @__PURE__ */ import_react45.default.createElement(import_react45.default.Fragment, null))));
@@ -102076,13 +101976,13 @@ var SpaceEditor = (props) => {
var SpaceEditor_default = SpaceEditor;
// src/core/react/components/UI/Modals/ContextEditor.tsx
-var openSpaceEditorModal = (superstate, space3, tab2) => {
+var openSpaceEditorModal = (superstate, space2, tab) => {
superstate.ui.openModal(
- space3.name,
+ space2.name,
(props) => /* @__PURE__ */ import_react46.default.createElement(SpaceEditor_default, {
superstate,
- space: space3,
- tab: tab2,
+ space: space2,
+ tab,
close: () => {
props.hide();
}
@@ -102129,39 +102029,39 @@ var SpacePropertyEditorContext = (props) => {
};
// src/core/react/components/UI/Menus/navigator/spaceContextMenu.tsx
-var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onClose) => {
- const space3 = superstate.spacesIndex.get(path3.path);
- if (!space3)
+var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onClose) => {
+ const space2 = superstate.spacesIndex.get(path2.path);
+ if (!space2)
return;
const menuOptions = [];
menuOptions.push({
name: "New",
type: 6 /* Submenu */,
onSubmenu: (offset2) => {
- return showSpaceAddMenu(superstate, offset2, space3);
+ return showSpaceAddMenu(superstate, offset2, space2);
},
icon: "ui//plus"
});
- if (space3.type == "folder") {
+ if (space2.type == "folder") {
menuOptions.push({
name: i18n_default.buttons.addIntoSpace,
icon: "ui//pin",
onClick: (e6) => {
const offset2 = e6.target.getBoundingClientRect();
- showLinkMenu(offset2, superstate, (link3) => {
- pinPathToSpaceAtIndex(superstate, space3, link3);
+ showLinkMenu(offset2, superstate, (link) => {
+ pinPathToSpaceAtIndex(superstate, space2, link);
});
e6.stopPropagation();
}
});
}
menuOptions.push(menuSeparator);
- if (space3.type != "default") {
+ if (space2.type != "default") {
menuOptions.push({
name: i18n_default.labels.renameSection,
icon: "ui//edit",
onClick: (e6) => {
- openSpaceEditorModal(superstate, space3, 0);
+ openSpaceEditorModal(superstate, space2, 0);
}
});
}
@@ -102175,7 +102075,7 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
});
}
menuOptions.push(menuSeparator);
- if (space3.type == "folder") {
+ if (space2.type == "folder") {
menuOptions.push({
name: i18n_default.buttons.addToSpace,
icon: "ui//pin",
@@ -102184,10 +102084,10 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
showSpacesMenu(
offset2,
superstate,
- (link3) => {
- const spaceCache = superstate.spacesIndex.get(link3);
+ (link) => {
+ const spaceCache = superstate.spacesIndex.get(link);
if (spaceCache)
- addPathToSpaceAtIndex(superstate, spaceCache, space3.path, -1);
+ addPathToSpaceAtIndex(superstate, spaceCache, space2.path, -1);
},
true
);
@@ -102201,17 +102101,17 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
name: "Save as Template",
icon: "ui//clipboard-add",
onClick: (e6) => {
- saveSpaceTemplate(superstate, space3.path, parentSpace);
+ saveSpaceTemplate(superstate, space2.path, parentSpace);
}
});
- if (parentSpace != path3.parent) {
+ if (parentSpace != path2.parent) {
const spaceCache = superstate.spacesIndex.get(parentSpace);
if (spaceCache) {
menuOptions.push({
name: i18n_default.menu.removeFromSpace,
icon: "ui//pin-off",
onClick: (e6) => {
- removePathsFromSpace(superstate, spaceCache.path, [space3.path]);
+ removePathsFromSpace(superstate, spaceCache.path, [space2.path]);
}
});
}
@@ -102228,7 +102128,7 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
superstate,
offset2,
"",
- (value) => savePathColor(superstate, space3.path, value)
+ (value) => savePathColor(superstate, space2.path, value)
);
}
});
@@ -102239,7 +102139,7 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react47.default.createElement(StickerModal_default, {
ui: superstate.ui,
hide: _props.hide,
- selectedSticker: (emoji) => savePathSticker(superstate, space3.path, emoji)
+ selectedSticker: (emoji) => savePathSticker(superstate, space2.path, emoji)
}));
}
});
@@ -102247,11 +102147,11 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
name: i18n_default.buttons.removeIcon,
icon: "ui//file-minus",
onClick: (e6) => {
- removePathIcon(superstate, space3.path);
+ removePathIcon(superstate, space2.path);
}
});
}
- if (space3.metadata?.sort) {
+ if (space2.metadata?.sort) {
menuOptions.push(menuSeparator);
menuOptions.push({
name: i18n_default.menu.sortBy,
@@ -102262,13 +102162,13 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
sortOptions.push({
name: i18n_default.menu.groupSpaces,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.group == true,
+ value: space2.metadata.sort.group == true,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, {
- field: space3.metadata.sort.field,
- asc: space3.metadata.sort.asc,
- group: !space3.metadata.sort.group
+ updateSpaceSort(superstate, space2.path, {
+ field: space2.metadata.sort.field,
+ asc: space2.metadata.sort.asc,
+ group: !space2.metadata.sort.group
});
}
});
@@ -102276,131 +102176,131 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
const rankSortOption = {
field: "rank",
asc: true,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.customSort,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == rankSortOption.field && space3.metadata.sort.asc == rankSortOption.asc,
+ value: space2.metadata.sort.field == rankSortOption.field && space2.metadata.sort.asc == rankSortOption.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, rankSortOption);
+ updateSpaceSort(superstate, space2.path, rankSortOption);
}
});
sortOptions.push(menuSeparator);
const nameSortOption = {
field: "name",
asc: true,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.fileNameSortAlphaAsc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == nameSortOption.field && space3.metadata.sort.asc == nameSortOption.asc,
+ value: space2.metadata.sort.field == nameSortOption.field && space2.metadata.sort.asc == nameSortOption.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, nameSortOption);
+ updateSpaceSort(superstate, space2.path, nameSortOption);
}
});
const nameSortOptionDesc = {
field: "name",
asc: false,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.fileNameSortAlphaDesc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == nameSortOptionDesc.field && space3.metadata.sort.asc == nameSortOptionDesc.asc,
+ value: space2.metadata.sort.field == nameSortOptionDesc.field && space2.metadata.sort.asc == nameSortOptionDesc.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, nameSortOptionDesc);
+ updateSpaceSort(superstate, space2.path, nameSortOptionDesc);
}
});
sortOptions.push(menuSeparator);
const numberSortOption = {
field: "number",
asc: true,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.fileNameSortNumericalAsc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == numberSortOption.field && space3.metadata.sort.asc == numberSortOption.asc,
+ value: space2.metadata.sort.field == numberSortOption.field && space2.metadata.sort.asc == numberSortOption.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, numberSortOption);
+ updateSpaceSort(superstate, space2.path, numberSortOption);
}
});
const numberSortOptionDesc = {
field: "number",
asc: false,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.fileNameSortNumericalDesc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == numberSortOptionDesc.field && space3.metadata.sort.asc == numberSortOptionDesc.asc,
+ value: space2.metadata.sort.field == numberSortOptionDesc.field && space2.metadata.sort.asc == numberSortOptionDesc.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, numberSortOptionDesc);
+ updateSpaceSort(superstate, space2.path, numberSortOptionDesc);
}
});
sortOptions.push(menuSeparator);
const createdTimeSortOption = {
field: "ctime",
asc: false,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.createdTimeSortAsc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == createdTimeSortOption.field && space3.metadata.sort.asc == createdTimeSortOption.asc,
+ value: space2.metadata.sort.field == createdTimeSortOption.field && space2.metadata.sort.asc == createdTimeSortOption.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, createdTimeSortOption);
+ updateSpaceSort(superstate, space2.path, createdTimeSortOption);
}
});
const createdTimeSortOptionDesc = {
field: "ctime",
asc: true,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.createdTimeSortDesc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == createdTimeSortOptionDesc.field && space3.metadata.sort.asc == createdTimeSortOptionDesc.asc,
+ value: space2.metadata.sort.field == createdTimeSortOptionDesc.field && space2.metadata.sort.asc == createdTimeSortOptionDesc.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, createdTimeSortOptionDesc);
+ updateSpaceSort(superstate, space2.path, createdTimeSortOptionDesc);
}
});
sortOptions.push(menuSeparator);
const sizeSortOption = {
field: "size",
asc: false,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.sizeSortAsc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == sizeSortOption.field && space3.metadata.sort.asc == sizeSortOption.asc,
+ value: space2.metadata.sort.field == sizeSortOption.field && space2.metadata.sort.asc == sizeSortOption.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, sizeSortOption);
+ updateSpaceSort(superstate, space2.path, sizeSortOption);
}
});
const sizeSortOptionDesc = {
field: "size",
asc: true,
- group: space3.metadata.sort.group
+ group: space2.metadata.sort.group
};
sortOptions.push({
name: i18n_default.menu.sizeSortDesc,
icon: "ui//arrow-up-down",
- value: space3.metadata.sort.field == sizeSortOptionDesc.field && space3.metadata.sort.asc == sizeSortOptionDesc.asc,
+ value: space2.metadata.sort.field == sizeSortOptionDesc.field && space2.metadata.sort.asc == sizeSortOptionDesc.asc,
type: 3 /* Radio */,
onClick: (e6) => {
- updateSpaceSort(superstate, space3.path, sizeSortOptionDesc);
+ updateSpaceSort(superstate, space2.path, sizeSortOptionDesc);
}
});
return superstate.ui.openMenu(
@@ -102410,7 +102310,7 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
}
});
}
- if (space3.type != "default") {
+ if (space2.type != "default") {
menuOptions.push(menuSeparator);
menuOptions.push({
name: i18n_default.menu.rename,
@@ -102420,9 +102320,9 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
i18n_default.labels.rename,
(_props) => /* @__PURE__ */ import_react47.default.createElement(InputModal, {
saveLabel: i18n_default.buttons.rename,
- value: space3.type == "tag" ? stringFromTag(space3.name) : space3.name,
+ value: space2.type == "tag" ? stringFromTag(space2.name) : space2.name,
hide: _props.hide,
- saveValue: (v2) => renamePathByName(superstate, space3.path, v2)
+ saveValue: (v2) => renamePathByName(superstate, space2.path, v2)
})
);
}
@@ -102432,19 +102332,19 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
name: i18n_default.menu.duplicate,
icon: "ui//documents",
onClick: (e6) => {
- superstate.spaceManager.copyPath(path3.path, `${path3.parent}`);
+ superstate.spaceManager.copyPath(path2.path, `${path2.parent}`);
}
});
- if (space3.type == "folder") {
+ if (space2.type == "folder") {
menuOptions.push({
name: i18n_default.menu.moveFile,
icon: "ui//paper-plane",
onClick: (e6) => {
const offset2 = e6.target.getBoundingClientRect();
- showSpacesMenu(offset2, superstate, (link3) => {
+ showSpacesMenu(offset2, superstate, (link) => {
superstate.spaceManager.renameSpace(
- space3.path,
- movePath(space3.path, link3)
+ space2.path,
+ movePath(space2.path, link)
);
});
}
@@ -102457,23 +102357,23 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
icon: "ui//arrow-up-right",
onClick: (e6) => {
superstate.ui.openPath(
- space3.type == "folder" ? space3.path : `${superstate.settings.spacesFolder}/${space3.name}`,
+ space2.type == "folder" ? space2.path : `${superstate.settings.spacesFolder}/${space2.name}`,
"system"
);
}
});
}
menuOptions.push(menuSeparator);
- if (space3.type == "folder") {
+ if (space2.type == "folder") {
menuOptions.push({
name: i18n_default.menu.hide,
icon: "ui//eye-off",
onClick: (e6) => {
- hidePath(superstate, space3.path);
+ hidePath(superstate, space2.path);
}
});
}
- if (space3.type == "folder" || space3.type == "tag")
+ if (space2.type == "folder" || space2.type == "tag")
menuOptions.push({
name: i18n_default.menu.delete,
icon: "ui//trash",
@@ -102482,7 +102382,7 @@ var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onCl
i18n_default.labels.deleteSpace,
(_props) => /* @__PURE__ */ import_react47.default.createElement(ConfirmationModal, {
hide: _props.hide,
- confirmAction: () => removeSpace(superstate, space3.path),
+ confirmAction: () => removeSpace(superstate, space2.path),
confirmLabel: i18n_default.buttons.delete,
message: i18n_default.descriptions.deleteSpace
})
@@ -102593,20 +102493,20 @@ var ContextListEditSelector = (props) => {
return schema;
};
const addListItemToKit = () => {
- const path3 = props.superstate.spaceManager.uriByString(predicate.listItem);
- if (path3.authority == "$kit") {
+ const path2 = props.superstate.spaceManager.uriByString(predicate.listItem);
+ if (path2.authority == "$kit") {
props.superstate.ui.notify("Already in Kit");
return;
}
- const mdbFrame = props.superstate.framesIndex.get(path3.path)?.frames[path3.ref];
+ const mdbFrame = props.superstate.framesIndex.get(path2.path)?.frames[path2.ref];
props.superstate.spaceManager.saveFrameKit(
mdbFrame,
props.superstate.settings.selectedKit
);
};
const editItem = (type) => {
- const listItem4 = initiateString(predicate[type], "spaces://$kit/#*" + type);
- const uri = props.superstate.spaceManager.uriByString(listItem4);
+ const listItem2 = initiateString(predicate[type], "spaces://$kit/#*" + type);
+ const uri = props.superstate.spaceManager.uriByString(listItem2);
if (uri.authority == "$kit") {
const kit = props.superstate.kit.find((g) => g.def.id == uri.ref);
newSchema(
@@ -102614,10 +102514,10 @@ var ContextListEditSelector = (props) => {
type
).then(async (f2) => {
await replaceFrameWithFrameRoot(props.superstate, spaceInfo, f2.id, kit);
- selectFrame(`${spaceInfo.path}/#*${f2.id}`, type);
+ selectFrame(`./#*${f2.id}`, type);
});
} else {
- selectFrame(listItem4, type);
+ selectFrame(listItem2, type);
}
props.setEditSection(type);
};
@@ -102832,12 +102732,12 @@ var React47 = __toESM(require_react(), 1);
function functionalUpdate(updater, input) {
return typeof updater === "function" ? updater(input) : updater;
}
-function makeStateUpdater(key3, instance) {
+function makeStateUpdater(key2, instance) {
return (updater) => {
instance.setState((old) => {
return {
...old,
- [key3]: functionalUpdate(updater, old[key3])
+ [key2]: functionalUpdate(updater, old[key2])
};
});
};
@@ -102870,7 +102770,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, index3) => deps[index3] !== dep);
+ const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
if (!depsChanged) {
return result;
}
@@ -102901,7 +102801,7 @@ function memo2(getDeps, fn, opts) {
return result;
};
}
-function getMemoOptions(tableOptions, debugLevel, key3, onChange) {
+function getMemoOptions(tableOptions, debugLevel, key2, onChange) {
return {
debug: () => {
var _tableOptions$debugAl;
@@ -102911,10 +102811,10 @@ function getMemoOptions(tableOptions, debugLevel, key3, onChange) {
onChange
};
}
-function createCell(table2, row2, column2, columnId) {
+function createCell(table, row2, column2, columnId) {
const getRenderValue = () => {
var _cell$getValue;
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table2.options.renderFallbackValue;
+ return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
};
const cell = {
id: `${row2.id}_${column2.id}`,
@@ -102922,23 +102822,23 @@ function createCell(table2, row2, column2, columnId) {
column: column2,
getValue: () => row2.getValue(columnId),
renderValue: getRenderValue,
- getContext: memo2(() => [table2, column2, row2, cell], (table3, column3, row3, cell2) => ({
- table: table3,
+ getContext: memo2(() => [table, column2, row2, cell], (table2, column3, row3, cell2) => ({
+ table: table2,
column: column3,
row: row3,
cell: cell2,
getValue: cell2.getValue,
renderValue: cell2.renderValue
- }), getMemoOptions(table2.options, "debugCells", "cell.getContext"))
+ }), getMemoOptions(table.options, "debugCells", "cell.getContext"))
};
- table2._features.forEach((feature) => {
- feature.createCell == null || feature.createCell(cell, column2, row2, table2);
+ table._features.forEach((feature) => {
+ feature.createCell == null || feature.createCell(cell, column2, row2, table);
}, {});
return cell;
}
-function createColumn2(table2, columnDef, depth, parent) {
+function createColumn2(table, columnDef, depth, parent) {
var _ref, _resolvedColumnDef$id;
- const defaultColumn = table2._getDefaultColumnDef();
+ const defaultColumn = table._getDefaultColumnDef();
const resolvedColumnDef = {
...defaultColumn,
...columnDef
@@ -102952,11 +102852,11 @@ function createColumn2(table2, columnDef, depth, parent) {
if (accessorKey.includes(".")) {
accessorFn = (originalRow) => {
let result = originalRow;
- for (const key3 of accessorKey.split(".")) {
+ for (const key2 of accessorKey.split(".")) {
var _result;
- result = (_result = result) == null ? void 0 : _result[key3];
+ result = (_result = result) == null ? void 0 : _result[key2];
if (false) {
- console.warn(`"${key3}" in deeply nested key "${accessorKey}" returned undefined.`);
+ console.warn(`"${key2}" in deeply nested key "${accessorKey}" returned undefined.`);
}
}
return result;
@@ -102981,23 +102881,23 @@ function createColumn2(table2, columnDef, depth, parent) {
getFlatColumns: memo2(() => [true], () => {
var _column$columns;
return [column2, ...(_column$columns = column2.columns) == null ? void 0 : _column$columns.flatMap((d4) => d4.getFlatColumns())];
- }, getMemoOptions(table2.options, "debugColumns", "column.getFlatColumns")),
- getLeafColumns: memo2(() => [table2._getOrderColumnsFn()], (orderColumns2) => {
+ }, getMemoOptions(table.options, "debugColumns", "column.getFlatColumns")),
+ getLeafColumns: memo2(() => [table._getOrderColumnsFn()], (orderColumns2) => {
var _column$columns2;
if ((_column$columns2 = column2.columns) != null && _column$columns2.length) {
let leafColumns = column2.columns.flatMap((column3) => column3.getLeafColumns());
return orderColumns2(leafColumns);
}
return [column2];
- }, getMemoOptions(table2.options, "debugColumns", "column.getLeafColumns"))
+ }, getMemoOptions(table.options, "debugColumns", "column.getLeafColumns"))
};
- for (const feature of table2._features) {
- feature.createColumn == null || feature.createColumn(column2, table2);
+ for (const feature of table._features) {
+ feature.createColumn == null || feature.createColumn(column2, table);
}
return column2;
}
var debug = "debugHeaders";
-function createHeader(table2, column2, options) {
+function createHeader(table, column2, options) {
var _options$id;
const id3 = (_options$id = options.id) != null ? _options$id : column2.id;
let header = {
@@ -103023,99 +102923,99 @@ function createHeader(table2, column2, options) {
return leafHeaders;
},
getContext: () => ({
- table: table2,
+ table,
header,
column: column2
})
};
- table2._features.forEach((feature) => {
- feature.createHeader == null || feature.createHeader(header, table2);
+ table._features.forEach((feature) => {
+ feature.createHeader == null || feature.createHeader(header, table);
});
return header;
}
var Headers = {
- createTable: (table2) => {
- table2.getHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
+ createTable: (table) => {
+ table.getHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
var _left$map$filter, _right$map$filter;
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
const centerColumns = leafColumns.filter((column2) => !(left != null && left.includes(column2.id)) && !(right != null && right.includes(column2.id)));
- const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table2);
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
return headerGroups;
- }, getMemoOptions(table2.options, debug, "getHeaderGroups"));
- table2.getCenterHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
+ }, getMemoOptions(table.options, debug, "getHeaderGroups"));
+ table.getCenterHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
leafColumns = leafColumns.filter((column2) => !(left != null && left.includes(column2.id)) && !(right != null && right.includes(column2.id)));
- return buildHeaderGroups(allColumns, leafColumns, table2, "center");
- }, getMemoOptions(table2.options, debug, "getCenterHeaderGroups"));
- table2.getLeftHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.left], (allColumns, leafColumns, left) => {
+ return buildHeaderGroups(allColumns, leafColumns, table, "center");
+ }, getMemoOptions(table.options, debug, "getCenterHeaderGroups"));
+ table.getLeftHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
var _left$map$filter2;
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
- return buildHeaderGroups(allColumns, orderedLeafColumns, table2, "left");
- }, getMemoOptions(table2.options, debug, "getLeftHeaderGroups"));
- table2.getRightHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.right], (allColumns, leafColumns, right) => {
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left");
+ }, getMemoOptions(table.options, debug, "getLeftHeaderGroups"));
+ table.getRightHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
var _right$map$filter2;
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
- return buildHeaderGroups(allColumns, orderedLeafColumns, table2, "right");
- }, getMemoOptions(table2.options, debug, "getRightHeaderGroups"));
- table2.getFooterGroups = memo2(() => [table2.getHeaderGroups()], (headerGroups) => {
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right");
+ }, getMemoOptions(table.options, debug, "getRightHeaderGroups"));
+ table.getFooterGroups = memo2(() => [table.getHeaderGroups()], (headerGroups) => {
return [...headerGroups].reverse();
- }, getMemoOptions(table2.options, debug, "getFooterGroups"));
- table2.getLeftFooterGroups = memo2(() => [table2.getLeftHeaderGroups()], (headerGroups) => {
+ }, getMemoOptions(table.options, debug, "getFooterGroups"));
+ table.getLeftFooterGroups = memo2(() => [table.getLeftHeaderGroups()], (headerGroups) => {
return [...headerGroups].reverse();
- }, getMemoOptions(table2.options, debug, "getLeftFooterGroups"));
- table2.getCenterFooterGroups = memo2(() => [table2.getCenterHeaderGroups()], (headerGroups) => {
+ }, getMemoOptions(table.options, debug, "getLeftFooterGroups"));
+ table.getCenterFooterGroups = memo2(() => [table.getCenterHeaderGroups()], (headerGroups) => {
return [...headerGroups].reverse();
- }, getMemoOptions(table2.options, debug, "getCenterFooterGroups"));
- table2.getRightFooterGroups = memo2(() => [table2.getRightHeaderGroups()], (headerGroups) => {
+ }, getMemoOptions(table.options, debug, "getCenterFooterGroups"));
+ table.getRightFooterGroups = memo2(() => [table.getRightHeaderGroups()], (headerGroups) => {
return [...headerGroups].reverse();
- }, getMemoOptions(table2.options, debug, "getRightFooterGroups"));
- table2.getFlatHeaders = memo2(() => [table2.getHeaderGroups()], (headerGroups) => {
+ }, getMemoOptions(table.options, debug, "getRightFooterGroups"));
+ table.getFlatHeaders = memo2(() => [table.getHeaderGroups()], (headerGroups) => {
return headerGroups.map((headerGroup) => {
return headerGroup.headers;
}).flat();
- }, getMemoOptions(table2.options, debug, "getFlatHeaders"));
- table2.getLeftFlatHeaders = memo2(() => [table2.getLeftHeaderGroups()], (left) => {
+ }, getMemoOptions(table.options, debug, "getFlatHeaders"));
+ table.getLeftFlatHeaders = memo2(() => [table.getLeftHeaderGroups()], (left) => {
return left.map((headerGroup) => {
return headerGroup.headers;
}).flat();
- }, getMemoOptions(table2.options, debug, "getLeftFlatHeaders"));
- table2.getCenterFlatHeaders = memo2(() => [table2.getCenterHeaderGroups()], (left) => {
+ }, getMemoOptions(table.options, debug, "getLeftFlatHeaders"));
+ table.getCenterFlatHeaders = memo2(() => [table.getCenterHeaderGroups()], (left) => {
return left.map((headerGroup) => {
return headerGroup.headers;
}).flat();
- }, getMemoOptions(table2.options, debug, "getCenterFlatHeaders"));
- table2.getRightFlatHeaders = memo2(() => [table2.getRightHeaderGroups()], (left) => {
+ }, getMemoOptions(table.options, debug, "getCenterFlatHeaders"));
+ table.getRightFlatHeaders = memo2(() => [table.getRightHeaderGroups()], (left) => {
return left.map((headerGroup) => {
return headerGroup.headers;
}).flat();
- }, getMemoOptions(table2.options, debug, "getRightFlatHeaders"));
- table2.getCenterLeafHeaders = memo2(() => [table2.getCenterFlatHeaders()], (flatHeaders) => {
+ }, getMemoOptions(table.options, debug, "getRightFlatHeaders"));
+ table.getCenterLeafHeaders = memo2(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
return flatHeaders.filter((header) => {
var _header$subHeaders;
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
});
- }, getMemoOptions(table2.options, debug, "getCenterLeafHeaders"));
- table2.getLeftLeafHeaders = memo2(() => [table2.getLeftFlatHeaders()], (flatHeaders) => {
+ }, getMemoOptions(table.options, debug, "getCenterLeafHeaders"));
+ table.getLeftLeafHeaders = memo2(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
return flatHeaders.filter((header) => {
var _header$subHeaders2;
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
});
- }, getMemoOptions(table2.options, debug, "getLeftLeafHeaders"));
- table2.getRightLeafHeaders = memo2(() => [table2.getRightFlatHeaders()], (flatHeaders) => {
+ }, getMemoOptions(table.options, debug, "getLeftLeafHeaders"));
+ table.getRightLeafHeaders = memo2(() => [table.getRightFlatHeaders()], (flatHeaders) => {
return flatHeaders.filter((header) => {
var _header$subHeaders3;
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
});
- }, getMemoOptions(table2.options, debug, "getRightLeafHeaders"));
- table2.getLeafHeaders = memo2(() => [table2.getLeftHeaderGroups(), table2.getCenterHeaderGroups(), table2.getRightHeaderGroups()], (left, center, right) => {
+ }, getMemoOptions(table.options, debug, "getRightLeafHeaders"));
+ table.getLeafHeaders = memo2(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
return [...(_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : [], ...(_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : [], ...(_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : []].map((header) => {
return header.getLeafHeaders();
}).flat();
- }, getMemoOptions(table2.options, debug, "getLeafHeaders"));
+ }, getMemoOptions(table.options, debug, "getLeafHeaders"));
}
};
-function buildHeaderGroups(allColumns, columnsToGroup, table2, headerFamily) {
+function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
var _headerGroups$0$heade, _headerGroups$;
let maxDepth = 0;
const findMaxDepth = function(columns, depth) {
@@ -103153,7 +103053,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table2, headerFamily) {
if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column2) {
latestPendingParentHeader.subHeaders.push(headerToGroup);
} else {
- const header = createHeader(table2, column2, {
+ const header = createHeader(table, column2, {
id: [headerFamily, depth, column2.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join("_"),
isPlaceholder,
placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d4) => d4.column === column2).length}` : void 0,
@@ -103171,9 +103071,9 @@ function buildHeaderGroups(allColumns, columnsToGroup, table2, headerFamily) {
createHeaderGroup(pendingParentHeaders, depth - 1);
}
};
- const bottomHeaders = columnsToGroup.map((column2, index3) => createHeader(table2, column2, {
+ const bottomHeaders = columnsToGroup.map((column2, index2) => createHeader(table, column2, {
depth: maxDepth,
- index: index3
+ index: index2
}));
createHeaderGroup(bottomHeaders, maxDepth - 1);
headerGroups.reverse();
@@ -103209,7 +103109,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table2, headerFamily) {
recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
return headerGroups;
}
-var createRow2 = (table2, id3, original, rowIndex, depth, subRows, parentId) => {
+var createRow2 = (table, id3, original, rowIndex, depth, subRows, parentId) => {
let row2 = {
id: id3,
index: rowIndex,
@@ -103222,7 +103122,7 @@ var createRow2 = (table2, id3, original, rowIndex, depth, subRows, parentId) =>
if (row2._valuesCache.hasOwnProperty(columnId)) {
return row2._valuesCache[columnId];
}
- const column2 = table2.getColumn(columnId);
+ const column2 = table.getColumn(columnId);
if (!(column2 != null && column2.accessorFn)) {
return void 0;
}
@@ -103233,7 +103133,7 @@ var createRow2 = (table2, id3, original, rowIndex, depth, subRows, parentId) =>
if (row2._uniqueValuesCache.hasOwnProperty(columnId)) {
return row2._uniqueValuesCache[columnId];
}
- const column2 = table2.getColumn(columnId);
+ const column2 = table.getColumn(columnId);
if (!(column2 != null && column2.accessorFn)) {
return void 0;
}
@@ -103246,11 +103146,11 @@ var createRow2 = (table2, id3, original, rowIndex, depth, subRows, parentId) =>
},
renderValue: (columnId) => {
var _row$getValue;
- return (_row$getValue = row2.getValue(columnId)) != null ? _row$getValue : table2.options.renderFallbackValue;
+ return (_row$getValue = row2.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
},
subRows: subRows != null ? subRows : [],
getLeafRows: () => flattenBy(row2.subRows, (d4) => d4.subRows),
- getParentRow: () => row2.parentId ? table2.getRow(row2.parentId, true) : void 0,
+ getParentRow: () => row2.parentId ? table.getRow(row2.parentId, true) : void 0,
getParentRows: () => {
let parentRows = [];
let currentRow = row2;
@@ -103263,41 +103163,41 @@ var createRow2 = (table2, id3, original, rowIndex, depth, subRows, parentId) =>
}
return parentRows.reverse();
},
- getAllCells: memo2(() => [table2.getAllLeafColumns()], (leafColumns) => {
+ getAllCells: memo2(() => [table.getAllLeafColumns()], (leafColumns) => {
return leafColumns.map((column2) => {
- return createCell(table2, row2, column2, column2.id);
+ return createCell(table, row2, column2, column2.id);
});
- }, getMemoOptions(table2.options, "debugRows", "getAllCells")),
+ }, getMemoOptions(table.options, "debugRows", "getAllCells")),
_getAllCellsByColumnId: memo2(() => [row2.getAllCells()], (allCells) => {
return allCells.reduce((acc, cell) => {
acc[cell.column.id] = cell;
return acc;
}, {});
- }, getMemoOptions(table2.options, "debugRows", "getAllCellsByColumnId"))
+ }, getMemoOptions(table.options, "debugRows", "getAllCellsByColumnId"))
};
- for (let i4 = 0; i4 < table2._features.length; i4++) {
- const feature = table2._features[i4];
- feature == null || feature.createRow == null || feature.createRow(row2, table2);
+ for (let i4 = 0; i4 < table._features.length; i4++) {
+ const feature = table._features[i4];
+ feature == null || feature.createRow == null || feature.createRow(row2, table);
}
return row2;
};
var ColumnFaceting = {
- createColumn: (column2, table2) => {
- column2._getFacetedRowModel = table2.options.getFacetedRowModel && table2.options.getFacetedRowModel(table2, column2.id);
+ createColumn: (column2, table) => {
+ column2._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column2.id);
column2.getFacetedRowModel = () => {
if (!column2._getFacetedRowModel) {
- return table2.getPreFilteredRowModel();
+ return table.getPreFilteredRowModel();
}
return column2._getFacetedRowModel();
};
- column2._getFacetedUniqueValues = table2.options.getFacetedUniqueValues && table2.options.getFacetedUniqueValues(table2, column2.id);
+ column2._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column2.id);
column2.getFacetedUniqueValues = () => {
if (!column2._getFacetedUniqueValues) {
return /* @__PURE__ */ new Map();
}
return column2._getFacetedUniqueValues();
};
- column2._getFacetedMinMaxValues = table2.options.getFacetedMinMaxValues && table2.options.getFacetedMinMaxValues(table2, column2.id);
+ column2._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column2.id);
column2.getFacetedMinMaxValues = () => {
if (!column2._getFacetedMinMaxValues) {
return void 0;
@@ -103308,8 +103208,8 @@ var ColumnFaceting = {
};
var includesString = (row2, columnId, filterValue) => {
var _row$getValue;
- const search3 = filterValue.toLowerCase();
- return Boolean((_row$getValue = row2.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search3));
+ const search2 = filterValue.toLowerCase();
+ return Boolean((_row$getValue = row2.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search2));
};
includesString.autoRemove = (val) => testFalsey(val);
var includesStringSensitive = (row2, columnId, filterValue) => {
@@ -103394,16 +103294,16 @@ var ColumnFiltering = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onColumnFiltersChange: makeStateUpdater("columnFilters", table2),
+ onColumnFiltersChange: makeStateUpdater("columnFilters", table),
filterFromLeafRows: false,
maxLeafRowFilterDepth: 100
};
},
- createColumn: (column2, table2) => {
+ createColumn: (column2, table) => {
column2.getAutoFilterFn = () => {
- const firstRow = table2.getCoreRowModel().flatRows[0];
+ const firstRow = table.getCoreRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column2.id);
if (typeof value === "string") {
return filterFns.includesString;
@@ -103424,23 +103324,23 @@ var ColumnFiltering = {
};
column2.getFilterFn = () => {
var _table$options$filter, _table$options$filter2;
- return isFunction2(column2.columnDef.filterFn) ? column2.columnDef.filterFn : column2.columnDef.filterFn === "auto" ? column2.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table2.options.filterFns) == null ? void 0 : _table$options$filter2[column2.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column2.columnDef.filterFn];
+ return isFunction2(column2.columnDef.filterFn) ? column2.columnDef.filterFn : column2.columnDef.filterFn === "auto" ? column2.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column2.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column2.columnDef.filterFn];
};
column2.getCanFilter = () => {
var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
- return ((_column$columnDef$ena = column2.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table2.options.enableFilters) != null ? _table$options$enable2 : true) && !!column2.accessorFn;
+ return ((_column$columnDef$ena = column2.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column2.accessorFn;
};
column2.getIsFiltered = () => column2.getFilterIndex() > -1;
column2.getFilterValue = () => {
var _table$getState$colum;
- return (_table$getState$colum = table2.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find((d4) => d4.id === column2.id)) == null ? void 0 : _table$getState$colum.value;
+ return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find((d4) => d4.id === column2.id)) == null ? void 0 : _table$getState$colum.value;
};
column2.getFilterIndex = () => {
var _table$getState$colum2, _table$getState$colum3;
- return (_table$getState$colum2 = (_table$getState$colum3 = table2.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$colum2 : -1;
+ return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$colum2 : -1;
};
column2.setFilterValue = (value) => {
- table2.setColumnFilters((old) => {
+ table.setColumnFilters((old) => {
const filterFn = column2.getFilterFn();
const previousFilter = old == null ? void 0 : old.find((d4) => d4.id === column2.id);
const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : void 0);
@@ -103472,9 +103372,9 @@ var ColumnFiltering = {
row2.columnFilters = {};
row2.columnFiltersMeta = {};
},
- createTable: (table2) => {
- table2.setColumnFilters = (updater) => {
- const leafColumns = table2.getAllLeafColumns();
+ createTable: (table) => {
+ table.setColumnFilters = (updater) => {
+ const leafColumns = table.getAllLeafColumns();
const updateFn = (old) => {
var _functionalUpdate;
return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter((filter4) => {
@@ -103488,21 +103388,21 @@ var ColumnFiltering = {
return true;
});
};
- table2.options.onColumnFiltersChange == null || table2.options.onColumnFiltersChange(updateFn);
+ table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
};
- table2.resetColumnFilters = (defaultState) => {
+ table.resetColumnFilters = (defaultState) => {
var _table$initialState$c, _table$initialState;
- table2.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
};
- table2.getPreFilteredRowModel = () => table2.getCoreRowModel();
- table2.getFilteredRowModel = () => {
- if (!table2._getFilteredRowModel && table2.options.getFilteredRowModel) {
- table2._getFilteredRowModel = table2.options.getFilteredRowModel(table2);
+ table.getPreFilteredRowModel = () => table.getCoreRowModel();
+ table.getFilteredRowModel = () => {
+ if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
+ table._getFilteredRowModel = table.options.getFilteredRowModel(table);
}
- if (table2.options.manualFiltering || !table2._getFilteredRowModel) {
- return table2.getPreFilteredRowModel();
+ if (table.options.manualFiltering || !table._getFilteredRowModel) {
+ return table.getPreFilteredRowModel();
}
- return table2._getFilteredRowModel();
+ return table._getFilteredRowModel();
};
}
};
@@ -103618,15 +103518,15 @@ var ColumnGrouping = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onGroupingChange: makeStateUpdater("grouping", table2),
+ onGroupingChange: makeStateUpdater("grouping", table),
groupedColumnMode: "reorder"
};
},
- createColumn: (column2, table2) => {
+ createColumn: (column2, table) => {
column2.toggleGrouping = () => {
- table2.setGrouping((old) => {
+ table.setGrouping((old) => {
if (old != null && old.includes(column2.id)) {
return old.filter((d4) => d4 !== column2.id);
}
@@ -103635,15 +103535,15 @@ var ColumnGrouping = {
};
column2.getCanGroup = () => {
var _ref, _ref2, _ref3, _column$columnDef$ena;
- return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column2.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table2.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column2.accessorFn;
+ return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column2.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column2.accessorFn;
};
column2.getIsGrouped = () => {
var _table$getState$group;
- return (_table$getState$group = table2.getState().grouping) == null ? void 0 : _table$getState$group.includes(column2.id);
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column2.id);
};
column2.getGroupedIndex = () => {
var _table$getState$group2;
- return (_table$getState$group2 = table2.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column2.id);
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column2.id);
};
column2.getToggleGroupingHandler = () => {
const canGroup = column2.getCanGroup();
@@ -103654,7 +103554,7 @@ var ColumnGrouping = {
};
};
column2.getAutoAggregationFn = () => {
- const firstRow = table2.getCoreRowModel().flatRows[0];
+ const firstRow = table.getCoreRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column2.id);
if (typeof value === "number") {
return aggregationFns.sum;
@@ -103668,33 +103568,33 @@ var ColumnGrouping = {
if (!column2) {
throw new Error();
}
- return isFunction2(column2.columnDef.aggregationFn) ? column2.columnDef.aggregationFn : column2.columnDef.aggregationFn === "auto" ? column2.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table2.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column2.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column2.columnDef.aggregationFn];
+ return isFunction2(column2.columnDef.aggregationFn) ? column2.columnDef.aggregationFn : column2.columnDef.aggregationFn === "auto" ? column2.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column2.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column2.columnDef.aggregationFn];
};
},
- createTable: (table2) => {
- table2.setGrouping = (updater) => table2.options.onGroupingChange == null ? void 0 : table2.options.onGroupingChange(updater);
- table2.resetGrouping = (defaultState) => {
+ createTable: (table) => {
+ table.setGrouping = (updater) => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);
+ table.resetGrouping = (defaultState) => {
var _table$initialState$g, _table$initialState;
- table2.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
};
- table2.getPreGroupedRowModel = () => table2.getFilteredRowModel();
- table2.getGroupedRowModel = () => {
- if (!table2._getGroupedRowModel && table2.options.getGroupedRowModel) {
- table2._getGroupedRowModel = table2.options.getGroupedRowModel(table2);
+ table.getPreGroupedRowModel = () => table.getFilteredRowModel();
+ table.getGroupedRowModel = () => {
+ if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
+ table._getGroupedRowModel = table.options.getGroupedRowModel(table);
}
- if (table2.options.manualGrouping || !table2._getGroupedRowModel) {
- return table2.getPreGroupedRowModel();
+ if (table.options.manualGrouping || !table._getGroupedRowModel) {
+ return table.getPreGroupedRowModel();
}
- return table2._getGroupedRowModel();
+ return table._getGroupedRowModel();
};
},
- createRow: (row2, table2) => {
+ createRow: (row2, table) => {
row2.getIsGrouped = () => !!row2.groupingColumnId;
row2.getGroupingValue = (columnId) => {
if (row2._groupingValuesCache.hasOwnProperty(columnId)) {
return row2._groupingValuesCache[columnId];
}
- const column2 = table2.getColumn(columnId);
+ const column2 = table.getColumn(columnId);
if (!(column2 != null && column2.columnDef.getGroupingValue)) {
return row2.getValue(columnId);
}
@@ -103703,7 +103603,7 @@ var ColumnGrouping = {
};
row2._groupingValuesCache = {};
},
- createCell: (cell, column2, row2, table2) => {
+ createCell: (cell, column2, row2, table) => {
cell.getIsGrouped = () => column2.getIsGrouped() && column2.id === row2.groupingColumnId;
cell.getIsPlaceholder = () => !cell.getIsGrouped() && column2.getIsGrouped();
cell.getIsAggregated = () => {
@@ -103730,31 +103630,31 @@ var ColumnOrdering = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onColumnOrderChange: makeStateUpdater("columnOrder", table2)
+ onColumnOrderChange: makeStateUpdater("columnOrder", table)
};
},
- createColumn: (column2, table2) => {
- column2.getIndex = memo2((position3) => [_getVisibleLeafColumns(table2, position3)], (columns) => columns.findIndex((d4) => d4.id === column2.id), getMemoOptions(table2.options, "debugColumns", "getIndex"));
- column2.getIsFirstColumn = (position3) => {
+ createColumn: (column2, table) => {
+ column2.getIndex = memo2((position) => [_getVisibleLeafColumns(table, position)], (columns) => columns.findIndex((d4) => d4.id === column2.id), getMemoOptions(table.options, "debugColumns", "getIndex"));
+ column2.getIsFirstColumn = (position) => {
var _columns$;
- const columns = _getVisibleLeafColumns(table2, position3);
+ const columns = _getVisibleLeafColumns(table, position);
return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column2.id;
};
- column2.getIsLastColumn = (position3) => {
+ column2.getIsLastColumn = (position) => {
var _columns;
- const columns = _getVisibleLeafColumns(table2, position3);
+ const columns = _getVisibleLeafColumns(table, position);
return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column2.id;
};
},
- createTable: (table2) => {
- table2.setColumnOrder = (updater) => table2.options.onColumnOrderChange == null ? void 0 : table2.options.onColumnOrderChange(updater);
- table2.resetColumnOrder = (defaultState) => {
+ createTable: (table) => {
+ table.setColumnOrder = (updater) => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);
+ table.resetColumnOrder = (defaultState) => {
var _table$initialState$c;
- table2.setColumnOrder(defaultState ? [] : (_table$initialState$c = table2.initialState.columnOrder) != null ? _table$initialState$c : []);
+ table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
};
- table2._getOrderColumnsFn = memo2(() => [table2.getState().columnOrder, table2.getState().grouping, table2.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => {
+ table._getOrderColumnsFn = memo2(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => {
let orderedColumns = [];
if (!(columnOrder != null && columnOrder.length)) {
orderedColumns = columns;
@@ -103771,7 +103671,7 @@ var ColumnOrdering = {
orderedColumns = [...orderedColumns, ...columnsCopy];
}
return orderColumns(orderedColumns, grouping, groupedColumnMode);
- }, getMemoOptions(table2.options, "debugTable", "_getOrderColumnsFn"));
+ }, getMemoOptions(table.options, "debugTable", "_getOrderColumnsFn"));
}
};
var getDefaultColumnPinningState = () => ({
@@ -103785,24 +103685,24 @@ var ColumnPinning = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onColumnPinningChange: makeStateUpdater("columnPinning", table2)
+ onColumnPinningChange: makeStateUpdater("columnPinning", table)
};
},
- createColumn: (column2, table2) => {
- column2.pin = (position3) => {
+ createColumn: (column2, table) => {
+ column2.pin = (position) => {
const columnIds = column2.getLeafColumns().map((d4) => d4.id).filter(Boolean);
- table2.setColumnPinning((old) => {
+ table.setColumnPinning((old) => {
var _old$left3, _old$right3;
- if (position3 === "right") {
+ if (position === "right") {
var _old$left, _old$right;
return {
left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d4) => !(columnIds != null && columnIds.includes(d4))),
right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d4) => !(columnIds != null && columnIds.includes(d4))), ...columnIds]
};
}
- if (position3 === "left") {
+ if (position === "left") {
var _old$left2, _old$right2;
return {
left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d4) => !(columnIds != null && columnIds.includes(d4))), ...columnIds],
@@ -103819,7 +103719,7 @@ var ColumnPinning = {
const leafColumns = column2.getLeafColumns();
return leafColumns.some((d4) => {
var _d$columnDef$enablePi, _ref, _table$options$enable;
- return ((_d$columnDef$enablePi = d4.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table2.options.enableColumnPinning) != null ? _table$options$enable : table2.options.enablePinning) != null ? _ref : true);
+ return ((_d$columnDef$enablePi = d4.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true);
});
};
column2.getIsPinned = () => {
@@ -103827,62 +103727,62 @@ var ColumnPinning = {
const {
left,
right
- } = table2.getState().columnPinning;
+ } = table.getState().columnPinning;
const isLeft = leafColumnIds.some((d4) => left == null ? void 0 : left.includes(d4));
const isRight = leafColumnIds.some((d4) => right == null ? void 0 : right.includes(d4));
return isLeft ? "left" : isRight ? "right" : false;
};
column2.getPinnedIndex = () => {
var _table$getState$colum, _table$getState$colum2;
- const position3 = column2.getIsPinned();
- return position3 ? (_table$getState$colum = (_table$getState$colum2 = table2.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position3]) == null ? void 0 : _table$getState$colum2.indexOf(column2.id)) != null ? _table$getState$colum : -1 : 0;
+ const position = column2.getIsPinned();
+ return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column2.id)) != null ? _table$getState$colum : -1 : 0;
};
},
- createRow: (row2, table2) => {
- row2.getCenterVisibleCells = memo2(() => [row2._getAllVisibleCells(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allCells, left, right) => {
+ createRow: (row2, table) => {
+ row2.getCenterVisibleCells = memo2(() => [row2._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
return allCells.filter((d4) => !leftAndRight.includes(d4.column.id));
- }, getMemoOptions(table2.options, "debugRows", "getCenterVisibleCells"));
- row2.getLeftVisibleCells = memo2(() => [row2._getAllVisibleCells(), table2.getState().columnPinning.left], (allCells, left) => {
- const cells2 = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({
+ }, getMemoOptions(table.options, "debugRows", "getCenterVisibleCells"));
+ row2.getLeftVisibleCells = memo2(() => [row2._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
+ const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({
...d4,
position: "left"
}));
- return cells2;
- }, getMemoOptions(table2.options, "debugRows", "getLeftVisibleCells"));
- row2.getRightVisibleCells = memo2(() => [row2._getAllVisibleCells(), table2.getState().columnPinning.right], (allCells, right) => {
- const cells2 = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({
+ return cells;
+ }, getMemoOptions(table.options, "debugRows", "getLeftVisibleCells"));
+ row2.getRightVisibleCells = memo2(() => [row2._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
+ const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({
...d4,
position: "right"
}));
- return cells2;
- }, getMemoOptions(table2.options, "debugRows", "getRightVisibleCells"));
+ return cells;
+ }, getMemoOptions(table.options, "debugRows", "getRightVisibleCells"));
},
- createTable: (table2) => {
- table2.setColumnPinning = (updater) => table2.options.onColumnPinningChange == null ? void 0 : table2.options.onColumnPinningChange(updater);
- table2.resetColumnPinning = (defaultState) => {
+ createTable: (table) => {
+ table.setColumnPinning = (updater) => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);
+ table.resetColumnPinning = (defaultState) => {
var _table$initialState$c, _table$initialState;
- return table2.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());
+ return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());
};
- table2.getIsSomeColumnsPinned = (position3) => {
+ table.getIsSomeColumnsPinned = (position) => {
var _pinningState$positio;
- const pinningState = table2.getState().columnPinning;
- if (!position3) {
+ const pinningState = table.getState().columnPinning;
+ if (!position) {
var _pinningState$left, _pinningState$right;
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
}
- return Boolean((_pinningState$positio = pinningState[position3]) == null ? void 0 : _pinningState$positio.length);
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
};
- table2.getLeftLeafColumns = memo2(() => [table2.getAllLeafColumns(), table2.getState().columnPinning.left], (allColumns, left) => {
+ table.getLeftLeafColumns = memo2(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
return (left != null ? left : []).map((columnId) => allColumns.find((column2) => column2.id === columnId)).filter(Boolean);
- }, getMemoOptions(table2.options, "debugColumns", "getLeftLeafColumns"));
- table2.getRightLeafColumns = memo2(() => [table2.getAllLeafColumns(), table2.getState().columnPinning.right], (allColumns, right) => {
+ }, getMemoOptions(table.options, "debugColumns", "getLeftLeafColumns"));
+ table.getRightLeafColumns = memo2(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
return (right != null ? right : []).map((columnId) => allColumns.find((column2) => column2.id === columnId)).filter(Boolean);
- }, getMemoOptions(table2.options, "debugColumns", "getRightLeafColumns"));
- table2.getCenterLeafColumns = memo2(() => [table2.getAllLeafColumns(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allColumns, left, right) => {
+ }, getMemoOptions(table.options, "debugColumns", "getRightLeafColumns"));
+ table.getCenterLeafColumns = memo2(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
return allColumns.filter((d4) => !leftAndRight.includes(d4.id));
- }, getMemoOptions(table2.options, "debugColumns", "getCenterLeafColumns"));
+ }, getMemoOptions(table.options, "debugColumns", "getCenterLeafColumns"));
}
};
var defaultColumnSizing = {
@@ -103909,24 +103809,24 @@ var ColumnSizing = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
columnResizeMode: "onEnd",
columnResizeDirection: "ltr",
- onColumnSizingChange: makeStateUpdater("columnSizing", table2),
- onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table2)
+ onColumnSizingChange: makeStateUpdater("columnSizing", table),
+ onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table)
};
},
- createColumn: (column2, table2) => {
+ createColumn: (column2, table) => {
column2.getSize = () => {
var _column$columnDef$min, _ref, _column$columnDef$max;
- const columnSize = table2.getState().columnSizing[column2.id];
+ const columnSize = table.getState().columnSizing[column2.id];
return Math.min(Math.max((_column$columnDef$min = column2.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column2.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column2.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
};
- column2.getStart = memo2((position3) => [position3, _getVisibleLeafColumns(table2, position3), table2.getState().columnSizing], (position3, columns) => columns.slice(0, column2.getIndex(position3)).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table2.options, "debugColumns", "getStart"));
- column2.getAfter = memo2((position3) => [position3, _getVisibleLeafColumns(table2, position3), table2.getState().columnSizing], (position3, columns) => columns.slice(column2.getIndex(position3) + 1).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table2.options, "debugColumns", "getAfter"));
+ column2.getStart = memo2((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column2.getIndex(position)).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getStart"));
+ column2.getAfter = memo2((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column2.getIndex(position) + 1).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getAfter"));
column2.resetSize = () => {
- table2.setColumnSizing((_ref2) => {
+ table.setColumnSizing((_ref2) => {
let {
[column2.id]: _15,
...rest
@@ -103936,13 +103836,13 @@ var ColumnSizing = {
};
column2.getCanResize = () => {
var _column$columnDef$ena, _table$options$enable;
- return ((_column$columnDef$ena = column2.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableColumnResizing) != null ? _table$options$enable : true);
+ return ((_column$columnDef$ena = column2.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
};
column2.getIsResizing = () => {
- return table2.getState().columnSizingInfo.isResizingColumn === column2.id;
+ return table.getState().columnSizingInfo.isResizingColumn === column2.id;
};
},
- createHeader: (header, table2) => {
+ createHeader: (header, table) => {
header.getSize = () => {
let sum4 = 0;
const recurse = (header2) => {
@@ -103964,7 +103864,7 @@ var ColumnSizing = {
return 0;
};
header.getResizeHandler = (_contextDocument) => {
- const column2 = table2.getColumn(header.column.id);
+ const column2 = table.getColumn(header.column.id);
const canResize = column2 == null ? void 0 : column2.getCanResize();
return (e5) => {
if (!column2 || !canResize) {
@@ -103984,9 +103884,9 @@ var ColumnSizing = {
if (typeof clientXPos !== "number") {
return;
}
- table2.setColumnSizingInfo((old) => {
+ table.setColumnSizingInfo((old) => {
var _old$startOffset, _old$startSize;
- const deltaDirection = table2.options.columnResizeDirection === "rtl" ? -1 : 1;
+ const deltaDirection = table.options.columnResizeDirection === "rtl" ? -1 : 1;
const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection;
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
old.columnSizingStart.forEach((_ref3) => {
@@ -103999,8 +103899,8 @@ var ColumnSizing = {
deltaPercentage
};
});
- if (table2.options.columnResizeMode === "onChange" || eventType === "end") {
- table2.setColumnSizing((old) => ({
+ if (table.options.columnResizeMode === "onChange" || eventType === "end") {
+ table.setColumnSizing((old) => ({
...old,
...newColumnSizing
}));
@@ -104009,7 +103909,7 @@ var ColumnSizing = {
const onMove = (clientXPos) => updateOffset("move", clientXPos);
const onEnd = (clientXPos) => {
updateOffset("end", clientXPos);
- table2.setColumnSizingInfo((old) => ({
+ table.setColumnSizingInfo((old) => ({
...old,
isResizingColumn: false,
startOffset: null,
@@ -104058,7 +103958,7 @@ var ColumnSizing = {
contextDocument == null || contextDocument.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported);
contextDocument == null || contextDocument.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported);
}
- table2.setColumnSizingInfo((old) => ({
+ table.setColumnSizingInfo((old) => ({
...old,
startOffset: clientX,
startSize,
@@ -104070,38 +103970,38 @@ var ColumnSizing = {
};
};
},
- createTable: (table2) => {
- table2.setColumnSizing = (updater) => table2.options.onColumnSizingChange == null ? void 0 : table2.options.onColumnSizingChange(updater);
- table2.setColumnSizingInfo = (updater) => table2.options.onColumnSizingInfoChange == null ? void 0 : table2.options.onColumnSizingInfoChange(updater);
- table2.resetColumnSizing = (defaultState) => {
+ createTable: (table) => {
+ table.setColumnSizing = (updater) => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);
+ table.setColumnSizingInfo = (updater) => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);
+ table.resetColumnSizing = (defaultState) => {
var _table$initialState$c;
- table2.setColumnSizing(defaultState ? {} : (_table$initialState$c = table2.initialState.columnSizing) != null ? _table$initialState$c : {});
+ table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
};
- table2.resetHeaderSizeInfo = (defaultState) => {
+ table.resetHeaderSizeInfo = (defaultState) => {
var _table$initialState$c2;
- table2.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table2.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
+ table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
};
- table2.getTotalSize = () => {
+ table.getTotalSize = () => {
var _table$getHeaderGroup, _table$getHeaderGroup2;
- return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table2.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum4, header) => {
+ return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum4, header) => {
return sum4 + header.getSize();
}, 0)) != null ? _table$getHeaderGroup : 0;
};
- table2.getLeftTotalSize = () => {
+ table.getLeftTotalSize = () => {
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
- return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table2.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum4, header) => {
+ return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum4, header) => {
return sum4 + header.getSize();
}, 0)) != null ? _table$getLeftHeaderG : 0;
};
- table2.getCenterTotalSize = () => {
+ table.getCenterTotalSize = () => {
var _table$getCenterHeade, _table$getCenterHeade2;
- return (_table$getCenterHeade = (_table$getCenterHeade2 = table2.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum4, header) => {
+ return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum4, header) => {
return sum4 + header.getSize();
}, 0)) != null ? _table$getCenterHeade : 0;
};
- table2.getRightTotalSize = () => {
+ table.getRightTotalSize = () => {
var _table$getRightHeader, _table$getRightHeader2;
- return (_table$getRightHeader = (_table$getRightHeader2 = table2.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum4, header) => {
+ return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum4, header) => {
return sum4 + header.getSize();
}, 0)) != null ? _table$getRightHeader : 0;
};
@@ -104139,15 +104039,15 @@ var ColumnVisibility = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onColumnVisibilityChange: makeStateUpdater("columnVisibility", table2)
+ onColumnVisibilityChange: makeStateUpdater("columnVisibility", table)
};
},
- createColumn: (column2, table2) => {
+ createColumn: (column2, table) => {
column2.toggleVisibility = (value) => {
if (column2.getCanHide()) {
- table2.setColumnVisibility((old) => ({
+ table.setColumnVisibility((old) => ({
...old,
[column2.id]: value != null ? value : !column2.getIsVisible()
}));
@@ -104156,11 +104056,11 @@ var ColumnVisibility = {
column2.getIsVisible = () => {
var _ref, _table$getState$colum;
const childColumns = column2.columns;
- return (_ref = childColumns.length ? childColumns.some((c3) => c3.getIsVisible()) : (_table$getState$colum = table2.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column2.id]) != null ? _ref : true;
+ return (_ref = childColumns.length ? childColumns.some((c3) => c3.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column2.id]) != null ? _ref : true;
};
column2.getCanHide = () => {
var _column$columnDef$ena, _table$options$enable;
- return ((_column$columnDef$ena = column2.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableHiding) != null ? _table$options$enable : true);
+ return ((_column$columnDef$ena = column2.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
};
column2.getToggleVisibilityHandler = () => {
return (e5) => {
@@ -104168,48 +104068,48 @@ var ColumnVisibility = {
};
};
},
- createRow: (row2, table2) => {
- row2._getAllVisibleCells = memo2(() => [row2.getAllCells(), table2.getState().columnVisibility], (cells2) => {
- return cells2.filter((cell) => cell.column.getIsVisible());
- }, getMemoOptions(table2.options, "debugRows", "_getAllVisibleCells"));
- row2.getVisibleCells = memo2(() => [row2.getLeftVisibleCells(), row2.getCenterVisibleCells(), row2.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table2.options, "debugRows", "getVisibleCells"));
+ createRow: (row2, table) => {
+ row2._getAllVisibleCells = memo2(() => [row2.getAllCells(), table.getState().columnVisibility], (cells) => {
+ return cells.filter((cell) => cell.column.getIsVisible());
+ }, getMemoOptions(table.options, "debugRows", "_getAllVisibleCells"));
+ row2.getVisibleCells = memo2(() => [row2.getLeftVisibleCells(), row2.getCenterVisibleCells(), row2.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, "debugRows", "getVisibleCells"));
},
- createTable: (table2) => {
- const makeVisibleColumnsMethod = (key3, getColumns) => {
+ createTable: (table) => {
+ const makeVisibleColumnsMethod = (key2, getColumns) => {
return memo2(() => [getColumns(), getColumns().filter((d4) => d4.getIsVisible()).map((d4) => d4.id).join("_")], (columns) => {
return columns.filter((d4) => d4.getIsVisible == null ? void 0 : d4.getIsVisible());
- }, getMemoOptions(table2.options, "debugColumns", key3));
- };
- table2.getVisibleFlatColumns = makeVisibleColumnsMethod("getVisibleFlatColumns", () => table2.getAllFlatColumns());
- table2.getVisibleLeafColumns = makeVisibleColumnsMethod("getVisibleLeafColumns", () => table2.getAllLeafColumns());
- table2.getLeftVisibleLeafColumns = makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table2.getLeftLeafColumns());
- table2.getRightVisibleLeafColumns = makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table2.getRightLeafColumns());
- table2.getCenterVisibleLeafColumns = makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table2.getCenterLeafColumns());
- table2.setColumnVisibility = (updater) => table2.options.onColumnVisibilityChange == null ? void 0 : table2.options.onColumnVisibilityChange(updater);
- table2.resetColumnVisibility = (defaultState) => {
+ }, getMemoOptions(table.options, "debugColumns", key2));
+ };
+ table.getVisibleFlatColumns = makeVisibleColumnsMethod("getVisibleFlatColumns", () => table.getAllFlatColumns());
+ table.getVisibleLeafColumns = makeVisibleColumnsMethod("getVisibleLeafColumns", () => table.getAllLeafColumns());
+ table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table.getLeftLeafColumns());
+ table.getRightVisibleLeafColumns = makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table.getRightLeafColumns());
+ table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table.getCenterLeafColumns());
+ table.setColumnVisibility = (updater) => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
+ table.resetColumnVisibility = (defaultState) => {
var _table$initialState$c;
- table2.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table2.initialState.columnVisibility) != null ? _table$initialState$c : {});
+ table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
};
- table2.toggleAllColumnsVisible = (value) => {
+ table.toggleAllColumnsVisible = (value) => {
var _value;
- value = (_value = value) != null ? _value : !table2.getIsAllColumnsVisible();
- table2.setColumnVisibility(table2.getAllLeafColumns().reduce((obj, column2) => ({
+ value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
+ table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column2) => ({
...obj,
[column2.id]: !value ? !(column2.getCanHide != null && column2.getCanHide()) : value
}), {}));
};
- table2.getIsAllColumnsVisible = () => !table2.getAllLeafColumns().some((column2) => !(column2.getIsVisible != null && column2.getIsVisible()));
- table2.getIsSomeColumnsVisible = () => table2.getAllLeafColumns().some((column2) => column2.getIsVisible == null ? void 0 : column2.getIsVisible());
- table2.getToggleAllColumnsVisibilityHandler = () => {
+ table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some((column2) => !(column2.getIsVisible != null && column2.getIsVisible()));
+ table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some((column2) => column2.getIsVisible == null ? void 0 : column2.getIsVisible());
+ table.getToggleAllColumnsVisibilityHandler = () => {
return (e5) => {
var _target;
- table2.toggleAllColumnsVisible((_target = e5.target) == null ? void 0 : _target.checked);
+ table.toggleAllColumnsVisible((_target = e5.target) == null ? void 0 : _target.checked);
};
};
}
};
-function _getVisibleLeafColumns(table2, position3) {
- return !position3 ? table2.getVisibleLeafColumns() : position3 === "center" ? table2.getCenterVisibleLeafColumns() : position3 === "left" ? table2.getLeftVisibleLeafColumns() : table2.getRightVisibleLeafColumns();
+function _getVisibleLeafColumns(table, position) {
+ return !position ? table.getVisibleLeafColumns() : position === "center" ? table.getCenterVisibleLeafColumns() : position === "left" ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
}
var GlobalFiltering = {
getInitialState: (state) => {
@@ -104218,60 +104118,60 @@ var GlobalFiltering = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onGlobalFilterChange: makeStateUpdater("globalFilter", table2),
+ onGlobalFilterChange: makeStateUpdater("globalFilter", table),
globalFilterFn: "auto",
getColumnCanGlobalFilter: (column2) => {
var _table$getCoreRowMode;
- const value = (_table$getCoreRowMode = table2.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column2.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column2.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
return typeof value === "string" || typeof value === "number";
}
};
},
- createColumn: (column2, table2) => {
+ createColumn: (column2, table) => {
column2.getCanGlobalFilter = () => {
var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;
- return ((_column$columnDef$ena = column2.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table2.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table2.options.getColumnCanGlobalFilter == null ? void 0 : table2.options.getColumnCanGlobalFilter(column2)) != null ? _table$options$getCol : true) && !!column2.accessorFn;
+ return ((_column$columnDef$ena = column2.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column2)) != null ? _table$options$getCol : true) && !!column2.accessorFn;
};
},
- createTable: (table2) => {
- table2.getGlobalAutoFilterFn = () => {
+ createTable: (table) => {
+ table.getGlobalAutoFilterFn = () => {
return filterFns.includesString;
};
- table2.getGlobalFilterFn = () => {
+ table.getGlobalFilterFn = () => {
var _table$options$filter, _table$options$filter2;
const {
globalFilterFn
- } = table2.options;
- return isFunction2(globalFilterFn) ? globalFilterFn : globalFilterFn === "auto" ? table2.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table2.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn];
+ } = table.options;
+ return isFunction2(globalFilterFn) ? globalFilterFn : globalFilterFn === "auto" ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn];
};
- table2.setGlobalFilter = (updater) => {
- table2.options.onGlobalFilterChange == null || table2.options.onGlobalFilterChange(updater);
+ table.setGlobalFilter = (updater) => {
+ table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
};
- table2.resetGlobalFilter = (defaultState) => {
- table2.setGlobalFilter(defaultState ? void 0 : table2.initialState.globalFilter);
+ table.resetGlobalFilter = (defaultState) => {
+ table.setGlobalFilter(defaultState ? void 0 : table.initialState.globalFilter);
};
- table2._getGlobalFacetedRowModel = table2.options.getFacetedRowModel && table2.options.getFacetedRowModel(table2, "__global__");
- table2.getGlobalFacetedRowModel = () => {
- if (table2.options.manualFiltering || !table2._getGlobalFacetedRowModel) {
- return table2.getPreFilteredRowModel();
+ table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, "__global__");
+ table.getGlobalFacetedRowModel = () => {
+ if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
+ return table.getPreFilteredRowModel();
}
- return table2._getGlobalFacetedRowModel();
+ return table._getGlobalFacetedRowModel();
};
- table2._getGlobalFacetedUniqueValues = table2.options.getFacetedUniqueValues && table2.options.getFacetedUniqueValues(table2, "__global__");
- table2.getGlobalFacetedUniqueValues = () => {
- if (!table2._getGlobalFacetedUniqueValues) {
+ table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, "__global__");
+ table.getGlobalFacetedUniqueValues = () => {
+ if (!table._getGlobalFacetedUniqueValues) {
return /* @__PURE__ */ new Map();
}
- return table2._getGlobalFacetedUniqueValues();
+ return table._getGlobalFacetedUniqueValues();
};
- table2._getGlobalFacetedMinMaxValues = table2.options.getFacetedMinMaxValues && table2.options.getFacetedMinMaxValues(table2, "__global__");
- table2.getGlobalFacetedMinMaxValues = () => {
- if (!table2._getGlobalFacetedMinMaxValues) {
+ table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, "__global__");
+ table.getGlobalFacetedMinMaxValues = () => {
+ if (!table._getGlobalFacetedMinMaxValues) {
return;
}
- return table2._getGlobalFacetedMinMaxValues();
+ return table._getGlobalFacetedMinMaxValues();
};
}
};
@@ -104282,99 +104182,99 @@ var RowExpanding = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onExpandedChange: makeStateUpdater("expanded", table2),
+ onExpandedChange: makeStateUpdater("expanded", table),
paginateExpandedRows: true
};
},
- createTable: (table2) => {
+ createTable: (table) => {
let registered = false;
let queued = false;
- table2._autoResetExpanded = () => {
+ table._autoResetExpanded = () => {
var _ref, _table$options$autoRe;
if (!registered) {
- table2._queue(() => {
+ table._queue(() => {
registered = true;
});
return;
}
- if ((_ref = (_table$options$autoRe = table2.options.autoResetAll) != null ? _table$options$autoRe : table2.options.autoResetExpanded) != null ? _ref : !table2.options.manualExpanding) {
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
if (queued)
return;
queued = true;
- table2._queue(() => {
- table2.resetExpanded();
+ table._queue(() => {
+ table.resetExpanded();
queued = false;
});
}
};
- table2.setExpanded = (updater) => table2.options.onExpandedChange == null ? void 0 : table2.options.onExpandedChange(updater);
- table2.toggleAllRowsExpanded = (expanded) => {
- if (expanded != null ? expanded : !table2.getIsAllRowsExpanded()) {
- table2.setExpanded(true);
+ table.setExpanded = (updater) => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);
+ table.toggleAllRowsExpanded = (expanded) => {
+ if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
+ table.setExpanded(true);
} else {
- table2.setExpanded({});
+ table.setExpanded({});
}
};
- table2.resetExpanded = (defaultState) => {
+ table.resetExpanded = (defaultState) => {
var _table$initialState$e, _table$initialState;
- table2.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
};
- table2.getCanSomeRowsExpand = () => {
- return table2.getPrePaginationRowModel().flatRows.some((row2) => row2.getCanExpand());
+ table.getCanSomeRowsExpand = () => {
+ return table.getPrePaginationRowModel().flatRows.some((row2) => row2.getCanExpand());
};
- table2.getToggleAllRowsExpandedHandler = () => {
+ table.getToggleAllRowsExpandedHandler = () => {
return (e5) => {
e5.persist == null || e5.persist();
- table2.toggleAllRowsExpanded();
+ table.toggleAllRowsExpanded();
};
};
- table2.getIsSomeRowsExpanded = () => {
- const expanded = table2.getState().expanded;
+ table.getIsSomeRowsExpanded = () => {
+ const expanded = table.getState().expanded;
return expanded === true || Object.values(expanded).some(Boolean);
};
- table2.getIsAllRowsExpanded = () => {
- const expanded = table2.getState().expanded;
+ table.getIsAllRowsExpanded = () => {
+ const expanded = table.getState().expanded;
if (typeof expanded === "boolean") {
return expanded === true;
}
if (!Object.keys(expanded).length) {
return false;
}
- if (table2.getRowModel().flatRows.some((row2) => !row2.getIsExpanded())) {
+ if (table.getRowModel().flatRows.some((row2) => !row2.getIsExpanded())) {
return false;
}
return true;
};
- table2.getExpandedDepth = () => {
+ table.getExpandedDepth = () => {
let maxDepth = 0;
- const rowIds = table2.getState().expanded === true ? Object.keys(table2.getRowModel().rowsById) : Object.keys(table2.getState().expanded);
+ const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
rowIds.forEach((id3) => {
const splitId = id3.split(".");
maxDepth = Math.max(maxDepth, splitId.length);
});
return maxDepth;
};
- table2.getPreExpandedRowModel = () => table2.getSortedRowModel();
- table2.getExpandedRowModel = () => {
- if (!table2._getExpandedRowModel && table2.options.getExpandedRowModel) {
- table2._getExpandedRowModel = table2.options.getExpandedRowModel(table2);
+ table.getPreExpandedRowModel = () => table.getSortedRowModel();
+ table.getExpandedRowModel = () => {
+ if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
+ table._getExpandedRowModel = table.options.getExpandedRowModel(table);
}
- if (table2.options.manualExpanding || !table2._getExpandedRowModel) {
- return table2.getPreExpandedRowModel();
+ if (table.options.manualExpanding || !table._getExpandedRowModel) {
+ return table.getPreExpandedRowModel();
}
- return table2._getExpandedRowModel();
+ return table._getExpandedRowModel();
};
},
- createRow: (row2, table2) => {
+ createRow: (row2, table) => {
row2.toggleExpanded = (expanded) => {
- table2.setExpanded((old) => {
+ table.setExpanded((old) => {
var _expanded;
const exists = old === true ? true : !!(old != null && old[row2.id]);
let oldExpanded = {};
if (old === true) {
- Object.keys(table2.getRowModel().rowsById).forEach((rowId) => {
+ Object.keys(table.getRowModel().rowsById).forEach((rowId) => {
oldExpanded[rowId] = true;
});
} else {
@@ -104399,18 +104299,18 @@ var RowExpanding = {
};
row2.getIsExpanded = () => {
var _table$options$getIsR;
- const expanded = table2.getState().expanded;
- return !!((_table$options$getIsR = table2.options.getIsRowExpanded == null ? void 0 : table2.options.getIsRowExpanded(row2)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row2.id]));
+ const expanded = table.getState().expanded;
+ return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row2)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row2.id]));
};
row2.getCanExpand = () => {
var _table$options$getRow, _table$options$enable, _row$subRows;
- return (_table$options$getRow = table2.options.getRowCanExpand == null ? void 0 : table2.options.getRowCanExpand(row2)) != null ? _table$options$getRow : ((_table$options$enable = table2.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row2.subRows) != null && _row$subRows.length);
+ return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row2)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row2.subRows) != null && _row$subRows.length);
};
row2.getIsAllParentsExpanded = () => {
let isFullyExpanded = true;
let currentRow = row2;
while (isFullyExpanded && currentRow.parentId) {
- currentRow = table2.getRow(currentRow.parentId, true);
+ currentRow = table.getRow(currentRow.parentId, true);
isFullyExpanded = currentRow.getIsExpanded();
}
return isFullyExpanded;
@@ -104441,47 +104341,47 @@ var RowPagination = {
}
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onPaginationChange: makeStateUpdater("pagination", table2)
+ onPaginationChange: makeStateUpdater("pagination", table)
};
},
- createTable: (table2) => {
+ createTable: (table) => {
let registered = false;
let queued = false;
- table2._autoResetPageIndex = () => {
+ table._autoResetPageIndex = () => {
var _ref, _table$options$autoRe;
if (!registered) {
- table2._queue(() => {
+ table._queue(() => {
registered = true;
});
return;
}
- if ((_ref = (_table$options$autoRe = table2.options.autoResetAll) != null ? _table$options$autoRe : table2.options.autoResetPageIndex) != null ? _ref : !table2.options.manualPagination) {
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
if (queued)
return;
queued = true;
- table2._queue(() => {
- table2.resetPageIndex();
+ table._queue(() => {
+ table.resetPageIndex();
queued = false;
});
}
};
- table2.setPagination = (updater) => {
+ table.setPagination = (updater) => {
const safeUpdater = (old) => {
let newState = functionalUpdate(updater, old);
return newState;
};
- return table2.options.onPaginationChange == null ? void 0 : table2.options.onPaginationChange(safeUpdater);
+ return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
};
- table2.resetPagination = (defaultState) => {
+ table.resetPagination = (defaultState) => {
var _table$initialState$p;
- table2.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table2.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
+ table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
};
- table2.setPageIndex = (updater) => {
- table2.setPagination((old) => {
+ table.setPageIndex = (updater) => {
+ table.setPagination((old) => {
let pageIndex = functionalUpdate(updater, old.pageIndex);
- const maxPageIndex = typeof table2.options.pageCount === "undefined" || table2.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table2.options.pageCount - 1;
+ const maxPageIndex = typeof table.options.pageCount === "undefined" || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
return {
...old,
@@ -104489,16 +104389,16 @@ var RowPagination = {
};
});
};
- table2.resetPageIndex = (defaultState) => {
+ table.resetPageIndex = (defaultState) => {
var _table$initialState$p2, _table$initialState;
- table2.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table2.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
+ table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
};
- table2.resetPageSize = (defaultState) => {
+ table.resetPageSize = (defaultState) => {
var _table$initialState$p3, _table$initialState2;
- table2.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table2.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
+ table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
};
- table2.setPageSize = (updater) => {
- table2.setPagination((old) => {
+ table.setPageSize = (updater) => {
+ table.setPagination((old) => {
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
const topRowIndex = old.pageSize * old.pageIndex;
const pageIndex = Math.floor(topRowIndex / pageSize);
@@ -104509,9 +104409,9 @@ var RowPagination = {
};
});
};
- table2.setPageCount = (updater) => table2.setPagination((old) => {
+ table.setPageCount = (updater) => table.setPagination((old) => {
var _table$options$pageCo;
- let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table2.options.pageCount) != null ? _table$options$pageCo : -1);
+ let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
if (typeof newPageCount === "number") {
newPageCount = Math.max(-1, newPageCount);
}
@@ -104520,19 +104420,19 @@ var RowPagination = {
pageCount: newPageCount
};
});
- table2.getPageOptions = memo2(() => [table2.getPageCount()], (pageCount) => {
+ table.getPageOptions = memo2(() => [table.getPageCount()], (pageCount) => {
let pageOptions = [];
if (pageCount && pageCount > 0) {
pageOptions = [...new Array(pageCount)].fill(null).map((_15, i4) => i4);
}
return pageOptions;
- }, getMemoOptions(table2.options, "debugTable", "getPageOptions"));
- table2.getCanPreviousPage = () => table2.getState().pagination.pageIndex > 0;
- table2.getCanNextPage = () => {
+ }, getMemoOptions(table.options, "debugTable", "getPageOptions"));
+ table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;
+ table.getCanNextPage = () => {
const {
pageIndex
- } = table2.getState().pagination;
- const pageCount = table2.getPageCount();
+ } = table.getState().pagination;
+ const pageCount = table.getPageCount();
if (pageCount === -1) {
return true;
}
@@ -104541,37 +104441,37 @@ var RowPagination = {
}
return pageIndex < pageCount - 1;
};
- table2.previousPage = () => {
- return table2.setPageIndex((old) => old - 1);
+ table.previousPage = () => {
+ return table.setPageIndex((old) => old - 1);
};
- table2.nextPage = () => {
- return table2.setPageIndex((old) => {
+ table.nextPage = () => {
+ return table.setPageIndex((old) => {
return old + 1;
});
};
- table2.firstPage = () => {
- return table2.setPageIndex(0);
+ table.firstPage = () => {
+ return table.setPageIndex(0);
};
- table2.lastPage = () => {
- return table2.setPageIndex(table2.getPageCount() - 1);
+ table.lastPage = () => {
+ return table.setPageIndex(table.getPageCount() - 1);
};
- table2.getPrePaginationRowModel = () => table2.getExpandedRowModel();
- table2.getPaginationRowModel = () => {
- if (!table2._getPaginationRowModel && table2.options.getPaginationRowModel) {
- table2._getPaginationRowModel = table2.options.getPaginationRowModel(table2);
+ table.getPrePaginationRowModel = () => table.getExpandedRowModel();
+ table.getPaginationRowModel = () => {
+ if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
+ table._getPaginationRowModel = table.options.getPaginationRowModel(table);
}
- if (table2.options.manualPagination || !table2._getPaginationRowModel) {
- return table2.getPrePaginationRowModel();
+ if (table.options.manualPagination || !table._getPaginationRowModel) {
+ return table.getPrePaginationRowModel();
}
- return table2._getPaginationRowModel();
+ return table._getPaginationRowModel();
};
- table2.getPageCount = () => {
+ table.getPageCount = () => {
var _table$options$pageCo2;
- return (_table$options$pageCo2 = table2.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table2.getRowCount() / table2.getState().pagination.pageSize);
+ return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);
};
- table2.getRowCount = () => {
+ table.getRowCount = () => {
var _table$options$rowCou;
- return (_table$options$rowCou = table2.options.rowCount) != null ? _table$options$rowCou : table2.getPrePaginationRowModel().rows.length;
+ return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;
};
}
};
@@ -104586,13 +104486,13 @@ var RowPinning = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onRowPinningChange: makeStateUpdater("rowPinning", table2)
+ onRowPinningChange: makeStateUpdater("rowPinning", table)
};
},
- createRow: (row2, table2) => {
- row2.pin = (position3, includeLeafRows, includeParentRows) => {
+ createRow: (row2, table) => {
+ row2.pin = (position, includeLeafRows, includeParentRows) => {
const leafRowIds = includeLeafRows ? row2.getLeafRows().map((_ref) => {
let {
id: id3
@@ -104606,16 +104506,16 @@ var RowPinning = {
return id3;
}) : [];
const rowIds = /* @__PURE__ */ new Set([...parentRowIds, row2.id, ...leafRowIds]);
- table2.setRowPinning((old) => {
+ table.setRowPinning((old) => {
var _old$top3, _old$bottom3;
- if (position3 === "bottom") {
+ if (position === "bottom") {
var _old$top, _old$bottom;
return {
top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter((d4) => !(rowIds != null && rowIds.has(d4))),
bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter((d4) => !(rowIds != null && rowIds.has(d4))), ...Array.from(rowIds)]
};
}
- if (position3 === "top") {
+ if (position === "top") {
var _old$top2, _old$bottom2;
return {
top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter((d4) => !(rowIds != null && rowIds.has(d4))), ...Array.from(rowIds)],
@@ -104633,7 +104533,7 @@ var RowPinning = {
const {
enableRowPinning,
enablePinning
- } = table2.options;
+ } = table.options;
if (typeof enableRowPinning === "function") {
return enableRowPinning(row2);
}
@@ -104644,17 +104544,17 @@ var RowPinning = {
const {
top,
bottom
- } = table2.getState().rowPinning;
+ } = table.getState().rowPinning;
const isTop = rowIds.some((d4) => top == null ? void 0 : top.includes(d4));
const isBottom = rowIds.some((d4) => bottom == null ? void 0 : bottom.includes(d4));
return isTop ? "top" : isBottom ? "bottom" : false;
};
row2.getPinnedIndex = () => {
var _table$_getPinnedRows, _visiblePinnedRowIds$;
- const position3 = row2.getIsPinned();
- if (!position3)
+ const position = row2.getIsPinned();
+ if (!position)
return -1;
- const visiblePinnedRowIds = (_table$_getPinnedRows = table2._getPinnedRows(position3)) == null ? void 0 : _table$_getPinnedRows.map((_ref4) => {
+ const visiblePinnedRowIds = (_table$_getPinnedRows = table._getPinnedRows(position)) == null ? void 0 : _table$_getPinnedRows.map((_ref4) => {
let {
id: id3
} = _ref4;
@@ -104663,38 +104563,38 @@ var RowPinning = {
return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row2.id)) != null ? _visiblePinnedRowIds$ : -1;
};
},
- createTable: (table2) => {
- table2.setRowPinning = (updater) => table2.options.onRowPinningChange == null ? void 0 : table2.options.onRowPinningChange(updater);
- table2.resetRowPinning = (defaultState) => {
+ createTable: (table) => {
+ table.setRowPinning = (updater) => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater);
+ table.resetRowPinning = (defaultState) => {
var _table$initialState$r, _table$initialState;
- return table2.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());
+ return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());
};
- table2.getIsSomeRowsPinned = (position3) => {
+ table.getIsSomeRowsPinned = (position) => {
var _pinningState$positio;
- const pinningState = table2.getState().rowPinning;
- if (!position3) {
+ const pinningState = table.getState().rowPinning;
+ if (!position) {
var _pinningState$top, _pinningState$bottom;
return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length));
}
- return Boolean((_pinningState$positio = pinningState[position3]) == null ? void 0 : _pinningState$positio.length);
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
};
- table2._getPinnedRows = memo2((position3) => [table2.getRowModel().rows, table2.getState().rowPinning[position3], position3], (visibleRows, pinnedRowIds, position3) => {
+ table._getPinnedRows = memo2((position) => [table.getRowModel().rows, table.getState().rowPinning[position], position], (visibleRows, pinnedRowIds, position) => {
var _table$options$keepPi;
- const rows = ((_table$options$keepPi = table2.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? (pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => {
- const row2 = table2.getRow(rowId, true);
+ const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? (pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => {
+ const row2 = table.getRow(rowId, true);
return row2.getIsAllParentsExpanded() ? row2 : null;
}) : (pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => visibleRows.find((row2) => row2.id === rowId));
return rows.filter(Boolean).map((d4) => ({
...d4,
- position: position3
+ position
}));
- }, getMemoOptions(table2.options, "debugRows", "_getPinnedRows"));
- table2.getTopRows = () => table2._getPinnedRows("top");
- table2.getBottomRows = () => table2._getPinnedRows("bottom");
- table2.getCenterRows = memo2(() => [table2.getRowModel().rows, table2.getState().rowPinning.top, table2.getState().rowPinning.bottom], (allRows, top, bottom) => {
+ }, getMemoOptions(table.options, "debugRows", "_getPinnedRows"));
+ table.getTopRows = () => table._getPinnedRows("top");
+ table.getBottomRows = () => table._getPinnedRows("bottom");
+ table.getCenterRows = memo2(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
const topAndBottom = /* @__PURE__ */ new Set([...top != null ? top : [], ...bottom != null ? bottom : []]);
return allRows.filter((d4) => !topAndBottom.has(d4.id));
- }, getMemoOptions(table2.options, "debugRows", "getCenterRows"));
+ }, getMemoOptions(table.options, "debugRows", "getCenterRows"));
}
};
var RowSelection = {
@@ -104704,27 +104604,27 @@ var RowSelection = {
...state
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onRowSelectionChange: makeStateUpdater("rowSelection", table2),
+ onRowSelectionChange: makeStateUpdater("rowSelection", table),
enableRowSelection: true,
enableMultiRowSelection: true,
enableSubRowSelection: true
};
},
- createTable: (table2) => {
- table2.setRowSelection = (updater) => table2.options.onRowSelectionChange == null ? void 0 : table2.options.onRowSelectionChange(updater);
- table2.resetRowSelection = (defaultState) => {
+ createTable: (table) => {
+ table.setRowSelection = (updater) => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);
+ table.resetRowSelection = (defaultState) => {
var _table$initialState$r;
- return table2.setRowSelection(defaultState ? {} : (_table$initialState$r = table2.initialState.rowSelection) != null ? _table$initialState$r : {});
+ return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
};
- table2.toggleAllRowsSelected = (value) => {
- table2.setRowSelection((old) => {
- value = typeof value !== "undefined" ? value : !table2.getIsAllRowsSelected();
+ table.toggleAllRowsSelected = (value) => {
+ table.setRowSelection((old) => {
+ value = typeof value !== "undefined" ? value : !table.getIsAllRowsSelected();
const rowSelection = {
...old
};
- const preGroupedFlatRows = table2.getPreGroupedRowModel().flatRows;
+ const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
if (value) {
preGroupedFlatRows.forEach((row2) => {
if (!row2.getCanSelect()) {
@@ -104740,18 +104640,18 @@ var RowSelection = {
return rowSelection;
});
};
- table2.toggleAllPageRowsSelected = (value) => table2.setRowSelection((old) => {
- const resolvedValue = typeof value !== "undefined" ? value : !table2.getIsAllPageRowsSelected();
+ table.toggleAllPageRowsSelected = (value) => table.setRowSelection((old) => {
+ const resolvedValue = typeof value !== "undefined" ? value : !table.getIsAllPageRowsSelected();
const rowSelection = {
...old
};
- table2.getRowModel().rows.forEach((row2) => {
- mutateRowIsSelected(rowSelection, row2.id, resolvedValue, true, table2);
+ table.getRowModel().rows.forEach((row2) => {
+ mutateRowIsSelected(rowSelection, row2.id, resolvedValue, true, table);
});
return rowSelection;
});
- table2.getPreSelectedRowModel = () => table2.getCoreRowModel();
- table2.getSelectedRowModel = memo2(() => [table2.getState().rowSelection, table2.getCoreRowModel()], (rowSelection, rowModel) => {
+ table.getPreSelectedRowModel = () => table.getCoreRowModel();
+ table.getSelectedRowModel = memo2(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
@@ -104759,9 +104659,9 @@ var RowSelection = {
rowsById: {}
};
}
- return selectRowsFn(table2, rowModel);
- }, getMemoOptions(table2.options, "debugTable", "getSelectedRowModel"));
- table2.getFilteredSelectedRowModel = memo2(() => [table2.getState().rowSelection, table2.getFilteredRowModel()], (rowSelection, rowModel) => {
+ return selectRowsFn(table, rowModel);
+ }, getMemoOptions(table.options, "debugTable", "getSelectedRowModel"));
+ table.getFilteredSelectedRowModel = memo2(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
@@ -104769,9 +104669,9 @@ var RowSelection = {
rowsById: {}
};
}
- return selectRowsFn(table2, rowModel);
- }, getMemoOptions(table2.options, "debugTable", "getFilteredSelectedRowModel"));
- table2.getGroupedSelectedRowModel = memo2(() => [table2.getState().rowSelection, table2.getSortedRowModel()], (rowSelection, rowModel) => {
+ return selectRowsFn(table, rowModel);
+ }, getMemoOptions(table.options, "debugTable", "getFilteredSelectedRowModel"));
+ table.getGroupedSelectedRowModel = memo2(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
@@ -104779,13 +104679,13 @@ var RowSelection = {
rowsById: {}
};
}
- return selectRowsFn(table2, rowModel);
- }, getMemoOptions(table2.options, "debugTable", "getGroupedSelectedRowModel"));
- table2.getIsAllRowsSelected = () => {
- const preGroupedFlatRows = table2.getFilteredRowModel().flatRows;
+ return selectRowsFn(table, rowModel);
+ }, getMemoOptions(table.options, "debugTable", "getGroupedSelectedRowModel"));
+ table.getIsAllRowsSelected = () => {
+ const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
const {
rowSelection
- } = table2.getState();
+ } = table.getState();
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
if (isAllRowsSelected) {
if (preGroupedFlatRows.some((row2) => row2.getCanSelect() && !rowSelection[row2.id])) {
@@ -104794,41 +104694,41 @@ var RowSelection = {
}
return isAllRowsSelected;
};
- table2.getIsAllPageRowsSelected = () => {
- const paginationFlatRows = table2.getPaginationRowModel().flatRows.filter((row2) => row2.getCanSelect());
+ table.getIsAllPageRowsSelected = () => {
+ const paginationFlatRows = table.getPaginationRowModel().flatRows.filter((row2) => row2.getCanSelect());
const {
rowSelection
- } = table2.getState();
+ } = table.getState();
let isAllPageRowsSelected = !!paginationFlatRows.length;
if (isAllPageRowsSelected && paginationFlatRows.some((row2) => !rowSelection[row2.id])) {
isAllPageRowsSelected = false;
}
return isAllPageRowsSelected;
};
- table2.getIsSomeRowsSelected = () => {
+ table.getIsSomeRowsSelected = () => {
var _table$getState$rowSe;
- const totalSelected = Object.keys((_table$getState$rowSe = table2.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
- return totalSelected > 0 && totalSelected < table2.getFilteredRowModel().flatRows.length;
+ const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
+ return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
};
- table2.getIsSomePageRowsSelected = () => {
- const paginationFlatRows = table2.getPaginationRowModel().flatRows;
- return table2.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter((row2) => row2.getCanSelect()).some((d4) => d4.getIsSelected() || d4.getIsSomeSelected());
+ table.getIsSomePageRowsSelected = () => {
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
+ return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter((row2) => row2.getCanSelect()).some((d4) => d4.getIsSelected() || d4.getIsSomeSelected());
};
- table2.getToggleAllRowsSelectedHandler = () => {
+ table.getToggleAllRowsSelectedHandler = () => {
return (e5) => {
- table2.toggleAllRowsSelected(e5.target.checked);
+ table.toggleAllRowsSelected(e5.target.checked);
};
};
- table2.getToggleAllPageRowsSelectedHandler = () => {
+ table.getToggleAllPageRowsSelectedHandler = () => {
return (e5) => {
- table2.toggleAllPageRowsSelected(e5.target.checked);
+ table.toggleAllPageRowsSelected(e5.target.checked);
};
};
},
- createRow: (row2, table2) => {
+ createRow: (row2, table) => {
row2.toggleSelected = (value, opts) => {
const isSelected = row2.getIsSelected();
- table2.setRowSelection((old) => {
+ table.setRowSelection((old) => {
var _opts$selectChildren;
value = typeof value !== "undefined" ? value : !isSelected;
if (row2.getCanSelect() && isSelected === value) {
@@ -104837,48 +104737,48 @@ var RowSelection = {
const selectedRowIds = {
...old
};
- mutateRowIsSelected(selectedRowIds, row2.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table2);
+ mutateRowIsSelected(selectedRowIds, row2.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table);
return selectedRowIds;
});
};
row2.getIsSelected = () => {
const {
rowSelection
- } = table2.getState();
+ } = table.getState();
return isRowSelected(row2, rowSelection);
};
row2.getIsSomeSelected = () => {
const {
rowSelection
- } = table2.getState();
+ } = table.getState();
return isSubRowSelected(row2, rowSelection) === "some";
};
row2.getIsAllSubRowsSelected = () => {
const {
rowSelection
- } = table2.getState();
+ } = table.getState();
return isSubRowSelected(row2, rowSelection) === "all";
};
row2.getCanSelect = () => {
var _table$options$enable;
- if (typeof table2.options.enableRowSelection === "function") {
- return table2.options.enableRowSelection(row2);
+ if (typeof table.options.enableRowSelection === "function") {
+ return table.options.enableRowSelection(row2);
}
- return (_table$options$enable = table2.options.enableRowSelection) != null ? _table$options$enable : true;
+ return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
};
row2.getCanSelectSubRows = () => {
var _table$options$enable2;
- if (typeof table2.options.enableSubRowSelection === "function") {
- return table2.options.enableSubRowSelection(row2);
+ if (typeof table.options.enableSubRowSelection === "function") {
+ return table.options.enableSubRowSelection(row2);
}
- return (_table$options$enable2 = table2.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
+ return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
};
row2.getCanMultiSelect = () => {
var _table$options$enable3;
- if (typeof table2.options.enableMultiRowSelection === "function") {
- return table2.options.enableMultiRowSelection(row2);
+ if (typeof table.options.enableMultiRowSelection === "function") {
+ return table.options.enableMultiRowSelection(row2);
}
- return (_table$options$enable3 = table2.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
+ return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
};
row2.getToggleSelectedHandler = () => {
const canSelect = row2.getCanSelect();
@@ -104891,12 +104791,12 @@ var RowSelection = {
};
}
};
-var mutateRowIsSelected = (selectedRowIds, id3, value, includeChildren, table2) => {
+var mutateRowIsSelected = (selectedRowIds, id3, value, includeChildren, table) => {
var _row$subRows;
- const row2 = table2.getRow(id3, true);
+ const row2 = table.getRow(id3, true);
if (value) {
if (!row2.getCanMultiSelect()) {
- Object.keys(selectedRowIds).forEach((key3) => delete selectedRowIds[key3]);
+ Object.keys(selectedRowIds).forEach((key2) => delete selectedRowIds[key2]);
}
if (row2.getCanSelect()) {
selectedRowIds[id3] = true;
@@ -104905,11 +104805,11 @@ var mutateRowIsSelected = (selectedRowIds, id3, value, includeChildren, table2)
delete selectedRowIds[id3];
}
if (includeChildren && (_row$subRows = row2.subRows) != null && _row$subRows.length && row2.getCanSelectSubRows()) {
- row2.subRows.forEach((row3) => mutateRowIsSelected(selectedRowIds, row3.id, value, includeChildren, table2));
+ row2.subRows.forEach((row3) => mutateRowIsSelected(selectedRowIds, row3.id, value, includeChildren, table));
}
};
-function selectRowsFn(table2, rowModel) {
- const rowSelection = table2.getState().rowSelection;
+function selectRowsFn(table, rowModel) {
+ const rowSelection = table.getState().rowSelection;
const newSelectedFlatRows = [];
const newSelectedRowsById = {};
const recurseRows = function(rows, depth) {
@@ -104941,7 +104841,7 @@ function isRowSelected(row2, selection2) {
var _selection$row$id;
return (_selection$row$id = selection2[row2.id]) != null ? _selection$row$id : false;
}
-function isSubRowSelected(row2, selection2, table2) {
+function isSubRowSelected(row2, selection2, table) {
var _row$subRows3;
if (!((_row$subRows3 = row2.subRows) != null && _row$subRows3.length))
return false;
@@ -105059,17 +104959,17 @@ var RowSorting = {
sortUndefined: 1
};
},
- getDefaultOptions: (table2) => {
+ getDefaultOptions: (table) => {
return {
- onSortingChange: makeStateUpdater("sorting", table2),
+ onSortingChange: makeStateUpdater("sorting", table),
isMultiSortEvent: (e5) => {
return e5.shiftKey;
}
};
},
- createColumn: (column2, table2) => {
+ createColumn: (column2, table) => {
column2.getAutoSortingFn = () => {
- const firstRows = table2.getFilteredRowModel().flatRows.slice(10);
+ const firstRows = table.getFilteredRowModel().flatRows.slice(10);
let isString5 = false;
for (const row2 of firstRows) {
const value = row2 == null ? void 0 : row2.getValue(column2.id);
@@ -105089,7 +104989,7 @@ var RowSorting = {
return sortingFns.basic;
};
column2.getAutoSortDir = () => {
- const firstRow = table2.getFilteredRowModel().flatRows[0];
+ const firstRow = table.getFilteredRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column2.id);
if (typeof value === "string") {
return "asc";
@@ -105101,12 +105001,12 @@ var RowSorting = {
if (!column2) {
throw new Error();
}
- return isFunction2(column2.columnDef.sortingFn) ? column2.columnDef.sortingFn : column2.columnDef.sortingFn === "auto" ? column2.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table2.options.sortingFns) == null ? void 0 : _table$options$sortin2[column2.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column2.columnDef.sortingFn];
+ return isFunction2(column2.columnDef.sortingFn) ? column2.columnDef.sortingFn : column2.columnDef.sortingFn === "auto" ? column2.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column2.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column2.columnDef.sortingFn];
};
column2.toggleSorting = (desc, multi) => {
const nextSortingOrder = column2.getNextSortingOrder();
const hasManualValue = typeof desc !== "undefined" && desc !== null;
- table2.setSorting((old) => {
+ table.setSorting((old) => {
const existingSorting = old == null ? void 0 : old.find((d4) => d4.id === column2.id);
const existingIndex = old == null ? void 0 : old.findIndex((d4) => d4.id === column2.id);
let newSorting = [];
@@ -105140,7 +105040,7 @@ var RowSorting = {
id: column2.id,
desc: nextDesc
}];
- newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table2.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
+ newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
} else if (sortAction === "toggle") {
newSorting = old.map((d4) => {
if (d4.id === column2.id) {
@@ -105164,7 +105064,7 @@ var RowSorting = {
};
column2.getFirstSortDir = () => {
var _ref, _column$columnDef$sor;
- const sortDescFirst = (_ref = (_column$columnDef$sor = column2.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table2.options.sortDescFirst) != null ? _ref : column2.getAutoSortDir() === "desc";
+ const sortDescFirst = (_ref = (_column$columnDef$sor = column2.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column2.getAutoSortDir() === "desc";
return sortDescFirst ? "desc" : "asc";
};
column2.getNextSortingOrder = (multi) => {
@@ -105174,30 +105074,30 @@ var RowSorting = {
if (!isSorted) {
return firstSortDirection;
}
- if (isSorted !== firstSortDirection && ((_table$options$enable = table2.options.enableSortingRemoval) != null ? _table$options$enable : true) && (multi ? (_table$options$enable2 = table2.options.enableMultiRemove) != null ? _table$options$enable2 : true : true)) {
+ if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true)) {
return false;
}
return isSorted === "desc" ? "asc" : "desc";
};
column2.getCanSort = () => {
var _column$columnDef$ena, _table$options$enable3;
- return ((_column$columnDef$ena = column2.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table2.options.enableSorting) != null ? _table$options$enable3 : true) && !!column2.accessorFn;
+ return ((_column$columnDef$ena = column2.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column2.accessorFn;
};
column2.getCanMultiSort = () => {
var _ref2, _column$columnDef$ena2;
- return (_ref2 = (_column$columnDef$ena2 = column2.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table2.options.enableMultiSort) != null ? _ref2 : !!column2.accessorFn;
+ return (_ref2 = (_column$columnDef$ena2 = column2.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column2.accessorFn;
};
column2.getIsSorted = () => {
var _table$getState$sorti;
- const columnSort = (_table$getState$sorti = table2.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d4) => d4.id === column2.id);
+ const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d4) => d4.id === column2.id);
return !columnSort ? false : columnSort.desc ? "desc" : "asc";
};
column2.getSortIndex = () => {
var _table$getState$sorti2, _table$getState$sorti3;
- return (_table$getState$sorti2 = (_table$getState$sorti3 = table2.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$sorti2 : -1;
+ return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$sorti2 : -1;
};
column2.clearSorting = () => {
- table2.setSorting((old) => old != null && old.length ? old.filter((d4) => d4.id !== column2.id) : []);
+ table.setSorting((old) => old != null && old.length ? old.filter((d4) => d4.id !== column2.id) : []);
};
column2.getToggleSortingHandler = () => {
const canSort = column2.getCanSort();
@@ -105205,25 +105105,25 @@ var RowSorting = {
if (!canSort)
return;
e5.persist == null || e5.persist();
- column2.toggleSorting == null || column2.toggleSorting(void 0, column2.getCanMultiSort() ? table2.options.isMultiSortEvent == null ? void 0 : table2.options.isMultiSortEvent(e5) : false);
+ column2.toggleSorting == null || column2.toggleSorting(void 0, column2.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e5) : false);
};
};
},
- createTable: (table2) => {
- table2.setSorting = (updater) => table2.options.onSortingChange == null ? void 0 : table2.options.onSortingChange(updater);
- table2.resetSorting = (defaultState) => {
+ createTable: (table) => {
+ table.setSorting = (updater) => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater);
+ table.resetSorting = (defaultState) => {
var _table$initialState$s, _table$initialState;
- table2.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
+ table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
};
- table2.getPreSortedRowModel = () => table2.getGroupedRowModel();
- table2.getSortedRowModel = () => {
- if (!table2._getSortedRowModel && table2.options.getSortedRowModel) {
- table2._getSortedRowModel = table2.options.getSortedRowModel(table2);
+ table.getPreSortedRowModel = () => table.getGroupedRowModel();
+ table.getSortedRowModel = () => {
+ if (!table._getSortedRowModel && table.options.getSortedRowModel) {
+ table._getSortedRowModel = table.options.getSortedRowModel(table);
}
- if (table2.options.manualSorting || !table2._getSortedRowModel) {
- return table2.getPreSortedRowModel();
+ if (table.options.manualSorting || !table._getSortedRowModel) {
+ return table.getPreSortedRowModel();
}
- return table2._getSortedRowModel();
+ return table._getSortedRowModel();
};
}
};
@@ -105249,15 +105149,15 @@ function createTable(options) {
console.info("Creating Table Instance...");
}
const _features = [...builtInFeatures, ...(_options$_features = options._features) != null ? _options$_features : []];
- let table2 = {
+ let table = {
_features
};
- const defaultOptions4 = table2._features.reduce((obj, feature) => {
- return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table2));
+ const defaultOptions4 = table._features.reduce((obj, feature) => {
+ return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
}, {});
const mergeOptions = (options2) => {
- if (table2.options.mergeOptions) {
- return table2.options.mergeOptions(defaultOptions4, options2);
+ if (table.options.mergeOptions) {
+ return table.options.mergeOptions(defaultOptions4, options2);
}
return {
...defaultOptions4,
@@ -105269,7 +105169,7 @@ function createTable(options) {
...coreInitialState,
...(_options$initialState = options.initialState) != null ? _options$initialState : {}
};
- table2._features.forEach((feature) => {
+ table._features.forEach((feature) => {
var _feature$getInitialSt;
initialState2 = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState2)) != null ? _feature$getInitialSt : initialState2;
});
@@ -105297,35 +105197,35 @@ function createTable(options) {
}
},
reset: () => {
- table2.setState(table2.initialState);
+ table.setState(table.initialState);
},
setOptions: (updater) => {
- const newOptions = functionalUpdate(updater, table2.options);
- table2.options = mergeOptions(newOptions);
+ const newOptions = functionalUpdate(updater, table.options);
+ table.options = mergeOptions(newOptions);
},
getState: () => {
- return table2.options.state;
+ return table.options.state;
},
setState: (updater) => {
- table2.options.onStateChange == null || table2.options.onStateChange(updater);
+ table.options.onStateChange == null || table.options.onStateChange(updater);
},
- _getRowId: (row2, index3, parent) => {
+ _getRowId: (row2, index2, parent) => {
var _table$options$getRow;
- return (_table$options$getRow = table2.options.getRowId == null ? void 0 : table2.options.getRowId(row2, index3, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index3].join(".") : index3}`;
+ 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}`;
},
getCoreRowModel: () => {
- if (!table2._getCoreRowModel) {
- table2._getCoreRowModel = table2.options.getCoreRowModel(table2);
+ if (!table._getCoreRowModel) {
+ table._getCoreRowModel = table.options.getCoreRowModel(table);
}
- return table2._getCoreRowModel();
+ return table._getCoreRowModel();
},
getRowModel: () => {
- return table2.getPaginationRowModel();
+ return table.getPaginationRowModel();
},
getRow: (id3, searchAll) => {
- let row2 = (searchAll ? table2.getPrePaginationRowModel() : table2.getRowModel()).rowsById[id3];
+ let row2 = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id3];
if (!row2) {
- row2 = table2.getCoreRowModel().rowsById[id3];
+ row2 = table.getCoreRowModel().rowsById[id3];
if (!row2) {
if (false) {
throw new Error(`getRow could not find row with ID: ${id3}`);
@@ -105335,7 +105235,7 @@ function createTable(options) {
}
return row2;
},
- _getDefaultColumnDef: memo2(() => [table2.options.defaultColumn], (defaultColumn) => {
+ _getDefaultColumnDef: memo2(() => [table.options.defaultColumn], (defaultColumn) => {
var _defaultColumn;
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
return {
@@ -105353,20 +105253,20 @@ function createTable(options) {
var _props$renderValue$to, _props$renderValue;
return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;
},
- ...table2._features.reduce((obj, feature) => {
+ ...table._features.reduce((obj, feature) => {
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
}, {}),
...defaultColumn
};
}, getMemoOptions(options, "debugColumns", "_getDefaultColumnDef")),
- _getColumnDefs: () => table2.options.columns,
- getAllColumns: memo2(() => [table2._getColumnDefs()], (columnDefs) => {
+ _getColumnDefs: () => table.options.columns,
+ getAllColumns: memo2(() => [table._getColumnDefs()], (columnDefs) => {
const recurseColumns = function(columnDefs2, parent, depth) {
if (depth === void 0) {
depth = 0;
}
return columnDefs2.map((columnDef) => {
- const column2 = createColumn2(table2, columnDef, depth, parent);
+ const column2 = createColumn2(table, columnDef, depth, parent);
const groupingColumnDef = columnDef;
column2.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column2, depth + 1) : [];
return column2;
@@ -105374,38 +105274,38 @@ function createTable(options) {
};
return recurseColumns(columnDefs);
}, getMemoOptions(options, "debugColumns", "getAllColumns")),
- getAllFlatColumns: memo2(() => [table2.getAllColumns()], (allColumns) => {
+ getAllFlatColumns: memo2(() => [table.getAllColumns()], (allColumns) => {
return allColumns.flatMap((column2) => {
return column2.getFlatColumns();
});
}, getMemoOptions(options, "debugColumns", "getAllFlatColumns")),
- _getAllFlatColumnsById: memo2(() => [table2.getAllFlatColumns()], (flatColumns) => {
+ _getAllFlatColumnsById: memo2(() => [table.getAllFlatColumns()], (flatColumns) => {
return flatColumns.reduce((acc, column2) => {
acc[column2.id] = column2;
return acc;
}, {});
}, getMemoOptions(options, "debugColumns", "getAllFlatColumnsById")),
- getAllLeafColumns: memo2(() => [table2.getAllColumns(), table2._getOrderColumnsFn()], (allColumns, orderColumns2) => {
+ getAllLeafColumns: memo2(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
let leafColumns = allColumns.flatMap((column2) => column2.getLeafColumns());
return orderColumns2(leafColumns);
}, getMemoOptions(options, "debugColumns", "getAllLeafColumns")),
getColumn: (columnId) => {
- const column2 = table2._getAllFlatColumnsById()[columnId];
+ const column2 = table._getAllFlatColumnsById()[columnId];
if (false) {
console.error(`[Table] Column with id '${columnId}' does not exist.`);
}
return column2;
}
};
- Object.assign(table2, coreInstance);
- for (let index3 = 0; index3 < table2._features.length; index3++) {
- const feature = table2._features[index3];
- feature == null || feature.createTable == null || feature.createTable(table2);
+ Object.assign(table, coreInstance);
+ for (let index2 = 0; index2 < table._features.length; index2++) {
+ const feature = table._features[index2];
+ feature == null || feature.createTable == null || feature.createTable(table);
}
- return table2;
+ return table;
}
function getCoreRowModel() {
- return (table2) => memo2(() => [table2.options.data], (data3) => {
+ return (table) => memo2(() => [table.options.data], (data2) => {
const rowModel = {
rows: [],
flatRows: [],
@@ -105417,13 +105317,13 @@ function getCoreRowModel() {
}
const rows = [];
for (let i4 = 0; i4 < originalRows.length; i4++) {
- const row2 = createRow2(table2, table2._getRowId(originalRows[i4], i4, parentRow), originalRows[i4], i4, depth, void 0, parentRow == null ? void 0 : parentRow.id);
+ const row2 = createRow2(table, table._getRowId(originalRows[i4], i4, parentRow), originalRows[i4], i4, depth, void 0, parentRow == null ? void 0 : parentRow.id);
rowModel.flatRows.push(row2);
rowModel.rowsById[row2.id] = row2;
rows.push(row2);
- if (table2.options.getSubRows) {
+ if (table.options.getSubRows) {
var _row$originalSubRows;
- row2.originalSubRows = table2.options.getSubRows(originalRows[i4], i4);
+ row2.originalSubRows = table.options.getSubRows(originalRows[i4], i4);
if ((_row$originalSubRows = row2.originalSubRows) != null && _row$originalSubRows.length) {
row2.subRows = accessRows(row2.originalSubRows, depth + 1, row2);
}
@@ -105431,12 +105331,12 @@ function getCoreRowModel() {
}
return rows;
};
- rowModel.rows = accessRows(data3);
+ rowModel.rows = accessRows(data2);
return rowModel;
- }, getMemoOptions(table2.options, "debugTable", "getRowModel", () => table2._autoResetPageIndex()));
+ }, getMemoOptions(table.options, "debugTable", "getRowModel", () => table._autoResetPageIndex()));
}
function getExpandedRowModel() {
- return (table2) => memo2(() => [table2.getState().expanded, table2.getPreExpandedRowModel(), table2.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
+ return (table) => memo2(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
return rowModel;
}
@@ -105444,7 +105344,7 @@ function getExpandedRowModel() {
return rowModel;
}
return expandRows(rowModel);
- }, getMemoOptions(table2.options, "debugTable", "getExpandedRowModel"));
+ }, getMemoOptions(table.options, "debugTable", "getExpandedRowModel"));
}
function expandRows(rowModel) {
const expandedRows = [];
@@ -105463,11 +105363,11 @@ function expandRows(rowModel) {
};
}
function getGroupedRowModel() {
- return (table2) => memo2(() => [table2.getState().grouping, table2.getPreGroupedRowModel()], (grouping, rowModel) => {
+ return (table) => memo2(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
if (!rowModel.rows.length || !grouping.length) {
return rowModel;
}
- const existingGrouping = grouping.filter((columnId) => table2.getColumn(columnId));
+ const existingGrouping = grouping.filter((columnId) => table.getColumn(columnId));
const groupedFlatRows = [];
const groupedRowsById = {};
const groupUpRecursively = function(rows, depth, parentId) {
@@ -105487,13 +105387,13 @@ function getGroupedRowModel() {
}
const columnId = existingGrouping[depth];
const rowGroupsMap = groupBy(rows, columnId);
- const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index3) => {
+ const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index2) => {
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(table2, id3, leafRows[0].original, index3, depth, void 0, parentId);
+ const row2 = createRow2(table, id3, leafRows[0].original, index2, depth, void 0, parentId);
Object.assign(row2, {
groupingColumnId: columnId,
groupingValue,
@@ -105513,7 +105413,7 @@ function getGroupedRowModel() {
if (row2._groupingValuesCache.hasOwnProperty(columnId2)) {
return row2._groupingValuesCache[columnId2];
}
- const column2 = table2.getColumn(columnId2);
+ const column2 = table.getColumn(columnId2);
const aggregateFn = column2 == null ? void 0 : column2.getAggregationFn();
if (aggregateFn) {
row2._groupingValuesCache[columnId2] = aggregateFn(columnId2, leafRows, groupedRows2);
@@ -105539,28 +105439,28 @@ function getGroupedRowModel() {
flatRows: groupedFlatRows,
rowsById: groupedRowsById
};
- }, getMemoOptions(table2.options, "debugTable", "getGroupedRowModel", () => {
- table2._queue(() => {
- table2._autoResetExpanded();
- table2._autoResetPageIndex();
+ }, getMemoOptions(table.options, "debugTable", "getGroupedRowModel", () => {
+ table._queue(() => {
+ table._autoResetExpanded();
+ table._autoResetPageIndex();
});
}));
}
function groupBy(rows, columnId) {
const groupMap = /* @__PURE__ */ new Map();
- return rows.reduce((map6, row2) => {
+ return rows.reduce((map4, row2) => {
const resKey = `${row2.getGroupingValue(columnId)}`;
- const previous2 = map6.get(resKey);
- if (!previous2) {
- map6.set(resKey, [row2]);
+ const previous = map4.get(resKey);
+ if (!previous) {
+ map4.set(resKey, [row2]);
} else {
- previous2.push(row2);
+ previous.push(row2);
}
- return map6;
+ return map4;
}, groupMap);
}
function getPaginationRowModel(opts) {
- return (table2) => memo2(() => [table2.getState().pagination, table2.getPrePaginationRowModel(), table2.options.paginateExpandedRows ? void 0 : table2.getState().expanded], (pagination, rowModel) => {
+ return (table) => memo2(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => {
if (!rowModel.rows.length) {
return rowModel;
}
@@ -105577,7 +105477,7 @@ function getPaginationRowModel(opts) {
const pageEnd = pageStart + pageSize;
rows = rows.slice(pageStart, pageEnd);
let paginatedRowModel;
- if (!table2.options.paginateExpandedRows) {
+ if (!table.options.paginateExpandedRows) {
paginatedRowModel = expandRows({
rows,
flatRows,
@@ -105599,7 +105499,7 @@ function getPaginationRowModel(opts) {
};
paginatedRowModel.rows.forEach(handleRow);
return paginatedRowModel;
- }, getMemoOptions(table2.options, "debugTable", "getPaginationRowModel"));
+ }, getMemoOptions(table.options, "debugTable", "getPaginationRowModel"));
}
// node_modules/@tanstack/react-table/build/lib/index.mjs
@@ -105723,8 +105623,8 @@ var BooleanCell = (props) => {
var import_react52 = __toESM(require_react());
var ColorCell = (props) => {
const showMenu2 = (e5) => {
- const handleChangeComplete = (color3) => {
- props.saveValue(color3);
+ const handleChangeComplete = (color2) => {
+ props.saveValue(color2);
};
const offset2 = e5.target.getBoundingClientRect();
showColorPickerMenu(
@@ -105827,9 +105727,9 @@ var OptionCell = (props) => {
props.saveValue("");
}
};
- const removeOption = (option2) => {
- const newOptions = options.filter((f2) => f2.value != option2);
- const newValues = value.filter((f2) => f2 != option2);
+ const removeOption = (option) => {
+ const newOptions = options.filter((f2) => f2.value != option);
+ const newValues = value.filter((f2) => f2 != option);
setOptions(newOptions);
setValue(newValues);
if (props.multi) {
@@ -105878,20 +105778,20 @@ var OptionCell = (props) => {
savePropValue(newOptions, newValues);
}
};
- const saveOption = (option2, newValue) => {
- const newOptions = options.map((t5) => t5.value == option2 ? newValue : t5);
+ const saveOption = (option, newValue) => {
+ const newOptions = options.map((t5) => t5.value == option ? newValue : t5);
const newValues = value;
setOptions(newOptions);
setValue(newValues);
savePropValue(newOptions, newValues);
};
const showOptionMenu = (e5, optionValue) => {
- const option2 = options.find((f2) => f2.value == optionValue);
+ const option = options.find((f2) => f2.value == optionValue);
const menuOptions = [];
menuOptions.push(
menuInput(
- option2.value,
- (value2) => saveOption(option2.value, { ...option2, value: value2 })
+ option.value,
+ (value2) => saveOption(option.value, { ...option, value: value2 })
)
);
menuOptions.push(menuSeparator);
@@ -105899,7 +105799,7 @@ var OptionCell = (props) => {
name: "None",
color: "var(--mk-color-none)",
onClick: () => {
- saveOption(option2.value, { ...option2, color: "" });
+ saveOption(option.value, { ...option, color: "" });
}
});
colors.forEach((f2) => {
@@ -105908,7 +105808,7 @@ var OptionCell = (props) => {
value: f2[1],
color: `${f2[1]}`,
onClick: () => {
- saveOption(option2.value, { ...option2, color: f2[1] });
+ saveOption(option.value, { ...option, color: f2[1] });
}
});
});
@@ -105941,12 +105841,12 @@ var OptionCell = (props) => {
selectLabel: props.compactMode ? props.property.name : i18n_default.labels.select,
editMode: props.editMode,
labelElement: (_props) => {
- const color3 = options.find((f2) => f2.value == _props.value)?.color ?? "var(--mk-color-none)";
+ const color2 = options.find((f2) => f2.value == _props.value)?.color ?? "var(--mk-color-none)";
return /* @__PURE__ */ import_react53.default.createElement("div", {
className: "mk-cell-option-item",
style: {
- background: `${color3}`,
- color: color3 == "var(--mk-color-none)" ? "inherit" : "var(--mk-color-white)"
+ background: `${color2}`,
+ color: color2 == "var(--mk-color-none)" ? "inherit" : "var(--mk-color-white)"
}
}, _props.value, _props.children);
}
@@ -106321,12 +106221,12 @@ var ImageModal = (props) => {
className: "mk-input mk-input-large mk-border-bottom"
}), /* @__PURE__ */ import_react57.default.createElement("div", {
className: "mk-layout-masonry mk-padding-12 mk-layout-scroll"
- }, images.map((image3) => /* @__PURE__ */ import_react57.default.createElement("img", {
- key: image3.path,
- src: props.superstate.ui.getUIPath(image3.thumnail),
- className: selectedImage === image3.path ? "mk-selected" : "",
+ }, images.map((image) => /* @__PURE__ */ import_react57.default.createElement("img", {
+ key: image.path,
+ src: props.superstate.ui.getUIPath(image.thumnail),
+ className: selectedImage === image.path ? "mk-selected" : "",
onClick: () => {
- props.selectedPath(image3.path);
+ props.selectedPath(image.path);
props.hide();
}
}))));
@@ -106350,34 +106250,34 @@ var ImageCell = (props) => {
import_react58.default.useEffect(() => {
setValue(parseMultiString(initialValue));
}, [initialValue]);
- const deleteValue = (index3) => {
+ const deleteValue = (index2) => {
if (multi) {
const newValue = [...value];
- newValue.splice(index3, 1);
+ newValue.splice(index2, 1);
setValue(newValue);
props.saveValue(serializeMultiString(newValue));
} else {
props.saveValue("");
}
};
- const saveValue = (index3, image3) => {
+ const saveValue = (index2, image) => {
if (props.multi) {
- if (index3 == -1) {
- props.saveValue(serializeMultiString([...value, image3]));
+ if (index2 == -1) {
+ props.saveValue(serializeMultiString([...value, image]));
} else {
props.saveValue(
- serializeMultiString(value.map((f2, i4) => i4 == index3 ? image3 : f2))
+ serializeMultiString(value.map((f2, i4) => i4 == index2 ? image : f2))
);
}
} else {
- props.saveValue(image3);
+ props.saveValue(image);
}
};
- const showModal2 = (index3) => {
+ const showModal2 = (index2) => {
props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react58.default.createElement(ImageModal_default, {
superstate: props.superstate,
hide: _props.hide,
- selectedPath: (image3) => saveValue(index3, image3)
+ selectedPath: (image) => saveValue(index2, image)
}));
props.setEditMode(null);
};
@@ -106605,18 +106505,18 @@ var ObjectEditor = (props) => {
};
})
];
- const saveKey = (key3, newKey) => {
- if (key3 != newKey)
+ const saveKey = (key2, newKey) => {
+ if (key2 != newKey)
saveValue({
...value,
- [newKey]: value[key3],
- [key3]: void 0
+ [newKey]: value[key2],
+ [key2]: void 0
});
};
- const saveVal = (key3, val) => {
+ const saveVal = (key2, val) => {
saveValue({
...value,
- [key3]: val
+ [key2]: val
});
};
const showPropertyMenu2 = (e5, field) => {
@@ -106648,15 +106548,15 @@ var ObjectEditor = (props) => {
icon: "ui//trash",
onClick: (e6) => {
props.saveType(
- Object.keys(props.type ?? {}).reduce((p2, c3) => {
+ Object.keys(props.type ?? {}).reduce((p, c3) => {
if (c3 != field)
- return { ...p2, [c3]: props.type[c3] };
- return p2;
+ return { ...p, [c3]: props.type[c3] };
+ return p;
}, {}),
- Object.keys(value).reduce((p2, c3) => {
+ Object.keys(value).reduce((p, c3) => {
if (c3 != field)
- return { ...p2, [c3]: value[c3] };
- return p2;
+ return { ...p, [c3]: value[c3] };
+ return p;
}, {})
);
}
@@ -106720,10 +106620,10 @@ var ObjectCell = (props) => {
const saveType = (newType, _value) => {
if (props.multi) {
const newValues = value.map((f2) => ({
- ...Object.keys(newType).reduce((p2, c3) => {
+ ...Object.keys(newType).reduce((p, c3) => {
if (f2[c3])
- return { ...p2, [c3]: f2[c3] };
- return p2;
+ return { ...p, [c3]: f2[c3] };
+ return p;
}, {})
}));
props.savePropValue(
@@ -106740,73 +106640,73 @@ var ObjectCell = (props) => {
const saveValue = (newValue) => {
props.saveValue(JSON.stringify(newValue));
};
- const insertMultiValue = (index3) => {
- const item = Object.keys(type).reduce((p2, c3) => ({ ...p2, [c3]: "" }), {});
+ const insertMultiValue = (index2) => {
+ const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {});
props.saveValue(
- JSON.stringify([...value.slice(0, index3), item, ...value.slice(index3)])
+ JSON.stringify([...value.slice(0, index2), item, ...value.slice(index2)])
);
};
- const saveMultiValue = (newValue, index3) => {
- if (index3 >= value.length) {
+ const saveMultiValue = (newValue, index2) => {
+ if (index2 >= value.length) {
props.saveValue(JSON.stringify([...value, newValue]));
return;
}
props.saveValue(
JSON.stringify(
value.map(
- (f2, i4) => i4 == index3 ? newValue : f2
+ (f2, i4) => i4 == index2 ? newValue : f2
)
)
);
};
- const deleteMultiValue = (index3) => {
+ const deleteMultiValue = (index2) => {
props.saveValue(
JSON.stringify(
- value.filter((f2, i4) => i4 != index3)
+ value.filter((f2, i4) => i4 != index2)
)
);
};
- const newKey = (key3) => {
- if (key3)
+ const newKey = (key2) => {
+ if (key2)
saveValue({
...value,
- [key3]: ""
+ [key2]: ""
});
};
- const showPropertyMultiMenu = (e5, index3) => {
+ const showPropertyMultiMenu = (e5, index2) => {
const offset2 = e5.target.getBoundingClientRect();
const menuOptions = [];
menuOptions.push({
name: i18n_default.menu.insertAbove,
onClick: (e6) => {
- insertMultiValue(index3);
+ insertMultiValue(index2);
}
});
menuOptions.push({
name: i18n_default.menu.insertBelow,
onClick: (e6) => {
- insertMultiValue(index3 + 1);
+ insertMultiValue(index2 + 1);
}
});
menuOptions.push(menuSeparator);
- if (index3 > 0)
+ if (index2 > 0)
menuOptions.push({
name: i18n_default.menu.moveUp,
onClick: (e6) => {
props.saveValue(
JSON.stringify(
- arrayMove(value, index3, index3 - 1)
+ arrayMove(value, index2, index2 - 1)
)
);
}
});
- if (index3 < value.length - 1)
+ if (index2 < value.length - 1)
menuOptions.push({
name: i18n_default.menu.moveDown,
onClick: (e6) => {
props.saveValue(
JSON.stringify(
- arrayMove(value, index3, index3 + 1)
+ arrayMove(value, index2, index2 + 1)
)
);
}
@@ -106816,7 +106716,7 @@ var ObjectCell = (props) => {
name: i18n_default.buttons.delete,
icon: "ui//trash",
onClick: (e6) => {
- deleteMultiValue(index3);
+ deleteMultiValue(index2);
}
});
props.superstate.ui.openMenu(
@@ -106985,12 +106885,12 @@ var ObjectEditorModal = (props) => {
false
);
};
- const insertMultiValue = (index3) => {
+ const insertMultiValue = (index2) => {
const val = parseObject(value, props.property.type == "object-multi");
const type = parseFieldValue(fieldValue, props.property.type)?.type;
- const item = Object.keys(type).reduce((p2, c3) => ({ ...p2, [c3]: "" }), {});
+ const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {});
saveValue(
- JSON.stringify([...val.slice(0, index3), item, ...val.slice(index3)])
+ JSON.stringify([...val.slice(0, index2), item, ...val.slice(index2)])
);
};
return /* @__PURE__ */ import_react62.default.createElement("div", {
@@ -107020,8 +106920,8 @@ var ObjectEditorModal = (props) => {
saveValue: (v2) => {
saveValue(v2);
},
- savePropValue: (v2, p2) => {
- savePropValue(v2, p2);
+ savePropValue: (v2, p) => {
+ savePropValue(v2, p);
},
editMode: 5 /* EditModeAlways */
}), /* @__PURE__ */ import_react62.default.createElement("div", {
@@ -107086,11 +106986,11 @@ var PathCell = (props) => {
};
const newPath = async (file) => {
const pathName = file.path.replace(/\//g, "").replace(/\./g, "");
- const path3 = `${props.folder}/${pathName}.md`;
+ const path2 = `${props.folder}/${pathName}.md`;
if (pathName.length == 0) {
return;
}
- if (await pathExists(path3)) {
+ if (await pathExists(path2)) {
props.superstate.ui.notify(i18n_default.notice.fileExists);
} else {
await props.superstate.spaceManager.createItemAtPath(
@@ -107298,9 +107198,9 @@ var import_react67 = __toESM(require_react());
var import_react66 = __toESM(require_react());
var ParameterSetter = (props) => {
const [value, setValue] = (0, import_react66.useState)(props.value);
- const saveValue = (key3, val) => {
- setValue({ ...value, [key3]: val });
- props.saveValue(key3, val);
+ const saveValue = (key2, val) => {
+ setValue({ ...value, [key2]: val });
+ props.saveValue(key2, val);
};
const stackedProperty = (field) => {
return field.type.startsWith("object") || field.type == "super";
@@ -107350,14 +107250,14 @@ var SuperCell = (props) => {
let parsedValue;
try {
parsedValue = JSON.parse(value2);
- parsedValue = Object.keys(parsedValue).reduce((p2, c3) => {
+ parsedValue = Object.keys(parsedValue).reduce((p, c3) => {
if (typeof parsedValue[c3] === "object") {
- return { ...p2, [c3]: JSON.stringify(parsedValue[c3]) };
+ return { ...p, [c3]: JSON.stringify(parsedValue[c3]) };
}
if (typeof parsedValue[c3] === "string") {
- return { ...p2, [c3]: wrapQuotes(parsedValue[c3]) };
+ return { ...p, [c3]: wrapQuotes(parsedValue[c3]) };
}
- return { ...p2, [c3]: parsedValue[c3] };
+ return { ...p, [c3]: parsedValue[c3] };
}, {});
} catch (e5) {
console.log(e5);
@@ -107372,12 +107272,12 @@ var SuperCell = (props) => {
setValue(parseValue(unwrapParanthesis(props.initialValue)));
}, [props.initialValue]);
const specialStringify = (obj) => {
- return `{${Object.keys(obj ?? {}).map((key3) => `"${key3}": ${obj[key3]}`).join(",")}}`;
+ return `{${Object.keys(obj ?? {}).map((key2) => `"${key2}": ${obj[key2]}`).join(",")}}`;
};
- const saveValue = (key3, val) => {
- setValue({ ...value, [key3]: val });
+ const saveValue = (key2, val) => {
+ setValue({ ...value, [key2]: val });
const newValue = wrapParanthesis(
- specialStringify({ ...value, [key3]: val })
+ specialStringify({ ...value, [key2]: val })
);
props.saveValue(newValue);
};
@@ -107670,7 +107570,7 @@ var TableView = (props) => {
selectedRows,
selectRows,
sortedColumns: cols,
- filteredData: data3,
+ filteredData: data2,
predicate,
savePredicate,
updateFieldValue,
@@ -107709,53 +107609,53 @@ var TableView = (props) => {
),
[predicate]
);
- const newRow = (name317, index3, data4) => {
+ const newRow = (name317, index2, data3) => {
if (dbSchema?.id == defaultContextSchemaID) {
newPathInSpace(props.superstate, spaceCache, "md", name317, true);
} else {
saveDB(
createNewRow(
tableData,
- primaryCol ? { [primaryCol.name]: name317 ?? "", ...data4 ?? {} } : data4 ?? {},
- index3
+ primaryCol ? { [primaryCol.name]: name317 ?? "", ...data3 ?? {} } : data3 ?? {},
+ index2
)
);
}
};
- const toggleFlow = (path3) => {
+ const toggleFlow = (path2) => {
setOpenFlows(
- (f2) => f2.find((p2) => p2 == path3) ? f2.filter((p2) => p2 != path3) : uniq([...f2, path3])
+ (f2) => f2.find((p) => p == path2) ? f2.filter((p) => p != path2) : uniq([...f2, path2])
);
};
- const selectItem = (modifier, index3) => {
+ const selectItem = (modifier, index2) => {
if (modifier.metaKey) {
props.superstate.ui.openPath(
- tableData.rows[parseInt(index3)][PathPropertyName],
+ tableData.rows[parseInt(index2)][PathPropertyName],
false
);
return;
}
if (modifier.ctrlKey) {
- selectedRows.some((f2) => f2 == index3) ? selectRows(
+ selectedRows.some((f2) => f2 == index2) ? selectRows(
null,
- selectedRows.filter((f2) => f2 != index3)
- ) : selectRows(index3, uniq([...selectedRows, index3]));
+ selectedRows.filter((f2) => f2 != index2)
+ ) : selectRows(index2, uniq([...selectedRows, index2]));
} else if (modifier.shiftKey) {
selectRows(
- index3,
+ index2,
uniq([
...selectedRows,
...selectRange(
lastSelectedIndex,
- index3,
- data3.map((f2) => f2._index)
+ index2,
+ data2.map((f2) => f2._index)
)
])
);
} else {
- selectRows(index3, [index3]);
+ selectRows(index2, [index2]);
}
- setLastSelectedIndex(index3);
+ setLastSelectedIndex(index2);
};
const onKeyDown = (e5) => {
const setCellValue = (value) => {
@@ -107781,7 +107681,7 @@ var TableView = (props) => {
const nextRow = () => {
const newIndex = selectNextIndex(
lastSelectedIndex,
- data3.map((f2) => f2._index)
+ data2.map((f2) => f2._index)
);
selectRows(newIndex, [newIndex]);
setLastSelectedIndex(newIndex);
@@ -107789,7 +107689,7 @@ var TableView = (props) => {
const lastRow = () => {
const newIndex = selectPrevIndex(
lastSelectedIndex,
- data3.map((f2) => f2._index)
+ data2.map((f2) => f2._index)
);
selectRows(newIndex, [newIndex]);
setLastSelectedIndex(newIndex);
@@ -107861,19 +107761,19 @@ var TableView = (props) => {
},
cell: ({
getValue,
- row: { index: index3 },
+ row: { index: index2 },
column: { colId },
cell,
- table: table3
+ table: table2
}) => {
const initialValue = getValue();
- const rowIndex = parseInt(data3[index3]["_index"]);
- const tableIndex = parseInt(data3[index3]["_index"]);
+ const rowIndex = parseInt(data2[index2]["_index"]);
+ const tableIndex = parseInt(data2[index2]["_index"]);
const saveValue = (value) => {
setCurrentEdit(null);
setSelectedColumn(null);
if (initialValue != value)
- table3.options.meta?.updateData(
+ table2.options.meta?.updateData(
f2.name,
value,
f2.table,
@@ -107881,7 +107781,7 @@ var TableView = (props) => {
);
};
const saveFieldValue = (fieldValue, value) => {
- table3.options.meta?.updateFieldValue(
+ table2.options.meta?.updateFieldValue(
f2.name,
fieldValue,
value,
@@ -107899,9 +107799,9 @@ var TableView = (props) => {
setEditMode: setCurrentEdit,
column: f2,
editMode,
- row: data3[index3],
+ row: data2[index2],
contextTable,
- source: data3[index3][PathPropertyName]
+ source: data2[index2][PathPropertyName]
};
const fieldType = fieldTypeForType(f2.type, f2.name);
if (!fieldType) {
@@ -107923,24 +107823,24 @@ var TableView = (props) => {
}
]
],
- [cols, data3, currentEdit, predicate, dbSchema, contextTable]
+ [cols, data2, currentEdit, predicate, dbSchema, contextTable]
);
const groupBy2 = (0, import_react71.useMemo)(
() => predicate?.groupBy?.length > 0 && cols.find((f2) => f2.name + f2.table == predicate.groupBy[0]) ? predicate.groupBy : [],
[predicate, cols]
);
- const table2 = useReactTable({
- data: data3,
+ const table = useReactTable({
+ data: data2,
columns,
columnResizeMode: "onChange",
state: {
columnVisibility: predicate?.colsHidden.reduce(
- (p2, c3) => ({ ...p2, [c3]: false }),
+ (p, c3) => ({ ...p, [c3]: false }),
{}
),
columnOrder: predicate?.colsOrder,
columnSizing: {
- ...columns.reduce((p2, c3) => ({ ...p2, [c3.accessorKey]: 150 }), {}),
+ ...columns.reduce((p, c3) => ({ ...p, [c3.accessorKey]: 150 }), {}),
...colsSize
},
grouping: groupBy2,
@@ -107998,7 +107898,7 @@ var TableView = (props) => {
]
});
};
- const selectCell = (e5, index3, column2) => {
+ const selectCell = (e5, index2, column2) => {
if (isTouchScreen(props.superstate.ui) || column2 == "+")
return;
selectItem(
@@ -108008,12 +107908,12 @@ var TableView = (props) => {
altKey: e5.altKey,
shiftKey: e5.shiftKey
},
- data3[index3]["_index"]
+ data2[index2]["_index"]
);
setSelectedColumn(column2);
if (e5.detail === 1) {
} else if (e5.detail === 2) {
- setCurrentEdit([column2, data3[index3]["_index"]]);
+ setCurrentEdit([column2, data2[index2]["_index"]]);
}
};
function handleDragEnd({ active, over }) {
@@ -108050,7 +107950,7 @@ var TableView = (props) => {
onKeyDown
}, /* @__PURE__ */ import_react71.default.createElement("table", {
...{}
- }, /* @__PURE__ */ import_react71.default.createElement("thead", null, table2.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ import_react71.default.createElement("tr", {
+ }, /* @__PURE__ */ import_react71.default.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ import_react71.default.createElement("tr", {
key: headerGroup.id
}, /* @__PURE__ */ import_react71.default.createElement("th", null), headerGroup.headers.map((header) => /* @__PURE__ */ import_react71.default.createElement("th", {
className: "mk-th",
@@ -108081,13 +107981,13 @@ var TableView = (props) => {
onTouchStart: header.getResizeHandler(),
className: `mk-resizer ${header.column.getIsResizing() ? "isResizing" : ""}`
}
- })))))), /* @__PURE__ */ import_react71.default.createElement("tbody", null, table2.getRowModel().rows.map((row2) => /* @__PURE__ */ import_react71.default.createElement("tr", {
+ })))))), /* @__PURE__ */ import_react71.default.createElement("tbody", null, table.getRowModel().rows.map((row2) => /* @__PURE__ */ import_react71.default.createElement("tr", {
className: selectedRows?.some(
- (f2) => f2 == data3[row2.index]["_index"]
+ (f2) => f2 == data2[row2.index]["_index"]
) ? "mk-active" : void 0,
onContextMenu: (e5) => {
const rowIndex = parseInt(
- data3[row2.index]["_index"]
+ data2[row2.index]["_index"]
);
showRowContextMenu(
e5,
@@ -108135,10 +108035,10 @@ var TableView = (props) => {
cell.column.columnDef.cell,
cell.getContext()
))
- )))), /* @__PURE__ */ import_react71.default.createElement("tfoot", null, table2.getCanNextPage() && /* @__PURE__ */ import_react71.default.createElement("tr", null, /* @__PURE__ */ import_react71.default.createElement("th", {
+ )))), /* @__PURE__ */ import_react71.default.createElement("tfoot", null, table.getCanNextPage() && /* @__PURE__ */ import_react71.default.createElement("tr", null, /* @__PURE__ */ import_react71.default.createElement("th", {
className: "mk-row-new",
colSpan: cols.length + (readMode ? 1 : 2),
- onClick: () => table2.setPageSize(pagination.pageSize + 25)
+ onClick: () => table.setPageSize(pagination.pageSize + 25)
}, "Load More")), !readMode ? /* @__PURE__ */ import_react71.default.createElement("tr", null, /* @__PURE__ */ import_react71.default.createElement("th", {
className: "mk-row-new",
colSpan: cols.length + (readMode ? 1 : 2),
@@ -108227,15 +108127,15 @@ var DataPropertyView = (props) => {
false
);
};
- const insertMultiValue = (index3) => {
+ const insertMultiValue = (index2) => {
const type = parseFieldValue(props.column.value, props.column.type)?.type;
const value = parseObject(
props.initialValue ?? "",
props.column.type == "object-multi"
);
- const item = Object.keys(type).reduce((p2, c3) => ({ ...p2, [c3]: "" }), {});
+ const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {});
props.updateValue(
- JSON.stringify([...value.slice(0, index3), item, ...value.slice(index3)])
+ JSON.stringify([...value.slice(0, index2), item, ...value.slice(index2)])
);
};
return /* @__PURE__ */ import_react72.default.createElement(import_react72.default.Fragment, null, /* @__PURE__ */ import_react72.default.createElement("div", {
@@ -108346,7 +108246,7 @@ var EditPropertiesSubmenu = (props) => {
};
// src/core/react/components/UI/Menus/contexts/rowContextMenu.tsx
-var showRowContextMenu = (e5, superstate, contextPath, schema, index3) => {
+var showRowContextMenu = (e5, superstate, contextPath, schema, index2) => {
e5.preventDefault();
const context = superstate.contextsIndex.get(contextPath);
const dbSchema = context?.tables[schema]?.schema;
@@ -108354,7 +108254,7 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index3) => {
if (!context)
return;
if (dbSchema.primary == "true") {
- const row2 = rows.find((f2, i4) => i4 == index3);
+ const row2 = rows.find((f2, i4) => i4 == index2);
if (row2) {
if (superstate.spacesIndex.has(row2[PathPropertyName])) {
const pathState = superstate.pathsIndex.get(row2[PathPropertyName]);
@@ -108377,7 +108277,7 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index3) => {
pathState: superstate.pathsIndex.get(contextPath),
path: contextPath,
schema,
- index: index3
+ index: index2
};
menuOptions.push({
name: i18n_default.menu.editProperties,
@@ -108396,7 +108296,7 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index3) => {
name: i18n_default.menu.deleteRow,
icon: "ui//trash",
onClick: (e6) => {
- deleteRowInTable(superstate.spaceManager, context.space, schema, index3);
+ deleteRowInTable(superstate.spaceManager, context.space, schema, index2);
}
});
superstate.ui.openMenu(
@@ -108409,11 +108309,11 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index3) => {
var API = class {
constructor(superstate) {
this.frame = {
- update: (property, value, path3, saveState) => {
+ update: (property, value, path2, saveState) => {
if (property.startsWith("$contexts")) {
const { context, prop: prop2 } = parseContextNode(property);
if (context && prop2)
- this.context.update(context, path3, prop2, value);
+ this.context.update(context, path2, prop2, value);
} else {
const linkedNode = parseLinkedNode(property);
if (linkedNode.node && linkedNode.prop) {
@@ -108432,9 +108332,9 @@ var API = class {
color: (property, value) => {
if (property?.type?.includes("option")) {
const fields = parseFieldValue(property.value, property.type);
- const option2 = fields.options?.find((f2) => f2.value == value);
- if (option2?.color.length > 0)
- return option2.color;
+ const option = fields.options?.find((f2) => f2.value == value);
+ if (option?.color.length > 0)
+ return option.color;
}
return "var(--mk-ui-background-contrast)";
},
@@ -108446,35 +108346,35 @@ var API = class {
}
};
this.path = {
- label: (path3) => {
- return this.superstate.pathsIndex.get(path3)?.label;
+ label: (path2) => {
+ return this.superstate.pathsIndex.get(path2)?.label;
},
- open: (path3, target) => {
- this.superstate.ui.openPath(path3, target);
+ open: (path2, target) => {
+ this.superstate.ui.openPath(path2, target);
},
- create: (name317, space3, type, content5) => {
- if (content5 instanceof Promise) {
- return content5.then((c3) => {
- newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space3), type, name317, true, c3);
+ create: (name317, space2, type, content3) => {
+ if (content3 instanceof Promise) {
+ return content3.then((c3) => {
+ newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space2), type, name317, true, c3);
});
}
- return newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space3), type, name317, true, content5);
+ return newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space2), type, name317, true, content3);
},
- setProperty: (path3, property, value) => {
+ setProperty: (path2, property, value) => {
if (value instanceof Promise) {
value.then((v2) => {
- saveProperties(this.superstate, path3, {
+ saveProperties(this.superstate, path2, {
[property]: v2
});
});
return;
}
- saveProperties(this.superstate, path3, {
+ saveProperties(this.superstate, path2, {
[property]: value
});
},
- contextMenu: (e5, path3) => {
- showPathContextMenu(this.superstate, path3, null, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 });
+ contextMenu: (e5, path2) => {
+ showPathContextMenu(this.superstate, path2, null, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 });
}
};
this.commands = {
@@ -108489,79 +108389,79 @@ var API = class {
alert("Button actions have been upgraded, please rebind your buttons to use the new API.");
};
this.table = {
- select: (path3, table2) => {
- return this.superstate.spaceManager.readTable(path3, table2)?.then((f2) => f2?.rows);
+ select: (path2, table) => {
+ return this.superstate.spaceManager.readTable(path2, table)?.then((f2) => f2?.rows);
},
- update: (path3, table2, index3, row2) => {
- const space3 = this.superstate.spacesIndex.get(path3);
- if (space3)
- return updateTableRow(this.superstate.spaceManager, space3.space, table2, index3, row2);
+ update: (path2, table, index2, row2) => {
+ const space2 = this.superstate.spacesIndex.get(path2);
+ if (space2)
+ return updateTableRow(this.superstate.spaceManager, space2.space, table, index2, row2);
},
- insert: (path3, schema, row2) => {
+ insert: (path2, schema, row2) => {
if (schema == defaultContextSchemaID) {
- this.context.insert(path3, schema, row2[PathPropertyName], row2);
+ this.context.insert(path2, schema, row2[PathPropertyName], row2);
return;
}
- const space3 = this.superstate.spacesIndex.get(path3);
- if (space3)
- return addRowInTable(this.superstate.spaceManager, row2, space3.space, schema);
+ const space2 = this.superstate.spacesIndex.get(path2);
+ if (space2)
+ return addRowInTable(this.superstate.spaceManager, row2, space2.space, schema);
return Promise.resolve();
},
- create: (path3, table2, properties3) => {
+ create: (path2, table, properties3) => {
const newSchema = {
- id: sanitizeTableName(table2),
- name: table2,
+ id: sanitizeTableName(table),
+ name: table,
type: "db"
};
this.superstate.spaceManager.createTable(
- path3,
+ path2,
newSchema
);
},
- open: (space3, table2, index3, target) => {
- const context = this.superstate.contextsIndex.get(space3);
- if (table2 == defaultContextSchemaID) {
- const path3 = context?.tables[table2]?.rows[index3]?.[PathPropertyName];
- this.superstate.ui.openPath(path3, target);
+ open: (space2, table, index2, target) => {
+ const context = this.superstate.contextsIndex.get(space2);
+ if (table == defaultContextSchemaID) {
+ const path2 = context?.tables[table]?.rows[index2]?.[PathPropertyName];
+ this.superstate.ui.openPath(path2, target);
} else {
}
},
- contextMenu: (e5, space3, table2, index3) => {
- const context = this.superstate.contextsIndex.get(space3);
- if (table2 == defaultContextSchemaID) {
- const path3 = context?.tables[table2]?.rows[index3]?.[PathPropertyName];
- showPathContextMenu(this.superstate, path3, space3, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 });
+ contextMenu: (e5, space2, table, index2) => {
+ const context = this.superstate.contextsIndex.get(space2);
+ if (table == defaultContextSchemaID) {
+ const path2 = context?.tables[table]?.rows[index2]?.[PathPropertyName];
+ showPathContextMenu(this.superstate, path2, space2, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 });
} else {
- showRowContextMenu(e5, this.superstate, space3, table2, index3);
+ showRowContextMenu(e5, this.superstate, space2, table, index2);
}
}
};
this.context = {
- select: (path3, table2) => {
- return this.superstate.contextsIndex.get(path3)?.tables[table2]?.rows;
+ select: (path2, table) => {
+ return this.superstate.contextsIndex.get(path2)?.tables[table]?.rows;
},
- update: (path3, file, field, value) => {
- const space3 = this.superstate.spacesIndex.get(path3);
- if (space3)
- updateValueInContext(this.superstate.spaceManager, file, field, value, space3.space);
+ update: (path2, file, field, value) => {
+ const space2 = this.superstate.spacesIndex.get(path2);
+ if (space2)
+ updateValueInContext(this.superstate.spaceManager, file, field, value, space2.space);
},
- insert: (path3, schema, name317, row2) => {
+ insert: (path2, schema, name317, row2) => {
if (schema == defaultContextSchemaID) {
- newPathInSpace(this.superstate, this.superstate.spacesIndex.get(path3), "md", name317, true).then((f2) => {
+ newPathInSpace(this.superstate, this.superstate.spacesIndex.get(path2), "md", name317, true).then((f2) => {
if (row2)
saveProperties(this.superstate, f2, {
...row2
});
});
} else {
- const table2 = this.superstate.contextsIndex.get(path3)?.tables?.[schema];
- if (table2) {
- const prop2 = table2.cols.find((f2) => f2.primary == "true");
+ const table = this.superstate.contextsIndex.get(path2)?.tables?.[schema];
+ if (table) {
+ const prop2 = table.cols.find((f2) => f2.primary == "true");
const newRow = prop2 ? {
...row2,
[prop2.name]: name317
} : row2;
- this.table.insert(path3, schema, newRow);
+ this.table.insert(path2, schema, newRow);
}
}
}
@@ -108625,8 +108525,8 @@ var _IndexMap = class {
this.map = /* @__PURE__ */ new Map();
this.invMap = /* @__PURE__ */ new Map();
}
- get(key3) {
- const result = this.map.get(key3);
+ get(key2) {
+ const result = this.map.get(key2);
if (result) {
return new Set(result);
} else {
@@ -108636,65 +108536,65 @@ var _IndexMap = class {
getInverse(value) {
return this.invMap.get(value) || _IndexMap.EMPTY_SET;
}
- set(key3, values2) {
+ set(key2, values2) {
if (!values2.size) {
- this.delete(key3);
+ this.delete(key2);
return this;
}
- const oldValues = this.map.get(key3);
+ const oldValues = this.map.get(key2);
if (oldValues) {
for (const value of oldValues) {
- if (!values2.has(key3))
- this.invMap.get(value)?.delete(key3);
+ if (!values2.has(key2))
+ this.invMap.get(value)?.delete(key2);
}
}
- this.map.set(key3, values2);
+ this.map.set(key2, values2);
for (const value of values2) {
if (!this.invMap.has(value))
- this.invMap.set(value, /* @__PURE__ */ new Set([key3]));
+ this.invMap.set(value, /* @__PURE__ */ new Set([key2]));
else
- this.invMap.get(value)?.add(key3);
+ this.invMap.get(value)?.add(key2);
}
return this;
}
- setInverse(key3, values2) {
+ setInverse(key2, values2) {
if (!values2.size) {
- this.deleteInverse(key3);
+ this.deleteInverse(key2);
return this;
}
- const oldValues = this.invMap.get(key3);
+ const oldValues = this.invMap.get(key2);
if (oldValues) {
for (const value of oldValues) {
- if (!values2.has(key3))
- this.map.get(value)?.delete(key3);
+ if (!values2.has(key2))
+ this.map.get(value)?.delete(key2);
}
}
- this.invMap.set(key3, values2);
+ this.invMap.set(key2, values2);
for (const value of values2) {
if (!this.map.has(value))
- this.map.set(value, /* @__PURE__ */ new Set([key3]));
+ this.map.set(value, /* @__PURE__ */ new Set([key2]));
else
- this.map.get(value)?.add(key3);
+ this.map.get(value)?.add(key2);
}
return this;
}
- delete(key3) {
- const oldValues = this.map.get(key3);
+ delete(key2) {
+ const oldValues = this.map.get(key2);
if (!oldValues)
return false;
- this.map.delete(key3);
+ this.map.delete(key2);
for (const value of oldValues) {
- this.invMap.get(value)?.delete(key3);
+ this.invMap.get(value)?.delete(key2);
}
return true;
}
- deleteInverse(key3) {
- const oldValues = this.invMap.get(key3);
+ deleteInverse(key2) {
+ const oldValues = this.invMap.get(key2);
if (!oldValues)
return false;
- this.invMap.delete(key3);
+ this.invMap.delete(key2);
for (const value of oldValues) {
- this.map.get(value)?.delete(key3);
+ this.map.get(value)?.delete(key2);
}
return true;
}
@@ -108724,8 +108624,8 @@ IndexMap.EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
// src/core/utils/spaces/query.ts
var filterPathsForAny = (paths, filters, props) => {
- const newArray = filters.reduce((p2, c3) => {
- const [result, remaining] = p2;
+ const newArray = filters.reduce((p, c3) => {
+ const [result, remaining] = p;
const filteredPaths = c3.type == "context" ? filterContext(remaining, c3, props) : c3.type == "path" ? filterPathCache(remaining, c3, props) : c3.type == "frontmatter" ? filterFM(remaining, c3, props) : filterPathProperties(remaining, c3, props);
const diffArray = remaining.filter((x2) => !filteredPaths.includes(x2));
return [[...result, ...filteredPaths], diffArray];
@@ -108733,8 +108633,8 @@ var filterPathsForAny = (paths, filters, props) => {
return newArray[0];
};
var filterPathsForAll2 = (paths, filters, props) => {
- return filters.reduce((p2, c3) => {
- return c3.type == "context" ? filterContext(p2, c3, props) : c3.type == "path" ? filterPathCache(p2, c3, props) : c3.type == "frontmatter" ? filterFM(p2, c3, props) : filterPathProperties(p2, c3, props);
+ return filters.reduce((p, c3) => {
+ return c3.type == "context" ? filterContext(p, c3, props) : c3.type == "path" ? filterPathCache(p, c3, props) : c3.type == "frontmatter" ? filterFM(p, c3, props) : filterPathProperties(p, c3, props);
}, paths);
};
var filterContext = (paths, def, props) => {
@@ -108812,11 +108712,11 @@ var filterPathProperties = (paths, def, props) => {
return result;
});
};
-var pathByDef = (filters, path3, props) => {
- const pathInFilter = filters.reduce((p2, c3) => {
- if (!p2 || c3.filters.length == 0)
+var pathByDef = (filters, path2, props) => {
+ const pathInFilter = filters.reduce((p, c3) => {
+ if (!p || c3.filters.length == 0)
return false;
- const result = c3.type == "any" ? filterPathsForAny([path3], c3.filters, props).length > 0 : filterPathsForAll2([path3], c3.filters, props).length > 0;
+ const result = c3.type == "any" ? filterPathsForAny([path2], c3.filters, props).length > 0 : filterPathsForAll2([path2], c3.filters, props).length > 0;
return result;
}, true);
return pathInFilter;
@@ -111210,7 +111110,7 @@ var SpacesCommandsAdapter = class {
if (command.schema.type == "script")
result = executeCode(command.code, instance.instanceProps);
if (command.schema.type == "formula")
- result = runFormulaWithContext(this.superstate.formulaContext, this.superstate.pathsIndex, command.code, command.fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}), instance.instanceProps);
+ result = runFormulaWithContext(this.superstate.formulaContext, this.superstate.pathsIndex, command.code, command.fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}), instance.instanceProps);
} catch (e5) {
error = e5;
}
@@ -111235,55 +111135,55 @@ var propertyDependencies = (fields) => {
localDependencies.push(...deps);
} catch (e5) {
}
- const key3 = f2.name;
- if (!graph.has(key3)) {
- graph.set(key3, /* @__PURE__ */ new Set());
+ const key2 = f2.name;
+ if (!graph.has(key2)) {
+ graph.set(key2, /* @__PURE__ */ new Set());
}
for (const dep of localDependencies) {
const depStr = dep;
- if (depStr === key3)
+ if (depStr === key2)
continue;
- graph.get(key3).add(depStr);
+ graph.get(key2).add(depStr);
}
});
const visited = /* @__PURE__ */ new Set();
const result = [];
const temp = /* @__PURE__ */ new Set();
- const visit2 = (key3) => {
- if (temp.has(key3))
+ const visit = (key2) => {
+ if (temp.has(key2))
throw new Error("Circular dependency detected");
- if (!visited.has(key3)) {
- temp.add(key3);
- const edges = graph.get(key3) || /* @__PURE__ */ new Set();
+ if (!visited.has(key2)) {
+ temp.add(key2);
+ const edges = graph.get(key2) || /* @__PURE__ */ new Set();
for (const dep of edges) {
- visit2(dep);
+ visit(dep);
}
- visited.add(key3);
- temp.delete(key3);
- result.push(key3);
+ visited.add(key2);
+ temp.delete(key2);
+ result.push(key2);
}
};
- for (const key3 of fields) {
- if (!visited.has(key3.name)) {
- visit2(key3.name);
+ for (const key2 of fields) {
+ if (!visited.has(key2.name)) {
+ visit(key2.name);
}
}
return result;
};
-var linkContextRow = (runContext, paths, row2, fields, path3, dependencies314) => {
+var linkContextRow = (runContext, paths, row2, fields, path2, dependencies314) => {
if (!row2)
return {};
const result = dependencies314 ?? propertyDependencies(fields);
const frontmatter = paths.get(row2[PathPropertyName])?.metadata?.property ?? {};
- const filteredFrontmatter = Object.keys(frontmatter).filter((f2) => fields.some((g) => g.name == f2)).reduce((p2, c3) => ({ ...p2, [c3]: parseProperty(c3, frontmatter[c3]) }), {});
+ const filteredFrontmatter = Object.keys(frontmatter).filter((f2) => fields.some((g) => g.name == f2)).reduce((p, c3) => ({ ...p, [c3]: parseProperty(c3, frontmatter[c3]) }), {});
const fieldsSorted = result.map((f2) => fields.find((g) => g.name == f2)).filter((f2) => f2 && (f2.type == "fileprop" || f2.name == "tags"));
- const properties3 = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {});
+ const properties3 = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {});
return {
...row2,
...filteredFrontmatter,
- ...fieldsSorted.reduce((p2, c3) => {
+ ...fieldsSorted.reduce((p, c3) => {
const { value } = parseFieldValue(c3.value, c3.type);
- return { ...p2, [c3.name]: runFormulaWithContext(runContext, paths, value, properties3, { ...row2, ...p2 }, path3) };
+ return { ...p, [c3.name]: runFormulaWithContext(runContext, paths, value, properties3, { ...row2, ...p }, path2) };
}, {})
};
};
@@ -111577,9 +111477,9 @@ var Indexer = class {
this.reloadQueue = [];
this.reloadSet = /* @__PURE__ */ new Set();
this.callbacks = /* @__PURE__ */ new Map();
- 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);
+ 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);
this.workers.push(worker);
this.busy.push(false);
}
@@ -111603,21 +111503,21 @@ var Indexer = class {
}
return promise;
}
- finish(jerb, data3, index3) {
+ finish(jerb, data2, index2) {
const jobKey = stringifyJob(jerb);
const calls = [].concat(this.callbacks.get(jobKey) ?? []);
this.reloadSet.delete(jobKey);
this.callbacks.delete(jobKey);
- this.busy[index3] = false;
+ this.busy[index2] = false;
const job = this.reloadQueue.shift();
if (job !== void 0)
- this.send(job, index3);
- if ("$error" in data3) {
+ this.send(job, index2);
+ if ("$error" in data2) {
for (const [_15, reject] of calls)
- reject(data3["$error"]);
+ reject(data2["$error"]);
} else {
for (const [callback, _15] of calls)
- callback(data3);
+ callback(data2);
}
}
async send(job, workerId) {
@@ -111662,12 +111562,12 @@ var Indexer = class {
return;
}
if (job.type == "context") {
- const space3 = this.cache.spacesIndex.get(job.path)?.space;
- if (!space3 || !space3.path) {
+ const space2 = this.cache.spacesIndex.get(job.path)?.space;
+ if (!space2 || !space2.path) {
this.message(workerId, {
job,
payload: {
- space: space3,
+ space: space2,
mdb: null,
paths: [...this.cache.spacesMap.getInverse(job.path)],
oldCache: this.cache.contextsIndex.get(job.path),
@@ -111677,12 +111577,12 @@ var Indexer = class {
this.busy[workerId] = true;
return;
}
- const dbExists = await this.cache.spaceManager.contextInitiated(space3.path);
- this.cache.spaceManager.readAllTables(space3.path).then((mdb) => {
+ const dbExists = await this.cache.spaceManager.contextInitiated(space2.path);
+ this.cache.spaceManager.readAllTables(space2.path).then((mdb) => {
this.message(workerId, {
job,
payload: {
- space: space3,
+ space: space2,
mdb,
paths: [...this.cache.spacesMap.getInverse(job.path)],
oldCache: this.cache.contextsIndex.get(job.path),
@@ -111697,16 +111597,16 @@ var Indexer = class {
if (job.type == "contexts") {
const spaces2 = this.cache.allSpaces().filter((f2) => f2.type != "default").map((f2) => f2.space);
const payloads = /* @__PURE__ */ new Map();
- for (const space3 of spaces2) {
- const dbExists = await this.cache.spaceManager.contextInitiated(space3.path);
- await this.cache.spaceManager.readAllTables(space3.path).then((mdb) => {
+ for (const space2 of spaces2) {
+ const dbExists = await this.cache.spaceManager.contextInitiated(space2.path);
+ await this.cache.spaceManager.readAllTables(space2.path).then((mdb) => {
payloads.set(
- space3.path,
+ space2.path,
{
- space: space3,
+ space: space2,
mdb,
- paths: [...this.cache.spacesMap.getInverse(space3.path)],
- oldCache: this.cache.contextsIndex.get(space3.path),
+ paths: [...this.cache.spacesMap.getInverse(space2.path)],
+ oldCache: this.cache.contextsIndex.get(space2.path),
dbExists
}
);
@@ -111722,12 +111622,12 @@ var Indexer = class {
this.busy[workerId] = true;
}
if (job.type == "frames") {
- const space3 = this.cache.spacesIndex.get(job.path)?.space;
- if (!space3) {
+ const space2 = this.cache.spacesIndex.get(job.path)?.space;
+ if (!space2) {
this.message(workerId, {
job,
payload: {
- space: space3,
+ space: space2,
mdb: null,
oldCache: this.cache.framesIndex.get(job.path)
}
@@ -111735,11 +111635,11 @@ var Indexer = class {
this.busy[workerId] = true;
return;
}
- this.cache.spaceManager.readAllFrames(space3.path).then((mdb) => {
+ this.cache.spaceManager.readAllFrames(space2.path).then((mdb) => {
this.message(workerId, {
job,
payload: {
- space: space3,
+ space: space2,
mdb,
oldCache: this.cache.framesIndex.get(job.path)
}
@@ -111755,8 +111655,8 @@ var Indexer = class {
);
}
nextAvailableWorker() {
- const index3 = this.busy.indexOf(false);
- return index3 == -1 ? void 0 : index3;
+ const index2 = this.busy.indexOf(false);
+ return index2 == -1 ? void 0 : index2;
}
};
@@ -111775,9 +111675,9 @@ var Searcher = class {
this.reloadQueue = [];
this.reloadSet = /* @__PURE__ */ new Set();
this.callbacks = /* @__PURE__ */ new Map();
- 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);
+ 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);
this.workers.push(worker);
this.busy.push(false);
}
@@ -111801,21 +111701,21 @@ var Searcher = class {
}
return promise;
}
- finish(jerb, data3, index3) {
+ finish(jerb, data2, index2) {
const jobKey = stringifyJob(jerb);
const calls = [].concat(this.callbacks.get(jobKey) ?? []);
this.reloadSet.delete(jobKey);
this.callbacks.delete(jobKey);
- this.busy[index3] = false;
+ this.busy[index2] = false;
const job = this.reloadQueue.shift();
if (job !== void 0)
- this.send(job, index3);
- if ("$error" in data3) {
+ this.send(job, index2);
+ if ("$error" in data2) {
for (const [_15, reject] of calls)
- reject(data3["$error"]);
+ reject(data2["$error"]);
} else {
for (const [callback, _15] of calls)
- callback(data3);
+ callback(data2);
}
}
async send(job, workerId) {
@@ -111837,8 +111737,8 @@ var Searcher = class {
);
}
nextAvailableWorker() {
- const index3 = this.busy.indexOf(false);
- return index3 == -1 ? void 0 : index3;
+ const index2 = this.busy.indexOf(false);
+ return index2 == -1 ? void 0 : index2;
}
};
@@ -111881,13 +111781,13 @@ var Superstate10 = class {
columnView
];
this.eventsDispatcher = new EventDispatcher();
- const all6 = {
+ const all2 = {
...all,
createAdd: factory("add", [], () => function add4(a4, b2) {
return a4 + b2;
})
};
- const runContext = create(all6);
+ const runContext = create(all2);
runContext.import(formulas, { override: true });
this.formulaContext = runContext;
this.initialized = false;
@@ -112022,7 +111922,7 @@ var Superstate10 = class {
}
async initializeContexts() {
await this.indexer.reload({ type: "contexts", path: "" }).then(async (r2) => {
- const promises = [...r2.entries()].map(([path3, { cache: cache2, changed }]) => this.contextReloaded(path3, cache2, changed));
+ const promises = [...r2.entries()].map(([path2, { cache: cache2, changed }]) => this.contextReloaded(path2, cache2, changed));
await Promise.all(promises);
});
}
@@ -112034,8 +111934,8 @@ var Superstate10 = class {
this.addToContextStateQueue(() => removePathsInContext(this.spaceManager, removeFiles.map((f2) => f2[PathPropertyName]), this.spacesIndex.get(context.path).space).then((f2) => this.reloadSpaceByPath(context.path)));
}
});
- this.spacesIndex.forEach((space3) => {
- const removeFiles = [...this.spacesMap.getInverse(space3.path)];
+ this.spacesIndex.forEach((space2) => {
+ const removeFiles = [...this.spacesMap.getInverse(space2.path)];
});
}
async loadFromCache() {
@@ -112053,21 +111953,21 @@ var Superstate10 = class {
const allContexts = await this.persister.loadAll("context");
const allFrames = await this.persister.loadAll("frame");
allSpaces.forEach((s4) => {
- const space3 = safelyParseJSON(s4.cache);
- if (space3 && space3.type) {
- this.spacesIndex.set(s4.path, space3);
+ const space2 = safelyParseJSON(s4.cache);
+ if (space2 && space2.type) {
+ this.spacesIndex.set(s4.path, space2);
}
});
allContexts.forEach((s4) => {
- const space3 = safelyParseJSON(s4.cache);
- if (space3) {
- this.contextsIndex.set(s4.path, space3);
+ const space2 = safelyParseJSON(s4.cache);
+ if (space2) {
+ this.contextsIndex.set(s4.path, space2);
}
});
allFrames.forEach((s4) => {
- const space3 = safelyParseJSON(s4.cache);
- if (space3) {
- this.framesIndex.set(s4.path, space3);
+ const space2 = safelyParseJSON(s4.cache);
+ if (space2) {
+ this.framesIndex.set(s4.path, space2);
}
});
allPaths.forEach((f2) => {
@@ -112087,17 +111987,17 @@ var Superstate10 = class {
const promises = [tagsSpacePath, ...allTags].map((l2) => this.reloadPath(l2, true));
await Promise.all(promises);
}
- async onSpaceDefinitionChanged(space3, oldDef) {
- const currentPaths = this.spacesMap.getInverse(space3.path);
+ async onSpaceDefinitionChanged(space2, oldDef) {
+ const currentPaths = this.spacesMap.getInverse(space2.path);
const newPaths = [];
- if (space3.metadata?.links && !import_lodash12.default.isEqual(space3.metadata.links, oldDef?.links)) {
- newPaths.push(...space3.metadata.links);
+ if (space2.metadata?.links && !import_lodash12.default.isEqual(space2.metadata.links, oldDef?.links)) {
+ newPaths.push(...space2.metadata.links);
}
- if (space3.metadata?.filters) {
- const hasProps = space3.metadata.filters.some((f2) => f2.filters.some((g) => g.fType == "property"));
- if (!import_lodash12.default.isEqual(space3.metadata?.filters, oldDef?.filters) || hasProps) {
+ if (space2.metadata?.filters) {
+ const hasProps = space2.metadata.filters.some((f2) => f2.filters.some((g) => g.fType == "property"));
+ if (!import_lodash12.default.isEqual(space2.metadata?.filters, oldDef?.filters) || hasProps) {
for (const [k2, f2] of this.pathsIndex) {
- if (!f2.hidden && pathByDef(space3.metadata?.filters, f2, space3.properties)) {
+ if (!f2.hidden && pathByDef(space2.metadata?.filters, f2, space2.properties)) {
newPaths.push(k2);
}
}
@@ -112126,8 +112026,8 @@ var Superstate10 = class {
const allFiles = this.spaceManager.allPaths();
const start = Date.now();
await this.indexer.reload({ type: "paths", path: "" }).then(async (r2) => {
- for await (const [path3, { cache: cache2, changed }] of Object.entries(r2)) {
- await this.pathReloaded(path3, cache2, changed, false);
+ for await (const [path2, { cache: cache2, changed }] of Object.entries(r2)) {
+ await this.pathReloaded(path2, cache2, changed, false);
}
});
this.ui.notify(`Make.md - ${allFiles.length} Paths Cached in ${(Date.now() - start) / 1e3} seconds`, "console");
@@ -112154,8 +112054,8 @@ var Superstate10 = class {
this.dispatchEvent("spaceStateUpdated", { path: "spaces://$tags" });
}
async onTagDeleted(tag2) {
- this.tagsMap.getInverse(tag2).forEach((path3) => {
- this.deleteTagInPath(tag2, path3);
+ this.tagsMap.getInverse(tag2).forEach((path2) => {
+ this.deleteTagInPath(tag2, path2);
});
const spacePath = folderForTagSpace(tag2, this.settings);
await this.spaceManager.deletePath(spacePath);
@@ -112174,10 +112074,10 @@ var Superstate10 = class {
this.addToContextStateQueue(() => removeTagInContexts(this.spaceManager, tag2, allContextsWithTag));
this.dispatchEvent("spaceStateUpdated", { path: "spaces://$tags" });
}
- async deleteTagInPath(tag2, path3) {
+ async deleteTagInPath(tag2, path2) {
let oldMetadata;
- if (this.pathsIndex.has(path3)) {
- oldMetadata = this.pathsIndex.get(path3);
+ if (this.pathsIndex.has(path2)) {
+ oldMetadata = this.pathsIndex.get(path2);
}
if (oldMetadata) {
const newMetadata = {
@@ -112185,38 +112085,38 @@ var Superstate10 = class {
tags: oldMetadata.tags.filter((f2) => f2 != tag2),
spaces: oldMetadata.spaces.filter((f2) => f2 != tagSpacePathFromTag(tag2))
};
- this.pathsIndex.set(path3, newMetadata);
- this.tagsMap.set(path3, new Set(newMetadata.tags));
- this.spacesMap.set(path3, new Set(newMetadata.spaces));
+ this.pathsIndex.set(path2, newMetadata);
+ this.tagsMap.set(path2, new Set(newMetadata.tags));
+ this.spacesMap.set(path2, new Set(newMetadata.spaces));
} else {
- await this.reloadPath(path3);
+ await this.reloadPath(path2);
}
- this.onPathReloaded(path3);
- this.dispatchEvent("pathStateUpdated", { path: path3 });
+ this.onPathReloaded(path2);
+ this.dispatchEvent("pathStateUpdated", { path: path2 });
}
- onMetadataChange(path3) {
- if (!this.pathsIndex.has(path3)) {
+ onMetadataChange(path2) {
+ if (!this.pathsIndex.has(path2)) {
return;
}
- this.reloadPath(path3).then(
+ this.reloadPath(path2).then(
(f2) => {
- const pathState = this.pathsIndex.get(path3);
- const spaceState = this.spacesIndex.get(path3);
+ const pathState = this.pathsIndex.get(path2);
+ const spaceState = this.spacesIndex.get(path2);
if (spaceState) {
this.reloadSpace(spaceState.space).then((f3) => this.onSpaceDefinitionChanged(f3, spaceState.metadata));
}
const allContextsWithFile = pathState.spaces.map((f3) => this.spacesIndex.get(f3)?.space).filter((f3) => f3);
- this.addToContextStateQueue(() => updateContextWithProperties(this, path3, allContextsWithFile).then(() => {
+ this.addToContextStateQueue(() => updateContextWithProperties(this, path2, allContextsWithFile).then(() => {
allContextsWithFile.forEach((f3) => {
this.dispatchEvent("contextStateUpdated", { path: f3.path });
});
}));
- this.dispatchEvent("pathStateUpdated", { path: path3 });
+ this.dispatchEvent("pathStateUpdated", { path: path2 });
}
);
}
- reloadSpaceByPath(path3, metadata) {
- return this.reloadSpace(this.spaceManager.spaceInfoForPath(path3), metadata);
+ reloadSpaceByPath(path2, metadata) {
+ return this.reloadSpace(this.spaceManager.spaceInfoForPath(path2), metadata);
}
async onPathRename(oldPath, newPath) {
const newFilePath = newPath;
@@ -112230,11 +112130,11 @@ var Superstate10 = class {
this.pathsIndex.delete(oldPath);
const allContextsWithPath = oldSpaces.map((f2) => this.spacesIndex.get(f2)).filter((f2) => f2);
await renamePathInContexts(this.spaceManager, oldPath, newFilePath, allContextsWithPath.map((f2) => f2.space));
- for (const space3 of allContextsWithPath) {
- if (space3.metadata?.links?.includes(oldPath)) {
- this.addToContextStateQueue(() => saveSpaceMetadataValue(this, space3.path, "links", space3.metadata.links.map((f2) => f2 == oldPath ? newPath : f2)));
+ for (const space2 of allContextsWithPath) {
+ if (space2.metadata?.links?.includes(oldPath)) {
+ this.addToContextStateQueue(() => saveSpaceMetadataValue(this, space2.path, "links", space2.metadata.links.map((f2) => f2 == oldPath ? newPath : f2)));
}
- await this.reloadContext(space3.space);
+ await this.reloadContext(space2.space);
}
const allContextsWithLink = [];
for (const [contextPath, contextCache] of this.contextsIndex) {
@@ -112259,37 +112159,37 @@ var Superstate10 = class {
view.openPath(newPath);
});
}
- async onPathCreated(path3) {
- await this.reloadPath(path3, true);
- const parent = getParentPathFromString(path3);
- if (this.spacesIndex.has(parent) && this.spacesIndex.get(parent).defPath == path3) {
+ async onPathCreated(path2) {
+ await this.reloadPath(path2, true);
+ const parent = getParentPathFromString(path2);
+ if (this.spacesIndex.has(parent) && this.spacesIndex.get(parent).defPath == path2) {
await this.reloadSpace(this.spacesIndex.get(parent).space);
}
- this.dispatchEvent("pathCreated", { path: path3 });
+ this.dispatchEvent("pathCreated", { path: path2 });
}
- onPathDeleted(path3) {
- this.spacesMap.delete(path3);
- this.linksMap.delete(path3);
- this.linksMap.deleteInverse(path3);
- this.persister.remove(path3, "path");
- const fileCache = this.pathsIndex.get(path3);
+ onPathDeleted(path2) {
+ this.spacesMap.delete(path2);
+ this.linksMap.delete(path2);
+ this.linksMap.deleteInverse(path2);
+ this.persister.remove(path2, "path");
+ const fileCache = this.pathsIndex.get(path2);
if (!fileCache) {
return;
}
const allContextsWithFile = (fileCache.spaces ?? []).map((f2) => this.spacesIndex.get(f2)?.space).filter((f2) => f2);
- this.addToContextStateQueue(() => removePathInContexts(this.spaceManager, path3, allContextsWithFile).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3))));
+ this.addToContextStateQueue(() => removePathInContexts(this.spaceManager, path2, allContextsWithFile).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3))));
const allContextsWithLink = [];
for (const [contextPath, contextCache] of this.contextsIndex) {
- if (contextCache.outlinks.includes(path3) && this.spacesIndex.has(contextCache.path)) {
+ if (contextCache.outlinks.includes(path2) && this.spacesIndex.has(contextCache.path)) {
allContextsWithLink.push(this.spacesIndex.get(contextCache.path).space);
}
}
- this.addToContextStateQueue(() => removeLinkInContexts(this.spaceManager, path3, allContextsWithLink).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3))));
+ this.addToContextStateQueue(() => removeLinkInContexts(this.spaceManager, path2, allContextsWithLink).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3))));
(fileCache.spaces ?? []).forEach((f2) => {
this.dispatchEvent("spaceStateUpdated", { path: f2 });
});
- this.pathsIndex.delete(path3);
- this.dispatchEvent("pathDeleted", { path: path3 });
+ this.pathsIndex.delete(path2);
+ this.dispatchEvent("pathDeleted", { path: path2 });
}
async onSpaceRenamed(oldPath, newSpaceInfo) {
if (this.spacesIndex.has(oldPath)) {
@@ -112313,60 +112213,60 @@ var Superstate10 = class {
await this.reloadFrames(newSpaceInfo).then((f2) => this.dispatchEvent("frameStateUpdated", { path: newSpaceInfo.path }));
}
}
- onSpaceDeleted(space3) {
- if (this.spacesIndex.has(space3)) {
- this.spacesIndex.delete(space3);
- this.contextsIndex.delete(space3);
- this.framesIndex.delete(space3);
+ onSpaceDeleted(space2) {
+ if (this.spacesIndex.has(space2)) {
+ this.spacesIndex.delete(space2);
+ this.contextsIndex.delete(space2);
+ this.framesIndex.delete(space2);
}
- this.spacesMap.delete(space3);
- this.spacesMap.deleteInverse(space3);
- this.persister.remove(space3, "space");
- this.dispatchEvent("spaceDeleted", { path: space3 });
+ this.spacesMap.delete(space2);
+ this.spacesMap.deleteInverse(space2);
+ this.persister.remove(space2, "space");
+ this.dispatchEvent("spaceDeleted", { path: space2 });
}
- async reloadActions(space3) {
- if (!space3)
+ async reloadActions(space2) {
+ if (!space2)
return false;
- this.spaceManager.commandsForSpace(space3.path).then((r2) => {
- this.actionsIndex.set(space3.path, r2);
- this.dispatchEvent("actionStateUpdated", { path: space3.path });
+ this.spaceManager.commandsForSpace(space2.path).then((r2) => {
+ this.actionsIndex.set(space2.path, r2);
+ this.dispatchEvent("actionStateUpdated", { path: space2.path });
});
}
- async reloadFrames(space3) {
- if (!space3)
+ async reloadFrames(space2) {
+ if (!space2)
return false;
- return this.indexer.reload({ type: "frames", path: space3.path }).then((r2) => {
+ return this.indexer.reload({ type: "frames", path: space2.path }).then((r2) => {
const { changed, cache: cache2 } = r2;
if (!changed) {
return false;
}
- this.framesIndex.set(space3.path, cache2);
- this.persister.store(space3.path, JSON.stringify(cache2), "frame");
+ this.framesIndex.set(space2.path, cache2);
+ this.persister.store(space2.path, JSON.stringify(cache2), "frame");
return true;
});
}
- async reloadContextByPath(path3) {
- return this.reloadContext(this.spaceManager.spaceInfoForPath(path3));
+ async reloadContextByPath(path2) {
+ return this.reloadContext(this.spaceManager.spaceInfoForPath(path2));
}
- async reloadContext(space3) {
- if (!space3)
+ async reloadContext(space2) {
+ if (!space2)
return false;
- return this.indexer.reload({ type: "context", path: space3.path }).then((r2) => {
- return this.contextReloaded(space3.path, r2.cache, r2.changed);
+ return this.indexer.reload({ type: "context", path: space2.path }).then((r2) => {
+ return this.contextReloaded(space2.path, r2.cache, r2.changed);
});
}
- async contextReloaded(path3, cache2, changed) {
+ async contextReloaded(path2, cache2, changed) {
if (!changed) {
return false;
}
- this.contextsIndex.set(path3, cache2);
+ this.contextsIndex.set(path2, cache2);
if (cache2.dbExists) {
if (this.settings.syncFormulaToFrontmatter) {
const allRows = cache2.tables?.[defaultContextSchemaID]?.rows ?? [];
const allColumns = cache2.tables?.[defaultContextSchemaID]?.cols ?? [];
const updatedValues = allRows.filter((f2) => {
- const path4 = f2[PathPropertyName];
- const pathCache = this.pathsIndex.get(path4);
+ const path3 = f2[PathPropertyName];
+ const pathCache = this.pathsIndex.get(path3);
if (!pathCache) {
return false;
}
@@ -112395,14 +112295,14 @@ var Superstate10 = class {
const missingPaths = cache2.paths.filter((f2) => !contextPaths.includes(f2));
const removedPaths = contextPaths.filter((f2) => !cache2.paths.includes(f2));
if (missingPaths.length > 0) {
- this.addToContextStateQueue(() => insertContextItems(this.spaceManager, missingPaths, path3));
+ this.addToContextStateQueue(() => insertContextItems(this.spaceManager, missingPaths, path2));
}
if (removedPaths.length > 0) {
this.addToContextStateQueue(() => removePathsInContext(this.spaceManager, removedPaths, cache2.space));
}
}
- this.persister.store(path3, JSON.stringify(cache2), "context");
- this.dispatchEvent("contextStateUpdated", { path: path3 });
+ this.persister.store(path2, JSON.stringify(cache2), "context");
+ this.dispatchEvent("contextStateUpdated", { path: path2 });
return true;
}
allSpaces(ordered) {
@@ -112418,19 +112318,19 @@ var Superstate10 = class {
return [...this.framesIndex.values()].filter((f2) => f2).flatMap((f2) => f2.schemas.filter((f3) => f3.type == "frame").map((s4) => ({ schema: s4, path: f2.path })));
}
async updateSpaceMetadata(spacePath, metadata) {
- const space3 = this.spacesIndex.get(spacePath);
- const oldDef = space3?.metadata;
- if (!space3) {
+ const space2 = this.spacesIndex.get(spacePath);
+ const oldDef = space2?.metadata;
+ if (!space2) {
return this.reloadSpaceByPath(spacePath);
}
let spaceDefChanged = false;
const spaceSort = metadata?.sort ?? { field: "rank", asc: true, group: true };
const sortable = spaceSort.field == "rank";
- if (!import_lodash12.default.isEqual(space3.metadata.links, metadata.links) || !import_lodash12.default.isEqual(space3.metadata.filters, metadata.filters)) {
+ if (!import_lodash12.default.isEqual(space2.metadata.links, metadata.links) || !import_lodash12.default.isEqual(space2.metadata.filters, metadata.filters)) {
spaceDefChanged = true;
}
const newSpaceCache = {
- ...space3,
+ ...space2,
metadata,
contexts: metadata?.contexts ?? [],
sortable
@@ -112439,35 +112339,35 @@ var Superstate10 = class {
if (spaceDefChanged) {
await this.onSpaceDefinitionChanged(newSpaceCache, oldDef);
}
- this.dispatchEvent("spaceStateUpdated", { path: space3.path });
+ this.dispatchEvent("spaceStateUpdated", { path: space2.path });
return newSpaceCache;
}
- async reloadSpace(space3, spaceMetadata, initialized = true) {
- if (!space3)
+ async reloadSpace(space2, spaceMetadata, initialized = true) {
+ if (!space2)
return;
- const metadata = spaceMetadata ?? await this.spaceManager.spaceDefForSpace(space3.path);
- let pathState = this.pathsIndex.get(space3.path);
- const type = this.spaceManager.spaceTypeByString(this.spaceManager.uriByString(space3.path));
+ const metadata = spaceMetadata ?? await this.spaceManager.spaceDefForSpace(space2.path);
+ let pathState = this.pathsIndex.get(space2.path);
+ const type = this.spaceManager.spaceTypeByString(this.spaceManager.uriByString(space2.path));
if (type == "default" || type == "tag") {
metadata.filters = [];
metadata.links = [];
}
const propertyTypes = [];
let properties3 = {};
- const frame = this.framesIndex.get(space3.path);
+ const frame = this.framesIndex.get(space2.path);
if (frame) {
const frameProps = frame.frames[mainFrameID]?.cols ?? [];
propertyTypes.push(...frameProps);
} else {
- const frameProps = await this.spaceManager.readFrame(space3.path, mainFrameID).then((f2) => f2?.cols ?? []);
+ const frameProps = await this.spaceManager.readFrame(space2.path, mainFrameID).then((f2) => f2?.cols ?? []);
propertyTypes.push(...frameProps);
}
if (propertyTypes.length > 0) {
if (!pathState) {
- const pathCache = await this.spaceManager.readPathCache(space3.defPath);
+ const pathCache = await this.spaceManager.readPathCache(space2.defPath);
pathState = {
- path: space3.path,
- name: space3.name,
+ path: space2.path,
+ name: space2.name,
tags: [],
spaces: [],
outlinks: [],
@@ -112475,17 +112375,17 @@ var Superstate10 = class {
metadata: pathCache?.metadata,
type: "space",
subtype: type,
- displayName: space3.name,
+ displayName: space2.name,
label: pathCache?.label
};
}
- properties3 = await this.spaceManager.readProperties(space3.defPath).then((f2) => linkContextRow(this.formulaContext, this.pathsIndex, f2, propertyTypes, pathState));
+ properties3 = await this.spaceManager.readProperties(space2.defPath).then((f2) => linkContextRow(this.formulaContext, this.pathsIndex, f2, propertyTypes, pathState));
}
- [...this.spacesMap.get(space3.path)].map((f2) => this.contextsIndex.get(f2)).forEach((f2) => {
+ [...this.spacesMap.get(space2.path)].map((f2) => this.contextsIndex.get(f2)).forEach((f2) => {
if (f2) {
const contextProps = f2.tables?.[defaultContextSchemaID]?.cols ?? [];
propertyTypes.push(...contextProps);
- properties3 = { ...properties3, ...f2.tables?.[defaultContextSchemaID]?.rows.find((g) => g[PathPropertyName] == space3.path) ?? {} };
+ properties3 = { ...properties3, ...f2.tables?.[defaultContextSchemaID]?.rows.find((g) => g[PathPropertyName] == space2.path) ?? {} };
}
});
const spaceSort = metadata?.sort ?? { field: "rank", asc: true, group: true };
@@ -112493,15 +112393,15 @@ var Superstate10 = class {
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) : []));
if (type == "tag" && this.settings.autoAddContextsToSubtags) {
- const parentTags = getAllParentTags(space3.name);
+ const parentTags = getAllParentTags(space2.name);
contexts.push(...parentTags);
}
- const templates = await this.spaceManager.readTemplates(space3.path);
+ const templates = await this.spaceManager.readTemplates(space2.path);
const cache2 = {
- name: space3.name,
- space: space3,
- path: space3.path,
- defPath: space3.defPath,
+ name: space2.name,
+ space: space2,
+ path: space2.path,
+ defPath: space2.defPath,
type,
templates,
contexts: contexts.map((f2) => ensureTag(f2)),
@@ -112511,31 +112411,31 @@ var Superstate10 = class {
properties: properties3,
propertyTypes
};
- this.spacesIndex.set(space3.path, cache2);
- this.persister.store(space3.path, JSON.stringify(cache2), "space");
+ this.spacesIndex.set(space2.path, cache2);
+ this.persister.store(space2.path, JSON.stringify(cache2), "space");
cache2.metadata?.links?.forEach((f2) => {
if (pathIsSpace(this, f2)) {
- this.spacesMap.set(f2, /* @__PURE__ */ new Set([...this.spacesMap.get(f2), space3.path]));
+ this.spacesMap.set(f2, /* @__PURE__ */ new Set([...this.spacesMap.get(f2), space2.path]));
}
});
if (initialized) {
- this.dispatchEvent("spaceStateUpdated", { path: space3.path });
+ this.dispatchEvent("spaceStateUpdated", { path: space2.path });
return cache2;
}
}
- async pathReloaded(path3, cache2, changed, force) {
- this.pathsIndex.set(path3, cache2);
- await this.onPathReloaded(path3);
+ async pathReloaded(path2, cache2, changed, force) {
+ this.pathsIndex.set(path2, cache2);
+ await this.onPathReloaded(path2);
if (cache2.subtype == "image" || cache2.metadata?.file?.extension == "svg") {
- this.imagesCache.set(cache2.metadata.file.filename, path3);
+ this.imagesCache.set(cache2.metadata.file.filename, path2);
}
if (!changed && !force) {
return false;
}
- this.tagsMap.set(path3, new Set(cache2.tags));
- this.linksMap.set(path3, new Set(cache2.outlinks));
- if (!import_lodash12.default.isEqual(cache2.spaces, Array.from(this.spacesMap.get(path3)))) {
- this.spacesMap.set(path3, new Set(cache2.spaces));
+ this.tagsMap.set(path2, new Set(cache2.tags));
+ this.linksMap.set(path2, new Set(cache2.outlinks));
+ if (!import_lodash12.default.isEqual(cache2.spaces, Array.from(this.spacesMap.get(path2)))) {
+ this.spacesMap.set(path2, new Set(cache2.spaces));
const promises = cache2.tags.map((f2) => this.spacesIndex.has(tagSpacePathFromTag(f2)) ? null : fileSystemSpaceInfoFromTag(this.spaceManager, f2)).filter((f2) => f2).map(
async (f2) => {
await this.reloadSpace(f2);
@@ -112551,7 +112451,7 @@ var Superstate10 = class {
}
if (force) {
const allContextsWithFile = cache2.spaces.map((f2) => this.spacesIndex.get(f2)?.space).filter((f2) => f2);
- this.addToContextStateQueue(() => updateContextWithProperties(this, path3, allContextsWithFile).then((g) => {
+ this.addToContextStateQueue(() => updateContextWithProperties(this, path2, allContextsWithFile).then((g) => {
allContextsWithFile.forEach((f2) => {
this.reloadContext(f2);
this.dispatchEvent("spaceStateUpdated", { path: f2.path });
@@ -112559,29 +112459,29 @@ var Superstate10 = class {
}));
}
if (cache2.metadata?.file?.extension == "svg" && this.settings.indexSVG) {
- this.spaceManager.readPath(path3).then((f2) => {
- this.iconsCache.set(path3, f2);
- this.persister.store(path3, f2, "icon");
+ this.spaceManager.readPath(path2).then((f2) => {
+ this.iconsCache.set(path2, f2);
+ this.persister.store(path2, f2, "icon");
});
}
}
- async reloadPath(path3, force) {
- if (!path3)
+ async reloadPath(path2, force) {
+ if (!path2)
return false;
- return this.indexer.reload({ type: "path", path: path3 }).then(async (r2) => {
- await this.pathReloaded(path3, r2.cache, r2.changed, force);
+ return this.indexer.reload({ type: "path", path: path2 }).then(async (r2) => {
+ await this.pathReloaded(path2, r2.cache, r2.changed, force);
return true;
});
}
- async onPathReloaded(path3) {
+ async onPathReloaded(path2) {
let pathState;
- if (this.pathsIndex.has(path3)) {
- pathState = this.pathsIndex.get(path3);
+ if (this.pathsIndex.has(path2)) {
+ pathState = this.pathsIndex.get(path2);
}
if (!pathState) {
return false;
}
- await this.persister.store(path3, serializePathState(pathState), "path");
+ await this.persister.store(path2, serializePathState(pathState), "path");
}
};
@@ -112595,8 +112495,8 @@ var FilesystemMiddleware = class {
static create() {
return new FilesystemMiddleware();
}
- resolvePath(path3, source) {
- return this.primary.resolvePath(path3, source);
+ resolvePath(path2, source) {
+ return this.primary.resolvePath(path2, source);
}
keysForCacheType(cacheType) {
return this.primary.keysForCacheType(cacheType);
@@ -112628,9 +112528,9 @@ var FilesystemMiddleware = class {
}
getFileCacheTypeByRefString(file, refString) {
const adapters = this.filetypeAdaptersForFile(file);
- return adapters.reduce((p2, c3) => {
- if (p2)
- return p2;
+ return adapters.reduce((p, c3) => {
+ if (p)
+ return p;
return c3.getCacheTypeByRefString(file, refString);
}, null);
}
@@ -112640,21 +112540,21 @@ var FilesystemMiddleware = class {
allFiles() {
return this.primary.allFiles();
}
- resourcePathForPath(path3) {
- return this.adapterForPath(path3).resourcePathForPath(path3);
+ resourcePathForPath(path2) {
+ return this.adapterForPath(path2).resourcePathForPath(path2);
}
- parentPathForPath(path3) {
- return this.adapterForPath(path3).parentPathForPath(path3);
+ parentPathForPath(path2) {
+ return this.adapterForPath(path2).parentPathForPath(path2);
}
- async createFileCache(path3) {
- const file = await this.getFile(path3);
+ async createFileCache(path2) {
+ const file = await this.getFile(path2);
for (const adapter of this.filetypeAdaptersForFile(file)) {
if (adapter.parseCache)
await adapter.parseCache(file, false);
}
}
- getFileCache(path3) {
- return this.adapterForPath(path3).getFileCache(path3);
+ getFileCache(path2) {
+ return this.adapterForPath(path2).getFileCache(path2);
}
getFileContent(file, contentType, contentId) {
const adapters = this.filetypeAdaptersForFile(file).filter((f2) => f2.contentTypes(file).includes(contentType));
@@ -112662,8 +112562,8 @@ var FilesystemMiddleware = class {
return adapters[0].readContent(file, contentType, contentId);
}
}
- updateFileCache(path3, cache2, refresh) {
- this.adapterForPath(path3).updateFileCache(path3, cache2, refresh);
+ updateFileCache(path2, cache2, refresh) {
+ this.adapterForPath(path2).updateFileCache(path2, cache2, refresh);
}
readFileFragments(file, fragmentType, query) {
const adapters = this.filetypeAdaptersForFileFragments(file, fragmentType);
@@ -112671,23 +112571,23 @@ var FilesystemMiddleware = class {
return adapters[0].readContent(file, fragmentType, query);
}
}
- async newFile(parent, name317, type, content5) {
+ async newFile(parent, name317, type, content3) {
const adapter = this.filetypes.find((f2) => f2.supportedFileTypes.includes(type));
if (adapter)
- return adapter.newFile(parent, name317, type, content5);
+ return adapter.newFile(parent, name317, type, content3);
}
- newFileFragment(file, fragmentType, name317, content5, options) {
+ newFileFragment(file, fragmentType, name317, content3, options) {
const adapters = this.filetypeAdaptersForFileFragments(file, fragmentType);
if (adapters.length >= 1) {
- return adapters[0].newContent(file, fragmentType, name317, content5, options);
+ return adapters[0].newContent(file, fragmentType, name317, content3, options);
}
}
- saveFileLabel(file, key3, value) {
+ saveFileLabel(file, key2, value) {
const adapters = this.filetypeAdaptersForFileFragments(file, "label");
if (adapters.length >= 1) {
- return adapters[0].saveContent(file, "label", key3, () => value);
+ return adapters[0].saveContent(file, "label", key2, () => value);
} else {
- return this.primary.updateFileLabel(file.path, key3, value);
+ return this.primary.updateFileLabel(file.path, key2, value);
}
}
saveFileFragment(file, fragmentType, fragmentId, saveContent) {
@@ -112715,53 +112615,53 @@ var FilesystemMiddleware = class {
onDelete(file) {
this.eventDispatch.dispatchEvent("onDelete", { file });
}
- adapterForPath(path3) {
+ adapterForPath(path2) {
return this.primary;
}
async getRoot() {
return this.adapterForPath().getRoot();
}
- async copyFile(path3, folder, newName) {
- return this.adapterForPath(path3).copyFile(path3, folder, newName);
+ async copyFile(path2, folder, newName) {
+ return this.adapterForPath(path2).copyFile(path2, folder, newName);
}
- async writeTextToFile(path3, content5) {
- return this.adapterForPath(path3).writeTextToFile(path3, content5);
+ async writeTextToFile(path2, content3) {
+ return this.adapterForPath(path2).writeTextToFile(path2, content3);
}
- async readTextFromFile(path3) {
- return this.adapterForPath(path3).readTextFromFile(path3);
+ async readTextFromFile(path2) {
+ return this.adapterForPath(path2).readTextFromFile(path2);
}
- async writeBinaryToFile(path3, buffer2) {
- return this.adapterForPath(path3).writeBinaryToFile(path3, buffer2);
+ async writeBinaryToFile(path2, buffer) {
+ return this.adapterForPath(path2).writeBinaryToFile(path2, buffer);
}
- async readBinaryToFile(path3) {
- return this.adapterForPath(path3).readBinaryToFile(path3);
+ async readBinaryToFile(path2) {
+ return this.adapterForPath(path2).readBinaryToFile(path2);
}
- async renameFile(path3, newPath) {
- return this.adapterForPath(path3).renameFile(path3, newPath);
+ async renameFile(path2, newPath) {
+ return this.adapterForPath(path2).renameFile(path2, newPath);
}
- async createFolder(path3) {
- return this.adapterForPath(path3).createFolder(path3);
+ async createFolder(path2) {
+ return this.adapterForPath(path2).createFolder(path2);
}
- async childrenForFolder(path3, type) {
- return this.adapterForPath(path3).childrenForFolder(path3, type);
+ async childrenForFolder(path2, type) {
+ return this.adapterForPath(path2).childrenForFolder(path2, type);
}
- async fileExists(path3) {
- return this.adapterForPath(path3).fileExists(path3);
+ async fileExists(path2) {
+ return this.adapterForPath(path2).fileExists(path2);
}
- async getFile(path3, source) {
- return this.adapterForPath(path3).getFile(path3, source);
+ async getFile(path2, source) {
+ return this.adapterForPath(path2).getFile(path2, source);
}
- async deleteFile(path3) {
- return this.adapterForPath(path3).deleteFile(path3);
+ async deleteFile(path2) {
+ return this.adapterForPath(path2).deleteFile(path2);
}
- async addTagToFile(path3, tag2) {
- return this.adapterForPath(path3).addTagToFile(path3, tag2);
+ async addTagToFile(path2, tag2) {
+ return this.adapterForPath(path2).addTagToFile(path2, tag2);
}
- async renameTagForFile(path3, oldTag, newTag) {
- return this.adapterForPath(path3).renameTagForFile(path3, oldTag, newTag);
+ async renameTagForFile(path2, oldTag, newTag) {
+ return this.adapterForPath(path2).renameTagForFile(path2, oldTag, newTag);
}
- async removeTagFromFile(path3, tag2) {
- return this.adapterForPath(path3).removeTagFromFile(path3, tag2);
+ async removeTagFromFile(path2, tag2) {
+ return this.adapterForPath(path2).removeTagFromFile(path2, tag2);
}
filesForTag(tag2) {
return this.primary.filesForTag(tag2);
@@ -112812,14 +112712,14 @@ var FilesystemSpaceAdapter = class {
initiateAdapter(manager) {
this.spaceManager = manager;
}
- async readTemplates(path3) {
- return (await this.childrenForPath(`${path3}/.space/templates`)).filter((f2) => !f2.startsWith(".")).map((f2) => f2.split("/").pop());
+ async readTemplates(path2) {
+ return (await this.childrenForPath(`${path2}/.space/templates`)).filter((f2) => !f2.startsWith(".")).map((f2) => f2.split("/").pop());
}
- async saveTemplate(path3, space3) {
- return this.copyPath(path3, `${space3}/.space/templates`);
+ async saveTemplate(path2, space2) {
+ return this.copyPath(path2, `${space2}/.space/templates`);
}
- deleteTemplate(path3, space3) {
- return this.deletePath(`${space3}/.space/templates/${path3}`);
+ deleteTemplate(path2, space2) {
+ return this.deletePath(`${space2}/.space/templates/${path2}`);
}
async readWaypoints() {
if (!await this.fileSystem.fileExists(defaultSpaceFolder)) {
@@ -112865,10 +112765,10 @@ var FilesystemSpaceAdapter = class {
async readAllTemplates() {
const strings = (await this.childrenForPath(defaultTemplatesFolder)).map((f2) => f2.split("/").pop());
const templates = {};
- for (const string6 of strings) {
- const template2 = await this.readTemplate(string6);
+ for (const string4 of strings) {
+ const template2 = await this.readTemplate(string4);
if (template2) {
- templates[string6] = template2;
+ templates[string4] = template2;
}
}
return templates;
@@ -112906,67 +112806,67 @@ var FilesystemSpaceAdapter = class {
async onMetadataChange(payload) {
if (!payload.path)
return;
- for (const space3 of this.allSpaces()) {
- if (space3.defPath == payload.path) {
- this.spaceManager.onPathPropertyChanged(space3.path);
+ for (const space2 of this.allSpaces()) {
+ if (space2.defPath == payload.path) {
+ this.spaceManager.onPathPropertyChanged(space2.path);
return;
}
}
this.spaceManager.onPathPropertyChanged(payload.path);
}
- uriByPath(path3) {
- return this.spaceManager.uriByString(path3);
+ uriByPath(path2) {
+ return this.spaceManager.uriByString(path2);
}
allPaths(type) {
return [...this.fileSystem.allFiles().filter((f2) => type ? type.some((g) => g == "folder" ? f2.isFolder : f2.extension == g) : true).map((g) => g.path)];
}
- async pathExists(path3) {
- return this.fileSystem.fileExists(path3);
+ async pathExists(path2) {
+ return this.fileSystem.fileExists(path2);
}
- async createItemAtPath(parent, type, name317, content5) {
+ async createItemAtPath(parent, type, name317, content3) {
const parentURI = await this.getPathInfo(parent);
if (!parentURI?.isFolder) {
const file = await this.fileSystem.getFile(parent);
if (!file)
return null;
- return this.fileSystem.newFileFragment(file, type, name317, content5)?.then((f2) => file.path);
+ return this.fileSystem.newFileFragment(file, type, name317, content3)?.then((f2) => file.path);
}
- return this.fileSystem.newFile(parent, name317, type, content5).then((f2) => f2?.path);
+ return this.fileSystem.newFile(parent, name317, type, content3).then((f2) => f2?.path);
}
- async renamePath(oldPath, path3) {
+ async renamePath(oldPath, path2) {
const uri = this.uriByPath(oldPath);
- const newUri = this.uriByPath(path3);
+ const newUri = this.uriByPath(path2);
const file = await this.fileSystem.getFile(uri.path);
if (uri.refStr) {
const refType = await this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr);
return await this.fileSystem.saveFileFragment(file, refType, uri.refStr, () => newUri.refStr);
}
- return await this.fileSystem.renameFile(oldPath, path3);
+ return await this.fileSystem.renameFile(oldPath, path2);
}
- async deletePath(path3) {
- const uri = this.uriByPath(path3);
+ async deletePath(path2) {
+ const uri = this.uriByPath(path2);
if (uri.refStr) {
const file = await this.fileSystem.getFile(uri.path);
const refType = await this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr);
return this.fileSystem.deleteFileFragment(file, refType, uri.refStr);
}
- return this.fileSystem.deleteFile(path3);
+ return this.fileSystem.deleteFile(path2);
}
- async getPathInfo(path3) {
- const uri = this.uriByPath(path3);
+ async getPathInfo(path2) {
+ const uri = this.uriByPath(path2);
const file = await this.fileSystem.getFile(uri.path);
if (uri.refStr) {
const type = this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr);
}
return file;
}
- keysForCacheType(path3) {
- return this.fileSystem.keysForCacheType(path3);
+ keysForCacheType(path2) {
+ return this.fileSystem.keysForCacheType(path2);
}
- async readPathCache(path3) {
- const uri = this.uriByPath(path3);
+ async readPathCache(path2) {
+ const uri = this.uriByPath(path2);
if (uri.scheme == "spaces") {
- if (path3.startsWith(tagsSpacePath)) {
+ if (path2.startsWith(tagsSpacePath)) {
return {
file: null,
metadata: null,
@@ -113008,44 +112908,44 @@ var FilesystemSpaceAdapter = class {
};
}
}
- return this.fileSystem.getFileCache(path3);
+ return this.fileSystem.getFileCache(path2);
}
- async readPath(path3) {
- const uri = this.uriByPath(path3);
+ async readPath(path2) {
+ const uri = this.uriByPath(path2);
const file = await this.fileSystem.getFile(uri.path);
if (uri.refStr) {
const fragmentType = this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr);
this.fileSystem.getFileContent(file, fragmentType, uri.refStr);
}
- return this.fileSystem.readTextFromFile(path3);
+ return this.fileSystem.readTextFromFile(path2);
}
- async copyPath(path3, newPath, newName) {
- const uri = this.uriByPath(path3);
+ async copyPath(path2, newPath, newName) {
+ const uri = this.uriByPath(path2);
const file = await this.fileSystem.getFile(uri.path);
return this.fileSystem.copyFile(file.path, newPath, newName);
}
- async writeToPath(path3, content5, binary) {
- const uri = this.uriByPath(path3);
+ async writeToPath(path2, content3, binary) {
+ const uri = this.uriByPath(path2);
const file = await this.fileSystem.getFile(uri.path);
if (uri.refStr) {
const fragmentType = this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr);
- this.fileSystem.saveFileFragment(file, fragmentType, uri.refStr, () => content5);
+ this.fileSystem.saveFileFragment(file, fragmentType, uri.refStr, () => content3);
}
if (binary) {
- return this.fileSystem.writeBinaryToFile(path3, content5);
+ return this.fileSystem.writeBinaryToFile(path2, content3);
}
- return this.fileSystem.writeTextToFile(path3, content5);
+ return this.fileSystem.writeTextToFile(path2, content3);
}
- async childrenForPath(path3, type) {
- if (await this.fileSystem.fileExists(path3))
- return this.fileSystem.childrenForFolder(path3, type);
+ async childrenForPath(path2, type) {
+ if (await this.fileSystem.fileExists(path2))
+ return this.fileSystem.childrenForFolder(path2, type);
return [];
}
- parentPathForPath(path3) {
- return this.fileSystem.parentPathForPath(path3);
+ parentPathForPath(path2) {
+ return this.fileSystem.parentPathForPath(path2);
}
- async readFrame(path3, schema) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async readFrame(path2, schema) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
if (!mdbFile) {
const defaultTemplate2 = this.defaultFrame();
if (Object.keys(defaultTemplate2).some((f2) => f2 == schema)) {
@@ -113055,15 +112955,15 @@ var FilesystemSpaceAdapter = class {
}
return this.fileSystem.readFileFragments(mdbFile, "mdbTable", schema);
}
- async readAllFrames(path3) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async readAllFrames(path2) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
if (!mdbFile) {
return this.defaultFrame();
}
return this.fileSystem.readFileFragments(mdbFile, "mdbTables");
}
- async readTable(path3, schema) {
- const spaceInfo = this.spaceInfoForPath(path3);
+ async readTable(path2, schema) {
+ const spaceInfo = this.spaceInfoForPath(path2);
const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath);
if (!mdbFile && schema == defaultContextDBSchema.id) {
const defaultTable = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo);
@@ -113071,18 +112971,18 @@ var FilesystemSpaceAdapter = class {
}
return this.fileSystem.readFileFragments(mdbFile, "mdbTable", schema);
}
- async spaceInitiated(path3) {
+ async spaceInitiated(path2) {
return true;
}
- async contextInitiated(path3) {
- const spaceInfo = this.spaceInfoForPath(path3);
+ async contextInitiated(path2) {
+ const spaceInfo = this.spaceInfoForPath(path2);
const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath);
if (mdbFile)
return true;
return false;
}
- async tablesForSpace(path3) {
- const spaceInfo = this.spaceInfoForPath(path3);
+ async tablesForSpace(path2) {
+ const spaceInfo = this.spaceInfoForPath(path2);
const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath);
if (!mdbFile) {
return defaultContextTable.rows;
@@ -113090,7 +112990,7 @@ var FilesystemSpaceAdapter = class {
return this.fileSystem.readFileFragments(mdbFile, "schemas", null);
}
defaultDBTablesForContext(spaceInfo) {
- const table2 = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo);
+ const table = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo);
const defaultFields = defaultFieldsForContext(spaceInfo);
const defaultTable = defaultTablesForContext(spaceInfo);
return {
@@ -113098,12 +112998,12 @@ var FilesystemSpaceAdapter = class {
m_fields: {
uniques: defaultFields.uniques,
cols: defaultFields.cols,
- rows: [...defaultFields.rows ?? [], ...table2.cols]
+ rows: [...defaultFields.rows ?? [], ...table.cols]
},
- [table2.schema.id]: {
- uniques: table2.cols.filter((c3) => c3.unique == "true").map((c3) => c3.name),
- cols: table2.cols.map((c3) => c3.name),
- rows: table2.rows
+ [table.schema.id]: {
+ uniques: table.cols.filter((c3) => c3.unique == "true").map((c3) => c3.name),
+ cols: table.cols.map((c3) => c3.name),
+ rows: table.rows
}
};
}
@@ -113113,57 +113013,57 @@ var FilesystemSpaceAdapter = class {
}
return DefaultMDBTables;
}
- async createDefaultTable(path3) {
- const spaceInfo = this.spaceInfoForPath(path3);
- const dbPath = this.spaceInfoForPath(path3).dbPath;
- const extension2 = dbPath.split(".").pop();
+ async createDefaultTable(path2) {
+ const spaceInfo = this.spaceInfoForPath(path2);
+ const dbPath = this.spaceInfoForPath(path2).dbPath;
+ const extension = dbPath.split(".").pop();
const folder = dbPath.split("/").slice(0, -1).join("/");
const filename = dbPath.split("/").pop().split(".")[0];
- return this.fileSystem.newFile(folder, filename, extension2, this.defaultDBTablesForContext(spaceInfo));
+ return this.fileSystem.newFile(folder, filename, extension, this.defaultDBTablesForContext(spaceInfo));
}
- async createDefaultFrames(path3) {
+ async createDefaultFrames(path2) {
const defaultSpaceTemplate = this.defaultFrame();
const dbField = {
...mdbFrameToDBTables(defaultSpaceTemplate),
m_schema: defaultFramesTable
};
- const dbPath = this.spaceInfoForPath(path3).framePath;
- const extension2 = dbPath.split(".").pop();
+ const dbPath = this.spaceInfoForPath(path2).framePath;
+ const extension = dbPath.split(".").pop();
const folder = dbPath.split("/").slice(0, -1).join("/");
const filename = dbPath.split("/").pop().split(".")[0];
- return this.fileSystem.newFile(folder, filename, extension2, dbField);
+ return this.fileSystem.newFile(folder, filename, extension, dbField);
}
- async createTable(path3, schema) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async createTable(path2, schema) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
if (!mdbFile) {
- mdbFile = await this.createDefaultTable(path3);
+ mdbFile = await this.createDefaultTable(path2);
}
return this.fileSystem.newFileFragment(mdbFile, "schema", schema.id, schema);
}
- async saveTableSchema(path3, schemaId, saveSchema) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async saveTableSchema(path2, schemaId, saveSchema) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
if (!mdbFile) {
- mdbFile = await this.createDefaultTable(path3);
+ mdbFile = await this.createDefaultTable(path2);
}
return this.fileSystem.saveFileFragment(mdbFile, "schema", schemaId, saveSchema);
}
- async saveTable(path3, table2, force) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async saveTable(path2, table, force) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
if (!mdbFile) {
if (force) {
- mdbFile = await this.createDefaultTable(path3);
+ mdbFile = await this.createDefaultTable(path2);
} else {
return false;
}
}
- return this.fileSystem.saveFileFragment(mdbFile, "mdbTable", table2.schema.id, () => table2);
+ return this.fileSystem.saveFileFragment(mdbFile, "mdbTable", table.schema.id, () => table);
}
- async deleteTable(path3, name317) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async deleteTable(path2, name317) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
return this.fileSystem.deleteFileFragment(mdbFile, "schema", name317);
}
- async readAllTables(path3) {
- const spaceInfo = this.spaceInfoForPath(path3);
+ async readAllTables(path2) {
+ const spaceInfo = this.spaceInfoForPath(path2);
const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath);
if (!mdbFile) {
const defaultTable = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo);
@@ -113173,40 +113073,40 @@ var FilesystemSpaceAdapter = class {
}
return this.fileSystem.readFileFragments(mdbFile, "mdbTables", null);
}
- async framesForSpace(path3) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async framesForSpace(path2) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
if (!mdbFile) {
const frames = this.defaultFrame();
return Object.values(frames).map((f2) => f2.schema);
}
return this.fileSystem.readFileFragments(mdbFile, "schemas", null);
}
- async createFrame(path3, schema) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async createFrame(path2, schema) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
if (!mdbFile) {
- mdbFile = await this.createDefaultFrames(path3);
+ mdbFile = await this.createDefaultFrames(path2);
}
return this.fileSystem.newFileFragment(mdbFile, "schema", schema.id, schema);
}
- async deleteFrame(path3, name317) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async deleteFrame(path2, name317) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
return this.fileSystem.deleteFileFragment(mdbFile, "schema", name317);
}
- async saveFrameSchema(path3, schemaId, saveSchema) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async saveFrameSchema(path2, schemaId, saveSchema) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
if (!mdbFile) {
- mdbFile = await this.createDefaultFrames(path3);
+ mdbFile = await this.createDefaultFrames(path2);
}
return this.fileSystem.saveFileFragment(mdbFile, "schema", schemaId, saveSchema);
}
- async saveFrame(path3, frame) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath);
+ async saveFrame(path2, frame) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath);
if (!mdbFile) {
- mdbFile = await this.createDefaultFrames(path3);
+ mdbFile = await this.createDefaultFrames(path2);
}
return this.fileSystem.saveFileFragment(mdbFile, "mdbFrame", frame.schema.id, () => frame);
}
- async createDefaultCommands(path3) {
+ async createDefaultCommands(path2) {
const dbField = {
m_fields: {
uniques: fieldSchema.uniques,
@@ -113219,21 +113119,21 @@ var FilesystemSpaceAdapter = class {
rows: []
}
};
- const dbPath = this.spaceInfoForPath(path3).commandsPath;
- const extension2 = dbPath.split(".").pop();
+ const dbPath = this.spaceInfoForPath(path2).commandsPath;
+ const extension = dbPath.split(".").pop();
const folder = dbPath.split("/").slice(0, -1).join("/");
const filename = dbPath.split("/").pop().split(".")[0];
- return this.fileSystem.newFile(folder, filename, extension2, dbField);
+ return this.fileSystem.newFile(folder, filename, extension, dbField);
}
- async commandsForSpace(path3) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath);
+ async commandsForSpace(path2) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath);
if (!mdbFile) {
return [];
}
return this.fileSystem.readFileFragments(mdbFile, "mdbCommands", null);
}
- async runCommand(path3, name317, args) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath);
+ async runCommand(path2, name317, args) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath);
if (!mdbFile) {
return { result: null, error: "No commands file found" };
}
@@ -113247,16 +113147,16 @@ var FilesystemSpaceAdapter = class {
if (command.schema.type == "script")
result = executeCode(command.code, args);
if (command.schema.type == "formula")
- result = runFormulaWithContext(this.spaceManager.superstate.formulaContext, this.spaceManager.superstate.pathsIndex, command.code, command.fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}), args, this.spaceManager.superstate.pathsIndex.get(path3));
+ result = runFormulaWithContext(this.spaceManager.superstate.formulaContext, this.spaceManager.superstate.pathsIndex, command.code, command.fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}), args, this.spaceManager.superstate.pathsIndex.get(path2));
} catch (e5) {
error = e5;
}
return { result, error };
}
- async createCommand(path3, schema) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath);
+ async createCommand(path2, schema) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath);
if (!mdbFile) {
- mdbFile = await this.createDefaultCommands(path3);
+ mdbFile = await this.createDefaultCommands(path2);
}
return this.fileSystem.newFileFragment(mdbFile, "schema", schema.id, schema);
}
@@ -113307,65 +113207,65 @@ var FilesystemSpaceAdapter = class {
}
};
const dbPath = mdbFile.path;
- const extension2 = dbPath.split(".").pop();
+ const extension = dbPath.split(".").pop();
const folder = dbPath.split("/").slice(0, -1).join("/");
const filename = dbPath.split("/").pop().split(".")[0];
- await this.fileSystem.newFile(folder, filename, extension2, dbField);
+ await this.fileSystem.newFile(folder, filename, extension, dbField);
}
}
- async deleteCommand(path3, name317) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath);
+ async deleteCommand(path2, name317) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath);
return this.fileSystem.deleteFileFragment(mdbFile, "mdbCommand", name317);
}
- async saveCommand(path3, schemaId, saveCommand) {
- let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath);
+ async saveCommand(path2, schemaId, saveCommand) {
+ let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath);
if (!mdbFile) {
- mdbFile = await this.createDefaultCommands(path3);
+ mdbFile = await this.createDefaultCommands(path2);
}
return this.fileSystem.saveFileFragment(mdbFile, "mdbCommand", schemaId, saveCommand);
}
- async contextForSpace(path3) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async contextForSpace(path2) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
if (!mdbFile) {
- return defaultTableDataForContext(this.spaceManager.superstate, this.spaceInfoForPath(path3));
+ return defaultTableDataForContext(this.spaceManager.superstate, this.spaceInfoForPath(path2));
}
return this.fileSystem.readFileFragments(mdbFile, "mdbTable", defaultContextSchemaID);
}
- async addSpaceProperty(path3, property) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3)?.dbPath);
+ async addSpaceProperty(path2, property) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2)?.dbPath);
if (!mdbFile) {
- await this.createDefaultTable(path3);
+ await this.createDefaultTable(path2);
}
return this.fileSystem.newFileFragment(mdbFile, "field", property.name, property);
}
- async deleteSpaceProperty(path3, property) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async deleteSpaceProperty(path2, property) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
return this.fileSystem.deleteFileFragment(mdbFile, "field", property);
}
- async saveSpaceProperty(path3, property, oldProperty) {
- const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath);
+ async saveSpaceProperty(path2, property, oldProperty) {
+ const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath);
if (!mdbFile) {
- await this.createDefaultTable(path3);
+ await this.createDefaultTable(path2);
}
return this.fileSystem.saveFileFragment(mdbFile, "field", oldProperty, (prev) => ({ ...prev, ...property }));
}
- async addProperty(path3, property) {
- const file = await this.fileSystem.getFile(path3);
+ async addProperty(path2, property) {
+ const file = await this.fileSystem.getFile(path2);
this.fileSystem.newFileFragment(file, "property", property.name, property);
}
- async saveProperties(path3, properties3) {
- const file = await this.fileSystem.getFile(path3);
+ async saveProperties(path2, properties3) {
+ const file = await this.fileSystem.getFile(path2);
this.fileSystem.saveFileFragment(file, "property", null, (prev) => ({ ...prev, ...properties3 }));
}
- async readLabel(path3) {
- return this.fileSystem.getFileCache(path3).label;
+ async readLabel(path2) {
+ return this.fileSystem.getFileCache(path2).label;
}
- async saveLabel(path3, label, value) {
- const file = await this.fileSystem.getFile(path3);
+ async saveLabel(path2, label, value) {
+ const file = await this.fileSystem.getFile(path2);
this.fileSystem.saveFileLabel(file, label, value);
}
- async renameProperty(path3, property, newProperty) {
- const file = await this.fileSystem.getFile(path3);
+ async renameProperty(path2, property, newProperty) {
+ const file = await this.fileSystem.getFile(path2);
this.fileSystem.saveFileFragment(file, "property", null, (prev) => {
const { [property]: value, ...properties3 } = prev;
if (!value)
@@ -113373,12 +113273,12 @@ var FilesystemSpaceAdapter = class {
return { ...properties3, [newProperty]: value };
});
}
- async readProperties(path3) {
- const file = await this.fileSystem.getFile(path3);
+ async readProperties(path2) {
+ const file = await this.fileSystem.getFile(path2);
return this.fileSystem.readFileFragments(file, "property", null);
}
- async deleteProperty(path3, property) {
- const file = await this.fileSystem.getFile(path3);
+ async deleteProperty(path2, property) {
+ const file = await this.fileSystem.getFile(path2);
this.fileSystem.deleteFileFragment(file, "property", property);
}
allSpaces() {
@@ -113395,31 +113295,31 @@ var FilesystemSpaceAdapter = class {
readTags() {
return this.fileSystem.allTags();
}
- spaceInfoForPath(path3) {
- return fileSystemSpaceInfoByPath(this.spaceManager, path3);
+ spaceInfoForPath(path2) {
+ return fileSystemSpaceInfoByPath(this.spaceManager, path2);
}
allCaches() {
return this.fileSystem.allCaches();
}
- async spaceDefForSpace(path3) {
- const space3 = this.spaceInfoForPath(path3);
- if (!space3)
+ async spaceDefForSpace(path2) {
+ const space2 = this.spaceInfoForPath(path2);
+ if (!space2)
return null;
- const defFile = await this.fileSystem.getFile(space3.defPath);
+ const defFile = await this.fileSystem.getFile(space2.defPath);
const metaCache = defFile ? this.fileSystem.getFileCache(defFile.path)?.frontmatter : null;
const spaceDef = metaCache ?? {};
return parseSpaceMetadata(spaceDef, this.spaceManager.superstate.settings);
}
- async createSpace(name317, parentPath, definition3) {
+ async createSpace(name317, parentPath, definition) {
const spaceInfo = this.spaceInfoForPath(parentPath);
const newPath = spaceInfo.folderPath == "/" ? name317 : spaceInfo.folderPath + "/" + name317;
await this.fileSystem.createFolder(newPath);
- if (Object.keys(definition3 ?? {}).length > 0)
- return this.saveSpace(newPath, () => definition3);
+ if (Object.keys(definition ?? {}).length > 0)
+ return this.saveSpace(newPath, () => definition);
}
- async saveSpace(path3, definitionFn, properties3) {
- const metadata = definitionFn(await this.spaceDefForSpace(path3)) ?? {};
- const spaceInfo = this.spaceInfoForPath(path3);
+ async saveSpace(path2, definitionFn, properties3) {
+ const metadata = definitionFn(await this.spaceDefForSpace(path2)) ?? {};
+ const spaceInfo = this.spaceInfoForPath(path2);
let file = await this.fileSystem.getFile(spaceInfo.defPath);
if (!file) {
file = await this.fileSystem.newFile(spaceInfo.folderPath, spaceInfo.name, "md");
@@ -113441,28 +113341,28 @@ var FilesystemSpaceAdapter = class {
const newSpaceInfo = this.spaceInfoForPath(newPath);
this.fileSystem.renameFile(spaceInfo.folderPath, newSpaceInfo.folderPath).then((f2) => this.fileSystem.renameFile(movePath(spaceInfo.defPath, newSpaceInfo.path), newSpaceInfo.defPath));
}
- deleteSpace(path3) {
- const spaceCache = this.spaceInfoForPath(path3);
+ deleteSpace(path2) {
+ const spaceCache = this.spaceInfoForPath(path2);
const spaceInfo = fileSystemSpaceInfoFromTag(this.spaceManager, spaceCache.name);
this.fileSystem.deleteFile(spaceInfo.folderPath);
}
- childrenForSpace(path3) {
- return this.fileSystem.allFiles().filter((f2) => f2.parent == path3).map((f2) => f2.path);
+ childrenForSpace(path2) {
+ return this.fileSystem.allFiles().filter((f2) => f2.parent == path2).map((f2) => f2.path);
}
- addTag(path3, tag2) {
- this.fileSystem.addTagToFile(path3, tag2);
+ addTag(path2, tag2) {
+ this.fileSystem.addTagToFile(path2, tag2);
}
- renameTag(path3, tag2, newTag) {
- this.fileSystem.renameTagForFile(path3, tag2, newTag);
+ renameTag(path2, tag2, newTag) {
+ this.fileSystem.renameTagForFile(path2, tag2, newTag);
}
- deleteTag(path3, tag2) {
- this.fileSystem.removeTagFromFile(path3, tag2);
+ deleteTag(path2, tag2) {
+ this.fileSystem.removeTagFromFile(path2, tag2);
}
pathsForTag(tag2) {
return this.fileSystem.filesForTag(tag2);
}
- resolvePath(path3, source) {
- return this.fileSystem.resolvePath(path3, source);
+ resolvePath(path2, source) {
+ return this.fileSystem.resolvePath(path2, source);
}
};
@@ -113509,24 +113409,24 @@ function getTag(value) {
return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
}
var INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
-var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key3) => `Invalid value for key ${key3}`;
+var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key2) => `Invalid value for key ${key2}`;
var PATTERN_LENGTH_TOO_LARGE = (max5) => `Pattern length exceeds max of ${max5}.`;
var MISSING_KEY_PROPERTY = (name317) => `Missing ${name317} property in key`;
-var INVALID_KEY_WEIGHT_VALUE = (key3) => `Property 'weight' in key '${key3}' must be a positive integer`;
+var INVALID_KEY_WEIGHT_VALUE = (key2) => `Property 'weight' in key '${key2}' must be a positive integer`;
var hasOwn2 = Object.prototype.hasOwnProperty;
var KeyStore = class {
- constructor(keys2) {
+ constructor(keys) {
this._keys = [];
this._keyMap = {};
let totalWeight = 0;
- keys2.forEach((key3) => {
- let obj = createKey(key3);
+ keys.forEach((key2) => {
+ let obj = createKey(key2);
this._keys.push(obj);
this._keyMap[obj.id] = obj;
totalWeight += obj.weight;
});
- this._keys.forEach((key3) => {
- key3.weight /= totalWeight;
+ this._keys.forEach((key2) => {
+ key2.weight /= totalWeight;
});
}
get(keyId) {
@@ -113539,69 +113439,69 @@ var KeyStore = class {
return JSON.stringify(this._keys);
}
};
-function createKey(key3) {
- let path3 = null;
+function createKey(key2) {
+ let path2 = null;
let id3 = null;
let src = null;
let weight = 1;
let getFn = null;
- if (isString4(key3) || isArray4(key3)) {
- src = key3;
- path3 = createKeyPath(key3);
- id3 = createKeyId(key3);
+ if (isString4(key2) || isArray4(key2)) {
+ src = key2;
+ path2 = createKeyPath(key2);
+ id3 = createKeyId(key2);
} else {
- if (!hasOwn2.call(key3, "name")) {
+ if (!hasOwn2.call(key2, "name")) {
throw new Error(MISSING_KEY_PROPERTY("name"));
}
- const name317 = key3.name;
+ const name317 = key2.name;
src = name317;
- if (hasOwn2.call(key3, "weight")) {
- weight = key3.weight;
+ if (hasOwn2.call(key2, "weight")) {
+ weight = key2.weight;
if (weight <= 0) {
throw new Error(INVALID_KEY_WEIGHT_VALUE(name317));
}
}
- path3 = createKeyPath(name317);
+ path2 = createKeyPath(name317);
id3 = createKeyId(name317);
- getFn = key3.getFn;
+ getFn = key2.getFn;
}
- return { path: path3, id: id3, weight, src, getFn };
+ return { path: path2, id: id3, weight, src, getFn };
}
-function createKeyPath(key3) {
- return isArray4(key3) ? key3 : key3.split(".");
+function createKeyPath(key2) {
+ return isArray4(key2) ? key2 : key2.split(".");
}
-function createKeyId(key3) {
- return isArray4(key3) ? key3.join(".") : key3;
+function createKeyId(key2) {
+ return isArray4(key2) ? key2.join(".") : key2;
}
-function get(obj, path3) {
- let list4 = [];
+function get(obj, path2) {
+ let list = [];
let arr = false;
- const deepGet = (obj2, path4, index3) => {
+ const deepGet = (obj2, path3, index2) => {
if (!isDefined(obj2)) {
return;
}
- if (!path4[index3]) {
- list4.push(obj2);
+ if (!path3[index2]) {
+ list.push(obj2);
} else {
- let key3 = path4[index3];
- const value = obj2[key3];
+ let key2 = path3[index2];
+ const value = obj2[key2];
if (!isDefined(value)) {
return;
}
- if (index3 === path4.length - 1 && (isString4(value) || isNumber3(value) || isBoolean2(value))) {
- list4.push(toString3(value));
+ if (index2 === 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], path4, index3 + 1);
+ deepGet(value[i4], path3, index2 + 1);
}
- } else if (path4.length) {
- deepGet(value, path4, index3 + 1);
+ } else if (path3.length) {
+ deepGet(value, path3, index2 + 1);
}
}
};
- deepGet(obj, isString4(path3) ? path3.split(".") : path3, 0);
- return arr ? list4 : list4[0];
+ deepGet(obj, isString4(path2) ? path2.split(".") : path2, 0);
+ return arr ? list : list[0];
}
var MatchOptions = {
includeMatches: false,
@@ -113669,11 +113569,11 @@ var FuseIndex = class {
setIndexRecords(records = []) {
this.records = records;
}
- setKeys(keys2 = []) {
- this.keys = keys2;
+ setKeys(keys = []) {
+ this.keys = keys;
this._keysMap = {};
- keys2.forEach((key3, idx) => {
- this._keysMap[key3.id] = idx;
+ keys.forEach((key2, idx) => {
+ this._keysMap[key2.id] = idx;
});
}
create() {
@@ -113725,8 +113625,8 @@ var FuseIndex = class {
}
_addObject(doc, docIndex) {
let record = { i: docIndex, $: {} };
- this.keys.forEach((key3, keyIndex) => {
- let value = key3.getFn ? key3.getFn(doc) : this.getFn(doc, key3.path);
+ this.keys.forEach((key2, keyIndex) => {
+ let value = key2.getFn ? key2.getFn(doc) : this.getFn(doc, key2.path);
if (!isDefined(value)) {
return;
}
@@ -113773,17 +113673,17 @@ var FuseIndex = class {
};
}
};
-function createIndex2(keys2, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
+function createIndex2(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
const myIndex = new FuseIndex({ getFn, fieldNormWeight });
- myIndex.setKeys(keys2.map(createKey));
+ myIndex.setKeys(keys.map(createKey));
myIndex.setSources(docs);
myIndex.create();
return myIndex;
}
-function parseIndex(data3, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
- const { keys: keys2, records } = data3;
+function parseIndex(data2, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
+ const { keys, records } = data2;
const myIndex = new FuseIndex({ getFn, fieldNormWeight });
- myIndex.setKeys(keys2);
+ myIndex.setKeys(keys);
myIndex.setIndexRecords(records);
return myIndex;
}
@@ -113827,7 +113727,7 @@ function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMat
return indices;
}
var MAX_BITS = 32;
-function search(text7, pattern, patternAlphabet, {
+function search(text2, pattern, patternAlphabet, {
location = Config.location,
distance: distance2 = Config.distance,
threshold = Config.threshold,
@@ -113840,26 +113740,26 @@ function search(text7, pattern, patternAlphabet, {
throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
}
const patternLen = pattern.length;
- const textLen = text7.length;
+ const textLen = text2.length;
const expectedLocation = Math.max(0, Math.min(location, textLen));
let currentThreshold = threshold;
let bestLocation = expectedLocation;
const computeMatches = minMatchCharLength > 1 || includeMatches;
const matchMask = computeMatches ? Array(textLen) : [];
- let index3;
- while ((index3 = text7.indexOf(pattern, bestLocation)) > -1) {
+ let index2;
+ while ((index2 = text2.indexOf(pattern, bestLocation)) > -1) {
let score = computeScore$1(pattern, {
- currentLocation: index3,
+ currentLocation: index2,
expectedLocation,
distance: distance2,
ignoreLocation
});
currentThreshold = Math.min(score, currentThreshold);
- bestLocation = index3 + patternLen;
+ bestLocation = index2 + patternLen;
if (computeMatches) {
let i4 = 0;
while (i4 < patternLen) {
- matchMask[index3 + i4] = 1;
+ matchMask[index2 + i4] = 1;
i4 += 1;
}
}
@@ -113894,7 +113794,7 @@ function search(text7, pattern, patternAlphabet, {
bitArr[finish + 1] = (1 << i4) - 1;
for (let j = finish; j >= start; j -= 1) {
let currentLocation = j - 1;
- let charMatch = patternAlphabet[text7.charAt(currentLocation)];
+ let charMatch = patternAlphabet[text2.charAt(currentLocation)];
if (computeMatches) {
matchMask[currentLocation] = +!!charMatch;
}
@@ -114004,18 +113904,18 @@ var BitapSearch = class {
addChunk(this.pattern, 0);
}
}
- searchIn(text7) {
+ searchIn(text2) {
const { isCaseSensitive, includeMatches } = this.options;
if (!isCaseSensitive) {
- text7 = text7.toLowerCase();
+ text2 = text2.toLowerCase();
}
- if (this.pattern === text7) {
+ if (this.pattern === text2) {
let result2 = {
isMatch: true,
score: 0
};
if (includeMatches) {
- result2.indices = [[0, text7.length - 1]];
+ result2.indices = [[0, text2.length - 1]];
}
return result2;
}
@@ -114031,7 +113931,7 @@ var BitapSearch = class {
let totalScore = 0;
let hasMatches = false;
this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
- const { isMatch: isMatch2, score, indices } = search(text7, pattern, alphabet, {
+ const { isMatch: isMatch2, score, indices } = search(text2, pattern, alphabet, {
location: location + startIndex,
distance: distance2,
threshold,
@@ -114088,8 +113988,8 @@ var ExactMatch = class extends BaseMatch {
static get singleRegex() {
return /^=(.*)$/;
}
- search(text7) {
- const isMatch2 = text7 === this.pattern;
+ search(text2) {
+ const isMatch2 = text2 === this.pattern;
return {
isMatch: isMatch2,
score: isMatch2 ? 0 : 1,
@@ -114110,13 +114010,13 @@ var InverseExactMatch = class extends BaseMatch {
static get singleRegex() {
return /^!(.*)$/;
}
- search(text7) {
- const index3 = text7.indexOf(this.pattern);
- const isMatch2 = index3 === -1;
+ search(text2) {
+ const index2 = text2.indexOf(this.pattern);
+ const isMatch2 = index2 === -1;
return {
isMatch: isMatch2,
score: isMatch2 ? 0 : 1,
- indices: [0, text7.length - 1]
+ indices: [0, text2.length - 1]
};
}
};
@@ -114133,8 +114033,8 @@ var PrefixExactMatch = class extends BaseMatch {
static get singleRegex() {
return /^\^(.*)$/;
}
- search(text7) {
- const isMatch2 = text7.startsWith(this.pattern);
+ search(text2) {
+ const isMatch2 = text2.startsWith(this.pattern);
return {
isMatch: isMatch2,
score: isMatch2 ? 0 : 1,
@@ -114155,12 +114055,12 @@ var InversePrefixExactMatch = class extends BaseMatch {
static get singleRegex() {
return /^!\^(.*)$/;
}
- search(text7) {
- const isMatch2 = !text7.startsWith(this.pattern);
+ search(text2) {
+ const isMatch2 = !text2.startsWith(this.pattern);
return {
isMatch: isMatch2,
score: isMatch2 ? 0 : 1,
- indices: [0, text7.length - 1]
+ indices: [0, text2.length - 1]
};
}
};
@@ -114177,12 +114077,12 @@ var SuffixExactMatch = class extends BaseMatch {
static get singleRegex() {
return /^(.*)\$$/;
}
- search(text7) {
- const isMatch2 = text7.endsWith(this.pattern);
+ search(text2) {
+ const isMatch2 = text2.endsWith(this.pattern);
return {
isMatch: isMatch2,
score: isMatch2 ? 0 : 1,
- indices: [text7.length - this.pattern.length, text7.length - 1]
+ indices: [text2.length - this.pattern.length, text2.length - 1]
};
}
};
@@ -114199,12 +114099,12 @@ var InverseSuffixExactMatch = class extends BaseMatch {
static get singleRegex() {
return /^!(.*)\$$/;
}
- search(text7) {
- const isMatch2 = !text7.endsWith(this.pattern);
+ search(text2) {
+ const isMatch2 = !text2.endsWith(this.pattern);
return {
isMatch: isMatch2,
score: isMatch2 ? 0 : 1,
- indices: [0, text7.length - 1]
+ indices: [0, text2.length - 1]
};
}
};
@@ -114240,8 +114140,8 @@ var FuzzyMatch = class extends BaseMatch {
static get singleRegex() {
return /^(.*)$/;
}
- search(text7) {
- return this._bitapSearch.searchIn(text7);
+ search(text2) {
+ return this._bitapSearch.searchIn(text2);
}
};
var IncludeMatch = class extends BaseMatch {
@@ -114257,14 +114157,14 @@ var IncludeMatch = class extends BaseMatch {
static get singleRegex() {
return /^'(.*)$/;
}
- search(text7) {
+ search(text2) {
let location = 0;
- let index3;
+ let index2;
const indices = [];
const patternLen = this.pattern.length;
- while ((index3 = text7.indexOf(this.pattern, location)) > -1) {
- location = index3 + patternLen;
- indices.push([index3, location - 1]);
+ while ((index2 = text2.indexOf(this.pattern, location)) > -1) {
+ location = index2 + patternLen;
+ indices.push([index2, location - 1]);
}
const isMatch2 = !!indices.length;
return {
@@ -114348,7 +114248,7 @@ var ExtendedSearch = class {
static condition(_15, options) {
return options.useExtendedSearch;
}
- searchIn(text7) {
+ searchIn(text2) {
const query = this.query;
if (!query) {
return {
@@ -114357,7 +114257,7 @@ var ExtendedSearch = class {
};
}
const { includeMatches, isCaseSensitive } = this.options;
- text7 = isCaseSensitive ? text7 : text7.toLowerCase();
+ text2 = isCaseSensitive ? text2 : text2.toLowerCase();
let numMatches = 0;
let allIndices = [];
let totalScore = 0;
@@ -114367,7 +114267,7 @@ var ExtendedSearch = class {
numMatches = 0;
for (let j = 0, pLen = searchers2.length; j < pLen; j += 1) {
const searcher = searchers2[j];
- const { isMatch: isMatch2, indices, score } = searcher.search(text7);
+ const { isMatch: isMatch2, indices, score } = searcher.search(text2);
if (isMatch2) {
numMatches += 1;
totalScore += score;
@@ -114428,25 +114328,25 @@ var isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOper
var isPath = (query) => !!query[KeyType.PATH];
var isLeaf = (query) => !isArray4(query) && isObject2(query) && !isExpression(query);
var convertToExplicit = (query) => ({
- [LogicalOperator.AND]: Object.keys(query).map((key3) => ({
- [key3]: query[key3]
+ [LogicalOperator.AND]: Object.keys(query).map((key2) => ({
+ [key2]: query[key2]
}))
});
function parse6(query, options, { auto = true } = {}) {
const next = (query2) => {
- let keys2 = Object.keys(query2);
+ let keys = Object.keys(query2);
const isQueryPath = isPath(query2);
- if (!isQueryPath && keys2.length > 1 && !isExpression(query2)) {
+ if (!isQueryPath && keys.length > 1 && !isExpression(query2)) {
return next(convertToExplicit(query2));
}
if (isLeaf(query2)) {
- const key3 = isQueryPath ? query2[KeyType.PATH] : keys2[0];
- const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key3];
+ const key2 = isQueryPath ? query2[KeyType.PATH] : keys[0];
+ const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key2];
if (!isString4(pattern)) {
- throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key3));
+ throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key2));
}
const obj = {
- keyId: createKeyId(key3),
+ keyId: createKeyId(key2),
pattern
};
if (auto) {
@@ -114454,19 +114354,19 @@ function parse6(query, options, { auto = true } = {}) {
}
return obj;
}
- let node2 = {
+ let node = {
children: [],
- operator: keys2[0]
+ operator: keys[0]
};
- keys2.forEach((key3) => {
- const value = query2[key3];
+ keys.forEach((key2) => {
+ const value = query2[key2];
if (isArray4(value)) {
value.forEach((item) => {
- node2.children.push(next(item));
+ node.children.push(next(item));
});
}
});
- return node2;
+ return node;
};
if (!isExpression(query)) {
query = convertToExplicit(query);
@@ -114476,8 +114376,8 @@ function parse6(query, options, { auto = true } = {}) {
function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
results.forEach((result) => {
let totalScore = 1;
- result.matches.forEach(({ key: key3, norm: norm3, score }) => {
- const weight = key3 ? key3.weight : null;
+ result.matches.forEach(({ key: key2, norm: norm3, score }) => {
+ const weight = key2 ? key2.weight : null;
totalScore *= Math.pow(
score === 0 && weight ? Number.EPSILON : score,
(weight || 1) * (ignoreFieldNorm ? 1 : norm3)
@@ -114486,9 +114386,9 @@ function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
result.score = totalScore;
});
}
-function transformMatches(result, data3) {
+function transformMatches(result, data2) {
const matches = result.matches;
- data3.matches = [];
+ data2.matches = [];
if (!isDefined(matches)) {
return;
}
@@ -114507,11 +114407,11 @@ function transformMatches(result, data3) {
if (match2.idx > -1) {
obj.refIndex = match2.idx;
}
- data3.matches.push(obj);
+ data2.matches.push(obj);
});
}
-function transformScore(result, data3) {
- data3.score = result.score;
+function transformScore(result, data2) {
+ data2.score = result.score;
}
function format7(results, docs, {
includeMatches = Config.includeMatches,
@@ -114524,33 +114424,33 @@ function format7(results, docs, {
transformers.push(transformScore);
return results.map((result) => {
const { idx } = result;
- const data3 = {
+ const data2 = {
item: docs[idx],
refIndex: idx
};
if (transformers.length) {
transformers.forEach((transformer) => {
- transformer(result, data3);
+ transformer(result, data2);
});
}
- return data3;
+ return data2;
});
}
var Fuse = class {
- constructor(docs, options = {}, index3) {
+ constructor(docs, options = {}, index2) {
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, index3);
+ this.setCollection(docs, index2);
}
- setCollection(docs, index3) {
+ setCollection(docs, index2) {
this._docs = docs;
- if (index3 && !(index3 instanceof FuseIndex)) {
+ if (index2 && !(index2 instanceof FuseIndex)) {
throw new Error(INCORRECT_INDEX_TYPE);
}
- this._myIndex = index3 || createIndex2(this.options.keys, this._docs, {
+ this._myIndex = index2 || createIndex2(this.options.keys, this._docs, {
getFn: this.options.getFn,
fieldNormWeight: this.options.fieldNormWeight
});
@@ -114607,16 +114507,16 @@ var Fuse = class {
const searcher = createSearcher(query, this.options);
const { records } = this._myIndex;
const results = [];
- records.forEach(({ v: text7, i: idx, n: norm3 }) => {
- if (!isDefined(text7)) {
+ records.forEach(({ v: text2, i: idx, n: norm3 }) => {
+ if (!isDefined(text2)) {
return;
}
- const { isMatch: isMatch2, score, indices } = searcher.searchIn(text7);
+ const { isMatch: isMatch2, score, indices } = searcher.searchIn(text2);
if (isMatch2) {
results.push({
- item: text7,
+ item: text2,
idx,
- matches: [{ score, value: text7, norm: norm3, indices }]
+ matches: [{ score, value: text2, norm: norm3, indices }]
});
}
});
@@ -114624,9 +114524,9 @@ var Fuse = class {
}
_searchLogical(query) {
const expression = parse6(query, this.options);
- const evaluate2 = (node2, item, idx) => {
- if (!node2.children) {
- const { keyId, searcher } = node2;
+ const evaluate2 = (node, item, idx) => {
+ if (!node.children) {
+ const { keyId, searcher } = node;
const matches = this._findMatches({
key: this._keyStore.get(keyId),
value: this._myIndex.getValueForItemAtKeyId(item, keyId),
@@ -114644,12 +114544,12 @@ var Fuse = class {
return [];
}
const res = [];
- for (let i4 = 0, len = node2.children.length; i4 < len; i4 += 1) {
- const child = node2.children[i4];
+ for (let i4 = 0, len = node.children.length; i4 < len; i4 += 1) {
+ const child = node.children[i4];
const result = evaluate2(child, item, idx);
if (result.length) {
res.push(...result);
- } else if (node2.operator === LogicalOperator.AND) {
+ } else if (node.operator === LogicalOperator.AND) {
return [];
}
}
@@ -114676,17 +114576,17 @@ var Fuse = class {
}
_searchObjectList(query) {
const searcher = createSearcher(query, this.options);
- const { keys: keys2, records } = this._myIndex;
+ const { keys, records } = this._myIndex;
const results = [];
records.forEach(({ $: item, i: idx }) => {
if (!isDefined(item)) {
return;
}
let matches = [];
- keys2.forEach((key3, keyIndex) => {
+ keys.forEach((key2, keyIndex) => {
matches.push(
...this._findMatches({
- key: key3,
+ key: key2,
value: item[keyIndex],
searcher
})
@@ -114702,22 +114602,22 @@ var Fuse = class {
});
return results;
}
- _findMatches({ key: key3, value, searcher }) {
+ _findMatches({ key: key2, value, searcher }) {
if (!isDefined(value)) {
return [];
}
let matches = [];
if (isArray4(value)) {
- value.forEach(({ v: text7, i: idx, n: norm3 }) => {
- if (!isDefined(text7)) {
+ value.forEach(({ v: text2, i: idx, n: norm3 }) => {
+ if (!isDefined(text2)) {
return;
}
- const { isMatch: isMatch2, score, indices } = searcher.searchIn(text7);
+ const { isMatch: isMatch2, score, indices } = searcher.searchIn(text2);
if (isMatch2) {
matches.push({
score,
- key: key3,
- value: text7,
+ key: key2,
+ value: text2,
idx,
norm: norm3,
indices
@@ -114725,10 +114625,10 @@ var Fuse = class {
}
});
} else {
- const { v: text7, n: norm3 } = value;
- const { isMatch: isMatch2, score, indices } = searcher.searchIn(text7);
+ const { v: text2, n: norm3 } = value;
+ const { isMatch: isMatch2, score, indices } = searcher.searchIn(text2);
if (isMatch2) {
- matches.push({ score, key: key3, value: text7, norm: norm3, indices });
+ matches.push({ score, key: key2, value: text2, norm: norm3, indices });
}
}
return matches;
@@ -114768,7 +114668,7 @@ var STYLE_PROPS = [
];
var SelectMenuSearch = (0, import_react75.forwardRef)(
(props, input) => {
- const { classNames: classNames13, inputAttributes, inputEventHandlers, index: index3 } = props;
+ const { classNames: classNames13, inputAttributes, inputEventHandlers, index: index2 } = props;
const sizer = (0, import_react75.useRef)(null);
const [inputWidth, setInputWidth] = (0, import_react75.useState)(null);
const [query, setQuery] = (0, import_react75.useState)("");
@@ -114920,13 +114820,13 @@ var SelectMenuInput = (props) => {
});
};
var SelectMenuSuggestions = (props) => {
- const options = props.options.map((item, index3) => {
- const key3 = `${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}`;
+ 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}`;
return /* @__PURE__ */ import_react77.default.createElement("div", {
ref: (ref2) => {
if (props.refs?.current)
- props.refs.current[index3] = ref2;
+ props.refs.current[index2] = ref2;
},
onMouseDown: (e5) => {
if (!props.isDisclosureMenu)
@@ -114935,7 +114835,7 @@ var SelectMenuSuggestions = (props) => {
},
onClick: (e5) => {
if (item.onSubmenu && props.openSubmenu) {
- const el = props.refs?.current[index3].getBoundingClientRect();
+ const el = props.refs?.current[index2].getBoundingClientRect();
props.openSubmenu(item.onSubmenu(el));
} else if (item.onClick) {
item.onClick(e5);
@@ -114956,8 +114856,8 @@ var SelectMenuSuggestions = (props) => {
}
}
},
- id: key3,
- key: key3,
+ id: key2,
+ key: key2,
className
}, item.type == -1 /* Separator */ ? /* @__PURE__ */ import_react77.default.createElement(import_react77.default.Fragment, null) : item.type == -2 /* Section */ ? /* @__PURE__ */ import_react77.default.createElement("div", {
className: "mk-menu-options-section"
@@ -114970,7 +114870,7 @@ var SelectMenuSuggestions = (props) => {
ui: props.ui,
item,
query: props.query,
- active: index3 == props.index,
+ active: index2 == props.index,
onMoreOption: props.moreOption,
onDeleteOption: props.deleteOption
}));
@@ -115005,7 +114905,7 @@ function focusNextElement(scope, currentTarget) {
const interactiveEls = scope.querySelectorAll("a,button,input");
const currentEl = Array.prototype.findIndex.call(
interactiveEls,
- (element3) => element3 === currentTarget
+ (element) => element === currentTarget
);
const nextEl = interactiveEls[currentEl - 1] || interactiveEls[currentEl + 1];
if (nextEl) {
@@ -115056,12 +114956,12 @@ var defaultProps = {
inputAttributes: {}
};
var findMatchIndex = (options, query) => {
- return options.findIndex((option2) => matchExact(query).test(option2.name));
+ return options.findIndex((option) => matchExact(query).test(option.name));
};
-var pressDelimiter = (props, query, index3, options, addTag2, modifiers) => {
+var pressDelimiter = (props, query, index2, options, addTag2, modifiers) => {
if (query.length >= props.minQueryLength) {
const match2 = findMatchIndex(options, query);
- const _index = index3 === -1 ? match2 : index3;
+ const _index = index2 === -1 ? match2 : index2;
const tag2 = _index > -1 ? options[_index] : null;
if (tag2) {
addTag2(tag2, modifiers);
@@ -115120,7 +115020,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
const [section, setSection] = (0, import_react78.useState)("");
const [query, setQuery] = (0, import_react78.useState)("");
const [focused, setFocused] = (0, import_react78.useState)(false);
- const [index3, setIndex] = (0, import_react78.useState)(0);
+ const [index2, setIndex] = (0, import_react78.useState)(0);
const onComposition = (0, import_react78.useRef)(false);
(0, import_react78.useEffect)(() => {
if (ref2) {
@@ -115158,17 +115058,17 @@ var SelectMenuComponent = import_react78.default.forwardRef(
props.onInput(_query);
}
if (_query.length === query.length + 1 && props.delimiters.indexOf(query.slice(-1)) > -1) {
- pressDelimiter(props, query, index3, options, addTag2, {});
+ pressDelimiter(props, query, index2, options, addTag2, {});
} else if (_query !== query) {
setQuery(_query);
}
};
const onKeyDown = (e5) => {
if (props.delimiters.indexOf(e5.key) > -1) {
- if (query || index3 > -1) {
+ if (query || index2 > -1) {
e5.preventDefault();
}
- pressDelimiter(props, query, index3, options, addTag2, {
+ pressDelimiter(props, query, index2, options, addTag2, {
ctrlKey: e5.ctrlKey,
metaKey: e5.metaKey,
altKey: e5.altKey,
@@ -115204,11 +115104,11 @@ var SelectMenuComponent = import_react78.default.forwardRef(
props.onFocus();
}
};
- const onDeleteTag = (index4, event) => {
+ const onDeleteTag = (index3, event) => {
if (container.current) {
focusNextElement(container.current, event.currentTarget);
}
- deleteTag(index4);
+ deleteTag(index3);
};
const addTag2 = (tag2, modifiers) => {
if (tag2.disabled) {
@@ -115233,7 +115133,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
const pressUpKey = (e5) => {
e5.preventDefault();
const size2 = options.length - 1;
- const newIndex = index3 <= 0 ? size2 : index3 - 1;
+ const newIndex = index2 <= 0 ? size2 : index2 - 1;
if (options[newIndex].disabled) {
setIndex(newIndex <= 0 ? size2 : newIndex - 1);
} else {
@@ -115243,7 +115143,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
const pressDownKey = (e5) => {
e5.preventDefault();
const size2 = options.length - 1;
- const newIndex = index3 >= size2 ? 0 : index3 + 1;
+ const newIndex = index2 >= size2 ? 0 : index2 + 1;
if (options[newIndex].disabled) {
setIndex(newIndex >= size2 ? 0 : newIndex + 1);
} else {
@@ -115259,11 +115159,11 @@ var SelectMenuComponent = import_react78.default.forwardRef(
if (props.showSections) {
e5.preventDefault();
e5.stopPropagation();
- setSection((p2) => {
- const sectionIndex = sections.findIndex((g) => g.value == p2);
+ setSection((p) => {
+ const sectionIndex = sections.findIndex((g) => g.value == p);
if (e5.shiftKey) {
if (sectionIndex == 0) {
- return p2;
+ return p;
}
if (props.onSelectSection) {
props.onSelectSection(sections[sectionIndex - 1].value);
@@ -115271,7 +115171,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
return sections[sectionIndex - 1].value;
}
if (sectionIndex == sections.length - 1) {
- return p2;
+ return p;
}
if (props.onSelectSection) {
props.onSelectSection(sections[sectionIndex + 1].value);
@@ -115298,7 +115198,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
return () => {
props.ui.inputManager.off("keydown", onKeyDown);
};
- }, [options, index3]);
+ }, [options, index2]);
const expanded = focused && query.length >= props.minQueryLength;
const classNames13 = Object.assign({}, CLASS_NAMES, props.classNames);
if (props.wrapperClass) {
@@ -115336,7 +115236,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
ui: props.ui,
ref: inputRef,
query,
- index: index3,
+ index: index2,
id: props.id,
classNames: classNames13,
inputAttributes: props.inputAttributes,
@@ -115362,7 +115262,7 @@ var SelectMenuComponent = import_react78.default.forwardRef(
options,
query,
setIndex,
- index: index3,
+ index: index2,
id: props.id,
classNames: classNames13,
expanded,
@@ -115521,12 +115421,12 @@ var NoteView = (0, import_react80.forwardRef)((props, ref2) => {
const [loaded, setLoaded] = (0, import_react80.useState)(false);
const loadPath = async (force) => {
const div2 = flowRef.current;
- const path3 = props.superstate.spaceManager.uriByString(
+ const path2 = props.superstate.spaceManager.uriByString(
props.path,
props.source
);
const properties3 = props.properties;
- const pathState = props.superstate.pathsIndex.get(path3.path);
+ const pathState = props.superstate.pathsIndex.get(path2.path);
const filePath = pathState?.type == "space" ? props.superstate.spacesIndex.get(props.path)?.defPath : pathState?.path;
if (!filePath) {
if (!force) {
@@ -115535,7 +115435,7 @@ var NoteView = (0, import_react80.forwardRef)((props, ref2) => {
return;
} else {
const parent = props.superstate.spaceManager.parentPathForPath(
- path3.path
+ path2.path
);
if (!parent)
return;
@@ -115619,15 +115519,15 @@ var PathContextList = (props) => {
(f3) => f3[PathPropertyName] == pathState.path
);
f2.cols.filter((f3) => f3.primary != "true").forEach((g) => {
- const index3 = properties3.findIndex((h3) => h3.property.name == g.name);
- if (index3 == -1) {
+ const index2 = properties3.findIndex((h3) => h3.property.name == g.name);
+ if (index2 == -1) {
properties3.push({
property: g,
contexts: [f2.path],
value: row2?.[g.name] ?? ""
});
} else {
- properties3[index3].contexts.push(f2.path);
+ properties3[index2].contexts.push(f2.path);
}
});
}, []);
@@ -115769,7 +115669,7 @@ var PropertiesView = (props) => {
const pathContexts = props.superstate.spacesMap.get(pathState.path) ?? /* @__PURE__ */ new Set();
const columns = [...pathContexts].map(
(f2) => props.superstate.contextsIndex.get(f2)?.tables?.[defaultContextSchemaID]?.cols ?? []
- ).reduce((p2, c3) => [...p2, ...c3], []);
+ ).reduce((p, c3) => [...p, ...c3], []);
const newCols = [];
const newValues = {};
const properties3 = pathState?.metadata?.property ?? {};
@@ -115843,15 +115743,15 @@ var PropertiesView = (props) => {
}
deleteProperty(props.superstate, pathState.path, property.name);
};
- const saveMetadata = async (property, space3) => {
+ const saveMetadata = async (property, space2) => {
const field = {
...property,
schemaId: defaultContextSchemaID
};
- const spaceInfo = props.superstate.spacesIndex.get(space3)?.space;
+ const spaceInfo = props.superstate.spacesIndex.get(space2)?.space;
if (!spaceInfo)
return;
- await props.superstate.spaceManager.addSpaceProperty(space3, field);
+ await props.superstate.spaceManager.addSpaceProperty(space2, field);
await updateContextValue(
props.superstate.spaceManager,
spaceInfo,
@@ -115887,31 +115787,31 @@ var PropertiesView = (props) => {
"bottom"
);
};
- const renameFMKey = (key3, name317) => {
+ const renameFMKey = (key2, name317) => {
if (saveProperty) {
- const property = tableData?.cols?.find((g) => g.name == key3);
+ const property = tableData?.cols?.find((g) => g.name == key2);
if (property)
saveProperty({ ...property, name: name317 }, property);
}
- renameProperty(props.superstate, pathState.path, key3, name317);
+ renameProperty(props.superstate, pathState.path, key2, name317);
};
- const selectedType = (value, key3) => {
+ const selectedType = (value, key2) => {
if (saveProperty) {
- const property = tableData?.cols?.find((g) => g.name == key3);
+ const property = tableData?.cols?.find((g) => g.name == key2);
if (property)
saveProperty({ ...property, type: value[0] }, property);
}
saveProperties(props.superstate, pathState.path, {
- [key3]: defaultValueForType(value[0])
+ [key2]: defaultValueForType(value[0])
});
};
- const selectType = (r2, key3) => {
+ const selectType = (r2, key2) => {
props.superstate.ui.openMenu(r2, {
ui: props.superstate.ui,
multi: false,
editable: false,
searchable: false,
- saveOptions: (_15, v2) => selectedType(v2, key3),
+ saveOptions: (_15, v2) => selectedType(v2, key2),
value: [],
showAll: true,
options: fieldTypes.filter((f2) => f2.metadata).map((f2, i4) => ({
@@ -116052,15 +115952,15 @@ var ContextPropertiesView = (props) => {
};
// src/core/react/components/Explorer/Explorer.tsx
-var isLeafNode = (node2) => {
- if (node2.type == "metadata" && (node2.subType == "properties" || node2.subType == "flow"))
+var isLeafNode = (node) => {
+ if (node.type == "metadata" && (node.subType == "properties" || node.subType == "flow"))
return true;
return false;
};
-var childrenForNode = (superstate, node2, index3, depth) => {
- let i4 = index3;
+var childrenForNode = (superstate, node, index2, depth) => {
+ let i4 = index2;
const items = [];
- if (node2.type == "path") {
+ if (node.type == "path") {
const metadataTypes = [];
metadataTypes.push({
type: "properties",
@@ -116095,50 +115995,50 @@ var childrenForNode = (superstate, node2, index3, depth) => {
);
items.push(
...metadataTypes.map((f2, k2) => ({
- id: node2.id + "/" + f2.type,
- parentId: node2.id,
+ id: node.id + "/" + f2.type,
+ parentId: node.id,
type: "metadata",
subType: f2.type,
index: i4 + k2,
- path: node2.path,
+ path: node.path,
label: f2.label,
sticker: f2.sticker,
value: f2.type,
depth,
- parentPath: node2.parentPath
+ parentPath: node.parentPath
}))
);
- } else if (node2.type == "metadata") {
- if (node2.subType == "tables") {
+ } else if (node.type == "metadata") {
+ if (node.subType == "tables") {
items.push(
...[
- ...(superstate.contextsIndex.get(node2.path)?.schemas ?? []).filter(
+ ...(superstate.contextsIndex.get(node.path)?.schemas ?? []).filter(
(f2) => f2.name != defaultContextSchemaID
)
].map((f2, k2) => ({
- id: node2.id + "/" + f2.id,
- parentId: node2.id,
+ id: node.id + "/" + f2.id,
+ parentId: node.id,
type: "schema",
- path: node2.path,
+ path: node.path,
index: i4 + k2,
sticker: "",
label: f2.name,
value: f2.id,
depth,
- parentPath: node2.path
+ parentPath: node.path
}))
);
}
let paths = [];
- if (node2.subType == "inlinks") {
- paths = [...superstate.linksMap.getInverse(node2.path)];
- } else if (node2.subType == "outlinks") {
- paths = [...superstate.linksMap.get(node2.path)];
+ if (node.subType == "inlinks") {
+ paths = [...superstate.linksMap.getInverse(node.path)];
+ } else if (node.subType == "outlinks") {
+ paths = [...superstate.linksMap.get(node.path)];
}
items.push(
...paths.map((f2) => superstate.pathsIndex.get(f2)).filter((f2) => f2).map((f2, k2) => ({
- id: node2.id + "/" + node2.value,
- parentId: node2.id,
+ id: node.id + "/" + node.value,
+ parentId: node.id,
type: "path",
path: f2.path,
index: i4 + k2,
@@ -116146,38 +116046,38 @@ var childrenForNode = (superstate, node2, index3, depth) => {
label: f2.name,
value: f2.path,
depth,
- parentPath: node2.path
+ parentPath: node.path
}))
);
}
i4 += items.length;
return items;
};
-var flattenTree = (superstate, node2, openNodes, depth, index3) => {
+var flattenTree = (superstate, node, openNodes, depth, index2) => {
const items = [];
- let i4 = index3;
- const leafNode = isLeafNode(node2);
+ let i4 = index2;
+ const leafNode = isLeafNode(node);
if (!leafNode) {
- const children = childrenForNode(superstate, node2, i4, depth);
+ const children = childrenForNode(superstate, node, i4, depth);
const newItems = [];
- if (openNodes.some((f2) => f2 == node2.id)) {
+ if (openNodes.some((f2) => f2 == node.id)) {
children.forEach((f2) => {
i4 = i4 + 1;
newItems.push(...flattenTree(superstate, f2, openNodes, depth + 1, i4));
});
}
- if (node2.type != "metadata" || children.length != 0)
- items.push({ ...node2, children: children.length, isLeafNode: leafNode });
+ if (node.type != "metadata" || children.length != 0)
+ items.push({ ...node, children: children.length, isLeafNode: leafNode });
items.push(...newItems);
} else {
- items.push({ ...node2, isLeafNode: leafNode });
+ items.push({ ...node, isLeafNode: leafNode });
}
return items;
};
var Explorer = (props) => {
const [selectedPath, setSelectedPath] = (0, import_react84.useState)(null);
- const changeSelectedPath = (path3) => {
- setSelectedPath(path3);
+ const changeSelectedPath = (path2) => {
+ setSelectedPath(path2);
};
(0, import_react84.useEffect)(() => {
props.superstate.ui.eventsDispatch.addListener(
@@ -116235,7 +116135,7 @@ var PathContextView = (props) => {
superstate: props.superstate,
collapsed: !openNodes.some((g) => g == f2.id),
onToggle: (collapsed) => setOpenNodes(
- (p2) => p2.some((g) => g == f2.id) ? p2.filter((o2) => o2 != f2.id) : [...p2, f2.id]
+ (p) => p.some((g) => g == f2.id) ? p.filter((o2) => o2 != f2.id) : [...p, f2.id]
)
}) : /* @__PURE__ */ import_react84.default.createElement(import_react84.default.Fragment, null), f2.type == "metadata" ? f2.subType == "flow" ? /* @__PURE__ */ import_react84.default.createElement(ExplorerFlowRow, {
path: f2.path,
@@ -116269,22 +116169,22 @@ var PathContextView = (props) => {
}, f2.label)))))) : /* @__PURE__ */ import_react84.default.createElement(import_react84.default.Fragment, null));
};
var ExplorerFlowRow = (props) => {
- const path3 = (0, import_react84.useMemo)(() => {
+ const path2 = (0, import_react84.useMemo)(() => {
const spaceCache = props.superstate.spacesIndex.get(props.path);
if (spaceCache)
return spaceCache.space.defPath;
return props.path;
}, [props.path]);
const [block, setBlock] = (0, import_react84.useState)([null, null]);
- const refreshBlock = (path4) => {
- const fCache = props.superstate.pathsIndex.get(path4);
- const link3 = [
+ const refreshBlock = (path3) => {
+ const fCache = props.superstate.pathsIndex.get(path3);
+ const link = [
...fCache?.metadata.links ?? [],
...fCache?.metadata.embeds ?? []
].find((f2) => props.source && props.source.includes(f2.displayText));
- if (link3) {
+ if (link) {
const block2 = fCache.metadata.sections.find(
- (f2) => f2.position.start.offset <= link3.position.start.offset && f2.position.end.offset >= link3.position.end.offset
+ (f2) => f2.position.start.offset <= link.position.start.offset && f2.position.end.offset >= link.position.end.offset
);
if (!block2)
setBlock([null, null]);
@@ -116304,17 +116204,17 @@ var ExplorerFlowRow = (props) => {
}
};
(0, import_react84.useEffect)(() => {
- refreshBlock(path3);
+ refreshBlock(path2);
}, []);
(0, import_react84.useEffect)(() => {
- refreshBlock(path3);
- }, [path3]);
+ refreshBlock(path2);
+ }, [path2]);
return /* @__PURE__ */ import_react84.default.createElement(import_react84.default.Fragment, null, /* @__PURE__ */ import_react84.default.createElement("div", {
className: "mk-path-context-backlink"
}, /* @__PURE__ */ import_react84.default.createElement(NoteView, {
load: true,
superstate: props.superstate,
- path: path3,
+ path: path2,
properties: {
from: block[0]?.line,
to: block[1] ? block[1].line + 1 : null
@@ -116323,9 +116223,9 @@ var ExplorerFlowRow = (props) => {
})));
};
var ExplorerContextRow = (props) => {
- const { node: node2, superstate } = props;
+ const { node, superstate } = props;
const [spaceCache, setSpaceCache] = (0, import_react84.useState)(
- superstate.spacesIndex.get(node2.path)
+ superstate.spacesIndex.get(node.path)
);
return /* @__PURE__ */ import_react84.default.createElement(ContextPropertiesView, {
superstate: props.superstate,
@@ -116334,7 +116234,7 @@ var ExplorerContextRow = (props) => {
};
// src/core/react/components/MDBView/MDBViewer.tsx
-var import_react175 = __toESM(require_react());
+var import_react155 = __toESM(require_react());
// src/core/react/context/FrameSelectionContext.tsx
var import_react88 = __toESM(require_react());
@@ -116384,11 +116284,11 @@ var FrameEditorProvider = (props) => {
(f2) => f2.id == frameSchema.id ? {
...frameToNode(f2),
types: tableData.cols.reduce(
- (p2, c3) => ({ ...p2, [c3.name]: c3.type }),
+ (p, c3) => ({ ...p, [c3.name]: c3.type }),
{}
),
propsValue: tableData.cols.reduce(
- (p2, c3) => ({ ...p2, [c3.name]: c3.value }),
+ (p, c3) => ({ ...p, [c3.name]: c3.value }),
{}
)
} : frameToNode(f2)
@@ -116399,20 +116299,20 @@ var FrameEditorProvider = (props) => {
}
return [...frames, _root];
}, [tableData, frameSchema]);
- const [root4, setRoot] = (0, import_react85.useState)(null);
+ const [root, setRoot] = (0, import_react85.useState)(null);
const frameProperties = (0, import_react85.useMemo)(() => {
const hiddenFields = [
...FMMetadataKeys(props.superstate.settings),
...FMSpaceKeys(props.superstate.settings)
];
- return root4?.id ? [
+ return root?.id ? [
...tableData?.cols.map((f2) => ({ ...f2, table: "" })) ?? [],
...(props.cols ?? []).map((f2) => ({
...f2,
- schemaId: root4.id
+ schemaId: root.id
}))
].filter((f2) => hiddenFields.some((g) => g == f2.name) == false) : [];
- }, [root4, props.cols]);
+ }, [root, props.cols]);
const initiateRoot = () => {
if (frameSchema?.type == "frame") {
const _newRoot = buildRoot(
@@ -116431,7 +116331,7 @@ var FrameEditorProvider = (props) => {
screenType: props.superstate.ui.getScreenType()
}
);
- if (executableChanged(_newRoot, root4)) {
+ if (executableChanged(_newRoot, root)) {
setRoot(_newRoot);
}
}
@@ -116458,18 +116358,18 @@ var FrameEditorProvider = (props) => {
initiateRoot();
}, [frameSchema, nodes, tableData, props.editMode]);
const updateNode = (_node, state) => {
- const node2 = nodes.find((f2) => f2.id == _node.id);
- if (!node2)
+ const node = nodes.find((f2) => f2.id == _node.id);
+ if (!node)
return;
if (selectedSlide) {
const existingDeltaNode = nodes.find(
- (f2) => f2.parentId == selectedSlide && f2.ref == node2.id
+ (f2) => f2.parentId == selectedSlide && f2.ref == node.id
);
if (!existingDeltaNode) {
addNode(
{
...deltaNode.node,
- ref: node2.id,
+ ref: node.id,
...state
},
nodes.find((f2) => f2.id == selectedSlide),
@@ -116497,26 +116397,26 @@ var FrameEditorProvider = (props) => {
} else {
saveNodes([
{
- ...node2,
+ ...node,
props: state.props ? {
- ...node2.props,
+ ...node.props,
...state.props
- } : node2.props,
+ } : node.props,
styles: state.styles ? {
- ...node2.styles,
+ ...node.styles,
...state.styles
- } : node2.styles,
+ } : node.styles,
actions: state.actions ? {
- ...node2.actions,
+ ...node.actions,
...state.actions
- } : node2.actions
+ } : node.actions
}
]);
}
};
- const moveUp = (node2) => {
- const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 }));
- const itemIndex = items.findIndex((item2) => item2.id === node2.id);
+ const moveUp = (node) => {
+ const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 }));
+ const itemIndex = items.findIndex((item2) => item2.id === node.id);
if (itemIndex <= 0) {
saveNodes(items);
return;
@@ -116526,9 +116426,9 @@ var FrameEditorProvider = (props) => {
[item.rank, swappedItem.rank] = [swappedItem.rank, item.rank];
saveNodes(items);
};
- const moveDown = (node2) => {
- const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 }));
- const itemIndex = items.findIndex((item2) => item2.id === node2.id);
+ const moveDown = (node) => {
+ const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 }));
+ const itemIndex = items.findIndex((item2) => item2.id === node.id);
if (itemIndex < 0 || itemIndex >= items.length - 1) {
saveNodes(items);
return;
@@ -116538,20 +116438,20 @@ var FrameEditorProvider = (props) => {
[item.rank, swappedItem.rank] = [swappedItem.rank, item.rank];
saveNodes(items.sort((a4, b2) => a4.rank - b2.rank));
};
- const ungroupNode = (node2) => {
- const children = nodes.filter((f2) => f2.parentId == node2.id);
- const newRank = node2.rank;
- const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank);
+ const ungroupNode = (node) => {
+ const children = nodes.filter((f2) => f2.parentId == node.id);
+ const newRank = node.rank;
+ const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank);
const newItems = insertMulti(
items,
newRank,
- children.map((f2) => ({ ...f2, parentId: node2.parentId }))
- ).filter((f2) => f2.id != node2.id).map((f2, i4) => ({ ...f2, rank: i4 }));
- return saveNodes(newItems, [node2]);
+ children.map((f2) => ({ ...f2, parentId: node.parentId }))
+ ).filter((f2) => f2.id != node.id).map((f2, i4) => ({ ...f2, rank: i4 }));
+ return saveNodes(newItems, [node]);
};
- const moveToRank = (node2, newRank) => {
- const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 }));
- const itemIndex = items.findIndex((item2) => item2.id === node2.id);
+ const moveToRank = (node, newRank) => {
+ const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 }));
+ const itemIndex = items.findIndex((item2) => item2.id === node.id);
if (itemIndex < 0 || newRank < 0 || newRank >= items.length) {
saveNodes(items);
return;
@@ -116570,9 +116470,9 @@ var FrameEditorProvider = (props) => {
...newUniqueNode(groupNode, parentId, nodes, frameSchema.id)
};
const newNodes = treeNodes.map((f2) => {
- const node2 = import_lodash13.default.cloneDeep(f2);
- node2.parentId = group.id;
- return node2;
+ const node = import_lodash13.default.cloneDeep(f2);
+ node.parentId = group.id;
+ return node;
});
saveNodes([
{ ...group, styles: { ...group.styles, ...style } },
@@ -116580,21 +116480,21 @@ var FrameEditorProvider = (props) => {
]);
};
const addNode = async (treeNode, target, insertInto) => {
- let node2 = relinkProps("$root", frameSchema.id, treeNode, frameSchema.id);
+ let node = relinkProps("$root", frameSchema.id, treeNode, frameSchema.id);
const id3 = uniqueNameFromString(
- node2.id,
+ node.id,
nodes.map((f2) => f2.id)
);
- node2 = relinkProps(treeNode.id, id3, treeNode, frameSchema.id);
- let parent = target ? target : root4.node;
+ node = relinkProps(treeNode.id, id3, treeNode, frameSchema.id);
+ let parent = target ? target : root.node;
let rank = target ? target.rank + 1 : parent.rank;
if (!insertInto || !groupableTypes.some((f2) => parent.type == f2)) {
- parent = findParent(root4, parent.id).node;
+ parent = findParent(root, parent.id).node;
} else {
rank = nodes.filter((f2) => f2.parentId == parent.id).length;
}
const newTreeNode = {
- ...node2,
+ ...node,
id: id3,
schemaId: frameSchema.id,
parentId: parent.id
@@ -116612,7 +116512,7 @@ var FrameEditorProvider = (props) => {
if (!tableData) {
return;
}
- const newRows = tableData?.rows?.some((f2) => f2.id == root4.id) ? tableData.rows : [...tableData?.rows ?? [], nodeToFrame(root4.node)];
+ const newRows = tableData?.rows?.some((f2) => f2.id == root.id) ? tableData.rows : [...tableData?.rows ?? [], nodeToFrame(root.node)];
const insertRows2 = treeNodes.filter((f2) => !newRows.some((g) => g.id == f2.id)).map((f2) => nodeToFrame(f2));
const modRows = treeNodes.filter((f2) => newRows.some((g) => g.id == f2.id)).map((f2) => nodeToFrame(f2));
const newTable = {
@@ -116680,13 +116580,13 @@ var FrameEditorProvider = (props) => {
{ editMode: props.editMode },
true
)[0];
- const parent = findParent(root4, treeNode.id);
+ const parent = findParent(root, treeNode.id);
const modNodes = [];
const deleteNodes = flattenToFrameNodes(tree, tree.node.schemaId);
if (parent) {
if (parent.children.length == 1 && parent.node.type == "column")
deleteNodes.push(parent.node);
- const grandParent = findParent(root4, parent.id);
+ const grandParent = findParent(root, parent.id);
if (grandParent?.node.type == "container") {
if (grandParent.children.length == 1) {
deleteNodes.push(grandParent.node);
@@ -116715,7 +116615,7 @@ var FrameEditorProvider = (props) => {
const properties3 = tableData?.cols ?? [];
return /* @__PURE__ */ import_react85.default.createElement(FramesEditorRootContext.Provider, {
value: {
- root: root4,
+ root,
nodes,
properties: properties3,
addNode,
@@ -116744,7 +116644,7 @@ var FrameRootContext = import_react86.default.createContext({
path: null
});
var FrameRootProvider = (props) => {
- const [root4, setRoot] = (0, import_react86.useState)(null);
+ const [root, setRoot] = (0, import_react86.useState)(null);
const refreshFrame = (payload) => {
if (payload.path != props.path.path && props.path.authority != "$kit") {
return;
@@ -116779,7 +116679,7 @@ var FrameRootProvider = (props) => {
}, [props.path]);
return /* @__PURE__ */ import_react86.default.createElement(FrameRootContext.Provider, {
value: {
- root: root4,
+ root,
path: props.path.fullPath
}
}, props.children);
@@ -116789,7 +116689,7 @@ var FrameRootProvider = (props) => {
var FrameInstanceContext = (0, import_react87.createContext)({
id: "",
hoverNode: { id: null, node: "", direction: null },
- setHoverNode: (node2) => null,
+ setHoverNode: (node) => null,
selectableNodeBounds: { current: {} },
runRoot: () => null,
instance: null,
@@ -116809,17 +116709,17 @@ var FrameInstanceProvider = (props) => {
});
const [rootProps, setRootProps] = (0, import_react87.useState)(props.props);
(0, import_react87.useEffect)(() => {
- setRootProps((p2) => {
- if (import_lodash14.default.isEqual(p2, props.props))
- return p2;
+ setRootProps((p) => {
+ if (import_lodash14.default.isEqual(p, props.props))
+ return p;
return props.props;
});
}, [props.props]);
const { selectedSlide: _selectedSlide } = (0, import_react87.useContext)(FramesEditorRootContext);
const selectedSlide = props.editable ? _selectedSlide : null;
const { root: editableRoot } = (0, import_react87.useContext)(FramesEditorRootContext);
- const { root: nonEditableRoot, path: path3 } = (0, import_react87.useContext)(FrameRootContext);
- const root4 = (0, import_react87.useMemo)(
+ const { root: nonEditableRoot, path: path2 } = (0, import_react87.useContext)(FrameRootContext);
+ const root = (0, import_react87.useMemo)(
() => props.editable ? editableRoot : nonEditableRoot,
[props.editable, editableRoot, nonEditableRoot]
);
@@ -116852,7 +116752,7 @@ var FrameInstanceProvider = (props) => {
exec: _exec
}
).then((s4) => {
- setInstance((p2) => {
+ setInstance((p) => {
return s4;
});
});
@@ -116870,8 +116770,8 @@ var FrameInstanceProvider = (props) => {
}, [instance]);
const selectableNodeBounds = (0, import_react87.useRef)({});
const fastSaveState = (newState) => {
- setInstance((p2) => {
- return { ...p2, state: newState };
+ setInstance((p) => {
+ return { ...p, state: newState };
});
};
(0, import_react87.useEffect)(
@@ -116881,8 +116781,8 @@ var FrameInstanceProvider = (props) => {
[]
);
const runRoot = () => {
- if (root4) {
- const newRoot = import_lodash14.default.cloneDeep(root4);
+ if (root) {
+ const newRoot = import_lodash14.default.cloneDeep(root);
const runID = (0, import_lodash14.uniqueId)();
activeRunID.current = runID;
executeTreeNode(
@@ -116897,13 +116797,13 @@ var FrameInstanceProvider = (props) => {
api: props.superstate.api,
contexts: props.contexts,
saveState,
- root: root4,
+ root,
exec: newRoot,
runID,
selectedSlide
}
).then((s4) => {
- setInstance((p2) => {
+ setInstance((p) => {
return s4;
});
activeRunID.current = s4.id;
@@ -116911,12 +116811,12 @@ var FrameInstanceProvider = (props) => {
}
};
(0, import_react87.useEffect)(() => {
- if (instance.root && !executableChanged(root4, instance.root) && (0, import_lodash14.isEqual)(props.contexts, instance.contexts)) {
+ if (instance.root && !executableChanged(root, instance.root) && (0, import_lodash14.isEqual)(props.contexts, instance.contexts)) {
saveState({ [instance.root.id]: { props: rootProps } }, instance);
} else {
runRoot();
}
- }, [rootProps, root4, props.contexts]);
+ }, [rootProps, root, props.contexts]);
return /* @__PURE__ */ import_react87.default.createElement(FrameInstanceContext.Provider, {
value: {
id: props.id,
@@ -117042,11 +116942,11 @@ var FrameSelectionProvider = (props) => {
// src/core/react/components/SpaceView/Contexts/ContextListContainer.tsx
var import_lodash19 = __toESM(require_lodash());
-var import_react174 = __toESM(require_react());
+var import_react154 = __toESM(require_react());
// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListInstance.tsx
var import_lodash18 = __toESM(require_lodash());
-var import_react171 = __toESM(require_react());
+var import_react151 = __toESM(require_react());
// src/core/utils/frames/editor/dropFrame.ts
var shouldDeleteColumn = (nodeParent) => {
@@ -117067,26 +116967,26 @@ var shouldCollapseColumnContainer = (nodeParent) => {
}
return false;
};
-var dropFrame = (_activeNode, overNode, root4, nodes, direction) => {
+var dropFrame = (_activeNode, overNode, root, nodes, direction) => {
let activeNode = _activeNode;
- if (activeNode.schemaId != root4.id) {
- activeNode = relinkProps("$root", root4.id, activeNode, root4.id);
+ if (activeNode.schemaId != root.id) {
+ activeNode = relinkProps("$root", root.id, activeNode, root.id);
const id3 = uniqueNameFromString(
activeNode.id,
nodes.map((f2) => f2.id)
);
- activeNode = relinkProps(activeNode.id, id3, activeNode, root4.id);
+ activeNode = relinkProps(activeNode.id, id3, activeNode, root.id);
activeNode.id = id3;
- activeNode.schemaId = root4.id;
+ activeNode.schemaId = root.id;
}
let saveNodes = [];
const deleteNodes = [];
if (activeNode.id == overNode.id) {
return [[], []];
}
- const schemaId = root4.node.schemaId;
- const overParentNode = findParent(root4, overNode.id);
- const activeParentNode = findParent(root4, activeNode.id);
+ const schemaId = root.node.schemaId;
+ const overParentNode = findParent(root, overNode.id);
+ const activeParentNode = findParent(root, activeNode.id);
if (!overParentNode) {
return [[], []];
}
@@ -117094,13 +116994,13 @@ var dropFrame = (_activeNode, overNode, root4, nodes, direction) => {
if (direction == "inside") {
const newItem = { ...activeNode, parentId: overNode.node.id };
saveNodes.push(newItem);
- } else if (isDroppableColumn || root4.editorProps.editMode == 1 /* Page */ && overNode.node.parentId == root4.id && (direction == "left" || direction == "right")) {
- const baseLevelNode = overNode.node.parentId == root4.id;
+ } else if (isDroppableColumn || root.editorProps.editMode == 1 /* Page */ && overNode.node.parentId == root.id && (direction == "left" || direction == "right")) {
+ const baseLevelNode = overNode.node.parentId == root.id;
const containerType = overNode.node.type == "container";
const columnType = overNode.node.type == "column";
let columnContainerIsBaseLevel = false;
if (columnType) {
- if (overParentNode.node.parentId == root4.id)
+ if (overParentNode.node.parentId == root.id)
columnContainerIsBaseLevel = true;
}
const createColumnContainer = baseLevelNode && !containerType;
@@ -117155,26 +117055,26 @@ var dropFrame = (_activeNode, overNode, root4, nodes, direction) => {
saveNodes.push(...newItems);
}
if (activeParentNode && shouldDeleteColumn(activeParentNode)) {
- const columnParentNode = findParent(root4, activeParentNode.id);
+ const columnParentNode = findParent(root, activeParentNode.id);
deleteNodes.push(activeParentNode.node);
if (shouldDeleteColumnContainer(columnParentNode)) {
deleteNodes.push(columnParentNode.node);
} else if (shouldCollapseColumnContainer(columnParentNode)) {
const removeColumn = columnParentNode.children.filter((f2) => f2.id != activeParentNode.id);
deleteNodes.push(...removeColumn.map((f2) => f2.node), columnParentNode.node);
- const moveToParentNodes = removeColumn.flatMap((f2) => f2.children.map((f3) => ({ ...f3.node, parentId: root4.id, rank: columnParentNode.node.rank })));
+ const moveToParentNodes = removeColumn.flatMap((f2) => f2.children.map((f3) => ({ ...f3.node, parentId: root.id, rank: columnParentNode.node.rank })));
moveToParentNodes.push(...saveNodes.filter((f2) => removeColumn.some((g) => g.id == f2.parentId)));
- saveNodes = [...saveNodes.map((f2) => moveToParentNodes.some((g) => g.id == f2.id) ? { ...f2, parentId: root4.id } : f2), ...moveToParentNodes.filter((g) => !saveNodes.some((f2) => g.id == f2.id))];
+ saveNodes = [...saveNodes.map((f2) => moveToParentNodes.some((g) => g.id == f2.id) ? { ...f2, parentId: root.id } : f2), ...moveToParentNodes.filter((g) => !saveNodes.some((f2) => g.id == f2.id))];
}
}
return [saveNodes, deleteNodes];
};
// src/core/react/components/SpaceView/Frames/ViewNodes/FrameEditorInstance.tsx
-var import_react170 = __toESM(require_react());
+var import_react150 = __toESM(require_react());
// src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx
-var import_classnames11 = __toESM(require_classnames());
+var import_classnames10 = __toESM(require_classnames());
// src/core/utils/frames/renderer.ts
var parseStylesToClass = (styles2) => {
@@ -117201,7 +117101,7 @@ var parseStylesToClass = (styles2) => {
};
// src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx
-var import_react169 = __toESM(require_react());
+var import_react149 = __toESM(require_react());
var import_react_dom11 = __toESM(require_react_dom());
// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameMultiNodeEditor.tsx
@@ -117329,24 +117229,24 @@ var predicateForViewType = (type) => {
};
}
};
-var createInlineTable = async (superstate, path3, type) => {
+var createInlineTable = async (superstate, path2, type) => {
let tableName = type == "board" ? "Board" : "Table";
- const schemas = await superstate.spaceManager.tablesForSpace(path3);
+ const schemas = await superstate.spaceManager.tablesForSpace(path2);
if (schemas) {
tableName = uniqueNameFromString(
tableName,
schemas.map((f2) => f2.id)
);
}
- const viewID = await superstate.spaceManager.createTable(path3, {
+ const viewID = await superstate.spaceManager.createTable(path2, {
id: tableName,
name: tableName,
type: "db"
}).then(
- (f2) => superstate.spaceManager.addSpaceProperty(path3, { ...defaultTableFields[0], schemaId: tableName })
+ (f2) => superstate.spaceManager.addSpaceProperty(path2, { ...defaultTableFields[0], schemaId: tableName })
).then(
async (f2) => {
- const schemaTable = await superstate.spaceManager.framesForSpace(path3);
+ const schemaTable = await superstate.spaceManager.framesForSpace(path2);
const schema = {
id: uniqueNameFromString(
tableName,
@@ -117363,7 +117263,7 @@ var createInlineTable = async (superstate, path3, type) => {
icon: type == "board" ? "ui//square-kanban" : "ui//table"
})
};
- await superstate.spaceManager.createFrame(path3, schema);
+ await superstate.spaceManager.createFrame(path2, schema);
return schema.id;
}
);
@@ -117371,7 +117271,7 @@ var createInlineTable = async (superstate, path3, type) => {
};
// src/core/react/components/UI/Menus/frames/newFrameMenu.tsx
-var showNewFrameMenu = (rect, superstate, space3, addNode, options = { searchable: true }) => {
+var showNewFrameMenu = (rect, superstate, space2, addNode, options = { searchable: true }) => {
const kits = superstate.settings.quickFrames.flatMap((s4) => {
const frameSchemas = superstate.framesIndex.get(s4)?.schemas ?? [];
return frameSchemas.map((f2) => mdbSchemaToFrameSchema(f2)).map((f2) => ({
@@ -117440,7 +117340,7 @@ var showNewFrameMenu = (rect, superstate, space3, addNode, options = { searchabl
const insertNode = async (item) => {
if (item.type == "preset") {
if (item.value == "note") {
- const _space = superstate.spacesIndex.get(space3.path);
+ const _space = superstate.spacesIndex.get(space2.path);
if (_space) {
const newPath = await newPathInSpace(
superstate,
@@ -117455,10 +117355,10 @@ var showNewFrameMenu = (rect, superstate, space3, addNode, options = { searchabl
});
}
} else if (item.value == "table") {
- const table2 = await createInlineTable(superstate, space3.path);
+ const table = await createInlineTable(superstate, space2.path);
addNode({
...contextNode.node,
- props: { value: wrapQuotes(`${space3.path}/#*${table2}`) }
+ props: { value: wrapQuotes(`${space2.path}/#*${table}`) }
});
} else if (item.value == "link") {
}
@@ -117490,8 +117390,8 @@ var showNewFrameMenu = (rect, superstate, space3, addNode, options = { searchabl
var import_react90 = __toESM(require_react());
var ColorSetter = (props) => {
const showColorMenu = (e5, prop2) => {
- const handleChangeComplete = (color3) => {
- props.setValue(color3);
+ const handleChangeComplete = (color2) => {
+ props.setValue(color2);
};
const offset2 = e5.target.getBoundingClientRect();
showColorPickerMenu(
@@ -118179,7 +118079,7 @@ var PropertiesSubmenu = (props) => {
};
const propertyForField = (field) => {
const f2 = frameProperties?.find(
- (p2) => p2.name == parseLinkedNode(frameProps?.[field])?.prop
+ (p) => p.name == parseLinkedNode(frameProps?.[field])?.prop
);
return f2;
};
@@ -118335,8 +118235,8 @@ var BorderSubmenu = (props) => {
);
};
const showColorMenu = (e5, prop2) => {
- const handleChangeComplete = (color3) => {
- saveStyleValue(prop2, `'${color3}'`);
+ const handleChangeComplete = (color2) => {
+ saveStyleValue(prop2, `'${color2}'`);
};
const offset2 = e5.target.getBoundingClientRect();
showColorPickerMenu(
@@ -118377,8 +118277,8 @@ var import_react102 = __toESM(require_react());
var ShadowSubmenu = (props) => {
const { selectedNode, saveStyleValue } = props;
const showColorMenu = (e5, prop2) => {
- const handleChangeComplete = (color3) => {
- const { r: r2, g, b: b2 } = hexToRgb(color3);
+ const handleChangeComplete = (color2) => {
+ const { r: r2, g, b: b2 } = hexToRgb(color2);
saveStyleValue(prop2, `'${r2},${g},${b2}'`);
};
const offset2 = e5.target.getBoundingClientRect();
@@ -118447,8 +118347,8 @@ var ShadowSubmenu = (props) => {
var StyleSubmenu = (props) => {
const { selectedNode, saveStyleValue } = props;
const showColorMenu = (e5, prop2) => {
- const handleChangeComplete = (color3) => {
- saveStyleValue(prop2, `'${color3}'`);
+ const handleChangeComplete = (color2) => {
+ saveStyleValue(prop2, `'${color2}'`);
};
const offset2 = e5.target.getBoundingClientRect();
showColorPickerMenu(
@@ -118531,8 +118431,8 @@ var TextSubmenu = (props) => {
saveStyleValue("textAlign", `'${value}'`);
};
const showColorMenu = (e5, prop2) => {
- const handleChangeComplete = (color3) => {
- saveStyleValue(prop2, `'${color3}'`);
+ const handleChangeComplete = (color2) => {
+ saveStyleValue(prop2, `'${color2}'`);
};
const offset2 = e5.target.getBoundingClientRect();
showColorPickerMenu(
@@ -118639,8 +118539,8 @@ var FrameNodeEditor = (props) => {
const { selectionMode } = (0, import_react105.useContext)(FrameSelectionContext);
const { instance } = (0, import_react105.useContext)(FrameInstanceContext);
const saveNodeValue = (0, import_react105.useCallback)(
- (values2, node2) => {
- updateNode(node2, {
+ (values2, node) => {
+ updateNode(node, {
props: {
...values2
}
@@ -118671,7 +118571,7 @@ var FrameNodeEditor = (props) => {
}, [props.node]);
const savePropValue = (0, import_react105.useCallback)(
(prop2, value) => {
- setFrameProps((p2) => ({ ...p2, [prop2]: value }));
+ setFrameProps((p) => ({ ...p, [prop2]: value }));
saveNodeValue({ [prop2]: value }, props.node);
},
[setFrameProps, saveNodeValue, props.node]
@@ -118957,21718 +118857,11283 @@ var ContentNodeView = (props) => {
return /* @__PURE__ */ import_react106.default.createElement(import_react106.default.Fragment, null, props.children);
};
-// src/adapters/obsidian/ui/editors/EmbedContextView.tsx
-var import_obsidian = require("obsidian");
+// src/core/react/components/PathView/PathView.tsx
+var import_react119 = __toESM(require_react());
+
+// src/core/react/components/SpaceView/Contexts/SpaceView.tsx
+var import_react116 = __toESM(require_react());
+
+// node_modules/react-error-boundary/dist/react-error-boundary.cjs.mjs
+var import_react_error_boundary_cjs = __toESM(require_react_error_boundary_cjs(), 1);
+
+// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx
+var import_lodash17 = __toESM(require_lodash());
+
+// src/core/react/context/SidebarContext.tsx
+var import_lodash16 = __toESM(require_lodash());
var import_react107 = __toESM(require_react());
-var EMBED_CONTEXT_VIEW_TYPE = "mk-space-embed";
-var EmbedContextView = class extends import_obsidian.ItemView {
- constructor(leaf, plugin) {
- super(leaf);
- this.navigation = true;
- this.plugin = plugin;
- }
- getViewType() {
- return EMBED_CONTEXT_VIEW_TYPE;
+var NavigatorContext = (0, import_react107.createContext)({
+ dragPaths: [],
+ setDragPaths: import_lodash16.default.noop,
+ selectedPaths: [],
+ setSelectedPaths: import_lodash16.default.noop,
+ activePath: null,
+ setActivePath: import_lodash16.default.noop,
+ activeViewSpaces: [],
+ waypoints: [],
+ setWaypoints: import_lodash16.default.noop,
+ saveActiveSpace: import_lodash16.default.noop,
+ closeActiveSpace: import_lodash16.default.noop,
+ modifier: null,
+ setModifier: import_lodash16.default.noop
+});
+var SidebarProvider = (props) => {
+ const [modifier, setModifier] = (0, import_react107.useState)(null);
+ const [dragPaths, setDragPaths] = (0, import_react107.useState)([]);
+ const [selectedPaths, setSelectedPaths] = (0, import_react107.useState)([]);
+ const [activePath, setActivePath] = (0, import_react107.useState)(null);
+ const [waypoints, setWaypoints] = (0, import_react107.useState)(
+ props.superstate.waypoints
+ );
+ const [activeViewSpaces, setActiveViewSpaces] = (0, import_react107.useState)(
+ (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2)
+ );
+ const setActiveViewSpaceByPath = (path2) => {
+ const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] };
+ newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path2), path2];
+ if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) {
+ props.superstate.spaceManager.saveWaypoints([
+ ...props.superstate.waypoints,
+ newWaypoint
+ ]);
+ }
+ const newWaypoints = props.superstate.waypoints.map(
+ (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2
+ );
+ props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2));
+ };
+ const closeActiveViewSpace = (path2) => {
+ const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] };
+ newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path2)];
+ if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) {
+ props.superstate.spaceManager.saveWaypoints([
+ ...props.superstate.waypoints,
+ newWaypoint
+ ]);
+ }
+ const newWaypoints = props.superstate.waypoints.map(
+ (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2
+ );
+ props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2));
+ };
+ const saveWaypoints = (paths) => {
+ props.superstate.spaceManager.saveWaypoints(paths.filter((f2) => f2));
+ };
+ 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.spacesIndex.get(f2))
+ );
+ }
+ };
+ const reloadPaths = () => {
+ setWaypoints(props.superstate.waypoints);
+ setActiveViewSpaces(
+ (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2)
+ );
+ };
+ (0, import_react107.useEffect)(() => {
+ props.superstate.eventsDispatcher.addListener(
+ "spaceStateUpdated",
+ refreshSpaces
+ );
+ props.superstate.eventsDispatcher.addListener(
+ "settingsChanged",
+ reloadPaths
+ );
+ props.superstate.eventsDispatcher.addListener(
+ "superstateUpdated",
+ reloadPaths
+ );
+ return () => {
+ props.superstate.eventsDispatcher.removeListener(
+ "spaceStateUpdated",
+ refreshSpaces
+ );
+ props.superstate.eventsDispatcher.removeListener(
+ "settingsChanged",
+ reloadPaths
+ );
+ props.superstate.eventsDispatcher.removeListener(
+ "superstateUpdated",
+ reloadPaths
+ );
+ };
+ }, []);
+ return /* @__PURE__ */ import_react107.default.createElement(NavigatorContext.Provider, {
+ value: {
+ dragPaths,
+ setDragPaths,
+ selectedPaths,
+ setSelectedPaths,
+ activePath,
+ setActivePath,
+ activeViewSpaces,
+ waypoints,
+ setWaypoints: saveWaypoints,
+ saveActiveSpace: setActiveViewSpaceByPath,
+ closeActiveSpace: closeActiveViewSpace,
+ modifier,
+ setModifier
+ }
+ }, props.children);
+};
+
+// src/core/types/types.ts
+var eventTypes = {
+ frameSelected: "mkmd-active-frame",
+ frameLayerSelected: "mkmd-frame-layer",
+ refreshView: "mkmd-refresh-view",
+ revealPath: "mkmd-reveal-file",
+ collapseFolders: "mkmd-collapse-folders",
+ toggleBacklinks: "mkmd-toggle-backlinks",
+ metadataChange: "mkmd-tags-change",
+ vaultChange: "mkmd-vault-change",
+ mdbChange: "mkmd-mdb-change",
+ spacesChange: "mkmd-spaces-change",
+ frameChange: "mkmd-frame-change",
+ updateSections: "mkmd-update-sections",
+ settingsChanged: "mkmd-settings-changed"
+};
+
+// src/core/utils/dnd/dragPath.ts
+function getMaxDepth(previousItem, dirDown) {
+ if (previousItem) {
+ if (previousItem.item?.type == "space" && !previousItem.collapsed && dirDown)
+ return previousItem.depth + 1;
+ return previousItem.depth;
}
- getDisplayText() {
- return this.path;
+ return 0;
+}
+function getMinDepth(previousItem) {
+ if (previousItem) {
+ return Math.max(0, previousItem.depth - 1);
}
- async onClose() {
- this.destroy();
+ return 0;
+}
+function getDragDepth(offset2, indentationWidth) {
+ return Math.round(offset2 / indentationWidth);
+}
+var getMultiProjection = (flattenedTree, paths, overIndex, modifier) => {
+ const overItem = flattenedTree[overIndex];
+ if (!overItem)
+ return;
+ const dropTarget = overItem.type == "file" ? flattenedTree.find((f2) => f2.id == overItem.parentId) : overItem;
+ if (dropTarget && dropTarget.type != "file") {
+ const _projected = {
+ depth: overItem.depth,
+ overId: overItem.id,
+ parentId: dropTarget.id,
+ sortable: false,
+ insert: dropTarget.collapsed,
+ droppable: true,
+ copy: modifier == "link" || modifier == "copy",
+ reorder: false
+ };
+ return _projected;
}
- onunload() {
- this.destroy();
+ return null;
+};
+function getProjection(activeItem, items, paths, overItemIndex, dragDepth, yOffset, dirDown, modifier, activeSpaceID) {
+ if (paths.length == 0)
+ return null;
+ if (paths.length > 1)
+ return getMultiProjection(items, paths, overItemIndex, modifier);
+ const overItem = items[overItemIndex];
+ const previousItem = items[overItemIndex];
+ const nextItem = items[overItemIndex + 1];
+ if (!previousItem)
+ return;
+ const previousItemDroppable = previousItem.type != "file";
+ const insert2 = activeItem.depth > 0 && overItem.collapsed && previousItemDroppable && (!overItem.sortable || dirDown && yOffset <= 13 || !dirDown && yOffset >= 13);
+ const sortable = overItem.sortable || previousItemDroppable && !insert2 && nextItem.sortable;
+ const projectedDepth = dragDepth;
+ const maxDepth = activeItem.depth == 0 ? 0 : getMaxDepth(
+ previousItem,
+ dirDown
+ );
+ const minDepth = getMinDepth(previousItem);
+ let depth = projectedDepth;
+ if (projectedDepth >= maxDepth) {
+ depth = maxDepth;
+ } else if (projectedDepth < minDepth) {
+ depth = minDepth;
}
- destroy() {
- if (this.root)
- this.root.unmount();
+ const parentId = getParentId();
+ const parent = items.find((f2) => f2.id == parentId);
+ return {
+ depth,
+ overId: previousItem.id,
+ parentId,
+ sortable,
+ insert: insert2,
+ droppable: parent?.type != "file",
+ copy: modifier == "link" || modifier == "copy",
+ reorder: insert2 ? activeItem?.parentId == overItem?.id : activeItem?.parentId == parent?.id || activeItem?.parentId == activeSpaceID
+ };
+ function getParentId() {
+ if (depth === 0) {
+ return null;
+ }
+ if (!previousItem) {
+ return null;
+ }
+ if (depth === previousItem.depth || depth > previousItem.depth && previousItem.item.type != "space") {
+ return previousItem.parentId;
+ }
+ if (depth > previousItem.depth) {
+ return previousItem.id;
+ }
+ const newParent = items.slice(0, overItemIndex).reverse().find((item) => item.depth === depth)?.parentId;
+ return newParent ?? null;
}
- async onOpen() {
- this.destroy();
+}
+
+// src/core/utils/keyboard.ts
+var normalizedAltName = () => window.navigator.platform.startsWith("Mac") ? "\u2325" : "Alt";
+
+// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx
+var import_react111 = __toESM(require_react());
+
+// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx
+var import_classnames3 = __toESM(require_classnames());
+var import_react109 = __toESM(require_react());
+
+// node_modules/react-dropzone/dist/es/index.js
+var import_react108 = __toESM(require_react());
+var import_prop_types = __toESM(require_prop_types());
+
+// node_modules/tslib/tslib.es6.mjs
+function __awaiter(thisArg, _arguments, P3, generator) {
+ function adopt(value) {
+ return value instanceof P3 ? value : new P3(function(resolve2) {
+ resolve2(value);
+ });
}
- 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 new (P3 || (P3 = Promise))(function(resolve2, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e5) {
+ reject(e5);
+ }
}
- return;
- }
- getState() {
- const state = super.getState();
- state.path = this.path;
- state.source = this.source;
- return state;
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e5) {
+ reject(e5);
+ }
+ }
+ function step(result) {
+ result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+function __generator(thisArg, body) {
+ var _15 = { label: 0, sent: function() {
+ if (t5[0] & 1)
+ throw t5[1];
+ return t5[1];
+ }, trys: [], ops: [] }, f2, y3, t5, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
+ return this;
+ }), g;
+ function verb(n3) {
+ return function(v2) {
+ return step([n3, v2]);
+ };
}
- constructInlineContext() {
- this.destroy();
- this.root = this.plugin.ui.createRoot(this.contentEl);
- if (this.root) {
- this.root.render(
- /* @__PURE__ */ import_react107.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();
+ function step(op) {
+ if (f2)
+ throw new TypeError("Generator is already executing.");
+ while (g && (g = 0, op[0] && (_15 = 0)), _15)
+ try {
+ if (f2 = 1, y3 && (t5 = op[0] & 2 ? y3["return"] : op[0] ? y3["throw"] || ((t5 = y3["return"]) && t5.call(y3), 0) : y3.next) && !(t5 = t5.call(y3, op[1])).done)
+ return t5;
+ if (y3 = 0, t5)
+ op = [op[0] & 2, t5.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t5 = op;
+ break;
+ case 4:
+ _15.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _15.label++;
+ y3 = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _15.ops.pop();
+ _15.trys.pop();
+ continue;
+ default:
+ if (!(t5 = _15.trys, t5 = t5.length > 0 && t5[t5.length - 1]) && (op[0] === 6 || op[0] === 2)) {
+ _15 = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t5 || op[1] > t5[0] && op[1] < t5[3])) {
+ _15.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _15.label < t5[1]) {
+ _15.label = t5[1];
+ t5 = op;
+ break;
+ }
+ if (t5 && _15.label < t5[2]) {
+ _15.label = t5[2];
+ _15.ops.push(op);
+ break;
+ }
+ if (t5[2])
+ _15.ops.pop();
+ _15.trys.pop();
+ continue;
}
- );
+ op = body.call(thisArg, _15);
+ } catch (e5) {
+ op = [6, e5];
+ y3 = 0;
+ } finally {
+ f2 = t5 = 0;
+ }
+ if (op[0] & 5)
+ throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+function __read(o2, n3) {
+ var m4 = typeof Symbol === "function" && o2[Symbol.iterator];
+ if (!m4)
+ return o2;
+ var i4 = m4.call(o2), r2, ar = [], e5;
+ try {
+ while ((n3 === void 0 || n3-- > 0) && !(r2 = i4.next()).done)
+ ar.push(r2.value);
+ } catch (error) {
+ e5 = { error };
+ } finally {
+ try {
+ if (r2 && !r2.done && (m4 = i4["return"]))
+ m4.call(i4);
+ } finally {
+ if (e5)
+ throw e5.error;
}
}
-};
+ return ar;
+}
+function __spreadArray2(to2, from, pack) {
+ if (pack || arguments.length === 2)
+ for (var i4 = 0, l2 = from.length, ar; i4 < l2; i4++) {
+ if (ar || !(i4 in from)) {
+ if (!ar)
+ ar = Array.prototype.slice.call(from, 0, i4);
+ ar[i4] = from[i4];
+ }
+ }
+ return to2.concat(ar || Array.prototype.slice.call(from));
+}
-// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx
-var import_obsidian2 = require("obsidian");
-var import_react108 = __toESM(require_react());
-var LINK_VIEW_TYPE = "mk-uri-view";
-var FileLinkView = class extends import_obsidian2.ItemView {
- constructor(leaf, app2, viewType, superstate) {
- super(leaf);
- this.superstate = superstate;
- this.navigation = true;
- this.app = app2;
- this.viewType = viewType;
+// node_modules/file-selector/dist/es5/file.js
+var COMMON_MIME_TYPES = /* @__PURE__ */ new Map([
+ ["aac", "audio/aac"],
+ ["abw", "application/x-abiword"],
+ ["arc", "application/x-freearc"],
+ ["avif", "image/avif"],
+ ["avi", "video/x-msvideo"],
+ ["azw", "application/vnd.amazon.ebook"],
+ ["bin", "application/octet-stream"],
+ ["bmp", "image/bmp"],
+ ["bz", "application/x-bzip"],
+ ["bz2", "application/x-bzip2"],
+ ["cda", "application/x-cdf"],
+ ["csh", "application/x-csh"],
+ ["css", "text/css"],
+ ["csv", "text/csv"],
+ ["doc", "application/msword"],
+ ["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
+ ["eot", "application/vnd.ms-fontobject"],
+ ["epub", "application/epub+zip"],
+ ["gz", "application/gzip"],
+ ["gif", "image/gif"],
+ ["heic", "image/heic"],
+ ["heif", "image/heif"],
+ ["htm", "text/html"],
+ ["html", "text/html"],
+ ["ico", "image/vnd.microsoft.icon"],
+ ["ics", "text/calendar"],
+ ["jar", "application/java-archive"],
+ ["jpeg", "image/jpeg"],
+ ["jpg", "image/jpeg"],
+ ["js", "text/javascript"],
+ ["json", "application/json"],
+ ["jsonld", "application/ld+json"],
+ ["mid", "audio/midi"],
+ ["midi", "audio/midi"],
+ ["mjs", "text/javascript"],
+ ["mp3", "audio/mpeg"],
+ ["mp4", "video/mp4"],
+ ["mpeg", "video/mpeg"],
+ ["mpkg", "application/vnd.apple.installer+xml"],
+ ["odp", "application/vnd.oasis.opendocument.presentation"],
+ ["ods", "application/vnd.oasis.opendocument.spreadsheet"],
+ ["odt", "application/vnd.oasis.opendocument.text"],
+ ["oga", "audio/ogg"],
+ ["ogv", "video/ogg"],
+ ["ogx", "application/ogg"],
+ ["opus", "audio/opus"],
+ ["otf", "font/otf"],
+ ["png", "image/png"],
+ ["pdf", "application/pdf"],
+ ["php", "application/x-httpd-php"],
+ ["ppt", "application/vnd.ms-powerpoint"],
+ ["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"],
+ ["rar", "application/vnd.rar"],
+ ["rtf", "application/rtf"],
+ ["sh", "application/x-sh"],
+ ["svg", "image/svg+xml"],
+ ["swf", "application/x-shockwave-flash"],
+ ["tar", "application/x-tar"],
+ ["tif", "image/tiff"],
+ ["tiff", "image/tiff"],
+ ["ts", "video/mp2t"],
+ ["ttf", "font/ttf"],
+ ["txt", "text/plain"],
+ ["vsd", "application/vnd.visio"],
+ ["wav", "audio/wav"],
+ ["weba", "audio/webm"],
+ ["webm", "video/webm"],
+ ["webp", "image/webp"],
+ ["woff", "font/woff"],
+ ["woff2", "font/woff2"],
+ ["xhtml", "application/xhtml+xml"],
+ ["xls", "application/vnd.ms-excel"],
+ ["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
+ ["xml", "application/xml"],
+ ["xul", "application/vnd.mozilla.xul+xml"],
+ ["zip", "application/zip"],
+ ["7z", "application/x-7z-compressed"],
+ ["mkv", "video/x-matroska"],
+ ["mov", "video/quicktime"],
+ ["msg", "application/vnd.ms-outlook"]
+]);
+function toFileWithPath(file, path2) {
+ var f2 = withMimeType(file);
+ if (typeof f2.path !== "string") {
+ var webkitRelativePath = file.webkitRelativePath;
+ Object.defineProperty(f2, "path", {
+ value: typeof path2 === "string" ? path2 : typeof webkitRelativePath === "string" && webkitRelativePath.length > 0 ? webkitRelativePath : file.name,
+ writable: false,
+ configurable: false,
+ enumerable: true
+ });
}
- getViewType() {
- return LINK_VIEW_TYPE;
+ return f2;
+}
+function withMimeType(file) {
+ var name317 = file.name;
+ var hasExtension = name317 && name317.lastIndexOf(".") !== -1;
+ if (hasExtension && !file.type) {
+ var ext = name317.split(".").pop().toLowerCase();
+ var type = COMMON_MIME_TYPES.get(ext);
+ if (type) {
+ Object.defineProperty(file, "type", {
+ value: type,
+ writable: false,
+ configurable: false,
+ enumerable: true
+ });
+ }
}
- getDisplayText() {
- return this.path;
+ return file;
+}
+
+// node_modules/file-selector/dist/es5/file-selector.js
+var FILES_TO_IGNORE = [
+ ".DS_Store",
+ "Thumbs.db"
+];
+function fromEvent(evt) {
+ return __awaiter(this, void 0, void 0, function() {
+ return __generator(this, function(_a) {
+ if (isObject3(evt) && isDataTransfer(evt.dataTransfer)) {
+ return [2, getDataTransferFiles(evt.dataTransfer, evt.type)];
+ } else if (isChangeEvt(evt)) {
+ return [2, getInputFiles(evt)];
+ } else if (Array.isArray(evt) && evt.every(function(item) {
+ return "getFile" in item && typeof item.getFile === "function";
+ })) {
+ return [2, getFsHandleFiles(evt)];
+ }
+ return [2, []];
+ });
+ });
+}
+function isDataTransfer(value) {
+ return isObject3(value);
+}
+function isChangeEvt(value) {
+ return isObject3(value) && isObject3(value.target);
+}
+function isObject3(v2) {
+ return typeof v2 === "object" && v2 !== null;
+}
+function getInputFiles(evt) {
+ return fromList(evt.target.files).map(function(file) {
+ return toFileWithPath(file);
+ });
+}
+function getFsHandleFiles(handles) {
+ return __awaiter(this, void 0, void 0, function() {
+ var files;
+ return __generator(this, function(_a) {
+ switch (_a.label) {
+ case 0:
+ return [4, Promise.all(handles.map(function(h3) {
+ return h3.getFile();
+ }))];
+ case 1:
+ files = _a.sent();
+ return [2, files.map(function(file) {
+ return toFileWithPath(file);
+ })];
+ }
+ });
+ });
+}
+function getDataTransferFiles(dt, type) {
+ return __awaiter(this, void 0, void 0, function() {
+ var items, files;
+ return __generator(this, function(_a) {
+ switch (_a.label) {
+ case 0:
+ if (!dt.items)
+ return [3, 2];
+ items = fromList(dt.items).filter(function(item) {
+ return item.kind === "file";
+ });
+ if (type !== "drop") {
+ return [2, items];
+ }
+ return [4, Promise.all(items.map(toFilePromises))];
+ case 1:
+ files = _a.sent();
+ return [2, noIgnoredFiles(flatten3(files))];
+ case 2:
+ return [2, noIgnoredFiles(fromList(dt.files).map(function(file) {
+ return toFileWithPath(file);
+ }))];
+ }
+ });
+ });
+}
+function noIgnoredFiles(files) {
+ return files.filter(function(file) {
+ return FILES_TO_IGNORE.indexOf(file.name) === -1;
+ });
+}
+function fromList(items) {
+ if (items === null) {
+ return [];
}
- async onClose() {
- this.destroy();
+ var files = [];
+ for (var i4 = 0; i4 < items.length; i4++) {
+ var file = items[i4];
+ files.push(file);
}
- destroy() {
- if (this.root)
- this.root.unmount();
+ return files;
+}
+function toFilePromises(item) {
+ if (typeof item.webkitGetAsEntry !== "function") {
+ return fromDataTransferItem(item);
}
- async onOpen() {
- this.destroy();
+ var entry = item.webkitGetAsEntry();
+ if (entry && entry.isDirectory) {
+ return fromDirEntry(entry);
}
- async setState(state, result) {
- this.path = state.path;
- 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;
+ return fromDataTransferItem(item);
+}
+function flatten3(items) {
+ return items.reduce(function(acc, files) {
+ return __spreadArray2(__spreadArray2([], __read(acc), false), __read(Array.isArray(files) ? flatten3(files) : [files]), false);
+ }, []);
+}
+function fromDataTransferItem(item) {
+ var file = item.getAsFile();
+ if (!file) {
+ return Promise.reject("".concat(item, " is not a File"));
+ }
+ var fwp = toFileWithPath(file);
+ return Promise.resolve(fwp);
+}
+function fromEntry(entry) {
+ return __awaiter(this, void 0, void 0, function() {
+ return __generator(this, function(_a) {
+ return [2, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
+ });
+ });
+}
+function fromDirEntry(entry) {
+ var reader = entry.createReader();
+ return new Promise(function(resolve2, reject) {
+ var entries = [];
+ function readEntries() {
+ var _this = this;
+ reader.readEntries(function(batch) {
+ return __awaiter(_this, void 0, void 0, function() {
+ var files, err_1, items;
+ return __generator(this, function(_a) {
+ switch (_a.label) {
+ case 0:
+ if (!!batch.length)
+ return [3, 5];
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4, Promise.all(entries)];
+ case 2:
+ files = _a.sent();
+ resolve2(files);
+ return [3, 4];
+ case 3:
+ err_1 = _a.sent();
+ reject(err_1);
+ return [3, 4];
+ case 4:
+ return [3, 6];
+ case 5:
+ items = Promise.all(batch.map(fromEntry));
+ entries.push(items);
+ readEntries();
+ _a.label = 6;
+ case 6:
+ return [2];
+ }
+ });
+ });
+ }, function(err) {
+ reject(err);
+ });
}
- result.history = true;
- return;
+ readEntries();
+ });
+}
+function fromFileEntry(entry) {
+ return __awaiter(this, void 0, void 0, function() {
+ return __generator(this, function(_a) {
+ return [2, new Promise(function(resolve2, reject) {
+ entry.file(function(file) {
+ var fwp = toFileWithPath(file, entry.fullPath);
+ resolve2(fwp);
+ }, function(err) {
+ reject(err);
+ });
+ })];
+ });
+ });
+}
+
+// node_modules/react-dropzone/dist/es/utils/index.js
+var import_attr_accept = __toESM(require_es());
+function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
+}
+function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+function _iterableToArray(iter) {
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
+ return Array.from(iter);
+}
+function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr))
+ return _arrayLikeToArray(arr);
+}
+function ownKeys4(object, enumerableOnly) {
+ var keys = Object.keys(object);
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ })), keys.push.apply(keys, symbols);
}
- getState() {
- const state = super.getState();
- state.path = this.path;
- return state;
+ return keys;
+}
+function _objectSpread4(target) {
+ for (var i4 = 1; i4 < arguments.length; i4++) {
+ var source = null != arguments[i4] ? arguments[i4] : {};
+ i4 % 2 ? ownKeys4(Object(source), true).forEach(function(key2) {
+ _defineProperty2(target, key2, source[key2]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys4(Object(source)).forEach(function(key2) {
+ Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
+ });
}
- constructView(path3) {
- this.destroy();
- this.root = this.superstate.ui.createRoot(this.contentEl);
- this.root.render(
- /* @__PURE__ */ import_react108.default.createElement("div", {
- className: "markdown-reading-view"
- }, /* @__PURE__ */ import_react108.default.createElement(FileLinkViewComponent, {
- superstate: this.superstate,
- path: path3
- }))
- );
+ return target;
+}
+function _defineProperty2(obj, key2, value) {
+ if (key2 in obj) {
+ Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });
+ } else {
+ obj[key2] = value;
+ }
+ return obj;
+}
+function _slicedToArray(arr, i4) {
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i4) || _unsupportedIterableToArray(arr, i4) || _nonIterableRest();
+}
+function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+function _unsupportedIterableToArray(o2, minLen) {
+ if (!o2)
+ return;
+ if (typeof o2 === "string")
+ return _arrayLikeToArray(o2, minLen);
+ var n3 = Object.prototype.toString.call(o2).slice(8, -1);
+ if (n3 === "Object" && o2.constructor)
+ n3 = o2.constructor.name;
+ if (n3 === "Map" || n3 === "Set")
+ return Array.from(o2);
+ if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
+ return _arrayLikeToArray(o2, minLen);
+}
+function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length)
+ len = arr.length;
+ for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) {
+ arr2[i4] = arr[i4];
+ }
+ return arr2;
+}
+function _iterableToArrayLimit(arr, i4) {
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
+ if (_i == null)
+ return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _s, _e;
+ try {
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+ if (i4 && _arr.length === i4)
+ break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null)
+ _i["return"]();
+ } finally {
+ if (_d)
+ throw _e;
+ }
}
+ return _arr;
+}
+function _arrayWithHoles(arr) {
+ if (Array.isArray(arr))
+ return arr;
+}
+var FILE_INVALID_TYPE = "file-invalid-type";
+var FILE_TOO_LARGE = "file-too-large";
+var FILE_TOO_SMALL = "file-too-small";
+var TOO_MANY_FILES = "too-many-files";
+var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr2(accept) {
+ accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
+ var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
+ return {
+ code: FILE_INVALID_TYPE,
+ message: "File type must be ".concat(messageSuffix)
+ };
};
-
-// src/adapters/obsidian/utils/file.ts
-var import_obsidian5 = require("obsidian");
-
-// src/core/react/components/System/SystemSettings.tsx
-var import_react120 = __toESM(require_react());
-
-// src/core/assets/icons.ts
-var uiIconSet = {
- "rows": ``,
- "close": ``,
- "flow-hover": ``,
- "folder": ``,
- "open-link": ``,
- "file": ``,
- "expand": ``,
- "json": ``,
- "new-folder": ``,
- "new-note": ``,
- "collapse": ``,
- "options": ``,
- "plus": `
- `,
- "collapse-solid": ``,
- "search": `
- `,
- "view-options": `
- `,
- "clear": `
- `,
- "new-file": `
- `,
- "blink": `
- `,
- "spaces": ``,
- "home": ``,
- "tags": ``,
- "handle": `
- `,
- "props": ``,
- "new-space": `
- `,
- "file-solid": `
- `,
- "folder-solid": `
- `,
- "sync": `
- `,
- "stack": `
- `,
- "cut": `
- `,
- "backlink": ``,
- "canvas": `
- `,
- "video": `
- `,
- "edit": `
- `,
- "list": `
-
- `,
- "build": `
- `,
- "check": `
- `,
- "layout": `
- `,
- "colors": `
- `,
- "mk-make-todo": `
- `,
- "mk-make-list": `
- `,
- "mk-make-ordered": `
- `,
- "mk-make-h1": `
- `,
- "mk-make-h2": `
- `,
- "mk-make-h3": `
- `,
- "mk-make-quote": `
- `,
- "mk-make-hr": `
- `,
- "mk-make-link": `
- `,
- "mk-make-image": `
- `,
- "mk-make-codeblock": `
- `,
- "mk-make-callout": ``,
- "mk-make-note": `
- `,
- "mk-make-flow": `
- `,
- "mk-make-tag": `
- `,
- "callout": ``,
- "mk-make-table": `
- `,
- "mk-make-date": `
- `,
- "mk-make-indent": `
-
- `,
- "mk-make-unindent": `
- `,
- "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-mark-color": ``,
- "any": ``,
- "all": ``,
- "context": ``,
- "full-width": ``,
- "file-stack": ``,
- "layout-panel-left": ``,
- "align-center": `
-`,
- "align-left": `
-`,
- "align-right": `
-`,
- "arrow-down": `
-`,
- "arrow-left": `
-`,
- "arrow-right": `
-`,
- "arrow-up-down": `
-`,
- "arrow-up-right": `
-`,
- "baseline": `
-`,
- "binary": `
-`,
- "bold": `
-`,
- "book-open": `
-`,
- "box-select": `
-`,
- "brush": `
-`,
- "calendar": `
-`,
- "case-insensitive": `
-`,
- "check-square": `
-`,
- "chevron-left": `
-`,
- "chevron-right": `
-`,
- "chevrons-down-up": `
-`,
- "chevrons-up-down": `
-`,
- "clock": `
-`,
- "code": `
-`,
- "columns": `
-`,
- "combine": `
-`,
- "copy-check": `
-`,
- "copy-x": `
-`,
- "copy": `
-`,
- "documents": `
-`,
- "edit-3": `
-`,
- "eye-off": `
-`,
- "eye": `
-`,
- "file-minus": `
-`,
- "file-plus-2": `
-`,
- "file-question": `
-`,
- "file-search": `
-`,
- "file-text": `
-`,
- "filter": `
-`,
- "fold-horizontal": `
-`,
- "fold-vertical": `
-`,
- "folder-plus": `
-`,
- "gallery-horizontal-end": `
-`,
- "gem": `
-`,
- "go-to-file": `
-`,
- "heading-1": `
-`,
- "heading-2": `
-`,
- "heading-3": `
-`,
- "heading-4": `
-`,
- "heading-5": `
-`,
- "heading-6": `
-`,
- "help-circle": `
-`,
- "image": `
-`,
- "infinity": `
-`,
- "input": `
-`,
- "italic": `
-`,
- "justify": `
-`,
- "layout-dashboard": `
-`,
- "grid": ``,
- "layout-grid": `
-`,
- "layout-list": `
-`,
- "lightbulb": `
-`,
- "link": `
-`,
- "links-coming-in": `
-`,
- "links-going-out": `
-`,
- "list-tree": `
-`,
- "minus": ``,
- "mouse-pointer-click": `
-`,
- "paintbrush": `
-`,
- "palette": `
-`,
- "panel-top-close": `
-`,
- "paper-plane": `
-`,
- "pie-chart": `
-`,
- "pin-off": `
-`,
- "pin": `
-`,
- "plug": `
-`,
- "scaling": `
-`,
- "settings": `
-`,
- "smile": `
-`,
- "sort-asc": `
-`,
- "sort-desc": `
-`,
- "star": `
-`,
- "sticker": `
-`,
- "text": ``,
- "table-2": `
-`,
- "table": `
-`,
- "trash": `
-`,
- "type": `
-`,
- "underline": `
-`,
- "unfold-horizontal": `
-`,
- "unfold-vertical": `
-`,
- "unplug": `
-`,
- "wrap-text": `
-`,
- "x-square": `
-`,
- "zap": `
-`,
- "vault": ``,
- "mk-logo": ``,
- "package-plus": ``,
- "square-kanban": ``,
- "formula": ``,
- "clipboard-pen": ``,
- "clipboard-add": ``,
- "live": ``,
- "insert": ``,
- "tabs": ``
-};
-
-// src/core/react/components/System/IconsSet.tsx
-var import_react109 = __toESM(require_react());
-var IconSet = (props) => {
- const [iconSets, setIconSets] = import_react109.default.useState([]);
- const [icons, setIcons] = import_react109.default.useState([]);
- (0, import_react109.useEffect)(() => {
- Object.keys(uiIconSet).filter((f2, i4) => i4 < 10).forEach((icon) => {
- setIcons((f2) => [...f2, "ui//" + icon]);
- });
- }, []);
- return /* @__PURE__ */ import_react109.default.createElement("div", null, /* @__PURE__ */ import_react109.default.createElement("div", null, icons.map((c3, i4) => /* @__PURE__ */ import_react109.default.createElement("div", {
- key: i4,
- className: "mk-icon-small",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(c3)
- }
- }))));
-};
-
-// src/core/react/components/System/ImageSet.tsx
-var import_react110 = __toESM(require_react());
-var ImageSet = (props) => {
- const [images, setImages] = import_react110.default.useState([]);
- const [currentSet, setCurrentSet] = import_react110.default.useState(null);
- const addImage = (image3) => {
- setImages([...images, image3]);
- };
- return /* @__PURE__ */ import_react110.default.createElement("div", null);
-};
-
-// src/core/react/components/System/MaterialsSet.tsx
-var import_react111 = __toESM(require_react());
-var MaterialsSet = (props) => {
- const [materials, setMaterials] = import_react111.default.useState([]);
- return /* @__PURE__ */ import_react111.default.createElement("div", null, /* @__PURE__ */ import_react111.default.createElement("div", null, colors.map((c3, i4) => /* @__PURE__ */ import_react111.default.createElement("div", {
- key: i4,
- "aria-label": c3[0],
- onMouseDown: () => {
- },
- className: "mk-color",
- style: { background: c3[1] }
- })), /* @__PURE__ */ import_react111.default.createElement("div", null, "Add")), /* @__PURE__ */ import_react111.default.createElement("div", null, colorsBase.map((c3, i4) => /* @__PURE__ */ import_react111.default.createElement("div", {
- key: i4,
- "aria-label": c3[0],
- onMouseDown: () => {
- },
- className: "mk-color",
- style: { background: c3[1] }
- }))));
-};
-
-// src/core/react/components/System/SystemActions.tsx
-var import_react118 = __toESM(require_react());
-
-// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx
-var import_react117 = __toESM(require_react());
-
-// src/core/react/components/UI/Dropdown.tsx
-var import_react112 = __toESM(require_react());
-var Dropdown2 = (props) => {
- const openMenu = (e5) => {
- const offset2 = e5.target.getBoundingClientRect();
- props.superstate.ui.openMenu(offset2, {
- ui: props.superstate.ui,
- editable: true,
- value: [props.value],
- options: props.options,
- saveOptions: (options, value) => {
- props.selectValue(value[0]);
- }
- });
- };
- return /* @__PURE__ */ import_react112.default.createElement("div", {
- className: "mk-cell-option-item",
- onClick: (e5) => props.triggerMenu ? props.triggerMenu(e5) : openMenu(e5)
- }, /* @__PURE__ */ import_react112.default.createElement("div", null, props.options ? props.options.find((f2) => f2.value == props.value)?.name : props.value), /* @__PURE__ */ import_react112.default.createElement("div", {
- className: "mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//collapse-solid")
- }
- }));
-};
-
-// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx
-var import_react115 = __toESM(require_react());
-
-// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx
-var import_react114 = __toESM(require_react());
-
-// src/core/react/components/SpaceEditor/Actions/BuiltinPropertyEditor.tsx
-var import_react113 = __toESM(require_react());
-var BuiltinPropertyEditor = (props) => {
- const allOptions = (0, import_react113.useMemo)(() => {
- const options = props.fields.map((f2) => ({
- id: f2.name,
- field: f2.name,
- vType: f2.type,
- label: f2.name,
- defaultFilter: "is",
- type: "property",
- description: ""
- }));
- return options;
- }, []);
- const editFormula = (e5) => {
- const _props = {
- superstate: props.superstate,
- saveFormula: (value) => props.saveTree({
- ...props.actionTree,
- props: {
- ...props.actionTree.props,
- $function: value
- }
- }),
- formula: props.actionTree.props["$function"],
- value: props.values,
- fields: props.fields,
- path: props.path
- };
- props.superstate.ui.openCustomMenu(
- e5.target.getBoundingClientRect(),
- /* @__PURE__ */ import_react113.default.createElement(FormulaEditor, {
- ..._props
- }),
- { ..._props },
- "bottom"
- );
- };
- return props.command.schema.id == "formula" ? /* @__PURE__ */ import_react113.default.createElement("button", {
- onClick: (e5) => editFormula(e5)
- }, "Edit Formula") : props.command.schema.id == "filter" ? /* @__PURE__ */ import_react113.default.createElement(SpaceQuery, {
- superstate: props.superstate,
- filters: props.actionTree.props["$function"] ?? [],
- setFilters: (filters) => {
- props.saveTree({
- ...props.actionTree,
- props: {
- ...props.actionTree.props,
- $function: filters
- }
- });
- },
- fields: allOptions,
- sections: [],
- removeable: true
- }) : /* @__PURE__ */ import_react113.default.createElement(import_react113.default.Fragment, null);
-};
-
-// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx
-var ActionNode = (props) => {
- const [action, setAction] = import_react114.default.useState(props.actionTree?.action);
- const command = (0, import_react114.useMemo)(
- () => props.superstate.cli.commandForAction(action),
- [action]
- );
- (0, import_react114.useEffect)(() => {
- setAction(props.actionTree?.action);
- }, [props.actionTree]);
- const selectAction = (e5, add4) => {
- const options = [...allActions(props.superstate, props.path)];
- const sections = [...new Set(options.map((f2) => f2.section))].map((f2) => ({
- name: f2,
- value: f2
- }));
- const offset2 = e5.target.getBoundingClientRect();
- props.superstate.ui.openMenu(offset2, {
- ui: props.superstate.ui,
- editable: true,
- value: [action],
- options,
- sections,
- showSections: true,
- saveOptions: (options2, value) => {
- if (add4) {
- props.saveTree({
- ...props.actionTree,
- children: [
- ...props.actionTree.children,
- { action: value[0], props: {}, propsValue: {}, children: [] }
- ]
- });
- return;
- }
- props.saveTree({ ...props.actionTree, action: value[0] });
- }
- });
- };
- const selectLinkedProp = (e5, prop2) => {
- const options = props.fields.map((f2) => ({ name: f2.name, value: f2.name }));
- const offset2 = e5.target.getBoundingClientRect();
- props.superstate.ui.openMenu(offset2, {
- ui: props.superstate.ui,
- editable: true,
- value: [],
- options,
- saveOptions: (options2, value) => {
- props.saveTree({
- ...props.actionTree,
- linked: { ...props.actionTree.linked, [prop2]: value[0] }
- });
- }
- });
- };
- return /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-editor-actions-node"
- }, /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-editor-actions-body"
- }, /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-editor-actions-name"
- }, /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-path-icon",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(
- command ? stickerForSchema(command.schema) : "ui//plus"
- )
- }
- }), /* @__PURE__ */ import_react114.default.createElement("div", {
- onClick: (e5) => !command && selectAction(e5),
- className: "mk-editor-actions-selector"
- }, command?.schema.name ?? "Select"), /* @__PURE__ */ import_react114.default.createElement("span", null), props.deleteTree && /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-icon-small",
- onClick: (e5) => props.deleteTree(),
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//close")
- }
- })), command && /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-editor-actions-fields"
- }, command.schema.type == "builtin" ? /* @__PURE__ */ import_react114.default.createElement(BuiltinPropertyEditor, {
- superstate: props.superstate,
- command,
- actionTree: props.actionTree,
- saveTree: props.saveTree,
- fields: [...props.fields, props.prevField].filter((f2) => f2),
- values: props.values,
- path: props.path
- }) : command?.fields.map((f2, i4) => {
- return /* @__PURE__ */ import_react114.default.createElement(DataPropertyView, {
- key: i4,
- superstate: props.superstate,
- column: f2,
- columns: props.fields,
- initialValue: props.actionTree.props[f2.name],
- updateValue: (value) => {
- const newTree = { ...props.actionTree };
- newTree.props[f2.name] = value;
- props.saveTree(newTree);
- },
- updateFieldValue: (fieldValue, value) => {
- const newTree = { ...props.actionTree };
- newTree.props[f2.name] = value;
- newTree.propsValue[f2.name] = fieldValue;
- props.saveTree(newTree);
- },
- editMode: 5 /* EditModeAlways */,
- linkProp: (e5) => selectLinkedProp(e5, f2.name)
- });
- }))), /* @__PURE__ */ import_react114.default.createElement("div", {
- className: props.hasSiblings ? "mk-editor-actions-children" : ""
- }, props.actionTree.children.map((child, i4) => /* @__PURE__ */ import_react114.default.createElement(ActionNode, {
- key: i4,
- hasSiblings: props.actionTree.children.length > 1,
- prevField: command?.fields[i4],
- superstate: props.superstate,
- path: props.path,
- fields: props.fields,
- actionTree: child,
- saveTree: (tree) => {
- const newTree = { ...props.actionTree };
- newTree.children[i4] = tree;
- props.saveTree(newTree);
- },
- values: props.values,
- deleteTree: () => {
- const newTree = { ...props.actionTree };
- newTree.children.splice(i4, 1);
- props.saveTree(newTree);
- }
- })), props.actionTree.children.length == 0 && /* @__PURE__ */ import_react114.default.createElement("button", {
- onClick: (e5) => selectAction(e5, true),
- className: "mk-inline-button"
- }, /* @__PURE__ */ import_react114.default.createElement("div", {
- className: "mk-icon-xsmall",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
- }
- }), "Add Step")));
-};
-
-// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx
-var ActionEditor = (props) => {
- const [actionTree, setActionTree] = import_react115.default.useState(
- parseActionString(props.formula) ?? {
- action: "",
- props: {},
- propsValue: {},
- children: []
- }
- );
- return /* @__PURE__ */ import_react115.default.createElement("div", {
- className: "mk-editor-actions-nodes"
- }, /* @__PURE__ */ import_react115.default.createElement(ActionNode, {
- hasSiblings: false,
- superstate: props.superstate,
- prevField: null,
- actionTree,
- path: props.path,
- fields: props.fields,
- values: props.value,
- saveTree: (tree) => {
- props.saveFormula(JSON.stringify(tree));
- setActionTree(tree);
- }
- }));
-};
-
-// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx
-var import_react116 = __toESM(require_react());
-
-// node_modules/@uiw/codemirror-theme-github/esm/index.js
-var defaultSettingsGithubLight = {
- background: "#fff",
- foreground: "#24292e",
- selection: "#BBDFFF",
- selectionMatch: "#BBDFFF",
- gutterBackground: "#fff",
- gutterForeground: "#6e7781"
-};
-var githubLightInit = (options) => {
- var {
- theme = "light",
- settings = {},
- styles: styles2 = []
- } = options || {};
- return createTheme({
- theme,
- settings: _extends({}, defaultSettingsGithubLight, settings),
- styles: [{
- tag: [tags2.standard(tags2.tagName), tags2.tagName],
- color: "#116329"
- }, {
- tag: [tags2.comment, tags2.bracket],
- color: "#6a737d"
- }, {
- tag: [tags2.className, tags2.propertyName],
- color: "#6f42c1"
- }, {
- tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator],
- color: "#005cc5"
- }, {
- tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName],
- color: "#d73a49"
- }, {
- tag: [tags2.string, tags2.meta, tags2.regexp],
- color: "#032f62"
- }, {
- tag: [tags2.name, tags2.quote],
- color: "#22863a"
- }, {
- tag: [tags2.heading, tags2.strong],
- color: "#24292e",
- fontWeight: "bold"
- }, {
- tag: [tags2.emphasis],
- color: "#24292e",
- fontStyle: "italic"
- }, {
- tag: [tags2.deleted],
- color: "#b31d28",
- backgroundColor: "ffeef0"
- }, {
- tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)],
- color: "#e36209"
- }, {
- tag: [tags2.url, tags2.escape, tags2.regexp, tags2.link],
- color: "#032f62"
- }, {
- tag: tags2.link,
- textDecoration: "underline"
- }, {
- tag: tags2.strikethrough,
- textDecoration: "line-through"
- }, {
- tag: tags2.invalid,
- color: "#cb2431"
- }, ...styles2]
- });
-};
-var githubLight = githubLightInit();
-var defaultSettingsGithubDark = {
- background: "#0d1117",
- foreground: "#c9d1d9",
- caret: "#c9d1d9",
- selection: "#003d73",
- selectionMatch: "#003d73",
- lineHighlight: "#36334280"
-};
-var githubDarkInit = (options) => {
- var {
- theme = "dark",
- settings = {},
- styles: styles2 = []
- } = options || {};
- return createTheme({
- theme,
- settings: _extends({}, defaultSettingsGithubDark, settings),
- styles: [{
- tag: [tags2.standard(tags2.tagName), tags2.tagName],
- color: "#7ee787"
- }, {
- tag: [tags2.comment, tags2.bracket],
- color: "#8b949e"
- }, {
- tag: [tags2.className, tags2.propertyName],
- color: "#d2a8ff"
- }, {
- tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator],
- color: "#79c0ff"
- }, {
- tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName],
- color: "#ff7b72"
- }, {
- tag: [tags2.string, tags2.meta, tags2.regexp],
- color: "#a5d6ff"
- }, {
- tag: [tags2.name, tags2.quote],
- color: "#7ee787"
- }, {
- tag: [tags2.heading, tags2.strong],
- color: "#d2a8ff",
- fontWeight: "bold"
- }, {
- tag: [tags2.emphasis],
- color: "#d2a8ff",
- fontStyle: "italic"
- }, {
- tag: [tags2.deleted],
- color: "#ffdcd7",
- backgroundColor: "ffeef0"
- }, {
- tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)],
- color: "#ffab70"
- }, {
- tag: tags2.link,
- textDecoration: "underline"
- }, {
- tag: tags2.strikethrough,
- textDecoration: "line-through"
- }, {
- tag: tags2.invalid,
- color: "#f97583"
- }, ...styles2]
- });
-};
-var githubDark = githubDarkInit();
-
-// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx
-var ScriptEditor = (props) => {
- const { command } = props;
- const value = (0, import_react116.useMemo)(() => {
- if (!command)
- return "";
- return `const ${command.schema.id} = (${command.fields.map((f2) => `${f2.name}: ${f2.type}`).join(", ")}, $api: API, $contexts) => {
-${command.code}
-}`;
- }, [command]);
- const saveCommand = (value2) => {
- props.saveCommand({
- ...command,
- code: value2.split("\n").slice(1, -1).join("\n"),
- codeType: "script"
- });
- };
- return /* @__PURE__ */ import_react116.default.createElement("div", null, /* @__PURE__ */ import_react116.default.createElement(esm_default, {
- className: "mk-editor-code",
- value,
- height: "100%",
- theme: githubDark,
- extensions: [javascript({ jsx: true })],
- onChange: saveCommand
- }), /* @__PURE__ */ import_react116.default.createElement(ActionTester, {
- type: "script",
- code: command.code,
- fields: command.fields,
- value: {},
- superstate: props.superstate,
- path: props.path
- }));
-};
-
-// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx
-var SpaceCommand = (props) => {
- const [command, setCommand] = (0, import_react117.useState)(null);
- const uri = (0, import_react117.useMemo)(() => {
- return props.superstate.spaceManager.uriByString(props.action);
- }, [props.action]);
- const saveCommand = (command2) => {
- setCommand(command2);
- if (uri.authority == "$actions") {
- props.superstate.spaceManager.saveSystemCommand(
- uri.path.split("/").pop(),
- command2
- );
- return;
- }
- props.superstate.spaceManager.saveCommand(
- uri.path,
- command2.schema.id,
- () => command2
- );
- };
- (0, import_react117.useEffect)(() => {
- setCommand(props.superstate.cli.commandForAction(props.action));
- }, [props.action]);
- (0, import_react117.useEffect)(() => {
- const listener = (f2) => {
- if (f2.path == uri.basePath)
- setCommand(props.superstate.cli.commandForAction(props.action));
- };
- props.superstate.eventsDispatcher.addListener(
- "actionStateUpdated",
- listener
- );
- return () => {
- props.superstate.eventsDispatcher.removeListener(
- "actionStateUpdated",
- listener
- );
- };
- });
- const saveField = (source, field) => {
- saveCommand({
- ...command,
- fields: [...command.fields, field]
- });
- };
- const deleteProperty2 = (field) => {
- saveCommand({
- ...command,
- fields: command.fields.filter((f2) => f2.name != field.name)
- });
- };
- const updateField = (newField, oldField) => {
- saveCommand({
- ...command,
- fields: command.fields.map((f2) => {
- if (f2.name == oldField.name) {
- return newField;
- }
- return f2;
- })
- });
- };
- const newProperty = (e5) => {
- const offset2 = e5.target.getBoundingClientRect();
- showNewPropertyMenu(
- props.superstate,
- offset2,
- [],
- [],
- saveField,
- command.schema.id,
- null,
- true,
- true
- );
- };
- const menuItems = [
- { name: "Actions", value: "actions" },
- { name: "Script", value: "script" },
- { name: "Formula", value: "formula" }
- ];
- const defaultValueForField = (field) => {
- const parsedValue = parseFieldValue(field.value, field.type);
- if (parsedValue) {
- return parsedValue?.default;
- }
- };
- const saveDefaultValueForField = (field, value) => {
- const parsedValue = parseFieldValue(field.value, field.type) ?? {};
- parsedValue.default = value;
- updateField(
- {
- ...field,
- value: JSON.stringify(parsedValue)
- },
- field
- );
- };
- const defaultValues = (0, import_react117.useMemo)(() => {
- return command?.fields.reduce((p2, c3) => {
- return { ...p2, [c3.name]: defaultValueForField(c3) };
- }, {}) ?? {};
- }, [command?.fields]);
- return /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-editor-actions"
- }, command && /* @__PURE__ */ import_react117.default.createElement(import_react117.default.Fragment, null, /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-props-contexts"
- }, /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-path-context-row"
- }, /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-path-context-field"
- }, "Type"), /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-path-context-value"
- }, /* @__PURE__ */ import_react117.default.createElement(Dropdown2, {
- superstate: props.superstate,
- options: menuItems,
- value: command.schema.type,
- selectValue: (value) => saveCommand({
- ...command,
- schema: {
- ...command.schema,
- type: value
- }
- })
- }))), /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-path-context-row"
- }, /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-path-context-field"
- }, "Properties")), /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-cell-object"
- }, command.fields.map((f2) => {
- return /* @__PURE__ */ import_react117.default.createElement(DataPropertyView, {
- key: f2.name,
- superstate: props.superstate,
- initialValue: defaultValueForField(f2),
- column: f2,
- editMode: 5 /* EditModeAlways */,
- updateValue: (value) => {
- saveDefaultValueForField(f2, value);
- },
- updateFieldValue: (fieldValue, value) => {
- saveCommand({
- ...command,
- fields: command.fields.map((g) => {
- if (f2.name == g.name) {
- return {
- ...g,
- value: fieldValue
- };
- }
- return g;
- })
- });
- },
- propertyMenu: (e5) => {
- const offset2 = e5.target.getBoundingClientRect();
- showPropertyMenu({
- superstate: props.superstate,
- rect: offset2,
- editable: true,
- options: [],
- field: f2,
- fields: command.fields,
- contextPath: null,
- saveField: (newField) => updateField(newField, f2),
- deleteColumn: deleteProperty2
- });
- }
- });
- })), /* @__PURE__ */ import_react117.default.createElement("button", {
- className: "mk-inline-button",
- onClick: (e5) => newProperty(e5)
- }, /* @__PURE__ */ import_react117.default.createElement("div", {
- className: "mk-icon-xsmall",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
- }
- }), i18n_default.labels.newProperty)), command.schema.type == "script" ? /* @__PURE__ */ import_react117.default.createElement(ScriptEditor, {
- superstate: props.superstate,
- command,
- saveCommand,
- values: defaultValues,
- path: uri.path
- }) : command.schema.type == "actions" ? /* @__PURE__ */ import_react117.default.createElement(ActionEditor, {
- superstate: props.superstate,
- formula: command.code,
- path: uri.path,
- saveOutputType: (outputType) => {
- saveCommand({
- ...command,
- codeType: outputType
- });
- },
- saveFormula: (formula) => {
- saveCommand({
- ...command,
- code: formula
- });
- },
- fields: command.fields,
- value: defaultValues
- }) : command.schema.type == "formula" ? /* @__PURE__ */ import_react117.default.createElement(FormulaEditor, {
- superstate: props.superstate,
- formula: command.code,
- saveFormula: (formula) => {
- saveCommand({
- ...command,
- code: formula
- });
- },
- fields: command.fields,
- value: defaultValues,
- path: uri.path
- }) : /* @__PURE__ */ import_react117.default.createElement("div", null)));
-};
-
-// src/core/react/components/System/SystemActions.tsx
-var SystemActionsEditor = (props) => {
- const [selectedCommand, setSelectedCommand] = (0, import_react118.useState)();
- const saveCommand = (command) => {
- props.superstate.spaceManager.saveSystemCommand(
- selectedCommand.library,
- command
- );
- };
- const addLibrary = () => {
- props.superstate.spaceManager.saveSystemCommand(
- selectedCommand.library,
- null
- );
- };
- return /* @__PURE__ */ import_react118.default.createElement("div", {
- style: { display: "flex" }
- }, selectedCommand && /* @__PURE__ */ import_react118.default.createElement("div", null, /* @__PURE__ */ import_react118.default.createElement(SpaceCommand, {
- superstate: props.superstate,
- action: "spaces://$actions/" + selectedCommand.library + "/#;" + selectedCommand.command.schema.id
- })));
-};
-
-// src/core/react/components/System/Templates.tsx
-var import_react119 = __toESM(require_react());
-var Templates = (props) => {
- return /* @__PURE__ */ import_react119.default.createElement("div", null, /* @__PURE__ */ import_react119.default.createElement("h1", null, "Templates"));
-};
-
-// src/core/react/components/System/SystemSettings.tsx
-var SystemSettings = (props) => {
- const [tab2, setTab] = (0, import_react120.useState)(0);
- const [loadout, setLoadOut] = (0, import_react120.useState)();
- const loadouts = props.superstate.loadouts;
- return /* @__PURE__ */ import_react120.default.createElement("div", null, /* @__PURE__ */ import_react120.default.createElement("div", {
- style: { display: "flex", flexDirection: "column" }
- }, "System Name", /* @__PURE__ */ import_react120.default.createElement("input", {
- value: props.superstate.settings.systemName,
- onChange: (e5) => {
- props.superstate.settings.systemName = e5.target.value;
- }
- }), /* @__PURE__ */ import_react120.default.createElement("div", null, /* @__PURE__ */ import_react120.default.createElement("h2", null, "Loadouts"), loadouts.map((l2, i4) => /* @__PURE__ */ import_react120.default.createElement("div", {
- key: i4,
- onClick: () => {
- setLoadOut(l2);
- }
- }, l2.name)), /* @__PURE__ */ import_react120.default.createElement("button", {
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
- },
- onClick: () => props.superstate.ui.openModal(
- "New Loadout",
- (_props) => /* @__PURE__ */ import_react120.default.createElement(InputModal, {
- value: "",
- saveLabel: "Save",
- hide: _props.hide,
- saveValue: (label) => {
- setLoadOut({
- name: label
- });
- }
- })
- )
- })), /* @__PURE__ */ import_react120.default.createElement("div", null, "Appearance", /* @__PURE__ */ import_react120.default.createElement("h2", null, "Typography")), "Space View", /* @__PURE__ */ import_react120.default.createElement("p", null, "Font"), "Palette Default New Template", /* @__PURE__ */ import_react120.default.createElement(MaterialsSet, {
- superstate: props.superstate
- }), "Icons", /* @__PURE__ */ import_react120.default.createElement(IconSet, {
- superstate: props.superstate
- }), "Images", /* @__PURE__ */ import_react120.default.createElement(ImageSet, {
- superstate: props.superstate
- }), /* @__PURE__ */ import_react120.default.createElement(Templates, {
- superstate: props.superstate
- }), /* @__PURE__ */ import_react120.default.createElement(SystemActionsEditor, {
- superstate: props.superstate
- })));
-};
-
-// src/adapters/obsidian/SpaceViewContainer.tsx
-var import_obsidian3 = require("obsidian");
-var import_react129 = __toESM(require_react());
-
-// src/core/react/components/MarkdownEditor/BannerView.tsx
-var import_react121 = __toESM(require_react());
-var BannerView = (props) => {
- const [hasSticker, setHasSticker] = (0, import_react121.useState)(false);
- const { pathState } = (0, import_react121.useContext)(PathContext);
- const [banner, setBanner] = (0, import_react121.useState)(
- props.superstate.spaceManager.uriByString(
- pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner]
- )
- );
- (0, import_react121.useEffect)(() => {
- const banner2 = props.superstate.spaceManager.uriByString(
- pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner]
- );
- const hasSticker2 = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0;
- setHasSticker(hasSticker2);
- if (banner2) {
- setBanner(banner2);
- } else {
- setBanner(null);
- }
- }, [pathState]);
- const offset2 = pathState?.metadata.property?.banner_y ? `${(parseFloat(pathState?.metadata.property?.banner_y) * 100).toString()}%` : "center";
- const triggerBannerContextMenu = (e5) => {
- e5.preventDefault();
- const menuOptions = [
- {
- name: i18n_default.buttons.changeBanner,
- value: "change",
- icon: "ui//image",
- onClick: (ev) => {
- props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react121.default.createElement(ImageModal_default, {
- superstate: props.superstate,
- hide: _props.hide,
- selectedPath: (image3) => savePathBanner(props.superstate, pathState.path, image3)
- }));
- }
- },
- {
- name: i18n_default.buttons.removeBanner,
- value: "remove",
- icon: "ui//file-minus",
- onClick: (ev) => {
- if (props.superstate.spacesIndex.has(pathState.path)) {
- props.superstate.spaceManager.deleteProperty(
- props.superstate.spacesIndex.get(pathState.path).defPath,
- props.superstate.settings.fmKeyBanner
- );
- }
- props.superstate.spaceManager.deleteProperty(
- pathState.path,
- props.superstate.settings.fmKeyBanner
- );
- }
- }
- ];
- props.superstate.ui.openMenu(
- {
- x: e5.clientX,
- y: e5.clientY,
- width: 0,
- height: 0
- },
- defaultMenu(props.superstate.ui, menuOptions)
- );
- return false;
- };
- return banner ? /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null, /* @__PURE__ */ import_react121.default.createElement("div", {
- className: `mk-space-banner`,
- onContextMenu: triggerBannerContextMenu,
- style: {
- "--mk-banner-height": props.superstate.settings.bannerHeight + "px",
- backgroundImage: `url("${banner.scheme == "vault" ? props.superstate.ui.getUIPath(banner.basePath) : banner.fullPath}")`,
- backgroundPositionY: offset2
- }
- }), /* @__PURE__ */ import_react121.default.createElement("div", {
- className: `mk-spacer`,
- style: {
- "--mk-header-height": ((isTouchScreen(props.superstate.ui) ? 1 : 0) * 26 + (props.superstate.settings.bannerHeight - 62) + (!props.superstate.settings.spacesStickers || props.superstate.settings.inlineContextNameLayout == "horizontal" ? 50 : hasSticker ? 0 : 30)).toString() + "px"
- },
- onContextMenu: (e5) => e5.preventDefault()
- })) : /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null);
-};
-
-// src/core/react/components/SpaceView/SpaceHeader.tsx
-var import_react125 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx
-var import_react123 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Contexts/SpaceEditor/SpaceProperties.tsx
-var import_react122 = __toESM(require_react());
-var SpaceHeaderView = (props) => {
- const { pathState } = (0, import_react122.useContext)(PathContext);
- const { spaceState } = (0, import_react122.useContext)(SpaceContext);
- const [tab2, setTab] = (0, import_react122.useState)(0);
- const tabs = [
- { label: "Items", icon: "ui//file-stack", tab: 0 },
- { label: "Lists", icon: "ui//layout-list", tab: 2 },
- { label: "Actions", icon: "ui//mouse-pointer-click", tab: 3 }
- ];
- return /* @__PURE__ */ import_react122.default.createElement(import_react122.default.Fragment, null, /* @__PURE__ */ import_react122.default.createElement("div", {
- className: "mk-header-space"
- }, /* @__PURE__ */ import_react122.default.createElement("div", {
- className: "mk-tabs-space"
- }, tabs.map((f2, i4) => /* @__PURE__ */ import_react122.default.createElement("div", {
- key: i4,
- onClick: () => {
- openSpaceEditorModal(props.superstate, spaceState, f2.tab);
- },
- className: `mk-path-info`
- }, /* @__PURE__ */ import_react122.default.createElement("div", {
- "aria-label": f2.label,
- className: "mk-icon-small",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(f2.icon)
- }
- }), f2.label))), /* @__PURE__ */ import_react122.default.createElement("div", {
- className: "mk-props-contexts"
- }, /* @__PURE__ */ import_react122.default.createElement(PathContextList, {
- superstate: props.superstate,
- color: "var(--tag-background)",
- path: pathState.path
- }), /* @__PURE__ */ import_react122.default.createElement(PropertiesView, {
- superstate: props.superstate,
- spaces: props.spaces.map((f2) => f2.path),
- force: true,
- excludeKeys: [
- ...FMMetadataKeys(props.superstate.settings),
- ...FMSpaceKeys(props.superstate.settings)
- ],
- editable: true
- }))));
-};
-
-// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx
-var NoteSpacesBar = (props) => {
- const { addToSpace, removeFromSpace, pathState } = (0, import_react123.useContext)(PathContext);
- const showContextMenu = (e5, path3) => {
- const space3 = props.superstate.spacesIndex.get(path3);
- if (!space3)
- return;
- e5.preventDefault();
- const menuOptions = [];
- menuOptions.push({
- name: i18n_default.menu.openSpace,
- icon: "ui//layout-grid",
- onClick: (e6) => {
- props.superstate.ui.openPath(space3.path, e6.metaKey);
- }
- });
- menuOptions.push({
- name: i18n_default.labels.newProperty,
- icon: "ui//plus",
- onClick: (e6) => {
- newProperty(e6, space3.path);
- }
- });
- if (removeFromSpace)
- menuOptions.push({
- name: i18n_default.menu.removeFromSpace,
- icon: "ui//trash",
- onClick: (e6) => {
- removeFromSpace(space3.path);
- }
- });
- const offset2 = e5.target.getBoundingClientRect();
- props.superstate.ui.openMenu(
- offset2,
- defaultMenu(props.superstate.ui, menuOptions)
- );
- };
- const spacesFromPath = (path3) => {
- return [...props.superstate.spacesMap.get(path3)].map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2 && f2.type != "default" && f2.path != "/").map((f2) => props.superstate.pathsIndex.get(f2.path)).sort(
- (f2, k2) => path3.startsWith(f2.path) ? -1 : path3.startsWith(k2.path) ? 1 : 0
- ).filter((f2) => f2);
- };
- const spacePathStates = (0, import_react123.useMemo)(
- () => spacesFromPath(pathState.path),
- [pathState]
- );
- const spaces2 = (0, import_react123.useMemo)(
- () => [...props.superstate.spacesMap.get(pathState?.path) ?? []].map((f2) => props.superstate.spacesIndex.get(f2)?.space).filter((f2) => f2),
- [pathState]
- );
- const saveField = (source, field) => {
- if (source == "fm") {
- props.superstate.spaceManager.addProperty(pathState.path, field);
- return;
- }
- props.superstate.spaceManager.addSpaceProperty(source, field);
- };
- const newProperty = (e5, space3) => {
- const offset2 = e5.target.getBoundingClientRect();
- showNewPropertyMenu(
- props.superstate,
- offset2,
- [],
- [],
- (source, field) => saveField(space3, field),
- defaultContextSchemaID,
- space3
- );
- };
- const showAddMenu = (e5) => {
- const offset2 = e5.target.getBoundingClientRect();
- showSpacesMenu(
- offset2,
- props.superstate,
- (link3, isNew) => {
- if (isNew) {
- if (link3.charAt(0) == "#") {
- addTagToPath(props.superstate, pathState.path, link3);
- } else {
- createSpace(props.superstate, link3, { links: [pathState.path] });
- }
- } else {
- addToSpace(link3);
- }
- },
- false,
- true
- );
- };
- return /* @__PURE__ */ import_react123.default.createElement(import_react123.default.Fragment, null, /* @__PURE__ */ import_react123.default.createElement("div", {
- className: "mk-props-contexts"
- }, /* @__PURE__ */ import_react123.default.createElement("div", {
- className: "mk-path-context-row"
- }, /* @__PURE__ */ import_react123.default.createElement("div", {
- className: "mk-props-contexts-space-list"
- }, spacePathStates.map((f2, i4) => /* @__PURE__ */ import_react123.default.createElement("div", {
- key: i4,
- className: "mk-props-contexts-space-name",
- onContextMenu: (e5) => showContextMenu(e5, f2.path),
- onClick: (e5) => props.superstate.ui.openPath(f2.path, e5.metaKey),
- style: f2.label?.color?.length > 0 ? {
- "--tag-background": f2.label?.color,
- "--tag-color": "var(--color-white)"
- } : {}
- }, /* @__PURE__ */ import_react123.default.createElement("div", {
- className: `mk-icon-xsmall`,
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(f2.label?.sticker)
- }
- }), f2.name)), /* @__PURE__ */ import_react123.default.createElement("div", {
- className: "mk-props-contexts-space-name",
- onClick: (e5) => showAddMenu(e5),
- style: {
- opacity: 0.5
- }
- }, /* @__PURE__ */ import_react123.default.createElement("span", {
- className: "mk-icon-xsmall",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
- }
- }), i18n_default.buttons.addToSpace))), pathState.type == "space" ? /* @__PURE__ */ import_react123.default.createElement(SpaceHeaderView, {
- superstate: props.superstate,
- spacePathStates,
- spaces: spaces2
- }) : /* @__PURE__ */ import_react123.default.createElement(import_react123.default.Fragment, null, /* @__PURE__ */ import_react123.default.createElement(PathContextList, {
- superstate: props.superstate,
- color: "var(--tag-background)",
- path: pathState.path
- }), /* @__PURE__ */ import_react123.default.createElement(PropertiesView, {
- superstate: props.superstate,
- spaces: spaces2.map((f2) => f2.path),
- force: true,
- excludeKeys: [
- ...FMMetadataKeys(props.superstate.settings),
- ...FMSpaceKeys(props.superstate.settings)
- ],
- editable: true
- }))));
-};
-
-// src/core/react/components/SpaceView/TitleComponent.tsx
-var import_react124 = __toESM(require_react());
-var TitleComponent = (props) => {
- const { pathState } = (0, import_react124.useContext)(PathContext);
- const { spaceState } = (0, import_react124.useContext)(SpaceContext);
- const fileNameRef = (0, import_react124.useRef)(null);
- const name317 = (0, import_react124.useMemo)(
- () => pathState ? props.superstate.settings.spacesUseAlias ? pathState?.displayName : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null,
- [pathState]
- );
- const contentEditable = !props.readOnly && spaceState?.type != "default";
- const onBlur = (e5) => {
- const newValue = e5.target.innerText;
- if (newValue != name317) {
- if (pathState.path == "/") {
- props.superstate.settings.systemName = newValue;
- props.superstate.saveSettings();
- props.superstate.reloadSpaceByPath("/");
- return;
- }
- if (props.superstate.settings.spacesUseAlias) {
- updatePrimaryAlias(
- props.superstate,
- pathState.path,
- pathState.metadata.aliases,
- newValue
- );
- } else {
- renamePathByName(props.superstate, pathState.path, newValue);
- }
- }
- };
- const onKeyPress = (e5) => {
- e5.stopPropagation();
- };
- const onKeyUp = (e5) => {
- e5.stopPropagation();
- };
- const onKeyDown = (e5) => {
- e5.stopPropagation();
- if (e5.key == "a" && e5.metaKey) {
- e5.preventDefault();
- const selection2 = window.getSelection();
- const range2 = document.createRange();
- range2.selectNodeContents(e5.target);
- selection2.removeAllRanges();
- selection2.addRange(range2);
- }
- if (e5.key == "Enter") {
- e5.target.blur();
- e5.preventDefault();
- }
- if (e5.key == "Escape") {
- e5.target.blur();
- e5.preventDefault();
- }
- };
- const hasSticker = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0;
- const hasBanner = pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner];
- return pathState && /* @__PURE__ */ import_react124.default.createElement(import_react124.default.Fragment, null, props.superstate.settings.spacesStickers && /* @__PURE__ */ import_react124.default.createElement("div", {
- className: "mk-header-icon",
- style: hasBanner ? {
- "--label-color": "var(--mk-ui-background)"
- } : {}
- }, hasSticker ? /* @__PURE__ */ import_react124.default.createElement(PathStickerContainer, {
- superstate: props.superstate,
- path: pathState.path
- }) : /* @__PURE__ */ import_react124.default.createElement("button", {
- className: "mk-inline-button",
- onClick: (e5) => props.superstate.ui.openPalette(
- (_props) => /* @__PURE__ */ import_react124.default.createElement(StickerModal_default, {
- ui: props.superstate.ui,
- hide: _props.hide,
- selectedSticker: (emoji) => savePathIcon(props.superstate, pathState.path, emoji)
- })
- )
- }, /* @__PURE__ */ import_react124.default.createElement("div", {
- className: "mk-icon-xsmall",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//smile")
- }
- }), i18n_default.buttons.addIcon), /* @__PURE__ */ import_react124.default.createElement("span", null), !hasBanner && /* @__PURE__ */ import_react124.default.createElement("button", {
- className: "mk-inline-button",
- onClick: (e5) => props.superstate.ui.openPalette(
- (_props) => /* @__PURE__ */ import_react124.default.createElement(ImageModal_default, {
- superstate: props.superstate,
- hide: _props.hide,
- selectedPath: (image3) => savePathBanner(
- props.superstate,
- pathState.path,
- image3
- )
- })
- )
- }, /* @__PURE__ */ import_react124.default.createElement("div", {
- className: "mk-icon-xsmall",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//mk-make-image")
- }
- }), i18n_default.buttons.addCover)), /* @__PURE__ */ import_react124.default.createElement("div", {
- className: "mk-title-container"
- }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react124.default.createElement("div", {
- className: "mk-title-prefix"
- }, "#") : "", /* @__PURE__ */ import_react124.default.createElement("div", {
- className: "mk-inline-title inline-title",
- ref: fileNameRef,
- contentEditable,
- onBlur,
- onDrop: (e5) => e5.preventDefault(),
- onKeyDown,
- onKeyPress,
- onKeyUp,
- dangerouslySetInnerHTML: {
- __html: name317
- }
- })));
-};
-
-// src/core/react/components/SpaceView/SpaceHeader.tsx
-var SpaceHeader = (props) => {
- const { readMode } = (0, import_react125.useContext)(PathContext);
- const { spaceState } = (0, import_react125.useContext)(SpaceContext);
- const [collapsed, setCollapsed] = (0, import_react125.useState)(
- !props.superstate.settings.inlineContextExpanded
- );
- (0, import_react125.useEffect)(() => {
- props.superstate.settings.inlineContextExpanded = !collapsed;
- props.superstate.saveSettings();
- }, [collapsed]);
- return /* @__PURE__ */ import_react125.default.createElement(import_react125.default.Fragment, null, /* @__PURE__ */ import_react125.default.createElement(BannerView, {
- superstate: props.superstate
- }), /* @__PURE__ */ import_react125.default.createElement("div", {
- className: "mk-space-header"
- }, /* @__PURE__ */ import_react125.default.createElement("div", {
- className: "mk-path-context-label"
- }, /* @__PURE__ */ import_react125.default.createElement(TitleComponent, {
- superstate: props.superstate,
- readOnly: readMode
- }), /* @__PURE__ */ import_react125.default.createElement("div", {
- style: { position: "relative" }
- }, /* @__PURE__ */ import_react125.default.createElement("div", {
- className: "mk-fold"
- }, /* @__PURE__ */ import_react125.default.createElement(CollapseToggle, {
- superstate: props.superstate,
- collapsed,
- onToggle: (c3) => setCollapsed(c3)
- })))), !collapsed && spaceState?.type == "folder" && /* @__PURE__ */ import_react125.default.createElement(NoteSpacesBar, {
- superstate: props.superstate
- })));
-};
-
-// node_modules/@air/react-drag-to-select/dist/index.modern.js
-var import_react126 = __toESM(require_react(), 1);
-var import_react_dom6 = __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 t5 = 1; t5 < arguments.length; t5++) {
- var n3 = arguments[t5];
- for (var r2 in n3)
- Object.prototype.hasOwnProperty.call(n3, r2) && (e5[r2] = n3[r2]);
- }
- return e5;
- }, a3.apply(this, arguments);
-}
-var s3 = ["style"];
-var d3 = (0, import_react126.forwardRef)((t5, u3) => {
- let { style: d4 = {} } = t5, m4 = function(e5, t6) {
- if (null == e5)
- return {};
- var n3, r2, o2 = {}, l2 = Object.keys(e5);
- for (r2 = 0; r2 < l2.length; r2++)
- t6.indexOf(n3 = l2[r2]) >= 0 || (o2[n3] = e5[n3]);
- return o2;
- }(t5, s3);
- const v2 = (0, import_react126.useRef)(null), f2 = (0, import_react126.useRef)(null), [, p2] = (0, import_react126.useState)(0);
- return (0, import_react126.useImperativeHandle)(u3, () => ({ getBoundingClientRect: () => {
- var e5;
- return null == (e5 = v2.current) ? void 0 : e5.getBoundingClientRect();
- }, getParentBoundingClientRect: () => {
- var e5, t6;
- return null == v2 || null == (e5 = v2.current) || null == (t6 = e5.parentElement) ? void 0 : t6.getBoundingClientRect();
- }, drawSelectionBox: (e5) => {
- requestAnimationFrame(() => {
- if (f2.current) {
- const t6 = 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)(t6);
- }
- });
- }, 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_react126.useEffect)(() => {
- p2((e5) => e5 + 1);
- }, []), import_react126.default.createElement("div", { ref: v2 }, v2.current ? import_react_dom6.default.createPortal(import_react126.default.createElement("div", a3({ ref: f2 }, m4)), v2.current) : null);
-});
-var m3 = (e5, t5) => e5.left <= t5.left + t5.width && e5.left + e5.width >= t5.left && e5.top <= t5.top + t5.height && e5.top + e5.height >= t5.top;
-function v(t5) {
- const { onSelectionChange: r2, onSelectionEnd: o2, onSelectionStart: c3, isEnabled: i4 = true, selectionProps: s4 = {}, eventsElement: m4, shouldStartSelecting: v2 } = t5 || {}, f2 = (0, import_react126.useRef)(null), { cancelCurrentSelection: p2 } = function({ containerRef: e5, onSelectionChange: t6, onSelectionStart: r3, onSelectionEnd: o3, isEnabled: c4 = true, eventsElement: i5, shouldStartSelecting: s5 }) {
- const d4 = (0, import_react126.useRef)(null), m5 = (0, import_react126.useRef)(null), v3 = (0, import_react126.useRef)(false), f3 = (0, import_react126.useRef)(t6), p3 = (0, import_react126.useRef)(r3), h3 = (0, import_react126.useRef)(o3), g = (0, import_react126.useRef)(), y3 = (0, import_react126.useRef)(c4);
- f3.current = (0, import_react126.useCallback)((e6) => {
- g.current = t6 ? requestAnimationFrame(() => {
- t6(e6);
- }) : void 0;
- }, [t6]), p3.current = r3, h3.current = o3, y3.current = c4;
- const b2 = (0, import_react126.useCallback)(() => {
- var t7;
- d4.current = null, m5.current = null, v3.current = false, null == (t7 = e5.current) || t7.clearSelectionBox(), "number" == typeof g.current && cancelAnimationFrame(g.current);
- }, [e5]), S3 = (0, import_react126.useCallback)((t7, n3) => {
- var r4, o4, l2;
- return n3 || (n3 = null == (l2 = e5.current) ? void 0 : l2.getParentBoundingClientRect()), { x: t7.clientX - ("number" == typeof (null == (r4 = n3) ? void 0 : r4.left) ? n3.left : 0), y: t7.clientY - ("number" == typeof (null == (o4 = n3) ? void 0 : o4.top) ? n3.top : 0) };
- }, [e5]), E2 = (0, import_react126.useCallback)((t7, n3) => {
- if (d4.current && m5.current) {
- if (!n3)
- return;
- const l2 = (({ startPoint: e6, endPoint: t8 }) => ({ left: Math.min(e6.x, t8.x), top: Math.min(e6.y, t8.y), width: Math.abs(e6.x - t8.x), height: Math.abs(e6.y - t8.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 != p3 && p3.current && p3.current(t7), 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_react126.useCallback)((t7) => {
- var n3;
- if (!d4.current)
- return;
- const r4 = null == (n3 = e5.current) ? void 0 : n3.getParentBoundingClientRect();
- m5.current = S3(t7, r4), E2(t7, r4);
- }, [E2, S3, e5]), x2 = (0, import_react126.useCallback)((e6) => {
- var t7;
- 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 == (t7 = window) || t7.removeEventListener("mouseup", x2));
- }, [i5, b2, w2]), C = (0, import_react126.useCallback)((e6) => {
- if (0 === e6.button && y3.current) {
- var t7;
- 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 == (t7 = window) || t7.addEventListener("mouseup", x2);
- }
- }, [i5, S3, w2, x2]);
- return (0, import_react126.useEffect)(() => ((i5 || document.body).addEventListener("mousedown", C), () => {
- (i5 || document.body).removeEventListener("mousedown", C), (i5 || document.body).removeEventListener("mousemove", w2), window.removeEventListener("mouseup", x2);
- }), [i5, C, w2, x2]), { cancelCurrentSelection: b2 };
- }({ containerRef: f2, onSelectionEnd: o2, onSelectionStart: c3, onSelectionChange: r2, isEnabled: i4, eventsElement: m4, shouldStartSelecting: v2 });
- return { cancelCurrentSelection: p2, DragSelection: (0, import_react126.useCallback)(() => import_react126.default.createElement(d3, a3({ ref: f2 }, s4)), []) };
-}
-
-// src/core/react/components/SpaceView/SpaceOuter.tsx
-var import_react127 = __toESM(require_react());
-var SpaceOuter = (0, import_react127.forwardRef)(
- (props, ref2) => {
- const [selectionBox, setSelectionBox] = (0, import_react127.useState)();
- const selectableItems = (0, import_react127.useRef)([]);
- const { frameProperties } = (0, import_react127.useContext)(FramesEditorRootContext);
- const { selectableNodeBounds, id: id3 } = (0, import_react127.useContext)(FrameInstanceContext);
- const { selectMulti } = (0, import_react127.useContext)(FrameSelectionContext);
- const { tableData } = (0, import_react127.useContext)(FramesMDBContext);
- const [dragging, setDragging] = (0, import_react127.useState)(false);
- const localRef = (0, import_react127.useRef)(null);
- const [contexts, setContexts] = (0, import_react127.useState)({});
- const [frameProps, setFrameProps] = (0, import_react127.useState)({});
- const { pathState } = (0, import_react127.useContext)(PathContext);
- const { spaceInfo } = (0, import_react127.useContext)(SpaceContext);
- (0, import_react127.useEffect)(() => {
- if (!spaceInfo) {
- return;
- }
- const linkedNote = spaceInfo.defPath;
- const refreshProps = () => {
- if (tableData) {
- const properties3 = {
- ...pathState?.metadata?.property ?? {}
- };
- const fixedProps = Object.keys(properties3).reduce(
- (p2, c3) => ({
- ...p2,
- [c3]: parseProperty(c3, properties3[c3])
- }),
- {}
- );
- const row2 = linkContextRow(
- props.superstate.formulaContext,
- props.superstate.pathsIndex,
- fixedProps,
- 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(
- (p2, c3) => {
- const context = props.superstate.contextsIndex.get(c3)?.tables?.[defaultContextSchemaID].rows.find(
- (f2) => f2[PathPropertyName] == pathState.path
- );
- return context ? { ...p2, [c3]: context } : p2;
- },
- {
- $space: {
- note: linkedNote,
- space: pathState.path,
- path: pathState.path
- },
- $context: {
- _keyValue: pathState.path,
- _schema: "main"
- },
- $properties: frameProperties
- }
- );
- setContexts(contexts2);
- };
- refreshProps();
- }, [spaceInfo, pathState, tableData]);
- const propSetters = Object.keys(frameProps).reduce(
- (p2, c3) => ({
- ...p2,
- [c3]: (value) => {
- setFrameProps((p3) => ({ ...p3, [c3]: value }));
- saveProperties(props.superstate, pathState.path, {
- [c3]: value
- });
- }
- }),
- {}
- );
- const onKeyDown = (e5) => {
- if (e5.key === "Escape") {
- props.superstate.ui.resetSelection(null);
- }
- };
- (0, import_react127.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_react127.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_react127.default.createElement(DragSelection, null), /* @__PURE__ */ import_react127.default.createElement(FrameInstanceProvider, {
- id: id3 ?? "root",
- superstate: props.superstate,
- props: frameProps,
- contexts,
- propSetters,
- editable: true
- }, props.children));
- }
-);
-SpaceOuter.displayName = "SpaceOuter";
-var SpaceOuter_default = SpaceOuter;
-
-// src/core/react/components/SpaceView/SpaceInner.tsx
-var import_react128 = __toESM(require_react());
-var SpaceInner = (props) => {
- const ref2 = (0, import_react128.useRef)(null);
- const { spaceState } = (0, import_react128.useContext)(SpaceContext);
- return /* @__PURE__ */ import_react128.default.createElement(import_react128.default.Fragment, null, /* @__PURE__ */ import_react128.default.createElement(SpaceHeader, {
- superstate: props.superstate
- }), spaceState && /* @__PURE__ */ import_react128.default.createElement(SpaceOuter_default, {
- superstate: props.superstate,
- ref: ref2
- }, /* @__PURE__ */ import_react128.default.createElement(FrameEditorInstance, {
- containerRef: ref2,
- superstate: props.superstate
- })));
-};
-
-// 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
- );
- 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(path3) {
- 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_react129.default.createElement("div", {
- className: "mk-space-view"
- }, path3 == "spaces://$settings" ? /* @__PURE__ */ import_react129.default.createElement(SystemSettings, {
- superstate: this.superstate
- }) : /* @__PURE__ */ import_react129.default.createElement(SpaceView, {
- path: path3,
- superstate: this.superstate,
- key: path3,
- readOnly: false
- }, /* @__PURE__ */ import_react129.default.createElement("div", {
- className: "mk-space-scroller markdown-source-view mod-cm6 is-readable-line-width"
- }, /* @__PURE__ */ import_react129.default.createElement(SpaceInner, {
- superstate: this.superstate
- }))))
- );
- } else {
- this.ui.manager.eventsDispatch.addOnceListener("windowReady", () => {
- this.constructNote(path3);
- });
- }
- }
-};
-
-// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentWrapper.tsx
-var import_react130 = __toESM(require_react());
-var import_react131 = __toESM(require_react());
-var SpaceFragmentTitleComponent = (props) => {
- const { pathState } = (0, import_react131.useContext)(PathContext);
- const fileNameRef = (0, import_react131.useRef)(null);
- const contentEditable = true;
- const onBlur = (e5) => {
- const newValue = e5.target.innerHTML;
- if (newValue != props.name) {
- props.saveName(newValue);
- }
- };
- const onKeyPress = (e5) => {
- e5.stopPropagation();
- };
- const onKeyUp = (e5) => {
- e5.stopPropagation();
- };
- const onKeyDown = (e5) => {
- e5.stopPropagation();
- if (e5.key == "a" && e5.metaKey) {
- e5.preventDefault();
- const selection2 = window.getSelection();
- const range2 = document.createRange();
- range2.selectNodeContents(e5.target);
- selection2.removeAllRanges();
- selection2.addRange(range2);
- }
- if (e5.key == "Enter") {
- e5.target.blur();
- e5.preventDefault();
- }
- if (e5.key == "Escape") {
- e5.target.blur();
- e5.preventDefault();
- }
- };
- const triggerStickerMenu = (e5) => {
- props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react130.default.createElement(StickerModal_default, {
- ui: props.superstate.ui,
- hide: _props.hide,
- selectedSticker: (emoji) => props.saveSticker(emoji)
- }));
- };
- return /* @__PURE__ */ import_react130.default.createElement("div", null, /* @__PURE__ */ import_react130.default.createElement("div", {
- className: "mk-header-icon"
- }), /* @__PURE__ */ import_react130.default.createElement("div", {
- className: "mk-title-container"
- }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react130.default.createElement("div", {
- className: "mk-title-prefix"
- }, "#") : "", /* @__PURE__ */ import_react130.default.createElement("div", {
- className: "mk-inline-title inline-title",
- ref: fileNameRef,
- contentEditable,
- onBlur,
- onDrop: (e5) => e5.preventDefault(),
- onKeyDown,
- onKeyPress,
- onKeyUp,
- dangerouslySetInnerHTML: {
- __html: props.name
- }
- })));
-};
-var SpaceFragmentWrapper = (props) => {
- const [schema, setSchema] = import_react130.default.useState(null);
- (0, import_react130.useEffect)(() => {
- const uri = props.superstate.spaceManager.uriByString(props.path);
- if (uri.refType == "context") {
- const schema2 = props.superstate.contextsIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref);
- if (schema2) {
- setSchema({
- id: schema2.id,
- name: schema2.name,
- type: "context",
- path: uri.basePath
- });
- }
- }
- if (uri.refType == "frame") {
- const schema2 = props.superstate.framesIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref);
- if (schema2) {
- const frameSchema = mdbSchemaToFrameSchema(schema2);
- setSchema({
- id: schema2.id,
- name: frameSchema.name,
- sticker: frameSchema.def?.icon,
- type: "frame",
- path: uri.basePath
- });
- }
- }
- if (uri.refType == "action") {
- const schema2 = props.superstate.actionsIndex.get(uri.path)?.find((s4) => s4.schema.id == uri.ref)?.schema;
- if (schema2) {
- setSchema({
- id: schema2.id,
- name: schema2.name,
- sticker: schema2.def?.icon,
- type: "action",
- path: uri.basePath
- });
- }
- }
- }, [props.path]);
- const saveName = (name317) => {
- if (schema.type == "context") {
- props.superstate.spaceManager.saveTableSchema(
- schema.path,
- schema.id,
- (schema2) => ({ ...schema2, name: name317 })
- );
- }
- if (schema.type == "frame") {
- props.superstate.spaceManager.saveFrameSchema(
- schema.path,
- schema.id,
- (schema2) => ({ ...schema2, name: name317 })
- );
- }
- if (schema.type == "action") {
- props.superstate.spaceManager.saveCommand(
- schema.path,
- schema.id,
- (command) => ({ ...command, schema: { ...command.schema, name: name317 } })
- );
- }
- };
- const saveSticker = (name317) => {
- if (schema.type == "frame") {
- props.superstate.spaceManager.saveFrameSchema(
- schema.path,
- schema.id,
- (schema2) => {
- const frameSchema = mdbSchemaToFrameSchema(schema2);
- const newFrameSchema = {
- ...frameSchema,
- def: { ...frameSchema.def, icon: name317 }
- };
- return frameSchemaToTableSchema(newFrameSchema);
- }
- );
- }
- if (schema.type == "action") {
- props.superstate.spaceManager.saveCommand(
- schema.path,
- schema.id,
- (command) => {
- return {
- ...command,
- schema: {
- ...command.schema,
- def: { ...command.schema?.def ?? {}, icon: name317 }
- }
- };
- }
- );
- }
- };
- return /* @__PURE__ */ import_react130.default.createElement("div", {
- className: "mk-editor-space-fragment markdown-source-view mod-cm6 is-readable-line-width"
- }, /* @__PURE__ */ import_react130.default.createElement("div", {
- className: "mk-editor-header"
- }, schema && /* @__PURE__ */ import_react130.default.createElement(SpaceFragmentTitleComponent, {
- superstate: props.superstate,
- readOnly: true,
- name: schema.name,
- sticker: schema.sticker,
- saveName,
- saveSticker
- })), props.children);
-};
-
-// src/adapters/obsidian/ui/editors/SpaceFragmentViewComponent.tsx
-var import_obsidian4 = require("obsidian");
-var import_react132 = __toESM(require_react());
-var SPACE_FRAGMENT_VIEW_TYPE = "mk-space-fragment";
-var SpaceFragmentView = class extends import_obsidian4.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.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_react132.default.createElement(SpaceFragmentWrapper, {
- superstate: this.plugin.superstate,
- path: this.path
- }, /* @__PURE__ */ import_react132.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_obsidian5.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_obsidian5.normalizePath)(plugin.app.vault.configDir + "/app.json")
- );
-};
-var fileExtensionForFile = (path3) => path3?.indexOf(".") > 0 ? path3.split(".").pop() : "md";
-var fileNameForFile = (path3) => path3?.indexOf("/") > 0 ? path3.split("/").pop().split(".").shift() : path3.split(".").shift();
-var uniqueFileName = (oldName, name317, extension2, folder) => {
- let newName = sanitizeFileName(name317);
- let uniqueName = false;
- let append = 1;
- while (!uniqueName) {
- if (!folder.children.some((f2) => f2.name == `${newName}.${extension2}` && f2.name != oldName)) {
- uniqueName = true;
- } else {
- newName = `${newName} ${append}`;
- append += 1;
- }
- }
- return `${newName}.${extension2}`;
-};
-function getAllAbstractFilesInVault(app2) {
- const files = [];
- const rootFolder = app2.vault.getRoot();
- function recursiveFx(folder) {
- for (const child of folder.children) {
- if (child instanceof import_obsidian5.TFolder) {
- const childFolder = child;
- if (childFolder.children)
- recursiveFx(childFolder);
- }
- files.push(child);
- }
- }
- recursiveFx(rootFolder);
- files.push(rootFolder);
- return files;
-}
-var openPath = async (leaf, path3, plugin, flow3) => {
- const uri = plugin.superstate.spaceManager.uriByString(path3);
- if (!uri)
- return;
- if (uri.scheme == "https" || uri.scheme == "http") {
- if (plugin.superstate.spacesIndex.has(path3)) {
- const viewType = SPACE_VIEW_TYPE;
- plugin.app.workspace.setActiveLeaf(leaf, { focus: true });
- await leaf.setViewState({
- type: viewType,
- state: { path: path3 }
- });
- 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 (flow3) {
- await leaf.setViewState({
- type: EMBED_CONTEXT_VIEW_TYPE,
- state: { path: uri.fullPath }
- });
- } else {
- await leaf.setViewState({
- type: SPACE_FRAGMENT_VIEW_TYPE,
- state: { path: uri.fullPath }
- });
- }
- return;
- }
- }
- if (uri.scheme == "spaces") {
- openTagContext(leaf, uri.authority, plugin.app);
- return;
- }
- plugin.files.getFile(path3).then((f2) => {
- if (f2) {
- openAFile(leaf, f2, plugin);
- } else {
- if (path3.contains("/")) {
- const folder = removeTrailingSlashFromFolder(getParentPathFromString(path3));
- const spaceFolder = plugin.superstate.spacesIndex.get(folder);
- if (spaceFolder) {
- newPathInSpace(
- plugin.superstate,
- spaceFolder,
- fileExtensionForFile(path3),
- fileNameForFile(path3)
- );
- }
- } else {
- defaultSpace(plugin.superstate, plugin.superstate.pathsIndex.get(plugin.superstate.ui.activePath)).then((f3) => {
- if (f3)
- newPathInSpace(
- plugin.superstate,
- f3,
- fileExtensionForFile(path3),
- fileNameForFile(path3)
- );
- });
- }
- }
- });
-};
-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_CONTEXT_VIEW_TYPE,
- state: { path: url }
- });
- }
- if (import_obsidian5.Platform.isMobile) {
- app2.workspace.leftSplit.collapse();
- }
-};
-var openAFile = async (leaf, file, plugin) => {
- if (file.isFolder) {
- openTFolder(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin);
- } else if (file) {
- openTFile(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin.app);
- } else {
- return;
- }
-};
-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) => {
- if (!plugin.superstate.settings.spaceViewEnabled) {
- const space3 = plugin.superstate.spacesIndex.get(file.path)?.space.defPath;
- if (!space3)
- return;
- const spaceFile = getAbstractFileAtPath(plugin.app, space3);
- if (!spaceFile)
- return;
- plugin.app.workspace.setActiveLeaf(leaf, { focus: true });
- leaf.openFile(spaceFile);
- return;
- }
- const viewType = SPACE_VIEW_TYPE;
- app.workspace.setActiveLeaf(leaf, { focus: true });
- await leaf.setViewState({
- type: viewType,
- state: { path: file.path }
- });
- await app.workspace.requestSaveLayout();
- if (import_obsidian5.Platform.isMobile) {
- 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_obsidian5.Platform.isMobile) {
- app2.workspace.leftSplit.collapse();
- }
-};
-var getAbstractFileAtPath = (app2, path3) => {
- return app2.vault.getAbstractFileByPath(path3);
-};
-
-// 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((key3) => {
- const runner = textCacheExperimental[key3];
- updatedCache[key3] = 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_obsidian6 = require("obsidian");
-var import_classnames3 = __toESM(require_classnames());
-
-// node_modules/bail/index.js
-function bail(error) {
- if (error) {
- throw error;
- }
-}
-
-// node_modules/unified/lib/index.js
-var import_is_buffer2 = __toESM(require_is_buffer(), 1);
-var import_extend = __toESM(require_extend(), 1);
-
-// node_modules/is-plain-obj/index.js
-function isPlainObject2(value) {
- if (typeof value !== "object" || value === null) {
- return false;
- }
- const prototype = Object.getPrototypeOf(value);
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
-}
-
-// node_modules/trough/lib/index.js
-function trough() {
- const fns = [];
- const pipeline = { run, use };
- return pipeline;
- function run(...values2) {
- let middlewareIndex = -1;
- const callback = values2.pop();
- if (typeof callback !== "function") {
- throw new TypeError("Expected function as last argument, not " + callback);
- }
- next(null, ...values2);
- function next(error, ...output) {
- const fn = fns[++middlewareIndex];
- let index3 = -1;
- if (error) {
- callback(error);
- return;
- }
- while (++index3 < values2.length) {
- if (output[index3] === null || output[index3] === void 0) {
- output[index3] = values2[index3];
- }
- }
- values2 = output;
- if (fn) {
- wrap(fn, next)(...output);
- } else {
- callback(null, ...output);
- }
- }
- }
- function use(middelware) {
- if (typeof middelware !== "function") {
- throw new TypeError(
- "Expected `middelware` to be a function, not " + middelware
- );
- }
- fns.push(middelware);
- return pipeline;
- }
-}
-function wrap(middleware, callback) {
- let called;
- return wrapped;
- function wrapped(...parameters) {
- const fnExpectsCallback = middleware.length > parameters.length;
- let result;
- if (fnExpectsCallback) {
- parameters.push(done);
- }
- try {
- result = middleware.apply(this, parameters);
- } catch (error) {
- const exception = error;
- if (fnExpectsCallback && called) {
- throw exception;
- }
- return done(exception);
- }
- if (!fnExpectsCallback) {
- if (result && result.then && typeof result.then === "function") {
- result.then(then, done);
- } else if (result instanceof Error) {
- done(result);
- } else {
- then(result);
- }
- }
- }
- function done(error, ...output) {
- if (!called) {
- called = true;
- callback(error, ...output);
- }
- }
- function then(value) {
- done(null, value);
- }
-}
-
-// node_modules/vfile/lib/index.js
-var import_is_buffer = __toESM(require_is_buffer(), 1);
-
-// node_modules/unist-util-stringify-position/lib/index.js
-function stringifyPosition(value) {
- if (!value || typeof value !== "object") {
- return "";
- }
- if ("position" in value || "type" in value) {
- return position(value.position);
- }
- if ("start" in value || "end" in value) {
- return position(value);
- }
- if ("line" in value || "column" in value) {
- return point(value);
- }
- return "";
-}
-function point(point4) {
- return index2(point4 && point4.line) + ":" + index2(point4 && point4.column);
-}
-function position(pos) {
- return point(pos && pos.start) + "-" + point(pos && pos.end);
-}
-function index2(value) {
- return value && typeof value === "number" ? value : 1;
-}
-
-// node_modules/vfile-message/lib/index.js
-var VFileMessage = class extends Error {
- constructor(reason, place, origin) {
- const parts = [null, null];
- let position3 = {
- start: { line: null, column: null },
- end: { line: null, column: null }
- };
- super();
- if (typeof place === "string") {
- origin = place;
- place = void 0;
- }
- if (typeof origin === "string") {
- const index3 = origin.indexOf(":");
- if (index3 === -1) {
- parts[1] = origin;
- } else {
- parts[0] = origin.slice(0, index3);
- parts[1] = origin.slice(index3 + 1);
- }
- }
- if (place) {
- if ("type" in place || "position" in place) {
- if (place.position) {
- position3 = place.position;
- }
- } else if ("start" in place || "end" in place) {
- position3 = place;
- } else if ("line" in place || "column" in place) {
- position3.start = place;
- }
- }
- this.name = stringifyPosition(place) || "1:1";
- this.message = typeof reason === "object" ? reason.message : reason;
- this.stack = "";
- if (typeof reason === "object" && reason.stack) {
- this.stack = reason.stack;
- }
- this.reason = this.message;
- this.fatal;
- this.line = position3.start.line;
- this.column = position3.start.column;
- this.position = position3;
- this.source = parts[0];
- this.ruleId = parts[1];
- this.file;
- this.actual;
- this.expected;
- this.url;
- this.note;
- }
-};
-VFileMessage.prototype.file = "";
-VFileMessage.prototype.name = "";
-VFileMessage.prototype.reason = "";
-VFileMessage.prototype.message = "";
-VFileMessage.prototype.stack = "";
-VFileMessage.prototype.fatal = null;
-VFileMessage.prototype.column = null;
-VFileMessage.prototype.line = null;
-VFileMessage.prototype.source = null;
-VFileMessage.prototype.ruleId = null;
-VFileMessage.prototype.position = null;
-
-// node_modules/vfile/lib/minpath.browser.js
-var path2 = { basename, dirname, extname, join: join2, sep: "/" };
-function basename(path3, ext) {
- if (ext !== void 0 && typeof ext !== "string") {
- throw new TypeError('"ext" argument must be a string');
- }
- assertPath(path3);
- let start = 0;
- let end = -1;
- let index3 = path3.length;
- let seenNonSlash;
- if (ext === void 0 || ext.length === 0 || ext.length > path3.length) {
- while (index3--) {
- if (path3.charCodeAt(index3) === 47) {
- if (seenNonSlash) {
- start = index3 + 1;
- break;
- }
- } else if (end < 0) {
- seenNonSlash = true;
- end = index3 + 1;
- }
- }
- return end < 0 ? "" : path3.slice(start, end);
- }
- if (ext === path3) {
- return "";
- }
- let firstNonSlashEnd = -1;
- let extIndex = ext.length - 1;
- while (index3--) {
- if (path3.charCodeAt(index3) === 47) {
- if (seenNonSlash) {
- start = index3 + 1;
- break;
- }
- } else {
- if (firstNonSlashEnd < 0) {
- seenNonSlash = true;
- firstNonSlashEnd = index3 + 1;
- }
- if (extIndex > -1) {
- if (path3.charCodeAt(index3) === ext.charCodeAt(extIndex--)) {
- if (extIndex < 0) {
- end = index3;
- }
- } else {
- extIndex = -1;
- end = firstNonSlashEnd;
- }
- }
- }
- }
- if (start === end) {
- end = firstNonSlashEnd;
- } else if (end < 0) {
- end = path3.length;
- }
- return path3.slice(start, end);
-}
-function dirname(path3) {
- assertPath(path3);
- if (path3.length === 0) {
- return ".";
- }
- let end = -1;
- let index3 = path3.length;
- let unmatchedSlash;
- while (--index3) {
- if (path3.charCodeAt(index3) === 47) {
- if (unmatchedSlash) {
- end = index3;
- break;
- }
- } else if (!unmatchedSlash) {
- unmatchedSlash = true;
- }
- }
- return end < 0 ? path3.charCodeAt(0) === 47 ? "/" : "." : end === 1 && path3.charCodeAt(0) === 47 ? "//" : path3.slice(0, end);
-}
-function extname(path3) {
- assertPath(path3);
- let index3 = path3.length;
- let end = -1;
- let startPart = 0;
- let startDot = -1;
- let preDotState = 0;
- let unmatchedSlash;
- while (index3--) {
- const code3 = path3.charCodeAt(index3);
- if (code3 === 47) {
- if (unmatchedSlash) {
- startPart = index3 + 1;
- break;
- }
- continue;
- }
- if (end < 0) {
- unmatchedSlash = true;
- end = index3 + 1;
- }
- if (code3 === 46) {
- if (startDot < 0) {
- startDot = index3;
- } else if (preDotState !== 1) {
- preDotState = 1;
- }
- } else if (startDot > -1) {
- preDotState = -1;
- }
- }
- if (startDot < 0 || end < 0 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return "";
- }
- return path3.slice(startDot, end);
-}
-function join2(...segments) {
- let index3 = -1;
- let joined;
- while (++index3 < segments.length) {
- assertPath(segments[index3]);
- if (segments[index3]) {
- joined = joined === void 0 ? segments[index3] : joined + "/" + segments[index3];
- }
- }
- return joined === void 0 ? "." : normalize(joined);
-}
-function normalize(path3) {
- assertPath(path3);
- const absolute = path3.charCodeAt(0) === 47;
- let value = normalizeString(path3, !absolute);
- if (value.length === 0 && !absolute) {
- value = ".";
- }
- if (value.length > 0 && path3.charCodeAt(path3.length - 1) === 47) {
- value += "/";
- }
- return absolute ? "/" + value : value;
-}
-function normalizeString(path3, allowAboveRoot) {
- let result = "";
- let lastSegmentLength = 0;
- let lastSlash = -1;
- let dots = 0;
- let index3 = -1;
- let code3;
- let lastSlashIndex;
- while (++index3 <= path3.length) {
- if (index3 < path3.length) {
- code3 = path3.charCodeAt(index3);
- } else if (code3 === 47) {
- break;
- } else {
- code3 = 47;
- }
- if (code3 === 47) {
- if (lastSlash === index3 - 1 || dots === 1) {
- } else if (lastSlash !== index3 - 1 && dots === 2) {
- if (result.length < 2 || lastSegmentLength !== 2 || result.charCodeAt(result.length - 1) !== 46 || result.charCodeAt(result.length - 2) !== 46) {
- if (result.length > 2) {
- lastSlashIndex = result.lastIndexOf("/");
- if (lastSlashIndex !== result.length - 1) {
- if (lastSlashIndex < 0) {
- result = "";
- lastSegmentLength = 0;
- } else {
- result = result.slice(0, lastSlashIndex);
- lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
- }
- lastSlash = index3;
- dots = 0;
- continue;
- }
- } else if (result.length > 0) {
- result = "";
- lastSegmentLength = 0;
- lastSlash = index3;
- dots = 0;
- continue;
- }
- }
- if (allowAboveRoot) {
- result = result.length > 0 ? result + "/.." : "..";
- lastSegmentLength = 2;
- }
- } else {
- if (result.length > 0) {
- result += "/" + path3.slice(lastSlash + 1, index3);
- } else {
- result = path3.slice(lastSlash + 1, index3);
- }
- lastSegmentLength = index3 - lastSlash - 1;
- }
- lastSlash = index3;
- dots = 0;
- } else if (code3 === 46 && dots > -1) {
- dots++;
- } else {
- dots = -1;
- }
- }
- return result;
-}
-function assertPath(path3) {
- if (typeof path3 !== "string") {
- throw new TypeError(
- "Path must be a string. Received " + JSON.stringify(path3)
- );
- }
-}
-
-// node_modules/vfile/lib/minproc.browser.js
-var proc = { cwd };
-function cwd() {
- return "/";
-}
-
-// node_modules/vfile/lib/minurl.shared.js
-function isUrl(fileUrlOrPath) {
- return fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && fileUrlOrPath.href && fileUrlOrPath.origin;
-}
-
-// node_modules/vfile/lib/minurl.browser.js
-function urlToPath(path3) {
- if (typeof path3 === "string") {
- path3 = new URL(path3);
- } else if (!isUrl(path3)) {
- const error = new TypeError(
- 'The "path" argument must be of type string or an instance of URL. Received `' + path3 + "`"
- );
- error.code = "ERR_INVALID_ARG_TYPE";
- throw error;
- }
- if (path3.protocol !== "file:") {
- const error = new TypeError("The URL must be of scheme file");
- error.code = "ERR_INVALID_URL_SCHEME";
- throw error;
- }
- return getPathFromURLPosix(path3);
-}
-function getPathFromURLPosix(url) {
- if (url.hostname !== "") {
- const error = new TypeError(
- 'File URL host must be "localhost" or empty on darwin'
- );
- error.code = "ERR_INVALID_FILE_URL_HOST";
- throw error;
- }
- const pathname = url.pathname;
- let index3 = -1;
- while (++index3 < pathname.length) {
- if (pathname.charCodeAt(index3) === 37 && pathname.charCodeAt(index3 + 1) === 50) {
- const third = pathname.charCodeAt(index3 + 2);
- if (third === 70 || third === 102) {
- const error = new TypeError(
- "File URL path must not include encoded / characters"
- );
- error.code = "ERR_INVALID_FILE_URL_PATH";
- throw error;
- }
- }
- }
- return decodeURIComponent(pathname);
-}
-
-// node_modules/vfile/lib/index.js
-var order = ["history", "path", "basename", "stem", "extname", "dirname"];
-var VFile = class {
- constructor(value) {
- let options;
- if (!value) {
- options = {};
- } else if (typeof value === "string" || buffer(value)) {
- options = { value };
- } else if (isUrl(value)) {
- options = { path: value };
- } else {
- options = value;
- }
- this.data = {};
- this.messages = [];
- this.history = [];
- this.cwd = proc.cwd();
- this.value;
- this.stored;
- this.result;
- this.map;
- let index3 = -1;
- while (++index3 < order.length) {
- const prop3 = order[index3];
- if (prop3 in options && options[prop3] !== void 0 && options[prop3] !== null) {
- this[prop3] = prop3 === "history" ? [...options[prop3]] : options[prop3];
- }
- }
- let prop2;
- for (prop2 in options) {
- if (!order.includes(prop2)) {
- this[prop2] = options[prop2];
- }
- }
- }
- get path() {
- return this.history[this.history.length - 1];
- }
- set path(path3) {
- if (isUrl(path3)) {
- path3 = urlToPath(path3);
- }
- assertNonEmpty(path3, "path");
- if (this.path !== path3) {
- this.history.push(path3);
- }
- }
- get dirname() {
- return typeof this.path === "string" ? path2.dirname(this.path) : void 0;
- }
- set dirname(dirname2) {
- assertPath2(this.basename, "dirname");
- this.path = path2.join(dirname2 || "", this.basename);
- }
- get basename() {
- return typeof this.path === "string" ? path2.basename(this.path) : void 0;
- }
- set basename(basename2) {
- assertNonEmpty(basename2, "basename");
- assertPart(basename2, "basename");
- this.path = path2.join(this.dirname || "", basename2);
- }
- get extname() {
- return typeof this.path === "string" ? path2.extname(this.path) : void 0;
- }
- set extname(extname2) {
- assertPart(extname2, "extname");
- assertPath2(this.dirname, "extname");
- if (extname2) {
- if (extname2.charCodeAt(0) !== 46) {
- throw new Error("`extname` must start with `.`");
- }
- if (extname2.includes(".", 1)) {
- throw new Error("`extname` cannot contain multiple dots");
- }
- }
- this.path = path2.join(this.dirname, this.stem + (extname2 || ""));
- }
- get stem() {
- return typeof this.path === "string" ? path2.basename(this.path, this.extname) : void 0;
- }
- set stem(stem) {
- assertNonEmpty(stem, "stem");
- assertPart(stem, "stem");
- this.path = path2.join(this.dirname || "", stem + (this.extname || ""));
- }
- toString(encoding) {
- return (this.value || "").toString(encoding || void 0);
- }
- message(reason, place, origin) {
- const message = new VFileMessage(reason, place, origin);
- if (this.path) {
- message.name = this.path + ":" + message.name;
- message.file = this.path;
- }
- message.fatal = false;
- this.messages.push(message);
- return message;
- }
- info(reason, place, origin) {
- const message = this.message(reason, place, origin);
- message.fatal = null;
- return message;
- }
- fail(reason, place, origin) {
- const message = this.message(reason, place, origin);
- message.fatal = true;
- throw message;
- }
-};
-function assertPart(part, name317) {
- if (part && part.includes(path2.sep)) {
- throw new Error(
- "`" + name317 + "` cannot be a path: did not expect `" + path2.sep + "`"
- );
- }
-}
-function assertNonEmpty(part, name317) {
- if (!part) {
- throw new Error("`" + name317 + "` cannot be empty");
- }
-}
-function assertPath2(path3, name317) {
- if (!path3) {
- throw new Error("Setting `" + name317 + "` requires `path` to be set too");
- }
-}
-function buffer(value) {
- return (0, import_is_buffer.default)(value);
-}
-
-// node_modules/unified/lib/index.js
-var unified = base2().freeze();
-var own = {}.hasOwnProperty;
-function base2() {
- const transformers = trough();
- const attachers = [];
- let namespace = {};
- let frozen;
- let freezeIndex = -1;
- processor.data = data3;
- processor.Parser = void 0;
- processor.Compiler = void 0;
- processor.freeze = freeze;
- processor.attachers = attachers;
- processor.use = use;
- processor.parse = parse8;
- processor.stringify = stringify5;
- processor.run = run;
- processor.runSync = runSync;
- processor.process = process2;
- processor.processSync = processSync;
- return processor;
- function processor() {
- const destination = base2();
- let index3 = -1;
- while (++index3 < attachers.length) {
- destination.use(...attachers[index3]);
- }
- destination.data((0, import_extend.default)(true, {}, namespace));
- return destination;
- }
- function data3(key3, value) {
- if (typeof key3 === "string") {
- if (arguments.length === 2) {
- assertUnfrozen("data", frozen);
- namespace[key3] = value;
- return processor;
- }
- return own.call(namespace, key3) && namespace[key3] || null;
- }
- if (key3) {
- assertUnfrozen("data", frozen);
- namespace = key3;
- return processor;
- }
- return namespace;
- }
- function freeze() {
- if (frozen) {
- return processor;
- }
- while (++freezeIndex < attachers.length) {
- const [attacher, ...options] = attachers[freezeIndex];
- if (options[0] === false) {
- continue;
- }
- if (options[0] === true) {
- options[0] = void 0;
- }
- const transformer = attacher.call(processor, ...options);
- if (typeof transformer === "function") {
- transformers.use(transformer);
- }
- }
- frozen = true;
- freezeIndex = Number.POSITIVE_INFINITY;
- return processor;
- }
- function use(value, ...options) {
- let settings;
- assertUnfrozen("use", frozen);
- if (value === null || value === void 0) {
- } else if (typeof value === "function") {
- addPlugin(value, ...options);
- } else if (typeof value === "object") {
- if (Array.isArray(value)) {
- addList(value);
- } else {
- addPreset(value);
- }
- } else {
- throw new TypeError("Expected usable value, not `" + value + "`");
- }
- if (settings) {
- namespace.settings = Object.assign(namespace.settings || {}, settings);
- }
- return processor;
- function add4(value2) {
- if (typeof value2 === "function") {
- addPlugin(value2);
- } else if (typeof value2 === "object") {
- if (Array.isArray(value2)) {
- const [plugin, ...options2] = value2;
- addPlugin(plugin, ...options2);
- } else {
- addPreset(value2);
- }
- } else {
- throw new TypeError("Expected usable value, not `" + value2 + "`");
- }
- }
- function addPreset(result) {
- addList(result.plugins);
- if (result.settings) {
- settings = Object.assign(settings || {}, result.settings);
- }
- }
- function addList(plugins) {
- let index3 = -1;
- if (plugins === null || plugins === void 0) {
- } else if (Array.isArray(plugins)) {
- while (++index3 < plugins.length) {
- const thing = plugins[index3];
- add4(thing);
- }
- } else {
- throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
- }
- }
- function addPlugin(plugin, value2) {
- let index3 = -1;
- let entry;
- while (++index3 < attachers.length) {
- if (attachers[index3][0] === plugin) {
- entry = attachers[index3];
- break;
- }
- }
- if (entry) {
- if (isPlainObject2(entry[1]) && isPlainObject2(value2)) {
- value2 = (0, import_extend.default)(true, entry[1], value2);
- }
- entry[1] = value2;
- } else {
- attachers.push([...arguments]);
- }
- }
- }
- function parse8(doc) {
- processor.freeze();
- const file = vfile(doc);
- const Parser5 = processor.Parser;
- assertParser("parse", Parser5);
- if (newable(Parser5, "parse")) {
- return new Parser5(String(file), file).parse();
- }
- return Parser5(String(file), file);
- }
- function stringify5(node2, doc) {
- processor.freeze();
- const file = vfile(doc);
- const Compiler = processor.Compiler;
- assertCompiler("stringify", Compiler);
- assertNode(node2);
- if (newable(Compiler, "compile")) {
- return new Compiler(node2, file).compile();
- }
- return Compiler(node2, file);
- }
- function run(node2, doc, callback) {
- assertNode(node2);
- processor.freeze();
- if (!callback && typeof doc === "function") {
- callback = doc;
- doc = void 0;
- }
- if (!callback) {
- return new Promise(executor);
- }
- executor(null, callback);
- function executor(resolve2, reject) {
- transformers.run(node2, vfile(doc), done);
- function done(error, tree, file) {
- tree = tree || node2;
- if (error) {
- reject(error);
- } else if (resolve2) {
- resolve2(tree);
- } else {
- callback(null, tree, file);
- }
- }
- }
- }
- function runSync(node2, file) {
- let result;
- let complete;
- processor.run(node2, file, done);
- assertDone("runSync", "run", complete);
- return result;
- function done(error, tree) {
- bail(error);
- result = tree;
- complete = true;
- }
- }
- function process2(doc, callback) {
- processor.freeze();
- assertParser("process", processor.Parser);
- assertCompiler("process", processor.Compiler);
- if (!callback) {
- return new Promise(executor);
- }
- executor(null, callback);
- function executor(resolve2, reject) {
- const file = vfile(doc);
- processor.run(processor.parse(file), file, (error, tree, file2) => {
- if (error || !tree || !file2) {
- done(error);
- } else {
- const result = processor.stringify(tree, file2);
- if (result === void 0 || result === null) {
- } else if (looksLikeAVFileValue(result)) {
- file2.value = result;
- } else {
- file2.result = result;
- }
- done(error, file2);
- }
- });
- function done(error, file2) {
- if (error || !file2) {
- reject(error);
- } else if (resolve2) {
- resolve2(file2);
- } else {
- callback(null, file2);
- }
- }
- }
- }
- function processSync(doc) {
- let complete;
- processor.freeze();
- assertParser("processSync", processor.Parser);
- assertCompiler("processSync", processor.Compiler);
- const file = vfile(doc);
- processor.process(file, done);
- assertDone("processSync", "process", complete);
- return file;
- function done(error) {
- complete = true;
- bail(error);
- }
- }
-}
-function newable(value, name317) {
- return typeof value === "function" && value.prototype && (keys(value.prototype) || name317 in value.prototype);
-}
-function keys(value) {
- let key3;
- for (key3 in value) {
- if (own.call(value, key3)) {
- return true;
- }
- }
- return false;
-}
-function assertParser(name317, value) {
- if (typeof value !== "function") {
- throw new TypeError("Cannot `" + name317 + "` without `Parser`");
- }
-}
-function assertCompiler(name317, value) {
- if (typeof value !== "function") {
- throw new TypeError("Cannot `" + name317 + "` without `Compiler`");
- }
-}
-function assertUnfrozen(name317, frozen) {
- if (frozen) {
- throw new Error(
- "Cannot call `" + name317 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
- );
- }
-}
-function assertNode(node2) {
- if (!isPlainObject2(node2) || typeof node2.type !== "string") {
- throw new TypeError("Expected node, got `" + node2 + "`");
- }
-}
-function assertDone(name317, asyncName, complete) {
- if (!complete) {
- throw new Error(
- "`" + name317 + "` finished async. Use `" + asyncName + "` instead"
- );
- }
-}
-function vfile(value) {
- return looksLikeAVFile(value) ? value : new VFile(value);
-}
-function looksLikeAVFile(value) {
- return Boolean(
- value && typeof value === "object" && "message" in value && "messages" in value
- );
-}
-function looksLikeAVFileValue(value) {
- return typeof value === "string" || (0, import_is_buffer2.default)(value);
-}
-
-// node_modules/mdast-util-to-string/lib/index.js
-var emptyOptions = {};
-function toString4(value, options) {
- const settings = options || emptyOptions;
- const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
- const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
- return one(value, includeImageAlt, includeHtml);
-}
-function one(value, includeImageAlt, includeHtml) {
- if (node(value)) {
- if ("value" in value) {
- return value.type === "html" && !includeHtml ? "" : value.value;
- }
- if (includeImageAlt && "alt" in value && value.alt) {
- return value.alt;
- }
- if ("children" in value) {
- return all2(value.children, includeImageAlt, includeHtml);
- }
- }
- if (Array.isArray(value)) {
- return all2(value, includeImageAlt, includeHtml);
- }
- return "";
-}
-function all2(values2, includeImageAlt, includeHtml) {
- const result = [];
- let index3 = -1;
- while (++index3 < values2.length) {
- result[index3] = one(values2[index3], includeImageAlt, includeHtml);
- }
- return result.join("");
-}
-function node(value) {
- return Boolean(value && typeof value === "object");
-}
-
-// node_modules/micromark-util-chunked/index.js
-function splice(list4, start, remove, items) {
- const end = list4.length;
- let chunkStart = 0;
- let parameters;
- if (start < 0) {
- start = -start > end ? 0 : end + start;
- } else {
- start = start > end ? end : start;
- }
- remove = remove > 0 ? remove : 0;
- if (items.length < 1e4) {
- parameters = Array.from(items);
- parameters.unshift(start, remove);
- list4.splice(...parameters);
- } else {
- if (remove)
- list4.splice(start, remove);
- while (chunkStart < items.length) {
- parameters = items.slice(chunkStart, chunkStart + 1e4);
- parameters.unshift(start, 0);
- list4.splice(...parameters);
- chunkStart += 1e4;
- start += 1e4;
- }
- }
-}
-function push(list4, items) {
- if (list4.length > 0) {
- splice(list4, list4.length, 0, items);
- return list4;
- }
- return items;
-}
-
-// node_modules/micromark-util-combine-extensions/index.js
-var hasOwnProperty3 = {}.hasOwnProperty;
-function combineExtensions(extensions) {
- const all6 = {};
- let index3 = -1;
- while (++index3 < extensions.length) {
- syntaxExtension(all6, extensions[index3]);
- }
- return all6;
-}
-function syntaxExtension(all6, extension2) {
- let hook;
- for (hook in extension2) {
- const maybe = hasOwnProperty3.call(all6, hook) ? all6[hook] : void 0;
- const left = maybe || (all6[hook] = {});
- const right = extension2[hook];
- let code3;
- if (right) {
- for (code3 in right) {
- if (!hasOwnProperty3.call(left, code3))
- left[code3] = [];
- const value = right[code3];
- constructs(
- left[code3],
- Array.isArray(value) ? value : value ? [value] : []
- );
- }
- }
- }
-}
-function constructs(existing, list4) {
- let index3 = -1;
- const before = [];
- while (++index3 < list4.length) {
- ;
- (list4[index3].add === "after" ? existing : before).push(list4[index3]);
- }
- splice(existing, 0, 0, before);
-}
-
-// node_modules/micromark-util-character/lib/unicode-punctuation-regex.js
-var unicodePunctuationRegex = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;
-
-// node_modules/micromark-util-character/index.js
-var asciiAlpha = regexCheck(/[A-Za-z]/);
-var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
-var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
-function asciiControl(code3) {
- return code3 !== null && (code3 < 32 || code3 === 127);
-}
-var asciiDigit = regexCheck(/\d/);
-var asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
-var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
-function markdownLineEnding(code3) {
- return code3 !== null && code3 < -2;
-}
-function markdownLineEndingOrSpace(code3) {
- return code3 !== null && (code3 < 0 || code3 === 32);
-}
-function markdownSpace(code3) {
- return code3 === -2 || code3 === -1 || code3 === 32;
-}
-var unicodePunctuation = regexCheck(unicodePunctuationRegex);
-var unicodeWhitespace = regexCheck(/\s/);
-function regexCheck(regex) {
- return check;
- function check(code3) {
- return code3 !== null && regex.test(String.fromCharCode(code3));
- }
-}
-
-// node_modules/micromark-factory-space/index.js
-function factorySpace(effects, ok2, type, max5) {
- const limit = max5 ? max5 - 1 : Number.POSITIVE_INFINITY;
- let size2 = 0;
- return start;
- function start(code3) {
- if (markdownSpace(code3)) {
- effects.enter(type);
- return prefix(code3);
- }
- return ok2(code3);
- }
- function prefix(code3) {
- if (markdownSpace(code3) && size2++ < limit) {
- effects.consume(code3);
- return prefix;
- }
- effects.exit(type);
- return ok2(code3);
- }
-}
-
-// node_modules/micromark/lib/initialize/content.js
-var content3 = {
- tokenize: initializeContent
-};
-function initializeContent(effects) {
- const contentStart = effects.attempt(
- this.parser.constructs.contentInitial,
- afterContentStartConstruct,
- paragraphInitial
- );
- let previous2;
- return contentStart;
- function afterContentStartConstruct(code3) {
- if (code3 === null) {
- effects.consume(code3);
- return;
- }
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return factorySpace(effects, contentStart, "linePrefix");
- }
- function paragraphInitial(code3) {
- effects.enter("paragraph");
- return lineStart(code3);
- }
- function lineStart(code3) {
- const token = effects.enter("chunkText", {
- contentType: "text",
- previous: previous2
- });
- if (previous2) {
- previous2.next = token;
- }
- previous2 = token;
- return data3(code3);
- }
- function data3(code3) {
- if (code3 === null) {
- effects.exit("chunkText");
- effects.exit("paragraph");
- effects.consume(code3);
- return;
- }
- if (markdownLineEnding(code3)) {
- effects.consume(code3);
- effects.exit("chunkText");
- return lineStart;
- }
- effects.consume(code3);
- return data3;
- }
-}
-
-// node_modules/micromark/lib/initialize/document.js
-var document2 = {
- tokenize: initializeDocument
-};
-var containerConstruct = {
- tokenize: tokenizeContainer
-};
-function initializeDocument(effects) {
- const self2 = this;
- const stack = [];
- let continued = 0;
- let childFlow;
- let childToken;
- let lineStartOffset;
- return start;
- function start(code3) {
- if (continued < stack.length) {
- const item = stack[continued];
- self2.containerState = item[1];
- return effects.attempt(
- item[0].continuation,
- documentContinue,
- checkNewContainers
- )(code3);
- }
- return checkNewContainers(code3);
- }
- function documentContinue(code3) {
- continued++;
- if (self2.containerState._closeFlow) {
- self2.containerState._closeFlow = void 0;
- if (childFlow) {
- closeFlow();
- }
- const indexBeforeExits = self2.events.length;
- let indexBeforeFlow = indexBeforeExits;
- let point4;
- while (indexBeforeFlow--) {
- if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
- point4 = self2.events[indexBeforeFlow][1].end;
- break;
- }
- }
- exitContainers(continued);
- let index3 = indexBeforeExits;
- while (index3 < self2.events.length) {
- self2.events[index3][1].end = Object.assign({}, point4);
- index3++;
- }
- splice(
- self2.events,
- indexBeforeFlow + 1,
- 0,
- self2.events.slice(indexBeforeExits)
- );
- self2.events.length = index3;
- return checkNewContainers(code3);
- }
- return start(code3);
- }
- function checkNewContainers(code3) {
- if (continued === stack.length) {
- if (!childFlow) {
- return documentContinued(code3);
- }
- if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
- return flowStart(code3);
- }
- self2.interrupt = Boolean(
- childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack
- );
- }
- self2.containerState = {};
- return effects.check(
- containerConstruct,
- thereIsANewContainer,
- thereIsNoNewContainer
- )(code3);
- }
- function thereIsANewContainer(code3) {
- if (childFlow)
- closeFlow();
- exitContainers(continued);
- return documentContinued(code3);
- }
- function thereIsNoNewContainer(code3) {
- self2.parser.lazy[self2.now().line] = continued !== stack.length;
- lineStartOffset = self2.now().offset;
- return flowStart(code3);
- }
- function documentContinued(code3) {
- self2.containerState = {};
- return effects.attempt(
- containerConstruct,
- containerContinue,
- flowStart
- )(code3);
- }
- function containerContinue(code3) {
- continued++;
- stack.push([self2.currentConstruct, self2.containerState]);
- return documentContinued(code3);
- }
- function flowStart(code3) {
- if (code3 === null) {
- if (childFlow)
- closeFlow();
- exitContainers(0);
- effects.consume(code3);
- return;
- }
- childFlow = childFlow || self2.parser.flow(self2.now());
- effects.enter("chunkFlow", {
- contentType: "flow",
- previous: childToken,
- _tokenizer: childFlow
- });
- return flowContinue(code3);
- }
- function flowContinue(code3) {
- if (code3 === null) {
- writeToChild(effects.exit("chunkFlow"), true);
- exitContainers(0);
- effects.consume(code3);
- return;
- }
- if (markdownLineEnding(code3)) {
- effects.consume(code3);
- writeToChild(effects.exit("chunkFlow"));
- continued = 0;
- self2.interrupt = void 0;
- return start;
- }
- effects.consume(code3);
- return flowContinue;
- }
- function writeToChild(token, eof) {
- const stream = self2.sliceStream(token);
- if (eof)
- stream.push(null);
- token.previous = childToken;
- if (childToken)
- childToken.next = token;
- childToken = token;
- childFlow.defineSkip(token.start);
- childFlow.write(stream);
- if (self2.parser.lazy[token.start.line]) {
- let index3 = childFlow.events.length;
- while (index3--) {
- if (childFlow.events[index3][1].start.offset < lineStartOffset && (!childFlow.events[index3][1].end || childFlow.events[index3][1].end.offset > lineStartOffset)) {
- return;
- }
- }
- const indexBeforeExits = self2.events.length;
- let indexBeforeFlow = indexBeforeExits;
- let seen;
- let point4;
- while (indexBeforeFlow--) {
- if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
- if (seen) {
- point4 = self2.events[indexBeforeFlow][1].end;
- break;
- }
- seen = true;
- }
- }
- exitContainers(continued);
- index3 = indexBeforeExits;
- while (index3 < self2.events.length) {
- self2.events[index3][1].end = Object.assign({}, point4);
- index3++;
- }
- splice(
- self2.events,
- indexBeforeFlow + 1,
- 0,
- self2.events.slice(indexBeforeExits)
- );
- self2.events.length = index3;
- }
- }
- function exitContainers(size2) {
- let index3 = stack.length;
- while (index3-- > size2) {
- const entry = stack[index3];
- self2.containerState = entry[1];
- entry[0].exit.call(self2, effects);
- }
- stack.length = size2;
- }
- function closeFlow() {
- childFlow.write([null]);
- childToken = void 0;
- childFlow = void 0;
- self2.containerState._closeFlow = void 0;
- }
-}
-function tokenizeContainer(effects, ok2, nok) {
- return factorySpace(
- effects,
- effects.attempt(this.parser.constructs.document, ok2, nok),
- "linePrefix",
- this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
- );
-}
-
-// node_modules/micromark-util-classify-character/index.js
-function classifyCharacter(code3) {
- if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
- return 1;
- }
- if (unicodePunctuation(code3)) {
- return 2;
- }
-}
-
-// node_modules/micromark-util-resolve-all/index.js
-function resolveAll(constructs2, events2, context) {
- const called = [];
- let index3 = -1;
- while (++index3 < constructs2.length) {
- const resolve2 = constructs2[index3].resolveAll;
- if (resolve2 && !called.includes(resolve2)) {
- events2 = resolve2(events2, context);
- called.push(resolve2);
- }
- }
- return events2;
-}
-
-// node_modules/micromark-core-commonmark/lib/attention.js
-var attention = {
- name: "attention",
- tokenize: tokenizeAttention,
- resolveAll: resolveAllAttention
-};
-function resolveAllAttention(events2, context) {
- let index3 = -1;
- let open;
- let group;
- let text7;
- let openingSequence;
- let closingSequence;
- let use;
- let nextEvents;
- let offset2;
- while (++index3 < events2.length) {
- if (events2[index3][0] === "enter" && events2[index3][1].type === "attentionSequence" && events2[index3][1]._close) {
- open = index3;
- while (open--) {
- if (events2[open][0] === "exit" && events2[open][1].type === "attentionSequence" && events2[open][1]._open && context.sliceSerialize(events2[open][1]).charCodeAt(0) === context.sliceSerialize(events2[index3][1]).charCodeAt(0)) {
- if ((events2[open][1]._close || events2[index3][1]._open) && (events2[index3][1].end.offset - events2[index3][1].start.offset) % 3 && !((events2[open][1].end.offset - events2[open][1].start.offset + events2[index3][1].end.offset - events2[index3][1].start.offset) % 3)) {
- continue;
- }
- use = events2[open][1].end.offset - events2[open][1].start.offset > 1 && events2[index3][1].end.offset - events2[index3][1].start.offset > 1 ? 2 : 1;
- const start = Object.assign({}, events2[open][1].end);
- const end = Object.assign({}, events2[index3][1].start);
- movePoint(start, -use);
- movePoint(end, use);
- openingSequence = {
- type: use > 1 ? "strongSequence" : "emphasisSequence",
- start,
- end: Object.assign({}, events2[open][1].end)
- };
- closingSequence = {
- type: use > 1 ? "strongSequence" : "emphasisSequence",
- start: Object.assign({}, events2[index3][1].start),
- end
- };
- text7 = {
- type: use > 1 ? "strongText" : "emphasisText",
- start: Object.assign({}, events2[open][1].end),
- end: Object.assign({}, events2[index3][1].start)
- };
- group = {
- type: use > 1 ? "strong" : "emphasis",
- start: Object.assign({}, openingSequence.start),
- end: Object.assign({}, closingSequence.end)
- };
- events2[open][1].end = Object.assign({}, openingSequence.start);
- events2[index3][1].start = Object.assign({}, closingSequence.end);
- nextEvents = [];
- if (events2[open][1].end.offset - events2[open][1].start.offset) {
- nextEvents = push(nextEvents, [
- ["enter", events2[open][1], context],
- ["exit", events2[open][1], context]
- ]);
- }
- nextEvents = push(nextEvents, [
- ["enter", group, context],
- ["enter", openingSequence, context],
- ["exit", openingSequence, context],
- ["enter", text7, context]
- ]);
- nextEvents = push(
- nextEvents,
- resolveAll(
- context.parser.constructs.insideSpan.null,
- events2.slice(open + 1, index3),
- context
- )
- );
- nextEvents = push(nextEvents, [
- ["exit", text7, context],
- ["enter", closingSequence, context],
- ["exit", closingSequence, context],
- ["exit", group, context]
- ]);
- if (events2[index3][1].end.offset - events2[index3][1].start.offset) {
- offset2 = 2;
- nextEvents = push(nextEvents, [
- ["enter", events2[index3][1], context],
- ["exit", events2[index3][1], context]
- ]);
- } else {
- offset2 = 0;
- }
- splice(events2, open - 1, index3 - open + 3, nextEvents);
- index3 = open + nextEvents.length - offset2 - 2;
- break;
- }
- }
- }
- }
- index3 = -1;
- while (++index3 < events2.length) {
- if (events2[index3][1].type === "attentionSequence") {
- events2[index3][1].type = "data";
- }
- }
- return events2;
-}
-function tokenizeAttention(effects, ok2) {
- const attentionMarkers2 = this.parser.constructs.attentionMarkers.null;
- const previous2 = this.previous;
- const before = classifyCharacter(previous2);
- let marker;
- return start;
- function start(code3) {
- marker = code3;
- effects.enter("attentionSequence");
- return inside(code3);
- }
- function inside(code3) {
- if (code3 === marker) {
- effects.consume(code3);
- return inside;
- }
- const token = effects.exit("attentionSequence");
- const after = classifyCharacter(code3);
- const open = !after || after === 2 && before || attentionMarkers2.includes(code3);
- const close = !before || before === 2 && after || attentionMarkers2.includes(previous2);
- token._open = Boolean(marker === 42 ? open : open && (before || !close));
- token._close = Boolean(marker === 42 ? close : close && (after || !open));
- return ok2(code3);
- }
-}
-function movePoint(point4, offset2) {
- point4.column += offset2;
- point4.offset += offset2;
- point4._bufferIndex += offset2;
-}
-
-// node_modules/micromark-core-commonmark/lib/autolink.js
-var autolink = {
- name: "autolink",
- tokenize: tokenizeAutolink
-};
-function tokenizeAutolink(effects, ok2, nok) {
- let size2 = 0;
- return start;
- function start(code3) {
- effects.enter("autolink");
- effects.enter("autolinkMarker");
- effects.consume(code3);
- effects.exit("autolinkMarker");
- effects.enter("autolinkProtocol");
- return open;
- }
- function open(code3) {
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- return schemeOrEmailAtext;
- }
- return emailAtext(code3);
- }
- function schemeOrEmailAtext(code3) {
- if (code3 === 43 || code3 === 45 || code3 === 46 || asciiAlphanumeric(code3)) {
- size2 = 1;
- return schemeInsideOrEmailAtext(code3);
- }
- return emailAtext(code3);
- }
- function schemeInsideOrEmailAtext(code3) {
- if (code3 === 58) {
- effects.consume(code3);
- size2 = 0;
- return urlInside;
- }
- if ((code3 === 43 || code3 === 45 || code3 === 46 || asciiAlphanumeric(code3)) && size2++ < 32) {
- effects.consume(code3);
- return schemeInsideOrEmailAtext;
- }
- size2 = 0;
- return emailAtext(code3);
- }
- function urlInside(code3) {
- if (code3 === 62) {
- effects.exit("autolinkProtocol");
- effects.enter("autolinkMarker");
- effects.consume(code3);
- effects.exit("autolinkMarker");
- effects.exit("autolink");
- return ok2;
- }
- if (code3 === null || code3 === 32 || code3 === 60 || asciiControl(code3)) {
- return nok(code3);
- }
- effects.consume(code3);
- return urlInside;
- }
- function emailAtext(code3) {
- if (code3 === 64) {
- effects.consume(code3);
- return emailAtSignOrDot;
- }
- if (asciiAtext(code3)) {
- effects.consume(code3);
- return emailAtext;
- }
- return nok(code3);
- }
- function emailAtSignOrDot(code3) {
- return asciiAlphanumeric(code3) ? emailLabel(code3) : nok(code3);
- }
- function emailLabel(code3) {
- if (code3 === 46) {
- effects.consume(code3);
- size2 = 0;
- return emailAtSignOrDot;
- }
- if (code3 === 62) {
- effects.exit("autolinkProtocol").type = "autolinkEmail";
- effects.enter("autolinkMarker");
- effects.consume(code3);
- effects.exit("autolinkMarker");
- effects.exit("autolink");
- return ok2;
- }
- return emailValue(code3);
- }
- function emailValue(code3) {
- if ((code3 === 45 || asciiAlphanumeric(code3)) && size2++ < 63) {
- const next = code3 === 45 ? emailValue : emailLabel;
- effects.consume(code3);
- return next;
- }
- return nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/blank-line.js
-var blankLine = {
- tokenize: tokenizeBlankLine,
- partial: true
-};
-function tokenizeBlankLine(effects, ok2, nok) {
- return start;
- function start(code3) {
- return markdownSpace(code3) ? factorySpace(effects, after, "linePrefix")(code3) : after(code3);
- }
- function after(code3) {
- return code3 === null || markdownLineEnding(code3) ? ok2(code3) : nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/block-quote.js
-var blockQuote = {
- name: "blockQuote",
- tokenize: tokenizeBlockQuoteStart,
- continuation: {
- tokenize: tokenizeBlockQuoteContinuation
- },
- exit
-};
-function tokenizeBlockQuoteStart(effects, ok2, nok) {
- const self2 = this;
- return start;
- function start(code3) {
- if (code3 === 62) {
- const state = self2.containerState;
- if (!state.open) {
- effects.enter("blockQuote", {
- _container: true
- });
- state.open = true;
- }
- effects.enter("blockQuotePrefix");
- effects.enter("blockQuoteMarker");
- effects.consume(code3);
- effects.exit("blockQuoteMarker");
- return after;
- }
- return nok(code3);
- }
- function after(code3) {
- if (markdownSpace(code3)) {
- effects.enter("blockQuotePrefixWhitespace");
- effects.consume(code3);
- effects.exit("blockQuotePrefixWhitespace");
- effects.exit("blockQuotePrefix");
- return ok2;
- }
- effects.exit("blockQuotePrefix");
- return ok2(code3);
- }
-}
-function tokenizeBlockQuoteContinuation(effects, ok2, nok) {
- const self2 = this;
- return contStart;
- function contStart(code3) {
- if (markdownSpace(code3)) {
- return factorySpace(
- effects,
- contBefore,
- "linePrefix",
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
- )(code3);
- }
- return contBefore(code3);
- }
- function contBefore(code3) {
- return effects.attempt(blockQuote, ok2, nok)(code3);
- }
-}
-function exit(effects) {
- effects.exit("blockQuote");
-}
-
-// node_modules/micromark-core-commonmark/lib/character-escape.js
-var characterEscape = {
- name: "characterEscape",
- tokenize: tokenizeCharacterEscape
-};
-function tokenizeCharacterEscape(effects, ok2, nok) {
- return start;
- function start(code3) {
- effects.enter("characterEscape");
- effects.enter("escapeMarker");
- effects.consume(code3);
- effects.exit("escapeMarker");
- return inside;
- }
- function inside(code3) {
- if (asciiPunctuation(code3)) {
- effects.enter("characterEscapeValue");
- effects.consume(code3);
- effects.exit("characterEscapeValue");
- effects.exit("characterEscape");
- return ok2;
- }
- return nok(code3);
- }
-}
-
-// node_modules/decode-named-character-reference/index.dom.js
-var element = document.createElement("i");
-function decodeNamedCharacterReference(value) {
- const characterReference2 = "&" + value + ";";
- element.innerHTML = characterReference2;
- const char = element.textContent;
- if (char.charCodeAt(char.length - 1) === 59 && value !== "semi") {
- return false;
- }
- return char === characterReference2 ? false : char;
-}
-
-// node_modules/micromark-core-commonmark/lib/character-reference.js
-var characterReference = {
- name: "characterReference",
- tokenize: tokenizeCharacterReference
-};
-function tokenizeCharacterReference(effects, ok2, nok) {
- const self2 = this;
- let size2 = 0;
- let max5;
- let test;
- return start;
- function start(code3) {
- effects.enter("characterReference");
- effects.enter("characterReferenceMarker");
- effects.consume(code3);
- effects.exit("characterReferenceMarker");
- return open;
- }
- function open(code3) {
- if (code3 === 35) {
- effects.enter("characterReferenceMarkerNumeric");
- effects.consume(code3);
- effects.exit("characterReferenceMarkerNumeric");
- return numeric3;
- }
- effects.enter("characterReferenceValue");
- max5 = 31;
- test = asciiAlphanumeric;
- return value(code3);
- }
- function numeric3(code3) {
- if (code3 === 88 || code3 === 120) {
- effects.enter("characterReferenceMarkerHexadecimal");
- effects.consume(code3);
- effects.exit("characterReferenceMarkerHexadecimal");
- effects.enter("characterReferenceValue");
- max5 = 6;
- test = asciiHexDigit;
- return value;
- }
- effects.enter("characterReferenceValue");
- max5 = 7;
- test = asciiDigit;
- return value(code3);
- }
- function value(code3) {
- if (code3 === 59 && size2) {
- const token = effects.exit("characterReferenceValue");
- if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) {
- return nok(code3);
- }
- effects.enter("characterReferenceMarker");
- effects.consume(code3);
- effects.exit("characterReferenceMarker");
- effects.exit("characterReference");
- return ok2;
- }
- if (test(code3) && size2++ < max5) {
- effects.consume(code3);
- return value;
- }
- return nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/code-fenced.js
-var nonLazyContinuation = {
- tokenize: tokenizeNonLazyContinuation,
- partial: true
-};
-var codeFenced = {
- name: "codeFenced",
- tokenize: tokenizeCodeFenced,
- concrete: true
-};
-function tokenizeCodeFenced(effects, ok2, nok) {
- const self2 = this;
- const closeStart = {
- tokenize: tokenizeCloseStart,
- partial: true
- };
- let initialPrefix = 0;
- let sizeOpen = 0;
- let marker;
- return start;
- function start(code3) {
- return beforeSequenceOpen(code3);
- }
- function beforeSequenceOpen(code3) {
- const tail = self2.events[self2.events.length - 1];
- initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
- marker = code3;
- effects.enter("codeFenced");
- effects.enter("codeFencedFence");
- effects.enter("codeFencedFenceSequence");
- return sequenceOpen(code3);
- }
- function sequenceOpen(code3) {
- if (code3 === marker) {
- sizeOpen++;
- effects.consume(code3);
- return sequenceOpen;
- }
- if (sizeOpen < 3) {
- return nok(code3);
- }
- effects.exit("codeFencedFenceSequence");
- return markdownSpace(code3) ? factorySpace(effects, infoBefore, "whitespace")(code3) : infoBefore(code3);
- }
- function infoBefore(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("codeFencedFence");
- return self2.interrupt ? ok2(code3) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code3);
- }
- effects.enter("codeFencedFenceInfo");
- effects.enter("chunkString", {
- contentType: "string"
- });
- return info(code3);
- }
- function info(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("chunkString");
- effects.exit("codeFencedFenceInfo");
- return infoBefore(code3);
- }
- if (markdownSpace(code3)) {
- effects.exit("chunkString");
- effects.exit("codeFencedFenceInfo");
- return factorySpace(effects, metaBefore, "whitespace")(code3);
- }
- if (code3 === 96 && code3 === marker) {
- return nok(code3);
- }
- effects.consume(code3);
- return info;
- }
- function metaBefore(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- return infoBefore(code3);
- }
- effects.enter("codeFencedFenceMeta");
- effects.enter("chunkString", {
- contentType: "string"
- });
- return meta3(code3);
- }
- function meta3(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("chunkString");
- effects.exit("codeFencedFenceMeta");
- return infoBefore(code3);
- }
- if (code3 === 96 && code3 === marker) {
- return nok(code3);
- }
- effects.consume(code3);
- return meta3;
- }
- function atNonLazyBreak(code3) {
- return effects.attempt(closeStart, after, contentBefore)(code3);
- }
- function contentBefore(code3) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return contentStart;
- }
- function contentStart(code3) {
- return initialPrefix > 0 && markdownSpace(code3) ? factorySpace(
- effects,
- beforeContentChunk,
- "linePrefix",
- initialPrefix + 1
- )(code3) : beforeContentChunk(code3);
- }
- function beforeContentChunk(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code3);
- }
- effects.enter("codeFlowValue");
- return contentChunk(code3);
- }
- function contentChunk(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("codeFlowValue");
- return beforeContentChunk(code3);
- }
- effects.consume(code3);
- return contentChunk;
- }
- function after(code3) {
- effects.exit("codeFenced");
- return ok2(code3);
- }
- function tokenizeCloseStart(effects2, ok3, nok2) {
- let size2 = 0;
- return startBefore;
- function startBefore(code3) {
- effects2.enter("lineEnding");
- effects2.consume(code3);
- effects2.exit("lineEnding");
- return start2;
- }
- function start2(code3) {
- effects2.enter("codeFencedFence");
- return markdownSpace(code3) ? factorySpace(
- effects2,
- beforeSequenceClose,
- "linePrefix",
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
- )(code3) : beforeSequenceClose(code3);
- }
- function beforeSequenceClose(code3) {
- if (code3 === marker) {
- effects2.enter("codeFencedFenceSequence");
- return sequenceClose(code3);
- }
- return nok2(code3);
- }
- function sequenceClose(code3) {
- if (code3 === marker) {
- size2++;
- effects2.consume(code3);
- return sequenceClose;
- }
- if (size2 >= sizeOpen) {
- effects2.exit("codeFencedFenceSequence");
- return markdownSpace(code3) ? factorySpace(effects2, sequenceCloseAfter, "whitespace")(code3) : sequenceCloseAfter(code3);
- }
- return nok2(code3);
- }
- function sequenceCloseAfter(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects2.exit("codeFencedFence");
- return ok3(code3);
- }
- return nok2(code3);
- }
- }
-}
-function tokenizeNonLazyContinuation(effects, ok2, nok) {
- const self2 = this;
- return start;
- function start(code3) {
- if (code3 === null) {
- return nok(code3);
- }
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return lineStart;
- }
- function lineStart(code3) {
- return self2.parser.lazy[self2.now().line] ? nok(code3) : ok2(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/code-indented.js
-var codeIndented = {
- name: "codeIndented",
- tokenize: tokenizeCodeIndented
-};
-var furtherStart = {
- tokenize: tokenizeFurtherStart,
- partial: true
-};
-function tokenizeCodeIndented(effects, ok2, nok) {
- const self2 = this;
- return start;
- function start(code3) {
- effects.enter("codeIndented");
- return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code3);
- }
- function afterPrefix(code3) {
- const tail = self2.events[self2.events.length - 1];
- return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code3) : nok(code3);
- }
- function atBreak(code3) {
- if (code3 === null) {
- return after(code3);
- }
- if (markdownLineEnding(code3)) {
- return effects.attempt(furtherStart, atBreak, after)(code3);
- }
- effects.enter("codeFlowValue");
- return inside(code3);
- }
- function inside(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("codeFlowValue");
- return atBreak(code3);
- }
- effects.consume(code3);
- return inside;
- }
- function after(code3) {
- effects.exit("codeIndented");
- return ok2(code3);
- }
-}
-function tokenizeFurtherStart(effects, ok2, nok) {
- const self2 = this;
- return furtherStart2;
- function furtherStart2(code3) {
- if (self2.parser.lazy[self2.now().line]) {
- return nok(code3);
- }
- if (markdownLineEnding(code3)) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return furtherStart2;
- }
- return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code3);
- }
- function afterPrefix(code3) {
- const tail = self2.events[self2.events.length - 1];
- return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok2(code3) : markdownLineEnding(code3) ? furtherStart2(code3) : nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/code-text.js
-var codeText = {
- name: "codeText",
- tokenize: tokenizeCodeText,
- resolve: resolveCodeText,
- previous
-};
-function resolveCodeText(events2) {
- let tailExitIndex = events2.length - 4;
- let headEnterIndex = 3;
- let index3;
- let enter;
- if ((events2[headEnterIndex][1].type === "lineEnding" || events2[headEnterIndex][1].type === "space") && (events2[tailExitIndex][1].type === "lineEnding" || events2[tailExitIndex][1].type === "space")) {
- index3 = headEnterIndex;
- while (++index3 < tailExitIndex) {
- if (events2[index3][1].type === "codeTextData") {
- events2[headEnterIndex][1].type = "codeTextPadding";
- events2[tailExitIndex][1].type = "codeTextPadding";
- headEnterIndex += 2;
- tailExitIndex -= 2;
- break;
- }
- }
- }
- index3 = headEnterIndex - 1;
- tailExitIndex++;
- while (++index3 <= tailExitIndex) {
- if (enter === void 0) {
- if (index3 !== tailExitIndex && events2[index3][1].type !== "lineEnding") {
- enter = index3;
- }
- } else if (index3 === tailExitIndex || events2[index3][1].type === "lineEnding") {
- events2[enter][1].type = "codeTextData";
- if (index3 !== enter + 2) {
- events2[enter][1].end = events2[index3 - 1][1].end;
- events2.splice(enter + 2, index3 - enter - 2);
- tailExitIndex -= index3 - enter - 2;
- index3 = enter + 2;
- }
- enter = void 0;
- }
- }
- return events2;
-}
-function previous(code3) {
- return code3 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
-}
-function tokenizeCodeText(effects, ok2, nok) {
- const self2 = this;
- let sizeOpen = 0;
- let size2;
- let token;
- return start;
- function start(code3) {
- effects.enter("codeText");
- effects.enter("codeTextSequence");
- return sequenceOpen(code3);
- }
- function sequenceOpen(code3) {
- if (code3 === 96) {
- effects.consume(code3);
- sizeOpen++;
- return sequenceOpen;
- }
- effects.exit("codeTextSequence");
- return between2(code3);
- }
- function between2(code3) {
- if (code3 === null) {
- return nok(code3);
- }
- if (code3 === 32) {
- effects.enter("space");
- effects.consume(code3);
- effects.exit("space");
- return between2;
- }
- if (code3 === 96) {
- token = effects.enter("codeTextSequence");
- size2 = 0;
- return sequenceClose(code3);
- }
- if (markdownLineEnding(code3)) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return between2;
- }
- effects.enter("codeTextData");
- return data3(code3);
- }
- function data3(code3) {
- if (code3 === null || code3 === 32 || code3 === 96 || markdownLineEnding(code3)) {
- effects.exit("codeTextData");
- return between2(code3);
- }
- effects.consume(code3);
- return data3;
- }
- function sequenceClose(code3) {
- if (code3 === 96) {
- effects.consume(code3);
- size2++;
- return sequenceClose;
- }
- if (size2 === sizeOpen) {
- effects.exit("codeTextSequence");
- effects.exit("codeText");
- return ok2(code3);
- }
- token.type = "codeTextData";
- return data3(code3);
- }
-}
-
-// node_modules/micromark-util-subtokenize/index.js
-function subtokenize(events2) {
- const jumps = {};
- let index3 = -1;
- let event;
- let lineIndex;
- let otherIndex;
- let otherEvent;
- let parameters;
- let subevents;
- let more;
- while (++index3 < events2.length) {
- while (index3 in jumps) {
- index3 = jumps[index3];
- }
- event = events2[index3];
- if (index3 && event[1].type === "chunkFlow" && events2[index3 - 1][1].type === "listItemPrefix") {
- subevents = event[1]._tokenizer.events;
- otherIndex = 0;
- if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
- otherIndex += 2;
- }
- if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
- while (++otherIndex < subevents.length) {
- if (subevents[otherIndex][1].type === "content") {
- break;
- }
- if (subevents[otherIndex][1].type === "chunkText") {
- subevents[otherIndex][1]._isInFirstContentOfListItem = true;
- otherIndex++;
- }
- }
- }
- }
- if (event[0] === "enter") {
- if (event[1].contentType) {
- Object.assign(jumps, subcontent(events2, index3));
- index3 = jumps[index3];
- more = true;
- }
- } else if (event[1]._container) {
- otherIndex = index3;
- lineIndex = void 0;
- while (otherIndex--) {
- otherEvent = events2[otherIndex];
- if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
- if (otherEvent[0] === "enter") {
- if (lineIndex) {
- events2[lineIndex][1].type = "lineEndingBlank";
- }
- otherEvent[1].type = "lineEnding";
- lineIndex = otherIndex;
- }
- } else {
- break;
- }
- }
- if (lineIndex) {
- event[1].end = Object.assign({}, events2[lineIndex][1].start);
- parameters = events2.slice(lineIndex, index3);
- parameters.unshift(event);
- splice(events2, lineIndex, index3 - lineIndex + 1, parameters);
- }
- }
- }
- return !more;
-}
-function subcontent(events2, eventIndex) {
- const token = events2[eventIndex][1];
- const context = events2[eventIndex][2];
- let startPosition = eventIndex - 1;
- const startPositions = [];
- const tokenizer2 = token._tokenizer || context.parser[token.contentType](token.start);
- const childEvents = tokenizer2.events;
- const jumps = [];
- const gaps = {};
- let stream;
- let previous2;
- let index3 = -1;
- let current3 = token;
- let adjust = 0;
- let start = 0;
- const breaks = [start];
- while (current3) {
- while (events2[++startPosition][1] !== current3) {
- }
- startPositions.push(startPosition);
- if (!current3._tokenizer) {
- stream = context.sliceStream(current3);
- if (!current3.next) {
- stream.push(null);
- }
- if (previous2) {
- tokenizer2.defineSkip(current3.start);
- }
- if (current3._isInFirstContentOfListItem) {
- tokenizer2._gfmTasklistFirstContentOfListItem = true;
- }
- tokenizer2.write(stream);
- if (current3._isInFirstContentOfListItem) {
- tokenizer2._gfmTasklistFirstContentOfListItem = void 0;
- }
- }
- previous2 = current3;
- current3 = current3.next;
- }
- current3 = token;
- while (++index3 < childEvents.length) {
- if (childEvents[index3][0] === "exit" && childEvents[index3 - 1][0] === "enter" && childEvents[index3][1].type === childEvents[index3 - 1][1].type && childEvents[index3][1].start.line !== childEvents[index3][1].end.line) {
- start = index3 + 1;
- breaks.push(start);
- current3._tokenizer = void 0;
- current3.previous = void 0;
- current3 = current3.next;
- }
- }
- tokenizer2.events = [];
- if (current3) {
- current3._tokenizer = void 0;
- current3.previous = void 0;
- } else {
- breaks.pop();
- }
- index3 = breaks.length;
- while (index3--) {
- const slice = childEvents.slice(breaks[index3], breaks[index3 + 1]);
- const start2 = startPositions.pop();
- jumps.unshift([start2, start2 + slice.length - 1]);
- splice(events2, start2, 2, slice);
- }
- index3 = -1;
- while (++index3 < jumps.length) {
- gaps[adjust + jumps[index3][0]] = adjust + jumps[index3][1];
- adjust += jumps[index3][1] - jumps[index3][0] - 1;
- }
- return gaps;
-}
-
-// node_modules/micromark-core-commonmark/lib/content.js
-var content4 = {
- tokenize: tokenizeContent,
- resolve: resolveContent
-};
-var continuationConstruct = {
- tokenize: tokenizeContinuation,
- partial: true
-};
-function resolveContent(events2) {
- subtokenize(events2);
- return events2;
-}
-function tokenizeContent(effects, ok2) {
- let previous2;
- return chunkStart;
- function chunkStart(code3) {
- effects.enter("content");
- previous2 = effects.enter("chunkContent", {
- contentType: "content"
- });
- return chunkInside(code3);
- }
- function chunkInside(code3) {
- if (code3 === null) {
- return contentEnd(code3);
- }
- if (markdownLineEnding(code3)) {
- return effects.check(
- continuationConstruct,
- contentContinue,
- contentEnd
- )(code3);
- }
- effects.consume(code3);
- return chunkInside;
- }
- function contentEnd(code3) {
- effects.exit("chunkContent");
- effects.exit("content");
- return ok2(code3);
- }
- function contentContinue(code3) {
- effects.consume(code3);
- effects.exit("chunkContent");
- previous2.next = effects.enter("chunkContent", {
- contentType: "content",
- previous: previous2
- });
- previous2 = previous2.next;
- return chunkInside;
- }
-}
-function tokenizeContinuation(effects, ok2, nok) {
- const self2 = this;
- return startLookahead;
- function startLookahead(code3) {
- effects.exit("chunkContent");
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return factorySpace(effects, prefixed, "linePrefix");
- }
- function prefixed(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- return nok(code3);
- }
- const tail = self2.events[self2.events.length - 1];
- if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) {
- return ok2(code3);
- }
- return effects.interrupt(self2.parser.constructs.flow, nok, ok2)(code3);
- }
-}
-
-// node_modules/micromark-factory-destination/index.js
-function factoryDestination(effects, ok2, nok, type, literalType, literalMarkerType, rawType, stringType, max5) {
- const limit = max5 || Number.POSITIVE_INFINITY;
- let balance = 0;
- return start;
- function start(code3) {
- if (code3 === 60) {
- effects.enter(type);
- effects.enter(literalType);
- effects.enter(literalMarkerType);
- effects.consume(code3);
- effects.exit(literalMarkerType);
- return enclosedBefore;
- }
- if (code3 === null || code3 === 32 || code3 === 41 || asciiControl(code3)) {
- return nok(code3);
- }
- effects.enter(type);
- effects.enter(rawType);
- effects.enter(stringType);
- effects.enter("chunkString", {
- contentType: "string"
- });
- return raw2(code3);
- }
- function enclosedBefore(code3) {
- if (code3 === 62) {
- effects.enter(literalMarkerType);
- effects.consume(code3);
- effects.exit(literalMarkerType);
- effects.exit(literalType);
- effects.exit(type);
- return ok2;
- }
- effects.enter(stringType);
- effects.enter("chunkString", {
- contentType: "string"
- });
- return enclosed(code3);
- }
- function enclosed(code3) {
- if (code3 === 62) {
- effects.exit("chunkString");
- effects.exit(stringType);
- return enclosedBefore(code3);
- }
- if (code3 === null || code3 === 60 || markdownLineEnding(code3)) {
- return nok(code3);
- }
- effects.consume(code3);
- return code3 === 92 ? enclosedEscape : enclosed;
- }
- function enclosedEscape(code3) {
- if (code3 === 60 || code3 === 62 || code3 === 92) {
- effects.consume(code3);
- return enclosed;
- }
- return enclosed(code3);
- }
- function raw2(code3) {
- if (!balance && (code3 === null || code3 === 41 || markdownLineEndingOrSpace(code3))) {
- effects.exit("chunkString");
- effects.exit(stringType);
- effects.exit(rawType);
- effects.exit(type);
- return ok2(code3);
- }
- if (balance < limit && code3 === 40) {
- effects.consume(code3);
- balance++;
- return raw2;
- }
- if (code3 === 41) {
- effects.consume(code3);
- balance--;
- return raw2;
- }
- if (code3 === null || code3 === 32 || code3 === 40 || asciiControl(code3)) {
- return nok(code3);
- }
- effects.consume(code3);
- return code3 === 92 ? rawEscape : raw2;
- }
- function rawEscape(code3) {
- if (code3 === 40 || code3 === 41 || code3 === 92) {
- effects.consume(code3);
- return raw2;
- }
- return raw2(code3);
- }
-}
-
-// node_modules/micromark-factory-label/index.js
-function factoryLabel(effects, ok2, nok, type, markerType, stringType) {
- const self2 = this;
- let size2 = 0;
- let seen;
- return start;
- function start(code3) {
- effects.enter(type);
- effects.enter(markerType);
- effects.consume(code3);
- effects.exit(markerType);
- effects.enter(stringType);
- return atBreak;
- }
- function atBreak(code3) {
- if (size2 > 999 || code3 === null || code3 === 91 || code3 === 93 && !seen || code3 === 94 && !size2 && "_hiddenFootnoteSupport" in self2.parser.constructs) {
- return nok(code3);
- }
- if (code3 === 93) {
- effects.exit(stringType);
- effects.enter(markerType);
- effects.consume(code3);
- effects.exit(markerType);
- effects.exit(type);
- return ok2;
- }
- if (markdownLineEnding(code3)) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return atBreak;
- }
- effects.enter("chunkString", {
- contentType: "string"
- });
- return labelInside(code3);
- }
- function labelInside(code3) {
- if (code3 === null || code3 === 91 || code3 === 93 || markdownLineEnding(code3) || size2++ > 999) {
- effects.exit("chunkString");
- return atBreak(code3);
- }
- effects.consume(code3);
- if (!seen)
- seen = !markdownSpace(code3);
- return code3 === 92 ? labelEscape : labelInside;
- }
- function labelEscape(code3) {
- if (code3 === 91 || code3 === 92 || code3 === 93) {
- effects.consume(code3);
- size2++;
- return labelInside;
- }
- return labelInside(code3);
- }
-}
-
-// node_modules/micromark-factory-title/index.js
-function factoryTitle(effects, ok2, nok, type, markerType, stringType) {
- let marker;
- return start;
- function start(code3) {
- if (code3 === 34 || code3 === 39 || code3 === 40) {
- effects.enter(type);
- effects.enter(markerType);
- effects.consume(code3);
- effects.exit(markerType);
- marker = code3 === 40 ? 41 : code3;
- return begin;
- }
- return nok(code3);
- }
- function begin(code3) {
- if (code3 === marker) {
- effects.enter(markerType);
- effects.consume(code3);
- effects.exit(markerType);
- effects.exit(type);
- return ok2;
- }
- effects.enter(stringType);
- return atBreak(code3);
- }
- function atBreak(code3) {
- if (code3 === marker) {
- effects.exit(stringType);
- return begin(marker);
- }
- if (code3 === null) {
- return nok(code3);
- }
- if (markdownLineEnding(code3)) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return factorySpace(effects, atBreak, "linePrefix");
- }
- effects.enter("chunkString", {
- contentType: "string"
- });
- return inside(code3);
- }
- function inside(code3) {
- if (code3 === marker || code3 === null || markdownLineEnding(code3)) {
- effects.exit("chunkString");
- return atBreak(code3);
- }
- effects.consume(code3);
- return code3 === 92 ? escape2 : inside;
- }
- function escape2(code3) {
- if (code3 === marker || code3 === 92) {
- effects.consume(code3);
- return inside;
- }
- return inside(code3);
- }
-}
-
-// node_modules/micromark-factory-whitespace/index.js
-function factoryWhitespace(effects, ok2) {
- let seen;
- return start;
- function start(code3) {
- if (markdownLineEnding(code3)) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- seen = true;
- return start;
- }
- if (markdownSpace(code3)) {
- return factorySpace(
- effects,
- start,
- seen ? "linePrefix" : "lineSuffix"
- )(code3);
- }
- return ok2(code3);
- }
-}
-
-// node_modules/micromark-util-normalize-identifier/index.js
-function normalizeIdentifier(value) {
- return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
-}
-
-// node_modules/micromark-core-commonmark/lib/definition.js
-var definition = {
- name: "definition",
- tokenize: tokenizeDefinition
-};
-var titleBefore = {
- tokenize: tokenizeTitleBefore,
- partial: true
-};
-function tokenizeDefinition(effects, ok2, nok) {
- const self2 = this;
- let identifier;
- return start;
- function start(code3) {
- effects.enter("definition");
- return before(code3);
- }
- function before(code3) {
- return factoryLabel.call(
- self2,
- effects,
- labelAfter,
- nok,
- "definitionLabel",
- "definitionLabelMarker",
- "definitionLabelString"
- )(code3);
- }
- function labelAfter(code3) {
- identifier = normalizeIdentifier(
- self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)
- );
- if (code3 === 58) {
- effects.enter("definitionMarker");
- effects.consume(code3);
- effects.exit("definitionMarker");
- return markerAfter;
- }
- return nok(code3);
- }
- function markerAfter(code3) {
- return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, destinationBefore)(code3) : destinationBefore(code3);
- }
- function destinationBefore(code3) {
- return factoryDestination(
- effects,
- destinationAfter,
- nok,
- "definitionDestination",
- "definitionDestinationLiteral",
- "definitionDestinationLiteralMarker",
- "definitionDestinationRaw",
- "definitionDestinationString"
- )(code3);
- }
- function destinationAfter(code3) {
- return effects.attempt(titleBefore, after, after)(code3);
- }
- function after(code3) {
- return markdownSpace(code3) ? factorySpace(effects, afterWhitespace, "whitespace")(code3) : afterWhitespace(code3);
- }
- function afterWhitespace(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("definition");
- self2.parser.defined.push(identifier);
- return ok2(code3);
- }
- return nok(code3);
- }
-}
-function tokenizeTitleBefore(effects, ok2, nok) {
- return titleBefore2;
- function titleBefore2(code3) {
- return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, beforeMarker)(code3) : nok(code3);
- }
- function beforeMarker(code3) {
- return factoryTitle(
- effects,
- titleAfter,
- nok,
- "definitionTitle",
- "definitionTitleMarker",
- "definitionTitleString"
- )(code3);
- }
- function titleAfter(code3) {
- return markdownSpace(code3) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code3) : titleAfterOptionalWhitespace(code3);
- }
- function titleAfterOptionalWhitespace(code3) {
- return code3 === null || markdownLineEnding(code3) ? ok2(code3) : nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/hard-break-escape.js
-var hardBreakEscape = {
- name: "hardBreakEscape",
- tokenize: tokenizeHardBreakEscape
-};
-function tokenizeHardBreakEscape(effects, ok2, nok) {
- return start;
- function start(code3) {
- effects.enter("hardBreakEscape");
- effects.consume(code3);
- return after;
- }
- function after(code3) {
- if (markdownLineEnding(code3)) {
- effects.exit("hardBreakEscape");
- return ok2(code3);
- }
- return nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/heading-atx.js
-var headingAtx = {
- name: "headingAtx",
- tokenize: tokenizeHeadingAtx,
- resolve: resolveHeadingAtx
-};
-function resolveHeadingAtx(events2, context) {
- let contentEnd = events2.length - 2;
- let contentStart = 3;
- let content5;
- let text7;
- if (events2[contentStart][1].type === "whitespace") {
- contentStart += 2;
- }
- if (contentEnd - 2 > contentStart && events2[contentEnd][1].type === "whitespace") {
- contentEnd -= 2;
- }
- if (events2[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events2[contentEnd - 2][1].type === "whitespace")) {
- contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
- }
- if (contentEnd > contentStart) {
- content5 = {
- type: "atxHeadingText",
- start: events2[contentStart][1].start,
- end: events2[contentEnd][1].end
- };
- text7 = {
- type: "chunkText",
- start: events2[contentStart][1].start,
- end: events2[contentEnd][1].end,
- contentType: "text"
- };
- splice(events2, contentStart, contentEnd - contentStart + 1, [
- ["enter", content5, context],
- ["enter", text7, context],
- ["exit", text7, context],
- ["exit", content5, context]
- ]);
- }
- return events2;
-}
-function tokenizeHeadingAtx(effects, ok2, nok) {
- let size2 = 0;
- return start;
- function start(code3) {
- effects.enter("atxHeading");
- return before(code3);
- }
- function before(code3) {
- effects.enter("atxHeadingSequence");
- return sequenceOpen(code3);
- }
- function sequenceOpen(code3) {
- if (code3 === 35 && size2++ < 6) {
- effects.consume(code3);
- return sequenceOpen;
- }
- if (code3 === null || markdownLineEndingOrSpace(code3)) {
- effects.exit("atxHeadingSequence");
- return atBreak(code3);
- }
- return nok(code3);
- }
- function atBreak(code3) {
- if (code3 === 35) {
- effects.enter("atxHeadingSequence");
- return sequenceFurther(code3);
- }
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("atxHeading");
- return ok2(code3);
- }
- if (markdownSpace(code3)) {
- return factorySpace(effects, atBreak, "whitespace")(code3);
- }
- effects.enter("atxHeadingText");
- return data3(code3);
- }
- function sequenceFurther(code3) {
- if (code3 === 35) {
- effects.consume(code3);
- return sequenceFurther;
- }
- effects.exit("atxHeadingSequence");
- return atBreak(code3);
- }
- function data3(code3) {
- if (code3 === null || code3 === 35 || markdownLineEndingOrSpace(code3)) {
- effects.exit("atxHeadingText");
- return atBreak(code3);
- }
- effects.consume(code3);
- return data3;
- }
-}
-
-// node_modules/micromark-util-html-tag-name/index.js
-var htmlBlockNames = [
- "address",
- "article",
- "aside",
- "base",
- "basefont",
- "blockquote",
- "body",
- "caption",
- "center",
- "col",
- "colgroup",
- "dd",
- "details",
- "dialog",
- "dir",
- "div",
- "dl",
- "dt",
- "fieldset",
- "figcaption",
- "figure",
- "footer",
- "form",
- "frame",
- "frameset",
- "h1",
- "h2",
- "h3",
- "h4",
- "h5",
- "h6",
- "head",
- "header",
- "hr",
- "html",
- "iframe",
- "legend",
- "li",
- "link",
- "main",
- "menu",
- "menuitem",
- "nav",
- "noframes",
- "ol",
- "optgroup",
- "option",
- "p",
- "param",
- "search",
- "section",
- "summary",
- "table",
- "tbody",
- "td",
- "tfoot",
- "th",
- "thead",
- "title",
- "tr",
- "track",
- "ul"
-];
-var htmlRawNames = ["pre", "script", "style", "textarea"];
-
-// node_modules/micromark-core-commonmark/lib/html-flow.js
-var htmlFlow = {
- name: "htmlFlow",
- tokenize: tokenizeHtmlFlow,
- resolveTo: resolveToHtmlFlow,
- concrete: true
-};
-var blankLineBefore = {
- tokenize: tokenizeBlankLineBefore,
- partial: true
-};
-var nonLazyContinuationStart = {
- tokenize: tokenizeNonLazyContinuationStart,
- partial: true
-};
-function resolveToHtmlFlow(events2) {
- let index3 = events2.length;
- while (index3--) {
- if (events2[index3][0] === "enter" && events2[index3][1].type === "htmlFlow") {
- break;
- }
- }
- if (index3 > 1 && events2[index3 - 2][1].type === "linePrefix") {
- events2[index3][1].start = events2[index3 - 2][1].start;
- events2[index3 + 1][1].start = events2[index3 - 2][1].start;
- events2.splice(index3 - 2, 2);
- }
- return events2;
-}
-function tokenizeHtmlFlow(effects, ok2, nok) {
- const self2 = this;
- let marker;
- let closingTag;
- let buffer2;
- let index3;
- let markerB;
- return start;
- function start(code3) {
- return before(code3);
- }
- function before(code3) {
- effects.enter("htmlFlow");
- effects.enter("htmlFlowData");
- effects.consume(code3);
- return open;
- }
- function open(code3) {
- if (code3 === 33) {
- effects.consume(code3);
- return declarationOpen;
- }
- if (code3 === 47) {
- effects.consume(code3);
- closingTag = true;
- return tagCloseStart;
- }
- if (code3 === 63) {
- effects.consume(code3);
- marker = 3;
- return self2.interrupt ? ok2 : continuationDeclarationInside;
- }
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- buffer2 = String.fromCharCode(code3);
- return tagName;
- }
- return nok(code3);
- }
- function declarationOpen(code3) {
- if (code3 === 45) {
- effects.consume(code3);
- marker = 2;
- return commentOpenInside;
- }
- if (code3 === 91) {
- effects.consume(code3);
- marker = 5;
- index3 = 0;
- return cdataOpenInside;
- }
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- marker = 4;
- return self2.interrupt ? ok2 : continuationDeclarationInside;
- }
- return nok(code3);
- }
- function commentOpenInside(code3) {
- if (code3 === 45) {
- effects.consume(code3);
- return self2.interrupt ? ok2 : continuationDeclarationInside;
- }
- return nok(code3);
- }
- function cdataOpenInside(code3) {
- const value = "CDATA[";
- if (code3 === value.charCodeAt(index3++)) {
- effects.consume(code3);
- if (index3 === value.length) {
- return self2.interrupt ? ok2 : continuation;
- }
- return cdataOpenInside;
- }
- return nok(code3);
- }
- function tagCloseStart(code3) {
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- buffer2 = String.fromCharCode(code3);
- return tagName;
- }
- return nok(code3);
- }
- function tagName(code3) {
- if (code3 === null || code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) {
- const slash2 = code3 === 47;
- const name317 = buffer2.toLowerCase();
- if (!slash2 && !closingTag && htmlRawNames.includes(name317)) {
- marker = 1;
- return self2.interrupt ? ok2(code3) : continuation(code3);
- }
- if (htmlBlockNames.includes(buffer2.toLowerCase())) {
- marker = 6;
- if (slash2) {
- effects.consume(code3);
- return basicSelfClosing;
- }
- return self2.interrupt ? ok2(code3) : continuation(code3);
- }
- marker = 7;
- return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code3) : closingTag ? completeClosingTagAfter(code3) : completeAttributeNameBefore(code3);
- }
- if (code3 === 45 || asciiAlphanumeric(code3)) {
- effects.consume(code3);
- buffer2 += String.fromCharCode(code3);
- return tagName;
- }
- return nok(code3);
- }
- function basicSelfClosing(code3) {
- if (code3 === 62) {
- effects.consume(code3);
- return self2.interrupt ? ok2 : continuation;
- }
- return nok(code3);
- }
- function completeClosingTagAfter(code3) {
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return completeClosingTagAfter;
- }
- return completeEnd(code3);
- }
- function completeAttributeNameBefore(code3) {
- if (code3 === 47) {
- effects.consume(code3);
- return completeEnd;
- }
- if (code3 === 58 || code3 === 95 || asciiAlpha(code3)) {
- effects.consume(code3);
- return completeAttributeName;
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return completeAttributeNameBefore;
- }
- return completeEnd(code3);
- }
- function completeAttributeName(code3) {
- if (code3 === 45 || code3 === 46 || code3 === 58 || code3 === 95 || asciiAlphanumeric(code3)) {
- effects.consume(code3);
- return completeAttributeName;
- }
- return completeAttributeNameAfter(code3);
- }
- function completeAttributeNameAfter(code3) {
- if (code3 === 61) {
- effects.consume(code3);
- return completeAttributeValueBefore;
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return completeAttributeNameAfter;
- }
- return completeAttributeNameBefore(code3);
- }
- function completeAttributeValueBefore(code3) {
- if (code3 === null || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96) {
- return nok(code3);
- }
- if (code3 === 34 || code3 === 39) {
- effects.consume(code3);
- markerB = code3;
- return completeAttributeValueQuoted;
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return completeAttributeValueBefore;
- }
- return completeAttributeValueUnquoted(code3);
- }
- function completeAttributeValueQuoted(code3) {
- if (code3 === markerB) {
- effects.consume(code3);
- markerB = null;
- return completeAttributeValueQuotedAfter;
- }
- if (code3 === null || markdownLineEnding(code3)) {
- return nok(code3);
- }
- effects.consume(code3);
- return completeAttributeValueQuoted;
- }
- function completeAttributeValueUnquoted(code3) {
- if (code3 === null || code3 === 34 || code3 === 39 || code3 === 47 || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96 || markdownLineEndingOrSpace(code3)) {
- return completeAttributeNameAfter(code3);
- }
- effects.consume(code3);
- return completeAttributeValueUnquoted;
- }
- function completeAttributeValueQuotedAfter(code3) {
- if (code3 === 47 || code3 === 62 || markdownSpace(code3)) {
- return completeAttributeNameBefore(code3);
- }
- return nok(code3);
- }
- function completeEnd(code3) {
- if (code3 === 62) {
- effects.consume(code3);
- return completeAfter;
- }
- return nok(code3);
- }
- function completeAfter(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- return continuation(code3);
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return completeAfter;
- }
- return nok(code3);
- }
- function continuation(code3) {
- if (code3 === 45 && marker === 2) {
- effects.consume(code3);
- return continuationCommentInside;
- }
- if (code3 === 60 && marker === 1) {
- effects.consume(code3);
- return continuationRawTagOpen;
- }
- if (code3 === 62 && marker === 4) {
- effects.consume(code3);
- return continuationClose;
- }
- if (code3 === 63 && marker === 3) {
- effects.consume(code3);
- return continuationDeclarationInside;
- }
- if (code3 === 93 && marker === 5) {
- effects.consume(code3);
- return continuationCdataInside;
- }
- if (markdownLineEnding(code3) && (marker === 6 || marker === 7)) {
- effects.exit("htmlFlowData");
- return effects.check(
- blankLineBefore,
- continuationAfter,
- continuationStart
- )(code3);
- }
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("htmlFlowData");
- return continuationStart(code3);
- }
- effects.consume(code3);
- return continuation;
- }
- function continuationStart(code3) {
- return effects.check(
- nonLazyContinuationStart,
- continuationStartNonLazy,
- continuationAfter
- )(code3);
- }
- function continuationStartNonLazy(code3) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return continuationBefore;
- }
- function continuationBefore(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- return continuationStart(code3);
- }
- effects.enter("htmlFlowData");
- return continuation(code3);
- }
- function continuationCommentInside(code3) {
- if (code3 === 45) {
- effects.consume(code3);
- return continuationDeclarationInside;
- }
- return continuation(code3);
- }
- function continuationRawTagOpen(code3) {
- if (code3 === 47) {
- effects.consume(code3);
- buffer2 = "";
- return continuationRawEndTag;
- }
- return continuation(code3);
- }
- function continuationRawEndTag(code3) {
- if (code3 === 62) {
- const name317 = buffer2.toLowerCase();
- if (htmlRawNames.includes(name317)) {
- effects.consume(code3);
- return continuationClose;
- }
- return continuation(code3);
- }
- if (asciiAlpha(code3) && buffer2.length < 8) {
- effects.consume(code3);
- buffer2 += String.fromCharCode(code3);
- return continuationRawEndTag;
- }
- return continuation(code3);
- }
- function continuationCdataInside(code3) {
- if (code3 === 93) {
- effects.consume(code3);
- return continuationDeclarationInside;
- }
- return continuation(code3);
- }
- function continuationDeclarationInside(code3) {
- if (code3 === 62) {
- effects.consume(code3);
- return continuationClose;
- }
- if (code3 === 45 && marker === 2) {
- effects.consume(code3);
- return continuationDeclarationInside;
- }
- return continuation(code3);
- }
- function continuationClose(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("htmlFlowData");
- return continuationAfter(code3);
- }
- effects.consume(code3);
- return continuationClose;
- }
- function continuationAfter(code3) {
- effects.exit("htmlFlow");
- return ok2(code3);
- }
-}
-function tokenizeNonLazyContinuationStart(effects, ok2, nok) {
- const self2 = this;
- return start;
- function start(code3) {
- if (markdownLineEnding(code3)) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return after;
- }
- return nok(code3);
- }
- function after(code3) {
- return self2.parser.lazy[self2.now().line] ? nok(code3) : ok2(code3);
- }
-}
-function tokenizeBlankLineBefore(effects, ok2, nok) {
- return start;
- function start(code3) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return effects.attempt(blankLine, ok2, nok);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/html-text.js
-var htmlText = {
- name: "htmlText",
- tokenize: tokenizeHtmlText
-};
-function tokenizeHtmlText(effects, ok2, nok) {
- const self2 = this;
- let marker;
- let index3;
- let returnState;
- return start;
- function start(code3) {
- effects.enter("htmlText");
- effects.enter("htmlTextData");
- effects.consume(code3);
- return open;
- }
- function open(code3) {
- if (code3 === 33) {
- effects.consume(code3);
- return declarationOpen;
- }
- if (code3 === 47) {
- effects.consume(code3);
- return tagCloseStart;
- }
- if (code3 === 63) {
- effects.consume(code3);
- return instruction;
- }
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- return tagOpen;
- }
- return nok(code3);
- }
- function declarationOpen(code3) {
- if (code3 === 45) {
- effects.consume(code3);
- return commentOpenInside;
- }
- if (code3 === 91) {
- effects.consume(code3);
- index3 = 0;
- return cdataOpenInside;
- }
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- return declaration;
- }
- return nok(code3);
- }
- function commentOpenInside(code3) {
- if (code3 === 45) {
- effects.consume(code3);
- return commentEnd;
- }
- return nok(code3);
- }
- function comment4(code3) {
- if (code3 === null) {
- return nok(code3);
- }
- if (code3 === 45) {
- effects.consume(code3);
- return commentClose;
- }
- if (markdownLineEnding(code3)) {
- returnState = comment4;
- return lineEndingBefore(code3);
- }
- effects.consume(code3);
- return comment4;
- }
- function commentClose(code3) {
- if (code3 === 45) {
- effects.consume(code3);
- return commentEnd;
- }
- return comment4(code3);
- }
- function commentEnd(code3) {
- return code3 === 62 ? end(code3) : code3 === 45 ? commentClose(code3) : comment4(code3);
- }
- function cdataOpenInside(code3) {
- const value = "CDATA[";
- if (code3 === value.charCodeAt(index3++)) {
- effects.consume(code3);
- return index3 === value.length ? cdata : cdataOpenInside;
- }
- return nok(code3);
- }
- function cdata(code3) {
- if (code3 === null) {
- return nok(code3);
- }
- if (code3 === 93) {
- effects.consume(code3);
- return cdataClose;
- }
- if (markdownLineEnding(code3)) {
- returnState = cdata;
- return lineEndingBefore(code3);
- }
- effects.consume(code3);
- return cdata;
- }
- function cdataClose(code3) {
- if (code3 === 93) {
- effects.consume(code3);
- return cdataEnd;
- }
- return cdata(code3);
- }
- function cdataEnd(code3) {
- if (code3 === 62) {
- return end(code3);
- }
- if (code3 === 93) {
- effects.consume(code3);
- return cdataEnd;
- }
- return cdata(code3);
- }
- function declaration(code3) {
- if (code3 === null || code3 === 62) {
- return end(code3);
- }
- if (markdownLineEnding(code3)) {
- returnState = declaration;
- return lineEndingBefore(code3);
- }
- effects.consume(code3);
- return declaration;
- }
- function instruction(code3) {
- if (code3 === null) {
- return nok(code3);
- }
- if (code3 === 63) {
- effects.consume(code3);
- return instructionClose;
- }
- if (markdownLineEnding(code3)) {
- returnState = instruction;
- return lineEndingBefore(code3);
- }
- effects.consume(code3);
- return instruction;
- }
- function instructionClose(code3) {
- return code3 === 62 ? end(code3) : instruction(code3);
- }
- function tagCloseStart(code3) {
- if (asciiAlpha(code3)) {
- effects.consume(code3);
- return tagClose;
- }
- return nok(code3);
- }
- function tagClose(code3) {
- if (code3 === 45 || asciiAlphanumeric(code3)) {
- effects.consume(code3);
- return tagClose;
- }
- return tagCloseBetween(code3);
- }
- function tagCloseBetween(code3) {
- if (markdownLineEnding(code3)) {
- returnState = tagCloseBetween;
- return lineEndingBefore(code3);
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return tagCloseBetween;
- }
- return end(code3);
- }
- function tagOpen(code3) {
- if (code3 === 45 || asciiAlphanumeric(code3)) {
- effects.consume(code3);
- return tagOpen;
- }
- if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) {
- return tagOpenBetween(code3);
- }
- return nok(code3);
- }
- function tagOpenBetween(code3) {
- if (code3 === 47) {
- effects.consume(code3);
- return end;
- }
- if (code3 === 58 || code3 === 95 || asciiAlpha(code3)) {
- effects.consume(code3);
- return tagOpenAttributeName;
- }
- if (markdownLineEnding(code3)) {
- returnState = tagOpenBetween;
- return lineEndingBefore(code3);
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return tagOpenBetween;
- }
- return end(code3);
- }
- function tagOpenAttributeName(code3) {
- if (code3 === 45 || code3 === 46 || code3 === 58 || code3 === 95 || asciiAlphanumeric(code3)) {
- effects.consume(code3);
- return tagOpenAttributeName;
- }
- return tagOpenAttributeNameAfter(code3);
- }
- function tagOpenAttributeNameAfter(code3) {
- if (code3 === 61) {
- effects.consume(code3);
- return tagOpenAttributeValueBefore;
- }
- if (markdownLineEnding(code3)) {
- returnState = tagOpenAttributeNameAfter;
- return lineEndingBefore(code3);
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return tagOpenAttributeNameAfter;
- }
- return tagOpenBetween(code3);
- }
- function tagOpenAttributeValueBefore(code3) {
- if (code3 === null || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96) {
- return nok(code3);
- }
- if (code3 === 34 || code3 === 39) {
- effects.consume(code3);
- marker = code3;
- return tagOpenAttributeValueQuoted;
- }
- if (markdownLineEnding(code3)) {
- returnState = tagOpenAttributeValueBefore;
- return lineEndingBefore(code3);
- }
- if (markdownSpace(code3)) {
- effects.consume(code3);
- return tagOpenAttributeValueBefore;
- }
- effects.consume(code3);
- return tagOpenAttributeValueUnquoted;
- }
- function tagOpenAttributeValueQuoted(code3) {
- if (code3 === marker) {
- effects.consume(code3);
- marker = void 0;
- return tagOpenAttributeValueQuotedAfter;
- }
- if (code3 === null) {
- return nok(code3);
- }
- if (markdownLineEnding(code3)) {
- returnState = tagOpenAttributeValueQuoted;
- return lineEndingBefore(code3);
- }
- effects.consume(code3);
- return tagOpenAttributeValueQuoted;
- }
- function tagOpenAttributeValueUnquoted(code3) {
- if (code3 === null || code3 === 34 || code3 === 39 || code3 === 60 || code3 === 61 || code3 === 96) {
- return nok(code3);
- }
- if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) {
- return tagOpenBetween(code3);
- }
- effects.consume(code3);
- return tagOpenAttributeValueUnquoted;
- }
- function tagOpenAttributeValueQuotedAfter(code3) {
- if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) {
- return tagOpenBetween(code3);
- }
- return nok(code3);
- }
- function end(code3) {
- if (code3 === 62) {
- effects.consume(code3);
- effects.exit("htmlTextData");
- effects.exit("htmlText");
- return ok2;
- }
- return nok(code3);
- }
- function lineEndingBefore(code3) {
- effects.exit("htmlTextData");
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return lineEndingAfter;
- }
- function lineEndingAfter(code3) {
- return markdownSpace(code3) ? factorySpace(
- effects,
- lineEndingAfterPrefix,
- "linePrefix",
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
- )(code3) : lineEndingAfterPrefix(code3);
- }
- function lineEndingAfterPrefix(code3) {
- effects.enter("htmlTextData");
- return returnState(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/label-end.js
-var labelEnd = {
- name: "labelEnd",
- tokenize: tokenizeLabelEnd,
- resolveTo: resolveToLabelEnd,
- resolveAll: resolveAllLabelEnd
-};
-var resourceConstruct = {
- tokenize: tokenizeResource
-};
-var referenceFullConstruct = {
- tokenize: tokenizeReferenceFull
-};
-var referenceCollapsedConstruct = {
- tokenize: tokenizeReferenceCollapsed
-};
-function resolveAllLabelEnd(events2) {
- let index3 = -1;
- while (++index3 < events2.length) {
- const token = events2[index3][1];
- if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") {
- events2.splice(index3 + 1, token.type === "labelImage" ? 4 : 2);
- token.type = "data";
- index3++;
- }
- }
- return events2;
-}
-function resolveToLabelEnd(events2, context) {
- let index3 = events2.length;
- let offset2 = 0;
- let token;
- let open;
- let close;
- let media;
- while (index3--) {
- token = events2[index3][1];
- if (open) {
- if (token.type === "link" || token.type === "labelLink" && token._inactive) {
- break;
- }
- if (events2[index3][0] === "enter" && token.type === "labelLink") {
- token._inactive = true;
- }
- } else if (close) {
- if (events2[index3][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) {
- open = index3;
- if (token.type !== "labelLink") {
- offset2 = 2;
- break;
- }
- }
- } else if (token.type === "labelEnd") {
- close = index3;
- }
- }
- const group = {
- type: events2[open][1].type === "labelLink" ? "link" : "image",
- start: Object.assign({}, events2[open][1].start),
- end: Object.assign({}, events2[events2.length - 1][1].end)
- };
- const label = {
- type: "label",
- start: Object.assign({}, events2[open][1].start),
- end: Object.assign({}, events2[close][1].end)
- };
- const text7 = {
- type: "labelText",
- start: Object.assign({}, events2[open + offset2 + 2][1].end),
- end: Object.assign({}, events2[close - 2][1].start)
+var getTooLargeRejectionErr = function getTooLargeRejectionErr2(maxSize) {
+ return {
+ code: FILE_TOO_LARGE,
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
};
- media = [
- ["enter", group, context],
- ["enter", label, context]
- ];
- media = push(media, events2.slice(open + 1, open + offset2 + 3));
- media = push(media, [["enter", text7, context]]);
- media = push(
- media,
- resolveAll(
- context.parser.constructs.insideSpan.null,
- events2.slice(open + offset2 + 4, close - 3),
- context
- )
- );
- media = push(media, [
- ["exit", text7, context],
- events2[close - 2],
- events2[close - 1],
- ["exit", label, context]
- ]);
- media = push(media, events2.slice(close + 1));
- media = push(media, [["exit", group, context]]);
- splice(events2, open, events2.length, media);
- return events2;
-}
-function tokenizeLabelEnd(effects, ok2, nok) {
- const self2 = this;
- let index3 = self2.events.length;
- let labelStart;
- let defined;
- while (index3--) {
- if ((self2.events[index3][1].type === "labelImage" || self2.events[index3][1].type === "labelLink") && !self2.events[index3][1]._balanced) {
- labelStart = self2.events[index3][1];
- break;
- }
- }
- return start;
- function start(code3) {
- if (!labelStart) {
- return nok(code3);
- }
- if (labelStart._inactive) {
- return labelEndNok(code3);
- }
- defined = self2.parser.defined.includes(
- normalizeIdentifier(
- self2.sliceSerialize({
- start: labelStart.end,
- end: self2.now()
- })
- )
- );
- effects.enter("labelEnd");
- effects.enter("labelMarker");
- effects.consume(code3);
- effects.exit("labelMarker");
- effects.exit("labelEnd");
- return after;
- }
- function after(code3) {
- if (code3 === 40) {
- return effects.attempt(
- resourceConstruct,
- labelEndOk,
- defined ? labelEndOk : labelEndNok
- )(code3);
- }
- if (code3 === 91) {
- return effects.attempt(
- referenceFullConstruct,
- labelEndOk,
- defined ? referenceNotFull : labelEndNok
- )(code3);
- }
- return defined ? labelEndOk(code3) : labelEndNok(code3);
- }
- function referenceNotFull(code3) {
- return effects.attempt(
- referenceCollapsedConstruct,
- labelEndOk,
- labelEndNok
- )(code3);
- }
- function labelEndOk(code3) {
- return ok2(code3);
- }
- function labelEndNok(code3) {
- labelStart._balanced = true;
- return nok(code3);
- }
-}
-function tokenizeResource(effects, ok2, nok) {
- return resourceStart;
- function resourceStart(code3) {
- effects.enter("resource");
- effects.enter("resourceMarker");
- effects.consume(code3);
- effects.exit("resourceMarker");
- return resourceBefore;
- }
- function resourceBefore(code3) {
- return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceOpen)(code3) : resourceOpen(code3);
- }
- function resourceOpen(code3) {
- if (code3 === 41) {
- return resourceEnd(code3);
- }
- return factoryDestination(
- effects,
- resourceDestinationAfter,
- resourceDestinationMissing,
- "resourceDestination",
- "resourceDestinationLiteral",
- "resourceDestinationLiteralMarker",
- "resourceDestinationRaw",
- "resourceDestinationString",
- 32
- )(code3);
- }
- function resourceDestinationAfter(code3) {
- return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceBetween)(code3) : resourceEnd(code3);
- }
- function resourceDestinationMissing(code3) {
- return nok(code3);
- }
- function resourceBetween(code3) {
- if (code3 === 34 || code3 === 39 || code3 === 40) {
- return factoryTitle(
- effects,
- resourceTitleAfter,
- nok,
- "resourceTitle",
- "resourceTitleMarker",
- "resourceTitleString"
- )(code3);
- }
- return resourceEnd(code3);
- }
- function resourceTitleAfter(code3) {
- return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceEnd)(code3) : resourceEnd(code3);
- }
- function resourceEnd(code3) {
- if (code3 === 41) {
- effects.enter("resourceMarker");
- effects.consume(code3);
- effects.exit("resourceMarker");
- effects.exit("resource");
- return ok2;
- }
- return nok(code3);
- }
-}
-function tokenizeReferenceFull(effects, ok2, nok) {
- const self2 = this;
- return referenceFull;
- function referenceFull(code3) {
- return factoryLabel.call(
- self2,
- effects,
- referenceFullAfter,
- referenceFullMissing,
- "reference",
- "referenceMarker",
- "referenceString"
- )(code3);
- }
- function referenceFullAfter(code3) {
- return self2.parser.defined.includes(
- normalizeIdentifier(
- self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)
- )
- ) ? ok2(code3) : nok(code3);
- }
- function referenceFullMissing(code3) {
- return nok(code3);
- }
-}
-function tokenizeReferenceCollapsed(effects, ok2, nok) {
- return referenceCollapsedStart;
- function referenceCollapsedStart(code3) {
- effects.enter("reference");
- effects.enter("referenceMarker");
- effects.consume(code3);
- effects.exit("referenceMarker");
- return referenceCollapsedOpen;
- }
- function referenceCollapsedOpen(code3) {
- if (code3 === 93) {
- effects.enter("referenceMarker");
- effects.consume(code3);
- effects.exit("referenceMarker");
- effects.exit("reference");
- return ok2;
- }
- return nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/label-start-image.js
-var labelStartImage = {
- name: "labelStartImage",
- tokenize: tokenizeLabelStartImage,
- resolveAll: labelEnd.resolveAll
-};
-function tokenizeLabelStartImage(effects, ok2, nok) {
- const self2 = this;
- return start;
- function start(code3) {
- effects.enter("labelImage");
- effects.enter("labelImageMarker");
- effects.consume(code3);
- effects.exit("labelImageMarker");
- return open;
- }
- function open(code3) {
- if (code3 === 91) {
- effects.enter("labelMarker");
- effects.consume(code3);
- effects.exit("labelMarker");
- effects.exit("labelImage");
- return after;
- }
- return nok(code3);
- }
- function after(code3) {
- return code3 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code3) : ok2(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/label-start-link.js
-var labelStartLink = {
- name: "labelStartLink",
- tokenize: tokenizeLabelStartLink,
- resolveAll: labelEnd.resolveAll
-};
-function tokenizeLabelStartLink(effects, ok2, nok) {
- const self2 = this;
- return start;
- function start(code3) {
- effects.enter("labelLink");
- effects.enter("labelMarker");
- effects.consume(code3);
- effects.exit("labelMarker");
- effects.exit("labelLink");
- return after;
- }
- function after(code3) {
- return code3 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code3) : ok2(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/line-ending.js
-var lineEnding = {
- name: "lineEnding",
- tokenize: tokenizeLineEnding
-};
-function tokenizeLineEnding(effects, ok2) {
- return start;
- function start(code3) {
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- return factorySpace(effects, ok2, "linePrefix");
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/thematic-break.js
-var thematicBreak = {
- name: "thematicBreak",
- tokenize: tokenizeThematicBreak
-};
-function tokenizeThematicBreak(effects, ok2, nok) {
- let size2 = 0;
- let marker;
- return start;
- function start(code3) {
- effects.enter("thematicBreak");
- return before(code3);
- }
- function before(code3) {
- marker = code3;
- return atBreak(code3);
- }
- function atBreak(code3) {
- if (code3 === marker) {
- effects.enter("thematicBreakSequence");
- return sequence(code3);
- }
- if (size2 >= 3 && (code3 === null || markdownLineEnding(code3))) {
- effects.exit("thematicBreak");
- return ok2(code3);
- }
- return nok(code3);
- }
- function sequence(code3) {
- if (code3 === marker) {
- effects.consume(code3);
- size2++;
- return sequence;
- }
- effects.exit("thematicBreakSequence");
- return markdownSpace(code3) ? factorySpace(effects, atBreak, "whitespace")(code3) : atBreak(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/list.js
-var list = {
- name: "list",
- tokenize: tokenizeListStart,
- continuation: {
- tokenize: tokenizeListContinuation
- },
- exit: tokenizeListEnd
-};
-var listItemPrefixWhitespaceConstruct = {
- tokenize: tokenizeListItemPrefixWhitespace,
- partial: true
-};
-var indentConstruct = {
- tokenize: tokenizeIndent,
- partial: true
};
-function tokenizeListStart(effects, ok2, nok) {
- const self2 = this;
- const tail = self2.events[self2.events.length - 1];
- let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
- let size2 = 0;
- return start;
- function start(code3) {
- const kind = self2.containerState.type || (code3 === 42 || code3 === 43 || code3 === 45 ? "listUnordered" : "listOrdered");
- if (kind === "listUnordered" ? !self2.containerState.marker || code3 === self2.containerState.marker : asciiDigit(code3)) {
- if (!self2.containerState.type) {
- self2.containerState.type = kind;
- effects.enter(kind, {
- _container: true
- });
- }
- if (kind === "listUnordered") {
- effects.enter("listItemPrefix");
- return code3 === 42 || code3 === 45 ? effects.check(thematicBreak, nok, atMarker)(code3) : atMarker(code3);
- }
- if (!self2.interrupt || code3 === 49) {
- effects.enter("listItemPrefix");
- effects.enter("listItemValue");
- return inside(code3);
- }
- }
- return nok(code3);
- }
- function inside(code3) {
- if (asciiDigit(code3) && ++size2 < 10) {
- effects.consume(code3);
- return inside;
- }
- if ((!self2.interrupt || size2 < 2) && (self2.containerState.marker ? code3 === self2.containerState.marker : code3 === 41 || code3 === 46)) {
- effects.exit("listItemValue");
- return atMarker(code3);
- }
- return nok(code3);
- }
- function atMarker(code3) {
- effects.enter("listItemMarker");
- effects.consume(code3);
- effects.exit("listItemMarker");
- self2.containerState.marker = self2.containerState.marker || code3;
- return effects.check(
- blankLine,
- self2.interrupt ? nok : onBlank,
- effects.attempt(
- listItemPrefixWhitespaceConstruct,
- endOfPrefix,
- otherPrefix
- )
- );
- }
- function onBlank(code3) {
- self2.containerState.initialBlankLine = true;
- initialSize++;
- return endOfPrefix(code3);
- }
- function otherPrefix(code3) {
- if (markdownSpace(code3)) {
- effects.enter("listItemPrefixWhitespace");
- effects.consume(code3);
- effects.exit("listItemPrefixWhitespace");
- return endOfPrefix;
- }
- return nok(code3);
- }
- function endOfPrefix(code3) {
- self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit("listItemPrefix"), true).length;
- return ok2(code3);
- }
-}
-function tokenizeListContinuation(effects, ok2, nok) {
- const self2 = this;
- self2.containerState._closeFlow = void 0;
- return effects.check(blankLine, onBlank, notBlank);
- function onBlank(code3) {
- self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine;
- return factorySpace(
- effects,
- ok2,
- "listItemIndent",
- self2.containerState.size + 1
- )(code3);
- }
- function notBlank(code3) {
- if (self2.containerState.furtherBlankLines || !markdownSpace(code3)) {
- self2.containerState.furtherBlankLines = void 0;
- self2.containerState.initialBlankLine = void 0;
- return notInCurrentItem(code3);
- }
- self2.containerState.furtherBlankLines = void 0;
- self2.containerState.initialBlankLine = void 0;
- return effects.attempt(indentConstruct, ok2, notInCurrentItem)(code3);
- }
- function notInCurrentItem(code3) {
- self2.containerState._closeFlow = true;
- self2.interrupt = void 0;
- return factorySpace(
- effects,
- effects.attempt(list, ok2, nok),
- "linePrefix",
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
- )(code3);
- }
-}
-function tokenizeIndent(effects, ok2, nok) {
- const self2 = this;
- return factorySpace(
- effects,
- afterPrefix,
- "listItemIndent",
- self2.containerState.size + 1
- );
- function afterPrefix(code3) {
- const tail = self2.events[self2.events.length - 1];
- return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code3) : nok(code3);
- }
-}
-function tokenizeListEnd(effects) {
- effects.exit(this.containerState.type);
-}
-function tokenizeListItemPrefixWhitespace(effects, ok2, nok) {
- const self2 = this;
- return factorySpace(
- effects,
- afterPrefix,
- "listItemPrefixWhitespace",
- self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1
- );
- function afterPrefix(code3) {
- const tail = self2.events[self2.events.length - 1];
- return !markdownSpace(code3) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok2(code3) : nok(code3);
- }
-}
-
-// node_modules/micromark-core-commonmark/lib/setext-underline.js
-var setextUnderline = {
- name: "setextUnderline",
- tokenize: tokenizeSetextUnderline,
- resolveTo: resolveToSetextUnderline
-};
-function resolveToSetextUnderline(events2, context) {
- let index3 = events2.length;
- let content5;
- let text7;
- let definition3;
- while (index3--) {
- if (events2[index3][0] === "enter") {
- if (events2[index3][1].type === "content") {
- content5 = index3;
- break;
- }
- if (events2[index3][1].type === "paragraph") {
- text7 = index3;
- }
- } else {
- if (events2[index3][1].type === "content") {
- events2.splice(index3, 1);
- }
- if (!definition3 && events2[index3][1].type === "definition") {
- definition3 = index3;
- }
- }
- }
- const heading5 = {
- type: "setextHeading",
- start: Object.assign({}, events2[text7][1].start),
- end: Object.assign({}, events2[events2.length - 1][1].end)
+var getTooSmallRejectionErr = function getTooSmallRejectionErr2(minSize) {
+ return {
+ code: FILE_TOO_SMALL,
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
};
- events2[text7][1].type = "setextHeadingText";
- if (definition3) {
- events2.splice(text7, 0, ["enter", heading5, context]);
- events2.splice(definition3 + 1, 0, ["exit", events2[content5][1], context]);
- events2[content5][1].end = Object.assign({}, events2[definition3][1].end);
- } else {
- events2[content5][1] = heading5;
- }
- events2.push(["exit", heading5, context]);
- return events2;
-}
-function tokenizeSetextUnderline(effects, ok2, nok) {
- const self2 = this;
- let marker;
- return start;
- function start(code3) {
- let index3 = self2.events.length;
- let paragraph3;
- while (index3--) {
- if (self2.events[index3][1].type !== "lineEnding" && self2.events[index3][1].type !== "linePrefix" && self2.events[index3][1].type !== "content") {
- paragraph3 = self2.events[index3][1].type === "paragraph";
- break;
- }
- }
- if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph3)) {
- effects.enter("setextHeadingLine");
- marker = code3;
- return before(code3);
- }
- return nok(code3);
- }
- function before(code3) {
- effects.enter("setextHeadingLineSequence");
- return inside(code3);
- }
- function inside(code3) {
- if (code3 === marker) {
- effects.consume(code3);
- return inside;
- }
- effects.exit("setextHeadingLineSequence");
- return markdownSpace(code3) ? factorySpace(effects, after, "lineSuffix")(code3) : after(code3);
- }
- function after(code3) {
- if (code3 === null || markdownLineEnding(code3)) {
- effects.exit("setextHeadingLine");
- return ok2(code3);
- }
- return nok(code3);
- }
-}
-
-// node_modules/micromark/lib/initialize/flow.js
-var flow = {
- tokenize: initializeFlow
};
-function initializeFlow(effects) {
- const self2 = this;
- const initial = effects.attempt(
- blankLine,
- atBlankEnding,
- effects.attempt(
- this.parser.constructs.flowInitial,
- afterConstruct,
- factorySpace(
- effects,
- effects.attempt(
- this.parser.constructs.flow,
- afterConstruct,
- effects.attempt(content4, afterConstruct)
- ),
- "linePrefix"
- )
- )
- );
- return initial;
- function atBlankEnding(code3) {
- if (code3 === null) {
- effects.consume(code3);
- return;
- }
- effects.enter("lineEndingBlank");
- effects.consume(code3);
- effects.exit("lineEndingBlank");
- self2.currentConstruct = void 0;
- return initial;
- }
- function afterConstruct(code3) {
- if (code3 === null) {
- effects.consume(code3);
- return;
- }
- effects.enter("lineEnding");
- effects.consume(code3);
- effects.exit("lineEnding");
- self2.currentConstruct = void 0;
- return initial;
- }
-}
-
-// node_modules/micromark/lib/initialize/text.js
-var resolver = {
- resolveAll: createResolver()
+var TOO_MANY_FILES_REJECTION = {
+ code: TOO_MANY_FILES,
+ message: "Too many files"
};
-var string4 = initializeFactory("string");
-var text2 = initializeFactory("text");
-function initializeFactory(field) {
- return {
- tokenize: initializeText,
- resolveAll: createResolver(
- field === "text" ? resolveAllLineSuffixes : void 0
- )
- };
- function initializeText(effects) {
- const self2 = this;
- const constructs2 = this.parser.constructs[field];
- const text7 = effects.attempt(constructs2, start, notText);
- return start;
- function start(code3) {
- return atBreak(code3) ? text7(code3) : notText(code3);
- }
- function notText(code3) {
- if (code3 === null) {
- effects.consume(code3);
- return;
- }
- effects.enter("data");
- effects.consume(code3);
- return data3;
- }
- function data3(code3) {
- if (atBreak(code3)) {
- effects.exit("data");
- return text7(code3);
- }
- effects.consume(code3);
- return data3;
- }
- function atBreak(code3) {
- if (code3 === null) {
- return true;
- }
- const list4 = constructs2[code3];
- let index3 = -1;
- if (list4) {
- while (++index3 < list4.length) {
- const item = list4[index3];
- if (!item.previous || item.previous.call(self2, self2.previous)) {
- return true;
- }
- }
- }
- return false;
- }
- }
+function fileAccepted(file, accept) {
+ var isAcceptable = file.type === "application/x-moz-file" || (0, import_attr_accept.default)(file, accept);
+ return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
}
-function createResolver(extraResolver) {
- return resolveAllText;
- function resolveAllText(events2, context) {
- let index3 = -1;
- let enter;
- while (++index3 <= events2.length) {
- if (enter === void 0) {
- if (events2[index3] && events2[index3][1].type === "data") {
- enter = index3;
- index3++;
- }
- } else if (!events2[index3] || events2[index3][1].type !== "data") {
- if (index3 !== enter + 2) {
- events2[enter][1].end = events2[index3 - 1][1].end;
- events2.splice(enter + 2, index3 - enter - 2);
- index3 = enter + 2;
- }
- enter = void 0;
- }
- }
- return extraResolver ? extraResolver(events2, context) : events2;
- }
-}
-function resolveAllLineSuffixes(events2, context) {
- let eventIndex = 0;
- while (++eventIndex <= events2.length) {
- if ((eventIndex === events2.length || events2[eventIndex][1].type === "lineEnding") && events2[eventIndex - 1][1].type === "data") {
- const data3 = events2[eventIndex - 1][1];
- const chunks = context.sliceStream(data3);
- let index3 = chunks.length;
- let bufferIndex = -1;
- let size2 = 0;
- let tabs;
- while (index3--) {
- const chunk = chunks[index3];
- if (typeof chunk === "string") {
- bufferIndex = chunk.length;
- while (chunk.charCodeAt(bufferIndex - 1) === 32) {
- size2++;
- bufferIndex--;
- }
- if (bufferIndex)
- break;
- bufferIndex = -1;
- } else if (chunk === -2) {
- tabs = true;
- size2++;
- } else if (chunk === -1) {
- } else {
- index3++;
- break;
- }
- }
- if (size2) {
- const token = {
- type: eventIndex === events2.length || tabs || size2 < 2 ? "lineSuffix" : "hardBreakTrailing",
- start: {
- line: data3.end.line,
- column: data3.end.column - size2,
- offset: data3.end.offset - size2,
- _index: data3.start._index + index3,
- _bufferIndex: index3 ? bufferIndex : data3.start._bufferIndex + bufferIndex
- },
- end: Object.assign({}, data3.end)
- };
- data3.end = Object.assign({}, token.start);
- if (data3.start.offset === data3.end.offset) {
- Object.assign(data3, token);
- } else {
- events2.splice(
- eventIndex,
- 0,
- ["enter", token, context],
- ["exit", token, context]
- );
- eventIndex += 2;
- }
- }
- eventIndex++;
- }
+function fileMatchSize(file, minSize, maxSize) {
+ if (isDefined2(file.size)) {
+ if (isDefined2(minSize) && isDefined2(maxSize)) {
+ if (file.size > maxSize)
+ return [false, getTooLargeRejectionErr(maxSize)];
+ if (file.size < minSize)
+ return [false, getTooSmallRejectionErr(minSize)];
+ } else if (isDefined2(minSize) && file.size < minSize)
+ return [false, getTooSmallRejectionErr(minSize)];
+ else if (isDefined2(maxSize) && file.size > maxSize)
+ return [false, getTooLargeRejectionErr(maxSize)];
}
- return events2;
+ return [true, null];
}
-
-// node_modules/micromark/lib/create-tokenizer.js
-function createTokenizer(parser3, initialize, from) {
- let point4 = Object.assign(
- from ? Object.assign({}, from) : {
- line: 1,
- column: 1,
- offset: 0
- },
- {
- _index: 0,
- _bufferIndex: -1
- }
- );
- const columnStart = {};
- const resolveAllConstructs = [];
- let chunks = [];
- let stack = [];
- let consumed = true;
- const effects = {
- consume,
- enter,
- exit: exit2,
- attempt: constructFactory(onsuccessfulconstruct),
- check: constructFactory(onsuccessfulcheck),
- interrupt: constructFactory(onsuccessfulcheck, {
- interrupt: true
- })
- };
- const context = {
- previous: null,
- code: null,
- containerState: {},
- events: [],
- parser: parser3,
- sliceStream,
- sliceSerialize,
- now,
- defineSkip,
- write
- };
- let state = initialize.tokenize.call(context, effects);
- let expectedCode;
- if (initialize.resolveAll) {
- resolveAllConstructs.push(initialize);
- }
- return context;
- function write(slice) {
- chunks = push(chunks, slice);
- main();
- if (chunks[chunks.length - 1] !== null) {
- return [];
- }
- addResult(initialize, 0);
- context.events = resolveAll(resolveAllConstructs, context.events, context);
- return context.events;
- }
- function sliceSerialize(token, expandTabs) {
- return serializeChunks(sliceStream(token), expandTabs);
- }
- function sliceStream(token) {
- return sliceChunks(chunks, token);
- }
- function now() {
- const { line, column: column2, offset: offset2, _index, _bufferIndex } = point4;
- return {
- line,
- column: column2,
- offset: offset2,
- _index,
- _bufferIndex
- };
- }
- function defineSkip(value) {
- columnStart[value.line] = value.column;
- accountForPotentialSkip();
- }
- function main() {
- let chunkIndex;
- while (point4._index < chunks.length) {
- const chunk = chunks[point4._index];
- if (typeof chunk === "string") {
- chunkIndex = point4._index;
- if (point4._bufferIndex < 0) {
- point4._bufferIndex = 0;
- }
- while (point4._index === chunkIndex && point4._bufferIndex < chunk.length) {
- go(chunk.charCodeAt(point4._bufferIndex));
- }
- } else {
- go(chunk);
- }
- }
- }
- function go(code3) {
- consumed = void 0;
- expectedCode = code3;
- state = state(code3);
- }
- function consume(code3) {
- if (markdownLineEnding(code3)) {
- point4.line++;
- point4.column = 1;
- point4.offset += code3 === -3 ? 2 : 1;
- accountForPotentialSkip();
- } else if (code3 !== -1) {
- point4.column++;
- point4.offset++;
- }
- if (point4._bufferIndex < 0) {
- point4._index++;
- } else {
- point4._bufferIndex++;
- if (point4._bufferIndex === chunks[point4._index].length) {
- point4._bufferIndex = -1;
- point4._index++;
- }
- }
- context.previous = code3;
- consumed = true;
- }
- function enter(type, fields) {
- const token = fields || {};
- token.type = type;
- token.start = now();
- context.events.push(["enter", token, context]);
- stack.push(token);
- return token;
- }
- function exit2(type) {
- const token = stack.pop();
- token.end = now();
- context.events.push(["exit", token, context]);
- return token;
- }
- function onsuccessfulconstruct(construct, info) {
- addResult(construct, info.from);
- }
- function onsuccessfulcheck(_15, info) {
- info.restore();
- }
- function constructFactory(onreturn, fields) {
- return hook;
- function hook(constructs2, returnState, bogusState) {
- let listOfConstructs;
- let constructIndex;
- let currentConstruct;
- let info;
- return Array.isArray(constructs2) ? handleListOfConstructs(constructs2) : "tokenize" in constructs2 ? handleListOfConstructs([constructs2]) : handleMapOfConstructs(constructs2);
- function handleMapOfConstructs(map6) {
- return start;
- function start(code3) {
- const def = code3 !== null && map6[code3];
- const all6 = code3 !== null && map6.null;
- const list4 = [
- ...Array.isArray(def) ? def : def ? [def] : [],
- ...Array.isArray(all6) ? all6 : all6 ? [all6] : []
- ];
- return handleListOfConstructs(list4)(code3);
- }
- }
- function handleListOfConstructs(list4) {
- listOfConstructs = list4;
- constructIndex = 0;
- if (list4.length === 0) {
- return bogusState;
- }
- return handleConstruct(list4[constructIndex]);
- }
- function handleConstruct(construct) {
- return start;
- function start(code3) {
- info = store();
- currentConstruct = construct;
- if (!construct.partial) {
- context.currentConstruct = construct;
- }
- if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
- return nok(code3);
- }
- return construct.tokenize.call(
- fields ? Object.assign(Object.create(context), fields) : context,
- effects,
- ok2,
- nok
- )(code3);
- }
- }
- function ok2(code3) {
- consumed = true;
- onreturn(currentConstruct, info);
- return returnState;
- }
- function nok(code3) {
- consumed = true;
- info.restore();
- if (++constructIndex < listOfConstructs.length) {
- return handleConstruct(listOfConstructs[constructIndex]);
- }
- return bogusState;
- }
- }
- }
- function addResult(construct, from2) {
- if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
- resolveAllConstructs.push(construct);
- }
- if (construct.resolve) {
- splice(
- context.events,
- from2,
- context.events.length - from2,
- construct.resolve(context.events.slice(from2), context)
- );
- }
- if (construct.resolveTo) {
- context.events = construct.resolveTo(context.events, context);
- }
- }
- function store() {
- const startPoint = now();
- const startPrevious = context.previous;
- const startCurrentConstruct = context.currentConstruct;
- const startEventsIndex = context.events.length;
- const startStack = Array.from(stack);
- return {
- restore,
- from: startEventsIndex
- };
- function restore() {
- point4 = startPoint;
- context.previous = startPrevious;
- context.currentConstruct = startCurrentConstruct;
- context.events.length = startEventsIndex;
- stack = startStack;
- accountForPotentialSkip();
- }
- }
- function accountForPotentialSkip() {
- if (point4.line in columnStart && point4.column < 2) {
- point4.column = columnStart[point4.line];
- point4.offset += columnStart[point4.line] - 1;
- }
- }
+function isDefined2(value) {
+ return value !== void 0 && value !== null;
}
-function sliceChunks(chunks, token) {
- const startIndex = token.start._index;
- const startBufferIndex = token.start._bufferIndex;
- const endIndex = token.end._index;
- const endBufferIndex = token.end._bufferIndex;
- let view;
- if (startIndex === endIndex) {
- view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
- } else {
- view = chunks.slice(startIndex, endIndex);
- if (startBufferIndex > -1) {
- const head2 = view[0];
- if (typeof head2 === "string") {
- view[0] = head2.slice(startBufferIndex);
- } else {
- view.shift();
- }
- }
- if (endBufferIndex > 0) {
- view.push(chunks[endIndex].slice(0, endBufferIndex));
- }
+function allFilesAccepted(_ref) {
+ var files = _ref.files, accept = _ref.accept, minSize = _ref.minSize, maxSize = _ref.maxSize, multiple = _ref.multiple, maxFiles = _ref.maxFiles, validator = _ref.validator;
+ if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
+ return false;
}
- return view;
+ return files.every(function(file) {
+ var _fileAccepted = fileAccepted(file, accept), _fileAccepted2 = _slicedToArray(_fileAccepted, 1), accepted = _fileAccepted2[0];
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray(_fileMatchSize, 1), sizeMatch = _fileMatchSize2[0];
+ var customErrors = validator ? validator(file) : null;
+ return accepted && sizeMatch && !customErrors;
+ });
}
-function serializeChunks(chunks, expandTabs) {
- let index3 = -1;
- const result = [];
- let atTab;
- while (++index3 < chunks.length) {
- const chunk = chunks[index3];
- let value;
- if (typeof chunk === "string") {
- value = chunk;
- } else
- switch (chunk) {
- case -5: {
- value = "\r";
- break;
- }
- case -4: {
- value = "\n";
- break;
- }
- case -3: {
- value = "\r\n";
- break;
- }
- case -2: {
- value = expandTabs ? " " : " ";
- break;
- }
- case -1: {
- if (!expandTabs && atTab)
- continue;
- value = " ";
- break;
- }
- default: {
- value = String.fromCharCode(chunk);
- }
- }
- atTab = chunk === -2;
- result.push(value);
- }
- return result.join("");
-}
-
-// node_modules/micromark/lib/constructs.js
-var constructs_exports = {};
-__export(constructs_exports, {
- attentionMarkers: () => attentionMarkers,
- contentInitial: () => contentInitial,
- disable: () => disable,
- document: () => document3,
- flow: () => flow2,
- flowInitial: () => flowInitial,
- insideSpan: () => insideSpan,
- string: () => string5,
- text: () => text3
-});
-var document3 = {
- [42]: list,
- [43]: list,
- [45]: list,
- [48]: list,
- [49]: list,
- [50]: list,
- [51]: list,
- [52]: list,
- [53]: list,
- [54]: list,
- [55]: list,
- [56]: list,
- [57]: list,
- [62]: blockQuote
-};
-var contentInitial = {
- [91]: definition
-};
-var flowInitial = {
- [-2]: codeIndented,
- [-1]: codeIndented,
- [32]: codeIndented
-};
-var flow2 = {
- [35]: headingAtx,
- [42]: thematicBreak,
- [45]: [setextUnderline, thematicBreak],
- [60]: htmlFlow,
- [61]: setextUnderline,
- [95]: thematicBreak,
- [96]: codeFenced,
- [126]: codeFenced
-};
-var string5 = {
- [38]: characterReference,
- [92]: characterEscape
-};
-var text3 = {
- [-5]: lineEnding,
- [-4]: lineEnding,
- [-3]: lineEnding,
- [33]: labelStartImage,
- [38]: characterReference,
- [42]: attention,
- [60]: [autolink, htmlText],
- [91]: labelStartLink,
- [92]: [hardBreakEscape, characterEscape],
- [93]: labelEnd,
- [95]: attention,
- [96]: codeText
-};
-var insideSpan = {
- null: [attention, resolver]
-};
-var attentionMarkers = {
- null: [42, 95]
-};
-var disable = {
- null: []
-};
-
-// node_modules/micromark/lib/parse.js
-function parse7(options) {
- const settings = options || {};
- const constructs2 = combineExtensions([constructs_exports, ...settings.extensions || []]);
- const parser3 = {
- defined: [],
- lazy: {},
- constructs: constructs2,
- content: create3(content3),
- document: create3(document2),
- flow: create3(flow),
- string: create3(string4),
- text: create3(text2)
- };
- return parser3;
- function create3(initial) {
- return creator;
- function creator(from) {
- return createTokenizer(parser3, initial, from);
- }
- }
-}
-
-// node_modules/micromark/lib/preprocess.js
-var search2 = /[\0\t\n\r]/g;
-function preprocess() {
- let column2 = 1;
- let buffer2 = "";
- let start = true;
- let atCarriageReturn;
- return preprocessor;
- function preprocessor(value, encoding, end) {
- const chunks = [];
- let match2;
- let next;
- let startPosition;
- let endPosition;
- let code3;
- value = buffer2 + value.toString(encoding);
- startPosition = 0;
- buffer2 = "";
- if (start) {
- if (value.charCodeAt(0) === 65279) {
- startPosition++;
- }
- start = void 0;
- }
- while (startPosition < value.length) {
- search2.lastIndex = startPosition;
- match2 = search2.exec(value);
- endPosition = match2 && match2.index !== void 0 ? match2.index : value.length;
- code3 = value.charCodeAt(endPosition);
- if (!match2) {
- buffer2 = value.slice(startPosition);
- break;
- }
- if (code3 === 10 && startPosition === endPosition && atCarriageReturn) {
- chunks.push(-3);
- atCarriageReturn = void 0;
- } else {
- if (atCarriageReturn) {
- chunks.push(-5);
- atCarriageReturn = void 0;
- }
- if (startPosition < endPosition) {
- chunks.push(value.slice(startPosition, endPosition));
- column2 += endPosition - startPosition;
- }
- switch (code3) {
- case 0: {
- chunks.push(65533);
- column2++;
- break;
- }
- case 9: {
- next = Math.ceil(column2 / 4) * 4;
- chunks.push(-2);
- while (column2++ < next)
- chunks.push(-1);
- break;
- }
- case 10: {
- chunks.push(-4);
- column2 = 1;
- break;
- }
- default: {
- atCarriageReturn = true;
- column2 = 1;
- }
- }
- }
- startPosition = endPosition + 1;
- }
- if (end) {
- if (atCarriageReturn)
- chunks.push(-5);
- if (buffer2)
- chunks.push(buffer2);
- chunks.push(null);
- }
- return chunks;
+function isPropagationStopped(event) {
+ if (typeof event.isPropagationStopped === "function") {
+ return event.isPropagationStopped();
+ } else if (typeof event.cancelBubble !== "undefined") {
+ return event.cancelBubble;
}
+ return false;
}
-
-// node_modules/micromark/lib/postprocess.js
-function postprocess(events2) {
- while (!subtokenize(events2)) {
+function isEvtWithFiles(event) {
+ if (!event.dataTransfer) {
+ return !!event.target && !!event.target.files;
}
- return events2;
+ return Array.prototype.some.call(event.dataTransfer.types, function(type) {
+ return type === "Files" || type === "application/x-moz-file";
+ });
}
-
-// node_modules/micromark-util-decode-numeric-character-reference/index.js
-function decodeNumericCharacterReference(value, base3) {
- const code3 = Number.parseInt(value, base3);
- if (code3 < 9 || code3 === 11 || code3 > 13 && code3 < 32 || code3 > 126 && code3 < 160 || code3 > 55295 && code3 < 57344 || code3 > 64975 && code3 < 65008 || (code3 & 65535) === 65535 || (code3 & 65535) === 65534 || code3 > 1114111) {
- return "\uFFFD";
- }
- return String.fromCharCode(code3);
+function onDocumentDragOver(event) {
+ event.preventDefault();
}
-
-// node_modules/micromark-util-decode-string/index.js
-var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
-function decodeString(value) {
- return value.replace(characterEscapeOrReference, decode);
+function isIe(userAgent) {
+ return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
}
-function decode($0, $1, $2) {
- if ($1) {
- return $1;
- }
- const head2 = $2.charCodeAt(0);
- if (head2 === 35) {
- const head3 = $2.charCodeAt(1);
- const hex2 = head3 === 120 || head3 === 88;
- return decodeNumericCharacterReference($2.slice(hex2 ? 2 : 1), hex2 ? 16 : 10);
- }
- return decodeNamedCharacterReference($2) || $0;
+function isEdge(userAgent) {
+ return userAgent.indexOf("Edge/") !== -1;
}
-
-// node_modules/mdast-util-from-markdown/lib/index.js
-var own2 = {}.hasOwnProperty;
-var fromMarkdown = function(value, encoding, options) {
- if (typeof encoding !== "string") {
- options = encoding;
- encoding = void 0;
+function isIeOrEdge() {
+ var userAgent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.navigator.userAgent;
+ return isIe(userAgent) || isEdge(userAgent);
+}
+function composeEventHandlers() {
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
+ fns[_key] = arguments[_key];
}
- return compiler(options)(
- postprocess(
- parse7(options).document().write(preprocess()(value, encoding, true))
- )
- );
-};
-function compiler(options) {
- const config4 = {
- transforms: [],
- canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
- enter: {
- autolink: opener(link3),
- autolinkProtocol: onenterdata,
- autolinkEmail: onenterdata,
- atxHeading: opener(heading5),
- blockQuote: opener(blockQuote2),
- characterEscape: onenterdata,
- characterReference: onenterdata,
- codeFenced: opener(codeFlow),
- codeFencedFenceInfo: buffer2,
- codeFencedFenceMeta: buffer2,
- codeIndented: opener(codeFlow, buffer2),
- codeText: opener(codeText2, buffer2),
- codeTextData: onenterdata,
- data: onenterdata,
- codeFlowValue: onenterdata,
- definition: opener(definition3),
- definitionDestinationString: buffer2,
- definitionLabelString: buffer2,
- definitionTitleString: buffer2,
- emphasis: opener(emphasis3),
- hardBreakEscape: opener(hardBreak3),
- hardBreakTrailing: opener(hardBreak3),
- htmlFlow: opener(html7, buffer2),
- htmlFlowData: onenterdata,
- htmlText: opener(html7, buffer2),
- htmlTextData: onenterdata,
- image: opener(image3),
- label: buffer2,
- link: opener(link3),
- listItem: opener(listItem4),
- listItemValue: onenterlistitemvalue,
- listOrdered: opener(list4, onenterlistordered),
- listUnordered: opener(list4),
- paragraph: opener(paragraph3),
- reference: onenterreference,
- referenceString: buffer2,
- resourceDestinationString: buffer2,
- resourceTitleString: buffer2,
- setextHeading: opener(heading5),
- strong: opener(strong3),
- thematicBreak: opener(thematicBreak4)
- },
- exit: {
- atxHeading: closer(),
- atxHeadingSequence: onexitatxheadingsequence,
- autolink: closer(),
- autolinkEmail: onexitautolinkemail,
- autolinkProtocol: onexitautolinkprotocol,
- blockQuote: closer(),
- characterEscapeValue: onexitdata,
- characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
- characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
- characterReferenceValue: onexitcharacterreferencevalue,
- codeFenced: closer(onexitcodefenced),
- codeFencedFence: onexitcodefencedfence,
- codeFencedFenceInfo: onexitcodefencedfenceinfo,
- codeFencedFenceMeta: onexitcodefencedfencemeta,
- codeFlowValue: onexitdata,
- codeIndented: closer(onexitcodeindented),
- codeText: closer(onexitcodetext),
- codeTextData: onexitdata,
- data: onexitdata,
- definition: closer(),
- definitionDestinationString: onexitdefinitiondestinationstring,
- definitionLabelString: onexitdefinitionlabelstring,
- definitionTitleString: onexitdefinitiontitlestring,
- emphasis: closer(),
- hardBreakEscape: closer(onexithardbreak),
- hardBreakTrailing: closer(onexithardbreak),
- htmlFlow: closer(onexithtmlflow),
- htmlFlowData: onexitdata,
- htmlText: closer(onexithtmltext),
- htmlTextData: onexitdata,
- image: closer(onexitimage),
- label: onexitlabel,
- labelText: onexitlabeltext,
- lineEnding: onexitlineending,
- link: closer(onexitlink),
- listItem: closer(),
- listOrdered: closer(),
- listUnordered: closer(),
- paragraph: closer(),
- referenceString: onexitreferencestring,
- resourceDestinationString: onexitresourcedestinationstring,
- resourceTitleString: onexitresourcetitlestring,
- resource: onexitresource,
- setextHeading: closer(onexitsetextheading),
- setextHeadingLineSequence: onexitsetextheadinglinesequence,
- setextHeadingText: onexitsetextheadingtext,
- strong: closer(),
- thematicBreak: closer()
- }
- };
- configure(config4, (options || {}).mdastExtensions || []);
- const data3 = {};
- return compile2;
- function compile2(events2) {
- let tree = {
- type: "root",
- children: []
- };
- const context = {
- stack: [tree],
- tokenStack: [],
- config: config4,
- enter,
- exit: exit2,
- buffer: buffer2,
- resume,
- setData,
- getData
- };
- const listStack = [];
- let index3 = -1;
- while (++index3 < events2.length) {
- if (events2[index3][1].type === "listOrdered" || events2[index3][1].type === "listUnordered") {
- if (events2[index3][0] === "enter") {
- listStack.push(index3);
- } else {
- const tail = listStack.pop();
- index3 = prepareList(events2, tail, index3);
- }
- }
- }
- index3 = -1;
- while (++index3 < events2.length) {
- const handler = config4[events2[index3][0]];
- if (own2.call(handler, events2[index3][1].type)) {
- handler[events2[index3][1].type].call(
- Object.assign(
- {
- sliceSerialize: events2[index3][2].sliceSerialize
- },
- context
- ),
- events2[index3][1]
- );
- }
- }
- if (context.tokenStack.length > 0) {
- const tail = context.tokenStack[context.tokenStack.length - 1];
- const handler = tail[1] || defaultOnError;
- handler.call(context, void 0, tail[0]);
- }
- tree.position = {
- start: point2(
- events2.length > 0 ? events2[0][1].start : {
- line: 1,
- column: 1,
- offset: 0
- }
- ),
- end: point2(
- events2.length > 0 ? events2[events2.length - 2][1].end : {
- line: 1,
- column: 1,
- offset: 0
- }
- )
- };
- index3 = -1;
- while (++index3 < config4.transforms.length) {
- tree = config4.transforms[index3](tree) || tree;
+ return function(event) {
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ args[_key2 - 1] = arguments[_key2];
}
- return tree;
- }
- function prepareList(events2, start, length) {
- let index3 = start - 1;
- let containerBalance = -1;
- let listSpread = false;
- let listItem5;
- let lineIndex;
- let firstBlankLineIndex;
- let atMarker;
- while (++index3 <= length) {
- const event = events2[index3];
- if (event[1].type === "listUnordered" || event[1].type === "listOrdered" || event[1].type === "blockQuote") {
- if (event[0] === "enter") {
- containerBalance++;
- } else {
- containerBalance--;
- }
- atMarker = void 0;
- } else if (event[1].type === "lineEndingBlank") {
- if (event[0] === "enter") {
- if (listItem5 && !atMarker && !containerBalance && !firstBlankLineIndex) {
- firstBlankLineIndex = index3;
- }
- atMarker = void 0;
- }
- } else if (event[1].type === "linePrefix" || event[1].type === "listItemValue" || event[1].type === "listItemMarker" || event[1].type === "listItemPrefix" || event[1].type === "listItemPrefixWhitespace") {
- } else {
- atMarker = void 0;
- }
- if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
- if (listItem5) {
- let tailIndex = index3;
- lineIndex = void 0;
- while (tailIndex--) {
- const tailEvent = events2[tailIndex];
- if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
- if (tailEvent[0] === "exit")
- continue;
- if (lineIndex) {
- events2[lineIndex][1].type = "lineEndingBlank";
- listSpread = true;
- }
- tailEvent[1].type = "lineEnding";
- lineIndex = tailIndex;
- } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") {
- } else {
- break;
- }
- }
- if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
- listItem5._spread = true;
- }
- listItem5.end = Object.assign(
- {},
- lineIndex ? events2[lineIndex][1].start : event[1].end
- );
- events2.splice(lineIndex || index3, 0, ["exit", listItem5, event[2]]);
- index3++;
- length++;
- }
- if (event[1].type === "listItemPrefix") {
- listItem5 = {
- type: "listItem",
- _spread: false,
- start: Object.assign({}, event[1].start),
- end: void 0
- };
- events2.splice(index3, 0, ["enter", listItem5, event[2]]);
- index3++;
- length++;
- firstBlankLineIndex = void 0;
- atMarker = true;
- }
+ return fns.some(function(fn) {
+ if (!isPropagationStopped(event) && fn) {
+ fn.apply(void 0, [event].concat(args));
}
- }
- events2[start][1]._spread = listSpread;
- return length;
- }
- function setData(key3, value) {
- data3[key3] = value;
- }
- function getData(key3) {
- return data3[key3];
- }
- function opener(create3, and2) {
- return open;
- function open(token) {
- enter.call(this, create3(token), token);
- if (and2)
- and2.call(this, token);
- }
- }
- function buffer2() {
- this.stack.push({
- type: "fragment",
- children: []
+ return isPropagationStopped(event);
});
- }
- function enter(node2, token, errorHandler) {
- const parent = this.stack[this.stack.length - 1];
- parent.children.push(node2);
- this.stack.push(node2);
- this.tokenStack.push([token, errorHandler]);
- node2.position = {
- start: point2(token.start)
- };
- return node2;
- }
- function closer(and2) {
- return close;
- function close(token) {
- if (and2)
- and2.call(this, token);
- exit2.call(this, token);
- }
- }
- function exit2(token, onExitError) {
- const node2 = this.stack.pop();
- const open = this.tokenStack.pop();
- if (!open) {
- throw new Error(
- "Cannot close `" + token.type + "` (" + stringifyPosition({
- start: token.start,
- end: token.end
- }) + "): it\u2019s not open"
- );
- } else if (open[0].type !== token.type) {
- if (onExitError) {
- onExitError.call(this, token, open[0]);
- } else {
- const handler = open[1] || defaultOnError;
- handler.call(this, token, open[0]);
- }
- }
- node2.position.end = point2(token.end);
- return node2;
- }
- function resume() {
- return toString4(this.stack.pop());
- }
- function onenterlistordered() {
- setData("expectingFirstListItemValue", true);
- }
- function onenterlistitemvalue(token) {
- if (getData("expectingFirstListItemValue")) {
- const ancestor2 = this.stack[this.stack.length - 2];
- ancestor2.start = Number.parseInt(this.sliceSerialize(token), 10);
- setData("expectingFirstListItemValue");
- }
- }
- function onexitcodefencedfenceinfo() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.lang = data4;
- }
- function onexitcodefencedfencemeta() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.meta = data4;
- }
- function onexitcodefencedfence() {
- if (getData("flowCodeInside"))
- return;
- this.buffer();
- setData("flowCodeInside", true);
- }
- function onexitcodefenced() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.value = data4.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
- setData("flowCodeInside");
- }
- function onexitcodeindented() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.value = data4.replace(/(\r?\n|\r)$/g, "");
- }
- function onexitdefinitionlabelstring(token) {
- const label = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.label = label;
- node2.identifier = normalizeIdentifier(
- this.sliceSerialize(token)
- ).toLowerCase();
- }
- function onexitdefinitiontitlestring() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.title = data4;
- }
- function onexitdefinitiondestinationstring() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.url = data4;
- }
- function onexitatxheadingsequence(token) {
- const node2 = this.stack[this.stack.length - 1];
- if (!node2.depth) {
- const depth = this.sliceSerialize(token).length;
- node2.depth = depth;
- }
- }
- function onexitsetextheadingtext() {
- setData("setextHeadingSlurpLineEnding", true);
- }
- function onexitsetextheadinglinesequence(token) {
- const node2 = this.stack[this.stack.length - 1];
- node2.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2;
- }
- function onexitsetextheading() {
- setData("setextHeadingSlurpLineEnding");
- }
- function onenterdata(token) {
- const node2 = this.stack[this.stack.length - 1];
- let tail = node2.children[node2.children.length - 1];
- if (!tail || tail.type !== "text") {
- tail = text7();
- tail.position = {
- start: point2(token.start)
- };
- node2.children.push(tail);
- }
- this.stack.push(tail);
- }
- function onexitdata(token) {
- const tail = this.stack.pop();
- tail.value += this.sliceSerialize(token);
- tail.position.end = point2(token.end);
- }
- function onexitlineending(token) {
- const context = this.stack[this.stack.length - 1];
- if (getData("atHardBreak")) {
- const tail = context.children[context.children.length - 1];
- tail.position.end = point2(token.end);
- setData("atHardBreak");
- return;
- }
- if (!getData("setextHeadingSlurpLineEnding") && config4.canContainEols.includes(context.type)) {
- onenterdata.call(this, token);
- onexitdata.call(this, token);
- }
- }
- function onexithardbreak() {
- setData("atHardBreak", true);
- }
- function onexithtmlflow() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.value = data4;
- }
- function onexithtmltext() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.value = data4;
- }
- function onexitcodetext() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.value = data4;
- }
- function onexitlink() {
- const node2 = this.stack[this.stack.length - 1];
- if (getData("inReference")) {
- const referenceType = getData("referenceType") || "shortcut";
- node2.type += "Reference";
- node2.referenceType = referenceType;
- delete node2.url;
- delete node2.title;
- } else {
- delete node2.identifier;
- delete node2.label;
- }
- setData("referenceType");
- }
- function onexitimage() {
- const node2 = this.stack[this.stack.length - 1];
- if (getData("inReference")) {
- const referenceType = getData("referenceType") || "shortcut";
- node2.type += "Reference";
- node2.referenceType = referenceType;
- delete node2.url;
- delete node2.title;
- } else {
- delete node2.identifier;
- delete node2.label;
- }
- setData("referenceType");
- }
- function onexitlabeltext(token) {
- const string6 = this.sliceSerialize(token);
- const ancestor2 = this.stack[this.stack.length - 2];
- ancestor2.label = decodeString(string6);
- ancestor2.identifier = normalizeIdentifier(string6).toLowerCase();
- }
- function onexitlabel() {
- const fragment = this.stack[this.stack.length - 1];
- const value = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- setData("inReference", true);
- if (node2.type === "link") {
- const children = fragment.children;
- node2.children = children;
- } else {
- node2.alt = value;
- }
- }
- function onexitresourcedestinationstring() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.url = data4;
- }
- function onexitresourcetitlestring() {
- const data4 = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.title = data4;
- }
- function onexitresource() {
- setData("inReference");
- }
- function onenterreference() {
- setData("referenceType", "collapsed");
- }
- function onexitreferencestring(token) {
- const label = this.resume();
- const node2 = this.stack[this.stack.length - 1];
- node2.label = label;
- node2.identifier = normalizeIdentifier(
- this.sliceSerialize(token)
- ).toLowerCase();
- setData("referenceType", "full");
- }
- function onexitcharacterreferencemarker(token) {
- setData("characterReferenceType", token.type);
- }
- function onexitcharacterreferencevalue(token) {
- const data4 = this.sliceSerialize(token);
- const type = getData("characterReferenceType");
- let value;
- if (type) {
- value = decodeNumericCharacterReference(
- data4,
- type === "characterReferenceMarkerNumeric" ? 10 : 16
- );
- setData("characterReferenceType");
- } else {
- const result = decodeNamedCharacterReference(data4);
- value = result;
- }
- const tail = this.stack.pop();
- tail.value += value;
- tail.position.end = point2(token.end);
- }
- function onexitautolinkprotocol(token) {
- onexitdata.call(this, token);
- const node2 = this.stack[this.stack.length - 1];
- node2.url = this.sliceSerialize(token);
- }
- function onexitautolinkemail(token) {
- onexitdata.call(this, token);
- const node2 = this.stack[this.stack.length - 1];
- node2.url = "mailto:" + this.sliceSerialize(token);
- }
- function blockQuote2() {
- return {
- type: "blockquote",
- children: []
- };
- }
- function codeFlow() {
- return {
- type: "code",
- lang: null,
- meta: null,
- value: ""
- };
- }
- function codeText2() {
- return {
- type: "inlineCode",
- value: ""
- };
- }
- function definition3() {
- return {
- type: "definition",
- identifier: "",
- label: null,
- title: null,
- url: ""
- };
- }
- function emphasis3() {
- return {
- type: "emphasis",
- children: []
- };
- }
- function heading5() {
- return {
- type: "heading",
- depth: void 0,
- children: []
- };
- }
- function hardBreak3() {
- return {
- type: "break"
- };
- }
- function html7() {
- return {
- type: "html",
- value: ""
- };
- }
- function image3() {
- return {
- type: "image",
- title: null,
- url: "",
- alt: null
- };
- }
- function link3() {
- return {
- type: "link",
- title: null,
- url: "",
- children: []
- };
- }
- function list4(token) {
- return {
- type: "list",
- ordered: token.type === "listOrdered",
- start: null,
- spread: token._spread,
- children: []
- };
- }
- function listItem4(token) {
- return {
- type: "listItem",
- spread: token._spread,
- checked: null,
- children: []
- };
- }
- function paragraph3() {
- return {
- type: "paragraph",
- children: []
- };
- }
- function strong3() {
- return {
- type: "strong",
- children: []
- };
- }
- function text7() {
- return {
- type: "text",
- value: ""
- };
- }
- function thematicBreak4() {
- return {
- type: "thematicBreak"
- };
- }
-}
-function point2(d4) {
- return {
- line: d4.line,
- column: d4.column,
- offset: d4.offset
};
}
-function configure(combined, extensions) {
- let index3 = -1;
- while (++index3 < extensions.length) {
- const value = extensions[index3];
- if (Array.isArray(value)) {
- configure(combined, value);
- } else {
- extension(combined, value);
- }
- }
+function canUseFileSystemAccessAPI() {
+ return "showOpenFilePicker" in window;
}
-function extension(combined, extension2) {
- let key3;
- for (key3 in extension2) {
- if (own2.call(extension2, key3)) {
- if (key3 === "canContainEols") {
- const right = extension2[key3];
- if (right) {
- combined[key3].push(...right);
- }
- } else if (key3 === "transforms") {
- const right = extension2[key3];
- if (right) {
- combined[key3].push(...right);
- }
- } else if (key3 === "enter" || key3 === "exit") {
- const right = extension2[key3];
- if (right) {
- Object.assign(combined[key3], right);
- }
+function pickerOptionsFromAccept(accept) {
+ if (isDefined2(accept)) {
+ var acceptForPicker = Object.entries(accept).filter(function(_ref2) {
+ var _ref3 = _slicedToArray(_ref2, 2), mimeType = _ref3[0], ext = _ref3[1];
+ var ok = true;
+ if (!isMIMEType(mimeType)) {
+ console.warn('Skipped "'.concat(mimeType, '" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.'));
+ ok = false;
}
- }
+ if (!Array.isArray(ext) || !ext.every(isExt)) {
+ console.warn('Skipped "'.concat(mimeType, '" because an invalid file extension was provided.'));
+ ok = false;
+ }
+ return ok;
+ }).reduce(function(agg, _ref4) {
+ var _ref5 = _slicedToArray(_ref4, 2), mimeType = _ref5[0], ext = _ref5[1];
+ return _objectSpread4(_objectSpread4({}, agg), {}, _defineProperty2({}, mimeType, ext));
+ }, {});
+ return [{
+ description: "Files",
+ accept: acceptForPicker
+ }];
}
+ return accept;
}
-function defaultOnError(left, right) {
- if (left) {
- throw new Error(
- "Cannot close `" + left.type + "` (" + stringifyPosition({
- start: left.start,
- end: left.end
- }) + "): a different token (`" + right.type + "`, " + stringifyPosition({
- start: right.start,
- end: right.end
- }) + ") is open"
- );
- } else {
- throw new Error(
- "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({
- start: right.start,
- end: right.end
- }) + ") is still open"
- );
+function acceptPropAsAcceptAttr(accept) {
+ if (isDefined2(accept)) {
+ return Object.entries(accept).reduce(function(a4, _ref6) {
+ var _ref7 = _slicedToArray(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1];
+ return [].concat(_toConsumableArray(a4), [mimeType], _toConsumableArray(ext));
+ }, []).filter(function(v2) {
+ return isMIMEType(v2) || isExt(v2);
+ }).join(",");
}
+ return void 0;
}
-
-// node_modules/remark-parse/lib/index.js
-function remarkParse(options) {
- const parser3 = (doc) => {
- const settings = this.data("settings");
- return fromMarkdown(
- doc,
- Object.assign({}, settings, options, {
- extensions: this.data("micromarkExtensions") || [],
- mdastExtensions: this.data("fromMarkdownExtensions") || []
- })
- );
- };
- Object.assign(this, { Parser: parser3 });
-}
-
-// node_modules/zwitch/index.js
-var own3 = {}.hasOwnProperty;
-function zwitch(key3, options) {
- const settings = options || {};
- function one5(value, ...parameters) {
- let fn = one5.invalid;
- const handlers2 = one5.handlers;
- if (value && own3.call(value, key3)) {
- const id3 = String(value[key3]);
- fn = own3.call(handlers2, id3) ? handlers2[id3] : one5.unknown;
- }
- if (fn) {
- return fn.call(this, value, ...parameters);
- }
- }
- one5.handlers = settings.handlers || {};
- one5.invalid = settings.invalid;
- one5.unknown = settings.unknown;
- return one5;
+function isAbort(v2) {
+ return v2 instanceof DOMException && (v2.name === "AbortError" || v2.code === v2.ABORT_ERR);
}
-
-// node_modules/mdast-util-to-markdown/lib/configure.js
-function configure2(base3, extension2) {
- let index3 = -1;
- let key3;
- if (extension2.extensions) {
- while (++index3 < extension2.extensions.length) {
- configure2(base3, extension2.extensions[index3]);
- }
- }
- for (key3 in extension2) {
- if (key3 === "extensions") {
- } else if (key3 === "unsafe" || key3 === "join") {
- base3[key3] = [...base3[key3] || [], ...extension2[key3] || []];
- } else if (key3 === "handlers") {
- base3[key3] = Object.assign(base3[key3], extension2[key3] || {});
- } else {
- base3.options[key3] = extension2[key3];
- }
- }
- return base3;
+function isSecurityError(v2) {
+ return v2 instanceof DOMException && (v2.name === "SecurityError" || v2.code === v2.SECURITY_ERR);
}
-
-// node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
-function blockquote(node2, _15, state, info) {
- const exit2 = state.enter("blockquote");
- const tracker = state.createTracker(info);
- tracker.move("> ");
- tracker.shift(2);
- const value = state.indentLines(
- state.containerFlow(node2, tracker.current()),
- map4
- );
- exit2();
- return value;
+function isMIMEType(v2) {
+ return v2 === "audio/*" || v2 === "video/*" || v2 === "image/*" || v2 === "text/*" || /\w+\/[-+.\w]+/g.test(v2);
}
-function map4(line, _15, blank) {
- return ">" + (blank ? "" : " ") + line;
+function isExt(v2) {
+ return /^.*\.[\w]+$/.test(v2);
}
-// node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
-function patternInScope(stack, pattern) {
- return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
-}
-function listInScope(stack, list4, none) {
- if (typeof list4 === "string") {
- list4 = [list4];
- }
- if (!list4 || list4.length === 0) {
- return none;
- }
- let index3 = -1;
- while (++index3 < list4.length) {
- if (stack.includes(list4[index3])) {
- return true;
- }
- }
- return false;
+// node_modules/react-dropzone/dist/es/index.js
+var _excluded2 = ["children"];
+var _excluded22 = ["open"];
+var _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"];
+var _excluded4 = ["refKey", "onChange", "onClick"];
+function _toConsumableArray2(arr) {
+ return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2();
}
-
-// node_modules/mdast-util-to-markdown/lib/handle/break.js
-function hardBreak(_15, _1, state, info) {
- let index3 = -1;
- while (++index3 < state.unsafe.length) {
- if (state.unsafe[index3].character === "\n" && patternInScope(state.stack, state.unsafe[index3])) {
- return /[ \t]/.test(info.before) ? "" : " ";
- }
- }
- return "\\\n";
+function _nonIterableSpread2() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
-
-// node_modules/longest-streak/index.js
-function longestStreak(value, substring) {
- const source = String(value);
- let index3 = source.indexOf(substring);
- let expected = index3;
- let count3 = 0;
- let max5 = 0;
- if (typeof substring !== "string") {
- throw new TypeError("Expected substring");
- }
- while (index3 !== -1) {
- if (index3 === expected) {
- if (++count3 > max5) {
- max5 = count3;
- }
- } else {
- count3 = 1;
- }
- expected = index3 + substring.length;
- index3 = source.indexOf(substring, expected);
- }
- return max5;
+function _iterableToArray2(iter) {
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
+ return Array.from(iter);
}
-
-// node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
-function formatCodeAsIndented(node2, state) {
- return Boolean(
- !state.options.fences && node2.value && !node2.lang && /[^ \r\n]/.test(node2.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
- );
+function _arrayWithoutHoles2(arr) {
+ if (Array.isArray(arr))
+ return _arrayLikeToArray2(arr);
}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-fence.js
-function checkFence(state) {
- const marker = state.options.fence || "`";
- if (marker !== "`" && marker !== "~") {
- throw new Error(
- "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
- );
- }
- return marker;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/code.js
-function code(node2, _15, state, info) {
- const marker = checkFence(state);
- const raw2 = node2.value || "";
- const suffix = marker === "`" ? "GraveAccent" : "Tilde";
- if (formatCodeAsIndented(node2, state)) {
- const exit3 = state.enter("codeIndented");
- const value2 = state.indentLines(raw2, map5);
- exit3();
- return value2;
- }
- const tracker = state.createTracker(info);
- const sequence = marker.repeat(Math.max(longestStreak(raw2, marker) + 1, 3));
- const exit2 = state.enter("codeFenced");
- let value = tracker.move(sequence);
- if (node2.lang) {
- const subexit = state.enter(`codeFencedLang${suffix}`);
- value += tracker.move(
- state.safe(node2.lang, {
- before: value,
- after: " ",
- encode: ["`"],
- ...tracker.current()
- })
- );
- subexit();
- }
- if (node2.lang && node2.meta) {
- const subexit = state.enter(`codeFencedMeta${suffix}`);
- value += tracker.move(" ");
- value += tracker.move(
- state.safe(node2.meta, {
- before: value,
- after: "\n",
- encode: ["`"],
- ...tracker.current()
- })
- );
- subexit();
- }
- value += tracker.move("\n");
- if (raw2) {
- value += tracker.move(raw2 + "\n");
- }
- value += tracker.move(sequence);
- exit2();
- return value;
+function _slicedToArray2(arr, i4) {
+ return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i4) || _unsupportedIterableToArray2(arr, i4) || _nonIterableRest2();
}
-function map5(line, _15, blank) {
- return (blank ? "" : " ") + line;
+function _nonIterableRest2() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-quote.js
-function checkQuote(state) {
- const marker = state.options.quote || '"';
- if (marker !== '"' && marker !== "'") {
- throw new Error(
- "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
- );
- }
- return marker;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/definition.js
-function definition2(node2, _15, state, info) {
- const quote = checkQuote(state);
- const suffix = quote === '"' ? "Quote" : "Apostrophe";
- const exit2 = state.enter("definition");
- let subexit = state.enter("label");
- const tracker = state.createTracker(info);
- let value = tracker.move("[");
- value += tracker.move(
- state.safe(state.associationId(node2), {
- before: value,
- after: "]",
- ...tracker.current()
- })
- );
- value += tracker.move("]: ");
- subexit();
- if (!node2.url || /[\0- \u007F]/.test(node2.url)) {
- subexit = state.enter("destinationLiteral");
- value += tracker.move("<");
- value += tracker.move(
- state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
- );
- value += tracker.move(">");
- } else {
- subexit = state.enter("destinationRaw");
- value += tracker.move(
- state.safe(node2.url, {
- before: value,
- after: node2.title ? " " : "\n",
- ...tracker.current()
- })
- );
- }
- subexit();
- if (node2.title) {
- subexit = state.enter(`title${suffix}`);
- value += tracker.move(" " + quote);
- value += tracker.move(
- state.safe(node2.title, {
- before: value,
- after: quote,
- ...tracker.current()
- })
- );
- value += tracker.move(quote);
- subexit();
- }
- exit2();
- return value;
+function _unsupportedIterableToArray2(o2, minLen) {
+ if (!o2)
+ return;
+ if (typeof o2 === "string")
+ return _arrayLikeToArray2(o2, minLen);
+ var n3 = Object.prototype.toString.call(o2).slice(8, -1);
+ if (n3 === "Object" && o2.constructor)
+ n3 = o2.constructor.name;
+ if (n3 === "Map" || n3 === "Set")
+ return Array.from(o2);
+ if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
+ return _arrayLikeToArray2(o2, minLen);
}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
-function checkEmphasis(state) {
- const marker = state.options.emphasis || "*";
- if (marker !== "*" && marker !== "_") {
- throw new Error(
- "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
- );
+function _arrayLikeToArray2(arr, len) {
+ if (len == null || len > arr.length)
+ len = arr.length;
+ for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) {
+ arr2[i4] = arr[i4];
}
- return marker;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
-emphasis.peek = emphasisPeek;
-function emphasis(node2, _15, state, info) {
- const marker = checkEmphasis(state);
- const exit2 = state.enter("emphasis");
- const tracker = state.createTracker(info);
- let value = tracker.move(marker);
- value += tracker.move(
- state.containerPhrasing(node2, {
- before: value,
- after: marker,
- ...tracker.current()
- })
- );
- value += tracker.move(marker);
- exit2();
- return value;
-}
-function emphasisPeek(_15, _1, state) {
- return state.options.emphasis || "*";
+ return arr2;
}
-
-// node_modules/unist-util-is/lib/index.js
-var convert = function(test) {
- if (test === void 0 || test === null) {
- return ok;
- }
- if (typeof test === "string") {
- return typeFactory(test);
- }
- if (typeof test === "object") {
- return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
- }
- if (typeof test === "function") {
- return castFactory(test);
- }
- throw new Error("Expected function, string, or object as test");
-};
-function anyFactory(tests) {
- const checks2 = [];
- let index3 = -1;
- while (++index3 < tests.length) {
- checks2[index3] = convert(tests[index3]);
- }
- return castFactory(any);
- function any(...parameters) {
- let index4 = -1;
- while (++index4 < checks2.length) {
- if (checks2[index4].call(this, ...parameters))
- return true;
+function _iterableToArrayLimit2(arr, i4) {
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
+ if (_i == null)
+ return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _s, _e;
+ try {
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+ if (i4 && _arr.length === i4)
+ break;
}
- return false;
- }
-}
-function propsFactory(check) {
- return castFactory(all6);
- function all6(node2) {
- let key3;
- for (key3 in check) {
- if (node2[key3] !== check[key3])
- return false;
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null)
+ _i["return"]();
+ } finally {
+ if (_d)
+ throw _e;
}
- return true;
- }
-}
-function typeFactory(check) {
- return castFactory(type);
- function type(node2) {
- return node2 && node2.type === check;
- }
-}
-function castFactory(check) {
- return assertion;
- function assertion(node2, ...parameters) {
- return Boolean(
- node2 && typeof node2 === "object" && "type" in node2 && Boolean(check.call(this, node2, ...parameters))
- );
}
+ return _arr;
}
-function ok() {
- return true;
-}
-
-// node_modules/unist-util-visit-parents/lib/color.browser.js
-function color2(d4) {
- return d4;
-}
-
-// node_modules/unist-util-visit-parents/lib/index.js
-var CONTINUE = true;
-var EXIT = false;
-var SKIP = "skip";
-var visitParents = function(tree, test, visitor, reverse) {
- if (typeof test === "function" && typeof visitor !== "function") {
- reverse = visitor;
- visitor = test;
- test = null;
- }
- const is2 = convert(test);
- const step = reverse ? -1 : 1;
- factory2(tree, void 0, [])();
- function factory2(node2, index3, parents) {
- const value = node2 && typeof node2 === "object" ? node2 : {};
- if (typeof value.type === "string") {
- const name317 = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0;
- Object.defineProperty(visit2, "name", {
- value: "node (" + color2(node2.type + (name317 ? "<" + name317 + ">" : "")) + ")"
- });
- }
- return visit2;
- function visit2() {
- let result = [];
- let subresult;
- let offset2;
- let grandparents;
- if (!test || is2(node2, index3, parents[parents.length - 1] || null)) {
- result = toResult(visitor(node2, parents));
- if (result[0] === EXIT) {
- return result;
- }
- }
- if (node2.children && result[0] !== SKIP) {
- offset2 = (reverse ? node2.children.length : -1) + step;
- grandparents = parents.concat(node2);
- while (offset2 > -1 && offset2 < node2.children.length) {
- subresult = factory2(node2.children[offset2], offset2, grandparents)();
- if (subresult[0] === EXIT) {
- return subresult;
- }
- offset2 = typeof subresult[1] === "number" ? subresult[1] : offset2 + step;
- }
- }
- return result;
- }
- }
-};
-function toResult(value) {
- if (Array.isArray(value)) {
- return value;
- }
- if (typeof value === "number") {
- return [CONTINUE, value];
- }
- return [value];
+function _arrayWithHoles2(arr) {
+ if (Array.isArray(arr))
+ return arr;
}
-
-// node_modules/unist-util-visit/lib/index.js
-var visit = function(tree, test, visitor, reverse) {
- if (typeof test === "function" && typeof visitor !== "function") {
- reverse = visitor;
- visitor = test;
- test = null;
- }
- visitParents(tree, test, overload, reverse);
- function overload(node2, parents) {
- const parent = parents[parents.length - 1];
- return visitor(
- node2,
- parent ? parent.children.indexOf(node2) : null,
- parent
- );
+function ownKeys5(object, enumerableOnly) {
+ var keys = Object.keys(object);
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ })), keys.push.apply(keys, symbols);
}
-};
-
-// node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
-function formatHeadingAsSetext(node2, state) {
- let literalWithBreak = false;
- visit(node2, (node3) => {
- if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
- literalWithBreak = true;
- return EXIT;
- }
- });
- return Boolean(
- (!node2.depth || node2.depth < 3) && toString4(node2) && (state.options.setext || literalWithBreak)
- );
+ return keys;
}
-
-// node_modules/mdast-util-to-markdown/lib/handle/heading.js
-function heading3(node2, _15, state, info) {
- const rank = Math.max(Math.min(6, node2.depth || 1), 1);
- const tracker = state.createTracker(info);
- if (formatHeadingAsSetext(node2, state)) {
- const exit3 = state.enter("headingSetext");
- const subexit2 = state.enter("phrasing");
- const value2 = state.containerPhrasing(node2, {
- ...tracker.current(),
- before: "\n",
- after: "\n"
+function _objectSpread5(target) {
+ for (var i4 = 1; i4 < arguments.length; i4++) {
+ var source = null != arguments[i4] ? arguments[i4] : {};
+ i4 % 2 ? ownKeys5(Object(source), true).forEach(function(key2) {
+ _defineProperty3(target, key2, source[key2]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys5(Object(source)).forEach(function(key2) {
+ Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
});
- subexit2();
- exit3();
- return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
- value2.length - (Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
- );
- }
- const sequence = "#".repeat(rank);
- const exit2 = state.enter("headingAtx");
- const subexit = state.enter("phrasing");
- tracker.move(sequence + " ");
- let value = state.containerPhrasing(node2, {
- before: "# ",
- after: "\n",
- ...tracker.current()
- });
- if (/^[\t ]/.test(value)) {
- value = "" + value.charCodeAt(0).toString(16).toUpperCase() + ";" + value.slice(1);
- }
- value = value ? sequence + " " + value : sequence;
- if (state.options.closeAtx) {
- value += " " + sequence;
- }
- subexit();
- exit2();
- return value;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/html.js
-html.peek = htmlPeek;
-function html(node2) {
- return node2.value || "";
-}
-function htmlPeek() {
- return "<";
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/image.js
-image.peek = imagePeek;
-function image(node2, _15, state, info) {
- const quote = checkQuote(state);
- const suffix = quote === '"' ? "Quote" : "Apostrophe";
- const exit2 = state.enter("image");
- let subexit = state.enter("label");
- const tracker = state.createTracker(info);
- let value = tracker.move("![");
- value += tracker.move(
- state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
- );
- value += tracker.move("](");
- subexit();
- if (!node2.url && node2.title || /[\0- \u007F]/.test(node2.url)) {
- subexit = state.enter("destinationLiteral");
- value += tracker.move("<");
- value += tracker.move(
- state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
- );
- value += tracker.move(">");
- } else {
- subexit = state.enter("destinationRaw");
- value += tracker.move(
- state.safe(node2.url, {
- before: value,
- after: node2.title ? " " : ")",
- ...tracker.current()
- })
- );
- }
- subexit();
- if (node2.title) {
- subexit = state.enter(`title${suffix}`);
- value += tracker.move(" " + quote);
- value += tracker.move(
- state.safe(node2.title, {
- before: value,
- after: quote,
- ...tracker.current()
- })
- );
- value += tracker.move(quote);
- subexit();
}
- value += tracker.move(")");
- exit2();
- return value;
+ return target;
}
-function imagePeek() {
- return "!";
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
-imageReference.peek = imageReferencePeek;
-function imageReference(node2, _15, state, info) {
- const type = node2.referenceType;
- const exit2 = state.enter("imageReference");
- let subexit = state.enter("label");
- const tracker = state.createTracker(info);
- let value = tracker.move("![");
- const alt = state.safe(node2.alt, {
- before: value,
- after: "]",
- ...tracker.current()
- });
- value += tracker.move(alt + "][");
- subexit();
- const stack = state.stack;
- state.stack = [];
- subexit = state.enter("reference");
- const reference = state.safe(state.associationId(node2), {
- before: value,
- after: "]",
- ...tracker.current()
- });
- subexit();
- state.stack = stack;
- exit2();
- if (type === "full" || !alt || alt !== reference) {
- value += tracker.move(reference + "]");
- } else if (type === "shortcut") {
- value = value.slice(0, -1);
+function _defineProperty3(obj, key2, value) {
+ if (key2 in obj) {
+ Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });
} else {
- value += tracker.move("]");
- }
- return value;
-}
-function imageReferencePeek() {
- return "!";
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
-function patternCompile(pattern) {
- if (!pattern._compiled) {
- const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : "");
- pattern._compiled = new RegExp(
- (before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""),
- "g"
- );
+ obj[key2] = value;
}
- return pattern._compiled;
+ return obj;
}
-
-// node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
-inlineCode.peek = inlineCodePeek;
-function inlineCode(node2, _15, state) {
- let value = node2.value || "";
- let sequence = "`";
- let index3 = -1;
- while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
- sequence += "`";
- }
- if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
- value = " " + value + " ";
- }
- while (++index3 < state.unsafe.length) {
- const pattern = state.unsafe[index3];
- const expression = patternCompile(pattern);
- let match2;
- if (!pattern.atBreak)
- continue;
- while (match2 = expression.exec(value)) {
- let position3 = match2.index;
- if (value.charCodeAt(position3) === 10 && value.charCodeAt(position3 - 1) === 13) {
- position3--;
- }
- value = value.slice(0, position3) + " " + value.slice(match2.index + 1);
+function _objectWithoutProperties(source, excluded) {
+ if (source == null)
+ return {};
+ var target = _objectWithoutPropertiesLoose2(source, excluded);
+ var key2, i4;
+ if (Object.getOwnPropertySymbols) {
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+ for (i4 = 0; i4 < sourceSymbolKeys.length; i4++) {
+ key2 = sourceSymbolKeys[i4];
+ if (excluded.indexOf(key2) >= 0)
+ continue;
+ if (!Object.prototype.propertyIsEnumerable.call(source, key2))
+ continue;
+ target[key2] = source[key2];
}
}
- return sequence + value + sequence;
-}
-function inlineCodePeek() {
- return "`";
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
-function formatLinkAsAutolink(node2, state) {
- const raw2 = toString4(node2);
- return Boolean(
- !state.options.resourceLink && node2.url && !node2.title && node2.children && node2.children.length === 1 && node2.children[0].type === "text" && (raw2 === node2.url || "mailto:" + raw2 === node2.url) && /^[a-z][a-z+.-]+:/i.test(node2.url) && !/[\0- <>\u007F]/.test(node2.url)
- );
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/link.js
-link.peek = linkPeek;
-function link(node2, _15, state, info) {
- const quote = checkQuote(state);
- const suffix = quote === '"' ? "Quote" : "Apostrophe";
- const tracker = state.createTracker(info);
- let exit2;
- let subexit;
- if (formatLinkAsAutolink(node2, state)) {
- const stack = state.stack;
- state.stack = [];
- exit2 = state.enter("autolink");
- let value2 = tracker.move("<");
- value2 += tracker.move(
- state.containerPhrasing(node2, {
- before: value2,
- after: ">",
- ...tracker.current()
- })
- );
- value2 += tracker.move(">");
- exit2();
- state.stack = stack;
- return value2;
- }
- exit2 = state.enter("link");
- subexit = state.enter("label");
- let value = tracker.move("[");
- value += tracker.move(
- state.containerPhrasing(node2, {
- before: value,
- after: "](",
- ...tracker.current()
- })
- );
- value += tracker.move("](");
- subexit();
- if (!node2.url && node2.title || /[\0- \u007F]/.test(node2.url)) {
- subexit = state.enter("destinationLiteral");
- value += tracker.move("<");
- value += tracker.move(
- state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
- );
- value += tracker.move(">");
- } else {
- subexit = state.enter("destinationRaw");
- value += tracker.move(
- state.safe(node2.url, {
- before: value,
- after: node2.title ? " " : ")",
- ...tracker.current()
- })
- );
- }
- subexit();
- if (node2.title) {
- subexit = state.enter(`title${suffix}`);
- value += tracker.move(" " + quote);
- value += tracker.move(
- state.safe(node2.title, {
- before: value,
- after: quote,
- ...tracker.current()
- })
- );
- value += tracker.move(quote);
- subexit();
- }
- value += tracker.move(")");
- exit2();
- return value;
-}
-function linkPeek(node2, _15, state) {
- return formatLinkAsAutolink(node2, state) ? "<" : "[";
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
-linkReference.peek = linkReferencePeek;
-function linkReference(node2, _15, state, info) {
- const type = node2.referenceType;
- const exit2 = state.enter("linkReference");
- let subexit = state.enter("label");
- const tracker = state.createTracker(info);
- let value = tracker.move("[");
- const text7 = state.containerPhrasing(node2, {
- before: value,
- after: "]",
- ...tracker.current()
- });
- value += tracker.move(text7 + "][");
- subexit();
- const stack = state.stack;
- state.stack = [];
- subexit = state.enter("reference");
- const reference = state.safe(state.associationId(node2), {
- before: value,
- after: "]",
- ...tracker.current()
- });
- subexit();
- state.stack = stack;
- exit2();
- if (type === "full" || !text7 || text7 !== reference) {
- value += tracker.move(reference + "]");
- } else if (type === "shortcut") {
- value = value.slice(0, -1);
- } else {
- value += tracker.move("]");
- }
- return value;
-}
-function linkReferencePeek() {
- return "[";
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
-function checkBullet(state) {
- const marker = state.options.bullet || "*";
- if (marker !== "*" && marker !== "+" && marker !== "-") {
- throw new Error(
- "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
- );
- }
- return marker;
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
-function checkBulletOther(state) {
- const bullet = checkBullet(state);
- const bulletOther = state.options.bulletOther;
- if (!bulletOther) {
- return bullet === "*" ? "-" : "*";
- }
- if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
- throw new Error(
- "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
- );
- }
- if (bulletOther === bullet) {
- throw new Error(
- "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
- );
- }
- return bulletOther;
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
-function checkBulletOrdered(state) {
- const marker = state.options.bulletOrdered || ".";
- if (marker !== "." && marker !== ")") {
- throw new Error(
- "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
- );
- }
- return marker;
+ return target;
}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered-other.js
-function checkBulletOrderedOther(state) {
- const bulletOrdered = checkBulletOrdered(state);
- const bulletOrderedOther = state.options.bulletOrderedOther;
- if (!bulletOrderedOther) {
- return bulletOrdered === "." ? ")" : ".";
- }
- if (bulletOrderedOther !== "." && bulletOrderedOther !== ")") {
- throw new Error(
- "Cannot serialize items with `" + bulletOrderedOther + "` for `options.bulletOrderedOther`, expected `*`, `+`, or `-`"
- );
- }
- if (bulletOrderedOther === bulletOrdered) {
- throw new Error(
- "Expected `bulletOrdered` (`" + bulletOrdered + "`) and `bulletOrderedOther` (`" + bulletOrderedOther + "`) to be different"
- );
+function _objectWithoutPropertiesLoose2(source, excluded) {
+ if (source == null)
+ return {};
+ var target = {};
+ var sourceKeys = Object.keys(source);
+ var key2, i4;
+ for (i4 = 0; i4 < sourceKeys.length; i4++) {
+ key2 = sourceKeys[i4];
+ if (excluded.indexOf(key2) >= 0)
+ continue;
+ target[key2] = source[key2];
}
- return bulletOrderedOther;
+ return target;
}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-rule.js
-function checkRule(state) {
- const marker = state.options.rule || "*";
- if (marker !== "*" && marker !== "-" && marker !== "_") {
- throw new Error(
- "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
- );
- }
- return marker;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/list.js
-function list2(node2, parent, state, info) {
- const exit2 = state.enter("list");
- const bulletCurrent = state.bulletCurrent;
- let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
- const bulletOther = node2.ordered ? checkBulletOrderedOther(state) : checkBulletOther(state);
- const bulletLastUsed = state.bulletLastUsed;
- let useDifferentMarker = false;
- if (parent && (node2.ordered ? state.options.bulletOrderedOther : state.options.bulletOther) && bulletLastUsed && bullet === bulletLastUsed) {
- useDifferentMarker = true;
- }
- if (!node2.ordered) {
- const firstListItem = node2.children ? node2.children[0] : void 0;
- if ((bullet === "*" || bullet === "-") && firstListItem && (!firstListItem.children || !firstListItem.children[0]) && state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0) {
- useDifferentMarker = true;
- }
- if (checkRule(state) === bullet && firstListItem) {
- let index3 = -1;
- while (++index3 < node2.children.length) {
- const item = node2.children[index3];
- if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
- useDifferentMarker = true;
- break;
+var Dropzone = /* @__PURE__ */ (0, import_react108.forwardRef)(function(_ref, ref2) {
+ var children = _ref.children, params = _objectWithoutProperties(_ref, _excluded2);
+ var _useDropzone = useDropzone(params), open = _useDropzone.open, props = _objectWithoutProperties(_useDropzone, _excluded22);
+ (0, import_react108.useImperativeHandle)(ref2, function() {
+ return {
+ open
+ };
+ }, [open]);
+ return /* @__PURE__ */ import_react108.default.createElement(import_react108.Fragment, null, children(_objectSpread5(_objectSpread5({}, props), {}, {
+ open
+ })));
+});
+Dropzone.displayName = "Dropzone";
+var defaultProps2 = {
+ disabled: false,
+ getFilesFromEvent: fromEvent,
+ maxSize: Infinity,
+ minSize: 0,
+ multiple: true,
+ maxFiles: 0,
+ preventDropOnDocument: true,
+ noClick: false,
+ noKeyboard: false,
+ noDrag: false,
+ noDragEventsBubbling: false,
+ validator: null,
+ useFsAccessApi: true,
+ autoFocus: false
+};
+Dropzone.defaultProps = defaultProps2;
+Dropzone.propTypes = {
+ children: import_prop_types.default.func,
+ accept: import_prop_types.default.objectOf(import_prop_types.default.arrayOf(import_prop_types.default.string)),
+ multiple: import_prop_types.default.bool,
+ preventDropOnDocument: import_prop_types.default.bool,
+ noClick: import_prop_types.default.bool,
+ noKeyboard: import_prop_types.default.bool,
+ noDrag: import_prop_types.default.bool,
+ noDragEventsBubbling: import_prop_types.default.bool,
+ minSize: import_prop_types.default.number,
+ maxSize: import_prop_types.default.number,
+ maxFiles: import_prop_types.default.number,
+ disabled: import_prop_types.default.bool,
+ getFilesFromEvent: import_prop_types.default.func,
+ onFileDialogCancel: import_prop_types.default.func,
+ onFileDialogOpen: import_prop_types.default.func,
+ useFsAccessApi: import_prop_types.default.bool,
+ autoFocus: import_prop_types.default.bool,
+ onDragEnter: import_prop_types.default.func,
+ onDragLeave: import_prop_types.default.func,
+ onDragOver: import_prop_types.default.func,
+ onDrop: import_prop_types.default.func,
+ onDropAccepted: import_prop_types.default.func,
+ onDropRejected: import_prop_types.default.func,
+ onError: import_prop_types.default.func,
+ validator: import_prop_types.default.func
+};
+var initialState = {
+ isFocused: false,
+ isFileDialogActive: false,
+ isDragActive: false,
+ isDragAccept: false,
+ isDragReject: false,
+ acceptedFiles: [],
+ fileRejections: []
+};
+function useDropzone() {
+ var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
+ var _defaultProps$props = _objectSpread5(_objectSpread5({}, defaultProps2), props), accept = _defaultProps$props.accept, disabled = _defaultProps$props.disabled, getFilesFromEvent = _defaultProps$props.getFilesFromEvent, maxSize = _defaultProps$props.maxSize, minSize = _defaultProps$props.minSize, multiple = _defaultProps$props.multiple, maxFiles = _defaultProps$props.maxFiles, onDragEnter = _defaultProps$props.onDragEnter, onDragLeave = _defaultProps$props.onDragLeave, onDragOver = _defaultProps$props.onDragOver, onDrop = _defaultProps$props.onDrop, onDropAccepted = _defaultProps$props.onDropAccepted, onDropRejected = _defaultProps$props.onDropRejected, onFileDialogCancel = _defaultProps$props.onFileDialogCancel, onFileDialogOpen = _defaultProps$props.onFileDialogOpen, useFsAccessApi = _defaultProps$props.useFsAccessApi, autoFocus = _defaultProps$props.autoFocus, preventDropOnDocument = _defaultProps$props.preventDropOnDocument, noClick = _defaultProps$props.noClick, noKeyboard = _defaultProps$props.noKeyboard, noDrag = _defaultProps$props.noDrag, noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, onError = _defaultProps$props.onError, validator = _defaultProps$props.validator;
+ var acceptAttr = (0, import_react108.useMemo)(function() {
+ return acceptPropAsAcceptAttr(accept);
+ }, [accept]);
+ var pickerTypes = (0, import_react108.useMemo)(function() {
+ return pickerOptionsFromAccept(accept);
+ }, [accept]);
+ var onFileDialogOpenCb = (0, import_react108.useMemo)(function() {
+ return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop2;
+ }, [onFileDialogOpen]);
+ var onFileDialogCancelCb = (0, import_react108.useMemo)(function() {
+ return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop2;
+ }, [onFileDialogCancel]);
+ var rootRef = (0, import_react108.useRef)(null);
+ var inputRef = (0, import_react108.useRef)(null);
+ var _useReducer = (0, import_react108.useReducer)(reducer2, initialState), _useReducer2 = _slicedToArray2(_useReducer, 2), state = _useReducer2[0], dispatch = _useReducer2[1];
+ var isFocused = state.isFocused, isFileDialogActive = state.isFileDialogActive;
+ var fsAccessApiWorksRef = (0, import_react108.useRef)(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI());
+ var onWindowFocus = function onWindowFocus2() {
+ if (!fsAccessApiWorksRef.current && isFileDialogActive) {
+ setTimeout(function() {
+ if (inputRef.current) {
+ var files = inputRef.current.files;
+ if (!files.length) {
+ dispatch({
+ type: "closeDialog"
+ });
+ onFileDialogCancelCb();
+ }
}
- }
- }
- }
- if (useDifferentMarker) {
- bullet = bulletOther;
- }
- state.bulletCurrent = bullet;
- const value = state.containerFlow(node2, info);
- state.bulletLastUsed = bullet;
- state.bulletCurrent = bulletCurrent;
- exit2();
- return value;
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
-function checkListItemIndent(state) {
- const style = state.options.listItemIndent || "tab";
- if (style === 1 || style === "1") {
- return "one";
- }
- if (style !== "tab" && style !== "one" && style !== "mixed") {
- throw new Error(
- "Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
- );
- }
- return style;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/list-item.js
-function listItem2(node2, parent, state, info) {
- const listItemIndent = checkListItemIndent(state);
- let bullet = state.bulletCurrent || checkBullet(state);
- if (parent && parent.type === "list" && parent.ordered) {
- bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
- }
- let size2 = bullet.length + 1;
- if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
- size2 = Math.ceil(size2 / 4) * 4;
- }
- const tracker = state.createTracker(info);
- tracker.move(bullet + " ".repeat(size2 - bullet.length));
- tracker.shift(size2);
- const exit2 = state.enter("listItem");
- const value = state.indentLines(
- state.containerFlow(node2, tracker.current()),
- map6
- );
- exit2();
- return value;
- function map6(line, index3, blank) {
- if (index3) {
- return (blank ? "" : " ".repeat(size2)) + line;
+ }, 300);
}
- return (blank ? bullet : bullet + " ".repeat(size2 - bullet.length)) + line;
- }
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
-function paragraph(node2, _15, state, info) {
- const exit2 = state.enter("paragraph");
- const subexit = state.enter("phrasing");
- const value = state.containerPhrasing(node2, info);
- subexit();
- exit2();
- return value;
-}
-
-// node_modules/mdast-util-phrasing/lib/index.js
-var phrasing = convert([
- "break",
- "delete",
- "emphasis",
- "footnote",
- "footnoteReference",
- "image",
- "imageReference",
- "inlineCode",
- "link",
- "linkReference",
- "strong",
- "text"
-]);
-
-// node_modules/mdast-util-to-markdown/lib/handle/root.js
-function root(node2, _15, state, info) {
- const hasPhrasing = node2.children.some((d4) => phrasing(d4));
- const fn = hasPhrasing ? state.containerPhrasing : state.containerFlow;
- return fn.call(state, node2, info);
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-strong.js
-function checkStrong(state) {
- const marker = state.options.strong || "*";
- if (marker !== "*" && marker !== "_") {
- throw new Error(
- "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
- );
- }
- return marker;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/strong.js
-strong.peek = strongPeek;
-function strong(node2, _15, state, info) {
- const marker = checkStrong(state);
- const exit2 = state.enter("strong");
- const tracker = state.createTracker(info);
- let value = tracker.move(marker + marker);
- value += tracker.move(
- state.containerPhrasing(node2, {
- before: value,
- after: marker,
- ...tracker.current()
- })
- );
- value += tracker.move(marker + marker);
- exit2();
- return value;
-}
-function strongPeek(_15, _1, state) {
- return state.options.strong || "*";
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/text.js
-function text4(node2, _15, state, info) {
- return state.safe(node2.value, info);
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
-function checkRuleRepetition(state) {
- const repetition = state.options.ruleRepetition || 3;
- if (repetition < 3) {
- throw new Error(
- "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
- );
- }
- return repetition;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
-function thematicBreak2(_15, _1, state) {
- const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
- return state.options.ruleSpaces ? value.slice(0, -1) : value;
-}
-
-// node_modules/mdast-util-to-markdown/lib/handle/index.js
-var handle = {
- blockquote,
- break: hardBreak,
- code,
- definition: definition2,
- emphasis,
- hardBreak,
- heading: heading3,
- html,
- image,
- imageReference,
- inlineCode,
- link,
- linkReference,
- list: list2,
- listItem: listItem2,
- paragraph,
- root,
- strong,
- text: text4,
- thematicBreak: thematicBreak2
-};
-
-// node_modules/mdast-util-to-markdown/lib/join.js
-var join3 = [joinDefaults];
-function joinDefaults(left, right, parent, state) {
- if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) {
- return false;
- }
- if (left.type === "list" && left.type === right.type && Boolean(left.ordered) === Boolean(right.ordered) && !(left.ordered ? state.options.bulletOrderedOther : state.options.bulletOther)) {
- return false;
- }
- if ("spread" in parent && typeof parent.spread === "boolean") {
- if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) {
+ };
+ (0, import_react108.useEffect)(function() {
+ window.addEventListener("focus", onWindowFocus, false);
+ return function() {
+ window.removeEventListener("focus", onWindowFocus, false);
+ };
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
+ var dragTargetsRef = (0, import_react108.useRef)([]);
+ var onDocumentDrop = function onDocumentDrop2(event) {
+ if (rootRef.current && rootRef.current.contains(event.target)) {
return;
}
- return parent.spread ? 1 : 0;
- }
-}
-
-// node_modules/mdast-util-to-markdown/lib/unsafe.js
-var fullPhrasingSpans = [
- "autolink",
- "destinationLiteral",
- "destinationRaw",
- "reference",
- "titleQuote",
- "titleApostrophe"
-];
-var unsafe = [
- { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
- { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
- {
- character: " ",
- inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"]
- },
- {
- character: "\r",
- inConstruct: [
- "codeFencedLangGraveAccent",
- "codeFencedLangTilde",
- "codeFencedMetaGraveAccent",
- "codeFencedMetaTilde",
- "destinationLiteral",
- "headingAtx"
- ]
- },
- {
- character: "\n",
- inConstruct: [
- "codeFencedLangGraveAccent",
- "codeFencedLangTilde",
- "codeFencedMetaGraveAccent",
- "codeFencedMetaTilde",
- "destinationLiteral",
- "headingAtx"
- ]
- },
- { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
- { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
- {
- character: " ",
- inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"]
- },
- {
- character: "!",
- after: "\\[",
- inConstruct: "phrasing",
- notInConstruct: fullPhrasingSpans
- },
- { character: '"', inConstruct: "titleQuote" },
- { atBreak: true, character: "#" },
- { character: "#", inConstruct: "headingAtx", after: "(?:[\r\n]|$)" },
- { character: "&", after: "[#A-Za-z]", inConstruct: "phrasing" },
- { character: "'", inConstruct: "titleApostrophe" },
- { character: "(", inConstruct: "destinationRaw" },
- {
- before: "\\]",
- character: "(",
- inConstruct: "phrasing",
- notInConstruct: fullPhrasingSpans
- },
- { atBreak: true, before: "\\d+", character: ")" },
- { character: ")", inConstruct: "destinationRaw" },
- { atBreak: true, character: "*", after: "(?:[ \r\n*])" },
- { character: "*", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
- { atBreak: true, character: "+", after: "(?:[ \r\n])" },
- { atBreak: true, character: "-", after: "(?:[ \r\n-])" },
- { atBreak: true, before: "\\d+", character: ".", after: "(?:[ \r\n]|$)" },
- { atBreak: true, character: "<", after: "[!/?A-Za-z]" },
- {
- character: "<",
- after: "[!/?A-Za-z]",
- inConstruct: "phrasing",
- notInConstruct: fullPhrasingSpans
- },
- { character: "<", inConstruct: "destinationLiteral" },
- { atBreak: true, character: "=" },
- { atBreak: true, character: ">" },
- { character: ">", inConstruct: "destinationLiteral" },
- { atBreak: true, character: "[" },
- { character: "[", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
- { character: "[", inConstruct: ["label", "reference"] },
- { character: "\\", after: "[\\r\\n]", inConstruct: "phrasing" },
- { character: "]", inConstruct: ["label", "reference"] },
- { atBreak: true, character: "_" },
- { character: "_", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
- { atBreak: true, character: "`" },
- {
- character: "`",
- inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"]
- },
- { character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
- { atBreak: true, character: "~" }
-];
-
-// node_modules/mdast-util-to-markdown/lib/util/association.js
-function association(node2) {
- if (node2.label || !node2.identifier) {
- return node2.label || "";
- }
- return decodeString(node2.identifier);
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
-function containerPhrasing(parent, state, info) {
- const indexStack = state.indexStack;
- const children = parent.children || [];
- const results = [];
- let index3 = -1;
- let before = info.before;
- indexStack.push(-1);
- let tracker = state.createTracker(info);
- while (++index3 < children.length) {
- const child = children[index3];
- let after;
- indexStack[indexStack.length - 1] = index3;
- if (index3 + 1 < children.length) {
- let handle3 = state.handle.handlers[children[index3 + 1].type];
- if (handle3 && handle3.peek)
- handle3 = handle3.peek;
- after = handle3 ? handle3(children[index3 + 1], parent, state, {
- before: "",
- after: "",
- ...tracker.current()
- }).charAt(0) : "";
+ event.preventDefault();
+ dragTargetsRef.current = [];
+ };
+ (0, import_react108.useEffect)(function() {
+ if (preventDropOnDocument) {
+ document.addEventListener("dragover", onDocumentDragOver, false);
+ document.addEventListener("drop", onDocumentDrop, false);
+ }
+ return function() {
+ if (preventDropOnDocument) {
+ document.removeEventListener("dragover", onDocumentDragOver);
+ document.removeEventListener("drop", onDocumentDrop);
+ }
+ };
+ }, [rootRef, preventDropOnDocument]);
+ (0, import_react108.useEffect)(function() {
+ if (!disabled && autoFocus && rootRef.current) {
+ rootRef.current.focus();
+ }
+ return function() {
+ };
+ }, [rootRef, autoFocus, disabled]);
+ var onErrCb = (0, import_react108.useCallback)(function(e5) {
+ if (onError) {
+ onError(e5);
} else {
- after = info.after;
+ console.error(e5);
}
- if (results.length > 0 && (before === "\r" || before === "\n") && child.type === "html") {
- results[results.length - 1] = results[results.length - 1].replace(
- /(\r?\n|\r)$/,
- " "
- );
- before = " ";
- tracker = state.createTracker(info);
- tracker.move(results.join(""));
- }
- results.push(
- tracker.move(
- state.handle(child, parent, state, {
- ...tracker.current(),
- before,
- after
- })
- )
- );
- before = results[results.length - 1].slice(-1);
- }
- indexStack.pop();
- return results.join("");
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/container-flow.js
-function containerFlow(parent, state, info) {
- const indexStack = state.indexStack;
- const children = parent.children || [];
- const tracker = state.createTracker(info);
- const results = [];
- let index3 = -1;
- indexStack.push(-1);
- while (++index3 < children.length) {
- const child = children[index3];
- indexStack[indexStack.length - 1] = index3;
- results.push(
- tracker.move(
- state.handle(child, parent, state, {
- before: "\n",
- after: "\n",
- ...tracker.current()
- })
- )
- );
- if (child.type !== "list") {
- state.bulletLastUsed = void 0;
+ }, [onError]);
+ var onDragEnterCb = (0, import_react108.useCallback)(function(event) {
+ event.preventDefault();
+ event.persist();
+ stopPropagation2(event);
+ dragTargetsRef.current = [].concat(_toConsumableArray2(dragTargetsRef.current), [event.target]);
+ if (isEvtWithFiles(event)) {
+ Promise.resolve(getFilesFromEvent(event)).then(function(files) {
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
+ return;
+ }
+ var fileCount = files.length;
+ var isDragAccept = fileCount > 0 && allFilesAccepted({
+ files,
+ accept: acceptAttr,
+ minSize,
+ maxSize,
+ multiple,
+ maxFiles,
+ validator
+ });
+ var isDragReject = fileCount > 0 && !isDragAccept;
+ dispatch({
+ isDragAccept,
+ isDragReject,
+ isDragActive: true,
+ type: "setDraggedFiles"
+ });
+ if (onDragEnter) {
+ onDragEnter(event);
+ }
+ }).catch(function(e5) {
+ return onErrCb(e5);
+ });
}
- if (index3 < children.length - 1) {
- results.push(
- tracker.move(between(child, children[index3 + 1], parent, state))
- );
+ }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
+ var onDragOverCb = (0, import_react108.useCallback)(function(event) {
+ event.preventDefault();
+ event.persist();
+ stopPropagation2(event);
+ var hasFiles = isEvtWithFiles(event);
+ if (hasFiles && event.dataTransfer) {
+ try {
+ event.dataTransfer.dropEffect = "copy";
+ } catch (_unused) {
+ }
}
- }
- indexStack.pop();
- return results.join("");
-}
-function between(left, right, parent, state) {
- let index3 = state.join.length;
- while (index3--) {
- const result = state.join[index3](left, right, parent, state);
- if (result === true || result === 1) {
- break;
+ if (hasFiles && onDragOver) {
+ onDragOver(event);
}
- if (typeof result === "number") {
- return "\n".repeat(1 + result);
+ return false;
+ }, [onDragOver, noDragEventsBubbling]);
+ var onDragLeaveCb = (0, import_react108.useCallback)(function(event) {
+ event.preventDefault();
+ event.persist();
+ stopPropagation2(event);
+ var targets = dragTargetsRef.current.filter(function(target) {
+ return rootRef.current && rootRef.current.contains(target);
+ });
+ var targetIdx = targets.indexOf(event.target);
+ if (targetIdx !== -1) {
+ targets.splice(targetIdx, 1);
}
- if (result === false) {
- return "\n\n\n\n";
+ dragTargetsRef.current = targets;
+ if (targets.length > 0) {
+ return;
}
- }
- return "\n\n";
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
-var eol = /\r?\n|\r/g;
-function indentLines(value, map6) {
- const result = [];
- let start = 0;
- let line = 0;
- let match2;
- while (match2 = eol.exec(value)) {
- one5(value.slice(start, match2.index));
- result.push(match2[0]);
- start = match2.index + match2[0].length;
- line++;
- }
- one5(value.slice(start));
- return result.join("");
- function one5(value2) {
- result.push(map6(value2, line, !value2));
- }
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/safe.js
-function safe(state, input, config4) {
- const value = (config4.before || "") + (input || "") + (config4.after || "");
- const positions = [];
- const result = [];
- const infos = {};
- let index3 = -1;
- while (++index3 < state.unsafe.length) {
- const pattern = state.unsafe[index3];
- if (!patternInScope(state.stack, pattern)) {
- continue;
+ dispatch({
+ type: "setDraggedFiles",
+ isDragActive: false,
+ isDragAccept: false,
+ isDragReject: false
+ });
+ if (isEvtWithFiles(event) && onDragLeave) {
+ onDragLeave(event);
}
- const expression = patternCompile(pattern);
- let match2;
- while (match2 = expression.exec(value)) {
- const before = "before" in pattern || Boolean(pattern.atBreak);
- const after = "after" in pattern;
- const position3 = match2.index + (before ? match2[1].length : 0);
- if (positions.includes(position3)) {
- if (infos[position3].before && !before) {
- infos[position3].before = false;
- }
- if (infos[position3].after && !after) {
- infos[position3].after = false;
- }
+ }, [rootRef, onDragLeave, noDragEventsBubbling]);
+ var setFiles = (0, import_react108.useCallback)(function(files, event) {
+ var acceptedFiles = [];
+ var fileRejections = [];
+ files.forEach(function(file) {
+ var _fileAccepted = fileAccepted(file, acceptAttr), _fileAccepted2 = _slicedToArray2(_fileAccepted, 2), accepted = _fileAccepted2[0], acceptError = _fileAccepted2[1];
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray2(_fileMatchSize, 2), sizeMatch = _fileMatchSize2[0], sizeError = _fileMatchSize2[1];
+ var customErrors = validator ? validator(file) : null;
+ if (accepted && sizeMatch && !customErrors) {
+ acceptedFiles.push(file);
} else {
- positions.push(position3);
- infos[position3] = { before, after };
+ var errors = [acceptError, sizeError];
+ if (customErrors) {
+ errors = errors.concat(customErrors);
+ }
+ fileRejections.push({
+ file,
+ errors: errors.filter(function(e5) {
+ return e5;
+ })
+ });
}
+ });
+ if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
+ acceptedFiles.forEach(function(file) {
+ fileRejections.push({
+ file,
+ errors: [TOO_MANY_FILES_REJECTION]
+ });
+ });
+ acceptedFiles.splice(0);
}
- }
- positions.sort(numerical);
- let start = config4.before ? config4.before.length : 0;
- const end = value.length - (config4.after ? config4.after.length : 0);
- index3 = -1;
- while (++index3 < positions.length) {
- const position3 = positions[index3];
- if (position3 < start || position3 >= end) {
- continue;
- }
- if (position3 + 1 < end && positions[index3 + 1] === position3 + 1 && infos[position3].after && !infos[position3 + 1].before && !infos[position3 + 1].after || positions[index3 - 1] === position3 - 1 && infos[position3].before && !infos[position3 - 1].before && !infos[position3 - 1].after) {
- continue;
- }
- if (start !== position3) {
- result.push(escapeBackslashes(value.slice(start, position3), "\\"));
+ dispatch({
+ acceptedFiles,
+ fileRejections,
+ type: "setFiles"
+ });
+ if (onDrop) {
+ onDrop(acceptedFiles, fileRejections, event);
}
- start = position3;
- if (/[!-/:-@[-`{-~]/.test(value.charAt(position3)) && (!config4.encode || !config4.encode.includes(value.charAt(position3)))) {
- result.push("\\");
- } else {
- result.push(
- "" + value.charCodeAt(position3).toString(16).toUpperCase() + ";"
- );
- start++;
+ if (fileRejections.length > 0 && onDropRejected) {
+ onDropRejected(fileRejections, event);
}
- }
- result.push(escapeBackslashes(value.slice(start, end), config4.after));
- return result.join("");
-}
-function numerical(a4, b2) {
- return a4 - b2;
-}
-function escapeBackslashes(value, after) {
- const expression = /\\(?=[!-/:-@[-`{-~])/g;
- const positions = [];
- const results = [];
- const whole = value + after;
- let index3 = -1;
- let start = 0;
- let match2;
- while (match2 = expression.exec(whole)) {
- positions.push(match2.index);
- }
- while (++index3 < positions.length) {
- if (start !== positions[index3]) {
- results.push(value.slice(start, positions[index3]));
- }
- results.push("\\");
- start = positions[index3];
- }
- results.push(value.slice(start));
- return results.join("");
-}
-
-// node_modules/mdast-util-to-markdown/lib/util/track.js
-function track(config4) {
- const options = config4 || {};
- const now = options.now || {};
- let lineShift = options.lineShift || 0;
- let line = now.line || 1;
- let column2 = now.column || 1;
- return { move, current: current3, shift };
- function current3() {
- return { now: { line, column: column2 }, lineShift };
- }
- function shift(value) {
- lineShift += value;
- }
- function move(input) {
- const value = input || "";
- const chunks = value.split(/\r?\n|\r/g);
- const tail = chunks[chunks.length - 1];
- line += chunks.length - 1;
- column2 = chunks.length === 1 ? column2 + tail.length : 1 + tail.length + lineShift;
- return value;
- }
-}
-
-// node_modules/mdast-util-to-markdown/lib/index.js
-function toMarkdown(tree, options = {}) {
- const state = {
- enter,
- indentLines,
- associationId: association,
- containerPhrasing: containerPhrasingBound,
- containerFlow: containerFlowBound,
- createTracker: track,
- safe: safeBound,
- stack: [],
- unsafe: [],
- join: [],
- handlers: {},
- options: {},
- indexStack: [],
- handle: void 0
- };
- configure2(state, { unsafe, join: join3, handlers: handle });
- configure2(state, options);
- if (state.options.tightDefinitions) {
- configure2(state, { join: [joinDefinition] });
- }
- state.handle = zwitch("type", {
- invalid: invalid2,
- unknown,
- handlers: state.handlers
- });
- let result = state.handle(tree, void 0, state, {
- before: "\n",
- after: "\n",
- now: { line: 1, column: 1 },
- lineShift: 0
- });
- if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) {
- result += "\n";
- }
- return result;
- function enter(name317) {
- state.stack.push(name317);
- return exit2;
- function exit2() {
- state.stack.pop();
+ if (acceptedFiles.length > 0 && onDropAccepted) {
+ onDropAccepted(acceptedFiles, event);
}
- }
-}
-function invalid2(value) {
- throw new Error("Cannot handle value `" + value + "`, expected node");
-}
-function unknown(node2) {
- throw new Error("Cannot handle unknown node `" + node2.type + "`");
-}
-function joinDefinition(left, right) {
- if (left.type === "definition" && left.type === right.type) {
- return 0;
- }
-}
-function containerPhrasingBound(parent, info) {
- return containerPhrasing(parent, this, info);
-}
-function containerFlowBound(parent, info) {
- return containerFlow(parent, this, info);
-}
-function safeBound(value, config4) {
- return safe(this, value, config4);
-}
-
-// node_modules/remark-stringify/lib/index.js
-function remarkStringify(options) {
- const compiler2 = (tree) => {
- const settings = this.data("settings");
- return toMarkdown(
- tree,
- Object.assign({}, settings, options, {
- extensions: this.data("toMarkdownExtensions") || []
- })
- );
- };
- Object.assign(this, { Compiler: compiler2 });
-}
-
-// node_modules/remark/index.js
-var remark = unified().use(remarkParse).use(remarkStringify).freeze();
-
-// node_modules/property-information/lib/util/schema.js
-var Schema = class {
- constructor(property, normal, space3) {
- this.property = property;
- this.normal = normal;
- if (space3) {
- this.space = space3;
- }
- }
-};
-Schema.prototype.property = {};
-Schema.prototype.normal = {};
-Schema.prototype.space = null;
-
-// node_modules/property-information/lib/util/merge.js
-function merge(definitions2, space3) {
- const property = {};
- const normal = {};
- let index3 = -1;
- while (++index3 < definitions2.length) {
- Object.assign(property, definitions2[index3].property);
- Object.assign(normal, definitions2[index3].normal);
- }
- return new Schema(property, normal, space3);
-}
-
-// node_modules/property-information/lib/normalize.js
-function normalize2(value) {
- return value.toLowerCase();
-}
-
-// node_modules/property-information/lib/util/info.js
-var Info = class {
- constructor(property, attribute) {
- this.property = property;
- this.attribute = attribute;
- }
-};
-Info.prototype.space = null;
-Info.prototype.boolean = false;
-Info.prototype.booleanish = false;
-Info.prototype.overloadedBoolean = false;
-Info.prototype.number = false;
-Info.prototype.commaSeparated = false;
-Info.prototype.spaceSeparated = false;
-Info.prototype.commaOrSpaceSeparated = false;
-Info.prototype.mustUseProperty = false;
-Info.prototype.defined = false;
-
-// node_modules/property-information/lib/util/types.js
-var types_exports = {};
-__export(types_exports, {
- boolean: () => boolean2,
- booleanish: () => booleanish,
- commaOrSpaceSeparated: () => commaOrSpaceSeparated,
- commaSeparated: () => commaSeparated,
- number: () => number4,
- overloadedBoolean: () => overloadedBoolean,
- spaceSeparated: () => spaceSeparated
-});
-var powers = 0;
-var boolean2 = increment();
-var booleanish = increment();
-var overloadedBoolean = increment();
-var number4 = increment();
-var spaceSeparated = increment();
-var commaSeparated = increment();
-var commaOrSpaceSeparated = increment();
-function increment() {
- return 2 ** ++powers;
-}
-
-// node_modules/property-information/lib/util/defined-info.js
-var checks = Object.keys(types_exports);
-var DefinedInfo = class extends Info {
- constructor(property, attribute, mask, space3) {
- let index3 = -1;
- super(property, attribute);
- mark(this, "space", space3);
- if (typeof mask === "number") {
- while (++index3 < checks.length) {
- const check = checks[index3];
- mark(this, checks[index3], (mask & types_exports[check]) === types_exports[check]);
- }
- }
- }
-};
-DefinedInfo.prototype.defined = true;
-function mark(values2, key3, value) {
- if (value) {
- values2[key3] = value;
- }
-}
-
-// node_modules/property-information/lib/util/create.js
-var own4 = {}.hasOwnProperty;
-function create2(definition3) {
- const property = {};
- const normal = {};
- let prop2;
- for (prop2 in definition3.properties) {
- if (own4.call(definition3.properties, prop2)) {
- const value = definition3.properties[prop2];
- const info = new DefinedInfo(
- prop2,
- definition3.transform(definition3.attributes || {}, prop2),
- value,
- definition3.space
- );
- if (definition3.mustUseProperty && definition3.mustUseProperty.includes(prop2)) {
- info.mustUseProperty = true;
- }
- property[prop2] = info;
- normal[normalize2(prop2)] = prop2;
- normal[normalize2(info.attribute)] = prop2;
- }
- }
- return new Schema(property, normal, definition3.space);
-}
-
-// node_modules/property-information/lib/xlink.js
-var xlink = create2({
- space: "xlink",
- transform(_15, prop2) {
- return "xlink:" + prop2.slice(5).toLowerCase();
- },
- properties: {
- xLinkActuate: null,
- xLinkArcRole: null,
- xLinkHref: null,
- xLinkRole: null,
- xLinkShow: null,
- xLinkTitle: null,
- xLinkType: null
- }
-});
-
-// node_modules/property-information/lib/xml.js
-var xml = create2({
- space: "xml",
- transform(_15, prop2) {
- return "xml:" + prop2.slice(3).toLowerCase();
- },
- properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
-});
-
-// node_modules/property-information/lib/util/case-sensitive-transform.js
-function caseSensitiveTransform(attributes, attribute) {
- return attribute in attributes ? attributes[attribute] : attribute;
-}
-
-// node_modules/property-information/lib/util/case-insensitive-transform.js
-function caseInsensitiveTransform(attributes, property) {
- return caseSensitiveTransform(attributes, property.toLowerCase());
-}
-
-// node_modules/property-information/lib/xmlns.js
-var xmlns = create2({
- space: "xmlns",
- attributes: { xmlnsxlink: "xmlns:xlink" },
- transform: caseInsensitiveTransform,
- properties: { xmlns: null, xmlnsXLink: null }
-});
-
-// node_modules/property-information/lib/aria.js
-var aria = create2({
- transform(_15, prop2) {
- return prop2 === "role" ? prop2 : "aria-" + prop2.slice(4).toLowerCase();
- },
- properties: {
- ariaActiveDescendant: null,
- ariaAtomic: booleanish,
- ariaAutoComplete: null,
- ariaBusy: booleanish,
- ariaChecked: booleanish,
- ariaColCount: number4,
- ariaColIndex: number4,
- ariaColSpan: number4,
- ariaControls: spaceSeparated,
- ariaCurrent: null,
- ariaDescribedBy: spaceSeparated,
- ariaDetails: null,
- ariaDisabled: booleanish,
- ariaDropEffect: spaceSeparated,
- ariaErrorMessage: null,
- ariaExpanded: booleanish,
- ariaFlowTo: spaceSeparated,
- ariaGrabbed: booleanish,
- ariaHasPopup: null,
- ariaHidden: booleanish,
- ariaInvalid: null,
- ariaKeyShortcuts: null,
- ariaLabel: null,
- ariaLabelledBy: spaceSeparated,
- ariaLevel: number4,
- ariaLive: null,
- ariaModal: booleanish,
- ariaMultiLine: booleanish,
- ariaMultiSelectable: booleanish,
- ariaOrientation: null,
- ariaOwns: spaceSeparated,
- ariaPlaceholder: null,
- ariaPosInSet: number4,
- ariaPressed: booleanish,
- ariaReadOnly: booleanish,
- ariaRelevant: null,
- ariaRequired: booleanish,
- ariaRoleDescription: spaceSeparated,
- ariaRowCount: number4,
- ariaRowIndex: number4,
- ariaRowSpan: number4,
- ariaSelected: booleanish,
- ariaSetSize: number4,
- ariaSort: null,
- ariaValueMax: number4,
- ariaValueMin: number4,
- ariaValueNow: number4,
- ariaValueText: null,
- role: null
- }
-});
-
-// node_modules/property-information/lib/html.js
-var html2 = create2({
- space: "html",
- attributes: {
- acceptcharset: "accept-charset",
- classname: "class",
- htmlfor: "for",
- httpequiv: "http-equiv"
- },
- transform: caseInsensitiveTransform,
- mustUseProperty: ["checked", "multiple", "muted", "selected"],
- properties: {
- abbr: null,
- accept: commaSeparated,
- acceptCharset: spaceSeparated,
- accessKey: spaceSeparated,
- action: null,
- allow: null,
- allowFullScreen: boolean2,
- allowPaymentRequest: boolean2,
- allowUserMedia: boolean2,
- alt: null,
- as: null,
- async: boolean2,
- autoCapitalize: null,
- autoComplete: spaceSeparated,
- autoFocus: boolean2,
- autoPlay: boolean2,
- blocking: spaceSeparated,
- capture: null,
- charSet: null,
- checked: boolean2,
- cite: null,
- className: spaceSeparated,
- cols: number4,
- colSpan: null,
- content: null,
- contentEditable: booleanish,
- controls: boolean2,
- controlsList: spaceSeparated,
- coords: number4 | commaSeparated,
- crossOrigin: null,
- data: null,
- dateTime: null,
- decoding: null,
- default: boolean2,
- defer: boolean2,
- dir: null,
- dirName: null,
- disabled: boolean2,
- download: overloadedBoolean,
- draggable: booleanish,
- encType: null,
- enterKeyHint: null,
- fetchPriority: null,
- form: null,
- formAction: null,
- formEncType: null,
- formMethod: null,
- formNoValidate: boolean2,
- formTarget: null,
- headers: spaceSeparated,
- height: number4,
- hidden: boolean2,
- high: number4,
- href: null,
- hrefLang: null,
- htmlFor: spaceSeparated,
- httpEquiv: spaceSeparated,
- id: null,
- imageSizes: null,
- imageSrcSet: null,
- inert: boolean2,
- inputMode: null,
- integrity: null,
- is: null,
- isMap: boolean2,
- itemId: null,
- itemProp: spaceSeparated,
- itemRef: spaceSeparated,
- itemScope: boolean2,
- itemType: spaceSeparated,
- kind: null,
- label: null,
- lang: null,
- language: null,
- list: null,
- loading: null,
- loop: boolean2,
- low: number4,
- manifest: null,
- max: null,
- maxLength: number4,
- media: null,
- method: null,
- min: null,
- minLength: number4,
- multiple: boolean2,
- muted: boolean2,
- name: null,
- nonce: null,
- noModule: boolean2,
- noValidate: boolean2,
- onAbort: null,
- onAfterPrint: null,
- onAuxClick: null,
- onBeforeMatch: null,
- onBeforePrint: null,
- onBeforeToggle: null,
- onBeforeUnload: null,
- onBlur: null,
- onCancel: null,
- onCanPlay: null,
- onCanPlayThrough: null,
- onChange: null,
- onClick: null,
- onClose: null,
- onContextLost: null,
- onContextMenu: null,
- onContextRestored: null,
- onCopy: null,
- onCueChange: null,
- onCut: null,
- onDblClick: null,
- onDrag: null,
- onDragEnd: null,
- onDragEnter: null,
- onDragExit: null,
- onDragLeave: null,
- onDragOver: null,
- onDragStart: null,
- onDrop: null,
- onDurationChange: null,
- onEmptied: null,
- onEnded: null,
- onError: null,
- onFocus: null,
- onFormData: null,
- onHashChange: null,
- onInput: null,
- onInvalid: null,
- onKeyDown: null,
- onKeyPress: null,
- onKeyUp: null,
- onLanguageChange: null,
- onLoad: null,
- onLoadedData: null,
- onLoadedMetadata: null,
- onLoadEnd: null,
- onLoadStart: null,
- onMessage: null,
- onMessageError: null,
- onMouseDown: null,
- onMouseEnter: null,
- onMouseLeave: null,
- onMouseMove: null,
- onMouseOut: null,
- onMouseOver: null,
- onMouseUp: null,
- onOffline: null,
- onOnline: null,
- onPageHide: null,
- onPageShow: null,
- onPaste: null,
- onPause: null,
- onPlay: null,
- onPlaying: null,
- onPopState: null,
- onProgress: null,
- onRateChange: null,
- onRejectionHandled: null,
- onReset: null,
- onResize: null,
- onScroll: null,
- onScrollEnd: null,
- onSecurityPolicyViolation: null,
- onSeeked: null,
- onSeeking: null,
- onSelect: null,
- onSlotChange: null,
- onStalled: null,
- onStorage: null,
- onSubmit: null,
- onSuspend: null,
- onTimeUpdate: null,
- onToggle: null,
- onUnhandledRejection: null,
- onUnload: null,
- onVolumeChange: null,
- onWaiting: null,
- onWheel: null,
- open: boolean2,
- optimum: number4,
- pattern: null,
- ping: spaceSeparated,
- placeholder: null,
- playsInline: boolean2,
- popover: null,
- popoverTarget: null,
- popoverTargetAction: null,
- poster: null,
- preload: null,
- readOnly: boolean2,
- referrerPolicy: null,
- rel: spaceSeparated,
- required: boolean2,
- reversed: boolean2,
- rows: number4,
- rowSpan: number4,
- sandbox: spaceSeparated,
- scope: null,
- scoped: boolean2,
- seamless: boolean2,
- selected: boolean2,
- shadowRootDelegatesFocus: boolean2,
- shadowRootMode: null,
- shape: null,
- size: number4,
- sizes: null,
- slot: null,
- span: number4,
- spellCheck: booleanish,
- src: null,
- srcDoc: null,
- srcLang: null,
- srcSet: null,
- start: number4,
- step: null,
- style: null,
- tabIndex: number4,
- target: null,
- title: null,
- translate: null,
- type: null,
- typeMustMatch: boolean2,
- useMap: null,
- value: booleanish,
- width: number4,
- wrap: null,
- align: null,
- aLink: null,
- archive: spaceSeparated,
- axis: null,
- background: null,
- bgColor: null,
- border: number4,
- borderColor: null,
- bottomMargin: number4,
- cellPadding: null,
- cellSpacing: null,
- char: null,
- charOff: null,
- classId: null,
- clear: null,
- code: null,
- codeBase: null,
- codeType: null,
- color: null,
- compact: boolean2,
- declare: boolean2,
- event: null,
- face: null,
- frame: null,
- frameBorder: null,
- hSpace: number4,
- leftMargin: number4,
- link: null,
- longDesc: null,
- lowSrc: null,
- marginHeight: number4,
- marginWidth: number4,
- noResize: boolean2,
- noHref: boolean2,
- noShade: boolean2,
- noWrap: boolean2,
- object: null,
- profile: null,
- prompt: null,
- rev: null,
- rightMargin: number4,
- rules: null,
- scheme: null,
- scrolling: booleanish,
- standby: null,
- summary: null,
- text: null,
- topMargin: number4,
- valueType: null,
- version: null,
- vAlign: null,
- vLink: null,
- vSpace: number4,
- allowTransparency: null,
- autoCorrect: null,
- autoSave: null,
- disablePictureInPicture: boolean2,
- disableRemotePlayback: boolean2,
- prefix: null,
- property: null,
- results: number4,
- security: null,
- unselectable: null
- }
-});
-
-// node_modules/property-information/lib/svg.js
-var svg = create2({
- space: "svg",
- attributes: {
- accentHeight: "accent-height",
- alignmentBaseline: "alignment-baseline",
- arabicForm: "arabic-form",
- baselineShift: "baseline-shift",
- capHeight: "cap-height",
- className: "class",
- clipPath: "clip-path",
- clipRule: "clip-rule",
- colorInterpolation: "color-interpolation",
- colorInterpolationFilters: "color-interpolation-filters",
- colorProfile: "color-profile",
- colorRendering: "color-rendering",
- crossOrigin: "crossorigin",
- dataType: "datatype",
- dominantBaseline: "dominant-baseline",
- enableBackground: "enable-background",
- fillOpacity: "fill-opacity",
- fillRule: "fill-rule",
- floodColor: "flood-color",
- floodOpacity: "flood-opacity",
- fontFamily: "font-family",
- fontSize: "font-size",
- fontSizeAdjust: "font-size-adjust",
- fontStretch: "font-stretch",
- fontStyle: "font-style",
- fontVariant: "font-variant",
- fontWeight: "font-weight",
- glyphName: "glyph-name",
- glyphOrientationHorizontal: "glyph-orientation-horizontal",
- glyphOrientationVertical: "glyph-orientation-vertical",
- hrefLang: "hreflang",
- horizAdvX: "horiz-adv-x",
- horizOriginX: "horiz-origin-x",
- horizOriginY: "horiz-origin-y",
- imageRendering: "image-rendering",
- letterSpacing: "letter-spacing",
- lightingColor: "lighting-color",
- markerEnd: "marker-end",
- markerMid: "marker-mid",
- markerStart: "marker-start",
- navDown: "nav-down",
- navDownLeft: "nav-down-left",
- navDownRight: "nav-down-right",
- navLeft: "nav-left",
- navNext: "nav-next",
- navPrev: "nav-prev",
- navRight: "nav-right",
- navUp: "nav-up",
- navUpLeft: "nav-up-left",
- navUpRight: "nav-up-right",
- onAbort: "onabort",
- onActivate: "onactivate",
- onAfterPrint: "onafterprint",
- onBeforePrint: "onbeforeprint",
- onBegin: "onbegin",
- onCancel: "oncancel",
- onCanPlay: "oncanplay",
- onCanPlayThrough: "oncanplaythrough",
- onChange: "onchange",
- onClick: "onclick",
- onClose: "onclose",
- onCopy: "oncopy",
- onCueChange: "oncuechange",
- onCut: "oncut",
- onDblClick: "ondblclick",
- onDrag: "ondrag",
- onDragEnd: "ondragend",
- onDragEnter: "ondragenter",
- onDragExit: "ondragexit",
- onDragLeave: "ondragleave",
- onDragOver: "ondragover",
- onDragStart: "ondragstart",
- onDrop: "ondrop",
- onDurationChange: "ondurationchange",
- onEmptied: "onemptied",
- onEnd: "onend",
- onEnded: "onended",
- onError: "onerror",
- onFocus: "onfocus",
- onFocusIn: "onfocusin",
- onFocusOut: "onfocusout",
- onHashChange: "onhashchange",
- onInput: "oninput",
- onInvalid: "oninvalid",
- onKeyDown: "onkeydown",
- onKeyPress: "onkeypress",
- onKeyUp: "onkeyup",
- onLoad: "onload",
- onLoadedData: "onloadeddata",
- onLoadedMetadata: "onloadedmetadata",
- onLoadStart: "onloadstart",
- onMessage: "onmessage",
- onMouseDown: "onmousedown",
- onMouseEnter: "onmouseenter",
- onMouseLeave: "onmouseleave",
- onMouseMove: "onmousemove",
- onMouseOut: "onmouseout",
- onMouseOver: "onmouseover",
- onMouseUp: "onmouseup",
- onMouseWheel: "onmousewheel",
- onOffline: "onoffline",
- onOnline: "ononline",
- onPageHide: "onpagehide",
- onPageShow: "onpageshow",
- onPaste: "onpaste",
- onPause: "onpause",
- onPlay: "onplay",
- onPlaying: "onplaying",
- onPopState: "onpopstate",
- onProgress: "onprogress",
- onRateChange: "onratechange",
- onRepeat: "onrepeat",
- onReset: "onreset",
- onResize: "onresize",
- onScroll: "onscroll",
- onSeeked: "onseeked",
- onSeeking: "onseeking",
- onSelect: "onselect",
- onShow: "onshow",
- onStalled: "onstalled",
- onStorage: "onstorage",
- onSubmit: "onsubmit",
- onSuspend: "onsuspend",
- onTimeUpdate: "ontimeupdate",
- onToggle: "ontoggle",
- onUnload: "onunload",
- onVolumeChange: "onvolumechange",
- onWaiting: "onwaiting",
- onZoom: "onzoom",
- overlinePosition: "overline-position",
- overlineThickness: "overline-thickness",
- paintOrder: "paint-order",
- panose1: "panose-1",
- pointerEvents: "pointer-events",
- referrerPolicy: "referrerpolicy",
- renderingIntent: "rendering-intent",
- shapeRendering: "shape-rendering",
- stopColor: "stop-color",
- stopOpacity: "stop-opacity",
- strikethroughPosition: "strikethrough-position",
- strikethroughThickness: "strikethrough-thickness",
- strokeDashArray: "stroke-dasharray",
- strokeDashOffset: "stroke-dashoffset",
- strokeLineCap: "stroke-linecap",
- strokeLineJoin: "stroke-linejoin",
- strokeMiterLimit: "stroke-miterlimit",
- strokeOpacity: "stroke-opacity",
- strokeWidth: "stroke-width",
- tabIndex: "tabindex",
- textAnchor: "text-anchor",
- textDecoration: "text-decoration",
- textRendering: "text-rendering",
- transformOrigin: "transform-origin",
- typeOf: "typeof",
- underlinePosition: "underline-position",
- underlineThickness: "underline-thickness",
- unicodeBidi: "unicode-bidi",
- unicodeRange: "unicode-range",
- unitsPerEm: "units-per-em",
- vAlphabetic: "v-alphabetic",
- vHanging: "v-hanging",
- vIdeographic: "v-ideographic",
- vMathematical: "v-mathematical",
- vectorEffect: "vector-effect",
- vertAdvY: "vert-adv-y",
- vertOriginX: "vert-origin-x",
- vertOriginY: "vert-origin-y",
- wordSpacing: "word-spacing",
- writingMode: "writing-mode",
- xHeight: "x-height",
- playbackOrder: "playbackorder",
- timelineBegin: "timelinebegin"
- },
- transform: caseSensitiveTransform,
- properties: {
- about: commaOrSpaceSeparated,
- accentHeight: number4,
- accumulate: null,
- additive: null,
- alignmentBaseline: null,
- alphabetic: number4,
- amplitude: number4,
- arabicForm: null,
- ascent: number4,
- attributeName: null,
- attributeType: null,
- azimuth: number4,
- bandwidth: null,
- baselineShift: null,
- baseFrequency: null,
- baseProfile: null,
- bbox: null,
- begin: null,
- bias: number4,
- by: null,
- calcMode: null,
- capHeight: number4,
- className: spaceSeparated,
- clip: null,
- clipPath: null,
- clipPathUnits: null,
- clipRule: null,
- color: null,
- colorInterpolation: null,
- colorInterpolationFilters: null,
- colorProfile: null,
- colorRendering: null,
- content: null,
- contentScriptType: null,
- contentStyleType: null,
- crossOrigin: null,
- cursor: null,
- cx: null,
- cy: null,
- d: null,
- dataType: null,
- defaultAction: null,
- descent: number4,
- diffuseConstant: number4,
- direction: null,
- display: null,
- dur: null,
- divisor: number4,
- dominantBaseline: null,
- download: boolean2,
- dx: null,
- dy: null,
- edgeMode: null,
- editable: null,
- elevation: number4,
- enableBackground: null,
- end: null,
- event: null,
- exponent: number4,
- externalResourcesRequired: null,
- fill: null,
- fillOpacity: number4,
- fillRule: null,
- filter: null,
- filterRes: null,
- filterUnits: null,
- floodColor: null,
- floodOpacity: null,
- focusable: null,
- focusHighlight: null,
- fontFamily: null,
- fontSize: null,
- fontSizeAdjust: null,
- fontStretch: null,
- fontStyle: null,
- fontVariant: null,
- fontWeight: null,
- format: null,
- fr: null,
- from: null,
- fx: null,
- fy: null,
- g1: commaSeparated,
- g2: commaSeparated,
- glyphName: commaSeparated,
- glyphOrientationHorizontal: null,
- glyphOrientationVertical: null,
- glyphRef: null,
- gradientTransform: null,
- gradientUnits: null,
- handler: null,
- hanging: number4,
- hatchContentUnits: null,
- hatchUnits: null,
- height: null,
- href: null,
- hrefLang: null,
- horizAdvX: number4,
- horizOriginX: number4,
- horizOriginY: number4,
- id: null,
- ideographic: number4,
- imageRendering: null,
- initialVisibility: null,
- in: null,
- in2: null,
- intercept: number4,
- k: number4,
- k1: number4,
- k2: number4,
- k3: number4,
- k4: number4,
- kernelMatrix: commaOrSpaceSeparated,
- kernelUnitLength: null,
- keyPoints: null,
- keySplines: null,
- keyTimes: null,
- kerning: null,
- lang: null,
- lengthAdjust: null,
- letterSpacing: null,
- lightingColor: null,
- limitingConeAngle: number4,
- local: null,
- markerEnd: null,
- markerMid: null,
- markerStart: null,
- markerHeight: null,
- markerUnits: null,
- markerWidth: null,
- mask: null,
- maskContentUnits: null,
- maskUnits: null,
- mathematical: null,
- max: null,
- media: null,
- mediaCharacterEncoding: null,
- mediaContentEncodings: null,
- mediaSize: number4,
- mediaTime: null,
- method: null,
- min: null,
- mode: null,
- name: null,
- navDown: null,
- navDownLeft: null,
- navDownRight: null,
- navLeft: null,
- navNext: null,
- navPrev: null,
- navRight: null,
- navUp: null,
- navUpLeft: null,
- navUpRight: null,
- numOctaves: null,
- observer: null,
- offset: null,
- onAbort: null,
- onActivate: null,
- onAfterPrint: null,
- onBeforePrint: null,
- onBegin: null,
- onCancel: null,
- onCanPlay: null,
- onCanPlayThrough: null,
- onChange: null,
- onClick: null,
- onClose: null,
- onCopy: null,
- onCueChange: null,
- onCut: null,
- onDblClick: null,
- onDrag: null,
- onDragEnd: null,
- onDragEnter: null,
- onDragExit: null,
- onDragLeave: null,
- onDragOver: null,
- onDragStart: null,
- onDrop: null,
- onDurationChange: null,
- onEmptied: null,
- onEnd: null,
- onEnded: null,
- onError: null,
- onFocus: null,
- onFocusIn: null,
- onFocusOut: null,
- onHashChange: null,
- onInput: null,
- onInvalid: null,
- onKeyDown: null,
- onKeyPress: null,
- onKeyUp: null,
- onLoad: null,
- onLoadedData: null,
- onLoadedMetadata: null,
- onLoadStart: null,
- onMessage: null,
- onMouseDown: null,
- onMouseEnter: null,
- onMouseLeave: null,
- onMouseMove: null,
- onMouseOut: null,
- onMouseOver: null,
- onMouseUp: null,
- onMouseWheel: null,
- onOffline: null,
- onOnline: null,
- onPageHide: null,
- onPageShow: null,
- onPaste: null,
- onPause: null,
- onPlay: null,
- onPlaying: null,
- onPopState: null,
- onProgress: null,
- onRateChange: null,
- onRepeat: null,
- onReset: null,
- onResize: null,
- onScroll: null,
- onSeeked: null,
- onSeeking: null,
- onSelect: null,
- onShow: null,
- onStalled: null,
- onStorage: null,
- onSubmit: null,
- onSuspend: null,
- onTimeUpdate: null,
- onToggle: null,
- onUnload: null,
- onVolumeChange: null,
- onWaiting: null,
- onZoom: null,
- opacity: null,
- operator: null,
- order: null,
- orient: null,
- orientation: null,
- origin: null,
- overflow: null,
- overlay: null,
- overlinePosition: number4,
- overlineThickness: number4,
- paintOrder: null,
- panose1: null,
- path: null,
- pathLength: number4,
- patternContentUnits: null,
- patternTransform: null,
- patternUnits: null,
- phase: null,
- ping: spaceSeparated,
- pitch: null,
- playbackOrder: null,
- pointerEvents: null,
- points: null,
- pointsAtX: number4,
- pointsAtY: number4,
- pointsAtZ: number4,
- preserveAlpha: null,
- preserveAspectRatio: null,
- primitiveUnits: null,
- propagate: null,
- property: commaOrSpaceSeparated,
- r: null,
- radius: null,
- referrerPolicy: null,
- refX: null,
- refY: null,
- rel: commaOrSpaceSeparated,
- rev: commaOrSpaceSeparated,
- renderingIntent: null,
- repeatCount: null,
- repeatDur: null,
- requiredExtensions: commaOrSpaceSeparated,
- requiredFeatures: commaOrSpaceSeparated,
- requiredFonts: commaOrSpaceSeparated,
- requiredFormats: commaOrSpaceSeparated,
- resource: null,
- restart: null,
- result: null,
- rotate: null,
- rx: null,
- ry: null,
- scale: null,
- seed: null,
- shapeRendering: null,
- side: null,
- slope: null,
- snapshotTime: null,
- specularConstant: number4,
- specularExponent: number4,
- spreadMethod: null,
- spacing: null,
- startOffset: null,
- stdDeviation: null,
- stemh: null,
- stemv: null,
- stitchTiles: null,
- stopColor: null,
- stopOpacity: null,
- strikethroughPosition: number4,
- strikethroughThickness: number4,
- string: null,
- stroke: null,
- strokeDashArray: commaOrSpaceSeparated,
- strokeDashOffset: null,
- strokeLineCap: null,
- strokeLineJoin: null,
- strokeMiterLimit: number4,
- strokeOpacity: number4,
- strokeWidth: null,
- style: null,
- surfaceScale: number4,
- syncBehavior: null,
- syncBehaviorDefault: null,
- syncMaster: null,
- syncTolerance: null,
- syncToleranceDefault: null,
- systemLanguage: commaOrSpaceSeparated,
- tabIndex: number4,
- tableValues: null,
- target: null,
- targetX: number4,
- targetY: number4,
- textAnchor: null,
- textDecoration: null,
- textRendering: null,
- textLength: null,
- timelineBegin: null,
- title: null,
- transformBehavior: null,
- type: null,
- typeOf: commaOrSpaceSeparated,
- to: null,
- transform: null,
- transformOrigin: null,
- u1: null,
- u2: null,
- underlinePosition: number4,
- underlineThickness: number4,
- unicode: null,
- unicodeBidi: null,
- unicodeRange: null,
- unitsPerEm: number4,
- values: null,
- vAlphabetic: number4,
- vMathematical: number4,
- vectorEffect: null,
- vHanging: number4,
- vIdeographic: number4,
- version: null,
- vertAdvY: number4,
- vertOriginX: number4,
- vertOriginY: number4,
- viewBox: null,
- viewTarget: null,
- visibility: null,
- width: null,
- widths: null,
- wordSpacing: null,
- writingMode: null,
- x: null,
- x1: null,
- x2: null,
- xChannelSelector: null,
- xHeight: number4,
- y: null,
- y1: null,
- y2: null,
- yChannelSelector: null,
- z: null,
- zoomAndPan: null
- }
-});
-
-// node_modules/property-information/lib/find.js
-var valid = /^data[-\w.:]+$/i;
-var dash = /-[a-z]/g;
-var cap = /[A-Z]/g;
-function find2(schema, value) {
- const normal = normalize2(value);
- let prop2 = value;
- let Type = Info;
- if (normal in schema.normal) {
- return schema.property[schema.normal[normal]];
- }
- if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) {
- if (value.charAt(4) === "-") {
- const rest = value.slice(5).replace(dash, camelcase);
- prop2 = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
- } else {
- const rest = value.slice(4);
- if (!dash.test(rest)) {
- let dashes = rest.replace(cap, kebab);
- if (dashes.charAt(0) !== "-") {
- dashes = "-" + dashes;
+ }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
+ var onDropCb = (0, import_react108.useCallback)(function(event) {
+ event.preventDefault();
+ event.persist();
+ stopPropagation2(event);
+ dragTargetsRef.current = [];
+ if (isEvtWithFiles(event)) {
+ Promise.resolve(getFilesFromEvent(event)).then(function(files) {
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
+ return;
}
- value = "data" + dashes;
- }
+ setFiles(files, event);
+ }).catch(function(e5) {
+ return onErrCb(e5);
+ });
}
- Type = DefinedInfo;
- }
- return new Type(prop2, value);
-}
-function kebab($0) {
- return "-" + $0.toLowerCase();
-}
-function camelcase($0) {
- return $0.charAt(1).toUpperCase();
-}
-
-// node_modules/property-information/index.js
-var html3 = merge([xml, xlink, xmlns, aria, html2], "html");
-var svg2 = merge([xml, xlink, xmlns, aria, svg], "svg");
-
-// node_modules/html-void-elements/index.js
-var htmlVoidElements = [
- "area",
- "base",
- "basefont",
- "bgsound",
- "br",
- "col",
- "command",
- "embed",
- "frame",
- "hr",
- "image",
- "img",
- "input",
- "isindex",
- "keygen",
- "link",
- "menuitem",
- "meta",
- "nextid",
- "param",
- "source",
- "track",
- "wbr"
-];
-
-// node_modules/stringify-entities/lib/core.js
-function core(value, options) {
- value = value.replace(
- options.subset ? charactersToExpression(options.subset) : /["&'<>`]/g,
- basic2
- );
- if (options.subset || options.escapeOnly) {
- return value;
- }
- return value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, surrogate).replace(
- /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,
- basic2
- );
- function surrogate(pair2, index3, all6) {
- return options.format(
- (pair2.charCodeAt(0) - 55296) * 1024 + pair2.charCodeAt(1) - 56320 + 65536,
- all6.charCodeAt(index3 + 2),
- options
- );
- }
- function basic2(character, index3, all6) {
- return options.format(
- character.charCodeAt(0),
- all6.charCodeAt(index3 + 1),
- options
- );
- }
-}
-function charactersToExpression(subset2) {
- const groups = [];
- let index3 = -1;
- while (++index3 < subset2.length) {
- groups.push(subset2[index3].replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"));
- }
- return new RegExp("(?:" + groups.join("|") + ")", "g");
-}
-
-// node_modules/stringify-entities/lib/util/to-hexadecimal.js
-function toHexadecimal(code3, next, omit) {
- const value = "" + code3.toString(16).toUpperCase();
- return omit && next && !/[\dA-Fa-f]/.test(String.fromCharCode(next)) ? value : value + ";";
-}
-
-// node_modules/stringify-entities/lib/util/to-decimal.js
-function toDecimal(code3, next, omit) {
- const value = "" + String(code3);
- return omit && next && !/\d/.test(String.fromCharCode(next)) ? value : value + ";";
-}
-
-// node_modules/character-entities-legacy/index.js
-var characterEntitiesLegacy = [
- "AElig",
- "AMP",
- "Aacute",
- "Acirc",
- "Agrave",
- "Aring",
- "Atilde",
- "Auml",
- "COPY",
- "Ccedil",
- "ETH",
- "Eacute",
- "Ecirc",
- "Egrave",
- "Euml",
- "GT",
- "Iacute",
- "Icirc",
- "Igrave",
- "Iuml",
- "LT",
- "Ntilde",
- "Oacute",
- "Ocirc",
- "Ograve",
- "Oslash",
- "Otilde",
- "Ouml",
- "QUOT",
- "REG",
- "THORN",
- "Uacute",
- "Ucirc",
- "Ugrave",
- "Uuml",
- "Yacute",
- "aacute",
- "acirc",
- "acute",
- "aelig",
- "agrave",
- "amp",
- "aring",
- "atilde",
- "auml",
- "brvbar",
- "ccedil",
- "cedil",
- "cent",
- "copy",
- "curren",
- "deg",
- "divide",
- "eacute",
- "ecirc",
- "egrave",
- "eth",
- "euml",
- "frac12",
- "frac14",
- "frac34",
- "gt",
- "iacute",
- "icirc",
- "iexcl",
- "igrave",
- "iquest",
- "iuml",
- "laquo",
- "lt",
- "macr",
- "micro",
- "middot",
- "nbsp",
- "not",
- "ntilde",
- "oacute",
- "ocirc",
- "ograve",
- "ordf",
- "ordm",
- "oslash",
- "otilde",
- "ouml",
- "para",
- "plusmn",
- "pound",
- "quot",
- "raquo",
- "reg",
- "sect",
- "shy",
- "sup1",
- "sup2",
- "sup3",
- "szlig",
- "thorn",
- "times",
- "uacute",
- "ucirc",
- "ugrave",
- "uml",
- "uuml",
- "yacute",
- "yen",
- "yuml"
-];
-
-// node_modules/character-entities-html4/index.js
-var characterEntitiesHtml4 = {
- nbsp: "\xA0",
- iexcl: "\xA1",
- cent: "\xA2",
- pound: "\xA3",
- curren: "\xA4",
- yen: "\xA5",
- brvbar: "\xA6",
- sect: "\xA7",
- uml: "\xA8",
- copy: "\xA9",
- ordf: "\xAA",
- laquo: "\xAB",
- not: "\xAC",
- shy: "\xAD",
- reg: "\xAE",
- macr: "\xAF",
- deg: "\xB0",
- plusmn: "\xB1",
- sup2: "\xB2",
- sup3: "\xB3",
- acute: "\xB4",
- micro: "\xB5",
- para: "\xB6",
- middot: "\xB7",
- cedil: "\xB8",
- sup1: "\xB9",
- ordm: "\xBA",
- raquo: "\xBB",
- frac14: "\xBC",
- frac12: "\xBD",
- frac34: "\xBE",
- iquest: "\xBF",
- Agrave: "\xC0",
- Aacute: "\xC1",
- Acirc: "\xC2",
- Atilde: "\xC3",
- Auml: "\xC4",
- Aring: "\xC5",
- AElig: "\xC6",
- Ccedil: "\xC7",
- Egrave: "\xC8",
- Eacute: "\xC9",
- Ecirc: "\xCA",
- Euml: "\xCB",
- Igrave: "\xCC",
- Iacute: "\xCD",
- Icirc: "\xCE",
- Iuml: "\xCF",
- ETH: "\xD0",
- Ntilde: "\xD1",
- Ograve: "\xD2",
- Oacute: "\xD3",
- Ocirc: "\xD4",
- Otilde: "\xD5",
- Ouml: "\xD6",
- times: "\xD7",
- Oslash: "\xD8",
- Ugrave: "\xD9",
- Uacute: "\xDA",
- Ucirc: "\xDB",
- Uuml: "\xDC",
- Yacute: "\xDD",
- THORN: "\xDE",
- szlig: "\xDF",
- agrave: "\xE0",
- aacute: "\xE1",
- acirc: "\xE2",
- atilde: "\xE3",
- auml: "\xE4",
- aring: "\xE5",
- aelig: "\xE6",
- ccedil: "\xE7",
- egrave: "\xE8",
- eacute: "\xE9",
- ecirc: "\xEA",
- euml: "\xEB",
- igrave: "\xEC",
- iacute: "\xED",
- icirc: "\xEE",
- iuml: "\xEF",
- eth: "\xF0",
- ntilde: "\xF1",
- ograve: "\xF2",
- oacute: "\xF3",
- ocirc: "\xF4",
- otilde: "\xF5",
- ouml: "\xF6",
- divide: "\xF7",
- oslash: "\xF8",
- ugrave: "\xF9",
- uacute: "\xFA",
- ucirc: "\xFB",
- uuml: "\xFC",
- yacute: "\xFD",
- thorn: "\xFE",
- yuml: "\xFF",
- fnof: "\u0192",
- Alpha: "\u0391",
- Beta: "\u0392",
- Gamma: "\u0393",
- Delta: "\u0394",
- Epsilon: "\u0395",
- Zeta: "\u0396",
- Eta: "\u0397",
- Theta: "\u0398",
- Iota: "\u0399",
- Kappa: "\u039A",
- Lambda: "\u039B",
- Mu: "\u039C",
- Nu: "\u039D",
- Xi: "\u039E",
- Omicron: "\u039F",
- Pi: "\u03A0",
- Rho: "\u03A1",
- Sigma: "\u03A3",
- Tau: "\u03A4",
- Upsilon: "\u03A5",
- Phi: "\u03A6",
- Chi: "\u03A7",
- Psi: "\u03A8",
- Omega: "\u03A9",
- alpha: "\u03B1",
- beta: "\u03B2",
- gamma: "\u03B3",
- delta: "\u03B4",
- epsilon: "\u03B5",
- zeta: "\u03B6",
- eta: "\u03B7",
- theta: "\u03B8",
- iota: "\u03B9",
- kappa: "\u03BA",
- lambda: "\u03BB",
- mu: "\u03BC",
- nu: "\u03BD",
- xi: "\u03BE",
- omicron: "\u03BF",
- pi: "\u03C0",
- rho: "\u03C1",
- sigmaf: "\u03C2",
- sigma: "\u03C3",
- tau: "\u03C4",
- upsilon: "\u03C5",
- phi: "\u03C6",
- chi: "\u03C7",
- psi: "\u03C8",
- omega: "\u03C9",
- thetasym: "\u03D1",
- upsih: "\u03D2",
- piv: "\u03D6",
- bull: "\u2022",
- hellip: "\u2026",
- prime: "\u2032",
- Prime: "\u2033",
- oline: "\u203E",
- frasl: "\u2044",
- weierp: "\u2118",
- image: "\u2111",
- real: "\u211C",
- trade: "\u2122",
- alefsym: "\u2135",
- larr: "\u2190",
- uarr: "\u2191",
- rarr: "\u2192",
- darr: "\u2193",
- harr: "\u2194",
- crarr: "\u21B5",
- lArr: "\u21D0",
- uArr: "\u21D1",
- rArr: "\u21D2",
- dArr: "\u21D3",
- hArr: "\u21D4",
- forall: "\u2200",
- part: "\u2202",
- exist: "\u2203",
- empty: "\u2205",
- nabla: "\u2207",
- isin: "\u2208",
- notin: "\u2209",
- ni: "\u220B",
- prod: "\u220F",
- sum: "\u2211",
- minus: "\u2212",
- lowast: "\u2217",
- radic: "\u221A",
- prop: "\u221D",
- infin: "\u221E",
- ang: "\u2220",
- and: "\u2227",
- or: "\u2228",
- cap: "\u2229",
- cup: "\u222A",
- int: "\u222B",
- there4: "\u2234",
- sim: "\u223C",
- cong: "\u2245",
- asymp: "\u2248",
- ne: "\u2260",
- equiv: "\u2261",
- le: "\u2264",
- ge: "\u2265",
- sub: "\u2282",
- sup: "\u2283",
- nsub: "\u2284",
- sube: "\u2286",
- supe: "\u2287",
- oplus: "\u2295",
- otimes: "\u2297",
- perp: "\u22A5",
- sdot: "\u22C5",
- lceil: "\u2308",
- rceil: "\u2309",
- lfloor: "\u230A",
- rfloor: "\u230B",
- lang: "\u2329",
- rang: "\u232A",
- loz: "\u25CA",
- spades: "\u2660",
- clubs: "\u2663",
- hearts: "\u2665",
- diams: "\u2666",
- quot: '"',
- amp: "&",
- lt: "<",
- gt: ">",
- OElig: "\u0152",
- oelig: "\u0153",
- Scaron: "\u0160",
- scaron: "\u0161",
- Yuml: "\u0178",
- circ: "\u02C6",
- tilde: "\u02DC",
- ensp: "\u2002",
- emsp: "\u2003",
- thinsp: "\u2009",
- zwnj: "\u200C",
- zwj: "\u200D",
- lrm: "\u200E",
- rlm: "\u200F",
- ndash: "\u2013",
- mdash: "\u2014",
- lsquo: "\u2018",
- rsquo: "\u2019",
- sbquo: "\u201A",
- ldquo: "\u201C",
- rdquo: "\u201D",
- bdquo: "\u201E",
- dagger: "\u2020",
- Dagger: "\u2021",
- permil: "\u2030",
- lsaquo: "\u2039",
- rsaquo: "\u203A",
- euro: "\u20AC"
-};
-
-// node_modules/stringify-entities/lib/constant/dangerous.js
-var dangerous = [
- "cent",
- "copy",
- "divide",
- "gt",
- "lt",
- "not",
- "para",
- "times"
-];
-
-// node_modules/stringify-entities/lib/util/to-named.js
-var own5 = {}.hasOwnProperty;
-var characters = {};
-var key2;
-for (key2 in characterEntitiesHtml4) {
- if (own5.call(characterEntitiesHtml4, key2)) {
- characters[characterEntitiesHtml4[key2]] = key2;
- }
-}
-function toNamed(code3, next, omit, attribute) {
- const character = String.fromCharCode(code3);
- if (own5.call(characters, character)) {
- const name317 = characters[character];
- const value = "&" + name317;
- if (omit && characterEntitiesLegacy.includes(name317) && !dangerous.includes(name317) && (!attribute || next && next !== 61 && /[^\da-z]/i.test(String.fromCharCode(next)))) {
- return value;
+ dispatch({
+ type: "reset"
+ });
+ }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]);
+ var openFileDialog = (0, import_react108.useCallback)(function() {
+ if (fsAccessApiWorksRef.current) {
+ dispatch({
+ type: "openDialog"
+ });
+ onFileDialogOpenCb();
+ var opts = {
+ multiple,
+ types: pickerTypes
+ };
+ window.showOpenFilePicker(opts).then(function(handles) {
+ return getFilesFromEvent(handles);
+ }).then(function(files) {
+ setFiles(files, null);
+ dispatch({
+ type: "closeDialog"
+ });
+ }).catch(function(e5) {
+ if (isAbort(e5)) {
+ onFileDialogCancelCb(e5);
+ dispatch({
+ type: "closeDialog"
+ });
+ } else if (isSecurityError(e5)) {
+ fsAccessApiWorksRef.current = false;
+ if (inputRef.current) {
+ inputRef.current.value = null;
+ inputRef.current.click();
+ } else {
+ onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."));
+ }
+ } else {
+ onErrCb(e5);
+ }
+ });
+ return;
}
- return value + ";";
- }
- return "";
-}
-
-// node_modules/stringify-entities/lib/util/format-smart.js
-function formatSmart(code3, next, options) {
- let numeric3 = toHexadecimal(code3, next, options.omitOptionalSemicolons);
- let named;
- if (options.useNamedReferences || options.useShortestReferences) {
- named = toNamed(
- code3,
- next,
- options.omitOptionalSemicolons,
- options.attribute
- );
- }
- if ((options.useShortestReferences || !named) && options.useShortestReferences) {
- const decimal = toDecimal(code3, next, options.omitOptionalSemicolons);
- if (decimal.length < numeric3.length) {
- numeric3 = decimal;
+ if (inputRef.current) {
+ dispatch({
+ type: "openDialog"
+ });
+ onFileDialogOpenCb();
+ inputRef.current.value = null;
+ inputRef.current.click();
}
- }
- return named && (!options.useShortestReferences || named.length < numeric3.length) ? named : numeric3;
-}
-
-// node_modules/stringify-entities/lib/index.js
-function stringifyEntities(value, options) {
- return core(value, Object.assign({ format: formatSmart }, options));
-}
-
-// node_modules/hast-util-to-html/lib/handle/comment.js
-function comment3(node2, _1, _22, state) {
- return state.settings.bogusComments ? "" + stringifyEntities(
- node2.value,
- Object.assign({}, state.settings.characterReferences, { subset: [">"] })
- ) + ">" : "|--!>|";
- function encode($0) {
- return stringifyEntities(
- $0,
- Object.assign({}, state.settings.characterReferences, {
- subset: ["<", ">"]
- })
- );
- }
-}
-
-// node_modules/hast-util-to-html/lib/handle/doctype.js
-function doctype(_1, _22, _32, state) {
- return "";
-}
-
-// node_modules/ccount/index.js
-function ccount(value, character) {
- const source = String(value);
- if (typeof character !== "string") {
- throw new TypeError("Expected character");
- }
- let count3 = 0;
- let index3 = source.indexOf(character);
- while (index3 !== -1) {
- count3++;
- index3 = source.indexOf(character, index3 + character.length);
- }
- return count3;
-}
-
-// node_modules/comma-separated-tokens/index.js
-function stringify3(values2, options) {
- const settings = options || {};
- const input = values2[values2.length - 1] === "" ? [...values2, ""] : values2;
- return input.join(
- (settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
- ).trim();
-}
-
-// node_modules/space-separated-tokens/index.js
-function stringify4(values2) {
- return values2.join(" ").trim();
-}
-
-// node_modules/hast-util-whitespace/index.js
-function whitespace(thing) {
- const value = thing && typeof thing === "object" && thing.type === "text" ? thing.value || "" : thing;
- return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === "";
-}
-
-// node_modules/hast-util-to-html/lib/omission/util/siblings.js
-var siblingAfter = siblings(1);
-var siblingBefore = siblings(-1);
-function siblings(increment2) {
- return sibling;
- function sibling(parent, index3, includeWhitespace) {
- const siblings2 = parent ? parent.children : [];
- let offset2 = (index3 || 0) + increment2;
- let next = siblings2 && siblings2[offset2];
- if (!includeWhitespace) {
- while (next && whitespace(next)) {
- offset2 += increment2;
- next = siblings2[offset2];
- }
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]);
+ var onKeyDownCb = (0, import_react108.useCallback)(function(event) {
+ if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
+ return;
}
- return next;
- }
-}
-
-// node_modules/hast-util-to-html/lib/omission/omission.js
-var own6 = {}.hasOwnProperty;
-function omission(handlers2) {
- return omit;
- function omit(node2, index3, parent) {
- return own6.call(handlers2, node2.tagName) && handlers2[node2.tagName](node2, index3, parent);
- }
-}
-
-// node_modules/hast-util-to-html/lib/omission/closing.js
-var closing = omission({
- html: html4,
- head: headOrColgroupOrCaption,
- body,
- p,
- li,
- dt,
- dd,
- rt: rubyElement,
- rp: rubyElement,
- optgroup,
- option,
- menuitem,
- colgroup: headOrColgroupOrCaption,
- caption: headOrColgroupOrCaption,
- thead,
- tbody,
- tfoot,
- tr,
- td: cells,
- th: cells
-});
-function headOrColgroupOrCaption(_15, index3, parent) {
- const next = siblingAfter(parent, index3, true);
- return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0)));
-}
-function html4(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type !== "comment";
-}
-function body(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type !== "comment";
-}
-function p(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return next ? next.type === "element" && (next.tagName === "address" || next.tagName === "article" || next.tagName === "aside" || next.tagName === "blockquote" || next.tagName === "details" || next.tagName === "div" || next.tagName === "dl" || next.tagName === "fieldset" || next.tagName === "figcaption" || next.tagName === "figure" || next.tagName === "footer" || next.tagName === "form" || next.tagName === "h1" || next.tagName === "h2" || next.tagName === "h3" || next.tagName === "h4" || next.tagName === "h5" || next.tagName === "h6" || next.tagName === "header" || next.tagName === "hgroup" || next.tagName === "hr" || next.tagName === "main" || next.tagName === "menu" || next.tagName === "nav" || next.tagName === "ol" || next.tagName === "p" || next.tagName === "pre" || next.tagName === "section" || next.tagName === "table" || next.tagName === "ul") : !parent || !(parent.type === "element" && (parent.tagName === "a" || parent.tagName === "audio" || parent.tagName === "del" || parent.tagName === "ins" || parent.tagName === "map" || parent.tagName === "noscript" || parent.tagName === "video"));
-}
-function li(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && next.tagName === "li";
-}
-function dt(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return next && next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
-}
-function dd(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
-}
-function rubyElement(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && (next.tagName === "rp" || next.tagName === "rt");
-}
-function optgroup(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && next.tagName === "optgroup";
-}
-function option(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && (next.tagName === "option" || next.tagName === "optgroup");
-}
-function menuitem(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && (next.tagName === "menuitem" || next.tagName === "hr" || next.tagName === "menu");
-}
-function thead(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return next && next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
-}
-function tbody(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
-}
-function tfoot(_15, index3, parent) {
- return !siblingAfter(parent, index3);
-}
-function tr(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && next.tagName === "tr";
-}
-function cells(_15, index3, parent) {
- const next = siblingAfter(parent, index3);
- return !next || next.type === "element" && (next.tagName === "td" || next.tagName === "th");
-}
-
-// node_modules/hast-util-to-html/lib/omission/opening.js
-var opening = omission({
- html: html5,
- head,
- body: body2,
- colgroup,
- tbody: tbody2
-});
-function html5(node2) {
- const head2 = siblingAfter(node2, -1);
- return !head2 || head2.type !== "comment";
-}
-function head(node2) {
- const children = node2.children;
- const seen = [];
- let index3 = -1;
- while (++index3 < children.length) {
- const child = children[index3];
- if (child.type === "element" && (child.tagName === "title" || child.tagName === "base")) {
- if (seen.includes(child.tagName))
- return false;
- seen.push(child.tagName);
+ if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
+ event.preventDefault();
+ openFileDialog();
}
- }
- return children.length > 0;
-}
-function body2(node2) {
- const head2 = siblingAfter(node2, -1, true);
- return !head2 || head2.type !== "comment" && !(head2.type === "text" && whitespace(head2.value.charAt(0))) && !(head2.type === "element" && (head2.tagName === "meta" || head2.tagName === "link" || head2.tagName === "script" || head2.tagName === "style" || head2.tagName === "template"));
-}
-function colgroup(node2, index3, parent) {
- const previous2 = siblingBefore(parent, index3);
- const head2 = siblingAfter(node2, -1, true);
- if (parent && previous2 && previous2.type === "element" && previous2.tagName === "colgroup" && closing(previous2, parent.children.indexOf(previous2), parent)) {
- return false;
- }
- return head2 && head2.type === "element" && head2.tagName === "col";
-}
-function tbody2(node2, index3, parent) {
- const previous2 = siblingBefore(parent, index3);
- const head2 = siblingAfter(node2, -1);
- if (parent && previous2 && previous2.type === "element" && (previous2.tagName === "thead" || previous2.tagName === "tbody") && closing(previous2, parent.children.indexOf(previous2), parent)) {
- return false;
- }
- return head2 && head2.type === "element" && head2.tagName === "tr";
-}
-
-// node_modules/hast-util-to-html/lib/handle/element.js
-var constants = {
- name: [
- [" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")],
- [`\0
-\f\r "&'/<=>`.split(""), "\0 \n\f\r \"&'/<=>`".split("")]
- ],
- unquoted: [
- [" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")],
- ["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")]
- ],
- single: [
- ["&'".split(""), "\"&'`".split("")],
- ["\0&'".split(""), "\0\"&'`".split("")]
- ],
- double: [
- ['"&'.split(""), "\"&'`".split("")],
- ['\0"&'.split(""), "\0\"&'`".split("")]
- ]
-};
-function element2(node2, index3, parent, state) {
- const schema = state.schema;
- const omit = schema.space === "svg" ? false : state.settings.omitOptionalTags;
- let selfClosing = schema.space === "svg" ? state.settings.closeEmptyElements : state.settings.voids.includes(node2.tagName.toLowerCase());
- const parts = [];
- let last;
- if (schema.space === "html" && node2.tagName === "svg") {
- state.schema = svg2;
- }
- const attrs = serializeAttributes(state, node2.properties);
- const content5 = state.all(
- schema.space === "html" && node2.tagName === "template" ? node2.content : node2
- );
- state.schema = schema;
- if (content5)
- selfClosing = false;
- if (attrs || !omit || !opening(node2, index3, parent)) {
- parts.push("<", node2.tagName, attrs ? " " + attrs : "");
- if (selfClosing && (schema.space === "svg" || state.settings.closeSelfClosing)) {
- last = attrs.charAt(attrs.length - 1);
- if (!state.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
- parts.push(" ");
- }
- parts.push("/");
+ }, [rootRef, openFileDialog]);
+ var onFocusCb = (0, import_react108.useCallback)(function() {
+ dispatch({
+ type: "focus"
+ });
+ }, []);
+ var onBlurCb = (0, import_react108.useCallback)(function() {
+ dispatch({
+ type: "blur"
+ });
+ }, []);
+ var onClickCb = (0, import_react108.useCallback)(function() {
+ if (noClick) {
+ return;
}
- parts.push(">");
- }
- parts.push(content5);
- if (!selfClosing && (!omit || !closing(node2, index3, parent))) {
- parts.push("" + node2.tagName + ">");
- }
- return parts.join("");
-}
-function serializeAttributes(state, props) {
- const values2 = [];
- let index3 = -1;
- let key3;
- if (props) {
- for (key3 in props) {
- if (props[key3] !== void 0 && props[key3] !== null) {
- const value = serializeAttribute(state, key3, props[key3]);
- if (value)
- values2.push(value);
- }
+ if (isIeOrEdge()) {
+ setTimeout(openFileDialog, 0);
+ } else {
+ openFileDialog();
}
- }
- while (++index3 < values2.length) {
- const last = state.settings.tightAttributes ? values2[index3].charAt(values2[index3].length - 1) : null;
- if (index3 !== values2.length - 1 && last !== '"' && last !== "'") {
- values2[index3] += " ";
+ }, [noClick, openFileDialog]);
+ var composeHandler = function composeHandler2(fn) {
+ return disabled ? null : fn;
+ };
+ var composeKeyboardHandler = function composeKeyboardHandler2(fn) {
+ return noKeyboard ? null : composeHandler(fn);
+ };
+ var composeDragHandler = function composeDragHandler2(fn) {
+ return noDrag ? null : composeHandler(fn);
+ };
+ var stopPropagation2 = function stopPropagation3(event) {
+ if (noDragEventsBubbling) {
+ event.stopPropagation();
}
- }
- return values2.join("");
+ };
+ var getRootProps = (0, import_react108.useMemo)(function() {
+ return function() {
+ var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, role = _ref2.role, onKeyDown = _ref2.onKeyDown, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, onClick = _ref2.onClick, onDragEnter2 = _ref2.onDragEnter, onDragOver2 = _ref2.onDragOver, onDragLeave2 = _ref2.onDragLeave, onDrop2 = _ref2.onDrop, rest = _objectWithoutProperties(_ref2, _excluded3);
+ return _objectSpread5(_objectSpread5(_defineProperty3({
+ onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
+ onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
+ onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
+ onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
+ onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter2, onDragEnterCb)),
+ onDragOver: composeDragHandler(composeEventHandlers(onDragOver2, onDragOverCb)),
+ onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave2, onDragLeaveCb)),
+ onDrop: composeDragHandler(composeEventHandlers(onDrop2, onDropCb)),
+ role: typeof role === "string" && role !== "" ? role : "presentation"
+ }, refKey, rootRef), !disabled && !noKeyboard ? {
+ tabIndex: 0
+ } : {}), rest);
+ };
+ }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
+ var onInputElementClick = (0, import_react108.useCallback)(function(event) {
+ event.stopPropagation();
+ }, []);
+ var getInputProps = (0, import_react108.useMemo)(function() {
+ return function() {
+ var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, onChange = _ref3.onChange, onClick = _ref3.onClick, rest = _objectWithoutProperties(_ref3, _excluded4);
+ var inputProps = _defineProperty3({
+ accept: acceptAttr,
+ multiple,
+ type: "file",
+ style: {
+ display: "none"
+ },
+ onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
+ onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
+ tabIndex: -1
+ }, refKey, inputRef);
+ return _objectSpread5(_objectSpread5({}, inputProps), rest);
+ };
+ }, [inputRef, accept, multiple, onDropCb, disabled]);
+ return _objectSpread5(_objectSpread5({}, state), {}, {
+ isFocused: isFocused && !disabled,
+ getRootProps,
+ getInputProps,
+ rootRef,
+ inputRef,
+ open: composeHandler(openFileDialog)
+ });
}
-function serializeAttribute(state, key3, value) {
- const info = find2(state.schema, key3);
- const x2 = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
- const y3 = state.settings.allowDangerousCharacters ? 0 : 1;
- let quote = state.quote;
- let result;
- if (info.overloadedBoolean && (value === info.attribute || value === "")) {
- value = true;
- } else if (info.boolean || info.overloadedBoolean && typeof value !== "string") {
- value = Boolean(value);
- }
- if (value === void 0 || value === null || value === false || typeof value === "number" && Number.isNaN(value)) {
- return "";
- }
- const name317 = stringifyEntities(
- info.attribute,
- Object.assign({}, state.settings.characterReferences, {
- subset: constants.name[x2][y3]
- })
- );
- if (value === true)
- return name317;
- value = Array.isArray(value) ? (info.commaSeparated ? stringify3 : stringify4)(value, {
- padLeft: !state.settings.tightCommaSeparatedLists
- }) : String(value);
- if (state.settings.collapseEmptyAttributes && !value)
- return name317;
- if (state.settings.preferUnquoted) {
- result = stringifyEntities(
- value,
- Object.assign({}, state.settings.characterReferences, {
- subset: constants.unquoted[x2][y3],
- attribute: true
- })
- );
- }
- if (result !== value) {
- if (state.settings.quoteSmart && ccount(value, quote) > ccount(value, state.alternative)) {
- quote = state.alternative;
- }
- result = quote + stringifyEntities(
- value,
- Object.assign({}, state.settings.characterReferences, {
- subset: (quote === "'" ? constants.single : constants.double)[x2][y3],
- attribute: true
- })
- ) + quote;
+function reducer2(state, action) {
+ switch (action.type) {
+ case "focus":
+ return _objectSpread5(_objectSpread5({}, state), {}, {
+ isFocused: true
+ });
+ case "blur":
+ return _objectSpread5(_objectSpread5({}, state), {}, {
+ isFocused: false
+ });
+ case "openDialog":
+ return _objectSpread5(_objectSpread5({}, initialState), {}, {
+ isFileDialogActive: true
+ });
+ case "closeDialog":
+ return _objectSpread5(_objectSpread5({}, state), {}, {
+ isFileDialogActive: false
+ });
+ case "setDraggedFiles":
+ return _objectSpread5(_objectSpread5({}, state), {}, {
+ isDragActive: action.isDragActive,
+ isDragAccept: action.isDragAccept,
+ isDragReject: action.isDragReject
+ });
+ case "setFiles":
+ return _objectSpread5(_objectSpread5({}, state), {}, {
+ acceptedFiles: action.acceptedFiles,
+ fileRejections: action.fileRejections
+ });
+ case "reset":
+ return _objectSpread5({}, initialState);
+ default:
+ return state;
}
- return name317 + (result ? "=" + result : result);
}
-
-// node_modules/hast-util-to-html/lib/handle/text.js
-function text5(node2, _15, parent, state) {
- return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node2.value : stringifyEntities(
- node2.value,
- Object.assign({}, state.settings.characterReferences, {
- subset: ["<", "&"]
- })
- );
+function noop2() {
}
-// node_modules/hast-util-to-html/lib/handle/raw.js
-function raw(node2, index3, parent, state) {
- return state.settings.allowDangerousHtml ? node2.value : text5(node2, index3, parent, state);
-}
-
-// node_modules/hast-util-to-html/lib/handle/root.js
-function root2(node2, _1, _22, state) {
- return state.all(node2);
-}
-
-// node_modules/hast-util-to-html/lib/handle/index.js
-var handle2 = zwitch("type", {
- invalid: invalid3,
- unknown: unknown2,
- handlers: { comment: comment3, doctype, element: element2, raw, root: root2, text: text5 }
-});
-function invalid3(node2) {
- throw new Error("Expected node, not `" + node2 + "`");
-}
-function unknown2(node2) {
- throw new Error("Cannot compile unknown node `" + node2.type + "`");
-}
-
-// node_modules/hast-util-to-html/lib/index.js
-function toHtml(tree, options) {
- const options_ = options || {};
- const quote = options_.quote || '"';
- const alternative = quote === '"' ? "'" : '"';
- if (quote !== '"' && quote !== "'") {
- throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
- }
- const state = {
- one: one2,
- all: all3,
- settings: {
- omitOptionalTags: options_.omitOptionalTags || false,
- allowParseErrors: options_.allowParseErrors || false,
- allowDangerousCharacters: options_.allowDangerousCharacters || false,
- quoteSmart: options_.quoteSmart || false,
- preferUnquoted: options_.preferUnquoted || false,
- tightAttributes: options_.tightAttributes || false,
- upperDoctype: options_.upperDoctype || false,
- tightDoctype: options_.tightDoctype || false,
- bogusComments: options_.bogusComments || false,
- tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false,
- tightSelfClosing: options_.tightSelfClosing || false,
- collapseEmptyAttributes: options_.collapseEmptyAttributes || false,
- allowDangerousHtml: options_.allowDangerousHtml || false,
- voids: options_.voids || htmlVoidElements,
- characterReferences: options_.characterReferences || options_.entities || {},
- closeSelfClosing: options_.closeSelfClosing || false,
- closeEmptyElements: options_.closeEmptyElements || false
- },
- schema: options_.space === "svg" ? svg2 : html3,
- quote,
- alternative
- };
- return state.one(
- Array.isArray(tree) ? { type: "root", children: tree } : tree,
- void 0,
- void 0
+// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx
+var eventToModifier = (e5, isDefaultSpace) => e5.altKey ? "copy" : e5.shiftKey || isDefaultSpace ? "link" : "move";
+var TreeItem = (props) => {
+ const {
+ id: id3,
+ childCount,
+ clone: clone5,
+ data: data2,
+ depth,
+ dragActive,
+ ghost,
+ active,
+ indentationWidth,
+ indicator,
+ collapsed,
+ selected,
+ highlighted,
+ onCollapse,
+ onSelectRange,
+ style,
+ superstate,
+ disabled,
+ dragStarted,
+ dragOver,
+ dragEnded
+ } = props;
+ const {
+ activePath,
+ setActivePath,
+ selectedPaths,
+ setSelectedPaths,
+ setDragPaths,
+ closeActiveSpace
+ } = (0, import_react109.useContext)(NavigatorContext);
+ const [hoverTarget, setHoverTarget] = (0, import_react109.useState)(null);
+ const innerRef = (0, import_react109.useRef)(null);
+ const [dropHighlighted, setDropHighlighted] = (0, import_react109.useState)(false);
+ const [pathState, setPathState] = (0, import_react109.useState)(
+ superstate.pathsIndex.get(data2.item.path)
);
-}
-function one2(node2, index3, parent) {
- return handle2(node2, index3, parent, this);
-}
-function all3(parent) {
- const results = [];
- const children = parent && parent.children || [];
- let index3 = -1;
- while (++index3 < children.length) {
- results[index3] = this.one(children[index3], index3, parent);
- }
- return results.join("");
-}
-
-// node_modules/hast-util-sanitize/lib/schema.js
-var defaultSchema = {
- strip: ["script"],
- clobberPrefix: "user-content-",
- clobber: ["name", "id"],
- ancestors: {
- tbody: ["table"],
- tfoot: ["table"],
- thead: ["table"],
- td: ["table"],
- th: ["table"],
- tr: ["table"]
- },
- protocols: {
- href: ["http", "https", "mailto", "xmpp", "irc", "ircs"],
- cite: ["http", "https"],
- src: ["http", "https"],
- longDesc: ["http", "https"]
- },
- tagNames: [
- "h1",
- "h2",
- "h3",
- "h4",
- "h5",
- "h6",
- "br",
- "b",
- "i",
- "strong",
- "em",
- "a",
- "pre",
- "code",
- "img",
- "tt",
- "div",
- "ins",
- "del",
- "sup",
- "sub",
- "p",
- "ol",
- "ul",
- "table",
- "thead",
- "tbody",
- "tfoot",
- "blockquote",
- "dl",
- "dt",
- "dd",
- "kbd",
- "q",
- "samp",
- "var",
- "hr",
- "ruby",
- "rt",
- "rp",
- "li",
- "tr",
- "td",
- "th",
- "s",
- "strike",
- "summary",
- "details",
- "caption",
- "figure",
- "figcaption",
- "abbr",
- "bdo",
- "cite",
- "dfn",
- "mark",
- "small",
- "span",
- "time",
- "wbr",
- "input"
- ],
- attributes: {
- a: ["href"],
- img: ["src", "longDesc"],
- input: [
- ["type", "checkbox"],
- ["disabled", true]
- ],
- li: [["className", "task-list-item"]],
- div: ["itemScope", "itemType"],
- blockquote: ["cite"],
- del: ["cite"],
- ins: ["cite"],
- q: ["cite"],
- "*": [
- "abbr",
- "accept",
- "acceptCharset",
- "accessKey",
- "action",
- "align",
- "alt",
- "ariaDescribedBy",
- "ariaHidden",
- "ariaLabel",
- "ariaLabelledBy",
- "axis",
- "border",
- "cellPadding",
- "cellSpacing",
- "char",
- "charOff",
- "charSet",
- "checked",
- "clear",
- "cols",
- "colSpan",
- "color",
- "compact",
- "coords",
- "dateTime",
- "dir",
- "disabled",
- "encType",
- "htmlFor",
- "frame",
- "headers",
- "height",
- "hrefLang",
- "hSpace",
- "isMap",
- "id",
- "label",
- "lang",
- "maxLength",
- "media",
- "method",
- "multiple",
- "name",
- "noHref",
- "noShade",
- "noWrap",
- "open",
- "prompt",
- "readOnly",
- "rel",
- "rev",
- "rows",
- "rowSpan",
- "rules",
- "scope",
- "selected",
- "shape",
- "size",
- "span",
- "start",
- "summary",
- "tabIndex",
- "target",
- "title",
- "type",
- "useMap",
- "vAlign",
- "value",
- "vSpace",
- "width",
- "itemProp"
- ]
- },
- required: {
- input: {
- type: "checkbox",
- disabled: true
+ (0, import_react109.useEffect)(
+ () => setPathState(superstate.pathsIndex.get(data2.item.path)),
+ [data2.item.path]
+ );
+ const openPathAtTarget = (path2, e5) => {
+ if (e5.shiftKey) {
+ onSelectRange(path2.id);
+ return;
+ } else if (e5.altKey) {
+ setSelectedPaths((s4) => [...s4.filter((f2) => f2.id != path2.id), path2]);
+ return;
}
- }
-};
-
-// node_modules/hast-util-sanitize/lib/index.js
-var own7 = {}.hasOwnProperty;
-var nodeSchema = {
- root: { children: all4 },
- doctype: handleDoctype,
- comment: handleComment,
- element: {
- tagName: handleTagName,
- properties: handleProperties,
- children: all4
- },
- text: { value: handleValue },
- "*": { data: allow, position: allow }
-};
-function sanitize(node2, schema) {
- let ctx = { type: "root", children: [] };
- if (node2 && typeof node2 === "object" && node2.type) {
- const replace = one3(
- Object.assign({}, defaultSchema, schema || {}),
- node2,
- []
- );
- if (replace) {
- if (Array.isArray(replace)) {
- if (replace.length === 1) {
- ctx = replace[0];
- } else {
- ctx.children = replace;
+ if (isFolder) {
+ if (superstate.settings.expandFolderOnClick) {
+ if (collapsed) {
+ onCollapse(data2, true);
+ } else if (active || selected) {
+ onCollapse(data2, false);
}
- } else {
- ctx = replace;
}
}
- }
- return ctx;
-}
-function one3(schema, node2, stack) {
- const type = node2 && node2.type;
- const replacement = { type: node2.type };
- let replace;
- if (own7.call(nodeSchema, type)) {
- let definition3 = nodeSchema[type];
- if (typeof definition3 === "function") {
- definition3 = definition3(schema, node2);
+ superstate.ui.openPath(
+ path2.item.path,
+ e5.ctrlKey || e5.metaKey || e5.button == 1 ? e5.altKey ? "split" : "tab" : false
+ );
+ setActivePath(path2.item.path);
+ setSelectedPaths([path2]);
+ };
+ const onDragStarted = (e5) => {
+ if (selectedPaths.length > 1) {
+ setDragPaths(selectedPaths.map((f2) => f2.path));
+ superstate.ui.dragStarted(
+ e5,
+ selectedPaths.map((f2) => f2.path)
+ );
+ return;
}
- if (definition3) {
- const allowed = Object.assign({}, definition3, nodeSchema["*"]);
- let key3;
- replace = true;
- for (key3 in allowed) {
- if (own7.call(allowed, key3)) {
- const result = allowed[key3](schema, node2[key3], node2, stack);
- if (result === false) {
- replace = void 0;
- replacement[key3] = node2[key3];
- } else if (result !== void 0 && result !== null) {
- replacement[key3] = result;
- }
- }
- }
+ dragStarted(data2.id);
+ setDragPaths([data2.path]);
+ superstate.ui.dragStarted(e5, [data2.path]);
+ };
+ const onDragOver = (e5) => {
+ e5.preventDefault();
+ if (!innerRef.current)
+ return;
+ const rect = innerRef.current.getBoundingClientRect();
+ const x2 = e5.clientX - rect.left;
+ const y3 = e5.clientY - rect.top;
+ dragOver(e5, data2.id, { x: x2, y: y3 });
+ };
+ const onKeyDown = (e5) => {
+ if (e5.key === "Control" || e5.key === "Meta") {
+ if (e5.repeat)
+ return;
+ const el = hoverTarget;
+ if (el)
+ superstate.ui.openPath(pathState.path, "hover", el);
}
- }
- if (replace) {
- return replacement;
- }
- return replacement.type === "element" && schema.strip && !schema.strip.includes(replacement.tagName) ? replacement.children : void 0;
-}
-function all4(schema, children, node2, stack) {
- const results = [];
- if (Array.isArray(children)) {
- let index3 = -1;
- if (node2.type === "element") {
- stack.push(node2.tagName);
+ };
+ const onDrop = (0, import_react109.useCallback)((files) => {
+ if (isFolder) {
+ files.map(async (file) => {
+ file.arrayBuffer().then((arrayBuffer) => {
+ superstate.spaceManager.writeToPath(
+ pathState.path + "/" + file.name,
+ arrayBuffer,
+ true
+ );
+ });
+ });
}
- while (++index3 < children.length) {
- const value = one3(schema, children[index3], stack);
- if (value) {
- if (Array.isArray(value)) {
- results.push(...value);
- } else {
- results.push(value);
- }
- }
+ }, []);
+ const onDragEnter = (0, import_react109.useCallback)(() => {
+ if (isFolder)
+ setDropHighlighted(true);
+ }, []);
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({
+ onDrop,
+ onDragEnter,
+ onDragLeave: () => setDropHighlighted(false),
+ onDropAccepted: () => setDropHighlighted(false),
+ onDropRejected: () => setDropHighlighted(false),
+ noClick: true
+ });
+ const onDragEnded = (e5) => {
+ dragEnded(e5, data2.id);
+ };
+ const mouseOut = (e5) => {
+ setHoverTarget(null);
+ };
+ const newAction = (e5) => {
+ const space2 = superstate.spacesIndex.get(pathState.path);
+ if (e5.shiftKey) {
+ const offset2 = e5.target.getBoundingClientRect();
+ showLinkMenu(
+ offset2,
+ superstate,
+ (link) => {
+ pinPathToSpaceAtIndex(superstate, space2, link);
+ },
+ { placeholder: i18n_default.labels.pinNotePlaceholder }
+ );
+ e5.stopPropagation();
+ return;
}
- if (node2.type === "element") {
- stack.pop();
+ defaultAddAction(superstate, space2);
+ };
+ const handleRightClick = (e5) => {
+ selectedPaths.length > 1 && selectedPaths.some((f2) => f2.id == data2.id) ? triggerMultiPathMenu(superstate, selectedPaths, e5) : contextMenu(e5);
+ };
+ const color2 = pathState?.label?.color;
+ const contextMenu = (e5) => {
+ if (superstate.spacesIndex.has(pathState.path)) {
+ showSpaceContextMenu(
+ superstate,
+ pathState,
+ e5,
+ activePath,
+ data2.space,
+ data2.type == "group" ? () => closeActiveSpace(data2.path) : null
+ );
+ return;
}
- }
- return results;
-}
-function handleDoctype(schema) {
- return schema.allowDoctypes ? { name: handleDoctypeName } : void 0;
-}
-function handleComment(schema) {
- return schema.allowComments ? { value: handleCommentValue } : void 0;
-}
-function handleProperties(schema, properties3, node2, stack) {
- const name317 = handleTagName(schema, node2.tagName, node2, stack);
- const attrs = schema.attributes || {};
- const reqs = schema.required || {};
- const props = properties3 || {};
- const allowed = Object.assign(
- {},
- toPropertyValueMap(attrs["*"]),
- toPropertyValueMap(name317 && own7.call(attrs, name317) ? attrs[name317] : [])
- );
- const result = {};
- let key3;
- for (key3 in props) {
- if (own7.call(props, key3)) {
- let value = props[key3];
- let definition3;
- if (own7.call(allowed, key3)) {
- definition3 = allowed[key3];
- } else if (data2(key3) && own7.call(allowed, "data*")) {
- definition3 = allowed["data*"];
- } else {
- continue;
- }
- value = Array.isArray(value) ? handlePropertyValues(schema, value, key3, definition3) : handlePropertyValue(schema, value, key3, definition3);
- if (value !== void 0 && value !== null) {
- result[key3] = value;
- }
+ showPathContextMenu(
+ superstate,
+ data2.path,
+ data2.space,
+ e5.target.getBoundingClientRect(),
+ "right"
+ );
+ };
+ const pathStateUpdated = (payload) => {
+ if (payload.path == pathState?.path) {
+ const _pathState = superstate.pathsIndex.get(pathState.path);
+ if (_pathState)
+ setPathState(_pathState);
}
- }
- if (name317 && own7.call(reqs, name317)) {
- for (key3 in reqs[name317]) {
- if (!own7.call(result, key3)) {
- result[key3] = reqs[name317][key3];
+ };
+ (0, import_react109.useEffect)(() => {
+ superstate.eventsDispatcher.addListener(
+ "pathStateUpdated",
+ pathStateUpdated
+ );
+ return () => {
+ superstate.eventsDispatcher.removeListener(
+ "pathStateUpdated",
+ pathStateUpdated
+ );
+ };
+ }, []);
+ const hoverItem = (e5) => {
+ if (superstate.settings.filePreviewOnHover) {
+ setHoverTarget(e5.target);
+ if (e5.ctrlKey || e5.metaKey) {
+ superstate.ui.openPath(pathState.path, "hover", e5.target);
}
}
- }
- return result;
-}
-function handleDoctypeName() {
- return "html";
-}
-function handleTagName(schema, tagName, _15, stack) {
- const name317 = typeof tagName === "string" ? tagName : "";
- let index3 = -1;
- if (!name317 || name317 === "*" || schema.tagNames && !schema.tagNames.includes(name317)) {
- return false;
- }
- if (schema.ancestors && own7.call(schema.ancestors, name317)) {
- while (++index3 < schema.ancestors[name317].length) {
- if (stack.includes(schema.ancestors[name317][index3])) {
- return name317;
- }
+ };
+ (0, import_react109.useEffect)(() => {
+ if (hoverTarget && superstate.settings.filePreviewOnHover) {
+ window.addEventListener("keydown", onKeyDown);
+ return () => {
+ window.removeEventListener("keydown", onKeyDown);
+ };
}
- return false;
- }
- return name317;
-}
-function handleCommentValue(_15, value) {
- const result = typeof value === "string" ? value : "";
- const index3 = result.indexOf("-->");
- return index3 < 0 ? result : result.slice(0, index3);
-}
-function handleValue(_15, value) {
- return typeof value === "string" ? value : "";
-}
-function allow(_15, value) {
- return value;
-}
-function handlePropertyValues(schema, values2, prop2, definition3) {
- let index3 = -1;
- const result = [];
- while (++index3 < values2.length) {
- const value = handlePropertyValue(schema, values2[index3], prop2, definition3);
- if (value !== void 0 && value !== null) {
- result.push(value);
+ }, [hoverTarget]);
+ const dropProps = {
+ onDragOver
+ };
+ const innerProps = {
+ draggable: true,
+ onDragStart: onDragStarted,
+ onDrop: onDragEnded
+ };
+ 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_react109.default.createElement(import_react109.default.Fragment, null, /* @__PURE__ */ import_react109.default.createElement("div", {
+ className: (0, import_classnames3.default)(
+ "mk-tree-wrapper",
+ data2.type == "group" ? "mk-tree-section" : "",
+ clone5 && "mk-clone",
+ ghost && "mk-ghost",
+ highlighted ? "is-highlighted" : ""
+ ),
+ style: color2?.length > 0 ? {
+ "--label-color": `${color2}`,
+ "--icon-color": `#ffffff`,
+ position: "relative"
+ } : {
+ "--icon-color": `var(--mk-ui-text-secondary)`,
+ position: "relative"
+ },
+ ref: innerRef,
+ onMouseLeave: mouseOut,
+ onMouseEnter: hoverItem,
+ onKeyDown,
+ onClick: (e5) => openPathAtTarget(data2, e5),
+ onContextMenu: (e5) => handleRightClick(e5),
+ ...dropProps,
+ ...innerProps
+ }, /* @__PURE__ */ import_react109.default.createElement("div", {
+ className: (0, import_classnames3.default)(isFolder ? "nav-folder" : "nav-file"),
+ style: {
+ ...style,
+ ...dragActive ? { pointerEvents: "none" } : {}
+ },
+ ...!isTouchScreen(props.superstate.ui) ? getRootProps({ className: "dropzone" }) : {}
+ }, /* @__PURE__ */ import_react109.default.createElement("input", {
+ ...getInputProps()
+ }), /* @__PURE__ */ import_react109.default.createElement("div", {
+ className: (0, import_classnames3.default)(
+ "mk-tree-item",
+ "tree-item-self",
+ isFolder ? "nav-folder-title" : "nav-file-title",
+ active ? "is-active" : "",
+ selected ? "is-selected" : "",
+ indicator || dropHighlighted ? "mk-indicator-row" : ""
+ ),
+ style: {
+ "--spacing": `${spacing}px`,
+ "--childrenCount": `${data2.type == "space" && !collapsed ? childCount * spaceRowHeight(superstate, false) - 13 : 0}px`
+ },
+ "data-path": pathState?.path
+ }, data2.type == "space" && /* @__PURE__ */ import_react109.default.createElement(CollapseToggle, {
+ superstate: props.superstate,
+ collapsed,
+ onToggle: (c3, e5) => {
+ onCollapse(data2, false);
+ e5.stopPropagation();
}
- }
- return result;
-}
-function handlePropertyValue(schema, value, prop2, definition3) {
- if ((typeof value === "boolean" || typeof value === "number" || typeof value === "string") && safeProtocol(schema, value, prop2) && (definition3.length === 0 || definition3.some(
- (allowed) => allowed && typeof allowed === "object" && "flags" in allowed ? allowed.test(String(value)) : allowed === value
- ))) {
- return schema.clobberPrefix && schema.clobber && schema.clobber.includes(prop2) ? schema.clobberPrefix + value : value;
- }
-}
-function safeProtocol(schema, value, prop2) {
- const url = String(value);
- const colon = url.indexOf(":");
- const questionMark = url.indexOf("?");
- const numberSign = url.indexOf("#");
- const slash2 = url.indexOf("/");
- const protocols = schema.protocols && own7.call(schema.protocols, prop2) ? schema.protocols[prop2].concat() : [];
- let index3 = -1;
- if (protocols.length === 0 || colon < 0 || slash2 > -1 && colon > slash2 || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign) {
- return true;
- }
- while (++index3 < protocols.length) {
- if (colon === protocols[index3].length && url.slice(0, protocols[index3].length) === protocols[index3]) {
- return true;
+ }), superstate.settings.spacesStickers && pathState && /* @__PURE__ */ import_react109.default.createElement(PathStickerView, {
+ superstate,
+ pathState,
+ editable: true
+ }), /* @__PURE__ */ import_react109.default.createElement("div", {
+ className: `mk-tree-text ${isFolder ? "nav-folder-title-content" : "nav-file-title-content"}`
+ }, pathState?.displayName ?? pathState?.name ?? data2.path), data2.type == "group" && data2.childrenCount > 0 && /* @__PURE__ */ import_react109.default.createElement(CollapseToggle, {
+ superstate: props.superstate,
+ collapsed,
+ onToggle: (c3, e5) => {
+ onCollapse(data2, false);
+ e5.stopPropagation();
}
- }
- return false;
-}
-function toPropertyValueMap(values2) {
- const result = {};
- let index3 = -1;
- while (++index3 < values2.length) {
- const value = values2[index3];
- if (Array.isArray(value)) {
- result[value[0]] = value.slice(1);
- } else {
- result[value] = [];
+ }), /* @__PURE__ */ import_react109.default.createElement("div", {
+ className: "mk-tree-span"
+ }), !isSpace && extension != "md" && /* @__PURE__ */ import_react109.default.createElement("span", {
+ className: "nav-file-tag"
+ }, extension), !clone5 ? /* @__PURE__ */ import_react109.default.createElement("div", {
+ className: "mk-folder-buttons"
+ }, /* @__PURE__ */ import_react109.default.createElement("button", {
+ "aria-label": i18n_default.buttons.moreOptions,
+ onClick: (e5) => {
+ contextMenu(e5);
+ e5.stopPropagation();
+ },
+ dangerouslySetInnerHTML: {
+ __html: superstate.ui.getSticker("ui//options")
}
- }
- return result;
-}
-function data2(prop2) {
- return prop2.length > 4 && prop2.slice(0, 4).toLowerCase() === "data";
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
-function blockquote2(state, node2) {
- const result = {
- type: "element",
- tagName: "blockquote",
- properties: {},
- children: state.wrap(state.all(node2), true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/break.js
-function hardBreak2(state, node2) {
- const result = { type: "element", tagName: "br", properties: {}, children: [] };
- state.patch(node2, result);
- return [state.applyData(node2, result), { type: "text", value: "\n" }];
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/code.js
-function code2(state, node2) {
- const value = node2.value ? node2.value + "\n" : "";
- const lang = node2.lang ? node2.lang.match(/^[^ \t]+(?=[ \t]|$)/) : null;
- const properties3 = {};
- if (lang) {
- properties3.className = ["language-" + lang];
- }
- let result = {
- type: "element",
- tagName: "code",
- properties: properties3,
- children: [{ type: "text", value }]
- };
- if (node2.meta) {
- result.data = { meta: node2.meta };
- }
- state.patch(node2, result);
- result = state.applyData(node2, result);
- result = { type: "element", tagName: "pre", properties: {}, children: [result] };
- state.patch(node2, result);
- return result;
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/delete.js
-function strikethrough(state, node2) {
- const result = {
- type: "element",
- tagName: "del",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
+ }), isSpace && /* @__PURE__ */ import_react109.default.createElement("button", {
+ "aria-label": i18n_default.buttons.newNote,
+ onClick: (e5) => {
+ newAction(e5);
+ e5.stopPropagation();
+ },
+ dangerouslySetInnerHTML: {
+ __html: superstate.ui.getSticker("ui//plus")
+ }
+ })) : /* @__PURE__ */ import_react109.default.createElement(import_react109.default.Fragment, null)))));
+};
+TreeItem.displayName = "TreeItem";
-// node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
-function emphasis2(state, node2) {
- const result = {
- type: "element",
- tagName: "em",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
+// node_modules/@tanstack/react-virtual/dist/esm/index.js
+var React107 = __toESM(require_react(), 1);
+var import_react_dom6 = __toESM(require_react_dom(), 1);
-// node_modules/micromark-util-sanitize-uri/index.js
-function normalizeUri(value) {
- const result = [];
- let index3 = -1;
- let start = 0;
- let skip = 0;
- while (++index3 < value.length) {
- const code3 = value.charCodeAt(index3);
- let replace = "";
- if (code3 === 37 && asciiAlphanumeric(value.charCodeAt(index3 + 1)) && asciiAlphanumeric(value.charCodeAt(index3 + 2))) {
- skip = 2;
- } else if (code3 < 128) {
- if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code3))) {
- replace = String.fromCharCode(code3);
- }
- } else if (code3 > 55295 && code3 < 57344) {
- const next = value.charCodeAt(index3 + 1);
- if (code3 < 56320 && next > 56319 && next < 57344) {
- replace = String.fromCharCode(code3, next);
- skip = 1;
- } else {
- replace = "\uFFFD";
- }
- } else {
- replace = String.fromCharCode(code3);
- }
- if (replace) {
- result.push(value.slice(start, index3), encodeURIComponent(replace));
- start = index3 + skip + 1;
- replace = "";
+// node_modules/@tanstack/virtual-core/dist/esm/utils.js
+function memo3(getDeps, fn, opts) {
+ let deps = opts.initialDeps ?? [];
+ let result;
+ return () => {
+ var _a, _b, _c, _d;
+ let depTime;
+ if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts)))
+ depTime = Date.now();
+ const newDeps = getDeps();
+ const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
+ if (!depsChanged) {
+ return result;
}
- if (skip) {
- index3 += skip;
- skip = 0;
+ deps = newDeps;
+ let resultTime;
+ if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts)))
+ resultTime = Date.now();
+ result = fn(...newDeps);
+ if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
+ const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
+ const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
+ const resultFpsPercentage = resultEndTime / 16;
+ const pad = (str, num) => {
+ str = String(str);
+ while (str.length < num) {
+ str = " " + str;
+ }
+ return str;
+ };
+ console.info(
+ `%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
+ `
+ font-size: .6rem;
+ font-weight: bold;
+ color: hsl(${Math.max(
+ 0,
+ Math.min(120 - 120 * resultFpsPercentage, 120)
+ )}deg 100% 31%);`,
+ opts == null ? void 0 : opts.key
+ );
}
- }
- return result.join("") + value.slice(start);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
-function footnoteReference(state, node2) {
- const id3 = String(node2.identifier).toUpperCase();
- const safeId = normalizeUri(id3.toLowerCase());
- const index3 = state.footnoteOrder.indexOf(id3);
- let counter;
- if (index3 === -1) {
- state.footnoteOrder.push(id3);
- state.footnoteCounts[id3] = 1;
- counter = state.footnoteOrder.length;
- } else {
- state.footnoteCounts[id3]++;
- counter = index3 + 1;
- }
- const reuseCounter = state.footnoteCounts[id3];
- const link3 = {
- type: "element",
- tagName: "a",
- properties: {
- href: "#" + state.clobberPrefix + "fn-" + safeId,
- id: state.clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""),
- dataFootnoteRef: true,
- ariaDescribedBy: ["footnote-label"]
- },
- children: [{ type: "text", value: String(counter) }]
- };
- state.patch(node2, link3);
- const sup = {
- type: "element",
- tagName: "sup",
- properties: {},
- children: [link3]
- };
- state.patch(node2, sup);
- return state.applyData(node2, sup);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/footnote.js
-function footnote(state, node2) {
- const footnoteById = state.footnoteById;
- let no = 1;
- while (no in footnoteById)
- no++;
- const identifier = String(no);
- footnoteById[identifier] = {
- type: "footnoteDefinition",
- identifier,
- children: [{ type: "paragraph", children: node2.children }],
- position: node2.position
- };
- return footnoteReference(state, {
- type: "footnoteReference",
- identifier,
- position: node2.position
- });
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/heading.js
-function heading4(state, node2) {
- const result = {
- type: "element",
- tagName: "h" + node2.depth,
- properties: {},
- children: state.all(node2)
+ (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
+ return result;
};
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/html.js
-function html6(state, node2) {
- if (state.dangerous) {
- const result = { type: "raw", value: node2.value };
- state.patch(node2, result);
- return state.applyData(node2, result);
- }
- return null;
}
-
-// node_modules/mdast-util-to-hast/lib/revert.js
-function revert(state, node2) {
- const subtype = node2.referenceType;
- let suffix = "]";
- if (subtype === "collapsed") {
- suffix += "[]";
- } else if (subtype === "full") {
- suffix += "[" + (node2.label || node2.identifier) + "]";
- }
- if (node2.type === "imageReference") {
- return { type: "text", value: "![" + node2.alt + suffix };
- }
- const contents = state.all(node2);
- const head2 = contents[0];
- if (head2 && head2.type === "text") {
- head2.value = "[" + head2.value;
- } else {
- contents.unshift({ type: "text", value: "[" });
- }
- const tail = contents[contents.length - 1];
- if (tail && tail.type === "text") {
- tail.value += suffix;
+function notUndefined(value, msg) {
+ if (value === void 0) {
+ throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
} else {
- contents.push({ type: "text", value: suffix });
- }
- return contents;
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
-function imageReference2(state, node2) {
- const def = state.definition(node2.identifier);
- if (!def) {
- return revert(state, node2);
- }
- const properties3 = { src: normalizeUri(def.url || ""), alt: node2.alt };
- if (def.title !== null && def.title !== void 0) {
- properties3.title = def.title;
+ return value;
}
- const result = { type: "element", tagName: "img", properties: properties3, children: [] };
- state.patch(node2, result);
- return state.applyData(node2, result);
}
+var approxEqual = (a4, b2) => Math.abs(a4 - b2) < 1;
-// node_modules/mdast-util-to-hast/lib/handlers/image.js
-function image2(state, node2) {
- const properties3 = { src: normalizeUri(node2.url) };
- if (node2.alt !== null && node2.alt !== void 0) {
- properties3.alt = node2.alt;
+// node_modules/@tanstack/virtual-core/dist/esm/index.js
+var defaultKeyExtractor = (index2) => index2;
+var defaultRangeExtractor = (range2) => {
+ const start = Math.max(range2.startIndex - range2.overscan, 0);
+ const end = Math.min(range2.endIndex + range2.overscan, range2.count - 1);
+ const arr = [];
+ for (let i4 = start; i4 <= end; i4++) {
+ arr.push(i4);
}
- if (node2.title !== null && node2.title !== void 0) {
- properties3.title = node2.title;
+ return arr;
+};
+var observeElementRect = (instance, cb) => {
+ const element = instance.scrollElement;
+ if (!element) {
+ return;
}
- const result = { type: "element", tagName: "img", properties: properties3, children: [] };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
-function inlineCode2(state, node2) {
- const text7 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
- state.patch(node2, text7);
- const result = {
- type: "element",
- tagName: "code",
- properties: {},
- children: [text7]
+ const handler = (rect) => {
+ const { width, height } = rect;
+ cb({ width: Math.round(width), height: Math.round(height) });
};
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
-function linkReference2(state, node2) {
- const def = state.definition(node2.identifier);
- if (!def) {
- return revert(state, node2);
- }
- const properties3 = { href: normalizeUri(def.url || "") };
- if (def.title !== null && def.title !== void 0) {
- properties3.title = def.title;
+ handler(element.getBoundingClientRect());
+ if (typeof ResizeObserver === "undefined") {
+ return () => {
+ };
}
- const result = {
- type: "element",
- tagName: "a",
- properties: properties3,
- children: state.all(node2)
+ const observer = new ResizeObserver((entries) => {
+ const entry = entries[0];
+ if (entry == null ? void 0 : entry.borderBoxSize) {
+ const box = entry.borderBoxSize[0];
+ if (box) {
+ handler({ width: box.inlineSize, height: box.blockSize });
+ return;
+ }
+ }
+ handler(element.getBoundingClientRect());
+ });
+ observer.observe(element, { box: "border-box" });
+ return () => {
+ observer.unobserve(element);
};
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/link.js
-function link2(state, node2) {
- const properties3 = { href: normalizeUri(node2.url) };
- if (node2.title !== null && node2.title !== void 0) {
- properties3.title = node2.title;
+};
+var observeElementOffset = (instance, cb) => {
+ const element = instance.scrollElement;
+ if (!element) {
+ return;
}
- const result = {
- type: "element",
- tagName: "a",
- properties: properties3,
- children: state.all(node2)
+ const handler = () => {
+ cb(element[instance.options.horizontal ? "scrollLeft" : "scrollTop"]);
};
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/list-item.js
-function listItem3(state, node2, parent) {
- const results = state.all(node2);
- const loose = parent ? listLoose(parent) : listItemLoose(node2);
- const properties3 = {};
- const children = [];
- if (typeof node2.checked === "boolean") {
- const head2 = results[0];
- let paragraph3;
- if (head2 && head2.type === "element" && head2.tagName === "p") {
- paragraph3 = head2;
- } else {
- paragraph3 = { type: "element", tagName: "p", properties: {}, children: [] };
- results.unshift(paragraph3);
- }
- if (paragraph3.children.length > 0) {
- paragraph3.children.unshift({ type: "text", value: " " });
- }
- paragraph3.children.unshift({
- type: "element",
- tagName: "input",
- properties: { type: "checkbox", checked: node2.checked, disabled: true },
- children: []
- });
- properties3.className = ["task-list-item"];
- }
- let index3 = -1;
- while (++index3 < results.length) {
- const child = results[index3];
- if (loose || index3 !== 0 || child.type !== "element" || child.tagName !== "p") {
- children.push({ type: "text", value: "\n" });
- }
- if (child.type === "element" && child.tagName === "p" && !loose) {
- children.push(...child.children);
- } else {
- children.push(child);
- }
- }
- const tail = results[results.length - 1];
- if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) {
- children.push({ type: "text", value: "\n" });
- }
- const result = { type: "element", tagName: "li", properties: properties3, children };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-function listLoose(node2) {
- let loose = false;
- if (node2.type === "list") {
- loose = node2.spread || false;
- const children = node2.children;
- let index3 = -1;
- while (!loose && ++index3 < children.length) {
- loose = listItemLoose(children[index3]);
- }
- }
- return loose;
-}
-function listItemLoose(node2) {
- const spread = node2.spread;
- return spread === void 0 || spread === null ? node2.children.length > 1 : spread;
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/list.js
-function list3(state, node2) {
- const properties3 = {};
- const results = state.all(node2);
- let index3 = -1;
- if (typeof node2.start === "number" && node2.start !== 1) {
- properties3.start = node2.start;
- }
- while (++index3 < results.length) {
- const child = results[index3];
- if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) {
- properties3.className = ["contains-task-list"];
- break;
+ handler();
+ element.addEventListener("scroll", handler, {
+ passive: true
+ });
+ return () => {
+ element.removeEventListener("scroll", handler);
+ };
+};
+var measureElement = (element, entry, instance) => {
+ if (entry == null ? void 0 : entry.borderBoxSize) {
+ const box = entry.borderBoxSize[0];
+ if (box) {
+ const size2 = Math.round(
+ box[instance.options.horizontal ? "inlineSize" : "blockSize"]
+ );
+ return size2;
}
}
- const result = {
- type: "element",
- tagName: node2.ordered ? "ol" : "ul",
- properties: properties3,
- children: state.wrap(results, true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
-function paragraph2(state, node2) {
- const result = {
- type: "element",
- tagName: "p",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/root.js
-function root3(state, node2) {
- const result = { type: "root", children: state.wrap(state.all(node2)) };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/strong.js
-function strong2(state, node2) {
- const result = {
- type: "element",
- tagName: "strong",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/unist-util-position/lib/index.js
-var pointStart = point3("start");
-var pointEnd = point3("end");
-function position2(node2) {
- return { start: pointStart(node2), end: pointEnd(node2) };
-}
-function point3(type) {
- return point4;
- function point4(node2) {
- const point5 = node2 && node2.position && node2.position[type] || {};
- return {
- line: point5.line || null,
- column: point5.column || null,
- offset: point5.offset > -1 ? point5.offset : null
+ return Math.round(
+ element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
+ );
+};
+var elementScroll = (offset2, {
+ adjustments = 0,
+ behavior
+}, instance) => {
+ var _a, _b;
+ const toOffset = offset2 + adjustments;
+ (_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
+ [instance.options.horizontal ? "left" : "top"]: toOffset,
+ behavior
+ });
+};
+var Virtualizer = class {
+ constructor(opts) {
+ this.unsubs = [];
+ this.scrollElement = null;
+ this.isScrolling = false;
+ this.isScrollingTimeoutId = null;
+ this.scrollToIndexTimeoutId = null;
+ this.measurementsCache = [];
+ this.itemSizeCache = /* @__PURE__ */ new Map();
+ this.pendingMeasuredCacheIndexes = [];
+ this.scrollDirection = null;
+ this.scrollAdjustments = 0;
+ this.measureElementCache = /* @__PURE__ */ new Map();
+ this.observer = /* @__PURE__ */ (() => {
+ let _ro = null;
+ const get2 = () => {
+ if (_ro) {
+ return _ro;
+ } else if (typeof ResizeObserver !== "undefined") {
+ return _ro = new ResizeObserver((entries) => {
+ entries.forEach((entry) => {
+ this._measureElement(entry.target, entry);
+ });
+ });
+ } else {
+ return null;
+ }
+ };
+ return {
+ disconnect: () => {
+ var _a;
+ return (_a = get2()) == null ? void 0 : _a.disconnect();
+ },
+ observe: (target) => {
+ var _a;
+ return (_a = get2()) == null ? void 0 : _a.observe(target, { box: "border-box" });
+ },
+ unobserve: (target) => {
+ var _a;
+ return (_a = get2()) == null ? void 0 : _a.unobserve(target);
+ }
+ };
+ })();
+ this.range = null;
+ this.setOptions = (opts2) => {
+ Object.entries(opts2).forEach(([key2, value]) => {
+ if (typeof value === "undefined")
+ delete opts2[key2];
+ });
+ this.options = {
+ debug: false,
+ initialOffset: 0,
+ overscan: 1,
+ paddingStart: 0,
+ paddingEnd: 0,
+ scrollPaddingStart: 0,
+ scrollPaddingEnd: 0,
+ horizontal: false,
+ getItemKey: defaultKeyExtractor,
+ rangeExtractor: defaultRangeExtractor,
+ onChange: () => {
+ },
+ measureElement,
+ initialRect: { width: 0, height: 0 },
+ scrollMargin: 0,
+ gap: 0,
+ scrollingDelay: 150,
+ indexAttribute: "data-index",
+ initialMeasurementsCache: [],
+ lanes: 1,
+ ...opts2
+ };
+ };
+ this.notify = (sync) => {
+ var _a, _b;
+ (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
+ };
+ this.maybeNotify = memo3(
+ () => {
+ this.calculateRange();
+ return [
+ this.isScrolling,
+ this.range ? this.range.startIndex : null,
+ this.range ? this.range.endIndex : null
+ ];
+ },
+ (isScrolling) => {
+ this.notify(isScrolling);
+ },
+ {
+ key: false,
+ debug: () => this.options.debug,
+ initialDeps: [
+ this.isScrolling,
+ this.range ? this.range.startIndex : null,
+ this.range ? this.range.endIndex : null
+ ]
+ }
+ );
+ this.cleanup = () => {
+ this.unsubs.filter(Boolean).forEach((d4) => d4());
+ this.unsubs = [];
+ this.scrollElement = null;
+ };
+ this._didMount = () => {
+ this.measureElementCache.forEach(this.observer.observe);
+ return () => {
+ this.observer.disconnect();
+ this.cleanup();
+ };
};
- }
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/table.js
-function table(state, node2) {
- const rows = state.all(node2);
- const firstRow = rows.shift();
- const tableContent = [];
- if (firstRow) {
- const head2 = {
- type: "element",
- tagName: "thead",
- properties: {},
- children: state.wrap([firstRow], true)
+ this._willUpdate = () => {
+ const scrollElement = this.options.getScrollElement();
+ if (this.scrollElement !== scrollElement) {
+ this.cleanup();
+ this.scrollElement = scrollElement;
+ this._scrollToOffset(this.scrollOffset, {
+ adjustments: void 0,
+ behavior: void 0
+ });
+ this.unsubs.push(
+ this.options.observeElementRect(this, (rect) => {
+ this.scrollRect = rect;
+ this.maybeNotify();
+ })
+ );
+ this.unsubs.push(
+ this.options.observeElementOffset(this, (offset2) => {
+ this.scrollAdjustments = 0;
+ if (this.scrollOffset === offset2) {
+ return;
+ }
+ if (this.isScrollingTimeoutId !== null) {
+ clearTimeout(this.isScrollingTimeoutId);
+ this.isScrollingTimeoutId = null;
+ }
+ this.isScrolling = true;
+ this.scrollDirection = this.scrollOffset < offset2 ? "forward" : "backward";
+ this.scrollOffset = offset2;
+ this.maybeNotify();
+ this.isScrollingTimeoutId = setTimeout(() => {
+ this.isScrollingTimeoutId = null;
+ this.isScrolling = false;
+ this.scrollDirection = null;
+ this.maybeNotify();
+ }, this.options.scrollingDelay);
+ })
+ );
+ }
};
- state.patch(node2.children[0], head2);
- tableContent.push(head2);
- }
- if (rows.length > 0) {
- const body3 = {
- type: "element",
- tagName: "tbody",
- properties: {},
- children: state.wrap(rows, true)
+ this.getSize = () => {
+ return this.scrollRect[this.options.horizontal ? "width" : "height"];
};
- const start = pointStart(node2.children[1]);
- const end = pointEnd(node2.children[node2.children.length - 1]);
- if (start.line && end.line)
- body3.position = { start, end };
- tableContent.push(body3);
- }
- const result = {
- type: "element",
- tagName: "table",
- properties: {},
- children: state.wrap(tableContent, true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/table-row.js
-function tableRow(state, node2, parent) {
- const siblings2 = parent ? parent.children : void 0;
- const rowIndex = siblings2 ? siblings2.indexOf(node2) : 1;
- const tagName = rowIndex === 0 ? "th" : "td";
- const align = parent && parent.type === "table" ? parent.align : void 0;
- const length = align ? align.length : node2.children.length;
- let cellIndex = -1;
- const cells2 = [];
- while (++cellIndex < length) {
- const cell = node2.children[cellIndex];
- const properties3 = {};
- const alignValue = align ? align[cellIndex] : void 0;
- if (alignValue) {
- properties3.align = alignValue;
- }
- let result2 = { type: "element", tagName, properties: properties3, children: [] };
- if (cell) {
- result2.children = state.all(cell);
- state.patch(cell, result2);
- result2 = state.applyData(node2, result2);
- }
- cells2.push(result2);
- }
- const result = {
- type: "element",
- tagName: "tr",
- properties: {},
- children: state.wrap(cells2, true)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/table-cell.js
-function tableCell(state, node2) {
- const result = {
- type: "element",
- tagName: "td",
- properties: {},
- children: state.all(node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/trim-lines/index.js
-var tab = 9;
-var space2 = 32;
-function trimLines(value) {
- const source = String(value);
- const search3 = /\r?\n|\r/g;
- let match2 = search3.exec(source);
- let last = 0;
- const lines = [];
- while (match2) {
- lines.push(
- trimLine(source.slice(last, match2.index), last > 0, true),
- match2[0]
+ this.memoOptions = memo3(
+ () => [
+ this.options.count,
+ this.options.paddingStart,
+ this.options.scrollMargin,
+ this.options.getItemKey
+ ],
+ (count3, paddingStart, scrollMargin, getItemKey) => {
+ this.pendingMeasuredCacheIndexes = [];
+ return {
+ count: count3,
+ paddingStart,
+ scrollMargin,
+ getItemKey
+ };
+ },
+ {
+ key: false
+ }
);
- last = match2.index + match2[0].length;
- match2 = search3.exec(source);
- }
- lines.push(trimLine(source.slice(last), last > 0, false));
- return lines.join("");
-}
-function trimLine(value, start, end) {
- let startIndex = 0;
- let endIndex = value.length;
- if (start) {
- let code3 = value.codePointAt(startIndex);
- while (code3 === tab || code3 === space2) {
- startIndex++;
- code3 = value.codePointAt(startIndex);
- }
- }
- if (end) {
- let code3 = value.codePointAt(endIndex - 1);
- while (code3 === tab || code3 === space2) {
- endIndex--;
- code3 = value.codePointAt(endIndex - 1);
- }
- }
- return endIndex > startIndex ? value.slice(startIndex, endIndex) : "";
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/text.js
-function text6(state, node2) {
- const result = { type: "text", value: trimLines(String(node2.value)) };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
-function thematicBreak3(state, node2) {
- const result = {
- type: "element",
- tagName: "hr",
- properties: {},
- children: []
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-
-// node_modules/mdast-util-to-hast/lib/handlers/index.js
-var handlers = {
- blockquote: blockquote2,
- break: hardBreak2,
- code: code2,
- delete: strikethrough,
- emphasis: emphasis2,
- footnoteReference,
- footnote,
- heading: heading4,
- html: html6,
- imageReference: imageReference2,
- image: image2,
- inlineCode: inlineCode2,
- linkReference: linkReference2,
- link: link2,
- listItem: listItem3,
- list: list3,
- paragraph: paragraph2,
- root: root3,
- strong: strong2,
- table,
- tableCell,
- tableRow,
- text: text6,
- thematicBreak: thematicBreak3,
- toml: ignore2,
- yaml: ignore2,
- definition: ignore2,
- footnoteDefinition: ignore2
-};
-function ignore2() {
- return null;
-}
-
-// node_modules/unist-util-generated/lib/index.js
-function generated(node2) {
- return !node2 || !node2.position || !node2.position.start || !node2.position.start.line || !node2.position.start.column || !node2.position.end || !node2.position.end.line || !node2.position.end.column;
-}
-
-// node_modules/mdast-util-definitions/lib/index.js
-var own8 = {}.hasOwnProperty;
-function definitions(tree) {
- const cache2 = /* @__PURE__ */ Object.create(null);
- if (!tree || !tree.type) {
- throw new Error("mdast-util-definitions expected node");
- }
- visit(tree, "definition", (definition4) => {
- const id3 = clean(definition4.identifier);
- if (id3 && !own8.call(cache2, id3)) {
- cache2[id3] = definition4;
- }
- });
- return definition3;
- function definition3(identifier) {
- const id3 = clean(identifier);
- return id3 && own8.call(cache2, id3) ? cache2[id3] : null;
- }
-}
-function clean(value) {
- return String(value || "").toUpperCase();
-}
-
-// node_modules/mdast-util-to-hast/lib/state.js
-var own9 = {}.hasOwnProperty;
-function createState(tree, options) {
- const settings = options || {};
- const dangerous2 = settings.allowDangerousHtml || false;
- const footnoteById = {};
- state.dangerous = dangerous2;
- state.clobberPrefix = settings.clobberPrefix === void 0 || settings.clobberPrefix === null ? "user-content-" : settings.clobberPrefix;
- state.footnoteLabel = settings.footnoteLabel || "Footnotes";
- state.footnoteLabelTagName = settings.footnoteLabelTagName || "h2";
- state.footnoteLabelProperties = settings.footnoteLabelProperties || {
- className: ["sr-only"]
- };
- state.footnoteBackLabel = settings.footnoteBackLabel || "Back to content";
- state.unknownHandler = settings.unknownHandler;
- state.passThrough = settings.passThrough;
- state.handlers = { ...handlers, ...settings.handlers };
- state.definition = definitions(tree);
- state.footnoteById = footnoteById;
- state.footnoteOrder = [];
- state.footnoteCounts = {};
- state.patch = patch;
- state.applyData = applyData;
- state.one = oneBound;
- state.all = allBound;
- state.wrap = wrap2;
- state.augment = augment;
- visit(tree, "footnoteDefinition", (definition3) => {
- const id3 = String(definition3.identifier).toUpperCase();
- if (!own9.call(footnoteById, id3)) {
- footnoteById[id3] = definition3;
- }
- });
- return state;
- function augment(left, right) {
- if (left && "data" in left && left.data) {
- const data3 = left.data;
- if (data3.hName) {
- if (right.type !== "element") {
- right = {
- type: "element",
- tagName: "",
- properties: {},
- children: []
- };
+ this.getFurthestMeasurement = (measurements, index2) => {
+ const furthestMeasurementsFound = /* @__PURE__ */ new Map();
+ const furthestMeasurements = /* @__PURE__ */ new Map();
+ for (let m4 = index2 - 1; m4 >= 0; m4--) {
+ const measurement = measurements[m4];
+ if (furthestMeasurementsFound.has(measurement.lane)) {
+ continue;
+ }
+ const previousFurthestMeasurement = furthestMeasurements.get(
+ measurement.lane
+ );
+ if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
+ furthestMeasurements.set(measurement.lane, measurement);
+ } else if (measurement.end < previousFurthestMeasurement.end) {
+ furthestMeasurementsFound.set(measurement.lane, true);
+ }
+ if (furthestMeasurementsFound.size === this.options.lanes) {
+ break;
}
- right.tagName = data3.hName;
}
- if (right.type === "element" && data3.hProperties) {
- right.properties = { ...right.properties, ...data3.hProperties };
+ return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a4, b2) => {
+ if (a4.end === b2.end) {
+ return a4.index - b2.index;
+ }
+ return a4.end - b2.end;
+ })[0] : void 0;
+ };
+ this.getMeasurements = memo3(
+ () => [this.memoOptions(), this.itemSizeCache],
+ ({ count: count3, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => {
+ const min5 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
+ this.pendingMeasuredCacheIndexes = [];
+ const measurements = this.measurementsCache.slice(0, min5);
+ for (let i4 = min5; i4 < count3; i4++) {
+ const key2 = getItemKey(i4);
+ const furthestMeasurement = this.options.lanes === 1 ? measurements[i4 - 1] : this.getFurthestMeasurement(measurements, i4);
+ const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
+ const measuredSize = itemSizeCache.get(key2);
+ const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i4);
+ const end = start + size2;
+ const lane = furthestMeasurement ? furthestMeasurement.lane : i4 % this.options.lanes;
+ measurements[i4] = {
+ index: i4,
+ start,
+ size: size2,
+ end,
+ key: key2,
+ lane
+ };
+ }
+ this.measurementsCache = measurements;
+ return measurements;
+ },
+ {
+ key: false,
+ debug: () => this.options.debug
}
- if ("children" in right && right.children && data3.hChildren) {
- right.children = data3.hChildren;
+ );
+ this.calculateRange = memo3(
+ () => [this.getMeasurements(), this.getSize(), this.scrollOffset],
+ (measurements, outerSize, scrollOffset) => {
+ return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
+ measurements,
+ outerSize,
+ scrollOffset
+ }) : null;
+ },
+ {
+ key: false,
+ debug: () => this.options.debug
}
- }
- if (left) {
- const ctx = "type" in left ? left : { position: left };
- if (!generated(ctx)) {
- right.position = { start: pointStart(ctx), end: pointEnd(ctx) };
+ );
+ this.getIndexes = memo3(
+ () => [
+ this.options.rangeExtractor,
+ this.calculateRange(),
+ this.options.overscan,
+ this.options.count
+ ],
+ (rangeExtractor, range2, overscan, count3) => {
+ return range2 === null ? [] : rangeExtractor({
+ ...range2,
+ overscan,
+ count: count3
+ });
+ },
+ {
+ key: false,
+ debug: () => this.options.debug
}
- }
- return right;
- }
- function state(node2, tagName, props, children) {
- if (Array.isArray(props)) {
- children = props;
- props = {};
- }
- return augment(node2, {
- type: "element",
- tagName,
- properties: props || {},
- children: children || []
- });
- }
- function oneBound(node2, parent) {
- return one4(state, node2, parent);
- }
- function allBound(parent) {
- return all5(state, parent);
- }
-}
-function patch(from, to2) {
- if (from.position)
- to2.position = position2(from);
-}
-function applyData(from, to2) {
- let result = to2;
- if (from && from.data) {
- const hName = from.data.hName;
- const hChildren = from.data.hChildren;
- const hProperties = from.data.hProperties;
- if (typeof hName === "string") {
- if (result.type === "element") {
- result.tagName = hName;
- } else {
- result = {
- type: "element",
- tagName: hName,
- properties: {},
- children: []
- };
+ );
+ this.indexFromElement = (node) => {
+ const attributeName = this.options.indexAttribute;
+ const indexStr = node.getAttribute(attributeName);
+ if (!indexStr) {
+ console.warn(
+ `Missing attribute name '${attributeName}={index}' on measured element.`
+ );
+ return -1;
}
- }
- if (result.type === "element" && hProperties) {
- result.properties = { ...result.properties, ...hProperties };
- }
- if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) {
- result.children = hChildren;
- }
- }
- return result;
-}
-function one4(state, node2, parent) {
- const type = node2 && node2.type;
- if (!type) {
- throw new Error("Expected node, got `" + node2 + "`");
- }
- if (own9.call(state.handlers, type)) {
- return state.handlers[type](state, node2, parent);
- }
- if (state.passThrough && state.passThrough.includes(type)) {
- return "children" in node2 ? { ...node2, children: all5(state, node2) } : node2;
- }
- if (state.unknownHandler) {
- return state.unknownHandler(state, node2, parent);
- }
- return defaultUnknownHandler(state, node2);
-}
-function all5(state, parent) {
- const values2 = [];
- if ("children" in parent) {
- const nodes = parent.children;
- let index3 = -1;
- while (++index3 < nodes.length) {
- const result = one4(state, nodes[index3], parent);
- if (result) {
- if (index3 && nodes[index3 - 1].type === "break") {
- if (!Array.isArray(result) && result.type === "text") {
- result.value = result.value.replace(/^\s+/, "");
- }
- if (!Array.isArray(result) && result.type === "element") {
- const head2 = result.children[0];
- if (head2 && head2.type === "text") {
- head2.value = head2.value.replace(/^\s+/, "");
- }
+ return parseInt(indexStr, 10);
+ };
+ this._measureElement = (node, entry) => {
+ const item = this.measurementsCache[this.indexFromElement(node)];
+ if (!item || !node.isConnected) {
+ this.measureElementCache.forEach((cached, key2) => {
+ if (cached === node) {
+ this.observer.unobserve(node);
+ this.measureElementCache.delete(key2);
}
- }
- if (Array.isArray(result)) {
- values2.push(...result);
- } else {
- values2.push(result);
- }
- }
- }
- }
- return values2;
-}
-function defaultUnknownHandler(state, node2) {
- const data3 = node2.data || {};
- const result = "value" in node2 && !(own9.call(data3, "hProperties") || own9.call(data3, "hChildren")) ? { type: "text", value: node2.value } : {
- type: "element",
- tagName: "div",
- properties: {},
- children: all5(state, node2)
- };
- state.patch(node2, result);
- return state.applyData(node2, result);
-}
-function wrap2(nodes, loose) {
- const result = [];
- let index3 = -1;
- if (loose) {
- result.push({ type: "text", value: "\n" });
- }
- while (++index3 < nodes.length) {
- if (index3)
- result.push({ type: "text", value: "\n" });
- result.push(nodes[index3]);
- }
- if (loose && nodes.length > 0) {
- result.push({ type: "text", value: "\n" });
- }
- return result;
-}
-
-// node_modules/mdast-util-to-hast/lib/footer.js
-function footer(state) {
- const listItems = [];
- let index3 = -1;
- while (++index3 < state.footnoteOrder.length) {
- const def = state.footnoteById[state.footnoteOrder[index3]];
- if (!def) {
- continue;
- }
- const content5 = state.all(def);
- const id3 = String(def.identifier).toUpperCase();
- const safeId = normalizeUri(id3.toLowerCase());
- let referenceIndex = 0;
- const backReferences = [];
- while (++referenceIndex <= state.footnoteCounts[id3]) {
- const backReference = {
- type: "element",
- tagName: "a",
- properties: {
- href: "#" + state.clobberPrefix + "fnref-" + safeId + (referenceIndex > 1 ? "-" + referenceIndex : ""),
- dataFootnoteBackref: true,
- className: ["data-footnote-backref"],
- ariaLabel: state.footnoteBackLabel
- },
- children: [{ type: "text", value: "\u21A9" }]
- };
- if (referenceIndex > 1) {
- backReference.children.push({
- type: "element",
- tagName: "sup",
- children: [{ type: "text", value: String(referenceIndex) }]
});
+ return;
}
- if (backReferences.length > 0) {
- backReferences.push({ type: "text", value: " " });
- }
- backReferences.push(backReference);
- }
- const tail = content5[content5.length - 1];
- if (tail && tail.type === "element" && tail.tagName === "p") {
- const tailTail = tail.children[tail.children.length - 1];
- if (tailTail && tailTail.type === "text") {
- tailTail.value += " ";
- } else {
- tail.children.push({ type: "text", value: " " });
+ const prevNode = this.measureElementCache.get(item.key);
+ if (prevNode !== node) {
+ if (prevNode) {
+ this.observer.unobserve(prevNode);
+ }
+ this.observer.observe(node);
+ this.measureElementCache.set(item.key, node);
}
- tail.children.push(...backReferences);
- } else {
- content5.push(...backReferences);
- }
- const listItem4 = {
- type: "element",
- tagName: "li",
- properties: { id: state.clobberPrefix + "fn-" + safeId },
- children: state.wrap(content5, true)
+ const measuredItemSize = this.options.measureElement(node, entry, this);
+ this.resizeItem(item, measuredItemSize);
};
- state.patch(def, listItem4);
- listItems.push(listItem4);
- }
- if (listItems.length === 0) {
- return;
- }
- return {
- type: "element",
- tagName: "section",
- properties: { dataFootnotes: true, className: ["footnotes"] },
- children: [
- {
- type: "element",
- tagName: state.footnoteLabelTagName,
- properties: {
- ...JSON.parse(JSON.stringify(state.footnoteLabelProperties)),
- id: "footnote-label"
- },
- children: [{ type: "text", value: state.footnoteLabel }]
- },
- { type: "text", value: "\n" },
- {
- type: "element",
- tagName: "ol",
- properties: {},
- children: state.wrap(listItems, true)
- },
- { type: "text", value: "\n" }
- ]
- };
-}
-
-// node_modules/mdast-util-to-hast/lib/index.js
-function toHast(tree, options) {
- const state = createState(tree, options);
- const node2 = state.one(tree, null);
- const foot = footer(state);
- if (foot) {
- node2.children.push({ type: "text", value: "\n" }, foot);
- }
- return Array.isArray(node2) ? { type: "root", children: node2 } : node2;
-}
-
-// node_modules/remark-html/index.js
-function remarkHtml(settings = {}) {
- const options = { ...settings };
- let clean2;
- if (typeof options.sanitize === "boolean") {
- clean2 = options.sanitize;
- options.sanitize = void 0;
- }
- if (typeof clean2 !== "boolean") {
- clean2 = true;
- }
- Object.assign(this, { Compiler: compiler2 });
- function compiler2(node2, file) {
- const hast = toHast(node2, {
- allowDangerousHtml: !clean2,
- handlers: options.handlers
- });
- const cleanHast = clean2 ? sanitize(hast, options.sanitize) : hast;
- const result = toHtml(
- cleanHast,
- Object.assign({}, options, { allowDangerousHtml: !clean2 })
- );
- if (file.extname) {
- file.extname = ".html";
- }
- return node2 && node2.type && node2.type === "root" && result && /[^\r\n]/.test(result.charAt(result.length - 1)) ? result + "\n" : result;
- }
-}
-
-// src/core/utils/markdown/mdToHTML.ts
-async function markdownToHtml(markdown) {
- const result = await remark().use(remarkHtml).process(markdown);
- return result.toString();
-}
-
-// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx
-var import_react134 = __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_react133 = __toESM(require_react());
-var RemoteMarkdownHeaderView = (props) => {
- const { name: name317, fm } = props;
- const [collapsed, setCollapsed] = (0, import_react133.useState)(false);
- const tags3 = fm.tags ?? [];
- const [values2, setValues] = (0, import_react133.useState)({});
- const [columns, setColumns] = (0, import_react133.useState)([]);
- (0, import_react133.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_react133.useMemo)(
- () => ({
- name: name317,
- path: name317,
- displayName: name317,
- type: "note",
- label: {
- sticker: fm.sticker,
- color: fm.color,
- name: name317
- },
- metadata: {
- property: {
- banner: fm.banner
+ this.resizeItem = (item, size2) => {
+ const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
+ const delta = size2 - itemSize;
+ if (delta !== 0) {
+ if (item.start < this.scrollOffset + this.scrollAdjustments) {
+ if (false) {
+ console.info("correction", delta);
+ }
+ this._scrollToOffset(this.scrollOffset, {
+ adjustments: this.scrollAdjustments += delta,
+ behavior: void 0
+ });
}
+ this.pendingMeasuredCacheIndexes.push(item.index);
+ this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2));
+ this.notify(false);
}
- }),
- [fm, name317]
- );
- return /* @__PURE__ */ import_react133.default.createElement(PathProvider, {
- superstate: props.superstate,
- path: props.name,
- pathState,
- readMode: true
- }, pathState.metadata.property.banner && /* @__PURE__ */ import_react133.default.createElement(BannerView, {
- superstate: props.superstate
- }), /* @__PURE__ */ import_react133.default.createElement("div", {
- className: "mk-path-context-component"
- }, /* @__PURE__ */ import_react133.default.createElement("div", {
- className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}`
- }, /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null, fm.sticker ? /* @__PURE__ */ import_react133.default.createElement("div", {
- className: "mk-header-icon"
- }, /* @__PURE__ */ import_react133.default.createElement("div", {
- className: `mk-path-icon`
- }, /* @__PURE__ */ import_react133.default.createElement("div", {
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(fm.sticker)
- }
- }))) : /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null), /* @__PURE__ */ import_react133.default.createElement("div", {
- className: "mk-inline-title inline-title"
- }, pathNameToString(name317))))), !collapsed ? /* @__PURE__ */ import_react133.default.createElement("div", {
- className: "mk-path-context-component"
- }, /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null, /* @__PURE__ */ import_react133.default.createElement("div", {
- className: "mk-path-context-section"
- }, columns.map((f2, i4) => /* @__PURE__ */ import_react133.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_react133.default.createElement(import_react133.default.Fragment, null));
-};
-
-// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx
-var FileLinkViewComponent = (props) => {
- const ref2 = (0, import_react134.useRef)(null);
- const [markdown, setMarkdown] = (0, import_react134.useState)("");
- const [fm, setFM] = (0, import_react134.useState)({});
- (0, import_react134.useEffect)(() => {
- markdownToHtml(markdown).then((html7) => {
- ref2.current.innerHTML = html7;
- });
- }, [markdown]);
- (0, import_react134.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_obsidian6.parseYaml)(yamlContent));
- } else {
- setMarkdown(f2);
+ };
+ this.measureElement = (node) => {
+ if (!node) {
+ return;
+ }
+ this._measureElement(node, void 0);
+ };
+ this.getVirtualItems = memo3(
+ () => [this.getIndexes(), this.getMeasurements()],
+ (indexes, measurements) => {
+ const virtualItems = [];
+ for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
+ const i4 = indexes[k2];
+ const measurement = measurements[i4];
+ virtualItems.push(measurement);
}
- });
- return;
- }
- fetch(props.path).then((res) => res.text()).then((f2) => {
- const match2 = f2.match(regexYaml);
- if (match2) {
- setMarkdown(f2.replace(match2[0], ""));
- const yamlContent = match2[1];
- setFM((0, import_obsidian6.parseYaml)(yamlContent));
- } else {
- setMarkdown(f2);
+ return virtualItems;
+ },
+ {
+ key: false,
+ debug: () => this.options.debug
}
- });
- }, [props.path]);
- return /* @__PURE__ */ import_react134.default.createElement("div", {
- className: (0, import_classnames3.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_react134.default.createElement("div", {
- className: "mk-remote-header"
- }, /* @__PURE__ */ import_react134.default.createElement(RemoteMarkdownHeaderView, {
- superstate: props.superstate,
- name: fm.name ?? props.path,
- fm
- })), /* @__PURE__ */ import_react134.default.createElement("div", {
- className: "markdown-preview-sizer markdown-preview-section",
- ref: ref2
- }));
-};
-
-// src/core/react/components/PathView/PathView.tsx
-var import_react145 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Contexts/SpaceView.tsx
-var import_react144 = __toESM(require_react());
-
-// node_modules/react-error-boundary/dist/react-error-boundary.cjs.mjs
-var import_react_error_boundary_cjs = __toESM(require_react_error_boundary_cjs(), 1);
-
-// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx
-var import_lodash17 = __toESM(require_lodash());
-
-// src/core/react/context/SidebarContext.tsx
-var import_lodash16 = __toESM(require_lodash());
-var import_react135 = __toESM(require_react());
-var NavigatorContext = (0, import_react135.createContext)({
- dragPaths: [],
- setDragPaths: import_lodash16.default.noop,
- selectedPaths: [],
- setSelectedPaths: import_lodash16.default.noop,
- activePath: null,
- setActivePath: import_lodash16.default.noop,
- activeViewSpaces: [],
- waypoints: [],
- setWaypoints: import_lodash16.default.noop,
- saveActiveSpace: import_lodash16.default.noop,
- closeActiveSpace: import_lodash16.default.noop,
- modifier: null,
- setModifier: import_lodash16.default.noop
-});
-var SidebarProvider = (props) => {
- const [modifier, setModifier] = (0, import_react135.useState)(null);
- const [dragPaths, setDragPaths] = (0, import_react135.useState)([]);
- const [selectedPaths, setSelectedPaths] = (0, import_react135.useState)([]);
- const [activePath, setActivePath] = (0, import_react135.useState)(null);
- const [waypoints, setWaypoints] = (0, import_react135.useState)(
- props.superstate.waypoints
- );
- const [activeViewSpaces, setActiveViewSpaces] = (0, import_react135.useState)(
- (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2)
- );
- const setActiveViewSpaceByPath = (path3) => {
- const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] };
- newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path3), path3];
- if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) {
- props.superstate.spaceManager.saveWaypoints([
- ...props.superstate.waypoints,
- newWaypoint
- ]);
- }
- const newWaypoints = props.superstate.waypoints.map(
- (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2
- );
- props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2));
- };
- const closeActiveViewSpace = (path3) => {
- const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] };
- newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path3)];
- if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) {
- props.superstate.spaceManager.saveWaypoints([
- ...props.superstate.waypoints,
- newWaypoint
- ]);
- }
- const newWaypoints = props.superstate.waypoints.map(
- (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2
- );
- props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2));
- };
- const saveWaypoints = (paths) => {
- props.superstate.spaceManager.saveWaypoints(paths.filter((f2) => f2));
- };
- 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.spacesIndex.get(f2))
- );
- }
- };
- const reloadPaths = () => {
- setWaypoints(props.superstate.waypoints);
- setActiveViewSpaces(
- (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2)
- );
- };
- (0, import_react135.useEffect)(() => {
- props.superstate.eventsDispatcher.addListener(
- "spaceStateUpdated",
- refreshSpaces
- );
- props.superstate.eventsDispatcher.addListener(
- "settingsChanged",
- reloadPaths
- );
- props.superstate.eventsDispatcher.addListener(
- "superstateUpdated",
- reloadPaths
);
- return () => {
- props.superstate.eventsDispatcher.removeListener(
- "spaceStateUpdated",
- refreshSpaces
- );
- props.superstate.eventsDispatcher.removeListener(
- "settingsChanged",
- reloadPaths
- );
- props.superstate.eventsDispatcher.removeListener(
- "superstateUpdated",
- reloadPaths
+ this.getVirtualItemForOffset = (offset2) => {
+ const measurements = this.getMeasurements();
+ return notUndefined(
+ measurements[findNearestBinarySearch(
+ 0,
+ measurements.length - 1,
+ (index2) => notUndefined(measurements[index2]).start,
+ offset2
+ )]
);
};
- }, []);
- return /* @__PURE__ */ import_react135.default.createElement(NavigatorContext.Provider, {
- value: {
- dragPaths,
- setDragPaths,
- selectedPaths,
- setSelectedPaths,
- activePath,
- setActivePath,
- activeViewSpaces,
- waypoints,
- setWaypoints: saveWaypoints,
- saveActiveSpace: setActiveViewSpaceByPath,
- closeActiveSpace: closeActiveViewSpace,
- modifier,
- setModifier
- }
- }, props.children);
-};
-
-// src/core/types/types.ts
-var eventTypes = {
- frameSelected: "mkmd-active-frame",
- frameLayerSelected: "mkmd-frame-layer",
- refreshView: "mkmd-refresh-view",
- revealPath: "mkmd-reveal-file",
- collapseFolders: "mkmd-collapse-folders",
- toggleBacklinks: "mkmd-toggle-backlinks",
- metadataChange: "mkmd-tags-change",
- vaultChange: "mkmd-vault-change",
- mdbChange: "mkmd-mdb-change",
- spacesChange: "mkmd-spaces-change",
- frameChange: "mkmd-frame-change",
- updateSections: "mkmd-update-sections",
- settingsChanged: "mkmd-settings-changed"
-};
-
-// src/core/utils/dnd/dragPath.ts
-function getMaxDepth(previousItem, dirDown) {
- if (previousItem) {
- if (previousItem.item?.type == "space" && !previousItem.collapsed && dirDown)
- return previousItem.depth + 1;
- return previousItem.depth;
- }
- return 0;
-}
-function getMinDepth(previousItem) {
- if (previousItem) {
- return Math.max(0, previousItem.depth - 1);
- }
- return 0;
-}
-function getDragDepth(offset2, indentationWidth) {
- return Math.round(offset2 / indentationWidth);
-}
-var getMultiProjection = (flattenedTree, paths, overIndex, modifier) => {
- const overItem = flattenedTree[overIndex];
- if (!overItem)
- return;
- const dropTarget = overItem.type == "file" ? flattenedTree.find((f2) => f2.id == overItem.parentId) : overItem;
- if (dropTarget && dropTarget.type != "file") {
- const _projected = {
- depth: overItem.depth,
- overId: overItem.id,
- parentId: dropTarget.id,
- sortable: false,
- insert: dropTarget.collapsed,
- droppable: true,
- copy: modifier == "link" || modifier == "copy",
- reorder: false
- };
- return _projected;
- }
- return null;
-};
-function getProjection(activeItem, items, paths, overItemIndex, dragDepth, yOffset, dirDown, modifier, activeSpaceID) {
- if (paths.length == 0)
- return null;
- if (paths.length > 1)
- return getMultiProjection(items, paths, overItemIndex, modifier);
- const overItem = items[overItemIndex];
- const previousItem = items[overItemIndex];
- const nextItem = items[overItemIndex + 1];
- if (!previousItem)
- return;
- const previousItemDroppable = previousItem.type != "file";
- const insert2 = activeItem.depth > 0 && overItem.collapsed && previousItemDroppable && (!overItem.sortable || dirDown && yOffset <= 13 || !dirDown && yOffset >= 13);
- const sortable = overItem.sortable || previousItemDroppable && !insert2 && nextItem.sortable;
- const projectedDepth = dragDepth;
- const maxDepth = activeItem.depth == 0 ? 0 : getMaxDepth(
- previousItem,
- dirDown
- );
- const minDepth = getMinDepth(previousItem);
- let depth = projectedDepth;
- if (projectedDepth >= maxDepth) {
- depth = maxDepth;
- } else if (projectedDepth < minDepth) {
- depth = minDepth;
- }
- const parentId = getParentId();
- const parent = items.find((f2) => f2.id == parentId);
- return {
- depth,
- overId: previousItem.id,
- parentId,
- sortable,
- insert: insert2,
- droppable: parent?.type != "file",
- copy: modifier == "link" || modifier == "copy",
- reorder: insert2 ? activeItem?.parentId == overItem?.id : activeItem?.parentId == parent?.id || activeItem?.parentId == activeSpaceID
- };
- function getParentId() {
- if (depth === 0) {
- return null;
- }
- if (!previousItem) {
- return null;
- }
- if (depth === previousItem.depth || depth > previousItem.depth && previousItem.item.type != "space") {
- return previousItem.parentId;
- }
- if (depth > previousItem.depth) {
- return previousItem.id;
- }
- const newParent = items.slice(0, overItemIndex).reverse().find((item) => item.depth === depth)?.parentId;
- return newParent ?? null;
- }
-}
-
-// src/core/utils/keyboard.ts
-var normalizedAltName = () => window.navigator.platform.startsWith("Mac") ? "\u2325" : "Alt";
-
-// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx
-var import_react139 = __toESM(require_react());
-
-// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx
-var import_classnames4 = __toESM(require_classnames());
-var import_react137 = __toESM(require_react());
-
-// node_modules/react-dropzone/dist/es/index.js
-var import_react136 = __toESM(require_react());
-var import_prop_types = __toESM(require_prop_types());
-
-// node_modules/tslib/tslib.es6.mjs
-function __awaiter(thisArg, _arguments, P3, generator) {
- function adopt(value) {
- return value instanceof P3 ? value : new P3(function(resolve2) {
- resolve2(value);
- });
- }
- return new (P3 || (P3 = Promise))(function(resolve2, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e5) {
- reject(e5);
+ this.getOffsetForAlignment = (toOffset, align) => {
+ const size2 = this.getSize();
+ if (align === "auto") {
+ if (toOffset <= this.scrollOffset) {
+ align = "start";
+ } else if (toOffset >= this.scrollOffset + size2) {
+ align = "end";
+ } else {
+ align = "start";
+ }
}
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e5) {
- reject(e5);
+ if (align === "start") {
+ toOffset = toOffset;
+ } else if (align === "end") {
+ toOffset = toOffset - size2;
+ } else if (align === "center") {
+ toOffset = toOffset - size2 / 2;
}
- }
- function step(result) {
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-}
-function __generator(thisArg, body3) {
- var _15 = { label: 0, sent: function() {
- if (t5[0] & 1)
- throw t5[1];
- return t5[1];
- }, trys: [], ops: [] }, f2, y3, t5, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
- return this;
- }), g;
- function verb(n3) {
- return function(v2) {
- return step([n3, v2]);
+ const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
+ const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
+ const maxOffset = scrollSize - this.getSize();
+ return Math.max(Math.min(maxOffset, toOffset), 0);
};
- }
- function step(op) {
- if (f2)
- throw new TypeError("Generator is already executing.");
- while (g && (g = 0, op[0] && (_15 = 0)), _15)
- try {
- if (f2 = 1, y3 && (t5 = op[0] & 2 ? y3["return"] : op[0] ? y3["throw"] || ((t5 = y3["return"]) && t5.call(y3), 0) : y3.next) && !(t5 = t5.call(y3, op[1])).done)
- return t5;
- if (y3 = 0, t5)
- op = [op[0] & 2, t5.value];
- switch (op[0]) {
- case 0:
- case 1:
- t5 = op;
- break;
- case 4:
- _15.label++;
- return { value: op[1], done: false };
- case 5:
- _15.label++;
- y3 = op[1];
- op = [0];
- continue;
- case 7:
- op = _15.ops.pop();
- _15.trys.pop();
- continue;
- default:
- if (!(t5 = _15.trys, t5 = t5.length > 0 && t5[t5.length - 1]) && (op[0] === 6 || op[0] === 2)) {
- _15 = 0;
- continue;
- }
- if (op[0] === 3 && (!t5 || op[1] > t5[0] && op[1] < t5[3])) {
- _15.label = op[1];
- break;
- }
- if (op[0] === 6 && _15.label < t5[1]) {
- _15.label = t5[1];
- t5 = op;
- break;
- }
- if (t5 && _15.label < t5[2]) {
- _15.label = t5[2];
- _15.ops.push(op);
- break;
- }
- if (t5[2])
- _15.ops.pop();
- _15.trys.pop();
- continue;
+ this.getOffsetForIndex = (index2, align = "auto") => {
+ index2 = Math.max(0, Math.min(index2, this.options.count - 1));
+ const measurement = notUndefined(this.getMeasurements()[index2]);
+ if (align === "auto") {
+ if (measurement.end >= this.scrollOffset + this.getSize() - this.options.scrollPaddingEnd) {
+ align = "end";
+ } else if (measurement.start <= this.scrollOffset + this.options.scrollPaddingStart) {
+ align = "start";
+ } else {
+ return [this.scrollOffset, align];
}
- op = body3.call(thisArg, _15);
- } catch (e5) {
- op = [6, e5];
- y3 = 0;
- } finally {
- f2 = t5 = 0;
}
- if (op[0] & 5)
- throw op[1];
- return { value: op[0] ? op[1] : void 0, done: true };
- }
-}
-function __read(o2, n3) {
- var m4 = typeof Symbol === "function" && o2[Symbol.iterator];
- if (!m4)
- return o2;
- var i4 = m4.call(o2), r2, ar = [], e5;
- try {
- while ((n3 === void 0 || n3-- > 0) && !(r2 = i4.next()).done)
- ar.push(r2.value);
- } catch (error) {
- e5 = { error };
- } finally {
- try {
- if (r2 && !r2.done && (m4 = i4["return"]))
- m4.call(i4);
- } finally {
- if (e5)
- throw e5.error;
- }
- }
- return ar;
-}
-function __spreadArray2(to2, from, pack) {
- if (pack || arguments.length === 2)
- for (var i4 = 0, l2 = from.length, ar; i4 < l2; i4++) {
- if (ar || !(i4 in from)) {
- if (!ar)
- ar = Array.prototype.slice.call(from, 0, i4);
- ar[i4] = from[i4];
+ const toOffset = align === "end" ? measurement.end + this.options.scrollPaddingEnd : measurement.start - this.options.scrollPaddingStart;
+ return [this.getOffsetForAlignment(toOffset, align), align];
+ };
+ this.isDynamicMode = () => this.measureElementCache.size > 0;
+ this.cancelScrollToIndex = () => {
+ if (this.scrollToIndexTimeoutId !== null) {
+ clearTimeout(this.scrollToIndexTimeoutId);
+ this.scrollToIndexTimeoutId = null;
}
- }
- return to2.concat(ar || Array.prototype.slice.call(from));
-}
-
-// node_modules/file-selector/dist/es5/file.js
-var COMMON_MIME_TYPES = /* @__PURE__ */ new Map([
- ["aac", "audio/aac"],
- ["abw", "application/x-abiword"],
- ["arc", "application/x-freearc"],
- ["avif", "image/avif"],
- ["avi", "video/x-msvideo"],
- ["azw", "application/vnd.amazon.ebook"],
- ["bin", "application/octet-stream"],
- ["bmp", "image/bmp"],
- ["bz", "application/x-bzip"],
- ["bz2", "application/x-bzip2"],
- ["cda", "application/x-cdf"],
- ["csh", "application/x-csh"],
- ["css", "text/css"],
- ["csv", "text/csv"],
- ["doc", "application/msword"],
- ["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
- ["eot", "application/vnd.ms-fontobject"],
- ["epub", "application/epub+zip"],
- ["gz", "application/gzip"],
- ["gif", "image/gif"],
- ["heic", "image/heic"],
- ["heif", "image/heif"],
- ["htm", "text/html"],
- ["html", "text/html"],
- ["ico", "image/vnd.microsoft.icon"],
- ["ics", "text/calendar"],
- ["jar", "application/java-archive"],
- ["jpeg", "image/jpeg"],
- ["jpg", "image/jpeg"],
- ["js", "text/javascript"],
- ["json", "application/json"],
- ["jsonld", "application/ld+json"],
- ["mid", "audio/midi"],
- ["midi", "audio/midi"],
- ["mjs", "text/javascript"],
- ["mp3", "audio/mpeg"],
- ["mp4", "video/mp4"],
- ["mpeg", "video/mpeg"],
- ["mpkg", "application/vnd.apple.installer+xml"],
- ["odp", "application/vnd.oasis.opendocument.presentation"],
- ["ods", "application/vnd.oasis.opendocument.spreadsheet"],
- ["odt", "application/vnd.oasis.opendocument.text"],
- ["oga", "audio/ogg"],
- ["ogv", "video/ogg"],
- ["ogx", "application/ogg"],
- ["opus", "audio/opus"],
- ["otf", "font/otf"],
- ["png", "image/png"],
- ["pdf", "application/pdf"],
- ["php", "application/x-httpd-php"],
- ["ppt", "application/vnd.ms-powerpoint"],
- ["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"],
- ["rar", "application/vnd.rar"],
- ["rtf", "application/rtf"],
- ["sh", "application/x-sh"],
- ["svg", "image/svg+xml"],
- ["swf", "application/x-shockwave-flash"],
- ["tar", "application/x-tar"],
- ["tif", "image/tiff"],
- ["tiff", "image/tiff"],
- ["ts", "video/mp2t"],
- ["ttf", "font/ttf"],
- ["txt", "text/plain"],
- ["vsd", "application/vnd.visio"],
- ["wav", "audio/wav"],
- ["weba", "audio/webm"],
- ["webm", "video/webm"],
- ["webp", "image/webp"],
- ["woff", "font/woff"],
- ["woff2", "font/woff2"],
- ["xhtml", "application/xhtml+xml"],
- ["xls", "application/vnd.ms-excel"],
- ["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
- ["xml", "application/xml"],
- ["xul", "application/vnd.mozilla.xul+xml"],
- ["zip", "application/zip"],
- ["7z", "application/x-7z-compressed"],
- ["mkv", "video/x-matroska"],
- ["mov", "video/quicktime"],
- ["msg", "application/vnd.ms-outlook"]
-]);
-function toFileWithPath(file, path3) {
- var f2 = withMimeType(file);
- if (typeof f2.path !== "string") {
- var webkitRelativePath = file.webkitRelativePath;
- Object.defineProperty(f2, "path", {
- value: typeof path3 === "string" ? path3 : typeof webkitRelativePath === "string" && webkitRelativePath.length > 0 ? webkitRelativePath : file.name,
- writable: false,
- configurable: false,
- enumerable: true
- });
- }
- return f2;
-}
-function withMimeType(file) {
- var name317 = file.name;
- var hasExtension = name317 && name317.lastIndexOf(".") !== -1;
- if (hasExtension && !file.type) {
- var ext = name317.split(".").pop().toLowerCase();
- var type = COMMON_MIME_TYPES.get(ext);
- if (type) {
- Object.defineProperty(file, "type", {
- value: type,
- writable: false,
- configurable: false,
- enumerable: true
- });
- }
- }
- return file;
-}
-
-// node_modules/file-selector/dist/es5/file-selector.js
-var FILES_TO_IGNORE = [
- ".DS_Store",
- "Thumbs.db"
-];
-function fromEvent(evt) {
- return __awaiter(this, void 0, void 0, function() {
- return __generator(this, function(_a) {
- if (isObject3(evt) && isDataTransfer(evt.dataTransfer)) {
- return [2, getDataTransferFiles(evt.dataTransfer, evt.type)];
- } else if (isChangeEvt(evt)) {
- return [2, getInputFiles(evt)];
- } else if (Array.isArray(evt) && evt.every(function(item) {
- return "getFile" in item && typeof item.getFile === "function";
- })) {
- return [2, getFsHandleFiles(evt)];
+ };
+ this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
+ this.cancelScrollToIndex();
+ if (behavior === "smooth" && this.isDynamicMode()) {
+ console.warn(
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
+ );
}
- return [2, []];
- });
- });
-}
-function isDataTransfer(value) {
- return isObject3(value);
-}
-function isChangeEvt(value) {
- return isObject3(value) && isObject3(value.target);
-}
-function isObject3(v2) {
- return typeof v2 === "object" && v2 !== null;
-}
-function getInputFiles(evt) {
- return fromList(evt.target.files).map(function(file) {
- return toFileWithPath(file);
- });
-}
-function getFsHandleFiles(handles) {
- return __awaiter(this, void 0, void 0, function() {
- var files;
- return __generator(this, function(_a) {
- switch (_a.label) {
- case 0:
- return [4, Promise.all(handles.map(function(h3) {
- return h3.getFile();
- }))];
- case 1:
- files = _a.sent();
- return [2, files.map(function(file) {
- return toFileWithPath(file);
- })];
+ this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
+ adjustments: void 0,
+ behavior
+ });
+ };
+ this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
+ index2 = Math.max(0, Math.min(index2, this.options.count - 1));
+ this.cancelScrollToIndex();
+ if (behavior === "smooth" && this.isDynamicMode()) {
+ console.warn(
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
+ );
}
- });
- });
-}
-function getDataTransferFiles(dt2, type) {
- return __awaiter(this, void 0, void 0, function() {
- var items, files;
- return __generator(this, function(_a) {
- switch (_a.label) {
- case 0:
- if (!dt2.items)
- return [3, 2];
- items = fromList(dt2.items).filter(function(item) {
- return item.kind === "file";
- });
- if (type !== "drop") {
- return [2, items];
+ const [toOffset, align] = this.getOffsetForIndex(index2, 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)
+ );
+ if (elementInDOM) {
+ const [toOffset2] = this.getOffsetForIndex(index2, align);
+ if (!approxEqual(toOffset2, this.scrollOffset)) {
+ this.scrollToIndex(index2, { align, behavior });
+ }
+ } else {
+ this.scrollToIndex(index2, { align, behavior });
}
- return [4, Promise.all(items.map(toFilePromises))];
- case 1:
- files = _a.sent();
- return [2, noIgnoredFiles(flatten3(files))];
- case 2:
- return [2, noIgnoredFiles(fromList(dt2.files).map(function(file) {
- return toFileWithPath(file);
- }))];
+ });
+ }
+ };
+ this.scrollBy = (delta, { behavior } = {}) => {
+ this.cancelScrollToIndex();
+ if (behavior === "smooth" && this.isDynamicMode()) {
+ console.warn(
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
+ );
+ }
+ this._scrollToOffset(this.scrollOffset + delta, {
+ adjustments: void 0,
+ behavior
+ });
+ };
+ this.getTotalSize = () => {
+ var _a;
+ const measurements = this.getMeasurements();
+ let end;
+ if (measurements.length === 0) {
+ end = this.options.paddingStart;
+ } else {
+ end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
+ ...measurements.slice(-this.options.lanes).map((m4) => m4.end)
+ );
}
+ return end - this.options.scrollMargin + this.options.paddingEnd;
+ };
+ this._scrollToOffset = (offset2, {
+ adjustments,
+ behavior
+ }) => {
+ this.options.scrollToFn(offset2, { behavior, adjustments }, this);
+ };
+ this.measure = () => {
+ this.itemSizeCache = /* @__PURE__ */ new Map();
+ this.notify(false);
+ };
+ this.setOptions(opts);
+ this.scrollRect = this.options.initialRect;
+ this.scrollOffset = this.options.initialOffset;
+ this.measurementsCache = this.options.initialMeasurementsCache;
+ this.measurementsCache.forEach((item) => {
+ this.itemSizeCache.set(item.key, item.size);
});
- });
-}
-function noIgnoredFiles(files) {
- return files.filter(function(file) {
- return FILES_TO_IGNORE.indexOf(file.name) === -1;
- });
-}
-function fromList(items) {
- if (items === null) {
- return [];
- }
- var files = [];
- for (var i4 = 0; i4 < items.length; i4++) {
- var file = items[i4];
- files.push(file);
+ this.maybeNotify();
}
- return files;
-}
-function toFilePromises(item) {
- if (typeof item.webkitGetAsEntry !== "function") {
- return fromDataTransferItem(item);
+};
+var findNearestBinarySearch = (low, high, getCurrentValue, value) => {
+ while (low <= high) {
+ const middle = (low + high) / 2 | 0;
+ const currentValue = getCurrentValue(middle);
+ if (currentValue < value) {
+ low = middle + 1;
+ } else if (currentValue > value) {
+ high = middle - 1;
+ } else {
+ return middle;
+ }
}
- var entry = item.webkitGetAsEntry();
- if (entry && entry.isDirectory) {
- return fromDirEntry(entry);
+ if (low > 0) {
+ return low - 1;
+ } else {
+ return 0;
}
- return fromDataTransferItem(item);
-}
-function flatten3(items) {
- return items.reduce(function(acc, files) {
- return __spreadArray2(__spreadArray2([], __read(acc), false), __read(Array.isArray(files) ? flatten3(files) : [files]), false);
- }, []);
-}
-function fromDataTransferItem(item) {
- var file = item.getAsFile();
- if (!file) {
- return Promise.reject("".concat(item, " is not a File"));
+};
+function calculateRange({
+ measurements,
+ outerSize,
+ scrollOffset
+}) {
+ const count3 = measurements.length - 1;
+ const getOffset = (index2) => measurements[index2].start;
+ const startIndex = findNearestBinarySearch(0, count3, getOffset, scrollOffset);
+ let endIndex = startIndex;
+ while (endIndex < count3 && measurements[endIndex].end < scrollOffset + outerSize) {
+ endIndex++;
}
- var fwp = toFileWithPath(file);
- return Promise.resolve(fwp);
-}
-function fromEntry(entry) {
- return __awaiter(this, void 0, void 0, function() {
- return __generator(this, function(_a) {
- return [2, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
- });
- });
+ return { startIndex, endIndex };
}
-function fromDirEntry(entry) {
- var reader = entry.createReader();
- return new Promise(function(resolve2, reject) {
- var entries = [];
- function readEntries() {
- var _this = this;
- reader.readEntries(function(batch) {
- return __awaiter(_this, void 0, void 0, function() {
- var files, err_1, items;
- return __generator(this, function(_a) {
- switch (_a.label) {
- case 0:
- if (!!batch.length)
- return [3, 5];
- _a.label = 1;
- case 1:
- _a.trys.push([1, 3, , 4]);
- return [4, Promise.all(entries)];
- case 2:
- files = _a.sent();
- resolve2(files);
- return [3, 4];
- case 3:
- err_1 = _a.sent();
- reject(err_1);
- return [3, 4];
- case 4:
- return [3, 6];
- case 5:
- items = Promise.all(batch.map(fromEntry));
- entries.push(items);
- readEntries();
- _a.label = 6;
- case 6:
- return [2];
- }
- });
- });
- }, function(err) {
- reject(err);
- });
+
+// node_modules/@tanstack/react-virtual/dist/esm/index.js
+var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? React107.useLayoutEffect : React107.useEffect;
+function useVirtualizerBase(options) {
+ const rerender = React107.useReducer(() => ({}), {})[1];
+ const resolvedOptions = {
+ ...options,
+ onChange: (instance2, sync) => {
+ var _a;
+ if (sync) {
+ (0, import_react_dom6.flushSync)(rerender);
+ } else {
+ rerender();
+ }
+ (_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
}
- readEntries();
+ };
+ const [instance] = React107.useState(
+ () => new Virtualizer(resolvedOptions)
+ );
+ instance.setOptions(resolvedOptions);
+ React107.useEffect(() => {
+ return instance._didMount();
+ }, []);
+ useIsomorphicLayoutEffect3(() => {
+ return instance._willUpdate();
});
+ return instance;
}
-function fromFileEntry(entry) {
- return __awaiter(this, void 0, void 0, function() {
- return __generator(this, function(_a) {
- return [2, new Promise(function(resolve2, reject) {
- entry.file(function(file) {
- var fwp = toFileWithPath(file, entry.fullPath);
- resolve2(fwp);
- }, function(err) {
- reject(err);
- });
- })];
- });
+function useVirtualizer(options) {
+ return useVirtualizerBase({
+ observeElementRect,
+ observeElementOffset,
+ scrollToFn: elementScroll,
+ ...options
});
}
-// node_modules/react-dropzone/dist/es/utils/index.js
-var import_attr_accept = __toESM(require_es());
-function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
-}
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
- return Array.from(iter);
-}
-function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr))
- return _arrayLikeToArray(arr);
-}
-function ownKeys4(object, enumerableOnly) {
- var keys2 = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys2.push.apply(keys2, symbols);
- }
- return keys2;
-}
-function _objectSpread4(target) {
- for (var i4 = 1; i4 < arguments.length; i4++) {
- var source = null != arguments[i4] ? arguments[i4] : {};
- i4 % 2 ? ownKeys4(Object(source), true).forEach(function(key3) {
- _defineProperty2(target, key3, source[key3]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys4(Object(source)).forEach(function(key3) {
- Object.defineProperty(target, key3, Object.getOwnPropertyDescriptor(source, key3));
- });
- }
- return target;
-}
-function _defineProperty2(obj, key3, value) {
- if (key3 in obj) {
- Object.defineProperty(obj, key3, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key3] = value;
- }
- return obj;
-}
-function _slicedToArray(arr, i4) {
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i4) || _unsupportedIterableToArray(arr, i4) || _nonIterableRest();
-}
-function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-function _unsupportedIterableToArray(o2, minLen) {
- if (!o2)
- return;
- if (typeof o2 === "string")
- return _arrayLikeToArray(o2, minLen);
- var n3 = Object.prototype.toString.call(o2).slice(8, -1);
- if (n3 === "Object" && o2.constructor)
- n3 = o2.constructor.name;
- if (n3 === "Map" || n3 === "Set")
- return Array.from(o2);
- if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
- return _arrayLikeToArray(o2, minLen);
-}
-function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) {
- arr2[i4] = arr[i4];
- }
- return arr2;
-}
-function _iterableToArrayLimit(arr, i4) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null)
- return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i4 && _arr.length === i4)
- break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null)
- _i["return"]();
- } finally {
- if (_d)
- throw _e;
- }
- }
- return _arr;
-}
-function _arrayWithHoles(arr) {
- if (Array.isArray(arr))
- return arr;
-}
-var FILE_INVALID_TYPE = "file-invalid-type";
-var FILE_TOO_LARGE = "file-too-large";
-var FILE_TOO_SMALL = "file-too-small";
-var TOO_MANY_FILES = "too-many-files";
-var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr2(accept) {
- accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
- var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
- return {
- code: FILE_INVALID_TYPE,
- message: "File type must be ".concat(messageSuffix)
+// src/core/react/components/Navigator/SpaceTree/SpaceTreeVirtualized.tsx
+var import_react110 = __toESM(require_react());
+var VirtualizedList = import_react110.default.memo(function VirtualizedList2(props) {
+ const {
+ flattenedTree,
+ rowHeights,
+ projected,
+ vRef,
+ selectedPaths,
+ activePath,
+ selectRange: selectRange2,
+ handleCollapse,
+ superstate,
+ overIndex,
+ activeIndex,
+ indentationWidth
+ } = props;
+ const parentRef = import_react110.default.useRef(null);
+ const rowVirtualizer = useVirtualizer({
+ count: flattenedTree.length,
+ paddingEnd: 24,
+ getScrollElement: () => parentRef.current,
+ estimateSize: import_react110.default.useCallback((index2) => rowHeights[index2], [rowHeights]),
+ overscan: 0
+ });
+ vRef.current = rowVirtualizer;
+ const { saveActiveSpace } = (0, import_react110.useContext)(NavigatorContext);
+ const dropIndicator = (index2) => {
+ return overIndex == index2 && projected && projected.insert;
};
-};
-var getTooLargeRejectionErr = function getTooLargeRejectionErr2(maxSize) {
- return {
- code: FILE_TOO_LARGE,
- message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
+ const highlighted = (index2) => {
+ if (!projected || !flattenedTree[index2] || !projected?.droppable)
+ return false;
+ return !projected.sortable && !projected.insert && flattenedTree[index2].parentId && flattenedTree[index2].parentId.startsWith(projected.parentId) || flattenedTree[index2].id == projected.parentId;
};
-};
-var getTooSmallRejectionErr = function getTooSmallRejectionErr2(minSize) {
- return {
- code: FILE_TOO_SMALL,
- message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
+ 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);
};
-};
-var TOO_MANY_FILES_REJECTION = {
- code: TOO_MANY_FILES,
- message: "Too many files"
-};
-function fileAccepted(file, accept) {
- var isAcceptable = file.type === "application/x-moz-file" || (0, import_attr_accept.default)(file, accept);
- return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
-}
-function fileMatchSize(file, minSize, maxSize) {
- if (isDefined2(file.size)) {
- if (isDefined2(minSize) && isDefined2(maxSize)) {
- if (file.size > maxSize)
- return [false, getTooLargeRejectionErr(maxSize)];
- if (file.size < minSize)
- return [false, getTooSmallRejectionErr(minSize)];
- } else if (isDefined2(minSize) && file.size < minSize)
- return [false, getTooSmallRejectionErr(minSize)];
- else if (isDefined2(maxSize) && file.size > maxSize)
- return [false, getTooLargeRejectionErr(maxSize)];
- }
- return [true, null];
-}
-function isDefined2(value) {
- return value !== void 0 && value !== null;
-}
-function allFilesAccepted(_ref) {
- var files = _ref.files, accept = _ref.accept, minSize = _ref.minSize, maxSize = _ref.maxSize, multiple = _ref.multiple, maxFiles = _ref.maxFiles, validator = _ref.validator;
- if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
- return false;
- }
- return files.every(function(file) {
- var _fileAccepted = fileAccepted(file, accept), _fileAccepted2 = _slicedToArray(_fileAccepted, 1), accepted = _fileAccepted2[0];
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray(_fileMatchSize, 1), sizeMatch = _fileMatchSize2[0];
- var customErrors = validator ? validator(file) : null;
- return accepted && sizeMatch && !customErrors;
- });
-}
-function isPropagationStopped(event) {
- if (typeof event.isPropagationStopped === "function") {
- return event.isPropagationStopped();
- } else if (typeof event.cancelBubble !== "undefined") {
- return event.cancelBubble;
- }
- return false;
-}
-function isEvtWithFiles(event) {
- if (!event.dataTransfer) {
- return !!event.target && !!event.target.files;
- }
- return Array.prototype.some.call(event.dataTransfer.types, function(type) {
- return type === "Files" || type === "application/x-moz-file";
- });
-}
-function onDocumentDragOver(event) {
- event.preventDefault();
-}
-function isIe(userAgent) {
- return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
-}
-function isEdge(userAgent) {
- return userAgent.indexOf("Edge/") !== -1;
-}
-function isIeOrEdge() {
- var userAgent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.navigator.userAgent;
- return isIe(userAgent) || isEdge(userAgent);
-}
-function composeEventHandlers() {
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
- fns[_key] = arguments[_key];
- }
- return function(event) {
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
- return fns.some(function(fn) {
- if (!isPropagationStopped(event) && fn) {
- fn.apply(void 0, [event].concat(args));
+ const calcYOffset = (index2) => {
+ if (!projected)
+ return 0;
+ if (projected.insert) {
+ if (projected.copy && !projected.reorder)
+ return 0;
+ if (index2 > activeIndex) {
+ return -rowHeights[index2];
+ } else if (index2 == activeIndex) {
+ return heightBetweenIndex(overIndex, activeIndex);
+ } else {
+ return 0;
}
- return isPropagationStopped(event);
- });
- };
-}
-function canUseFileSystemAccessAPI() {
- return "showOpenFilePicker" in window;
-}
-function pickerOptionsFromAccept(accept) {
- if (isDefined2(accept)) {
- var acceptForPicker = Object.entries(accept).filter(function(_ref2) {
- var _ref3 = _slicedToArray(_ref2, 2), mimeType = _ref3[0], ext = _ref3[1];
- var ok2 = true;
- if (!isMIMEType(mimeType)) {
- console.warn('Skipped "'.concat(mimeType, '" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.'));
- ok2 = false;
+ } else if (projected.sortable) {
+ const targetIndex = overIndex < activeIndex ? overIndex : overIndex;
+ if (projected.copy && !projected.reorder) {
+ if (index2 == activeIndex) {
+ return heightBetweenIndex(targetIndex, activeIndex);
+ } else if (index2 >= targetIndex) {
+ return rowHeights[index2];
+ } else {
+ return 0;
+ }
}
- if (!Array.isArray(ext) || !ext.every(isExt)) {
- console.warn('Skipped "'.concat(mimeType, '" because an invalid file extension was provided.'));
- ok2 = false;
+ if (index2 == activeIndex) {
+ return heightBetweenIndex(targetIndex, activeIndex);
+ } else if (index2 > activeIndex && index2 <= targetIndex) {
+ return -rowHeights[index2];
+ } else if (index2 < activeIndex && index2 >= targetIndex) {
+ return rowHeights[index2];
+ } else {
+ return 0;
}
- return ok2;
- }).reduce(function(agg, _ref4) {
- var _ref5 = _slicedToArray(_ref4, 2), mimeType = _ref5[0], ext = _ref5[1];
- return _objectSpread4(_objectSpread4({}, agg), {}, _defineProperty2({}, mimeType, ext));
- }, {});
- return [{
- description: "Files",
- accept: acceptForPicker
- }];
- }
- return accept;
-}
-function acceptPropAsAcceptAttr(accept) {
- if (isDefined2(accept)) {
- return Object.entries(accept).reduce(function(a4, _ref6) {
- var _ref7 = _slicedToArray(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1];
- return [].concat(_toConsumableArray(a4), [mimeType], _toConsumableArray(ext));
- }, []).filter(function(v2) {
- return isMIMEType(v2) || isExt(v2);
- }).join(",");
- }
- return void 0;
-}
-function isAbort(v2) {
- return v2 instanceof DOMException && (v2.name === "AbortError" || v2.code === v2.ABORT_ERR);
-}
-function isSecurityError(v2) {
- return v2 instanceof DOMException && (v2.name === "SecurityError" || v2.code === v2.SECURITY_ERR);
-}
-function isMIMEType(v2) {
- return v2 === "audio/*" || v2 === "video/*" || v2 === "image/*" || v2 === "text/*" || /\w+\/[-+.\w]+/g.test(v2);
-}
-function isExt(v2) {
- return /^.*\.[\w]+$/.test(v2);
-}
-
-// node_modules/react-dropzone/dist/es/index.js
-var _excluded2 = ["children"];
-var _excluded22 = ["open"];
-var _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"];
-var _excluded4 = ["refKey", "onChange", "onClick"];
-function _toConsumableArray2(arr) {
- return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2();
-}
-function _nonIterableSpread2() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-function _iterableToArray2(iter) {
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
- return Array.from(iter);
-}
-function _arrayWithoutHoles2(arr) {
- if (Array.isArray(arr))
- return _arrayLikeToArray2(arr);
-}
-function _slicedToArray2(arr, i4) {
- return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i4) || _unsupportedIterableToArray2(arr, i4) || _nonIterableRest2();
-}
-function _nonIterableRest2() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-function _unsupportedIterableToArray2(o2, minLen) {
- if (!o2)
- return;
- if (typeof o2 === "string")
- return _arrayLikeToArray2(o2, minLen);
- var n3 = Object.prototype.toString.call(o2).slice(8, -1);
- if (n3 === "Object" && o2.constructor)
- n3 = o2.constructor.name;
- if (n3 === "Map" || n3 === "Set")
- return Array.from(o2);
- if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
- return _arrayLikeToArray2(o2, minLen);
-}
-function _arrayLikeToArray2(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) {
- arr2[i4] = arr[i4];
- }
- return arr2;
-}
-function _iterableToArrayLimit2(arr, i4) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null)
- return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i4 && _arr.length === i4)
- break;
}
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null)
- _i["return"]();
- } finally {
- if (_d)
- throw _e;
+ };
+ return /* @__PURE__ */ import_react110.default.createElement("div", {
+ ref: parentRef,
+ style: {
+ width: `100%`,
+ height: `100%`,
+ overflow: "auto",
+ "--spaceRowHeight": spaceRowHeight(superstate, false) + "px"
}
- }
- return _arr;
-}
-function _arrayWithHoles2(arr) {
- if (Array.isArray(arr))
- return arr;
-}
-function ownKeys5(object, enumerableOnly) {
- var keys2 = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys2.push.apply(keys2, symbols);
- }
- return keys2;
-}
-function _objectSpread5(target) {
- for (var i4 = 1; i4 < arguments.length; i4++) {
- var source = null != arguments[i4] ? arguments[i4] : {};
- i4 % 2 ? ownKeys5(Object(source), true).forEach(function(key3) {
- _defineProperty3(target, key3, source[key3]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys5(Object(source)).forEach(function(key3) {
- Object.defineProperty(target, key3, Object.getOwnPropertyDescriptor(source, key3));
+ }, /* @__PURE__ */ import_react110.default.createElement("div", {
+ style: {
+ height: `${rowVirtualizer.getTotalSize()}px`,
+ width: "100%",
+ position: "relative"
+ }
+ }, rowVirtualizer.getVirtualItems().map((virtualRow) => /* @__PURE__ */ import_react110.default.createElement("div", {
+ key: virtualRow.index,
+ style: {
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: "100%",
+ height: `${rowHeights[virtualRow.index]}px`,
+ transform: `translateY(${virtualRow.start}px)`
+ }
+ }, flattenedTree[virtualRow.index].type == "new" ? /* @__PURE__ */ import_react110.default.createElement("div", {
+ className: "mk-tree-wrapper mk-tree-section",
+ onClick: (e5) => {
+ const offset2 = e5.target.getBoundingClientRect();
+ showSpacesMenu(
+ offset2,
+ props.superstate,
+ (link, isNew) => {
+ if (isNew) {
+ createSpace(props.superstate, link, {}).then((f2) => {
+ saveActiveSpace(link);
+ props.superstate.ui.openPath(link, false);
+ });
+ return;
+ }
+ saveActiveSpace(link);
+ },
+ true,
+ true
+ );
+ }
+ }, /* @__PURE__ */ import_react110.default.createElement("div", {
+ className: "mk-tree-item tree-item-self nav-folder-title mk-tree-new"
+ }, /* @__PURE__ */ import_react110.default.createElement("div", {
+ className: `mk-path-icon mk-path-icon-placeholder`,
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//plus")
+ }
+ }), /* @__PURE__ */ import_react110.default.createElement("div", {
+ className: "mk-tree-text nav-folder-title-content"
+ }, i18n_default.menu.openSpace))) : /* @__PURE__ */ import_react110.default.createElement(TreeItem, {
+ key: flattenedTree[virtualRow.index].id,
+ id: flattenedTree[virtualRow.index].id,
+ data: flattenedTree[virtualRow.index],
+ disabled: false,
+ depth: flattenedTree[virtualRow.index].depth,
+ childCount: flattenedTree[virtualRow.index].childrenCount,
+ indentationWidth,
+ dragStarted: props.dragStarted,
+ dragOver: props.dragOver,
+ dragEnded: props.dragEnded,
+ dragActive: activeIndex != -1,
+ indicator: dropIndicator(virtualRow.index),
+ superstate,
+ ghost: overIndex != -1 && activeIndex == virtualRow.index,
+ style: {
+ opacity: projected && projected.insert && !projected.copy && virtualRow.index == activeIndex ? 0 : 1,
+ transform: CSS.Translate.toString({
+ x: projected && projected.sortable && virtualRow.index == activeIndex && projected ? (projected.depth - flattenedTree[virtualRow.index].depth) * indentationWidth : 0,
+ y: calcYOffset(virtualRow.index),
+ scaleX: 0,
+ scaleY: 0
+ })
+ },
+ onSelectRange: selectRange2,
+ active: activePath == flattenedTree[virtualRow.index].item?.path,
+ highlighted: highlighted(virtualRow.index),
+ selected: selectedPaths.some(
+ (g) => g.id == flattenedTree[virtualRow.index].id
+ ),
+ collapsed: flattenedTree[virtualRow.index].collapsed,
+ onCollapse: handleCollapse
+ })))));
+});
+
+// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx
+var treeForSpace = (superstate, space2, path2, depth, parentId, activeId, sortable, root, parentPath, sort2, expandedSpaces) => {
+ const tree = [];
+ const id3 = parentId ? parentId + "/" + space2.path : space2.path;
+ const spaceCollapsed = !expandedSpaces.includes(id3) || activeId == id3;
+ const spaceSort = space2.metadata?.sort?.field && space2.metadata?.sort?.field != "rank" ? space2.metadata?.sort : sort2 ?? {
+ field: "rank",
+ asc: true,
+ group: true
+ };
+ const children = superstate.getSpaceItems(space2.path) ?? [];
+ if (!spaceCollapsed || root) {
+ children.sort(spaceSortFn(spaceSort)).forEach((item) => {
+ const _parentId = parentId ? parentId + "/" + space2.path : space2.path;
+ if (item.type != "space") {
+ tree.push(
+ pathStateToTreeNode(
+ superstate,
+ item,
+ space2.path,
+ item.path,
+ depth + 1,
+ 0,
+ true,
+ space2.sortable,
+ 0,
+ _parentId
+ )
+ );
+ } else {
+ if (superstate.spacesIndex.has(item.path)) {
+ tree.push(
+ ...treeForSpace(
+ superstate,
+ superstate.spacesIndex.get(item.path),
+ item,
+ depth + 1,
+ _parentId,
+ activeId,
+ space2.sortable,
+ false,
+ space2.path,
+ sort2,
+ expandedSpaces
+ )
+ );
+ }
+ }
});
}
- return target;
-}
-function _defineProperty3(obj, key3, value) {
- if (key3 in obj) {
- Object.defineProperty(obj, key3, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key3] = value;
+ if (!root)
+ tree.splice(
+ 0,
+ 0,
+ spaceToTreeNode(
+ path2,
+ spaceCollapsed,
+ sortable,
+ depth,
+ parentId,
+ parentPath,
+ tree.length
+ )
+ );
+ return tree;
+};
+var treeForRoot = (superstate, space2, active, expandedSpaces) => {
+ const tree = [];
+ const pathIndex = superstate.pathsIndex.get(space2.path);
+ if (pathIndex)
+ tree.push({
+ id: space2.path,
+ parentId: null,
+ depth: 0,
+ index: 0,
+ space: space2.path,
+ path: space2.path,
+ item: pathIndex,
+ rank: null,
+ collapsed: expandedSpaces.includes(space2.path) ? false : true,
+ sortable: space2.sortable,
+ childrenCount: [...superstate.spacesMap.getInverse(space2.path) ?? []].length,
+ type: "group"
+ });
+ const spaceSort = space2.metadata?.sort ?? {
+ field: "rank",
+ asc: true,
+ group: true
+ };
+ if (!expandedSpaces.includes(space2.path) || active && !active.parentId) {
+ return tree;
}
- return obj;
-}
-function _objectWithoutProperties(source, excluded) {
- if (source == null)
- return {};
- var target = _objectWithoutPropertiesLoose2(source, excluded);
- var key3, i4;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i4 = 0; i4 < sourceSymbolKeys.length; i4++) {
- key3 = sourceSymbolKeys[i4];
- if (excluded.indexOf(key3) >= 0)
- continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key3))
- continue;
- target[key3] = source[key3];
+ const children = superstate.getSpaceItems(space2.path) ?? [];
+ children.sort(spaceSortFn(spaceSort)).forEach((item) => {
+ const _parentId = space2.path;
+ if (item.type != "space") {
+ const id3 = _parentId + "/" + item.path;
+ const itemCollapsed = !expandedSpaces.includes(id3);
+ tree.push(
+ pathStateToTreeNode(
+ superstate,
+ item,
+ space2.path,
+ item.path,
+ 1,
+ 0,
+ itemCollapsed,
+ space2.sortable,
+ 0,
+ _parentId
+ )
+ );
+ } else {
+ if (superstate.spacesIndex.has(item.path))
+ tree.push(
+ ...treeForSpace(
+ superstate,
+ superstate.spacesIndex.get(item.path),
+ item,
+ 1,
+ _parentId,
+ active?.id,
+ space2.sortable,
+ false,
+ space2.path,
+ spaceSort,
+ expandedSpaces
+ )
+ );
}
- }
- return target;
-}
-function _objectWithoutPropertiesLoose2(source, excluded) {
- if (source == null)
- return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key3, i4;
- for (i4 = 0; i4 < sourceKeys.length; i4++) {
- key3 = sourceKeys[i4];
- if (excluded.indexOf(key3) >= 0)
- continue;
- target[key3] = source[key3];
- }
- return target;
-}
-var Dropzone = /* @__PURE__ */ (0, import_react136.forwardRef)(function(_ref, ref2) {
- var children = _ref.children, params = _objectWithoutProperties(_ref, _excluded2);
- var _useDropzone = useDropzone(params), open = _useDropzone.open, props = _objectWithoutProperties(_useDropzone, _excluded22);
- (0, import_react136.useImperativeHandle)(ref2, function() {
- return {
- open
- };
- }, [open]);
- return /* @__PURE__ */ import_react136.default.createElement(import_react136.Fragment, null, children(_objectSpread5(_objectSpread5({}, props), {}, {
- open
- })));
-});
-Dropzone.displayName = "Dropzone";
-var defaultProps2 = {
- disabled: false,
- getFilesFromEvent: fromEvent,
- maxSize: Infinity,
- minSize: 0,
- multiple: true,
- maxFiles: 0,
- preventDropOnDocument: true,
- noClick: false,
- noKeyboard: false,
- noDrag: false,
- noDragEventsBubbling: false,
- validator: null,
- useFsAccessApi: true,
- autoFocus: false
-};
-Dropzone.defaultProps = defaultProps2;
-Dropzone.propTypes = {
- children: import_prop_types.default.func,
- accept: import_prop_types.default.objectOf(import_prop_types.default.arrayOf(import_prop_types.default.string)),
- multiple: import_prop_types.default.bool,
- preventDropOnDocument: import_prop_types.default.bool,
- noClick: import_prop_types.default.bool,
- noKeyboard: import_prop_types.default.bool,
- noDrag: import_prop_types.default.bool,
- noDragEventsBubbling: import_prop_types.default.bool,
- minSize: import_prop_types.default.number,
- maxSize: import_prop_types.default.number,
- maxFiles: import_prop_types.default.number,
- disabled: import_prop_types.default.bool,
- getFilesFromEvent: import_prop_types.default.func,
- onFileDialogCancel: import_prop_types.default.func,
- onFileDialogOpen: import_prop_types.default.func,
- useFsAccessApi: import_prop_types.default.bool,
- autoFocus: import_prop_types.default.bool,
- onDragEnter: import_prop_types.default.func,
- onDragLeave: import_prop_types.default.func,
- onDragOver: import_prop_types.default.func,
- onDrop: import_prop_types.default.func,
- onDropAccepted: import_prop_types.default.func,
- onDropRejected: import_prop_types.default.func,
- onError: import_prop_types.default.func,
- validator: import_prop_types.default.func
+ });
+ return tree;
};
-var initialState = {
- isFocused: false,
- isFileDialogActive: false,
- isDragActive: false,
- isDragAccept: false,
- isDragReject: false,
- acceptedFiles: [],
- fileRejections: []
+var retrieveData = (superstate, activeViewSpaces, active, expandedSpaces) => {
+ const tree = [];
+ activeViewSpaces.filter((f2) => f2).forEach((activeViewSpace) => {
+ tree.push(
+ ...treeForRoot(superstate, activeViewSpace, active, expandedSpaces)
+ );
+ });
+ tree.push({
+ id: "placeholder",
+ parentId: null,
+ depth: 0,
+ index: 0,
+ space: null,
+ type: "new",
+ path: null,
+ childrenCount: 0,
+ collapsed: false,
+ rank: 0
+ });
+ return tree;
};
-function useDropzone() {
- var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
- var _defaultProps$props = _objectSpread5(_objectSpread5({}, defaultProps2), props), accept = _defaultProps$props.accept, disabled = _defaultProps$props.disabled, getFilesFromEvent = _defaultProps$props.getFilesFromEvent, maxSize = _defaultProps$props.maxSize, minSize = _defaultProps$props.minSize, multiple = _defaultProps$props.multiple, maxFiles = _defaultProps$props.maxFiles, onDragEnter = _defaultProps$props.onDragEnter, onDragLeave = _defaultProps$props.onDragLeave, onDragOver = _defaultProps$props.onDragOver, onDrop = _defaultProps$props.onDrop, onDropAccepted = _defaultProps$props.onDropAccepted, onDropRejected = _defaultProps$props.onDropRejected, onFileDialogCancel = _defaultProps$props.onFileDialogCancel, onFileDialogOpen = _defaultProps$props.onFileDialogOpen, useFsAccessApi = _defaultProps$props.useFsAccessApi, autoFocus = _defaultProps$props.autoFocus, preventDropOnDocument = _defaultProps$props.preventDropOnDocument, noClick = _defaultProps$props.noClick, noKeyboard = _defaultProps$props.noKeyboard, noDrag = _defaultProps$props.noDrag, noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, onError = _defaultProps$props.onError, validator = _defaultProps$props.validator;
- var acceptAttr = (0, import_react136.useMemo)(function() {
- return acceptPropAsAcceptAttr(accept);
- }, [accept]);
- var pickerTypes = (0, import_react136.useMemo)(function() {
- return pickerOptionsFromAccept(accept);
- }, [accept]);
- var onFileDialogOpenCb = (0, import_react136.useMemo)(function() {
- return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop2;
- }, [onFileDialogOpen]);
- var onFileDialogCancelCb = (0, import_react136.useMemo)(function() {
- return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop2;
- }, [onFileDialogCancel]);
- var rootRef = (0, import_react136.useRef)(null);
- var inputRef = (0, import_react136.useRef)(null);
- var _useReducer = (0, import_react136.useReducer)(reducer2, initialState), _useReducer2 = _slicedToArray2(_useReducer, 2), state = _useReducer2[0], dispatch = _useReducer2[1];
- var isFocused = state.isFocused, isFileDialogActive = state.isFileDialogActive;
- var fsAccessApiWorksRef = (0, import_react136.useRef)(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI());
- var onWindowFocus = function onWindowFocus2() {
- if (!fsAccessApiWorksRef.current && isFileDialogActive) {
- setTimeout(function() {
- if (inputRef.current) {
- var files = inputRef.current.files;
- if (!files.length) {
- dispatch({
- type: "closeDialog"
- });
- onFileDialogCancelCb();
- }
- }
- }, 300);
+var SpaceTreeComponent = (props) => {
+ const { superstate } = props;
+ const indentationWidth = isTouchScreen(props.superstate.ui) ? 20 : 16;
+ const [expandedSpaces, setExpandedSpaces] = (0, import_react111.useState)(
+ superstate.settings.expandedSpaces
+ );
+ const {
+ activePath,
+ activeViewSpaces,
+ setActivePath,
+ selectedPaths,
+ setSelectedPaths,
+ dragPaths,
+ setDragPaths,
+ modifier,
+ setModifier
+ } = (0, import_react111.useContext)(NavigatorContext);
+ const [active, setActive] = (0, import_react111.useState)(null);
+ const [overId, setOverId] = (0, import_react111.useState)(null);
+ const [flattenedTree, setFlattenedTree] = (0, import_react111.useState)([]);
+ const nextTreeScrollPath = (0, import_react111.useRef)(null);
+ const [offset2, setOffset] = (0, import_react111.useState)({ x: 0, y: 0 });
+ const listRef = (0, import_react111.useRef)(null);
+ const refreshableSpaces = (0, import_react111.useMemo)(
+ () => [
+ ...activeViewSpaces.filter((f2) => f2).map((f2) => f2.path),
+ ...flattenedTree.filter((f2) => f2.type == "space").map((f2) => f2.path)
+ ].filter((f2) => f2),
+ [activeViewSpaces, flattenedTree]
+ );
+ (0, import_react111.useEffect)(() => {
+ if (selectedPaths.length <= 1) {
+ if (!selectedPaths[0] || selectedPaths[0].item.path != activePath)
+ setSelectedPaths([]);
+ if (superstate.settings.revealActiveFile)
+ revealPath(activePath);
}
- };
- (0, import_react136.useEffect)(function() {
- window.addEventListener("focus", onWindowFocus, false);
- return function() {
- window.removeEventListener("focus", onWindowFocus, false);
+ props.superstate.ui.eventsDispatch.addListener(
+ "activePathChanged",
+ changeActivePath
+ );
+ return () => {
+ props.superstate.ui.eventsDispatch.removeListener(
+ "activePathChanged",
+ changeActivePath
+ );
};
- }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
- var dragTargetsRef = (0, import_react136.useRef)([]);
- var onDocumentDrop = function onDocumentDrop2(event) {
- if (rootRef.current && rootRef.current.contains(event.target)) {
- return;
- }
- event.preventDefault();
- dragTargetsRef.current = [];
+ }, [activePath]);
+ (0, import_react111.useEffect)(() => {
+ window.addEventListener("dragend", resetState);
+ return () => {
+ window.removeEventListener("dragend", resetState);
+ };
+ });
+ (0, import_react111.useEffect)(() => {
+ const settingsChanged = () => {
+ setExpandedSpaces(superstate.settings.expandedSpaces);
+ };
+ superstate.eventsDispatcher.addListener("settingsChanged", settingsChanged);
+ return () => {
+ superstate.eventsDispatcher.removeListener(
+ "settingsChanged",
+ settingsChanged
+ );
+ };
+ }, [activeViewSpaces, active, setExpandedSpaces, setFlattenedTree]);
+ const revealPath = (0, import_react111.useCallback)(
+ (path2) => {
+ if (!path2 || !activeViewSpaces?.some((f2) => f2.path == "/"))
+ 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
+ ];
+ superstate.settings.expandedSpaces = newOpenFolders;
+ nextTreeScrollPath.current = "/" + path2;
+ superstate.saveSettings();
+ },
+ [expandedSpaces, activeViewSpaces]
+ );
+ (0, import_react111.useEffect)(() => {
+ const handleRevealPathEvent = (evt) => {
+ if (evt.detail)
+ revealPath(evt.detail.path);
+ };
+ window.addEventListener(eventTypes.revealPath, handleRevealPathEvent);
+ return () => {
+ window.removeEventListener(eventTypes.revealPath, handleRevealPathEvent);
+ };
+ }, [revealPath]);
+ (0, import_react111.useEffect)(() => {
+ const reloadData = () => {
+ setFlattenedTree(
+ retrieveData(superstate, activeViewSpaces, active, expandedSpaces)
+ );
+ };
+ const spaceUpdated = (payload) => {
+ if (refreshableSpaces.some((f2) => f2 == payload.path)) {
+ reloadData();
+ }
+ };
+ props.superstate.eventsDispatcher.addListener(
+ "spaceStateUpdated",
+ spaceUpdated
+ );
+ return () => {
+ props.superstate.eventsDispatcher.removeListener(
+ "spaceStateUpdated",
+ spaceUpdated
+ );
+ };
+ }, [
+ expandedSpaces,
+ activeViewSpaces,
+ active,
+ expandedSpaces,
+ refreshableSpaces,
+ setFlattenedTree
+ ]);
+ (0, import_react111.useEffect)(() => {
+ setFlattenedTree(
+ retrieveData(superstate, activeViewSpaces, active, expandedSpaces)
+ );
+ }, [expandedSpaces, activeViewSpaces, active]);
+ const changeActivePath = (path2) => {
+ setActivePath(path2);
};
- (0, import_react136.useEffect)(function() {
- if (preventDropOnDocument) {
- document.addEventListener("dragover", onDocumentDragOver, false);
- document.addEventListener("drop", onDocumentDrop, false);
- }
- return function() {
- if (preventDropOnDocument) {
- document.removeEventListener("dragover", onDocumentDragOver);
- document.removeEventListener("drop", onDocumentDrop);
+ const overIndex = (0, import_react111.useMemo)(
+ () => flattenedTree.findIndex((f2) => f2.id == overId),
+ [overId, flattenedTree]
+ );
+ const activeIndex = (0, import_react111.useMemo)(
+ () => active?.id ? flattenedTree.findIndex((f2) => f2.id == active.id) : -1,
+ [active, flattenedTree]
+ );
+ const sortedIds = (0, import_react111.useMemo)(
+ () => flattenedTree.map(({ id: id3 }) => id3),
+ [flattenedTree]
+ );
+ const selectRange2 = (0, import_react111.useCallback)(
+ (fromId) => {
+ const startIndex = sortedIds.findIndex((f2) => f2 == fromId);
+ const selectedPathsStartIndex = sortedIds.findIndex(
+ (f2) => f2 == selectedPaths[0]?.id
+ );
+ const selectedPathsEndIndex = sortedIds.findIndex(
+ (f2) => f2 == selectedPaths[selectedPaths.length - 1]?.id
+ );
+ if (startIndex < selectedPathsStartIndex) {
+ setSelectedPaths(
+ flattenedTree.slice(startIndex, selectedPathsEndIndex + 1).filter((f2) => f2.item)
+ );
+ } else {
+ setSelectedPaths(
+ flattenedTree.slice(selectedPathsStartIndex, startIndex + 1).filter((f2) => f2.item)
+ );
}
- };
- }, [rootRef, preventDropOnDocument]);
- (0, import_react136.useEffect)(function() {
- if (!disabled && autoFocus && rootRef.current) {
- rootRef.current.focus();
- }
- return function() {
- };
- }, [rootRef, autoFocus, disabled]);
- var onErrCb = (0, import_react136.useCallback)(function(e5) {
- if (onError) {
- onError(e5);
- } else {
- console.error(e5);
- }
- }, [onError]);
- var onDragEnterCb = (0, import_react136.useCallback)(function(event) {
- event.preventDefault();
- event.persist();
- stopPropagation2(event);
- dragTargetsRef.current = [].concat(_toConsumableArray2(dragTargetsRef.current), [event.target]);
- if (isEvtWithFiles(event)) {
- Promise.resolve(getFilesFromEvent(event)).then(function(files) {
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
- return;
- }
- var fileCount = files.length;
- var isDragAccept = fileCount > 0 && allFilesAccepted({
- files,
- accept: acceptAttr,
- minSize,
- maxSize,
- multiple,
- maxFiles,
- validator
- });
- var isDragReject = fileCount > 0 && !isDragAccept;
- dispatch({
- isDragAccept,
- isDragReject,
- isDragActive: true,
- type: "setDraggedFiles"
- });
- if (onDragEnter) {
- onDragEnter(event);
- }
- }).catch(function(e5) {
- return onErrCb(e5);
- });
- }
- }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
- var onDragOverCb = (0, import_react136.useCallback)(function(event) {
- event.preventDefault();
- event.persist();
- stopPropagation2(event);
- var hasFiles = isEvtWithFiles(event);
- if (hasFiles && event.dataTransfer) {
- try {
- event.dataTransfer.dropEffect = "copy";
- } catch (_unused) {
+ },
+ [sortedIds, selectedPaths, setSelectedPaths, flattenedTree]
+ );
+ const [projected, setProjected] = (0, import_react111.useState)(null);
+ (0, import_react111.useEffect)(() => {
+ const dragDepth = getDragDepth(offset2.x, indentationWidth);
+ const _projected = overId ? getProjection(
+ active,
+ flattenedTree,
+ dragPaths,
+ overIndex,
+ dragDepth,
+ offset2.y,
+ activeIndex < overIndex,
+ modifier,
+ active?.space
+ ) : null;
+ setProjected((p) => !(0, import_lodash17.isEqual)(p, _projected) ? _projected : p);
+ }, [
+ active,
+ flattenedTree,
+ overId,
+ overIndex,
+ dragPaths,
+ offset2,
+ activeIndex,
+ modifier,
+ indentationWidth,
+ activeViewSpaces
+ ]);
+ const dragStarted = (activeId) => {
+ const activeItem = flattenedTree.find(({ id: id3 }) => id3 === activeId);
+ setActive(activeItem);
+ setOverId(activeId);
+ if (activeItem) {
+ if (selectedPaths.length > 1) {
+ setDragPaths(selectedPaths.map((f2) => f2.path));
+ } else {
+ setDragPaths([activeItem.path]);
}
}
- if (hasFiles && onDragOver) {
- onDragOver(event);
- }
- return false;
- }, [onDragOver, noDragEventsBubbling]);
- var onDragLeaveCb = (0, import_react136.useCallback)(function(event) {
- event.preventDefault();
- event.persist();
- stopPropagation2(event);
- var targets = dragTargetsRef.current.filter(function(target) {
- return rootRef.current && rootRef.current.contains(target);
- });
- var targetIdx = targets.indexOf(event.target);
- if (targetIdx !== -1) {
- targets.splice(targetIdx, 1);
+ document.body.style.setProperty("cursor", "grabbing");
+ };
+ const parentName = (0, import_react111.useMemo)(
+ () => projected ? flattenedTree.find((f2) => f2.id == projected.parentId)?.item?.name : null,
+ [flattenedTree, projected]
+ );
+ const overName = (0, import_react111.useMemo)(
+ () => projected && flattenedTree.find((f2) => f2.id == projected.overId)?.item?.name,
+ [flattenedTree, projected]
+ );
+ const dragOver = (e5, _overId, position) => {
+ const modifier2 = eventToModifier(e5);
+ setModifier(modifier2);
+ e5.dataTransfer.dropEffect = modifier2;
+ if (projected) {
+ superstate.ui.setDragLabel(
+ `${projected.reorder && !projected.insert ? i18n_default.labels.reorderIn : modifier2 == "move" || !modifier2 ? i18n_default.labels.moveTo : modifier2 == "link" ? i18n_default.labels.addTo : i18n_default.labels.copyTo} ${projected.insert ? overName : parentName ?? "Spaces"}`
+ );
}
- dragTargetsRef.current = targets;
- if (targets.length > 0) {
+ if (dragPaths.length > 1) {
+ if (_overId && _overId != overId)
+ setOverId(_overId);
return;
}
- dispatch({
- type: "setDraggedFiles",
- isDragActive: false,
- isDragAccept: false,
- isDragReject: false
- });
- if (isEvtWithFiles(event) && onDragLeave) {
- onDragLeave(event);
- }
- }, [rootRef, onDragLeave, noDragEventsBubbling]);
- var setFiles = (0, import_react136.useCallback)(function(files, event) {
- var acceptedFiles = [];
- var fileRejections = [];
- files.forEach(function(file) {
- var _fileAccepted = fileAccepted(file, acceptAttr), _fileAccepted2 = _slicedToArray2(_fileAccepted, 2), accepted = _fileAccepted2[0], acceptError = _fileAccepted2[1];
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray2(_fileMatchSize, 2), sizeMatch = _fileMatchSize2[0], sizeError = _fileMatchSize2[1];
- var customErrors = validator ? validator(file) : null;
- if (accepted && sizeMatch && !customErrors) {
- acceptedFiles.push(file);
- } else {
- var errors = [acceptError, sizeError];
- if (customErrors) {
- errors = errors.concat(customErrors);
- }
- fileRejections.push({
- file,
- errors: errors.filter(function(e5) {
- return e5;
- })
- });
- }
- });
- if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
- acceptedFiles.forEach(function(file) {
- fileRejections.push({
- file,
- errors: [TOO_MANY_FILES_REJECTION]
- });
+ if (_overId && _overId != overId)
+ setOverId(_overId);
+ const x2 = offset2.x;
+ const y3 = offset2.y;
+ const newX = 2 * Math.round(Math.max(1, position.x - indentationWidth - 20));
+ const newY = 2 * Math.round(position.y / 2);
+ if (x2 != newX || y3 != newY) {
+ setOffset({
+ x: newX,
+ y: newY
});
- acceptedFiles.splice(0);
- }
- dispatch({
- acceptedFiles,
- fileRejections,
- type: "setFiles"
- });
- if (onDrop) {
- onDrop(acceptedFiles, fileRejections, event);
- }
- if (fileRejections.length > 0 && onDropRejected) {
- onDropRejected(fileRejections, event);
- }
- if (acceptedFiles.length > 0 && onDropAccepted) {
- onDropAccepted(acceptedFiles, event);
}
- }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
- var onDropCb = (0, import_react136.useCallback)(function(event) {
- event.preventDefault();
- event.persist();
- stopPropagation2(event);
- dragTargetsRef.current = [];
- if (isEvtWithFiles(event)) {
- Promise.resolve(getFilesFromEvent(event)).then(function(files) {
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
- return;
- }
- setFiles(files, event);
- }).catch(function(e5) {
- return onErrCb(e5);
- });
+ };
+ (0, import_react111.useEffect)(() => {
+ if (dragPaths.length == 0) {
+ setOverId(null);
+ setActive(null);
+ setOffset({ x: 0, y: 0 });
+ setModifier(null);
+ setProjected(null);
+ dragCounter.current = 0;
+ document.body.style.setProperty("cursor", "");
}
- dispatch({
- type: "reset"
- });
- }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]);
- var openFileDialog = (0, import_react136.useCallback)(function() {
- if (fsAccessApiWorksRef.current) {
- dispatch({
- type: "openDialog"
- });
- onFileDialogOpenCb();
- var opts = {
- multiple,
- types: pickerTypes
- };
- window.showOpenFilePicker(opts).then(function(handles) {
- return getFilesFromEvent(handles);
- }).then(function(files) {
- setFiles(files, null);
- dispatch({
- type: "closeDialog"
- });
- }).catch(function(e5) {
- if (isAbort(e5)) {
- onFileDialogCancelCb(e5);
- dispatch({
- type: "closeDialog"
- });
- } else if (isSecurityError(e5)) {
- fsAccessApiWorksRef.current = false;
- if (inputRef.current) {
- inputRef.current.value = null;
- inputRef.current.click();
- } else {
- onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."));
- }
- } else {
- onErrCb(e5);
- }
- });
- return;
+ }, [dragPaths]);
+ const dragEnded = (e5, overId2) => {
+ const modifiers = eventToModifier(e5);
+ dropPathsInTree(
+ superstate,
+ dragPaths,
+ active?.id,
+ overId2,
+ projected,
+ flattenedTree,
+ activeViewSpaces,
+ modifiers
+ );
+ resetState();
+ };
+ const handleCollapse = (0, import_react111.useCallback)(
+ (folder, open) => {
+ const folderOpen = expandedSpaces?.includes(folder.id);
+ const newOpenFolders = !folderOpen || open ? [...expandedSpaces, folder.id] : expandedSpaces.filter(
+ (openFolder) => folder.id !== openFolder
+ );
+ superstate.settings.expandedSpaces = newOpenFolders;
+ superstate.saveSettings();
+ },
+ [superstate, expandedSpaces]
+ );
+ function resetState() {
+ setDragPaths([]);
+ setOverId(null);
+ setActive(null);
+ setOffset({ x: 0, y: 0 });
+ setModifier(null);
+ setProjected(null);
+ dragCounter.current = 0;
+ document.body.style.setProperty("cursor", "");
+ }
+ const dragCounter = (0, import_react111.useRef)(0);
+ const dragEnter = () => {
+ dragCounter.current++;
+ };
+ const dragLeave = () => {
+ dragCounter.current--;
+ if (dragCounter.current == 0) {
+ setOverId(null);
+ setOffset({ x: 0, y: 0 });
+ setProjected(null);
+ dragCounter.current = 0;
}
- if (inputRef.current) {
- dispatch({
- type: "openDialog"
- });
- onFileDialogOpenCb();
- inputRef.current.value = null;
- inputRef.current.click();
+ };
+ const rowHeights = (0, import_react111.useMemo)(
+ () => flattenedTree.map((f2) => spaceRowHeight(superstate, f2.type == "group")),
+ [flattenedTree]
+ );
+ return /* @__PURE__ */ import_react111.default.createElement("div", {
+ className: `mk-path-tree`,
+ onDragEnter: () => dragEnter(),
+ onDragLeave: () => dragLeave(),
+ onDragOver: (e5) => e5.preventDefault(),
+ onDrop: (e5) => {
+ if (overId) {
+ dragEnded(e5, overId);
+ } else {
+ resetState();
+ }
}
- }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]);
- var onKeyDownCb = (0, import_react136.useCallback)(function(event) {
- if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
- return;
+ }, /* @__PURE__ */ import_react111.default.createElement(VirtualizedList, {
+ vRef: listRef,
+ rowHeights,
+ flattenedTree,
+ projected,
+ handleCollapse,
+ activePath,
+ superstate,
+ selectedPaths,
+ selectRange: selectRange2,
+ indentationWidth,
+ dragStarted,
+ dragOver,
+ dragEnded,
+ overIndex,
+ activeIndex
+ }), modifier && !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react111.default.createElement("div", {
+ className: "mk-hint-dnd",
+ style: {
+ position: "absolute",
+ bottom: "10px",
+ left: "10px",
+ background: "var(--mk-ui-active)",
+ boxShadow: "var(--background-modifier-box-shadow)",
+ padding: "4px 8px",
+ borderRadius: "4px",
+ color: "var(--text-on-accent)",
+ fontSize: "12px"
}
- if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
- event.preventDefault();
- openFileDialog();
+ }, /* @__PURE__ */ import_react111.default.createElement("div", null, i18n_default.hintText.dragDropModifierKeys.replace("${1}", "shift").replace("${2}", normalizedAltName()))));
+};
+
+// src/core/react/components/Navigator/MainList.tsx
+var import_react115 = __toESM(require_react());
+
+// src/core/react/components/Navigator/MainMenu.tsx
+var import_classnames4 = __toESM(require_classnames());
+var import_react112 = __toESM(require_react());
+var MainMenu = (props) => {
+ const { superstate } = props;
+ const { setActivePath, setDragPaths } = (0, import_react112.useContext)(NavigatorContext);
+ const ref2 = (0, import_react112.useRef)();
+ return /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: "mk-main-menu-container"
+ }, /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: "mk-main-menu-inner"
+ }, /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: (0, import_classnames4.default)("mk-main-menu")
+ }, /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: `mk-main-menu-button mk-main-menu-button-primary`,
+ ref: ref2,
+ onClick: (e5) => {
+ props.superstate.ui.mainMenu(ref2.current, superstate);
}
- }, [rootRef, openFileDialog]);
- var onFocusCb = (0, import_react136.useCallback)(function() {
- dispatch({
- type: "focus"
- });
- }, []);
- var onBlurCb = (0, import_react136.useCallback)(function() {
- dispatch({
- type: "blur"
- });
- }, []);
- var onClickCb = (0, import_react136.useCallback)(function() {
- if (noClick) {
- return;
+ }, props.superstate.settings.systemName, /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: "mk-icon-xsmall",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//chevrons-up-down")
}
- if (isIeOrEdge()) {
- setTimeout(openFileDialog, 0);
- } else {
- openFileDialog();
+ })), /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: "mk-main-menu-button",
+ onClick: (e5) => props.superstate.ui.quickOpen(superstate)
+ }, /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: "mk-icon-small",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//search")
}
- }, [noClick, openFileDialog]);
- var composeHandler = function composeHandler2(fn) {
- return disabled ? null : fn;
- };
- var composeKeyboardHandler = function composeKeyboardHandler2(fn) {
- return noKeyboard ? null : composeHandler(fn);
- };
- var composeDragHandler = function composeDragHandler2(fn) {
- return noDrag ? null : composeHandler(fn);
- };
- var stopPropagation2 = function stopPropagation3(event) {
- if (noDragEventsBubbling) {
- event.stopPropagation();
+ }))), /* @__PURE__ */ import_react112.default.createElement("button", {
+ "aria-label": i18n_default.buttons.newNote,
+ className: "mk-main-menu-button",
+ onClick: (e5) => defaultAddAction(superstate, null, e5.metaKey ? "tab" : false)
+ }, /* @__PURE__ */ import_react112.default.createElement("div", {
+ className: "mk-icon-small",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//new-note")
}
- };
- var getRootProps = (0, import_react136.useMemo)(function() {
- return function() {
- var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, role = _ref2.role, onKeyDown = _ref2.onKeyDown, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, onClick = _ref2.onClick, onDragEnter2 = _ref2.onDragEnter, onDragOver2 = _ref2.onDragOver, onDragLeave2 = _ref2.onDragLeave, onDrop2 = _ref2.onDrop, rest = _objectWithoutProperties(_ref2, _excluded3);
- return _objectSpread5(_objectSpread5(_defineProperty3({
- onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
- onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
- onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
- onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
- onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter2, onDragEnterCb)),
- onDragOver: composeDragHandler(composeEventHandlers(onDragOver2, onDragOverCb)),
- onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave2, onDragLeaveCb)),
- onDrop: composeDragHandler(composeEventHandlers(onDrop2, onDropCb)),
- role: typeof role === "string" && role !== "" ? role : "presentation"
- }, refKey, rootRef), !disabled && !noKeyboard ? {
- tabIndex: 0
- } : {}), rest);
- };
- }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
- var onInputElementClick = (0, import_react136.useCallback)(function(event) {
- event.stopPropagation();
- }, []);
- var getInputProps = (0, import_react136.useMemo)(function() {
- return function() {
- var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, onChange = _ref3.onChange, onClick = _ref3.onClick, rest = _objectWithoutProperties(_ref3, _excluded4);
- var inputProps = _defineProperty3({
- accept: acceptAttr,
- multiple,
- type: "file",
- style: {
- display: "none"
- },
- onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
- onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
- tabIndex: -1
- }, refKey, inputRef);
- return _objectSpread5(_objectSpread5({}, inputProps), rest);
- };
- }, [inputRef, accept, multiple, onDropCb, disabled]);
- return _objectSpread5(_objectSpread5({}, state), {}, {
- isFocused: isFocused && !disabled,
- getRootProps,
- getInputProps,
- rootRef,
- inputRef,
- open: composeHandler(openFileDialog)
- });
-}
-function reducer2(state, action) {
- switch (action.type) {
- case "focus":
- return _objectSpread5(_objectSpread5({}, state), {}, {
- isFocused: true
- });
- case "blur":
- return _objectSpread5(_objectSpread5({}, state), {}, {
- isFocused: false
- });
- case "openDialog":
- return _objectSpread5(_objectSpread5({}, initialState), {}, {
- isFileDialogActive: true
- });
- case "closeDialog":
- return _objectSpread5(_objectSpread5({}, state), {}, {
- isFileDialogActive: false
- });
- case "setDraggedFiles":
- return _objectSpread5(_objectSpread5({}, state), {}, {
- isDragActive: action.isDragActive,
- isDragAccept: action.isDragAccept,
- isDragReject: action.isDragReject
- });
- case "setFiles":
- return _objectSpread5(_objectSpread5({}, state), {}, {
- acceptedFiles: action.acceptedFiles,
- fileRejections: action.fileRejections
- });
- case "reset":
- return _objectSpread5({}, initialState);
- default:
- return state;
- }
-}
-function noop2() {
-}
+ }))));
+};
-// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx
-var eventToModifier = (e5, isDefaultSpace) => e5.altKey ? "copy" : e5.shiftKey || isDefaultSpace ? "link" : "move";
-var TreeItem = (props) => {
- const {
- id: id3,
- childCount,
- clone: clone5,
- data: data3,
- depth,
- dragActive,
- ghost,
- active,
- indentationWidth,
+// src/core/react/components/Navigator/Waypoints/Waypoints.tsx
+var import_react114 = __toESM(require_react());
+var import_react_dom7 = __toESM(require_react_dom());
+
+// src/core/react/components/Navigator/Waypoints/Waypoint.tsx
+var import_classnames5 = __toESM(require_classnames());
+var import_react113 = __toESM(require_react());
+var SortablePinnedSpaceItem = ({
+ id: id3,
+ index: index2,
+ ...props
+}) => {
+ return /* @__PURE__ */ import_react113.default.createElement(PinnedSpace, {
+ index: index2,
+ ...props
+ });
+};
+var PinnedSpace = (0, import_react113.forwardRef)(
+ ({
+ pin,
indicator,
- collapsed,
- selected,
highlighted,
- onCollapse,
- onSelectRange,
- style,
superstate,
- disabled,
- dragStarted,
+ style,
+ clone: clone5,
+ ghost,
+ dragStart,
dragOver,
- dragEnded
- } = props;
+ dragEnded,
+ index: index2
+ }, ref2) => {
+ const innerRef = (0, import_react113.useRef)(null);
+ const {
+ activePath,
+ waypoints,
+ setWaypoints,
+ setModifier
+ } = (0, import_react113.useContext)(NavigatorContext);
+ const onDragStarted = (e5) => {
+ if (dragStart && pin) {
+ dragStart(index2);
+ }
+ };
+ const onDragEnded = (e5) => {
+ if (dragEnded) {
+ dragEnded();
+ }
+ };
+ const innerProps = {
+ draggable: true,
+ onDragStart: onDragStarted,
+ onDragEnd: onDragEnded,
+ onDrop: onDragEnded
+ };
+ return pin ? /* @__PURE__ */ import_react113.default.createElement("div", {
+ onContextMenu: (e5) => {
+ const menuOptions = [
+ {
+ name: "Change Sticker",
+ icon: "ui//edit",
+ value: "change-sticker",
+ onClick: () => {
+ superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react113.default.createElement(StickerModal_default, {
+ ui: superstate.ui,
+ hide: _props.hide,
+ selectedSticker: (emoji) => {
+ setWaypoints(
+ waypoints.map(
+ (f2, i4) => i4 == index2 ? { ...f2, sticker: emoji } : f2
+ )
+ );
+ }
+ }));
+ }
+ },
+ {
+ name: "Close",
+ icon: "ui//close",
+ value: "close",
+ onClick: () => {
+ setWaypoints(waypoints.filter((f2, i4) => i4 != index2));
+ superstate.saveSettings();
+ }
+ }
+ ];
+ superstate.ui.openMenu(
+ e5.target.getBoundingClientRect(),
+ defaultMenu(superstate.ui, menuOptions)
+ );
+ },
+ ref: innerRef,
+ className: "mk-waypoint",
+ onClick: (e5) => {
+ superstate.settings.currentWaypoint = index2;
+ superstate.saveSettings();
+ },
+ onDragOver: (e5) => {
+ e5.preventDefault();
+ setModifier(eventToModifier(e5));
+ if (!innerRef.current)
+ return;
+ const rect = innerRef.current.getBoundingClientRect();
+ const x2 = e5.clientX - rect.left;
+ if (dragOver && pin)
+ dragOver(index2, x2);
+ },
+ ...innerProps
+ }, /* @__PURE__ */ import_react113.default.createElement("div", {
+ ref: ref2,
+ className: (0, import_classnames5.default)(
+ "mk-waypoints-item",
+ "clickable-icon",
+ "nav-action-button",
+ (superstate.settings.currentWaypoint == index2 || highlighted) && "mk-active",
+ indicator && "mk-indicator",
+ clone5 && "mk-clone",
+ ghost && "mk-ghost"
+ ),
+ style: {
+ ...style
+ },
+ dangerouslySetInnerHTML: {
+ __html: superstate.ui.getSticker(pin.sticker)
+ }
+ })) : /* @__PURE__ */ import_react113.default.createElement("div", {
+ ref: innerRef,
+ className: "mk-waypoint"
+ }, /* @__PURE__ */ import_react113.default.createElement("div", {
+ ref: ref2,
+ onClick: (e5) => {
+ setWaypoints([
+ ...waypoints,
+ { sticker: "ui//spaces", name: "Waypoint", paths: [] }
+ ]);
+ superstate.saveSettings();
+ },
+ className: (0, import_classnames5.default)(
+ "mk-waypoints-item",
+ "clickable-icon",
+ "nav-action-button",
+ highlighted && "mk-active",
+ indicator && "mk-indicator",
+ clone5 && "mk-clone",
+ ghost && "mk-ghost"
+ )
+ }));
+ }
+);
+PinnedSpace.displayName = "PinnedSpace";
+
+// src/core/react/components/Navigator/Waypoints/Waypoints.tsx
+var SpaceSwitcher = (props) => {
const {
- activePath,
- setActivePath,
- selectedPaths,
- setSelectedPaths,
- setDragPaths,
- closeActiveSpace
- } = (0, import_react137.useContext)(NavigatorContext);
- const [hoverTarget, setHoverTarget] = (0, import_react137.useState)(null);
- const innerRef = (0, import_react137.useRef)(null);
- const [dropHighlighted, setDropHighlighted] = (0, import_react137.useState)(false);
- const [pathState, setPathState] = (0, import_react137.useState)(
- superstate.pathsIndex.get(data3.item.path)
- );
- (0, import_react137.useEffect)(
- () => setPathState(superstate.pathsIndex.get(data3.item.path)),
- [data3.item.path]
- );
- const openPathAtTarget = (path3, e5) => {
- if (e5.shiftKey) {
- onSelectRange(path3.id);
- return;
- } else if (e5.altKey) {
- setSelectedPaths((s4) => [...s4.filter((f2) => f2.id != path3.id), path3]);
+ waypoints,
+ modifier,
+ setModifier,
+ setWaypoints
+ } = (0, import_react114.useContext)(NavigatorContext);
+ const { superstate } = props;
+ const { dragPaths, setDragPaths } = (0, import_react114.useContext)(NavigatorContext);
+ const [activeId, setActiveId] = (0, import_react114.useState)(null);
+ const [overId, setOverId] = (0, import_react114.useState)(null);
+ const dragCounter = (0, import_react114.useRef)(0);
+ const [offset2, setOffset] = (0, import_react114.useState)(0);
+ const [projected, setProjected] = (0, import_react114.useState)(null);
+ const [dropPlaceholder, setDragPlaceholder] = (0, import_react114.useState)(null);
+ (0, import_react114.useEffect)(() => {
+ if (overId === null || dragPaths.length == 0) {
+ setProjected(null);
return;
}
- if (isFolder) {
- if (superstate.settings.expandFolderOnClick) {
- if (collapsed) {
- onCollapse(data3, true);
- } else if (active || selected) {
- onCollapse(data3, false);
- }
- }
- }
- superstate.ui.openPath(
- path3.item.path,
- e5.ctrlKey || e5.metaKey || e5.button == 1 ? e5.altKey ? "split" : "tab" : false
- );
- setActivePath(path3.item.path);
- setSelectedPaths([path3]);
- };
- const onDragStarted = (e5) => {
- if (selectedPaths.length > 1) {
- setDragPaths(selectedPaths.map((f2) => f2.path));
- superstate.ui.dragStarted(
- e5,
- selectedPaths.map((f2) => f2.path)
- );
+ const waypoint = waypoints.find((f2, i4) => i4 == overId);
+ if (!waypoint)
return;
- }
- dragStarted(data3.id);
- setDragPaths([data3.path]);
- superstate.ui.dragStarted(e5, [data3.path]);
+ const _projected = {
+ depth: 0,
+ overId,
+ parentId: null,
+ sortable: false,
+ insert: true,
+ droppable: true,
+ copy: false,
+ reorder: false
+ };
+ setProjected(_projected);
+ return;
+ }, [overId, dragPaths, offset2, modifier, waypoints, activeId]);
+ const resetState = () => {
+ setModifier(null);
+ setOverId(null);
+ setDragPaths([]);
+ setActiveId(null);
+ setProjected(null);
+ setOffset(0);
+ dragCounter.current = 0;
};
- const onDragOver = (e5) => {
- e5.preventDefault();
- if (!innerRef.current)
- return;
- const rect = innerRef.current.getBoundingClientRect();
- const x2 = e5.clientX - rect.left;
- const y3 = e5.clientY - rect.top;
- dragOver(e5, data3.id, { x: x2, y: y3 });
+ const handleDragCancel = () => {
+ resetState();
};
- const onKeyDown = (e5) => {
- if (e5.key === "Control" || e5.key === "Meta") {
- if (e5.repeat)
- return;
- const el = hoverTarget;
- if (el)
- superstate.ui.openPath(pathState.path, "hover", el);
- }
+ const dragEnter = () => {
+ dragCounter.current++;
};
- const onDrop = (0, import_react137.useCallback)((files) => {
- if (isFolder) {
- files.map(async (file) => {
- file.arrayBuffer().then((arrayBuffer) => {
- superstate.spaceManager.writeToPath(
- pathState.path + "/" + file.name,
- arrayBuffer,
- true
- );
- });
- });
+ const dragLeave = () => {
+ dragCounter.current--;
+ if (dragCounter.current == 0) {
+ setOverId(null);
+ setProjected(null);
+ setOffset(0);
+ dragCounter.current = 0;
}
- }, []);
- const onDragEnter = (0, import_react137.useCallback)(() => {
- if (isFolder)
- setDropHighlighted(true);
- }, []);
- const { getRootProps, getInputProps, isDragActive } = useDropzone({
- onDrop,
- onDragEnter,
- onDragLeave: () => setDropHighlighted(false),
- onDropAccepted: () => setDropHighlighted(false),
- onDropRejected: () => setDropHighlighted(false),
- noClick: true
- });
- const onDragEnded = (e5) => {
- dragEnded(e5, data3.id);
- };
- const mouseOut = (e5) => {
- setHoverTarget(null);
};
- const newAction = (e5) => {
- const space3 = superstate.spacesIndex.get(pathState.path);
- if (e5.shiftKey) {
- const offset2 = e5.target.getBoundingClientRect();
- showLinkMenu(
- offset2,
- superstate,
- (link3) => {
- pinPathToSpaceAtIndex(superstate, space3, link3);
- },
- { placeholder: i18n_default.labels.pinNotePlaceholder }
- );
- e5.stopPropagation();
- return;
- }
- defaultAddAction(superstate, space3);
+ const adjustTranslate = ({ transform }) => {
+ return {
+ ...transform,
+ x: transform.x,
+ y: transform.y - 10
+ };
};
- const handleRightClick = (e5) => {
- selectedPaths.length > 1 && selectedPaths.some((f2) => f2.id == data3.id) ? triggerMultiPathMenu(superstate, selectedPaths, e5) : contextMenu(e5);
+ const dragStarted = (id3) => {
+ setActiveId(id3);
};
- const color3 = pathState?.label?.color;
- const contextMenu = (e5) => {
- if (superstate.spacesIndex.has(pathState.path)) {
- showSpaceContextMenu(
- superstate,
- pathState,
- e5,
- activePath,
- data3.space,
- data3.type == "group" ? () => closeActiveSpace(data3.path) : null
- );
- return;
+ const dragOver = (id3, x2) => {
+ setOffset(x2);
+ if (activeId == null) {
+ setOverId(id3);
+ } else {
+ if (id3 == activeId)
+ return;
+ setWaypoints(arrayMove(waypoints, activeId, id3));
+ setActiveId(id3);
}
- showPathContextMenu(
- superstate,
- data3.path,
- data3.space,
- e5.target.getBoundingClientRect(),
- "right"
- );
};
- const pathStateUpdated = (payload) => {
- if (payload.path == pathState?.path) {
- const _pathState = superstate.pathsIndex.get(pathState.path);
- if (_pathState)
- setPathState(_pathState);
+ const dragEnded = () => {
+ if (projected && projected.insert) {
+ const space2 = props.superstate.spacesIndex.get(overId);
+ if (space2)
+ dropPathsInSpaceAtIndex(
+ props.superstate,
+ dragPaths,
+ space2.path,
+ 0,
+ "link"
+ );
+ } else if (dragPaths.length == 1) {
+ const toIndex = overId;
+ if (activeId !== null) {
+ const fromIndex = activeId;
+ setWaypoints(arrayMove(waypoints, fromIndex, toIndex));
+ } else {
+ setWaypoints(
+ waypoints.map(
+ (f2, i4) => i4 == toIndex ? { ...f2, paths: [...f2.paths, dragPaths[0]] } : f2
+ )
+ );
+ }
}
+ resetState();
};
- (0, import_react137.useEffect)(() => {
- superstate.eventsDispatcher.addListener(
- "pathStateUpdated",
- pathStateUpdated
- );
+ function handleDragStart(event) {
+ const {
+ active: { id: activeId2 }
+ } = event;
+ if (event.active.data.current.type != "path")
+ return;
+ dragStarted(activeId2);
+ }
+ function handleDragMove({ delta }) {
+ }
+ function handleDragOver({ over }) {
+ const overId2 = over?.id;
+ if (overId2 !== null) {
+ if (activeId == null) {
+ setOverId(overId2);
+ } else {
+ setWaypoints(
+ arrayMove(waypoints, overId2, parseInt(activeId))
+ );
+ }
+ }
+ }
+ function handleDragEnd({ active, over }) {
+ dragEnded();
+ }
+ (0, import_react114.useEffect)(() => {
+ window.addEventListener("dragend", resetState);
return () => {
- superstate.eventsDispatcher.removeListener(
- "pathStateUpdated",
- pathStateUpdated
- );
+ window.removeEventListener("dragend", resetState);
};
- }, []);
- const hoverItem = (e5) => {
- if (superstate.settings.filePreviewOnHover) {
- setHoverTarget(e5.target);
- if (e5.ctrlKey || e5.metaKey) {
- superstate.ui.openPath(pathState.path, "hover", e5.target);
- }
+ });
+ const width = isTouchScreen(props.superstate.ui) ? 48 : 32;
+ const calcXOffset = (index2) => {
+ if (!projected || projected.insert)
+ return 0;
+ const fromIndex = activeId;
+ const targetIndex = overId;
+ if (activeId === null) {
+ if (index2 >= targetIndex)
+ return width;
+ return 0;
}
- };
- (0, import_react137.useEffect)(() => {
- if (hoverTarget && superstate.settings.filePreviewOnHover) {
- window.addEventListener("keydown", onKeyDown);
- return () => {
- window.removeEventListener("keydown", onKeyDown);
- };
+ if (index2 == fromIndex) {
+ return width * (targetIndex - fromIndex);
+ } else if (index2 > fromIndex && index2 <= targetIndex) {
+ return -width;
+ } else if (index2 < fromIndex && index2 >= targetIndex) {
+ return width;
+ } else {
+ return 0;
}
- }, [hoverTarget]);
- const dropProps = {
- onDragOver
};
- const innerProps = {
- draggable: true,
- onDragStart: onDragStarted,
- onDrop: onDragEnded
- };
- const isSpace = pathState?.type == "space";
- const isFolder = pathState?.metadata?.isFolder || isSpace;
- const extension2 = pathState?.metadata?.file?.extension;
- const isLink = pathState?.parent != data3.space;
- const spacing = data3.type == "group" ? 0 : indentationWidth * (depth - 1) + (data3.type == "space" ? 0 : isTouchScreen(props.superstate.ui) ? 30 : 20);
- return /* @__PURE__ */ import_react137.default.createElement(import_react137.default.Fragment, null, /* @__PURE__ */ import_react137.default.createElement("div", {
- className: (0, import_classnames4.default)(
- "mk-tree-wrapper",
- data3.type == "group" ? "mk-tree-section" : "",
- clone5 && "mk-clone",
- ghost && "mk-ghost",
- highlighted ? "is-highlighted" : ""
- ),
- style: color3?.length > 0 ? {
- "--label-color": `${color3}`,
- "--icon-color": `#ffffff`,
- position: "relative"
- } : {
- "--icon-color": `var(--mk-ui-text-secondary)`,
- position: "relative"
- },
- ref: innerRef,
- onMouseLeave: mouseOut,
- onMouseEnter: hoverItem,
- onKeyDown,
- onClick: (e5) => openPathAtTarget(data3, e5),
- onContextMenu: (e5) => handleRightClick(e5),
- ...dropProps,
- ...innerProps
- }, /* @__PURE__ */ import_react137.default.createElement("div", {
- className: (0, import_classnames4.default)(isFolder ? "nav-folder" : "nav-file"),
+ return /* @__PURE__ */ import_react114.default.createElement(import_react114.default.Fragment, null, /* @__PURE__ */ import_react114.default.createElement("div", {
+ className: "mk-waypoints nav-header",
+ onDragEnter: () => dragEnter(),
+ onDragLeave: () => dragLeave(),
+ onDragOver: (e5) => e5.preventDefault()
+ }, /* @__PURE__ */ import_react114.default.createElement("div", {
+ className: "mk-waypoints-inner nav-buttons-container"
+ }, waypoints.map((pin, i4) => /* @__PURE__ */ import_react114.default.createElement(SortablePinnedSpaceItem, {
+ id: i4,
+ superstate: props.superstate,
+ highlighted: overId == i4 && projected && projected.insert && projected.droppable,
style: {
- ...style,
- ...dragActive ? { pointerEvents: "none" } : {}
+ transform: CSS.Translate.toString({
+ x: calcXOffset(i4),
+ y: 0,
+ scaleX: 0,
+ scaleY: 0
+ })
},
- ...!isTouchScreen(props.superstate.ui) ? getRootProps({ className: "dropzone" }) : {}
- }, /* @__PURE__ */ import_react137.default.createElement("input", {
- ...getInputProps()
- }), /* @__PURE__ */ import_react137.default.createElement("div", {
- className: (0, import_classnames4.default)(
- "mk-tree-item",
- "tree-item-self",
- isFolder ? "nav-folder-title" : "nav-file-title",
- active ? "is-active" : "",
- selected ? "is-selected" : "",
- indicator || dropHighlighted ? "mk-indicator-row" : ""
- ),
- style: {
- "--spacing": `${spacing}px`,
- "--childrenCount": `${data3.type == "space" && !collapsed ? childCount * spaceRowHeight(superstate, false) - 13 : 0}px`
+ index: i4,
+ pin,
+ key: i4,
+ dragStart: dragStarted,
+ dragOver,
+ dragEnded,
+ dragActive: activeId !== null,
+ ghost: activeId === i4
+ })), /* @__PURE__ */ import_react114.default.createElement("div", {
+ className: "mk-waypoint-new",
+ onClick: (e5) => {
+ const newWaypoints = [
+ ...waypoints,
+ { sticker: "ui//spaces", name: "Waypoint", paths: [] }
+ ];
+ props.superstate.settings.currentWaypoint = newWaypoints.length - 1;
+ setWaypoints(newWaypoints);
},
- "data-path": pathState?.path
- }, data3.type == "space" && /* @__PURE__ */ import_react137.default.createElement(CollapseToggle, {
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//plus")
+ }
+ }), overId != null && activeId === null && /* @__PURE__ */ import_react114.default.createElement(SortablePinnedSpaceItem, {
+ id: waypoints.length,
+ superstate: props.superstate,
+ highlighted: false,
+ index: waypoints.length,
+ pin: null
+ })), (0, import_react_dom7.createPortal)(
+ /* @__PURE__ */ import_react114.default.createElement(DragOverlay, {
+ dropAnimation: null,
+ modifiers: [adjustTranslate],
+ zIndex: 1600
+ }, activeId !== null ? /* @__PURE__ */ import_react114.default.createElement(SortablePinnedSpaceItem, {
+ id: -1,
+ superstate: props.superstate,
+ highlighted: false,
+ clone: true,
+ index: activeId,
+ indicator: false,
+ pin: waypoints[activeId]
+ }) : null),
+ document.body
+ )));
+};
+
+// src/core/react/components/Navigator/MainList.tsx
+var MainList = (props) => {
+ const [indexing, setIndexing] = import_react115.default.useState(false);
+ (0, import_react115.useEffect)(() => {
+ const reindex = async () => {
+ setIndexing(true);
+ };
+ const finishedIndex = async () => {
+ setIndexing(false);
+ };
+ props.superstate.eventsDispatcher.addListener("superstateReindex", reindex);
+ props.superstate.eventsDispatcher.addListener(
+ "superstateUpdated",
+ finishedIndex
+ );
+ return () => {
+ props.superstate.eventsDispatcher.removeListener(
+ "superstateReindex",
+ reindex
+ );
+ props.superstate.eventsDispatcher.removeListener(
+ "superstateUpdated",
+ finishedIndex
+ );
+ };
+ }, []);
+ return /* @__PURE__ */ import_react115.default.createElement(import_react115.default.Fragment, null, /* @__PURE__ */ import_react115.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, {
+ FallbackComponent: ErrorFallback
+ }, /* @__PURE__ */ import_react115.default.createElement("div", {
+ className: "mk-progress-bar"
+ }, indexing && /* @__PURE__ */ import_react115.default.createElement("div", {
+ className: "mk-progress-bar-value"
+ })), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react115.default.createElement(MainMenu, {
+ superstate: props.superstate
+ }), /* @__PURE__ */ import_react115.default.createElement(SpaceSwitcher, {
+ superstate: props.superstate
+ }), /* @__PURE__ */ import_react115.default.createElement(SpaceTreeComponent, {
+ superstate: props.superstate
+ })));
+};
+function ErrorFallback({ error }) {
+ const { resetBoundary } = (0, import_react_error_boundary_cjs.useErrorBoundary)();
+ const copyError = () => {
+ navigator.clipboard.writeText(error.message);
+ };
+ return /* @__PURE__ */ import_react115.default.createElement("div", {
+ role: "alert"
+ }, /* @__PURE__ */ import_react115.default.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ import_react115.default.createElement("p", {
+ style: { color: "red" }
+ }, error.message), /* @__PURE__ */ import_react115.default.createElement("button", {
+ onClick: copyError
+ }, "Copy Error"), /* @__PURE__ */ import_react115.default.createElement("button", {
+ onClick: resetBoundary
+ }, "Reload"));
+}
+
+// src/core/react/components/SpaceView/Contexts/SpaceView.tsx
+var SpaceView = (props) => {
+ return /* @__PURE__ */ import_react116.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, {
+ FallbackComponent: ErrorFallback
+ }, /* @__PURE__ */ import_react116.default.createElement(PathProvider, {
superstate: props.superstate,
- collapsed,
- onToggle: (c3, e5) => {
- onCollapse(data3, false);
- e5.stopPropagation();
- }
- }), superstate.settings.spacesStickers && pathState && /* @__PURE__ */ import_react137.default.createElement(PathStickerView, {
- superstate,
- pathState,
- editable: true
- }), /* @__PURE__ */ import_react137.default.createElement("div", {
- className: `mk-tree-text ${isFolder ? "nav-folder-title-content" : "nav-file-title-content"}`
- }, pathState?.displayName ?? pathState?.name ?? data3.path), data3.type == "group" && data3.childrenCount > 0 && /* @__PURE__ */ import_react137.default.createElement(CollapseToggle, {
+ path: props.path,
+ readMode: false
+ }, /* @__PURE__ */ import_react116.default.createElement(SpaceProvider, {
+ superstate: props.superstate
+ }, /* @__PURE__ */ import_react116.default.createElement(FramesMDBProvider, {
superstate: props.superstate,
- collapsed,
- onToggle: (c3, e5) => {
- onCollapse(data3, false);
- e5.stopPropagation();
- }
- }), /* @__PURE__ */ import_react137.default.createElement("div", {
- className: "mk-tree-span"
- }), !isSpace && extension2 != "md" && /* @__PURE__ */ import_react137.default.createElement("span", {
- className: "nav-file-tag"
- }, extension2), !clone5 ? /* @__PURE__ */ import_react137.default.createElement("div", {
- className: "mk-folder-buttons"
- }, /* @__PURE__ */ import_react137.default.createElement("button", {
- "aria-label": i18n_default.buttons.moreOptions,
- onClick: (e5) => {
- contextMenu(e5);
- e5.stopPropagation();
- },
- dangerouslySetInnerHTML: {
- __html: superstate.ui.getSticker("ui//options")
- }
- }), isSpace && /* @__PURE__ */ import_react137.default.createElement("button", {
- "aria-label": i18n_default.buttons.newNote,
- onClick: (e5) => {
- newAction(e5);
- e5.stopPropagation();
- },
- dangerouslySetInnerHTML: {
- __html: superstate.ui.getSticker("ui//plus")
- }
- })) : /* @__PURE__ */ import_react137.default.createElement(import_react137.default.Fragment, null)))));
+ schema: "main"
+ }, /* @__PURE__ */ import_react116.default.createElement(FrameSelectionProvider, {
+ id: "main",
+ superstate: props.superstate,
+ editMode: props.readOnly ? 0 /* Read */ : 1 /* Page */
+ }, /* @__PURE__ */ import_react116.default.createElement(SpaceRoot, {
+ superstate: props.superstate
+ }, props.children))))));
+};
+var SpaceRoot = (props) => {
+ const { pathState } = (0, import_react116.useContext)(PathContext);
+ const { tableData } = (0, import_react116.useContext)(FramesMDBContext);
+ const cols = [
+ ...[...props.superstate.spacesMap.get(pathState.path) ?? []].flatMap(
+ (f2) => props.superstate.contextsIndex.get(f2)?.cols.map((g) => ({ ...g, table: f2 }))
+ ),
+ ...tableData?.cols.map((f2) => ({ ...f2, table: "" })) ?? []
+ ];
+ return /* @__PURE__ */ import_react116.default.createElement(FrameEditorProvider, {
+ superstate: props.superstate,
+ editMode: 1 /* Page */,
+ cols
+ }, props.children);
};
-TreeItem.displayName = "TreeItem";
-
-// node_modules/@tanstack/react-virtual/dist/esm/index.js
-var React133 = __toESM(require_react(), 1);
-var import_react_dom7 = __toESM(require_react_dom(), 1);
-// node_modules/@tanstack/virtual-core/dist/esm/utils.js
-function memo3(getDeps, fn, opts) {
- let deps = opts.initialDeps ?? [];
- let result;
- return () => {
- var _a, _b, _c, _d;
- let depTime;
- if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts)))
- depTime = Date.now();
- const newDeps = getDeps();
- const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index3) => deps[index3] !== dep);
- if (!depsChanged) {
- return result;
- }
- deps = newDeps;
- let resultTime;
- if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts)))
- resultTime = Date.now();
- result = fn(...newDeps);
- if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
- const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
- const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
- const resultFpsPercentage = resultEndTime / 16;
- const pad = (str, num) => {
- str = String(str);
- while (str.length < num) {
- str = " " + str;
- }
- return str;
- };
- console.info(
- `%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
- `
- font-size: .6rem;
- font-weight: bold;
- color: hsl(${Math.max(
- 0,
- Math.min(120 - 120 * resultFpsPercentage, 120)
- )}deg 100% 31%);`,
- opts == null ? void 0 : opts.key
- );
+// node_modules/@air/react-drag-to-select/dist/index.modern.js
+var import_react117 = __toESM(require_react(), 1);
+var import_react_dom8 = __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 t5 = 1; t5 < arguments.length; t5++) {
+ var n3 = arguments[t5];
+ for (var r2 in n3)
+ Object.prototype.hasOwnProperty.call(n3, r2) && (e5[r2] = n3[r2]);
}
- (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
- return result;
- };
+ return e5;
+ }, a3.apply(this, arguments);
}
-function notUndefined(value, msg) {
- if (value === void 0) {
- throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
- } else {
- return value;
- }
+var s3 = ["style"];
+var d3 = (0, import_react117.forwardRef)((t5, u3) => {
+ let { style: d4 = {} } = t5, m4 = function(e5, t6) {
+ if (null == e5)
+ return {};
+ var n3, r2, o2 = {}, l2 = Object.keys(e5);
+ for (r2 = 0; r2 < l2.length; r2++)
+ t6.indexOf(n3 = l2[r2]) >= 0 || (o2[n3] = e5[n3]);
+ return o2;
+ }(t5, s3);
+ const v2 = (0, import_react117.useRef)(null), f2 = (0, import_react117.useRef)(null), [, p] = (0, import_react117.useState)(0);
+ return (0, import_react117.useImperativeHandle)(u3, () => ({ getBoundingClientRect: () => {
+ var e5;
+ return null == (e5 = v2.current) ? void 0 : e5.getBoundingClientRect();
+ }, getParentBoundingClientRect: () => {
+ var e5, t6;
+ return null == v2 || null == (e5 = v2.current) || null == (t6 = e5.parentElement) ? void 0 : t6.getBoundingClientRect();
+ }, drawSelectionBox: (e5) => {
+ requestAnimationFrame(() => {
+ if (f2.current) {
+ const t6 = 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)(t6);
+ }
+ });
+ }, 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_react117.useEffect)(() => {
+ p((e5) => e5 + 1);
+ }, []), import_react117.default.createElement("div", { ref: v2 }, v2.current ? import_react_dom8.default.createPortal(import_react117.default.createElement("div", a3({ ref: f2 }, m4)), v2.current) : null);
+});
+var m3 = (e5, t5) => e5.left <= t5.left + t5.width && e5.left + e5.width >= t5.left && e5.top <= t5.top + t5.height && e5.top + e5.height >= t5.top;
+function v(t5) {
+ const { onSelectionChange: r2, onSelectionEnd: o2, onSelectionStart: c3, isEnabled: i4 = true, selectionProps: s4 = {}, eventsElement: m4, shouldStartSelecting: v2 } = t5 || {}, f2 = (0, import_react117.useRef)(null), { cancelCurrentSelection: p } = function({ containerRef: e5, onSelectionChange: t6, onSelectionStart: r3, onSelectionEnd: o3, isEnabled: c4 = true, eventsElement: i5, shouldStartSelecting: s5 }) {
+ const d4 = (0, import_react117.useRef)(null), m5 = (0, import_react117.useRef)(null), v3 = (0, import_react117.useRef)(false), f3 = (0, import_react117.useRef)(t6), p2 = (0, import_react117.useRef)(r3), h3 = (0, import_react117.useRef)(o3), g = (0, import_react117.useRef)(), y3 = (0, import_react117.useRef)(c4);
+ f3.current = (0, import_react117.useCallback)((e6) => {
+ g.current = t6 ? requestAnimationFrame(() => {
+ t6(e6);
+ }) : void 0;
+ }, [t6]), p2.current = r3, h3.current = o3, y3.current = c4;
+ const b2 = (0, import_react117.useCallback)(() => {
+ var t7;
+ d4.current = null, m5.current = null, v3.current = false, null == (t7 = e5.current) || t7.clearSelectionBox(), "number" == typeof g.current && cancelAnimationFrame(g.current);
+ }, [e5]), S3 = (0, import_react117.useCallback)((t7, n3) => {
+ var r4, o4, l2;
+ return n3 || (n3 = null == (l2 = e5.current) ? void 0 : l2.getParentBoundingClientRect()), { x: t7.clientX - ("number" == typeof (null == (r4 = n3) ? void 0 : r4.left) ? n3.left : 0), y: t7.clientY - ("number" == typeof (null == (o4 = n3) ? void 0 : o4.top) ? n3.top : 0) };
+ }, [e5]), E2 = (0, import_react117.useCallback)((t7, n3) => {
+ if (d4.current && m5.current) {
+ if (!n3)
+ return;
+ const l2 = (({ startPoint: e6, endPoint: t8 }) => ({ left: Math.min(e6.x, t8.x), top: Math.min(e6.y, t8.y), width: Math.abs(e6.x - t8.x), height: Math.abs(e6.y - t8.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(t7), 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_react117.useCallback)((t7) => {
+ var n3;
+ if (!d4.current)
+ return;
+ const r4 = null == (n3 = e5.current) ? void 0 : n3.getParentBoundingClientRect();
+ m5.current = S3(t7, r4), E2(t7, r4);
+ }, [E2, S3, e5]), x2 = (0, import_react117.useCallback)((e6) => {
+ var t7;
+ 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 == (t7 = window) || t7.removeEventListener("mouseup", x2));
+ }, [i5, b2, w2]), C = (0, import_react117.useCallback)((e6) => {
+ if (0 === e6.button && y3.current) {
+ var t7;
+ 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 == (t7 = window) || t7.addEventListener("mouseup", x2);
+ }
+ }, [i5, S3, w2, x2]);
+ return (0, import_react117.useEffect)(() => ((i5 || document.body).addEventListener("mousedown", C), () => {
+ (i5 || document.body).removeEventListener("mousedown", C), (i5 || document.body).removeEventListener("mousemove", w2), window.removeEventListener("mouseup", x2);
+ }), [i5, C, w2, x2]), { cancelCurrentSelection: b2 };
+ }({ containerRef: f2, onSelectionEnd: o2, onSelectionStart: c3, onSelectionChange: r2, isEnabled: i4, eventsElement: m4, shouldStartSelecting: v2 });
+ return { cancelCurrentSelection: p, DragSelection: (0, import_react117.useCallback)(() => import_react117.default.createElement(d3, a3({ ref: f2 }, s4)), []) };
}
-var approxEqual = (a4, b2) => Math.abs(a4 - b2) < 1;
-// node_modules/@tanstack/virtual-core/dist/esm/index.js
-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);
- const arr = [];
- for (let i4 = start; i4 <= end; i4++) {
- arr.push(i4);
- }
- return arr;
-};
-var observeElementRect = (instance, cb) => {
- const element3 = instance.scrollElement;
- if (!element3) {
- return;
- }
- const handler = (rect) => {
- const { width, height } = rect;
- cb({ width: Math.round(width), height: Math.round(height) });
- };
- handler(element3.getBoundingClientRect());
- if (typeof ResizeObserver === "undefined") {
- return () => {
- };
- }
- const observer = new ResizeObserver((entries) => {
- const entry = entries[0];
- if (entry == null ? void 0 : entry.borderBoxSize) {
- const box = entry.borderBoxSize[0];
- if (box) {
- handler({ width: box.inlineSize, height: box.blockSize });
+// src/core/react/components/SpaceView/SpaceOuter.tsx
+var import_react118 = __toESM(require_react());
+var SpaceOuter = (0, import_react118.forwardRef)(
+ (props, ref2) => {
+ const [selectionBox, setSelectionBox] = (0, import_react118.useState)();
+ const selectableItems = (0, import_react118.useRef)([]);
+ const { frameProperties } = (0, import_react118.useContext)(FramesEditorRootContext);
+ const { selectableNodeBounds, id: id3 } = (0, import_react118.useContext)(FrameInstanceContext);
+ const { selectMulti } = (0, import_react118.useContext)(FrameSelectionContext);
+ const { tableData } = (0, import_react118.useContext)(FramesMDBContext);
+ const [dragging, setDragging] = (0, import_react118.useState)(false);
+ const localRef = (0, import_react118.useRef)(null);
+ const [contexts, setContexts] = (0, import_react118.useState)({});
+ const [frameProps, setFrameProps] = (0, import_react118.useState)({});
+ const { pathState } = (0, import_react118.useContext)(PathContext);
+ const { spaceInfo } = (0, import_react118.useContext)(SpaceContext);
+ (0, import_react118.useEffect)(() => {
+ if (!spaceInfo) {
return;
}
- }
- handler(element3.getBoundingClientRect());
- });
- observer.observe(element3, { box: "border-box" });
- return () => {
- observer.unobserve(element3);
- };
-};
-var observeElementOffset = (instance, cb) => {
- const element3 = instance.scrollElement;
- if (!element3) {
- return;
- }
- const handler = () => {
- cb(element3[instance.options.horizontal ? "scrollLeft" : "scrollTop"]);
- };
- handler();
- element3.addEventListener("scroll", handler, {
- passive: true
- });
- return () => {
- element3.removeEventListener("scroll", handler);
- };
-};
-var measureElement = (element3, entry, instance) => {
- if (entry == null ? void 0 : entry.borderBoxSize) {
- const box = entry.borderBoxSize[0];
- if (box) {
- const size2 = Math.round(
- box[instance.options.horizontal ? "inlineSize" : "blockSize"]
- );
- return size2;
- }
- }
- return Math.round(
- element3.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
- );
-};
-var elementScroll = (offset2, {
- adjustments = 0,
- behavior
-}, instance) => {
- var _a, _b;
- const toOffset = offset2 + adjustments;
- (_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
- [instance.options.horizontal ? "left" : "top"]: toOffset,
- behavior
- });
-};
-var Virtualizer = class {
- constructor(opts) {
- this.unsubs = [];
- this.scrollElement = null;
- this.isScrolling = false;
- this.isScrollingTimeoutId = null;
- this.scrollToIndexTimeoutId = null;
- this.measurementsCache = [];
- this.itemSizeCache = /* @__PURE__ */ new Map();
- this.pendingMeasuredCacheIndexes = [];
- this.scrollDirection = null;
- this.scrollAdjustments = 0;
- this.measureElementCache = /* @__PURE__ */ new Map();
- this.observer = /* @__PURE__ */ (() => {
- let _ro = null;
- const get2 = () => {
- if (_ro) {
- return _ro;
- } else if (typeof ResizeObserver !== "undefined") {
- return _ro = new ResizeObserver((entries) => {
- entries.forEach((entry) => {
- this._measureElement(entry.target, entry);
- });
- });
+ const linkedNote = spaceInfo.defPath;
+ const refreshProps = () => {
+ if (tableData) {
+ const properties3 = {
+ ...pathState?.metadata?.property ?? {}
+ };
+ const fixedProps = Object.keys(properties3).reduce(
+ (p, c3) => ({
+ ...p,
+ [c3]: parseProperty(c3, properties3[c3])
+ }),
+ {}
+ );
+ const row2 = linkContextRow(
+ props.superstate.formulaContext,
+ props.superstate.pathsIndex,
+ fixedProps,
+ tableData?.cols ?? [],
+ pathState
+ );
+ setFrameProps(row2);
} else {
- return null;
+ const properties3 = {
+ ...pathState?.metadata?.property ?? {}
+ };
+ setFrameProps(properties3);
}
- };
- return {
- disconnect: () => {
- var _a;
- return (_a = get2()) == null ? void 0 : _a.disconnect();
- },
- observe: (target) => {
- var _a;
- return (_a = get2()) == null ? void 0 : _a.observe(target, { box: "border-box" });
- },
- unobserve: (target) => {
- var _a;
- return (_a = get2()) == null ? void 0 : _a.unobserve(target);
+ 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)?.tables?.[defaultContextSchemaID].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
+ }
+ );
+ setContexts(contexts2);
};
- })();
- this.range = null;
- this.setOptions = (opts2) => {
- Object.entries(opts2).forEach(([key3, value]) => {
- if (typeof value === "undefined")
- delete opts2[key3];
- });
- this.options = {
- debug: false,
- initialOffset: 0,
- overscan: 1,
- paddingStart: 0,
- paddingEnd: 0,
- scrollPaddingStart: 0,
- scrollPaddingEnd: 0,
- horizontal: false,
- getItemKey: defaultKeyExtractor,
- rangeExtractor: defaultRangeExtractor,
- onChange: () => {
- },
- measureElement,
- initialRect: { width: 0, height: 0 },
- scrollMargin: 0,
- gap: 0,
- scrollingDelay: 150,
- indexAttribute: "data-index",
- initialMeasurementsCache: [],
- lanes: 1,
- ...opts2
- };
- };
- this.notify = (sync) => {
- var _a, _b;
- (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
- };
- this.maybeNotify = memo3(
- () => {
- this.calculateRange();
- return [
- this.isScrolling,
- this.range ? this.range.startIndex : null,
- this.range ? this.range.endIndex : null
- ];
- },
- (isScrolling) => {
- this.notify(isScrolling);
- },
- {
- key: false,
- debug: () => this.options.debug,
- initialDeps: [
- this.isScrolling,
- this.range ? this.range.startIndex : null,
- this.range ? this.range.endIndex : null
- ]
- }
+ 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
+ });
+ }
+ }),
+ {}
);
- this.cleanup = () => {
- this.unsubs.filter(Boolean).forEach((d4) => d4());
- this.unsubs = [];
- this.scrollElement = null;
+ const onKeyDown = (e5) => {
+ if (e5.key === "Escape") {
+ props.superstate.ui.resetSelection(null);
+ }
};
- this._didMount = () => {
- this.measureElementCache.forEach(this.observer.observe);
+ (0, import_react118.useEffect)(() => {
+ window.addEventListener("keydown", onKeyDown);
return () => {
- this.observer.disconnect();
- this.cleanup();
+ window.removeEventListener("keydown", onKeyDown);
};
- };
- this._willUpdate = () => {
- const scrollElement = this.options.getScrollElement();
- if (this.scrollElement !== scrollElement) {
- this.cleanup();
- this.scrollElement = scrollElement;
- this._scrollToOffset(this.scrollOffset, {
- adjustments: void 0,
- behavior: void 0
- });
- this.unsubs.push(
- this.options.observeElementRect(this, (rect) => {
- this.scrollRect = rect;
- this.maybeNotify();
- })
- );
- this.unsubs.push(
- this.options.observeElementOffset(this, (offset2) => {
- this.scrollAdjustments = 0;
- if (this.scrollOffset === offset2) {
- return;
- }
- if (this.isScrollingTimeoutId !== null) {
- clearTimeout(this.isScrollingTimeoutId);
- this.isScrollingTimeoutId = null;
- }
- this.isScrolling = true;
- this.scrollDirection = this.scrollOffset < offset2 ? "forward" : "backward";
- this.scrollOffset = offset2;
- this.maybeNotify();
- this.isScrollingTimeoutId = setTimeout(() => {
- this.isScrollingTimeoutId = null;
- this.isScrolling = false;
- this.scrollDirection = null;
- this.maybeNotify();
- }, this.options.scrollingDelay);
- })
- );
- }
- };
- this.getSize = () => {
- return this.scrollRect[this.options.horizontal ? "width" : "height"];
- };
- this.memoOptions = memo3(
- () => [
- this.options.count,
- this.options.paddingStart,
- this.options.scrollMargin,
- this.options.getItemKey
- ],
- (count3, paddingStart, scrollMargin, getItemKey) => {
- this.pendingMeasuredCacheIndexes = [];
- return {
- count: count3,
- paddingStart,
- scrollMargin,
- getItemKey
+ }, []);
+ 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);
},
- {
- key: false
- }
- );
- this.getFurthestMeasurement = (measurements, index3) => {
- const furthestMeasurementsFound = /* @__PURE__ */ new Map();
- const furthestMeasurements = /* @__PURE__ */ new Map();
- for (let m4 = index3 - 1; m4 >= 0; m4--) {
- const measurement = measurements[m4];
- if (furthestMeasurementsFound.has(measurement.lane)) {
- continue;
- }
- const previousFurthestMeasurement = furthestMeasurements.get(
- measurement.lane
- );
- if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
- furthestMeasurements.set(measurement.lane, measurement);
- } else if (measurement.end < previousFurthestMeasurement.end) {
- furthestMeasurementsFound.set(measurement.lane, true);
- }
- if (furthestMeasurementsFound.size === this.options.lanes) {
- break;
- }
- }
- return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a4, b2) => {
- if (a4.end === b2.end) {
- return a4.index - b2.index;
- }
- return a4.end - b2.end;
- })[0] : void 0;
- };
- this.getMeasurements = memo3(
- () => [this.memoOptions(), this.itemSizeCache],
- ({ count: count3, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => {
- const min5 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
- this.pendingMeasuredCacheIndexes = [];
- const measurements = this.measurementsCache.slice(0, min5);
- for (let i4 = min5; i4 < count3; i4++) {
- const key3 = getItemKey(i4);
- const furthestMeasurement = this.options.lanes === 1 ? measurements[i4 - 1] : this.getFurthestMeasurement(measurements, i4);
- const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
- const measuredSize = itemSizeCache.get(key3);
- const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i4);
- const end = start + size2;
- const lane = furthestMeasurement ? furthestMeasurement.lane : i4 % this.options.lanes;
- measurements[i4] = {
- index: i4,
- start,
- size: size2,
- end,
- key: key3,
- lane
- };
- }
- this.measurementsCache = measurements;
- return measurements;
+ onSelectionStart: () => {
+ setDragging(true);
},
- {
- key: false,
- debug: () => this.options.debug
- }
- );
- this.calculateRange = memo3(
- () => [this.getMeasurements(), this.getSize(), this.scrollOffset],
- (measurements, outerSize, scrollOffset) => {
- return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
- measurements,
- outerSize,
- scrollOffset
- }) : null;
+ onSelectionEnd: (e5) => {
+ setTimeout(function() {
+ setDragging(false);
+ }, 100);
},
- {
- key: false,
- debug: () => this.options.debug
- }
- );
- this.getIndexes = memo3(
- () => [
- this.options.rangeExtractor,
- this.calculateRange(),
- this.options.overscan,
- this.options.count
- ],
- (rangeExtractor, range2, overscan, count3) => {
- return range2 === null ? [] : rangeExtractor({
- ...range2,
- overscan,
- count: count3
- });
+ selectionProps: {
+ style: {
+ backgroundColor: "hsla(var(--color-accent-hsl), 0.1)",
+ border: "2px solid var(--color-accent)",
+ borderRadius: 2,
+ opacity: 0.5
+ }
},
- {
- key: false,
- debug: () => this.options.debug
- }
- );
- this.indexFromElement = (node2) => {
- const attributeName = this.options.indexAttribute;
- const indexStr = node2.getAttribute(attributeName);
- if (!indexStr) {
- console.warn(
- `Missing attribute name '${attributeName}={index}' on measured element.`
- );
- return -1;
+ 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 parseInt(indexStr, 10);
- };
- this._measureElement = (node2, entry) => {
- const item = this.measurementsCache[this.indexFromElement(node2)];
- if (!item || !node2.isConnected) {
- this.measureElementCache.forEach((cached, key3) => {
- if (cached === node2) {
- this.observer.unobserve(node2);
- this.measureElementCache.delete(key3);
- }
- });
- return;
+ });
+ return /* @__PURE__ */ import_react118.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;
}
- const prevNode = this.measureElementCache.get(item.key);
- if (prevNode !== node2) {
- if (prevNode) {
- this.observer.unobserve(prevNode);
+ }, /* @__PURE__ */ import_react118.default.createElement(DragSelection, null), /* @__PURE__ */ import_react118.default.createElement(FrameInstanceProvider, {
+ id: id3 ?? "root",
+ superstate: props.superstate,
+ props: frameProps,
+ contexts,
+ propSetters,
+ editable: true
+ }, props.children));
+ }
+);
+SpaceOuter.displayName = "SpaceOuter";
+var SpaceOuter_default = SpaceOuter;
+
+// src/core/react/components/PathView/PathView.tsx
+var PathView = (props) => {
+ const [pathState, setPathState] = (0, import_react119.useState)(
+ props.superstate.pathsIndex.get(props.path)
+ );
+ const ref2 = (0, import_react119.useRef)(null);
+ (0, import_react119.useEffect)(() => {
+ const uri = props.superstate.spaceManager.uriByString(props.path);
+ const pathState2 = props.superstate.pathsIndex.get(props.path);
+ if (!pathState2 && (uri?.scheme == "https" || uri?.scheme == "http")) {
+ setPathState({
+ path: props.path,
+ displayName: uri.path,
+ label: {
+ sticker: uri.scheme,
+ name: uri.path,
+ color: ""
+ },
+ hidden: false,
+ subtype: "md",
+ type: "remote"
+ });
+ return;
+ }
+ setPathState(pathState2);
+ }, [props.path]);
+ return /* @__PURE__ */ import_react119.default.createElement("div", {
+ className: "mk-path-view",
+ style: { ...props.styles ?? {} }
+ }, pathState?.type == "remote" ? pathState.subtype == "note" ? /* @__PURE__ */ import_react119.default.createElement("iframe", {
+ src: props.path
+ }) : /* @__PURE__ */ import_react119.default.createElement("iframe", {
+ src: props.path
+ }) : pathState?.type == "space" ? /* @__PURE__ */ import_react119.default.createElement(SpaceView, {
+ superstate: props.superstate,
+ path: props.path,
+ readOnly: props.readOnly
+ }, /* @__PURE__ */ import_react119.default.createElement(SpaceOuter_default, {
+ superstate: props.superstate,
+ ref: ref2
+ }, /* @__PURE__ */ import_react119.default.createElement(FrameEditorInstance, {
+ containerRef: props.containerRef,
+ superstate: props.superstate
+ }))) : props.superstate.ui.availableViews().some((f2) => f2 == props.path?.split(".").pop()) ? /* @__PURE__ */ import_react119.default.createElement(NoteView, {
+ superstate: props.superstate,
+ path: props.path,
+ load: true,
+ classname: "mk-flow-node"
+ }) : /* @__PURE__ */ import_react119.default.createElement(import_react119.default.Fragment, null));
+};
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx
+var import_react121 = __toESM(require_react());
+
+// src/core/react/components/SpaceView/Frames/SpaceCommand/Suggester.tsx
+var import_react120 = __toESM(require_react());
+var import_react_dom9 = __toESM(require_react_dom());
+var Suggester = (0, import_react120.forwardRef)(
+ (props, outerRef) => {
+ const ref2 = (0, import_react120.useRef)(null);
+ const [index2, setIndex] = (0, import_react120.useState)(0);
+ const [isReady, setIsReady] = (0, import_react120.useState)(false);
+ const menuRef = (0, import_react120.useRef)(null);
+ const [pos, setPos] = (0, import_react120.useState)({ x: 0, y: 0 });
+ const [active, setActive] = (0, import_react120.useState)(false);
+ const [section, setSection] = (0, import_react120.useState)("");
+ (0, import_react120.useEffect)(() => {
+ const resizeObserver = new ResizeObserver((entries) => {
+ if (menuRef.current) {
+ const rect = menuRef.current.getBoundingClientRect();
+ setIsReady(true);
+ setPos(
+ calculateBoundsBasedOnPosition(
+ ref2.current.getBoundingClientRect(),
+ rect,
+ { width: window.innerWidth, height: innerHeight },
+ "bottom"
+ )
+ );
}
- this.observer.observe(node2);
- this.measureElementCache.set(item.key, node2);
+ });
+ if (menuRef.current && ref2.current) {
+ resizeObserver.observe(menuRef.current);
+ resizeObserver.observe(ref2.current);
}
- const measuredItemSize = this.options.measureElement(node2, entry, this);
- this.resizeItem(item, measuredItemSize);
- };
- this.resizeItem = (item, size2) => {
- const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
- const delta = size2 - itemSize;
- if (delta !== 0) {
- if (item.start < this.scrollOffset + this.scrollAdjustments) {
- if (false) {
- console.info("correction", delta);
- }
- this._scrollToOffset(this.scrollOffset, {
- adjustments: this.scrollAdjustments += delta,
- behavior: void 0
- });
+ return () => {
+ resizeObserver.disconnect();
+ };
+ }, [menuRef.current]);
+ const keyDown = (e5) => {
+ if (e5.key == "Delete" || e5.key == "Backspace") {
+ if (ref2.current.innerText == "" && props.onDelete) {
+ props.onDelete();
}
- this.pendingMeasuredCacheIndexes.push(item.index);
- this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2));
- this.notify(false);
- }
- };
- this.measureElement = (node2) => {
- if (!node2) {
- return;
}
- this._measureElement(node2, void 0);
- };
- this.getVirtualItems = memo3(
- () => [this.getIndexes(), this.getMeasurements()],
- (indexes, measurements) => {
- const virtualItems = [];
- for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
- const i4 = indexes[k2];
- const measurement = measurements[i4];
- virtualItems.push(measurement);
+ if (e5.key == "Tab") {
+ if (props.sections && props.onSelectSection) {
+ e5.preventDefault();
+ e5.stopPropagation();
+ setSection((p) => {
+ const sectionIndex = props.sections.findIndex((g) => g.value == p);
+ if (e5.shiftKey) {
+ if (sectionIndex == 0) {
+ return p;
+ }
+ props.onSelectSection(props.sections[sectionIndex - 1].value);
+ return props.sections[sectionIndex - 1].value;
+ }
+ if (sectionIndex == props.sections.length - 1) {
+ return p;
+ }
+ props.onSelectSection(props.sections[sectionIndex + 1].value);
+ return props.sections[sectionIndex + 1].value;
+ });
}
- return virtualItems;
- },
- {
- key: false,
- debug: () => this.options.debug
}
- );
- this.getVirtualItemForOffset = (offset2) => {
- const measurements = this.getMeasurements();
- return notUndefined(
- measurements[findNearestBinarySearch(
- 0,
- measurements.length - 1,
- (index3) => notUndefined(measurements[index3]).start,
- offset2
- )]
- );
- };
- this.getOffsetForAlignment = (toOffset, align) => {
- const size2 = this.getSize();
- if (align === "auto") {
- if (toOffset <= this.scrollOffset) {
- align = "start";
- } else if (toOffset >= this.scrollOffset + size2) {
- align = "end";
+ if (e5.key == "ArrowUp") {
+ const size2 = props.suggestions.length - 1;
+ const newIndex = index2 < 0 ? size2 : index2 - 1;
+ if (props.suggestions[newIndex]?.disabled) {
+ setIndex(newIndex < 0 ? size2 : newIndex - 1);
} else {
- align = "start";
+ setIndex(newIndex);
}
+ e5.preventDefault();
}
- if (align === "start") {
- toOffset = toOffset;
- } else if (align === "end") {
- toOffset = toOffset - size2;
- } else if (align === "center") {
- toOffset = toOffset - size2 / 2;
- }
- const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
- const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
- const maxOffset = scrollSize - this.getSize();
- return Math.max(Math.min(maxOffset, toOffset), 0);
- };
- 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";
- } else if (measurement.start <= this.scrollOffset + this.options.scrollPaddingStart) {
- align = "start";
+ if (e5.key == "ArrowDown") {
+ const size2 = props.suggestions.length - 1;
+ const newIndex = index2 >= size2 ? 0 : index2 + 1;
+ if (props.suggestions[newIndex]?.disabled) {
+ setIndex(newIndex >= size2 ? 0 : newIndex + 1);
} else {
- return [this.scrollOffset, align];
+ setIndex(newIndex);
}
+ e5.preventDefault();
}
- const toOffset = align === "end" ? measurement.end + this.options.scrollPaddingEnd : measurement.start - this.options.scrollPaddingStart;
- return [this.getOffsetForAlignment(toOffset, align), align];
- };
- this.isDynamicMode = () => this.measureElementCache.size > 0;
- this.cancelScrollToIndex = () => {
- if (this.scrollToIndexTimeoutId !== null) {
- clearTimeout(this.scrollToIndexTimeoutId);
- this.scrollToIndexTimeoutId = null;
+ if (e5.key == "Enter") {
+ props.onSelect(props.suggestions[index2]);
+ e5.preventDefault();
}
};
- this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
- this.cancelScrollToIndex();
- if (behavior === "smooth" && this.isDynamicMode()) {
- console.warn(
- "The `smooth` scroll behavior is not fully supported with dynamic size."
- );
- }
- this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
- adjustments: void 0,
- behavior
- });
+ const CLASS_NAMES2 = {
+ root: "mk-menu-container",
+ rootFocused: "mk-focused",
+ selected: "mk-selected",
+ selectedTagWrapper: "mk-menu-selected-tag-wrapper",
+ selectedTag: "mk-menu-selected-tag",
+ selectedTagName: "mk-menu-selected-tag-name",
+ search: "mk-menu-search",
+ searchWrapper: "mk-menu-search-container",
+ searchInput: "mk-menu-search-input",
+ suggestions: "mk-menu-suggestions",
+ suggestionActive: "mk-active",
+ suggestionDisabled: "mk-disabled"
};
- 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(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(index3)
- );
- if (elementInDOM) {
- const [toOffset2] = this.getOffsetForIndex(index3, align);
- if (!approxEqual(toOffset2, this.scrollOffset)) {
- this.scrollToIndex(index3, { align, behavior });
- }
+ return /* @__PURE__ */ import_react120.default.createElement(import_react120.default.Fragment, null, /* @__PURE__ */ import_react120.default.createElement("div", {
+ ref: (node) => {
+ ref2.current = node;
+ if (outerRef) {
+ if (typeof outerRef === "function") {
+ outerRef(node);
} else {
- this.scrollToIndex(index3, { align, behavior });
+ outerRef.current = node;
}
- });
- }
- };
- this.scrollBy = (delta, { behavior } = {}) => {
- this.cancelScrollToIndex();
- if (behavior === "smooth" && this.isDynamicMode()) {
- console.warn(
- "The `smooth` scroll behavior is not fully supported with dynamic size."
- );
- }
- this._scrollToOffset(this.scrollOffset + delta, {
- adjustments: void 0,
- behavior
- });
- };
- this.getTotalSize = () => {
- var _a;
- const measurements = this.getMeasurements();
- let end;
- if (measurements.length === 0) {
- end = this.options.paddingStart;
- } else {
- end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
- ...measurements.slice(-this.options.lanes).map((m4) => m4.end)
- );
- }
- return end - this.options.scrollMargin + this.options.paddingEnd;
- };
- this._scrollToOffset = (offset2, {
- adjustments,
- behavior
- }) => {
- this.options.scrollToFn(offset2, { behavior, adjustments }, this);
- };
- this.measure = () => {
- this.itemSizeCache = /* @__PURE__ */ new Map();
- this.notify(false);
- };
- this.setOptions(opts);
- this.scrollRect = this.options.initialRect;
- this.scrollOffset = this.options.initialOffset;
- this.measurementsCache = this.options.initialMeasurementsCache;
- this.measurementsCache.forEach((item) => {
- this.itemSizeCache.set(item.key, item.size);
- });
- this.maybeNotify();
- }
-};
-var findNearestBinarySearch = (low, high, getCurrentValue, value) => {
- while (low <= high) {
- const middle = (low + high) / 2 | 0;
- const currentValue = getCurrentValue(middle);
- if (currentValue < value) {
- low = middle + 1;
- } else if (currentValue > value) {
- high = middle - 1;
- } else {
- return middle;
- }
- }
- if (low > 0) {
- return low - 1;
- } else {
- return 0;
- }
-};
-function calculateRange({
- measurements,
- outerSize,
- scrollOffset
-}) {
- const count3 = measurements.length - 1;
- const getOffset = (index3) => measurements[index3].start;
- const startIndex = findNearestBinarySearch(0, count3, getOffset, scrollOffset);
- let endIndex = startIndex;
- while (endIndex < count3 && measurements[endIndex].end < scrollOffset + outerSize) {
- endIndex++;
+ }
+ },
+ onFocus: () => {
+ if (props.onFocus) {
+ props.onFocus();
+ }
+ setActive(true);
+ },
+ onBlur: () => {
+ if (props.onBlur)
+ props.onBlur();
+ setActive(false);
+ },
+ "data-placeholder": props.placeholder,
+ onInput: (e5) => props.onChange(e5.currentTarget.innerText),
+ onKeyDown: (e5) => keyDown(e5),
+ className: "mk-suggester",
+ contentEditable: true
+ }), active && (0, import_react_dom9.createPortal)(
+ /* @__PURE__ */ import_react120.default.createElement("div", {
+ ref: menuRef,
+ className: `mk-menu mk-menu-suggester ${isReady ? "mk-ready" : ""}`,
+ style: {
+ position: "absolute",
+ top: pos.y,
+ left: pos.x,
+ zIndex: 1e3,
+ width: "300px",
+ "--mk-menu-max-height": "300px",
+ visibility: active ? "visible" : "hidden"
+ }
+ }, props.sections ? /* @__PURE__ */ import_react120.default.createElement("div", {
+ className: "mk-menu-sections"
+ }, props.sections.map((f2, i4) => /* @__PURE__ */ import_react120.default.createElement("div", {
+ key: i4,
+ onClick: () => setSection(f2.value),
+ className: `${section == f2.value ? "is-active" : ""} mk-menu-section`
+ }, f2.name == "" ? i18n_default.labels.all : f2.name))) : /* @__PURE__ */ import_react120.default.createElement(import_react120.default.Fragment, null), /* @__PURE__ */ import_react120.default.createElement(SelectMenuSuggestions_default, {
+ expanded: false,
+ addKeyword: "Add",
+ options: props.suggestions,
+ query: "",
+ refs: null,
+ hide: () => null,
+ selectOption: props.onSelect,
+ id: "",
+ classNames: CLASS_NAMES2,
+ index: index2,
+ setIndex,
+ allowNew: false,
+ ui: props.superstate.ui,
+ isDisclosureMenu: false
+ })),
+ document.body
+ ));
}
- return { startIndex, endIndex };
-}
+);
+Suggester.displayName = "Suggester";
-// node_modules/@tanstack/react-virtual/dist/esm/index.js
-var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? React133.useLayoutEffect : React133.useEffect;
-function useVirtualizerBase(options) {
- const rerender = React133.useReducer(() => ({}), {})[1];
- const resolvedOptions = {
- ...options,
- onChange: (instance2, sync) => {
- var _a;
- if (sync) {
- (0, import_react_dom7.flushSync)(rerender);
+// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx
+function parseContent(input) {
+ const regex1 = /!\[!\[(.*?)\]\]/;
+ const regex2 = /!!\[\[(.*?)\]\]/;
+ const match1 = input.match(regex1);
+ const match2 = input.match(regex2);
+ return match1 ? match1[1] : match2 ? match2[1] : input;
+}
+var FlowNodeView = (props) => {
+ const { spaceState } = (0, import_react121.useContext)(SpaceContext);
+ const pathState = (0, import_react121.useMemo)(() => {
+ const fullPath = props.state?.props?.value;
+ const path2 = fullPath ? props.superstate.spaceManager.resolvePath(
+ parseContent(fullPath),
+ props.source
+ ) : null;
+ const uri = props.superstate.spaceManager.uriByString(fullPath);
+ if (uri?.scheme == "https" || uri?.scheme == "http") {
+ return {
+ path: fullPath,
+ displayName: uri.path,
+ label: {
+ sticker: uri.scheme,
+ name: uri.path,
+ color: ""
+ },
+ hidden: false,
+ subtype: "md",
+ type: "remote"
+ };
+ }
+ return props.superstate.pathsIndex.get(path2);
+ }, [props.state, props.source]);
+ const { updateNode, nodes } = (0, import_react121.useContext)(FramesEditorRootContext);
+ const { selectionMode } = (0, import_react121.useContext)(FrameSelectionContext);
+ const [expanded, setExpanded] = (0, import_react121.useState)(
+ props.state?.styles?.["--mk-expanded"]
+ );
+ const updateValue2 = (newValue) => {
+ if (newValue != props.state.props?.value) {
+ if (props.treeNode.editorProps?.linkedNode) {
+ const node = nodes.find(
+ (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
+ );
+ updateNode(node, {
+ props: {
+ ...node.props,
+ [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
+ }
+ });
} else {
- rerender();
+ updateNode(props.treeNode.node, {
+ props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
+ });
}
- (_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
}
};
- const [instance] = React133.useState(
- () => new Virtualizer(resolvedOptions)
- );
- instance.setOptions(resolvedOptions);
- React133.useEffect(() => {
- return instance._didMount();
- }, []);
- useIsomorphicLayoutEffect3(() => {
- return instance._willUpdate();
- });
- return instance;
-}
-function useVirtualizer(options) {
- return useVirtualizerBase({
- observeElementRect,
- observeElementOffset,
- scrollToFn: elementScroll,
- ...options
- });
-}
-
-// src/core/react/components/Navigator/SpaceTree/SpaceTreeVirtualized.tsx
-var import_react138 = __toESM(require_react());
-var VirtualizedList = import_react138.default.memo(function VirtualizedList2(props) {
- const {
- flattenedTree,
- rowHeights,
- projected,
- vRef,
- selectedPaths,
- activePath,
- selectRange: selectRange2,
- handleCollapse,
- superstate,
- overIndex,
- activeIndex,
- indentationWidth
- } = props;
- const parentRef = import_react138.default.useRef(null);
- const rowVirtualizer = useVirtualizer({
- count: flattenedTree.length,
- paddingEnd: 24,
- getScrollElement: () => parentRef.current,
- estimateSize: import_react138.default.useCallback((index3) => rowHeights[index3], [rowHeights]),
- overscan: 0
- });
- vRef.current = rowVirtualizer;
- const { saveActiveSpace } = (0, import_react138.useContext)(NavigatorContext);
- const dropIndicator = (index3) => {
- return overIndex == index3 && projected && projected.insert;
- };
- const highlighted = (index3) => {
- if (!projected || !flattenedTree[index3] || !projected?.droppable)
- return false;
- 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((p2, c3) => p2 + c3, 0);
- return -rowHeights.slice(start, end).reduce((p2, c3) => p2 + c3, 0);
- };
- const calcYOffset = (index3) => {
- if (!projected)
- return 0;
- if (projected.insert) {
- if (projected.copy && !projected.reorder)
- return 0;
- if (index3 > activeIndex) {
- return -rowHeights[index3];
- } else if (index3 == activeIndex) {
- return heightBetweenIndex(overIndex, activeIndex);
- } else {
- return 0;
- }
- } else if (projected.sortable) {
- const targetIndex = overIndex < activeIndex ? overIndex : overIndex;
- if (projected.copy && !projected.reorder) {
- if (index3 == activeIndex) {
- return heightBetweenIndex(targetIndex, activeIndex);
- } else if (index3 >= targetIndex) {
- return rowHeights[index3];
- } else {
- return 0;
+ const hideToggle = props.state?.styles?.["--mk-link"];
+ const { id: id3 } = (0, import_react121.useContext)(FrameInstanceContext);
+ const [pathString, setPathString] = (0, import_react121.useState)("");
+ const options = (0, import_react121.useMemo)(() => {
+ const fuseOptions = {
+ keys: ["name", "value"]
+ };
+ const suggestions = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden && f2.subtype == "md" || f2.subtype == "space").map((f2) => ({
+ name: f2.displayName,
+ value: f2.path,
+ description: f2.path,
+ icon: f2.label?.sticker
+ }));
+ const fuse = new Fuse(suggestions, fuseOptions);
+ return pathString?.length == 0 ? suggestions : fuse.search(pathString).map((result) => result.item);
+ }, [pathString]);
+ const toggleCollapse = () => {
+ setExpanded((p) => !p);
+ if (selectionMode > 0 /* Read */)
+ updateNode(props.treeNode.node, {
+ styles: {
+ ...props.treeNode.node.styles,
+ "--mk-expanded": (!props.state?.styles?.["--mk-expanded"]).toString()
}
+ });
+ };
+ const [isTransition, startTransition] = (0, import_react121.useTransition)();
+ return /* @__PURE__ */ import_react121.default.createElement("div", {
+ className: "mk-node-flow"
+ }, !props.state?.styles?.["--mk-min-mode"] && /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null, pathState ? /* @__PURE__ */ import_react121.default.createElement("div", {
+ className: "mk-node-link"
+ }, /* @__PURE__ */ import_react121.default.createElement(PathCrumb, {
+ superstate: props.superstate,
+ path: pathState.path
+ }), !hideToggle && /* @__PURE__ */ import_react121.default.createElement(CollapseToggle, {
+ superstate: props.superstate,
+ collapsed: !expanded,
+ onToggle: toggleCollapse
+ })) : selectionMode > 0 /* Read */ && /* @__PURE__ */ import_react121.default.createElement("div", {
+ className: "mk-node-text-placeholder"
+ }, /* @__PURE__ */ import_react121.default.createElement(Suggester, {
+ placeholder: i18n_default.hintText.selectNote,
+ onChange: (e5) => {
+ setPathString(e5);
+ },
+ suggestions: options,
+ superstate: props.superstate,
+ onSelect: (option) => {
+ updateValue2(option.value);
+ }
+ }))), props.state && expanded && (props.state?.props?.value?.length > 0 ? /* @__PURE__ */ import_react121.default.createElement(PathView, {
+ id: id3,
+ superstate: props.superstate,
+ path: pathState?.path ?? props.state?.props?.value,
+ containerRef: props.containerRef,
+ styles: {},
+ readOnly: true
+ }) : /* @__PURE__ */ import_react121.default.createElement("div", {
+ onClick: () => newPathInSpace(
+ props.superstate,
+ spaceState,
+ "md",
+ null,
+ true
+ ).then((f2) => updateValue2(f2))
+ }, "New Note")));
+};
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameHoverMenu.tsx
+var import_react122 = __toESM(require_react());
+var FrameHoverMenu = (props) => {
+ const { spaceInfo } = (0, import_react122.useContext)(SpaceContext);
+ const { addNode, moveUp, moveDown, setLastCreatedId } = (0, import_react122.useContext)(
+ FramesEditorRootContext
+ );
+ const { select, selection: selection2 } = (0, import_react122.useContext)(FrameSelectionContext);
+ const selected = selection2.includes(props.node.id);
+ return /* @__PURE__ */ import_react122.default.createElement(import_react122.default.Fragment, null, /* @__PURE__ */ import_react122.default.createElement("div", {
+ className: `${"mk-editor-frame-hover-horizontal"}`,
+ style: {
+ pointerEvents: "auto",
+ opacity: props.visible ? "1" : "0"
+ }
+ }, props.dragRef && /* @__PURE__ */ import_react122.default.createElement("div", {
+ className: "mk-icon-small mk-editor-frame-hover-button",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//handle")
+ },
+ style: { cursor: "grab" },
+ ref: props.dragRef,
+ onClick: (e5) => {
+ e5.stopPropagation();
+ if (selection2.length == 1 && selected) {
+ select(null);
+ return;
}
- if (index3 == activeIndex) {
- return heightBetweenIndex(targetIndex, activeIndex);
- } else if (index3 > activeIndex && index3 <= targetIndex) {
- return -rowHeights[index3];
- } else if (index3 < activeIndex && index3 >= targetIndex) {
- return rowHeights[index3];
+ if (e5.shiftKey) {
+ select(props.node.id, true);
} else {
- return 0;
+ select(props.node.id);
+ }
+ },
+ ...props.listeners ?? {},
+ ...props.attributes ?? {}
+ }), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react122.default.createElement("div", {
+ onClick: (e5) => {
+ addNode(newNode.node, props.node).then(
+ (f2) => setLastCreatedId(f2.id)
+ );
+ e5.stopPropagation();
+ },
+ className: "mk-icon-small mk-editor-frame-hover-button",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//plus")
+ }
+ })));
+};
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameNodeEditorContainer.tsx
+var import_react123 = __toESM(require_react());
+var FrameNodeEditorContainer = (props) => {
+ const menuRef = (0, import_react123.useRef)(null);
+ const [pos, setPos] = (0, import_react123.useState)(0);
+ const calculateXBasedOnBounds = (targetRect, rect, containerRect) => {
+ const x2 = targetRect.x - props.containerRect.x;
+ const overflowX = x2 + rect.width - containerRect.width;
+ let newX = x2;
+ if (overflowX > 0) {
+ if (targetRect.x - props.containerRect.x - rect.width > 0)
+ newX = containerRect.width - rect.width;
+ else {
+ newX = 0;
}
}
+ return newX;
};
- return /* @__PURE__ */ import_react138.default.createElement("div", {
- ref: parentRef,
+ const [ready, setReady] = (0, import_react123.useState)(false);
+ (0, import_react123.useEffect)(() => {
+ const resizeObserver = new ResizeObserver((entries) => {
+ const rect = entries[0].target.getBoundingClientRect();
+ setReady(true);
+ setPos(
+ calculateXBasedOnBounds(props.nodeRect, rect, props.containerRect)
+ );
+ });
+ if (menuRef.current)
+ resizeObserver.observe(menuRef.current);
+ return () => {
+ resizeObserver.disconnect();
+ };
+ }, [menuRef]);
+ return /* @__PURE__ */ import_react123.default.createElement("div", {
+ className: "mk-editor-frame-node-container",
+ ref: menuRef,
style: {
- width: `100%`,
- height: `100%`,
- overflow: "auto",
- "--spaceRowHeight": spaceRowHeight(superstate, false) + "px"
+ visibility: ready ? "visible" : "hidden",
+ pointerEvents: "auto",
+ left: pos,
+ bottom: `calc(100% - ${props.nodeRect.y - props.containerRect.y - 10}px)`,
+ maxWidth: props.containerRect.width
+ },
+ onClick: (e5) => {
+ e5.preventDefault();
+ e5.stopPropagation();
+ }
+ }, props.children);
+};
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx
+var import_classnames6 = __toESM(require_classnames());
+var import_react125 = __toESM(require_react());
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDraggableHandle.tsx
+var import_react124 = __toESM(require_react());
+var FrameDraggableHandle = (props) => {
+ const [modifier, setModifier] = (0, import_react124.useState)(null);
+ const startValue = (0, import_react124.useRef)(props.value);
+ const currentValue = (0, import_react124.useRef)(props.value);
+ const [, setStartPos] = (0, import_react124.useState)([0, 0]);
+ const step = props.step ?? 1;
+ const handleMove = (0, import_react124.useCallback)(
+ (e5) => {
+ setStartPos((pos) => {
+ const { clientX: x2, clientY: y22 } = e5;
+ const [x1, y1] = pos;
+ const a4 = props.reverseX ? x1 - x2 : x2 - x1;
+ const b2 = props.reverseY ? y22 - y1 : y1 - y22;
+ const mod3 = props.mod ?? 1;
+ const stepModifer = step * mod3;
+ let delta = Math.sqrt((a4 + b2) / 2 * (a4 + b2) / 2) * stepModifer;
+ if (a4 + b2 < 0)
+ delta = -delta;
+ if (props.disableX)
+ delta = b2 * stepModifer;
+ if (props.disableY)
+ delta = a4 * stepModifer;
+ let newValue = startValue.current + delta;
+ newValue = props.min != null ? Math.max(newValue, props.min) : newValue;
+ newValue = props.max != null ? Math.min(newValue, props.max) : newValue;
+ currentValue.current = newValue;
+ props.onDragMove(newValue, {
+ ctrlKey: e5.ctrlKey,
+ metaKey: e5.metaKey,
+ altKey: e5.altKey,
+ shiftKey: e5.shiftKey
+ });
+ return pos;
+ });
+ e5.stopPropagation();
+ },
+ [modifier, props.max, props.min, step, props.onDragMove, props.mod]
+ );
+ const handleMoveEnd = (0, import_react124.useCallback)(
+ (e5) => {
+ const captureClick = (e6) => {
+ e6.stopPropagation();
+ window.removeEventListener("click", captureClick, true);
+ };
+ window.addEventListener(
+ "click",
+ captureClick,
+ true
+ );
+ document.removeEventListener("mousemove", handleMove);
+ document.removeEventListener("mouseup", handleMoveEnd);
+ props.onDragEnd(currentValue.current, {
+ ctrlKey: e5.ctrlKey,
+ metaKey: e5.metaKey,
+ altKey: e5.altKey,
+ shiftKey: e5.shiftKey
+ });
+ e5.preventDefault();
+ e5.stopPropagation();
+ },
+ [handleMove, props.onDragEnd]
+ );
+ const handleDown = (0, import_react124.useCallback)(
+ (e5) => {
+ startValue.current = props.value;
+ setStartPos([e5.clientX, e5.clientY]);
+ document.addEventListener("mousemove", handleMove);
+ document.addEventListener("mouseup", handleMoveEnd);
+ e5.stopPropagation();
+ },
+ [handleMove, handleMoveEnd, props.value]
+ );
+ const handleKeyDown = (e5) => {
+ if (e5.metaKey) {
+ setModifier("metaKey");
+ } else if (e5.ctrlKey) {
+ setModifier("ctrlKey");
+ } else if (e5.altKey) {
+ setModifier("altKey");
+ } else if (e5.shiftKey) {
+ setModifier("shiftKey");
}
- }, /* @__PURE__ */ import_react138.default.createElement("div", {
+ };
+ const handleKeyUp = () => {
+ setModifier(null);
+ };
+ (0, import_react124.useEffect)(() => {
+ document.addEventListener("keydown", handleKeyDown);
+ document.addEventListener("keyup", handleKeyUp);
+ return () => {
+ document.removeEventListener("mousemove", handleMove);
+ document.removeEventListener("mouseup", handleMoveEnd);
+ document.removeEventListener("keydown", handleKeyDown);
+ document.removeEventListener("keyup", handleKeyUp);
+ };
+ }, []);
+ return /* @__PURE__ */ import_react124.default.createElement("div", {
+ className: "mk-frame-draggable-handle",
+ onMouseDown: handleDown,
+ "data-placeholder": currentValue.current.toString(),
style: {
- height: `${rowVirtualizer.getTotalSize()}px`,
+ cursor: props.cursor,
width: "100%",
- position: "relative"
+ height: "100%",
+ pointerEvents: "auto"
}
- }, rowVirtualizer.getVirtualItems().map((virtualRow) => /* @__PURE__ */ import_react138.default.createElement("div", {
- key: virtualRow.index,
+ }, /* @__PURE__ */ import_react124.default.createElement("span", null));
+};
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx
+var FrameCorners = (props) => {
+ const match2 = props.styles.borderRadius ? props.styles.borderRadius.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null;
+ const numericValue = match2 ? parseInt(match2[1]) : 0;
+ const unit2 = match2 && match2[2] ? match2[2] : "px";
+ const [offset2, setOffset] = import_react125.default.useState(Math.max(8, numericValue));
+ (0, import_react125.useEffect)(() => {
+ setOffset(numericValue);
+ }, [numericValue]);
+ const handleProps = {
+ min: 0,
+ max: Math.min(props.clientSize.height / 2, props.clientSize.width / 2),
+ value: offset2,
+ onDragMove: (value) => {
+ setOffset(value);
+ },
+ onDragEnd: (value) => {
+ props.saveStyles({ borderRadius: `"${value}${unit2}"` });
+ }
+ };
+ const minOffset = Math.max(8, offset2);
+ return /* @__PURE__ */ import_react125.default.createElement("div", {
style: {
position: "absolute",
top: 0,
left: 0,
- width: "100%",
- height: `${rowHeights[virtualRow.index]}px`,
- transform: `translateY(${virtualRow.start}px)`
+ width: props.clientSize.width,
+ height: props.clientSize.height,
+ display: "flex",
+ zIndex: 200,
+ borderRadius: offset2,
+ border: "1px solid var(--mk-ui-border-accent)"
}
- }, flattenedTree[virtualRow.index].type == "new" ? /* @__PURE__ */ import_react138.default.createElement("div", {
- className: "mk-tree-wrapper mk-tree-section",
- onClick: (e5) => {
- const offset2 = e5.target.getBoundingClientRect();
- showSpacesMenu(
- offset2,
- props.superstate,
- (link3, isNew) => {
- if (isNew) {
- createSpace(props.superstate, link3, {}).then((f2) => {
- saveActiveSpace(link3);
- props.superstate.ui.openPath(link3, false);
- });
- return;
- }
- saveActiveSpace(link3);
- },
- true,
- true
- );
+ }, /* @__PURE__ */ import_react125.default.createElement("div", {
+ className: (0, import_classnames6.default)("mk-frame-corners")
+ }, /* @__PURE__ */ import_react125.default.createElement("div", {
+ className: "mk-frame-corner",
+ style: {
+ position: "absolute",
+ transform: `translate(${minOffset}px, ${minOffset}px)`,
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- }, /* @__PURE__ */ import_react138.default.createElement("div", {
- className: "mk-tree-item tree-item-self nav-folder-title mk-tree-new"
- }, /* @__PURE__ */ import_react138.default.createElement("div", {
- className: `mk-path-icon mk-path-icon-placeholder`,
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
+ }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ cursor: "nwse-resize",
+ reverseY: true
+ })), /* @__PURE__ */ import_react125.default.createElement("div", {
+ className: "mk-frame-corner",
+ style: {
+ position: "absolute",
+ transform: `translate(${props.clientSize.width - minOffset}px, ${minOffset}px)`,
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- }), /* @__PURE__ */ import_react138.default.createElement("div", {
- className: "mk-tree-text nav-folder-title-content"
- }, i18n_default.menu.openSpace))) : /* @__PURE__ */ import_react138.default.createElement(TreeItem, {
- key: flattenedTree[virtualRow.index].id,
- id: flattenedTree[virtualRow.index].id,
- data: flattenedTree[virtualRow.index],
- disabled: false,
- depth: flattenedTree[virtualRow.index].depth,
- childCount: flattenedTree[virtualRow.index].childrenCount,
- indentationWidth,
- dragStarted: props.dragStarted,
- dragOver: props.dragOver,
- dragEnded: props.dragEnded,
- dragActive: activeIndex != -1,
- indicator: dropIndicator(virtualRow.index),
- superstate,
- ghost: overIndex != -1 && activeIndex == virtualRow.index,
+ }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ cursor: "nesw-resize",
+ reverseX: true,
+ reverseY: true
+ })), /* @__PURE__ */ import_react125.default.createElement("div", {
+ className: "mk-frame-corner",
style: {
- opacity: projected && projected.insert && !projected.copy && virtualRow.index == activeIndex ? 0 : 1,
- transform: CSS.Translate.toString({
- x: projected && projected.sortable && virtualRow.index == activeIndex && projected ? (projected.depth - flattenedTree[virtualRow.index].depth) * indentationWidth : 0,
- y: calcYOffset(virtualRow.index),
- scaleX: 0,
- scaleY: 0
- })
- },
- onSelectRange: selectRange2,
- active: activePath == flattenedTree[virtualRow.index].item?.path,
- highlighted: highlighted(virtualRow.index),
- selected: selectedPaths.some(
- (g) => g.id == flattenedTree[virtualRow.index].id
+ position: "absolute",
+ transform: `translate(${minOffset}px, ${props.clientSize.height - minOffset}px)`,
+ zIndex: "var(--mk-layer-editor-overlay)"
+ }
+ }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ cursor: "nesw-resize"
+ })), /* @__PURE__ */ import_react125.default.createElement("div", {
+ className: "mk-frame-corner",
+ style: {
+ position: "absolute",
+ transform: `translate(${props.clientSize.width - minOffset}px, ${props.clientSize.height - minOffset}px)`,
+ zIndex: "var(--mk-layer-editor-overlay)"
+ }
+ }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ reverseX: true,
+ cursor: "nwse-resize"
+ }))));
+};
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDropZone.tsx
+var import_classnames7 = __toESM(require_classnames());
+var import_react126 = __toESM(require_react());
+var FrameDropZone = (props) => {
+ const { instance, id: id3 } = (0, import_react126.useContext)(FrameInstanceContext);
+ const { spaceInfo } = (0, import_react126.useContext)(SpaceContext);
+ const { setNodeRef } = useDroppable({
+ id: props.id + props.direction,
+ data: {
+ id: props.id + props.direction,
+ direction: props.direction,
+ type: "node",
+ parent: props.parentId,
+ root: id3,
+ frame: props.schemaID,
+ space: spaceInfo.path,
+ node: props.node
+ }
+ });
+ const offset2 = 20;
+ const left = props.direction == "left" ? -offset2 : props.direction == "right" ? props.width : 0;
+ const top = props.direction == "bottom" ? props.insertMode != 0 ? props.height : props.height / 2 : props.direction == "top" && props.insertMode != 0 ? -offset2 : 0;
+ const width = props.direction == "left" || props.direction == "right" ? offset2 : props.width;
+ const height = props.direction == "top" || props.direction == "bottom" ? props.insertMode != 0 ? offset2 : props.height / 2 : props.height;
+ const indicator = props.insertMode != 0 ? props.direction == "top" ? "bottom" : props.direction == "bottom" ? "top" : props.direction : props.direction;
+ return /* @__PURE__ */ import_react126.default.createElement("div", {
+ ref: setNodeRef,
+ className: (0, import_classnames7.default)(
+ props.active ? `mk-indicator-${indicator}` : "",
+ "mk-frame-drop-zone"
),
- collapsed: flattenedTree[virtualRow.index].collapsed,
- onCollapse: handleCollapse
- })))));
-});
+ style: {
+ left,
+ top,
+ width,
+ height
+ }
+ });
+};
+var FrameEditorDropZone = (props) => {
+ const { frameSchema } = (0, import_react126.useContext)(FramesMDBContext);
+ const { hoverNode } = (0, import_react126.useContext)(FrameInstanceContext);
+ const directions2 = [
+ ...props.mode == 1 /* DropModeRowColumn */ ? ["top", "bottom", "left", "right"] : props.mode == 2 /* DropModeRowOnly */ ? ["top", "bottom"] : props.mode == 3 /* DropModeColumnOnly */ ? ["left", "right"] : [],
+ ...props.insertMode == 1 ? ["inside"] : []
+ ];
+ return /* @__PURE__ */ import_react126.default.createElement("div", {
+ className: `mk-frame-drop-zone-container`,
+ style: {
+ width: props.width,
+ height: props.height
+ }
+ }, directions2.map((d4) => /* @__PURE__ */ import_react126.default.createElement(FrameDropZone, {
+ ...props,
+ key: d4,
+ active: hoverNode?.node == props.node && hoverNode?.direction == d4,
+ direction: d4,
+ mode: props.mode,
+ schemaID: frameSchema.id
+ })));
+};
-// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx
-var treeForSpace = (superstate, space3, path3, depth, parentId, activeId, sortable, root4, parentPath, sort2, expandedSpaces) => {
- const tree = [];
- const id3 = parentId ? parentId + "/" + space3.path : space3.path;
- const spaceCollapsed = !expandedSpaces.includes(id3) || activeId == id3;
- const spaceSort = space3.metadata?.sort?.field && space3.metadata?.sort?.field != "rank" ? space3.metadata?.sort : sort2 ?? {
- field: "rank",
- asc: true,
- group: true
- };
- const children = superstate.getSpaceItems(space3.path) ?? [];
- if (!spaceCollapsed || root4) {
- children.sort(spaceSortFn(spaceSort)).forEach((item) => {
- const _parentId = parentId ? parentId + "/" + space3.path : space3.path;
- if (item.type != "space") {
- tree.push(
- pathStateToTreeNode(
- superstate,
- item,
- space3.path,
- item.path,
- depth + 1,
- 0,
- true,
- space3.sortable,
- 0,
- _parentId
- )
- );
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameGapHandle.tsx
+var import_react127 = __toESM(require_react());
+var reduceFlexItems = (items, container, xAxis, axisGap) => {
+ const rows = {};
+ let row2 = 0;
+ let currentRowWidth = 0;
+ const axisValue = xAxis ? "width" : "height";
+ const nonAxisValue = !xAxis ? "width" : "height";
+ items.forEach((f2, i4, array) => {
+ if (i4 == 0) {
+ rows[row2] = {
+ start: i4,
+ end: i4,
+ maxValue: f2[nonAxisValue],
+ items: [{ ...f2, row: row2 }]
+ };
+ currentRowWidth = f2[axisValue];
+ } else if (array[i4][axisValue] + axisGap > container[axisValue]) {
+ row2++;
+ rows[row2] = {
+ start: i4,
+ end: i4,
+ maxValue: f2[nonAxisValue],
+ items: [{ ...f2, row: row2 }]
+ };
+ } else if (array[i4][axisValue] + axisGap + currentRowWidth > container[axisValue]) {
+ row2++;
+ rows[row2] = {
+ start: i4,
+ end: i4,
+ maxValue: f2[nonAxisValue],
+ items: [{ ...f2, row: row2 }]
+ };
+ currentRowWidth = f2[axisValue];
+ } else {
+ if (rows[row2]) {
+ rows[row2] = {
+ start: rows[row2].start,
+ end: i4,
+ maxValue: Math.max(rows[row2].maxValue, f2[nonAxisValue]),
+ items: [...rows[row2].items, { ...f2, row: row2 }]
+ };
+ currentRowWidth += f2[axisValue] + axisGap;
} else {
- if (superstate.spacesIndex.has(item.path)) {
- tree.push(
- ...treeForSpace(
- superstate,
- superstate.spacesIndex.get(item.path),
- item,
- depth + 1,
- _parentId,
- activeId,
- space3.sortable,
- false,
- space3.path,
- sort2,
- expandedSpaces
- )
- );
- }
+ console.log("Warning: Flexbox found orphan row");
}
- });
- }
- if (!root4)
- tree.splice(
- 0,
- 0,
- spaceToTreeNode(
- path3,
- spaceCollapsed,
- sortable,
- depth,
- parentId,
- parentPath,
- tree.length
- )
- );
- return tree;
-};
-var treeForRoot = (superstate, space3, active, expandedSpaces) => {
- const tree = [];
- const pathIndex = superstate.pathsIndex.get(space3.path);
- if (pathIndex)
- tree.push({
- id: space3.path,
- parentId: null,
- depth: 0,
- index: 0,
- space: space3.path,
- path: space3.path,
- item: pathIndex,
- rank: null,
- collapsed: expandedSpaces.includes(space3.path) ? false : true,
- sortable: space3.sortable,
- childrenCount: [...superstate.spacesMap.getInverse(space3.path) ?? []].length,
- type: "group"
- });
- const spaceSort = space3.metadata?.sort ?? {
- field: "rank",
- asc: true,
- group: true
- };
- if (!expandedSpaces.includes(space3.path) || active && !active.parentId) {
- return tree;
- }
- const children = superstate.getSpaceItems(space3.path) ?? [];
- children.sort(spaceSortFn(spaceSort)).forEach((item) => {
- const _parentId = space3.path;
- if (item.type != "space") {
- const id3 = _parentId + "/" + item.path;
- const itemCollapsed = !expandedSpaces.includes(id3);
- tree.push(
- pathStateToTreeNode(
- superstate,
- item,
- space3.path,
- item.path,
- 1,
- 0,
- itemCollapsed,
- space3.sortable,
- 0,
- _parentId
- )
- );
- } else {
- if (superstate.spacesIndex.has(item.path))
- tree.push(
- ...treeForSpace(
- superstate,
- superstate.spacesIndex.get(item.path),
- item,
- 1,
- _parentId,
- active?.id,
- space3.sortable,
- false,
- space3.path,
- spaceSort,
- expandedSpaces
- )
- );
}
});
- return tree;
-};
-var retrieveData = (superstate, activeViewSpaces, active, expandedSpaces) => {
- const tree = [];
- activeViewSpaces.filter((f2) => f2).forEach((activeViewSpace) => {
- tree.push(
- ...treeForRoot(superstate, activeViewSpace, active, expandedSpaces)
- );
- });
- tree.push({
- id: "placeholder",
- parentId: null,
- depth: 0,
- index: 0,
- space: null,
- type: "new",
- path: null,
- childrenCount: 0,
- collapsed: false,
- rank: 0
- });
- return tree;
+ return rows;
};
-var SpaceTreeComponent = (props) => {
- const { superstate } = props;
- const indentationWidth = isTouchScreen(props.superstate.ui) ? 20 : 16;
- const [expandedSpaces, setExpandedSpaces] = (0, import_react139.useState)(
- superstate.settings.expandedSpaces
- );
- const {
- activePath,
- activeViewSpaces,
- setActivePath,
- selectedPaths,
- setSelectedPaths,
- dragPaths,
- setDragPaths,
- modifier,
- setModifier
- } = (0, import_react139.useContext)(NavigatorContext);
- const [active, setActive] = (0, import_react139.useState)(null);
- const [overId, setOverId] = (0, import_react139.useState)(null);
- const [flattenedTree, setFlattenedTree] = (0, import_react139.useState)([]);
- const nextTreeScrollPath = (0, import_react139.useRef)(null);
- const [offset2, setOffset] = (0, import_react139.useState)({ x: 0, y: 0 });
- const listRef = (0, import_react139.useRef)(null);
- const refreshableSpaces = (0, import_react139.useMemo)(
- () => [
- ...activeViewSpaces.filter((f2) => f2).map((f2) => f2.path),
- ...flattenedTree.filter((f2) => f2.type == "space").map((f2) => f2.path)
- ].filter((f2) => f2),
- [activeViewSpaces, flattenedTree]
- );
- (0, import_react139.useEffect)(() => {
- if (selectedPaths.length <= 1) {
- if (!selectedPaths[0] || selectedPaths[0].item.path != activePath)
- setSelectedPaths([]);
- if (superstate.settings.revealActiveFile)
- revealPath(activePath);
- }
- props.superstate.ui.eventsDispatch.addListener(
- "activePathChanged",
- changeActivePath
- );
- return () => {
- props.superstate.ui.eventsDispatch.removeListener(
- "activePathChanged",
- changeActivePath
- );
- };
- }, [activePath]);
- (0, import_react139.useEffect)(() => {
- window.addEventListener("dragend", resetState);
- return () => {
- window.removeEventListener("dragend", resetState);
- };
+var FrameGapHandle = (props) => {
+ const calculateOffset = (value) => {
+ const match2 = value ? value.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null;
+ const numericValue = match2 ? parseInt(match2[1]) : 0;
+ return numericValue;
+ };
+ const [offset2, setOffset] = import_react127.default.useState({
+ row: calculateOffset(props.styles["rowGap"]),
+ column: calculateOffset(props.styles["columnGap"])
});
- (0, import_react139.useEffect)(() => {
- const settingsChanged = () => {
- setExpandedSpaces(superstate.settings.expandedSpaces);
- };
- superstate.eventsDispatcher.addListener("settingsChanged", settingsChanged);
- return () => {
- superstate.eventsDispatcher.removeListener(
- "settingsChanged",
- settingsChanged
- );
- };
- }, [activeViewSpaces, active, setExpandedSpaces, setFlattenedTree]);
- const revealPath = (0, import_react139.useCallback)(
- (path3) => {
- if (!path3 || !activeViewSpaces?.some((f2) => f2.path == "/"))
- return;
- const folders = path3.split("/");
- const openPaths = folders.reduce(
- (p2, c3, index3) => [
- ...p2,
- index3 == 0 ? "//" + c3 : p2[index3] + "/" + folders.slice(0, index3 + 1).join("/")
- ],
- ["/"]
- ).slice(0, -1);
- const newOpenFolders = [
- ...expandedSpaces.filter((f2) => !openPaths.find((g) => g == f2)) ?? [],
- ...openPaths
- ];
- superstate.settings.expandedSpaces = newOpenFolders;
- nextTreeScrollPath.current = "/" + path3;
- superstate.saveSettings();
+ (0, import_react127.useEffect)(() => {
+ setOffset({
+ row: calculateOffset(props.styles["rowGap"]),
+ column: calculateOffset(props.styles["columnGap"])
+ });
+ }, [props.styles]);
+ const handleProps = {
+ value: offset2[props.direction],
+ onDragMove: (value) => {
+ setOffset({
+ ...offset2,
+ [props.direction == "column" ? "row" : "column"]: value
+ });
},
- [expandedSpaces, activeViewSpaces]
- );
- (0, import_react139.useEffect)(() => {
- const handleRevealPathEvent = (evt) => {
- if (evt.detail)
- revealPath(evt.detail.path);
- };
- window.addEventListener(eventTypes.revealPath, handleRevealPathEvent);
- return () => {
- window.removeEventListener(eventTypes.revealPath, handleRevealPathEvent);
- };
- }, [revealPath]);
- (0, import_react139.useEffect)(() => {
- const reloadData = () => {
- setFlattenedTree(
- retrieveData(superstate, activeViewSpaces, active, expandedSpaces)
- );
- };
- const spaceUpdated = (payload) => {
- if (refreshableSpaces.some((f2) => f2 == payload.path)) {
- reloadData();
- }
- };
- props.superstate.eventsDispatcher.addListener(
- "spaceStateUpdated",
- spaceUpdated
- );
- return () => {
- props.superstate.eventsDispatcher.removeListener(
- "spaceStateUpdated",
- spaceUpdated
+ onDragEnd: (value) => {
+ props.saveStyles(
+ props.direction == "column" ? {
+ rowGap: `"${value}px"`
+ } : {
+ columnGap: `"${value}px"`
+ }
);
- };
- }, [
- expandedSpaces,
- activeViewSpaces,
- active,
- expandedSpaces,
- refreshableSpaces,
- setFlattenedTree
- ]);
- (0, import_react139.useEffect)(() => {
- setFlattenedTree(
- retrieveData(superstate, activeViewSpaces, active, expandedSpaces)
- );
- }, [expandedSpaces, activeViewSpaces, active]);
- const changeActivePath = (path3) => {
- setActivePath(path3);
+ }
};
- const overIndex = (0, import_react139.useMemo)(
- () => flattenedTree.findIndex((f2) => f2.id == overId),
- [overId, flattenedTree]
- );
- const activeIndex = (0, import_react139.useMemo)(
- () => active?.id ? flattenedTree.findIndex((f2) => f2.id == active.id) : -1,
- [active, flattenedTree]
- );
- const sortedIds = (0, import_react139.useMemo)(
- () => flattenedTree.map(({ id: id3 }) => id3),
- [flattenedTree]
- );
- const selectRange2 = (0, import_react139.useCallback)(
- (fromId) => {
- const startIndex = sortedIds.findIndex((f2) => f2 == fromId);
- const selectedPathsStartIndex = sortedIds.findIndex(
- (f2) => f2 == selectedPaths[0]?.id
- );
- const selectedPathsEndIndex = sortedIds.findIndex(
- (f2) => f2 == selectedPaths[selectedPaths.length - 1]?.id
- );
- if (startIndex < selectedPathsStartIndex) {
- setSelectedPaths(
- flattenedTree.slice(startIndex, selectedPathsEndIndex + 1).filter((f2) => f2.item)
- );
- } else {
- setSelectedPaths(
- flattenedTree.slice(selectedPathsStartIndex, startIndex + 1).filter((f2) => f2.item)
- );
- }
+ const offAxisHandleProps = {
+ value: offset2[props.direction == "column" ? "row" : "column"],
+ onDragMove: (value) => {
+ setOffset({
+ ...offset2,
+ [props.direction]: value
+ });
},
- [sortedIds, selectedPaths, setSelectedPaths, flattenedTree]
- );
- const [projected, setProjected] = (0, import_react139.useState)(null);
- (0, import_react139.useEffect)(() => {
- const dragDepth = getDragDepth(offset2.x, indentationWidth);
- const _projected = overId ? getProjection(
- active,
- flattenedTree,
- dragPaths,
- overIndex,
- dragDepth,
- offset2.y,
- activeIndex < overIndex,
- modifier,
- active?.space
- ) : null;
- setProjected((p2) => !(0, import_lodash17.isEqual)(p2, _projected) ? _projected : p2);
- }, [
- active,
- flattenedTree,
- overId,
- overIndex,
- dragPaths,
- offset2,
- activeIndex,
- modifier,
- indentationWidth,
- activeViewSpaces
- ]);
- const dragStarted = (activeId) => {
- const activeItem = flattenedTree.find(({ id: id3 }) => id3 === activeId);
- setActive(activeItem);
- setOverId(activeId);
- if (activeItem) {
- if (selectedPaths.length > 1) {
- setDragPaths(selectedPaths.map((f2) => f2.path));
- } else {
- setDragPaths([activeItem.path]);
- }
+ onDragEnd: (value) => {
+ props.saveStyles(
+ props.direction == "column" ? {
+ columnGap: `"${value}px"`
+ } : {
+ rowGap: `"${value}px"`
+ }
+ );
}
- document.body.style.setProperty("cursor", "grabbing");
};
- const parentName = (0, import_react139.useMemo)(
- () => projected ? flattenedTree.find((f2) => f2.id == projected.parentId)?.item?.name : null,
- [flattenedTree, projected]
- );
- const overName = (0, import_react139.useMemo)(
- () => projected && flattenedTree.find((f2) => f2.id == projected.overId)?.item?.name,
- [flattenedTree, projected]
+ const rows = (0, import_react127.useMemo)(
+ () => reduceFlexItems(
+ props.childSizes,
+ {
+ width: props.clientSize.width - props.clientSize.paddingLeft - props.clientSize.paddingRight,
+ height: props.clientSize.height - props.clientSize.paddingTop - props.clientSize.paddingBottom
+ },
+ props.direction == "row",
+ offset2[props.direction == "column" ? "row" : "column"]
+ ),
+ [props.childSizes, props.clientSize, props.direction, offset2]
);
- const dragOver = (e5, _overId, position3) => {
- const modifier2 = eventToModifier(e5);
- setModifier(modifier2);
- e5.dataTransfer.dropEffect = modifier2;
- if (projected) {
- superstate.ui.setDragLabel(
- `${projected.reorder && !projected.insert ? i18n_default.labels.reorderIn : modifier2 == "move" || !modifier2 ? i18n_default.labels.moveTo : modifier2 == "link" ? i18n_default.labels.addTo : i18n_default.labels.copyTo} ${projected.insert ? overName : parentName ?? "Spaces"}`
- );
+ const items = (0, import_react127.useMemo)(() => {
+ const items2 = [];
+ Object.keys(rows).forEach((f2) => {
+ items2.push(...rows[f2].items);
+ });
+ return items2;
+ }, [rows]);
+ return /* @__PURE__ */ import_react127.default.createElement("div", {
+ className: `mk-frame-gaps ${parseStylesToClass(props.styles)}`,
+ style: {
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: props.clientSize.width,
+ height: props.clientSize.height,
+ padding: props.clientSize.paddingTop,
+ paddingLeft: props.clientSize.paddingLeft,
+ paddingBottom: props.clientSize.paddingBottom,
+ paddingRight: props.clientSize.paddingRight,
+ flexWrap: props.styles.flexWrap
}
- if (dragPaths.length > 1) {
- if (_overId && _overId != overId)
- setOverId(_overId);
- return;
+ }, props.direction === "row" ? items.map((f2, i4, array) => /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null, /* @__PURE__ */ import_react127.default.createElement("div", {
+ style: { width: f2.width, height: f2.height }
+ }), i4 == array.length - 1 ? /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react127.default.createElement("div", {
+ key: i4,
+ className: "mk-frame-gap-handle-h",
+ style: {
+ width: "100%",
+ height: Math.max(8, Math.abs(offset2["row"])),
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- if (_overId && _overId != overId)
- setOverId(_overId);
- const x2 = offset2.x;
- const y3 = offset2.y;
- const newX = 2 * Math.round(Math.max(1, position3.x - indentationWidth - 20));
- const newY = 2 * Math.round(position3.y / 2);
- if (x2 != newX || y3 != newY) {
- setOffset({
- x: newX,
- y: newY
- });
+ }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, {
+ ...offAxisHandleProps,
+ cursor: "col-resize",
+ disableX: true,
+ reverseY: true
+ })) : /* @__PURE__ */ import_react127.default.createElement("div", {
+ key: i4,
+ className: "mk-frame-gap-handle-v",
+ style: {
+ width: Math.max(8, Math.abs(offset2["column"])),
+ height: rows[f2.row].maxValue,
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- };
- (0, import_react139.useEffect)(() => {
- if (dragPaths.length == 0) {
- setOverId(null);
- setActive(null);
- setOffset({ x: 0, y: 0 });
- setModifier(null);
- setProjected(null);
- dragCounter.current = 0;
- document.body.style.setProperty("cursor", "");
+ }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ cursor: "col-resize",
+ disableY: true
+ })))) : items.map((f2, i4, array) => /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null, /* @__PURE__ */ import_react127.default.createElement("div", {
+ style: { width: f2.width, height: f2.height }
+ }), i4 == array.length - 1 ? /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react127.default.createElement("div", {
+ key: i4,
+ className: "mk-frame-gap-handle-v",
+ style: {
+ height: "100%",
+ width: Math.max(8, Math.abs(offset2["column"])),
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- }, [dragPaths]);
- const dragEnded = (e5, overId2) => {
- const modifiers = eventToModifier(e5);
- dropPathsInTree(
- superstate,
- dragPaths,
- active?.id,
- overId2,
- projected,
- flattenedTree,
- activeViewSpaces,
- modifiers
+ }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, {
+ ...offAxisHandleProps,
+ cursor: "col-resize",
+ disableX: true,
+ reverseY: true
+ })) : /* @__PURE__ */ import_react127.default.createElement("div", {
+ key: i4,
+ className: "mk-frame-gap-handle-h",
+ style: {
+ height: Math.max(8, Math.abs(offset2["row"])),
+ width: rows[f2.row].maxValue,
+ zIndex: "var(--mk-layer-editor-overlay)"
+ }
+ }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ cursor: "row-resize",
+ disableX: true,
+ reverseY: true
+ })))));
+};
+
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FramePaddingHandle.tsx
+var import_classnames8 = __toESM(require_classnames());
+var import_react128 = __toESM(require_react());
+var FramePadding = (props) => {
+ const paddingTypes = [
+ "padding",
+ "paddingTop",
+ "paddingBottom",
+ "paddingLeft",
+ "paddingRight"
+ ];
+ const [offset2, setOffset] = import_react128.default.useState({
+ padding: 0,
+ paddingTop: null,
+ paddingBottom: null,
+ paddingLeft: null,
+ paddingRight: null
+ });
+ const unit2 = "px";
+ (0, import_react128.useEffect)(() => {
+ const getNumericValue = (type) => {
+ if (!props.styles[type])
+ return null;
+ const match2 = props.styles[type] ? props.styles[type].match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null;
+ const numericValue = Math.max(match2 ? parseInt(match2[1]) : 0, 8);
+ return numericValue;
+ };
+ setOffset((p) => {
+ return paddingTypes.reduce((a4, c3) => {
+ return {
+ ...a4,
+ [c3]: getNumericValue(c3)
+ };
+ }, p);
+ });
+ }, [props.styles]);
+ const [shiftModifier, setShiftModifier] = import_react128.default.useState(false);
+ const handleProps = {
+ min: 0,
+ mod: 2
+ };
+ const inset = (type) => Math.max(5, offset2[type] ?? offset2.padding);
+ const setNewOffset = (type, value, modifiers) => {
+ setOffset(
+ (p) => modifiers.shiftKey ? {
+ padding: value,
+ paddingBottom: null,
+ paddingTop: null,
+ paddingLeft: null,
+ paddingRight: null
+ } : { ...p, [type]: value }
);
- resetState();
- };
- const handleCollapse = (0, import_react139.useCallback)(
- (folder, open) => {
- const folderOpen = expandedSpaces?.includes(folder.id);
- const newOpenFolders = !folderOpen || open ? [...expandedSpaces, folder.id] : expandedSpaces.filter(
- (openFolder) => folder.id !== openFolder
- );
- superstate.settings.expandedSpaces = newOpenFolders;
- superstate.saveSettings();
- },
- [superstate, expandedSpaces]
- );
- function resetState() {
- setDragPaths([]);
- setOverId(null);
- setActive(null);
- setOffset({ x: 0, y: 0 });
- setModifier(null);
- setProjected(null);
- dragCounter.current = 0;
- document.body.style.setProperty("cursor", "");
- }
- const dragCounter = (0, import_react139.useRef)(0);
- const dragEnter = () => {
- dragCounter.current++;
};
- const dragLeave = () => {
- dragCounter.current--;
- if (dragCounter.current == 0) {
- setOverId(null);
- setOffset({ x: 0, y: 0 });
- setProjected(null);
- dragCounter.current = 0;
- }
+ const saveValue = (type, value, modifiers) => {
+ props.saveStyles(
+ modifiers.shiftKey ? {
+ padding: `'${value}${unit2}'`,
+ paddingBottom: "",
+ paddingTop: "",
+ paddingLeft: "",
+ paddingRight: ""
+ } : { [type]: `'${value}${unit2}'` }
+ );
};
- const rowHeights = (0, import_react139.useMemo)(
- () => flattenedTree.map((f2) => spaceRowHeight(superstate, f2.type == "group")),
- [flattenedTree]
- );
- return /* @__PURE__ */ import_react139.default.createElement("div", {
- className: `mk-path-tree`,
- onDragEnter: () => dragEnter(),
- onDragLeave: () => dragLeave(),
- onDragOver: (e5) => e5.preventDefault(),
- onDrop: (e5) => {
- if (overId) {
- dragEnded(e5, overId);
- } else {
- resetState();
+ (0, import_react128.useEffect)(() => {
+ const handleKeyDown = (e5) => {
+ if (e5.key === "Shift") {
+ setShiftModifier(true);
}
- }
- }, /* @__PURE__ */ import_react139.default.createElement(VirtualizedList, {
- vRef: listRef,
- rowHeights,
- flattenedTree,
- projected,
- handleCollapse,
- activePath,
- superstate,
- selectedPaths,
- selectRange: selectRange2,
- indentationWidth,
- dragStarted,
- dragOver,
- dragEnded,
- overIndex,
- activeIndex
- }), modifier && !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react139.default.createElement("div", {
- className: "mk-hint-dnd",
+ };
+ const handleKeyUp = (e5) => {
+ if (e5.key === "Shift") {
+ setShiftModifier(false);
+ }
+ };
+ window.addEventListener("keydown", handleKeyDown);
+ window.addEventListener("keyup", handleKeyUp);
+ return () => {
+ window.removeEventListener("keydown", handleKeyDown);
+ window.removeEventListener("keyup", handleKeyUp);
+ };
+ }, []);
+ return /* @__PURE__ */ import_react128.default.createElement("div", {
style: {
position: "absolute",
- bottom: "10px",
- left: "10px",
- background: "var(--mk-ui-active)",
- boxShadow: "var(--background-modifier-box-shadow)",
- padding: "4px 8px",
- borderRadius: "4px",
- color: "var(--text-on-accent)",
- fontSize: "12px"
+ top: 0,
+ left: 0,
+ width: props.clientSize.width,
+ height: props.clientSize.height,
+ display: "flex",
+ zIndex: 200,
+ border: "1px solid var(--mk-ui-color-border-accent)"
}
- }, /* @__PURE__ */ import_react139.default.createElement("div", null, i18n_default.hintText.dragDropModifierKeys.replace("${1}", "shift").replace("${2}", normalizedAltName()))));
-};
-
-// src/core/react/components/Navigator/MainList.tsx
-var import_react143 = __toESM(require_react());
-
-// src/core/react/components/Navigator/MainMenu.tsx
-var import_classnames5 = __toESM(require_classnames());
-var import_react140 = __toESM(require_react());
-var MainMenu = (props) => {
- const { superstate } = props;
- const { setActivePath, setDragPaths } = (0, import_react140.useContext)(NavigatorContext);
- const ref2 = (0, import_react140.useRef)();
- return /* @__PURE__ */ import_react140.default.createElement("div", {
- className: "mk-main-menu-container"
- }, /* @__PURE__ */ import_react140.default.createElement("div", {
- className: "mk-main-menu-inner"
- }, /* @__PURE__ */ import_react140.default.createElement("div", {
- className: (0, import_classnames5.default)("mk-main-menu")
- }, /* @__PURE__ */ import_react140.default.createElement("div", {
- className: `mk-main-menu-button mk-main-menu-button-primary`,
- ref: ref2,
- onClick: (e5) => {
- props.superstate.ui.mainMenu(ref2.current, superstate);
+ }, /* @__PURE__ */ import_react128.default.createElement("div", {
+ className: (0, import_classnames8.default)(
+ "mk-frame-paddings",
+ shiftModifier && "mk-modifier-shift"
+ )
+ }, /* @__PURE__ */ import_react128.default.createElement("div", {
+ className: "mk-frame-padding-handle-h",
+ style: {
+ position: "absolute",
+ transform: `translate(${0}px, ${0}px)`,
+ height: inset("paddingTop"),
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- }, props.superstate.settings.systemName, /* @__PURE__ */ import_react140.default.createElement("div", {
- className: "mk-icon-xsmall",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//chevrons-up-down")
+ }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ value: offset2["paddingTop"] ?? offset2.padding,
+ cursor: "s-resize",
+ max: props.clientSize.height,
+ onDragMove: (value, modifiers) => {
+ setNewOffset("paddingTop", value, modifiers);
+ },
+ onDragEnd: (value, modifiers) => {
+ saveValue("paddingTop", value, modifiers);
+ },
+ reverseY: true,
+ disableX: true
+ })), /* @__PURE__ */ import_react128.default.createElement("div", {
+ className: "mk-frame-padding-handle-v",
+ style: {
+ position: "absolute",
+ transform: `translate(${props.clientSize.width - inset("paddingRight")}px, ${0}px)`,
+ width: inset("paddingRight"),
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- })), /* @__PURE__ */ import_react140.default.createElement("div", {
- className: "mk-main-menu-button",
- onClick: (e5) => props.superstate.ui.quickOpen(superstate)
- }, /* @__PURE__ */ import_react140.default.createElement("div", {
- className: "mk-icon-small",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//search")
+ }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ value: offset2["paddingRight"] ?? offset2.padding,
+ cursor: "w-resize",
+ onDragMove: (value, modifiers) => {
+ setNewOffset("paddingRight", value, modifiers);
+ },
+ max: props.clientSize.width,
+ onDragEnd: (value, modifiers) => {
+ saveValue("paddingRight", value, modifiers);
+ },
+ reverseX: true,
+ reverseY: true,
+ disableY: true
+ })), /* @__PURE__ */ import_react128.default.createElement("div", {
+ className: "mk-frame-padding-handle-v",
+ style: {
+ position: "absolute",
+ transform: `translate(${0}px, ${0}px)`,
+ width: inset("paddingLeft"),
+ zIndex: "var(--mk-layer-editor-overlay)"
}
- }))), /* @__PURE__ */ import_react140.default.createElement("button", {
- "aria-label": i18n_default.buttons.newNote,
- className: "mk-main-menu-button",
- onClick: (e5) => defaultAddAction(superstate, null, e5.metaKey ? "tab" : false)
- }, /* @__PURE__ */ import_react140.default.createElement("div", {
- className: "mk-icon-small",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//new-note")
+ }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ value: offset2["paddingLeft"] ?? offset2.padding,
+ cursor: "e-resize",
+ max: props.clientSize.width,
+ onDragMove: (value, modifiers) => {
+ setNewOffset("paddingLeft", value, modifiers);
+ },
+ onDragEnd: (value, modifiers) => {
+ saveValue("paddingLeft", value, modifiers);
+ },
+ disableY: true
+ })), /* @__PURE__ */ import_react128.default.createElement("div", {
+ className: "mk-frame-padding-handle-h",
+ style: {
+ position: "absolute",
+ transform: `translate(${0}px, ${props.clientSize.height - inset("paddingBottom")}px)`,
+ height: inset("paddingBottom"),
+ zIndex: "var(--mk-layer-editor-overlay)"
}
+ }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, {
+ ...handleProps,
+ value: offset2["paddingBottom"] ?? offset2.padding,
+ cursor: "n-resize",
+ max: props.clientSize.height,
+ onDragMove: (value, modifiers) => {
+ setNewOffset("paddingBottom", value, modifiers);
+ },
+ onDragEnd: (value, modifiers) => {
+ saveValue("paddingBottom", value, modifiers);
+ },
+ reverseX: true,
+ disableX: true
}))));
};
-// src/core/react/components/Navigator/Waypoints/Waypoints.tsx
-var import_react142 = __toESM(require_react());
-var import_react_dom8 = __toESM(require_react_dom());
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx
+var import_classnames9 = __toESM(require_classnames());
-// src/core/react/components/Navigator/Waypoints/Waypoint.tsx
-var import_classnames6 = __toESM(require_classnames());
-var import_react141 = __toESM(require_react());
-var SortablePinnedSpaceItem = ({
- id: id3,
- index: index3,
- ...props
-}) => {
- return /* @__PURE__ */ import_react141.default.createElement(PinnedSpace, {
- index: index3,
- ...props
- });
-};
-var PinnedSpace = (0, import_react141.forwardRef)(
- ({
- pin,
- indicator,
- highlighted,
- superstate,
- style,
- clone: clone5,
- ghost,
- dragStart,
- dragOver,
- dragEnded,
- index: index3
- }, ref2) => {
- const innerRef = (0, import_react141.useRef)(null);
- const {
- activePath,
- waypoints,
- setWaypoints,
- setModifier
- } = (0, import_react141.useContext)(NavigatorContext);
- const onDragStarted = (e5) => {
- if (dragStart && pin) {
- dragStart(index3);
- }
- };
- const onDragEnded = (e5) => {
- if (dragEnded) {
- dragEnded();
- }
- };
- const innerProps = {
- draggable: true,
- onDragStart: onDragStarted,
- onDragEnd: onDragEnded,
- onDrop: onDragEnded
- };
- return pin ? /* @__PURE__ */ import_react141.default.createElement("div", {
- onContextMenu: (e5) => {
- const menuOptions = [
- {
- name: "Change Sticker",
- icon: "ui//edit",
- value: "change-sticker",
- onClick: () => {
- superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react141.default.createElement(StickerModal_default, {
- ui: superstate.ui,
- hide: _props.hide,
- selectedSticker: (emoji) => {
- setWaypoints(
- waypoints.map(
- (f2, i4) => i4 == index3 ? { ...f2, sticker: emoji } : f2
- )
- );
- }
- }));
- }
- },
- {
- name: "Close",
- icon: "ui//close",
- value: "close",
- onClick: () => {
- setWaypoints(waypoints.filter((f2, i4) => i4 != index3));
- superstate.saveSettings();
- }
- }
- ];
- superstate.ui.openMenu(
- e5.target.getBoundingClientRect(),
- defaultMenu(superstate.ui, menuOptions)
- );
- },
- ref: innerRef,
- className: "mk-waypoint",
- onClick: (e5) => {
- superstate.settings.currentWaypoint = index3;
- superstate.saveSettings();
- },
- onDragOver: (e5) => {
- e5.preventDefault();
- setModifier(eventToModifier(e5));
- if (!innerRef.current)
- return;
- const rect = innerRef.current.getBoundingClientRect();
- const x2 = e5.clientX - rect.left;
- if (dragOver && pin)
- dragOver(index3, x2);
- },
- ...innerProps
- }, /* @__PURE__ */ import_react141.default.createElement("div", {
- ref: ref2,
- className: (0, import_classnames6.default)(
- "mk-waypoints-item",
- "clickable-icon",
- "nav-action-button",
- (superstate.settings.currentWaypoint == index3 || highlighted) && "mk-active",
- indicator && "mk-indicator",
- clone5 && "mk-clone",
- ghost && "mk-ghost"
- ),
- style: {
- ...style
- },
- dangerouslySetInnerHTML: {
- __html: superstate.ui.getSticker(pin.sticker)
- }
- })) : /* @__PURE__ */ import_react141.default.createElement("div", {
- ref: innerRef,
- className: "mk-waypoint"
- }, /* @__PURE__ */ import_react141.default.createElement("div", {
- ref: ref2,
- onClick: (e5) => {
- setWaypoints([
- ...waypoints,
- { sticker: "ui//spaces", name: "Waypoint", paths: [] }
- ]);
- superstate.saveSettings();
- },
- className: (0, import_classnames6.default)(
- "mk-waypoints-item",
- "clickable-icon",
- "nav-action-button",
- highlighted && "mk-active",
- indicator && "mk-indicator",
- clone5 && "mk-clone",
- ghost && "mk-ghost"
- )
- }));
- }
-);
-PinnedSpace.displayName = "PinnedSpace";
+// node_modules/re-resizable/lib/index.js
+var React127 = __toESM(require_react());
+var import_react_dom10 = __toESM(require_react_dom());
-// src/core/react/components/Navigator/Waypoints/Waypoints.tsx
-var SpaceSwitcher = (props) => {
- const {
- waypoints,
- modifier,
- setModifier,
- setWaypoints
- } = (0, import_react142.useContext)(NavigatorContext);
- const { superstate } = props;
- const { dragPaths, setDragPaths } = (0, import_react142.useContext)(NavigatorContext);
- const [activeId, setActiveId] = (0, import_react142.useState)(null);
- const [overId, setOverId] = (0, import_react142.useState)(null);
- const dragCounter = (0, import_react142.useRef)(0);
- const [offset2, setOffset] = (0, import_react142.useState)(0);
- const [projected, setProjected] = (0, import_react142.useState)(null);
- const [dropPlaceholder, setDragPlaceholder] = (0, import_react142.useState)(null);
- (0, import_react142.useEffect)(() => {
- if (overId === null || dragPaths.length == 0) {
- setProjected(null);
- return;
- }
- const waypoint = waypoints.find((f2, i4) => i4 == overId);
- if (!waypoint)
- return;
- const _projected = {
- depth: 0,
- overId,
- parentId: null,
- sortable: false,
- insert: true,
- droppable: true,
- copy: false,
- reorder: false
+// node_modules/re-resizable/lib/resizer.js
+var React126 = __toESM(require_react());
+var __extends = function() {
+ var extendStatics = function(d4, b2) {
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) {
+ d5.__proto__ = b3;
+ } || function(d5, b3) {
+ for (var p in b3)
+ if (Object.prototype.hasOwnProperty.call(b3, p))
+ d5[p] = b3[p];
};
- setProjected(_projected);
- return;
- }, [overId, dragPaths, offset2, modifier, waypoints, activeId]);
- const resetState = () => {
- setModifier(null);
- setOverId(null);
- setDragPaths([]);
- setActiveId(null);
- setProjected(null);
- setOffset(0);
- dragCounter.current = 0;
- };
- const handleDragCancel = () => {
- resetState();
+ return extendStatics(d4, b2);
};
- const dragEnter = () => {
- dragCounter.current++;
+ return function(d4, b2) {
+ extendStatics(d4, b2);
+ function __() {
+ this.constructor = d4;
+ }
+ d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
};
- const dragLeave = () => {
- dragCounter.current--;
- if (dragCounter.current == 0) {
- setOverId(null);
- setProjected(null);
- setOffset(0);
- dragCounter.current = 0;
+}();
+var __assign2 = function() {
+ __assign2 = Object.assign || function(t5) {
+ for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
+ s4 = arguments[i4];
+ for (var p in s4)
+ if (Object.prototype.hasOwnProperty.call(s4, p))
+ t5[p] = s4[p];
}
+ return t5;
};
- const adjustTranslate = ({ transform }) => {
- return {
- ...transform,
- x: transform.x,
- y: transform.y - 10
+ return __assign2.apply(this, arguments);
+};
+var rowSizeBase = {
+ width: "100%",
+ height: "10px",
+ top: "0px",
+ left: "0px",
+ cursor: "row-resize"
+};
+var colSizeBase = {
+ width: "10px",
+ height: "100%",
+ top: "0px",
+ left: "0px",
+ cursor: "col-resize"
+};
+var edgeBase = {
+ width: "20px",
+ height: "20px",
+ position: "absolute"
+};
+var styles = {
+ top: __assign2(__assign2({}, rowSizeBase), { top: "-5px" }),
+ right: __assign2(__assign2({}, colSizeBase), { left: void 0, right: "-5px" }),
+ bottom: __assign2(__assign2({}, rowSizeBase), { top: void 0, bottom: "-5px" }),
+ left: __assign2(__assign2({}, colSizeBase), { left: "-5px" }),
+ topRight: __assign2(__assign2({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
+ bottomRight: __assign2(__assign2({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
+ bottomLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
+ topLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" })
+};
+var Resizer = function(_super) {
+ __extends(Resizer2, _super);
+ function Resizer2() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.onMouseDown = function(e5) {
+ _this.props.onResizeStart(e5, _this.props.direction);
+ };
+ _this.onTouchStart = function(e5) {
+ _this.props.onResizeStart(e5, _this.props.direction);
};
+ return _this;
+ }
+ Resizer2.prototype.render = function() {
+ return React126.createElement("div", { className: this.props.className || "", style: __assign2(__assign2({ position: "absolute", userSelect: "none" }, styles[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children);
};
- const dragStarted = (id3) => {
- setActiveId(id3);
+ return Resizer2;
+}(React126.PureComponent);
+
+// node_modules/re-resizable/lib/index.js
+var __extends2 = function() {
+ var extendStatics = function(d4, b2) {
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) {
+ d5.__proto__ = b3;
+ } || function(d5, b3) {
+ for (var p in b3)
+ if (Object.prototype.hasOwnProperty.call(b3, p))
+ d5[p] = b3[p];
+ };
+ return extendStatics(d4, b2);
};
- const dragOver = (id3, x2) => {
- setOffset(x2);
- if (activeId == null) {
- setOverId(id3);
- } else {
- if (id3 == activeId)
- return;
- setWaypoints(arrayMove(waypoints, activeId, id3));
- setActiveId(id3);
+ return function(d4, b2) {
+ extendStatics(d4, b2);
+ function __() {
+ this.constructor = d4;
}
+ d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
};
- const dragEnded = () => {
- if (projected && projected.insert) {
- const space3 = props.superstate.spacesIndex.get(overId);
- if (space3)
- dropPathsInSpaceAtIndex(
- props.superstate,
- dragPaths,
- space3.path,
- 0,
- "link"
- );
- } else if (dragPaths.length == 1) {
- const toIndex = overId;
- if (activeId !== null) {
- const fromIndex = activeId;
- setWaypoints(arrayMove(waypoints, fromIndex, toIndex));
- } else {
- setWaypoints(
- waypoints.map(
- (f2, i4) => i4 == toIndex ? { ...f2, paths: [...f2.paths, dragPaths[0]] } : f2
- )
- );
- }
+}();
+var __assign3 = function() {
+ __assign3 = Object.assign || function(t5) {
+ for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
+ s4 = arguments[i4];
+ for (var p in s4)
+ if (Object.prototype.hasOwnProperty.call(s4, p))
+ t5[p] = s4[p];
}
- resetState();
+ return t5;
};
- function handleDragStart(event) {
- const {
- active: { id: activeId2 }
- } = event;
- if (event.active.data.current.type != "path")
- return;
- dragStarted(activeId2);
+ return __assign3.apply(this, arguments);
+};
+var DEFAULT_SIZE = {
+ width: "auto",
+ height: "auto"
+};
+var clamp2 = function(n3, min5, max5) {
+ return Math.max(Math.min(n3, max5), min5);
+};
+var snap = function(n3, size2) {
+ return Math.round(n3 / size2) * size2;
+};
+var hasDirection = function(dir, target) {
+ return new RegExp(dir, "i").test(target);
+};
+var isTouchEvent2 = function(event) {
+ return Boolean(event.touches && event.touches.length);
+};
+var isMouseEvent = function(event) {
+ return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0));
+};
+var findClosestSnap = function(n3, snapArray, snapGap) {
+ if (snapGap === void 0) {
+ snapGap = 0;
}
- function handleDragMove({ delta }) {
+ var closestGapIndex = snapArray.reduce(function(prev, curr, index2) {
+ return Math.abs(curr - n3) < Math.abs(snapArray[prev] - n3) ? index2 : prev;
+ }, 0);
+ var gap = Math.abs(snapArray[closestGapIndex] - n3);
+ return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n3;
+};
+var getStringSize = function(n3) {
+ n3 = n3.toString();
+ if (n3 === "auto") {
+ return n3;
}
- function handleDragOver({ over }) {
- const overId2 = over?.id;
- if (overId2 !== null) {
- if (activeId == null) {
- setOverId(overId2);
- } else {
- setWaypoints(
- arrayMove(waypoints, overId2, parseInt(activeId))
- );
- }
- }
+ if (n3.endsWith("px")) {
+ return n3;
}
- function handleDragEnd({ active, over }) {
- dragEnded();
+ if (n3.endsWith("%")) {
+ return n3;
}
- (0, import_react142.useEffect)(() => {
- window.addEventListener("dragend", resetState);
- return () => {
- window.removeEventListener("dragend", resetState);
- };
- });
- const width = isTouchScreen(props.superstate.ui) ? 48 : 32;
- const calcXOffset = (index3) => {
- if (!projected || projected.insert)
- return 0;
- const fromIndex = activeId;
- const targetIndex = overId;
- if (activeId === null) {
- if (index3 >= targetIndex)
- return width;
- return 0;
+ if (n3.endsWith("vh")) {
+ return n3;
+ }
+ if (n3.endsWith("vw")) {
+ return n3;
+ }
+ if (n3.endsWith("vmax")) {
+ return n3;
+ }
+ if (n3.endsWith("vmin")) {
+ return n3;
+ }
+ return n3 + "px";
+};
+var getPixelSize = function(size2, parentSize, innerWidth2, innerHeight2) {
+ if (size2 && typeof size2 === "string") {
+ if (size2.endsWith("px")) {
+ return Number(size2.replace("px", ""));
}
- if (index3 == fromIndex) {
- return width * (targetIndex - fromIndex);
- } else if (index3 > fromIndex && index3 <= targetIndex) {
- return -width;
- } else if (index3 < fromIndex && index3 >= targetIndex) {
- return width;
- } else {
- return 0;
+ if (size2.endsWith("%")) {
+ var ratio = Number(size2.replace("%", "")) / 100;
+ return parentSize * ratio;
+ }
+ if (size2.endsWith("vw")) {
+ var ratio = Number(size2.replace("vw", "")) / 100;
+ return innerWidth2 * ratio;
+ }
+ if (size2.endsWith("vh")) {
+ var ratio = Number(size2.replace("vh", "")) / 100;
+ return innerHeight2 * ratio;
}
+ }
+ return size2;
+};
+var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) {
+ maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2);
+ maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2);
+ minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2);
+ minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2);
+ return {
+ maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth),
+ maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight),
+ minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth),
+ minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight)
};
- return /* @__PURE__ */ import_react142.default.createElement(import_react142.default.Fragment, null, /* @__PURE__ */ import_react142.default.createElement("div", {
- className: "mk-waypoints nav-header",
- onDragEnter: () => dragEnter(),
- onDragLeave: () => dragLeave(),
- onDragOver: (e5) => e5.preventDefault()
- }, /* @__PURE__ */ import_react142.default.createElement("div", {
- className: "mk-waypoints-inner nav-buttons-container"
- }, waypoints.map((pin, i4) => /* @__PURE__ */ import_react142.default.createElement(SortablePinnedSpaceItem, {
- id: i4,
- superstate: props.superstate,
- highlighted: overId == i4 && projected && projected.insert && projected.droppable,
- style: {
- transform: CSS.Translate.toString({
- x: calcXOffset(i4),
+};
+var definedProps = [
+ "as",
+ "style",
+ "className",
+ "grid",
+ "snap",
+ "bounds",
+ "boundsByDirection",
+ "size",
+ "defaultSize",
+ "minWidth",
+ "minHeight",
+ "maxWidth",
+ "maxHeight",
+ "lockAspectRatio",
+ "lockAspectRatioExtraWidth",
+ "lockAspectRatioExtraHeight",
+ "enable",
+ "handleStyles",
+ "handleClasses",
+ "handleWrapperStyle",
+ "handleWrapperClass",
+ "children",
+ "onResizeStart",
+ "onResize",
+ "onResizeStop",
+ "handleComponent",
+ "scale",
+ "resizeRatio",
+ "snapGap"
+];
+var baseClassName = "__resizable_base__";
+var Resizable = function(_super) {
+ __extends2(Resizable2, _super);
+ function Resizable2(props) {
+ var _this = _super.call(this, props) || this;
+ _this.ratio = 1;
+ _this.resizable = null;
+ _this.parentLeft = 0;
+ _this.parentTop = 0;
+ _this.resizableLeft = 0;
+ _this.resizableRight = 0;
+ _this.resizableTop = 0;
+ _this.resizableBottom = 0;
+ _this.targetLeft = 0;
+ _this.targetTop = 0;
+ _this.appendBase = function() {
+ if (!_this.resizable || !_this.window) {
+ return null;
+ }
+ var parent = _this.parentNode;
+ if (!parent) {
+ return null;
+ }
+ var element = _this.window.document.createElement("div");
+ element.style.width = "100%";
+ element.style.height = "100%";
+ element.style.position = "absolute";
+ element.style.transform = "scale(0, 0)";
+ element.style.left = "0";
+ element.style.flex = "0 0 100%";
+ if (element.classList) {
+ element.classList.add(baseClassName);
+ } else {
+ element.className += baseClassName;
+ }
+ parent.appendChild(element);
+ return element;
+ };
+ _this.removeBase = function(base2) {
+ var parent = _this.parentNode;
+ if (!parent) {
+ return;
+ }
+ parent.removeChild(base2);
+ };
+ _this.ref = function(c3) {
+ if (c3) {
+ _this.resizable = c3;
+ }
+ };
+ _this.state = {
+ isResizing: false,
+ width: typeof (_this.propsSize && _this.propsSize.width) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.width,
+ height: typeof (_this.propsSize && _this.propsSize.height) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.height,
+ direction: "right",
+ original: {
+ x: 0,
y: 0,
- scaleX: 0,
- scaleY: 0
- })
+ width: 0,
+ height: 0
+ },
+ backgroundStyle: {
+ height: "100%",
+ width: "100%",
+ backgroundColor: "rgba(0,0,0,0)",
+ cursor: "auto",
+ opacity: 0,
+ position: "fixed",
+ zIndex: 9999,
+ top: "0",
+ left: "0",
+ bottom: "0",
+ right: "0"
+ },
+ flexBasis: void 0
+ };
+ _this.onResizeStart = _this.onResizeStart.bind(_this);
+ _this.onMouseMove = _this.onMouseMove.bind(_this);
+ _this.onMouseUp = _this.onMouseUp.bind(_this);
+ return _this;
+ }
+ Object.defineProperty(Resizable2.prototype, "parentNode", {
+ get: function() {
+ if (!this.resizable) {
+ return null;
+ }
+ return this.resizable.parentNode;
},
- index: i4,
- pin,
- key: i4,
- dragStart: dragStarted,
- dragOver,
- dragEnded,
- dragActive: activeId !== null,
- ghost: activeId === i4
- })), /* @__PURE__ */ import_react142.default.createElement("div", {
- className: "mk-waypoint-new",
- onClick: (e5) => {
- const newWaypoints = [
- ...waypoints,
- { sticker: "ui//spaces", name: "Waypoint", paths: [] }
- ];
- props.superstate.settings.currentWaypoint = newWaypoints.length - 1;
- setWaypoints(newWaypoints);
+ enumerable: false,
+ configurable: true
+ });
+ Object.defineProperty(Resizable2.prototype, "window", {
+ get: function() {
+ if (!this.resizable) {
+ return null;
+ }
+ if (!this.resizable.ownerDocument) {
+ return null;
+ }
+ return this.resizable.ownerDocument.defaultView;
},
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
+ enumerable: false,
+ configurable: true
+ });
+ Object.defineProperty(Resizable2.prototype, "propsSize", {
+ get: function() {
+ return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
+ },
+ enumerable: false,
+ configurable: true
+ });
+ Object.defineProperty(Resizable2.prototype, "size", {
+ get: function() {
+ var width = 0;
+ var height = 0;
+ if (this.resizable && this.window) {
+ var orgWidth = this.resizable.offsetWidth;
+ var orgHeight = this.resizable.offsetHeight;
+ var orgPosition = this.resizable.style.position;
+ if (orgPosition !== "relative") {
+ this.resizable.style.position = "relative";
+ }
+ width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth;
+ height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight;
+ this.resizable.style.position = orgPosition;
+ }
+ return { width, height };
+ },
+ enumerable: false,
+ configurable: true
+ });
+ Object.defineProperty(Resizable2.prototype, "sizeStyle", {
+ get: function() {
+ var _this = this;
+ var size2 = this.props.size;
+ var getSize = function(key2) {
+ if (typeof _this.state[key2] === "undefined" || _this.state[key2] === "auto") {
+ return "auto";
+ }
+ if (_this.propsSize && _this.propsSize[key2] && _this.propsSize[key2].toString().endsWith("%")) {
+ if (_this.state[key2].toString().endsWith("%")) {
+ return _this.state[key2].toString();
+ }
+ var parentSize = _this.getParentSize();
+ var value = Number(_this.state[key2].toString().replace("px", ""));
+ var percent = value / parentSize[key2] * 100;
+ return percent + "%";
+ }
+ return getStringSize(_this.state[key2]);
+ };
+ var width = size2 && typeof size2.width !== "undefined" && !this.state.isResizing ? getStringSize(size2.width) : getSize("width");
+ var height = size2 && typeof size2.height !== "undefined" && !this.state.isResizing ? getStringSize(size2.height) : getSize("height");
+ return { width, height };
+ },
+ enumerable: false,
+ configurable: true
+ });
+ Resizable2.prototype.getParentSize = function() {
+ if (!this.parentNode) {
+ if (!this.window) {
+ return { width: 0, height: 0 };
+ }
+ return { width: this.window.innerWidth, height: this.window.innerHeight };
}
- }), overId != null && activeId === null && /* @__PURE__ */ import_react142.default.createElement(SortablePinnedSpaceItem, {
- id: waypoints.length,
- superstate: props.superstate,
- highlighted: false,
- index: waypoints.length,
- pin: null
- })), (0, import_react_dom8.createPortal)(
- /* @__PURE__ */ import_react142.default.createElement(DragOverlay, {
- dropAnimation: null,
- modifiers: [adjustTranslate],
- zIndex: 1600
- }, activeId !== null ? /* @__PURE__ */ import_react142.default.createElement(SortablePinnedSpaceItem, {
- id: -1,
- superstate: props.superstate,
- highlighted: false,
- clone: true,
- index: activeId,
- indicator: false,
- pin: waypoints[activeId]
- }) : null),
- document.body
- )));
-};
-
-// src/core/react/components/Navigator/MainList.tsx
-var MainList = (props) => {
- const [indexing, setIndexing] = import_react143.default.useState(false);
- (0, import_react143.useEffect)(() => {
- const reindex = async () => {
- setIndexing(true);
- };
- const finishedIndex = async () => {
- setIndexing(false);
- };
- props.superstate.eventsDispatcher.addListener("superstateReindex", reindex);
- props.superstate.eventsDispatcher.addListener(
- "superstateUpdated",
- finishedIndex
- );
- return () => {
- props.superstate.eventsDispatcher.removeListener(
- "superstateReindex",
- reindex
- );
- props.superstate.eventsDispatcher.removeListener(
- "superstateUpdated",
- finishedIndex
- );
+ var base2 = this.appendBase();
+ if (!base2) {
+ return { width: 0, height: 0 };
+ }
+ var wrapChanged = false;
+ var wrap = this.parentNode.style.flexWrap;
+ if (wrap !== "wrap") {
+ wrapChanged = true;
+ this.parentNode.style.flexWrap = "wrap";
+ }
+ base2.style.position = "relative";
+ base2.style.minWidth = "100%";
+ base2.style.minHeight = "100%";
+ var size2 = {
+ width: base2.offsetWidth,
+ height: base2.offsetHeight
};
- }, []);
- return /* @__PURE__ */ import_react143.default.createElement(import_react143.default.Fragment, null, /* @__PURE__ */ import_react143.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, {
- FallbackComponent: ErrorFallback
- }, /* @__PURE__ */ import_react143.default.createElement("div", {
- className: "mk-progress-bar"
- }, indexing && /* @__PURE__ */ import_react143.default.createElement("div", {
- className: "mk-progress-bar-value"
- })), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react143.default.createElement(MainMenu, {
- superstate: props.superstate
- }), /* @__PURE__ */ import_react143.default.createElement(SpaceSwitcher, {
- superstate: props.superstate
- }), /* @__PURE__ */ import_react143.default.createElement(SpaceTreeComponent, {
- superstate: props.superstate
- })));
-};
-function ErrorFallback({ error }) {
- const { resetBoundary } = (0, import_react_error_boundary_cjs.useErrorBoundary)();
- const copyError = () => {
- navigator.clipboard.writeText(error.message);
+ if (wrapChanged) {
+ this.parentNode.style.flexWrap = wrap;
+ }
+ this.removeBase(base2);
+ return size2;
};
- return /* @__PURE__ */ import_react143.default.createElement("div", {
- role: "alert"
- }, /* @__PURE__ */ import_react143.default.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ import_react143.default.createElement("p", {
- style: { color: "red" }
- }, error.message), /* @__PURE__ */ import_react143.default.createElement("button", {
- onClick: copyError
- }, "Copy Error"), /* @__PURE__ */ import_react143.default.createElement("button", {
- onClick: resetBoundary
- }, "Reload"));
-}
-
-// src/core/react/components/SpaceView/Contexts/SpaceView.tsx
-var SpaceView = (props) => {
- return /* @__PURE__ */ import_react144.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, {
- FallbackComponent: ErrorFallback
- }, /* @__PURE__ */ import_react144.default.createElement(PathProvider, {
- superstate: props.superstate,
- path: props.path,
- readMode: false
- }, /* @__PURE__ */ import_react144.default.createElement(SpaceProvider, {
- superstate: props.superstate
- }, /* @__PURE__ */ import_react144.default.createElement(FramesMDBProvider, {
- superstate: props.superstate,
- schema: "main"
- }, /* @__PURE__ */ import_react144.default.createElement(FrameSelectionProvider, {
- id: "main",
- superstate: props.superstate,
- editMode: props.readOnly ? 0 /* Read */ : 1 /* Page */
- }, /* @__PURE__ */ import_react144.default.createElement(SpaceRoot, {
- superstate: props.superstate
- }, props.children))))));
-};
-var SpaceRoot = (props) => {
- const { pathState } = (0, import_react144.useContext)(PathContext);
- const { tableData } = (0, import_react144.useContext)(FramesMDBContext);
- const cols = [
- ...[...props.superstate.spacesMap.get(pathState.path) ?? []].flatMap(
- (f2) => props.superstate.contextsIndex.get(f2)?.cols.map((g) => ({ ...g, table: f2 }))
- ),
- ...tableData?.cols.map((f2) => ({ ...f2, table: "" })) ?? []
- ];
- return /* @__PURE__ */ import_react144.default.createElement(FrameEditorProvider, {
- superstate: props.superstate,
- editMode: 1 /* Page */,
- cols
- }, props.children);
-};
-
-// src/core/react/components/PathView/PathView.tsx
-var PathView = (props) => {
- const [pathState, setPathState] = (0, import_react145.useState)(
- props.superstate.pathsIndex.get(props.path)
- );
- const ref2 = (0, import_react145.useRef)(null);
- (0, import_react145.useEffect)(() => {
- const uri = props.superstate.spaceManager.uriByString(props.path);
- const pathState2 = props.superstate.pathsIndex.get(props.path);
- if (!pathState2 && (uri?.scheme == "https" || uri?.scheme == "http")) {
- setPathState({
- path: props.path,
- displayName: uri.path,
- label: {
- sticker: uri.scheme,
- name: uri.path,
- color: ""
- },
- hidden: false,
- subtype: "md",
- type: "remote"
+ Resizable2.prototype.bindEvents = function() {
+ if (this.window) {
+ this.window.addEventListener("mouseup", this.onMouseUp);
+ this.window.addEventListener("mousemove", this.onMouseMove);
+ this.window.addEventListener("mouseleave", this.onMouseUp);
+ this.window.addEventListener("touchmove", this.onMouseMove, {
+ capture: true,
+ passive: false
});
+ this.window.addEventListener("touchend", this.onMouseUp);
+ }
+ };
+ Resizable2.prototype.unbindEvents = function() {
+ if (this.window) {
+ this.window.removeEventListener("mouseup", this.onMouseUp);
+ this.window.removeEventListener("mousemove", this.onMouseMove);
+ this.window.removeEventListener("mouseleave", this.onMouseUp);
+ this.window.removeEventListener("touchmove", this.onMouseMove, true);
+ this.window.removeEventListener("touchend", this.onMouseUp);
+ }
+ };
+ Resizable2.prototype.componentDidMount = function() {
+ if (!this.resizable || !this.window) {
return;
}
- setPathState(pathState2);
- }, [props.path]);
- return /* @__PURE__ */ import_react145.default.createElement("div", {
- className: "mk-path-view",
- style: { ...props.styles ?? {} }
- }, pathState?.type == "remote" ? pathState.subtype == "note" ? /* @__PURE__ */ import_react145.default.createElement(FileLinkViewComponent, {
- path: pathState.path,
- superstate: props.superstate,
- flow: true
- }) : /* @__PURE__ */ import_react145.default.createElement("iframe", {
- src: props.path
- }) : pathState?.type == "space" ? /* @__PURE__ */ import_react145.default.createElement(SpaceView, {
- superstate: props.superstate,
- path: props.path,
- readOnly: props.readOnly
- }, /* @__PURE__ */ import_react145.default.createElement(SpaceOuter_default, {
- superstate: props.superstate,
- ref: ref2
- }, /* @__PURE__ */ import_react145.default.createElement(FrameEditorInstance, {
- containerRef: props.containerRef,
- superstate: props.superstate
- }))) : props.superstate.ui.availableViews().some((f2) => f2 == props.path?.split(".").pop()) ? /* @__PURE__ */ import_react145.default.createElement(NoteView, {
- superstate: props.superstate,
- path: props.path,
- load: true,
- classname: "mk-flow-node"
- }) : /* @__PURE__ */ import_react145.default.createElement(import_react145.default.Fragment, null));
-};
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx
-var import_react147 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Frames/SpaceCommand/Suggester.tsx
-var import_react146 = __toESM(require_react());
-var import_react_dom9 = __toESM(require_react_dom());
-var Suggester = (0, import_react146.forwardRef)(
- (props, outerRef) => {
- const ref2 = (0, import_react146.useRef)(null);
- const [index3, setIndex] = (0, import_react146.useState)(0);
- const [isReady, setIsReady] = (0, import_react146.useState)(false);
- const menuRef = (0, import_react146.useRef)(null);
- const [pos, setPos] = (0, import_react146.useState)({ x: 0, y: 0 });
- const [active, setActive] = (0, import_react146.useState)(false);
- const [section, setSection] = (0, import_react146.useState)("");
- (0, import_react146.useEffect)(() => {
- const resizeObserver = new ResizeObserver((entries) => {
- if (menuRef.current) {
- const rect = menuRef.current.getBoundingClientRect();
- setIsReady(true);
- setPos(
- calculateBoundsBasedOnPosition(
- ref2.current.getBoundingClientRect(),
- rect,
- { width: window.innerWidth, height: innerHeight },
- "bottom"
- )
- );
- }
- });
- if (menuRef.current && ref2.current) {
- resizeObserver.observe(menuRef.current);
- resizeObserver.observe(ref2.current);
+ var computedStyle = this.window.getComputedStyle(this.resizable);
+ this.setState({
+ width: this.state.width || this.size.width,
+ height: this.state.height || this.size.height,
+ flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0
+ });
+ };
+ Resizable2.prototype.componentWillUnmount = function() {
+ if (this.window) {
+ this.unbindEvents();
+ }
+ };
+ Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) {
+ var propsSize = this.propsSize && this.propsSize[kind];
+ return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize;
+ };
+ Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) {
+ var boundsByDirection = this.props.boundsByDirection;
+ var direction = this.state.direction;
+ var widthByDirection = boundsByDirection && hasDirection("left", direction);
+ var heightByDirection = boundsByDirection && hasDirection("top", direction);
+ var boundWidth;
+ var boundHeight;
+ if (this.props.bounds === "parent") {
+ var parent_1 = this.parentNode;
+ if (parent_1) {
+ boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
+ boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop);
+ }
+ } else if (this.props.bounds === "window") {
+ if (this.window) {
+ boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
+ boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
+ }
+ } else if (this.props.bounds) {
+ boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
+ boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
+ }
+ if (boundWidth && Number.isFinite(boundWidth)) {
+ maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
+ }
+ if (boundHeight && Number.isFinite(boundHeight)) {
+ maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
+ }
+ return { maxWidth, maxHeight };
+ };
+ Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) {
+ var scale = this.props.scale || 1;
+ var resizeRatio = this.props.resizeRatio || 1;
+ var _a = this.state, direction = _a.direction, original = _a.original;
+ var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
+ var newWidth = original.width;
+ var newHeight = original.height;
+ var extraHeight = lockAspectRatioExtraHeight || 0;
+ var extraWidth = lockAspectRatioExtraWidth || 0;
+ if (hasDirection("right", direction)) {
+ newWidth = original.width + (clientX - original.x) * resizeRatio / scale;
+ if (lockAspectRatio) {
+ newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
+ }
+ }
+ if (hasDirection("left", direction)) {
+ newWidth = original.width - (clientX - original.x) * resizeRatio / scale;
+ if (lockAspectRatio) {
+ newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
}
- return () => {
- resizeObserver.disconnect();
- };
- }, [menuRef.current]);
- const keyDown = (e5) => {
- if (e5.key == "Delete" || e5.key == "Backspace") {
- if (ref2.current.innerText == "" && props.onDelete) {
- props.onDelete();
- }
+ }
+ if (hasDirection("bottom", direction)) {
+ newHeight = original.height + (clientY - original.y) * resizeRatio / scale;
+ if (lockAspectRatio) {
+ newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
}
- if (e5.key == "Tab") {
- if (props.sections && props.onSelectSection) {
- e5.preventDefault();
- e5.stopPropagation();
- setSection((p2) => {
- const sectionIndex = props.sections.findIndex((g) => g.value == p2);
- if (e5.shiftKey) {
- if (sectionIndex == 0) {
- return p2;
- }
- props.onSelectSection(props.sections[sectionIndex - 1].value);
- return props.sections[sectionIndex - 1].value;
- }
- if (sectionIndex == props.sections.length - 1) {
- return p2;
- }
- props.onSelectSection(props.sections[sectionIndex + 1].value);
- return props.sections[sectionIndex + 1].value;
- });
- }
+ }
+ if (hasDirection("top", direction)) {
+ newHeight = original.height - (clientY - original.y) * resizeRatio / scale;
+ if (lockAspectRatio) {
+ newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
}
- if (e5.key == "ArrowUp") {
- const size2 = props.suggestions.length - 1;
- const newIndex = index3 < 0 ? size2 : index3 - 1;
- if (props.suggestions[newIndex]?.disabled) {
- setIndex(newIndex < 0 ? size2 : newIndex - 1);
- } else {
- setIndex(newIndex);
- }
- e5.preventDefault();
+ }
+ return { newWidth, newHeight };
+ };
+ Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max5, min5) {
+ var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
+ var computedMinWidth = typeof min5.width === "undefined" ? 10 : min5.width;
+ var computedMaxWidth = typeof max5.width === "undefined" || max5.width < 0 ? newWidth : max5.width;
+ var computedMinHeight = typeof min5.height === "undefined" ? 10 : min5.height;
+ var computedMaxHeight = typeof max5.height === "undefined" || max5.height < 0 ? newHeight : max5.height;
+ var extraHeight = lockAspectRatioExtraHeight || 0;
+ var extraWidth = lockAspectRatioExtraWidth || 0;
+ if (lockAspectRatio) {
+ var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
+ var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
+ var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
+ var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
+ var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
+ var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
+ var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
+ var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
+ newWidth = clamp2(newWidth, lockedMinWidth, lockedMaxWidth);
+ newHeight = clamp2(newHeight, lockedMinHeight, lockedMaxHeight);
+ } else {
+ newWidth = clamp2(newWidth, computedMinWidth, computedMaxWidth);
+ newHeight = clamp2(newHeight, computedMinHeight, computedMaxHeight);
+ }
+ return { newWidth, newHeight };
+ };
+ Resizable2.prototype.setBoundingClientRect = function() {
+ if (this.props.bounds === "parent") {
+ var parent_2 = this.parentNode;
+ if (parent_2) {
+ var parentRect = parent_2.getBoundingClientRect();
+ this.parentLeft = parentRect.left;
+ this.parentTop = parentRect.top;
}
- if (e5.key == "ArrowDown") {
- const size2 = props.suggestions.length - 1;
- const newIndex = index3 >= size2 ? 0 : index3 + 1;
- if (props.suggestions[newIndex]?.disabled) {
- setIndex(newIndex >= size2 ? 0 : newIndex + 1);
- } else {
- setIndex(newIndex);
+ }
+ if (this.props.bounds && typeof this.props.bounds !== "string") {
+ var targetRect = this.props.bounds.getBoundingClientRect();
+ this.targetLeft = targetRect.left;
+ this.targetTop = targetRect.top;
+ }
+ if (this.resizable) {
+ var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
+ this.resizableLeft = left;
+ this.resizableRight = right;
+ this.resizableTop = top_1;
+ this.resizableBottom = bottom;
+ }
+ };
+ Resizable2.prototype.onResizeStart = function(event, direction) {
+ if (!this.resizable || !this.window) {
+ return;
+ }
+ var clientX = 0;
+ var clientY = 0;
+ if (event.nativeEvent && isMouseEvent(event.nativeEvent)) {
+ clientX = event.nativeEvent.clientX;
+ clientY = event.nativeEvent.clientY;
+ } else if (event.nativeEvent && isTouchEvent2(event.nativeEvent)) {
+ clientX = event.nativeEvent.touches[0].clientX;
+ clientY = event.nativeEvent.touches[0].clientY;
+ }
+ if (this.props.onResizeStart) {
+ if (this.resizable) {
+ var startResize = this.props.onResizeStart(event, direction, this.resizable);
+ if (startResize === false) {
+ return;
}
- e5.preventDefault();
}
- if (e5.key == "Enter") {
- props.onSelect(props.suggestions[index3]);
- e5.preventDefault();
+ }
+ if (this.props.size) {
+ if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) {
+ this.setState({ height: this.props.size.height });
+ }
+ if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) {
+ this.setState({ width: this.props.size.width });
+ }
+ }
+ this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
+ var flexBasis;
+ var computedStyle = this.window.getComputedStyle(this.resizable);
+ if (computedStyle.flexBasis !== "auto") {
+ var parent_3 = this.parentNode;
+ if (parent_3) {
+ var dir = this.window.getComputedStyle(parent_3).flexDirection;
+ this.flexDir = dir.startsWith("row") ? "row" : "column";
+ flexBasis = computedStyle.flexBasis;
}
+ }
+ this.setBoundingClientRect();
+ this.bindEvents();
+ var state = {
+ original: {
+ x: clientX,
+ y: clientY,
+ width: this.size.width,
+ height: this.size.height
+ },
+ isResizing: true,
+ backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }),
+ direction,
+ flexBasis
};
- const CLASS_NAMES2 = {
- root: "mk-menu-container",
- rootFocused: "mk-focused",
- selected: "mk-selected",
- selectedTagWrapper: "mk-menu-selected-tag-wrapper",
- selectedTag: "mk-menu-selected-tag",
- selectedTagName: "mk-menu-selected-tag-name",
- search: "mk-menu-search",
- searchWrapper: "mk-menu-search-container",
- searchInput: "mk-menu-search-input",
- suggestions: "mk-menu-suggestions",
- suggestionActive: "mk-active",
- suggestionDisabled: "mk-disabled"
+ this.setState(state);
+ };
+ Resizable2.prototype.onMouseMove = function(event) {
+ var _this = this;
+ if (!this.state.isResizing || !this.resizable || !this.window) {
+ return;
+ }
+ if (this.window.TouchEvent && isTouchEvent2(event)) {
+ try {
+ event.preventDefault();
+ event.stopPropagation();
+ } catch (e5) {
+ }
+ }
+ var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
+ var clientX = isTouchEvent2(event) ? event.touches[0].clientX : event.clientX;
+ var clientY = isTouchEvent2(event) ? event.touches[0].clientY : event.clientY;
+ var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
+ var parentSize = this.getParentSize();
+ var max5 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
+ maxWidth = max5.maxWidth;
+ maxHeight = max5.maxHeight;
+ minWidth = max5.minWidth;
+ minHeight = max5.minHeight;
+ var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
+ var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
+ if (this.props.snap && this.props.snap.x) {
+ newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
+ }
+ if (this.props.snap && this.props.snap.y) {
+ newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
+ }
+ var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
+ newWidth = newSize.newWidth;
+ newHeight = newSize.newHeight;
+ if (this.props.grid) {
+ var newGridWidth = snap(newWidth, this.props.grid[0]);
+ var newGridHeight = snap(newHeight, this.props.grid[1]);
+ var gap = this.props.snapGap || 0;
+ newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
+ newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
+ }
+ var delta = {
+ width: newWidth - original.width,
+ height: newHeight - original.height
};
- return /* @__PURE__ */ import_react146.default.createElement(import_react146.default.Fragment, null, /* @__PURE__ */ import_react146.default.createElement("div", {
- ref: (node2) => {
- ref2.current = node2;
- if (outerRef) {
- if (typeof outerRef === "function") {
- outerRef(node2);
- } else {
- outerRef.current = node2;
- }
- }
- },
- onFocus: () => {
- if (props.onFocus) {
- props.onFocus();
- }
- setActive(true);
- },
- onBlur: () => {
- if (props.onBlur)
- props.onBlur();
- setActive(false);
- },
- "data-placeholder": props.placeholder,
- onInput: (e5) => props.onChange(e5.currentTarget.innerText),
- onKeyDown: (e5) => keyDown(e5),
- className: "mk-suggester",
- contentEditable: true
- }), active && (0, import_react_dom9.createPortal)(
- /* @__PURE__ */ import_react146.default.createElement("div", {
- ref: menuRef,
- className: `mk-menu mk-menu-suggester ${isReady ? "mk-ready" : ""}`,
- style: {
- position: "absolute",
- top: pos.y,
- left: pos.x,
- zIndex: 1e3,
- width: "300px",
- "--mk-menu-max-height": "300px",
- visibility: active ? "visible" : "hidden"
- }
- }, props.sections ? /* @__PURE__ */ import_react146.default.createElement("div", {
- className: "mk-menu-sections"
- }, props.sections.map((f2, i4) => /* @__PURE__ */ import_react146.default.createElement("div", {
- key: i4,
- onClick: () => setSection(f2.value),
- className: `${section == f2.value ? "is-active" : ""} mk-menu-section`
- }, f2.name == "" ? i18n_default.labels.all : f2.name))) : /* @__PURE__ */ import_react146.default.createElement(import_react146.default.Fragment, null), /* @__PURE__ */ import_react146.default.createElement(SelectMenuSuggestions_default, {
- expanded: false,
- addKeyword: "Add",
- options: props.suggestions,
- query: "",
- refs: null,
- hide: () => null,
- selectOption: props.onSelect,
- id: "",
- classNames: CLASS_NAMES2,
- index: index3,
- setIndex,
- allowNew: false,
- ui: props.superstate.ui,
- isDisclosureMenu: false
- })),
- document.body
- ));
- }
-);
-Suggester.displayName = "Suggester";
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx
-function parseContent(input) {
- const regex1 = /!\[!\[(.*?)\]\]/;
- const regex2 = /!!\[\[(.*?)\]\]/;
- const match1 = input.match(regex1);
- const match2 = input.match(regex2);
- return match1 ? match1[1] : match2 ? match2[1] : input;
-}
-var FlowNodeView = (props) => {
- const { spaceState } = (0, import_react147.useContext)(SpaceContext);
- const pathState = (0, import_react147.useMemo)(() => {
- const fullPath = props.state?.props?.value;
- const path3 = fullPath ? props.superstate.spaceManager.resolvePath(
- parseContent(fullPath),
- props.source
- ) : null;
- const uri = props.superstate.spaceManager.uriByString(fullPath);
- if (uri?.scheme == "https" || uri?.scheme == "http") {
- return {
- path: fullPath,
- displayName: uri.path,
- label: {
- sticker: uri.scheme,
- name: uri.path,
- color: ""
- },
- hidden: false,
- subtype: "md",
- type: "remote"
- };
+ if (width && typeof width === "string") {
+ if (width.endsWith("%")) {
+ var percent = newWidth / parentSize.width * 100;
+ newWidth = percent + "%";
+ } else if (width.endsWith("vw")) {
+ var vw = newWidth / this.window.innerWidth * 100;
+ newWidth = vw + "vw";
+ } else if (width.endsWith("vh")) {
+ var vh = newWidth / this.window.innerHeight * 100;
+ newWidth = vh + "vh";
+ }
}
- return props.superstate.pathsIndex.get(path3);
- }, [props.state, props.source]);
- const { updateNode, nodes } = (0, import_react147.useContext)(FramesEditorRootContext);
- const { selectionMode } = (0, import_react147.useContext)(FrameSelectionContext);
- const [expanded, setExpanded] = (0, import_react147.useState)(
- props.state?.styles?.["--mk-expanded"]
- );
- const updateValue2 = (newValue) => {
- if (newValue != props.state.props?.value) {
- if (props.treeNode.editorProps?.linkedNode) {
- const node2 = nodes.find(
- (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
- );
- updateNode(node2, {
- props: {
- ...node2.props,
- [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
- }
- });
- } else {
- updateNode(props.treeNode.node, {
- props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
- });
+ if (height && typeof height === "string") {
+ if (height.endsWith("%")) {
+ var percent = newHeight / parentSize.height * 100;
+ newHeight = percent + "%";
+ } else if (height.endsWith("vw")) {
+ var vw = newHeight / this.window.innerWidth * 100;
+ newHeight = vw + "vw";
+ } else if (height.endsWith("vh")) {
+ var vh = newHeight / this.window.innerHeight * 100;
+ newHeight = vh + "vh";
}
}
- };
- const hideToggle = props.state?.styles?.["--mk-link"];
- const { id: id3 } = (0, import_react147.useContext)(FrameInstanceContext);
- const [pathString, setPathString] = (0, import_react147.useState)("");
- const options = (0, import_react147.useMemo)(() => {
- const fuseOptions = {
- keys: ["name", "value"]
+ var newState = {
+ width: this.createSizeForCssProperty(newWidth, "width"),
+ height: this.createSizeForCssProperty(newHeight, "height")
};
- const suggestions = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden && f2.subtype == "md" || f2.subtype == "space").map((f2) => ({
- name: f2.displayName,
- value: f2.path,
- description: f2.path,
- icon: f2.label?.sticker
- }));
- const fuse = new Fuse(suggestions, fuseOptions);
- return pathString?.length == 0 ? suggestions : fuse.search(pathString).map((result) => result.item);
- }, [pathString]);
- const toggleCollapse = () => {
- setExpanded((p2) => !p2);
- if (selectionMode > 0 /* Read */)
- updateNode(props.treeNode.node, {
- styles: {
- ...props.treeNode.node.styles,
- "--mk-expanded": (!props.state?.styles?.["--mk-expanded"]).toString()
- }
- });
+ if (this.flexDir === "row") {
+ newState.flexBasis = newState.width;
+ } else if (this.flexDir === "column") {
+ newState.flexBasis = newState.height;
+ }
+ (0, import_react_dom10.flushSync)(function() {
+ _this.setState(newState);
+ });
+ if (this.props.onResize) {
+ this.props.onResize(event, direction, this.resizable, delta);
+ }
};
- const [isTransition, startTransition] = (0, import_react147.useTransition)();
- return /* @__PURE__ */ import_react147.default.createElement("div", {
- className: "mk-node-flow"
- }, !props.state?.styles?.["--mk-min-mode"] && /* @__PURE__ */ import_react147.default.createElement(import_react147.default.Fragment, null, pathState ? /* @__PURE__ */ import_react147.default.createElement("div", {
- className: "mk-node-link"
- }, /* @__PURE__ */ import_react147.default.createElement(PathCrumb, {
- superstate: props.superstate,
- path: pathState.path
- }), !hideToggle && /* @__PURE__ */ import_react147.default.createElement(CollapseToggle, {
- superstate: props.superstate,
- collapsed: !expanded,
- onToggle: toggleCollapse
- })) : selectionMode > 0 /* Read */ && /* @__PURE__ */ import_react147.default.createElement("div", {
- className: "mk-node-text-placeholder"
- }, /* @__PURE__ */ import_react147.default.createElement(Suggester, {
- placeholder: i18n_default.hintText.selectNote,
- onChange: (e5) => {
- setPathString(e5);
- },
- suggestions: options,
- superstate: props.superstate,
- onSelect: (option2) => {
- updateValue2(option2.value);
+ Resizable2.prototype.onMouseUp = function(event) {
+ var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
+ if (!isResizing || !this.resizable) {
+ return;
}
- }))), props.state && expanded && (props.state?.props?.value?.length > 0 ? /* @__PURE__ */ import_react147.default.createElement(PathView, {
- id: id3,
- superstate: props.superstate,
- path: pathState?.path ?? props.state?.props?.value,
- containerRef: props.containerRef,
- styles: {},
- readOnly: true
- }) : /* @__PURE__ */ import_react147.default.createElement("div", {
- onClick: () => newPathInSpace(
- props.superstate,
- spaceState,
- "md",
- null,
- true
- ).then((f2) => updateValue2(f2))
- }, "New Note")));
-};
-
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameHoverMenu.tsx
-var import_react148 = __toESM(require_react());
-var FrameHoverMenu = (props) => {
- const { spaceInfo } = (0, import_react148.useContext)(SpaceContext);
- const { addNode, moveUp, moveDown, setLastCreatedId } = (0, import_react148.useContext)(
- FramesEditorRootContext
- );
- const { select, selection: selection2 } = (0, import_react148.useContext)(FrameSelectionContext);
- const selected = selection2.includes(props.node.id);
- return /* @__PURE__ */ import_react148.default.createElement(import_react148.default.Fragment, null, /* @__PURE__ */ import_react148.default.createElement("div", {
- className: `${"mk-editor-frame-hover-horizontal"}`,
- style: {
- pointerEvents: "auto",
- opacity: props.visible ? "1" : "0"
+ var delta = {
+ width: this.size.width - original.width,
+ height: this.size.height - original.height
+ };
+ if (this.props.onResizeStop) {
+ this.props.onResizeStop(event, direction, this.resizable, delta);
}
- }, props.dragRef && /* @__PURE__ */ import_react148.default.createElement("div", {
- className: "mk-icon-small mk-editor-frame-hover-button",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//handle")
- },
- style: { cursor: "grab" },
- ref: props.dragRef,
- onClick: (e5) => {
- e5.stopPropagation();
- if (selection2.length == 1 && selected) {
- select(null);
- return;
+ if (this.props.size) {
+ this.setState(this.props.size);
+ }
+ this.unbindEvents();
+ this.setState({
+ isResizing: false,
+ backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: "auto" })
+ });
+ };
+ Resizable2.prototype.updateSize = function(size2) {
+ this.setState({ width: size2.width, height: size2.height });
+ };
+ Resizable2.prototype.renderResizer = function() {
+ var _this = this;
+ var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
+ if (!enable) {
+ return null;
+ }
+ var resizers = Object.keys(enable).map(function(dir) {
+ if (enable[dir] !== false) {
+ return React127.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null);
}
- if (e5.shiftKey) {
- select(props.node.id, true);
- } else {
- select(props.node.id);
+ return null;
+ });
+ return React127.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers);
+ };
+ Resizable2.prototype.render = function() {
+ var _this = this;
+ var extendsProps = Object.keys(this.props).reduce(function(acc, key2) {
+ if (definedProps.indexOf(key2) !== -1) {
+ return acc;
}
+ acc[key2] = _this.props[key2];
+ return acc;
+ }, {});
+ var style = __assign3(__assign3(__assign3({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
+ if (this.state.flexBasis) {
+ style.flexBasis = this.state.flexBasis;
+ }
+ var Wrapper = this.props.as || "div";
+ return React127.createElement(
+ Wrapper,
+ __assign3({ ref: this.ref, style, className: this.props.className }, extendsProps),
+ this.state.isResizing && React127.createElement("div", { style: this.state.backgroundStyle }),
+ this.props.children,
+ this.renderResizer()
+ );
+ };
+ Resizable2.defaultProps = {
+ as: "div",
+ onResizeStart: function() {
},
- ...props.listeners ?? {},
- ...props.attributes ?? {}
- }), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react148.default.createElement("div", {
- onClick: (e5) => {
- addNode(newNode.node, props.node).then(
- (f2) => setLastCreatedId(f2.id)
- );
- e5.stopPropagation();
+ onResize: function() {
},
- className: "mk-icon-small mk-editor-frame-hover-button",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//plus")
- }
- })));
-};
+ onResizeStop: function() {
+ },
+ enable: {
+ top: true,
+ right: true,
+ bottom: true,
+ left: true,
+ topRight: true,
+ bottomRight: true,
+ bottomLeft: true,
+ topLeft: true
+ },
+ style: {},
+ grid: [1, 1],
+ lockAspectRatio: false,
+ lockAspectRatioExtraWidth: 0,
+ lockAspectRatioExtraHeight: 0,
+ scale: 1,
+ resizeRatio: 1,
+ snapGap: 0
+ };
+ return Resizable2;
+}(React127.PureComponent);
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameNodeEditorContainer.tsx
-var import_react149 = __toESM(require_react());
-var FrameNodeEditorContainer = (props) => {
- const menuRef = (0, import_react149.useRef)(null);
- const [pos, setPos] = (0, import_react149.useState)(0);
- const calculateXBasedOnBounds = (targetRect, rect, containerRect) => {
- const x2 = targetRect.x - props.containerRect.x;
- const overflowX = x2 + rect.width - containerRect.width;
- let newX = x2;
- if (overflowX > 0) {
- if (targetRect.x - props.containerRect.x - rect.width > 0)
- newX = containerRect.width - rect.width;
- else {
- newX = 0;
- }
- }
- return newX;
+// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx
+var import_react129 = __toESM(require_react());
+var FrameResizer = (props) => {
+ const labelForValue = (value) => {
+ if (!value)
+ return null;
+ if (value == "auto")
+ return "Fit";
+ if (value == "100%")
+ return "Fill";
+ return value;
};
- const [ready, setReady] = (0, import_react149.useState)(false);
- (0, import_react149.useEffect)(() => {
- const resizeObserver = new ResizeObserver((entries) => {
- const rect = entries[0].target.getBoundingClientRect();
- setReady(true);
- setPos(
- calculateXBasedOnBounds(props.nodeRect, rect, props.containerRect)
- );
+ const [modifiers, setModifiers] = import_react129.default.useState(null);
+ const [size2, setSize2] = import_react129.default.useState({
+ width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth,
+ height: props.size.height
+ });
+ import_react129.default.useEffect(() => {
+ setSize2({
+ width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth,
+ height: props.size.height
});
- if (menuRef.current)
- resizeObserver.observe(menuRef.current);
+ }, [props.size, props.resizeMode]);
+ (0, import_react129.useEffect)(() => {
+ const captureShift = (e5) => {
+ setModifiers({ shiftKey: e5.shiftKey });
+ };
+ props.superstate.ui.inputManager.on("keydown", captureShift);
+ props.superstate.ui.inputManager.on("keyup", captureShift);
return () => {
- resizeObserver.disconnect();
+ props.superstate.ui.inputManager.off("keydown", captureShift);
+ props.superstate.ui.inputManager.off("keyup", captureShift);
};
- }, [menuRef]);
- return /* @__PURE__ */ import_react149.default.createElement("div", {
- className: "mk-editor-frame-node-container",
- ref: menuRef,
+ }, [setModifiers]);
+ return /* @__PURE__ */ import_react129.default.createElement("div", {
style: {
- visibility: ready ? "visible" : "hidden",
- pointerEvents: "auto",
- left: pos,
- bottom: `calc(100% - ${props.nodeRect.y - props.containerRect.y - 10}px)`,
- maxWidth: props.containerRect.width
- },
- onClick: (e5) => {
- e5.preventDefault();
- e5.stopPropagation();
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: props.clientSize.width,
+ height: props.clientSize.height
}
- }, props.children);
-};
-
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx
-var import_classnames7 = __toESM(require_classnames());
-var import_react151 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDraggableHandle.tsx
-var import_react150 = __toESM(require_react());
-var FrameDraggableHandle = (props) => {
- const [modifier, setModifier] = (0, import_react150.useState)(null);
- const startValue = (0, import_react150.useRef)(props.value);
- const currentValue = (0, import_react150.useRef)(props.value);
- const [, setStartPos] = (0, import_react150.useState)([0, 0]);
- const step = props.step ?? 1;
- const handleMove = (0, import_react150.useCallback)(
- (e5) => {
- setStartPos((pos) => {
- const { clientX: x2, clientY: y22 } = e5;
- const [x1, y1] = pos;
- const a4 = props.reverseX ? x1 - x2 : x2 - x1;
- const b2 = props.reverseY ? y22 - y1 : y1 - y22;
- const mod3 = props.mod ?? 1;
- const stepModifer = step * mod3;
- let delta = Math.sqrt((a4 + b2) / 2 * (a4 + b2) / 2) * stepModifer;
- if (a4 + b2 < 0)
- delta = -delta;
- if (props.disableX)
- delta = b2 * stepModifer;
- if (props.disableY)
- delta = a4 * stepModifer;
- let newValue = startValue.current + delta;
- newValue = props.min != null ? Math.max(newValue, props.min) : newValue;
- newValue = props.max != null ? Math.min(newValue, props.max) : newValue;
- currentValue.current = newValue;
- props.onDragMove(newValue, {
- ctrlKey: e5.ctrlKey,
- metaKey: e5.metaKey,
- altKey: e5.altKey,
- shiftKey: e5.shiftKey
- });
- return pos;
+ }, /* @__PURE__ */ import_react129.default.createElement(Resizable, {
+ lockAspectRatio: modifiers?.shiftKey,
+ className: (0, import_classnames9.default)(
+ props.resizeMode == 2 /* ResizeColumn */ ? "mk-frame-column" : "mk-frame-bounds"
+ ),
+ enable: props.resizeMode == 2 /* ResizeColumn */ ? { right: true } : {
+ right: true,
+ bottom: true,
+ bottomRight: true
+ },
+ onResize: (e5, direction, ref2, d4) => {
+ setSize2({
+ width: ref2.clientWidth,
+ height: ref2.clientHeight
});
- e5.stopPropagation();
},
- [modifier, props.max, props.min, step, props.onDragMove, props.mod]
- );
- const handleMoveEnd = (0, import_react150.useCallback)(
- (e5) => {
+ onResizeStop: (e5, direction, ref2, d4) => {
const captureClick = (e6) => {
e6.stopPropagation();
window.removeEventListener("click", captureClick, true);
};
- window.addEventListener(
- "click",
- captureClick,
- true
- );
- document.removeEventListener("mousemove", handleMove);
- document.removeEventListener("mouseup", handleMoveEnd);
- props.onDragEnd(currentValue.current, {
- ctrlKey: e5.ctrlKey,
- metaKey: e5.metaKey,
- altKey: e5.altKey,
- shiftKey: e5.shiftKey
+ window.addEventListener("click", captureClick, true);
+ props.resizeMode == 2 /* ResizeColumn */ ? props.resize({
+ minWidth: `'${ref2.clientWidth}px'`
+ }) : direction == "bottom" ? props.resize({
+ height: `'${ref2.clientHeight}px'`
+ }) : direction == "right" ? props.resize({
+ width: `'${ref2.clientWidth}px'`
+ }) : props.resize({
+ width: `'${ref2.clientWidth}px'`,
+ height: `'${ref2.clientHeight}px'`
});
- e5.preventDefault();
e5.stopPropagation();
},
- [handleMove, props.onDragEnd]
- );
- const handleDown = (0, import_react150.useCallback)(
- (e5) => {
- startValue.current = props.value;
- setStartPos([e5.clientX, e5.clientY]);
- document.addEventListener("mousemove", handleMove);
- document.addEventListener("mouseup", handleMoveEnd);
+ onResizeStart: (e5) => {
e5.stopPropagation();
},
- [handleMove, handleMoveEnd, props.value]
- );
- const handleKeyDown = (e5) => {
- if (e5.metaKey) {
- setModifier("metaKey");
- } else if (e5.ctrlKey) {
- setModifier("ctrlKey");
- } else if (e5.altKey) {
- setModifier("altKey");
- } else if (e5.shiftKey) {
- setModifier("shiftKey");
+ handleClasses: props.resizeMode == 2 /* ResizeColumn */ ? {
+ right: "mk-frame-column-resize-handle"
+ } : props.resizeMode == 1 /* ResizeSelected */ ? { bottomRight: "mk-frame-resize-handle" } : {},
+ handleWrapperStyle: {
+ pointerEvents: "auto"
+ },
+ size: {
+ width: size2.width && size2.width != "auto" ? size2.width : "100%",
+ height: size2.height && size2.height != "auto" ? size2.height : "100%"
+ },
+ ...props.listeners
+ }), props.clientSize?.width > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react129.default.createElement("div", {
+ className: "mk-frame-resize-label-width"
+ }, /* @__PURE__ */ import_react129.default.createElement("div", null, /* @__PURE__ */ import_react129.default.createElement("span", null, labelForValue(size2.width) ?? i18n_default.editor.fit), size2.width && size2.width != "auto" ? /* @__PURE__ */ import_react129.default.createElement("div", {
+ onClick: (e5) => {
+ props.resize({
+ width: wrapQuotes("auto")
+ });
+ e5.stopPropagation();
+ },
+ "aria-label": i18n_default.editor.scaleToFit,
+ style: { display: "flex" },
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(
+ "ui//fold-horizontal"
+ )
}
+ }) : /* @__PURE__ */ import_react129.default.createElement("div", {
+ onClick: (e5) => {
+ props.resize({
+ width: wrapQuotes("100%")
+ });
+ e5.stopPropagation();
+ },
+ "aria-label": i18n_default.editor.scaleToFill,
+ style: { display: "flex" },
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(
+ "ui//unfold-horizontal"
+ )
+ }
+ }))), props.clientSize?.height > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react129.default.createElement("div", {
+ className: "mk-frame-resize-label-height"
+ }, /* @__PURE__ */ import_react129.default.createElement("div", null, /* @__PURE__ */ import_react129.default.createElement("span", null, labelForValue(size2.height) ?? i18n_default.editor.fit), size2.height && size2.height != "auto" ? /* @__PURE__ */ import_react129.default.createElement("div", {
+ onClick: (e5) => {
+ props.resize({
+ height: wrapQuotes("auto")
+ });
+ e5.stopPropagation();
+ },
+ "aria-label": i18n_default.editor.scaleToFit,
+ style: { display: "flex" },
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//fold-vertical")
+ }
+ }) : /* @__PURE__ */ import_react129.default.createElement("div", {
+ onClick: (e5) => {
+ props.resize({
+ height: wrapQuotes("100%")
+ });
+ e5.stopPropagation();
+ },
+ "aria-label": i18n_default.editor.scaleToFill,
+ style: { display: "flex" },
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(
+ "ui//unfold-vertical"
+ )
+ }
+ }))));
+};
+
+// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx
+var import_react147 = __toESM(require_react());
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/AudioNodeView.tsx
+var import_react130 = __toESM(require_react());
+var AudioNodeView = (props) => {
+ const value = props.state.props.value;
+ const sourcePath = (0, import_react130.useMemo)(() => {
+ return props.superstate.ui.getUIPath(value);
+ }, [value]);
+ return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react130.default.createElement("audio", {
+ controls: true,
+ preload: "none",
+ src: sourcePath
+ }) : /* @__PURE__ */ import_react130.default.createElement(import_react130.default.Fragment, null);
+};
+
+// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx
+var import_react136 = __toESM(require_react());
+
+// src/core/react/components/UI/Dropdown.tsx
+var import_react131 = __toESM(require_react());
+var Dropdown2 = (props) => {
+ const openMenu = (e5) => {
+ const offset2 = e5.target.getBoundingClientRect();
+ props.superstate.ui.openMenu(offset2, {
+ ui: props.superstate.ui,
+ editable: true,
+ value: [props.value],
+ options: props.options,
+ saveOptions: (options, value) => {
+ props.selectValue(value[0]);
+ }
+ });
};
- const handleKeyUp = () => {
- setModifier(null);
- };
- (0, import_react150.useEffect)(() => {
- document.addEventListener("keydown", handleKeyDown);
- document.addEventListener("keyup", handleKeyUp);
- return () => {
- document.removeEventListener("mousemove", handleMove);
- document.removeEventListener("mouseup", handleMoveEnd);
- document.removeEventListener("keydown", handleKeyDown);
- document.removeEventListener("keyup", handleKeyUp);
- };
- }, []);
- return /* @__PURE__ */ import_react150.default.createElement("div", {
- className: "mk-frame-draggable-handle",
- onMouseDown: handleDown,
- "data-placeholder": currentValue.current.toString(),
- style: {
- cursor: props.cursor,
- width: "100%",
- height: "100%",
- pointerEvents: "auto"
+ return /* @__PURE__ */ import_react131.default.createElement("div", {
+ className: "mk-cell-option-item",
+ onClick: (e5) => props.triggerMenu ? props.triggerMenu(e5) : openMenu(e5)
+ }, /* @__PURE__ */ import_react131.default.createElement("div", null, props.options ? props.options.find((f2) => f2.value == props.value)?.name : props.value), /* @__PURE__ */ import_react131.default.createElement("div", {
+ className: "mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//collapse-solid")
}
- }, /* @__PURE__ */ import_react150.default.createElement("span", null));
+ }));
};
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx
-var FrameCorners = (props) => {
- const match2 = props.styles.borderRadius ? props.styles.borderRadius.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null;
- const numericValue = match2 ? parseInt(match2[1]) : 0;
- const unit2 = match2 && match2[2] ? match2[2] : "px";
- const [offset2, setOffset] = import_react151.default.useState(Math.max(8, numericValue));
- (0, import_react151.useEffect)(() => {
- setOffset(numericValue);
- }, [numericValue]);
- const handleProps = {
- min: 0,
- max: Math.min(props.clientSize.height / 2, props.clientSize.width / 2),
- value: offset2,
- onDragMove: (value) => {
- setOffset(value);
+// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx
+var import_react134 = __toESM(require_react());
+
+// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx
+var import_react133 = __toESM(require_react());
+
+// src/core/react/components/SpaceEditor/Actions/BuiltinPropertyEditor.tsx
+var import_react132 = __toESM(require_react());
+var BuiltinPropertyEditor = (props) => {
+ const allOptions = (0, import_react132.useMemo)(() => {
+ const options = props.fields.map((f2) => ({
+ id: f2.name,
+ field: f2.name,
+ vType: f2.type,
+ label: f2.name,
+ defaultFilter: "is",
+ type: "property",
+ description: ""
+ }));
+ return options;
+ }, []);
+ const editFormula = (e5) => {
+ const _props = {
+ superstate: props.superstate,
+ saveFormula: (value) => props.saveTree({
+ ...props.actionTree,
+ props: {
+ ...props.actionTree.props,
+ $function: value
+ }
+ }),
+ formula: props.actionTree.props["$function"],
+ value: props.values,
+ fields: props.fields,
+ path: props.path
+ };
+ props.superstate.ui.openCustomMenu(
+ e5.target.getBoundingClientRect(),
+ /* @__PURE__ */ import_react132.default.createElement(FormulaEditor, {
+ ..._props
+ }),
+ { ..._props },
+ "bottom"
+ );
+ };
+ return props.command.schema.id == "formula" ? /* @__PURE__ */ import_react132.default.createElement("button", {
+ onClick: (e5) => editFormula(e5)
+ }, "Edit Formula") : props.command.schema.id == "filter" ? /* @__PURE__ */ import_react132.default.createElement(SpaceQuery, {
+ superstate: props.superstate,
+ filters: props.actionTree.props["$function"] ?? [],
+ setFilters: (filters) => {
+ props.saveTree({
+ ...props.actionTree,
+ props: {
+ ...props.actionTree.props,
+ $function: filters
+ }
+ });
},
- onDragEnd: (value) => {
- props.saveStyles({ borderRadius: `"${value}${unit2}"` });
- }
+ fields: allOptions,
+ sections: [],
+ removeable: true
+ }) : /* @__PURE__ */ import_react132.default.createElement(import_react132.default.Fragment, null);
+};
+
+// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx
+var ActionNode = (props) => {
+ const [action, setAction] = import_react133.default.useState(props.actionTree?.action);
+ const command = (0, import_react133.useMemo)(
+ () => props.superstate.cli.commandForAction(action),
+ [action]
+ );
+ (0, import_react133.useEffect)(() => {
+ setAction(props.actionTree?.action);
+ }, [props.actionTree]);
+ const selectAction = (e5, add4) => {
+ const options = [...allActions(props.superstate, props.path)];
+ const sections = [...new Set(options.map((f2) => f2.section))].map((f2) => ({
+ name: f2,
+ value: f2
+ }));
+ const offset2 = e5.target.getBoundingClientRect();
+ props.superstate.ui.openMenu(offset2, {
+ ui: props.superstate.ui,
+ editable: true,
+ value: [action],
+ options,
+ sections,
+ showSections: true,
+ saveOptions: (options2, value) => {
+ if (add4) {
+ props.saveTree({
+ ...props.actionTree,
+ children: [
+ ...props.actionTree.children,
+ { action: value[0], props: {}, propsValue: {}, children: [] }
+ ]
+ });
+ return;
+ }
+ props.saveTree({ ...props.actionTree, action: value[0] });
+ }
+ });
};
- const minOffset = Math.max(8, offset2);
- return /* @__PURE__ */ import_react151.default.createElement("div", {
- style: {
- position: "absolute",
- top: 0,
- left: 0,
- width: props.clientSize.width,
- height: props.clientSize.height,
- display: "flex",
- zIndex: 200,
- borderRadius: offset2,
- border: "1px solid var(--mk-ui-border-accent)"
- }
- }, /* @__PURE__ */ import_react151.default.createElement("div", {
- className: (0, import_classnames7.default)("mk-frame-corners")
- }, /* @__PURE__ */ import_react151.default.createElement("div", {
- className: "mk-frame-corner",
- style: {
- position: "absolute",
- transform: `translate(${minOffset}px, ${minOffset}px)`,
- zIndex: "var(--mk-layer-editor-overlay)"
+ const selectLinkedProp = (e5, prop2) => {
+ const options = props.fields.map((f2) => ({ name: f2.name, value: f2.name }));
+ const offset2 = e5.target.getBoundingClientRect();
+ props.superstate.ui.openMenu(offset2, {
+ ui: props.superstate.ui,
+ editable: true,
+ value: [],
+ options,
+ saveOptions: (options2, value) => {
+ props.saveTree({
+ ...props.actionTree,
+ linked: { ...props.actionTree.linked, [prop2]: value[0] }
+ });
+ }
+ });
+ };
+ return /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-editor-actions-node"
+ }, /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-editor-actions-body"
+ }, /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-editor-actions-name"
+ }, /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-path-icon",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(
+ command ? stickerForSchema(command.schema) : "ui//plus"
+ )
}
- }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- cursor: "nwse-resize",
- reverseY: true
- })), /* @__PURE__ */ import_react151.default.createElement("div", {
- className: "mk-frame-corner",
- style: {
- position: "absolute",
- transform: `translate(${props.clientSize.width - minOffset}px, ${minOffset}px)`,
- zIndex: "var(--mk-layer-editor-overlay)"
+ }), /* @__PURE__ */ import_react133.default.createElement("div", {
+ onClick: (e5) => !command && selectAction(e5),
+ className: "mk-editor-actions-selector"
+ }, command?.schema.name ?? "Select"), /* @__PURE__ */ import_react133.default.createElement("span", null), props.deleteTree && /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-icon-small",
+ onClick: (e5) => props.deleteTree(),
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//close")
}
- }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- cursor: "nesw-resize",
- reverseX: true,
- reverseY: true
- })), /* @__PURE__ */ import_react151.default.createElement("div", {
- className: "mk-frame-corner",
- style: {
- position: "absolute",
- transform: `translate(${minOffset}px, ${props.clientSize.height - minOffset}px)`,
- zIndex: "var(--mk-layer-editor-overlay)"
+ })), command && /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-editor-actions-fields"
+ }, command.schema.type == "builtin" ? /* @__PURE__ */ import_react133.default.createElement(BuiltinPropertyEditor, {
+ superstate: props.superstate,
+ command,
+ actionTree: props.actionTree,
+ saveTree: props.saveTree,
+ fields: [...props.fields, props.prevField].filter((f2) => f2),
+ values: props.values,
+ path: props.path
+ }) : command?.fields.map((f2, i4) => {
+ return /* @__PURE__ */ import_react133.default.createElement(DataPropertyView, {
+ key: i4,
+ superstate: props.superstate,
+ column: f2,
+ columns: props.fields,
+ initialValue: props.actionTree.props[f2.name],
+ updateValue: (value) => {
+ const newTree = { ...props.actionTree };
+ newTree.props[f2.name] = value;
+ props.saveTree(newTree);
+ },
+ updateFieldValue: (fieldValue, value) => {
+ const newTree = { ...props.actionTree };
+ newTree.props[f2.name] = value;
+ newTree.propsValue[f2.name] = fieldValue;
+ props.saveTree(newTree);
+ },
+ editMode: 5 /* EditModeAlways */,
+ linkProp: (e5) => selectLinkedProp(e5, f2.name)
+ });
+ }))), /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: props.hasSiblings ? "mk-editor-actions-children" : ""
+ }, props.actionTree.children.map((child, i4) => /* @__PURE__ */ import_react133.default.createElement(ActionNode, {
+ key: i4,
+ hasSiblings: props.actionTree.children.length > 1,
+ prevField: command?.fields[i4],
+ superstate: props.superstate,
+ path: props.path,
+ fields: props.fields,
+ actionTree: child,
+ saveTree: (tree) => {
+ const newTree = { ...props.actionTree };
+ newTree.children[i4] = tree;
+ props.saveTree(newTree);
+ },
+ values: props.values,
+ deleteTree: () => {
+ const newTree = { ...props.actionTree };
+ newTree.children.splice(i4, 1);
+ props.saveTree(newTree);
}
- }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- cursor: "nesw-resize"
- })), /* @__PURE__ */ import_react151.default.createElement("div", {
- className: "mk-frame-corner",
- style: {
- position: "absolute",
- transform: `translate(${props.clientSize.width - minOffset}px, ${props.clientSize.height - minOffset}px)`,
- zIndex: "var(--mk-layer-editor-overlay)"
+ })), props.actionTree.children.length == 0 && /* @__PURE__ */ import_react133.default.createElement("button", {
+ onClick: (e5) => selectAction(e5, true),
+ className: "mk-inline-button"
+ }, /* @__PURE__ */ import_react133.default.createElement("div", {
+ className: "mk-icon-xsmall",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//plus")
}
- }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- reverseX: true,
- cursor: "nwse-resize"
- }))));
+ }), "Add Step")));
};
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDropZone.tsx
-var import_classnames8 = __toESM(require_classnames());
-var import_react152 = __toESM(require_react());
-var FrameDropZone = (props) => {
- const { instance, id: id3 } = (0, import_react152.useContext)(FrameInstanceContext);
- const { spaceInfo } = (0, import_react152.useContext)(SpaceContext);
- const { setNodeRef } = useDroppable({
- id: props.id + props.direction,
- data: {
- id: props.id + props.direction,
- direction: props.direction,
- type: "node",
- parent: props.parentId,
- root: id3,
- frame: props.schemaID,
- space: spaceInfo.path,
- node: props.node
- }
- });
- const offset2 = 20;
- const left = props.direction == "left" ? -offset2 : props.direction == "right" ? props.width : 0;
- const top = props.direction == "bottom" ? props.insertMode != 0 ? props.height : props.height / 2 : props.direction == "top" && props.insertMode != 0 ? -offset2 : 0;
- const width = props.direction == "left" || props.direction == "right" ? offset2 : props.width;
- const height = props.direction == "top" || props.direction == "bottom" ? props.insertMode != 0 ? offset2 : props.height / 2 : props.height;
- const indicator = props.insertMode != 0 ? props.direction == "top" ? "bottom" : props.direction == "bottom" ? "top" : props.direction : props.direction;
- return /* @__PURE__ */ import_react152.default.createElement("div", {
- ref: setNodeRef,
- className: (0, import_classnames8.default)(
- props.active ? `mk-indicator-${indicator}` : "",
- "mk-frame-drop-zone"
- ),
- style: {
- left,
- top,
- width,
- height
+// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx
+var ActionEditor = (props) => {
+ const [actionTree, setActionTree] = import_react134.default.useState(
+ parseActionString(props.formula) ?? {
+ action: "",
+ props: {},
+ propsValue: {},
+ children: []
}
- });
-};
-var FrameEditorDropZone = (props) => {
- const { frameSchema } = (0, import_react152.useContext)(FramesMDBContext);
- const { hoverNode } = (0, import_react152.useContext)(FrameInstanceContext);
- const directions2 = [
- ...props.mode == 1 /* DropModeRowColumn */ ? ["top", "bottom", "left", "right"] : props.mode == 2 /* DropModeRowOnly */ ? ["top", "bottom"] : props.mode == 3 /* DropModeColumnOnly */ ? ["left", "right"] : [],
- ...props.insertMode == 1 ? ["inside"] : []
- ];
- return /* @__PURE__ */ import_react152.default.createElement("div", {
- className: `mk-frame-drop-zone-container`,
- style: {
- width: props.width,
- height: props.height
+ );
+ return /* @__PURE__ */ import_react134.default.createElement("div", {
+ className: "mk-editor-actions-nodes"
+ }, /* @__PURE__ */ import_react134.default.createElement(ActionNode, {
+ hasSiblings: false,
+ superstate: props.superstate,
+ prevField: null,
+ actionTree,
+ path: props.path,
+ fields: props.fields,
+ values: props.value,
+ saveTree: (tree) => {
+ props.saveFormula(JSON.stringify(tree));
+ setActionTree(tree);
}
- }, directions2.map((d4) => /* @__PURE__ */ import_react152.default.createElement(FrameDropZone, {
- ...props,
- key: d4,
- active: hoverNode?.node == props.node && hoverNode?.direction == d4,
- direction: d4,
- mode: props.mode,
- schemaID: frameSchema.id
- })));
+ }));
};
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameGapHandle.tsx
-var import_react153 = __toESM(require_react());
-var reduceFlexItems = (items, container, xAxis, axisGap) => {
- const rows = {};
- let row2 = 0;
- let currentRowWidth = 0;
- const axisValue = xAxis ? "width" : "height";
- const nonAxisValue = !xAxis ? "width" : "height";
- items.forEach((f2, i4, array) => {
- if (i4 == 0) {
- rows[row2] = {
- start: i4,
- end: i4,
- maxValue: f2[nonAxisValue],
- items: [{ ...f2, row: row2 }]
- };
- currentRowWidth = f2[axisValue];
- } else if (array[i4][axisValue] + axisGap > container[axisValue]) {
- row2++;
- rows[row2] = {
- start: i4,
- end: i4,
- maxValue: f2[nonAxisValue],
- items: [{ ...f2, row: row2 }]
- };
- } else if (array[i4][axisValue] + axisGap + currentRowWidth > container[axisValue]) {
- row2++;
- rows[row2] = {
- start: i4,
- end: i4,
- maxValue: f2[nonAxisValue],
- items: [{ ...f2, row: row2 }]
- };
- currentRowWidth = f2[axisValue];
- } else {
- if (rows[row2]) {
- rows[row2] = {
- start: rows[row2].start,
- end: i4,
- maxValue: Math.max(rows[row2].maxValue, f2[nonAxisValue]),
- items: [...rows[row2].items, { ...f2, row: row2 }]
- };
- currentRowWidth += f2[axisValue] + axisGap;
- } else {
- console.log("Warning: Flexbox found orphan row");
- }
- }
+// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx
+var import_react135 = __toESM(require_react());
+
+// node_modules/@uiw/codemirror-theme-github/esm/index.js
+var defaultSettingsGithubLight = {
+ background: "#fff",
+ foreground: "#24292e",
+ selection: "#BBDFFF",
+ selectionMatch: "#BBDFFF",
+ gutterBackground: "#fff",
+ gutterForeground: "#6e7781"
+};
+var githubLightInit = (options) => {
+ var {
+ theme = "light",
+ settings = {},
+ styles: styles2 = []
+ } = options || {};
+ return createTheme({
+ theme,
+ settings: _extends({}, defaultSettingsGithubLight, settings),
+ styles: [{
+ tag: [tags2.standard(tags2.tagName), tags2.tagName],
+ color: "#116329"
+ }, {
+ tag: [tags2.comment, tags2.bracket],
+ color: "#6a737d"
+ }, {
+ tag: [tags2.className, tags2.propertyName],
+ color: "#6f42c1"
+ }, {
+ tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator],
+ color: "#005cc5"
+ }, {
+ tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName],
+ color: "#d73a49"
+ }, {
+ tag: [tags2.string, tags2.meta, tags2.regexp],
+ color: "#032f62"
+ }, {
+ tag: [tags2.name, tags2.quote],
+ color: "#22863a"
+ }, {
+ tag: [tags2.heading, tags2.strong],
+ color: "#24292e",
+ fontWeight: "bold"
+ }, {
+ tag: [tags2.emphasis],
+ color: "#24292e",
+ fontStyle: "italic"
+ }, {
+ tag: [tags2.deleted],
+ color: "#b31d28",
+ backgroundColor: "ffeef0"
+ }, {
+ tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)],
+ color: "#e36209"
+ }, {
+ tag: [tags2.url, tags2.escape, tags2.regexp, tags2.link],
+ color: "#032f62"
+ }, {
+ tag: tags2.link,
+ textDecoration: "underline"
+ }, {
+ tag: tags2.strikethrough,
+ textDecoration: "line-through"
+ }, {
+ tag: tags2.invalid,
+ color: "#cb2431"
+ }, ...styles2]
});
- return rows;
};
-var FrameGapHandle = (props) => {
- const calculateOffset = (value) => {
- const match2 = value ? value.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null;
- const numericValue = match2 ? parseInt(match2[1]) : 0;
- return numericValue;
- };
- const [offset2, setOffset] = import_react153.default.useState({
- row: calculateOffset(props.styles["rowGap"]),
- column: calculateOffset(props.styles["columnGap"])
+var githubLight = githubLightInit();
+var defaultSettingsGithubDark = {
+ background: "#0d1117",
+ foreground: "#c9d1d9",
+ caret: "#c9d1d9",
+ selection: "#003d73",
+ selectionMatch: "#003d73",
+ lineHighlight: "#36334280"
+};
+var githubDarkInit = (options) => {
+ var {
+ theme = "dark",
+ settings = {},
+ styles: styles2 = []
+ } = options || {};
+ return createTheme({
+ theme,
+ settings: _extends({}, defaultSettingsGithubDark, settings),
+ styles: [{
+ tag: [tags2.standard(tags2.tagName), tags2.tagName],
+ color: "#7ee787"
+ }, {
+ tag: [tags2.comment, tags2.bracket],
+ color: "#8b949e"
+ }, {
+ tag: [tags2.className, tags2.propertyName],
+ color: "#d2a8ff"
+ }, {
+ tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator],
+ color: "#79c0ff"
+ }, {
+ tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName],
+ color: "#ff7b72"
+ }, {
+ tag: [tags2.string, tags2.meta, tags2.regexp],
+ color: "#a5d6ff"
+ }, {
+ tag: [tags2.name, tags2.quote],
+ color: "#7ee787"
+ }, {
+ tag: [tags2.heading, tags2.strong],
+ color: "#d2a8ff",
+ fontWeight: "bold"
+ }, {
+ tag: [tags2.emphasis],
+ color: "#d2a8ff",
+ fontStyle: "italic"
+ }, {
+ tag: [tags2.deleted],
+ color: "#ffdcd7",
+ backgroundColor: "ffeef0"
+ }, {
+ tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)],
+ color: "#ffab70"
+ }, {
+ tag: tags2.link,
+ textDecoration: "underline"
+ }, {
+ tag: tags2.strikethrough,
+ textDecoration: "line-through"
+ }, {
+ tag: tags2.invalid,
+ color: "#f97583"
+ }, ...styles2]
});
- (0, import_react153.useEffect)(() => {
- setOffset({
- row: calculateOffset(props.styles["rowGap"]),
- column: calculateOffset(props.styles["columnGap"])
+};
+var githubDark = githubDarkInit();
+
+// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx
+var ScriptEditor = (props) => {
+ const { command } = props;
+ const value = (0, import_react135.useMemo)(() => {
+ if (!command)
+ return "";
+ return `const ${command.schema.id} = (${command.fields.map((f2) => `${f2.name}: ${f2.type}`).join(", ")}, $api: API, $contexts) => {
+${command.code}
+}`;
+ }, [command]);
+ const saveCommand = (value2) => {
+ props.saveCommand({
+ ...command,
+ code: value2.split("\n").slice(1, -1).join("\n"),
+ codeType: "script"
});
- }, [props.styles]);
- const handleProps = {
- value: offset2[props.direction],
- onDragMove: (value) => {
- setOffset({
- ...offset2,
- [props.direction == "column" ? "row" : "column"]: value
- });
- },
- onDragEnd: (value) => {
- props.saveStyles(
- props.direction == "column" ? {
- rowGap: `"${value}px"`
- } : {
- columnGap: `"${value}px"`
- }
+ };
+ return /* @__PURE__ */ import_react135.default.createElement("div", null, /* @__PURE__ */ import_react135.default.createElement(esm_default, {
+ className: "mk-editor-code",
+ value,
+ height: "100%",
+ theme: githubDark,
+ extensions: [javascript({ jsx: true })],
+ onChange: saveCommand
+ }), /* @__PURE__ */ import_react135.default.createElement(ActionTester, {
+ type: "script",
+ code: command.code,
+ fields: command.fields,
+ value: {},
+ superstate: props.superstate,
+ path: props.path
+ }));
+};
+
+// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx
+var SpaceCommand = (props) => {
+ const [command, setCommand] = (0, import_react136.useState)(null);
+ const uri = (0, import_react136.useMemo)(() => {
+ return props.superstate.spaceManager.uriByString(props.action);
+ }, [props.action]);
+ const saveCommand = (command2) => {
+ setCommand(command2);
+ if (uri.authority == "$actions") {
+ props.superstate.spaceManager.saveSystemCommand(
+ uri.path.split("/").pop(),
+ command2
);
+ return;
}
+ props.superstate.spaceManager.saveCommand(
+ uri.path,
+ command2.schema.id,
+ () => command2
+ );
};
- const offAxisHandleProps = {
- value: offset2[props.direction == "column" ? "row" : "column"],
- onDragMove: (value) => {
- setOffset({
- ...offset2,
- [props.direction]: value
- });
- },
- onDragEnd: (value) => {
- props.saveStyles(
- props.direction == "column" ? {
- columnGap: `"${value}px"`
- } : {
- rowGap: `"${value}px"`
- }
+ (0, import_react136.useEffect)(() => {
+ setCommand(props.superstate.cli.commandForAction(props.action));
+ }, [props.action]);
+ (0, import_react136.useEffect)(() => {
+ const listener = (f2) => {
+ if (f2.path == uri.basePath)
+ setCommand(props.superstate.cli.commandForAction(props.action));
+ };
+ props.superstate.eventsDispatcher.addListener(
+ "actionStateUpdated",
+ listener
+ );
+ return () => {
+ props.superstate.eventsDispatcher.removeListener(
+ "actionStateUpdated",
+ listener
);
- }
+ };
+ });
+ const saveField = (source, field) => {
+ saveCommand({
+ ...command,
+ fields: [...command.fields, field]
+ });
};
- const rows = (0, import_react153.useMemo)(
- () => reduceFlexItems(
- props.childSizes,
- {
- width: props.clientSize.width - props.clientSize.paddingLeft - props.clientSize.paddingRight,
- height: props.clientSize.height - props.clientSize.paddingTop - props.clientSize.paddingBottom
- },
- props.direction == "row",
- offset2[props.direction == "column" ? "row" : "column"]
- ),
- [props.childSizes, props.clientSize, props.direction, offset2]
- );
- const items = (0, import_react153.useMemo)(() => {
- const items2 = [];
- Object.keys(rows).forEach((f2) => {
- items2.push(...rows[f2].items);
+ const deleteProperty2 = (field) => {
+ saveCommand({
+ ...command,
+ fields: command.fields.filter((f2) => f2.name != field.name)
});
- return items2;
- }, [rows]);
- return /* @__PURE__ */ import_react153.default.createElement("div", {
- className: `mk-frame-gaps ${parseStylesToClass(props.styles)}`,
- style: {
- position: "absolute",
- top: 0,
- left: 0,
- width: props.clientSize.width,
- height: props.clientSize.height,
- padding: props.clientSize.paddingTop,
- paddingLeft: props.clientSize.paddingLeft,
- paddingBottom: props.clientSize.paddingBottom,
- paddingRight: props.clientSize.paddingRight,
- flexWrap: props.styles.flexWrap
- }
- }, props.direction === "row" ? items.map((f2, i4, array) => /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null, /* @__PURE__ */ import_react153.default.createElement("div", {
- style: { width: f2.width, height: f2.height }
- }), i4 == array.length - 1 ? /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react153.default.createElement("div", {
- key: i4,
- className: "mk-frame-gap-handle-h",
- style: {
- width: "100%",
- height: Math.max(8, Math.abs(offset2["row"])),
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, {
- ...offAxisHandleProps,
- cursor: "col-resize",
- disableX: true,
- reverseY: true
- })) : /* @__PURE__ */ import_react153.default.createElement("div", {
- key: i4,
- className: "mk-frame-gap-handle-v",
- style: {
- width: Math.max(8, Math.abs(offset2["column"])),
- height: rows[f2.row].maxValue,
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- cursor: "col-resize",
- disableY: true
- })))) : items.map((f2, i4, array) => /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null, /* @__PURE__ */ import_react153.default.createElement("div", {
- style: { width: f2.width, height: f2.height }
- }), i4 == array.length - 1 ? /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react153.default.createElement("div", {
- key: i4,
- className: "mk-frame-gap-handle-v",
- style: {
- height: "100%",
- width: Math.max(8, Math.abs(offset2["column"])),
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, {
- ...offAxisHandleProps,
- cursor: "col-resize",
- disableX: true,
- reverseY: true
- })) : /* @__PURE__ */ import_react153.default.createElement("div", {
- key: i4,
- className: "mk-frame-gap-handle-h",
- style: {
- height: Math.max(8, Math.abs(offset2["row"])),
- width: rows[f2.row].maxValue,
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- cursor: "row-resize",
- disableX: true,
- reverseY: true
- })))));
-};
-
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FramePaddingHandle.tsx
-var import_classnames9 = __toESM(require_classnames());
-var import_react154 = __toESM(require_react());
-var FramePadding = (props) => {
- const paddingTypes = [
- "padding",
- "paddingTop",
- "paddingBottom",
- "paddingLeft",
- "paddingRight"
- ];
- const [offset2, setOffset] = import_react154.default.useState({
- padding: 0,
- paddingTop: null,
- paddingBottom: null,
- paddingLeft: null,
- paddingRight: null
- });
- const unit2 = "px";
- (0, import_react154.useEffect)(() => {
- const getNumericValue = (type) => {
- if (!props.styles[type])
- return null;
- const match2 = props.styles[type] ? props.styles[type].match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null;
- const numericValue = Math.max(match2 ? parseInt(match2[1]) : 0, 8);
- return numericValue;
- };
- setOffset((p2) => {
- return paddingTypes.reduce((a4, c3) => {
- return {
- ...a4,
- [c3]: getNumericValue(c3)
- };
- }, p2);
+ };
+ const updateField = (newField, oldField) => {
+ saveCommand({
+ ...command,
+ fields: command.fields.map((f2) => {
+ if (f2.name == oldField.name) {
+ return newField;
+ }
+ return f2;
+ })
});
- }, [props.styles]);
- const [shiftModifier, setShiftModifier] = import_react154.default.useState(false);
- const handleProps = {
- min: 0,
- mod: 2
};
- const inset = (type) => Math.max(5, offset2[type] ?? offset2.padding);
- const setNewOffset = (type, value, modifiers) => {
- setOffset(
- (p2) => modifiers.shiftKey ? {
- padding: value,
- paddingBottom: null,
- paddingTop: null,
- paddingLeft: null,
- paddingRight: null
- } : { ...p2, [type]: value }
+ const newProperty = (e5) => {
+ const offset2 = e5.target.getBoundingClientRect();
+ showNewPropertyMenu(
+ props.superstate,
+ offset2,
+ [],
+ [],
+ saveField,
+ command.schema.id,
+ null,
+ true,
+ true
);
};
- const saveValue = (type, value, modifiers) => {
- props.saveStyles(
- modifiers.shiftKey ? {
- padding: `'${value}${unit2}'`,
- paddingBottom: "",
- paddingTop: "",
- paddingLeft: "",
- paddingRight: ""
- } : { [type]: `'${value}${unit2}'` }
+ const menuItems = [
+ { name: "Actions", value: "actions" },
+ { name: "Script", value: "script" },
+ { name: "Formula", value: "formula" }
+ ];
+ const defaultValueForField = (field) => {
+ const parsedValue = parseFieldValue(field.value, field.type);
+ if (parsedValue) {
+ return parsedValue?.default;
+ }
+ };
+ const saveDefaultValueForField = (field, value) => {
+ const parsedValue = parseFieldValue(field.value, field.type) ?? {};
+ parsedValue.default = value;
+ updateField(
+ {
+ ...field,
+ value: JSON.stringify(parsedValue)
+ },
+ field
);
};
- (0, import_react154.useEffect)(() => {
- const handleKeyDown = (e5) => {
- if (e5.key === "Shift") {
- setShiftModifier(true);
+ const defaultValues = (0, import_react136.useMemo)(() => {
+ return command?.fields.reduce((p, c3) => {
+ return { ...p, [c3.name]: defaultValueForField(c3) };
+ }, {}) ?? {};
+ }, [command?.fields]);
+ return /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-editor-actions"
+ }, command && /* @__PURE__ */ import_react136.default.createElement(import_react136.default.Fragment, null, /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-props-contexts"
+ }, /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-path-context-row"
+ }, /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-path-context-field"
+ }, "Type"), /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-path-context-value"
+ }, /* @__PURE__ */ import_react136.default.createElement(Dropdown2, {
+ superstate: props.superstate,
+ options: menuItems,
+ value: command.schema.type,
+ selectValue: (value) => saveCommand({
+ ...command,
+ schema: {
+ ...command.schema,
+ type: value
}
- };
- const handleKeyUp = (e5) => {
- if (e5.key === "Shift") {
- setShiftModifier(false);
+ })
+ }))), /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-path-context-row"
+ }, /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-path-context-field"
+ }, "Properties")), /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-cell-object"
+ }, command.fields.map((f2) => {
+ return /* @__PURE__ */ import_react136.default.createElement(DataPropertyView, {
+ key: f2.name,
+ superstate: props.superstate,
+ initialValue: defaultValueForField(f2),
+ column: f2,
+ editMode: 5 /* EditModeAlways */,
+ updateValue: (value) => {
+ saveDefaultValueForField(f2, value);
+ },
+ updateFieldValue: (fieldValue, value) => {
+ saveCommand({
+ ...command,
+ fields: command.fields.map((g) => {
+ if (f2.name == g.name) {
+ return {
+ ...g,
+ value: fieldValue
+ };
+ }
+ return g;
+ })
+ });
+ },
+ propertyMenu: (e5) => {
+ const offset2 = e5.target.getBoundingClientRect();
+ showPropertyMenu({
+ superstate: props.superstate,
+ rect: offset2,
+ editable: true,
+ options: [],
+ field: f2,
+ fields: command.fields,
+ contextPath: null,
+ saveField: (newField) => updateField(newField, f2),
+ deleteColumn: deleteProperty2
+ });
}
- };
- window.addEventListener("keydown", handleKeyDown);
- window.addEventListener("keyup", handleKeyUp);
- return () => {
- window.removeEventListener("keydown", handleKeyDown);
- window.removeEventListener("keyup", handleKeyUp);
- };
- }, []);
- return /* @__PURE__ */ import_react154.default.createElement("div", {
- style: {
- position: "absolute",
- top: 0,
- left: 0,
- width: props.clientSize.width,
- height: props.clientSize.height,
- display: "flex",
- zIndex: 200,
- border: "1px solid var(--mk-ui-color-border-accent)"
- }
- }, /* @__PURE__ */ import_react154.default.createElement("div", {
- className: (0, import_classnames9.default)(
- "mk-frame-paddings",
- shiftModifier && "mk-modifier-shift"
- )
- }, /* @__PURE__ */ import_react154.default.createElement("div", {
- className: "mk-frame-padding-handle-h",
- style: {
- position: "absolute",
- transform: `translate(${0}px, ${0}px)`,
- height: inset("paddingTop"),
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- value: offset2["paddingTop"] ?? offset2.padding,
- cursor: "s-resize",
- max: props.clientSize.height,
- onDragMove: (value, modifiers) => {
- setNewOffset("paddingTop", value, modifiers);
- },
- onDragEnd: (value, modifiers) => {
- saveValue("paddingTop", value, modifiers);
- },
- reverseY: true,
- disableX: true
- })), /* @__PURE__ */ import_react154.default.createElement("div", {
- className: "mk-frame-padding-handle-v",
- style: {
- position: "absolute",
- transform: `translate(${props.clientSize.width - inset("paddingRight")}px, ${0}px)`,
- width: inset("paddingRight"),
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- value: offset2["paddingRight"] ?? offset2.padding,
- cursor: "w-resize",
- onDragMove: (value, modifiers) => {
- setNewOffset("paddingRight", value, modifiers);
- },
- max: props.clientSize.width,
- onDragEnd: (value, modifiers) => {
- saveValue("paddingRight", value, modifiers);
- },
- reverseX: true,
- reverseY: true,
- disableY: true
- })), /* @__PURE__ */ import_react154.default.createElement("div", {
- className: "mk-frame-padding-handle-v",
- style: {
- position: "absolute",
- transform: `translate(${0}px, ${0}px)`,
- width: inset("paddingLeft"),
- zIndex: "var(--mk-layer-editor-overlay)"
+ });
+ })), /* @__PURE__ */ import_react136.default.createElement("button", {
+ className: "mk-inline-button",
+ onClick: (e5) => newProperty(e5)
+ }, /* @__PURE__ */ import_react136.default.createElement("div", {
+ className: "mk-icon-xsmall",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//plus")
}
- }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- value: offset2["paddingLeft"] ?? offset2.padding,
- cursor: "e-resize",
- max: props.clientSize.width,
- onDragMove: (value, modifiers) => {
- setNewOffset("paddingLeft", value, modifiers);
- },
- onDragEnd: (value, modifiers) => {
- saveValue("paddingLeft", value, modifiers);
+ }), i18n_default.labels.newProperty)), command.schema.type == "script" ? /* @__PURE__ */ import_react136.default.createElement(ScriptEditor, {
+ superstate: props.superstate,
+ command,
+ saveCommand,
+ values: defaultValues,
+ path: uri.path
+ }) : command.schema.type == "actions" ? /* @__PURE__ */ import_react136.default.createElement(ActionEditor, {
+ superstate: props.superstate,
+ formula: command.code,
+ path: uri.path,
+ saveOutputType: (outputType) => {
+ saveCommand({
+ ...command,
+ codeType: outputType
+ });
},
- disableY: true
- })), /* @__PURE__ */ import_react154.default.createElement("div", {
- className: "mk-frame-padding-handle-h",
- style: {
- position: "absolute",
- transform: `translate(${0}px, ${props.clientSize.height - inset("paddingBottom")}px)`,
- height: inset("paddingBottom"),
- zIndex: "var(--mk-layer-editor-overlay)"
- }
- }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, {
- ...handleProps,
- value: offset2["paddingBottom"] ?? offset2.padding,
- cursor: "n-resize",
- max: props.clientSize.height,
- onDragMove: (value, modifiers) => {
- setNewOffset("paddingBottom", value, modifiers);
+ saveFormula: (formula) => {
+ saveCommand({
+ ...command,
+ code: formula
+ });
},
- onDragEnd: (value, modifiers) => {
- saveValue("paddingBottom", value, modifiers);
+ fields: command.fields,
+ value: defaultValues
+ }) : command.schema.type == "formula" ? /* @__PURE__ */ import_react136.default.createElement(FormulaEditor, {
+ superstate: props.superstate,
+ formula: command.code,
+ saveFormula: (formula) => {
+ saveCommand({
+ ...command,
+ code: formula
+ });
},
- reverseX: true,
- disableX: true
- }))));
+ fields: command.fields,
+ value: defaultValues,
+ path: uri.path
+ }) : /* @__PURE__ */ import_react136.default.createElement("div", null)));
};
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx
-var import_classnames10 = __toESM(require_classnames());
+// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx
+var import_react138 = __toESM(require_react());
-// node_modules/re-resizable/lib/index.js
-var React152 = __toESM(require_react());
-var import_react_dom10 = __toESM(require_react_dom());
+// src/core/react/components/SpaceView/Frames/ViewNodes/FrameInstance.tsx
+var import_react137 = __toESM(require_react());
+var FrameInstanceView = (props) => {
+ const { saveState, instance } = (0, import_react137.useContext)(FrameInstanceContext);
+ return instance.exec && /* @__PURE__ */ import_react137.default.createElement(FrameView, {
+ superstate: props.superstate,
+ treeNode: instance.exec,
+ instance,
+ saveState,
+ source: props.source
+ }, props.children);
+};
-// node_modules/re-resizable/lib/resizer.js
-var React151 = __toESM(require_react());
-var __extends = function() {
- var extendStatics = function(d4, b2) {
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) {
- d5.__proto__ = b3;
- } || function(d5, b3) {
- for (var p2 in b3)
- if (Object.prototype.hasOwnProperty.call(b3, p2))
- d5[p2] = b3[p2];
- };
- return extendStatics(d4, b2);
- };
- return function(d4, b2) {
- extendStatics(d4, b2);
- function __() {
- this.constructor = d4;
+// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx
+var SpaceFragmentViewComponent = (props) => {
+ const path2 = (0, import_react138.useMemo)(
+ () => props.superstate.spaceManager.uriByString(props.path, props.source),
+ [props.path, props.source]
+ );
+ const [spaceFragment, setSpaceFragment] = (0, import_react138.useState)(null);
+ (0, import_react138.useEffect)(() => {
+ if (path2.refType == "context") {
+ setSpaceFragment({
+ type: "context",
+ path: path2.basePath,
+ contextSchema: path2.ref,
+ frameSchema: path2.query?.frameSchema
+ });
+ } else if (path2.refType == "frame") {
+ let schema = props.superstate.framesIndex.get(path2.basePath)?.schemas.find((f2) => f2.id == path2.ref);
+ if (!schema && path2.ref == defaultFrameListViewSchema.id) {
+ schema = defaultFrameListViewSchema;
+ setSpaceFragment({
+ type: "context",
+ path: path2.basePath,
+ frameSchema: schema.id
+ });
+ }
+ if (schema?.type == "view") {
+ setSpaceFragment({
+ type: "context",
+ path: path2.basePath,
+ frameSchema: path2.ref
+ });
+ } else {
+ setSpaceFragment({
+ type: "frame",
+ path: path2.basePath,
+ frameSchema: path2.ref
+ });
+ }
+ } else if (path2.refType == "action") {
+ setSpaceFragment({
+ type: "action",
+ path: path2.basePath,
+ actionSchema: path2.ref
+ });
+ } else {
+ setSpaceFragment({
+ type: "context",
+ path: path2.basePath,
+ frameSchema: defaultFrameListViewID
+ });
}
- d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
+ }, [path2]);
+ return /* @__PURE__ */ import_react138.default.createElement(import_react138.default.Fragment, null, spaceFragment?.path && (spaceFragment?.type == "context" ? /* @__PURE__ */ import_react138.default.createElement(PathProvider, {
+ superstate: props.superstate,
+ path: spaceFragment.path,
+ readMode: false
+ }, /* @__PURE__ */ import_react138.default.createElement(SpaceProvider, {
+ superstate: props.superstate
+ }, /* @__PURE__ */ import_react138.default.createElement(FramesMDBProvider, {
+ superstate: props.superstate,
+ contextSchema: spaceFragment.contextSchema,
+ schema: spaceFragment.frameSchema
+ }, /* @__PURE__ */ import_react138.default.createElement(ContextEditorProvider, {
+ superstate: props.superstate
+ }, /* @__PURE__ */ import_react138.default.createElement(ContextListContainer, {
+ superstate: props.superstate,
+ minMode: props.minMode,
+ containerRef: props.containerRef,
+ setView: props.setFrameSchema
+ }))))) : spaceFragment?.type == "frame" ? /* @__PURE__ */ import_react138.default.createElement(FrameRootProvider, {
+ superstate: props.superstate,
+ path: path2,
+ cols: []
+ }, /* @__PURE__ */ import_react138.default.createElement(FrameInstanceProvider, {
+ id: props.id,
+ superstate: props.superstate,
+ props: {},
+ editable: false
+ }, /* @__PURE__ */ import_react138.default.createElement(FrameInstanceView, {
+ superstate: props.superstate,
+ source: props.source
+ }))) : spaceFragment?.type == "action" ? /* @__PURE__ */ import_react138.default.createElement(SpaceCommand, {
+ superstate: props.superstate,
+ action: props.path
+ }) : /* @__PURE__ */ import_react138.default.createElement(import_react138.default.Fragment, null)));
+};
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/ContextNodeView.tsx
+var import_react139 = __toESM(require_react());
+var ContextNodeView = (props) => {
+ const fullPath = props.state?.props?.value;
+ const { updateNode } = (0, import_react139.useContext)(FramesEditorRootContext);
+ const { id: id3 } = (0, import_react139.useContext)(FrameInstanceContext);
+ const selectLink = (e5) => {
+ showSpacesMenu(
+ e5,
+ props.superstate,
+ (link) => updateNode(props.treeNode.node, {
+ props: {
+ ...props.treeNode.node.props,
+ value: wrapQuotes(link + "#^" + defaultContextSchemaID)
+ }
+ })
+ );
};
-}();
-var __assign2 = function() {
- __assign2 = Object.assign || function(t5) {
- for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
- s4 = arguments[i4];
- for (var p2 in s4)
- if (Object.prototype.hasOwnProperty.call(s4, p2))
- t5[p2] = s4[p2];
+ const setFrameSchema = (schema) => {
+ if (props.treeNode.node.props.value == "$contexts['$space']['space']") {
+ updateNode(props.treeNode.node, {
+ props: {
+ ...props.treeNode.node.props,
+ value: `$contexts['$space']['space']+"/#*${schema}"`
+ }
+ });
+ return;
}
- return t5;
+ updateNode(props.treeNode.node, {
+ props: {
+ ...props.treeNode.node.props,
+ value: wrapQuotes(
+ contextPathFromPath(
+ props.superstate,
+ props.superstate.spaceManager.resolvePath(fullPath, props.source)
+ )?.space + "#*" + schema
+ )
+ }
+ });
};
- return __assign2.apply(this, arguments);
-};
-var rowSizeBase = {
- width: "100%",
- height: "10px",
- top: "0px",
- left: "0px",
- cursor: "row-resize"
-};
-var colSizeBase = {
- width: "10px",
- height: "100%",
- top: "0px",
- left: "0px",
- cursor: "col-resize"
-};
-var edgeBase = {
- width: "20px",
- height: "20px",
- position: "absolute"
-};
-var styles = {
- top: __assign2(__assign2({}, rowSizeBase), { top: "-5px" }),
- right: __assign2(__assign2({}, colSizeBase), { left: void 0, right: "-5px" }),
- bottom: __assign2(__assign2({}, rowSizeBase), { top: void 0, bottom: "-5px" }),
- left: __assign2(__assign2({}, colSizeBase), { left: "-5px" }),
- topRight: __assign2(__assign2({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
- bottomRight: __assign2(__assign2({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
- bottomLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
- topLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" })
+ return props.state && fullPath ? /* @__PURE__ */ import_react139.default.createElement(SpaceFragmentViewComponent, {
+ id: id3,
+ source: props.source,
+ superstate: props.superstate,
+ path: fullPath,
+ minMode: props.state?.styles?.["--mk-min-mode"],
+ containerRef: props.containerRef,
+ setFrameSchema
+ }) : /* @__PURE__ */ import_react139.default.createElement("div", {
+ className: "mk-frame-placeholder",
+ onClick: (e5) => selectLink(e5)
+ }, i18n_default.labels.selectSpace);
};
-var Resizer = function(_super) {
- __extends(Resizer2, _super);
- function Resizer2() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.onMouseDown = function(e5) {
- _this.props.onResizeStart(e5, _this.props.direction);
- };
- _this.onTouchStart = function(e5) {
- _this.props.onResizeStart(e5, _this.props.direction);
- };
- return _this;
- }
- Resizer2.prototype.render = function() {
- return React151.createElement("div", { className: this.props.className || "", style: __assign2(__assign2({ position: "absolute", userSelect: "none" }, styles[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children);
- };
- return Resizer2;
-}(React151.PureComponent);
-// node_modules/re-resizable/lib/index.js
-var __extends2 = function() {
- var extendStatics = function(d4, b2) {
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) {
- d5.__proto__ = b3;
- } || function(d5, b3) {
- for (var p2 in b3)
- if (Object.prototype.hasOwnProperty.call(b3, p2))
- d5[p2] = b3[p2];
- };
- return extendStatics(d4, b2);
- };
- return function(d4, b2) {
- extendStatics(d4, b2);
- function __() {
- this.constructor = d4;
+// src/core/react/components/SpaceView/Frames/EditorNodes/IconNodeView.tsx
+var import_react140 = __toESM(require_react());
+var IconNodeView = (props) => {
+ const {
+ selectionMode,
+ selected: frameSelected,
+ selection: selection2
+ } = (0, import_react140.useContext)(FrameSelectionContext);
+ const { updateNode, nodes } = (0, import_react140.useContext)(FramesEditorRootContext);
+ const updateValue2 = (newValue) => {
+ if (newValue != props.state.props?.value) {
+ if (props.treeNode.editorProps?.linkedNode) {
+ const node = nodes.find(
+ (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
+ );
+ updateNode(node, {
+ props: {
+ ...node.props,
+ [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
+ }
+ });
+ } else {
+ updateNode(props.treeNode.node, {
+ props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
+ });
+ }
}
- d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
};
-}();
-var __assign3 = function() {
- __assign3 = Object.assign || function(t5) {
- for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
- s4 = arguments[i4];
- for (var p2 in s4)
- if (Object.prototype.hasOwnProperty.call(s4, p2))
- t5[p2] = s4[p2];
+ const selected = selection2?.includes(props.treeNode.node.id);
+ const editable = (0, import_react140.useMemo)(() => {
+ if (selectionMode == 0 /* Read */)
+ return false;
+ if (selectionMode == 1 /* Page */)
+ return true;
+ if (selectionMode == 3 /* Group */ && selected)
+ return true;
+ if (props.treeNode.isRef) {
+ if (props.treeNode.editorProps.linkedNode && frameSelected)
+ return true;
+ return false;
}
- return t5;
+ return true;
+ }, [props.treeNode, selectionMode, frameSelected, selected]);
+ const selectIcon = () => {
+ props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react140.default.createElement(StickerModal_default, {
+ ui: props.superstate.ui,
+ hide: _props.hide,
+ selectedSticker: (emoji) => updateValue2(emoji)
+ }));
};
- return __assign3.apply(this, arguments);
-};
-var DEFAULT_SIZE = {
- width: "auto",
- height: "auto"
-};
-var clamp2 = function(n3, min5, max5) {
- return Math.max(Math.min(n3, max5), min5);
-};
-var snap = function(n3, size2) {
- return Math.round(n3 / size2) * size2;
-};
-var hasDirection = function(dir, target) {
- return new RegExp(dir, "i").test(target);
-};
-var isTouchEvent2 = function(event) {
- return Boolean(event.touches && event.touches.length);
-};
-var isMouseEvent = function(event) {
- return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0));
-};
-var findClosestSnap = function(n3, snapArray, snapGap) {
- if (snapGap === void 0) {
- snapGap = 0;
- }
- 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;
-};
-var getStringSize = function(n3) {
- n3 = n3.toString();
- if (n3 === "auto") {
- return n3;
- }
- if (n3.endsWith("px")) {
- return n3;
- }
- if (n3.endsWith("%")) {
- return n3;
- }
- if (n3.endsWith("vh")) {
- return n3;
- }
- if (n3.endsWith("vw")) {
- return n3;
- }
- if (n3.endsWith("vmax")) {
- return n3;
- }
- if (n3.endsWith("vmin")) {
- return n3;
- }
- return n3 + "px";
-};
-var getPixelSize = function(size2, parentSize, innerWidth2, innerHeight2) {
- if (size2 && typeof size2 === "string") {
- if (size2.endsWith("px")) {
- return Number(size2.replace("px", ""));
- }
- if (size2.endsWith("%")) {
- var ratio = Number(size2.replace("%", "")) / 100;
- return parentSize * ratio;
- }
- if (size2.endsWith("vw")) {
- var ratio = Number(size2.replace("vw", "")) / 100;
- return innerWidth2 * ratio;
+ const [stickerType, stickerPath] = props.state.props?.value ? parseStickerString(props.state.props?.value) : [null, null];
+ return props.state && (props.state.props?.value?.length > 0 ? stickerType == "image" ? /* @__PURE__ */ import_react140.default.createElement("img", {
+ className: "mk-frame-icon",
+ src: props.superstate.ui.getUIPath(
+ props.superstate.imagesCache.get(stickerPath)
+ )
+ }) : /* @__PURE__ */ import_react140.default.createElement("div", {
+ className: "mk-frame-icon",
+ style: {},
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(props.state.props?.value)
}
- if (size2.endsWith("vh")) {
- var ratio = Number(size2.replace("vh", "")) / 100;
- return innerHeight2 * ratio;
+ }) : editable ? /* @__PURE__ */ import_react140.default.createElement("div", {
+ onClick: () => selectIcon(),
+ "aria-label": "Select Sticker",
+ className: "mk-node-icon-placeholder",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//smile")
}
- }
- return size2;
+ }) : /* @__PURE__ */ import_react140.default.createElement(import_react140.default.Fragment, null));
};
-var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) {
- maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2);
- maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2);
- minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2);
- minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2);
- return {
- maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth),
- maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight),
- minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth),
- minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight)
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/ImageNodeView.tsx
+var import_react141 = __toESM(require_react());
+var ImageNodeView = (props) => {
+ const value = props.state.props.value;
+ const sourcePath = (0, import_react141.useMemo)(() => {
+ return props.superstate.ui.getUIPath(value, true);
+ }, [value]);
+ const { nodes, updateNode } = (0, import_react141.useContext)(FramesEditorRootContext);
+ const { linkedProps } = (0, import_react141.useContext)(FrameInstanceContext);
+ const {
+ selectionMode,
+ selected: frameSelected,
+ selection: selection2
+ } = (0, import_react141.useContext)(FrameSelectionContext);
+ const selected = selection2?.includes(props.treeNode.node.id);
+ const showModal2 = () => {
+ if (!stringIsConst(props.treeNode.node.props.value) && !linkedProps.some(
+ (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2
+ ))
+ return;
+ props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react141.default.createElement(ImageModal_default, {
+ superstate: props.superstate,
+ hide: _props.hide,
+ selectedPath: (image) => saveValue(image)
+ }));
};
-};
-var definedProps = [
- "as",
- "style",
- "className",
- "grid",
- "snap",
- "bounds",
- "boundsByDirection",
- "size",
- "defaultSize",
- "minWidth",
- "minHeight",
- "maxWidth",
- "maxHeight",
- "lockAspectRatio",
- "lockAspectRatioExtraWidth",
- "lockAspectRatioExtraHeight",
- "enable",
- "handleStyles",
- "handleClasses",
- "handleWrapperStyle",
- "handleWrapperClass",
- "children",
- "onResizeStart",
- "onResize",
- "onResizeStop",
- "handleComponent",
- "scale",
- "resizeRatio",
- "snapGap"
-];
-var baseClassName = "__resizable_base__";
-var Resizable = function(_super) {
- __extends2(Resizable2, _super);
- function Resizable2(props) {
- var _this = _super.call(this, props) || this;
- _this.ratio = 1;
- _this.resizable = null;
- _this.parentLeft = 0;
- _this.parentTop = 0;
- _this.resizableLeft = 0;
- _this.resizableRight = 0;
- _this.resizableTop = 0;
- _this.resizableBottom = 0;
- _this.targetLeft = 0;
- _this.targetTop = 0;
- _this.appendBase = function() {
- if (!_this.resizable || !_this.window) {
- return null;
- }
- var parent = _this.parentNode;
- if (!parent) {
- return null;
- }
- var element3 = _this.window.document.createElement("div");
- element3.style.width = "100%";
- element3.style.height = "100%";
- element3.style.position = "absolute";
- element3.style.transform = "scale(0, 0)";
- element3.style.left = "0";
- element3.style.flex = "0 0 100%";
- if (element3.classList) {
- element3.classList.add(baseClassName);
+ const saveValue = (newValue) => {
+ if (newValue != props.state.props?.value) {
+ if (props.treeNode.editorProps?.linkedNode) {
+ const node = nodes.find(
+ (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
+ );
+ updateNode(node, {
+ props: {
+ ...node.props,
+ [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
+ }
+ });
} else {
- element3.className += baseClassName;
- }
- parent.appendChild(element3);
- return element3;
- };
- _this.removeBase = function(base3) {
- var parent = _this.parentNode;
- if (!parent) {
- return;
- }
- parent.removeChild(base3);
- };
- _this.ref = function(c3) {
- if (c3) {
- _this.resizable = c3;
- }
- };
- _this.state = {
- isResizing: false,
- width: typeof (_this.propsSize && _this.propsSize.width) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.width,
- height: typeof (_this.propsSize && _this.propsSize.height) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.height,
- direction: "right",
- original: {
- x: 0,
- y: 0,
- width: 0,
- height: 0
- },
- backgroundStyle: {
- height: "100%",
- width: "100%",
- backgroundColor: "rgba(0,0,0,0)",
- cursor: "auto",
- opacity: 0,
- position: "fixed",
- zIndex: 9999,
- top: "0",
- left: "0",
- bottom: "0",
- right: "0"
- },
- flexBasis: void 0
- };
- _this.onResizeStart = _this.onResizeStart.bind(_this);
- _this.onMouseMove = _this.onMouseMove.bind(_this);
- _this.onMouseUp = _this.onMouseUp.bind(_this);
- return _this;
- }
- Object.defineProperty(Resizable2.prototype, "parentNode", {
- get: function() {
- if (!this.resizable) {
- return null;
+ updateNode(props.treeNode.node, {
+ props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
+ });
}
- return this.resizable.parentNode;
+ }
+ };
+ const editable = (0, import_react141.useMemo)(() => {
+ if (selectionMode == 0 /* Read */)
+ return false;
+ if (selectionMode == 1 /* Page */)
+ return true;
+ if (selectionMode == 3 /* Group */ && selected)
+ return true;
+ if (props.treeNode.isRef) {
+ if (props.treeNode.editorProps.linkedNode && frameSelected)
+ return true;
+ return false;
+ }
+ return true;
+ }, [props.treeNode, selectionMode, frameSelected, selected]);
+ return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react141.default.createElement("img", {
+ className: "mk-node-image",
+ width: props.state?.styles.width,
+ height: props.state?.styles.height,
+ style: {
+ borderRadius: props.state?.styles.borderRadius,
+ maxHeight: props.state?.styles.maxHeight
},
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Resizable2.prototype, "window", {
- get: function() {
- if (!this.resizable) {
- return null;
- }
- if (!this.resizable.ownerDocument) {
- return null;
- }
- return this.resizable.ownerDocument.defaultView;
+ src: sourcePath
+ }) : editable ? /* @__PURE__ */ import_react141.default.createElement("div", {
+ className: "mk-node-image-placeholder",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getPlaceholderImage("image-select")
},
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Resizable2.prototype, "propsSize", {
- get: function() {
- return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
+ style: {
+ borderRadius: props.state?.styles.borderRadius,
+ maxHeight: props.state?.styles.maxHeight
},
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Resizable2.prototype, "size", {
- get: function() {
- var width = 0;
- var height = 0;
- if (this.resizable && this.window) {
- var orgWidth = this.resizable.offsetWidth;
- var orgHeight = this.resizable.offsetHeight;
- var orgPosition = this.resizable.style.position;
- if (orgPosition !== "relative") {
- this.resizable.style.position = "relative";
+ onClick: (e5) => showModal2()
+ }) : /* @__PURE__ */ import_react141.default.createElement(import_react141.default.Fragment, null);
+};
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/InputNodeView.tsx
+var import_react142 = __toESM(require_react());
+var InputNodeView = (props) => {
+ const { selectionMode } = (0, import_react142.useContext)(FrameSelectionContext);
+ const { saveState, instance } = (0, import_react142.useContext)(FrameInstanceContext);
+ const [value, setValue] = (0, import_react142.useState)("");
+ const state = props.state;
+ const type = props.state.styles?.as;
+ (0, import_react142.useEffect)(() => {
+ const linkedNode = parseLinkedNode(props.state?.props?.value);
+ if (linkedNode) {
+ const node = linkedNode.node == "$root" ? instance.exec.id : linkedNode.node;
+ setValue(instance.state?.[node]?.props?.[linkedNode.prop]);
+ }
+ }, [props.state.props]);
+ return /* @__PURE__ */ import_react142.default.createElement("input", {
+ className: "mk-node-input",
+ type,
+ value: type == "checkbox" ? null : value,
+ checked: value == "true",
+ onKeyDown: (e5) => {
+ e5.stopPropagation();
+ if (e5.key == "Enter") {
+ const _value = type == "text" ? e5.currentTarget.value : type == "checkbox" ? (!e5.currentTarget.checked).toString() : e5.currentTarget.value;
+ setValue("");
+ if (typeof state.actions?.onEnter == "function") {
+ state.actions?.onEnter(
+ e5,
+ _value,
+ instance.state,
+ (s4) => saveState(s4, instance),
+ props.superstate.api
+ );
}
- width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth;
- height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight;
- this.resizable.style.position = orgPosition;
}
- return { width, height };
},
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Resizable2.prototype, "sizeStyle", {
- get: function() {
- var _this = this;
- var size2 = this.props.size;
- var getSize = function(key3) {
- if (typeof _this.state[key3] === "undefined" || _this.state[key3] === "auto") {
- return "auto";
- }
- if (_this.propsSize && _this.propsSize[key3] && _this.propsSize[key3].toString().endsWith("%")) {
- if (_this.state[key3].toString().endsWith("%")) {
- return _this.state[key3].toString();
- }
- var parentSize = _this.getParentSize();
- var value = Number(_this.state[key3].toString().replace("px", ""));
- var percent = value / parentSize[key3] * 100;
- return percent + "%";
- }
- return getStringSize(_this.state[key3]);
- };
- var width = size2 && typeof size2.width !== "undefined" && !this.state.isResizing ? getStringSize(size2.width) : getSize("width");
- var height = size2 && typeof size2.height !== "undefined" && !this.state.isResizing ? getStringSize(size2.height) : getSize("height");
- return { width, height };
+ onChange: (e5) => {
+ const _value = type == "text" ? e5.target.value : type == "checkbox" ? (!e5.target.checked).toString() : e5.target.value;
+ setValue(_value);
+ if (typeof state.actions?.onChange == "function") {
+ state.actions?.onChange(
+ e5,
+ _value,
+ instance.state,
+ (s4) => saveState(s4, instance),
+ props.superstate.api
+ );
+ }
},
- enumerable: false,
- configurable: true
+ placeholder: state.styles.placeholder,
+ style: {
+ ...state?.styles
+ }
});
- Resizable2.prototype.getParentSize = function() {
- if (!this.parentNode) {
- if (!this.window) {
- return { width: 0, height: 0 };
+};
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx
+var import_react146 = __toESM(require_react());
+
+// src/core/react/hooks/useEffectOnce.ts
+var import_react143 = __toESM(require_react());
+function useEffectOnce(cb) {
+ (0, import_react143.useEffect)(cb, []);
+}
+
+// src/core/react/hooks/useEventListener.ts
+var import_react144 = __toESM(require_react());
+function useEventListener(eventType, callback, element = window) {
+ const callbackRef = (0, import_react144.useRef)(callback);
+ (0, import_react144.useEffect)(() => {
+ callbackRef.current = callback;
+ }, [callback]);
+ (0, import_react144.useEffect)(() => {
+ if (element == null)
+ return;
+ const handler = (e5) => callbackRef.current(e5);
+ element.addEventListener(eventType, handler);
+ return () => element.removeEventListener(eventType, handler);
+ }, [eventType, element]);
+}
+
+// src/core/react/hooks/useTimeout.tsx
+var import_react145 = __toESM(require_react());
+function useTimeout(callback, delay) {
+ const callbackRef = (0, import_react145.useRef)(callback);
+ const timeoutRef = (0, import_react145.useRef)(null);
+ (0, import_react145.useEffect)(() => {
+ callbackRef.current = callback;
+ }, [callback]);
+ const set = (0, import_react145.useCallback)(() => {
+ timeoutRef.current = setTimeout(() => callbackRef.current(), delay);
+ }, [delay]);
+ const clear = (0, import_react145.useCallback)(() => {
+ timeoutRef.current && clearTimeout(timeoutRef.current);
+ }, []);
+ (0, import_react145.useEffect)(() => {
+ set();
+ return clear;
+ }, [delay, set, clear]);
+ const reset2 = (0, import_react145.useCallback)(() => {
+ clear();
+ set();
+ }, [clear, set]);
+ return { reset: reset2, clear };
+}
+
+// src/core/react/hooks/useLongPress.tsx
+function useLongPress(ref2, cb, { delay = 400 } = {}) {
+ const { reset: reset2, clear } = useTimeout(cb, delay);
+ useEffectOnce(clear);
+ useEventListener("mousedown", reset2, ref2.current);
+ useEventListener("touchstart", reset2, ref2.current);
+ useEventListener("mouseup", clear, ref2.current);
+ useEventListener("mouseleave", clear, ref2.current);
+ useEventListener("touchend", clear, ref2.current);
+}
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx
+var TextNodeView = (props) => {
+ const {
+ selectionMode,
+ selection: selection2,
+ selectable,
+ selected: frameSelected,
+ select
+ } = (0, import_react146.useContext)(FrameSelectionContext);
+ const fileNameRef = (0, import_react146.useRef)(null);
+ const { updateNode, nodes, deleteNode } = (0, import_react146.useContext)(FramesEditorRootContext);
+ const updateValue2 = (newValue) => {
+ if (newValue != props.state.props?.value) {
+ if (props.treeNode.editorProps?.linkedNode) {
+ const node = nodes.find(
+ (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
+ );
+ updateNode(node, {
+ props: {
+ ...node.props,
+ [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
+ }
+ });
+ } else {
+ updateNode(props.treeNode.node, {
+ props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
+ });
}
- return { width: this.window.innerWidth, height: this.window.innerHeight };
}
- var base3 = this.appendBase();
- if (!base3) {
- return { width: 0, height: 0 };
+ };
+ const onBlur = (e5) => {
+ const newValue = e5.target.innerHTML;
+ updateValue2(newValue);
+ };
+ const onKeyPress = (e5) => {
+ e5.stopPropagation();
+ };
+ const onKeyUp = (e5) => {
+ e5.stopPropagation();
+ };
+ const onKeyDown = (e5) => {
+ e5.stopPropagation();
+ if (e5.key == "Delete" || e5.key == "Backspace") {
+ if (e5.target.innerHTML == "")
+ deleteNode(props.treeNode.node);
}
- var wrapChanged = false;
- var wrap3 = this.parentNode.style.flexWrap;
- if (wrap3 !== "wrap") {
- wrapChanged = true;
- this.parentNode.style.flexWrap = "wrap";
+ if (e5.key == "a" && e5.metaKey) {
+ e5.preventDefault();
+ const selection3 = window.getSelection();
+ const range2 = document.createRange();
+ range2.selectNodeContents(e5.target);
+ selection3.removeAllRanges();
+ selection3.addRange(range2);
}
- base3.style.position = "relative";
- base3.style.minWidth = "100%";
- base3.style.minHeight = "100%";
- var size2 = {
- width: base3.offsetWidth,
- height: base3.offsetHeight
- };
- if (wrapChanged) {
- this.parentNode.style.flexWrap = wrap3;
+ if (e5.key == "Enter") {
+ e5.target.blur();
+ e5.preventDefault();
+ }
+ if (e5.key == "Escape") {
+ e5.target.blur();
+ e5.preventDefault();
}
- this.removeBase(base3);
- return size2;
};
- Resizable2.prototype.bindEvents = function() {
- if (this.window) {
- this.window.addEventListener("mouseup", this.onMouseUp);
- this.window.addEventListener("mousemove", this.onMouseMove);
- this.window.addEventListener("mouseleave", this.onMouseUp);
- this.window.addEventListener("touchmove", this.onMouseMove, {
- capture: true,
- passive: false
- });
- this.window.addEventListener("touchend", this.onMouseUp);
+ const onClick = (e5) => {
+ if (editable) {
+ e5.stopPropagation();
}
};
- Resizable2.prototype.unbindEvents = function() {
- if (this.window) {
- this.window.removeEventListener("mouseup", this.onMouseUp);
- this.window.removeEventListener("mousemove", this.onMouseMove);
- this.window.removeEventListener("mouseleave", this.onMouseUp);
- this.window.removeEventListener("touchmove", this.onMouseMove, true);
- this.window.removeEventListener("touchend", this.onMouseUp);
+ const onMouseDown = (e5) => {
+ if (editable)
+ e5.stopPropagation();
+ if (selectionMode == 3 /* Group */ && !props.treeNode.isRef) {
+ select(props.treeNode.id);
}
};
- Resizable2.prototype.componentDidMount = function() {
- if (!this.resizable || !this.window) {
+ const onLongPress = () => {
+ if (editable) {
+ select(props.treeNode.node.id, false);
return;
}
- var computedStyle = this.window.getComputedStyle(this.resizable);
- this.setState({
- width: this.state.width || this.size.width,
- height: this.state.height || this.size.height,
- flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0
- });
};
- Resizable2.prototype.componentWillUnmount = function() {
- if (this.window) {
- this.unbindEvents();
+ useLongPress(fileNameRef, onLongPress);
+ const selected = selection2.includes(props.treeNode.id);
+ const { linkedProps } = (0, import_react146.useContext)(FrameInstanceContext);
+ const editable = (0, import_react146.useMemo)(() => {
+ if (selectionMode == 0 /* Read */)
+ return false;
+ if (props.treeNode.isRef) {
+ if (props.treeNode.editorProps.linkedNode && frameSelected)
+ return true;
+ return false;
}
+ if (linkedProps.some(
+ (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2
+ ))
+ return true;
+ if (!stringIsConst(props.treeNode.node.props.value))
+ return false;
+ if (selectionMode == 1 /* Page */)
+ return true;
+ if (selectionMode == 3 /* Group */ && selected)
+ return true;
+ return false;
+ }, [props.treeNode, selectionMode, frameSelected, selected, linkedProps]);
+ return props.state && /* @__PURE__ */ import_react146.default.createElement("div", {
+ className: `mk-frame-text`,
+ "data-placeholder": editable || selectable ? i18n_default.labels.textPlaceholder : "",
+ dangerouslySetInnerHTML: {
+ __html: props.state.props?.value
+ },
+ onClick,
+ onMouseDown,
+ onBlur,
+ onDrop: (e5) => e5.preventDefault(),
+ onKeyDown,
+ onKeyPress,
+ onKeyUp,
+ ref: fileNameRef,
+ contentEditable: editable
+ });
+};
+
+// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx
+var FrameView = (props) => {
+ const nodeProps = {
+ superstate: props.superstate,
+ treeNode: props.treeNode,
+ state: props.instance.state[props.treeNode.id]
};
- Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) {
- var propsSize = this.propsSize && this.propsSize[kind];
- return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize;
- };
- Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) {
- var boundsByDirection = this.props.boundsByDirection;
- var direction = this.state.direction;
- var widthByDirection = boundsByDirection && hasDirection("left", direction);
- var heightByDirection = boundsByDirection && hasDirection("top", direction);
- var boundWidth;
- var boundHeight;
- if (this.props.bounds === "parent") {
- var parent_1 = this.parentNode;
- if (parent_1) {
- boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
- boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop);
+ const innerComponents = props.treeNode.node.type == "input" ? /* @__PURE__ */ import_react147.default.createElement(InputNodeView, {
+ ...nodeProps
+ }) : props.treeNode.node.type == "text" ? /* @__PURE__ */ import_react147.default.createElement(TextNodeView, {
+ ...nodeProps
+ }) : props.treeNode.node.type == "icon" ? /* @__PURE__ */ import_react147.default.createElement(IconNodeView, {
+ ...nodeProps
+ }) : props.treeNode.node.type == "audio" ? /* @__PURE__ */ import_react147.default.createElement(AudioNodeView, {
+ ...nodeProps
+ }) : props.treeNode.node.type == "image" ? /* @__PURE__ */ import_react147.default.createElement(ImageNodeView, {
+ ...nodeProps
+ }) : props.treeNode.node.type == "space" ? /* @__PURE__ */ import_react147.default.createElement(ContextNodeView, {
+ ...nodeProps,
+ source: props.source
+ }) : props.treeNode.node.type == "content" ? /* @__PURE__ */ import_react147.default.createElement(ContentNodeView, null, props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react147.default.createElement(FrameView, {
+ superstate: props.superstate,
+ key: i4,
+ treeNode: c3,
+ instance: props.instance,
+ saveState: props.saveState,
+ source: props.source
+ }, props.children)), props.children) : props.treeNode.node.type == "flow" ? /* @__PURE__ */ import_react147.default.createElement(FlowNodeView, {
+ ...nodeProps,
+ source: props.source
+ }) : props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react147.default.createElement(FrameView, {
+ superstate: props.superstate,
+ key: i4,
+ treeNode: c3,
+ instance: props.instance,
+ saveState: props.saveState,
+ source: props.source
+ }, props.children));
+ const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false;
+ return props.instance.state[props.treeNode.id] && !hidden && /* @__PURE__ */ import_react147.default.createElement("div", {
+ className: `mk-frame ${parseStylesToClass(
+ props.instance.state[props.treeNode.id]?.styles
+ )}`,
+ "data-path": props.treeNode.id,
+ "data-type": props.treeNode.node.type,
+ onContextMenu: (e5) => {
+ if (typeof props.instance.state[props.treeNode.id].actions?.onContextMenu == "function") {
+ props.instance.state[props.treeNode.id].actions?.onContextMenu(
+ e5,
+ null,
+ props.instance.state,
+ (s4) => props.saveState(s4, props.instance),
+ props.superstate.api
+ );
+ e5.stopPropagation();
}
- } else if (this.props.bounds === "window") {
- if (this.window) {
- boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
- boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
+ },
+ onClick: (e5) => {
+ if (e5.detail === 1) {
+ if (typeof props.instance.state[props.treeNode.id].actions?.onClick == "function") {
+ props.instance.state[props.treeNode.id].actions?.onClick(
+ e5,
+ null,
+ props.instance.state,
+ (s4) => props.saveState(s4, props.instance),
+ props.superstate.api
+ );
+ e5.stopPropagation();
+ }
+ } else if (e5.detail === 2) {
+ if (typeof props.instance.state[props.treeNode.id].actions?.onDoubleClick == "function") {
+ props.instance.state[props.treeNode.id].actions?.onDoubleClick(
+ e5,
+ null,
+ props.instance.state,
+ (s4) => props.saveState(s4, props.instance),
+ props.superstate.api
+ );
+ e5.stopPropagation();
+ }
}
- } else if (this.props.bounds) {
- boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
- boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
+ },
+ style: {
+ ...defaultFrameStyles,
+ ...props.instance.state[props.treeNode.id]?.styles
}
- if (boundWidth && Number.isFinite(boundWidth)) {
- maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
+ }, innerComponents);
+};
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/NewNodeView.tsx
+var import_react148 = __toESM(require_react());
+var NewNodeView = (props) => {
+ const ref2 = import_react148.default.createRef();
+ const { spaceState } = (0, import_react148.useContext)(SpaceContext);
+ const {
+ updateNode,
+ nodes,
+ deleteNode,
+ addNode,
+ saveNodes,
+ lastCreatedId,
+ setLastCreatedId
+ } = (0, import_react148.useContext)(FramesEditorRootContext);
+ const { selection: selection2, select } = (0, import_react148.useContext)(FrameSelectionContext);
+ const [type, setType] = (0, import_react148.useState)("label");
+ const { instance } = (0, import_react148.useContext)(FrameInstanceContext);
+ const spaces2 = [...props.superstate.allSpaces(true)].filter((f2) => f2.type != "default").map((f2) => ({
+ name: f2.name,
+ value: f2.path,
+ icon: props.superstate.pathsIndex.get(f2.path)?.label?.sticker,
+ description: f2.type == "tag" ? f2.name : f2.type == "folder" ? f2.path : f2.name
+ }));
+ const paths = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden).filter((f2) => f2.type == "space" || f2.subtype == "md").map((f2) => ({
+ name: f2.displayName,
+ value: f2.path,
+ description: f2.path,
+ section: "flow",
+ icon: f2.label?.sticker
+ }));
+ const fuseOptions = {
+ minMatchCharLength: 1,
+ threshold: 0,
+ keys: ["name", "value"]
+ };
+ const [query, setQuery] = (0, import_react148.useState)("");
+ const suggestions = (0, import_react148.useMemo)(() => {
+ const menuOptions = [];
+ const label = {
+ name: i18n_default.frames.label.label,
+ description: query,
+ icon: "ui//baseline",
+ section: "label",
+ value: ""
+ };
+ menuOptions.push(label);
+ const note = {
+ name: i18n_default.frames.note.label,
+ description: query,
+ icon: "ui//file-text",
+ value: "",
+ section: "flow"
+ };
+ menuOptions.push(note);
+ const kit = [
+ {
+ name: i18n_default.frames.table.label,
+ description: i18n_default.frames.table.description,
+ icon: "ui//table",
+ section: "list",
+ value: ""
+ },
+ ...[contextNode, dividerNode, iconNode, imageNode, groupNode].map(
+ (f2) => ({
+ name: f2.node.name,
+ value: f2,
+ icon: f2.def?.icon,
+ section: "base",
+ description: f2.def?.description
+ })
+ ),
+ ...[
+ buttonNode,
+ ratingNode,
+ callout,
+ toggleNode,
+ progressNode,
+ circularProgressNode,
+ tabsNode
+ ].map((f2) => ({
+ name: f2.node.name,
+ value: f2,
+ icon: f2.def?.icon,
+ section: "kit",
+ description: f2.def?.description
+ }))
+ ];
+ const fuse = new Fuse(kit, fuseOptions);
+ const kitOptions = query.length == 0 ? kit : fuse.search(query).map((result) => result.item).slice(0, 10);
+ if (kitOptions.length > 0) {
+ menuOptions.push(menuSection("Kit"));
}
- if (boundHeight && Number.isFinite(boundHeight)) {
- maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
+ menuOptions.push(...kitOptions);
+ if (query.length > 0) {
+ const fuse2 = new Fuse([...paths], fuseOptions);
+ const options = query.length == 0 ? [] : fuse2.search(query).map((result) => result.item).slice(0, 10);
+ if (options.length > 0)
+ menuOptions.push(menuSection("Paths"));
+ menuOptions.push(...options);
}
- return { maxWidth, maxHeight };
- };
- Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) {
- var scale = this.props.scale || 1;
- var resizeRatio = this.props.resizeRatio || 1;
- var _a = this.state, direction = _a.direction, original = _a.original;
- var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
- var newWidth = original.width;
- var newHeight = original.height;
- var extraHeight = lockAspectRatioExtraHeight || 0;
- var extraWidth = lockAspectRatioExtraWidth || 0;
- if (hasDirection("right", direction)) {
- newWidth = original.width + (clientX - original.x) * resizeRatio / scale;
- if (lockAspectRatio) {
- newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
- }
+ return menuOptions;
+ }, [query, type]);
+ const selectOption = (option) => {
+ if (!props.treeNode) {
+ clear();
}
- if (hasDirection("left", direction)) {
- newWidth = original.width - (clientX - original.x) * resizeRatio / scale;
- if (lockAspectRatio) {
- newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
+ if (option.section == "kit" || option.section == "base") {
+ if (props.treeNode) {
+ let node = relinkProps(
+ "$root",
+ props.treeNode.node.schemaId,
+ option.value.node,
+ props.treeNode.node.schemaId
+ );
+ node = relinkProps(
+ node.id,
+ props.treeNode.node.id,
+ node,
+ props.treeNode.node.schemaId
+ );
+ saveNodes([
+ {
+ ...node,
+ type: option.section == "base" ? node.type : "frame",
+ styles: option.value.node.styles,
+ ref: option.section == "base" ? "" : "spaces://$kit/#*" + option.value.def.id,
+ parentId: props.treeNode.node.parentId,
+ schemaId: props.treeNode.node.schemaId,
+ id: props.treeNode.node.id,
+ rank: props.treeNode.node.rank
+ }
+ ]).then((f2) => select(props.treeNode.id));
+ } else {
+ addNode(
+ option.section == "base" ? option.value.node : {
+ ...option.value.node,
+ type: "frame",
+ styles: option.value.node.styles,
+ ref: "spaces://$kit/#*" + option.value.def.id
+ },
+ instance.exec.node,
+ true
+ ).then((f2) => select(f2.id));
}
- }
- if (hasDirection("bottom", direction)) {
- newHeight = original.height + (clientY - original.y) * resizeRatio / scale;
- if (lockAspectRatio) {
- newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
+ } else if (option.section == "label") {
+ if (props.treeNode) {
+ saveNodes([
+ {
+ ...props.treeNode.node,
+ type: "text",
+ name: textNode.node.name,
+ props: {
+ ...props.treeNode.node.props,
+ value: wrapQuotes(query)
+ },
+ styles: textNode.node.styles
+ }
+ ]).then((f2) => select(props.treeNode.id));
+ } else {
+ addNode(
+ {
+ ...textNode.node,
+ props: {
+ value: wrapQuotes(query)
+ }
+ },
+ instance.exec.node,
+ true
+ ).then((f2) => select(f2.id));
+ }
+ } else if (option.section == "flow") {
+ if (option.value.length > 0) {
+ if (props.treeNode) {
+ saveNodes([
+ {
+ ...props.treeNode.node,
+ type: "flow",
+ name: flowNode.node.name,
+ props: {
+ ...props.treeNode.node.props,
+ value: wrapQuotes(option.value)
+ },
+ styles: flowNode.node.styles
+ }
+ ]);
+ } else {
+ addNode(
+ {
+ ...flowNode.node,
+ props: {
+ value: wrapQuotes(option.value)
+ }
+ },
+ instance.exec.node,
+ true
+ );
+ }
+ } else {
+ newPathInSpace(props.superstate, spaceState, "md", query, true).then(
+ (f2) => {
+ if (props.treeNode) {
+ saveNodes([
+ {
+ ...props.treeNode.node,
+ name: flowNode.node.name,
+ type: "flow",
+ props: {
+ value: wrapQuotes(f2)
+ },
+ styles: {
+ ...flowNode.node.styles
+ }
+ }
+ ]);
+ } else {
+ addNode(
+ {
+ ...flowNode.node,
+ props: {
+ value: wrapQuotes(f2)
+ }
+ },
+ instance.exec.node,
+ true
+ );
+ }
+ }
+ );
}
+ } else if (option.section == "list") {
+ createInlineTable(props.superstate, spaceState.path).then((f2) => {
+ if (props.treeNode) {
+ saveNodes([
+ {
+ ...props.treeNode.node,
+ name: contextNode.node.name,
+ type: "space",
+ props: { value: wrapQuotes(`${spaceState.path}/#*${f2}`) },
+ styles: {
+ ...contextNode.node.styles
+ }
+ }
+ ]);
+ } else {
+ addNode(
+ {
+ ...textNode.node,
+ name: contextNode.node.name,
+ type: "space",
+ props: { value: wrapQuotes(`${spaceState.path}/#^${f2}`) }
+ },
+ instance.exec.node,
+ true
+ );
+ }
+ });
}
- if (hasDirection("top", direction)) {
- newHeight = original.height - (clientY - original.y) * resizeRatio / scale;
- if (lockAspectRatio) {
- newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
+ };
+ const clear = () => {
+ setQuery("");
+ ref2.current.blur();
+ ref2.current.innerHTML = "";
+ };
+ (0, import_react148.useEffect)(() => {
+ if (ref2.current && lastCreatedId && lastCreatedId == props.treeNode?.node.id) {
+ ref2.current.focus();
+ setLastCreatedId(null);
+ }
+ }, [ref2, selection2, props.treeNode]);
+ return /* @__PURE__ */ import_react148.default.createElement("div", {
+ className: "mk-node-new"
+ }, /* @__PURE__ */ import_react148.default.createElement(Suggester, {
+ superstate: props.superstate,
+ placeholder: i18n_default.hintText.newFrame,
+ suggestions,
+ onChange: (query2) => setQuery(query2),
+ onSelect: (option) => {
+ selectOption(option);
+ },
+ onFocus: () => {
+ select(null);
+ },
+ ref: ref2,
+ onDelete: () => props.treeNode ? deleteNode(props.treeNode?.node) : clear(),
+ onSelectSection: (option) => setType(option)
+ }));
+};
+
+// src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx
+var defaultFrameStyles = {
+ position: "relative"
+};
+var FrameEditorInner = (0, import_react149.memo)(function FrameEditorInner2(props) {
+ const nodeProps = {
+ superstate: props.superstate,
+ treeNode: props.treeNode,
+ state: props.state
+ };
+ const { treeNode } = props;
+ const { pathState } = (0, import_react149.useContext)(PathContext);
+ const { instance } = (0, import_react149.useContext)(FrameInstanceContext);
+ return /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, treeNode.node.type == "new" ? /* @__PURE__ */ import_react149.default.createElement(NewNodeView, {
+ ...nodeProps
+ }) : treeNode.node.type == "input" ? /* @__PURE__ */ import_react149.default.createElement(InputNodeView, {
+ ...nodeProps
+ }) : treeNode.node.type == "text" ? /* @__PURE__ */ import_react149.default.createElement(TextNodeView, {
+ ...nodeProps
+ }) : treeNode.node.type == "icon" ? /* @__PURE__ */ import_react149.default.createElement(IconNodeView, {
+ ...nodeProps
+ }) : treeNode.node.type == "audio" ? /* @__PURE__ */ import_react149.default.createElement(AudioNodeView, {
+ ...nodeProps
+ }) : treeNode.node.type == "image" ? /* @__PURE__ */ import_react149.default.createElement(ImageNodeView, {
+ ...nodeProps
+ }) : treeNode.node.type == "space" ? /* @__PURE__ */ import_react149.default.createElement(ContextNodeView, {
+ ...nodeProps,
+ containerRef: props.containerRef,
+ source: pathState.path
+ }) : treeNode.node.type == "flow" ? /* @__PURE__ */ import_react149.default.createElement(FlowNodeView, {
+ ...nodeProps,
+ source: pathState.path,
+ containerRef: props.containerRef
+ }) : treeNode.node.type == "content" ? /* @__PURE__ */ import_react149.default.createElement(ContentNodeView, {
+ editable: !props.treeNode.isRef
+ }, props.treeNode.children.map(
+ (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react149.default.createElement(FrameEditorNodeView, {
+ superstate: props.superstate,
+ key: c3.id,
+ treeNode: c3,
+ instance: props.instance,
+ containerRef: props.containerRef
+ }, props.children)
+ ), props.children) : (treeNode.node.type == "column" || treeNode.node.type == "container") && treeNode.children.length == 0 ? null : props.treeNode.id == props.instance.exec.id || treeNode.node.type == "column" || treeNode.node.type == "container" ? props.treeNode.children.map(
+ (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react149.default.createElement(FrameEditorNodeView, {
+ superstate: props.superstate,
+ key: c3.id,
+ treeNode: c3,
+ instance: props.instance,
+ containerRef: props.containerRef
+ }, props.children)
+ ) : /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement(FrameSelectionProvider, {
+ superstate: props.superstate,
+ id: treeNode.id,
+ editMode: props.editMode
+ }, treeNode.children.map(
+ (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react149.default.createElement(FrameEditorNodeView, {
+ superstate: props.superstate,
+ key: c3.id,
+ treeNode: c3,
+ instance: props.instance,
+ containerRef: props.containerRef
+ }, props.children)
+ ))));
+});
+var FrameEditorNodeView = (props) => {
+ const {
+ selectionMode,
+ selectable,
+ selected: _selected,
+ isParentToSelection,
+ select,
+ selection: selection2
+ } = (0, import_react149.useContext)(FrameSelectionContext);
+ const {
+ updateNode,
+ addNode,
+ deleteNode,
+ nodes,
+ selectedSlide
+ } = (0, import_react149.useContext)(FramesEditorRootContext);
+ const { setDragNode } = (0, import_react149.useContext)(WindowContext);
+ const { saveState, selectableNodeBounds, id: id3 } = (0, import_react149.useContext)(FrameInstanceContext);
+ const { dragActive } = (0, import_react149.useContext)(WindowContext);
+ const editMode = props.treeNode.isRef ? 0 /* Read */ : props.treeNode.id == props.instance.exec.id ? selectionMode : 3 /* Group */;
+ const selected = selection2.some((f2) => f2 == props.treeNode.id);
+ const isSelectable = selectable && !props.treeNode.isRef && !selected;
+ const state = props.instance.state[props.treeNode.id];
+ const deltas = (0, import_react149.useMemo)(
+ () => selectedSlide ? nodes.find(
+ (f2) => f2.ref == props.treeNode.id && selectedSlide == f2.parentId
+ ) ?? null : null,
+ [nodes, props.treeNode, selectedSlide]
+ );
+ const treeNode = (0, import_react149.useMemo)(
+ () => deltas ? {
+ ...props.treeNode,
+ node: {
+ ...props.treeNode.node,
+ styles: {
+ ...props.treeNode.node.styles,
+ ...deltas.styles
+ },
+ props: {
+ ...props.treeNode.node.props,
+ ...deltas.props
+ },
+ actions: {
+ ...props.treeNode.node.actions,
+ ...deltas.actions
+ }
}
+ } : props.treeNode,
+ [deltas, props.treeNode]
+ );
+ const { frameSchema } = (0, import_react149.useContext)(FramesMDBContext);
+ const dragId = id3 + frameSchema.id + props.treeNode.id;
+ const [hover, setHover] = (0, import_react149.useState)(false);
+ const [isMouseOverElement, setIsMouseOverElement] = import_react149.default.useState(false);
+ const [isMouseOverPortal, setIsMouseOverPortal] = import_react149.default.useState(false);
+ const draggable = props.treeNode.editorProps.dragMode == 1 /* DragHandle */ || (isSelectable && !isParentToSelection || selected) && props.treeNode.editorProps.dragMode != 0;
+ const {
+ attributes,
+ listeners,
+ setNodeRef: setDraggableNodeRef,
+ transform
+ } = useDraggable({
+ id: dragId,
+ data: {
+ id: dragId,
+ root: id3,
+ type: "node",
+ parent: props.treeNode.node.parentId,
+ frame: frameSchema.id,
+ node: props.treeNode.id
+ },
+ disabled: !draggable
+ });
+ const ref2 = (0, import_react149.useRef)(null);
+ const onLongPress = () => {
+ if (isSelectable && props.treeNode.id != props.instance.exec.id) {
+ select(treeNode.node.id);
+ return;
}
- return { newWidth, newHeight };
};
- Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max5, min5) {
- var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
- var computedMinWidth = typeof min5.width === "undefined" ? 10 : min5.width;
- var computedMaxWidth = typeof max5.width === "undefined" || max5.width < 0 ? newWidth : max5.width;
- var computedMinHeight = typeof min5.height === "undefined" ? 10 : min5.height;
- var computedMaxHeight = typeof max5.height === "undefined" || max5.height < 0 ? newHeight : max5.height;
- var extraHeight = lockAspectRatioExtraHeight || 0;
- var extraWidth = lockAspectRatioExtraWidth || 0;
- if (lockAspectRatio) {
- var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
- var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
- var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
- var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
- var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
- var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
- var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
- var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
- newWidth = clamp2(newWidth, lockedMinWidth, lockedMaxWidth);
- newHeight = clamp2(newHeight, lockedMinHeight, lockedMaxHeight);
- } else {
- newWidth = clamp2(newWidth, computedMinWidth, computedMaxWidth);
- newHeight = clamp2(newHeight, computedMinHeight, computedMaxHeight);
- }
- return { newWidth, newHeight };
+ const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false;
+ const nodeProps = {
+ superstate: props.superstate,
+ treeNode,
+ state
};
- Resizable2.prototype.setBoundingClientRect = function() {
- if (this.props.bounds === "parent") {
- var parent_2 = this.parentNode;
- if (parent_2) {
- var parentRect = parent_2.getBoundingClientRect();
- this.parentLeft = parentRect.left;
- this.parentTop = parentRect.top;
- }
- }
- if (this.props.bounds && typeof this.props.bounds !== "string") {
- var targetRect = this.props.bounds.getBoundingClientRect();
- this.targetLeft = targetRect.left;
- this.targetTop = targetRect.top;
- }
- if (this.resizable) {
- var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
- this.resizableLeft = left;
- this.resizableRight = right;
- this.resizableTop = top_1;
- this.resizableBottom = bottom;
- }
+ const saveStyles = (size2) => {
+ updateNode(treeNode.node, {
+ styles: { ...size2 }
+ });
};
- Resizable2.prototype.onResizeStart = function(event, direction) {
- if (!this.resizable || !this.window) {
+ const onClick = (e5) => {
+ if (isSelectable && (selectionMode != 1 /* Page */ || isParentToSelection && props.treeNode.id != props.instance.exec.id)) {
+ if (e5.shiftKey) {
+ select(treeNode.node.id, true);
+ } else {
+ select(treeNode.node.id);
+ }
+ e5.stopPropagation();
return;
+ } else if (props.treeNode.id == props.instance.exec.id) {
+ select(null);
}
- var clientX = 0;
- var clientY = 0;
- if (event.nativeEvent && isMouseEvent(event.nativeEvent)) {
- clientX = event.nativeEvent.clientX;
- clientY = event.nativeEvent.clientY;
- } else if (event.nativeEvent && isTouchEvent2(event.nativeEvent)) {
- clientX = event.nativeEvent.touches[0].clientX;
- clientY = event.nativeEvent.touches[0].clientY;
- }
- if (this.props.onResizeStart) {
- if (this.resizable) {
- var startResize = this.props.onResizeStart(event, direction, this.resizable);
- if (startResize === false) {
- return;
+ if (!selected) {
+ if (e5.detail === 1) {
+ if (typeof state.actions?.onClick == "function") {
+ state.actions?.onClick(
+ e5,
+ null,
+ props.instance.state,
+ (s4) => saveState(s4, props.instance),
+ props.superstate.api
+ );
+ e5.stopPropagation();
+ }
+ } else if (e5.detail === 2 || isTouchScreen(props.superstate.ui)) {
+ if (typeof state.actions?.onDoubleClick == "function") {
+ state.actions?.onDoubleClick(
+ e5,
+ null,
+ props.instance.state,
+ (s4) => saveState(s4, props.instance),
+ props.superstate.api
+ );
+ e5.stopPropagation();
}
}
+ } else {
+ e5.stopPropagation();
}
- if (this.props.size) {
- if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) {
- this.setState({ height: this.props.size.height });
- }
- if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) {
- this.setState({ width: this.props.size.width });
- }
- }
- this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
- var flexBasis;
- var computedStyle = this.window.getComputedStyle(this.resizable);
- if (computedStyle.flexBasis !== "auto") {
- var parent_3 = this.parentNode;
- if (parent_3) {
- var dir = this.window.getComputedStyle(parent_3).flexDirection;
- this.flexDir = dir.startsWith("row") ? "row" : "column";
- flexBasis = computedStyle.flexBasis;
- }
- }
- this.setBoundingClientRect();
- this.bindEvents();
- var state = {
- original: {
- x: clientX,
- y: clientY,
- width: this.size.width,
- height: this.size.height
- },
- isResizing: true,
- backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }),
- direction,
- flexBasis
- };
- this.setState(state);
};
- Resizable2.prototype.onMouseMove = function(event) {
- var _this = this;
- if (!this.state.isResizing || !this.resizable || !this.window) {
- return;
- }
- if (this.window.TouchEvent && isTouchEvent2(event)) {
- try {
- event.preventDefault();
- event.stopPropagation();
- } catch (e5) {
- }
- }
- var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
- var clientX = isTouchEvent2(event) ? event.touches[0].clientX : event.clientX;
- var clientY = isTouchEvent2(event) ? event.touches[0].clientY : event.clientY;
- var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
- var parentSize = this.getParentSize();
- var max5 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
- maxWidth = max5.maxWidth;
- maxHeight = max5.maxHeight;
- minWidth = max5.minWidth;
- minHeight = max5.minHeight;
- var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
- var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
- if (this.props.snap && this.props.snap.x) {
- newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
- }
- if (this.props.snap && this.props.snap.y) {
- newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
- }
- var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
- newWidth = newSize.newWidth;
- newHeight = newSize.newHeight;
- if (this.props.grid) {
- var newGridWidth = snap(newWidth, this.props.grid[0]);
- var newGridHeight = snap(newHeight, this.props.grid[1]);
- var gap = this.props.snapGap || 0;
- newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
- newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
- }
- var delta = {
- width: newWidth - original.width,
- height: newHeight - original.height
- };
- if (width && typeof width === "string") {
- if (width.endsWith("%")) {
- var percent = newWidth / parentSize.width * 100;
- newWidth = percent + "%";
- } else if (width.endsWith("vw")) {
- var vw = newWidth / this.window.innerWidth * 100;
- newWidth = vw + "vw";
- } else if (width.endsWith("vh")) {
- var vh = newWidth / this.window.innerHeight * 100;
- newWidth = vh + "vh";
- }
- }
- if (height && typeof height === "string") {
- if (height.endsWith("%")) {
- var percent = newHeight / parentSize.height * 100;
- newHeight = percent + "%";
- } else if (height.endsWith("vw")) {
- var vw = newHeight / this.window.innerWidth * 100;
- newHeight = vw + "vw";
- } else if (height.endsWith("vh")) {
- var vh = newHeight / this.window.innerHeight * 100;
- newHeight = vh + "vh";
+ (0, import_react149.useEffect)(() => {
+ selection2.some((f2) => f2 != props.treeNode.id) && setHover(false);
+ }, [selection2, props.treeNode]);
+ const [canEditLayout, setCanEditLayout] = (0, import_react149.useState)(false);
+ (0, import_react149.useEffect)(() => {
+ if (selected && isTouchScreen(props.superstate.ui) && (props.treeNode.node.type == "group" || props.treeNode.node.type == "image" || selectionMode >= 3 /* Group */)) {
+ setCanEditLayout(true);
+ } else {
+ if (selected && canEditLayout) {
+ } else {
+ setCanEditLayout(false);
}
}
- var newState = {
- width: this.createSizeForCssProperty(newWidth, "width"),
- height: this.createSizeForCssProperty(newHeight, "height")
+ }, [props.treeNode, selectionMode, selected]);
+ const dropMode = props.treeNode.editorProps.dropMode;
+ const computedStyle = ref2.current && getComputedStyle(ref2.current);
+ const clientWidth = ref2.current && ref2.current.clientWidth;
+ const clientHeight = ref2.current && ref2.current.clientHeight;
+ const [childNodeSizes, setChildNodeSizes] = (0, import_react149.useState)([]);
+ const calculateRectInContainer = (rect, containerRect2) => {
+ return {
+ left: rect.x - containerRect2.x,
+ top: rect.y - containerRect2.y,
+ width: rect.width,
+ height: rect.height
};
- if (this.flexDir === "row") {
- newState.flexBasis = newState.width;
- } else if (this.flexDir === "column") {
- newState.flexBasis = newState.height;
- }
- (0, import_react_dom10.flushSync)(function() {
- _this.setState(newState);
- });
- if (this.props.onResize) {
- this.props.onResize(event, direction, this.resizable, delta);
- }
};
- Resizable2.prototype.onMouseUp = function(event) {
- var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
- if (!isResizing || !this.resizable) {
- return;
- }
- var delta = {
- width: this.size.width - original.width,
- height: this.size.height - original.height
- };
- if (this.props.onResizeStop) {
- this.props.onResizeStop(event, direction, this.resizable, delta);
- }
- if (this.props.size) {
- this.setState(this.props.size);
+ (0, import_react149.useEffect)(() => {
+ if (!ref2.current || !props.containerRef?.current) {
+ return () => null;
}
- this.unbindEvents();
- this.setState({
- isResizing: false,
- backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: "auto" })
+ if (props.treeNode.node.parentId == props.instance.exec.id)
+ selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer(
+ ref2.current.getBoundingClientRect(),
+ props.containerRef.current.getBoundingClientRect()
+ );
+ setChildNodeSizes(() => {
+ const sizes = Array.from(ref2.current?.children ?? []).map(
+ (node) => {
+ return {
+ x: node.offsetLeft,
+ y: node.offsetTop,
+ width: node.clientWidth,
+ height: node.clientHeight
+ };
+ }
+ );
+ return sizes;
});
- };
- Resizable2.prototype.updateSize = function(size2) {
- this.setState({ width: size2.width, height: size2.height });
- };
- Resizable2.prototype.renderResizer = function() {
- var _this = this;
- var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
- if (!enable) {
- return null;
- }
- var resizers = Object.keys(enable).map(function(dir) {
- if (enable[dir] !== false) {
- return React152.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null);
- }
- return null;
+ const resizeObserver = new ResizeObserver(() => {
+ if (props.treeNode.node.parentId == props.instance.exec.id && ref2.current)
+ selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer(
+ ref2.current.getBoundingClientRect(),
+ props.containerRef.current.getBoundingClientRect()
+ );
+ setChildNodeSizes(() => {
+ const sizes = Array.from(ref2.current?.children ?? []).map(
+ (node) => {
+ return {
+ x: node.offsetLeft,
+ y: node.offsetTop,
+ width: node.clientWidth,
+ height: node.clientHeight
+ };
+ }
+ );
+ return sizes;
+ });
});
- return React152.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers);
+ resizeObserver.observe(ref2.current);
+ return () => resizeObserver.disconnect();
+ }, [state]);
+ const nodeRect = ref2.current?.getBoundingClientRect();
+ const containerRect = props.containerRef?.current?.getBoundingClientRect();
+ const styles2 = {
+ ...defaultFrameStyles,
+ ...props.treeNode.node.type != "flow" ? state?.styles : {
+ width: state?.styles?.width,
+ height: state?.styles?.height,
+ "--max-width": state?.styles?.["--max-width"]
+ },
+ "--translate-x": `${transform?.x ?? 0}px`,
+ "--translate-y": `${transform?.y ?? 0}px`
};
- Resizable2.prototype.render = function() {
- var _this = this;
- var extendsProps = Object.keys(this.props).reduce(function(acc, key3) {
- if (definedProps.indexOf(key3) !== -1) {
- return acc;
+ useDndMonitor({
+ onDragStart: (e5) => {
+ if (e5.active?.id == dragId) {
+ setDragNode(
+ /* @__PURE__ */ import_react149.default.createElement("div", {
+ style: {
+ width: ref2.current.clientWidth
+ }
+ }, /* @__PURE__ */ import_react149.default.createElement(FrameView, {
+ superstate: props.superstate,
+ treeNode: props.treeNode,
+ instance: props.instance,
+ saveState: null
+ }))
+ );
}
- acc[key3] = _this.props[key3];
- return acc;
- }, {});
- var style = __assign3(__assign3(__assign3({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
- if (this.state.flexBasis) {
- style.flexBasis = this.state.flexBasis;
}
- var Wrapper = this.props.as || "div";
- return React152.createElement(
- Wrapper,
- __assign3({ ref: this.ref, style, className: this.props.className }, extendsProps),
- this.state.isResizing && React152.createElement("div", { style: this.state.backgroundStyle }),
- this.props.children,
- this.renderResizer()
- );
- };
- Resizable2.defaultProps = {
- as: "div",
- onResizeStart: function() {
- },
- onResize: function() {
- },
- onResizeStop: function() {
- },
- enable: {
- top: true,
- right: true,
- bottom: true,
- left: true,
- topRight: true,
- bottomRight: true,
- bottomLeft: true,
- topLeft: true
- },
- style: {},
- grid: [1, 1],
- lockAspectRatio: false,
- lockAspectRatioExtraWidth: 0,
- lockAspectRatioExtraHeight: 0,
- scale: 1,
- resizeRatio: 1,
- snapGap: 0
- };
- return Resizable2;
-}(React152.PureComponent);
-
-// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx
-var import_react155 = __toESM(require_react());
-var FrameResizer = (props) => {
- const labelForValue = (value) => {
- if (!value)
- return null;
- if (value == "auto")
- return "Fit";
- if (value == "100%")
- return "Fill";
- return value;
- };
- const [modifiers, setModifiers] = import_react155.default.useState(null);
- const [size2, setSize2] = import_react155.default.useState({
- width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth,
- height: props.size.height
});
- import_react155.default.useEffect(() => {
- setSize2({
- width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth,
- height: props.size.height
- });
- }, [props.size, props.resizeMode]);
- (0, import_react155.useEffect)(() => {
- const captureShift = (e5) => {
- setModifiers({ shiftKey: e5.shiftKey });
- };
- props.superstate.ui.inputManager.on("keydown", captureShift);
- props.superstate.ui.inputManager.on("keyup", captureShift);
- return () => {
- props.superstate.ui.inputManager.off("keydown", captureShift);
- props.superstate.ui.inputManager.off("keyup", captureShift);
- };
- }, [setModifiers]);
- return /* @__PURE__ */ import_react155.default.createElement("div", {
- style: {
- position: "absolute",
- top: 0,
- left: 0,
- width: props.clientSize.width,
- height: props.clientSize.height
- }
- }, /* @__PURE__ */ import_react155.default.createElement(Resizable, {
- lockAspectRatio: modifiers?.shiftKey,
+ return /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, (!hidden || !props.treeNode.isRef) && /* @__PURE__ */ import_react149.default.createElement("div", {
+ ref: (el) => {
+ ref2.current = el;
+ selectionMode > 1 /* Page */ && draggable && setDraggableNodeRef(el);
+ },
+ onContextMenu: () => isTouchScreen(props.superstate.ui) && onLongPress(),
className: (0, import_classnames10.default)(
- props.resizeMode == 2 /* ResizeColumn */ ? "mk-frame-column" : "mk-frame-bounds"
+ `mk-frame-edit ${parseStylesToClass(state?.styles)}`,
+ isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable",
+ selected && selectionMode == 1 /* Page */ && "mk-selected"
),
- enable: props.resizeMode == 2 /* ResizeColumn */ ? { right: true } : {
- right: true,
- bottom: true,
- bottomRight: true
- },
- onResize: (e5, direction, ref2, d4) => {
- setSize2({
- width: ref2.clientWidth,
- height: ref2.clientHeight
- });
- },
- onResizeStop: (e5, direction, ref2, d4) => {
- const captureClick = (e6) => {
- e6.stopPropagation();
- window.removeEventListener("click", captureClick, true);
- };
- window.addEventListener("click", captureClick, true);
- props.resizeMode == 2 /* ResizeColumn */ ? props.resize({
- minWidth: `'${ref2.clientWidth}px'`
- }) : direction == "bottom" ? props.resize({
- height: `'${ref2.clientHeight}px'`
- }) : direction == "right" ? props.resize({
- width: `'${ref2.clientWidth}px'`
- }) : props.resize({
- width: `'${ref2.clientWidth}px'`,
- height: `'${ref2.clientHeight}px'`
- });
- e5.stopPropagation();
- },
- onResizeStart: (e5) => {
- e5.stopPropagation();
- },
- handleClasses: props.resizeMode == 2 /* ResizeColumn */ ? {
- right: "mk-frame-column-resize-handle"
- } : props.resizeMode == 1 /* ResizeSelected */ ? { bottomRight: "mk-frame-resize-handle" } : {},
- handleWrapperStyle: {
- pointerEvents: "auto"
- },
- size: {
- width: size2.width && size2.width != "auto" ? size2.width : "100%",
- height: size2.height && size2.height != "auto" ? size2.height : "100%"
- },
- ...props.listeners
- }), props.clientSize?.width > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react155.default.createElement("div", {
- className: "mk-frame-resize-label-width"
- }, /* @__PURE__ */ import_react155.default.createElement("div", null, /* @__PURE__ */ import_react155.default.createElement("span", null, labelForValue(size2.width) ?? i18n_default.editor.fit), size2.width && size2.width != "auto" ? /* @__PURE__ */ import_react155.default.createElement("div", {
- onClick: (e5) => {
- props.resize({
- width: wrapQuotes("auto")
- });
- e5.stopPropagation();
- },
- "aria-label": i18n_default.editor.scaleToFit,
- style: { display: "flex" },
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(
- "ui//fold-horizontal"
- )
- }
- }) : /* @__PURE__ */ import_react155.default.createElement("div", {
- onClick: (e5) => {
- props.resize({
- width: wrapQuotes("100%")
- });
- e5.stopPropagation();
- },
- "aria-label": i18n_default.editor.scaleToFill,
- style: { display: "flex" },
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(
- "ui//unfold-horizontal"
- )
- }
- }))), props.clientSize?.height > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react155.default.createElement("div", {
- className: "mk-frame-resize-label-height"
- }, /* @__PURE__ */ import_react155.default.createElement("div", null, /* @__PURE__ */ import_react155.default.createElement("span", null, labelForValue(size2.height) ?? i18n_default.editor.fit), size2.height && size2.height != "auto" ? /* @__PURE__ */ import_react155.default.createElement("div", {
- onClick: (e5) => {
- props.resize({
- height: wrapQuotes("auto")
- });
- e5.stopPropagation();
+ "data-path": treeNode.id,
+ "data-type": treeNode.node.type,
+ onMouseEnter: () => {
+ setHover(true);
+ setIsMouseOverElement(true);
},
- "aria-label": i18n_default.editor.scaleToFit,
- style: { display: "flex" },
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//fold-vertical")
- }
- }) : /* @__PURE__ */ import_react155.default.createElement("div", {
- onClick: (e5) => {
- props.resize({
- height: wrapQuotes("100%")
- });
- e5.stopPropagation();
+ onMouseLeave: () => {
+ if (!isMouseOverPortal) {
+ setHover(false);
+ }
+ setIsMouseOverElement(false);
},
- "aria-label": i18n_default.editor.scaleToFill,
- style: { display: "flex" },
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(
- "ui//unfold-vertical"
- )
- }
- }))));
-};
-
-// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx
-var import_react167 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/AudioNodeView.tsx
-var import_react156 = __toESM(require_react());
-var AudioNodeView = (props) => {
- const value = props.state.props.value;
- const sourcePath = (0, import_react156.useMemo)(() => {
- return props.superstate.ui.getUIPath(value);
- }, [value]);
- return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react156.default.createElement("audio", {
- controls: true,
- preload: "none",
- src: sourcePath
- }) : /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null);
-};
-
-// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx
-var import_react158 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Frames/ViewNodes/FrameInstance.tsx
-var import_react157 = __toESM(require_react());
-var FrameInstanceView = (props) => {
- const { saveState, instance } = (0, import_react157.useContext)(FrameInstanceContext);
- return instance.exec && /* @__PURE__ */ import_react157.default.createElement(FrameView, {
- superstate: props.superstate,
- treeNode: instance.exec,
- instance,
- saveState,
- source: props.source
- }, props.children);
+ ...{ onClick },
+ ...selectionMode > 1 /* Page */ ? { ...listeners, ...attributes } : {},
+ style: styles2
+ }, /* @__PURE__ */ import_react149.default.createElement(FrameEditorInner, {
+ ...nodeProps,
+ containerRef: props.containerRef,
+ editMode,
+ instance: props.instance
+ }, props.children)), state && props.treeNode.node.type != "new" && props.containerRef?.current && selectionMode > 0 /* Read */ && ref2.current && (0, import_react_dom11.createPortal)(
+ /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement("div", {
+ style: {
+ position: "absolute",
+ top: nodeRect.top - containerRect.top,
+ left: nodeRect.left - containerRect.left,
+ width: clientWidth,
+ height: clientHeight,
+ pointerEvents: "none"
+ },
+ className: (0, import_classnames10.default)(
+ !dragActive && isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable",
+ !dragActive && selected && (selectionMode != 1 /* Page */ || props.treeNode.node.type == "group") && "mk-f-edit",
+ !dragActive && hover && selectionMode != 1 /* Page */ && "mk-f-edit-hover"
+ ),
+ onClick: (e5) => {
+ if (isSelectable && selectionMode != 1 /* Page */) {
+ if (e5.shiftKey) {
+ select(treeNode.node.id, true);
+ } else {
+ select(treeNode.node.id);
+ }
+ e5.stopPropagation();
+ return;
+ }
+ }
+ }, props.treeNode.editorProps.resizeMode == 2 /* ResizeColumn */ && /* @__PURE__ */ import_react149.default.createElement(FrameResizer, {
+ size: state?.styles,
+ superstate: props.superstate,
+ resizeMode: props.treeNode.editorProps.resizeMode,
+ resize: saveStyles,
+ clientSize: {
+ width: clientWidth,
+ height: clientHeight
+ }
+ }), dragActive && (selectionMode == 1 /* Page */ || selectionMode == 3 /* Group */) && dropMode > 0 /* DropModeNone */ && /* @__PURE__ */ import_react149.default.createElement(FrameEditorDropZone, {
+ parentId: treeNode.node.parentId,
+ superstate: props.superstate,
+ height: clientHeight,
+ width: clientWidth,
+ node: treeNode.node.id,
+ id: dragId,
+ mode: dropMode,
+ insertMode: treeNode.node.type == "group" ? 1 : treeNode.node.type == "space" ? -1 : 0
+ }), canEditLayout && /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement(FrameResizer, {
+ superstate: props.superstate,
+ resizeMode: 1 /* ResizeSelected */,
+ size: state?.styles,
+ resize: saveStyles,
+ clientSize: {
+ width: clientWidth,
+ height: clientHeight
+ }
+ }), /* @__PURE__ */ import_react149.default.createElement(FrameCorners, {
+ styles: state?.styles,
+ saveStyles,
+ clientSize: {
+ width: clientWidth,
+ height: clientHeight
+ }
+ }), (treeNode.node.type == "group" || treeNode.node.type == "content") && (state.styles?.layout == "row" || state.styles?.layout == "column") && /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement(FrameGapHandle, {
+ childSizes: childNodeSizes,
+ clientSize: {
+ width: clientWidth,
+ height: clientHeight,
+ paddingBottom: parseInt(
+ computedStyle?.paddingBottom ?? "0"
+ ),
+ paddingLeft: parseInt(
+ computedStyle?.paddingLeft ?? "0"
+ ),
+ paddingRight: parseInt(
+ computedStyle?.paddingRight ?? "0"
+ ),
+ paddingTop: parseInt(
+ computedStyle?.paddingTop ?? "0"
+ )
+ },
+ styles: state?.styles,
+ saveStyles,
+ direction: state?.styles.layout == "column" ? "column" : "row"
+ }), /* @__PURE__ */ import_react149.default.createElement(FramePadding, {
+ clientSize: {
+ width: clientWidth,
+ height: clientHeight
+ },
+ styles: state?.styles,
+ saveStyles
+ }))), treeNode.editorProps.dragMode == 1 /* DragHandle */ && (!isTouchScreen(props.superstate.ui) || selected) ? /* @__PURE__ */ import_react149.default.createElement("div", {
+ onMouseEnter: () => {
+ setIsMouseOverPortal(true);
+ setHover(true);
+ },
+ onMouseLeave: () => {
+ if (!isMouseOverElement) {
+ setHover(false);
+ }
+ setIsMouseOverPortal(false);
+ },
+ className: "mk-editor-frame-hover-menu-container",
+ style: {
+ zIndex: hover ? "calc(var(--layer-popover) + 1)" : "var(--layer-popover)"
+ }
+ }, /* @__PURE__ */ import_react149.default.createElement(FrameHoverMenu, {
+ superstate: props.superstate,
+ node: treeNode.node,
+ mode: selectionMode == 1 /* Page */ ? 0 : 1,
+ selected,
+ visible: isTouchScreen(props.superstate.ui) || hover,
+ dragRef: setDraggableNodeRef,
+ attributes,
+ listeners
+ })) : /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null)), selection2 && !dragActive && selected && selection2.length == 1 ? /* @__PURE__ */ import_react149.default.createElement(FrameNodeEditorContainer, {
+ nodeRect,
+ containerRect
+ }, /* @__PURE__ */ import_react149.default.createElement(FrameNodeEditor, {
+ editLayout: (state2) => setCanEditLayout(state2),
+ superstate: props.superstate,
+ node: treeNode.node,
+ duplicateFrame: () => {
+ addNode(treeNode.node, treeNode.node);
+ },
+ state,
+ deleteFrame: () => deleteNode(treeNode.node),
+ fields: propertiesForNode(treeNode.node)
+ })) : selection2.length > 1 && selection2[0] == treeNode.id ? /* @__PURE__ */ import_react149.default.createElement(FrameNodeEditorContainer, {
+ nodeRect,
+ containerRect
+ }, /* @__PURE__ */ import_react149.default.createElement(FrameMultiNodeEditor, {
+ superstate: props.superstate
+ })) : null),
+ props.containerRef.current
+ ));
};
-// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx
-var SpaceFragmentViewComponent = (props) => {
- const path3 = (0, import_react158.useMemo)(
- () => props.superstate.spaceManager.uriByString(props.path, props.source),
- [props.path, props.source]
+// src/core/react/components/SpaceView/Frames/ViewNodes/FrameEditorInstance.tsx
+var FrameEditorInstance = (props) => {
+ const { spaceInfo } = (0, import_react150.useContext)(SpaceContext);
+ const { undoLastAction, redoAction, frameSchema } = (0, import_react150.useContext)(FramesMDBContext);
+ const { nodes, addNode, saveNodes, setLastCreatedId } = (0, import_react150.useContext)(
+ FramesEditorRootContext
);
- const [spaceFragment, setSpaceFragment] = (0, import_react158.useState)(null);
- (0, import_react158.useEffect)(() => {
- if (path3.refType == "context") {
- setSpaceFragment({
- type: "context",
- path: path3.basePath,
- contextSchema: path3.ref,
- frameSchema: path3.query?.frameSchema
- });
- } else if (path3.refType == "frame") {
- let schema = props.superstate.framesIndex.get(path3.basePath)?.schemas.find((f2) => f2.id == path3.ref);
- if (!schema && path3.ref == defaultFrameListViewSchema.id) {
- schema = defaultFrameListViewSchema;
- setSpaceFragment({
- type: "context",
- path: path3.basePath,
- frameSchema: schema.id
- });
- }
- if (schema?.type == "view") {
- setSpaceFragment({
- type: "context",
- path: path3.basePath,
- frameSchema: path3.ref
- });
+ const { hoverNode, setHoverNode, instance, id: id3 } = (0, import_react150.useContext)(FrameInstanceContext);
+ const { selectionMode, selection: selection2, select } = (0, import_react150.useContext)(
+ FrameSelectionContext
+ );
+ const resetState = () => {
+ setHoverNode(null);
+ };
+ useDndMonitor({
+ onDragOver: ({ active, over }) => {
+ const overId = over?.data.current.node;
+ if (over?.data.current.root == id3) {
+ if (overId)
+ setHoverNode({
+ id: over?.data.current.id,
+ node: over?.data.current.node,
+ direction: over?.data.current?.direction
+ });
} else {
- setSpaceFragment({
- type: "frame",
- path: path3.basePath,
- frameSchema: path3.ref
- });
+ setHoverNode(null);
}
- } else if (path3.refType == "action") {
- setSpaceFragment({
- type: "action",
- path: path3.basePath,
- actionSchema: path3.ref
- });
- } else {
- setSpaceFragment({
- type: "context",
- path: path3.basePath,
- frameSchema: defaultFrameListViewID
- });
- }
- }, [path3]);
- return /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null, spaceFragment?.path && (spaceFragment?.type == "context" ? /* @__PURE__ */ import_react158.default.createElement(PathProvider, {
- superstate: props.superstate,
- path: spaceFragment.path,
- readMode: false
- }, /* @__PURE__ */ import_react158.default.createElement(SpaceProvider, {
- superstate: props.superstate
- }, /* @__PURE__ */ import_react158.default.createElement(FramesMDBProvider, {
- superstate: props.superstate,
- contextSchema: spaceFragment.contextSchema,
- schema: spaceFragment.frameSchema
- }, /* @__PURE__ */ import_react158.default.createElement(ContextEditorProvider, {
- superstate: props.superstate
- }, /* @__PURE__ */ import_react158.default.createElement(ContextListContainer, {
- superstate: props.superstate,
- minMode: props.minMode,
- containerRef: props.containerRef,
- setView: props.setFrameSchema
- }))))) : spaceFragment?.type == "frame" ? /* @__PURE__ */ import_react158.default.createElement(FrameRootProvider, {
- superstate: props.superstate,
- path: path3,
- cols: []
- }, /* @__PURE__ */ import_react158.default.createElement(FrameInstanceProvider, {
- id: props.id,
- superstate: props.superstate,
- props: {},
- editable: false
- }, /* @__PURE__ */ import_react158.default.createElement(FrameInstanceView, {
- superstate: props.superstate,
- source: props.source
- }))) : spaceFragment?.type == "action" ? /* @__PURE__ */ import_react158.default.createElement(SpaceCommand, {
- superstate: props.superstate,
- action: props.path
- }) : /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null)));
-};
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/ContextNodeView.tsx
-var import_react159 = __toESM(require_react());
-var ContextNodeView = (props) => {
- const fullPath = props.state?.props?.value;
- const { updateNode } = (0, import_react159.useContext)(FramesEditorRootContext);
- const { id: id3 } = (0, import_react159.useContext)(FrameInstanceContext);
- const selectLink = (e5) => {
- showSpacesMenu(
- e5,
- props.superstate,
- (link3) => updateNode(props.treeNode.node, {
- props: {
- ...props.treeNode.node.props,
- value: wrapQuotes(link3 + "#^" + defaultContextSchemaID)
+ },
+ onDragCancel: () => {
+ resetState();
+ },
+ onDragEnd: ({ active, over }) => {
+ if (!active || !hoverNode) {
+ resetState();
+ return;
+ }
+ const overId = hoverNode?.node;
+ if (overId == active.data.current.id || hoverNode?.id != over.data.current.id) {
+ resetState();
+ return;
+ }
+ const overParentNode = findParent(instance.exec, overId);
+ const overNode = overParentNode?.children.find(
+ (f2) => f2.id == overId
+ );
+ if (active.data.current.type == "node") {
+ const activeParentNode = findParent(
+ instance.exec,
+ active.data.current.node
+ );
+ const activeNode = activeParentNode?.children.find(
+ (f2) => f2.id == active.data.current.node
+ );
+ if (overNode && activeNode) {
+ const [newNodes, deleteNodes] = dropFrame(
+ activeNode.node,
+ overNode,
+ instance.exec,
+ nodes,
+ hoverNode.direction
+ );
+ saveNodes(newNodes, deleteNodes);
}
- })
- );
- };
- const setFrameSchema = (schema) => {
- if (props.treeNode.node.props.value == "$contexts['$space']['space']") {
- updateNode(props.treeNode.node, {
- props: {
- ...props.treeNode.node.props,
- value: `$contexts['$space']['space']+"/#*${schema}"`
+ } else if (active.data.current.type == "property") {
+ if (active.data.current.path == spaceInfo.path && overNode) {
+ const [newNodes, deleteNodes] = dropFrame(
+ propertyToNode(
+ active.data.current.property,
+ active.data.current.context
+ ),
+ overNode,
+ instance.exec,
+ nodes,
+ hoverNode.direction
+ );
+ saveNodes(newNodes, deleteNodes);
+ }
+ } else if (active.data.current.type == "listItem") {
+ if (overNode) {
+ const [newNodes, deleteNodes] = dropFrame(
+ {
+ ...flowNode.node,
+ props: {
+ value: `'${active.data.current.contexts?.$context?.["_keyValue"]}'`
+ }
+ },
+ overNode,
+ instance.exec,
+ nodes,
+ hoverNode.direction
+ );
+ saveNodes(newNodes, deleteNodes);
+ }
+ } else if (active.data.current.type == "context") {
+ if (overNode) {
+ const space2 = props.superstate.spacesIndex.get(
+ active.data.current.space
+ );
+ if (space2) {
+ const [newNodes, deleteNodes] = dropFrame(
+ {
+ ...contextNode.node,
+ props: {
+ value: wrapQuotes(
+ contextPathForSpace(space2, active.data.current.schema)
+ )
+ }
+ },
+ overNode,
+ instance.exec,
+ nodes,
+ hoverNode.direction
+ );
+ saveNodes(newNodes, deleteNodes);
+ }
}
- });
- return;
- }
- updateNode(props.treeNode.node, {
- props: {
- ...props.treeNode.node.props,
- value: wrapQuotes(
- contextPathFromPath(
- props.superstate,
- props.superstate.spaceManager.resolvePath(fullPath, props.source)
- )?.space + "#*" + schema
- )
}
- });
- };
- return props.state && fullPath ? /* @__PURE__ */ import_react159.default.createElement(SpaceFragmentViewComponent, {
- id: id3,
- source: props.source,
- superstate: props.superstate,
- path: fullPath,
- minMode: props.state?.styles?.["--mk-min-mode"],
- containerRef: props.containerRef,
- setFrameSchema
- }) : /* @__PURE__ */ import_react159.default.createElement("div", {
- className: "mk-frame-placeholder",
- onClick: (e5) => selectLink(e5)
- }, i18n_default.labels.selectSpace);
-};
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/IconNodeView.tsx
-var import_react160 = __toESM(require_react());
-var IconNodeView = (props) => {
- const {
- selectionMode,
- selected: frameSelected,
- selection: selection2
- } = (0, import_react160.useContext)(FrameSelectionContext);
- const { updateNode, nodes } = (0, import_react160.useContext)(FramesEditorRootContext);
- const updateValue2 = (newValue) => {
- if (newValue != props.state.props?.value) {
- if (props.treeNode.editorProps?.linkedNode) {
- const node2 = nodes.find(
- (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
- );
- updateNode(node2, {
+ resetState();
+ }
+ });
+ const propertyToNode = (property, context) => {
+ let node = textNode.node;
+ if (property.type == "boolean") {
+ node = {
+ ...inputNode.node,
+ styles: { ...inputNode.node.styles, as: `'checkbox'` }
+ };
+ } else if (property.type == "link" || property.type == "context" || property.type == "file") {
+ node = flowNode.node;
+ } else if (property.type == "image") {
+ node = imageNode.node;
+ }
+ if (node.type == "input") {
+ node = {
+ ...node,
+ props: { ...node.props, value: wrapQuotes(property.name) }
+ };
+ } else {
+ if (context.length > 0) {
+ node = {
+ ...node,
props: {
- ...node2.props,
- [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
+ ...node.props,
+ value: `$contexts['${context}']['${property.name}']`
}
- });
+ };
} else {
- updateNode(props.treeNode.node, {
- props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
- });
+ node = {
+ ...node,
+ props: {
+ ...node.props,
+ value: `${frameSchema.id}.props['${property.name}']`
+ }
+ };
}
}
+ return node;
};
- const selected = selection2?.includes(props.treeNode.node.id);
- const editable = (0, import_react160.useMemo)(() => {
- if (selectionMode == 0 /* Read */)
- return false;
- if (selectionMode == 1 /* Page */)
- return true;
- if (selectionMode == 3 /* Group */ && selected)
- return true;
- if (props.treeNode.isRef) {
- if (props.treeNode.editorProps.linkedNode && frameSelected)
- return true;
- return false;
- }
- return true;
- }, [props.treeNode, selectionMode, frameSelected, selected]);
- const selectIcon = () => {
- props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react160.default.createElement(StickerModal_default, {
- ui: props.superstate.ui,
- hide: _props.hide,
- selectedSticker: (emoji) => updateValue2(emoji)
- }));
- };
- const [stickerType, stickerPath] = props.state.props?.value ? parseStickerString(props.state.props?.value) : [null, null];
- return props.state && (props.state.props?.value?.length > 0 ? stickerType == "image" ? /* @__PURE__ */ import_react160.default.createElement("img", {
- className: "mk-frame-icon",
- src: props.superstate.ui.getUIPath(
- props.superstate.imagesCache.get(stickerPath)
- )
- }) : /* @__PURE__ */ import_react160.default.createElement("div", {
- className: "mk-frame-icon",
- style: {},
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker(props.state.props?.value)
- }
- }) : editable ? /* @__PURE__ */ import_react160.default.createElement("div", {
- onClick: () => selectIcon(),
- "aria-label": "Select Sticker",
- className: "mk-node-icon-placeholder",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//smile")
+ const handleKeyDown = (0, import_react150.useCallback)(
+ (e5) => {
+ if (e5.key == "ArrowUp") {
+ if (selection2.length > 0) {
+ const node = nodes.find((f2) => f2.id == selection2[0]);
+ 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) {
+ select(
+ parent.children.find((f2) => f2.node.rank == index2 - 1)?.id
+ );
+ }
+ }
+ }
+ }
+ }
+ if (e5.key == "ArrowDown") {
+ if (selection2.length > 0) {
+ const node = nodes.find((f2) => f2.id == selection2[0]);
+ 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) {
+ select(
+ parent.children.find((f2) => f2.node.rank == index2 + 1)?.id
+ );
+ }
+ }
+ }
+ }
+ }
+ if (e5.key == "Delete" || e5.key == "Backspace") {
+ if (selection2.length > 0)
+ saveNodes(
+ [],
+ selection2.map((f2) => nodes.find((g) => g.id == f2)).filter((f2) => f2)
+ );
+ }
+ if (e5.key == "z" && e5.metaKey) {
+ if (e5.shiftKey) {
+ redoAction();
+ } else {
+ undoLastAction();
+ }
+ }
+ },
+ [selection2, nodes, undoLastAction, redoAction, saveNodes]
+ );
+ (0, import_react150.useEffect)(() => {
+ props.superstate.ui.inputManager.on("keydown", handleKeyDown);
+ return () => {
+ props.superstate.ui.inputManager.off("keydown", handleKeyDown);
+ };
+ }, [handleKeyDown]);
+ return /* @__PURE__ */ import_react150.default.createElement(import_react150.default.Fragment, null, instance.exec && /* @__PURE__ */ import_react150.default.createElement("div", {
+ className: "mk-f-root",
+ style: { position: "relative" }
+ }, selectionMode >= 3 /* Group */ && /* @__PURE__ */ import_react150.default.createElement("div", {
+ className: "mk-f-root-label",
+ onClick: (e5) => {
+ select(instance.exec.id);
+ e5.stopPropagation();
}
- }) : /* @__PURE__ */ import_react160.default.createElement(import_react160.default.Fragment, null));
+ }, instance.exec.node.name), /* @__PURE__ */ import_react150.default.createElement(FrameEditorNodeView, {
+ key: spaceInfo.path,
+ superstate: props.superstate,
+ treeNode: instance.exec,
+ instance,
+ containerRef: props.containerRef
+ }, props.children), instance.exec.children.length == 0 && /* @__PURE__ */ import_react150.default.createElement(NewNodeView, {
+ superstate: props.superstate,
+ treeNode: null,
+ state: null
+ })));
};
-// src/core/react/components/SpaceView/Frames/EditorNodes/ImageNodeView.tsx
-var import_react161 = __toESM(require_react());
-var ImageNodeView = (props) => {
- const value = props.state.props.value;
- const sourcePath = (0, import_react161.useMemo)(() => {
- return props.superstate.ui.getUIPath(value, true);
- }, [value]);
- const { nodes, updateNode } = (0, import_react161.useContext)(FramesEditorRootContext);
- const { linkedProps } = (0, import_react161.useContext)(FrameInstanceContext);
+// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListInstance.tsx
+var ContextListInstance = (props) => {
+ const [contexts, setContexts] = (0, import_react151.useState)(props.contexts);
+ (0, import_react151.useEffect)(
+ () => setContexts((p) => import_lodash18.default.isEqual(props.contexts, p) ? p : props.contexts),
+ [props.contexts]
+ );
+ const { spaceInfo } = (0, import_react151.useContext)(SpaceContext);
+ const { dbSchema } = (0, import_react151.useContext)(ContextEditorContext);
+ const { setDragNode } = (0, import_react151.useContext)(WindowContext);
+ const ref2 = import_react151.default.useRef(null);
const {
- selectionMode,
- selected: frameSelected,
- selection: selection2
- } = (0, import_react161.useContext)(FrameSelectionContext);
- const selected = selection2?.includes(props.treeNode.node.id);
- const showModal2 = () => {
- if (!stringIsConst(props.treeNode.node.props.value) && !linkedProps.some(
- (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2
- ))
- return;
- props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react161.default.createElement(ImageModal_default, {
- superstate: props.superstate,
- hide: _props.hide,
- selectedPath: (image3) => saveValue(image3)
- }));
- };
- const saveValue = (newValue) => {
- if (newValue != props.state.props?.value) {
- if (props.treeNode.editorProps?.linkedNode) {
- const node2 = nodes.find(
- (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
+ attributes,
+ listeners,
+ active,
+ setNodeRef: setDraggableNodeRef,
+ transform,
+ isDragging,
+ transition,
+ isOver,
+ over
+ } = useSortable({
+ id: props.id,
+ data: {
+ id: props.id,
+ type: props.type,
+ space: spaceInfo?.path,
+ schema: dbSchema?.id,
+ props: props.props,
+ contexts
+ },
+ disabled: props.type != "listItem" || props.editMode > 0 /* Read */,
+ animateLayoutChanges: defaultAnimateLayoutChanges
+ });
+ useDndMonitor({
+ onDragStart: (e5) => {
+ if (e5.active.data.current.id == props.id) {
+ setDragNode(
+ /* @__PURE__ */ import_react151.default.createElement("div", {
+ dangerouslySetInnerHTML: { __html: ref2.current.innerHTML }
+ })
);
- updateNode(node2, {
- props: {
- ...node2.props,
- [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
- }
- });
- } else {
- updateNode(props.treeNode.node, {
- props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
- });
}
- }
- };
- const editable = (0, import_react161.useMemo)(() => {
- if (selectionMode == 0 /* Read */)
- return false;
- if (selectionMode == 1 /* Page */)
- return true;
- if (selectionMode == 3 /* Group */ && selected)
- return true;
- if (props.treeNode.isRef) {
- if (props.treeNode.editorProps.linkedNode && frameSelected)
- return true;
- return false;
- }
- return true;
- }, [props.treeNode, selectionMode, frameSelected, selected]);
- return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react161.default.createElement("img", {
- className: "mk-node-image",
- width: props.state?.styles.width,
- height: props.state?.styles.height,
- style: {
- borderRadius: props.state?.styles.borderRadius,
- maxHeight: props.state?.styles.maxHeight
},
- src: sourcePath
- }) : editable ? /* @__PURE__ */ import_react161.default.createElement("div", {
- className: "mk-node-image-placeholder",
- dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getPlaceholderImage("image-select")
+ onDragOver: (over2) => {
},
- style: {
- borderRadius: props.state?.styles.borderRadius,
- maxHeight: props.state?.styles.maxHeight
+ onDragEnd: ({ active: active2, over: over2 }) => {
+ const dragReorder = over2 && over2.data.current.space == spaceInfo?.path && over2.data.current.schema == dbSchema?.id;
+ dropListItem(dragReorder, over2, props, active2, spaceInfo);
+ }
+ });
+ return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react151.default.createElement(FrameSelectionProvider, {
+ superstate: props.superstate,
+ id: props.id,
+ editMode: props.editMode,
+ selected: props.editMode == 3 /* Group */
+ }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceProvider, {
+ id: props.id,
+ superstate: props.superstate,
+ props: props.props,
+ propSetters: props.propSetters,
+ contexts,
+ editable: true
+ }, /* @__PURE__ */ import_react151.default.createElement(FrameEditorInstance, {
+ superstate: props.superstate,
+ containerRef: props.containerRef
+ }, props.children))) : /* @__PURE__ */ import_react151.default.createElement(import_react151.default.Fragment, null, over?.id == props.id && active.data.current.type == props.type && !(active.data.current.space == spaceInfo?.path && active.data.current.schema == dbSchema?.id && active.data.current.props?._groupValue == props.props?._groupValue) && /* @__PURE__ */ import_react151.default.createElement(FrameInstanceProvider, {
+ id: props.id,
+ superstate: props.superstate,
+ props: props.props,
+ propSetters: props.propSetters,
+ contexts,
+ editable: false
+ }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceView, {
+ superstate: props.superstate
+ })), /* @__PURE__ */ import_react151.default.createElement("div", {
+ ref: (el) => {
+ setDraggableNodeRef(el);
+ ref2.current = el;
},
- onClick: (e5) => showModal2()
- }) : /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null);
-};
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/InputNodeView.tsx
-var import_react162 = __toESM(require_react());
-var InputNodeView = (props) => {
- const { selectionMode } = (0, import_react162.useContext)(FrameSelectionContext);
- const { saveState, instance } = (0, import_react162.useContext)(FrameInstanceContext);
- const [value, setValue] = (0, import_react162.useState)("");
- const state = props.state;
- const type = props.state.styles?.as;
- (0, import_react162.useEffect)(() => {
- const linkedNode = parseLinkedNode(props.state?.props?.value);
- if (linkedNode) {
- const node2 = linkedNode.node == "$root" ? instance.exec.id : linkedNode.node;
- setValue(instance.state?.[node2]?.props?.[linkedNode.prop]);
+ ...attributes,
+ ...listeners,
+ style: {
+ transform: CSS.Transform.toString(transform),
+ transition
}
- }, [props.state.props]);
- return /* @__PURE__ */ import_react162.default.createElement("input", {
- className: "mk-node-input",
- type,
- value: type == "checkbox" ? null : value,
- checked: value == "true",
- onKeyDown: (e5) => {
- e5.stopPropagation();
- if (e5.key == "Enter") {
- const _value = type == "text" ? e5.currentTarget.value : type == "checkbox" ? (!e5.currentTarget.checked).toString() : e5.currentTarget.value;
- setValue("");
- if (typeof state.actions?.onEnter == "function") {
- state.actions?.onEnter(
- e5,
- _value,
- instance.state,
- (s4) => saveState(s4, instance),
- props.superstate.api
+ }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceProvider, {
+ id: props.id,
+ superstate: props.superstate,
+ props: props.props,
+ propSetters: props.propSetters,
+ contexts,
+ editable: false
+ }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceView, {
+ superstate: props.superstate
+ }, props.children))));
+};
+var dropListItem = async (dragReorder, over, props, active, spaceInfo) => {
+ if (dragReorder && over.id == props.id) {
+ if (active.data.current.schema == defaultContextSchemaID) {
+ const activePath = active.data.current.contexts?.$context?.["_keyValue"];
+ const context = over.data.current.contexts?.$context;
+ const groupValueMismatch = props.props?._groupValue != active.data.current.props?._groupValue;
+ if (activePath && context) {
+ if (groupValueMismatch) {
+ {
+ saveProperties(props.superstate, activePath, {
+ [props.props?._groupField]: props.props?._groupValue
+ });
+ }
+ } else {
+ updatePathRankInSpace(
+ props.superstate,
+ activePath,
+ context._index,
+ spaceInfo.path
);
}
}
- },
- onChange: (e5) => {
- const _value = type == "text" ? e5.target.value : type == "checkbox" ? (!e5.target.checked).toString() : e5.target.value;
- setValue(_value);
- if (typeof state.actions?.onChange == "function") {
- state.actions?.onChange(
- e5,
- _value,
- instance.state,
- (s4) => saveState(s4, instance),
- props.superstate.api
- );
- }
- },
- placeholder: state.styles.placeholder,
- style: {
- ...state?.styles
+ } else {
+ const context = over.data.current.contexts?.$context;
+ updateTableValue(
+ props.superstate.spaceManager,
+ spaceInfo,
+ active.data.current.schema,
+ active.data.current.contexts?.$context?.["_index"],
+ props.props?._groupField,
+ props.props?._groupValue,
+ context?._index
+ );
}
- });
+ }
};
-// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx
-var import_react166 = __toESM(require_react());
-
-// src/core/react/hooks/useEffectOnce.ts
-var import_react163 = __toESM(require_react());
-function useEffectOnce(cb) {
- (0, import_react163.useEffect)(cb, []);
-}
-
-// src/core/react/hooks/useEventListener.ts
-var import_react164 = __toESM(require_react());
-function useEventListener(eventType, callback, element3 = window) {
- const callbackRef = (0, import_react164.useRef)(callback);
- (0, import_react164.useEffect)(() => {
- callbackRef.current = callback;
- }, [callback]);
- (0, import_react164.useEffect)(() => {
- if (element3 == null)
- return;
- const handler = (e5) => callbackRef.current(e5);
- element3.addEventListener(eventType, handler);
- return () => element3.removeEventListener(eventType, handler);
- }, [eventType, element3]);
-}
-
-// src/core/react/hooks/useTimeout.tsx
-var import_react165 = __toESM(require_react());
-function useTimeout(callback, delay) {
- const callbackRef = (0, import_react165.useRef)(callback);
- const timeoutRef = (0, import_react165.useRef)(null);
- (0, import_react165.useEffect)(() => {
- callbackRef.current = callback;
- }, [callback]);
- const set = (0, import_react165.useCallback)(() => {
- timeoutRef.current = setTimeout(() => callbackRef.current(), delay);
- }, [delay]);
- const clear = (0, import_react165.useCallback)(() => {
- timeoutRef.current && clearTimeout(timeoutRef.current);
- }, []);
- (0, import_react165.useEffect)(() => {
- set();
- return clear;
- }, [delay, set, clear]);
- const reset2 = (0, import_react165.useCallback)(() => {
- clear();
- set();
- }, [clear, set]);
- return { reset: reset2, clear };
-}
+// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx
+var import_react153 = __toESM(require_react());
-// src/core/react/hooks/useLongPress.tsx
-function useLongPress(ref2, cb, { delay = 400 } = {}) {
- const { reset: reset2, clear } = useTimeout(cb, delay);
- useEffectOnce(clear);
- useEventListener("mousedown", reset2, ref2.current);
- useEventListener("touchstart", reset2, ref2.current);
- useEventListener("mouseup", clear, ref2.current);
- useEventListener("mouseleave", clear, ref2.current);
- useEventListener("touchend", clear, ref2.current);
-}
+// src/core/react/components/SpaceView/Contexts/ContextBuilder/FrameContainerView.tsx
+var import_react152 = __toESM(require_react());
+var FrameContainerView = (props) => {
+ const { selected: _selected } = (0, import_react152.useContext)(FrameSelectionContext);
+ return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react152.default.createElement(FramesMDBProvider, {
+ superstate: props.superstate,
+ schema: props.uri.ref
+ }, /* @__PURE__ */ import_react152.default.createElement(FrameEditorProvider, {
+ superstate: props.superstate,
+ cols: props.cols,
+ editMode: props.editMode
+ }, props.children)) : /* @__PURE__ */ import_react152.default.createElement(FrameRootProvider, {
+ superstate: props.superstate,
+ path: props.uri,
+ cols: props.cols
+ }, props.children);
+};
-// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx
-var TextNodeView = (props) => {
+// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx
+var ContextListView = (props) => {
+ const { editSection, selectedIndex, setSelectedIndex, groupURI, itemURI } = props;
+ const { spaceInfo } = (0, import_react153.useContext)(SpaceContext);
const {
- selectionMode,
- selection: selection2,
- selectable,
- selected: frameSelected,
- select
- } = (0, import_react166.useContext)(FrameSelectionContext);
- const fileNameRef = (0, import_react166.useRef)(null);
- const { updateNode, nodes, deleteNode } = (0, import_react166.useContext)(FramesEditorRootContext);
- const updateValue2 = (newValue) => {
- if (newValue != props.state.props?.value) {
- if (props.treeNode.editorProps?.linkedNode) {
- const node2 = nodes.find(
- (f2) => f2.id == props.treeNode.editorProps.linkedNode.node
- );
- updateNode(node2, {
- props: {
- ...node2.props,
- [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue)
- }
- });
- } else {
- updateNode(props.treeNode.node, {
- props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) }
- });
+ predicate,
+ filteredData: data2,
+ editMode,
+ sortedColumns,
+ contextTable,
+ cols,
+ dbSchema
+ } = (0, import_react153.useContext)(ContextEditorContext);
+ const { instance } = (0, import_react153.useContext)(FrameInstanceContext);
+ const groupBy2 = predicate?.groupBy?.length > 0 ? cols.find((f2) => f2.name + f2.table == predicate.groupBy[0]) : null;
+ const groupByOptions = (0, import_react153.useMemo)(() => {
+ const groupByOptions2 = instance?.state[instance?.root?.id].props?.groupOptions;
+ if (groupByOptions2)
+ return ensureArray(groupByOptions2);
+ if (!groupBy2)
+ return [""];
+ const options = uniq([
+ "",
+ ...(parseFieldValue(groupBy2.value, groupBy2.type, props.superstate)?.options ?? []).map((f2) => f2.value),
+ ...data2.reduce(
+ (p, c3) => [...p, c3[groupBy2.name + groupBy2.table] ?? ""],
+ []
+ )
+ ]);
+ return options;
+ }, [groupBy2, data2, instance]);
+ const groupByFilter = (0, import_react153.useMemo)(() => {
+ const filter4 = instance?.state[instance?.root?.id].props?.groupFilter;
+ return filterFnTypes[filter4] ?? filterFnTypes.is;
+ }, [instance]);
+ const items = (0, import_react153.useMemo)(() => {
+ return groupByOptions.reduce((p, c3) => {
+ if (!groupBy2) {
+ return c3 == "" ? {
+ ...p,
+ [c3]: data2 ?? []
+ } : {
+ ...p,
+ [c3]: []
+ };
}
- }
- };
- const onBlur = (e5) => {
- const newValue = e5.target.innerHTML;
- updateValue2(newValue);
- };
- const onKeyPress = (e5) => {
- e5.stopPropagation();
- };
- const onKeyUp = (e5) => {
- e5.stopPropagation();
- };
- const onKeyDown = (e5) => {
- e5.stopPropagation();
- if (e5.key == "Delete" || e5.key == "Backspace") {
- if (e5.target.innerHTML == "")
- deleteNode(props.treeNode.node);
- }
- if (e5.key == "a" && e5.metaKey) {
- e5.preventDefault();
- const selection3 = window.getSelection();
- const range2 = document.createRange();
- range2.selectNodeContents(e5.target);
- selection3.removeAllRanges();
- selection3.addRange(range2);
- }
- if (e5.key == "Enter") {
- e5.target.blur();
- e5.preventDefault();
- }
- if (e5.key == "Escape") {
- e5.target.blur();
- e5.preventDefault();
- }
- };
- const onClick = (e5) => {
- if (editable) {
- e5.stopPropagation();
- }
- };
- const onMouseDown = (e5) => {
- if (editable)
- e5.stopPropagation();
- if (selectionMode == 3 /* Group */ && !props.treeNode.isRef) {
- select(props.treeNode.id);
- }
- };
- const onLongPress = () => {
- if (editable) {
- select(props.treeNode.node.id, false);
- return;
- }
+ const newItems = data2.filter((r2) => {
+ return groupByFilter.fn(r2[groupBy2.name + groupBy2.table], c3);
+ });
+ return newItems.length > 0 ? {
+ ...p,
+ [c3]: newItems
+ } : {
+ ...p,
+ [c3]: []
+ };
+ }, {});
+ }, [data2, groupByOptions, groupByFilter, groupBy2]);
+ const primaryKey = (0, import_react153.useMemo)(() => {
+ return cols.find((f2) => f2.primary == "true")?.name;
+ }, [cols]);
+ const visibleCols = (0, import_react153.useMemo)(() => {
+ return sortedColumns.filter((f2) => !predicate?.colsHidden.includes(f2.name));
+ }, [predicate, sortedColumns]);
+ const context = {
+ _path: spaceInfo?.path,
+ _schema: dbSchema?.id,
+ _key: primaryKey,
+ _properties: visibleCols
};
- useLongPress(fileNameRef, onLongPress);
- const selected = selection2.includes(props.treeNode.id);
- const { linkedProps } = (0, import_react166.useContext)(FrameInstanceContext);
- const editable = (0, import_react166.useMemo)(() => {
- if (selectionMode == 0 /* Read */)
- return false;
- if (props.treeNode.isRef) {
- if (props.treeNode.editorProps.linkedNode && frameSelected)
- return true;
- return false;
- }
- if (linkedProps.some(
- (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2
- ))
- return true;
- if (!stringIsConst(props.treeNode.node.props.value))
- return false;
- if (selectionMode == 1 /* Page */)
- return true;
- if (selectionMode == 3 /* Group */ && selected)
- return true;
- return false;
- }, [props.treeNode, selectionMode, frameSelected, selected, linkedProps]);
- return props.state && /* @__PURE__ */ import_react166.default.createElement("div", {
- className: `mk-frame-text`,
- "data-placeholder": editable || selectable ? i18n_default.labels.textPlaceholder : "",
- dangerouslySetInnerHTML: {
- __html: props.state.props?.value
+ const contextMap = (0, import_react153.useMemo)(() => {
+ return dbSchema?.primary == "true" ? data2.reduce((p, c3) => {
+ return {
+ ...p,
+ [c3["_index"]]: {
+ $context: {
+ _index: c3["_index"],
+ _keyValue: c3[primaryKey],
+ _schema: dbSchema.id,
+ _name: props.superstate.pathsIndex.get(c3[primaryKey])?.name,
+ ...context
+ },
+ $properties: cols,
+ [spaceInfo.path]: cols.reduce((a4, b2) => {
+ return {
+ ...a4,
+ [b2.name]: c3[b2.name]
+ };
+ }, {}),
+ ...Object.keys(contextTable).reduce((d4, e5) => {
+ return {
+ ...d4,
+ [e5]: contextTable[e5].cols.reduce((a4, b2) => {
+ return {
+ ...a4,
+ [b2.name]: c3[b2.name + e5]
+ };
+ }, {})
+ };
+ }, {})
+ }
+ };
+ }, {}) : data2.reduce((p, c3) => {
+ return {
+ ...p,
+ [c3["_index"]]: {
+ $context: {
+ _index: c3["_index"],
+ _keyValue: c3[primaryKey],
+ _schema: dbSchema.id,
+ _name: c3[primaryKey],
+ ...context
+ },
+ $properties: cols,
+ [spaceInfo.path]: cols.reduce((a4, b2) => {
+ return {
+ ...a4,
+ [b2.name]: c3[b2.name]
+ };
+ }, {})
+ }
+ };
+ }, {});
+ }, [data2, cols, contextTable]);
+ return /* @__PURE__ */ import_react153.default.createElement(FrameContainerView, {
+ superstate: props.superstate,
+ uri: groupURI,
+ editMode: editSection == "listGroup" ? editMode : 0 /* Read */,
+ cols: []
+ }, /* @__PURE__ */ import_react153.default.createElement(SortableContext, {
+ items: Object.keys(items).map(
+ (f2, i4) => spaceInfo.path + "listGroup" + i4
+ ),
+ strategy: rectSortingStrategy
+ }, Object.keys(items).map((c3, i4) => /* @__PURE__ */ import_react153.default.createElement(ContextListInstance, {
+ key: "listGroup" + i4,
+ id: spaceInfo.path + "listGroup" + i4,
+ type: "listGroup",
+ superstate: props.superstate,
+ uri: groupURI,
+ props: {
+ _selectedIndex: selectedIndex,
+ _groupValue: c3,
+ _groupField: groupBy2?.name,
+ _groupType: groupBy2?.type,
+ ...predicate.listGroupProps
},
- onClick,
- onMouseDown,
- onBlur,
- onDrop: (e5) => e5.preventDefault(),
- onKeyDown,
- onKeyPress,
- onKeyUp,
- ref: fileNameRef,
- contentEditable: editable
- });
+ propSetters: null,
+ editMode: editSection == "listGroup" ? editMode : 0 /* Read */,
+ cols: [],
+ containerRef: props.containerRef,
+ contexts: { $context: context }
+ }, /* @__PURE__ */ import_react153.default.createElement(FrameContainerView, {
+ uri: itemURI,
+ superstate: props.superstate,
+ cols: [],
+ editMode: editSection == "listItem" ? editMode : 0 /* Read */
+ }, /* @__PURE__ */ import_react153.default.createElement(SortableContext, {
+ items: items[c3].flatMap(
+ (f2, k2) => spaceInfo.path + "listGroup" + i4 + "_listItem" + k2
+ ),
+ strategy: rectSortingStrategy
+ }, items[c3].map((f2, j) => {
+ return /* @__PURE__ */ import_react153.default.createElement(ContextListInstance, {
+ key: "listGroup" + i4 + "_listItem" + j,
+ id: spaceInfo.path + "listGroup" + i4 + "_listItem" + j,
+ type: "listItem",
+ uri: itemURI,
+ superstate: props.superstate,
+ cols: [],
+ props: {
+ _selectedIndex: selectedIndex,
+ _groupValue: c3,
+ _groupField: groupBy2?.name,
+ ...predicate.listItemProps
+ },
+ propSetters: {
+ _selectedIndex: setSelectedIndex
+ },
+ containerRef: props.containerRef,
+ editMode: editSection == "listItem" ? editMode : 0 /* Read */,
+ contexts: contextMap[f2["_index"]]
+ });
+ })))))));
};
-// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx
-var FrameView = (props) => {
- const nodeProps = {
+// src/core/react/components/SpaceView/Contexts/ContextListContainer.tsx
+var ContextListContainer = (props) => {
+ const { pathState } = (0, import_react154.useContext)(PathContext);
+ const { predicate, editMode, setEditMode, dbSchema } = (0, import_react154.useContext)(ContextEditorContext);
+ const { frameSchema } = (0, import_react154.useContext)(FramesMDBContext);
+ const [editSection, setEditSection] = (0, import_react154.useState)(null);
+ const [selectedIndex, setSelectedIndex] = (0, import_react154.useState)(null);
+ const [uris, setURIs] = (0, import_react154.useState)(
+ predicate ? {
+ listView: props.superstate.spaceManager.uriByString(
+ initiateString(predicate.listView, "spaces://$kit/#*listView"),
+ pathState.path
+ ),
+ listGroup: props.superstate.spaceManager.uriByString(
+ initiateString(predicate.listGroup, "spaces://$kit/#*listGroup"),
+ pathState.path
+ ),
+ listItem: props.superstate.spaceManager.uriByString(
+ initiateString(predicate.listItem, "spaces://$kit/#*rowItem"),
+ pathState.path
+ )
+ } : null
+ );
+ (0, import_react154.useEffect)(() => {
+ if (!predicate)
+ return;
+ const newURIs = {
+ listView: props.superstate.spaceManager.uriByString(
+ initiateString(predicate.listView, "spaces://$kit/#*listView"),
+ pathState.path
+ ),
+ listGroup: props.superstate.spaceManager.uriByString(
+ initiateString(predicate.listGroup, "spaces://$kit/#*listGroup"),
+ pathState.path
+ ),
+ listItem: props.superstate.spaceManager.uriByString(
+ initiateString(predicate.listItem, "spaces://$kit/#*rowItem"),
+ pathState.path
+ )
+ };
+ setURIs((p) => !import_lodash19.default.isEqual(newURIs, p) ? newURIs : p);
+ }, [predicate, pathState]);
+ return /* @__PURE__ */ import_react154.default.createElement("div", {
+ className: "mk-context-container"
+ }, !props.minMode && /* @__PURE__ */ import_react154.default.createElement(FilterBar, {
superstate: props.superstate,
- treeNode: props.treeNode,
- state: props.instance.state[props.treeNode.id]
- };
- const innerComponents = props.treeNode.node.type == "input" ? /* @__PURE__ */ import_react167.default.createElement(InputNodeView, {
- ...nodeProps
- }) : props.treeNode.node.type == "text" ? /* @__PURE__ */ import_react167.default.createElement(TextNodeView, {
- ...nodeProps
- }) : props.treeNode.node.type == "icon" ? /* @__PURE__ */ import_react167.default.createElement(IconNodeView, {
- ...nodeProps
- }) : props.treeNode.node.type == "audio" ? /* @__PURE__ */ import_react167.default.createElement(AudioNodeView, {
- ...nodeProps
- }) : props.treeNode.node.type == "image" ? /* @__PURE__ */ import_react167.default.createElement(ImageNodeView, {
- ...nodeProps
- }) : props.treeNode.node.type == "space" ? /* @__PURE__ */ import_react167.default.createElement(ContextNodeView, {
- ...nodeProps,
- source: props.source
- }) : props.treeNode.node.type == "content" ? /* @__PURE__ */ import_react167.default.createElement(ContentNodeView, null, props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react167.default.createElement(FrameView, {
+ setView: props.setView
+ }), uris ? predicate.view == "table" || predicate.view == "db" || dbSchema?.primary != "true" && !frameSchema ? /* @__PURE__ */ import_react154.default.createElement(TableView, {
+ superstate: props.superstate
+ }) : /* @__PURE__ */ import_react154.default.createElement("div", {
+ className: "mk-editor-context"
+ }, /* @__PURE__ */ import_react154.default.createElement(FrameSelectionProvider, {
superstate: props.superstate,
- key: i4,
- treeNode: c3,
- instance: props.instance,
- saveState: props.saveState,
- source: props.source
- }, props.children)), props.children) : props.treeNode.node.type == "flow" ? /* @__PURE__ */ import_react167.default.createElement(FlowNodeView, {
- ...nodeProps,
- source: props.source
- }) : props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react167.default.createElement(FrameView, {
+ id: "list",
+ editMode: editSection == "listView" ? editMode : 0 /* Read */
+ }, editMode > 0 && /* @__PURE__ */ import_react154.default.createElement(ContextListEditSelector, {
+ editSection,
superstate: props.superstate,
- key: i4,
- treeNode: c3,
- instance: props.instance,
- saveState: props.saveState,
- source: props.source
- }, props.children));
- const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false;
- return props.instance.state[props.treeNode.id] && !hidden && /* @__PURE__ */ import_react167.default.createElement("div", {
- className: `mk-frame ${parseStylesToClass(
- props.instance.state[props.treeNode.id]?.styles
- )}`,
- "data-path": props.treeNode.id,
- "data-type": props.treeNode.node.type,
- onContextMenu: (e5) => {
- if (typeof props.instance.state[props.treeNode.id].actions?.onContextMenu == "function") {
- props.instance.state[props.treeNode.id].actions?.onContextMenu(
- e5,
- null,
- props.instance.state,
- (s4) => props.saveState(s4, props.instance),
- props.superstate.api
- );
- e5.stopPropagation();
- }
+ setEditSection,
+ setEditMode
+ }), /* @__PURE__ */ import_react154.default.createElement(FrameContainerView, {
+ superstate: props.superstate,
+ uri: uris.listView,
+ cols: [],
+ editMode: editSection == "listView" ? editMode : 0 /* Read */
+ }, /* @__PURE__ */ import_react154.default.createElement(ContextListInstance, {
+ superstate: props.superstate,
+ id: "listView",
+ type: "listView",
+ uri: uris.listView,
+ props: {
+ _selectedIndex: selectedIndex,
+ ...predicate.listViewProps
},
+ propSetters: { _selectedIndex: setSelectedIndex },
+ containerRef: props.containerRef,
+ editMode: editSection == "listView" ? editMode : 0 /* Read */,
+ cols: [],
+ contexts: null
+ }, /* @__PURE__ */ import_react154.default.createElement(ContextListView, {
+ superstate: props.superstate,
+ containerRef: props.containerRef,
+ editSection,
+ selectedIndex,
+ setSelectedIndex,
+ groupURI: uris.listGroup,
+ itemURI: uris.listItem
+ }))))) : /* @__PURE__ */ import_react154.default.createElement(import_react154.default.Fragment, null));
+};
+
+// src/core/react/components/MDBView/MDBViewer.tsx
+var MDBViewer = (props) => {
+ return /* @__PURE__ */ import_react155.default.createElement(PathProvider, {
+ superstate: props.superstate,
+ path: props.space.path,
+ readMode: false
+ }, /* @__PURE__ */ import_react155.default.createElement(SpaceProvider, {
+ superstate: props.superstate
+ }, /* @__PURE__ */ import_react155.default.createElement(FramesMDBProvider, {
+ superstate: props.superstate,
+ schema: props.schema
+ }, /* @__PURE__ */ import_react155.default.createElement(ContextEditorProvider, {
+ superstate: props.superstate
+ }, /* @__PURE__ */ import_react155.default.createElement(ContextListContainer, {
+ superstate: props.superstate
+ })))));
+};
+
+// src/core/react/components/MarkdownEditor/Backlinks.tsx
+var import_react156 = __toESM(require_react());
+var BacklinkItem = (props) => {
+ const [block, setBlock] = (0, import_react156.useState)([null, null]);
+ const refreshBlock = (path2) => {
+ const fCache = props.superstate.pathsIndex.get(path2);
+ const link = [
+ ...fCache.metadata.links ?? [],
+ ...fCache.metadata.embeds ?? []
+ ].find((f2) => props.source.includes(f2.displayText));
+ if (link) {
+ const block2 = fCache.metadata.sections.find(
+ (f2) => f2.position.start.offset <= link.position.start.offset && f2.position.end.offset >= link.position.end.offset
+ );
+ setBlock([
+ Math.max(1, block2.position.start.line),
+ Math.max(block2.position.start.line + 1, block2.position.end.line + 1)
+ ]);
+ } else {
+ setBlock([null, null]);
+ }
+ };
+ (0, import_react156.useEffect)(() => {
+ refreshBlock(props.path);
+ }, []);
+ (0, import_react156.useEffect)(() => {
+ refreshBlock(props.path);
+ }, [props.path]);
+ const [collapsed, setCollapsed] = (0, import_react156.useState)(false);
+ return /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null, /* @__PURE__ */ import_react156.default.createElement("div", {
+ className: "mk-path-context-title"
+ }, /* @__PURE__ */ import_react156.default.createElement(CollapseToggle, {
+ superstate: props.superstate,
+ collapsed,
+ onToggle: (c3) => setCollapsed(c3)
+ }), /* @__PURE__ */ import_react156.default.createElement("div", {
onClick: (e5) => {
- if (e5.detail === 1) {
- if (typeof props.instance.state[props.treeNode.id].actions?.onClick == "function") {
- props.instance.state[props.treeNode.id].actions?.onClick(
- e5,
- null,
- props.instance.state,
- (s4) => props.saveState(s4, props.instance),
- props.superstate.api
- );
- e5.stopPropagation();
- }
- } else if (e5.detail === 2) {
- if (typeof props.instance.state[props.treeNode.id].actions?.onDoubleClick == "function") {
- props.instance.state[props.treeNode.id].actions?.onDoubleClick(
- e5,
- null,
- props.instance.state,
- (s4) => props.saveState(s4, props.instance),
- props.superstate.api
- );
- e5.stopPropagation();
- }
- }
- },
- style: {
- ...defaultFrameStyles,
- ...props.instance.state[props.treeNode.id]?.styles
+ props.superstate.ui.openPath(props.path, false);
+ e5.stopPropagation();
}
- }, innerComponents);
+ }, pathNameToString(props.path))), !collapsed ? /* @__PURE__ */ import_react156.default.createElement("div", {
+ className: "mk-path-context-backlink"
+ }, /* @__PURE__ */ import_react156.default.createElement(NoteView, {
+ load: true,
+ superstate: props.superstate,
+ path: props.path,
+ properties: { from: block[0], to: block[1] },
+ classname: "mk-path-context-flow"
+ })) : /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null));
};
-
-// src/core/react/components/SpaceView/Frames/EditorNodes/NewNodeView.tsx
-var import_react168 = __toESM(require_react());
-var NewNodeView = (props) => {
- const ref2 = import_react168.default.createRef();
- const { spaceState } = (0, import_react168.useContext)(SpaceContext);
- const {
- updateNode,
- nodes,
- deleteNode,
- addNode,
- saveNodes,
- lastCreatedId,
- setLastCreatedId
- } = (0, import_react168.useContext)(FramesEditorRootContext);
- const { selection: selection2, select } = (0, import_react168.useContext)(FrameSelectionContext);
- const [type, setType] = (0, import_react168.useState)("label");
- const { instance } = (0, import_react168.useContext)(FrameInstanceContext);
- const spaces2 = [...props.superstate.allSpaces(true)].filter((f2) => f2.type != "default").map((f2) => ({
- name: f2.name,
- value: f2.path,
- icon: props.superstate.pathsIndex.get(f2.path)?.label?.sticker,
- description: f2.type == "tag" ? f2.name : f2.type == "folder" ? f2.path : f2.name
- }));
- const paths = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden).filter((f2) => f2.type == "space" || f2.subtype == "md").map((f2) => ({
- name: f2.displayName,
- value: f2.path,
- description: f2.path,
- section: "flow",
- icon: f2.label?.sticker
- }));
- const fuseOptions = {
- minMatchCharLength: 1,
- threshold: 0,
- keys: ["name", "value"]
+var Backlinks = (props) => {
+ const [collapsed, setCollapsed] = (0, import_react156.useState)(
+ !props.superstate.settings.inlineBacklinksExpanded
+ );
+ const [backlinks, setBacklinks] = (0, import_react156.useState)([]);
+ (0, import_react156.useEffect)(() => {
+ if (!props.path)
+ return;
+ Promise.all(
+ uniq([...props.superstate.linksMap.getInverse(props.path)]).map(
+ (f2) => props.superstate.spaceManager.pathExists(f2) ? f2 : null
+ )
+ ).then((bls) => setBacklinks(bls.filter((f2) => f2)));
+ }, [props.path]);
+ (0, import_react156.useEffect)(() => {
+ props.superstate.settings.inlineBacklinksExpanded = !collapsed;
+ props.superstate.saveSettings();
+ }, [collapsed]);
+ const toggleBacklinks = () => {
+ setCollapsed(!collapsed);
};
- const [query, setQuery] = (0, import_react168.useState)("");
- const suggestions = (0, import_react168.useMemo)(() => {
- const menuOptions = [];
- const label = {
- name: i18n_default.frames.label.label,
- description: query,
- icon: "ui//baseline",
- section: "label",
- value: ""
- };
- menuOptions.push(label);
- const note = {
- name: i18n_default.frames.note.label,
- description: query,
- icon: "ui//file-text",
- value: "",
- section: "flow"
+ (0, import_react156.useEffect)(() => {
+ window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks);
+ return () => {
+ window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks);
};
- menuOptions.push(note);
- const kit = [
- {
- name: i18n_default.frames.table.label,
- description: i18n_default.frames.table.description,
- icon: "ui//table",
- section: "list",
- value: ""
- },
- ...[contextNode, dividerNode, iconNode, imageNode, groupNode].map(
- (f2) => ({
- name: f2.node.name,
- value: f2,
- icon: f2.def?.icon,
- section: "base",
- description: f2.def?.description
- })
- ),
- ...[
- buttonNode,
- ratingNode,
- callout,
- toggleNode,
- progressNode,
- circularProgressNode,
- tabsNode
- ].map((f2) => ({
- name: f2.node.name,
- value: f2,
- icon: f2.def?.icon,
- section: "kit",
- description: f2.def?.description
- }))
- ];
- const fuse = new Fuse(kit, fuseOptions);
- const kitOptions = query.length == 0 ? kit : fuse.search(query).map((result) => result.item).slice(0, 10);
- if (kitOptions.length > 0) {
- menuOptions.push(menuSection("Kit"));
- }
- menuOptions.push(...kitOptions);
- if (query.length > 0) {
- const fuse2 = new Fuse([...paths], fuseOptions);
- const options = query.length == 0 ? [] : fuse2.search(query).map((result) => result.item).slice(0, 10);
- if (options.length > 0)
- menuOptions.push(menuSection("Paths"));
- menuOptions.push(...options);
+ }, [collapsed]);
+ return backlinks.length > 0 && props.path ? /* @__PURE__ */ import_react156.default.createElement("div", {
+ className: "mk-path-context-component mk-note-footer"
+ }, /* @__PURE__ */ import_react156.default.createElement("div", {
+ className: "mk-path-context-section"
+ }, /* @__PURE__ */ import_react156.default.createElement("div", {
+ onClick: (e5) => {
+ setCollapsed(!collapsed);
+ e5.stopPropagation();
+ },
+ className: "mk-path-context-title"
+ }, /* @__PURE__ */ import_react156.default.createElement("div", {
+ className: `mk-icon-xsmall`,
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//backlink")
}
- return menuOptions;
- }, [query, type]);
- const selectOption = (option2) => {
- if (!props.treeNode) {
- clear();
+ }), i18n_default.labels.backlinks, /* @__PURE__ */ import_react156.default.createElement(CollapseToggleSmall, {
+ superstate: props.superstate,
+ collapsed,
+ onToggle: () => null
+ })), /* @__PURE__ */ import_react156.default.createElement("div", null, !collapsed && backlinks.map((f2, i4) => /* @__PURE__ */ import_react156.default.createElement(BacklinkItem, {
+ path: f2,
+ key: i4,
+ superstate: props.superstate,
+ source: props.path
+ }))))) : /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null);
+};
+
+// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx
+var import_react158 = __toESM(require_react());
+
+// src/core/react/components/SpaceView/Contexts/SpaceEditor/SpaceProperties.tsx
+var import_react157 = __toESM(require_react());
+var SpaceHeaderView = (props) => {
+ const { pathState } = (0, import_react157.useContext)(PathContext);
+ const { spaceState } = (0, import_react157.useContext)(SpaceContext);
+ const [tab, setTab] = (0, import_react157.useState)(0);
+ const tabs = [
+ { label: "Items", icon: "ui//file-stack", tab: 0 },
+ { label: "Lists", icon: "ui//layout-list", tab: 2 },
+ { label: "Actions", icon: "ui//mouse-pointer-click", tab: 3 }
+ ];
+ return /* @__PURE__ */ import_react157.default.createElement(import_react157.default.Fragment, null, /* @__PURE__ */ import_react157.default.createElement("div", {
+ className: "mk-header-space"
+ }, /* @__PURE__ */ import_react157.default.createElement("div", {
+ className: "mk-tabs-space"
+ }, tabs.map((f2, i4) => /* @__PURE__ */ import_react157.default.createElement("div", {
+ key: i4,
+ onClick: () => {
+ openSpaceEditorModal(props.superstate, spaceState, f2.tab);
+ },
+ className: `mk-path-info`
+ }, /* @__PURE__ */ import_react157.default.createElement("div", {
+ "aria-label": f2.label,
+ className: "mk-icon-small",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(f2.icon)
}
- if (option2.section == "kit" || option2.section == "base") {
- if (props.treeNode) {
- let node2 = relinkProps(
- "$root",
- props.treeNode.node.schemaId,
- option2.value.node,
- props.treeNode.node.schemaId
- );
- node2 = relinkProps(
- node2.id,
- props.treeNode.node.id,
- node2,
- props.treeNode.node.schemaId
- );
- saveNodes([
- {
- ...node2,
- type: option2.section == "base" ? node2.type : "frame",
- styles: option2.value.node.styles,
- ref: option2.section == "base" ? "" : "spaces://$kit/#*" + option2.value.def.id,
- parentId: props.treeNode.node.parentId,
- schemaId: props.treeNode.node.schemaId,
- id: props.treeNode.node.id,
- rank: props.treeNode.node.rank
- }
- ]).then((f2) => select(props.treeNode.id));
- } else {
- addNode(
- option2.section == "base" ? option2.value.node : {
- ...option2.value.node,
- type: "frame",
- styles: option2.value.node.styles,
- ref: "spaces://$kit/#*" + option2.value.def.id
- },
- instance.exec.node,
- true
- ).then((f2) => select(f2.id));
- }
- } else if (option2.section == "label") {
- if (props.treeNode) {
- saveNodes([
- {
- ...props.treeNode.node,
- type: "text",
- name: textNode.node.name,
- props: {
- ...props.treeNode.node.props,
- value: wrapQuotes(query)
- },
- styles: textNode.node.styles
- }
- ]).then((f2) => select(props.treeNode.id));
- } else {
- addNode(
- {
- ...textNode.node,
- props: {
- value: wrapQuotes(query)
- }
- },
- instance.exec.node,
- true
- ).then((f2) => select(f2.id));
- }
- } else if (option2.section == "flow") {
- if (option2.value.length > 0) {
- if (props.treeNode) {
- saveNodes([
- {
- ...props.treeNode.node,
- type: "flow",
- name: flowNode.node.name,
- props: {
- ...props.treeNode.node.props,
- value: wrapQuotes(option2.value)
- },
- styles: flowNode.node.styles
- }
- ]);
- } else {
- addNode(
- {
- ...flowNode.node,
- props: {
- value: wrapQuotes(option2.value)
- }
- },
- instance.exec.node,
- true
- );
- }
- } else {
- newPathInSpace(props.superstate, spaceState, "md", query, true).then(
- (f2) => {
- if (props.treeNode) {
- saveNodes([
- {
- ...props.treeNode.node,
- name: flowNode.node.name,
- type: "flow",
- props: {
- value: wrapQuotes(f2)
- },
- styles: {
- ...flowNode.node.styles
- }
- }
- ]);
- } else {
- addNode(
- {
- ...flowNode.node,
- props: {
- value: wrapQuotes(f2)
- }
- },
- instance.exec.node,
- true
- );
- }
- }
- );
- }
- } else if (option2.section == "list") {
- createInlineTable(props.superstate, spaceState.path).then((f2) => {
- if (props.treeNode) {
- saveNodes([
- {
- ...props.treeNode.node,
- name: contextNode.node.name,
- type: "space",
- props: { value: wrapQuotes(`${spaceState.path}/#*${f2}`) },
- styles: {
- ...contextNode.node.styles
- }
- }
- ]);
- } else {
- addNode(
- {
- ...textNode.node,
- name: contextNode.node.name,
- type: "space",
- props: { value: wrapQuotes(`${spaceState.path}/#^${f2}`) }
- },
- instance.exec.node,
- true
- );
+ }), f2.label))), /* @__PURE__ */ import_react157.default.createElement("div", {
+ className: "mk-props-contexts"
+ }, /* @__PURE__ */ import_react157.default.createElement(PathContextList, {
+ superstate: props.superstate,
+ color: "var(--tag-background)",
+ path: pathState.path
+ }), /* @__PURE__ */ import_react157.default.createElement(PropertiesView, {
+ superstate: props.superstate,
+ spaces: props.spaces.map((f2) => f2.path),
+ force: true,
+ excludeKeys: [
+ ...FMMetadataKeys(props.superstate.settings),
+ ...FMSpaceKeys(props.superstate.settings)
+ ],
+ editable: true
+ }))));
+};
+
+// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx
+var NoteSpacesBar = (props) => {
+ const { addToSpace, removeFromSpace, pathState } = (0, import_react158.useContext)(PathContext);
+ const showContextMenu = (e5, path2) => {
+ const space2 = props.superstate.spacesIndex.get(path2);
+ if (!space2)
+ return;
+ e5.preventDefault();
+ const menuOptions = [];
+ menuOptions.push({
+ name: i18n_default.menu.openSpace,
+ icon: "ui//layout-grid",
+ onClick: (e6) => {
+ props.superstate.ui.openPath(space2.path, e6.metaKey);
+ }
+ });
+ menuOptions.push({
+ name: i18n_default.labels.newProperty,
+ icon: "ui//plus",
+ onClick: (e6) => {
+ newProperty(e6, space2.path);
+ }
+ });
+ if (removeFromSpace)
+ menuOptions.push({
+ name: i18n_default.menu.removeFromSpace,
+ icon: "ui//trash",
+ onClick: (e6) => {
+ removeFromSpace(space2.path);
}
});
+ const offset2 = e5.target.getBoundingClientRect();
+ props.superstate.ui.openMenu(
+ offset2,
+ defaultMenu(props.superstate.ui, menuOptions)
+ );
+ };
+ const spacesFromPath = (path2) => {
+ return [...props.superstate.spacesMap.get(path2)].map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2 && f2.type != "default" && f2.path != "/").map((f2) => props.superstate.pathsIndex.get(f2.path)).sort(
+ (f2, k2) => path2.startsWith(f2.path) ? -1 : path2.startsWith(k2.path) ? 1 : 0
+ ).filter((f2) => f2);
+ };
+ const spacePathStates = (0, import_react158.useMemo)(
+ () => spacesFromPath(pathState.path),
+ [pathState]
+ );
+ const spaces2 = (0, import_react158.useMemo)(
+ () => [...props.superstate.spacesMap.get(pathState?.path) ?? []].map((f2) => props.superstate.spacesIndex.get(f2)?.space).filter((f2) => f2),
+ [pathState]
+ );
+ const saveField = (source, field) => {
+ if (source == "fm") {
+ props.superstate.spaceManager.addProperty(pathState.path, field);
+ return;
}
+ props.superstate.spaceManager.addSpaceProperty(source, field);
};
- const clear = () => {
- setQuery("");
- ref2.current.blur();
- ref2.current.innerHTML = "";
+ const newProperty = (e5, space2) => {
+ const offset2 = e5.target.getBoundingClientRect();
+ showNewPropertyMenu(
+ props.superstate,
+ offset2,
+ [],
+ [],
+ (source, field) => saveField(space2, field),
+ defaultContextSchemaID,
+ space2
+ );
};
- (0, import_react168.useEffect)(() => {
- if (ref2.current && lastCreatedId && lastCreatedId == props.treeNode?.node.id) {
- ref2.current.focus();
- setLastCreatedId(null);
+ const showAddMenu = (e5) => {
+ const offset2 = e5.target.getBoundingClientRect();
+ showSpacesMenu(
+ offset2,
+ props.superstate,
+ (link, isNew) => {
+ if (isNew) {
+ if (link.charAt(0) == "#") {
+ addTagToPath(props.superstate, pathState.path, link);
+ } else {
+ createSpace(props.superstate, link, { links: [pathState.path] });
+ }
+ } else {
+ addToSpace(link);
+ }
+ },
+ false,
+ true
+ );
+ };
+ return /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null, /* @__PURE__ */ import_react158.default.createElement("div", {
+ className: "mk-props-contexts"
+ }, /* @__PURE__ */ import_react158.default.createElement("div", {
+ className: "mk-path-context-row"
+ }, /* @__PURE__ */ import_react158.default.createElement("div", {
+ className: "mk-props-contexts-space-list"
+ }, spacePathStates.map((f2, i4) => /* @__PURE__ */ import_react158.default.createElement("div", {
+ key: i4,
+ className: "mk-props-contexts-space-name",
+ onContextMenu: (e5) => showContextMenu(e5, f2.path),
+ onClick: (e5) => props.superstate.ui.openPath(f2.path, e5.metaKey),
+ style: f2.label?.color?.length > 0 ? {
+ "--tag-background": f2.label?.color,
+ "--tag-color": "var(--color-white)"
+ } : {}
+ }, /* @__PURE__ */ import_react158.default.createElement("div", {
+ className: `mk-icon-xsmall`,
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(f2.label?.sticker)
}
- }, [ref2, selection2, props.treeNode]);
- return /* @__PURE__ */ import_react168.default.createElement("div", {
- className: "mk-node-new"
- }, /* @__PURE__ */ import_react168.default.createElement(Suggester, {
+ }), f2.name)), /* @__PURE__ */ import_react158.default.createElement("div", {
+ className: "mk-props-contexts-space-name",
+ onClick: (e5) => showAddMenu(e5),
+ style: {
+ opacity: 0.5
+ }
+ }, /* @__PURE__ */ import_react158.default.createElement("span", {
+ className: "mk-icon-xsmall",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//plus")
+ }
+ }), i18n_default.buttons.addToSpace))), pathState.type == "space" ? /* @__PURE__ */ import_react158.default.createElement(SpaceHeaderView, {
superstate: props.superstate,
- placeholder: i18n_default.hintText.newFrame,
- suggestions,
- onChange: (query2) => setQuery(query2),
- onSelect: (option2) => {
- selectOption(option2);
- },
- onFocus: () => {
- select(null);
- },
- ref: ref2,
- onDelete: () => props.treeNode ? deleteNode(props.treeNode?.node) : clear(),
- onSelectSection: (option2) => setType(option2)
- }));
+ spacePathStates,
+ spaces: spaces2
+ }) : /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null, /* @__PURE__ */ import_react158.default.createElement(PathContextList, {
+ superstate: props.superstate,
+ color: "var(--tag-background)",
+ path: pathState.path
+ }), /* @__PURE__ */ import_react158.default.createElement(PropertiesView, {
+ superstate: props.superstate,
+ spaces: spaces2.map((f2) => f2.path),
+ force: true,
+ excludeKeys: [
+ ...FMMetadataKeys(props.superstate.settings),
+ ...FMSpaceKeys(props.superstate.settings)
+ ],
+ editable: true
+ }))));
};
-// src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx
-var defaultFrameStyles = {
- position: "relative"
-};
-var FrameEditorInner = (0, import_react169.memo)(function FrameEditorInner2(props) {
- const nodeProps = {
- superstate: props.superstate,
- treeNode: props.treeNode,
- state: props.state
+// src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx
+var import_react161 = __toESM(require_react());
+
+// src/core/react/components/SpaceView/TitleComponent.tsx
+var import_react159 = __toESM(require_react());
+var TitleComponent = (props) => {
+ const { pathState } = (0, import_react159.useContext)(PathContext);
+ const { spaceState } = (0, import_react159.useContext)(SpaceContext);
+ const fileNameRef = (0, import_react159.useRef)(null);
+ const name317 = (0, import_react159.useMemo)(
+ () => pathState ? props.superstate.settings.spacesUseAlias ? pathState?.displayName : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null,
+ [pathState]
+ );
+ const contentEditable = !props.readOnly && spaceState?.type != "default";
+ const onBlur = (e5) => {
+ const newValue = e5.target.innerText;
+ if (newValue != name317) {
+ if (pathState.path == "/") {
+ props.superstate.settings.systemName = newValue;
+ props.superstate.saveSettings();
+ props.superstate.reloadSpaceByPath("/");
+ return;
+ }
+ if (props.superstate.settings.spacesUseAlias) {
+ updatePrimaryAlias(
+ props.superstate,
+ pathState.path,
+ pathState.metadata.aliases,
+ newValue
+ );
+ } else {
+ renamePathByName(props.superstate, pathState.path, newValue);
+ }
+ }
};
- const { treeNode } = props;
- const { pathState } = (0, import_react169.useContext)(PathContext);
- const { instance } = (0, import_react169.useContext)(FrameInstanceContext);
- return /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, treeNode.node.type == "new" ? /* @__PURE__ */ import_react169.default.createElement(NewNodeView, {
- ...nodeProps
- }) : treeNode.node.type == "input" ? /* @__PURE__ */ import_react169.default.createElement(InputNodeView, {
- ...nodeProps
- }) : treeNode.node.type == "text" ? /* @__PURE__ */ import_react169.default.createElement(TextNodeView, {
- ...nodeProps
- }) : treeNode.node.type == "icon" ? /* @__PURE__ */ import_react169.default.createElement(IconNodeView, {
- ...nodeProps
- }) : treeNode.node.type == "audio" ? /* @__PURE__ */ import_react169.default.createElement(AudioNodeView, {
- ...nodeProps
- }) : treeNode.node.type == "image" ? /* @__PURE__ */ import_react169.default.createElement(ImageNodeView, {
- ...nodeProps
- }) : treeNode.node.type == "space" ? /* @__PURE__ */ import_react169.default.createElement(ContextNodeView, {
- ...nodeProps,
- containerRef: props.containerRef,
- source: pathState.path
- }) : treeNode.node.type == "flow" ? /* @__PURE__ */ import_react169.default.createElement(FlowNodeView, {
- ...nodeProps,
- source: pathState.path,
- containerRef: props.containerRef
- }) : treeNode.node.type == "content" ? /* @__PURE__ */ import_react169.default.createElement(ContentNodeView, {
- editable: !props.treeNode.isRef
- }, props.treeNode.children.map(
- (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react169.default.createElement(FrameEditorNodeView, {
- superstate: props.superstate,
- key: c3.id,
- treeNode: c3,
- instance: props.instance,
- containerRef: props.containerRef
- }, props.children)
- ), props.children) : (treeNode.node.type == "column" || treeNode.node.type == "container") && treeNode.children.length == 0 ? null : props.treeNode.id == props.instance.exec.id || treeNode.node.type == "column" || treeNode.node.type == "container" ? props.treeNode.children.map(
- (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react169.default.createElement(FrameEditorNodeView, {
- superstate: props.superstate,
- key: c3.id,
- treeNode: c3,
- instance: props.instance,
- containerRef: props.containerRef
- }, props.children)
- ) : /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(FrameSelectionProvider, {
+ const onKeyPress = (e5) => {
+ e5.stopPropagation();
+ };
+ const onKeyUp = (e5) => {
+ e5.stopPropagation();
+ };
+ const onKeyDown = (e5) => {
+ e5.stopPropagation();
+ if (e5.key == "a" && e5.metaKey) {
+ e5.preventDefault();
+ const selection2 = window.getSelection();
+ const range2 = document.createRange();
+ range2.selectNodeContents(e5.target);
+ selection2.removeAllRanges();
+ selection2.addRange(range2);
+ }
+ if (e5.key == "Enter") {
+ e5.target.blur();
+ e5.preventDefault();
+ }
+ if (e5.key == "Escape") {
+ e5.target.blur();
+ e5.preventDefault();
+ }
+ };
+ const hasSticker = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0;
+ const hasBanner = pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner];
+ return pathState && /* @__PURE__ */ import_react159.default.createElement(import_react159.default.Fragment, null, props.superstate.settings.spacesStickers && /* @__PURE__ */ import_react159.default.createElement("div", {
+ className: "mk-header-icon",
+ style: hasBanner ? {
+ "--label-color": "var(--mk-ui-background)"
+ } : {}
+ }, hasSticker ? /* @__PURE__ */ import_react159.default.createElement(PathStickerContainer, {
superstate: props.superstate,
- id: treeNode.id,
- editMode: props.editMode
- }, treeNode.children.map(
- (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react169.default.createElement(FrameEditorNodeView, {
- superstate: props.superstate,
- key: c3.id,
- treeNode: c3,
- instance: props.instance,
- containerRef: props.containerRef
- }, props.children)
- ))));
-});
-var FrameEditorNodeView = (props) => {
- const {
- selectionMode,
- selectable,
- selected: _selected,
- isParentToSelection,
- select,
- selection: selection2
- } = (0, import_react169.useContext)(FrameSelectionContext);
- const {
- updateNode,
- addNode,
- deleteNode,
- nodes,
- selectedSlide
- } = (0, import_react169.useContext)(FramesEditorRootContext);
- const { setDragNode } = (0, import_react169.useContext)(WindowContext);
- const { saveState, selectableNodeBounds, id: id3 } = (0, import_react169.useContext)(FrameInstanceContext);
- const { dragActive } = (0, import_react169.useContext)(WindowContext);
- const editMode = props.treeNode.isRef ? 0 /* Read */ : props.treeNode.id == props.instance.exec.id ? selectionMode : 3 /* Group */;
- const selected = selection2.some((f2) => f2 == props.treeNode.id);
- const isSelectable = selectable && !props.treeNode.isRef && !selected;
- const state = props.instance.state[props.treeNode.id];
- const deltas = (0, import_react169.useMemo)(
- () => selectedSlide ? nodes.find(
- (f2) => f2.ref == props.treeNode.id && selectedSlide == f2.parentId
- ) ?? null : null,
- [nodes, props.treeNode, selectedSlide]
+ path: pathState.path
+ }) : /* @__PURE__ */ import_react159.default.createElement("button", {
+ className: "mk-inline-button",
+ onClick: (e5) => props.superstate.ui.openPalette(
+ (_props) => /* @__PURE__ */ import_react159.default.createElement(StickerModal_default, {
+ ui: props.superstate.ui,
+ hide: _props.hide,
+ selectedSticker: (emoji) => savePathIcon(props.superstate, pathState.path, emoji)
+ })
+ )
+ }, /* @__PURE__ */ import_react159.default.createElement("div", {
+ className: "mk-icon-xsmall",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//smile")
+ }
+ }), i18n_default.buttons.addIcon), /* @__PURE__ */ import_react159.default.createElement("span", null), !hasBanner && /* @__PURE__ */ import_react159.default.createElement("button", {
+ className: "mk-inline-button",
+ onClick: (e5) => props.superstate.ui.openPalette(
+ (_props) => /* @__PURE__ */ import_react159.default.createElement(ImageModal_default, {
+ superstate: props.superstate,
+ hide: _props.hide,
+ selectedPath: (image) => savePathBanner(
+ props.superstate,
+ pathState.path,
+ image
+ )
+ })
+ )
+ }, /* @__PURE__ */ import_react159.default.createElement("div", {
+ className: "mk-icon-xsmall",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker("ui//mk-make-image")
+ }
+ }), i18n_default.buttons.addCover)), /* @__PURE__ */ import_react159.default.createElement("div", {
+ className: "mk-title-container"
+ }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react159.default.createElement("div", {
+ className: "mk-title-prefix"
+ }, "#") : "", /* @__PURE__ */ import_react159.default.createElement("div", {
+ className: "mk-inline-title inline-title",
+ ref: fileNameRef,
+ contentEditable,
+ onBlur,
+ onDrop: (e5) => e5.preventDefault(),
+ onKeyDown,
+ onKeyPress,
+ onKeyUp,
+ dangerouslySetInnerHTML: {
+ __html: name317
+ }
+ })));
+};
+
+// src/core/react/components/MarkdownEditor/BannerView.tsx
+var import_react160 = __toESM(require_react());
+var BannerView = (props) => {
+ const [hasSticker, setHasSticker] = (0, import_react160.useState)(false);
+ const { pathState } = (0, import_react160.useContext)(PathContext);
+ const [banner, setBanner] = (0, import_react160.useState)(
+ props.superstate.spaceManager.uriByString(
+ pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner]
+ )
);
- const treeNode = (0, import_react169.useMemo)(
- () => deltas ? {
- ...props.treeNode,
- node: {
- ...props.treeNode.node,
- styles: {
- ...props.treeNode.node.styles,
- ...deltas.styles
- },
- props: {
- ...props.treeNode.node.props,
- ...deltas.props
- },
- actions: {
- ...props.treeNode.node.actions,
- ...deltas.actions
+ (0, import_react160.useEffect)(() => {
+ const banner2 = props.superstate.spaceManager.uriByString(
+ pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner]
+ );
+ const hasSticker2 = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0;
+ setHasSticker(hasSticker2);
+ if (banner2) {
+ setBanner(banner2);
+ } else {
+ setBanner(null);
+ }
+ }, [pathState]);
+ const offset2 = pathState?.metadata.property?.banner_y ? `${(parseFloat(pathState?.metadata.property?.banner_y) * 100).toString()}%` : "center";
+ const triggerBannerContextMenu = (e5) => {
+ e5.preventDefault();
+ const menuOptions = [
+ {
+ name: i18n_default.buttons.changeBanner,
+ value: "change",
+ icon: "ui//image",
+ onClick: (ev) => {
+ props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react160.default.createElement(ImageModal_default, {
+ superstate: props.superstate,
+ hide: _props.hide,
+ selectedPath: (image) => savePathBanner(props.superstate, pathState.path, image)
+ }));
+ }
+ },
+ {
+ name: i18n_default.buttons.removeBanner,
+ value: "remove",
+ icon: "ui//file-minus",
+ onClick: (ev) => {
+ if (props.superstate.spacesIndex.has(pathState.path)) {
+ props.superstate.spaceManager.deleteProperty(
+ props.superstate.spacesIndex.get(pathState.path).defPath,
+ props.superstate.settings.fmKeyBanner
+ );
+ }
+ props.superstate.spaceManager.deleteProperty(
+ pathState.path,
+ props.superstate.settings.fmKeyBanner
+ );
}
}
- } : props.treeNode,
- [deltas, props.treeNode]
- );
- const { frameSchema } = (0, import_react169.useContext)(FramesMDBContext);
- const dragId = id3 + frameSchema.id + props.treeNode.id;
- const [hover, setHover] = (0, import_react169.useState)(false);
- const [isMouseOverElement, setIsMouseOverElement] = import_react169.default.useState(false);
- const [isMouseOverPortal, setIsMouseOverPortal] = import_react169.default.useState(false);
- const draggable = props.treeNode.editorProps.dragMode == 1 /* DragHandle */ || (isSelectable && !isParentToSelection || selected) && props.treeNode.editorProps.dragMode != 0;
- const {
- attributes,
- listeners,
- setNodeRef: setDraggableNodeRef,
- transform
- } = useDraggable({
- id: dragId,
- data: {
- id: dragId,
- root: id3,
- type: "node",
- parent: props.treeNode.node.parentId,
- frame: frameSchema.id,
- node: props.treeNode.id
+ ];
+ props.superstate.ui.openMenu(
+ {
+ x: e5.clientX,
+ y: e5.clientY,
+ width: 0,
+ height: 0
+ },
+ defaultMenu(props.superstate.ui, menuOptions)
+ );
+ return false;
+ };
+ return banner ? /* @__PURE__ */ import_react160.default.createElement(import_react160.default.Fragment, null, /* @__PURE__ */ import_react160.default.createElement("div", {
+ className: `mk-space-banner`,
+ onContextMenu: triggerBannerContextMenu,
+ style: {
+ "--mk-banner-height": props.superstate.settings.bannerHeight + "px",
+ backgroundImage: `url("${banner.scheme == "vault" ? props.superstate.ui.getUIPath(banner.basePath) : banner.fullPath}")`,
+ backgroundPositionY: offset2
+ }
+ }), /* @__PURE__ */ import_react160.default.createElement("div", {
+ className: `mk-spacer`,
+ style: {
+ "--mk-header-height": ((isTouchScreen(props.superstate.ui) ? 1 : 0) * 26 + (props.superstate.settings.bannerHeight - 62) + (!props.superstate.settings.spacesStickers || props.superstate.settings.inlineContextNameLayout == "horizontal" ? 50 : hasSticker ? 0 : 30)).toString() + "px"
},
- disabled: !draggable
- });
- const ref2 = (0, import_react169.useRef)(null);
- const onLongPress = () => {
- if (isSelectable && props.treeNode.id != props.instance.exec.id) {
- select(treeNode.node.id);
- return;
+ onContextMenu: (e5) => e5.preventDefault()
+ })) : /* @__PURE__ */ import_react160.default.createElement(import_react160.default.Fragment, null);
+};
+
+// src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx
+var MarkdownHeaderView = (props) => {
+ const { pathState } = (0, import_react161.useContext)(PathContext);
+ const [collapsed, setCollapsed] = (0, import_react161.useState)(
+ !props.superstate.settings.inlineContextExpanded
+ );
+ (0, import_react161.useEffect)(() => {
+ props.superstate.settings.inlineContextExpanded = !collapsed;
+ props.superstate.saveSettings();
+ }, [collapsed]);
+ (0, import_react161.useLayoutEffect)(() => {
+ props.editorView?.requestMeasure();
+ }, []);
+ return pathState && /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null, /* @__PURE__ */ import_react161.default.createElement("div", {
+ className: "mk-path-context-component"
+ }, /* @__PURE__ */ import_react161.default.createElement("div", {
+ className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}`
+ }, /* @__PURE__ */ import_react161.default.createElement(BannerView, {
+ superstate: props.superstate
+ }), /* @__PURE__ */ import_react161.default.createElement(TitleComponent, {
+ superstate: props.superstate,
+ readOnly: !props.editable
+ }), /* @__PURE__ */ import_react161.default.createElement("div", {
+ style: { position: "relative" }
+ }, /* @__PURE__ */ import_react161.default.createElement("div", {
+ className: "mk-fold"
+ }, /* @__PURE__ */ import_react161.default.createElement(CollapseToggle, {
+ superstate: props.superstate,
+ collapsed,
+ onToggle: (c3) => setCollapsed(c3)
+ })))), props.editable && !collapsed && /* @__PURE__ */ import_react161.default.createElement(NoteSpacesBar, {
+ superstate: props.superstate
+ })));
+};
+
+// src/core/react/components/Navigator/Navigator.tsx
+var import_react162 = __toESM(require_react());
+var Navigator = (props) => {
+ return /* @__PURE__ */ import_react162.default.createElement("div", {
+ className: "mk-sidebar"
+ }, /* @__PURE__ */ import_react162.default.createElement(SidebarProvider, {
+ superstate: props.superstate
+ }, /* @__PURE__ */ import_react162.default.createElement(MainList, {
+ superstate: props.superstate
+ })));
+};
+
+// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentWrapper.tsx
+var import_react163 = __toESM(require_react());
+var import_react164 = __toESM(require_react());
+var SpaceFragmentTitleComponent = (props) => {
+ const { pathState } = (0, import_react164.useContext)(PathContext);
+ const fileNameRef = (0, import_react164.useRef)(null);
+ const contentEditable = true;
+ const onBlur = (e5) => {
+ const newValue = e5.target.innerHTML;
+ if (newValue != props.name) {
+ props.saveName(newValue);
}
};
- const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false;
- const nodeProps = {
- superstate: props.superstate,
- treeNode,
- state
+ const onKeyPress = (e5) => {
+ e5.stopPropagation();
};
- const saveStyles = (size2) => {
- updateNode(treeNode.node, {
- styles: { ...size2 }
- });
+ const onKeyUp = (e5) => {
+ e5.stopPropagation();
};
- const onClick = (e5) => {
- if (isSelectable && (selectionMode != 1 /* Page */ || isParentToSelection && props.treeNode.id != props.instance.exec.id)) {
- if (e5.shiftKey) {
- select(treeNode.node.id, true);
- } else {
- select(treeNode.node.id);
+ const onKeyDown = (e5) => {
+ e5.stopPropagation();
+ if (e5.key == "a" && e5.metaKey) {
+ e5.preventDefault();
+ const selection2 = window.getSelection();
+ const range2 = document.createRange();
+ range2.selectNodeContents(e5.target);
+ selection2.removeAllRanges();
+ selection2.addRange(range2);
+ }
+ if (e5.key == "Enter") {
+ e5.target.blur();
+ e5.preventDefault();
+ }
+ if (e5.key == "Escape") {
+ e5.target.blur();
+ e5.preventDefault();
+ }
+ };
+ const triggerStickerMenu = (e5) => {
+ props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react163.default.createElement(StickerModal_default, {
+ ui: props.superstate.ui,
+ hide: _props.hide,
+ selectedSticker: (emoji) => props.saveSticker(emoji)
+ }));
+ };
+ return /* @__PURE__ */ import_react163.default.createElement("div", null, /* @__PURE__ */ import_react163.default.createElement("div", {
+ className: "mk-header-icon"
+ }), /* @__PURE__ */ import_react163.default.createElement("div", {
+ className: "mk-title-container"
+ }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react163.default.createElement("div", {
+ className: "mk-title-prefix"
+ }, "#") : "", /* @__PURE__ */ import_react163.default.createElement("div", {
+ className: "mk-inline-title inline-title",
+ ref: fileNameRef,
+ contentEditable,
+ onBlur,
+ onDrop: (e5) => e5.preventDefault(),
+ onKeyDown,
+ onKeyPress,
+ onKeyUp,
+ dangerouslySetInnerHTML: {
+ __html: props.name
+ }
+ })));
+};
+var SpaceFragmentWrapper = (props) => {
+ const [schema, setSchema] = import_react163.default.useState(null);
+ (0, import_react163.useEffect)(() => {
+ const uri = props.superstate.spaceManager.uriByString(props.path);
+ if (uri.refType == "context") {
+ const schema2 = props.superstate.contextsIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref);
+ if (schema2) {
+ setSchema({
+ id: schema2.id,
+ name: schema2.name,
+ type: "context",
+ path: uri.basePath
+ });
}
- e5.stopPropagation();
- return;
- } else if (props.treeNode.id == props.instance.exec.id) {
- select(null);
}
- if (!selected) {
- if (e5.detail === 1) {
- if (typeof state.actions?.onClick == "function") {
- state.actions?.onClick(
- e5,
- null,
- props.instance.state,
- (s4) => saveState(s4, props.instance),
- props.superstate.api
- );
- e5.stopPropagation();
- }
- } else if (e5.detail === 2 || isTouchScreen(props.superstate.ui)) {
- if (typeof state.actions?.onDoubleClick == "function") {
- state.actions?.onDoubleClick(
- e5,
- null,
- props.instance.state,
- (s4) => saveState(s4, props.instance),
- props.superstate.api
- );
- e5.stopPropagation();
- }
+ if (uri.refType == "frame") {
+ const schema2 = props.superstate.framesIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref);
+ if (schema2) {
+ const frameSchema = mdbSchemaToFrameSchema(schema2);
+ setSchema({
+ id: schema2.id,
+ name: frameSchema.name,
+ sticker: frameSchema.def?.icon,
+ type: "frame",
+ path: uri.basePath
+ });
}
- } else {
- e5.stopPropagation();
}
- };
- (0, import_react169.useEffect)(() => {
- selection2.some((f2) => f2 != props.treeNode.id) && setHover(false);
- }, [selection2, props.treeNode]);
- const [canEditLayout, setCanEditLayout] = (0, import_react169.useState)(false);
- (0, import_react169.useEffect)(() => {
- if (selected && isTouchScreen(props.superstate.ui) && (props.treeNode.node.type == "group" || props.treeNode.node.type == "image" || selectionMode >= 3 /* Group */)) {
- setCanEditLayout(true);
- } else {
- if (selected && canEditLayout) {
- } else {
- setCanEditLayout(false);
+ if (uri.refType == "action") {
+ const schema2 = props.superstate.actionsIndex.get(uri.path)?.find((s4) => s4.schema.id == uri.ref)?.schema;
+ if (schema2) {
+ setSchema({
+ id: schema2.id,
+ name: schema2.name,
+ sticker: schema2.def?.icon,
+ type: "action",
+ path: uri.basePath
+ });
}
}
- }, [props.treeNode, selectionMode, selected]);
- const dropMode = props.treeNode.editorProps.dropMode;
- const computedStyle = ref2.current && getComputedStyle(ref2.current);
- const clientWidth = ref2.current && ref2.current.clientWidth;
- const clientHeight = ref2.current && ref2.current.clientHeight;
- const [childNodeSizes, setChildNodeSizes] = (0, import_react169.useState)([]);
- const calculateRectInContainer = (rect, containerRect2) => {
- return {
- left: rect.x - containerRect2.x,
- top: rect.y - containerRect2.y,
- width: rect.width,
- height: rect.height
- };
- };
- (0, import_react169.useEffect)(() => {
- if (!ref2.current || !props.containerRef?.current) {
- return () => null;
+ }, [props.path]);
+ const saveName = (name317) => {
+ if (schema.type == "context") {
+ props.superstate.spaceManager.saveTableSchema(
+ schema.path,
+ schema.id,
+ (schema2) => ({ ...schema2, name: name317 })
+ );
}
- if (props.treeNode.node.parentId == props.instance.exec.id)
- selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer(
- ref2.current.getBoundingClientRect(),
- props.containerRef.current.getBoundingClientRect()
+ if (schema.type == "frame") {
+ props.superstate.spaceManager.saveFrameSchema(
+ schema.path,
+ schema.id,
+ (schema2) => ({ ...schema2, name: name317 })
);
- setChildNodeSizes(() => {
- const sizes = Array.from(ref2.current?.children ?? []).map(
- (node2) => {
- return {
- x: node2.offsetLeft,
- y: node2.offsetTop,
- width: node2.clientWidth,
- height: node2.clientHeight
+ }
+ if (schema.type == "action") {
+ props.superstate.spaceManager.saveCommand(
+ schema.path,
+ schema.id,
+ (command) => ({ ...command, schema: { ...command.schema, name: name317 } })
+ );
+ }
+ };
+ const saveSticker = (name317) => {
+ if (schema.type == "frame") {
+ props.superstate.spaceManager.saveFrameSchema(
+ schema.path,
+ schema.id,
+ (schema2) => {
+ const frameSchema = mdbSchemaToFrameSchema(schema2);
+ const newFrameSchema = {
+ ...frameSchema,
+ def: { ...frameSchema.def, icon: name317 }
};
+ return frameSchemaToTableSchema(newFrameSchema);
}
);
- return sizes;
- });
- const resizeObserver = new ResizeObserver(() => {
- if (props.treeNode.node.parentId == props.instance.exec.id && ref2.current)
- selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer(
- ref2.current.getBoundingClientRect(),
- props.containerRef.current.getBoundingClientRect()
- );
- setChildNodeSizes(() => {
- const sizes = Array.from(ref2.current?.children ?? []).map(
- (node2) => {
- return {
- x: node2.offsetLeft,
- y: node2.offsetTop,
- width: node2.clientWidth,
- height: node2.clientHeight
- };
- }
- );
- return sizes;
- });
- });
- resizeObserver.observe(ref2.current);
- return () => resizeObserver.disconnect();
- }, [state]);
- const nodeRect = ref2.current?.getBoundingClientRect();
- const containerRect = props.containerRef?.current?.getBoundingClientRect();
- const styles2 = {
- ...defaultFrameStyles,
- ...props.treeNode.node.type != "flow" ? state?.styles : {
- width: state?.styles?.width,
- height: state?.styles?.height,
- "--max-width": state?.styles?.["--max-width"]
- },
- "--translate-x": `${transform?.x ?? 0}px`,
- "--translate-y": `${transform?.y ?? 0}px`
- };
- useDndMonitor({
- onDragStart: (e5) => {
- if (e5.active?.id == dragId) {
- setDragNode(
- /* @__PURE__ */ import_react169.default.createElement("div", {
- style: {
- width: ref2.current.clientWidth
+ }
+ if (schema.type == "action") {
+ props.superstate.spaceManager.saveCommand(
+ schema.path,
+ schema.id,
+ (command) => {
+ return {
+ ...command,
+ schema: {
+ ...command.schema,
+ def: { ...command.schema?.def ?? {}, icon: name317 }
}
- }, /* @__PURE__ */ import_react169.default.createElement(FrameView, {
- superstate: props.superstate,
- treeNode: props.treeNode,
- instance: props.instance,
- saveState: null
- }))
- );
- }
+ };
+ }
+ );
}
+ };
+ return /* @__PURE__ */ import_react163.default.createElement("div", {
+ className: "mk-editor-space-fragment markdown-source-view mod-cm6 is-readable-line-width"
+ }, /* @__PURE__ */ import_react163.default.createElement("div", {
+ className: "mk-editor-header"
+ }, schema && /* @__PURE__ */ import_react163.default.createElement(SpaceFragmentTitleComponent, {
+ superstate: props.superstate,
+ readOnly: true,
+ name: schema.name,
+ sticker: schema.sticker,
+ saveName,
+ saveSticker
+ })), props.children);
+};
+
+// src/adapters/obsidian/utils/createTable.ts
+var createTable2 = (object, columns) => {
+ const columnNames = columns.map((f2) => f2.name);
+ const base2 = "|";
+ let outputString = base2 + columnNames.join(base2) + "|\n";
+ columns.forEach((f2) => {
+ outputString += base2 + "----";
});
- return /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, (!hidden || !props.treeNode.isRef) && /* @__PURE__ */ import_react169.default.createElement("div", {
- ref: (el) => {
- ref2.current = el;
- selectionMode > 1 /* Page */ && draggable && setDraggableNodeRef(el);
- },
- onContextMenu: () => isTouchScreen(props.superstate.ui) && onLongPress(),
- className: (0, import_classnames11.default)(
- `mk-frame-edit ${parseStylesToClass(state?.styles)}`,
- isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable",
- selected && selectionMode == 1 /* Page */ && "mk-selected"
- ),
- "data-path": treeNode.id,
- "data-type": treeNode.node.type,
- onMouseEnter: () => {
- setHover(true);
- setIsMouseOverElement(true);
- },
- onMouseLeave: () => {
- if (!isMouseOverPortal) {
- setHover(false);
- }
- setIsMouseOverElement(false);
- },
- ...{ onClick },
- ...selectionMode > 1 /* Page */ ? { ...listeners, ...attributes } : {},
- style: styles2
- }, /* @__PURE__ */ import_react169.default.createElement(FrameEditorInner, {
- ...nodeProps,
- containerRef: props.containerRef,
- editMode,
- instance: props.instance
- }, props.children)), state && props.treeNode.node.type != "new" && props.containerRef?.current && selectionMode > 0 /* Read */ && ref2.current && (0, import_react_dom11.createPortal)(
- /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement("div", {
- style: {
- position: "absolute",
- top: nodeRect.top - containerRect.top,
- left: nodeRect.left - containerRect.left,
- width: clientWidth,
- height: clientHeight,
- pointerEvents: "none"
- },
- className: (0, import_classnames11.default)(
- !dragActive && isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable",
- !dragActive && selected && (selectionMode != 1 /* Page */ || props.treeNode.node.type == "group") && "mk-f-edit",
- !dragActive && hover && selectionMode != 1 /* Page */ && "mk-f-edit-hover"
- ),
- onClick: (e5) => {
- if (isSelectable && selectionMode != 1 /* Page */) {
- if (e5.shiftKey) {
- select(treeNode.node.id, true);
- } else {
- select(treeNode.node.id);
- }
- e5.stopPropagation();
- return;
+ outputString += base2 + "\n";
+ object.forEach((row2) => {
+ outputString += columnNames.map((c3) => base2 + row2[c3]).join("") + "|\n";
+ });
+ return outputString;
+};
+
+// src/adapters/obsidian/ui/editors/EmbedContextView.tsx
+var import_obsidian = require("obsidian");
+var import_react165 = __toESM(require_react());
+var EMBED_CONTEXT_VIEW_TYPE = "mk-space-embed";
+var EmbedContextView = class extends import_obsidian.ItemView {
+ constructor(leaf, plugin) {
+ super(leaf);
+ this.navigation = true;
+ this.plugin = plugin;
+ }
+ getViewType() {
+ return EMBED_CONTEXT_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_react165.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();
}
- }
- }, props.treeNode.editorProps.resizeMode == 2 /* ResizeColumn */ && /* @__PURE__ */ import_react169.default.createElement(FrameResizer, {
- size: state?.styles,
- superstate: props.superstate,
- resizeMode: props.treeNode.editorProps.resizeMode,
- resize: saveStyles,
- clientSize: {
- width: clientWidth,
- height: clientHeight
- }
- }), dragActive && (selectionMode == 1 /* Page */ || selectionMode == 3 /* Group */) && dropMode > 0 /* DropModeNone */ && /* @__PURE__ */ import_react169.default.createElement(FrameEditorDropZone, {
- parentId: treeNode.node.parentId,
- superstate: props.superstate,
- height: clientHeight,
- width: clientWidth,
- node: treeNode.node.id,
- id: dragId,
- mode: dropMode,
- insertMode: treeNode.node.type == "group" ? 1 : treeNode.node.type == "space" ? -1 : 0
- }), canEditLayout && /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(FrameResizer, {
- superstate: props.superstate,
- resizeMode: 1 /* ResizeSelected */,
- size: state?.styles,
- resize: saveStyles,
- clientSize: {
- width: clientWidth,
- height: clientHeight
- }
- }), /* @__PURE__ */ import_react169.default.createElement(FrameCorners, {
- styles: state?.styles,
- saveStyles,
- clientSize: {
- width: clientWidth,
- height: clientHeight
- }
- }), (treeNode.node.type == "group" || treeNode.node.type == "content") && (state.styles?.layout == "row" || state.styles?.layout == "column") && /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(FrameGapHandle, {
- childSizes: childNodeSizes,
- clientSize: {
- width: clientWidth,
- height: clientHeight,
- paddingBottom: parseInt(
- computedStyle?.paddingBottom ?? "0"
- ),
- paddingLeft: parseInt(
- computedStyle?.paddingLeft ?? "0"
- ),
- paddingRight: parseInt(
- computedStyle?.paddingRight ?? "0"
- ),
- paddingTop: parseInt(
- computedStyle?.paddingTop ?? "0"
- )
- },
- styles: state?.styles,
- saveStyles,
- direction: state?.styles.layout == "column" ? "column" : "row"
- }), /* @__PURE__ */ import_react169.default.createElement(FramePadding, {
- clientSize: {
- width: clientWidth,
- height: clientHeight
- },
- styles: state?.styles,
- saveStyles
- }))), treeNode.editorProps.dragMode == 1 /* DragHandle */ && (!isTouchScreen(props.superstate.ui) || selected) ? /* @__PURE__ */ import_react169.default.createElement("div", {
- onMouseEnter: () => {
- setIsMouseOverPortal(true);
- setHover(true);
+ );
+ }
+ }
+};
+
+// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx
+var import_obsidian3 = require("obsidian");
+var import_react168 = __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_obsidian2 = require("obsidian");
+var import_classnames11 = __toESM(require_classnames());
+var import_react167 = __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_react166 = __toESM(require_react());
+var RemoteMarkdownHeaderView = (props) => {
+ const { name: name317, fm } = props;
+ const [collapsed, setCollapsed] = (0, import_react166.useState)(false);
+ const tags3 = fm.tags ?? [];
+ const [values2, setValues] = (0, import_react166.useState)({});
+ const [columns, setColumns] = (0, import_react166.useState)([]);
+ (0, import_react166.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_react166.useMemo)(
+ () => ({
+ name: name317,
+ path: name317,
+ displayName: name317,
+ type: "note",
+ label: {
+ sticker: fm.sticker,
+ color: fm.color,
+ name: name317
},
- onMouseLeave: () => {
- if (!isMouseOverElement) {
- setHover(false);
+ metadata: {
+ property: {
+ banner: fm.banner
}
- setIsMouseOverPortal(false);
- },
- className: "mk-editor-frame-hover-menu-container",
- style: {
- zIndex: hover ? "calc(var(--layer-popover) + 1)" : "var(--layer-popover)"
}
- }, /* @__PURE__ */ import_react169.default.createElement(FrameHoverMenu, {
- superstate: props.superstate,
- node: treeNode.node,
- mode: selectionMode == 1 /* Page */ ? 0 : 1,
- selected,
- visible: isTouchScreen(props.superstate.ui) || hover,
- dragRef: setDraggableNodeRef,
- attributes,
- listeners
- })) : /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null)), selection2 && !dragActive && selected && selection2.length == 1 ? /* @__PURE__ */ import_react169.default.createElement(FrameNodeEditorContainer, {
- nodeRect,
- containerRect
- }, /* @__PURE__ */ import_react169.default.createElement(FrameNodeEditor, {
- editLayout: (state2) => setCanEditLayout(state2),
- superstate: props.superstate,
- node: treeNode.node,
- duplicateFrame: () => {
- addNode(treeNode.node, treeNode.node);
- },
- state,
- deleteFrame: () => deleteNode(treeNode.node),
- fields: propertiesForNode(treeNode.node)
- })) : selection2.length > 1 && selection2[0] == treeNode.id ? /* @__PURE__ */ import_react169.default.createElement(FrameNodeEditorContainer, {
- nodeRect,
- containerRect
- }, /* @__PURE__ */ import_react169.default.createElement(FrameMultiNodeEditor, {
- superstate: props.superstate
- })) : null),
- props.containerRef.current
- ));
-};
-
-// src/core/react/components/SpaceView/Frames/ViewNodes/FrameEditorInstance.tsx
-var FrameEditorInstance = (props) => {
- const { spaceInfo } = (0, import_react170.useContext)(SpaceContext);
- const { undoLastAction, redoAction, frameSchema } = (0, import_react170.useContext)(FramesMDBContext);
- const { nodes, addNode, saveNodes, setLastCreatedId } = (0, import_react170.useContext)(
- FramesEditorRootContext
- );
- const { hoverNode, setHoverNode, instance, id: id3 } = (0, import_react170.useContext)(FrameInstanceContext);
- const { selectionMode, selection: selection2, select } = (0, import_react170.useContext)(
- FrameSelectionContext
+ }),
+ [fm, name317]
);
- const resetState = () => {
- setHoverNode(null);
- };
- useDndMonitor({
- onDragOver: ({ active, over }) => {
- const overId = over?.data.current.node;
- if (over?.data.current.root == id3) {
- if (overId)
- setHoverNode({
- id: over?.data.current.id,
- node: over?.data.current.node,
- direction: over?.data.current?.direction
- });
- } else {
- setHoverNode(null);
- }
+ return /* @__PURE__ */ import_react166.default.createElement(PathProvider, {
+ superstate: props.superstate,
+ path: props.name,
+ pathState,
+ readMode: true
+ }, pathState.metadata.property.banner && /* @__PURE__ */ import_react166.default.createElement(BannerView, {
+ superstate: props.superstate
+ }), /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: "mk-path-context-component"
+ }, /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}`
+ }, /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null, fm.sticker ? /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: "mk-header-icon"
+ }, /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: `mk-path-icon`
+ }, /* @__PURE__ */ import_react166.default.createElement("div", {
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(fm.sticker)
+ }
+ }))) : /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null), /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: "mk-inline-title inline-title"
+ }, pathNameToString(name317))))), !collapsed ? /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: "mk-path-context-component"
+ }, /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null, /* @__PURE__ */ import_react166.default.createElement("div", {
+ className: "mk-path-context-section"
+ }, columns.map((f2, i4) => /* @__PURE__ */ import_react166.default.createElement(DataPropertyView, {
+ key: i4,
+ superstate: props.superstate,
+ initialValue: values2[f2.name],
+ row: {},
+ column: { ...f2, table: "" },
+ editMode: 2 /* EditModeView */,
+ updateValue: () => {
},
- onDragCancel: () => {
- resetState();
+ updateFieldValue: (fieldValue, value) => {
},
- onDragEnd: ({ active, over }) => {
- if (!active || !hoverNode) {
- resetState();
- return;
- }
- const overId = hoverNode?.node;
- if (overId == active.data.current.id || hoverNode?.id != over.data.current.id) {
- resetState();
- return;
- }
- const overParentNode = findParent(instance.exec, overId);
- const overNode = overParentNode?.children.find(
- (f2) => f2.id == overId
+ contextTable: {}
+ }))))) : /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null));
+};
+
+// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx
+var FileLinkViewComponent = (props) => {
+ const ref2 = (0, import_react167.useRef)(null);
+ const [markdown, setMarkdown] = (0, import_react167.useState)("");
+ const [fm, setFM] = (0, import_react167.useState)({});
+ (0, import_react167.useEffect)(() => {
+ if (ref2.current) {
+ import_obsidian2.MarkdownRenderer.render(
+ props.app,
+ markdown,
+ ref2.current,
+ props.path,
+ props.component
);
- if (active.data.current.type == "node") {
- const activeParentNode = findParent(
- instance.exec,
- active.data.current.node
- );
- const activeNode = activeParentNode?.children.find(
- (f2) => f2.id == active.data.current.node
- );
- if (overNode && activeNode) {
- const [newNodes, deleteNodes] = dropFrame(
- activeNode.node,
- overNode,
- instance.exec,
- nodes,
- hoverNode.direction
- );
- saveNodes(newNodes, deleteNodes);
- }
- } else if (active.data.current.type == "property") {
- if (active.data.current.path == spaceInfo.path && overNode) {
- const [newNodes, deleteNodes] = dropFrame(
- propertyToNode(
- active.data.current.property,
- active.data.current.context
- ),
- overNode,
- instance.exec,
- nodes,
- hoverNode.direction
- );
- saveNodes(newNodes, deleteNodes);
- }
- } else if (active.data.current.type == "listItem") {
- if (overNode) {
- const [newNodes, deleteNodes] = dropFrame(
- {
- ...flowNode.node,
- props: {
- value: `'${active.data.current.contexts?.$context?.["_keyValue"]}'`
- }
- },
- overNode,
- instance.exec,
- nodes,
- hoverNode.direction
- );
- saveNodes(newNodes, deleteNodes);
- }
- } else if (active.data.current.type == "context") {
- if (overNode) {
- const space3 = props.superstate.spacesIndex.get(
- active.data.current.space
- );
- if (space3) {
- const [newNodes, deleteNodes] = dropFrame(
- {
- ...contextNode.node,
- props: {
- value: wrapQuotes(
- contextPathForSpace(space3, active.data.current.schema)
- )
- }
- },
- overNode,
- instance.exec,
- nodes,
- hoverNode.direction
- );
- saveNodes(newNodes, deleteNodes);
- }
- }
- }
- resetState();
- }
- });
- const propertyToNode = (property, context) => {
- let node2 = textNode.node;
- if (property.type == "boolean") {
- node2 = {
- ...inputNode.node,
- styles: { ...inputNode.node.styles, as: `'checkbox'` }
- };
- } else if (property.type == "link" || property.type == "context" || property.type == "file") {
- node2 = flowNode.node;
- } else if (property.type == "image") {
- node2 = imageNode.node;
- }
- if (node2.type == "input") {
- node2 = {
- ...node2,
- props: { ...node2.props, value: wrapQuotes(property.name) }
- };
- } else {
- if (context.length > 0) {
- node2 = {
- ...node2,
- props: {
- ...node2.props,
- value: `$contexts['${context}']['${property.name}']`
- }
- };
- } else {
- node2 = {
- ...node2,
- props: {
- ...node2.props,
- value: `${frameSchema.id}.props['${property.name}']`
+ 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();
}
- return node2;
- };
- const handleKeyDown = (0, import_react170.useCallback)(
- (e5) => {
- if (e5.key == "ArrowUp") {
- if (selection2.length > 0) {
- const node2 = nodes.find((f2) => f2.id == selection2[0]);
- if (node2) {
- const parent = findParent(instance.exec, node2.id);
- if (parent) {
- const index3 = parent.children.find((f2) => f2.id == node2.id).node.rank;
- if (index3 > 0) {
- select(
- parent.children.find((f2) => f2.node.rank == index3 - 1)?.id
- );
- }
- }
- }
- }
- }
- if (e5.key == "ArrowDown") {
- if (selection2.length > 0) {
- const node2 = nodes.find((f2) => f2.id == selection2[0]);
- if (node2) {
- const parent = findParent(instance.exec, node2.id);
- if (parent) {
- const index3 = parent.children.find((f2) => f2.id == node2.id).node.rank;
- if (index3 < parent.children.length - 1) {
- select(
- parent.children.find((f2) => f2.node.rank == index3 + 1)?.id
- );
- }
- }
- }
- }
- }
- if (e5.key == "Delete" || e5.key == "Backspace") {
- if (selection2.length > 0)
- saveNodes(
- [],
- selection2.map((f2) => nodes.find((g) => g.id == f2)).filter((f2) => f2)
- );
- }
- if (e5.key == "z" && e5.metaKey) {
- if (e5.shiftKey) {
- redoAction();
+ }, [markdown]);
+ (0, import_react167.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_obsidian2.parseYaml)(yamlContent));
} else {
- undoLastAction();
+ setMarkdown(f2);
}
- }
- },
- [selection2, nodes, undoLastAction, redoAction, saveNodes]
- );
- (0, import_react170.useEffect)(() => {
- props.superstate.ui.inputManager.on("keydown", handleKeyDown);
- return () => {
- props.superstate.ui.inputManager.off("keydown", handleKeyDown);
- };
- }, [handleKeyDown]);
- return /* @__PURE__ */ import_react170.default.createElement(import_react170.default.Fragment, null, instance.exec && /* @__PURE__ */ import_react170.default.createElement("div", {
- className: "mk-f-root",
- style: { position: "relative" }
- }, selectionMode >= 3 /* Group */ && /* @__PURE__ */ import_react170.default.createElement("div", {
- className: "mk-f-root-label",
- onClick: (e5) => {
- select(instance.exec.id);
- e5.stopPropagation();
+ });
+ return;
}
- }, instance.exec.node.name), /* @__PURE__ */ import_react170.default.createElement(FrameEditorNodeView, {
- key: spaceInfo.path,
- superstate: props.superstate,
- treeNode: instance.exec,
- instance,
- containerRef: props.containerRef
- }, props.children), instance.exec.children.length == 0 && /* @__PURE__ */ import_react170.default.createElement(NewNodeView, {
+ fetch(props.path).then((res) => res.text()).then((f2) => {
+ const match2 = f2.match(regexYaml);
+ if (match2) {
+ setMarkdown(f2.replace(match2[0], ""));
+ const yamlContent = match2[1];
+ setFM((0, import_obsidian2.parseYaml)(yamlContent));
+ } else {
+ setMarkdown(f2);
+ }
+ });
+ }, [props.path]);
+ return /* @__PURE__ */ import_react167.default.createElement("div", {
+ className: (0, import_classnames11.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_react167.default.createElement("div", {
+ className: "mk-remote-header"
+ }, /* @__PURE__ */ import_react167.default.createElement(RemoteMarkdownHeaderView, {
superstate: props.superstate,
- treeNode: null,
- state: null
- })));
+ name: fm.name ?? props.path,
+ fm
+ })), /* @__PURE__ */ import_react167.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_obsidian3.ItemView {
+ constructor(leaf, app2, viewType, superstate) {
+ super(leaf);
+ this.superstate = superstate;
+ this.navigation = true;
+ 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.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;
+ return state;
+ }
+ constructView(path2) {
+ this.destroy();
+ this.root = this.superstate.ui.createRoot(this.contentEl);
+ this.root.render(
+ /* @__PURE__ */ import_react168.default.createElement("div", {
+ className: "markdown-reading-view"
+ }, /* @__PURE__ */ import_react168.default.createElement(FileLinkViewComponent, {
+ app: this.app,
+ component: this,
+ superstate: this.superstate,
+ path: path2
+ }))
+ );
+ }
+};
+
+// src/adapters/obsidian/utils/file.ts
+var import_obsidian6 = require("obsidian");
+
+// src/core/react/components/System/SystemSettings.tsx
+var import_react174 = __toESM(require_react());
+
+// src/core/assets/icons.ts
+var uiIconSet = {
+ "rows": ``,
+ "close": `
+
+ `,
+ "flow-hover": `
+
+ `,
+ "folder": `
+
+ `,
+ "open-link": `
+
+ `,
+ "file": `
+
+ `,
+ "expand": `
+
+ `,
+ "json": ``,
+ "new-folder": ``,
+ "new-note": ``,
+ "collapse": `
+
+ `,
+ "options": `
+
+ `,
+ "plus": `
+
+
+ `,
+ "collapse-solid": `
+
+ `,
+ "search": `
+
+
+ `,
+ "view-options": `
+
+
+ `,
+ "clear": `
+
+
+ `,
+ "new-file": `
+
+
+ `,
+ "blink": `
+
+
+
+
+ `,
+ "spaces": `
+
+ `,
+ "home": `
+
+ `,
+ "tags": ``,
+ "handle": `
+
+
+
+
+
+
+
+ `,
+ "props": `
+
+
+
+
+ `,
+ "new-space": `
+
+
+ `,
+ "file-solid": `
+
+
+
+ `,
+ "folder-solid": `
+
+
+ `,
+ "sync": `
+
+
+ `,
+ "stack": `
+
+
+ `,
+ "cut": `
+
+
+ `,
+ "backlink": `
+
+
+ `,
+ "canvas": `
+
+
+
+
+
+ `,
+ "video": `
+
+
+ `,
+ "edit": `
+
+
+ `,
+ "list": `
+
+
+
+ `,
+ "build": `
+
+
+ `,
+ "check": `
+
+
+ `,
+ "layout": `
+
+
+ `,
+ "colors": `
+
+
+ `,
+ "mk-make-todo": `
+
+
+
+ `,
+ "mk-make-list": `
+
+
+
+
+
+
+
+ `,
+ "mk-make-ordered": `
+
+
+
+
+
+
+
+ `,
+ "mk-make-h1": `
+
+
+
+ `,
+ "mk-make-h2": `
+
+
+
+ `,
+ "mk-make-h3": `
+
+
+
+ `,
+ "mk-make-quote": `
+
+
+
+
+
+ `,
+ "mk-make-hr": `
+
+
+ `,
+ "mk-make-link": `
+
+
+ `,
+ "mk-make-image": `
+
+
+
+
+
+ `,
+ "mk-make-codeblock": `
+
+
+
+
+ `,
+ "mk-make-callout": `
+
+
+
+ `,
+ "mk-make-note": `
+
+
+
+
+
+ `,
+ "mk-make-flow": `
+
+
+ `,
+ "mk-make-tag": `
+
+
+ `,
+ "callout": ``,
+ "mk-make-table": `
+
+
+
+
+ `,
+ "mk-make-date": `
+
+
+ `,
+ "mk-make-indent": `
+
+
+
+
+
+
+ `,
+ "mk-make-unindent": `
+
+
+
+
+
+ `,
+ "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-mark-color": `
+
+
+ `,
+ "any": `
+
+
+ `,
+ "all": `
+
+
+
+ `,
+ "context": `
+
+
+
+
+
+ `,
+ "full-width": ``,
+ "file-stack": ``,
+ "layout-panel-left": ``,
+ "align-center": `
+
+
+`,
+ "align-left": `
+
+
+`,
+ "align-right": `
+
+
+`,
+ "arrow-down": `
+
+
+`,
+ "arrow-left": `
+
+
+`,
+ "arrow-right": `
+
+
+`,
+ "arrow-up-down": `
+
+
+`,
+ "arrow-up-right": `
+
+
+`,
+ "baseline": `
+
+
+`,
+ "binary": `
+
+
+`,
+ "bold": `
+
+
+`,
+ "book-open": `
+
+
+`,
+ "box-select": `
+
+
+`,
+ "brush": `
+
+
+`,
+ "calendar": `
+
+
+`,
+ "case-insensitive": `
+
+
+`,
+ "check-square": `
+
+
+
+`,
+ "chevron-left": `
+
+
+`,
+ "chevron-right": `
+
+
+`,
+ "chevrons-down-up": `
+
+
+`,
+ "chevrons-up-down": `
+
+
+`,
+ "clock": `
+
+
+
+`,
+ "code": `
+
+
+`,
+ "columns": `
+
+
+`,
+ "combine": `
+
+
+
+`,
+ "copy-check": `
+
+
+
+
+`,
+ "copy-x": `
+
+
+
+`,
+ "copy": `
+
+
+
+`,
+ "documents": `
+
+
+
+
+`,
+ "edit-3": `
+
+
+`,
+ "eye-off": `
+
+
+
+`,
+ "eye": `
+
+
+
+`,
+ "file-minus": `
+
+
+
+`,
+ "file-plus-2": `
+
+
+
+`,
+ "file-question": `
+
+
+
+`,
+ "file-search": `
+
+
+
+`,
+ "file-text": `
+
+
+
+`,
+ "filter": `
+
+
+`,
+ "fold-horizontal": `
+
+
+`,
+ "fold-vertical": `
+
+
+`,
+ "folder-plus": `
+
+
+`,
+ "gallery-horizontal-end": `
+
+
+`,
+ "gem": `
+
+
+
+`,
+ "go-to-file": `
+
+
+
+`,
+ "heading-1": `
+
+
+`,
+ "heading-2": `
+
+
+`,
+ "heading-3": `
+
+
+`,
+ "heading-4": `
+
+
+`,
+ "heading-5": `
+
+
+`,
+ "heading-6": `
+
+
+
+`,
+ "help-circle": `
+
+
+
+`,
+ "image": `
+
+
+
+`,
+ "infinity": `
+
+
+`,
+ "input": `
+
+
+`,
+ "italic": `
+
+
+`,
+ "justify": `
+
+
+`,
+ "layout-dashboard": `
+
+
+`,
+ "grid": ``,
+ "layout-grid": `
+
+
+`,
+ "layout-list": `
+
+
+`,
+ "lightbulb": `
+
+
+`,
+ "link": `
+
+
+
+`,
+ "links-coming-in": `
+
+
+
+`,
+ "links-going-out": `
+
+
+
+`,
+ "list-tree": `
+
+
+
+`,
+ "minus": ``,
+ "mouse-pointer-click": `
+
+
+`,
+ "paintbrush": `
+
+
+
+`,
+ "palette": `
+
+
+
+`,
+ "panel-top-close": `
+
+
+
+`,
+ "paper-plane": `
+
+
+`,
+ "pie-chart": `
+
+
+
+`,
+ "pin-off": `
+
+
+`,
+ "pin": `
+
+
+`,
+ "plug": `
+
+
+`,
+ "scaling": `
+
+
+
+`,
+ "settings": `
+
+
+
+`,
+ "smile": `
+
+
+
+`,
+ "sort-asc": `
+
+
+`,
+ "sort-desc": `
+
+
+`,
+ "star": `
+
+
+`,
+ "sticker": `
+
+
+
+`,
+ "text": ``,
+ "table-2": `
+
+
+`,
+ "table": `
+
+
+`,
+ "trash": `
+
+
+`,
+ "type": `
+
+
+`,
+ "underline": `
+
+
+`,
+ "unfold-horizontal": `
+
+
+`,
+ "unfold-vertical": `
+
+
+`,
+ "unplug": `
+
+
+`,
+ "wrap-text": `
+
+
+
+`,
+ "x-square": `
+
+
+`,
+ "zap": `
+
+
+`,
+ "vault": ``,
+ "mk-logo": `
+
+
+`,
+ "package-plus": ``,
+ "square-kanban": ``,
+ "formula": ``,
+ "clipboard-pen": ``,
+ "clipboard-add": ``,
+ "live": ``,
+ "insert": ``,
+ "tabs": ``
};
-// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListInstance.tsx
-var ContextListInstance = (props) => {
- const [contexts, setContexts] = (0, import_react171.useState)(props.contexts);
- (0, import_react171.useEffect)(
- () => setContexts((p2) => import_lodash18.default.isEqual(props.contexts, p2) ? p2 : props.contexts),
- [props.contexts]
- );
- const { spaceInfo } = (0, import_react171.useContext)(SpaceContext);
- const { dbSchema } = (0, import_react171.useContext)(ContextEditorContext);
- const { setDragNode } = (0, import_react171.useContext)(WindowContext);
- const ref2 = import_react171.default.useRef(null);
- const {
- attributes,
- listeners,
- active,
- setNodeRef: setDraggableNodeRef,
- transform,
- isDragging,
- transition,
- isOver,
- over
- } = useSortable({
- id: props.id,
- data: {
- id: props.id,
- type: props.type,
- space: spaceInfo?.path,
- schema: dbSchema?.id,
- props: props.props,
- contexts
- },
- disabled: props.type != "listItem" || props.editMode > 0 /* Read */,
- animateLayoutChanges: defaultAnimateLayoutChanges
- });
- useDndMonitor({
- onDragStart: (e5) => {
- if (e5.active.data.current.id == props.id) {
- setDragNode(
- /* @__PURE__ */ import_react171.default.createElement("div", {
- dangerouslySetInnerHTML: { __html: ref2.current.innerHTML }
- })
- );
- }
- },
- onDragOver: (over2) => {
- },
- onDragEnd: ({ active: active2, over: over2 }) => {
- const dragReorder = over2 && over2.data.current.space == spaceInfo?.path && over2.data.current.schema == dbSchema?.id;
- dropListItem(dragReorder, over2, props, active2, spaceInfo);
- }
- });
- return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react171.default.createElement(FrameSelectionProvider, {
- superstate: props.superstate,
- id: props.id,
- editMode: props.editMode,
- selected: props.editMode == 3 /* Group */
- }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, {
- id: props.id,
- superstate: props.superstate,
- props: props.props,
- propSetters: props.propSetters,
- contexts,
- editable: true
- }, /* @__PURE__ */ import_react171.default.createElement(FrameEditorInstance, {
- superstate: props.superstate,
- containerRef: props.containerRef
- }, props.children))) : /* @__PURE__ */ import_react171.default.createElement(import_react171.default.Fragment, null, over?.id == props.id && active.data.current.type == props.type && !(active.data.current.space == spaceInfo?.path && active.data.current.schema == dbSchema?.id && active.data.current.props?._groupValue == props.props?._groupValue) && /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, {
- id: props.id,
- superstate: props.superstate,
- props: props.props,
- propSetters: props.propSetters,
- contexts,
- editable: false
- }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceView, {
- superstate: props.superstate
- })), /* @__PURE__ */ import_react171.default.createElement("div", {
- ref: (el) => {
- setDraggableNodeRef(el);
- ref2.current = el;
- },
- ...attributes,
- ...listeners,
- style: {
- transform: CSS.Transform.toString(transform),
- transition
- }
- }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, {
- id: props.id,
- superstate: props.superstate,
- props: props.props,
- propSetters: props.propSetters,
- contexts,
- editable: false
- }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceView, {
- superstate: props.superstate
- }, props.children))));
-};
-var dropListItem = async (dragReorder, over, props, active, spaceInfo) => {
- if (dragReorder && over.id == props.id) {
- if (active.data.current.schema == defaultContextSchemaID) {
- const activePath = active.data.current.contexts?.$context?.["_keyValue"];
- const context = over.data.current.contexts?.$context;
- const groupValueMismatch = props.props?._groupValue != active.data.current.props?._groupValue;
- if (activePath && context) {
- if (groupValueMismatch) {
- {
- saveProperties(props.superstate, activePath, {
- [props.props?._groupField]: props.props?._groupValue
- });
- }
- } else {
- updatePathRankInSpace(
- props.superstate,
- activePath,
- context._index,
- spaceInfo.path
- );
- }
- }
- } else {
- const context = over.data.current.contexts?.$context;
- updateTableValue(
- props.superstate.spaceManager,
- spaceInfo,
- active.data.current.schema,
- active.data.current.contexts?.$context?.["_index"],
- props.props?._groupField,
- props.props?._groupValue,
- context?._index
- );
+// src/core/react/components/System/IconsSet.tsx
+var import_react169 = __toESM(require_react());
+var IconSet = (props) => {
+ const [iconSets, setIconSets] = import_react169.default.useState([]);
+ const [icons, setIcons] = import_react169.default.useState([]);
+ (0, import_react169.useEffect)(() => {
+ Object.keys(uiIconSet).filter((f2, i4) => i4 < 10).forEach((icon) => {
+ setIcons((f2) => [...f2, "ui//" + icon]);
+ });
+ }, []);
+ return /* @__PURE__ */ import_react169.default.createElement("div", null, /* @__PURE__ */ import_react169.default.createElement("div", null, icons.map((c3, i4) => /* @__PURE__ */ import_react169.default.createElement("div", {
+ key: i4,
+ className: "mk-icon-small",
+ dangerouslySetInnerHTML: {
+ __html: props.superstate.ui.getSticker(c3)
}
- }
+ }))));
};
-// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx
-var import_react173 = __toESM(require_react());
-
-// src/core/react/components/SpaceView/Contexts/ContextBuilder/FrameContainerView.tsx
-var import_react172 = __toESM(require_react());
-var FrameContainerView = (props) => {
- const { selected: _selected } = (0, import_react172.useContext)(FrameSelectionContext);
- return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react172.default.createElement(FramesMDBProvider, {
- superstate: props.superstate,
- schema: props.uri.ref
- }, /* @__PURE__ */ import_react172.default.createElement(FrameEditorProvider, {
- superstate: props.superstate,
- cols: props.cols,
- editMode: props.editMode
- }, props.children)) : /* @__PURE__ */ import_react172.default.createElement(FrameRootProvider, {
- superstate: props.superstate,
- path: props.uri,
- cols: props.cols
- }, props.children);
+// src/core/react/components/System/ImageSet.tsx
+var import_react170 = __toESM(require_react());
+var ImageSet = (props) => {
+ const [images, setImages] = import_react170.default.useState([]);
+ const [currentSet, setCurrentSet] = import_react170.default.useState(null);
+ const addImage = (image) => {
+ setImages([...images, image]);
+ };
+ return /* @__PURE__ */ import_react170.default.createElement("div", null);
};
-// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx
-var ContextListView = (props) => {
- const { editSection, selectedIndex, setSelectedIndex, groupURI, itemURI } = props;
- const { spaceInfo } = (0, import_react173.useContext)(SpaceContext);
- const {
- predicate,
- filteredData: data3,
- editMode,
- sortedColumns,
- contextTable,
- cols,
- dbSchema
- } = (0, import_react173.useContext)(ContextEditorContext);
- const { instance } = (0, import_react173.useContext)(FrameInstanceContext);
- const groupBy2 = predicate?.groupBy?.length > 0 ? cols.find((f2) => f2.name + f2.table == predicate.groupBy[0]) : null;
- const groupByOptions = (0, import_react173.useMemo)(() => {
- const groupByOptions2 = instance?.state[instance?.root?.id].props?.groupOptions;
- if (groupByOptions2)
- return ensureArray(groupByOptions2);
- if (!groupBy2)
- return [""];
- const options = uniq([
- "",
- ...(parseFieldValue(groupBy2.value, groupBy2.type, props.superstate)?.options ?? []).map((f2) => f2.value),
- ...data3.reduce(
- (p2, c3) => [...p2, c3[groupBy2.name + groupBy2.table] ?? ""],
- []
- )
- ]);
- return options;
- }, [groupBy2, data3, instance]);
- const groupByFilter = (0, import_react173.useMemo)(() => {
- const filter4 = instance?.state[instance?.root?.id].props?.groupFilter;
- return filterFnTypes[filter4] ?? filterFnTypes.is;
- }, [instance]);
- const items = (0, import_react173.useMemo)(() => {
- return groupByOptions.reduce((p2, c3) => {
- if (!groupBy2) {
- return c3 == "" ? {
- ...p2,
- [c3]: data3 ?? []
- } : {
- ...p2,
- [c3]: []
- };
- }
- const newItems = data3.filter((r2) => {
- return groupByFilter.fn(r2[groupBy2.name + groupBy2.table], c3);
- });
- return newItems.length > 0 ? {
- ...p2,
- [c3]: newItems
- } : {
- ...p2,
- [c3]: []
- };
- }, {});
- }, [data3, groupByOptions, groupByFilter, groupBy2]);
- const primaryKey = (0, import_react173.useMemo)(() => {
- return cols.find((f2) => f2.primary == "true")?.name;
- }, [cols]);
- const visibleCols = (0, import_react173.useMemo)(() => {
- return sortedColumns.filter((f2) => !predicate?.colsHidden.includes(f2.name));
- }, [predicate, sortedColumns]);
- const context = {
- _path: spaceInfo?.path,
- _schema: dbSchema?.id,
- _key: primaryKey,
- _properties: visibleCols
- };
- const contextMap = (0, import_react173.useMemo)(() => {
- return dbSchema?.primary == "true" ? data3.reduce((p2, c3) => {
- return {
- ...p2,
- [c3["_index"]]: {
- $context: {
- _index: c3["_index"],
- _keyValue: c3[primaryKey],
- _schema: dbSchema.id,
- _name: props.superstate.pathsIndex.get(c3[primaryKey])?.name,
- ...context
- },
- $properties: cols,
- [spaceInfo.path]: cols.reduce((a4, b2) => {
- return {
- ...a4,
- [b2.name]: c3[b2.name]
- };
- }, {}),
- ...Object.keys(contextTable).reduce((d4, e5) => {
- return {
- ...d4,
- [e5]: contextTable[e5].cols.reduce((a4, b2) => {
- return {
- ...a4,
- [b2.name]: c3[b2.name + e5]
- };
- }, {})
- };
- }, {})
- }
- };
- }, {}) : data3.reduce((p2, c3) => {
- return {
- ...p2,
- [c3["_index"]]: {
- $context: {
- _index: c3["_index"],
- _keyValue: c3[primaryKey],
- _schema: dbSchema.id,
- _name: c3[primaryKey],
- ...context
- },
- $properties: cols,
- [spaceInfo.path]: cols.reduce((a4, b2) => {
- return {
- ...a4,
- [b2.name]: c3[b2.name]
- };
- }, {})
- }
- };
- }, {});
- }, [data3, cols, contextTable]);
- return /* @__PURE__ */ import_react173.default.createElement(FrameContainerView, {
- superstate: props.superstate,
- uri: groupURI,
- editMode: editSection == "listGroup" ? editMode : 0 /* Read */,
- cols: []
- }, /* @__PURE__ */ import_react173.default.createElement(SortableContext, {
- items: Object.keys(items).map(
- (f2, i4) => spaceInfo.path + "listGroup" + i4
- ),
- strategy: rectSortingStrategy
- }, Object.keys(items).map((c3, i4) => /* @__PURE__ */ import_react173.default.createElement(ContextListInstance, {
- key: "listGroup" + i4,
- id: spaceInfo.path + "listGroup" + i4,
- type: "listGroup",
- superstate: props.superstate,
- uri: groupURI,
- props: {
- _selectedIndex: selectedIndex,
- _groupValue: c3,
- _groupField: groupBy2?.name,
- _groupType: groupBy2?.type,
- ...predicate.listGroupProps
+// src/core/react/components/System/MaterialsSet.tsx
+var import_react171 = __toESM(require_react());
+var MaterialsSet = (props) => {
+ const [materials, setMaterials] = import_react171.default.useState([]);
+ return /* @__PURE__ */ import_react171.default.createElement("div", null, /* @__PURE__ */ import_react171.default.createElement("div", null, colors.map((c3, i4) => /* @__PURE__ */ import_react171.default.createElement("div", {
+ key: i4,
+ "aria-label": c3[0],
+ onMouseDown: () => {
},
- propSetters: null,
- editMode: editSection == "listGroup" ? editMode : 0 /* Read */,
- cols: [],
- containerRef: props.containerRef,
- contexts: { $context: context }
- }, /* @__PURE__ */ import_react173.default.createElement(FrameContainerView, {
- uri: itemURI,
- superstate: props.superstate,
- cols: [],
- editMode: editSection == "listItem" ? editMode : 0 /* Read */
- }, /* @__PURE__ */ import_react173.default.createElement(SortableContext, {
- items: items[c3].flatMap(
- (f2, k2) => spaceInfo.path + "listGroup" + i4 + "_listItem" + k2
- ),
- strategy: rectSortingStrategy
- }, items[c3].map((f2, j) => {
- return /* @__PURE__ */ import_react173.default.createElement(ContextListInstance, {
- key: "listGroup" + i4 + "_listItem" + j,
- id: spaceInfo.path + "listGroup" + i4 + "_listItem" + j,
- type: "listItem",
- uri: itemURI,
- superstate: props.superstate,
- cols: [],
- props: {
- _selectedIndex: selectedIndex,
- _groupValue: c3,
- _groupField: groupBy2?.name,
- ...predicate.listItemProps
- },
- propSetters: {
- _selectedIndex: setSelectedIndex
- },
- containerRef: props.containerRef,
- editMode: editSection == "listItem" ? editMode : 0 /* Read */,
- contexts: contextMap[f2["_index"]]
- });
- })))))));
+ className: "mk-color",
+ style: { background: c3[1] }
+ })), /* @__PURE__ */ import_react171.default.createElement("div", null, "Add")), /* @__PURE__ */ import_react171.default.createElement("div", null, colorsBase.map((c3, i4) => /* @__PURE__ */ import_react171.default.createElement("div", {
+ key: i4,
+ "aria-label": c3[0],
+ onMouseDown: () => {
+ },
+ className: "mk-color",
+ style: { background: c3[1] }
+ }))));
};
-// src/core/react/components/SpaceView/Contexts/ContextListContainer.tsx
-var ContextListContainer = (props) => {
- const { predicate, editMode, setEditMode, dbSchema } = (0, import_react174.useContext)(ContextEditorContext);
- const { frameSchema } = (0, import_react174.useContext)(FramesMDBContext);
- const [editSection, setEditSection] = (0, import_react174.useState)(null);
- const [selectedIndex, setSelectedIndex] = (0, import_react174.useState)(null);
- const [uris, setURIs] = (0, import_react174.useState)(
- predicate ? {
- listView: props.superstate.spaceManager.uriByString(
- initiateString(predicate.listView, "spaces://$kit/#*listView")
- ),
- listGroup: props.superstate.spaceManager.uriByString(
- initiateString(predicate.listGroup, "spaces://$kit/#*listGroup")
- ),
- listItem: props.superstate.spaceManager.uriByString(
- initiateString(predicate.listItem, "spaces://$kit/#*rowItem")
- )
- } : null
- );
- (0, import_react174.useEffect)(() => {
- if (!predicate)
- return;
- const newURIs = {
- listView: props.superstate.spaceManager.uriByString(
- initiateString(predicate.listView, "spaces://$kit/#*listView")
- ),
- listGroup: props.superstate.spaceManager.uriByString(
- initiateString(predicate.listGroup, "spaces://$kit/#*listGroup")
- ),
- listItem: props.superstate.spaceManager.uriByString(
- initiateString(predicate.listItem, "spaces://$kit/#*rowItem")
- )
- };
- setURIs((p2) => !import_lodash19.default.isEqual(newURIs, p2) ? newURIs : p2);
- }, [predicate]);
- return /* @__PURE__ */ import_react174.default.createElement("div", {
- className: "mk-context-container"
- }, !props.minMode && /* @__PURE__ */ import_react174.default.createElement(FilterBar, {
- superstate: props.superstate,
- setView: props.setView
- }), uris ? predicate.view == "table" || predicate.view == "db" || dbSchema?.primary != "true" && !frameSchema ? /* @__PURE__ */ import_react174.default.createElement(TableView, {
- superstate: props.superstate
- }) : /* @__PURE__ */ import_react174.default.createElement("div", {
- className: "mk-editor-context"
- }, /* @__PURE__ */ import_react174.default.createElement(FrameSelectionProvider, {
- superstate: props.superstate,
- id: "list",
- editMode: editSection == "listView" ? editMode : 0 /* Read */
- }, editMode > 0 && /* @__PURE__ */ import_react174.default.createElement(ContextListEditSelector, {
- editSection,
- superstate: props.superstate,
- setEditSection,
- setEditMode
- }), /* @__PURE__ */ import_react174.default.createElement(FrameContainerView, {
- superstate: props.superstate,
- uri: uris.listView,
- cols: [],
- editMode: editSection == "listView" ? editMode : 0 /* Read */
- }, /* @__PURE__ */ import_react174.default.createElement(ContextListInstance, {
- superstate: props.superstate,
- id: "listView",
- type: "listView",
- uri: uris.listView,
- props: {
- _selectedIndex: selectedIndex,
- ...predicate.listViewProps
- },
- propSetters: { _selectedIndex: setSelectedIndex },
- containerRef: props.containerRef,
- editMode: editSection == "listView" ? editMode : 0 /* Read */,
- cols: [],
- contexts: null
- }, /* @__PURE__ */ import_react174.default.createElement(ContextListView, {
+// src/core/react/components/System/SystemActions.tsx
+var import_react172 = __toESM(require_react());
+var SystemActionsEditor = (props) => {
+ const [selectedCommand, setSelectedCommand] = (0, import_react172.useState)();
+ const saveCommand = (command) => {
+ props.superstate.spaceManager.saveSystemCommand(
+ selectedCommand.library,
+ command
+ );
+ };
+ const addLibrary = () => {
+ props.superstate.spaceManager.saveSystemCommand(
+ selectedCommand.library,
+ null
+ );
+ };
+ return /* @__PURE__ */ import_react172.default.createElement("div", {
+ style: { display: "flex" }
+ }, selectedCommand && /* @__PURE__ */ import_react172.default.createElement("div", null, /* @__PURE__ */ import_react172.default.createElement(SpaceCommand, {
superstate: props.superstate,
- containerRef: props.containerRef,
- editSection,
- selectedIndex,
- setSelectedIndex,
- groupURI: uris.listGroup,
- itemURI: uris.listItem
- }))))) : /* @__PURE__ */ import_react174.default.createElement(import_react174.default.Fragment, null));
+ action: "spaces://$actions/" + selectedCommand.library + "/#;" + selectedCommand.command.schema.id
+ })));
};
-// src/core/react/components/MDBView/MDBViewer.tsx
-var MDBViewer = (props) => {
- return /* @__PURE__ */ import_react175.default.createElement(PathProvider, {
- superstate: props.superstate,
- path: props.space.path,
- readMode: false
- }, /* @__PURE__ */ import_react175.default.createElement(SpaceProvider, {
- superstate: props.superstate
- }, /* @__PURE__ */ import_react175.default.createElement(FramesMDBProvider, {
- superstate: props.superstate,
- schema: props.schema
- }, /* @__PURE__ */ import_react175.default.createElement(ContextEditorProvider, {
- superstate: props.superstate
- }, /* @__PURE__ */ import_react175.default.createElement(ContextListContainer, {
- superstate: props.superstate
- })))));
+// src/core/react/components/System/Templates.tsx
+var import_react173 = __toESM(require_react());
+var Templates = (props) => {
+ return /* @__PURE__ */ import_react173.default.createElement("div", null, /* @__PURE__ */ import_react173.default.createElement("h1", null, "Templates"));
};
-// src/core/react/components/MarkdownEditor/Backlinks.tsx
-var import_react176 = __toESM(require_react());
-var BacklinkItem = (props) => {
- const [block, setBlock] = (0, import_react176.useState)([null, null]);
- const refreshBlock = (path3) => {
- const fCache = props.superstate.pathsIndex.get(path3);
- const link3 = [
- ...fCache.metadata.links ?? [],
- ...fCache.metadata.embeds ?? []
- ].find((f2) => props.source.includes(f2.displayText));
- if (link3) {
- const block2 = fCache.metadata.sections.find(
- (f2) => f2.position.start.offset <= link3.position.start.offset && f2.position.end.offset >= link3.position.end.offset
- );
- setBlock([
- Math.max(1, block2.position.start.line),
- Math.max(block2.position.start.line + 1, block2.position.end.line + 1)
- ]);
- } else {
- setBlock([null, null]);
+// src/core/react/components/System/SystemSettings.tsx
+var SystemSettings = (props) => {
+ const [tab, setTab] = (0, import_react174.useState)(0);
+ const [loadout, setLoadOut] = (0, import_react174.useState)();
+ const loadouts = props.superstate.loadouts;
+ return /* @__PURE__ */ import_react174.default.createElement("div", null, /* @__PURE__ */ import_react174.default.createElement("div", {
+ style: { display: "flex", flexDirection: "column" }
+ }, "System Name", /* @__PURE__ */ import_react174.default.createElement("input", {
+ value: props.superstate.settings.systemName,
+ onChange: (e5) => {
+ props.superstate.settings.systemName = e5.target.value;
}
- };
- (0, import_react176.useEffect)(() => {
- refreshBlock(props.path);
- }, []);
- (0, import_react176.useEffect)(() => {
- refreshBlock(props.path);
- }, [props.path]);
- const [collapsed, setCollapsed] = (0, import_react176.useState)(false);
- return /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null, /* @__PURE__ */ import_react176.default.createElement("div", {
- className: "mk-path-context-title"
- }, /* @__PURE__ */ import_react176.default.createElement(CollapseToggle, {
- superstate: props.superstate,
- collapsed,
- onToggle: (c3) => setCollapsed(c3)
- }), /* @__PURE__ */ import_react176.default.createElement("div", {
- onClick: (e5) => {
- props.superstate.ui.openPath(props.path, false);
- e5.stopPropagation();
+ }), /* @__PURE__ */ import_react174.default.createElement("div", null, /* @__PURE__ */ import_react174.default.createElement("h2", null, "Loadouts"), loadouts.map((l2, i4) => /* @__PURE__ */ import_react174.default.createElement("div", {
+ key: i4,
+ onClick: () => {
+ setLoadOut(l2);
}
- }, pathNameToString(props.path))), !collapsed ? /* @__PURE__ */ import_react176.default.createElement("div", {
- className: "mk-path-context-backlink"
- }, /* @__PURE__ */ import_react176.default.createElement(NoteView, {
- load: true,
- superstate: props.superstate,
- path: props.path,
- properties: { from: block[0], to: block[1] },
- classname: "mk-path-context-flow"
- })) : /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null));
-};
-var Backlinks = (props) => {
- const [collapsed, setCollapsed] = (0, import_react176.useState)(
- !props.superstate.settings.inlineBacklinksExpanded
- );
- const [backlinks, setBacklinks] = (0, import_react176.useState)([]);
- (0, import_react176.useEffect)(() => {
- if (!props.path)
- return;
- Promise.all(
- uniq([...props.superstate.linksMap.getInverse(props.path)]).map(
- (f2) => props.superstate.spaceManager.pathExists(f2) ? f2 : null
- )
- ).then((bls) => setBacklinks(bls.filter((f2) => f2)));
- }, [props.path]);
- (0, import_react176.useEffect)(() => {
- props.superstate.settings.inlineBacklinksExpanded = !collapsed;
- props.superstate.saveSettings();
- }, [collapsed]);
- const toggleBacklinks = () => {
- setCollapsed(!collapsed);
- };
- (0, import_react176.useEffect)(() => {
- window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks);
- return () => {
- window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks);
- };
- }, [collapsed]);
- return backlinks.length > 0 && props.path ? /* @__PURE__ */ import_react176.default.createElement("div", {
- className: "mk-path-context-component mk-note-footer"
- }, /* @__PURE__ */ import_react176.default.createElement("div", {
- className: "mk-path-context-section"
- }, /* @__PURE__ */ import_react176.default.createElement("div", {
- onClick: (e5) => {
- setCollapsed(!collapsed);
- e5.stopPropagation();
- },
- className: "mk-path-context-title"
- }, /* @__PURE__ */ import_react176.default.createElement("div", {
- className: `mk-icon-xsmall`,
+ }, l2.name)), /* @__PURE__ */ import_react174.default.createElement("button", {
dangerouslySetInnerHTML: {
- __html: props.superstate.ui.getSticker("ui//backlink")
- }
- }), i18n_default.labels.backlinks, /* @__PURE__ */ import_react176.default.createElement(CollapseToggleSmall, {
- superstate: props.superstate,
- collapsed,
- onToggle: () => null
- })), /* @__PURE__ */ import_react176.default.createElement("div", null, !collapsed && backlinks.map((f2, i4) => /* @__PURE__ */ import_react176.default.createElement(BacklinkItem, {
- path: f2,
- key: i4,
- superstate: props.superstate,
- source: props.path
- }))))) : /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null);
+ __html: props.superstate.ui.getSticker("ui//plus")
+ },
+ onClick: () => props.superstate.ui.openModal(
+ "New Loadout",
+ (_props) => /* @__PURE__ */ import_react174.default.createElement(InputModal, {
+ value: "",
+ saveLabel: "Save",
+ hide: _props.hide,
+ saveValue: (label) => {
+ setLoadOut({
+ name: label
+ });
+ }
+ })
+ )
+ })), /* @__PURE__ */ import_react174.default.createElement("div", null, "Appearance", /* @__PURE__ */ import_react174.default.createElement("h2", null, "Typography")), "Space View", /* @__PURE__ */ import_react174.default.createElement("p", null, "Font"), "Palette Default New Template", /* @__PURE__ */ import_react174.default.createElement(MaterialsSet, {
+ superstate: props.superstate
+ }), "Icons", /* @__PURE__ */ import_react174.default.createElement(IconSet, {
+ superstate: props.superstate
+ }), "Images", /* @__PURE__ */ import_react174.default.createElement(ImageSet, {
+ superstate: props.superstate
+ }), /* @__PURE__ */ import_react174.default.createElement(Templates, {
+ superstate: props.superstate
+ }), /* @__PURE__ */ import_react174.default.createElement(SystemActionsEditor, {
+ superstate: props.superstate
+ })));
};
-// src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx
+// src/adapters/obsidian/SpaceViewContainer.tsx
+var import_obsidian4 = require("obsidian");
var import_react177 = __toESM(require_react());
-var MarkdownHeaderView = (props) => {
- const { pathState } = (0, import_react177.useContext)(PathContext);
- const [collapsed, setCollapsed] = (0, import_react177.useState)(
+
+// src/core/react/components/SpaceView/SpaceHeader.tsx
+var import_react175 = __toESM(require_react());
+var SpaceHeader = (props) => {
+ const { readMode } = (0, import_react175.useContext)(PathContext);
+ const { spaceState } = (0, import_react175.useContext)(SpaceContext);
+ const [collapsed, setCollapsed] = (0, import_react175.useState)(
!props.superstate.settings.inlineContextExpanded
);
- (0, import_react177.useEffect)(() => {
+ (0, import_react175.useEffect)(() => {
props.superstate.settings.inlineContextExpanded = !collapsed;
props.superstate.saveSettings();
}, [collapsed]);
- (0, import_react177.useLayoutEffect)(() => {
- props.editorView?.requestMeasure();
- }, []);
- return pathState && /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement("div", {
- className: "mk-path-context-component"
- }, /* @__PURE__ */ import_react177.default.createElement("div", {
- className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}`
- }, /* @__PURE__ */ import_react177.default.createElement(BannerView, {
+ return /* @__PURE__ */ import_react175.default.createElement(import_react175.default.Fragment, null, /* @__PURE__ */ import_react175.default.createElement(BannerView, {
superstate: props.superstate
- }), /* @__PURE__ */ import_react177.default.createElement(TitleComponent, {
+ }), /* @__PURE__ */ import_react175.default.createElement("div", {
+ className: "mk-space-header"
+ }, /* @__PURE__ */ import_react175.default.createElement("div", {
+ className: "mk-path-context-label"
+ }, /* @__PURE__ */ import_react175.default.createElement(TitleComponent, {
superstate: props.superstate,
- readOnly: !props.editable
- }), /* @__PURE__ */ import_react177.default.createElement("div", {
+ readOnly: readMode
+ }), /* @__PURE__ */ import_react175.default.createElement("div", {
style: { position: "relative" }
- }, /* @__PURE__ */ import_react177.default.createElement("div", {
+ }, /* @__PURE__ */ import_react175.default.createElement("div", {
className: "mk-fold"
- }, /* @__PURE__ */ import_react177.default.createElement(CollapseToggle, {
+ }, /* @__PURE__ */ import_react175.default.createElement(CollapseToggle, {
superstate: props.superstate,
collapsed,
onToggle: (c3) => setCollapsed(c3)
- })))), props.editable && !collapsed && /* @__PURE__ */ import_react177.default.createElement(NoteSpacesBar, {
+ })))), !collapsed && spaceState?.type == "folder" && /* @__PURE__ */ import_react175.default.createElement(NoteSpacesBar, {
superstate: props.superstate
})));
};
-// src/core/react/components/Navigator/Navigator.tsx
-var import_react178 = __toESM(require_react());
-var Navigator = (props) => {
- return /* @__PURE__ */ import_react178.default.createElement("div", {
- className: "mk-sidebar"
- }, /* @__PURE__ */ import_react178.default.createElement(SidebarProvider, {
+// src/core/react/components/SpaceView/SpaceInner.tsx
+var import_react176 = __toESM(require_react());
+var SpaceInner = (props) => {
+ const ref2 = (0, import_react176.useRef)(null);
+ const { spaceState } = (0, import_react176.useContext)(SpaceContext);
+ return /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null, /* @__PURE__ */ import_react176.default.createElement(SpaceHeader, {
superstate: props.superstate
- }, /* @__PURE__ */ import_react178.default.createElement(MainList, {
+ }), spaceState && /* @__PURE__ */ import_react176.default.createElement(SpaceOuter_default, {
+ superstate: props.superstate,
+ ref: ref2
+ }, /* @__PURE__ */ import_react176.default.createElement(FrameEditorInstance, {
+ containerRef: ref2,
superstate: props.superstate
})));
};
-// src/adapters/obsidian/utils/createTable.ts
-var createTable2 = (object, columns) => {
- const columnNames = columns.map((f2) => f2.name);
- const base3 = "|";
- let outputString = base3 + columnNames.join(base3) + "|\n";
- columns.forEach((f2) => {
- outputString += base3 + "----";
+// src/adapters/obsidian/SpaceViewContainer.tsx
+var SPACE_VIEW_TYPE = "mk-space";
+var SpaceViewContainer = class extends import_obsidian4.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_react177.default.createElement("div", {
+ className: "mk-space-view"
+ }, path2 == "spaces://$settings" ? /* @__PURE__ */ import_react177.default.createElement(SystemSettings, {
+ superstate: this.superstate
+ }) : /* @__PURE__ */ import_react177.default.createElement(SpaceView, {
+ path: path2,
+ superstate: this.superstate,
+ key: path2,
+ readOnly: false
+ }, /* @__PURE__ */ import_react177.default.createElement("div", {
+ className: "mk-space-scroller markdown-source-view mod-cm6 is-readable-line-width"
+ }, /* @__PURE__ */ import_react177.default.createElement(SpaceInner, {
+ superstate: this.superstate
+ }))))
+ );
+ } else {
+ this.ui.manager.eventsDispatch.addOnceListener("windowReady", () => {
+ this.constructNote(path2);
+ });
+ }
+ }
+};
+
+// src/adapters/obsidian/ui/editors/SpaceFragmentViewComponent.tsx
+var import_obsidian5 = require("obsidian");
+var import_react178 = __toESM(require_react());
+var SPACE_FRAGMENT_VIEW_TYPE = "mk-space-fragment";
+var SpaceFragmentView = class extends import_obsidian5.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.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_react178.default.createElement(SpaceFragmentWrapper, {
+ superstate: this.plugin.superstate,
+ path: this.path
+ }, /* @__PURE__ */ import_react178.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_obsidian6.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_obsidian6.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, name317, extension, folder) => {
+ let newName = sanitizeFileName(name317);
+ 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_obsidian6.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 }
+ });
+ 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) {
+ await leaf.setViewState({
+ type: EMBED_CONTEXT_VIEW_TYPE,
+ state: { path: uri.fullPath }
+ });
+ } else {
+ await leaf.setViewState({
+ type: SPACE_FRAGMENT_VIEW_TYPE,
+ state: { path: uri.fullPath }
+ });
+ }
+ return;
+ }
+ }
+ if (uri.scheme == "spaces") {
+ openTagContext(leaf, uri.authority, plugin.app);
+ return;
+ }
+ plugin.files.getFile(path2).then((f2) => {
+ if (f2) {
+ openAFile(leaf, f2, plugin);
+ } 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)
+ );
+ });
+ }
+ }
});
- outputString += base3 + "\n";
- object.forEach((row2) => {
- outputString += columnNames.map((c3) => base3 + row2[c3]).join("") + "|\n";
+};
+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_CONTEXT_VIEW_TYPE,
+ state: { path: url }
+ });
+ }
+ if (import_obsidian6.Platform.isMobile) {
+ app2.workspace.leftSplit.collapse();
+ }
+};
+var openAFile = async (leaf, file, plugin) => {
+ if (file.isFolder) {
+ openTFolder(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin);
+ } else if (file) {
+ openTFile(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin.app);
+ } else {
+ return;
+ }
+};
+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) => {
+ if (!plugin.superstate.settings.spaceViewEnabled) {
+ const space2 = plugin.superstate.spacesIndex.get(file.path)?.space.defPath;
+ if (!space2)
+ return;
+ const spaceFile = getAbstractFileAtPath(plugin.app, space2);
+ if (!spaceFile)
+ return;
+ plugin.app.workspace.setActiveLeaf(leaf, { focus: true });
+ leaf.openFile(spaceFile);
+ return;
+ }
+ const viewType = SPACE_VIEW_TYPE;
+ app.workspace.setActiveLeaf(leaf, { focus: true });
+ await leaf.setViewState({
+ type: viewType,
+ state: { path: file.path }
});
- return outputString;
+ await app.workspace.requestSaveLayout();
+ if (import_obsidian6.Platform.isMobile) {
+ 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_obsidian6.Platform.isMobile) {
+ app2.workspace.leftSplit.collapse();
+ }
+};
+var getAbstractFileAtPath = (app2, path2) => {
+ return app2.vault.getAbstractFileByPath(path2);
};
// src/adapters/obsidian/ui/editors/markdownView/FlowEditorHover.tsx
@@ -140802,18 +130267,18 @@ var FlowEditorHover = (props) => {
};
// src/adapters/obsidian/utils/flow/flowEditor.ts
-var import_state10 = require("@codemirror/state");
+var import_state9 = require("@codemirror/state");
// src/adapters/obsidian/ui/editors/FlowEditor.tsx
var import_obsidian8 = require("obsidian");
var popovers = /* @__PURE__ */ new WeakMap();
var mouseCoords = { x: 0, y: 0 };
-function nosuper(base3) {
+function nosuper(base2) {
const derived = function() {
return Object.setPrototypeOf(new import_obsidian8.Component(), new.target.prototype);
};
- derived.prototype = base3.prototype;
- return Object.setPrototypeOf(derived, base3);
+ derived.prototype = base2.prototype;
+ return Object.setPrototypeOf(derived, base2);
}
var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) {
constructor(parent, targetEl, plugin, waitTime, onShowCallback) {
@@ -140937,9 +130402,9 @@ var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) {
);
this.registerEvent(
app.workspace.on("layout-change", () => {
- this.rootSplit.children.forEach((item, index3) => {
+ this.rootSplit.children.forEach((item, index2) => {
if (item instanceof import_obsidian8.WorkspaceTabs) {
- this.rootSplit.replaceChild(index3, item.children[0]);
+ this.rootSplit.replaceChild(index2, item.children[0]);
}
});
})
@@ -141110,10 +130575,10 @@ var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) {
eState
};
}
- buildEphemeralState(file, link3) {
+ buildEphemeralState(file, link) {
const cache2 = this.plugin.app.metadataCache.getFileCache(file);
- const subpath = cache2 ? (0, import_obsidian8.resolveSubpath)(cache2, link3?.subpath || "") : void 0;
- const eState = { subpath: link3?.subpath };
+ const subpath = cache2 ? (0, import_obsidian8.resolveSubpath)(cache2, link?.subpath || "") : void 0;
+ const eState = { subpath: link?.subpath };
if (subpath) {
eState.line = subpath.start.line;
eState.startLoc = subpath.start;
@@ -141124,42 +130589,42 @@ var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) {
};
// src/adapters/obsidian/ui/editors/markdownView/flowEditor/atomic.ts
-var import_state9 = require("@codemirror/state");
+var import_state8 = require("@codemirror/state");
// src/adapters/obsidian/ui/editors/markdownView/flowEditor/selectiveEditor.ts
-var import_state8 = require("@codemirror/state");
+var import_state7 = require("@codemirror/state");
var import_view9 = 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_state8.Annotation.define();
-var contentRange = import_state8.Annotation.define();
+var editableRange = import_state7.Annotation.define();
+var contentRange = import_state7.Annotation.define();
var hiddenLine = import_view9.Decoration.replace({ inclusive: true, block: true });
-var hideLine = import_state8.StateField.define({
+var hideLine = import_state7.StateField.define({
create() {
return import_view9.Decoration.none;
},
- update(value, tr2) {
- const builder = new import_state8.RangeSetBuilder();
- const betterFacet = combinedRangeFacets(tr2.state.field(selectiveLinesFacet, false), tr2.state.field(frontmatterFacet, false));
+ update(value, tr) {
+ const builder = new import_state7.RangeSetBuilder();
+ const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false));
if (betterFacet?.[0] != null) {
const starterLine = Math.min(
- tr2.state.doc.lines,
+ tr.state.doc.lines,
betterFacet[0]
);
builder.add(
- tr2.state.doc.line(1).from,
- tr2.state.doc.line(starterLine).from - 1,
+ tr.state.doc.line(1).from,
+ tr.state.doc.line(starterLine).from - 1,
hiddenLine
);
- if (tr2.newDoc.lines != betterFacet[1])
+ if (tr.newDoc.lines != betterFacet[1])
builder.add(
- tr2.state.doc.line(
- Math.min(tr2.newDoc.lines, betterFacet[1])
+ tr.state.doc.line(
+ Math.min(tr.newDoc.lines, betterFacet[1])
).to,
- tr2.state.doc.line(tr2.newDoc.lines).to,
+ tr.state.doc.line(tr.newDoc.lines).to,
hiddenLine
);
}
@@ -141168,32 +130633,32 @@ var hideLine = import_state8.StateField.define({
},
provide: (f2) => import_view9.EditorView.decorations.from(f2)
});
-var frontmatterFacet = import_state8.StateField.define({
+var frontmatterFacet = import_state7.StateField.define({
create: () => [void 0, void 0],
- update(value, tr2) {
- if (tr2.annotation(contentRange)) {
- if (tr2.annotation(contentRange)[0]) {
+ update(value, tr) {
+ if (tr.annotation(contentRange)) {
+ if (tr.annotation(contentRange)[0]) {
return [
- tr2.annotation(contentRange)[0],
- Math.min(tr2.state.doc.lines, tr2.annotation(contentRange)[1])
+ tr.annotation(contentRange)[0],
+ Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1])
];
}
- return tr2.annotation(contentRange);
+ return tr.annotation(contentRange);
}
return value;
}
});
-var selectiveLinesFacet = import_state8.StateField.define({
+var selectiveLinesFacet = import_state7.StateField.define({
create: () => [void 0, void 0],
- update(value, tr2) {
- if (tr2.annotation(editableRange)) {
- if (tr2.annotation(editableRange)[0]) {
+ update(value, tr) {
+ if (tr.annotation(editableRange)) {
+ if (tr.annotation(editableRange)[0]) {
return [
- tr2.annotation(editableRange)[0],
- Math.min(tr2.state.doc.lines, tr2.annotation(editableRange)[1])
+ tr.annotation(editableRange)[0],
+ Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1])
];
}
- return tr2.annotation(editableRange);
+ return tr.annotation(editableRange);
}
return value;
}
@@ -141204,20 +130669,20 @@ var lineRangeToPosRange = (state, range2) => {
to: state.doc.line(Math.min(state.doc.lines, range2[1])).to
};
};
-var smartDelete = import_state8.EditorState.transactionFilter.of(
- (tr2) => {
- if (tr2.isUserEvent("delete") && !tr2.annotation(import_state8.Transaction.userEvent).endsWith(".smart")) {
- const initialSelections = tr2.startState.selection.ranges.map((range2) => ({
+var smartDelete = import_state7.EditorState.transactionFilter.of(
+ (tr) => {
+ if (tr.isUserEvent("delete") && !tr.annotation(import_state7.Transaction.userEvent).endsWith(".smart")) {
+ const initialSelections = tr.startState.selection.ranges.map((range2) => ({
from: range2.from,
to: range2.to
}));
- const betterFacet = combinedRangeFacets(tr2.startState.field(selectiveLinesFacet, false), tr2.startState.field(frontmatterFacet, false));
+ const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false));
if (initialSelections.length > 0 && betterFacet?.[0]) {
const posRange = lineRangeToPosRange(
- tr2.startState,
+ tr.startState,
betterFacet
);
- if (tr2.changes.touchesRange(0, posRange.from - 1)) {
+ 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 [{
@@ -141225,42 +130690,42 @@ var smartDelete = import_state8.EditorState.transactionFilter.of(
from: Math.min(minFrom, minTo),
to: Math.max(minFrom, minTo)
},
- annotations: import_state8.Transaction.userEvent.of(
- `${tr2.annotation(import_state8.Transaction.userEvent)}.smart`
+ annotations: import_state7.Transaction.userEvent.of(
+ `${tr.annotation(import_state7.Transaction.userEvent)}.smart`
)
}];
}
}
}
- return tr2;
+ return tr;
}
);
-var preventModifyTargetRanges = import_state8.EditorState.transactionFilter.of(
- (tr2) => {
+var preventModifyTargetRanges = import_state7.EditorState.transactionFilter.of(
+ (tr) => {
const newTrans = [];
try {
- const editableLines = tr2.startState.field(selectiveLinesFacet, false);
- const contentLines = tr2.startState.field(frontmatterFacet, false);
+ const editableLines = tr.startState.field(selectiveLinesFacet, false);
+ const contentLines = tr.startState.field(frontmatterFacet, false);
const selectiveLines = combinedRangeFacets(editableLines, contentLines);
- if (tr2.isUserEvent("input") || tr2.isUserEvent("delete") || tr2.isUserEvent("move")) {
+ if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) {
if (selectiveLines?.[0]) {
const posRange = lineRangeToPosRange(
- tr2.startState,
+ tr.startState,
selectiveLines
);
- if (!tr2.changes.touchesRange(posRange.from, posRange.to)) {
+ if (!tr.changes.touchesRange(posRange.from, posRange.to)) {
return [];
}
}
}
- if (tr2.state.doc.lines != tr2.startState.doc.lines) {
- const numberNewLines = tr2.state.doc.lines - tr2.startState.doc.lines;
+ 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(
- tr2.startState,
+ tr.startState,
selectiveLines
);
- if (tr2.changes.touchesRange(0, posRange.from - 1)) {
+ if (tr.changes.touchesRange(0, posRange.from - 1)) {
const newAnnotations = [];
if (editableLines[0]) {
newAnnotations.push(editableRange.of([
@@ -141277,7 +130742,7 @@ var preventModifyTargetRanges = import_state8.EditorState.transactionFilter.of(
newTrans.push({
annotations: newAnnotations
});
- } else if (tr2.changes.touchesRange(posRange.from - 1, posRange.to)) {
+ } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) {
const newAnnotations = [];
if (editableLines[0]) {
newAnnotations.push(editableRange.of([
@@ -141300,7 +130765,7 @@ var preventModifyTargetRanges = import_state8.EditorState.transactionFilter.of(
} catch (e5) {
return [];
}
- return [tr2, ...newTrans];
+ return [tr, ...newTrans];
}
);
var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges];
@@ -141312,14 +130777,14 @@ var editBlockExtensions = () => [
];
// src/adapters/obsidian/ui/editors/markdownView/flowEditor/atomic.ts
-var arrowKeyAnnotation = import_state9.Annotation.define();
+var arrowKeyAnnotation = import_state8.Annotation.define();
// src/adapters/obsidian/utils/flow/flowEditor.ts
-var getLineRangeFromRef = (path3, ref2, plugin) => {
+var getLineRangeFromRef = (path2, ref2, plugin) => {
if (!ref2) {
return [void 0, void 0];
}
- const cache2 = plugin.app.metadataCache.getCache(path3);
+ const cache2 = plugin.app.metadataCache.getCache(path2);
if (!cache2)
return [void 0, void 0];
const headings = cache2.headings;
@@ -141331,15 +130796,15 @@ var getLineRangeFromRef = (path3, ref2, plugin) => {
blocks[ref2.substring(1)].position.end.line + 1
];
}
- const heading5 = headings?.find((f2) => f2.heading.replace("#", " ") == ref2);
- if (heading5) {
- const index3 = headings.findIndex((f2) => f2.heading == heading5.heading);
- const level = headings[index3]?.level;
+ const heading3 = headings?.find((f2) => f2.heading.replace("#", " ") == ref2);
+ if (heading3) {
+ const index2 = headings.findIndex((f2) => f2.heading == heading3.heading);
+ const level = headings[index2]?.level;
const nextIndex2 = headings.findIndex(
- (f2, i4) => i4 > index3 && f2.level <= level
+ (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 (index3 < headings.length - 1 && nextIndex2 != -1) {
+ const start = plugin.superstate.settings.editorFlowStyle == "classic" ? heading3.position.start.line + 1 : heading3.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];
@@ -141409,20 +130874,20 @@ var loadFlowEditor = async (leaf, cm, flowEditorInfo2, source, plugin) => {
const dom = cm.dom.querySelector(
"#mk-flow-" + flowEditorInfo2.id
);
- const path3 = plugin.superstate.spaceManager.uriByString(flowEditorInfo2.link, source);
- const basePath = plugin.superstate.spaceManager.resolvePath(path3.basePath, source);
+ 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(path3.basePath);
+ const spaceCache = plugin.superstate.spacesIndex.get(path2.basePath);
if (spaceCache) {
if (!dom.hasAttribute("ready")) {
dom.setAttribute("ready", "");
- plugin.superstate.ui.openPath(path3.fullPath, false, dom);
+ plugin.superstate.ui.openPath(path2.fullPath, false, dom);
return;
}
} else {
- const file = getAbstractFileAtPath(plugin.app, path3.basePath) ?? getAbstractFileAtPath(plugin.app, basePath);
+ const file = getAbstractFileAtPath(plugin.app, path2.basePath) ?? getAbstractFileAtPath(plugin.app, basePath);
if (file) {
- const selectiveRange = getLineRangeFromRef(file.path, path3.refStr, plugin);
+ 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] });
@@ -141463,16 +130928,16 @@ var openPathInElement = (plugin, parentLeaf, initiatingEl, fileName, onShowCallb
// src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx
var import_obsidian9 = require("obsidian");
-var toggleFlowEditor = import_state11.Annotation.define();
-var cacheFlowEditorHeight = import_state11.Annotation.define();
-var preloadFlowEditor = import_state11.EditorState.transactionFilter.of(
- (tr2) => {
+var toggleFlowEditor = import_state10.Annotation.define();
+var cacheFlowEditorHeight = import_state10.Annotation.define();
+var preloadFlowEditor = import_state10.EditorState.transactionFilter.of(
+ (tr) => {
const newTrans = [];
- const value = tr2.state.field(flowEditorInfo, false);
- if (value && !tr2.annotation(toggleFlowEditor)) {
+ const value = tr.state.field(flowEditorInfo, false);
+ if (value && !tr.annotation(toggleFlowEditor)) {
newTrans.push(
...value.filter((f2) => f2.expandedState == 1).map((f2) => {
- if (tr2.state.field(flowTypeStateField, false) == "doc") {
+ if (tr.state.field(flowTypeStateField, false) == "doc") {
return {
annotations: toggleFlowEditor.of([f2.id, 2])
};
@@ -141484,7 +130949,7 @@ var preloadFlowEditor = import_state11.EditorState.transactionFilter.of(
})
);
}
- return [tr2, ...newTrans];
+ return [tr, ...newTrans];
}
);
var internalLinkToggle = import_view10.ViewPlugin.fromClass(
@@ -141499,8 +130964,8 @@ var internalLinkToggle = import_view10.ViewPlugin.fromClass(
return;
}
const pos = view.posAtDOM(e5.target);
- const { from: lineFrom, to: lineTo, text: text7 } = view.state.doc.lineAt(pos);
- for (const match2 of text7.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)) {
+ 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
@@ -141561,26 +131026,26 @@ var internalLinkHover = (plugin) => hoverTooltip((view, pos, side) => {
});
return hovObject;
});
-var flowEditorInfo = import_state11.StateField.define({
+var flowEditorInfo = import_state10.StateField.define({
create() {
return [];
},
- update(value, tr2) {
+ update(value, tr) {
const newValues = [];
- const previous2 = value;
+ const previous = value;
const usedContainers = [];
- const str = tr2.newDoc.sliceString(0);
+ const str = tr.newDoc.sliceString(0);
const reverseExpandedState = (state) => {
const news = state != 2 ? 2 : 0;
return news;
};
for (const match2 of str.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)) {
- const link3 = match2[1];
- const existingLinks = previous2.filter((f2) => f2.link == link3);
- const offset2 = usedContainers.filter((f2) => f2 == link3).length;
+ 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(link3);
+ usedContainers.push(link);
const info = {
id: id3,
link: match2[1],
@@ -141588,19 +131053,19 @@ var flowEditorInfo = import_state11.StateField.define({
from: match2.index + 4,
to: match2.index + 4 + match2[1].length,
embed: 1,
- height: existingInfo ? tr2.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr2.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr2.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1,
- expandedState: existingInfo ? tr2.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1
+ 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 link3 = match2[1];
- const existingLinks = previous2.filter((f2) => f2.link == link3);
- const offset2 = usedContainers.filter((f2) => f2 == link3).length;
+ 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(link3);
+ usedContainers.push(link);
const info = {
id: id3,
link: match2[1],
@@ -141608,17 +131073,17 @@ var flowEditorInfo = import_state11.StateField.define({
from: match2.index + 2,
to: match2.index + 2 + match2[1].length,
embed: 0,
- height: existingInfo ? tr2.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr2.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr2.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1,
- expandedState: existingInfo ? tr2.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0
+ 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 link3 = match2[1];
- const existingLinks = previous2.filter((f2) => f2.link == link3);
- const offset2 = usedContainers.filter((f2) => f2 == link3).length;
+ 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(link3);
+ usedContainers.push(link);
const info = {
id: id3,
link: match2[1],
@@ -141626,8 +131091,8 @@ var flowEditorInfo = import_state11.StateField.define({
from: match2.index + 3,
to: match2.index + 3 + match2[1].length,
embed: 2,
- height: existingInfo ? tr2.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr2.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr2.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1,
- expandedState: existingInfo ? tr2.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1
+ 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);
}
@@ -141637,7 +131102,7 @@ var flowEditorInfo = import_state11.StateField.define({
}
});
var flowEditorRangeset = (state, plugin) => {
- const builder = new import_state11.RangeSetBuilder();
+ const builder = new import_state10.RangeSetBuilder();
const infoFields = state.field(flowEditorInfo, false);
for (const info of infoFields) {
const { from, to: to2, embed: embedType, expandedState } = info;
@@ -141664,12 +131129,12 @@ var flowEditorRangeset = (state, plugin) => {
const dec = builder.finish();
return dec;
};
-var flowEditorField = (plugin) => import_state11.StateField.define({
+var flowEditorField = (plugin) => import_state10.StateField.define({
create(state) {
return flowEditorRangeset(state, plugin);
},
- update(value, tr2) {
- return flowEditorRangeset(tr2.state, plugin);
+ update(value, tr) {
+ return flowEditorRangeset(tr.state, plugin);
},
provide: (f2) => import_view10.EditorView.decorations.from(f2)
});
@@ -141790,10 +131255,10 @@ var flowViewUpdates = (plugin) => import_view11.EditorView.updateListener.of((v2
});
// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx
-var import_state13 = require("@codemirror/state");
+var import_state12 = require("@codemirror/state");
// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts
-var import_state12 = require("@codemirror/state");
+var import_state11 = require("@codemirror/state");
// src/adapters/obsidian/ui/editors/markdownView/obsidianSyntax.ts
var oMarks = [
@@ -141821,7 +131286,7 @@ var oMarks = [
];
// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts
-var toggleMark = import_state12.Annotation.define();
+var toggleMark = import_state11.Annotation.define();
var trimSpace = (pos, moveDirLeft, state) => {
if (moveDirLeft && state.sliceDoc(pos, pos + 1) == " ")
return pos + 1;
@@ -141837,18 +131302,18 @@ var newPosAfterFormatting = (pos, moveDirLeft, state) => {
let lastFormatPos = start;
const exitFormatRange = false;
iterateTreeInSelection({ from: start, to: end }, state, {
- enter: (node2) => {
+ enter: (node) => {
if (exitFormatRange)
return false;
- if (node2.name.includes("formatting")) {
- if (!moveDirLeft && node2.from > start) {
+ if (node.name.includes("formatting")) {
+ if (!moveDirLeft && node.from > start) {
return false;
}
if (moveDirLeft) {
- newPos = node2.from;
- lastFormatPos = node2.to;
+ newPos = node.from;
+ lastFormatPos = node.to;
} else {
- newPos = node2.to;
+ newPos = node.to;
}
}
}
@@ -141871,10 +131336,10 @@ var expandRange = (selection2, state) => {
);
return { from, to: to2 };
};
-var addMarkAtPos = (pos, mark2) => ({
- changes: { from: pos, to: pos, insert: mark2.formatChar }
+var addMarkAtPos = (pos, mark) => ({
+ changes: { from: pos, to: pos, insert: mark.formatChar }
});
-var rangeIsMark = (state, mark2, selection2) => posIsMark(selection2.from, state, mark2.mark) && posIsMark(selection2.to, state, mark2.mark);
+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, {
@@ -141888,41 +131353,41 @@ var posIsMark = (pos, state, markString) => {
var nodeNameContainsMark = (name317, markString) => {
return name317.includes(markString);
};
-var edgeIsMark = (pos, state, mark2) => posIsMark(pos, state, mark2.mark);
-var edgeIsMarkFormat = (pos, state, mark2) => posIsMark(pos, state, mark2.formatting) ? true : mark2.altFormatting ? posIsMark(pos, state, mark2.altFormatting) : false;
-var transactionChangesForMark = (range2, mark2, state) => {
+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, mark2, range2)) {
- if (edgeIsMarkFormat(range2.from, state, mark2) && !edgeIsMarkFormat(range2.to, state, mark2)) {
- newTrans.push(addMarkAtPos(range2.to, mark2));
+ 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, mark2) && !edgeIsMarkFormat(range2.from, state, mark2)) {
- newTrans.push(addMarkAtPos(range2.from, mark2));
+ if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMarkFormat(range2.from, state, mark)) {
+ newTrans.push(addMarkAtPos(range2.from, mark));
}
- } else if (edgeIsMark(range2.from, state, mark2)) {
- if (edgeIsMarkFormat(range2.from, state, mark2) && !edgeIsMark(range2.from - 1, state, mark2)) {
- newTrans.push(addMarkAtPos(range2.from, mark2));
+ } 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, mark2));
- } else if (edgeIsMark(range2.to, state, mark2)) {
- if (edgeIsMarkFormat(range2.to, state, mark2) && !edgeIsMark(range2.to + 1, state, mark2)) {
- newTrans.push(addMarkAtPos(range2.to, mark2));
+ 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, mark2));
+ newTrans.push(addMarkAtPos(range2.from, mark));
} else {
- newTrans.push(addMarkAtPos(range2.to, mark2));
- newTrans.push(addMarkAtPos(range2.from, mark2));
+ newTrans.push(addMarkAtPos(range2.to, mark));
+ newTrans.push(addMarkAtPos(range2.from, mark));
}
return newTrans;
};
-var removeAllInternalMarks = (sel, state, mark2) => {
+var removeAllInternalMarks = (sel, state, mark) => {
const returnTrans = [];
iterateTreeInSelection({ from: sel.from, to: sel.to }, state, {
enter: ({ name: name317, from, to: to2 }) => {
- if (nodeNameContainsMark(name317, mark2.formatting) || (mark2.altFormatting ? nodeNameContainsMark(name317, mark2.altFormatting) : false))
+ if (nodeNameContainsMark(name317, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name317, mark.altFormatting) : false))
returnTrans.push({
from,
- to: from + mark2.formatChar.length
+ to: from + mark.formatChar.length
});
}
});
@@ -141930,51 +131395,51 @@ var removeAllInternalMarks = (sel, state, mark2) => {
changes: returnTrans
};
};
-var toggleMarkExtension = import_state12.EditorState.transactionFilter.of(
- (tr2) => {
- if (!tr2.annotation(toggleMark))
- return tr2;
- const markToggle = tr2.annotation(toggleMark);
- const mark2 = oMarks.find((f2) => f2.mark == markToggle);
- if (!mark2) {
- return tr2;
+var toggleMarkExtension = import_state11.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 = tr2.startState.selection.main;
+ const selection2 = tr.startState.selection.main;
const newTrans = [];
if (selection2.head == selection2.anchor) {
- if (tr2.startState.sliceDoc(
- selection2.head - mark2.formatChar.length,
+ if (tr.startState.sliceDoc(
+ selection2.head - mark.formatChar.length,
selection2.head
- ) == mark2.formatChar && tr2.startState.sliceDoc(
+ ) == mark.formatChar && tr.startState.sliceDoc(
selection2.head,
- selection2.head + mark2.formatChar.length
- ) == mark2.formatChar) {
+ selection2.head + mark.formatChar.length
+ ) == mark.formatChar) {
newTrans.push({
changes: {
- from: selection2.head - mark2.formatChar.length,
- to: selection2.head + mark2.formatChar.length
+ from: selection2.head - mark.formatChar.length,
+ to: selection2.head + mark.formatChar.length
}
});
} else {
newTrans.push({
changes: {
from: selection2.head,
- insert: mark2.formatChar + mark2.formatChar
+ insert: mark.formatChar + mark.formatChar
},
selection: {
- anchor: selection2.head + mark2.formatChar.length,
- head: selection2.head + mark2.formatChar.length
+ anchor: selection2.head + mark.formatChar.length,
+ head: selection2.head + mark.formatChar.length
}
});
}
- return [tr2, ...newTrans];
+ return [tr, ...newTrans];
}
- const range2 = expandRange(selection2, tr2.startState);
- newTrans.push(removeAllInternalMarks(range2, tr2.startState, mark2));
+ 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, mark2, tr2.startState));
- return [tr2, ...newTrans, { selection: { anchor: newFrom, head: newTo } }];
+ newTrans.push(...transactionChangesForMark(range2, mark, tr.startState));
+ return [tr, ...newTrans, { selection: { anchor: newFrom, head: newTo } }];
}
);
@@ -142049,8 +131514,8 @@ function resolveStyles() {
// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu.tsx
var loadStylerIntoContainer = (el, plugin) => {
- const root4 = plugin.ui.createRoot(el);
- root4.render(
+ const root = plugin.ui.createRoot(el);
+ root.render(
/* @__PURE__ */ import_react182.default.createElement(InlineMenuComponent, {
mobile: true,
activeMarks: [],
@@ -142258,12 +131723,12 @@ var InlineMenuComponent = (props) => {
// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx
var import_react183 = __toESM(require_react());
-var cursorTooltipField = (plugin) => import_state13.StateField.define({
+var cursorTooltipField = (plugin) => import_state12.StateField.define({
create: getCursorTooltips(plugin),
- update(tooltips2, tr2) {
- if (!tr2.docChanged && !tr2.selection)
+ update(tooltips2, tr) {
+ if (!tr.docChanged && !tr.selection)
return tooltips2;
- return getCursorTooltips(plugin)(tr2.state);
+ return getCursorTooltips(plugin)(tr.state);
},
provide: (f2) => showTooltip.computeN([f2], (state) => state.field(f2))
});
@@ -142299,19 +131764,19 @@ function cursorTooltip(plugin) {
}
// src/adapters/obsidian/ui/editors/markdownView/placeholder.ts
-var import_state14 = require("@codemirror/state");
+var import_state13 = require("@codemirror/state");
var import_view12 = require("@codemirror/view");
var placeholderLine = (plugin) => import_view12.Decoration.line({
attributes: { "data-ph": i18n_default.labels.placeholder.replace("${1}", plugin.superstate.settings.menuTriggerChar) },
class: "mk-placeholder"
});
-var placeholderExtension = (plugin) => import_state14.StateField.define({
+var placeholderExtension = (plugin) => import_state13.StateField.define({
create() {
return import_view12.Decoration.none;
},
- update(value, tr2) {
- const builder = new import_state14.RangeSetBuilder();
- const currentLine = tr2.state.doc.lineAt(tr2.state.selection.main.head);
+ update(value, tr) {
+ const builder = new import_state13.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();
@@ -142372,17 +131837,17 @@ var getCMFromElement = (el, app2) => {
return rcm;
};
var replaceAllTables = (plugin, el, ctx) => {
- el.querySelectorAll("p").forEach((element3) => {
- for (const match2 of element3.textContent.matchAll(
+ el.querySelectorAll("p").forEach((element) => {
+ for (const match2 of element.textContent.matchAll(
/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g
)) {
- const link3 = match2[1];
- const reactEl = plugin.ui.createRoot(element3.parentElement);
+ const link = match2[1];
+ const reactEl = plugin.ui.createRoot(element.parentElement);
reactEl.render(
/* @__PURE__ */ import_react184.default.createElement(NoteView, {
load: true,
superstate: plugin.superstate,
- path: link3
+ path: link
})
);
}
@@ -142430,10 +131895,10 @@ var replaceAllEmbed = (el, ctx, superstate, app2) => {
const reactEl = superstate.ui.createRoot(div2);
const cm = getCMFromElement(el, app2);
const pos = cm?.posAtDOM(dom);
- const index3 = [...Array.from(dom.parentElement.childNodes)].indexOf(
+ const index2 = [...Array.from(dom.parentElement.childNodes)].indexOf(
dom
);
- const nextDom = dom.parentElement.childNodes[index3];
+ const nextDom = dom.parentElement.childNodes[index2];
const endPos = cm?.posAtDOM(nextDom);
if (ctx.sourcePath)
reactEl.render(
@@ -142638,9 +132103,9 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab {
this.plugin.saveSettings();
})
);
- new import_obsidian10.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text7) => {
- text7.setValue(this.plugin.superstate.settings.spaceRowHeight.toString()).onChange(async (value) => {
- text7.setValue(parseInt(value).toString());
+ new import_obsidian10.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();
});
@@ -142692,13 +132157,13 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab {
i18n_default.settings.spacesDeleteOptions["system-trash"]
);
dropdown.setValue(this.plugin.superstate.settings.deleteFileOption);
- dropdown.onChange((option2) => {
- this.plugin.superstate.settings.deleteFileOption = option2;
+ dropdown.onChange((option) => {
+ this.plugin.superstate.settings.deleteFileOption = option;
this.plugin.saveSettings();
});
});
- new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.newNotePlaceholder.name).setDesc(i18n_default.settings.newNotePlaceholder.desc).addText((text7) => {
- text7.setValue(this.plugin.superstate.settings.newNotePlaceholder).onChange(async (value) => {
+ new import_obsidian10.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();
});
@@ -142713,17 +132178,17 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab {
})
);
}
- new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.coverHeight.name).setDesc(i18n_default.settings.coverHeight.desc).addText((text7) => {
- text7.setValue(this.plugin.superstate.settings.bannerHeight.toString()).onChange(async (value) => {
- text7.setValue(parseInt(value).toString());
+ new import_obsidian10.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);
await this.plugin.saveSettings();
});
});
if (this.plugin.superstate.settings.spaceViewEnabled) {
containerEl.createEl("h3", { text: i18n_default.settings.sectionSpaceView });
- new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.defaultSpaceTemplate.name).setDesc(i18n_default.settings.defaultSpaceTemplate.desc).addText((text7) => {
- text7.setValue(this.plugin.superstate.settings.defaultSpaceTemplate).onChange(async (value) => {
+ new import_obsidian10.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();
});
@@ -142744,8 +132209,8 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab {
this.plugin.reloadExtensions(false);
})
);
- new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text7) => {
- text7.setValue(this.plugin.superstate.settings.defaultDateFormat).onChange(async (value) => {
+ new import_obsidian10.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();
});
@@ -142804,8 +132269,8 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab {
dropdown.addOption("vertical", i18n_default.settings.layoutVertical);
dropdown.addOption("horizontal", i18n_default.settings.layoutHorizontal);
dropdown.setValue(this.plugin.superstate.settings.inlineContextNameLayout);
- dropdown.onChange((option2) => {
- this.plugin.superstate.settings.inlineContextNameLayout = option2;
+ dropdown.onChange((option) => {
+ this.plugin.superstate.settings.inlineContextNameLayout = option;
this.plugin.saveSettings();
});
});
@@ -142869,17 +132334,17 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab {
this.plugin.reloadExtensions(false);
})
);
- new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text7) => {
- text7.setValue(this.plugin.superstate.settings.menuTriggerChar).onChange(async (value) => {
+ new import_obsidian10.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) {
- text7.setValue(this.plugin.superstate.settings.menuTriggerChar);
+ text2.setValue(this.plugin.superstate.settings.menuTriggerChar);
return;
}
let char = value[0];
if (value.length === 2) {
char = value.replace(this.plugin.superstate.settings.menuTriggerChar, "");
}
- text7.setValue(char);
+ text2.setValue(char);
this.plugin.superstate.settings.menuTriggerChar = char;
await this.plugin.saveSettings();
});
@@ -143061,18 +132526,18 @@ var MDBFileViewer = class extends import_obsidian12.FileView {
state.schema = this.schema;
return state;
}
- constructInlineContext(path3, schema) {
- const space3 = this.plugin.superstate.spaceManager.spaceInfoForPath(
- getParentPathFromString(path3)
+ constructInlineContext(path2, schema) {
+ const space2 = this.plugin.superstate.spaceManager.spaceInfoForPath(
+ getParentPathFromString(path2)
);
this.destroy();
- if (space3) {
+ if (space2) {
this.root = this.plugin.ui.createRoot(this.contentEl);
if (this.root) {
this.root.render(
/* @__PURE__ */ import_react187.default.createElement(MDBViewer, {
superstate: this.plugin.superstate,
- space: space3,
+ space: space2,
schema
})
);
@@ -143080,7 +132545,7 @@ var MDBFileViewer = class extends import_obsidian12.FileView {
this.plugin.ui.manager.eventsDispatch.addOnceListener(
"windowReady",
() => {
- this.constructInlineContext(path3, schema);
+ this.constructInlineContext(path2, schema);
}
);
}
@@ -143144,14 +132609,14 @@ var VIEW_DISPLAY_TEXT2 = i18n_default.views.explorer;
// src/adapters/obsidian/ui/editors/ReadingModeHeader.tsx
var import_react189 = __toESM(require_react());
var ReadingModeHeader = (props) => {
- const [path3, setPath] = (0, import_react189.useState)(props.filePath);
+ const [path2, setPath] = (0, import_react189.useState)(props.filePath);
const ref2 = (0, import_react189.useRef)(null);
(0, import_react189.useEffect)(() => {
setPath(props.filePath);
}, [props.filePath]);
- const changeActiveFile = (path4) => {
+ const changeActiveFile = (path3) => {
if (ref2.current.closest(".mod-active"))
- setPath(path4);
+ setPath(path3);
};
(0, import_react189.useEffect)(() => {
props.superstate.ui.eventsDispatch.addListener(
@@ -143169,7 +132634,7 @@ var ReadingModeHeader = (props) => {
ref: ref2
}, /* @__PURE__ */ import_react189.default.createElement(PathProvider, {
superstate: props.superstate,
- path: path3,
+ path: path2,
readMode: true
}, /* @__PURE__ */ import_react189.default.createElement(MarkdownHeaderView, {
superstate: props.superstate,
@@ -143182,7 +132647,7 @@ var import_obsidian14 = require("obsidian");
var import_react190 = __toESM(require_react());
var replaceInlineContext = (plugin, el, ctx) => {
replaceMarkdownForReadingMode(el, async (dom) => {
- const element3 = dom.querySelector(".mod-header");
+ const element = dom.querySelector(".mod-header");
if (!el.parentElement)
return;
let outerdom = dom;
@@ -143191,20 +132656,20 @@ var replaceInlineContext = (plugin, el, ctx) => {
}
if (outerdom.hasClass("mk-floweditor"))
return;
- if (element3) {
- let ctxElement = element3?.querySelector(".mk-inline-context");
+ if (element) {
+ let ctxElement = element?.querySelector(".mk-inline-context");
if (!ctxElement) {
- ctxElement = element3.createDiv();
+ ctxElement = element.createDiv();
ctxElement.classList.add("mk-inline-context");
- element3.prepend(ctxElement);
+ element.prepend(ctxElement);
}
if (ctxElement.getAttribute("data-path") != ctx.sourcePath) {
ctxElement.setAttribute("data-path", ctx.sourcePath);
- ctx.addChild(new import_obsidian14.MarkdownRenderChild(element3));
- const root4 = plugin.ui.createRoot(ctxElement);
- const construct = (root5) => {
+ ctx.addChild(new import_obsidian14.MarkdownRenderChild(element));
+ const root = plugin.ui.createRoot(ctxElement);
+ const construct = (root2) => {
if (ctx.sourcePath.match(urlRegex)) {
- root5.render(
+ root2.render(
/* @__PURE__ */ import_react190.default.createElement(RemoteMarkdownHeaderView, {
superstate: plugin.superstate,
fm: ctx.frontmatter,
@@ -143212,7 +132677,7 @@ var replaceInlineContext = (plugin, el, ctx) => {
})
);
} else {
- root5.render(
+ root2.render(
/* @__PURE__ */ import_react190.default.createElement(ReadingModeHeader, {
superstate: plugin.superstate,
filePath: ctx.sourcePath
@@ -143220,14 +132685,14 @@ var replaceInlineContext = (plugin, el, ctx) => {
);
}
};
- if (root4) {
- construct(root4);
+ if (root) {
+ construct(root);
} else {
plugin.ui.manager.eventsDispatch.addOnceListener(
"windowReady",
() => {
- const root5 = plugin.ui.createRoot(ctxElement);
- construct(root5);
+ const root2 = plugin.ui.createRoot(ctxElement);
+ construct(root2);
}
);
}
@@ -144225,7 +133690,7 @@ var lucideIcons = [
// node_modules/monkey-around/mjs/index.js
function around(obj, factories) {
- const removers = Object.keys(factories).map((key3) => around1(obj, key3, factories[key3]));
+ const removers = Object.keys(factories).map((key2) => around1(obj, key2, factories[key2]));
return removers.length === 1 ? removers[0] : function() {
removers.forEach((r2) => r2());
};
@@ -144368,8 +133833,8 @@ var modifyFlowDom = (plugin) => {
sizerEl.prepend(inlineContext);
}
}
- const construct = (root5) => {
- root5.render(
+ const construct = (root2) => {
+ root2.render(
/* @__PURE__ */ import_react191.default.createElement(PathProvider, {
superstate: plugin.superstate,
path: file.path,
@@ -144382,18 +133847,18 @@ var modifyFlowDom = (plugin) => {
}))
);
};
- let root4 = plugin.ui.getRoot(inlineContext);
- if (!root4) {
- root4 = plugin.ui.createRoot(inlineContext);
+ let root = plugin.ui.getRoot(inlineContext);
+ if (!root) {
+ root = plugin.ui.createRoot(inlineContext);
}
- if (root4) {
- construct(root4);
+ if (root) {
+ construct(root);
} else {
plugin.ui.manager.eventsDispatch.addOnceListener("windowReady", () => {
- let root5 = plugin.ui.getRoot(inlineContext);
- if (!root5)
- root5 = plugin.ui.createRoot(inlineContext);
- construct(root5);
+ let root2 = plugin.ui.getRoot(inlineContext);
+ if (!root2)
+ root2 = plugin.ui.createRoot(inlineContext);
+ construct(root2);
});
}
if (plugin.superstate.settings.inlineBacklinks) {
@@ -144418,20 +133883,20 @@ var modifyFlowDom = (plugin) => {
// src/adapters/mdb/db/db.ts
var import_jszip = __toESM(require_jszip_min());
import_jszip.default.support.nodebuffer = false;
-var getDBFile = async (plugin, path3, isRemote) => {
+var getDBFile = async (plugin, path2, isRemote) => {
if (isRemote) {
- return fetch(path3).then((res) => res.arrayBuffer());
+ return fetch(path2).then((res) => res.arrayBuffer());
}
- if (!await plugin.middleware.fileExists(path3)) {
+ if (!await plugin.middleware.fileExists(path2)) {
return null;
}
const file = await plugin.middleware.readBinaryToFile(
- path3
+ path2
);
return file;
};
-var getDB = async (plugin, sqlJS, path3, isRemote) => {
- const buf = await getDBFile(plugin, path3, isRemote);
+var getDB = async (plugin, sqlJS, path2, isRemote) => {
+ const buf = await getDBFile(plugin, path2, isRemote);
if (buf) {
const db = await new sqlJS.Database(new Uint8Array(buf));
try {
@@ -144445,8 +133910,8 @@ var getDB = async (plugin, sqlJS, path3, isRemote) => {
}
return new sqlJS.Database();
};
-var getZippedDB = async (plugin, sqlJS, path3, isRemote) => {
- const buf = await getZippedDBFile(plugin, path3, isRemote);
+var getZippedDB = async (plugin, sqlJS, path2, isRemote) => {
+ const buf = await getZippedDBFile(plugin, path2, isRemote);
if (buf) {
const db = await new sqlJS.Database(new Uint8Array(buf));
try {
@@ -144460,30 +133925,30 @@ var getZippedDB = async (plugin, sqlJS, path3, isRemote) => {
}
return new sqlJS.Database();
};
-var getZippedDBFile = async (plugin, path3, isRemote) => {
+var getZippedDBFile = async (plugin, path2, isRemote) => {
if (isRemote) {
- return fetch(path3).then((res) => res.arrayBuffer());
+ return fetch(path2).then((res) => res.arrayBuffer());
}
- if (!await plugin.middleware.fileExists(path3)) {
+ if (!await plugin.middleware.fileExists(path2)) {
return null;
}
const zip = new import_jszip.default();
const file = await plugin.middleware.readBinaryToFile(
- path3
+ path2
);
- let buffer2;
+ let buffer;
try {
- buffer2 = await zip.loadAsync(file).then((f2) => zip.file("data.mdb").async("arraybuffer"));
+ buffer = await zip.loadAsync(file).then((f2) => zip.file("data.mdb").async("arraybuffer"));
} catch (e5) {
console.log(e5);
}
- return buffer2;
+ return buffer;
};
-var saveZippedDBFile = async (plugin, path3, binary) => {
+var saveZippedDBFile = async (plugin, path2, binary) => {
if (!await plugin.middleware.fileExists(
- removeTrailingSlashFromFolder(getParentPathFromString(path3))
+ removeTrailingSlashFromFolder(getParentPathFromString(path2))
)) {
- await plugin.middleware.createFolder(getParentPathFromString(path3));
+ await plugin.middleware.createFolder(getParentPathFromString(path2));
}
const zip = new import_jszip.default();
zip.file("data.mdb", binary);
@@ -144495,27 +133960,27 @@ var saveZippedDBFile = async (plugin, path3, binary) => {
}
});
const file = plugin.middleware.writeBinaryToFile(
- path3,
+ path2,
zipFile
);
return file;
};
-var saveDBFile = async (plugin, path3, binary) => {
+var saveDBFile = async (plugin, path2, binary) => {
if (!await plugin.middleware.fileExists(
- removeTrailingSlashFromFolder(getParentPathFromString(path3))
+ removeTrailingSlashFromFolder(getParentPathFromString(path2))
)) {
- await plugin.middleware.createFolder(getParentPathFromString(path3));
+ await plugin.middleware.createFolder(getParentPathFromString(path2));
}
const file = plugin.middleware.writeBinaryToFile(
- path3,
+ path2,
binary
);
return file;
};
var mdbTablesToDBTables = (tables, uniques) => {
- return Object.keys(tables).reduce((p2, c3) => {
+ return Object.keys(tables).reduce((p, c3) => {
return {
- ...p2,
+ ...p,
[c3]: {
uniques: uniques?.[c3] ?? [],
cols: tables[c3].cols.map((f2) => f2.name),
@@ -144526,13 +133991,13 @@ var mdbTablesToDBTables = (tables, uniques) => {
};
var dbResultsToDBTables = (res) => {
return res.reduce(
- (p2, c3, i4) => [
- ...p2,
+ (p, c3, i4) => [
+ ...p,
{
cols: c3.columns,
rows: c3 ? c3.values.map(
(r2) => c3.columns.reduce(
- (prev, curr, index3) => ({ ...prev, [curr]: r2[index3] }),
+ (prev, curr, index2) => ({ ...prev, [curr]: r2[index2] }),
{}
)
) : []
@@ -144541,9 +134006,9 @@ var dbResultsToDBTables = (res) => {
[]
);
};
-var selectDB = (db, table2, condition, fields) => {
+var selectDB = (db, table, condition, fields) => {
const fieldsStr = fields ?? "*";
- const sqlstr = condition ? `SELECT ${fieldsStr} FROM "${table2}" WHERE ${condition};` : `SELECT ${fieldsStr} FROM ${table2};`;
+ const sqlstr = condition ? `SELECT ${fieldsStr} FROM "${table}" WHERE ${condition};` : `SELECT ${fieldsStr} FROM ${table};`;
let tables;
try {
tables = dbResultsToDBTables(db.exec(sqlstr));
@@ -144572,16 +134037,16 @@ var insertIntoDB = (db, tables, replace) => {
console.log(e5);
}
};
-var deleteFromDB = (db, table2, condition) => {
- const sqlstr = `DELETE FROM "${table2}" WHERE ${condition};`;
+var deleteFromDB = (db, table, condition) => {
+ const sqlstr = `DELETE FROM "${table}" WHERE ${condition};`;
try {
db.exec(sqlstr);
} catch (e5) {
console.log(e5);
}
};
-var dropTable = (db, table2) => {
- const sqlstr = `DROP TABLE IF EXISTS "${table2}";`;
+var dropTable = (db, table) => {
+ const sqlstr = `DROP TABLE IF EXISTS "${table}";`;
try {
db.exec(sqlstr);
} catch (e5) {
@@ -144594,8 +134059,8 @@ var replaceDB = (db, tables) => {
const tableFields = tables[t5].cols;
const fieldQuery = serializeSQLFieldNames(uniq(tableFields).filter((f2) => f2).map((f2) => `'${sanitizeSQLStatement(f2)}' char`));
const createQuery = `CREATE TABLE IF NOT EXISTS "${t5}" (${fieldQuery}); `;
- const idxQuery = tables[t5].uniques.filter((f2) => f2).reduce((p2, c3) => {
- return `${p2} CREATE UNIQUE INDEX IF NOT EXISTS "idx_${t5}_${c3.replace(
+ const idxQuery = tables[t5].uniques.filter((f2) => f2).reduce((p, c3) => {
+ return `${p} CREATE UNIQUE INDEX IF NOT EXISTS "idx_${t5}_${c3.replace(
/,/g,
"_"
)}" ON "${t5}"(${c3});`;
@@ -144624,28 +134089,28 @@ var replaceDB = (db, tables) => {
}
return true;
};
-var saveZippedDBToPath = async (plugin, path3, tables) => {
+var saveZippedDBToPath = async (plugin, path2, tables) => {
const sqlJS = await plugin.sqlJS();
- const db = await getZippedDB(plugin, sqlJS, path3);
+ const db = await getZippedDB(plugin, sqlJS, path2);
if (!db) {
db.close();
return false;
}
replaceDB(db, tables);
- await saveZippedDBFile(plugin, path3, db.export().buffer);
+ await saveZippedDBFile(plugin, path2, db.export().buffer);
db.close();
return true;
};
-var saveDBToPath = async (plugin, path3, tables) => {
+var saveDBToPath = async (plugin, path2, tables) => {
const sqlJS = await plugin.sqlJS();
- const db = await getDB(plugin, sqlJS, path3);
+ const db = await getDB(plugin, sqlJS, path2);
if (!db) {
db.close();
return false;
}
const result = replaceDB(db, tables);
if (result) {
- await saveDBFile(plugin, path3, db.export().buffer);
+ await saveDBFile(plugin, path2, db.export().buffer);
}
db.close();
return result;
@@ -144659,16 +134124,16 @@ var vaultSchema = {
};
// src/adapters/mdb/utils/mdb.ts
-var dbTableToMDBTable = (table2, schema, fields) => {
+var dbTableToMDBTable = (table, schema, fields) => {
return {
schema,
cols: fields,
- rows: table2?.rows ?? []
+ rows: table?.rows ?? []
};
};
-var getMDB = async (plugin, path3) => {
+var getMDB = async (plugin, path2) => {
const sqlJS = await plugin.sqlJS();
- const buf = await getDBFile(plugin, path3, false);
+ const buf = await getDBFile(plugin, path2, false);
if (!buf) {
return null;
}
@@ -144692,7 +134157,7 @@ var getMDB = async (plugin, path3) => {
db.exec(
`SELECT * FROM "${f2.id}"`
)
- )[0] })).reduce((p2, c3) => ({ ...p2, ...c3 }), {});
+ )[0] })).reduce((p, c3) => ({ ...p, ...c3 }), {});
} catch (e5) {
db.close();
return null;
@@ -144704,7 +134169,7 @@ var getMDB = async (plugin, path3) => {
tables: dbTable
};
};
-var getMDBTable = async (adapter, dbPath, table2) => {
+var getMDBTable = async (adapter, dbPath, table) => {
const sqlJS = await adapter.sqlJS();
const buf = await getDBFile(adapter, dbPath, false);
if (!buf) {
@@ -144715,10 +134180,10 @@ var getMDBTable = async (adapter, dbPath, table2) => {
let schema;
try {
fieldsTables = dbResultsToDBTables(
- db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table2}'`)
+ db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table}'`)
);
schema = dbResultsToDBTables(
- db.exec(`SELECT * FROM m_schema WHERE id = '${table2}'`)
+ db.exec(`SELECT * FROM m_schema WHERE id = '${table}'`)
)[0]?.rows[0];
} catch (e5) {
adapter.plugin.superstate.ui.error(e5);
@@ -144734,7 +134199,7 @@ var getMDBTable = async (adapter, dbPath, table2) => {
try {
dbTable = dbResultsToDBTables(
db.exec(
- `SELECT * FROM "${table2}"`
+ `SELECT * FROM "${table}"`
)
);
} catch (e5) {
@@ -144801,24 +134266,24 @@ var getMDBTables = async (plugin, dbPath) => {
db.close();
return mdbTables;
};
-var deleteMDBTable = async (plugin, table2, dbPath) => {
+var deleteMDBTable = async (plugin, table, dbPath) => {
const sqlJS = await plugin.sqlJS();
const buf = await getDBFile(plugin, dbPath, false);
if (!buf) {
return false;
}
const db = new sqlJS.Database(new Uint8Array(buf));
- deleteFromDB(db, "m_schema", `id = '${sanitizeSQLStatement(table2)}'`);
- deleteFromDB(db, "m_schema", `def = '${sanitizeSQLStatement(table2)}'`);
- deleteFromDB(db, "m_fields", `schemaId = '${sanitizeSQLStatement(table2)}'`);
- dropTable(db, table2);
+ deleteFromDB(db, "m_schema", `id = '${sanitizeSQLStatement(table)}'`);
+ deleteFromDB(db, "m_schema", `def = '${sanitizeSQLStatement(table)}'`);
+ deleteFromDB(db, "m_fields", `schemaId = '${sanitizeSQLStatement(table)}'`);
+ dropTable(db, table);
await saveDBFile(plugin, dbPath, db.export().buffer);
db.close();
return true;
};
-var getMDBTableSchemas = async (plugin, path3) => {
+var getMDBTableSchemas = async (plugin, path2) => {
const sqlJS = await plugin.sqlJS();
- const buf = await getDBFile(plugin, path3, false);
+ const buf = await getDBFile(plugin, path2, false);
if (!buf) {
return null;
}
@@ -144827,7 +134292,7 @@ var getMDBTableSchemas = async (plugin, path3) => {
try {
schemas = db.exec(`SELECT * FROM m_schema`);
} catch (e5) {
- console.log(e5, path3);
+ console.log(e5, path2);
}
db.close();
return (schemas[0]?.values ?? []).map((f2) => {
@@ -144835,9 +134300,9 @@ var getMDBTableSchemas = async (plugin, path3) => {
return { id: id3, name: name317, type, def, predicate, primary };
});
};
-var getMDBTableProperties = async (adapter, path3) => {
+var getMDBTableProperties = async (adapter, path2) => {
const sqlJS = await adapter.sqlJS();
- const buf = await getDBFile(adapter, path3, false);
+ const buf = await getDBFile(adapter, path2, false);
if (!buf) {
return null;
}
@@ -144931,16 +134396,16 @@ var deletePropertyToDBTables = (column2, fields) => {
};
// src/adapters/mdb/utils/schema.ts
-var saveSchemaToDBTables = (table2, schemas) => {
- const newSchema = schemas.find((f2) => f2.id == table2.id) ? true : false;
+var saveSchemaToDBTables = (table, schemas) => {
+ const newSchema = schemas.find((f2) => f2.id == table.id) ? true : false;
const newSchemaTable = newSchema ? {
uniques: [],
cols: ["id", "name", "type", "def", "predicate", "primary"],
- rows: schemas.map((f2) => f2.id == table2.id ? table2 : f2)
+ rows: schemas.map((f2) => f2.id == table.id ? table : f2)
} : {
uniques: [],
cols: ["id", "name", "type", "def", "predicate", "primary"],
- rows: [...schemas, table2]
+ rows: [...schemas, table]
};
return {
m_schema: newSchemaTable
@@ -144958,9 +134423,9 @@ var MDBFileTypeAdapter = class {
const sqljs = await loadSQL();
return sqljs;
}
- async newFile(parent, name317, type, content5) {
+ async newFile(parent, name317, type, content3) {
const newPath = `${parent}/${name317}.${type}`;
- await saveDBToPath(this, newPath, content5);
+ await saveDBToPath(this, newPath, content3);
return this.middleware.getFile(newPath);
}
initiate(middleware) {
@@ -145022,12 +134487,12 @@ var MDBFileTypeAdapter = class {
return getMDBTable(this, file.path, fragmentId);
}
if (fragmentType == "mdbCommand") {
- const table2 = await getMDBTable(this, file.path, fragmentId);
- if (table2)
+ const table = await getMDBTable(this, file.path, fragmentId);
+ if (table)
return {
- schema: mdbSchemaToCommandSchema(table2.schema),
- fields: table2.cols.filter((f2) => f2.name != "$function"),
- code: table2.cols.find((f2) => f2.name == "$function")?.value ?? ""
+ schema: mdbSchemaToCommandSchema(table.schema),
+ fields: table.cols.filter((f2) => f2.name != "$function"),
+ code: table.cols.find((f2) => f2.name == "$function")?.value ?? ""
};
}
if (fragmentType == "mdbCommands") {
@@ -145041,49 +134506,49 @@ var MDBFileTypeAdapter = class {
});
}
}
- async newContent(file, fragmentType, name317, content5, options) {
+ async newContent(file, fragmentType, name317, content3, options) {
if (fragmentType == "schema") {
const schemas = await this.readContent(file, "schemas", null);
- const dbTables = saveSchemaToDBTables(content5, schemas);
+ const dbTables = saveSchemaToDBTables(content3, schemas);
return saveDBToPath(this, file.path, dbTables);
}
if (fragmentType == "field") {
const oldFields = await this.readContent(file, "fields", null);
- const dbTables = savePropertyToDBTables(content5, oldFields);
+ const dbTables = savePropertyToDBTables(content3, oldFields);
return saveDBToPath(this, file.path, dbTables);
}
if (fragmentType == "table") {
- return saveDBToPath(this, file.path, { [name317]: content5 });
+ return saveDBToPath(this, file.path, { [name317]: content3 });
}
if (fragmentType == "tables") {
- return saveDBToPath(this, file.path, content5);
+ return saveDBToPath(this, file.path, content3);
}
if (fragmentType == "mdbTable") {
- return saveDBToPath(this, file.path, mdbTablesToDBTables({ [name317]: content5 }));
+ return saveDBToPath(this, file.path, mdbTablesToDBTables({ [name317]: content3 }));
}
if (fragmentType == "mdbFrame") {
- return saveDBToPath(this, file.path, mdbFrameToDBTables({ [name317]: content5 }));
+ return saveDBToPath(this, file.path, mdbFrameToDBTables({ [name317]: content3 }));
}
}
- async saveContent(file, fragmentType, fragmentId, content5) {
+ async saveContent(file, fragmentType, fragmentId, content3) {
if (fragmentType == "schema") {
const schemas = await this.readContent(file, "schemas", null) ?? [];
- const dbTables = saveSchemaToDBTables(content5(schemas.find((t5) => t5.id == fragmentId)), schemas);
+ const dbTables = saveSchemaToDBTables(content3(schemas.find((t5) => t5.id == fragmentId)), schemas);
return saveDBToPath(this, file.path, dbTables);
}
if (fragmentType == "field") {
const oldFields = await this.readContent(file, "fields", null);
const oldField = oldFields.find((t5) => t5.name == fragmentId.name && t5.schemaId == fragmentId.schemaId);
- const dbTables = savePropertyToDBTables(content5(oldField), oldFields, oldField);
+ const dbTables = savePropertyToDBTables(content3(oldField), oldFields, oldField);
return saveDBToPath(this, file.path, dbTables);
}
if (fragmentType == "table") {
- return saveDBToPath(this, file.path, { [fragmentId]: content5(this.cache.get(file.path)["tables"][fragmentId]) });
+ return saveDBToPath(this, file.path, { [fragmentId]: content3(this.cache.get(file.path)["tables"][fragmentId]) });
}
if (fragmentType == "mdbTable") {
const mdbTable = await this.readContent(file, "mdbTable", fragmentId);
const oldFields = await this.readContent(file, "fields", null);
- const tables = { [fragmentId]: content5(mdbTable) };
+ const tables = { [fragmentId]: content3(mdbTable) };
const newFields = {
m_fields: {
uniques: fieldSchema.uniques,
@@ -145095,13 +134560,13 @@ var MDBFileTypeAdapter = class {
}
if (fragmentType == "mdbFrame") {
const mdbTable = await this.readContent(file, "mdbFrame", fragmentId);
- return saveDBToPath(this, file.path, mdbFrameToDBTables({ [fragmentId]: content5(mdbTable) }));
+ return saveDBToPath(this, file.path, mdbFrameToDBTables({ [fragmentId]: content3(mdbTable) }));
}
if (fragmentType == "mdbCommand") {
const mdbTable = await this.readContent(file, "mdbCommand", fragmentId);
const schemas = await this.readContent(file, "schemas", null) ?? [];
const schema = schemas.find((t5) => t5.id == fragmentId);
- const newCommand = content5(mdbTable);
+ const newCommand = content3(mdbTable);
const newSchema = frameSchemaToTableSchema(newCommand.schema);
if (!import_lodash20.default.isEqual(newSchema, schema)) {
const dbTables = saveSchemaToDBTables(newSchema, schemas);
@@ -145202,9 +134667,9 @@ var getAllFilesForTag = (plugin, tag2) => {
})();
return tagsCache;
};
-var addTagToProperties = (manager, tag2, path3) => {
+var addTagToProperties = (manager, tag2, path2) => {
const newTag = validateName(tag2);
- editTagInProperties(manager, "", newTag, path3);
+ editTagInProperties(manager, "", newTag, path2);
};
var positionsForTag = (plugin, tag2, file) => {
const currentCache = plugin.app.metadataCache.getFileCache(file);
@@ -145235,8 +134700,8 @@ var renameTagInMarkdownFile = async (plugin, tag2, newTag, tFile) => {
await editTagInProperties(plugin.superstate.spaceManager, tag2, newTag, tFile.path);
}
};
-var removeTagInProperties = async (manager, oldTag, path3) => {
- const fm = await manager.readProperties(path3);
+var removeTagInProperties = async (manager, oldTag, path2) => {
+ const fm = await manager.readProperties(path2);
const processKey = (value) => {
if (Array.isArray(value)) {
return value.filter((f2) => stringFromTag(oldTag) != f2);
@@ -145259,10 +134724,10 @@ var removeTagInProperties = async (manager, oldTag, path3) => {
return false;
});
editKeys.forEach((tag2) => {
- manager.saveProperties(path3, { [tag2]: processKey(fm[tag2]) });
+ manager.saveProperties(path2, { [tag2]: processKey(fm[tag2]) });
});
};
-var editTagInProperties = async (manager, oldTag, newTag, path3) => {
+var editTagInProperties = async (manager, oldTag, newTag, path2) => {
const addTag2 = (value) => {
if (Array.isArray(value)) {
return uniq([...value, stringFromTag(newTag)]).filter((f2) => f2?.length > 0);
@@ -145274,7 +134739,7 @@ var editTagInProperties = async (manager, oldTag, newTag, path3) => {
}
return stringFromTag(newTag);
};
- const fm = await manager.readProperties(path3);
+ const fm = await manager.readProperties(path2);
if (fm) {
const processKey = (value) => {
if (Array.isArray(value)) {
@@ -145304,18 +134769,18 @@ var editTagInProperties = async (manager, oldTag, newTag, path3) => {
return false;
});
if (editKeys.length > 0) {
- editKeys.forEach((key3) => {
- manager.saveProperties(path3, {
- [key3]: processKey(fm[key3])
+ editKeys.forEach((key2) => {
+ manager.saveProperties(path2, {
+ [key2]: processKey(fm[key2])
});
});
} else {
- manager.saveProperties(path3, {
+ manager.saveProperties(path2, {
tags: addTag2(fm["tags"])
});
}
} else {
- manager.saveProperties(path3, {
+ manager.saveProperties(path2, {
tags: stringFromTag(newTag)
});
}
@@ -145325,19 +134790,19 @@ var editTagInFileBody = async (plugin, oldTag, newTag, positions, file) => {
if (positions.length == 0)
return false;
const original = await plugin.files.readTextFromFile(file.path);
- let text7 = original;
+ let text2 = original;
let offset2 = 0;
for (const { start, end } of positions) {
const startOff = start.offset + offset2;
const endOff = end.offset + offset2;
- if (text7.slice(startOff, endOff) !== oldTag) {
+ if (text2.slice(startOff, endOff) !== oldTag) {
return false;
}
- text7 = text7.slice(0, startOff) + newTag + text7.slice(startOff + oldTag.length);
+ text2 = text2.slice(0, startOff) + newTag + text2.slice(startOff + oldTag.length);
offset2 += offsetOffset;
}
- if (text7 !== original) {
- await plugin.files.writeTextToFile(file.path, text7);
+ if (text2 !== original) {
+ await plugin.files.writeTextToFile(file.path, text2);
return true;
}
};
@@ -145389,19 +134854,19 @@ var LocalStorageCache = class {
reset() {
replaceDB(this.db, this.defaultTables);
}
- async store(path3, cache2, type) {
+ async store(path2, cache2, type) {
if (!this.db)
return;
await insertIntoDB(this.db, {
- [type]: { ...this.defaultTables[type], rows: [{ path: path3, cache: cache2, version: this.indexVersion }] }
+ [type]: { ...this.defaultTables[type], rows: [{ path: path2, cache: cache2, version: this.indexVersion }] }
}, true);
this.debounceSaveSpaceDatabase();
return;
}
- async remove(path3, type) {
+ async remove(path2, type) {
if (!this.db)
return;
- await deleteFromDB(this.db, type, `path='${path3}'`);
+ await deleteFromDB(this.db, type, `path='${path2}'`);
this.debounceSaveSpaceDatabase();
return;
}
@@ -145428,9 +134893,9 @@ var MobileCachePersister = class {
this.indexVersion = Date.now().toString();
this.debounceSaveSpaceDatabase = (0, import_lodash23.debounce)(
(maps) => {
- const tables = Object.keys(maps).reduce((p2, c3) => {
+ const tables = Object.keys(maps).reduce((p, c3) => {
return {
- ...p2,
+ ...p,
[c3]: {
...CacheDBSchema,
rows: [...this.maps[c3].values()]
@@ -145465,7 +134930,7 @@ var MobileCachePersister = class {
replaceDB(db, this.types.reduce((acc, type) => ({ ...acc, [type]: CacheDBSchema }), {}));
await saveZippedDBFile(this.mdbAdapter, this.storageDBPath, db.export().buffer);
}
- this.maps = this.types.reduce((p2, type) => ({ ...p2, [type]: new Map((selectDB(db, type)?.rows ?? []).map((f2) => [f2.path, f2])) }), {});
+ this.maps = this.types.reduce((p, type) => ({ ...p, [type]: new Map((selectDB(db, type)?.rows ?? []).map((f2) => [f2.path, f2])) }), {});
db.close();
}
async reset() {
@@ -145475,13 +134940,13 @@ var MobileCachePersister = class {
this.maps = this.types.reduce((acc, type) => ({ ...acc, [type]: new Map((selectDB(db, type)?.rows ?? []).map((f2) => [f2.path, f2])) }), {});
db.close();
}
- async store(path3, cache2, type) {
- this.maps[type].set(path3, { path: path3, cache: cache2, version: this.indexVersion });
+ async store(path2, cache2, type) {
+ this.maps[type].set(path2, { path: path2, cache: cache2, version: this.indexVersion });
this.debounceSaveSpaceDatabase(this.maps);
return;
}
- async remove(path3, type) {
- this.maps[type].delete(path3);
+ async remove(path2, type) {
+ this.maps[type].delete(path2);
this.debounceSaveSpaceDatabase(this.maps);
return;
}
@@ -145622,56 +135087,56 @@ var ObsidianFileSystem = class {
this.vaultQueue = this.vaultQueue.then(operation).catch(() => {
});
}
- updateFileCache(path3, cache2, refresh) {
+ updateFileCache(path2, cache2, refresh) {
if (!cache2)
return;
- const oldCache = this.cache.get(path3);
+ const oldCache = this.cache.get(path2);
const newCache = { ...oldCache, ...cache2 };
if (oldCache && import_lodash24.default.isEqual(newCache, oldCache)) {
return;
}
- this.cache.set(path3, newCache);
- this.persister.store(path3, JSON.stringify(newCache), "file");
+ this.cache.set(path2, newCache);
+ this.persister.store(path2, JSON.stringify(newCache), "file");
if (refresh)
- this.middleware.eventDispatch.dispatchEvent("onCacheUpdated", { path: path3 });
+ this.middleware.eventDispatch.dispatchEvent("onCacheUpdated", { path: path2 });
}
readAllTags() {
return loadTags(this.plugin.app, this.plugin.superstate.settings);
}
- async addTagToFile(path3, tag2) {
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ async addTagToFile(path2, tag2) {
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (!file)
return;
if (file.extension == "md") {
addTagToProperties(this.plugin.superstate.spaceManager, tag2, file.path);
return;
}
- const vaultItem = this.cache.get(path3);
+ const vaultItem = this.cache.get(path2);
if (!vaultItem)
return;
- this.updateFileLabel(path3, "tags", serializeMultiDisplayString([...vaultItem.tags, tag2]));
+ this.updateFileLabel(path2, "tags", serializeMultiDisplayString([...vaultItem.tags, tag2]));
}
- async renameTagForFile(path3, oldTag, newTag) {
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ async renameTagForFile(path2, oldTag, newTag) {
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (file.extension == "md") {
renameTagInMarkdownFile(this.plugin, oldTag, newTag, file);
return;
}
- const vaultItem = this.cache.get(path3);
+ const vaultItem = this.cache.get(path2);
if (!vaultItem)
return;
- this.updateFileLabel(path3, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != oldTag), newTag]));
+ this.updateFileLabel(path2, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != oldTag), newTag]));
}
- async removeTagFromFile(path3, tag2) {
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ async removeTagFromFile(path2, tag2) {
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (file.extension == "md") {
removeTagFromMarkdownFile(this.plugin, tag2, file);
return;
}
- const vaultItem = this.cache.get(path3);
+ const vaultItem = this.cache.get(path2);
if (!vaultItem)
return;
- this.updateFileLabel(path3, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != tag2)]));
+ this.updateFileLabel(path2, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != tag2)]));
}
async loadCacheFromObsidianCache() {
await this.persister.initialize();
@@ -145752,25 +135217,25 @@ var ObsidianFileSystem = class {
allFiles() {
return getAllAbstractFilesInVault(this.plugin.app).map((f2) => tFileToAFile(f2));
}
- getFileCache(path3, source) {
- return this.cache.get(path3);
+ getFileCache(path2, source) {
+ return this.cache.get(path2);
}
- parentPathForPath(path3) {
+ parentPathForPath(path2) {
return removeTrailingSlashFromFolder(
- getParentPathFromString(path3)
+ getParentPathFromString(path2)
);
}
- resolvePath(path3, source) {
- if (!source || !path3)
- return path3;
- return this.plugin.app.metadataCache.getFirstLinkpathDest(path3, source)?.path ?? path3;
+ resolvePath(path2, source) {
+ if (!source || !path2)
+ return path2;
+ return this.plugin.app.metadataCache.getFirstLinkpathDest(path2, source)?.path ?? path2;
}
- updateFileLabel(path3, label, content5) {
+ updateFileLabel(path2, label, content3) {
{
- const newVaultDB = this.vaultDBCache.map((f2) => f2.path == path3 ? { ...f2, [label]: content5 } : f2);
+ const newVaultDB = this.vaultDBCache.map((f2) => f2.path == path2 ? { ...f2, [label]: content3 } : f2);
this.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } });
- const file = this.cache.get(path3);
- this.middleware.updateFileCache(path3, { label: { ...file.label, [label]: content5 } }, true);
+ const file = this.cache.get(path2);
+ this.middleware.updateFileCache(path2, { label: { ...file.label, [label]: content3 } }, true);
}
}
async saveSpacesDatabaseToDisk(tables, save = true) {
@@ -145787,23 +135252,23 @@ var ObsidianFileSystem = class {
initiate(middleware) {
this.middleware = middleware;
}
- resourcePathForPath(path3) {
- if (!path3)
- return path3;
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ resourcePathForPath(path2) {
+ if (!path2)
+ return path2;
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (file instanceof import_obsidian20.TFile) {
return this.plugin.app.vault.getResourcePath(file);
- } else if (path3.match(urlRegex)) {
- return path3;
+ } else if (path2.match(urlRegex)) {
+ return path2;
}
const returnPath = this.parentPathForPath(this.plugin.app.vault.getResourcePath(this.plugin.app.vault.getRoot()));
- return `${returnPath}/${path3}`;
+ return `${returnPath}/${path2}`;
}
async getRoot() {
return tFileToAFile(this.plugin.app.vault.getRoot());
}
- async copyFile(path3, folder, newName) {
- const file = await this.getFile(path3);
+ async copyFile(path2, folder, newName) {
+ const file = await this.getFile(path2);
if (!file)
return;
newName = newName ? file.extension?.length > 0 ? newName + "." + file.extension : newName : file.filename;
@@ -145819,7 +135284,7 @@ var ObsidianFileSystem = class {
const files = await this.plugin.app.vault.adapter.list(folder2);
for (const f2 of files.files) {
if (newName != file.name) {
- if (folder2 == path3 && f2.split("/").pop() == file.name + ".md") {
+ if (folder2 == path2 && f2.split("/").pop() == file.name + ".md") {
await this.plugin.app.vault.adapter.copy(f2, newPath2 + "/" + newName + ".md");
continue;
}
@@ -145853,96 +135318,96 @@ var ObsidianFileSystem = class {
this.cache.set(newFile.path, {
...this.cache.get(file.path),
file: newFile,
- label: { ...this.cache.get(path3)?.label, name: newFile.name },
+ label: { ...this.cache.get(path2)?.label, name: newFile.name },
parent: newFile.parent,
type: newFile.isFolder ? "space" : "file",
subtype: newFile.isFolder ? "folder" : newFile.extension
});
return newPath;
}
- async writeTextToFile(path3, content5) {
- const newFile = this.plugin.app.vault.getAbstractFileByPath(path3);
+ async writeTextToFile(path2, content3) {
+ const newFile = this.plugin.app.vault.getAbstractFileByPath(path2);
if (!newFile) {
- await this.plugin.app.vault.adapter.write(path3, content5);
+ await this.plugin.app.vault.adapter.write(path2, content3);
} else {
- await this.plugin.app.vault.modify(newFile, content5);
+ await this.plugin.app.vault.modify(newFile, content3);
}
}
- async readTextFromFile(path3) {
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ async readTextFromFile(path2) {
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (file) {
return this.plugin.app.vault.read(file);
}
- if (await this.fileExists(path3))
- return this.plugin.app.vault.adapter.read(path3);
+ if (await this.fileExists(path2))
+ return this.plugin.app.vault.adapter.read(path2);
return null;
}
- async writeBinaryToFile(path3, buffer2) {
+ async writeBinaryToFile(path2, buffer) {
return this.plugin.app.vault.adapter.writeBinary(
- path3,
- buffer2
+ path2,
+ buffer
);
}
- async readBinaryToFile(path3) {
- return this.plugin.app.vault.adapter.readBinary(path3);
+ async readBinaryToFile(path2) {
+ return this.plugin.app.vault.adapter.readBinary(path2);
}
- async renameFile(path3, newPath) {
+ async renameFile(path2, newPath) {
return this.plugin.app.fileManager.renameFile(
- this.plugin.app.vault.getAbstractFileByPath(path3),
+ this.plugin.app.vault.getAbstractFileByPath(path2),
newPath
);
}
- async createFolder(path3) {
- if (!await this.fileExists(path3)) {
- await this.plugin.app.vault.adapter.mkdir(path3);
- return this.getFile(path3);
+ async createFolder(path2) {
+ if (!await this.fileExists(path2)) {
+ await this.plugin.app.vault.adapter.mkdir(path2);
+ return this.getFile(path2);
} else {
- return this.getFile(path3);
+ return this.getFile(path2);
}
}
- async fileExists(path3) {
- return this.plugin.app.vault.adapter.exists(path3);
+ async fileExists(path2) {
+ return this.plugin.app.vault.adapter.exists(path2);
}
- async getFile(path3, source) {
+ async getFile(path2, source) {
let aFile;
if (source) {
- aFile = tFileToAFile(this.plugin.app.metadataCache.getFirstLinkpathDest(path3, source));
+ aFile = tFileToAFile(this.plugin.app.metadataCache.getFirstLinkpathDest(path2, source));
} else {
- aFile = tFileToAFile(this.plugin.app.vault.getAbstractFileByPath(path3));
+ aFile = tFileToAFile(this.plugin.app.vault.getAbstractFileByPath(path2));
}
if (!aFile) {
- if (!await this.fileExists(path3)) {
+ if (!await this.fileExists(path2)) {
return null;
}
- const fileStat = await this.plugin.app.vault.adapter.stat(path3);
+ const fileStat = await this.plugin.app.vault.adapter.stat(path2);
if (!fileStat)
return null;
const type = fileStat?.type;
- const extension2 = type == "file" ? path3.split(".").pop() : null;
- const folder = path3.split("/").slice(0, -1).join("/");
- const filename = path3.split("/").pop();
+ const extension = type == "file" ? path2.split(".").pop() : null;
+ const folder = path2.split("/").slice(0, -1).join("/");
+ const filename = path2.split("/").pop();
const name317 = type == "file" ? filename.substring(0, filename.lastIndexOf(".")) : filename;
aFile = {
- path: path3,
+ path: path2,
name: name317,
filename,
parent: folder,
isFolder: type == "folder",
- extension: extension2
+ extension
};
}
return aFile;
}
- async deleteFile(path3) {
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ async deleteFile(path2) {
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (!file) {
- const fileExists = await this.fileExists(path3);
+ const fileExists = await this.fileExists(path2);
if (fileExists) {
- const stat = await this.plugin.app.vault.adapter.stat(path3);
+ const stat = await this.plugin.app.vault.adapter.stat(path2);
if (stat.type == "folder") {
- return this.plugin.app.vault.adapter.rmdir(path3, true);
+ return this.plugin.app.vault.adapter.rmdir(path2, true);
} else {
- return this.plugin.app.vault.adapter.remove(path3);
+ return this.plugin.app.vault.adapter.remove(path2);
}
}
}
@@ -145960,13 +135425,13 @@ var ObsidianFileSystem = class {
filesForTag(tag2) {
return getAllFilesForTag(this.plugin, tag2);
}
- childrenForFolder(path3, type) {
+ childrenForFolder(path2, type) {
if (type == "folder") {
- return this.plugin.app.vault.adapter.list(path3).then((g) => g.folders);
+ return this.plugin.app.vault.adapter.list(path2).then((g) => g.folders);
} else if (type == "file") {
- return this.plugin.app.vault.adapter.list(path3).then((g) => g.files);
+ return this.plugin.app.vault.adapter.list(path2).then((g) => g.files);
}
- return this.plugin.app.vault.adapter.list(path3).then((g) => [...g.files, ...g.folders]);
+ return this.plugin.app.vault.adapter.list(path2).then((g) => [...g.files, ...g.folders]);
}
};
@@ -146097,13 +135562,13 @@ var ObsidianMarkdownFiletypeAdapter = class {
const fm = frontMatterForFile(this.app, tfile);
const fmKeys = frontMatterKeys(fm);
const rows = fmKeys.reduce(
- (p2, c3) => ({ ...p2, [c3]: parseProperty(c3, fm[c3]) }),
+ (p, c3) => ({ ...p, [c3]: parseProperty(c3, fm[c3]) }),
{}
);
return rows;
}
}
- async newFile(parent, name317, type, content5) {
+ async newFile(parent, name317, type, content3) {
let parentFolder = getAbstractFileAtPath(this.app, parent);
if (!parentFolder) {
await this.middleware.createFolder(parent);
@@ -146113,22 +135578,22 @@ var ObsidianMarkdownFiletypeAdapter = class {
parentFolder ? parentFolder instanceof import_obsidian21.TFolder ? parentFolder : parentFolder.parent : this.app.vault.getRoot(),
name317
).then(async (f2) => {
- if (content5) {
- await this.app.vault.modify(f2, content5);
+ if (content3) {
+ await this.app.vault.modify(f2, content3);
}
return tFileToAFile(f2);
});
}
- async saveContent(file, fragmentType, fragmentId, content5) {
+ async saveContent(file, fragmentType, fragmentId, content3) {
if (fragmentType == "label") {
const afile = this.app.vault.getAbstractFileByPath(file.path);
if (afile && afile instanceof import_obsidian21.TFile) {
if (this.app.fileManager.processFrontMatter) {
await this.app.fileManager.processFrontMatter(afile, (frontmatter) => {
if (fragmentId == "sticker") {
- frontmatter[this.plugin.superstate.settings.fmKeySticker] = content5(frontmatter);
+ frontmatter[this.plugin.superstate.settings.fmKeySticker] = content3(frontmatter);
} else if (fragmentId == "color") {
- frontmatter[this.plugin.superstate.settings.fmKeyColor] = content5(frontmatter);
+ frontmatter[this.plugin.superstate.settings.fmKeyColor] = content3(frontmatter);
}
});
}
@@ -146139,7 +135604,7 @@ var ObsidianMarkdownFiletypeAdapter = class {
if (afile && afile instanceof import_obsidian21.TFile) {
if (this.app.fileManager.processFrontMatter) {
await this.app.fileManager.processFrontMatter(afile, (frontmatter) => {
- const newFrontmatter = content5(frontmatter);
+ const newFrontmatter = content3(frontmatter);
const newKeys = Object.keys(newFrontmatter);
newKeys.forEach((f2) => {
frontmatter[f2] = newFrontmatter?.[f2];
@@ -146381,17 +135846,17 @@ var MakeMenu = class extends import_obsidian22.EditorSuggest {
return;
if (cmd.value == "note") {
const offset2 = _evt.target.getBoundingClientRect();
- showLinkMenu(offset2, this.plugin.superstate, (link3) => {
- editor.replaceRange(`![![${link3}]]`, { ...start, ch: startCh }, end);
+ showLinkMenu(offset2, this.plugin.superstate, (link) => {
+ editor.replaceRange(`![![${link}]]`, { ...start, ch: startCh }, end);
this.resetInfos();
this.close();
});
} else if (cmd.value == "context") {
const offset2 = _evt.target.getBoundingClientRect();
- showSpacesMenu(offset2, this.plugin.superstate, (link3) => {
+ showSpacesMenu(offset2, this.plugin.superstate, (link) => {
editor.replaceRange(
contextEmbedStringFromContext(
- this.plugin.superstate.spacesIndex.get(link3),
+ this.plugin.superstate.spacesIndex.get(link),
"files"
),
{ ...start, ch: startCh },
@@ -146406,8 +135871,8 @@ var MakeMenu = class extends import_obsidian22.EditorSuggest {
});
} else if (cmd.value == "link") {
const offset2 = _evt.target.getBoundingClientRect();
- showLinkMenu(offset2, this.plugin.superstate, (link3) => {
- editor.replaceRange(`[[${link3}]]`, { ...start, ch: startCh }, end);
+ showLinkMenu(offset2, this.plugin.superstate, (link) => {
+ editor.replaceRange(`[[${link}]]`, { ...start, ch: startCh }, end);
this.resetInfos();
this.close();
});
@@ -146415,9 +135880,9 @@ var MakeMenu = class extends import_obsidian22.EditorSuggest {
this.plugin.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react192.default.createElement(ImageModal_default, {
superstate: this.plugin.superstate,
hide: _props.hide,
- selectedPath: (image3) => {
+ selectedPath: (image) => {
editor.replaceRange(
- `![[${image3}]]`,
+ `![[${image}]]`,
{ ...start, ch: startCh },
end
);
@@ -151869,8 +141334,8 @@ var StickerMenu = class extends import_obsidian23.EditorSuggest {
this.cmdStartCh = 0;
this.plugin = plugin;
this.emojis = Object.keys(emojis).reduce(
- (p2, c3) => [
- ...p2,
+ (p, c3) => [
+ ...p,
...emojis[c3].map((e5) => ({
label: e5.n[0],
desc: e5.n[1],
@@ -151975,9 +141440,9 @@ var modifyTabSticker = (plugin) => {
if (pathCache?.label.sticker && leaf.tabHeaderInnerIconEl) {
const [stickerType, stickerPath] = parseStickerString(pathCache.label.sticker);
if (stickerType == "image") {
- const path3 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath));
- if (path3)
- leaf.tabHeaderInnerIconEl.innerHTML = ``;
+ const path2 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath));
+ if (path2)
+ leaf.tabHeaderInnerIconEl.innerHTML = ``;
} else {
const icon = stickerFromString(pathCache.label.sticker, plugin);
leaf.tabHeaderInnerIconEl.innerHTML = icon;
@@ -151992,10 +141457,10 @@ var modifyTabSticker = (plugin) => {
if (fileCache?.label?.sticker && leaf.tabHeaderInnerIconEl) {
const [stickerType, stickerPath] = parseStickerString(fileCache.label.sticker);
if (stickerType == "image") {
- const path3 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath));
- if (!path3)
- return path3;
- leaf.tabHeaderInnerIconEl.innerHTML = ``;
+ const path2 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath));
+ if (!path2)
+ return path2;
+ leaf.tabHeaderInnerIconEl.innerHTML = ``;
} else {
const icon = stickerFromString(fileCache.label.sticker, plugin);
leaf.tabHeaderInnerIconEl.innerHTML = icon;
@@ -152019,7 +141484,7 @@ function useInTreeCreateRoot() {
};
const createRoot2 = (0, import_react194.useCallback)(
(container, options) => {
- const root4 = {
+ const root = {
render: (children) => {
setRoots((roots2) => {
const newRoots = new Map(roots2);
@@ -152044,15 +141509,15 @@ function useInTreeCreateRoot() {
return new Map(roots2).set(container, null);
});
setRootMap((r2) => {
- return new Map(r2).set(container, root4);
+ return new Map(r2).set(container, root);
});
- return root4;
+ return root;
},
[]
);
const portals = (0, import_react194.useMemo)(() => {
- return [...roots.entries()].map(([container, root4]) => {
- return (0, import_react_dom12.createPortal)(root4, container);
+ return [...roots.entries()].map(([container, root]) => {
+ return (0, import_react_dom12.createPortal)(root, container);
});
}, [roots]);
return { createRoot: createRoot2, portals, getRoot };
@@ -152195,20 +141660,20 @@ var showModal = (props) => {
portalElement.classList.add("mk-modal-wrapper");
}
document.body.appendChild(portalElement);
- const hideFunction = (root5) => {
+ const hideFunction = (root2) => {
let hasBeenCalled = false;
return () => {
if (hasBeenCalled)
return;
- root5.unmount();
+ root2.unmount();
document.body.removeChild(portalElement);
hasBeenCalled = true;
};
};
- const root4 = props.ui.createRoot(portalElement);
- const hide = hideFunction(root4);
+ const root = props.ui.createRoot(portalElement);
+ const hide = hideFunction(root);
const updateRoot = (newProps) => {
- root4.render(
+ root.render(
/* @__PURE__ */ import_react197.default.createElement(ModalWrapper, {
ui: props.ui.manager,
hide: () => hide(),
@@ -152263,14 +141728,14 @@ var HiddenPaths = (props) => {
superstate.saveSettings();
superstate.initializePaths();
};
- const removeExtension = (index3) => {
- superstate.settings.hiddenExtensions = superstate.settings.hiddenExtensions.filter((f2, i4) => i4 != index3);
+ const removeExtension = (index2) => {
+ superstate.settings.hiddenExtensions = superstate.settings.hiddenExtensions.filter((f2, i4) => i4 != index2);
superstate.saveSettings();
superstate.initializePaths();
};
- const removeItem = (index3) => {
+ const removeItem = (index2) => {
superstate.settings.hiddenFiles = superstate.settings.hiddenFiles.filter(
- (f2, i4) => i4 != index3
+ (f2, i4) => i4 != index2
);
superstate.saveSettings();
superstate.initializePaths();
@@ -152322,8 +141787,8 @@ var HiddenPaths = (props) => {
className: "setting-item setting-item-heading"
}, i18n_default.labels.hiddenFilePattern), /* @__PURE__ */ import_react198.default.createElement("div", {
className: "setting-item-description"
- }, i18n_default.descriptions.hiddenFileOptions), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenExtensions.map((f2, index3) => /* @__PURE__ */ import_react198.default.createElement("div", {
- key: index3,
+ }, i18n_default.descriptions.hiddenFileOptions), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenExtensions.map((f2, index2) => /* @__PURE__ */ import_react198.default.createElement("div", {
+ key: index2,
className: "mobile-option-setting-item"
}, /* @__PURE__ */ import_react198.default.createElement("span", {
className: "mobile-option-setting-item-name"
@@ -152333,7 +141798,7 @@ var HiddenPaths = (props) => {
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//close")
},
- onClick: () => removeExtension(index3)
+ onClick: () => removeExtension(index2)
})))), /* @__PURE__ */ import_react198.default.createElement("div", {
className: "setting-item"
}, /* @__PURE__ */ import_react198.default.createElement("input", {
@@ -152346,8 +141811,8 @@ var HiddenPaths = (props) => {
className: "setting-item setting-item-heading"
}, i18n_default.subViews.filesAndFolders), /* @__PURE__ */ import_react198.default.createElement("div", {
className: "setting-item-description"
- }, i18n_default.labels.hiddenFileSpecific), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenPaths.map((f2, index3) => /* @__PURE__ */ import_react198.default.createElement("div", {
- key: index3,
+ }, i18n_default.labels.hiddenFileSpecific), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenPaths.map((f2, index2) => /* @__PURE__ */ import_react198.default.createElement("div", {
+ key: index2,
className: "mobile-option-setting-item"
}, /* @__PURE__ */ import_react198.default.createElement("span", {
className: "mobile-option-setting-item-name"
@@ -152357,7 +141822,7 @@ var HiddenPaths = (props) => {
dangerouslySetInnerHTML: {
__html: props.superstate.ui.getSticker("ui//close")
},
- onClick: () => removeItem(index3)
+ onClick: () => removeItem(index2)
})))), /* @__PURE__ */ import_react198.default.createElement("div", {
className: "setting-item"
}, /* @__PURE__ */ import_react198.default.createElement("button", {
@@ -152381,11 +141846,11 @@ var showMainMenu = (el, superstate, app2) => {
if (isMobile) {
const mobileDrawer = app2.workspace.leftSplit;
const leaves = mobileDrawer.children;
- const index3 = leaves.reduce((p2, c3, i4) => {
- return c3.getViewState().type == FILE_TREE_VIEW_TYPE ? i4 : p2;
+ const index2 = leaves.reduce((p, c3, i4) => {
+ return c3.getViewState().type == FILE_TREE_VIEW_TYPE ? i4 : p;
}, -1);
- spaceActive2 = index3 == mobileDrawer.currentTab;
- leafs2.push(...leaves.filter((l2, i4) => i4 != index3));
+ spaceActive2 = index2 == mobileDrawer.currentTab;
+ leafs2.push(...leaves.filter((l2, i4) => i4 != index2));
}
return { leafs: leafs2, spaceActive: spaceActive2 };
};
@@ -152512,8 +141977,8 @@ var ObsidianUI = class {
this.getSticker = (icon) => {
return stickerFromString(icon, this.plugin);
};
- this.openToast = (content5) => {
- new import_obsidian25.Notice(content5);
+ this.openToast = (content3) => {
+ new import_obsidian25.Notice(content3);
};
this.openPalette = (modal, className) => {
return showModal({ ui: this, fc: modal, isPalette: true, className });
@@ -152521,14 +141986,14 @@ var ObsidianUI = class {
this.openModal = (title, modal, className, props) => {
return showModal({ ui: this, fc: modal, title, className, props });
};
- this.openPopover = (position3, popover) => {
+ this.openPopover = (position, popover) => {
};
this.dragStarted = (e5, paths) => {
if (paths.length == 0)
return;
if (paths.length == 1) {
- const path3 = paths[0];
- const file = getAbstractFileAtPath(this.plugin.app, path3);
+ const path2 = paths[0];
+ const file = getAbstractFileAtPath(this.plugin.app, path2);
if (!file)
return;
if (file instanceof import_obsidian25.TFile) {
@@ -152592,8 +142057,8 @@ var ObsidianUI = class {
html: this.plugin.superstate.iconsCache.get(f2)
}));
const allEmojis = Object.keys(emojis).reduce(
- (p2, c3) => [
- ...p2,
+ (p, c3) => [
+ ...p,
...emojis[c3].map((e5) => ({
type: "emoji",
name: e5.n[0],
@@ -152605,8 +142070,8 @@ var ObsidianUI = class {
);
return [...allEmojis, ...allCustom, ...allLucide];
};
- this.getUIPath = (path3, thumbnail) => {
- const file = this.plugin.app.vault.getAbstractFileByPath(path3);
+ this.getUIPath = (path2, thumbnail) => {
+ const file = this.plugin.app.vault.getAbstractFileByPath(path2);
if (file instanceof import_obsidian25.TFile) {
if (thumbnail) {
const thumb = this.plugin.superstate.pathsIndex.get(file.path)?.label?.thumbnail;
@@ -152615,25 +142080,25 @@ var ObsidianUI = class {
}
}
return this.plugin.app.vault.getResourcePath(file);
- } else if (path3?.match(urlRegex)) {
- return path3;
+ } else if (path2?.match(urlRegex)) {
+ return path2;
}
const returnPath = getParentPathFromString(
this.plugin.app.vault.getResourcePath(
this.plugin.app.vault.getRoot()
)
);
- return `${returnPath}${path3}`;
+ return `${returnPath}${path2}`;
};
- this.viewsByPath = (path3) => {
- const abstractFile = getAbstractFileAtPath(this.plugin.app, path3);
+ this.viewsByPath = (path2) => {
+ const abstractFile = getAbstractFileAtPath(this.plugin.app, path2);
if (abstractFile instanceof import_obsidian25.TFile) {
return this.plugin.app.workspace.getLeavesOfType("markdown").filter((f2) => {
- return f2.view.file?.path == path3;
+ return f2.view.file?.path == path2;
}).map((f2) => {
return {
path: f2.view.file?.path,
- openPath: (path4) => {
+ openPath: (path3) => {
f2.openFile(abstractFile);
},
parent: null,
@@ -152642,14 +142107,14 @@ var ObsidianUI = class {
});
} else {
return this.plugin.app.workspace.getLeavesOfType(SPACE_VIEW_TYPE).filter((f2) => {
- return f2.view.getState().path == path3;
+ return f2.view.getState().path == path2;
}).map((f2) => {
return {
path: f2.view.getState().path,
- openPath: (path4) => {
+ openPath: (path3) => {
f2.setViewState({
type: SPACE_VIEW_TYPE,
- state: { path: path4 }
+ state: { path: path3 }
});
},
parent: null,
@@ -152658,13 +142123,13 @@ var ObsidianUI = class {
});
}
};
- this.openPath = (path3, newLeaf, source, props) => {
+ this.openPath = (path2, newLeaf, source, props) => {
if (newLeaf == "system") {
- this.plugin.app.showInFolder(path3);
+ this.plugin.app.showInFolder(path2);
return;
}
if (newLeaf == "hover") {
- this.plugin.app.workspace.trigger("link-hover", {}, source, path3, path3);
+ this.plugin.app.workspace.trigger("link-hover", {}, source, path2, path2);
return;
} else if (source) {
openPathInElement(
@@ -152674,12 +142139,12 @@ var ObsidianUI = class {
null,
async (editor) => {
const leaf2 = editor.attachLeaf();
- if (this.plugin.app.vault.getAbstractFileByPath(path3) instanceof import_obsidian25.TFile) {
+ if (this.plugin.app.vault.getAbstractFileByPath(path2) instanceof import_obsidian25.TFile) {
await leaf2.openFile(
- this.plugin.app.vault.getAbstractFileByPath(path3)
+ this.plugin.app.vault.getAbstractFileByPath(path2)
);
} else {
- await openPath(leaf2, path3, this.plugin, true);
+ await openPath(leaf2, path2, this.plugin, true);
}
if (!props || !leaf2.view?.editor) {
return;
@@ -152722,7 +142187,7 @@ var ObsidianUI = class {
return;
}
const leaf = getLeaf(this.plugin.app, newLeaf);
- openPath(leaf, path3, this.plugin);
+ openPath(leaf, path2, this.plugin);
};
this.primaryInteractionType = () => {
return import_obsidian25.Platform.isMobile ? 0 /* Touch */ : 1 /* Mouse */;
@@ -152751,9 +142216,9 @@ var migrate09 = async (plugin) => {
if (needsMigrate) {
const updatedFrames = { ...f2.frames[mainFrameID], cols: f2.frames[mainFrameID].cols.filter((f3) => f3.name != "space" && f3.name != "note"), rows: f2.frames[mainFrameID].rows.map(
(r2) => {
- const node2 = frameToNode(r2);
- if (node2.props?.value == "main.props.note" || node2.props?.value == "main.props.space") {
- const newNode2 = { ...node2, props: { ...node2.props, value: node2.props.value.replace("main.props", "$contexts.$space") } };
+ const node = frameToNode(r2);
+ if (node.props?.value == "main.props.note" || node.props?.value == "main.props.space") {
+ const newNode2 = { ...node, props: { ...node.props, value: node.props.value.replace("main.props", "$contexts.$space") } };
return nodeToFrame(newNode2);
}
return r2;
@@ -152928,7 +142393,7 @@ var import_react201 = __toESM(require_react());
var BlinkComponent = (props) => {
const [previewPath, setPreviewPath] = (0, import_react201.useState)(null);
const [query, setQuery] = (0, import_react201.useState)("");
- const [index3, setIndex] = (0, import_react201.useState)(0);
+ const [index2, setIndex] = (0, import_react201.useState)(0);
const onChange = (query2) => {
setQuery(query2);
};
@@ -152953,10 +142418,10 @@ var BlinkComponent = (props) => {
}, [query, filters]);
const [suggestions, setFilteredPaths] = (0, import_react201.useState)([]);
(0, import_react201.useEffect)(() => {
- const runQuery = (path3, _queries) => {
+ const runQuery = (path2, _queries) => {
props.superstate.searcher.run({
type: "search",
- path: path3,
+ path: path2,
payload: { queries: _queries, count: 10 }
}).then(
(g) => setFilteredPaths(
@@ -152972,11 +142437,11 @@ var BlinkComponent = (props) => {
(0, import_lodash25.debounce)(() => runQuery(query, queries), 300)();
}, [query, queries]);
(0, import_react201.useEffect)(() => {
- const path3 = suggestions[index3]?.value;
- if (!path3 || path3 == previewPath)
+ const path2 = suggestions[index2]?.value;
+ if (!path2 || path2 == previewPath)
return;
- setPreviewPath(suggestions[index3]?.value);
- }, [index3, suggestions]);
+ setPreviewPath(suggestions[index2]?.value);
+ }, [index2, suggestions]);
const selectItem = (item, e5) => {
if (!item)
return;
@@ -152997,7 +142462,7 @@ var BlinkComponent = (props) => {
}
if (e5.key == "ArrowUp") {
const size2 = 0;
- const newIndex = index3 <= size2 ? suggestions.length - 1 : index3 - 1;
+ const newIndex = index2 <= size2 ? suggestions.length - 1 : index2 - 1;
if (suggestions.length == 0)
return;
if (suggestions[newIndex].disabled) {
@@ -153009,7 +142474,7 @@ var BlinkComponent = (props) => {
}
if (e5.key == "ArrowDown") {
const size2 = suggestions.length - 1;
- const newIndex = index3 >= size2 ? 0 : index3 + 1;
+ const newIndex = index2 >= size2 ? 0 : index2 + 1;
if (suggestions[newIndex].disabled) {
setIndex(newIndex >= size2 ? 0 : newIndex + 1);
} else {
@@ -153020,7 +142485,7 @@ var BlinkComponent = (props) => {
}
if (e5.key == "Enter") {
props.superstate.ui.openPath(
- suggestions[index3].value,
+ suggestions[index2].value,
e5.ctrlKey || e5.metaKey ? e5.altKey ? "split" : "tab" : false
);
props.hide();
@@ -153097,7 +142562,7 @@ var BlinkComponent = (props) => {
selectOption: selectItem,
id: "",
classNames: CLASS_NAMES2,
- index: index3,
+ index: index2,
setIndex,
allowNew: false,
ui: props.superstate.ui,
@@ -153184,16 +142649,16 @@ var TestToggleSection = (props) => {
};
var TestComponent = (props) => {
const { superstate } = props;
- const [space3, setSpace] = (0, import_react203.useState)(null);
- const [path3, setPath] = (0, import_react203.useState)(null);
+ const [space2, setSpace] = (0, import_react203.useState)(null);
+ const [path2, setPath] = (0, import_react203.useState)(null);
const [sticker, setSticker] = (0, import_react203.useState)(null);
- const [image3, setImage] = (0, import_react203.useState)(null);
+ const [image, setImage] = (0, import_react203.useState)(null);
const [output, setOutput] = (0, import_react203.useState)("");
(0, import_react203.useEffect)(() => {
superstate.eventsDispatcher.addListener(
"spaceStateUpdated",
(payload) => {
- if (payload.path == space3?.path) {
+ if (payload.path == space2?.path) {
setSpace(superstate.spacesIndex.get(payload.path));
}
}
@@ -153201,7 +142666,7 @@ var TestComponent = (props) => {
superstate.eventsDispatcher.addListener(
"pathStateUpdated",
(payload) => {
- if (payload.path == path3?.path) {
+ if (payload.path == path2?.path) {
setPath(superstate.pathsIndex.get(payload.path));
}
}
@@ -153218,11 +142683,11 @@ var TestComponent = (props) => {
section: "Space"
}, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => setSpace(superstate.spacesIndex.get(value))
- }, "Select Space"), /* @__PURE__ */ import_react203.default.createElement("p", null, space3?.path ?? "No Selected Space", /* @__PURE__ */ import_react203.default.createElement("button", {
- onClick: () => setSpace(superstate.spacesIndex.get(space3.path))
+ }, "Select Space"), /* @__PURE__ */ import_react203.default.createElement("p", null, space2?.path ?? "No Selected Space", /* @__PURE__ */ import_react203.default.createElement("button", {
+ onClick: () => setSpace(superstate.spacesIndex.get(space2.path))
}, "Refresh"), /* @__PURE__ */ import_react203.default.createElement("button", {
- onClick: () => setPath(superstate.pathsIndex.get(space3.path))
- }, "Set Path")), space3 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Contexts ", space3.contexts?.map((f2) => f2), superstate.getSpaceItems(space3.path).map((f2, i4) => /* @__PURE__ */ import_react203.default.createElement("div", {
+ onClick: () => setPath(superstate.pathsIndex.get(space2.path))
+ }, "Set Path")), space2 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Contexts ", space2.contexts?.map((f2) => f2), superstate.getSpaceItems(space2.path).map((f2, i4) => /* @__PURE__ */ import_react203.default.createElement("div", {
key: i4
}, f2.path, " ", /* @__PURE__ */ import_react203.default.createElement("button", {
onClick: () => setSpace(superstate.spacesIndex.get(f2.path))
@@ -153234,13 +142699,13 @@ var TestComponent = (props) => {
section: "Path"
}, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => setPath(superstate.pathsIndex.get(value))
- }, "Select Path"), /* @__PURE__ */ import_react203.default.createElement("p", null, path3?.path ?? "No Selected Path"), path3 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Sticker", /* @__PURE__ */ import_react203.default.createElement("div", {
+ }, "Select Path"), /* @__PURE__ */ import_react203.default.createElement("p", null, path2?.path ?? "No Selected Path"), path2 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Sticker", /* @__PURE__ */ import_react203.default.createElement("div", {
dangerouslySetInnerHTML: {
- __html: superstate.ui.getSticker(path3?.label.sticker)
+ __html: superstate.ui.getSticker(path2?.label.sticker)
},
style: { height: "50px", width: "50px" }
}), "Banner", /* @__PURE__ */ import_react203.default.createElement("img", {
- src: superstate.ui.getUIPath(path3?.metadata.banner),
+ src: superstate.ui.getUIPath(path2?.metadata.banner),
style: { height: "50px", width: "50px" }
}))), /* @__PURE__ */ import_react203.default.createElement("h2", null, "Sticker"), /* @__PURE__ */ import_react203.default.createElement("div", {
dangerouslySetInnerHTML: {
@@ -153248,7 +142713,7 @@ var TestComponent = (props) => {
},
style: { height: "50px", width: "50px" }
}), /* @__PURE__ */ import_react203.default.createElement("h2", null, "Image"), /* @__PURE__ */ import_react203.default.createElement("img", {
- src: superstate.ui.getUIPath(image3),
+ src: superstate.ui.getUIPath(image),
style: { height: "50px", width: "50px" }
}), /* @__PURE__ */ import_react203.default.createElement("h2", null, "Output"), /* @__PURE__ */ import_react203.default.createElement("div", null, output)), /* @__PURE__ */ import_react203.default.createElement("div", null, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => {
@@ -153264,38 +142729,38 @@ var TestComponent = (props) => {
}, "Acorn"), /* @__PURE__ */ import_react203.default.createElement(TestToggleSection, {
section: "Space"
}, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => superstate.spaceManager.createSpace(value, space3.path, {})
+ action: (value) => superstate.spaceManager.createSpace(value, space2.path, {})
}, "Create Space"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => superstate.spaceManager.renameSpace(space3.path, value)
+ action: (value) => superstate.spaceManager.renameSpace(space2.path, value)
}, "Rename Space"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => removeSpace(superstate, value)
}, "Delete Space"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => saveSpaceMetadataValue(props.superstate, space3.path, "contexts", [
+ action: (value) => saveSpaceMetadataValue(props.superstate, space2.path, "contexts", [
value
])
}, "Set Space Context"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => removeSpace(superstate, value)
}, "Remove Space Context"), /* @__PURE__ */ import_react203.default.createElement(TestActionComponent, {
- action: () => savePathBanner(superstate, space3.path, image3)
+ action: () => savePathBanner(superstate, space2.path, image)
}, "Set Space Banner"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => updatePrimaryAlias(superstate, space3.path, [], value)
+ action: (value) => updatePrimaryAlias(superstate, space2.path, [], value)
}, "Set Space Alias"), /* @__PURE__ */ import_react203.default.createElement(TestActionComponent, {
- action: () => savePathSticker(superstate, space3.path, sticker)
+ action: () => savePathSticker(superstate, space2.path, sticker)
}, "Set Space Sticker")), /* @__PURE__ */ import_react203.default.createElement(TestToggleSection, {
section: "Path"
}, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => newPathInSpace(superstate, space3, "md", value)
+ action: (value) => newPathInSpace(superstate, space2, "md", value)
}, "Create Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => superstate.spaceManager.copyPath(path3.path, value)
+ action: (value) => superstate.spaceManager.copyPath(path2.path, value)
}, "Copy Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => superstate.spaceManager.renamePath(
- path3.path,
- movePath(path3.path, value)
+ path2.path,
+ movePath(path2.path, value)
)
}, "Move Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
action: (value) => deletePath(superstate, value)
}, "Delete Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, {
- action: (value) => pinPathToSpaceAtIndex(superstate, space3, value)
+ action: (value) => pinPathToSpaceAtIndex(superstate, space2, value)
}, "Pin Path")), /* @__PURE__ */ import_react203.default.createElement(TestToggleSection, {
section: "Modals"
}, /* @__PURE__ */ import_react203.default.createElement("button", {
@@ -153434,30 +142899,30 @@ var JSONFiletypeAdapter = class {
this.cache.set(file.path, updatedCache);
this.middleware.updateFileCache(file.path, updatedCache, refresh);
}
- async newFile(parent, name317, type, content5) {
+ async newFile(parent, name317, type, content3) {
name317 = uniqueFileName(name317 ?? "Untitled", name317 ?? "Untitled", type, getAbstractFileAtPath(this.plugin.app, parent));
const newPath = parent == "/" ? name317 : `${parent}/${name317}`;
- await this.middleware.writeTextToFile(newPath, content5);
+ await this.middleware.writeTextToFile(newPath, content3);
return this.middleware.getFile(newPath);
}
};
// src/adapters/obsidian/ui/kit/kits.ts
var import_obsidian28 = require("obsidian");
-var installSpaceTemplate = async (plugin, superstate, space3, template2) => {
+var installSpaceTemplate = async (plugin, superstate, space2, template2) => {
if (template2.type === "folder") {
if (template2.content)
- await installSpaceKit(plugin, superstate, template2.content, space3 + "/.space/templates", true);
+ await installSpaceKit(plugin, superstate, template2.content, space2 + "/.space/templates", true);
} else {
- await plugin.files.writeTextToFile(space3 + "/.space/templates/" + template2.name, template2.content);
+ await plugin.files.writeTextToFile(space2 + "/.space/templates/" + template2.name, template2.content);
}
};
var mdbFramesToDBTables = (tables) => {
const schemas = Object.values(tables).map((t5) => t5.schema);
const fields = Object.values(tables).flatMap((t5) => t5.cols);
- const dbTables = Object.keys(tables).reduce((p2, c3) => {
+ const dbTables = Object.keys(tables).reduce((p, c3) => {
return {
- ...p2,
+ ...p,
[c3]: {
uniques: defaultFrameSchema.uniques,
cols: defaultFrameSchema.cols,
@@ -153482,9 +142947,9 @@ var mdbFramesToDBTables = (tables) => {
var mdbToDBTables = (tables) => {
const schemas = Object.values(tables).map((t5) => t5.schema);
const fields = Object.values(tables).flatMap((t5) => t5.cols);
- const dbTables = Object.keys(tables).reduce((p2, c3) => {
+ const dbTables = Object.keys(tables).reduce((p, c3) => {
return {
- ...p2,
+ ...p,
[c3]: {
uniques: [],
cols: tables[c3].cols.map((f2) => f2.name),
@@ -153506,29 +142971,29 @@ var mdbToDBTables = (tables) => {
}
};
};
-var installSpaceKit = async (plugin, superstate, kit, space3, isTemplate) => {
+var installSpaceKit = async (plugin, superstate, kit, space2, isTemplate) => {
if (!kit)
return;
- const path3 = space3 == "/" ? kit.name : space3 + "/" + kit.name;
+ const path2 = space2 == "/" ? kit.name : space2 + "/" + kit.name;
let newSpace;
if (isTemplate) {
- await plugin.files.createFolder(path3);
+ await plugin.files.createFolder(path2);
newSpace = {
name: kit.name,
type: "folder",
- path: path3,
+ path: path2,
space: {
- path: path3,
+ path: path2,
name: kit.name,
isRemote: false,
readOnly: false,
- defPath: `${path3}/${kit.name}.md`,
- dbPath: `${path3}/.space/context.mdb`,
- framePath: `${path3}/.space/views.mdb`
+ defPath: `${path2}/${kit.name}.md`,
+ dbPath: `${path2}/.space/context.mdb`,
+ framePath: `${path2}/.space/views.mdb`
}
};
} else {
- newSpace = await createSpace(superstate, path3, kit.definition);
+ newSpace = await createSpace(superstate, path2, kit.definition);
await saveProperties(superstate, newSpace.path, kit.properties);
}
if (kit.content) {
@@ -153555,7 +143020,7 @@ var installSpaceKit = async (plugin, superstate, kit, space3, isTemplate) => {
}, "tables", "", mdbToDBTables(kit.context), {});
}
if (kit.templates?.length > 0) {
- await plugin.files.createFolder(space3 + "/.space/templates");
+ await plugin.files.createFolder(space2 + "/.space/templates");
for (const template2 of kit.templates) {
await installSpaceTemplate(plugin, superstate, newSpace.path, template2);
}
@@ -153587,7 +143052,7 @@ var installKitModal = (plugin, superstate, kit) => {
};
var InstallKit = (props) => {
const [kit, setKit] = (0, import_react204.useState)(props.kit);
- const [space3, setSpace] = (0, import_react204.useState)("/");
+ const [space2, setSpace] = (0, import_react204.useState)("/");
const installKit = () => {
if (!kit.startsWith("https://www.make.md/static/kits/")) {
props.superstate.ui.notify("Invalid Kit URL");
@@ -153603,7 +143068,7 @@ var InstallKit = (props) => {
props.plugin,
props.superstate,
safelyParseJSON(f2),
- space3
+ space2
);
}).then((f2) => {
props.superstate.ui.notify("Kit added");
@@ -153626,9 +143091,9 @@ var InstallKit = (props) => {
superstate: props.superstate,
triggerMenu: (e5) => {
const offset2 = e5.target.getBoundingClientRect();
- showSpacesMenu(offset2, props.superstate, (link3) => setSpace(link3));
+ showSpacesMenu(offset2, props.superstate, (link) => setSpace(link));
},
- value: props.superstate.spacesIndex.get(space3)?.name,
+ value: props.superstate.spacesIndex.get(space2)?.name,
selectValue: (value) => {
setSpace(value);
}
@@ -153650,37 +143115,37 @@ var WebCacher = class {
this.loading = {};
this.parentMap = new IndexMap();
}
- async loadedKit(basePath, path3, kit) {
+ async loadedKit(basePath, path2, kit) {
if (!kit)
return;
- this.cache.set(path3, { ...kit, path: path3 });
- this.notes.set(path3 + "/.def", { name: kit.name, properties: kit.properties, content: kit.content });
- await this.adapter.onNoteCreate(path3 + "/.def", kit.content);
- await this.adapter.onCreate(path3, kit);
+ this.cache.set(path2, { ...kit, path: path2 });
+ this.notes.set(path2 + "/.def", { name: kit.name, properties: kit.properties, content: kit.content });
+ await this.adapter.onNoteCreate(path2 + "/.def", kit.content);
+ await this.adapter.onCreate(path2, kit);
for (const child of kit.notes) {
- this.notes.set(path3 + "/" + child.name, { name: child.name, properties: child.properties, content: child.content });
+ this.notes.set(path2 + "/" + child.name, { name: child.name, properties: child.properties, content: child.content });
}
for (const child of kit.children) {
const childPath = basePath + "/" + child.path;
- this.parentMap.set(childPath, /* @__PURE__ */ new Set([path3]));
+ this.parentMap.set(childPath, /* @__PURE__ */ new Set([path2]));
await this.loadedKit(basePath, childPath, child);
}
}
- async load(path3) {
- if (this.cache.has(path3)) {
- return this.cache.get(path3);
+ async load(path2) {
+ if (this.cache.has(path2)) {
+ return this.cache.get(path2);
}
- this.loading[path3] = true;
+ this.loading[path2] = true;
return new Promise((resolve2, reject) => {
- return fetch(path3).then((response) => {
- this.loading[path3] = false;
+ return fetch(path2).then((response) => {
+ this.loading[path2] = false;
if (response.status !== 200) {
return reject(response.statusText);
}
return response.json();
}).then((f2) => {
const kit = f2;
- return this.loadedKit(path3, path3, kit).then((g) => f2);
+ return this.loadedKit(path2, path2, kit).then((g) => f2);
}).then((kit) => {
return resolve2(kit);
});
@@ -153692,27 +143157,25 @@ var WebCacher = class {
var WebSpaceAdapter = class {
constructor() {
this.schemes = ["http", "https"];
- this.onNoteCreate = async (path3, content5) => {
- this.spaceManager.onPathCreated(path3);
+ this.onNoteCreate = async (path2, content3) => {
+ this.spaceManager.onPathCreated(path2);
};
- this.onCreate = async (path3, kit) => {
- const space3 = this.spaceInfoForPath(path3);
- await this.spaceManager.onSpaceCreated(path3);
- await this.spaceManager.superstate.reloadContext(space3);
- await this.spaceManager.superstate.reloadFrames(space3);
+ this.onCreate = async (path2, kit) => {
+ const space2 = this.spaceInfoForPath(path2);
+ await this.spaceManager.onSpaceCreated(path2);
};
this.webCache = new WebCacher(this);
}
initiateAdapter(manager) {
this.spaceManager = manager;
}
- async readTemplates(path3) {
+ async readTemplates(path2) {
return [];
}
- async saveTemplate(path3, space3) {
+ async saveTemplate(path2, space2) {
return null;
}
- deleteTemplate(path3, space3) {
+ deleteTemplate(path2, space2) {
return;
}
async readWaypoints() {
@@ -153742,26 +143205,26 @@ var WebSpaceAdapter = class {
allPaths(type) {
return [];
}
- async pathExists(path3) {
+ async pathExists(path2) {
return true;
}
- async createItemAtPath(parent, type, name317, content5) {
+ async createItemAtPath(parent, type, name317, content3) {
return null;
}
- async renamePath(oldPath, path3) {
+ async renamePath(oldPath, path2) {
return;
}
- async deletePath(path3) {
+ async deletePath(path2) {
return;
}
- async getPathInfo(path3) {
+ async getPathInfo(path2) {
return {};
}
- keysForCacheType(path3) {
+ keysForCacheType(path2) {
return null;
}
- async readPathCache(path3) {
- if (this.webCache.notes.has(path3)) {
+ async readPathCache(path2) {
+ if (this.webCache.notes.has(path2)) {
return {
metadata: { properties: {} },
type: "remote",
@@ -153769,108 +143232,108 @@ var WebSpaceAdapter = class {
contentTypes: [],
tags: [],
label: {
- name: this.webCache.notes.get(path3).name,
- sticker: this.webCache.notes.get(path3).properties.sticker,
+ name: this.webCache.notes.get(path2).name,
+ sticker: this.webCache.notes.get(path2).properties.sticker,
color: null
},
- parent: [...this.webCache.parentMap.get(path3)]?.[0]
+ parent: [...this.webCache.parentMap.get(path2)]?.[0]
};
}
- const space3 = await this.webCache.load(path3);
+ const space2 = await this.webCache.load(path2);
return {
- metadata: { properties: space3.properties },
+ metadata: { properties: space2.properties },
type: "space",
subtype: "web",
contentTypes: [],
tags: [],
label: {
- name: space3.name,
- sticker: space3.properties.sticker,
- color: space3.properties.color
+ name: space2.name,
+ sticker: space2.properties.sticker,
+ color: space2.properties.color
},
- parent: [...this.webCache.parentMap.get(path3)]?.[0]
+ parent: [...this.webCache.parentMap.get(path2)]?.[0]
};
}
- async readPath(path3) {
- return this.webCache.notes.get(path3).content;
+ async readPath(path2) {
+ return this.webCache.notes.get(path2).content;
}
- async copyPath(path3, newPath, newName) {
+ async copyPath(path2, newPath, newName) {
return;
}
- async writeToPath(path3, content5, binary) {
+ async writeToPath(path2, content3, binary) {
return;
}
- async childrenForPath(path3, type) {
- return [...this.webCache.parentMap.getInverse(path3)];
+ async childrenForPath(path2, type) {
+ return [...this.webCache.parentMap.getInverse(path2)];
}
- parentPathForPath(path3) {
- return [...this.webCache.parentMap.get(path3)]?.[0];
+ parentPathForPath(path2) {
+ return [...this.webCache.parentMap.get(path2)]?.[0];
}
- async readFrame(path3, schema) {
- const space3 = await this.webCache.load(path3);
- return space3.frames[schema];
+ async readFrame(path2, schema) {
+ const space2 = await this.webCache.load(path2);
+ return space2.frames[schema];
}
- async readAllFrames(path3) {
- const space3 = await this.webCache.load(path3);
- return space3.frames;
+ async readAllFrames(path2) {
+ const space2 = await this.webCache.load(path2);
+ return space2.frames;
}
- async readTable(path3, schema) {
- const space3 = await this.webCache.load(path3);
- return space3.context[schema];
+ async readTable(path2, schema) {
+ const space2 = await this.webCache.load(path2);
+ return space2.context[schema];
}
- async spaceInitiated(path3) {
- if (this.webCache.cache.has(path3))
+ async spaceInitiated(path2) {
+ if (this.webCache.cache.has(path2))
return true;
return false;
}
- async contextInitiated(path3) {
- if (this.webCache.cache.has(path3))
+ async contextInitiated(path2) {
+ if (this.webCache.cache.has(path2))
return true;
return false;
}
- async tablesForSpace(path3) {
- const space3 = await this.webCache.load(path3);
- return Object.values(space3.context).map((f2) => f2.schema);
+ async tablesForSpace(path2) {
+ const space2 = await this.webCache.load(path2);
+ return Object.values(space2.context).map((f2) => f2.schema);
}
- async createTable(path3, schema) {
+ async createTable(path2, schema) {
return;
}
- async saveTableSchema(path3, schemaId, saveSchema) {
+ async saveTableSchema(path2, schemaId, saveSchema) {
return false;
}
- async saveTable(path3, table2, force) {
+ async saveTable(path2, table, force) {
return false;
}
- async deleteTable(path3, name317) {
+ async deleteTable(path2, name317) {
return;
}
- async readAllTables(path3) {
- const space3 = await this.webCache.load(path3);
- return space3.context;
+ async readAllTables(path2) {
+ const space2 = await this.webCache.load(path2);
+ return space2.context;
}
- async framesForSpace(path3) {
- const space3 = await this.webCache.load(path3);
- return Object.values(space3.frames).map((f2) => f2.schema);
+ async framesForSpace(path2) {
+ const space2 = await this.webCache.load(path2);
+ return Object.values(space2.frames).map((f2) => f2.schema);
}
- async createFrame(path3, schema) {
+ async createFrame(path2, schema) {
return;
}
- async deleteFrame(path3, name317) {
+ async deleteFrame(path2, name317) {
return;
}
- async saveFrameSchema(path3, schemaId, saveSchema) {
+ async saveFrameSchema(path2, schemaId, saveSchema) {
return false;
}
- async saveFrame(path3, frame) {
+ async saveFrame(path2, frame) {
return false;
}
- async commandsForSpace(path3) {
+ async commandsForSpace(path2) {
return [];
}
- async runCommand(path3, name317, args) {
+ async runCommand(path2, name317, args) {
return null;
}
- async createCommand(path3, schema) {
+ async createCommand(path2, schema) {
return;
}
async readSystemCommands() {
@@ -153882,44 +143345,44 @@ var WebSpaceAdapter = class {
async saveSystemCommand(lib, command) {
return;
}
- async deleteCommand(path3, name317) {
+ async deleteCommand(path2, name317) {
return;
}
- async saveCommand(path3, schemaId, saveCommand) {
+ async saveCommand(path2, schemaId, saveCommand) {
return false;
}
- async contextForSpace(path3) {
+ async contextForSpace(path2) {
return null;
}
- async addSpaceProperty(path3, property) {
+ async addSpaceProperty(path2, property) {
return;
}
- async deleteSpaceProperty(path3, property) {
+ async deleteSpaceProperty(path2, property) {
return;
}
- async saveSpaceProperty(path3, property, oldProperty) {
+ async saveSpaceProperty(path2, property, oldProperty) {
return false;
}
- async addProperty(path3, property) {
+ async addProperty(path2, property) {
return;
}
- async readLabel(path3) {
+ async readLabel(path2) {
return null;
}
- async saveLabel(path3, label, value) {
+ async saveLabel(path2, label, value) {
return;
}
- async renameProperty(path3, property, newProperty) {
+ async renameProperty(path2, property, newProperty) {
return;
}
- async readProperties(path3) {
- const space3 = await this.webCache.load(path3);
- return space3.context[defaultContextSchemaID].cols;
+ async readProperties(path2) {
+ const space2 = await this.webCache.load(path2);
+ return space2.context[defaultContextSchemaID].cols;
}
- async deleteProperty(path3, property) {
+ async deleteProperty(path2, property) {
return;
}
- async saveProperties(path3, properties3) {
+ async saveProperties(path2, properties3) {
return;
}
allSpaces() {
@@ -153928,51 +143391,51 @@ var WebSpaceAdapter = class {
readTags() {
return [];
}
- spaceInfoForPath(path3) {
+ spaceInfoForPath(path2) {
return {
- name: path3.split("/").pop(),
- path: path3,
+ name: path2.split("/").pop(),
+ path: path2,
isRemote: true,
readOnly: true,
- defPath: path3 + "/.def"
+ defPath: path2 + "/.def"
};
}
allCaches() {
return /* @__PURE__ */ new Map();
}
- async spaceDefForSpace(path3) {
- const space3 = await this.webCache.load(path3);
- return space3.definition;
+ async spaceDefForSpace(path2) {
+ const space2 = await this.webCache.load(path2);
+ return space2.definition;
}
- async createSpace(name317, parentPath, definition3) {
+ async createSpace(name317, parentPath, definition) {
return;
}
- async saveSpace(path3, definitionFn, properties3) {
+ async saveSpace(path2, definitionFn, properties3) {
return;
}
renameSpace(oldPath, newPath) {
return;
}
- deleteSpace(path3) {
+ deleteSpace(path2) {
return;
}
- childrenForSpace(path3) {
- return [...this.webCache.parentMap.getInverse(path3)];
+ childrenForSpace(path2) {
+ return [...this.webCache.parentMap.getInverse(path2)];
}
- addTag(path3, tag2) {
+ addTag(path2, tag2) {
return;
}
- renameTag(path3, tag2, newTag) {
+ renameTag(path2, tag2, newTag) {
return;
}
- deleteTag(path3, tag2) {
+ deleteTag(path2, tag2) {
return;
}
pathsForTag(tag2) {
return [];
}
- resolvePath(path3, source) {
- return path3;
+ resolvePath(path2, source) {
+ return path2;
}
};
@@ -154217,9 +143680,9 @@ var MakeMDPlugin = class extends import_obsidian29.Plugin {
return filePath;
}
activeFileChange() {
- const path3 = this.getActiveFile();
- if (path3) {
- this.superstate.ui.setActivePath(path3);
+ const path2 = this.getActiveFile();
+ if (path2) {
+ this.superstate.ui.setActivePath(path2);
}
}
releaseTheNotes() {
@@ -154381,25 +143844,25 @@ var MakeMDPlugin = class extends import_obsidian29.Plugin {
"mk-flow-" + this.superstate.settings.editorFlowStyle,
true
);
- this.registerMarkdownPostProcessor((element3, context) => {
+ this.registerMarkdownPostProcessor((element, context) => {
const removeAllFlowMarks = (el) => {
const embeds = el.querySelectorAll(".internal-embed.markdown-embed");
- for (let index3 = 0; index3 < embeds.length; index3++) {
- const embed = embeds.item(index3);
+ for (let index2 = 0; index2 < embeds.length; index2++) {
+ const embed = embeds.item(index2);
if (embed.previousSibling && embed.previousSibling.textContent.slice(-1) == "!")
embed.previousSibling.textContent = embed.previousSibling.textContent.slice(0, -1);
}
};
- removeAllFlowMarks(element3);
- replaceAllTables(this, element3, context);
- replaceAllEmbed(element3, context, this.superstate, this.app);
+ removeAllFlowMarks(element);
+ replaceAllTables(this, element, context);
+ replaceAllEmbed(element, context, this.superstate, this.app);
});
}
loadMakerMode() {
if (this.superstate.settings.makerMode) {
if (this.superstate.settings.inlineContext) {
- this.registerMarkdownPostProcessor((element3, context) => {
- replaceInlineContext(this, element3, context);
+ this.registerMarkdownPostProcessor((element, context) => {
+ replaceInlineContext(this, element, context);
});
document.body.classList.toggle(
"mk-inline-context-enabled",
@@ -154524,12 +143987,6 @@ https://github.com/nodeca/pica
* Copyright (c) 2022 Michael Mclaughlin
* MIT Licence
*/
-/*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh
- * @license MIT
- */
/**
* react-table
*
diff --git a/manifest.json b/manifest.json
index 46b7666..28d739a 100755
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"id": "make-md",
"name": "MAKE.md",
- "version": "0.9.30",
+ "version": "0.9.31",
"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",