From a14c05e4518b98a6281f64d7fc20ca9c83b41467 Mon Sep 17 00:00:00 2001 From: JP Cen Date: Thu, 27 Jul 2023 19:11:37 -0400 Subject: [PATCH] 0.7.19 fixes for properties --- main.js | 57854 ++++++++++++++++++++++++------------------------ manifest.json | 2 +- styles.css | 1908 +- 3 files changed, 29830 insertions(+), 29934 deletions(-) diff --git a/main.js b/main.js index eefbff9..fd9abf7 100644 --- a/main.js +++ b/main.js @@ -5484,6 +5484,57 @@ var require_lodash = __commonJS({ } }); +// node_modules/classnames/index.js +var require_classnames = __commonJS({ + "node_modules/classnames/index.js"(exports, module2) { + (function() { + "use strict"; + var hasOwn = {}.hasOwnProperty; + var nativeCodeString = "[native code]"; + function classNames9() { + var classes = []; + for (var i4 = 0; i4 < arguments.length; i4++) { + var arg = arguments[i4]; + if (!arg) + continue; + var argType = typeof arg; + if (argType === "string" || argType === "number") { + classes.push(arg); + } else if (Array.isArray(arg)) { + if (arg.length) { + var inner = classNames9.apply(null, arg); + if (inner) { + classes.push(inner); + } + } + } else if (argType === "object") { + if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) { + classes.push(arg.toString()); + continue; + } + for (var key2 in arg) { + if (hasOwn.call(arg, key2) && arg[key2]) { + classes.push(key2); + } + } + } + } + return classes.join(" "); + } + if (typeof module2 !== "undefined" && module2.exports) { + classNames9.default = classNames9; + module2.exports = classNames9; + } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) { + define("classnames", [], function() { + return classNames9; + }); + } else { + window.classNames = classNames9; + } + })(); + } +}); + // node_modules/tslib/tslib.js var require_tslib = __commonJS({ "node_modules/tslib/tslib.js"(exports, module2) { @@ -5991,57 +6042,6 @@ var require_tslib = __commonJS({ } }); -// node_modules/classnames/index.js -var require_classnames = __commonJS({ - "node_modules/classnames/index.js"(exports, module2) { - (function() { - "use strict"; - var hasOwn = {}.hasOwnProperty; - var nativeCodeString = "[native code]"; - function classNames9() { - var classes = []; - for (var i4 = 0; i4 < arguments.length; i4++) { - var arg = arguments[i4]; - if (!arg) - continue; - var argType = typeof arg; - if (argType === "string" || argType === "number") { - classes.push(arg); - } else if (Array.isArray(arg)) { - if (arg.length) { - var inner = classNames9.apply(null, arg); - if (inner) { - classes.push(inner); - } - } - } else if (argType === "object") { - if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) { - classes.push(arg.toString()); - continue; - } - for (var key2 in arg) { - if (hasOwn.call(arg, key2) && arg[key2]) { - classes.push(key2); - } - } - } - } - return classes.join(" "); - } - if (typeof module2 !== "undefined" && module2.exports) { - classNames9.default = classNames9; - module2.exports = classNames9; - } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) { - define("classnames", [], function() { - return classNames9; - }); - } else { - window.classNames = classNames9; - } - })(); - } -}); - // node_modules/obsidian-dataview/lib/index.js var require_lib = __commonJS({ "node_modules/obsidian-dataview/lib/index.js"(exports) { @@ -14114,13 +14114,13 @@ var openFileFlowEditor = (file, source) => { }; // src/cm-extensions/flowEditor/flowEditor.tsx -var import_obsidian40 = require("obsidian"); +var import_obsidian44 = require("obsidian"); // src/components/ui/modals/vaultChangeModals.ts -var import_obsidian38 = require("obsidian"); +var import_obsidian42 = require("obsidian"); // src/components/ContextView/ContextView.tsx -var import_obsidian34 = require("obsidian"); +var import_obsidian38 = require("obsidian"); // src/utils/strings.ts function parseStickerString(input) { @@ -14197,2157 +14197,1534 @@ var contextDisplayName = (context) => { var folderNotePathFromAFile = (settings, aFile) => !aFile ? null : settings.folderNoteInsideFolder ? `${aFile.path}/${aFile.name}.md` : aFile.parent == "/" ? `${aFile.name}.md` : `${aFile.parent}/${aFile.name}.md`; var folderPathFromFolderNoteFile = (settings, aFile) => !aFile ? null : settings.folderNoteInsideFolder ? aFile.parent : aFile.parent == "/" ? aFile.name : `${aFile.parent}/${aFile.name}`; -// src/components/ui/modals/imageModal.tsx -var import_obsidian = require("obsidian"); +// src/components/ui/menus/selectMenu/concerns/matchers.js +function escapeForRegExp(string) { + return string.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); +} +function matchAny(string) { + return new RegExp(escapeForRegExp(string), "gi"); +} +function matchExact(string) { + return new RegExp(`^${escapeForRegExp(string)}$`, "i"); +} -// src/utils/regex.ts -var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi; +// src/components/ContextView/MDBContext.tsx +var import_lodash2 = __toESM(require_lodash()); +var import_obsidian7 = require("obsidian"); -// src/components/ui/modals/imageModal.tsx -var imageModal = class extends import_obsidian.FuzzySuggestModal { - constructor(plugin, app2, selectImage) { - super(app2); - this.plugin = plugin; - this.selectImage = selectImage; - this.resultContainerEl.toggleClass("mk-image-modal", true); - this.inputEl.focus(); - this.inputEl.placeholder = "Select an image or paste a URL"; - this.emptyStateText = "No Images Found"; - this.limit = 30; - } - renderSuggestion(item, el) { - var oImg = el.createEl("img"); - const file = getAbstractFileAtPath(app, item.item); - oImg.setAttribute( - "src", - file ? app.vault.getResourcePath(file) : item.item - ); - oImg.setAttribute("height", "100px"); - oImg.setAttribute("width", "100px"); - el.appendChild(oImg); - } - getItemText(item) { - return item; +// src/types/context.ts +var FilePropertyName = "File"; + +// src/utils/contexts/parsers.ts +var parsePropString = (str) => { + var _a2; + const [p1, p22] = (_a2 = str == null ? void 0 : str.match(/(\\.|[^.])+/g)) != null ? _a2 : []; + if (p22) + return { + field: p1, + property: p22 + }; + return { field: "File", property: p1 }; +}; + +// src/schemas/mdb.ts +var fieldTypeForType = (type) => fieldTypes.find((t4) => type == t4.type) || fieldTypes.find((t4) => type == t4.multiType); +var fieldTypes = [ + { + type: "unknown", + label: "", + restricted: true + }, + { + type: "preview", + label: i18n_default.properties.preview.label, + restricted: true + }, + { + type: "text", + label: i18n_default.properties.text.label, + metadata: true, + icon: "mk-make-h3" + }, + { + type: "number", + label: i18n_default.properties.number.label, + metadata: true, + icon: "mk-make-tag" + }, + { + type: "boolean", + label: i18n_default.properties.boolean.label, + metadata: true, + icon: "mk-make-todo" + }, + { + type: "date", + label: i18n_default.properties.date.label, + metadata: true, + icon: "mk-make-date" + }, + { + type: "option", + label: i18n_default.properties.option.label, + multi: true, + multiType: "option-multi", + icon: "mk-make-list" + }, + { + type: "file", + label: i18n_default.properties.file.label, + restricted: true, + icon: "mk-make-h3" + }, + { + type: "fileprop", + label: i18n_default.properties.fileProperty.label + }, + { + type: "link", + label: i18n_default.properties.link.label, + multi: true, + multiType: "link-multi", + metadata: true, + icon: "mk-make-note" + }, + { + type: "context", + label: i18n_default.properties.context.label, + multi: true, + multiType: "context-multi", + icon: "mk-make-note" + }, + { + type: "object", + label: i18n_default.properties.context.label, + restricted: true, + metadata: true + }, + { + type: "image", + label: i18n_default.properties.image.label, + multi: true, + multiType: "image-multi", + metadata: true, + icon: "mk-make-image" } - getSuggestions(query) { - let allImages = []; - if (query.match(urlRegex)) - allImages.push(query); - allImages.push( - ...getAllAbstractFilesInVault(this.plugin, app).filter( - (f4) => f4 instanceof import_obsidian.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) - ).map((f4) => f4.path) - ); - return allImages.filter((f4) => f4.contains(query)).map((f4, i4) => ({ - item: f4, - match: { - score: i4, - matches: [] - } - })); +]; +var defaultValueForPropertyType = (name, value, type) => { + if (type == "preview") { + return "https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"; } - getItems() { - let allImages = []; - allImages.push( - ...getAllAbstractFilesInVault(this.plugin, app).filter( - (f4) => f4 instanceof import_obsidian.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) - ).map((f4) => f4.path) - ); - return allImages; + if (type == "fileprop") { + const { field, property } = parsePropString(value); + if (property == "ctime" || property == "mtime") + return (Date.now() - 60).toString(); + return value; } - onChooseItem(item, evt) { - this.selectImage(item); + if (type == "file") { + return "Note Name"; } -}; - -// src/hooks/useLongPress.tsx -function isMouseEvent(e4) { - return e4 && "screenX" in e4; -} - -// src/components/FileContextView/NoteBannerView.tsx -var import_obsidian4 = require("obsidian"); - -// node_modules/date-fns/esm/_lib/toInteger/index.js -function toInteger(dirtyNumber) { - if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { - return NaN; + if (type == "date") { + return "2020-04-21"; } - var number = Number(dirtyNumber); - if (isNaN(number)) { - return number; + if (type == "number") { + return "123"; } - return number < 0 ? Math.ceil(number) : Math.floor(number); -} - -// node_modules/date-fns/esm/_lib/requiredArgs/index.js -function requiredArgs(required, args) { - if (args.length < required) { - throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present"); + if (type == "boolean") { + return "true"; } -} - -// node_modules/date-fns/esm/toDate/index.js -function _typeof(obj) { - "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function _typeof5(obj2) { - return typeof obj2; - }; - } else { - _typeof = function _typeof5(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + if (type == "link") { + return "[[Select Note]]"; } - return _typeof(obj); -} -function toDate(argument) { - requiredArgs(1, arguments); - var argStr = Object.prototype.toString.call(argument); - if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") { - return new Date(argument.getTime()); - } else if (typeof argument === "number" || argStr === "[object Number]") { - return new Date(argument); - } else { - if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") { - console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); - console.warn(new Error().stack); - } - return new Date(NaN); + if (type == "option") { + return "one, two"; } -} - -// node_modules/date-fns/esm/addDays/index.js -function addDays(dirtyDate, dirtyAmount) { - requiredArgs(2, arguments); - var date = toDate(dirtyDate); - var amount = toInteger(dirtyAmount); - if (isNaN(amount)) { - return new Date(NaN); + if (type == "text") { + return name; } - if (!amount) { - return date; + if (type == "image") { + return "https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"; } - date.setDate(date.getDate() + amount); - return date; -} - -// node_modules/date-fns/esm/addMonths/index.js -function addMonths(dirtyDate, dirtyAmount) { - requiredArgs(2, arguments); - var date = toDate(dirtyDate); - var amount = toInteger(dirtyAmount); - if (isNaN(amount)) { - return new Date(NaN); + return ""; +}; +var defaultFileDBSchema = { + id: "files", + name: "Files", + type: "db", + primary: "true" +}; +var defaultFileListSchema = { + id: "filesView", + name: "Files", + type: "list", + def: "files" +}; +var defaultFileTableSchema = { + id: "filesView", + name: "Files", + type: "table", + def: "files" +}; +var defaultFolderSchema = { + uniques: [], + cols: ["id", "name", "type", "def", "predicate", "primary"], + rows: [defaultFileDBSchema, defaultFileListSchema] +}; +var defaultTagSchema = { + uniques: [], + cols: ["id", "name", "type", "def", "predicate", "primary"], + rows: [defaultFileDBSchema, defaultFileTableSchema] +}; +var fieldSchema = { + uniques: ["name,schemaId"], + cols: [ + "name", + "schemaId", + "type", + "value", + "attrs", + "hidden", + "unique", + "primary" + ] +}; +var defaultFolderFields = { + ...fieldSchema, + rows: [ + { + name: i18n_default.properties.preview.label, + schemaId: "files", + type: "preview", + hidden: "", + unique: "", + attrs: "", + value: "", + primary: "" + }, + { + name: FilePropertyName, + schemaId: "files", + type: "file", + primary: "true", + hidden: "", + unique: "", + attrs: "", + value: "" + }, + { + name: i18n_default.properties.fileProperty.createdTime, + schemaId: "files", + type: "fileprop", + value: "File.ctime", + hidden: "", + unique: "", + attrs: "", + primary: "" + } + ] +}; +var defaultFieldsForContext = (context) => { + if (context.type == "tag") { + return defaultTagFields; + } else if (context.type == "folder") { + return defaultFolderFields; } - if (!amount) { - return date; + return defaultFolderFields; +}; +var defaultTableFields = [ + { + name: i18n_default.properties.defaultField, + schemaId: "", + type: "text" } - var dayOfMonth = date.getDate(); - var endOfDesiredMonth = new Date(date.getTime()); - endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0); - var daysInMonth = endOfDesiredMonth.getDate(); - if (dayOfMonth >= daysInMonth) { - return endOfDesiredMonth; - } else { - date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth); - return date; +]; +var defaultTagFields = { + ...fieldSchema, + rows: [ + { + name: FilePropertyName, + schemaId: "files", + type: "file", + primary: "true", + hidden: "", + unique: "", + attrs: "", + value: "" + } + ] +}; +var defaultMDBTableForContext = (context) => { + if (context.type == "tag") { + return defaultTagMDBTable; + } else if (context.type == "folder") { + return defaultFolderMDBTable; } -} - -// node_modules/date-fns/esm/addMilliseconds/index.js -function addMilliseconds(dirtyDate, dirtyAmount) { - requiredArgs(2, arguments); - var timestamp = toDate(dirtyDate).getTime(); - var amount = toInteger(dirtyAmount); - return new Date(timestamp + amount); -} - -// node_modules/date-fns/esm/_lib/defaultOptions/index.js -var defaultOptions = {}; -function getDefaultOptions() { - return defaultOptions; -} - -// node_modules/date-fns/esm/startOfWeek/index.js -function startOfWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - requiredArgs(1, arguments); - var defaultOptions3 = getDefaultOptions(); - var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); + return defaultFolderMDBTable; +}; +var defaultFolderMDBTable = { + schema: defaultFileDBSchema, + cols: defaultFolderFields.rows, + rows: [] +}; +var defaultQueryMDBTable = { + schema: defaultFileDBSchema, + cols: defaultFolderFields.rows, + rows: [] +}; +var defaultTagMDBTable = { + schema: defaultFileDBSchema, + cols: defaultTagFields.rows, + rows: [] +}; +var fieldsToTable = (fields, schemas) => { + return fields.filter((s5) => schemas.find((g4) => g4.id == s5.schemaId && g4.type == "db")).reduce((p3, c4) => { + return { + ...p3, + ...p3[c4.schemaId] ? { + [c4.schemaId]: { + uniques: c4.unique == "true" ? [...p3[c4.schemaId].uniques, c4.name] : p3[c4.schemaId].uniques, + cols: [...p3[c4.schemaId].cols, c4.name], + rows: [] + } + } : { + [c4.schemaId]: { + uniques: c4.unique == "true" ? [c4.name] : [], + cols: [c4.name], + rows: [] + } + } + }; + }, {}); +}; +var defaultTablesForContext = (context) => { + if (context.type == "tag") { + return defaultTagTables; + } else if (context.type == "folder") { + return defaultFolderTables; } - var date = toDate(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setDate(date.getDate() - diff); - date.setHours(0, 0, 0, 0); - return date; -} - -// node_modules/date-fns/esm/startOfISOWeek/index.js -function startOfISOWeek(dirtyDate) { - requiredArgs(1, arguments); - return startOfWeek(dirtyDate, { - weekStartsOn: 1 - }); -} + return defaultFolderTables; +}; +var defaultFolderTables = { + m_schema: defaultFolderSchema, + m_fields: defaultFolderFields, + ...fieldsToTable( + defaultFolderFields.rows, + defaultFolderSchema.rows + ) +}; +var defaultTagTables = { + m_schema: defaultTagSchema, + m_fields: defaultTagFields, + ...fieldsToTable( + defaultTagFields.rows, + defaultTagSchema.rows + ) +}; -// node_modules/date-fns/esm/getISOWeekYear/index.js -function getISOWeekYear(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var year = date.getFullYear(); - var fourthOfJanuaryOfNextYear = new Date(0); - fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = new Date(0); - fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); - fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); - var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; +// src/utils/array.ts +var insert = (arr, index, newItem) => index <= 0 ? [ + newItem, + ...arr +] : [ + ...arr.slice(0, index), + newItem, + ...arr.slice(index) +]; +var uniq = (a5) => [...new Set(a5)]; +var uniqCaseInsensitive = (a5) => [ + ...new Map(a5.map((s5) => [s5.toLowerCase(), s5])).values() +]; +var uniqueNameFromString = (name, cols) => { + let newName = name; + if (cols.includes(newName)) { + let append = 1; + while (cols.includes(newName)) { + newName = name + append.toString(); + append += 1; + } } -} - -// node_modules/date-fns/esm/startOfISOWeekYear/index.js -function startOfISOWeekYear(dirtyDate) { - requiredArgs(1, arguments); - var year = getISOWeekYear(dirtyDate); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setFullYear(year, 0, 4); - fourthOfJanuary.setHours(0, 0, 0, 0); - var date = startOfISOWeek(fourthOfJanuary); - return date; -} - -// node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js -function getTimezoneOffsetInMilliseconds(date) { - var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds())); - utcDate.setUTCFullYear(date.getFullYear()); - return date.getTime() - utcDate.getTime(); -} - -// node_modules/date-fns/esm/startOfDay/index.js -function startOfDay(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - date.setHours(0, 0, 0, 0); - return date; -} - -// node_modules/date-fns/esm/differenceInCalendarDays/index.js -var MILLISECONDS_IN_DAY = 864e5; -function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) { - requiredArgs(2, arguments); - var startOfDayLeft = startOfDay(dirtyDateLeft); - var startOfDayRight = startOfDay(dirtyDateRight); - var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft); - var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight); - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY); -} - -// node_modules/date-fns/esm/addWeeks/index.js -function addWeeks(dirtyDate, dirtyAmount) { - requiredArgs(2, arguments); - var amount = toInteger(dirtyAmount); - var days = amount * 7; - return addDays(dirtyDate, days); -} - -// node_modules/date-fns/esm/addYears/index.js -function addYears(dirtyDate, dirtyAmount) { - requiredArgs(2, arguments); - var amount = toInteger(dirtyAmount); - return addMonths(dirtyDate, amount * 12); -} + return newName; +}; +var onlyUniqueProp = (prop) => (value, index, self2) => { + return self2.findIndex((v3) => value[prop] == v3[prop]) === index; +}; +var onlyUniquePropCaseInsensitive = (prop) => (value, index, self2) => { + return self2.findIndex( + (v3) => value[prop].toLowerCase() == v3[prop].toLowerCase() + ) === index; +}; -// node_modules/date-fns/esm/max/index.js -function _typeof2(obj) { - "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof5(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof5(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); -} -function max(dirtyDatesArray) { - requiredArgs(1, arguments); - var datesArray; - if (dirtyDatesArray && typeof dirtyDatesArray.forEach === "function") { - datesArray = dirtyDatesArray; - } else if (_typeof2(dirtyDatesArray) === "object" && dirtyDatesArray !== null) { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } else { - return new Date(NaN); +// src/utils/sanitize.ts +var sanitizeTableName = (name) => { + return name == null ? void 0 : name.replace(/[^a-z0-9+]+/gi, ""); +}; +var sanitizeColumnName = (name) => { + if ((name == null ? void 0 : name.charAt(0)) == "_") { + return sanitizeColumnName(name.substring(1)); } - var result; - datesArray.forEach(function(dirtyDate) { - var currentDate = toDate(dirtyDate); - if (result === void 0 || result < currentDate || isNaN(Number(currentDate))) { - result = currentDate; - } - }); - return result || new Date(NaN); -} + return name == null ? void 0 : name.replace(/"/g, ``); +}; +var sanitizeSQLStatement = (name) => { + return name == null ? void 0 : name.replace(/'/g, `''`); +}; -// node_modules/date-fns/esm/min/index.js -function _typeof3(obj) { - "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof3 = function _typeof5(obj2) { - return typeof obj2; - }; - } else { - _typeof3 = function _typeof5(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; +// src/utils/serializer.ts +var serializeSpace = (space) => ({ ...space, def: JSON.stringify(space.def) }); +var serializeMultiString = (value) => value.join(","); +var serializeMultiDisplayString = (value) => value.join(", "); +var serializeSQLValues = (value) => value.join(", "); +var serializeSQLStatements = (value) => value.join("; "); +var serializeSQLFieldNames = (value) => value.join(","); + +// src/utils/tree.ts +var import_obsidian = require("obsidian"); +var nodeIsAncestorOfTarget = (node, target) => { + var _a2; + if (!node.item || !node.item.isFolder) + return false; + return (_a2 = target.item) == null ? void 0 : _a2.path.contains(node.item.path + "/"); +}; +var excludeVaultItemPredicate = (settings) => (f4, index, folder) => !(f4.folder != "true" && settings.hiddenExtensions.find( + (e4) => fileExtensionForFile(f4.path) == e4 +)) && !settings.hiddenFiles.find((e4) => e4 == f4.path) && (!settings.enableFolderNote || !settings.folderNoteInsideFolder && !folder.some((g4) => g4.path + ".md" == f4.path) || settings.folderNoteInsideFolder && !(f4.parent + "/" + folderPathToString(f4.parent) + ".md" == f4.path)); +var excludeFilePredicate = (plugin) => (f4, index, folder) => !(f4 instanceof import_obsidian.TFile && plugin.settings.hiddenExtensions.find((e4) => f4.extension == e4)) && !plugin.settings.hiddenFiles.find((e4) => e4 == f4.path) && (!plugin.settings.enableFolderNote || !plugin.settings.folderNoteInsideFolder && !folder.some((g4) => g4.path + ".md" == f4.path) || plugin.settings.folderNoteInsideFolder && !(f4.parent.path + "/" + f4.parent.name + ".md" == f4.path)); +var folderChildren = (plugin, f4, exclusionList) => { + var _a2, _b2; + return (_b2 = (_a2 = f4 == null ? void 0 : f4.children) == null ? void 0 : _a2.filter(excludeFilePredicate(plugin))) != null ? _b2 : []; +}; +var compareByField = (field, dir) => (_a2, _b2) => { + const a5 = dir ? _a2 : _b2; + const b4 = dir ? _b2 : _a2; + if (a5[field] < b4[field]) { + return -1; } - return _typeof3(obj); -} -function min(dirtyDatesArray) { - requiredArgs(1, arguments); - var datesArray; - if (dirtyDatesArray && typeof dirtyDatesArray.forEach === "function") { - datesArray = dirtyDatesArray; - } else if (_typeof3(dirtyDatesArray) === "object" && dirtyDatesArray !== null) { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } else { - return new Date(NaN); + if (a5[field] > b4[field]) { + return 1; } - var result; - datesArray.forEach(function(dirtyDate) { - var currentDate = toDate(dirtyDate); - if (result === void 0 || result > currentDate || isNaN(currentDate.getDate())) { - result = currentDate; - } - }); - return result || new Date(NaN); -} - -// node_modules/date-fns/esm/compareAsc/index.js -function compareAsc(dirtyDateLeft, dirtyDateRight) { - requiredArgs(2, arguments); - var dateLeft = toDate(dirtyDateLeft); - var dateRight = toDate(dirtyDateRight); - var diff = dateLeft.getTime() - dateRight.getTime(); - if (diff < 0) { + return 0; +}; +var compareByFieldCaseInsensitive = (field, dir) => (_a2, _b2) => { + const a5 = dir ? _a2 : _b2; + const b4 = dir ? _b2 : _a2; + if (a5[field].toLowerCase() < b4[field].toLowerCase()) { return -1; - } else if (diff > 0) { + } + if (a5[field].toLowerCase() > b4[field].toLowerCase()) { return 1; - } else { - return diff; } + return 0; +}; +var internalPluginLoaded = (pluginName, app2) => { + var _a2; + return (_a2 = app2.internalPlugins.plugins[pluginName]) == null ? void 0 : _a2._loaded; +}; +function selectElementContents(el) { + if (!el) + return; + var range = document.createRange(); + range.selectNodeContents(el); + var sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); } -// node_modules/date-fns/esm/isSameDay/index.js -function isSameDay(dirtyDateLeft, dirtyDateRight) { - requiredArgs(2, arguments); - var dateLeftStartOfDay = startOfDay(dirtyDateLeft); - var dateRightStartOfDay = startOfDay(dirtyDateRight); - return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime(); -} - -// node_modules/date-fns/esm/isDate/index.js -function _typeof4(obj) { - "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof4 = function _typeof5(obj2) { - return typeof obj2; - }; - } else { - _typeof4 = function _typeof5(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; +// src/utils/db/db.ts +var import_obsidian2 = require("obsidian"); +var getDBFile = async (path, isRemote) => { + if (isRemote) { + return fetch(path).then((res) => res.arrayBuffer()); } - return _typeof4(obj); -} -function isDate(value) { - requiredArgs(1, arguments); - return value instanceof Date || _typeof4(value) === "object" && Object.prototype.toString.call(value) === "[object Date]"; -} - -// node_modules/date-fns/esm/isValid/index.js -function isValid(dirtyDate) { - requiredArgs(1, arguments); - if (!isDate(dirtyDate) && typeof dirtyDate !== "number") { + if (!await app.vault.adapter.exists((0, import_obsidian2.normalizePath)(path))) { + return null; + } + const file = await app.vault.adapter.readBinary( + (0, import_obsidian2.normalizePath)(path) + ); + return file; +}; +var getDB = async (sqlJS, path, isRemote) => { + const buf = await getDBFile(path, isRemote); + if (buf) { + return new sqlJS.Database(new Uint8Array(buf)); + } + return new sqlJS.Database(); +}; +var saveDBFile = async (path, binary) => { + const file = app.vault.adapter.writeBinary( + (0, import_obsidian2.normalizePath)(path), + binary + ); + return file; +}; +var dbResultsToDBTables = (res) => { + return res.reduce( + (p3, c4, i4) => [ + ...p3, + { + cols: c4.columns, + rows: c4 ? c4.values.map( + (r3) => c4.columns.reduce( + (prev, curr, index) => ({ ...prev, [curr]: r3[index] }), + {} + ) + ) : [] + } + ], + [] + ); +}; +var selectDB = (db, table, condition, fields) => { + const fieldsStr = fields != null ? fields : "*"; + const sqlstr = condition ? `SELECT ${fieldsStr} FROM "${table}" WHERE ${condition};` : `SELECT ${fieldsStr} FROM ${table};`; + let tables; + try { + tables = dbResultsToDBTables(db.exec(sqlstr)); + } catch (e4) { + return null; + } + if (tables.length == 1) + return tables[0]; + return null; +}; +var deleteFromDB = (db, table, condition) => { + const sqlstr = `DELETE FROM "${table}" WHERE ${condition};`; + try { + db.exec(sqlstr); + } catch (e4) { + console.log(e4); + } +}; +var dropTable = (db, table) => { + const sqlstr = `DROP TABLE IF EXISTS "${table}";`; + try { + db.exec(sqlstr); + } catch (e4) { + console.log(e4); + } +}; +var replaceDB = (db, tables) => { + const sqlstr = serializeSQLStatements(Object.keys(tables).map((t4) => { + const tableFields = tables[t4].cols; + const fieldQuery = serializeSQLFieldNames(uniq(tableFields).map((f4) => `'${sanitizeSQLStatement(f4)}' char`)); + const rowsQuery = tables[t4].rows.reduce((prev, curr) => { + return `${prev} REPLACE INTO "${t4}" VALUES (${serializeSQLValues(tableFields.map((c4) => { + var _a2; + return `'${(_a2 = sanitizeSQLStatement(curr == null ? void 0 : curr[c4])) != null ? _a2 : ""}'`; + }))});`; + }, ""); + const idxQuery = tables[t4].uniques.filter((f4) => f4).reduce((p3, c4) => { + return `${p3} CREATE UNIQUE INDEX IF NOT EXISTS idx_${t4}_${c4.replace( + /,/g, + "_" + )} ON ${t4}(${c4});`; + }, ""); + const insertQuery = `CREATE TABLE IF NOT EXISTS "${t4}" (${fieldQuery}); ${idxQuery} BEGIN TRANSACTION; ${rowsQuery} COMMIT;`; + return `DROP INDEX IF EXISTS idx_${t4}__id; DROP TABLE IF EXISTS "${t4}"; ${fieldQuery.length > 0 ? insertQuery : ""}`; + })); + try { + db.exec(sqlstr); + } catch (e4) { + console.log(e4); + } +}; +var saveDBToPath = async (plugin, path, tables) => { + const sqlJS = await plugin.sqlJS(); + let db = await getDB(sqlJS, path); + if (!db) { + db.close(); return false; } - var date = toDate(dirtyDate); - return !isNaN(Number(date)); -} - -// node_modules/date-fns/esm/differenceInCalendarMonths/index.js -function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) { - requiredArgs(2, arguments); - var dateLeft = toDate(dirtyDateLeft); - var dateRight = toDate(dirtyDateRight); - var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear(); - var monthDiff = dateLeft.getMonth() - dateRight.getMonth(); - return yearDiff * 12 + monthDiff; -} - -// node_modules/date-fns/esm/differenceInCalendarWeeks/index.js -var MILLISECONDS_IN_WEEK = 6048e5; -function differenceInCalendarWeeks(dirtyDateLeft, dirtyDateRight, options) { - requiredArgs(2, arguments); - var startOfWeekLeft = startOfWeek(dirtyDateLeft, options); - var startOfWeekRight = startOfWeek(dirtyDateRight, options); - var timestampLeft = startOfWeekLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfWeekLeft); - var timestampRight = startOfWeekRight.getTime() - getTimezoneOffsetInMilliseconds(startOfWeekRight); - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK); -} + replaceDB(db, tables); + await saveDBFile(path, db.export().buffer); + db.close(); + return true; +}; -// node_modules/date-fns/esm/differenceInMilliseconds/index.js -function differenceInMilliseconds(dateLeft, dateRight) { - requiredArgs(2, arguments); - return toDate(dateLeft).getTime() - toDate(dateRight).getTime(); -} +// src/utils/metadata/tags.ts +var import_obsidian3 = require("obsidian"); -// node_modules/date-fns/esm/_lib/roundingMethods/index.js -var roundingMap = { - ceil: Math.ceil, - round: Math.round, - floor: Math.floor, - trunc: function trunc(value) { - return value < 0 ? Math.ceil(value) : Math.floor(value); +// src/utils/json.ts +var safelyParseJSON = (json) => { + var parsed; + try { + parsed = JSON.parse(json); + } catch (e4) { } + return parsed; }; -var defaultRoundingMethod = "trunc"; -function getRoundingMethod(method) { - return method ? roundingMap[method] : roundingMap[defaultRoundingMethod]; -} - -// node_modules/date-fns/esm/endOfDay/index.js -function endOfDay(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - date.setHours(23, 59, 59, 999); - return date; -} -// node_modules/date-fns/esm/endOfMonth/index.js -function endOfMonth(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var month = date.getMonth(); - date.setFullYear(date.getFullYear(), month + 1, 0); - date.setHours(23, 59, 59, 999); - return date; -} - -// node_modules/date-fns/esm/isLastDayOfMonth/index.js -function isLastDayOfMonth(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - return endOfDay(date).getTime() === endOfMonth(date).getTime(); -} - -// node_modules/date-fns/esm/differenceInMonths/index.js -function differenceInMonths(dirtyDateLeft, dirtyDateRight) { - requiredArgs(2, arguments); - var dateLeft = toDate(dirtyDateLeft); - var dateRight = toDate(dirtyDateRight); - var sign = compareAsc(dateLeft, dateRight); - var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight)); - var result; - if (difference < 1) { - result = 0; - } else { - if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) { - dateLeft.setDate(30); - } - dateLeft.setMonth(dateLeft.getMonth() - sign * difference); - var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign; - if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) { - isLastMonthNotFull = false; - } - result = sign * (difference - Number(isLastMonthNotFull)); - } - return result === 0 ? 0 : result; -} - -// node_modules/date-fns/esm/differenceInSeconds/index.js -function differenceInSeconds(dateLeft, dateRight, options) { - requiredArgs(2, arguments); - var diff = differenceInMilliseconds(dateLeft, dateRight) / 1e3; - return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); -} - -// node_modules/date-fns/esm/startOfMonth/index.js -function startOfMonth(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - date.setDate(1); - date.setHours(0, 0, 0, 0); - return date; -} - -// node_modules/date-fns/esm/startOfYear/index.js -function startOfYear(dirtyDate) { - requiredArgs(1, arguments); - var cleanDate = toDate(dirtyDate); - var date = new Date(0); - date.setFullYear(cleanDate.getFullYear(), 0, 1); - date.setHours(0, 0, 0, 0); - return date; -} - -// node_modules/date-fns/esm/endOfWeek/index.js -function endOfWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - requiredArgs(1, arguments); - var defaultOptions3 = getDefaultOptions(); - var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var date = toDate(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); - date.setDate(date.getDate() + diff); - date.setHours(23, 59, 59, 999); - return date; -} - -// node_modules/date-fns/esm/endOfISOWeek/index.js -function endOfISOWeek(dirtyDate) { - requiredArgs(1, arguments); - return endOfWeek(dirtyDate, { - weekStartsOn: 1 - }); -} - -// node_modules/date-fns/esm/subMilliseconds/index.js -function subMilliseconds(dirtyDate, dirtyAmount) { - requiredArgs(2, arguments); - var amount = toInteger(dirtyAmount); - return addMilliseconds(dirtyDate, -amount); -} - -// node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js -var MILLISECONDS_IN_DAY2 = 864e5; -function getUTCDayOfYear(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var timestamp = date.getTime(); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - var startOfYearTimestamp = date.getTime(); - var difference = timestamp - startOfYearTimestamp; - return Math.floor(difference / MILLISECONDS_IN_DAY2) + 1; -} - -// node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js -function startOfUTCISOWeek(dirtyDate) { - requiredArgs(1, arguments); - var weekStartsOn = 1; - var date = toDate(dirtyDate); - var day = date.getUTCDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setUTCDate(date.getUTCDate() - diff); - date.setUTCHours(0, 0, 0, 0); - return date; -} - -// node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js -function getUTCISOWeekYear(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var year = date.getUTCFullYear(); - var fourthOfJanuaryOfNextYear = new Date(0); - fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = new Date(0); - fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4); - fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; +// src/utils/parser.tsx +var parseSortStrat = (str) => { + const [a5, b4] = str.split("_"); + return [a5, b4 == "asc"]; +}; +var parseMultiString = (str) => { + var _a2; + return (_a2 = str == null ? void 0 : str.match(/(\\.|[^,])+/g)) != null ? _a2 : []; +}; +var parseLinkString = (string) => { + if (!string) + return ""; + const match2 = /\[\[(.*?)\]\]/g.exec(string); + const stringValue = (match2 == null ? void 0 : match2.length) > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string; + if (stringValue) + return stringValue; + return string; +}; +var parseLinkDisplayString = (string) => { + return filePathToString(parseLinkString(string)); +}; +var parseContextDefString = (str) => { + var _a2; + if (!str || str.length == 0) + return []; + if (str.charAt(0) == "#") { + return str.split("&").map((f4) => ({ + type: "tag", + value: f4 + })); } -} - -// node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js -function startOfUTCISOWeekYear(dirtyDate) { - requiredArgs(1, arguments); - var year = getUTCISOWeekYear(dirtyDate); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setUTCFullYear(year, 0, 4); - fourthOfJanuary.setUTCHours(0, 0, 0, 0); - var date = startOfUTCISOWeek(fourthOfJanuary); - return date; -} - -// node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js -var MILLISECONDS_IN_WEEK2 = 6048e5; -function getUTCISOWeek(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK2) + 1; -} - -// node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js -function startOfUTCWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - requiredArgs(1, arguments); - var defaultOptions3 = getDefaultOptions(); - var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); + return (_a2 = safelyParseJSON(str)) != null ? _a2 : []; +}; +var parseSpace = (spaceRow) => { + return { + ...spaceRow, + def: parseSpaceDefString(spaceRow.def) + }; +}; +var parseSpaceDefString = (str) => { + var _a2; + if (!str || str.length == 0) + return { type: "focus", folder: "", filters: [] }; + if (str.charAt(0) != "{") { + return { + folder: str, + type: "focus", + filters: [ + { + type: "any", + trueFalse: true, + filters: [ + { + type: "filemeta", + fType: "string", + field: "folder", + fn: "equals", + value: str + } + ] + } + ] + }; } - var date = toDate(dirtyDate); - var day = date.getUTCDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setUTCDate(date.getUTCDate() - diff); - date.setUTCHours(0, 0, 0, 0); - return date; -} + return (_a2 = safelyParseJSON(str)) != null ? _a2 : []; +}; -// node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js -function getUTCWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var year = date.getUTCFullYear(); - var defaultOptions3 = getDefaultOptions(); - var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); +// src/utils/metadata/tags.ts +var tagKeys = ["tag", "tags", "Tag", "Tags"]; +var tagToTagPath = (tag) => { + if (!tag) + return null; + let string = tag; + if (string.charAt(0) != "#") + string = "#" + string; + return string.replace(/\//g, "+"); +}; +var tagPathToTag = (string) => { + return filePathToString(string).replace(/\+/g, "/"); +}; +var loadTags = (plugin) => { + var _a2; + const folder = plugin.settings.tagContextFolder == "" ? app.vault.getRoot() : getAbstractFileAtPath( + app, + getFolderPathFromString(plugin.settings.tagContextFolder) + ); + return uniq([ + ...Object.keys(app.metadataCache.getTags()), + ...(_a2 = folder == null ? void 0 : folder.children.filter( + (f4) => f4 instanceof import_obsidian3.TFile && f4.extension == "mdb" && f4.name.charAt(0) == "#" + ).map((f4) => tagPathToTag(f4.name))) != null ? _a2 : [] + ]); +}; +var tagExists = (currentCache, findTag) => { + let currentTags = []; + if ((0, import_obsidian3.getAllTags)(currentCache)) { + currentTags = (0, import_obsidian3.getAllTags)(currentCache); } - var firstWeekOfNextYear = new Date(0); - firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options); - var firstWeekOfThisYear = new Date(0); - firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; + return currentTags.find((tag) => tag.toLowerCase() == findTag.toLowerCase()) ? true : false; +}; +var getAllFilesForTag = (tag) => { + let tagsCache = []; + (() => { + app.vault.getMarkdownFiles().forEach((tfile) => { + let currentCache; + if (app.metadataCache.getFileCache(tfile) !== null) { + currentCache = app.metadataCache.getFileCache(tfile); + } + let relativePath = tfile.path; + const hasTag = tagExists(currentCache, tag); + if (hasTag) { + tagsCache.push(relativePath); + } + }); + })(); + return tagsCache; +}; +var addTagToNote = (tag, tFile) => { + const newTag = validateName(tag); + editTagInFrontmatter("", newTag, tFile); +}; +var positionsForTag = (tag, file) => { + const currentCache = app.metadataCache.getFileCache(file); + if (currentCache.tags) { + const positions = currentCache.tags.filter((f4) => f4.tag == tag).map((f4) => f4.position).sort((a5, b4) => { + if (a5.start.offset < b4.start.offset) { + return -1; + } + if (a5.start.offset > b4.start.offset) { + return 1; + } + return 0; + }); + return positions; } -} - -// node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js -function startOfUTCWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - requiredArgs(1, arguments); - var defaultOptions3 = getDefaultOptions(); - var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - var year = getUTCWeekYear(dirtyDate, options); - var firstWeek = new Date(0); - firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeek.setUTCHours(0, 0, 0, 0); - var date = startOfUTCWeek(firstWeek, options); - return date; -} - -// node_modules/date-fns/esm/_lib/getUTCWeek/index.js -var MILLISECONDS_IN_WEEK3 = 6048e5; -function getUTCWeek(dirtyDate, options) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK3) + 1; -} - -// node_modules/date-fns/esm/_lib/addLeadingZeros/index.js -function addLeadingZeros(number, targetLength) { - var sign = number < 0 ? "-" : ""; - var output = Math.abs(number).toString(); - while (output.length < targetLength) { - output = "0" + output; + return []; +}; +var removeTagFromFile = (tag, file) => { + const pos = positionsForTag(tag, file); + removeTagInFrontmatter(tag, file); + editTagInFileBody(tag, "", pos, file); +}; +var validateName = (tag) => { + return tag.trim(); +}; +var deleteTag = async (plugin, tag, subTags) => { + const files = getAllFilesForTag(tag).map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4 instanceof import_obsidian3.TFile); + files.forEach((file) => removeTagFromFile(tag, file)); + deleteTagContext(plugin, tag); + if (subTags) { + const tags = getAllSubtags(plugin, tag); + tags.forEach((tag2) => deleteTag(plugin, tag2, subTags)); } - return sign + output; -} - -// node_modules/date-fns/esm/_lib/format/lightFormatters/index.js -var formatters = { - y: function y3(date, token) { - var signedYear = date.getUTCFullYear(); - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); - }, - M: function M3(date, token) { - var month = date.getUTCMonth(); - return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); - }, - d: function d3(date, token) { - return addLeadingZeros(date.getUTCDate(), token.length); - }, - a: function a3(date, token) { - var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am"; - switch (token) { - case "a": - case "aa": - return dayPeriodEnumValue.toUpperCase(); - case "aaa": - return dayPeriodEnumValue; - case "aaaaa": - return dayPeriodEnumValue[0]; - case "aaaa": - default: - return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; +}; +var tagsFromDefString = (defStr) => parseContextDefString(defStr).filter((f4) => f4.type == "tag" && f4.value.length > 0).map((f4) => f4.value); +var updateTagsForDefString = (defStr, tags) => JSON.stringify([...parseContextDefString(defStr).filter((f4) => f4.type != "tag"), ...tags.map((f4) => ({ type: "tag", value: f4 }))]); +var addTag = async (plugin, tag) => { + const context = tagContextFromTag(plugin, tag); + await createDefaultDB(plugin, context); +}; +var renameTag = async (plugin, tag, toTag) => { + const tags = getAllSubtags(plugin, tag); + const newTag = validateName(toTag); + const files = getAllFilesForTag(tag); + for (const file of files) { + const tFile = getAbstractFileAtPath(app, file); + if (tFile instanceof import_obsidian3.TFile) { + const positions = positionsForTag(tag, tFile); + if (positions.length > 0) { + await editTagInFileBody(tag, newTag, positions, tFile); + } else { + await editTagInFrontmatter(tag, newTag, tFile); + } } - }, - h: function h3(date, token) { - return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length); - }, - H: function H3(date, token) { - return addLeadingZeros(date.getUTCHours(), token.length); - }, - m: function m3(date, token) { - return addLeadingZeros(date.getUTCMinutes(), token.length); - }, - s: function s3(date, token) { - return addLeadingZeros(date.getUTCSeconds(), token.length); - }, - S: function S2(date, token) { - var numberOfDigits = token.length; - var milliseconds = date.getUTCMilliseconds(); - var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3)); - return addLeadingZeros(fractionalSeconds, token.length); + } + await renameTagContextFile(plugin, tag, toTag); + for (const subtag of tags) { + await renameTag(plugin, subtag, subtag.replace(tag, newTag)); } }; -var lightFormatters_default = formatters; - -// node_modules/date-fns/esm/_lib/format/formatters/index.js -var dayPeriodEnum = { - am: "am", - pm: "pm", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" +var getAllSubtags = (plugin, tag) => { + const tags = loadTags(plugin); + return tags.filter((f4) => f4.startsWith(tag) && f4 != tag); }; -var formatters2 = { - G: function G2(date, token, localize2) { - var era = date.getUTCFullYear() > 0 ? 1 : 0; - switch (token) { - case "G": - case "GG": - case "GGG": - return localize2.era(era, { - width: "abbreviated" - }); - case "GGGGG": - return localize2.era(era, { - width: "narrow" - }); - case "GGGG": - default: - return localize2.era(era, { - width: "wide" - }); - } - }, - y: function y4(date, token, localize2) { - if (token === "yo") { - var signedYear = date.getUTCFullYear(); - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return localize2.ordinalNumber(year, { - unit: "year" - }); - } - return lightFormatters_default.y(date, token); - }, - Y: function Y2(date, token, localize2, options) { - var signedWeekYear = getUTCWeekYear(date, options); - var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; - if (token === "YY") { - var twoDigitYear = weekYear % 100; - return addLeadingZeros(twoDigitYear, 2); - } - if (token === "Yo") { - return localize2.ordinalNumber(weekYear, { - unit: "year" - }); - } - return addLeadingZeros(weekYear, token.length); - }, - R: function R2(date, token) { - var isoWeekYear = getUTCISOWeekYear(date); - return addLeadingZeros(isoWeekYear, token.length); - }, - u: function u3(date, token) { - var year = date.getUTCFullYear(); - return addLeadingZeros(year, token.length); - }, - Q: function Q2(date, token, localize2) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); - switch (token) { - case "Q": - return String(quarter); - case "QQ": - return addLeadingZeros(quarter, 2); - case "Qo": - return localize2.ordinalNumber(quarter, { - unit: "quarter" - }); - case "QQQ": - return localize2.quarter(quarter, { - width: "abbreviated", - context: "formatting" - }); - case "QQQQQ": - return localize2.quarter(quarter, { - width: "narrow", - context: "formatting" - }); - case "QQQQ": - default: - return localize2.quarter(quarter, { - width: "wide", - context: "formatting" - }); - } - }, - q: function q4(date, token, localize2) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); - switch (token) { - case "q": - return String(quarter); - case "qq": - return addLeadingZeros(quarter, 2); - case "qo": - return localize2.ordinalNumber(quarter, { - unit: "quarter" - }); - case "qqq": - return localize2.quarter(quarter, { - width: "abbreviated", - context: "standalone" - }); - case "qqqqq": - return localize2.quarter(quarter, { - width: "narrow", - context: "standalone" - }); - case "qqqq": - default: - return localize2.quarter(quarter, { - width: "wide", - context: "standalone" - }); - } - }, - M: function M4(date, token, localize2) { - var month = date.getUTCMonth(); - switch (token) { - case "M": - case "MM": - return lightFormatters_default.M(date, token); - case "Mo": - return localize2.ordinalNumber(month + 1, { - unit: "month" - }); - case "MMM": - return localize2.month(month, { - width: "abbreviated", - context: "formatting" - }); - case "MMMMM": - return localize2.month(month, { - width: "narrow", - context: "formatting" - }); - case "MMMM": - default: - return localize2.month(month, { - width: "wide", - context: "formatting" - }); - } - }, - L: function L3(date, token, localize2) { - var month = date.getUTCMonth(); - switch (token) { - case "L": - return String(month + 1); - case "LL": - return addLeadingZeros(month + 1, 2); - case "Lo": - return localize2.ordinalNumber(month + 1, { - unit: "month" - }); - case "LLL": - return localize2.month(month, { - width: "abbreviated", - context: "standalone" - }); - case "LLLLL": - return localize2.month(month, { - width: "narrow", - context: "standalone" - }); - case "LLLL": - default: - return localize2.month(month, { - width: "wide", - context: "standalone" - }); - } - }, - w: function w4(date, token, localize2, options) { - var week = getUTCWeek(date, options); - if (token === "wo") { - return localize2.ordinalNumber(week, { - unit: "week" - }); - } - return addLeadingZeros(week, token.length); - }, - I: function I3(date, token, localize2) { - var isoWeek = getUTCISOWeek(date); - if (token === "Io") { - return localize2.ordinalNumber(isoWeek, { - unit: "week" - }); - } - return addLeadingZeros(isoWeek, token.length); - }, - d: function d4(date, token, localize2) { - if (token === "do") { - return localize2.ordinalNumber(date.getUTCDate(), { - unit: "date" +var removeTagInFrontmatter = async (oldTag, file) => { + var _a2; + let fm; + if (app.metadataCache.getFileCache(file) !== null) { + fm = (_a2 = app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; + } + if (fm && app.fileManager.processFrontMatter) { + const processKey = (value) => { + if (Array.isArray(value)) { + return value.filter((f4) => stringFromTag(oldTag) != f4); + } else if (typeof value === "string") { + return serializeMultiDisplayString( + value.replace(/\s/g, "").split(",").filter((f4) => stringFromTag(oldTag) != f4) + ); + } + return value; + }; + const editKeys = tagKeys.filter((f4) => { + let tags = []; + if (Array.isArray(fm[f4])) { + tags = fm[f4]; + } else if (typeof fm[f4] === "string") { + tags = fm[f4].replace(/\s/g, "").split(","); + } + if (tags.find((g4) => g4 == stringFromTag(oldTag))) + return true; + return false; + }); + editKeys.forEach((tag) => { + app.fileManager.processFrontMatter(file, (frontmatter) => { + frontmatter[tag] = processKey(fm[tag]); }); + }); + } +}; +var editTagInFrontmatter = async (oldTag, newTag, file) => { + var _a2; + let fm; + if (app.metadataCache.getFileCache(file) !== null) { + fm = (_a2 = app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; + } + const addTag2 = (value) => { + if (Array.isArray(value)) { + return uniq([...value, stringFromTag(newTag)]).filter((f4) => (f4 == null ? void 0 : f4.length) > 0); + } else if (typeof value === "string") { + return serializeMultiDisplayString(uniq([ + ...value.replace(/\s/g, "").split(","), + stringFromTag(newTag) + ]).filter((f4) => (f4 == null ? void 0 : f4.length) > 0)); } - return lightFormatters_default.d(date, token); - }, - D: function D3(date, token, localize2) { - var dayOfYear = getUTCDayOfYear(date); - if (token === "Do") { - return localize2.ordinalNumber(dayOfYear, { - unit: "dayOfYear" + return stringFromTag(newTag); + }; + if (app.fileManager.processFrontMatter) { + if (fm) { + const processKey = (value) => { + if (Array.isArray(value)) { + return uniq( + value.map( + (f4) => stringFromTag(oldTag) == f4 ? stringFromTag(newTag) : f4 + ) + ); + } else if (typeof value === "string") { + return serializeMultiDisplayString(uniq( + value.replace(/\s/g, "").split(",").map( + (f4) => stringFromTag(oldTag) == f4 ? stringFromTag(newTag) : f4 + ) + )); + } + return value; + }; + const editKeys = tagKeys.filter((f4) => { + let tags = []; + if (Array.isArray(fm[f4])) { + tags = fm[f4]; + } else if (typeof fm[f4] === "string") { + tags = fm[f4].replace(/\s/g, "").split(","); + } + if (tags.find((g4) => g4 == stringFromTag(oldTag))) + return true; + return false; }); - } - return addLeadingZeros(dayOfYear, token.length); - }, - E: function E3(date, token, localize2) { - var dayOfWeek = date.getUTCDay(); - switch (token) { - case "E": - case "EE": - case "EEE": - return localize2.day(dayOfWeek, { - width: "abbreviated", - context: "formatting" - }); - case "EEEEE": - return localize2.day(dayOfWeek, { - width: "narrow", - context: "formatting" - }); - case "EEEEEE": - return localize2.day(dayOfWeek, { - width: "short", - context: "formatting" - }); - case "EEEE": - default: - return localize2.day(dayOfWeek, { - width: "wide", - context: "formatting" - }); - } - }, - e: function e3(date, token, localize2, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; - switch (token) { - case "e": - return String(localDayOfWeek); - case "ee": - return addLeadingZeros(localDayOfWeek, 2); - case "eo": - return localize2.ordinalNumber(localDayOfWeek, { - unit: "day" - }); - case "eee": - return localize2.day(dayOfWeek, { - width: "abbreviated", - context: "formatting" - }); - case "eeeee": - return localize2.day(dayOfWeek, { - width: "narrow", - context: "formatting" - }); - case "eeeeee": - return localize2.day(dayOfWeek, { - width: "short", - context: "formatting" - }); - case "eeee": - default: - return localize2.day(dayOfWeek, { - width: "wide", - context: "formatting" - }); - } - }, - c: function c3(date, token, localize2, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; - switch (token) { - case "c": - return String(localDayOfWeek); - case "cc": - return addLeadingZeros(localDayOfWeek, token.length); - case "co": - return localize2.ordinalNumber(localDayOfWeek, { - unit: "day" - }); - case "ccc": - return localize2.day(dayOfWeek, { - width: "abbreviated", - context: "standalone" - }); - case "ccccc": - return localize2.day(dayOfWeek, { - width: "narrow", - context: "standalone" - }); - case "cccccc": - return localize2.day(dayOfWeek, { - width: "short", - context: "standalone" - }); - case "cccc": - default: - return localize2.day(dayOfWeek, { - width: "wide", - context: "standalone" - }); - } - }, - i: function i3(date, token, localize2) { - var dayOfWeek = date.getUTCDay(); - var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; - switch (token) { - case "i": - return String(isoDayOfWeek); - case "ii": - return addLeadingZeros(isoDayOfWeek, token.length); - case "io": - return localize2.ordinalNumber(isoDayOfWeek, { - unit: "day" - }); - case "iii": - return localize2.day(dayOfWeek, { - width: "abbreviated", - context: "formatting" - }); - case "iiiii": - return localize2.day(dayOfWeek, { - width: "narrow", - context: "formatting" - }); - case "iiiiii": - return localize2.day(dayOfWeek, { - width: "short", - context: "formatting" - }); - case "iiii": - default: - return localize2.day(dayOfWeek, { - width: "wide", - context: "formatting" - }); - } - }, - a: function a4(date, token, localize2) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; - switch (token) { - case "a": - case "aa": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "abbreviated", - context: "formatting" - }); - case "aaa": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "abbreviated", - context: "formatting" - }).toLowerCase(); - case "aaaaa": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "narrow", - context: "formatting" - }); - case "aaaa": - default: - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "wide", - context: "formatting" - }); - } - }, - b: function b3(date, token, localize2) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; - if (hours === 12) { - dayPeriodEnumValue = dayPeriodEnum.noon; - } else if (hours === 0) { - dayPeriodEnumValue = dayPeriodEnum.midnight; - } else { - dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; - } - switch (token) { - case "b": - case "bb": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "abbreviated", - context: "formatting" - }); - case "bbb": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "abbreviated", - context: "formatting" - }).toLowerCase(); - case "bbbbb": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "narrow", - context: "formatting" + if (editKeys.length > 0) { + editKeys.forEach((key2) => { + app.fileManager.processFrontMatter(file, (frontmatter) => { + frontmatter[key2] = processKey(fm[key2]); + }); }); - case "bbbb": - default: - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "wide", - context: "formatting" + } else { + app.fileManager.processFrontMatter(file, (frontmatter) => { + frontmatter["tags"] = addTag2(fm["tags"]); }); - } - }, - B: function B4(date, token, localize2) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; - if (hours >= 17) { - dayPeriodEnumValue = dayPeriodEnum.evening; - } else if (hours >= 12) { - dayPeriodEnumValue = dayPeriodEnum.afternoon; - } else if (hours >= 4) { - dayPeriodEnumValue = dayPeriodEnum.morning; + } } else { - dayPeriodEnumValue = dayPeriodEnum.night; - } - switch (token) { - case "B": - case "BB": - case "BBB": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "abbreviated", - context: "formatting" - }); - case "BBBBB": - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "narrow", - context: "formatting" - }); - case "BBBB": - default: - return localize2.dayPeriod(dayPeriodEnumValue, { - width: "wide", - context: "formatting" - }); - } - }, - h: function h4(date, token, localize2) { - if (token === "ho") { - var hours = date.getUTCHours() % 12; - if (hours === 0) - hours = 12; - return localize2.ordinalNumber(hours, { - unit: "hour" - }); - } - return lightFormatters_default.h(date, token); - }, - H: function H4(date, token, localize2) { - if (token === "Ho") { - return localize2.ordinalNumber(date.getUTCHours(), { - unit: "hour" - }); - } - return lightFormatters_default.H(date, token); - }, - K: function K2(date, token, localize2) { - var hours = date.getUTCHours() % 12; - if (token === "Ko") { - return localize2.ordinalNumber(hours, { - unit: "hour" + app.fileManager.processFrontMatter(file, (frontmatter) => { + frontmatter["tags"] = stringFromTag(newTag); }); } - return addLeadingZeros(hours, token.length); - }, - k: function k4(date, token, localize2) { - var hours = date.getUTCHours(); - if (hours === 0) - hours = 24; - if (token === "ko") { - return localize2.ordinalNumber(hours, { - unit: "hour" - }); + } +}; +var editTagInFileBody = async (oldTag, newTag, positions, file) => { + const offsetOffset = newTag.length - oldTag.length; + if (positions.length == 0) + return false; + const original = await app.vault.read(file); + let text2 = original; + let offset = 0; + for (const { start, end } of positions) { + let startOff = start.offset + offset; + let endOff = end.offset + offset; + if (text2.slice(startOff, endOff) !== oldTag) { + return false; } - return addLeadingZeros(hours, token.length); - }, - m: function m4(date, token, localize2) { - if (token === "mo") { - return localize2.ordinalNumber(date.getUTCMinutes(), { - unit: "minute" - }); - } - return lightFormatters_default.m(date, token); - }, - s: function s4(date, token, localize2) { - if (token === "so") { - return localize2.ordinalNumber(date.getUTCSeconds(), { - unit: "second" - }); - } - return lightFormatters_default.s(date, token); - }, - S: function S3(date, token) { - return lightFormatters_default.S(date, token); - }, - X: function X2(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - if (timezoneOffset === 0) { - return "Z"; - } - switch (token) { - case "X": - return formatTimezoneWithOptionalMinutes(timezoneOffset); - case "XXXX": - case "XX": - return formatTimezone(timezoneOffset); - case "XXXXX": - case "XXX": - default: - return formatTimezone(timezoneOffset, ":"); - } - }, - x: function x4(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - case "x": - return formatTimezoneWithOptionalMinutes(timezoneOffset); - case "xxxx": - case "xx": - return formatTimezone(timezoneOffset); - case "xxxxx": - case "xxx": - default: - return formatTimezone(timezoneOffset, ":"); - } - }, - O: function O3(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - case "O": - case "OO": - case "OOO": - return "GMT" + formatTimezoneShort(timezoneOffset, ":"); - case "OOOO": - default: - return "GMT" + formatTimezone(timezoneOffset, ":"); - } - }, - z: function z4(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - case "z": - case "zz": - case "zzz": - return "GMT" + formatTimezoneShort(timezoneOffset, ":"); - case "zzzz": - default: - return "GMT" + formatTimezone(timezoneOffset, ":"); - } - }, - t: function t3(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = Math.floor(originalDate.getTime() / 1e3); - return addLeadingZeros(timestamp, token.length); - }, - T: function T5(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = originalDate.getTime(); - return addLeadingZeros(timestamp, token.length); + text2 = text2.slice(0, startOff) + newTag + text2.slice(startOff + oldTag.length); + offset += offsetOffset; } -}; -function formatTimezoneShort(offset, dirtyDelimiter) { - var sign = offset > 0 ? "-" : "+"; - var absOffset = Math.abs(offset); - var hours = Math.floor(absOffset / 60); - var minutes = absOffset % 60; - if (minutes === 0) { - return sign + String(hours); + if (text2 !== original) { + await app.vault.modify(file, text2); + return true; } - var delimiter = dirtyDelimiter || ""; - return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); -} -function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { - if (offset % 60 === 0) { - var sign = offset > 0 ? "-" : "+"; - return sign + addLeadingZeros(Math.abs(offset) / 60, 2); +}; +var allTagsForFile = (file) => { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j; + let rt = []; + if (file instanceof import_obsidian3.TFile) { + const fCache = app.metadataCache.getCache(file.path); + if (fCache && fCache.tags) + rt.push(...(_b2 = (_a2 = fCache.tags) == null ? void 0 : _a2.map((f4) => f4.tag)) != null ? _b2 : []); + if (fCache && ((_c2 = fCache.frontmatter) == null ? void 0 : _c2.tags)) + rt.push( + ...(typeof ((_d2 = fCache.frontmatter) == null ? void 0 : _d2.tags) === "string" ? parseMultiString(fCache.frontmatter.tags.replace(/ /g, "")) : Array.isArray((_e2 = fCache.frontmatter) == null ? void 0 : _e2.tags) ? (_f = fCache.frontmatter) == null ? void 0 : _f.tags : []).filter((f4) => typeof f4 === "string").map((f4) => "#" + f4) + ); + if (fCache && ((_g = fCache.frontmatter) == null ? void 0 : _g.tag)) + rt.push( + ...(typeof ((_h = fCache.frontmatter) == null ? void 0 : _h.tag) === "string" ? parseMultiString(fCache.frontmatter.tag.replace(/ /g, "")) : Array.isArray((_i = fCache.frontmatter) == null ? void 0 : _i.tag) ? (_j = fCache.frontmatter) == null ? void 0 : _j.tag : []).filter((f4) => typeof f4 === "string").map((f4) => "#" + f4) + ); } - return formatTimezone(offset, dirtyDelimiter); -} -function formatTimezone(offset, dirtyDelimiter) { - var delimiter = dirtyDelimiter || ""; - var sign = offset > 0 ? "-" : "+"; - var absOffset = Math.abs(offset); - var hours = addLeadingZeros(Math.floor(absOffset / 60), 2); - var minutes = addLeadingZeros(absOffset % 60, 2); - return sign + hours + delimiter + minutes; -} -var formatters_default = formatters2; + return uniq(rt); +}; -// node_modules/date-fns/esm/_lib/format/longFormatters/index.js -var dateLongFormatter = function dateLongFormatter2(pattern, formatLong2) { - switch (pattern) { - case "P": - return formatLong2.date({ - width: "short" - }); - case "PP": - return formatLong2.date({ - width: "medium" - }); - case "PPP": - return formatLong2.date({ - width: "long" - }); - case "PPPP": - default: - return formatLong2.date({ - width: "full" - }); - } +// src/utils/contexts/mdb.ts +var dbTableToMDBTable = (table, schema, fields) => { + var _a2; + return { + schema, + cols: fields, + rows: (_a2 = table == null ? void 0 : table.rows) != null ? _a2 : [] + }; }; -var timeLongFormatter = function timeLongFormatter2(pattern, formatLong2) { - switch (pattern) { - case "p": - return formatLong2.time({ - width: "short" - }); - case "pp": - return formatLong2.time({ - width: "medium" - }); - case "ppp": - return formatLong2.time({ - width: "long" - }); - case "pppp": - default: - return formatLong2.time({ - width: "full" - }); - } +var updateFieldsToSchema = (fields, context) => { + const defaultFields = defaultFieldsForContext(context); + return [ + ...fields, + ...defaultFields.rows.filter( + (f4) => !fields.some((g4) => g4.name == f4.name && g4.schemaId == f4.schemaId) + ) + ]; }; -var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong2) { - var matchResult = pattern.match(/(P+)(p+)?/) || []; - var datePattern = matchResult[1]; - var timePattern = matchResult[2]; - if (!timePattern) { - return dateLongFormatter(pattern, formatLong2); +var getMDBTable = async (plugin, context, table) => { + if (!context) + return null; + const sqlJS = await plugin.sqlJS(); + const buf = await getDBFile(context.dbPath, context.isRemote); + if (!buf) { + return null; } - var dateTimeFormat; - switch (datePattern) { - case "P": - dateTimeFormat = formatLong2.dateTime({ - width: "short" - }); - break; - case "PP": - dateTimeFormat = formatLong2.dateTime({ - width: "medium" - }); - break; - case "PPP": - dateTimeFormat = formatLong2.dateTime({ - width: "long" - }); - break; - case "PPPP": - default: - dateTimeFormat = formatLong2.dateTime({ - width: "full" - }); - break; + const db = new sqlJS.Database(new Uint8Array(buf)); + await sanitizeTableSchema(plugin, db, context); + let fieldsTables; + let schema; + try { + fieldsTables = dbResultsToDBTables( + db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table}'`) + ); + schema = dbResultsToDBTables( + db.exec(`SELECT * FROM m_schema WHERE id = '${table}'`) + )[0].rows[0]; + } catch (e4) { + db.close(); + return null; } - return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); -}; -var longFormatters = { - p: timeLongFormatter, - P: dateTimeLongFormatter + if (fieldsTables.length == 0) { + db.close(); + return { + schema, + cols: [], + rows: [] + }; + } + const fields = fieldsTables[0].rows.filter( + (f4) => f4.name.length > 0 + ); + const dbTable = dbResultsToDBTables( + db.exec( + `SELECT ${serializeSQLFieldNames( + fields.reduce((p3, c4) => [...p3, `"${c4.name}"`], []) + )} FROM "${table}"` + ) + ); + db.close(); + return dbTableToMDBTable( + dbTable[0], + schema, + schema.primary ? updateFieldsToSchema(fields, context) : fields + ); }; -var longFormatters_default = longFormatters; - -// node_modules/date-fns/esm/_lib/protectedTokens/index.js -var protectedDayOfYearTokens = ["D", "DD"]; -var protectedWeekYearTokens = ["YY", "YYYY"]; -function isProtectedDayOfYearToken(token) { - return protectedDayOfYearTokens.indexOf(token) !== -1; -} -function isProtectedWeekYearToken(token) { - return protectedWeekYearTokens.indexOf(token) !== -1; -} -function throwProtectedError(token, format2, input) { - if (token === "YYYY") { - throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === "YY") { - throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === "D") { - throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === "DD") { - throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); +var deleteMDBTable = async (plugin, context, table) => { + if (context.readOnly) + return false; + const sqlJS = await plugin.sqlJS(); + const buf = await getDBFile(context.dbPath, context.isRemote); + if (!buf) { + return false; } -} - -// node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js -var formatDistanceLocale = { - lessThanXSeconds: { - one: "less than a second", - other: "less than {{count}} seconds" - }, - xSeconds: { - one: "1 second", - other: "{{count}} seconds" - }, - halfAMinute: "half a minute", - lessThanXMinutes: { - one: "less than a minute", - other: "less than {{count}} minutes" - }, - xMinutes: { - one: "1 minute", - other: "{{count}} minutes" - }, - aboutXHours: { - one: "about 1 hour", - other: "about {{count}} hours" - }, - xHours: { - one: "1 hour", - other: "{{count}} hours" - }, - xDays: { - one: "1 day", - other: "{{count}} days" - }, - aboutXWeeks: { - one: "about 1 week", - other: "about {{count}} weeks" - }, - xWeeks: { - one: "1 week", - other: "{{count}} weeks" - }, - aboutXMonths: { - one: "about 1 month", - other: "about {{count}} months" - }, - xMonths: { - one: "1 month", - other: "{{count}} months" - }, - aboutXYears: { - one: "about 1 year", - other: "about {{count}} years" - }, - xYears: { - one: "1 year", - other: "{{count}} years" - }, - overXYears: { - one: "over 1 year", - other: "over {{count}} years" - }, - almostXYears: { - one: "almost 1 year", - other: "almost {{count}} years" + const db = new sqlJS.Database(new Uint8Array(buf)); + 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(context.dbPath, db.export().buffer); + db.close(); + return true; +}; +var getMDBTableSchemas = async (plugin, context) => { + const sqlJS = await plugin.sqlJS(); + const buf = await getDBFile(context.dbPath, context.isRemote); + if (!buf) { + return null; } + const db = new sqlJS.Database(new Uint8Array(buf)); + await sanitizeTableSchema(plugin, db, context); + const tables = db.exec(`SELECT * FROM m_schema`); + db.close(); + return tables[0].values.map((f4) => { + const [id2, name, type, def, predicate, primary] = f4; + return { id: id2, name, type, def, predicate, primary }; + }); }; -var formatDistance = function formatDistance2(token, count2, options) { - var result; - var tokenValue = formatDistanceLocale[token]; - if (typeof tokenValue === "string") { - result = tokenValue; - } else if (count2 === 1) { - result = tokenValue.one; - } else { - result = tokenValue.other.replace("{{count}}", count2.toString()); +var saveMDBToPath = async (plugin, context, mdb) => { + var _a2, _b2; + if (context.readOnly) + return; + const sqlJS = await plugin.sqlJS(); + const buf = await getDBFile(context.dbPath, context.isRemote); + if (!buf) { + return null; } - if (options !== null && options !== void 0 && options.addSuffix) { - if (options.comparison && options.comparison > 0) { - return "in " + result; - } else { - return result + " ago"; + const db = new sqlJS.Database(new Uint8Array(buf)); + const fieldsTables = dbResultsToDBTables( + db.exec(`SELECT * FROM m_fields WHERE schemaId != '${mdb.schema.id}'`) + ); + const tables = { + m_fields: { + uniques: fieldSchema.uniques, + cols: fieldSchema.cols, + rows: [...(_b2 = (_a2 = fieldsTables[0]) == null ? void 0 : _a2.rows) != null ? _b2 : [], ...mdb.cols] + }, + [mdb.schema.id]: { + uniques: [], + cols: mdb.cols.map((c4) => c4.name), + rows: mdb.rows } - } - return result; -}; -var formatDistance_default = formatDistance; - -// node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js -function buildFormatLongFn(args) { - return function() { - var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - var width = options.width ? String(options.width) : args.defaultWidth; - var format2 = args.formats[width] || args.formats[args.defaultWidth]; - return format2; }; -} - -// node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js -var dateFormats = { - full: "EEEE, MMMM do, y", - long: "MMMM do, y", - medium: "MMM d, y", - short: "MM/dd/yyyy" -}; -var timeFormats = { - full: "h:mm:ss a zzzz", - long: "h:mm:ss a z", - medium: "h:mm:ss a", - short: "h:mm a" + db.close(); + return saveDBToPath(plugin, context.dbPath, tables); }; -var dateTimeFormats = { - full: "{{date}} 'at' {{time}}", - long: "{{date}} 'at' {{time}}", - medium: "{{date}}, {{time}}", - short: "{{date}}, {{time}}" +var optionValuesForColumn = (column, table) => { + var _a2; + return uniq( + (_a2 = table == null ? void 0 : table.rows.reduce((p3, c4) => { + return [...p3, ...parseMultiString(c4[column])]; + }, [])) != null ? _a2 : [] + ); }; -var formatLong = { - date: buildFormatLongFn({ - formats: dateFormats, - defaultWidth: "full" - }), - time: buildFormatLongFn({ - formats: timeFormats, - defaultWidth: "full" - }), - dateTime: buildFormatLongFn({ - formats: dateTimeFormats, - defaultWidth: "full" - }) +var defaultTableDataForContext = (plugin, contextInfo) => { + var _a2, _b2; + let files; + if (contextInfo.type == "folder") { + files = folderChildren( + plugin, + getAbstractFileAtPath( + plugin.app, + contextInfo.contextPath + ) + ); + return { + ...defaultMDBTableForContext(contextInfo), + rows: files.map((f4) => ({ File: f4.path })) + }; + } else if (contextInfo.type == "tag") { + files = getAllFilesForTag(contextInfo.contextPath).map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4); + return { + ...defaultMDBTableForContext(contextInfo), + rows: files.map((f4) => ({ File: f4.path })) + }; + } else if (contextInfo.type == "space") { + files = [ + ...(_b2 = (_a2 = plugin.index.spacesMap) == null ? void 0 : _a2.getInverse( + contextInfo.contextPath.substring( + 0, + contextInfo.contextPath.length - 2 + ) + )) != null ? _b2 : [] + ].map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4); + return { + ...defaultMDBTableForContext(contextInfo), + rows: files.map((f4) => ({ File: f4.path })) + }; + } + return null; }; -var formatLong_default = formatLong; - -// node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js -var formatRelativeLocale = { - lastWeek: "'last' eeee 'at' p", - yesterday: "'yesterday at' p", - today: "'today at' p", - tomorrow: "'tomorrow at' p", - nextWeek: "eeee 'at' p", - other: "P" -}; -var formatRelative = function formatRelative2(token, _date, _baseDate, _options) { - return formatRelativeLocale[token]; -}; -var formatRelative_default = formatRelative; - -// node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js -function buildLocalizeFn(args) { - return function(dirtyIndex, options) { - var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone"; - var valuesArray; - if (context === "formatting" && args.formattingValues) { - var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; - var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; - valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; - } else { - var _defaultWidth = args.defaultWidth; - var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; - valuesArray = args.values[_width] || args.values[_defaultWidth]; +var createDefaultDB = async (plugin, context) => { + var _a2; + const table = defaultTableDataForContext(plugin, context); + if (table) { + const defaultFields = defaultFieldsForContext(context); + const defaultTable = defaultTablesForContext(context); + const dbField = { + ...defaultTable, + m_fields: { + uniques: defaultFields.uniques, + cols: defaultFields.cols, + rows: [...(_a2 = defaultFields.rows) != null ? _a2 : [], ...table.cols] + }, + [table.schema.id]: { + uniques: table.cols.filter((c4) => c4.unique == "true").map((c4) => c4.name), + cols: table.cols.map((c4) => c4.name), + rows: table.rows + } + }; + const result = await saveDBToPath(plugin, context.dbPath, dbField); + if (result) { + await plugin.index.reloadContext(context); + table.rows.map((f4) => getAbstractFileAtPath(app, f4.File)).forEach((f4) => f4 && plugin.index.reloadFile(f4, true)); + return true; } - var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; - return valuesArray[index]; - }; -} - -// node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js -var eraValues = { - narrow: ["B", "A"], - abbreviated: ["BC", "AD"], - wide: ["Before Christ", "Anno Domini"] -}; -var quarterValues = { - narrow: ["1", "2", "3", "4"], - abbreviated: ["Q1", "Q2", "Q3", "Q4"], - wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] + return false; + } + return false; }; -var monthValues = { - narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], - abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] +var sanitizeTableSchema = async (plugin, db, context) => { + const sqlJS = await plugin.sqlJS(); + const tableRes = db.exec( + `SELECT name FROM sqlite_master WHERE type='table';` + ); + if (!tableRes[0] || !tableRes[0].values.some((f4) => f4[0] == "m_schema") || !tableRes[0].values.some((f4) => f4[0] == "m_fields") || !tableRes[0].values.some((f4) => f4[0] == "files")) { + await createDefaultDB(plugin, context); + } }; -var dayValues = { - narrow: ["S", "M", "T", "W", "T", "F", "S"], - short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], - abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] +var createNewRow = (mdb, row, index) => { + if (index) { + return { + ...mdb, + rows: insert(mdb.rows, index, row) + }; + } + return { + ...mdb, + rows: [...mdb.rows, row] + }; }; -var dayPeriodValues = { - narrow: { - am: "a", - pm: "p", - midnight: "mi", - noon: "n", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" - }, - abbreviated: { - am: "AM", - pm: "PM", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" - }, - wide: { - am: "a.m.", - pm: "p.m.", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" +var deleteTagContext = async (plugin, tag) => { + const context = tagContextFromTag(plugin, tag); + if (getAbstractFileAtPath(app, context.dbPath)) { + await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); } + app.workspace.iterateLeaves((leaf) => { + if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == tag) { + leaf.setViewState({ type: "empty" }); + } + }, app.workspace["rootSplit"]); + plugin.index.deleteTag(tag); }; -var formattingDayPeriodValues = { - narrow: { - am: "a", - pm: "p", - midnight: "mi", - noon: "n", - morning: "in the morning", - afternoon: "in the afternoon", - evening: "in the evening", - night: "at night" - }, - abbreviated: { - am: "AM", - pm: "PM", - midnight: "midnight", - noon: "noon", - morning: "in the morning", - afternoon: "in the afternoon", - evening: "in the evening", - night: "at night" - }, - wide: { - am: "a.m.", - pm: "p.m.", - midnight: "midnight", - noon: "noon", - morning: "in the morning", - afternoon: "in the afternoon", - evening: "in the evening", - night: "at night" +var deleteSpaceContext = async (plugin, space) => { + const context = spaceContextFromSpace(plugin, spaceContextPathFromName(space)); + if (getAbstractFileAtPath(app, context.dbPath)) { + await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); } + app.workspace.iterateLeaves((leaf) => { + if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == context.contextPath) { + leaf.setViewState({ type: "empty" }); + } + }, app.workspace["rootSplit"]); }; -var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) { - var number = Number(dirtyNumber); - var rem100 = number % 100; - if (rem100 > 20 || rem100 < 10) { - switch (rem100 % 10) { - case 1: - return number + "st"; - case 2: - return number + "nd"; - case 3: - return number + "rd"; +var connectContext = async (plugin, tag, source) => { +}; +var renameSpaceContextFile = async (plugin, space, newSpace) => { + const context = spaceContextFromSpace(plugin, spaceContextPathFromName(space)); + if (getAbstractFileAtPath(app, context.dbPath)) { + const newSpaceDBPath = newSpace + ".mdb"; + if (!getAbstractFileAtPath( + app, + getAbstractFileAtPath(app, context.dbPath).parent.path + "/" + newSpaceDBPath + )) { + await renameFile( + plugin, + getAbstractFileAtPath(app, context.dbPath), + newSpaceDBPath + ); + } else { + await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); } } - return number + "th"; -}; -var localize = { - ordinalNumber, - era: buildLocalizeFn({ - values: eraValues, - defaultWidth: "wide" - }), - quarter: buildLocalizeFn({ - values: quarterValues, - defaultWidth: "wide", - argumentCallback: function argumentCallback(quarter) { - return quarter - 1; + app.workspace.iterateLeaves((leaf) => { + if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == context.contextPath) { + leaf.setViewState({ + type: CONTEXT_VIEW_TYPE, + state: { contextPath: spaceContextPathFromName(newSpace) } + }); } - }), - month: buildLocalizeFn({ - values: monthValues, - defaultWidth: "wide" - }), - day: buildLocalizeFn({ - values: dayValues, - defaultWidth: "wide" - }), - dayPeriod: buildLocalizeFn({ - values: dayPeriodValues, - defaultWidth: "wide", - formattingValues: formattingDayPeriodValues, - defaultFormattingWidth: "wide" - }) + }, app.workspace["rootSplit"]); }; -var localize_default = localize; - -// node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js -function buildMatchFn(args) { - return function(string) { - 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 = string.match(matchPattern); - if (!matchResult) { - return null; - } - var matchedString = matchResult[0]; - var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; - 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(key2) : key2; - value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); - return { - value, - rest - }; - }; -} -function findKey(object, predicate) { - for (var key2 in object) { - if (object.hasOwnProperty(key2) && predicate(object[key2])) { - return key2; +var renameTagContextFile = async (plugin, tag, newTag) => { + const context = tagContextFromTag(plugin, tag); + if (getAbstractFileAtPath(app, context.dbPath)) { + const newTagDBPath = tagToTagPath(newTag) + ".mdb"; + if (!getAbstractFileAtPath( + app, + getAbstractFileAtPath(app, context.dbPath).parent.path + "/" + tagToTagPath(newTag) + ".mdb" + )) { + await renameFile( + plugin, + getAbstractFileAtPath(app, context.dbPath), + tagToTagPath(newTag) + ".mdb" + ); + } else { + await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); } } - return void 0; -} -function findIndex(array, predicate) { - for (var key2 = 0; key2 < array.length; key2++) { - if (predicate(array[key2])) { - return key2; + plugin.index.renameTag(tag, newTag); + app.workspace.iterateLeaves((leaf) => { + if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == tag) { + leaf.setViewState({ + type: CONTEXT_VIEW_TYPE, + state: { contextPath: newTag } + }); } - } - return void 0; -} - -// node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js -function buildMatchPatternFn(args) { - return function(string) { - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var matchResult = string.match(args.matchPattern); - if (!matchResult) - return null; - var matchedString = matchResult[0]; - var parseResult = string.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 = string.slice(matchedString.length); - return { - value, - rest - }; - }; -} + }, app.workspace["rootSplit"]); +}; -// node_modules/date-fns/esm/locale/en-US/_lib/match/index.js -var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; -var parseOrdinalNumberPattern = /\d+/i; -var matchEraPatterns = { - narrow: /^(b|a)/i, - abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, - wide: /^(before christ|before common era|anno domini|common era)/i +// src/utils/contexts/predicate/filterFns/filterFnTypes.ts +var filterFnTypes = { + isNotEmpty: { + type: ["text", "file", "link", "link-multi", "fileprop", "image"], + fn: (v3, f4) => !empty(v3, ""), + valueType: "none" + }, + isEmpty: { + type: ["text", "file", "link", "link-multi", "fileprop", "image"], + fn: (v3, f4) => empty(v3, ""), + valueType: "none" + }, + include: { + fn: (v3, f4) => stringCompare(v3, f4), + type: ["text", "file", "link", "link-multi", "fileprop", "image"], + valueType: "text" + }, + notInclude: { + type: ["text", "file", "link", "link-multi", "fileprop", "image"], + fn: (v3, f4) => !stringCompare(v3, f4), + valueType: "text" + }, + is: { + type: ["text", "file", "link", "context", "fileprop"], + fn: stringEqual, + valueType: "text" + }, + isNot: { + type: ["text", "file", "link", "context", "fileprop"], + fn: (v3, f4) => !stringEqual(v3, f4), + valueType: "text" + }, + equal: { + type: ["number"], + fn: stringEqual, + valueType: "number" + }, + isGreatThan: { + type: ["number"], + fn: greaterThan, + valueType: "number" + }, + isLessThan: { + type: ["number"], + fn: lessThan, + valueType: "number" + }, + isLessThanOrEqual: { + type: ["number"], + fn: (v3, f4) => !greaterThan(v3, f4), + valueType: "number" + }, + isGreatThanOrEqual: { + type: ["number"], + fn: (v3, f4) => !lessThan(v3, f4), + valueType: "number" + }, + dateBefore: { + type: ["date", "fileprop"], + fn: lessThan, + valueType: "date" + }, + dateAfter: { + type: ["date", "fileprop"], + fn: greaterThan, + valueType: "date" + }, + isAnyInList: { + type: ["option", "context", "option-multi", "context-multi", "tags-multi", "tags"], + fn: listIncludes, + valueType: "list" + }, + isNoneInList: { + type: ["option", "context", "option-multi", "context-multi", "tags-multi", "tags"], + fn: (v3, f4) => !listIncludes(v3, f4), + valueType: "list" + }, + isTrue: { + type: ["boolean"], + fn: (v3, f4) => v3 == "true", + valueType: "none" + }, + isFalse: { + type: ["boolean"], + fn: (v3, f4) => v3 != "true", + valueType: "none" + } }; -var parseEraPatterns = { - any: [/^b/i, /^(a|c)/i] + +// src/utils/contexts/predicate/filter.ts +var stringEqual = (value, filterValue) => { + return value == filterValue; }; -var matchQuarterPatterns = { - narrow: /^[1234]/i, - abbreviated: /^q[1234]/i, - wide: /^[1234](th|st|nd|rd)? quarter/i +var empty = (value, filterValue) => { + return (value != null ? value : "").length == 0; }; -var parseQuarterPatterns = { - any: [/1/i, /2/i, /3/i, /4/i] +var stringCompare = (value, filterValue) => { + return (value != null ? value : "").toLowerCase().includes((filterValue != null ? filterValue : "").toLowerCase()); }; -var matchMonthPatterns = { - narrow: /^[jfmasond]/i, - abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, - wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i +var greaterThan = (value, filterValue) => { + return parseFloat(value) > parseFloat(filterValue); }; -var parseMonthPatterns = { - narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], - any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i] +var lessThan = (value, filterValue) => { + return parseInt(value) > parseInt(filterValue); }; -var matchDayPatterns = { - narrow: /^[smtwf]/i, - short: /^(su|mo|tu|we|th|fr|sa)/i, - abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, - wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i +var listIncludes = (value, filterValue) => { + const valueList = value ? parseMultiString(value) : []; + const strings = filterValue ? parseMultiString(filterValue) : []; + return strings.some((f4) => valueList.some((g4) => g4 == f4)); }; -var parseDayPatterns = { - narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], - any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] +var filterReturnForCol = (col, filter, row) => { + if (!col) + return true; + const filterType = filterFnTypes[filter == null ? void 0 : filter.fn]; + let result = true; + if (filterType && filterType.fn) { + result = filterType.fn(row[filter.field], filter.value); + } + return result; }; -var matchDayPeriodPatterns = { - narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, - any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i + +// src/utils/contexts/predicate/sort.ts +var simpleSort = (a5, b4) => { + if (a5 < b4) + return -1; + if (a5 > b4) + return 1; + return 0; }; -var parseDayPeriodPatterns = { - any: { - am: /^a/i, - pm: /^p/i, - midnight: /^mi/i, - noon: /^no/i, - morning: /morning/i, - afternoon: /afternoon/i, - evening: /evening/i, - night: /night/i - } +var stringSort = (value, filterValue) => simpleSort(value, filterValue); +var numSort = (value, filterValue) => simpleSort(parseFloat(value), parseFloat(filterValue)); +var boolSort = (value, filterValue) => simpleSort(value == "true" ? 1 : 0, filterValue == "true" ? 1 : 0); +var countSort = (value, filterValue) => simpleSort(parseMultiString(value).length, parseMultiString(filterValue).length); +var normalizedSortForType = (type, desc) => { + return Object.keys(sortFnTypes).find( + (f4) => sortFnTypes[f4].type.some((g4) => g4 == type) && sortFnTypes[f4].desc == desc + ); }; -var match = { - ordinalNumber: buildMatchPatternFn({ - matchPattern: matchOrdinalNumberPattern, - parsePattern: parseOrdinalNumberPattern, - valueCallback: function valueCallback(value) { - return parseInt(value, 10); - } - }), - era: buildMatchFn({ - matchPatterns: matchEraPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseEraPatterns, - defaultParseWidth: "any" - }), - quarter: buildMatchFn({ - matchPatterns: matchQuarterPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseQuarterPatterns, - defaultParseWidth: "any", - valueCallback: function valueCallback2(index) { - return index + 1; - } - }), - month: buildMatchFn({ - matchPatterns: matchMonthPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseMonthPatterns, - defaultParseWidth: "any" - }), - day: buildMatchFn({ - matchPatterns: matchDayPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseDayPatterns, - defaultParseWidth: "any" - }), - dayPeriod: buildMatchFn({ - matchPatterns: matchDayPeriodPatterns, - defaultMatchWidth: "any", - parsePatterns: parseDayPeriodPatterns, - defaultParseWidth: "any" - }) +var sortFnTypes = { + alphabetical: { + type: ["text", "file", "link", "context", "fileprop"], + fn: stringSort, + label: i18n_default.sortTypes.alphaAsc, + desc: false + }, + reverseAlphabetical: { + type: ["text", "file", "link", "context", "fileprop"], + fn: (v3, f4) => stringSort(v3, f4) * -1, + label: i18n_default.sortTypes.alphaDesc, + desc: true + }, + earliest: { + type: ["date", "fileprop"], + fn: stringSort, + label: i18n_default.sortTypes.earliest, + desc: false + }, + latest: { + type: ["date", "fileprop"], + fn: (v3, f4) => stringSort(v3, f4) * -1, + label: i18n_default.sortTypes.latest, + desc: true + }, + boolean: { + type: ["boolean"], + fn: boolSort, + label: i18n_default.sortTypes.checkAsc, + desc: false + }, + booleanReverse: { + type: ["boolean"], + fn: (v3, f4) => boolSort(v3, f4) * -1, + label: i18n_default.sortTypes.checkDesc, + desc: true + }, + number: { + type: ["number", "fileprop"], + fn: numSort, + label: "1 \u2192 9", + desc: false + }, + reverseNumber: { + type: ["number", "fileprop"], + fn: (v3, f4) => numSort(v3, f4) * -1, + label: "9 \u2192 1", + desc: true + }, + count: { + type: ["option-multi", "context-multi", "link-multi"], + fn: countSort, + label: i18n_default.sortTypes.itemsDesc, + desc: true + }, + reverseCount: { + type: ["option-multi", "context-multi", "link-multi"], + fn: (v3, f4) => countSort(v3, f4) * -1, + label: i18n_default.sortTypes.itemsAsc, + desc: false + } }; -var match_default = match; - -// node_modules/date-fns/esm/locale/en-US/index.js -var locale = { - code: "en-US", - formatDistance: formatDistance_default, - formatLong: formatLong_default, - formatRelative: formatRelative_default, - localize: localize_default, - match: match_default, - options: { - weekStartsOn: 0, - firstWeekContainsDate: 1 +var sortReturnForCol = (col, sort, row, row2) => { + if (!col) + return 0; + const sortType = sortFnTypes[sort.fn]; + if (sortType) { + return sortType.fn(row[sort.field], row2[sort.field]); } + return 0; }; -var en_US_default = locale; - -// node_modules/date-fns/esm/_lib/defaultLocale/index.js -var defaultLocale_default = en_US_default; -// node_modules/date-fns/esm/format/index.js -var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; -var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; -var escapedStringRegExp = /^'([^]*?)'?$/; -var doubleQuoteRegExp = /''/g; -var unescapedLatinCharacterRegExp = /[a-zA-Z]/; -function format(dirtyDate, dirtyFormatStr, options) { - var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4; - requiredArgs(2, arguments); - var formatStr = String(dirtyFormatStr); - var defaultOptions3 = getDefaultOptions(); - var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default; - var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions3.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); - } - var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions3.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions3.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - if (!locale2.localize) { - throw new RangeError("locale must contain localize property"); - } - if (!locale2.formatLong) { - throw new RangeError("locale must contain formatLong property"); +// node_modules/date-fns/esm/_lib/toInteger/index.js +function toInteger(dirtyNumber) { + if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { + return NaN; } - var originalDate = toDate(dirtyDate); - if (!isValid(originalDate)) { - throw new RangeError("Invalid time value"); + var number = Number(dirtyNumber); + if (isNaN(number)) { + return number; } - var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate); - var utcDate = subMilliseconds(originalDate, timezoneOffset); - var formatterOptions = { - firstWeekContainsDate, - weekStartsOn, - locale: locale2, - _originalDate: originalDate - }; - var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) { - var firstCharacter = substring[0]; - if (firstCharacter === "p" || firstCharacter === "P") { - var longFormatter = longFormatters_default[firstCharacter]; - return longFormatter(substring, locale2.formatLong); - } - return substring; - }).join("").match(formattingTokensRegExp).map(function(substring) { - if (substring === "''") { - return "'"; - } - var firstCharacter = substring[0]; - if (firstCharacter === "'") { - return cleanEscapedString(substring); - } - var formatter = formatters_default[firstCharacter]; - if (formatter) { - if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) { - throwProtectedError(substring, dirtyFormatStr, String(dirtyDate)); - } - if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) { - throwProtectedError(substring, dirtyFormatStr, String(dirtyDate)); - } - return formatter(utcDate, substring, locale2.localize, formatterOptions); - } - if (firstCharacter.match(unescapedLatinCharacterRegExp)) { - throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"); - } - return substring; - }).join(""); - return result; + return number < 0 ? Math.ceil(number) : Math.floor(number); } -function cleanEscapedString(input) { - var matched = input.match(escapedStringRegExp); - if (!matched) { - return input; + +// node_modules/date-fns/esm/_lib/requiredArgs/index.js +function requiredArgs(required, args) { + if (args.length < required) { + throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present"); } - return matched[1].replace(doubleQuoteRegExp, "'"); } -// node_modules/date-fns/esm/_lib/assign/index.js -function assign(target, object) { - if (target == null) { - throw new TypeError("assign requires that input parameter not be null or undefined"); +// node_modules/date-fns/esm/toDate/index.js +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof5(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof5(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; } - for (var property in object) { - if (Object.prototype.hasOwnProperty.call(object, property)) { - ; - target[property] = object[property]; + return _typeof(obj); +} +function toDate(argument) { + requiredArgs(1, arguments); + var argStr = Object.prototype.toString.call(argument); + if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") { + return new Date(argument.getTime()); + } else if (typeof argument === "number" || argStr === "[object Number]") { + return new Date(argument); + } else { + if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") { + console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); + console.warn(new Error().stack); } + return new Date(NaN); } - return target; -} - -// node_modules/date-fns/esm/_lib/cloneObject/index.js -function cloneObject(object) { - return assign({}, object); } -// node_modules/date-fns/esm/formatDistance/index.js -var MINUTES_IN_DAY = 1440; -var MINUTES_IN_ALMOST_TWO_DAYS = 2520; -var MINUTES_IN_MONTH = 43200; -var MINUTES_IN_TWO_MONTHS = 86400; -function formatDistance3(dirtyDate, dirtyBaseDate, options) { - var _ref, _options$locale; +// node_modules/date-fns/esm/addDays/index.js +function addDays(dirtyDate, dirtyAmount) { requiredArgs(2, arguments); - var defaultOptions3 = getDefaultOptions(); - var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default; - if (!locale2.formatDistance) { - throw new RangeError("locale must contain formatDistance property"); + var date = toDate(dirtyDate); + var amount = toInteger(dirtyAmount); + if (isNaN(amount)) { + return new Date(NaN); } - var comparison = compareAsc(dirtyDate, dirtyBaseDate); - if (isNaN(comparison)) { - throw new RangeError("Invalid time value"); + if (!amount) { + return date; } - var localizeOptions = assign(cloneObject(options), { - addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix), - comparison - }); - var dateLeft; - var dateRight; - if (comparison > 0) { - dateLeft = toDate(dirtyBaseDate); - dateRight = toDate(dirtyDate); - } else { - dateLeft = toDate(dirtyDate); - dateRight = toDate(dirtyBaseDate); + date.setDate(date.getDate() + amount); + return date; +} + +// node_modules/date-fns/esm/addMonths/index.js +function addMonths(dirtyDate, dirtyAmount) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var amount = toInteger(dirtyAmount); + if (isNaN(amount)) { + return new Date(NaN); } - var seconds = differenceInSeconds(dateRight, dateLeft); - var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3; - var minutes = Math.round((seconds - offsetInSeconds) / 60); - var months; - if (minutes < 2) { - if (options !== null && options !== void 0 && options.includeSeconds) { - if (seconds < 5) { - return locale2.formatDistance("lessThanXSeconds", 5, localizeOptions); - } else if (seconds < 10) { - return locale2.formatDistance("lessThanXSeconds", 10, localizeOptions); - } else if (seconds < 20) { - return locale2.formatDistance("lessThanXSeconds", 20, localizeOptions); - } else if (seconds < 40) { - return locale2.formatDistance("halfAMinute", 0, localizeOptions); - } else if (seconds < 60) { - return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions); - } else { - return locale2.formatDistance("xMinutes", 1, localizeOptions); - } - } else { - if (minutes === 0) { - return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions); - } else { - return locale2.formatDistance("xMinutes", minutes, localizeOptions); - } - } - } else if (minutes < 45) { - return locale2.formatDistance("xMinutes", minutes, localizeOptions); - } else if (minutes < 90) { - return locale2.formatDistance("aboutXHours", 1, localizeOptions); - } else if (minutes < MINUTES_IN_DAY) { - var hours = Math.round(minutes / 60); - return locale2.formatDistance("aboutXHours", hours, localizeOptions); - } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) { - return locale2.formatDistance("xDays", 1, localizeOptions); - } else if (minutes < MINUTES_IN_MONTH) { - var days = Math.round(minutes / MINUTES_IN_DAY); - return locale2.formatDistance("xDays", days, localizeOptions); - } else if (minutes < MINUTES_IN_TWO_MONTHS) { - months = Math.round(minutes / MINUTES_IN_MONTH); - return locale2.formatDistance("aboutXMonths", months, localizeOptions); + if (!amount) { + return date; } - months = differenceInMonths(dateRight, dateLeft); - if (months < 12) { - var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH); - return locale2.formatDistance("xMonths", nearestMonth, localizeOptions); + var dayOfMonth = date.getDate(); + var endOfDesiredMonth = new Date(date.getTime()); + endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0); + var daysInMonth = endOfDesiredMonth.getDate(); + if (dayOfMonth >= daysInMonth) { + return endOfDesiredMonth; } else { - var monthsSinceStartOfYear = months % 12; - var years = Math.floor(months / 12); - if (monthsSinceStartOfYear < 3) { - return locale2.formatDistance("aboutXYears", years, localizeOptions); - } else if (monthsSinceStartOfYear < 9) { - return locale2.formatDistance("overXYears", years, localizeOptions); - } else { - return locale2.formatDistance("almostXYears", years + 1, localizeOptions); - } + date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth); + return date; } } -// node_modules/date-fns/esm/getDaysInMonth/index.js -function getDaysInMonth(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var year = date.getFullYear(); - var monthIndex = date.getMonth(); - var lastDayOfMonth2 = new Date(0); - lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0); - lastDayOfMonth2.setHours(0, 0, 0, 0); - return lastDayOfMonth2.getDate(); +// node_modules/date-fns/esm/addMilliseconds/index.js +function addMilliseconds(dirtyDate, dirtyAmount) { + requiredArgs(2, arguments); + var timestamp = toDate(dirtyDate).getTime(); + var amount = toInteger(dirtyAmount); + return new Date(timestamp + amount); } -// node_modules/date-fns/esm/getISOWeek/index.js -var MILLISECONDS_IN_WEEK4 = 6048e5; -function getISOWeek(dirtyDate) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var diff = startOfISOWeek(date).getTime() - startOfISOWeekYear(date).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK4) + 1; +// node_modules/date-fns/esm/_lib/defaultOptions/index.js +var defaultOptions = {}; +function getDefaultOptions() { + return defaultOptions; } -// node_modules/date-fns/esm/getTime/index.js -function getTime(dirtyDate) { +// node_modules/date-fns/esm/startOfWeek/index.js +function startOfWeek(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; requiredArgs(1, arguments); + var defaultOptions3 = getDefaultOptions(); + var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); + if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { + throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); + } var date = toDate(dirtyDate); - var timestamp = date.getTime(); - return timestamp; + var day = date.getDay(); + var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; + date.setDate(date.getDate() - diff); + date.setHours(0, 0, 0, 0); + return date; } -// node_modules/date-fns/esm/getUnixTime/index.js -function getUnixTime(dirtyDate) { +// node_modules/date-fns/esm/startOfISOWeek/index.js +function startOfISOWeek(dirtyDate) { requiredArgs(1, arguments); - return Math.floor(getTime(dirtyDate) / 1e3); + return startOfWeek(dirtyDate, { + weekStartsOn: 1 + }); } -// node_modules/date-fns/esm/getWeekYear/index.js -function getWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; +// node_modules/date-fns/esm/getISOWeekYear/index.js +function getISOWeekYear(dirtyDate) { requiredArgs(1, arguments); var date = toDate(dirtyDate); var year = date.getFullYear(); - var defaultOptions3 = getDefaultOptions(); - var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); - } - var firstWeekOfNextYear = new Date(0); - firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setHours(0, 0, 0, 0); - var startOfNextYear = startOfWeek(firstWeekOfNextYear, options); - var firstWeekOfThisYear = new Date(0); - firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setHours(0, 0, 0, 0); - var startOfThisYear = startOfWeek(firstWeekOfThisYear, options); + var fourthOfJanuaryOfNextYear = new Date(0); + fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); + fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); + var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); + var fourthOfJanuaryOfThisYear = new Date(0); + fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); + fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); + var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); if (date.getTime() >= startOfNextYear.getTime()) { return year + 1; } else if (date.getTime() >= startOfThisYear.getTime()) { @@ -16357,21847 +15734,20682 @@ function getWeekYear(dirtyDate, options) { } } -// node_modules/date-fns/esm/startOfWeekYear/index.js -function startOfWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; +// node_modules/date-fns/esm/startOfISOWeekYear/index.js +function startOfISOWeekYear(dirtyDate) { requiredArgs(1, arguments); - var defaultOptions3 = getDefaultOptions(); - var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - var year = getWeekYear(dirtyDate, options); - var firstWeek = new Date(0); - firstWeek.setFullYear(year, 0, firstWeekContainsDate); - firstWeek.setHours(0, 0, 0, 0); - var date = startOfWeek(firstWeek, options); + var year = getISOWeekYear(dirtyDate); + var fourthOfJanuary = new Date(0); + fourthOfJanuary.setFullYear(year, 0, 4); + fourthOfJanuary.setHours(0, 0, 0, 0); + var date = startOfISOWeek(fourthOfJanuary); return date; } -// node_modules/date-fns/esm/getWeek/index.js -var MILLISECONDS_IN_WEEK5 = 6048e5; -function getWeek(dirtyDate, options) { - requiredArgs(1, arguments); - var date = toDate(dirtyDate); - var diff = startOfWeek(date, options).getTime() - startOfWeekYear(date, options).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK5) + 1; +// node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +function getTimezoneOffsetInMilliseconds(date) { + var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds())); + utcDate.setUTCFullYear(date.getFullYear()); + return date.getTime() - utcDate.getTime(); } -// node_modules/date-fns/esm/lastDayOfMonth/index.js -function lastDayOfMonth(dirtyDate) { +// node_modules/date-fns/esm/startOfDay/index.js +function startOfDay(dirtyDate) { requiredArgs(1, arguments); var date = toDate(dirtyDate); - var month = date.getMonth(); - date.setFullYear(date.getFullYear(), month + 1, 0); date.setHours(0, 0, 0, 0); return date; } -// node_modules/date-fns/esm/getWeeksInMonth/index.js -function getWeeksInMonth(date, options) { - requiredArgs(1, arguments); - return differenceInCalendarWeeks(lastDayOfMonth(date), startOfMonth(date), options) + 1; -} - -// node_modules/date-fns/esm/isAfter/index.js -function isAfter(dirtyDate, dirtyDateToCompare) { - requiredArgs(2, arguments); - var date = toDate(dirtyDate); - var dateToCompare = toDate(dirtyDateToCompare); - return date.getTime() > dateToCompare.getTime(); -} - -// node_modules/date-fns/esm/isBefore/index.js -function isBefore(dirtyDate, dirtyDateToCompare) { - requiredArgs(2, arguments); - var date = toDate(dirtyDate); - var dateToCompare = toDate(dirtyDateToCompare); - return date.getTime() < dateToCompare.getTime(); -} - -// node_modules/date-fns/esm/isSameMonth/index.js -function isSameMonth(dirtyDateLeft, dirtyDateRight) { +// node_modules/date-fns/esm/differenceInCalendarDays/index.js +var MILLISECONDS_IN_DAY = 864e5; +function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) { requiredArgs(2, arguments); - var dateLeft = toDate(dirtyDateLeft); - var dateRight = toDate(dirtyDateRight); - return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth(); + var startOfDayLeft = startOfDay(dirtyDateLeft); + var startOfDayRight = startOfDay(dirtyDateRight); + var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft); + var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight); + return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY); } -// node_modules/date-fns/esm/isSameYear/index.js -function isSameYear(dirtyDateLeft, dirtyDateRight) { +// node_modules/date-fns/esm/addWeeks/index.js +function addWeeks(dirtyDate, dirtyAmount) { requiredArgs(2, arguments); - var dateLeft = toDate(dirtyDateLeft); - var dateRight = toDate(dirtyDateRight); - return dateLeft.getFullYear() === dateRight.getFullYear(); + var amount = toInteger(dirtyAmount); + var days = amount * 7; + return addDays(dirtyDate, days); } -// node_modules/date-fns/esm/subDays/index.js -function subDays(dirtyDate, dirtyAmount) { +// node_modules/date-fns/esm/addYears/index.js +function addYears(dirtyDate, dirtyAmount) { requiredArgs(2, arguments); var amount = toInteger(dirtyAmount); - return addDays(dirtyDate, -amount); + return addMonths(dirtyDate, amount * 12); } -// node_modules/date-fns/esm/setMonth/index.js -function setMonth(dirtyDate, dirtyMonth) { - requiredArgs(2, arguments); - var date = toDate(dirtyDate); - var month = toInteger(dirtyMonth); - var year = date.getFullYear(); - var day = date.getDate(); - var dateWithDesiredMonth = new Date(0); - dateWithDesiredMonth.setFullYear(year, month, 15); - dateWithDesiredMonth.setHours(0, 0, 0, 0); - var daysInMonth = getDaysInMonth(dateWithDesiredMonth); - date.setMonth(month, Math.min(day, daysInMonth)); - return date; +// node_modules/date-fns/esm/max/index.js +function _typeof2(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof2 = function _typeof5(obj2) { + return typeof obj2; + }; + } else { + _typeof2 = function _typeof5(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof2(obj); } - -// node_modules/date-fns/esm/setYear/index.js -function setYear(dirtyDate, dirtyYear) { - requiredArgs(2, arguments); - var date = toDate(dirtyDate); - var year = toInteger(dirtyYear); - if (isNaN(date.getTime())) { +function max(dirtyDatesArray) { + requiredArgs(1, arguments); + var datesArray; + if (dirtyDatesArray && typeof dirtyDatesArray.forEach === "function") { + datesArray = dirtyDatesArray; + } else if (_typeof2(dirtyDatesArray) === "object" && dirtyDatesArray !== null) { + datesArray = Array.prototype.slice.call(dirtyDatesArray); + } else { return new Date(NaN); } - date.setFullYear(year); - return date; + var result; + datesArray.forEach(function(dirtyDate) { + var currentDate = toDate(dirtyDate); + if (result === void 0 || result < currentDate || isNaN(Number(currentDate))) { + result = currentDate; + } + }); + return result || new Date(NaN); } -// src/utils/metadata/frontmatter/fm.ts -var import_lodash = __toESM(require_lodash()); -var import_obsidian3 = require("obsidian"); - -// src/utils/array.ts -var insert = (arr, index, newItem) => index <= 0 ? [ - newItem, - ...arr -] : [ - ...arr.slice(0, index), - newItem, - ...arr.slice(index) -]; -var uniq = (a5) => [...new Set(a5)]; -var uniqCaseInsensitive = (a5) => [ - ...new Map(a5.map((s5) => [s5.toLowerCase(), s5])).values() -]; -var uniqueNameFromString = (name, cols) => { - let newName = name; - if (cols.includes(newName)) { - let append = 1; - while (cols.includes(newName)) { - newName = name + append.toString(); - append += 1; - } +// node_modules/date-fns/esm/min/index.js +function _typeof3(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof3 = function _typeof5(obj2) { + return typeof obj2; + }; + } else { + _typeof3 = function _typeof5(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; } - return newName; -}; -var onlyUniqueProp = (prop) => (value, index, self2) => { - return self2.findIndex((v3) => value[prop] == v3[prop]) === index; -}; -var onlyUniquePropCaseInsensitive = (prop) => (value, index, self2) => { - return self2.findIndex( - (v3) => value[prop].toLowerCase() == v3[prop].toLowerCase() - ) === index; -}; - -// src/utils/json.ts -var safelyParseJSON = (json) => { - var parsed; - try { - parsed = JSON.parse(json); - } catch (e4) { + return _typeof3(obj); +} +function min(dirtyDatesArray) { + requiredArgs(1, arguments); + var datesArray; + if (dirtyDatesArray && typeof dirtyDatesArray.forEach === "function") { + datesArray = dirtyDatesArray; + } else if (_typeof3(dirtyDatesArray) === "object" && dirtyDatesArray !== null) { + datesArray = Array.prototype.slice.call(dirtyDatesArray); + } else { + return new Date(NaN); } - return parsed; -}; + var result; + datesArray.forEach(function(dirtyDate) { + var currentDate = toDate(dirtyDate); + if (result === void 0 || result > currentDate || isNaN(currentDate.getDate())) { + result = currentDate; + } + }); + return result || new Date(NaN); +} -// src/utils/parser.tsx -var parseSortStrat = (str) => { - const [a5, b4] = str.split("_"); - return [a5, b4 == "asc"]; -}; -var parseMultiString = (str) => { - var _a2; - return (_a2 = str == null ? void 0 : str.match(/(\\.|[^,])+/g)) != null ? _a2 : []; -}; -var parseLinkString = (string) => { - if (!string) - return ""; - const match2 = /\[\[(.*?)\]\]/g.exec(string); - const stringValue = (match2 == null ? void 0 : match2.length) > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string; - if (stringValue) - return stringValue; - return string; -}; -var parseLinkDisplayString = (string) => { - return filePathToString(parseLinkString(string)); -}; -var parseContextDefString = (str) => { - var _a2; - if (!str || str.length == 0) - return []; - if (str.charAt(0) == "#") { - return str.split("&").map((f4) => ({ - type: "tag", - value: f4 - })); +// node_modules/date-fns/esm/compareAsc/index.js +function compareAsc(dirtyDateLeft, dirtyDateRight) { + requiredArgs(2, arguments); + var dateLeft = toDate(dirtyDateLeft); + var dateRight = toDate(dirtyDateRight); + var diff = dateLeft.getTime() - dateRight.getTime(); + if (diff < 0) { + return -1; + } else if (diff > 0) { + return 1; + } else { + return diff; } - return (_a2 = safelyParseJSON(str)) != null ? _a2 : []; -}; -var parseSpace = (spaceRow) => { - return { - ...spaceRow, - def: parseSpaceDefString(spaceRow.def) - }; -}; -var parseSpaceDefString = (str) => { - var _a2; - if (!str || str.length == 0) - return { type: "focus", folder: "", filters: [] }; - if (str.charAt(0) != "{") { - return { - folder: str, - type: "focus", - filters: [ - { - type: "any", - trueFalse: true, - filters: [ - { - type: "filemeta", - fType: "string", - field: "folder", - fn: "equals", - value: str - } - ] - } - ] +} + +// node_modules/date-fns/esm/isSameDay/index.js +function isSameDay(dirtyDateLeft, dirtyDateRight) { + requiredArgs(2, arguments); + var dateLeftStartOfDay = startOfDay(dirtyDateLeft); + var dateRightStartOfDay = startOfDay(dirtyDateRight); + return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime(); +} + +// node_modules/date-fns/esm/isDate/index.js +function _typeof4(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof4 = function _typeof5(obj2) { + return typeof obj2; + }; + } else { + _typeof4 = function _typeof5(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }; } - return (_a2 = safelyParseJSON(str)) != null ? _a2 : []; -}; + return _typeof4(obj); +} +function isDate(value) { + requiredArgs(1, arguments); + return value instanceof Date || _typeof4(value) === "object" && Object.prototype.toString.call(value) === "[object Date]"; +} -// src/utils/metadata/dv.ts -var import_obsidian2 = require("obsidian"); +// node_modules/date-fns/esm/isValid/index.js +function isValid(dirtyDate) { + requiredArgs(1, arguments); + if (!isDate(dirtyDate) && typeof dirtyDate !== "number") { + return false; + } + var date = toDate(dirtyDate); + return !isNaN(Number(date)); +} -// src/utils/serializer.ts -var serializeSpace = (space) => ({ ...space, def: JSON.stringify(space.def) }); -var serializeMultiString = (value) => value.join(","); -var serializeMultiDisplayString = (value) => value.join(", "); -var serializeSQLValues = (value) => value.join(", "); -var serializeSQLStatements = (value) => value.join("; "); -var serializeSQLFieldNames = (value) => value.join(","); +// node_modules/date-fns/esm/differenceInCalendarMonths/index.js +function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) { + requiredArgs(2, arguments); + var dateLeft = toDate(dirtyDateLeft); + var dateRight = toDate(dirtyDateRight); + var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear(); + var monthDiff = dateLeft.getMonth() - dateRight.getMonth(); + return yearDiff * 12 + monthDiff; +} -// src/utils/metadata/dv.ts -var LocationWrapper = { - fullLine: { start: "", end: "" }, - brackets: { start: "[", end: "]" }, - parenthesis: { start: "(", end: ")" } -}; -var fieldComponents = [ - "inQuote", - "inList", - "startStyle", - "attribute", - "endStyle", - "beforeSeparatorSpacer", - "afterSeparatorSpacer", - "values" -]; -var genericFieldRegex = "(?>(\\s+)?)?(?- )?(?[_\\*~`]*)(?[0-9\\w\\p{Letter}\\p{Emoji_Presentation}][-0-9\\w\\p{Letter}\\p{Emoji_Presentation}\\s]*)(?[_\\*~`]*)(?\\s*)"; -var inlineFieldRegex = (attribute) => `(?>(\\s+)?)?(?- )?(?[_\\*~\`]*)(?${attribute})(?[_\\*~\`]*)(?\\s*)::(?\\s*)`; -var fullLineRegex = new RegExp( - `^${genericFieldRegex}::\\s*(?.*)?`, - "u" -); -var inSentenceRegexBrackets = new RegExp( - `\\[${genericFieldRegex}::\\s*(?[^\\]]+)?\\]`, - "gu" -); -var inSentenceRegexPar = new RegExp( - `\\(${genericFieldRegex}::\\s*(?[^\\)]+)?\\)`, - "gu" -); -var encodeLink = (value) => { - return value ? value.replace(/\[\[/g, "\u{1F54C}\u{1F527}").replace(/\]\]/g, "\u{1F413}\u{1F400}") : value; -}; -var decodeLink = (value) => { - return value ? value.replace(/🕌🔧/gu, "[[").replace(/🐓🐀/gu, "]]") : value; -}; -var matchInlineFields = (regex, line, attribute, input, location = "fullLine") => { - const sR = line.matchAll(regex); - let next = sR.next(); - const newFields = []; - while (!next.done) { - const match2 = next.value; - if (match2.groups && Object.keys(match2.groups).every((j4) => fieldComponents.includes(j4))) { - const { - inList, - inQuote, - startStyle, - endStyle, - beforeSeparatorSpacer, - afterSeparatorSpacer, - values - } = match2.groups; - const inputArray = input ? input.replace(/(\,\s+)/g, ",").split(",") : [""]; - const newValue = inputArray.length == 1 ? inputArray[0] : `${serializeMultiDisplayString(inputArray)}`; - const start = LocationWrapper[location].start; - const end = LocationWrapper[location].end; - newFields.push({ - oldField: match2[0], - newField: `${inQuote || ""}${start}${inList || ""}${startStyle}${attribute}${endStyle}${beforeSeparatorSpacer}::${afterSeparatorSpacer}${newValue}${end}` - }); - } - next = sR.next(); +// node_modules/date-fns/esm/differenceInCalendarWeeks/index.js +var MILLISECONDS_IN_WEEK = 6048e5; +function differenceInCalendarWeeks(dirtyDateLeft, dirtyDateRight, options) { + requiredArgs(2, arguments); + var startOfWeekLeft = startOfWeek(dirtyDateLeft, options); + var startOfWeekRight = startOfWeek(dirtyDateRight, options); + var timestampLeft = startOfWeekLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfWeekLeft); + var timestampRight = startOfWeekRight.getTime() - getTimezoneOffsetInMilliseconds(startOfWeekRight); + return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK); +} + +// node_modules/date-fns/esm/differenceInMilliseconds/index.js +function differenceInMilliseconds(dateLeft, dateRight) { + requiredArgs(2, arguments); + return toDate(dateLeft).getTime() - toDate(dateRight).getTime(); +} + +// node_modules/date-fns/esm/_lib/roundingMethods/index.js +var roundingMap = { + ceil: Math.ceil, + round: Math.round, + floor: Math.floor, + trunc: function trunc(value) { + return value < 0 ? Math.ceil(value) : Math.floor(value); } - return newFields; }; -async function replaceValues(plugin, fileOrFilePath, attribute, input, previousItemsCount = 0) { - var _a2, _b2; - let file; - if (fileOrFilePath instanceof import_obsidian2.TFile) { - file = fileOrFilePath; +var defaultRoundingMethod = "trunc"; +function getRoundingMethod(method) { + return method ? roundingMap[method] : roundingMap[defaultRoundingMethod]; +} + +// node_modules/date-fns/esm/endOfDay/index.js +function endOfDay(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + date.setHours(23, 59, 59, 999); + return date; +} + +// node_modules/date-fns/esm/endOfMonth/index.js +function endOfMonth(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var month = date.getMonth(); + date.setFullYear(date.getFullYear(), month + 1, 0); + date.setHours(23, 59, 59, 999); + return date; +} + +// node_modules/date-fns/esm/isLastDayOfMonth/index.js +function isLastDayOfMonth(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + return endOfDay(date).getTime() === endOfMonth(date).getTime(); +} + +// node_modules/date-fns/esm/differenceInMonths/index.js +function differenceInMonths(dirtyDateLeft, dirtyDateRight) { + requiredArgs(2, arguments); + var dateLeft = toDate(dirtyDateLeft); + var dateRight = toDate(dirtyDateRight); + var sign = compareAsc(dateLeft, dateRight); + var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight)); + var result; + if (difference < 1) { + result = 0; } else { - const _file = plugin.app.vault.getAbstractFileByPath(fileOrFilePath); - if (_file instanceof import_obsidian2.TFile && _file.extension == "md") { - file = _file; - } else { - throw Error("path doesn't correspond to a proper file"); + if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) { + dateLeft.setDate(30); } - } - const content = (await plugin.app.vault.read(file)).split("\n"); - const frontmatter = (_a2 = plugin.app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; - const skippedLines = []; - const { - position: { start, end } - } = frontmatter ? frontmatter : { position: { start: void 0, end: void 0 } }; - const newContent = content.map((line, i4) => { - const encodedInput = encodeLink(input); - let encodedLine = encodeLink(line); - const fullLineRegex2 = new RegExp( - `^${inlineFieldRegex(attribute)}(?[^\\]]*)`, - "u" - ); - const fR = encodedLine.match(fullLineRegex2); - if ((fR == null ? void 0 : fR.groups) && Object.keys(fR.groups).every((j4) => fieldComponents.includes(j4))) { - const { - inList, - inQuote, - startStyle, - endStyle, - beforeSeparatorSpacer, - afterSeparatorSpacer, - values - } = fR.groups; - const inputArray = input ? input.replace(/(\,\s+)/g, ",").split(",").sort() : []; - let newValue; - let hiddenValue = ""; - newValue = inputArray.length == 1 ? inputArray[0] : `${serializeMultiDisplayString(inputArray)}`; - return `${inQuote || ""}${inList || ""}${startStyle}${attribute}${endStyle}${beforeSeparatorSpacer}::${afterSeparatorSpacer}${hiddenValue + newValue}`; - } else { - const newFields = []; - const inSentenceRegexBrackets2 = new RegExp( - `\\[${inlineFieldRegex(attribute)}(?[^\\]]+)?\\]`, - "gu" - ); - const inSentenceRegexPar2 = new RegExp( - `\\(${inlineFieldRegex(attribute)}(?[^\\)]+)?\\)`, - "gu" - ); - newFields.push( - ...matchInlineFields( - inSentenceRegexBrackets2, - encodedLine, - attribute, - encodedInput, - "brackets" /* brackets */ - ) - ); - newFields.push( - ...matchInlineFields( - inSentenceRegexPar2, - encodedLine, - attribute, - encodedInput, - "parenthesis" /* parenthesis */ - ) - ); - newFields.forEach((field) => { - const fieldRegex = new RegExp( - field.oldField.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), - "u" - ); - encodedLine = encodedLine.replace(fieldRegex, field.newField); - }); - return decodeLink(encodedLine); + dateLeft.setMonth(dateLeft.getMonth() - sign * difference); + var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign; + if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) { + isLastMonthNotFull = false; } - }); - await plugin.app.vault.modify( - file, - newContent.filter((line, i4) => !skippedLines.includes(i4)).join("\n") - ); - const editor = (_b2 = plugin.app.workspace.getActiveViewOfType(import_obsidian2.MarkdownView)) == null ? void 0 : _b2.editor; - if (editor) { - const lineNumber = editor.getCursor().line; - editor.setCursor({ - line: editor.getCursor().line, - ch: editor.getLine(lineNumber).length - }); + result = sign * (difference - Number(isLastMonthNotFull)); } + return result === 0 ? 0 : result; } -// src/utils/metadata/frontmatter/detectYAMLType.ts -var detectYAMLType = (value, key2) => { - if (typeof value === "string") { - if (/\/\/(\S+?(?:jpe?g|png|gif|svg))/gi.test(value) || value.includes("unsplash")) { - return "image"; - } - if (/^\d{4}-\d{2}-\d{2}$/.test(value)) { - return "date"; - } - if (key2 == "tag" || key2 == "tags") { - return "tag"; - } - if (/\[\[.*?\]\]/.test(value)) { - return "link"; - } - } else if (typeof value === "number") { - return "number"; - } else if (typeof value === "boolean") { - return "boolean"; - } else if (!value) { - return "unknown"; - } else if (Array.isArray(value) || typeof value === "string" && value.indexOf(",") > -1) { - let arrayValue = Array.isArray(value) ? value : []; - if (typeof value === "string" && value.indexOf(",") > -1) { - arrayValue = parseMultiString(value); - } - if (key2 == "tag" || key2 == "tags") { - return "tag-multi"; - } - if (arrayValue.length == 1 && Array.isArray(arrayValue[0]) && arrayValue[0].length == 1 && typeof arrayValue[0][0] === "string") { - return "link"; - } - const types = uniq(arrayValue.map((f4) => detectYAMLType(f4, key2))); - if (types.length == 1 && types[0] == "link") { - return "link-multi"; - } - return "option-multi"; - } else if (value.isLuxonDateTime) { - return "date"; - } else if (value.isLuxonDuration) { - return "duration"; - } else if (value.type == "file") { - return "link"; - } else if (typeof value === "object" && !Array.isArray(value) && value !== null) { - return "object"; +// node_modules/date-fns/esm/differenceInSeconds/index.js +function differenceInSeconds(dateLeft, dateRight, options) { + requiredArgs(2, arguments); + var diff = differenceInMilliseconds(dateLeft, dateRight) / 1e3; + return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); +} + +// node_modules/date-fns/esm/startOfMonth/index.js +function startOfMonth(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + date.setDate(1); + date.setHours(0, 0, 0, 0); + return date; +} + +// node_modules/date-fns/esm/startOfYear/index.js +function startOfYear(dirtyDate) { + requiredArgs(1, arguments); + var cleanDate = toDate(dirtyDate); + var date = new Date(0); + date.setFullYear(cleanDate.getFullYear(), 0, 1); + date.setHours(0, 0, 0, 0); + return date; +} + +// node_modules/date-fns/esm/endOfWeek/index.js +function endOfWeek(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var defaultOptions3 = getDefaultOptions(); + var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); + if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { + throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); } - return "text"; -}; + var date = toDate(dirtyDate); + var day = date.getDay(); + var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); + date.setDate(date.getDate() + diff); + date.setHours(23, 59, 59, 999); + return date; +} -// src/utils/metadata/frontmatter/frontMatterKeys.ts -var frontMatterKeys = (fm) => { - return Object.keys(fm != null ? fm : {}).filter((f4) => f4 != "position").filter((f4) => f4 != "tag" && f4 != "tags"); -}; +// node_modules/date-fns/esm/endOfISOWeek/index.js +function endOfISOWeek(dirtyDate) { + requiredArgs(1, arguments); + return endOfWeek(dirtyDate, { + weekStartsOn: 1 + }); +} -// src/utils/metadata/frontmatter/yamlTypeToMDBType.ts -var yamlTypeToMDBType = (YAMLtype) => { - switch (YAMLtype) { - case "duration": - return "text"; - break; - case "unknown": - return "text"; - break; +// node_modules/date-fns/esm/subMilliseconds/index.js +function subMilliseconds(dirtyDate, dirtyAmount) { + requiredArgs(2, arguments); + var amount = toInteger(dirtyAmount); + return addMilliseconds(dirtyDate, -amount); +} + +// node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js +var MILLISECONDS_IN_DAY2 = 864e5; +function getUTCDayOfYear(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var timestamp = date.getTime(); + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + var startOfYearTimestamp = date.getTime(); + var difference = timestamp - startOfYearTimestamp; + return Math.floor(difference / MILLISECONDS_IN_DAY2) + 1; +} + +// node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js +function startOfUTCISOWeek(dirtyDate) { + requiredArgs(1, arguments); + var weekStartsOn = 1; + var date = toDate(dirtyDate); + var day = date.getUTCDay(); + var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; + date.setUTCDate(date.getUTCDate() - diff); + date.setUTCHours(0, 0, 0, 0); + return date; +} + +// node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js +function getUTCISOWeekYear(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var year = date.getUTCFullYear(); + var fourthOfJanuaryOfNextYear = new Date(0); + fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4); + fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0); + var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear); + var fourthOfJanuaryOfThisYear = new Date(0); + fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4); + fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0); + var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear); + if (date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; } - return YAMLtype; -}; +} -// src/utils/metadata/frontmatter/fm.ts -var saveContextToFile = (file, cols, context, plugin) => { - if (app.fileManager.processFrontMatter) { - app.fileManager.processFrontMatter(file, (frontmatter) => { - Object.keys(context).filter( - (f4) => cols.find((c4) => c4.name == f4) && cols.find((c4) => c4.name == f4).hidden != "true" && !cols.find((c4) => c4.name == f4).type.contains("file") && context[f4] - ).forEach((f4) => { - const col = cols.find((c4) => c4.name == f4); - frontmatter[f4] = valueForFrontmatter(col.type, context[f4]); - frontmatter[f4] = valueForFrontmatter(col.type, context[f4]); - }); - }); +// node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js +function startOfUTCISOWeekYear(dirtyDate) { + requiredArgs(1, arguments); + var year = getUTCISOWeekYear(dirtyDate); + var fourthOfJanuary = new Date(0); + fourthOfJanuary.setUTCFullYear(year, 0, 4); + fourthOfJanuary.setUTCHours(0, 0, 0, 0); + var date = startOfUTCISOWeek(fourthOfJanuary); + return date; +} + +// node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js +var MILLISECONDS_IN_WEEK2 = 6048e5; +function getUTCISOWeek(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); + return Math.round(diff / MILLISECONDS_IN_WEEK2) + 1; +} + +// node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js +function startOfUTCWeek(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var defaultOptions3 = getDefaultOptions(); + var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); + if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { + throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); } -}; -var frontMatterForFile = (file) => { - let currentCache; - if (file instanceof import_obsidian3.TFile && app.metadataCache.getFileCache(file) !== null) { - currentCache = app.metadataCache.getFileCache(file); + var date = toDate(dirtyDate); + var day = date.getUTCDay(); + var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; + date.setUTCDate(date.getUTCDate() - diff); + date.setUTCHours(0, 0, 0, 0); + return date; +} + +// node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js +function getUTCWeekYear(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var year = date.getUTCFullYear(); + var defaultOptions3 = getDefaultOptions(); + var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); + if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { + throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); } - return currentCache == null ? void 0 : currentCache.frontmatter; -}; -var mergeTableData = (mdb, yamlmdb, types) => { - return { - ...mdb, - cols: [ - ...mdb.cols, - ...yamlmdb.cols.filter( - (f4) => !mdb.cols.find((g4) => g4.name.toLowerCase() == f4.toLowerCase()) - ).map((f4) => ({ - name: f4, - schemaId: mdb.schema.id, - type: yamlTypeToMDBType(types[f4]) - })) - ].filter(onlyUniquePropCaseInsensitive("name")), - rows: mdb.rows.map((r3) => { - const fmRow = yamlmdb.rows.find((f4) => f4.File == r3.File); - if (fmRow) { - return { - ...r3, - ...fmRow - }; - } - return r3; - }) - }; -}; -var guestimateTypes = (_files, plugin, dv) => { - const typesArray = _files.map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4).map((k5) => { - const fm = dv && plugin.dataViewAPI() ? plugin.dataViewAPI().page(k5.path) : frontMatterForFile(k5); - const fmKeys = dv ? Object.keys(fm != null ? fm : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 - ) ? true : false - ).filter((f4) => f4 != "file") : frontMatterKeys(fm); - return fmKeys.reduce( - (pk, ck) => ({ ...pk, [ck]: detectYAMLType(fm[ck], ck) }), - {} - ); - }); - const types = typesArray.reduce( - (p3, c4) => { - const newSet = Object.keys(c4).reduce( - (pk, ck) => { - var _a2; - return { ...pk, [ck]: [...(_a2 = p3 == null ? void 0 : p3[ck]) != null ? _a2 : [], c4[ck]] }; - }, - { ...p3 } - ); - return newSet; - }, - {} - ); - const guessType = (ts) => { - return import_lodash.default.head((0, import_lodash.default)(ts).countBy().entries().maxBy(import_lodash.default.last)); - }; - const guessedTypes = Object.keys(types).reduce((p3, c4) => { - return { ...p3, [c4]: guessType(types[c4]) }; - }, {}); - return guessedTypes; -}; -var valueForFrontmatter = (type, value) => { - if (type == "number") { - return parseFloat(value); - } else if (type == "boolean") { - return value == "true"; - } else if (type.contains("multi")) { - return parseMultiString(value).map( - (f4) => valueForFrontmatter(type.replace("-multi", ""), f4) - ); - } else if (type.contains("link") || type.contains("context")) { - return `[[${value}]]`; + var firstWeekOfNextYear = new Date(0); + firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate); + firstWeekOfNextYear.setUTCHours(0, 0, 0, 0); + var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options); + var firstWeekOfThisYear = new Date(0); + firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate); + firstWeekOfThisYear.setUTCHours(0, 0, 0, 0); + var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options); + if (date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; } - return value; -}; -var valueForDataview = (type, value) => { - if (type.contains("link") || type.contains("context")) { - return `[[${value}]]`; +} + +// node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js +function startOfUTCWeekYear(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var defaultOptions3 = getDefaultOptions(); + var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); + var year = getUTCWeekYear(dirtyDate, options); + var firstWeek = new Date(0); + firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate); + firstWeek.setUTCHours(0, 0, 0, 0); + var date = startOfUTCWeek(firstWeek, options); + return date; +} + +// node_modules/date-fns/esm/_lib/getUTCWeek/index.js +var MILLISECONDS_IN_WEEK3 = 6048e5; +function getUTCWeek(dirtyDate, options) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); + return Math.round(diff / MILLISECONDS_IN_WEEK3) + 1; +} + +// node_modules/date-fns/esm/_lib/addLeadingZeros/index.js +function addLeadingZeros(number, targetLength) { + var sign = number < 0 ? "-" : ""; + var output = Math.abs(number).toString(); + while (output.length < targetLength) { + output = "0" + output; } - return value; -}; -var renameFrontmatterKey = (plugin, path, key2, name) => { - const afile = getAbstractFileAtPath(app, path); - if (afile && afile instanceof import_obsidian3.TFile) { - if (app.fileManager.processFrontMatter) { - app.fileManager.processFrontMatter(afile, (frontmatter) => { - if (key2 in frontmatter) { - frontmatter[name] = frontmatter[key2]; - delete frontmatter[key2]; - } - }); + return sign + output; +} + +// node_modules/date-fns/esm/_lib/format/lightFormatters/index.js +var formatters = { + y: function y3(date, token) { + var signedYear = date.getUTCFullYear(); + var year = signedYear > 0 ? signedYear : 1 - signedYear; + return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); + }, + M: function M3(date, token) { + var month = date.getUTCMonth(); + return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); + }, + d: function d3(date, token) { + return addLeadingZeros(date.getUTCDate(), token.length); + }, + a: function a3(date, token) { + var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am"; + switch (token) { + case "a": + case "aa": + return dayPeriodEnumValue.toUpperCase(); + case "aaa": + return dayPeriodEnumValue; + case "aaaaa": + return dayPeriodEnumValue[0]; + case "aaaa": + default: + return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; } + }, + h: function h3(date, token) { + return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length); + }, + H: function H3(date, token) { + return addLeadingZeros(date.getUTCHours(), token.length); + }, + m: function m3(date, token) { + return addLeadingZeros(date.getUTCMinutes(), token.length); + }, + s: function s3(date, token) { + return addLeadingZeros(date.getUTCSeconds(), token.length); + }, + S: function S2(date, token) { + var numberOfDigits = token.length; + var milliseconds = date.getUTCMilliseconds(); + var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3)); + return addLeadingZeros(fractionalSeconds, token.length); } }; -var defaultValueForType = (value, type) => { - if (type == "date") { - return format(Date.now(), "yyyy-MM-dd"); - } - if (type == "number") { - return 0; - } - if (type == "boolean") { - return true; - } - if (type == "link") { - return "[[Select Note]]"; - } - if (type == "option") { - return "one, two"; - } - if (type == "text") { - return " "; - } - if (type == "image") { - return "https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"; - } +var lightFormatters_default = formatters; + +// node_modules/date-fns/esm/_lib/format/formatters/index.js +var dayPeriodEnum = { + am: "am", + pm: "pm", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" }; -var changeFrontmatterType = (plugin, path, key2, type) => { - const afile = getAbstractFileAtPath(app, path); - if (afile && afile instanceof import_obsidian3.TFile) { - if (app.fileManager.processFrontMatter) { - app.fileManager.processFrontMatter(afile, (frontmatter) => { - if (key2 in frontmatter) { - frontmatter[key2] = defaultValueForType(frontmatter[key2], type); - } - }); +var formatters2 = { + G: function G2(date, token, localize2) { + var era = date.getUTCFullYear() > 0 ? 1 : 0; + switch (token) { + case "G": + case "GG": + case "GGG": + return localize2.era(era, { + width: "abbreviated" + }); + case "GGGGG": + return localize2.era(era, { + width: "narrow" + }); + case "GGGG": + default: + return localize2.era(era, { + width: "wide" + }); } - } -}; -var deleteFrontmatterValue = (plugin, path, key2) => { - const afile = getAbstractFileAtPath(app, path); - if (afile && afile instanceof import_obsidian3.TFile) { - if (app.fileManager.processFrontMatter) { - app.fileManager.processFrontMatter(afile, (frontmatter) => { - if (plugin.dataViewAPI()) { - if (plugin.dataViewAPI().page(path)[key2] && !frontmatter[key2]) { - replaceValues(plugin, path, key2, ""); - } else { - if (key2 in frontmatter) { - delete frontmatter[key2]; - } - } - } else { - if (key2 in frontmatter) { - delete frontmatter[key2]; - } - } + }, + y: function y4(date, token, localize2) { + if (token === "yo") { + var signedYear = date.getUTCFullYear(); + var year = signedYear > 0 ? signedYear : 1 - signedYear; + return localize2.ordinalNumber(year, { + unit: "year" }); } - } -}; -var saveFrontmatterValue = (plugin, path, key2, value, type, forceSave) => { - let afile = getAbstractFileAtPath(app, path); - const fileCache = plugin.index.filesIndex.get(path); - if (afile && fileCache) { - if (fileCache.isFolder && fileCache.folderNote) { - afile = getAbstractFileAtPath(app, fileCache.folderNote.folderNotePath); - } - if (afile instanceof import_obsidian3.TFile) { - if (app.fileManager.processFrontMatter) { - app.fileManager.processFrontMatter(afile, (frontmatter) => { - var _a2; - if (plugin.dataViewAPI()) { - if (((_a2 = plugin.dataViewAPI().page(afile.path)) == null ? void 0 : _a2[key2]) && !frontmatter[key2]) { - replaceValues(plugin, afile.path, key2, valueForDataview(type, value)); - } else { - if (key2 in frontmatter || forceSave) { - frontmatter[key2] = valueForFrontmatter(type, value); - } - } - } else { - if (key2 in frontmatter || forceSave) { - frontmatter[key2] = valueForFrontmatter(type, value); - } - } - }); - } + return lightFormatters_default.y(date, token); + }, + Y: function Y2(date, token, localize2, options) { + var signedWeekYear = getUTCWeekYear(date, options); + var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; + if (token === "YY") { + var twoDigitYear = weekYear % 100; + return addLeadingZeros(twoDigitYear, 2); } - } -}; - -// src/components/FileContextView/NoteBannerView.tsx -var NoteBannerView = (props2) => { - const [banner, setBanner] = h2(null); - p2(() => { - var _a2; - if (props2.link) { - const newBanner = (_a2 = getAbstractFileAtPath(app, props2.link)) != null ? _a2 : props2.link; - setBanner(newBanner); - } else { - setBanner(null); + if (token === "Yo") { + return localize2.ordinalNumber(weekYear, { + unit: "year" + }); } - }, [props2.link]); - const triggerBannerContextMenu = (e4) => { - if (!props2.file) - return; - e4.preventDefault(); - const fileMenu = new import_obsidian4.Menu(); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeBanner); - menuItem.setIcon("lucide-image"); - menuItem.onClick((ev) => { - let vaultChangeModal = new imageModal( - props2.plugin, - props2.plugin.app, - (image) => saveFrontmatterValue( - props2.plugin, - props2.file.path, - props2.plugin.settings.fmKeyBanner, - image, - "image", - true - ) - ); - vaultChangeModal.open(); + return addLeadingZeros(weekYear, token.length); + }, + R: function R2(date, token) { + var isoWeekYear = getUTCISOWeekYear(date); + return addLeadingZeros(isoWeekYear, token.length); + }, + u: function u3(date, token) { + var year = date.getUTCFullYear(); + return addLeadingZeros(year, token.length); + }, + Q: function Q2(date, token, localize2) { + var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); + switch (token) { + case "Q": + return String(quarter); + case "QQ": + return addLeadingZeros(quarter, 2); + case "Qo": + return localize2.ordinalNumber(quarter, { + unit: "quarter" + }); + case "QQQ": + return localize2.quarter(quarter, { + width: "abbreviated", + context: "formatting" + }); + case "QQQQQ": + return localize2.quarter(quarter, { + width: "narrow", + context: "formatting" + }); + case "QQQQ": + default: + return localize2.quarter(quarter, { + width: "wide", + context: "formatting" + }); + } + }, + q: function q4(date, token, localize2) { + var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); + switch (token) { + case "q": + return String(quarter); + case "qq": + return addLeadingZeros(quarter, 2); + case "qo": + return localize2.ordinalNumber(quarter, { + unit: "quarter" + }); + case "qqq": + return localize2.quarter(quarter, { + width: "abbreviated", + context: "standalone" + }); + case "qqqqq": + return localize2.quarter(quarter, { + width: "narrow", + context: "standalone" + }); + case "qqqq": + default: + return localize2.quarter(quarter, { + width: "wide", + context: "standalone" + }); + } + }, + M: function M4(date, token, localize2) { + var month = date.getUTCMonth(); + switch (token) { + case "M": + case "MM": + return lightFormatters_default.M(date, token); + case "Mo": + return localize2.ordinalNumber(month + 1, { + unit: "month" + }); + case "MMM": + return localize2.month(month, { + width: "abbreviated", + context: "formatting" + }); + case "MMMMM": + return localize2.month(month, { + width: "narrow", + context: "formatting" + }); + case "MMMM": + default: + return localize2.month(month, { + width: "wide", + context: "formatting" + }); + } + }, + L: function L3(date, token, localize2) { + var month = date.getUTCMonth(); + switch (token) { + case "L": + return String(month + 1); + case "LL": + return addLeadingZeros(month + 1, 2); + case "Lo": + return localize2.ordinalNumber(month + 1, { + unit: "month" + }); + case "LLL": + return localize2.month(month, { + width: "abbreviated", + context: "standalone" + }); + case "LLLLL": + return localize2.month(month, { + width: "narrow", + context: "standalone" + }); + case "LLLL": + default: + return localize2.month(month, { + width: "wide", + context: "standalone" + }); + } + }, + w: function w4(date, token, localize2, options) { + var week = getUTCWeek(date, options); + if (token === "wo") { + return localize2.ordinalNumber(week, { + unit: "week" }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeBanner); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - deleteFrontmatterValue( - props2.plugin, - props2.file.path, - props2.plugin.settings.fmKeyBanner - ); + } + return addLeadingZeros(week, token.length); + }, + I: function I3(date, token, localize2) { + var isoWeek = getUTCISOWeek(date); + if (token === "Io") { + return localize2.ordinalNumber(isoWeek, { + unit: "week" }); - }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } + return addLeadingZeros(isoWeek, token.length); + }, + d: function d4(date, token, localize2) { + if (token === "do") { + return localize2.ordinalNumber(date.getUTCDate(), { + unit: "date" + }); + } + return lightFormatters_default.d(date, token); + }, + D: function D3(date, token, localize2) { + var dayOfYear = getUTCDayOfYear(date); + if (token === "Do") { + return localize2.ordinalNumber(dayOfYear, { + unit: "dayOfYear" + }); + } + return addLeadingZeros(dayOfYear, token.length); + }, + E: function E3(date, token, localize2) { + var dayOfWeek = date.getUTCDay(); + switch (token) { + case "E": + case "EE": + case "EEE": + return localize2.day(dayOfWeek, { + width: "abbreviated", + context: "formatting" + }); + case "EEEEE": + return localize2.day(dayOfWeek, { + width: "narrow", + context: "formatting" + }); + case "EEEEEE": + return localize2.day(dayOfWeek, { + width: "short", + context: "formatting" + }); + case "EEEE": + default: + return localize2.day(dayOfWeek, { + width: "wide", + context: "formatting" + }); + } + }, + e: function e3(date, token, localize2, options) { + var dayOfWeek = date.getUTCDay(); + var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + switch (token) { + case "e": + return String(localDayOfWeek); + case "ee": + return addLeadingZeros(localDayOfWeek, 2); + case "eo": + return localize2.ordinalNumber(localDayOfWeek, { + unit: "day" + }); + case "eee": + return localize2.day(dayOfWeek, { + width: "abbreviated", + context: "formatting" + }); + case "eeeee": + return localize2.day(dayOfWeek, { + width: "narrow", + context: "formatting" + }); + case "eeeeee": + return localize2.day(dayOfWeek, { + width: "short", + context: "formatting" + }); + case "eeee": + default: + return localize2.day(dayOfWeek, { + width: "wide", + context: "formatting" + }); + } + }, + c: function c3(date, token, localize2, options) { + var dayOfWeek = date.getUTCDay(); + var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + switch (token) { + case "c": + return String(localDayOfWeek); + case "cc": + return addLeadingZeros(localDayOfWeek, token.length); + case "co": + return localize2.ordinalNumber(localDayOfWeek, { + unit: "day" + }); + case "ccc": + return localize2.day(dayOfWeek, { + width: "abbreviated", + context: "standalone" + }); + case "ccccc": + return localize2.day(dayOfWeek, { + width: "narrow", + context: "standalone" + }); + case "cccccc": + return localize2.day(dayOfWeek, { + width: "short", + context: "standalone" + }); + case "cccc": + default: + return localize2.day(dayOfWeek, { + width: "wide", + context: "standalone" + }); + } + }, + i: function i3(date, token, localize2) { + var dayOfWeek = date.getUTCDay(); + var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; + switch (token) { + case "i": + return String(isoDayOfWeek); + case "ii": + return addLeadingZeros(isoDayOfWeek, token.length); + case "io": + return localize2.ordinalNumber(isoDayOfWeek, { + unit: "day" + }); + case "iii": + return localize2.day(dayOfWeek, { + width: "abbreviated", + context: "formatting" + }); + case "iiiii": + return localize2.day(dayOfWeek, { + width: "narrow", + context: "formatting" + }); + case "iiiiii": + return localize2.day(dayOfWeek, { + width: "short", + context: "formatting" + }); + case "iiii": + default: + return localize2.day(dayOfWeek, { + width: "wide", + context: "formatting" + }); + } + }, + a: function a4(date, token, localize2) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; + switch (token) { + case "a": + case "aa": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting" + }); + case "aaa": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting" + }).toLowerCase(); + case "aaaaa": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting" + }); + case "aaaa": + default: + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting" + }); + } + }, + b: function b3(date, token, localize2) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue; + if (hours === 12) { + dayPeriodEnumValue = dayPeriodEnum.noon; + } else if (hours === 0) { + dayPeriodEnumValue = dayPeriodEnum.midnight; } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY + dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; + } + switch (token) { + case "b": + case "bb": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting" + }); + case "bbb": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting" + }).toLowerCase(); + case "bbbbb": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting" + }); + case "bbbb": + default: + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting" + }); + } + }, + B: function B4(date, token, localize2) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue; + if (hours >= 17) { + dayPeriodEnumValue = dayPeriodEnum.evening; + } else if (hours >= 12) { + dayPeriodEnumValue = dayPeriodEnum.afternoon; + } else if (hours >= 4) { + dayPeriodEnumValue = dayPeriodEnum.morning; + } else { + dayPeriodEnumValue = dayPeriodEnum.night; + } + switch (token) { + case "B": + case "BB": + case "BBB": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting" + }); + case "BBBBB": + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting" + }); + case "BBBB": + default: + return localize2.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting" + }); + } + }, + h: function h4(date, token, localize2) { + if (token === "ho") { + var hours = date.getUTCHours() % 12; + if (hours === 0) + hours = 12; + return localize2.ordinalNumber(hours, { + unit: "hour" }); } - return false; - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: `mk-note-header`, - onContextMenu: triggerBannerContextMenu - }, banner && /* @__PURE__ */ Cn.createElement("img", { - src: banner instanceof import_obsidian4.TFile ? app.vault.getResourcePath(banner) : banner - })); -}; - -// src/components/StickerMenu/emojis/default.ts -var emojis = { - smileys_people: [ - { n: ["grinning", "grinning face"], u: "1f600" }, - { n: ["smiley", "smiling face with open mouth"], u: "1f603" }, - { - n: ["smile", "smiling face with open mouth and smiling eyes"], - u: "1f604" - }, - { n: ["grin", "grinning face with smiling eyes"], u: "1f601" }, - { - n: [ - "laughing", - "satisfied", - "smiling face with open mouth and tightly-closed eyes" - ], - u: "1f606" - }, - { - n: ["sweat smile", "smiling face with open mouth and cold sweat"], - u: "1f605" - }, - { n: ["rolling on the floor laughing"], u: "1f923" }, - { n: ["joy", "face with tears of joy"], u: "1f602" }, - { n: ["slightly smiling face"], u: "1f642" }, - { n: ["upside-down face", "upside down face"], u: "1f643" }, - { n: ["melting face"], u: "1fae0" }, - { n: ["wink", "winking face"], u: "1f609" }, - { n: ["blush", "smiling face with smiling eyes"], u: "1f60a" }, - { n: ["innocent", "smiling face with halo"], u: "1f607" }, - { - n: [ - "smiling face with 3 hearts", - "smiling face with smiling eyes and three hearts" - ], - u: "1f970" - }, - { n: ["heart eyes", "smiling face with heart-shaped eyes"], u: "1f60d" }, - { n: ["star-struck", "grinning face with star eyes"], u: "1f929" }, - { n: ["kissing heart", "face throwing a kiss"], u: "1f618" }, - { n: ["kissing", "kissing face"], u: "1f617" }, - { n: ["relaxed", "white smiling face"], u: "263a-fe0f" }, - { n: ["kissing closed eyes", "kissing face with closed eyes"], u: "1f61a" }, - { - n: ["kissing smiling eyes", "kissing face with smiling eyes"], - u: "1f619" - }, - { n: ["smiling face with tear"], u: "1f972" }, - { n: ["yum", "face savouring delicious food"], u: "1f60b" }, - { n: ["stuck out tongue", "face with stuck-out tongue"], u: "1f61b" }, - { - n: [ - "stuck out tongue winking eye", - "face with stuck-out tongue and winking eye" - ], - u: "1f61c" - }, - { - n: ["zany face", "grinning face with one large and one small eye"], - u: "1f92a" - }, - { - n: [ - "stuck out tongue closed eyes", - "face with stuck-out tongue and tightly-closed eyes" - ], - u: "1f61d" - }, - { n: ["money-mouth face", "money mouth face"], u: "1f911" }, - { n: ["hugging face"], u: "1f917" }, - { - n: [ - "face with hand over mouth", - "smiling face with smiling eyes and hand covering mouth" - ], - u: "1f92d" - }, - { n: ["face with open eyes and hand over mouth"], u: "1fae2" }, - { n: ["face with peeking eye"], u: "1fae3" }, - { - n: ["shushing face", "face with finger covering closed lips"], - u: "1f92b" - }, - { n: ["thinking face"], u: "1f914" }, - { n: ["saluting face"], u: "1fae1" }, - { n: ["zipper-mouth face", "zipper mouth face"], u: "1f910" }, - { - n: ["face with raised eyebrow", "face with one eyebrow raised"], - u: "1f928" - }, - { n: ["neutral face"], u: "1f610" }, - { n: ["expressionless", "expressionless face"], u: "1f611" }, - { n: ["no mouth", "face without mouth"], u: "1f636" }, - { n: ["dotted line face"], u: "1fae5" }, - { n: ["face in clouds"], u: "1f636-200d-1f32b-fe0f" }, - { n: ["smirk", "smirking face"], u: "1f60f" }, - { n: ["unamused", "unamused face"], u: "1f612" }, - { n: ["face with rolling eyes"], u: "1f644" }, - { n: ["grimacing", "grimacing face"], u: "1f62c" }, - { n: ["face exhaling"], u: "1f62e-200d-1f4a8" }, - { n: ["lying face"], u: "1f925" }, - { n: ["relieved", "relieved face"], u: "1f60c" }, - { n: ["pensive", "pensive face"], u: "1f614" }, - { n: ["sleepy", "sleepy face"], u: "1f62a" }, - { n: ["drooling face"], u: "1f924" }, - { n: ["sleeping", "sleeping face"], u: "1f634" }, - { n: ["mask", "face with medical mask"], u: "1f637" }, - { n: ["face with thermometer"], u: "1f912" }, - { n: ["face with head-bandage", "face with head bandage"], u: "1f915" }, - { n: ["nauseated face"], u: "1f922" }, - { n: ["face vomiting", "face with open mouth vomiting"], u: "1f92e" }, - { n: ["sneezing face"], u: "1f927" }, - { n: ["hot face", "overheated face"], u: "1f975" }, - { n: ["cold face", "freezing face"], u: "1f976" }, - { n: ["woozy face", "face with uneven eyes and wavy mouth"], u: "1f974" }, - { n: ["dizzy face"], u: "1f635" }, - { n: ["face with spiral eyes"], u: "1f635-200d-1f4ab" }, - { n: ["exploding head", "shocked face with exploding head"], u: "1f92f" }, - { n: ["face with cowboy hat"], u: "1f920" }, - { n: ["partying face", "face with party horn and party hat"], u: "1f973" }, - { n: ["disguised face"], u: "1f978" }, - { n: ["sunglasses", "smiling face with sunglasses"], u: "1f60e" }, - { n: ["nerd face"], u: "1f913" }, - { n: ["face with monocle"], u: "1f9d0" }, - { n: ["confused", "confused face"], u: "1f615" }, - { n: ["face with diagonal mouth"], u: "1fae4" }, - { n: ["worried", "worried face"], u: "1f61f" }, - { n: ["slightly frowning face"], u: "1f641" }, - { n: ["frowning face", "white frowning face"], u: "2639-fe0f" }, - { n: ["open mouth", "face with open mouth"], u: "1f62e" }, - { n: ["hushed", "hushed face"], u: "1f62f" }, - { n: ["astonished", "astonished face"], u: "1f632" }, - { n: ["flushed", "flushed face"], u: "1f633" }, - { n: ["pleading face", "face with pleading eyes"], u: "1f97a" }, - { n: ["face holding back tears"], u: "1f979" }, - { n: ["frowning", "frowning face with open mouth"], u: "1f626" }, - { n: ["anguished", "anguished face"], u: "1f627" }, - { n: ["fearful", "fearful face"], u: "1f628" }, - { n: ["cold sweat", "face with open mouth and cold sweat"], u: "1f630" }, - { - n: ["disappointed relieved", "disappointed but relieved face"], - u: "1f625" - }, - { n: ["cry", "crying face"], u: "1f622" }, - { n: ["sob", "loudly crying face"], u: "1f62d" }, - { n: ["scream", "face screaming in fear"], u: "1f631" }, - { n: ["confounded", "confounded face"], u: "1f616" }, - { n: ["persevere", "persevering face"], u: "1f623" }, - { n: ["disappointed", "disappointed face"], u: "1f61e" }, - { n: ["sweat", "face with cold sweat"], u: "1f613" }, - { n: ["weary", "weary face"], u: "1f629" }, - { n: ["tired face"], u: "1f62b" }, - { n: ["yawning face"], u: "1f971" }, - { n: ["triumph", "face with look of triumph"], u: "1f624" }, - { n: ["rage", "pouting face"], u: "1f621" }, - { n: ["angry", "angry face"], u: "1f620" }, - { - n: [ - "face with symbols on mouth", - "serious face with symbols covering mouth" - ], - u: "1f92c" - }, - { n: ["smiling imp", "smiling face with horns"], u: "1f608" }, - { n: ["imp"], u: "1f47f" }, - { n: ["skull"], u: "1f480" }, - { n: ["skull and crossbones"], u: "2620-fe0f" }, - { n: ["poop", "shit", "hankey", "pile of poo"], u: "1f4a9" }, - { n: ["clown face"], u: "1f921" }, - { n: ["japanese ogre"], u: "1f479" }, - { n: ["japanese goblin"], u: "1f47a" }, - { n: ["ghost"], u: "1f47b" }, - { n: ["alien", "extraterrestrial alien"], u: "1f47d" }, - { n: ["alien monster", "space invader"], u: "1f47e" }, - { n: ["robot face"], u: "1f916" }, - { n: ["smiley cat", "smiling cat face with open mouth"], u: "1f63a" }, - { n: ["smile cat", "grinning cat face with smiling eyes"], u: "1f638" }, - { n: ["joy cat", "cat face with tears of joy"], u: "1f639" }, - { - n: ["heart eyes cat", "smiling cat face with heart-shaped eyes"], - u: "1f63b" - }, - { n: ["smirk cat", "cat face with wry smile"], u: "1f63c" }, - { n: ["kissing cat", "kissing cat face with closed eyes"], u: "1f63d" }, - { n: ["scream cat", "weary cat face"], u: "1f640" }, - { n: ["crying cat face"], u: "1f63f" }, - { n: ["pouting cat", "pouting cat face"], u: "1f63e" }, - { n: ["see no evil", "see-no-evil monkey"], u: "1f648" }, - { n: ["hear no evil", "hear-no-evil monkey"], u: "1f649" }, - { n: ["speak no evil", "speak-no-evil monkey"], u: "1f64a" }, - { n: ["kiss", "kiss mark"], u: "1f48b" }, - { n: ["love letter"], u: "1f48c" }, - { n: ["cupid", "heart with arrow"], u: "1f498" }, - { n: ["gift heart", "heart with ribbon"], u: "1f49d" }, - { n: ["sparkling heart"], u: "1f496" }, - { n: ["heartpulse", "growing heart"], u: "1f497" }, - { n: ["heartbeat", "beating heart"], u: "1f493" }, - { n: ["revolving hearts"], u: "1f49e" }, - { n: ["two hearts"], u: "1f495" }, - { n: ["heart decoration"], u: "1f49f" }, - { - n: ["heart exclamation", "heavy heart exclamation mark ornament"], - u: "2763-fe0f" - }, - { n: ["broken heart"], u: "1f494" }, - { n: ["heart on fire"], u: "2764-fe0f-200d-1f525" }, - { n: ["mending heart"], u: "2764-fe0f-200d-1fa79" }, - { n: ["heart", "heavy black heart"], u: "2764-fe0f" }, - { n: ["orange heart"], u: "1f9e1" }, - { n: ["yellow heart"], u: "1f49b" }, - { n: ["green heart"], u: "1f49a" }, - { n: ["blue heart"], u: "1f499" }, - { n: ["purple heart"], u: "1f49c" }, - { n: ["brown heart"], u: "1f90e" }, - { n: ["black heart"], u: "1f5a4" }, - { n: ["white heart"], u: "1f90d" }, - { n: ["100", "hundred points symbol"], u: "1f4af" }, - { n: ["anger", "anger symbol"], u: "1f4a2" }, - { n: ["boom", "collision", "collision symbol"], u: "1f4a5" }, - { n: ["dizzy", "dizzy symbol"], u: "1f4ab" }, - { n: ["sweat drops", "splashing sweat symbol"], u: "1f4a6" }, - { n: ["dash", "dash symbol"], u: "1f4a8" }, - { n: ["hole"], u: "1f573-fe0f" }, - { n: ["bomb"], u: "1f4a3" }, - { n: ["speech balloon"], u: "1f4ac" }, - { - n: ["eye in speech bubble", "eye-in-speech-bubble"], - u: "1f441-fe0f-200d-1f5e8-fe0f" - }, - { n: ["left speech bubble"], u: "1f5e8-fe0f" }, - { n: ["right anger bubble"], u: "1f5ef-fe0f" }, - { n: ["thought balloon"], u: "1f4ad" }, - { n: ["zzz", "sleeping symbol"], u: "1f4a4" }, - { - n: ["wave", "waving hand sign"], - u: "1f44b", - v: [ - "1f44b-1f3fb", - "1f44b-1f3fc", - "1f44b-1f3fd", - "1f44b-1f3fe", - "1f44b-1f3ff" - ] - }, - { - n: ["raised back of hand"], - u: "1f91a", - v: [ - "1f91a-1f3fb", - "1f91a-1f3fc", - "1f91a-1f3fd", - "1f91a-1f3fe", - "1f91a-1f3ff" - ] - }, - { - n: ["hand with fingers splayed", "raised hand with fingers splayed"], - u: "1f590-fe0f", - v: [ - "1f590-1f3fb", - "1f590-1f3fc", - "1f590-1f3fd", - "1f590-1f3fe", - "1f590-1f3ff" - ] - }, - { - n: ["hand", "raised hand"], - u: "270b", - v: ["270b-1f3fb", "270b-1f3fc", "270b-1f3fd", "270b-1f3fe", "270b-1f3ff"] - }, - { - n: [ - "spock-hand", - "raised hand with part between middle and ring fingers" - ], - u: "1f596", - v: [ - "1f596-1f3fb", - "1f596-1f3fc", - "1f596-1f3fd", - "1f596-1f3fe", - "1f596-1f3ff" - ] - }, - { - n: ["rightwards hand"], - u: "1faf1", - v: [ - "1faf1-1f3fb", - "1faf1-1f3fc", - "1faf1-1f3fd", - "1faf1-1f3fe", - "1faf1-1f3ff" - ] - }, - { - n: ["leftwards hand"], - u: "1faf2", - v: [ - "1faf2-1f3fb", - "1faf2-1f3fc", - "1faf2-1f3fd", - "1faf2-1f3fe", - "1faf2-1f3ff" - ] - }, - { - n: ["palm down hand"], - u: "1faf3", - v: [ - "1faf3-1f3fb", - "1faf3-1f3fc", - "1faf3-1f3fd", - "1faf3-1f3fe", - "1faf3-1f3ff" - ] - }, - { - n: ["palm up hand"], - u: "1faf4", - v: [ - "1faf4-1f3fb", - "1faf4-1f3fc", - "1faf4-1f3fd", - "1faf4-1f3fe", - "1faf4-1f3ff" - ] - }, - { - n: ["ok hand", "ok hand sign"], - u: "1f44c", - v: [ - "1f44c-1f3fb", - "1f44c-1f3fc", - "1f44c-1f3fd", - "1f44c-1f3fe", - "1f44c-1f3ff" - ] - }, - { - n: ["pinched fingers"], - u: "1f90c", - v: [ - "1f90c-1f3fb", - "1f90c-1f3fc", - "1f90c-1f3fd", - "1f90c-1f3fe", - "1f90c-1f3ff" - ] - }, - { - n: ["pinching hand"], - u: "1f90f", - v: [ - "1f90f-1f3fb", - "1f90f-1f3fc", - "1f90f-1f3fd", - "1f90f-1f3fe", - "1f90f-1f3ff" - ] - }, - { - n: ["v", "victory hand"], - u: "270c-fe0f", - v: ["270c-1f3fb", "270c-1f3fc", "270c-1f3fd", "270c-1f3fe", "270c-1f3ff"] - }, - { - n: ["crossed fingers", "hand with index and middle fingers crossed"], - u: "1f91e", - v: [ - "1f91e-1f3fb", - "1f91e-1f3fc", - "1f91e-1f3fd", - "1f91e-1f3fe", - "1f91e-1f3ff" - ] - }, - { - n: ["hand with index finger and thumb crossed"], - u: "1faf0", - v: [ - "1faf0-1f3fb", - "1faf0-1f3fc", - "1faf0-1f3fd", - "1faf0-1f3fe", - "1faf0-1f3ff" - ] - }, - { - n: ["i love you hand sign"], - u: "1f91f", - v: [ - "1f91f-1f3fb", - "1f91f-1f3fc", - "1f91f-1f3fd", - "1f91f-1f3fe", - "1f91f-1f3ff" - ] - }, - { - n: ["the horns", "sign of the horns"], - u: "1f918", - v: [ - "1f918-1f3fb", - "1f918-1f3fc", - "1f918-1f3fd", - "1f918-1f3fe", - "1f918-1f3ff" - ] - }, - { - n: ["call me hand"], - u: "1f919", - v: [ - "1f919-1f3fb", - "1f919-1f3fc", - "1f919-1f3fd", - "1f919-1f3fe", - "1f919-1f3ff" - ] - }, - { - n: ["point left", "white left pointing backhand index"], - u: "1f448", - v: [ - "1f448-1f3fb", - "1f448-1f3fc", - "1f448-1f3fd", - "1f448-1f3fe", - "1f448-1f3ff" - ] - }, - { - n: ["point right", "white right pointing backhand index"], - u: "1f449", - v: [ - "1f449-1f3fb", - "1f449-1f3fc", - "1f449-1f3fd", - "1f449-1f3fe", - "1f449-1f3ff" - ] - }, - { - n: ["point up 2", "white up pointing backhand index"], - u: "1f446", - v: [ - "1f446-1f3fb", - "1f446-1f3fc", - "1f446-1f3fd", - "1f446-1f3fe", - "1f446-1f3ff" - ] - }, - { - n: ["middle finger", "reversed hand with middle finger extended"], - u: "1f595", - v: [ - "1f595-1f3fb", - "1f595-1f3fc", - "1f595-1f3fd", - "1f595-1f3fe", - "1f595-1f3ff" - ] - }, - { - n: ["point down", "white down pointing backhand index"], - u: "1f447", - v: [ - "1f447-1f3fb", - "1f447-1f3fc", - "1f447-1f3fd", - "1f447-1f3fe", - "1f447-1f3ff" - ] - }, - { - n: ["point up", "white up pointing index"], - u: "261d-fe0f", - v: ["261d-1f3fb", "261d-1f3fc", "261d-1f3fd", "261d-1f3fe", "261d-1f3ff"] - }, - { - n: ["index pointing at the viewer"], - u: "1faf5", - v: [ - "1faf5-1f3fb", - "1faf5-1f3fc", - "1faf5-1f3fd", - "1faf5-1f3fe", - "1faf5-1f3ff" - ] - }, - { - n: ["+1", "thumbsup", "thumbs up sign"], - u: "1f44d", - v: [ - "1f44d-1f3fb", - "1f44d-1f3fc", - "1f44d-1f3fd", - "1f44d-1f3fe", - "1f44d-1f3ff" - ] - }, - { - n: ["-1", "thumbsdown", "thumbs down sign"], - u: "1f44e", - v: [ - "1f44e-1f3fb", - "1f44e-1f3fc", - "1f44e-1f3fd", - "1f44e-1f3fe", - "1f44e-1f3ff" - ] - }, - { - n: ["fist", "raised fist"], - u: "270a", - v: ["270a-1f3fb", "270a-1f3fc", "270a-1f3fd", "270a-1f3fe", "270a-1f3ff"] - }, - { - n: ["punch", "facepunch", "fisted hand sign"], - u: "1f44a", - v: [ - "1f44a-1f3fb", - "1f44a-1f3fc", - "1f44a-1f3fd", - "1f44a-1f3fe", - "1f44a-1f3ff" - ] - }, - { - n: ["left-facing fist"], - u: "1f91b", - v: [ - "1f91b-1f3fb", - "1f91b-1f3fc", - "1f91b-1f3fd", - "1f91b-1f3fe", - "1f91b-1f3ff" - ] - }, - { - n: ["right-facing fist"], - u: "1f91c", - v: [ - "1f91c-1f3fb", - "1f91c-1f3fc", - "1f91c-1f3fd", - "1f91c-1f3fe", - "1f91c-1f3ff" - ] - }, - { - n: ["clap", "clapping hands sign"], - u: "1f44f", - v: [ - "1f44f-1f3fb", - "1f44f-1f3fc", - "1f44f-1f3fd", - "1f44f-1f3fe", - "1f44f-1f3ff" - ] - }, - { - n: ["raised hands", "person raising both hands in celebration"], - u: "1f64c", - v: [ - "1f64c-1f3fb", - "1f64c-1f3fc", - "1f64c-1f3fd", - "1f64c-1f3fe", - "1f64c-1f3ff" - ] - }, - { - n: ["heart hands"], - u: "1faf6", - v: [ - "1faf6-1f3fb", - "1faf6-1f3fc", - "1faf6-1f3fd", - "1faf6-1f3fe", - "1faf6-1f3ff" - ] - }, - { - n: ["open hands", "open hands sign"], - u: "1f450", - v: [ - "1f450-1f3fb", - "1f450-1f3fc", - "1f450-1f3fd", - "1f450-1f3fe", - "1f450-1f3ff" - ] - }, - { - n: ["palms up together"], - u: "1f932", - v: [ - "1f932-1f3fb", - "1f932-1f3fc", - "1f932-1f3fd", - "1f932-1f3fe", - "1f932-1f3ff" - ] - }, - { - n: ["handshake"], - u: "1f91d", - v: [ - "1f91d-1f3fb", - "1f91d-1f3fc", - "1f91d-1f3fd", - "1f91d-1f3fe", - "1f91d-1f3ff", - "1faf1-1f3fb-200d-1faf2-1f3fc", - "1faf1-1f3fb-200d-1faf2-1f3fd", - "1faf1-1f3fb-200d-1faf2-1f3fe", - "1faf1-1f3fb-200d-1faf2-1f3ff", - "1faf1-1f3fc-200d-1faf2-1f3fb", - "1faf1-1f3fc-200d-1faf2-1f3fd", - "1faf1-1f3fc-200d-1faf2-1f3fe", - "1faf1-1f3fc-200d-1faf2-1f3ff", - "1faf1-1f3fd-200d-1faf2-1f3fb", - "1faf1-1f3fd-200d-1faf2-1f3fc", - "1faf1-1f3fd-200d-1faf2-1f3fe", - "1faf1-1f3fd-200d-1faf2-1f3ff", - "1faf1-1f3fe-200d-1faf2-1f3fb", - "1faf1-1f3fe-200d-1faf2-1f3fc", - "1faf1-1f3fe-200d-1faf2-1f3fd", - "1faf1-1f3fe-200d-1faf2-1f3ff", - "1faf1-1f3ff-200d-1faf2-1f3fb", - "1faf1-1f3ff-200d-1faf2-1f3fc", - "1faf1-1f3ff-200d-1faf2-1f3fd", - "1faf1-1f3ff-200d-1faf2-1f3fe" - ] - }, - { - n: ["pray", "person with folded hands"], - u: "1f64f", - v: [ - "1f64f-1f3fb", - "1f64f-1f3fc", - "1f64f-1f3fd", - "1f64f-1f3fe", - "1f64f-1f3ff" - ] - }, - { - n: ["writing hand"], - u: "270d-fe0f", - v: ["270d-1f3fb", "270d-1f3fc", "270d-1f3fd", "270d-1f3fe", "270d-1f3ff"] - }, - { - n: ["nail care", "nail polish"], - u: "1f485", - v: [ - "1f485-1f3fb", - "1f485-1f3fc", - "1f485-1f3fd", - "1f485-1f3fe", - "1f485-1f3ff" - ] - }, - { - n: ["selfie"], - u: "1f933", - v: [ - "1f933-1f3fb", - "1f933-1f3fc", - "1f933-1f3fd", - "1f933-1f3fe", - "1f933-1f3ff" - ] - }, - { - n: ["muscle", "flexed biceps"], - u: "1f4aa", - v: [ - "1f4aa-1f3fb", - "1f4aa-1f3fc", - "1f4aa-1f3fd", - "1f4aa-1f3fe", - "1f4aa-1f3ff" - ] - }, - { n: ["mechanical arm"], u: "1f9be" }, - { n: ["mechanical leg"], u: "1f9bf" }, - { - n: ["leg"], - u: "1f9b5", - v: [ - "1f9b5-1f3fb", - "1f9b5-1f3fc", - "1f9b5-1f3fd", - "1f9b5-1f3fe", - "1f9b5-1f3ff" - ] - }, - { - n: ["foot"], - u: "1f9b6", - v: [ - "1f9b6-1f3fb", - "1f9b6-1f3fc", - "1f9b6-1f3fd", - "1f9b6-1f3fe", - "1f9b6-1f3ff" - ] - }, - { - n: ["ear"], - u: "1f442", - v: [ - "1f442-1f3fb", - "1f442-1f3fc", - "1f442-1f3fd", - "1f442-1f3fe", - "1f442-1f3ff" - ] - }, - { - n: ["ear with hearing aid"], - u: "1f9bb", - v: [ - "1f9bb-1f3fb", - "1f9bb-1f3fc", - "1f9bb-1f3fd", - "1f9bb-1f3fe", - "1f9bb-1f3ff" - ] - }, - { - n: ["nose"], - u: "1f443", - v: [ - "1f443-1f3fb", - "1f443-1f3fc", - "1f443-1f3fd", - "1f443-1f3fe", - "1f443-1f3ff" - ] - }, - { n: ["brain"], u: "1f9e0" }, - { n: ["anatomical heart"], u: "1fac0" }, - { n: ["lungs"], u: "1fac1" }, - { n: ["tooth"], u: "1f9b7" }, - { n: ["bone"], u: "1f9b4" }, - { n: ["eyes"], u: "1f440" }, - { n: ["eye"], u: "1f441-fe0f" }, - { n: ["tongue"], u: "1f445" }, - { n: ["lips", "mouth"], u: "1f444" }, - { n: ["biting lip"], u: "1fae6" }, - { - n: ["baby"], - u: "1f476", - v: [ - "1f476-1f3fb", - "1f476-1f3fc", - "1f476-1f3fd", - "1f476-1f3fe", - "1f476-1f3ff" - ] - }, - { - n: ["child"], - u: "1f9d2", - v: [ - "1f9d2-1f3fb", - "1f9d2-1f3fc", - "1f9d2-1f3fd", - "1f9d2-1f3fe", - "1f9d2-1f3ff" - ] - }, - { - n: ["boy"], - u: "1f466", - v: [ - "1f466-1f3fb", - "1f466-1f3fc", - "1f466-1f3fd", - "1f466-1f3fe", - "1f466-1f3ff" - ] - }, - { - n: ["girl"], - u: "1f467", - v: [ - "1f467-1f3fb", - "1f467-1f3fc", - "1f467-1f3fd", - "1f467-1f3fe", - "1f467-1f3ff" - ] - }, - { - n: ["adult"], - u: "1f9d1", - v: [ - "1f9d1-1f3fb", - "1f9d1-1f3fc", - "1f9d1-1f3fd", - "1f9d1-1f3fe", - "1f9d1-1f3ff" - ] - }, - { - n: ["person with blond hair"], - u: "1f471", - v: [ - "1f471-1f3fb", - "1f471-1f3fc", - "1f471-1f3fd", - "1f471-1f3fe", - "1f471-1f3ff" - ] - }, - { - n: ["man"], - u: "1f468", - v: [ - "1f468-1f3fb", - "1f468-1f3fc", - "1f468-1f3fd", - "1f468-1f3fe", - "1f468-1f3ff" - ] - }, - { - n: ["bearded person"], - u: "1f9d4", - v: [ - "1f9d4-1f3fb", - "1f9d4-1f3fc", - "1f9d4-1f3fd", - "1f9d4-1f3fe", - "1f9d4-1f3ff" - ] - }, - { - n: ["man: beard", "man with beard"], - u: "1f9d4-200d-2642-fe0f", - v: [ - "1f9d4-1f3fb-200d-2642-fe0f", - "1f9d4-1f3fc-200d-2642-fe0f", - "1f9d4-1f3fd-200d-2642-fe0f", - "1f9d4-1f3fe-200d-2642-fe0f", - "1f9d4-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman: beard", "woman with beard"], - u: "1f9d4-200d-2640-fe0f", - v: [ - "1f9d4-1f3fb-200d-2640-fe0f", - "1f9d4-1f3fc-200d-2640-fe0f", - "1f9d4-1f3fd-200d-2640-fe0f", - "1f9d4-1f3fe-200d-2640-fe0f", - "1f9d4-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["man: red hair", "red haired man"], - u: "1f468-200d-1f9b0", - v: [ - "1f468-1f3fb-200d-1f9b0", - "1f468-1f3fc-200d-1f9b0", - "1f468-1f3fd-200d-1f9b0", - "1f468-1f3fe-200d-1f9b0", - "1f468-1f3ff-200d-1f9b0" - ] - }, - { - n: ["man: curly hair", "curly haired man"], - u: "1f468-200d-1f9b1", - v: [ - "1f468-1f3fb-200d-1f9b1", - "1f468-1f3fc-200d-1f9b1", - "1f468-1f3fd-200d-1f9b1", - "1f468-1f3fe-200d-1f9b1", - "1f468-1f3ff-200d-1f9b1" - ] - }, - { - n: ["man: white hair", "white haired man"], - u: "1f468-200d-1f9b3", - v: [ - "1f468-1f3fb-200d-1f9b3", - "1f468-1f3fc-200d-1f9b3", - "1f468-1f3fd-200d-1f9b3", - "1f468-1f3fe-200d-1f9b3", - "1f468-1f3ff-200d-1f9b3" - ] - }, - { - n: ["bald man", "man: bald"], - u: "1f468-200d-1f9b2", - v: [ - "1f468-1f3fb-200d-1f9b2", - "1f468-1f3fc-200d-1f9b2", - "1f468-1f3fd-200d-1f9b2", - "1f468-1f3fe-200d-1f9b2", - "1f468-1f3ff-200d-1f9b2" - ] - }, - { - n: ["woman"], - u: "1f469", - v: [ - "1f469-1f3fb", - "1f469-1f3fc", - "1f469-1f3fd", - "1f469-1f3fe", - "1f469-1f3ff" - ] - }, - { - n: ["woman: red hair", "red haired woman"], - u: "1f469-200d-1f9b0", - v: [ - "1f469-1f3fb-200d-1f9b0", - "1f469-1f3fc-200d-1f9b0", - "1f469-1f3fd-200d-1f9b0", - "1f469-1f3fe-200d-1f9b0", - "1f469-1f3ff-200d-1f9b0" - ] - }, - { - n: ["person: red hair", "red haired person"], - u: "1f9d1-200d-1f9b0", - v: [ - "1f9d1-1f3fb-200d-1f9b0", - "1f9d1-1f3fc-200d-1f9b0", - "1f9d1-1f3fd-200d-1f9b0", - "1f9d1-1f3fe-200d-1f9b0", - "1f9d1-1f3ff-200d-1f9b0" - ] - }, - { - n: ["woman: curly hair", "curly haired woman"], - u: "1f469-200d-1f9b1", - v: [ - "1f469-1f3fb-200d-1f9b1", - "1f469-1f3fc-200d-1f9b1", - "1f469-1f3fd-200d-1f9b1", - "1f469-1f3fe-200d-1f9b1", - "1f469-1f3ff-200d-1f9b1" - ] - }, - { - n: ["person: curly hair", "curly haired person"], - u: "1f9d1-200d-1f9b1", - v: [ - "1f9d1-1f3fb-200d-1f9b1", - "1f9d1-1f3fc-200d-1f9b1", - "1f9d1-1f3fd-200d-1f9b1", - "1f9d1-1f3fe-200d-1f9b1", - "1f9d1-1f3ff-200d-1f9b1" - ] - }, - { - n: ["woman: white hair", "white haired woman"], - u: "1f469-200d-1f9b3", - v: [ - "1f469-1f3fb-200d-1f9b3", - "1f469-1f3fc-200d-1f9b3", - "1f469-1f3fd-200d-1f9b3", - "1f469-1f3fe-200d-1f9b3", - "1f469-1f3ff-200d-1f9b3" - ] - }, - { - n: ["person: white hair", "white haired person"], - u: "1f9d1-200d-1f9b3", - v: [ - "1f9d1-1f3fb-200d-1f9b3", - "1f9d1-1f3fc-200d-1f9b3", - "1f9d1-1f3fd-200d-1f9b3", - "1f9d1-1f3fe-200d-1f9b3", - "1f9d1-1f3ff-200d-1f9b3" - ] - }, - { - n: ["bald woman", "woman: bald"], - u: "1f469-200d-1f9b2", - v: [ - "1f469-1f3fb-200d-1f9b2", - "1f469-1f3fc-200d-1f9b2", - "1f469-1f3fd-200d-1f9b2", - "1f469-1f3fe-200d-1f9b2", - "1f469-1f3ff-200d-1f9b2" - ] - }, - { - n: ["bald person", "person: bald"], - u: "1f9d1-200d-1f9b2", - v: [ - "1f9d1-1f3fb-200d-1f9b2", - "1f9d1-1f3fc-200d-1f9b2", - "1f9d1-1f3fd-200d-1f9b2", - "1f9d1-1f3fe-200d-1f9b2", - "1f9d1-1f3ff-200d-1f9b2" - ] - }, - { - n: ["woman: blond hair", "blond-haired-woman"], - u: "1f471-200d-2640-fe0f", - v: [ - "1f471-1f3fb-200d-2640-fe0f", - "1f471-1f3fc-200d-2640-fe0f", - "1f471-1f3fd-200d-2640-fe0f", - "1f471-1f3fe-200d-2640-fe0f", - "1f471-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["man: blond hair", "blond-haired-man"], - u: "1f471-200d-2642-fe0f", - v: [ - "1f471-1f3fb-200d-2642-fe0f", - "1f471-1f3fc-200d-2642-fe0f", - "1f471-1f3fd-200d-2642-fe0f", - "1f471-1f3fe-200d-2642-fe0f", - "1f471-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["older adult"], - u: "1f9d3", - v: [ - "1f9d3-1f3fb", - "1f9d3-1f3fc", - "1f9d3-1f3fd", - "1f9d3-1f3fe", - "1f9d3-1f3ff" - ] - }, - { - n: ["older man"], - u: "1f474", - v: [ - "1f474-1f3fb", - "1f474-1f3fc", - "1f474-1f3fd", - "1f474-1f3fe", - "1f474-1f3ff" - ] - }, - { - n: ["older woman"], - u: "1f475", - v: [ - "1f475-1f3fb", - "1f475-1f3fc", - "1f475-1f3fd", - "1f475-1f3fe", - "1f475-1f3ff" - ] - }, - { - n: ["person frowning"], - u: "1f64d", - v: [ - "1f64d-1f3fb", - "1f64d-1f3fc", - "1f64d-1f3fd", - "1f64d-1f3fe", - "1f64d-1f3ff" - ] - }, - { - n: ["man frowning", "man-frowning"], - u: "1f64d-200d-2642-fe0f", - v: [ - "1f64d-1f3fb-200d-2642-fe0f", - "1f64d-1f3fc-200d-2642-fe0f", - "1f64d-1f3fd-200d-2642-fe0f", - "1f64d-1f3fe-200d-2642-fe0f", - "1f64d-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman frowning", "woman-frowning"], - u: "1f64d-200d-2640-fe0f", - v: [ - "1f64d-1f3fb-200d-2640-fe0f", - "1f64d-1f3fc-200d-2640-fe0f", - "1f64d-1f3fd-200d-2640-fe0f", - "1f64d-1f3fe-200d-2640-fe0f", - "1f64d-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person with pouting face"], - u: "1f64e", - v: [ - "1f64e-1f3fb", - "1f64e-1f3fc", - "1f64e-1f3fd", - "1f64e-1f3fe", - "1f64e-1f3ff" - ] - }, - { - n: ["man pouting", "man-pouting"], - u: "1f64e-200d-2642-fe0f", - v: [ - "1f64e-1f3fb-200d-2642-fe0f", - "1f64e-1f3fc-200d-2642-fe0f", - "1f64e-1f3fd-200d-2642-fe0f", - "1f64e-1f3fe-200d-2642-fe0f", - "1f64e-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman pouting", "woman-pouting"], - u: "1f64e-200d-2640-fe0f", - v: [ - "1f64e-1f3fb-200d-2640-fe0f", - "1f64e-1f3fc-200d-2640-fe0f", - "1f64e-1f3fd-200d-2640-fe0f", - "1f64e-1f3fe-200d-2640-fe0f", - "1f64e-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["no good", "face with no good gesture"], - u: "1f645", - v: [ - "1f645-1f3fb", - "1f645-1f3fc", - "1f645-1f3fd", - "1f645-1f3fe", - "1f645-1f3ff" - ] - }, - { - n: ["man gesturing no", "man-gesturing-no"], - u: "1f645-200d-2642-fe0f", - v: [ - "1f645-1f3fb-200d-2642-fe0f", - "1f645-1f3fc-200d-2642-fe0f", - "1f645-1f3fd-200d-2642-fe0f", - "1f645-1f3fe-200d-2642-fe0f", - "1f645-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman gesturing no", "woman-gesturing-no"], - u: "1f645-200d-2640-fe0f", - v: [ - "1f645-1f3fb-200d-2640-fe0f", - "1f645-1f3fc-200d-2640-fe0f", - "1f645-1f3fd-200d-2640-fe0f", - "1f645-1f3fe-200d-2640-fe0f", - "1f645-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["ok woman", "face with ok gesture"], - u: "1f646", - v: [ - "1f646-1f3fb", - "1f646-1f3fc", - "1f646-1f3fd", - "1f646-1f3fe", - "1f646-1f3ff" - ] - }, - { - n: ["man gesturing ok", "man-gesturing-ok"], - u: "1f646-200d-2642-fe0f", - v: [ - "1f646-1f3fb-200d-2642-fe0f", - "1f646-1f3fc-200d-2642-fe0f", - "1f646-1f3fd-200d-2642-fe0f", - "1f646-1f3fe-200d-2642-fe0f", - "1f646-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman gesturing ok", "woman-gesturing-ok"], - u: "1f646-200d-2640-fe0f", - v: [ - "1f646-1f3fb-200d-2640-fe0f", - "1f646-1f3fc-200d-2640-fe0f", - "1f646-1f3fd-200d-2640-fe0f", - "1f646-1f3fe-200d-2640-fe0f", - "1f646-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["information desk person"], - u: "1f481", - v: [ - "1f481-1f3fb", - "1f481-1f3fc", - "1f481-1f3fd", - "1f481-1f3fe", - "1f481-1f3ff" - ] - }, - { - n: ["man tipping hand", "man-tipping-hand"], - u: "1f481-200d-2642-fe0f", - v: [ - "1f481-1f3fb-200d-2642-fe0f", - "1f481-1f3fc-200d-2642-fe0f", - "1f481-1f3fd-200d-2642-fe0f", - "1f481-1f3fe-200d-2642-fe0f", - "1f481-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman tipping hand", "woman-tipping-hand"], - u: "1f481-200d-2640-fe0f", - v: [ - "1f481-1f3fb-200d-2640-fe0f", - "1f481-1f3fc-200d-2640-fe0f", - "1f481-1f3fd-200d-2640-fe0f", - "1f481-1f3fe-200d-2640-fe0f", - "1f481-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["raising hand", "happy person raising one hand"], - u: "1f64b", - v: [ - "1f64b-1f3fb", - "1f64b-1f3fc", - "1f64b-1f3fd", - "1f64b-1f3fe", - "1f64b-1f3ff" - ] - }, - { - n: ["man raising hand", "man-raising-hand"], - u: "1f64b-200d-2642-fe0f", - v: [ - "1f64b-1f3fb-200d-2642-fe0f", - "1f64b-1f3fc-200d-2642-fe0f", - "1f64b-1f3fd-200d-2642-fe0f", - "1f64b-1f3fe-200d-2642-fe0f", - "1f64b-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman raising hand", "woman-raising-hand"], - u: "1f64b-200d-2640-fe0f", - v: [ - "1f64b-1f3fb-200d-2640-fe0f", - "1f64b-1f3fc-200d-2640-fe0f", - "1f64b-1f3fd-200d-2640-fe0f", - "1f64b-1f3fe-200d-2640-fe0f", - "1f64b-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["deaf person"], - u: "1f9cf", - v: [ - "1f9cf-1f3fb", - "1f9cf-1f3fc", - "1f9cf-1f3fd", - "1f9cf-1f3fe", - "1f9cf-1f3ff" - ] - }, - { - n: ["deaf man"], - u: "1f9cf-200d-2642-fe0f", - v: [ - "1f9cf-1f3fb-200d-2642-fe0f", - "1f9cf-1f3fc-200d-2642-fe0f", - "1f9cf-1f3fd-200d-2642-fe0f", - "1f9cf-1f3fe-200d-2642-fe0f", - "1f9cf-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["deaf woman"], - u: "1f9cf-200d-2640-fe0f", - v: [ - "1f9cf-1f3fb-200d-2640-fe0f", - "1f9cf-1f3fc-200d-2640-fe0f", - "1f9cf-1f3fd-200d-2640-fe0f", - "1f9cf-1f3fe-200d-2640-fe0f", - "1f9cf-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["bow", "person bowing deeply"], - u: "1f647", - v: [ - "1f647-1f3fb", - "1f647-1f3fc", - "1f647-1f3fd", - "1f647-1f3fe", - "1f647-1f3ff" - ] - }, - { - n: ["man bowing", "man-bowing"], - u: "1f647-200d-2642-fe0f", - v: [ - "1f647-1f3fb-200d-2642-fe0f", - "1f647-1f3fc-200d-2642-fe0f", - "1f647-1f3fd-200d-2642-fe0f", - "1f647-1f3fe-200d-2642-fe0f", - "1f647-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman bowing", "woman-bowing"], - u: "1f647-200d-2640-fe0f", - v: [ - "1f647-1f3fb-200d-2640-fe0f", - "1f647-1f3fc-200d-2640-fe0f", - "1f647-1f3fd-200d-2640-fe0f", - "1f647-1f3fe-200d-2640-fe0f", - "1f647-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["face palm"], - u: "1f926", - v: [ - "1f926-1f3fb", - "1f926-1f3fc", - "1f926-1f3fd", - "1f926-1f3fe", - "1f926-1f3ff" - ] - }, - { - n: ["man facepalming", "man-facepalming"], - u: "1f926-200d-2642-fe0f", - v: [ - "1f926-1f3fb-200d-2642-fe0f", - "1f926-1f3fc-200d-2642-fe0f", - "1f926-1f3fd-200d-2642-fe0f", - "1f926-1f3fe-200d-2642-fe0f", - "1f926-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman facepalming", "woman-facepalming"], - u: "1f926-200d-2640-fe0f", - v: [ - "1f926-1f3fb-200d-2640-fe0f", - "1f926-1f3fc-200d-2640-fe0f", - "1f926-1f3fd-200d-2640-fe0f", - "1f926-1f3fe-200d-2640-fe0f", - "1f926-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["shrug"], - u: "1f937", - v: [ - "1f937-1f3fb", - "1f937-1f3fc", - "1f937-1f3fd", - "1f937-1f3fe", - "1f937-1f3ff" - ] - }, - { - n: ["man shrugging", "man-shrugging"], - u: "1f937-200d-2642-fe0f", - v: [ - "1f937-1f3fb-200d-2642-fe0f", - "1f937-1f3fc-200d-2642-fe0f", - "1f937-1f3fd-200d-2642-fe0f", - "1f937-1f3fe-200d-2642-fe0f", - "1f937-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman shrugging", "woman-shrugging"], - u: "1f937-200d-2640-fe0f", - v: [ - "1f937-1f3fb-200d-2640-fe0f", - "1f937-1f3fc-200d-2640-fe0f", - "1f937-1f3fd-200d-2640-fe0f", - "1f937-1f3fe-200d-2640-fe0f", - "1f937-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["health worker"], - u: "1f9d1-200d-2695-fe0f", - v: [ - "1f9d1-1f3fb-200d-2695-fe0f", - "1f9d1-1f3fc-200d-2695-fe0f", - "1f9d1-1f3fd-200d-2695-fe0f", - "1f9d1-1f3fe-200d-2695-fe0f", - "1f9d1-1f3ff-200d-2695-fe0f" - ] - }, - { - n: ["male-doctor", "man health worker"], - u: "1f468-200d-2695-fe0f", - v: [ - "1f468-1f3fb-200d-2695-fe0f", - "1f468-1f3fc-200d-2695-fe0f", - "1f468-1f3fd-200d-2695-fe0f", - "1f468-1f3fe-200d-2695-fe0f", - "1f468-1f3ff-200d-2695-fe0f" - ] - }, - { - n: ["female-doctor", "woman health worker"], - u: "1f469-200d-2695-fe0f", - v: [ - "1f469-1f3fb-200d-2695-fe0f", - "1f469-1f3fc-200d-2695-fe0f", - "1f469-1f3fd-200d-2695-fe0f", - "1f469-1f3fe-200d-2695-fe0f", - "1f469-1f3ff-200d-2695-fe0f" - ] - }, - { - n: ["student"], - u: "1f9d1-200d-1f393", - v: [ - "1f9d1-1f3fb-200d-1f393", - "1f9d1-1f3fc-200d-1f393", - "1f9d1-1f3fd-200d-1f393", - "1f9d1-1f3fe-200d-1f393", - "1f9d1-1f3ff-200d-1f393" - ] - }, - { - n: ["man student", "male-student"], - u: "1f468-200d-1f393", - v: [ - "1f468-1f3fb-200d-1f393", - "1f468-1f3fc-200d-1f393", - "1f468-1f3fd-200d-1f393", - "1f468-1f3fe-200d-1f393", - "1f468-1f3ff-200d-1f393" - ] - }, - { - n: ["woman student", "female-student"], - u: "1f469-200d-1f393", - v: [ - "1f469-1f3fb-200d-1f393", - "1f469-1f3fc-200d-1f393", - "1f469-1f3fd-200d-1f393", - "1f469-1f3fe-200d-1f393", - "1f469-1f3ff-200d-1f393" - ] - }, - { - n: ["teacher"], - u: "1f9d1-200d-1f3eb", - v: [ - "1f9d1-1f3fb-200d-1f3eb", - "1f9d1-1f3fc-200d-1f3eb", - "1f9d1-1f3fd-200d-1f3eb", - "1f9d1-1f3fe-200d-1f3eb", - "1f9d1-1f3ff-200d-1f3eb" - ] - }, - { - n: ["man teacher", "male-teacher"], - u: "1f468-200d-1f3eb", - v: [ - "1f468-1f3fb-200d-1f3eb", - "1f468-1f3fc-200d-1f3eb", - "1f468-1f3fd-200d-1f3eb", - "1f468-1f3fe-200d-1f3eb", - "1f468-1f3ff-200d-1f3eb" - ] - }, - { - n: ["woman teacher", "female-teacher"], - u: "1f469-200d-1f3eb", - v: [ - "1f469-1f3fb-200d-1f3eb", - "1f469-1f3fc-200d-1f3eb", - "1f469-1f3fd-200d-1f3eb", - "1f469-1f3fe-200d-1f3eb", - "1f469-1f3ff-200d-1f3eb" - ] - }, - { - n: ["judge"], - u: "1f9d1-200d-2696-fe0f", - v: [ - "1f9d1-1f3fb-200d-2696-fe0f", - "1f9d1-1f3fc-200d-2696-fe0f", - "1f9d1-1f3fd-200d-2696-fe0f", - "1f9d1-1f3fe-200d-2696-fe0f", - "1f9d1-1f3ff-200d-2696-fe0f" - ] - }, - { - n: ["man judge", "male-judge"], - u: "1f468-200d-2696-fe0f", - v: [ - "1f468-1f3fb-200d-2696-fe0f", - "1f468-1f3fc-200d-2696-fe0f", - "1f468-1f3fd-200d-2696-fe0f", - "1f468-1f3fe-200d-2696-fe0f", - "1f468-1f3ff-200d-2696-fe0f" - ] - }, - { - n: ["woman judge", "female-judge"], - u: "1f469-200d-2696-fe0f", - v: [ - "1f469-1f3fb-200d-2696-fe0f", - "1f469-1f3fc-200d-2696-fe0f", - "1f469-1f3fd-200d-2696-fe0f", - "1f469-1f3fe-200d-2696-fe0f", - "1f469-1f3ff-200d-2696-fe0f" - ] - }, - { - n: ["farmer"], - u: "1f9d1-200d-1f33e", - v: [ - "1f9d1-1f3fb-200d-1f33e", - "1f9d1-1f3fc-200d-1f33e", - "1f9d1-1f3fd-200d-1f33e", - "1f9d1-1f3fe-200d-1f33e", - "1f9d1-1f3ff-200d-1f33e" - ] - }, - { - n: ["man farmer", "male-farmer"], - u: "1f468-200d-1f33e", - v: [ - "1f468-1f3fb-200d-1f33e", - "1f468-1f3fc-200d-1f33e", - "1f468-1f3fd-200d-1f33e", - "1f468-1f3fe-200d-1f33e", - "1f468-1f3ff-200d-1f33e" - ] - }, - { - n: ["woman farmer", "female-farmer"], - u: "1f469-200d-1f33e", - v: [ - "1f469-1f3fb-200d-1f33e", - "1f469-1f3fc-200d-1f33e", - "1f469-1f3fd-200d-1f33e", - "1f469-1f3fe-200d-1f33e", - "1f469-1f3ff-200d-1f33e" - ] - }, - { - n: ["cook"], - u: "1f9d1-200d-1f373", - v: [ - "1f9d1-1f3fb-200d-1f373", - "1f9d1-1f3fc-200d-1f373", - "1f9d1-1f3fd-200d-1f373", - "1f9d1-1f3fe-200d-1f373", - "1f9d1-1f3ff-200d-1f373" - ] - }, - { - n: ["man cook", "male-cook"], - u: "1f468-200d-1f373", - v: [ - "1f468-1f3fb-200d-1f373", - "1f468-1f3fc-200d-1f373", - "1f468-1f3fd-200d-1f373", - "1f468-1f3fe-200d-1f373", - "1f468-1f3ff-200d-1f373" - ] - }, - { - n: ["woman cook", "female-cook"], - u: "1f469-200d-1f373", - v: [ - "1f469-1f3fb-200d-1f373", - "1f469-1f3fc-200d-1f373", - "1f469-1f3fd-200d-1f373", - "1f469-1f3fe-200d-1f373", - "1f469-1f3ff-200d-1f373" - ] - }, - { - n: ["mechanic"], - u: "1f9d1-200d-1f527", - v: [ - "1f9d1-1f3fb-200d-1f527", - "1f9d1-1f3fc-200d-1f527", - "1f9d1-1f3fd-200d-1f527", - "1f9d1-1f3fe-200d-1f527", - "1f9d1-1f3ff-200d-1f527" - ] - }, - { - n: ["man mechanic", "male-mechanic"], - u: "1f468-200d-1f527", - v: [ - "1f468-1f3fb-200d-1f527", - "1f468-1f3fc-200d-1f527", - "1f468-1f3fd-200d-1f527", - "1f468-1f3fe-200d-1f527", - "1f468-1f3ff-200d-1f527" - ] - }, - { - n: ["woman mechanic", "female-mechanic"], - u: "1f469-200d-1f527", - v: [ - "1f469-1f3fb-200d-1f527", - "1f469-1f3fc-200d-1f527", - "1f469-1f3fd-200d-1f527", - "1f469-1f3fe-200d-1f527", - "1f469-1f3ff-200d-1f527" - ] - }, - { - n: ["factory worker"], - u: "1f9d1-200d-1f3ed", - v: [ - "1f9d1-1f3fb-200d-1f3ed", - "1f9d1-1f3fc-200d-1f3ed", - "1f9d1-1f3fd-200d-1f3ed", - "1f9d1-1f3fe-200d-1f3ed", - "1f9d1-1f3ff-200d-1f3ed" - ] - }, - { - n: ["man factory worker", "male-factory-worker"], - u: "1f468-200d-1f3ed", - v: [ - "1f468-1f3fb-200d-1f3ed", - "1f468-1f3fc-200d-1f3ed", - "1f468-1f3fd-200d-1f3ed", - "1f468-1f3fe-200d-1f3ed", - "1f468-1f3ff-200d-1f3ed" - ] - }, - { - n: ["woman factory worker", "female-factory-worker"], - u: "1f469-200d-1f3ed", - v: [ - "1f469-1f3fb-200d-1f3ed", - "1f469-1f3fc-200d-1f3ed", - "1f469-1f3fd-200d-1f3ed", - "1f469-1f3fe-200d-1f3ed", - "1f469-1f3ff-200d-1f3ed" - ] - }, - { - n: ["office worker"], - u: "1f9d1-200d-1f4bc", - v: [ - "1f9d1-1f3fb-200d-1f4bc", - "1f9d1-1f3fc-200d-1f4bc", - "1f9d1-1f3fd-200d-1f4bc", - "1f9d1-1f3fe-200d-1f4bc", - "1f9d1-1f3ff-200d-1f4bc" - ] - }, - { - n: ["man office worker", "male-office-worker"], - u: "1f468-200d-1f4bc", - v: [ - "1f468-1f3fb-200d-1f4bc", - "1f468-1f3fc-200d-1f4bc", - "1f468-1f3fd-200d-1f4bc", - "1f468-1f3fe-200d-1f4bc", - "1f468-1f3ff-200d-1f4bc" - ] - }, - { - n: ["woman office worker", "female-office-worker"], - u: "1f469-200d-1f4bc", - v: [ - "1f469-1f3fb-200d-1f4bc", - "1f469-1f3fc-200d-1f4bc", - "1f469-1f3fd-200d-1f4bc", - "1f469-1f3fe-200d-1f4bc", - "1f469-1f3ff-200d-1f4bc" - ] - }, - { - n: ["scientist"], - u: "1f9d1-200d-1f52c", - v: [ - "1f9d1-1f3fb-200d-1f52c", - "1f9d1-1f3fc-200d-1f52c", - "1f9d1-1f3fd-200d-1f52c", - "1f9d1-1f3fe-200d-1f52c", - "1f9d1-1f3ff-200d-1f52c" - ] - }, - { - n: ["man scientist", "male-scientist"], - u: "1f468-200d-1f52c", - v: [ - "1f468-1f3fb-200d-1f52c", - "1f468-1f3fc-200d-1f52c", - "1f468-1f3fd-200d-1f52c", - "1f468-1f3fe-200d-1f52c", - "1f468-1f3ff-200d-1f52c" - ] - }, - { - n: ["woman scientist", "female-scientist"], - u: "1f469-200d-1f52c", - v: [ - "1f469-1f3fb-200d-1f52c", - "1f469-1f3fc-200d-1f52c", - "1f469-1f3fd-200d-1f52c", - "1f469-1f3fe-200d-1f52c", - "1f469-1f3ff-200d-1f52c" - ] - }, - { - n: ["technologist"], - u: "1f9d1-200d-1f4bb", - v: [ - "1f9d1-1f3fb-200d-1f4bb", - "1f9d1-1f3fc-200d-1f4bb", - "1f9d1-1f3fd-200d-1f4bb", - "1f9d1-1f3fe-200d-1f4bb", - "1f9d1-1f3ff-200d-1f4bb" - ] - }, - { - n: ["man technologist", "male-technologist"], - u: "1f468-200d-1f4bb", - v: [ - "1f468-1f3fb-200d-1f4bb", - "1f468-1f3fc-200d-1f4bb", - "1f468-1f3fd-200d-1f4bb", - "1f468-1f3fe-200d-1f4bb", - "1f468-1f3ff-200d-1f4bb" - ] - }, - { - n: ["woman technologist", "female-technologist"], - u: "1f469-200d-1f4bb", - v: [ - "1f469-1f3fb-200d-1f4bb", - "1f469-1f3fc-200d-1f4bb", - "1f469-1f3fd-200d-1f4bb", - "1f469-1f3fe-200d-1f4bb", - "1f469-1f3ff-200d-1f4bb" - ] - }, - { - n: ["singer"], - u: "1f9d1-200d-1f3a4", - v: [ - "1f9d1-1f3fb-200d-1f3a4", - "1f9d1-1f3fc-200d-1f3a4", - "1f9d1-1f3fd-200d-1f3a4", - "1f9d1-1f3fe-200d-1f3a4", - "1f9d1-1f3ff-200d-1f3a4" - ] - }, - { - n: ["man singer", "male-singer"], - u: "1f468-200d-1f3a4", - v: [ - "1f468-1f3fb-200d-1f3a4", - "1f468-1f3fc-200d-1f3a4", - "1f468-1f3fd-200d-1f3a4", - "1f468-1f3fe-200d-1f3a4", - "1f468-1f3ff-200d-1f3a4" - ] - }, - { - n: ["woman singer", "female-singer"], - u: "1f469-200d-1f3a4", - v: [ - "1f469-1f3fb-200d-1f3a4", - "1f469-1f3fc-200d-1f3a4", - "1f469-1f3fd-200d-1f3a4", - "1f469-1f3fe-200d-1f3a4", - "1f469-1f3ff-200d-1f3a4" - ] - }, - { - n: ["artist"], - u: "1f9d1-200d-1f3a8", - v: [ - "1f9d1-1f3fb-200d-1f3a8", - "1f9d1-1f3fc-200d-1f3a8", - "1f9d1-1f3fd-200d-1f3a8", - "1f9d1-1f3fe-200d-1f3a8", - "1f9d1-1f3ff-200d-1f3a8" - ] - }, - { - n: ["man artist", "male-artist"], - u: "1f468-200d-1f3a8", - v: [ - "1f468-1f3fb-200d-1f3a8", - "1f468-1f3fc-200d-1f3a8", - "1f468-1f3fd-200d-1f3a8", - "1f468-1f3fe-200d-1f3a8", - "1f468-1f3ff-200d-1f3a8" - ] - }, - { - n: ["woman artist", "female-artist"], - u: "1f469-200d-1f3a8", - v: [ - "1f469-1f3fb-200d-1f3a8", - "1f469-1f3fc-200d-1f3a8", - "1f469-1f3fd-200d-1f3a8", - "1f469-1f3fe-200d-1f3a8", - "1f469-1f3ff-200d-1f3a8" - ] - }, - { - n: ["pilot"], - u: "1f9d1-200d-2708-fe0f", - v: [ - "1f9d1-1f3fb-200d-2708-fe0f", - "1f9d1-1f3fc-200d-2708-fe0f", - "1f9d1-1f3fd-200d-2708-fe0f", - "1f9d1-1f3fe-200d-2708-fe0f", - "1f9d1-1f3ff-200d-2708-fe0f" - ] - }, - { - n: ["man pilot", "male-pilot"], - u: "1f468-200d-2708-fe0f", - v: [ - "1f468-1f3fb-200d-2708-fe0f", - "1f468-1f3fc-200d-2708-fe0f", - "1f468-1f3fd-200d-2708-fe0f", - "1f468-1f3fe-200d-2708-fe0f", - "1f468-1f3ff-200d-2708-fe0f" - ] - }, - { - n: ["woman pilot", "female-pilot"], - u: "1f469-200d-2708-fe0f", - v: [ - "1f469-1f3fb-200d-2708-fe0f", - "1f469-1f3fc-200d-2708-fe0f", - "1f469-1f3fd-200d-2708-fe0f", - "1f469-1f3fe-200d-2708-fe0f", - "1f469-1f3ff-200d-2708-fe0f" - ] - }, - { - n: ["astronaut"], - u: "1f9d1-200d-1f680", - v: [ - "1f9d1-1f3fb-200d-1f680", - "1f9d1-1f3fc-200d-1f680", - "1f9d1-1f3fd-200d-1f680", - "1f9d1-1f3fe-200d-1f680", - "1f9d1-1f3ff-200d-1f680" - ] - }, - { - n: ["man astronaut", "male-astronaut"], - u: "1f468-200d-1f680", - v: [ - "1f468-1f3fb-200d-1f680", - "1f468-1f3fc-200d-1f680", - "1f468-1f3fd-200d-1f680", - "1f468-1f3fe-200d-1f680", - "1f468-1f3ff-200d-1f680" - ] - }, - { - n: ["woman astronaut", "female-astronaut"], - u: "1f469-200d-1f680", - v: [ - "1f469-1f3fb-200d-1f680", - "1f469-1f3fc-200d-1f680", - "1f469-1f3fd-200d-1f680", - "1f469-1f3fe-200d-1f680", - "1f469-1f3ff-200d-1f680" - ] - }, - { - n: ["firefighter"], - u: "1f9d1-200d-1f692", - v: [ - "1f9d1-1f3fb-200d-1f692", - "1f9d1-1f3fc-200d-1f692", - "1f9d1-1f3fd-200d-1f692", - "1f9d1-1f3fe-200d-1f692", - "1f9d1-1f3ff-200d-1f692" - ] - }, - { - n: ["man firefighter", "male-firefighter"], - u: "1f468-200d-1f692", - v: [ - "1f468-1f3fb-200d-1f692", - "1f468-1f3fc-200d-1f692", - "1f468-1f3fd-200d-1f692", - "1f468-1f3fe-200d-1f692", - "1f468-1f3ff-200d-1f692" - ] - }, - { - n: ["woman firefighter", "female-firefighter"], - u: "1f469-200d-1f692", - v: [ - "1f469-1f3fb-200d-1f692", - "1f469-1f3fc-200d-1f692", - "1f469-1f3fd-200d-1f692", - "1f469-1f3fe-200d-1f692", - "1f469-1f3ff-200d-1f692" - ] - }, - { - n: ["cop", "police officer"], - u: "1f46e", - v: [ - "1f46e-1f3fb", - "1f46e-1f3fc", - "1f46e-1f3fd", - "1f46e-1f3fe", - "1f46e-1f3ff" - ] - }, - { - n: ["man police officer", "male-police-officer"], - u: "1f46e-200d-2642-fe0f", - v: [ - "1f46e-1f3fb-200d-2642-fe0f", - "1f46e-1f3fc-200d-2642-fe0f", - "1f46e-1f3fd-200d-2642-fe0f", - "1f46e-1f3fe-200d-2642-fe0f", - "1f46e-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman police officer", "female-police-officer"], - u: "1f46e-200d-2640-fe0f", - v: [ - "1f46e-1f3fb-200d-2640-fe0f", - "1f46e-1f3fc-200d-2640-fe0f", - "1f46e-1f3fd-200d-2640-fe0f", - "1f46e-1f3fe-200d-2640-fe0f", - "1f46e-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["detective", "sleuth or spy"], - u: "1f575-fe0f", - v: [ - "1f575-1f3fb", - "1f575-1f3fc", - "1f575-1f3fd", - "1f575-1f3fe", - "1f575-1f3ff" - ] - }, - { - n: ["man detective", "male-detective"], - u: "1f575-fe0f-200d-2642-fe0f", - v: [ - "1f575-1f3fb-200d-2642-fe0f", - "1f575-1f3fc-200d-2642-fe0f", - "1f575-1f3fd-200d-2642-fe0f", - "1f575-1f3fe-200d-2642-fe0f", - "1f575-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman detective", "female-detective"], - u: "1f575-fe0f-200d-2640-fe0f", - v: [ - "1f575-1f3fb-200d-2640-fe0f", - "1f575-1f3fc-200d-2640-fe0f", - "1f575-1f3fd-200d-2640-fe0f", - "1f575-1f3fe-200d-2640-fe0f", - "1f575-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["guardsman"], - u: "1f482", - v: [ - "1f482-1f3fb", - "1f482-1f3fc", - "1f482-1f3fd", - "1f482-1f3fe", - "1f482-1f3ff" - ] - }, - { - n: ["man guard", "male-guard"], - u: "1f482-200d-2642-fe0f", - v: [ - "1f482-1f3fb-200d-2642-fe0f", - "1f482-1f3fc-200d-2642-fe0f", - "1f482-1f3fd-200d-2642-fe0f", - "1f482-1f3fe-200d-2642-fe0f", - "1f482-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman guard", "female-guard"], - u: "1f482-200d-2640-fe0f", - v: [ - "1f482-1f3fb-200d-2640-fe0f", - "1f482-1f3fc-200d-2640-fe0f", - "1f482-1f3fd-200d-2640-fe0f", - "1f482-1f3fe-200d-2640-fe0f", - "1f482-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["ninja"], - u: "1f977", - v: [ - "1f977-1f3fb", - "1f977-1f3fc", - "1f977-1f3fd", - "1f977-1f3fe", - "1f977-1f3ff" - ] - }, - { - n: ["construction worker"], - u: "1f477", - v: [ - "1f477-1f3fb", - "1f477-1f3fc", - "1f477-1f3fd", - "1f477-1f3fe", - "1f477-1f3ff" - ] - }, - { - n: ["man construction worker", "male-construction-worker"], - u: "1f477-200d-2642-fe0f", - v: [ - "1f477-1f3fb-200d-2642-fe0f", - "1f477-1f3fc-200d-2642-fe0f", - "1f477-1f3fd-200d-2642-fe0f", - "1f477-1f3fe-200d-2642-fe0f", - "1f477-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman construction worker", "female-construction-worker"], - u: "1f477-200d-2640-fe0f", - v: [ - "1f477-1f3fb-200d-2640-fe0f", - "1f477-1f3fc-200d-2640-fe0f", - "1f477-1f3fd-200d-2640-fe0f", - "1f477-1f3fe-200d-2640-fe0f", - "1f477-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person with crown"], - u: "1fac5", - v: [ - "1fac5-1f3fb", - "1fac5-1f3fc", - "1fac5-1f3fd", - "1fac5-1f3fe", - "1fac5-1f3ff" - ] - }, - { - n: ["prince"], - u: "1f934", - v: [ - "1f934-1f3fb", - "1f934-1f3fc", - "1f934-1f3fd", - "1f934-1f3fe", - "1f934-1f3ff" - ] - }, - { - n: ["princess"], - u: "1f478", - v: [ - "1f478-1f3fb", - "1f478-1f3fc", - "1f478-1f3fd", - "1f478-1f3fe", - "1f478-1f3ff" - ] - }, - { - n: ["man with turban"], - u: "1f473", - v: [ - "1f473-1f3fb", - "1f473-1f3fc", - "1f473-1f3fd", - "1f473-1f3fe", - "1f473-1f3ff" - ] - }, - { - n: ["man wearing turban", "man-wearing-turban"], - u: "1f473-200d-2642-fe0f", - v: [ - "1f473-1f3fb-200d-2642-fe0f", - "1f473-1f3fc-200d-2642-fe0f", - "1f473-1f3fd-200d-2642-fe0f", - "1f473-1f3fe-200d-2642-fe0f", - "1f473-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman wearing turban", "woman-wearing-turban"], - u: "1f473-200d-2640-fe0f", - v: [ - "1f473-1f3fb-200d-2640-fe0f", - "1f473-1f3fc-200d-2640-fe0f", - "1f473-1f3fd-200d-2640-fe0f", - "1f473-1f3fe-200d-2640-fe0f", - "1f473-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["man with gua pi mao"], - u: "1f472", - v: [ - "1f472-1f3fb", - "1f472-1f3fc", - "1f472-1f3fd", - "1f472-1f3fe", - "1f472-1f3ff" - ] - }, - { - n: ["person with headscarf"], - u: "1f9d5", - v: [ - "1f9d5-1f3fb", - "1f9d5-1f3fc", - "1f9d5-1f3fd", - "1f9d5-1f3fe", - "1f9d5-1f3ff" - ] - }, - { - n: ["man in tuxedo", "person in tuxedo"], - u: "1f935", - v: [ - "1f935-1f3fb", - "1f935-1f3fc", - "1f935-1f3fd", - "1f935-1f3fe", - "1f935-1f3ff" - ] - }, - { - n: ["man in tuxedo"], - u: "1f935-200d-2642-fe0f", - v: [ - "1f935-1f3fb-200d-2642-fe0f", - "1f935-1f3fc-200d-2642-fe0f", - "1f935-1f3fd-200d-2642-fe0f", - "1f935-1f3fe-200d-2642-fe0f", - "1f935-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman in tuxedo"], - u: "1f935-200d-2640-fe0f", - v: [ - "1f935-1f3fb-200d-2640-fe0f", - "1f935-1f3fc-200d-2640-fe0f", - "1f935-1f3fd-200d-2640-fe0f", - "1f935-1f3fe-200d-2640-fe0f", - "1f935-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["bride with veil"], - u: "1f470", - v: [ - "1f470-1f3fb", - "1f470-1f3fc", - "1f470-1f3fd", - "1f470-1f3fe", - "1f470-1f3ff" - ] - }, - { - n: ["man with veil"], - u: "1f470-200d-2642-fe0f", - v: [ - "1f470-1f3fb-200d-2642-fe0f", - "1f470-1f3fc-200d-2642-fe0f", - "1f470-1f3fd-200d-2642-fe0f", - "1f470-1f3fe-200d-2642-fe0f", - "1f470-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman with veil"], - u: "1f470-200d-2640-fe0f", - v: [ - "1f470-1f3fb-200d-2640-fe0f", - "1f470-1f3fc-200d-2640-fe0f", - "1f470-1f3fd-200d-2640-fe0f", - "1f470-1f3fe-200d-2640-fe0f", - "1f470-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["pregnant woman"], - u: "1f930", - v: [ - "1f930-1f3fb", - "1f930-1f3fc", - "1f930-1f3fd", - "1f930-1f3fe", - "1f930-1f3ff" - ] - }, - { - n: ["pregnant man"], - u: "1fac3", - v: [ - "1fac3-1f3fb", - "1fac3-1f3fc", - "1fac3-1f3fd", - "1fac3-1f3fe", - "1fac3-1f3ff" - ] - }, - { - n: ["pregnant person"], - u: "1fac4", - v: [ - "1fac4-1f3fb", - "1fac4-1f3fc", - "1fac4-1f3fd", - "1fac4-1f3fe", - "1fac4-1f3ff" - ] - }, - { - n: ["breast-feeding"], - u: "1f931", - v: [ - "1f931-1f3fb", - "1f931-1f3fc", - "1f931-1f3fd", - "1f931-1f3fe", - "1f931-1f3ff" - ] - }, - { - n: ["woman feeding baby"], - u: "1f469-200d-1f37c", - v: [ - "1f469-1f3fb-200d-1f37c", - "1f469-1f3fc-200d-1f37c", - "1f469-1f3fd-200d-1f37c", - "1f469-1f3fe-200d-1f37c", - "1f469-1f3ff-200d-1f37c" - ] - }, - { - n: ["man feeding baby"], - u: "1f468-200d-1f37c", - v: [ - "1f468-1f3fb-200d-1f37c", - "1f468-1f3fc-200d-1f37c", - "1f468-1f3fd-200d-1f37c", - "1f468-1f3fe-200d-1f37c", - "1f468-1f3ff-200d-1f37c" - ] - }, - { - n: ["person feeding baby"], - u: "1f9d1-200d-1f37c", - v: [ - "1f9d1-1f3fb-200d-1f37c", - "1f9d1-1f3fc-200d-1f37c", - "1f9d1-1f3fd-200d-1f37c", - "1f9d1-1f3fe-200d-1f37c", - "1f9d1-1f3ff-200d-1f37c" - ] - }, - { - n: ["angel", "baby angel"], - u: "1f47c", - v: [ - "1f47c-1f3fb", - "1f47c-1f3fc", - "1f47c-1f3fd", - "1f47c-1f3fe", - "1f47c-1f3ff" - ] - }, - { - n: ["santa", "father christmas"], - u: "1f385", - v: [ - "1f385-1f3fb", - "1f385-1f3fc", - "1f385-1f3fd", - "1f385-1f3fe", - "1f385-1f3ff" - ] - }, - { - n: ["mrs claus", "mother christmas"], - u: "1f936", - v: [ - "1f936-1f3fb", - "1f936-1f3fc", - "1f936-1f3fd", - "1f936-1f3fe", - "1f936-1f3ff" - ] - }, - { - n: ["mx claus"], - u: "1f9d1-200d-1f384", - v: [ - "1f9d1-1f3fb-200d-1f384", - "1f9d1-1f3fc-200d-1f384", - "1f9d1-1f3fd-200d-1f384", - "1f9d1-1f3fe-200d-1f384", - "1f9d1-1f3ff-200d-1f384" - ] - }, - { - n: ["superhero"], - u: "1f9b8", - v: [ - "1f9b8-1f3fb", - "1f9b8-1f3fc", - "1f9b8-1f3fd", - "1f9b8-1f3fe", - "1f9b8-1f3ff" - ] - }, - { - n: ["man superhero", "male superhero"], - u: "1f9b8-200d-2642-fe0f", - v: [ - "1f9b8-1f3fb-200d-2642-fe0f", - "1f9b8-1f3fc-200d-2642-fe0f", - "1f9b8-1f3fd-200d-2642-fe0f", - "1f9b8-1f3fe-200d-2642-fe0f", - "1f9b8-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman superhero", "female superhero"], - u: "1f9b8-200d-2640-fe0f", - v: [ - "1f9b8-1f3fb-200d-2640-fe0f", - "1f9b8-1f3fc-200d-2640-fe0f", - "1f9b8-1f3fd-200d-2640-fe0f", - "1f9b8-1f3fe-200d-2640-fe0f", - "1f9b8-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["supervillain"], - u: "1f9b9", - v: [ - "1f9b9-1f3fb", - "1f9b9-1f3fc", - "1f9b9-1f3fd", - "1f9b9-1f3fe", - "1f9b9-1f3ff" - ] - }, - { - n: ["man supervillain", "male supervillain"], - u: "1f9b9-200d-2642-fe0f", - v: [ - "1f9b9-1f3fb-200d-2642-fe0f", - "1f9b9-1f3fc-200d-2642-fe0f", - "1f9b9-1f3fd-200d-2642-fe0f", - "1f9b9-1f3fe-200d-2642-fe0f", - "1f9b9-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman supervillain", "female supervillain"], - u: "1f9b9-200d-2640-fe0f", - v: [ - "1f9b9-1f3fb-200d-2640-fe0f", - "1f9b9-1f3fc-200d-2640-fe0f", - "1f9b9-1f3fd-200d-2640-fe0f", - "1f9b9-1f3fe-200d-2640-fe0f", - "1f9b9-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["mage"], - u: "1f9d9", - v: [ - "1f9d9-1f3fb", - "1f9d9-1f3fc", - "1f9d9-1f3fd", - "1f9d9-1f3fe", - "1f9d9-1f3ff" - ] - }, - { - n: ["man mage", "male mage"], - u: "1f9d9-200d-2642-fe0f", - v: [ - "1f9d9-1f3fb-200d-2642-fe0f", - "1f9d9-1f3fc-200d-2642-fe0f", - "1f9d9-1f3fd-200d-2642-fe0f", - "1f9d9-1f3fe-200d-2642-fe0f", - "1f9d9-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman mage", "female mage"], - u: "1f9d9-200d-2640-fe0f", - v: [ - "1f9d9-1f3fb-200d-2640-fe0f", - "1f9d9-1f3fc-200d-2640-fe0f", - "1f9d9-1f3fd-200d-2640-fe0f", - "1f9d9-1f3fe-200d-2640-fe0f", - "1f9d9-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["fairy"], - u: "1f9da", - v: [ - "1f9da-1f3fb", - "1f9da-1f3fc", - "1f9da-1f3fd", - "1f9da-1f3fe", - "1f9da-1f3ff" - ] - }, - { - n: ["man fairy", "male fairy"], - u: "1f9da-200d-2642-fe0f", - v: [ - "1f9da-1f3fb-200d-2642-fe0f", - "1f9da-1f3fc-200d-2642-fe0f", - "1f9da-1f3fd-200d-2642-fe0f", - "1f9da-1f3fe-200d-2642-fe0f", - "1f9da-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman fairy", "female fairy"], - u: "1f9da-200d-2640-fe0f", - v: [ - "1f9da-1f3fb-200d-2640-fe0f", - "1f9da-1f3fc-200d-2640-fe0f", - "1f9da-1f3fd-200d-2640-fe0f", - "1f9da-1f3fe-200d-2640-fe0f", - "1f9da-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["vampire"], - u: "1f9db", - v: [ - "1f9db-1f3fb", - "1f9db-1f3fc", - "1f9db-1f3fd", - "1f9db-1f3fe", - "1f9db-1f3ff" - ] - }, - { - n: ["man vampire", "male vampire"], - u: "1f9db-200d-2642-fe0f", - v: [ - "1f9db-1f3fb-200d-2642-fe0f", - "1f9db-1f3fc-200d-2642-fe0f", - "1f9db-1f3fd-200d-2642-fe0f", - "1f9db-1f3fe-200d-2642-fe0f", - "1f9db-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman vampire", "female vampire"], - u: "1f9db-200d-2640-fe0f", - v: [ - "1f9db-1f3fb-200d-2640-fe0f", - "1f9db-1f3fc-200d-2640-fe0f", - "1f9db-1f3fd-200d-2640-fe0f", - "1f9db-1f3fe-200d-2640-fe0f", - "1f9db-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["merperson"], - u: "1f9dc", - v: [ - "1f9dc-1f3fb", - "1f9dc-1f3fc", - "1f9dc-1f3fd", - "1f9dc-1f3fe", - "1f9dc-1f3ff" - ] - }, - { - n: ["merman"], - u: "1f9dc-200d-2642-fe0f", - v: [ - "1f9dc-1f3fb-200d-2642-fe0f", - "1f9dc-1f3fc-200d-2642-fe0f", - "1f9dc-1f3fd-200d-2642-fe0f", - "1f9dc-1f3fe-200d-2642-fe0f", - "1f9dc-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["mermaid"], - u: "1f9dc-200d-2640-fe0f", - v: [ - "1f9dc-1f3fb-200d-2640-fe0f", - "1f9dc-1f3fc-200d-2640-fe0f", - "1f9dc-1f3fd-200d-2640-fe0f", - "1f9dc-1f3fe-200d-2640-fe0f", - "1f9dc-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["elf"], - u: "1f9dd", - v: [ - "1f9dd-1f3fb", - "1f9dd-1f3fc", - "1f9dd-1f3fd", - "1f9dd-1f3fe", - "1f9dd-1f3ff" - ] - }, - { - n: ["man elf", "male elf"], - u: "1f9dd-200d-2642-fe0f", - v: [ - "1f9dd-1f3fb-200d-2642-fe0f", - "1f9dd-1f3fc-200d-2642-fe0f", - "1f9dd-1f3fd-200d-2642-fe0f", - "1f9dd-1f3fe-200d-2642-fe0f", - "1f9dd-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman elf", "female elf"], - u: "1f9dd-200d-2640-fe0f", - v: [ - "1f9dd-1f3fb-200d-2640-fe0f", - "1f9dd-1f3fc-200d-2640-fe0f", - "1f9dd-1f3fd-200d-2640-fe0f", - "1f9dd-1f3fe-200d-2640-fe0f", - "1f9dd-1f3ff-200d-2640-fe0f" - ] - }, - { n: ["genie"], u: "1f9de" }, - { n: ["man genie", "male genie"], u: "1f9de-200d-2642-fe0f" }, - { n: ["woman genie", "female genie"], u: "1f9de-200d-2640-fe0f" }, - { n: ["zombie"], u: "1f9df" }, - { n: ["man zombie", "male zombie"], u: "1f9df-200d-2642-fe0f" }, - { n: ["woman zombie", "female zombie"], u: "1f9df-200d-2640-fe0f" }, - { n: ["troll"], u: "1f9cc" }, - { - n: ["massage", "face massage"], - u: "1f486", - v: [ - "1f486-1f3fb", - "1f486-1f3fc", - "1f486-1f3fd", - "1f486-1f3fe", - "1f486-1f3ff" - ] - }, - { - n: ["man getting massage", "man-getting-massage"], - u: "1f486-200d-2642-fe0f", - v: [ - "1f486-1f3fb-200d-2642-fe0f", - "1f486-1f3fc-200d-2642-fe0f", - "1f486-1f3fd-200d-2642-fe0f", - "1f486-1f3fe-200d-2642-fe0f", - "1f486-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman getting massage", "woman-getting-massage"], - u: "1f486-200d-2640-fe0f", - v: [ - "1f486-1f3fb-200d-2640-fe0f", - "1f486-1f3fc-200d-2640-fe0f", - "1f486-1f3fd-200d-2640-fe0f", - "1f486-1f3fe-200d-2640-fe0f", - "1f486-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["haircut"], - u: "1f487", - v: [ - "1f487-1f3fb", - "1f487-1f3fc", - "1f487-1f3fd", - "1f487-1f3fe", - "1f487-1f3ff" - ] - }, - { - n: ["man getting haircut", "man-getting-haircut"], - u: "1f487-200d-2642-fe0f", - v: [ - "1f487-1f3fb-200d-2642-fe0f", - "1f487-1f3fc-200d-2642-fe0f", - "1f487-1f3fd-200d-2642-fe0f", - "1f487-1f3fe-200d-2642-fe0f", - "1f487-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman getting haircut", "woman-getting-haircut"], - u: "1f487-200d-2640-fe0f", - v: [ - "1f487-1f3fb-200d-2640-fe0f", - "1f487-1f3fc-200d-2640-fe0f", - "1f487-1f3fd-200d-2640-fe0f", - "1f487-1f3fe-200d-2640-fe0f", - "1f487-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["walking", "pedestrian"], - u: "1f6b6", - v: [ - "1f6b6-1f3fb", - "1f6b6-1f3fc", - "1f6b6-1f3fd", - "1f6b6-1f3fe", - "1f6b6-1f3ff" - ] - }, - { - n: ["man walking", "man-walking"], - u: "1f6b6-200d-2642-fe0f", - v: [ - "1f6b6-1f3fb-200d-2642-fe0f", - "1f6b6-1f3fc-200d-2642-fe0f", - "1f6b6-1f3fd-200d-2642-fe0f", - "1f6b6-1f3fe-200d-2642-fe0f", - "1f6b6-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman walking", "woman-walking"], - u: "1f6b6-200d-2640-fe0f", - v: [ - "1f6b6-1f3fb-200d-2640-fe0f", - "1f6b6-1f3fc-200d-2640-fe0f", - "1f6b6-1f3fd-200d-2640-fe0f", - "1f6b6-1f3fe-200d-2640-fe0f", - "1f6b6-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["standing person"], - u: "1f9cd", - v: [ - "1f9cd-1f3fb", - "1f9cd-1f3fc", - "1f9cd-1f3fd", - "1f9cd-1f3fe", - "1f9cd-1f3ff" - ] - }, - { - n: ["man standing"], - u: "1f9cd-200d-2642-fe0f", - v: [ - "1f9cd-1f3fb-200d-2642-fe0f", - "1f9cd-1f3fc-200d-2642-fe0f", - "1f9cd-1f3fd-200d-2642-fe0f", - "1f9cd-1f3fe-200d-2642-fe0f", - "1f9cd-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman standing"], - u: "1f9cd-200d-2640-fe0f", - v: [ - "1f9cd-1f3fb-200d-2640-fe0f", - "1f9cd-1f3fc-200d-2640-fe0f", - "1f9cd-1f3fd-200d-2640-fe0f", - "1f9cd-1f3fe-200d-2640-fe0f", - "1f9cd-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["kneeling person"], - u: "1f9ce", - v: [ - "1f9ce-1f3fb", - "1f9ce-1f3fc", - "1f9ce-1f3fd", - "1f9ce-1f3fe", - "1f9ce-1f3ff" - ] - }, - { - n: ["man kneeling"], - u: "1f9ce-200d-2642-fe0f", - v: [ - "1f9ce-1f3fb-200d-2642-fe0f", - "1f9ce-1f3fc-200d-2642-fe0f", - "1f9ce-1f3fd-200d-2642-fe0f", - "1f9ce-1f3fe-200d-2642-fe0f", - "1f9ce-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman kneeling"], - u: "1f9ce-200d-2640-fe0f", - v: [ - "1f9ce-1f3fb-200d-2640-fe0f", - "1f9ce-1f3fc-200d-2640-fe0f", - "1f9ce-1f3fd-200d-2640-fe0f", - "1f9ce-1f3fe-200d-2640-fe0f", - "1f9ce-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person with white cane", "person with probing cane"], - u: "1f9d1-200d-1f9af", - v: [ - "1f9d1-1f3fb-200d-1f9af", - "1f9d1-1f3fc-200d-1f9af", - "1f9d1-1f3fd-200d-1f9af", - "1f9d1-1f3fe-200d-1f9af", - "1f9d1-1f3ff-200d-1f9af" - ] - }, - { - n: ["man with white cane", "man with probing cane"], - u: "1f468-200d-1f9af", - v: [ - "1f468-1f3fb-200d-1f9af", - "1f468-1f3fc-200d-1f9af", - "1f468-1f3fd-200d-1f9af", - "1f468-1f3fe-200d-1f9af", - "1f468-1f3ff-200d-1f9af" - ] - }, - { - n: ["woman with white cane", "woman with probing cane"], - u: "1f469-200d-1f9af", - v: [ - "1f469-1f3fb-200d-1f9af", - "1f469-1f3fc-200d-1f9af", - "1f469-1f3fd-200d-1f9af", - "1f469-1f3fe-200d-1f9af", - "1f469-1f3ff-200d-1f9af" - ] - }, - { - n: ["person in motorized wheelchair"], - u: "1f9d1-200d-1f9bc", - v: [ - "1f9d1-1f3fb-200d-1f9bc", - "1f9d1-1f3fc-200d-1f9bc", - "1f9d1-1f3fd-200d-1f9bc", - "1f9d1-1f3fe-200d-1f9bc", - "1f9d1-1f3ff-200d-1f9bc" - ] - }, - { - n: ["man in motorized wheelchair"], - u: "1f468-200d-1f9bc", - v: [ - "1f468-1f3fb-200d-1f9bc", - "1f468-1f3fc-200d-1f9bc", - "1f468-1f3fd-200d-1f9bc", - "1f468-1f3fe-200d-1f9bc", - "1f468-1f3ff-200d-1f9bc" - ] - }, - { - n: ["woman in motorized wheelchair"], - u: "1f469-200d-1f9bc", - v: [ - "1f469-1f3fb-200d-1f9bc", - "1f469-1f3fc-200d-1f9bc", - "1f469-1f3fd-200d-1f9bc", - "1f469-1f3fe-200d-1f9bc", - "1f469-1f3ff-200d-1f9bc" - ] - }, - { - n: ["person in manual wheelchair"], - u: "1f9d1-200d-1f9bd", - v: [ - "1f9d1-1f3fb-200d-1f9bd", - "1f9d1-1f3fc-200d-1f9bd", - "1f9d1-1f3fd-200d-1f9bd", - "1f9d1-1f3fe-200d-1f9bd", - "1f9d1-1f3ff-200d-1f9bd" - ] - }, - { - n: ["man in manual wheelchair"], - u: "1f468-200d-1f9bd", - v: [ - "1f468-1f3fb-200d-1f9bd", - "1f468-1f3fc-200d-1f9bd", - "1f468-1f3fd-200d-1f9bd", - "1f468-1f3fe-200d-1f9bd", - "1f468-1f3ff-200d-1f9bd" - ] - }, - { - n: ["woman in manual wheelchair"], - u: "1f469-200d-1f9bd", - v: [ - "1f469-1f3fb-200d-1f9bd", - "1f469-1f3fc-200d-1f9bd", - "1f469-1f3fd-200d-1f9bd", - "1f469-1f3fe-200d-1f9bd", - "1f469-1f3ff-200d-1f9bd" - ] - }, - { - n: ["runner", "running"], - u: "1f3c3", - v: [ - "1f3c3-1f3fb", - "1f3c3-1f3fc", - "1f3c3-1f3fd", - "1f3c3-1f3fe", - "1f3c3-1f3ff" - ] - }, - { - n: ["man running", "man-running"], - u: "1f3c3-200d-2642-fe0f", - v: [ - "1f3c3-1f3fb-200d-2642-fe0f", - "1f3c3-1f3fc-200d-2642-fe0f", - "1f3c3-1f3fd-200d-2642-fe0f", - "1f3c3-1f3fe-200d-2642-fe0f", - "1f3c3-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman running", "woman-running"], - u: "1f3c3-200d-2640-fe0f", - v: [ - "1f3c3-1f3fb-200d-2640-fe0f", - "1f3c3-1f3fc-200d-2640-fe0f", - "1f3c3-1f3fd-200d-2640-fe0f", - "1f3c3-1f3fe-200d-2640-fe0f", - "1f3c3-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["dancer"], - u: "1f483", - v: [ - "1f483-1f3fb", - "1f483-1f3fc", - "1f483-1f3fd", - "1f483-1f3fe", - "1f483-1f3ff" - ] - }, - { - n: ["man dancing"], - u: "1f57a", - v: [ - "1f57a-1f3fb", - "1f57a-1f3fc", - "1f57a-1f3fd", - "1f57a-1f3fe", - "1f57a-1f3ff" - ] - }, - { - n: ["person in suit levitating", "man in business suit levitating"], - u: "1f574-fe0f", - v: [ - "1f574-1f3fb", - "1f574-1f3fc", - "1f574-1f3fd", - "1f574-1f3fe", - "1f574-1f3ff" - ] - }, - { n: ["dancers", "woman with bunny ears"], u: "1f46f" }, - { - n: [ - "men with bunny ears", - "men-with-bunny-ears-partying", - "man-with-bunny-ears-partying" - ], - u: "1f46f-200d-2642-fe0f" - }, - { - n: [ - "women with bunny ears", - "women-with-bunny-ears-partying", - "woman-with-bunny-ears-partying" - ], - u: "1f46f-200d-2640-fe0f" - }, - { - n: ["person in steamy room"], - u: "1f9d6", - v: [ - "1f9d6-1f3fb", - "1f9d6-1f3fc", - "1f9d6-1f3fd", - "1f9d6-1f3fe", - "1f9d6-1f3ff" - ] - }, - { - n: ["man in steamy room"], - u: "1f9d6-200d-2642-fe0f", - v: [ - "1f9d6-1f3fb-200d-2642-fe0f", - "1f9d6-1f3fc-200d-2642-fe0f", - "1f9d6-1f3fd-200d-2642-fe0f", - "1f9d6-1f3fe-200d-2642-fe0f", - "1f9d6-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman in steamy room"], - u: "1f9d6-200d-2640-fe0f", - v: [ - "1f9d6-1f3fb-200d-2640-fe0f", - "1f9d6-1f3fc-200d-2640-fe0f", - "1f9d6-1f3fd-200d-2640-fe0f", - "1f9d6-1f3fe-200d-2640-fe0f", - "1f9d6-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person climbing"], - u: "1f9d7", - v: [ - "1f9d7-1f3fb", - "1f9d7-1f3fc", - "1f9d7-1f3fd", - "1f9d7-1f3fe", - "1f9d7-1f3ff" - ] - }, - { - n: ["man climbing"], - u: "1f9d7-200d-2642-fe0f", - v: [ - "1f9d7-1f3fb-200d-2642-fe0f", - "1f9d7-1f3fc-200d-2642-fe0f", - "1f9d7-1f3fd-200d-2642-fe0f", - "1f9d7-1f3fe-200d-2642-fe0f", - "1f9d7-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman climbing"], - u: "1f9d7-200d-2640-fe0f", - v: [ - "1f9d7-1f3fb-200d-2640-fe0f", - "1f9d7-1f3fc-200d-2640-fe0f", - "1f9d7-1f3fd-200d-2640-fe0f", - "1f9d7-1f3fe-200d-2640-fe0f", - "1f9d7-1f3ff-200d-2640-fe0f" - ] - }, - { n: ["fencer"], u: "1f93a" }, - { - n: ["horse racing"], - u: "1f3c7", - v: [ - "1f3c7-1f3fb", - "1f3c7-1f3fc", - "1f3c7-1f3fd", - "1f3c7-1f3fe", - "1f3c7-1f3ff" - ] - }, - { n: ["skier"], u: "26f7-fe0f" }, - { - n: ["snowboarder"], - u: "1f3c2", - v: [ - "1f3c2-1f3fb", - "1f3c2-1f3fc", - "1f3c2-1f3fd", - "1f3c2-1f3fe", - "1f3c2-1f3ff" - ] - }, - { - n: ["golfer", "person golfing"], - u: "1f3cc-fe0f", - v: [ - "1f3cc-1f3fb", - "1f3cc-1f3fc", - "1f3cc-1f3fd", - "1f3cc-1f3fe", - "1f3cc-1f3ff" - ] - }, - { - n: ["man golfing", "man-golfing"], - u: "1f3cc-fe0f-200d-2642-fe0f", - v: [ - "1f3cc-1f3fb-200d-2642-fe0f", - "1f3cc-1f3fc-200d-2642-fe0f", - "1f3cc-1f3fd-200d-2642-fe0f", - "1f3cc-1f3fe-200d-2642-fe0f", - "1f3cc-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman golfing", "woman-golfing"], - u: "1f3cc-fe0f-200d-2640-fe0f", - v: [ - "1f3cc-1f3fb-200d-2640-fe0f", - "1f3cc-1f3fc-200d-2640-fe0f", - "1f3cc-1f3fd-200d-2640-fe0f", - "1f3cc-1f3fe-200d-2640-fe0f", - "1f3cc-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["surfer"], - u: "1f3c4", - v: [ - "1f3c4-1f3fb", - "1f3c4-1f3fc", - "1f3c4-1f3fd", - "1f3c4-1f3fe", - "1f3c4-1f3ff" - ] - }, - { - n: ["man surfing", "man-surfing"], - u: "1f3c4-200d-2642-fe0f", - v: [ - "1f3c4-1f3fb-200d-2642-fe0f", - "1f3c4-1f3fc-200d-2642-fe0f", - "1f3c4-1f3fd-200d-2642-fe0f", - "1f3c4-1f3fe-200d-2642-fe0f", - "1f3c4-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman surfing", "woman-surfing"], - u: "1f3c4-200d-2640-fe0f", - v: [ - "1f3c4-1f3fb-200d-2640-fe0f", - "1f3c4-1f3fc-200d-2640-fe0f", - "1f3c4-1f3fd-200d-2640-fe0f", - "1f3c4-1f3fe-200d-2640-fe0f", - "1f3c4-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["rowboat"], - u: "1f6a3", - v: [ - "1f6a3-1f3fb", - "1f6a3-1f3fc", - "1f6a3-1f3fd", - "1f6a3-1f3fe", - "1f6a3-1f3ff" - ] - }, - { - n: ["man rowing boat", "man-rowing-boat"], - u: "1f6a3-200d-2642-fe0f", - v: [ - "1f6a3-1f3fb-200d-2642-fe0f", - "1f6a3-1f3fc-200d-2642-fe0f", - "1f6a3-1f3fd-200d-2642-fe0f", - "1f6a3-1f3fe-200d-2642-fe0f", - "1f6a3-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman rowing boat", "woman-rowing-boat"], - u: "1f6a3-200d-2640-fe0f", - v: [ - "1f6a3-1f3fb-200d-2640-fe0f", - "1f6a3-1f3fc-200d-2640-fe0f", - "1f6a3-1f3fd-200d-2640-fe0f", - "1f6a3-1f3fe-200d-2640-fe0f", - "1f6a3-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["swimmer"], - u: "1f3ca", - v: [ - "1f3ca-1f3fb", - "1f3ca-1f3fc", - "1f3ca-1f3fd", - "1f3ca-1f3fe", - "1f3ca-1f3ff" - ] - }, - { - n: ["man swimming", "man-swimming"], - u: "1f3ca-200d-2642-fe0f", - v: [ - "1f3ca-1f3fb-200d-2642-fe0f", - "1f3ca-1f3fc-200d-2642-fe0f", - "1f3ca-1f3fd-200d-2642-fe0f", - "1f3ca-1f3fe-200d-2642-fe0f", - "1f3ca-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman swimming", "woman-swimming"], - u: "1f3ca-200d-2640-fe0f", - v: [ - "1f3ca-1f3fb-200d-2640-fe0f", - "1f3ca-1f3fc-200d-2640-fe0f", - "1f3ca-1f3fd-200d-2640-fe0f", - "1f3ca-1f3fe-200d-2640-fe0f", - "1f3ca-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person with ball", "person bouncing ball"], - u: "26f9-fe0f", - v: ["26f9-1f3fb", "26f9-1f3fc", "26f9-1f3fd", "26f9-1f3fe", "26f9-1f3ff"] - }, - { - n: ["man bouncing ball", "man-bouncing-ball"], - u: "26f9-fe0f-200d-2642-fe0f", - v: [ - "26f9-1f3fb-200d-2642-fe0f", - "26f9-1f3fc-200d-2642-fe0f", - "26f9-1f3fd-200d-2642-fe0f", - "26f9-1f3fe-200d-2642-fe0f", - "26f9-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman bouncing ball", "woman-bouncing-ball"], - u: "26f9-fe0f-200d-2640-fe0f", - v: [ - "26f9-1f3fb-200d-2640-fe0f", - "26f9-1f3fc-200d-2640-fe0f", - "26f9-1f3fd-200d-2640-fe0f", - "26f9-1f3fe-200d-2640-fe0f", - "26f9-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["weight lifter", "person lifting weights"], - u: "1f3cb-fe0f", - v: [ - "1f3cb-1f3fb", - "1f3cb-1f3fc", - "1f3cb-1f3fd", - "1f3cb-1f3fe", - "1f3cb-1f3ff" - ] - }, - { - n: ["man lifting weights", "man-lifting-weights"], - u: "1f3cb-fe0f-200d-2642-fe0f", - v: [ - "1f3cb-1f3fb-200d-2642-fe0f", - "1f3cb-1f3fc-200d-2642-fe0f", - "1f3cb-1f3fd-200d-2642-fe0f", - "1f3cb-1f3fe-200d-2642-fe0f", - "1f3cb-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman lifting weights", "woman-lifting-weights"], - u: "1f3cb-fe0f-200d-2640-fe0f", - v: [ - "1f3cb-1f3fb-200d-2640-fe0f", - "1f3cb-1f3fc-200d-2640-fe0f", - "1f3cb-1f3fd-200d-2640-fe0f", - "1f3cb-1f3fe-200d-2640-fe0f", - "1f3cb-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["bicyclist"], - u: "1f6b4", - v: [ - "1f6b4-1f3fb", - "1f6b4-1f3fc", - "1f6b4-1f3fd", - "1f6b4-1f3fe", - "1f6b4-1f3ff" - ] - }, - { - n: ["man biking", "man-biking"], - u: "1f6b4-200d-2642-fe0f", - v: [ - "1f6b4-1f3fb-200d-2642-fe0f", - "1f6b4-1f3fc-200d-2642-fe0f", - "1f6b4-1f3fd-200d-2642-fe0f", - "1f6b4-1f3fe-200d-2642-fe0f", - "1f6b4-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman biking", "woman-biking"], - u: "1f6b4-200d-2640-fe0f", - v: [ - "1f6b4-1f3fb-200d-2640-fe0f", - "1f6b4-1f3fc-200d-2640-fe0f", - "1f6b4-1f3fd-200d-2640-fe0f", - "1f6b4-1f3fe-200d-2640-fe0f", - "1f6b4-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["mountain bicyclist"], - u: "1f6b5", - v: [ - "1f6b5-1f3fb", - "1f6b5-1f3fc", - "1f6b5-1f3fd", - "1f6b5-1f3fe", - "1f6b5-1f3ff" - ] - }, - { - n: ["man mountain biking", "man-mountain-biking"], - u: "1f6b5-200d-2642-fe0f", - v: [ - "1f6b5-1f3fb-200d-2642-fe0f", - "1f6b5-1f3fc-200d-2642-fe0f", - "1f6b5-1f3fd-200d-2642-fe0f", - "1f6b5-1f3fe-200d-2642-fe0f", - "1f6b5-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman mountain biking", "woman-mountain-biking"], - u: "1f6b5-200d-2640-fe0f", - v: [ - "1f6b5-1f3fb-200d-2640-fe0f", - "1f6b5-1f3fc-200d-2640-fe0f", - "1f6b5-1f3fd-200d-2640-fe0f", - "1f6b5-1f3fe-200d-2640-fe0f", - "1f6b5-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person doing cartwheel"], - u: "1f938", - v: [ - "1f938-1f3fb", - "1f938-1f3fc", - "1f938-1f3fd", - "1f938-1f3fe", - "1f938-1f3ff" - ] - }, - { - n: ["man cartwheeling", "man-cartwheeling"], - u: "1f938-200d-2642-fe0f", - v: [ - "1f938-1f3fb-200d-2642-fe0f", - "1f938-1f3fc-200d-2642-fe0f", - "1f938-1f3fd-200d-2642-fe0f", - "1f938-1f3fe-200d-2642-fe0f", - "1f938-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman cartwheeling", "woman-cartwheeling"], - u: "1f938-200d-2640-fe0f", - v: [ - "1f938-1f3fb-200d-2640-fe0f", - "1f938-1f3fc-200d-2640-fe0f", - "1f938-1f3fd-200d-2640-fe0f", - "1f938-1f3fe-200d-2640-fe0f", - "1f938-1f3ff-200d-2640-fe0f" - ] - }, - { n: ["wrestlers"], u: "1f93c" }, - { n: ["men wrestling", "man-wrestling"], u: "1f93c-200d-2642-fe0f" }, - { n: ["women wrestling", "woman-wrestling"], u: "1f93c-200d-2640-fe0f" }, - { - n: ["water polo"], - u: "1f93d", - v: [ - "1f93d-1f3fb", - "1f93d-1f3fc", - "1f93d-1f3fd", - "1f93d-1f3fe", - "1f93d-1f3ff" - ] - }, - { - n: ["man playing water polo", "man-playing-water-polo"], - u: "1f93d-200d-2642-fe0f", - v: [ - "1f93d-1f3fb-200d-2642-fe0f", - "1f93d-1f3fc-200d-2642-fe0f", - "1f93d-1f3fd-200d-2642-fe0f", - "1f93d-1f3fe-200d-2642-fe0f", - "1f93d-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman playing water polo", "woman-playing-water-polo"], - u: "1f93d-200d-2640-fe0f", - v: [ - "1f93d-1f3fb-200d-2640-fe0f", - "1f93d-1f3fc-200d-2640-fe0f", - "1f93d-1f3fd-200d-2640-fe0f", - "1f93d-1f3fe-200d-2640-fe0f", - "1f93d-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["handball"], - u: "1f93e", - v: [ - "1f93e-1f3fb", - "1f93e-1f3fc", - "1f93e-1f3fd", - "1f93e-1f3fe", - "1f93e-1f3ff" - ] - }, - { - n: ["man playing handball", "man-playing-handball"], - u: "1f93e-200d-2642-fe0f", - v: [ - "1f93e-1f3fb-200d-2642-fe0f", - "1f93e-1f3fc-200d-2642-fe0f", - "1f93e-1f3fd-200d-2642-fe0f", - "1f93e-1f3fe-200d-2642-fe0f", - "1f93e-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman playing handball", "woman-playing-handball"], - u: "1f93e-200d-2640-fe0f", - v: [ - "1f93e-1f3fb-200d-2640-fe0f", - "1f93e-1f3fc-200d-2640-fe0f", - "1f93e-1f3fd-200d-2640-fe0f", - "1f93e-1f3fe-200d-2640-fe0f", - "1f93e-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["juggling"], - u: "1f939", - v: [ - "1f939-1f3fb", - "1f939-1f3fc", - "1f939-1f3fd", - "1f939-1f3fe", - "1f939-1f3ff" - ] - }, - { - n: ["man juggling", "man-juggling"], - u: "1f939-200d-2642-fe0f", - v: [ - "1f939-1f3fb-200d-2642-fe0f", - "1f939-1f3fc-200d-2642-fe0f", - "1f939-1f3fd-200d-2642-fe0f", - "1f939-1f3fe-200d-2642-fe0f", - "1f939-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman juggling", "woman-juggling"], - u: "1f939-200d-2640-fe0f", - v: [ - "1f939-1f3fb-200d-2640-fe0f", - "1f939-1f3fc-200d-2640-fe0f", - "1f939-1f3fd-200d-2640-fe0f", - "1f939-1f3fe-200d-2640-fe0f", - "1f939-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["person in lotus position"], - u: "1f9d8", - v: [ - "1f9d8-1f3fb", - "1f9d8-1f3fc", - "1f9d8-1f3fd", - "1f9d8-1f3fe", - "1f9d8-1f3ff" - ] - }, - { - n: ["man in lotus position"], - u: "1f9d8-200d-2642-fe0f", - v: [ - "1f9d8-1f3fb-200d-2642-fe0f", - "1f9d8-1f3fc-200d-2642-fe0f", - "1f9d8-1f3fd-200d-2642-fe0f", - "1f9d8-1f3fe-200d-2642-fe0f", - "1f9d8-1f3ff-200d-2642-fe0f" - ] - }, - { - n: ["woman in lotus position"], - u: "1f9d8-200d-2640-fe0f", - v: [ - "1f9d8-1f3fb-200d-2640-fe0f", - "1f9d8-1f3fc-200d-2640-fe0f", - "1f9d8-1f3fd-200d-2640-fe0f", - "1f9d8-1f3fe-200d-2640-fe0f", - "1f9d8-1f3ff-200d-2640-fe0f" - ] - }, - { - n: ["bath"], - u: "1f6c0", - v: [ - "1f6c0-1f3fb", - "1f6c0-1f3fc", - "1f6c0-1f3fd", - "1f6c0-1f3fe", - "1f6c0-1f3ff" - ] - }, - { - n: ["sleeping accommodation"], - u: "1f6cc", - v: [ - "1f6cc-1f3fb", - "1f6cc-1f3fc", - "1f6cc-1f3fd", - "1f6cc-1f3fe", - "1f6cc-1f3ff" - ] - }, - { - n: ["people holding hands"], - u: "1f9d1-200d-1f91d-200d-1f9d1", - v: [ - "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fb", - "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fc", - "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fd", - "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fe", - "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3ff", - "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fb", - "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fc", - "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fd", - "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fe", - "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3ff", - "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fb", - "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fc", - "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fd", - "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fe", - "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3ff", - "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fb", - "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fc", - "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fd", - "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fe", - "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3ff", - "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fb", - "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fc", - "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fd", - "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fe", - "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3ff" - ] - }, - { - n: ["women holding hands", "two women holding hands"], - u: "1f46d", - v: [ - "1f46d-1f3fb", - "1f46d-1f3fc", - "1f46d-1f3fd", - "1f46d-1f3fe", - "1f46d-1f3ff", - "1f469-1f3fb-200d-1f91d-200d-1f469-1f3fc", - "1f469-1f3fb-200d-1f91d-200d-1f469-1f3fd", - "1f469-1f3fb-200d-1f91d-200d-1f469-1f3fe", - "1f469-1f3fb-200d-1f91d-200d-1f469-1f3ff", - "1f469-1f3fc-200d-1f91d-200d-1f469-1f3fb", - "1f469-1f3fc-200d-1f91d-200d-1f469-1f3fd", - "1f469-1f3fc-200d-1f91d-200d-1f469-1f3fe", - "1f469-1f3fc-200d-1f91d-200d-1f469-1f3ff", - "1f469-1f3fd-200d-1f91d-200d-1f469-1f3fb", - "1f469-1f3fd-200d-1f91d-200d-1f469-1f3fc", - "1f469-1f3fd-200d-1f91d-200d-1f469-1f3fe", - "1f469-1f3fd-200d-1f91d-200d-1f469-1f3ff", - "1f469-1f3fe-200d-1f91d-200d-1f469-1f3fb", - "1f469-1f3fe-200d-1f91d-200d-1f469-1f3fc", - "1f469-1f3fe-200d-1f91d-200d-1f469-1f3fd", - "1f469-1f3fe-200d-1f91d-200d-1f469-1f3ff", - "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fb", - "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fc", - "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fd", - "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fe" - ] - }, - { - n: [ - "couple", - "man and woman holding hands", - "woman and man holding hands" - ], - u: "1f46b", - v: [ - "1f46b-1f3fb", - "1f46b-1f3fc", - "1f46b-1f3fd", - "1f46b-1f3fe", - "1f46b-1f3ff", - "1f469-1f3fb-200d-1f91d-200d-1f468-1f3fc", - "1f469-1f3fb-200d-1f91d-200d-1f468-1f3fd", - "1f469-1f3fb-200d-1f91d-200d-1f468-1f3fe", - "1f469-1f3fb-200d-1f91d-200d-1f468-1f3ff", - "1f469-1f3fc-200d-1f91d-200d-1f468-1f3fb", - "1f469-1f3fc-200d-1f91d-200d-1f468-1f3fd", - "1f469-1f3fc-200d-1f91d-200d-1f468-1f3fe", - "1f469-1f3fc-200d-1f91d-200d-1f468-1f3ff", - "1f469-1f3fd-200d-1f91d-200d-1f468-1f3fb", - "1f469-1f3fd-200d-1f91d-200d-1f468-1f3fc", - "1f469-1f3fd-200d-1f91d-200d-1f468-1f3fe", - "1f469-1f3fd-200d-1f91d-200d-1f468-1f3ff", - "1f469-1f3fe-200d-1f91d-200d-1f468-1f3fb", - "1f469-1f3fe-200d-1f91d-200d-1f468-1f3fc", - "1f469-1f3fe-200d-1f91d-200d-1f468-1f3fd", - "1f469-1f3fe-200d-1f91d-200d-1f468-1f3ff", - "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fb", - "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fc", - "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fd", - "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fe" - ] - }, - { - n: ["men holding hands", "two men holding hands"], - u: "1f46c", - v: [ - "1f46c-1f3fb", - "1f46c-1f3fc", - "1f46c-1f3fd", - "1f46c-1f3fe", - "1f46c-1f3ff", - "1f468-1f3fb-200d-1f91d-200d-1f468-1f3fc", - "1f468-1f3fb-200d-1f91d-200d-1f468-1f3fd", - "1f468-1f3fb-200d-1f91d-200d-1f468-1f3fe", - "1f468-1f3fb-200d-1f91d-200d-1f468-1f3ff", - "1f468-1f3fc-200d-1f91d-200d-1f468-1f3fb", - "1f468-1f3fc-200d-1f91d-200d-1f468-1f3fd", - "1f468-1f3fc-200d-1f91d-200d-1f468-1f3fe", - "1f468-1f3fc-200d-1f91d-200d-1f468-1f3ff", - "1f468-1f3fd-200d-1f91d-200d-1f468-1f3fb", - "1f468-1f3fd-200d-1f91d-200d-1f468-1f3fc", - "1f468-1f3fd-200d-1f91d-200d-1f468-1f3fe", - "1f468-1f3fd-200d-1f91d-200d-1f468-1f3ff", - "1f468-1f3fe-200d-1f91d-200d-1f468-1f3fb", - "1f468-1f3fe-200d-1f91d-200d-1f468-1f3fc", - "1f468-1f3fe-200d-1f91d-200d-1f468-1f3fd", - "1f468-1f3fe-200d-1f91d-200d-1f468-1f3ff", - "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fb", - "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fc", - "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fd", - "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fe" - ] - }, - { - n: ["kiss", "couplekiss"], - u: "1f48f", - v: [ - "1f48f-1f3fb", - "1f48f-1f3fc", - "1f48f-1f3fd", - "1f48f-1f3fe", - "1f48f-1f3ff", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe" - ] - }, - { - n: ["woman-kiss-man", "kiss: woman, man"], - u: "1f469-200d-2764-fe0f-200d-1f48b-200d-1f468", - v: [ - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff" - ] - }, - { - n: ["man-kiss-man", "kiss: man, man"], - u: "1f468-200d-2764-fe0f-200d-1f48b-200d-1f468", - v: [ - "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", - "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", - "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", - "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", - "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", - "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff" - ] - }, - { - n: ["woman-kiss-woman", "kiss: woman, woman"], - u: "1f469-200d-2764-fe0f-200d-1f48b-200d-1f469", - v: [ - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", - "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", - "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", - "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", - "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", - "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff" - ] - }, - { - n: ["couple with heart"], - u: "1f491", - v: [ - "1f491-1f3fb", - "1f491-1f3fc", - "1f491-1f3fd", - "1f491-1f3fe", - "1f491-1f3ff", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3fc", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3fd", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3fe", - "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3ff", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3fb", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3fd", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3fe", - "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3ff", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3fb", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3fc", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3fe", - "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3ff", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3fb", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3fc", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3fd", - "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3ff", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fb", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fc", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fd", - "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fe" - ] - }, - { - n: ["woman-heart-man", "couple with heart: woman, man"], - u: "1f469-200d-2764-fe0f-200d-1f468", - v: [ - "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fb", - "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fc", - "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fd", - "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fe", - "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3ff", - "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fb", - "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fc", - "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fd", - "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fe", - "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3ff", - "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fb", - "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fc", - "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fd", - "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fe", - "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3ff", - "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fb", - "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fc", - "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fd", - "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fe", - "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3ff", - "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fb", - "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fc", - "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fd", - "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fe", - "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3ff" - ] - }, - { - n: ["man-heart-man", "couple with heart: man, man"], - u: "1f468-200d-2764-fe0f-200d-1f468", - v: [ - "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fb", - "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fc", - "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fd", - "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fe", - "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3ff", - "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fb", - "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fc", - "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fd", - "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fe", - "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3ff", - "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fb", - "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fc", - "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fd", - "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fe", - "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3ff", - "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fb", - "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fc", - "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fd", - "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fe", - "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3ff", - "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fb", - "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fc", - "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fd", - "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fe", - "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3ff" - ] - }, - { - n: ["woman-heart-woman", "couple with heart: woman, woman"], - u: "1f469-200d-2764-fe0f-200d-1f469", - v: [ - "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fb", - "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fc", - "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fd", - "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fe", - "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3ff", - "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fb", - "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fc", - "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fd", - "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fe", - "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3ff", - "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fb", - "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fc", - "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fd", - "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fe", - "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3ff", - "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fb", - "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fc", - "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fd", - "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fe", - "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3ff", - "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fb", - "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fc", - "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fd", - "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fe", - "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3ff" - ] - }, - { n: ["family"], u: "1f46a" }, - { - n: ["man-woman-boy", "family: man, woman, boy"], - u: "1f468-200d-1f469-200d-1f466" - }, - { - n: ["man-woman-girl", "family: man, woman, girl"], - u: "1f468-200d-1f469-200d-1f467" - }, - { - n: ["man-woman-girl-boy", "family: man, woman, girl, boy"], - u: "1f468-200d-1f469-200d-1f467-200d-1f466" - }, - { - n: ["man-woman-boy-boy", "family: man, woman, boy, boy"], - u: "1f468-200d-1f469-200d-1f466-200d-1f466" - }, - { - n: ["man-woman-girl-girl", "family: man, woman, girl, girl"], - u: "1f468-200d-1f469-200d-1f467-200d-1f467" - }, - { - n: ["man-man-boy", "family: man, man, boy"], - u: "1f468-200d-1f468-200d-1f466" - }, - { - n: ["man-man-girl", "family: man, man, girl"], - u: "1f468-200d-1f468-200d-1f467" - }, - { - n: ["man-man-girl-boy", "family: man, man, girl, boy"], - u: "1f468-200d-1f468-200d-1f467-200d-1f466" - }, - { - n: ["man-man-boy-boy", "family: man, man, boy, boy"], - u: "1f468-200d-1f468-200d-1f466-200d-1f466" - }, - { - n: ["man-man-girl-girl", "family: man, man, girl, girl"], - u: "1f468-200d-1f468-200d-1f467-200d-1f467" - }, - { - n: ["woman-woman-boy", "family: woman, woman, boy"], - u: "1f469-200d-1f469-200d-1f466" - }, - { - n: ["woman-woman-girl", "family: woman, woman, girl"], - u: "1f469-200d-1f469-200d-1f467" - }, - { - n: ["woman-woman-girl-boy", "family: woman, woman, girl, boy"], - u: "1f469-200d-1f469-200d-1f467-200d-1f466" - }, - { - n: ["woman-woman-boy-boy", "family: woman, woman, boy, boy"], - u: "1f469-200d-1f469-200d-1f466-200d-1f466" - }, - { - n: ["woman-woman-girl-girl", "family: woman, woman, girl, girl"], - u: "1f469-200d-1f469-200d-1f467-200d-1f467" - }, - { n: ["man-boy", "family: man, boy"], u: "1f468-200d-1f466" }, - { - n: ["man-boy-boy", "family: man, boy, boy"], - u: "1f468-200d-1f466-200d-1f466" - }, - { n: ["man-girl", "family: man, girl"], u: "1f468-200d-1f467" }, - { - n: ["man-girl-boy", "family: man, girl, boy"], - u: "1f468-200d-1f467-200d-1f466" - }, - { - n: ["man-girl-girl", "family: man, girl, girl"], - u: "1f468-200d-1f467-200d-1f467" - }, - { n: ["woman-boy", "family: woman, boy"], u: "1f469-200d-1f466" }, - { - n: ["woman-boy-boy", "family: woman, boy, boy"], - u: "1f469-200d-1f466-200d-1f466" - }, - { n: ["woman-girl", "family: woman, girl"], u: "1f469-200d-1f467" }, - { - n: ["woman-girl-boy", "family: woman, girl, boy"], - u: "1f469-200d-1f467-200d-1f466" - }, - { - n: ["woman-girl-girl", "family: woman, girl, girl"], - u: "1f469-200d-1f467-200d-1f467" - }, - { n: ["speaking head", "speaking head in silhouette"], u: "1f5e3-fe0f" }, - { n: ["bust in silhouette"], u: "1f464" }, - { n: ["busts in silhouette"], u: "1f465" }, - { n: ["people hugging"], u: "1fac2" }, - { n: ["footprints"], u: "1f463" } - ], - animals_nature: [ - { n: ["monkey face"], u: "1f435" }, - { n: ["monkey"], u: "1f412" }, - { n: ["gorilla"], u: "1f98d" }, - { n: ["orangutan"], u: "1f9a7" }, - { n: ["dog", "dog face"], u: "1f436" }, - { n: ["dog", "dog2"], u: "1f415" }, - { n: ["guide dog"], u: "1f9ae" }, - { n: ["service dog"], u: "1f415-200d-1f9ba" }, - { n: ["poodle"], u: "1f429" }, - { n: ["wolf", "wolf face"], u: "1f43a" }, - { n: ["fox face"], u: "1f98a" }, - { n: ["raccoon"], u: "1f99d" }, - { n: ["cat", "cat face"], u: "1f431" }, - { n: ["cat", "cat2"], u: "1f408" }, - { n: ["black cat"], u: "1f408-200d-2b1b" }, - { n: ["lion face"], u: "1f981" }, - { n: ["tiger", "tiger face"], u: "1f42f" }, - { n: ["tiger", "tiger2"], u: "1f405" }, - { n: ["leopard"], u: "1f406" }, - { n: ["horse", "horse face"], u: "1f434" }, - { n: ["horse", "racehorse"], u: "1f40e" }, - { n: ["unicorn face"], u: "1f984" }, - { n: ["zebra face"], u: "1f993" }, - { n: ["deer"], u: "1f98c" }, - { n: ["bison"], u: "1f9ac" }, - { n: ["cow", "cow face"], u: "1f42e" }, - { n: ["ox"], u: "1f402" }, - { n: ["water buffalo"], u: "1f403" }, - { n: ["cow", "cow2"], u: "1f404" }, - { n: ["pig", "pig face"], u: "1f437" }, - { n: ["pig", "pig2"], u: "1f416" }, - { n: ["boar"], u: "1f417" }, - { n: ["pig nose"], u: "1f43d" }, - { n: ["ram"], u: "1f40f" }, - { n: ["sheep"], u: "1f411" }, - { n: ["goat"], u: "1f410" }, - { n: ["dromedary camel"], u: "1f42a" }, - { n: ["camel", "bactrian camel"], u: "1f42b" }, - { n: ["llama"], u: "1f999" }, - { n: ["giraffe face"], u: "1f992" }, - { n: ["elephant"], u: "1f418" }, - { n: ["mammoth"], u: "1f9a3" }, - { n: ["rhinoceros"], u: "1f98f" }, - { n: ["hippopotamus"], u: "1f99b" }, - { n: ["mouse", "mouse face"], u: "1f42d" }, - { n: ["mouse", "mouse2"], u: "1f401" }, - { n: ["rat"], u: "1f400" }, - { n: ["hamster", "hamster face"], u: "1f439" }, - { n: ["rabbit", "rabbit face"], u: "1f430" }, - { n: ["rabbit", "rabbit2"], u: "1f407" }, - { n: ["chipmunk"], u: "1f43f-fe0f" }, - { n: ["beaver"], u: "1f9ab" }, - { n: ["hedgehog"], u: "1f994" }, - { n: ["bat"], u: "1f987" }, - { n: ["bear", "bear face"], u: "1f43b" }, - { n: ["polar bear"], u: "1f43b-200d-2744-fe0f" }, - { n: ["koala"], u: "1f428" }, - { n: ["panda face"], u: "1f43c" }, - { n: ["sloth"], u: "1f9a5" }, - { n: ["otter"], u: "1f9a6" }, - { n: ["skunk"], u: "1f9a8" }, - { n: ["kangaroo"], u: "1f998" }, - { n: ["badger"], u: "1f9a1" }, - { n: ["feet", "paw prints"], u: "1f43e" }, - { n: ["turkey"], u: "1f983" }, - { n: ["chicken"], u: "1f414" }, - { n: ["rooster"], u: "1f413" }, - { n: ["hatching chick"], u: "1f423" }, - { n: ["baby chick"], u: "1f424" }, - { n: ["hatched chick", "front-facing baby chick"], u: "1f425" }, - { n: ["bird"], u: "1f426" }, - { n: ["penguin"], u: "1f427" }, - { n: ["dove", "dove of peace"], u: "1f54a-fe0f" }, - { n: ["eagle"], u: "1f985" }, - { n: ["duck"], u: "1f986" }, - { n: ["swan"], u: "1f9a2" }, - { n: ["owl"], u: "1f989" }, - { n: ["dodo"], u: "1f9a4" }, - { n: ["feather"], u: "1fab6" }, - { n: ["flamingo"], u: "1f9a9" }, - { n: ["peacock"], u: "1f99a" }, - { n: ["parrot"], u: "1f99c" }, - { n: ["frog", "frog face"], u: "1f438" }, - { n: ["crocodile"], u: "1f40a" }, - { n: ["turtle"], u: "1f422" }, - { n: ["lizard"], u: "1f98e" }, - { n: ["snake"], u: "1f40d" }, - { n: ["dragon face"], u: "1f432" }, - { n: ["dragon"], u: "1f409" }, - { n: ["sauropod"], u: "1f995" }, - { n: ["t-rex"], u: "1f996" }, - { n: ["whale", "spouting whale"], u: "1f433" }, - { n: ["whale", "whale2"], u: "1f40b" }, - { n: ["dolphin", "flipper"], u: "1f42c" }, - { n: ["seal"], u: "1f9ad" }, - { n: ["fish"], u: "1f41f" }, - { n: ["tropical fish"], u: "1f420" }, - { n: ["blowfish"], u: "1f421" }, - { n: ["shark"], u: "1f988" }, - { n: ["octopus"], u: "1f419" }, - { n: ["shell", "spiral shell"], u: "1f41a" }, - { n: ["coral"], u: "1fab8" }, - { n: ["snail"], u: "1f40c" }, - { n: ["butterfly"], u: "1f98b" }, - { n: ["bug"], u: "1f41b" }, - { n: ["ant"], u: "1f41c" }, - { n: ["bee", "honeybee"], u: "1f41d" }, - { n: ["beetle"], u: "1fab2" }, - { n: ["ladybug", "lady beetle"], u: "1f41e" }, - { n: ["cricket"], u: "1f997" }, - { n: ["cockroach"], u: "1fab3" }, - { n: ["spider"], u: "1f577-fe0f" }, - { n: ["spider web"], u: "1f578-fe0f" }, - { n: ["scorpion"], u: "1f982" }, - { n: ["mosquito"], u: "1f99f" }, - { n: ["fly"], u: "1fab0" }, - { n: ["worm"], u: "1fab1" }, - { n: ["microbe"], u: "1f9a0" }, - { n: ["bouquet"], u: "1f490" }, - { n: ["cherry blossom"], u: "1f338" }, - { n: ["white flower"], u: "1f4ae" }, - { n: ["lotus"], u: "1fab7" }, - { n: ["rosette"], u: "1f3f5-fe0f" }, - { n: ["rose"], u: "1f339" }, - { n: ["wilted flower"], u: "1f940" }, - { n: ["hibiscus"], u: "1f33a" }, - { n: ["sunflower"], u: "1f33b" }, - { n: ["blossom"], u: "1f33c" }, - { n: ["tulip"], u: "1f337" }, - { n: ["seedling"], u: "1f331" }, - { n: ["potted plant"], u: "1fab4" }, - { n: ["evergreen tree"], u: "1f332" }, - { n: ["deciduous tree"], u: "1f333" }, - { n: ["palm tree"], u: "1f334" }, - { n: ["cactus"], u: "1f335" }, - { n: ["ear of rice"], u: "1f33e" }, - { n: ["herb"], u: "1f33f" }, - { n: ["shamrock"], u: "2618-fe0f" }, - { n: ["four leaf clover"], u: "1f340" }, - { n: ["maple leaf"], u: "1f341" }, - { n: ["fallen leaf"], u: "1f342" }, - { n: ["leaves", "leaf fluttering in wind"], u: "1f343" }, - { n: ["empty nest"], u: "1fab9" }, - { n: ["nest with eggs"], u: "1faba" } - ], - food_drink: [ - { n: ["grapes"], u: "1f347" }, - { n: ["melon"], u: "1f348" }, - { n: ["watermelon"], u: "1f349" }, - { n: ["tangerine"], u: "1f34a" }, - { n: ["lemon"], u: "1f34b" }, - { n: ["banana"], u: "1f34c" }, - { n: ["pineapple"], u: "1f34d" }, - { n: ["mango"], u: "1f96d" }, - { n: ["apple", "red apple"], u: "1f34e" }, - { n: ["green apple"], u: "1f34f" }, - { n: ["pear"], u: "1f350" }, - { n: ["peach"], u: "1f351" }, - { n: ["cherries"], u: "1f352" }, - { n: ["strawberry"], u: "1f353" }, - { n: ["blueberries"], u: "1fad0" }, - { n: ["kiwifruit"], u: "1f95d" }, - { n: ["tomato"], u: "1f345" }, - { n: ["olive"], u: "1fad2" }, - { n: ["coconut"], u: "1f965" }, - { n: ["avocado"], u: "1f951" }, - { n: ["eggplant", "aubergine"], u: "1f346" }, - { n: ["potato"], u: "1f954" }, - { n: ["carrot"], u: "1f955" }, - { n: ["corn", "ear of maize"], u: "1f33d" }, - { n: ["hot pepper"], u: "1f336-fe0f" }, - { n: ["bell pepper"], u: "1fad1" }, - { n: ["cucumber"], u: "1f952" }, - { n: ["leafy green"], u: "1f96c" }, - { n: ["broccoli"], u: "1f966" }, - { n: ["garlic"], u: "1f9c4" }, - { n: ["onion"], u: "1f9c5" }, - { n: ["mushroom"], u: "1f344" }, - { n: ["peanuts"], u: "1f95c" }, - { n: ["beans"], u: "1fad8" }, - { n: ["chestnut"], u: "1f330" }, - { n: ["bread"], u: "1f35e" }, - { n: ["croissant"], u: "1f950" }, - { n: ["baguette bread"], u: "1f956" }, - { n: ["flatbread"], u: "1fad3" }, - { n: ["pretzel"], u: "1f968" }, - { n: ["bagel"], u: "1f96f" }, - { n: ["pancakes"], u: "1f95e" }, - { n: ["waffle"], u: "1f9c7" }, - { n: ["cheese wedge"], u: "1f9c0" }, - { n: ["meat on bone"], u: "1f356" }, - { n: ["poultry leg"], u: "1f357" }, - { n: ["cut of meat"], u: "1f969" }, - { n: ["bacon"], u: "1f953" }, - { n: ["hamburger"], u: "1f354" }, - { n: ["fries", "french fries"], u: "1f35f" }, - { n: ["pizza", "slice of pizza"], u: "1f355" }, - { n: ["hotdog", "hot dog"], u: "1f32d" }, - { n: ["sandwich"], u: "1f96a" }, - { n: ["taco"], u: "1f32e" }, - { n: ["burrito"], u: "1f32f" }, - { n: ["tamale"], u: "1fad4" }, - { n: ["stuffed flatbread"], u: "1f959" }, - { n: ["falafel"], u: "1f9c6" }, - { n: ["egg"], u: "1f95a" }, - { n: ["cooking", "fried egg"], u: "1f373" }, - { n: ["shallow pan of food"], u: "1f958" }, - { n: ["stew", "pot of food"], u: "1f372" }, - { n: ["fondue"], u: "1fad5" }, - { n: ["bowl with spoon"], u: "1f963" }, - { n: ["green salad"], u: "1f957" }, - { n: ["popcorn"], u: "1f37f" }, - { n: ["butter"], u: "1f9c8" }, - { n: ["salt", "salt shaker"], u: "1f9c2" }, - { n: ["canned food"], u: "1f96b" }, - { n: ["bento", "bento box"], u: "1f371" }, - { n: ["rice cracker"], u: "1f358" }, - { n: ["rice ball"], u: "1f359" }, - { n: ["rice", "cooked rice"], u: "1f35a" }, - { n: ["curry", "curry and rice"], u: "1f35b" }, - { n: ["ramen", "steaming bowl"], u: "1f35c" }, - { n: ["spaghetti"], u: "1f35d" }, - { n: ["sweet potato", "roasted sweet potato"], u: "1f360" }, - { n: ["oden"], u: "1f362" }, - { n: ["sushi"], u: "1f363" }, - { n: ["fried shrimp"], u: "1f364" }, - { n: ["fish cake", "fish cake with swirl design"], u: "1f365" }, - { n: ["moon cake"], u: "1f96e" }, - { n: ["dango"], u: "1f361" }, - { n: ["dumpling"], u: "1f95f" }, - { n: ["fortune cookie"], u: "1f960" }, - { n: ["takeout box"], u: "1f961" }, - { n: ["crab"], u: "1f980" }, - { n: ["lobster"], u: "1f99e" }, - { n: ["shrimp"], u: "1f990" }, - { n: ["squid"], u: "1f991" }, - { n: ["oyster"], u: "1f9aa" }, - { n: ["icecream", "soft ice cream"], u: "1f366" }, - { n: ["shaved ice"], u: "1f367" }, - { n: ["ice cream"], u: "1f368" }, - { n: ["doughnut"], u: "1f369" }, - { n: ["cookie"], u: "1f36a" }, - { n: ["birthday", "birthday cake"], u: "1f382" }, - { n: ["cake", "shortcake"], u: "1f370" }, - { n: ["cupcake"], u: "1f9c1" }, - { n: ["pie"], u: "1f967" }, - { n: ["chocolate bar"], u: "1f36b" }, - { n: ["candy"], u: "1f36c" }, - { n: ["lollipop"], u: "1f36d" }, - { n: ["custard"], u: "1f36e" }, - { n: ["honey pot"], u: "1f36f" }, - { n: ["baby bottle"], u: "1f37c" }, - { n: ["glass of milk"], u: "1f95b" }, - { n: ["coffee", "hot beverage"], u: "2615" }, - { n: ["teapot"], u: "1fad6" }, - { n: ["tea", "teacup without handle"], u: "1f375" }, - { n: ["sake", "sake bottle and cup"], u: "1f376" }, - { n: ["champagne", "bottle with popping cork"], u: "1f37e" }, - { n: ["wine glass"], u: "1f377" }, - { n: ["cocktail", "cocktail glass"], u: "1f378" }, - { n: ["tropical drink"], u: "1f379" }, - { n: ["beer", "beer mug"], u: "1f37a" }, - { n: ["beers", "clinking beer mugs"], u: "1f37b" }, - { n: ["clinking glasses"], u: "1f942" }, - { n: ["tumbler glass"], u: "1f943" }, - { n: ["pouring liquid"], u: "1fad7" }, - { n: ["cup with straw"], u: "1f964" }, - { n: ["bubble tea"], u: "1f9cb" }, - { n: ["beverage box"], u: "1f9c3" }, - { n: ["mate drink"], u: "1f9c9" }, - { n: ["ice cube"], u: "1f9ca" }, - { n: ["chopsticks"], u: "1f962" }, - { n: ["knife fork plate", "fork and knife with plate"], u: "1f37d-fe0f" }, - { n: ["fork and knife"], u: "1f374" }, - { n: ["spoon"], u: "1f944" }, - { n: ["hocho", "knife"], u: "1f52a" }, - { n: ["jar"], u: "1fad9" }, - { n: ["amphora"], u: "1f3fa" } - ], - travel_places: [ - { n: ["earth africa", "earth globe europe-africa"], u: "1f30d" }, - { n: ["earth americas", "earth globe americas"], u: "1f30e" }, - { n: ["earth asia", "earth globe asia-australia"], u: "1f30f" }, - { n: ["globe with meridians"], u: "1f310" }, - { n: ["world map"], u: "1f5fa-fe0f" }, - { n: ["japan", "silhouette of japan"], u: "1f5fe" }, - { n: ["compass"], u: "1f9ed" }, - { n: ["snow-capped mountain", "snow capped mountain"], u: "1f3d4-fe0f" }, - { n: ["mountain"], u: "26f0-fe0f" }, - { n: ["volcano"], u: "1f30b" }, - { n: ["mount fuji"], u: "1f5fb" }, - { n: ["camping"], u: "1f3d5-fe0f" }, - { n: ["beach with umbrella"], u: "1f3d6-fe0f" }, - { n: ["desert"], u: "1f3dc-fe0f" }, - { n: ["desert island"], u: "1f3dd-fe0f" }, - { n: ["national park"], u: "1f3de-fe0f" }, - { n: ["stadium"], u: "1f3df-fe0f" }, - { n: ["classical building"], u: "1f3db-fe0f" }, - { n: ["building construction"], u: "1f3d7-fe0f" }, - { n: ["brick", "bricks"], u: "1f9f1" }, - { n: ["rock"], u: "1faa8" }, - { n: ["wood"], u: "1fab5" }, - { n: ["hut"], u: "1f6d6" }, - { n: ["houses", "house buildings"], u: "1f3d8-fe0f" }, - { n: ["derelict house", "derelict house building"], u: "1f3da-fe0f" }, - { n: ["house", "house building"], u: "1f3e0" }, - { n: ["house with garden"], u: "1f3e1" }, - { n: ["office", "office building"], u: "1f3e2" }, - { n: ["post office", "japanese post office"], u: "1f3e3" }, - { n: ["european post office"], u: "1f3e4" }, - { n: ["hospital"], u: "1f3e5" }, - { n: ["bank"], u: "1f3e6" }, - { n: ["hotel"], u: "1f3e8" }, - { n: ["love hotel"], u: "1f3e9" }, - { n: ["convenience store"], u: "1f3ea" }, - { n: ["school"], u: "1f3eb" }, - { n: ["department store"], u: "1f3ec" }, - { n: ["factory"], u: "1f3ed" }, - { n: ["japanese castle"], u: "1f3ef" }, - { n: ["european castle"], u: "1f3f0" }, - { n: ["wedding"], u: "1f492" }, - { n: ["tokyo tower"], u: "1f5fc" }, - { n: ["statue of liberty"], u: "1f5fd" }, - { n: ["church"], u: "26ea" }, - { n: ["mosque"], u: "1f54c" }, - { n: ["hindu temple"], u: "1f6d5" }, - { n: ["synagogue"], u: "1f54d" }, - { n: ["shinto shrine"], u: "26e9-fe0f" }, - { n: ["kaaba"], u: "1f54b" }, - { n: ["fountain"], u: "26f2" }, - { n: ["tent"], u: "26fa" }, - { n: ["foggy"], u: "1f301" }, - { n: ["night with stars"], u: "1f303" }, - { n: ["cityscape"], u: "1f3d9-fe0f" }, - { n: ["sunrise over mountains"], u: "1f304" }, - { n: ["sunrise"], u: "1f305" }, - { n: ["city sunset", "cityscape at dusk"], u: "1f306" }, - { n: ["city sunrise", "sunset over buildings"], u: "1f307" }, - { n: ["bridge at night"], u: "1f309" }, - { n: ["hotsprings", "hot springs"], u: "2668-fe0f" }, - { n: ["carousel horse"], u: "1f3a0" }, - { n: ["playground slide"], u: "1f6dd" }, - { n: ["ferris wheel"], u: "1f3a1" }, - { n: ["roller coaster"], u: "1f3a2" }, - { n: ["barber", "barber pole"], u: "1f488" }, - { n: ["circus tent"], u: "1f3aa" }, - { n: ["steam locomotive"], u: "1f682" }, - { n: ["railway car"], u: "1f683" }, - { n: ["high-speed train", "bullettrain side"], u: "1f684" }, - { - n: ["bullettrain front", "high-speed train with bullet nose"], - u: "1f685" - }, - { n: ["train", "train2"], u: "1f686" }, - { n: ["metro"], u: "1f687" }, - { n: ["light rail"], u: "1f688" }, - { n: ["station"], u: "1f689" }, - { n: ["tram"], u: "1f68a" }, - { n: ["monorail"], u: "1f69d" }, - { n: ["mountain railway"], u: "1f69e" }, - { n: ["train", "tram car"], u: "1f68b" }, - { n: ["bus"], u: "1f68c" }, - { n: ["oncoming bus"], u: "1f68d" }, - { n: ["trolleybus"], u: "1f68e" }, - { n: ["minibus"], u: "1f690" }, - { n: ["ambulance"], u: "1f691" }, - { n: ["fire engine"], u: "1f692" }, - { n: ["police car"], u: "1f693" }, - { n: ["oncoming police car"], u: "1f694" }, - { n: ["taxi"], u: "1f695" }, - { n: ["oncoming taxi"], u: "1f696" }, - { n: ["car", "red car", "automobile"], u: "1f697" }, - { n: ["oncoming automobile"], u: "1f698" }, - { n: ["blue car", "recreational vehicle"], u: "1f699" }, - { n: ["pickup truck"], u: "1f6fb" }, - { n: ["truck", "delivery truck"], u: "1f69a" }, - { n: ["articulated lorry"], u: "1f69b" }, - { n: ["tractor"], u: "1f69c" }, - { n: ["racing car"], u: "1f3ce-fe0f" }, - { n: ["motorcycle", "racing motorcycle"], u: "1f3cd-fe0f" }, - { n: ["motor scooter"], u: "1f6f5" }, - { n: ["manual wheelchair"], u: "1f9bd" }, - { n: ["motorized wheelchair"], u: "1f9bc" }, - { n: ["auto rickshaw"], u: "1f6fa" }, - { n: ["bike", "bicycle"], u: "1f6b2" }, - { n: ["scooter"], u: "1f6f4" }, - { n: ["skateboard"], u: "1f6f9" }, - { n: ["roller skate"], u: "1f6fc" }, - { n: ["busstop", "bus stop"], u: "1f68f" }, - { n: ["motorway"], u: "1f6e3-fe0f" }, - { n: ["railway track"], u: "1f6e4-fe0f" }, - { n: ["oil drum"], u: "1f6e2-fe0f" }, - { n: ["fuelpump", "fuel pump"], u: "26fd" }, - { n: ["wheel"], u: "1f6de" }, - { n: ["rotating light", "police cars revolving light"], u: "1f6a8" }, - { n: ["traffic light", "horizontal traffic light"], u: "1f6a5" }, - { n: ["vertical traffic light"], u: "1f6a6" }, - { n: ["octagonal sign"], u: "1f6d1" }, - { n: ["construction", "construction sign"], u: "1f6a7" }, - { n: ["anchor"], u: "2693" }, - { n: ["ring buoy"], u: "1f6df" }, - { n: ["boat", "sailboat"], u: "26f5" }, - { n: ["canoe"], u: "1f6f6" }, - { n: ["speedboat"], u: "1f6a4" }, - { n: ["passenger ship"], u: "1f6f3-fe0f" }, - { n: ["ferry"], u: "26f4-fe0f" }, - { n: ["motor boat"], u: "1f6e5-fe0f" }, - { n: ["ship"], u: "1f6a2" }, - { n: ["airplane"], u: "2708-fe0f" }, - { n: ["small airplane"], u: "1f6e9-fe0f" }, - { n: ["airplane departure"], u: "1f6eb" }, - { n: ["airplane arriving"], u: "1f6ec" }, - { n: ["parachute"], u: "1fa82" }, - { n: ["seat"], u: "1f4ba" }, - { n: ["helicopter"], u: "1f681" }, - { n: ["suspension railway"], u: "1f69f" }, - { n: ["mountain cableway"], u: "1f6a0" }, - { n: ["aerial tramway"], u: "1f6a1" }, - { n: ["satellite"], u: "1f6f0-fe0f" }, - { n: ["rocket"], u: "1f680" }, - { n: ["flying saucer"], u: "1f6f8" }, - { n: ["bellhop bell"], u: "1f6ce-fe0f" }, - { n: ["luggage"], u: "1f9f3" }, - { n: ["hourglass"], u: "231b" }, - { n: ["hourglass flowing sand", "hourglass with flowing sand"], u: "23f3" }, - { n: ["watch"], u: "231a" }, - { n: ["alarm clock"], u: "23f0" }, - { n: ["stopwatch"], u: "23f1-fe0f" }, - { n: ["timer clock"], u: "23f2-fe0f" }, - { n: ["mantelpiece clock"], u: "1f570-fe0f" }, - { n: ["clock12", "clock face twelve oclock"], u: "1f55b" }, - { n: ["clock1230", "clock face twelve-thirty"], u: "1f567" }, - { n: ["clock1", "clock face one oclock"], u: "1f550" }, - { n: ["clock130", "clock face one-thirty"], u: "1f55c" }, - { n: ["clock2", "clock face two oclock"], u: "1f551" }, - { n: ["clock230", "clock face two-thirty"], u: "1f55d" }, - { n: ["clock3", "clock face three oclock"], u: "1f552" }, - { n: ["clock330", "clock face three-thirty"], u: "1f55e" }, - { n: ["clock4", "clock face four oclock"], u: "1f553" }, - { n: ["clock430", "clock face four-thirty"], u: "1f55f" }, - { n: ["clock5", "clock face five oclock"], u: "1f554" }, - { n: ["clock530", "clock face five-thirty"], u: "1f560" }, - { n: ["clock6", "clock face six oclock"], u: "1f555" }, - { n: ["clock630", "clock face six-thirty"], u: "1f561" }, - { n: ["clock7", "clock face seven oclock"], u: "1f556" }, - { n: ["clock730", "clock face seven-thirty"], u: "1f562" }, - { n: ["clock8", "clock face eight oclock"], u: "1f557" }, - { n: ["clock830", "clock face eight-thirty"], u: "1f563" }, - { n: ["clock9", "clock face nine oclock"], u: "1f558" }, - { n: ["clock930", "clock face nine-thirty"], u: "1f564" }, - { n: ["clock10", "clock face ten oclock"], u: "1f559" }, - { n: ["clock1030", "clock face ten-thirty"], u: "1f565" }, - { n: ["clock11", "clock face eleven oclock"], u: "1f55a" }, - { n: ["clock1130", "clock face eleven-thirty"], u: "1f566" }, - { n: ["new moon", "new moon symbol"], u: "1f311" }, - { n: ["waxing crescent moon", "waxing crescent moon symbol"], u: "1f312" }, - { n: ["first quarter moon", "first quarter moon symbol"], u: "1f313" }, - { - n: ["moon", "waxing gibbous moon", "waxing gibbous moon symbol"], - u: "1f314" - }, - { n: ["full moon", "full moon symbol"], u: "1f315" }, - { n: ["waning gibbous moon", "waning gibbous moon symbol"], u: "1f316" }, - { n: ["last quarter moon", "last quarter moon symbol"], u: "1f317" }, - { n: ["waning crescent moon", "waning crescent moon symbol"], u: "1f318" }, - { n: ["crescent moon"], u: "1f319" }, - { n: ["new moon with face"], u: "1f31a" }, - { n: ["first quarter moon with face"], u: "1f31b" }, - { n: ["last quarter moon with face"], u: "1f31c" }, - { n: ["thermometer"], u: "1f321-fe0f" }, - { n: ["sunny", "black sun with rays"], u: "2600-fe0f" }, - { n: ["full moon with face"], u: "1f31d" }, - { n: ["sun with face"], u: "1f31e" }, - { n: ["ringed planet"], u: "1fa90" }, - { n: ["star", "white medium star"], u: "2b50" }, - { n: ["star2", "glowing star"], u: "1f31f" }, - { n: ["stars", "shooting star"], u: "1f320" }, - { n: ["milky way"], u: "1f30c" }, - { n: ["cloud"], u: "2601-fe0f" }, - { n: ["partly sunny", "sun behind cloud"], u: "26c5" }, - { - n: ["thunder cloud and rain", "cloud with lightning and rain"], - u: "26c8-fe0f" - }, - { - n: ["mostly sunny", "sun small cloud", "sun behind small cloud"], - u: "1f324-fe0f" - }, - { - n: ["barely sunny", "sun behind cloud", "sun behind large cloud"], - u: "1f325-fe0f" - }, - { n: ["partly sunny rain", "sun behind rain cloud"], u: "1f326-fe0f" }, - { n: ["rain cloud", "cloud with rain"], u: "1f327-fe0f" }, - { n: ["snow cloud", "cloud with snow"], u: "1f328-fe0f" }, - { - n: ["lightning", "lightning cloud", "cloud with lightning"], - u: "1f329-fe0f" - }, - { n: ["tornado", "tornado cloud"], u: "1f32a-fe0f" }, - { n: ["fog"], u: "1f32b-fe0f" }, - { n: ["wind face", "wind blowing face"], u: "1f32c-fe0f" }, - { n: ["cyclone"], u: "1f300" }, - { n: ["rainbow"], u: "1f308" }, - { n: ["closed umbrella"], u: "1f302" }, - { n: ["umbrella"], u: "2602-fe0f" }, - { n: ["umbrella with rain drops"], u: "2614" }, - { n: ["umbrella on ground"], u: "26f1-fe0f" }, - { n: ["zap", "high voltage sign"], u: "26a1" }, - { n: ["snowflake"], u: "2744-fe0f" }, - { n: ["snowman"], u: "2603-fe0f" }, - { n: ["snowman without snow"], u: "26c4" }, - { n: ["comet"], u: "2604-fe0f" }, - { n: ["fire"], u: "1f525" }, - { n: ["droplet"], u: "1f4a7" }, - { n: ["ocean", "water wave"], u: "1f30a" } - ], - activities: [ - { n: ["jack-o-lantern", "jack o lantern"], u: "1f383" }, - { n: ["christmas tree"], u: "1f384" }, - { n: ["fireworks"], u: "1f386" }, - { n: ["sparkler", "firework sparkler"], u: "1f387" }, - { n: ["firecracker"], u: "1f9e8" }, - { n: ["sparkles"], u: "2728" }, - { n: ["balloon"], u: "1f388" }, - { n: ["tada", "party popper"], u: "1f389" }, - { n: ["confetti ball"], u: "1f38a" }, - { n: ["tanabata tree"], u: "1f38b" }, - { n: ["bamboo", "pine decoration"], u: "1f38d" }, - { n: ["dolls", "japanese dolls"], u: "1f38e" }, - { n: ["flags", "carp streamer"], u: "1f38f" }, - { n: ["wind chime"], u: "1f390" }, - { n: ["rice scene", "moon viewing ceremony"], u: "1f391" }, - { n: ["red envelope", "red gift envelope"], u: "1f9e7" }, - { n: ["ribbon"], u: "1f380" }, - { n: ["gift", "wrapped present"], u: "1f381" }, - { n: ["reminder ribbon"], u: "1f397-fe0f" }, - { n: ["admission tickets"], u: "1f39f-fe0f" }, - { n: ["ticket"], u: "1f3ab" }, - { n: ["medal", "military medal"], u: "1f396-fe0f" }, - { n: ["trophy"], u: "1f3c6" }, - { n: ["sports medal"], u: "1f3c5" }, - { n: ["first place medal"], u: "1f947" }, - { n: ["second place medal"], u: "1f948" }, - { n: ["third place medal"], u: "1f949" }, - { n: ["soccer", "soccer ball"], u: "26bd" }, - { n: ["baseball"], u: "26be" }, - { n: ["softball"], u: "1f94e" }, - { n: ["basketball", "basketball and hoop"], u: "1f3c0" }, - { n: ["volleyball"], u: "1f3d0" }, - { n: ["football", "american football"], u: "1f3c8" }, - { n: ["rugby football"], u: "1f3c9" }, - { n: ["tennis", "tennis racquet and ball"], u: "1f3be" }, - { n: ["flying disc"], u: "1f94f" }, - { n: ["bowling"], u: "1f3b3" }, - { n: ["cricket bat and ball"], u: "1f3cf" }, - { n: ["field hockey stick and ball"], u: "1f3d1" }, - { n: ["ice hockey stick and puck"], u: "1f3d2" }, - { n: ["lacrosse", "lacrosse stick and ball"], u: "1f94d" }, - { n: ["table tennis paddle and ball"], u: "1f3d3" }, - { n: ["badminton racquet and shuttlecock"], u: "1f3f8" }, - { n: ["boxing glove"], u: "1f94a" }, - { n: ["martial arts uniform"], u: "1f94b" }, - { n: ["goal net"], u: "1f945" }, - { n: ["golf", "flag in hole"], u: "26f3" }, - { n: ["ice skate"], u: "26f8-fe0f" }, - { n: ["fishing pole and fish"], u: "1f3a3" }, - { n: ["diving mask"], u: "1f93f" }, - { n: ["running shirt with sash"], u: "1f3bd" }, - { n: ["ski", "ski and ski boot"], u: "1f3bf" }, - { n: ["sled"], u: "1f6f7" }, - { n: ["curling stone"], u: "1f94c" }, - { n: ["dart", "direct hit"], u: "1f3af" }, - { n: ["yo-yo"], u: "1fa80" }, - { n: ["kite"], u: "1fa81" }, - { n: ["8ball", "billiards"], u: "1f3b1" }, - { n: ["crystal ball"], u: "1f52e" }, - { n: ["magic wand"], u: "1fa84" }, - { n: ["nazar amulet"], u: "1f9ff" }, - { n: ["hamsa"], u: "1faac" }, - { n: ["video game"], u: "1f3ae" }, - { n: ["joystick"], u: "1f579-fe0f" }, - { n: ["slot machine"], u: "1f3b0" }, - { n: ["game die"], u: "1f3b2" }, - { n: ["jigsaw", "jigsaw puzzle piece"], u: "1f9e9" }, - { n: ["teddy bear"], u: "1f9f8" }, - { n: ["pinata"], u: "1fa85" }, - { n: ["mirror ball"], u: "1faa9" }, - { n: ["nesting dolls"], u: "1fa86" }, - { n: ["spades", "black spade suit"], u: "2660-fe0f" }, - { n: ["hearts", "black heart suit"], u: "2665-fe0f" }, - { n: ["diamonds", "black diamond suit"], u: "2666-fe0f" }, - { n: ["clubs", "black club suit"], u: "2663-fe0f" }, - { n: ["chess pawn"], u: "265f-fe0f" }, - { n: ["black joker", "playing card black joker"], u: "1f0cf" }, - { n: ["mahjong", "mahjong tile red dragon"], u: "1f004" }, - { n: ["flower playing cards"], u: "1f3b4" }, - { n: ["performing arts"], u: "1f3ad" }, - { n: ["framed picture", "frame with picture"], u: "1f5bc-fe0f" }, - { n: ["art", "artist palette"], u: "1f3a8" }, - { n: ["thread", "spool of thread"], u: "1f9f5" }, - { n: ["sewing needle"], u: "1faa1" }, - { n: ["yarn", "ball of yarn"], u: "1f9f6" }, - { n: ["knot"], u: "1faa2" } - ], - objects: [ - { n: ["eyeglasses"], u: "1f453" }, - { n: ["sunglasses", "dark sunglasses"], u: "1f576-fe0f" }, - { n: ["goggles"], u: "1f97d" }, - { n: ["lab coat"], u: "1f97c" }, - { n: ["safety vest"], u: "1f9ba" }, - { n: ["necktie"], u: "1f454" }, - { n: ["shirt", "tshirt", "t-shirt"], u: "1f455" }, - { n: ["jeans"], u: "1f456" }, - { n: ["scarf"], u: "1f9e3" }, - { n: ["gloves"], u: "1f9e4" }, - { n: ["coat"], u: "1f9e5" }, - { n: ["socks"], u: "1f9e6" }, - { n: ["dress"], u: "1f457" }, - { n: ["kimono"], u: "1f458" }, - { n: ["sari"], u: "1f97b" }, - { n: ["one-piece swimsuit"], u: "1fa71" }, - { n: ["briefs"], u: "1fa72" }, - { n: ["shorts"], u: "1fa73" }, - { n: ["bikini"], u: "1f459" }, - { n: ["womans clothes"], u: "1f45a" }, - { n: ["purse"], u: "1f45b" }, - { n: ["handbag"], u: "1f45c" }, - { n: ["pouch"], u: "1f45d" }, - { n: ["shopping bags"], u: "1f6cd-fe0f" }, - { n: ["school satchel"], u: "1f392" }, - { n: ["thong sandal"], u: "1fa74" }, - { n: ["shoe", "mans shoe"], u: "1f45e" }, - { n: ["athletic shoe"], u: "1f45f" }, - { n: ["hiking boot"], u: "1f97e" }, - { n: ["flat shoe", "womans flat shoe"], u: "1f97f" }, - { n: ["high heel", "high-heeled shoe"], u: "1f460" }, - { n: ["sandal", "womans sandal"], u: "1f461" }, - { n: ["ballet shoes"], u: "1fa70" }, - { n: ["boot", "womans boots"], u: "1f462" }, - { n: ["crown"], u: "1f451" }, - { n: ["womans hat"], u: "1f452" }, - { n: ["tophat", "top hat"], u: "1f3a9" }, - { n: ["mortar board", "graduation cap"], u: "1f393" }, - { n: ["billed cap"], u: "1f9e2" }, - { n: ["military helmet"], u: "1fa96" }, - { - n: ["rescue worker\u2019s helmet", "helmet with white cross"], - u: "26d1-fe0f" - }, - { n: ["prayer beads"], u: "1f4ff" }, - { n: ["lipstick"], u: "1f484" }, - { n: ["ring"], u: "1f48d" }, - { n: ["gem", "gem stone"], u: "1f48e" }, - { n: ["mute", "speaker with cancellation stroke"], u: "1f507" }, - { n: ["speaker"], u: "1f508" }, - { n: ["sound", "speaker with one sound wave"], u: "1f509" }, - { n: ["loud sound", "speaker with three sound waves"], u: "1f50a" }, - { n: ["loudspeaker", "public address loudspeaker"], u: "1f4e2" }, - { n: ["mega", "cheering megaphone"], u: "1f4e3" }, - { n: ["postal horn"], u: "1f4ef" }, - { n: ["bell"], u: "1f514" }, - { n: ["no bell", "bell with cancellation stroke"], u: "1f515" }, - { n: ["musical score"], u: "1f3bc" }, - { n: ["musical note"], u: "1f3b5" }, - { n: ["notes", "multiple musical notes"], u: "1f3b6" }, - { n: ["studio microphone"], u: "1f399-fe0f" }, - { n: ["level slider"], u: "1f39a-fe0f" }, - { n: ["control knobs"], u: "1f39b-fe0f" }, - { n: ["microphone"], u: "1f3a4" }, - { n: ["headphone", "headphones"], u: "1f3a7" }, - { n: ["radio"], u: "1f4fb" }, - { n: ["saxophone"], u: "1f3b7" }, - { n: ["accordion"], u: "1fa97" }, - { n: ["guitar"], u: "1f3b8" }, - { n: ["musical keyboard"], u: "1f3b9" }, - { n: ["trumpet"], u: "1f3ba" }, - { n: ["violin"], u: "1f3bb" }, - { n: ["banjo"], u: "1fa95" }, - { n: ["drum with drumsticks"], u: "1f941" }, - { n: ["long drum"], u: "1fa98" }, - { n: ["iphone", "mobile phone"], u: "1f4f1" }, - { - n: ["calling", "mobile phone with rightwards arrow at left"], - u: "1f4f2" - }, - { n: ["phone", "telephone", "black telephone"], u: "260e-fe0f" }, - { n: ["telephone receiver"], u: "1f4de" }, - { n: ["pager"], u: "1f4df" }, - { n: ["fax", "fax machine"], u: "1f4e0" }, - { n: ["battery"], u: "1f50b" }, - { n: ["low battery"], u: "1faab" }, - { n: ["electric plug"], u: "1f50c" }, - { n: ["computer", "personal computer"], u: "1f4bb" }, - { n: ["desktop computer"], u: "1f5a5-fe0f" }, - { n: ["printer"], u: "1f5a8-fe0f" }, - { n: ["keyboard"], u: "2328-fe0f" }, - { n: ["computer mouse", "three button mouse"], u: "1f5b1-fe0f" }, - { n: ["trackball"], u: "1f5b2-fe0f" }, - { n: ["minidisc"], u: "1f4bd" }, - { n: ["floppy disk"], u: "1f4be" }, - { n: ["cd", "optical disc"], u: "1f4bf" }, - { n: ["dvd"], u: "1f4c0" }, - { n: ["abacus"], u: "1f9ee" }, - { n: ["movie camera"], u: "1f3a5" }, - { n: ["film frames"], u: "1f39e-fe0f" }, - { n: ["film projector"], u: "1f4fd-fe0f" }, - { n: ["clapper", "clapper board"], u: "1f3ac" }, - { n: ["tv", "television"], u: "1f4fa" }, - { n: ["camera"], u: "1f4f7" }, - { n: ["camera with flash"], u: "1f4f8" }, - { n: ["video camera"], u: "1f4f9" }, - { n: ["vhs", "videocassette"], u: "1f4fc" }, - { n: ["mag", "left-pointing magnifying glass"], u: "1f50d" }, - { n: ["mag right", "right-pointing magnifying glass"], u: "1f50e" }, - { n: ["candle"], u: "1f56f-fe0f" }, - { n: ["bulb", "electric light bulb"], u: "1f4a1" }, - { n: ["flashlight", "electric torch"], u: "1f526" }, - { n: ["lantern", "izakaya lantern"], u: "1f3ee" }, - { n: ["diya lamp"], u: "1fa94" }, - { n: ["notebook with decorative cover"], u: "1f4d4" }, - { n: ["closed book"], u: "1f4d5" }, - { n: ["book", "open book"], u: "1f4d6" }, - { n: ["green book"], u: "1f4d7" }, - { n: ["blue book"], u: "1f4d8" }, - { n: ["orange book"], u: "1f4d9" }, - { n: ["books"], u: "1f4da" }, - { n: ["notebook"], u: "1f4d3" }, - { n: ["ledger"], u: "1f4d2" }, - { n: ["page with curl"], u: "1f4c3" }, - { n: ["scroll"], u: "1f4dc" }, - { n: ["page facing up"], u: "1f4c4" }, - { n: ["newspaper"], u: "1f4f0" }, - { n: ["rolled-up newspaper", "rolled up newspaper"], u: "1f5de-fe0f" }, - { n: ["bookmark tabs"], u: "1f4d1" }, - { n: ["bookmark"], u: "1f516" }, - { n: ["label"], u: "1f3f7-fe0f" }, - { n: ["moneybag", "money bag"], u: "1f4b0" }, - { n: ["coin"], u: "1fa99" }, - { n: ["yen", "banknote with yen sign"], u: "1f4b4" }, - { n: ["dollar", "banknote with dollar sign"], u: "1f4b5" }, - { n: ["euro", "banknote with euro sign"], u: "1f4b6" }, - { n: ["pound", "banknote with pound sign"], u: "1f4b7" }, - { n: ["money with wings"], u: "1f4b8" }, - { n: ["credit card"], u: "1f4b3" }, - { n: ["receipt"], u: "1f9fe" }, - { n: ["chart", "chart with upwards trend and yen sign"], u: "1f4b9" }, - { n: ["email", "envelope"], u: "2709-fe0f" }, - { n: ["e-mail", "e-mail symbol"], u: "1f4e7" }, - { n: ["incoming envelope"], u: "1f4e8" }, - { - n: ["envelope with arrow", "envelope with downwards arrow above"], - u: "1f4e9" - }, - { n: ["outbox tray"], u: "1f4e4" }, - { n: ["inbox tray"], u: "1f4e5" }, - { n: ["package"], u: "1f4e6" }, - { n: ["mailbox", "closed mailbox with raised flag"], u: "1f4eb" }, - { n: ["mailbox closed", "closed mailbox with lowered flag"], u: "1f4ea" }, - { n: ["mailbox with mail", "open mailbox with raised flag"], u: "1f4ec" }, - { - n: ["mailbox with no mail", "open mailbox with lowered flag"], - u: "1f4ed" - }, - { n: ["postbox"], u: "1f4ee" }, - { n: ["ballot box with ballot"], u: "1f5f3-fe0f" }, - { n: ["pencil", "pencil2"], u: "270f-fe0f" }, - { n: ["black nib"], u: "2712-fe0f" }, - { n: ["fountain pen", "lower left fountain pen"], u: "1f58b-fe0f" }, - { n: ["pen", "lower left ballpoint pen"], u: "1f58a-fe0f" }, - { n: ["paintbrush", "lower left paintbrush"], u: "1f58c-fe0f" }, - { n: ["crayon", "lower left crayon"], u: "1f58d-fe0f" }, - { n: ["memo", "pencil"], u: "1f4dd" }, - { n: ["briefcase"], u: "1f4bc" }, - { n: ["file folder"], u: "1f4c1" }, - { n: ["open file folder"], u: "1f4c2" }, - { n: ["card index dividers"], u: "1f5c2-fe0f" }, - { n: ["date", "calendar"], u: "1f4c5" }, - { n: ["calendar", "tear-off calendar"], u: "1f4c6" }, - { n: ["spiral notepad", "spiral note pad"], u: "1f5d2-fe0f" }, - { n: ["spiral calendar", "spiral calendar pad"], u: "1f5d3-fe0f" }, - { n: ["card index"], u: "1f4c7" }, - { n: ["chart with upwards trend"], u: "1f4c8" }, - { n: ["chart with downwards trend"], u: "1f4c9" }, - { n: ["bar chart"], u: "1f4ca" }, - { n: ["clipboard"], u: "1f4cb" }, - { n: ["pushpin"], u: "1f4cc" }, - { n: ["round pushpin"], u: "1f4cd" }, - { n: ["paperclip"], u: "1f4ce" }, - { n: ["linked paperclips"], u: "1f587-fe0f" }, - { n: ["straight ruler"], u: "1f4cf" }, - { n: ["triangular ruler"], u: "1f4d0" }, - { n: ["scissors", "black scissors"], u: "2702-fe0f" }, - { n: ["card file box"], u: "1f5c3-fe0f" }, - { n: ["file cabinet"], u: "1f5c4-fe0f" }, - { n: ["wastebasket"], u: "1f5d1-fe0f" }, - { n: ["lock"], u: "1f512" }, - { n: ["unlock", "open lock"], u: "1f513" }, - { n: ["lock with ink pen"], u: "1f50f" }, - { n: ["closed lock with key"], u: "1f510" }, - { n: ["key"], u: "1f511" }, - { n: ["old key"], u: "1f5dd-fe0f" }, - { n: ["hammer"], u: "1f528" }, - { n: ["axe"], u: "1fa93" }, - { n: ["pick"], u: "26cf-fe0f" }, - { n: ["hammer and pick"], u: "2692-fe0f" }, - { n: ["hammer and wrench"], u: "1f6e0-fe0f" }, - { n: ["dagger", "dagger knife"], u: "1f5e1-fe0f" }, - { n: ["crossed swords"], u: "2694-fe0f" }, - { n: ["gun", "pistol"], u: "1f52b" }, - { n: ["boomerang"], u: "1fa83" }, - { n: ["bow and arrow"], u: "1f3f9" }, - { n: ["shield"], u: "1f6e1-fe0f" }, - { n: ["carpentry saw"], u: "1fa9a" }, - { n: ["wrench"], u: "1f527" }, - { n: ["screwdriver"], u: "1fa9b" }, - { n: ["nut and bolt"], u: "1f529" }, - { n: ["gear"], u: "2699-fe0f" }, - { n: ["clamp", "compression"], u: "1f5dc-fe0f" }, - { n: ["scales", "balance scale"], u: "2696-fe0f" }, - { n: ["probing cane"], u: "1f9af" }, - { n: ["link", "link symbol"], u: "1f517" }, - { n: ["chains"], u: "26d3-fe0f" }, - { n: ["hook"], u: "1fa9d" }, - { n: ["toolbox"], u: "1f9f0" }, - { n: ["magnet"], u: "1f9f2" }, - { n: ["ladder"], u: "1fa9c" }, - { n: ["alembic"], u: "2697-fe0f" }, - { n: ["test tube"], u: "1f9ea" }, - { n: ["petri dish"], u: "1f9eb" }, - { n: ["dna", "dna double helix"], u: "1f9ec" }, - { n: ["microscope"], u: "1f52c" }, - { n: ["telescope"], u: "1f52d" }, - { n: ["satellite antenna"], u: "1f4e1" }, - { n: ["syringe"], u: "1f489" }, - { n: ["drop of blood"], u: "1fa78" }, - { n: ["pill"], u: "1f48a" }, - { n: ["adhesive bandage"], u: "1fa79" }, - { n: ["crutch"], u: "1fa7c" }, - { n: ["stethoscope"], u: "1fa7a" }, - { n: ["x-ray"], u: "1fa7b" }, - { n: ["door"], u: "1f6aa" }, - { n: ["elevator"], u: "1f6d7" }, - { n: ["mirror"], u: "1fa9e" }, - { n: ["window"], u: "1fa9f" }, - { n: ["bed"], u: "1f6cf-fe0f" }, - { n: ["couch and lamp"], u: "1f6cb-fe0f" }, - { n: ["chair"], u: "1fa91" }, - { n: ["toilet"], u: "1f6bd" }, - { n: ["plunger"], u: "1faa0" }, - { n: ["shower"], u: "1f6bf" }, - { n: ["bathtub"], u: "1f6c1" }, - { n: ["mouse trap"], u: "1faa4" }, - { n: ["razor"], u: "1fa92" }, - { n: ["lotion bottle"], u: "1f9f4" }, - { n: ["safety pin"], u: "1f9f7" }, - { n: ["broom"], u: "1f9f9" }, - { n: ["basket"], u: "1f9fa" }, - { n: ["roll of paper"], u: "1f9fb" }, - { n: ["bucket"], u: "1faa3" }, - { n: ["soap", "bar of soap"], u: "1f9fc" }, - { n: ["bubbles"], u: "1fae7" }, - { n: ["toothbrush"], u: "1faa5" }, - { n: ["sponge"], u: "1f9fd" }, - { n: ["fire extinguisher"], u: "1f9ef" }, - { n: ["shopping trolley"], u: "1f6d2" }, - { n: ["smoking", "smoking symbol"], u: "1f6ac" }, - { n: ["coffin"], u: "26b0-fe0f" }, - { n: ["headstone"], u: "1faa6" }, - { n: ["funeral urn"], u: "26b1-fe0f" }, - { n: ["moyai"], u: "1f5ff" }, - { n: ["placard"], u: "1faa7" }, - { n: ["identification card"], u: "1faaa" } - ], - symbols: [ - { n: ["atm", "automated teller machine"], u: "1f3e7" }, - { - n: ["put litter in its place", "put litter in its place symbol"], - u: "1f6ae" - }, - { n: ["potable water", "potable water symbol"], u: "1f6b0" }, - { n: ["wheelchair", "wheelchair symbol"], u: "267f" }, - { n: ["mens", "mens symbol"], u: "1f6b9" }, - { n: ["womens", "womens symbol"], u: "1f6ba" }, - { n: ["restroom"], u: "1f6bb" }, - { n: ["baby symbol"], u: "1f6bc" }, - { n: ["wc", "water closet"], u: "1f6be" }, - { n: ["passport control"], u: "1f6c2" }, - { n: ["customs"], u: "1f6c3" }, - { n: ["baggage claim"], u: "1f6c4" }, - { n: ["left luggage"], u: "1f6c5" }, - { n: ["warning", "warning sign"], u: "26a0-fe0f" }, - { n: ["children crossing"], u: "1f6b8" }, - { n: ["no entry"], u: "26d4" }, - { n: ["no entry sign"], u: "1f6ab" }, - { n: ["no bicycles"], u: "1f6b3" }, - { n: ["no smoking", "no smoking symbol"], u: "1f6ad" }, - { n: ["do not litter", "do not litter symbol"], u: "1f6af" }, - { n: ["non-potable water", "non-potable water symbol"], u: "1f6b1" }, - { n: ["no pedestrians"], u: "1f6b7" }, - { n: ["no mobile phones"], u: "1f4f5" }, - { n: ["underage", "no one under eighteen symbol"], u: "1f51e" }, - { n: ["radioactive", "radioactive sign"], u: "2622-fe0f" }, - { n: ["biohazard", "biohazard sign"], u: "2623-fe0f" }, - { n: ["arrow up", "upwards black arrow"], u: "2b06-fe0f" }, - { n: ["north east arrow", "arrow upper right"], u: "2197-fe0f" }, - { n: ["arrow right", "black rightwards arrow"], u: "27a1-fe0f" }, - { n: ["south east arrow", "arrow lower right"], u: "2198-fe0f" }, - { n: ["arrow down", "downwards black arrow"], u: "2b07-fe0f" }, - { n: ["south west arrow", "arrow lower left"], u: "2199-fe0f" }, - { n: ["arrow left", "leftwards black arrow"], u: "2b05-fe0f" }, - { n: ["north west arrow", "arrow upper left"], u: "2196-fe0f" }, - { n: ["up down arrow", "arrow up down"], u: "2195-fe0f" }, - { n: ["left right arrow"], u: "2194-fe0f" }, - { n: ["leftwards arrow with hook"], u: "21a9-fe0f" }, - { n: ["arrow right hook", "rightwards arrow with hook"], u: "21aa-fe0f" }, - { - n: ["arrow heading up", "arrow pointing rightwards then curving upwards"], - u: "2934-fe0f" - }, - { - n: [ - "arrow heading down", - "arrow pointing rightwards then curving downwards" - ], - u: "2935-fe0f" - }, - { - n: [ - "arrows clockwise", - "clockwise downwards and upwards open circle arrows" - ], - u: "1f503" - }, - { - n: [ - "arrows counterclockwise", - "anticlockwise downwards and upwards open circle arrows" - ], - u: "1f504" - }, - { n: ["back", "back with leftwards arrow above"], u: "1f519" }, - { n: ["end", "end with leftwards arrow above"], u: "1f51a" }, - { - n: ["on", "on with exclamation mark with left right arrow above"], - u: "1f51b" - }, - { n: ["soon", "soon with rightwards arrow above"], u: "1f51c" }, - { n: ["top", "top with upwards arrow above"], u: "1f51d" }, - { n: ["place of worship"], u: "1f6d0" }, - { n: ["atom symbol"], u: "269b-fe0f" }, - { n: ["om", "om symbol"], u: "1f549-fe0f" }, - { n: ["star of david"], u: "2721-fe0f" }, - { n: ["wheel of dharma"], u: "2638-fe0f" }, - { n: ["yin yang"], u: "262f-fe0f" }, - { n: ["latin cross"], u: "271d-fe0f" }, - { n: ["orthodox cross"], u: "2626-fe0f" }, - { n: ["star and crescent"], u: "262a-fe0f" }, - { n: ["peace symbol"], u: "262e-fe0f" }, - { n: ["menorah with nine branches"], u: "1f54e" }, - { n: ["six pointed star", "six pointed star with middle dot"], u: "1f52f" }, - { n: ["aries"], u: "2648" }, - { n: ["taurus"], u: "2649" }, - { n: ["gemini"], u: "264a" }, - { n: ["cancer"], u: "264b" }, - { n: ["leo"], u: "264c" }, - { n: ["virgo"], u: "264d" }, - { n: ["libra"], u: "264e" }, - { n: ["scorpius"], u: "264f" }, - { n: ["sagittarius"], u: "2650" }, - { n: ["capricorn"], u: "2651" }, - { n: ["aquarius"], u: "2652" }, - { n: ["pisces"], u: "2653" }, - { n: ["ophiuchus"], u: "26ce" }, - { n: ["twisted rightwards arrows"], u: "1f500" }, - { - n: ["repeat", "clockwise rightwards and leftwards open circle arrows"], - u: "1f501" - }, - { - n: [ - "repeat one", - "clockwise rightwards and leftwards open circle arrows with circled one overlay" - ], - u: "1f502" - }, - { n: ["arrow forward", "black right-pointing triangle"], u: "25b6-fe0f" }, - { n: ["fast forward", "black right-pointing double triangle"], u: "23e9" }, - { - n: [ - "next track button", - "black right pointing double triangle with vertical bar" - ], - u: "23ed-fe0f" - }, - { - n: [ - "play or pause button", - "black right pointing triangle with double vertical bar" - ], - u: "23ef-fe0f" - }, - { n: ["arrow backward", "black left-pointing triangle"], u: "25c0-fe0f" }, - { n: ["rewind", "black left-pointing double triangle"], u: "23ea" }, - { - n: [ - "last track button", - "black left pointing double triangle with vertical bar" - ], - u: "23ee-fe0f" - }, - { n: ["arrow up small", "up-pointing small red triangle"], u: "1f53c" }, - { n: ["arrow double up", "black up-pointing double triangle"], u: "23eb" }, - { n: ["arrow down small", "down-pointing small red triangle"], u: "1f53d" }, - { - n: ["arrow double down", "black down-pointing double triangle"], - u: "23ec" - }, - { n: ["pause button", "double vertical bar"], u: "23f8-fe0f" }, - { n: ["stop button", "black square for stop"], u: "23f9-fe0f" }, - { n: ["record button", "black circle for record"], u: "23fa-fe0f" }, - { n: ["eject", "eject button"], u: "23cf-fe0f" }, - { n: ["cinema"], u: "1f3a6" }, - { n: ["low brightness", "low brightness symbol"], u: "1f505" }, - { n: ["high brightness", "high brightness symbol"], u: "1f506" }, - { n: ["signal strength", "antenna with bars"], u: "1f4f6" }, - { n: ["vibration mode"], u: "1f4f3" }, - { n: ["mobile phone off"], u: "1f4f4" }, - { n: ["female sign"], u: "2640-fe0f" }, - { n: ["male sign"], u: "2642-fe0f" }, - { n: ["transgender symbol"], u: "26a7-fe0f" }, - { n: ["heavy multiplication x"], u: "2716-fe0f" }, - { n: ["heavy plus sign"], u: "2795" }, - { n: ["heavy minus sign"], u: "2796" }, - { n: ["heavy division sign"], u: "2797" }, - { n: ["heavy equals sign"], u: "1f7f0" }, - { n: ["infinity"], u: "267e-fe0f" }, - { n: ["bangbang", "double exclamation mark"], u: "203c-fe0f" }, - { n: ["interrobang", "exclamation question mark"], u: "2049-fe0f" }, - { n: ["question", "black question mark ornament"], u: "2753" }, - { n: ["grey question", "white question mark ornament"], u: "2754" }, - { n: ["grey exclamation", "white exclamation mark ornament"], u: "2755" }, - { - n: [ - "exclamation", - "heavy exclamation mark", - "heavy exclamation mark symbol" - ], - u: "2757" - }, - { n: ["wavy dash"], u: "3030-fe0f" }, - { n: ["currency exchange"], u: "1f4b1" }, - { n: ["heavy dollar sign"], u: "1f4b2" }, - { n: ["medical symbol", "staff of aesculapius"], u: "2695-fe0f" }, - { n: ["recycle", "black universal recycling symbol"], u: "267b-fe0f" }, - { n: ["fleur-de-lis", "fleur de lis"], u: "269c-fe0f" }, - { n: ["trident", "trident emblem"], u: "1f531" }, - { n: ["name badge"], u: "1f4db" }, - { n: ["beginner", "japanese symbol for beginner"], u: "1f530" }, - { n: ["o", "heavy large circle"], u: "2b55" }, - { n: ["white check mark", "white heavy check mark"], u: "2705" }, - { n: ["ballot box with check"], u: "2611-fe0f" }, - { n: ["heavy check mark"], u: "2714-fe0f" }, - { n: ["x", "cross mark"], u: "274c" }, - { n: ["negative squared cross mark"], u: "274e" }, - { n: ["curly loop"], u: "27b0" }, - { n: ["loop", "double curly loop"], u: "27bf" }, - { n: ["part alternation mark"], u: "303d-fe0f" }, - { n: ["eight spoked asterisk"], u: "2733-fe0f" }, - { n: ["eight pointed black star"], u: "2734-fe0f" }, - { n: ["sparkle"], u: "2747-fe0f" }, - { n: ["copyright", "copyright sign"], u: "00a9-fe0f" }, - { n: ["registered", "registered sign"], u: "00ae-fe0f" }, - { n: ["tm", "trade mark sign"], u: "2122-fe0f" }, - { n: ["hash", "hash key"], u: "0023-fe0f-20e3" }, - { n: ["keycap: *", "keycap star"], u: "002a-fe0f-20e3" }, - { n: ["zero", "keycap 0"], u: "0030-fe0f-20e3" }, - { n: ["one", "keycap 1"], u: "0031-fe0f-20e3" }, - { n: ["two", "keycap 2"], u: "0032-fe0f-20e3" }, - { n: ["three", "keycap 3"], u: "0033-fe0f-20e3" }, - { n: ["four", "keycap 4"], u: "0034-fe0f-20e3" }, - { n: ["five", "keycap 5"], u: "0035-fe0f-20e3" }, - { n: ["six", "keycap 6"], u: "0036-fe0f-20e3" }, - { n: ["seven", "keycap 7"], u: "0037-fe0f-20e3" }, - { n: ["eight", "keycap 8"], u: "0038-fe0f-20e3" }, - { n: ["nine", "keycap 9"], u: "0039-fe0f-20e3" }, - { n: ["keycap ten"], u: "1f51f" }, - { - n: ["capital abcd", "input symbol for latin capital letters"], - u: "1f520" - }, - { n: ["abcd", "input symbol for latin small letters"], u: "1f521" }, - { n: ["1234", "input symbol for numbers"], u: "1f522" }, - { n: ["symbols", "input symbol for symbols"], u: "1f523" }, - { n: ["abc", "input symbol for latin letters"], u: "1f524" }, - { n: ["a", "negative squared latin capital letter a"], u: "1f170-fe0f" }, - { n: ["ab", "negative squared ab"], u: "1f18e" }, - { n: ["b", "negative squared latin capital letter b"], u: "1f171-fe0f" }, - { n: ["cl", "squared cl"], u: "1f191" }, - { n: ["cool", "squared cool"], u: "1f192" }, - { n: ["free", "squared free"], u: "1f193" }, - { n: ["information source"], u: "2139-fe0f" }, - { n: ["id", "squared id"], u: "1f194" }, - { n: ["m", "circled latin capital letter m"], u: "24c2-fe0f" }, - { n: ["new", "squared new"], u: "1f195" }, - { n: ["ng", "squared ng"], u: "1f196" }, - { n: ["o2", "negative squared latin capital letter o"], u: "1f17e-fe0f" }, - { n: ["ok", "squared ok"], u: "1f197" }, - { - n: ["parking", "negative squared latin capital letter p"], - u: "1f17f-fe0f" - }, - { n: ["sos", "squared sos"], u: "1f198" }, - { n: ["up", "squared up with exclamation mark"], u: "1f199" }, - { n: ["vs", "squared vs"], u: "1f19a" }, - { n: ["koko", "squared katakana koko"], u: "1f201" }, - { n: ["sa", "squared katakana sa"], u: "1f202-fe0f" }, - { n: ["u6708", "squared cjk unified ideograph-6708"], u: "1f237-fe0f" }, - { n: ["u6709", "squared cjk unified ideograph-6709"], u: "1f236" }, - { n: ["u6307", "squared cjk unified ideograph-6307"], u: "1f22f" }, - { n: ["ideograph advantage", "circled ideograph advantage"], u: "1f250" }, - { n: ["u5272", "squared cjk unified ideograph-5272"], u: "1f239" }, - { n: ["u7121", "squared cjk unified ideograph-7121"], u: "1f21a" }, - { n: ["u7981", "squared cjk unified ideograph-7981"], u: "1f232" }, - { n: ["accept", "circled ideograph accept"], u: "1f251" }, - { n: ["u7533", "squared cjk unified ideograph-7533"], u: "1f238" }, - { n: ["u5408", "squared cjk unified ideograph-5408"], u: "1f234" }, - { n: ["u7a7a", "squared cjk unified ideograph-7a7a"], u: "1f233" }, - { - n: ["congratulations", "circled ideograph congratulation"], - u: "3297-fe0f" - }, - { n: ["secret", "circled ideograph secret"], u: "3299-fe0f" }, - { n: ["u55b6", "squared cjk unified ideograph-55b6"], u: "1f23a" }, - { n: ["u6e80", "squared cjk unified ideograph-6e80"], u: "1f235" }, - { n: ["red circle", "large red circle"], u: "1f534" }, - { n: ["large orange circle"], u: "1f7e0" }, - { n: ["large yellow circle"], u: "1f7e1" }, - { n: ["large green circle"], u: "1f7e2" }, - { n: ["large blue circle"], u: "1f535" }, - { n: ["large purple circle"], u: "1f7e3" }, - { n: ["large brown circle"], u: "1f7e4" }, - { n: ["black circle", "medium black circle"], u: "26ab" }, - { n: ["white circle", "medium white circle"], u: "26aa" }, - { n: ["large red square"], u: "1f7e5" }, - { n: ["large orange square"], u: "1f7e7" }, - { n: ["large yellow square"], u: "1f7e8" }, - { n: ["large green square"], u: "1f7e9" }, - { n: ["large blue square"], u: "1f7e6" }, - { n: ["large purple square"], u: "1f7ea" }, - { n: ["large brown square"], u: "1f7eb" }, - { n: ["black large square"], u: "2b1b" }, - { n: ["white large square"], u: "2b1c" }, - { n: ["black medium square"], u: "25fc-fe0f" }, - { n: ["white medium square"], u: "25fb-fe0f" }, - { n: ["black medium small square"], u: "25fe" }, - { n: ["white medium small square"], u: "25fd" }, - { n: ["black small square"], u: "25aa-fe0f" }, - { n: ["white small square"], u: "25ab-fe0f" }, - { n: ["large orange diamond"], u: "1f536" }, - { n: ["large blue diamond"], u: "1f537" }, - { n: ["small orange diamond"], u: "1f538" }, - { n: ["small blue diamond"], u: "1f539" }, - { n: ["small red triangle", "up-pointing red triangle"], u: "1f53a" }, - { - n: ["small red triangle down", "down-pointing red triangle"], - u: "1f53b" - }, - { n: ["diamond shape with a dot inside"], u: "1f4a0" }, - { n: ["radio button"], u: "1f518" }, - { n: ["white square button"], u: "1f533" }, - { n: ["black square button"], u: "1f532" } - ], - flags: [ - { n: ["chequered flag", "checkered flag"], u: "1f3c1" }, - { n: ["triangular flag on post"], u: "1f6a9" }, - { n: ["crossed flags"], u: "1f38c" }, - { n: ["waving black flag"], u: "1f3f4" }, - { n: ["white flag", "waving white flag"], u: "1f3f3-fe0f" }, - { n: ["rainbow flag", "rainbow-flag"], u: "1f3f3-fe0f-200d-1f308" }, - { n: ["transgender flag"], u: "1f3f3-fe0f-200d-26a7-fe0f" }, - { n: ["pirate flag"], u: "1f3f4-200d-2620-fe0f" }, - { n: ["flag-ac", "ascension island flag"], u: "1f1e6-1f1e8" }, - { n: ["flag-ad", "andorra flag"], u: "1f1e6-1f1e9" }, - { n: ["flag-ae", "united arab emirates flag"], u: "1f1e6-1f1ea" }, - { n: ["flag-af", "afghanistan flag"], u: "1f1e6-1f1eb" }, - { n: ["flag-ag", "antigua & barbuda flag"], u: "1f1e6-1f1ec" }, - { n: ["flag-ai", "anguilla flag"], u: "1f1e6-1f1ee" }, - { n: ["flag-al", "albania flag"], u: "1f1e6-1f1f1" }, - { n: ["flag-am", "armenia flag"], u: "1f1e6-1f1f2" }, - { n: ["flag-ao", "angola flag"], u: "1f1e6-1f1f4" }, - { n: ["flag-aq", "antarctica flag"], u: "1f1e6-1f1f6" }, - { n: ["flag-ar", "argentina flag"], u: "1f1e6-1f1f7" }, - { n: ["flag-as", "american samoa flag"], u: "1f1e6-1f1f8" }, - { n: ["flag-at", "austria flag"], u: "1f1e6-1f1f9" }, - { n: ["flag-au", "australia flag"], u: "1f1e6-1f1fa" }, - { n: ["flag-aw", "aruba flag"], u: "1f1e6-1f1fc" }, - { n: ["flag-ax", "\xE5land islands flag"], u: "1f1e6-1f1fd" }, - { n: ["flag-az", "azerbaijan flag"], u: "1f1e6-1f1ff" }, - { n: ["flag-ba", "bosnia & herzegovina flag"], u: "1f1e7-1f1e6" }, - { n: ["flag-bb", "barbados flag"], u: "1f1e7-1f1e7" }, - { n: ["flag-bd", "bangladesh flag"], u: "1f1e7-1f1e9" }, - { n: ["flag-be", "belgium flag"], u: "1f1e7-1f1ea" }, - { n: ["flag-bf", "burkina faso flag"], u: "1f1e7-1f1eb" }, - { n: ["flag-bg", "bulgaria flag"], u: "1f1e7-1f1ec" }, - { n: ["flag-bh", "bahrain flag"], u: "1f1e7-1f1ed" }, - { n: ["flag-bi", "burundi flag"], u: "1f1e7-1f1ee" }, - { n: ["flag-bj", "benin flag"], u: "1f1e7-1f1ef" }, - { n: ["flag-bl", "st. barth\xE9lemy flag"], u: "1f1e7-1f1f1" }, - { n: ["flag-bm", "bermuda flag"], u: "1f1e7-1f1f2" }, - { n: ["flag-bn", "brunei flag"], u: "1f1e7-1f1f3" }, - { n: ["flag-bo", "bolivia flag"], u: "1f1e7-1f1f4" }, - { n: ["flag-bq", "caribbean netherlands flag"], u: "1f1e7-1f1f6" }, - { n: ["flag-br", "brazil flag"], u: "1f1e7-1f1f7" }, - { n: ["flag-bs", "bahamas flag"], u: "1f1e7-1f1f8" }, - { n: ["flag-bt", "bhutan flag"], u: "1f1e7-1f1f9" }, - { n: ["flag-bv", "bouvet island flag"], u: "1f1e7-1f1fb" }, - { n: ["flag-bw", "botswana flag"], u: "1f1e7-1f1fc" }, - { n: ["flag-by", "belarus flag"], u: "1f1e7-1f1fe" }, - { n: ["flag-bz", "belize flag"], u: "1f1e7-1f1ff" }, - { n: ["flag-ca", "canada flag"], u: "1f1e8-1f1e6" }, - { n: ["flag-cc", "cocos (keeling) islands flag"], u: "1f1e8-1f1e8" }, - { n: ["flag-cd", "congo - kinshasa flag"], u: "1f1e8-1f1e9" }, - { n: ["flag-cf", "central african republic flag"], u: "1f1e8-1f1eb" }, - { n: ["flag-cg", "congo - brazzaville flag"], u: "1f1e8-1f1ec" }, - { n: ["flag-ch", "switzerland flag"], u: "1f1e8-1f1ed" }, - { n: ["flag-ci", "c\xF4te d\u2019ivoire flag"], u: "1f1e8-1f1ee" }, - { n: ["flag-ck", "cook islands flag"], u: "1f1e8-1f1f0" }, - { n: ["flag-cl", "chile flag"], u: "1f1e8-1f1f1" }, - { n: ["flag-cm", "cameroon flag"], u: "1f1e8-1f1f2" }, - { n: ["cn", "flag-cn", "china flag"], u: "1f1e8-1f1f3" }, - { n: ["flag-co", "colombia flag"], u: "1f1e8-1f1f4" }, - { n: ["flag-cp", "clipperton island flag"], u: "1f1e8-1f1f5" }, - { n: ["flag-cr", "costa rica flag"], u: "1f1e8-1f1f7" }, - { n: ["flag-cu", "cuba flag"], u: "1f1e8-1f1fa" }, - { n: ["flag-cv", "cape verde flag"], u: "1f1e8-1f1fb" }, - { n: ["flag-cw", "cura\xE7ao flag"], u: "1f1e8-1f1fc" }, - { n: ["flag-cx", "christmas island flag"], u: "1f1e8-1f1fd" }, - { n: ["flag-cy", "cyprus flag"], u: "1f1e8-1f1fe" }, - { n: ["flag-cz", "czechia flag"], u: "1f1e8-1f1ff" }, - { n: ["de", "flag-de", "germany flag"], u: "1f1e9-1f1ea" }, - { n: ["flag-dg", "diego garcia flag"], u: "1f1e9-1f1ec" }, - { n: ["flag-dj", "djibouti flag"], u: "1f1e9-1f1ef" }, - { n: ["flag-dk", "denmark flag"], u: "1f1e9-1f1f0" }, - { n: ["flag-dm", "dominica flag"], u: "1f1e9-1f1f2" }, - { n: ["flag-do", "dominican republic flag"], u: "1f1e9-1f1f4" }, - { n: ["flag-dz", "algeria flag"], u: "1f1e9-1f1ff" }, - { n: ["flag-ea", "ceuta & melilla flag"], u: "1f1ea-1f1e6" }, - { n: ["flag-ec", "ecuador flag"], u: "1f1ea-1f1e8" }, - { n: ["flag-ee", "estonia flag"], u: "1f1ea-1f1ea" }, - { n: ["flag-eg", "egypt flag"], u: "1f1ea-1f1ec" }, - { n: ["flag-eh", "western sahara flag"], u: "1f1ea-1f1ed" }, - { n: ["flag-er", "eritrea flag"], u: "1f1ea-1f1f7" }, - { n: ["es", "flag-es", "spain flag"], u: "1f1ea-1f1f8" }, - { n: ["flag-et", "ethiopia flag"], u: "1f1ea-1f1f9" }, - { n: ["flag-eu", "european union flag"], u: "1f1ea-1f1fa" }, - { n: ["flag-fi", "finland flag"], u: "1f1eb-1f1ee" }, - { n: ["flag-fj", "fiji flag"], u: "1f1eb-1f1ef" }, - { n: ["flag-fk", "falkland islands flag"], u: "1f1eb-1f1f0" }, - { n: ["flag-fm", "micronesia flag"], u: "1f1eb-1f1f2" }, - { n: ["flag-fo", "faroe islands flag"], u: "1f1eb-1f1f4" }, - { n: ["fr", "flag-fr", "france flag"], u: "1f1eb-1f1f7" }, - { n: ["flag-ga", "gabon flag"], u: "1f1ec-1f1e6" }, - { n: ["gb", "uk", "flag-gb", "united kingdom flag"], u: "1f1ec-1f1e7" }, - { n: ["flag-gd", "grenada flag"], u: "1f1ec-1f1e9" }, - { n: ["flag-ge", "georgia flag"], u: "1f1ec-1f1ea" }, - { n: ["flag-gf", "french guiana flag"], u: "1f1ec-1f1eb" }, - { n: ["flag-gg", "guernsey flag"], u: "1f1ec-1f1ec" }, - { n: ["flag-gh", "ghana flag"], u: "1f1ec-1f1ed" }, - { n: ["flag-gi", "gibraltar flag"], u: "1f1ec-1f1ee" }, - { n: ["flag-gl", "greenland flag"], u: "1f1ec-1f1f1" }, - { n: ["flag-gm", "gambia flag"], u: "1f1ec-1f1f2" }, - { n: ["flag-gn", "guinea flag"], u: "1f1ec-1f1f3" }, - { n: ["flag-gp", "guadeloupe flag"], u: "1f1ec-1f1f5" }, - { n: ["flag-gq", "equatorial guinea flag"], u: "1f1ec-1f1f6" }, - { n: ["flag-gr", "greece flag"], u: "1f1ec-1f1f7" }, - { - n: ["flag-gs", "south georgia & south sandwich islands flag"], - u: "1f1ec-1f1f8" - }, - { n: ["flag-gt", "guatemala flag"], u: "1f1ec-1f1f9" }, - { n: ["flag-gu", "guam flag"], u: "1f1ec-1f1fa" }, - { n: ["flag-gw", "guinea-bissau flag"], u: "1f1ec-1f1fc" }, - { n: ["flag-gy", "guyana flag"], u: "1f1ec-1f1fe" }, - { n: ["flag-hk", "hong kong sar china flag"], u: "1f1ed-1f1f0" }, - { n: ["flag-hm", "heard & mcdonald islands flag"], u: "1f1ed-1f1f2" }, - { n: ["flag-hn", "honduras flag"], u: "1f1ed-1f1f3" }, - { n: ["flag-hr", "croatia flag"], u: "1f1ed-1f1f7" }, - { n: ["flag-ht", "haiti flag"], u: "1f1ed-1f1f9" }, - { n: ["flag-hu", "hungary flag"], u: "1f1ed-1f1fa" }, - { n: ["flag-ic", "canary islands flag"], u: "1f1ee-1f1e8" }, - { n: ["flag-id", "indonesia flag"], u: "1f1ee-1f1e9" }, - { n: ["flag-ie", "ireland flag"], u: "1f1ee-1f1ea" }, - { n: ["flag-il", "israel flag"], u: "1f1ee-1f1f1" }, - { n: ["flag-im", "isle of man flag"], u: "1f1ee-1f1f2" }, - { n: ["flag-in", "india flag"], u: "1f1ee-1f1f3" }, - { n: ["flag-io", "british indian ocean territory flag"], u: "1f1ee-1f1f4" }, - { n: ["flag-iq", "iraq flag"], u: "1f1ee-1f1f6" }, - { n: ["flag-ir", "iran flag"], u: "1f1ee-1f1f7" }, - { n: ["flag-is", "iceland flag"], u: "1f1ee-1f1f8" }, - { n: ["it", "flag-it", "italy flag"], u: "1f1ee-1f1f9" }, - { n: ["flag-je", "jersey flag"], u: "1f1ef-1f1ea" }, - { n: ["flag-jm", "jamaica flag"], u: "1f1ef-1f1f2" }, - { n: ["flag-jo", "jordan flag"], u: "1f1ef-1f1f4" }, - { n: ["jp", "flag-jp", "japan flag"], u: "1f1ef-1f1f5" }, - { n: ["flag-ke", "kenya flag"], u: "1f1f0-1f1ea" }, - { n: ["flag-kg", "kyrgyzstan flag"], u: "1f1f0-1f1ec" }, - { n: ["flag-kh", "cambodia flag"], u: "1f1f0-1f1ed" }, - { n: ["flag-ki", "kiribati flag"], u: "1f1f0-1f1ee" }, - { n: ["flag-km", "comoros flag"], u: "1f1f0-1f1f2" }, - { n: ["flag-kn", "st. kitts & nevis flag"], u: "1f1f0-1f1f3" }, - { n: ["flag-kp", "north korea flag"], u: "1f1f0-1f1f5" }, - { n: ["kr", "flag-kr", "south korea flag"], u: "1f1f0-1f1f7" }, - { n: ["flag-kw", "kuwait flag"], u: "1f1f0-1f1fc" }, - { n: ["flag-ky", "cayman islands flag"], u: "1f1f0-1f1fe" }, - { n: ["flag-kz", "kazakhstan flag"], u: "1f1f0-1f1ff" }, - { n: ["flag-la", "laos flag"], u: "1f1f1-1f1e6" }, - { n: ["flag-lb", "lebanon flag"], u: "1f1f1-1f1e7" }, - { n: ["flag-lc", "st. lucia flag"], u: "1f1f1-1f1e8" }, - { n: ["flag-li", "liechtenstein flag"], u: "1f1f1-1f1ee" }, - { n: ["flag-lk", "sri lanka flag"], u: "1f1f1-1f1f0" }, - { n: ["flag-lr", "liberia flag"], u: "1f1f1-1f1f7" }, - { n: ["flag-ls", "lesotho flag"], u: "1f1f1-1f1f8" }, - { n: ["flag-lt", "lithuania flag"], u: "1f1f1-1f1f9" }, - { n: ["flag-lu", "luxembourg flag"], u: "1f1f1-1f1fa" }, - { n: ["flag-lv", "latvia flag"], u: "1f1f1-1f1fb" }, - { n: ["flag-ly", "libya flag"], u: "1f1f1-1f1fe" }, - { n: ["flag-ma", "morocco flag"], u: "1f1f2-1f1e6" }, - { n: ["flag-mc", "monaco flag"], u: "1f1f2-1f1e8" }, - { n: ["flag-md", "moldova flag"], u: "1f1f2-1f1e9" }, - { n: ["flag-me", "montenegro flag"], u: "1f1f2-1f1ea" }, - { n: ["flag-mf", "st. martin flag"], u: "1f1f2-1f1eb" }, - { n: ["flag-mg", "madagascar flag"], u: "1f1f2-1f1ec" }, - { n: ["flag-mh", "marshall islands flag"], u: "1f1f2-1f1ed" }, - { n: ["flag-mk", "north macedonia flag"], u: "1f1f2-1f1f0" }, - { n: ["flag-ml", "mali flag"], u: "1f1f2-1f1f1" }, - { n: ["flag-mm", "myanmar (burma) flag"], u: "1f1f2-1f1f2" }, - { n: ["flag-mn", "mongolia flag"], u: "1f1f2-1f1f3" }, - { n: ["flag-mo", "macao sar china flag"], u: "1f1f2-1f1f4" }, - { n: ["flag-mp", "northern mariana islands flag"], u: "1f1f2-1f1f5" }, - { n: ["flag-mq", "martinique flag"], u: "1f1f2-1f1f6" }, - { n: ["flag-mr", "mauritania flag"], u: "1f1f2-1f1f7" }, - { n: ["flag-ms", "montserrat flag"], u: "1f1f2-1f1f8" }, - { n: ["flag-mt", "malta flag"], u: "1f1f2-1f1f9" }, - { n: ["flag-mu", "mauritius flag"], u: "1f1f2-1f1fa" }, - { n: ["flag-mv", "maldives flag"], u: "1f1f2-1f1fb" }, - { n: ["flag-mw", "malawi flag"], u: "1f1f2-1f1fc" }, - { n: ["flag-mx", "mexico flag"], u: "1f1f2-1f1fd" }, - { n: ["flag-my", "malaysia flag"], u: "1f1f2-1f1fe" }, - { n: ["flag-mz", "mozambique flag"], u: "1f1f2-1f1ff" }, - { n: ["flag-na", "namibia flag"], u: "1f1f3-1f1e6" }, - { n: ["flag-nc", "new caledonia flag"], u: "1f1f3-1f1e8" }, - { n: ["flag-ne", "niger flag"], u: "1f1f3-1f1ea" }, - { n: ["flag-nf", "norfolk island flag"], u: "1f1f3-1f1eb" }, - { n: ["flag-ng", "nigeria flag"], u: "1f1f3-1f1ec" }, - { n: ["flag-ni", "nicaragua flag"], u: "1f1f3-1f1ee" }, - { n: ["flag-nl", "netherlands flag"], u: "1f1f3-1f1f1" }, - { n: ["flag-no", "norway flag"], u: "1f1f3-1f1f4" }, - { n: ["flag-np", "nepal flag"], u: "1f1f3-1f1f5" }, - { n: ["flag-nr", "nauru flag"], u: "1f1f3-1f1f7" }, - { n: ["flag-nu", "niue flag"], u: "1f1f3-1f1fa" }, - { n: ["flag-nz", "new zealand flag"], u: "1f1f3-1f1ff" }, - { n: ["flag-om", "oman flag"], u: "1f1f4-1f1f2" }, - { n: ["flag-pa", "panama flag"], u: "1f1f5-1f1e6" }, - { n: ["flag-pe", "peru flag"], u: "1f1f5-1f1ea" }, - { n: ["flag-pf", "french polynesia flag"], u: "1f1f5-1f1eb" }, - { n: ["flag-pg", "papua new guinea flag"], u: "1f1f5-1f1ec" }, - { n: ["flag-ph", "philippines flag"], u: "1f1f5-1f1ed" }, - { n: ["flag-pk", "pakistan flag"], u: "1f1f5-1f1f0" }, - { n: ["flag-pl", "poland flag"], u: "1f1f5-1f1f1" }, - { n: ["flag-pm", "st. pierre & miquelon flag"], u: "1f1f5-1f1f2" }, - { n: ["flag-pn", "pitcairn islands flag"], u: "1f1f5-1f1f3" }, - { n: ["flag-pr", "puerto rico flag"], u: "1f1f5-1f1f7" }, - { n: ["flag-ps", "palestinian territories flag"], u: "1f1f5-1f1f8" }, - { n: ["flag-pt", "portugal flag"], u: "1f1f5-1f1f9" }, - { n: ["flag-pw", "palau flag"], u: "1f1f5-1f1fc" }, - { n: ["flag-py", "paraguay flag"], u: "1f1f5-1f1fe" }, - { n: ["flag-qa", "qatar flag"], u: "1f1f6-1f1e6" }, - { n: ["flag-re", "r\xE9union flag"], u: "1f1f7-1f1ea" }, - { n: ["flag-ro", "romania flag"], u: "1f1f7-1f1f4" }, - { n: ["flag-rs", "serbia flag"], u: "1f1f7-1f1f8" }, - { n: ["ru", "flag-ru", "russia flag"], u: "1f1f7-1f1fa" }, - { n: ["flag-rw", "rwanda flag"], u: "1f1f7-1f1fc" }, - { n: ["flag-sa", "saudi arabia flag"], u: "1f1f8-1f1e6" }, - { n: ["flag-sb", "solomon islands flag"], u: "1f1f8-1f1e7" }, - { n: ["flag-sc", "seychelles flag"], u: "1f1f8-1f1e8" }, - { n: ["flag-sd", "sudan flag"], u: "1f1f8-1f1e9" }, - { n: ["flag-se", "sweden flag"], u: "1f1f8-1f1ea" }, - { n: ["flag-sg", "singapore flag"], u: "1f1f8-1f1ec" }, - { n: ["flag-sh", "st. helena flag"], u: "1f1f8-1f1ed" }, - { n: ["flag-si", "slovenia flag"], u: "1f1f8-1f1ee" }, - { n: ["flag-sj", "svalbard & jan mayen flag"], u: "1f1f8-1f1ef" }, - { n: ["flag-sk", "slovakia flag"], u: "1f1f8-1f1f0" }, - { n: ["flag-sl", "sierra leone flag"], u: "1f1f8-1f1f1" }, - { n: ["flag-sm", "san marino flag"], u: "1f1f8-1f1f2" }, - { n: ["flag-sn", "senegal flag"], u: "1f1f8-1f1f3" }, - { n: ["flag-so", "somalia flag"], u: "1f1f8-1f1f4" }, - { n: ["flag-sr", "suriname flag"], u: "1f1f8-1f1f7" }, - { n: ["flag-ss", "south sudan flag"], u: "1f1f8-1f1f8" }, - { n: ["flag-st", "s\xE3o tom\xE9 & pr\xEDncipe flag"], u: "1f1f8-1f1f9" }, - { n: ["flag-sv", "el salvador flag"], u: "1f1f8-1f1fb" }, - { n: ["flag-sx", "sint maarten flag"], u: "1f1f8-1f1fd" }, - { n: ["flag-sy", "syria flag"], u: "1f1f8-1f1fe" }, - { n: ["flag-sz", "eswatini flag"], u: "1f1f8-1f1ff" }, - { n: ["flag-ta", "tristan da cunha flag"], u: "1f1f9-1f1e6" }, - { n: ["flag-tc", "turks & caicos islands flag"], u: "1f1f9-1f1e8" }, - { n: ["flag-td", "chad flag"], u: "1f1f9-1f1e9" }, - { n: ["flag-tf", "french southern territories flag"], u: "1f1f9-1f1eb" }, - { n: ["flag-tg", "togo flag"], u: "1f1f9-1f1ec" }, - { n: ["flag-th", "thailand flag"], u: "1f1f9-1f1ed" }, - { n: ["flag-tj", "tajikistan flag"], u: "1f1f9-1f1ef" }, - { n: ["flag-tk", "tokelau flag"], u: "1f1f9-1f1f0" }, - { n: ["flag-tl", "timor-leste flag"], u: "1f1f9-1f1f1" }, - { n: ["flag-tm", "turkmenistan flag"], u: "1f1f9-1f1f2" }, - { n: ["flag-tn", "tunisia flag"], u: "1f1f9-1f1f3" }, - { n: ["flag-to", "tonga flag"], u: "1f1f9-1f1f4" }, - { n: ["flag-tr", "turkey flag"], u: "1f1f9-1f1f7" }, - { n: ["flag-tt", "trinidad & tobago flag"], u: "1f1f9-1f1f9" }, - { n: ["flag-tv", "tuvalu flag"], u: "1f1f9-1f1fb" }, - { n: ["flag-tw", "taiwan flag"], u: "1f1f9-1f1fc" }, - { n: ["flag-tz", "tanzania flag"], u: "1f1f9-1f1ff" }, - { n: ["flag-ua", "ukraine flag"], u: "1f1fa-1f1e6" }, - { n: ["flag-ug", "uganda flag"], u: "1f1fa-1f1ec" }, - { n: ["flag-um", "u.s. outlying islands flag"], u: "1f1fa-1f1f2" }, - { n: ["flag-un", "united nations flag"], u: "1f1fa-1f1f3" }, - { n: ["us", "flag-us", "united states flag"], u: "1f1fa-1f1f8" }, - { n: ["flag-uy", "uruguay flag"], u: "1f1fa-1f1fe" }, - { n: ["flag-uz", "uzbekistan flag"], u: "1f1fa-1f1ff" }, - { n: ["flag-va", "vatican city flag"], u: "1f1fb-1f1e6" }, - { n: ["flag-vc", "st. vincent & grenadines flag"], u: "1f1fb-1f1e8" }, - { n: ["flag-ve", "venezuela flag"], u: "1f1fb-1f1ea" }, - { n: ["flag-vg", "british virgin islands flag"], u: "1f1fb-1f1ec" }, - { n: ["flag-vi", "u.s. virgin islands flag"], u: "1f1fb-1f1ee" }, - { n: ["flag-vn", "vietnam flag"], u: "1f1fb-1f1f3" }, - { n: ["flag-vu", "vanuatu flag"], u: "1f1fb-1f1fa" }, - { n: ["flag-wf", "wallis & futuna flag"], u: "1f1fc-1f1eb" }, - { n: ["flag-ws", "samoa flag"], u: "1f1fc-1f1f8" }, - { n: ["flag-xk", "kosovo flag"], u: "1f1fd-1f1f0" }, - { n: ["flag-ye", "yemen flag"], u: "1f1fe-1f1ea" }, - { n: ["flag-yt", "mayotte flag"], u: "1f1fe-1f1f9" }, - { n: ["flag-za", "south africa flag"], u: "1f1ff-1f1e6" }, - { n: ["flag-zm", "zambia flag"], u: "1f1ff-1f1f2" }, - { n: ["flag-zw", "zimbabwe flag"], u: "1f1ff-1f1fc" }, - { - n: ["england flag", "flag-england"], - u: "1f3f4-e0067-e0062-e0065-e006e-e0067-e007f" - }, - { - n: ["scotland flag", "flag-scotland"], - u: "1f3f4-e0067-e0062-e0073-e0063-e0074-e007f" - }, - { - n: ["wales flag", "flag-wales"], - u: "1f3f4-e0067-e0062-e0077-e006c-e0073-e007f" - } - ] -}; - -// src/components/ui/modals/stickerModal.tsx -var import_obsidian5 = require("obsidian"); -var htmlFromSticker = (sticker) => { - if (sticker.type == "emoji") { - return emojiFromString(sticker.html); - } - return sticker.html; -}; -var stickerModal = class extends import_obsidian5.FuzzySuggestModal { - constructor(app2, plugin, setIcon) { - super(app2); - this.plugin = plugin; - this.setIcon = setIcon; - this.resultContainerEl.toggleClass("mk-sticker-modal", true); - this.inputEl.focus(); - this.emptyStateText = i18n_default.labels.findStickers; - this.limit = 0; - } - renderSuggestion(item, el) { - el.innerHTML = htmlFromSticker(item.item); - el.setAttr("aria-label", item.item.name); - } - getItemText(item) { - return item.name; - } - getItems() { - const allLucide = lucideIcons.map((f4) => ({ - name: f4, - type: "lucide", - keywords: f4, - value: f4, - html: (0, import_obsidian5.getIcon)(f4).outerHTML - })); - const allCustom = [...this.plugin.index.iconsCache.keys()].map( - (f4) => ({ - name: f4, - type: "vault", - keywords: f4, - value: f4, - html: this.plugin.index.iconsCache.get(f4) - }) - ); - const allEmojis = Object.keys(emojis).reduce( - (p3, c4) => [ - ...p3, - ...emojis[c4].map((e4) => ({ - type: "emoji", - name: e4.n[0], - value: e4.u, - html: e4.u - })) - ], - [] - ); - return [...allCustom, ...allEmojis, ...allLucide]; - } - onChooseItem(item, evt) { - this.setIcon(item.type + "//" + item.value); - } -}; - -// src/components/FileSticker/FileSticker.tsx -var import_obsidian7 = require("obsidian"); - -// src/utils/emoji.ts -var saveFileIcons = (plugin, files, icon) => { - files.forEach((file) => { - saveFileSticker(plugin, file, icon); - }); -}; -var saveFileColors = (plugin, files, icon) => { - files.forEach((file) => { - saveFileColor(plugin, file, icon); - }); -}; -var saveSpaceIcon = (plugin, space, icon) => { - saveSpaceSticker(plugin, space, icon); -}; -var removeSpaceIcon = (plugin, space) => { - saveSpaceSticker(plugin, space, ""); -}; -var saveFileIcon = (plugin, data, icon) => { - saveFileSticker(plugin, data.path, icon); -}; -var removeFileIcons = (plugin, files) => { - files.forEach((file) => { - saveFileSticker(plugin, file, ""); - }); -}; -var removeFileIcon = (plugin, data) => { - saveFileSticker(plugin, data.path, ""); -}; - -// src/utils/sticker.ts -var import_obsidian6 = require("obsidian"); -var stickerFromString = (sticker, plugin) => { - var _a2; - const [type, value] = parseStickerString(sticker); - if (type == "" || type == "emoji") { - return emojiFromString(value); - } else if (type == "ui") { - return uiIconSet[value]; - } else if (type == "lucide") { - return (_a2 = (0, import_obsidian6.getIcon)(value)) == null ? void 0 : _a2.outerHTML; - } else { - return plugin.index.iconsCache.get(value); - } -}; - -// src/components/FileSticker/FileSticker.tsx -var FileSticker = (props2) => { - var _a2; - const { fileCache } = props2; - const triggerStickerContextMenu = (e4) => { - if (!fileCache) - return; - e4.preventDefault(); - const fileMenu = new import_obsidian7.Menu(); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - let vaultChangeModal = new stickerModal( - props2.plugin.app, - props2.plugin, - (emoji) => saveFileSticker(props2.plugin, fileCache == null ? void 0 : fileCache.path, emoji) - ); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeFileIcons(props2.plugin, [fileCache.path]); - }); - }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - return false; - }; - const triggerStickerMenu = (e4) => { - e4.stopPropagation(); - const vaultChangeModal = new stickerModal( - props2.plugin.app, - props2.plugin, - (emoji) => saveFileSticker(props2.plugin, fileCache.path, emoji) - ); - vaultChangeModal.open(); - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: `mk-file-icon ${(fileCache == null ? void 0 : fileCache.sticker) ? "" : "mk-file-icon-placeholder"}` - }, /* @__PURE__ */ Cn.createElement("button", { - "aria-label": i18n_default.buttons.changeIcon, - onContextMenu: triggerStickerContextMenu, - style: ((_a2 = fileCache == null ? void 0 : fileCache.color) == null ? void 0 : _a2.length) > 0 ? { - "--label-color": `${fileCache.color}`, - "--icon-color": `#ffffff` - } : { - "--icon-color": `var(--text-muted)` - }, - dangerouslySetInnerHTML: (fileCache == null ? void 0 : fileCache.sticker) ? { __html: stickerFromString(fileCache.sticker, props2.plugin) } : { - __html: defaultIconForExtension( - fileCache == null ? void 0 : fileCache.extension, - (fileCache == null ? void 0 : fileCache.color) ? true : false - ) - }, - onClick: (e4) => triggerStickerMenu(e4) - })); -}; - -// src/utils/flow/flowEditor.ts -var import_state5 = require("@codemirror/state"); - -// src/cm-extensions/flowEditor/atomic.ts -var import_state4 = require("@codemirror/state"); - -// src/cm-extensions/flowEditor/selectiveEditor.ts -var import_state3 = require("@codemirror/state"); -var import_view3 = require("@codemirror/view"); - -// node_modules/tslib/modules/index.js -var import_tslib = __toESM(require_tslib(), 1); -var { - __extends, - __assign, - __rest, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn -} = import_tslib.default; - -// src/cm-extensions/flowEditor/selectiveEditor.ts -var combinedRangeFacets = (rangeA, rangeB) => { - const startRange = !(rangeA == null ? void 0 : rangeA[0]) ? rangeB[0] : !(rangeB == null ? void 0 : rangeB[0]) ? rangeA[0] : Math.max(rangeA == null ? void 0 : rangeA[0], rangeB == null ? void 0 : rangeB[0]); - const endRange = !(rangeA == null ? void 0 : rangeA[1]) ? rangeB[1] : !(rangeB == null ? void 0 : rangeB[1]) ? rangeA[1] : Math.min(rangeA == null ? void 0 : rangeA[1], rangeB == null ? void 0 : rangeB[1]); - return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; -}; -var editableRange = import_state3.Annotation.define(); -var contentRange = import_state3.Annotation.define(); -var hiddenLine = import_view3.Decoration.replace({ inclusive: true, block: true }); -var hideLine = import_state3.StateField.define({ - create() { - return import_view3.Decoration.none; - }, - update(value, tr) { - let builder = new import_state3.RangeSetBuilder(); - const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); - if ((betterFacet == null ? void 0 : betterFacet[0]) != null) { - const starterLine = Math.min( - tr.state.doc.lines, - betterFacet[0] - ); - builder.add( - tr.state.doc.line(1).from, - tr.state.doc.line(starterLine).from - 1, - hiddenLine - ); - if (tr.newDoc.lines != betterFacet[1]) - builder.add( - tr.state.doc.line( - Math.min(tr.newDoc.lines, betterFacet[1]) - ).to, - tr.state.doc.line(tr.newDoc.lines).to, - hiddenLine - ); - } - const dec = builder.finish(); - return dec; - }, - provide: (f4) => import_view3.EditorView.decorations.from(f4) -}); -var frontmatterFacet = import_state3.StateField.define({ - create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(contentRange)) { - if (tr.annotation(contentRange)[0]) { - return [ - tr.annotation(contentRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) - ]; - } - return tr.annotation(contentRange); - } - return value; - } -}); -var selectiveLinesFacet = import_state3.StateField.define({ - create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(editableRange)) { - if (tr.annotation(editableRange)[0]) { - return [ - tr.annotation(editableRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) - ]; - } - return tr.annotation(editableRange); - } - return value; - } -}); -var lineRangeToPosRange = (state, range) => { - return { - from: state.doc.line(range[0]).from, - to: state.doc.line(Math.min(state.doc.lines, range[1])).to - }; -}; -var smartDelete = import_state3.EditorState.transactionFilter.of( - (tr) => { - if (tr.isUserEvent("delete") && !tr.annotation(import_state3.Transaction.userEvent).endsWith(".smart")) { - const initialSelections = tr.startState.selection.ranges.map((range) => ({ - from: range.from, - to: range.to - })); - const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); - if (initialSelections.length > 0 && (betterFacet == null ? void 0 : betterFacet[0])) { - const posRange = lineRangeToPosRange( - tr.startState, - betterFacet - ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { - const minFrom = Math.max(posRange.from, initialSelections[0].from); - const minTo = Math.min(posRange.to, initialSelections[0].to); - return [{ - changes: { - from: Math.min(minFrom, minTo), - to: Math.max(minFrom, minTo) - }, - annotations: import_state3.Transaction.userEvent.of( - `${tr.annotation(import_state3.Transaction.userEvent)}.smart` - ) - }]; - } - } - } - return tr; - } -); -var preventModifyTargetRanges = import_state3.EditorState.transactionFilter.of( - (tr) => { - let newTrans = []; - try { - const editableLines = tr.startState.field(selectiveLinesFacet, false); - const contentLines = tr.startState.field(frontmatterFacet, false); - const selectiveLines = combinedRangeFacets(editableLines, contentLines); - if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { - if (selectiveLines == null ? void 0 : selectiveLines[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - selectiveLines - ); - if (!tr.changes.touchesRange(posRange.from, posRange.to)) { - return []; - } - } - } - if (tr.state.doc.lines != tr.startState.doc.lines) { - const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; - if (selectiveLines == null ? void 0 : selectiveLines[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - selectiveLines - ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { - const newAnnotations = []; - if (editableLines[0]) { - newAnnotations.push(editableRange.of([ - editableLines[0] + numberNewLines, - editableLines[1] + numberNewLines - ])); - } - if (contentLines[0]) { - newAnnotations.push(contentRange.of([ - contentLines[0] + numberNewLines, - contentLines[1] + numberNewLines - ])); - } - newTrans.push({ - annotations: newAnnotations - }); - } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { - const newAnnotations = []; - if (editableLines[0]) { - newAnnotations.push(editableRange.of([ - editableLines[0], - editableLines[1] + numberNewLines - ])); - } - if (contentLines[0]) { - newAnnotations.push(contentRange.of([ - contentLines[0], - contentLines[1] + numberNewLines - ])); - } - newTrans.push({ - annotations: newAnnotations - }); - } - } - } - } catch (e4) { - return []; - } - return [tr, ...newTrans]; - } -); -var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; -var editBlockExtensions = () => [ - readOnlyRangesExtension, - hideLine, - selectiveLinesFacet, - frontmatterFacet -]; - -// src/cm-extensions/flowEditor/atomic.ts -var arrowKeyAnnotation = import_state4.Annotation.define(); -var atomicSelect = import_state4.EditorState.transactionFilter.of( - (tr) => { - if (tr.isUserEvent("delete") || tr.isUserEvent("input")) { - return tr; - } - const flowID = tr.startState.field(flowIDStateField, false); - if (tr.annotation(arrowKeyAnnotation) && flowID) { - const oldSel = tr.startState.selection.main; - const lineRange = tr.state.field(selectiveLinesFacet, false); - const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(tr.startState, lineRange) : { from: 0, to: tr.startState.doc.length }; - if (oldSel.from <= posRange.from && tr.annotation(arrowKeyAnnotation) == 3) { - focusFlowEditorParent(flowID, true); - } - if (oldSel.to >= posRange.to && tr.annotation(arrowKeyAnnotation) == 4) { - focusFlowEditorParent(flowID, false); - } - return tr; - } - const selection = tr.newSelection.main; - if (selection.from == 0 && selection.to == 0 || selection.from != selection.to) - return tr; - const flowEditors = tr.state.field(flowEditorInfo, false); - if (flowEditors) { - for (let info of flowEditors) { - if (info.embed == 1) { - if (info.from - 3 <= selection.from && info.to + 2 >= selection.to && info.expandedState == 2) { - const top = tr.annotation(arrowKeyAnnotation) == 1 || tr.startState.selection.main.from > selection.from ? false : true; - focusFlowEditor(info.id, top); - return { - selection: import_state4.EditorSelection.single(info.from - 4) - }; - break; - } - } - } - } - return tr; - } -); - -// src/components/ContextView/EmbedContextView.tsx -var import_obsidian30 = require("obsidian"); - -// node_modules/@dnd-kit/utilities/dist/utilities.esm.js -function useCombinedRefs() { - for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { - refs[_key] = arguments[_key]; - } - return F2( - () => (node) => { - refs.forEach((ref) => ref(node)); - }, - refs - ); -} -var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; -function isWindow(element) { - const elementString = Object.prototype.toString.call(element); - return elementString === "[object Window]" || elementString === "[object global]"; -} -function isNode(node) { - return "nodeType" in node; -} -function getWindow(target) { - var _target$ownerDocument, _target$ownerDocument2; - if (!target) { - return window; - } - if (isWindow(target)) { - return target; - } - if (!isNode(target)) { - return window; - } - return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window; -} -function isDocument(node) { - const { - Document - } = getWindow(node); - return node instanceof Document; -} -function isHTMLElement(node) { - if (isWindow(node)) { - return false; - } - return node instanceof getWindow(node).HTMLElement; -} -function isSVGElement(node) { - return node instanceof getWindow(node).SVGElement; -} -function getOwnerDocument(target) { - if (!target) { - return document; - } - if (isWindow(target)) { - return target.document; - } - if (!isNode(target)) { - return document; - } - if (isDocument(target)) { - return target; - } - if (isHTMLElement(target)) { - return target.ownerDocument; - } - return document; -} -var useIsomorphicLayoutEffect = canUseDOM ? y2 : p2; -function useEvent(handler) { - const handlerRef = _2(handler); - useIsomorphicLayoutEffect(() => { - handlerRef.current = handler; - }); - return T2(function() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - return handlerRef.current == null ? void 0 : handlerRef.current(...args); - }, []); -} -function useInterval() { - const intervalRef = _2(null); - const set = T2((listener, duration) => { - intervalRef.current = setInterval(listener, duration); - }, []); - const clear = T2(() => { - if (intervalRef.current !== null) { - clearInterval(intervalRef.current); - intervalRef.current = null; - } - }, []); - return [set, clear]; -} -function useLatestValue(value, dependencies) { - if (dependencies === void 0) { - dependencies = [value]; - } - const valueRef = _2(value); - useIsomorphicLayoutEffect(() => { - if (valueRef.current !== value) { - valueRef.current = value; - } - }, dependencies); - return valueRef; -} -function useLazyMemo(callback, dependencies) { - const valueRef = _2(); - return F2( - () => { - const newValue = callback(valueRef.current); - valueRef.current = newValue; - return newValue; - }, - [...dependencies] - ); -} -function useNodeRef(onChange) { - const onChangeHandler = useEvent(onChange); - const node = _2(null); - const setNodeRef = T2( - (element) => { - if (element !== node.current) { - onChangeHandler == null ? void 0 : onChangeHandler(element, node.current); - } - node.current = element; - }, - [] - ); - return [node, setNodeRef]; -} -function usePrevious(value) { - const ref = _2(); - p2(() => { - ref.current = value; - }, [value]); - return ref.current; -} -var ids = {}; -function useUniqueId(prefix, value) { - return F2(() => { - if (value) { - return value; - } - const id2 = ids[prefix] == null ? 0 : ids[prefix] + 1; - ids[prefix] = id2; - return prefix + "-" + id2; - }, [prefix, value]); -} -function createAdjustmentFn(modifier) { - return function(object) { - for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - adjustments[_key - 1] = arguments[_key]; - } - return adjustments.reduce((accumulator, adjustment) => { - const entries = Object.entries(adjustment); - for (const [key2, valueAdjustment] of entries) { - const value = accumulator[key2]; - if (value != null) { - accumulator[key2] = value + modifier * valueAdjustment; - } - } - return accumulator; - }, { - ...object - }); - }; -} -var add = /* @__PURE__ */ createAdjustmentFn(1); -var subtract = /* @__PURE__ */ createAdjustmentFn(-1); -function hasViewportRelativeCoordinates(event) { - return "clientX" in event && "clientY" in event; -} -function isKeyboardEvent(event) { - if (!event) { - return false; - } - const { - KeyboardEvent - } = getWindow(event.target); - return KeyboardEvent && event instanceof KeyboardEvent; -} -function isTouchEvent(event) { - if (!event) { - return false; - } - const { - TouchEvent - } = getWindow(event.target); - return TouchEvent && event instanceof TouchEvent; -} -function getEventCoordinates(event) { - if (isTouchEvent(event)) { - if (event.touches && event.touches.length) { - const { - clientX: x5, - clientY: y5 - } = event.touches[0]; - return { - x: x5, - y: y5 - }; - } else if (event.changedTouches && event.changedTouches.length) { - const { - clientX: x5, - clientY: y5 - } = event.changedTouches[0]; - return { - x: x5, - y: y5 - }; - } - } - if (hasViewportRelativeCoordinates(event)) { - return { - x: event.clientX, - y: event.clientY - }; - } - return null; -} -var CSS = /* @__PURE__ */ Object.freeze({ - Translate: { - toString(transform) { - if (!transform) { - return; - } - const { - x: x5, - y: y5 - } = transform; - return "translate3d(" + (x5 ? Math.round(x5) : 0) + "px, " + (y5 ? Math.round(y5) : 0) + "px, 0)"; - } - }, - Scale: { - toString(transform) { - if (!transform) { - return; - } - const { - scaleX, - scaleY - } = transform; - return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")"; - } - }, - Transform: { - toString(transform) { - if (!transform) { - return; - } - return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" "); - } - }, - Transition: { - toString(_ref) { - let { - property, - duration, - easing - } = _ref; - return property + " " + duration + "ms " + easing; - } - } -}); -var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"; -function findFirstFocusableNode(element) { - if (element.matches(SELECTOR)) { - return element; - } - return element.querySelector(SELECTOR); -} - -// node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js -var hiddenStyles = { - display: "none" -}; -function HiddenText(_ref) { - let { - id: id2, - value - } = _ref; - return Cn.createElement("div", { - id: id2, - style: hiddenStyles - }, value); -} -var visuallyHidden = { - position: "fixed", - width: 1, - height: 1, - margin: -1, - border: 0, - padding: 0, - overflow: "hidden", - clip: "rect(0 0 0 0)", - clipPath: "inset(100%)", - whiteSpace: "nowrap" -}; -function LiveRegion(_ref) { - let { - id: id2, - announcement - } = _ref; - return Cn.createElement("div", { - id: id2, - style: visuallyHidden, - role: "status", - "aria-live": "assertive", - "aria-atomic": true - }, announcement); -} -function useAnnouncement() { - const [announcement, setAnnouncement] = h2(""); - const announce = T2((value) => { - if (value != null) { - setAnnouncement(value); - } - }, []); - return { - announce, - announcement - }; -} - -// node_modules/@dnd-kit/core/dist/core.esm.js -var DndMonitorContext = /* @__PURE__ */ F(null); -function useDndMonitor(listener) { - const registerListener = q2(DndMonitorContext); - p2(() => { - if (!registerListener) { - throw new Error("useDndMonitor must be used within a children of "); - } - const unsubscribe = registerListener(listener); - return unsubscribe; - }, [listener, registerListener]); -} -function useDndMonitorProvider() { - const [listeners] = h2(() => /* @__PURE__ */ new Set()); - const registerListener = T2((listener) => { - listeners.add(listener); - return () => listeners.delete(listener); - }, [listeners]); - const dispatch = T2((_ref) => { - let { - type, - event - } = _ref; - listeners.forEach((listener) => { - var _listener$type; - return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event); - }); - }, [listeners]); - return [dispatch, registerListener]; -} -var defaultScreenReaderInstructions = { - draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " -}; -var defaultAnnouncements = { - onDragStart(_ref) { - let { - active - } = _ref; - return "Picked up draggable item " + active.id + "."; - }, - onDragOver(_ref2) { - let { - active, - over - } = _ref2; - if (over) { - return "Draggable item " + active.id + " was moved over droppable area " + over.id + "."; - } - return "Draggable item " + active.id + " is no longer over a droppable area."; - }, - onDragEnd(_ref3) { - let { - active, - over - } = _ref3; - if (over) { - return "Draggable item " + active.id + " was dropped over droppable area " + over.id; - } - return "Draggable item " + active.id + " was dropped."; - }, - onDragCancel(_ref4) { - let { - active - } = _ref4; - return "Dragging was cancelled. Draggable item " + active.id + " was dropped."; - } -}; -function Accessibility(_ref) { - let { - announcements = defaultAnnouncements, - container, - hiddenTextDescribedById, - screenReaderInstructions = defaultScreenReaderInstructions - } = _ref; - const { - announce, - announcement - } = useAnnouncement(); - const liveRegionId = useUniqueId("DndLiveRegion"); - const [mounted, setMounted] = h2(false); - p2(() => { - setMounted(true); - }, []); - useDndMonitor(F2(() => ({ - onDragStart(_ref2) { - let { - active - } = _ref2; - announce(announcements.onDragStart({ - active - })); - }, - onDragMove(_ref3) { - let { - active, - over - } = _ref3; - if (announcements.onDragMove) { - announce(announcements.onDragMove({ - active, - over - })); - } - }, - onDragOver(_ref4) { - let { - active, - over - } = _ref4; - announce(announcements.onDragOver({ - active, - over - })); - }, - onDragEnd(_ref5) { - let { - active, - over - } = _ref5; - announce(announcements.onDragEnd({ - active, - over - })); - }, - onDragCancel(_ref6) { - let { - active, - over - } = _ref6; - announce(announcements.onDragCancel({ - active, - over - })); - } - }), [announce, announcements])); - if (!mounted) { - return null; - } - const markup = Cn.createElement(Cn.Fragment, null, Cn.createElement(HiddenText, { - id: hiddenTextDescribedById, - value: screenReaderInstructions.draggable - }), Cn.createElement(LiveRegion, { - id: liveRegionId, - announcement - })); - return container ? z3(markup, container) : markup; -} -var Action; -(function(Action2) { - Action2["DragStart"] = "dragStart"; - Action2["DragMove"] = "dragMove"; - Action2["DragEnd"] = "dragEnd"; - Action2["DragCancel"] = "dragCancel"; - Action2["DragOver"] = "dragOver"; - Action2["RegisterDroppable"] = "registerDroppable"; - Action2["SetDroppableDisabled"] = "setDroppableDisabled"; - Action2["UnregisterDroppable"] = "unregisterDroppable"; -})(Action || (Action = {})); -function noop() { -} -function useSensor(sensor, options) { - return F2( - () => ({ - sensor, - options: options != null ? options : {} - }), - [sensor, options] - ); -} -function useSensors() { - for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) { - sensors[_key] = arguments[_key]; - } - return F2( - () => [...sensors].filter((sensor) => sensor != null), - [...sensors] - ); -} -var defaultCoordinates = /* @__PURE__ */ Object.freeze({ - x: 0, - y: 0 -}); -function distanceBetween(p1, p22) { - return Math.sqrt(Math.pow(p1.x - p22.x, 2) + Math.pow(p1.y - p22.y, 2)); -} -function getRelativeTransformOrigin(event, rect) { - const eventCoordinates = getEventCoordinates(event); - if (!eventCoordinates) { - return "0 0"; - } - const transformOrigin = { - x: (eventCoordinates.x - rect.left) / rect.width * 100, - y: (eventCoordinates.y - rect.top) / rect.height * 100 - }; - return transformOrigin.x + "% " + transformOrigin.y + "%"; -} -function sortCollisionsAsc(_ref, _ref2) { - let { - data: { - value: a5 - } - } = _ref; - let { - data: { - value: b4 - } - } = _ref2; - return a5 - b4; -} -function sortCollisionsDesc(_ref3, _ref4) { - let { - data: { - value: a5 - } - } = _ref3; - let { - data: { - value: b4 - } - } = _ref4; - return b4 - a5; -} -function cornersOfRectangle(_ref5) { - let { - left, - top, - height, - width - } = _ref5; - return [{ - x: left, - y: top - }, { - x: left + width, - y: top - }, { - x: left, - y: top + height - }, { - x: left + width, - y: top + height - }]; -} -function getFirstCollision(collisions, property) { - if (!collisions || collisions.length === 0) { - return null; - } - const [firstCollision] = collisions; - return property ? firstCollision[property] : firstCollision; -} -function centerOfRectangle(rect, left, top) { - if (left === void 0) { - left = rect.left; - } - if (top === void 0) { - top = rect.top; - } - return { - x: left + rect.width * 0.5, - y: top + rect.height * 0.5 - }; -} -var closestCenter = (_ref) => { - let { - collisionRect, - droppableRects, - droppableContainers - } = _ref; - const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top); - const collisions = []; - for (const droppableContainer of droppableContainers) { - const { - id: id2 - } = droppableContainer; - const rect = droppableRects.get(id2); - if (rect) { - const distBetween = distanceBetween(centerOfRectangle(rect), centerRect); - collisions.push({ - id: id2, - data: { - droppableContainer, - value: distBetween - } - }); - } - } - return collisions.sort(sortCollisionsAsc); -}; -var closestCorners = (_ref) => { - let { - collisionRect, - droppableRects, - droppableContainers - } = _ref; - const corners = cornersOfRectangle(collisionRect); - const collisions = []; - for (const droppableContainer of droppableContainers) { - const { - id: id2 - } = droppableContainer; - const rect = droppableRects.get(id2); - if (rect) { - const rectCorners = cornersOfRectangle(rect); - const distances = corners.reduce((accumulator, corner, index) => { - return accumulator + distanceBetween(rectCorners[index], corner); - }, 0); - const effectiveDistance = Number((distances / 4).toFixed(4)); - collisions.push({ - id: id2, - data: { - droppableContainer, - value: effectiveDistance - } - }); - } - } - return collisions.sort(sortCollisionsAsc); -}; -function getIntersectionRatio(entry, target) { - const top = Math.max(target.top, entry.top); - const left = Math.max(target.left, entry.left); - const right = Math.min(target.left + target.width, entry.left + entry.width); - const bottom = Math.min(target.top + target.height, entry.top + entry.height); - const width = right - left; - const height = bottom - top; - if (left < right && top < bottom) { - const targetArea = target.width * target.height; - const entryArea = entry.width * entry.height; - const intersectionArea = width * height; - const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea); - return Number(intersectionRatio.toFixed(4)); - } - return 0; -} -var rectIntersection = (_ref) => { - let { - collisionRect, - droppableRects, - droppableContainers - } = _ref; - const collisions = []; - for (const droppableContainer of droppableContainers) { - const { - id: id2 - } = droppableContainer; - const rect = droppableRects.get(id2); - if (rect) { - const intersectionRatio = getIntersectionRatio(rect, collisionRect); - if (intersectionRatio > 0) { - collisions.push({ - id: id2, - data: { - droppableContainer, - value: intersectionRatio - } - }); - } - } - } - return collisions.sort(sortCollisionsDesc); -}; -function adjustScale(transform, rect1, rect2) { - return { - ...transform, - scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1, - scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1 - }; -} -function getRectDelta(rect1, rect2) { - return rect1 && rect2 ? { - x: rect1.left - rect2.left, - y: rect1.top - rect2.top - } : defaultCoordinates; -} -function createRectAdjustmentFn(modifier) { - return function adjustClientRect(rect) { - for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - adjustments[_key - 1] = arguments[_key]; - } - return adjustments.reduce((acc, adjustment) => ({ - ...acc, - top: acc.top + modifier * adjustment.y, - bottom: acc.bottom + modifier * adjustment.y, - left: acc.left + modifier * adjustment.x, - right: acc.right + modifier * adjustment.x - }), { - ...rect - }); - }; -} -var getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1); -function parseTransform(transform) { - if (transform.startsWith("matrix3d(")) { - const transformArray = transform.slice(9, -1).split(/, /); - return { - x: +transformArray[12], - y: +transformArray[13], - scaleX: +transformArray[0], - scaleY: +transformArray[5] - }; - } else if (transform.startsWith("matrix(")) { - const transformArray = transform.slice(7, -1).split(/, /); - return { - x: +transformArray[4], - y: +transformArray[5], - scaleX: +transformArray[0], - scaleY: +transformArray[3] - }; - } - return null; -} -function inverseTransform(rect, transform, transformOrigin) { - const parsedTransform = parseTransform(transform); - if (!parsedTransform) { - return rect; - } - const { - scaleX, - scaleY, - x: translateX, - y: translateY - } = parsedTransform; - const x5 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin); - const y5 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1)); - const w5 = scaleX ? rect.width / scaleX : rect.width; - const h5 = scaleY ? rect.height / scaleY : rect.height; - return { - width: w5, - height: h5, - top: y5, - right: x5 + w5, - bottom: y5 + h5, - left: x5 - }; -} -var defaultOptions2 = { - ignoreTransform: false -}; -function getClientRect(element, options) { - if (options === void 0) { - options = defaultOptions2; - } - let rect = element.getBoundingClientRect(); - if (options.ignoreTransform) { - const { - transform, - transformOrigin - } = getWindow(element).getComputedStyle(element); - if (transform) { - rect = inverseTransform(rect, transform, transformOrigin); - } - } - const { - top, - left, - width, - height, - bottom, - right - } = rect; - return { - top, - left, - width, - height, - bottom, - right - }; -} -function getTransformAgnosticClientRect(element) { - return getClientRect(element, { - ignoreTransform: true - }); -} -function getWindowClientRect(element) { - const width = element.innerWidth; - const height = element.innerHeight; - return { - top: 0, - left: 0, - right: width, - bottom: height, - width, - height - }; -} -function isFixed(node, computedStyle) { - if (computedStyle === void 0) { - computedStyle = getWindow(node).getComputedStyle(node); - } - return computedStyle.position === "fixed"; -} -function isScrollable(element, computedStyle) { - if (computedStyle === void 0) { - computedStyle = getWindow(element).getComputedStyle(element); - } - const overflowRegex = /(auto|scroll|overlay)/; - const properties2 = ["overflow", "overflowX", "overflowY"]; - return properties2.some((property) => { - const value = computedStyle[property]; - return typeof value === "string" ? overflowRegex.test(value) : false; - }); -} -function getScrollableAncestors(element, limit) { - const scrollParents = []; - function findScrollableAncestors(node) { - if (limit != null && scrollParents.length >= limit) { - return scrollParents; - } - if (!node) { - return scrollParents; - } - if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) { - scrollParents.push(node.scrollingElement); - return scrollParents; - } - if (!isHTMLElement(node) || isSVGElement(node)) { - return scrollParents; - } - if (scrollParents.includes(node)) { - return scrollParents; - } - const computedStyle = getWindow(element).getComputedStyle(node); - if (node !== element) { - if (isScrollable(node, computedStyle)) { - scrollParents.push(node); - } - } - if (isFixed(node, computedStyle)) { - return scrollParents; - } - return findScrollableAncestors(node.parentNode); - } - if (!element) { - return scrollParents; - } - return findScrollableAncestors(element); -} -function getFirstScrollableAncestor(node) { - const [firstScrollableAncestor] = getScrollableAncestors(node, 1); - return firstScrollableAncestor != null ? firstScrollableAncestor : null; -} -function getScrollableElement(element) { - if (!canUseDOM || !element) { - return null; - } - if (isWindow(element)) { - return element; - } - if (!isNode(element)) { - return null; - } - if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) { - return window; - } - if (isHTMLElement(element)) { - return element; - } - return null; -} -function getScrollXCoordinate(element) { - if (isWindow(element)) { - return element.scrollX; - } - return element.scrollLeft; -} -function getScrollYCoordinate(element) { - if (isWindow(element)) { - return element.scrollY; - } - return element.scrollTop; -} -function getScrollCoordinates(element) { - return { - x: getScrollXCoordinate(element), - y: getScrollYCoordinate(element) - }; -} -var Direction2; -(function(Direction3) { - Direction3[Direction3["Forward"] = 1] = "Forward"; - Direction3[Direction3["Backward"] = -1] = "Backward"; -})(Direction2 || (Direction2 = {})); -function isDocumentScrollingElement(element) { - if (!canUseDOM || !element) { - return false; - } - return element === document.scrollingElement; -} -function getScrollPosition(scrollingContainer) { - const minScroll = { - x: 0, - y: 0 - }; - const dimensions = isDocumentScrollingElement(scrollingContainer) ? { - height: window.innerHeight, - width: window.innerWidth - } : { - height: scrollingContainer.clientHeight, - width: scrollingContainer.clientWidth - }; - const maxScroll = { - x: scrollingContainer.scrollWidth - dimensions.width, - y: scrollingContainer.scrollHeight - dimensions.height - }; - const isTop = scrollingContainer.scrollTop <= minScroll.y; - const isLeft = scrollingContainer.scrollLeft <= minScroll.x; - const isBottom = scrollingContainer.scrollTop >= maxScroll.y; - const isRight = scrollingContainer.scrollLeft >= maxScroll.x; - return { - isTop, - isLeft, - isBottom, - isRight, - maxScroll, - minScroll - }; -} -var defaultThreshold = { - x: 0.2, - y: 0.2 -}; -function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) { - let { - top, - left, - right, - bottom - } = _ref; - if (acceleration === void 0) { - acceleration = 10; - } - if (thresholdPercentage === void 0) { - thresholdPercentage = defaultThreshold; - } - const { - isTop, - isBottom, - isLeft, - isRight - } = getScrollPosition(scrollContainer); - const direction = { - x: 0, - y: 0 - }; - const speed = { - x: 0, - y: 0 - }; - const threshold = { - height: scrollContainerRect.height * thresholdPercentage.y, - width: scrollContainerRect.width * thresholdPercentage.x - }; - if (!isTop && top <= scrollContainerRect.top + threshold.height) { - direction.y = Direction2.Backward; - speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height); - } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) { - direction.y = Direction2.Forward; - speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height); - } - if (!isRight && right >= scrollContainerRect.right - threshold.width) { - direction.x = Direction2.Forward; - speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width); - } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) { - direction.x = Direction2.Backward; - speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width); - } - return { - direction, - speed - }; -} -function getScrollElementRect(element) { - if (element === document.scrollingElement) { - const { - innerWidth: innerWidth2, - innerHeight: innerHeight2 - } = window; - return { - top: 0, - left: 0, - right: innerWidth2, - bottom: innerHeight2, - width: innerWidth2, - height: innerHeight2 - }; - } - const { - top, - left, - right, - bottom - } = element.getBoundingClientRect(); - return { - top, - left, - right, - bottom, - width: element.clientWidth, - height: element.clientHeight - }; -} -function getScrollOffsets(scrollableAncestors) { - return scrollableAncestors.reduce((acc, node) => { - return add(acc, getScrollCoordinates(node)); - }, defaultCoordinates); -} -function getScrollXOffset(scrollableAncestors) { - return scrollableAncestors.reduce((acc, node) => { - return acc + getScrollXCoordinate(node); - }, 0); -} -function getScrollYOffset(scrollableAncestors) { - return scrollableAncestors.reduce((acc, node) => { - return acc + getScrollYCoordinate(node); - }, 0); -} -function scrollIntoViewIfNeeded(element, measure) { - if (measure === void 0) { - measure = getClientRect; - } - if (!element) { - return; - } - const { - top, - left, - bottom, - right - } = measure(element); - const firstScrollableAncestor = getFirstScrollableAncestor(element); - if (!firstScrollableAncestor) { - return; - } - if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) { - element.scrollIntoView({ - block: "center", - inline: "center" - }); - } -} -var properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]]; -var Rect = class { - constructor(rect, element) { - this.rect = void 0; - this.width = void 0; - this.height = void 0; - this.top = void 0; - this.bottom = void 0; - this.right = void 0; - this.left = void 0; - const scrollableAncestors = getScrollableAncestors(element); - const scrollOffsets = getScrollOffsets(scrollableAncestors); - this.rect = { - ...rect - }; - this.width = rect.width; - this.height = rect.height; - 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[key2] + scrollOffsetsDeltla; - }, - enumerable: true - }); - } - } - Object.defineProperty(this, "rect", { - enumerable: false - }); - } -}; -var Listeners = class { - constructor(target) { - this.target = void 0; - this.listeners = []; - this.removeAll = () => { - this.listeners.forEach((listener) => { - var _this$target; - return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener); - }); - }; - this.target = target; - } - add(eventName, handler, options) { - var _this$target2; - (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options); - this.listeners.push([eventName, handler, options]); - } -}; -function getEventListenerTarget(target) { - const { - EventTarget - } = getWindow(target); - return target instanceof EventTarget ? target : getOwnerDocument(target); -} -function hasExceededDistance(delta, measurement) { - const dx = Math.abs(delta.x); - const dy = Math.abs(delta.y); - if (typeof measurement === "number") { - return Math.sqrt(dx ** 2 + dy ** 2) > measurement; - } - if ("x" in measurement && "y" in measurement) { - return dx > measurement.x && dy > measurement.y; - } - if ("x" in measurement) { - return dx > measurement.x; - } - if ("y" in measurement) { - return dy > measurement.y; - } - return false; -} -var EventName; -(function(EventName2) { - EventName2["Click"] = "click"; - EventName2["DragStart"] = "dragstart"; - EventName2["Keydown"] = "keydown"; - EventName2["ContextMenu"] = "contextmenu"; - EventName2["Resize"] = "resize"; - EventName2["SelectionChange"] = "selectionchange"; - EventName2["VisibilityChange"] = "visibilitychange"; -})(EventName || (EventName = {})); -function preventDefault(event) { - event.preventDefault(); -} -function stopPropagation(event) { - event.stopPropagation(); -} -var KeyboardCode; -(function(KeyboardCode2) { - KeyboardCode2["Space"] = "Space"; - KeyboardCode2["Down"] = "ArrowDown"; - KeyboardCode2["Right"] = "ArrowRight"; - KeyboardCode2["Left"] = "ArrowLeft"; - KeyboardCode2["Up"] = "ArrowUp"; - KeyboardCode2["Esc"] = "Escape"; - KeyboardCode2["Enter"] = "Enter"; -})(KeyboardCode || (KeyboardCode = {})); -var defaultKeyboardCodes = { - start: [KeyboardCode.Space, KeyboardCode.Enter], - cancel: [KeyboardCode.Esc], - end: [KeyboardCode.Space, KeyboardCode.Enter] -}; -var defaultKeyboardCoordinateGetter = (event, _ref) => { - let { - currentCoordinates - } = _ref; - switch (event.code) { - case KeyboardCode.Right: - return { - ...currentCoordinates, - x: currentCoordinates.x + 25 - }; - case KeyboardCode.Left: - return { - ...currentCoordinates, - x: currentCoordinates.x - 25 - }; - case KeyboardCode.Down: - return { - ...currentCoordinates, - y: currentCoordinates.y + 25 - }; - case KeyboardCode.Up: - return { - ...currentCoordinates, - y: currentCoordinates.y - 25 - }; - } - return void 0; -}; -var KeyboardSensor = class { - constructor(props2) { - this.props = void 0; - this.autoScrollEnabled = false; - this.referenceCoordinates = void 0; - this.listeners = void 0; - this.windowListeners = void 0; - this.props = props2; - const { - event: { - target - } - } = props2; - this.props = props2; - this.listeners = new Listeners(getOwnerDocument(target)); - this.windowListeners = new Listeners(getWindow(target)); - this.handleKeyDown = this.handleKeyDown.bind(this); - this.handleCancel = this.handleCancel.bind(this); - this.attach(); - } - attach() { - this.handleStart(); - this.windowListeners.add(EventName.Resize, this.handleCancel); - this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); - setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown)); - } - handleStart() { - const { - activeNode, - onStart - } = this.props; - const node = activeNode.node.current; - if (node) { - scrollIntoViewIfNeeded(node); - } - onStart(defaultCoordinates); - } - handleKeyDown(event) { - if (isKeyboardEvent(event)) { - const { - active, - context, - options - } = this.props; - const { - keyboardCodes = defaultKeyboardCodes, - coordinateGetter = defaultKeyboardCoordinateGetter, - scrollBehavior = "smooth" - } = options; - const { - code - } = event; - if (keyboardCodes.end.includes(code)) { - this.handleEnd(event); - return; - } - if (keyboardCodes.cancel.includes(code)) { - this.handleCancel(event); - return; - } - const { - collisionRect - } = context.current; - const currentCoordinates = collisionRect ? { - x: collisionRect.left, - y: collisionRect.top - } : defaultCoordinates; - if (!this.referenceCoordinates) { - this.referenceCoordinates = currentCoordinates; - } - const newCoordinates = coordinateGetter(event, { - active, - context: context.current, - currentCoordinates - }); - if (newCoordinates) { - const coordinatesDelta = subtract(newCoordinates, currentCoordinates); - const scrollDelta = { - x: 0, - y: 0 - }; - const { - scrollableAncestors - } = context.current; - for (const scrollContainer of scrollableAncestors) { - const direction = event.code; - const { - isTop, - isRight, - isLeft, - isBottom, - maxScroll, - minScroll - } = getScrollPosition(scrollContainer); - const scrollElementRect = getScrollElementRect(scrollContainer); - const clampedCoordinates = { - x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)), - y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y)) - }; - const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft; - const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop; - if (canScrollX && clampedCoordinates.x !== newCoordinates.x) { - const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x; - const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x; - if (canScrollToNewCoordinates && !coordinatesDelta.y) { - scrollContainer.scrollTo({ - left: newScrollCoordinates, - behavior: scrollBehavior - }); - return; - } - if (canScrollToNewCoordinates) { - scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates; - } else { - scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x; - } - if (scrollDelta.x) { - scrollContainer.scrollBy({ - left: -scrollDelta.x, - behavior: scrollBehavior - }); - } - break; - } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) { - const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y; - const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y; - if (canScrollToNewCoordinates && !coordinatesDelta.x) { - scrollContainer.scrollTo({ - top: newScrollCoordinates, - behavior: scrollBehavior - }); - return; - } - if (canScrollToNewCoordinates) { - scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates; - } else { - scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y; - } - if (scrollDelta.y) { - scrollContainer.scrollBy({ - top: -scrollDelta.y, - behavior: scrollBehavior - }); - } - break; - } - } - this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta)); - } - } - } - handleMove(event, coordinates) { - const { - onMove - } = this.props; - event.preventDefault(); - onMove(coordinates); - } - handleEnd(event) { - const { - onEnd - } = this.props; - event.preventDefault(); - this.detach(); - onEnd(); - } - handleCancel(event) { - const { - onCancel - } = this.props; - event.preventDefault(); - this.detach(); - onCancel(); - } - detach() { - this.listeners.removeAll(); - this.windowListeners.removeAll(); - } -}; -KeyboardSensor.activators = [{ - eventName: "onKeyDown", - handler: (event, _ref, _ref2) => { - let { - keyboardCodes = defaultKeyboardCodes, - onActivation - } = _ref; - let { - active - } = _ref2; - const { - code - } = event.nativeEvent; - if (keyboardCodes.start.includes(code)) { - const activator = active.activatorNode.current; - if (activator && event.target !== activator) { - return false; - } - event.preventDefault(); - onActivation == null ? void 0 : onActivation({ - event: event.nativeEvent - }); - return true; - } - return false; - } -}]; -function isDistanceConstraint(constraint) { - return Boolean(constraint && "distance" in constraint); -} -function isDelayConstraint(constraint) { - return Boolean(constraint && "delay" in constraint); -} -var AbstractPointerSensor = class { - constructor(props2, events2, listenerTarget) { - var _getEventCoordinates; - if (listenerTarget === void 0) { - listenerTarget = getEventListenerTarget(props2.event.target); - } - this.props = void 0; - this.events = void 0; - this.autoScrollEnabled = true; - this.document = void 0; - this.activated = false; - this.initialCoordinates = void 0; - this.timeoutId = null; - this.listeners = void 0; - this.documentListeners = void 0; - this.windowListeners = void 0; - this.props = props2; - this.events = events2; - const { - event - } = props2; - const { - target - } = event; - this.props = props2; - this.events = events2; - this.document = getOwnerDocument(target); - this.documentListeners = new Listeners(this.document); - this.listeners = new Listeners(listenerTarget); - this.windowListeners = new Listeners(getWindow(target)); - this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates; - this.handleStart = this.handleStart.bind(this); - this.handleMove = this.handleMove.bind(this); - this.handleEnd = this.handleEnd.bind(this); - this.handleCancel = this.handleCancel.bind(this); - this.handleKeydown = this.handleKeydown.bind(this); - this.removeTextSelection = this.removeTextSelection.bind(this); - this.attach(); - } - attach() { - const { - events: events2, - props: { - options: { - activationConstraint - } - } - } = this; - this.listeners.add(events2.move.name, this.handleMove, { - passive: false - }); - this.listeners.add(events2.end.name, this.handleEnd); - this.windowListeners.add(EventName.Resize, this.handleCancel); - this.windowListeners.add(EventName.DragStart, preventDefault); - this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); - this.windowListeners.add(EventName.ContextMenu, preventDefault); - this.documentListeners.add(EventName.Keydown, this.handleKeydown); - if (activationConstraint) { - if (isDistanceConstraint(activationConstraint)) { - return; - } - if (isDelayConstraint(activationConstraint)) { - this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay); - return; - } - } - this.handleStart(); - } - detach() { - this.listeners.removeAll(); - this.windowListeners.removeAll(); - setTimeout(this.documentListeners.removeAll, 50); - if (this.timeoutId !== null) { - clearTimeout(this.timeoutId); - this.timeoutId = null; - } - } - handleStart() { - const { - initialCoordinates - } = this; - const { - onStart - } = this.props; - if (initialCoordinates) { - this.activated = true; - this.documentListeners.add(EventName.Click, stopPropagation, { - capture: true - }); - this.removeTextSelection(); - this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection); - onStart(initialCoordinates); - } - } - handleMove(event) { - var _getEventCoordinates2; - const { - activated, - initialCoordinates, - props: props2 - } = this; - const { - onMove, - options: { - activationConstraint - } - } = props2; - if (!initialCoordinates) { - return; - } - const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates; - const delta = subtract(initialCoordinates, coordinates); - if (!activated && activationConstraint) { - if (isDelayConstraint(activationConstraint)) { - if (hasExceededDistance(delta, activationConstraint.tolerance)) { - return this.handleCancel(); - } - return; - } - if (isDistanceConstraint(activationConstraint)) { - if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) { - return this.handleCancel(); - } - if (hasExceededDistance(delta, activationConstraint.distance)) { - return this.handleStart(); - } - return; - } - } - if (event.cancelable) { - event.preventDefault(); - } - onMove(coordinates); - } - handleEnd() { - const { - onEnd - } = this.props; - this.detach(); - onEnd(); - } - handleCancel() { - const { - onCancel - } = this.props; - this.detach(); - onCancel(); - } - handleKeydown(event) { - if (event.code === KeyboardCode.Esc) { - this.handleCancel(); - } - } - removeTextSelection() { - var _this$document$getSel; - (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges(); - } -}; -var events = { - move: { - name: "pointermove" - }, - end: { - name: "pointerup" - } -}; -var PointerSensor = class extends AbstractPointerSensor { - constructor(props2) { - const { - event - } = props2; - const listenerTarget = getOwnerDocument(event.target); - super(props2, events, listenerTarget); - } -}; -PointerSensor.activators = [{ - eventName: "onPointerDown", - handler: (_ref, _ref2) => { - let { - nativeEvent: event - } = _ref; - let { - onActivation - } = _ref2; - if (!event.isPrimary || event.button !== 0) { - return false; - } - onActivation == null ? void 0 : onActivation({ - event - }); - return true; - } -}]; -var events$1 = { - move: { - name: "mousemove" - }, - end: { - name: "mouseup" - } -}; -var MouseButton; -(function(MouseButton2) { - MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick"; -})(MouseButton || (MouseButton = {})); -var MouseSensor = class extends AbstractPointerSensor { - constructor(props2) { - super(props2, events$1, getOwnerDocument(props2.event.target)); - } -}; -MouseSensor.activators = [{ - eventName: "onMouseDown", - handler: (_ref, _ref2) => { - let { - nativeEvent: event - } = _ref; - let { - onActivation - } = _ref2; - if (event.button === MouseButton.RightClick) { - return false; - } - onActivation == null ? void 0 : onActivation({ - event - }); - return true; - } -}]; -var events$2 = { - move: { - name: "touchmove" - }, - end: { - name: "touchend" - } -}; -var TouchSensor = class extends AbstractPointerSensor { - constructor(props2) { - super(props2, events$2); - } - static setup() { - window.addEventListener(events$2.move.name, noop2, { - capture: false, - passive: false - }); - return function teardown() { - window.removeEventListener(events$2.move.name, noop2); - }; - function noop2() { - } - } -}; -TouchSensor.activators = [{ - eventName: "onTouchStart", - handler: (_ref, _ref2) => { - let { - nativeEvent: event - } = _ref; - let { - onActivation - } = _ref2; - const { - touches - } = event; - if (touches.length > 1) { - return false; - } - onActivation == null ? void 0 : onActivation({ - event - }); - return true; - } -}]; -var AutoScrollActivator; -(function(AutoScrollActivator2) { - AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer"; - AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect"; -})(AutoScrollActivator || (AutoScrollActivator = {})); -var TraversalOrder; -(function(TraversalOrder2) { - TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder"; - TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder"; -})(TraversalOrder || (TraversalOrder = {})); -function useAutoScroller(_ref) { - let { - acceleration, - activator = AutoScrollActivator.Pointer, - canScroll, - draggingRect, - enabled, - interval = 5, - order = TraversalOrder.TreeOrder, - pointerCoordinates, - scrollableAncestors, - scrollableAncestorRects, - delta, - threshold - } = _ref; - const scrollIntent = useScrollIntent({ - delta, - disabled: !enabled - }); - const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval(); - const scrollSpeed = _2({ - x: 0, - y: 0 - }); - const scrollDirection = _2({ - x: 0, - y: 0 - }); - const rect = F2(() => { - switch (activator) { - case AutoScrollActivator.Pointer: - return pointerCoordinates ? { - top: pointerCoordinates.y, - bottom: pointerCoordinates.y, - left: pointerCoordinates.x, - right: pointerCoordinates.x - } : null; - case AutoScrollActivator.DraggableRect: - return draggingRect; - } - }, [activator, draggingRect, pointerCoordinates]); - const scrollContainerRef = _2(null); - const autoScroll = T2(() => { - const scrollContainer = scrollContainerRef.current; - if (!scrollContainer) { - return; - } - const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x; - const scrollTop = scrollSpeed.current.y * scrollDirection.current.y; - scrollContainer.scrollBy(scrollLeft, scrollTop); - }, []); - const sortedScrollableAncestors = F2(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]); - p2( - () => { - if (!enabled || !scrollableAncestors.length || !rect) { - clearAutoScrollInterval(); - return; - } - for (const scrollContainer of sortedScrollableAncestors) { - if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { - continue; - } - const index = scrollableAncestors.indexOf(scrollContainer); - const scrollContainerRect = scrollableAncestorRects[index]; - if (!scrollContainerRect) { - continue; - } - const { - direction, - speed - } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold); - for (const axis of ["x", "y"]) { - if (!scrollIntent[axis][direction[axis]]) { - speed[axis] = 0; - direction[axis] = 0; - } - } - if (speed.x > 0 || speed.y > 0) { - clearAutoScrollInterval(); - scrollContainerRef.current = scrollContainer; - setAutoScrollInterval(autoScroll, interval); - scrollSpeed.current = speed; - scrollDirection.current = direction; - return; - } - } - scrollSpeed.current = { - x: 0, - y: 0 - }; - scrollDirection.current = { - x: 0, - y: 0 - }; - clearAutoScrollInterval(); - }, - [ - acceleration, - autoScroll, - canScroll, - clearAutoScrollInterval, - enabled, - interval, - JSON.stringify(rect), - JSON.stringify(scrollIntent), - setAutoScrollInterval, - scrollableAncestors, - sortedScrollableAncestors, - scrollableAncestorRects, - JSON.stringify(threshold) - ] - ); -} -var defaultScrollIntent = { - x: { - [Direction2.Backward]: false, - [Direction2.Forward]: false + return lightFormatters_default.h(date, token); }, - y: { - [Direction2.Backward]: false, - [Direction2.Forward]: false - } -}; -function useScrollIntent(_ref2) { - let { - delta, - disabled - } = _ref2; - const previousDelta = usePrevious(delta); - return useLazyMemo((previousIntent) => { - if (disabled || !previousDelta || !previousIntent) { - return defaultScrollIntent; + H: function H4(date, token, localize2) { + if (token === "Ho") { + return localize2.ordinalNumber(date.getUTCHours(), { + unit: "hour" + }); } - const direction = { - x: Math.sign(delta.x - previousDelta.x), - y: Math.sign(delta.y - previousDelta.y) - }; - return { - x: { - [Direction2.Backward]: previousIntent.x[Direction2.Backward] || direction.x === -1, - [Direction2.Forward]: previousIntent.x[Direction2.Forward] || direction.x === 1 - }, - y: { - [Direction2.Backward]: previousIntent.y[Direction2.Backward] || direction.y === -1, - [Direction2.Forward]: previousIntent.y[Direction2.Forward] || direction.y === 1 - } - }; - }, [disabled, delta, previousDelta]); -} -function useCachedNode(draggableNodes, id2) { - const draggableNode = id2 !== null ? draggableNodes.get(id2) : void 0; - const node = draggableNode ? draggableNode.node.current : null; - return useLazyMemo((cachedNode) => { - var _ref; - if (id2 === null) { - return null; + return lightFormatters_default.H(date, token); + }, + K: function K2(date, token, localize2) { + var hours = date.getUTCHours() % 12; + if (token === "Ko") { + return localize2.ordinalNumber(hours, { + unit: "hour" + }); } - return (_ref = node != null ? node : cachedNode) != null ? _ref : null; - }, [node, id2]); -} -function useCombineActivators(sensors, getSyntheticHandler) { - return F2(() => sensors.reduce((accumulator, sensor) => { - const { - sensor: Sensor - } = sensor; - const sensorActivators = Sensor.activators.map((activator) => ({ - eventName: activator.eventName, - handler: getSyntheticHandler(activator.handler, sensor) - })); - return [...accumulator, ...sensorActivators]; - }, []), [sensors, getSyntheticHandler]); -} -var MeasuringStrategy; -(function(MeasuringStrategy2) { - MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always"; - MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging"; - MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging"; -})(MeasuringStrategy || (MeasuringStrategy = {})); -var MeasuringFrequency; -(function(MeasuringFrequency2) { - MeasuringFrequency2["Optimized"] = "optimized"; -})(MeasuringFrequency || (MeasuringFrequency = {})); -var defaultValue = /* @__PURE__ */ new Map(); -function useDroppableMeasuring(containers, _ref) { - let { - dragging, - dependencies, - config - } = _ref; - const [queue, setQueue] = h2(null); - const { - frequency, - measure, - strategy - } = config; - const containersRef = _2(containers); - const disabled = isDisabled(); - const disabledRef = useLatestValue(disabled); - const measureDroppableContainers = T2(function(ids2) { - if (ids2 === void 0) { - ids2 = []; + return addLeadingZeros(hours, token.length); + }, + k: function k4(date, token, localize2) { + var hours = date.getUTCHours(); + if (hours === 0) + hours = 24; + if (token === "ko") { + return localize2.ordinalNumber(hours, { + unit: "hour" + }); } - if (disabledRef.current) { - return; + return addLeadingZeros(hours, token.length); + }, + m: function m4(date, token, localize2) { + if (token === "mo") { + return localize2.ordinalNumber(date.getUTCMinutes(), { + unit: "minute" + }); } - setQueue((value) => { - if (value === null) { - return ids2; - } - return value.concat(ids2.filter((id2) => !value.includes(id2))); - }); - }, [disabledRef]); - const timeoutId = _2(null); - const droppableRects = useLazyMemo((previousValue) => { - if (disabled && !dragging) { - return defaultValue; + return lightFormatters_default.m(date, token); + }, + s: function s4(date, token, localize2) { + if (token === "so") { + return localize2.ordinalNumber(date.getUTCSeconds(), { + unit: "second" + }); } - if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) { - const map = /* @__PURE__ */ new Map(); - for (let container of containers) { - if (!container) { - continue; - } - if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) { - map.set(container.id, container.rect.current); - continue; - } - const node = container.node.current; - const rect = node ? new Rect(measure(node), node) : null; - container.rect.current = rect; - if (rect) { - map.set(container.id, rect); - } - } - return map; + return lightFormatters_default.s(date, token); + }, + S: function S3(date, token) { + return lightFormatters_default.S(date, token); + }, + X: function X2(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + if (timezoneOffset === 0) { + return "Z"; } - return previousValue; - }, [containers, queue, dragging, disabled, measure]); - p2(() => { - containersRef.current = containers; - }, [containers]); - p2( - () => { - if (disabled) { - return; - } - measureDroppableContainers(); - }, - [dragging, disabled] - ); - p2( - () => { - if (queue && queue.length > 0) { - setQueue(null); - } - }, - [JSON.stringify(queue)] - ); - p2( - () => { - if (disabled || typeof frequency !== "number" || timeoutId.current !== null) { - return; - } - timeoutId.current = setTimeout(() => { - measureDroppableContainers(); - timeoutId.current = null; - }, frequency); - }, - [frequency, disabled, measureDroppableContainers, ...dependencies] - ); - return { - droppableRects, - measureDroppableContainers, - measuringScheduled: queue != null - }; - function isDisabled() { - switch (strategy) { - case MeasuringStrategy.Always: - return false; - case MeasuringStrategy.BeforeDragging: - return dragging; + switch (token) { + case "X": + return formatTimezoneWithOptionalMinutes(timezoneOffset); + case "XXXX": + case "XX": + return formatTimezone(timezoneOffset); + case "XXXXX": + case "XXX": default: - return !dragging; + return formatTimezone(timezoneOffset, ":"); } - } -} -function useInitialValue(value, computeFn) { - return useLazyMemo((previousValue) => { - if (!value) { - return null; + }, + x: function x4(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + switch (token) { + case "x": + return formatTimezoneWithOptionalMinutes(timezoneOffset); + case "xxxx": + case "xx": + return formatTimezone(timezoneOffset); + case "xxxxx": + case "xxx": + default: + return formatTimezone(timezoneOffset, ":"); } - if (previousValue) { - return previousValue; + }, + O: function O3(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + switch (token) { + case "O": + case "OO": + case "OOO": + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); + case "OOOO": + default: + return "GMT" + formatTimezone(timezoneOffset, ":"); } - return typeof computeFn === "function" ? computeFn(value) : value; - }, [computeFn, value]); -} -function useInitialRect(node, measure) { - return useInitialValue(node, measure); -} -function useMutationObserver(_ref) { - let { - callback, - disabled - } = _ref; - const handleMutations = useEvent(callback); - const mutationObserver = F2(() => { - if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") { - return void 0; + }, + z: function z4(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + switch (token) { + case "z": + case "zz": + case "zzz": + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); + case "zzzz": + default: + return "GMT" + formatTimezone(timezoneOffset, ":"); } - const { - MutationObserver - } = window; - return new MutationObserver(handleMutations); - }, [handleMutations, disabled]); - p2(() => { - return () => mutationObserver == null ? void 0 : mutationObserver.disconnect(); - }, [mutationObserver]); - return mutationObserver; -} -function useResizeObserver(_ref) { - let { - callback, - disabled - } = _ref; - const handleResize = useEvent(callback); - const resizeObserver = F2( - () => { - if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") { - return void 0; - } - const { - ResizeObserver - } = window; - return new ResizeObserver(handleResize); - }, - [disabled] - ); - p2(() => { - return () => resizeObserver == null ? void 0 : resizeObserver.disconnect(); - }, [resizeObserver]); - return resizeObserver; -} -function defaultMeasure(element) { - return new Rect(getClientRect(element), element); -} -function useRect(element, measure, fallbackRect) { - if (measure === void 0) { - measure = defaultMeasure; + }, + t: function t3(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timestamp = Math.floor(originalDate.getTime() / 1e3); + return addLeadingZeros(timestamp, token.length); + }, + T: function T5(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timestamp = originalDate.getTime(); + return addLeadingZeros(timestamp, token.length); } - const [rect, measureRect] = s2(reducer2, null); - const mutationObserver = useMutationObserver({ - callback(records) { - if (!element) { - return; - } - for (const record of records) { - const { - type, - target - } = record; - if (type === "childList" && target instanceof HTMLElement && target.contains(element)) { - measureRect(); - break; - } - } - } - }); - const resizeObserver = useResizeObserver({ - callback: measureRect - }); - useIsomorphicLayoutEffect(() => { - measureRect(); - if (element) { - resizeObserver == null ? void 0 : resizeObserver.observe(element); - mutationObserver == null ? void 0 : mutationObserver.observe(document.body, { - childList: true, - subtree: true - }); - } else { - resizeObserver == null ? void 0 : resizeObserver.disconnect(); - mutationObserver == null ? void 0 : mutationObserver.disconnect(); - } - }, [element]); - return rect; - function reducer2(currentRect) { - if (!element) { - return null; - } - if (element.isConnected === false) { - var _ref; - return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null; - } - const newRect = measure(element); - if (JSON.stringify(currentRect) === JSON.stringify(newRect)) { - return currentRect; - } - return newRect; +}; +function formatTimezoneShort(offset, dirtyDelimiter) { + var sign = offset > 0 ? "-" : "+"; + var absOffset = Math.abs(offset); + var hours = Math.floor(absOffset / 60); + var minutes = absOffset % 60; + if (minutes === 0) { + return sign + String(hours); } + var delimiter = dirtyDelimiter || ""; + return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); } -function useRectDelta(rect) { - const initialRect = useInitialValue(rect); - return getRectDelta(rect, initialRect); +function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { + if (offset % 60 === 0) { + var sign = offset > 0 ? "-" : "+"; + return sign + addLeadingZeros(Math.abs(offset) / 60, 2); + } + return formatTimezone(offset, dirtyDelimiter); } -var defaultValue$1 = []; -function useScrollableAncestors(node) { - const previousNode = _2(node); - const ancestors = useLazyMemo((previousValue) => { - if (!node) { - return defaultValue$1; - } - if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) { - return previousValue; - } - return getScrollableAncestors(node); - }, [node]); - p2(() => { - previousNode.current = node; - }, [node]); - return ancestors; +function formatTimezone(offset, dirtyDelimiter) { + var delimiter = dirtyDelimiter || ""; + var sign = offset > 0 ? "-" : "+"; + var absOffset = Math.abs(offset); + var hours = addLeadingZeros(Math.floor(absOffset / 60), 2); + var minutes = addLeadingZeros(absOffset % 60, 2); + return sign + hours + delimiter + minutes; } -function useScrollOffsets(elements) { - const [scrollCoordinates, setScrollCoordinates] = h2(null); - const prevElements = _2(elements); - const handleScroll = T2((event) => { - const scrollingElement = getScrollableElement(event.target); - if (!scrollingElement) { - return; - } - setScrollCoordinates((scrollCoordinates2) => { - if (!scrollCoordinates2) { - return null; - } - scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement)); - return new Map(scrollCoordinates2); - }); - }, []); - p2(() => { - const previousElements = prevElements.current; - if (elements !== previousElements) { - cleanup(previousElements); - const entries = elements.map((element) => { - const scrollableElement = getScrollableElement(element); - if (scrollableElement) { - scrollableElement.addEventListener("scroll", handleScroll, { - passive: true - }); - return [scrollableElement, getScrollCoordinates(scrollableElement)]; - } - return null; - }).filter((entry) => entry != null); - setScrollCoordinates(entries.length ? new Map(entries) : null); - prevElements.current = elements; - } - return () => { - cleanup(elements); - cleanup(previousElements); - }; - function cleanup(elements2) { - elements2.forEach((element) => { - const scrollableElement = getScrollableElement(element); - scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll); +var formatters_default = formatters2; + +// node_modules/date-fns/esm/_lib/format/longFormatters/index.js +var dateLongFormatter = function dateLongFormatter2(pattern, formatLong2) { + switch (pattern) { + case "P": + return formatLong2.date({ + width: "short" + }); + case "PP": + return formatLong2.date({ + width: "medium" + }); + case "PPP": + return formatLong2.date({ + width: "long" + }); + case "PPPP": + default: + return formatLong2.date({ + width: "full" + }); + } +}; +var timeLongFormatter = function timeLongFormatter2(pattern, formatLong2) { + switch (pattern) { + case "p": + return formatLong2.time({ + width: "short" + }); + case "pp": + return formatLong2.time({ + width: "medium" + }); + case "ppp": + return formatLong2.time({ + width: "long" + }); + case "pppp": + default: + return formatLong2.time({ + width: "full" }); - } - }, [handleScroll, elements]); - return F2(() => { - if (elements.length) { - return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements); - } - return defaultCoordinates; - }, [elements, scrollCoordinates]); -} -function useScrollOffsetsDelta(scrollOffsets, dependencies) { - if (dependencies === void 0) { - dependencies = []; } - const initialScrollOffsets = _2(null); - p2( - () => { - initialScrollOffsets.current = null; - }, - dependencies - ); - p2(() => { - const hasScrollOffsets = scrollOffsets !== defaultCoordinates; - if (hasScrollOffsets && !initialScrollOffsets.current) { - initialScrollOffsets.current = scrollOffsets; - } - if (!hasScrollOffsets && initialScrollOffsets.current) { - initialScrollOffsets.current = null; - } - }, [scrollOffsets]); - return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates; -} -function useSensorSetup(sensors) { - p2( - () => { - if (!canUseDOM) { - return; - } - const teardownFns = sensors.map((_ref) => { - let { - sensor - } = _ref; - return sensor.setup == null ? void 0 : sensor.setup(); +}; +var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong2) { + var matchResult = pattern.match(/(P+)(p+)?/) || []; + var datePattern = matchResult[1]; + var timePattern = matchResult[2]; + if (!timePattern) { + return dateLongFormatter(pattern, formatLong2); + } + var dateTimeFormat; + switch (datePattern) { + case "P": + dateTimeFormat = formatLong2.dateTime({ + width: "short" }); - return () => { - for (const teardown of teardownFns) { - teardown == null ? void 0 : teardown(); - } - }; - }, - sensors.map((_ref2) => { - let { - sensor - } = _ref2; - return sensor; - }) - ); + break; + case "PP": + dateTimeFormat = formatLong2.dateTime({ + width: "medium" + }); + break; + case "PPP": + dateTimeFormat = formatLong2.dateTime({ + width: "long" + }); + break; + case "PPPP": + default: + dateTimeFormat = formatLong2.dateTime({ + width: "full" + }); + break; + } + return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); +}; +var longFormatters = { + p: timeLongFormatter, + P: dateTimeLongFormatter +}; +var longFormatters_default = longFormatters; + +// node_modules/date-fns/esm/_lib/protectedTokens/index.js +var protectedDayOfYearTokens = ["D", "DD"]; +var protectedWeekYearTokens = ["YY", "YYYY"]; +function isProtectedDayOfYearToken(token) { + return protectedDayOfYearTokens.indexOf(token) !== -1; } -function useSyntheticListeners(listeners, id2) { - return F2(() => { - return listeners.reduce((acc, _ref) => { - let { - eventName, - handler - } = _ref; - acc[eventName] = (event) => { - handler(event, id2); - }; - return acc; - }, {}); - }, [listeners, id2]); +function isProtectedWeekYearToken(token) { + return protectedWeekYearTokens.indexOf(token) !== -1; } -function useWindowRect(element) { - return F2(() => element ? getWindowClientRect(element) : null, [element]); +function throwProtectedError(token, format2, input) { + if (token === "YYYY") { + throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } else if (token === "YY") { + throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } else if (token === "D") { + throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } else if (token === "DD") { + throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } } -var defaultValue$2 = []; -function useRects(elements, measure) { - if (measure === void 0) { - measure = getClientRect; + +// node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js +var formatDistanceLocale = { + lessThanXSeconds: { + one: "less than a second", + other: "less than {{count}} seconds" + }, + xSeconds: { + one: "1 second", + other: "{{count}} seconds" + }, + halfAMinute: "half a minute", + lessThanXMinutes: { + one: "less than a minute", + other: "less than {{count}} minutes" + }, + xMinutes: { + one: "1 minute", + other: "{{count}} minutes" + }, + aboutXHours: { + one: "about 1 hour", + other: "about {{count}} hours" + }, + xHours: { + one: "1 hour", + other: "{{count}} hours" + }, + xDays: { + one: "1 day", + other: "{{count}} days" + }, + aboutXWeeks: { + one: "about 1 week", + other: "about {{count}} weeks" + }, + xWeeks: { + one: "1 week", + other: "{{count}} weeks" + }, + aboutXMonths: { + one: "about 1 month", + other: "about {{count}} months" + }, + xMonths: { + one: "1 month", + other: "{{count}} months" + }, + aboutXYears: { + one: "about 1 year", + other: "about {{count}} years" + }, + xYears: { + one: "1 year", + other: "{{count}} years" + }, + overXYears: { + one: "over 1 year", + other: "over {{count}} years" + }, + almostXYears: { + one: "almost 1 year", + other: "almost {{count}} years" } - const [firstElement] = elements; - const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null); - const [rects, measureRects] = s2(reducer2, defaultValue$2); - const resizeObserver = useResizeObserver({ - callback: measureRects - }); - if (elements.length > 0 && rects === defaultValue$2) { - measureRects(); +}; +var formatDistance = function formatDistance2(token, count2, options) { + var result; + var tokenValue = formatDistanceLocale[token]; + if (typeof tokenValue === "string") { + result = tokenValue; + } else if (count2 === 1) { + result = tokenValue.one; + } else { + result = tokenValue.other.replace("{{count}}", count2.toString()); } - useIsomorphicLayoutEffect(() => { - if (elements.length) { - elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element)); + if (options !== null && options !== void 0 && options.addSuffix) { + if (options.comparison && options.comparison > 0) { + return "in " + result; } else { - resizeObserver == null ? void 0 : resizeObserver.disconnect(); - measureRects(); - } - }, [elements]); - return rects; - function reducer2() { - if (!elements.length) { - return defaultValue$2; + return result + " ago"; } - return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element)); - } -} -function getMeasurableNode(node) { - if (!node) { - return null; - } - if (node.children.length > 1) { - return node; } - const firstChild = node.children[0]; - return isHTMLElement(firstChild) ? firstChild : node; + return result; +}; +var formatDistance_default = formatDistance; + +// node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js +function buildFormatLongFn(args) { + return function() { + var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + var width = options.width ? String(options.width) : args.defaultWidth; + var format2 = args.formats[width] || args.formats[args.defaultWidth]; + return format2; + }; } -function useDragOverlayMeasuring(_ref) { - let { - measure - } = _ref; - const [rect, setRect] = h2(null); - const handleResize = T2((entries) => { - for (const { - target - } of entries) { - if (isHTMLElement(target)) { - setRect((rect2) => { - const newRect = measure(target); - return rect2 ? { - ...rect2, - width: newRect.width, - height: newRect.height - } : newRect; - }); - break; - } - } - }, [measure]); - const resizeObserver = useResizeObserver({ - callback: handleResize - }); - const handleNodeChange = T2((element) => { - const node = getMeasurableNode(element); - resizeObserver == null ? void 0 : resizeObserver.disconnect(); - if (node) { - resizeObserver == null ? void 0 : resizeObserver.observe(node); + +// node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js +var dateFormats = { + full: "EEEE, MMMM do, y", + long: "MMMM do, y", + medium: "MMM d, y", + short: "MM/dd/yyyy" +}; +var timeFormats = { + full: "h:mm:ss a zzzz", + long: "h:mm:ss a z", + medium: "h:mm:ss a", + short: "h:mm a" +}; +var dateTimeFormats = { + full: "{{date}} 'at' {{time}}", + long: "{{date}} 'at' {{time}}", + medium: "{{date}}, {{time}}", + short: "{{date}}, {{time}}" +}; +var formatLong = { + date: buildFormatLongFn({ + formats: dateFormats, + defaultWidth: "full" + }), + time: buildFormatLongFn({ + formats: timeFormats, + defaultWidth: "full" + }), + dateTime: buildFormatLongFn({ + formats: dateTimeFormats, + defaultWidth: "full" + }) +}; +var formatLong_default = formatLong; + +// node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js +var formatRelativeLocale = { + lastWeek: "'last' eeee 'at' p", + yesterday: "'yesterday at' p", + today: "'today at' p", + tomorrow: "'tomorrow at' p", + nextWeek: "eeee 'at' p", + other: "P" +}; +var formatRelative = function formatRelative2(token, _date, _baseDate, _options) { + return formatRelativeLocale[token]; +}; +var formatRelative_default = formatRelative; + +// node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js +function buildLocalizeFn(args) { + return function(dirtyIndex, options) { + var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone"; + var valuesArray; + if (context === "formatting" && args.formattingValues) { + var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; + var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; + valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; + } else { + var _defaultWidth = args.defaultWidth; + var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; + valuesArray = args.values[_width] || args.values[_defaultWidth]; } - setRect(node ? measure(node) : null); - }, [measure, resizeObserver]); - const [nodeRef, setRef] = useNodeRef(handleNodeChange); - return F2(() => ({ - nodeRef, - rect, - setRef - }), [rect, nodeRef, setRef]); + var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; + return valuesArray[index]; + }; } -var defaultSensors = [{ - sensor: PointerSensor, - options: {} -}, { - sensor: KeyboardSensor, - options: {} -}]; -var defaultData = { - current: {} + +// node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js +var eraValues = { + narrow: ["B", "A"], + abbreviated: ["BC", "AD"], + wide: ["Before Christ", "Anno Domini"] }; -var defaultMeasuringConfiguration = { - draggable: { - measure: getTransformAgnosticClientRect +var quarterValues = { + narrow: ["1", "2", "3", "4"], + abbreviated: ["Q1", "Q2", "Q3", "Q4"], + wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] +}; +var monthValues = { + narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], + abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] +}; +var dayValues = { + narrow: ["S", "M", "T", "W", "T", "F", "S"], + short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], + abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] +}; +var dayPeriodValues = { + narrow: { + am: "a", + pm: "p", + midnight: "mi", + noon: "n", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" }, - droppable: { - measure: getTransformAgnosticClientRect, - strategy: MeasuringStrategy.WhileDragging, - frequency: MeasuringFrequency.Optimized + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" }, - dragOverlay: { - measure: getClientRect - } -}; -var DroppableContainersMap = class extends Map { - get(id2) { - var _super$get; - return id2 != null ? (_super$get = super.get(id2)) != null ? _super$get : void 0 : void 0; - } - toArray() { - return Array.from(this.values()); - } - getEnabled() { - return this.toArray().filter((_ref) => { - let { - disabled - } = _ref; - return !disabled; - }); - } - getNodeFor(id2) { - var _this$get$node$curren, _this$get; - return (_this$get$node$curren = (_this$get = this.get(id2)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0; + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" } }; -var defaultPublicContext = { - activatorEvent: null, - active: null, - activeNode: null, - activeNodeRect: null, - collisions: null, - containerNodeRect: null, - draggableNodes: /* @__PURE__ */ new Map(), - droppableRects: /* @__PURE__ */ new Map(), - droppableContainers: /* @__PURE__ */ new DroppableContainersMap(), - over: null, - dragOverlay: { - nodeRef: { - current: null - }, - rect: null, - setRef: noop +var formattingDayPeriodValues = { + narrow: { + am: "a", + pm: "p", + midnight: "mi", + noon: "n", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night" }, - scrollableAncestors: [], - scrollableAncestorRects: [], - measuringConfiguration: defaultMeasuringConfiguration, - measureDroppableContainers: noop, - windowRect: null, - measuringScheduled: false + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night" + }, + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night" + } }; -var defaultInternalContext = { - activatorEvent: null, - activators: [], - active: null, - activeNodeRect: null, - ariaDescribedById: { - draggable: "" - }, - dispatch: noop, - draggableNodes: /* @__PURE__ */ new Map(), - over: null, - measureDroppableContainers: noop +var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) { + var number = Number(dirtyNumber); + var rem100 = number % 100; + if (rem100 > 20 || rem100 < 10) { + switch (rem100 % 10) { + case 1: + return number + "st"; + case 2: + return number + "nd"; + case 3: + return number + "rd"; + } + } + return number + "th"; }; -var InternalContext = /* @__PURE__ */ F(defaultInternalContext); -var PublicContext = /* @__PURE__ */ F(defaultPublicContext); -function getInitialState() { - return { - draggable: { - active: null, - initialCoordinates: { - x: 0, - y: 0 - }, - nodes: /* @__PURE__ */ new Map(), - translate: { - x: 0, - y: 0 - } - }, - droppable: { - containers: new DroppableContainersMap() +var localize = { + ordinalNumber, + era: buildLocalizeFn({ + values: eraValues, + defaultWidth: "wide" + }), + quarter: buildLocalizeFn({ + values: quarterValues, + defaultWidth: "wide", + argumentCallback: function argumentCallback(quarter) { + return quarter - 1; + } + }), + month: buildLocalizeFn({ + values: monthValues, + defaultWidth: "wide" + }), + day: buildLocalizeFn({ + values: dayValues, + defaultWidth: "wide" + }), + dayPeriod: buildLocalizeFn({ + values: dayPeriodValues, + defaultWidth: "wide", + formattingValues: formattingDayPeriodValues, + defaultFormattingWidth: "wide" + }) +}; +var localize_default = localize; + +// node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js +function buildMatchFn(args) { + return function(string) { + 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 = string.match(matchPattern); + if (!matchResult) { + return null; } + var matchedString = matchResult[0]; + var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; + 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(key2) : key2; + value = options.valueCallback ? options.valueCallback(value) : value; + var rest = string.slice(matchedString.length); + return { + value, + rest + }; }; } -function reducer(state, action) { - switch (action.type) { - case Action.DragStart: - return { - ...state, - draggable: { - ...state.draggable, - initialCoordinates: action.initialCoordinates, - active: action.active - } - }; - case Action.DragMove: - if (!state.draggable.active) { - return state; - } - return { - ...state, - draggable: { - ...state.draggable, - translate: { - x: action.coordinates.x - state.draggable.initialCoordinates.x, - y: action.coordinates.y - state.draggable.initialCoordinates.y - } - } - }; - case Action.DragEnd: - case Action.DragCancel: - return { - ...state, - draggable: { - ...state.draggable, - active: null, - initialCoordinates: { - x: 0, - y: 0 - }, - translate: { - x: 0, - y: 0 - } - } - }; - case Action.RegisterDroppable: { - const { - element - } = action; - const { - id: id2 - } = element; - const containers = new DroppableContainersMap(state.droppable.containers); - containers.set(id2, element); - return { - ...state, - droppable: { - ...state.droppable, - containers - } - }; - } - case Action.SetDroppableDisabled: { - const { - id: id2, - key: key2, - disabled - } = action; - const element = state.droppable.containers.get(id2); - if (!element || key2 !== element.key) { - return state; - } - const containers = new DroppableContainersMap(state.droppable.containers); - containers.set(id2, { - ...element, - disabled - }); - return { - ...state, - droppable: { - ...state.droppable, - containers - } - }; - } - case Action.UnregisterDroppable: { - const { - id: id2, - key: key2 - } = action; - const element = state.droppable.containers.get(id2); - if (!element || key2 !== element.key) { - return state; - } - const containers = new DroppableContainersMap(state.droppable.containers); - containers.delete(id2); - return { - ...state, - droppable: { - ...state.droppable, - containers - } - }; - } - default: { - return state; +function findKey(object, predicate) { + for (var key2 in object) { + if (object.hasOwnProperty(key2) && predicate(object[key2])) { + return key2; } } + return void 0; } -function RestoreFocus(_ref) { - let { - disabled - } = _ref; - const { - active, - activatorEvent, - draggableNodes - } = q2(InternalContext); - const previousActivatorEvent = usePrevious(activatorEvent); - const previousActiveId = usePrevious(active == null ? void 0 : active.id); - p2(() => { - if (disabled) { - return; - } - if (!activatorEvent && previousActivatorEvent && previousActiveId != null) { - if (!isKeyboardEvent(previousActivatorEvent)) { - return; - } - if (document.activeElement === previousActivatorEvent.target) { - return; - } - const draggableNode = draggableNodes.get(previousActiveId); - if (!draggableNode) { - return; - } - const { - activatorNode, - node - } = draggableNode; - if (!activatorNode.current && !node.current) { - return; - } - requestAnimationFrame(() => { - for (const element of [activatorNode.current, node.current]) { - if (!element) { - continue; - } - const focusableNode = findFirstFocusableNode(element); - if (focusableNode) { - focusableNode.focus(); - break; - } - } - }); +function findIndex(array, predicate) { + for (var key2 = 0; key2 < array.length; key2++) { + if (predicate(array[key2])) { + return key2; } - }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]); - return null; -} -function applyModifiers(modifiers, _ref) { - let { - transform, - ...args - } = _ref; - return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => { - return modifier({ - transform: accumulator, - ...args - }); - }, transform) : transform; + } + return void 0; } -function useMeasuringConfiguration(config) { - return F2( - () => ({ - draggable: { - ...defaultMeasuringConfiguration.draggable, - ...config == null ? void 0 : config.draggable - }, - droppable: { - ...defaultMeasuringConfiguration.droppable, - ...config == null ? void 0 : config.droppable - }, - dragOverlay: { - ...defaultMeasuringConfiguration.dragOverlay, - ...config == null ? void 0 : config.dragOverlay - } - }), - [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay] - ); + +// node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js +function buildMatchPatternFn(args) { + return function(string) { + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + var matchResult = string.match(args.matchPattern); + if (!matchResult) + return null; + var matchedString = matchResult[0]; + var parseResult = string.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 = string.slice(matchedString.length); + return { + value, + rest + }; + }; } -function useLayoutShiftScrollCompensation(_ref) { - let { - activeNode, - measure, - initialRect, - config = true - } = _ref; - const initialized = _2(false); - const { - x: x5, - y: y5 - } = typeof config === "boolean" ? { - x: config, - y: config - } : config; - useIsomorphicLayoutEffect(() => { - const disabled = !x5 && !y5; - if (disabled || !activeNode) { - initialized.current = false; - return; - } - if (initialized.current || !initialRect) { - return; - } - const node = activeNode == null ? void 0 : activeNode.node.current; - if (!node || node.isConnected === false) { - return; + +// node_modules/date-fns/esm/locale/en-US/_lib/match/index.js +var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; +var parseOrdinalNumberPattern = /\d+/i; +var matchEraPatterns = { + narrow: /^(b|a)/i, + abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, + wide: /^(before christ|before common era|anno domini|common era)/i +}; +var parseEraPatterns = { + any: [/^b/i, /^(a|c)/i] +}; +var matchQuarterPatterns = { + narrow: /^[1234]/i, + abbreviated: /^q[1234]/i, + wide: /^[1234](th|st|nd|rd)? quarter/i +}; +var parseQuarterPatterns = { + any: [/1/i, /2/i, /3/i, /4/i] +}; +var matchMonthPatterns = { + narrow: /^[jfmasond]/i, + abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, + wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i +}; +var parseMonthPatterns = { + narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], + any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i] +}; +var matchDayPatterns = { + narrow: /^[smtwf]/i, + short: /^(su|mo|tu|we|th|fr|sa)/i, + abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, + wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i +}; +var parseDayPatterns = { + narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], + any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] +}; +var matchDayPeriodPatterns = { + narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, + any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i +}; +var parseDayPeriodPatterns = { + any: { + am: /^a/i, + pm: /^p/i, + midnight: /^mi/i, + noon: /^no/i, + morning: /morning/i, + afternoon: /afternoon/i, + evening: /evening/i, + night: /night/i + } +}; +var match = { + ordinalNumber: buildMatchPatternFn({ + matchPattern: matchOrdinalNumberPattern, + parsePattern: parseOrdinalNumberPattern, + valueCallback: function valueCallback(value) { + return parseInt(value, 10); } - const rect = measure(node); - const rectDelta = getRectDelta(rect, initialRect); - if (!x5) { - rectDelta.x = 0; + }), + era: buildMatchFn({ + matchPatterns: matchEraPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseEraPatterns, + defaultParseWidth: "any" + }), + quarter: buildMatchFn({ + matchPatterns: matchQuarterPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseQuarterPatterns, + defaultParseWidth: "any", + valueCallback: function valueCallback2(index) { + return index + 1; } - if (!y5) { - rectDelta.y = 0; + }), + month: buildMatchFn({ + matchPatterns: matchMonthPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseMonthPatterns, + defaultParseWidth: "any" + }), + day: buildMatchFn({ + matchPatterns: matchDayPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseDayPatterns, + defaultParseWidth: "any" + }), + dayPeriod: buildMatchFn({ + matchPatterns: matchDayPeriodPatterns, + defaultMatchWidth: "any", + parsePatterns: parseDayPeriodPatterns, + defaultParseWidth: "any" + }) +}; +var match_default = match; + +// node_modules/date-fns/esm/locale/en-US/index.js +var locale = { + code: "en-US", + formatDistance: formatDistance_default, + formatLong: formatLong_default, + formatRelative: formatRelative_default, + localize: localize_default, + match: match_default, + options: { + weekStartsOn: 0, + firstWeekContainsDate: 1 + } +}; +var en_US_default = locale; + +// node_modules/date-fns/esm/_lib/defaultLocale/index.js +var defaultLocale_default = en_US_default; + +// node_modules/date-fns/esm/format/index.js +var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; +var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; +var escapedStringRegExp = /^'([^]*?)'?$/; +var doubleQuoteRegExp = /''/g; +var unescapedLatinCharacterRegExp = /[a-zA-Z]/; +function format(dirtyDate, dirtyFormatStr, options) { + var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4; + requiredArgs(2, arguments); + var formatStr = String(dirtyFormatStr); + var defaultOptions3 = getDefaultOptions(); + var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default; + var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions3.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); + if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { + throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); + } + var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions3.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions3.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); + if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { + throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); + } + if (!locale2.localize) { + throw new RangeError("locale must contain localize property"); + } + if (!locale2.formatLong) { + throw new RangeError("locale must contain formatLong property"); + } + var originalDate = toDate(dirtyDate); + if (!isValid(originalDate)) { + throw new RangeError("Invalid time value"); + } + var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate); + var utcDate = subMilliseconds(originalDate, timezoneOffset); + var formatterOptions = { + firstWeekContainsDate, + weekStartsOn, + locale: locale2, + _originalDate: originalDate + }; + var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) { + var firstCharacter = substring[0]; + if (firstCharacter === "p" || firstCharacter === "P") { + var longFormatter = longFormatters_default[firstCharacter]; + return longFormatter(substring, locale2.formatLong); } - initialized.current = true; - if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) { - const firstScrollableAncestor = getFirstScrollableAncestor(node); - if (firstScrollableAncestor) { - firstScrollableAncestor.scrollBy({ - top: rectDelta.y, - left: rectDelta.x - }); - } + return substring; + }).join("").match(formattingTokensRegExp).map(function(substring) { + if (substring === "''") { + return "'"; } - }, [activeNode, x5, y5, initialRect, measure]); -} -var ActiveDraggableContext = /* @__PURE__ */ F({ - ...defaultCoordinates, - scaleX: 1, - scaleY: 1 -}); -var Status; -(function(Status2) { - Status2[Status2["Uninitialized"] = 0] = "Uninitialized"; - Status2[Status2["Initializing"] = 1] = "Initializing"; - Status2[Status2["Initialized"] = 2] = "Initialized"; -})(Status || (Status = {})); -var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { - var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect; - let { - id: id2, - accessibility, - autoScroll = true, - children, - sensors = defaultSensors, - collisionDetection = rectIntersection, - measuring, - modifiers, - ...props2 - } = _ref; - const store = s2(reducer, void 0, getInitialState); - const [state, dispatch] = store; - const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider(); - const [status, setStatus] = h2(Status.Uninitialized); - const isInitialized = status === Status.Initialized; - const { - draggable: { - active: activeId, - nodes: draggableNodes, - translate - }, - droppable: { - containers: droppableContainers + var firstCharacter = substring[0]; + if (firstCharacter === "'") { + return cleanEscapedString(substring); } - } = state; - const node = activeId ? draggableNodes.get(activeId) : null; - const activeRects = _2({ - initial: null, - translated: null - }); - const active = F2(() => { - var _node$data; - return activeId != null ? { - id: activeId, - data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData, - rect: activeRects - } : null; - }, [activeId, node]); - const activeRef = _2(null); - const [activeSensor, setActiveSensor] = h2(null); - const [activatorEvent, setActivatorEvent] = h2(null); - const latestProps = useLatestValue(props2, Object.values(props2)); - const draggableDescribedById = useUniqueId("DndDescribedBy", id2); - const enabledDroppableContainers = F2(() => droppableContainers.getEnabled(), [droppableContainers]); - const measuringConfiguration = useMeasuringConfiguration(measuring); - const { - droppableRects, - measureDroppableContainers, - measuringScheduled - } = useDroppableMeasuring(enabledDroppableContainers, { - dragging: isInitialized, - dependencies: [translate.x, translate.y], - config: measuringConfiguration.droppable - }); - const activeNode = useCachedNode(draggableNodes, activeId); - const activationCoordinates = F2(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]); - const autoScrollOptions = getAutoScrollerOptions(); - const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure); - useLayoutShiftScrollCompensation({ - activeNode: activeId ? draggableNodes.get(activeId) : null, - config: autoScrollOptions.layoutShiftCompensation, - initialRect: initialActiveNodeRect, - measure: measuringConfiguration.draggable.measure - }); - const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect); - const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null); - const sensorContext = _2({ - activatorEvent: null, - active: null, - activeNode, - collisionRect: null, - collisions: null, - droppableRects, - draggableNodes, - draggingNode: null, - draggingNodeRect: null, - droppableContainers, - over: null, - scrollableAncestors: [], - scrollAdjustedTranslate: null - }); - const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id); - const dragOverlay = useDragOverlayMeasuring({ - measure: measuringConfiguration.dragOverlay.measure - }); - const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode; - const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null; - const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); - const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); - const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); - const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null); - const scrollableAncestorRects = useRects(scrollableAncestors); - const modifiedTranslate = applyModifiers(modifiers, { - transform: { - x: translate.x - nodeRectDelta.x, - y: translate.y - nodeRectDelta.y, - scaleX: 1, - scaleY: 1 - }, - activatorEvent, - active, - activeNodeRect, - containerNodeRect, - draggingNodeRect, - over: sensorContext.current.over, - overlayNodeRect: dragOverlay.rect, - scrollableAncestors, - scrollableAncestorRects, - windowRect - }); - const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null; - const scrollOffsets = useScrollOffsets(scrollableAncestors); - const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); - const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]); - const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment); - const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null; - const collisions = active && collisionRect ? collisionDetection({ - active, - collisionRect, - droppableRects, - droppableContainers: enabledDroppableContainers, - pointerCoordinates - }) : null; - const overId = getFirstCollision(collisions, "id"); - const [over, setOver] = h2(null); - const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta); - const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect); - const instantiateSensor = T2( - (event, _ref2) => { - let { - sensor: Sensor, - options - } = _ref2; - if (activeRef.current == null) { - return; - } - const activeNode2 = draggableNodes.get(activeRef.current); - if (!activeNode2) { - return; - } - const activatorEvent2 = event.nativeEvent; - const sensorInstance = new Sensor({ - active: activeRef.current, - activeNode: activeNode2, - event: activatorEvent2, - options, - context: sensorContext, - onStart(initialCoordinates) { - const id3 = activeRef.current; - if (id3 == null) { - return; - } - const draggableNode = draggableNodes.get(id3); - if (!draggableNode) { - return; - } - const { - onDragStart - } = latestProps.current; - const event2 = { - active: { - id: id3, - data: draggableNode.data, - rect: activeRects - } - }; - dn(() => { - onDragStart == null ? void 0 : onDragStart(event2); - setStatus(Status.Initializing); - dispatch({ - type: Action.DragStart, - initialCoordinates, - active: id3 - }); - dispatchMonitorEvent({ - type: "onDragStart", - event: event2 - }); - }); - }, - onMove(coordinates) { - dispatch({ - type: Action.DragMove, - coordinates - }); - }, - onEnd: createHandler(Action.DragEnd), - onCancel: createHandler(Action.DragCancel) - }); - dn(() => { - setActiveSensor(sensorInstance); - setActivatorEvent(event.nativeEvent); - }); - function createHandler(type) { - return async function handler() { - const { - active: active2, - collisions: collisions2, - over: over2, - scrollAdjustedTranslate: scrollAdjustedTranslate2 - } = sensorContext.current; - let event2 = null; - if (active2 && scrollAdjustedTranslate2) { - const { - cancelDrop - } = latestProps.current; - event2 = { - activatorEvent: activatorEvent2, - active: active2, - collisions: collisions2, - delta: scrollAdjustedTranslate2, - over: over2 - }; - if (type === Action.DragEnd && typeof cancelDrop === "function") { - const shouldCancel = await Promise.resolve(cancelDrop(event2)); - if (shouldCancel) { - type = Action.DragCancel; - } - } - } - activeRef.current = null; - dn(() => { - dispatch({ - type - }); - setStatus(Status.Uninitialized); - setOver(null); - setActiveSensor(null); - setActivatorEvent(null); - const eventName = type === Action.DragEnd ? "onDragEnd" : "onDragCancel"; - if (event2) { - const handler2 = latestProps.current[eventName]; - handler2 == null ? void 0 : handler2(event2); - dispatchMonitorEvent({ - type: eventName, - event: event2 - }); - } - }); - }; - } - }, - [draggableNodes] - ); - const bindActivatorToSensorInstantiator = T2((handler, sensor) => { - return (event, active2) => { - const nativeEvent = event.nativeEvent; - const activeDraggableNode = draggableNodes.get(active2); - if (activeRef.current !== null || !activeDraggableNode || nativeEvent.dndKit || nativeEvent.defaultPrevented) { - return; + var formatter = formatters_default[firstCharacter]; + if (formatter) { + if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) { + throwProtectedError(substring, dirtyFormatStr, String(dirtyDate)); } - const activationContext = { - active: activeDraggableNode - }; - const shouldActivate = handler(event, sensor.options, activationContext); - if (shouldActivate === true) { - nativeEvent.dndKit = { - capturedBy: sensor.sensor - }; - activeRef.current = active2; - instantiateSensor(event, sensor); + if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) { + throwProtectedError(substring, dirtyFormatStr, String(dirtyDate)); } - }; - }, [draggableNodes, instantiateSensor]); - const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator); - useSensorSetup(sensors); - useIsomorphicLayoutEffect(() => { - if (activeNodeRect && status === Status.Initializing) { - setStatus(Status.Initialized); + return formatter(utcDate, substring, locale2.localize, formatterOptions); } - }, [activeNodeRect, status]); - p2( - () => { - const { - onDragMove - } = latestProps.current; - const { - active: active2, - activatorEvent: activatorEvent2, - collisions: collisions2, - over: over2 - } = sensorContext.current; - if (!active2 || !activatorEvent2) { - return; - } - const event = { - active: active2, - activatorEvent: activatorEvent2, - collisions: collisions2, - delta: { - x: scrollAdjustedTranslate.x, - y: scrollAdjustedTranslate.y - }, - over: over2 - }; - dn(() => { - onDragMove == null ? void 0 : onDragMove(event); - dispatchMonitorEvent({ - type: "onDragMove", - event - }); - }); - }, - [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y] - ); - p2( - () => { - const { - active: active2, - activatorEvent: activatorEvent2, - collisions: collisions2, - droppableContainers: droppableContainers2, - scrollAdjustedTranslate: scrollAdjustedTranslate2 - } = sensorContext.current; - if (!active2 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) { - return; - } - const { - onDragOver - } = latestProps.current; - const overContainer = droppableContainers2.get(overId); - const over2 = overContainer && overContainer.rect.current ? { - id: overContainer.id, - rect: overContainer.rect.current, - data: overContainer.data, - disabled: overContainer.disabled - } : null; - const event = { - active: active2, - activatorEvent: activatorEvent2, - collisions: collisions2, - delta: { - x: scrollAdjustedTranslate2.x, - y: scrollAdjustedTranslate2.y - }, - over: over2 - }; - dn(() => { - setOver(over2); - onDragOver == null ? void 0 : onDragOver(event); - dispatchMonitorEvent({ - type: "onDragOver", - event - }); - }); - }, - [overId] - ); - useIsomorphicLayoutEffect(() => { - sensorContext.current = { - activatorEvent, - active, - activeNode, - collisionRect, - collisions, - droppableRects, - draggableNodes, - draggingNode, - draggingNodeRect, - droppableContainers, - over, - scrollableAncestors, - scrollAdjustedTranslate - }; - activeRects.current = { - initial: draggingNodeRect, - translated: collisionRect - }; - }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]); - useAutoScroller({ - ...autoScrollOptions, - delta: translate, - draggingRect: collisionRect, - pointerCoordinates, - scrollableAncestors, - scrollableAncestorRects - }); - const publicContext = F2(() => { - const context = { - active, - activeNode, - activeNodeRect, - activatorEvent, - collisions, - containerNodeRect, - dragOverlay, - draggableNodes, - droppableContainers, - droppableRects, - over, - measureDroppableContainers, - scrollableAncestors, - scrollableAncestorRects, - measuringConfiguration, - measuringScheduled, - windowRect - }; - return context; - }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]); - const internalContext = F2(() => { - const context = { - activatorEvent, - activators, - active, - activeNodeRect, - ariaDescribedById: { - draggable: draggableDescribedById - }, - dispatch, - draggableNodes, - over, - measureDroppableContainers - }; - return context; - }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]); - return Cn.createElement(DndMonitorContext.Provider, { - value: registerMonitorListener - }, Cn.createElement(InternalContext.Provider, { - value: internalContext - }, Cn.createElement(PublicContext.Provider, { - value: publicContext - }, Cn.createElement(ActiveDraggableContext.Provider, { - value: transform - }, children)), Cn.createElement(RestoreFocus, { - disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false - })), Cn.createElement(Accessibility, { - ...accessibility, - hiddenTextDescribedById: draggableDescribedById - })); - function getAutoScrollerOptions() { - const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false; - const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false; - const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled; - if (typeof autoScroll === "object") { - return { - ...autoScroll, - enabled - }; + if (firstCharacter.match(unescapedLatinCharacterRegExp)) { + throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"); + } + return substring; + }).join(""); + return result; +} +function cleanEscapedString(input) { + var matched = input.match(escapedStringRegExp); + if (!matched) { + return input; + } + return matched[1].replace(doubleQuoteRegExp, "'"); +} + +// node_modules/date-fns/esm/_lib/assign/index.js +function assign(target, object) { + if (target == null) { + throw new TypeError("assign requires that input parameter not be null or undefined"); + } + for (var property in object) { + if (Object.prototype.hasOwnProperty.call(object, property)) { + ; + target[property] = object[property]; + } + } + return target; +} + +// node_modules/date-fns/esm/_lib/cloneObject/index.js +function cloneObject(object) { + return assign({}, object); +} + +// node_modules/date-fns/esm/formatDistance/index.js +var MINUTES_IN_DAY = 1440; +var MINUTES_IN_ALMOST_TWO_DAYS = 2520; +var MINUTES_IN_MONTH = 43200; +var MINUTES_IN_TWO_MONTHS = 86400; +function formatDistance3(dirtyDate, dirtyBaseDate, options) { + var _ref, _options$locale; + requiredArgs(2, arguments); + var defaultOptions3 = getDefaultOptions(); + var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default; + if (!locale2.formatDistance) { + throw new RangeError("locale must contain formatDistance property"); + } + var comparison = compareAsc(dirtyDate, dirtyBaseDate); + if (isNaN(comparison)) { + throw new RangeError("Invalid time value"); + } + var localizeOptions = assign(cloneObject(options), { + addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix), + comparison + }); + var dateLeft; + var dateRight; + if (comparison > 0) { + dateLeft = toDate(dirtyBaseDate); + dateRight = toDate(dirtyDate); + } else { + dateLeft = toDate(dirtyDate); + dateRight = toDate(dirtyBaseDate); + } + var seconds = differenceInSeconds(dateRight, dateLeft); + var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3; + var minutes = Math.round((seconds - offsetInSeconds) / 60); + var months; + if (minutes < 2) { + if (options !== null && options !== void 0 && options.includeSeconds) { + if (seconds < 5) { + return locale2.formatDistance("lessThanXSeconds", 5, localizeOptions); + } else if (seconds < 10) { + return locale2.formatDistance("lessThanXSeconds", 10, localizeOptions); + } else if (seconds < 20) { + return locale2.formatDistance("lessThanXSeconds", 20, localizeOptions); + } else if (seconds < 40) { + return locale2.formatDistance("halfAMinute", 0, localizeOptions); + } else if (seconds < 60) { + return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions); + } else { + return locale2.formatDistance("xMinutes", 1, localizeOptions); + } + } else { + if (minutes === 0) { + return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions); + } else { + return locale2.formatDistance("xMinutes", minutes, localizeOptions); + } + } + } else if (minutes < 45) { + return locale2.formatDistance("xMinutes", minutes, localizeOptions); + } else if (minutes < 90) { + return locale2.formatDistance("aboutXHours", 1, localizeOptions); + } else if (minutes < MINUTES_IN_DAY) { + var hours = Math.round(minutes / 60); + return locale2.formatDistance("aboutXHours", hours, localizeOptions); + } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) { + return locale2.formatDistance("xDays", 1, localizeOptions); + } else if (minutes < MINUTES_IN_MONTH) { + var days = Math.round(minutes / MINUTES_IN_DAY); + return locale2.formatDistance("xDays", days, localizeOptions); + } else if (minutes < MINUTES_IN_TWO_MONTHS) { + months = Math.round(minutes / MINUTES_IN_MONTH); + return locale2.formatDistance("aboutXMonths", months, localizeOptions); + } + months = differenceInMonths(dateRight, dateLeft); + if (months < 12) { + var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH); + return locale2.formatDistance("xMonths", nearestMonth, localizeOptions); + } else { + var monthsSinceStartOfYear = months % 12; + var years = Math.floor(months / 12); + if (monthsSinceStartOfYear < 3) { + return locale2.formatDistance("aboutXYears", years, localizeOptions); + } else if (monthsSinceStartOfYear < 9) { + return locale2.formatDistance("overXYears", years, localizeOptions); + } else { + return locale2.formatDistance("almostXYears", years + 1, localizeOptions); } - return { - enabled - }; } -}); -var NullContext = /* @__PURE__ */ F(null); -var defaultRole = "button"; -var ID_PREFIX = "Droppable"; -function useDraggable(_ref) { - let { - id: id2, - data, - disabled = false, - attributes - } = _ref; - const key2 = useUniqueId(ID_PREFIX); - const { - activators, - activatorEvent, - active, - activeNodeRect, - ariaDescribedById, - draggableNodes, - over - } = q2(InternalContext); - const { - role = defaultRole, - roleDescription = "draggable", - tabIndex = 0 - } = attributes != null ? attributes : {}; - const isDragging = (active == null ? void 0 : active.id) === id2; - const transform = q2(isDragging ? ActiveDraggableContext : NullContext); - const [node, setNodeRef] = useNodeRef(); - const [activatorNode, setActivatorNodeRef] = useNodeRef(); - const listeners = useSyntheticListeners(activators, id2); - const dataRef = useLatestValue(data); - useIsomorphicLayoutEffect( - () => { - draggableNodes.set(id2, { - id: id2, - key: key2, - node, - activatorNode, - data: dataRef - }); - return () => { - const node2 = draggableNodes.get(id2); - if (node2 && node2.key === key2) { - draggableNodes.delete(id2); - } - }; - }, - [draggableNodes, id2] - ); - const memoizedAttributes = F2(() => ({ - role, - tabIndex, - "aria-disabled": disabled, - "aria-pressed": isDragging && role === defaultRole ? true : void 0, - "aria-roledescription": roleDescription, - "aria-describedby": ariaDescribedById.draggable - }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]); - return { - active, - activatorEvent, - activeNodeRect, - attributes: memoizedAttributes, - isDragging, - listeners: disabled ? void 0 : listeners, - node, - over, - setNodeRef, - setActivatorNodeRef, - transform - }; } -function useDndContext() { - return q2(PublicContext); + +// node_modules/date-fns/esm/getDaysInMonth/index.js +function getDaysInMonth(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var year = date.getFullYear(); + var monthIndex = date.getMonth(); + var lastDayOfMonth2 = new Date(0); + lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0); + lastDayOfMonth2.setHours(0, 0, 0, 0); + return lastDayOfMonth2.getDate(); } -var ID_PREFIX$1 = "Droppable"; -var defaultResizeObserverConfig = { - timeout: 25 + +// node_modules/date-fns/esm/getISOWeek/index.js +var MILLISECONDS_IN_WEEK4 = 6048e5; +function getISOWeek(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var diff = startOfISOWeek(date).getTime() - startOfISOWeekYear(date).getTime(); + return Math.round(diff / MILLISECONDS_IN_WEEK4) + 1; +} + +// node_modules/date-fns/esm/getTime/index.js +function getTime(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var timestamp = date.getTime(); + return timestamp; +} + +// node_modules/date-fns/esm/getUnixTime/index.js +function getUnixTime(dirtyDate) { + requiredArgs(1, arguments); + return Math.floor(getTime(dirtyDate) / 1e3); +} + +// node_modules/date-fns/esm/getWeekYear/index.js +function getWeekYear(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var year = date.getFullYear(); + var defaultOptions3 = getDefaultOptions(); + var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); + if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { + throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); + } + var firstWeekOfNextYear = new Date(0); + firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); + firstWeekOfNextYear.setHours(0, 0, 0, 0); + var startOfNextYear = startOfWeek(firstWeekOfNextYear, options); + var firstWeekOfThisYear = new Date(0); + firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); + firstWeekOfThisYear.setHours(0, 0, 0, 0); + var startOfThisYear = startOfWeek(firstWeekOfThisYear, options); + if (date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; + } +} + +// node_modules/date-fns/esm/startOfWeekYear/index.js +function startOfWeekYear(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var defaultOptions3 = getDefaultOptions(); + var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); + var year = getWeekYear(dirtyDate, options); + var firstWeek = new Date(0); + firstWeek.setFullYear(year, 0, firstWeekContainsDate); + firstWeek.setHours(0, 0, 0, 0); + var date = startOfWeek(firstWeek, options); + return date; +} + +// node_modules/date-fns/esm/getWeek/index.js +var MILLISECONDS_IN_WEEK5 = 6048e5; +function getWeek(dirtyDate, options) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var diff = startOfWeek(date, options).getTime() - startOfWeekYear(date, options).getTime(); + return Math.round(diff / MILLISECONDS_IN_WEEK5) + 1; +} + +// node_modules/date-fns/esm/lastDayOfMonth/index.js +function lastDayOfMonth(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var month = date.getMonth(); + date.setFullYear(date.getFullYear(), month + 1, 0); + date.setHours(0, 0, 0, 0); + return date; +} + +// node_modules/date-fns/esm/getWeeksInMonth/index.js +function getWeeksInMonth(date, options) { + requiredArgs(1, arguments); + return differenceInCalendarWeeks(lastDayOfMonth(date), startOfMonth(date), options) + 1; +} + +// node_modules/date-fns/esm/isAfter/index.js +function isAfter(dirtyDate, dirtyDateToCompare) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var dateToCompare = toDate(dirtyDateToCompare); + return date.getTime() > dateToCompare.getTime(); +} + +// node_modules/date-fns/esm/isBefore/index.js +function isBefore(dirtyDate, dirtyDateToCompare) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var dateToCompare = toDate(dirtyDateToCompare); + return date.getTime() < dateToCompare.getTime(); +} + +// node_modules/date-fns/esm/isSameMonth/index.js +function isSameMonth(dirtyDateLeft, dirtyDateRight) { + requiredArgs(2, arguments); + var dateLeft = toDate(dirtyDateLeft); + var dateRight = toDate(dirtyDateRight); + return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth(); +} + +// node_modules/date-fns/esm/isSameYear/index.js +function isSameYear(dirtyDateLeft, dirtyDateRight) { + requiredArgs(2, arguments); + var dateLeft = toDate(dirtyDateLeft); + var dateRight = toDate(dirtyDateRight); + return dateLeft.getFullYear() === dateRight.getFullYear(); +} + +// node_modules/date-fns/esm/subDays/index.js +function subDays(dirtyDate, dirtyAmount) { + requiredArgs(2, arguments); + var amount = toInteger(dirtyAmount); + return addDays(dirtyDate, -amount); +} + +// node_modules/date-fns/esm/setMonth/index.js +function setMonth(dirtyDate, dirtyMonth) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var month = toInteger(dirtyMonth); + var year = date.getFullYear(); + var day = date.getDate(); + var dateWithDesiredMonth = new Date(0); + dateWithDesiredMonth.setFullYear(year, month, 15); + dateWithDesiredMonth.setHours(0, 0, 0, 0); + var daysInMonth = getDaysInMonth(dateWithDesiredMonth); + date.setMonth(month, Math.min(day, daysInMonth)); + return date; +} + +// node_modules/date-fns/esm/setYear/index.js +function setYear(dirtyDate, dirtyYear) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var year = toInteger(dirtyYear); + if (isNaN(date.getTime())) { + return new Date(NaN); + } + date.setFullYear(year); + return date; +} + +// src/utils/metadata/frontmatter/fm.ts +var import_lodash = __toESM(require_lodash()); +var import_obsidian5 = require("obsidian"); + +// src/utils/metadata/dv.ts +var import_obsidian4 = require("obsidian"); +var LocationWrapper = { + fullLine: { start: "", end: "" }, + brackets: { start: "[", end: "]" }, + parenthesis: { start: "(", end: ")" } }; -function useDroppable(_ref) { - let { - data, - disabled = false, - id: id2, - resizeObserverConfig - } = _ref; - const key2 = useUniqueId(ID_PREFIX$1); - const { - active, - dispatch, - over, - measureDroppableContainers - } = q2(InternalContext); - const previous = _2({ - disabled - }); - const resizeObserverConnected = _2(false); - const rect = _2(null); - const callbackId = _2(null); +var fieldComponents = [ + "inQuote", + "inList", + "startStyle", + "attribute", + "endStyle", + "beforeSeparatorSpacer", + "afterSeparatorSpacer", + "values" +]; +var genericFieldRegex = "(?>(\\s+)?)?(?- )?(?[_\\*~`]*)(?[0-9\\w\\p{Letter}\\p{Emoji_Presentation}][-0-9\\w\\p{Letter}\\p{Emoji_Presentation}\\s]*)(?[_\\*~`]*)(?\\s*)"; +var inlineFieldRegex = (attribute) => `(?>(\\s+)?)?(?- )?(?[_\\*~\`]*)(?${attribute})(?[_\\*~\`]*)(?\\s*)::(?\\s*)`; +var fullLineRegex = new RegExp( + `^${genericFieldRegex}::\\s*(?.*)?`, + "u" +); +var inSentenceRegexBrackets = new RegExp( + `\\[${genericFieldRegex}::\\s*(?[^\\]]+)?\\]`, + "gu" +); +var inSentenceRegexPar = new RegExp( + `\\(${genericFieldRegex}::\\s*(?[^\\)]+)?\\)`, + "gu" +); +var encodeLink = (value) => { + return value ? value.replace(/\[\[/g, "\u{1F54C}\u{1F527}").replace(/\]\]/g, "\u{1F413}\u{1F400}") : value; +}; +var decodeLink = (value) => { + return value ? value.replace(/🕌🔧/gu, "[[").replace(/🐓🐀/gu, "]]") : value; +}; +var matchInlineFields = (regex, line, attribute, input, location = "fullLine") => { + const sR = line.matchAll(regex); + let next = sR.next(); + const newFields = []; + while (!next.done) { + const match2 = next.value; + if (match2.groups && Object.keys(match2.groups).every((j4) => fieldComponents.includes(j4))) { + const { + inList, + inQuote, + startStyle, + endStyle, + beforeSeparatorSpacer, + afterSeparatorSpacer, + values + } = match2.groups; + const inputArray = input ? input.replace(/(\,\s+)/g, ",").split(",") : [""]; + const newValue = inputArray.length == 1 ? inputArray[0] : `${serializeMultiDisplayString(inputArray)}`; + const start = LocationWrapper[location].start; + const end = LocationWrapper[location].end; + newFields.push({ + oldField: match2[0], + newField: `${inQuote || ""}${start}${inList || ""}${startStyle}${attribute}${endStyle}${beforeSeparatorSpacer}::${afterSeparatorSpacer}${newValue}${end}` + }); + } + next = sR.next(); + } + return newFields; +}; +async function replaceValues(plugin, fileOrFilePath, attribute, input, previousItemsCount = 0) { + var _a2, _b2; + let file; + if (fileOrFilePath instanceof import_obsidian4.TFile) { + file = fileOrFilePath; + } else { + const _file = plugin.app.vault.getAbstractFileByPath(fileOrFilePath); + if (_file instanceof import_obsidian4.TFile && _file.extension == "md") { + file = _file; + } else { + throw Error("path doesn't correspond to a proper file"); + } + } + const content = (await plugin.app.vault.read(file)).split("\n"); + const frontmatter = (_a2 = plugin.app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; + const skippedLines = []; const { - disabled: resizeObserverDisabled, - updateMeasurementsFor, - timeout: resizeObserverTimeout - } = { - ...defaultResizeObserverConfig, - ...resizeObserverConfig - }; - const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2); - const handleResize = T2( - () => { - if (!resizeObserverConnected.current) { - resizeObserverConnected.current = true; - return; - } - if (callbackId.current != null) { - clearTimeout(callbackId.current); - } - callbackId.current = setTimeout(() => { - measureDroppableContainers(Array.isArray(ids2.current) ? ids2.current : [ids2.current]); - callbackId.current = null; - }, resizeObserverTimeout); - }, - [resizeObserverTimeout] - ); - const resizeObserver = useResizeObserver({ - callback: handleResize, - disabled: resizeObserverDisabled || !active + position: { start, end } + } = frontmatter ? frontmatter : { position: { start: void 0, end: void 0 } }; + const newContent = content.map((line, i4) => { + const encodedInput = encodeLink(input); + let encodedLine = encodeLink(line); + const fullLineRegex2 = new RegExp( + `^${inlineFieldRegex(attribute)}(?[^\\]]*)`, + "u" + ); + const fR = encodedLine.match(fullLineRegex2); + if ((fR == null ? void 0 : fR.groups) && Object.keys(fR.groups).every((j4) => fieldComponents.includes(j4))) { + const { + inList, + inQuote, + startStyle, + endStyle, + beforeSeparatorSpacer, + afterSeparatorSpacer, + values + } = fR.groups; + const inputArray = input ? input.replace(/(\,\s+)/g, ",").split(",").sort() : []; + let newValue; + let hiddenValue = ""; + newValue = inputArray.length == 1 ? inputArray[0] : `${serializeMultiDisplayString(inputArray)}`; + return `${inQuote || ""}${inList || ""}${startStyle}${attribute}${endStyle}${beforeSeparatorSpacer}::${afterSeparatorSpacer}${hiddenValue + newValue}`; + } else { + const newFields = []; + const inSentenceRegexBrackets2 = new RegExp( + `\\[${inlineFieldRegex(attribute)}(?[^\\]]+)?\\]`, + "gu" + ); + const inSentenceRegexPar2 = new RegExp( + `\\(${inlineFieldRegex(attribute)}(?[^\\)]+)?\\)`, + "gu" + ); + newFields.push( + ...matchInlineFields( + inSentenceRegexBrackets2, + encodedLine, + attribute, + encodedInput, + "brackets" /* brackets */ + ) + ); + newFields.push( + ...matchInlineFields( + inSentenceRegexPar2, + encodedLine, + attribute, + encodedInput, + "parenthesis" /* parenthesis */ + ) + ); + newFields.forEach((field) => { + const fieldRegex = new RegExp( + field.oldField.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), + "u" + ); + encodedLine = encodedLine.replace(fieldRegex, field.newField); + }); + return decodeLink(encodedLine); + } }); - const handleNodeChange = T2((newElement, previousElement) => { - if (!resizeObserver) { - return; + await plugin.app.vault.modify( + file, + newContent.filter((line, i4) => !skippedLines.includes(i4)).join("\n") + ); + const editor = (_b2 = plugin.app.workspace.getActiveViewOfType(import_obsidian4.MarkdownView)) == null ? void 0 : _b2.editor; + if (editor) { + const lineNumber = editor.getCursor().line; + editor.setCursor({ + line: editor.getCursor().line, + ch: editor.getLine(lineNumber).length + }); + } +} + +// src/utils/metadata/frontmatter/detectYAMLType.ts +var detectYAMLType = (value, key2) => { + if (typeof value === "string") { + if (/\/\/(\S+?(?:jpe?g|png|gif|svg))/gi.test(value) || value.includes("unsplash")) { + return "image"; } - if (previousElement) { - resizeObserver.unobserve(previousElement); - resizeObserverConnected.current = false; + if (/^\d{4}-\d{2}-\d{2}$/.test(value)) { + return "date"; } - if (newElement) { - resizeObserver.observe(newElement); + if (key2 == "tag" || key2 == "tags") { + return "tag"; } - }, [resizeObserver]); - const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange); - const dataRef = useLatestValue(data); - p2(() => { - if (!resizeObserver || !nodeRef.current) { - return; + if (/\[\[.*?\]\]/.test(value)) { + return "link"; } - resizeObserver.disconnect(); - resizeObserverConnected.current = false; - resizeObserver.observe(nodeRef.current); - }, [nodeRef, resizeObserver]); - useIsomorphicLayoutEffect( - () => { - dispatch({ - type: Action.RegisterDroppable, - element: { - id: id2, - key: key2, - disabled, - node: nodeRef, - rect, - data: dataRef - } - }); - return () => dispatch({ - type: Action.UnregisterDroppable, - key: key2, - id: id2 - }); - }, - [id2] - ); - p2(() => { - if (disabled !== previous.current.disabled) { - dispatch({ - type: Action.SetDroppableDisabled, - id: id2, - key: key2, - disabled - }); - previous.current.disabled = disabled; + } else if (typeof value === "number") { + return "number"; + } else if (typeof value === "boolean") { + return "boolean"; + } else if (!value) { + return "unknown"; + } else if (Array.isArray(value) || typeof value === "string" && value.indexOf(",") > -1) { + let arrayValue = Array.isArray(value) ? value : []; + if (typeof value === "string" && value.indexOf(",") > -1) { + arrayValue = parseMultiString(value); } - }, [id2, key2, disabled, dispatch]); - return { - active, - rect, - isOver: (over == null ? void 0 : over.id) === id2, - node: nodeRef, - over, - setNodeRef - }; -} -function AnimationManager(_ref) { - let { - animation, - children - } = _ref; - const [clonedChildren, setClonedChildren] = h2(null); - const [element, setElement] = h2(null); - const previousChildren = usePrevious(children); - if (!children && !clonedChildren && previousChildren) { - setClonedChildren(previousChildren); - } - useIsomorphicLayoutEffect(() => { - if (!element) { - return; + if (key2 == "tag" || key2 == "tags") { + return "tag-multi"; } - const key2 = clonedChildren == null ? void 0 : clonedChildren.key; - const id2 = clonedChildren == null ? void 0 : clonedChildren.props.id; - if (key2 == null || id2 == null) { - setClonedChildren(null); - return; + if (arrayValue.length == 1 && Array.isArray(arrayValue[0]) && arrayValue[0].length == 1 && typeof arrayValue[0][0] === "string") { + return "link"; } - Promise.resolve(animation(id2, element)).then(() => { - setClonedChildren(null); - }); - }, [animation, clonedChildren, element]); - return Cn.createElement(Cn.Fragment, null, children, clonedChildren ? sn(clonedChildren, { - ref: setElement - }) : null); -} -var defaultTransform = { - x: 0, - y: 0, - scaleX: 1, - scaleY: 1 + const types = uniq(arrayValue.map((f4) => detectYAMLType(f4, key2))); + if (types.length == 1 && types[0] == "link") { + return "link-multi"; + } + return "option-multi"; + } else if (value.isLuxonDateTime) { + return "date"; + } else if (value.isLuxonDuration) { + return "duration"; + } else if (value.type == "file") { + return "link"; + } else if (typeof value === "object" && !Array.isArray(value) && value !== null) { + return "object"; + } + return "text"; }; -function NullifiedContextProvider(_ref) { - let { - children - } = _ref; - return Cn.createElement(InternalContext.Provider, { - value: defaultInternalContext - }, Cn.createElement(ActiveDraggableContext.Provider, { - value: defaultTransform - }, children)); -} -var baseStyles = { - position: "fixed", - touchAction: "none" + +// src/utils/metadata/frontmatter/frontMatterKeys.ts +var frontMatterKeys = (fm) => { + return Object.keys(fm != null ? fm : {}).filter((f4) => f4 != "position").filter((f4) => f4 != "tag" && f4 != "tags"); }; -var defaultTransition = (activatorEvent) => { - const isKeyboardActivator = isKeyboardEvent(activatorEvent); - return isKeyboardActivator ? "transform 250ms ease" : void 0; + +// src/utils/metadata/frontmatter/yamlTypeToMDBType.ts +var yamlTypeToMDBType = (YAMLtype) => { + switch (YAMLtype) { + case "duration": + return "text"; + break; + case "unknown": + return "text"; + break; + } + return YAMLtype; }; -var PositionedOverlay = /* @__PURE__ */ k3((_ref, ref) => { - let { - as, - activatorEvent, - adjustScale: adjustScale2, - children, - className, - rect, - style, - transform, - transition = defaultTransition - } = _ref; - if (!rect) { - return null; + +// src/utils/metadata/frontmatter/fm.ts +var saveContextToFile = (file, cols, context, plugin) => { + if (app.fileManager.processFrontMatter) { + app.fileManager.processFrontMatter(file, (frontmatter) => { + Object.keys(context).filter( + (f4) => cols.find((c4) => c4.name == f4) && cols.find((c4) => c4.name == f4).hidden != "true" && !cols.find((c4) => c4.name == f4).type.contains("file") && context[f4] + ).forEach((f4) => { + const col = cols.find((c4) => c4.name == f4); + frontmatter[f4] = valueForFrontmatter(col.type, context[f4]); + frontmatter[f4] = valueForFrontmatter(col.type, context[f4]); + }); + }); } - const scaleAdjustedTransform = adjustScale2 ? transform : { - ...transform, - scaleX: 1, - scaleY: 1 +}; +var frontMatterForFile = (file) => { + let currentCache; + if (file instanceof import_obsidian5.TFile && app.metadataCache.getFileCache(file) !== null) { + currentCache = app.metadataCache.getFileCache(file); + } + return currentCache == null ? void 0 : currentCache.frontmatter; +}; +var mergeTableData = (mdb, yamlmdb, types) => { + return { + ...mdb, + cols: [ + ...mdb.cols, + ...yamlmdb.cols.filter( + (f4) => !mdb.cols.find((g4) => g4.name.toLowerCase() == f4.toLowerCase()) + ).map((f4) => ({ + name: f4, + schemaId: mdb.schema.id, + type: yamlTypeToMDBType(types[f4]) + })) + ].filter(onlyUniquePropCaseInsensitive("name")), + rows: mdb.rows.map((r3) => { + const fmRow = yamlmdb.rows.find((f4) => f4.File == r3.File); + if (fmRow) { + return { + ...r3, + ...fmRow + }; + } + return r3; + }) }; - const styles = { - ...baseStyles, - width: rect.width, - height: rect.height, - top: rect.top, - left: rect.left, - transform: CSS.Transform.toString(scaleAdjustedTransform), - transformOrigin: adjustScale2 && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : void 0, - transition: typeof transition === "function" ? transition(activatorEvent) : transition, - ...style +}; +var guestimateTypes = (_files, plugin, dv) => { + const typesArray = _files.map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4).map((k5) => { + const fm = dv && plugin.dataViewAPI() ? plugin.dataViewAPI().page(k5.path) : frontMatterForFile(k5); + const fmKeys = dv ? Object.keys(fm != null ? fm : {}).filter( + (f4, i4, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + ) ? true : false + ).filter((f4) => f4 != "file") : frontMatterKeys(fm); + return fmKeys.reduce( + (pk, ck) => ({ ...pk, [ck]: detectYAMLType(fm[ck], ck) }), + {} + ); + }); + const types = typesArray.reduce( + (p3, c4) => { + const newSet = Object.keys(c4).reduce( + (pk, ck) => { + var _a2; + return { ...pk, [ck]: [...(_a2 = p3 == null ? void 0 : p3[ck]) != null ? _a2 : [], c4[ck]] }; + }, + { ...p3 } + ); + return newSet; + }, + {} + ); + const guessType = (ts) => { + return import_lodash.default.head((0, import_lodash.default)(ts).countBy().entries().maxBy(import_lodash.default.last)); }; - return Cn.createElement(as, { - className, - style: styles, - ref - }, children); -}); -var defaultDropAnimationSideEffects = (options) => (_ref) => { - let { - active, - dragOverlay - } = _ref; - const originalStyles = {}; - const { - styles, - className - } = options; - if (styles != null && styles.active) { - for (const [key2, value] of Object.entries(styles.active)) { - if (value === void 0) { - continue; - } - originalStyles[key2] = active.node.style.getPropertyValue(key2); - active.node.style.setProperty(key2, value); - } + const guessedTypes = Object.keys(types).reduce((p3, c4) => { + return { ...p3, [c4]: guessType(types[c4]) }; + }, {}); + return guessedTypes; +}; +var valueForFrontmatter = (type, value) => { + if (type == "number") { + return parseFloat(value); + } else if (type == "boolean") { + return value == "true"; + } else if (type.contains("multi")) { + return parseMultiString(value).map( + (f4) => valueForFrontmatter(type.replace("-multi", ""), f4) + ); + } else if (type.contains("link") || type.contains("context")) { + return `[[${value}]]`; } - if (styles != null && styles.dragOverlay) { - for (const [key2, value] of Object.entries(styles.dragOverlay)) { - if (value === void 0) { - continue; - } - dragOverlay.node.style.setProperty(key2, value); + return value; +}; +var valueForDataview = (type, value) => { + if (type.contains("link") || type.contains("context")) { + return `[[${value}]]`; + } + return value; +}; +var renameFrontmatterKey = (plugin, path, key2, name) => { + const afile = getAbstractFileAtPath(app, path); + if (afile && afile instanceof import_obsidian5.TFile) { + if (app.fileManager.processFrontMatter) { + app.fileManager.processFrontMatter(afile, (frontmatter) => { + if (key2 in frontmatter) { + frontmatter[name] = frontmatter[key2]; + delete frontmatter[key2]; + } + }); } } - if (className != null && className.active) { - active.node.classList.add(className.active); +}; +var defaultValueForType = (value, type) => { + if (type == "date") { + return format(Date.now(), "yyyy-MM-dd"); } - if (className != null && className.dragOverlay) { - dragOverlay.node.classList.add(className.dragOverlay); + if (type == "number") { + return 0; + } + if (type == "boolean") { + return true; + } + if (type == "link") { + return "[[Select Note]]"; + } + if (type == "option") { + return "one, two"; + } + if (type == "text") { + return " "; + } + if (type == "image") { + return "https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"; } - return function cleanup() { - 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); - } - }; -}; -var defaultKeyframeResolver = (_ref2) => { - let { - transform: { - initial, - final - } - } = _ref2; - return [{ - transform: CSS.Transform.toString(initial) - }, { - transform: CSS.Transform.toString(final) - }]; }; -var defaultDropAnimationConfiguration = { - duration: 250, - easing: "ease", - keyframes: defaultKeyframeResolver, - sideEffects: /* @__PURE__ */ defaultDropAnimationSideEffects({ - styles: { - active: { - opacity: "0" - } +var changeFrontmatterType = (plugin, path, key2, type) => { + const afile = getAbstractFileAtPath(app, path); + if (afile && afile instanceof import_obsidian5.TFile) { + if (app.fileManager.processFrontMatter) { + app.fileManager.processFrontMatter(afile, (frontmatter) => { + if (key2 in frontmatter) { + frontmatter[key2] = defaultValueForType(frontmatter[key2], type); + } + }); } - }) + } }; -function useDropAnimation(_ref3) { - let { - config, - draggableNodes, - droppableContainers, - measuringConfiguration - } = _ref3; - return useEvent((id2, node) => { - if (config === null) { - return; - } - const activeDraggable = draggableNodes.get(id2); - if (!activeDraggable) { - return; - } - const activeNode = activeDraggable.node.current; - if (!activeNode) { - return; - } - const measurableNode = getMeasurableNode(node); - if (!measurableNode) { - return; - } - const { - transform - } = getWindow(node).getComputedStyle(node); - const parsedTransform = parseTransform(transform); - if (!parsedTransform) { - return; - } - const animation = typeof config === "function" ? config : createDefaultDropAnimation(config); - scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure); - return animation({ - active: { - id: id2, - data: activeDraggable.data, - node: activeNode, - rect: measuringConfiguration.draggable.measure(activeNode) - }, - draggableNodes, - dragOverlay: { - node, - rect: measuringConfiguration.dragOverlay.measure(measurableNode) - }, - droppableContainers, - measuringConfiguration, - transform: parsedTransform - }); - }); -} -function createDefaultDropAnimation(options) { - const { - duration, - easing, - sideEffects, - keyframes - } = { - ...defaultDropAnimationConfiguration, - ...options - }; - return (_ref4) => { - let { - active, - dragOverlay, - transform, - ...rest - } = _ref4; - if (!duration) { - return; - } - const delta = { - x: dragOverlay.rect.left - active.rect.left, - y: dragOverlay.rect.top - active.rect.top - }; - const scale = { - scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1, - scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1 - }; - const finalTransform = { - x: transform.x - delta.x, - y: transform.y - delta.y, - ...scale - }; - const animationKeyframes = keyframes({ - ...rest, - active, - dragOverlay, - transform: { - initial: transform, - final: finalTransform - } - }); - const [firstKeyframe] = animationKeyframes; - const lastKeyframe = animationKeyframes[animationKeyframes.length - 1]; - if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) { - return; +var deleteFrontmatterValue = (plugin, path, key2) => { + const afile = getAbstractFileAtPath(app, path); + if (afile && afile instanceof import_obsidian5.TFile) { + if (app.fileManager.processFrontMatter) { + app.fileManager.processFrontMatter(afile, (frontmatter) => { + if (plugin.dataViewAPI()) { + if (plugin.dataViewAPI().page(path)[key2] && !frontmatter[key2]) { + replaceValues(plugin, path, key2, ""); + } else { + if (key2 in frontmatter) { + delete frontmatter[key2]; + } + } + } else { + if (key2 in frontmatter) { + delete frontmatter[key2]; + } + } + }); } - const cleanup = sideEffects == null ? void 0 : sideEffects({ - active, - dragOverlay, - ...rest - }); - const animation = dragOverlay.node.animate(animationKeyframes, { - duration, - easing, - fill: "forwards" - }); - return new Promise((resolve) => { - animation.onfinish = () => { - cleanup == null ? void 0 : cleanup(); - resolve(); - }; - }); - }; -} -var key = 0; -function useKey(id2) { - return F2(() => { - if (id2 == null) { - return; + } +}; +var saveFrontmatterValue = (plugin, path, key2, value, type, forceSave) => { + let afile = getAbstractFileAtPath(app, path); + const fileCache = plugin.index.filesIndex.get(path); + if (afile && fileCache) { + if (fileCache.isFolder && fileCache.folderNote) { + afile = getAbstractFileAtPath(app, fileCache.folderNote.folderNotePath); } - key++; - return key; - }, [id2]); -} -var DragOverlay = /* @__PURE__ */ Cn.memo((_ref) => { - let { - adjustScale: adjustScale2 = false, - children, - dropAnimation: dropAnimationConfig, - style, - transition, - modifiers, - wrapperElement = "div", - className, - zIndex = 999 - } = _ref; - const { - activatorEvent, - active, - activeNodeRect, - containerNodeRect, - draggableNodes, - droppableContainers, - dragOverlay, - over, - measuringConfiguration, - scrollableAncestors, - scrollableAncestorRects, - windowRect - } = useDndContext(); - const transform = q2(ActiveDraggableContext); - const key2 = useKey(active == null ? void 0 : active.id); - const modifiedTransform = applyModifiers(modifiers, { - activatorEvent, - active, - activeNodeRect, - containerNodeRect, - draggingNodeRect: dragOverlay.rect, - over, - overlayNodeRect: dragOverlay.rect, - scrollableAncestors, - scrollableAncestorRects, - transform, - windowRect - }); - const initialRect = useInitialValue(activeNodeRect); - const dropAnimation = useDropAnimation({ - config: dropAnimationConfig, - draggableNodes, - droppableContainers, - measuringConfiguration - }); - const ref = initialRect ? dragOverlay.setRef : void 0; - return Cn.createElement(NullifiedContextProvider, null, Cn.createElement(AnimationManager, { - animation: dropAnimation - }, active && key2 ? Cn.createElement(PositionedOverlay, { - key: key2, - id: active.id, - ref, - as: wrapperElement, - activatorEvent, - adjustScale: adjustScale2, - className, - transition, - rect: initialRect, - style: { - zIndex, - ...style - }, - transform: modifiedTransform - }, children) : null)); -}); - -// node_modules/@dnd-kit/sortable/dist/sortable.esm.js -function arrayMove(array, from, to) { - const newArray = array.slice(); - newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]); - return newArray; -} -function getSortedRects(items, rects) { - return items.reduce((accumulator, id2, index) => { - const rect = rects.get(id2); - if (rect) { - accumulator[index] = rect; + if (afile instanceof import_obsidian5.TFile) { + if (app.fileManager.processFrontMatter) { + app.fileManager.processFrontMatter(afile, (frontmatter) => { + var _a2; + if (plugin.dataViewAPI()) { + if (((_a2 = plugin.dataViewAPI().page(afile.path)) == null ? void 0 : _a2[key2]) && !frontmatter[key2]) { + replaceValues(plugin, afile.path, key2, valueForDataview(type, value)); + } else { + if (key2 in frontmatter || forceSave) { + frontmatter[key2] = valueForFrontmatter(type, value); + } + } + } else { + if (key2 in frontmatter || forceSave) { + frontmatter[key2] = valueForFrontmatter(type, value); + } + } + }); + } } - return accumulator; - }, Array(items.length)); -} -function isValidIndex(index) { - return index !== null && index >= 0; -} -function itemsEqual(a5, b4) { - if (a5 === b4) { - return true; } - if (a5.length !== b4.length) { - return false; +}; + +// src/utils/metadata/frontmatter/parseFrontMatter.ts +var parseFrontMatter = (field, value) => { + const YAMLtype = detectYAMLType(value, field); + switch (YAMLtype) { + case "object": + return JSON.stringify(value); + break; + case "number": + return value.toString(); + break; + case "boolean": + return value ? "true" : "false"; + break; + case "date": + return value; + break; + case "duration": + return serializeMultiDisplayString(Object.keys(value.values).reduce( + (p3, c4) => [ + ...p3, + ...value.values[c4] > 0 ? [value.values[c4] + " " + c4] : [] + ], + [] + )); + break; + case "option-multi": + case "link-multi": + if (typeof value === "string") { + return value; + } + return serializeMultiString( + value.map((v3) => { + if (!v3) { + return ""; + } + if (typeof v3 === "string") { + return v3; + } + if (v3.path) { + return v3.path; + } + if (Array.isArray(value) && v3.length == 1 && Array.isArray(v3[0]) && v3[0].length == 1 && typeof v3[0][0] === "string") { + return v3[0][0]; + } + return JSON.stringify(v3); + }) + ); + break; + case "link": + { + if (Array.isArray(value) && value.length == 1 && Array.isArray(value[0]) && value[0].length == 1 && typeof value[0][0] === "string") { + return value[0][0]; + } else if (typeof value === "string") { + return value; + } + return value.path; + } + break; + case "text": + case "tag": + case "image": + return value; + break; } - for (let i4 = 0; i4 < a5.length; i4++) { - if (a5[i4] !== b4[i4]) { - return false; + return ""; +}; + +// src/utils/path.ts +var import_obsidian6 = require("obsidian"); + +// src/utils/regex.ts +var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi; + +// src/utils/path.ts +var openPath = (plugin, _path) => { + const { type, path } = _path; + if (type == "file" || type == "folder") { + const afile = getAbstractFileAtPath(app, path); + if (afile) { + openAFile(afile, plugin, false); + } else { + if (type == "file") + createNewMarkdownFile( + plugin, + defaultNoteFolder(plugin, null), + path + ); } + return; } - return true; -} -function normalizeDisabled(disabled) { - if (typeof disabled === "boolean") { - return { - draggable: disabled, - droppable: disabled - }; + if (type == "tag") { + openTagContext(path, plugin, false); + return; + } + if (type == "url") { + openURL(path); + return; } - return disabled; -} -var defaultScale = { - scaleX: 1, - scaleY: 1 }; -var horizontalListSortingStrategy = (_ref) => { - var _rects$activeIndex; - let { - rects, - activeNodeRect: fallbackActiveRect, - activeIndex, - overIndex, - index - } = _ref; - const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; - if (!activeNodeRect) { - return null; +var pathByString = (path, source) => { + const [str, alias] = path.split("|"); + const refIndex = str.lastIndexOf("#"); + const [link, ref] = refIndex > 0 ? [str.substring(0, refIndex), str.substring(refIndex + 1)] : [str, void 0]; + const type = pathTypeByString(link, source); + return { + fullPath: path, + path: link, + type, + alias, + ref + }; +}; +var pathTypeByString = (file, source) => { + if (file.charAt(0) == "#") { + return "tag"; } - const itemGap = getItemGap(rects, index, activeIndex); - if (index === activeIndex) { - const newIndexRect = rects[overIndex]; - if (!newIndexRect) { - return null; + if (file.slice(-2) == "//") { + return "space"; + } + if (file.charAt(file.length - 1) == "/") { + return "folder"; + } + let portalFile; + if (source) { + portalFile = app.metadataCache.getFirstLinkpathDest(file, source); + } else { + portalFile = app.vault.getAbstractFileByPath(file); + } + if (portalFile instanceof import_obsidian6.TFolder) { + return "folder"; + } + if (portalFile instanceof import_obsidian6.TFile) { + return "file"; + } + if (file.match(urlRegex)) + return "url"; + return "unknown"; +}; + +// src/utils/contexts/predicate/predicate.tsx +var defaultPredicateFnForType = (type, types) => { + const fnType = Object.keys(types).find( + (f4) => types[f4].type.find((g4) => g4 == type) + ); + return fnType; +}; +var predicateFnsForType = (type, types) => { + const fnTypes = Object.keys(types).filter( + (f4) => types[f4].type.find((g4) => g4 == type) + ); + return fnTypes; +}; +var cleanPredicateType = (type, definedTypes) => { + return type.filter((f4) => Object.keys(definedTypes).find((g4) => g4 == f4.fn)); +}; +var validatePredicate = (prevPredicate) => { + if (!prevPredicate) { + return defaultPredicate; + } + return { + ...defaultPredicate, + filters: Array.isArray(prevPredicate.filters) ? cleanPredicateType(prevPredicate.filters, filterFnTypes) : [], + sort: Array.isArray(prevPredicate.sort) ? cleanPredicateType(prevPredicate.sort, sortFnTypes) : [], + groupBy: Array.isArray(prevPredicate.groupBy) ? prevPredicate.groupBy : [], + colsOrder: Array.isArray(prevPredicate.colsOrder) ? prevPredicate.colsOrder : [], + colsHidden: Array.isArray(prevPredicate.colsHidden) ? prevPredicate.colsHidden : [], + colsSize: prevPredicate.colsSize + }; +}; +var defaultPredicate = { + filters: [], + sort: [], + groupBy: [], + colsOrder: [], + colsHidden: [], + colsSize: {} +}; + +// src/components/ContextView/MDBContext.tsx +var MDBContext = F({ + def: [], + tables: [], + cols: [], + sortedColumns: [], + data: [], + filteredData: [], + tableData: null, + contextTable: {}, + selectedRows: [], + selectRows: () => { + }, + setContextTable: () => { + }, + predicate: defaultPredicate, + savePredicate: () => { + }, + saveDB: () => null, + saveContextDB: () => null, + schema: null, + dbSchema: null, + setSchema: () => { + }, + setDBSchema: () => { + }, + hideColumn: () => { + }, + saveColumn: () => false, + newColumn: () => false, + sortColumn: () => { + }, + delColumn: () => { + }, + saveSchema: () => null, + deleteSchema: () => null, + tagContexts: [], + contextInfo: null, + dbFileExists: false, + readMode: false, + searchString: "", + setSearchString: () => { + }, + loadContextFields: () => { + }, + updateValue: () => { + }, + updateFieldValue: () => { + } +}); +var MDBProvider = (props2) => { + var _a2; + const [readMode, setReadMode] = h2(props2.context.readOnly); + const [dbFileExists, setDBFileExists] = h2(false); + const [schema, setSchema] = h2(null); + const [searchString, setSearchString] = h2(null); + const [schemaTable, setSchemaTable] = h2(null); + const tables = (_a2 = schemaTable == null ? void 0 : schemaTable.rows) != null ? _a2 : []; + const [tableData, setTableData] = h2(null); + const [dbSchema, setDBSchema] = h2(null); + const [contextTable, setContextTable] = h2({}); + const [predicate, setPredicate] = h2(defaultPredicate); + const def = F2(() => parseContextDefString(dbSchema == null ? void 0 : dbSchema.def), [dbSchema]); + const [selectedRows, setSelectedRows] = h2([]); + const [metadataCache, setMetadataCache] = h2(null); + const defaultSchema = props2.context.type == "tag" ? defaultTagSchema : defaultFolderSchema; + const contextInfo = F2(() => { + return props2.context; + }, [props2.context]); + const tagContexts = F2( + () => def.filter((f4) => f4.type == "tag").map((f4) => f4.value), + [def] + ); + const cols = F2( + () => { + var _a3; + return tableData ? [ + ...(_a3 = tableData.cols.map((f4) => ({ ...f4, table: "" }))) != null ? _a3 : [], + ...tagContexts.reduce( + (p3, c4) => { + var _a4, _b2; + return [ + ...p3, + ...(_b2 = (_a4 = contextTable[c4]) == null ? void 0 : _a4.cols.filter( + (f4) => f4.name != FilePropertyName && f4.type != "fileprop" + ).map((f4) => ({ ...f4, table: c4 }))) != null ? _b2 : [] + ]; + }, + [] + ) + ] : []; + }, + [tableData, schema, contextTable, tagContexts] + ); + const data = F2( + () => { + var _a3; + return (_a3 = tableData == null ? void 0 : tableData.rows.map( + (r3, index) => linkContextRow( + props2.plugin, + { + _index: index.toString(), + ...r3, + ...tagContexts.reduce((p3, c4) => { + var _a4, _b2, _c2, _d2; + const contextRowIndexByFile = (_b2 = (_a4 = contextTable[c4]) == null ? void 0 : _a4.rows.findIndex((f4) => f4.File == r3.File)) != null ? _b2 : -1; + const contextRowsByFile = (_d2 = (_c2 = contextTable[c4]) == null ? void 0 : _c2.rows[contextRowIndexByFile]) != null ? _d2 : {}; + const contextRowsWithKeysAppended = Object.keys( + contextRowsByFile + ).reduce( + (pa, ca) => ({ ...pa, [ca + c4]: contextRowsByFile[ca] }), + { + ["_index" + c4]: contextRowIndexByFile.toString() + } + ); + return { ...p3, ...contextRowsWithKeysAppended }; + }, {}) + }, + cols + ) + )) != null ? _a3 : []; + }, + [tableData, schema, contextTable] + ); + const sortedColumns = F2(() => { + return cols.filter( + (f4) => f4.hidden != "true" && !predicate.colsHidden.some((c4) => c4 == f4.name + f4.table) + ).sort( + (a5, b4) => predicate.colsOrder.findIndex((x5) => x5 == a5.name + a5.table) - predicate.colsOrder.findIndex((x5) => x5 == b4.name + b4.table) + ); + }, [cols, predicate]); + const filteredData = F2( + () => data.filter((f4) => { + return predicate.filters.reduce((p3, c4) => { + return p3 ? filterReturnForCol( + cols.find((col) => col.name + col.table == c4.field), + c4, + f4 + ) : p3; + }, true); + }).filter( + (f4) => (searchString == null ? void 0 : searchString.length) > 0 ? matchAny(searchString).test( + Object.keys(f4).filter((g4) => g4.charAt(0) != "_").map((g4) => f4[g4]).join("|") + ) : true + ).sort((a5, b4) => { + return predicate.sort.reduce((p3, c4) => { + return p3 == 0 ? sortReturnForCol( + cols.find((col) => col.name + col.table == c4.field), + c4, + a5, + b4 + ) : p3; + }, 0); + }), + [predicate, data, cols, searchString] + ); + const deleteSchema = async (table) => { + if (table.primary) + return; + const deleteResult = await deleteMDBTable( + props2.plugin, + contextInfo, + table.id + ); + if (deleteResult) { + const newSchemaTable = { + ...schemaTable, + rows: schemaTable.rows.filter( + (f4) => f4.id != table.id && f4.def != table.id + ) + }; + setSchemaTable(newSchemaTable); + if (dbSchema.id == table.id) { + setDBSchema( + newSchemaTable.rows.find((g4) => g4.type == "db") + ); + } } - return { - x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left, - y: 0, - ...defaultScale - }; - } - if (index > activeIndex && index <= overIndex) { - return { - x: -activeNodeRect.width - itemGap, - y: 0, - ...defaultScale - }; - } - if (index < activeIndex && index >= overIndex) { - return { - x: activeNodeRect.width + itemGap, - y: 0, - ...defaultScale + }; + const saveSchema = async (table) => { + const newSchema = schemaTable.rows.find((f4) => f4.id == table.id) ? true : false; + const newSchemaTable = newSchema ? { + ...schemaTable, + rows: schemaTable.rows.map((f4) => f4.id == table.id ? table : f4) + } : { + ...schemaTable, + rows: [...schemaTable.rows, table] }; - } - return { - x: 0, - y: 0, - ...defaultScale + if (!contextInfo.readOnly) { + await saveDBToPath(props2.plugin, contextInfo.dbPath, { + m_schema: newSchemaTable + }); + if (!dbFileExists) { + saveDB2(tableData); + } + } + if (table.id == (schema == null ? void 0 : schema.id)) { + setSchema(table); + } + if (table.id == (dbSchema == null ? void 0 : dbSchema.id)) { + setDBSchema(table); + setTableData((f4) => ({ + ...f4, + schema: table + })); + } + setSchemaTable(newSchemaTable); }; -}; -function getItemGap(rects, index, activeIndex) { - const currentRect = rects[index]; - const previousRect = rects[index - 1]; - const nextRect = rects[index + 1]; - if (!currentRect || !previousRect && !nextRect) { - return 0; - } - if (activeIndex < index) { - return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width); - } - return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width); -} -var rectSortingStrategy = (_ref) => { - let { - rects, - activeIndex, - overIndex, - index - } = _ref; - const newRects = arrayMove(rects, overIndex, activeIndex); - const oldRect = rects[index]; - const newRect = newRects[index]; - if (!newRect || !oldRect) { - return null; - } - return { - x: newRect.left - oldRect.left, - y: newRect.top - oldRect.top, - scaleX: newRect.width / oldRect.width, - scaleY: newRect.height / oldRect.height + const updateValue2 = (column, value, table, index, file) => { + var _a3, _b2; + const col = (_a3 = table == "" ? tableData : contextTable[table]) == null ? void 0 : _a3.cols.find( + (f4) => f4.name == column + ); + if (col) + saveFrontmatterValue( + props2.plugin, + file != null ? file : (_b2 = tableData.rows[index]) == null ? void 0 : _b2.File, + column, + value, + col.type, + props2.plugin.settings.saveAllContextToFrontmatter + ); + if (table == "") { + saveDB2({ + ...tableData, + rows: tableData.rows.map( + (r3, i4) => i4 == index ? { + ...r3, + [column]: value + } : r3 + ) + }); + } else if (contextTable[table]) { + saveContextDB( + { + ...contextTable[table], + rows: contextTable[table].rows.map( + (r3, i4) => i4 == index ? { + ...r3, + [column]: value + } : r3 + ) + }, + table + ); + } }; -}; -var defaultScale$1 = { - scaleX: 1, - scaleY: 1 -}; -var verticalListSortingStrategy = (_ref) => { - var _rects$activeIndex; - let { - activeIndex, - activeNodeRect: fallbackActiveRect, - index, - rects, - overIndex - } = _ref; - const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; - if (!activeNodeRect) { - return null; - } - if (index === activeIndex) { - const overIndexRect = rects[overIndex]; - if (!overIndexRect) { - return null; + const sortColumn = (sort) => { + savePredicate({ + ...predicate, + sort: [sort] + }); + }; + const hideColumn = (col, hidden) => { + savePredicate({ + ...predicate, + colsHidden: hidden ? [ + ...predicate.colsHidden.filter((s5) => s5 != col.name + col.table), + col.name + col.table + ] : predicate.colsHidden.filter((s5) => s5 != col.name + col.table) + }); + }; + const updateFieldValue = (column, fieldValue, value, table, index, file) => { + var _a3; + const col = tableData.cols.find((f4) => f4.name == column); + saveFrontmatterValue( + props2.plugin, + file != null ? file : (_a3 = tableData.rows[index]) == null ? void 0 : _a3.File, + column, + value, + col.type, + props2.plugin.settings.saveAllContextToFrontmatter + ); + if (table == "") { + const newTable = { + ...tableData, + cols: tableData.cols.map( + (m5) => m5.name == column ? { + ...m5, + value: fieldValue + } : m5 + ), + rows: tableData.rows.map( + (r3, i4) => i4 == index ? { + ...r3, + [column]: value + } : r3 + ) + }; + saveDB2(newTable); + } else if (contextTable[table]) { + saveContextDB( + { + ...contextTable[table], + cols: contextTable[table].cols.map( + (m5) => m5.name == column ? { + ...m5, + value: fieldValue + } : m5 + ), + rows: contextTable[table].rows.map( + (r3, i4) => i4 == index ? { + ...r3, + [column]: value + } : r3 + ) + }, + table + ); } - return { - x: 0, - y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top, - ...defaultScale$1 - }; - } - const itemGap = getItemGap$1(rects, index, activeIndex); - if (index > activeIndex && index <= overIndex) { - return { - x: 0, - y: -activeNodeRect.height - itemGap, - ...defaultScale$1 - }; - } - if (index < activeIndex && index >= overIndex) { - return { - x: 0, - y: activeNodeRect.height + itemGap, - ...defaultScale$1 - }; - } - return { - x: 0, - y: 0, - ...defaultScale$1 }; -}; -function getItemGap$1(clientRects, index, activeIndex) { - const currentRect = clientRects[index]; - const previousRect = clientRects[index - 1]; - const nextRect = clientRects[index + 1]; - if (!currentRect) { - return 0; - } - if (activeIndex < index) { - 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; -} -var ID_PREFIX2 = "Sortable"; -var Context = /* @__PURE__ */ Cn.createContext({ - activeIndex: -1, - containerId: ID_PREFIX2, - disableTransforms: false, - items: [], - overIndex: -1, - useDragOverlay: false, - sortedRects: [], - strategy: rectSortingStrategy, - disabled: { - draggable: false, - droppable: false - } -}); -function SortableContext(_ref) { - let { - children, - id: id2, - items: userDefinedItems, - strategy = rectSortingStrategy, - disabled: disabledProp = false - } = _ref; - const { - active, - dragOverlay, - droppableRects, - over, - measureDroppableContainers - } = useDndContext(); - const containerId = useUniqueId(ID_PREFIX2, id2); - const useDragOverlay = Boolean(dragOverlay.rect !== null); - const items = F2(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]); - const isDragging = active != null; - const activeIndex = active ? items.indexOf(active.id) : -1; - const overIndex = over ? items.indexOf(over.id) : -1; - const previousItemsRef = _2(items); - const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current); - const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged; - const disabled = normalizeDisabled(disabledProp); - useIsomorphicLayoutEffect(() => { - if (itemsHaveChanged && isDragging) { - measureDroppableContainers(items); + const syncAllMetadata = (f4) => { + const files = f4.rows.map((f5) => f5.File); + const importYAML = (files2, fmKeys) => { + return files2.map((f5) => getAbstractFileAtPath(app, f5)).filter((f5) => f5).reduce( + (p3, c4) => { + const fm = frontMatterForFile(c4); + if (!fm) + return p3; + return { + uniques: [], + cols: uniq([...p3.cols, ...fmKeys]), + rows: [ + ...p3.rows, + { + File: c4.path, + ...fmKeys.reduce((p4, c5) => { + const value = parseFrontMatter(c5, fm[c5]); + if ((value == null ? void 0 : value.length) > 0) + return { ...p4, [c5]: value }; + return p4; + }, {}) + } + ] + }; + }, + { uniques: [], cols: [], rows: [] } + ); + }; + const yamlTableData = importYAML( + files, + f4.cols.filter((f5) => !f5.type.contains("file")).map((f5) => f5.name) + ); + const newRows = f4.rows.map((r3) => { + const fmRow = yamlTableData.rows.find((f5) => f5.File == r3.File); + if (fmRow) { + return { + ...r3, + ...fmRow + }; + } + return r3; + }); + const rowsChanged = !import_lodash2.default.isEqual(newRows, tableData == null ? void 0 : tableData.rows); + const colsChanged = !import_lodash2.default.isEqual(tableData == null ? void 0 : tableData.cols, f4.cols); + if (rowsChanged || colsChanged) { + saveDB2({ + ...f4, + rows: newRows + }); } - }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]); + }; p2(() => { - previousItemsRef.current = items; - }, [items]); - const contextValue = F2( - () => ({ - activeIndex, - containerId, - disabled, - disableTransforms, - items, - overIndex, - useDragOverlay, - sortedRects: getSortedRects(items, droppableRects), - strategy - }), - [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy] - ); - return Cn.createElement(Context.Provider, { - value: contextValue - }, children); -} -var defaultNewIndexGetter = (_ref) => { - let { - id: id2, - items, - activeIndex, - overIndex - } = _ref; - return arrayMove(items, activeIndex, overIndex).indexOf(id2); -}; -var defaultAnimateLayoutChanges = (_ref2) => { - let { - containerId, - isSorting, - wasDragging, - index, - items, - newIndex, - previousItems, - previousContainerId, - transition - } = _ref2; - if (!transition || !wasDragging) { - return false; - } - if (previousItems !== items && index === newIndex) { - return false; - } - if (isSorting) { - return true; - } - return newIndex !== index && containerId === previousContainerId; -}; -var defaultTransition2 = { - duration: 200, - easing: "ease" -}; -var transitionProperty = "transform"; -var disabledTransition = /* @__PURE__ */ CSS.Transition.toString({ - property: transitionProperty, - duration: 0, - easing: "linear" -}); -var defaultAttributes = { - roleDescription: "sortable" -}; -function useDerivedTransform(_ref) { - let { - disabled, - index, - node, - rect - } = _ref; - const [derivedTransform, setDerivedtransform] = h2(null); - const previousIndex = _2(index); - useIsomorphicLayoutEffect(() => { - if (!disabled && index !== previousIndex.current && node.current) { - const initial = rect.current; - if (initial) { - const current = getClientRect(node.current, { - ignoreTransform: true - }); - const delta = { - x: initial.left - current.left, - y: initial.top - current.top, - scaleX: initial.width / current.width, - scaleY: initial.height / current.height - }; - if (delta.x || delta.y) { - setDerivedtransform(delta); + var _a3, _b2; + if (schemaTable) { + if (props2.schema) { + if ((dbSchema == null ? void 0 : dbSchema.id) != props2.schema) { + const preselectSchema = schemaTable.rows.find( + (g4) => g4.id == props2.schema + ); + if (preselectSchema) { + if (preselectSchema.type == "db") { + setDBSchema(preselectSchema); + return; + } else { + const preselectDBSchema = schemaTable.rows.find( + (g4) => g4.id == preselectSchema.def + ); + if (preselectDBSchema) { + setDBSchema(preselectDBSchema); + return; + } + } + } else { + const newSchema = { + id: uniqueNameFromString( + sanitizeTableName(props2.schema), + schemaTable.rows.map((g4) => g4.id) + ), + name: props2.schema, + type: "db" + }; + setDBSchema(newSchema); + saveSchema(newSchema).then((f4) => { + saveDB2({ + schema: newSchema, + cols: defaultTableFields.map((g4) => ({ + ...g4, + schemaId: newSchema.id + })), + rows: [] + }); + }); + } } + } else { + if (!dbSchema) { + setDBSchema( + (_a3 = schemaTable.rows) == null ? void 0 : _a3.find((g4) => g4.type == "db") + ); + } else { + setDBSchema( + (_b2 = schemaTable.rows) == null ? void 0 : _b2.find((g4) => g4.id == dbSchema.id) + ); + } + } + } + }, [schemaTable]); + const loadTables = async () => { + if (getAbstractFileAtPath(app, contextInfo.dbPath) || contextInfo.isRemote) { + setDBFileExists(true); + getMDBTableSchemas(props2.plugin, contextInfo).then((f4) => { + setSchemaTable((prev) => ({ + ...defaultSchema, + rows: f4 + })); + }); + } else { + if (props2.schema) { + saveDB2(defaultTableDataForContext(props2.plugin, contextInfo)).then( + (f4) => { + setSchemaTable((prev) => defaultSchema); + } + ); + } else { + setSchemaTable((prev) => defaultSchema); + setDBSchema((prev) => defaultFileDBSchema); } } - if (index !== previousIndex.current) { - previousIndex.current = index; + }; + const refreshFile = async (file) => { + var _a3; + if (file.path == props2.file && dbSchema) { + const fCache = (_a3 = app.metadataCache.getCache(file.path)) == null ? void 0 : _a3.frontmatter; + if ((0, import_lodash2.isEqual)(fCache, metadataCache)) + return; + setMetadataCache(fCache); + if (dbSchema.primary) { + runDef(); + } else { + getMDBData(); + } } - }, [disabled, index, node, rect]); - p2(() => { - if (derivedTransform) { - setDerivedtransform(null); + }; + const refreshTags = async (tags) => { + if (tagContexts.some((f4) => tags.some((g4) => g4 == f4))) + if (dbSchema.primary) { + runDef(); + } else { + getMDBData(); + } + }; + const refreshSpace = async (evt) => { + if (evt.detail.type == "context") { + refreshMDB(evt.detail.name); + return; } - }, [derivedTransform]); - return derivedTransform; -} -function useSortable(_ref) { - let { - animateLayoutChanges: animateLayoutChanges3 = defaultAnimateLayoutChanges, - attributes: userDefinedAttributes, - disabled: localDisabled, - data: customData, - getNewIndex = defaultNewIndexGetter, - id: id2, - strategy: localStrategy, - resizeObserverConfig, - transition = defaultTransition2 - } = _ref; - const { - items, - containerId, - activeIndex, - disabled: globalDisabled, - disableTransforms, - sortedRects, - overIndex, - useDragOverlay, - strategy: globalStrategy - } = q2(Context); - const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); - const index = items.indexOf(id2); - const data = F2(() => ({ - sortable: { - containerId, - index, - items - }, - ...customData - }), [containerId, customData, index, items]); - const itemsAfterCurrentSortable = F2(() => items.slice(items.indexOf(id2)), [items, id2]); - const { - rect, - node, - isOver, - setNodeRef: setDroppableNodeRef - } = useDroppable({ - id: id2, - data, - disabled: disabled.droppable, - resizeObserverConfig: { - updateMeasurementsFor: itemsAfterCurrentSortable, - ...resizeObserverConfig + if (evt.detail.type == "file") { + refreshFile(getAbstractFileAtPath(app, evt.detail.name)); + return; } - }); - const { - active, - activatorEvent, - activeNodeRect, - attributes, - setNodeRef: setDraggableNodeRef, - listeners, - isDragging, - over, - setActivatorNodeRef, - transform - } = useDraggable({ - id: id2, - data, - attributes: { - ...defaultAttributes, - ...userDefinedAttributes - }, - disabled: disabled.draggable - }); - const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef); - const isSorting = Boolean(active); - const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex); - const shouldDisplaceDragSource = !useDragOverlay && isDragging; - const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null; - const strategy = localStrategy != null ? localStrategy : globalStrategy; - const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({ - rects: sortedRects, - activeNodeRect, - activeIndex, - overIndex, - index - }) : null; - const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ - id: id2, - items, - activeIndex, - overIndex - }) : index; - const activeId = active == null ? void 0 : active.id; - const previous = _2({ - activeId, - items, - newIndex, - containerId - }); - const itemsHaveChanged = items !== previous.current.items; - const shouldAnimateLayoutChanges = animateLayoutChanges3({ - active, - containerId, - isDragging, - isSorting, - id: id2, - index, - items, - newIndex: previous.current.newIndex, - previousItems: previous.current.items, - previousContainerId: previous.current.containerId, - transition, - wasDragging: previous.current.activeId != null - }); - const derivedTransform = useDerivedTransform({ - disabled: !shouldAnimateLayoutChanges, - index, - node, - rect - }); - p2(() => { - if (isSorting && previous.current.newIndex !== newIndex) { - previous.current.newIndex = newIndex; + if ((evt.detail.type == "space" || evt.detail.type == "vault") && !dbFileExists) { + const defaultTable = defaultTableDataForContext( + props2.plugin, + contextInfo + ); + if (defaultTable) + setTableData(defaultTable); + } else if (evt.detail.type == "vault") { + refreshMDB(contextInfo.contextPath); } - if (containerId !== previous.current.containerId) { - previous.current.containerId = containerId; + }; + const getMDBData = () => { + getMDBTable(props2.plugin, contextInfo, dbSchema.id).then((f4) => { + setTableData(f4); + }); + }; + const refreshMDB = async (contextPath) => { + if (!dbFileExists || (dbSchema == null ? void 0 : dbSchema.primary) != "true") { + return; } - if (items !== previous.current.items) { - previous.current.items = items; + if (contextPath == contextInfo.contextPath) { + if (dbSchema) { + loadTables(); + } + } else { + const tag = Object.keys(contextTable).find( + (t4) => tagContextFromTag(props2.plugin, t4).contextPath == contextPath + ); + if (tag) + loadContextFields(tag); } - }, [isSorting, newIndex, containerId, items]); + }; p2(() => { - if (activeId === previous.current.activeId) { - return; - } - if (activeId && !previous.current.activeId) { - previous.current.activeId = activeId; + window.addEventListener(eventTypes.spacesChange, refreshSpace); + return () => { + window.removeEventListener(eventTypes.spacesChange, refreshSpace); + }; + }, [refreshSpace]); + p2(() => { + loadTables(); + }, [contextInfo]); + const saveDB2 = async (newTable) => { + var _a3; + if (contextInfo.readOnly) return; + if (!dbFileExists) { + const defaultFields = defaultFieldsForContext(contextInfo); + const defaultTable = defaultTablesForContext(contextInfo); + const dbField = { + ...defaultTable, + m_fields: { + uniques: defaultFields.uniques, + cols: defaultFields.cols, + rows: [...(_a3 = defaultFields.rows) != null ? _a3 : [], ...newTable.cols] + }, + [newTable.schema.id]: { + uniques: newTable.cols.filter((c4) => c4.unique == "true").map((c4) => c4.name), + cols: newTable.cols.map((c4) => c4.name), + rows: newTable.rows + } + }; + await saveDBToPath(props2.plugin, contextInfo.dbPath, dbField).then( + (f4) => { + setDBFileExists(true); + f4 ? setTableData(newTable) : new import_obsidian7.Notice("DB ERROR"); + } + ); + } else { + await saveMDBToPath(props2.plugin, contextInfo, newTable).then((f4) => { + setDBFileExists(true); + f4 ? setTableData(newTable) : new import_obsidian7.Notice("DB ERROR"); + }); } - const timeoutId = setTimeout(() => { - previous.current.activeId = activeId; - }, 50); - return () => clearTimeout(timeoutId); - }, [activeId]); - return { - active, - activeIndex, - attributes, - data, - rect, - index, - newIndex, - items, - isOver, - isSorting, - isDragging, - listeners, - node, - overIndex, - over, - setNodeRef, - setActivatorNodeRef, - setDroppableNodeRef, - setDraggableNodeRef, - transform: derivedTransform != null ? derivedTransform : finalTransform, - transition: getTransition() }; - function getTransition() { - if (derivedTransform || itemsHaveChanged && previous.current.newIndex === index) { - return disabledTransition; + p2(() => { + var _a3; + if (!schemaTable || !dbSchema) + return; + const _schema = (schema == null ? void 0 : schema.def) == dbSchema.id ? schemaTable.rows.find((f4) => f4.id == schema.id) : (_a3 = schemaTable.rows.find((f4) => f4.def == dbSchema.id)) != null ? _a3 : { + ...dbSchema, + id: uniqueNameFromString( + dbSchema.id + "View", + schemaTable.rows.map((f4) => f4.id) + ), + type: "table", + def: dbSchema.id + }; + if (_schema) { + setSchema(_schema); + if (dbFileExists) { + if (dbSchema.primary) { + runDef(); + } else { + getMDBData(); + } + } else { + const defaultTable = defaultTableDataForContext( + props2.plugin, + contextInfo + ); + if (defaultTable) + setTableData(defaultTable); + } } - if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) { - return void 0; + }, [dbSchema]); + p2(() => { + if (dbFileExists && schema) { + parsePredicate(schema.predicate); } - if (isSorting || shouldAnimateLayoutChanges) { - return CSS.Transition.toString({ - ...transition, - property: transitionProperty + }, [schema]); + p2(() => { + if (dbFileExists && tableData) + getContextTags(tableData); + }, [tableData]); + const selectRows = (lastSelected, rows) => { + setSelectedRows(rows); + if (!((dbSchema == null ? void 0 : dbSchema.primary) == "true")) + return; + if (lastSelected) { + const path = tableData.rows[parseInt(lastSelected)].File; + let evt = new CustomEvent(eventTypes.activePathChange, { + detail: { + selection: path, + path: { + ...pathByString(contextInfo.contextPath), + ref: schema == null ? void 0 : schema.id + } + } + }); + window.dispatchEvent(evt); + } else { + let evt = new CustomEvent(eventTypes.activePathChange, { + detail: { + path: { + ...pathByString(contextInfo.contextPath), + ref: schema == null ? void 0 : schema.id + }, + selection: null + } }); + window.dispatchEvent(evt); } - return void 0; - } -} -function normalizeLocalDisabled(localDisabled, globalDisabled) { - var _localDisabled$dragga, _localDisabled$droppa; - if (typeof localDisabled === "boolean") { - return { - draggable: localDisabled, - droppable: false - }; - } - return { - draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable, - droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable }; -} -function hasSortableData(entry) { - if (!entry) { - return false; - } - const data = entry.data.current; - if (data && "sortable" in data && typeof data.sortable === "object" && "containerId" in data.sortable && "items" in data.sortable && "index" in data.sortable) { - return true; - } - return false; -} -var directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left]; -var sortableKeyboardCoordinates = (event, _ref) => { - let { - context: { - active, - collisionRect, - droppableRects, - droppableContainers, - over, - scrollableAncestors + const getContextTags = async (_tableData) => { + const contextFields = _tableData.cols.filter((f4) => f4.type.contains("context")).map((f4) => f4.value).filter((f4) => !tagContexts.some((g4) => g4 == f4)); + for (let c4 of contextFields) { + loadContextFields(c4); } - } = _ref; - if (directions.includes(event.code)) { - event.preventDefault(); - if (!active || !collisionRect) { - return; + }; + const runDef = async () => { + if (contextInfo.type == "folder") { + getMDBTable(props2.plugin, contextInfo, "files").then((f4) => { + for (let c4 of tagContexts) { + loadTagContext(c4, f4.rows); + } + setTableData(f4); + return f4; + }); + } else if (contextInfo.type == "tag") { + getMDBTable(props2.plugin, contextInfo, "files").then((f4) => { + for (let c4 of tagContexts) { + loadTagContext(c4, f4.rows); + } + setTableData(f4); + return f4; + }); + } else if (contextInfo.type == "space") { + getMDBTable(props2.plugin, contextInfo, "files").then((f4) => { + setTableData(f4); + return f4; + }); + } else { + getMDBTable(props2.plugin, contextInfo, dbSchema.id).then( + (f4) => setTableData(f4) + ); } - const filteredContainers = []; - droppableContainers.getEnabled().forEach((entry) => { - if (!entry || entry != null && entry.disabled) { - return; - } - const rect = droppableRects.get(entry.id); - if (!rect) { - return; - } - switch (event.code) { - case KeyboardCode.Down: - if (collisionRect.top < rect.top) { - filteredContainers.push(entry); - } - break; - case KeyboardCode.Up: - if (collisionRect.top > rect.top) { - filteredContainers.push(entry); - } - break; - case KeyboardCode.Left: - if (collisionRect.left > rect.left) { - filteredContainers.push(entry); - } - break; - case KeyboardCode.Right: - if (collisionRect.left < rect.left) { - filteredContainers.push(entry); - } - break; + }; + const loadTagContext = async (tag, files) => { + getMDBTable( + props2.plugin, + tagContextFromTag(props2.plugin, tag), + "files" + ).then((f4) => { + if (f4) { + const contextFields = f4.cols.filter((g4) => g4.type.contains("context")).map((g4) => g4.value).filter((g4) => !tagContexts.some((h5) => h5 == g4)); + for (let c4 of contextFields) { + loadContextFields(c4); + } + setContextTable((t4) => ({ + ...t4, + [tag]: f4 + })); } }); - const collisions = closestCorners({ - active, - collisionRect, - droppableRects, - droppableContainers: filteredContainers, - pointerCoordinates: null + }; + const loadContextFields = async (tag) => { + getMDBTable( + props2.plugin, + tagContextFromTag(props2.plugin, tag), + "files" + ).then((f4) => { + setContextTable((t4) => ({ + ...t4, + [tag]: f4 + })); }); - let closestId = getFirstCollision(collisions, "id"); - if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { - closestId = collisions[1].id; + }; + const saveContextDB = async (newTable, tag) => { + const context = tagContextFromTag(props2.plugin, tag); + await saveMDBToPath(props2.plugin, context, newTable).then( + (f4) => f4 && setContextTable((t4) => ({ + ...t4, + [tag]: newTable + })) + ); + }; + const savePredicate = (newPredicate) => { + const cleanedPredicate = validatePredicate(newPredicate); + saveSchema({ + ...schema, + predicate: JSON.stringify(cleanedPredicate) + }); + setPredicate(cleanedPredicate); + }; + p2(() => { + setPredicate((p3) => ({ + ...p3, + colsOrder: uniq([ + ...p3.colsOrder, + ...cols.filter((f4) => f4.hidden != "true").map((c4) => c4.name + c4.table) + ]) + })); + }, [cols]); + const parsePredicate = (predicateStr) => { + const newPredicate = safelyParseJSON(predicateStr); + setPredicate(validatePredicate(newPredicate)); + }; + const delColumn = (column) => { + let mdbtable; + const table = column.table; + if (table == "") { + mdbtable = tableData; + } else if (contextTable[table]) { + mdbtable = contextTable[table]; + } + const newFields = mdbtable.cols.filter( + (f4, i4) => f4.name != column.name + ); + const newTable = { + ...mdbtable, + cols: newFields, + rows: mdbtable.rows.map((r3) => { + const { [column.name]: val, ...rest } = r3; + return rest; + }) + }; + if (table == "") { + saveDB2(newTable); + } else if (contextTable[table]) { + saveContextDB(newTable, table); } - if (closestId != null) { - const activeDroppable = droppableContainers.get(active.id); - const newDroppable = droppableContainers.get(closestId); - const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null; - const newNode = newDroppable == null ? void 0 : newDroppable.node.current; - if (newNode && newRect && activeDroppable && newDroppable) { - const newScrollAncestors = getScrollableAncestors(newNode); - const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element); - const hasSameContainer = isSameContainer(activeDroppable, newDroppable); - const isAfterActive = isAfter2(activeDroppable, newDroppable); - const offset = hasDifferentScrollAncestors || !hasSameContainer ? { - x: 0, - y: 0 - } : { - x: isAfterActive ? collisionRect.width - newRect.width : 0, - y: isAfterActive ? collisionRect.height - newRect.height : 0 - }; - const rectCoordinates = { - x: newRect.left, - y: newRect.top - }; - const newCoordinates = offset.x && offset.y ? rectCoordinates : subtract(rectCoordinates, offset); - return newCoordinates; - } + }; + const newColumn = (col) => { + return saveColumn(col); + }; + const saveColumn = (newColumn2, oldColumn) => { + let mdbtable; + const column = { + ...newColumn2, + name: sanitizeColumnName(newColumn2.name) + }; + const table = column.table; + if (table == "") { + mdbtable = tableData; + } else if (contextTable[table]) { + mdbtable = contextTable[table]; } - } - return void 0; -}; -function isSameContainer(a5, b4) { - if (!hasSortableData(a5) || !hasSortableData(b4)) { - return false; - } - return a5.data.current.sortable.containerId === b4.data.current.sortable.containerId; -} -function isAfter2(a5, b4) { - if (!hasSortableData(a5) || !hasSortableData(b4)) { - return false; - } - if (!isSameContainer(a5, b4)) { - return false; - } - return a5.data.current.sortable.index < b4.data.current.sortable.index; -} - -// src/components/ContextView/CardsView/CardsView.tsx -var import_classnames4 = __toESM(require_classnames()); - -// src/utils/ui/selection.ts -var selectNextIndex = (currIndex, array) => { - if (!currIndex && array.length > 0) - return array[0]; - const pos = array.indexOf(currIndex); - if (pos < array.length - 1) - return array[pos + 1]; - return currIndex; -}; -var selectPrevIndex = (currIndex, array) => { - const pos = array.indexOf(currIndex); - if (pos > 0) - return array[pos - 1]; - return array[0]; -}; -var selectRange = (currSel, newSel, array) => { - const lastIndex = array.findIndex((f4) => f4 == currSel); - const newIndex = array.findIndex((f4) => f4 == newSel); - if (lastIndex < newIndex) { - return array.filter((f4, i4) => i4 > lastIndex && i4 <= newIndex); - } - return array.filter((f4, i4) => i4 < lastIndex && i4 >= newIndex); + if (column.name == "") { + new import_obsidian7.Notice(i18n_default.notice.noPropertyName); + return false; + } + if (!oldColumn && mdbtable.cols.find( + (f4) => f4.name.toLowerCase() == column.name.toLowerCase() + ) || oldColumn && oldColumn.name != column.name && mdbtable.cols.find( + (f4) => f4.name.toLowerCase() == column.name.toLowerCase() + )) { + new import_obsidian7.Notice(i18n_default.notice.duplicatePropertyName); + return false; + } + const oldFieldIndex = oldColumn ? mdbtable.cols.findIndex((f4) => f4.name == oldColumn.name) : -1; + const newFields = oldFieldIndex == -1 ? [...mdbtable.cols, column] : mdbtable.cols.map((f4, i4) => i4 == oldFieldIndex ? column : f4); + const newTable = { + ...mdbtable, + cols: newFields, + rows: mdbtable.rows.map( + (f4) => oldColumn ? { + ...f4, + [column.name]: f4[oldColumn.name], + oldColumn: void 0 + } : f4 + ) + }; + if (oldColumn) + savePredicate({ + filters: predicate.filters.map( + (f4) => f4.field == oldColumn.name + oldColumn.table ? { ...f4, field: column.name + column.table } : f4 + ), + sort: predicate.sort.map( + (f4) => f4.field == oldColumn.name + oldColumn.table ? { ...f4, field: column.name + column.table } : f4 + ), + groupBy: predicate.groupBy.map( + (f4) => f4 == oldColumn.name + oldColumn.table ? column.name + column.table : f4 + ), + colsHidden: predicate.colsHidden.map( + (f4) => f4 == oldColumn.name + oldColumn.table ? column.name + column.table : f4 + ), + colsOrder: predicate.colsOrder.map( + (f4) => f4 == oldColumn.name + oldColumn.table ? column.name + column.table : f4 + ), + colsSize: { + ...predicate.colsSize, + [column.name + column.table]: predicate.colsSize[oldColumn.name + oldColumn.table], + [oldColumn.name + oldColumn.table]: void 0 + } + }); + if (table == "") { + syncAllMetadata(newTable); + } else if (contextTable[table]) { + saveContextDB(newTable, table); + } + return true; + }; + return /* @__PURE__ */ Cn.createElement(MDBContext.Provider, { + value: { + def, + readMode, + contextInfo, + data, + filteredData, + loadContextFields, + selectedRows, + selectRows, + tableData, + cols, + sortedColumns, + contextTable, + setContextTable, + predicate, + savePredicate, + saveDB: saveDB2, + saveContextDB, + schema, + saveColumn, + hideColumn, + sortColumn, + delColumn, + newColumn, + tagContexts, + tables, + setSchema, + saveSchema, + deleteSchema, + dbFileExists, + dbSchema, + searchString, + setSearchString, + setDBSchema, + updateValue: updateValue2, + updateFieldValue + } + }, props2.children); }; -// src/components/ui/menus/selectMenu/concerns/matchers.js -function escapeForRegExp(string) { - return string.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); -} -function matchAny(string) { - return new RegExp(escapeForRegExp(string), "gi"); -} -function matchExact(string) { - return new RegExp(`^${escapeForRegExp(string)}$`, "i"); -} - -// src/components/ContextView/MDBContext.tsx -var import_lodash2 = __toESM(require_lodash()); -var import_obsidian12 = require("obsidian"); - -// src/types/context.ts -var FilePropertyName = "File"; +// src/components/ui/menus/menuItems.tsx +var import_obsidian8 = require("obsidian"); -// src/utils/contexts/parsers.ts -var parsePropString = (str) => { - var _a2; - const [p1, p22] = (_a2 = str == null ? void 0 : str.match(/(\\.|[^.])+/g)) != null ? _a2 : []; - if (p22) - return { - field: p1, - property: p22 - }; - return { field: "File", property: p1 }; -}; +// src/components/ui/menus/selectMenu/SelectMenuComponent.tsx +var import_lodash3 = __toESM(require_lodash()); -// src/schemas/mdb.ts -var fieldTypeForType = (type) => fieldTypes.find((t4) => type == t4.type) || fieldTypes.find((t4) => type == t4.multiType); -var fieldTypes = [ - { - type: "unknown", - label: "", - restricted: true - }, - { - type: "preview", - label: i18n_default.properties.preview.label, - restricted: true - }, - { - type: "text", - label: i18n_default.properties.text.label, - metadata: true, - icon: "mk-make-h3" - }, - { - type: "number", - label: i18n_default.properties.number.label, - metadata: true, - icon: "mk-make-tag" - }, - { - type: "boolean", - label: i18n_default.properties.boolean.label, - metadata: true, - icon: "mk-make-todo" - }, - { - type: "date", - label: i18n_default.properties.date.label, - metadata: true, - icon: "mk-make-date" - }, - { - type: "option", - label: i18n_default.properties.option.label, - multi: true, - multiType: "option-multi", - icon: "mk-make-list" - }, - { - type: "file", - label: i18n_default.properties.file.label, - restricted: true, - icon: "mk-make-h3" - }, - { - type: "fileprop", - label: i18n_default.properties.fileProperty.label - }, - { - type: "link", - label: i18n_default.properties.link.label, - multi: true, - multiType: "link-multi", - metadata: true, - icon: "mk-make-note" - }, - { - type: "context", - label: i18n_default.properties.context.label, - multi: true, - multiType: "context-multi", - icon: "mk-make-note" - }, - { - type: "object", - label: i18n_default.properties.context.label, - restricted: true, - metadata: true - }, - { - type: "image", - label: i18n_default.properties.image.label, - multi: true, - multiType: "image-multi", - metadata: true, - icon: "mk-make-image" - } -]; -var defaultValueForPropertyType = (name, value, type) => { - if (type == "preview") { - return "https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"; - } - if (type == "fileprop") { - const { field, property } = parsePropString(value); - if (property == "ctime" || property == "mtime") - return (Date.now() - 60).toString(); - return value; - } - if (type == "file") { - return "Note Name"; - } - if (type == "date") { - return "2020-04-21"; - } - if (type == "number") { - return "123"; - } - if (type == "boolean") { - return "true"; - } - if (type == "link") { - return "[[Select Note]]"; - } - if (type == "option") { - return "one, two"; - } - if (type == "text") { - return name; - } - if (type == "image") { - return "https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"; - } - return ""; -}; -var defaultFileDBSchema = { - id: "files", - name: "Files", - type: "db", - primary: "true" -}; -var defaultFileListSchema = { - id: "filesView", - name: "Files", - type: "list", - def: "files" -}; -var defaultFileTableSchema = { - id: "filesView", - name: "Files", - type: "table", - def: "files" -}; -var defaultFolderSchema = { - uniques: [], - cols: ["id", "name", "type", "def", "predicate", "primary"], - rows: [defaultFileDBSchema, defaultFileListSchema] -}; -var defaultTagSchema = { - uniques: [], - cols: ["id", "name", "type", "def", "predicate", "primary"], - rows: [defaultFileDBSchema, defaultFileTableSchema] -}; -var fieldSchema = { - uniques: ["name,schemaId"], - cols: [ - "name", - "schemaId", - "type", - "value", - "attrs", - "hidden", - "unique", - "primary" - ] -}; -var defaultFolderFields = { - ...fieldSchema, - rows: [ - { - name: i18n_default.properties.preview.label, - schemaId: "files", - type: "preview", - hidden: "", - unique: "", - attrs: "", - value: "", - primary: "" - }, - { - name: FilePropertyName, - schemaId: "files", - type: "file", - primary: "true", - hidden: "", - unique: "", - attrs: "", - value: "" - }, - { - name: i18n_default.properties.fileProperty.createdTime, - schemaId: "files", - type: "fileprop", - value: "File.ctime", - hidden: "", - unique: "", - attrs: "", - primary: "" - } - ] -}; -var defaultFieldsForContext = (context) => { - if (context.type == "tag") { - return defaultTagFields; - } else if (context.type == "folder") { - return defaultFolderFields; - } - return defaultFolderFields; +// src/components/ui/menus/selectMenu/SelectMenuInput.tsx +var SIZER_STYLES = { + position: "absolute", + width: 0, + height: 0, + visibility: "hidden", + overflow: "scroll", + whiteSpace: "pre" }; -var defaultTableFields = [ - { - name: i18n_default.properties.defaultField, - schemaId: "", - type: "text" - } +var STYLE_PROPS = [ + "fontSize", + "fontFamily", + "fontWeight", + "fontStyle", + "letterSpacing", + "textTransform" ]; -var defaultTagFields = { - ...fieldSchema, - rows: [ - { - name: FilePropertyName, - schemaId: "files", - type: "file", - primary: "true", - hidden: "", - unique: "", - attrs: "", - value: "" - } - ] -}; -var defaultMDBTableForContext = (context) => { - if (context.type == "tag") { - return defaultTagMDBTable; - } else if (context.type == "folder") { - return defaultFolderMDBTable; - } - return defaultFolderMDBTable; -}; -var defaultFolderMDBTable = { - schema: defaultFileDBSchema, - cols: defaultFolderFields.rows, - rows: [] -}; -var defaultQueryMDBTable = { - schema: defaultFileDBSchema, - cols: defaultFolderFields.rows, - rows: [] -}; -var defaultTagMDBTable = { - schema: defaultFileDBSchema, - cols: defaultTagFields.rows, - rows: [] -}; -var fieldsToTable = (fields, schemas) => { - return fields.filter((s5) => schemas.find((g4) => g4.id == s5.schemaId && g4.type == "db")).reduce((p3, c4) => { - return { - ...p3, - ...p3[c4.schemaId] ? { - [c4.schemaId]: { - uniques: c4.unique == "true" ? [...p3[c4.schemaId].uniques, c4.name] : p3[c4.schemaId].uniques, - cols: [...p3[c4.schemaId].cols, c4.name], - rows: [] - } - } : { - [c4.schemaId]: { - uniques: c4.unique == "true" ? [c4.name] : [], - cols: [c4.name], - rows: [] - } +var SelectMenuInput = k3( + (props2, input) => { + const { classNames: classNames9, inputAttributes, inputEventHandlers, index } = props2; + const sizer = _2(null); + const [inputWidth, setInputWidth] = h2(null); + const [query, setQuery] = h2(""); + const [placeholderText, setPlaceholderText] = h2(""); + p2(() => { + copyInputStyles(); + updateInputWidth(); + setTimeout(() => { + input.current.focus(); + }, 50); + }, []); + p2(() => { + if (query !== props2.query || placeholderText !== props2.placeholderText) { + setQuery(props2.query); + setPlaceholderText(props2.placeholderText); + updateInputWidth(); } + }, [props2.query, props2.placeholderText]); + const copyInputStyles = () => { + const inputStyle = window.getComputedStyle(input.current); + STYLE_PROPS.forEach((prop) => { + sizer.current.style[prop] = inputStyle[prop]; + }); }; - }, {}); -}; -var defaultTablesForContext = (context) => { - if (context.type == "tag") { - return defaultTagTables; - } else if (context.type == "folder") { - return defaultFolderTables; + const updateInputWidth = () => { + let _inputWidth; + _inputWidth = Math.ceil(sizer.current.scrollWidth) + 2; + if (_inputWidth !== inputWidth) { + setInputWidth(_inputWidth); + } + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: classNames9.searchWrapper + }, /* @__PURE__ */ Cn.createElement("input", { + ...inputAttributes, + ...inputEventHandlers, + ref: input, + value: query, + placeholder: placeholderText, + className: classNames9.searchInput, + role: "combobox", + style: { width: "100%" } + }), /* @__PURE__ */ Cn.createElement("div", { + ref: sizer, + style: SIZER_STYLES + }, query || placeholderText)); } - return defaultFolderTables; -}; -var defaultFolderTables = { - m_schema: defaultFolderSchema, - m_fields: defaultFolderFields, - ...fieldsToTable( - defaultFolderFields.rows, - defaultFolderSchema.rows - ) -}; -var defaultTagTables = { - m_schema: defaultTagSchema, - m_fields: defaultTagFields, - ...fieldsToTable( - defaultTagFields.rows, - defaultTagSchema.rows - ) -}; +); +var SelectMenuInput_default = SelectMenuInput; -// src/utils/sanitize.ts -var sanitizeTableName = (name) => { - return name == null ? void 0 : name.replace(/[^a-z0-9+]+/gi, ""); -}; -var sanitizeColumnName = (name) => { - if ((name == null ? void 0 : name.charAt(0)) == "_") { - return sanitizeColumnName(name.substring(1)); - } - return name == null ? void 0 : name.replace(/"/g, ``); -}; -var sanitizeSQLStatement = (name) => { - return name == null ? void 0 : name.replace(/'/g, `''`); +// src/components/ui/menus/selectMenu/SelectMenuPill.tsx +var SelectMenuPillComponent = (props2) => { + return /* @__PURE__ */ Cn.createElement("button", { + type: "button", + className: props2.classNames.selectedTag, + onClick: props2.onDelete + }, /* @__PURE__ */ Cn.createElement("span", { + className: props2.classNames.selectedTagName + }, props2.tag.name)); }; +var SelectMenuPill_default = SelectMenuPillComponent; -// src/utils/tree.ts -var import_obsidian8 = require("obsidian"); -var nodeIsAncestorOfTarget = (node, target) => { - var _a2; - if (!node.item || !node.item.isFolder) - return false; - return (_a2 = target.item) == null ? void 0 : _a2.path.contains(node.item.path + "/"); -}; -var excludeVaultItemPredicate = (settings) => (f4, index, folder) => !(f4.folder != "true" && settings.hiddenExtensions.find( - (e4) => fileExtensionForFile(f4.path) == e4 -)) && !settings.hiddenFiles.find((e4) => e4 == f4.path) && (!settings.enableFolderNote || !settings.folderNoteInsideFolder && !folder.some((g4) => g4.path + ".md" == f4.path) || settings.folderNoteInsideFolder && !(f4.parent + "/" + folderPathToString(f4.parent) + ".md" == f4.path)); -var excludeFilePredicate = (plugin) => (f4, index, folder) => !(f4 instanceof import_obsidian8.TFile && plugin.settings.hiddenExtensions.find((e4) => f4.extension == e4)) && !plugin.settings.hiddenFiles.find((e4) => e4 == f4.path) && (!plugin.settings.enableFolderNote || !plugin.settings.folderNoteInsideFolder && !folder.some((g4) => g4.path + ".md" == f4.path) || plugin.settings.folderNoteInsideFolder && !(f4.parent.path + "/" + f4.parent.name + ".md" == f4.path)); -var folderChildren = (plugin, f4, exclusionList) => { - var _a2, _b2; - return (_b2 = (_a2 = f4 == null ? void 0 : f4.children) == null ? void 0 : _a2.filter(excludeFilePredicate(plugin))) != null ? _b2 : []; -}; -var compareByField = (field, dir) => (_a2, _b2) => { - const a5 = dir ? _a2 : _b2; - const b4 = dir ? _b2 : _a2; - if (a5[field] < b4[field]) { - return -1; - } - if (a5[field] > b4[field]) { - return 1; - } - return 0; -}; -var compareByFieldCaseInsensitive = (field, dir) => (_a2, _b2) => { - const a5 = dir ? _a2 : _b2; - const b4 = dir ? _b2 : _a2; - if (a5[field].toLowerCase() < b4[field].toLowerCase()) { - return -1; - } - if (a5[field].toLowerCase() > b4[field].toLowerCase()) { - return 1; - } - return 0; +// src/components/ui/menus/selectMenu/SelectMenuSuggestions.tsx +function markIt(name, query) { + const regexp = matchAny(query); + return name.replace(regexp, "$&"); +} +var SelectMenuSuggestionsComponent = (props2) => { + const ref = _2(null); + p2(() => { + var _a2; + if (props2.active) { + (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.scrollIntoViewIfNeeded(); + } + }, [props2.active]); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-options-menu-inner" + }, props2.item.onToggle && /* @__PURE__ */ Cn.createElement("div", null, "Toggle"), /* @__PURE__ */ Cn.createElement("span", { + ref, + dangerouslySetInnerHTML: { + __html: markIt(props2.item.name, props2.query) + } + }), props2.item.description && /* @__PURE__ */ Cn.createElement("span", { + className: "mk-description", + ref, + dangerouslySetInnerHTML: { + __html: markIt(props2.item.description, props2.query) + } + })), props2.item.removeable && /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + e4.stopPropagation(); + e4.preventDefault(); + props2.onDeleteOption(props2.item.value); + }, + className: "mk-icon-small", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })); }; -var internalPluginLoaded = (pluginName, app2) => { - var _a2; - return (_a2 = app2.internalPlugins.plugins[pluginName]) == null ? void 0 : _a2._loaded; +var SelectMenuSuggestions = (props2) => { + const timer = _2(null); + const mouseOver = (e4, index) => { + if (!props2.hoverSelect) { + return; + } + timer.current && clearTimeout(timer.current); + timer.current = setTimeout(() => props2.setIndex(index), 300); + }; + const options = props2.options.map((item, index) => { + const key2 = `${props2.id}-${index}`; + const classNames9 = []; + if (props2.index === index) { + classNames9.push(props2.classNames.suggestionActive); + } + if (item.disabled) { + classNames9.push(props2.classNames.suggestionDisabled); + } + return /* @__PURE__ */ Cn.createElement("li", { + id: key2, + key: key2, + role: "option", + className: classNames9.join(" "), + "aria-disabled": Boolean(item.disabled), + onMouseDown: (e4) => e4.preventDefault(), + onClick: () => props2.addTag(item), + onMouseOver: (e4) => mouseOver(e4, index), + onMouseOut: (e4) => props2.hoverSelect && clearTimeout(timer.current) + }, /* @__PURE__ */ Cn.createElement(SelectMenuSuggestionsComponent, { + item, + query: props2.query, + active: index == props2.index, + onDeleteOption: props2.deleteOption + })); + }); + return /* @__PURE__ */ Cn.createElement("div", { + className: props2.classNames.suggestions + }, /* @__PURE__ */ Cn.createElement("ul", { + role: "listbox", + id: props2.id + }, options, props2.query && props2.allowNew && /* @__PURE__ */ Cn.createElement("li", { + onMouseDown: (e4) => e4.preventDefault(), + onClick: () => props2.addTag({ name: props2.query, value: props2.query }) + }, "Add ", props2.query))); }; -function selectElementContents(el) { - if (!el) - return; - var range = document.createRange(); - range.selectNodeContents(el); - var sel = window.getSelection(); - sel.removeAllRanges(); - sel.addRange(range); -} +var SelectMenuSuggestions_default = SelectMenuSuggestions; -// src/utils/db/db.ts -var import_obsidian9 = require("obsidian"); -var getDBFile = async (path, isRemote) => { - if (isRemote) { - return fetch(path).then((res) => res.arrayBuffer()); - } - if (!await app.vault.adapter.exists((0, import_obsidian9.normalizePath)(path))) { - return null; - } - const file = await app.vault.adapter.readBinary( - (0, import_obsidian9.normalizePath)(path) +// src/components/ui/menus/selectMenu/concerns/focusNextElement.js +function focusNextElement(scope, currentTarget) { + const interactiveEls = scope.querySelectorAll("a,button,input"); + const currentEl = Array.prototype.findIndex.call( + interactiveEls, + (element) => element === currentTarget ); - return file; -}; -var getDB = async (sqlJS, path, isRemote) => { - const buf = await getDBFile(path, isRemote); - if (buf) { - return new sqlJS.Database(new Uint8Array(buf)); + const nextEl = interactiveEls[currentEl - 1] || interactiveEls[currentEl + 1]; + if (nextEl) { + nextEl.focus(); } - return new sqlJS.Database(); -}; -var saveDBFile = async (path, binary) => { - const file = app.vault.adapter.writeBinary( - (0, import_obsidian9.normalizePath)(path), - binary - ); - return file; -}; -var dbResultsToDBTables = (res) => { - return res.reduce( - (p3, c4, i4) => [ - ...p3, - { - cols: c4.columns, - rows: c4 ? c4.values.map( - (r3) => c4.columns.reduce( - (prev, curr, index) => ({ ...prev, [curr]: r3[index] }), - {} - ) - ) : [] - } - ], - [] - ); +} + +// src/components/ui/menus/selectMenu/SelectMenuComponent.tsx +var KEYS = { + ENTER: "Enter", + TAB: "Tab", + BACKSPACE: "Backspace", + UP_ARROW: "ArrowUp", + UP_ARROW_COMPAT: "Up", + DOWN_ARROW: "ArrowDown", + DOWN_ARROW_COMPAT: "Down" }; -var selectDB = (db, table, condition, fields) => { - const fieldsStr = fields != null ? fields : "*"; - const sqlstr = condition ? `SELECT ${fieldsStr} FROM "${table}" WHERE ${condition};` : `SELECT ${fieldsStr} FROM ${table};`; - let tables; - try { - tables = dbResultsToDBTables(db.exec(sqlstr)); - } catch (e4) { - return null; - } - if (tables.length == 1) - return tables[0]; - return null; +var CLASS_NAMES = { + root: "mk-options-menu", + rootFocused: "is-focused", + selected: "mk-options-menu__selected", + selectedTag: "mk-options-menu__selected-tag", + selectedTagName: "mk-options-menu__selected-tag-name", + search: "mk-options-menu__search", + searchWrapper: "mk-options-menu__search-wrapper", + searchInput: "mk-options-menu__search-input", + suggestions: "mk-options-menu__suggestions", + suggestionActive: "is-active", + suggestionDisabled: "is-disabled" }; -var deleteFromDB = (db, table, condition) => { - const sqlstr = `DELETE FROM "${table}" WHERE ${condition};`; - try { - db.exec(sqlstr); - } catch (e4) { - console.log(e4); - } +var defaultProps = { + id: "SelectMenu", + tags: [], + suggestionsOnly: false, + placeholderText: i18n_default.labels.optionItemSelectPlaceholder, + noSuggestionsText: null, + newTagText: null, + suggestions: [], + suggestionsFilter: defaultSuggestionsFilter, + suggestionsTransform: null, + classNames: CLASS_NAMES, + delimiters: [KEYS.ENTER], + minQueryLength: 2, + maxSuggestionsLength: 8, + inputAttributes: {}, + hoverSelect: false }; -var dropTable = (db, table) => { - const sqlstr = `DROP TABLE IF EXISTS "${table}";`; - try { - db.exec(sqlstr); - } catch (e4) { - console.log(e4); - } +var findMatchIndex = (options, query) => { + return options.findIndex((option) => matchExact(query).test(option.name)); }; -var replaceDB = (db, tables) => { - const sqlstr = serializeSQLStatements(Object.keys(tables).map((t4) => { - const tableFields = tables[t4].cols; - const fieldQuery = serializeSQLFieldNames(uniq(tableFields).map((f4) => `'${sanitizeSQLStatement(f4)}' char`)); - const rowsQuery = tables[t4].rows.reduce((prev, curr) => { - return `${prev} REPLACE INTO "${t4}" VALUES (${serializeSQLValues(tableFields.map((c4) => { - var _a2; - return `'${(_a2 = sanitizeSQLStatement(curr == null ? void 0 : curr[c4])) != null ? _a2 : ""}'`; - }))});`; - }, ""); - const idxQuery = tables[t4].uniques.filter((f4) => f4).reduce((p3, c4) => { - return `${p3} CREATE UNIQUE INDEX IF NOT EXISTS idx_${t4}_${c4.replace( - /,/g, - "_" - )} ON ${t4}(${c4});`; - }, ""); - const insertQuery = `CREATE TABLE IF NOT EXISTS "${t4}" (${fieldQuery}); ${idxQuery} BEGIN TRANSACTION; ${rowsQuery} COMMIT;`; - return `DROP INDEX IF EXISTS idx_${t4}__id; DROP TABLE IF EXISTS "${t4}"; ${fieldQuery.length > 0 ? insertQuery : ""}`; - })); - try { - db.exec(sqlstr); - } catch (e4) { - console.log(e4); +var pressDelimiter = (props2, query, index, options, addTag2) => { + if (query.length >= props2.minQueryLength) { + const match2 = findMatchIndex(options, query); + const _index = index === -1 ? match2 : index; + const tag = _index > -1 ? options[_index] : null; + if (tag) { + addTag2(tag); + } else { + addTag2({ name: query, value: query }); + } } }; -var saveDBToPath = async (plugin, path, tables) => { - const sqlJS = await plugin.sqlJS(); - let db = await getDB(sqlJS, path); - if (!db) { - db.close(); - return false; +function defaultSuggestionsFilter(item, query) { + const regexp = matchAny(query); + return regexp.test(item.name); +} +function getOptions(props2, query) { + let options; + if (props2.suggestionsTransform) { + options = props2.suggestionsTransform(query, props2.suggestions); + } else { + options = props2.suggestions.filter( + (item) => props2.suggestionsFilter(item, query) + ); } - replaceDB(db, tables); - await saveDBFile(path, db.export().buffer); - db.close(); - return true; -}; - -// src/utils/metadata/tags.ts -var import_obsidian10 = require("obsidian"); -var tagKeys = ["tag", "tags", "Tag", "Tags"]; -var tagToTagPath = (tag) => { - if (!tag) - return null; - let string = tag; - if (string.charAt(0) != "#") - string = "#" + string; - return string.replace(/\//g, "+"); -}; -var tagPathToTag = (string) => { - return filePathToString(string).replace(/\+/g, "/"); -}; -var loadTags = (plugin) => { - var _a2; - const folder = plugin.settings.tagContextFolder == "" ? app.vault.getRoot() : getAbstractFileAtPath( - app, - getFolderPathFromString(plugin.settings.tagContextFolder) - ); - return uniq([ - ...Object.keys(app.metadataCache.getTags()), - ...(_a2 = folder == null ? void 0 : folder.children.filter( - (f4) => f4 instanceof import_obsidian10.TFile && f4.extension == "mdb" && f4.name.charAt(0) == "#" - ).map((f4) => tagPathToTag(f4.name))) != null ? _a2 : [] - ]); -}; -var tagExists = (currentCache, findTag) => { - let currentTags = []; - if ((0, import_obsidian10.getAllTags)(currentCache)) { - currentTags = (0, import_obsidian10.getAllTags)(currentCache); + options = options.slice(0, props2.maxSuggestionsLength); + if (props2.newTagText && findMatchIndex(options, query) === -1) { + options.push({ id: 0, name: query, value: query }); + } else if (props2.noSuggestionsText && options.length === 0) { + options.push({ + id: 0, + name: props2.noSuggestionsText, + value: "", + disabled: true + }); } - return currentTags.find((tag) => tag.toLowerCase() == findTag.toLowerCase()) ? true : false; -}; -var getAllFilesForTag = (tag) => { - let tagsCache = []; - (() => { - app.vault.getMarkdownFiles().forEach((tfile) => { - let currentCache; - if (app.metadataCache.getFileCache(tfile) !== null) { - currentCache = app.metadataCache.getFileCache(tfile); + return options; +} +var SelectMenuComponent = Cn.forwardRef( + (_props, ref) => { + const props2 = { ...defaultProps, ..._props }; + const [options, setOptions] = h2([]); + const inputRef = _2(null); + const [query, setQuery] = h2(""); + const [focused, setFocused] = h2(false); + const [index, setIndex] = h2(0); + const onComposition = _2(false); + p2(() => { + if (ref) { + ref.current = () => { + var _a2; + if (!focused) { + (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.focus(); + setFocused(true); + return false; + } + return true; + }; } - let relativePath = tfile.path; - const hasTag = tagExists(currentCache, tag); - if (hasTag) { - tagsCache.push(relativePath); + }, [focused]); + p2(() => { + var _a2; + if (index != -1 && props2.onHover && props2.hoverSelect) { + debounceFn((_a2 = options[index]) == null ? void 0 : _a2.value); } - }); - })(); - return tagsCache; -}; -var addTagToNote = (tag, tFile) => { - const newTag = validateName(tag); - editTagInFrontmatter("", newTag, tFile); -}; -var positionsForTag = (tag, file) => { - const currentCache = app.metadataCache.getFileCache(file); - if (currentCache.tags) { - const positions = currentCache.tags.filter((f4) => f4.tag == tag).map((f4) => f4.position).sort((a5, b4) => { - if (a5.start.offset < b4.start.offset) { - return -1; + }, [index, options]); + const debounceFn = T2( + (0, import_lodash3.debounce)(handleDebounceFn, 300, { + leading: false + }), + [] + ); + function handleDebounceFn(inputValue) { + props2.onHover(inputValue); + } + p2(() => { + if (query.length == 0 && props2.defaultSuggestions) { + setOptions(props2.defaultSuggestions); + return; + } + setOptions(getOptions(props2, query)); + }, [query, props2.suggestions]); + const container = _2(null); + const onInput = (e4) => { + if (e4.type === "compositionstart") { + onComposition.current = true; + return; + } + if (e4.type === "compositionend") { + onComposition.current = false; + } + if (onComposition.current) { + return; + } + const _query = e4.target.value; + if (props2.onInput) { + props2.onInput(_query); + } + if (_query.length === query.length + 1 && props2.delimiters.indexOf(query.slice(-1)) > -1) { + pressDelimiter(props2, query, index, options, addTag2); + } else if (_query !== query) { + setQuery(_query); + } + }; + const onKeyDown = (e4) => { + if (props2.delimiters.indexOf(e4.key) > -1) { + if (query || index > -1) { + e4.preventDefault(); + } + pressDelimiter(props2, query, index, options, addTag2); } - if (a5.start.offset > b4.start.offset) { - return 1; + if (e4.key === KEYS.BACKSPACE) { + pressBackspaceKey(); } - return 0; - }); - return positions; - } - return []; -}; -var removeTagFromFile = (tag, file) => { - const pos = positionsForTag(tag, file); - removeTagInFrontmatter(tag, file); - editTagInFileBody(tag, "", pos, file); -}; -var validateName = (tag) => { - return tag; -}; -var deleteTag = async (plugin, tag, subTags) => { - const files = getAllFilesForTag(tag).map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4 instanceof import_obsidian10.TFile); - files.forEach((file) => removeTagFromFile(tag, file)); - deleteTagContext(plugin, tag); - if (subTags) { - const tags = getAllSubtags(plugin, tag); - tags.forEach((tag2) => deleteTag(plugin, tag2, subTags)); - } -}; -var tagsFromDefString = (defStr) => parseContextDefString(defStr).filter((f4) => f4.type == "tag" && f4.value.length > 0).map((f4) => f4.value); -var updateTagsForDefString = (defStr, tags) => JSON.stringify([...parseContextDefString(defStr).filter((f4) => f4.type != "tag"), ...tags.map((f4) => ({ type: "tag", value: f4 }))]); -var addTag = async (plugin, tag) => { - const context = tagContextFromTag(plugin, tag); - await createDefaultDB(plugin, context); -}; -var renameTag = async (plugin, tag, toTag) => { - const tags = getAllSubtags(plugin, tag); - const newTag = validateName(toTag); - const files = getAllFilesForTag(tag); - for (const file of files) { - const tFile = getAbstractFileAtPath(app, file); - if (tFile instanceof import_obsidian10.TFile) { - const positions = positionsForTag(tag, tFile); - if (positions.length > 0) { - await editTagInFileBody(tag, newTag, positions, tFile); - } else { - await editTagInFrontmatter(tag, newTag, tFile); + if (e4.key === KEYS.UP_ARROW || e4.key === KEYS.UP_ARROW_COMPAT) { + pressUpKey(e4); } - } - } - await renameTagContextFile(plugin, tag, toTag); - for (const subtag of tags) { - await renameTag(plugin, subtag, subtag.replace(tag, newTag)); - } -}; -var getAllSubtags = (plugin, tag) => { - const tags = loadTags(plugin); - return tags.filter((f4) => f4.startsWith(tag) && f4 != tag); -}; -var removeTagInFrontmatter = async (oldTag, file) => { - var _a2; - let fm; - if (app.metadataCache.getFileCache(file) !== null) { - fm = (_a2 = app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; - } - if (fm && app.fileManager.processFrontMatter) { - const processKey = (value) => { - if (Array.isArray(value)) { - return value.filter((f4) => stringFromTag(oldTag) != f4); - } else if (typeof value === "string") { - return serializeMultiDisplayString( - value.replace(/\s/g, "").split(",").filter((f4) => stringFromTag(oldTag) != f4) - ); + if (e4.key === KEYS.DOWN_ARROW || e4.key === KEYS.DOWN_ARROW_COMPAT) { + pressDownKey(e4); } - return value; }; - const editKeys = tagKeys.filter((f4) => { - let tags = []; - if (Array.isArray(fm[f4])) { - tags = fm[f4]; - } else if (typeof fm[f4] === "string") { - tags = fm[f4].replace(/\s/g, "").split(","); + const onBlur = () => { + setFocused(false); + if (props2.onBlur) { + props2.onBlur(); } - if (tags.find((g4) => g4 == stringFromTag(oldTag))) - return true; - return false; - }); - editKeys.forEach((tag) => { - app.fileManager.processFrontMatter(file, (frontmatter) => { - frontmatter[tag] = processKey(fm[tag]); - }); - }); - } -}; -var editTagInFrontmatter = async (oldTag, newTag, file) => { - var _a2; - let fm; - if (app.metadataCache.getFileCache(file) !== null) { - fm = (_a2 = app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; - } - const addTag2 = (value) => { - if (Array.isArray(value)) { - return uniq([...value, stringFromTag(newTag)]).filter((f4) => (f4 == null ? void 0 : f4.length) > 0); - } else if (typeof value === "string") { - return serializeMultiDisplayString(uniq([ - ...value.replace(/\s/g, "").split(","), - stringFromTag(newTag) - ]).filter((f4) => (f4 == null ? void 0 : f4.length) > 0)); - } - return stringFromTag(newTag); - }; - if (app.fileManager.processFrontMatter) { - if (fm) { - const processKey = (value) => { - if (Array.isArray(value)) { - return uniq( - value.map( - (f4) => stringFromTag(oldTag) == f4 ? stringFromTag(newTag) : f4 - ) - ); - } else if (typeof value === "string") { - return serializeMultiDisplayString(uniq( - value.replace(/\s/g, "").split(",").map( - (f4) => stringFromTag(oldTag) == f4 ? stringFromTag(newTag) : f4 - ) - )); - } - return value; - }; - const editKeys = tagKeys.filter((f4) => { - let tags = []; - if (Array.isArray(fm[f4])) { - tags = fm[f4]; - } else if (typeof fm[f4] === "string") { - tags = fm[f4].replace(/\s/g, "").split(","); - } - if (tags.find((g4) => g4 == stringFromTag(oldTag))) - return true; - return false; - }); - if (editKeys.length > 0) { - editKeys.forEach((key2) => { - app.fileManager.processFrontMatter(file, (frontmatter) => { - frontmatter[key2] = processKey(fm[key2]); - }); - }); - } else { - app.fileManager.processFrontMatter(file, (frontmatter) => { - frontmatter["tag"] = addTag2(fm["tag"]); - }); + }; + const onFocus = () => { + setFocused(true); + if (props2.onFocus) { + props2.onFocus(); + } + }; + const onDeleteTag = (index2, event) => { + if (container.current) { + focusNextElement(container.current, event.currentTarget); + } + deleteTag2(index2); + }; + const addTag2 = (tag) => { + if (tag.disabled) { + return; + } + if (props2.onValidate && !props2.onValidate(tag)) { + return; + } + props2.onAddition(tag); + clearInput(); + }; + const deleteTag2 = (i4) => { + props2.onDelete(i4); + }; + const clearInput = () => { + setQuery(""); + setIndex(-1); + }; + const clearSelectedIndex = () => { + setIndex(-1); + }; + const pressUpKey = (e4) => { + e4.preventDefault(); + const size = options.length - 1; + setIndex(index <= 0 ? size : index - 1); + }; + const pressDownKey = (e4) => { + e4.preventDefault(); + const size = options.length - 1; + setIndex((i4) => i4 >= size ? 0 : i4 + 1); + }; + function pressBackspaceKey() { + if (!query.length) { + deleteTag2(props2.tags.length - 1); } - } else { - app.fileManager.processFrontMatter(file, (frontmatter) => { - frontmatter["tag"] = stringFromTag(newTag); - }); - } - } -}; -var editTagInFileBody = async (oldTag, newTag, positions, file) => { - const offsetOffset = newTag.length - oldTag.length; - if (positions.length == 0) - return false; - const original = await app.vault.read(file); - let text2 = original; - let offset = 0; - for (const { start, end } of positions) { - let startOff = start.offset + offset; - let endOff = end.offset + offset; - if (text2.slice(startOff, endOff) !== oldTag) { - return false; } - text2 = text2.slice(0, startOff) + newTag + text2.slice(startOff + oldTag.length); - offset += offsetOffset; - } - if (text2 !== original) { - await app.vault.modify(file, text2); - return true; + const focusInput = () => { + inputRef.current.focus(); + }; + const inputEventHandlers = { + onChange: onInput, + onBlur, + onFocus, + onInput: () => { + }, + onKeyDown, + onCompositionEnd: onInput, + onCompositionStart: onInput + }; + const expanded = focused && query.length >= props2.minQueryLength; + const classNames9 = Object.assign({}, CLASS_NAMES, props2.classNames); + const rootClassNames = [classNames9.root]; + focused && rootClassNames.push(classNames9.rootFocused); + return /* @__PURE__ */ Cn.createElement("div", { + ref: container, + className: rootClassNames.join(" ") + }, !props2.suggestionsOnly ? /* @__PURE__ */ Cn.createElement("div", { + className: classNames9.selected, + "aria-relevant": "additions removals", + "aria-live": "polite" + }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.tags.map((tag, i4) => /* @__PURE__ */ Cn.createElement(SelectMenuPill_default, { + key: i4, + tag, + classNames: classNames9, + onDelete: (e4) => onDeleteTag(i4, e4) + }))), /* @__PURE__ */ Cn.createElement("div", { + className: classNames9.search + }, /* @__PURE__ */ Cn.createElement(SelectMenuInput_default, { + ref: inputRef, + query, + index, + id: props2.id, + classNames: classNames9, + inputAttributes: props2.inputAttributes, + inputEventHandlers, + expanded, + placeholderText: props2.placeholderText + }))) : null, options.length || props2.allowNew ? /* @__PURE__ */ Cn.createElement(SelectMenuSuggestions_default, { + options, + hoverSelect: props2.hoverSelect, + query, + setIndex, + index, + id: props2.id, + classNames: classNames9, + expanded, + addTag: addTag2, + allowNew: props2.allowNew, + deleteOption: props2.onDeleteOption + }) : null, props2.previewComponent); } -}; -var allTagsForFile = (file) => { - var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j; - let rt = []; - if (file instanceof import_obsidian10.TFile) { - const fCache = app.metadataCache.getCache(file.path); - if (fCache && fCache.tags) - rt.push(...(_b2 = (_a2 = fCache.tags) == null ? void 0 : _a2.map((f4) => f4.tag)) != null ? _b2 : []); - if (fCache && ((_c2 = fCache.frontmatter) == null ? void 0 : _c2.tags)) - rt.push( - ...(typeof ((_d2 = fCache.frontmatter) == null ? void 0 : _d2.tags) === "string" ? parseMultiString(fCache.frontmatter.tags.replace(/ /g, "")) : Array.isArray((_e2 = fCache.frontmatter) == null ? void 0 : _e2.tags) ? (_f = fCache.frontmatter) == null ? void 0 : _f.tags : []).filter((f4) => typeof f4 === "string").map((f4) => "#" + f4) - ); - if (fCache && ((_g = fCache.frontmatter) == null ? void 0 : _g.tag)) - rt.push( - ...(typeof ((_h = fCache.frontmatter) == null ? void 0 : _h.tag) === "string" ? parseMultiString(fCache.frontmatter.tag.replace(/ /g, "")) : Array.isArray((_i = fCache.frontmatter) == null ? void 0 : _i.tag) ? (_j = fCache.frontmatter) == null ? void 0 : _j.tag : []).filter((f4) => typeof f4 === "string").map((f4) => "#" + f4) +); +SelectMenuComponent.displayName = "SelectMenuComponent"; +var SelectMenuComponent_default = SelectMenuComponent; + +// src/components/ui/menus/selectMenu.tsx +var SelectMenu = Cn.forwardRef( + (props2, ref) => { + var _a2; + const initialOptions = props2.options.map((o3, i4) => { + return { + ...o3, + id: i4 + 1 + }; + }); + p2(() => { + setSuggestions( + props2.options.map((o3, i4) => { + return { + ...o3, + id: i4 + 1 + }; + }) ); + }, [props2.options]); + const [suggestions, setSuggestions] = h2(initialOptions); + const [tags, setTags] = h2( + props2.value.map( + (v3) => { + var _a3; + return (_a3 = initialOptions.find((f4) => f4.value == v3)) != null ? _a3 : { + id: 0, + name: v3, + value: v3 + }; + } + ) + ); + const onDelete = T2( + (tagIndex) => { + const newTags = tags.filter((_9, i4) => i4 !== tagIndex); + setTags(newTags); + props2.saveOptions( + suggestions.map((f4) => f4.value), + newTags.map((f4) => f4.value) + ); + }, + [suggestions, tags, props2] + ); + const onDeleteOption = T2( + (removeTag) => { + const newSuggestions = suggestions.filter((f4) => f4.value != removeTag); + const newTags = tags.filter((f4) => f4.value != removeTag); + setSuggestions(newSuggestions); + setTags(newTags); + if (props2.removeOption) + props2.removeOption(removeTag); + props2.hide(); + }, + [tags, suggestions, props2] + ); + const onAddition = T2( + (newTag) => { + let tag = newTag; + let newSuggestions = suggestions; + let newTags = tags; + if (!suggestions.find((s5) => s5.value == newTag.value)) { + tag = { + id: suggestions.length + 1, + name: newTag.name, + value: newTag.name + }; + newSuggestions = [...suggestions, tag]; + setSuggestions(newSuggestions); + } + if (props2.multi) { + if (!tags.find((t4) => t4.value == tag.value)) { + newTags = [...tags, tag]; + setTags(newTags); + } + } else { + newTags = [tag]; + setTags(newTags); + } + props2.saveOptions( + newSuggestions.map((f4) => f4.value), + newTags.map((f4) => f4.value) + ); + if (!props2.multi) { + props2.hide(); + } + }, + [tags, suggestions] + ); + const onValidation = T2( + (newTag) => { + if (!props2.editable && !suggestions.find((s5) => s5.value == newTag.value)) { + return false; + } + if (newTag.name.length == 0) { + return false; + } + return true; + }, + [suggestions] + ); + return /* @__PURE__ */ Cn.createElement(SelectMenuComponent_default, { + tags: props2.multi ? tags : [], + suggestions, + ref, + onDelete, + onDeleteOption, + onAddition, + onValidate: onValidation, + defaultSuggestions: props2.defaultOptions, + placeholderText: (_a2 = props2.placeholder) != null ? _a2 : "", + minQueryLength: 0, + onHover: props2.onHover, + hoverSelect: props2.onHover ? true : false, + maxSuggestionsLength: props2.showAll ? Math.min(50, props2.options.length) : 8, + suggestionsOnly: !props2.searchable && !props2.editable, + allowNew: props2.editable, + previewComponent: props2.previewComponent + }); } - return uniq(rt); -}; +); +SelectMenu.displayName = "SelectMenu"; +var selectMenu_default = SelectMenu; -// src/utils/contexts/mdb.ts -var dbTableToMDBTable = (table, schema, fields) => { - var _a2; - return { - schema, - cols: fields, - rows: (_a2 = table == null ? void 0 : table.rows) != null ? _a2 : [] - }; -}; -var updateFieldsToSchema = (fields, context) => { - const defaultFields = defaultFieldsForContext(context); - return [ - ...fields, - ...defaultFields.rows.filter( - (f4) => !fields.some((g4) => g4.name == f4.name && g4.schemaId == f4.schemaId) - ) - ]; +// src/components/ui/menus/menuItems.tsx +var inputMenuItem = (menuItem, value, setValue) => { + const frag = document.createDocumentFragment(); + const spanEl = frag.createEl("span"); + const inputEl = frag.createEl("input"); + inputEl.type = "text"; + inputEl.value = value; + inputEl.addEventListener("click", (e4) => { + e4.stopImmediatePropagation(); + }); + inputEl.addEventListener("mousedown", (e4) => { + e4.stopImmediatePropagation(); + }); + inputEl.addEventListener("mouseup", (e4) => { + e4.stopImmediatePropagation(); + }); + inputEl.addEventListener("blur", (e4) => { + setValue(inputEl.value); + }); + menuItem.dom.toggleClass("mk-menu-input", true); + menuItem.setTitle(frag); + return menuItem; }; -var getMDBTable = async (plugin, context, table) => { - if (!context) - return null; - const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(context.dbPath, context.isRemote); - if (!buf) { - return null; - } - const db = new sqlJS.Database(new Uint8Array(buf)); - await sanitizeTableSchema(plugin, db, context); - let fieldsTables; - let schema; - try { - fieldsTables = dbResultsToDBTables( - db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table}'`) - ); - schema = dbResultsToDBTables( - db.exec(`SELECT * FROM m_schema WHERE id = '${table}'`) - )[0].rows[0]; - } catch (e4) { - db.close(); - return null; - } - if (fieldsTables.length == 0) { - db.close(); - return { - schema, - cols: [], - rows: [] - }; - } - const fields = fieldsTables[0].rows.filter( - (f4) => f4.name.length > 0 - ); - const dbTable = dbResultsToDBTables( - db.exec( - `SELECT ${serializeSQLFieldNames( - fields.reduce((p3, c4) => [...p3, `"${c4.name}"`], []) - )} FROM "${table}"` - ) - ); - db.close(); - return dbTableToMDBTable( - dbTable[0], - schema, - schema.primary ? updateFieldsToSchema(fields, context) : fields +var showSelectMenu = (point, optionProps) => { + const menu = new import_obsidian8.Menu(); + menu.dom.toggleClass("mk-menu", true); + menu.setUseNativeMenu(false); + const frag = document.createDocumentFragment(); + const div = frag.createDiv("mk-options-container"); + div.style.minHeight = Math.min( + 200, + (optionProps.options.length + (optionProps.searchable ? 1 : 0)) * 28 + ).toString() + "px"; + div.addEventListener("click", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("mousedown", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("mouseup", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("keydown", (e4) => { + }); + menu.onHide(() => optionProps.onHide && optionProps.onHide()); + const root = createRoot(div); + root.render( + /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(selectMenu_default, { + hide: () => { + menu.hide(); + optionProps.onHide && optionProps.onHide(); + }, + ...optionProps + })) ); -}; -var deleteMDBTable = async (plugin, context, table) => { - if (context.readOnly) - return false; - const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(context.dbPath, context.isRemote); - if (!buf) { - return false; + menu.addItem((item) => { + item.setTitle(frag); + }); + const keys = [...menu.scope.keys]; + for (let i4 = 0; i4 < keys.length; i4++) { + if (keys[i4].key != "Escape") { + menu.scope.unregister(keys[i4]); + } } - const db = new sqlJS.Database(new Uint8Array(buf)); - 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(context.dbPath, db.export().buffer); - db.close(); - return true; + menu.showAtPosition(point); + return menu; }; -var getMDBTableSchemas = async (plugin, context) => { - const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(context.dbPath, context.isRemote); - if (!buf) { - return null; - } - const db = new sqlJS.Database(new Uint8Array(buf)); - await sanitizeTableSchema(plugin, db, context); - const tables = db.exec(`SELECT * FROM m_schema`); - db.close(); - return tables[0].values.map((f4) => { - const [id2, name, type, def, predicate, primary] = f4; - return { id: id2, name, type, def, predicate, primary }; +var disclosureMenuItem = (menuItem, multi, editable, title, value, options, saveOptions) => { + const frag = document.createDocumentFragment(); + const div = frag.createDiv("title"); + div.textContent = title; + const div2 = frag.createDiv("disclosure"); + div2.textContent = value; + menuItem.setTitle(frag); + menuItem.onClick((ev) => { + var _a2; + ev.stopPropagation(); + const offset = menuItem.dom.getBoundingClientRect(); + showSelectMenu( + { x: offset.right + 10, y: offset.top }, + { + multi, + editable, + value: (_a2 = parseMultiString(value)) != null ? _a2 : [], + options, + saveOptions, + searchable: true, + showAll: true + } + ); }); + return menuItem; }; -var saveMDBToPath = async (plugin, context, mdb) => { - var _a2, _b2; - if (context.readOnly) - return; - const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(context.dbPath, context.isRemote); - if (!buf) { - return null; - } - const db = new sqlJS.Database(new Uint8Array(buf)); - const fieldsTables = dbResultsToDBTables( - db.exec(`SELECT * FROM m_fields WHERE schemaId != '${mdb.schema.id}'`) - ); - const tables = { - m_fields: { - uniques: fieldSchema.uniques, - cols: fieldSchema.cols, - rows: [...(_b2 = (_a2 = fieldsTables[0]) == null ? void 0 : _a2.rows) != null ? _b2 : [], ...mdb.cols] + +// src/components/ContextView/TagsView/TagsView.tsx +var import_obsidian9 = require("obsidian"); +var TagsView = (props2) => { + const showTagMenu = (e4, tag) => { + e4.stopPropagation(); + e4.preventDefault(); + const menu = new import_obsidian9.Menu(); + menu.addItem((menuItem) => { + menuItem.setIcon("hash"); + menuItem.setTitle(i18n_default.menu.openTag); + menuItem.onClick(() => { + openTagContext(tag, props2.plugin, e4.metaKey); + }); + }); + if (props2.removeTag) + menu.addItem((menuItem) => { + menuItem.setIcon("trash"); + menuItem.setTitle(i18n_default.menu.removeTag); + menuItem.onClick(() => { + props2.removeTag(tag); + }); + }); + const offset = e4.target.getBoundingClientRect(); + menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + }; + const showContextMenu = (e4) => { + const offset = e4.target.getBoundingClientRect(); + const f4 = loadTags(props2.plugin); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: true, + value: [], + options: f4.map((m5) => ({ name: m5, value: m5 })), + saveOptions: (_9, value) => props2.addTag(value[0]), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-tag-selector" + }, props2.tags.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { + key: i4, + onContextMenu: (e4) => showTagMenu(e4, f4), + onClick: (e4) => !props2.canOpen ? showTagMenu(e4, f4) : openTagContext(f4, props2.plugin, e4.metaKey) + }, /* @__PURE__ */ Cn.createElement("span", { + className: "cm-hashtag cm-hashtag-begin" + }, "#"), /* @__PURE__ */ Cn.createElement("span", { + className: "cm-hashtag cm-hashtag-end" + }, stringFromTag(f4)))), props2.addTag && /* @__PURE__ */ Cn.createElement("div", { + "aria-label": i18n_default.buttons.addTag, + onClick: (e4) => showContextMenu(e4) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + }))); +}; + +// src/components/StickerMenu/emojis/default.ts +var emojis = { + smileys_people: [ + { n: ["grinning", "grinning face"], u: "1f600" }, + { n: ["smiley", "smiling face with open mouth"], u: "1f603" }, + { + n: ["smile", "smiling face with open mouth and smiling eyes"], + u: "1f604" + }, + { n: ["grin", "grinning face with smiling eyes"], u: "1f601" }, + { + n: [ + "laughing", + "satisfied", + "smiling face with open mouth and tightly-closed eyes" + ], + u: "1f606" + }, + { + n: ["sweat smile", "smiling face with open mouth and cold sweat"], + u: "1f605" + }, + { n: ["rolling on the floor laughing"], u: "1f923" }, + { n: ["joy", "face with tears of joy"], u: "1f602" }, + { n: ["slightly smiling face"], u: "1f642" }, + { n: ["upside-down face", "upside down face"], u: "1f643" }, + { n: ["melting face"], u: "1fae0" }, + { n: ["wink", "winking face"], u: "1f609" }, + { n: ["blush", "smiling face with smiling eyes"], u: "1f60a" }, + { n: ["innocent", "smiling face with halo"], u: "1f607" }, + { + n: [ + "smiling face with 3 hearts", + "smiling face with smiling eyes and three hearts" + ], + u: "1f970" + }, + { n: ["heart eyes", "smiling face with heart-shaped eyes"], u: "1f60d" }, + { n: ["star-struck", "grinning face with star eyes"], u: "1f929" }, + { n: ["kissing heart", "face throwing a kiss"], u: "1f618" }, + { n: ["kissing", "kissing face"], u: "1f617" }, + { n: ["relaxed", "white smiling face"], u: "263a-fe0f" }, + { n: ["kissing closed eyes", "kissing face with closed eyes"], u: "1f61a" }, + { + n: ["kissing smiling eyes", "kissing face with smiling eyes"], + u: "1f619" + }, + { n: ["smiling face with tear"], u: "1f972" }, + { n: ["yum", "face savouring delicious food"], u: "1f60b" }, + { n: ["stuck out tongue", "face with stuck-out tongue"], u: "1f61b" }, + { + n: [ + "stuck out tongue winking eye", + "face with stuck-out tongue and winking eye" + ], + u: "1f61c" + }, + { + n: ["zany face", "grinning face with one large and one small eye"], + u: "1f92a" + }, + { + n: [ + "stuck out tongue closed eyes", + "face with stuck-out tongue and tightly-closed eyes" + ], + u: "1f61d" + }, + { n: ["money-mouth face", "money mouth face"], u: "1f911" }, + { n: ["hugging face"], u: "1f917" }, + { + n: [ + "face with hand over mouth", + "smiling face with smiling eyes and hand covering mouth" + ], + u: "1f92d" + }, + { n: ["face with open eyes and hand over mouth"], u: "1fae2" }, + { n: ["face with peeking eye"], u: "1fae3" }, + { + n: ["shushing face", "face with finger covering closed lips"], + u: "1f92b" + }, + { n: ["thinking face"], u: "1f914" }, + { n: ["saluting face"], u: "1fae1" }, + { n: ["zipper-mouth face", "zipper mouth face"], u: "1f910" }, + { + n: ["face with raised eyebrow", "face with one eyebrow raised"], + u: "1f928" + }, + { n: ["neutral face"], u: "1f610" }, + { n: ["expressionless", "expressionless face"], u: "1f611" }, + { n: ["no mouth", "face without mouth"], u: "1f636" }, + { n: ["dotted line face"], u: "1fae5" }, + { n: ["face in clouds"], u: "1f636-200d-1f32b-fe0f" }, + { n: ["smirk", "smirking face"], u: "1f60f" }, + { n: ["unamused", "unamused face"], u: "1f612" }, + { n: ["face with rolling eyes"], u: "1f644" }, + { n: ["grimacing", "grimacing face"], u: "1f62c" }, + { n: ["face exhaling"], u: "1f62e-200d-1f4a8" }, + { n: ["lying face"], u: "1f925" }, + { n: ["relieved", "relieved face"], u: "1f60c" }, + { n: ["pensive", "pensive face"], u: "1f614" }, + { n: ["sleepy", "sleepy face"], u: "1f62a" }, + { n: ["drooling face"], u: "1f924" }, + { n: ["sleeping", "sleeping face"], u: "1f634" }, + { n: ["mask", "face with medical mask"], u: "1f637" }, + { n: ["face with thermometer"], u: "1f912" }, + { n: ["face with head-bandage", "face with head bandage"], u: "1f915" }, + { n: ["nauseated face"], u: "1f922" }, + { n: ["face vomiting", "face with open mouth vomiting"], u: "1f92e" }, + { n: ["sneezing face"], u: "1f927" }, + { n: ["hot face", "overheated face"], u: "1f975" }, + { n: ["cold face", "freezing face"], u: "1f976" }, + { n: ["woozy face", "face with uneven eyes and wavy mouth"], u: "1f974" }, + { n: ["dizzy face"], u: "1f635" }, + { n: ["face with spiral eyes"], u: "1f635-200d-1f4ab" }, + { n: ["exploding head", "shocked face with exploding head"], u: "1f92f" }, + { n: ["face with cowboy hat"], u: "1f920" }, + { n: ["partying face", "face with party horn and party hat"], u: "1f973" }, + { n: ["disguised face"], u: "1f978" }, + { n: ["sunglasses", "smiling face with sunglasses"], u: "1f60e" }, + { n: ["nerd face"], u: "1f913" }, + { n: ["face with monocle"], u: "1f9d0" }, + { n: ["confused", "confused face"], u: "1f615" }, + { n: ["face with diagonal mouth"], u: "1fae4" }, + { n: ["worried", "worried face"], u: "1f61f" }, + { n: ["slightly frowning face"], u: "1f641" }, + { n: ["frowning face", "white frowning face"], u: "2639-fe0f" }, + { n: ["open mouth", "face with open mouth"], u: "1f62e" }, + { n: ["hushed", "hushed face"], u: "1f62f" }, + { n: ["astonished", "astonished face"], u: "1f632" }, + { n: ["flushed", "flushed face"], u: "1f633" }, + { n: ["pleading face", "face with pleading eyes"], u: "1f97a" }, + { n: ["face holding back tears"], u: "1f979" }, + { n: ["frowning", "frowning face with open mouth"], u: "1f626" }, + { n: ["anguished", "anguished face"], u: "1f627" }, + { n: ["fearful", "fearful face"], u: "1f628" }, + { n: ["cold sweat", "face with open mouth and cold sweat"], u: "1f630" }, + { + n: ["disappointed relieved", "disappointed but relieved face"], + u: "1f625" + }, + { n: ["cry", "crying face"], u: "1f622" }, + { n: ["sob", "loudly crying face"], u: "1f62d" }, + { n: ["scream", "face screaming in fear"], u: "1f631" }, + { n: ["confounded", "confounded face"], u: "1f616" }, + { n: ["persevere", "persevering face"], u: "1f623" }, + { n: ["disappointed", "disappointed face"], u: "1f61e" }, + { n: ["sweat", "face with cold sweat"], u: "1f613" }, + { n: ["weary", "weary face"], u: "1f629" }, + { n: ["tired face"], u: "1f62b" }, + { n: ["yawning face"], u: "1f971" }, + { n: ["triumph", "face with look of triumph"], u: "1f624" }, + { n: ["rage", "pouting face"], u: "1f621" }, + { n: ["angry", "angry face"], u: "1f620" }, + { + n: [ + "face with symbols on mouth", + "serious face with symbols covering mouth" + ], + u: "1f92c" + }, + { n: ["smiling imp", "smiling face with horns"], u: "1f608" }, + { n: ["imp"], u: "1f47f" }, + { n: ["skull"], u: "1f480" }, + { n: ["skull and crossbones"], u: "2620-fe0f" }, + { n: ["poop", "shit", "hankey", "pile of poo"], u: "1f4a9" }, + { n: ["clown face"], u: "1f921" }, + { n: ["japanese ogre"], u: "1f479" }, + { n: ["japanese goblin"], u: "1f47a" }, + { n: ["ghost"], u: "1f47b" }, + { n: ["alien", "extraterrestrial alien"], u: "1f47d" }, + { n: ["alien monster", "space invader"], u: "1f47e" }, + { n: ["robot face"], u: "1f916" }, + { n: ["smiley cat", "smiling cat face with open mouth"], u: "1f63a" }, + { n: ["smile cat", "grinning cat face with smiling eyes"], u: "1f638" }, + { n: ["joy cat", "cat face with tears of joy"], u: "1f639" }, + { + n: ["heart eyes cat", "smiling cat face with heart-shaped eyes"], + u: "1f63b" + }, + { n: ["smirk cat", "cat face with wry smile"], u: "1f63c" }, + { n: ["kissing cat", "kissing cat face with closed eyes"], u: "1f63d" }, + { n: ["scream cat", "weary cat face"], u: "1f640" }, + { n: ["crying cat face"], u: "1f63f" }, + { n: ["pouting cat", "pouting cat face"], u: "1f63e" }, + { n: ["see no evil", "see-no-evil monkey"], u: "1f648" }, + { n: ["hear no evil", "hear-no-evil monkey"], u: "1f649" }, + { n: ["speak no evil", "speak-no-evil monkey"], u: "1f64a" }, + { n: ["kiss", "kiss mark"], u: "1f48b" }, + { n: ["love letter"], u: "1f48c" }, + { n: ["cupid", "heart with arrow"], u: "1f498" }, + { n: ["gift heart", "heart with ribbon"], u: "1f49d" }, + { n: ["sparkling heart"], u: "1f496" }, + { n: ["heartpulse", "growing heart"], u: "1f497" }, + { n: ["heartbeat", "beating heart"], u: "1f493" }, + { n: ["revolving hearts"], u: "1f49e" }, + { n: ["two hearts"], u: "1f495" }, + { n: ["heart decoration"], u: "1f49f" }, + { + n: ["heart exclamation", "heavy heart exclamation mark ornament"], + u: "2763-fe0f" + }, + { n: ["broken heart"], u: "1f494" }, + { n: ["heart on fire"], u: "2764-fe0f-200d-1f525" }, + { n: ["mending heart"], u: "2764-fe0f-200d-1fa79" }, + { n: ["heart", "heavy black heart"], u: "2764-fe0f" }, + { n: ["orange heart"], u: "1f9e1" }, + { n: ["yellow heart"], u: "1f49b" }, + { n: ["green heart"], u: "1f49a" }, + { n: ["blue heart"], u: "1f499" }, + { n: ["purple heart"], u: "1f49c" }, + { n: ["brown heart"], u: "1f90e" }, + { n: ["black heart"], u: "1f5a4" }, + { n: ["white heart"], u: "1f90d" }, + { n: ["100", "hundred points symbol"], u: "1f4af" }, + { n: ["anger", "anger symbol"], u: "1f4a2" }, + { n: ["boom", "collision", "collision symbol"], u: "1f4a5" }, + { n: ["dizzy", "dizzy symbol"], u: "1f4ab" }, + { n: ["sweat drops", "splashing sweat symbol"], u: "1f4a6" }, + { n: ["dash", "dash symbol"], u: "1f4a8" }, + { n: ["hole"], u: "1f573-fe0f" }, + { n: ["bomb"], u: "1f4a3" }, + { n: ["speech balloon"], u: "1f4ac" }, + { + n: ["eye in speech bubble", "eye-in-speech-bubble"], + u: "1f441-fe0f-200d-1f5e8-fe0f" + }, + { n: ["left speech bubble"], u: "1f5e8-fe0f" }, + { n: ["right anger bubble"], u: "1f5ef-fe0f" }, + { n: ["thought balloon"], u: "1f4ad" }, + { n: ["zzz", "sleeping symbol"], u: "1f4a4" }, + { + n: ["wave", "waving hand sign"], + u: "1f44b", + v: [ + "1f44b-1f3fb", + "1f44b-1f3fc", + "1f44b-1f3fd", + "1f44b-1f3fe", + "1f44b-1f3ff" + ] + }, + { + n: ["raised back of hand"], + u: "1f91a", + v: [ + "1f91a-1f3fb", + "1f91a-1f3fc", + "1f91a-1f3fd", + "1f91a-1f3fe", + "1f91a-1f3ff" + ] + }, + { + n: ["hand with fingers splayed", "raised hand with fingers splayed"], + u: "1f590-fe0f", + v: [ + "1f590-1f3fb", + "1f590-1f3fc", + "1f590-1f3fd", + "1f590-1f3fe", + "1f590-1f3ff" + ] + }, + { + n: ["hand", "raised hand"], + u: "270b", + v: ["270b-1f3fb", "270b-1f3fc", "270b-1f3fd", "270b-1f3fe", "270b-1f3ff"] + }, + { + n: [ + "spock-hand", + "raised hand with part between middle and ring fingers" + ], + u: "1f596", + v: [ + "1f596-1f3fb", + "1f596-1f3fc", + "1f596-1f3fd", + "1f596-1f3fe", + "1f596-1f3ff" + ] + }, + { + n: ["rightwards hand"], + u: "1faf1", + v: [ + "1faf1-1f3fb", + "1faf1-1f3fc", + "1faf1-1f3fd", + "1faf1-1f3fe", + "1faf1-1f3ff" + ] + }, + { + n: ["leftwards hand"], + u: "1faf2", + v: [ + "1faf2-1f3fb", + "1faf2-1f3fc", + "1faf2-1f3fd", + "1faf2-1f3fe", + "1faf2-1f3ff" + ] + }, + { + n: ["palm down hand"], + u: "1faf3", + v: [ + "1faf3-1f3fb", + "1faf3-1f3fc", + "1faf3-1f3fd", + "1faf3-1f3fe", + "1faf3-1f3ff" + ] + }, + { + n: ["palm up hand"], + u: "1faf4", + v: [ + "1faf4-1f3fb", + "1faf4-1f3fc", + "1faf4-1f3fd", + "1faf4-1f3fe", + "1faf4-1f3ff" + ] + }, + { + n: ["ok hand", "ok hand sign"], + u: "1f44c", + v: [ + "1f44c-1f3fb", + "1f44c-1f3fc", + "1f44c-1f3fd", + "1f44c-1f3fe", + "1f44c-1f3ff" + ] + }, + { + n: ["pinched fingers"], + u: "1f90c", + v: [ + "1f90c-1f3fb", + "1f90c-1f3fc", + "1f90c-1f3fd", + "1f90c-1f3fe", + "1f90c-1f3ff" + ] + }, + { + n: ["pinching hand"], + u: "1f90f", + v: [ + "1f90f-1f3fb", + "1f90f-1f3fc", + "1f90f-1f3fd", + "1f90f-1f3fe", + "1f90f-1f3ff" + ] + }, + { + n: ["v", "victory hand"], + u: "270c-fe0f", + v: ["270c-1f3fb", "270c-1f3fc", "270c-1f3fd", "270c-1f3fe", "270c-1f3ff"] + }, + { + n: ["crossed fingers", "hand with index and middle fingers crossed"], + u: "1f91e", + v: [ + "1f91e-1f3fb", + "1f91e-1f3fc", + "1f91e-1f3fd", + "1f91e-1f3fe", + "1f91e-1f3ff" + ] + }, + { + n: ["hand with index finger and thumb crossed"], + u: "1faf0", + v: [ + "1faf0-1f3fb", + "1faf0-1f3fc", + "1faf0-1f3fd", + "1faf0-1f3fe", + "1faf0-1f3ff" + ] + }, + { + n: ["i love you hand sign"], + u: "1f91f", + v: [ + "1f91f-1f3fb", + "1f91f-1f3fc", + "1f91f-1f3fd", + "1f91f-1f3fe", + "1f91f-1f3ff" + ] + }, + { + n: ["the horns", "sign of the horns"], + u: "1f918", + v: [ + "1f918-1f3fb", + "1f918-1f3fc", + "1f918-1f3fd", + "1f918-1f3fe", + "1f918-1f3ff" + ] + }, + { + n: ["call me hand"], + u: "1f919", + v: [ + "1f919-1f3fb", + "1f919-1f3fc", + "1f919-1f3fd", + "1f919-1f3fe", + "1f919-1f3ff" + ] + }, + { + n: ["point left", "white left pointing backhand index"], + u: "1f448", + v: [ + "1f448-1f3fb", + "1f448-1f3fc", + "1f448-1f3fd", + "1f448-1f3fe", + "1f448-1f3ff" + ] + }, + { + n: ["point right", "white right pointing backhand index"], + u: "1f449", + v: [ + "1f449-1f3fb", + "1f449-1f3fc", + "1f449-1f3fd", + "1f449-1f3fe", + "1f449-1f3ff" + ] + }, + { + n: ["point up 2", "white up pointing backhand index"], + u: "1f446", + v: [ + "1f446-1f3fb", + "1f446-1f3fc", + "1f446-1f3fd", + "1f446-1f3fe", + "1f446-1f3ff" + ] + }, + { + n: ["middle finger", "reversed hand with middle finger extended"], + u: "1f595", + v: [ + "1f595-1f3fb", + "1f595-1f3fc", + "1f595-1f3fd", + "1f595-1f3fe", + "1f595-1f3ff" + ] + }, + { + n: ["point down", "white down pointing backhand index"], + u: "1f447", + v: [ + "1f447-1f3fb", + "1f447-1f3fc", + "1f447-1f3fd", + "1f447-1f3fe", + "1f447-1f3ff" + ] + }, + { + n: ["point up", "white up pointing index"], + u: "261d-fe0f", + v: ["261d-1f3fb", "261d-1f3fc", "261d-1f3fd", "261d-1f3fe", "261d-1f3ff"] + }, + { + n: ["index pointing at the viewer"], + u: "1faf5", + v: [ + "1faf5-1f3fb", + "1faf5-1f3fc", + "1faf5-1f3fd", + "1faf5-1f3fe", + "1faf5-1f3ff" + ] + }, + { + n: ["+1", "thumbsup", "thumbs up sign"], + u: "1f44d", + v: [ + "1f44d-1f3fb", + "1f44d-1f3fc", + "1f44d-1f3fd", + "1f44d-1f3fe", + "1f44d-1f3ff" + ] + }, + { + n: ["-1", "thumbsdown", "thumbs down sign"], + u: "1f44e", + v: [ + "1f44e-1f3fb", + "1f44e-1f3fc", + "1f44e-1f3fd", + "1f44e-1f3fe", + "1f44e-1f3ff" + ] + }, + { + n: ["fist", "raised fist"], + u: "270a", + v: ["270a-1f3fb", "270a-1f3fc", "270a-1f3fd", "270a-1f3fe", "270a-1f3ff"] + }, + { + n: ["punch", "facepunch", "fisted hand sign"], + u: "1f44a", + v: [ + "1f44a-1f3fb", + "1f44a-1f3fc", + "1f44a-1f3fd", + "1f44a-1f3fe", + "1f44a-1f3ff" + ] + }, + { + n: ["left-facing fist"], + u: "1f91b", + v: [ + "1f91b-1f3fb", + "1f91b-1f3fc", + "1f91b-1f3fd", + "1f91b-1f3fe", + "1f91b-1f3ff" + ] + }, + { + n: ["right-facing fist"], + u: "1f91c", + v: [ + "1f91c-1f3fb", + "1f91c-1f3fc", + "1f91c-1f3fd", + "1f91c-1f3fe", + "1f91c-1f3ff" + ] + }, + { + n: ["clap", "clapping hands sign"], + u: "1f44f", + v: [ + "1f44f-1f3fb", + "1f44f-1f3fc", + "1f44f-1f3fd", + "1f44f-1f3fe", + "1f44f-1f3ff" + ] + }, + { + n: ["raised hands", "person raising both hands in celebration"], + u: "1f64c", + v: [ + "1f64c-1f3fb", + "1f64c-1f3fc", + "1f64c-1f3fd", + "1f64c-1f3fe", + "1f64c-1f3ff" + ] + }, + { + n: ["heart hands"], + u: "1faf6", + v: [ + "1faf6-1f3fb", + "1faf6-1f3fc", + "1faf6-1f3fd", + "1faf6-1f3fe", + "1faf6-1f3ff" + ] + }, + { + n: ["open hands", "open hands sign"], + u: "1f450", + v: [ + "1f450-1f3fb", + "1f450-1f3fc", + "1f450-1f3fd", + "1f450-1f3fe", + "1f450-1f3ff" + ] + }, + { + n: ["palms up together"], + u: "1f932", + v: [ + "1f932-1f3fb", + "1f932-1f3fc", + "1f932-1f3fd", + "1f932-1f3fe", + "1f932-1f3ff" + ] + }, + { + n: ["handshake"], + u: "1f91d", + v: [ + "1f91d-1f3fb", + "1f91d-1f3fc", + "1f91d-1f3fd", + "1f91d-1f3fe", + "1f91d-1f3ff", + "1faf1-1f3fb-200d-1faf2-1f3fc", + "1faf1-1f3fb-200d-1faf2-1f3fd", + "1faf1-1f3fb-200d-1faf2-1f3fe", + "1faf1-1f3fb-200d-1faf2-1f3ff", + "1faf1-1f3fc-200d-1faf2-1f3fb", + "1faf1-1f3fc-200d-1faf2-1f3fd", + "1faf1-1f3fc-200d-1faf2-1f3fe", + "1faf1-1f3fc-200d-1faf2-1f3ff", + "1faf1-1f3fd-200d-1faf2-1f3fb", + "1faf1-1f3fd-200d-1faf2-1f3fc", + "1faf1-1f3fd-200d-1faf2-1f3fe", + "1faf1-1f3fd-200d-1faf2-1f3ff", + "1faf1-1f3fe-200d-1faf2-1f3fb", + "1faf1-1f3fe-200d-1faf2-1f3fc", + "1faf1-1f3fe-200d-1faf2-1f3fd", + "1faf1-1f3fe-200d-1faf2-1f3ff", + "1faf1-1f3ff-200d-1faf2-1f3fb", + "1faf1-1f3ff-200d-1faf2-1f3fc", + "1faf1-1f3ff-200d-1faf2-1f3fd", + "1faf1-1f3ff-200d-1faf2-1f3fe" + ] + }, + { + n: ["pray", "person with folded hands"], + u: "1f64f", + v: [ + "1f64f-1f3fb", + "1f64f-1f3fc", + "1f64f-1f3fd", + "1f64f-1f3fe", + "1f64f-1f3ff" + ] + }, + { + n: ["writing hand"], + u: "270d-fe0f", + v: ["270d-1f3fb", "270d-1f3fc", "270d-1f3fd", "270d-1f3fe", "270d-1f3ff"] + }, + { + n: ["nail care", "nail polish"], + u: "1f485", + v: [ + "1f485-1f3fb", + "1f485-1f3fc", + "1f485-1f3fd", + "1f485-1f3fe", + "1f485-1f3ff" + ] + }, + { + n: ["selfie"], + u: "1f933", + v: [ + "1f933-1f3fb", + "1f933-1f3fc", + "1f933-1f3fd", + "1f933-1f3fe", + "1f933-1f3ff" + ] + }, + { + n: ["muscle", "flexed biceps"], + u: "1f4aa", + v: [ + "1f4aa-1f3fb", + "1f4aa-1f3fc", + "1f4aa-1f3fd", + "1f4aa-1f3fe", + "1f4aa-1f3ff" + ] + }, + { n: ["mechanical arm"], u: "1f9be" }, + { n: ["mechanical leg"], u: "1f9bf" }, + { + n: ["leg"], + u: "1f9b5", + v: [ + "1f9b5-1f3fb", + "1f9b5-1f3fc", + "1f9b5-1f3fd", + "1f9b5-1f3fe", + "1f9b5-1f3ff" + ] + }, + { + n: ["foot"], + u: "1f9b6", + v: [ + "1f9b6-1f3fb", + "1f9b6-1f3fc", + "1f9b6-1f3fd", + "1f9b6-1f3fe", + "1f9b6-1f3ff" + ] + }, + { + n: ["ear"], + u: "1f442", + v: [ + "1f442-1f3fb", + "1f442-1f3fc", + "1f442-1f3fd", + "1f442-1f3fe", + "1f442-1f3ff" + ] + }, + { + n: ["ear with hearing aid"], + u: "1f9bb", + v: [ + "1f9bb-1f3fb", + "1f9bb-1f3fc", + "1f9bb-1f3fd", + "1f9bb-1f3fe", + "1f9bb-1f3ff" + ] + }, + { + n: ["nose"], + u: "1f443", + v: [ + "1f443-1f3fb", + "1f443-1f3fc", + "1f443-1f3fd", + "1f443-1f3fe", + "1f443-1f3ff" + ] + }, + { n: ["brain"], u: "1f9e0" }, + { n: ["anatomical heart"], u: "1fac0" }, + { n: ["lungs"], u: "1fac1" }, + { n: ["tooth"], u: "1f9b7" }, + { n: ["bone"], u: "1f9b4" }, + { n: ["eyes"], u: "1f440" }, + { n: ["eye"], u: "1f441-fe0f" }, + { n: ["tongue"], u: "1f445" }, + { n: ["lips", "mouth"], u: "1f444" }, + { n: ["biting lip"], u: "1fae6" }, + { + n: ["baby"], + u: "1f476", + v: [ + "1f476-1f3fb", + "1f476-1f3fc", + "1f476-1f3fd", + "1f476-1f3fe", + "1f476-1f3ff" + ] + }, + { + n: ["child"], + u: "1f9d2", + v: [ + "1f9d2-1f3fb", + "1f9d2-1f3fc", + "1f9d2-1f3fd", + "1f9d2-1f3fe", + "1f9d2-1f3ff" + ] + }, + { + n: ["boy"], + u: "1f466", + v: [ + "1f466-1f3fb", + "1f466-1f3fc", + "1f466-1f3fd", + "1f466-1f3fe", + "1f466-1f3ff" + ] + }, + { + n: ["girl"], + u: "1f467", + v: [ + "1f467-1f3fb", + "1f467-1f3fc", + "1f467-1f3fd", + "1f467-1f3fe", + "1f467-1f3ff" + ] + }, + { + n: ["adult"], + u: "1f9d1", + v: [ + "1f9d1-1f3fb", + "1f9d1-1f3fc", + "1f9d1-1f3fd", + "1f9d1-1f3fe", + "1f9d1-1f3ff" + ] + }, + { + n: ["person with blond hair"], + u: "1f471", + v: [ + "1f471-1f3fb", + "1f471-1f3fc", + "1f471-1f3fd", + "1f471-1f3fe", + "1f471-1f3ff" + ] + }, + { + n: ["man"], + u: "1f468", + v: [ + "1f468-1f3fb", + "1f468-1f3fc", + "1f468-1f3fd", + "1f468-1f3fe", + "1f468-1f3ff" + ] + }, + { + n: ["bearded person"], + u: "1f9d4", + v: [ + "1f9d4-1f3fb", + "1f9d4-1f3fc", + "1f9d4-1f3fd", + "1f9d4-1f3fe", + "1f9d4-1f3ff" + ] + }, + { + n: ["man: beard", "man with beard"], + u: "1f9d4-200d-2642-fe0f", + v: [ + "1f9d4-1f3fb-200d-2642-fe0f", + "1f9d4-1f3fc-200d-2642-fe0f", + "1f9d4-1f3fd-200d-2642-fe0f", + "1f9d4-1f3fe-200d-2642-fe0f", + "1f9d4-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman: beard", "woman with beard"], + u: "1f9d4-200d-2640-fe0f", + v: [ + "1f9d4-1f3fb-200d-2640-fe0f", + "1f9d4-1f3fc-200d-2640-fe0f", + "1f9d4-1f3fd-200d-2640-fe0f", + "1f9d4-1f3fe-200d-2640-fe0f", + "1f9d4-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["man: red hair", "red haired man"], + u: "1f468-200d-1f9b0", + v: [ + "1f468-1f3fb-200d-1f9b0", + "1f468-1f3fc-200d-1f9b0", + "1f468-1f3fd-200d-1f9b0", + "1f468-1f3fe-200d-1f9b0", + "1f468-1f3ff-200d-1f9b0" + ] + }, + { + n: ["man: curly hair", "curly haired man"], + u: "1f468-200d-1f9b1", + v: [ + "1f468-1f3fb-200d-1f9b1", + "1f468-1f3fc-200d-1f9b1", + "1f468-1f3fd-200d-1f9b1", + "1f468-1f3fe-200d-1f9b1", + "1f468-1f3ff-200d-1f9b1" + ] + }, + { + n: ["man: white hair", "white haired man"], + u: "1f468-200d-1f9b3", + v: [ + "1f468-1f3fb-200d-1f9b3", + "1f468-1f3fc-200d-1f9b3", + "1f468-1f3fd-200d-1f9b3", + "1f468-1f3fe-200d-1f9b3", + "1f468-1f3ff-200d-1f9b3" + ] + }, + { + n: ["bald man", "man: bald"], + u: "1f468-200d-1f9b2", + v: [ + "1f468-1f3fb-200d-1f9b2", + "1f468-1f3fc-200d-1f9b2", + "1f468-1f3fd-200d-1f9b2", + "1f468-1f3fe-200d-1f9b2", + "1f468-1f3ff-200d-1f9b2" + ] + }, + { + n: ["woman"], + u: "1f469", + v: [ + "1f469-1f3fb", + "1f469-1f3fc", + "1f469-1f3fd", + "1f469-1f3fe", + "1f469-1f3ff" + ] + }, + { + n: ["woman: red hair", "red haired woman"], + u: "1f469-200d-1f9b0", + v: [ + "1f469-1f3fb-200d-1f9b0", + "1f469-1f3fc-200d-1f9b0", + "1f469-1f3fd-200d-1f9b0", + "1f469-1f3fe-200d-1f9b0", + "1f469-1f3ff-200d-1f9b0" + ] + }, + { + n: ["person: red hair", "red haired person"], + u: "1f9d1-200d-1f9b0", + v: [ + "1f9d1-1f3fb-200d-1f9b0", + "1f9d1-1f3fc-200d-1f9b0", + "1f9d1-1f3fd-200d-1f9b0", + "1f9d1-1f3fe-200d-1f9b0", + "1f9d1-1f3ff-200d-1f9b0" + ] + }, + { + n: ["woman: curly hair", "curly haired woman"], + u: "1f469-200d-1f9b1", + v: [ + "1f469-1f3fb-200d-1f9b1", + "1f469-1f3fc-200d-1f9b1", + "1f469-1f3fd-200d-1f9b1", + "1f469-1f3fe-200d-1f9b1", + "1f469-1f3ff-200d-1f9b1" + ] + }, + { + n: ["person: curly hair", "curly haired person"], + u: "1f9d1-200d-1f9b1", + v: [ + "1f9d1-1f3fb-200d-1f9b1", + "1f9d1-1f3fc-200d-1f9b1", + "1f9d1-1f3fd-200d-1f9b1", + "1f9d1-1f3fe-200d-1f9b1", + "1f9d1-1f3ff-200d-1f9b1" + ] + }, + { + n: ["woman: white hair", "white haired woman"], + u: "1f469-200d-1f9b3", + v: [ + "1f469-1f3fb-200d-1f9b3", + "1f469-1f3fc-200d-1f9b3", + "1f469-1f3fd-200d-1f9b3", + "1f469-1f3fe-200d-1f9b3", + "1f469-1f3ff-200d-1f9b3" + ] + }, + { + n: ["person: white hair", "white haired person"], + u: "1f9d1-200d-1f9b3", + v: [ + "1f9d1-1f3fb-200d-1f9b3", + "1f9d1-1f3fc-200d-1f9b3", + "1f9d1-1f3fd-200d-1f9b3", + "1f9d1-1f3fe-200d-1f9b3", + "1f9d1-1f3ff-200d-1f9b3" + ] + }, + { + n: ["bald woman", "woman: bald"], + u: "1f469-200d-1f9b2", + v: [ + "1f469-1f3fb-200d-1f9b2", + "1f469-1f3fc-200d-1f9b2", + "1f469-1f3fd-200d-1f9b2", + "1f469-1f3fe-200d-1f9b2", + "1f469-1f3ff-200d-1f9b2" + ] + }, + { + n: ["bald person", "person: bald"], + u: "1f9d1-200d-1f9b2", + v: [ + "1f9d1-1f3fb-200d-1f9b2", + "1f9d1-1f3fc-200d-1f9b2", + "1f9d1-1f3fd-200d-1f9b2", + "1f9d1-1f3fe-200d-1f9b2", + "1f9d1-1f3ff-200d-1f9b2" + ] + }, + { + n: ["woman: blond hair", "blond-haired-woman"], + u: "1f471-200d-2640-fe0f", + v: [ + "1f471-1f3fb-200d-2640-fe0f", + "1f471-1f3fc-200d-2640-fe0f", + "1f471-1f3fd-200d-2640-fe0f", + "1f471-1f3fe-200d-2640-fe0f", + "1f471-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["man: blond hair", "blond-haired-man"], + u: "1f471-200d-2642-fe0f", + v: [ + "1f471-1f3fb-200d-2642-fe0f", + "1f471-1f3fc-200d-2642-fe0f", + "1f471-1f3fd-200d-2642-fe0f", + "1f471-1f3fe-200d-2642-fe0f", + "1f471-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["older adult"], + u: "1f9d3", + v: [ + "1f9d3-1f3fb", + "1f9d3-1f3fc", + "1f9d3-1f3fd", + "1f9d3-1f3fe", + "1f9d3-1f3ff" + ] + }, + { + n: ["older man"], + u: "1f474", + v: [ + "1f474-1f3fb", + "1f474-1f3fc", + "1f474-1f3fd", + "1f474-1f3fe", + "1f474-1f3ff" + ] + }, + { + n: ["older woman"], + u: "1f475", + v: [ + "1f475-1f3fb", + "1f475-1f3fc", + "1f475-1f3fd", + "1f475-1f3fe", + "1f475-1f3ff" + ] + }, + { + n: ["person frowning"], + u: "1f64d", + v: [ + "1f64d-1f3fb", + "1f64d-1f3fc", + "1f64d-1f3fd", + "1f64d-1f3fe", + "1f64d-1f3ff" + ] + }, + { + n: ["man frowning", "man-frowning"], + u: "1f64d-200d-2642-fe0f", + v: [ + "1f64d-1f3fb-200d-2642-fe0f", + "1f64d-1f3fc-200d-2642-fe0f", + "1f64d-1f3fd-200d-2642-fe0f", + "1f64d-1f3fe-200d-2642-fe0f", + "1f64d-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman frowning", "woman-frowning"], + u: "1f64d-200d-2640-fe0f", + v: [ + "1f64d-1f3fb-200d-2640-fe0f", + "1f64d-1f3fc-200d-2640-fe0f", + "1f64d-1f3fd-200d-2640-fe0f", + "1f64d-1f3fe-200d-2640-fe0f", + "1f64d-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person with pouting face"], + u: "1f64e", + v: [ + "1f64e-1f3fb", + "1f64e-1f3fc", + "1f64e-1f3fd", + "1f64e-1f3fe", + "1f64e-1f3ff" + ] + }, + { + n: ["man pouting", "man-pouting"], + u: "1f64e-200d-2642-fe0f", + v: [ + "1f64e-1f3fb-200d-2642-fe0f", + "1f64e-1f3fc-200d-2642-fe0f", + "1f64e-1f3fd-200d-2642-fe0f", + "1f64e-1f3fe-200d-2642-fe0f", + "1f64e-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman pouting", "woman-pouting"], + u: "1f64e-200d-2640-fe0f", + v: [ + "1f64e-1f3fb-200d-2640-fe0f", + "1f64e-1f3fc-200d-2640-fe0f", + "1f64e-1f3fd-200d-2640-fe0f", + "1f64e-1f3fe-200d-2640-fe0f", + "1f64e-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["no good", "face with no good gesture"], + u: "1f645", + v: [ + "1f645-1f3fb", + "1f645-1f3fc", + "1f645-1f3fd", + "1f645-1f3fe", + "1f645-1f3ff" + ] + }, + { + n: ["man gesturing no", "man-gesturing-no"], + u: "1f645-200d-2642-fe0f", + v: [ + "1f645-1f3fb-200d-2642-fe0f", + "1f645-1f3fc-200d-2642-fe0f", + "1f645-1f3fd-200d-2642-fe0f", + "1f645-1f3fe-200d-2642-fe0f", + "1f645-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman gesturing no", "woman-gesturing-no"], + u: "1f645-200d-2640-fe0f", + v: [ + "1f645-1f3fb-200d-2640-fe0f", + "1f645-1f3fc-200d-2640-fe0f", + "1f645-1f3fd-200d-2640-fe0f", + "1f645-1f3fe-200d-2640-fe0f", + "1f645-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["ok woman", "face with ok gesture"], + u: "1f646", + v: [ + "1f646-1f3fb", + "1f646-1f3fc", + "1f646-1f3fd", + "1f646-1f3fe", + "1f646-1f3ff" + ] + }, + { + n: ["man gesturing ok", "man-gesturing-ok"], + u: "1f646-200d-2642-fe0f", + v: [ + "1f646-1f3fb-200d-2642-fe0f", + "1f646-1f3fc-200d-2642-fe0f", + "1f646-1f3fd-200d-2642-fe0f", + "1f646-1f3fe-200d-2642-fe0f", + "1f646-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman gesturing ok", "woman-gesturing-ok"], + u: "1f646-200d-2640-fe0f", + v: [ + "1f646-1f3fb-200d-2640-fe0f", + "1f646-1f3fc-200d-2640-fe0f", + "1f646-1f3fd-200d-2640-fe0f", + "1f646-1f3fe-200d-2640-fe0f", + "1f646-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["information desk person"], + u: "1f481", + v: [ + "1f481-1f3fb", + "1f481-1f3fc", + "1f481-1f3fd", + "1f481-1f3fe", + "1f481-1f3ff" + ] + }, + { + n: ["man tipping hand", "man-tipping-hand"], + u: "1f481-200d-2642-fe0f", + v: [ + "1f481-1f3fb-200d-2642-fe0f", + "1f481-1f3fc-200d-2642-fe0f", + "1f481-1f3fd-200d-2642-fe0f", + "1f481-1f3fe-200d-2642-fe0f", + "1f481-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman tipping hand", "woman-tipping-hand"], + u: "1f481-200d-2640-fe0f", + v: [ + "1f481-1f3fb-200d-2640-fe0f", + "1f481-1f3fc-200d-2640-fe0f", + "1f481-1f3fd-200d-2640-fe0f", + "1f481-1f3fe-200d-2640-fe0f", + "1f481-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["raising hand", "happy person raising one hand"], + u: "1f64b", + v: [ + "1f64b-1f3fb", + "1f64b-1f3fc", + "1f64b-1f3fd", + "1f64b-1f3fe", + "1f64b-1f3ff" + ] + }, + { + n: ["man raising hand", "man-raising-hand"], + u: "1f64b-200d-2642-fe0f", + v: [ + "1f64b-1f3fb-200d-2642-fe0f", + "1f64b-1f3fc-200d-2642-fe0f", + "1f64b-1f3fd-200d-2642-fe0f", + "1f64b-1f3fe-200d-2642-fe0f", + "1f64b-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman raising hand", "woman-raising-hand"], + u: "1f64b-200d-2640-fe0f", + v: [ + "1f64b-1f3fb-200d-2640-fe0f", + "1f64b-1f3fc-200d-2640-fe0f", + "1f64b-1f3fd-200d-2640-fe0f", + "1f64b-1f3fe-200d-2640-fe0f", + "1f64b-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["deaf person"], + u: "1f9cf", + v: [ + "1f9cf-1f3fb", + "1f9cf-1f3fc", + "1f9cf-1f3fd", + "1f9cf-1f3fe", + "1f9cf-1f3ff" + ] + }, + { + n: ["deaf man"], + u: "1f9cf-200d-2642-fe0f", + v: [ + "1f9cf-1f3fb-200d-2642-fe0f", + "1f9cf-1f3fc-200d-2642-fe0f", + "1f9cf-1f3fd-200d-2642-fe0f", + "1f9cf-1f3fe-200d-2642-fe0f", + "1f9cf-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["deaf woman"], + u: "1f9cf-200d-2640-fe0f", + v: [ + "1f9cf-1f3fb-200d-2640-fe0f", + "1f9cf-1f3fc-200d-2640-fe0f", + "1f9cf-1f3fd-200d-2640-fe0f", + "1f9cf-1f3fe-200d-2640-fe0f", + "1f9cf-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["bow", "person bowing deeply"], + u: "1f647", + v: [ + "1f647-1f3fb", + "1f647-1f3fc", + "1f647-1f3fd", + "1f647-1f3fe", + "1f647-1f3ff" + ] + }, + { + n: ["man bowing", "man-bowing"], + u: "1f647-200d-2642-fe0f", + v: [ + "1f647-1f3fb-200d-2642-fe0f", + "1f647-1f3fc-200d-2642-fe0f", + "1f647-1f3fd-200d-2642-fe0f", + "1f647-1f3fe-200d-2642-fe0f", + "1f647-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman bowing", "woman-bowing"], + u: "1f647-200d-2640-fe0f", + v: [ + "1f647-1f3fb-200d-2640-fe0f", + "1f647-1f3fc-200d-2640-fe0f", + "1f647-1f3fd-200d-2640-fe0f", + "1f647-1f3fe-200d-2640-fe0f", + "1f647-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["face palm"], + u: "1f926", + v: [ + "1f926-1f3fb", + "1f926-1f3fc", + "1f926-1f3fd", + "1f926-1f3fe", + "1f926-1f3ff" + ] + }, + { + n: ["man facepalming", "man-facepalming"], + u: "1f926-200d-2642-fe0f", + v: [ + "1f926-1f3fb-200d-2642-fe0f", + "1f926-1f3fc-200d-2642-fe0f", + "1f926-1f3fd-200d-2642-fe0f", + "1f926-1f3fe-200d-2642-fe0f", + "1f926-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman facepalming", "woman-facepalming"], + u: "1f926-200d-2640-fe0f", + v: [ + "1f926-1f3fb-200d-2640-fe0f", + "1f926-1f3fc-200d-2640-fe0f", + "1f926-1f3fd-200d-2640-fe0f", + "1f926-1f3fe-200d-2640-fe0f", + "1f926-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["shrug"], + u: "1f937", + v: [ + "1f937-1f3fb", + "1f937-1f3fc", + "1f937-1f3fd", + "1f937-1f3fe", + "1f937-1f3ff" + ] + }, + { + n: ["man shrugging", "man-shrugging"], + u: "1f937-200d-2642-fe0f", + v: [ + "1f937-1f3fb-200d-2642-fe0f", + "1f937-1f3fc-200d-2642-fe0f", + "1f937-1f3fd-200d-2642-fe0f", + "1f937-1f3fe-200d-2642-fe0f", + "1f937-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman shrugging", "woman-shrugging"], + u: "1f937-200d-2640-fe0f", + v: [ + "1f937-1f3fb-200d-2640-fe0f", + "1f937-1f3fc-200d-2640-fe0f", + "1f937-1f3fd-200d-2640-fe0f", + "1f937-1f3fe-200d-2640-fe0f", + "1f937-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["health worker"], + u: "1f9d1-200d-2695-fe0f", + v: [ + "1f9d1-1f3fb-200d-2695-fe0f", + "1f9d1-1f3fc-200d-2695-fe0f", + "1f9d1-1f3fd-200d-2695-fe0f", + "1f9d1-1f3fe-200d-2695-fe0f", + "1f9d1-1f3ff-200d-2695-fe0f" + ] + }, + { + n: ["male-doctor", "man health worker"], + u: "1f468-200d-2695-fe0f", + v: [ + "1f468-1f3fb-200d-2695-fe0f", + "1f468-1f3fc-200d-2695-fe0f", + "1f468-1f3fd-200d-2695-fe0f", + "1f468-1f3fe-200d-2695-fe0f", + "1f468-1f3ff-200d-2695-fe0f" + ] + }, + { + n: ["female-doctor", "woman health worker"], + u: "1f469-200d-2695-fe0f", + v: [ + "1f469-1f3fb-200d-2695-fe0f", + "1f469-1f3fc-200d-2695-fe0f", + "1f469-1f3fd-200d-2695-fe0f", + "1f469-1f3fe-200d-2695-fe0f", + "1f469-1f3ff-200d-2695-fe0f" + ] + }, + { + n: ["student"], + u: "1f9d1-200d-1f393", + v: [ + "1f9d1-1f3fb-200d-1f393", + "1f9d1-1f3fc-200d-1f393", + "1f9d1-1f3fd-200d-1f393", + "1f9d1-1f3fe-200d-1f393", + "1f9d1-1f3ff-200d-1f393" + ] + }, + { + n: ["man student", "male-student"], + u: "1f468-200d-1f393", + v: [ + "1f468-1f3fb-200d-1f393", + "1f468-1f3fc-200d-1f393", + "1f468-1f3fd-200d-1f393", + "1f468-1f3fe-200d-1f393", + "1f468-1f3ff-200d-1f393" + ] + }, + { + n: ["woman student", "female-student"], + u: "1f469-200d-1f393", + v: [ + "1f469-1f3fb-200d-1f393", + "1f469-1f3fc-200d-1f393", + "1f469-1f3fd-200d-1f393", + "1f469-1f3fe-200d-1f393", + "1f469-1f3ff-200d-1f393" + ] + }, + { + n: ["teacher"], + u: "1f9d1-200d-1f3eb", + v: [ + "1f9d1-1f3fb-200d-1f3eb", + "1f9d1-1f3fc-200d-1f3eb", + "1f9d1-1f3fd-200d-1f3eb", + "1f9d1-1f3fe-200d-1f3eb", + "1f9d1-1f3ff-200d-1f3eb" + ] + }, + { + n: ["man teacher", "male-teacher"], + u: "1f468-200d-1f3eb", + v: [ + "1f468-1f3fb-200d-1f3eb", + "1f468-1f3fc-200d-1f3eb", + "1f468-1f3fd-200d-1f3eb", + "1f468-1f3fe-200d-1f3eb", + "1f468-1f3ff-200d-1f3eb" + ] + }, + { + n: ["woman teacher", "female-teacher"], + u: "1f469-200d-1f3eb", + v: [ + "1f469-1f3fb-200d-1f3eb", + "1f469-1f3fc-200d-1f3eb", + "1f469-1f3fd-200d-1f3eb", + "1f469-1f3fe-200d-1f3eb", + "1f469-1f3ff-200d-1f3eb" + ] + }, + { + n: ["judge"], + u: "1f9d1-200d-2696-fe0f", + v: [ + "1f9d1-1f3fb-200d-2696-fe0f", + "1f9d1-1f3fc-200d-2696-fe0f", + "1f9d1-1f3fd-200d-2696-fe0f", + "1f9d1-1f3fe-200d-2696-fe0f", + "1f9d1-1f3ff-200d-2696-fe0f" + ] + }, + { + n: ["man judge", "male-judge"], + u: "1f468-200d-2696-fe0f", + v: [ + "1f468-1f3fb-200d-2696-fe0f", + "1f468-1f3fc-200d-2696-fe0f", + "1f468-1f3fd-200d-2696-fe0f", + "1f468-1f3fe-200d-2696-fe0f", + "1f468-1f3ff-200d-2696-fe0f" + ] + }, + { + n: ["woman judge", "female-judge"], + u: "1f469-200d-2696-fe0f", + v: [ + "1f469-1f3fb-200d-2696-fe0f", + "1f469-1f3fc-200d-2696-fe0f", + "1f469-1f3fd-200d-2696-fe0f", + "1f469-1f3fe-200d-2696-fe0f", + "1f469-1f3ff-200d-2696-fe0f" + ] + }, + { + n: ["farmer"], + u: "1f9d1-200d-1f33e", + v: [ + "1f9d1-1f3fb-200d-1f33e", + "1f9d1-1f3fc-200d-1f33e", + "1f9d1-1f3fd-200d-1f33e", + "1f9d1-1f3fe-200d-1f33e", + "1f9d1-1f3ff-200d-1f33e" + ] + }, + { + n: ["man farmer", "male-farmer"], + u: "1f468-200d-1f33e", + v: [ + "1f468-1f3fb-200d-1f33e", + "1f468-1f3fc-200d-1f33e", + "1f468-1f3fd-200d-1f33e", + "1f468-1f3fe-200d-1f33e", + "1f468-1f3ff-200d-1f33e" + ] + }, + { + n: ["woman farmer", "female-farmer"], + u: "1f469-200d-1f33e", + v: [ + "1f469-1f3fb-200d-1f33e", + "1f469-1f3fc-200d-1f33e", + "1f469-1f3fd-200d-1f33e", + "1f469-1f3fe-200d-1f33e", + "1f469-1f3ff-200d-1f33e" + ] + }, + { + n: ["cook"], + u: "1f9d1-200d-1f373", + v: [ + "1f9d1-1f3fb-200d-1f373", + "1f9d1-1f3fc-200d-1f373", + "1f9d1-1f3fd-200d-1f373", + "1f9d1-1f3fe-200d-1f373", + "1f9d1-1f3ff-200d-1f373" + ] + }, + { + n: ["man cook", "male-cook"], + u: "1f468-200d-1f373", + v: [ + "1f468-1f3fb-200d-1f373", + "1f468-1f3fc-200d-1f373", + "1f468-1f3fd-200d-1f373", + "1f468-1f3fe-200d-1f373", + "1f468-1f3ff-200d-1f373" + ] + }, + { + n: ["woman cook", "female-cook"], + u: "1f469-200d-1f373", + v: [ + "1f469-1f3fb-200d-1f373", + "1f469-1f3fc-200d-1f373", + "1f469-1f3fd-200d-1f373", + "1f469-1f3fe-200d-1f373", + "1f469-1f3ff-200d-1f373" + ] + }, + { + n: ["mechanic"], + u: "1f9d1-200d-1f527", + v: [ + "1f9d1-1f3fb-200d-1f527", + "1f9d1-1f3fc-200d-1f527", + "1f9d1-1f3fd-200d-1f527", + "1f9d1-1f3fe-200d-1f527", + "1f9d1-1f3ff-200d-1f527" + ] + }, + { + n: ["man mechanic", "male-mechanic"], + u: "1f468-200d-1f527", + v: [ + "1f468-1f3fb-200d-1f527", + "1f468-1f3fc-200d-1f527", + "1f468-1f3fd-200d-1f527", + "1f468-1f3fe-200d-1f527", + "1f468-1f3ff-200d-1f527" + ] + }, + { + n: ["woman mechanic", "female-mechanic"], + u: "1f469-200d-1f527", + v: [ + "1f469-1f3fb-200d-1f527", + "1f469-1f3fc-200d-1f527", + "1f469-1f3fd-200d-1f527", + "1f469-1f3fe-200d-1f527", + "1f469-1f3ff-200d-1f527" + ] + }, + { + n: ["factory worker"], + u: "1f9d1-200d-1f3ed", + v: [ + "1f9d1-1f3fb-200d-1f3ed", + "1f9d1-1f3fc-200d-1f3ed", + "1f9d1-1f3fd-200d-1f3ed", + "1f9d1-1f3fe-200d-1f3ed", + "1f9d1-1f3ff-200d-1f3ed" + ] + }, + { + n: ["man factory worker", "male-factory-worker"], + u: "1f468-200d-1f3ed", + v: [ + "1f468-1f3fb-200d-1f3ed", + "1f468-1f3fc-200d-1f3ed", + "1f468-1f3fd-200d-1f3ed", + "1f468-1f3fe-200d-1f3ed", + "1f468-1f3ff-200d-1f3ed" + ] + }, + { + n: ["woman factory worker", "female-factory-worker"], + u: "1f469-200d-1f3ed", + v: [ + "1f469-1f3fb-200d-1f3ed", + "1f469-1f3fc-200d-1f3ed", + "1f469-1f3fd-200d-1f3ed", + "1f469-1f3fe-200d-1f3ed", + "1f469-1f3ff-200d-1f3ed" + ] + }, + { + n: ["office worker"], + u: "1f9d1-200d-1f4bc", + v: [ + "1f9d1-1f3fb-200d-1f4bc", + "1f9d1-1f3fc-200d-1f4bc", + "1f9d1-1f3fd-200d-1f4bc", + "1f9d1-1f3fe-200d-1f4bc", + "1f9d1-1f3ff-200d-1f4bc" + ] + }, + { + n: ["man office worker", "male-office-worker"], + u: "1f468-200d-1f4bc", + v: [ + "1f468-1f3fb-200d-1f4bc", + "1f468-1f3fc-200d-1f4bc", + "1f468-1f3fd-200d-1f4bc", + "1f468-1f3fe-200d-1f4bc", + "1f468-1f3ff-200d-1f4bc" + ] + }, + { + n: ["woman office worker", "female-office-worker"], + u: "1f469-200d-1f4bc", + v: [ + "1f469-1f3fb-200d-1f4bc", + "1f469-1f3fc-200d-1f4bc", + "1f469-1f3fd-200d-1f4bc", + "1f469-1f3fe-200d-1f4bc", + "1f469-1f3ff-200d-1f4bc" + ] + }, + { + n: ["scientist"], + u: "1f9d1-200d-1f52c", + v: [ + "1f9d1-1f3fb-200d-1f52c", + "1f9d1-1f3fc-200d-1f52c", + "1f9d1-1f3fd-200d-1f52c", + "1f9d1-1f3fe-200d-1f52c", + "1f9d1-1f3ff-200d-1f52c" + ] + }, + { + n: ["man scientist", "male-scientist"], + u: "1f468-200d-1f52c", + v: [ + "1f468-1f3fb-200d-1f52c", + "1f468-1f3fc-200d-1f52c", + "1f468-1f3fd-200d-1f52c", + "1f468-1f3fe-200d-1f52c", + "1f468-1f3ff-200d-1f52c" + ] + }, + { + n: ["woman scientist", "female-scientist"], + u: "1f469-200d-1f52c", + v: [ + "1f469-1f3fb-200d-1f52c", + "1f469-1f3fc-200d-1f52c", + "1f469-1f3fd-200d-1f52c", + "1f469-1f3fe-200d-1f52c", + "1f469-1f3ff-200d-1f52c" + ] + }, + { + n: ["technologist"], + u: "1f9d1-200d-1f4bb", + v: [ + "1f9d1-1f3fb-200d-1f4bb", + "1f9d1-1f3fc-200d-1f4bb", + "1f9d1-1f3fd-200d-1f4bb", + "1f9d1-1f3fe-200d-1f4bb", + "1f9d1-1f3ff-200d-1f4bb" + ] + }, + { + n: ["man technologist", "male-technologist"], + u: "1f468-200d-1f4bb", + v: [ + "1f468-1f3fb-200d-1f4bb", + "1f468-1f3fc-200d-1f4bb", + "1f468-1f3fd-200d-1f4bb", + "1f468-1f3fe-200d-1f4bb", + "1f468-1f3ff-200d-1f4bb" + ] + }, + { + n: ["woman technologist", "female-technologist"], + u: "1f469-200d-1f4bb", + v: [ + "1f469-1f3fb-200d-1f4bb", + "1f469-1f3fc-200d-1f4bb", + "1f469-1f3fd-200d-1f4bb", + "1f469-1f3fe-200d-1f4bb", + "1f469-1f3ff-200d-1f4bb" + ] + }, + { + n: ["singer"], + u: "1f9d1-200d-1f3a4", + v: [ + "1f9d1-1f3fb-200d-1f3a4", + "1f9d1-1f3fc-200d-1f3a4", + "1f9d1-1f3fd-200d-1f3a4", + "1f9d1-1f3fe-200d-1f3a4", + "1f9d1-1f3ff-200d-1f3a4" + ] + }, + { + n: ["man singer", "male-singer"], + u: "1f468-200d-1f3a4", + v: [ + "1f468-1f3fb-200d-1f3a4", + "1f468-1f3fc-200d-1f3a4", + "1f468-1f3fd-200d-1f3a4", + "1f468-1f3fe-200d-1f3a4", + "1f468-1f3ff-200d-1f3a4" + ] + }, + { + n: ["woman singer", "female-singer"], + u: "1f469-200d-1f3a4", + v: [ + "1f469-1f3fb-200d-1f3a4", + "1f469-1f3fc-200d-1f3a4", + "1f469-1f3fd-200d-1f3a4", + "1f469-1f3fe-200d-1f3a4", + "1f469-1f3ff-200d-1f3a4" + ] + }, + { + n: ["artist"], + u: "1f9d1-200d-1f3a8", + v: [ + "1f9d1-1f3fb-200d-1f3a8", + "1f9d1-1f3fc-200d-1f3a8", + "1f9d1-1f3fd-200d-1f3a8", + "1f9d1-1f3fe-200d-1f3a8", + "1f9d1-1f3ff-200d-1f3a8" + ] + }, + { + n: ["man artist", "male-artist"], + u: "1f468-200d-1f3a8", + v: [ + "1f468-1f3fb-200d-1f3a8", + "1f468-1f3fc-200d-1f3a8", + "1f468-1f3fd-200d-1f3a8", + "1f468-1f3fe-200d-1f3a8", + "1f468-1f3ff-200d-1f3a8" + ] + }, + { + n: ["woman artist", "female-artist"], + u: "1f469-200d-1f3a8", + v: [ + "1f469-1f3fb-200d-1f3a8", + "1f469-1f3fc-200d-1f3a8", + "1f469-1f3fd-200d-1f3a8", + "1f469-1f3fe-200d-1f3a8", + "1f469-1f3ff-200d-1f3a8" + ] + }, + { + n: ["pilot"], + u: "1f9d1-200d-2708-fe0f", + v: [ + "1f9d1-1f3fb-200d-2708-fe0f", + "1f9d1-1f3fc-200d-2708-fe0f", + "1f9d1-1f3fd-200d-2708-fe0f", + "1f9d1-1f3fe-200d-2708-fe0f", + "1f9d1-1f3ff-200d-2708-fe0f" + ] + }, + { + n: ["man pilot", "male-pilot"], + u: "1f468-200d-2708-fe0f", + v: [ + "1f468-1f3fb-200d-2708-fe0f", + "1f468-1f3fc-200d-2708-fe0f", + "1f468-1f3fd-200d-2708-fe0f", + "1f468-1f3fe-200d-2708-fe0f", + "1f468-1f3ff-200d-2708-fe0f" + ] + }, + { + n: ["woman pilot", "female-pilot"], + u: "1f469-200d-2708-fe0f", + v: [ + "1f469-1f3fb-200d-2708-fe0f", + "1f469-1f3fc-200d-2708-fe0f", + "1f469-1f3fd-200d-2708-fe0f", + "1f469-1f3fe-200d-2708-fe0f", + "1f469-1f3ff-200d-2708-fe0f" + ] + }, + { + n: ["astronaut"], + u: "1f9d1-200d-1f680", + v: [ + "1f9d1-1f3fb-200d-1f680", + "1f9d1-1f3fc-200d-1f680", + "1f9d1-1f3fd-200d-1f680", + "1f9d1-1f3fe-200d-1f680", + "1f9d1-1f3ff-200d-1f680" + ] + }, + { + n: ["man astronaut", "male-astronaut"], + u: "1f468-200d-1f680", + v: [ + "1f468-1f3fb-200d-1f680", + "1f468-1f3fc-200d-1f680", + "1f468-1f3fd-200d-1f680", + "1f468-1f3fe-200d-1f680", + "1f468-1f3ff-200d-1f680" + ] + }, + { + n: ["woman astronaut", "female-astronaut"], + u: "1f469-200d-1f680", + v: [ + "1f469-1f3fb-200d-1f680", + "1f469-1f3fc-200d-1f680", + "1f469-1f3fd-200d-1f680", + "1f469-1f3fe-200d-1f680", + "1f469-1f3ff-200d-1f680" + ] + }, + { + n: ["firefighter"], + u: "1f9d1-200d-1f692", + v: [ + "1f9d1-1f3fb-200d-1f692", + "1f9d1-1f3fc-200d-1f692", + "1f9d1-1f3fd-200d-1f692", + "1f9d1-1f3fe-200d-1f692", + "1f9d1-1f3ff-200d-1f692" + ] + }, + { + n: ["man firefighter", "male-firefighter"], + u: "1f468-200d-1f692", + v: [ + "1f468-1f3fb-200d-1f692", + "1f468-1f3fc-200d-1f692", + "1f468-1f3fd-200d-1f692", + "1f468-1f3fe-200d-1f692", + "1f468-1f3ff-200d-1f692" + ] + }, + { + n: ["woman firefighter", "female-firefighter"], + u: "1f469-200d-1f692", + v: [ + "1f469-1f3fb-200d-1f692", + "1f469-1f3fc-200d-1f692", + "1f469-1f3fd-200d-1f692", + "1f469-1f3fe-200d-1f692", + "1f469-1f3ff-200d-1f692" + ] + }, + { + n: ["cop", "police officer"], + u: "1f46e", + v: [ + "1f46e-1f3fb", + "1f46e-1f3fc", + "1f46e-1f3fd", + "1f46e-1f3fe", + "1f46e-1f3ff" + ] + }, + { + n: ["man police officer", "male-police-officer"], + u: "1f46e-200d-2642-fe0f", + v: [ + "1f46e-1f3fb-200d-2642-fe0f", + "1f46e-1f3fc-200d-2642-fe0f", + "1f46e-1f3fd-200d-2642-fe0f", + "1f46e-1f3fe-200d-2642-fe0f", + "1f46e-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman police officer", "female-police-officer"], + u: "1f46e-200d-2640-fe0f", + v: [ + "1f46e-1f3fb-200d-2640-fe0f", + "1f46e-1f3fc-200d-2640-fe0f", + "1f46e-1f3fd-200d-2640-fe0f", + "1f46e-1f3fe-200d-2640-fe0f", + "1f46e-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["detective", "sleuth or spy"], + u: "1f575-fe0f", + v: [ + "1f575-1f3fb", + "1f575-1f3fc", + "1f575-1f3fd", + "1f575-1f3fe", + "1f575-1f3ff" + ] + }, + { + n: ["man detective", "male-detective"], + u: "1f575-fe0f-200d-2642-fe0f", + v: [ + "1f575-1f3fb-200d-2642-fe0f", + "1f575-1f3fc-200d-2642-fe0f", + "1f575-1f3fd-200d-2642-fe0f", + "1f575-1f3fe-200d-2642-fe0f", + "1f575-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman detective", "female-detective"], + u: "1f575-fe0f-200d-2640-fe0f", + v: [ + "1f575-1f3fb-200d-2640-fe0f", + "1f575-1f3fc-200d-2640-fe0f", + "1f575-1f3fd-200d-2640-fe0f", + "1f575-1f3fe-200d-2640-fe0f", + "1f575-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["guardsman"], + u: "1f482", + v: [ + "1f482-1f3fb", + "1f482-1f3fc", + "1f482-1f3fd", + "1f482-1f3fe", + "1f482-1f3ff" + ] + }, + { + n: ["man guard", "male-guard"], + u: "1f482-200d-2642-fe0f", + v: [ + "1f482-1f3fb-200d-2642-fe0f", + "1f482-1f3fc-200d-2642-fe0f", + "1f482-1f3fd-200d-2642-fe0f", + "1f482-1f3fe-200d-2642-fe0f", + "1f482-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman guard", "female-guard"], + u: "1f482-200d-2640-fe0f", + v: [ + "1f482-1f3fb-200d-2640-fe0f", + "1f482-1f3fc-200d-2640-fe0f", + "1f482-1f3fd-200d-2640-fe0f", + "1f482-1f3fe-200d-2640-fe0f", + "1f482-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["ninja"], + u: "1f977", + v: [ + "1f977-1f3fb", + "1f977-1f3fc", + "1f977-1f3fd", + "1f977-1f3fe", + "1f977-1f3ff" + ] + }, + { + n: ["construction worker"], + u: "1f477", + v: [ + "1f477-1f3fb", + "1f477-1f3fc", + "1f477-1f3fd", + "1f477-1f3fe", + "1f477-1f3ff" + ] + }, + { + n: ["man construction worker", "male-construction-worker"], + u: "1f477-200d-2642-fe0f", + v: [ + "1f477-1f3fb-200d-2642-fe0f", + "1f477-1f3fc-200d-2642-fe0f", + "1f477-1f3fd-200d-2642-fe0f", + "1f477-1f3fe-200d-2642-fe0f", + "1f477-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman construction worker", "female-construction-worker"], + u: "1f477-200d-2640-fe0f", + v: [ + "1f477-1f3fb-200d-2640-fe0f", + "1f477-1f3fc-200d-2640-fe0f", + "1f477-1f3fd-200d-2640-fe0f", + "1f477-1f3fe-200d-2640-fe0f", + "1f477-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person with crown"], + u: "1fac5", + v: [ + "1fac5-1f3fb", + "1fac5-1f3fc", + "1fac5-1f3fd", + "1fac5-1f3fe", + "1fac5-1f3ff" + ] + }, + { + n: ["prince"], + u: "1f934", + v: [ + "1f934-1f3fb", + "1f934-1f3fc", + "1f934-1f3fd", + "1f934-1f3fe", + "1f934-1f3ff" + ] + }, + { + n: ["princess"], + u: "1f478", + v: [ + "1f478-1f3fb", + "1f478-1f3fc", + "1f478-1f3fd", + "1f478-1f3fe", + "1f478-1f3ff" + ] + }, + { + n: ["man with turban"], + u: "1f473", + v: [ + "1f473-1f3fb", + "1f473-1f3fc", + "1f473-1f3fd", + "1f473-1f3fe", + "1f473-1f3ff" + ] + }, + { + n: ["man wearing turban", "man-wearing-turban"], + u: "1f473-200d-2642-fe0f", + v: [ + "1f473-1f3fb-200d-2642-fe0f", + "1f473-1f3fc-200d-2642-fe0f", + "1f473-1f3fd-200d-2642-fe0f", + "1f473-1f3fe-200d-2642-fe0f", + "1f473-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman wearing turban", "woman-wearing-turban"], + u: "1f473-200d-2640-fe0f", + v: [ + "1f473-1f3fb-200d-2640-fe0f", + "1f473-1f3fc-200d-2640-fe0f", + "1f473-1f3fd-200d-2640-fe0f", + "1f473-1f3fe-200d-2640-fe0f", + "1f473-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["man with gua pi mao"], + u: "1f472", + v: [ + "1f472-1f3fb", + "1f472-1f3fc", + "1f472-1f3fd", + "1f472-1f3fe", + "1f472-1f3ff" + ] + }, + { + n: ["person with headscarf"], + u: "1f9d5", + v: [ + "1f9d5-1f3fb", + "1f9d5-1f3fc", + "1f9d5-1f3fd", + "1f9d5-1f3fe", + "1f9d5-1f3ff" + ] + }, + { + n: ["man in tuxedo", "person in tuxedo"], + u: "1f935", + v: [ + "1f935-1f3fb", + "1f935-1f3fc", + "1f935-1f3fd", + "1f935-1f3fe", + "1f935-1f3ff" + ] + }, + { + n: ["man in tuxedo"], + u: "1f935-200d-2642-fe0f", + v: [ + "1f935-1f3fb-200d-2642-fe0f", + "1f935-1f3fc-200d-2642-fe0f", + "1f935-1f3fd-200d-2642-fe0f", + "1f935-1f3fe-200d-2642-fe0f", + "1f935-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman in tuxedo"], + u: "1f935-200d-2640-fe0f", + v: [ + "1f935-1f3fb-200d-2640-fe0f", + "1f935-1f3fc-200d-2640-fe0f", + "1f935-1f3fd-200d-2640-fe0f", + "1f935-1f3fe-200d-2640-fe0f", + "1f935-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["bride with veil"], + u: "1f470", + v: [ + "1f470-1f3fb", + "1f470-1f3fc", + "1f470-1f3fd", + "1f470-1f3fe", + "1f470-1f3ff" + ] + }, + { + n: ["man with veil"], + u: "1f470-200d-2642-fe0f", + v: [ + "1f470-1f3fb-200d-2642-fe0f", + "1f470-1f3fc-200d-2642-fe0f", + "1f470-1f3fd-200d-2642-fe0f", + "1f470-1f3fe-200d-2642-fe0f", + "1f470-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman with veil"], + u: "1f470-200d-2640-fe0f", + v: [ + "1f470-1f3fb-200d-2640-fe0f", + "1f470-1f3fc-200d-2640-fe0f", + "1f470-1f3fd-200d-2640-fe0f", + "1f470-1f3fe-200d-2640-fe0f", + "1f470-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["pregnant woman"], + u: "1f930", + v: [ + "1f930-1f3fb", + "1f930-1f3fc", + "1f930-1f3fd", + "1f930-1f3fe", + "1f930-1f3ff" + ] + }, + { + n: ["pregnant man"], + u: "1fac3", + v: [ + "1fac3-1f3fb", + "1fac3-1f3fc", + "1fac3-1f3fd", + "1fac3-1f3fe", + "1fac3-1f3ff" + ] + }, + { + n: ["pregnant person"], + u: "1fac4", + v: [ + "1fac4-1f3fb", + "1fac4-1f3fc", + "1fac4-1f3fd", + "1fac4-1f3fe", + "1fac4-1f3ff" + ] + }, + { + n: ["breast-feeding"], + u: "1f931", + v: [ + "1f931-1f3fb", + "1f931-1f3fc", + "1f931-1f3fd", + "1f931-1f3fe", + "1f931-1f3ff" + ] + }, + { + n: ["woman feeding baby"], + u: "1f469-200d-1f37c", + v: [ + "1f469-1f3fb-200d-1f37c", + "1f469-1f3fc-200d-1f37c", + "1f469-1f3fd-200d-1f37c", + "1f469-1f3fe-200d-1f37c", + "1f469-1f3ff-200d-1f37c" + ] + }, + { + n: ["man feeding baby"], + u: "1f468-200d-1f37c", + v: [ + "1f468-1f3fb-200d-1f37c", + "1f468-1f3fc-200d-1f37c", + "1f468-1f3fd-200d-1f37c", + "1f468-1f3fe-200d-1f37c", + "1f468-1f3ff-200d-1f37c" + ] + }, + { + n: ["person feeding baby"], + u: "1f9d1-200d-1f37c", + v: [ + "1f9d1-1f3fb-200d-1f37c", + "1f9d1-1f3fc-200d-1f37c", + "1f9d1-1f3fd-200d-1f37c", + "1f9d1-1f3fe-200d-1f37c", + "1f9d1-1f3ff-200d-1f37c" + ] + }, + { + n: ["angel", "baby angel"], + u: "1f47c", + v: [ + "1f47c-1f3fb", + "1f47c-1f3fc", + "1f47c-1f3fd", + "1f47c-1f3fe", + "1f47c-1f3ff" + ] + }, + { + n: ["santa", "father christmas"], + u: "1f385", + v: [ + "1f385-1f3fb", + "1f385-1f3fc", + "1f385-1f3fd", + "1f385-1f3fe", + "1f385-1f3ff" + ] + }, + { + n: ["mrs claus", "mother christmas"], + u: "1f936", + v: [ + "1f936-1f3fb", + "1f936-1f3fc", + "1f936-1f3fd", + "1f936-1f3fe", + "1f936-1f3ff" + ] + }, + { + n: ["mx claus"], + u: "1f9d1-200d-1f384", + v: [ + "1f9d1-1f3fb-200d-1f384", + "1f9d1-1f3fc-200d-1f384", + "1f9d1-1f3fd-200d-1f384", + "1f9d1-1f3fe-200d-1f384", + "1f9d1-1f3ff-200d-1f384" + ] + }, + { + n: ["superhero"], + u: "1f9b8", + v: [ + "1f9b8-1f3fb", + "1f9b8-1f3fc", + "1f9b8-1f3fd", + "1f9b8-1f3fe", + "1f9b8-1f3ff" + ] + }, + { + n: ["man superhero", "male superhero"], + u: "1f9b8-200d-2642-fe0f", + v: [ + "1f9b8-1f3fb-200d-2642-fe0f", + "1f9b8-1f3fc-200d-2642-fe0f", + "1f9b8-1f3fd-200d-2642-fe0f", + "1f9b8-1f3fe-200d-2642-fe0f", + "1f9b8-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman superhero", "female superhero"], + u: "1f9b8-200d-2640-fe0f", + v: [ + "1f9b8-1f3fb-200d-2640-fe0f", + "1f9b8-1f3fc-200d-2640-fe0f", + "1f9b8-1f3fd-200d-2640-fe0f", + "1f9b8-1f3fe-200d-2640-fe0f", + "1f9b8-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["supervillain"], + u: "1f9b9", + v: [ + "1f9b9-1f3fb", + "1f9b9-1f3fc", + "1f9b9-1f3fd", + "1f9b9-1f3fe", + "1f9b9-1f3ff" + ] + }, + { + n: ["man supervillain", "male supervillain"], + u: "1f9b9-200d-2642-fe0f", + v: [ + "1f9b9-1f3fb-200d-2642-fe0f", + "1f9b9-1f3fc-200d-2642-fe0f", + "1f9b9-1f3fd-200d-2642-fe0f", + "1f9b9-1f3fe-200d-2642-fe0f", + "1f9b9-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman supervillain", "female supervillain"], + u: "1f9b9-200d-2640-fe0f", + v: [ + "1f9b9-1f3fb-200d-2640-fe0f", + "1f9b9-1f3fc-200d-2640-fe0f", + "1f9b9-1f3fd-200d-2640-fe0f", + "1f9b9-1f3fe-200d-2640-fe0f", + "1f9b9-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["mage"], + u: "1f9d9", + v: [ + "1f9d9-1f3fb", + "1f9d9-1f3fc", + "1f9d9-1f3fd", + "1f9d9-1f3fe", + "1f9d9-1f3ff" + ] + }, + { + n: ["man mage", "male mage"], + u: "1f9d9-200d-2642-fe0f", + v: [ + "1f9d9-1f3fb-200d-2642-fe0f", + "1f9d9-1f3fc-200d-2642-fe0f", + "1f9d9-1f3fd-200d-2642-fe0f", + "1f9d9-1f3fe-200d-2642-fe0f", + "1f9d9-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman mage", "female mage"], + u: "1f9d9-200d-2640-fe0f", + v: [ + "1f9d9-1f3fb-200d-2640-fe0f", + "1f9d9-1f3fc-200d-2640-fe0f", + "1f9d9-1f3fd-200d-2640-fe0f", + "1f9d9-1f3fe-200d-2640-fe0f", + "1f9d9-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["fairy"], + u: "1f9da", + v: [ + "1f9da-1f3fb", + "1f9da-1f3fc", + "1f9da-1f3fd", + "1f9da-1f3fe", + "1f9da-1f3ff" + ] + }, + { + n: ["man fairy", "male fairy"], + u: "1f9da-200d-2642-fe0f", + v: [ + "1f9da-1f3fb-200d-2642-fe0f", + "1f9da-1f3fc-200d-2642-fe0f", + "1f9da-1f3fd-200d-2642-fe0f", + "1f9da-1f3fe-200d-2642-fe0f", + "1f9da-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman fairy", "female fairy"], + u: "1f9da-200d-2640-fe0f", + v: [ + "1f9da-1f3fb-200d-2640-fe0f", + "1f9da-1f3fc-200d-2640-fe0f", + "1f9da-1f3fd-200d-2640-fe0f", + "1f9da-1f3fe-200d-2640-fe0f", + "1f9da-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["vampire"], + u: "1f9db", + v: [ + "1f9db-1f3fb", + "1f9db-1f3fc", + "1f9db-1f3fd", + "1f9db-1f3fe", + "1f9db-1f3ff" + ] + }, + { + n: ["man vampire", "male vampire"], + u: "1f9db-200d-2642-fe0f", + v: [ + "1f9db-1f3fb-200d-2642-fe0f", + "1f9db-1f3fc-200d-2642-fe0f", + "1f9db-1f3fd-200d-2642-fe0f", + "1f9db-1f3fe-200d-2642-fe0f", + "1f9db-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman vampire", "female vampire"], + u: "1f9db-200d-2640-fe0f", + v: [ + "1f9db-1f3fb-200d-2640-fe0f", + "1f9db-1f3fc-200d-2640-fe0f", + "1f9db-1f3fd-200d-2640-fe0f", + "1f9db-1f3fe-200d-2640-fe0f", + "1f9db-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["merperson"], + u: "1f9dc", + v: [ + "1f9dc-1f3fb", + "1f9dc-1f3fc", + "1f9dc-1f3fd", + "1f9dc-1f3fe", + "1f9dc-1f3ff" + ] + }, + { + n: ["merman"], + u: "1f9dc-200d-2642-fe0f", + v: [ + "1f9dc-1f3fb-200d-2642-fe0f", + "1f9dc-1f3fc-200d-2642-fe0f", + "1f9dc-1f3fd-200d-2642-fe0f", + "1f9dc-1f3fe-200d-2642-fe0f", + "1f9dc-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["mermaid"], + u: "1f9dc-200d-2640-fe0f", + v: [ + "1f9dc-1f3fb-200d-2640-fe0f", + "1f9dc-1f3fc-200d-2640-fe0f", + "1f9dc-1f3fd-200d-2640-fe0f", + "1f9dc-1f3fe-200d-2640-fe0f", + "1f9dc-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["elf"], + u: "1f9dd", + v: [ + "1f9dd-1f3fb", + "1f9dd-1f3fc", + "1f9dd-1f3fd", + "1f9dd-1f3fe", + "1f9dd-1f3ff" + ] + }, + { + n: ["man elf", "male elf"], + u: "1f9dd-200d-2642-fe0f", + v: [ + "1f9dd-1f3fb-200d-2642-fe0f", + "1f9dd-1f3fc-200d-2642-fe0f", + "1f9dd-1f3fd-200d-2642-fe0f", + "1f9dd-1f3fe-200d-2642-fe0f", + "1f9dd-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman elf", "female elf"], + u: "1f9dd-200d-2640-fe0f", + v: [ + "1f9dd-1f3fb-200d-2640-fe0f", + "1f9dd-1f3fc-200d-2640-fe0f", + "1f9dd-1f3fd-200d-2640-fe0f", + "1f9dd-1f3fe-200d-2640-fe0f", + "1f9dd-1f3ff-200d-2640-fe0f" + ] + }, + { n: ["genie"], u: "1f9de" }, + { n: ["man genie", "male genie"], u: "1f9de-200d-2642-fe0f" }, + { n: ["woman genie", "female genie"], u: "1f9de-200d-2640-fe0f" }, + { n: ["zombie"], u: "1f9df" }, + { n: ["man zombie", "male zombie"], u: "1f9df-200d-2642-fe0f" }, + { n: ["woman zombie", "female zombie"], u: "1f9df-200d-2640-fe0f" }, + { n: ["troll"], u: "1f9cc" }, + { + n: ["massage", "face massage"], + u: "1f486", + v: [ + "1f486-1f3fb", + "1f486-1f3fc", + "1f486-1f3fd", + "1f486-1f3fe", + "1f486-1f3ff" + ] + }, + { + n: ["man getting massage", "man-getting-massage"], + u: "1f486-200d-2642-fe0f", + v: [ + "1f486-1f3fb-200d-2642-fe0f", + "1f486-1f3fc-200d-2642-fe0f", + "1f486-1f3fd-200d-2642-fe0f", + "1f486-1f3fe-200d-2642-fe0f", + "1f486-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman getting massage", "woman-getting-massage"], + u: "1f486-200d-2640-fe0f", + v: [ + "1f486-1f3fb-200d-2640-fe0f", + "1f486-1f3fc-200d-2640-fe0f", + "1f486-1f3fd-200d-2640-fe0f", + "1f486-1f3fe-200d-2640-fe0f", + "1f486-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["haircut"], + u: "1f487", + v: [ + "1f487-1f3fb", + "1f487-1f3fc", + "1f487-1f3fd", + "1f487-1f3fe", + "1f487-1f3ff" + ] + }, + { + n: ["man getting haircut", "man-getting-haircut"], + u: "1f487-200d-2642-fe0f", + v: [ + "1f487-1f3fb-200d-2642-fe0f", + "1f487-1f3fc-200d-2642-fe0f", + "1f487-1f3fd-200d-2642-fe0f", + "1f487-1f3fe-200d-2642-fe0f", + "1f487-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman getting haircut", "woman-getting-haircut"], + u: "1f487-200d-2640-fe0f", + v: [ + "1f487-1f3fb-200d-2640-fe0f", + "1f487-1f3fc-200d-2640-fe0f", + "1f487-1f3fd-200d-2640-fe0f", + "1f487-1f3fe-200d-2640-fe0f", + "1f487-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["walking", "pedestrian"], + u: "1f6b6", + v: [ + "1f6b6-1f3fb", + "1f6b6-1f3fc", + "1f6b6-1f3fd", + "1f6b6-1f3fe", + "1f6b6-1f3ff" + ] + }, + { + n: ["man walking", "man-walking"], + u: "1f6b6-200d-2642-fe0f", + v: [ + "1f6b6-1f3fb-200d-2642-fe0f", + "1f6b6-1f3fc-200d-2642-fe0f", + "1f6b6-1f3fd-200d-2642-fe0f", + "1f6b6-1f3fe-200d-2642-fe0f", + "1f6b6-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman walking", "woman-walking"], + u: "1f6b6-200d-2640-fe0f", + v: [ + "1f6b6-1f3fb-200d-2640-fe0f", + "1f6b6-1f3fc-200d-2640-fe0f", + "1f6b6-1f3fd-200d-2640-fe0f", + "1f6b6-1f3fe-200d-2640-fe0f", + "1f6b6-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["standing person"], + u: "1f9cd", + v: [ + "1f9cd-1f3fb", + "1f9cd-1f3fc", + "1f9cd-1f3fd", + "1f9cd-1f3fe", + "1f9cd-1f3ff" + ] + }, + { + n: ["man standing"], + u: "1f9cd-200d-2642-fe0f", + v: [ + "1f9cd-1f3fb-200d-2642-fe0f", + "1f9cd-1f3fc-200d-2642-fe0f", + "1f9cd-1f3fd-200d-2642-fe0f", + "1f9cd-1f3fe-200d-2642-fe0f", + "1f9cd-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman standing"], + u: "1f9cd-200d-2640-fe0f", + v: [ + "1f9cd-1f3fb-200d-2640-fe0f", + "1f9cd-1f3fc-200d-2640-fe0f", + "1f9cd-1f3fd-200d-2640-fe0f", + "1f9cd-1f3fe-200d-2640-fe0f", + "1f9cd-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["kneeling person"], + u: "1f9ce", + v: [ + "1f9ce-1f3fb", + "1f9ce-1f3fc", + "1f9ce-1f3fd", + "1f9ce-1f3fe", + "1f9ce-1f3ff" + ] + }, + { + n: ["man kneeling"], + u: "1f9ce-200d-2642-fe0f", + v: [ + "1f9ce-1f3fb-200d-2642-fe0f", + "1f9ce-1f3fc-200d-2642-fe0f", + "1f9ce-1f3fd-200d-2642-fe0f", + "1f9ce-1f3fe-200d-2642-fe0f", + "1f9ce-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman kneeling"], + u: "1f9ce-200d-2640-fe0f", + v: [ + "1f9ce-1f3fb-200d-2640-fe0f", + "1f9ce-1f3fc-200d-2640-fe0f", + "1f9ce-1f3fd-200d-2640-fe0f", + "1f9ce-1f3fe-200d-2640-fe0f", + "1f9ce-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person with white cane", "person with probing cane"], + u: "1f9d1-200d-1f9af", + v: [ + "1f9d1-1f3fb-200d-1f9af", + "1f9d1-1f3fc-200d-1f9af", + "1f9d1-1f3fd-200d-1f9af", + "1f9d1-1f3fe-200d-1f9af", + "1f9d1-1f3ff-200d-1f9af" + ] + }, + { + n: ["man with white cane", "man with probing cane"], + u: "1f468-200d-1f9af", + v: [ + "1f468-1f3fb-200d-1f9af", + "1f468-1f3fc-200d-1f9af", + "1f468-1f3fd-200d-1f9af", + "1f468-1f3fe-200d-1f9af", + "1f468-1f3ff-200d-1f9af" + ] + }, + { + n: ["woman with white cane", "woman with probing cane"], + u: "1f469-200d-1f9af", + v: [ + "1f469-1f3fb-200d-1f9af", + "1f469-1f3fc-200d-1f9af", + "1f469-1f3fd-200d-1f9af", + "1f469-1f3fe-200d-1f9af", + "1f469-1f3ff-200d-1f9af" + ] + }, + { + n: ["person in motorized wheelchair"], + u: "1f9d1-200d-1f9bc", + v: [ + "1f9d1-1f3fb-200d-1f9bc", + "1f9d1-1f3fc-200d-1f9bc", + "1f9d1-1f3fd-200d-1f9bc", + "1f9d1-1f3fe-200d-1f9bc", + "1f9d1-1f3ff-200d-1f9bc" + ] + }, + { + n: ["man in motorized wheelchair"], + u: "1f468-200d-1f9bc", + v: [ + "1f468-1f3fb-200d-1f9bc", + "1f468-1f3fc-200d-1f9bc", + "1f468-1f3fd-200d-1f9bc", + "1f468-1f3fe-200d-1f9bc", + "1f468-1f3ff-200d-1f9bc" + ] + }, + { + n: ["woman in motorized wheelchair"], + u: "1f469-200d-1f9bc", + v: [ + "1f469-1f3fb-200d-1f9bc", + "1f469-1f3fc-200d-1f9bc", + "1f469-1f3fd-200d-1f9bc", + "1f469-1f3fe-200d-1f9bc", + "1f469-1f3ff-200d-1f9bc" + ] + }, + { + n: ["person in manual wheelchair"], + u: "1f9d1-200d-1f9bd", + v: [ + "1f9d1-1f3fb-200d-1f9bd", + "1f9d1-1f3fc-200d-1f9bd", + "1f9d1-1f3fd-200d-1f9bd", + "1f9d1-1f3fe-200d-1f9bd", + "1f9d1-1f3ff-200d-1f9bd" + ] + }, + { + n: ["man in manual wheelchair"], + u: "1f468-200d-1f9bd", + v: [ + "1f468-1f3fb-200d-1f9bd", + "1f468-1f3fc-200d-1f9bd", + "1f468-1f3fd-200d-1f9bd", + "1f468-1f3fe-200d-1f9bd", + "1f468-1f3ff-200d-1f9bd" + ] + }, + { + n: ["woman in manual wheelchair"], + u: "1f469-200d-1f9bd", + v: [ + "1f469-1f3fb-200d-1f9bd", + "1f469-1f3fc-200d-1f9bd", + "1f469-1f3fd-200d-1f9bd", + "1f469-1f3fe-200d-1f9bd", + "1f469-1f3ff-200d-1f9bd" + ] + }, + { + n: ["runner", "running"], + u: "1f3c3", + v: [ + "1f3c3-1f3fb", + "1f3c3-1f3fc", + "1f3c3-1f3fd", + "1f3c3-1f3fe", + "1f3c3-1f3ff" + ] + }, + { + n: ["man running", "man-running"], + u: "1f3c3-200d-2642-fe0f", + v: [ + "1f3c3-1f3fb-200d-2642-fe0f", + "1f3c3-1f3fc-200d-2642-fe0f", + "1f3c3-1f3fd-200d-2642-fe0f", + "1f3c3-1f3fe-200d-2642-fe0f", + "1f3c3-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman running", "woman-running"], + u: "1f3c3-200d-2640-fe0f", + v: [ + "1f3c3-1f3fb-200d-2640-fe0f", + "1f3c3-1f3fc-200d-2640-fe0f", + "1f3c3-1f3fd-200d-2640-fe0f", + "1f3c3-1f3fe-200d-2640-fe0f", + "1f3c3-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["dancer"], + u: "1f483", + v: [ + "1f483-1f3fb", + "1f483-1f3fc", + "1f483-1f3fd", + "1f483-1f3fe", + "1f483-1f3ff" + ] + }, + { + n: ["man dancing"], + u: "1f57a", + v: [ + "1f57a-1f3fb", + "1f57a-1f3fc", + "1f57a-1f3fd", + "1f57a-1f3fe", + "1f57a-1f3ff" + ] + }, + { + n: ["person in suit levitating", "man in business suit levitating"], + u: "1f574-fe0f", + v: [ + "1f574-1f3fb", + "1f574-1f3fc", + "1f574-1f3fd", + "1f574-1f3fe", + "1f574-1f3ff" + ] + }, + { n: ["dancers", "woman with bunny ears"], u: "1f46f" }, + { + n: [ + "men with bunny ears", + "men-with-bunny-ears-partying", + "man-with-bunny-ears-partying" + ], + u: "1f46f-200d-2642-fe0f" + }, + { + n: [ + "women with bunny ears", + "women-with-bunny-ears-partying", + "woman-with-bunny-ears-partying" + ], + u: "1f46f-200d-2640-fe0f" + }, + { + n: ["person in steamy room"], + u: "1f9d6", + v: [ + "1f9d6-1f3fb", + "1f9d6-1f3fc", + "1f9d6-1f3fd", + "1f9d6-1f3fe", + "1f9d6-1f3ff" + ] + }, + { + n: ["man in steamy room"], + u: "1f9d6-200d-2642-fe0f", + v: [ + "1f9d6-1f3fb-200d-2642-fe0f", + "1f9d6-1f3fc-200d-2642-fe0f", + "1f9d6-1f3fd-200d-2642-fe0f", + "1f9d6-1f3fe-200d-2642-fe0f", + "1f9d6-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman in steamy room"], + u: "1f9d6-200d-2640-fe0f", + v: [ + "1f9d6-1f3fb-200d-2640-fe0f", + "1f9d6-1f3fc-200d-2640-fe0f", + "1f9d6-1f3fd-200d-2640-fe0f", + "1f9d6-1f3fe-200d-2640-fe0f", + "1f9d6-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person climbing"], + u: "1f9d7", + v: [ + "1f9d7-1f3fb", + "1f9d7-1f3fc", + "1f9d7-1f3fd", + "1f9d7-1f3fe", + "1f9d7-1f3ff" + ] + }, + { + n: ["man climbing"], + u: "1f9d7-200d-2642-fe0f", + v: [ + "1f9d7-1f3fb-200d-2642-fe0f", + "1f9d7-1f3fc-200d-2642-fe0f", + "1f9d7-1f3fd-200d-2642-fe0f", + "1f9d7-1f3fe-200d-2642-fe0f", + "1f9d7-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman climbing"], + u: "1f9d7-200d-2640-fe0f", + v: [ + "1f9d7-1f3fb-200d-2640-fe0f", + "1f9d7-1f3fc-200d-2640-fe0f", + "1f9d7-1f3fd-200d-2640-fe0f", + "1f9d7-1f3fe-200d-2640-fe0f", + "1f9d7-1f3ff-200d-2640-fe0f" + ] + }, + { n: ["fencer"], u: "1f93a" }, + { + n: ["horse racing"], + u: "1f3c7", + v: [ + "1f3c7-1f3fb", + "1f3c7-1f3fc", + "1f3c7-1f3fd", + "1f3c7-1f3fe", + "1f3c7-1f3ff" + ] + }, + { n: ["skier"], u: "26f7-fe0f" }, + { + n: ["snowboarder"], + u: "1f3c2", + v: [ + "1f3c2-1f3fb", + "1f3c2-1f3fc", + "1f3c2-1f3fd", + "1f3c2-1f3fe", + "1f3c2-1f3ff" + ] + }, + { + n: ["golfer", "person golfing"], + u: "1f3cc-fe0f", + v: [ + "1f3cc-1f3fb", + "1f3cc-1f3fc", + "1f3cc-1f3fd", + "1f3cc-1f3fe", + "1f3cc-1f3ff" + ] + }, + { + n: ["man golfing", "man-golfing"], + u: "1f3cc-fe0f-200d-2642-fe0f", + v: [ + "1f3cc-1f3fb-200d-2642-fe0f", + "1f3cc-1f3fc-200d-2642-fe0f", + "1f3cc-1f3fd-200d-2642-fe0f", + "1f3cc-1f3fe-200d-2642-fe0f", + "1f3cc-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman golfing", "woman-golfing"], + u: "1f3cc-fe0f-200d-2640-fe0f", + v: [ + "1f3cc-1f3fb-200d-2640-fe0f", + "1f3cc-1f3fc-200d-2640-fe0f", + "1f3cc-1f3fd-200d-2640-fe0f", + "1f3cc-1f3fe-200d-2640-fe0f", + "1f3cc-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["surfer"], + u: "1f3c4", + v: [ + "1f3c4-1f3fb", + "1f3c4-1f3fc", + "1f3c4-1f3fd", + "1f3c4-1f3fe", + "1f3c4-1f3ff" + ] + }, + { + n: ["man surfing", "man-surfing"], + u: "1f3c4-200d-2642-fe0f", + v: [ + "1f3c4-1f3fb-200d-2642-fe0f", + "1f3c4-1f3fc-200d-2642-fe0f", + "1f3c4-1f3fd-200d-2642-fe0f", + "1f3c4-1f3fe-200d-2642-fe0f", + "1f3c4-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman surfing", "woman-surfing"], + u: "1f3c4-200d-2640-fe0f", + v: [ + "1f3c4-1f3fb-200d-2640-fe0f", + "1f3c4-1f3fc-200d-2640-fe0f", + "1f3c4-1f3fd-200d-2640-fe0f", + "1f3c4-1f3fe-200d-2640-fe0f", + "1f3c4-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["rowboat"], + u: "1f6a3", + v: [ + "1f6a3-1f3fb", + "1f6a3-1f3fc", + "1f6a3-1f3fd", + "1f6a3-1f3fe", + "1f6a3-1f3ff" + ] + }, + { + n: ["man rowing boat", "man-rowing-boat"], + u: "1f6a3-200d-2642-fe0f", + v: [ + "1f6a3-1f3fb-200d-2642-fe0f", + "1f6a3-1f3fc-200d-2642-fe0f", + "1f6a3-1f3fd-200d-2642-fe0f", + "1f6a3-1f3fe-200d-2642-fe0f", + "1f6a3-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman rowing boat", "woman-rowing-boat"], + u: "1f6a3-200d-2640-fe0f", + v: [ + "1f6a3-1f3fb-200d-2640-fe0f", + "1f6a3-1f3fc-200d-2640-fe0f", + "1f6a3-1f3fd-200d-2640-fe0f", + "1f6a3-1f3fe-200d-2640-fe0f", + "1f6a3-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["swimmer"], + u: "1f3ca", + v: [ + "1f3ca-1f3fb", + "1f3ca-1f3fc", + "1f3ca-1f3fd", + "1f3ca-1f3fe", + "1f3ca-1f3ff" + ] + }, + { + n: ["man swimming", "man-swimming"], + u: "1f3ca-200d-2642-fe0f", + v: [ + "1f3ca-1f3fb-200d-2642-fe0f", + "1f3ca-1f3fc-200d-2642-fe0f", + "1f3ca-1f3fd-200d-2642-fe0f", + "1f3ca-1f3fe-200d-2642-fe0f", + "1f3ca-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman swimming", "woman-swimming"], + u: "1f3ca-200d-2640-fe0f", + v: [ + "1f3ca-1f3fb-200d-2640-fe0f", + "1f3ca-1f3fc-200d-2640-fe0f", + "1f3ca-1f3fd-200d-2640-fe0f", + "1f3ca-1f3fe-200d-2640-fe0f", + "1f3ca-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person with ball", "person bouncing ball"], + u: "26f9-fe0f", + v: ["26f9-1f3fb", "26f9-1f3fc", "26f9-1f3fd", "26f9-1f3fe", "26f9-1f3ff"] + }, + { + n: ["man bouncing ball", "man-bouncing-ball"], + u: "26f9-fe0f-200d-2642-fe0f", + v: [ + "26f9-1f3fb-200d-2642-fe0f", + "26f9-1f3fc-200d-2642-fe0f", + "26f9-1f3fd-200d-2642-fe0f", + "26f9-1f3fe-200d-2642-fe0f", + "26f9-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman bouncing ball", "woman-bouncing-ball"], + u: "26f9-fe0f-200d-2640-fe0f", + v: [ + "26f9-1f3fb-200d-2640-fe0f", + "26f9-1f3fc-200d-2640-fe0f", + "26f9-1f3fd-200d-2640-fe0f", + "26f9-1f3fe-200d-2640-fe0f", + "26f9-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["weight lifter", "person lifting weights"], + u: "1f3cb-fe0f", + v: [ + "1f3cb-1f3fb", + "1f3cb-1f3fc", + "1f3cb-1f3fd", + "1f3cb-1f3fe", + "1f3cb-1f3ff" + ] + }, + { + n: ["man lifting weights", "man-lifting-weights"], + u: "1f3cb-fe0f-200d-2642-fe0f", + v: [ + "1f3cb-1f3fb-200d-2642-fe0f", + "1f3cb-1f3fc-200d-2642-fe0f", + "1f3cb-1f3fd-200d-2642-fe0f", + "1f3cb-1f3fe-200d-2642-fe0f", + "1f3cb-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman lifting weights", "woman-lifting-weights"], + u: "1f3cb-fe0f-200d-2640-fe0f", + v: [ + "1f3cb-1f3fb-200d-2640-fe0f", + "1f3cb-1f3fc-200d-2640-fe0f", + "1f3cb-1f3fd-200d-2640-fe0f", + "1f3cb-1f3fe-200d-2640-fe0f", + "1f3cb-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["bicyclist"], + u: "1f6b4", + v: [ + "1f6b4-1f3fb", + "1f6b4-1f3fc", + "1f6b4-1f3fd", + "1f6b4-1f3fe", + "1f6b4-1f3ff" + ] + }, + { + n: ["man biking", "man-biking"], + u: "1f6b4-200d-2642-fe0f", + v: [ + "1f6b4-1f3fb-200d-2642-fe0f", + "1f6b4-1f3fc-200d-2642-fe0f", + "1f6b4-1f3fd-200d-2642-fe0f", + "1f6b4-1f3fe-200d-2642-fe0f", + "1f6b4-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman biking", "woman-biking"], + u: "1f6b4-200d-2640-fe0f", + v: [ + "1f6b4-1f3fb-200d-2640-fe0f", + "1f6b4-1f3fc-200d-2640-fe0f", + "1f6b4-1f3fd-200d-2640-fe0f", + "1f6b4-1f3fe-200d-2640-fe0f", + "1f6b4-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["mountain bicyclist"], + u: "1f6b5", + v: [ + "1f6b5-1f3fb", + "1f6b5-1f3fc", + "1f6b5-1f3fd", + "1f6b5-1f3fe", + "1f6b5-1f3ff" + ] + }, + { + n: ["man mountain biking", "man-mountain-biking"], + u: "1f6b5-200d-2642-fe0f", + v: [ + "1f6b5-1f3fb-200d-2642-fe0f", + "1f6b5-1f3fc-200d-2642-fe0f", + "1f6b5-1f3fd-200d-2642-fe0f", + "1f6b5-1f3fe-200d-2642-fe0f", + "1f6b5-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman mountain biking", "woman-mountain-biking"], + u: "1f6b5-200d-2640-fe0f", + v: [ + "1f6b5-1f3fb-200d-2640-fe0f", + "1f6b5-1f3fc-200d-2640-fe0f", + "1f6b5-1f3fd-200d-2640-fe0f", + "1f6b5-1f3fe-200d-2640-fe0f", + "1f6b5-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person doing cartwheel"], + u: "1f938", + v: [ + "1f938-1f3fb", + "1f938-1f3fc", + "1f938-1f3fd", + "1f938-1f3fe", + "1f938-1f3ff" + ] + }, + { + n: ["man cartwheeling", "man-cartwheeling"], + u: "1f938-200d-2642-fe0f", + v: [ + "1f938-1f3fb-200d-2642-fe0f", + "1f938-1f3fc-200d-2642-fe0f", + "1f938-1f3fd-200d-2642-fe0f", + "1f938-1f3fe-200d-2642-fe0f", + "1f938-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman cartwheeling", "woman-cartwheeling"], + u: "1f938-200d-2640-fe0f", + v: [ + "1f938-1f3fb-200d-2640-fe0f", + "1f938-1f3fc-200d-2640-fe0f", + "1f938-1f3fd-200d-2640-fe0f", + "1f938-1f3fe-200d-2640-fe0f", + "1f938-1f3ff-200d-2640-fe0f" + ] + }, + { n: ["wrestlers"], u: "1f93c" }, + { n: ["men wrestling", "man-wrestling"], u: "1f93c-200d-2642-fe0f" }, + { n: ["women wrestling", "woman-wrestling"], u: "1f93c-200d-2640-fe0f" }, + { + n: ["water polo"], + u: "1f93d", + v: [ + "1f93d-1f3fb", + "1f93d-1f3fc", + "1f93d-1f3fd", + "1f93d-1f3fe", + "1f93d-1f3ff" + ] + }, + { + n: ["man playing water polo", "man-playing-water-polo"], + u: "1f93d-200d-2642-fe0f", + v: [ + "1f93d-1f3fb-200d-2642-fe0f", + "1f93d-1f3fc-200d-2642-fe0f", + "1f93d-1f3fd-200d-2642-fe0f", + "1f93d-1f3fe-200d-2642-fe0f", + "1f93d-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman playing water polo", "woman-playing-water-polo"], + u: "1f93d-200d-2640-fe0f", + v: [ + "1f93d-1f3fb-200d-2640-fe0f", + "1f93d-1f3fc-200d-2640-fe0f", + "1f93d-1f3fd-200d-2640-fe0f", + "1f93d-1f3fe-200d-2640-fe0f", + "1f93d-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["handball"], + u: "1f93e", + v: [ + "1f93e-1f3fb", + "1f93e-1f3fc", + "1f93e-1f3fd", + "1f93e-1f3fe", + "1f93e-1f3ff" + ] + }, + { + n: ["man playing handball", "man-playing-handball"], + u: "1f93e-200d-2642-fe0f", + v: [ + "1f93e-1f3fb-200d-2642-fe0f", + "1f93e-1f3fc-200d-2642-fe0f", + "1f93e-1f3fd-200d-2642-fe0f", + "1f93e-1f3fe-200d-2642-fe0f", + "1f93e-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman playing handball", "woman-playing-handball"], + u: "1f93e-200d-2640-fe0f", + v: [ + "1f93e-1f3fb-200d-2640-fe0f", + "1f93e-1f3fc-200d-2640-fe0f", + "1f93e-1f3fd-200d-2640-fe0f", + "1f93e-1f3fe-200d-2640-fe0f", + "1f93e-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["juggling"], + u: "1f939", + v: [ + "1f939-1f3fb", + "1f939-1f3fc", + "1f939-1f3fd", + "1f939-1f3fe", + "1f939-1f3ff" + ] + }, + { + n: ["man juggling", "man-juggling"], + u: "1f939-200d-2642-fe0f", + v: [ + "1f939-1f3fb-200d-2642-fe0f", + "1f939-1f3fc-200d-2642-fe0f", + "1f939-1f3fd-200d-2642-fe0f", + "1f939-1f3fe-200d-2642-fe0f", + "1f939-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman juggling", "woman-juggling"], + u: "1f939-200d-2640-fe0f", + v: [ + "1f939-1f3fb-200d-2640-fe0f", + "1f939-1f3fc-200d-2640-fe0f", + "1f939-1f3fd-200d-2640-fe0f", + "1f939-1f3fe-200d-2640-fe0f", + "1f939-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["person in lotus position"], + u: "1f9d8", + v: [ + "1f9d8-1f3fb", + "1f9d8-1f3fc", + "1f9d8-1f3fd", + "1f9d8-1f3fe", + "1f9d8-1f3ff" + ] + }, + { + n: ["man in lotus position"], + u: "1f9d8-200d-2642-fe0f", + v: [ + "1f9d8-1f3fb-200d-2642-fe0f", + "1f9d8-1f3fc-200d-2642-fe0f", + "1f9d8-1f3fd-200d-2642-fe0f", + "1f9d8-1f3fe-200d-2642-fe0f", + "1f9d8-1f3ff-200d-2642-fe0f" + ] + }, + { + n: ["woman in lotus position"], + u: "1f9d8-200d-2640-fe0f", + v: [ + "1f9d8-1f3fb-200d-2640-fe0f", + "1f9d8-1f3fc-200d-2640-fe0f", + "1f9d8-1f3fd-200d-2640-fe0f", + "1f9d8-1f3fe-200d-2640-fe0f", + "1f9d8-1f3ff-200d-2640-fe0f" + ] + }, + { + n: ["bath"], + u: "1f6c0", + v: [ + "1f6c0-1f3fb", + "1f6c0-1f3fc", + "1f6c0-1f3fd", + "1f6c0-1f3fe", + "1f6c0-1f3ff" + ] + }, + { + n: ["sleeping accommodation"], + u: "1f6cc", + v: [ + "1f6cc-1f3fb", + "1f6cc-1f3fc", + "1f6cc-1f3fd", + "1f6cc-1f3fe", + "1f6cc-1f3ff" + ] + }, + { + n: ["people holding hands"], + u: "1f9d1-200d-1f91d-200d-1f9d1", + v: [ + "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fb", + "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fc", + "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fd", + "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3fe", + "1f9d1-1f3fb-200d-1f91d-200d-1f9d1-1f3ff", + "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fb", + "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fc", + "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fd", + "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fe", + "1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3ff", + "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fb", + "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fc", + "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fd", + "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3fe", + "1f9d1-1f3fd-200d-1f91d-200d-1f9d1-1f3ff", + "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fb", + "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fc", + "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fd", + "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3fe", + "1f9d1-1f3fe-200d-1f91d-200d-1f9d1-1f3ff", + "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fb", + "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fc", + "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fd", + "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3fe", + "1f9d1-1f3ff-200d-1f91d-200d-1f9d1-1f3ff" + ] + }, + { + n: ["women holding hands", "two women holding hands"], + u: "1f46d", + v: [ + "1f46d-1f3fb", + "1f46d-1f3fc", + "1f46d-1f3fd", + "1f46d-1f3fe", + "1f46d-1f3ff", + "1f469-1f3fb-200d-1f91d-200d-1f469-1f3fc", + "1f469-1f3fb-200d-1f91d-200d-1f469-1f3fd", + "1f469-1f3fb-200d-1f91d-200d-1f469-1f3fe", + "1f469-1f3fb-200d-1f91d-200d-1f469-1f3ff", + "1f469-1f3fc-200d-1f91d-200d-1f469-1f3fb", + "1f469-1f3fc-200d-1f91d-200d-1f469-1f3fd", + "1f469-1f3fc-200d-1f91d-200d-1f469-1f3fe", + "1f469-1f3fc-200d-1f91d-200d-1f469-1f3ff", + "1f469-1f3fd-200d-1f91d-200d-1f469-1f3fb", + "1f469-1f3fd-200d-1f91d-200d-1f469-1f3fc", + "1f469-1f3fd-200d-1f91d-200d-1f469-1f3fe", + "1f469-1f3fd-200d-1f91d-200d-1f469-1f3ff", + "1f469-1f3fe-200d-1f91d-200d-1f469-1f3fb", + "1f469-1f3fe-200d-1f91d-200d-1f469-1f3fc", + "1f469-1f3fe-200d-1f91d-200d-1f469-1f3fd", + "1f469-1f3fe-200d-1f91d-200d-1f469-1f3ff", + "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fb", + "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fc", + "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fd", + "1f469-1f3ff-200d-1f91d-200d-1f469-1f3fe" + ] + }, + { + n: [ + "couple", + "man and woman holding hands", + "woman and man holding hands" + ], + u: "1f46b", + v: [ + "1f46b-1f3fb", + "1f46b-1f3fc", + "1f46b-1f3fd", + "1f46b-1f3fe", + "1f46b-1f3ff", + "1f469-1f3fb-200d-1f91d-200d-1f468-1f3fc", + "1f469-1f3fb-200d-1f91d-200d-1f468-1f3fd", + "1f469-1f3fb-200d-1f91d-200d-1f468-1f3fe", + "1f469-1f3fb-200d-1f91d-200d-1f468-1f3ff", + "1f469-1f3fc-200d-1f91d-200d-1f468-1f3fb", + "1f469-1f3fc-200d-1f91d-200d-1f468-1f3fd", + "1f469-1f3fc-200d-1f91d-200d-1f468-1f3fe", + "1f469-1f3fc-200d-1f91d-200d-1f468-1f3ff", + "1f469-1f3fd-200d-1f91d-200d-1f468-1f3fb", + "1f469-1f3fd-200d-1f91d-200d-1f468-1f3fc", + "1f469-1f3fd-200d-1f91d-200d-1f468-1f3fe", + "1f469-1f3fd-200d-1f91d-200d-1f468-1f3ff", + "1f469-1f3fe-200d-1f91d-200d-1f468-1f3fb", + "1f469-1f3fe-200d-1f91d-200d-1f468-1f3fc", + "1f469-1f3fe-200d-1f91d-200d-1f468-1f3fd", + "1f469-1f3fe-200d-1f91d-200d-1f468-1f3ff", + "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fb", + "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fc", + "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fd", + "1f469-1f3ff-200d-1f91d-200d-1f468-1f3fe" + ] + }, + { + n: ["men holding hands", "two men holding hands"], + u: "1f46c", + v: [ + "1f46c-1f3fb", + "1f46c-1f3fc", + "1f46c-1f3fd", + "1f46c-1f3fe", + "1f46c-1f3ff", + "1f468-1f3fb-200d-1f91d-200d-1f468-1f3fc", + "1f468-1f3fb-200d-1f91d-200d-1f468-1f3fd", + "1f468-1f3fb-200d-1f91d-200d-1f468-1f3fe", + "1f468-1f3fb-200d-1f91d-200d-1f468-1f3ff", + "1f468-1f3fc-200d-1f91d-200d-1f468-1f3fb", + "1f468-1f3fc-200d-1f91d-200d-1f468-1f3fd", + "1f468-1f3fc-200d-1f91d-200d-1f468-1f3fe", + "1f468-1f3fc-200d-1f91d-200d-1f468-1f3ff", + "1f468-1f3fd-200d-1f91d-200d-1f468-1f3fb", + "1f468-1f3fd-200d-1f91d-200d-1f468-1f3fc", + "1f468-1f3fd-200d-1f91d-200d-1f468-1f3fe", + "1f468-1f3fd-200d-1f91d-200d-1f468-1f3ff", + "1f468-1f3fe-200d-1f91d-200d-1f468-1f3fb", + "1f468-1f3fe-200d-1f91d-200d-1f468-1f3fc", + "1f468-1f3fe-200d-1f91d-200d-1f468-1f3fd", + "1f468-1f3fe-200d-1f91d-200d-1f468-1f3ff", + "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fb", + "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fc", + "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fd", + "1f468-1f3ff-200d-1f91d-200d-1f468-1f3fe" + ] + }, + { + n: ["kiss", "couplekiss"], + u: "1f48f", + v: [ + "1f48f-1f3fb", + "1f48f-1f3fc", + "1f48f-1f3fd", + "1f48f-1f3fe", + "1f48f-1f3ff", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3ff", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fb", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fc", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fd", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f9d1-1f3fe" + ] + }, + { + n: ["woman-kiss-man", "kiss: woman, man"], + u: "1f469-200d-2764-fe0f-200d-1f48b-200d-1f468", + v: [ + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff" + ] + }, + { + n: ["man-kiss-man", "kiss: man, man"], + u: "1f468-200d-2764-fe0f-200d-1f48b-200d-1f468", + v: [ + "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f468-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f468-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f468-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f468-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff", + "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fb", + "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fc", + "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fd", + "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3fe", + "1f468-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f468-1f3ff" + ] + }, + { + n: ["woman-kiss-woman", "kiss: woman, woman"], + u: "1f469-200d-2764-fe0f-200d-1f48b-200d-1f469", + v: [ + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", + "1f469-1f3fb-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", + "1f469-1f3fc-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", + "1f469-1f3fd-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", + "1f469-1f3fe-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fb", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fc", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fd", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3fe", + "1f469-1f3ff-200d-2764-fe0f-200d-1f48b-200d-1f469-1f3ff" + ] + }, + { + n: ["couple with heart"], + u: "1f491", + v: [ + "1f491-1f3fb", + "1f491-1f3fc", + "1f491-1f3fd", + "1f491-1f3fe", + "1f491-1f3ff", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3fc", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3fd", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3fe", + "1f9d1-1f3fb-200d-2764-fe0f-200d-1f9d1-1f3ff", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3fb", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3fd", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3fe", + "1f9d1-1f3fc-200d-2764-fe0f-200d-1f9d1-1f3ff", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3fb", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3fc", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3fe", + "1f9d1-1f3fd-200d-2764-fe0f-200d-1f9d1-1f3ff", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3fb", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3fc", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3fd", + "1f9d1-1f3fe-200d-2764-fe0f-200d-1f9d1-1f3ff", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fb", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fc", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fd", + "1f9d1-1f3ff-200d-2764-fe0f-200d-1f9d1-1f3fe" + ] + }, + { + n: ["woman-heart-man", "couple with heart: woman, man"], + u: "1f469-200d-2764-fe0f-200d-1f468", + v: [ + "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fb", + "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fc", + "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fd", + "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3fe", + "1f469-1f3fb-200d-2764-fe0f-200d-1f468-1f3ff", + "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fb", + "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fc", + "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fd", + "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3fe", + "1f469-1f3fc-200d-2764-fe0f-200d-1f468-1f3ff", + "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fb", + "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fc", + "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fd", + "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3fe", + "1f469-1f3fd-200d-2764-fe0f-200d-1f468-1f3ff", + "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fb", + "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fc", + "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fd", + "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3fe", + "1f469-1f3fe-200d-2764-fe0f-200d-1f468-1f3ff", + "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fb", + "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fc", + "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fd", + "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3fe", + "1f469-1f3ff-200d-2764-fe0f-200d-1f468-1f3ff" + ] + }, + { + n: ["man-heart-man", "couple with heart: man, man"], + u: "1f468-200d-2764-fe0f-200d-1f468", + v: [ + "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fb", + "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fc", + "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fd", + "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3fe", + "1f468-1f3fb-200d-2764-fe0f-200d-1f468-1f3ff", + "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fb", + "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fc", + "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fd", + "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3fe", + "1f468-1f3fc-200d-2764-fe0f-200d-1f468-1f3ff", + "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fb", + "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fc", + "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fd", + "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3fe", + "1f468-1f3fd-200d-2764-fe0f-200d-1f468-1f3ff", + "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fb", + "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fc", + "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fd", + "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3fe", + "1f468-1f3fe-200d-2764-fe0f-200d-1f468-1f3ff", + "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fb", + "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fc", + "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fd", + "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3fe", + "1f468-1f3ff-200d-2764-fe0f-200d-1f468-1f3ff" + ] + }, + { + n: ["woman-heart-woman", "couple with heart: woman, woman"], + u: "1f469-200d-2764-fe0f-200d-1f469", + v: [ + "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fb", + "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fc", + "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fd", + "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3fe", + "1f469-1f3fb-200d-2764-fe0f-200d-1f469-1f3ff", + "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fb", + "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fc", + "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fd", + "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3fe", + "1f469-1f3fc-200d-2764-fe0f-200d-1f469-1f3ff", + "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fb", + "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fc", + "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fd", + "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3fe", + "1f469-1f3fd-200d-2764-fe0f-200d-1f469-1f3ff", + "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fb", + "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fc", + "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fd", + "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3fe", + "1f469-1f3fe-200d-2764-fe0f-200d-1f469-1f3ff", + "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fb", + "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fc", + "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fd", + "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3fe", + "1f469-1f3ff-200d-2764-fe0f-200d-1f469-1f3ff" + ] + }, + { n: ["family"], u: "1f46a" }, + { + n: ["man-woman-boy", "family: man, woman, boy"], + u: "1f468-200d-1f469-200d-1f466" + }, + { + n: ["man-woman-girl", "family: man, woman, girl"], + u: "1f468-200d-1f469-200d-1f467" + }, + { + n: ["man-woman-girl-boy", "family: man, woman, girl, boy"], + u: "1f468-200d-1f469-200d-1f467-200d-1f466" + }, + { + n: ["man-woman-boy-boy", "family: man, woman, boy, boy"], + u: "1f468-200d-1f469-200d-1f466-200d-1f466" + }, + { + n: ["man-woman-girl-girl", "family: man, woman, girl, girl"], + u: "1f468-200d-1f469-200d-1f467-200d-1f467" + }, + { + n: ["man-man-boy", "family: man, man, boy"], + u: "1f468-200d-1f468-200d-1f466" + }, + { + n: ["man-man-girl", "family: man, man, girl"], + u: "1f468-200d-1f468-200d-1f467" + }, + { + n: ["man-man-girl-boy", "family: man, man, girl, boy"], + u: "1f468-200d-1f468-200d-1f467-200d-1f466" + }, + { + n: ["man-man-boy-boy", "family: man, man, boy, boy"], + u: "1f468-200d-1f468-200d-1f466-200d-1f466" + }, + { + n: ["man-man-girl-girl", "family: man, man, girl, girl"], + u: "1f468-200d-1f468-200d-1f467-200d-1f467" + }, + { + n: ["woman-woman-boy", "family: woman, woman, boy"], + u: "1f469-200d-1f469-200d-1f466" + }, + { + n: ["woman-woman-girl", "family: woman, woman, girl"], + u: "1f469-200d-1f469-200d-1f467" + }, + { + n: ["woman-woman-girl-boy", "family: woman, woman, girl, boy"], + u: "1f469-200d-1f469-200d-1f467-200d-1f466" + }, + { + n: ["woman-woman-boy-boy", "family: woman, woman, boy, boy"], + u: "1f469-200d-1f469-200d-1f466-200d-1f466" + }, + { + n: ["woman-woman-girl-girl", "family: woman, woman, girl, girl"], + u: "1f469-200d-1f469-200d-1f467-200d-1f467" + }, + { n: ["man-boy", "family: man, boy"], u: "1f468-200d-1f466" }, + { + n: ["man-boy-boy", "family: man, boy, boy"], + u: "1f468-200d-1f466-200d-1f466" + }, + { n: ["man-girl", "family: man, girl"], u: "1f468-200d-1f467" }, + { + n: ["man-girl-boy", "family: man, girl, boy"], + u: "1f468-200d-1f467-200d-1f466" + }, + { + n: ["man-girl-girl", "family: man, girl, girl"], + u: "1f468-200d-1f467-200d-1f467" + }, + { n: ["woman-boy", "family: woman, boy"], u: "1f469-200d-1f466" }, + { + n: ["woman-boy-boy", "family: woman, boy, boy"], + u: "1f469-200d-1f466-200d-1f466" + }, + { n: ["woman-girl", "family: woman, girl"], u: "1f469-200d-1f467" }, + { + n: ["woman-girl-boy", "family: woman, girl, boy"], + u: "1f469-200d-1f467-200d-1f466" + }, + { + n: ["woman-girl-girl", "family: woman, girl, girl"], + u: "1f469-200d-1f467-200d-1f467" + }, + { n: ["speaking head", "speaking head in silhouette"], u: "1f5e3-fe0f" }, + { n: ["bust in silhouette"], u: "1f464" }, + { n: ["busts in silhouette"], u: "1f465" }, + { n: ["people hugging"], u: "1fac2" }, + { n: ["footprints"], u: "1f463" } + ], + animals_nature: [ + { n: ["monkey face"], u: "1f435" }, + { n: ["monkey"], u: "1f412" }, + { n: ["gorilla"], u: "1f98d" }, + { n: ["orangutan"], u: "1f9a7" }, + { n: ["dog", "dog face"], u: "1f436" }, + { n: ["dog", "dog2"], u: "1f415" }, + { n: ["guide dog"], u: "1f9ae" }, + { n: ["service dog"], u: "1f415-200d-1f9ba" }, + { n: ["poodle"], u: "1f429" }, + { n: ["wolf", "wolf face"], u: "1f43a" }, + { n: ["fox face"], u: "1f98a" }, + { n: ["raccoon"], u: "1f99d" }, + { n: ["cat", "cat face"], u: "1f431" }, + { n: ["cat", "cat2"], u: "1f408" }, + { n: ["black cat"], u: "1f408-200d-2b1b" }, + { n: ["lion face"], u: "1f981" }, + { n: ["tiger", "tiger face"], u: "1f42f" }, + { n: ["tiger", "tiger2"], u: "1f405" }, + { n: ["leopard"], u: "1f406" }, + { n: ["horse", "horse face"], u: "1f434" }, + { n: ["horse", "racehorse"], u: "1f40e" }, + { n: ["unicorn face"], u: "1f984" }, + { n: ["zebra face"], u: "1f993" }, + { n: ["deer"], u: "1f98c" }, + { n: ["bison"], u: "1f9ac" }, + { n: ["cow", "cow face"], u: "1f42e" }, + { n: ["ox"], u: "1f402" }, + { n: ["water buffalo"], u: "1f403" }, + { n: ["cow", "cow2"], u: "1f404" }, + { n: ["pig", "pig face"], u: "1f437" }, + { n: ["pig", "pig2"], u: "1f416" }, + { n: ["boar"], u: "1f417" }, + { n: ["pig nose"], u: "1f43d" }, + { n: ["ram"], u: "1f40f" }, + { n: ["sheep"], u: "1f411" }, + { n: ["goat"], u: "1f410" }, + { n: ["dromedary camel"], u: "1f42a" }, + { n: ["camel", "bactrian camel"], u: "1f42b" }, + { n: ["llama"], u: "1f999" }, + { n: ["giraffe face"], u: "1f992" }, + { n: ["elephant"], u: "1f418" }, + { n: ["mammoth"], u: "1f9a3" }, + { n: ["rhinoceros"], u: "1f98f" }, + { n: ["hippopotamus"], u: "1f99b" }, + { n: ["mouse", "mouse face"], u: "1f42d" }, + { n: ["mouse", "mouse2"], u: "1f401" }, + { n: ["rat"], u: "1f400" }, + { n: ["hamster", "hamster face"], u: "1f439" }, + { n: ["rabbit", "rabbit face"], u: "1f430" }, + { n: ["rabbit", "rabbit2"], u: "1f407" }, + { n: ["chipmunk"], u: "1f43f-fe0f" }, + { n: ["beaver"], u: "1f9ab" }, + { n: ["hedgehog"], u: "1f994" }, + { n: ["bat"], u: "1f987" }, + { n: ["bear", "bear face"], u: "1f43b" }, + { n: ["polar bear"], u: "1f43b-200d-2744-fe0f" }, + { n: ["koala"], u: "1f428" }, + { n: ["panda face"], u: "1f43c" }, + { n: ["sloth"], u: "1f9a5" }, + { n: ["otter"], u: "1f9a6" }, + { n: ["skunk"], u: "1f9a8" }, + { n: ["kangaroo"], u: "1f998" }, + { n: ["badger"], u: "1f9a1" }, + { n: ["feet", "paw prints"], u: "1f43e" }, + { n: ["turkey"], u: "1f983" }, + { n: ["chicken"], u: "1f414" }, + { n: ["rooster"], u: "1f413" }, + { n: ["hatching chick"], u: "1f423" }, + { n: ["baby chick"], u: "1f424" }, + { n: ["hatched chick", "front-facing baby chick"], u: "1f425" }, + { n: ["bird"], u: "1f426" }, + { n: ["penguin"], u: "1f427" }, + { n: ["dove", "dove of peace"], u: "1f54a-fe0f" }, + { n: ["eagle"], u: "1f985" }, + { n: ["duck"], u: "1f986" }, + { n: ["swan"], u: "1f9a2" }, + { n: ["owl"], u: "1f989" }, + { n: ["dodo"], u: "1f9a4" }, + { n: ["feather"], u: "1fab6" }, + { n: ["flamingo"], u: "1f9a9" }, + { n: ["peacock"], u: "1f99a" }, + { n: ["parrot"], u: "1f99c" }, + { n: ["frog", "frog face"], u: "1f438" }, + { n: ["crocodile"], u: "1f40a" }, + { n: ["turtle"], u: "1f422" }, + { n: ["lizard"], u: "1f98e" }, + { n: ["snake"], u: "1f40d" }, + { n: ["dragon face"], u: "1f432" }, + { n: ["dragon"], u: "1f409" }, + { n: ["sauropod"], u: "1f995" }, + { n: ["t-rex"], u: "1f996" }, + { n: ["whale", "spouting whale"], u: "1f433" }, + { n: ["whale", "whale2"], u: "1f40b" }, + { n: ["dolphin", "flipper"], u: "1f42c" }, + { n: ["seal"], u: "1f9ad" }, + { n: ["fish"], u: "1f41f" }, + { n: ["tropical fish"], u: "1f420" }, + { n: ["blowfish"], u: "1f421" }, + { n: ["shark"], u: "1f988" }, + { n: ["octopus"], u: "1f419" }, + { n: ["shell", "spiral shell"], u: "1f41a" }, + { n: ["coral"], u: "1fab8" }, + { n: ["snail"], u: "1f40c" }, + { n: ["butterfly"], u: "1f98b" }, + { n: ["bug"], u: "1f41b" }, + { n: ["ant"], u: "1f41c" }, + { n: ["bee", "honeybee"], u: "1f41d" }, + { n: ["beetle"], u: "1fab2" }, + { n: ["ladybug", "lady beetle"], u: "1f41e" }, + { n: ["cricket"], u: "1f997" }, + { n: ["cockroach"], u: "1fab3" }, + { n: ["spider"], u: "1f577-fe0f" }, + { n: ["spider web"], u: "1f578-fe0f" }, + { n: ["scorpion"], u: "1f982" }, + { n: ["mosquito"], u: "1f99f" }, + { n: ["fly"], u: "1fab0" }, + { n: ["worm"], u: "1fab1" }, + { n: ["microbe"], u: "1f9a0" }, + { n: ["bouquet"], u: "1f490" }, + { n: ["cherry blossom"], u: "1f338" }, + { n: ["white flower"], u: "1f4ae" }, + { n: ["lotus"], u: "1fab7" }, + { n: ["rosette"], u: "1f3f5-fe0f" }, + { n: ["rose"], u: "1f339" }, + { n: ["wilted flower"], u: "1f940" }, + { n: ["hibiscus"], u: "1f33a" }, + { n: ["sunflower"], u: "1f33b" }, + { n: ["blossom"], u: "1f33c" }, + { n: ["tulip"], u: "1f337" }, + { n: ["seedling"], u: "1f331" }, + { n: ["potted plant"], u: "1fab4" }, + { n: ["evergreen tree"], u: "1f332" }, + { n: ["deciduous tree"], u: "1f333" }, + { n: ["palm tree"], u: "1f334" }, + { n: ["cactus"], u: "1f335" }, + { n: ["ear of rice"], u: "1f33e" }, + { n: ["herb"], u: "1f33f" }, + { n: ["shamrock"], u: "2618-fe0f" }, + { n: ["four leaf clover"], u: "1f340" }, + { n: ["maple leaf"], u: "1f341" }, + { n: ["fallen leaf"], u: "1f342" }, + { n: ["leaves", "leaf fluttering in wind"], u: "1f343" }, + { n: ["empty nest"], u: "1fab9" }, + { n: ["nest with eggs"], u: "1faba" } + ], + food_drink: [ + { n: ["grapes"], u: "1f347" }, + { n: ["melon"], u: "1f348" }, + { n: ["watermelon"], u: "1f349" }, + { n: ["tangerine"], u: "1f34a" }, + { n: ["lemon"], u: "1f34b" }, + { n: ["banana"], u: "1f34c" }, + { n: ["pineapple"], u: "1f34d" }, + { n: ["mango"], u: "1f96d" }, + { n: ["apple", "red apple"], u: "1f34e" }, + { n: ["green apple"], u: "1f34f" }, + { n: ["pear"], u: "1f350" }, + { n: ["peach"], u: "1f351" }, + { n: ["cherries"], u: "1f352" }, + { n: ["strawberry"], u: "1f353" }, + { n: ["blueberries"], u: "1fad0" }, + { n: ["kiwifruit"], u: "1f95d" }, + { n: ["tomato"], u: "1f345" }, + { n: ["olive"], u: "1fad2" }, + { n: ["coconut"], u: "1f965" }, + { n: ["avocado"], u: "1f951" }, + { n: ["eggplant", "aubergine"], u: "1f346" }, + { n: ["potato"], u: "1f954" }, + { n: ["carrot"], u: "1f955" }, + { n: ["corn", "ear of maize"], u: "1f33d" }, + { n: ["hot pepper"], u: "1f336-fe0f" }, + { n: ["bell pepper"], u: "1fad1" }, + { n: ["cucumber"], u: "1f952" }, + { n: ["leafy green"], u: "1f96c" }, + { n: ["broccoli"], u: "1f966" }, + { n: ["garlic"], u: "1f9c4" }, + { n: ["onion"], u: "1f9c5" }, + { n: ["mushroom"], u: "1f344" }, + { n: ["peanuts"], u: "1f95c" }, + { n: ["beans"], u: "1fad8" }, + { n: ["chestnut"], u: "1f330" }, + { n: ["bread"], u: "1f35e" }, + { n: ["croissant"], u: "1f950" }, + { n: ["baguette bread"], u: "1f956" }, + { n: ["flatbread"], u: "1fad3" }, + { n: ["pretzel"], u: "1f968" }, + { n: ["bagel"], u: "1f96f" }, + { n: ["pancakes"], u: "1f95e" }, + { n: ["waffle"], u: "1f9c7" }, + { n: ["cheese wedge"], u: "1f9c0" }, + { n: ["meat on bone"], u: "1f356" }, + { n: ["poultry leg"], u: "1f357" }, + { n: ["cut of meat"], u: "1f969" }, + { n: ["bacon"], u: "1f953" }, + { n: ["hamburger"], u: "1f354" }, + { n: ["fries", "french fries"], u: "1f35f" }, + { n: ["pizza", "slice of pizza"], u: "1f355" }, + { n: ["hotdog", "hot dog"], u: "1f32d" }, + { n: ["sandwich"], u: "1f96a" }, + { n: ["taco"], u: "1f32e" }, + { n: ["burrito"], u: "1f32f" }, + { n: ["tamale"], u: "1fad4" }, + { n: ["stuffed flatbread"], u: "1f959" }, + { n: ["falafel"], u: "1f9c6" }, + { n: ["egg"], u: "1f95a" }, + { n: ["cooking", "fried egg"], u: "1f373" }, + { n: ["shallow pan of food"], u: "1f958" }, + { n: ["stew", "pot of food"], u: "1f372" }, + { n: ["fondue"], u: "1fad5" }, + { n: ["bowl with spoon"], u: "1f963" }, + { n: ["green salad"], u: "1f957" }, + { n: ["popcorn"], u: "1f37f" }, + { n: ["butter"], u: "1f9c8" }, + { n: ["salt", "salt shaker"], u: "1f9c2" }, + { n: ["canned food"], u: "1f96b" }, + { n: ["bento", "bento box"], u: "1f371" }, + { n: ["rice cracker"], u: "1f358" }, + { n: ["rice ball"], u: "1f359" }, + { n: ["rice", "cooked rice"], u: "1f35a" }, + { n: ["curry", "curry and rice"], u: "1f35b" }, + { n: ["ramen", "steaming bowl"], u: "1f35c" }, + { n: ["spaghetti"], u: "1f35d" }, + { n: ["sweet potato", "roasted sweet potato"], u: "1f360" }, + { n: ["oden"], u: "1f362" }, + { n: ["sushi"], u: "1f363" }, + { n: ["fried shrimp"], u: "1f364" }, + { n: ["fish cake", "fish cake with swirl design"], u: "1f365" }, + { n: ["moon cake"], u: "1f96e" }, + { n: ["dango"], u: "1f361" }, + { n: ["dumpling"], u: "1f95f" }, + { n: ["fortune cookie"], u: "1f960" }, + { n: ["takeout box"], u: "1f961" }, + { n: ["crab"], u: "1f980" }, + { n: ["lobster"], u: "1f99e" }, + { n: ["shrimp"], u: "1f990" }, + { n: ["squid"], u: "1f991" }, + { n: ["oyster"], u: "1f9aa" }, + { n: ["icecream", "soft ice cream"], u: "1f366" }, + { n: ["shaved ice"], u: "1f367" }, + { n: ["ice cream"], u: "1f368" }, + { n: ["doughnut"], u: "1f369" }, + { n: ["cookie"], u: "1f36a" }, + { n: ["birthday", "birthday cake"], u: "1f382" }, + { n: ["cake", "shortcake"], u: "1f370" }, + { n: ["cupcake"], u: "1f9c1" }, + { n: ["pie"], u: "1f967" }, + { n: ["chocolate bar"], u: "1f36b" }, + { n: ["candy"], u: "1f36c" }, + { n: ["lollipop"], u: "1f36d" }, + { n: ["custard"], u: "1f36e" }, + { n: ["honey pot"], u: "1f36f" }, + { n: ["baby bottle"], u: "1f37c" }, + { n: ["glass of milk"], u: "1f95b" }, + { n: ["coffee", "hot beverage"], u: "2615" }, + { n: ["teapot"], u: "1fad6" }, + { n: ["tea", "teacup without handle"], u: "1f375" }, + { n: ["sake", "sake bottle and cup"], u: "1f376" }, + { n: ["champagne", "bottle with popping cork"], u: "1f37e" }, + { n: ["wine glass"], u: "1f377" }, + { n: ["cocktail", "cocktail glass"], u: "1f378" }, + { n: ["tropical drink"], u: "1f379" }, + { n: ["beer", "beer mug"], u: "1f37a" }, + { n: ["beers", "clinking beer mugs"], u: "1f37b" }, + { n: ["clinking glasses"], u: "1f942" }, + { n: ["tumbler glass"], u: "1f943" }, + { n: ["pouring liquid"], u: "1fad7" }, + { n: ["cup with straw"], u: "1f964" }, + { n: ["bubble tea"], u: "1f9cb" }, + { n: ["beverage box"], u: "1f9c3" }, + { n: ["mate drink"], u: "1f9c9" }, + { n: ["ice cube"], u: "1f9ca" }, + { n: ["chopsticks"], u: "1f962" }, + { n: ["knife fork plate", "fork and knife with plate"], u: "1f37d-fe0f" }, + { n: ["fork and knife"], u: "1f374" }, + { n: ["spoon"], u: "1f944" }, + { n: ["hocho", "knife"], u: "1f52a" }, + { n: ["jar"], u: "1fad9" }, + { n: ["amphora"], u: "1f3fa" } + ], + travel_places: [ + { n: ["earth africa", "earth globe europe-africa"], u: "1f30d" }, + { n: ["earth americas", "earth globe americas"], u: "1f30e" }, + { n: ["earth asia", "earth globe asia-australia"], u: "1f30f" }, + { n: ["globe with meridians"], u: "1f310" }, + { n: ["world map"], u: "1f5fa-fe0f" }, + { n: ["japan", "silhouette of japan"], u: "1f5fe" }, + { n: ["compass"], u: "1f9ed" }, + { n: ["snow-capped mountain", "snow capped mountain"], u: "1f3d4-fe0f" }, + { n: ["mountain"], u: "26f0-fe0f" }, + { n: ["volcano"], u: "1f30b" }, + { n: ["mount fuji"], u: "1f5fb" }, + { n: ["camping"], u: "1f3d5-fe0f" }, + { n: ["beach with umbrella"], u: "1f3d6-fe0f" }, + { n: ["desert"], u: "1f3dc-fe0f" }, + { n: ["desert island"], u: "1f3dd-fe0f" }, + { n: ["national park"], u: "1f3de-fe0f" }, + { n: ["stadium"], u: "1f3df-fe0f" }, + { n: ["classical building"], u: "1f3db-fe0f" }, + { n: ["building construction"], u: "1f3d7-fe0f" }, + { n: ["brick", "bricks"], u: "1f9f1" }, + { n: ["rock"], u: "1faa8" }, + { n: ["wood"], u: "1fab5" }, + { n: ["hut"], u: "1f6d6" }, + { n: ["houses", "house buildings"], u: "1f3d8-fe0f" }, + { n: ["derelict house", "derelict house building"], u: "1f3da-fe0f" }, + { n: ["house", "house building"], u: "1f3e0" }, + { n: ["house with garden"], u: "1f3e1" }, + { n: ["office", "office building"], u: "1f3e2" }, + { n: ["post office", "japanese post office"], u: "1f3e3" }, + { n: ["european post office"], u: "1f3e4" }, + { n: ["hospital"], u: "1f3e5" }, + { n: ["bank"], u: "1f3e6" }, + { n: ["hotel"], u: "1f3e8" }, + { n: ["love hotel"], u: "1f3e9" }, + { n: ["convenience store"], u: "1f3ea" }, + { n: ["school"], u: "1f3eb" }, + { n: ["department store"], u: "1f3ec" }, + { n: ["factory"], u: "1f3ed" }, + { n: ["japanese castle"], u: "1f3ef" }, + { n: ["european castle"], u: "1f3f0" }, + { n: ["wedding"], u: "1f492" }, + { n: ["tokyo tower"], u: "1f5fc" }, + { n: ["statue of liberty"], u: "1f5fd" }, + { n: ["church"], u: "26ea" }, + { n: ["mosque"], u: "1f54c" }, + { n: ["hindu temple"], u: "1f6d5" }, + { n: ["synagogue"], u: "1f54d" }, + { n: ["shinto shrine"], u: "26e9-fe0f" }, + { n: ["kaaba"], u: "1f54b" }, + { n: ["fountain"], u: "26f2" }, + { n: ["tent"], u: "26fa" }, + { n: ["foggy"], u: "1f301" }, + { n: ["night with stars"], u: "1f303" }, + { n: ["cityscape"], u: "1f3d9-fe0f" }, + { n: ["sunrise over mountains"], u: "1f304" }, + { n: ["sunrise"], u: "1f305" }, + { n: ["city sunset", "cityscape at dusk"], u: "1f306" }, + { n: ["city sunrise", "sunset over buildings"], u: "1f307" }, + { n: ["bridge at night"], u: "1f309" }, + { n: ["hotsprings", "hot springs"], u: "2668-fe0f" }, + { n: ["carousel horse"], u: "1f3a0" }, + { n: ["playground slide"], u: "1f6dd" }, + { n: ["ferris wheel"], u: "1f3a1" }, + { n: ["roller coaster"], u: "1f3a2" }, + { n: ["barber", "barber pole"], u: "1f488" }, + { n: ["circus tent"], u: "1f3aa" }, + { n: ["steam locomotive"], u: "1f682" }, + { n: ["railway car"], u: "1f683" }, + { n: ["high-speed train", "bullettrain side"], u: "1f684" }, + { + n: ["bullettrain front", "high-speed train with bullet nose"], + u: "1f685" + }, + { n: ["train", "train2"], u: "1f686" }, + { n: ["metro"], u: "1f687" }, + { n: ["light rail"], u: "1f688" }, + { n: ["station"], u: "1f689" }, + { n: ["tram"], u: "1f68a" }, + { n: ["monorail"], u: "1f69d" }, + { n: ["mountain railway"], u: "1f69e" }, + { n: ["train", "tram car"], u: "1f68b" }, + { n: ["bus"], u: "1f68c" }, + { n: ["oncoming bus"], u: "1f68d" }, + { n: ["trolleybus"], u: "1f68e" }, + { n: ["minibus"], u: "1f690" }, + { n: ["ambulance"], u: "1f691" }, + { n: ["fire engine"], u: "1f692" }, + { n: ["police car"], u: "1f693" }, + { n: ["oncoming police car"], u: "1f694" }, + { n: ["taxi"], u: "1f695" }, + { n: ["oncoming taxi"], u: "1f696" }, + { n: ["car", "red car", "automobile"], u: "1f697" }, + { n: ["oncoming automobile"], u: "1f698" }, + { n: ["blue car", "recreational vehicle"], u: "1f699" }, + { n: ["pickup truck"], u: "1f6fb" }, + { n: ["truck", "delivery truck"], u: "1f69a" }, + { n: ["articulated lorry"], u: "1f69b" }, + { n: ["tractor"], u: "1f69c" }, + { n: ["racing car"], u: "1f3ce-fe0f" }, + { n: ["motorcycle", "racing motorcycle"], u: "1f3cd-fe0f" }, + { n: ["motor scooter"], u: "1f6f5" }, + { n: ["manual wheelchair"], u: "1f9bd" }, + { n: ["motorized wheelchair"], u: "1f9bc" }, + { n: ["auto rickshaw"], u: "1f6fa" }, + { n: ["bike", "bicycle"], u: "1f6b2" }, + { n: ["scooter"], u: "1f6f4" }, + { n: ["skateboard"], u: "1f6f9" }, + { n: ["roller skate"], u: "1f6fc" }, + { n: ["busstop", "bus stop"], u: "1f68f" }, + { n: ["motorway"], u: "1f6e3-fe0f" }, + { n: ["railway track"], u: "1f6e4-fe0f" }, + { n: ["oil drum"], u: "1f6e2-fe0f" }, + { n: ["fuelpump", "fuel pump"], u: "26fd" }, + { n: ["wheel"], u: "1f6de" }, + { n: ["rotating light", "police cars revolving light"], u: "1f6a8" }, + { n: ["traffic light", "horizontal traffic light"], u: "1f6a5" }, + { n: ["vertical traffic light"], u: "1f6a6" }, + { n: ["octagonal sign"], u: "1f6d1" }, + { n: ["construction", "construction sign"], u: "1f6a7" }, + { n: ["anchor"], u: "2693" }, + { n: ["ring buoy"], u: "1f6df" }, + { n: ["boat", "sailboat"], u: "26f5" }, + { n: ["canoe"], u: "1f6f6" }, + { n: ["speedboat"], u: "1f6a4" }, + { n: ["passenger ship"], u: "1f6f3-fe0f" }, + { n: ["ferry"], u: "26f4-fe0f" }, + { n: ["motor boat"], u: "1f6e5-fe0f" }, + { n: ["ship"], u: "1f6a2" }, + { n: ["airplane"], u: "2708-fe0f" }, + { n: ["small airplane"], u: "1f6e9-fe0f" }, + { n: ["airplane departure"], u: "1f6eb" }, + { n: ["airplane arriving"], u: "1f6ec" }, + { n: ["parachute"], u: "1fa82" }, + { n: ["seat"], u: "1f4ba" }, + { n: ["helicopter"], u: "1f681" }, + { n: ["suspension railway"], u: "1f69f" }, + { n: ["mountain cableway"], u: "1f6a0" }, + { n: ["aerial tramway"], u: "1f6a1" }, + { n: ["satellite"], u: "1f6f0-fe0f" }, + { n: ["rocket"], u: "1f680" }, + { n: ["flying saucer"], u: "1f6f8" }, + { n: ["bellhop bell"], u: "1f6ce-fe0f" }, + { n: ["luggage"], u: "1f9f3" }, + { n: ["hourglass"], u: "231b" }, + { n: ["hourglass flowing sand", "hourglass with flowing sand"], u: "23f3" }, + { n: ["watch"], u: "231a" }, + { n: ["alarm clock"], u: "23f0" }, + { n: ["stopwatch"], u: "23f1-fe0f" }, + { n: ["timer clock"], u: "23f2-fe0f" }, + { n: ["mantelpiece clock"], u: "1f570-fe0f" }, + { n: ["clock12", "clock face twelve oclock"], u: "1f55b" }, + { n: ["clock1230", "clock face twelve-thirty"], u: "1f567" }, + { n: ["clock1", "clock face one oclock"], u: "1f550" }, + { n: ["clock130", "clock face one-thirty"], u: "1f55c" }, + { n: ["clock2", "clock face two oclock"], u: "1f551" }, + { n: ["clock230", "clock face two-thirty"], u: "1f55d" }, + { n: ["clock3", "clock face three oclock"], u: "1f552" }, + { n: ["clock330", "clock face three-thirty"], u: "1f55e" }, + { n: ["clock4", "clock face four oclock"], u: "1f553" }, + { n: ["clock430", "clock face four-thirty"], u: "1f55f" }, + { n: ["clock5", "clock face five oclock"], u: "1f554" }, + { n: ["clock530", "clock face five-thirty"], u: "1f560" }, + { n: ["clock6", "clock face six oclock"], u: "1f555" }, + { n: ["clock630", "clock face six-thirty"], u: "1f561" }, + { n: ["clock7", "clock face seven oclock"], u: "1f556" }, + { n: ["clock730", "clock face seven-thirty"], u: "1f562" }, + { n: ["clock8", "clock face eight oclock"], u: "1f557" }, + { n: ["clock830", "clock face eight-thirty"], u: "1f563" }, + { n: ["clock9", "clock face nine oclock"], u: "1f558" }, + { n: ["clock930", "clock face nine-thirty"], u: "1f564" }, + { n: ["clock10", "clock face ten oclock"], u: "1f559" }, + { n: ["clock1030", "clock face ten-thirty"], u: "1f565" }, + { n: ["clock11", "clock face eleven oclock"], u: "1f55a" }, + { n: ["clock1130", "clock face eleven-thirty"], u: "1f566" }, + { n: ["new moon", "new moon symbol"], u: "1f311" }, + { n: ["waxing crescent moon", "waxing crescent moon symbol"], u: "1f312" }, + { n: ["first quarter moon", "first quarter moon symbol"], u: "1f313" }, + { + n: ["moon", "waxing gibbous moon", "waxing gibbous moon symbol"], + u: "1f314" + }, + { n: ["full moon", "full moon symbol"], u: "1f315" }, + { n: ["waning gibbous moon", "waning gibbous moon symbol"], u: "1f316" }, + { n: ["last quarter moon", "last quarter moon symbol"], u: "1f317" }, + { n: ["waning crescent moon", "waning crescent moon symbol"], u: "1f318" }, + { n: ["crescent moon"], u: "1f319" }, + { n: ["new moon with face"], u: "1f31a" }, + { n: ["first quarter moon with face"], u: "1f31b" }, + { n: ["last quarter moon with face"], u: "1f31c" }, + { n: ["thermometer"], u: "1f321-fe0f" }, + { n: ["sunny", "black sun with rays"], u: "2600-fe0f" }, + { n: ["full moon with face"], u: "1f31d" }, + { n: ["sun with face"], u: "1f31e" }, + { n: ["ringed planet"], u: "1fa90" }, + { n: ["star", "white medium star"], u: "2b50" }, + { n: ["star2", "glowing star"], u: "1f31f" }, + { n: ["stars", "shooting star"], u: "1f320" }, + { n: ["milky way"], u: "1f30c" }, + { n: ["cloud"], u: "2601-fe0f" }, + { n: ["partly sunny", "sun behind cloud"], u: "26c5" }, + { + n: ["thunder cloud and rain", "cloud with lightning and rain"], + u: "26c8-fe0f" + }, + { + n: ["mostly sunny", "sun small cloud", "sun behind small cloud"], + u: "1f324-fe0f" + }, + { + n: ["barely sunny", "sun behind cloud", "sun behind large cloud"], + u: "1f325-fe0f" + }, + { n: ["partly sunny rain", "sun behind rain cloud"], u: "1f326-fe0f" }, + { n: ["rain cloud", "cloud with rain"], u: "1f327-fe0f" }, + { n: ["snow cloud", "cloud with snow"], u: "1f328-fe0f" }, + { + n: ["lightning", "lightning cloud", "cloud with lightning"], + u: "1f329-fe0f" + }, + { n: ["tornado", "tornado cloud"], u: "1f32a-fe0f" }, + { n: ["fog"], u: "1f32b-fe0f" }, + { n: ["wind face", "wind blowing face"], u: "1f32c-fe0f" }, + { n: ["cyclone"], u: "1f300" }, + { n: ["rainbow"], u: "1f308" }, + { n: ["closed umbrella"], u: "1f302" }, + { n: ["umbrella"], u: "2602-fe0f" }, + { n: ["umbrella with rain drops"], u: "2614" }, + { n: ["umbrella on ground"], u: "26f1-fe0f" }, + { n: ["zap", "high voltage sign"], u: "26a1" }, + { n: ["snowflake"], u: "2744-fe0f" }, + { n: ["snowman"], u: "2603-fe0f" }, + { n: ["snowman without snow"], u: "26c4" }, + { n: ["comet"], u: "2604-fe0f" }, + { n: ["fire"], u: "1f525" }, + { n: ["droplet"], u: "1f4a7" }, + { n: ["ocean", "water wave"], u: "1f30a" } + ], + activities: [ + { n: ["jack-o-lantern", "jack o lantern"], u: "1f383" }, + { n: ["christmas tree"], u: "1f384" }, + { n: ["fireworks"], u: "1f386" }, + { n: ["sparkler", "firework sparkler"], u: "1f387" }, + { n: ["firecracker"], u: "1f9e8" }, + { n: ["sparkles"], u: "2728" }, + { n: ["balloon"], u: "1f388" }, + { n: ["tada", "party popper"], u: "1f389" }, + { n: ["confetti ball"], u: "1f38a" }, + { n: ["tanabata tree"], u: "1f38b" }, + { n: ["bamboo", "pine decoration"], u: "1f38d" }, + { n: ["dolls", "japanese dolls"], u: "1f38e" }, + { n: ["flags", "carp streamer"], u: "1f38f" }, + { n: ["wind chime"], u: "1f390" }, + { n: ["rice scene", "moon viewing ceremony"], u: "1f391" }, + { n: ["red envelope", "red gift envelope"], u: "1f9e7" }, + { n: ["ribbon"], u: "1f380" }, + { n: ["gift", "wrapped present"], u: "1f381" }, + { n: ["reminder ribbon"], u: "1f397-fe0f" }, + { n: ["admission tickets"], u: "1f39f-fe0f" }, + { n: ["ticket"], u: "1f3ab" }, + { n: ["medal", "military medal"], u: "1f396-fe0f" }, + { n: ["trophy"], u: "1f3c6" }, + { n: ["sports medal"], u: "1f3c5" }, + { n: ["first place medal"], u: "1f947" }, + { n: ["second place medal"], u: "1f948" }, + { n: ["third place medal"], u: "1f949" }, + { n: ["soccer", "soccer ball"], u: "26bd" }, + { n: ["baseball"], u: "26be" }, + { n: ["softball"], u: "1f94e" }, + { n: ["basketball", "basketball and hoop"], u: "1f3c0" }, + { n: ["volleyball"], u: "1f3d0" }, + { n: ["football", "american football"], u: "1f3c8" }, + { n: ["rugby football"], u: "1f3c9" }, + { n: ["tennis", "tennis racquet and ball"], u: "1f3be" }, + { n: ["flying disc"], u: "1f94f" }, + { n: ["bowling"], u: "1f3b3" }, + { n: ["cricket bat and ball"], u: "1f3cf" }, + { n: ["field hockey stick and ball"], u: "1f3d1" }, + { n: ["ice hockey stick and puck"], u: "1f3d2" }, + { n: ["lacrosse", "lacrosse stick and ball"], u: "1f94d" }, + { n: ["table tennis paddle and ball"], u: "1f3d3" }, + { n: ["badminton racquet and shuttlecock"], u: "1f3f8" }, + { n: ["boxing glove"], u: "1f94a" }, + { n: ["martial arts uniform"], u: "1f94b" }, + { n: ["goal net"], u: "1f945" }, + { n: ["golf", "flag in hole"], u: "26f3" }, + { n: ["ice skate"], u: "26f8-fe0f" }, + { n: ["fishing pole and fish"], u: "1f3a3" }, + { n: ["diving mask"], u: "1f93f" }, + { n: ["running shirt with sash"], u: "1f3bd" }, + { n: ["ski", "ski and ski boot"], u: "1f3bf" }, + { n: ["sled"], u: "1f6f7" }, + { n: ["curling stone"], u: "1f94c" }, + { n: ["dart", "direct hit"], u: "1f3af" }, + { n: ["yo-yo"], u: "1fa80" }, + { n: ["kite"], u: "1fa81" }, + { n: ["8ball", "billiards"], u: "1f3b1" }, + { n: ["crystal ball"], u: "1f52e" }, + { n: ["magic wand"], u: "1fa84" }, + { n: ["nazar amulet"], u: "1f9ff" }, + { n: ["hamsa"], u: "1faac" }, + { n: ["video game"], u: "1f3ae" }, + { n: ["joystick"], u: "1f579-fe0f" }, + { n: ["slot machine"], u: "1f3b0" }, + { n: ["game die"], u: "1f3b2" }, + { n: ["jigsaw", "jigsaw puzzle piece"], u: "1f9e9" }, + { n: ["teddy bear"], u: "1f9f8" }, + { n: ["pinata"], u: "1fa85" }, + { n: ["mirror ball"], u: "1faa9" }, + { n: ["nesting dolls"], u: "1fa86" }, + { n: ["spades", "black spade suit"], u: "2660-fe0f" }, + { n: ["hearts", "black heart suit"], u: "2665-fe0f" }, + { n: ["diamonds", "black diamond suit"], u: "2666-fe0f" }, + { n: ["clubs", "black club suit"], u: "2663-fe0f" }, + { n: ["chess pawn"], u: "265f-fe0f" }, + { n: ["black joker", "playing card black joker"], u: "1f0cf" }, + { n: ["mahjong", "mahjong tile red dragon"], u: "1f004" }, + { n: ["flower playing cards"], u: "1f3b4" }, + { n: ["performing arts"], u: "1f3ad" }, + { n: ["framed picture", "frame with picture"], u: "1f5bc-fe0f" }, + { n: ["art", "artist palette"], u: "1f3a8" }, + { n: ["thread", "spool of thread"], u: "1f9f5" }, + { n: ["sewing needle"], u: "1faa1" }, + { n: ["yarn", "ball of yarn"], u: "1f9f6" }, + { n: ["knot"], u: "1faa2" } + ], + objects: [ + { n: ["eyeglasses"], u: "1f453" }, + { n: ["sunglasses", "dark sunglasses"], u: "1f576-fe0f" }, + { n: ["goggles"], u: "1f97d" }, + { n: ["lab coat"], u: "1f97c" }, + { n: ["safety vest"], u: "1f9ba" }, + { n: ["necktie"], u: "1f454" }, + { n: ["shirt", "tshirt", "t-shirt"], u: "1f455" }, + { n: ["jeans"], u: "1f456" }, + { n: ["scarf"], u: "1f9e3" }, + { n: ["gloves"], u: "1f9e4" }, + { n: ["coat"], u: "1f9e5" }, + { n: ["socks"], u: "1f9e6" }, + { n: ["dress"], u: "1f457" }, + { n: ["kimono"], u: "1f458" }, + { n: ["sari"], u: "1f97b" }, + { n: ["one-piece swimsuit"], u: "1fa71" }, + { n: ["briefs"], u: "1fa72" }, + { n: ["shorts"], u: "1fa73" }, + { n: ["bikini"], u: "1f459" }, + { n: ["womans clothes"], u: "1f45a" }, + { n: ["purse"], u: "1f45b" }, + { n: ["handbag"], u: "1f45c" }, + { n: ["pouch"], u: "1f45d" }, + { n: ["shopping bags"], u: "1f6cd-fe0f" }, + { n: ["school satchel"], u: "1f392" }, + { n: ["thong sandal"], u: "1fa74" }, + { n: ["shoe", "mans shoe"], u: "1f45e" }, + { n: ["athletic shoe"], u: "1f45f" }, + { n: ["hiking boot"], u: "1f97e" }, + { n: ["flat shoe", "womans flat shoe"], u: "1f97f" }, + { n: ["high heel", "high-heeled shoe"], u: "1f460" }, + { n: ["sandal", "womans sandal"], u: "1f461" }, + { n: ["ballet shoes"], u: "1fa70" }, + { n: ["boot", "womans boots"], u: "1f462" }, + { n: ["crown"], u: "1f451" }, + { n: ["womans hat"], u: "1f452" }, + { n: ["tophat", "top hat"], u: "1f3a9" }, + { n: ["mortar board", "graduation cap"], u: "1f393" }, + { n: ["billed cap"], u: "1f9e2" }, + { n: ["military helmet"], u: "1fa96" }, + { + n: ["rescue worker\u2019s helmet", "helmet with white cross"], + u: "26d1-fe0f" + }, + { n: ["prayer beads"], u: "1f4ff" }, + { n: ["lipstick"], u: "1f484" }, + { n: ["ring"], u: "1f48d" }, + { n: ["gem", "gem stone"], u: "1f48e" }, + { n: ["mute", "speaker with cancellation stroke"], u: "1f507" }, + { n: ["speaker"], u: "1f508" }, + { n: ["sound", "speaker with one sound wave"], u: "1f509" }, + { n: ["loud sound", "speaker with three sound waves"], u: "1f50a" }, + { n: ["loudspeaker", "public address loudspeaker"], u: "1f4e2" }, + { n: ["mega", "cheering megaphone"], u: "1f4e3" }, + { n: ["postal horn"], u: "1f4ef" }, + { n: ["bell"], u: "1f514" }, + { n: ["no bell", "bell with cancellation stroke"], u: "1f515" }, + { n: ["musical score"], u: "1f3bc" }, + { n: ["musical note"], u: "1f3b5" }, + { n: ["notes", "multiple musical notes"], u: "1f3b6" }, + { n: ["studio microphone"], u: "1f399-fe0f" }, + { n: ["level slider"], u: "1f39a-fe0f" }, + { n: ["control knobs"], u: "1f39b-fe0f" }, + { n: ["microphone"], u: "1f3a4" }, + { n: ["headphone", "headphones"], u: "1f3a7" }, + { n: ["radio"], u: "1f4fb" }, + { n: ["saxophone"], u: "1f3b7" }, + { n: ["accordion"], u: "1fa97" }, + { n: ["guitar"], u: "1f3b8" }, + { n: ["musical keyboard"], u: "1f3b9" }, + { n: ["trumpet"], u: "1f3ba" }, + { n: ["violin"], u: "1f3bb" }, + { n: ["banjo"], u: "1fa95" }, + { n: ["drum with drumsticks"], u: "1f941" }, + { n: ["long drum"], u: "1fa98" }, + { n: ["iphone", "mobile phone"], u: "1f4f1" }, + { + n: ["calling", "mobile phone with rightwards arrow at left"], + u: "1f4f2" + }, + { n: ["phone", "telephone", "black telephone"], u: "260e-fe0f" }, + { n: ["telephone receiver"], u: "1f4de" }, + { n: ["pager"], u: "1f4df" }, + { n: ["fax", "fax machine"], u: "1f4e0" }, + { n: ["battery"], u: "1f50b" }, + { n: ["low battery"], u: "1faab" }, + { n: ["electric plug"], u: "1f50c" }, + { n: ["computer", "personal computer"], u: "1f4bb" }, + { n: ["desktop computer"], u: "1f5a5-fe0f" }, + { n: ["printer"], u: "1f5a8-fe0f" }, + { n: ["keyboard"], u: "2328-fe0f" }, + { n: ["computer mouse", "three button mouse"], u: "1f5b1-fe0f" }, + { n: ["trackball"], u: "1f5b2-fe0f" }, + { n: ["minidisc"], u: "1f4bd" }, + { n: ["floppy disk"], u: "1f4be" }, + { n: ["cd", "optical disc"], u: "1f4bf" }, + { n: ["dvd"], u: "1f4c0" }, + { n: ["abacus"], u: "1f9ee" }, + { n: ["movie camera"], u: "1f3a5" }, + { n: ["film frames"], u: "1f39e-fe0f" }, + { n: ["film projector"], u: "1f4fd-fe0f" }, + { n: ["clapper", "clapper board"], u: "1f3ac" }, + { n: ["tv", "television"], u: "1f4fa" }, + { n: ["camera"], u: "1f4f7" }, + { n: ["camera with flash"], u: "1f4f8" }, + { n: ["video camera"], u: "1f4f9" }, + { n: ["vhs", "videocassette"], u: "1f4fc" }, + { n: ["mag", "left-pointing magnifying glass"], u: "1f50d" }, + { n: ["mag right", "right-pointing magnifying glass"], u: "1f50e" }, + { n: ["candle"], u: "1f56f-fe0f" }, + { n: ["bulb", "electric light bulb"], u: "1f4a1" }, + { n: ["flashlight", "electric torch"], u: "1f526" }, + { n: ["lantern", "izakaya lantern"], u: "1f3ee" }, + { n: ["diya lamp"], u: "1fa94" }, + { n: ["notebook with decorative cover"], u: "1f4d4" }, + { n: ["closed book"], u: "1f4d5" }, + { n: ["book", "open book"], u: "1f4d6" }, + { n: ["green book"], u: "1f4d7" }, + { n: ["blue book"], u: "1f4d8" }, + { n: ["orange book"], u: "1f4d9" }, + { n: ["books"], u: "1f4da" }, + { n: ["notebook"], u: "1f4d3" }, + { n: ["ledger"], u: "1f4d2" }, + { n: ["page with curl"], u: "1f4c3" }, + { n: ["scroll"], u: "1f4dc" }, + { n: ["page facing up"], u: "1f4c4" }, + { n: ["newspaper"], u: "1f4f0" }, + { n: ["rolled-up newspaper", "rolled up newspaper"], u: "1f5de-fe0f" }, + { n: ["bookmark tabs"], u: "1f4d1" }, + { n: ["bookmark"], u: "1f516" }, + { n: ["label"], u: "1f3f7-fe0f" }, + { n: ["moneybag", "money bag"], u: "1f4b0" }, + { n: ["coin"], u: "1fa99" }, + { n: ["yen", "banknote with yen sign"], u: "1f4b4" }, + { n: ["dollar", "banknote with dollar sign"], u: "1f4b5" }, + { n: ["euro", "banknote with euro sign"], u: "1f4b6" }, + { n: ["pound", "banknote with pound sign"], u: "1f4b7" }, + { n: ["money with wings"], u: "1f4b8" }, + { n: ["credit card"], u: "1f4b3" }, + { n: ["receipt"], u: "1f9fe" }, + { n: ["chart", "chart with upwards trend and yen sign"], u: "1f4b9" }, + { n: ["email", "envelope"], u: "2709-fe0f" }, + { n: ["e-mail", "e-mail symbol"], u: "1f4e7" }, + { n: ["incoming envelope"], u: "1f4e8" }, + { + n: ["envelope with arrow", "envelope with downwards arrow above"], + u: "1f4e9" + }, + { n: ["outbox tray"], u: "1f4e4" }, + { n: ["inbox tray"], u: "1f4e5" }, + { n: ["package"], u: "1f4e6" }, + { n: ["mailbox", "closed mailbox with raised flag"], u: "1f4eb" }, + { n: ["mailbox closed", "closed mailbox with lowered flag"], u: "1f4ea" }, + { n: ["mailbox with mail", "open mailbox with raised flag"], u: "1f4ec" }, + { + n: ["mailbox with no mail", "open mailbox with lowered flag"], + u: "1f4ed" + }, + { n: ["postbox"], u: "1f4ee" }, + { n: ["ballot box with ballot"], u: "1f5f3-fe0f" }, + { n: ["pencil", "pencil2"], u: "270f-fe0f" }, + { n: ["black nib"], u: "2712-fe0f" }, + { n: ["fountain pen", "lower left fountain pen"], u: "1f58b-fe0f" }, + { n: ["pen", "lower left ballpoint pen"], u: "1f58a-fe0f" }, + { n: ["paintbrush", "lower left paintbrush"], u: "1f58c-fe0f" }, + { n: ["crayon", "lower left crayon"], u: "1f58d-fe0f" }, + { n: ["memo", "pencil"], u: "1f4dd" }, + { n: ["briefcase"], u: "1f4bc" }, + { n: ["file folder"], u: "1f4c1" }, + { n: ["open file folder"], u: "1f4c2" }, + { n: ["card index dividers"], u: "1f5c2-fe0f" }, + { n: ["date", "calendar"], u: "1f4c5" }, + { n: ["calendar", "tear-off calendar"], u: "1f4c6" }, + { n: ["spiral notepad", "spiral note pad"], u: "1f5d2-fe0f" }, + { n: ["spiral calendar", "spiral calendar pad"], u: "1f5d3-fe0f" }, + { n: ["card index"], u: "1f4c7" }, + { n: ["chart with upwards trend"], u: "1f4c8" }, + { n: ["chart with downwards trend"], u: "1f4c9" }, + { n: ["bar chart"], u: "1f4ca" }, + { n: ["clipboard"], u: "1f4cb" }, + { n: ["pushpin"], u: "1f4cc" }, + { n: ["round pushpin"], u: "1f4cd" }, + { n: ["paperclip"], u: "1f4ce" }, + { n: ["linked paperclips"], u: "1f587-fe0f" }, + { n: ["straight ruler"], u: "1f4cf" }, + { n: ["triangular ruler"], u: "1f4d0" }, + { n: ["scissors", "black scissors"], u: "2702-fe0f" }, + { n: ["card file box"], u: "1f5c3-fe0f" }, + { n: ["file cabinet"], u: "1f5c4-fe0f" }, + { n: ["wastebasket"], u: "1f5d1-fe0f" }, + { n: ["lock"], u: "1f512" }, + { n: ["unlock", "open lock"], u: "1f513" }, + { n: ["lock with ink pen"], u: "1f50f" }, + { n: ["closed lock with key"], u: "1f510" }, + { n: ["key"], u: "1f511" }, + { n: ["old key"], u: "1f5dd-fe0f" }, + { n: ["hammer"], u: "1f528" }, + { n: ["axe"], u: "1fa93" }, + { n: ["pick"], u: "26cf-fe0f" }, + { n: ["hammer and pick"], u: "2692-fe0f" }, + { n: ["hammer and wrench"], u: "1f6e0-fe0f" }, + { n: ["dagger", "dagger knife"], u: "1f5e1-fe0f" }, + { n: ["crossed swords"], u: "2694-fe0f" }, + { n: ["gun", "pistol"], u: "1f52b" }, + { n: ["boomerang"], u: "1fa83" }, + { n: ["bow and arrow"], u: "1f3f9" }, + { n: ["shield"], u: "1f6e1-fe0f" }, + { n: ["carpentry saw"], u: "1fa9a" }, + { n: ["wrench"], u: "1f527" }, + { n: ["screwdriver"], u: "1fa9b" }, + { n: ["nut and bolt"], u: "1f529" }, + { n: ["gear"], u: "2699-fe0f" }, + { n: ["clamp", "compression"], u: "1f5dc-fe0f" }, + { n: ["scales", "balance scale"], u: "2696-fe0f" }, + { n: ["probing cane"], u: "1f9af" }, + { n: ["link", "link symbol"], u: "1f517" }, + { n: ["chains"], u: "26d3-fe0f" }, + { n: ["hook"], u: "1fa9d" }, + { n: ["toolbox"], u: "1f9f0" }, + { n: ["magnet"], u: "1f9f2" }, + { n: ["ladder"], u: "1fa9c" }, + { n: ["alembic"], u: "2697-fe0f" }, + { n: ["test tube"], u: "1f9ea" }, + { n: ["petri dish"], u: "1f9eb" }, + { n: ["dna", "dna double helix"], u: "1f9ec" }, + { n: ["microscope"], u: "1f52c" }, + { n: ["telescope"], u: "1f52d" }, + { n: ["satellite antenna"], u: "1f4e1" }, + { n: ["syringe"], u: "1f489" }, + { n: ["drop of blood"], u: "1fa78" }, + { n: ["pill"], u: "1f48a" }, + { n: ["adhesive bandage"], u: "1fa79" }, + { n: ["crutch"], u: "1fa7c" }, + { n: ["stethoscope"], u: "1fa7a" }, + { n: ["x-ray"], u: "1fa7b" }, + { n: ["door"], u: "1f6aa" }, + { n: ["elevator"], u: "1f6d7" }, + { n: ["mirror"], u: "1fa9e" }, + { n: ["window"], u: "1fa9f" }, + { n: ["bed"], u: "1f6cf-fe0f" }, + { n: ["couch and lamp"], u: "1f6cb-fe0f" }, + { n: ["chair"], u: "1fa91" }, + { n: ["toilet"], u: "1f6bd" }, + { n: ["plunger"], u: "1faa0" }, + { n: ["shower"], u: "1f6bf" }, + { n: ["bathtub"], u: "1f6c1" }, + { n: ["mouse trap"], u: "1faa4" }, + { n: ["razor"], u: "1fa92" }, + { n: ["lotion bottle"], u: "1f9f4" }, + { n: ["safety pin"], u: "1f9f7" }, + { n: ["broom"], u: "1f9f9" }, + { n: ["basket"], u: "1f9fa" }, + { n: ["roll of paper"], u: "1f9fb" }, + { n: ["bucket"], u: "1faa3" }, + { n: ["soap", "bar of soap"], u: "1f9fc" }, + { n: ["bubbles"], u: "1fae7" }, + { n: ["toothbrush"], u: "1faa5" }, + { n: ["sponge"], u: "1f9fd" }, + { n: ["fire extinguisher"], u: "1f9ef" }, + { n: ["shopping trolley"], u: "1f6d2" }, + { n: ["smoking", "smoking symbol"], u: "1f6ac" }, + { n: ["coffin"], u: "26b0-fe0f" }, + { n: ["headstone"], u: "1faa6" }, + { n: ["funeral urn"], u: "26b1-fe0f" }, + { n: ["moyai"], u: "1f5ff" }, + { n: ["placard"], u: "1faa7" }, + { n: ["identification card"], u: "1faaa" } + ], + symbols: [ + { n: ["atm", "automated teller machine"], u: "1f3e7" }, + { + n: ["put litter in its place", "put litter in its place symbol"], + u: "1f6ae" + }, + { n: ["potable water", "potable water symbol"], u: "1f6b0" }, + { n: ["wheelchair", "wheelchair symbol"], u: "267f" }, + { n: ["mens", "mens symbol"], u: "1f6b9" }, + { n: ["womens", "womens symbol"], u: "1f6ba" }, + { n: ["restroom"], u: "1f6bb" }, + { n: ["baby symbol"], u: "1f6bc" }, + { n: ["wc", "water closet"], u: "1f6be" }, + { n: ["passport control"], u: "1f6c2" }, + { n: ["customs"], u: "1f6c3" }, + { n: ["baggage claim"], u: "1f6c4" }, + { n: ["left luggage"], u: "1f6c5" }, + { n: ["warning", "warning sign"], u: "26a0-fe0f" }, + { n: ["children crossing"], u: "1f6b8" }, + { n: ["no entry"], u: "26d4" }, + { n: ["no entry sign"], u: "1f6ab" }, + { n: ["no bicycles"], u: "1f6b3" }, + { n: ["no smoking", "no smoking symbol"], u: "1f6ad" }, + { n: ["do not litter", "do not litter symbol"], u: "1f6af" }, + { n: ["non-potable water", "non-potable water symbol"], u: "1f6b1" }, + { n: ["no pedestrians"], u: "1f6b7" }, + { n: ["no mobile phones"], u: "1f4f5" }, + { n: ["underage", "no one under eighteen symbol"], u: "1f51e" }, + { n: ["radioactive", "radioactive sign"], u: "2622-fe0f" }, + { n: ["biohazard", "biohazard sign"], u: "2623-fe0f" }, + { n: ["arrow up", "upwards black arrow"], u: "2b06-fe0f" }, + { n: ["north east arrow", "arrow upper right"], u: "2197-fe0f" }, + { n: ["arrow right", "black rightwards arrow"], u: "27a1-fe0f" }, + { n: ["south east arrow", "arrow lower right"], u: "2198-fe0f" }, + { n: ["arrow down", "downwards black arrow"], u: "2b07-fe0f" }, + { n: ["south west arrow", "arrow lower left"], u: "2199-fe0f" }, + { n: ["arrow left", "leftwards black arrow"], u: "2b05-fe0f" }, + { n: ["north west arrow", "arrow upper left"], u: "2196-fe0f" }, + { n: ["up down arrow", "arrow up down"], u: "2195-fe0f" }, + { n: ["left right arrow"], u: "2194-fe0f" }, + { n: ["leftwards arrow with hook"], u: "21a9-fe0f" }, + { n: ["arrow right hook", "rightwards arrow with hook"], u: "21aa-fe0f" }, + { + n: ["arrow heading up", "arrow pointing rightwards then curving upwards"], + u: "2934-fe0f" + }, + { + n: [ + "arrow heading down", + "arrow pointing rightwards then curving downwards" + ], + u: "2935-fe0f" + }, + { + n: [ + "arrows clockwise", + "clockwise downwards and upwards open circle arrows" + ], + u: "1f503" + }, + { + n: [ + "arrows counterclockwise", + "anticlockwise downwards and upwards open circle arrows" + ], + u: "1f504" + }, + { n: ["back", "back with leftwards arrow above"], u: "1f519" }, + { n: ["end", "end with leftwards arrow above"], u: "1f51a" }, + { + n: ["on", "on with exclamation mark with left right arrow above"], + u: "1f51b" + }, + { n: ["soon", "soon with rightwards arrow above"], u: "1f51c" }, + { n: ["top", "top with upwards arrow above"], u: "1f51d" }, + { n: ["place of worship"], u: "1f6d0" }, + { n: ["atom symbol"], u: "269b-fe0f" }, + { n: ["om", "om symbol"], u: "1f549-fe0f" }, + { n: ["star of david"], u: "2721-fe0f" }, + { n: ["wheel of dharma"], u: "2638-fe0f" }, + { n: ["yin yang"], u: "262f-fe0f" }, + { n: ["latin cross"], u: "271d-fe0f" }, + { n: ["orthodox cross"], u: "2626-fe0f" }, + { n: ["star and crescent"], u: "262a-fe0f" }, + { n: ["peace symbol"], u: "262e-fe0f" }, + { n: ["menorah with nine branches"], u: "1f54e" }, + { n: ["six pointed star", "six pointed star with middle dot"], u: "1f52f" }, + { n: ["aries"], u: "2648" }, + { n: ["taurus"], u: "2649" }, + { n: ["gemini"], u: "264a" }, + { n: ["cancer"], u: "264b" }, + { n: ["leo"], u: "264c" }, + { n: ["virgo"], u: "264d" }, + { n: ["libra"], u: "264e" }, + { n: ["scorpius"], u: "264f" }, + { n: ["sagittarius"], u: "2650" }, + { n: ["capricorn"], u: "2651" }, + { n: ["aquarius"], u: "2652" }, + { n: ["pisces"], u: "2653" }, + { n: ["ophiuchus"], u: "26ce" }, + { n: ["twisted rightwards arrows"], u: "1f500" }, + { + n: ["repeat", "clockwise rightwards and leftwards open circle arrows"], + u: "1f501" + }, + { + n: [ + "repeat one", + "clockwise rightwards and leftwards open circle arrows with circled one overlay" + ], + u: "1f502" + }, + { n: ["arrow forward", "black right-pointing triangle"], u: "25b6-fe0f" }, + { n: ["fast forward", "black right-pointing double triangle"], u: "23e9" }, + { + n: [ + "next track button", + "black right pointing double triangle with vertical bar" + ], + u: "23ed-fe0f" + }, + { + n: [ + "play or pause button", + "black right pointing triangle with double vertical bar" + ], + u: "23ef-fe0f" + }, + { n: ["arrow backward", "black left-pointing triangle"], u: "25c0-fe0f" }, + { n: ["rewind", "black left-pointing double triangle"], u: "23ea" }, + { + n: [ + "last track button", + "black left pointing double triangle with vertical bar" + ], + u: "23ee-fe0f" + }, + { n: ["arrow up small", "up-pointing small red triangle"], u: "1f53c" }, + { n: ["arrow double up", "black up-pointing double triangle"], u: "23eb" }, + { n: ["arrow down small", "down-pointing small red triangle"], u: "1f53d" }, + { + n: ["arrow double down", "black down-pointing double triangle"], + u: "23ec" + }, + { n: ["pause button", "double vertical bar"], u: "23f8-fe0f" }, + { n: ["stop button", "black square for stop"], u: "23f9-fe0f" }, + { n: ["record button", "black circle for record"], u: "23fa-fe0f" }, + { n: ["eject", "eject button"], u: "23cf-fe0f" }, + { n: ["cinema"], u: "1f3a6" }, + { n: ["low brightness", "low brightness symbol"], u: "1f505" }, + { n: ["high brightness", "high brightness symbol"], u: "1f506" }, + { n: ["signal strength", "antenna with bars"], u: "1f4f6" }, + { n: ["vibration mode"], u: "1f4f3" }, + { n: ["mobile phone off"], u: "1f4f4" }, + { n: ["female sign"], u: "2640-fe0f" }, + { n: ["male sign"], u: "2642-fe0f" }, + { n: ["transgender symbol"], u: "26a7-fe0f" }, + { n: ["heavy multiplication x"], u: "2716-fe0f" }, + { n: ["heavy plus sign"], u: "2795" }, + { n: ["heavy minus sign"], u: "2796" }, + { n: ["heavy division sign"], u: "2797" }, + { n: ["heavy equals sign"], u: "1f7f0" }, + { n: ["infinity"], u: "267e-fe0f" }, + { n: ["bangbang", "double exclamation mark"], u: "203c-fe0f" }, + { n: ["interrobang", "exclamation question mark"], u: "2049-fe0f" }, + { n: ["question", "black question mark ornament"], u: "2753" }, + { n: ["grey question", "white question mark ornament"], u: "2754" }, + { n: ["grey exclamation", "white exclamation mark ornament"], u: "2755" }, + { + n: [ + "exclamation", + "heavy exclamation mark", + "heavy exclamation mark symbol" + ], + u: "2757" }, - [mdb.schema.id]: { - uniques: [], - cols: mdb.cols.map((c4) => c4.name), - rows: mdb.rows - } - }; - db.close(); - return saveDBToPath(plugin, context.dbPath, tables); -}; -var optionValuesForColumn = (column, table) => { - var _a2; - return uniq( - (_a2 = table == null ? void 0 : table.rows.reduce((p3, c4) => { - return [...p3, ...parseMultiString(c4[column])]; - }, [])) != null ? _a2 : [] - ); -}; -var defaultTableDataForContext = (plugin, contextInfo) => { - var _a2, _b2; - let files; - if (contextInfo.type == "folder") { - files = folderChildren( - plugin, - getAbstractFileAtPath( - plugin.app, - contextInfo.contextPath - ) - ); - return { - ...defaultMDBTableForContext(contextInfo), - rows: files.map((f4) => ({ File: f4.path })) - }; - } else if (contextInfo.type == "tag") { - files = getAllFilesForTag(contextInfo.contextPath).map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4); - return { - ...defaultMDBTableForContext(contextInfo), - rows: files.map((f4) => ({ File: f4.path })) - }; - } else if (contextInfo.type == "space") { - files = [ - ...(_b2 = (_a2 = plugin.index.spacesMap) == null ? void 0 : _a2.getInverse( - contextInfo.contextPath.substring( - 0, - contextInfo.contextPath.length - 2 - ) - )) != null ? _b2 : [] - ].map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4); - return { - ...defaultMDBTableForContext(contextInfo), - rows: files.map((f4) => ({ File: f4.path })) - }; - } - return null; -}; -var createDefaultDB = async (plugin, context) => { - var _a2; - const table = defaultTableDataForContext(plugin, context); - if (table) { - const defaultFields = defaultFieldsForContext(context); - const defaultTable = defaultTablesForContext(context); - const dbField = { - ...defaultTable, - m_fields: { - uniques: defaultFields.uniques, - cols: defaultFields.cols, - rows: [...(_a2 = defaultFields.rows) != null ? _a2 : [], ...table.cols] - }, - [table.schema.id]: { - uniques: table.cols.filter((c4) => c4.unique == "true").map((c4) => c4.name), - cols: table.cols.map((c4) => c4.name), - rows: table.rows - } - }; - const result = await saveDBToPath(plugin, context.dbPath, dbField); - if (result) { - await plugin.index.reloadContext(context); - table.rows.map((f4) => getAbstractFileAtPath(app, f4.File)).forEach((f4) => f4 && plugin.index.reloadFile(f4, true)); - return true; - } - return false; - } - return false; -}; -var sanitizeTableSchema = async (plugin, db, context) => { - const sqlJS = await plugin.sqlJS(); - const tableRes = db.exec( - `SELECT name FROM sqlite_master WHERE type='table';` - ); - if (!tableRes[0] || !tableRes[0].values.some((f4) => f4[0] == "m_schema") || !tableRes[0].values.some((f4) => f4[0] == "m_fields") || !tableRes[0].values.some((f4) => f4[0] == "files")) { - await createDefaultDB(plugin, context); - } -}; -var createNewRow = (mdb, row, index) => { - if (index) { - return { - ...mdb, - rows: insert(mdb.rows, index, row) - }; - } - return { - ...mdb, - rows: [...mdb.rows, row] - }; -}; -var deleteTagContext = async (plugin, tag) => { - const context = tagContextFromTag(plugin, tag); - if (getAbstractFileAtPath(app, context.dbPath)) { - await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); - } - app.workspace.iterateLeaves((leaf) => { - if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == tag) { - leaf.setViewState({ type: "empty" }); - } - }, app.workspace["rootSplit"]); - plugin.index.deleteTag(tag); -}; -var deleteSpaceContext = async (plugin, space) => { - const context = spaceContextFromSpace(plugin, spaceContextPathFromName(space)); - if (getAbstractFileAtPath(app, context.dbPath)) { - await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); - } - app.workspace.iterateLeaves((leaf) => { - if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == context.contextPath) { - leaf.setViewState({ type: "empty" }); + { n: ["wavy dash"], u: "3030-fe0f" }, + { n: ["currency exchange"], u: "1f4b1" }, + { n: ["heavy dollar sign"], u: "1f4b2" }, + { n: ["medical symbol", "staff of aesculapius"], u: "2695-fe0f" }, + { n: ["recycle", "black universal recycling symbol"], u: "267b-fe0f" }, + { n: ["fleur-de-lis", "fleur de lis"], u: "269c-fe0f" }, + { n: ["trident", "trident emblem"], u: "1f531" }, + { n: ["name badge"], u: "1f4db" }, + { n: ["beginner", "japanese symbol for beginner"], u: "1f530" }, + { n: ["o", "heavy large circle"], u: "2b55" }, + { n: ["white check mark", "white heavy check mark"], u: "2705" }, + { n: ["ballot box with check"], u: "2611-fe0f" }, + { n: ["heavy check mark"], u: "2714-fe0f" }, + { n: ["x", "cross mark"], u: "274c" }, + { n: ["negative squared cross mark"], u: "274e" }, + { n: ["curly loop"], u: "27b0" }, + { n: ["loop", "double curly loop"], u: "27bf" }, + { n: ["part alternation mark"], u: "303d-fe0f" }, + { n: ["eight spoked asterisk"], u: "2733-fe0f" }, + { n: ["eight pointed black star"], u: "2734-fe0f" }, + { n: ["sparkle"], u: "2747-fe0f" }, + { n: ["copyright", "copyright sign"], u: "00a9-fe0f" }, + { n: ["registered", "registered sign"], u: "00ae-fe0f" }, + { n: ["tm", "trade mark sign"], u: "2122-fe0f" }, + { n: ["hash", "hash key"], u: "0023-fe0f-20e3" }, + { n: ["keycap: *", "keycap star"], u: "002a-fe0f-20e3" }, + { n: ["zero", "keycap 0"], u: "0030-fe0f-20e3" }, + { n: ["one", "keycap 1"], u: "0031-fe0f-20e3" }, + { n: ["two", "keycap 2"], u: "0032-fe0f-20e3" }, + { n: ["three", "keycap 3"], u: "0033-fe0f-20e3" }, + { n: ["four", "keycap 4"], u: "0034-fe0f-20e3" }, + { n: ["five", "keycap 5"], u: "0035-fe0f-20e3" }, + { n: ["six", "keycap 6"], u: "0036-fe0f-20e3" }, + { n: ["seven", "keycap 7"], u: "0037-fe0f-20e3" }, + { n: ["eight", "keycap 8"], u: "0038-fe0f-20e3" }, + { n: ["nine", "keycap 9"], u: "0039-fe0f-20e3" }, + { n: ["keycap ten"], u: "1f51f" }, + { + n: ["capital abcd", "input symbol for latin capital letters"], + u: "1f520" + }, + { n: ["abcd", "input symbol for latin small letters"], u: "1f521" }, + { n: ["1234", "input symbol for numbers"], u: "1f522" }, + { n: ["symbols", "input symbol for symbols"], u: "1f523" }, + { n: ["abc", "input symbol for latin letters"], u: "1f524" }, + { n: ["a", "negative squared latin capital letter a"], u: "1f170-fe0f" }, + { n: ["ab", "negative squared ab"], u: "1f18e" }, + { n: ["b", "negative squared latin capital letter b"], u: "1f171-fe0f" }, + { n: ["cl", "squared cl"], u: "1f191" }, + { n: ["cool", "squared cool"], u: "1f192" }, + { n: ["free", "squared free"], u: "1f193" }, + { n: ["information source"], u: "2139-fe0f" }, + { n: ["id", "squared id"], u: "1f194" }, + { n: ["m", "circled latin capital letter m"], u: "24c2-fe0f" }, + { n: ["new", "squared new"], u: "1f195" }, + { n: ["ng", "squared ng"], u: "1f196" }, + { n: ["o2", "negative squared latin capital letter o"], u: "1f17e-fe0f" }, + { n: ["ok", "squared ok"], u: "1f197" }, + { + n: ["parking", "negative squared latin capital letter p"], + u: "1f17f-fe0f" + }, + { n: ["sos", "squared sos"], u: "1f198" }, + { n: ["up", "squared up with exclamation mark"], u: "1f199" }, + { n: ["vs", "squared vs"], u: "1f19a" }, + { n: ["koko", "squared katakana koko"], u: "1f201" }, + { n: ["sa", "squared katakana sa"], u: "1f202-fe0f" }, + { n: ["u6708", "squared cjk unified ideograph-6708"], u: "1f237-fe0f" }, + { n: ["u6709", "squared cjk unified ideograph-6709"], u: "1f236" }, + { n: ["u6307", "squared cjk unified ideograph-6307"], u: "1f22f" }, + { n: ["ideograph advantage", "circled ideograph advantage"], u: "1f250" }, + { n: ["u5272", "squared cjk unified ideograph-5272"], u: "1f239" }, + { n: ["u7121", "squared cjk unified ideograph-7121"], u: "1f21a" }, + { n: ["u7981", "squared cjk unified ideograph-7981"], u: "1f232" }, + { n: ["accept", "circled ideograph accept"], u: "1f251" }, + { n: ["u7533", "squared cjk unified ideograph-7533"], u: "1f238" }, + { n: ["u5408", "squared cjk unified ideograph-5408"], u: "1f234" }, + { n: ["u7a7a", "squared cjk unified ideograph-7a7a"], u: "1f233" }, + { + n: ["congratulations", "circled ideograph congratulation"], + u: "3297-fe0f" + }, + { n: ["secret", "circled ideograph secret"], u: "3299-fe0f" }, + { n: ["u55b6", "squared cjk unified ideograph-55b6"], u: "1f23a" }, + { n: ["u6e80", "squared cjk unified ideograph-6e80"], u: "1f235" }, + { n: ["red circle", "large red circle"], u: "1f534" }, + { n: ["large orange circle"], u: "1f7e0" }, + { n: ["large yellow circle"], u: "1f7e1" }, + { n: ["large green circle"], u: "1f7e2" }, + { n: ["large blue circle"], u: "1f535" }, + { n: ["large purple circle"], u: "1f7e3" }, + { n: ["large brown circle"], u: "1f7e4" }, + { n: ["black circle", "medium black circle"], u: "26ab" }, + { n: ["white circle", "medium white circle"], u: "26aa" }, + { n: ["large red square"], u: "1f7e5" }, + { n: ["large orange square"], u: "1f7e7" }, + { n: ["large yellow square"], u: "1f7e8" }, + { n: ["large green square"], u: "1f7e9" }, + { n: ["large blue square"], u: "1f7e6" }, + { n: ["large purple square"], u: "1f7ea" }, + { n: ["large brown square"], u: "1f7eb" }, + { n: ["black large square"], u: "2b1b" }, + { n: ["white large square"], u: "2b1c" }, + { n: ["black medium square"], u: "25fc-fe0f" }, + { n: ["white medium square"], u: "25fb-fe0f" }, + { n: ["black medium small square"], u: "25fe" }, + { n: ["white medium small square"], u: "25fd" }, + { n: ["black small square"], u: "25aa-fe0f" }, + { n: ["white small square"], u: "25ab-fe0f" }, + { n: ["large orange diamond"], u: "1f536" }, + { n: ["large blue diamond"], u: "1f537" }, + { n: ["small orange diamond"], u: "1f538" }, + { n: ["small blue diamond"], u: "1f539" }, + { n: ["small red triangle", "up-pointing red triangle"], u: "1f53a" }, + { + n: ["small red triangle down", "down-pointing red triangle"], + u: "1f53b" + }, + { n: ["diamond shape with a dot inside"], u: "1f4a0" }, + { n: ["radio button"], u: "1f518" }, + { n: ["white square button"], u: "1f533" }, + { n: ["black square button"], u: "1f532" } + ], + flags: [ + { n: ["chequered flag", "checkered flag"], u: "1f3c1" }, + { n: ["triangular flag on post"], u: "1f6a9" }, + { n: ["crossed flags"], u: "1f38c" }, + { n: ["waving black flag"], u: "1f3f4" }, + { n: ["white flag", "waving white flag"], u: "1f3f3-fe0f" }, + { n: ["rainbow flag", "rainbow-flag"], u: "1f3f3-fe0f-200d-1f308" }, + { n: ["transgender flag"], u: "1f3f3-fe0f-200d-26a7-fe0f" }, + { n: ["pirate flag"], u: "1f3f4-200d-2620-fe0f" }, + { n: ["flag-ac", "ascension island flag"], u: "1f1e6-1f1e8" }, + { n: ["flag-ad", "andorra flag"], u: "1f1e6-1f1e9" }, + { n: ["flag-ae", "united arab emirates flag"], u: "1f1e6-1f1ea" }, + { n: ["flag-af", "afghanistan flag"], u: "1f1e6-1f1eb" }, + { n: ["flag-ag", "antigua & barbuda flag"], u: "1f1e6-1f1ec" }, + { n: ["flag-ai", "anguilla flag"], u: "1f1e6-1f1ee" }, + { n: ["flag-al", "albania flag"], u: "1f1e6-1f1f1" }, + { n: ["flag-am", "armenia flag"], u: "1f1e6-1f1f2" }, + { n: ["flag-ao", "angola flag"], u: "1f1e6-1f1f4" }, + { n: ["flag-aq", "antarctica flag"], u: "1f1e6-1f1f6" }, + { n: ["flag-ar", "argentina flag"], u: "1f1e6-1f1f7" }, + { n: ["flag-as", "american samoa flag"], u: "1f1e6-1f1f8" }, + { n: ["flag-at", "austria flag"], u: "1f1e6-1f1f9" }, + { n: ["flag-au", "australia flag"], u: "1f1e6-1f1fa" }, + { n: ["flag-aw", "aruba flag"], u: "1f1e6-1f1fc" }, + { n: ["flag-ax", "\xE5land islands flag"], u: "1f1e6-1f1fd" }, + { n: ["flag-az", "azerbaijan flag"], u: "1f1e6-1f1ff" }, + { n: ["flag-ba", "bosnia & herzegovina flag"], u: "1f1e7-1f1e6" }, + { n: ["flag-bb", "barbados flag"], u: "1f1e7-1f1e7" }, + { n: ["flag-bd", "bangladesh flag"], u: "1f1e7-1f1e9" }, + { n: ["flag-be", "belgium flag"], u: "1f1e7-1f1ea" }, + { n: ["flag-bf", "burkina faso flag"], u: "1f1e7-1f1eb" }, + { n: ["flag-bg", "bulgaria flag"], u: "1f1e7-1f1ec" }, + { n: ["flag-bh", "bahrain flag"], u: "1f1e7-1f1ed" }, + { n: ["flag-bi", "burundi flag"], u: "1f1e7-1f1ee" }, + { n: ["flag-bj", "benin flag"], u: "1f1e7-1f1ef" }, + { n: ["flag-bl", "st. barth\xE9lemy flag"], u: "1f1e7-1f1f1" }, + { n: ["flag-bm", "bermuda flag"], u: "1f1e7-1f1f2" }, + { n: ["flag-bn", "brunei flag"], u: "1f1e7-1f1f3" }, + { n: ["flag-bo", "bolivia flag"], u: "1f1e7-1f1f4" }, + { n: ["flag-bq", "caribbean netherlands flag"], u: "1f1e7-1f1f6" }, + { n: ["flag-br", "brazil flag"], u: "1f1e7-1f1f7" }, + { n: ["flag-bs", "bahamas flag"], u: "1f1e7-1f1f8" }, + { n: ["flag-bt", "bhutan flag"], u: "1f1e7-1f1f9" }, + { n: ["flag-bv", "bouvet island flag"], u: "1f1e7-1f1fb" }, + { n: ["flag-bw", "botswana flag"], u: "1f1e7-1f1fc" }, + { n: ["flag-by", "belarus flag"], u: "1f1e7-1f1fe" }, + { n: ["flag-bz", "belize flag"], u: "1f1e7-1f1ff" }, + { n: ["flag-ca", "canada flag"], u: "1f1e8-1f1e6" }, + { n: ["flag-cc", "cocos (keeling) islands flag"], u: "1f1e8-1f1e8" }, + { n: ["flag-cd", "congo - kinshasa flag"], u: "1f1e8-1f1e9" }, + { n: ["flag-cf", "central african republic flag"], u: "1f1e8-1f1eb" }, + { n: ["flag-cg", "congo - brazzaville flag"], u: "1f1e8-1f1ec" }, + { n: ["flag-ch", "switzerland flag"], u: "1f1e8-1f1ed" }, + { n: ["flag-ci", "c\xF4te d\u2019ivoire flag"], u: "1f1e8-1f1ee" }, + { n: ["flag-ck", "cook islands flag"], u: "1f1e8-1f1f0" }, + { n: ["flag-cl", "chile flag"], u: "1f1e8-1f1f1" }, + { n: ["flag-cm", "cameroon flag"], u: "1f1e8-1f1f2" }, + { n: ["cn", "flag-cn", "china flag"], u: "1f1e8-1f1f3" }, + { n: ["flag-co", "colombia flag"], u: "1f1e8-1f1f4" }, + { n: ["flag-cp", "clipperton island flag"], u: "1f1e8-1f1f5" }, + { n: ["flag-cr", "costa rica flag"], u: "1f1e8-1f1f7" }, + { n: ["flag-cu", "cuba flag"], u: "1f1e8-1f1fa" }, + { n: ["flag-cv", "cape verde flag"], u: "1f1e8-1f1fb" }, + { n: ["flag-cw", "cura\xE7ao flag"], u: "1f1e8-1f1fc" }, + { n: ["flag-cx", "christmas island flag"], u: "1f1e8-1f1fd" }, + { n: ["flag-cy", "cyprus flag"], u: "1f1e8-1f1fe" }, + { n: ["flag-cz", "czechia flag"], u: "1f1e8-1f1ff" }, + { n: ["de", "flag-de", "germany flag"], u: "1f1e9-1f1ea" }, + { n: ["flag-dg", "diego garcia flag"], u: "1f1e9-1f1ec" }, + { n: ["flag-dj", "djibouti flag"], u: "1f1e9-1f1ef" }, + { n: ["flag-dk", "denmark flag"], u: "1f1e9-1f1f0" }, + { n: ["flag-dm", "dominica flag"], u: "1f1e9-1f1f2" }, + { n: ["flag-do", "dominican republic flag"], u: "1f1e9-1f1f4" }, + { n: ["flag-dz", "algeria flag"], u: "1f1e9-1f1ff" }, + { n: ["flag-ea", "ceuta & melilla flag"], u: "1f1ea-1f1e6" }, + { n: ["flag-ec", "ecuador flag"], u: "1f1ea-1f1e8" }, + { n: ["flag-ee", "estonia flag"], u: "1f1ea-1f1ea" }, + { n: ["flag-eg", "egypt flag"], u: "1f1ea-1f1ec" }, + { n: ["flag-eh", "western sahara flag"], u: "1f1ea-1f1ed" }, + { n: ["flag-er", "eritrea flag"], u: "1f1ea-1f1f7" }, + { n: ["es", "flag-es", "spain flag"], u: "1f1ea-1f1f8" }, + { n: ["flag-et", "ethiopia flag"], u: "1f1ea-1f1f9" }, + { n: ["flag-eu", "european union flag"], u: "1f1ea-1f1fa" }, + { n: ["flag-fi", "finland flag"], u: "1f1eb-1f1ee" }, + { n: ["flag-fj", "fiji flag"], u: "1f1eb-1f1ef" }, + { n: ["flag-fk", "falkland islands flag"], u: "1f1eb-1f1f0" }, + { n: ["flag-fm", "micronesia flag"], u: "1f1eb-1f1f2" }, + { n: ["flag-fo", "faroe islands flag"], u: "1f1eb-1f1f4" }, + { n: ["fr", "flag-fr", "france flag"], u: "1f1eb-1f1f7" }, + { n: ["flag-ga", "gabon flag"], u: "1f1ec-1f1e6" }, + { n: ["gb", "uk", "flag-gb", "united kingdom flag"], u: "1f1ec-1f1e7" }, + { n: ["flag-gd", "grenada flag"], u: "1f1ec-1f1e9" }, + { n: ["flag-ge", "georgia flag"], u: "1f1ec-1f1ea" }, + { n: ["flag-gf", "french guiana flag"], u: "1f1ec-1f1eb" }, + { n: ["flag-gg", "guernsey flag"], u: "1f1ec-1f1ec" }, + { n: ["flag-gh", "ghana flag"], u: "1f1ec-1f1ed" }, + { n: ["flag-gi", "gibraltar flag"], u: "1f1ec-1f1ee" }, + { n: ["flag-gl", "greenland flag"], u: "1f1ec-1f1f1" }, + { n: ["flag-gm", "gambia flag"], u: "1f1ec-1f1f2" }, + { n: ["flag-gn", "guinea flag"], u: "1f1ec-1f1f3" }, + { n: ["flag-gp", "guadeloupe flag"], u: "1f1ec-1f1f5" }, + { n: ["flag-gq", "equatorial guinea flag"], u: "1f1ec-1f1f6" }, + { n: ["flag-gr", "greece flag"], u: "1f1ec-1f1f7" }, + { + n: ["flag-gs", "south georgia & south sandwich islands flag"], + u: "1f1ec-1f1f8" + }, + { n: ["flag-gt", "guatemala flag"], u: "1f1ec-1f1f9" }, + { n: ["flag-gu", "guam flag"], u: "1f1ec-1f1fa" }, + { n: ["flag-gw", "guinea-bissau flag"], u: "1f1ec-1f1fc" }, + { n: ["flag-gy", "guyana flag"], u: "1f1ec-1f1fe" }, + { n: ["flag-hk", "hong kong sar china flag"], u: "1f1ed-1f1f0" }, + { n: ["flag-hm", "heard & mcdonald islands flag"], u: "1f1ed-1f1f2" }, + { n: ["flag-hn", "honduras flag"], u: "1f1ed-1f1f3" }, + { n: ["flag-hr", "croatia flag"], u: "1f1ed-1f1f7" }, + { n: ["flag-ht", "haiti flag"], u: "1f1ed-1f1f9" }, + { n: ["flag-hu", "hungary flag"], u: "1f1ed-1f1fa" }, + { n: ["flag-ic", "canary islands flag"], u: "1f1ee-1f1e8" }, + { n: ["flag-id", "indonesia flag"], u: "1f1ee-1f1e9" }, + { n: ["flag-ie", "ireland flag"], u: "1f1ee-1f1ea" }, + { n: ["flag-il", "israel flag"], u: "1f1ee-1f1f1" }, + { n: ["flag-im", "isle of man flag"], u: "1f1ee-1f1f2" }, + { n: ["flag-in", "india flag"], u: "1f1ee-1f1f3" }, + { n: ["flag-io", "british indian ocean territory flag"], u: "1f1ee-1f1f4" }, + { n: ["flag-iq", "iraq flag"], u: "1f1ee-1f1f6" }, + { n: ["flag-ir", "iran flag"], u: "1f1ee-1f1f7" }, + { n: ["flag-is", "iceland flag"], u: "1f1ee-1f1f8" }, + { n: ["it", "flag-it", "italy flag"], u: "1f1ee-1f1f9" }, + { n: ["flag-je", "jersey flag"], u: "1f1ef-1f1ea" }, + { n: ["flag-jm", "jamaica flag"], u: "1f1ef-1f1f2" }, + { n: ["flag-jo", "jordan flag"], u: "1f1ef-1f1f4" }, + { n: ["jp", "flag-jp", "japan flag"], u: "1f1ef-1f1f5" }, + { n: ["flag-ke", "kenya flag"], u: "1f1f0-1f1ea" }, + { n: ["flag-kg", "kyrgyzstan flag"], u: "1f1f0-1f1ec" }, + { n: ["flag-kh", "cambodia flag"], u: "1f1f0-1f1ed" }, + { n: ["flag-ki", "kiribati flag"], u: "1f1f0-1f1ee" }, + { n: ["flag-km", "comoros flag"], u: "1f1f0-1f1f2" }, + { n: ["flag-kn", "st. kitts & nevis flag"], u: "1f1f0-1f1f3" }, + { n: ["flag-kp", "north korea flag"], u: "1f1f0-1f1f5" }, + { n: ["kr", "flag-kr", "south korea flag"], u: "1f1f0-1f1f7" }, + { n: ["flag-kw", "kuwait flag"], u: "1f1f0-1f1fc" }, + { n: ["flag-ky", "cayman islands flag"], u: "1f1f0-1f1fe" }, + { n: ["flag-kz", "kazakhstan flag"], u: "1f1f0-1f1ff" }, + { n: ["flag-la", "laos flag"], u: "1f1f1-1f1e6" }, + { n: ["flag-lb", "lebanon flag"], u: "1f1f1-1f1e7" }, + { n: ["flag-lc", "st. lucia flag"], u: "1f1f1-1f1e8" }, + { n: ["flag-li", "liechtenstein flag"], u: "1f1f1-1f1ee" }, + { n: ["flag-lk", "sri lanka flag"], u: "1f1f1-1f1f0" }, + { n: ["flag-lr", "liberia flag"], u: "1f1f1-1f1f7" }, + { n: ["flag-ls", "lesotho flag"], u: "1f1f1-1f1f8" }, + { n: ["flag-lt", "lithuania flag"], u: "1f1f1-1f1f9" }, + { n: ["flag-lu", "luxembourg flag"], u: "1f1f1-1f1fa" }, + { n: ["flag-lv", "latvia flag"], u: "1f1f1-1f1fb" }, + { n: ["flag-ly", "libya flag"], u: "1f1f1-1f1fe" }, + { n: ["flag-ma", "morocco flag"], u: "1f1f2-1f1e6" }, + { n: ["flag-mc", "monaco flag"], u: "1f1f2-1f1e8" }, + { n: ["flag-md", "moldova flag"], u: "1f1f2-1f1e9" }, + { n: ["flag-me", "montenegro flag"], u: "1f1f2-1f1ea" }, + { n: ["flag-mf", "st. martin flag"], u: "1f1f2-1f1eb" }, + { n: ["flag-mg", "madagascar flag"], u: "1f1f2-1f1ec" }, + { n: ["flag-mh", "marshall islands flag"], u: "1f1f2-1f1ed" }, + { n: ["flag-mk", "north macedonia flag"], u: "1f1f2-1f1f0" }, + { n: ["flag-ml", "mali flag"], u: "1f1f2-1f1f1" }, + { n: ["flag-mm", "myanmar (burma) flag"], u: "1f1f2-1f1f2" }, + { n: ["flag-mn", "mongolia flag"], u: "1f1f2-1f1f3" }, + { n: ["flag-mo", "macao sar china flag"], u: "1f1f2-1f1f4" }, + { n: ["flag-mp", "northern mariana islands flag"], u: "1f1f2-1f1f5" }, + { n: ["flag-mq", "martinique flag"], u: "1f1f2-1f1f6" }, + { n: ["flag-mr", "mauritania flag"], u: "1f1f2-1f1f7" }, + { n: ["flag-ms", "montserrat flag"], u: "1f1f2-1f1f8" }, + { n: ["flag-mt", "malta flag"], u: "1f1f2-1f1f9" }, + { n: ["flag-mu", "mauritius flag"], u: "1f1f2-1f1fa" }, + { n: ["flag-mv", "maldives flag"], u: "1f1f2-1f1fb" }, + { n: ["flag-mw", "malawi flag"], u: "1f1f2-1f1fc" }, + { n: ["flag-mx", "mexico flag"], u: "1f1f2-1f1fd" }, + { n: ["flag-my", "malaysia flag"], u: "1f1f2-1f1fe" }, + { n: ["flag-mz", "mozambique flag"], u: "1f1f2-1f1ff" }, + { n: ["flag-na", "namibia flag"], u: "1f1f3-1f1e6" }, + { n: ["flag-nc", "new caledonia flag"], u: "1f1f3-1f1e8" }, + { n: ["flag-ne", "niger flag"], u: "1f1f3-1f1ea" }, + { n: ["flag-nf", "norfolk island flag"], u: "1f1f3-1f1eb" }, + { n: ["flag-ng", "nigeria flag"], u: "1f1f3-1f1ec" }, + { n: ["flag-ni", "nicaragua flag"], u: "1f1f3-1f1ee" }, + { n: ["flag-nl", "netherlands flag"], u: "1f1f3-1f1f1" }, + { n: ["flag-no", "norway flag"], u: "1f1f3-1f1f4" }, + { n: ["flag-np", "nepal flag"], u: "1f1f3-1f1f5" }, + { n: ["flag-nr", "nauru flag"], u: "1f1f3-1f1f7" }, + { n: ["flag-nu", "niue flag"], u: "1f1f3-1f1fa" }, + { n: ["flag-nz", "new zealand flag"], u: "1f1f3-1f1ff" }, + { n: ["flag-om", "oman flag"], u: "1f1f4-1f1f2" }, + { n: ["flag-pa", "panama flag"], u: "1f1f5-1f1e6" }, + { n: ["flag-pe", "peru flag"], u: "1f1f5-1f1ea" }, + { n: ["flag-pf", "french polynesia flag"], u: "1f1f5-1f1eb" }, + { n: ["flag-pg", "papua new guinea flag"], u: "1f1f5-1f1ec" }, + { n: ["flag-ph", "philippines flag"], u: "1f1f5-1f1ed" }, + { n: ["flag-pk", "pakistan flag"], u: "1f1f5-1f1f0" }, + { n: ["flag-pl", "poland flag"], u: "1f1f5-1f1f1" }, + { n: ["flag-pm", "st. pierre & miquelon flag"], u: "1f1f5-1f1f2" }, + { n: ["flag-pn", "pitcairn islands flag"], u: "1f1f5-1f1f3" }, + { n: ["flag-pr", "puerto rico flag"], u: "1f1f5-1f1f7" }, + { n: ["flag-ps", "palestinian territories flag"], u: "1f1f5-1f1f8" }, + { n: ["flag-pt", "portugal flag"], u: "1f1f5-1f1f9" }, + { n: ["flag-pw", "palau flag"], u: "1f1f5-1f1fc" }, + { n: ["flag-py", "paraguay flag"], u: "1f1f5-1f1fe" }, + { n: ["flag-qa", "qatar flag"], u: "1f1f6-1f1e6" }, + { n: ["flag-re", "r\xE9union flag"], u: "1f1f7-1f1ea" }, + { n: ["flag-ro", "romania flag"], u: "1f1f7-1f1f4" }, + { n: ["flag-rs", "serbia flag"], u: "1f1f7-1f1f8" }, + { n: ["ru", "flag-ru", "russia flag"], u: "1f1f7-1f1fa" }, + { n: ["flag-rw", "rwanda flag"], u: "1f1f7-1f1fc" }, + { n: ["flag-sa", "saudi arabia flag"], u: "1f1f8-1f1e6" }, + { n: ["flag-sb", "solomon islands flag"], u: "1f1f8-1f1e7" }, + { n: ["flag-sc", "seychelles flag"], u: "1f1f8-1f1e8" }, + { n: ["flag-sd", "sudan flag"], u: "1f1f8-1f1e9" }, + { n: ["flag-se", "sweden flag"], u: "1f1f8-1f1ea" }, + { n: ["flag-sg", "singapore flag"], u: "1f1f8-1f1ec" }, + { n: ["flag-sh", "st. helena flag"], u: "1f1f8-1f1ed" }, + { n: ["flag-si", "slovenia flag"], u: "1f1f8-1f1ee" }, + { n: ["flag-sj", "svalbard & jan mayen flag"], u: "1f1f8-1f1ef" }, + { n: ["flag-sk", "slovakia flag"], u: "1f1f8-1f1f0" }, + { n: ["flag-sl", "sierra leone flag"], u: "1f1f8-1f1f1" }, + { n: ["flag-sm", "san marino flag"], u: "1f1f8-1f1f2" }, + { n: ["flag-sn", "senegal flag"], u: "1f1f8-1f1f3" }, + { n: ["flag-so", "somalia flag"], u: "1f1f8-1f1f4" }, + { n: ["flag-sr", "suriname flag"], u: "1f1f8-1f1f7" }, + { n: ["flag-ss", "south sudan flag"], u: "1f1f8-1f1f8" }, + { n: ["flag-st", "s\xE3o tom\xE9 & pr\xEDncipe flag"], u: "1f1f8-1f1f9" }, + { n: ["flag-sv", "el salvador flag"], u: "1f1f8-1f1fb" }, + { n: ["flag-sx", "sint maarten flag"], u: "1f1f8-1f1fd" }, + { n: ["flag-sy", "syria flag"], u: "1f1f8-1f1fe" }, + { n: ["flag-sz", "eswatini flag"], u: "1f1f8-1f1ff" }, + { n: ["flag-ta", "tristan da cunha flag"], u: "1f1f9-1f1e6" }, + { n: ["flag-tc", "turks & caicos islands flag"], u: "1f1f9-1f1e8" }, + { n: ["flag-td", "chad flag"], u: "1f1f9-1f1e9" }, + { n: ["flag-tf", "french southern territories flag"], u: "1f1f9-1f1eb" }, + { n: ["flag-tg", "togo flag"], u: "1f1f9-1f1ec" }, + { n: ["flag-th", "thailand flag"], u: "1f1f9-1f1ed" }, + { n: ["flag-tj", "tajikistan flag"], u: "1f1f9-1f1ef" }, + { n: ["flag-tk", "tokelau flag"], u: "1f1f9-1f1f0" }, + { n: ["flag-tl", "timor-leste flag"], u: "1f1f9-1f1f1" }, + { n: ["flag-tm", "turkmenistan flag"], u: "1f1f9-1f1f2" }, + { n: ["flag-tn", "tunisia flag"], u: "1f1f9-1f1f3" }, + { n: ["flag-to", "tonga flag"], u: "1f1f9-1f1f4" }, + { n: ["flag-tr", "turkey flag"], u: "1f1f9-1f1f7" }, + { n: ["flag-tt", "trinidad & tobago flag"], u: "1f1f9-1f1f9" }, + { n: ["flag-tv", "tuvalu flag"], u: "1f1f9-1f1fb" }, + { n: ["flag-tw", "taiwan flag"], u: "1f1f9-1f1fc" }, + { n: ["flag-tz", "tanzania flag"], u: "1f1f9-1f1ff" }, + { n: ["flag-ua", "ukraine flag"], u: "1f1fa-1f1e6" }, + { n: ["flag-ug", "uganda flag"], u: "1f1fa-1f1ec" }, + { n: ["flag-um", "u.s. outlying islands flag"], u: "1f1fa-1f1f2" }, + { n: ["flag-un", "united nations flag"], u: "1f1fa-1f1f3" }, + { n: ["us", "flag-us", "united states flag"], u: "1f1fa-1f1f8" }, + { n: ["flag-uy", "uruguay flag"], u: "1f1fa-1f1fe" }, + { n: ["flag-uz", "uzbekistan flag"], u: "1f1fa-1f1ff" }, + { n: ["flag-va", "vatican city flag"], u: "1f1fb-1f1e6" }, + { n: ["flag-vc", "st. vincent & grenadines flag"], u: "1f1fb-1f1e8" }, + { n: ["flag-ve", "venezuela flag"], u: "1f1fb-1f1ea" }, + { n: ["flag-vg", "british virgin islands flag"], u: "1f1fb-1f1ec" }, + { n: ["flag-vi", "u.s. virgin islands flag"], u: "1f1fb-1f1ee" }, + { n: ["flag-vn", "vietnam flag"], u: "1f1fb-1f1f3" }, + { n: ["flag-vu", "vanuatu flag"], u: "1f1fb-1f1fa" }, + { n: ["flag-wf", "wallis & futuna flag"], u: "1f1fc-1f1eb" }, + { n: ["flag-ws", "samoa flag"], u: "1f1fc-1f1f8" }, + { n: ["flag-xk", "kosovo flag"], u: "1f1fd-1f1f0" }, + { n: ["flag-ye", "yemen flag"], u: "1f1fe-1f1ea" }, + { n: ["flag-yt", "mayotte flag"], u: "1f1fe-1f1f9" }, + { n: ["flag-za", "south africa flag"], u: "1f1ff-1f1e6" }, + { n: ["flag-zm", "zambia flag"], u: "1f1ff-1f1f2" }, + { n: ["flag-zw", "zimbabwe flag"], u: "1f1ff-1f1fc" }, + { + n: ["england flag", "flag-england"], + u: "1f3f4-e0067-e0062-e0065-e006e-e0067-e007f" + }, + { + n: ["scotland flag", "flag-scotland"], + u: "1f3f4-e0067-e0062-e0073-e0063-e0074-e007f" + }, + { + n: ["wales flag", "flag-wales"], + u: "1f3f4-e0067-e0062-e0077-e006c-e0073-e007f" } - }, app.workspace["rootSplit"]); -}; -var connectContext = async (plugin, tag, source) => { + ] }; -var renameSpaceContextFile = async (plugin, space, newSpace) => { - const context = spaceContextFromSpace(plugin, spaceContextPathFromName(space)); - if (getAbstractFileAtPath(app, context.dbPath)) { - const newSpaceDBPath = newSpace + ".mdb"; - if (!getAbstractFileAtPath( - app, - getAbstractFileAtPath(app, context.dbPath).parent.path + "/" + newSpaceDBPath - )) { - await renameFile( - plugin, - getAbstractFileAtPath(app, context.dbPath), - newSpaceDBPath - ); - } else { - await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); - } + +// src/components/ui/modals/stickerModal.tsx +var import_obsidian10 = require("obsidian"); +var htmlFromSticker = (sticker) => { + if (sticker.type == "emoji") { + return emojiFromString(sticker.html); } - app.workspace.iterateLeaves((leaf) => { - if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == context.contextPath) { - leaf.setViewState({ - type: CONTEXT_VIEW_TYPE, - state: { contextPath: spaceContextPathFromName(newSpace) } - }); - } - }, app.workspace["rootSplit"]); + return sticker.html; }; -var renameTagContextFile = async (plugin, tag, newTag) => { - const context = tagContextFromTag(plugin, tag); - if (getAbstractFileAtPath(app, context.dbPath)) { - const newTagDBPath = tagToTagPath(newTag) + ".mdb"; - if (!getAbstractFileAtPath( - app, - getAbstractFileAtPath(app, context.dbPath).parent.path + "/" + tagToTagPath(newTag) + ".mdb" - )) { - await renameFile( - plugin, - getAbstractFileAtPath(app, context.dbPath), - tagToTagPath(newTag) + ".mdb" - ); - } else { - await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath)); - } +var stickerModal = class extends import_obsidian10.FuzzySuggestModal { + constructor(app2, plugin, setIcon) { + super(app2); + this.plugin = plugin; + this.setIcon = setIcon; + this.resultContainerEl.toggleClass("mk-sticker-modal", true); + this.inputEl.focus(); + this.emptyStateText = i18n_default.labels.findStickers; + this.limit = 0; } - plugin.index.renameTag(tag, newTag); - app.workspace.iterateLeaves((leaf) => { - if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == tag) { - leaf.setViewState({ - type: CONTEXT_VIEW_TYPE, - state: { contextPath: newTag } - }); - } - }, app.workspace["rootSplit"]); -}; - -// src/utils/contexts/predicate/filterFns/filterFnTypes.ts -var filterFnTypes = { - isNotEmpty: { - type: ["text", "file", "link", "link-multi", "fileprop", "image"], - fn: (v3, f4) => !empty(v3, ""), - valueType: "none" - }, - isEmpty: { - type: ["text", "file", "link", "link-multi", "fileprop", "image"], - fn: (v3, f4) => empty(v3, ""), - valueType: "none" - }, - include: { - fn: (v3, f4) => stringCompare(v3, f4), - type: ["text", "file", "link", "link-multi", "fileprop", "image"], - valueType: "text" - }, - notInclude: { - type: ["text", "file", "link", "link-multi", "fileprop", "image"], - fn: (v3, f4) => !stringCompare(v3, f4), - valueType: "text" - }, - is: { - type: ["text", "file", "link", "context", "fileprop"], - fn: stringEqual, - valueType: "text" - }, - isNot: { - type: ["text", "file", "link", "context", "fileprop"], - fn: (v3, f4) => !stringEqual(v3, f4), - valueType: "text" - }, - equal: { - type: ["number"], - fn: stringEqual, - valueType: "number" - }, - isGreatThan: { - type: ["number"], - fn: greaterThan, - valueType: "number" - }, - isLessThan: { - type: ["number"], - fn: lessThan, - valueType: "number" - }, - isLessThanOrEqual: { - type: ["number"], - fn: (v3, f4) => !greaterThan(v3, f4), - valueType: "number" - }, - isGreatThanOrEqual: { - type: ["number"], - fn: (v3, f4) => !lessThan(v3, f4), - valueType: "number" - }, - dateBefore: { - type: ["date", "fileprop"], - fn: lessThan, - valueType: "date" - }, - dateAfter: { - type: ["date", "fileprop"], - fn: greaterThan, - valueType: "date" - }, - isAnyInList: { - type: ["option", "context", "option-multi", "context-multi", "tags-multi", "tags"], - fn: listIncludes, - valueType: "list" - }, - isNoneInList: { - type: ["option", "context", "option-multi", "context-multi", "tags-multi", "tags"], - fn: (v3, f4) => !listIncludes(v3, f4), - valueType: "list" - }, - isTrue: { - type: ["boolean"], - fn: (v3, f4) => v3 == "true", - valueType: "none" - }, - isFalse: { - type: ["boolean"], - fn: (v3, f4) => v3 != "true", - valueType: "none" + renderSuggestion(item, el) { + el.innerHTML = htmlFromSticker(item.item); + el.setAttr("aria-label", item.item.name); } -}; - -// src/utils/contexts/predicate/filter.ts -var stringEqual = (value, filterValue) => { - return value == filterValue; -}; -var empty = (value, filterValue) => { - return (value != null ? value : "").length == 0; -}; -var stringCompare = (value, filterValue) => { - return (value != null ? value : "").toLowerCase().includes((filterValue != null ? filterValue : "").toLowerCase()); -}; -var greaterThan = (value, filterValue) => { - return parseFloat(value) > parseFloat(filterValue); -}; -var lessThan = (value, filterValue) => { - return parseInt(value) > parseInt(filterValue); -}; -var listIncludes = (value, filterValue) => { - const valueList = value ? parseMultiString(value) : []; - const strings = filterValue ? parseMultiString(filterValue) : []; - return strings.some((f4) => valueList.some((g4) => g4 == f4)); -}; -var filterReturnForCol = (col, filter, row) => { - if (!col) - return true; - const filterType = filterFnTypes[filter == null ? void 0 : filter.fn]; - let result = true; - if (filterType && filterType.fn) { - result = filterType.fn(row[filter.field], filter.value); + getItemText(item) { + return item.name; } - return result; -}; - -// src/utils/contexts/predicate/sort.ts -var simpleSort = (a5, b4) => { - if (a5 < b4) - return -1; - if (a5 > b4) - return 1; - return 0; -}; -var stringSort = (value, filterValue) => simpleSort(value, filterValue); -var numSort = (value, filterValue) => simpleSort(parseFloat(value), parseFloat(filterValue)); -var boolSort = (value, filterValue) => simpleSort(value == "true" ? 1 : 0, filterValue == "true" ? 1 : 0); -var countSort = (value, filterValue) => simpleSort(parseMultiString(value).length, parseMultiString(filterValue).length); -var normalizedSortForType = (type, desc) => { - return Object.keys(sortFnTypes).find( - (f4) => sortFnTypes[f4].type.some((g4) => g4 == type) && sortFnTypes[f4].desc == desc - ); -}; -var sortFnTypes = { - alphabetical: { - type: ["text", "file", "link", "context", "fileprop"], - fn: stringSort, - label: i18n_default.sortTypes.alphaAsc, - desc: false - }, - reverseAlphabetical: { - type: ["text", "file", "link", "context", "fileprop"], - fn: (v3, f4) => stringSort(v3, f4) * -1, - label: i18n_default.sortTypes.alphaDesc, - desc: true - }, - earliest: { - type: ["date", "fileprop"], - fn: stringSort, - label: i18n_default.sortTypes.earliest, - desc: false - }, - latest: { - type: ["date", "fileprop"], - fn: (v3, f4) => stringSort(v3, f4) * -1, - label: i18n_default.sortTypes.latest, - desc: true - }, - boolean: { - type: ["boolean"], - fn: boolSort, - label: i18n_default.sortTypes.checkAsc, - desc: false - }, - booleanReverse: { - type: ["boolean"], - fn: (v3, f4) => boolSort(v3, f4) * -1, - label: i18n_default.sortTypes.checkDesc, - desc: true - }, - number: { - type: ["number", "fileprop"], - fn: numSort, - label: "1 \u2192 9", - desc: false - }, - reverseNumber: { - type: ["number", "fileprop"], - fn: (v3, f4) => numSort(v3, f4) * -1, - label: "9 \u2192 1", - desc: true - }, - count: { - type: ["option-multi", "context-multi", "link-multi"], - fn: countSort, - label: i18n_default.sortTypes.itemsDesc, - desc: true - }, - reverseCount: { - type: ["option-multi", "context-multi", "link-multi"], - fn: (v3, f4) => countSort(v3, f4) * -1, - label: i18n_default.sortTypes.itemsAsc, - desc: false + getItems() { + const allLucide = lucideIcons.map((f4) => ({ + name: f4, + type: "lucide", + keywords: f4, + value: f4, + html: (0, import_obsidian10.getIcon)(f4).outerHTML + })); + const allCustom = [...this.plugin.index.iconsCache.keys()].map( + (f4) => ({ + name: f4, + type: "vault", + keywords: f4, + value: f4, + html: this.plugin.index.iconsCache.get(f4) + }) + ); + const allEmojis = Object.keys(emojis).reduce( + (p3, c4) => [ + ...p3, + ...emojis[c4].map((e4) => ({ + type: "emoji", + name: e4.n[0], + value: e4.u, + html: e4.u + })) + ], + [] + ); + return [...allCustom, ...allEmojis, ...allLucide]; } -}; -var sortReturnForCol = (col, sort, row, row2) => { - if (!col) - return 0; - const sortType = sortFnTypes[sort.fn]; - if (sortType) { - return sortType.fn(row[sort.field], row2[sort.field]); + onChooseItem(item, evt) { + this.setIcon(item.type + "//" + item.value); } - return 0; }; -// src/utils/metadata/frontmatter/parseFrontMatter.ts -var parseFrontMatter = (field, value) => { - const YAMLtype = detectYAMLType(value, field); - switch (YAMLtype) { - case "object": - return JSON.stringify(value); - break; - case "number": - return value.toString(); - break; - case "boolean": - return value ? "true" : "false"; - break; - case "date": - return value; - break; - case "duration": - return serializeMultiDisplayString(Object.keys(value.values).reduce( - (p3, c4) => [ - ...p3, - ...value.values[c4] > 0 ? [value.values[c4] + " " + c4] : [] - ], - [] - )); - break; - case "option-multi": - case "link-multi": - if (typeof value === "string") { - return value; - } - return serializeMultiString( - value.map((v3) => { - if (!v3) { - return ""; - } - if (typeof v3 === "string") { - return v3; - } - if (v3.path) { - return v3.path; - } - if (Array.isArray(value) && v3.length == 1 && Array.isArray(v3[0]) && v3[0].length == 1 && typeof v3[0][0] === "string") { - return v3[0][0]; - } - return JSON.stringify(v3); - }) - ); - break; - case "link": - { - if (Array.isArray(value) && value.length == 1 && Array.isArray(value[0]) && value[0].length == 1 && typeof value[0][0] === "string") { - return value[0][0]; - } else if (typeof value === "string") { - return value; - } - return value.path; - } - break; - case "text": - case "tag": - case "image": - return value; - break; - } - return ""; -}; +// src/hooks/useLongPress.tsx +function isMouseEvent(e4) { + return e4 && "screenX" in e4; +} -// src/utils/path.ts -var import_obsidian11 = require("obsidian"); -var openPath = (plugin, _path) => { - const { type, path } = _path; - if (type == "file" || type == "folder") { - const afile = getAbstractFileAtPath(app, path); - if (afile) { - openAFile(afile, plugin, false); - } else { - if (type == "file") - createNewMarkdownFile( - plugin, - defaultNoteFolder(plugin, null), - path - ); - } - return; - } - if (type == "tag") { - openTagContext(path, plugin, false); - return; - } - if (type == "url") { - openURL(path); - return; - } -}; -var pathByString = (path, source) => { - const [str, alias] = path.split("|"); - const refIndex = str.lastIndexOf("#"); - const [link, ref] = refIndex > 0 ? [str.substring(0, refIndex), str.substring(refIndex + 1)] : [str, void 0]; - const type = pathTypeByString(link, source); - return { - fullPath: path, - path: link, - type, - alias, - ref - }; -}; -var pathTypeByString = (file, source) => { - if (file.charAt(0) == "#") { - return "tag"; - } - if (file.slice(-2) == "//") { - return "space"; - } - if (file.charAt(file.length - 1) == "/") { - return "folder"; - } - let portalFile; - if (source) { - portalFile = app.metadataCache.getFirstLinkpathDest(file, source); - } else { - portalFile = app.vault.getAbstractFileByPath(file); - } - if (portalFile instanceof import_obsidian11.TFolder) { - return "folder"; - } - if (portalFile instanceof import_obsidian11.TFile) { - return "file"; - } - if (file.match(urlRegex)) - return "url"; - return "unknown"; -}; +// src/components/FileSticker/FileSticker.tsx +var import_obsidian12 = require("obsidian"); -// src/utils/contexts/predicate/predicate.tsx -var defaultPredicateFnForType = (type, types) => { - const fnType = Object.keys(types).find( - (f4) => types[f4].type.find((g4) => g4 == type) - ); - return fnType; +// src/utils/emoji.ts +var saveFileIcons = (plugin, files, icon) => { + files.forEach((file) => { + saveFileSticker(plugin, file, icon); + }); }; -var predicateFnsForType = (type, types) => { - const fnTypes = Object.keys(types).filter( - (f4) => types[f4].type.find((g4) => g4 == type) - ); - return fnTypes; +var saveFileColors = (plugin, files, icon) => { + files.forEach((file) => { + saveFileColor(plugin, file, icon); + }); }; -var cleanPredicateType = (type, definedTypes) => { - return type.filter((f4) => Object.keys(definedTypes).find((g4) => g4 == f4.fn)); +var saveSpaceIcon = (plugin, space, icon) => { + saveSpaceSticker(plugin, space, icon); +}; +var removeSpaceIcon = (plugin, space) => { + saveSpaceSticker(plugin, space, ""); }; -var validatePredicate = (prevPredicate) => { - if (!prevPredicate) { - return defaultPredicate; - } - return { - ...defaultPredicate, - filters: Array.isArray(prevPredicate.filters) ? cleanPredicateType(prevPredicate.filters, filterFnTypes) : [], - sort: Array.isArray(prevPredicate.sort) ? cleanPredicateType(prevPredicate.sort, sortFnTypes) : [], - groupBy: Array.isArray(prevPredicate.groupBy) ? prevPredicate.groupBy : [], - colsOrder: Array.isArray(prevPredicate.colsOrder) ? prevPredicate.colsOrder : [], - colsHidden: Array.isArray(prevPredicate.colsHidden) ? prevPredicate.colsHidden : [], - colsSize: prevPredicate.colsSize - }; +var saveFileIcon = (plugin, data, icon) => { + saveFileSticker(plugin, data.path, icon); }; -var defaultPredicate = { - filters: [], - sort: [], - groupBy: [], - colsOrder: [], - colsHidden: [], - colsSize: {} +var removeFileIcons = (plugin, files) => { + files.forEach((file) => { + saveFileSticker(plugin, file, ""); + }); +}; +var removeFileIcon = (plugin, data) => { + saveFileSticker(plugin, data.path, ""); }; -// src/components/ContextView/MDBContext.tsx -var MDBContext = F({ - def: [], - tables: [], - cols: [], - sortedColumns: [], - data: [], - filteredData: [], - tableData: null, - contextTable: {}, - selectedRows: [], - selectRows: () => { - }, - setContextTable: () => { - }, - predicate: defaultPredicate, - savePredicate: () => { - }, - saveDB: () => null, - saveContextDB: () => null, - schema: null, - dbSchema: null, - setSchema: () => { - }, - setDBSchema: () => { - }, - hideColumn: () => { - }, - saveColumn: () => false, - newColumn: () => false, - sortColumn: () => { - }, - delColumn: () => { - }, - saveSchema: () => null, - deleteSchema: () => null, - tagContexts: [], - contextInfo: null, - dbFileExists: false, - readMode: false, - searchString: "", - setSearchString: () => { - }, - loadContextFields: () => { - }, - updateValue: () => { - }, - updateFieldValue: () => { +// src/utils/sticker.ts +var import_obsidian11 = require("obsidian"); +var stickerFromString = (sticker, plugin) => { + var _a2; + const [type, value] = parseStickerString(sticker); + if (type == "" || type == "emoji") { + return emojiFromString(value); + } else if (type == "ui") { + return uiIconSet[value]; + } else if (type == "lucide") { + return (_a2 = (0, import_obsidian11.getIcon)(value)) == null ? void 0 : _a2.outerHTML; + } else { + return plugin.index.iconsCache.get(value); } -}); -var MDBProvider = (props2) => { +}; + +// src/components/FileSticker/FileSticker.tsx +var FileSticker = (props2) => { var _a2; - const [readMode, setReadMode] = h2(props2.context.readOnly); - const [dbFileExists, setDBFileExists] = h2(false); - const [schema, setSchema] = h2(null); - const [searchString, setSearchString] = h2(null); - const [schemaTable, setSchemaTable] = h2(null); - const tables = (_a2 = schemaTable == null ? void 0 : schemaTable.rows) != null ? _a2 : []; - const [tableData, setTableData] = h2(null); - const [dbSchema, setDBSchema] = h2(null); - const [contextTable, setContextTable] = h2({}); - const [predicate, setPredicate] = h2(defaultPredicate); - const def = F2(() => parseContextDefString(dbSchema == null ? void 0 : dbSchema.def), [dbSchema]); - const [selectedRows, setSelectedRows] = h2([]); - const [metadataCache, setMetadataCache] = h2(null); - const defaultSchema = props2.context.type == "tag" ? defaultTagSchema : defaultFolderSchema; - const contextInfo = F2(() => { - return props2.context; - }, [props2.context]); - const tagContexts = F2( - () => def.filter((f4) => f4.type == "tag").map((f4) => f4.value), - [def] - ); - const cols = F2( - () => { - var _a3; - return tableData ? [ - ...(_a3 = tableData.cols.map((f4) => ({ ...f4, table: "" }))) != null ? _a3 : [], - ...tagContexts.reduce( - (p3, c4) => { - var _a4, _b2; - return [ - ...p3, - ...(_b2 = (_a4 = contextTable[c4]) == null ? void 0 : _a4.cols.filter( - (f4) => f4.name != FilePropertyName && f4.type != "fileprop" - ).map((f4) => ({ ...f4, table: c4 }))) != null ? _b2 : [] - ]; - }, - [] - ) - ] : []; - }, - [tableData, schema, contextTable, tagContexts] - ); - const data = F2( - () => { - var _a3; - return (_a3 = tableData == null ? void 0 : tableData.rows.map( - (r3, index) => linkContextRow( - props2.plugin, - { - _index: index.toString(), - ...r3, - ...tagContexts.reduce((p3, c4) => { - var _a4, _b2, _c2, _d2; - const contextRowIndexByFile = (_b2 = (_a4 = contextTable[c4]) == null ? void 0 : _a4.rows.findIndex((f4) => f4.File == r3.File)) != null ? _b2 : -1; - const contextRowsByFile = (_d2 = (_c2 = contextTable[c4]) == null ? void 0 : _c2.rows[contextRowIndexByFile]) != null ? _d2 : {}; - const contextRowsWithKeysAppended = Object.keys( - contextRowsByFile - ).reduce( - (pa, ca) => ({ ...pa, [ca + c4]: contextRowsByFile[ca] }), - { - ["_index" + c4]: contextRowIndexByFile.toString() - } - ); - return { ...p3, ...contextRowsWithKeysAppended }; - }, {}) - }, - cols - ) - )) != null ? _a3 : []; - }, - [tableData, schema, contextTable] - ); - const sortedColumns = F2(() => { - return cols.filter( - (f4) => f4.hidden != "true" && !predicate.colsHidden.some((c4) => c4 == f4.name + f4.table) - ).sort( - (a5, b4) => predicate.colsOrder.findIndex((x5) => x5 == a5.name + a5.table) - predicate.colsOrder.findIndex((x5) => x5 == b4.name + b4.table) - ); - }, [cols, predicate]); - const filteredData = F2( - () => data.filter((f4) => { - return predicate.filters.reduce((p3, c4) => { - return p3 ? filterReturnForCol( - cols.find((col) => col.name + col.table == c4.field), - c4, - f4 - ) : p3; - }, true); - }).filter( - (f4) => (searchString == null ? void 0 : searchString.length) > 0 ? matchAny(searchString).test( - Object.keys(f4).filter((g4) => g4.charAt(0) != "_").map((g4) => f4[g4]).join("|") - ) : true - ).sort((a5, b4) => { - return predicate.sort.reduce((p3, c4) => { - return p3 == 0 ? sortReturnForCol( - cols.find((col) => col.name + col.table == c4.field), - c4, - a5, - b4 - ) : p3; - }, 0); - }), - [predicate, data, cols, searchString] - ); - const deleteSchema = async (table) => { - if (table.primary) + const { fileCache } = props2; + const triggerStickerContextMenu = (e4) => { + if (!fileCache) return; - const deleteResult = await deleteMDBTable( - props2.plugin, - contextInfo, - table.id - ); - if (deleteResult) { - const newSchemaTable = { - ...schemaTable, - rows: schemaTable.rows.filter( - (f4) => f4.id != table.id && f4.def != table.id - ) - }; - setSchemaTable(newSchemaTable); - if (dbSchema.id == table.id) { - setDBSchema( - newSchemaTable.rows.find((g4) => g4.type == "db") + e4.preventDefault(); + const fileMenu = new import_obsidian12.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + let vaultChangeModal = new stickerModal( + props2.plugin.app, + props2.plugin, + (emoji) => saveFileSticker(props2.plugin, fileCache == null ? void 0 : fileCache.path, emoji) ); - } - } - }; - const saveSchema = async (table) => { - const newSchema = schemaTable.rows.find((f4) => f4.id == table.id) ? true : false; - const newSchemaTable = newSchema ? { - ...schemaTable, - rows: schemaTable.rows.map((f4) => f4.id == table.id ? table : f4) - } : { - ...schemaTable, - rows: [...schemaTable.rows, table] - }; - if (!contextInfo.readOnly) { - await saveDBToPath(props2.plugin, contextInfo.dbPath, { - m_schema: newSchemaTable - }); - if (!dbFileExists) { - saveDB2(tableData); - } - } - if (table.id == (schema == null ? void 0 : schema.id)) { - setSchema(table); - } - if (table.id == (dbSchema == null ? void 0 : dbSchema.id)) { - setDBSchema(table); - setTableData((f4) => ({ - ...f4, - schema: table - })); - } - setSchemaTable(newSchemaTable); - }; - const updateValue2 = (column, value, table, index, file) => { - var _a3, _b2; - const col = (_a3 = table == "" ? tableData : contextTable[table]) == null ? void 0 : _a3.cols.find( - (f4) => f4.name == column - ); - if (col) - saveFrontmatterValue( - props2.plugin, - file != null ? file : (_b2 = tableData.rows[index]) == null ? void 0 : _b2.File, - column, - value, - col.type, - props2.plugin.settings.saveAllContextToFrontmatter - ); - if (table == "") { - saveDB2({ - ...tableData, - rows: tableData.rows.map( - (r3, i4) => i4 == index ? { - ...r3, - [column]: value - } : r3 - ) + vaultChangeModal.open(); }); - } else if (contextTable[table]) { - saveContextDB( - { - ...contextTable[table], - rows: contextTable[table].rows.map( - (r3, i4) => i4 == index ? { - ...r3, - [column]: value - } : r3 - ) - }, - table - ); - } - }; - const sortColumn = (sort) => { - savePredicate({ - ...predicate, - sort: [sort] - }); - }; - const hideColumn = (col, hidden) => { - savePredicate({ - ...predicate, - colsHidden: hidden ? [ - ...predicate.colsHidden.filter((s5) => s5 != col.name + col.table), - col.name + col.table - ] : predicate.colsHidden.filter((s5) => s5 != col.name + col.table) - }); - }; - const updateFieldValue = (column, fieldValue, value, table, index, file) => { - var _a3; - const col = tableData.cols.find((f4) => f4.name == column); - saveFrontmatterValue( - props2.plugin, - file != null ? file : (_a3 = tableData.rows[index]) == null ? void 0 : _a3.File, - column, - value, - col.type, - props2.plugin.settings.saveAllContextToFrontmatter - ); - if (table == "") { - const newTable = { - ...tableData, - cols: tableData.cols.map( - (m5) => m5.name == column ? { - ...m5, - value: fieldValue - } : m5 - ), - rows: tableData.rows.map( - (r3, i4) => i4 == index ? { - ...r3, - [column]: value - } : r3 - ) - }; - saveDB2(newTable); - } else if (contextTable[table]) { - saveContextDB( - { - ...contextTable[table], - cols: contextTable[table].cols.map( - (m5) => m5.name == column ? { - ...m5, - value: fieldValue - } : m5 - ), - rows: contextTable[table].rows.map( - (r3, i4) => i4 == index ? { - ...r3, - [column]: value - } : r3 - ) - }, - table - ); - } - }; - const syncAllMetadata = (f4) => { - const files = f4.rows.map((f5) => f5.File); - const importYAML = (files2, fmKeys) => { - return files2.map((f5) => getAbstractFileAtPath(app, f5)).filter((f5) => f5).reduce( - (p3, c4) => { - const fm = frontMatterForFile(c4); - if (!fm) - return p3; - return { - uniques: [], - cols: uniq([...p3.cols, ...fmKeys]), - rows: [ - ...p3.rows, - { - File: c4.path, - ...fmKeys.reduce((p4, c5) => { - const value = parseFrontMatter(c5, fm[c5]); - if ((value == null ? void 0 : value.length) > 0) - return { ...p4, [c5]: value }; - return p4; - }, {}) - } - ] - }; - }, - { uniques: [], cols: [], rows: [] } - ); - }; - const yamlTableData = importYAML( - files, - f4.cols.filter((f5) => !f5.type.contains("file")).map((f5) => f5.name) - ); - const newRows = f4.rows.map((r3) => { - const fmRow = yamlTableData.rows.find((f5) => f5.File == r3.File); - if (fmRow) { - return { - ...r3, - ...fmRow - }; - } - return r3; }); - const rowsChanged = !import_lodash2.default.isEqual(newRows, tableData == null ? void 0 : tableData.rows); - const colsChanged = !import_lodash2.default.isEqual(tableData == null ? void 0 : tableData.cols, f4.cols); - if (rowsChanged || colsChanged) { - saveDB2({ - ...f4, - rows: newRows - }); - } - }; - p2(() => { - var _a3, _b2; - if (schemaTable) { - if (props2.schema) { - if ((dbSchema == null ? void 0 : dbSchema.id) != props2.schema) { - const preselectSchema = schemaTable.rows.find( - (g4) => g4.id == props2.schema - ); - if (preselectSchema) { - if (preselectSchema.type == "db") { - setDBSchema(preselectSchema); - return; - } else { - const preselectDBSchema = schemaTable.rows.find( - (g4) => g4.id == preselectSchema.def - ); - if (preselectDBSchema) { - setDBSchema(preselectDBSchema); - return; - } - } - } else { - const newSchema = { - id: uniqueNameFromString( - sanitizeTableName(props2.schema), - schemaTable.rows.map((g4) => g4.id) - ), - name: props2.schema, - type: "db" - }; - setDBSchema(newSchema); - saveSchema(newSchema).then((f4) => { - saveDB2({ - schema: newSchema, - cols: defaultTableFields.map((g4) => ({ - ...g4, - schemaId: newSchema.id - })), - rows: [] - }); - }); - } - } - } else { - if (!dbSchema) { - setDBSchema( - (_a3 = schemaTable.rows) == null ? void 0 : _a3.find((g4) => g4.type == "db") - ); - } else { - setDBSchema( - (_b2 = schemaTable.rows) == null ? void 0 : _b2.find((g4) => g4.id == dbSchema.id) - ); - } - } - } - }, [schemaTable]); - const loadTables = async () => { - if (getAbstractFileAtPath(app, contextInfo.dbPath) || contextInfo.isRemote) { - setDBFileExists(true); - getMDBTableSchemas(props2.plugin, contextInfo).then((f4) => { - setSchemaTable((prev) => ({ - ...defaultSchema, - rows: f4 - })); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeFileIcons(props2.plugin, [fileCache.path]); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY }); - } else { - if (props2.schema) { - saveDB2(defaultTableDataForContext(props2.plugin, contextInfo)).then( - (f4) => { - setSchemaTable((prev) => defaultSchema); - } - ); - } else { - setSchemaTable((prev) => defaultSchema); - setDBSchema((prev) => defaultFileDBSchema); - } - } - }; - const refreshFile = async (file) => { - var _a3; - if (file.path == props2.file && dbSchema) { - const fCache = (_a3 = app.metadataCache.getCache(file.path)) == null ? void 0 : _a3.frontmatter; - if ((0, import_lodash2.isEqual)(fCache, metadataCache)) - return; - setMetadataCache(fCache); - if (dbSchema.primary) { - runDef(); - } else { - getMDBData(); - } } + return false; }; - const refreshTags = async (tags) => { - if (tagContexts.some((f4) => tags.some((g4) => g4 == f4))) - if (dbSchema.primary) { - runDef(); - } else { - getMDBData(); - } + const triggerStickerMenu = (e4) => { + e4.stopPropagation(); + const vaultChangeModal = new stickerModal( + props2.plugin.app, + props2.plugin, + (emoji) => saveFileSticker(props2.plugin, fileCache.path, emoji) + ); + vaultChangeModal.open(); }; - const refreshSpace = async (evt) => { - if (evt.detail.type == "context") { - refreshMDB(evt.detail.name); - return; - } - if (evt.detail.type == "file") { - refreshFile(getAbstractFileAtPath(app, evt.detail.name)); - return; + return /* @__PURE__ */ Cn.createElement("div", { + className: `mk-file-icon ${(fileCache == null ? void 0 : fileCache.sticker) ? "" : "mk-file-icon-placeholder"}` + }, /* @__PURE__ */ Cn.createElement("button", { + "aria-label": i18n_default.buttons.changeIcon, + onContextMenu: triggerStickerContextMenu, + style: ((_a2 = fileCache == null ? void 0 : fileCache.color) == null ? void 0 : _a2.length) > 0 ? { + "--label-color": `${fileCache.color}`, + "--icon-color": `#ffffff` + } : { + "--icon-color": `var(--text-muted)` + }, + dangerouslySetInnerHTML: (fileCache == null ? void 0 : fileCache.sticker) ? { __html: stickerFromString(fileCache.sticker, props2.plugin) } : { + __html: defaultIconForExtension( + fileCache == null ? void 0 : fileCache.extension, + (fileCache == null ? void 0 : fileCache.color) ? true : false + ) + }, + onClick: (e4) => triggerStickerMenu(e4) + })); +}; + +// src/components/ui/menus/newPropertyMenu.tsx +var import_obsidian15 = require("obsidian"); + +// node_modules/@dnd-kit/utilities/dist/utilities.esm.js +function useCombinedRefs() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } + return F2( + () => (node) => { + refs.forEach((ref) => ref(node)); + }, + refs + ); +} +var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; +function isWindow(element) { + const elementString = Object.prototype.toString.call(element); + return elementString === "[object Window]" || elementString === "[object global]"; +} +function isNode(node) { + return "nodeType" in node; +} +function getWindow(target) { + var _target$ownerDocument, _target$ownerDocument2; + if (!target) { + return window; + } + if (isWindow(target)) { + return target; + } + if (!isNode(target)) { + return window; + } + return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window; +} +function isDocument(node) { + const { + Document + } = getWindow(node); + return node instanceof Document; +} +function isHTMLElement(node) { + if (isWindow(node)) { + return false; + } + return node instanceof getWindow(node).HTMLElement; +} +function isSVGElement(node) { + return node instanceof getWindow(node).SVGElement; +} +function getOwnerDocument(target) { + if (!target) { + return document; + } + if (isWindow(target)) { + return target.document; + } + if (!isNode(target)) { + return document; + } + if (isDocument(target)) { + return target; + } + if (isHTMLElement(target)) { + return target.ownerDocument; + } + return document; +} +var useIsomorphicLayoutEffect = canUseDOM ? y2 : p2; +function useEvent(handler) { + const handlerRef = _2(handler); + useIsomorphicLayoutEffect(() => { + handlerRef.current = handler; + }); + return T2(function() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - if ((evt.detail.type == "space" || evt.detail.type == "vault") && !dbFileExists) { - const defaultTable = defaultTableDataForContext( - props2.plugin, - contextInfo - ); - if (defaultTable) - setTableData(defaultTable); - } else if (evt.detail.type == "vault") { - refreshMDB(contextInfo.contextPath); + return handlerRef.current == null ? void 0 : handlerRef.current(...args); + }, []); +} +function useInterval() { + const intervalRef = _2(null); + const set = T2((listener, duration) => { + intervalRef.current = setInterval(listener, duration); + }, []); + const clear = T2(() => { + if (intervalRef.current !== null) { + clearInterval(intervalRef.current); + intervalRef.current = null; } - }; - const getMDBData = () => { - getMDBTable(props2.plugin, contextInfo, dbSchema.id).then((f4) => { - setTableData(f4); - }); - }; - const refreshMDB = async (contextPath) => { - if (!dbFileExists || (dbSchema == null ? void 0 : dbSchema.primary) != "true") { - return; + }, []); + return [set, clear]; +} +function useLatestValue(value, dependencies) { + if (dependencies === void 0) { + dependencies = [value]; + } + const valueRef = _2(value); + useIsomorphicLayoutEffect(() => { + if (valueRef.current !== value) { + valueRef.current = value; } - if (contextPath == contextInfo.contextPath) { - if (dbSchema) { - loadTables(); + }, dependencies); + return valueRef; +} +function useLazyMemo(callback, dependencies) { + const valueRef = _2(); + return F2( + () => { + const newValue = callback(valueRef.current); + valueRef.current = newValue; + return newValue; + }, + [...dependencies] + ); +} +function useNodeRef(onChange) { + const onChangeHandler = useEvent(onChange); + const node = _2(null); + const setNodeRef = T2( + (element) => { + if (element !== node.current) { + onChangeHandler == null ? void 0 : onChangeHandler(element, node.current); } - } else { - const tag = Object.keys(contextTable).find( - (t4) => tagContextFromTag(props2.plugin, t4).contextPath == contextPath - ); - if (tag) - loadContextFields(tag); - } - }; - p2(() => { - window.addEventListener(eventTypes.spacesChange, refreshSpace); - return () => { - window.removeEventListener(eventTypes.spacesChange, refreshSpace); - }; - }, [refreshSpace]); + node.current = element; + }, + [] + ); + return [node, setNodeRef]; +} +function usePrevious(value) { + const ref = _2(); p2(() => { - loadTables(); - }, [contextInfo]); - const saveDB2 = async (newTable) => { - var _a3; - if (contextInfo.readOnly) - return; - if (!dbFileExists) { - const defaultFields = defaultFieldsForContext(contextInfo); - const defaultTable = defaultTablesForContext(contextInfo); - const dbField = { - ...defaultTable, - m_fields: { - uniques: defaultFields.uniques, - cols: defaultFields.cols, - rows: [...(_a3 = defaultFields.rows) != null ? _a3 : [], ...newTable.cols] - }, - [newTable.schema.id]: { - uniques: newTable.cols.filter((c4) => c4.unique == "true").map((c4) => c4.name), - cols: newTable.cols.map((c4) => c4.name), - rows: newTable.rows + ref.current = value; + }, [value]); + return ref.current; +} +var ids = {}; +function useUniqueId(prefix, value) { + return F2(() => { + if (value) { + return value; + } + const id2 = ids[prefix] == null ? 0 : ids[prefix] + 1; + ids[prefix] = id2; + return prefix + "-" + id2; + }, [prefix, value]); +} +function createAdjustmentFn(modifier) { + return function(object) { + for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + adjustments[_key - 1] = arguments[_key]; + } + return adjustments.reduce((accumulator, adjustment) => { + const entries = Object.entries(adjustment); + for (const [key2, valueAdjustment] of entries) { + const value = accumulator[key2]; + if (value != null) { + accumulator[key2] = value + modifier * valueAdjustment; } + } + return accumulator; + }, { + ...object + }); + }; +} +var add = /* @__PURE__ */ createAdjustmentFn(1); +var subtract = /* @__PURE__ */ createAdjustmentFn(-1); +function hasViewportRelativeCoordinates(event) { + return "clientX" in event && "clientY" in event; +} +function isKeyboardEvent(event) { + if (!event) { + return false; + } + const { + KeyboardEvent + } = getWindow(event.target); + return KeyboardEvent && event instanceof KeyboardEvent; +} +function isTouchEvent(event) { + if (!event) { + return false; + } + const { + TouchEvent + } = getWindow(event.target); + return TouchEvent && event instanceof TouchEvent; +} +function getEventCoordinates(event) { + if (isTouchEvent(event)) { + if (event.touches && event.touches.length) { + const { + clientX: x5, + clientY: y5 + } = event.touches[0]; + return { + x: x5, + y: y5 + }; + } else if (event.changedTouches && event.changedTouches.length) { + const { + clientX: x5, + clientY: y5 + } = event.changedTouches[0]; + return { + x: x5, + y: y5 }; - await saveDBToPath(props2.plugin, contextInfo.dbPath, dbField).then( - (f4) => { - setDBFileExists(true); - f4 ? setTableData(newTable) : new import_obsidian12.Notice("DB ERROR"); - } - ); - } else { - await saveMDBToPath(props2.plugin, contextInfo, newTable).then((f4) => { - setDBFileExists(true); - f4 ? setTableData(newTable) : new import_obsidian12.Notice("DB ERROR"); - }); } - }; - p2(() => { - var _a3; - if (!schemaTable || !dbSchema) - return; - const _schema = (schema == null ? void 0 : schema.def) == dbSchema.id ? schemaTable.rows.find((f4) => f4.id == schema.id) : (_a3 = schemaTable.rows.find((f4) => f4.def == dbSchema.id)) != null ? _a3 : { - ...dbSchema, - id: uniqueNameFromString( - dbSchema.id + "View", - schemaTable.rows.map((f4) => f4.id) - ), - type: "table", - def: dbSchema.id + } + if (hasViewportRelativeCoordinates(event)) { + return { + x: event.clientX, + y: event.clientY }; - if (_schema) { - setSchema(_schema); - if (dbFileExists) { - if (dbSchema.primary) { - runDef(); - } else { - getMDBData(); - } - } else { - const defaultTable = defaultTableDataForContext( - props2.plugin, - contextInfo - ); - if (defaultTable) - setTableData(defaultTable); + } + return null; +} +var CSS = /* @__PURE__ */ Object.freeze({ + Translate: { + toString(transform) { + if (!transform) { + return; } + const { + x: x5, + y: y5 + } = transform; + return "translate3d(" + (x5 ? Math.round(x5) : 0) + "px, " + (y5 ? Math.round(y5) : 0) + "px, 0)"; } - }, [dbSchema]); - p2(() => { - if (dbFileExists && schema) { - parsePredicate(schema.predicate); + }, + Scale: { + toString(transform) { + if (!transform) { + return; + } + const { + scaleX, + scaleY + } = transform; + return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")"; } - }, [schema]); - p2(() => { - if (dbFileExists && tableData) - getContextTags(tableData); - }, [tableData]); - const selectRows = (lastSelected, rows) => { - setSelectedRows(rows); - if (!((dbSchema == null ? void 0 : dbSchema.primary) == "true")) - return; - if (lastSelected) { - const path = tableData.rows[parseInt(lastSelected)].File; - let evt = new CustomEvent(eventTypes.activePathChange, { - detail: { - selection: path, - path: { - ...pathByString(contextInfo.contextPath), - ref: schema == null ? void 0 : schema.id - } - } - }); - window.dispatchEvent(evt); - } else { - let evt = new CustomEvent(eventTypes.activePathChange, { - detail: { - path: { - ...pathByString(contextInfo.contextPath), - ref: schema == null ? void 0 : schema.id - }, - selection: null - } - }); - window.dispatchEvent(evt); + }, + Transform: { + toString(transform) { + if (!transform) { + return; + } + return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" "); } - }; - const getContextTags = async (_tableData) => { - const contextFields = _tableData.cols.filter((f4) => f4.type.contains("context")).map((f4) => f4.value).filter((f4) => !tagContexts.some((g4) => g4 == f4)); - for (let c4 of contextFields) { - loadContextFields(c4); + }, + Transition: { + toString(_ref) { + let { + property, + duration, + easing + } = _ref; + return property + " " + duration + "ms " + easing; } - }; - const runDef = async () => { - if (contextInfo.type == "folder") { - getMDBTable(props2.plugin, contextInfo, "files").then((f4) => { - for (let c4 of tagContexts) { - loadTagContext(c4, f4.rows); - } - setTableData(f4); - return f4; - }); - } else if (contextInfo.type == "tag") { - getMDBTable(props2.plugin, contextInfo, "files").then((f4) => { - for (let c4 of tagContexts) { - loadTagContext(c4, f4.rows); - } - setTableData(f4); - return f4; - }); - } else if (contextInfo.type == "space") { - getMDBTable(props2.plugin, contextInfo, "files").then((f4) => { - setTableData(f4); - return f4; - }); - } else { - getMDBTable(props2.plugin, contextInfo, dbSchema.id).then( - (f4) => setTableData(f4) - ); + } +}); +var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"; +function findFirstFocusableNode(element) { + if (element.matches(SELECTOR)) { + return element; + } + return element.querySelector(SELECTOR); +} + +// node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +var hiddenStyles = { + display: "none" +}; +function HiddenText(_ref) { + let { + id: id2, + value + } = _ref; + return Cn.createElement("div", { + id: id2, + style: hiddenStyles + }, value); +} +var visuallyHidden = { + position: "fixed", + width: 1, + height: 1, + margin: -1, + border: 0, + padding: 0, + overflow: "hidden", + clip: "rect(0 0 0 0)", + clipPath: "inset(100%)", + whiteSpace: "nowrap" +}; +function LiveRegion(_ref) { + let { + id: id2, + announcement + } = _ref; + return Cn.createElement("div", { + id: id2, + style: visuallyHidden, + role: "status", + "aria-live": "assertive", + "aria-atomic": true + }, announcement); +} +function useAnnouncement() { + const [announcement, setAnnouncement] = h2(""); + const announce = T2((value) => { + if (value != null) { + setAnnouncement(value); } + }, []); + return { + announce, + announcement }; - const loadTagContext = async (tag, files) => { - getMDBTable( - props2.plugin, - tagContextFromTag(props2.plugin, tag), - "files" - ).then((f4) => { - if (f4) { - const contextFields = f4.cols.filter((g4) => g4.type.contains("context")).map((g4) => g4.value).filter((g4) => !tagContexts.some((h5) => h5 == g4)); - for (let c4 of contextFields) { - loadContextFields(c4); - } - setContextTable((t4) => ({ - ...t4, - [tag]: f4 +} + +// node_modules/@dnd-kit/core/dist/core.esm.js +var DndMonitorContext = /* @__PURE__ */ F(null); +function useDndMonitor(listener) { + const registerListener = q2(DndMonitorContext); + p2(() => { + if (!registerListener) { + throw new Error("useDndMonitor must be used within a children of "); + } + const unsubscribe = registerListener(listener); + return unsubscribe; + }, [listener, registerListener]); +} +function useDndMonitorProvider() { + const [listeners] = h2(() => /* @__PURE__ */ new Set()); + const registerListener = T2((listener) => { + listeners.add(listener); + return () => listeners.delete(listener); + }, [listeners]); + const dispatch = T2((_ref) => { + let { + type, + event + } = _ref; + listeners.forEach((listener) => { + var _listener$type; + return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event); + }); + }, [listeners]); + return [dispatch, registerListener]; +} +var defaultScreenReaderInstructions = { + draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " +}; +var defaultAnnouncements = { + onDragStart(_ref) { + let { + active + } = _ref; + return "Picked up draggable item " + active.id + "."; + }, + onDragOver(_ref2) { + let { + active, + over + } = _ref2; + if (over) { + return "Draggable item " + active.id + " was moved over droppable area " + over.id + "."; + } + return "Draggable item " + active.id + " is no longer over a droppable area."; + }, + onDragEnd(_ref3) { + let { + active, + over + } = _ref3; + if (over) { + return "Draggable item " + active.id + " was dropped over droppable area " + over.id; + } + return "Draggable item " + active.id + " was dropped."; + }, + onDragCancel(_ref4) { + let { + active + } = _ref4; + return "Dragging was cancelled. Draggable item " + active.id + " was dropped."; + } +}; +function Accessibility(_ref) { + let { + announcements = defaultAnnouncements, + container, + hiddenTextDescribedById, + screenReaderInstructions = defaultScreenReaderInstructions + } = _ref; + const { + announce, + announcement + } = useAnnouncement(); + const liveRegionId = useUniqueId("DndLiveRegion"); + const [mounted, setMounted] = h2(false); + p2(() => { + setMounted(true); + }, []); + useDndMonitor(F2(() => ({ + onDragStart(_ref2) { + let { + active + } = _ref2; + announce(announcements.onDragStart({ + active + })); + }, + onDragMove(_ref3) { + let { + active, + over + } = _ref3; + if (announcements.onDragMove) { + announce(announcements.onDragMove({ + active, + over })); } - }); - }; - const loadContextFields = async (tag) => { - getMDBTable( - props2.plugin, - tagContextFromTag(props2.plugin, tag), - "files" - ).then((f4) => { - setContextTable((t4) => ({ - ...t4, - [tag]: f4 + }, + onDragOver(_ref4) { + let { + active, + over + } = _ref4; + announce(announcements.onDragOver({ + active, + over })); - }); - }; - const saveContextDB = async (newTable, tag) => { - const context = tagContextFromTag(props2.plugin, tag); - await saveMDBToPath(props2.plugin, context, newTable).then( - (f4) => f4 && setContextTable((t4) => ({ - ...t4, - [tag]: newTable - })) - ); - }; - const savePredicate = (newPredicate) => { - const cleanedPredicate = validatePredicate(newPredicate); - saveSchema({ - ...schema, - predicate: JSON.stringify(cleanedPredicate) - }); - setPredicate(cleanedPredicate); - }; - p2(() => { - setPredicate((p3) => ({ - ...p3, - colsOrder: uniq([ - ...p3.colsOrder, - ...cols.filter((f4) => f4.hidden != "true").map((c4) => c4.name + c4.table) - ]) - })); - }, [cols]); - const parsePredicate = (predicateStr) => { - const newPredicate = safelyParseJSON(predicateStr); - setPredicate(validatePredicate(newPredicate)); + }, + onDragEnd(_ref5) { + let { + active, + over + } = _ref5; + announce(announcements.onDragEnd({ + active, + over + })); + }, + onDragCancel(_ref6) { + let { + active, + over + } = _ref6; + announce(announcements.onDragCancel({ + active, + over + })); + } + }), [announce, announcements])); + if (!mounted) { + return null; + } + const markup = Cn.createElement(Cn.Fragment, null, Cn.createElement(HiddenText, { + id: hiddenTextDescribedById, + value: screenReaderInstructions.draggable + }), Cn.createElement(LiveRegion, { + id: liveRegionId, + announcement + })); + return container ? z3(markup, container) : markup; +} +var Action; +(function(Action2) { + Action2["DragStart"] = "dragStart"; + Action2["DragMove"] = "dragMove"; + Action2["DragEnd"] = "dragEnd"; + Action2["DragCancel"] = "dragCancel"; + Action2["DragOver"] = "dragOver"; + Action2["RegisterDroppable"] = "registerDroppable"; + Action2["SetDroppableDisabled"] = "setDroppableDisabled"; + Action2["UnregisterDroppable"] = "unregisterDroppable"; +})(Action || (Action = {})); +function noop() { +} +function useSensor(sensor, options) { + return F2( + () => ({ + sensor, + options: options != null ? options : {} + }), + [sensor, options] + ); +} +function useSensors() { + for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) { + sensors[_key] = arguments[_key]; + } + return F2( + () => [...sensors].filter((sensor) => sensor != null), + [...sensors] + ); +} +var defaultCoordinates = /* @__PURE__ */ Object.freeze({ + x: 0, + y: 0 +}); +function distanceBetween(p1, p22) { + return Math.sqrt(Math.pow(p1.x - p22.x, 2) + Math.pow(p1.y - p22.y, 2)); +} +function getRelativeTransformOrigin(event, rect) { + const eventCoordinates = getEventCoordinates(event); + if (!eventCoordinates) { + return "0 0"; + } + const transformOrigin = { + x: (eventCoordinates.x - rect.left) / rect.width * 100, + y: (eventCoordinates.y - rect.top) / rect.height * 100 }; - const delColumn = (column) => { - let mdbtable; - const table = column.table; - if (table == "") { - mdbtable = tableData; - } else if (contextTable[table]) { - mdbtable = contextTable[table]; + return transformOrigin.x + "% " + transformOrigin.y + "%"; +} +function sortCollisionsAsc(_ref, _ref2) { + let { + data: { + value: a5 } - const newFields = mdbtable.cols.filter( - (f4, i4) => f4.name != column.name - ); - const newTable = { - ...mdbtable, - cols: newFields, - rows: mdbtable.rows.map((r3) => { - const { [column.name]: val, ...rest } = r3; - return rest; - }) - }; - if (table == "") { - saveDB2(newTable); - } else if (contextTable[table]) { - saveContextDB(newTable, table); + } = _ref; + let { + data: { + value: b4 } - }; - const newColumn = (col) => { - return saveColumn(col); - }; - const saveColumn = (newColumn2, oldColumn) => { - let mdbtable; - const column = { - ...newColumn2, - name: sanitizeColumnName(newColumn2.name) - }; - const table = column.table; - if (table == "") { - mdbtable = tableData; - } else if (contextTable[table]) { - mdbtable = contextTable[table]; + } = _ref2; + return a5 - b4; +} +function sortCollisionsDesc(_ref3, _ref4) { + let { + data: { + value: a5 } - if (column.name == "") { - new import_obsidian12.Notice(i18n_default.notice.noPropertyName); - return false; + } = _ref3; + let { + data: { + value: b4 } - if (!oldColumn && mdbtable.cols.find( - (f4) => f4.name.toLowerCase() == column.name.toLowerCase() - ) || oldColumn && oldColumn.name != column.name && mdbtable.cols.find( - (f4) => f4.name.toLowerCase() == column.name.toLowerCase() - )) { - new import_obsidian12.Notice(i18n_default.notice.duplicatePropertyName); - return false; + } = _ref4; + return b4 - a5; +} +function cornersOfRectangle(_ref5) { + let { + left, + top, + height, + width + } = _ref5; + return [{ + x: left, + y: top + }, { + x: left + width, + y: top + }, { + x: left, + y: top + height + }, { + x: left + width, + y: top + height + }]; +} +function getFirstCollision(collisions, property) { + if (!collisions || collisions.length === 0) { + return null; + } + const [firstCollision] = collisions; + return property ? firstCollision[property] : firstCollision; +} +function centerOfRectangle(rect, left, top) { + if (left === void 0) { + left = rect.left; + } + if (top === void 0) { + top = rect.top; + } + return { + x: left + rect.width * 0.5, + y: top + rect.height * 0.5 + }; +} +var closestCenter = (_ref) => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top); + const collisions = []; + for (const droppableContainer of droppableContainers) { + const { + id: id2 + } = droppableContainer; + const rect = droppableRects.get(id2); + if (rect) { + const distBetween = distanceBetween(centerOfRectangle(rect), centerRect); + collisions.push({ + id: id2, + data: { + droppableContainer, + value: distBetween + } + }); } - const oldFieldIndex = oldColumn ? mdbtable.cols.findIndex((f4) => f4.name == oldColumn.name) : -1; - const newFields = oldFieldIndex == -1 ? [...mdbtable.cols, column] : mdbtable.cols.map((f4, i4) => i4 == oldFieldIndex ? column : f4); - const newTable = { - ...mdbtable, - cols: newFields, - rows: mdbtable.rows.map( - (f4) => oldColumn ? { - ...f4, - [column.name]: f4[oldColumn.name], - oldColumn: void 0 - } : f4 - ) - }; - if (oldColumn) - savePredicate({ - filters: predicate.filters.map( - (f4) => f4.field == oldColumn.name + oldColumn.table ? { ...f4, field: column.name + column.table } : f4 - ), - sort: predicate.sort.map( - (f4) => f4.field == oldColumn.name + oldColumn.table ? { ...f4, field: column.name + column.table } : f4 - ), - groupBy: predicate.groupBy.map( - (f4) => f4 == oldColumn.name + oldColumn.table ? column.name + column.table : f4 - ), - colsHidden: predicate.colsHidden.map( - (f4) => f4 == oldColumn.name + oldColumn.table ? column.name + column.table : f4 - ), - colsOrder: predicate.colsOrder.map( - (f4) => f4 == oldColumn.name + oldColumn.table ? column.name + column.table : f4 - ), - colsSize: { - ...predicate.colsSize, - [column.name + column.table]: predicate.colsSize[oldColumn.name + oldColumn.table], - [oldColumn.name + oldColumn.table]: void 0 + } + return collisions.sort(sortCollisionsAsc); +}; +var closestCorners = (_ref) => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const corners = cornersOfRectangle(collisionRect); + const collisions = []; + for (const droppableContainer of droppableContainers) { + const { + id: id2 + } = droppableContainer; + const rect = droppableRects.get(id2); + if (rect) { + const rectCorners = cornersOfRectangle(rect); + const distances = corners.reduce((accumulator, corner, index) => { + return accumulator + distanceBetween(rectCorners[index], corner); + }, 0); + const effectiveDistance = Number((distances / 4).toFixed(4)); + collisions.push({ + id: id2, + data: { + droppableContainer, + value: effectiveDistance } }); - if (table == "") { - syncAllMetadata(newTable); - } else if (contextTable[table]) { - saveContextDB(newTable, table); } - return true; - }; - return /* @__PURE__ */ Cn.createElement(MDBContext.Provider, { - value: { - def, - readMode, - contextInfo, - data, - filteredData, - loadContextFields, - selectedRows, - selectRows, - tableData, - cols, - sortedColumns, - contextTable, - setContextTable, - predicate, - savePredicate, - saveDB: saveDB2, - saveContextDB, - schema, - saveColumn, - hideColumn, - sortColumn, - delColumn, - newColumn, - tagContexts, - tables, - setSchema, - saveSchema, - deleteSchema, - dbFileExists, - dbSchema, - searchString, - setSearchString, - setDBSchema, - updateValue: updateValue2, - updateFieldValue + } + return collisions.sort(sortCollisionsAsc); +}; +function getIntersectionRatio(entry, target) { + const top = Math.max(target.top, entry.top); + const left = Math.max(target.left, entry.left); + const right = Math.min(target.left + target.width, entry.left + entry.width); + const bottom = Math.min(target.top + target.height, entry.top + entry.height); + const width = right - left; + const height = bottom - top; + if (left < right && top < bottom) { + const targetArea = target.width * target.height; + const entryArea = entry.width * entry.height; + const intersectionArea = width * height; + const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea); + return Number(intersectionRatio.toFixed(4)); + } + return 0; +} +var rectIntersection = (_ref) => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const collisions = []; + for (const droppableContainer of droppableContainers) { + const { + id: id2 + } = droppableContainer; + const rect = droppableRects.get(id2); + if (rect) { + const intersectionRatio = getIntersectionRatio(rect, collisionRect); + if (intersectionRatio > 0) { + collisions.push({ + id: id2, + data: { + droppableContainer, + value: intersectionRatio + } + }); + } } - }, props2.children); + } + return collisions.sort(sortCollisionsDesc); }; - -// src/components/ContextView/CardsView/CardColumnView.tsx -var import_classnames2 = __toESM(require_classnames()); - -// node_modules/@tanstack/table-core/build/lib/index.mjs -function functionalUpdate(updater, input) { - return typeof updater === "function" ? updater(input) : updater; -} -function makeStateUpdater(key2, instance) { - return (updater) => { - instance.setState((old) => { - return { - ...old, - [key2]: functionalUpdate(updater, old[key2]) - }; - }); +function adjustScale(transform, rect1, rect2) { + return { + ...transform, + scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1, + scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1 }; } -function isFunction(d5) { - return d5 instanceof Function; +function getRectDelta(rect1, rect2) { + return rect1 && rect2 ? { + x: rect1.left - rect2.left, + y: rect1.top - rect2.top + } : defaultCoordinates; } -function flattenBy(arr, getChildren) { - const flat = []; - const recurse = (subArr) => { - subArr.forEach((item) => { - flat.push(item); - const children = getChildren(item); - if (children != null && children.length) { - recurse(children); - } +function createRectAdjustmentFn(modifier) { + return function adjustClientRect(rect) { + for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + adjustments[_key - 1] = arguments[_key]; + } + return adjustments.reduce((acc, adjustment) => ({ + ...acc, + top: acc.top + modifier * adjustment.y, + bottom: acc.bottom + modifier * adjustment.y, + left: acc.left + modifier * adjustment.x, + right: acc.right + modifier * adjustment.x + }), { + ...rect }); }; - recurse(arr); - return flat; } -function memo(getDeps, fn2, opts) { - let deps = []; - let result; - return () => { - let depTime; - if (opts.key && opts.debug) - depTime = Date.now(); - const newDeps = getDeps(); - const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); - if (!depsChanged) { - return result; - } - deps = newDeps; - let resultTime; - if (opts.key && opts.debug) - resultTime = Date.now(); - result = fn2(...newDeps); - opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result); - if (opts.key && opts.debug) { - if (opts != null && opts.debug()) { - 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; - }; +var getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1); +function parseTransform(transform) { + if (transform.startsWith("matrix3d(")) { + const transformArray = transform.slice(9, -1).split(/, /); + return { + x: +transformArray[12], + y: +transformArray[13], + scaleX: +transformArray[0], + scaleY: +transformArray[5] + }; + } else if (transform.startsWith("matrix(")) { + const transformArray = transform.slice(7, -1).split(/, /); + return { + x: +transformArray[4], + y: +transformArray[5], + scaleX: +transformArray[0], + scaleY: +transformArray[3] + }; + } + return null; } -function createColumn(table, columnDef, depth, parent) { - var _ref, _resolvedColumnDef$id; - const defaultColumn = table._getDefaultColumnDef(); - const resolvedColumnDef = { - ...defaultColumn, - ...columnDef +function inverseTransform(rect, transform, transformOrigin) { + const parsedTransform = parseTransform(transform); + if (!parsedTransform) { + return rect; + } + const { + scaleX, + scaleY, + x: translateX, + y: translateY + } = parsedTransform; + const x5 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin); + const y5 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1)); + const w5 = scaleX ? rect.width / scaleX : rect.width; + const h5 = scaleY ? rect.height / scaleY : rect.height; + return { + width: w5, + height: h5, + top: y5, + right: x5 + w5, + bottom: y5 + h5, + left: x5 }; - const accessorKey = resolvedColumnDef.accessorKey; - let id2 = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace(".", "_") : void 0) != null ? _ref : typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header : void 0; - let accessorFn; - if (resolvedColumnDef.accessorFn) { - accessorFn = resolvedColumnDef.accessorFn; - } else if (accessorKey) { - if (accessorKey.includes(".")) { - accessorFn = (originalRow) => { - let result = originalRow; - for (const key2 of accessorKey.split(".")) { - var _result; - result = (_result = result) == null ? void 0 : _result[key2]; - if (result === void 0) { - console.warn(`"${key2}" in deeply nested key "${accessorKey}" returned undefined.`); - } - } - return result; - }; - } else { - accessorFn = (originalRow) => originalRow[resolvedColumnDef.accessorKey]; - } +} +var defaultOptions2 = { + ignoreTransform: false +}; +function getClientRect(element, options) { + if (options === void 0) { + options = defaultOptions2; } - if (!id2) { - if (true) { - throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + let rect = element.getBoundingClientRect(); + if (options.ignoreTransform) { + const { + transform, + transformOrigin + } = getWindow(element).getComputedStyle(element); + if (transform) { + rect = inverseTransform(rect, transform, transformOrigin); } - throw new Error(); } - let column = { - id: `${String(id2)}`, - accessorFn, - parent, - depth, - columnDef: resolvedColumnDef, - columns: [], - getFlatColumns: memo(() => [true], () => { - var _column$columns; - return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d5) => d5.getFlatColumns())]; - }, { - key: false, - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns; - } - }), - getLeafColumns: memo(() => [table._getOrderColumnsFn()], (orderColumns2) => { - var _column$columns2; - if ((_column$columns2 = column.columns) != null && _column$columns2.length) { - let leafColumns = column.columns.flatMap((column2) => column2.getLeafColumns()); - return orderColumns2(leafColumns); - } - return [column]; - }, { - key: false, - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns; - } - }) + const { + top, + left, + width, + height, + bottom, + right + } = rect; + return { + top, + left, + width, + height, + bottom, + right }; - column = table._features.reduce((obj, feature) => { - return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table)); - }, column); - return column; } -function createHeader(table, column, options) { - var _options$id; - const id2 = (_options$id = options.id) != null ? _options$id : column.id; - let header = { - id: id2, - column, - index: options.index, - isPlaceholder: !!options.isPlaceholder, - placeholderId: options.placeholderId, - depth: options.depth, - subHeaders: [], - colSpan: 0, - rowSpan: 0, - headerGroup: null, - getLeafHeaders: () => { - const leafHeaders = []; - const recurseHeader = (h5) => { - if (h5.subHeaders && h5.subHeaders.length) { - h5.subHeaders.map(recurseHeader); - } - leafHeaders.push(h5); - }; - recurseHeader(header); - return leafHeaders; - }, - getContext: () => ({ - table, - header, - column - }) - }; - table._features.forEach((feature) => { - Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table)); +function getTransformAgnosticClientRect(element) { + return getClientRect(element, { + ignoreTransform: true }); - return header; } -var Headers = { - createTable: (table) => { - return { - getHeaderGroups: memo(() => [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((d5) => d5.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; - const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d5) => d5.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; - const centerColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); - const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); - return headerGroups; - }, { - key: "getHeaderGroups", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders; - } - }), - getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { - leafColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); - return buildHeaderGroups(allColumns, leafColumns, table, "center"); - }, { - key: "getCenterHeaderGroups", - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders; - } - }), - getLeftHeaderGroups: memo(() => [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((d5) => d5.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; - return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left"); - }, { - key: "getLeftHeaderGroups", - debug: () => { - var _table$options$debugA3; - return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders; - } - }), - getRightHeaderGroups: memo(() => [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((d5) => d5.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; - return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right"); - }, { - key: "getRightHeaderGroups", - debug: () => { - var _table$options$debugA4; - return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders; - } - }), - getFooterGroups: memo(() => [table.getHeaderGroups()], (headerGroups) => { - return [...headerGroups].reverse(); - }, { - key: "getFooterGroups", - debug: () => { - var _table$options$debugA5; - return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders; - } - }), - getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], (headerGroups) => { - return [...headerGroups].reverse(); - }, { - key: "getLeftFooterGroups", - debug: () => { - var _table$options$debugA6; - return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders; - } - }), - getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], (headerGroups) => { - return [...headerGroups].reverse(); - }, { - key: "getCenterFooterGroups", - debug: () => { - var _table$options$debugA7; - return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders; - } - }), - getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], (headerGroups) => { - return [...headerGroups].reverse(); - }, { - key: "getRightFooterGroups", - debug: () => { - var _table$options$debugA8; - return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders; - } - }), - getFlatHeaders: memo(() => [table.getHeaderGroups()], (headerGroups) => { - return headerGroups.map((headerGroup) => { - return headerGroup.headers; - }).flat(); - }, { - key: "getFlatHeaders", - debug: () => { - var _table$options$debugA9; - return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders; - } - }), - getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], (left) => { - return left.map((headerGroup) => { - return headerGroup.headers; - }).flat(); - }, { - key: "getLeftFlatHeaders", - debug: () => { - var _table$options$debugA10; - return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders; - } - }), - getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], (left) => { - return left.map((headerGroup) => { - return headerGroup.headers; - }).flat(); - }, { - key: "getCenterFlatHeaders", - debug: () => { - var _table$options$debugA11; - return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders; - } - }), - getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], (left) => { - return left.map((headerGroup) => { - return headerGroup.headers; - }).flat(); - }, { - key: "getRightFlatHeaders", - debug: () => { - var _table$options$debugA12; - return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders; - } - }), - getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], (flatHeaders) => { - return flatHeaders.filter((header) => { - var _header$subHeaders; - return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); - }); - }, { - key: "getCenterLeafHeaders", - debug: () => { - var _table$options$debugA13; - return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders; - } - }), - getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], (flatHeaders) => { - return flatHeaders.filter((header) => { - var _header$subHeaders2; - return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); - }); - }, { - key: "getLeftLeafHeaders", - debug: () => { - var _table$options$debugA14; - return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders; - } - }), - getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], (flatHeaders) => { - return flatHeaders.filter((header) => { - var _header$subHeaders3; - return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); - }); - }, { - key: "getRightLeafHeaders", - debug: () => { - var _table$options$debugA15; - return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders; - } - }), - getLeafHeaders: memo(() => [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(); - }, { - key: "getLeafHeaders", - debug: () => { - var _table$options$debugA16; - return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders; - } - }) - }; +function getWindowClientRect(element) { + const width = element.innerWidth; + const height = element.innerHeight; + return { + top: 0, + left: 0, + right: width, + bottom: height, + width, + height + }; +} +function isFixed(node, computedStyle) { + if (computedStyle === void 0) { + computedStyle = getWindow(node).getComputedStyle(node); } -}; -function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { - var _headerGroups$0$heade, _headerGroups$; - let maxDepth = 0; - const findMaxDepth = function(columns, depth) { - if (depth === void 0) { - depth = 1; + return computedStyle.position === "fixed"; +} +function isScrollable(element, computedStyle) { + if (computedStyle === void 0) { + computedStyle = getWindow(element).getComputedStyle(element); + } + const overflowRegex = /(auto|scroll|overlay)/; + const properties2 = ["overflow", "overflowX", "overflowY"]; + return properties2.some((property) => { + const value = computedStyle[property]; + return typeof value === "string" ? overflowRegex.test(value) : false; + }); +} +function getScrollableAncestors(element, limit) { + const scrollParents = []; + function findScrollableAncestors(node) { + if (limit != null && scrollParents.length >= limit) { + return scrollParents; + } + if (!node) { + return scrollParents; + } + if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) { + scrollParents.push(node.scrollingElement); + return scrollParents; } - maxDepth = Math.max(maxDepth, depth); - columns.filter((column) => column.getIsVisible()).forEach((column) => { - var _column$columns; - if ((_column$columns = column.columns) != null && _column$columns.length) { - findMaxDepth(column.columns, depth + 1); - } - }, 0); - }; - findMaxDepth(allColumns); - let headerGroups = []; - const createHeaderGroup = (headersToGroup, depth) => { - const headerGroup = { - depth, - id: [headerFamily, `${depth}`].filter(Boolean).join("_"), - headers: [] - }; - const pendingParentHeaders = []; - headersToGroup.forEach((headerToGroup) => { - const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; - const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; - let column; - let isPlaceholder = false; - if (isLeafHeader && headerToGroup.column.parent) { - column = headerToGroup.column.parent; - } else { - column = headerToGroup.column; - isPlaceholder = true; - } - if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { - latestPendingParentHeader.subHeaders.push(headerToGroup); - } else { - const header = createHeader(table, column, { - id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join("_"), - isPlaceholder, - placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d5) => d5.column === column).length}` : void 0, - depth, - index: pendingParentHeaders.length - }); - header.subHeaders.push(headerToGroup); - pendingParentHeaders.push(header); + if (!isHTMLElement(node) || isSVGElement(node)) { + return scrollParents; + } + if (scrollParents.includes(node)) { + return scrollParents; + } + const computedStyle = getWindow(element).getComputedStyle(node); + if (node !== element) { + if (isScrollable(node, computedStyle)) { + scrollParents.push(node); } - headerGroup.headers.push(headerToGroup); - headerToGroup.headerGroup = headerGroup; - }); - headerGroups.push(headerGroup); - if (depth > 0) { - createHeaderGroup(pendingParentHeaders, depth - 1); } + if (isFixed(node, computedStyle)) { + return scrollParents; + } + return findScrollableAncestors(node.parentNode); + } + if (!element) { + return scrollParents; + } + return findScrollableAncestors(element); +} +function getFirstScrollableAncestor(node) { + const [firstScrollableAncestor] = getScrollableAncestors(node, 1); + return firstScrollableAncestor != null ? firstScrollableAncestor : null; +} +function getScrollableElement(element) { + if (!canUseDOM || !element) { + return null; + } + if (isWindow(element)) { + return element; + } + if (!isNode(element)) { + return null; + } + if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) { + return window; + } + if (isHTMLElement(element)) { + return element; + } + return null; +} +function getScrollXCoordinate(element) { + if (isWindow(element)) { + return element.scrollX; + } + return element.scrollLeft; +} +function getScrollYCoordinate(element) { + if (isWindow(element)) { + return element.scrollY; + } + return element.scrollTop; +} +function getScrollCoordinates(element) { + return { + x: getScrollXCoordinate(element), + y: getScrollYCoordinate(element) }; - const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { - depth: maxDepth, - index - })); - createHeaderGroup(bottomHeaders, maxDepth - 1); - headerGroups.reverse(); - const recurseHeadersForSpans = (headers) => { - const filteredHeaders = headers.filter((header) => header.column.getIsVisible()); - return filteredHeaders.map((header) => { - let colSpan = 0; - let rowSpan = 0; - let childRowSpans = [0]; - if (header.subHeaders && header.subHeaders.length) { - childRowSpans = []; - recurseHeadersForSpans(header.subHeaders).forEach((_ref) => { - let { - colSpan: childColSpan, - rowSpan: childRowSpan - } = _ref; - colSpan += childColSpan; - childRowSpans.push(childRowSpan); - }); - } else { - colSpan = 1; - } - const minChildRowSpan = Math.min(...childRowSpans); - rowSpan = rowSpan + minChildRowSpan; - header.colSpan = colSpan; - header.rowSpan = rowSpan; - return { - colSpan, - rowSpan - }; - }); +} +var Direction2; +(function(Direction3) { + Direction3[Direction3["Forward"] = 1] = "Forward"; + Direction3[Direction3["Backward"] = -1] = "Backward"; +})(Direction2 || (Direction2 = {})); +function isDocumentScrollingElement(element) { + if (!canUseDOM || !element) { + return false; + } + return element === document.scrollingElement; +} +function getScrollPosition(scrollingContainer) { + const minScroll = { + x: 0, + y: 0 + }; + const dimensions = isDocumentScrollingElement(scrollingContainer) ? { + height: window.innerHeight, + width: window.innerWidth + } : { + height: scrollingContainer.clientHeight, + width: scrollingContainer.clientWidth + }; + const maxScroll = { + x: scrollingContainer.scrollWidth - dimensions.width, + y: scrollingContainer.scrollHeight - dimensions.height + }; + const isTop = scrollingContainer.scrollTop <= minScroll.y; + const isLeft = scrollingContainer.scrollLeft <= minScroll.x; + const isBottom = scrollingContainer.scrollTop >= maxScroll.y; + const isRight = scrollingContainer.scrollLeft >= maxScroll.x; + return { + isTop, + isLeft, + isBottom, + isRight, + maxScroll, + minScroll }; - recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); - return headerGroups; } -var defaultColumnSizing = { - size: 150, - minSize: 20, - maxSize: Number.MAX_SAFE_INTEGER +var defaultThreshold = { + x: 0.2, + y: 0.2 }; -var getDefaultColumnSizingInfoState = () => ({ - startOffset: null, - startSize: null, - deltaOffset: null, - deltaPercentage: null, - isResizingColumn: false, - columnSizingStart: [] -}); -var ColumnSizing = { - getDefaultColumnDef: () => { - return defaultColumnSizing; - }, - getInitialState: (state) => { +function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) { + let { + top, + left, + right, + bottom + } = _ref; + if (acceleration === void 0) { + acceleration = 10; + } + if (thresholdPercentage === void 0) { + thresholdPercentage = defaultThreshold; + } + const { + isTop, + isBottom, + isLeft, + isRight + } = getScrollPosition(scrollContainer); + const direction = { + x: 0, + y: 0 + }; + const speed = { + x: 0, + y: 0 + }; + const threshold = { + height: scrollContainerRect.height * thresholdPercentage.y, + width: scrollContainerRect.width * thresholdPercentage.x + }; + if (!isTop && top <= scrollContainerRect.top + threshold.height) { + direction.y = Direction2.Backward; + speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height); + } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) { + direction.y = Direction2.Forward; + speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height); + } + if (!isRight && right >= scrollContainerRect.right - threshold.width) { + direction.x = Direction2.Forward; + speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width); + } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) { + direction.x = Direction2.Backward; + speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width); + } + return { + direction, + speed + }; +} +function getScrollElementRect(element) { + if (element === document.scrollingElement) { + const { + innerWidth: innerWidth2, + innerHeight: innerHeight2 + } = window; return { - columnSizing: {}, - columnSizingInfo: getDefaultColumnSizingInfoState(), - ...state + top: 0, + left: 0, + right: innerWidth2, + bottom: innerHeight2, + width: innerWidth2, + height: innerHeight2 }; - }, - getDefaultOptions: (table) => { - return { - columnResizeMode: "onEnd", - onColumnSizingChange: makeStateUpdater("columnSizing", table), - onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table) + } + const { + top, + left, + right, + bottom + } = element.getBoundingClientRect(); + return { + top, + left, + right, + bottom, + width: element.clientWidth, + height: element.clientHeight + }; +} +function getScrollOffsets(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return add(acc, getScrollCoordinates(node)); + }, defaultCoordinates); +} +function getScrollXOffset(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return acc + getScrollXCoordinate(node); + }, 0); +} +function getScrollYOffset(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return acc + getScrollYCoordinate(node); + }, 0); +} +function scrollIntoViewIfNeeded(element, measure) { + if (measure === void 0) { + measure = getClientRect; + } + if (!element) { + return; + } + const { + top, + left, + bottom, + right + } = measure(element); + const firstScrollableAncestor = getFirstScrollableAncestor(element); + if (!firstScrollableAncestor) { + return; + } + if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) { + element.scrollIntoView({ + block: "center", + inline: "center" + }); + } +} +var properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]]; +var Rect = class { + constructor(rect, element) { + this.rect = void 0; + this.width = void 0; + this.height = void 0; + this.top = void 0; + this.bottom = void 0; + this.right = void 0; + this.left = void 0; + const scrollableAncestors = getScrollableAncestors(element); + const scrollOffsets = getScrollOffsets(scrollableAncestors); + this.rect = { + ...rect }; - }, - createColumn: (column, table) => { - return { - getSize: () => { - var _column$columnDef$min, _ref, _column$columnDef$max; - const columnSize = table.getState().columnSizing[column.id]; - return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); - }, - getStart: (position) => { - const columns = !position ? table.getVisibleLeafColumns() : position === "left" ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); - const index = columns.findIndex((d5) => d5.id === column.id); - if (index > 0) { - const prevSiblingColumn = columns[index - 1]; - return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize(); - } - return 0; - }, - resetSize: () => { - table.setColumnSizing((_ref2) => { - let { - [column.id]: _9, - ...rest - } = _ref2; - return rest; + this.width = rect.width; + this.height = rect.height; + 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[key2] + scrollOffsetsDeltla; + }, + enumerable: true }); - }, - getCanResize: () => { - var _column$columnDef$ena, _table$options$enable; - return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); - }, - getIsResizing: () => { - return table.getState().columnSizingInfo.isResizingColumn === column.id; } - }; - }, - createHeader: (header, table) => { - return { - getSize: () => { - let sum2 = 0; - const recurse = (header2) => { - if (header2.subHeaders.length) { - header2.subHeaders.forEach(recurse); - } else { - var _header$column$getSiz; - sum2 += (_header$column$getSiz = header2.column.getSize()) != null ? _header$column$getSiz : 0; - } + } + Object.defineProperty(this, "rect", { + enumerable: false + }); + } +}; +var Listeners = class { + constructor(target) { + this.target = void 0; + this.listeners = []; + this.removeAll = () => { + this.listeners.forEach((listener) => { + var _this$target; + return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener); + }); + }; + this.target = target; + } + add(eventName, handler, options) { + var _this$target2; + (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options); + this.listeners.push([eventName, handler, options]); + } +}; +function getEventListenerTarget(target) { + const { + EventTarget + } = getWindow(target); + return target instanceof EventTarget ? target : getOwnerDocument(target); +} +function hasExceededDistance(delta, measurement) { + const dx = Math.abs(delta.x); + const dy = Math.abs(delta.y); + if (typeof measurement === "number") { + return Math.sqrt(dx ** 2 + dy ** 2) > measurement; + } + if ("x" in measurement && "y" in measurement) { + return dx > measurement.x && dy > measurement.y; + } + if ("x" in measurement) { + return dx > measurement.x; + } + if ("y" in measurement) { + return dy > measurement.y; + } + return false; +} +var EventName; +(function(EventName2) { + EventName2["Click"] = "click"; + EventName2["DragStart"] = "dragstart"; + EventName2["Keydown"] = "keydown"; + EventName2["ContextMenu"] = "contextmenu"; + EventName2["Resize"] = "resize"; + EventName2["SelectionChange"] = "selectionchange"; + EventName2["VisibilityChange"] = "visibilitychange"; +})(EventName || (EventName = {})); +function preventDefault(event) { + event.preventDefault(); +} +function stopPropagation(event) { + event.stopPropagation(); +} +var KeyboardCode; +(function(KeyboardCode2) { + KeyboardCode2["Space"] = "Space"; + KeyboardCode2["Down"] = "ArrowDown"; + KeyboardCode2["Right"] = "ArrowRight"; + KeyboardCode2["Left"] = "ArrowLeft"; + KeyboardCode2["Up"] = "ArrowUp"; + KeyboardCode2["Esc"] = "Escape"; + KeyboardCode2["Enter"] = "Enter"; +})(KeyboardCode || (KeyboardCode = {})); +var defaultKeyboardCodes = { + start: [KeyboardCode.Space, KeyboardCode.Enter], + cancel: [KeyboardCode.Esc], + end: [KeyboardCode.Space, KeyboardCode.Enter] +}; +var defaultKeyboardCoordinateGetter = (event, _ref) => { + let { + currentCoordinates + } = _ref; + switch (event.code) { + case KeyboardCode.Right: + return { + ...currentCoordinates, + x: currentCoordinates.x + 25 + }; + case KeyboardCode.Left: + return { + ...currentCoordinates, + x: currentCoordinates.x - 25 + }; + case KeyboardCode.Down: + return { + ...currentCoordinates, + y: currentCoordinates.y + 25 + }; + case KeyboardCode.Up: + return { + ...currentCoordinates, + y: currentCoordinates.y - 25 + }; + } + return void 0; +}; +var KeyboardSensor = class { + constructor(props2) { + this.props = void 0; + this.autoScrollEnabled = false; + this.referenceCoordinates = void 0; + this.listeners = void 0; + this.windowListeners = void 0; + this.props = props2; + const { + event: { + target + } + } = props2; + this.props = props2; + this.listeners = new Listeners(getOwnerDocument(target)); + this.windowListeners = new Listeners(getWindow(target)); + this.handleKeyDown = this.handleKeyDown.bind(this); + this.handleCancel = this.handleCancel.bind(this); + this.attach(); + } + attach() { + this.handleStart(); + this.windowListeners.add(EventName.Resize, this.handleCancel); + this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); + setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown)); + } + handleStart() { + const { + activeNode, + onStart + } = this.props; + const node = activeNode.node.current; + if (node) { + scrollIntoViewIfNeeded(node); + } + onStart(defaultCoordinates); + } + handleKeyDown(event) { + if (isKeyboardEvent(event)) { + const { + active, + context, + options + } = this.props; + const { + keyboardCodes = defaultKeyboardCodes, + coordinateGetter = defaultKeyboardCoordinateGetter, + scrollBehavior = "smooth" + } = options; + const { + code + } = event; + if (keyboardCodes.end.includes(code)) { + this.handleEnd(event); + return; + } + if (keyboardCodes.cancel.includes(code)) { + this.handleCancel(event); + return; + } + const { + collisionRect + } = context.current; + const currentCoordinates = collisionRect ? { + x: collisionRect.left, + y: collisionRect.top + } : defaultCoordinates; + if (!this.referenceCoordinates) { + this.referenceCoordinates = currentCoordinates; + } + const newCoordinates = coordinateGetter(event, { + active, + context: context.current, + currentCoordinates + }); + if (newCoordinates) { + const coordinatesDelta = subtract(newCoordinates, currentCoordinates); + const scrollDelta = { + x: 0, + y: 0 }; - recurse(header); - return sum2; - }, - getStart: () => { - if (header.index > 0) { - const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; - return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); - } - return 0; - }, - getResizeHandler: () => { - const column = table.getColumn(header.column.id); - const canResize = column == null ? void 0 : column.getCanResize(); - return (e4) => { - if (!column || !canResize) { - return; - } - e4.persist == null ? void 0 : e4.persist(); - if (isTouchStartEvent(e4)) { - if (e4.touches && e4.touches.length > 1) { + const { + scrollableAncestors + } = context.current; + for (const scrollContainer of scrollableAncestors) { + const direction = event.code; + const { + isTop, + isRight, + isLeft, + isBottom, + maxScroll, + minScroll + } = getScrollPosition(scrollContainer); + const scrollElementRect = getScrollElementRect(scrollContainer); + const clampedCoordinates = { + x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)), + y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y)) + }; + const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft; + const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop; + if (canScrollX && clampedCoordinates.x !== newCoordinates.x) { + const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x; + const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x; + if (canScrollToNewCoordinates && !coordinatesDelta.y) { + scrollContainer.scrollTo({ + left: newScrollCoordinates, + behavior: scrollBehavior + }); return; } - } - const startSize = header.getSize(); - const columnSizingStart = header ? header.getLeafHeaders().map((d5) => [d5.column.id, d5.column.getSize()]) : [[column.id, column.getSize()]]; - const clientX = isTouchStartEvent(e4) ? Math.round(e4.touches[0].clientX) : e4.clientX; - const newColumnSizing = {}; - const updateOffset = (eventType, clientXPos) => { - if (typeof clientXPos !== "number") { - return; + if (canScrollToNewCoordinates) { + scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates; + } else { + scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x; } - table.setColumnSizingInfo((old) => { - var _old$startOffset, _old$startSize; - const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0); - const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); - old.columnSizingStart.forEach((_ref3) => { - let [columnId, headerSize] = _ref3; - newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + if (scrollDelta.x) { + scrollContainer.scrollBy({ + left: -scrollDelta.x, + behavior: scrollBehavior }); - return { - ...old, - deltaOffset, - deltaPercentage - }; - }); - if (table.options.columnResizeMode === "onChange" || eventType === "end") { - table.setColumnSizing((old) => ({ - ...old, - ...newColumnSizing - })); } - }; - const onMove = (clientXPos) => updateOffset("move", clientXPos); - const onEnd = (clientXPos) => { - updateOffset("end", clientXPos); - table.setColumnSizingInfo((old) => ({ - ...old, - isResizingColumn: false, - startOffset: null, - startSize: null, - deltaOffset: null, - deltaPercentage: null, - columnSizingStart: [] - })); - }; - const mouseEvents = { - moveHandler: (e5) => onMove(e5.clientX), - upHandler: (e5) => { - document.removeEventListener("mousemove", mouseEvents.moveHandler); - document.removeEventListener("mouseup", mouseEvents.upHandler); - onEnd(e5.clientX); + break; + } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) { + const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y; + const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y; + if (canScrollToNewCoordinates && !coordinatesDelta.x) { + scrollContainer.scrollTo({ + top: newScrollCoordinates, + behavior: scrollBehavior + }); + return; } - }; - const touchEvents = { - moveHandler: (e5) => { - if (e5.cancelable) { - e5.preventDefault(); - e5.stopPropagation(); - } - onMove(e5.touches[0].clientX); - return false; - }, - upHandler: (e5) => { - var _e$touches$; - document.removeEventListener("touchmove", touchEvents.moveHandler); - document.removeEventListener("touchend", touchEvents.upHandler); - if (e5.cancelable) { - e5.preventDefault(); - e5.stopPropagation(); - } - onEnd((_e$touches$ = e5.touches[0]) == null ? void 0 : _e$touches$.clientX); + if (canScrollToNewCoordinates) { + scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates; + } else { + scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y; } - }; - const passiveIfSupported = passiveEventSupported() ? { - passive: false - } : false; - if (isTouchStartEvent(e4)) { - document.addEventListener("touchmove", touchEvents.moveHandler, passiveIfSupported); - document.addEventListener("touchend", touchEvents.upHandler, passiveIfSupported); - } else { - document.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported); - document.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported); + if (scrollDelta.y) { + scrollContainer.scrollBy({ + top: -scrollDelta.y, + behavior: scrollBehavior + }); + } + break; } - table.setColumnSizingInfo((old) => ({ - ...old, - startOffset: clientX, - startSize, - deltaOffset: 0, - deltaPercentage: 0, - columnSizingStart, - isResizingColumn: column.id - })); - }; - } - }; - }, - createTable: (table) => { - return { - setColumnSizing: (updater) => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater), - setColumnSizingInfo: (updater) => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater), - resetColumnSizing: (defaultState) => { - var _table$initialState$c; - table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); - }, - resetHeaderSizeInfo: (defaultState) => { - var _table$initialState$c2; - table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); - }, - getTotalSize: () => { - var _table$getHeaderGroup, _table$getHeaderGroup2; - return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum2, header) => { - return sum2 + header.getSize(); - }, 0)) != null ? _table$getHeaderGroup : 0; - }, - getLeftTotalSize: () => { - var _table$getLeftHeaderG, _table$getLeftHeaderG2; - return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum2, header) => { - return sum2 + header.getSize(); - }, 0)) != null ? _table$getLeftHeaderG : 0; - }, - getCenterTotalSize: () => { - var _table$getCenterHeade, _table$getCenterHeade2; - return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum2, header) => { - return sum2 + header.getSize(); - }, 0)) != null ? _table$getCenterHeade : 0; - }, - getRightTotalSize: () => { - var _table$getRightHeader, _table$getRightHeader2; - return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum2, header) => { - return sum2 + header.getSize(); - }, 0)) != null ? _table$getRightHeader : 0; + } + this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta)); } - }; + } + } + handleMove(event, coordinates) { + const { + onMove + } = this.props; + event.preventDefault(); + onMove(coordinates); + } + handleEnd(event) { + const { + onEnd + } = this.props; + event.preventDefault(); + this.detach(); + onEnd(); + } + handleCancel(event) { + const { + onCancel + } = this.props; + event.preventDefault(); + this.detach(); + onCancel(); + } + detach() { + this.listeners.removeAll(); + this.windowListeners.removeAll(); } }; -var passiveSupported = null; -function passiveEventSupported() { - if (typeof passiveSupported === "boolean") - return passiveSupported; - let supported = false; - try { - const options = { - get passive() { - supported = true; +KeyboardSensor.activators = [{ + eventName: "onKeyDown", + handler: (event, _ref, _ref2) => { + let { + keyboardCodes = defaultKeyboardCodes, + onActivation + } = _ref; + let { + active + } = _ref2; + const { + code + } = event.nativeEvent; + if (keyboardCodes.start.includes(code)) { + const activator = active.activatorNode.current; + if (activator && event.target !== activator) { return false; } - }; - const noop2 = () => { - }; - window.addEventListener("test", noop2, options); - window.removeEventListener("test", noop2); - } catch (err) { - supported = false; + event.preventDefault(); + onActivation == null ? void 0 : onActivation({ + event: event.nativeEvent + }); + return true; + } + return false; } - passiveSupported = supported; - return passiveSupported; +}]; +function isDistanceConstraint(constraint) { + return Boolean(constraint && "distance" in constraint); } -function isTouchStartEvent(e4) { - return e4.type === "touchstart"; +function isDelayConstraint(constraint) { + return Boolean(constraint && "delay" in constraint); } -var Expanding = { - getInitialState: (state) => { - return { - expanded: {}, - ...state - }; - }, - getDefaultOptions: (table) => { - return { - onExpandedChange: makeStateUpdater("expanded", table), - paginateExpandedRows: true - }; - }, - createTable: (table) => { - let registered = false; - let queued = false; - return { - _autoResetExpanded: () => { - var _ref, _table$options$autoRe; - if (!registered) { - table._queue(() => { - registered = true; - }); - return; - } - 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; - table._queue(() => { - table.resetExpanded(); - queued = false; - }); - } - }, - setExpanded: (updater) => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater), - toggleAllRowsExpanded: (expanded) => { - if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { - table.setExpanded(true); - } else { - table.setExpanded({}); - } - }, - resetExpanded: (defaultState) => { - var _table$initialState$e, _table$initialState; - table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); - }, - getCanSomeRowsExpand: () => { - return table.getRowModel().flatRows.some((row) => row.getCanExpand()); - }, - getToggleAllRowsExpandedHandler: () => { - return (e4) => { - e4.persist == null ? void 0 : e4.persist(); - table.toggleAllRowsExpanded(); - }; - }, - getIsSomeRowsExpanded: () => { - const expanded = table.getState().expanded; - return expanded === true || Object.values(expanded).some(Boolean); - }, - getIsAllRowsExpanded: () => { - const expanded = table.getState().expanded; - if (typeof expanded === "boolean") { - return expanded === true; - } - if (!Object.keys(expanded).length) { - return false; +var AbstractPointerSensor = class { + constructor(props2, events2, listenerTarget) { + var _getEventCoordinates; + if (listenerTarget === void 0) { + listenerTarget = getEventListenerTarget(props2.event.target); + } + this.props = void 0; + this.events = void 0; + this.autoScrollEnabled = true; + this.document = void 0; + this.activated = false; + this.initialCoordinates = void 0; + this.timeoutId = null; + this.listeners = void 0; + this.documentListeners = void 0; + this.windowListeners = void 0; + this.props = props2; + this.events = events2; + const { + event + } = props2; + const { + target + } = event; + this.props = props2; + this.events = events2; + this.document = getOwnerDocument(target); + this.documentListeners = new Listeners(this.document); + this.listeners = new Listeners(listenerTarget); + this.windowListeners = new Listeners(getWindow(target)); + this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates; + this.handleStart = this.handleStart.bind(this); + this.handleMove = this.handleMove.bind(this); + this.handleEnd = this.handleEnd.bind(this); + this.handleCancel = this.handleCancel.bind(this); + this.handleKeydown = this.handleKeydown.bind(this); + this.removeTextSelection = this.removeTextSelection.bind(this); + this.attach(); + } + attach() { + const { + events: events2, + props: { + options: { + activationConstraint } - if (table.getRowModel().flatRows.some((row) => !row.getIsExpanded())) { - return false; + } + } = this; + this.listeners.add(events2.move.name, this.handleMove, { + passive: false + }); + this.listeners.add(events2.end.name, this.handleEnd); + this.windowListeners.add(EventName.Resize, this.handleCancel); + this.windowListeners.add(EventName.DragStart, preventDefault); + this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); + this.windowListeners.add(EventName.ContextMenu, preventDefault); + this.documentListeners.add(EventName.Keydown, this.handleKeydown); + if (activationConstraint) { + if (isDistanceConstraint(activationConstraint)) { + return; + } + if (isDelayConstraint(activationConstraint)) { + this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay); + return; + } + } + this.handleStart(); + } + detach() { + this.listeners.removeAll(); + this.windowListeners.removeAll(); + setTimeout(this.documentListeners.removeAll, 50); + if (this.timeoutId !== null) { + clearTimeout(this.timeoutId); + this.timeoutId = null; + } + } + handleStart() { + const { + initialCoordinates + } = this; + const { + onStart + } = this.props; + if (initialCoordinates) { + this.activated = true; + this.documentListeners.add(EventName.Click, stopPropagation, { + capture: true + }); + this.removeTextSelection(); + this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection); + onStart(initialCoordinates); + } + } + handleMove(event) { + var _getEventCoordinates2; + const { + activated, + initialCoordinates, + props: props2 + } = this; + const { + onMove, + options: { + activationConstraint + } + } = props2; + if (!initialCoordinates) { + return; + } + const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates; + const delta = subtract(initialCoordinates, coordinates); + if (!activated && activationConstraint) { + if (isDelayConstraint(activationConstraint)) { + if (hasExceededDistance(delta, activationConstraint.tolerance)) { + return this.handleCancel(); } - return true; - }, - getExpandedDepth: () => { - let maxDepth = 0; - const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); - rowIds.forEach((id2) => { - const splitId = id2.split("."); - maxDepth = Math.max(maxDepth, splitId.length); - }); - return maxDepth; - }, - getPreExpandedRowModel: () => table.getSortedRowModel(), - getExpandedRowModel: () => { - if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { - table._getExpandedRowModel = table.options.getExpandedRowModel(table); + return; + } + if (isDistanceConstraint(activationConstraint)) { + if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) { + return this.handleCancel(); } - if (table.options.manualExpanding || !table._getExpandedRowModel) { - return table.getPreExpandedRowModel(); + if (hasExceededDistance(delta, activationConstraint.distance)) { + return this.handleStart(); } - return table._getExpandedRowModel(); - } - }; - }, - createRow: (row, table) => { - return { - toggleExpanded: (expanded) => { - table.setExpanded((old) => { - var _expanded; - const exists = old === true ? true : !!(old != null && old[row.id]); - let oldExpanded = {}; - if (old === true) { - Object.keys(table.getRowModel().rowsById).forEach((rowId) => { - oldExpanded[rowId] = true; - }); - } else { - oldExpanded = old; - } - expanded = (_expanded = expanded) != null ? _expanded : !exists; - if (!exists && expanded) { - return { - ...oldExpanded, - [row.id]: true - }; - } - if (exists && !expanded) { - const { - [row.id]: _9, - ...rest - } = oldExpanded; - return rest; - } - return old; - }); - }, - getIsExpanded: () => { - var _table$options$getIsR; - const expanded = table.getState().expanded; - return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); - }, - getCanExpand: () => { - var _table$options$getRow, _table$options$enable, _row$subRows; - return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); - }, - getToggleExpandedHandler: () => { - const canExpand = row.getCanExpand(); - return () => { - if (!canExpand) - return; - row.toggleExpanded(); - }; + return; } - }; + } + if (event.cancelable) { + event.preventDefault(); + } + onMove(coordinates); + } + handleEnd() { + const { + onEnd + } = this.props; + this.detach(); + onEnd(); + } + handleCancel() { + const { + onCancel + } = this.props; + this.detach(); + onCancel(); + } + handleKeydown(event) { + if (event.code === KeyboardCode.Esc) { + this.handleCancel(); + } + } + removeTextSelection() { + var _this$document$getSel; + (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges(); } }; -var includesString = (row, columnId, filterValue) => { - var _row$getValue; - const search = filterValue.toLowerCase(); - return Boolean((_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search)); -}; -includesString.autoRemove = (val) => testFalsey(val); -var includesStringSensitive = (row, columnId, filterValue) => { - var _row$getValue2; - return Boolean((_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue)); -}; -includesStringSensitive.autoRemove = (val) => testFalsey(val); -var equalsString = (row, columnId, filterValue) => { - var _row$getValue3; - return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase(); -}; -equalsString.autoRemove = (val) => testFalsey(val); -var arrIncludes = (row, columnId, filterValue) => { - var _row$getValue4; - return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); -}; -arrIncludes.autoRemove = (val) => testFalsey(val) || !(val != null && val.length); -var arrIncludesAll = (row, columnId, filterValue) => { - return !filterValue.some((val) => { - var _row$getValue5; - return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); - }); -}; -arrIncludesAll.autoRemove = (val) => testFalsey(val) || !(val != null && val.length); -var arrIncludesSome = (row, columnId, filterValue) => { - return filterValue.some((val) => { - var _row$getValue6; - return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); - }); -}; -arrIncludesSome.autoRemove = (val) => testFalsey(val) || !(val != null && val.length); -var equals = (row, columnId, filterValue) => { - return row.getValue(columnId) === filterValue; -}; -equals.autoRemove = (val) => testFalsey(val); -var weakEquals = (row, columnId, filterValue) => { - return row.getValue(columnId) == filterValue; +var events = { + move: { + name: "pointermove" + }, + end: { + name: "pointerup" + } }; -weakEquals.autoRemove = (val) => testFalsey(val); -var inNumberRange = (row, columnId, filterValue) => { - let [min3, max3] = filterValue; - const rowValue = row.getValue(columnId); - return rowValue >= min3 && rowValue <= max3; +var PointerSensor = class extends AbstractPointerSensor { + constructor(props2) { + const { + event + } = props2; + const listenerTarget = getOwnerDocument(event.target); + super(props2, events, listenerTarget); + } }; -inNumberRange.resolveFilterValue = (val) => { - let [unsafeMin, unsafeMax] = val; - let parsedMin = typeof unsafeMin !== "number" ? parseFloat(unsafeMin) : unsafeMin; - let parsedMax = typeof unsafeMax !== "number" ? parseFloat(unsafeMax) : unsafeMax; - let min3 = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; - let max3 = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; - if (min3 > max3) { - const temp = min3; - min3 = max3; - max3 = temp; +PointerSensor.activators = [{ + eventName: "onPointerDown", + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + if (!event.isPrimary || event.button !== 0) { + return false; + } + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; +var events$1 = { + move: { + name: "mousemove" + }, + end: { + name: "mouseup" } - return [min3, max3]; }; -inNumberRange.autoRemove = (val) => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); -var filterFns = { - includesString, - includesStringSensitive, - equalsString, - arrIncludes, - arrIncludesAll, - arrIncludesSome, - equals, - weakEquals, - inNumberRange +var MouseButton; +(function(MouseButton2) { + MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick"; +})(MouseButton || (MouseButton = {})); +var MouseSensor = class extends AbstractPointerSensor { + constructor(props2) { + super(props2, events$1, getOwnerDocument(props2.event.target)); + } }; -function testFalsey(val) { - return val === void 0 || val === null || val === ""; -} -var Filters = { - getDefaultColumnDef: () => { - return { - filterFn: "auto" - }; +MouseSensor.activators = [{ + eventName: "onMouseDown", + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + if (event.button === MouseButton.RightClick) { + return false; + } + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; +var events$2 = { + move: { + name: "touchmove" }, - getInitialState: (state) => { - return { - columnFilters: [], - globalFilter: void 0, - ...state + end: { + name: "touchend" + } +}; +var TouchSensor = class extends AbstractPointerSensor { + constructor(props2) { + super(props2, events$2); + } + static setup() { + window.addEventListener(events$2.move.name, noop2, { + capture: false, + passive: false + }); + return function teardown() { + window.removeEventListener(events$2.move.name, noop2); }; - }, - getDefaultOptions: (table) => { - return { - onColumnFiltersChange: makeStateUpdater("columnFilters", table), - onGlobalFilterChange: makeStateUpdater("globalFilter", table), - filterFromLeafRows: false, - maxLeafRowFilterDepth: 100, - globalFilterFn: "auto", - getColumnCanGlobalFilter: (column) => { - var _table$getCoreRowMode, _table$getCoreRowMode2; - const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue(); - return typeof value === "string" || typeof value === "number"; + function noop2() { + } + } +}; +TouchSensor.activators = [{ + eventName: "onTouchStart", + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + const { + touches + } = event; + if (touches.length > 1) { + return false; + } + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; +var AutoScrollActivator; +(function(AutoScrollActivator2) { + AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer"; + AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect"; +})(AutoScrollActivator || (AutoScrollActivator = {})); +var TraversalOrder; +(function(TraversalOrder2) { + TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder"; + TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder"; +})(TraversalOrder || (TraversalOrder = {})); +function useAutoScroller(_ref) { + let { + acceleration, + activator = AutoScrollActivator.Pointer, + canScroll, + draggingRect, + enabled, + interval = 5, + order = TraversalOrder.TreeOrder, + pointerCoordinates, + scrollableAncestors, + scrollableAncestorRects, + delta, + threshold + } = _ref; + const scrollIntent = useScrollIntent({ + delta, + disabled: !enabled + }); + const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval(); + const scrollSpeed = _2({ + x: 0, + y: 0 + }); + const scrollDirection = _2({ + x: 0, + y: 0 + }); + const rect = F2(() => { + switch (activator) { + case AutoScrollActivator.Pointer: + return pointerCoordinates ? { + top: pointerCoordinates.y, + bottom: pointerCoordinates.y, + left: pointerCoordinates.x, + right: pointerCoordinates.x + } : null; + case AutoScrollActivator.DraggableRect: + return draggingRect; + } + }, [activator, draggingRect, pointerCoordinates]); + const scrollContainerRef = _2(null); + const autoScroll = T2(() => { + const scrollContainer = scrollContainerRef.current; + if (!scrollContainer) { + return; + } + const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x; + const scrollTop = scrollSpeed.current.y * scrollDirection.current.y; + scrollContainer.scrollBy(scrollLeft, scrollTop); + }, []); + const sortedScrollableAncestors = F2(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]); + p2( + () => { + if (!enabled || !scrollableAncestors.length || !rect) { + clearAutoScrollInterval(); + return; } - }; - }, - createColumn: (column, table) => { - return { - getAutoFilterFn: () => { - const firstRow = table.getCoreRowModel().flatRows[0]; - const value = firstRow == null ? void 0 : firstRow.getValue(column.id); - if (typeof value === "string") { - return filterFns.includesString; - } - if (typeof value === "number") { - return filterFns.inNumberRange; - } - if (typeof value === "boolean") { - return filterFns.equals; - } - if (value !== null && typeof value === "object") { - return filterFns.equals; + for (const scrollContainer of sortedScrollableAncestors) { + if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { + continue; } - if (Array.isArray(value)) { - return filterFns.arrIncludes; + const index = scrollableAncestors.indexOf(scrollContainer); + const scrollContainerRect = scrollableAncestorRects[index]; + if (!scrollContainerRect) { + continue; } - return filterFns.weakEquals; - }, - getFilterFn: () => { - var _table$options$filter, _table$options$filter2; - return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === "auto" ? column.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn]; - }, - getCanFilter: () => { - var _column$columnDef$ena, _table$options$enable, _table$options$enable2; - return ((_column$columnDef$ena = column.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) && !!column.accessorFn; - }, - getCanGlobalFilter: () => { - var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol; - return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; - }, - getIsFiltered: () => column.getFilterIndex() > -1, - getFilterValue: () => { - var _table$getState$colum, _table$getState$colum2; - return (_table$getState$colum = table.getState().columnFilters) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum.find((d5) => d5.id === column.id)) == null ? void 0 : _table$getState$colum2.value; - }, - getFilterIndex: () => { - var _table$getState$colum3, _table$getState$colum4; - return (_table$getState$colum3 = (_table$getState$colum4 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum4.findIndex((d5) => d5.id === column.id)) != null ? _table$getState$colum3 : -1; - }, - setFilterValue: (value) => { - table.setColumnFilters((old) => { - const filterFn = column.getFilterFn(); - const previousfilter = old == null ? void 0 : old.find((d5) => d5.id === column.id); - const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : void 0); - if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { - var _old$filter; - return (_old$filter = old == null ? void 0 : old.filter((d5) => d5.id !== column.id)) != null ? _old$filter : []; - } - const newFilterObj = { - id: column.id, - value: newFilter - }; - if (previousfilter) { - var _old$map; - return (_old$map = old == null ? void 0 : old.map((d5) => { - if (d5.id === column.id) { - return newFilterObj; - } - return d5; - })) != null ? _old$map : []; - } - if (old != null && old.length) { - return [...old, newFilterObj]; + const { + direction, + speed + } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold); + for (const axis of ["x", "y"]) { + if (!scrollIntent[axis][direction[axis]]) { + speed[axis] = 0; + direction[axis] = 0; } - return [newFilterObj]; - }); - }, - _getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id), - getFacetedRowModel: () => { - if (!column._getFacetedRowModel) { - return table.getPreFilteredRowModel(); - } - return column._getFacetedRowModel(); - }, - _getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id), - getFacetedUniqueValues: () => { - if (!column._getFacetedUniqueValues) { - return /* @__PURE__ */ new Map(); } - return column._getFacetedUniqueValues(); - }, - _getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id), - getFacetedMinMaxValues: () => { - if (!column._getFacetedMinMaxValues) { - return void 0; + if (speed.x > 0 || speed.y > 0) { + clearAutoScrollInterval(); + scrollContainerRef.current = scrollContainer; + setAutoScrollInterval(autoScroll, interval); + scrollSpeed.current = speed; + scrollDirection.current = direction; + return; } - return column._getFacetedMinMaxValues(); } - }; + scrollSpeed.current = { + x: 0, + y: 0 + }; + scrollDirection.current = { + x: 0, + y: 0 + }; + clearAutoScrollInterval(); + }, + [ + acceleration, + autoScroll, + canScroll, + clearAutoScrollInterval, + enabled, + interval, + JSON.stringify(rect), + JSON.stringify(scrollIntent), + setAutoScrollInterval, + scrollableAncestors, + sortedScrollableAncestors, + scrollableAncestorRects, + JSON.stringify(threshold) + ] + ); +} +var defaultScrollIntent = { + x: { + [Direction2.Backward]: false, + [Direction2.Forward]: false }, - createRow: (row, table) => { - return { - columnFilters: {}, - columnFiltersMeta: {} + y: { + [Direction2.Backward]: false, + [Direction2.Forward]: false + } +}; +function useScrollIntent(_ref2) { + let { + delta, + disabled + } = _ref2; + const previousDelta = usePrevious(delta); + return useLazyMemo((previousIntent) => { + if (disabled || !previousDelta || !previousIntent) { + return defaultScrollIntent; + } + const direction = { + x: Math.sign(delta.x - previousDelta.x), + y: Math.sign(delta.y - previousDelta.y) }; - }, - createTable: (table) => { return { - getGlobalAutoFilterFn: () => { - return filterFns.includesString; - }, - getGlobalFilterFn: () => { - var _table$options$filter3, _table$options$filter4; - const { - globalFilterFn - } = table.options; - return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === "auto" ? table.getGlobalAutoFilterFn() : (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn]; - }, - setColumnFilters: (updater) => { - const leafColumns = table.getAllLeafColumns(); - const updateFn = (old) => { - var _functionalUpdate; - return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter((filter) => { - const column = leafColumns.find((d5) => d5.id === filter.id); - if (column) { - const filterFn = column.getFilterFn(); - if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { - return false; - } - } - return true; - }); - }; - table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn); - }, - setGlobalFilter: (updater) => { - table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater); - }, - resetGlobalFilter: (defaultState) => { - table.setGlobalFilter(defaultState ? void 0 : table.initialState.globalFilter); - }, - resetColumnFilters: (defaultState) => { - var _table$initialState$c, _table$initialState; - table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); - }, - getPreFilteredRowModel: () => table.getCoreRowModel(), - getFilteredRowModel: () => { - if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { - table._getFilteredRowModel = table.options.getFilteredRowModel(table); - } - if (table.options.manualFiltering || !table._getFilteredRowModel) { - return table.getPreFilteredRowModel(); - } - return table._getFilteredRowModel(); + x: { + [Direction2.Backward]: previousIntent.x[Direction2.Backward] || direction.x === -1, + [Direction2.Forward]: previousIntent.x[Direction2.Forward] || direction.x === 1 }, - _getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, "__global__"), - getGlobalFacetedRowModel: () => { - if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { - return table.getPreFilteredRowModel(); + y: { + [Direction2.Backward]: previousIntent.y[Direction2.Backward] || direction.y === -1, + [Direction2.Forward]: previousIntent.y[Direction2.Forward] || direction.y === 1 + } + }; + }, [disabled, delta, previousDelta]); +} +function useCachedNode(draggableNodes, id2) { + const draggableNode = id2 !== null ? draggableNodes.get(id2) : void 0; + const node = draggableNode ? draggableNode.node.current : null; + return useLazyMemo((cachedNode) => { + var _ref; + if (id2 === null) { + return null; + } + return (_ref = node != null ? node : cachedNode) != null ? _ref : null; + }, [node, id2]); +} +function useCombineActivators(sensors, getSyntheticHandler) { + return F2(() => sensors.reduce((accumulator, sensor) => { + const { + sensor: Sensor + } = sensor; + const sensorActivators = Sensor.activators.map((activator) => ({ + eventName: activator.eventName, + handler: getSyntheticHandler(activator.handler, sensor) + })); + return [...accumulator, ...sensorActivators]; + }, []), [sensors, getSyntheticHandler]); +} +var MeasuringStrategy; +(function(MeasuringStrategy2) { + MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always"; + MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging"; + MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging"; +})(MeasuringStrategy || (MeasuringStrategy = {})); +var MeasuringFrequency; +(function(MeasuringFrequency2) { + MeasuringFrequency2["Optimized"] = "optimized"; +})(MeasuringFrequency || (MeasuringFrequency = {})); +var defaultValue = /* @__PURE__ */ new Map(); +function useDroppableMeasuring(containers, _ref) { + let { + dragging, + dependencies, + config + } = _ref; + const [queue, setQueue] = h2(null); + const { + frequency, + measure, + strategy + } = config; + const containersRef = _2(containers); + const disabled = isDisabled(); + const disabledRef = useLatestValue(disabled); + const measureDroppableContainers = T2(function(ids2) { + if (ids2 === void 0) { + ids2 = []; + } + if (disabledRef.current) { + return; + } + setQueue((value) => { + if (value === null) { + return ids2; + } + return value.concat(ids2.filter((id2) => !value.includes(id2))); + }); + }, [disabledRef]); + const timeoutId = _2(null); + const droppableRects = useLazyMemo((previousValue) => { + if (disabled && !dragging) { + return defaultValue; + } + if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) { + const map = /* @__PURE__ */ new Map(); + for (let container of containers) { + if (!container) { + continue; } - return table._getGlobalFacetedRowModel(); - }, - _getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, "__global__"), - getGlobalFacetedUniqueValues: () => { - if (!table._getGlobalFacetedUniqueValues) { - return /* @__PURE__ */ new Map(); + if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) { + map.set(container.id, container.rect.current); + continue; } - return table._getGlobalFacetedUniqueValues(); - }, - _getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, "__global__"), - getGlobalFacetedMinMaxValues: () => { - if (!table._getGlobalFacetedMinMaxValues) { - return; + const node = container.node.current; + const rect = node ? new Rect(measure(node), node) : null; + container.rect.current = rect; + if (rect) { + map.set(container.id, rect); } - return table._getGlobalFacetedMinMaxValues(); } - }; + return map; + } + return previousValue; + }, [containers, queue, dragging, disabled, measure]); + p2(() => { + containersRef.current = containers; + }, [containers]); + p2( + () => { + if (disabled) { + return; + } + measureDroppableContainers(); + }, + [dragging, disabled] + ); + p2( + () => { + if (queue && queue.length > 0) { + setQueue(null); + } + }, + [JSON.stringify(queue)] + ); + p2( + () => { + if (disabled || typeof frequency !== "number" || timeoutId.current !== null) { + return; + } + timeoutId.current = setTimeout(() => { + measureDroppableContainers(); + timeoutId.current = null; + }, frequency); + }, + [frequency, disabled, measureDroppableContainers, ...dependencies] + ); + return { + droppableRects, + measureDroppableContainers, + measuringScheduled: queue != null + }; + function isDisabled() { + switch (strategy) { + case MeasuringStrategy.Always: + return false; + case MeasuringStrategy.BeforeDragging: + return dragging; + default: + return !dragging; + } } -}; -function shouldAutoRemoveFilter(filterFn, value, column) { - return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === "undefined" || typeof value === "string" && !value; } -var sum = (columnId, _leafRows, childRows) => { - return childRows.reduce((sum2, next) => { - const nextValue = next.getValue(columnId); - return sum2 + (typeof nextValue === "number" ? nextValue : 0); - }, 0); -}; -var min2 = (columnId, _leafRows, childRows) => { - let min3; - childRows.forEach((row) => { - const value = row.getValue(columnId); - if (value != null && (min3 > value || min3 === void 0 && value >= value)) { - min3 = value; +function useInitialValue(value, computeFn) { + return useLazyMemo((previousValue) => { + if (!value) { + return null; + } + if (previousValue) { + return previousValue; + } + return typeof computeFn === "function" ? computeFn(value) : value; + }, [computeFn, value]); +} +function useInitialRect(node, measure) { + return useInitialValue(node, measure); +} +function useMutationObserver(_ref) { + let { + callback, + disabled + } = _ref; + const handleMutations = useEvent(callback); + const mutationObserver = F2(() => { + if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") { + return void 0; + } + const { + MutationObserver + } = window; + return new MutationObserver(handleMutations); + }, [handleMutations, disabled]); + p2(() => { + return () => mutationObserver == null ? void 0 : mutationObserver.disconnect(); + }, [mutationObserver]); + return mutationObserver; +} +function useResizeObserver(_ref) { + let { + callback, + disabled + } = _ref; + const handleResize = useEvent(callback); + const resizeObserver = F2( + () => { + if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") { + return void 0; + } + const { + ResizeObserver + } = window; + return new ResizeObserver(handleResize); + }, + [disabled] + ); + p2(() => { + return () => resizeObserver == null ? void 0 : resizeObserver.disconnect(); + }, [resizeObserver]); + return resizeObserver; +} +function defaultMeasure(element) { + return new Rect(getClientRect(element), element); +} +function useRect(element, measure, fallbackRect) { + if (measure === void 0) { + measure = defaultMeasure; + } + const [rect, measureRect] = s2(reducer2, null); + const mutationObserver = useMutationObserver({ + callback(records) { + if (!element) { + return; + } + for (const record of records) { + const { + type, + target + } = record; + if (type === "childList" && target instanceof HTMLElement && target.contains(element)) { + measureRect(); + break; + } + } } }); - return min3; -}; -var max2 = (columnId, _leafRows, childRows) => { - let max3; - childRows.forEach((row) => { - const value = row.getValue(columnId); - if (value != null && (max3 < value || max3 === void 0 && value >= value)) { - max3 = value; + const resizeObserver = useResizeObserver({ + callback: measureRect + }); + useIsomorphicLayoutEffect(() => { + measureRect(); + if (element) { + resizeObserver == null ? void 0 : resizeObserver.observe(element); + mutationObserver == null ? void 0 : mutationObserver.observe(document.body, { + childList: true, + subtree: true + }); + } else { + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + mutationObserver == null ? void 0 : mutationObserver.disconnect(); + } + }, [element]); + return rect; + function reducer2(currentRect) { + if (!element) { + return null; + } + if (element.isConnected === false) { + var _ref; + return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null; + } + const newRect = measure(element); + if (JSON.stringify(currentRect) === JSON.stringify(newRect)) { + return currentRect; + } + return newRect; + } +} +function useRectDelta(rect) { + const initialRect = useInitialValue(rect); + return getRectDelta(rect, initialRect); +} +var defaultValue$1 = []; +function useScrollableAncestors(node) { + const previousNode = _2(node); + const ancestors = useLazyMemo((previousValue) => { + if (!node) { + return defaultValue$1; + } + if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) { + return previousValue; + } + return getScrollableAncestors(node); + }, [node]); + p2(() => { + previousNode.current = node; + }, [node]); + return ancestors; +} +function useScrollOffsets(elements) { + const [scrollCoordinates, setScrollCoordinates] = h2(null); + const prevElements = _2(elements); + const handleScroll = T2((event) => { + const scrollingElement = getScrollableElement(event.target); + if (!scrollingElement) { + return; + } + setScrollCoordinates((scrollCoordinates2) => { + if (!scrollCoordinates2) { + return null; + } + scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement)); + return new Map(scrollCoordinates2); + }); + }, []); + p2(() => { + const previousElements = prevElements.current; + if (elements !== previousElements) { + cleanup(previousElements); + const entries = elements.map((element) => { + const scrollableElement = getScrollableElement(element); + if (scrollableElement) { + scrollableElement.addEventListener("scroll", handleScroll, { + passive: true + }); + return [scrollableElement, getScrollCoordinates(scrollableElement)]; + } + return null; + }).filter((entry) => entry != null); + setScrollCoordinates(entries.length ? new Map(entries) : null); + prevElements.current = elements; + } + return () => { + cleanup(elements); + cleanup(previousElements); + }; + function cleanup(elements2) { + elements2.forEach((element) => { + const scrollableElement = getScrollableElement(element); + scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll); + }); + } + }, [handleScroll, elements]); + return F2(() => { + if (elements.length) { + return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements); + } + return defaultCoordinates; + }, [elements, scrollCoordinates]); +} +function useScrollOffsetsDelta(scrollOffsets, dependencies) { + if (dependencies === void 0) { + dependencies = []; + } + const initialScrollOffsets = _2(null); + p2( + () => { + initialScrollOffsets.current = null; + }, + dependencies + ); + p2(() => { + const hasScrollOffsets = scrollOffsets !== defaultCoordinates; + if (hasScrollOffsets && !initialScrollOffsets.current) { + initialScrollOffsets.current = scrollOffsets; + } + if (!hasScrollOffsets && initialScrollOffsets.current) { + initialScrollOffsets.current = null; } + }, [scrollOffsets]); + return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates; +} +function useSensorSetup(sensors) { + p2( + () => { + if (!canUseDOM) { + return; + } + const teardownFns = sensors.map((_ref) => { + let { + sensor + } = _ref; + return sensor.setup == null ? void 0 : sensor.setup(); + }); + return () => { + for (const teardown of teardownFns) { + teardown == null ? void 0 : teardown(); + } + }; + }, + sensors.map((_ref2) => { + let { + sensor + } = _ref2; + return sensor; + }) + ); +} +function useSyntheticListeners(listeners, id2) { + return F2(() => { + return listeners.reduce((acc, _ref) => { + let { + eventName, + handler + } = _ref; + acc[eventName] = (event) => { + handler(event, id2); + }; + return acc; + }, {}); + }, [listeners, id2]); +} +function useWindowRect(element) { + return F2(() => element ? getWindowClientRect(element) : null, [element]); +} +var defaultValue$2 = []; +function useRects(elements, measure) { + if (measure === void 0) { + measure = getClientRect; + } + const [firstElement] = elements; + const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null); + const [rects, measureRects] = s2(reducer2, defaultValue$2); + const resizeObserver = useResizeObserver({ + callback: measureRects }); - return max3; -}; -var extent = (columnId, _leafRows, childRows) => { - let min3; - let max3; - childRows.forEach((row) => { - const value = row.getValue(columnId); - if (value != null) { - if (min3 === void 0) { - if (value >= value) - min3 = max3 = value; - } else { - if (min3 > value) - min3 = value; - if (max3 < value) - max3 = value; - } + if (elements.length > 0 && rects === defaultValue$2) { + measureRects(); + } + useIsomorphicLayoutEffect(() => { + if (elements.length) { + elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element)); + } else { + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + measureRects(); } - }); - return [min3, max3]; -}; -var mean = (columnId, leafRows) => { - let count2 = 0; - let sum2 = 0; - leafRows.forEach((row) => { - let value = row.getValue(columnId); - if (value != null && (value = +value) >= value) { - ++count2, sum2 += value; + }, [elements]); + return rects; + function reducer2() { + if (!elements.length) { + return defaultValue$2; } - }); - if (count2) - return sum2 / count2; - return; -}; -var median = (columnId, leafRows) => { - if (!leafRows.length) { - return; + return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element)); } - let min3 = 0; - let max3 = 0; - leafRows.forEach((row) => { - let value = row.getValue(columnId); - if (typeof value === "number") { - min3 = Math.min(min3, value); - max3 = Math.max(max3, value); +} +function getMeasurableNode(node) { + if (!node) { + return null; + } + if (node.children.length > 1) { + return node; + } + const firstChild = node.children[0]; + return isHTMLElement(firstChild) ? firstChild : node; +} +function useDragOverlayMeasuring(_ref) { + let { + measure + } = _ref; + const [rect, setRect] = h2(null); + const handleResize = T2((entries) => { + for (const { + target + } of entries) { + if (isHTMLElement(target)) { + setRect((rect2) => { + const newRect = measure(target); + return rect2 ? { + ...rect2, + width: newRect.width, + height: newRect.height + } : newRect; + }); + break; + } } + }, [measure]); + const resizeObserver = useResizeObserver({ + callback: handleResize }); - return (min3 + max3) / 2; -}; -var unique = (columnId, leafRows) => { - return Array.from(new Set(leafRows.map((d5) => d5.getValue(columnId))).values()); -}; -var uniqueCount = (columnId, leafRows) => { - return new Set(leafRows.map((d5) => d5.getValue(columnId))).size; -}; -var count = (_columnId, leafRows) => { - return leafRows.length; -}; -var aggregationFns = { - sum, - min: min2, - max: max2, - extent, - mean, - median, - unique, - uniqueCount, - count + const handleNodeChange = T2((element) => { + const node = getMeasurableNode(element); + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + if (node) { + resizeObserver == null ? void 0 : resizeObserver.observe(node); + } + setRect(node ? measure(node) : null); + }, [measure, resizeObserver]); + const [nodeRef, setRef] = useNodeRef(handleNodeChange); + return F2(() => ({ + nodeRef, + rect, + setRef + }), [rect, nodeRef, setRef]); +} +var defaultSensors = [{ + sensor: PointerSensor, + options: {} +}, { + sensor: KeyboardSensor, + options: {} +}]; +var defaultData = { + current: {} }; -var Grouping = { - getDefaultColumnDef: () => { - return { - aggregatedCell: (props2) => { - var _toString, _props$getValue; - return (_toString = (_props$getValue = props2.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; - }, - aggregationFn: "auto" - }; - }, - getInitialState: (state) => { - return { - grouping: [], - ...state - }; - }, - getDefaultOptions: (table) => { - return { - onGroupingChange: makeStateUpdater("grouping", table), - groupedColumnMode: "reorder" - }; - }, - createColumn: (column, table) => { - return { - toggleGrouping: () => { - table.setGrouping((old) => { - if (old != null && old.includes(column.id)) { - return old.filter((d5) => d5 !== column.id); - } - return [...old != null ? old : [], column.id]; - }); - }, - getCanGroup: () => { - var _ref, _ref2, _ref3, _column$columnDef$ena; - return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn; - }, - getIsGrouped: () => { - var _table$getState$group; - return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); - }, - getGroupedIndex: () => { - var _table$getState$group2; - return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); - }, - getToggleGroupingHandler: () => { - const canGroup = column.getCanGroup(); - return () => { - if (!canGroup) - return; - column.toggleGrouping(); - }; - }, - getAutoAggregationFn: () => { - const firstRow = table.getCoreRowModel().flatRows[0]; - const value = firstRow == null ? void 0 : firstRow.getValue(column.id); - if (typeof value === "number") { - return aggregationFns.sum; - } - if (Object.prototype.toString.call(value) === "[object Date]") { - return aggregationFns.extent; - } - }, - getAggregationFn: () => { - var _table$options$aggreg, _table$options$aggreg2; - if (!column) { - throw new Error(); - } - return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === "auto" ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn]; - } - }; - }, - createTable: (table) => { - return { - setGrouping: (updater) => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater), - resetGrouping: (defaultState) => { - var _table$initialState$g, _table$initialState; - table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); - }, - getPreGroupedRowModel: () => table.getFilteredRowModel(), - getGroupedRowModel: () => { - if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { - table._getGroupedRowModel = table.options.getGroupedRowModel(table); - } - if (table.options.manualGrouping || !table._getGroupedRowModel) { - return table.getPreGroupedRowModel(); - } - return table._getGroupedRowModel(); - } - }; +var defaultMeasuringConfiguration = { + draggable: { + measure: getTransformAgnosticClientRect }, - createRow: (row) => { - return { - getIsGrouped: () => !!row.groupingColumnId, - _groupingValuesCache: {} - }; + droppable: { + measure: getTransformAgnosticClientRect, + strategy: MeasuringStrategy.WhileDragging, + frequency: MeasuringFrequency.Optimized }, - createCell: (cell, column, row, table) => { - return { - getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId, - getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(), - getIsAggregated: () => { - var _row$subRows; - return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); - } - }; + dragOverlay: { + measure: getClientRect } }; -function orderColumns(leafColumns, grouping, groupedColumnMode) { - if (!(grouping != null && grouping.length) || !groupedColumnMode) { - return leafColumns; +var DroppableContainersMap = class extends Map { + get(id2) { + var _super$get; + return id2 != null ? (_super$get = super.get(id2)) != null ? _super$get : void 0 : void 0; } - const nonGroupingColumns = leafColumns.filter((col) => !grouping.includes(col.id)); - if (groupedColumnMode === "remove") { - return nonGroupingColumns; + toArray() { + return Array.from(this.values()); } - const groupingColumns = grouping.map((g4) => leafColumns.find((col) => col.id === g4)).filter(Boolean); - return [...groupingColumns, ...nonGroupingColumns]; -} -var Ordering = { - getInitialState: (state) => { - return { - columnOrder: [], - ...state - }; - }, - getDefaultOptions: (table) => { - return { - onColumnOrderChange: makeStateUpdater("columnOrder", table) - }; - }, - createTable: (table) => { - return { - setColumnOrder: (updater) => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater), - resetColumnOrder: (defaultState) => { - var _table$initialState$c; - table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); - }, - _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => { - let orderedColumns = []; - if (!(columnOrder != null && columnOrder.length)) { - orderedColumns = columns; - } else { - const columnOrderCopy = [...columnOrder]; - const columnsCopy = [...columns]; - while (columnsCopy.length && columnOrderCopy.length) { - const targetColumnId = columnOrderCopy.shift(); - const foundIndex = columnsCopy.findIndex((d5) => d5.id === targetColumnId); - if (foundIndex > -1) { - orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); - } - } - orderedColumns = [...orderedColumns, ...columnsCopy]; - } - return orderColumns(orderedColumns, grouping, groupedColumnMode); - }, { - key: "getOrderColumnsFn" - }) - }; + getEnabled() { + return this.toArray().filter((_ref) => { + let { + disabled + } = _ref; + return !disabled; + }); } -}; -var defaultPageIndex = 0; -var defaultPageSize = 10; -var getDefaultPaginationState = () => ({ - pageIndex: defaultPageIndex, - pageSize: defaultPageSize -}); -var Pagination = { - getInitialState: (state) => { - return { - ...state, - pagination: { - ...getDefaultPaginationState(), - ...state == null ? void 0 : state.pagination - } - }; - }, - getDefaultOptions: (table) => { - return { - onPaginationChange: makeStateUpdater("pagination", table) - }; - }, - createTable: (table) => { - let registered = false; - let queued = false; - return { - _autoResetPageIndex: () => { - var _ref, _table$options$autoRe; - if (!registered) { - table._queue(() => { - registered = true; - }); - return; - } - 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; - table._queue(() => { - table.resetPageIndex(); - queued = false; - }); - } - }, - setPagination: (updater) => { - const safeUpdater = (old) => { - let newState = functionalUpdate(updater, old); - return newState; - }; - return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); - }, - resetPagination: (defaultState) => { - var _table$initialState$p; - table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); - }, - setPageIndex: (updater) => { - table.setPagination((old) => { - let pageIndex = functionalUpdate(updater, old.pageIndex); - 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, - pageIndex - }; - }); - }, - resetPageIndex: (defaultState) => { - var _table$initialState$p2, _table$initialState, _table$initialState$p3; - table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null ? void 0 : (_table$initialState$p3 = _table$initialState.pagination) == null ? void 0 : _table$initialState$p3.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); - }, - resetPageSize: (defaultState) => { - var _table$initialState$p4, _table$initialState2, _table$initialState2$; - table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p4 = (_table$initialState2 = table.initialState) == null ? void 0 : (_table$initialState2$ = _table$initialState2.pagination) == null ? void 0 : _table$initialState2$.pageSize) != null ? _table$initialState$p4 : defaultPageSize); - }, - 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); - return { - ...old, - pageIndex, - pageSize - }; - }); - }, - setPageCount: (updater) => table.setPagination((old) => { - var _table$options$pageCo; - let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); - if (typeof newPageCount === "number") { - newPageCount = Math.max(-1, newPageCount); - } - return { - ...old, - pageCount: newPageCount - }; - }), - getPageOptions: memo(() => [table.getPageCount()], (pageCount) => { - let pageOptions = []; - if (pageCount && pageCount > 0) { - pageOptions = [...new Array(pageCount)].fill(null).map((_9, i4) => i4); - } - return pageOptions; - }, { - key: "getPageOptions", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; - } - }), - getCanPreviousPage: () => table.getState().pagination.pageIndex > 0, - getCanNextPage: () => { - const { - pageIndex - } = table.getState().pagination; - const pageCount = table.getPageCount(); - if (pageCount === -1) { - return true; - } - if (pageCount === 0) { - return false; - } - return pageIndex < pageCount - 1; - }, - previousPage: () => { - return table.setPageIndex((old) => old - 1); - }, - nextPage: () => { - return table.setPageIndex((old) => { - return old + 1; - }); - }, - getPrePaginationRowModel: () => table.getExpandedRowModel(), - getPaginationRowModel: () => { - if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { - table._getPaginationRowModel = table.options.getPaginationRowModel(table); - } - if (table.options.manualPagination || !table._getPaginationRowModel) { - return table.getPrePaginationRowModel(); - } - return table._getPaginationRowModel(); - }, - getPageCount: () => { - var _table$options$pageCo2; - return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize); - } - }; + getNodeFor(id2) { + var _this$get$node$curren, _this$get; + return (_this$get$node$curren = (_this$get = this.get(id2)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0; } }; -var getDefaultPinningState = () => ({ - left: [], - right: [] -}); -var Pinning = { - getInitialState: (state) => { - return { - columnPinning: getDefaultPinningState(), - ...state - }; +var defaultPublicContext = { + activatorEvent: null, + active: null, + activeNode: null, + activeNodeRect: null, + collisions: null, + containerNodeRect: null, + draggableNodes: /* @__PURE__ */ new Map(), + droppableRects: /* @__PURE__ */ new Map(), + droppableContainers: /* @__PURE__ */ new DroppableContainersMap(), + over: null, + dragOverlay: { + nodeRef: { + current: null + }, + rect: null, + setRef: noop }, - getDefaultOptions: (table) => { - return { - onColumnPinningChange: makeStateUpdater("columnPinning", table) - }; + scrollableAncestors: [], + scrollableAncestorRects: [], + measuringConfiguration: defaultMeasuringConfiguration, + measureDroppableContainers: noop, + windowRect: null, + measuringScheduled: false +}; +var defaultInternalContext = { + activatorEvent: null, + activators: [], + active: null, + activeNodeRect: null, + ariaDescribedById: { + draggable: "" }, - createColumn: (column, table) => { - return { - pin: (position) => { - const columnIds = column.getLeafColumns().map((d5) => d5.id).filter(Boolean); - table.setColumnPinning((old) => { - var _old$left3, _old$right3; - if (position === "right") { - var _old$left, _old$right; - return { - left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), - right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), ...columnIds] - }; - } - if (position === "left") { - var _old$left2, _old$right2; - return { - left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), ...columnIds], - right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))) - }; - } - return { - left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), - right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))) - }; - }); - }, - getCanPin: () => { - const leafColumns = column.getLeafColumns(); - return leafColumns.some((d5) => { - var _d$columnDef$enablePi, _table$options$enable; - return ((_d$columnDef$enablePi = d5.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true); - }); - }, - getIsPinned: () => { - const leafColumnIds = column.getLeafColumns().map((d5) => d5.id); - const { - left, - right - } = table.getState().columnPinning; - const isLeft = leafColumnIds.some((d5) => left == null ? void 0 : left.includes(d5)); - const isRight = leafColumnIds.some((d5) => right == null ? void 0 : right.includes(d5)); - return isLeft ? "left" : isRight ? "right" : false; + dispatch: noop, + draggableNodes: /* @__PURE__ */ new Map(), + over: null, + measureDroppableContainers: noop +}; +var InternalContext = /* @__PURE__ */ F(defaultInternalContext); +var PublicContext = /* @__PURE__ */ F(defaultPublicContext); +function getInitialState() { + return { + draggable: { + active: null, + initialCoordinates: { + x: 0, + y: 0 }, - getPinnedIndex: () => { - var _table$getState$colum, _table$getState$colum2, _table$getState$colum3; - const position = column.getIsPinned(); - return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null ? void 0 : (_table$getState$colum3 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum3.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + nodes: /* @__PURE__ */ new Map(), + translate: { + x: 0, + y: 0 } - }; - }, - createRow: (row, table) => { - return { - getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { - const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; - return allCells.filter((d5) => !leftAndRight.includes(d5.column.id)); - }, { - key: false, - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows; - } - }), - getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, ,], (allCells, left) => { - const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d5) => ({ - ...d5, - position: "left" - })); - return cells; - }, { - key: false, - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows; + }, + droppable: { + containers: new DroppableContainersMap() + } + }; +} +function reducer(state, action) { + switch (action.type) { + case Action.DragStart: + return { + ...state, + draggable: { + ...state.draggable, + initialCoordinates: action.initialCoordinates, + active: action.active } - }), - getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { - const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d5) => ({ - ...d5, - position: "right" - })); - return cells; - }, { - key: false, - debug: () => { - var _table$options$debugA3; - return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows; + }; + case Action.DragMove: + if (!state.draggable.active) { + return state; + } + return { + ...state, + draggable: { + ...state.draggable, + translate: { + x: action.coordinates.x - state.draggable.initialCoordinates.x, + y: action.coordinates.y - state.draggable.initialCoordinates.y + } } - }) - }; - }, - createTable: (table) => { - return { - setColumnPinning: (updater) => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater), - resetColumnPinning: (defaultState) => { - var _table$initialState$c, _table$initialState; - return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState()); - }, - getIsSomeColumnsPinned: (position) => { - var _pinningState$positio; - 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)); + }; + case Action.DragEnd: + case Action.DragCancel: + return { + ...state, + draggable: { + ...state.draggable, + active: null, + initialCoordinates: { + x: 0, + y: 0 + }, + translate: { + x: 0, + y: 0 + } } - return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); - }, - getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { - return (left != null ? left : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean); - }, { - key: "getLeftLeafColumns", - debug: () => { - var _table$options$debugA4; - return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns; + }; + case Action.RegisterDroppable: { + const { + element + } = action; + const { + id: id2 + } = element; + const containers = new DroppableContainersMap(state.droppable.containers); + containers.set(id2, element); + return { + ...state, + droppable: { + ...state.droppable, + containers } - }), - getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { - return (right != null ? right : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean); - }, { - key: "getRightLeafColumns", - debug: () => { - var _table$options$debugA5; - return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns; + }; + } + case Action.SetDroppableDisabled: { + const { + id: id2, + key: key2, + disabled + } = action; + const element = state.droppable.containers.get(id2); + if (!element || key2 !== element.key) { + return state; + } + const containers = new DroppableContainersMap(state.droppable.containers); + containers.set(id2, { + ...element, + disabled + }); + return { + ...state, + droppable: { + ...state.droppable, + containers } - }), - getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { - const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; - return allColumns.filter((d5) => !leftAndRight.includes(d5.id)); - }, { - key: "getCenterLeafColumns", - debug: () => { - var _table$options$debugA6; - return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns; + }; + } + case Action.UnregisterDroppable: { + const { + id: id2, + key: key2 + } = action; + const element = state.droppable.containers.get(id2); + if (!element || key2 !== element.key) { + return state; + } + const containers = new DroppableContainersMap(state.droppable.containers); + containers.delete(id2); + return { + ...state, + droppable: { + ...state.droppable, + containers } - }) - }; + }; + } + default: { + return state; + } } -}; -var RowSelection = { - getInitialState: (state) => { - return { - rowSelection: {}, - ...state - }; - }, - getDefaultOptions: (table) => { - return { - onRowSelectionChange: makeStateUpdater("rowSelection", table), - enableRowSelection: true, - enableMultiRowSelection: true, - enableSubRowSelection: true - }; - }, - createTable: (table) => { - return { - setRowSelection: (updater) => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater), - resetRowSelection: (defaultState) => { - var _table$initialState$r; - return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); +} +function RestoreFocus(_ref) { + let { + disabled + } = _ref; + const { + active, + activatorEvent, + draggableNodes + } = q2(InternalContext); + const previousActivatorEvent = usePrevious(activatorEvent); + const previousActiveId = usePrevious(active == null ? void 0 : active.id); + p2(() => { + if (disabled) { + return; + } + if (!activatorEvent && previousActivatorEvent && previousActiveId != null) { + if (!isKeyboardEvent(previousActivatorEvent)) { + return; + } + if (document.activeElement === previousActivatorEvent.target) { + return; + } + const draggableNode = draggableNodes.get(previousActiveId); + if (!draggableNode) { + return; + } + const { + activatorNode, + node + } = draggableNode; + if (!activatorNode.current && !node.current) { + return; + } + requestAnimationFrame(() => { + for (const element of [activatorNode.current, node.current]) { + if (!element) { + continue; + } + const focusableNode = findFirstFocusableNode(element); + if (focusableNode) { + focusableNode.focus(); + break; + } + } + }); + } + }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]); + return null; +} +function applyModifiers(modifiers, _ref) { + let { + transform, + ...args + } = _ref; + return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => { + return modifier({ + transform: accumulator, + ...args + }); + }, transform) : transform; +} +function useMeasuringConfiguration(config) { + return F2( + () => ({ + draggable: { + ...defaultMeasuringConfiguration.draggable, + ...config == null ? void 0 : config.draggable }, - toggleAllRowsSelected: (value) => { - table.setRowSelection((old) => { - value = typeof value !== "undefined" ? value : !table.getIsAllRowsSelected(); - const rowSelection = { - ...old + droppable: { + ...defaultMeasuringConfiguration.droppable, + ...config == null ? void 0 : config.droppable + }, + dragOverlay: { + ...defaultMeasuringConfiguration.dragOverlay, + ...config == null ? void 0 : config.dragOverlay + } + }), + [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay] + ); +} +function useLayoutShiftScrollCompensation(_ref) { + let { + activeNode, + measure, + initialRect, + config = true + } = _ref; + const initialized = _2(false); + const { + x: x5, + y: y5 + } = typeof config === "boolean" ? { + x: config, + y: config + } : config; + useIsomorphicLayoutEffect(() => { + const disabled = !x5 && !y5; + if (disabled || !activeNode) { + initialized.current = false; + return; + } + if (initialized.current || !initialRect) { + return; + } + const node = activeNode == null ? void 0 : activeNode.node.current; + if (!node || node.isConnected === false) { + return; + } + const rect = measure(node); + const rectDelta = getRectDelta(rect, initialRect); + if (!x5) { + rectDelta.x = 0; + } + if (!y5) { + rectDelta.y = 0; + } + initialized.current = true; + if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) { + const firstScrollableAncestor = getFirstScrollableAncestor(node); + if (firstScrollableAncestor) { + firstScrollableAncestor.scrollBy({ + top: rectDelta.y, + left: rectDelta.x + }); + } + } + }, [activeNode, x5, y5, initialRect, measure]); +} +var ActiveDraggableContext = /* @__PURE__ */ F({ + ...defaultCoordinates, + scaleX: 1, + scaleY: 1 +}); +var Status; +(function(Status2) { + Status2[Status2["Uninitialized"] = 0] = "Uninitialized"; + Status2[Status2["Initializing"] = 1] = "Initializing"; + Status2[Status2["Initialized"] = 2] = "Initialized"; +})(Status || (Status = {})); +var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { + var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect; + let { + id: id2, + accessibility, + autoScroll = true, + children, + sensors = defaultSensors, + collisionDetection = rectIntersection, + measuring, + modifiers, + ...props2 + } = _ref; + const store = s2(reducer, void 0, getInitialState); + const [state, dispatch] = store; + const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider(); + const [status, setStatus] = h2(Status.Uninitialized); + const isInitialized = status === Status.Initialized; + const { + draggable: { + active: activeId, + nodes: draggableNodes, + translate + }, + droppable: { + containers: droppableContainers + } + } = state; + const node = activeId ? draggableNodes.get(activeId) : null; + const activeRects = _2({ + initial: null, + translated: null + }); + const active = F2(() => { + var _node$data; + return activeId != null ? { + id: activeId, + data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData, + rect: activeRects + } : null; + }, [activeId, node]); + const activeRef = _2(null); + const [activeSensor, setActiveSensor] = h2(null); + const [activatorEvent, setActivatorEvent] = h2(null); + const latestProps = useLatestValue(props2, Object.values(props2)); + const draggableDescribedById = useUniqueId("DndDescribedBy", id2); + const enabledDroppableContainers = F2(() => droppableContainers.getEnabled(), [droppableContainers]); + const measuringConfiguration = useMeasuringConfiguration(measuring); + const { + droppableRects, + measureDroppableContainers, + measuringScheduled + } = useDroppableMeasuring(enabledDroppableContainers, { + dragging: isInitialized, + dependencies: [translate.x, translate.y], + config: measuringConfiguration.droppable + }); + const activeNode = useCachedNode(draggableNodes, activeId); + const activationCoordinates = F2(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]); + const autoScrollOptions = getAutoScrollerOptions(); + const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure); + useLayoutShiftScrollCompensation({ + activeNode: activeId ? draggableNodes.get(activeId) : null, + config: autoScrollOptions.layoutShiftCompensation, + initialRect: initialActiveNodeRect, + measure: measuringConfiguration.draggable.measure + }); + const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect); + const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null); + const sensorContext = _2({ + activatorEvent: null, + active: null, + activeNode, + collisionRect: null, + collisions: null, + droppableRects, + draggableNodes, + draggingNode: null, + draggingNodeRect: null, + droppableContainers, + over: null, + scrollableAncestors: [], + scrollAdjustedTranslate: null + }); + const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id); + const dragOverlay = useDragOverlayMeasuring({ + measure: measuringConfiguration.dragOverlay.measure + }); + const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode; + const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null; + const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); + const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); + const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); + const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null); + const scrollableAncestorRects = useRects(scrollableAncestors); + const modifiedTranslate = applyModifiers(modifiers, { + transform: { + x: translate.x - nodeRectDelta.x, + y: translate.y - nodeRectDelta.y, + scaleX: 1, + scaleY: 1 + }, + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggingNodeRect, + over: sensorContext.current.over, + overlayNodeRect: dragOverlay.rect, + scrollableAncestors, + scrollableAncestorRects, + windowRect + }); + const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null; + const scrollOffsets = useScrollOffsets(scrollableAncestors); + const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); + const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]); + const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment); + const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null; + const collisions = active && collisionRect ? collisionDetection({ + active, + collisionRect, + droppableRects, + droppableContainers: enabledDroppableContainers, + pointerCoordinates + }) : null; + const overId = getFirstCollision(collisions, "id"); + const [over, setOver] = h2(null); + const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta); + const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect); + const instantiateSensor = T2( + (event, _ref2) => { + let { + sensor: Sensor, + options + } = _ref2; + if (activeRef.current == null) { + return; + } + const activeNode2 = draggableNodes.get(activeRef.current); + if (!activeNode2) { + return; + } + const activatorEvent2 = event.nativeEvent; + const sensorInstance = new Sensor({ + active: activeRef.current, + activeNode: activeNode2, + event: activatorEvent2, + options, + context: sensorContext, + onStart(initialCoordinates) { + const id3 = activeRef.current; + if (id3 == null) { + return; + } + const draggableNode = draggableNodes.get(id3); + if (!draggableNode) { + return; + } + const { + onDragStart + } = latestProps.current; + const event2 = { + active: { + id: id3, + data: draggableNode.data, + rect: activeRects + } }; - const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; - if (value) { - preGroupedFlatRows.forEach((row) => { - if (!row.getCanSelect()) { - return; - } - rowSelection[row.id] = true; + dn(() => { + onDragStart == null ? void 0 : onDragStart(event2); + setStatus(Status.Initializing); + dispatch({ + type: Action.DragStart, + initialCoordinates, + active: id3 }); - } else { - preGroupedFlatRows.forEach((row) => { - delete rowSelection[row.id]; + dispatchMonitorEvent({ + type: "onDragStart", + event: event2 }); + }); + }, + onMove(coordinates) { + dispatch({ + type: Action.DragMove, + coordinates + }); + }, + onEnd: createHandler(Action.DragEnd), + onCancel: createHandler(Action.DragCancel) + }); + dn(() => { + setActiveSensor(sensorInstance); + setActivatorEvent(event.nativeEvent); + }); + function createHandler(type) { + return async function handler() { + const { + active: active2, + collisions: collisions2, + over: over2, + scrollAdjustedTranslate: scrollAdjustedTranslate2 + } = sensorContext.current; + let event2 = null; + if (active2 && scrollAdjustedTranslate2) { + const { + cancelDrop + } = latestProps.current; + event2 = { + activatorEvent: activatorEvent2, + active: active2, + collisions: collisions2, + delta: scrollAdjustedTranslate2, + over: over2 + }; + if (type === Action.DragEnd && typeof cancelDrop === "function") { + const shouldCancel = await Promise.resolve(cancelDrop(event2)); + if (shouldCancel) { + type = Action.DragCancel; + } + } } - return rowSelection; - }); - }, - toggleAllPageRowsSelected: (value) => table.setRowSelection((old) => { - const resolvedValue = typeof value !== "undefined" ? value : !table.getIsAllPageRowsSelected(); - const rowSelection = { - ...old - }; - table.getRowModel().rows.forEach((row) => { - mutateRowIsSelected(rowSelection, row.id, resolvedValue, table); - }); - return rowSelection; - }), - getPreSelectedRowModel: () => table.getCoreRowModel(), - getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { - if (!Object.keys(rowSelection).length) { - return { - rows: [], - flatRows: [], - rowsById: {} - }; - } - return selectRowsFn(table, rowModel); - }, { - key: "getSelectedRowModel", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; - } - }), - getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { - if (!Object.keys(rowSelection).length) { - return { - rows: [], - flatRows: [], - rowsById: {} - }; - } - return selectRowsFn(table, rowModel); - }, { - key: false, - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable; - } - }), - getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { - if (!Object.keys(rowSelection).length) { - return { - rows: [], - flatRows: [], - rowsById: {} - }; - } - return selectRowsFn(table, rowModel); - }, { - key: false, - debug: () => { - var _table$options$debugA3; - return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable; - } - }), - getIsAllRowsSelected: () => { - const preGroupedFlatRows = table.getFilteredRowModel().flatRows; - const { - rowSelection - } = table.getState(); - let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); - if (isAllRowsSelected) { - if (preGroupedFlatRows.some((row) => row.getCanSelect() && !rowSelection[row.id])) { - isAllRowsSelected = false; - } - } - return isAllRowsSelected; - }, - getIsAllPageRowsSelected: () => { - const paginationFlatRows = table.getPaginationRowModel().flatRows; - const { - rowSelection - } = table.getState(); - let isAllPageRowsSelected = !!paginationFlatRows.length; - if (isAllPageRowsSelected && paginationFlatRows.some((row) => row.getCanSelect() && !rowSelection[row.id])) { - isAllPageRowsSelected = false; - } - return isAllPageRowsSelected; - }, - getIsSomeRowsSelected: () => { - var _table$getState$rowSe; - const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; - return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; - }, - getIsSomePageRowsSelected: () => { - const paginationFlatRows = table.getPaginationRowModel().flatRows; - return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some((d5) => d5.getIsSelected() || d5.getIsSomeSelected()); - }, - getToggleAllRowsSelectedHandler: () => { - return (e4) => { - table.toggleAllRowsSelected(e4.target.checked); + activeRef.current = null; + dn(() => { + dispatch({ + type + }); + setStatus(Status.Uninitialized); + setOver(null); + setActiveSensor(null); + setActivatorEvent(null); + const eventName = type === Action.DragEnd ? "onDragEnd" : "onDragCancel"; + if (event2) { + const handler2 = latestProps.current[eventName]; + handler2 == null ? void 0 : handler2(event2); + dispatchMonitorEvent({ + type: eventName, + event: event2 + }); + } + }); }; - }, - getToggleAllPageRowsSelectedHandler: () => { - return (e4) => { - table.toggleAllPageRowsSelected(e4.target.checked); + } + }, + [draggableNodes] + ); + const bindActivatorToSensorInstantiator = T2((handler, sensor) => { + return (event, active2) => { + const nativeEvent = event.nativeEvent; + const activeDraggableNode = draggableNodes.get(active2); + if (activeRef.current !== null || !activeDraggableNode || nativeEvent.dndKit || nativeEvent.defaultPrevented) { + return; + } + const activationContext = { + active: activeDraggableNode + }; + const shouldActivate = handler(event, sensor.options, activationContext); + if (shouldActivate === true) { + nativeEvent.dndKit = { + capturedBy: sensor.sensor }; + activeRef.current = active2; + instantiateSensor(event, sensor); } }; - }, - createRow: (row, table) => { - return { - toggleSelected: (value) => { - const isSelected = row.getIsSelected(); - table.setRowSelection((old) => { - value = typeof value !== "undefined" ? value : !isSelected; - if (isSelected === value) { - return old; - } - const selectedRowIds = { - ...old - }; - mutateRowIsSelected(selectedRowIds, row.id, value, table); - return selectedRowIds; + }, [draggableNodes, instantiateSensor]); + const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator); + useSensorSetup(sensors); + useIsomorphicLayoutEffect(() => { + if (activeNodeRect && status === Status.Initializing) { + setStatus(Status.Initialized); + } + }, [activeNodeRect, status]); + p2( + () => { + const { + onDragMove + } = latestProps.current; + const { + active: active2, + activatorEvent: activatorEvent2, + collisions: collisions2, + over: over2 + } = sensorContext.current; + if (!active2 || !activatorEvent2) { + return; + } + const event = { + active: active2, + activatorEvent: activatorEvent2, + collisions: collisions2, + delta: { + x: scrollAdjustedTranslate.x, + y: scrollAdjustedTranslate.y + }, + over: over2 + }; + dn(() => { + onDragMove == null ? void 0 : onDragMove(event); + dispatchMonitorEvent({ + type: "onDragMove", + event }); + }); + }, + [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y] + ); + p2( + () => { + const { + active: active2, + activatorEvent: activatorEvent2, + collisions: collisions2, + droppableContainers: droppableContainers2, + scrollAdjustedTranslate: scrollAdjustedTranslate2 + } = sensorContext.current; + if (!active2 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) { + return; + } + const { + onDragOver + } = latestProps.current; + const overContainer = droppableContainers2.get(overId); + const over2 = overContainer && overContainer.rect.current ? { + id: overContainer.id, + rect: overContainer.rect.current, + data: overContainer.data, + disabled: overContainer.disabled + } : null; + const event = { + active: active2, + activatorEvent: activatorEvent2, + collisions: collisions2, + delta: { + x: scrollAdjustedTranslate2.x, + y: scrollAdjustedTranslate2.y + }, + over: over2 + }; + dn(() => { + setOver(over2); + onDragOver == null ? void 0 : onDragOver(event); + dispatchMonitorEvent({ + type: "onDragOver", + event + }); + }); + }, + [overId] + ); + useIsomorphicLayoutEffect(() => { + sensorContext.current = { + activatorEvent, + active, + activeNode, + collisionRect, + collisions, + droppableRects, + draggableNodes, + draggingNode, + draggingNodeRect, + droppableContainers, + over, + scrollableAncestors, + scrollAdjustedTranslate + }; + activeRects.current = { + initial: draggingNodeRect, + translated: collisionRect + }; + }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]); + useAutoScroller({ + ...autoScrollOptions, + delta: translate, + draggingRect: collisionRect, + pointerCoordinates, + scrollableAncestors, + scrollableAncestorRects + }); + const publicContext = F2(() => { + const context = { + active, + activeNode, + activeNodeRect, + activatorEvent, + collisions, + containerNodeRect, + dragOverlay, + draggableNodes, + droppableContainers, + droppableRects, + over, + measureDroppableContainers, + scrollableAncestors, + scrollableAncestorRects, + measuringConfiguration, + measuringScheduled, + windowRect + }; + return context; + }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]); + const internalContext = F2(() => { + const context = { + activatorEvent, + activators, + active, + activeNodeRect, + ariaDescribedById: { + draggable: draggableDescribedById }, - getIsSelected: () => { - const { - rowSelection - } = table.getState(); - return isRowSelected(row, rowSelection); - }, - getIsSomeSelected: () => { - const { - rowSelection - } = table.getState(); - return isSubRowSelected(row, rowSelection) === "some"; - }, - getIsAllSubRowsSelected: () => { - const { - rowSelection - } = table.getState(); - return isSubRowSelected(row, rowSelection) === "all"; - }, - getCanSelect: () => { - var _table$options$enable; - if (typeof table.options.enableRowSelection === "function") { - return table.options.enableRowSelection(row); - } - return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; - }, - getCanSelectSubRows: () => { - var _table$options$enable2; - if (typeof table.options.enableSubRowSelection === "function") { - return table.options.enableSubRowSelection(row); - } - return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; - }, - getCanMultiSelect: () => { - var _table$options$enable3; - if (typeof table.options.enableMultiRowSelection === "function") { - return table.options.enableMultiRowSelection(row); + dispatch, + draggableNodes, + over, + measureDroppableContainers + }; + return context; + }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]); + return Cn.createElement(DndMonitorContext.Provider, { + value: registerMonitorListener + }, Cn.createElement(InternalContext.Provider, { + value: internalContext + }, Cn.createElement(PublicContext.Provider, { + value: publicContext + }, Cn.createElement(ActiveDraggableContext.Provider, { + value: transform + }, children)), Cn.createElement(RestoreFocus, { + disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false + })), Cn.createElement(Accessibility, { + ...accessibility, + hiddenTextDescribedById: draggableDescribedById + })); + function getAutoScrollerOptions() { + const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false; + const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false; + const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled; + if (typeof autoScroll === "object") { + return { + ...autoScroll, + enabled + }; + } + return { + enabled + }; + } +}); +var NullContext = /* @__PURE__ */ F(null); +var defaultRole = "button"; +var ID_PREFIX = "Droppable"; +function useDraggable(_ref) { + let { + id: id2, + data, + disabled = false, + attributes + } = _ref; + const key2 = useUniqueId(ID_PREFIX); + const { + activators, + activatorEvent, + active, + activeNodeRect, + ariaDescribedById, + draggableNodes, + over + } = q2(InternalContext); + const { + role = defaultRole, + roleDescription = "draggable", + tabIndex = 0 + } = attributes != null ? attributes : {}; + const isDragging = (active == null ? void 0 : active.id) === id2; + const transform = q2(isDragging ? ActiveDraggableContext : NullContext); + const [node, setNodeRef] = useNodeRef(); + const [activatorNode, setActivatorNodeRef] = useNodeRef(); + const listeners = useSyntheticListeners(activators, id2); + const dataRef = useLatestValue(data); + useIsomorphicLayoutEffect( + () => { + draggableNodes.set(id2, { + id: id2, + key: key2, + node, + activatorNode, + data: dataRef + }); + return () => { + const node2 = draggableNodes.get(id2); + if (node2 && node2.key === key2) { + draggableNodes.delete(id2); } - return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; - }, - getToggleSelectedHandler: () => { - const canSelect = row.getCanSelect(); - return (e4) => { - var _target; - if (!canSelect) - return; - row.toggleSelected((_target = e4.target) == null ? void 0 : _target.checked); - }; + }; + }, + [draggableNodes, id2] + ); + const memoizedAttributes = F2(() => ({ + role, + tabIndex, + "aria-disabled": disabled, + "aria-pressed": isDragging && role === defaultRole ? true : void 0, + "aria-roledescription": roleDescription, + "aria-describedby": ariaDescribedById.draggable + }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]); + return { + active, + activatorEvent, + activeNodeRect, + attributes: memoizedAttributes, + isDragging, + listeners: disabled ? void 0 : listeners, + node, + over, + setNodeRef, + setActivatorNodeRef, + transform + }; +} +function useDndContext() { + return q2(PublicContext); +} +var ID_PREFIX$1 = "Droppable"; +var defaultResizeObserverConfig = { + timeout: 25 +}; +function useDroppable(_ref) { + let { + data, + disabled = false, + id: id2, + resizeObserverConfig + } = _ref; + const key2 = useUniqueId(ID_PREFIX$1); + const { + active, + dispatch, + over, + measureDroppableContainers + } = q2(InternalContext); + const previous = _2({ + disabled + }); + const resizeObserverConnected = _2(false); + const rect = _2(null); + const callbackId = _2(null); + const { + disabled: resizeObserverDisabled, + updateMeasurementsFor, + timeout: resizeObserverTimeout + } = { + ...defaultResizeObserverConfig, + ...resizeObserverConfig + }; + const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2); + const handleResize = T2( + () => { + if (!resizeObserverConnected.current) { + resizeObserverConnected.current = true; + return; } - }; + if (callbackId.current != null) { + clearTimeout(callbackId.current); + } + callbackId.current = setTimeout(() => { + measureDroppableContainers(Array.isArray(ids2.current) ? ids2.current : [ids2.current]); + callbackId.current = null; + }, resizeObserverTimeout); + }, + [resizeObserverTimeout] + ); + const resizeObserver = useResizeObserver({ + callback: handleResize, + disabled: resizeObserverDisabled || !active + }); + const handleNodeChange = T2((newElement, previousElement) => { + if (!resizeObserver) { + return; + } + if (previousElement) { + resizeObserver.unobserve(previousElement); + resizeObserverConnected.current = false; + } + if (newElement) { + resizeObserver.observe(newElement); + } + }, [resizeObserver]); + const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange); + const dataRef = useLatestValue(data); + p2(() => { + if (!resizeObserver || !nodeRef.current) { + return; + } + resizeObserver.disconnect(); + resizeObserverConnected.current = false; + resizeObserver.observe(nodeRef.current); + }, [nodeRef, resizeObserver]); + useIsomorphicLayoutEffect( + () => { + dispatch({ + type: Action.RegisterDroppable, + element: { + id: id2, + key: key2, + disabled, + node: nodeRef, + rect, + data: dataRef + } + }); + return () => dispatch({ + type: Action.UnregisterDroppable, + key: key2, + id: id2 + }); + }, + [id2] + ); + p2(() => { + if (disabled !== previous.current.disabled) { + dispatch({ + type: Action.SetDroppableDisabled, + id: id2, + key: key2, + disabled + }); + previous.current.disabled = disabled; + } + }, [id2, key2, disabled, dispatch]); + return { + active, + rect, + isOver: (over == null ? void 0 : over.id) === id2, + node: nodeRef, + over, + setNodeRef + }; +} +function AnimationManager(_ref) { + let { + animation, + children + } = _ref; + const [clonedChildren, setClonedChildren] = h2(null); + const [element, setElement] = h2(null); + const previousChildren = usePrevious(children); + if (!children && !clonedChildren && previousChildren) { + setClonedChildren(previousChildren); } + useIsomorphicLayoutEffect(() => { + if (!element) { + return; + } + const key2 = clonedChildren == null ? void 0 : clonedChildren.key; + const id2 = clonedChildren == null ? void 0 : clonedChildren.props.id; + if (key2 == null || id2 == null) { + setClonedChildren(null); + return; + } + Promise.resolve(animation(id2, element)).then(() => { + setClonedChildren(null); + }); + }, [animation, clonedChildren, element]); + return Cn.createElement(Cn.Fragment, null, children, clonedChildren ? sn(clonedChildren, { + ref: setElement + }) : null); +} +var defaultTransform = { + x: 0, + y: 0, + scaleX: 1, + scaleY: 1 }; -var mutateRowIsSelected = (selectedRowIds, id2, value, table) => { - var _row$subRows; - const row = table.getRow(id2); - if (value) { - if (!row.getCanMultiSelect()) { - Object.keys(selectedRowIds).forEach((key2) => delete selectedRowIds[key2]); +function NullifiedContextProvider(_ref) { + let { + children + } = _ref; + return Cn.createElement(InternalContext.Provider, { + value: defaultInternalContext + }, Cn.createElement(ActiveDraggableContext.Provider, { + value: defaultTransform + }, children)); +} +var baseStyles = { + position: "fixed", + touchAction: "none" +}; +var defaultTransition = (activatorEvent) => { + const isKeyboardActivator = isKeyboardEvent(activatorEvent); + return isKeyboardActivator ? "transform 250ms ease" : void 0; +}; +var PositionedOverlay = /* @__PURE__ */ k3((_ref, ref) => { + let { + as, + activatorEvent, + adjustScale: adjustScale2, + children, + className, + rect, + style, + transform, + transition = defaultTransition + } = _ref; + if (!rect) { + return null; + } + const scaleAdjustedTransform = adjustScale2 ? transform : { + ...transform, + scaleX: 1, + scaleY: 1 + }; + const styles = { + ...baseStyles, + width: rect.width, + height: rect.height, + top: rect.top, + left: rect.left, + transform: CSS.Transform.toString(scaleAdjustedTransform), + transformOrigin: adjustScale2 && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : void 0, + transition: typeof transition === "function" ? transition(activatorEvent) : transition, + ...style + }; + return Cn.createElement(as, { + className, + style: styles, + ref + }, children); +}); +var defaultDropAnimationSideEffects = (options) => (_ref) => { + let { + active, + dragOverlay + } = _ref; + const originalStyles = {}; + const { + styles, + className + } = options; + if (styles != null && styles.active) { + for (const [key2, value] of Object.entries(styles.active)) { + if (value === void 0) { + continue; + } + originalStyles[key2] = active.node.style.getPropertyValue(key2); + active.node.style.setProperty(key2, value); } - if (row.getCanSelect()) { - selectedRowIds[id2] = true; + } + if (styles != null && styles.dragOverlay) { + for (const [key2, value] of Object.entries(styles.dragOverlay)) { + if (value === void 0) { + continue; + } + dragOverlay.node.style.setProperty(key2, value); } - } else { - delete selectedRowIds[id2]; } - if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { - row.subRows.forEach((row2) => mutateRowIsSelected(selectedRowIds, row2.id, value, table)); + if (className != null && className.active) { + active.node.classList.add(className.active); + } + if (className != null && className.dragOverlay) { + dragOverlay.node.classList.add(className.dragOverlay); } + return function cleanup() { + 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); + } + }; }; -function selectRowsFn(table, rowModel) { - const rowSelection = table.getState().rowSelection; - const newSelectedFlatRows = []; - const newSelectedRowsById = {}; - const recurseRows = function(rows, depth) { - return rows.map((row) => { - var _row$subRows2; - const isSelected = isRowSelected(row, rowSelection); - if (isSelected) { - newSelectedFlatRows.push(row); - newSelectedRowsById[row.id] = row; - } - if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { - row = { - ...row, - subRows: recurseRows(row.subRows) - }; +var defaultKeyframeResolver = (_ref2) => { + let { + transform: { + initial, + final + } + } = _ref2; + return [{ + transform: CSS.Transform.toString(initial) + }, { + transform: CSS.Transform.toString(final) + }]; +}; +var defaultDropAnimationConfiguration = { + duration: 250, + easing: "ease", + keyframes: defaultKeyframeResolver, + sideEffects: /* @__PURE__ */ defaultDropAnimationSideEffects({ + styles: { + active: { + opacity: "0" } - if (isSelected) { - return row; + } + }) +}; +function useDropAnimation(_ref3) { + let { + config, + draggableNodes, + droppableContainers, + measuringConfiguration + } = _ref3; + return useEvent((id2, node) => { + if (config === null) { + return; + } + const activeDraggable = draggableNodes.get(id2); + if (!activeDraggable) { + return; + } + const activeNode = activeDraggable.node.current; + if (!activeNode) { + return; + } + const measurableNode = getMeasurableNode(node); + if (!measurableNode) { + return; + } + const { + transform + } = getWindow(node).getComputedStyle(node); + const parsedTransform = parseTransform(transform); + if (!parsedTransform) { + return; + } + const animation = typeof config === "function" ? config : createDefaultDropAnimation(config); + scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure); + return animation({ + active: { + id: id2, + data: activeDraggable.data, + node: activeNode, + rect: measuringConfiguration.draggable.measure(activeNode) + }, + draggableNodes, + dragOverlay: { + node, + rect: measuringConfiguration.dragOverlay.measure(measurableNode) + }, + droppableContainers, + measuringConfiguration, + transform: parsedTransform + }); + }); +} +function createDefaultDropAnimation(options) { + const { + duration, + easing, + sideEffects, + keyframes + } = { + ...defaultDropAnimationConfiguration, + ...options + }; + return (_ref4) => { + let { + active, + dragOverlay, + transform, + ...rest + } = _ref4; + if (!duration) { + return; + } + const delta = { + x: dragOverlay.rect.left - active.rect.left, + y: dragOverlay.rect.top - active.rect.top + }; + const scale = { + scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1, + scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1 + }; + const finalTransform = { + x: transform.x - delta.x, + y: transform.y - delta.y, + ...scale + }; + const animationKeyframes = keyframes({ + ...rest, + active, + dragOverlay, + transform: { + initial: transform, + final: finalTransform } - }).filter(Boolean); + }); + const [firstKeyframe] = animationKeyframes; + const lastKeyframe = animationKeyframes[animationKeyframes.length - 1]; + if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) { + return; + } + const cleanup = sideEffects == null ? void 0 : sideEffects({ + active, + dragOverlay, + ...rest + }); + const animation = dragOverlay.node.animate(animationKeyframes, { + duration, + easing, + fill: "forwards" + }); + return new Promise((resolve) => { + animation.onfinish = () => { + cleanup == null ? void 0 : cleanup(); + resolve(); + }; + }); + }; +} +var key = 0; +function useKey(id2) { + return F2(() => { + if (id2 == null) { + return; + } + key++; + return key; + }, [id2]); +} +var DragOverlay = /* @__PURE__ */ Cn.memo((_ref) => { + let { + adjustScale: adjustScale2 = false, + children, + dropAnimation: dropAnimationConfig, + style, + transition, + modifiers, + wrapperElement = "div", + className, + zIndex = 999 + } = _ref; + const { + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggableNodes, + droppableContainers, + dragOverlay, + over, + measuringConfiguration, + scrollableAncestors, + scrollableAncestorRects, + windowRect + } = useDndContext(); + const transform = q2(ActiveDraggableContext); + const key2 = useKey(active == null ? void 0 : active.id); + const modifiedTransform = applyModifiers(modifiers, { + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggingNodeRect: dragOverlay.rect, + over, + overlayNodeRect: dragOverlay.rect, + scrollableAncestors, + scrollableAncestorRects, + transform, + windowRect + }); + const initialRect = useInitialValue(activeNodeRect); + const dropAnimation = useDropAnimation({ + config: dropAnimationConfig, + draggableNodes, + droppableContainers, + measuringConfiguration + }); + const ref = initialRect ? dragOverlay.setRef : void 0; + return Cn.createElement(NullifiedContextProvider, null, Cn.createElement(AnimationManager, { + animation: dropAnimation + }, active && key2 ? Cn.createElement(PositionedOverlay, { + key: key2, + id: active.id, + ref, + as: wrapperElement, + activatorEvent, + adjustScale: adjustScale2, + className, + transition, + rect: initialRect, + style: { + zIndex, + ...style + }, + transform: modifiedTransform + }, children) : null)); +}); + +// src/dispatch/mdb.ts +var import_lodash4 = __toESM(require_lodash()); +var import_obsidian13 = require("obsidian"); + +// src/utils/contexts/file.ts +var renameRowForFile = (folder, filePath, toFilePath) => { + return { + ...folder, + rows: folder.rows.map( + (f4) => f4.File == filePath ? { ...f4, File: toFilePath } : f4 + ) }; +}; +var removeRowForFile = (folder, filePath) => { return { - rows: recurseRows(rowModel.rows), - flatRows: newSelectedFlatRows, - rowsById: newSelectedRowsById + ...folder, + rows: folder.rows.filter( + (f4) => f4.File != filePath + ) }; -} -function isRowSelected(row, selection) { - var _selection$row$id; - return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; -} -function isSubRowSelected(row, selection, table) { - if (row.subRows && row.subRows.length) { - let allChildrenSelected = true; - let someSelected = false; - row.subRows.forEach((subRow) => { - if (someSelected && !allChildrenSelected) { - return; - } - if (isRowSelected(subRow, selection)) { - someSelected = true; - } else { - allChildrenSelected = false; - } - }); - return allChildrenSelected ? "all" : someSelected ? "some" : false; - } - return false; -} -var reSplitAlphaNumeric = /([0-9]+)/gm; -var alphanumeric = (rowA, rowB, columnId) => { - return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); }; -var alphanumericCaseSensitive = (rowA, rowB, columnId) => { - return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +var removeRowsForFile = (folder, filePaths) => { + return { + ...folder, + rows: folder.rows.filter( + (f4) => !filePaths.includes(f4.File) + ) + }; }; -var text = (rowA, rowB, columnId) => { - return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); + +// src/utils/contexts/links.ts +var valueContainsLink = (link, value) => { + return parseMultiString(value).some((f4) => link == parseLinkString(f4)); }; -var textCaseSensitive = (rowA, rowB, columnId) => { - return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +var replaceLinkInValue = (link, newLink, value) => { + return serializeMultiString(parseMultiString(value).map((f4) => parseLinkString(f4) == link ? newLink : link)); }; -var datetime = (rowA, rowB, columnId) => { - const a5 = rowA.getValue(columnId); - const b4 = rowB.getValue(columnId); - return a5 > b4 ? 1 : a5 < b4 ? -1 : 0; +var removeLinkInValue = (link, value) => { + return serializeMultiString(parseMultiString(value).filter((f4) => f4 != link)); }; -var basic = (rowA, rowB, columnId) => { - return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); +var linkColumns = (cols) => { + return cols.filter((f4) => f4.type.startsWith("link") || f4.type.startsWith("context")); }; -function compareBasic(a5, b4) { - return a5 === b4 ? 0 : a5 > b4 ? 1 : -1; -} -function toString(a5) { - if (typeof a5 === "number") { - if (isNaN(a5) || a5 === Infinity || a5 === -Infinity) { - return ""; - } - return String(a5); - } - if (typeof a5 === "string") { - return a5; +var removeLinksInRow = (plugin, row, link, cols) => { + if (cols.length == 0) { + return row; } - return ""; -} -function compareAlphanumeric(aStr, bStr) { - const a5 = aStr.split(reSplitAlphaNumeric).filter(Boolean); - const b4 = bStr.split(reSplitAlphaNumeric).filter(Boolean); - while (a5.length && b4.length) { - const aa = a5.shift(); - const bb = b4.shift(); - const an2 = parseInt(aa, 10); - const bn2 = parseInt(bb, 10); - const combo = [an2, bn2].sort(); - if (isNaN(combo[0])) { - if (aa > bb) { - return 1; - } - if (bb > aa) { - return -1; - } - continue; - } - if (isNaN(combo[1])) { - return isNaN(an2) ? -1 : 1; - } - if (an2 > bn2) { - return 1; - } - if (bn2 > an2) { - return -1; + const deltaRow = cols.reduce((p3, c4) => { + if (valueContainsLink(link, row[c4.name])) { + const newValue = removeLinkInValue(link, row[c4.name]); + saveFrontmatterValue( + plugin, + row.File, + c4.name, + newValue, + c4.type, + plugin.settings.saveAllContextToFrontmatter + ); + return { ...p3, [c4.name]: newValue }; } + return p3; + }, {}); + return { ...row, ...deltaRow }; +}; +var renameLinksInRow = (plugin, row, link, newLink, cols) => { + if (cols.length == 0) { + return row; } - return a5.length - b4.length; -} -var sortingFns = { - alphanumeric, - alphanumericCaseSensitive, - text, - textCaseSensitive, - datetime, - basic + const deltaRow = cols.reduce((p3, c4) => { + if (valueContainsLink(link, row[c4.name])) { + const newValue = replaceLinkInValue(link, newLink, row[c4.name]); + saveFrontmatterValue( + plugin, + row.File, + c4.name, + newValue, + c4.type, + plugin.settings.saveAllContextToFrontmatter + ); + return { ...p3, [c4.name]: newValue }; + } + return p3; + }, {}); + return { ...row, ...deltaRow }; }; -var Sorting = { - getInitialState: (state) => { - return { - sorting: [], - ...state - }; - }, - getDefaultColumnDef: () => { - return { - sortingFn: "auto" - }; - }, - getDefaultOptions: (table) => { - return { - onSortingChange: makeStateUpdater("sorting", table), - isMultiSortEvent: (e4) => { - return e4.shiftKey; + +// src/utils/metadata/dataview/parseDataview.ts +var parseDataview = (field, value) => { + const YAMLtype = detectYAMLType(value, field); + switch (YAMLtype) { + case "object": + return JSON.stringify(value); + break; + case "number": + return value.toString(); + break; + case "boolean": + return value ? "true" : "false"; + break; + case "date": + return format(new Date(value.ts), "yyyy-MM-dd"); + break; + case "duration": + return serializeMultiDisplayString(Object.keys(value.values).reduce( + (p3, c4) => [ + ...p3, + ...value.values[c4] > 0 ? [value.values[c4] + " " + c4] : [] + ], + [] + )); + break; + case "option-multi": + case "link-multi": + if (typeof value === "string") { + return value; } - }; - }, - createColumn: (column, table) => { - return { - getAutoSortingFn: () => { - const firstRows = table.getFilteredRowModel().flatRows.slice(10); - let isString = false; - for (const row of firstRows) { - const value = row == null ? void 0 : row.getValue(column.id); - if (Object.prototype.toString.call(value) === "[object Date]") { - return sortingFns.datetime; - } - if (typeof value === "string") { - isString = true; - if (value.split(reSplitAlphaNumeric).length > 1) { - return sortingFns.alphanumeric; - } - } - } - if (isString) { - return sortingFns.text; - } - return sortingFns.basic; - }, - getAutoSortDir: () => { - const firstRow = table.getFilteredRowModel().flatRows[0]; - const value = firstRow == null ? void 0 : firstRow.getValue(column.id); - if (typeof value === "string") { - return "asc"; - } - return "desc"; - }, - getSortingFn: () => { - var _table$options$sortin, _table$options$sortin2; - if (!column) { - throw new Error(); - } - return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === "auto" ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn]; - }, - toggleSorting: (desc, multi) => { - const nextSortingOrder = column.getNextSortingOrder(); - const hasManualValue = typeof desc !== "undefined" && desc !== null; - table.setSorting((old) => { - const existingSorting = old == null ? void 0 : old.find((d5) => d5.id === column.id); - const existingIndex = old == null ? void 0 : old.findIndex((d5) => d5.id === column.id); - let newSorting = []; - let sortAction; - let nextDesc = hasManualValue ? desc : nextSortingOrder === "desc"; - if (old != null && old.length && column.getCanMultiSort() && multi) { - if (existingSorting) { - sortAction = "toggle"; - } else { - sortAction = "add"; - } - } else { - if (old != null && old.length && existingIndex !== old.length - 1) { - sortAction = "replace"; - } else if (existingSorting) { - sortAction = "toggle"; - } else { - sortAction = "replace"; - } - } - if (sortAction === "toggle") { - if (!hasManualValue) { - if (!nextSortingOrder) { - sortAction = "remove"; - } - } + return serializeMultiString( + value.map((v3) => { + if (!v3) { + return ""; } - if (sortAction === "add") { - var _table$options$maxMul; - newSorting = [...old, { - id: column.id, - desc: nextDesc - }]; - 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((d5) => { - if (d5.id === column.id) { - return { - ...d5, - desc: nextDesc - }; - } - return d5; - }); - } else if (sortAction === "remove") { - newSorting = old.filter((d5) => d5.id !== column.id); - } else { - newSorting = [{ - id: column.id, - desc: nextDesc - }]; + if (typeof v3 === "string") { + return v3; } - return newSorting; - }); - }, - getFirstSortDir: () => { - var _ref, _column$columnDef$sor; - const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === "desc"; - return sortDescFirst ? "desc" : "asc"; - }, - getNextSortingOrder: (multi) => { - var _table$options$enable, _table$options$enable2; - const firstSortDirection = column.getFirstSortDir(); - const isSorted = column.getIsSorted(); - if (!isSorted) { - return firstSortDirection; - } - 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"; - }, - getCanSort: () => { - var _column$columnDef$ena, _table$options$enable3; - return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; - }, - getCanMultiSort: () => { - var _ref2, _column$columnDef$ena2; - return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; - }, - getIsSorted: () => { - var _table$getState$sorti; - const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d5) => d5.id === column.id); - return !columnSort ? false : columnSort.desc ? "desc" : "asc"; - }, - getSortIndex: () => { - var _table$getState$sorti2, _table$getState$sorti3; - return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d5) => d5.id === column.id)) != null ? _table$getState$sorti2 : -1; - }, - clearSorting: () => { - table.setSorting((old) => old != null && old.length ? old.filter((d5) => d5.id !== column.id) : []); - }, - getToggleSortingHandler: () => { - const canSort = column.getCanSort(); - return (e4) => { - if (!canSort) - return; - e4.persist == null ? void 0 : e4.persist(); - column.toggleSorting == null ? void 0 : column.toggleSorting(void 0, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e4) : false); - }; - } - }; - }, - createTable: (table) => { - return { - setSorting: (updater) => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater), - resetSorting: (defaultState) => { - var _table$initialState$s, _table$initialState; - table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); - }, - getPreSortedRowModel: () => table.getGroupedRowModel(), - getSortedRowModel: () => { - if (!table._getSortedRowModel && table.options.getSortedRowModel) { - table._getSortedRowModel = table.options.getSortedRowModel(table); - } - if (table.options.manualSorting || !table._getSortedRowModel) { - return table.getPreSortedRowModel(); - } - return table._getSortedRowModel(); - } - }; - } -}; -var Visibility = { - getInitialState: (state) => { - return { - columnVisibility: {}, - ...state - }; - }, - getDefaultOptions: (table) => { - return { - onColumnVisibilityChange: makeStateUpdater("columnVisibility", table) - }; - }, - createColumn: (column, table) => { - return { - toggleVisibility: (value) => { - if (column.getCanHide()) { - table.setColumnVisibility((old) => ({ - ...old, - [column.id]: value != null ? value : !column.getIsVisible() - })); - } - }, - getIsVisible: () => { - var _table$getState$colum, _table$getState$colum2; - return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true; - }, - getCanHide: () => { - var _column$columnDef$ena, _table$options$enable; - return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); - }, - getToggleVisibilityHandler: () => { - return (e4) => { - column.toggleVisibility == null ? void 0 : column.toggleVisibility(e4.target.checked); - }; - } - }; - }, - createRow: (row, table) => { - return { - _getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => { - return cells.filter((cell) => cell.column.getIsVisible()); - }, { - key: false, - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows; - } - }), - getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], { - key: "row.getVisibleCells", - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows; - } - }) - }; - }, - createTable: (table) => { - const makeVisibleColumnsMethod = (key2, getColumns) => { - return memo(() => [getColumns(), getColumns().filter((d5) => d5.getIsVisible()).map((d5) => d5.id).join("_")], (columns) => { - return columns.filter((d5) => d5.getIsVisible == null ? void 0 : d5.getIsVisible()); - }, { - key: key2, - debug: () => { - var _table$options$debugA3; - return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns; + if (v3.path) { + return v3.path; + } + if (Array.isArray(value) && v3.length == 1 && Array.isArray(v3[0]) && v3[0].length == 1 && typeof v3[0][0] === "string") { + return v3[0][0]; + } + return JSON.stringify(v3); + }) + ); + break; + case "link": + { + if (Array.isArray(value) && value.length == 1 && Array.isArray(value[0]) && value[0].length == 1 && typeof value[0][0] === "string") { + return value[0][0]; + } else if (typeof value === "string") { + return value; } - }); - }; - return { - getVisibleFlatColumns: makeVisibleColumnsMethod("getVisibleFlatColumns", () => table.getAllFlatColumns()), - getVisibleLeafColumns: makeVisibleColumnsMethod("getVisibleLeafColumns", () => table.getAllLeafColumns()), - getLeftVisibleLeafColumns: makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table.getLeftLeafColumns()), - getRightVisibleLeafColumns: makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table.getRightLeafColumns()), - getCenterVisibleLeafColumns: makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table.getCenterLeafColumns()), - setColumnVisibility: (updater) => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater), - resetColumnVisibility: (defaultState) => { - var _table$initialState$c; - table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); - }, - toggleAllColumnsVisible: (value) => { - var _value; - value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); - table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ - ...obj, - [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value - }), {})); - }, - getIsAllColumnsVisible: () => !table.getAllLeafColumns().some((column) => !(column.getIsVisible != null && column.getIsVisible())), - getIsSomeColumnsVisible: () => table.getAllLeafColumns().some((column) => column.getIsVisible == null ? void 0 : column.getIsVisible()), - getToggleAllColumnsVisibilityHandler: () => { - return (e4) => { - var _target; - table.toggleAllColumnsVisible((_target = e4.target) == null ? void 0 : _target.checked); - }; + return value.path; } - }; + break; + case "text": + case "tag": + case "image": + return value; + break; } + return ""; }; -var features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; -function createTable(options) { - var _options$initialState; - if (options.debugAll || options.debugTable) { - console.info("Creating Table Instance..."); + +// src/dispatch/mdb.ts +var processContextFile = async (plugin, context, processor, fallback) => { + const dbFileExists = getAbstractFileAtPath(app, context.dbPath); + if (dbFileExists) { + const contextDB = await getMDBTable(plugin, context, "files"); + if (contextDB) { + await processor(contextDB, context); + return; + } else if (fallback) { + await fallback(); + } + } else if (fallback) { + await fallback(); } - let table = { - _features: features +}; +var saveDB = async (plugin, context, newTable) => { + return saveMDBToPath(plugin, context, newTable); +}; +var insertColumns = (table, column) => { + if (table.cols.find((f4) => f4.name == column.name)) { + new import_obsidian13.Notice(i18n_default.notice.duplicatePropertyName); + return; + } + return { + ...table, + cols: [...table.cols, column] }; - const defaultOptions3 = table._features.reduce((obj, feature) => { - return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); - }, {}); - const mergeOptions = (options2) => { - if (table.options.mergeOptions) { - return table.options.mergeOptions(defaultOptions3, options2); - } - return { - ...defaultOptions3, - ...options2 - }; +}; +var updateValue = (folder, lookupField, lookupValue, field, value) => { + return { + ...folder, + rows: folder.rows.map( + (f4) => f4[lookupField] == lookupValue ? { + ...f4, + [field]: value + } : f4 + ) }; - const coreInitialState = {}; - let initialState = { - ...coreInitialState, - ...(_options$initialState = options.initialState) != null ? _options$initialState : {} +}; +var insertRowsIfUnique = (folder, rows) => { + return { ...folder, rows: [...folder.rows, ...rows.filter((f4) => !folder.rows.some((g4) => g4.File == f4.File))] }; +}; +var saveContextToFrontmatter = (file, cols, context, plugin) => { + const afile = getAbstractFileAtPath(app, file); + if (afile && afile instanceof import_obsidian13.TFile) + saveContextToFile(afile, cols, context, plugin); +}; +var initiateContextIfNotExists = async (plugin, tag) => { + const context = tagContextFromTag(plugin, tag); + const tagFileExists = getAbstractFileAtPath(app, context.dbPath); + if (tagFileExists) + return false; + return createDefaultDB(plugin, context); +}; +var updateContextValue = async (plugin, context, file, field, value) => { + let tagFileExists = abstractFileAtPathExists(app, context.dbPath); + if (!tagFileExists) { + tagFileExists = await createDefaultDB(plugin, context); + } + if (tagFileExists) + await getMDBTable(plugin, context, "files").then( + (tagDB) => { + const newMDB = updateValue(tagDB, FilePropertyName, file, field, value); + return saveDB(plugin, context, newMDB).then((f4) => newMDB); + } + ); +}; +var insertContextColumn = async (plugin, context, field) => { + let tagFileExists = abstractFileAtPathExists(app, context.dbPath); + if (!tagFileExists) { + tagFileExists = await createDefaultDB(plugin, context); + } + if (tagFileExists) + await getMDBTable(plugin, context, "files").then((tagDB) => { + const newDB = insertColumns(tagDB, field); + saveDB(plugin, context, newDB).then((f4) => newDB); + return newDB; + }).then((f4) => plugin.index.reloadContext(context)); +}; +var insertContextItems = async (plugin, newPaths, t4) => { + const saveNewContextRows = async (tag, context2) => { + const newRow = newPaths.map((newPath) => ({ File: newPath })); + await saveDB(plugin, context2, insertRowsIfUnique(tag, newRow)); }; - table._features.forEach((feature) => { - var _feature$getInitialSt; - initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; + const context = tagContextFromTag(plugin, t4); + let tagFileExists = abstractFileAtPathExists(app, context.dbPath); + if (!tagFileExists) { + tagFileExists = await createDefaultDB(plugin, context); + } + if (tagFileExists) + await getMDBTable(plugin, context, "files").then( + (tagDB) => saveNewContextRows(tagDB, context) + ); +}; +var fileToFM = (afile, cols, plugin) => { + let file = afile; + if (afile instanceof import_obsidian13.TFolder) { + file = getAbstractFileAtPath(app, folderNotePathFromAFile(plugin.settings, tFileToAFile(afile))); + } + if (!file) + return []; + const fm = frontMatterForFile(file); + const fmKeys = frontMatterKeys(fm).filter((f4) => cols.some((g4) => f4 == g4)); + const rows = fmKeys.reduce( + (p3, c4) => ({ ...p3, [c4]: parseFrontMatter(c4, fm[c4]) }), + {} + ); + if (plugin.dataViewAPI()) { + return { ...rows, ...fileToDV(file, cols, plugin) }; + } + return rows; +}; +var fileToDV = (file, cols, plugin) => { + const dvValues = plugin.dataViewAPI().page(file.path); + const fmKeys = uniqCaseInsensitive( + Object.keys(dvValues != null ? dvValues : {}).filter( + (f4, i4, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + ) ? true : false + ).filter((f4) => f4 != "file") + ).filter((f4) => cols.some((g4) => f4 == g4)); + return fmKeys.reduce( + (p3, c4) => ({ + ...p3, + [c4]: parseDataview(c4, dvValues[c4]) + }), + {} + ); +}; +var onMetadataChange = async (plugin, file, contexts) => { + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const newDB = { + ...mdb, + rows: mdb.rows.map( + (f4) => f4.File == file.path ? { + ...f4, + ...fileToFM( + file, + mdb.cols.map((f5) => f5.name), + plugin + ) + } : f4 + ) + }; + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); + } + return newDB; + }); }); - const queued = []; - let queuedTimeout = false; - const coreInstance = { - _features: features, - options: { - ...defaultOptions3, - ...options - }, - initialState, - _queue: (cb) => { - queued.push(cb); - if (!queuedTimeout) { - queuedTimeout = true; - Promise.resolve().then(() => { - while (queued.length) { - queued.shift()(); - } - queuedTimeout = false; - }).catch((error) => setTimeout(() => { - throw error; - })); + return Promise.all(promises); +}; +var renameTagInContexts = async (plugin, oldTag, newTag, contexts) => { + const changeTagInContextMDB = (mdb) => { + const schema = parseContextDefString(mdb.schema.def).some((t4) => t4.type == "tag" && t4.value == oldTag) ? { ...mdb.schema, def: updateTagsForDefString(mdb.schema.def, tagsFromDefString(mdb.schema.def).map((t4) => t4 == oldTag ? newTag : t4)) } : mdb.schema; + const cols = mdb.cols.map((f4) => f4.type.startsWith("context") && f4.value == oldTag ? { ...f4, value: newTag } : f4); + return { ...mdb, schema, cols }; + }; + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const newDB = changeTagInContextMDB(mdb); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); } - }, - reset: () => { - table.setState(table.initialState); - }, - setOptions: (updater) => { - const newOptions = functionalUpdate(updater, table.options); - table.options = mergeOptions(newOptions); - }, - getState: () => { - return table.options.state; - }, - setState: (updater) => { - table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater); - }, - _getRowId: (row, index, parent) => { - var _table$options$getRow; - return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join(".") : index}`; - }, - getCoreRowModel: () => { - if (!table._getCoreRowModel) { - table._getCoreRowModel = table.options.getCoreRowModel(table); + return newDB; + }); + }); + return Promise.all(promises); +}; +var removeTagInContexts = async (plugin, tag, contexts) => { + const deleteTagInContextMDB = (mdb) => { + const schema = parseContextDefString(mdb.schema.def).some((t4) => t4.type == "tag" && t4.value == tag) ? { ...mdb.schema, def: updateTagsForDefString(mdb.schema.def, tagsFromDefString(mdb.schema.def).filter((t4) => t4 != tag)) } : mdb.schema; + const cols = mdb.cols.map((f4) => f4.type.startsWith("context") && f4.value == tag ? { ...f4, type: "link-multi" } : f4); + return { ...mdb, schema, cols }; + }; + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const newDB = deleteTagInContextMDB(mdb); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); } - return table._getCoreRowModel(); - }, - getRowModel: () => { - return table.getPaginationRowModel(); - }, - getRow: (id2) => { - const row = table.getRowModel().rowsById[id2]; - if (!row) { - if (true) { - throw new Error(`getRow expected an ID, but got ${id2}`); - } - throw new Error(); + return newDB; + }); + }); + return Promise.all(promises); +}; +var addFileInContexts = async (plugin, path, contexts) => { + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const newDB = insertRowsIfUnique(mdb, [{ File: path }]); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); } - return row; - }, - _getDefaultColumnDef: memo(() => [table.options.defaultColumn], (defaultColumn) => { - var _defaultColumn; - defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; - return { - header: (props2) => { - const resolvedColumnDef = props2.header.column.columnDef; - if (resolvedColumnDef.accessorKey) { - return resolvedColumnDef.accessorKey; - } - if (resolvedColumnDef.accessorFn) { - return resolvedColumnDef.id; - } - return null; - }, - cell: (props2) => { - var _props$renderValue$to, _props$renderValue; - return (_props$renderValue$to = (_props$renderValue = props2.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; - }, - ...table._features.reduce((obj, feature) => { - return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); - }, {}), - ...defaultColumn + return newDB; + }); + }); + return Promise.all(promises); +}; +var renameLinkInContexts = async (plugin, oldPath, newPath, contexts) => { + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const linkCols = linkColumns(mdb.cols); + const newDB = { + ...mdb, + rows: mdb.rows.map((r3) => renameLinksInRow(plugin, r3, oldPath, newPath, linkCols)) }; - }, { - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns; - }, - key: "getDefaultColumnDef" - }), - _getColumnDefs: () => table.options.columns, - getAllColumns: memo(() => [table._getColumnDefs()], (columnDefs) => { - const recurseColumns = function(columnDefs2, parent, depth) { - if (depth === void 0) { - depth = 0; - } - return columnDefs2.map((columnDef) => { - const column = createColumn(table, columnDef, depth, parent); - const groupingColumnDef = columnDef; - column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : []; - return column; - }); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); + } + return newDB; + }); + }); + return Promise.all(promises); +}; +var removeLinkInContexts = async (plugin, path, contexts) => { + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const linkCols = linkColumns(mdb.cols); + const newDB = { + ...mdb, + rows: mdb.rows.map((r3) => removeLinksInRow(plugin, r3, path, linkCols)) }; - return recurseColumns(columnDefs); - }, { - key: "getAllColumns", - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns; + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); } - }), - getAllFlatColumns: memo(() => [table.getAllColumns()], (allColumns) => { - return allColumns.flatMap((column) => { - return column.getFlatColumns(); - }); - }, { - key: "getAllFlatColumns", - debug: () => { - var _table$options$debugA3; - return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns; + return newDB; + }); + }); + return Promise.all(promises); +}; +var renameFileInContexts = async (plugin, oldPath, newPath, contexts) => { + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const newDB = renameRowForFile(mdb, oldPath, newPath); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); } - }), - _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], (flatColumns) => { - return flatColumns.reduce((acc, column) => { - acc[column.id] = column; - return acc; - }, {}); - }, { - key: "getAllFlatColumnsById", - debug: () => { - var _table$options$debugA4; - return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns; + return newDB; + }); + }); + return Promise.all(promises); +}; +var removeFileInContexts = async (plugin, path, contexts) => { + const promises = contexts.map((context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + const removeRow = mdb.rows.find((f4) => f4.File == path); + if (removeRow) { + saveContextToFrontmatter(path, mdb.cols, removeRow, plugin); } - }), - getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => { - let leafColumns = allColumns.flatMap((column) => column.getLeafColumns()); - return orderColumns2(leafColumns); - }, { - key: "getAllLeafColumns", - debug: () => { - var _table$options$debugA5; - return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns; + const newDB = removeRowForFile(mdb, path); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); + } + return newDB; + }); + }); + return Promise.all(promises); +}; +var removeFilesInContext = async (plugin, paths, context) => { + return processContextFile(plugin, context, async (mdb, context2) => { + mdb.rows.forEach((row) => { + if (paths.includes(row.File)) + saveContextToFrontmatter(row.File, mdb.cols, row, plugin); + }); + const newDB = removeRowsForFile(mdb, paths); + if (!import_lodash4.default.isEqual(mdb, newDB)) { + await saveDB(plugin, context2, newDB); + } + return newDB; + }); +}; + +// src/hooks/useCombinedRef.tsx +function useCombinedRefs2(...refs) { + return F2( + () => (node) => { + refs.forEach((ref) => ref(node)); + }, + refs + ); +} + +// src/components/ContextView/TableView/ColumnHeader.tsx +var filePropTypes = [ + { + name: i18n_default.properties.fileProperty.createdTime, + value: "ctime" + }, + { + name: i18n_default.properties.fileProperty.modifiedTime, + value: "mtime" + }, + { + name: i18n_default.properties.fileProperty.extension, + value: "extension" + }, + { + name: i18n_default.properties.fileProperty.size, + value: "size" + }, + { + name: i18n_default.properties.fileProperty.parentFolder, + value: "folder" + }, + { + name: "Links", + value: "links" + }, + { + name: "Tags", + value: "tags" + }, + { + name: "Spaces", + value: "spaces" + } +]; +var ColumnHeader = (props2) => { + const [field, setField] = h2(props2.column); + const menuRef = _2(null); + const { + loadContextFields, + contextInfo, + predicate, + tableData, + tagContexts, + contextTable, + cols, + newColumn, + saveColumn, + hideColumn, + sortColumn, + delColumn + } = q2(MDBContext); + p2(() => { + setField(props2.column); + }, [props2.column]); + const { + attributes, + listeners, + setNodeRef: setDraggableNodeRef, + transform + } = useDraggable({ + id: field.name + field.table, + data: { name: field.name } + }); + const { setNodeRef: setDroppableNodeRef } = useDroppable({ + id: field.name + field.table, + data: { name: field.name } + }); + const saveField = (field2) => { + if (field2.name.length > 0) { + if (field2.name != props2.column.name || field2.type != props2.column.type || field2.value != props2.column.value || field2.attrs != props2.column.attrs) { + const saveResult = saveColumn(field2, props2.column); + if (saveResult) { + if (props2.isNew) { + setField(props2.column); + } + } } - }), - getColumn: (columnId) => { - const column = table._getAllFlatColumnsById()[columnId]; - if (!column) { - console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + }; + const saveContext = (field2, value) => { + const newContext = value[0]; + connectContext(props2.plugin, value[0], contextInfo.dbPath); + initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { + if (f4) { + return insertContextItems( + props2.plugin, + optionValuesForColumn( + field2.name, + field2.table == "" ? tableData : contextTable[field2.table] + ), + newContext + ); } - return column; + }).then((f4) => loadContextFields(newContext)); + const newField = { + ...field2, + value: newContext != null ? newContext : "" + }; + setField(newField); + saveColumn(newField, props2.column); + }; + const showNewMenu = (e4) => { + const offset = ref.current.getBoundingClientRect(); + showNewPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + tagContexts, + cols, + (source, field2) => newColumn({ ...field2, table: source }), + tableData.schema.id, + contextInfo.contextPath, + false + ); + }; + const toggleMenu = (e4) => { + if (props2.isNew) { + showNewMenu(e4); + } else { + const offset = e4.target.getBoundingClientRect(); + const options = optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ); + showPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + props2.editable, + options, + field, + cols, + contextInfo.contextPath, + saveField, + saveContext, + hideColumn, + delColumn, + sortColumn, + predicate.colsHidden.includes(field.name + field.table) + ); } }; - Object.assign(table, coreInstance); - table._features.forEach((feature) => { - return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table)); - }); - return table; -} -function createCell(table, row, column, columnId) { - const getRenderValue = () => { - var _cell$getValue; - return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + const ref = _2(null); + const setNodeRef = useCombinedRefs2(setDroppableNodeRef, setDraggableNodeRef); + return /* @__PURE__ */ Cn.createElement("div", { + ref: setNodeRef, + ...listeners, + ...attributes, + className: "mk-col-header", + onClick: (e4) => { + toggleMenu(e4); + } + }, /* @__PURE__ */ Cn.createElement("div", { + ref + }, props2.column.name.length > 0 ? field.name : "+", /* @__PURE__ */ Cn.createElement("span", { + className: "mk-col-header-context", + "aria-label": props2.column.table.length > 0 ? props2.column.table : "" + }, props2.column.table.length > 0 ? "#" : ""))); +}; + +// src/components/ui/menus/propertyMenu.tsx +var import_obsidian14 = require("obsidian"); +var PropertyValueComponent = (props2) => { + const selectContext = (e4) => { + var _a2; + showSelectMenu(e4.target.getBoundingClientRect(), { + multi: false, + editable: true, + searchable: true, + saveOptions: (_9, v3) => props2.saveContext(v3[0]), + placeholder: i18n_default.labels.propertyContext, + value: [(_a2 = props2.value) != null ? _a2 : ""], + options: loadTags(props2.plugin).map((m5) => ({ name: m5, value: m5 })) + }); }; - const cell = { - id: `${row.id}_${column.id}`, - row, - column, - getValue: () => row.getValue(columnId), - renderValue: getRenderValue, - getContext: memo(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({ - table: table2, - column: column2, - row: row2, - cell: cell2, - getValue: cell2.getValue, - renderValue: cell2.renderValue - }), { - key: "cell.getContext", - debug: () => table.options.debugAll - }) + const selectFileProp = (e4) => { + var _a2; + const properties2 = (_a2 = props2.plugin.index.contextsIndex.get(props2.contextPath)) == null ? void 0 : _a2.cols.filter( + (f4) => f4.type == "file" || f4.type == "link" || f4.type == "context" + ).reduce((p3, c4) => { + var _a3, _b2; + return [ + ...p3, + ...c4.type == "file" || c4.type == "link" ? filePropTypes.map((f4) => ({ + name: c4.name + "." + f4.name, + value: c4.name + "." + f4.value + })) : (_b2 = (_a3 = props2.plugin.index.contextsIndex.get(c4.value)) == null ? void 0 : _a3.cols.filter((f4) => f4.hidden != "true").map((f4) => ({ + name: c4.name + "." + f4.name, + value: c4.name + "." + f4.name + }))) != null ? _b2 : [] + ]; + }, []); + showSelectMenu(e4.target.getBoundingClientRect(), { + multi: false, + editable: false, + searchable: false, + saveOptions: (_9, v3) => props2.saveValue(v3[0]), + value: [], + options: properties2, + showAll: true + }); }; - table._features.forEach((feature) => { - Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table)); - }, {}); - return cell; -} -var createRow = (table, id2, original, rowIndex, depth, subRows) => { - let row = { - id: id2, - index: rowIndex, - original, - depth, - _valuesCache: {}, - _uniqueValuesCache: {}, - getValue: (columnId) => { - if (row._valuesCache.hasOwnProperty(columnId)) { - return row._valuesCache[columnId]; - } - const column = table.getColumn(columnId); - if (!(column != null && column.accessorFn)) { - return void 0; - } - row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); - return row._valuesCache[columnId]; - }, - getUniqueValues: (columnId) => { - if (row._uniqueValuesCache.hasOwnProperty(columnId)) { - return row._uniqueValuesCache[columnId]; - } - const column = table.getColumn(columnId); - if (!(column != null && column.accessorFn)) { - return void 0; - } - if (!column.columnDef.getUniqueValues) { - row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; - return row._uniqueValuesCache[columnId]; - } - row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); - return row._uniqueValuesCache[columnId]; - }, - renderValue: (columnId) => { - var _row$getValue; - return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; - }, - subRows: subRows != null ? subRows : [], - getLeafRows: () => flattenBy(row.subRows, (d5) => d5.subRows), - getAllCells: memo(() => [table.getAllLeafColumns()], (leafColumns) => { - return leafColumns.map((column) => { - return createCell(table, row, column, column.id); - }); - }, { - key: "row.getAllCells", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows; - } - }), - _getAllCellsByColumnId: memo(() => [row.getAllCells()], (allCells) => { - return allCells.reduce((acc, cell) => { - acc[cell.column.id] = cell; - return acc; - }, {}); - }, { - key: false, - debug: () => { - var _table$options$debugA2; - return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows; + const selectDateFormat = (e4) => { + const formats = [ + { + name: "2020-04-21", + value: "yyyy-MM-dd" + }, + { + name: "Apr 21, 2020", + value: "MMM d, yyyy" + }, + { + name: "Tue Apr 21, 2020", + value: "EEE MMM d, yyyy" } - }) + ]; + showSelectMenu(e4.target.getBoundingClientRect(), { + multi: false, + editable: true, + searchable: false, + saveOptions: (_9, v3) => props2.saveValue(v3[0]), + value: [], + options: formats, + showAll: true, + placeholder: i18n_default.labels.selectDateFormat + }); }; - for (let i4 = 0; i4 < table._features.length; i4++) { - const feature = table._features[i4]; - Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table)); - } - return row; + return props2.fieldType.startsWith("date") ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectDateFormat(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.dateFormat), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : props2.fieldType.startsWith("context") ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectContext(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyContext), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : props2.fieldType == "fileprop" ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectFileProp(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyFileProp), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); }; -function getCoreRowModel() { - return (table) => memo(() => [table.options.data], (data) => { - const rowModel = { - rows: [], - flatRows: [], - rowsById: {} +var PropertyMenuComponent = (props2) => { + var _a2; + const [field, setField] = h2(props2.field); + const selectedType = (_9, value) => { + const newField = { + ...field, + type: value[0], + value: getNewValueForType(field, value) }; - const accessRows = function(originalRows, depth, parent) { - if (depth === void 0) { - depth = 0; - } - const rows = []; - for (let i4 = 0; i4 < originalRows.length; i4++) { - const row = createRow(table, table._getRowId(originalRows[i4], i4, parent), originalRows[i4], i4, depth); - rowModel.flatRows.push(row); - rowModel.rowsById[row.id] = row; - rows.push(row); - if (table.options.getSubRows) { - var _row$originalSubRows; - row.originalSubRows = table.options.getSubRows(originalRows[i4], i4); - if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { - row.subRows = accessRows(row.originalSubRows, depth + 1, row); - } - } - } - return rows; + setField(newField); + props2.saveField(newField); + }; + const selectedValue = (value) => { + const newField = { ...field, value }; + setField(newField); + props2.saveField(newField); + }; + const selectedContext = (context) => { + const newField = { ...field, value: context }; + setField(newField); + props2.saveContext(newField, [context]); + }; + const toggleMulti = () => { + const newField = { + ...field, + type: field.type == fieldType.multiType ? fieldType.type : fieldType.multiType }; - rowModel.rows = accessRows(data); - return rowModel; - }, { - key: "getRowModel", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; - }, - onChange: () => { - table._autoResetPageIndex(); - } - }); -} -function getGroupedRowModel() { - return (table) => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { - if (!rowModel.rows.length || !grouping.length) { - return rowModel; + setField(newField); + props2.saveField(newField); + }; + const fieldType = (_a2 = fieldTypeForType(field.type)) != null ? _a2 : fieldTypes[0]; + const getNewValueForType = (f4, value) => { + if (value[0].startsWith("option")) { + return serializeMultiString(props2.options); } - const existingGrouping = grouping.filter((columnId) => table.getColumn(columnId)); - const groupedFlatRows = []; - const groupedRowsById = {}; - const groupUpRecursively = function(rows, depth, parentId) { - if (depth === void 0) { - depth = 0; - } - if (depth >= existingGrouping.length) { - return rows.map((row) => { - row.depth = depth; - groupedFlatRows.push(row); - groupedRowsById[row.id] = row; - if (row.subRows) { - row.subRows = groupUpRecursively(row.subRows, depth + 1); - } - return row; + return value[0] == fieldType.type || value[0] == fieldType.multiType ? f4.value : null; + }; + const selectType = (e4) => { + showSelectMenu(e4.target.getBoundingClientRect(), { + multi: false, + editable: false, + searchable: false, + saveOptions: selectedType, + value: [], + showAll: true, + options: fieldTypes.filter((f4) => !f4.restricted).map((f4, i4) => ({ + id: i4 + 1, + name: f4.label, + value: f4.type, + icon: "" + })) + }); + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectType(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyType), /* @__PURE__ */ Cn.createElement("span", null, fieldType.label)), fieldType.multi ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item" + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.multiple), /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: field.type == fieldType.multiType, + onChange: () => toggleMulti() + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-separator" + }), /* @__PURE__ */ Cn.createElement(PropertyValueComponent, { + plugin: props2.plugin, + table: field.table, + fields: props2.fields, + fieldType: fieldType.type, + value: field.value, + contextPath: props2.contextPath, + saveValue: selectedValue, + saveContext: selectedContext + })); +}; +var showPropertyMenu = (plugin, position, editable, options, field, fields, contextPath, saveField, saveContext, hide, deleteColumn, sortColumn, hidden) => { + const menu = new import_obsidian14.Menu(); + menu.setUseNativeMenu(false); + if (editable) { + menu.addItem((menuItem) => { + var _a2; + inputMenuItem( + menuItem, + (_a2 = field == null ? void 0 : field.name) != null ? _a2 : "", + (value) => saveField({ ...field, name: value }) + ); + menuItem.setIcon("type"); + }); + menu.addSeparator(); + const frag = document.createDocumentFragment(); + const div = frag.createDiv(); + div.addEventListener("click", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("keydown", (e4) => { + }); + const root = createRoot(div); + root.render( + /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(PropertyMenuComponent, { + plugin, + field, + fields, + contextPath, + options, + saveField, + saveContext + })) + ); + menu.addItem((menuItem) => { + menuItem.setTitle(frag); + menuItem.dom.toggleClass("mk-properties", true); + }); + menu.addSeparator(); + if (!hidden) { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.hideProperty); + menuItem.onClick(() => { + hide(field, true); }); - } - const columnId = existingGrouping[depth]; - const rowGroupsMap = groupBy(rows, columnId); - const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { - let [groupingValue, groupedRows2] = _ref; - let id2 = `${columnId}:${groupingValue}`; - id2 = parentId ? `${parentId}>${id2}` : id2; - const subRows = groupUpRecursively(groupedRows2, depth + 1, id2); - const leafRows = depth ? flattenBy(groupedRows2, (row2) => row2.subRows) : groupedRows2; - const row = createRow(table, id2, leafRows[0].original, index, depth); - Object.assign(row, { - groupingColumnId: columnId, - groupingValue, - subRows, - leafRows, - getValue: (columnId2) => { - if (existingGrouping.includes(columnId2)) { - if (row._valuesCache.hasOwnProperty(columnId2)) { - return row._valuesCache[columnId2]; - } - if (groupedRows2[0]) { - var _groupedRows$0$getVal; - row._valuesCache[columnId2] = (_groupedRows$0$getVal = groupedRows2[0].getValue(columnId2)) != null ? _groupedRows$0$getVal : void 0; - } - return row._valuesCache[columnId2]; - } - if (row._groupingValuesCache.hasOwnProperty(columnId2)) { - return row._groupingValuesCache[columnId2]; - } - const column = table.getColumn(columnId2); - const aggregateFn = column == null ? void 0 : column.getAggregationFn(); - if (aggregateFn) { - row._groupingValuesCache[columnId2] = aggregateFn(columnId2, leafRows, groupedRows2); - return row._groupingValuesCache[columnId2]; - } - } + menuItem.setIcon("eye-off"); + }); + } else { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.unhideProperty); + menuItem.onClick(() => { + hide(field, false); + }); + menuItem.setIcon("eye"); + }); + } + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteProperty); + menuItem.onClick(() => { + deleteColumn(field); + }); + menuItem.setIcon("trash-2"); + }); + menu.addSeparator(); + } + const sortableString = normalizedSortForType(field.type, false); + if (sortableString) { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortAscending); + menuItem.setIcon("sort-asc"); + menuItem.onClick(() => { + sortColumn({ + field: field.name + field.table, + fn: normalizedSortForType(field.type, false) }); - subRows.forEach((subRow) => { - groupedFlatRows.push(subRow); - groupedRowsById[subRow.id] = subRow; + }); + }); + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortDescending); + menuItem.setIcon("sort-desc"); + menuItem.onClick(() => { + sortColumn({ + field: field.name + field.table, + fn: normalizedSortForType(field.type, true) }); - return row; }); - return aggregatedGroupedRows; - }; - const groupedRows = groupUpRecursively(rowModel.rows, 0, ""); - groupedRows.forEach((subRow) => { - groupedFlatRows.push(subRow); - groupedRowsById[subRow.id] = subRow; }); - return { - rows: groupedRows, - flatRows: groupedFlatRows, - rowsById: groupedRowsById - }; - }, { - key: "getGroupedRowModel", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; - }, - onChange: () => { - table._queue(() => { - table._autoResetExpanded(); - table._autoResetPageIndex(); + } + menu.showAtPosition(position); + return menu; +}; + +// src/components/ui/menus/newPropertyMenu.tsx +var NewPropertyMenuComponent = (props2) => { + const [fieldName, setFieldName] = h2(""); + const [fieldSource, setFieldSource] = h2( + props2.fileMetadata ? "fm" : "" + ); + const [fieldValue, setFieldValue] = h2(""); + const [fieldType, setFieldType] = h2("text"); + const options = F2(() => { + const options2 = []; + if (props2.fileMetadata) { + options2.push({ + name: i18n_default.menu.fileMetadata, + value: "fm", + description: i18n_default.menu.fileMetadataDescription }); } - }); -} -function groupBy(rows, columnId) { - const groupMap = /* @__PURE__ */ new Map(); - return rows.reduce((map, row) => { - const resKey = `${row.getValue(columnId)}`; - const previous = map.get(resKey); - if (!previous) { - map.set(resKey, [row]); - } else { - previous.push(row); - } - return map; - }, groupMap); -} -function getExpandedRowModel() { - return (table) => memo(() => [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; - } - if (!paginateExpandedRows) { - return rowModel; - } - return expandRows(rowModel); - }, { - key: "getExpandedRowModel", - debug: () => { - var _table$options$debugA; - return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; - } - }); -} -function expandRows(rowModel) { - const expandedRows = []; - const handleRow = (row) => { - var _row$subRows; - expandedRows.push(row); - if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { - row.subRows.forEach(handleRow); + if (props2.contextPath) { + options2.push({ + name: folderPathToString(props2.contextPath), + value: "", + description: `All notes in ${folderPathToString(props2.contextPath)}` + }); } + options2.push( + ...props2.tags.map((f4) => ({ + name: f4, + value: f4, + description: `All notes tagged ${f4}` + })) + ); + return options2; + }, []); + const selectedType = (_9, value) => { + setFieldType(value[0]); }; - rowModel.rows.forEach(handleRow); - return { - rows: expandedRows, - flatRows: rowModel.flatRows, - rowsById: rowModel.rowsById + const selectedValue = (value) => { + setFieldValue(value); }; -} - -// node_modules/@tanstack/react-table/build/lib/index.mjs -function flexRender(Comp, props2) { - return !Comp ? null : isReactComponent(Comp) ? /* @__PURE__ */ y(Comp, props2) : Comp; -} -function isReactComponent(component) { - return isClassComponent(component) || typeof component === "function" || isExoticComponent(component); -} -function isClassComponent(component) { - return typeof component === "function" && (() => { - const proto = Object.getPrototypeOf(component); - return proto.prototype && proto.prototype.isReactComponent; - })(); -} -function isExoticComponent(component) { - return typeof component === "object" && typeof component.$$typeof === "symbol" && ["react.memo", "react.forward_ref"].includes(component.$$typeof.description); -} -function useReactTable(options) { - const resolvedOptions = { - state: {}, - onStateChange: () => { - }, - renderFallbackValue: null, - ...options + const selectedSource = (_9, value) => { + setFieldSource(value[0]); }; - const [tableRef] = h2(() => ({ - current: createTable(resolvedOptions) - })); - const [state, setState] = h2(() => tableRef.current.initialState); - tableRef.current.setOptions((prev) => ({ - ...prev, - ...options, - state: { - ...state, - ...options.state + const toggleMulti = () => { + const field = fieldTypes.find( + (f4) => f4.type == fieldType || f4.multiType == fieldType + ); + setFieldType(field.type == fieldType ? field.multiType : field.type); + }; + const selectType = (e4) => { + showSelectMenu(e4.target.getBoundingClientRect(), { + multi: false, + editable: false, + searchable: false, + saveOptions: selectedType, + value: [], + showAll: true, + options: fieldTypes.filter((f4) => fieldSource == "fm" ? f4.metadata : !f4.restricted).map((f4, i4) => ({ + id: i4 + 1, + name: f4.label, + value: f4.type, + icon: "" + })) + }); + }; + const selectedContext = (value) => { + setFieldValue(value); + }; + const type = F2( + () => { + var _a2; + return (_a2 = fieldTypeForType(fieldType)) != null ? _a2 : fieldTypes[0]; }, - onStateChange: (updater) => { - setState(updater); - options.onStateChange == null ? void 0 : options.onStateChange(updater); - } - })); - return tableRef.current; -} - -// src/dispatch/mdb.ts -var import_lodash3 = __toESM(require_lodash()); -var import_obsidian13 = require("obsidian"); - -// src/utils/contexts/file.ts -var renameRowForFile = (folder, filePath, toFilePath) => { - return { - ...folder, - rows: folder.rows.map( - (f4) => f4.File == filePath ? { ...f4, File: toFilePath } : f4 - ) + [fieldType] + ); + const selectSource = (e4) => { + showSelectMenu(e4.target.getBoundingClientRect(), { + multi: false, + editable: false, + searchable: false, + saveOptions: selectedSource, + value: [], + showAll: true, + options + }); }; -}; -var removeRowForFile = (folder, filePath) => { - return { - ...folder, - rows: folder.rows.filter( - (f4) => f4.File != filePath - ) + const saveField = () => { + if (fieldName.length == 0) { + new import_obsidian15.Notice(i18n_default.notice.noPropertyName); + return; + } + props2.saveField(fieldSource, { + name: fieldName, + type: fieldType, + value: fieldValue, + schemaId: props2.schemaId + }); + props2.hide(); }; -}; -var removeRowsForFile = (folder, filePaths) => { - return { - ...folder, - rows: folder.rows.filter( - (f4) => !filePaths.includes(f4.File) - ) + const onKeyDown = (e4) => { + if (e4.key == "Enter") { + saveField(); + } }; + p2(() => { + setTimeout(() => { + input.current.focus(); + }, 50); + }, []); + const input = _2(null); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item" + }, /* @__PURE__ */ Cn.createElement("span", null, "Name"), /* @__PURE__ */ Cn.createElement("input", { + type: "text", + ref: input, + onKeyDown, + onChange: (e4) => setFieldName(e4.target.value), + onMouseDown: (e4) => e4.stopPropagation(), + value: fieldName + })), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-separator" + }), options.length > 1 && /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectSource(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, "Context"), /* @__PURE__ */ Cn.createElement("span", null, fieldSource == "fm" ? "File Metadata" : fieldSource == "" ? props2.contextPath : fieldSource)), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectType(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, "Type"), /* @__PURE__ */ Cn.createElement("span", null, type.label)), type.multi ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item" + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.multiple), /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: fieldType == type.multiType, + onChange: () => toggleMulti() + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-separator" + }), fieldSource != "fm" ? /* @__PURE__ */ Cn.createElement(PropertyValueComponent, { + plugin: props2.plugin, + table: fieldSource, + fields: props2.fields, + fieldType, + value: fieldValue, + contextPath: props2.contextPath, + saveValue: selectedValue, + saveContext: selectedContext + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-separator" + }), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => saveField() + }, /* @__PURE__ */ Cn.createElement("span", null, "Save Property")), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => props2.hide() + }, /* @__PURE__ */ Cn.createElement("span", null, "Cancel"))); }; - -// src/utils/contexts/links.ts -var valueContainsLink = (link, value) => { - return parseMultiString(value).some((f4) => link == parseLinkString(f4)); -}; -var replaceLinkInValue = (link, newLink, value) => { - return serializeMultiString(parseMultiString(value).map((f4) => parseLinkString(f4) == link ? newLink : link)); -}; -var removeLinkInValue = (link, value) => { - return serializeMultiString(parseMultiString(value).filter((f4) => f4 != link)); -}; -var linkColumns = (cols) => { - return cols.filter((f4) => f4.type.startsWith("link") || f4.type.startsWith("context")); -}; -var removeLinksInRow = (plugin, row, link, cols) => { - if (cols.length == 0) { - return row; - } - const deltaRow = cols.reduce((p3, c4) => { - if (valueContainsLink(link, row[c4.name])) { - const newValue = removeLinkInValue(link, row[c4.name]); - saveFrontmatterValue( - plugin, - row.File, - c4.name, - newValue, - c4.type, - plugin.settings.saveAllContextToFrontmatter - ); - return { ...p3, [c4.name]: newValue }; +var showNewPropertyMenu = (plugin, position, tags, fields, saveField, schemaId, contextPath, fileMetadata) => { + const menu = new import_obsidian15.Menu(); + menu.setUseNativeMenu(false); + const frag = document.createDocumentFragment(); + const div = frag.createDiv(); + div.addEventListener("click", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("keydown", (e4) => { + }); + const root = createRoot(div); + root.render( + /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(NewPropertyMenuComponent, { + plugin, + tags, + schemaId, + contextPath, + fields, + hide: () => menu.hide(), + saveField, + fileMetadata + })) + ); + menu.addItem((menuItem) => { + menuItem.setTitle(frag); + menuItem.dom.toggleClass("mk-properties", true); + }); + const keys = [...menu.scope.keys]; + for (let i4 = 0; i4 < keys.length; i4++) { + if (keys[i4].key != "Escape") { + menu.scope.unregister(keys[i4]); } - return p3; - }, {}); - return { ...row, ...deltaRow }; -}; -var renameLinksInRow = (plugin, row, link, newLink, cols) => { - if (cols.length == 0) { - return row; } - const deltaRow = cols.reduce((p3, c4) => { - if (valueContainsLink(link, row[c4.name])) { - const newValue = replaceLinkInValue(link, newLink, row[c4.name]); - saveFrontmatterValue( - plugin, - row.File, - c4.name, - newValue, - c4.type, - plugin.settings.saveAllContextToFrontmatter - ); - return { ...p3, [c4.name]: newValue }; - } - return p3; - }, {}); - return { ...row, ...deltaRow }; + menu.showAtPosition(position); + return menu; }; -// src/utils/metadata/dataview/parseDataview.ts -var parseDataview = (field, value) => { - const YAMLtype = detectYAMLType(value, field); - switch (YAMLtype) { - case "object": - return JSON.stringify(value); - break; - case "number": - return value.toString(); - break; - case "boolean": - return value ? "true" : "false"; - break; - case "date": - return format(new Date(value.ts), "yyyy-MM-dd"); - break; - case "duration": - return serializeMultiDisplayString(Object.keys(value.values).reduce( - (p3, c4) => [ - ...p3, - ...value.values[c4] > 0 ? [value.values[c4] + " " + c4] : [] - ], - [] - )); - break; - case "option-multi": - case "link-multi": - if (typeof value === "string") { - return value; - } - return serializeMultiString( - value.map((v3) => { - if (!v3) { - return ""; - } - if (typeof v3 === "string") { - return v3; - } - if (v3.path) { - return v3.path; - } - if (Array.isArray(value) && v3.length == 1 && Array.isArray(v3[0]) && v3[0].length == 1 && typeof v3[0][0] === "string") { - return v3[0][0]; - } - return JSON.stringify(v3); - }) - ); - break; - case "link": - { - if (Array.isArray(value) && value.length == 1 && Array.isArray(value[0]) && value[0].length == 1 && typeof value[0][0] === "string") { - return value[0][0]; - } else if (typeof value === "string") { - return value; - } - return value.path; +// src/components/ui/modals/imageModal.tsx +var import_obsidian16 = require("obsidian"); +var imageModal = class extends import_obsidian16.FuzzySuggestModal { + constructor(plugin, app2, selectImage) { + super(app2); + this.plugin = plugin; + this.selectImage = selectImage; + this.resultContainerEl.toggleClass("mk-image-modal", true); + this.inputEl.focus(); + this.inputEl.placeholder = "Select an image or paste a URL"; + this.emptyStateText = "No Images Found"; + this.limit = 30; + } + renderSuggestion(item, el) { + var oImg = el.createEl("img"); + const file = getAbstractFileAtPath(app, item.item); + oImg.setAttribute( + "src", + file ? app.vault.getResourcePath(file) : item.item + ); + oImg.setAttribute("height", "100px"); + oImg.setAttribute("width", "100px"); + el.appendChild(oImg); + } + getItemText(item) { + return item; + } + getSuggestions(query) { + let allImages = []; + if (query.match(urlRegex)) + allImages.push(query); + allImages.push( + ...getAllAbstractFilesInVault(this.plugin, app).filter( + (f4) => f4 instanceof import_obsidian16.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) + ).map((f4) => f4.path) + ); + return allImages.filter((f4) => f4.contains(query)).map((f4, i4) => ({ + item: f4, + match: { + score: i4, + matches: [] } - break; - case "text": - case "tag": - case "image": - return value; - break; + })); + } + getItems() { + let allImages = []; + allImages.push( + ...getAllAbstractFilesInVault(this.plugin, app).filter( + (f4) => f4 instanceof import_obsidian16.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) + ).map((f4) => f4.path) + ); + return allImages; + } + onChooseItem(item, evt) { + this.selectImage(item); } - return ""; }; -// src/dispatch/mdb.ts -var processContextFile = async (plugin, context, processor, fallback) => { - const dbFileExists = getAbstractFileAtPath(app, context.dbPath); - if (dbFileExists) { - const contextDB = await getMDBTable(plugin, context, "files"); - if (contextDB) { - await processor(contextDB, context); - return; - } else if (fallback) { - await fallback(); +// src/components/FileContextView/InlineFileContextView.tsx +var import_obsidian35 = require("obsidian"); + +// src/types/space.ts +var FMMetadataKeys = (plugin) => [plugin.settings.fmKeyBanner, plugin.settings.fmKeySticker, plugin.settings.fmKeyAlias, plugin.settings.fmKeyColor]; + +// src/utils/obsidian/obsidian.ts +var corePluginEnabled = (app2, plugin) => app2.internalPlugins.getPluginById(plugin) ? true : false; + +// node_modules/@dnd-kit/sortable/dist/sortable.esm.js +function arrayMove(array, from, to) { + const newArray = array.slice(); + newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]); + return newArray; +} +function getSortedRects(items, rects) { + return items.reduce((accumulator, id2, index) => { + const rect = rects.get(id2); + if (rect) { + accumulator[index] = rect; } - } else if (fallback) { - await fallback(); + return accumulator; + }, Array(items.length)); +} +function isValidIndex(index) { + return index !== null && index >= 0; +} +function itemsEqual(a5, b4) { + if (a5 === b4) { + return true; } + if (a5.length !== b4.length) { + return false; + } + for (let i4 = 0; i4 < a5.length; i4++) { + if (a5[i4] !== b4[i4]) { + return false; + } + } + return true; +} +function normalizeDisabled(disabled) { + if (typeof disabled === "boolean") { + return { + draggable: disabled, + droppable: disabled + }; + } + return disabled; +} +var defaultScale = { + scaleX: 1, + scaleY: 1 }; -var saveDB = async (plugin, context, newTable) => { - return saveMDBToPath(plugin, context, newTable); -}; -var insertColumns = (table, column) => { - if (table.cols.find((f4) => f4.name == column.name)) { - new import_obsidian13.Notice(i18n_default.notice.duplicatePropertyName); - return; +var horizontalListSortingStrategy = (_ref) => { + var _rects$activeIndex; + let { + rects, + activeNodeRect: fallbackActiveRect, + activeIndex, + overIndex, + index + } = _ref; + const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; + if (!activeNodeRect) { + return null; + } + const itemGap = getItemGap(rects, index, activeIndex); + if (index === activeIndex) { + const newIndexRect = rects[overIndex]; + if (!newIndexRect) { + return null; + } + return { + x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left, + y: 0, + ...defaultScale + }; + } + if (index > activeIndex && index <= overIndex) { + return { + x: -activeNodeRect.width - itemGap, + y: 0, + ...defaultScale + }; + } + if (index < activeIndex && index >= overIndex) { + return { + x: activeNodeRect.width + itemGap, + y: 0, + ...defaultScale + }; } return { - ...table, - cols: [...table.cols, column] + x: 0, + y: 0, + ...defaultScale }; }; -var updateValue = (folder, lookupField, lookupValue, field, value) => { +function getItemGap(rects, index, activeIndex) { + const currentRect = rects[index]; + const previousRect = rects[index - 1]; + const nextRect = rects[index + 1]; + if (!currentRect || !previousRect && !nextRect) { + return 0; + } + if (activeIndex < index) { + return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width); + } + return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width); +} +var rectSortingStrategy = (_ref) => { + let { + rects, + activeIndex, + overIndex, + index + } = _ref; + const newRects = arrayMove(rects, overIndex, activeIndex); + const oldRect = rects[index]; + const newRect = newRects[index]; + if (!newRect || !oldRect) { + return null; + } return { - ...folder, - rows: folder.rows.map( - (f4) => f4[lookupField] == lookupValue ? { - ...f4, - [field]: value - } : f4 - ) + x: newRect.left - oldRect.left, + y: newRect.top - oldRect.top, + scaleX: newRect.width / oldRect.width, + scaleY: newRect.height / oldRect.height }; }; -var insertRowsIfUnique = (folder, rows) => { - return { ...folder, rows: [...folder.rows, ...rows.filter((f4) => !folder.rows.some((g4) => g4.File == f4.File))] }; -}; -var saveContextToFrontmatter = (file, cols, context, plugin) => { - const afile = getAbstractFileAtPath(app, file); - if (afile && afile instanceof import_obsidian13.TFile) - saveContextToFile(afile, cols, context, plugin); -}; -var initiateContextIfNotExists = async (plugin, tag) => { - const context = tagContextFromTag(plugin, tag); - const tagFileExists = getAbstractFileAtPath(app, context.dbPath); - if (tagFileExists) - return false; - return createDefaultDB(plugin, context); +var defaultScale$1 = { + scaleX: 1, + scaleY: 1 }; -var updateContextValue = async (plugin, context, file, field, value) => { - let tagFileExists = abstractFileAtPathExists(app, context.dbPath); - if (!tagFileExists) { - tagFileExists = await createDefaultDB(plugin, context); +var verticalListSortingStrategy = (_ref) => { + var _rects$activeIndex; + let { + activeIndex, + activeNodeRect: fallbackActiveRect, + index, + rects, + overIndex + } = _ref; + const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; + if (!activeNodeRect) { + return null; } - if (tagFileExists) - await getMDBTable(plugin, context, "files").then( - (tagDB) => { - const newMDB = updateValue(tagDB, FilePropertyName, file, field, value); - return saveDB(plugin, context, newMDB).then((f4) => newMDB); - } - ); -}; -var insertContextColumn = async (plugin, context, field) => { - let tagFileExists = abstractFileAtPathExists(app, context.dbPath); - if (!tagFileExists) { - tagFileExists = await createDefaultDB(plugin, context); + if (index === activeIndex) { + const overIndexRect = rects[overIndex]; + if (!overIndexRect) { + return null; + } + return { + x: 0, + y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top, + ...defaultScale$1 + }; } - if (tagFileExists) - await getMDBTable(plugin, context, "files").then((tagDB) => { - const newDB = insertColumns(tagDB, field); - saveDB(plugin, context, newDB).then((f4) => newDB); - return newDB; - }).then((f4) => plugin.index.reloadContext(context)); -}; -var insertContextItems = async (plugin, newPaths, t4) => { - const saveNewContextRows = async (tag, context2) => { - const newRow = newPaths.map((newPath) => ({ File: newPath })); - await saveDB(plugin, context2, insertRowsIfUnique(tag, newRow)); - }; - const context = tagContextFromTag(plugin, t4); - let tagFileExists = abstractFileAtPathExists(app, context.dbPath); - if (!tagFileExists) { - tagFileExists = await createDefaultDB(plugin, context); + const itemGap = getItemGap$1(rects, index, activeIndex); + if (index > activeIndex && index <= overIndex) { + return { + x: 0, + y: -activeNodeRect.height - itemGap, + ...defaultScale$1 + }; } - if (tagFileExists) - await getMDBTable(plugin, context, "files").then( - (tagDB) => saveNewContextRows(tagDB, context) - ); + if (index < activeIndex && index >= overIndex) { + return { + x: 0, + y: activeNodeRect.height + itemGap, + ...defaultScale$1 + }; + } + return { + x: 0, + y: 0, + ...defaultScale$1 + }; }; -var fileToFM = (afile, cols, plugin) => { - let file = afile; - if (afile instanceof import_obsidian13.TFolder) { - file = getAbstractFileAtPath(app, folderNotePathFromAFile(plugin.settings, tFileToAFile(afile))); +function getItemGap$1(clientRects, index, activeIndex) { + const currentRect = clientRects[index]; + const previousRect = clientRects[index - 1]; + const nextRect = clientRects[index + 1]; + if (!currentRect) { + return 0; } - if (!file) - return []; - const fm = frontMatterForFile(file); - const fmKeys = frontMatterKeys(fm).filter((f4) => cols.some((g4) => f4 == g4)); - const rows = fmKeys.reduce( - (p3, c4) => ({ ...p3, [c4]: parseFrontMatter(c4, fm[c4]) }), - {} - ); - if (plugin.dataViewAPI()) { - return { ...rows, ...fileToDV(file, cols, plugin) }; + if (activeIndex < index) { + return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0; } - return rows; -}; -var fileToDV = (file, cols, plugin) => { - const dvValues = plugin.dataViewAPI().page(file.path); - const fmKeys = uniqCaseInsensitive( - Object.keys(dvValues != null ? dvValues : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 - ) ? true : false - ).filter((f4) => f4 != "file") - ).filter((f4) => cols.some((g4) => f4 == g4)); - return fmKeys.reduce( - (p3, c4) => ({ - ...p3, - [c4]: parseDataview(c4, dvValues[c4]) + return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0; +} +var ID_PREFIX2 = "Sortable"; +var Context = /* @__PURE__ */ Cn.createContext({ + activeIndex: -1, + containerId: ID_PREFIX2, + disableTransforms: false, + items: [], + overIndex: -1, + useDragOverlay: false, + sortedRects: [], + strategy: rectSortingStrategy, + disabled: { + draggable: false, + droppable: false + } +}); +function SortableContext(_ref) { + let { + children, + id: id2, + items: userDefinedItems, + strategy = rectSortingStrategy, + disabled: disabledProp = false + } = _ref; + const { + active, + dragOverlay, + droppableRects, + over, + measureDroppableContainers + } = useDndContext(); + const containerId = useUniqueId(ID_PREFIX2, id2); + const useDragOverlay = Boolean(dragOverlay.rect !== null); + const items = F2(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]); + const isDragging = active != null; + const activeIndex = active ? items.indexOf(active.id) : -1; + const overIndex = over ? items.indexOf(over.id) : -1; + const previousItemsRef = _2(items); + const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current); + const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged; + const disabled = normalizeDisabled(disabledProp); + useIsomorphicLayoutEffect(() => { + if (itemsHaveChanged && isDragging) { + measureDroppableContainers(items); + } + }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]); + p2(() => { + previousItemsRef.current = items; + }, [items]); + const contextValue = F2( + () => ({ + activeIndex, + containerId, + disabled, + disableTransforms, + items, + overIndex, + useDragOverlay, + sortedRects: getSortedRects(items, droppableRects), + strategy }), - {} + [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy] ); + return Cn.createElement(Context.Provider, { + value: contextValue + }, children); +} +var defaultNewIndexGetter = (_ref) => { + let { + id: id2, + items, + activeIndex, + overIndex + } = _ref; + return arrayMove(items, activeIndex, overIndex).indexOf(id2); }; -var onMetadataChange = async (plugin, file, contexts) => { - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const newDB = { - ...mdb, - rows: mdb.rows.map( - (f4) => f4.File == file.path ? { - ...f4, - ...fileToFM( - file, - mdb.cols.map((f5) => f5.name), - plugin - ) - } : f4 - ) - }; - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); - }); - return Promise.all(promises); -}; -var renameTagInContexts = async (plugin, oldTag, newTag, contexts) => { - const changeTagInContextMDB = (mdb) => { - const schema = parseContextDefString(mdb.schema.def).some((t4) => t4.type == "tag" && t4.value == oldTag) ? { ...mdb.schema, def: updateTagsForDefString(mdb.schema.def, tagsFromDefString(mdb.schema.def).map((t4) => t4 == oldTag ? newTag : t4)) } : mdb.schema; - const cols = mdb.cols.map((f4) => f4.type.startsWith("context") && f4.value == oldTag ? { ...f4, value: newTag } : f4); - return { ...mdb, schema, cols }; - }; - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const newDB = changeTagInContextMDB(mdb); - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); - }); - return Promise.all(promises); +var defaultAnimateLayoutChanges = (_ref2) => { + let { + containerId, + isSorting, + wasDragging, + index, + items, + newIndex, + previousItems, + previousContainerId, + transition + } = _ref2; + if (!transition || !wasDragging) { + return false; + } + if (previousItems !== items && index === newIndex) { + return false; + } + if (isSorting) { + return true; + } + return newIndex !== index && containerId === previousContainerId; }; -var removeTagInContexts = async (plugin, tag, contexts) => { - const deleteTagInContextMDB = (mdb) => { - const schema = parseContextDefString(mdb.schema.def).some((t4) => t4.type == "tag" && t4.value == tag) ? { ...mdb.schema, def: updateTagsForDefString(mdb.schema.def, tagsFromDefString(mdb.schema.def).filter((t4) => t4 != tag)) } : mdb.schema; - const cols = mdb.cols.map((f4) => f4.type.startsWith("context") && f4.value == tag ? { ...f4, type: "link-multi" } : f4); - return { ...mdb, schema, cols }; - }; - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const newDB = deleteTagInContextMDB(mdb); - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); - }); - return Promise.all(promises); +var defaultTransition2 = { + duration: 200, + easing: "ease" }; -var addFileInContexts = async (plugin, path, contexts) => { - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const newDB = insertRowsIfUnique(mdb, [{ File: path }]); - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); - }); - return Promise.all(promises); +var transitionProperty = "transform"; +var disabledTransition = /* @__PURE__ */ CSS.Transition.toString({ + property: transitionProperty, + duration: 0, + easing: "linear" +}); +var defaultAttributes = { + roleDescription: "sortable" }; -var renameLinkInContexts = async (plugin, oldPath, newPath, contexts) => { - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const linkCols = linkColumns(mdb.cols); - const newDB = { - ...mdb, - rows: mdb.rows.map((r3) => renameLinksInRow(plugin, r3, oldPath, newPath, linkCols)) - }; - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); +function useDerivedTransform(_ref) { + let { + disabled, + index, + node, + rect + } = _ref; + const [derivedTransform, setDerivedtransform] = h2(null); + const previousIndex = _2(index); + useIsomorphicLayoutEffect(() => { + if (!disabled && index !== previousIndex.current && node.current) { + const initial = rect.current; + if (initial) { + const current = getClientRect(node.current, { + ignoreTransform: true + }); + const delta = { + x: initial.left - current.left, + y: initial.top - current.top, + scaleX: initial.width / current.width, + scaleY: initial.height / current.height + }; + if (delta.x || delta.y) { + setDerivedtransform(delta); + } } - return newDB; - }); + } + if (index !== previousIndex.current) { + previousIndex.current = index; + } + }, [disabled, index, node, rect]); + p2(() => { + if (derivedTransform) { + setDerivedtransform(null); + } + }, [derivedTransform]); + return derivedTransform; +} +function useSortable(_ref) { + let { + animateLayoutChanges: animateLayoutChanges3 = defaultAnimateLayoutChanges, + attributes: userDefinedAttributes, + disabled: localDisabled, + data: customData, + getNewIndex = defaultNewIndexGetter, + id: id2, + strategy: localStrategy, + resizeObserverConfig, + transition = defaultTransition2 + } = _ref; + const { + items, + containerId, + activeIndex, + disabled: globalDisabled, + disableTransforms, + sortedRects, + overIndex, + useDragOverlay, + strategy: globalStrategy + } = q2(Context); + const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); + const index = items.indexOf(id2); + const data = F2(() => ({ + sortable: { + containerId, + index, + items + }, + ...customData + }), [containerId, customData, index, items]); + const itemsAfterCurrentSortable = F2(() => items.slice(items.indexOf(id2)), [items, id2]); + const { + rect, + node, + isOver, + setNodeRef: setDroppableNodeRef + } = useDroppable({ + id: id2, + data, + disabled: disabled.droppable, + resizeObserverConfig: { + updateMeasurementsFor: itemsAfterCurrentSortable, + ...resizeObserverConfig + } }); - return Promise.all(promises); -}; -var removeLinkInContexts = async (plugin, path, contexts) => { - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const linkCols = linkColumns(mdb.cols); - const newDB = { - ...mdb, - rows: mdb.rows.map((r3) => removeLinksInRow(plugin, r3, path, linkCols)) - }; - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); + const { + active, + activatorEvent, + activeNodeRect, + attributes, + setNodeRef: setDraggableNodeRef, + listeners, + isDragging, + over, + setActivatorNodeRef, + transform + } = useDraggable({ + id: id2, + data, + attributes: { + ...defaultAttributes, + ...userDefinedAttributes + }, + disabled: disabled.draggable }); - return Promise.all(promises); -}; -var renameFileInContexts = async (plugin, oldPath, newPath, contexts) => { - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const newDB = renameRowForFile(mdb, oldPath, newPath); - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); + const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef); + const isSorting = Boolean(active); + const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex); + const shouldDisplaceDragSource = !useDragOverlay && isDragging; + const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null; + const strategy = localStrategy != null ? localStrategy : globalStrategy; + const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({ + rects: sortedRects, + activeNodeRect, + activeIndex, + overIndex, + index + }) : null; + const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ + id: id2, + items, + activeIndex, + overIndex + }) : index; + const activeId = active == null ? void 0 : active.id; + const previous = _2({ + activeId, + items, + newIndex, + containerId }); - return Promise.all(promises); -}; -var removeFileInContexts = async (plugin, path, contexts) => { - const promises = contexts.map((context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - const removeRow = mdb.rows.find((f4) => f4.File == path); - if (removeRow) { - saveContextToFrontmatter(path, mdb.cols, removeRow, plugin); - } - const newDB = removeRowForFile(mdb, path); - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; - }); + const itemsHaveChanged = items !== previous.current.items; + const shouldAnimateLayoutChanges = animateLayoutChanges3({ + active, + containerId, + isDragging, + isSorting, + id: id2, + index, + items, + newIndex: previous.current.newIndex, + previousItems: previous.current.items, + previousContainerId: previous.current.containerId, + transition, + wasDragging: previous.current.activeId != null }); - return Promise.all(promises); -}; -var removeFilesInContext = async (plugin, paths, context) => { - return processContextFile(plugin, context, async (mdb, context2) => { - mdb.rows.forEach((row) => { - if (paths.includes(row.File)) - saveContextToFrontmatter(row.File, mdb.cols, row, plugin); - }); - const newDB = removeRowsForFile(mdb, paths); - if (!import_lodash3.default.isEqual(mdb, newDB)) { - await saveDB(plugin, context2, newDB); - } - return newDB; + const derivedTransform = useDerivedTransform({ + disabled: !shouldAnimateLayoutChanges, + index, + node, + rect }); -}; - -// src/components/ui/menus/menuItems.tsx -var import_obsidian14 = require("obsidian"); - -// src/components/ui/menus/selectMenu/SelectMenuComponent.tsx -var import_lodash4 = __toESM(require_lodash()); - -// src/components/ui/menus/selectMenu/SelectMenuInput.tsx -var SIZER_STYLES = { - position: "absolute", - width: 0, - height: 0, - visibility: "hidden", - overflow: "scroll", - whiteSpace: "pre" -}; -var STYLE_PROPS = [ - "fontSize", - "fontFamily", - "fontWeight", - "fontStyle", - "letterSpacing", - "textTransform" -]; -var SelectMenuInput = k3( - (props2, input) => { - const { classNames: classNames9, inputAttributes, inputEventHandlers, index } = props2; - const sizer = _2(null); - const [inputWidth, setInputWidth] = h2(null); - const [query, setQuery] = h2(""); - const [placeholderText, setPlaceholderText] = h2(""); - p2(() => { - copyInputStyles(); - updateInputWidth(); - setTimeout(() => { - input.current.focus(); - }, 50); - }, []); - p2(() => { - if (query !== props2.query || placeholderText !== props2.placeholderText) { - setQuery(props2.query); - setPlaceholderText(props2.placeholderText); - updateInputWidth(); - } - }, [props2.query, props2.placeholderText]); - const copyInputStyles = () => { - const inputStyle = window.getComputedStyle(input.current); - STYLE_PROPS.forEach((prop) => { - sizer.current.style[prop] = inputStyle[prop]; - }); - }; - const updateInputWidth = () => { - let _inputWidth; - _inputWidth = Math.ceil(sizer.current.scrollWidth) + 2; - if (_inputWidth !== inputWidth) { - setInputWidth(_inputWidth); - } - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: classNames9.searchWrapper - }, /* @__PURE__ */ Cn.createElement("input", { - ...inputAttributes, - ...inputEventHandlers, - ref: input, - value: query, - placeholder: placeholderText, - className: classNames9.searchInput, - role: "combobox", - style: { width: "100%" } - }), /* @__PURE__ */ Cn.createElement("div", { - ref: sizer, - style: SIZER_STYLES - }, query || placeholderText)); - } -); -var SelectMenuInput_default = SelectMenuInput; - -// src/components/ui/menus/selectMenu/SelectMenuPill.tsx -var SelectMenuPillComponent = (props2) => { - return /* @__PURE__ */ Cn.createElement("button", { - type: "button", - className: props2.classNames.selectedTag, - onClick: props2.onDelete - }, /* @__PURE__ */ Cn.createElement("span", { - className: props2.classNames.selectedTagName - }, props2.tag.name)); -}; -var SelectMenuPill_default = SelectMenuPillComponent; - -// src/components/ui/menus/selectMenu/SelectMenuSuggestions.tsx -function markIt(name, query) { - const regexp = matchAny(query); - return name.replace(regexp, "$&"); -} -var SelectMenuSuggestionsComponent = (props2) => { - const ref = _2(null); p2(() => { - var _a2; - if (props2.active) { - (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.scrollIntoViewIfNeeded(); + if (isSorting && previous.current.newIndex !== newIndex) { + previous.current.newIndex = newIndex; } - }, [props2.active]); - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-options-menu-inner" - }, props2.item.onToggle && /* @__PURE__ */ Cn.createElement("div", null, "Toggle"), /* @__PURE__ */ Cn.createElement("span", { - ref, - dangerouslySetInnerHTML: { - __html: markIt(props2.item.name, props2.query) + if (containerId !== previous.current.containerId) { + previous.current.containerId = containerId; } - }), props2.item.description && /* @__PURE__ */ Cn.createElement("span", { - className: "mk-description", - ref, - dangerouslySetInnerHTML: { - __html: markIt(props2.item.description, props2.query) + if (items !== previous.current.items) { + previous.current.items = items; } - })), props2.item.removeable && /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => { - e4.stopPropagation(); - e4.preventDefault(); - props2.onDeleteOption(props2.item.value); - }, - className: "mk-icon-small", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })); -}; -var SelectMenuSuggestions = (props2) => { - const timer = _2(null); - const mouseOver = (e4, index) => { - if (!props2.hoverSelect) { + }, [isSorting, newIndex, containerId, items]); + p2(() => { + if (activeId === previous.current.activeId) { return; } - timer.current && clearTimeout(timer.current); - timer.current = setTimeout(() => props2.setIndex(index), 300); + if (activeId && !previous.current.activeId) { + previous.current.activeId = activeId; + return; + } + const timeoutId = setTimeout(() => { + previous.current.activeId = activeId; + }, 50); + return () => clearTimeout(timeoutId); + }, [activeId]); + return { + active, + activeIndex, + attributes, + data, + rect, + index, + newIndex, + items, + isOver, + isSorting, + isDragging, + listeners, + node, + overIndex, + over, + setNodeRef, + setActivatorNodeRef, + setDroppableNodeRef, + setDraggableNodeRef, + transform: derivedTransform != null ? derivedTransform : finalTransform, + transition: getTransition() }; - const options = props2.options.map((item, index) => { - const key2 = `${props2.id}-${index}`; - const classNames9 = []; - if (props2.index === index) { - classNames9.push(props2.classNames.suggestionActive); + function getTransition() { + if (derivedTransform || itemsHaveChanged && previous.current.newIndex === index) { + return disabledTransition; } - if (item.disabled) { - classNames9.push(props2.classNames.suggestionDisabled); + if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) { + return void 0; } - return /* @__PURE__ */ Cn.createElement("li", { - id: key2, - key: key2, - role: "option", - className: classNames9.join(" "), - "aria-disabled": Boolean(item.disabled), - onMouseDown: (e4) => e4.preventDefault(), - onClick: () => props2.addTag(item), - onMouseOver: (e4) => mouseOver(e4, index), - onMouseOut: (e4) => props2.hoverSelect && clearTimeout(timer.current) - }, /* @__PURE__ */ Cn.createElement(SelectMenuSuggestionsComponent, { - item, - query: props2.query, - active: index == props2.index, - onDeleteOption: props2.deleteOption - })); - }); - return /* @__PURE__ */ Cn.createElement("div", { - className: props2.classNames.suggestions - }, /* @__PURE__ */ Cn.createElement("ul", { - role: "listbox", - id: props2.id - }, options, props2.query && props2.allowNew && /* @__PURE__ */ Cn.createElement("li", { - onMouseDown: (e4) => e4.preventDefault(), - onClick: () => props2.addTag({ name: props2.query, value: props2.query }) - }, "Add ", props2.query))); -}; -var SelectMenuSuggestions_default = SelectMenuSuggestions; - -// src/components/ui/menus/selectMenu/concerns/focusNextElement.js -function focusNextElement(scope, currentTarget) { - const interactiveEls = scope.querySelectorAll("a,button,input"); - const currentEl = Array.prototype.findIndex.call( - interactiveEls, - (element) => element === currentTarget - ); - const nextEl = interactiveEls[currentEl - 1] || interactiveEls[currentEl + 1]; - if (nextEl) { - nextEl.focus(); + if (isSorting || shouldAnimateLayoutChanges) { + return CSS.Transition.toString({ + ...transition, + property: transitionProperty + }); + } + return void 0; } } - -// src/components/ui/menus/selectMenu/SelectMenuComponent.tsx -var KEYS = { - ENTER: "Enter", - TAB: "Tab", - BACKSPACE: "Backspace", - UP_ARROW: "ArrowUp", - UP_ARROW_COMPAT: "Up", - DOWN_ARROW: "ArrowDown", - DOWN_ARROW_COMPAT: "Down" -}; -var CLASS_NAMES = { - root: "mk-options-menu", - rootFocused: "is-focused", - selected: "mk-options-menu__selected", - selectedTag: "mk-options-menu__selected-tag", - selectedTagName: "mk-options-menu__selected-tag-name", - search: "mk-options-menu__search", - searchWrapper: "mk-options-menu__search-wrapper", - searchInput: "mk-options-menu__search-input", - suggestions: "mk-options-menu__suggestions", - suggestionActive: "is-active", - suggestionDisabled: "is-disabled" -}; -var defaultProps = { - id: "SelectMenu", - tags: [], - suggestionsOnly: false, - placeholderText: i18n_default.labels.optionItemSelectPlaceholder, - noSuggestionsText: null, - newTagText: null, - suggestions: [], - suggestionsFilter: defaultSuggestionsFilter, - suggestionsTransform: null, - classNames: CLASS_NAMES, - delimiters: [KEYS.ENTER], - minQueryLength: 2, - maxSuggestionsLength: 8, - inputAttributes: {}, - hoverSelect: false -}; -var findMatchIndex = (options, query) => { - return options.findIndex((option) => matchExact(query).test(option.name)); -}; -var pressDelimiter = (props2, query, index, options, addTag2) => { - if (query.length >= props2.minQueryLength) { - const match2 = findMatchIndex(options, query); - const _index = index === -1 ? match2 : index; - const tag = _index > -1 ? options[_index] : null; - if (tag) { - addTag2(tag); - } else { - addTag2({ name: query, value: query }); +function normalizeLocalDisabled(localDisabled, globalDisabled) { + var _localDisabled$dragga, _localDisabled$droppa; + if (typeof localDisabled === "boolean") { + return { + draggable: localDisabled, + droppable: false + }; + } + return { + draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable, + droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable + }; +} +function hasSortableData(entry) { + if (!entry) { + return false; + } + const data = entry.data.current; + if (data && "sortable" in data && typeof data.sortable === "object" && "containerId" in data.sortable && "items" in data.sortable && "index" in data.sortable) { + return true; + } + return false; +} +var directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left]; +var sortableKeyboardCoordinates = (event, _ref) => { + let { + context: { + active, + collisionRect, + droppableRects, + droppableContainers, + over, + scrollableAncestors + } + } = _ref; + if (directions.includes(event.code)) { + event.preventDefault(); + if (!active || !collisionRect) { + return; + } + const filteredContainers = []; + droppableContainers.getEnabled().forEach((entry) => { + if (!entry || entry != null && entry.disabled) { + return; + } + const rect = droppableRects.get(entry.id); + if (!rect) { + return; + } + switch (event.code) { + case KeyboardCode.Down: + if (collisionRect.top < rect.top) { + filteredContainers.push(entry); + } + break; + case KeyboardCode.Up: + if (collisionRect.top > rect.top) { + filteredContainers.push(entry); + } + break; + case KeyboardCode.Left: + if (collisionRect.left > rect.left) { + filteredContainers.push(entry); + } + break; + case KeyboardCode.Right: + if (collisionRect.left < rect.left) { + filteredContainers.push(entry); + } + break; + } + }); + const collisions = closestCorners({ + active, + collisionRect, + droppableRects, + droppableContainers: filteredContainers, + pointerCoordinates: null + }); + let closestId = getFirstCollision(collisions, "id"); + if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { + closestId = collisions[1].id; + } + if (closestId != null) { + const activeDroppable = droppableContainers.get(active.id); + const newDroppable = droppableContainers.get(closestId); + const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null; + const newNode = newDroppable == null ? void 0 : newDroppable.node.current; + if (newNode && newRect && activeDroppable && newDroppable) { + const newScrollAncestors = getScrollableAncestors(newNode); + const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element); + const hasSameContainer = isSameContainer(activeDroppable, newDroppable); + const isAfterActive = isAfter2(activeDroppable, newDroppable); + const offset = hasDifferentScrollAncestors || !hasSameContainer ? { + x: 0, + y: 0 + } : { + x: isAfterActive ? collisionRect.width - newRect.width : 0, + y: isAfterActive ? collisionRect.height - newRect.height : 0 + }; + const rectCoordinates = { + x: newRect.left, + y: newRect.top + }; + const newCoordinates = offset.x && offset.y ? rectCoordinates : subtract(rectCoordinates, offset); + return newCoordinates; + } } } + return void 0; }; -function defaultSuggestionsFilter(item, query) { - const regexp = matchAny(query); - return regexp.test(item.name); +function isSameContainer(a5, b4) { + if (!hasSortableData(a5) || !hasSortableData(b4)) { + return false; + } + return a5.data.current.sortable.containerId === b4.data.current.sortable.containerId; } -function getOptions(props2, query) { - let options; - if (props2.suggestionsTransform) { - options = props2.suggestionsTransform(query, props2.suggestions); - } else { - options = props2.suggestions.filter( - (item) => props2.suggestionsFilter(item, query) - ); +function isAfter2(a5, b4) { + if (!hasSortableData(a5) || !hasSortableData(b4)) { + return false; } - options = options.slice(0, props2.maxSuggestionsLength); - if (props2.newTagText && findMatchIndex(options, query) === -1) { - options.push({ id: 0, name: query, value: query }); - } else if (props2.noSuggestionsText && options.length === 0) { - options.push({ - id: 0, - name: props2.noSuggestionsText, - value: "", - disabled: true - }); + if (!isSameContainer(a5, b4)) { + return false; } - return options; + return a5.data.current.sortable.index < b4.data.current.sortable.index; } -var SelectMenuComponent = Cn.forwardRef( - (_props, ref) => { - const props2 = { ...defaultProps, ..._props }; - const [options, setOptions] = h2([]); - const inputRef = _2(null); - const [query, setQuery] = h2(""); - const [focused, setFocused] = h2(false); - const [index, setIndex] = h2(0); - const onComposition = _2(false); - p2(() => { - if (ref) { - ref.current = () => { - var _a2; - if (!focused) { - (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.focus(); - setFocused(true); - return false; + +// node_modules/@tanstack/table-core/build/lib/index.mjs +function functionalUpdate(updater, input) { + return typeof updater === "function" ? updater(input) : updater; +} +function makeStateUpdater(key2, instance) { + return (updater) => { + instance.setState((old) => { + return { + ...old, + [key2]: functionalUpdate(updater, old[key2]) + }; + }); + }; +} +function isFunction(d5) { + return d5 instanceof Function; +} +function flattenBy(arr, getChildren) { + const flat = []; + const recurse = (subArr) => { + subArr.forEach((item) => { + flat.push(item); + const children = getChildren(item); + if (children != null && children.length) { + recurse(children); + } + }); + }; + recurse(arr); + return flat; +} +function memo(getDeps, fn2, opts) { + let deps = []; + let result; + return () => { + let depTime; + if (opts.key && opts.debug) + depTime = Date.now(); + const newDeps = getDeps(); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && opts.debug) + resultTime = Date.now(); + result = fn2(...newDeps); + opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result); + if (opts.key && opts.debug) { + if (opts != null && opts.debug()) { + 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 true; + 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); } - }, [focused]); - p2(() => { - var _a2; - if (index != -1 && props2.onHover && props2.hoverSelect) { - debounceFn((_a2 = options[index]) == null ? void 0 : _a2.value); - } - }, [index, options]); - const debounceFn = T2( - (0, import_lodash4.debounce)(handleDebounceFn, 300, { - leading: false - }), - [] - ); - function handleDebounceFn(inputValue) { - props2.onHover(inputValue); } - p2(() => { - if (query.length == 0 && props2.defaultSuggestions) { - setOptions(props2.defaultSuggestions); - return; - } - setOptions(getOptions(props2, query)); - }, [query, props2.suggestions]); - const container = _2(null); - const onInput = (e4) => { - if (e4.type === "compositionstart") { - onComposition.current = true; - return; - } - if (e4.type === "compositionend") { - onComposition.current = false; - } - if (onComposition.current) { - return; + return result; + }; +} +function createColumn(table, columnDef, depth, parent) { + var _ref, _resolvedColumnDef$id; + const defaultColumn = table._getDefaultColumnDef(); + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef + }; + const accessorKey = resolvedColumnDef.accessorKey; + let id2 = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace(".", "_") : void 0) != null ? _ref : typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header : void 0; + let accessorFn; + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn; + } else if (accessorKey) { + if (accessorKey.includes(".")) { + accessorFn = (originalRow) => { + let result = originalRow; + for (const key2 of accessorKey.split(".")) { + var _result; + result = (_result = result) == null ? void 0 : _result[key2]; + if (result === void 0) { + console.warn(`"${key2}" in deeply nested key "${accessorKey}" returned undefined.`); + } + } + return result; + }; + } else { + accessorFn = (originalRow) => originalRow[resolvedColumnDef.accessorKey]; + } + } + if (!id2) { + if (true) { + throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + } + throw new Error(); + } + let column = { + id: `${String(id2)}`, + accessorFn, + parent, + depth, + columnDef: resolvedColumnDef, + columns: [], + getFlatColumns: memo(() => [true], () => { + var _column$columns; + return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d5) => d5.getFlatColumns())]; + }, { + key: false, + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns; } - const _query = e4.target.value; - if (props2.onInput) { - props2.onInput(_query); + }), + getLeafColumns: memo(() => [table._getOrderColumnsFn()], (orderColumns2) => { + var _column$columns2; + if ((_column$columns2 = column.columns) != null && _column$columns2.length) { + let leafColumns = column.columns.flatMap((column2) => column2.getLeafColumns()); + return orderColumns2(leafColumns); } - if (_query.length === query.length + 1 && props2.delimiters.indexOf(query.slice(-1)) > -1) { - pressDelimiter(props2, query, index, options, addTag2); - } else if (_query !== query) { - setQuery(_query); + return [column]; + }, { + key: false, + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns; } - }; - const onKeyDown = (e4) => { - if (props2.delimiters.indexOf(e4.key) > -1) { - if (query || index > -1) { - e4.preventDefault(); + }) + }; + column = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table)); + }, column); + return column; +} +function createHeader(table, column, options) { + var _options$id; + const id2 = (_options$id = options.id) != null ? _options$id : column.id; + let header = { + id: id2, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null, + getLeafHeaders: () => { + const leafHeaders = []; + const recurseHeader = (h5) => { + if (h5.subHeaders && h5.subHeaders.length) { + h5.subHeaders.map(recurseHeader); } - pressDelimiter(props2, query, index, options, addTag2); + leafHeaders.push(h5); + }; + recurseHeader(header); + return leafHeaders; + }, + getContext: () => ({ + table, + header, + column + }) + }; + table._features.forEach((feature) => { + Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table)); + }); + return header; +} +var Headers = { + createTable: (table) => { + return { + getHeaderGroups: memo(() => [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((d5) => d5.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d5) => d5.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const centerColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + return headerGroups; + }, { + key: "getHeaderGroups", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders; + } + }), + getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + return buildHeaderGroups(allColumns, leafColumns, table, "center"); + }, { + key: "getCenterHeaderGroups", + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders; + } + }), + getLeftHeaderGroups: memo(() => [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((d5) => d5.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left"); + }, { + key: "getLeftHeaderGroups", + debug: () => { + var _table$options$debugA3; + return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders; + } + }), + getRightHeaderGroups: memo(() => [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((d5) => d5.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right"); + }, { + key: "getRightHeaderGroups", + debug: () => { + var _table$options$debugA4; + return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders; + } + }), + getFooterGroups: memo(() => [table.getHeaderGroups()], (headerGroups) => { + return [...headerGroups].reverse(); + }, { + key: "getFooterGroups", + debug: () => { + var _table$options$debugA5; + return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders; + } + }), + getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], (headerGroups) => { + return [...headerGroups].reverse(); + }, { + key: "getLeftFooterGroups", + debug: () => { + var _table$options$debugA6; + return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders; + } + }), + getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], (headerGroups) => { + return [...headerGroups].reverse(); + }, { + key: "getCenterFooterGroups", + debug: () => { + var _table$options$debugA7; + return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders; + } + }), + getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], (headerGroups) => { + return [...headerGroups].reverse(); + }, { + key: "getRightFooterGroups", + debug: () => { + var _table$options$debugA8; + return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders; + } + }), + getFlatHeaders: memo(() => [table.getHeaderGroups()], (headerGroups) => { + return headerGroups.map((headerGroup) => { + return headerGroup.headers; + }).flat(); + }, { + key: "getFlatHeaders", + debug: () => { + var _table$options$debugA9; + return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders; + } + }), + getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], (left) => { + return left.map((headerGroup) => { + return headerGroup.headers; + }).flat(); + }, { + key: "getLeftFlatHeaders", + debug: () => { + var _table$options$debugA10; + return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders; + } + }), + getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], (left) => { + return left.map((headerGroup) => { + return headerGroup.headers; + }).flat(); + }, { + key: "getCenterFlatHeaders", + debug: () => { + var _table$options$debugA11; + return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders; + } + }), + getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], (left) => { + return left.map((headerGroup) => { + return headerGroup.headers; + }).flat(); + }, { + key: "getRightFlatHeaders", + debug: () => { + var _table$options$debugA12; + return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders; + } + }), + getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], (flatHeaders) => { + return flatHeaders.filter((header) => { + var _header$subHeaders; + return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); + }); + }, { + key: "getCenterLeafHeaders", + debug: () => { + var _table$options$debugA13; + return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders; + } + }), + getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], (flatHeaders) => { + return flatHeaders.filter((header) => { + var _header$subHeaders2; + return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); + }); + }, { + key: "getLeftLeafHeaders", + debug: () => { + var _table$options$debugA14; + return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders; + } + }), + getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], (flatHeaders) => { + return flatHeaders.filter((header) => { + var _header$subHeaders3; + return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); + }); + }, { + key: "getRightLeafHeaders", + debug: () => { + var _table$options$debugA15; + return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders; + } + }), + getLeafHeaders: memo(() => [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(); + }, { + key: "getLeafHeaders", + debug: () => { + var _table$options$debugA16; + return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders; + } + }) + }; + } +}; +function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { + var _headerGroups$0$heade, _headerGroups$; + let maxDepth = 0; + const findMaxDepth = function(columns, depth) { + if (depth === void 0) { + depth = 1; + } + maxDepth = Math.max(maxDepth, depth); + columns.filter((column) => column.getIsVisible()).forEach((column) => { + var _column$columns; + if ((_column$columns = column.columns) != null && _column$columns.length) { + findMaxDepth(column.columns, depth + 1); } - if (e4.key === KEYS.BACKSPACE) { - pressBackspaceKey(); + }, 0); + }; + findMaxDepth(allColumns); + let headerGroups = []; + const createHeaderGroup = (headersToGroup, depth) => { + const headerGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join("_"), + headers: [] + }; + const pendingParentHeaders = []; + headersToGroup.forEach((headerToGroup) => { + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; + let column; + let isPlaceholder = false; + if (isLeafHeader && headerToGroup.column.parent) { + column = headerToGroup.column.parent; + } else { + column = headerToGroup.column; + isPlaceholder = true; } - if (e4.key === KEYS.UP_ARROW || e4.key === KEYS.UP_ARROW_COMPAT) { - pressUpKey(e4); + if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { + latestPendingParentHeader.subHeaders.push(headerToGroup); + } else { + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join("_"), + isPlaceholder, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d5) => d5.column === column).length}` : void 0, + depth, + index: pendingParentHeaders.length + }); + header.subHeaders.push(headerToGroup); + pendingParentHeaders.push(header); } - if (e4.key === KEYS.DOWN_ARROW || e4.key === KEYS.DOWN_ARROW_COMPAT) { - pressDownKey(e4); + headerGroup.headers.push(headerToGroup); + headerToGroup.headerGroup = headerGroup; + }); + headerGroups.push(headerGroup); + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1); + } + }; + const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { + depth: maxDepth, + index + })); + createHeaderGroup(bottomHeaders, maxDepth - 1); + headerGroups.reverse(); + const recurseHeadersForSpans = (headers) => { + const filteredHeaders = headers.filter((header) => header.column.getIsVisible()); + return filteredHeaders.map((header) => { + let colSpan = 0; + let rowSpan = 0; + let childRowSpans = [0]; + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = []; + recurseHeadersForSpans(header.subHeaders).forEach((_ref) => { + let { + colSpan: childColSpan, + rowSpan: childRowSpan + } = _ref; + colSpan += childColSpan; + childRowSpans.push(childRowSpan); + }); + } else { + colSpan = 1; } + const minChildRowSpan = Math.min(...childRowSpans); + rowSpan = rowSpan + minChildRowSpan; + header.colSpan = colSpan; + header.rowSpan = rowSpan; + return { + colSpan, + rowSpan + }; + }); + }; + recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); + return headerGroups; +} +var defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER +}; +var getDefaultColumnSizingInfoState = () => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [] +}); +var ColumnSizing = { + getDefaultColumnDef: () => { + return defaultColumnSizing; + }, + getInitialState: (state) => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state }; - const onBlur = () => { - setFocused(false); - if (props2.onBlur) { - props2.onBlur(); - } + }, + getDefaultOptions: (table) => { + return { + columnResizeMode: "onEnd", + onColumnSizingChange: makeStateUpdater("columnSizing", table), + onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table) }; - const onFocus = () => { - setFocused(true); - if (props2.onFocus) { - props2.onFocus(); + }, + createColumn: (column, table) => { + return { + getSize: () => { + var _column$columnDef$min, _ref, _column$columnDef$max; + const columnSize = table.getState().columnSizing[column.id]; + return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); + }, + getStart: (position) => { + const columns = !position ? table.getVisibleLeafColumns() : position === "left" ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); + const index = columns.findIndex((d5) => d5.id === column.id); + if (index > 0) { + const prevSiblingColumn = columns[index - 1]; + return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize(); + } + return 0; + }, + resetSize: () => { + table.setColumnSizing((_ref2) => { + let { + [column.id]: _9, + ...rest + } = _ref2; + return rest; + }); + }, + getCanResize: () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + }, + getIsResizing: () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id; } }; - const onDeleteTag = (index2, event) => { - if (container.current) { - focusNextElement(container.current, event.currentTarget); + }, + createHeader: (header, table) => { + return { + getSize: () => { + let sum2 = 0; + const recurse = (header2) => { + if (header2.subHeaders.length) { + header2.subHeaders.forEach(recurse); + } else { + var _header$column$getSiz; + sum2 += (_header$column$getSiz = header2.column.getSize()) != null ? _header$column$getSiz : 0; + } + }; + recurse(header); + return sum2; + }, + getStart: () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); + } + return 0; + }, + getResizeHandler: () => { + const column = table.getColumn(header.column.id); + const canResize = column == null ? void 0 : column.getCanResize(); + return (e4) => { + if (!column || !canResize) { + return; + } + e4.persist == null ? void 0 : e4.persist(); + if (isTouchStartEvent(e4)) { + if (e4.touches && e4.touches.length > 1) { + return; + } + } + const startSize = header.getSize(); + const columnSizingStart = header ? header.getLeafHeaders().map((d5) => [d5.column.id, d5.column.getSize()]) : [[column.id, column.getSize()]]; + const clientX = isTouchStartEvent(e4) ? Math.round(e4.touches[0].clientX) : e4.clientX; + const newColumnSizing = {}; + const updateOffset = (eventType, clientXPos) => { + if (typeof clientXPos !== "number") { + return; + } + table.setColumnSizingInfo((old) => { + var _old$startOffset, _old$startSize; + const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0); + const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); + old.columnSizingStart.forEach((_ref3) => { + let [columnId, headerSize] = _ref3; + newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + }); + return { + ...old, + deltaOffset, + deltaPercentage + }; + }); + if (table.options.columnResizeMode === "onChange" || eventType === "end") { + table.setColumnSizing((old) => ({ + ...old, + ...newColumnSizing + })); + } + }; + const onMove = (clientXPos) => updateOffset("move", clientXPos); + const onEnd = (clientXPos) => { + updateOffset("end", clientXPos); + table.setColumnSizingInfo((old) => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [] + })); + }; + const mouseEvents = { + moveHandler: (e5) => onMove(e5.clientX), + upHandler: (e5) => { + document.removeEventListener("mousemove", mouseEvents.moveHandler); + document.removeEventListener("mouseup", mouseEvents.upHandler); + onEnd(e5.clientX); + } + }; + const touchEvents = { + moveHandler: (e5) => { + if (e5.cancelable) { + e5.preventDefault(); + e5.stopPropagation(); + } + onMove(e5.touches[0].clientX); + return false; + }, + upHandler: (e5) => { + var _e$touches$; + document.removeEventListener("touchmove", touchEvents.moveHandler); + document.removeEventListener("touchend", touchEvents.upHandler); + if (e5.cancelable) { + e5.preventDefault(); + e5.stopPropagation(); + } + onEnd((_e$touches$ = e5.touches[0]) == null ? void 0 : _e$touches$.clientX); + } + }; + const passiveIfSupported = passiveEventSupported() ? { + passive: false + } : false; + if (isTouchStartEvent(e4)) { + document.addEventListener("touchmove", touchEvents.moveHandler, passiveIfSupported); + document.addEventListener("touchend", touchEvents.upHandler, passiveIfSupported); + } else { + document.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported); + document.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported); + } + table.setColumnSizingInfo((old) => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id + })); + }; } - deleteTag2(index2); }; - const addTag2 = (tag) => { - if (tag.disabled) { - return; - } - if (props2.onValidate && !props2.onValidate(tag)) { - return; + }, + createTable: (table) => { + return { + setColumnSizing: (updater) => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater), + setColumnSizingInfo: (updater) => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater), + resetColumnSizing: (defaultState) => { + var _table$initialState$c; + table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + }, + resetHeaderSizeInfo: (defaultState) => { + var _table$initialState$c2; + table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + }, + getTotalSize: () => { + var _table$getHeaderGroup, _table$getHeaderGroup2; + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum2, header) => { + return sum2 + header.getSize(); + }, 0)) != null ? _table$getHeaderGroup : 0; + }, + getLeftTotalSize: () => { + var _table$getLeftHeaderG, _table$getLeftHeaderG2; + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum2, header) => { + return sum2 + header.getSize(); + }, 0)) != null ? _table$getLeftHeaderG : 0; + }, + getCenterTotalSize: () => { + var _table$getCenterHeade, _table$getCenterHeade2; + return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum2, header) => { + return sum2 + header.getSize(); + }, 0)) != null ? _table$getCenterHeade : 0; + }, + getRightTotalSize: () => { + var _table$getRightHeader, _table$getRightHeader2; + return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum2, header) => { + return sum2 + header.getSize(); + }, 0)) != null ? _table$getRightHeader : 0; } - props2.onAddition(tag); - clearInput(); - }; - const deleteTag2 = (i4) => { - props2.onDelete(i4); - }; - const clearInput = () => { - setQuery(""); - setIndex(-1); - }; - const clearSelectedIndex = () => { - setIndex(-1); }; - const pressUpKey = (e4) => { - e4.preventDefault(); - const size = options.length - 1; - setIndex(index <= 0 ? size : index - 1); - }; - const pressDownKey = (e4) => { - e4.preventDefault(); - const size = options.length - 1; - setIndex((i4) => i4 >= size ? 0 : i4 + 1); - }; - function pressBackspaceKey() { - if (!query.length) { - deleteTag2(props2.tags.length - 1); + } +}; +var passiveSupported = null; +function passiveEventSupported() { + if (typeof passiveSupported === "boolean") + return passiveSupported; + let supported = false; + try { + const options = { + get passive() { + supported = true; + return false; } - } - const focusInput = () => { - inputRef.current.focus(); }; - const inputEventHandlers = { - onChange: onInput, - onBlur, - onFocus, - onInput: () => { - }, - onKeyDown, - onCompositionEnd: onInput, - onCompositionStart: onInput + const noop2 = () => { }; - const expanded = focused && query.length >= props2.minQueryLength; - const classNames9 = Object.assign({}, CLASS_NAMES, props2.classNames); - const rootClassNames = [classNames9.root]; - focused && rootClassNames.push(classNames9.rootFocused); - return /* @__PURE__ */ Cn.createElement("div", { - ref: container, - className: rootClassNames.join(" ") - }, !props2.suggestionsOnly ? /* @__PURE__ */ Cn.createElement("div", { - className: classNames9.selected, - "aria-relevant": "additions removals", - "aria-live": "polite" - }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.tags.map((tag, i4) => /* @__PURE__ */ Cn.createElement(SelectMenuPill_default, { - key: i4, - tag, - classNames: classNames9, - onDelete: (e4) => onDeleteTag(i4, e4) - }))), /* @__PURE__ */ Cn.createElement("div", { - className: classNames9.search - }, /* @__PURE__ */ Cn.createElement(SelectMenuInput_default, { - ref: inputRef, - query, - index, - id: props2.id, - classNames: classNames9, - inputAttributes: props2.inputAttributes, - inputEventHandlers, - expanded, - placeholderText: props2.placeholderText - }))) : null, options.length || props2.allowNew ? /* @__PURE__ */ Cn.createElement(SelectMenuSuggestions_default, { - options, - hoverSelect: props2.hoverSelect, - query, - setIndex, - index, - id: props2.id, - classNames: classNames9, - expanded, - addTag: addTag2, - allowNew: props2.allowNew, - deleteOption: props2.onDeleteOption - }) : null, props2.previewComponent); + window.addEventListener("test", noop2, options); + window.removeEventListener("test", noop2); + } catch (err) { + supported = false; } -); -SelectMenuComponent.displayName = "SelectMenuComponent"; -var SelectMenuComponent_default = SelectMenuComponent; - -// src/components/ui/menus/selectMenu.tsx -var SelectMenu = Cn.forwardRef( - (props2, ref) => { - var _a2; - const initialOptions = props2.options.map((o3, i4) => { - return { - ...o3, - id: i4 + 1 - }; - }); - p2(() => { - setSuggestions( - props2.options.map((o3, i4) => { - return { - ...o3, - id: i4 + 1 - }; - }) - ); - }, [props2.options]); - const [suggestions, setSuggestions] = h2(initialOptions); - const [tags, setTags] = h2( - props2.value.map( - (v3) => { - var _a3; - return (_a3 = initialOptions.find((f4) => f4.value == v3)) != null ? _a3 : { - id: 0, - name: v3, - value: v3 - }; - } - ) - ); - const onDelete = T2( - (tagIndex) => { - const newTags = tags.filter((_9, i4) => i4 !== tagIndex); - setTags(newTags); - props2.saveOptions( - suggestions.map((f4) => f4.value), - newTags.map((f4) => f4.value) - ); - }, - [suggestions, tags, props2] - ); - const onDeleteOption = T2( - (removeTag) => { - const newSuggestions = suggestions.filter((f4) => f4.value != removeTag); - const newTags = tags.filter((f4) => f4.value != removeTag); - setSuggestions(newSuggestions); - setTags(newTags); - if (props2.removeOption) - props2.removeOption(removeTag); - props2.hide(); - }, - [tags, suggestions, props2] - ); - const onAddition = T2( - (newTag) => { - let tag = newTag; - let newSuggestions = suggestions; - let newTags = tags; - if (!suggestions.find((s5) => s5.value == newTag.value)) { - tag = { - id: suggestions.length + 1, - name: newTag.name, - value: newTag.name - }; - newSuggestions = [...suggestions, tag]; - setSuggestions(newSuggestions); - } - if (props2.multi) { - if (!tags.find((t4) => t4.value == tag.value)) { - newTags = [...tags, tag]; - setTags(newTags); - } - } else { - newTags = [tag]; - setTags(newTags); + passiveSupported = supported; + return passiveSupported; +} +function isTouchStartEvent(e4) { + return e4.type === "touchstart"; +} +var Expanding = { + getInitialState: (state) => { + return { + expanded: {}, + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onExpandedChange: makeStateUpdater("expanded", table), + paginateExpandedRows: true + }; + }, + createTable: (table) => { + let registered = false; + let queued = false; + return { + _autoResetExpanded: () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; } - props2.saveOptions( - newSuggestions.map((f4) => f4.value), - newTags.map((f4) => f4.value) - ); - if (!props2.multi) { - props2.hide(); + 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; + table._queue(() => { + table.resetExpanded(); + queued = false; + }); } }, - [tags, suggestions] - ); - const onValidation = T2( - (newTag) => { - if (!props2.editable && !suggestions.find((s5) => s5.value == newTag.value)) { + setExpanded: (updater) => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater), + toggleAllRowsExpanded: (expanded) => { + if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { + table.setExpanded(true); + } else { + table.setExpanded({}); + } + }, + resetExpanded: (defaultState) => { + var _table$initialState$e, _table$initialState; + table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + }, + getCanSomeRowsExpand: () => { + return table.getRowModel().flatRows.some((row) => row.getCanExpand()); + }, + getToggleAllRowsExpandedHandler: () => { + return (e4) => { + e4.persist == null ? void 0 : e4.persist(); + table.toggleAllRowsExpanded(); + }; + }, + getIsSomeRowsExpanded: () => { + const expanded = table.getState().expanded; + return expanded === true || Object.values(expanded).some(Boolean); + }, + getIsAllRowsExpanded: () => { + const expanded = table.getState().expanded; + if (typeof expanded === "boolean") { + return expanded === true; + } + if (!Object.keys(expanded).length) { return false; } - if (newTag.name.length == 0) { + if (table.getRowModel().flatRows.some((row) => !row.getIsExpanded())) { return false; } return true; }, - [suggestions] - ); - return /* @__PURE__ */ Cn.createElement(SelectMenuComponent_default, { - tags: props2.multi ? tags : [], - suggestions, - ref, - onDelete, - onDeleteOption, - onAddition, - onValidate: onValidation, - defaultSuggestions: props2.defaultOptions, - placeholderText: (_a2 = props2.placeholder) != null ? _a2 : "", - minQueryLength: 0, - onHover: props2.onHover, - hoverSelect: props2.onHover ? true : false, - maxSuggestionsLength: props2.showAll ? Math.min(50, props2.options.length) : 8, - suggestionsOnly: !props2.searchable && !props2.editable, - allowNew: props2.editable, - previewComponent: props2.previewComponent - }); - } -); -SelectMenu.displayName = "SelectMenu"; -var selectMenu_default = SelectMenu; - -// src/components/ui/menus/menuItems.tsx -var inputMenuItem = (menuItem, value, setValue) => { - const frag = document.createDocumentFragment(); - const spanEl = frag.createEl("span"); - const inputEl = frag.createEl("input"); - inputEl.type = "text"; - inputEl.value = value; - inputEl.addEventListener("click", (e4) => { - e4.stopImmediatePropagation(); - }); - inputEl.addEventListener("mousedown", (e4) => { - e4.stopImmediatePropagation(); - }); - inputEl.addEventListener("mouseup", (e4) => { - e4.stopImmediatePropagation(); - }); - inputEl.addEventListener("blur", (e4) => { - setValue(inputEl.value); - }); - menuItem.dom.toggleClass("mk-menu-input", true); - menuItem.setTitle(frag); - return menuItem; -}; -var showSelectMenu = (point, optionProps) => { - const menu = new import_obsidian14.Menu(); - menu.dom.toggleClass("mk-menu", true); - menu.setUseNativeMenu(false); - const frag = document.createDocumentFragment(); - const div = frag.createDiv("mk-options-container"); - div.style.minHeight = Math.min( - 200, - (optionProps.options.length + (optionProps.searchable ? 1 : 0)) * 28 - ).toString() + "px"; - div.addEventListener("click", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("mousedown", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("mouseup", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("keydown", (e4) => { - }); - menu.onHide(() => optionProps.onHide && optionProps.onHide()); - const root = createRoot(div); - root.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(selectMenu_default, { - hide: () => { - menu.hide(); - optionProps.onHide && optionProps.onHide(); + getExpandedDepth: () => { + let maxDepth = 0; + const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + rowIds.forEach((id2) => { + const splitId = id2.split("."); + maxDepth = Math.max(maxDepth, splitId.length); + }); + return maxDepth; }, - ...optionProps - })) - ); - menu.addItem((item) => { - item.setTitle(frag); - }); - const keys = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys.length; i4++) { - if (keys[i4].key != "Escape") { - menu.scope.unregister(keys[i4]); - } - } - menu.showAtPosition(point); - return menu; -}; -var disclosureMenuItem = (menuItem, multi, editable, title, value, options, saveOptions) => { - const frag = document.createDocumentFragment(); - const div = frag.createDiv("title"); - div.textContent = title; - const div2 = frag.createDiv("disclosure"); - div2.textContent = value; - menuItem.setTitle(frag); - menuItem.onClick((ev) => { - var _a2; - ev.stopPropagation(); - const offset = menuItem.dom.getBoundingClientRect(); - showSelectMenu( - { x: offset.right + 10, y: offset.top }, - { - multi, - editable, - value: (_a2 = parseMultiString(value)) != null ? _a2 : [], - options, - saveOptions, - searchable: true, - showAll: true + getPreExpandedRowModel: () => table.getSortedRowModel(), + getExpandedRowModel: () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table); + } + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel(); + } + return table._getExpandedRowModel(); } - ); - }); - return menuItem; -}; - -// src/components/ContextView/DataTypeView/OptionCell.tsx -var import_lodash5 = __toESM(require_lodash()); -var OptionCell = (props2) => { - var _a2, _b2; - const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); - const initialOptions = [ - ...(_b2 = parseMultiString(props2.options).filter((f4) => f4).map((t4) => ({ name: t4, value: t4, removeable: true }))) != null ? _b2 : [], - ...initialValue.map((f4) => ({ name: f4, value: f4, removeable: true })) - ].filter(onlyUniqueProp("value")).filter((f4) => f4.value.length > 0); - const [options, setOptions] = h2(initialOptions); - const [value, setValue] = h2(initialValue); - p2(() => { - var _a3; - setValue( - (props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue]).filter((f4) => f4) - ); - }, [props2.initialValue]); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4 != v3); - setValue(newValues); - props2.saveOptions( - serializeMultiString(options.map((f4) => f4.value)), - serializeMultiString(newValues) - ); - }; - const removeOption = (option) => { - const newOptions = options.filter((f4) => f4.value != option); - const newValues = value.filter((f4) => f4 != option); - setOptions(newOptions); - setValue(newValues); - props2.saveOptions( - serializeMultiString(newOptions.map((f4) => f4.value)), - serializeMultiString(newValues) - ); - }; - const saveOptions = (_options, _value) => { - if (!props2.multi) { - setOptions( - _options.filter((f4) => f4.length > 0).map((t4) => ({ name: t4, value: t4, removeable: true })) - ); - setValue(_value); - props2.saveOptions( - serializeMultiString(_options.filter((f4) => f4.length > 0)), - serializeMultiString(_value) - ); - } else { - const newValues = (0, import_lodash5.uniq)([...value, _value[0]]); - setOptions( - _options.map((t4) => ({ name: t4, value: t4, removeable: true })) - ); - setValue(newValues); - props2.saveOptions( - serializeMultiString(_options.filter((f4) => f4.length > 0)), - serializeMultiString(newValues) - ); - } - }; - const menuProps = () => ({ - multi: false, - editable: true, - value, - options: !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options, - saveOptions, - removeOption, - placeholder: i18n_default.labels.optionItemSelectPlaceholder, - searchable: true, - showAll: true, - onHide: () => props2.setEditMode(null) - }); - return /* @__PURE__ */ Cn.createElement(OptionCellBase, { - baseClass: "mk-cell-option", - value, - menuProps, - multi: props2.multi, - editMode: props2.editMode, - removeValue - }); -}; -var OptionCellBase = (props2) => { - const { - value, - menuProps, - removeValue, - getLabelString, - openItem, - valueClass - } = props2; - const menuRef = _2(null); - p2(() => { - if (props2.editMode == 2) { - if (!menuRef.current) - showMenu(); - } - }, [props2.editMode]); - const ref = _2(null); - const showMenu = () => { - const offset = ref.current.getBoundingClientRect(); - menuRef.current = showSelectMenu( - { x: offset.left - 4, y: offset.bottom - 4 }, - menuProps() - ); - }; - const editable = props2.editMode > 0; - return /* @__PURE__ */ Cn.createElement("div", { - className: props2.baseClass, - ref - }, value.length > 0 ? value.map((o3) => /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option-item" - }, (getLabelString ? getLabelString(o3).length > 0 : o3.length > 0) ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: valueClass && valueClass(o3), - onClick: () => openItem && openItem(o3) - }, getLabelString ? getLabelString(o3) : o3), editable && props2.multi ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - onClick: () => removeValue(o3), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-close"] - } - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)) : /* @__PURE__ */ Cn.createElement("div", null, i18n_default.labels.select), editable && !props2.multi && value.length > 0 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => editable && !props2.multi && showMenu(), - className: "mk-cell-option-select mk-icon-xxsmall mk-icon-rotated", - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-collapse-sm"] - } - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))) : editable && !props2.multi ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option-item" - }, /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => !props2.multi && showMenu() - }, i18n_default.labels.select)) : props2.editMode == -1 ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option-item mk-cell-empty" - }, /* @__PURE__ */ Cn.createElement("div", null, i18n_default.menu.none)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), editable && props2.multi ? /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => editable && showMenu(), - className: "mk-cell-option-new mk-icon-small", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); -}; - -// src/components/ContextView/DataTypeView/ContextCell.tsx -var ContextCell = (props2) => { - var _a2, _b2, _c2; - const stringValueToLink = (strings) => strings.map((f4) => { - return { - label: parseLinkDisplayString(f4), - path: parseLinkString(f4) }; - }); - const initialValue = stringValueToLink( - props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue] - ); - const ref = _2(null); - const options = stringValueToLink( - (_c2 = (_b2 = props2.contextTable) == null ? void 0 : _b2.rows.map((f4) => f4[FilePropertyName])) != null ? _c2 : [] - ).map((f4) => ({ - name: f4.label, - value: f4.path - })); - const [value, setValue] = h2(initialValue); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4.path != v3.path); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues.map((f4) => f4.path))); - }; - p2(() => { - var _a3; - setValue( - stringValueToLink( - props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue] - ) - ); - }, [props2.initialValue]); - const saveOptions = (_options, _value) => { - insertContextItems(props2.plugin, _options, props2.contextTag); - if (!props2.multi) { - setValue( - _value.map((f4) => ({ - path: f4, - label: fileNameToString(folderPathToString(f4)) - })) - ); - props2.saveValue(serializeMultiString(_value)); - } else { - const newValue = _value[0]; - if (newValue) { - const newValues = uniq([...value.map((f4) => f4.path), newValue]); - setValue( - newValues.map((f4) => ({ - label: fileNameToString(folderPathToString(f4)), - path: f4 - })) - ); - props2.saveValue(serializeMultiString(newValues)); - } - } - }; - const openLink = async (o3) => { - const file = getAbstractFileAtPath(app, o3.path); - if (file) { - openAFile(file, props2.plugin, false); - } - }; - const menuProps = () => { - const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; + }, + createRow: (row, table) => { return { - multi: false, - editable: true, - value: value.map((f4) => f4.path), - options: _options, - saveOptions, - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true, - onHide: () => props2.setEditMode(null) - }; - }; - return /* @__PURE__ */ Cn.createElement(OptionCellBase, { - baseClass: "mk-cell-context", - menuProps, - openItem: openLink, - getLabelString: (o3) => o3.label, - value, - multi: props2.multi, - editMode: props2.editMode, - removeValue - }); -}; - -// src/components/ui/menus/datePickerMenu.tsx -var import_obsidian15 = require("obsidian"); - -// node_modules/react-day-picker/dist/index.esm.js -var __assign2 = function() { - __assign2 = Object.assign || function __assign3(t4) { - for (var s5, i4 = 1, n2 = arguments.length; i4 < n2; i4++) { - s5 = arguments[i4]; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3)) - t4[p3] = s5[p3]; - } - return t4; - }; - return __assign2.apply(this, arguments); -}; -function __rest2(s5, e4) { - var t4 = {}; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3) && e4.indexOf(p3) < 0) - t4[p3] = s5[p3]; - if (s5 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i4 = 0, p3 = Object.getOwnPropertySymbols(s5); i4 < p3.length; i4++) { - if (e4.indexOf(p3[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s5, p3[i4])) - t4[p3[i4]] = s5[p3[i4]]; - } - return t4; -} -function __spreadArray2(to, from, pack) { - if (pack || arguments.length === 2) - for (var i4 = 0, l3 = from.length, ar; i4 < l3; i4++) { - if (ar || !(i4 in from)) { - if (!ar) - ar = Array.prototype.slice.call(from, 0, i4); - ar[i4] = from[i4]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -function isDayPickerMultiple(props2) { - return props2.mode === "multiple"; -} -function isDayPickerRange(props2) { - return props2.mode === "range"; -} -function isDayPickerSingle(props2) { - return props2.mode === "single"; -} -var defaultClassNames = { - root: "rdp", - multiple_months: "rdp-multiple_months", - with_weeknumber: "rdp-with_weeknumber", - vhidden: "rdp-vhidden", - button_reset: "rdp-button_reset", - button: "rdp-button", - caption: "rdp-caption", - caption_start: "rdp-caption_start", - caption_end: "rdp-caption_end", - caption_between: "rdp-caption_between", - caption_label: "rdp-caption_label", - caption_dropdowns: "rdp-caption_dropdowns", - dropdown: "rdp-dropdown", - dropdown_month: "rdp-dropdown_month", - dropdown_year: "rdp-dropdown_year", - dropdown_icon: "rdp-dropdown_icon", - months: "rdp-months", - month: "rdp-month", - table: "rdp-table", - tbody: "rdp-tbody", - tfoot: "rdp-tfoot", - head: "rdp-head", - head_row: "rdp-head_row", - head_cell: "rdp-head_cell", - nav: "rdp-nav", - nav_button: "rdp-nav_button", - nav_button_previous: "rdp-nav_button_previous", - nav_button_next: "rdp-nav_button_next", - nav_icon: "rdp-nav_icon", - row: "rdp-row", - weeknumber: "rdp-weeknumber", - cell: "rdp-cell", - day: "rdp-day", - day_today: "rdp-day_today", - day_outside: "rdp-day_outside", - day_selected: "rdp-day_selected", - day_disabled: "rdp-day_disabled", - day_hidden: "rdp-day_hidden", - day_range_start: "rdp-day_range_start", - day_range_end: "rdp-day_range_end", - day_range_middle: "rdp-day_range_middle" + toggleExpanded: (expanded) => { + table.setExpanded((old) => { + var _expanded; + const exists = old === true ? true : !!(old != null && old[row.id]); + let oldExpanded = {}; + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach((rowId) => { + oldExpanded[rowId] = true; + }); + } else { + oldExpanded = old; + } + expanded = (_expanded = expanded) != null ? _expanded : !exists; + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true + }; + } + if (exists && !expanded) { + const { + [row.id]: _9, + ...rest + } = oldExpanded; + return rest; + } + return old; + }); + }, + getIsExpanded: () => { + var _table$options$getIsR; + const expanded = table.getState().expanded; + return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); + }, + getCanExpand: () => { + var _table$options$getRow, _table$options$enable, _row$subRows; + return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }, + getToggleExpandedHandler: () => { + const canExpand = row.getCanExpand(); + return () => { + if (!canExpand) + return; + row.toggleExpanded(); + }; + } + }; + } }; -function formatCaption(month, options) { - return format(month, "LLLL y", options); -} -function formatDay(day, options) { - return format(day, "d", options); -} -function formatMonthCaption(month, options) { - return format(month, "LLLL", options); -} -function formatWeekNumber(weekNumber) { - return "".concat(weekNumber); -} -function formatWeekdayName(weekday, options) { - return format(weekday, "cccccc", options).toUpperCase(); -} -function formatYearCaption(year, options) { - return format(year, "yyyy", options); -} -var formatters3 = /* @__PURE__ */ Object.freeze({ - __proto__: null, - formatCaption, - formatDay, - formatMonthCaption, - formatWeekNumber, - formatWeekdayName, - formatYearCaption -}); -var labelDay = function(day, activeModifiers, options) { - return format(day, "do MMMM (EEEE)", options); +var includesString = (row, columnId, filterValue) => { + var _row$getValue; + const search = filterValue.toLowerCase(); + return Boolean((_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search)); }; -var labelMonthDropdown = function() { - return "Month: "; +includesString.autoRemove = (val) => testFalsey(val); +var includesStringSensitive = (row, columnId, filterValue) => { + var _row$getValue2; + return Boolean((_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue)); }; -var labelNext = function() { - return "Go to next month"; +includesStringSensitive.autoRemove = (val) => testFalsey(val); +var equalsString = (row, columnId, filterValue) => { + var _row$getValue3; + return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase(); }; -var labelPrevious = function() { - return "Go to previous month"; +equalsString.autoRemove = (val) => testFalsey(val); +var arrIncludes = (row, columnId, filterValue) => { + var _row$getValue4; + return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); }; -var labelWeekday = function(day, options) { - return format(day, "cccc", options); +arrIncludes.autoRemove = (val) => testFalsey(val) || !(val != null && val.length); +var arrIncludesAll = (row, columnId, filterValue) => { + return !filterValue.some((val) => { + var _row$getValue5; + return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); + }); }; -var labelWeekNumber = function(n2) { - return "Week n. ".concat(n2); +arrIncludesAll.autoRemove = (val) => testFalsey(val) || !(val != null && val.length); +var arrIncludesSome = (row, columnId, filterValue) => { + return filterValue.some((val) => { + var _row$getValue6; + return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); + }); }; -var labelYearDropdown = function() { - return "Year: "; +arrIncludesSome.autoRemove = (val) => testFalsey(val) || !(val != null && val.length); +var equals = (row, columnId, filterValue) => { + return row.getValue(columnId) === filterValue; }; -var labels = /* @__PURE__ */ Object.freeze({ - __proto__: null, - labelDay, - labelMonthDropdown, - labelNext, - labelPrevious, - labelWeekNumber, - labelWeekday, - labelYearDropdown -}); -function getDefaultContextValues() { - var captionLayout = "buttons"; - var classNames9 = defaultClassNames; - var locale2 = en_US_default; - var modifiersClassNames = {}; - var modifiers = {}; - var numberOfMonths = 1; - var styles = {}; - var today = new Date(); - return { - captionLayout, - classNames: classNames9, - formatters: formatters3, - labels, - locale: locale2, - modifiersClassNames, - modifiers, - numberOfMonths, - styles, - today, - mode: "default" - }; -} -function parseFromToProps(props2) { - var fromYear = props2.fromYear, toYear = props2.toYear, fromMonth = props2.fromMonth, toMonth = props2.toMonth; - var fromDate = props2.fromDate, toDate2 = props2.toDate; - if (fromMonth) { - fromDate = startOfMonth(fromMonth); - } else if (fromYear) { - fromDate = new Date(fromYear, 0, 1); - } - if (toMonth) { - toDate2 = endOfMonth(toMonth); - } else if (toYear) { - toDate2 = new Date(toYear, 11, 31); - } - return { - fromDate: fromDate ? startOfDay(fromDate) : void 0, - toDate: toDate2 ? startOfDay(toDate2) : void 0 - }; -} -var DayPickerContext = F(void 0); -function DayPickerProvider(props2) { - var _a2; - var initialProps = props2.initialProps; - var defaultContextValues = getDefaultContextValues(); - var _b2 = parseFromToProps(initialProps), fromDate = _b2.fromDate, toDate2 = _b2.toDate; - var captionLayout = (_a2 = initialProps.captionLayout) !== null && _a2 !== void 0 ? _a2 : defaultContextValues.captionLayout; - if (captionLayout !== "buttons" && (!fromDate || !toDate2)) { - captionLayout = "buttons"; - } - var onSelect; - if (isDayPickerSingle(initialProps) || isDayPickerMultiple(initialProps) || isDayPickerRange(initialProps)) { - onSelect = initialProps.onSelect; - } - var value = __assign2(__assign2(__assign2({}, defaultContextValues), initialProps), { captionLayout, classNames: __assign2(__assign2({}, defaultContextValues.classNames), initialProps.classNames), components: __assign2({}, initialProps.components), formatters: __assign2(__assign2({}, defaultContextValues.formatters), initialProps.formatters), fromDate, labels: __assign2(__assign2({}, defaultContextValues.labels), initialProps.labels), mode: initialProps.mode || defaultContextValues.mode, modifiers: __assign2(__assign2({}, defaultContextValues.modifiers), initialProps.modifiers), modifiersClassNames: __assign2(__assign2({}, defaultContextValues.modifiersClassNames), initialProps.modifiersClassNames), onSelect, styles: __assign2(__assign2({}, defaultContextValues.styles), initialProps.styles), toDate: toDate2 }); - return Cn.createElement(DayPickerContext.Provider, { value }, props2.children); -} -function useDayPicker() { - var context = q2(DayPickerContext); - if (!context) { - throw new Error("useDayPicker must be used within a DayPickerProvider."); - } - return context; -} -function CaptionLabel(props2) { - var _a2 = useDayPicker(), locale2 = _a2.locale, classNames9 = _a2.classNames, styles = _a2.styles, formatCaption2 = _a2.formatters.formatCaption; - return Cn.createElement("div", { className: classNames9.caption_label, style: styles.caption_label, "aria-live": "polite", role: "presentation", id: props2.id }, formatCaption2(props2.displayMonth, { locale: locale2 })); -} -function IconDropdown(props2) { - return Cn.createElement( - "svg", - __assign2({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, props2), - Cn.createElement("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) - ); -} -function Dropdown(props2) { - var _a2, _b2; - var onChange = props2.onChange, value = props2.value, children = props2.children, caption = props2.caption, className = props2.className, style = props2.style; - var dayPicker = useDayPicker(); - var IconDropdownComponent = (_b2 = (_a2 = dayPicker.components) === null || _a2 === void 0 ? void 0 : _a2.IconDropdown) !== null && _b2 !== void 0 ? _b2 : IconDropdown; - return Cn.createElement( - "div", - { className, style }, - Cn.createElement("span", { className: dayPicker.classNames.vhidden }, props2["aria-label"]), - Cn.createElement("select", { name: props2.name, "aria-label": props2["aria-label"], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value, onChange }, children), - Cn.createElement( - "div", - { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true" }, - caption, - Cn.createElement(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon }) - ) - ); -} -function MonthsDropdown(props2) { - var _a2; - var _b2 = useDayPicker(), fromDate = _b2.fromDate, toDate2 = _b2.toDate, styles = _b2.styles, locale2 = _b2.locale, formatMonthCaption2 = _b2.formatters.formatMonthCaption, classNames9 = _b2.classNames, components = _b2.components, labelMonthDropdown2 = _b2.labels.labelMonthDropdown; - if (!fromDate) - return Cn.createElement(Cn.Fragment, null); - if (!toDate2) - return Cn.createElement(Cn.Fragment, null); - var dropdownMonths = []; - if (isSameYear(fromDate, toDate2)) { - var date = startOfMonth(fromDate); - for (var month = fromDate.getMonth(); month <= toDate2.getMonth(); month++) { - dropdownMonths.push(setMonth(date, month)); - } - } else { - var date = startOfMonth(new Date()); - for (var month = 0; month <= 11; month++) { - dropdownMonths.push(setMonth(date, month)); - } - } - var handleChange = function(e4) { - var selectedMonth = Number(e4.target.value); - var newMonth = setMonth(startOfMonth(props2.displayMonth), selectedMonth); - props2.onChange(newMonth); - }; - var DropdownComponent2 = (_a2 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a2 !== void 0 ? _a2 : Dropdown; - return Cn.createElement(DropdownComponent2, { name: "months", "aria-label": labelMonthDropdown2(), className: classNames9.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props2.displayMonth.getMonth(), caption: formatMonthCaption2(props2.displayMonth, { locale: locale2 }) }, dropdownMonths.map(function(m5) { - return Cn.createElement("option", { key: m5.getMonth(), value: m5.getMonth() }, formatMonthCaption2(m5, { locale: locale2 })); - })); -} -function YearsDropdown(props2) { - var _a2; - var displayMonth = props2.displayMonth; - var _b2 = useDayPicker(), fromDate = _b2.fromDate, toDate2 = _b2.toDate, locale2 = _b2.locale, styles = _b2.styles, classNames9 = _b2.classNames, components = _b2.components, formatYearCaption2 = _b2.formatters.formatYearCaption, labelYearDropdown2 = _b2.labels.labelYearDropdown; - var years = []; - if (!fromDate) - return Cn.createElement(Cn.Fragment, null); - if (!toDate2) - return Cn.createElement(Cn.Fragment, null); - var fromYear = fromDate.getFullYear(); - var toYear = toDate2.getFullYear(); - for (var year = fromYear; year <= toYear; year++) { - years.push(setYear(startOfYear(new Date()), year)); - } - var handleChange = function(e4) { - var newMonth = setYear(startOfMonth(displayMonth), Number(e4.target.value)); - props2.onChange(newMonth); - }; - var DropdownComponent2 = (_a2 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a2 !== void 0 ? _a2 : Dropdown; - return Cn.createElement(DropdownComponent2, { name: "years", "aria-label": labelYearDropdown2(), className: classNames9.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption2(displayMonth, { locale: locale2 }) }, years.map(function(year2) { - return Cn.createElement("option", { key: year2.getFullYear(), value: year2.getFullYear() }, formatYearCaption2(year2, { locale: locale2 })); - })); -} -function useControlledValue(defaultValue2, controlledValue) { - var _a2 = h2(defaultValue2), uncontrolledValue = _a2[0], setValue = _a2[1]; - var value = controlledValue === void 0 ? uncontrolledValue : controlledValue; - return [value, setValue]; -} -function getInitialMonth(context) { - var month = context.month, defaultMonth = context.defaultMonth, today = context.today; - var initialMonth = month || defaultMonth || today || new Date(); - var toDate2 = context.toDate, fromDate = context.fromDate, _a2 = context.numberOfMonths, numberOfMonths = _a2 === void 0 ? 1 : _a2; - if (toDate2 && differenceInCalendarMonths(toDate2, initialMonth) < 0) { - var offset = -1 * (numberOfMonths - 1); - initialMonth = addMonths(toDate2, offset); - } - if (fromDate && differenceInCalendarMonths(initialMonth, fromDate) < 0) { - initialMonth = fromDate; - } - return startOfMonth(initialMonth); -} -function useNavigationState() { - var context = useDayPicker(); - var initialMonth = getInitialMonth(context); - var _a2 = useControlledValue(initialMonth, context.month), month = _a2[0], setMonth2 = _a2[1]; - var goToMonth = function(date) { - var _a3; - if (context.disableNavigation) - return; - var month2 = startOfMonth(date); - setMonth2(month2); - (_a3 = context.onMonthChange) === null || _a3 === void 0 ? void 0 : _a3.call(context, month2); - }; - return [month, goToMonth]; -} -function getDisplayMonths(month, _a2) { - var reverseMonths = _a2.reverseMonths, numberOfMonths = _a2.numberOfMonths; - var start = startOfMonth(month); - var end = startOfMonth(addMonths(start, numberOfMonths)); - var monthsDiff = differenceInCalendarMonths(end, start); - var months = []; - for (var i4 = 0; i4 < monthsDiff; i4++) { - var nextMonth = addMonths(start, i4); - months.push(nextMonth); - } - if (reverseMonths) - months = months.reverse(); - return months; -} -function getNextMonth(startingMonth, options) { - if (options.disableNavigation) { - return void 0; - } - var toDate2 = options.toDate, pagedNavigation = options.pagedNavigation, _a2 = options.numberOfMonths, numberOfMonths = _a2 === void 0 ? 1 : _a2; - var offset = pagedNavigation ? numberOfMonths : 1; - var month = startOfMonth(startingMonth); - if (!toDate2) { - return addMonths(month, offset); - } - var monthsDiff = differenceInCalendarMonths(toDate2, startingMonth); - if (monthsDiff < numberOfMonths) { - return void 0; - } - return addMonths(month, offset); -} -function getPreviousMonth(startingMonth, options) { - if (options.disableNavigation) { - return void 0; - } - var fromDate = options.fromDate, pagedNavigation = options.pagedNavigation, _a2 = options.numberOfMonths, numberOfMonths = _a2 === void 0 ? 1 : _a2; - var offset = pagedNavigation ? numberOfMonths : 1; - var month = startOfMonth(startingMonth); - if (!fromDate) { - return addMonths(month, -offset); - } - var monthsDiff = differenceInCalendarMonths(month, fromDate); - if (monthsDiff <= 0) { - return void 0; - } - return addMonths(month, -offset); -} -var NavigationContext = F(void 0); -function NavigationProvider(props2) { - var dayPicker = useDayPicker(); - var _a2 = useNavigationState(), currentMonth = _a2[0], goToMonth = _a2[1]; - var displayMonths = getDisplayMonths(currentMonth, dayPicker); - var nextMonth = getNextMonth(currentMonth, dayPicker); - var previousMonth = getPreviousMonth(currentMonth, dayPicker); - var isDateDisplayed = function(date) { - return displayMonths.some(function(displayMonth) { - return isSameMonth(date, displayMonth); - }); - }; - var goToDate = function(date, refDate) { - if (isDateDisplayed(date)) { - return; - } - if (refDate && isBefore(date, refDate)) { - goToMonth(addMonths(date, 1 + dayPicker.numberOfMonths * -1)); - } else { - goToMonth(date); - } - }; - var value = { - currentMonth, - displayMonths, - goToMonth, - goToDate, - previousMonth, - nextMonth, - isDateDisplayed - }; - return Cn.createElement(NavigationContext.Provider, { value }, props2.children); -} -function useNavigation() { - var context = q2(NavigationContext); - if (!context) { - throw new Error("useNavigation must be used within a NavigationProvider"); - } - return context; -} -function CaptionDropdowns(props2) { - var _a2; - var _b2 = useDayPicker(), classNames9 = _b2.classNames, styles = _b2.styles, components = _b2.components; - var goToMonth = useNavigation().goToMonth; - var handleMonthChange = function(newMonth) { - goToMonth(newMonth); - }; - var CaptionLabelComponent = (_a2 = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a2 !== void 0 ? _a2 : CaptionLabel; - var captionLabel = Cn.createElement(CaptionLabelComponent, { id: props2.id, displayMonth: props2.displayMonth }); - return Cn.createElement( - "div", - { className: classNames9.caption_dropdowns, style: styles.caption_dropdowns }, - Cn.createElement("div", { className: classNames9.vhidden }, captionLabel), - Cn.createElement(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props2.displayMonth }), - Cn.createElement(YearsDropdown, { onChange: handleMonthChange, displayMonth: props2.displayMonth }) - ); -} -function IconLeft(props2) { - return Cn.createElement( - "svg", - __assign2({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props2), - Cn.createElement("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) - ); -} -function IconRight(props2) { - return Cn.createElement( - "svg", - __assign2({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props2), - Cn.createElement("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) - ); -} -var Button = k3(function(props2, ref) { - var _a2 = useDayPicker(), classNames9 = _a2.classNames, styles = _a2.styles; - var classNamesArr = [classNames9.button_reset, classNames9.button]; - if (props2.className) { - classNamesArr.push(props2.className); - } - var className = classNamesArr.join(" "); - var style = __assign2(__assign2({}, styles.button_reset), styles.button); - if (props2.style) { - Object.assign(style, props2.style); - } - return Cn.createElement("button", __assign2({}, props2, { ref, type: "button", className, style })); -}); -function Navigation(props2) { - var _a2, _b2; - var _c2 = useDayPicker(), dir = _c2.dir, locale2 = _c2.locale, classNames9 = _c2.classNames, styles = _c2.styles, _d2 = _c2.labels, labelPrevious2 = _d2.labelPrevious, labelNext2 = _d2.labelNext, components = _c2.components; - if (!props2.nextMonth && !props2.previousMonth) { - return Cn.createElement(Cn.Fragment, null); - } - var previousLabel = labelPrevious2(props2.previousMonth, { locale: locale2 }); - var previousClassName = [ - classNames9.nav_button, - classNames9.nav_button_previous - ].join(" "); - var nextLabel = labelNext2(props2.nextMonth, { locale: locale2 }); - var nextClassName = [ - classNames9.nav_button, - classNames9.nav_button_next - ].join(" "); - var IconRightComponent = (_a2 = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a2 !== void 0 ? _a2 : IconRight; - var IconLeftComponent = (_b2 = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b2 !== void 0 ? _b2 : IconLeft; - return Cn.createElement( - "div", - { className: classNames9.nav, style: styles.nav }, - !props2.hidePrevious && Cn.createElement(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props2.previousMonth, onClick: props2.onPreviousClick }, dir === "rtl" ? Cn.createElement(IconRightComponent, { className: classNames9.nav_icon, style: styles.nav_icon }) : Cn.createElement(IconLeftComponent, { className: classNames9.nav_icon, style: styles.nav_icon })), - !props2.hideNext && Cn.createElement(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props2.nextMonth, onClick: props2.onNextClick }, dir === "rtl" ? Cn.createElement(IconLeftComponent, { className: classNames9.nav_icon, style: styles.nav_icon }) : Cn.createElement(IconRightComponent, { className: classNames9.nav_icon, style: styles.nav_icon })) - ); -} -function CaptionNavigation(props2) { - var _a2; - var _b2 = useDayPicker(), numberOfMonths = _b2.numberOfMonths, dir = _b2.dir; - var _c2 = useNavigation(), previousMonth = _c2.previousMonth, nextMonth = _c2.nextMonth, goToMonth = _c2.goToMonth, displayMonths = _c2.displayMonths; - var displayIndex = displayMonths.findIndex(function(month) { - return isSameMonth(props2.displayMonth, month); - }); - var isFirst = displayIndex === 0; - var isLast = displayIndex === displayMonths.length - 1; - if (dir === "rtl") { - _a2 = [isFirst, isLast], isLast = _a2[0], isFirst = _a2[1]; - } - var hideNext = numberOfMonths > 1 && (isFirst || !isLast); - var hidePrevious = numberOfMonths > 1 && (isLast || !isFirst); - var handlePreviousClick = function() { - if (!previousMonth) - return; - goToMonth(previousMonth); - }; - var handleNextClick = function() { - if (!nextMonth) - return; - goToMonth(nextMonth); - }; - return Cn.createElement(Navigation, { displayMonth: props2.displayMonth, hideNext, hidePrevious, nextMonth, previousMonth, onPreviousClick: handlePreviousClick, onNextClick: handleNextClick }); -} -function Caption(props2) { - var _a2; - var _b2 = useDayPicker(), classNames9 = _b2.classNames, disableNavigation = _b2.disableNavigation, styles = _b2.styles, captionLayout = _b2.captionLayout, components = _b2.components; - var CaptionLabelComponent = (_a2 = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a2 !== void 0 ? _a2 : CaptionLabel; - var caption; - if (disableNavigation) { - caption = Cn.createElement(CaptionLabelComponent, { id: props2.id, displayMonth: props2.displayMonth }); - } else if (captionLayout === "dropdown") { - caption = Cn.createElement(CaptionDropdowns, { displayMonth: props2.displayMonth, id: props2.id }); - } else if (captionLayout === "dropdown-buttons") { - caption = Cn.createElement( - Cn.Fragment, - null, - Cn.createElement(CaptionDropdowns, { displayMonth: props2.displayMonth, id: props2.id }), - Cn.createElement(CaptionNavigation, { displayMonth: props2.displayMonth, id: props2.id }) - ); - } else { - caption = Cn.createElement( - Cn.Fragment, - null, - Cn.createElement(CaptionLabelComponent, { id: props2.id, displayMonth: props2.displayMonth }), - Cn.createElement(CaptionNavigation, { displayMonth: props2.displayMonth, id: props2.id }) - ); - } - return Cn.createElement("div", { className: classNames9.caption, style: styles.caption }, caption); -} -function Footer(props2) { - var _a2 = useDayPicker(), footer = _a2.footer, styles = _a2.styles, tfoot = _a2.classNames.tfoot; - if (!footer) - return Cn.createElement(Cn.Fragment, null); - return Cn.createElement( - "tfoot", - { className: tfoot, style: styles.tfoot }, - Cn.createElement( - "tr", - null, - Cn.createElement("td", { colSpan: 8 }, footer) - ) - ); -} -function getWeekdays(locale2, weekStartsOn, ISOWeek) { - var start = ISOWeek ? startOfISOWeek(new Date()) : startOfWeek(new Date(), { locale: locale2, weekStartsOn }); - var days = []; - for (var i4 = 0; i4 < 7; i4++) { - var day = addDays(start, i4); - days.push(day); +equals.autoRemove = (val) => testFalsey(val); +var weakEquals = (row, columnId, filterValue) => { + return row.getValue(columnId) == filterValue; +}; +weakEquals.autoRemove = (val) => testFalsey(val); +var inNumberRange = (row, columnId, filterValue) => { + let [min3, max3] = filterValue; + const rowValue = row.getValue(columnId); + return rowValue >= min3 && rowValue <= max3; +}; +inNumberRange.resolveFilterValue = (val) => { + let [unsafeMin, unsafeMax] = val; + let parsedMin = typeof unsafeMin !== "number" ? parseFloat(unsafeMin) : unsafeMin; + let parsedMax = typeof unsafeMax !== "number" ? parseFloat(unsafeMax) : unsafeMax; + let min3 = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; + let max3 = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; + if (min3 > max3) { + const temp = min3; + min3 = max3; + max3 = temp; } - return days; -} -function HeadRow() { - var _a2 = useDayPicker(), classNames9 = _a2.classNames, styles = _a2.styles, showWeekNumber = _a2.showWeekNumber, locale2 = _a2.locale, weekStartsOn = _a2.weekStartsOn, ISOWeek = _a2.ISOWeek, formatWeekdayName2 = _a2.formatters.formatWeekdayName, labelWeekday2 = _a2.labels.labelWeekday; - var weekdays = getWeekdays(locale2, weekStartsOn, ISOWeek); - return Cn.createElement( - "tr", - { style: styles.head_row, className: classNames9.head_row }, - showWeekNumber && Cn.createElement("th", { scope: "col", style: styles.head_cell, className: classNames9.head_cell }), - weekdays.map(function(weekday, i4) { - return Cn.createElement("th", { key: i4, scope: "col", className: classNames9.head_cell, style: styles.head_cell, "aria-label": labelWeekday2(weekday, { locale: locale2 }) }, formatWeekdayName2(weekday, { locale: locale2 })); - }) - ); -} -function Head() { - var _a2; - var _b2 = useDayPicker(), classNames9 = _b2.classNames, styles = _b2.styles, components = _b2.components; - var HeadRowComponent = (_a2 = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a2 !== void 0 ? _a2 : HeadRow; - return Cn.createElement( - "thead", - { style: styles.head, className: classNames9.head }, - Cn.createElement(HeadRowComponent, null) - ); -} -function DayContent(props2) { - var _a2 = useDayPicker(), locale2 = _a2.locale, formatDay2 = _a2.formatters.formatDay; - return Cn.createElement(Cn.Fragment, null, formatDay2(props2.date, { locale: locale2 })); + return [min3, max3]; +}; +inNumberRange.autoRemove = (val) => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); +var filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange +}; +function testFalsey(val) { + return val === void 0 || val === null || val === ""; } -var SelectMultipleContext = F(void 0); -function SelectMultipleProvider(props2) { - if (!isDayPickerMultiple(props2.initialProps)) { - var emptyContextValue = { - selected: void 0, - modifiers: { - disabled: [] +var Filters = { + getDefaultColumnDef: () => { + return { + filterFn: "auto" + }; + }, + getInitialState: (state) => { + return { + columnFilters: [], + globalFilter: void 0, + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onColumnFiltersChange: makeStateUpdater("columnFilters", table), + onGlobalFilterChange: makeStateUpdater("globalFilter", table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100, + globalFilterFn: "auto", + getColumnCanGlobalFilter: (column) => { + var _table$getCoreRowMode, _table$getCoreRowMode2; + const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue(); + return typeof value === "string" || typeof value === "number"; + } + }; + }, + createColumn: (column, table) => { + return { + getAutoFilterFn: () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === "string") { + return filterFns.includesString; + } + if (typeof value === "number") { + return filterFns.inNumberRange; + } + if (typeof value === "boolean") { + return filterFns.equals; + } + if (value !== null && typeof value === "object") { + return filterFns.equals; + } + if (Array.isArray(value)) { + return filterFns.arrIncludes; + } + return filterFns.weakEquals; + }, + getFilterFn: () => { + var _table$options$filter, _table$options$filter2; + return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === "auto" ? column.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn]; + }, + getCanFilter: () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2; + return ((_column$columnDef$ena = column.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) && !!column.accessorFn; + }, + getCanGlobalFilter: () => { + var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol; + return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; + }, + getIsFiltered: () => column.getFilterIndex() > -1, + getFilterValue: () => { + var _table$getState$colum, _table$getState$colum2; + return (_table$getState$colum = table.getState().columnFilters) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum.find((d5) => d5.id === column.id)) == null ? void 0 : _table$getState$colum2.value; + }, + getFilterIndex: () => { + var _table$getState$colum3, _table$getState$colum4; + return (_table$getState$colum3 = (_table$getState$colum4 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum4.findIndex((d5) => d5.id === column.id)) != null ? _table$getState$colum3 : -1; + }, + setFilterValue: (value) => { + table.setColumnFilters((old) => { + const filterFn = column.getFilterFn(); + const previousfilter = old == null ? void 0 : old.find((d5) => d5.id === column.id); + const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : void 0); + if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { + var _old$filter; + return (_old$filter = old == null ? void 0 : old.filter((d5) => d5.id !== column.id)) != null ? _old$filter : []; + } + const newFilterObj = { + id: column.id, + value: newFilter + }; + if (previousfilter) { + var _old$map; + return (_old$map = old == null ? void 0 : old.map((d5) => { + if (d5.id === column.id) { + return newFilterObj; + } + return d5; + })) != null ? _old$map : []; + } + if (old != null && old.length) { + return [...old, newFilterObj]; + } + return [newFilterObj]; + }); + }, + _getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id), + getFacetedRowModel: () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return column._getFacetedRowModel(); + }, + _getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id), + getFacetedUniqueValues: () => { + if (!column._getFacetedUniqueValues) { + return /* @__PURE__ */ new Map(); + } + return column._getFacetedUniqueValues(); + }, + _getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id), + getFacetedMinMaxValues: () => { + if (!column._getFacetedMinMaxValues) { + return void 0; + } + return column._getFacetedMinMaxValues(); + } + }; + }, + createRow: (row, table) => { + return { + columnFilters: {}, + columnFiltersMeta: {} + }; + }, + createTable: (table) => { + return { + getGlobalAutoFilterFn: () => { + return filterFns.includesString; + }, + getGlobalFilterFn: () => { + var _table$options$filter3, _table$options$filter4; + const { + globalFilterFn + } = table.options; + return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === "auto" ? table.getGlobalAutoFilterFn() : (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn]; + }, + setColumnFilters: (updater) => { + const leafColumns = table.getAllLeafColumns(); + const updateFn = (old) => { + var _functionalUpdate; + return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter((filter) => { + const column = leafColumns.find((d5) => d5.id === filter.id); + if (column) { + const filterFn = column.getFilterFn(); + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false; + } + } + return true; + }); + }; + table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn); + }, + setGlobalFilter: (updater) => { + table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater); + }, + resetGlobalFilter: (defaultState) => { + table.setGlobalFilter(defaultState ? void 0 : table.initialState.globalFilter); + }, + resetColumnFilters: (defaultState) => { + var _table$initialState$c, _table$initialState; + table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + }, + getPreFilteredRowModel: () => table.getCoreRowModel(), + getFilteredRowModel: () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table); + } + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getFilteredRowModel(); + }, + _getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, "__global__"), + getGlobalFacetedRowModel: () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getGlobalFacetedRowModel(); + }, + _getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, "__global__"), + getGlobalFacetedUniqueValues: () => { + if (!table._getGlobalFacetedUniqueValues) { + return /* @__PURE__ */ new Map(); + } + return table._getGlobalFacetedUniqueValues(); + }, + _getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, "__global__"), + getGlobalFacetedMinMaxValues: () => { + if (!table._getGlobalFacetedMinMaxValues) { + return; + } + return table._getGlobalFacetedMinMaxValues(); } }; - return Cn.createElement(SelectMultipleContext.Provider, { value: emptyContextValue }, props2.children); } - return Cn.createElement(SelectMultipleProviderInternal, { initialProps: props2.initialProps, children: props2.children }); +}; +function shouldAutoRemoveFilter(filterFn, value, column) { + return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === "undefined" || typeof value === "string" && !value; } -function SelectMultipleProviderInternal(_a2) { - var initialProps = _a2.initialProps, children = _a2.children; - var selected = initialProps.selected, min3 = initialProps.min, max3 = initialProps.max; - var onDayClick = function(day, activeModifiers, e4) { - var _a3, _b2; - (_a3 = initialProps.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(initialProps, day, activeModifiers, e4); - var isMinSelected = Boolean(activeModifiers.selected && min3 && (selected === null || selected === void 0 ? void 0 : selected.length) === min3); - if (isMinSelected) { - return; +var sum = (columnId, _leafRows, childRows) => { + return childRows.reduce((sum2, next) => { + const nextValue = next.getValue(columnId); + return sum2 + (typeof nextValue === "number" ? nextValue : 0); + }, 0); +}; +var min2 = (columnId, _leafRows, childRows) => { + let min3; + childRows.forEach((row) => { + const value = row.getValue(columnId); + if (value != null && (min3 > value || min3 === void 0 && value >= value)) { + min3 = value; } - var isMaxSelected = Boolean(!activeModifiers.selected && max3 && (selected === null || selected === void 0 ? void 0 : selected.length) === max3); - if (isMaxSelected) { - return; + }); + return min3; +}; +var max2 = (columnId, _leafRows, childRows) => { + let max3; + childRows.forEach((row) => { + const value = row.getValue(columnId); + if (value != null && (max3 < value || max3 === void 0 && value >= value)) { + max3 = value; } - var selectedDays = selected ? __spreadArray2([], selected, true) : []; - if (activeModifiers.selected) { - var index = selectedDays.findIndex(function(selectedDay) { - return isSameDay(day, selectedDay); - }); - selectedDays.splice(index, 1); - } else { - selectedDays.push(day); + }); + return max3; +}; +var extent = (columnId, _leafRows, childRows) => { + let min3; + let max3; + childRows.forEach((row) => { + const value = row.getValue(columnId); + if (value != null) { + if (min3 === void 0) { + if (value >= value) + min3 = max3 = value; + } else { + if (min3 > value) + min3 = value; + if (max3 < value) + max3 = value; + } } - (_b2 = initialProps.onSelect) === null || _b2 === void 0 ? void 0 : _b2.call(initialProps, selectedDays, day, activeModifiers, e4); - }; - var modifiers = { - disabled: [] - }; - if (selected) { - modifiers.disabled.push(function(day) { - var isMaxSelected = max3 && selected.length > max3 - 1; - var isSelected = selected.some(function(selectedDay) { - return isSameDay(selectedDay, day); - }); - return Boolean(isMaxSelected && !isSelected); - }); - } - var contextValue = { - selected, - onDayClick, - modifiers - }; - return Cn.createElement(SelectMultipleContext.Provider, { value: contextValue }, children); -} -function useSelectMultiple() { - var context = q2(SelectMultipleContext); - if (!context) { - throw new Error("useSelectMultiple must be used within a SelectMultipleProvider"); - } - return context; -} -function addToRange(day, range) { - var _a2 = range || {}, from = _a2.from, to = _a2.to; - if (!from) { - return { from: day, to: void 0 }; - } - if (!to && isSameDay(from, day)) { - return { from, to: day }; - } - if (!to && isBefore(day, from)) { - return { from: day, to: from }; + }); + return [min3, max3]; +}; +var mean = (columnId, leafRows) => { + let count2 = 0; + let sum2 = 0; + leafRows.forEach((row) => { + let value = row.getValue(columnId); + if (value != null && (value = +value) >= value) { + ++count2, sum2 += value; + } + }); + if (count2) + return sum2 / count2; + return; +}; +var median = (columnId, leafRows) => { + if (!leafRows.length) { + return; } - if (!to) { - return { from, to: day }; + let min3 = 0; + let max3 = 0; + leafRows.forEach((row) => { + let value = row.getValue(columnId); + if (typeof value === "number") { + min3 = Math.min(min3, value); + max3 = Math.max(max3, value); + } + }); + return (min3 + max3) / 2; +}; +var unique = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map((d5) => d5.getValue(columnId))).values()); +}; +var uniqueCount = (columnId, leafRows) => { + return new Set(leafRows.map((d5) => d5.getValue(columnId))).size; +}; +var count = (_columnId, leafRows) => { + return leafRows.length; +}; +var aggregationFns = { + sum, + min: min2, + max: max2, + extent, + mean, + median, + unique, + uniqueCount, + count +}; +var Grouping = { + getDefaultColumnDef: () => { + return { + aggregatedCell: (props2) => { + var _toString, _props$getValue; + return (_toString = (_props$getValue = props2.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; + }, + aggregationFn: "auto" + }; + }, + getInitialState: (state) => { + return { + grouping: [], + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onGroupingChange: makeStateUpdater("grouping", table), + groupedColumnMode: "reorder" + }; + }, + createColumn: (column, table) => { + return { + toggleGrouping: () => { + table.setGrouping((old) => { + if (old != null && old.includes(column.id)) { + return old.filter((d5) => d5 !== column.id); + } + return [...old != null ? old : [], column.id]; + }); + }, + getCanGroup: () => { + var _ref, _ref2, _ref3, _column$columnDef$ena; + return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn; + }, + getIsGrouped: () => { + var _table$getState$group; + return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); + }, + getGroupedIndex: () => { + var _table$getState$group2; + return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); + }, + getToggleGroupingHandler: () => { + const canGroup = column.getCanGroup(); + return () => { + if (!canGroup) + return; + column.toggleGrouping(); + }; + }, + getAutoAggregationFn: () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === "number") { + return aggregationFns.sum; + } + if (Object.prototype.toString.call(value) === "[object Date]") { + return aggregationFns.extent; + } + }, + getAggregationFn: () => { + var _table$options$aggreg, _table$options$aggreg2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === "auto" ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn]; + } + }; + }, + createTable: (table) => { + return { + setGrouping: (updater) => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater), + resetGrouping: (defaultState) => { + var _table$initialState$g, _table$initialState; + table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + }, + getPreGroupedRowModel: () => table.getFilteredRowModel(), + getGroupedRowModel: () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table); + } + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel(); + } + return table._getGroupedRowModel(); + } + }; + }, + createRow: (row) => { + return { + getIsGrouped: () => !!row.groupingColumnId, + _groupingValuesCache: {} + }; + }, + createCell: (cell, column, row, table) => { + return { + getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId, + getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(), + getIsAggregated: () => { + var _row$subRows; + return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + } + }; } - if (isSameDay(to, day) && isSameDay(from, day)) { - return void 0; +}; +function orderColumns(leafColumns, grouping, groupedColumnMode) { + if (!(grouping != null && grouping.length) || !groupedColumnMode) { + return leafColumns; } - if (isSameDay(to, day)) { - return { from: to, to: void 0 }; + const nonGroupingColumns = leafColumns.filter((col) => !grouping.includes(col.id)); + if (groupedColumnMode === "remove") { + return nonGroupingColumns; } - if (isSameDay(from, day)) { - return void 0; + const groupingColumns = grouping.map((g4) => leafColumns.find((col) => col.id === g4)).filter(Boolean); + return [...groupingColumns, ...nonGroupingColumns]; +} +var Ordering = { + getInitialState: (state) => { + return { + columnOrder: [], + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onColumnOrderChange: makeStateUpdater("columnOrder", table) + }; + }, + createTable: (table) => { + return { + setColumnOrder: (updater) => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater), + resetColumnOrder: (defaultState) => { + var _table$initialState$c; + table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + }, + _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => { + let orderedColumns = []; + if (!(columnOrder != null && columnOrder.length)) { + orderedColumns = columns; + } else { + const columnOrderCopy = [...columnOrder]; + const columnsCopy = [...columns]; + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift(); + const foundIndex = columnsCopy.findIndex((d5) => d5.id === targetColumnId); + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); + } + } + orderedColumns = [...orderedColumns, ...columnsCopy]; + } + return orderColumns(orderedColumns, grouping, groupedColumnMode); + }, { + key: "getOrderColumnsFn" + }) + }; } - if (isAfter(from, day)) { - return { from: day, to }; +}; +var defaultPageIndex = 0; +var defaultPageSize = 10; +var getDefaultPaginationState = () => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize +}); +var Pagination = { + getInitialState: (state) => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...state == null ? void 0 : state.pagination + } + }; + }, + getDefaultOptions: (table) => { + return { + onPaginationChange: makeStateUpdater("pagination", table) + }; + }, + createTable: (table) => { + let registered = false; + let queued = false; + return { + _autoResetPageIndex: () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + 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; + table._queue(() => { + table.resetPageIndex(); + queued = false; + }); + } + }, + setPagination: (updater) => { + const safeUpdater = (old) => { + let newState = functionalUpdate(updater, old); + return newState; + }; + return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + }, + resetPagination: (defaultState) => { + var _table$initialState$p; + table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + }, + setPageIndex: (updater) => { + table.setPagination((old) => { + let pageIndex = functionalUpdate(updater, old.pageIndex); + 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, + pageIndex + }; + }); + }, + resetPageIndex: (defaultState) => { + var _table$initialState$p2, _table$initialState, _table$initialState$p3; + table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null ? void 0 : (_table$initialState$p3 = _table$initialState.pagination) == null ? void 0 : _table$initialState$p3.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + }, + resetPageSize: (defaultState) => { + var _table$initialState$p4, _table$initialState2, _table$initialState2$; + table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p4 = (_table$initialState2 = table.initialState) == null ? void 0 : (_table$initialState2$ = _table$initialState2.pagination) == null ? void 0 : _table$initialState2$.pageSize) != null ? _table$initialState$p4 : defaultPageSize); + }, + 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); + return { + ...old, + pageIndex, + pageSize + }; + }); + }, + setPageCount: (updater) => table.setPagination((old) => { + var _table$options$pageCo; + let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + if (typeof newPageCount === "number") { + newPageCount = Math.max(-1, newPageCount); + } + return { + ...old, + pageCount: newPageCount + }; + }), + getPageOptions: memo(() => [table.getPageCount()], (pageCount) => { + let pageOptions = []; + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_9, i4) => i4); + } + return pageOptions; + }, { + key: "getPageOptions", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; + } + }), + getCanPreviousPage: () => table.getState().pagination.pageIndex > 0, + getCanNextPage: () => { + const { + pageIndex + } = table.getState().pagination; + const pageCount = table.getPageCount(); + if (pageCount === -1) { + return true; + } + if (pageCount === 0) { + return false; + } + return pageIndex < pageCount - 1; + }, + previousPage: () => { + return table.setPageIndex((old) => old - 1); + }, + nextPage: () => { + return table.setPageIndex((old) => { + return old + 1; + }); + }, + getPrePaginationRowModel: () => table.getExpandedRowModel(), + getPaginationRowModel: () => { + if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { + table._getPaginationRowModel = table.options.getPaginationRowModel(table); + } + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel(); + } + return table._getPaginationRowModel(); + }, + getPageCount: () => { + var _table$options$pageCo2; + return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize); + } + }; } - return { from, to: day }; -} -var SelectRangeContext = F(void 0); -function SelectRangeProvider(props2) { - if (!isDayPickerRange(props2.initialProps)) { - var emptyContextValue = { - selected: void 0, - modifiers: { - range_start: [], - range_end: [], - range_middle: [], - disabled: [] +}; +var getDefaultPinningState = () => ({ + left: [], + right: [] +}); +var Pinning = { + getInitialState: (state) => { + return { + columnPinning: getDefaultPinningState(), + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onColumnPinningChange: makeStateUpdater("columnPinning", table) + }; + }, + createColumn: (column, table) => { + return { + pin: (position) => { + const columnIds = column.getLeafColumns().map((d5) => d5.id).filter(Boolean); + table.setColumnPinning((old) => { + var _old$left3, _old$right3; + if (position === "right") { + var _old$left, _old$right; + return { + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), ...columnIds] + }; + } + if (position === "left") { + var _old$left2, _old$right2; + return { + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))) + }; + } + return { + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))) + }; + }); + }, + getCanPin: () => { + const leafColumns = column.getLeafColumns(); + return leafColumns.some((d5) => { + var _d$columnDef$enablePi, _table$options$enable; + return ((_d$columnDef$enablePi = d5.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true); + }); + }, + getIsPinned: () => { + const leafColumnIds = column.getLeafColumns().map((d5) => d5.id); + const { + left, + right + } = table.getState().columnPinning; + const isLeft = leafColumnIds.some((d5) => left == null ? void 0 : left.includes(d5)); + const isRight = leafColumnIds.some((d5) => right == null ? void 0 : right.includes(d5)); + return isLeft ? "left" : isRight ? "right" : false; + }, + getPinnedIndex: () => { + var _table$getState$colum, _table$getState$colum2, _table$getState$colum3; + const position = column.getIsPinned(); + return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null ? void 0 : (_table$getState$colum3 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum3.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + } + }; + }, + createRow: (row, table) => { + return { + getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; + return allCells.filter((d5) => !leftAndRight.includes(d5.column.id)); + }, { + key: false, + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows; + } + }), + getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, ,], (allCells, left) => { + const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d5) => ({ + ...d5, + position: "left" + })); + return cells; + }, { + key: false, + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows; + } + }), + getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { + const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d5) => ({ + ...d5, + position: "right" + })); + return cells; + }, { + key: false, + debug: () => { + var _table$options$debugA3; + return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows; + } + }) + }; + }, + createTable: (table) => { + return { + setColumnPinning: (updater) => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater), + resetColumnPinning: (defaultState) => { + var _table$initialState$c, _table$initialState; + return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState()); + }, + getIsSomeColumnsPinned: (position) => { + var _pinningState$positio; + 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[position]) == null ? void 0 : _pinningState$positio.length); + }, + getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + return (left != null ? left : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean); + }, { + key: "getLeftLeafColumns", + debug: () => { + var _table$options$debugA4; + return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns; + } + }), + getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + return (right != null ? right : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean); + }, { + key: "getRightLeafColumns", + debug: () => { + var _table$options$debugA5; + return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns; + } + }), + getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; + return allColumns.filter((d5) => !leftAndRight.includes(d5.id)); + }, { + key: "getCenterLeafColumns", + debug: () => { + var _table$options$debugA6; + return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns; + } + }) + }; + } +}; +var RowSelection = { + getInitialState: (state) => { + return { + rowSelection: {}, + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onRowSelectionChange: makeStateUpdater("rowSelection", table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true + }; + }, + createTable: (table) => { + return { + setRowSelection: (updater) => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater), + resetRowSelection: (defaultState) => { + var _table$initialState$r; + return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + }, + toggleAllRowsSelected: (value) => { + table.setRowSelection((old) => { + value = typeof value !== "undefined" ? value : !table.getIsAllRowsSelected(); + const rowSelection = { + ...old + }; + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + if (value) { + preGroupedFlatRows.forEach((row) => { + if (!row.getCanSelect()) { + return; + } + rowSelection[row.id] = true; + }); + } else { + preGroupedFlatRows.forEach((row) => { + delete rowSelection[row.id]; + }); + } + return rowSelection; + }); + }, + toggleAllPageRowsSelected: (value) => table.setRowSelection((old) => { + const resolvedValue = typeof value !== "undefined" ? value : !table.getIsAllPageRowsSelected(); + const rowSelection = { + ...old + }; + table.getRowModel().rows.forEach((row) => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, table); + }); + return rowSelection; + }), + getPreSelectedRowModel: () => table.getCoreRowModel(), + getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, { + key: "getSelectedRowModel", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; + } + }), + getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, { + key: false, + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable; + } + }), + getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, { + key: false, + debug: () => { + var _table$options$debugA3; + return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable; + } + }), + getIsAllRowsSelected: () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); + if (isAllRowsSelected) { + if (preGroupedFlatRows.some((row) => row.getCanSelect() && !rowSelection[row.id])) { + isAllRowsSelected = false; + } + } + return isAllRowsSelected; + }, + getIsAllPageRowsSelected: () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllPageRowsSelected = !!paginationFlatRows.length; + if (isAllPageRowsSelected && paginationFlatRows.some((row) => row.getCanSelect() && !rowSelection[row.id])) { + isAllPageRowsSelected = false; + } + return isAllPageRowsSelected; + }, + getIsSomeRowsSelected: () => { + var _table$getState$rowSe; + const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + }, + getIsSomePageRowsSelected: () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some((d5) => d5.getIsSelected() || d5.getIsSomeSelected()); + }, + getToggleAllRowsSelectedHandler: () => { + return (e4) => { + table.toggleAllRowsSelected(e4.target.checked); + }; + }, + getToggleAllPageRowsSelectedHandler: () => { + return (e4) => { + table.toggleAllPageRowsSelected(e4.target.checked); + }; } }; - return Cn.createElement(SelectRangeContext.Provider, { value: emptyContextValue }, props2.children); - } - return Cn.createElement(SelectRangeProviderInternal, { initialProps: props2.initialProps, children: props2.children }); -} -function SelectRangeProviderInternal(_a2) { - var initialProps = _a2.initialProps, children = _a2.children; - var selected = initialProps.selected; - var _b2 = selected || {}, selectedFrom = _b2.from, selectedTo = _b2.to; - var min3 = initialProps.min; - var max3 = initialProps.max; - var onDayClick = function(day, activeModifiers, e4) { - var _a3, _b3; - (_a3 = initialProps.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(initialProps, day, activeModifiers, e4); - var newRange = addToRange(day, selected); - (_b3 = initialProps.onSelect) === null || _b3 === void 0 ? void 0 : _b3.call(initialProps, newRange, day, activeModifiers, e4); - }; - var modifiers = { - range_start: [], - range_end: [], - range_middle: [], - disabled: [] - }; - if (selectedFrom) { - modifiers.range_start = [selectedFrom]; - if (!selectedTo) { - modifiers.range_end = [selectedFrom]; - } else { - modifiers.range_end = [selectedTo]; - if (!isSameDay(selectedFrom, selectedTo)) { - modifiers.range_middle = [ - { - after: selectedFrom, - before: selectedTo + }, + createRow: (row, table) => { + return { + toggleSelected: (value) => { + const isSelected = row.getIsSelected(); + table.setRowSelection((old) => { + value = typeof value !== "undefined" ? value : !isSelected; + if (isSelected === value) { + return old; } - ]; + const selectedRowIds = { + ...old + }; + mutateRowIsSelected(selectedRowIds, row.id, value, table); + return selectedRowIds; + }); + }, + getIsSelected: () => { + const { + rowSelection + } = table.getState(); + return isRowSelected(row, rowSelection); + }, + getIsSomeSelected: () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === "some"; + }, + getIsAllSubRowsSelected: () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === "all"; + }, + getCanSelect: () => { + var _table$options$enable; + if (typeof table.options.enableRowSelection === "function") { + return table.options.enableRowSelection(row); + } + return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + }, + getCanSelectSubRows: () => { + var _table$options$enable2; + if (typeof table.options.enableSubRowSelection === "function") { + return table.options.enableSubRowSelection(row); + } + return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + }, + getCanMultiSelect: () => { + var _table$options$enable3; + if (typeof table.options.enableMultiRowSelection === "function") { + return table.options.enableMultiRowSelection(row); + } + return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + }, + getToggleSelectedHandler: () => { + const canSelect = row.getCanSelect(); + return (e4) => { + var _target; + if (!canSelect) + return; + row.toggleSelected((_target = e4.target) == null ? void 0 : _target.checked); + }; } - } - } - if (min3) { - if (selectedFrom && !selectedTo) { - modifiers.disabled.push({ - after: subDays(selectedFrom, min3 - 1), - before: addDays(selectedFrom, min3 - 1) - }); - } - if (selectedFrom && selectedTo) { - modifiers.disabled.push({ - after: selectedFrom, - before: addDays(selectedFrom, min3 - 1) - }); - } + }; } - if (max3) { - if (selectedFrom && !selectedTo) { - modifiers.disabled.push({ - before: addDays(selectedFrom, -max3 + 1) - }); - modifiers.disabled.push({ - after: addDays(selectedFrom, max3 - 1) - }); +}; +var mutateRowIsSelected = (selectedRowIds, id2, value, table) => { + var _row$subRows; + const row = table.getRow(id2); + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach((key2) => delete selectedRowIds[key2]); } - if (selectedFrom && selectedTo) { - var selectedCount = differenceInCalendarDays(selectedTo, selectedFrom) + 1; - var offset = max3 - selectedCount; - modifiers.disabled.push({ - before: subDays(selectedFrom, offset) - }); - modifiers.disabled.push({ - after: addDays(selectedTo, offset) - }); + if (row.getCanSelect()) { + selectedRowIds[id2] = true; } - } - return Cn.createElement(SelectRangeContext.Provider, { value: { selected, onDayClick, modifiers } }, children); -} -function useSelectRange() { - var context = q2(SelectRangeContext); - if (!context) { - throw new Error("useSelectRange must be used within a SelectRangeProvider"); - } - return context; -} -function matcherToArray(matcher) { - if (Array.isArray(matcher)) { - return __spreadArray2([], matcher, true); - } else if (matcher !== void 0) { - return [matcher]; } else { - return []; - } -} -function getCustomModifiers(dayModifiers) { - var customModifiers = {}; - Object.entries(dayModifiers).forEach(function(_a2) { - var modifier = _a2[0], matcher = _a2[1]; - customModifiers[modifier] = matcherToArray(matcher); - }); - return customModifiers; -} -var InternalModifier; -(function(InternalModifier2) { - InternalModifier2["Outside"] = "outside"; - InternalModifier2["Disabled"] = "disabled"; - InternalModifier2["Selected"] = "selected"; - InternalModifier2["Hidden"] = "hidden"; - InternalModifier2["Today"] = "today"; - InternalModifier2["RangeStart"] = "range_start"; - InternalModifier2["RangeEnd"] = "range_end"; - InternalModifier2["RangeMiddle"] = "range_middle"; -})(InternalModifier || (InternalModifier = {})); -var Selected = InternalModifier.Selected; -var Disabled = InternalModifier.Disabled; -var Hidden = InternalModifier.Hidden; -var Today = InternalModifier.Today; -var RangeEnd = InternalModifier.RangeEnd; -var RangeMiddle = InternalModifier.RangeMiddle; -var RangeStart = InternalModifier.RangeStart; -var Outside2 = InternalModifier.Outside; -function getInternalModifiers(dayPicker, selectMultiple, selectRange2) { - var _a2; - var internalModifiers = (_a2 = {}, _a2[Selected] = matcherToArray(dayPicker.selected), _a2[Disabled] = matcherToArray(dayPicker.disabled), _a2[Hidden] = matcherToArray(dayPicker.hidden), _a2[Today] = [dayPicker.today], _a2[RangeEnd] = [], _a2[RangeMiddle] = [], _a2[RangeStart] = [], _a2[Outside2] = [], _a2); - if (dayPicker.fromDate) { - internalModifiers[Disabled].push({ before: dayPicker.fromDate }); - } - if (dayPicker.toDate) { - internalModifiers[Disabled].push({ after: dayPicker.toDate }); - } - if (isDayPickerMultiple(dayPicker)) { - internalModifiers[Disabled] = internalModifiers[Disabled].concat(selectMultiple.modifiers[Disabled]); - } else if (isDayPickerRange(dayPicker)) { - internalModifiers[Disabled] = internalModifiers[Disabled].concat(selectRange2.modifiers[Disabled]); - internalModifiers[RangeStart] = selectRange2.modifiers[RangeStart]; - internalModifiers[RangeMiddle] = selectRange2.modifiers[RangeMiddle]; - internalModifiers[RangeEnd] = selectRange2.modifiers[RangeEnd]; - } - return internalModifiers; -} -var ModifiersContext = F(void 0); -function ModifiersProvider(props2) { - var dayPicker = useDayPicker(); - var selectMultiple = useSelectMultiple(); - var selectRange2 = useSelectRange(); - var internalModifiers = getInternalModifiers(dayPicker, selectMultiple, selectRange2); - var customModifiers = getCustomModifiers(dayPicker.modifiers); - var modifiers = __assign2(__assign2({}, internalModifiers), customModifiers); - return Cn.createElement(ModifiersContext.Provider, { value: modifiers }, props2.children); -} -function useModifiers() { - var context = q2(ModifiersContext); - if (!context) { - throw new Error("useModifiers must be used within a ModifiersProvider"); - } - return context; -} -function isDateInterval(matcher) { - return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher); -} -function isDateRange(value) { - return Boolean(value && typeof value === "object" && "from" in value); -} -function isDateAfterType(value) { - return Boolean(value && typeof value === "object" && "after" in value); -} -function isDateBeforeType(value) { - return Boolean(value && typeof value === "object" && "before" in value); -} -function isDayOfWeekType(value) { - return Boolean(value && typeof value === "object" && "dayOfWeek" in value); -} -function isDateInRange(date, range) { - var _a2; - var from = range.from, to = range.to; - if (!from) { - return false; - } - if (!to && isSameDay(from, date)) { - return true; - } - if (!to) { - return false; + delete selectedRowIds[id2]; } - var isRangeInverted = differenceInCalendarDays(to, from) < 0; - if (isRangeInverted) { - _a2 = [to, from], from = _a2[0], to = _a2[1]; + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { + row.subRows.forEach((row2) => mutateRowIsSelected(selectedRowIds, row2.id, value, table)); } - var isInRange = differenceInCalendarDays(date, from) >= 0 && differenceInCalendarDays(to, date) >= 0; - return isInRange; -} -function isDateType(value) { - return isDate(value); -} -function isArrayOfDates(value) { - return Array.isArray(value) && value.every(isDate); -} -function isMatch(day, matchers) { - return matchers.some(function(matcher) { - if (typeof matcher === "boolean") { - return matcher; - } - if (isDateType(matcher)) { - return isSameDay(day, matcher); - } - if (isArrayOfDates(matcher)) { - return matcher.includes(day); - } - if (isDateRange(matcher)) { - return isDateInRange(day, matcher); - } - if (isDayOfWeekType(matcher)) { - return matcher.dayOfWeek.includes(day.getDay()); - } - if (isDateInterval(matcher)) { - var diffBefore = differenceInCalendarDays(matcher.before, day); - var diffAfter = differenceInCalendarDays(matcher.after, day); - var isDayBefore = diffBefore > 0; - var isDayAfter = diffAfter < 0; - var isClosedInterval = isAfter(matcher.before, matcher.after); - if (isClosedInterval) { - return isDayAfter && isDayBefore; - } else { - return isDayBefore || isDayAfter; +}; +function selectRowsFn(table, rowModel) { + const rowSelection = table.getState().rowSelection; + const newSelectedFlatRows = []; + const newSelectedRowsById = {}; + const recurseRows = function(rows, depth) { + return rows.map((row) => { + var _row$subRows2; + const isSelected = isRowSelected(row, rowSelection); + if (isSelected) { + newSelectedFlatRows.push(row); + newSelectedRowsById[row.id] = row; } - } - if (isDateAfterType(matcher)) { - return differenceInCalendarDays(day, matcher.after) > 0; - } - if (isDateBeforeType(matcher)) { - return differenceInCalendarDays(matcher.before, day) > 0; - } - if (typeof matcher === "function") { - return matcher(day); - } - return false; - }); -} -function getActiveModifiers(day, modifiers, displayMonth) { - var matchedModifiers = Object.keys(modifiers).reduce(function(result, key2) { - var modifier = modifiers[key2]; - if (isMatch(day, modifier)) { - result.push(key2); - } - return result; - }, []); - var activeModifiers = {}; - matchedModifiers.forEach(function(modifier) { - return activeModifiers[modifier] = true; - }); - if (displayMonth && !isSameMonth(day, displayMonth)) { - activeModifiers.outside = true; - } - return activeModifiers; -} -function getInitialFocusTarget(displayMonths, modifiers) { - var firstDayInMonth = startOfMonth(displayMonths[0]); - var lastDayInMonth = endOfMonth(displayMonths[displayMonths.length - 1]); - var firstFocusableDay; - var today; - var date = firstDayInMonth; - while (date <= lastDayInMonth) { - var activeModifiers = getActiveModifiers(date, modifiers); - var isFocusable = !activeModifiers.disabled && !activeModifiers.hidden; - if (!isFocusable) { - date = addDays(date, 1); - continue; - } - if (activeModifiers.selected) { - return date; - } - if (activeModifiers.today && !today) { - today = date; - } - if (!firstFocusableDay) { - firstFocusableDay = date; - } - date = addDays(date, 1); - } - if (today) { - return today; - } else { - return firstFocusableDay; - } -} -var MAX_RETRY = 365; -function getNextFocus(focusedDay, options) { - var moveBy = options.moveBy, direction = options.direction, context = options.context, modifiers = options.modifiers, _a2 = options.retry, retry = _a2 === void 0 ? { count: 0, lastFocused: focusedDay } : _a2; - var weekStartsOn = context.weekStartsOn, fromDate = context.fromDate, toDate2 = context.toDate, locale2 = context.locale; - var moveFns = { - day: addDays, - week: addWeeks, - month: addMonths, - year: addYears, - startOfWeek: function(date) { - return context.ISOWeek ? startOfISOWeek(date) : startOfWeek(date, { locale: locale2, weekStartsOn }); - }, - endOfWeek: function(date) { - return context.ISOWeek ? endOfISOWeek(date) : endOfWeek(date, { locale: locale2, weekStartsOn }); - } - }; - var newFocusedDay = moveFns[moveBy](focusedDay, direction === "after" ? 1 : -1); - if (direction === "before" && fromDate) { - newFocusedDay = max([fromDate, newFocusedDay]); - } else if (direction === "after" && toDate2) { - newFocusedDay = min([toDate2, newFocusedDay]); - } - var isFocusable = true; - if (modifiers) { - var activeModifiers = getActiveModifiers(newFocusedDay, modifiers); - isFocusable = !activeModifiers.disabled && !activeModifiers.hidden; - } - if (isFocusable) { - return newFocusedDay; - } else { - if (retry.count > MAX_RETRY) { - return retry.lastFocused; - } - return getNextFocus(newFocusedDay, { - moveBy, - direction, - context, - modifiers, - retry: __assign2(__assign2({}, retry), { count: retry.count + 1 }) - }); - } -} -var FocusContext = F(void 0); -function FocusProvider(props2) { - var navigation = useNavigation(); - var modifiers = useModifiers(); - var _a2 = h2(), focusedDay = _a2[0], setFocusedDay = _a2[1]; - var _b2 = h2(), lastFocused = _b2[0], setLastFocused = _b2[1]; - var initialFocusTarget = getInitialFocusTarget(navigation.displayMonths, modifiers); - var focusTarget = (focusedDay !== null && focusedDay !== void 0 ? focusedDay : lastFocused && navigation.isDateDisplayed(lastFocused)) ? lastFocused : initialFocusTarget; - var blur = function() { - setLastFocused(focusedDay); - setFocusedDay(void 0); - }; - var focus = function(date) { - setFocusedDay(date); - }; - var context = useDayPicker(); - var moveFocus = function(moveBy, direction) { - if (!focusedDay) - return; - var nextFocused = getNextFocus(focusedDay, { - moveBy, - direction, - context, - modifiers - }); - if (isSameDay(focusedDay, nextFocused)) - return void 0; - navigation.goToDate(nextFocused, focusedDay); - focus(nextFocused); + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { + row = { + ...row, + subRows: recurseRows(row.subRows) + }; + } + if (isSelected) { + return row; + } + }).filter(Boolean); }; - var value = { - focusedDay, - focusTarget, - blur, - focus, - focusDayAfter: function() { - return moveFocus("day", "after"); - }, - focusDayBefore: function() { - return moveFocus("day", "before"); - }, - focusWeekAfter: function() { - return moveFocus("week", "after"); - }, - focusWeekBefore: function() { - return moveFocus("week", "before"); - }, - focusMonthBefore: function() { - return moveFocus("month", "before"); - }, - focusMonthAfter: function() { - return moveFocus("month", "after"); - }, - focusYearBefore: function() { - return moveFocus("year", "before"); - }, - focusYearAfter: function() { - return moveFocus("year", "after"); - }, - focusStartOfWeek: function() { - return moveFocus("startOfWeek", "before"); - }, - focusEndOfWeek: function() { - return moveFocus("endOfWeek", "after"); - } + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById }; - return Cn.createElement(FocusContext.Provider, { value }, props2.children); -} -function useFocusContext() { - var context = q2(FocusContext); - if (!context) { - throw new Error("useFocusContext must be used within a FocusProvider"); - } - return context; } -function useActiveModifiers(day, displayMonth) { - var modifiers = useModifiers(); - var activeModifiers = getActiveModifiers(day, modifiers, displayMonth); - return activeModifiers; +function isRowSelected(row, selection) { + var _selection$row$id; + return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; } -var SelectSingleContext = F(void 0); -function SelectSingleProvider(props2) { - if (!isDayPickerSingle(props2.initialProps)) { - var emptyContextValue = { - selected: void 0 - }; - return Cn.createElement(SelectSingleContext.Provider, { value: emptyContextValue }, props2.children); +function isSubRowSelected(row, selection, table) { + if (row.subRows && row.subRows.length) { + let allChildrenSelected = true; + let someSelected = false; + row.subRows.forEach((subRow) => { + if (someSelected && !allChildrenSelected) { + return; + } + if (isRowSelected(subRow, selection)) { + someSelected = true; + } else { + allChildrenSelected = false; + } + }); + return allChildrenSelected ? "all" : someSelected ? "some" : false; } - return Cn.createElement(SelectSingleProviderInternal, { initialProps: props2.initialProps, children: props2.children }); + return false; } -function SelectSingleProviderInternal(_a2) { - var initialProps = _a2.initialProps, children = _a2.children; - var onDayClick = function(day, activeModifiers, e4) { - var _a3, _b2, _c2; - (_a3 = initialProps.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(initialProps, day, activeModifiers, e4); - if (activeModifiers.selected && !initialProps.required) { - (_b2 = initialProps.onSelect) === null || _b2 === void 0 ? void 0 : _b2.call(initialProps, void 0, day, activeModifiers, e4); - return; - } - (_c2 = initialProps.onSelect) === null || _c2 === void 0 ? void 0 : _c2.call(initialProps, day, day, activeModifiers, e4); - }; - var contextValue = { - selected: initialProps.selected, - onDayClick - }; - return Cn.createElement(SelectSingleContext.Provider, { value: contextValue }, children); +var reSplitAlphaNumeric = /([0-9]+)/gm; +var alphanumeric = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; +var alphanumericCaseSensitive = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; +var text = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; +var textCaseSensitive = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; +var datetime = (rowA, rowB, columnId) => { + const a5 = rowA.getValue(columnId); + const b4 = rowB.getValue(columnId); + return a5 > b4 ? 1 : a5 < b4 ? -1 : 0; +}; +var basic = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); +}; +function compareBasic(a5, b4) { + return a5 === b4 ? 0 : a5 > b4 ? 1 : -1; } -function useSelectSingle() { - var context = q2(SelectSingleContext); - if (!context) { - throw new Error("useSelectSingle must be used within a SelectSingleProvider"); +function toString(a5) { + if (typeof a5 === "number") { + if (isNaN(a5) || a5 === Infinity || a5 === -Infinity) { + return ""; + } + return String(a5); } - return context; + if (typeof a5 === "string") { + return a5; + } + return ""; } -function useDayEventHandlers(date, activeModifiers) { - var dayPicker = useDayPicker(); - var single = useSelectSingle(); - var multiple = useSelectMultiple(); - var range = useSelectRange(); - var _a2 = useFocusContext(), focusDayAfter = _a2.focusDayAfter, focusDayBefore = _a2.focusDayBefore, focusWeekAfter = _a2.focusWeekAfter, focusWeekBefore = _a2.focusWeekBefore, blur = _a2.blur, focus = _a2.focus, focusMonthBefore = _a2.focusMonthBefore, focusMonthAfter = _a2.focusMonthAfter, focusYearBefore = _a2.focusYearBefore, focusYearAfter = _a2.focusYearAfter, focusStartOfWeek = _a2.focusStartOfWeek, focusEndOfWeek = _a2.focusEndOfWeek; - var onClick = function(e4) { - var _a3, _b2, _c2, _d2; - if (isDayPickerSingle(dayPicker)) { - (_a3 = single.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(single, date, activeModifiers, e4); - } else if (isDayPickerMultiple(dayPicker)) { - (_b2 = multiple.onDayClick) === null || _b2 === void 0 ? void 0 : _b2.call(multiple, date, activeModifiers, e4); - } else if (isDayPickerRange(dayPicker)) { - (_c2 = range.onDayClick) === null || _c2 === void 0 ? void 0 : _c2.call(range, date, activeModifiers, e4); - } else { - (_d2 = dayPicker.onDayClick) === null || _d2 === void 0 ? void 0 : _d2.call(dayPicker, date, activeModifiers, e4); +function compareAlphanumeric(aStr, bStr) { + const a5 = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const b4 = bStr.split(reSplitAlphaNumeric).filter(Boolean); + while (a5.length && b4.length) { + const aa = a5.shift(); + const bb = b4.shift(); + const an2 = parseInt(aa, 10); + const bn2 = parseInt(bb, 10); + const combo = [an2, bn2].sort(); + if (isNaN(combo[0])) { + if (aa > bb) { + return 1; + } + if (bb > aa) { + return -1; + } + continue; } - }; - var onFocus = function(e4) { - var _a3; - focus(date); - (_a3 = dayPicker.onDayFocus) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onBlur = function(e4) { - var _a3; - blur(); - (_a3 = dayPicker.onDayBlur) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onMouseEnter = function(e4) { - var _a3; - (_a3 = dayPicker.onDayMouseEnter) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onMouseLeave = function(e4) { - var _a3; - (_a3 = dayPicker.onDayMouseLeave) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onPointerEnter = function(e4) { - var _a3; - (_a3 = dayPicker.onDayPointerEnter) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onPointerLeave = function(e4) { - var _a3; - (_a3 = dayPicker.onDayPointerLeave) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onTouchCancel = function(e4) { - var _a3; - (_a3 = dayPicker.onDayTouchCancel) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onTouchEnd = function(e4) { - var _a3; - (_a3 = dayPicker.onDayTouchEnd) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onTouchMove = function(e4) { - var _a3; - (_a3 = dayPicker.onDayTouchMove) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onTouchStart = function(e4) { - var _a3; - (_a3 = dayPicker.onDayTouchStart) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onKeyUp = function(e4) { - var _a3; - (_a3 = dayPicker.onDayKeyUp) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var onKeyDown = function(e4) { - var _a3; - switch (e4.key) { - case "ArrowLeft": - e4.preventDefault(); - e4.stopPropagation(); - dayPicker.dir === "rtl" ? focusDayAfter() : focusDayBefore(); - break; - case "ArrowRight": - e4.preventDefault(); - e4.stopPropagation(); - dayPicker.dir === "rtl" ? focusDayBefore() : focusDayAfter(); - break; - case "ArrowDown": - e4.preventDefault(); - e4.stopPropagation(); - focusWeekAfter(); - break; - case "ArrowUp": - e4.preventDefault(); - e4.stopPropagation(); - focusWeekBefore(); - break; - case "PageUp": - e4.preventDefault(); - e4.stopPropagation(); - e4.shiftKey ? focusYearBefore() : focusMonthBefore(); - break; - case "PageDown": - e4.preventDefault(); - e4.stopPropagation(); - e4.shiftKey ? focusYearAfter() : focusMonthAfter(); - break; - case "Home": - e4.preventDefault(); - e4.stopPropagation(); - focusStartOfWeek(); - break; - case "End": - e4.preventDefault(); - e4.stopPropagation(); - focusEndOfWeek(); - break; + if (isNaN(combo[1])) { + return isNaN(an2) ? -1 : 1; } - (_a3 = dayPicker.onDayKeyDown) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); - }; - var eventHandlers = { - onClick, - onFocus, - onBlur, - onKeyDown, - onKeyUp, - onMouseEnter, - onMouseLeave, - onPointerEnter, - onPointerLeave, - onTouchCancel, - onTouchEnd, - onTouchMove, - onTouchStart - }; - return eventHandlers; -} -function useSelectedDays() { - var dayPicker = useDayPicker(); - var single = useSelectSingle(); - var multiple = useSelectMultiple(); - var range = useSelectRange(); - var selectedDays = isDayPickerSingle(dayPicker) ? single.selected : isDayPickerMultiple(dayPicker) ? multiple.selected : isDayPickerRange(dayPicker) ? range.selected : void 0; - return selectedDays; -} -function isInternalModifier(modifier) { - return Object.values(InternalModifier).includes(modifier); + if (an2 > bn2) { + return 1; + } + if (bn2 > an2) { + return -1; + } + } + return a5.length - b4.length; } -function getDayClassNames(dayPicker, activeModifiers) { - var classNames9 = [dayPicker.classNames.day]; - Object.keys(activeModifiers).forEach(function(modifier) { - var customClassName = dayPicker.modifiersClassNames[modifier]; - if (customClassName) { - classNames9.push(customClassName); - } else if (isInternalModifier(modifier)) { - var internalClassName = dayPicker.classNames["day_".concat(modifier)]; - if (internalClassName) { - classNames9.push(internalClassName); +var sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic +}; +var Sorting = { + getInitialState: (state) => { + return { + sorting: [], + ...state + }; + }, + getDefaultColumnDef: () => { + return { + sortingFn: "auto" + }; + }, + getDefaultOptions: (table) => { + return { + onSortingChange: makeStateUpdater("sorting", table), + isMultiSortEvent: (e4) => { + return e4.shiftKey; + } + }; + }, + createColumn: (column, table) => { + return { + getAutoSortingFn: () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10); + let isString = false; + for (const row of firstRows) { + const value = row == null ? void 0 : row.getValue(column.id); + if (Object.prototype.toString.call(value) === "[object Date]") { + return sortingFns.datetime; + } + if (typeof value === "string") { + isString = true; + if (value.split(reSplitAlphaNumeric).length > 1) { + return sortingFns.alphanumeric; + } + } + } + if (isString) { + return sortingFns.text; + } + return sortingFns.basic; + }, + getAutoSortDir: () => { + const firstRow = table.getFilteredRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === "string") { + return "asc"; + } + return "desc"; + }, + getSortingFn: () => { + var _table$options$sortin, _table$options$sortin2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === "auto" ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn]; + }, + toggleSorting: (desc, multi) => { + const nextSortingOrder = column.getNextSortingOrder(); + const hasManualValue = typeof desc !== "undefined" && desc !== null; + table.setSorting((old) => { + const existingSorting = old == null ? void 0 : old.find((d5) => d5.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex((d5) => d5.id === column.id); + let newSorting = []; + let sortAction; + let nextDesc = hasManualValue ? desc : nextSortingOrder === "desc"; + if (old != null && old.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = "toggle"; + } else { + sortAction = "add"; + } + } else { + if (old != null && old.length && existingIndex !== old.length - 1) { + sortAction = "replace"; + } else if (existingSorting) { + sortAction = "toggle"; + } else { + sortAction = "replace"; + } + } + if (sortAction === "toggle") { + if (!hasManualValue) { + if (!nextSortingOrder) { + sortAction = "remove"; + } + } + } + if (sortAction === "add") { + var _table$options$maxMul; + newSorting = [...old, { + id: column.id, + desc: nextDesc + }]; + 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((d5) => { + if (d5.id === column.id) { + return { + ...d5, + desc: nextDesc + }; + } + return d5; + }); + } else if (sortAction === "remove") { + newSorting = old.filter((d5) => d5.id !== column.id); + } else { + newSorting = [{ + id: column.id, + desc: nextDesc + }]; + } + return newSorting; + }); + }, + getFirstSortDir: () => { + var _ref, _column$columnDef$sor; + const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === "desc"; + return sortDescFirst ? "desc" : "asc"; + }, + getNextSortingOrder: (multi) => { + var _table$options$enable, _table$options$enable2; + const firstSortDirection = column.getFirstSortDir(); + const isSorted = column.getIsSorted(); + if (!isSorted) { + return firstSortDirection; + } + 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"; + }, + getCanSort: () => { + var _column$columnDef$ena, _table$options$enable3; + return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; + }, + getCanMultiSort: () => { + var _ref2, _column$columnDef$ena2; + return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; + }, + getIsSorted: () => { + var _table$getState$sorti; + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d5) => d5.id === column.id); + return !columnSort ? false : columnSort.desc ? "desc" : "asc"; + }, + getSortIndex: () => { + var _table$getState$sorti2, _table$getState$sorti3; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d5) => d5.id === column.id)) != null ? _table$getState$sorti2 : -1; + }, + clearSorting: () => { + table.setSorting((old) => old != null && old.length ? old.filter((d5) => d5.id !== column.id) : []); + }, + getToggleSortingHandler: () => { + const canSort = column.getCanSort(); + return (e4) => { + if (!canSort) + return; + e4.persist == null ? void 0 : e4.persist(); + column.toggleSorting == null ? void 0 : column.toggleSorting(void 0, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e4) : false); + }; + } + }; + }, + createTable: (table) => { + return { + setSorting: (updater) => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater), + resetSorting: (defaultState) => { + var _table$initialState$s, _table$initialState; + table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + }, + getPreSortedRowModel: () => table.getGroupedRowModel(), + getSortedRowModel: () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table); + } + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel(); + } + return table._getSortedRowModel(); + } + }; + } +}; +var Visibility = { + getInitialState: (state) => { + return { + columnVisibility: {}, + ...state + }; + }, + getDefaultOptions: (table) => { + return { + onColumnVisibilityChange: makeStateUpdater("columnVisibility", table) + }; + }, + createColumn: (column, table) => { + return { + toggleVisibility: (value) => { + if (column.getCanHide()) { + table.setColumnVisibility((old) => ({ + ...old, + [column.id]: value != null ? value : !column.getIsVisible() + })); + } + }, + getIsVisible: () => { + var _table$getState$colum, _table$getState$colum2; + return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true; + }, + getCanHide: () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + }, + getToggleVisibilityHandler: () => { + return (e4) => { + column.toggleVisibility == null ? void 0 : column.toggleVisibility(e4.target.checked); + }; + } + }; + }, + createRow: (row, table) => { + return { + _getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => { + return cells.filter((cell) => cell.column.getIsVisible()); + }, { + key: false, + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows; + } + }), + getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], { + key: "row.getVisibleCells", + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows; + } + }) + }; + }, + createTable: (table) => { + const makeVisibleColumnsMethod = (key2, getColumns) => { + return memo(() => [getColumns(), getColumns().filter((d5) => d5.getIsVisible()).map((d5) => d5.id).join("_")], (columns) => { + return columns.filter((d5) => d5.getIsVisible == null ? void 0 : d5.getIsVisible()); + }, { + key: key2, + debug: () => { + var _table$options$debugA3; + return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns; + } + }); + }; + return { + getVisibleFlatColumns: makeVisibleColumnsMethod("getVisibleFlatColumns", () => table.getAllFlatColumns()), + getVisibleLeafColumns: makeVisibleColumnsMethod("getVisibleLeafColumns", () => table.getAllLeafColumns()), + getLeftVisibleLeafColumns: makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table.getLeftLeafColumns()), + getRightVisibleLeafColumns: makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table.getRightLeafColumns()), + getCenterVisibleLeafColumns: makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table.getCenterLeafColumns()), + setColumnVisibility: (updater) => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater), + resetColumnVisibility: (defaultState) => { + var _table$initialState$c; + table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + }, + toggleAllColumnsVisible: (value) => { + var _value; + value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); + table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ + ...obj, + [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value + }), {})); + }, + getIsAllColumnsVisible: () => !table.getAllLeafColumns().some((column) => !(column.getIsVisible != null && column.getIsVisible())), + getIsSomeColumnsVisible: () => table.getAllLeafColumns().some((column) => column.getIsVisible == null ? void 0 : column.getIsVisible()), + getToggleAllColumnsVisibilityHandler: () => { + return (e4) => { + var _target; + table.toggleAllColumnsVisible((_target = e4.target) == null ? void 0 : _target.checked); + }; } - } - }); - return classNames9; -} -function getDayStyle(dayPicker, activeModifiers) { - var style = __assign2({}, dayPicker.styles.day); - Object.keys(activeModifiers).forEach(function(modifier) { - var _a2; - style = __assign2(__assign2({}, style), (_a2 = dayPicker.modifiersStyles) === null || _a2 === void 0 ? void 0 : _a2[modifier]); - }); - return style; -} -function useDayRender(day, displayMonth, buttonRef) { - var _a2; - var _b2, _c2; - var dayPicker = useDayPicker(); - var focusContext = useFocusContext(); - var activeModifiers = useActiveModifiers(day, displayMonth); - var eventHandlers = useDayEventHandlers(day, activeModifiers); - var selectedDays = useSelectedDays(); - var isButton = Boolean(dayPicker.onDayClick || dayPicker.mode !== "default"); - p2(function() { - var _a3; - if (activeModifiers.outside) - return; - if (!focusContext.focusedDay) - return; - if (!isButton) - return; - if (isSameDay(focusContext.focusedDay, day)) { - (_a3 = buttonRef.current) === null || _a3 === void 0 ? void 0 : _a3.focus(); - } - }, [ - focusContext.focusedDay, - day, - buttonRef, - isButton, - activeModifiers.outside - ]); - var className = getDayClassNames(dayPicker, activeModifiers).join(" "); - var style = getDayStyle(dayPicker, activeModifiers); - var isHidden = Boolean(activeModifiers.outside && !dayPicker.showOutsideDays || activeModifiers.hidden); - var DayContentComponent = (_c2 = (_b2 = dayPicker.components) === null || _b2 === void 0 ? void 0 : _b2.DayContent) !== null && _c2 !== void 0 ? _c2 : DayContent; - var children = Cn.createElement(DayContentComponent, { date: day, displayMonth, activeModifiers }); - var divProps = { - style, - className, - children, - role: "gridcell" - }; - var isFocusTarget = focusContext.focusTarget && isSameDay(focusContext.focusTarget, day) && !activeModifiers.outside; - var isFocused = focusContext.focusedDay && isSameDay(focusContext.focusedDay, day); - var buttonProps = __assign2(__assign2(__assign2({}, divProps), (_a2 = { disabled: activeModifiers.disabled, role: "gridcell" }, _a2["aria-selected"] = activeModifiers.selected, _a2.tabIndex = isFocused || isFocusTarget ? 0 : -1, _a2)), eventHandlers); - var dayRender = { - isButton, - isHidden, - activeModifiers, - selectedDays, - buttonProps, - divProps - }; - return dayRender; -} -function Day(props2) { - var buttonRef = _2(null); - var dayRender = useDayRender(props2.date, props2.displayMonth, buttonRef); - if (dayRender.isHidden) { - return Cn.createElement("div", { role: "gridcell" }); - } - if (!dayRender.isButton) { - return Cn.createElement("div", __assign2({}, dayRender.divProps)); + }; } - return Cn.createElement(Button, __assign2({ name: "day", ref: buttonRef }, dayRender.buttonProps)); -} -function WeekNumber(props2) { - var weekNumber = props2.number, dates = props2.dates; - var _a2 = useDayPicker(), onWeekNumberClick = _a2.onWeekNumberClick, styles = _a2.styles, classNames9 = _a2.classNames, locale2 = _a2.locale, labelWeekNumber2 = _a2.labels.labelWeekNumber, formatWeekNumber2 = _a2.formatters.formatWeekNumber; - var content = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); - if (!onWeekNumberClick) { - return Cn.createElement("span", { className: classNames9.weeknumber, style: styles.weeknumber }, content); +}; +var features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; +function createTable(options) { + var _options$initialState; + if (options.debugAll || options.debugTable) { + console.info("Creating Table Instance..."); } - var label = labelWeekNumber2(Number(weekNumber), { locale: locale2 }); - var handleClick = function(e4) { - onWeekNumberClick(weekNumber, dates, e4); + let table = { + _features: features }; - return Cn.createElement(Button, { name: "week-number", "aria-label": label, className: classNames9.weeknumber, style: styles.weeknumber, onClick: handleClick }, content); -} -function Row(props2) { - var _a2, _b2; - var _c2 = useDayPicker(), styles = _c2.styles, classNames9 = _c2.classNames, showWeekNumber = _c2.showWeekNumber, components = _c2.components; - var DayComponent = (_a2 = components === null || components === void 0 ? void 0 : components.Day) !== null && _a2 !== void 0 ? _a2 : Day; - var WeeknumberComponent = (_b2 = components === null || components === void 0 ? void 0 : components.WeekNumber) !== null && _b2 !== void 0 ? _b2 : WeekNumber; - var weekNumberCell; - if (showWeekNumber) { - weekNumberCell = Cn.createElement( - "td", - { className: classNames9.cell, style: styles.cell }, - Cn.createElement(WeeknumberComponent, { number: props2.weekNumber, dates: props2.dates }) - ); - } - return Cn.createElement( - "tr", - { className: classNames9.row, style: styles.row }, - weekNumberCell, - props2.dates.map(function(date) { - return Cn.createElement( - "td", - { className: classNames9.cell, style: styles.cell, key: getUnixTime(date), role: "presentation" }, - Cn.createElement(DayComponent, { displayMonth: props2.displayMonth, date }) - ); - }) - ); -} -function daysToMonthWeeks(fromDate, toDate2, options) { - var toWeek = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? endOfISOWeek(toDate2) : endOfWeek(toDate2, options); - var fromWeek = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? startOfISOWeek(fromDate) : startOfWeek(fromDate, options); - var nOfDays = differenceInCalendarDays(toWeek, fromWeek); - var days = []; - for (var i4 = 0; i4 <= nOfDays; i4++) { - days.push(addDays(fromWeek, i4)); - } - var weeksInMonth = days.reduce(function(result, date) { - var weekNumber = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? getISOWeek(date) : getWeek(date, options); - var existingWeek = result.find(function(value) { - return value.weekNumber === weekNumber; - }); - if (existingWeek) { - existingWeek.dates.push(date); - return result; - } - result.push({ - weekNumber, - dates: [date] - }); - return result; - }, []); - return weeksInMonth; -} -function getMonthWeeks(month, options) { - var weeksInMonth = daysToMonthWeeks(startOfMonth(month), endOfMonth(month), options); - if (options === null || options === void 0 ? void 0 : options.useFixedWeeks) { - var nrOfMonthWeeks = getWeeksInMonth(month, options); - if (nrOfMonthWeeks < 6) { - var lastWeek = weeksInMonth[weeksInMonth.length - 1]; - var lastDate = lastWeek.dates[lastWeek.dates.length - 1]; - var toDate2 = addWeeks(lastDate, 6 - nrOfMonthWeeks); - var extraWeeks = daysToMonthWeeks(addWeeks(lastDate, 1), toDate2, options); - weeksInMonth.push.apply(weeksInMonth, extraWeeks); - } - } - return weeksInMonth; -} -function Table(props2) { - var _a2, _b2, _c2; - var _d2 = useDayPicker(), locale2 = _d2.locale, classNames9 = _d2.classNames, styles = _d2.styles, hideHead = _d2.hideHead, fixedWeeks = _d2.fixedWeeks, components = _d2.components, weekStartsOn = _d2.weekStartsOn, firstWeekContainsDate = _d2.firstWeekContainsDate, ISOWeek = _d2.ISOWeek; - var weeks = getMonthWeeks(props2.displayMonth, { - useFixedWeeks: Boolean(fixedWeeks), - ISOWeek, - locale: locale2, - weekStartsOn, - firstWeekContainsDate - }); - var HeadComponent = (_a2 = components === null || components === void 0 ? void 0 : components.Head) !== null && _a2 !== void 0 ? _a2 : Head; - var RowComponent = (_b2 = components === null || components === void 0 ? void 0 : components.Row) !== null && _b2 !== void 0 ? _b2 : Row; - var FooterComponent = (_c2 = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c2 !== void 0 ? _c2 : Footer; - return Cn.createElement( - "table", - { className: classNames9.table, style: styles.table, role: "grid", "aria-labelledby": props2["aria-labelledby"] }, - !hideHead && Cn.createElement(HeadComponent, null), - Cn.createElement("tbody", { className: classNames9.tbody, style: styles.tbody, role: "rowgroup" }, weeks.map(function(week) { - return Cn.createElement(RowComponent, { displayMonth: props2.displayMonth, key: week.weekNumber, dates: week.dates, weekNumber: week.weekNumber }); - })), - Cn.createElement(FooterComponent, { displayMonth: props2.displayMonth }) - ); -} -function canUseDOM2() { - return !!(typeof window !== "undefined" && window.document && window.document.createElement); -} -var useIsomorphicLayoutEffect2 = canUseDOM2() ? y2 : p2; -var serverHandoffComplete = false; -var id = 0; -function genId2() { - return "react-day-picker-".concat(++id); -} -function useId(providedId) { - var _a2; - var initialId = providedId !== null && providedId !== void 0 ? providedId : serverHandoffComplete ? genId2() : null; - var _b2 = h2(initialId), id2 = _b2[0], setId = _b2[1]; - useIsomorphicLayoutEffect2(function() { - if (id2 === null) { - setId(genId2()); - } - }, []); - p2(function() { - if (serverHandoffComplete === false) { - serverHandoffComplete = true; + const defaultOptions3 = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + }, {}); + const mergeOptions = (options2) => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions3, options2); } - }, []); - return (_a2 = providedId !== null && providedId !== void 0 ? providedId : id2) !== null && _a2 !== void 0 ? _a2 : void 0; -} -function Month(props2) { - var _a2; - var _b2; - var dayPicker = useDayPicker(); - var dir = dayPicker.dir, classNames9 = dayPicker.classNames, styles = dayPicker.styles, components = dayPicker.components; - var displayMonths = useNavigation().displayMonths; - var captionId = useId(dayPicker.id ? "".concat(dayPicker.id, "-").concat(props2.displayIndex) : void 0); - var className = [classNames9.month]; - var style = styles.month; - var isStart = props2.displayIndex === 0; - var isEnd = props2.displayIndex === displayMonths.length - 1; - var isCenter = !isStart && !isEnd; - if (dir === "rtl") { - _a2 = [isStart, isEnd], isEnd = _a2[0], isStart = _a2[1]; - } - if (isStart) { - className.push(classNames9.caption_start); - style = __assign2(__assign2({}, style), styles.caption_start); - } - if (isEnd) { - className.push(classNames9.caption_end); - style = __assign2(__assign2({}, style), styles.caption_end); - } - if (isCenter) { - className.push(classNames9.caption_between); - style = __assign2(__assign2({}, style), styles.caption_between); - } - var CaptionComponent = (_b2 = components === null || components === void 0 ? void 0 : components.Caption) !== null && _b2 !== void 0 ? _b2 : Caption; - return Cn.createElement( - "div", - { key: props2.displayIndex, className: className.join(" "), style }, - Cn.createElement(CaptionComponent, { id: captionId, displayMonth: props2.displayMonth }), - Cn.createElement(Table, { "aria-labelledby": captionId, displayMonth: props2.displayMonth }) - ); -} -function Root() { - var dayPicker = useDayPicker(); - var focusContext = useFocusContext(); - var navigation = useNavigation(); - var _a2 = h2(false), hasInitialFocus = _a2[0], setHasInitialFocus = _a2[1]; - p2(function() { - if (!dayPicker.initialFocus) - return; - if (!focusContext.focusTarget) - return; - if (hasInitialFocus) - return; - focusContext.focus(focusContext.focusTarget); - setHasInitialFocus(true); - }, [ - dayPicker.initialFocus, - hasInitialFocus, - focusContext.focus, - focusContext.focusTarget, - focusContext - ]); - var classNames9 = [dayPicker.classNames.root, dayPicker.className]; - if (dayPicker.numberOfMonths > 1) { - classNames9.push(dayPicker.classNames.multiple_months); - } - if (dayPicker.showWeekNumber) { - classNames9.push(dayPicker.classNames.with_weeknumber); - } - var style = __assign2(__assign2({}, dayPicker.styles.root), dayPicker.style); - return Cn.createElement( - "div", - { className: classNames9.join(" "), style, dir: dayPicker.dir }, - Cn.createElement("div", { className: dayPicker.classNames.months, style: dayPicker.styles.months }, navigation.displayMonths.map(function(month, i4) { - return Cn.createElement(Month, { key: i4, displayIndex: i4, displayMonth: month }); - })) - ); -} -function RootProvider(props2) { - var children = props2.children, initialProps = __rest2(props2, ["children"]); - return Cn.createElement( - DayPickerProvider, - { initialProps }, - Cn.createElement( - NavigationProvider, - null, - Cn.createElement( - SelectSingleProvider, - { initialProps }, - Cn.createElement( - SelectMultipleProvider, - { initialProps }, - Cn.createElement( - SelectRangeProvider, - { initialProps }, - Cn.createElement( - ModifiersProvider, - null, - Cn.createElement(FocusProvider, null, children) - ) - ) - ) - ) - ) - ); -} -function DayPicker(props2) { - return Cn.createElement( - RootProvider, - __assign2({}, props2), - Cn.createElement(Root, null) - ); -} - -// src/components/ui/menus/datePickerMenu.tsx -var showDatePickerMenu = (point, value, setValue, format2) => { - const menu = new import_obsidian15.Menu(); - menu.dom.toggleClass("mk-menu", true); - menu.setUseNativeMenu(false); - const frag = document.createDocumentFragment(); - const div = frag.createEl("div"); - div.addEventListener("click", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("mousedown", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("mouseup", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("keydown", (e4) => { - }); - const setDate = (date) => { - setValue(date); - menu.hide(); + return { + ...defaultOptions3, + ...options2 + }; }; - const root = createRoot(div); - root.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(DayPicker, { - defaultMonth: value, - mode: "single", - selected: value, - labels: { - labelMonthDropdown: () => void 0, - labelYearDropdown: () => void 0, - labelNext: () => void 0, - labelPrevious: () => void 0, - labelDay: () => void 0, - labelWeekday: () => void 0, - labelWeekNumber: () => void 0 - }, - onSelect: setDate - })) - ); - menu.addItem((item) => { - item.setTitle(frag); + const coreInitialState = {}; + let initialState = { + ...coreInitialState, + ...(_options$initialState = options.initialState) != null ? _options$initialState : {} + }; + table._features.forEach((feature) => { + var _feature$getInitialSt; + initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; }); - const keys = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys.length; i4++) { - if (keys[i4].key != "Escape") { - menu.scope.unregister(keys[i4]); + const queued = []; + let queuedTimeout = false; + const coreInstance = { + _features: features, + options: { + ...defaultOptions3, + ...options + }, + initialState, + _queue: (cb) => { + queued.push(cb); + if (!queuedTimeout) { + queuedTimeout = true; + Promise.resolve().then(() => { + while (queued.length) { + queued.shift()(); + } + queuedTimeout = false; + }).catch((error) => setTimeout(() => { + throw error; + })); + } + }, + reset: () => { + table.setState(table.initialState); + }, + setOptions: (updater) => { + const newOptions = functionalUpdate(updater, table.options); + table.options = mergeOptions(newOptions); + }, + getState: () => { + return table.options.state; + }, + setState: (updater) => { + table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater); + }, + _getRowId: (row, index, parent) => { + var _table$options$getRow; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join(".") : index}`; + }, + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table); + } + return table._getCoreRowModel(); + }, + getRowModel: () => { + return table.getPaginationRowModel(); + }, + getRow: (id2) => { + const row = table.getRowModel().rowsById[id2]; + if (!row) { + if (true) { + throw new Error(`getRow expected an ID, but got ${id2}`); + } + throw new Error(); + } + return row; + }, + _getDefaultColumnDef: memo(() => [table.options.defaultColumn], (defaultColumn) => { + var _defaultColumn; + defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; + return { + header: (props2) => { + const resolvedColumnDef = props2.header.column.columnDef; + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey; + } + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id; + } + return null; + }, + cell: (props2) => { + var _props$renderValue$to, _props$renderValue; + return (_props$renderValue$to = (_props$renderValue = props2.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; + }, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); + }, {}), + ...defaultColumn + }; + }, { + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns; + }, + key: "getDefaultColumnDef" + }), + _getColumnDefs: () => table.options.columns, + getAllColumns: memo(() => [table._getColumnDefs()], (columnDefs) => { + const recurseColumns = function(columnDefs2, parent, depth) { + if (depth === void 0) { + depth = 0; + } + return columnDefs2.map((columnDef) => { + const column = createColumn(table, columnDef, depth, parent); + const groupingColumnDef = columnDef; + column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : []; + return column; + }); + }; + return recurseColumns(columnDefs); + }, { + key: "getAllColumns", + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns; + } + }), + getAllFlatColumns: memo(() => [table.getAllColumns()], (allColumns) => { + return allColumns.flatMap((column) => { + return column.getFlatColumns(); + }); + }, { + key: "getAllFlatColumns", + debug: () => { + var _table$options$debugA3; + return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns; + } + }), + _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], (flatColumns) => { + return flatColumns.reduce((acc, column) => { + acc[column.id] = column; + return acc; + }, {}); + }, { + key: "getAllFlatColumnsById", + debug: () => { + var _table$options$debugA4; + return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns; + } + }), + getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => { + let leafColumns = allColumns.flatMap((column) => column.getLeafColumns()); + return orderColumns2(leafColumns); + }, { + key: "getAllLeafColumns", + debug: () => { + var _table$options$debugA5; + return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns; + } + }), + getColumn: (columnId) => { + const column = table._getAllFlatColumnsById()[columnId]; + if (!column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + return column; } - } - menu.showAtPosition(point); - return menu; -}; - -// src/utils/date.ts -var formatDate = (plugin, date, dateFormat) => { - let dateString; - try { - dateString = format( - date, - (dateFormat == null ? void 0 : dateFormat.length) > 0 ? dateFormat : plugin.settings.defaultDateFormat - ); - } catch (e4) { - dateString = "Date Format Invalid"; - } - return dateString; -}; - -// src/components/ContextView/DataTypeView/DateCell.tsx -var DateCell = (props2) => { - const [value, setValue] = h2(props2.initialValue); - p2(() => { - setValue(props2.initialValue); - }, [props2.initialValue]); - const date = F2(() => { - const dateTime = Date.parse(value); - return dateTime > 0 ? new Date(dateTime + new Date().getTimezoneOffset() * 60 * 1e3) : null; - }, [value]); - const saveValue = (date2) => { - const newValue = format(date2, "yyyy-MM-dd"); - props2.saveValue(newValue); - setValue(newValue); - props2.setEditMode(null); }; - const menuRef = _2(null); - const ref = _2(null); - p2(() => { - if (props2.editMode == 2 /* EditModeActive */) { - if (ref.current) { - showPicker(); - ref.current.focus(); + Object.assign(table, coreInstance); + table._features.forEach((feature) => { + return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table)); + }); + return table; +} +function createCell(table, row, column, columnId) { + const getRenderValue = () => { + var _cell$getValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + }; + const cell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: memo(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({ + table: table2, + column: column2, + row: row2, + cell: cell2, + getValue: cell2.getValue, + renderValue: cell2.renderValue + }), { + key: "cell.getContext", + debug: () => table.options.debugAll + }) + }; + table._features.forEach((feature) => { + Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table)); + }, {}); + return cell; +} +var createRow = (table, id2, original, rowIndex, depth, subRows) => { + let row = { + id: id2, + index: rowIndex, + original, + depth, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: (columnId) => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; } - } - }, [props2.editMode]); - const showPicker = T2( - (e4) => { - if (props2.editMode <= 0) { - return; + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return void 0; } - const offset = e4 ? e4.target.getBoundingClientRect() : ref.current.getBoundingClientRect(); - menuRef.current = showDatePickerMenu( - { x: offset.left - 4, y: offset.bottom - 4 }, - date, - saveValue - ); + row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); + return row._valuesCache[columnId]; }, - [date] - ); - const onKeyDown = (e4) => { - e4.stopPropagation(); - if (e4.key == "Enter" || e4.key == "Escape") { - e4.target.blur(); - saveValue(date); - menuRef.current.hide(); - } + getUniqueValues: (columnId) => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return void 0; + } + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; + return row._uniqueValuesCache[columnId]; + } + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); + return row._uniqueValuesCache[columnId]; + }, + renderValue: (columnId) => { + var _row$getValue; + return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + }, + subRows: subRows != null ? subRows : [], + getLeafRows: () => flattenBy(row.subRows, (d5) => d5.subRows), + getAllCells: memo(() => [table.getAllLeafColumns()], (leafColumns) => { + return leafColumns.map((column) => { + return createCell(table, row, column, column.id); + }); + }, { + key: "row.getAllCells", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows; + } + }), + _getAllCellsByColumnId: memo(() => [row.getAllCells()], (allCells) => { + return allCells.reduce((acc, cell) => { + acc[cell.column.id] = cell; + return acc; + }, {}); + }, { + key: false, + debug: () => { + var _table$options$debugA2; + return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows; + } + }) }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-date", - onClick: (e4) => !value && showPicker(e4) - }, props2.editMode == 2 ? /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - ref, - type: "text", - value, - onChange: (e4) => setValue(e4.target.value), - onMouseDown: () => showPicker(), - onKeyDown - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-date-value", - onClick: (e4) => showPicker(e4) - }, date ? formatDate(props2.plugin, date, props2.propertyValue) : value)); + for (let i4 = 0; i4 < table._features.length; i4++) { + const feature = table._features[i4]; + Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table)); + } + return row; }; - -// src/components/ContextView/ContextBuilder/BuilderMetadataFields.tsx -var import_obsidian16 = require("obsidian"); -var allMetadataForFiles = (plugin, files) => { - return files.reduce((p3, c4) => { - const fm = frontMatterForFile(c4); - const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); - if (plugin.dataViewAPI()) { - const dvValues = plugin.dataViewAPI().page(c4.path); - const dvKeys = uniqCaseInsensitive( - Object.keys(dvValues != null ? dvValues : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 - ) ? true : false - ).filter((f4) => f4 != "file" && !fmKeys.some((g4) => f4 == g4)) - ); - return [ - ...p3, - ...fmKeys.map((f4) => ({ name: f4, type: "fm" })), - ...dvKeys.map((f4) => ({ name: f4, type: "dv" })) - ].filter(metadatTypeFilterPredicate); +function getCoreRowModel() { + return (table) => memo(() => [table.options.data], (data) => { + const rowModel = { + rows: [], + flatRows: [], + rowsById: {} + }; + const accessRows = function(originalRows, depth, parent) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + for (let i4 = 0; i4 < originalRows.length; i4++) { + const row = createRow(table, table._getRowId(originalRows[i4], i4, parent), originalRows[i4], i4, depth); + rowModel.flatRows.push(row); + rowModel.rowsById[row.id] = row; + rows.push(row); + if (table.options.getSubRows) { + var _row$originalSubRows; + row.originalSubRows = table.options.getSubRows(originalRows[i4], i4); + if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { + row.subRows = accessRows(row.originalSubRows, depth + 1, row); + } + } + } + return rows; + }; + rowModel.rows = accessRows(data); + return rowModel; + }, { + key: "getRowModel", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; + }, + onChange: () => { + table._autoResetPageIndex(); } - return [ - ...p3, - ...fmKeys.map((f4) => ({ name: f4, type: "fm" })) - ].filter(metadatTypeFilterPredicate); - }, []); -}; -var metadatTypeFilterPredicate = (value, index, self2) => { - return self2.findIndex( - (v3) => value["type"] == v3["type"] && value["name"] == v3["name"] - ) === index; -}; -var SyncMetadataComponent = (props2) => { - const cols = allMetadataForFiles( - props2.plugin, - props2.files.filter((f4) => f4 instanceof import_obsidian16.TFile) - ).filter( - (f4) => props2.columns ? !props2.columns.some((g4) => g4.name == f4.name) : true - ); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option" - }, cols.map((f4, index) => /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option-item", - onClick: () => props2.syncColumn(f4, "") - }, /* @__PURE__ */ Cn.createElement("div", null, f4.name), /* @__PURE__ */ Cn.createElement("div", { - className: `mk-icon-xsmall`, - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-plus"] + }); +} +function getGroupedRowModel() { + return (table) => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + return rowModel; } - })))); -}; - -// src/components/Spaces/SpaceEditor.tsx -var import_obsidian24 = require("obsidian"); - -// src/types/metadata.ts -var fileProps = { - "name": { - label: "File Name", - field: "name", - vType: "text", - type: "fileprop" - }, - "path": { - label: "Path", - field: "path", - vType: "text", - type: "fileprop" - }, - "parent": { - label: "Folder", - field: "parent", - vType: "text", - type: "fileprop" - }, - "sticker": { - label: "Sticker", - field: "sticker", - vType: "text", - type: "fileprop" - }, - "color": { - label: "Color", - field: "color", - vType: "text", - type: "fileprop" - }, - "ctime": { - label: "Created", - field: "ctime", - vType: "date", - type: "fileprop" - }, - "mtime": { - label: "Last Modified", - field: "mtime", - vType: "date", - type: "fileprop" - }, - "extension": { - label: "Extension", - field: "extension", - vType: "text", - type: "fileprop" - }, - "size": { - label: "Size", - field: "size", - vType: "number", - type: "fileprop" - } -}; -var fileMeta = { - "tags": { - label: "Tags", - field: "tags", - vType: "tags-multi", - type: "filemeta" - }, - "inlinks": { - label: "Linked Mentions", - field: "inlinks", - vType: "link-multi", - type: "filemeta" - }, - "outlinks": { - label: "Links", - field: "outlinks", - vType: "link-multi", - type: "filemeta" - } -}; - -// src/utils/contexts/predicate/filterFns/filterFnLabels.ts -var filterFnLabels = { - isEmpty: i18n_default.filterTypes.isEmpty, - isNotEmpty: i18n_default.filterTypes.isNotEmpty, - include: i18n_default.filterTypes.contains, - notInclude: i18n_default.filterTypes.notContains, - is: i18n_default.filterTypes.is, - isNot: i18n_default.filterTypes.isNot, - equal: "=", - isGreatThan: ">", - isLessThan: "<", - isLessThanOrEqual: "\u2264", - isGreatThanOrEqual: "\u2265", - dateBefore: i18n_default.filterTypes.before, - dateAfter: i18n_default.filterTypes.after, - isAnyInList: i18n_default.filterTypes.anyOf, - isNoneInList: i18n_default.filterTypes.noneOf, - isTrue: i18n_default.filterTypes.checked, - isFalse: i18n_default.filterTypes.unchecked -}; - -// src/components/ui/menus/newPropertyMenu.tsx -var import_obsidian17 = require("obsidian"); -var NewPropertyMenuComponent = (props2) => { - const [fieldName, setFieldName] = h2(""); - const [fieldSource, setFieldSource] = h2( - props2.fileMetadata ? "fm" : "" - ); - const [fieldValue, setFieldValue] = h2(""); - const [fieldType, setFieldType] = h2("text"); - const options = F2(() => { - const options2 = []; - if (props2.fileMetadata) { - options2.push({ - name: i18n_default.menu.fileMetadata, - value: "fm", - description: i18n_default.menu.fileMetadataDescription + const existingGrouping = grouping.filter((columnId) => table.getColumn(columnId)); + const groupedFlatRows = []; + const groupedRowsById = {}; + const groupUpRecursively = function(rows, depth, parentId) { + if (depth === void 0) { + depth = 0; + } + if (depth >= existingGrouping.length) { + return rows.map((row) => { + row.depth = depth; + groupedFlatRows.push(row); + groupedRowsById[row.id] = row; + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1); + } + return row; + }); + } + const columnId = existingGrouping[depth]; + const rowGroupsMap = groupBy(rows, columnId); + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { + let [groupingValue, groupedRows2] = _ref; + let id2 = `${columnId}:${groupingValue}`; + id2 = parentId ? `${parentId}>${id2}` : id2; + const subRows = groupUpRecursively(groupedRows2, depth + 1, id2); + const leafRows = depth ? flattenBy(groupedRows2, (row2) => row2.subRows) : groupedRows2; + const row = createRow(table, id2, leafRows[0].original, index, depth); + Object.assign(row, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: (columnId2) => { + if (existingGrouping.includes(columnId2)) { + if (row._valuesCache.hasOwnProperty(columnId2)) { + return row._valuesCache[columnId2]; + } + if (groupedRows2[0]) { + var _groupedRows$0$getVal; + row._valuesCache[columnId2] = (_groupedRows$0$getVal = groupedRows2[0].getValue(columnId2)) != null ? _groupedRows$0$getVal : void 0; + } + return row._valuesCache[columnId2]; + } + if (row._groupingValuesCache.hasOwnProperty(columnId2)) { + return row._groupingValuesCache[columnId2]; + } + const column = table.getColumn(columnId2); + const aggregateFn = column == null ? void 0 : column.getAggregationFn(); + if (aggregateFn) { + row._groupingValuesCache[columnId2] = aggregateFn(columnId2, leafRows, groupedRows2); + return row._groupingValuesCache[columnId2]; + } + } + }); + subRows.forEach((subRow) => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + }); + return row; }); - } - if (props2.contextPath) { - options2.push({ - name: folderPathToString(props2.contextPath), - value: "", - description: `All notes in ${folderPathToString(props2.contextPath)}` + return aggregatedGroupedRows; + }; + const groupedRows = groupUpRecursively(rowModel.rows, 0, ""); + groupedRows.forEach((subRow) => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + }); + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById + }; + }, { + key: "getGroupedRowModel", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; + }, + onChange: () => { + table._queue(() => { + table._autoResetExpanded(); + table._autoResetPageIndex(); }); } - options2.push( - ...props2.tags.map((f4) => ({ - name: f4, - value: f4, - description: `All notes tagged ${f4}` - })) - ); - return options2; - }, []); - const selectedType = (_9, value) => { - setFieldType(value[0]); - }; - const selectedValue = (value) => { - setFieldValue(value); - }; - const selectedSource = (_9, value) => { - setFieldSource(value[0]); - }; - const toggleMulti = () => { - const field = fieldTypes.find( - (f4) => f4.type == fieldType || f4.multiType == fieldType - ); - setFieldType(field.type == fieldType ? field.multiType : field.type); - }; - const selectType = (e4) => { - showSelectMenu(e4.target.getBoundingClientRect(), { - multi: false, - editable: false, - searchable: false, - saveOptions: selectedType, - value: [], - showAll: true, - options: fieldTypes.filter((f4) => fieldSource == "fm" ? f4.metadata : !f4.restricted).map((f4, i4) => ({ - id: i4 + 1, - name: f4.label, - value: f4.type, - icon: "" - })) - }); + }); +} +function groupBy(rows, columnId) { + const groupMap = /* @__PURE__ */ new Map(); + return rows.reduce((map, row) => { + const resKey = `${row.getValue(columnId)}`; + const previous = map.get(resKey); + if (!previous) { + map.set(resKey, [row]); + } else { + previous.push(row); + } + return map; + }, groupMap); +} +function getExpandedRowModel() { + return (table) => memo(() => [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; + } + if (!paginateExpandedRows) { + return rowModel; + } + return expandRows(rowModel); + }, { + key: "getExpandedRowModel", + debug: () => { + var _table$options$debugA; + return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable; + } + }); +} +function expandRows(rowModel) { + const expandedRows = []; + const handleRow = (row) => { + var _row$subRows; + expandedRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow); + } }; - const selectedContext = (value) => { - setFieldValue(value); + rowModel.rows.forEach(handleRow); + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById }; - const type = F2( - () => { - var _a2; - return (_a2 = fieldTypeForType(fieldType)) != null ? _a2 : fieldTypes[0]; +} + +// node_modules/@tanstack/react-table/build/lib/index.mjs +function flexRender(Comp, props2) { + return !Comp ? null : isReactComponent(Comp) ? /* @__PURE__ */ y(Comp, props2) : Comp; +} +function isReactComponent(component) { + return isClassComponent(component) || typeof component === "function" || isExoticComponent(component); +} +function isClassComponent(component) { + return typeof component === "function" && (() => { + const proto = Object.getPrototypeOf(component); + return proto.prototype && proto.prototype.isReactComponent; + })(); +} +function isExoticComponent(component) { + return typeof component === "object" && typeof component.$$typeof === "symbol" && ["react.memo", "react.forward_ref"].includes(component.$$typeof.description); +} +function useReactTable(options) { + const resolvedOptions = { + state: {}, + onStateChange: () => { }, - [fieldType] - ); - const selectSource = (e4) => { - showSelectMenu(e4.target.getBoundingClientRect(), { - multi: false, - editable: false, - searchable: false, - saveOptions: selectedSource, - value: [], - showAll: true, - options - }); + renderFallbackValue: null, + ...options }; - const saveField = () => { - if (fieldName.length == 0) { - new import_obsidian17.Notice(i18n_default.notice.noPropertyName); - return; + const [tableRef] = h2(() => ({ + current: createTable(resolvedOptions) + })); + const [state, setState] = h2(() => tableRef.current.initialState); + tableRef.current.setOptions((prev) => ({ + ...prev, + ...options, + state: { + ...state, + ...options.state + }, + onStateChange: (updater) => { + setState(updater); + options.onStateChange == null ? void 0 : options.onStateChange(updater); } - props2.saveField(fieldSource, { - name: fieldName, - type: fieldType, - value: fieldValue, - schemaId: props2.schemaId - }); - props2.hide(); + })); + return tableRef.current; +} + +// src/components/ContextView/DataTypeView/OptionCell.tsx +var import_lodash5 = __toESM(require_lodash()); +var OptionCell = (props2) => { + var _a2, _b2; + const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); + const initialOptions = [ + ...(_b2 = parseMultiString(props2.options).filter((f4) => f4).map((t4) => ({ name: t4, value: t4, removeable: true }))) != null ? _b2 : [], + ...initialValue.map((f4) => ({ name: f4, value: f4, removeable: true })) + ].filter(onlyUniqueProp("value")).filter((f4) => f4.value.length > 0); + const [options, setOptions] = h2(initialOptions); + const [value, setValue] = h2(initialValue); + p2(() => { + var _a3; + setValue( + (props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue]).filter((f4) => f4) + ); + }, [props2.initialValue]); + const removeValue = (v3) => { + const newValues = value.filter((f4) => f4 != v3); + setValue(newValues); + props2.saveOptions( + serializeMultiString(options.map((f4) => f4.value)), + serializeMultiString(newValues) + ); }; - const onKeyDown = (e4) => { - if (e4.key == "Enter") { - saveField(); + const removeOption = (option) => { + const newOptions = options.filter((f4) => f4.value != option); + const newValues = value.filter((f4) => f4 != option); + setOptions(newOptions); + setValue(newValues); + props2.saveOptions( + serializeMultiString(newOptions.map((f4) => f4.value)), + serializeMultiString(newValues) + ); + }; + const saveOptions = (_options, _value) => { + if (!props2.multi) { + setOptions( + _options.filter((f4) => f4.length > 0).map((t4) => ({ name: t4, value: t4, removeable: true })) + ); + setValue(_value); + props2.saveOptions( + serializeMultiString(_options.filter((f4) => f4.length > 0)), + serializeMultiString(_value) + ); + } else { + const newValues = (0, import_lodash5.uniq)([...value, _value[0]]); + setOptions( + _options.map((t4) => ({ name: t4, value: t4, removeable: true })) + ); + setValue(newValues); + props2.saveOptions( + serializeMultiString(_options.filter((f4) => f4.length > 0)), + serializeMultiString(newValues) + ); } }; - p2(() => { - setTimeout(() => { - input.current.focus(); - }, 50); - }, []); - const input = _2(null); - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item" - }, /* @__PURE__ */ Cn.createElement("span", null, "Name"), /* @__PURE__ */ Cn.createElement("input", { - type: "text", - ref: input, - onKeyDown, - onChange: (e4) => setFieldName(e4.target.value), - onMouseDown: (e4) => e4.stopPropagation(), - value: fieldName - })), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-separator" - }), options.length > 1 && /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => selectSource(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, "Context"), /* @__PURE__ */ Cn.createElement("span", null, fieldSource == "fm" ? "File Metadata" : fieldSource == "" ? props2.contextPath : fieldSource)), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => selectType(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, "Type"), /* @__PURE__ */ Cn.createElement("span", null, type.label)), type.multi ? /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item" - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.multiple), /* @__PURE__ */ Cn.createElement("input", { - type: "checkbox", - checked: fieldType == type.multiType, - onChange: () => toggleMulti() - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-separator" - }), fieldSource != "fm" ? /* @__PURE__ */ Cn.createElement(PropertyValueComponent, { - plugin: props2.plugin, - table: fieldSource, - fields: props2.fields, - fieldType, - value: fieldValue, - contextPath: props2.contextPath, - saveValue: selectedValue, - saveContext: selectedContext - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-separator" - }), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => saveField() - }, /* @__PURE__ */ Cn.createElement("span", null, "Save Property")), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => props2.hide() - }, /* @__PURE__ */ Cn.createElement("span", null, "Cancel"))); -}; -var showNewPropertyMenu = (plugin, position, tags, fields, saveField, schemaId, contextPath, fileMetadata) => { - const menu = new import_obsidian17.Menu(); - menu.setUseNativeMenu(false); - const frag = document.createDocumentFragment(); - const div = frag.createDiv(); - div.addEventListener("click", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("keydown", (e4) => { + const menuProps = () => ({ + multi: false, + editable: true, + value, + options: !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options, + saveOptions, + removeOption, + placeholder: i18n_default.labels.optionItemSelectPlaceholder, + searchable: true, + showAll: true, + onHide: () => props2.setEditMode(null) }); - const root = createRoot(div); - root.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(NewPropertyMenuComponent, { - plugin, - tags, - schemaId, - contextPath, - fields, - hide: () => menu.hide(), - saveField, - fileMetadata - })) - ); - menu.addItem((menuItem) => { - menuItem.setTitle(frag); - menuItem.dom.toggleClass("mk-properties", true); + return /* @__PURE__ */ Cn.createElement(OptionCellBase, { + baseClass: "mk-cell-option", + value, + menuProps, + multi: props2.multi, + editMode: props2.editMode, + removeValue }); - const keys = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys.length; i4++) { - if (keys[i4].key != "Escape") { - menu.scope.unregister(keys[i4]); - } - } - menu.showAtPosition(position); - return menu; }; - -// src/hooks/useCombinedRef.tsx -function useCombinedRefs2(...refs) { - return F2( - () => (node) => { - refs.forEach((ref) => ref(node)); - }, - refs - ); -} - -// src/components/ContextView/TableView/ColumnHeader.tsx -var filePropTypes = [ - { - name: i18n_default.properties.fileProperty.createdTime, - value: "ctime" - }, - { - name: i18n_default.properties.fileProperty.modifiedTime, - value: "mtime" - }, - { - name: i18n_default.properties.fileProperty.extension, - value: "extension" - }, - { - name: i18n_default.properties.fileProperty.size, - value: "size" - }, - { - name: i18n_default.properties.fileProperty.parentFolder, - value: "folder" - }, - { - name: "Links", - value: "links" - }, - { - name: "Tags", - value: "tags" - }, - { - name: "Spaces", - value: "spaces" - } -]; -var ColumnHeader = (props2) => { - const [field, setField] = h2(props2.column); - const menuRef = _2(null); +var OptionCellBase = (props2) => { const { - loadContextFields, - contextInfo, - predicate, - tableData, - tagContexts, - contextTable, - cols, - newColumn, - saveColumn, - hideColumn, - sortColumn, - delColumn - } = q2(MDBContext); + value, + menuProps, + removeValue, + getLabelString, + openItem, + valueClass + } = props2; + const menuRef = _2(null); p2(() => { - setField(props2.column); - }, [props2.column]); - const { - attributes, - listeners, - setNodeRef: setDraggableNodeRef, - transform - } = useDraggable({ - id: field.name + field.table, - data: { name: field.name } - }); - const { setNodeRef: setDroppableNodeRef } = useDroppable({ - id: field.name + field.table, - data: { name: field.name } - }); - const saveField = (field2) => { - if (field2.name.length > 0) { - if (field2.name != props2.column.name || field2.type != props2.column.type || field2.value != props2.column.value || field2.attrs != props2.column.attrs) { - const saveResult = saveColumn(field2, props2.column); - if (saveResult) { - if (props2.isNew) { - setField(props2.column); - } - } - } + if (props2.editMode == 2) { + if (!menuRef.current) + showMenu(); } + }, [props2.editMode]); + const ref = _2(null); + const showMenu = () => { + const offset = ref.current.getBoundingClientRect(); + menuRef.current = showSelectMenu( + { x: offset.left - 4, y: offset.bottom - 4 }, + menuProps() + ); }; - const saveContext = (field2, value) => { - const newContext = value[0]; - connectContext(props2.plugin, value[0], contextInfo.dbPath); - initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { - if (f4) { - return insertContextItems( - props2.plugin, - optionValuesForColumn( - field2.name, - field2.table == "" ? tableData : contextTable[field2.table] - ), - newContext - ); - } - }).then((f4) => loadContextFields(newContext)); - const newField = { - ...field2, - value: newContext != null ? newContext : "" + const editable = props2.editMode > 0; + return /* @__PURE__ */ Cn.createElement("div", { + className: props2.baseClass, + ref + }, value.length > 0 ? value.map((o3) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option-item" + }, (getLabelString ? getLabelString(o3).length > 0 : o3.length > 0) ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: valueClass && valueClass(o3), + onClick: () => openItem && openItem(o3) + }, getLabelString ? getLabelString(o3) : o3), editable && props2.multi ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + onClick: () => removeValue(o3), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-close"] + } + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)) : /* @__PURE__ */ Cn.createElement("div", null, i18n_default.labels.select), editable && !props2.multi && value.length > 0 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => editable && !props2.multi && showMenu(), + className: "mk-cell-option-select mk-icon-xxsmall mk-icon-rotated", + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))) : editable && !props2.multi ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option-item" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => !props2.multi && showMenu() + }, i18n_default.labels.select)) : props2.editMode == -1 ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option-item mk-cell-empty" + }, /* @__PURE__ */ Cn.createElement("div", null, i18n_default.menu.none)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), editable && props2.multi ? /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => editable && showMenu(), + className: "mk-cell-option-new mk-icon-small", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); +}; + +// src/components/ContextView/DataTypeView/ContextCell.tsx +var ContextCell = (props2) => { + var _a2, _b2, _c2; + const stringValueToLink = (strings) => strings.map((f4) => { + return { + label: parseLinkDisplayString(f4), + path: parseLinkString(f4) }; - setField(newField); - saveColumn(newField, props2.column); + }); + const initialValue = stringValueToLink( + props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue] + ); + const ref = _2(null); + const options = stringValueToLink( + (_c2 = (_b2 = props2.contextTable) == null ? void 0 : _b2.rows.map((f4) => f4[FilePropertyName])) != null ? _c2 : [] + ).map((f4) => ({ + name: f4.label, + value: f4.path + })); + const [value, setValue] = h2(initialValue); + const removeValue = (v3) => { + const newValues = value.filter((f4) => f4.path != v3.path); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues.map((f4) => f4.path))); }; - const showNewMenu = (e4) => { - const offset = ref.current.getBoundingClientRect(); - showNewPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - tagContexts, - cols, - (source, field2) => newColumn({ ...field2, table: source }), - tableData.schema.id, - contextInfo.contextPath, - false + p2(() => { + var _a3; + setValue( + stringValueToLink( + props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue] + ) ); - }; - const toggleMenu = (e4) => { - if (props2.isNew) { - showNewMenu(e4); - } else { - const offset = e4.target.getBoundingClientRect(); - const options = optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] - ); - showPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - props2.editable, - options, - field, - cols, - contextInfo.contextPath, - saveField, - saveContext, - hideColumn, - delColumn, - sortColumn, - predicate.colsHidden.includes(field.name + field.table) + }, [props2.initialValue]); + const saveOptions = (_options, _value) => { + insertContextItems(props2.plugin, _options, props2.contextTag); + if (!props2.multi) { + setValue( + _value.map((f4) => ({ + path: f4, + label: fileNameToString(folderPathToString(f4)) + })) ); + props2.saveValue(serializeMultiString(_value)); + } else { + const newValue = _value[0]; + if (newValue) { + const newValues = uniq([...value.map((f4) => f4.path), newValue]); + setValue( + newValues.map((f4) => ({ + label: fileNameToString(folderPathToString(f4)), + path: f4 + })) + ); + props2.saveValue(serializeMultiString(newValues)); + } } }; - const ref = _2(null); - const setNodeRef = useCombinedRefs2(setDroppableNodeRef, setDraggableNodeRef); - return /* @__PURE__ */ Cn.createElement("div", { - ref: setNodeRef, - ...listeners, - ...attributes, - className: "mk-col-header", - onClick: (e4) => { - toggleMenu(e4); + const openLink = async (o3) => { + const file = getAbstractFileAtPath(app, o3.path); + if (file) { + openAFile(file, props2.plugin, false); } - }, /* @__PURE__ */ Cn.createElement("div", { - ref - }, props2.column.name.length > 0 ? field.name : "+", /* @__PURE__ */ Cn.createElement("span", { - className: "mk-col-header-context", - "aria-label": props2.column.table.length > 0 ? props2.column.table : "" - }, props2.column.table.length > 0 ? "#" : ""))); -}; - -// src/components/ui/menus/propertyMenu.tsx -var import_obsidian18 = require("obsidian"); -var PropertyValueComponent = (props2) => { - const selectContext = (e4) => { - var _a2; - showSelectMenu(e4.target.getBoundingClientRect(), { - multi: false, - editable: true, - searchable: true, - saveOptions: (_9, v3) => props2.saveContext(v3[0]), - placeholder: i18n_default.labels.propertyContext, - value: [(_a2 = props2.value) != null ? _a2 : ""], - options: loadTags(props2.plugin).map((m5) => ({ name: m5, value: m5 })) - }); - }; - const selectFileProp = (e4) => { - var _a2; - const properties2 = (_a2 = props2.plugin.index.contextsIndex.get(props2.contextPath)) == null ? void 0 : _a2.cols.filter( - (f4) => f4.type == "file" || f4.type == "link" || f4.type == "context" - ).reduce((p3, c4) => { - var _a3, _b2; - return [ - ...p3, - ...c4.type == "file" || c4.type == "link" ? filePropTypes.map((f4) => ({ - name: c4.name + "." + f4.name, - value: c4.name + "." + f4.value - })) : (_b2 = (_a3 = props2.plugin.index.contextsIndex.get(c4.value)) == null ? void 0 : _a3.cols.filter((f4) => f4.hidden != "true").map((f4) => ({ - name: c4.name + "." + f4.name, - value: c4.name + "." + f4.name - }))) != null ? _b2 : [] - ]; - }, []); - showSelectMenu(e4.target.getBoundingClientRect(), { - multi: false, - editable: false, - searchable: false, - saveOptions: (_9, v3) => props2.saveValue(v3[0]), - value: [], - options: properties2, - showAll: true - }); }; - const selectDateFormat = (e4) => { - const formats = [ - { - name: "2020-04-21", - value: "yyyy-MM-dd" - }, - { - name: "Apr 21, 2020", - value: "MMM d, yyyy" - }, - { - name: "Tue Apr 21, 2020", - value: "EEE MMM d, yyyy" - } - ]; - showSelectMenu(e4.target.getBoundingClientRect(), { + const menuProps = () => { + const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; + return { multi: false, editable: true, - searchable: false, - saveOptions: (_9, v3) => props2.saveValue(v3[0]), - value: [], - options: formats, + value: value.map((f4) => f4.path), + options: _options, + saveOptions, + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, showAll: true, - placeholder: i18n_default.labels.selectDateFormat - }); - }; - return props2.fieldType.startsWith("date") ? /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => selectDateFormat(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.dateFormat), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : props2.fieldType.startsWith("context") ? /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => selectContext(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyContext), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : props2.fieldType == "fileprop" ? /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => selectFileProp(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyFileProp), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); -}; -var PropertyMenuComponent = (props2) => { - var _a2; - const [field, setField] = h2(props2.field); - const selectedType = (_9, value) => { - const newField = { - ...field, - type: value[0], - value: getNewValueForType(field, value) - }; - setField(newField); - props2.saveField(newField); - }; - const selectedValue = (value) => { - const newField = { ...field, value }; - setField(newField); - props2.saveField(newField); - }; - const selectedContext = (context) => { - const newField = { ...field, value: context }; - setField(newField); - props2.saveContext(newField, [context]); - }; - const toggleMulti = () => { - const newField = { - ...field, - type: field.type == fieldType.multiType ? fieldType.type : fieldType.multiType + onHide: () => props2.setEditMode(null) }; - setField(newField); - props2.saveField(newField); }; - const fieldType = (_a2 = fieldTypeForType(field.type)) != null ? _a2 : fieldTypes[0]; - const getNewValueForType = (f4, value) => { - if (value[0].startsWith("option")) { - return serializeMultiString(props2.options); + return /* @__PURE__ */ Cn.createElement(OptionCellBase, { + baseClass: "mk-cell-context", + menuProps, + openItem: openLink, + getLabelString: (o3) => o3.label, + value, + multi: props2.multi, + editMode: props2.editMode, + removeValue + }); +}; + +// src/components/ui/menus/datePickerMenu.tsx +var import_obsidian17 = require("obsidian"); + +// node_modules/react-day-picker/dist/index.esm.js +var __assign = function() { + __assign = Object.assign || function __assign3(t4) { + for (var s5, i4 = 1, n2 = arguments.length; i4 < n2; i4++) { + s5 = arguments[i4]; + for (var p3 in s5) + if (Object.prototype.hasOwnProperty.call(s5, p3)) + t4[p3] = s5[p3]; } - return value[0] == fieldType.type || value[0] == fieldType.multiType ? f4.value : null; - }; - const selectType = (e4) => { - showSelectMenu(e4.target.getBoundingClientRect(), { - multi: false, - editable: false, - searchable: false, - saveOptions: selectedType, - value: [], - showAll: true, - options: fieldTypes.filter((f4) => !f4.restricted).map((f4, i4) => ({ - id: i4 + 1, - name: f4.label, - value: f4.type, - icon: "" - })) - }); + return t4; }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item", - onClick: (e4) => selectType(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyType), /* @__PURE__ */ Cn.createElement("span", null, fieldType.label)), fieldType.multi ? /* @__PURE__ */ Cn.createElement("div", { - className: "menu-item" - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.multiple), /* @__PURE__ */ Cn.createElement("input", { - type: "checkbox", - checked: field.type == fieldType.multiType, - onChange: () => toggleMulti() - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-separator" - }), /* @__PURE__ */ Cn.createElement(PropertyValueComponent, { - plugin: props2.plugin, - table: field.table, - fields: props2.fields, - fieldType: fieldType.type, - value: field.value, - contextPath: props2.contextPath, - saveValue: selectedValue, - saveContext: selectedContext - })); + return __assign.apply(this, arguments); }; -var showPropertyMenu = (plugin, position, editable, options, field, fields, contextPath, saveField, saveContext, hide, deleteColumn, sortColumn, hidden) => { - const menu = new import_obsidian18.Menu(); - menu.setUseNativeMenu(false); - if (editable) { - menu.addItem((menuItem) => { - var _a2; - inputMenuItem( - menuItem, - (_a2 = field == null ? void 0 : field.name) != null ? _a2 : "", - (value) => saveField({ ...field, name: value }) - ); - menuItem.setIcon("type"); - }); - menu.addSeparator(); - const frag = document.createDocumentFragment(); - const div = frag.createDiv(); - div.addEventListener("click", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("keydown", (e4) => { - }); - const root = createRoot(div); - root.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(PropertyMenuComponent, { - plugin, - field, - fields, - contextPath, - options, - saveField, - saveContext - })) - ); - menu.addItem((menuItem) => { - menuItem.setTitle(frag); - menuItem.dom.toggleClass("mk-properties", true); - }); - menu.addSeparator(); - if (!hidden) { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.hideProperty); - menuItem.onClick(() => { - hide(field, true); - }); - menuItem.setIcon("eye-off"); - }); - } else { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.unhideProperty); - menuItem.onClick(() => { - hide(field, false); - }); - menuItem.setIcon("eye"); - }); +function __rest(s5, e4) { + var t4 = {}; + for (var p3 in s5) + if (Object.prototype.hasOwnProperty.call(s5, p3) && e4.indexOf(p3) < 0) + t4[p3] = s5[p3]; + if (s5 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i4 = 0, p3 = Object.getOwnPropertySymbols(s5); i4 < p3.length; i4++) { + if (e4.indexOf(p3[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s5, p3[i4])) + t4[p3[i4]] = s5[p3[i4]]; + } + return t4; +} +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) + for (var i4 = 0, l3 = from.length, ar; i4 < l3; i4++) { + if (ar || !(i4 in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i4); + ar[i4] = from[i4]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} +function isDayPickerMultiple(props2) { + return props2.mode === "multiple"; +} +function isDayPickerRange(props2) { + return props2.mode === "range"; +} +function isDayPickerSingle(props2) { + return props2.mode === "single"; +} +var defaultClassNames = { + root: "rdp", + multiple_months: "rdp-multiple_months", + with_weeknumber: "rdp-with_weeknumber", + vhidden: "rdp-vhidden", + button_reset: "rdp-button_reset", + button: "rdp-button", + caption: "rdp-caption", + caption_start: "rdp-caption_start", + caption_end: "rdp-caption_end", + caption_between: "rdp-caption_between", + caption_label: "rdp-caption_label", + caption_dropdowns: "rdp-caption_dropdowns", + dropdown: "rdp-dropdown", + dropdown_month: "rdp-dropdown_month", + dropdown_year: "rdp-dropdown_year", + dropdown_icon: "rdp-dropdown_icon", + months: "rdp-months", + month: "rdp-month", + table: "rdp-table", + tbody: "rdp-tbody", + tfoot: "rdp-tfoot", + head: "rdp-head", + head_row: "rdp-head_row", + head_cell: "rdp-head_cell", + nav: "rdp-nav", + nav_button: "rdp-nav_button", + nav_button_previous: "rdp-nav_button_previous", + nav_button_next: "rdp-nav_button_next", + nav_icon: "rdp-nav_icon", + row: "rdp-row", + weeknumber: "rdp-weeknumber", + cell: "rdp-cell", + day: "rdp-day", + day_today: "rdp-day_today", + day_outside: "rdp-day_outside", + day_selected: "rdp-day_selected", + day_disabled: "rdp-day_disabled", + day_hidden: "rdp-day_hidden", + day_range_start: "rdp-day_range_start", + day_range_end: "rdp-day_range_end", + day_range_middle: "rdp-day_range_middle" +}; +function formatCaption(month, options) { + return format(month, "LLLL y", options); +} +function formatDay(day, options) { + return format(day, "d", options); +} +function formatMonthCaption(month, options) { + return format(month, "LLLL", options); +} +function formatWeekNumber(weekNumber) { + return "".concat(weekNumber); +} +function formatWeekdayName(weekday, options) { + return format(weekday, "cccccc", options).toUpperCase(); +} +function formatYearCaption(year, options) { + return format(year, "yyyy", options); +} +var formatters3 = /* @__PURE__ */ Object.freeze({ + __proto__: null, + formatCaption, + formatDay, + formatMonthCaption, + formatWeekNumber, + formatWeekdayName, + formatYearCaption +}); +var labelDay = function(day, activeModifiers, options) { + return format(day, "do MMMM (EEEE)", options); +}; +var labelMonthDropdown = function() { + return "Month: "; +}; +var labelNext = function() { + return "Go to next month"; +}; +var labelPrevious = function() { + return "Go to previous month"; +}; +var labelWeekday = function(day, options) { + return format(day, "cccc", options); +}; +var labelWeekNumber = function(n2) { + return "Week n. ".concat(n2); +}; +var labelYearDropdown = function() { + return "Year: "; +}; +var labels = /* @__PURE__ */ Object.freeze({ + __proto__: null, + labelDay, + labelMonthDropdown, + labelNext, + labelPrevious, + labelWeekNumber, + labelWeekday, + labelYearDropdown +}); +function getDefaultContextValues() { + var captionLayout = "buttons"; + var classNames9 = defaultClassNames; + var locale2 = en_US_default; + var modifiersClassNames = {}; + var modifiers = {}; + var numberOfMonths = 1; + var styles = {}; + var today = new Date(); + return { + captionLayout, + classNames: classNames9, + formatters: formatters3, + labels, + locale: locale2, + modifiersClassNames, + modifiers, + numberOfMonths, + styles, + today, + mode: "default" + }; +} +function parseFromToProps(props2) { + var fromYear = props2.fromYear, toYear = props2.toYear, fromMonth = props2.fromMonth, toMonth = props2.toMonth; + var fromDate = props2.fromDate, toDate2 = props2.toDate; + if (fromMonth) { + fromDate = startOfMonth(fromMonth); + } else if (fromYear) { + fromDate = new Date(fromYear, 0, 1); + } + if (toMonth) { + toDate2 = endOfMonth(toMonth); + } else if (toYear) { + toDate2 = new Date(toYear, 11, 31); + } + return { + fromDate: fromDate ? startOfDay(fromDate) : void 0, + toDate: toDate2 ? startOfDay(toDate2) : void 0 + }; +} +var DayPickerContext = F(void 0); +function DayPickerProvider(props2) { + var _a2; + var initialProps = props2.initialProps; + var defaultContextValues = getDefaultContextValues(); + var _b2 = parseFromToProps(initialProps), fromDate = _b2.fromDate, toDate2 = _b2.toDate; + var captionLayout = (_a2 = initialProps.captionLayout) !== null && _a2 !== void 0 ? _a2 : defaultContextValues.captionLayout; + if (captionLayout !== "buttons" && (!fromDate || !toDate2)) { + captionLayout = "buttons"; + } + var onSelect; + if (isDayPickerSingle(initialProps) || isDayPickerMultiple(initialProps) || isDayPickerRange(initialProps)) { + onSelect = initialProps.onSelect; + } + var value = __assign(__assign(__assign({}, defaultContextValues), initialProps), { captionLayout, classNames: __assign(__assign({}, defaultContextValues.classNames), initialProps.classNames), components: __assign({}, initialProps.components), formatters: __assign(__assign({}, defaultContextValues.formatters), initialProps.formatters), fromDate, labels: __assign(__assign({}, defaultContextValues.labels), initialProps.labels), mode: initialProps.mode || defaultContextValues.mode, modifiers: __assign(__assign({}, defaultContextValues.modifiers), initialProps.modifiers), modifiersClassNames: __assign(__assign({}, defaultContextValues.modifiersClassNames), initialProps.modifiersClassNames), onSelect, styles: __assign(__assign({}, defaultContextValues.styles), initialProps.styles), toDate: toDate2 }); + return Cn.createElement(DayPickerContext.Provider, { value }, props2.children); +} +function useDayPicker() { + var context = q2(DayPickerContext); + if (!context) { + throw new Error("useDayPicker must be used within a DayPickerProvider."); + } + return context; +} +function CaptionLabel(props2) { + var _a2 = useDayPicker(), locale2 = _a2.locale, classNames9 = _a2.classNames, styles = _a2.styles, formatCaption2 = _a2.formatters.formatCaption; + return Cn.createElement("div", { className: classNames9.caption_label, style: styles.caption_label, "aria-live": "polite", role: "presentation", id: props2.id }, formatCaption2(props2.displayMonth, { locale: locale2 })); +} +function IconDropdown(props2) { + return Cn.createElement( + "svg", + __assign({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, props2), + Cn.createElement("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) + ); +} +function Dropdown(props2) { + var _a2, _b2; + var onChange = props2.onChange, value = props2.value, children = props2.children, caption = props2.caption, className = props2.className, style = props2.style; + var dayPicker = useDayPicker(); + var IconDropdownComponent = (_b2 = (_a2 = dayPicker.components) === null || _a2 === void 0 ? void 0 : _a2.IconDropdown) !== null && _b2 !== void 0 ? _b2 : IconDropdown; + return Cn.createElement( + "div", + { className, style }, + Cn.createElement("span", { className: dayPicker.classNames.vhidden }, props2["aria-label"]), + Cn.createElement("select", { name: props2.name, "aria-label": props2["aria-label"], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value, onChange }, children), + Cn.createElement( + "div", + { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true" }, + caption, + Cn.createElement(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon }) + ) + ); +} +function MonthsDropdown(props2) { + var _a2; + var _b2 = useDayPicker(), fromDate = _b2.fromDate, toDate2 = _b2.toDate, styles = _b2.styles, locale2 = _b2.locale, formatMonthCaption2 = _b2.formatters.formatMonthCaption, classNames9 = _b2.classNames, components = _b2.components, labelMonthDropdown2 = _b2.labels.labelMonthDropdown; + if (!fromDate) + return Cn.createElement(Cn.Fragment, null); + if (!toDate2) + return Cn.createElement(Cn.Fragment, null); + var dropdownMonths = []; + if (isSameYear(fromDate, toDate2)) { + var date = startOfMonth(fromDate); + for (var month = fromDate.getMonth(); month <= toDate2.getMonth(); month++) { + dropdownMonths.push(setMonth(date, month)); + } + } else { + var date = startOfMonth(new Date()); + for (var month = 0; month <= 11; month++) { + dropdownMonths.push(setMonth(date, month)); } - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteProperty); - menuItem.onClick(() => { - deleteColumn(field); - }); - menuItem.setIcon("trash-2"); - }); - menu.addSeparator(); } - const sortableString = normalizedSortForType(field.type, false); - if (sortableString) { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortAscending); - menuItem.setIcon("sort-asc"); - menuItem.onClick(() => { - sortColumn({ - field: field.name + field.table, - fn: normalizedSortForType(field.type, false) - }); - }); - }); - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortDescending); - menuItem.setIcon("sort-desc"); - menuItem.onClick(() => { - sortColumn({ - field: field.name + field.table, - fn: normalizedSortForType(field.type, true) - }); - }); - }); + var handleChange = function(e4) { + var selectedMonth = Number(e4.target.value); + var newMonth = setMonth(startOfMonth(props2.displayMonth), selectedMonth); + props2.onChange(newMonth); + }; + var DropdownComponent2 = (_a2 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a2 !== void 0 ? _a2 : Dropdown; + return Cn.createElement(DropdownComponent2, { name: "months", "aria-label": labelMonthDropdown2(), className: classNames9.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props2.displayMonth.getMonth(), caption: formatMonthCaption2(props2.displayMonth, { locale: locale2 }) }, dropdownMonths.map(function(m5) { + return Cn.createElement("option", { key: m5.getMonth(), value: m5.getMonth() }, formatMonthCaption2(m5, { locale: locale2 })); + })); +} +function YearsDropdown(props2) { + var _a2; + var displayMonth = props2.displayMonth; + var _b2 = useDayPicker(), fromDate = _b2.fromDate, toDate2 = _b2.toDate, locale2 = _b2.locale, styles = _b2.styles, classNames9 = _b2.classNames, components = _b2.components, formatYearCaption2 = _b2.formatters.formatYearCaption, labelYearDropdown2 = _b2.labels.labelYearDropdown; + var years = []; + if (!fromDate) + return Cn.createElement(Cn.Fragment, null); + if (!toDate2) + return Cn.createElement(Cn.Fragment, null); + var fromYear = fromDate.getFullYear(); + var toYear = toDate2.getFullYear(); + for (var year = fromYear; year <= toYear; year++) { + years.push(setYear(startOfYear(new Date()), year)); } - menu.showAtPosition(position); - return menu; -}; - -// src/components/ContextView/ContextBuilder/ContextBuilderView.tsx -var import_classnames = __toESM(require_classnames()); - -// src/components/ContextView/TagsView/TagsView.tsx -var import_obsidian19 = require("obsidian"); -var TagsView = (props2) => { - const showTagMenu = (e4, tag) => { - e4.stopPropagation(); - e4.preventDefault(); - const menu = new import_obsidian19.Menu(); - menu.addItem((menuItem) => { - menuItem.setIcon("hash"); - menuItem.setTitle(i18n_default.menu.openTag); - menuItem.onClick(() => { - openTagContext(tag, props2.plugin, e4.metaKey); - }); - }); - if (props2.removeTag) - menu.addItem((menuItem) => { - menuItem.setIcon("trash"); - menuItem.setTitle(i18n_default.menu.removeTag); - menuItem.onClick(() => { - props2.removeTag(tag); - }); - }); - const offset = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + var handleChange = function(e4) { + var newMonth = setYear(startOfMonth(displayMonth), Number(e4.target.value)); + props2.onChange(newMonth); }; - const showContextMenu = (e4) => { - const offset = e4.target.getBoundingClientRect(); - const f4 = loadTags(props2.plugin); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: true, - value: [], - options: f4.map((m5) => ({ name: m5, value: m5 })), - saveOptions: (_9, value) => props2.addTag(value[0]), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); + var DropdownComponent2 = (_a2 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a2 !== void 0 ? _a2 : Dropdown; + return Cn.createElement(DropdownComponent2, { name: "years", "aria-label": labelYearDropdown2(), className: classNames9.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption2(displayMonth, { locale: locale2 }) }, years.map(function(year2) { + return Cn.createElement("option", { key: year2.getFullYear(), value: year2.getFullYear() }, formatYearCaption2(year2, { locale: locale2 })); + })); +} +function useControlledValue(defaultValue2, controlledValue) { + var _a2 = h2(defaultValue2), uncontrolledValue = _a2[0], setValue = _a2[1]; + var value = controlledValue === void 0 ? uncontrolledValue : controlledValue; + return [value, setValue]; +} +function getInitialMonth(context) { + var month = context.month, defaultMonth = context.defaultMonth, today = context.today; + var initialMonth = month || defaultMonth || today || new Date(); + var toDate2 = context.toDate, fromDate = context.fromDate, _a2 = context.numberOfMonths, numberOfMonths = _a2 === void 0 ? 1 : _a2; + if (toDate2 && differenceInCalendarMonths(toDate2, initialMonth) < 0) { + var offset = -1 * (numberOfMonths - 1); + initialMonth = addMonths(toDate2, offset); + } + if (fromDate && differenceInCalendarMonths(initialMonth, fromDate) < 0) { + initialMonth = fromDate; + } + return startOfMonth(initialMonth); +} +function useNavigationState() { + var context = useDayPicker(); + var initialMonth = getInitialMonth(context); + var _a2 = useControlledValue(initialMonth, context.month), month = _a2[0], setMonth2 = _a2[1]; + var goToMonth = function(date) { + var _a3; + if (context.disableNavigation) + return; + var month2 = startOfMonth(date); + setMonth2(month2); + (_a3 = context.onMonthChange) === null || _a3 === void 0 ? void 0 : _a3.call(context, month2); }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-tag-selector" - }, props2.tags.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, - onContextMenu: (e4) => showTagMenu(e4, f4), - onClick: (e4) => !props2.canOpen ? showTagMenu(e4, f4) : openTagContext(f4, props2.plugin, e4.metaKey) - }, /* @__PURE__ */ Cn.createElement("span", { - className: "cm-hashtag cm-hashtag-begin" - }, "#"), /* @__PURE__ */ Cn.createElement("span", { - className: "cm-hashtag cm-hashtag-end" - }, stringFromTag(f4)))), props2.addTag && /* @__PURE__ */ Cn.createElement("div", { - "aria-label": i18n_default.buttons.addTag, - onClick: (e4) => showContextMenu(e4) - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - }))); -}; - -// src/components/ContextView/ContextBuilder/TagSelector.tsx -var TagSelector = (props2) => { - const { - data, - tagContexts, - dbFileExists, - setContextTable, - saveDB: saveDB2, - tableData, - cols, - contextTable, - dbSchema, - contextInfo, - saveContextDB, - saveSchema, - loadContextFields - } = q2(MDBContext); - const removeContext = (value) => { - const tags = tagContexts.filter((f4) => value != f4); - saveSchema({ - ...dbSchema, - def: updateTagsForDefString(dbSchema.def, tags) + return [month, goToMonth]; +} +function getDisplayMonths(month, _a2) { + var reverseMonths = _a2.reverseMonths, numberOfMonths = _a2.numberOfMonths; + var start = startOfMonth(month); + var end = startOfMonth(addMonths(start, numberOfMonths)); + var monthsDiff = differenceInCalendarMonths(end, start); + var months = []; + for (var i4 = 0; i4 < monthsDiff; i4++) { + var nextMonth = addMonths(start, i4); + months.push(nextMonth); + } + if (reverseMonths) + months = months.reverse(); + return months; +} +function getNextMonth(startingMonth, options) { + if (options.disableNavigation) { + return void 0; + } + var toDate2 = options.toDate, pagedNavigation = options.pagedNavigation, _a2 = options.numberOfMonths, numberOfMonths = _a2 === void 0 ? 1 : _a2; + var offset = pagedNavigation ? numberOfMonths : 1; + var month = startOfMonth(startingMonth); + if (!toDate2) { + return addMonths(month, offset); + } + var monthsDiff = differenceInCalendarMonths(toDate2, startingMonth); + if (monthsDiff < numberOfMonths) { + return void 0; + } + return addMonths(month, offset); +} +function getPreviousMonth(startingMonth, options) { + if (options.disableNavigation) { + return void 0; + } + var fromDate = options.fromDate, pagedNavigation = options.pagedNavigation, _a2 = options.numberOfMonths, numberOfMonths = _a2 === void 0 ? 1 : _a2; + var offset = pagedNavigation ? numberOfMonths : 1; + var month = startOfMonth(startingMonth); + if (!fromDate) { + return addMonths(month, -offset); + } + var monthsDiff = differenceInCalendarMonths(month, fromDate); + if (monthsDiff <= 0) { + return void 0; + } + return addMonths(month, -offset); +} +var NavigationContext = F(void 0); +function NavigationProvider(props2) { + var dayPicker = useDayPicker(); + var _a2 = useNavigationState(), currentMonth = _a2[0], goToMonth = _a2[1]; + var displayMonths = getDisplayMonths(currentMonth, dayPicker); + var nextMonth = getNextMonth(currentMonth, dayPicker); + var previousMonth = getPreviousMonth(currentMonth, dayPicker); + var isDateDisplayed = function(date) { + return displayMonths.some(function(displayMonth) { + return isSameMonth(date, displayMonth); }); }; - const addTag2 = async (tag) => { - const tags = uniq([...tagContexts, tag]); - tags.forEach((tag2) => { - initiateContextIfNotExists(props2.plugin, tag2).then( - (f4) => loadContextFields(tag2) - ); - }); - saveSchema({ - ...dbSchema, - def: updateTagsForDefString(dbSchema.def, tags) - }); - connectContext(props2.plugin, tag, contextInfo.dbPath); + var goToDate = function(date, refDate) { + if (isDateDisplayed(date)) { + return; + } + if (refDate && isBefore(date, refDate)) { + goToMonth(addMonths(date, 1 + dayPicker.numberOfMonths * -1)); + } else { + goToMonth(date); + } }; - return /* @__PURE__ */ Cn.createElement(TagsView, { - plugin: props2.plugin, - tags: tagContexts, - canOpen: false, - addTag: props2.canAdd && addTag2, - removeTag: removeContext - }); -}; - -// src/components/ContextView/ContextBuilder/ContextDesigner.tsx -var ContextDesigner = (props2) => { - const { sortedColumns, predicate, savePredicate } = q2(MDBContext); - const [activeId, setActiveId] = h2(""); - const [overId, setOverId] = h2(""); - const items = sortedColumns.map((f4) => ({ ...f4, id: f4.name + f4.table })); - const sensors = useSensors( - useSensor(MouseSensor, { - activationConstraint: { - distance: 10 - } - }), - useSensor(TouchSensor, { - activationConstraint: { - delay: 250, - tolerance: 5 - } - }), - useSensor(KeyboardSensor, { - coordinateGetter: sortableKeyboardCoordinates - }) + var value = { + currentMonth, + displayMonths, + goToMonth, + goToDate, + previousMonth, + nextMonth, + isDateDisplayed + }; + return Cn.createElement(NavigationContext.Provider, { value }, props2.children); +} +function useNavigation() { + var context = q2(NavigationContext); + if (!context) { + throw new Error("useNavigation must be used within a NavigationProvider"); + } + return context; +} +function CaptionDropdowns(props2) { + var _a2; + var _b2 = useDayPicker(), classNames9 = _b2.classNames, styles = _b2.styles, components = _b2.components; + var goToMonth = useNavigation().goToMonth; + var handleMonthChange = function(newMonth) { + goToMonth(newMonth); + }; + var CaptionLabelComponent = (_a2 = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a2 !== void 0 ? _a2 : CaptionLabel; + var captionLabel = Cn.createElement(CaptionLabelComponent, { id: props2.id, displayMonth: props2.displayMonth }); + return Cn.createElement( + "div", + { className: classNames9.caption_dropdowns, style: styles.caption_dropdowns }, + Cn.createElement("div", { className: classNames9.vhidden }, captionLabel), + Cn.createElement(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props2.displayMonth }), + Cn.createElement(YearsDropdown, { onChange: handleMonthChange, displayMonth: props2.displayMonth }) ); - const resetState = () => { - setActiveId(null); - setOverId(null); +} +function IconLeft(props2) { + return Cn.createElement( + "svg", + __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props2), + Cn.createElement("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) + ); +} +function IconRight(props2) { + return Cn.createElement( + "svg", + __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props2), + Cn.createElement("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) + ); +} +var Button = k3(function(props2, ref) { + var _a2 = useDayPicker(), classNames9 = _a2.classNames, styles = _a2.styles; + var classNamesArr = [classNames9.button_reset, classNames9.button]; + if (props2.className) { + classNamesArr.push(props2.className); + } + var className = classNamesArr.join(" "); + var style = __assign(__assign({}, styles.button_reset), styles.button); + if (props2.style) { + Object.assign(style, props2.style); + } + return Cn.createElement("button", __assign({}, props2, { ref, type: "button", className, style })); +}); +function Navigation(props2) { + var _a2, _b2; + var _c2 = useDayPicker(), dir = _c2.dir, locale2 = _c2.locale, classNames9 = _c2.classNames, styles = _c2.styles, _d2 = _c2.labels, labelPrevious2 = _d2.labelPrevious, labelNext2 = _d2.labelNext, components = _c2.components; + if (!props2.nextMonth && !props2.previousMonth) { + return Cn.createElement(Cn.Fragment, null); + } + var previousLabel = labelPrevious2(props2.previousMonth, { locale: locale2 }); + var previousClassName = [ + classNames9.nav_button, + classNames9.nav_button_previous + ].join(" "); + var nextLabel = labelNext2(props2.nextMonth, { locale: locale2 }); + var nextClassName = [ + classNames9.nav_button, + classNames9.nav_button_next + ].join(" "); + var IconRightComponent = (_a2 = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a2 !== void 0 ? _a2 : IconRight; + var IconLeftComponent = (_b2 = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b2 !== void 0 ? _b2 : IconLeft; + return Cn.createElement( + "div", + { className: classNames9.nav, style: styles.nav }, + !props2.hidePrevious && Cn.createElement(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props2.previousMonth, onClick: props2.onPreviousClick }, dir === "rtl" ? Cn.createElement(IconRightComponent, { className: classNames9.nav_icon, style: styles.nav_icon }) : Cn.createElement(IconLeftComponent, { className: classNames9.nav_icon, style: styles.nav_icon })), + !props2.hideNext && Cn.createElement(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props2.nextMonth, onClick: props2.onNextClick }, dir === "rtl" ? Cn.createElement(IconLeftComponent, { className: classNames9.nav_icon, style: styles.nav_icon }) : Cn.createElement(IconRightComponent, { className: classNames9.nav_icon, style: styles.nav_icon })) + ); +} +function CaptionNavigation(props2) { + var _a2; + var _b2 = useDayPicker(), numberOfMonths = _b2.numberOfMonths, dir = _b2.dir; + var _c2 = useNavigation(), previousMonth = _c2.previousMonth, nextMonth = _c2.nextMonth, goToMonth = _c2.goToMonth, displayMonths = _c2.displayMonths; + var displayIndex = displayMonths.findIndex(function(month) { + return isSameMonth(props2.displayMonth, month); + }); + var isFirst = displayIndex === 0; + var isLast = displayIndex === displayMonths.length - 1; + if (dir === "rtl") { + _a2 = [isFirst, isLast], isLast = _a2[0], isFirst = _a2[1]; + } + var hideNext = numberOfMonths > 1 && (isFirst || !isLast); + var hidePrevious = numberOfMonths > 1 && (isLast || !isFirst); + var handlePreviousClick = function() { + if (!previousMonth) + return; + goToMonth(previousMonth); }; - return /* @__PURE__ */ Cn.createElement(DndContext, { - sensors, - collisionDetection: closestCenter, - measuring: { - droppable: { - strategy: MeasuringStrategy.Always - } - }, - onDragStart: ({ active }) => { - setActiveId(active.id); - }, - onDragOver: ({ active, over }) => { - const overId2 = over == null ? void 0 : over.id; - if (overId2) - setOverId(overId2); - }, - onDragEnd: ({ active, over }) => { - const overId2 = over == null ? void 0 : over.id; - if (!overId2) { - resetState(); - return; - } - savePredicate({ - ...predicate, - colsOrder: arrayMove( - predicate.colsOrder, - predicate.colsOrder.findIndex((f4) => f4 == activeId), - predicate.colsOrder.findIndex((f4) => f4 == overId2) - ) - }); - resetState(); - }, - onDragCancel: resetState - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-context-maker-layout" - }, /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(SortableContext, { - items, - strategy: verticalListSortingStrategy - }, items.map((value, index) => { - return /* @__PURE__ */ Cn.createElement(SortableItem, { - id: value.id, - value: value.name - }); - })))), z3( - /* @__PURE__ */ Cn.createElement(DragOverlay, { - adjustScale: false - }, activeId ? /* @__PURE__ */ Cn.createElement(SortableItem, { - id: items.find((f4) => f4.id == activeId).id, - value: items.find((f4) => f4.id == activeId).name - }) : null), - document.body - )); -}; -function SortableItem(props2) { - const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: props2.id }); - const style = { - transform: CSS.Transform.toString(transform), - transition + var handleNextClick = function() { + if (!nextMonth) + return; + goToMonth(nextMonth); }; - return /* @__PURE__ */ Cn.createElement("div", { - ref: setNodeRef, - style, - ...attributes, - ...listeners - }, props2.value); + return Cn.createElement(Navigation, { displayMonth: props2.displayMonth, hideNext, hidePrevious, nextMonth, previousMonth, onPreviousClick: handlePreviousClick, onNextClick: handleNextClick }); +} +function Caption(props2) { + var _a2; + var _b2 = useDayPicker(), classNames9 = _b2.classNames, disableNavigation = _b2.disableNavigation, styles = _b2.styles, captionLayout = _b2.captionLayout, components = _b2.components; + var CaptionLabelComponent = (_a2 = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a2 !== void 0 ? _a2 : CaptionLabel; + var caption; + if (disableNavigation) { + caption = Cn.createElement(CaptionLabelComponent, { id: props2.id, displayMonth: props2.displayMonth }); + } else if (captionLayout === "dropdown") { + caption = Cn.createElement(CaptionDropdowns, { displayMonth: props2.displayMonth, id: props2.id }); + } else if (captionLayout === "dropdown-buttons") { + caption = Cn.createElement( + Cn.Fragment, + null, + Cn.createElement(CaptionDropdowns, { displayMonth: props2.displayMonth, id: props2.id }), + Cn.createElement(CaptionNavigation, { displayMonth: props2.displayMonth, id: props2.id }) + ); + } else { + caption = Cn.createElement( + Cn.Fragment, + null, + Cn.createElement(CaptionLabelComponent, { id: props2.id, displayMonth: props2.displayMonth }), + Cn.createElement(CaptionNavigation, { displayMonth: props2.displayMonth, id: props2.id }) + ); + } + return Cn.createElement("div", { className: classNames9.caption, style: styles.caption }, caption); +} +function Footer(props2) { + var _a2 = useDayPicker(), footer = _a2.footer, styles = _a2.styles, tfoot = _a2.classNames.tfoot; + if (!footer) + return Cn.createElement(Cn.Fragment, null); + return Cn.createElement( + "tfoot", + { className: tfoot, style: styles.tfoot }, + Cn.createElement( + "tr", + null, + Cn.createElement("td", { colSpan: 8 }, footer) + ) + ); +} +function getWeekdays(locale2, weekStartsOn, ISOWeek) { + var start = ISOWeek ? startOfISOWeek(new Date()) : startOfWeek(new Date(), { locale: locale2, weekStartsOn }); + var days = []; + for (var i4 = 0; i4 < 7; i4++) { + var day = addDays(start, i4); + days.push(day); + } + return days; +} +function HeadRow() { + var _a2 = useDayPicker(), classNames9 = _a2.classNames, styles = _a2.styles, showWeekNumber = _a2.showWeekNumber, locale2 = _a2.locale, weekStartsOn = _a2.weekStartsOn, ISOWeek = _a2.ISOWeek, formatWeekdayName2 = _a2.formatters.formatWeekdayName, labelWeekday2 = _a2.labels.labelWeekday; + var weekdays = getWeekdays(locale2, weekStartsOn, ISOWeek); + return Cn.createElement( + "tr", + { style: styles.head_row, className: classNames9.head_row }, + showWeekNumber && Cn.createElement("th", { scope: "col", style: styles.head_cell, className: classNames9.head_cell }), + weekdays.map(function(weekday, i4) { + return Cn.createElement("th", { key: i4, scope: "col", className: classNames9.head_cell, style: styles.head_cell, "aria-label": labelWeekday2(weekday, { locale: locale2 }) }, formatWeekdayName2(weekday, { locale: locale2 })); + }) + ); } - -// src/components/ContextView/ContextBuilder/ContextBuilderView.tsx -var ContextBuilderView = (props2) => { - const { - data, - cols, - sortedColumns, - dbSchema, - schema, - contextInfo, - tableData, - contextTable, - saveColumn, - loadContextFields, - tagContexts, - hideColumn, - sortColumn, - delColumn, - saveDB: saveDB2, - saveContextDB, - dbFileExists, - predicate, - saveSchema - } = q2(MDBContext); - const [section, setSection] = h2(0); - const saveField = (field, oldField) => { - if (field.name.length > 0) { - if (field.name != oldField.name || field.type != oldField.type || field.value != oldField.value || field.attrs != oldField.attrs) { - const saveResult = saveColumn(field, oldField); +function Head() { + var _a2; + var _b2 = useDayPicker(), classNames9 = _b2.classNames, styles = _b2.styles, components = _b2.components; + var HeadRowComponent = (_a2 = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a2 !== void 0 ? _a2 : HeadRow; + return Cn.createElement( + "thead", + { style: styles.head, className: classNames9.head }, + Cn.createElement(HeadRowComponent, null) + ); +} +function DayContent(props2) { + var _a2 = useDayPicker(), locale2 = _a2.locale, formatDay2 = _a2.formatters.formatDay; + return Cn.createElement(Cn.Fragment, null, formatDay2(props2.date, { locale: locale2 })); +} +var SelectMultipleContext = F(void 0); +function SelectMultipleProvider(props2) { + if (!isDayPickerMultiple(props2.initialProps)) { + var emptyContextValue = { + selected: void 0, + modifiers: { + disabled: [] } + }; + return Cn.createElement(SelectMultipleContext.Provider, { value: emptyContextValue }, props2.children); + } + return Cn.createElement(SelectMultipleProviderInternal, { initialProps: props2.initialProps, children: props2.children }); +} +function SelectMultipleProviderInternal(_a2) { + var initialProps = _a2.initialProps, children = _a2.children; + var selected = initialProps.selected, min3 = initialProps.min, max3 = initialProps.max; + var onDayClick = function(day, activeModifiers, e4) { + var _a3, _b2; + (_a3 = initialProps.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(initialProps, day, activeModifiers, e4); + var isMinSelected = Boolean(activeModifiers.selected && min3 && (selected === null || selected === void 0 ? void 0 : selected.length) === min3); + if (isMinSelected) { + return; + } + var isMaxSelected = Boolean(!activeModifiers.selected && max3 && (selected === null || selected === void 0 ? void 0 : selected.length) === max3); + if (isMaxSelected) { + return; + } + var selectedDays = selected ? __spreadArray([], selected, true) : []; + if (activeModifiers.selected) { + var index = selectedDays.findIndex(function(selectedDay) { + return isSameDay(day, selectedDay); + }); + selectedDays.splice(index, 1); + } else { + selectedDays.push(day); } + (_b2 = initialProps.onSelect) === null || _b2 === void 0 ? void 0 : _b2.call(initialProps, selectedDays, day, activeModifiers, e4); }; - const saveContext = (field, oldField, value) => { - const newContext = value[0]; - initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { - if (f4) { - return insertContextItems( - props2.plugin, - optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] - ), - newContext - ); - } - }).then((f4) => loadContextFields(newContext)); - const newField = { - ...field, - value: newContext != null ? newContext : "" - }; - saveColumn(newField, oldField); + var modifiers = { + disabled: [] }; - const showMenu = (e4, field) => { - const offset = e4.target.getBoundingClientRect(); - const options = optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] - ); - showPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - true, - options, - field, - cols, - contextInfo.contextPath, - (newField) => saveField(newField, field), - (newField, val) => saveContext(newField, field, val), - hideColumn, - delColumn, - sortColumn, - predicate.colsHidden.includes(field.name + field.table) - ); + if (selected) { + modifiers.disabled.push(function(day) { + var isMaxSelected = max3 && selected.length > max3 - 1; + var isSelected = selected.some(function(selectedDay) { + return isSameDay(selectedDay, day); + }); + return Boolean(isMaxSelected && !isSelected); + }); + } + var contextValue = { + selected, + onDayClick, + modifiers }; - const saveNewField = (source, field) => { - saveColumn({ ...field, table: "" }); + return Cn.createElement(SelectMultipleContext.Provider, { value: contextValue }, children); +} +function useSelectMultiple() { + var context = q2(SelectMultipleContext); + if (!context) { + throw new Error("useSelectMultiple must be used within a SelectMultipleProvider"); + } + return context; +} +function addToRange(day, range) { + var _a2 = range || {}, from = _a2.from, to = _a2.to; + if (!from) { + return { from: day, to: void 0 }; + } + if (!to && isSameDay(from, day)) { + return { from, to: day }; + } + if (!to && isBefore(day, from)) { + return { from: day, to: from }; + } + if (!to) { + return { from, to: day }; + } + if (isSameDay(to, day) && isSameDay(from, day)) { + return void 0; + } + if (isSameDay(to, day)) { + return { from: to, to: void 0 }; + } + if (isSameDay(from, day)) { + return void 0; + } + if (isAfter(from, day)) { + return { from: day, to }; + } + return { from, to: day }; +} +var SelectRangeContext = F(void 0); +function SelectRangeProvider(props2) { + if (!isDayPickerRange(props2.initialProps)) { + var emptyContextValue = { + selected: void 0, + modifiers: { + range_start: [], + range_end: [], + range_middle: [], + disabled: [] + } + }; + return Cn.createElement(SelectRangeContext.Provider, { value: emptyContextValue }, props2.children); + } + return Cn.createElement(SelectRangeProviderInternal, { initialProps: props2.initialProps, children: props2.children }); +} +function SelectRangeProviderInternal(_a2) { + var initialProps = _a2.initialProps, children = _a2.children; + var selected = initialProps.selected; + var _b2 = selected || {}, selectedFrom = _b2.from, selectedTo = _b2.to; + var min3 = initialProps.min; + var max3 = initialProps.max; + var onDayClick = function(day, activeModifiers, e4) { + var _a3, _b3; + (_a3 = initialProps.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(initialProps, day, activeModifiers, e4); + var newRange = addToRange(day, selected); + (_b3 = initialProps.onSelect) === null || _b3 === void 0 ? void 0 : _b3.call(initialProps, newRange, day, activeModifiers, e4); }; - const newProperty = (e4) => { - const offset = e4.target.getBoundingClientRect(); - showNewPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - tagContexts, - [], - saveNewField, - "files", - contextInfo.contextPath, - false - ); + var modifiers = { + range_start: [], + range_end: [], + range_middle: [], + disabled: [] }; - const saveMetadata = (keys, table) => { - const files = data.map((f4) => f4.File); - const importDV = (files2, dvKeys) => { - return files2.reduce( - (p3, c4) => { - const dvValues = props2.plugin.dataViewAPI().page(c4); - if (!dvValues) { - return p3; - } - return { - uniques: [], - cols: uniqCaseInsensitive([...p3.cols, ...dvKeys]), - rows: [ - ...p3.rows, - { - File: c4, - ...dvKeys.reduce( - (p4, c5) => ({ - ...p4, - [c5]: parseDataview(c5, dvValues[c5]) - }), - {} - ) - } - ] - }; - }, - { uniques: [], cols: [], rows: [] } - ); - }; - const importYAML = (files2, fmKeys) => { - return files2.map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4).reduce( - (p3, c4) => { - const fm = frontMatterForFile(c4); - if (!fm) { - return p3; - } - return { - uniques: [], - cols: uniq([...p3.cols, ...fmKeys]), - rows: [ - ...p3.rows, - { - File: c4.path, - ...fmKeys.reduce( - (p4, c5) => ({ - ...p4, - [c5]: parseFrontMatter(c5, fm[c5]) - }), - {} - ) - } - ] - }; - }, - { uniques: [], cols: [], rows: [] } - ); - }; - let yamlTableData = importYAML( - files, - keys.filter((f4) => f4.type == "fm").map((f4) => f4.name) - ); - let yamlTypes = guestimateTypes(files, props2.plugin, false); - if (props2.plugin.dataViewAPI()) { - const dvTableData = importDV( - files, - keys.filter((f4) => f4.type == "dv").map((f4) => f4.name) - ); - const dvTypes = guestimateTypes(files, props2.plugin, true); - yamlTableData = { - uniques: uniq([...yamlTableData.uniques, ...dvTableData.uniques]), - cols: uniqCaseInsensitive([...yamlTableData.cols, ...dvTableData.cols]), - rows: files.map((file) => { - var _a2, _b2; - return { - ...(_a2 = yamlTableData.rows.find((r3) => r3.File == file)) != null ? _a2 : {}, - ...(_b2 = dvTableData.rows.find((r3) => r3.File == file)) != null ? _b2 : {} - }; - }) - }; - yamlTypes = { ...yamlTypes, ...dvTypes }; - } - if (table == "") { - const newTable = mergeTableData(tableData, yamlTableData, yamlTypes); - saveDB2(newTable); + if (selectedFrom) { + modifiers.range_start = [selectedFrom]; + if (!selectedTo) { + modifiers.range_end = [selectedFrom]; } else { - if (!dbFileExists) { - saveDB2(tableData).then( - () => syncMetadataContext(yamlTableData, yamlTypes, table) - ); - } else { - syncMetadataContext(yamlTableData, yamlTypes, table); + modifiers.range_end = [selectedTo]; + if (!isSameDay(selectedFrom, selectedTo)) { + modifiers.range_middle = [ + { + after: selectedFrom, + before: selectedTo + } + ]; } } - }; - const syncMetadataContext = (yamlTableData, yamlTypes, table) => { - if (contextTable[table]) { - const newTable = mergeTableData( - contextTable[table], - yamlTableData, - yamlTypes - ); - saveContextDB(newTable, table); - saveSchema({ - ...dbSchema, - def: updateTagsForDefString( - dbSchema.def, - uniq([...tagContexts, table]) - ) + } + if (min3) { + if (selectedFrom && !selectedTo) { + modifiers.disabled.push({ + after: subDays(selectedFrom, min3 - 1), + before: addDays(selectedFrom, min3 - 1) }); - } else { - getMDBTable(props2.plugin, tagContextFromTag(props2.plugin, table), "files").then((f4) => { - if (f4) { - const newTable = mergeTableData(f4, yamlTableData, yamlTypes); - return saveContextDB(newTable, table); - } - }).then(() => { - saveSchema({ - ...dbSchema, - def: updateTagsForDefString( - dbSchema.def, - uniq([...tagContexts, table]) - ) - }); + } + if (selectedFrom && selectedTo) { + modifiers.disabled.push({ + after: selectedFrom, + before: addDays(selectedFrom, min3 - 1) + }); + } + } + if (max3) { + if (selectedFrom && !selectedTo) { + modifiers.disabled.push({ + before: addDays(selectedFrom, -max3 + 1) + }); + modifiers.disabled.push({ + after: addDays(selectedFrom, max3 - 1) + }); + } + if (selectedFrom && selectedTo) { + var selectedCount = differenceInCalendarDays(selectedTo, selectedFrom) + 1; + var offset = max3 - selectedCount; + modifiers.disabled.push({ + before: subDays(selectedFrom, offset) + }); + modifiers.disabled.push({ + after: addDays(selectedTo, offset) }); } - }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-context-maker-preview" - }, /* @__PURE__ */ Cn.createElement("div", { - className: (schema == null ? void 0 : schema.type) == "card" ? "mk-cards-container mk-cards-grid" : "mk-list-container" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-list-item" - }, sortedColumns.filter((f4) => f4.type == "preview" && f4.table == "").map((f4) => /* @__PURE__ */ Cn.createElement(DataTypeView, { - plugin: props2.plugin, - initialValue: defaultValueForPropertyType( - f4.name, - f4.value, - f4.type - ), - column: f4, - index: 0, - file: "", - editable: false - })), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-list-fields" - }, sortedColumns.filter((f4) => f4.type != "preview").map((f4, i4) => /* @__PURE__ */ Cn.createElement(DataTypeView, { - plugin: props2.plugin, - initialValue: defaultValueForPropertyType( - f4.name, - f4.value, - f4.type - ), - index: 0, - file: "", - column: { ...f4, table: "" }, - editable: false, - updateValue: (v3) => { - }, - updateFieldValue: (fv, v3) => { - }, - contextTable: {} - })))))), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-context-maker-selector" - }, section == 0 ? /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)("mk-section-title") - }, (dbSchema == null ? void 0 : dbSchema.primary) == "true" ? contextDisplayName(contextInfo) : "Properties"), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option" - }, cols.filter( - (f4) => !(f4.type == "preview" && f4.table != "") && f4.table == "" - ).map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4 - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)( - "mk-cell-option-item", - !predicate.colsHidden.includes(f4.name + f4.table) && "mk-is-active" - ), - onClick: (e4) => hideColumn( - f4, - !predicate.colsHidden.includes(f4.name + f4.table) - ), - onContextMenu: (e4) => showMenu(e4, f4) - }, /* @__PURE__ */ Cn.createElement("div", null, f4.name, " ")))), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option-item" - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)(`mk-icon-xsmall`), - onClick: (e4) => newProperty(e4), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-plus"] + } + return Cn.createElement(SelectRangeContext.Provider, { value: { selected, onDayClick, modifiers } }, children); +} +function useSelectRange() { + var context = q2(SelectRangeContext); + if (!context) { + throw new Error("useSelectRange must be used within a SelectRangeProvider"); + } + return context; +} +function matcherToArray(matcher) { + if (Array.isArray(matcher)) { + return __spreadArray([], matcher, true); + } else if (matcher !== void 0) { + return [matcher]; + } else { + return []; + } +} +function getCustomModifiers(dayModifiers) { + var customModifiers = {}; + Object.entries(dayModifiers).forEach(function(_a2) { + var modifier = _a2[0], matcher = _a2[1]; + customModifiers[modifier] = matcherToArray(matcher); + }); + return customModifiers; +} +var InternalModifier; +(function(InternalModifier2) { + InternalModifier2["Outside"] = "outside"; + InternalModifier2["Disabled"] = "disabled"; + InternalModifier2["Selected"] = "selected"; + InternalModifier2["Hidden"] = "hidden"; + InternalModifier2["Today"] = "today"; + InternalModifier2["RangeStart"] = "range_start"; + InternalModifier2["RangeEnd"] = "range_end"; + InternalModifier2["RangeMiddle"] = "range_middle"; +})(InternalModifier || (InternalModifier = {})); +var Selected = InternalModifier.Selected; +var Disabled = InternalModifier.Disabled; +var Hidden = InternalModifier.Hidden; +var Today = InternalModifier.Today; +var RangeEnd = InternalModifier.RangeEnd; +var RangeMiddle = InternalModifier.RangeMiddle; +var RangeStart = InternalModifier.RangeStart; +var Outside2 = InternalModifier.Outside; +function getInternalModifiers(dayPicker, selectMultiple, selectRange2) { + var _a2; + var internalModifiers = (_a2 = {}, _a2[Selected] = matcherToArray(dayPicker.selected), _a2[Disabled] = matcherToArray(dayPicker.disabled), _a2[Hidden] = matcherToArray(dayPicker.hidden), _a2[Today] = [dayPicker.today], _a2[RangeEnd] = [], _a2[RangeMiddle] = [], _a2[RangeStart] = [], _a2[Outside2] = [], _a2); + if (dayPicker.fromDate) { + internalModifiers[Disabled].push({ before: dayPicker.fromDate }); + } + if (dayPicker.toDate) { + internalModifiers[Disabled].push({ after: dayPicker.toDate }); + } + if (isDayPickerMultiple(dayPicker)) { + internalModifiers[Disabled] = internalModifiers[Disabled].concat(selectMultiple.modifiers[Disabled]); + } else if (isDayPickerRange(dayPicker)) { + internalModifiers[Disabled] = internalModifiers[Disabled].concat(selectRange2.modifiers[Disabled]); + internalModifiers[RangeStart] = selectRange2.modifiers[RangeStart]; + internalModifiers[RangeMiddle] = selectRange2.modifiers[RangeMiddle]; + internalModifiers[RangeEnd] = selectRange2.modifiers[RangeEnd]; + } + return internalModifiers; +} +var ModifiersContext = F(void 0); +function ModifiersProvider(props2) { + var dayPicker = useDayPicker(); + var selectMultiple = useSelectMultiple(); + var selectRange2 = useSelectRange(); + var internalModifiers = getInternalModifiers(dayPicker, selectMultiple, selectRange2); + var customModifiers = getCustomModifiers(dayPicker.modifiers); + var modifiers = __assign(__assign({}, internalModifiers), customModifiers); + return Cn.createElement(ModifiersContext.Provider, { value: modifiers }, props2.children); +} +function useModifiers() { + var context = q2(ModifiersContext); + if (!context) { + throw new Error("useModifiers must be used within a ModifiersProvider"); + } + return context; +} +function isDateInterval(matcher) { + return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher); +} +function isDateRange(value) { + return Boolean(value && typeof value === "object" && "from" in value); +} +function isDateAfterType(value) { + return Boolean(value && typeof value === "object" && "after" in value); +} +function isDateBeforeType(value) { + return Boolean(value && typeof value === "object" && "before" in value); +} +function isDayOfWeekType(value) { + return Boolean(value && typeof value === "object" && "dayOfWeek" in value); +} +function isDateInRange(date, range) { + var _a2; + var from = range.from, to = range.to; + if (!from) { + return false; + } + if (!to && isSameDay(from, date)) { + return true; + } + if (!to) { + return false; + } + var isRangeInverted = differenceInCalendarDays(to, from) < 0; + if (isRangeInverted) { + _a2 = [to, from], from = _a2[0], to = _a2[1]; + } + var isInRange = differenceInCalendarDays(date, from) >= 0 && differenceInCalendarDays(to, date) >= 0; + return isInRange; +} +function isDateType(value) { + return isDate(value); +} +function isArrayOfDates(value) { + return Array.isArray(value) && value.every(isDate); +} +function isMatch(day, matchers) { + return matchers.some(function(matcher) { + if (typeof matcher === "boolean") { + return matcher; + } + if (isDateType(matcher)) { + return isSameDay(day, matcher); + } + if (isArrayOfDates(matcher)) { + return matcher.includes(day); } - }))), (dbSchema == null ? void 0 : dbSchema.primary) == "true" && contextInfo.type != "tag" && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)("mk-section-title") - }, "Contexts"), /* @__PURE__ */ Cn.createElement(TagSelector, { - plugin: props2.plugin, - canAdd: true - }), tagContexts.map((t4) => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)("mk-section-title") - }, t4 == "" ? contextDisplayName(contextInfo) : t4), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option" - }, cols.filter( - (f4) => !(f4.type == "preview" && f4.table != "") && f4.table == t4 - ).map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4 - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)( - "mk-cell-option-item", - !predicate.colsHidden.includes( - f4.name + f4.table - ) && "mk-is-active" - ), - onClick: (e4) => hideColumn( - f4, - !predicate.colsHidden.includes( - f4.name + f4.table - ) - ), - onContextMenu: (e4) => showMenu(e4, f4) - }, /* @__PURE__ */ Cn.createElement("div", null, f4.name, " ")))), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-option-item" - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)(`mk-icon-xsmall`), - onClick: (e4) => newProperty(e4), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-plus"] + if (isDateRange(matcher)) { + return isDateInRange(day, matcher); } - })))))), (dbSchema == null ? void 0 : dbSchema.primary) == "true" && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)("mk-section-title") - }, "Metadata"), /* @__PURE__ */ Cn.createElement(SyncMetadataComponent, { - plugin: props2.plugin, - columns: cols, - syncColumn: (columns, table) => saveMetadata([columns], table), - files: data.map((f4) => getAbstractFileAtPath(app, f4.File)).filter((f4) => f4) - }))) : /* @__PURE__ */ Cn.createElement(ContextDesigner, null)), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-section-tabs" - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)( - "mk-section-title", - section == 0 && "mk-is-active" - ), - onClick: () => setSection(0) - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)(`mk-icon-small`), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-edit"] + if (isDayOfWeekType(matcher)) { + return matcher.dayOfWeek.includes(day.getDay()); } - }), "Properties"), /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)( - "mk-section-title", - section == 1 && "mk-is-active" - ), - onClick: () => setSection(1) - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames.default)(`mk-icon-small`), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-stack"] + if (isDateInterval(matcher)) { + var diffBefore = differenceInCalendarDays(matcher.before, day); + var diffAfter = differenceInCalendarDays(matcher.after, day); + var isDayBefore = diffBefore > 0; + var isDayAfter = diffAfter < 0; + var isClosedInterval = isAfter(matcher.before, matcher.after); + if (isClosedInterval) { + return isDayAfter && isDayBefore; + } else { + return isDayBefore || isDayAfter; + } } - }), "Layout"))); -}; - -// src/components/ui/modals/contextEditorModal.tsx -var import_obsidian20 = require("obsidian"); -var ContextEditorModal = class extends import_obsidian20.Modal { - constructor(plugin, context, view) { - super(plugin.app); - this.context = context; - this.view = view; - this.plugin = plugin; - } - onOpen() { - let { contentEl } = this; - let myModal = this; - myModal.modalEl.toggleClass("mk-context-maker", true); - let headerText; - headerText = i18n_default.labels.contextMaker; - const queryEl = contentEl.createDiv("mk-context-maker-container"); - const root = createRoot(queryEl); - root.render( - /* @__PURE__ */ Cn.createElement(MDBProvider, { - plugin: this.plugin, - context: this.context, - schema: this.view - }, /* @__PURE__ */ Cn.createElement(ContextBuilderView, { - plugin: this.plugin - })) - ); - } - onClose() { - let { contentEl } = this; - contentEl.empty(); - } -}; - -// src/components/ui/modals/mergeColumnModal.ts -var import_obsidian21 = require("obsidian"); -var MergeColumnModal = class extends import_obsidian21.Modal { - constructor(columns, mergeColumn) { - super(app); - this.columns = columns; - this.mergeColumn = mergeColumn; + if (isDateAfterType(matcher)) { + return differenceInCalendarDays(day, matcher.after) > 0; + } + if (isDateBeforeType(matcher)) { + return differenceInCalendarDays(matcher.before, day) > 0; + } + if (typeof matcher === "function") { + return matcher(day); + } + return false; + }); +} +function getActiveModifiers(day, modifiers, displayMonth) { + var matchedModifiers = Object.keys(modifiers).reduce(function(result, key2) { + var modifier = modifiers[key2]; + if (isMatch(day, modifier)) { + result.push(key2); + } + return result; + }, []); + var activeModifiers = {}; + matchedModifiers.forEach(function(modifier) { + return activeModifiers[modifier] = true; + }); + if (displayMonth && !isSameMonth(day, displayMonth)) { + activeModifiers.outside = true; } - onOpen() { - let { contentEl } = this; - let myModal = this; - let headerText = i18n_default.labels.mergeProperties; - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - const containerEl = contentEl.createEl("div"); - containerEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; - const select = containerEl.createEl("select"); - for (var i4 = 0; i4 < this.columns.length; i4++) { - var opt = document.createElement("option"); - opt.value = i4.toString(); - opt.innerHTML = this.columns[i4].name + this.columns[i4].table; - select.appendChild(opt); + return activeModifiers; +} +function getInitialFocusTarget(displayMonths, modifiers) { + var firstDayInMonth = startOfMonth(displayMonths[0]); + var lastDayInMonth = endOfMonth(displayMonths[displayMonths.length - 1]); + var firstFocusableDay; + var today; + var date = firstDayInMonth; + while (date <= lastDayInMonth) { + var activeModifiers = getActiveModifiers(date, modifiers); + var isFocusable = !activeModifiers.disabled && !activeModifiers.hidden; + if (!isFocusable) { + date = addDays(date, 1); + continue; } - const select2 = containerEl.createEl("select"); - for (var i4 = 0; i4 < this.columns.length; i4++) { - var opt = document.createElement("option"); - opt.value = i4.toString(); - opt.innerHTML = this.columns[i4].name + this.columns[i4].table; - select2.appendChild(opt); + if (activeModifiers.selected) { + return date; } - let changeButtonText = i18n_default.buttons.merge; - const changeButton = contentEl.createEl("button", { - text: changeButtonText - }); - const cancelButton = contentEl.createEl("button", { - text: i18n_default.buttons.cancel - }); - cancelButton.style.cssText = "float: right;"; - cancelButton.addEventListener("click", () => { - myModal.close(); - }); - const onClickAction = async () => { - this.mergeColumn( - this.columns[parseInt(select.value)], - this.columns[parseInt(select2.value)] - ); - myModal.close(); - }; - changeButton.addEventListener("click", onClickAction); + if (activeModifiers.today && !today) { + today = date; + } + if (!firstFocusableDay) { + firstFocusableDay = date; + } + date = addDays(date, 1); } - onClose() { - let { contentEl } = this; - contentEl.empty(); + if (today) { + return today; + } else { + return firstFocusableDay; } -}; - -// src/components/ui/modals/saveViewModal.ts -var import_obsidian22 = require("obsidian"); -var SaveViewModal = class extends import_obsidian22.Modal { - constructor(schema, saveSchema, action) { - super(app); - this.schema = schema; - this.saveSchema = saveSchema; - this.action = action; +} +var MAX_RETRY = 365; +function getNextFocus(focusedDay, options) { + var moveBy = options.moveBy, direction = options.direction, context = options.context, modifiers = options.modifiers, _a2 = options.retry, retry = _a2 === void 0 ? { count: 0, lastFocused: focusedDay } : _a2; + var weekStartsOn = context.weekStartsOn, fromDate = context.fromDate, toDate2 = context.toDate, locale2 = context.locale; + var moveFns = { + day: addDays, + week: addWeeks, + month: addMonths, + year: addYears, + startOfWeek: function(date) { + return context.ISOWeek ? startOfISOWeek(date) : startOfWeek(date, { locale: locale2, weekStartsOn }); + }, + endOfWeek: function(date) { + return context.ISOWeek ? endOfISOWeek(date) : endOfWeek(date, { locale: locale2, weekStartsOn }); + } + }; + var newFocusedDay = moveFns[moveBy](focusedDay, direction === "after" ? 1 : -1); + if (direction === "before" && fromDate) { + newFocusedDay = max([fromDate, newFocusedDay]); + } else if (direction === "after" && toDate2) { + newFocusedDay = min([toDate2, newFocusedDay]); } - onOpen() { - let { contentEl } = this; - let myModal = this; - let headerText; - if (this.action == "new view") - headerText = i18n_default.labels.saveView; - if (this.action == "new table") - headerText = i18n_default.labels.saveTable; - if (this.action == "rename view") - headerText = i18n_default.labels.renameView; - if (this.action == "rename table") - headerText = i18n_default.labels.renameTable; - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - const inputEl = contentEl.createEl("input"); - inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; - inputEl.focus(); - let changeButtonText; - if (this.action == "new view") - changeButtonText = i18n_default.buttons.saveView; - if (this.action == "new table") - changeButtonText = i18n_default.buttons.saveTable; - if (this.action == "rename view") - changeButtonText = i18n_default.buttons.renameView; - if (this.action == "rename table") - changeButtonText = i18n_default.buttons.renameTable; - const changeButton = contentEl.createEl("button", { - text: changeButtonText - }); - const cancelButton = contentEl.createEl("button", { - text: i18n_default.buttons.cancel - }); - cancelButton.style.cssText = "float: right;"; - cancelButton.addEventListener("click", () => { - myModal.close(); - }); - const onClickAction = async () => { - let newName = inputEl.value; - if (this.action == "new view" || this.action == "new table") { - this.saveSchema({ ...this.schema, id: newName, name: newName }); - } else { - this.saveSchema({ ...this.schema, name: newName }); - } - myModal.close(); - }; - changeButton.addEventListener("click", onClickAction); - inputEl.addEventListener("keydown", (e4) => { - if (e4.key === "Enter") { - e4.preventDefault(); - onClickAction(); - } - }); + var isFocusable = true; + if (modifiers) { + var activeModifiers = getActiveModifiers(newFocusedDay, modifiers); + isFocusable = !activeModifiers.disabled && !activeModifiers.hidden; } - onClose() { - let { contentEl } = this; - contentEl.empty(); + if (isFocusable) { + return newFocusedDay; + } else { + if (retry.count > MAX_RETRY) { + return retry.lastFocused; + } + return getNextFocus(newFocusedDay, { + moveBy, + direction, + context, + modifiers, + retry: __assign(__assign({}, retry), { count: retry.count + 1 }) + }); } -}; - -// src/components/ContextView/FilterBar/FilterBar.tsx -var import_obsidian23 = require("obsidian"); - -// src/components/ContextView/FilterBar/SearchBar.tsx -var SearchBar = (props2) => { - const clearSearch = () => { - props2.setSearchString(""); +} +var FocusContext = F(void 0); +function FocusProvider(props2) { + var navigation = useNavigation(); + var modifiers = useModifiers(); + var _a2 = h2(), focusedDay = _a2[0], setFocusedDay = _a2[1]; + var _b2 = h2(), lastFocused = _b2[0], setLastFocused = _b2[1]; + var initialFocusTarget = getInitialFocusTarget(navigation.displayMonths, modifiers); + var focusTarget = (focusedDay !== null && focusedDay !== void 0 ? focusedDay : lastFocused && navigation.isDateDisplayed(lastFocused)) ? lastFocused : initialFocusTarget; + var blur = function() { + setLastFocused(focusedDay); + setFocusedDay(void 0); }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-view-search" - }, /* @__PURE__ */ Cn.createElement("button", { - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-search"] } - }), /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("input", { - onChange: (e4) => props2.setSearchString(e4.target.value), - placeholder: i18n_default.labels.searchPlaceholder, - className: "mk-search-bar" - }), /* @__PURE__ */ Cn.createElement("button", { - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-clear"] }, - onClick: () => clearSearch() - }))); -}; - -// src/components/ContextView/FilterBar/FilterBar.tsx -var FilterBar = (props2) => { - const ctxRef = _2(null); - const { - tables, - data, - setDBSchema, - loadContextFields, - cols, - deleteSchema, - saveSchema, - saveDB: saveDB2, - saveContextDB, - setSchema, - setSearchString, - predicate, - tagContexts, - savePredicate, - hideColumn, - saveColumn, - sortColumn, - delColumn, - schema, - dbSchema, - contextInfo, - contextTable, - tableData - } = q2(MDBContext); - const filteredCols = cols.filter((f4) => f4.hidden != "true"); - const saveViewType = (type) => { - saveSchema({ - ...schema, - type + var focus = function(date) { + setFocusedDay(date); + }; + var context = useDayPicker(); + var moveFocus = function(moveBy, direction) { + if (!focusedDay) + return; + var nextFocused = getNextFocus(focusedDay, { + moveBy, + direction, + context, + modifiers }); + if (isSameDay(focusedDay, nextFocused)) + return void 0; + navigation.goToDate(nextFocused, focusedDay); + focus(nextFocused); }; - const views = tables.filter((f4) => f4.type != "db" && f4.def == (dbSchema == null ? void 0 : dbSchema.id)); - const selectView = (_dbschema, value) => { - setDBSchema(_dbschema); - value && setSchema(tables.find((f4) => f4.id == value)); + var value = { + focusedDay, + focusTarget, + blur, + focus, + focusDayAfter: function() { + return moveFocus("day", "after"); + }, + focusDayBefore: function() { + return moveFocus("day", "before"); + }, + focusWeekAfter: function() { + return moveFocus("week", "after"); + }, + focusWeekBefore: function() { + return moveFocus("week", "before"); + }, + focusMonthBefore: function() { + return moveFocus("month", "before"); + }, + focusMonthAfter: function() { + return moveFocus("month", "after"); + }, + focusYearBefore: function() { + return moveFocus("year", "before"); + }, + focusYearAfter: function() { + return moveFocus("year", "after"); + }, + focusStartOfWeek: function() { + return moveFocus("startOfWeek", "before"); + }, + focusEndOfWeek: function() { + return moveFocus("endOfWeek", "after"); + } }; - const openView = (e4, view) => { - const dbSchema2 = tables.find((f4) => f4.type == "db" && f4.id == view.def); - if (dbSchema2) { - selectView(dbSchema2, view.id); + return Cn.createElement(FocusContext.Provider, { value }, props2.children); +} +function useFocusContext() { + var context = q2(FocusContext); + if (!context) { + throw new Error("useFocusContext must be used within a FocusProvider"); + } + return context; +} +function useActiveModifiers(day, displayMonth) { + var modifiers = useModifiers(); + var activeModifiers = getActiveModifiers(day, modifiers, displayMonth); + return activeModifiers; +} +var SelectSingleContext = F(void 0); +function SelectSingleProvider(props2) { + if (!isDayPickerSingle(props2.initialProps)) { + var emptyContextValue = { + selected: void 0 + }; + return Cn.createElement(SelectSingleContext.Provider, { value: emptyContextValue }, props2.children); + } + return Cn.createElement(SelectSingleProviderInternal, { initialProps: props2.initialProps, children: props2.children }); +} +function SelectSingleProviderInternal(_a2) { + var initialProps = _a2.initialProps, children = _a2.children; + var onDayClick = function(day, activeModifiers, e4) { + var _a3, _b2, _c2; + (_a3 = initialProps.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(initialProps, day, activeModifiers, e4); + if (activeModifiers.selected && !initialProps.required) { + (_b2 = initialProps.onSelect) === null || _b2 === void 0 ? void 0 : _b2.call(initialProps, void 0, day, activeModifiers, e4); return; } - return; + (_c2 = initialProps.onSelect) === null || _c2 === void 0 ? void 0 : _c2.call(initialProps, day, day, activeModifiers, e4); }; - const showViewMenu = (e4, _dbschema) => { - const views2 = tables.filter((f4) => f4.type != "db" && f4.def == _dbschema.id); - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: tagContexts, - options: views2.map((m5) => ({ name: m5.name, value: m5.id })), - saveOptions: (_9, value) => selectView(_dbschema, value[0]), - placeholder: i18n_default.labels.viewItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); + var contextValue = { + selected: initialProps.selected, + onDayClick }; - const clearFilters = () => { - savePredicate({ - ...predicate, - filters: [], - sort: [] - }); + return Cn.createElement(SelectSingleContext.Provider, { value: contextValue }, children); +} +function useSelectSingle() { + var context = q2(SelectSingleContext); + if (!context) { + throw new Error("useSelectSingle must be used within a SelectSingleProvider"); + } + return context; +} +function useDayEventHandlers(date, activeModifiers) { + var dayPicker = useDayPicker(); + var single = useSelectSingle(); + var multiple = useSelectMultiple(); + var range = useSelectRange(); + var _a2 = useFocusContext(), focusDayAfter = _a2.focusDayAfter, focusDayBefore = _a2.focusDayBefore, focusWeekAfter = _a2.focusWeekAfter, focusWeekBefore = _a2.focusWeekBefore, blur = _a2.blur, focus = _a2.focus, focusMonthBefore = _a2.focusMonthBefore, focusMonthAfter = _a2.focusMonthAfter, focusYearBefore = _a2.focusYearBefore, focusYearAfter = _a2.focusYearAfter, focusStartOfWeek = _a2.focusStartOfWeek, focusEndOfWeek = _a2.focusEndOfWeek; + var onClick = function(e4) { + var _a3, _b2, _c2, _d2; + if (isDayPickerSingle(dayPicker)) { + (_a3 = single.onDayClick) === null || _a3 === void 0 ? void 0 : _a3.call(single, date, activeModifiers, e4); + } else if (isDayPickerMultiple(dayPicker)) { + (_b2 = multiple.onDayClick) === null || _b2 === void 0 ? void 0 : _b2.call(multiple, date, activeModifiers, e4); + } else if (isDayPickerRange(dayPicker)) { + (_c2 = range.onDayClick) === null || _c2 === void 0 ? void 0 : _c2.call(range, date, activeModifiers, e4); + } else { + (_d2 = dayPicker.onDayClick) === null || _d2 === void 0 ? void 0 : _d2.call(dayPicker, date, activeModifiers, e4); + } }; - const clearHiddenCols = () => { - savePredicate({ - ...predicate, - colsHidden: [] - }); + var onFocus = function(e4) { + var _a3; + focus(date); + (_a3 = dayPicker.onDayFocus) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const removeFilter = (filter) => { - const newFilters = [ - ...predicate.filters.filter((f4) => f4.field != filter.field) - ]; - savePredicate({ - ...predicate, - filters: newFilters - }); + var onBlur = function(e4) { + var _a3; + blur(); + (_a3 = dayPicker.onDayBlur) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const viewContextMenu = (e4, _schema) => { - const fileMenu = new import_obsidian23.Menu(); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle("Copy Embed Link"); - menuItem.onClick(() => { - navigator.clipboard.writeText( - contextEmbedStringFromContext(contextInfo, _schema.id) - ); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle("Rename View"); - menuItem.onClick(() => { - let vaultChangeModal = new SaveViewModal( - _schema, - (s5) => saveSchema(s5), - "rename view" - ); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle("Delete View"); - menuItem.onClick(() => { - deleteSchema(_schema); - }); - }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } + var onMouseEnter = function(e4) { + var _a3; + (_a3 = dayPicker.onDayMouseEnter) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const showFilterMenu = (e4) => { - const menu = new import_obsidian23.Menu(); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.tableView); - item.setIcon("table-2"); - item.onClick(() => { - saveViewType("table"); - }); - }); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.cardView); - item.setIcon("layout-grid"); - item.onClick(() => { - saveViewType("card"); - }); - }); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.listView); - item.setIcon("layout-list"); - item.onClick(() => { - saveViewType("list"); - }); - }); - if (dbSchema == null ? void 0 : dbSchema.primary) { - menu.addItem((item) => { - item.setTitle(i18n_default.menu.flowView); - item.setIcon("infinity"); - item.onClick(() => { - saveViewType("flow"); - }); - }); - } - menu.addSeparator(); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.groupBy); - item.setIcon("columns"); - item.onClick(() => { - showGroupByMenu(e4); - }); - }); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.sortBy); - item.setIcon("sort-desc"); - item.onClick(() => { - showSortMenu(e4); - }); - }); - menu.addSeparator(); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.newFilter); - item.setIcon("filter"); - item.onClick(() => { - showAddFilterMenu(e4); - }); - }); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.clearFilters); - item.setIcon("x-square"); - item.onClick(() => { - clearFilters(); - }); - }); - menu.addSeparator(); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.unhideFields); - item.setIcon("eye"); - item.onClick(() => { - clearHiddenCols(); - }); - }); - const offset = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + var onMouseLeave = function(e4) { + var _a3; + (_a3 = dayPicker.onDayMouseLeave) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const addSort = (_9, sort) => { - var _a2; - const field = sort[0]; - const fieldType = (_a2 = filteredCols.find((f4) => f4.name + f4.table == field)) == null ? void 0 : _a2.type; - if (fieldType) { - const type = defaultPredicateFnForType(fieldType, sortFnTypes); - const newSort = { - field, - fn: type - }; - savePredicate({ - ...predicate, - sort: [ - ...predicate.sort.filter((s5) => s5.field != newSort.field), - newSort - ] - }); - } + var onPointerEnter = function(e4) { + var _a3; + (_a3 = dayPicker.onDayPointerEnter) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const saveGroupBy = (_9, groupBy2) => { - savePredicate({ - ...predicate, - groupBy: groupBy2 - }); + var onPointerLeave = function(e4) { + var _a3; + (_a3 = dayPicker.onDayPointerLeave) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const removeSort = (sort) => { - const newSort = [...predicate.sort.filter((f4) => f4.field != sort.field)]; - savePredicate({ - ...predicate, - sort: newSort - }); + var onTouchCancel = function(e4) { + var _a3; + (_a3 = dayPicker.onDayTouchCancel) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const addFilter = (_9, filter) => { - var _a2; - const field = filter[0]; - const fieldType = (_a2 = filteredCols.find((f4) => f4.name + f4.table == field)) == null ? void 0 : _a2.type; - if (fieldType) { - const type = defaultPredicateFnForType(fieldType, filterFnTypes); - const newFilter = fieldType == "boolean" ? { - field, - fn: type, - value: "true" - } : { - field, - fn: type, - value: "" - }; - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), - newFilter - ] - }); - } + var onTouchEnd = function(e4) { + var _a3; + (_a3 = dayPicker.onDayTouchEnd) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const changeSortMenu = (e4, sort) => { - var _a2; - const offset = e4.target.getBoundingClientRect(); - const saveSort = (_9, newType) => { - const type = newType[0]; - const newSort = { - ...sort, - fn: type - }; - savePredicate({ - ...predicate, - sort: [ - ...predicate.sort.filter((s5) => s5.field != newSort.field), - newSort - ] - }); - }; - const fieldType = (_a2 = filteredCols.find( - (f4) => f4.name + f4.table == sort.field - )) == null ? void 0 : _a2.type; - const sortsForType = predicateFnsForType(fieldType, sortFnTypes); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: sortsForType.map((f4) => ({ - name: sortFnTypes[f4].label, - value: f4 - })), - saveOptions: saveSort, - placeholder: i18n_default.labels.sortItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); + var onTouchMove = function(e4) { + var _a3; + (_a3 = dayPicker.onDayTouchMove) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const showColsMenu = (e4) => { - let vaultChangeModal = new ContextEditorModal( - props2.plugin, - contextInfo, - schema == null ? void 0 : schema.id - ); - vaultChangeModal.open(); + var onTouchStart = function(e4) { + var _a3; + (_a3 = dayPicker.onDayTouchStart) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const saveField = (field, oldField) => { - if (field.name.length > 0) { - if (field.name != oldField.name || field.type != oldField.type || field.value != oldField.value || field.attrs != oldField.attrs) { - const saveResult = saveColumn(field, oldField); - } - } + var onKeyUp = function(e4) { + var _a3; + (_a3 = dayPicker.onDayKeyUp) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const showMenu = (e4, field) => { - const offset = e4.target.getBoundingClientRect(); - const options = optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] - ); - showPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - true, - options, - field, - cols, - contextInfo.contextPath, - (newField) => saveField(newField, field), - (newField, val) => { - }, - hideColumn, - delColumn, - sortColumn, - predicate.colsHidden.includes(field.name + field.table) - ); + var onKeyDown = function(e4) { + var _a3; + switch (e4.key) { + case "ArrowLeft": + e4.preventDefault(); + e4.stopPropagation(); + dayPicker.dir === "rtl" ? focusDayAfter() : focusDayBefore(); + break; + case "ArrowRight": + e4.preventDefault(); + e4.stopPropagation(); + dayPicker.dir === "rtl" ? focusDayBefore() : focusDayAfter(); + break; + case "ArrowDown": + e4.preventDefault(); + e4.stopPropagation(); + focusWeekAfter(); + break; + case "ArrowUp": + e4.preventDefault(); + e4.stopPropagation(); + focusWeekBefore(); + break; + case "PageUp": + e4.preventDefault(); + e4.stopPropagation(); + e4.shiftKey ? focusYearBefore() : focusMonthBefore(); + break; + case "PageDown": + e4.preventDefault(); + e4.stopPropagation(); + e4.shiftKey ? focusYearAfter() : focusMonthAfter(); + break; + case "Home": + e4.preventDefault(); + e4.stopPropagation(); + focusStartOfWeek(); + break; + case "End": + e4.preventDefault(); + e4.stopPropagation(); + focusEndOfWeek(); + break; + } + (_a3 = dayPicker.onDayKeyDown) === null || _a3 === void 0 ? void 0 : _a3.call(dayPicker, date, activeModifiers, e4); }; - const changeFilterMenu = (e4, filter) => { - var _a2; - const offset = e4.target.getBoundingClientRect(); - const saveFilter = (_9, newType) => { - const type = newType[0]; - const newFilter = { - ...filter, - fn: type - }; - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), - newFilter - ] - }); - }; - const fieldType = (_a2 = filteredCols.find( - (f4) => f4.name + f4.table == filter.field - )) == null ? void 0 : _a2.type; - const filtersForType = predicateFnsForType(fieldType, filterFnTypes); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: filtersForType.map((f4) => ({ - name: filterFnLabels[f4], - value: f4 - })), - saveOptions: saveFilter, - placeholder: i18n_default.labels.filterItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); + var eventHandlers = { + onClick, + onFocus, + onBlur, + onKeyDown, + onKeyUp, + onMouseEnter, + onMouseLeave, + onPointerEnter, + onPointerLeave, + onTouchCancel, + onTouchEnd, + onTouchMove, + onTouchStart }; - const showAddFilterMenu = (e4) => { - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: filteredCols.filter((f4) => predicateFnsForType(f4.type, filterFnTypes).length > 0).map((f4) => ({ - name: f4.name + f4.table, - value: f4.name + f4.table - })), - saveOptions: addFilter, - placeholder: i18n_default.labels.propertyItemSelectPlaceholder, - searchable: false, - showAll: true + return eventHandlers; +} +function useSelectedDays() { + var dayPicker = useDayPicker(); + var single = useSelectSingle(); + var multiple = useSelectMultiple(); + var range = useSelectRange(); + var selectedDays = isDayPickerSingle(dayPicker) ? single.selected : isDayPickerMultiple(dayPicker) ? multiple.selected : isDayPickerRange(dayPicker) ? range.selected : void 0; + return selectedDays; +} +function isInternalModifier(modifier) { + return Object.values(InternalModifier).includes(modifier); +} +function getDayClassNames(dayPicker, activeModifiers) { + var classNames9 = [dayPicker.classNames.day]; + Object.keys(activeModifiers).forEach(function(modifier) { + var customClassName = dayPicker.modifiersClassNames[modifier]; + if (customClassName) { + classNames9.push(customClassName); + } else if (isInternalModifier(modifier)) { + var internalClassName = dayPicker.classNames["day_".concat(modifier)]; + if (internalClassName) { + classNames9.push(internalClassName); } - ); + } + }); + return classNames9; +} +function getDayStyle(dayPicker, activeModifiers) { + var style = __assign({}, dayPicker.styles.day); + Object.keys(activeModifiers).forEach(function(modifier) { + var _a2; + style = __assign(__assign({}, style), (_a2 = dayPicker.modifiersStyles) === null || _a2 === void 0 ? void 0 : _a2[modifier]); + }); + return style; +} +function useDayRender(day, displayMonth, buttonRef) { + var _a2; + var _b2, _c2; + var dayPicker = useDayPicker(); + var focusContext = useFocusContext(); + var activeModifiers = useActiveModifiers(day, displayMonth); + var eventHandlers = useDayEventHandlers(day, activeModifiers); + var selectedDays = useSelectedDays(); + var isButton = Boolean(dayPicker.onDayClick || dayPicker.mode !== "default"); + p2(function() { + var _a3; + if (activeModifiers.outside) + return; + if (!focusContext.focusedDay) + return; + if (!isButton) + return; + if (isSameDay(focusContext.focusedDay, day)) { + (_a3 = buttonRef.current) === null || _a3 === void 0 ? void 0 : _a3.focus(); + } + }, [ + focusContext.focusedDay, + day, + buttonRef, + isButton, + activeModifiers.outside + ]); + var className = getDayClassNames(dayPicker, activeModifiers).join(" "); + var style = getDayStyle(dayPicker, activeModifiers); + var isHidden = Boolean(activeModifiers.outside && !dayPicker.showOutsideDays || activeModifiers.hidden); + var DayContentComponent = (_c2 = (_b2 = dayPicker.components) === null || _b2 === void 0 ? void 0 : _b2.DayContent) !== null && _c2 !== void 0 ? _c2 : DayContent; + var children = Cn.createElement(DayContentComponent, { date: day, displayMonth, activeModifiers }); + var divProps = { + style, + className, + children, + role: "gridcell" }; - const showSortMenu = (e4) => { - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: filteredCols.map((f4) => ({ - name: f4.name + f4.table, - value: f4.name + f4.table - })), - saveOptions: addSort, - placeholder: i18n_default.labels.sortItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); + var isFocusTarget = focusContext.focusTarget && isSameDay(focusContext.focusTarget, day) && !activeModifiers.outside; + var isFocused = focusContext.focusedDay && isSameDay(focusContext.focusedDay, day); + var buttonProps = __assign(__assign(__assign({}, divProps), (_a2 = { disabled: activeModifiers.disabled, role: "gridcell" }, _a2["aria-selected"] = activeModifiers.selected, _a2.tabIndex = isFocused || isFocusTarget ? 0 : -1, _a2)), eventHandlers); + var dayRender = { + isButton, + isHidden, + activeModifiers, + selectedDays, + buttonProps, + divProps }; - const showGroupByMenu = (e4) => { - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: filteredCols.filter((f4) => f4.primary != "true").map((f4) => ({ - name: f4.name + f4.table, - value: f4.name + f4.table - })), - saveOptions: saveGroupBy, - placeholder: i18n_default.labels.propertyItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); + return dayRender; +} +function Day(props2) { + var buttonRef = _2(null); + var dayRender = useDayRender(props2.date, props2.displayMonth, buttonRef); + if (dayRender.isHidden) { + return Cn.createElement("div", { role: "gridcell" }); + } + if (!dayRender.isButton) { + return Cn.createElement("div", __assign({}, dayRender.divProps)); + } + return Cn.createElement(Button, __assign({ name: "day", ref: buttonRef }, dayRender.buttonProps)); +} +function WeekNumber(props2) { + var weekNumber = props2.number, dates = props2.dates; + var _a2 = useDayPicker(), onWeekNumberClick = _a2.onWeekNumberClick, styles = _a2.styles, classNames9 = _a2.classNames, locale2 = _a2.locale, labelWeekNumber2 = _a2.labels.labelWeekNumber, formatWeekNumber2 = _a2.formatters.formatWeekNumber; + var content = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); + if (!onWeekNumberClick) { + return Cn.createElement("span", { className: classNames9.weeknumber, style: styles.weeknumber }, content); + } + var label = labelWeekNumber2(Number(weekNumber), { locale: locale2 }); + var handleClick = function(e4) { + onWeekNumberClick(weekNumber, dates, e4); }; - const showAddMenu = (e4) => { - const fileMenu = new import_obsidian23.Menu(); - const folder = getAbstractFileAtPath( - app, - contextInfo.contextPath + return Cn.createElement(Button, { name: "week-number", "aria-label": label, className: classNames9.weeknumber, style: styles.weeknumber, onClick: handleClick }, content); +} +function Row(props2) { + var _a2, _b2; + var _c2 = useDayPicker(), styles = _c2.styles, classNames9 = _c2.classNames, showWeekNumber = _c2.showWeekNumber, components = _c2.components; + var DayComponent = (_a2 = components === null || components === void 0 ? void 0 : components.Day) !== null && _a2 !== void 0 ? _a2 : Day; + var WeeknumberComponent = (_b2 = components === null || components === void 0 ? void 0 : components.WeekNumber) !== null && _b2 !== void 0 ? _b2 : WeekNumber; + var weekNumberCell; + if (showWeekNumber) { + weekNumberCell = Cn.createElement( + "td", + { className: classNames9.cell, style: styles.cell }, + Cn.createElement(WeeknumberComponent, { number: props2.weekNumber, dates: props2.dates }) ); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("edit"); - menuItem.setTitle(i18n_default.buttons.createNote); - menuItem.onClick((ev) => { - newFileInFolder(props2.plugin, folder); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("layout-dashboard"); - menuItem.setTitle(i18n_default.buttons.createCanvas); - menuItem.onClick((ev) => { - createNewCanvasFile(props2.plugin, folder, ""); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("folder-plus"); - menuItem.setTitle(i18n_default.buttons.createFolder); - menuItem.onClick((ev) => { - let vaultChangeModal = new VaultChangeModal( - props2.plugin, - folder, - "create folder", - "/" - ); - vaultChangeModal.open(); - }); + } + return Cn.createElement( + "tr", + { className: classNames9.row, style: styles.row }, + weekNumberCell, + props2.dates.map(function(date) { + return Cn.createElement( + "td", + { className: classNames9.cell, style: styles.cell, key: getUnixTime(date), role: "presentation" }, + Cn.createElement(DayComponent, { displayMonth: props2.displayMonth, date }) + ); + }) + ); +} +function daysToMonthWeeks(fromDate, toDate2, options) { + var toWeek = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? endOfISOWeek(toDate2) : endOfWeek(toDate2, options); + var fromWeek = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? startOfISOWeek(fromDate) : startOfWeek(fromDate, options); + var nOfDays = differenceInCalendarDays(toWeek, fromWeek); + var days = []; + for (var i4 = 0; i4 <= nOfDays; i4++) { + days.push(addDays(fromWeek, i4)); + } + var weeksInMonth = days.reduce(function(result, date) { + var weekNumber = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? getISOWeek(date) : getWeek(date, options); + var existingWeek = result.find(function(value) { + return value.weekNumber === weekNumber; }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); + if (existingWeek) { + existingWeek.dates.push(date); + return result; } - return false; - }; - const showFMMenu2 = (e4) => { - const menu = new import_obsidian23.Menu(); - menu.addItem((menuItem) => { - menuItem.setIcon("log-in"); - menuItem.setTitle(i18n_default.menu.mergeProperties); - menuItem.onClick(() => { - showMergeColumnModal(); - }); + result.push({ + weekNumber, + dates: [date] }); - const offset = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); - }; - const mergeColumn = (fromCol, toCol) => { - const fromTable = fromCol.table == "" ? tableData : contextTable[fromCol.table]; - if (toCol.table == "") { - saveDB2({ - ...tableData, - rows: tableData.rows.map((r3, i4) => { - const foundRow = fromTable.rows.find((f4) => f4.File == r3.File); - return foundRow ? { ...r3, [toCol.name]: foundRow[fromCol.name] } : r3; - }) - }); - } else { - saveContextDB( - { - ...contextTable[toCol.table], - rows: contextTable[toCol.table].rows.map((r3, i4) => { - const foundRow = fromTable.rows.find((f4) => f4.File == r3.File); - return foundRow ? { ...r3, [toCol.name]: foundRow[fromCol.name] } : r3; - }) - }, - toCol.table - ); + return result; + }, []); + return weeksInMonth; +} +function getMonthWeeks(month, options) { + var weeksInMonth = daysToMonthWeeks(startOfMonth(month), endOfMonth(month), options); + if (options === null || options === void 0 ? void 0 : options.useFixedWeeks) { + var nrOfMonthWeeks = getWeeksInMonth(month, options); + if (nrOfMonthWeeks < 6) { + var lastWeek = weeksInMonth[weeksInMonth.length - 1]; + var lastDate = lastWeek.dates[lastWeek.dates.length - 1]; + var toDate2 = addWeeks(lastDate, 6 - nrOfMonthWeeks); + var extraWeeks = daysToMonthWeeks(addWeeks(lastDate, 1), toDate2, options); + weeksInMonth.push.apply(weeksInMonth, extraWeeks); } - }; - const showMergeColumnModal = () => { - var _a2; - let vaultChangeModal = new MergeColumnModal( - [ - ...(_a2 = filteredCols == null ? void 0 : filteredCols.map((f4) => ({ ...f4, table: "" }))) != null ? _a2 : [], - ...tagContexts.reduce( - (p3, c4) => { - var _a3, _b2; - return [ - ...p3, - ...(_b2 = (_a3 = contextTable[c4]) == null ? void 0 : _a3.cols.filter( - (f4) => f4.name != FilePropertyName && f4.hidden != "true" && f4.type != "fileprop" - ).map((f4) => ({ ...f4, table: c4 }))) != null ? _b2 : [] - ]; - }, - [] + } + return weeksInMonth; +} +function Table(props2) { + var _a2, _b2, _c2; + var _d2 = useDayPicker(), locale2 = _d2.locale, classNames9 = _d2.classNames, styles = _d2.styles, hideHead = _d2.hideHead, fixedWeeks = _d2.fixedWeeks, components = _d2.components, weekStartsOn = _d2.weekStartsOn, firstWeekContainsDate = _d2.firstWeekContainsDate, ISOWeek = _d2.ISOWeek; + var weeks = getMonthWeeks(props2.displayMonth, { + useFixedWeeks: Boolean(fixedWeeks), + ISOWeek, + locale: locale2, + weekStartsOn, + firstWeekContainsDate + }); + var HeadComponent = (_a2 = components === null || components === void 0 ? void 0 : components.Head) !== null && _a2 !== void 0 ? _a2 : Head; + var RowComponent = (_b2 = components === null || components === void 0 ? void 0 : components.Row) !== null && _b2 !== void 0 ? _b2 : Row; + var FooterComponent = (_c2 = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c2 !== void 0 ? _c2 : Footer; + return Cn.createElement( + "table", + { className: classNames9.table, style: styles.table, role: "grid", "aria-labelledby": props2["aria-labelledby"] }, + !hideHead && Cn.createElement(HeadComponent, null), + Cn.createElement("tbody", { className: classNames9.tbody, style: styles.tbody, role: "rowgroup" }, weeks.map(function(week) { + return Cn.createElement(RowComponent, { displayMonth: props2.displayMonth, key: week.weekNumber, dates: week.dates, weekNumber: week.weekNumber }); + })), + Cn.createElement(FooterComponent, { displayMonth: props2.displayMonth }) + ); +} +function canUseDOM2() { + return !!(typeof window !== "undefined" && window.document && window.document.createElement); +} +var useIsomorphicLayoutEffect2 = canUseDOM2() ? y2 : p2; +var serverHandoffComplete = false; +var id = 0; +function genId2() { + return "react-day-picker-".concat(++id); +} +function useId(providedId) { + var _a2; + var initialId = providedId !== null && providedId !== void 0 ? providedId : serverHandoffComplete ? genId2() : null; + var _b2 = h2(initialId), id2 = _b2[0], setId = _b2[1]; + useIsomorphicLayoutEffect2(function() { + if (id2 === null) { + setId(genId2()); + } + }, []); + p2(function() { + if (serverHandoffComplete === false) { + serverHandoffComplete = true; + } + }, []); + return (_a2 = providedId !== null && providedId !== void 0 ? providedId : id2) !== null && _a2 !== void 0 ? _a2 : void 0; +} +function Month(props2) { + var _a2; + var _b2; + var dayPicker = useDayPicker(); + var dir = dayPicker.dir, classNames9 = dayPicker.classNames, styles = dayPicker.styles, components = dayPicker.components; + var displayMonths = useNavigation().displayMonths; + var captionId = useId(dayPicker.id ? "".concat(dayPicker.id, "-").concat(props2.displayIndex) : void 0); + var className = [classNames9.month]; + var style = styles.month; + var isStart = props2.displayIndex === 0; + var isEnd = props2.displayIndex === displayMonths.length - 1; + var isCenter = !isStart && !isEnd; + if (dir === "rtl") { + _a2 = [isStart, isEnd], isEnd = _a2[0], isStart = _a2[1]; + } + if (isStart) { + className.push(classNames9.caption_start); + style = __assign(__assign({}, style), styles.caption_start); + } + if (isEnd) { + className.push(classNames9.caption_end); + style = __assign(__assign({}, style), styles.caption_end); + } + if (isCenter) { + className.push(classNames9.caption_between); + style = __assign(__assign({}, style), styles.caption_between); + } + var CaptionComponent = (_b2 = components === null || components === void 0 ? void 0 : components.Caption) !== null && _b2 !== void 0 ? _b2 : Caption; + return Cn.createElement( + "div", + { key: props2.displayIndex, className: className.join(" "), style }, + Cn.createElement(CaptionComponent, { id: captionId, displayMonth: props2.displayMonth }), + Cn.createElement(Table, { "aria-labelledby": captionId, displayMonth: props2.displayMonth }) + ); +} +function Root() { + var dayPicker = useDayPicker(); + var focusContext = useFocusContext(); + var navigation = useNavigation(); + var _a2 = h2(false), hasInitialFocus = _a2[0], setHasInitialFocus = _a2[1]; + p2(function() { + if (!dayPicker.initialFocus) + return; + if (!focusContext.focusTarget) + return; + if (hasInitialFocus) + return; + focusContext.focus(focusContext.focusTarget); + setHasInitialFocus(true); + }, [ + dayPicker.initialFocus, + hasInitialFocus, + focusContext.focus, + focusContext.focusTarget, + focusContext + ]); + var classNames9 = [dayPicker.classNames.root, dayPicker.className]; + if (dayPicker.numberOfMonths > 1) { + classNames9.push(dayPicker.classNames.multiple_months); + } + if (dayPicker.showWeekNumber) { + classNames9.push(dayPicker.classNames.with_weeknumber); + } + var style = __assign(__assign({}, dayPicker.styles.root), dayPicker.style); + return Cn.createElement( + "div", + { className: classNames9.join(" "), style, dir: dayPicker.dir }, + Cn.createElement("div", { className: dayPicker.classNames.months, style: dayPicker.styles.months }, navigation.displayMonths.map(function(month, i4) { + return Cn.createElement(Month, { key: i4, displayIndex: i4, displayMonth: month }); + })) + ); +} +function RootProvider(props2) { + var children = props2.children, initialProps = __rest(props2, ["children"]); + return Cn.createElement( + DayPickerProvider, + { initialProps }, + Cn.createElement( + NavigationProvider, + null, + Cn.createElement( + SelectSingleProvider, + { initialProps }, + Cn.createElement( + SelectMultipleProvider, + { initialProps }, + Cn.createElement( + SelectRangeProvider, + { initialProps }, + Cn.createElement( + ModifiersProvider, + null, + Cn.createElement(FocusProvider, null, children) + ) + ) ) - ], - mergeColumn - ); - vaultChangeModal.open(); - }; - const showSaveViewModal = () => { - let vaultChangeModal = new SaveViewModal(schema, saveSchema, "new view"); - vaultChangeModal.open(); - }; - const editViewModal = () => { - let vaultChangeModal = new SaveViewModal(schema, saveSchema, "rename view"); - vaultChangeModal.open(); + ) + ) + ); +} +function DayPicker(props2) { + return Cn.createElement( + RootProvider, + __assign({}, props2), + Cn.createElement(Root, null) + ); +} + +// src/components/ui/menus/datePickerMenu.tsx +var showDatePickerMenu = (point, value, setValue, format2) => { + const menu = new import_obsidian17.Menu(); + menu.dom.toggleClass("mk-menu", true); + menu.setUseNativeMenu(false); + const frag = document.createDocumentFragment(); + const div = frag.createEl("div"); + div.addEventListener("click", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("mousedown", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("mouseup", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("keydown", (e4) => { + }); + const setDate = (date) => { + setValue(date); + menu.hide(); }; - const selectFilterValue = (e4, filter) => { - var _a2, _b2, _c2; - switch (filterFnTypes[filter.fn].valueType) { - case "text": - case "number": - { - const menu = new import_obsidian23.Menu(); - menu.setUseNativeMenu(false); - const saveFilterValue = (value) => { - const newFilter = { - ...filter, - value - }; - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), - newFilter - ] - }); - }; - menu.addItem((menuItem) => { - inputMenuItem( - menuItem, - filter.value, - (value) => saveFilterValue(value) - ); - menuItem.setIcon("type"); - }); - const offset = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); - } - break; - case "date": { - const saveValue = (date2) => { - const newFilter = { - ...filter, - value: date2.valueOf().toString() - }; - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), - newFilter - ] - }); - }; - const offset = e4.target.getBoundingClientRect(); - const date = new Date(filter.value); - showDatePickerMenu( - { x: offset.left, y: offset.top + 30 }, - date.getTime() ? date : null, - saveValue - ); - break; + const root = createRoot(div); + root.render( + /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(DayPicker, { + defaultMonth: value, + mode: "single", + selected: value, + labels: { + labelMonthDropdown: () => void 0, + labelYearDropdown: () => void 0, + labelNext: () => void 0, + labelPrevious: () => void 0, + labelDay: () => void 0, + labelWeekday: () => void 0, + labelWeekNumber: () => void 0 + }, + onSelect: setDate + })) + ); + menu.addItem((item) => { + item.setTitle(frag); + }); + const keys = [...menu.scope.keys]; + for (let i4 = 0; i4 < keys.length; i4++) { + if (keys[i4].key != "Escape") { + menu.scope.unregister(keys[i4]); + } + } + menu.showAtPosition(point); + return menu; +}; + +// src/utils/date.ts +var formatDate = (plugin, date, dateFormat) => { + let dateString; + try { + dateString = format( + date, + (dateFormat == null ? void 0 : dateFormat.length) > 0 ? dateFormat : plugin.settings.defaultDateFormat + ); + } catch (e4) { + dateString = "Date Format Invalid"; + } + return dateString; +}; + +// src/components/ContextView/DataTypeView/DateCell.tsx +var DateCell = (props2) => { + const [value, setValue] = h2(props2.initialValue); + p2(() => { + setValue(props2.initialValue); + }, [props2.initialValue]); + const date = F2(() => { + const dateTime = Date.parse(value); + return dateTime > 0 ? new Date(dateTime + new Date().getTimezoneOffset() * 60 * 1e3) : null; + }, [value]); + const saveValue = (date2) => { + const newValue = format(date2, "yyyy-MM-dd"); + props2.saveValue(newValue); + setValue(newValue); + props2.setEditMode(null); + }; + const menuRef = _2(null); + const ref = _2(null); + p2(() => { + if (props2.editMode == 2 /* EditModeActive */) { + if (ref.current) { + showPicker(); + ref.current.focus(); } - case "list": - { - const col = cols.find((f4) => f4.name + f4.table == filter.field); - const saveOptions = (options, values) => { - const newFilter = { - ...filter, - value: serializeMultiString(values) - }; - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), - newFilter - ] - }); - }; - if (col.type.startsWith("option")) { - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: true, - editable: false, - value: parseMultiString(filter.value), - options: parseMultiString(col.value).map((f4) => ({ - name: f4, - value: f4 - })), - saveOptions, - placeholder: i18n_default.labels.optionItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - } else if (col.type.startsWith("context")) { - const contextData = (_b2 = (_a2 = contextTable[col.table]) == null ? void 0 : _a2.rows) != null ? _b2 : []; - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: true, - editable: false, - value: parseMultiString(filter.value), - options: (_c2 = contextData.map((f4) => ({ - name: filePathToString(f4[FilePropertyName]), - value: f4[FilePropertyName] - }))) != null ? _c2 : [], - saveOptions, - placeholder: i18n_default.labels.optionItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - } - } - break; + } + }, [props2.editMode]); + const showPicker = T2( + (e4) => { + if (props2.editMode <= 0) { + return; + } + const offset = e4 ? e4.target.getBoundingClientRect() : ref.current.getBoundingClientRect(); + menuRef.current = showDatePickerMenu( + { x: offset.left - 4, y: offset.bottom - 4 }, + date, + saveValue + ); + }, + [date] + ); + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "Enter" || e4.key == "Escape") { + e4.target.blur(); + saveValue(date); + menuRef.current.hide(); } }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-view-config" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-view-selector" - }, views.map((f4) => /* @__PURE__ */ Cn.createElement("div", { - className: `${(schema == null ? void 0 : schema.id) == f4.id ? "mk-is-active" : ""}`, - onContextMenu: (e4) => viewContextMenu(e4, f4) - }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => openView(e4, f4) - }, f4.name))), /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => showSaveViewModal() - }, "+")), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-view-options" - }, /* @__PURE__ */ Cn.createElement(SearchBar, { - setSearchString - }), /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => showFilterMenu(e4), + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-date", + onClick: (e4) => !value && showPicker(e4) + }, props2.editMode == 2 ? /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-cell-text", + ref, + type: "text", + value, + onChange: (e4) => setValue(e4.target.value), + onMouseDown: () => showPicker(), + onKeyDown + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-date-value", + onClick: (e4) => showPicker(e4) + }, date ? formatDate(props2.plugin, date, props2.propertyValue) : value)); +}; + +// src/components/ContextView/ContextBuilder/BuilderMetadataFields.tsx +var import_obsidian18 = require("obsidian"); +var allMetadataForFiles = (plugin, files) => { + return files.reduce((p3, c4) => { + const fm = frontMatterForFile(c4); + const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); + if (plugin.dataViewAPI()) { + const dvValues = plugin.dataViewAPI().page(c4.path); + const dvKeys = uniqCaseInsensitive( + Object.keys(dvValues != null ? dvValues : {}).filter( + (f4, i4, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + ) ? true : false + ).filter((f4) => f4 != "file" && !fmKeys.some((g4) => f4 == g4)) + ); + return [ + ...p3, + ...fmKeys.map((f4) => ({ name: f4, type: "fm" })), + ...dvKeys.map((f4) => ({ name: f4, type: "dv" })) + ].filter(metadatTypeFilterPredicate); + } + return [ + ...p3, + ...fmKeys.map((f4) => ({ name: f4, type: "fm" })) + ].filter(metadatTypeFilterPredicate); + }, []); +}; +var metadatTypeFilterPredicate = (value, index, self2) => { + return self2.findIndex( + (v3) => value["type"] == v3["type"] && value["name"] == v3["name"] + ) === index; +}; +var SyncMetadataComponent = (props2) => { + const cols = allMetadataForFiles( + props2.plugin, + props2.files.filter((f4) => f4 instanceof import_obsidian18.TFile) + ).filter( + (f4) => props2.columns ? !props2.columns.some((g4) => g4.name == f4.name) : true + ); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option" + }, cols.map((f4, index) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option-item", + onClick: () => props2.syncColumn(f4, "") + }, /* @__PURE__ */ Cn.createElement("div", null, f4.name), /* @__PURE__ */ Cn.createElement("div", { + className: `mk-icon-xsmall`, dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-view-options"] + __html: uiIconSet["mk-ui-plus"] } - }), (dbSchema == null ? void 0 : dbSchema.primary) && /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => showColsMenu(e4), - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-build"] } - }), contextInfo.type == "folder" && (dbSchema == null ? void 0 : dbSchema.id) == "files" && /* @__PURE__ */ Cn.createElement("button", { - className: "mk-button-new", - onClick: (e4) => showAddMenu(e4), - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - }))), (predicate.filters.length > 0 || predicate.sort.length > 0 || predicate.groupBy.length > 0) && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter-bar" - }, predicate.groupBy.length > 0 && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, /* @__PURE__ */ Cn.createElement("span", null, "Group By"), /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => showGroupByMenu(e4) - }, predicate.groupBy[0]), /* @__PURE__ */ Cn.createElement("div", { - onClick: () => saveGroupBy(null, []), - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })), predicate.sort.map((f4) => /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, /* @__PURE__ */ Cn.createElement("span", null, f4.field), /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => changeSortMenu(e4, f4) - }, sortFnTypes[f4.fn].label), /* @__PURE__ */ Cn.createElement("div", { - onClick: () => removeSort(f4), - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }))), predicate.filters.map((f4) => { - var _a2; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, /* @__PURE__ */ Cn.createElement("span", null, f4.field), /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => changeFilterMenu(e4, f4) - }, filterFnLabels[f4.fn]), /* @__PURE__ */ Cn.createElement(FilterValueSpan, { - fieldType: (_a2 = cols.find((c4) => c4.name + c4.table == f4.field)) == null ? void 0 : _a2.type, - filter: f4, - selectFilterValue - }), /* @__PURE__ */ Cn.createElement("div", { - onClick: () => removeFilter(f4), - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })); - }), /* @__PURE__ */ Cn.createElement("span", null))); + })))); }; -var FilterValueSpan = (props2) => { - const { filter, selectFilterValue, fieldType } = props2; - const fnType = filterFnTypes[filter.fn]; - if (!fieldType || !fnType || fnType.valueType == "none") { - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); - } else if (filter.value.length == 0) { - return /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectFilterValue(e4, filter) - }, "Select"); - } else if (fieldType.startsWith("option") || fieldType.startsWith("context")) { - const options = parseMultiString(filter.value); - return /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectFilterValue(e4, filter) - }, " ", options.map((f4) => /* @__PURE__ */ Cn.createElement("span", null, f4))); + +// src/components/Spaces/SpaceEditor.tsx +var import_obsidian23 = require("obsidian"); + +// src/types/metadata.ts +var fileProps = { + "name": { + label: "File Name", + field: "name", + vType: "text", + type: "fileprop" + }, + "path": { + label: "Path", + field: "path", + vType: "text", + type: "fileprop" + }, + "parent": { + label: "Folder", + field: "parent", + vType: "text", + type: "fileprop" + }, + "sticker": { + label: "Sticker", + field: "sticker", + vType: "text", + type: "fileprop" + }, + "color": { + label: "Color", + field: "color", + vType: "text", + type: "fileprop" + }, + "ctime": { + label: "Created", + field: "ctime", + vType: "date", + type: "fileprop" + }, + "mtime": { + label: "Last Modified", + field: "mtime", + vType: "date", + type: "fileprop" + }, + "extension": { + label: "Extension", + field: "extension", + vType: "text", + type: "fileprop" + }, + "size": { + label: "Size", + field: "size", + vType: "number", + type: "fileprop" + } +}; +var fileMeta = { + "tags": { + label: "Tags", + field: "tags", + vType: "tags-multi", + type: "filemeta" + }, + "inlinks": { + label: "Linked Mentions", + field: "inlinks", + vType: "link-multi", + type: "filemeta" + }, + "outlinks": { + label: "Links", + field: "outlinks", + vType: "link-multi", + type: "filemeta" } - return /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectFilterValue(e4, filter) - }, filter.value); }; -// src/components/Spaces/SpaceEditor.tsx -var SpaceEditor = k3( - (props2, ref) => { - var _a2, _b2; - const [def, setDef] = h2( - (_a2 = props2.def) != null ? _a2 : { - type: "smart", - folder: "", - filters: [{ type: "any", trueFalse: true, filters: [] }] - } - ); - const selectFilterValue = (e4, filter, i4, k5) => { - var _a3; - const saveFilterValue = (value) => { - setDefFilterValue(value, i4, k5); - }; - switch ((_a3 = filterFnTypes[filter.fn]) == null ? void 0 : _a3.valueType) { - case "text": - case "number": - { - const menu = new import_obsidian24.Menu(); - menu.setUseNativeMenu(false); - menu.addItem((menuItem) => { - inputMenuItem( - menuItem, - filter.value, - (value) => saveFilterValue(value) - ); - menuItem.setIcon("type"); - }); - const offset = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); - } - break; - case "date": { - const saveValue = (date2) => { - saveFilterValue(date2.valueOf().toString()); - }; - const offset = e4.target.getBoundingClientRect(); - const date = new Date(filter.value); - showDatePickerMenu( - { x: offset.left, y: offset.top + 30 }, - date.getTime() ? date : null, - saveValue - ); - break; - } - case "list": - { - const fieldType = filter.fType; - const saveOptions = (options2, values) => { - saveFilterValue(serializeMultiString(values)); - }; - let options = []; - if (fieldType.startsWith("option")) { - options = parseMultiString(filter.value).map((f4) => ({ - name: f4, - value: f4 - })); - } else if (fieldType.startsWith("tags")) { - options = loadTags(props2.plugin).map((f4) => ({ - value: f4, - name: f4 - })); - } else if (fieldType.startsWith("links")) { - options = getAllAbstractFilesInVault(props2.plugin, app).map( - (f4) => ({ - name: fileNameToString(f4.name), - value: f4.path, - description: f4.path - }) - ); - } - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: true, - editable: true, - value: parseMultiString(filter.value), - options, - saveOptions, - placeholder: i18n_default.labels.optionItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); - } - break; - } - }; - const addDefGroup = () => { - setDef({ - ...def, - filters: [ - ...def.filters, - { - type: "any", - trueFalse: true, - filters: [] - } - ] - }); - }; - const removeDefGroup = (groupIndex) => { - setDef({ - ...def, - filters: def.filters.filter((f4, i4) => i4 == groupIndex ? false : true) - }); - }; - const typeForField = (type, field) => { - if (type == "frontmatter") { - return "text"; - } - if (type == "filemeta") { - return fileMeta[field].vType; - } - if (type == "fileprop") { - return fileProps[field].vType; +// src/utils/contexts/predicate/filterFns/filterFnLabels.ts +var filterFnLabels = { + isEmpty: i18n_default.filterTypes.isEmpty, + isNotEmpty: i18n_default.filterTypes.isNotEmpty, + include: i18n_default.filterTypes.contains, + notInclude: i18n_default.filterTypes.notContains, + is: i18n_default.filterTypes.is, + isNot: i18n_default.filterTypes.isNot, + equal: "=", + isGreatThan: ">", + isLessThan: "<", + isLessThanOrEqual: "\u2264", + isGreatThanOrEqual: "\u2265", + dateBefore: i18n_default.filterTypes.before, + dateAfter: i18n_default.filterTypes.after, + isAnyInList: i18n_default.filterTypes.anyOf, + isNoneInList: i18n_default.filterTypes.noneOf, + isTrue: i18n_default.filterTypes.checked, + isFalse: i18n_default.filterTypes.unchecked +}; + +// src/components/ContextView/ContextBuilder/ContextBuilderView.tsx +var import_classnames = __toESM(require_classnames()); + +// src/components/ContextView/ContextBuilder/TagSelector.tsx +var TagSelector = (props2) => { + const { + data, + tagContexts, + dbFileExists, + setContextTable, + saveDB: saveDB2, + tableData, + cols, + contextTable, + dbSchema, + contextInfo, + saveContextDB, + saveSchema, + loadContextFields + } = q2(MDBContext); + const removeContext = (value) => { + const tags = tagContexts.filter((f4) => value != f4); + saveSchema({ + ...dbSchema, + def: updateTagsForDefString(dbSchema.def, tags) + }); + }; + const addTag2 = async (tag) => { + const tags = uniq([...tagContexts, tag]); + tags.forEach((tag2) => { + initiateContextIfNotExists(props2.plugin, tag2).then( + (f4) => loadContextFields(tag2) + ); + }); + saveSchema({ + ...dbSchema, + def: updateTagsForDefString(dbSchema.def, tags) + }); + connectContext(props2.plugin, tag, contextInfo.dbPath); + }; + return /* @__PURE__ */ Cn.createElement(TagsView, { + plugin: props2.plugin, + tags: tagContexts, + canOpen: false, + addTag: props2.canAdd && addTag2, + removeTag: removeContext + }); +}; + +// src/components/ContextView/ContextBuilder/ContextDesigner.tsx +var ContextDesigner = (props2) => { + const { sortedColumns, predicate, savePredicate } = q2(MDBContext); + const [activeId, setActiveId] = h2(""); + const [overId, setOverId] = h2(""); + const items = sortedColumns.map((f4) => ({ ...f4, id: f4.name + f4.table })); + const sensors = useSensors( + useSensor(MouseSensor, { + activationConstraint: { + distance: 10 } - return "text"; - }; - const setDefFilter = (filter, groupIndex, filterIndex) => { - var _a3; - let type; - let field; - let fType; - const filterTuple = filter.split("."); - type = filterTuple[0]; - if (type == "frontmatter") { - fType = filterTuple[1]; - field = filterTuple[2]; - } else { - field = filterTuple[1]; - fType = typeForField(type, field); + }), + useSensor(TouchSensor, { + activationConstraint: { + delay: 250, + tolerance: 5 } - if (def.filters.length == 0) { - setDef({ - ...def, - filters: [ - { - type: "any", - trueFalse: true, - filters: [ - { - type, - field, - fType, - fn: "", - value: "" - } - ] - } - ] - }); - return; + }), + useSensor(KeyboardSensor, { + coordinateGetter: sortableKeyboardCoordinates + }) + ); + const resetState = () => { + setActiveId(null); + setOverId(null); + }; + return /* @__PURE__ */ Cn.createElement(DndContext, { + sensors, + collisionDetection: closestCenter, + measuring: { + droppable: { + strategy: MeasuringStrategy.Always } - if (((_a3 = def.filters[groupIndex]) == null ? void 0 : _a3.filters.length) == 0) { - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: [ - { - type, - field, - fType, - fn: "", - value: "" - } - ] - } : f4 - ) - }); + }, + onDragStart: ({ active }) => { + setActiveId(active.id); + }, + onDragOver: ({ active, over }) => { + const overId2 = over == null ? void 0 : over.id; + if (overId2) + setOverId(overId2); + }, + onDragEnd: ({ active, over }) => { + const overId2 = over == null ? void 0 : over.id; + if (!overId2) { + resetState(); return; } - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.map( - (g4, k5) => k5 == filterIndex ? { - ...g4, - type, - fType, - field - } : g4 - ) - } : f4 - ) - }); - }; - const setDefFilterFn = (fn2, groupIndex, filterIndex) => { - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.map( - (g4, k5) => k5 == filterIndex ? { - ...g4, - fn: fn2 - } : g4 - ) - } : f4 - ) - }); - }; - const setDefFilterValue = (value, groupIndex, filterIndex) => { - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.map( - (g4, k5) => k5 == filterIndex ? { - ...g4, - value - } : g4 - ) - } : f4 + savePredicate({ + ...predicate, + colsOrder: arrayMove( + predicate.colsOrder, + predicate.colsOrder.findIndex((f4) => f4 == activeId), + predicate.colsOrder.findIndex((f4) => f4 == overId2) ) }); - }; - const addDefFilter = (groupIndex) => { - if (groupIndex == 0 && def.filters.length == 0) { - setDef({ - ...def, - filters: [ - { - type: "any", - trueFalse: true, - filters: [ - { - type: "", - fType: "", - field: "", - value: "", - fn: "" - } - ] - } - ] - }); - } else { - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: [ - ...f4.filters, - { - type: "", - fType: "", - field: "", - value: "", - fn: "" - } - ] - } : f4 - ) - }); + resetState(); + }, + onDragCancel: resetState + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-context-maker-layout" + }, /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(SortableContext, { + items, + strategy: verticalListSortingStrategy + }, items.map((value, index) => { + return /* @__PURE__ */ Cn.createElement(SortableItem, { + id: value.id, + value: value.name + }); + })))), z3( + /* @__PURE__ */ Cn.createElement(DragOverlay, { + adjustScale: false + }, activeId ? /* @__PURE__ */ Cn.createElement(SortableItem, { + id: items.find((f4) => f4.id == activeId).id, + value: items.find((f4) => f4.id == activeId).name + }) : null), + document.body + )); +}; +function SortableItem(props2) { + const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: props2.id }); + const style = { + transform: CSS.Transform.toString(transform), + transition + }; + return /* @__PURE__ */ Cn.createElement("div", { + ref: setNodeRef, + style, + ...attributes, + ...listeners + }, props2.value); +} + +// src/components/ContextView/ContextBuilder/ContextBuilderView.tsx +var ContextBuilderView = (props2) => { + const { + data, + cols, + sortedColumns, + dbSchema, + schema, + contextInfo, + tableData, + contextTable, + saveColumn, + loadContextFields, + tagContexts, + hideColumn, + sortColumn, + delColumn, + saveDB: saveDB2, + saveContextDB, + dbFileExists, + predicate, + saveSchema + } = q2(MDBContext); + const [section, setSection] = h2(0); + const saveField = (field, oldField) => { + if (field.name.length > 0) { + if (field.name != oldField.name || field.type != oldField.type || field.value != oldField.value || field.attrs != oldField.attrs) { + const saveResult = saveColumn(field, oldField); } - }; - const removeDefFilter = (filterIndex, groupIndex) => { - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.filter( - (g4, k5) => k5 == filterIndex ? false : true - ) - } : f4 - ) - }); - }; - const setGroupType = (groupIndex, type) => { - if (groupIndex == 0 && def.filters.length == 0) { - setDef({ - ...def, - filters: [ - { - type, - trueFalse: true, - filters: [] - } - ] - }); - } else { - setDef({ - ...def, - filters: def.filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - type - } : f4 - ) - }); + } + }; + const saveContext = (field, oldField, value) => { + const newContext = value[0]; + initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { + if (f4) { + return insertContextItems( + props2.plugin, + optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ), + newContext + ); } + }).then((f4) => loadContextFields(newContext)); + const newField = { + ...field, + value: newContext != null ? newContext : "" }; - const selectGroupType = (e4, i4) => { - const offset = e4.target.getBoundingClientRect(); - const filters = ["any", "all"]; - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: filters.map((f4) => ({ name: f4, value: f4 })), - saveOptions: (_9, value) => setGroupType(i4, value[0]), - searchable: false, - showAll: true - } - ); - }; - const selectFilter = (e4, i4, k5) => { - const offset = e4.target.getBoundingClientRect(); - const { type, field, fType } = def.filters[i4].filters[k5]; - const filters = predicateFnsForType(fType, filterFnTypes); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: true, - value: [], - options: filters.map((f4) => ({ name: filterFnLabels[f4], value: f4 })), - saveOptions: (_9, value) => setDefFilterFn(value[0], i4, k5), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - }; - const selectField = (e4, i4, k5) => { - const offset = e4.target.getBoundingClientRect(); - const allFiles = retrieveAllFiles( - props2.plugin.index.vaultDBCache, - props2.plugin.settings - ); - const frontmatter = allMetadataForFiles( - props2.plugin, - allFiles.map((f5) => getAbstractFileAtPath(app, f5.path)).filter((f5) => f5 instanceof import_obsidian24.TFile) - ); - const fmTypes = guestimateTypes( - allFiles.map((f5) => f5.path), - props2.plugin, - false - ); - const f4 = [ - ...Object.keys(fileMeta).map((f5) => ({ - name: fileMeta[f5].label, - value: "filemeta." + f5 - })), - ...Object.keys(fileProps).map((f5) => ({ - name: fileProps[f5].label, - value: "fileprop." + f5 - })), - ...frontmatter.map((f5) => ({ - name: f5.name, - value: "frontmatter." + fmTypes[f5.name] + "." + f5.name - })) - ]; - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: f4, - saveOptions: (_9, value) => setDefFilter(value[0], i4, k5), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - }; - p2(() => { - ref.current = def; - }, [def]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-space-settings" - }, def.type == "smart" ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query" - }, def.filters.length == 0 ? /* @__PURE__ */ Cn.createElement(DefFilterGroup, { - selectGroupType, - group: null, - addDefGroup, - addDefFilter, - selectField, - i: 0, - removeDefGroup - }) : def.filters.map((f4, i4) => /* @__PURE__ */ Cn.createElement(DefFilterGroup, { - key: i4, - group: f4, - selectGroupType, - addDefGroup, - addDefFilter, - selectField, - i: i4, - removeDefGroup - }, f4.filters.map((filter, k5) => /* @__PURE__ */ Cn.createElement(DefFilter, { - key: k5, - filter, - i: i4, - k: k5, - selectField, - selectFilter, - selectFilterValue, - addDefFilter, - removeDefFilter - }))))) : /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item mod-toggle" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-info" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-name" - }, "Sync to Folder"), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-description" - }, "Select a folder to sync this space with all notes from a folder", /* @__PURE__ */ Cn.createElement("br", null), "Note: Existing items in the space will be removed from the space.")), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-control" - }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => { - const offset = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: [ - { name: "None", value: "" }, - ...getAllFoldersInVault(app).map((f4) => ({ - name: getFolderName(f4.path, app), - description: f4.path, - value: f4.path - })) - ], - saveOptions: (_9, values) => { - setDef((prev) => ({ ...prev, folder: values[0] })); - }, - searchable: true + saveColumn(newField, oldField); + }; + const showMenu = (e4, field) => { + const offset = e4.target.getBoundingClientRect(); + const options = optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ); + showPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + true, + options, + field, + cols, + contextInfo.contextPath, + (newField) => saveField(newField, field), + (newField, val) => saveContext(newField, field, val), + hideColumn, + delColumn, + sortColumn, + predicate.colsHidden.includes(field.name + field.table) + ); + }; + const saveNewField = (source, field) => { + saveColumn({ ...field, table: "" }); + }; + const newProperty = (e4) => { + const offset = e4.target.getBoundingClientRect(); + showNewPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + tagContexts, + [], + saveNewField, + "files", + contextInfo.contextPath, + false + ); + }; + const saveMetadata = (keys, table) => { + const files = data.map((f4) => f4.File); + const importDV = (files2, dvKeys) => { + return files2.reduce( + (p3, c4) => { + const dvValues = props2.plugin.dataViewAPI().page(c4); + if (!dvValues) { + return p3; + } + return { + uniques: [], + cols: uniqCaseInsensitive([...p3.cols, ...dvKeys]), + rows: [ + ...p3.rows, + { + File: c4, + ...dvKeys.reduce( + (p4, c5) => ({ + ...p4, + [c5]: parseDataview(c5, dvValues[c5]) + }), + {} + ) + } + ] + }; + }, + { uniques: [], cols: [], rows: [] } + ); + }; + const importYAML = (files2, fmKeys) => { + return files2.map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4).reduce( + (p3, c4) => { + const fm = frontMatterForFile(c4); + if (!fm) { + return p3; } + return { + uniques: [], + cols: uniq([...p3.cols, ...fmKeys]), + rows: [ + ...p3.rows, + { + File: c4.path, + ...fmKeys.reduce( + (p4, c5) => ({ + ...p4, + [c5]: parseFrontMatter(c5, fm[c5]) + }), + {} + ) + } + ] + }; + }, + { uniques: [], cols: [], rows: [] } + ); + }; + let yamlTableData = importYAML( + files, + keys.filter((f4) => f4.type == "fm").map((f4) => f4.name) + ); + let yamlTypes = guestimateTypes(files, props2.plugin, false); + if (props2.plugin.dataViewAPI()) { + const dvTableData = importDV( + files, + keys.filter((f4) => f4.type == "dv").map((f4) => f4.name) + ); + const dvTypes = guestimateTypes(files, props2.plugin, true); + yamlTableData = { + uniques: uniq([...yamlTableData.uniques, ...dvTableData.uniques]), + cols: uniqCaseInsensitive([...yamlTableData.cols, ...dvTableData.cols]), + rows: files.map((file) => { + var _a2, _b2; + return { + ...(_a2 = yamlTableData.rows.find((r3) => r3.File == file)) != null ? _a2 : {}, + ...(_b2 = dvTableData.rows.find((r3) => r3.File == file)) != null ? _b2 : {} + }; + }) + }; + yamlTypes = { ...yamlTypes, ...dvTypes }; + } + if (table == "") { + const newTable = mergeTableData(tableData, yamlTableData, yamlTypes); + saveDB2(newTable); + } else { + if (!dbFileExists) { + saveDB2(tableData).then( + () => syncMetadataContext(yamlTableData, yamlTypes, table) ); + } else { + syncMetadataContext(yamlTableData, yamlTypes, table); } - }, ((_b2 = def.folder) == null ? void 0 : _b2.length) > 0 ? getFolderName(def.folder, app) : "None")))); - } -); -SpaceEditor.displayName = "SpaceEditor"; -var SpaceEditor_default = SpaceEditor; -var DefFilter = (props2) => { - var _a2; - const { - filter, - selectField, - selectFilter, - selectFilterValue, - addDefFilter, - removeDefFilter, - i: i4, - k: k5 - } = props2; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query-filter" + } + }; + const syncMetadataContext = (yamlTableData, yamlTypes, table) => { + if (contextTable[table]) { + const newTable = mergeTableData( + contextTable[table], + yamlTableData, + yamlTypes + ); + saveContextDB(newTable, table); + saveSchema({ + ...dbSchema, + def: updateTagsForDefString( + dbSchema.def, + uniq([...tagContexts, table]) + ) + }); + } else { + getMDBTable(props2.plugin, tagContextFromTag(props2.plugin, table), "files").then((f4) => { + if (f4) { + const newTable = mergeTableData(f4, yamlTableData, yamlTypes); + return saveContextDB(newTable, table); + } + }).then(() => { + saveSchema({ + ...dbSchema, + def: updateTagsForDefString( + dbSchema.def, + uniq([...tagContexts, table]) + ) + }); + }); + } + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-context-maker-preview" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectField(e4, i4, k5) - }, filter.field.length == 0 ? "Select" : filter.field), filter.field.length > 0 && /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectFilter(e4, i4, k5) - }, !filterFnLabels[filter.fn] ? "Select" : filterFnLabels[filter.fn]), filter.field.length > 0 && filterFnLabels[filter.fn] && ((_a2 = filterFnTypes[filter.fn]) == null ? void 0 : _a2.valueType) != "none" && /* @__PURE__ */ Cn.createElement("span", null, /* @__PURE__ */ Cn.createElement(FilterValueSpan, { - fieldType: filter.fType, - filter, - selectFilterValue: (e4, h5) => selectFilterValue(e4, h5, i4, k5) - }))), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { - "aria-label": i18n_default.buttons.addTag, - onClick: (e4) => addDefFilter(i4) + className: (schema == null ? void 0 : schema.type) == "card" ? "mk-cards-container mk-cards-grid" : "mk-list-container" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - })), /* @__PURE__ */ Cn.createElement("button", { - onClick: () => removeDefFilter(k5, i4) + className: "mk-list-item" + }, sortedColumns.filter((f4) => f4.type == "preview" && f4.table == "").map((f4) => /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: defaultValueForPropertyType( + f4.name, + f4.value, + f4.type + ), + column: f4, + index: 0, + file: "", + editable: false + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-list-fields" + }, sortedColumns.filter((f4) => f4.type != "preview").map((f4, i4) => /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: defaultValueForPropertyType( + f4.name, + f4.value, + f4.type + ), + index: 0, + file: "", + column: { ...f4, table: "" }, + editable: false, + updateValue: (v3) => { + }, + updateFieldValue: (fv, v3) => { + }, + contextTable: {} + })))))), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-context-maker-selector" + }, section == 0 ? /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames.default)("mk-section-title") + }, (dbSchema == null ? void 0 : dbSchema.primary) == "true" ? contextDisplayName(contextInfo) : "Properties"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option" + }, cols.filter( + (f4) => !(f4.type == "preview" && f4.table != "") && f4.table == "" + ).map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { + key: i4 }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }))); -}; -var DefFilterGroup = (props2) => { - var _a2; - const { - group, - selectGroupType, - addDefGroup, - addDefFilter, - selectField, - i: i4, - removeDefGroup - } = props2; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query-group" + className: (0, import_classnames.default)( + "mk-cell-option-item", + !predicate.colsHidden.includes(f4.name + f4.table) && "mk-is-active" + ), + onClick: (e4) => hideColumn( + f4, + !predicate.colsHidden.includes(f4.name + f4.table) + ), + onContextMenu: (e4) => showMenu(e4, f4) + }, /* @__PURE__ */ Cn.createElement("div", null, f4.name, " ")))), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option-item" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query-group-type" + className: (0, import_classnames.default)(`mk-icon-xsmall`), + onClick: (e4) => newProperty(e4), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-plus"] + } + }))), (dbSchema == null ? void 0 : dbSchema.primary) == "true" && contextInfo.type != "tag" && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames.default)("mk-section-title") + }, "Contexts"), /* @__PURE__ */ Cn.createElement(TagSelector, { + plugin: props2.plugin, + canAdd: true + }), tagContexts.map((t4) => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames.default)("mk-section-title") + }, t4 == "" ? contextDisplayName(contextInfo) : t4), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option" + }, cols.filter( + (f4) => !(f4.type == "preview" && f4.table != "") && f4.table == t4 + ).map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { + key: i4 }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, "Match", " ", /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectGroupType(e4, i4) - }, (_a2 = group == null ? void 0 : group.type) != null ? _a2 : "any"), " ", "of the following"), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { - "aria-label": i18n_default.buttons.addTag, - onClick: (e4) => addDefGroup() + className: (0, import_classnames.default)( + "mk-cell-option-item", + !predicate.colsHidden.includes( + f4.name + f4.table + ) && "mk-is-active" + ), + onClick: (e4) => hideColumn( + f4, + !predicate.colsHidden.includes( + f4.name + f4.table + ) + ), + onContextMenu: (e4) => showMenu(e4, f4) + }, /* @__PURE__ */ Cn.createElement("div", null, f4.name, " ")))), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-option-item" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - })), i4 > 0 ? /* @__PURE__ */ Cn.createElement("button", { - onClick: () => removeDefGroup(i4) + className: (0, import_classnames.default)(`mk-icon-xsmall`), + onClick: (e4) => newProperty(e4), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-plus"] + } + })))))), (dbSchema == null ? void 0 : dbSchema.primary) == "true" && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames.default)("mk-section-title") + }, "Metadata"), /* @__PURE__ */ Cn.createElement(SyncMetadataComponent, { + plugin: props2.plugin, + columns: cols, + syncColumn: (columns, table) => saveMetadata([columns], table), + files: data.map((f4) => getAbstractFileAtPath(app, f4.File)).filter((f4) => f4) + }))) : /* @__PURE__ */ Cn.createElement(ContextDesigner, null)), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-section-tabs" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter-bar mk-query-filters" - }, !group || group.filters.length == 0 ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query-filter" + className: (0, import_classnames.default)( + "mk-section-title", + section == 0 && "mk-is-active" + ), + onClick: () => setSection(0) }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectField(e4, i4, 0) - }, "Select")), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { - "aria-label": i18n_default.buttons.addTag, - onClick: (e4) => addDefFilter(i4) + className: (0, import_classnames.default)(`mk-icon-small`), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-edit"] + } + }), "Properties"), /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames.default)( + "mk-section-title", + section == 1 && "mk-is-active" + ), + onClick: () => setSection(1) }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - }))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.children))); + className: (0, import_classnames.default)(`mk-icon-small`), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-stack"] + } + }), "Layout"))); }; -// src/components/ui/modals/editSpaceModal.tsx -var import_obsidian25 = require("obsidian"); -var EditSpaceModal = class extends import_obsidian25.Modal { - constructor(plugin, space, action) { +// src/components/ui/modals/contextEditorModal.tsx +var import_obsidian19 = require("obsidian"); +var ContextEditorModal = class extends import_obsidian19.Modal { + constructor(plugin, context, view) { super(plugin.app); - this.space = space; - this.action = action; + this.context = context; + this.view = view; this.plugin = plugin; } onOpen() { - const { contentEl } = this; + let { contentEl } = this; + let myModal = this; + myModal.modalEl.toggleClass("mk-context-maker", true); let headerText; - if (this.action === "rename") { - if (this.space.def.type == "smart") { - headerText = i18n_default.labels.renameSectionSmart; - } else { - headerText = i18n_default.labels.renameSection; - } - headerText = i18n_default.labels.renameSection; - } else if (this.action === "create") { - if (this.space.def.type == "smart") { - headerText = i18n_default.labels.createSectionSmart; - } else { - headerText = i18n_default.labels.createSection; - } - } - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - const inputEl = contentEl.createEl("input"); - inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; - if (this.action === "rename") { - inputEl.value = this.space.name; - } - inputEl.focus(); - const queryEl = contentEl.createDiv("mk-space-query"); + headerText = i18n_default.labels.contextMaker; + const queryEl = contentEl.createDiv("mk-context-maker-container"); const root = createRoot(queryEl); - this.ref = Cn.createRef(); root.render( - /* @__PURE__ */ Cn.createElement(SpaceEditor_default, { + /* @__PURE__ */ Cn.createElement(MDBProvider, { plugin: this.plugin, - def: this.space.def, - ref: this.ref - }) + context: this.context, + schema: this.view + }, /* @__PURE__ */ Cn.createElement(ContextBuilderView, { + plugin: this.plugin + })) ); - let changeButtonText; - if (this.action === "rename") { - changeButtonText = i18n_default.buttons.saveSpace; - } else if (this.action === "create") { - changeButtonText = i18n_default.buttons.saveSpace; + } + onClose() { + let { contentEl } = this; + contentEl.empty(); + } +}; + +// src/components/ui/modals/mergeColumnModal.ts +var import_obsidian20 = require("obsidian"); +var MergeColumnModal = class extends import_obsidian20.Modal { + constructor(columns, mergeColumn) { + super(app); + this.columns = columns; + this.mergeColumn = mergeColumn; + } + onOpen() { + let { contentEl } = this; + let myModal = this; + let headerText = i18n_default.labels.mergeProperties; + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const containerEl = contentEl.createEl("div"); + containerEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; + const select = containerEl.createEl("select"); + for (var i4 = 0; i4 < this.columns.length; i4++) { + var opt = document.createElement("option"); + opt.value = i4.toString(); + opt.innerHTML = this.columns[i4].name + this.columns[i4].table; + select.appendChild(opt); + } + const select2 = containerEl.createEl("select"); + for (var i4 = 0; i4 < this.columns.length; i4++) { + var opt = document.createElement("option"); + opt.value = i4.toString(); + opt.innerHTML = this.columns[i4].name + this.columns[i4].table; + select2.appendChild(opt); } + let changeButtonText = i18n_default.buttons.merge; const changeButton = contentEl.createEl("button", { text: changeButtonText }); @@ -38206,401 +36418,555 @@ var EditSpaceModal = class extends import_obsidian25.Modal { }); cancelButton.style.cssText = "float: right;"; cancelButton.addEventListener("click", () => { - this.close(); + myModal.close(); }); const onClickAction = async () => { - const newName = inputEl.value.replace(/\//g, ""); - if (newName.length == 0) { - new import_obsidian25.Notice(i18n_default.notice.newSpaceName); - return; - } - if (this.plugin.index.spacesIndex.has(newName) && newName != this.space.name) { - new import_obsidian25.Notice(i18n_default.notice.duplicateSpaceName); - return; - } - if (this.action === "rename") { - saveSpace(this.plugin, this.space.name, { - ...this.space, - def: this.ref.current, - name: newName - }); - } else if (this.action === "create") { - insertSpaceAtIndex( - this.plugin, - { name: newName, pinned: "home", def: this.ref.current }, - 0 - ); - } - this.close(); + this.mergeColumn( + this.columns[parseInt(select.value)], + this.columns[parseInt(select2.value)] + ); + myModal.close(); }; changeButton.addEventListener("click", onClickAction); - inputEl.addEventListener("keydown", (e4) => { - if (e4.key === "Enter") - onClickAction(); - }); } onClose() { - const { contentEl } = this; + let { contentEl } = this; contentEl.empty(); } }; -// src/components/ui/menus/fileMenu.tsx -var import_obsidian26 = require("obsidian"); - -// src/utils/color.ts -var colors = [ - ["Red", "#eb3b5a"], - ["Orange", "#fa8231"], - ["Yellow", "#f7b731"], - ["Green", "#20bf6b"], - ["Turquoise", "#0fb9b1"], - ["Teal", "#2d98da"], - ["Blue", "#3867d6"], - ["Purple", "#8854d0"], - ["Charcoal", "#4b6584"] -]; - -// src/components/ui/menus/fileMenu.tsx -var triggerSectionAddMenu = (plugin, e4) => { - const fileMenu = new import_obsidian26.Menu(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus"); - menuItem.setTitle(i18n_default.buttons.createSection); - menuItem.onClick((ev) => { - let vaultChangeModal = new EditSpaceModal( - plugin, - { - name: "", - def: { - type: "focus", - folder: "", - filters: [] - } - }, - "create" - ); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus"); - menuItem.setTitle(i18n_default.buttons.createSectionSmart); - menuItem.onClick((ev) => { - let vaultChangeModal = new EditSpaceModal( - plugin, - { - name: "", - def: { - type: "smart", - folder: "", - filters: [] - } - }, - "create" - ); - vaultChangeModal.open(); +// src/components/ui/modals/saveViewModal.ts +var import_obsidian21 = require("obsidian"); +var SaveViewModal = class extends import_obsidian21.Modal { + constructor(schema, saveSchema, action) { + super(app); + this.schema = schema; + this.saveSchema = saveSchema; + this.action = action; + } + onOpen() { + let { contentEl } = this; + let myModal = this; + let headerText; + if (this.action == "new view") + headerText = i18n_default.labels.saveView; + if (this.action == "new table") + headerText = i18n_default.labels.saveTable; + if (this.action == "rename view") + headerText = i18n_default.labels.renameView; + if (this.action == "rename table") + headerText = i18n_default.labels.renameTable; + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const inputEl = contentEl.createEl("input"); + inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; + inputEl.focus(); + let changeButtonText; + if (this.action == "new view") + changeButtonText = i18n_default.buttons.saveView; + if (this.action == "new table") + changeButtonText = i18n_default.buttons.saveTable; + if (this.action == "rename view") + changeButtonText = i18n_default.buttons.renameView; + if (this.action == "rename table") + changeButtonText = i18n_default.buttons.renameTable; + const changeButton = contentEl.createEl("button", { + text: changeButtonText }); - }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel }); - } - return false; -}; -var triggerSectionMenu = (plugin, space, spaces2, e4, activeFile2) => { - if (!space) - return; - const fileMenu = new import_obsidian26.Menu(); - const spaceName = space.name; - fileMenu.addItem((menuItem) => { - menuItem.setIcon("edit"); - menuItem.setTitle(i18n_default.buttons.createNote); - menuItem.onClick((ev) => { - newFileInSpace(plugin, space, activeFile2); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + myModal.close(); }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("layout-dashboard"); - menuItem.setTitle(i18n_default.buttons.createCanvas); - menuItem.onClick((ev) => { - newFileInSpace(plugin, space, activeFile2, true); + const onClickAction = async () => { + let newName = inputEl.value; + if (this.action == "new view" || this.action == "new table") { + this.saveSchema({ ...this.schema, id: newName, name: newName }); + } else { + this.saveSchema({ ...this.schema, name: newName }); + } + myModal.close(); + }; + changeButton.addEventListener("click", onClickAction); + inputEl.addEventListener("keydown", (e4) => { + if (e4.key === "Enter") { + e4.preventDefault(); + onClickAction(); + } }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("folder-plus"); - menuItem.setTitle(i18n_default.buttons.createFolder); - menuItem.onClick((ev) => { - newFolderInSpace(plugin, space, activeFile2); + } + onClose() { + let { contentEl } = this; + contentEl.empty(); + } +}; + +// src/components/ContextView/FilterBar/FilterBar.tsx +var import_obsidian22 = require("obsidian"); + +// src/components/ContextView/FilterBar/SearchBar.tsx +var SearchBar = (props2) => { + const clearSearch = () => { + props2.setSearchString(""); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-view-search" + }, /* @__PURE__ */ Cn.createElement("button", { + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-search"] } + }), /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("input", { + onChange: (e4) => props2.setSearchString(e4.target.value), + placeholder: i18n_default.labels.searchPlaceholder, + className: "mk-search-bar" + }), /* @__PURE__ */ Cn.createElement("button", { + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-clear"] }, + onClick: () => clearSearch() + }))); +}; + +// src/components/ContextView/FilterBar/FilterBar.tsx +var FilterBar = (props2) => { + const ctxRef = _2(null); + const { + tables, + data, + setDBSchema, + loadContextFields, + cols, + deleteSchema, + saveSchema, + saveDB: saveDB2, + saveContextDB, + setSchema, + setSearchString, + predicate, + tagContexts, + savePredicate, + hideColumn, + saveColumn, + sortColumn, + delColumn, + schema, + dbSchema, + contextInfo, + contextTable, + tableData + } = q2(MDBContext); + const filteredCols = cols.filter((f4) => f4.hidden != "true"); + const saveViewType = (type) => { + saveSchema({ + ...schema, + type }); - }); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - const pinned = (space == null ? void 0 : space.pinned) == "false" || (space == null ? void 0 : space.pinned) == "home"; - menuItem.setTitle(i18n_default.menu.homeSpace); - menuItem.setIcon("home"); - menuItem.setChecked(pinned); - menuItem.onClick((ev) => { - toggleSpacePin(plugin, spaceName, "home"); + }; + const views = tables.filter((f4) => f4.type != "db" && f4.def == (dbSchema == null ? void 0 : dbSchema.id)); + const selectView = (_dbschema, value) => { + setDBSchema(_dbschema); + value && setSchema(tables.find((f4) => f4.id == value)); + }; + const openView = (e4, view) => { + const dbSchema2 = tables.find((f4) => f4.type == "db" && f4.id == view.def); + if (dbSchema2) { + selectView(dbSchema2, view.id); + return; + } + return; + }; + const showViewMenu = (e4, _dbschema) => { + const views2 = tables.filter((f4) => f4.type != "db" && f4.def == _dbschema.id); + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: tagContexts, + options: views2.map((m5) => ({ name: m5.name, value: m5.id })), + saveOptions: (_9, value) => selectView(_dbschema, value[0]), + placeholder: i18n_default.labels.viewItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + }; + const clearFilters = () => { + savePredicate({ + ...predicate, + filters: [], + sort: [] }); - }); - fileMenu.addItem((menuItem) => { - const pinned = (space == null ? void 0 : space.pinned) == "true" || (space == null ? void 0 : space.pinned) == "pinned"; - menuItem.setTitle(i18n_default.menu.pinSpace); - menuItem.setIcon("pin"); - menuItem.setChecked(pinned); - menuItem.onClick((ev) => { - toggleSpacePin(plugin, spaceName, "pinned"); + }; + const clearHiddenCols = () => { + savePredicate({ + ...predicate, + colsHidden: [] }); - }); - fileMenu.addItem((menuItem) => { - const space2 = spaces2.find((f4) => f4.name == spaceName); - const pinned = (space2 == null ? void 0 : space2.pinned) == "none"; - menuItem.setTitle(i18n_default.menu.unpinSpace); - menuItem.setIcon("pin-off"); - menuItem.onClick((ev) => { - toggleSpacePin(plugin, spaceName, "none"); + }; + const removeFilter = (filter) => { + const newFilters = [ + ...predicate.filters.filter((f4) => f4.field != filter.field) + ]; + savePredicate({ + ...predicate, + filters: newFilters }); - }); - if (plugin.settings.spacesStickers) { + }; + const viewContextMenu = (e4, _schema) => { + const fileMenu = new import_obsidian22.Menu(); fileMenu.addSeparator(); fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - const vaultChangeModal = new stickerModal( - plugin.app, - plugin, - (emoji) => saveSpaceIcon(plugin, spaceName, emoji) + menuItem.setTitle("Copy Embed Link"); + menuItem.onClick(() => { + navigator.clipboard.writeText( + contextEmbedStringFromContext(contextInfo, _schema.id) ); - vaultChangeModal.open(); }); }); fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeSpaceIcon(plugin, spaceName); + menuItem.setTitle("Rename View"); + menuItem.onClick(() => { + let vaultChangeModal = new SaveViewModal( + _schema, + (s5) => saveSchema(s5), + "rename view" + ); + vaultChangeModal.open(); }); }); - } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.collapseAll); - menuItem.setIcon("lucide-chevrons-down-up"); - menuItem.onClick((ev) => { - plugin.settings.expandedFolders = { - ...plugin.settings.expandedFolders, - [spaceName]: [] - }; - plugin.saveSettings(); - }); - }); - fileMenu.addSeparator(); - if (space.def.type == "focus") { fileMenu.addItem((menuItem) => { - const sortOption = ["rank", true]; - menuItem.setIcon("arrow-up-down"); - menuItem.setTitle(i18n_default.menu.customSort); - menuItem.setChecked( - space.sort == JSON.stringify(sortOption) || space.sort == "" - ); - menuItem.onClick((ev) => { - updateSpaceSort(plugin, spaceName, sortOption); + menuItem.setTitle("Delete View"); + menuItem.onClick(() => { + deleteSchema(_schema); }); }); - } - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortBy); - menuItem.setIcon("sort-desc"); - menuItem.onClick((ev) => { - const sortMenu = new import_obsidian26.Menu(); - sortMenu.addItem((menuItem2) => { - const sortOption = ["path", true]; - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); - menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, spaceName, sortOption); - }); - }); - sortMenu.addItem((menuItem2) => { - const sortOption = ["path", false]; - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); - menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, spaceName, sortOption); - }); - }); - sortMenu.addSeparator(); - sortMenu.addItem((menuItem2) => { - const sortOption = ["ctime", false]; - menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); - menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, spaceName, sortOption); - }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY }); - sortMenu.addItem((menuItem2) => { - const sortOption = ["ctime", true]; - menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); - menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, spaceName, sortOption); - }); + } + }; + const showFilterMenu = (e4) => { + const menu = new import_obsidian22.Menu(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.tableView); + item.setIcon("table-2"); + item.onClick(() => { + saveViewType("table"); }); - const offset = e4.target.getBoundingClientRect(); - if (isMouseEvent(e4)) { - sortMenu.showAtPosition({ x: offset.left, y: offset.top + 30 }); - } else { - sortMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } }); - }); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.edit); - menuItem.setIcon("pencil"); - menuItem.onClick((ev) => { - let vaultChangeModal = new EditSpaceModal(plugin, space, "rename"); - vaultChangeModal.open(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.cardView); + item.setIcon("layout-grid"); + item.onClick(() => { + saveViewType("card"); + }); }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteSpace); - menuItem.setIcon("trash"); - menuItem.onClick((ev) => { - removeSpace(plugin, space.name); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.listView); + item.setIcon("layout-list"); + item.onClick(() => { + saveViewType("list"); + }); }); - }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY + if (dbSchema == null ? void 0 : dbSchema.primary) { + menu.addItem((item) => { + item.setTitle(i18n_default.menu.flowView); + item.setIcon("infinity"); + item.onClick(() => { + saveViewType("flow"); + }); + }); + } + menu.addSeparator(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.groupBy); + item.setIcon("columns"); + item.onClick(() => { + showGroupByMenu(e4); + }); }); - } - return false; -}; -var triggerMultiFileMenu = (plugin, selectedFiles2, e4) => { - const files = selectedFiles2.map((s5) => s5.item.path); - const spaces2 = plugin.index.allSpaces(); - const spaceItems = retrieveSpaceItems(plugin, spaces2); - const fileMenu = new import_obsidian26.Menu(); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus"); - menuItem.setTitle("Add to Space"); - menuItem.onClick((ev) => { - let vaultChangeModal = new AddToSpaceModal( - plugin, - selectedFiles2.map((f4) => f4.path) - ); - vaultChangeModal.open(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.sortBy); + item.setIcon("sort-desc"); + item.onClick(() => { + showSortMenu(e4); + }); }); - }); - if (plugin.settings.spacesStickers) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("palette"); - disclosureMenuItem( - menuItem, - false, - false, - i18n_default.menu.changeColor, - "", - [ - { name: "None", value: "" }, - ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) - ], - (_9, values) => { - saveFileColors(plugin, files, values[0]); - } - ); + menu.addSeparator(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.newFilter); + item.setIcon("filter"); + item.onClick(() => { + showAddFilterMenu(e4); + }); }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - const vaultChangeModal = new stickerModal( - plugin.app, - plugin, - (emoji) => saveFileIcons(plugin, files, emoji) - ); - vaultChangeModal.open(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.clearFilters); + item.setIcon("x-square"); + item.onClick(() => { + clearFilters(); }); }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeFileIcons(plugin, files); + menu.addSeparator(); + menu.addItem((item) => { + item.setTitle(i18n_default.menu.unhideFields); + item.setIcon("eye"); + item.onClick(() => { + clearHiddenCols(); }); }); - } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteFiles); - menuItem.setIcon("trash"); - menuItem.onClick((ev) => { - deleteFiles(plugin, files); + const offset = e4.target.getBoundingClientRect(); + menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + }; + const addSort = (_9, sort) => { + var _a2; + const field = sort[0]; + const fieldType = (_a2 = filteredCols.find((f4) => f4.name + f4.table == field)) == null ? void 0 : _a2.type; + if (fieldType) { + const type = defaultPredicateFnForType(fieldType, sortFnTypes); + const newSort = { + field, + fn: type + }; + savePredicate({ + ...predicate, + sort: [ + ...predicate.sort.filter((s5) => s5.field != newSort.field), + newSort + ] + }); + } + }; + const saveGroupBy = (_9, groupBy2) => { + savePredicate({ + ...predicate, + groupBy: groupBy2 }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("go-to-file"); - menuItem.setTitle(i18n_default.menu.openFilePane); - menuItem.onClick((ev) => { - files.forEach( - (file) => openAFile(getAbstractFileAtPath(app, file), plugin, true) - ); + }; + const removeSort = (sort) => { + const newSort = [...predicate.sort.filter((f4) => f4.field != sort.field)]; + savePredicate({ + ...predicate, + sort: newSort }); - }); - if (!internalPluginLoaded("file-explorer", plugin.app)) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.moveFile); - menuItem.setIcon("paper-plane"); - menuItem.onClick((ev) => { - let fileMoveSuggester = new MoveSuggestionModal(plugin.app, files); - fileMoveSuggester.open(); + }; + const addFilter = (_9, filter) => { + var _a2; + const field = filter[0]; + const fieldType = (_a2 = filteredCols.find((f4) => f4.name + f4.table == field)) == null ? void 0 : _a2.type; + if (fieldType) { + const type = defaultPredicateFnForType(fieldType, filterFnTypes); + const newFilter = fieldType == "boolean" ? { + field, + fn: type, + value: "true" + } : { + field, + fn: type, + value: "" + }; + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s5) => s5.field != newFilter.field), + newFilter + ] + }); + } + }; + const changeSortMenu = (e4, sort) => { + var _a2; + const offset = e4.target.getBoundingClientRect(); + const saveSort = (_9, newType) => { + const type = newType[0]; + const newSort = { + ...sort, + fn: type + }; + savePredicate({ + ...predicate, + sort: [ + ...predicate.sort.filter((s5) => s5.field != newSort.field), + newSort + ] }); - }); - } - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - return false; -}; -var triggerFileMenu = (plugin, file, isFolder, e4, source = "file-explorer") => { - const spaces2 = plugin.index.allSpaces(); - const spaceItems = retrieveSpaceItems(plugin, spaces2); - const cache = plugin.index.filesIndex.get(file.path); - const fileMenu = new import_obsidian26.Menu(); - if (isFolder) { - fileMenu.addSeparator(); + }; + const fieldType = (_a2 = filteredCols.find( + (f4) => f4.name + f4.table == sort.field + )) == null ? void 0 : _a2.type; + const sortsForType = predicateFnsForType(fieldType, sortFnTypes); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: sortsForType.map((f4) => ({ + name: sortFnTypes[f4].label, + value: f4 + })), + saveOptions: saveSort, + placeholder: i18n_default.labels.sortItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + }; + const showColsMenu = (e4) => { + let vaultChangeModal = new ContextEditorModal( + props2.plugin, + contextInfo, + schema == null ? void 0 : schema.id + ); + vaultChangeModal.open(); + }; + const saveField = (field, oldField) => { + if (field.name.length > 0) { + if (field.name != oldField.name || field.type != oldField.type || field.value != oldField.value || field.attrs != oldField.attrs) { + const saveResult = saveColumn(field, oldField); + } + } + }; + const showMenu = (e4, field) => { + const offset = e4.target.getBoundingClientRect(); + const options = optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ); + showPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + true, + options, + field, + cols, + contextInfo.contextPath, + (newField) => saveField(newField, field), + (newField, val) => { + }, + hideColumn, + delColumn, + sortColumn, + predicate.colsHidden.includes(field.name + field.table) + ); + }; + const changeFilterMenu = (e4, filter) => { + var _a2; + const offset = e4.target.getBoundingClientRect(); + const saveFilter = (_9, newType) => { + const type = newType[0]; + const newFilter = { + ...filter, + fn: type + }; + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s5) => s5.field != newFilter.field), + newFilter + ] + }); + }; + const fieldType = (_a2 = filteredCols.find( + (f4) => f4.name + f4.table == filter.field + )) == null ? void 0 : _a2.type; + const filtersForType = predicateFnsForType(fieldType, filterFnTypes); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: filtersForType.map((f4) => ({ + name: filterFnLabels[f4], + value: f4 + })), + saveOptions: saveFilter, + placeholder: i18n_default.labels.filterItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + }; + const showAddFilterMenu = (e4) => { + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: filteredCols.filter((f4) => predicateFnsForType(f4.type, filterFnTypes).length > 0).map((f4) => ({ + name: f4.name + f4.table, + value: f4.name + f4.table + })), + saveOptions: addFilter, + placeholder: i18n_default.labels.propertyItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + }; + const showSortMenu = (e4) => { + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: filteredCols.map((f4) => ({ + name: f4.name + f4.table, + value: f4.name + f4.table + })), + saveOptions: addSort, + placeholder: i18n_default.labels.sortItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + }; + const showGroupByMenu = (e4) => { + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: filteredCols.filter((f4) => f4.primary != "true").map((f4) => ({ + name: f4.name + f4.table, + value: f4.name + f4.table + })), + saveOptions: saveGroupBy, + placeholder: i18n_default.labels.propertyItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + }; + const showAddMenu = (e4) => { + const fileMenu = new import_obsidian22.Menu(); + const folder = getAbstractFileAtPath( + app, + contextInfo.contextPath + ); fileMenu.addItem((menuItem) => { menuItem.setIcon("edit"); menuItem.setTitle(i18n_default.buttons.createNote); menuItem.onClick((ev) => { - newFileInFolder(plugin, file); + newFileInFolder(props2.plugin, folder); }); }); fileMenu.addItem((menuItem) => { menuItem.setIcon("layout-dashboard"); menuItem.setTitle(i18n_default.buttons.createCanvas); menuItem.onClick((ev) => { - createNewCanvasFile(plugin, file, ""); + createNewCanvasFile(props2.plugin, folder, ""); }); }); fileMenu.addItem((menuItem) => { @@ -38608,1500 +36974,2134 @@ var triggerFileMenu = (plugin, file, isFolder, e4, source = "file-explorer") => menuItem.setTitle(i18n_default.buttons.createFolder); menuItem.onClick((ev) => { let vaultChangeModal = new VaultChangeModal( - plugin, - file, + props2.plugin, + folder, "create folder", "/" ); vaultChangeModal.open(); }); }); - } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus-square"); - menuItem.setTitle("Add to Space"); - menuItem.onClick((ev) => { - let vaultChangeModal = new AddToSpaceModal(plugin, [file.path]); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("minus-square"); - menuItem.setTitle("Remove from Space"); - menuItem.onClick((ev) => { - let vaultChangeModal = new RemoveFromSpaceModal(plugin, file.path); - vaultChangeModal.open(); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; + }; + const showFMMenu2 = (e4) => { + const menu = new import_obsidian22.Menu(); + menu.addItem((menuItem) => { + menuItem.setIcon("log-in"); + menuItem.setTitle(i18n_default.menu.mergeProperties); + menuItem.onClick(() => { + showMergeColumnModal(); + }); }); - }); - if (isFolder) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.createFolderSpace); - menuItem.setIcon("folder-plus"); - menuItem.onClick((ev) => { - insertSpaceAtIndex( - plugin, + const offset = e4.target.getBoundingClientRect(); + menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + }; + const mergeColumn = (fromCol, toCol) => { + const fromTable = fromCol.table == "" ? tableData : contextTable[fromCol.table]; + if (toCol.table == "") { + saveDB2({ + ...tableData, + rows: tableData.rows.map((r3, i4) => { + const foundRow = fromTable.rows.find((f4) => f4.File == r3.File); + return foundRow ? { ...r3, [toCol.name]: foundRow[fromCol.name] } : r3; + }) + }); + } else { + saveContextDB( + { + ...contextTable[toCol.table], + rows: contextTable[toCol.table].rows.map((r3, i4) => { + const foundRow = fromTable.rows.find((f4) => f4.File == r3.File); + return foundRow ? { ...r3, [toCol.name]: foundRow[fromCol.name] } : r3; + }) + }, + toCol.table + ); + } + }; + const showMergeColumnModal = () => { + var _a2; + let vaultChangeModal = new MergeColumnModal( + [ + ...(_a2 = filteredCols == null ? void 0 : filteredCols.map((f4) => ({ ...f4, table: "" }))) != null ? _a2 : [], + ...tagContexts.reduce( + (p3, c4) => { + var _a3, _b2; + return [ + ...p3, + ...(_b2 = (_a3 = contextTable[c4]) == null ? void 0 : _a3.cols.filter( + (f4) => f4.name != FilePropertyName && f4.hidden != "true" && f4.type != "fileprop" + ).map((f4) => ({ ...f4, table: c4 }))) != null ? _b2 : [] + ]; + }, + [] + ) + ], + mergeColumn + ); + vaultChangeModal.open(); + }; + const showSaveViewModal = () => { + let vaultChangeModal = new SaveViewModal(schema, saveSchema, "new view"); + vaultChangeModal.open(); + }; + const editViewModal = () => { + let vaultChangeModal = new SaveViewModal(schema, saveSchema, "rename view"); + vaultChangeModal.open(); + }; + const selectFilterValue = (e4, filter) => { + var _a2, _b2, _c2; + switch (filterFnTypes[filter.fn].valueType) { + case "text": + case "number": + { + const menu = new import_obsidian22.Menu(); + menu.setUseNativeMenu(false); + const saveFilterValue = (value) => { + const newFilter = { + ...filter, + value + }; + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s5) => s5.field != newFilter.field), + newFilter + ] + }); + }; + menu.addItem((menuItem) => { + inputMenuItem( + menuItem, + filter.value, + (value) => saveFilterValue(value) + ); + menuItem.setIcon("type"); + }); + const offset = e4.target.getBoundingClientRect(); + menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + } + break; + case "date": { + const saveValue = (date2) => { + const newFilter = { + ...filter, + value: date2.valueOf().toString() + }; + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s5) => s5.field != newFilter.field), + newFilter + ] + }); + }; + const offset = e4.target.getBoundingClientRect(); + const date = new Date(filter.value); + showDatePickerMenu( + { x: offset.left, y: offset.top + 30 }, + date.getTime() ? date : null, + saveValue + ); + break; + } + case "list": + { + const col = cols.find((f4) => f4.name + f4.table == filter.field); + const saveOptions = (options, values) => { + const newFilter = { + ...filter, + value: serializeMultiString(values) + }; + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s5) => s5.field != newFilter.field), + newFilter + ] + }); + }; + if (col.type.startsWith("option")) { + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: true, + editable: false, + value: parseMultiString(filter.value), + options: parseMultiString(col.value).map((f4) => ({ + name: f4, + value: f4 + })), + saveOptions, + placeholder: i18n_default.labels.optionItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + } else if (col.type.startsWith("context")) { + const contextData = (_b2 = (_a2 = contextTable[col.table]) == null ? void 0 : _a2.rows) != null ? _b2 : []; + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: true, + editable: false, + value: parseMultiString(filter.value), + options: (_c2 = contextData.map((f4) => ({ + name: filePathToString(f4[FilePropertyName]), + value: f4[FilePropertyName] + }))) != null ? _c2 : [], + saveOptions, + placeholder: i18n_default.labels.optionItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + } + } + break; + } + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-view-config" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-view-selector" + }, views.map((f4) => /* @__PURE__ */ Cn.createElement("div", { + className: `${(schema == null ? void 0 : schema.id) == f4.id ? "mk-is-active" : ""}`, + onContextMenu: (e4) => viewContextMenu(e4, f4) + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => openView(e4, f4) + }, f4.name))), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => showSaveViewModal() + }, "+")), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-view-options" + }, /* @__PURE__ */ Cn.createElement(SearchBar, { + setSearchString + }), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => showFilterMenu(e4), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-view-options"] + } + }), (dbSchema == null ? void 0 : dbSchema.primary) && /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => showColsMenu(e4), + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-build"] } + }), contextInfo.type == "folder" && (dbSchema == null ? void 0 : dbSchema.id) == "files" && /* @__PURE__ */ Cn.createElement("button", { + className: "mk-button-new", + onClick: (e4) => showAddMenu(e4), + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + }))), (predicate.filters.length > 0 || predicate.sort.length > 0 || predicate.groupBy.length > 0) && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter-bar" + }, predicate.groupBy.length > 0 && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, /* @__PURE__ */ Cn.createElement("span", null, "Group By"), /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => showGroupByMenu(e4) + }, predicate.groupBy[0]), /* @__PURE__ */ Cn.createElement("div", { + onClick: () => saveGroupBy(null, []), + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })), predicate.sort.map((f4) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, /* @__PURE__ */ Cn.createElement("span", null, f4.field), /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => changeSortMenu(e4, f4) + }, sortFnTypes[f4.fn].label), /* @__PURE__ */ Cn.createElement("div", { + onClick: () => removeSort(f4), + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + }))), predicate.filters.map((f4) => { + var _a2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, /* @__PURE__ */ Cn.createElement("span", null, f4.field), /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => changeFilterMenu(e4, f4) + }, filterFnLabels[f4.fn]), /* @__PURE__ */ Cn.createElement(FilterValueSpan, { + fieldType: (_a2 = cols.find((c4) => c4.name + c4.table == f4.field)) == null ? void 0 : _a2.type, + filter: f4, + selectFilterValue + }), /* @__PURE__ */ Cn.createElement("div", { + onClick: () => removeFilter(f4), + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })); + }), /* @__PURE__ */ Cn.createElement("span", null))); +}; +var FilterValueSpan = (props2) => { + const { filter, selectFilterValue, fieldType } = props2; + const fnType = filterFnTypes[filter.fn]; + if (!fieldType || !fnType || fnType.valueType == "none") { + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); + } else if (filter.value.length == 0) { + return /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectFilterValue(e4, filter) + }, "Select"); + } else if (fieldType.startsWith("option") || fieldType.startsWith("context")) { + const options = parseMultiString(filter.value); + return /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectFilterValue(e4, filter) + }, " ", options.map((f4) => /* @__PURE__ */ Cn.createElement("span", null, f4))); + } + return /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectFilterValue(e4, filter) + }, filter.value); +}; + +// src/components/Spaces/SpaceEditor.tsx +var SpaceEditor = k3( + (props2, ref) => { + var _a2, _b2; + const [def, setDef] = h2( + (_a2 = props2.def) != null ? _a2 : { + type: "smart", + folder: "", + filters: [{ type: "any", trueFalse: true, filters: [] }] + } + ); + const selectFilterValue = (e4, filter, i4, k5) => { + var _a3; + const saveFilterValue = (value) => { + setDefFilterValue(value, i4, k5); + }; + switch ((_a3 = filterFnTypes[filter.fn]) == null ? void 0 : _a3.valueType) { + case "text": + case "number": + { + const menu = new import_obsidian23.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { + inputMenuItem( + menuItem, + filter.value, + (value) => saveFilterValue(value) + ); + menuItem.setIcon("type"); + }); + const offset = e4.target.getBoundingClientRect(); + menu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + } + break; + case "date": { + const saveValue = (date2) => { + saveFilterValue(date2.valueOf().toString()); + }; + const offset = e4.target.getBoundingClientRect(); + const date = new Date(filter.value); + showDatePickerMenu( + { x: offset.left, y: offset.top + 30 }, + date.getTime() ? date : null, + saveValue + ); + break; + } + case "list": { - name: file.name, - pinned: "home", - def: { type: "focus", folder: file.path, filters: [] } - }, - 0 - ); + const fieldType = filter.fType; + const saveOptions = (options2, values) => { + saveFilterValue(serializeMultiString(values)); + }; + let options = []; + if (fieldType.startsWith("option")) { + options = parseMultiString(filter.value).map((f4) => ({ + name: f4, + value: f4 + })); + } else if (fieldType.startsWith("tags")) { + options = loadTags(props2.plugin).map((f4) => ({ + value: f4, + name: f4 + })); + } else if (fieldType.startsWith("links")) { + options = getAllAbstractFilesInVault(props2.plugin, app).map( + (f4) => ({ + name: fileNameToString(f4.name), + value: f4.path, + description: f4.path + }) + ); + } + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: true, + editable: true, + value: parseMultiString(filter.value), + options, + saveOptions, + placeholder: i18n_default.labels.optionItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + } + break; + } + }; + const addDefGroup = () => { + setDef({ + ...def, + filters: [ + ...def.filters, + { + type: "any", + trueFalse: true, + filters: [] + } + ] }); - }); - } - if (isFolder && cache) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.customSort); - menuItem.setIcon("arrow-up-down"); - menuItem.setChecked(cache.folderSort == ""); - menuItem.onClick((ev) => { - saveFolderSort(plugin, file.path, ""); + }; + const removeDefGroup = (groupIndex) => { + setDef({ + ...def, + filters: def.filters.filter((f4, i4) => i4 == groupIndex ? false : true) }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortBy); - menuItem.setIcon("sort-desc"); - menuItem.onClick((ev) => { - const sortMenu = new import_obsidian26.Menu(); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); - menuItem2.setChecked(cache.folderSort == "path_asc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "path_asc"); - }); - }); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); - menuItem2.setChecked(cache.folderSort == "path_desc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "path_desc"); - }); - }); - sortMenu.addSeparator(); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); - menuItem2.setChecked(cache.folderSort == "ctime_asc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "ctime_asc"); - }); - }); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); - menuItem2.setChecked(cache.folderSort == "ctime_desc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "ctime_desc"); - }); - }); - sortMenu.addSeparator(); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.modifiedTimeSortAsc); - menuItem2.setChecked(cache.folderSort == "mtime_asc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "mtime_asc"); - }); + }; + const typeForField = (type, field) => { + if (type == "frontmatter") { + return "text"; + } + if (type == "filemeta") { + return fileMeta[field].vType; + } + if (type == "fileprop") { + return fileProps[field].vType; + } + return "text"; + }; + const setDefFilter = (filter, groupIndex, filterIndex) => { + var _a3; + let type; + let field; + let fType; + const filterTuple = filter.split("."); + type = filterTuple[0]; + if (type == "frontmatter") { + fType = filterTuple[1]; + field = filterTuple[2]; + } else { + field = filterTuple[1]; + fType = typeForField(type, field); + } + if (def.filters.length == 0) { + setDef({ + ...def, + filters: [ + { + type: "any", + trueFalse: true, + filters: [ + { + type, + field, + fType, + fn: "", + value: "" + } + ] + } + ] }); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.modifiedTimeSortDesc); - menuItem2.setChecked(cache.folderSort == "mtime_desc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "mtime_desc"); - }); + return; + } + if (((_a3 = def.filters[groupIndex]) == null ? void 0 : _a3.filters.length) == 0) { + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + filters: [ + { + type, + field, + fType, + fn: "", + value: "" + } + ] + } : f4 + ) }); - const offset = e4.target.getBoundingClientRect(); - if (isMouseEvent(e4)) { - sortMenu.showAtPosition({ x: offset.left, y: offset.top + 30 }); - } else { - sortMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } + return; + } + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + filters: f4.filters.map( + (g4, k5) => k5 == filterIndex ? { + ...g4, + type, + fType, + field + } : g4 + ) + } : f4 + ) }); - }); - } - if (plugin.settings.spacesStickers) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("palette"); - disclosureMenuItem( - menuItem, - false, - false, - i18n_default.menu.changeColor, - "", - [ - { name: "None", value: "" }, - ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) - ], - (_9, values) => { - saveFileColor(plugin, file.path, values[0]); - } - ); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - const vaultChangeModal = new stickerModal( - plugin.app, - plugin, - (emoji) => saveFileIcon(plugin, file, emoji) - ); - vaultChangeModal.open(); + }; + const setDefFilterFn = (fn2, groupIndex, filterIndex) => { + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + filters: f4.filters.map( + (g4, k5) => k5 == filterIndex ? { + ...g4, + fn: fn2 + } : g4 + ) + } : f4 + ) }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeFileIcon(plugin, file); + }; + const setDefFilterValue = (value, groupIndex, filterIndex) => { + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + filters: f4.filters.map( + (g4, k5) => k5 == filterIndex ? { + ...g4, + value + } : g4 + ) + } : f4 + ) }); - }); - } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.rename); - menuItem.setIcon("pencil"); - menuItem.onClick((ev) => { - let vaultChangeModal = new VaultChangeModal(plugin, file, "rename"); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.delete); - menuItem.setIcon("trash"); - menuItem.onClick((ev) => { - let deleteOption = plugin.settings.deleteFileOption; - if (deleteOption === "permanent") { - plugin.app.vault.delete(file, true); - } else if (deleteOption === "system-trash") { - plugin.app.vault.trash(file, true); - } else if (deleteOption === "trash") { - plugin.app.vault.trash(file, false); + }; + const addDefFilter = (groupIndex) => { + if (groupIndex == 0 && def.filters.length == 0) { + setDef({ + ...def, + filters: [ + { + type: "any", + trueFalse: true, + filters: [ + { + type: "", + fType: "", + field: "", + value: "", + fn: "" + } + ] + } + ] + }); + } else { + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + filters: [ + ...f4.filters, + { + type: "", + fType: "", + field: "", + value: "", + fn: "" + } + ] + } : f4 + ) + }); } - }); - }); - if (!isFolder) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.changeToFolderNote); - menuItem.setIcon("file-plus-2"); - menuItem.onClick((ev) => { - if (file instanceof import_obsidian26.TFile) - noteToFolderNote(plugin, file, true); - }); - }); - } - fileMenu.addItem((menuItem) => { - menuItem.setIcon("go-to-file"); - menuItem.setTitle(i18n_default.menu.openFilePane); - menuItem.onClick((ev) => { - openFileInNewPane(plugin, { ...file, isFolder }); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.duplicate); - menuItem.setIcon("documents"); - menuItem.onClick((ev) => { - if (file.basename && file.extension) - plugin.app.vault.copy( - file, - `${file.parent.path}/${file.basename} 1.${file.extension}` - ); - }); - }); - if (!internalPluginLoaded("file-explorer", plugin.app)) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.moveFile); - menuItem.setIcon("paper-plane"); - menuItem.onClick((ev) => { - let fileMoveSuggester = new MoveSuggestionModal(plugin.app, [ - file.path - ]); - fileMoveSuggester.open(); - }); - }); - } - plugin.app.workspace.trigger("file-menu", fileMenu, file, source); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - return false; -}; - -// src/components/ContextView/DataTypeView/FileCell.tsx -var import_obsidian27 = require("obsidian"); -var FileCell = (props2) => { - const fileOrCleanPath = (f4) => { - if (!f4) - return { - path: "" - }; - const fileCache = props2.plugin.index.filesIndex.get(f4); - return fileCache ? { path: f4, fileCache } : { path: f4 }; - }; - const value = F2( - () => { - var _a2; - return (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).map((f4) => fileOrCleanPath(f4)); - }, - [props2.initialValue] - ); - const ref = _2(null); - const onKeyDown = (e4) => { - e4.stopPropagation(); - e4.key == "Enter" && e4.target.blur(); - }; - const fileExists = (name) => { - if (!name) - return false; - return getAbstractFileAtPath(app, name) ? true : false; - }; - const onBlur = () => { - var _a2; - if (!ref.current) - return; - if (fileExists((_a2 = ref.current) == null ? void 0 : _a2.value)) { - new import_obsidian27.Notice(i18n_default.notice.fileExists); - } else { - props2.saveValue(ref.current.value); - props2.setEditMode(null); - } - }; - const newFile = async (file) => { - const filePath = file.path.replace(/\//g, "").replace(/\./g, ""); - const path = `${props2.folder}/${filePath}.md`; - if (filePath.length == 0) { - return; - } - if (fileExists(path)) { - new import_obsidian27.Notice(i18n_default.notice.fileExists); - } else { - await createNewMarkdownFile( - props2.plugin, - getAbstractFileAtPath(app, props2.folder), - filePath - ); - } - }; - const deleteRow = () => { - props2.deleteRow(); - }; - p2(() => { - var _a2; - if (props2.editMode == 2) { - (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.focus(); - } - }, [props2.editMode]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file" - }, value.map((v3, i4) => { - var _a2; - if (props2.editMode == 0) { - if (v3.fileCache) { - return /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-cell-file-title" - }, v3 && v3.fileCache ? v3.fileCache.name : "", ((_a2 = v3.fileCache.extension) == null ? void 0 : _a2.length) > 0 && v3.fileCache.extension != "md" && /* @__PURE__ */ Cn.createElement("span", { - className: "nav-file-tag" - }, v3.fileCache.extension), /* @__PURE__ */ Cn.createElement("button", { - "aria-label": i18n_default.buttons.toggleFlow, - className: "mk-cell-file-flow mk-inline-button", - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-flow-hover"] - }, - onClick: (e4) => { - if (props2.openFlow) { - props2.openFlow(e4); - e4.stopPropagation(); + }; + const removeDefFilter = (filterIndex, groupIndex) => { + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + filters: f4.filters.filter( + (g4, k5) => k5 == filterIndex ? false : true + ) + } : f4 + ) + }); + }; + const setGroupType = (groupIndex, type) => { + if (groupIndex == 0 && def.filters.length == 0) { + setDef({ + ...def, + filters: [ + { + type, + trueFalse: true, + filters: [] } - } - })); + ] + }); } else { - return /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-cell-file-title" - }, v3.path); + setDef({ + ...def, + filters: def.filters.map( + (f4, i4) => i4 == groupIndex ? { + ...f4, + type + } : f4 + ) + }); } - } - if (v3.fileCache) { - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-item", - onContextMenu: (e4) => triggerFileMenu( - props2.plugin, - getAbstractFileAtPath(app, v3.fileCache.path), - v3.fileCache.isFolder, - e4 - ) - }, /* @__PURE__ */ Cn.createElement(FileSticker, { - plugin: props2.plugin, - fileCache: v3.fileCache - }), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-name", - onClick: (e4) => openAFile( - getAbstractFileAtPath(app, v3.fileCache.path), - props2.plugin, - e4.ctrlKey || e4.metaKey - ) - }, v3 && v3.fileCache ? filePathToString(v3.fileCache.name) : ""))); - } - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-item" + }; + const selectGroupType = (e4, i4) => { + const offset = e4.target.getBoundingClientRect(); + const filters = ["any", "all"]; + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: filters.map((f4) => ({ name: f4, value: f4 })), + saveOptions: (_9, value) => setGroupType(i4, value[0]), + searchable: false, + showAll: true + } + ); + }; + const selectFilter = (e4, i4, k5) => { + const offset = e4.target.getBoundingClientRect(); + const { type, field, fType } = def.filters[i4].filters[k5]; + const filters = predicateFnsForType(fType, filterFnTypes); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: true, + value: [], + options: filters.map((f4) => ({ name: filterFnLabels[f4], value: f4 })), + saveOptions: (_9, value) => setDefFilterFn(value[0], i4, k5), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + }; + const selectField = (e4, i4, k5) => { + const offset = e4.target.getBoundingClientRect(); + const allFiles = retrieveAllFiles( + props2.plugin.index.vaultDBCache, + props2.plugin.settings + ); + const frontmatter = allMetadataForFiles( + props2.plugin, + allFiles.map((f5) => getAbstractFileAtPath(app, f5.path)).filter((f5) => f5 instanceof import_obsidian23.TFile) + ); + const fmTypes = guestimateTypes( + allFiles.map((f5) => f5.path), + props2.plugin, + false + ); + const f4 = [ + ...Object.keys(fileMeta).map((f5) => ({ + name: fileMeta[f5].label, + value: "filemeta." + f5 + })), + ...Object.keys(fileProps).map((f5) => ({ + name: fileProps[f5].label, + value: "fileprop." + f5 + })), + ...frontmatter.map((f5) => ({ + name: f5.name, + value: "frontmatter." + fmTypes[f5.name] + "." + f5.name + })) + ]; + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: f4, + saveOptions: (_9, value) => setDefFilter(value[0], i4, k5), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + }; + p2(() => { + ref.current = def; + }, [def]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-space-settings" + }, def.type == "smart" ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query" + }, def.filters.length == 0 ? /* @__PURE__ */ Cn.createElement(DefFilterGroup, { + selectGroupType, + group: null, + addDefGroup, + addDefFilter, + selectField, + i: 0, + removeDefGroup + }) : def.filters.map((f4, i4) => /* @__PURE__ */ Cn.createElement(DefFilterGroup, { + key: i4, + group: f4, + selectGroupType, + addDefGroup, + addDefFilter, + selectField, + i: i4, + removeDefGroup + }, f4.filters.map((filter, k5) => /* @__PURE__ */ Cn.createElement(DefFilter, { + key: k5, + filter, + i: i4, + k: k5, + selectField, + selectFilter, + selectFilterValue, + addDefFilter, + removeDefFilter + }))))) : /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item mod-toggle" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-icon" + className: "setting-item-info" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-name" + }, "Sync to Folder"), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-description" + }, "Select a folder to sync this space with all notes from a folder", /* @__PURE__ */ Cn.createElement("br", null), "Note: Existing items in the space will be removed from the space.")), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-control" }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => newFile(v3), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-new-file"] - } - })), props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { - className: "mk-cell-file-name", - type: "text", - placeholder: "Untitled", - ref, - value: v3.path, - onKeyDown, - onBlur - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-name" - }, v3.path))); - })); -}; - -// src/components/ContextView/DataTypeView/FilePropertyCell.tsx -var humanFileSize = (bytes, si = false, dp = 1) => { - const thresh = si ? 1e3 : 1024; - if (Math.abs(bytes) < thresh) { - return bytes + " B"; - } - const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; - let u4 = -1; - const r3 = 10 ** dp; - do { - bytes /= thresh; - ++u4; - } while (Math.round(Math.abs(bytes) * r3) / r3 >= thresh && u4 < units.length - 1); - return bytes.toFixed(dp) + " " + units[u4]; -}; -var LookUpCell = (props2) => { - const [cache, setCache] = h2(null); - const initialValue = props2.initialValue; - const { field, property } = parsePropString(props2.propertyValue); - if (property == "folder") { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop", - onClick: () => { - openTFolder( - getAbstractFileAtPath(app, initialValue), - props2.plugin, - false + onClick: (e4) => { + const offset = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: false, + value: [], + options: [ + { name: "None", value: "" }, + ...getAllFoldersInVault(app).map((f4) => ({ + name: getFolderName(f4.path, app), + description: f4.path, + value: f4.path + })) + ], + saveOptions: (_9, values) => { + setDef((prev) => ({ ...prev, folder: values[0] })); + }, + searchable: true + } ); } - }, folderPathToString(initialValue)); - } - if (property == "extension") { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, initialValue); - } else if (property == "ctime" || property == "mtime") { - const date = new Date(parseInt(initialValue)).getTime() ? new Date(parseInt(initialValue)) : null; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, date && formatDistance3(new Date(date), new Date(), { addSuffix: true })); - } else if (property == "size" || property == "File.size") { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, humanFileSize(parseInt(initialValue))); + }, ((_b2 = def.folder) == null ? void 0 : _b2.length) > 0 ? getFolderName(def.folder, app) : "None")))); } +); +SpaceEditor.displayName = "SpaceEditor"; +var SpaceEditor_default = SpaceEditor; +var DefFilter = (props2) => { + var _a2; + const { + filter, + selectField, + selectFilter, + selectFilterValue, + addDefFilter, + removeDefFilter, + i: i4, + k: k5 + } = props2; return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, initialValue); + className: "mk-query-filter" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectField(e4, i4, k5) + }, filter.field.length == 0 ? "Select" : filter.field), filter.field.length > 0 && /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectFilter(e4, i4, k5) + }, !filterFnLabels[filter.fn] ? "Select" : filterFnLabels[filter.fn]), filter.field.length > 0 && filterFnLabels[filter.fn] && ((_a2 = filterFnTypes[filter.fn]) == null ? void 0 : _a2.valueType) != "none" && /* @__PURE__ */ Cn.createElement("span", null, /* @__PURE__ */ Cn.createElement(FilterValueSpan, { + fieldType: filter.fType, + filter, + selectFilterValue: (e4, h5) => selectFilterValue(e4, h5, i4, k5) + }))), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { + "aria-label": i18n_default.buttons.addTag, + onClick: (e4) => addDefFilter(i4) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + })), /* @__PURE__ */ Cn.createElement("button", { + onClick: () => removeDefFilter(k5, i4) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + }))); }; - -// src/components/ContextView/DataTypeView/NumberCell.tsx -var NumberCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue); - const ref = _2(null); - const onBlur = () => { - if (initialValue != value) - saveValue(value); - }; - const onKeyDown = (e4) => { - e4.stopPropagation(); - if (e4.key == "Enter") { - e4.target.blur(); - props2.setEditMode(null); - } - if (e4.key == "Escape") { - setValue(initialValue); - e4.target.blur(); - props2.setEditMode(null); - } - }; - Cn.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - p2(() => { - var _a2; - if (props2.editMode == 2) { - (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.focus(); - } - }, [props2.editMode]); - return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { - className: "mk-cell-text", - type: "number", - step: "any", - ref, - value, - onChange: (e4) => setValue(e4.target.value), - onKeyDown, - onBlur - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-number" - }, value); +var DefFilterGroup = (props2) => { + var _a2; + const { + group, + selectGroupType, + addDefGroup, + addDefFilter, + selectField, + i: i4, + removeDefGroup + } = props2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query-group" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query-group-type" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, "Match", " ", /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectGroupType(e4, i4) + }, (_a2 = group == null ? void 0 : group.type) != null ? _a2 : "any"), " ", "of the following"), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { + "aria-label": i18n_default.buttons.addTag, + onClick: (e4) => addDefGroup() + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + })), i4 > 0 ? /* @__PURE__ */ Cn.createElement("button", { + onClick: () => removeDefGroup(i4) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter-bar mk-query-filters" + }, !group || group.filters.length == 0 ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query-filter" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectField(e4, i4, 0) + }, "Select")), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { + "aria-label": i18n_default.buttons.addTag, + onClick: (e4) => addDefFilter(i4) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + }))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.children))); }; -// src/components/ContextView/DataTypeView/TextCell.tsx -var TextCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue); - const ref = _2(null); - const onBlur = () => { - if (initialValue != value) - saveValue(value); - }; - const onKeyDown = (e4) => { - e4.stopPropagation(); - if (e4.key == "Enter") { - e4.target.blur(); - props2.setEditMode(null); +// src/components/ui/modals/editSpaceModal.tsx +var import_obsidian24 = require("obsidian"); +var EditSpaceModal = class extends import_obsidian24.Modal { + constructor(plugin, space, action) { + super(plugin.app); + this.space = space; + this.action = action; + this.plugin = plugin; + } + onOpen() { + const { contentEl } = this; + let headerText; + if (this.action === "rename") { + if (this.space.def.type == "smart") { + headerText = i18n_default.labels.renameSectionSmart; + } else { + headerText = i18n_default.labels.renameSection; + } + headerText = i18n_default.labels.renameSection; + } else if (this.action === "create") { + if (this.space.def.type == "smart") { + headerText = i18n_default.labels.createSectionSmart; + } else { + headerText = i18n_default.labels.createSection; + } } - if (e4.key == "Escape") { - setValue(initialValue); - e4.target.blur(); - props2.setEditMode(null); + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const inputEl = contentEl.createEl("input"); + inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; + if (this.action === "rename") { + inputEl.value = this.space.name; } - }; - Cn.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - p2(() => { - var _a2; - if (props2.editMode == 2) { - (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.focus(); + inputEl.focus(); + const queryEl = contentEl.createDiv("mk-space-query"); + const root = createRoot(queryEl); + this.ref = Cn.createRef(); + root.render( + /* @__PURE__ */ Cn.createElement(SpaceEditor_default, { + plugin: this.plugin, + def: this.space.def, + ref: this.ref + }) + ); + let changeButtonText; + if (this.action === "rename") { + changeButtonText = i18n_default.buttons.saveSpace; + } else if (this.action === "create") { + changeButtonText = i18n_default.buttons.saveSpace; } - }, [props2.editMode]); - return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - ref, - type: "text", - value, - onChange: (e4) => setValue(e4.target.value), - onKeyDown, - onBlur - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-text" - }, value); + const changeButton = contentEl.createEl("button", { + text: changeButtonText + }); + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel + }); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + this.close(); + }); + const onClickAction = async () => { + const newName = inputEl.value.replace(/\//g, ""); + if (newName.length == 0) { + new import_obsidian24.Notice(i18n_default.notice.newSpaceName); + return; + } + if (this.plugin.index.spacesIndex.has(newName) && newName != this.space.name) { + new import_obsidian24.Notice(i18n_default.notice.duplicateSpaceName); + return; + } + if (this.action === "rename") { + saveSpace(this.plugin, this.space.name, { + ...this.space, + def: this.ref.current, + name: newName + }); + } else if (this.action === "create") { + insertSpaceAtIndex( + this.plugin, + { name: newName, pinned: "home", def: this.ref.current }, + 0 + ); + } + this.close(); + }; + changeButton.addEventListener("click", onClickAction); + inputEl.addEventListener("keydown", (e4) => { + if (e4.key === "Enter") + onClickAction(); + }); + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } }; -// src/components/ContextView/TableView/TableView.tsx -var import_lodash6 = __toESM(require_lodash()); -var import_obsidian28 = require("obsidian"); +// src/components/ui/menus/fileMenu.tsx +var import_obsidian25 = require("obsidian"); -// src/components/ContextView/DataTypeView/ImageCell.tsx -var ImageCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue); - const menuRef = _2(null); - p2(() => { - if (props2.editMode == 2 /* EditModeActive */) { - if (!menuRef.current) - showModal(); - } - }, []); - const file = F2(() => { - const f4 = getAbstractFileAtPath(app, value); - return f4 ? app.vault.getResourcePath(f4) : value; - }, [value]); - Cn.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - const showModal = () => { - let vaultChangeModal = new imageModal( - props2.plugin, - props2.plugin.app, - (image) => saveValue(image) - ); - vaultChangeModal.open(); - props2.setEditMode(null); - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-image" - }, /* @__PURE__ */ Cn.createElement("img", { - src: file - }), props2.editMode > 0 ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-image-selector" - }, /* @__PURE__ */ Cn.createElement("div", { - onClick: showModal, - className: "mk-hover-button mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-edit"] } - }), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ Cn.createElement("div", { - onClick: () => saveValue(""), - className: "mk-hover-button mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); -}; +// src/utils/color.ts +var colors = [ + ["Red", "#eb3b5a"], + ["Orange", "#fa8231"], + ["Yellow", "#f7b731"], + ["Green", "#20bf6b"], + ["Turquoise", "#0fb9b1"], + ["Teal", "#2d98da"], + ["Blue", "#3867d6"], + ["Purple", "#8854d0"], + ["Charcoal", "#4b6584"] +]; -// src/components/ContextView/DataTypeView/LinkCell.tsx -var LinkCell = (props2) => { - var _a2; - const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); - const stringValueToLink = (strings) => strings.map((f4) => { - return { - label: parseLinkDisplayString(f4), - value: parseLinkString(f4) - }; +// src/components/ui/menus/fileMenu.tsx +var triggerSectionAddMenu = (plugin, e4) => { + const fileMenu = new import_obsidian25.Menu(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus"); + menuItem.setTitle(i18n_default.buttons.createSection); + menuItem.onClick((ev) => { + let vaultChangeModal = new EditSpaceModal( + plugin, + { + name: "", + def: { + type: "focus", + folder: "", + filters: [] + } + }, + "create" + ); + vaultChangeModal.open(); + }); }); - p2(() => { - var _a3; - setValue( - resolveLinks( - stringValueToLink( - props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue] - ) - ) - ); - }, [props2.initialValue]); - const resolveLinks = (links) => links.map((f4) => ({ - value: f4.value, - label: filePathToString(f4.value), - file: getFileFromString(f4.value, getFolderPathFromString(props2.file)) - })); - const ref = _2(null); - const [value, setValue] = h2( - resolveLinks(stringValueToLink(initialValue)) - ); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4.value != v3.value); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues.map((f4) => f4.value))); - }; - const saveOptions = (_9, _value) => { - if (!props2.multi) { - setValue(resolveLinks(stringValueToLink(_value))); - props2.saveValue(serializeMultiString(_value)); - } else { - const newValue = _value[0]; - if (newValue) { - const newValues = uniq([...value.map((f4) => f4.value), newValue]); - setValue(resolveLinks(stringValueToLink(newValues))); - props2.saveValue(serializeMultiString(newValues)); - } - } - }; - const menuProps = () => { - const options = getAllAbstractFilesInVault(props2.plugin, app).map((f4) => ({ - name: fileNameToString(f4.name), - value: f4.path, - description: f4.path - })); - const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; - return { - multi: false, - editable: true, - value: value.map((f4) => f4.value), - options: _options, - saveOptions, - placeholder: i18n_default.labels.linkItemSelectPlaceholder, - detail: true, - searchable: true - }; - }; - const openLink = async (o3) => { - if (o3.file) { - openTFile(o3.file, props2.plugin, false); - } else { - const file = await app.fileManager.createNewMarkdownFile( - app.vault.getRoot(), - o3.value + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus"); + menuItem.setTitle(i18n_default.buttons.createSectionSmart); + menuItem.onClick((ev) => { + let vaultChangeModal = new EditSpaceModal( + plugin, + { + name: "", + def: { + type: "smart", + folder: "", + filters: [] + } + }, + "create" ); - openTFile(file, props2.plugin, false); - setValue(resolveLinks(value)); - } - }; - return /* @__PURE__ */ Cn.createElement(OptionCellBase, { - baseClass: "mk-cell-link", - menuProps, - getLabelString: (o3) => o3.label, - valueClass: (o3) => o3.file ? "mk-cell-link-item" : "mk-cell-link-unresolved", - openItem: openLink, - value, - multi: props2.multi, - editMode: props2.editMode, - removeValue + vaultChangeModal.open(); + }); }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; }; - -// src/components/ContextView/DataTypeView/TagCell.tsx -var TagCell = (props2) => { - var _a2; - const initialValue = ((_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : []).filter( - (f4) => (f4 == null ? void 0 : f4.length) > 0 - ); - const [value, setValue] = h2(initialValue); - p2(() => { - var _a3; - setValue((_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : []); - }, [props2.initialValue]); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4 != v3); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues)); - }; - const saveOptions = (_options, _value) => { - if (!props2.multi) { - setValue(_value); - props2.saveValue(serializeMultiString(_value)); - } else { - const newValue = _value[0]; - if (newValue) { - const newValues = uniq([...value, newValue]); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues)); - } - } - }; - const menuProps = () => { - const options = loadTags(props2.plugin).map((f4) => ({ - name: f4, - value: f4 - })); - const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; - return { - multi: false, - editable: true, - value, - options: _options, - saveOptions, - placeholder: i18n_default.labels.tagItemSelectPlaceholder, - searchable: true, - showAll: true, - onHide: () => props2.setEditMode(null) - }; - }; - return /* @__PURE__ */ Cn.createElement(OptionCellBase, { - baseClass: "mk-cell-tag", - menuProps, - value, - multi: props2.multi, - editMode: props2.editMode, - removeValue +var triggerSectionMenu = (plugin, space, spaces2, e4, activeFile2) => { + if (!space) + return; + const fileMenu = new import_obsidian25.Menu(); + const spaceName = space.name; + fileMenu.addItem((menuItem) => { + menuItem.setIcon("edit"); + menuItem.setTitle(i18n_default.buttons.createNote); + menuItem.onClick((ev) => { + newFileInSpace(plugin, space, activeFile2); + }); }); -}; - -// src/components/ContextView/TableView/TableView.tsx -var TableView = (props2) => { - const { - selectedRows, - selectRows, - tableData, - sortedColumns: cols, - filteredData: data, - contextInfo, - readMode, - dbSchema, - contextTable, - predicate, - savePredicate, - saveDB: saveDB2, - updateFieldValue, - updateValue: updateValue2 - } = q2(MDBContext); - const [activeId, setActiveId] = h2(null); - const [lastSelectedIndex, setLastSelectedIndex] = h2(null); - const [selectedColumn, setSelectedColumn] = h2(null); - const [currentEdit, setCurrentEdit] = h2(null); - const [overId, setOverId] = h2(null); - const [openFlows, setOpenFlows] = h2([]); - const [colsSize, setColsSize] = h2({}); - const ref = _2(null); - p2(() => { - setColsSize({ ...predicate.colsSize, "+": 30 }); - }, [predicate]); - p2(() => { - setCurrentEdit(null); - }, [selectedColumn, lastSelectedIndex]); - p2(() => { - if (currentEdit == null) { - ref.current.focus(); - } - }, [currentEdit]); - const saveColsSize = (colSize) => { - const newColSize = colSize(colsSize); - setColsSize(newColSize); - debouncedSavePredicate(newColSize); - }; - const debouncedSavePredicate = T2( - (0, import_lodash6.debounce)( - (nextValue) => savePredicate({ - ...predicate, - colsSize: nextValue - }), - 1e3 - ), - [predicate] - ); - const newRow = (index, data2) => { - saveDB2(createNewRow(tableData, { File: "", ...data2 != null ? data2 : {} }, index)); - }; - const deleteRow = (rowIndex) => { - const row = tableData.rows.find((f4, i4) => i4 == rowIndex); - if (getAbstractFileAtPath(app, row.File)) { - deleteFile(props2.plugin, getAbstractFileAtPath(app, row.File)); - } - if (row) { - saveDB2({ - ...tableData, - rows: tableData.rows.filter((f4, i4) => i4 != rowIndex) + fileMenu.addItem((menuItem) => { + menuItem.setIcon("layout-dashboard"); + menuItem.setTitle(i18n_default.buttons.createCanvas); + menuItem.onClick((ev) => { + newFileInSpace(plugin, space, activeFile2, true); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("folder-plus"); + menuItem.setTitle(i18n_default.buttons.createFolder); + menuItem.onClick((ev) => { + newFolderInSpace(plugin, space, activeFile2); + }); + }); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + const pinned = (space == null ? void 0 : space.pinned) == "false" || (space == null ? void 0 : space.pinned) == "home"; + menuItem.setTitle(i18n_default.menu.homeSpace); + menuItem.setIcon("home"); + menuItem.setChecked(pinned); + menuItem.onClick((ev) => { + toggleSpacePin(plugin, spaceName, "home"); + }); + }); + fileMenu.addItem((menuItem) => { + const pinned = (space == null ? void 0 : space.pinned) == "true" || (space == null ? void 0 : space.pinned) == "pinned"; + menuItem.setTitle(i18n_default.menu.pinSpace); + menuItem.setIcon("pin"); + menuItem.setChecked(pinned); + menuItem.onClick((ev) => { + toggleSpacePin(plugin, spaceName, "pinned"); + }); + }); + fileMenu.addItem((menuItem) => { + const space2 = spaces2.find((f4) => f4.name == spaceName); + const pinned = (space2 == null ? void 0 : space2.pinned) == "none"; + menuItem.setTitle(i18n_default.menu.unpinSpace); + menuItem.setIcon("pin-off"); + menuItem.onClick((ev) => { + toggleSpacePin(plugin, spaceName, "none"); + }); + }); + if (plugin.settings.spacesStickers) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + const vaultChangeModal = new stickerModal( + plugin.app, + plugin, + (emoji) => saveSpaceIcon(plugin, spaceName, emoji) + ); + vaultChangeModal.open(); }); - } - }; - const toggleFlow = (path) => { - setOpenFlows( - (f4) => f4.find((p3) => p3 == path) ? f4.filter((p3) => p3 != path) : uniq([...f4, path]) - ); - }; - const selectItem = (modifier, index) => { - if (modifier == 3) { - const file = getAbstractFileAtPath( - app, - tableData.rows[parseInt(index)].File - ); - if (file) - openAFile(file, props2.plugin, false); - return; - } - if (modifier == 2) { - selectedRows.some((f4) => f4 == index) ? selectRows( - null, - selectedRows.filter((f4) => f4 != index) - ) : selectRows(index, uniq([...selectedRows, index])); - } else if (modifier == 1) { - selectRows( - index, - uniq([ - ...selectedRows, - ...selectRange( - lastSelectedIndex, - index, - data.map((f4) => f4._index) - ) - ]) - ); - } else { - selectRows(index, [index]); - } - setLastSelectedIndex(index); - }; - const onKeyDown = (e4) => { - const setCellValue = (value) => { - var _a2; - const columnTuple = selectedColumn.split("#"); - updateValue2( - columnTuple[0], - value, - (_a2 = columnTuple[1]) != null ? _a2 : "", - parseInt(lastSelectedIndex), - "" + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeSpaceIcon(plugin, spaceName); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.collapseAll); + menuItem.setIcon("lucide-chevrons-down-up"); + menuItem.onClick((ev) => { + plugin.settings.expandedFolders = { + ...plugin.settings.expandedFolders, + [spaceName]: [] + }; + plugin.saveSettings(); + }); + }); + fileMenu.addSeparator(); + if (space.def.type == "focus") { + fileMenu.addItem((menuItem) => { + const sortOption = ["rank", true]; + menuItem.setIcon("arrow-up-down"); + menuItem.setTitle(i18n_default.menu.customSort); + menuItem.setChecked( + space.sort == JSON.stringify(sortOption) || space.sort == "" ); - }; - const clearCell = () => { - setCellValue(""); - }; - const copyCell = () => { - navigator.clipboard.writeText( - tableData.rows[parseInt(lastSelectedIndex)][selectedColumn] + menuItem.onClick((ev) => { + updateSpaceSort(plugin, spaceName, sortOption); + }); + }); + } + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortBy); + menuItem.setIcon("sort-desc"); + menuItem.onClick((ev) => { + const sortMenu = new import_obsidian25.Menu(); + sortMenu.addItem((menuItem2) => { + const sortOption = ["path", true]; + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); + menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, spaceName, sortOption); + }); + }); + sortMenu.addItem((menuItem2) => { + const sortOption = ["path", false]; + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); + menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, spaceName, sortOption); + }); + }); + sortMenu.addSeparator(); + sortMenu.addItem((menuItem2) => { + const sortOption = ["ctime", false]; + menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); + menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, spaceName, sortOption); + }); + }); + sortMenu.addItem((menuItem2) => { + const sortOption = ["ctime", true]; + menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); + menuItem2.setChecked(space.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, spaceName, sortOption); + }); + }); + const offset = e4.target.getBoundingClientRect(); + if (isMouseEvent(e4)) { + sortMenu.showAtPosition({ x: offset.left, y: offset.top + 30 }); + } else { + sortMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }); + }); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.edit); + menuItem.setIcon("pencil"); + menuItem.onClick((ev) => { + let vaultChangeModal = new EditSpaceModal(plugin, space, "rename"); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteSpace); + menuItem.setIcon("trash"); + menuItem.onClick((ev) => { + removeSpace(plugin, space.name); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; +}; +var triggerMultiFileMenu = (plugin, selectedFiles2, e4) => { + const files = selectedFiles2.map((s5) => s5.item.path); + const spaces2 = plugin.index.allSpaces(); + const spaceItems = retrieveSpaceItems(plugin, spaces2); + const fileMenu = new import_obsidian25.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus"); + menuItem.setTitle("Add to Space"); + menuItem.onClick((ev) => { + let vaultChangeModal = new AddToSpaceModal( + plugin, + selectedFiles2.map((f4) => f4.path) ); - }; - const nextRow = () => { - const newIndex = selectNextIndex( - lastSelectedIndex, - data.map((f4) => f4._index) + vaultChangeModal.open(); + }); + }); + if (plugin.settings.spacesStickers) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("palette"); + disclosureMenuItem( + menuItem, + false, + false, + i18n_default.menu.changeColor, + "", + [ + { name: "None", value: "" }, + ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) + ], + (_9, values) => { + saveFileColors(plugin, files, values[0]); + } ); - selectRows(newIndex, [newIndex]); - setLastSelectedIndex(newIndex); - }; - const lastRow = () => { - const newIndex = selectPrevIndex( - lastSelectedIndex, - data.map((f4) => f4._index) + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + const vaultChangeModal = new stickerModal( + plugin.app, + plugin, + (emoji) => saveFileIcons(plugin, files, emoji) + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeFileIcons(plugin, files); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteFiles); + menuItem.setIcon("trash"); + menuItem.onClick((ev) => { + deleteFiles(plugin, files); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("go-to-file"); + menuItem.setTitle(i18n_default.menu.openFilePane); + menuItem.onClick((ev) => { + files.forEach( + (file) => openAFile(getAbstractFileAtPath(app, file), plugin, true) ); - selectRows(newIndex, [newIndex]); - setLastSelectedIndex(newIndex); - }; - if (e4.key == "c" && e4.metaKey) { - copyCell(); - } - if (e4.key == "x" && e4.metaKey) { - copyCell(); - clearCell(); - } - if (e4.key == "v" && e4.metaKey) { - navigator.clipboard.readText().then((f4) => setCellValue(f4)); - } - if (e4.key == "Escape") { - selectRows(null, []); - setLastSelectedIndex(null); - } - if (e4.key == "Backspace" || e4.key == "Delete") { - clearCell(); - } - if (e4.key == "Enter") { - if (selectedColumn && lastSelectedIndex) { - if (e4.shiftKey) { - newRow(parseInt(lastSelectedIndex) + 1); - nextRow(); + }); + }); + if (!internalPluginLoaded("file-explorer", plugin.app)) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.moveFile); + menuItem.setIcon("paper-plane"); + menuItem.onClick((ev) => { + let fileMoveSuggester = new MoveSuggestionModal(plugin.app, files); + fileMoveSuggester.open(); + }); + }); + } + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; +}; +var triggerFileMenu = (plugin, file, isFolder, e4, source = "file-explorer") => { + const spaces2 = plugin.index.allSpaces(); + const spaceItems = retrieveSpaceItems(plugin, spaces2); + const cache = plugin.index.filesIndex.get(file.path); + const fileMenu = new import_obsidian25.Menu(); + if (isFolder) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("edit"); + menuItem.setTitle(i18n_default.buttons.createNote); + menuItem.onClick((ev) => { + newFileInFolder(plugin, file); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("layout-dashboard"); + menuItem.setTitle(i18n_default.buttons.createCanvas); + menuItem.onClick((ev) => { + createNewCanvasFile(plugin, file, ""); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("folder-plus"); + menuItem.setTitle(i18n_default.buttons.createFolder); + menuItem.onClick((ev) => { + let vaultChangeModal = new VaultChangeModal( + plugin, + file, + "create folder", + "/" + ); + vaultChangeModal.open(); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus-square"); + menuItem.setTitle("Add to Space"); + menuItem.onClick((ev) => { + let vaultChangeModal = new AddToSpaceModal(plugin, [file.path]); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("minus-square"); + menuItem.setTitle("Remove from Space"); + menuItem.onClick((ev) => { + let vaultChangeModal = new RemoveFromSpaceModal(plugin, file.path); + vaultChangeModal.open(); + }); + }); + if (isFolder) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.createFolderSpace); + menuItem.setIcon("folder-plus"); + menuItem.onClick((ev) => { + insertSpaceAtIndex( + plugin, + { + name: file.name, + pinned: "home", + def: { type: "focus", folder: file.path, filters: [] } + }, + 0 + ); + }); + }); + } + if (isFolder && cache) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.customSort); + menuItem.setIcon("arrow-up-down"); + menuItem.setChecked(cache.folderSort == ""); + menuItem.onClick((ev) => { + saveFolderSort(plugin, file.path, ""); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortBy); + menuItem.setIcon("sort-desc"); + menuItem.onClick((ev) => { + const sortMenu = new import_obsidian25.Menu(); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); + menuItem2.setChecked(cache.folderSort == "path_asc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "path_asc"); + }); + }); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); + menuItem2.setChecked(cache.folderSort == "path_desc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "path_desc"); + }); + }); + sortMenu.addSeparator(); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); + menuItem2.setChecked(cache.folderSort == "ctime_asc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "ctime_asc"); + }); + }); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); + menuItem2.setChecked(cache.folderSort == "ctime_desc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "ctime_desc"); + }); + }); + sortMenu.addSeparator(); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.modifiedTimeSortAsc); + menuItem2.setChecked(cache.folderSort == "mtime_asc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "mtime_asc"); + }); + }); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.modifiedTimeSortDesc); + menuItem2.setChecked(cache.folderSort == "mtime_desc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "mtime_desc"); + }); + }); + const offset = e4.target.getBoundingClientRect(); + if (isMouseEvent(e4)) { + sortMenu.showAtPosition({ x: offset.left, y: offset.top + 30 }); } else { - setCurrentEdit([selectedColumn, lastSelectedIndex]); + sortMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }); + }); + } + if (plugin.settings.spacesStickers) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("palette"); + disclosureMenuItem( + menuItem, + false, + false, + i18n_default.menu.changeColor, + "", + [ + { name: "None", value: "" }, + ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) + ], + (_9, values) => { + saveFileColor(plugin, file.path, values[0]); } - } - return; - } - if (e4.key == "ArrowDown") { - nextRow(); - e4.preventDefault(); - } - if (e4.key == "ArrowUp") { - lastRow(); - e4.preventDefault(); - } - if (e4.key == "ArrowLeft") { - const newIndex = selectPrevIndex( - selectedColumn, - columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") - ); - setSelectedColumn(newIndex); - } - if (e4.key == "ArrowRight") { - const newIndex = selectNextIndex( - selectedColumn, - columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") ); - setSelectedColumn(newIndex); - } - }; - const columns = F2( - () => { - var _a2; - return [ - ...(_a2 = cols == null ? void 0 : cols.filter((f4) => f4.type != "preview").map((f4) => { - return { - header: f4.name, - accessorKey: f4.name + f4.table, - meta: { - table: f4.table, - editable: f4.primary != "true", - schemaId: dbSchema == null ? void 0 : dbSchema.id - }, - cell: ({ - getValue, - row: { index }, - column: { colId }, - cell, - table: table2 - }) => { - const initialValue = getValue(); - const rowIndex = parseInt( - data[index]["_index" + f4.table] - ); - const tableIndex = parseInt(data[index]["_index"]); - const saveValue = (value) => { - var _a3; - setCurrentEdit(null); - if (initialValue != value) - (_a3 = table2.options.meta) == null ? void 0 : _a3.updateData( - f4.name, - value, - f4.table, - rowIndex - ); - }; - const saveFieldValue = (fieldValue, value) => { - var _a3; - (_a3 = table2.options.meta) == null ? void 0 : _a3.updateFieldValue( - f4.name, - fieldValue, - value, - f4.table, - rowIndex - ); - }; - const editMode = readMode ? -1 /* EditModeReadOnly */ : !cell.getIsGrouped() ? platformIsMobile() ? 3 /* EditModeAlways */ : currentEdit && currentEdit[0] == f4.name + f4.table && currentEdit[1] == tableIndex.toString() ? 2 /* EditModeActive */ : 1 /* EditModeView */ : -1 /* EditModeReadOnly */; - const cellProps = { - initialValue, - saveValue, - plugin: props2.plugin, - setEditMode: setCurrentEdit, - editMode, - propertyValue: f4.value - }; - const fieldType = fieldTypeForType(f4.type); - if (!fieldType) { - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, initialValue); - } - if (fieldType.type == "file") { - return /* @__PURE__ */ Cn.createElement(FileCell, { - ...cellProps, - multi: fieldType.multiType == f4.type, - folder: contextInfo.contextPath, - isFolder: contextInfo.type == "folder", - openFlow: () => toggleFlow(initialValue), - deleteRow: () => deleteRow(index) - }); - } else if (fieldType.type == "boolean") { - return /* @__PURE__ */ Cn.createElement(BooleanCell, { - ...cellProps, - column: f4 - }); - } else if (fieldType.type == "option") { - return /* @__PURE__ */ Cn.createElement(OptionCell, { - ...cellProps, - options: f4.value, - multi: fieldType.multiType == f4.type, - saveOptions: saveFieldValue - }); - } else if (fieldType.type == "date") { - return /* @__PURE__ */ Cn.createElement(DateCell, { - ...cellProps - }); - } else if (fieldType.type == "context") { - return /* @__PURE__ */ Cn.createElement(ContextCell, { - ...cellProps, - multi: fieldType.multiType == f4.type, - contextTable: contextTable[f4.value], - contextTag: f4.value - }); - } else if (fieldType.type == "fileprop") { - return /* @__PURE__ */ Cn.createElement(LookUpCell, { - ...cellProps, - file: data[index][FilePropertyName] - }); - } else if (fieldType.type == "tag") { - return /* @__PURE__ */ Cn.createElement(TagCell, { - ...cellProps, - multi: fieldType.multiType == f4.type - }); - } else if (fieldType.type == "number") { - return /* @__PURE__ */ Cn.createElement(NumberCell, { - ...cellProps - }); - } else if (fieldType.type == "link") { - return /* @__PURE__ */ Cn.createElement(LinkCell, { - ...cellProps, - multi: fieldType.multiType == f4.type, - file: data[index][FilePropertyName] - }); - } else if (fieldType.type == "image") { - return /* @__PURE__ */ Cn.createElement(ImageCell, { - ...cellProps - }); - } else { - return /* @__PURE__ */ Cn.createElement(TextCell, { - ...cellProps - }); - } - } - }; - })) != null ? _a2 : [], - ...readMode ? [] : [ - { - header: "+", - meta: { schemaId: dbSchema == null ? void 0 : dbSchema.id }, - accessorKey: "+", - size: 20, - cell: () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) - } - ] - ]; - }, - [cols, currentEdit, predicate, contextTable, toggleFlow, openFlows] - ); - const groupBy2 = F2( + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + const vaultChangeModal = new stickerModal( + plugin.app, + plugin, + (emoji) => saveFileIcon(plugin, file, emoji) + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeFileIcon(plugin, file); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.rename); + menuItem.setIcon("pencil"); + menuItem.onClick((ev) => { + let vaultChangeModal = new VaultChangeModal(plugin, file, "rename"); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.delete); + menuItem.setIcon("trash"); + menuItem.onClick((ev) => { + let deleteOption = plugin.settings.deleteFileOption; + if (deleteOption === "permanent") { + plugin.app.vault.delete(file, true); + } else if (deleteOption === "system-trash") { + plugin.app.vault.trash(file, true); + } else if (deleteOption === "trash") { + plugin.app.vault.trash(file, false); + } + }); + }); + if (!isFolder) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.changeToFolderNote); + menuItem.setIcon("file-plus-2"); + menuItem.onClick((ev) => { + if (file instanceof import_obsidian25.TFile) + noteToFolderNote(plugin, file, true); + }); + }); + } + fileMenu.addItem((menuItem) => { + menuItem.setIcon("go-to-file"); + menuItem.setTitle(i18n_default.menu.openFilePane); + menuItem.onClick((ev) => { + openFileInNewPane(plugin, { ...file, isFolder }); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.duplicate); + menuItem.setIcon("documents"); + menuItem.onClick((ev) => { + if (file.basename && file.extension) + plugin.app.vault.copy( + file, + `${file.parent.path}/${file.basename} 1.${file.extension}` + ); + }); + }); + if (!internalPluginLoaded("file-explorer", plugin.app)) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.moveFile); + menuItem.setIcon("paper-plane"); + menuItem.onClick((ev) => { + let fileMoveSuggester = new MoveSuggestionModal(plugin.app, [ + file.path + ]); + fileMoveSuggester.open(); + }); + }); + } + plugin.app.workspace.trigger("file-menu", fileMenu, file, source); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; +}; + +// src/components/ContextView/DataTypeView/FileCell.tsx +var import_obsidian26 = require("obsidian"); +var FileCell = (props2) => { + const fileOrCleanPath = (f4) => { + if (!f4) + return { + path: "" + }; + const fileCache = props2.plugin.index.filesIndex.get(f4); + return fileCache ? { path: f4, fileCache } : { path: f4 }; + }; + const value = F2( () => { var _a2; - return ((_a2 = predicate.groupBy) == null ? void 0 : _a2.length) > 0 && cols.find((f4) => f4.name + f4.table == predicate.groupBy[0]) ? predicate.groupBy : []; - }, - [predicate, cols] - ); - const table = useReactTable({ - data, - columns, - columnResizeMode: "onChange", - state: { - columnVisibility: predicate.colsHidden.reduce( - (p3, c4) => ({ ...p3, [c4]: false }), - {} - ), - columnOrder: predicate.colsOrder, - columnSizing: { - ...columns.reduce((p3, c4) => ({ ...p3, [c4.accessorKey]: 150 }), {}), - ...colsSize - }, - grouping: groupBy2, - expanded: true + return (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).map((f4) => fileOrCleanPath(f4)); }, - onColumnSizingChange: saveColsSize, - getCoreRowModel: getCoreRowModel(), - getExpandedRowModel: getExpandedRowModel(), - getGroupedRowModel: getGroupedRowModel(), - meta: { - updateData: updateValue2, - updateFieldValue - } - }); - const sensors = useSensors( - useSensor(MouseSensor, { - activationConstraint: { - distance: 10 - } - }), - useSensor(TouchSensor, { - activationConstraint: { - delay: 250, - tolerance: 5 - } - }) + [props2.initialValue] ); - const measuring = { - droppable: { - strategy: MeasuringStrategy.Always - } + const ref = _2(null); + const onKeyDown = (e4) => { + e4.stopPropagation(); + e4.key == "Enter" && e4.target.blur(); }; - function handleDragStart(event) { - const { - active: { id: activeId2 } - } = event; - setActiveId(activeId2); - setOverId(overId); - document.body.style.setProperty("cursor", "grabbing"); - } - function handleDragOver({ over }) { + const fileExists = (name) => { + if (!name) + return false; + return getAbstractFileAtPath(app, name) ? true : false; + }; + const onBlur = () => { var _a2; - const overId2 = over == null ? void 0 : over.id; - if (overId2) { - setOverId((_a2 = over == null ? void 0 : over.id) != null ? _a2 : null); + if (!ref.current) + return; + if (fileExists((_a2 = ref.current) == null ? void 0 : _a2.value)) { + new import_obsidian26.Notice(i18n_default.notice.fileExists); + } else { + props2.saveValue(ref.current.value); + props2.setEditMode(null); } - } - const saveFilter = (filter) => { - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != filter.field), - filter - ] - }); }; - const selectCell = (e4, index, column) => { - if (platformIsMobile() || column == "+") + const newFile = async (file) => { + const filePath = file.path.replace(/\//g, "").replace(/\./g, ""); + const path = `${props2.folder}/${filePath}.md`; + if (filePath.length == 0) { return; - selectItem(0, data[index]["_index"]); - setSelectedColumn(column); - if (e4.detail === 1) { - } else if (e4.detail === 2) { - setCurrentEdit([column, data[index]["_index"]]); } - }; - const showContextMenu = (e4, index) => { - e4.preventDefault(); - const menu = new import_obsidian28.Menu(); - menu.addItem((item) => { - item.setIcon("trash"); - item.setTitle(i18n_default.menu.deleteRow); - item.onClick(() => { - deleteRow(index); - }); - }); - if (isMouseEvent(e4)) { - menu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + if (fileExists(path)) { + new import_obsidian26.Notice(i18n_default.notice.fileExists); } else { - menu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); + await createNewMarkdownFile( + props2.plugin, + getAbstractFileAtPath(app, props2.folder), + filePath + ); } }; - function handleDragEnd({ active, over }) { - resetState(); - savePredicate({ - ...predicate, - colsOrder: arrayMove( - predicate.colsOrder, - predicate.colsOrder.findIndex((f4) => f4 == activeId), - predicate.colsOrder.findIndex((f4) => f4 == overId) - ) - }); - } - function handleDragCancel() { - resetState(); - } - function resetState() { - setOverId(null); - setActiveId(null); - document.body.style.setProperty("cursor", ""); - } - return /* @__PURE__ */ Cn.createElement(DndContext, { - sensors, - collisionDetection: closestCenter, - measuring, - onDragStart: handleDragStart, - onDragOver: handleDragOver, - onDragEnd: handleDragEnd, - onDragCancel: handleDragCancel - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-table", - ref, - tabIndex: 1, - onKeyDown - }, /* @__PURE__ */ Cn.createElement("table", { - ...{} - }, /* @__PURE__ */ Cn.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ Cn.createElement("tr", { - key: headerGroup.id - }, /* @__PURE__ */ Cn.createElement("th", null), headerGroup.headers.map((header) => { + const deleteRow = () => { + props2.deleteRow(); + }; + p2(() => { var _a2; - return /* @__PURE__ */ Cn.createElement("th", { - className: "mk-th", - key: header.id, - style: { - minWidth: header.column.getIsGrouped() ? "0px" : (_a2 = colsSize[header.column.columnDef.accessorKey]) != null ? _a2 : "150px" - } - }, header.isPlaceholder ? null : header.column.columnDef.header != "+" ? header.column.getIsGrouped() ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { - plugin: props2.plugin, - editable: header.column.columnDef.meta.editable, - column: cols.find( - (f4) => f4.name == header.column.columnDef.header && f4.table == header.column.columnDef.meta.table - ) - }) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { - plugin: props2.plugin, - isNew: true, - editable: true, - column: { - name: "", - schemaId: header.column.columnDef.meta.schemaId, - type: "text", - table: "" - } - }), /* @__PURE__ */ Cn.createElement("div", { - ...{ - onMouseDown: header.getResizeHandler(), - onTouchStart: header.getResizeHandler(), - className: `mk-resizer ${header.column.getIsResizing() ? "isResizing" : ""}` - } - })); - })))), /* @__PURE__ */ Cn.createElement("tbody", null, table.getRowModel().rows.map((row) => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("tr", { - className: (selectedRows == null ? void 0 : selectedRows.some( - (f4) => f4 == data[row.index]["_index"] - )) && "mk-is-active", - onContextMenu: (e4) => { - const rowIndex = parseInt( - data[row.index]["_index"] - ); - showContextMenu(e4, rowIndex); - }, - key: row.id - }, /* @__PURE__ */ Cn.createElement("td", null), row.getVisibleCells().map( - (cell) => { - var _a2, _b2; - return cell.getIsGrouped() ? /* @__PURE__ */ Cn.createElement("td", { - className: "mk-td-group", - colSpan: cols.length + (readMode ? 0 : 1) - }, /* @__PURE__ */ Cn.createElement("div", { - ...{ - onClick: row.getToggleExpandedHandler(), - style: { - display: "flex", - alignItems: "center", - cursor: "normal" + if (props2.editMode == 2) { + (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.focus(); + } + }, [props2.editMode]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file" + }, value.map((v3, i4) => { + var _a2; + if (props2.editMode == 0) { + if (v3.fileCache) { + return /* @__PURE__ */ Cn.createElement("div", { + key: i4, + className: "mk-cell-file-title" + }, v3 && v3.fileCache ? v3.fileCache.name : "", ((_a2 = v3.fileCache.extension) == null ? void 0 : _a2.length) > 0 && v3.fileCache.extension != "md" && /* @__PURE__ */ Cn.createElement("span", { + className: "nav-file-tag" + }, v3.fileCache.extension), /* @__PURE__ */ Cn.createElement("button", { + "aria-label": i18n_default.buttons.toggleFlow, + className: "mk-cell-file-flow mk-inline-button", + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-flow-hover"] + }, + onClick: (e4) => { + if (props2.openFlow) { + props2.openFlow(e4); + e4.stopPropagation(); + } } - } - }, flexRender( - cell.column.columnDef.cell, - cell.getContext() - ), " ", "(", row.subRows.length, ")")) : cell.getIsAggregated() ? flexRender( - (_a2 = cell.column.columnDef.aggregatedCell) != null ? _a2 : cell.column.columnDef.cell, - cell.getContext() - ) : /* @__PURE__ */ Cn.createElement("td", { - onClick: (e4) => selectCell( - e4, - cell.row.index, - cell.column.columnDef.accessorKey - ), - className: `${cell.column.columnDef.accessorKey == selectedColumn ? "mk-selected-cell " : ""} mk-td ${cell.getIsPlaceholder() ? "mk-td-empty" : ""}`, - key: cell.id, - style: { - minWidth: cell.getIsPlaceholder() ? "0px" : (_b2 = colsSize[cell.column.columnDef.accessorKey]) != null ? _b2 : "50px" - } - }, cell.getIsPlaceholder() ? null : flexRender( - cell.column.columnDef.cell, - cell.getContext() - )); + })); + } else { + return /* @__PURE__ */ Cn.createElement("div", { + key: i4, + className: "mk-cell-file-title" + }, v3.path); + } } - ))))), /* @__PURE__ */ Cn.createElement("tfoot", null, contextInfo.type == "folder" && !readMode ? /* @__PURE__ */ Cn.createElement("tr", null, /* @__PURE__ */ Cn.createElement("th", { - className: "mk-row-new", - colSpan: cols.length + (readMode ? 1 : 2), - onClick: () => { - newRow(); + if (v3.fileCache) { + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-item", + onContextMenu: (e4) => triggerFileMenu( + props2.plugin, + getAbstractFileAtPath(app, v3.fileCache.path), + v3.fileCache.isFolder, + e4 + ) + }, /* @__PURE__ */ Cn.createElement(FileSticker, { + plugin: props2.plugin, + fileCache: v3.fileCache + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-name", + onClick: (e4) => openAFile( + getAbstractFileAtPath(app, v3.fileCache.path), + props2.plugin, + e4.ctrlKey || e4.metaKey + ) + }, v3 && v3.fileCache ? filePathToString(v3.fileCache.name) : ""))); } - }, "+ New")) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))), z3( - /* @__PURE__ */ Cn.createElement(DragOverlay, { - dropAnimation: null, - zIndex: 1600 - }, activeId ? /* @__PURE__ */ Cn.createElement(ColumnHeader, { - plugin: props2.plugin, - editable: false, - column: { - name: activeId, - schemaId: tableData.schema.id, - type: "text", - table: "" + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-item" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-icon" + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => newFile(v3), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-new-file"] } - }) : null), - document.body - ))); + })), props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { + className: "mk-cell-file-name", + type: "text", + placeholder: "Untitled", + ref, + value: v3.path, + onKeyDown, + onBlur + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-name" + }, v3.path))); + })); }; -// src/components/ContextView/DataTypeView/BooleanCell.tsx -var BooleanCell = (props2) => { +// src/components/ContextView/DataTypeView/FilePropertyCell.tsx +var humanFileSize = (bytes, si = false, dp = 1) => { + const thresh = si ? 1e3 : 1024; + if (Math.abs(bytes) < thresh) { + return bytes + " B"; + } + const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; + let u4 = -1; + const r3 = 10 ** dp; + do { + bytes /= thresh; + ++u4; + } while (Math.round(Math.abs(bytes) * r3) / r3 >= thresh && u4 < units.length - 1); + return bytes.toFixed(dp) + " " + units[u4]; +}; +var LookUpCell = (props2) => { + const [cache, setCache] = h2(null); + const initialValue = props2.initialValue; + const { field, property } = parsePropString(props2.propertyValue); + if (property == "folder") { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop", + onClick: () => { + openTFolder( + getAbstractFileAtPath(app, initialValue), + props2.plugin, + false + ); + } + }, folderPathToString(initialValue)); + } + if (property == "extension") { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, initialValue); + } else if (property == "ctime" || property == "mtime") { + const date = new Date(parseInt(initialValue)).getTime() ? new Date(parseInt(initialValue)) : null; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, date && formatDistance3(new Date(date), new Date(), { addSuffix: true })); + } else if (property == "size" || property == "File.size") { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, humanFileSize(parseInt(initialValue))); + } + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, initialValue); +}; + +// src/components/ContextView/DataTypeView/NumberCell.tsx +var NumberCell = (props2) => { const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue == "true"); - const onChange = () => { - if (props2.editMode == -1 /* EditModeReadOnly */) { - return; - } - setValue(!value); - saveValue(!value ? "true" : "false"); + const [value, setValue] = Cn.useState(initialValue); + const ref = _2(null); + const onBlur = () => { + if (initialValue != value) + saveValue(value); }; - p2(() => { - if (props2.editMode == 2 /* EditModeActive */) { - setValue(!value); - saveValue(!value ? "true" : "false"); + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "Enter") { + e4.target.blur(); props2.setEditMode(null); } - }, [props2.editMode]); + if (e4.key == "Escape") { + setValue(initialValue); + e4.target.blur(); + props2.setEditMode(null); + } + }; Cn.useEffect(() => { - setValue(initialValue == "true"); + setValue(initialValue); }, [initialValue]); - if (props2.editMode < 1 /* EditModeView */) { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-boolean" - }, /* @__PURE__ */ Cn.createElement("input", { - type: "checkbox", - checked: value, - onChange - }), /* @__PURE__ */ Cn.createElement("div", null, props2.column.name)); - } - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-text" - }, /* @__PURE__ */ Cn.createElement("input", { - type: "checkbox", - checked: value, - onChange - })); + p2(() => { + var _a2; + if (props2.editMode == 2) { + (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.focus(); + } + }, [props2.editMode]); + return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { + className: "mk-cell-text", + type: "number", + step: "any", + ref, + value, + onChange: (e4) => setValue(e4.target.value), + onKeyDown, + onBlur + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-number" + }, value); }; - -// src/components/ContextView/DataTypeView/ObjectCell.tsx -var ObjectCell = (props2) => { + +// src/components/ContextView/DataTypeView/TextCell.tsx +var TextCell = (props2) => { const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(safelyParseJSON(initialValue)); - const saveKey = (key2, newKey) => { - if (key2 != newKey) - saveValue({ - ...value, - [newKey]: value[key2], - [key2]: void 0 - }); + const [value, setValue] = Cn.useState(initialValue); + const ref = _2(null); + const onBlur = () => { + if (initialValue != value) + saveValue(value); }; - const saveVal = (key2, val) => { - saveValue({ - ...value, - [key2]: val - }); + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "Enter") { + e4.target.blur(); + props2.setEditMode(null); + } + if (e4.key == "Escape") { + setValue(initialValue); + e4.target.blur(); + props2.setEditMode(null); + } }; Cn.useEffect(() => { - setValue(safelyParseJSON(initialValue)); + setValue(initialValue); }, [initialValue]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-object" - }, Object.keys(value).map((f4) => /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-object-row" - }, /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - type: "text", - value: f4, - onBlur: (e4) => saveKey(f4, e4.target.value) - }), /* @__PURE__ */ Cn.createElement("input", { + p2(() => { + var _a2; + if (props2.editMode == 2) { + (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.focus(); + } + }, [props2.editMode]); + return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { onClick: (e4) => e4.stopPropagation(), className: "mk-cell-text", + ref, type: "text", - value: value[f4], - onBlur: (e4) => saveVal(f4, e4.target.value) - })))); + value, + onChange: (e4) => setValue(e4.target.value), + onKeyDown, + onBlur + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-text" + }, value); }; -// src/components/ContextView/DataTypeView/PreviewCell.tsx -var PreviewCell = (props2) => { - var _a2; - const [vaultItem, setVaultItem] = h2(null); - const previewImage = F2(() => { - if (vaultItem == null ? void 0 : vaultItem.banner) - return vaultItem.banner; - if (props2.initialValue) - return props2.initialValue; - if (!props2.row || !props2.columns) - return null; - const imageCol = props2.columns.find((f4) => f4.type == "image"); - if (!imageCol) - return null; - return props2.row[imageCol.name + imageCol.table]; - }, [props2.row, props2.columns]); - const previewFile = F2(() => { - return getAbstractFileAtPath(app, previewImage); - }, [previewImage]); - const loadIcon = () => { - setVaultItem(props2.plugin.index.filesIndex.get(props2.file)); - }; +// src/components/ContextView/TableView/TableView.tsx +var import_lodash6 = __toESM(require_lodash()); +var import_obsidian31 = require("obsidian"); + +// src/utils/ui/selection.ts +var selectNextIndex = (currIndex, array) => { + if (!currIndex && array.length > 0) + return array[0]; + const pos = array.indexOf(currIndex); + if (pos < array.length - 1) + return array[pos + 1]; + return currIndex; +}; +var selectPrevIndex = (currIndex, array) => { + const pos = array.indexOf(currIndex); + if (pos > 0) + return array[pos - 1]; + return array[0]; +}; +var selectRange = (currSel, newSel, array) => { + const lastIndex = array.findIndex((f4) => f4 == currSel); + const newIndex = array.findIndex((f4) => f4 == newSel); + if (lastIndex < newIndex) { + return array.filter((f4, i4) => i4 > lastIndex && i4 <= newIndex); + } + return array.filter((f4, i4) => i4 < lastIndex && i4 >= newIndex); +}; + +// src/components/ContextView/DataTypeView/ImageCell.tsx +var ImageCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue); + const menuRef = _2(null); p2(() => { - loadIcon(); - window.addEventListener(eventTypes.spacesChange, loadIcon); - return () => { - window.removeEventListener(eventTypes.spacesChange, loadIcon); - }; - }, [props2.file]); - return previewImage ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-preview", - style: { - backgroundSize: "cover", - backgroundPositionY: "50%", - backgroundImage: `url(${previewFile ? app.vault.getResourcePath(previewFile) : previewImage})` - } - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-preview", - style: ((_a2 = vaultItem == null ? void 0 : vaultItem.color) == null ? void 0 : _a2.length) > 0 ? { - "--label-color": `${vaultItem.color}`, - "--icon-color": `#ffffff` - } : { - "--label-color": `var(--background-secondary-alt)`, - "--icon-color": `var(--text-muted)` + if (props2.editMode == 2 /* EditModeActive */) { + if (!menuRef.current) + showModal(); } + }, []); + const file = F2(() => { + const f4 = getAbstractFileAtPath(app, value); + return f4 ? app.vault.getResourcePath(f4) : value; + }, [value]); + Cn.useEffect(() => { + setValue(initialValue); + }, [initialValue]); + const showModal = () => { + let vaultChangeModal = new imageModal( + props2.plugin, + props2.plugin.app, + (image) => saveValue(image) + ); + vaultChangeModal.open(); + props2.setEditMode(null); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-image" + }, /* @__PURE__ */ Cn.createElement("img", { + src: file + }), props2.editMode > 0 ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-image-selector" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-icon", - dangerouslySetInnerHTML: (vaultItem == null ? void 0 : vaultItem.sticker) ? { __html: stickerFromString(vaultItem.sticker, props2.plugin) } : (vaultItem == null ? void 0 : vaultItem.isFolder) ? { __html: uiIconSet["mk-ui-folder"] } : { __html: uiIconSet["mk-ui-file"] } - })); + onClick: showModal, + className: "mk-hover-button mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-edit"] } + }), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ Cn.createElement("div", { + onClick: () => saveValue(""), + className: "mk-hover-button mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); }; -// src/components/ContextView/DataTypeView/DataTypeView.tsx -var DataTypeView = (props2) => { - const { initialValue, index, column, file } = props2; - const saveValue = (value) => { - props2.updateValue(value); - }; - const saveFieldValue = (fieldValue, value) => { - props2.updateFieldValue(fieldValue, value); - }; - const viewProps = { - initialValue, - saveValue, - editMode: props2.editable == true ? 3 : 0, - setEditMode: () => { - }, - plugin: props2.plugin, - propertyValue: column.value +// src/utils/flow/flowEditor.ts +var import_state5 = require("@codemirror/state"); + +// src/cm-extensions/flowEditor/atomic.ts +var import_state4 = require("@codemirror/state"); + +// src/cm-extensions/flowEditor/selectiveEditor.ts +var import_state3 = require("@codemirror/state"); +var import_view3 = require("@codemirror/view"); + +// node_modules/tslib/modules/index.js +var import_tslib = __toESM(require_tslib(), 1); +var { + __extends, + __assign: __assign2, + __rest: __rest2, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray: __spreadArray2, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn +} = import_tslib.default; + +// src/cm-extensions/flowEditor/selectiveEditor.ts +var combinedRangeFacets = (rangeA, rangeB) => { + const startRange = !(rangeA == null ? void 0 : rangeA[0]) ? rangeB[0] : !(rangeB == null ? void 0 : rangeB[0]) ? rangeA[0] : Math.max(rangeA == null ? void 0 : rangeA[0], rangeB == null ? void 0 : rangeB[0]); + const endRange = !(rangeA == null ? void 0 : rangeA[1]) ? rangeB[1] : !(rangeB == null ? void 0 : rangeB[1]) ? rangeA[1] : Math.min(rangeA == null ? void 0 : rangeA[1], rangeB == null ? void 0 : rangeB[1]); + return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; +}; +var editableRange = import_state3.Annotation.define(); +var contentRange = import_state3.Annotation.define(); +var hiddenLine = import_view3.Decoration.replace({ inclusive: true, block: true }); +var hideLine = import_state3.StateField.define({ + create() { + return import_view3.Decoration.none; + }, + update(value, tr) { + let builder = new import_state3.RangeSetBuilder(); + const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); + if ((betterFacet == null ? void 0 : betterFacet[0]) != null) { + const starterLine = Math.min( + tr.state.doc.lines, + betterFacet[0] + ); + builder.add( + tr.state.doc.line(1).from, + tr.state.doc.line(starterLine).from - 1, + hiddenLine + ); + if (tr.newDoc.lines != betterFacet[1]) + builder.add( + tr.state.doc.line( + Math.min(tr.newDoc.lines, betterFacet[1]) + ).to, + tr.state.doc.line(tr.newDoc.lines).to, + hiddenLine + ); + } + const dec = builder.finish(); + return dec; + }, + provide: (f4) => import_view3.EditorView.decorations.from(f4) +}); +var frontmatterFacet = import_state3.StateField.define({ + create: () => [void 0, void 0], + update(value, tr) { + if (tr.annotation(contentRange)) { + if (tr.annotation(contentRange)[0]) { + return [ + tr.annotation(contentRange)[0], + Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) + ]; + } + return tr.annotation(contentRange); + } + return value; + } +}); +var selectiveLinesFacet = import_state3.StateField.define({ + create: () => [void 0, void 0], + update(value, tr) { + if (tr.annotation(editableRange)) { + if (tr.annotation(editableRange)[0]) { + return [ + tr.annotation(editableRange)[0], + Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) + ]; + } + return tr.annotation(editableRange); + } + return value; + } +}); +var lineRangeToPosRange = (state, range) => { + return { + from: state.doc.line(range[0]).from, + to: state.doc.line(Math.min(state.doc.lines, range[1])).to }; - const fieldType = fieldTypeForType(column.type); - if (!fieldType) { - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); +}; +var smartDelete = import_state3.EditorState.transactionFilter.of( + (tr) => { + if (tr.isUserEvent("delete") && !tr.annotation(import_state3.Transaction.userEvent).endsWith(".smart")) { + const initialSelections = tr.startState.selection.ranges.map((range) => ({ + from: range.from, + to: range.to + })); + const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); + if (initialSelections.length > 0 && (betterFacet == null ? void 0 : betterFacet[0])) { + const posRange = lineRangeToPosRange( + tr.startState, + betterFacet + ); + if (tr.changes.touchesRange(0, posRange.from - 1)) { + const minFrom = Math.max(posRange.from, initialSelections[0].from); + const minTo = Math.min(posRange.to, initialSelections[0].to); + return [{ + changes: { + from: Math.min(minFrom, minTo), + to: Math.max(minFrom, minTo) + }, + annotations: import_state3.Transaction.userEvent.of( + `${tr.annotation(import_state3.Transaction.userEvent)}.smart` + ) + }]; + } + } + } + return tr; } - if (fieldType.type == "preview") { - return /* @__PURE__ */ Cn.createElement(PreviewCell, { - ...viewProps, - file, - row: props2.row, - columns: props2.cols - }); - } else if (fieldType.type == "file") { - return /* @__PURE__ */ Cn.createElement(FileCell, { - isFolder: false, - ...viewProps, - multi: fieldType.multiType == column.type, - openFlow: props2.openFlow - }); - } else if (fieldType.type == "boolean") { - return /* @__PURE__ */ Cn.createElement(BooleanCell, { - ...viewProps, - column - }); - } else if (fieldType.type == "option") { - return /* @__PURE__ */ Cn.createElement(OptionCell, { - ...viewProps, - options: column.value, - multi: fieldType.multiType == column.type, - saveOptions: saveFieldValue - }); - } else if (fieldType.type == "date") { - return /* @__PURE__ */ Cn.createElement(DateCell, { - ...viewProps - }); - } else if (fieldType.type == "context") { - return /* @__PURE__ */ Cn.createElement(ContextCell, { - ...viewProps, - multi: fieldType.multiType == column.type, - contextTable: props2.contextTable[column.value], - contextTag: column.value - }); - } else if (fieldType.type == "fileprop") { - return /* @__PURE__ */ Cn.createElement(LookUpCell, { - ...viewProps, - file - }); - } else if (fieldType.type == "number") { - return /* @__PURE__ */ Cn.createElement(NumberCell, { - ...viewProps - }); - } else if (fieldType.type == "link") { - return /* @__PURE__ */ Cn.createElement(LinkCell, { - ...viewProps, - multi: fieldType.multiType == column.type, - file - }); - } else if (fieldType.type == "tag") { - return /* @__PURE__ */ Cn.createElement(TagCell, { - ...viewProps, - multi: fieldType.multiType == column.type - }); - } else if (fieldType.type == "image") { - return /* @__PURE__ */ Cn.createElement(ImageCell, { - ...viewProps - }); - } else if (fieldType.type == "object") { - return /* @__PURE__ */ Cn.createElement(ObjectCell, { - ...viewProps - }); +); +var preventModifyTargetRanges = import_state3.EditorState.transactionFilter.of( + (tr) => { + let newTrans = []; + try { + const editableLines = tr.startState.field(selectiveLinesFacet, false); + const contentLines = tr.startState.field(frontmatterFacet, false); + const selectiveLines = combinedRangeFacets(editableLines, contentLines); + if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { + if (selectiveLines == null ? void 0 : selectiveLines[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + selectiveLines + ); + if (!tr.changes.touchesRange(posRange.from, posRange.to)) { + return []; + } + } + } + if (tr.state.doc.lines != tr.startState.doc.lines) { + const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; + if (selectiveLines == null ? void 0 : selectiveLines[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + selectiveLines + ); + if (tr.changes.touchesRange(0, posRange.from - 1)) { + const newAnnotations = []; + if (editableLines[0]) { + newAnnotations.push(editableRange.of([ + editableLines[0] + numberNewLines, + editableLines[1] + numberNewLines + ])); + } + if (contentLines[0]) { + newAnnotations.push(contentRange.of([ + contentLines[0] + numberNewLines, + contentLines[1] + numberNewLines + ])); + } + newTrans.push({ + annotations: newAnnotations + }); + } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { + const newAnnotations = []; + if (editableLines[0]) { + newAnnotations.push(editableRange.of([ + editableLines[0], + editableLines[1] + numberNewLines + ])); + } + if (contentLines[0]) { + newAnnotations.push(contentRange.of([ + contentLines[0], + contentLines[1] + numberNewLines + ])); + } + newTrans.push({ + annotations: newAnnotations + }); + } + } + } + } catch (e4) { + return []; + } + return [tr, ...newTrans]; + } +); +var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; +var editBlockExtensions = () => [ + readOnlyRangesExtension, + hideLine, + selectiveLinesFacet, + frontmatterFacet +]; + +// src/cm-extensions/flowEditor/atomic.ts +var arrowKeyAnnotation = import_state4.Annotation.define(); +var atomicSelect = import_state4.EditorState.transactionFilter.of( + (tr) => { + if (tr.isUserEvent("delete") || tr.isUserEvent("input")) { + return tr; + } + const flowID = tr.startState.field(flowIDStateField, false); + if (tr.annotation(arrowKeyAnnotation) && flowID) { + const oldSel = tr.startState.selection.main; + const lineRange = tr.state.field(selectiveLinesFacet, false); + const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(tr.startState, lineRange) : { from: 0, to: tr.startState.doc.length }; + if (oldSel.from <= posRange.from && tr.annotation(arrowKeyAnnotation) == 3) { + focusFlowEditorParent(flowID, true); + } + if (oldSel.to >= posRange.to && tr.annotation(arrowKeyAnnotation) == 4) { + focusFlowEditorParent(flowID, false); + } + return tr; + } + const selection = tr.newSelection.main; + if (selection.from == 0 && selection.to == 0 || selection.from != selection.to) + return tr; + const flowEditors = tr.state.field(flowEditorInfo, false); + if (flowEditors) { + for (let info of flowEditors) { + if (info.embed == 1) { + if (info.from - 3 <= selection.from && info.to + 2 >= selection.to && info.expandedState == 2) { + const top = tr.annotation(arrowKeyAnnotation) == 1 || tr.startState.selection.main.from > selection.from ? false : true; + focusFlowEditor(info.id, top); + return { + selection: import_state4.EditorSelection.single(info.from - 4) + }; + break; + } + } + } + } + return tr; } - return /* @__PURE__ */ Cn.createElement(TextCell, { - ...viewProps - }); -}; +); + +// src/components/ContextView/EmbedContextView.tsx +var import_obsidian28 = require("obsidian"); + +// src/components/ContextView/CardsView/CardsView.tsx +var import_classnames4 = __toESM(require_classnames()); // src/components/ContextView/CardsView/CardColumnView.tsx +var import_classnames2 = __toESM(require_classnames()); var CardColumnView = k3( ({ id: id2, @@ -40734,966 +39734,2340 @@ var CardsView = ({ dragOverlay: true })); } - function renderContainerDragOverlay(containerId) { - return /* @__PURE__ */ Cn.createElement(CardColumnView, { - id: containerId, - plugin, - label: `Column ${containerId}`, - field: groupBy2, - columns, - style: { - height: "100%" - }, - shadow: true, - unstyled: false - }, items[Object.keys(items)[parseInt(containerId) * -1]].map( - (item, index) => /* @__PURE__ */ Cn.createElement(CardView, { - key: item, - id: item, - plugin, - value: filteredData.find((f4) => f4._index == item), - cols: displayCols, - handle, - style: getItemStyles({ - containerId, - overIndex: -1, - index: getIndex(item), - value: item, - isDragging: false, - isSorting: false, - isDragOverlay: false - }), - color: getColor(item), - selected: selectedRows.some((f4) => f4 == item), - onSelect: selectItem, - wrapperStyle: wrapperStyle({ index }), - renderItem - }) - )); + function renderContainerDragOverlay(containerId) { + return /* @__PURE__ */ Cn.createElement(CardColumnView, { + id: containerId, + plugin, + label: `Column ${containerId}`, + field: groupBy2, + columns, + style: { + height: "100%" + }, + shadow: true, + unstyled: false + }, items[Object.keys(items)[parseInt(containerId) * -1]].map( + (item, index) => /* @__PURE__ */ Cn.createElement(CardView, { + key: item, + id: item, + plugin, + value: filteredData.find((f4) => f4._index == item), + cols: displayCols, + handle, + style: getItemStyles({ + containerId, + overIndex: -1, + index: getIndex(item), + value: item, + isDragging: false, + isSorting: false, + isDragOverlay: false + }), + color: getColor(item), + selected: selectedRows.some((f4) => f4 == item), + onSelect: selectItem, + wrapperStyle: wrapperStyle({ index }), + renderItem + }) + )); + } + function getNextContainerId() { + const containeIds = Object.keys(items); + const lastContaineId = containeIds[containeIds.length - 1]; + return String.fromCharCode(lastContaineId.charCodeAt(0) + 1); + } +}; +function getColor(id2) { + switch (id2[0]) { + case "A": + return "#7193f1"; + case "B": + return "#ffda6c"; + case "C": + return "#00bcd4"; + case "D": + return "#ef769f"; + } + return void 0; +} +function SortableItem2({ + disabled, + id: id2, + plugin, + index, + handle, + renderItem, + style, + containerId, + onSelect, + selected, + getIndex, + cols, + value, + wrapperStyle +}) { + const { + setNodeRef, + listeners, + isDragging, + isSorting, + over, + overIndex, + transform, + transition + } = useSortable({ + id: id2 + }); + const mounted = useMountStatus(); + const mountedWhileDragging = isDragging && !mounted; + return /* @__PURE__ */ Cn.createElement(CardView, { + ref: disabled ? void 0 : setNodeRef, + value, + plugin, + id: id2, + cols, + dragging: isDragging, + sorting: isSorting, + handle, + index, + wrapperStyle: wrapperStyle({ index }), + style: style({ + index, + value: id2, + isDragging, + isSorting, + overIndex: over ? getIndex(over.id) : overIndex, + containerId + }), + onSelect, + selected, + color: getColor(id2), + transition, + transform, + fadeIn: mountedWhileDragging, + listeners, + renderItem + }); +} +function useMountStatus() { + const [isMounted, setIsMounted] = h2(false); + p2(() => { + const timeout = setTimeout(() => setIsMounted(true), 500); + return () => clearTimeout(timeout); + }, []); + return isMounted; +} + +// src/components/ContextView/FlowListView/FlowListView.tsx +var import_obsidian27 = require("obsidian"); +var FlowListView = (props2) => { + const { filteredData: data } = q2(MDBContext); + const flowItems = F2(() => { + return data.map((f4) => getAbstractFileAtPath(app, f4.File)).filter((f4) => f4 instanceof import_obsidian27.TFile && f4.extension == "md"); + }, [data]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-flow-container" + }, flowItems.map((f4) => /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("span", null, fileNameToString(f4.name)), /* @__PURE__ */ Cn.createElement(FlowView, { + plugin: props2.plugin, + path: f4.path, + load: true + })))); +}; + +// src/components/ContextView/ContextListView.tsx +var ContextListView = (props2) => { + const { schema } = q2(MDBContext); + const [error, resetError] = P2(); + if (error) + console.log(error); + return schema ? schema.type == "flow" ? /* @__PURE__ */ Cn.createElement(FlowListView, { + plugin: props2.plugin + }) : schema.type == "table" ? /* @__PURE__ */ Cn.createElement(TableView, { + plugin: props2.plugin + }) : /* @__PURE__ */ Cn.createElement(CardsView, { + plugin: props2.plugin + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); +}; + +// src/components/ContextView/EmbedContextViewComponent.tsx +var EmbedContextViewComponent = (props2) => { + const context = mdbContextByPath(props2.plugin, props2.path); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, context && /* @__PURE__ */ Cn.createElement(MDBProvider, { + plugin: props2.plugin, + context, + schema: props2.schema + }, /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(ContextListView, { + plugin: props2.plugin + })))); +}; + +// src/components/ContextView/EmbedContextView.tsx +var EMBED_CONTEXT_VIEW_TYPE = "make-inline-context"; +var EmbedContextView = class extends import_obsidian28.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = true; + this.plugin = plugin; + } + getViewType() { + return EMBED_CONTEXT_VIEW_TYPE; + } + getDisplayText() { + return this.contextPath; + } + async onClose() { + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + } + async setState(state, result) { + this.contextPath = state.contextPath; + this.ref = state.ref ? state.ref.substring(1, state.ref.length) : null; + this.constructInlineContext(this.contextPath); + await super.setState(state, result); + const context = mdbContextByPath(this.plugin, this.contextPath); + const title = contextDisplayName(context); + 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() { + let state = super.getState(); + state.contextPath = this.contextPath; + return state; + } + constructInlineContext(file) { + this.destroy(); + this.root = createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(EmbedContextViewComponent, { + plugin: this.plugin, + path: this.contextPath, + schema: this.ref + })) + ); + } +}; + +// src/components/FlowEditor/FlowEditor.tsx +var import_obsidian29 = require("obsidian"); +var popovers = /* @__PURE__ */ new WeakMap(); +var mouseCoords = { x: 0, y: 0 }; +function nosuper(base) { + const derived = function() { + return Object.setPrototypeOf(new import_obsidian29.Component(), new.target.prototype); + }; + derived.prototype = base.prototype; + return Object.setPrototypeOf(derived, base); +} +var _a, _b, _c, _d, _e; +var FlowEditor = class extends nosuper(import_obsidian29.HoverPopover) { + constructor(parent, targetEl, plugin, waitTime, onShowCallback) { + super(); + this.targetEl = targetEl; + this.plugin = plugin; + this.onShowCallback = onShowCallback; + this.abortController = this.addChild(new import_obsidian29.Component()); + this.detaching = false; + this.opening = false; + this.rootSplit = new import_obsidian29.WorkspaceSplit( + window.app.workspace, + "vertical" + ); + this.targetRect = (_a = this.targetEl) == null ? void 0 : _a.getBoundingClientRect(); + this.oldPopover = (_b = this.parent) == null ? void 0 : _b.flowEditor; + this.document = (_e = (_d = (_c = this.targetEl) == null ? void 0 : _c.ownerDocument) != null ? _d : window.activeDocument) != null ? _e : window.document; + this.id = genId(); + this.hoverEl = this.document.defaultView.createDiv({ + cls: "mk-floweditor mk-hover-popover", + attr: { id: "he" + this.id } + }); + if (waitTime === void 0) { + waitTime = 300; + } + this.onTarget = true; + this.parent = parent; + this.waitTime = waitTime; + this.state = import_obsidian29.PopoverState.Showing; + const { hoverEl } = this; + this.abortController.load(); + this.timer = window.setTimeout(this.show.bind(this), waitTime); + this.setActive = this._setActive.bind(this); + if (hoverEl) { + hoverEl.addEventListener("mousedown", this.setActive); + hoverEl.addEventListener("mousedown", (e4) => e4.stopPropagation()); + } + popovers.set(this.hoverEl, this); + this.hoverEl.addClass("hover-editor"); + this.containerEl = this.hoverEl.createDiv("popover-content"); + this.setTitleBar(); + this.hoverEl.style.height = "auto"; + this.hoverEl.style.width = "100%"; + this.hoverEl.addEventListener("keydown", (e4) => e4.stopPropagation()); + } + static activeWindows() { + const windows = [window]; + const { floatingSplit } = app.workspace; + if (floatingSplit) { + for (const split of floatingSplit.children) { + if (split.win) + windows.push(split.win); + } + } + return windows; + } + static containerForDocument(doc) { + if (doc !== document && app.workspace.floatingSplit) + for (const container of app.workspace.floatingSplit.children) { + if (container.doc === doc) + return container; + } + return app.workspace.rootSplit; + } + static activePopovers() { + return this.activeWindows().flatMap(this.popoversForWindow); + } + static popoversForWindow(win) { + var _a2, _b2; + return Array.prototype.slice.call( + (_b2 = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.body.querySelectorAll(".mk-hover-popover")) != null ? _b2 : [] + ).map((el) => popovers.get(el)).filter((he) => he); + } + static forLeaf(leaf) { + const el = leaf && document.body.matchParent.call(leaf.containerEl, ".mk-hover-popover"); + return el ? popovers.get(el) : void 0; + } + _setActive() { + this.plugin.app.workspace.setActiveLeaf(this.leaves()[0], { focus: true }); + } + getDefaultMode() { + var _a2, _b2; + return ((_b2 = (_a2 = this.parent) == null ? void 0 : _a2.view) == null ? void 0 : _b2.getMode) ? this.parent.view.getMode() : "preview"; + } + updateLeaves() { + if (this.onTarget && this.targetEl && !this.document.contains(this.targetEl)) { + this.onTarget = false; + this.transition(); + } + let leafCount = 0; + this.plugin.app.workspace.iterateLeaves((leaf) => { + leafCount++; + }, this.rootSplit); + if (leafCount === 0) { + this.hide(); + } else if (leafCount > 1) { + } + this.hoverEl.setAttribute("data-leaf-count", leafCount.toString()); + } + setTitleBar() { + this.titleEl = this.document.defaultView.createDiv("mk-flow-titlebar"); + this.containerEl.prepend(this.titleEl); + } + attachLeaf() { + this.rootSplit.getRoot = () => this.plugin.app.workspace[this.document === document ? "rootSplit" : "floatingSplit"]; + this.rootSplit.getContainer = () => FlowEditor.containerForDocument(this.document); + this.titleEl.insertAdjacentElement("afterend", this.rootSplit.containerEl); + let leaf = this.plugin.app.workspace.createLeafInParent(this.rootSplit, 0); + leaf.isFlowBlock = true; + this.updateLeaves(); + return leaf; + } + onload() { + super.onload(); + this.registerEvent( + this.plugin.app.workspace.on("layout-change", this.updateLeaves, this) + ); + this.registerEvent( + app.workspace.on("layout-change", () => { + this.rootSplit.children.forEach((item, index) => { + if (item instanceof import_obsidian29.WorkspaceTabs) { + this.rootSplit.replaceChild(index, item.children[0]); + } + }); + }) + ); + } + leaves() { + const leaves = []; + this.plugin.app.workspace.iterateLeaves((leaf) => { + leaves.push(leaf); + }, this.rootSplit); + return leaves; + } + async onShow() { + var _a2, _b2; + const closeDelay = 600; + setTimeout(() => this.waitTime = closeDelay, closeDelay); + (_a2 = this.oldPopover) == null ? void 0 : _a2.hide(); + this.oldPopover = null; + this.hoverEl.toggleClass("is-new", true); + this.document.body.addEventListener( + "click", + () => { + this.hoverEl.toggleClass("is-new", false); + }, + { once: true, capture: true } + ); + if (this.parent) { + this.parent.flowEditor = this; + } + await ((_b2 = this.onShowCallback) == null ? void 0 : _b2.call(this, this)); + this.onShowCallback = void 0; + const viewHeaderEl = this.hoverEl.querySelector(".view-header"); + viewHeaderEl == null ? void 0 : viewHeaderEl.remove(); + const sizer = this.hoverEl.querySelector(".workspace-leaf"); + if (sizer) + this.hoverEl.appendChild(sizer); + const inlineTitle = this.hoverEl.querySelector(".inline-title"); + inlineTitle == null ? void 0 : inlineTitle.remove(); + } + transition() { + if (this.shouldShow()) { + if (this.state === import_obsidian29.PopoverState.Hiding) { + this.state = import_obsidian29.PopoverState.Shown; + clearTimeout(this.timer); + } + } else { + if (this.state === import_obsidian29.PopoverState.Showing) { + this.hide(); + } else { + if (this.state === import_obsidian29.PopoverState.Shown) { + this.state = import_obsidian29.PopoverState.Hiding; + this.timer = window.setTimeout(() => { + if (this.shouldShow()) { + this.transition(); + } else { + this.hide(); + } + }, this.waitTime); + } + } + } + } + shouldShow() { + return this.shouldShowSelf() || this.shouldShowChild(); + } + shouldShowChild() { + return FlowEditor.activePopovers().some((popover) => { + if (popover !== this && popover.targetEl && this.hoverEl.contains(popover.targetEl)) { + return popover.shouldShow(); + } + return false; + }); + } + shouldShowSelf() { + return !this.detaching && !!(this.onTarget || this.state == import_obsidian29.PopoverState.Shown || this.document.querySelector( + `body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container` + )); + } + show() { + if (!this.targetEl || this.document.body.contains(this.targetEl)) { + this.state = import_obsidian29.PopoverState.Shown; + this.timer = 0; + this.shownPos = mouseCoords; + this.targetEl.replaceChildren(this.hoverEl); + this.onShow(); + app.workspace.onLayoutChange(); + this.load(); + } else { + this.hide(); + } + } + onHide() { + var _a2; + this.oldPopover = null; + if (((_a2 = this.parent) == null ? void 0 : _a2.flowEditor) === this) { + this.parent.flowEditor = null; + } + } + hide() { + var _a2; + this.onTarget = false; + this.detaching = true; + if (this.timer) { + clearTimeout(this.timer); + this.timer = 0; + } + this.hoverEl.hide(); + if (this.opening) + return; + const leaves = this.leaves(); + if (leaves.length) { + leaves.forEach((leaf) => leaf.detach()); + } else { + this.parent = null; + (_a2 = this.abortController) == null ? void 0 : _a2.unload(); + this.abortController = void 0; + return this.nativeHide(); + } + } + nativeHide() { + var _a2; + const { hoverEl, targetEl } = this; + this.state = import_obsidian29.PopoverState.Hidden; + hoverEl.detach(); + if (targetEl) { + const parent = targetEl.matchParent(".mk-hover-popover"); + if (parent) + (_a2 = popovers.get(parent)) == null ? void 0 : _a2.transition(); + } + this.onHide(); + this.unload(); + } + resolveLink(linkText, sourcePath) { + const link = (0, import_obsidian29.parseLinktext)(linkText); + const tFile = link ? this.plugin.app.metadataCache.getFirstLinkpathDest( + link.path, + sourcePath != null ? sourcePath : "" + ) : null; + return tFile; + } + async openContext(file, openState, useLeaf) { + if (this.detaching) + return; + const leaf = useLeaf != null ? useLeaf : this.attachLeaf(); + this.opening = true; + try { + await leaf.openFile(file, openState); + } catch (e4) { + console.error(e4); + } finally { + this.opening = false; + if (this.detaching) + this.hide(); + } + return leaf; + } + async openFile(file, openState, useLeaf) { + if (this.detaching) + return; + const leaf = useLeaf != null ? useLeaf : this.attachLeaf(); + this.opening = true; + try { + await leaf.openFile(file, openState); + } catch (e4) { + console.error(e4); + } finally { + this.opening = false; + if (this.detaching) + this.hide(); + } + return leaf; } - function getNextContainerId() { - const containeIds = Object.keys(items); - const lastContaineId = containeIds[containeIds.length - 1]; - return String.fromCharCode(lastContaineId.charCodeAt(0) + 1); + buildState(parentMode, eState) { + return { + active: false, + state: {}, + eState + }; } -}; -function getColor(id2) { - switch (id2[0]) { - case "A": - return "#7193f1"; - case "B": - return "#ffda6c"; - case "C": - return "#00bcd4"; - case "D": - return "#ef769f"; + buildEphemeralState(file, link) { + const cache = this.plugin.app.metadataCache.getFileCache(file); + const subpath = cache ? (0, import_obsidian29.resolveSubpath)(cache, (link == null ? void 0 : link.subpath) || "") : void 0; + const eState = { subpath: link == null ? void 0 : link.subpath }; + if (subpath) { + eState.line = subpath.start.line; + eState.startLoc = subpath.start; + eState.endLoc = subpath.end || void 0; + } + return eState; } - return void 0; -} -function SortableItem2({ - disabled, - id: id2, - plugin, - index, - handle, - renderItem, - style, - containerId, - onSelect, - selected, - getIndex, - cols, - value, - wrapperStyle -}) { - const { - setNodeRef, - listeners, - isDragging, - isSorting, - over, - overIndex, - transform, - transition - } = useSortable({ - id: id2 - }); - const mounted = useMountStatus(); - const mountedWhileDragging = isDragging && !mounted; - return /* @__PURE__ */ Cn.createElement(CardView, { - ref: disabled ? void 0 : setNodeRef, - value, - plugin, - id: id2, - cols, - dragging: isDragging, - sorting: isSorting, - handle, - index, - wrapperStyle: wrapperStyle({ index }), - style: style({ - index, - value: id2, - isDragging, - isSorting, - overIndex: over ? getIndex(over.id) : overIndex, - containerId - }), - onSelect, - selected, - color: getColor(id2), - transition, - transform, - fadeIn: mountedWhileDragging, - listeners, - renderItem - }); -} -function useMountStatus() { - const [isMounted, setIsMounted] = h2(false); - p2(() => { - const timeout = setTimeout(() => setIsMounted(true), 500); - return () => clearTimeout(timeout); - }, []); - return isMounted; -} - -// src/components/ContextView/FlowListView/FlowListView.tsx -var import_obsidian29 = require("obsidian"); -var FlowListView = (props2) => { - const { filteredData: data } = q2(MDBContext); - const flowItems = F2(() => { - return data.map((f4) => getAbstractFileAtPath(app, f4.File)).filter((f4) => f4 instanceof import_obsidian29.TFile && f4.extension == "md"); - }, [data]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-flow-container" - }, flowItems.map((f4) => /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("span", null, fileNameToString(f4.name)), /* @__PURE__ */ Cn.createElement(FlowView, { - plugin: props2.plugin, - path: f4.path, - load: true - })))); }; -// src/components/ContextView/ContextListView.tsx -var ContextListView = (props2) => { - const { schema } = q2(MDBContext); - const [error, resetError] = P2(); - if (error) - console.log(error); - return schema ? schema.type == "flow" ? /* @__PURE__ */ Cn.createElement(FlowListView, { - plugin: props2.plugin - }) : schema.type == "table" ? /* @__PURE__ */ Cn.createElement(TableView, { - plugin: props2.plugin - }) : /* @__PURE__ */ Cn.createElement(CardsView, { - plugin: props2.plugin - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); +// src/utils/flow/flowEditor.ts +var import_obsidian30 = require("obsidian"); +var parseOutReferences = (ostr) => { + const str = ostr.split("|")[0]; + const refIndex = str.lastIndexOf("#"); + return refIndex > 0 ? [str.substring(0, refIndex), str.substring(refIndex + 1)] : [str, void 0]; }; - -// src/components/ContextView/EmbedContextViewComponent.tsx -var EmbedContextViewComponent = (props2) => { - const context = mdbContextByPath(props2.plugin, props2.path); - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, context && /* @__PURE__ */ Cn.createElement(MDBProvider, { - plugin: props2.plugin, - context, - schema: props2.schema - }, /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(ContextListView, { - plugin: props2.plugin - })))); +var getFileFromString = (url, source) => { + return app.metadataCache.getFirstLinkpathDest(url, source != null ? source : ""); }; - -// src/components/ContextView/EmbedContextView.tsx -var EMBED_CONTEXT_VIEW_TYPE = "make-inline-context"; -var EmbedContextView = class extends import_obsidian30.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.navigation = true; - this.plugin = plugin; +var getLineRangeFromRef = (file, ref, plugin) => { + var _a2; + if (!ref) { + return [void 0, void 0]; } - getViewType() { - return EMBED_CONTEXT_VIEW_TYPE; + const cache = app.metadataCache.getFileCache(file); + const headings = cache.headings; + const blocks = cache.blocks; + const sections = cache.sections; + if (blocks && ref.charAt(0) == "^" && blocks[ref.substring(1)]) { + return [ + blocks[ref.substring(1)].position.start.line + 1, + blocks[ref.substring(1)].position.end.line + 1 + ]; } - getDisplayText() { - return this.contextPath; + const heading = headings == null ? void 0 : headings.find((f4) => f4.heading.replace("#", " ") == ref); + if (heading) { + const index = headings.findIndex((f4) => f4.heading == heading.heading); + const level = (_a2 = headings[index]) == null ? void 0 : _a2.level; + const nextIndex2 = headings.findIndex( + (f4, i4) => i4 > index && f4.level <= level + ); + const start = plugin.settings.editorFlowStyle == "classic" ? heading.position.start.line + 1 : heading.position.start.line + 2; + if (index < headings.length - 1 && nextIndex2 != -1) { + return [start, headings[nextIndex2].position.end.line]; + } + return [start, sections[sections.length - 1].position.end.line + 1]; } - async onClose() { - this.destroy(); + return [void 0, void 0]; +}; +var loadFlowEditorByDOM2 = (make, el, view, id2) => { + setTimeout(async () => { + let counter = 0; + while (!el.parentElement && counter++ <= 50) + await sleep(50); + if (!el.parentElement) + return; + let dom = el; + while (!dom.hasClass("mk-floweditor") && !dom.hasClass("workspace") && dom.parentElement) { + dom = dom.parentElement; + } + if (!dom.hasClass("mk-floweditor") && !dom.hasClass("workspace") && !(dom.nodeName == "HTML")) { + return; + } + setTimeout(async () => { + var _a2, _b2, _c2; + let leafFound = false; + if (app.workspace.activeEditor) { + if (((_b2 = (_a2 = app.workspace.activeEditor) == null ? void 0 : _a2.editor) == null ? void 0 : _b2.cm.dom) == view.dom) { + leafFound = true; + loadFlowEditorsForLeafForID( + app.workspace.activeEditor.editor.cm, + (_c2 = app.workspace.activeEditor.file) == null ? void 0 : _c2.path, + make, + id2 + ); + } + } + if (!leafFound) { + app.workspace.iterateLeaves((leaf) => { + var _a3, _b3; + const cm = (_a3 = leaf.view.editor) == null ? void 0 : _a3.cm; + if (cm && view.dom == cm.dom) { + leafFound = true; + loadFlowEditorsForLeafForID( + cm, + (_b3 = leaf.view.file) == null ? void 0 : _b3.path, + make, + id2 + ); + } + }, app.workspace["rootSplit"]); + } + }); + }); +}; +var loadFlowEditorsForLeafForID = (cm, source, make, id2) => { + const stateField = cm.state.field(flowEditorInfo, false); + if (!stateField) + return; + const flowInfo = stateField.find((f4) => f4.id == id2); + if (flowInfo && flowInfo.expandedState == 2) { + loadFlowEditor(cm, flowInfo, source, make); } - destroy() { - if (this.root) - this.root.unmount(); +}; +var loadFlowEditor = (cm, flowEditorInfo2, source, make) => { + const dom = cm.dom.querySelector( + "#mk-flow-" + flowEditorInfo2.id + ); + const { path, type, ref } = pathByString(flowEditorInfo2.link, source); + if (dom) { + if (type == "folder" || type == "tag" || type == "space") { + const context = mdbContextByPath( + make, + path + ); + if (!dom.hasAttribute("ready")) { + dom.setAttribute("ready", ""); + createFlowEditorInElement( + flowEditorInfo2.id, + dom, + "context", + context.contextPath, + ref + ); + return; + } + } else if (type == "file") { + const file = getFileFromString(path, source); + const aFile = getAbstractFileAtPath(app, path); + if (file) { + const selectiveRange = getLineRangeFromRef(file, ref, make); + if (!dom.hasAttribute("ready")) { + dom.setAttribute("ready", ""); + createFlowEditorInElement( + flowEditorInfo2.id, + dom, + ref ? "block" : "flow", + file.path, + ref, + selectiveRange[0], + selectiveRange[1] + ); + } + } else { + if (aFile instanceof import_obsidian30.TFolder) { + if (!dom.hasAttribute("ready")) { + dom.setAttribute("ready", ""); + createFlowEditorInElement( + flowEditorInfo2.id, + dom, + ref ? "block" : "flow", + path + ); + } + return; + } + dom.empty(); + const createDiv = dom.createDiv("file-embed"); + createDiv.toggleClass("mod-empty", true); + const createFile = async (e4) => { + e4.stopPropagation(); + e4.stopImmediatePropagation(); + await app.fileManager.createNewMarkdownFile(app.vault.getRoot(), path); + loadFlowEditor(cm, flowEditorInfo2, source, make); + }; + createDiv.setText(`"${path}" ` + i18n_default.labels.noFile); + createDiv.addEventListener("click", createFile); + } + } } - async onOpen() { - this.destroy(); +}; +var focusPortal = async (plugin, evt) => { + const { id: id2, parent, top } = evt.detail; + if (parent) { + app.workspace.iterateLeaves((leaf) => { + var _a2; + const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; + if (cm) { + const stateField = cm.state.field(flowEditorInfo, false); + if (stateField) { + const foundInfo = stateField.find((f4) => f4.id == id2); + if (foundInfo) { + cm.focus(); + if (top) { + cm.dispatch({ + selection: import_state5.EditorSelection.single(foundInfo.from - 4), + annotations: arrowKeyAnnotation.of(1) + }); + } else { + if (foundInfo.to + 2 == cm.state.doc.length) { + cm.dispatch({ + changes: [ + { + from: foundInfo.to + 2, + to: foundInfo.to + 2, + insert: cm.state.lineBreak + } + ], + selection: import_state5.EditorSelection.single(foundInfo.to + 3), + annotations: arrowKeyAnnotation.of(2) + }); + } else { + cm.dispatch({ + selection: import_state5.EditorSelection.single(foundInfo.to + 3), + annotations: arrowKeyAnnotation.of(2) + }); + } + } + } + } + } + }, app.workspace["rootSplit"]); + } else { + app.workspace.iterateLeaves((leaf) => { + var _a2; + const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; + if (cm) { + const stateField = cm.state.field(flowIDStateField, false); + if (stateField && stateField == id2) { + cm.focus(); + const lineRange = cm.state.field(selectiveLinesFacet, false); + const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(cm.state, lineRange) : { from: 0, to: cm.state.doc.length }; + if (top) { + cm.dispatch({ + selection: import_state5.EditorSelection.single(posRange.from) + }); + } else { + cm.dispatch({ + selection: import_state5.EditorSelection.single(posRange.to) + }); + } + } + } + }, app.workspace["rootSplit"]); } - async setState(state, result) { - this.contextPath = state.contextPath; - this.ref = state.ref ? state.ref.substring(1, state.ref.length) : null; - this.constructInlineContext(this.contextPath); - await super.setState(state, result); - const context = mdbContextByPath(this.plugin, this.contextPath); - const title = contextDisplayName(context); - 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; +}; +var openFileFromPortal = (plugin, evt) => { + const { file: fullLink, source } = evt.detail; + const [link, ref] = parseOutReferences(fullLink); + const file = getFileFromString(link, source); + openAFile(file, plugin, false); +}; +var spawnLeafFromFile = async (plugin, file, el, type, ref, from, to, onLeafAttachCallback) => { + if (type == "context") { + spawnPortal(plugin, el, null, async (editor) => { + const newLeaf = editor.attachLeaf(); + await newLeaf.setViewState({ + type: EMBED_CONTEXT_VIEW_TYPE, + state: { contextPath: file, ref } + }); + if (onLeafAttachCallback) + onLeafAttachCallback(newLeaf); + }); + } + const portalFile = plugin.app.vault.getAbstractFileByPath(file); + if (!portalFile || !Object.keys(app.embedRegistry.embedByExtension).some( + (f4) => f4 == portalFile.extension + )) + return null; + spawnPortal(plugin, el, portalFile.name, async (editor) => { + return editor.openFile(portalFile, { active: false }).then((newLeaf) => { + var _a2; + if (newLeaf.view.setMode) + newLeaf.view.setMode(newLeaf.view.editMode); + if (from && to) { + (_a2 = newLeaf.view.editor) == null ? void 0 : _a2.cm.dispatch({ + annotations: [editableRange.of([from, to])] + }); + if (onLeafAttachCallback) + onLeafAttachCallback(newLeaf); + } + }); + }); +}; +var spawnNewPortal = async (plugin, evt) => { + const { file, el, ref, from, to, type } = evt.detail; + spawnLeafFromFile(plugin, file, el, type, ref, from, to, (newLeaf) => { + var _a2, _b2, _c2; + if (!((_a2 = newLeaf == null ? void 0 : newLeaf.view) == null ? void 0 : _a2.editor)) { + return; + } + const view = (_b2 = newLeaf.view.editor) == null ? void 0 : _b2.cm; + view.dispatch({ + annotations: [ + portalTypeAnnotation.of(evt.detail.type), + flowIDAnnotation.of(evt.detail.id) + ] + }); + view.dom.addEventListener("keydown", (e4) => { + if (e4.key == "ArrowUp") { + if (e4.metaKey == true) { + view.dispatch({ + annotations: arrowKeyAnnotation.of(3) + }); + } else { + view.dispatch({ + annotations: arrowKeyAnnotation.of(1) + }); + } + } + if (e4.key == "ArrowDown") { + if (e4.metaKey == true) { + view.dispatch({ + annotations: arrowKeyAnnotation.of(4) + }); + } else { + view.dispatch({ + annotations: arrowKeyAnnotation.of(2) + }); + } + } + }); + if (from && to) { + (_c2 = newLeaf.view.editor) == null ? void 0 : _c2.cm.dispatch({ + annotations: [editableRange.of([from, to])] + }); } - return; - } - getState() { - let state = super.getState(); - state.contextPath = this.contextPath; - return state; - } - constructInlineContext(file) { - this.destroy(); - this.root = createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(EmbedContextViewComponent, { - plugin: this.plugin, - path: this.contextPath, - schema: this.ref - })) + }); +}; +var spawnPortal = (plugin, initiatingEl, fileName, onShowCallback) => { + const parent = plugin.app.workspace.activeLeaf; + if (!initiatingEl) + initiatingEl = parent.containerEl; + const hoverPopover = new FlowEditor( + parent, + initiatingEl, + plugin, + void 0, + onShowCallback + ); + if (fileName) + hoverPopover.titleEl.textContent = fileName.substring( + 0, + fileName.lastIndexOf(".") ); - } }; -// src/components/FlowEditor/FlowEditor.tsx -var import_obsidian31 = require("obsidian"); -var popovers = /* @__PURE__ */ new WeakMap(); -var mouseCoords = { x: 0, y: 0 }; -function nosuper(base) { - const derived = function() { - return Object.setPrototypeOf(new import_obsidian31.Component(), new.target.prototype); - }; - derived.prototype = base.prototype; - return Object.setPrototypeOf(derived, base); -} -var _a, _b, _c, _d, _e; -var FlowEditor = class extends nosuper(import_obsidian31.HoverPopover) { - constructor(parent, targetEl, plugin, waitTime, onShowCallback) { - super(); - this.targetEl = targetEl; - this.plugin = plugin; - this.onShowCallback = onShowCallback; - this.abortController = this.addChild(new import_obsidian31.Component()); - this.detaching = false; - this.opening = false; - this.rootSplit = new import_obsidian31.WorkspaceSplit( - window.app.workspace, - "vertical" +// src/components/ContextView/DataTypeView/LinkCell.tsx +var LinkCell = (props2) => { + var _a2; + const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); + const stringValueToLink = (strings) => strings.map((f4) => { + return { + label: parseLinkDisplayString(f4), + value: parseLinkString(f4) + }; + }); + p2(() => { + var _a3; + setValue( + resolveLinks( + stringValueToLink( + props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue] + ) + ) ); - this.targetRect = (_a = this.targetEl) == null ? void 0 : _a.getBoundingClientRect(); - this.oldPopover = (_b = this.parent) == null ? void 0 : _b.flowEditor; - this.document = (_e = (_d = (_c = this.targetEl) == null ? void 0 : _c.ownerDocument) != null ? _d : window.activeDocument) != null ? _e : window.document; - this.id = genId(); - this.hoverEl = this.document.defaultView.createDiv({ - cls: "mk-floweditor mk-hover-popover", - attr: { id: "he" + this.id } - }); - if (waitTime === void 0) { - waitTime = 300; + }, [props2.initialValue]); + const resolveLinks = (links) => links.map((f4) => ({ + value: f4.value, + label: filePathToString(f4.value), + file: getFileFromString(f4.value, getFolderPathFromString(props2.file)) + })); + const ref = _2(null); + const [value, setValue] = h2( + resolveLinks(stringValueToLink(initialValue)) + ); + const removeValue = (v3) => { + const newValues = value.filter((f4) => f4.value != v3.value); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues.map((f4) => f4.value))); + }; + const saveOptions = (_9, _value) => { + if (!props2.multi) { + setValue(resolveLinks(stringValueToLink(_value))); + props2.saveValue(serializeMultiString(_value)); + } else { + const newValue = _value[0]; + if (newValue) { + const newValues = uniq([...value.map((f4) => f4.value), newValue]); + setValue(resolveLinks(stringValueToLink(newValues))); + props2.saveValue(serializeMultiString(newValues)); + } } - this.onTarget = true; - this.parent = parent; - this.waitTime = waitTime; - this.state = import_obsidian31.PopoverState.Showing; - const { hoverEl } = this; - this.abortController.load(); - this.timer = window.setTimeout(this.show.bind(this), waitTime); - this.setActive = this._setActive.bind(this); - if (hoverEl) { - hoverEl.addEventListener("mousedown", this.setActive); - hoverEl.addEventListener("mousedown", (e4) => e4.stopPropagation()); + }; + const menuProps = () => { + const options = getAllAbstractFilesInVault(props2.plugin, app).map((f4) => ({ + name: fileNameToString(f4.name), + value: f4.path, + description: f4.path + })); + const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; + return { + multi: false, + editable: true, + value: value.map((f4) => f4.value), + options: _options, + saveOptions, + placeholder: i18n_default.labels.linkItemSelectPlaceholder, + detail: true, + searchable: true + }; + }; + const openLink = async (o3) => { + if (o3.file) { + openTFile(o3.file, props2.plugin, false); + } else { + const file = await app.fileManager.createNewMarkdownFile( + app.vault.getRoot(), + o3.value + ); + openTFile(file, props2.plugin, false); + setValue(resolveLinks(value)); } - popovers.set(this.hoverEl, this); - this.hoverEl.addClass("hover-editor"); - this.containerEl = this.hoverEl.createDiv("popover-content"); - this.setTitleBar(); - this.hoverEl.style.height = "auto"; - this.hoverEl.style.width = "100%"; - this.hoverEl.addEventListener("keydown", (e4) => e4.stopPropagation()); - } - static activeWindows() { - const windows = [window]; - const { floatingSplit } = app.workspace; - if (floatingSplit) { - for (const split of floatingSplit.children) { - if (split.win) - windows.push(split.win); + }; + return /* @__PURE__ */ Cn.createElement(OptionCellBase, { + baseClass: "mk-cell-link", + menuProps, + getLabelString: (o3) => o3.label, + valueClass: (o3) => o3.file ? "mk-cell-link-item" : "mk-cell-link-unresolved", + openItem: openLink, + value, + multi: props2.multi, + editMode: props2.editMode, + removeValue + }); +}; + +// src/components/ContextView/DataTypeView/TagCell.tsx +var TagCell = (props2) => { + var _a2; + const initialValue = ((_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : []).filter( + (f4) => (f4 == null ? void 0 : f4.length) > 0 + ); + const [value, setValue] = h2(initialValue); + p2(() => { + var _a3; + setValue((_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : []); + }, [props2.initialValue]); + const removeValue = (v3) => { + const newValues = value.filter((f4) => f4 != v3); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues)); + }; + const saveOptions = (_options, _value) => { + if (!props2.multi) { + setValue(_value); + props2.saveValue(serializeMultiString(_value)); + } else { + const newValue = _value[0]; + if (newValue) { + const newValues = uniq([...value, newValue]); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues)); } } - return windows; - } - static containerForDocument(doc) { - if (doc !== document && app.workspace.floatingSplit) - for (const container of app.workspace.floatingSplit.children) { - if (container.doc === doc) - return container; - } - return app.workspace.rootSplit; - } - static activePopovers() { - return this.activeWindows().flatMap(this.popoversForWindow); - } - static popoversForWindow(win) { - var _a2, _b2; - return Array.prototype.slice.call( - (_b2 = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.body.querySelectorAll(".mk-hover-popover")) != null ? _b2 : [] - ).map((el) => popovers.get(el)).filter((he) => he); - } - static forLeaf(leaf) { - const el = leaf && document.body.matchParent.call(leaf.containerEl, ".mk-hover-popover"); - return el ? popovers.get(el) : void 0; - } - _setActive() { - this.plugin.app.workspace.setActiveLeaf(this.leaves()[0], { focus: true }); - } - getDefaultMode() { - var _a2, _b2; - return ((_b2 = (_a2 = this.parent) == null ? void 0 : _a2.view) == null ? void 0 : _b2.getMode) ? this.parent.view.getMode() : "preview"; - } - updateLeaves() { - if (this.onTarget && this.targetEl && !this.document.contains(this.targetEl)) { - this.onTarget = false; - this.transition(); + }; + const menuProps = () => { + const options = loadTags(props2.plugin).map((f4) => ({ + name: f4, + value: f4 + })); + const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; + return { + multi: false, + editable: true, + value, + options: _options, + saveOptions, + placeholder: i18n_default.labels.tagItemSelectPlaceholder, + searchable: true, + showAll: true, + onHide: () => props2.setEditMode(null) + }; + }; + return /* @__PURE__ */ Cn.createElement(OptionCellBase, { + baseClass: "mk-cell-tag", + menuProps, + value, + multi: props2.multi, + editMode: props2.editMode, + removeValue + }); +}; + +// src/components/ContextView/TableView/TableView.tsx +var TableView = (props2) => { + const { + selectedRows, + selectRows, + tableData, + sortedColumns: cols, + filteredData: data, + contextInfo, + readMode, + dbSchema, + contextTable, + predicate, + savePredicate, + saveDB: saveDB2, + updateFieldValue, + updateValue: updateValue2 + } = q2(MDBContext); + const [activeId, setActiveId] = h2(null); + const [lastSelectedIndex, setLastSelectedIndex] = h2(null); + const [selectedColumn, setSelectedColumn] = h2(null); + const [currentEdit, setCurrentEdit] = h2(null); + const [overId, setOverId] = h2(null); + const [openFlows, setOpenFlows] = h2([]); + const [colsSize, setColsSize] = h2({}); + const ref = _2(null); + p2(() => { + setColsSize({ ...predicate.colsSize, "+": 30 }); + }, [predicate]); + p2(() => { + setCurrentEdit(null); + }, [selectedColumn, lastSelectedIndex]); + p2(() => { + if (currentEdit == null) { + ref.current.focus(); } - let leafCount = 0; - this.plugin.app.workspace.iterateLeaves((leaf) => { - leafCount++; - }, this.rootSplit); - if (leafCount === 0) { - this.hide(); - } else if (leafCount > 1) { + }, [currentEdit]); + const saveColsSize = (colSize) => { + const newColSize = colSize(colsSize); + setColsSize(newColSize); + debouncedSavePredicate(newColSize); + }; + const debouncedSavePredicate = T2( + (0, import_lodash6.debounce)( + (nextValue) => savePredicate({ + ...predicate, + colsSize: nextValue + }), + 1e3 + ), + [predicate] + ); + const newRow = (index, data2) => { + saveDB2(createNewRow(tableData, { File: "", ...data2 != null ? data2 : {} }, index)); + }; + const deleteRow = (rowIndex) => { + const row = tableData.rows.find((f4, i4) => i4 == rowIndex); + if (getAbstractFileAtPath(app, row.File)) { + deleteFile(props2.plugin, getAbstractFileAtPath(app, row.File)); } - this.hoverEl.setAttribute("data-leaf-count", leafCount.toString()); - } - setTitleBar() { - this.titleEl = this.document.defaultView.createDiv("mk-flow-titlebar"); - this.containerEl.prepend(this.titleEl); - } - attachLeaf() { - this.rootSplit.getRoot = () => this.plugin.app.workspace[this.document === document ? "rootSplit" : "floatingSplit"]; - this.rootSplit.getContainer = () => FlowEditor.containerForDocument(this.document); - this.titleEl.insertAdjacentElement("afterend", this.rootSplit.containerEl); - let leaf = this.plugin.app.workspace.createLeafInParent(this.rootSplit, 0); - leaf.isFlowBlock = true; - this.updateLeaves(); - return leaf; - } - onload() { - super.onload(); - this.registerEvent( - this.plugin.app.workspace.on("layout-change", this.updateLeaves, this) - ); - this.registerEvent( - app.workspace.on("layout-change", () => { - this.rootSplit.children.forEach((item, index) => { - if (item instanceof import_obsidian31.WorkspaceTabs) { - this.rootSplit.replaceChild(index, item.children[0]); - } - }); - }) - ); - } - leaves() { - const leaves = []; - this.plugin.app.workspace.iterateLeaves((leaf) => { - leaves.push(leaf); - }, this.rootSplit); - return leaves; - } - async onShow() { - var _a2, _b2; - const closeDelay = 600; - setTimeout(() => this.waitTime = closeDelay, closeDelay); - (_a2 = this.oldPopover) == null ? void 0 : _a2.hide(); - this.oldPopover = null; - this.hoverEl.toggleClass("is-new", true); - this.document.body.addEventListener( - "click", - () => { - this.hoverEl.toggleClass("is-new", false); - }, - { once: true, capture: true } - ); - if (this.parent) { - this.parent.flowEditor = this; + if (row) { + saveDB2({ + ...tableData, + rows: tableData.rows.filter((f4, i4) => i4 != rowIndex) + }); } - await ((_b2 = this.onShowCallback) == null ? void 0 : _b2.call(this, this)); - this.onShowCallback = void 0; - const viewHeaderEl = this.hoverEl.querySelector(".view-header"); - viewHeaderEl == null ? void 0 : viewHeaderEl.remove(); - const sizer = this.hoverEl.querySelector(".workspace-leaf"); - if (sizer) - this.hoverEl.appendChild(sizer); - const inlineTitle = this.hoverEl.querySelector(".inline-title"); - inlineTitle == null ? void 0 : inlineTitle.remove(); - } - transition() { - if (this.shouldShow()) { - if (this.state === import_obsidian31.PopoverState.Hiding) { - this.state = import_obsidian31.PopoverState.Shown; - clearTimeout(this.timer); - } - } else { - if (this.state === import_obsidian31.PopoverState.Showing) { - this.hide(); - } else { - if (this.state === import_obsidian31.PopoverState.Shown) { - this.state = import_obsidian31.PopoverState.Hiding; - this.timer = window.setTimeout(() => { - if (this.shouldShow()) { - this.transition(); - } else { - this.hide(); - } - }, this.waitTime); - } - } + }; + const toggleFlow = (path) => { + setOpenFlows( + (f4) => f4.find((p3) => p3 == path) ? f4.filter((p3) => p3 != path) : uniq([...f4, path]) + ); + }; + const selectItem = (modifier, index) => { + if (modifier == 3) { + const file = getAbstractFileAtPath( + app, + tableData.rows[parseInt(index)].File + ); + if (file) + openAFile(file, props2.plugin, false); + return; } - } - shouldShow() { - return this.shouldShowSelf() || this.shouldShowChild(); - } - shouldShowChild() { - return FlowEditor.activePopovers().some((popover) => { - if (popover !== this && popover.targetEl && this.hoverEl.contains(popover.targetEl)) { - return popover.shouldShow(); - } - return false; - }); - } - shouldShowSelf() { - return !this.detaching && !!(this.onTarget || this.state == import_obsidian31.PopoverState.Shown || this.document.querySelector( - `body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container` - )); - } - show() { - if (!this.targetEl || this.document.body.contains(this.targetEl)) { - this.state = import_obsidian31.PopoverState.Shown; - this.timer = 0; - this.shownPos = mouseCoords; - this.targetEl.replaceChildren(this.hoverEl); - this.onShow(); - app.workspace.onLayoutChange(); - this.load(); + if (modifier == 2) { + selectedRows.some((f4) => f4 == index) ? selectRows( + null, + selectedRows.filter((f4) => f4 != index) + ) : selectRows(index, uniq([...selectedRows, index])); + } else if (modifier == 1) { + selectRows( + index, + uniq([ + ...selectedRows, + ...selectRange( + lastSelectedIndex, + index, + data.map((f4) => f4._index) + ) + ]) + ); } else { - this.hide(); + selectRows(index, [index]); } - } - onHide() { - var _a2; - this.oldPopover = null; - if (((_a2 = this.parent) == null ? void 0 : _a2.flowEditor) === this) { - this.parent.flowEditor = null; + setLastSelectedIndex(index); + }; + const onKeyDown = (e4) => { + const setCellValue = (value) => { + var _a2; + const columnTuple = selectedColumn.split("#"); + updateValue2( + columnTuple[0], + value, + (_a2 = columnTuple[1]) != null ? _a2 : "", + parseInt(lastSelectedIndex), + "" + ); + }; + const clearCell = () => { + setCellValue(""); + }; + const copyCell = () => { + navigator.clipboard.writeText( + tableData.rows[parseInt(lastSelectedIndex)][selectedColumn] + ); + }; + const nextRow = () => { + const newIndex = selectNextIndex( + lastSelectedIndex, + data.map((f4) => f4._index) + ); + selectRows(newIndex, [newIndex]); + setLastSelectedIndex(newIndex); + }; + const lastRow = () => { + const newIndex = selectPrevIndex( + lastSelectedIndex, + data.map((f4) => f4._index) + ); + selectRows(newIndex, [newIndex]); + setLastSelectedIndex(newIndex); + }; + if (e4.key == "c" && e4.metaKey) { + copyCell(); } - } - hide() { - var _a2; - this.onTarget = false; - this.detaching = true; - if (this.timer) { - clearTimeout(this.timer); - this.timer = 0; + if (e4.key == "x" && e4.metaKey) { + copyCell(); + clearCell(); } - this.hoverEl.hide(); - if (this.opening) - return; - const leaves = this.leaves(); - if (leaves.length) { - leaves.forEach((leaf) => leaf.detach()); - } else { - this.parent = null; - (_a2 = this.abortController) == null ? void 0 : _a2.unload(); - this.abortController = void 0; - return this.nativeHide(); + if (e4.key == "v" && e4.metaKey) { + navigator.clipboard.readText().then((f4) => setCellValue(f4)); } - } - nativeHide() { - var _a2; - const { hoverEl, targetEl } = this; - this.state = import_obsidian31.PopoverState.Hidden; - hoverEl.detach(); - if (targetEl) { - const parent = targetEl.matchParent(".mk-hover-popover"); - if (parent) - (_a2 = popovers.get(parent)) == null ? void 0 : _a2.transition(); + if (e4.key == "Escape") { + selectRows(null, []); + setLastSelectedIndex(null); } - this.onHide(); - this.unload(); - } - resolveLink(linkText, sourcePath) { - const link = (0, import_obsidian31.parseLinktext)(linkText); - const tFile = link ? this.plugin.app.metadataCache.getFirstLinkpathDest( - link.path, - sourcePath != null ? sourcePath : "" - ) : null; - return tFile; - } - async openContext(file, openState, useLeaf) { - if (this.detaching) - return; - const leaf = useLeaf != null ? useLeaf : this.attachLeaf(); - this.opening = true; - try { - await leaf.openFile(file, openState); - } catch (e4) { - console.error(e4); - } finally { - this.opening = false; - if (this.detaching) - this.hide(); + if (e4.key == "Backspace" || e4.key == "Delete") { + clearCell(); } - return leaf; - } - async openFile(file, openState, useLeaf) { - if (this.detaching) + if (e4.key == "Enter") { + if (selectedColumn && lastSelectedIndex) { + if (e4.shiftKey) { + newRow(parseInt(lastSelectedIndex) + 1); + nextRow(); + } else { + setCurrentEdit([selectedColumn, lastSelectedIndex]); + } + } return; - const leaf = useLeaf != null ? useLeaf : this.attachLeaf(); - this.opening = true; - try { - await leaf.openFile(file, openState); - } catch (e4) { - console.error(e4); - } finally { - this.opening = false; - if (this.detaching) - this.hide(); } - return leaf; - } - buildState(parentMode, eState) { - return { - active: false, - state: {}, - eState - }; - } - buildEphemeralState(file, link) { - const cache = this.plugin.app.metadataCache.getFileCache(file); - const subpath = cache ? (0, import_obsidian31.resolveSubpath)(cache, (link == null ? void 0 : link.subpath) || "") : void 0; - const eState = { subpath: link == null ? void 0 : link.subpath }; - if (subpath) { - eState.line = subpath.start.line; - eState.startLoc = subpath.start; - eState.endLoc = subpath.end || void 0; + if (e4.key == "ArrowDown") { + nextRow(); + e4.preventDefault(); } - return eState; - } -}; - -// src/utils/flow/flowEditor.ts -var import_obsidian32 = require("obsidian"); -var parseOutReferences = (ostr) => { - const str = ostr.split("|")[0]; - const refIndex = str.lastIndexOf("#"); - return refIndex > 0 ? [str.substring(0, refIndex), str.substring(refIndex + 1)] : [str, void 0]; -}; -var getFileFromString = (url, source) => { - return app.metadataCache.getFirstLinkpathDest(url, source != null ? source : ""); -}; -var getLineRangeFromRef = (file, ref, plugin) => { - var _a2; - if (!ref) { - return [void 0, void 0]; - } - const cache = app.metadataCache.getFileCache(file); - const headings = cache.headings; - const blocks = cache.blocks; - const sections = cache.sections; - if (blocks && ref.charAt(0) == "^" && blocks[ref.substring(1)]) { - return [ - blocks[ref.substring(1)].position.start.line + 1, - blocks[ref.substring(1)].position.end.line + 1 - ]; - } - const heading = headings == null ? void 0 : headings.find((f4) => f4.heading.replace("#", " ") == ref); - if (heading) { - const index = headings.findIndex((f4) => f4.heading == heading.heading); - const level = (_a2 = headings[index]) == null ? void 0 : _a2.level; - const nextIndex2 = headings.findIndex( - (f4, i4) => i4 > index && f4.level <= level - ); - const start = plugin.settings.editorFlowStyle == "classic" ? heading.position.start.line + 1 : heading.position.start.line + 2; - if (index < headings.length - 1 && nextIndex2 != -1) { - return [start, headings[nextIndex2].position.end.line]; + if (e4.key == "ArrowUp") { + lastRow(); + e4.preventDefault(); } - return [start, sections[sections.length - 1].position.end.line + 1]; - } - return [void 0, void 0]; -}; -var loadFlowEditorByDOM2 = (make, el, view, id2) => { - setTimeout(async () => { - let counter = 0; - while (!el.parentElement && counter++ <= 50) - await sleep(50); - if (!el.parentElement) - return; - let dom = el; - while (!dom.hasClass("mk-floweditor") && !dom.hasClass("workspace") && dom.parentElement) { - dom = dom.parentElement; + if (e4.key == "ArrowLeft") { + const newIndex = selectPrevIndex( + selectedColumn, + columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") + ); + setSelectedColumn(newIndex); } - if (!dom.hasClass("mk-floweditor") && !dom.hasClass("workspace") && !(dom.nodeName == "HTML")) { - return; + if (e4.key == "ArrowRight") { + const newIndex = selectNextIndex( + selectedColumn, + columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") + ); + setSelectedColumn(newIndex); } - setTimeout(async () => { - var _a2, _b2, _c2; - let leafFound = false; - if (app.workspace.activeEditor) { - if (((_b2 = (_a2 = app.workspace.activeEditor) == null ? void 0 : _a2.editor) == null ? void 0 : _b2.cm.dom) == view.dom) { - leafFound = true; - loadFlowEditorsForLeafForID( - app.workspace.activeEditor.editor.cm, - (_c2 = app.workspace.activeEditor.file) == null ? void 0 : _c2.path, - make, - id2 - ); - } - } - if (!leafFound) { - app.workspace.iterateLeaves((leaf) => { - var _a3, _b3; - const cm = (_a3 = leaf.view.editor) == null ? void 0 : _a3.cm; - if (cm && view.dom == cm.dom) { - leafFound = true; - loadFlowEditorsForLeafForID( - cm, - (_b3 = leaf.view.file) == null ? void 0 : _b3.path, - make, - id2 - ); + }; + const columns = F2( + () => { + var _a2; + return [ + ...(_a2 = cols == null ? void 0 : cols.filter((f4) => f4.type != "preview").map((f4) => { + return { + header: f4.name, + accessorKey: f4.name + f4.table, + meta: { + table: f4.table, + editable: f4.primary != "true", + schemaId: dbSchema == null ? void 0 : dbSchema.id + }, + cell: ({ + getValue, + row: { index }, + column: { colId }, + cell, + table: table2 + }) => { + const initialValue = getValue(); + const rowIndex = parseInt( + data[index]["_index" + f4.table] + ); + const tableIndex = parseInt(data[index]["_index"]); + const saveValue = (value) => { + var _a3; + setCurrentEdit(null); + if (initialValue != value) + (_a3 = table2.options.meta) == null ? void 0 : _a3.updateData( + f4.name, + value, + f4.table, + rowIndex + ); + }; + const saveFieldValue = (fieldValue, value) => { + var _a3; + (_a3 = table2.options.meta) == null ? void 0 : _a3.updateFieldValue( + f4.name, + fieldValue, + value, + f4.table, + rowIndex + ); + }; + const editMode = readMode ? -1 /* EditModeReadOnly */ : !cell.getIsGrouped() ? platformIsMobile() ? 3 /* EditModeAlways */ : currentEdit && currentEdit[0] == f4.name + f4.table && currentEdit[1] == tableIndex.toString() ? 2 /* EditModeActive */ : 1 /* EditModeView */ : -1 /* EditModeReadOnly */; + const cellProps = { + initialValue, + saveValue, + plugin: props2.plugin, + setEditMode: setCurrentEdit, + editMode, + propertyValue: f4.value + }; + const fieldType = fieldTypeForType(f4.type); + if (!fieldType) { + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, initialValue); + } + if (fieldType.type == "file") { + return /* @__PURE__ */ Cn.createElement(FileCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + folder: contextInfo.contextPath, + isFolder: contextInfo.type == "folder", + openFlow: () => toggleFlow(initialValue), + deleteRow: () => deleteRow(index) + }); + } else if (fieldType.type == "boolean") { + return /* @__PURE__ */ Cn.createElement(BooleanCell, { + ...cellProps, + column: f4 + }); + } else if (fieldType.type == "option") { + return /* @__PURE__ */ Cn.createElement(OptionCell, { + ...cellProps, + options: f4.value, + multi: fieldType.multiType == f4.type, + saveOptions: saveFieldValue + }); + } else if (fieldType.type == "date") { + return /* @__PURE__ */ Cn.createElement(DateCell, { + ...cellProps + }); + } else if (fieldType.type == "context") { + return /* @__PURE__ */ Cn.createElement(ContextCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + contextTable: contextTable[f4.value], + contextTag: f4.value + }); + } else if (fieldType.type == "fileprop") { + return /* @__PURE__ */ Cn.createElement(LookUpCell, { + ...cellProps, + file: data[index][FilePropertyName] + }); + } else if (fieldType.type == "tag") { + return /* @__PURE__ */ Cn.createElement(TagCell, { + ...cellProps, + multi: fieldType.multiType == f4.type + }); + } else if (fieldType.type == "number") { + return /* @__PURE__ */ Cn.createElement(NumberCell, { + ...cellProps + }); + } else if (fieldType.type == "link") { + return /* @__PURE__ */ Cn.createElement(LinkCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + file: data[index][FilePropertyName] + }); + } else if (fieldType.type == "image") { + return /* @__PURE__ */ Cn.createElement(ImageCell, { + ...cellProps + }); + } else { + return /* @__PURE__ */ Cn.createElement(TextCell, { + ...cellProps + }); + } + } + }; + })) != null ? _a2 : [], + ...readMode ? [] : [ + { + header: "+", + meta: { schemaId: dbSchema == null ? void 0 : dbSchema.id }, + accessorKey: "+", + size: 20, + cell: () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) } - }, app.workspace["rootSplit"]); - } - }); - }); -}; -var loadFlowEditorsForLeafForID = (cm, source, make, id2) => { - const stateField = cm.state.field(flowEditorInfo, false); - if (!stateField) - return; - const flowInfo = stateField.find((f4) => f4.id == id2); - if (flowInfo && flowInfo.expandedState == 2) { - loadFlowEditor(cm, flowInfo, source, make); - } -}; -var loadFlowEditor = (cm, flowEditorInfo2, source, make) => { - const dom = cm.dom.querySelector( - "#mk-flow-" + flowEditorInfo2.id + ] + ]; + }, + [cols, currentEdit, predicate, contextTable, toggleFlow, openFlows] ); - const { path, type, ref } = pathByString(flowEditorInfo2.link, source); - if (dom) { - if (type == "folder" || type == "tag" || type == "space") { - const context = mdbContextByPath( - make, - path - ); - if (!dom.hasAttribute("ready")) { - dom.setAttribute("ready", ""); - createFlowEditorInElement( - flowEditorInfo2.id, - dom, - "context", - context.contextPath, - ref - ); - return; + const groupBy2 = F2( + () => { + var _a2; + return ((_a2 = predicate.groupBy) == null ? void 0 : _a2.length) > 0 && cols.find((f4) => f4.name + f4.table == predicate.groupBy[0]) ? predicate.groupBy : []; + }, + [predicate, cols] + ); + const table = useReactTable({ + data, + columns, + columnResizeMode: "onChange", + state: { + columnVisibility: predicate.colsHidden.reduce( + (p3, c4) => ({ ...p3, [c4]: false }), + {} + ), + columnOrder: predicate.colsOrder, + columnSizing: { + ...columns.reduce((p3, c4) => ({ ...p3, [c4.accessorKey]: 150 }), {}), + ...colsSize + }, + grouping: groupBy2, + expanded: true + }, + onColumnSizingChange: saveColsSize, + getCoreRowModel: getCoreRowModel(), + getExpandedRowModel: getExpandedRowModel(), + getGroupedRowModel: getGroupedRowModel(), + meta: { + updateData: updateValue2, + updateFieldValue + } + }); + const sensors = useSensors( + useSensor(MouseSensor, { + activationConstraint: { + distance: 10 } - } else if (type == "file") { - const file = getFileFromString(path, source); - const aFile = getAbstractFileAtPath(app, path); - if (file) { - const selectiveRange = getLineRangeFromRef(file, ref, make); - if (!dom.hasAttribute("ready")) { - dom.setAttribute("ready", ""); - createFlowEditorInElement( - flowEditorInfo2.id, - dom, - ref ? "block" : "flow", - file.path, - ref, - selectiveRange[0], - selectiveRange[1] - ); - } - } else { - if (aFile instanceof import_obsidian32.TFolder) { - if (!dom.hasAttribute("ready")) { - dom.setAttribute("ready", ""); - createFlowEditorInElement( - flowEditorInfo2.id, - dom, - ref ? "block" : "flow", - path - ); - } - return; - } - dom.empty(); - const createDiv = dom.createDiv("file-embed"); - createDiv.toggleClass("mod-empty", true); - const createFile = async (e4) => { - e4.stopPropagation(); - e4.stopImmediatePropagation(); - await app.fileManager.createNewMarkdownFile(app.vault.getRoot(), path); - loadFlowEditor(cm, flowEditorInfo2, source, make); - }; - createDiv.setText(`"${path}" ` + i18n_default.labels.noFile); - createDiv.addEventListener("click", createFile); + }), + useSensor(TouchSensor, { + activationConstraint: { + delay: 250, + tolerance: 5 } + }) + ); + const measuring = { + droppable: { + strategy: MeasuringStrategy.Always + } + }; + function handleDragStart(event) { + const { + active: { id: activeId2 } + } = event; + setActiveId(activeId2); + setOverId(overId); + document.body.style.setProperty("cursor", "grabbing"); + } + function handleDragOver({ over }) { + var _a2; + const overId2 = over == null ? void 0 : over.id; + if (overId2) { + setOverId((_a2 = over == null ? void 0 : over.id) != null ? _a2 : null); + } + } + const saveFilter = (filter) => { + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s5) => s5.field != filter.field), + filter + ] + }); + }; + const selectCell = (e4, index, column) => { + if (platformIsMobile() || column == "+") + return; + selectItem(0, data[index]["_index"]); + setSelectedColumn(column); + if (e4.detail === 1) { + } else if (e4.detail === 2) { + setCurrentEdit([column, data[index]["_index"]]); + } + }; + const showContextMenu = (e4, index) => { + e4.preventDefault(); + const menu = new import_obsidian31.Menu(); + menu.addItem((item) => { + item.setIcon("trash"); + item.setTitle(i18n_default.menu.deleteRow); + item.onClick(() => { + deleteRow(index); + }); + }); + if (isMouseEvent(e4)) { + menu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + menu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); } + }; + function handleDragEnd({ active, over }) { + resetState(); + savePredicate({ + ...predicate, + colsOrder: arrayMove( + predicate.colsOrder, + predicate.colsOrder.findIndex((f4) => f4 == activeId), + predicate.colsOrder.findIndex((f4) => f4 == overId) + ) + }); } -}; -var focusPortal = async (plugin, evt) => { - const { id: id2, parent, top } = evt.detail; - if (parent) { - app.workspace.iterateLeaves((leaf) => { - var _a2; - const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; - if (cm) { - const stateField = cm.state.field(flowEditorInfo, false); - if (stateField) { - const foundInfo = stateField.find((f4) => f4.id == id2); - if (foundInfo) { - cm.focus(); - if (top) { - cm.dispatch({ - selection: import_state5.EditorSelection.single(foundInfo.from - 4), - annotations: arrowKeyAnnotation.of(1) - }); - } else { - if (foundInfo.to + 2 == cm.state.doc.length) { - cm.dispatch({ - changes: [ - { - from: foundInfo.to + 2, - to: foundInfo.to + 2, - insert: cm.state.lineBreak - } - ], - selection: import_state5.EditorSelection.single(foundInfo.to + 3), - annotations: arrowKeyAnnotation.of(2) - }); - } else { - cm.dispatch({ - selection: import_state5.EditorSelection.single(foundInfo.to + 3), - annotations: arrowKeyAnnotation.of(2) - }); - } - } - } - } + function handleDragCancel() { + resetState(); + } + function resetState() { + setOverId(null); + setActiveId(null); + document.body.style.setProperty("cursor", ""); + } + return /* @__PURE__ */ Cn.createElement(DndContext, { + sensors, + collisionDetection: closestCenter, + measuring, + onDragStart: handleDragStart, + onDragOver: handleDragOver, + onDragEnd: handleDragEnd, + onDragCancel: handleDragCancel + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-table", + ref, + tabIndex: 1, + onKeyDown + }, /* @__PURE__ */ Cn.createElement("table", { + ...{} + }, /* @__PURE__ */ Cn.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ Cn.createElement("tr", { + key: headerGroup.id + }, /* @__PURE__ */ Cn.createElement("th", null), headerGroup.headers.map((header) => { + var _a2; + return /* @__PURE__ */ Cn.createElement("th", { + className: "mk-th", + key: header.id, + style: { + minWidth: header.column.getIsGrouped() ? "0px" : (_a2 = colsSize[header.column.columnDef.accessorKey]) != null ? _a2 : "150px" } - }, app.workspace["rootSplit"]); - } else { - app.workspace.iterateLeaves((leaf) => { - var _a2; - const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; - if (cm) { - const stateField = cm.state.field(flowIDStateField, false); - if (stateField && stateField == id2) { - cm.focus(); - const lineRange = cm.state.field(selectiveLinesFacet, false); - const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(cm.state, lineRange) : { from: 0, to: cm.state.doc.length }; - if (top) { - cm.dispatch({ - selection: import_state5.EditorSelection.single(posRange.from) - }); - } else { - cm.dispatch({ - selection: import_state5.EditorSelection.single(posRange.to) - }); + }, header.isPlaceholder ? null : header.column.columnDef.header != "+" ? header.column.getIsGrouped() ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { + plugin: props2.plugin, + editable: header.column.columnDef.meta.editable, + column: cols.find( + (f4) => f4.name == header.column.columnDef.header && f4.table == header.column.columnDef.meta.table + ) + }) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { + plugin: props2.plugin, + isNew: true, + editable: true, + column: { + name: "", + schemaId: header.column.columnDef.meta.schemaId, + type: "text", + table: "" + } + }), /* @__PURE__ */ Cn.createElement("div", { + ...{ + onMouseDown: header.getResizeHandler(), + onTouchStart: header.getResizeHandler(), + className: `mk-resizer ${header.column.getIsResizing() ? "isResizing" : ""}` + } + })); + })))), /* @__PURE__ */ Cn.createElement("tbody", null, table.getRowModel().rows.map((row) => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("tr", { + className: (selectedRows == null ? void 0 : selectedRows.some( + (f4) => f4 == data[row.index]["_index"] + )) && "mk-is-active", + onContextMenu: (e4) => { + const rowIndex = parseInt( + data[row.index]["_index"] + ); + showContextMenu(e4, rowIndex); + }, + key: row.id + }, /* @__PURE__ */ Cn.createElement("td", null), row.getVisibleCells().map( + (cell) => { + var _a2, _b2; + return cell.getIsGrouped() ? /* @__PURE__ */ Cn.createElement("td", { + className: "mk-td-group", + colSpan: cols.length + (readMode ? 0 : 1) + }, /* @__PURE__ */ Cn.createElement("div", { + ...{ + onClick: row.getToggleExpandedHandler(), + style: { + display: "flex", + alignItems: "center", + cursor: "normal" } } + }, flexRender( + cell.column.columnDef.cell, + cell.getContext() + ), " ", "(", row.subRows.length, ")")) : cell.getIsAggregated() ? flexRender( + (_a2 = cell.column.columnDef.aggregatedCell) != null ? _a2 : cell.column.columnDef.cell, + cell.getContext() + ) : /* @__PURE__ */ Cn.createElement("td", { + onClick: (e4) => selectCell( + e4, + cell.row.index, + cell.column.columnDef.accessorKey + ), + className: `${cell.column.columnDef.accessorKey == selectedColumn ? "mk-selected-cell " : ""} mk-td ${cell.getIsPlaceholder() ? "mk-td-empty" : ""}`, + key: cell.id, + style: { + minWidth: cell.getIsPlaceholder() ? "0px" : (_b2 = colsSize[cell.column.columnDef.accessorKey]) != null ? _b2 : "50px" + } + }, cell.getIsPlaceholder() ? null : flexRender( + cell.column.columnDef.cell, + cell.getContext() + )); + } + ))))), /* @__PURE__ */ Cn.createElement("tfoot", null, contextInfo.type == "folder" && !readMode ? /* @__PURE__ */ Cn.createElement("tr", null, /* @__PURE__ */ Cn.createElement("th", { + className: "mk-row-new", + colSpan: cols.length + (readMode ? 1 : 2), + onClick: () => { + newRow(); + } + }, "+ New")) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))), z3( + /* @__PURE__ */ Cn.createElement(DragOverlay, { + dropAnimation: null, + zIndex: 1600 + }, activeId ? /* @__PURE__ */ Cn.createElement(ColumnHeader, { + plugin: props2.plugin, + editable: false, + column: { + name: activeId, + schemaId: tableData.schema.id, + type: "text", + table: "" } - }, app.workspace["rootSplit"]); - } + }) : null), + document.body + ))); }; -var openFileFromPortal = (plugin, evt) => { - const { file: fullLink, source } = evt.detail; - const [link, ref] = parseOutReferences(fullLink); - const file = getFileFromString(link, source); - openAFile(file, plugin, false); + +// src/components/ContextView/DataTypeView/BooleanCell.tsx +var BooleanCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue == "true"); + const onChange = () => { + if (props2.editMode == -1 /* EditModeReadOnly */) { + return; + } + setValue(!value); + saveValue(!value ? "true" : "false"); + }; + p2(() => { + if (props2.editMode == 2 /* EditModeActive */) { + setValue(!value); + saveValue(!value ? "true" : "false"); + props2.setEditMode(null); + } + }, [props2.editMode]); + Cn.useEffect(() => { + setValue(initialValue == "true"); + }, [initialValue]); + if (props2.editMode < 1 /* EditModeView */) { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-boolean" + }, /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: value, + onChange + }), /* @__PURE__ */ Cn.createElement("div", null, props2.column.name)); + } + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-text" + }, /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: value, + onChange + })); }; -var spawnLeafFromFile = async (plugin, file, el, type, ref, from, to, onLeafAttachCallback) => { - if (type == "context") { - spawnPortal(plugin, el, null, async (editor) => { - const newLeaf = editor.attachLeaf(); - await newLeaf.setViewState({ - type: EMBED_CONTEXT_VIEW_TYPE, - state: { contextPath: file, ref } + +// src/components/ContextView/DataTypeView/ObjectCell.tsx +var ObjectCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(safelyParseJSON(initialValue)); + const saveKey = (key2, newKey) => { + if (key2 != newKey) + saveValue({ + ...value, + [newKey]: value[key2], + [key2]: void 0 }); - if (onLeafAttachCallback) - onLeafAttachCallback(newLeaf); + }; + const saveVal = (key2, val) => { + saveValue({ + ...value, + [key2]: val }); + }; + Cn.useEffect(() => { + setValue(safelyParseJSON(initialValue)); + }, [initialValue]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-object" + }, Object.keys(value).map((f4) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-object-row" + }, /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-cell-text", + type: "text", + value: f4, + onBlur: (e4) => saveKey(f4, e4.target.value) + }), /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-cell-text", + type: "text", + value: value[f4], + onBlur: (e4) => saveVal(f4, e4.target.value) + })))); +}; + +// src/components/ContextView/DataTypeView/PreviewCell.tsx +var PreviewCell = (props2) => { + var _a2; + const [vaultItem, setVaultItem] = h2(null); + const previewImage = F2(() => { + if (vaultItem == null ? void 0 : vaultItem.banner) + return vaultItem.banner; + if (props2.initialValue) + return props2.initialValue; + if (!props2.row || !props2.columns) + return null; + const imageCol = props2.columns.find((f4) => f4.type == "image"); + if (!imageCol) + return null; + return props2.row[imageCol.name + imageCol.table]; + }, [props2.row, props2.columns]); + const previewFile = F2(() => { + return getAbstractFileAtPath(app, previewImage); + }, [previewImage]); + const loadIcon = () => { + setVaultItem(props2.plugin.index.filesIndex.get(props2.file)); + }; + p2(() => { + loadIcon(); + window.addEventListener(eventTypes.spacesChange, loadIcon); + return () => { + window.removeEventListener(eventTypes.spacesChange, loadIcon); + }; + }, [props2.file]); + return previewImage ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-preview", + style: { + backgroundSize: "cover", + backgroundPositionY: "50%", + backgroundImage: `url(${previewFile ? app.vault.getResourcePath(previewFile) : previewImage})` + } + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-preview", + style: ((_a2 = vaultItem == null ? void 0 : vaultItem.color) == null ? void 0 : _a2.length) > 0 ? { + "--label-color": `${vaultItem.color}`, + "--icon-color": `#ffffff` + } : { + "--label-color": `var(--background-secondary-alt)`, + "--icon-color": `var(--text-muted)` + } + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-icon", + dangerouslySetInnerHTML: (vaultItem == null ? void 0 : vaultItem.sticker) ? { __html: stickerFromString(vaultItem.sticker, props2.plugin) } : (vaultItem == null ? void 0 : vaultItem.isFolder) ? { __html: uiIconSet["mk-ui-folder"] } : { __html: uiIconSet["mk-ui-file"] } + })); +}; + +// src/components/ContextView/DataTypeView/DataTypeView.tsx +var DataTypeView = (props2) => { + const { initialValue, index, column, file } = props2; + const saveValue = (value) => { + props2.updateValue(value); + }; + const saveFieldValue = (fieldValue, value) => { + props2.updateFieldValue(fieldValue, value); + }; + const viewProps = { + initialValue, + saveValue, + editMode: props2.editable == true ? 3 : 0, + setEditMode: () => { + }, + plugin: props2.plugin, + propertyValue: column.value + }; + const fieldType = fieldTypeForType(column.type); + if (!fieldType) { + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); } - const portalFile = plugin.app.vault.getAbstractFileByPath(file); - if (!portalFile || !Object.keys(app.embedRegistry.embedByExtension).some( - (f4) => f4 == portalFile.extension - )) - return null; - spawnPortal(plugin, el, portalFile.name, async (editor) => { - return editor.openFile(portalFile, { active: false }).then((newLeaf) => { - var _a2; - if (newLeaf.view.setMode) - newLeaf.view.setMode(newLeaf.view.editMode); - if (from && to) { - (_a2 = newLeaf.view.editor) == null ? void 0 : _a2.cm.dispatch({ - annotations: [editableRange.of([from, to])] - }); - if (onLeafAttachCallback) - onLeafAttachCallback(newLeaf); - } + if (fieldType.type == "preview") { + return /* @__PURE__ */ Cn.createElement(PreviewCell, { + ...viewProps, + file, + row: props2.row, + columns: props2.cols + }); + } else if (fieldType.type == "file") { + return /* @__PURE__ */ Cn.createElement(FileCell, { + isFolder: false, + ...viewProps, + multi: fieldType.multiType == column.type, + openFlow: props2.openFlow + }); + } else if (fieldType.type == "boolean") { + return /* @__PURE__ */ Cn.createElement(BooleanCell, { + ...viewProps, + column + }); + } else if (fieldType.type == "option") { + return /* @__PURE__ */ Cn.createElement(OptionCell, { + ...viewProps, + options: column.value, + multi: fieldType.multiType == column.type, + saveOptions: saveFieldValue + }); + } else if (fieldType.type == "date") { + return /* @__PURE__ */ Cn.createElement(DateCell, { + ...viewProps + }); + } else if (fieldType.type == "context") { + return /* @__PURE__ */ Cn.createElement(ContextCell, { + ...viewProps, + multi: fieldType.multiType == column.type, + contextTable: props2.contextTable[column.value], + contextTag: column.value + }); + } else if (fieldType.type == "fileprop") { + return /* @__PURE__ */ Cn.createElement(LookUpCell, { + ...viewProps, + file + }); + } else if (fieldType.type == "number") { + return /* @__PURE__ */ Cn.createElement(NumberCell, { + ...viewProps + }); + } else if (fieldType.type == "link") { + return /* @__PURE__ */ Cn.createElement(LinkCell, { + ...viewProps, + multi: fieldType.multiType == column.type, + file + }); + } else if (fieldType.type == "tag") { + return /* @__PURE__ */ Cn.createElement(TagCell, { + ...viewProps, + multi: fieldType.multiType == column.type + }); + } else if (fieldType.type == "image") { + return /* @__PURE__ */ Cn.createElement(ImageCell, { + ...viewProps + }); + } else if (fieldType.type == "object") { + return /* @__PURE__ */ Cn.createElement(ObjectCell, { + ...viewProps }); + } + return /* @__PURE__ */ Cn.createElement(TextCell, { + ...viewProps }); }; -var spawnNewPortal = async (plugin, evt) => { - const { file, el, ref, from, to, type } = evt.detail; - spawnLeafFromFile(plugin, file, el, type, ref, from, to, (newLeaf) => { - var _a2, _b2, _c2; - if (!((_a2 = newLeaf == null ? void 0 : newLeaf.view) == null ? void 0 : _a2.editor)) { - return; - } - const view = (_b2 = newLeaf.view.editor) == null ? void 0 : _b2.cm; - view.dispatch({ - annotations: [ - portalTypeAnnotation.of(evt.detail.type), - flowIDAnnotation.of(evt.detail.id) - ] - }); - view.dom.addEventListener("keydown", (e4) => { - if (e4.key == "ArrowUp") { - if (e4.metaKey == true) { - view.dispatch({ - annotations: arrowKeyAnnotation.of(3) - }); - } else { - view.dispatch({ - annotations: arrowKeyAnnotation.of(1) - }); + +// src/components/FileContextView/FileContextList.tsx +var FileContextList = (props2) => { + const { path } = props2; + const { + tableData, + newColumn, + cols, + tagContexts, + contextTable, + contextInfo, + saveColumn, + hideColumn, + delColumn, + sortColumn, + updateFieldValue, + updateValue: updateValue2, + loadContextFields, + predicate + } = q2(MDBContext); + const [collapsed, setCollapsed] = h2( + !props2.plugin.settings.inlineContextSectionsExpanded + ); + const fileContext = F2(() => { + const td = tableData ? { + folder: { + cols: tableData.cols.filter( + (f4) => f4.name != FilePropertyName && !(f4.type == "fileprop" && (f4.value.startsWith(FilePropertyName) || f4.value.indexOf(".") == -1)) && f4.hidden != "true" && f4.type != "preview" + ), + data: tableData.rows.find((r3) => r3.File == path), + dataIndex: tableData.rows.findIndex((r3) => r3.File == path) + } + } : {}; + const tags = tagContexts.reduce( + (p3, c4) => contextTable[c4] ? { + ...p3, + [c4]: { + cols: contextTable[c4].cols.filter( + (f4) => f4.name != FilePropertyName && f4.type != "fileprop" && f4.hidden != "true" && f4.type != "preview" + ), + data: contextTable[c4].rows.find( + (r3, index) => index == parseInt(props2.path) + ), + dataIndex: contextTable[c4].rows.findIndex( + (r3) => r3.File == path + ) } + } : p3, + {} + ); + return { + ...tags, + ...td + }; + }, [tableData, contextTable, tagContexts, path]); + const saveField = (field, oldField) => { + if (field.name.length > 0) { + if (field.name != oldField.name || field.type != oldField.type || field.value != oldField.value || field.attrs != oldField.attrs) { + const saveResult = saveColumn(field, oldField); } - if (e4.key == "ArrowDown") { - if (e4.metaKey == true) { - view.dispatch({ - annotations: arrowKeyAnnotation.of(4) - }); - } else { - view.dispatch({ - annotations: arrowKeyAnnotation.of(2) - }); - } + } + }; + const saveContext = (field, oldField, value) => { + const newContext = value[0]; + initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { + if (f4) { + return insertContextItems( + props2.plugin, + optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ), + newContext + ); } - }); - if (from && to) { - (_c2 = newLeaf.view.editor) == null ? void 0 : _c2.cm.dispatch({ - annotations: [editableRange.of([from, to])] - }); + }).then((f4) => loadContextFields(newContext)); + const newField = { + ...field, + value: newContext != null ? newContext : "" + }; + saveColumn(newField, oldField); + }; + const showMenu = (e4, field) => { + const offset = e4.target.getBoundingClientRect(); + const options = optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ); + showPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + true, + options, + field, + cols, + contextInfo.contextPath, + (newField) => saveField(newField, field), + (newField, val) => saveContext(newField, field, val), + hideColumn, + delColumn, + sortColumn, + predicate.colsHidden.includes(field.name + field.table) + ); + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, fileContext.folder && fileContext.folder.data && fileContext.folder.cols.length > 0 && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title", + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); } - }); + }, /* @__PURE__ */ Cn.createElement("div", { + className: `mk-icon-xsmall`, + dangerouslySetInnerHTML: { + __html: contextInfo.type == "folder" ? uiIconSet["mk-ui-folder"] : contextInfo.type == "space" ? uiIconSet["mk-ui-spaces"] : uiIconSet["mk-ui-tags"] + } + }), contextDisplayName(contextInfo), /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xxsmall ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + })), !collapsed ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, fileContext.folder.cols.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { + key: i4, + className: "mk-file-context-row" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field", + onClick: (e4) => showMenu(e4, { ...f4, table: "" }) + }, f4.name), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: fileContext.folder.data[f4.name], + index: fileContext.folder.dataIndex, + file: fileContext.folder.data[FilePropertyName], + column: { ...f4, table: "" }, + editable: !contextInfo.readOnly, + updateValue: (v3) => updateValue2( + f4.name, + v3, + "", + fileContext.folder.dataIndex, + fileContext.folder.data[FilePropertyName] + ), + updateFieldValue: (fv, v3) => updateFieldValue( + f4.name, + fv, + v3, + "", + fileContext.folder.dataIndex, + fileContext.folder.data[FilePropertyName] + ), + contextTable + }))))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))); }; -var spawnPortal = (plugin, initiatingEl, fileName, onShowCallback) => { - const parent = plugin.app.workspace.activeLeaf; - if (!initiatingEl) - initiatingEl = parent.containerEl; - const hoverPopover = new FlowEditor( - parent, - initiatingEl, - plugin, - void 0, - onShowCallback - ); - if (fileName) - hoverPopover.titleEl.textContent = fileName.substring( - 0, - fileName.lastIndexOf(".") + +// src/components/ui/menus/fmMenu.tsx +var import_obsidian32 = require("obsidian"); +var showFMMenu = (plugin, position, property, deleteProperty, syncProperty, renameProperty, changeType) => { + const menu = new import_obsidian32.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { + var _a2; + inputMenuItem( + menuItem, + (_a2 = property == null ? void 0 : property.name) != null ? _a2 : "", + (value) => renameProperty(property.name, value) ); + menuItem.setIcon("type"); + }); + menu.addSeparator(); + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.changePropertyType); + menuItem.onClick(() => { + changeType(position, property.name); + }); + menuItem.setIcon("list"); + }); + if (property.type != "object") + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.syncToContext); + menuItem.onClick(() => { + syncProperty(property); + }); + menuItem.setIcon("sync"); + }); + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteProperty); + menuItem.onClick(() => { + deleteProperty(property); + }); + menuItem.setIcon("trash-2"); + }); + menu.addSeparator(); + menu.showAtPosition(position); + return menu; }; -// src/components/ContextView/FilterBar/TableSelector.tsx +// src/components/ui/modals/moveMetadataModal.tsx var import_obsidian33 = require("obsidian"); -var TableSelector = (props2) => { - const { folderNoteOpen, viewFolderNote } = props2; - const { - tables, - setDBSchema, - deleteSchema, - saveSchema, - saveDB: saveDB2, - setSchema, - dbSchema, - contextInfo - } = q2(MDBContext); - const saveNewSchemas = (_schema) => { - const newSchema = { - ..._schema, - id: uniqueNameFromString( - sanitizeTableName(_schema.id), - tables.map((f4) => f4.id) - ) - }; - saveSchema(newSchema).then( - (f4) => saveDB2({ - schema: newSchema, - cols: defaultTableFields.map((f5) => ({ ...f5, schemaId: newSchema.id })), - rows: [] +var MovePropertyModal = class extends import_obsidian33.Modal { + constructor(plugin, syncProperty, property, file) { + super(plugin.app); + this.plugin = plugin; + this.file = file; + let closeButton = this.modalEl.querySelector( + ".modal-close-button" + ); + closeButton.style.display = "none"; + this.syncProperty = syncProperty; + this.property = property; + } + onOpen() { + let { contentEl } = this; + let myModal = this; + let headerText; + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + headerEl.innerHTML = i18n_default.labels.syncMetadata; + const root = createRoot(contentEl); + root.render( + /* @__PURE__ */ Cn.createElement(MovePropertyComponent, { + plugin: this.plugin, + syncProperty: this.syncProperty, + close: () => this.close(), + property: this.property, + file: this.file }) ); + } + onClose() { + let { contentEl } = this; + contentEl.empty(); + } +}; +var MovePropertyComponent = (props2) => { + const { plugin } = props2; + const [table, setTable] = h2(""); + const saveContexts = (_9, value) => { + setTable(value[0]); }; - const newTable = (e4) => { - let vaultChangeModal = new SaveViewModal( + const showContextMenu = async (e4) => { + const offset = e4.target.getBoundingClientRect(); + const tags = allTagsForFile(props2.file); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, { - id: "", - name: "", - type: "db" - }, - saveNewSchemas, - "new table" + multi: false, + editable: false, + value: [], + options: [ + { name: props2.file.parent.name, value: "" }, + ...tags.map((m5) => ({ name: m5, value: m5 })) + ], + saveOptions: saveContexts, + placeholder: i18n_default.labels.tagItemSelectPlaceholder, + searchable: false, + showAll: true + } ); - vaultChangeModal.open(); }; - const selectView = (_dbschema, value) => { - viewFolderNote(false); - setDBSchema(_dbschema); - value && setSchema(tables.find((f4) => f4.id == value)); + const sync = () => { + props2.syncProperty(props2.property, table); + props2.close(); }; - const openView = (e4, _dbschema) => { - const views = tables.filter((f4) => f4.type != "db" && f4.def == _dbschema.id); - if (views.length == 0) { - selectView(_dbschema); - return; + return /* @__PURE__ */ Cn.createElement("div", { + className: "modal-content" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item setting-item-heading" + }, i18n_default.labels.syncProperties), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-info" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-name" + }, i18n_default.labels.selectContext), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-description" + }, i18n_default.descriptions.selectContext)), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item-control" + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => showContextMenu(e4) + }, table == "" ? i18n_default.buttons.currentFolder : table))), /* @__PURE__ */ Cn.createElement("button", { + style: { marginRight: 8 }, + onClick: () => sync() + }, i18n_default.buttons.sync), /* @__PURE__ */ Cn.createElement("button", { + onClick: () => props2.close() + }, i18n_default.buttons.cancel)); +}; + +// src/components/FileContextView/FrontmatterView.tsx +var FrontmatterView = (props2) => { + const { metadataPath, path } = props2; + const [values, setValues] = h2({}); + const [cols, setCols] = h2([]); + const refreshData = async () => { + var _a2; + const fileContexts = (_a2 = props2.plugin.index.contextsMap.get(path)) != null ? _a2 : /* @__PURE__ */ new Set(); + const columns = [...fileContexts].map((f4) => { + var _a3, _b2; + return (_b2 = (_a3 = props2.plugin.index.contextsIndex.get(f4)) == null ? void 0 : _a3.cols) != null ? _b2 : []; + }).reduce((p3, c4) => [...p3, ...c4], []); + const newCols = []; + const newValues = {}; + const types = guestimateTypes([metadataPath], props2.plugin, false); + const fm = frontMatterForFile(getAbstractFileAtPath(app, metadataPath)); + const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)).filter( + (f4) => !columns.some((g4) => g4.name == f4) + ); + const cols2 = fmKeys.map((f4) => ({ + table: "", + name: f4, + schemaId: "", + type: yamlTypeToMDBType(types[f4]) + })); + if (fm) { + newCols.push(...cols2); + Object.keys(fm).forEach((c4) => { + newValues[c4] = parseFrontMatter(c4, fm[c4]); + }); } - selectView(_dbschema, views[0].id); - return; + if (props2.plugin.dataViewAPI() && props2.plugin.settings.dataviewInlineContext) { + const types2 = guestimateTypes([metadataPath], props2.plugin, true); + const fm2 = frontMatterForFile(getAbstractFileAtPath(app, metadataPath)); + const fmKeys2 = uniqCaseInsensitive(frontMatterKeys(fm2)); + const dvValues = props2.plugin.dataViewAPI().page(metadataPath); + const dvKeys = uniqCaseInsensitive( + Object.keys(dvValues != null ? dvValues : {}).filter( + (f4, i4, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + ) ? true : false + ).filter((f4) => f4 != "file").filter((f4) => f4 != "tag" && f4 != "tags").filter((f4) => !fmKeys2.includes(f4)).filter((f4) => !columns.some((g4) => g4.name == f4)) + ); + const dvCols = dvKeys.map((f4) => ({ + table: "", + name: f4, + schemaId: "", + type: yamlTypeToMDBType(types2[f4]) + })); + const dv = dvKeys.reduce( + (p3, c4) => ({ + ...p3, + [c4]: parseDataview(c4, dvValues[c4]) + }), + {} + ); + newCols.push(...dvCols); + Object.keys(dv).forEach((c4) => { + newValues[c4] = parseDataview(c4, dvValues[c4]); + }); + } + setCols( + newCols.filter((f4) => { + var _a3; + return !((_a3 = props2.excludeKeys) == null ? void 0 : _a3.some((g4) => g4 == f4.name)); + }) + ); + setValues(newValues); }; - const folderNoteOptions = (e4) => { - triggerFileMenu( + p2(() => { + refreshData(); + }, [path, props2.tags]); + const mdbChanged = (evt) => { + if (evt.detail.type == "context" && evt.detail.contextPath && props2.tags.find( + (f4) => tagContextFromTag(props2.plugin, f4).contextPath == evt.detail.contextPath + )) { + refreshData(); + } else if (evt.detail.type == "file" && evt.detail.name == path) { + refreshData(); + } + }; + p2(() => { + window.addEventListener(eventTypes.spacesChange, mdbChanged); + return () => { + window.removeEventListener(eventTypes.spacesChange, mdbChanged); + }; + }, [path, props2.tags]); + const saveFMValue = (value, f4) => { + saveFrontmatterValue(props2.plugin, metadataPath, f4.name, value, f4.type); + }; + const deleteFMValue = (property) => { + deleteFrontmatterValue(props2.plugin, metadataPath, property.name); + }; + const saveMetadata = async (property, table) => { + const field = { + ...property, + schemaId: "files" + }; + let context; + let tag; + if (table == "") { + context = folderContextFromFolder(props2.plugin, props2.folder); + tag = false; + } else { + context = tagContextFromTag(props2.plugin, table); + tag = true; + } + await insertContextColumn(props2.plugin, context, field); + await updateContextValue( props2.plugin, - getAbstractFileAtPath(app, props2.folderNotePath), - false, - e4, - "link-context-menu" + context, + path, + field.name, + values[field.name] ); }; - const viewContextMenu = (e4, _schema) => { - const fileMenu = new import_obsidian33.Menu(); + const syncFMValue = (property) => { + let vaultChangeModal = new MovePropertyModal( + props2.plugin, + saveMetadata, + property, + getAbstractFileAtPath(app, metadataPath) + ); + vaultChangeModal.open(); + }; + const renameFMKey = (key2, name) => { + renameFrontmatterKey(props2.plugin, metadataPath, key2, name); + }; + const selectedType = (value, key2) => { + changeFrontmatterType(props2.plugin, metadataPath, key2, value[0]); + }; + const selectType = (p3, key2) => { + showSelectMenu(p3, { + multi: false, + editable: false, + searchable: false, + saveOptions: (_9, v3) => selectedType(v3, key2), + value: [], + showAll: true, + options: fieldTypes.filter((f4) => f4.metadata).map((f4, i4) => ({ + id: i4 + 1, + name: f4.label, + value: f4.type, + icon: "" + })) + }); + }; + const showMenu = (e4, property) => { + const offset = e4.target.getBoundingClientRect(); + showFMMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + property, + deleteFMValue, + syncFMValue, + renameFMKey, + selectType + ); + }; + return cols.length > 0 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, cols.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { + key: i4, + className: "mk-file-context-row" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field", + onClick: (e4) => showMenu(e4, f4) + }, f4.name), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: values[f4.name], + index: 0, + file: metadataPath, + column: { ...f4, table: "" }, + editable: props2.editable, + updateValue: (value) => saveFMValue(value, f4), + updateFieldValue: (fieldValue, value) => saveFMValue(value, f4), + contextTable: {} + }))))))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); +}; + +// src/components/FileContextView/NoteBannerView.tsx +var import_obsidian34 = require("obsidian"); +var NoteBannerView = (props2) => { + const [banner, setBanner] = h2(null); + p2(() => { + var _a2; + if (props2.link) { + const newBanner = (_a2 = getAbstractFileAtPath(app, props2.link)) != null ? _a2 : props2.link; + setBanner(newBanner); + } else { + setBanner(null); + } + }, [props2.link]); + const triggerBannerContextMenu = (e4) => { + if (!props2.file) + return; + e4.preventDefault(); + const fileMenu = new import_obsidian34.Menu(); fileMenu.addSeparator(); fileMenu.addItem((menuItem) => { - menuItem.setTitle("Rename Table"); - menuItem.onClick(() => { - let vaultChangeModal = new SaveViewModal( - _schema, - (s5) => saveSchema(s5), - "rename table" + menuItem.setTitle(i18n_default.buttons.changeBanner); + menuItem.setIcon("lucide-image"); + menuItem.onClick((ev) => { + let vaultChangeModal = new imageModal( + props2.plugin, + props2.plugin.app, + (image) => saveFrontmatterValue( + props2.plugin, + props2.file.path, + props2.plugin.settings.fmKeyBanner, + image, + "image", + true + ) ); vaultChangeModal.open(); }); }); fileMenu.addItem((menuItem) => { - menuItem.setTitle("Delete Table"); - menuItem.onClick(() => { - deleteSchema(_schema); + menuItem.setTitle(i18n_default.buttons.removeBanner); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + deleteFrontmatterValue( + props2.plugin, + props2.file.path, + props2.plugin.settings.fmKeyBanner + ); }); }); if (isMouseEvent(e4)) { @@ -41704,103 +42078,166 @@ var TableSelector = (props2) => { y: e4.nativeEvent.locationY }); } + return false; }; return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-table-selector" - }, viewFolderNote && /* @__PURE__ */ Cn.createElement("button", { - className: `mk-folder-note ${folderNoteOpen ? "mk-is-active" : ""}`, - onClick: () => viewFolderNote(true), - onContextMenu: (e4) => folderNoteOptions(e4) - }, props2.folderNoteName), tables.filter((f4) => f4.type == "db").map((f4) => /* @__PURE__ */ Cn.createElement("button", { - className: `${!folderNoteOpen && (dbSchema == null ? void 0 : dbSchema.id) == f4.id ? "mk-is-active" : ""}`, - onClick: (e4) => openView(e4, f4), - onContextMenu: (e4) => !f4.primary && viewContextMenu(e4, f4) - }, f4.name)), contextInfo.type == "folder" && /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => newTable(e4) - }, "+")); + className: `mk-note-header`, + onContextMenu: triggerBannerContextMenu + }, banner && /* @__PURE__ */ Cn.createElement("img", { + src: banner instanceof import_obsidian34.TFile ? app.vault.getResourcePath(banner) : banner + })); }; -// src/components/ContextView/ContextViewComponent.tsx -var ContextViewComponent = (props2) => { +// src/components/FileContextView/InlineFileContextView.tsx +var InlineFileContextView = (props2) => { var _a2, _b2; - const context = props2.context; - const contextCache = props2.plugin.index.contextsIndex.get( - context.contextPath - ); - const [folderCache, setFolderCache] = h2(null); - const [currentFlowNotePath, setCurrentFlowNotePath] = h2(null); - const refreshCache = () => { - if (props2.context.type == "folder") { - setFolderCache( - props2.plugin.index.filesIndex.get(props2.context.contextPath) + const { file } = props2; + const folderPath = (_a2 = file == null ? void 0 : file.parent) == null ? void 0 : _a2.path; + const getFileCache = (file2) => { + if (!file2 || file2.path == "/") + return null; + const cache = props2.plugin.index.filesIndex.get(file2.path); + if (!cache) { + return props2.plugin.index.filesIndex.get( + folderPathFromFolderNoteFile(props2.plugin.settings, tFileToAFile(file2)) ); - return; } - setFolderCache(null); + return cache; }; - const name = (_a2 = contextCache == null ? void 0 : contextCache.name) != null ? _a2 : contextDisplayName(props2.context); - const ref = _2(null); - const [flowOpen, setFlowOpen] = h2( - props2.plugin.settings.folderNoteDefaultView && props2.plugin.settings.enableFolderNote + const [fileCache, setFileCache] = h2( + getFileCache(props2.file) ); - const loadFile = async () => { - if (!folderCache) + const metadataFilePath = F2(() => { + if (!fileCache) + return null; + if (fileCache.isFolder && fileCache.folderNote) { + return fileCache.folderNote.folderNotePath; + } + return fileCache.path; + }, [fileCache]); + const showHeader = props2.showHeader; + const [collapsed, setCollapsed] = h2( + !showHeader ? false : !props2.plugin.settings.inlineContextExpanded + ); + const tags = (_b2 = fileCache == null ? void 0 : fileCache.tags) != null ? _b2 : []; + const contexts = F2(() => { + var _a3; + return ((_a3 = fileCache == null ? void 0 : fileCache.contexts) != null ? _a3 : []).map((f4) => props2.plugin.index.contextsIndex.get(f4)).filter((f4) => f4).map((f4) => f4.info); + }, [fileCache]); + const banner = fileCache == null ? void 0 : fileCache.banner; + p2(() => { + props2.plugin.settings.inlineContextExpanded = !collapsed; + props2.plugin.saveSettings(); + }, [collapsed]); + const fileNameRef = _2(null); + const refreshFile = () => { + if (!file) { return; - const folderNotePath = folderNotePathFromAFile( - props2.plugin.settings, - folderCache - ); - const folderNote = getAbstractFileAtPath(app, folderNotePath); - const div = ref.current; - spawnPortal(props2.plugin, div, folderCache.name, async (editor) => { - var _a3, _b3; - let leaf; - if (folderNote) { - leaf = await editor.openFile(folderNote); - } else { - const newFile = await app.fileManager.createNewMarkdownFile( - app.vault.getRoot(), - folderNotePath - ); - leaf = await editor.openFile(newFile); - } - if (!((_a3 = leaf == null ? void 0 : leaf.view) == null ? void 0 : _a3.editor)) { - return; - } - const view = (_b3 = leaf.view.editor) == null ? void 0 : _b3.cm; - view.dispatch({ - annotations: [portalTypeAnnotation.of("foldernote")] - }); - }); + } + console.log("refresh file"); + const fileCache2 = getFileCache(file); + setFileCache(fileCache2); }; const cacheChanged = (evt) => { - if (evt.detail.type == "file" && evt.detail.name == context.contextPath) { - refreshCache(); + var _a3; + if (evt.detail.type == "file" && (evt.detail.name == (file == null ? void 0 : file.path) || evt.detail.name == ((_a3 = fileCache == null ? void 0 : fileCache.folderNote) == null ? void 0 : _a3.folderNotePath))) { + refreshFile(); + } + if (evt.detail.type == "context" && contexts.some((f4) => f4.contextPath == evt.detail.name)) { + refreshFile(); } }; p2(() => { window.addEventListener(eventTypes.spacesChange, cacheChanged); - refreshCache(); + refreshFile(); return () => { window.removeEventListener(eventTypes.spacesChange, cacheChanged); }; - }, [props2.context]); - p2(() => { - if (flowOpen && folderCache) { - loadFile(); - } else { - if (ref.current) - ref.current.empty(); + }, [file]); + const changeCover = (e4) => { + const vaultChangeModal = new imageModal( + props2.plugin, + props2.plugin.app, + (image) => saveFrontmatterValue( + props2.plugin, + fileCache.path, + props2.plugin.settings.fmKeyBanner, + image, + "image", + true + ) + ); + vaultChangeModal.open(); + }; + const showContextMenu = (e4) => { + const offset = e4.target.getBoundingClientRect(); + const f4 = loadTags(props2.plugin); + showSelectMenu( + { x: offset.left, y: offset.top + 30 }, + { + multi: false, + editable: true, + value: [], + options: f4.map((m5) => ({ name: m5, value: m5 })), + saveOptions: (_9, value) => addTag2(value[0]), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + }; + const addTag2 = (tag) => { + if (file instanceof import_obsidian35.TFile && file.extension == "md") + addTagToNote(tag, file); + }; + const removeTag = (tag) => { + if (file instanceof import_obsidian35.TFile && file.extension == "md") + removeTagFromFile(tag, file); + }; + const saveField = (source, field) => { + if (source == "fm") { + saveFrontmatterValue( + props2.plugin, + fileCache.path, + field.name, + "", + field.type, + true + ); + return; } - }, [flowOpen, folderCache]); - const viewFolderNote = (open) => { - setFlowOpen(open); + if (source == "") { + insertContextColumn( + props2.plugin, + mdbContextByPath(props2.plugin, fileCache.parent), + field + ); + return; + } + insertContextColumn( + props2.plugin, + tagContextFromTag(props2.plugin, source), + field + ); + }; + const propertiesPlugin = corePluginEnabled(app, "properties"); + const newProperty = (e4) => { + const offset = e4.target.getBoundingClientRect(); + showNewPropertyMenu( + props2.plugin, + { x: offset.left, y: offset.top + 30 }, + tags, + [], + saveField, + "files", + folderPath, + true + ); }; - const fileNameRef = _2(null); const onBlur = (e4) => { const newValue = e4.target.innerHTML; - if (newValue != name) { - renameContext(props2.plugin, context, newValue); + if (newValue != fileNameToString(file.name)) { + renameFile(props2.plugin, file, newValue + ".md"); } }; const onKeyPress = (e4) => { @@ -41810,6 +42247,7 @@ var ContextViewComponent = (props2) => { e4.stopPropagation(); }; const onKeyDown = (e4) => { + var _a3, _b3; e4.stopPropagation(); if (e4.key == "a" && e4.metaKey) { e4.preventDefault(); @@ -41821,3251 +42259,2576 @@ var ContextViewComponent = (props2) => { } if (e4.key == "Enter") { e4.target.blur(); + (_a3 = props2.editorView) == null ? void 0 : _a3.focus(); e4.preventDefault(); } if (e4.key == "Escape") { e4.target.blur(); + (_b3 = props2.editorView) == null ? void 0 : _b3.focus(); e4.preventDefault(); } }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-folder-scroller markdown-source-view mod-cm6 is-readable-line-width" - }, props2.plugin.settings.enableFolderNote && props2.context.type == "folder" ? /* @__PURE__ */ Cn.createElement(MDBProvider, { - plugin: props2.plugin, - context - }, (folderCache == null ? void 0 : folderCache.banner) && /* @__PURE__ */ Cn.createElement(NoteBannerView, { + y2(() => { + var _a3; + (_a3 = props2.editorView) == null ? void 0 : _a3.requestMeasure(); + }, []); + p2(() => { + var _a3; + if (file == null ? void 0 : file.name.startsWith("Untitled")) { + selectElementContents(fileNameRef.current); + } + const pasteEvent = (e4) => { + e4.preventDefault(); + const text2 = e4.clipboardData.getData("text/plain"); + document.execCommand("insertText", false, text2); + }; + (_a3 = fileNameRef.current) == null ? void 0 : _a3.addEventListener("paste", pasteEvent); + return () => { + var _a4; + (_a4 = fileNameRef.current) == null ? void 0 : _a4.removeEventListener("paste", pasteEvent); + }; + }, [fileNameRef]); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.showBanner && /* @__PURE__ */ Cn.createElement(NoteBannerView, { plugin: props2.plugin, - link: folderCache.banner + link: banner, + file: props2.file }), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-folder-outer cm-line" + className: "mk-file-context-component" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-folder-header" - }, folderCache && /* @__PURE__ */ Cn.createElement("div", { className: `mk-spacer`, style: { - "--header-height": folderCache.banner ? ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!folderCache.sticker || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" : 0 + "--header-height": props2.showBanner && banner ? ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!props2.plugin.settings.spacesStickers || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" : 0 }, onContextMenu: (e4) => e4.preventDefault() }), /* @__PURE__ */ Cn.createElement("div", { className: `mk-file-context-file ${props2.plugin.settings.inlineContextNameLayout == "horizontal" ? "mk-file-context-file-horizontal" : ""}` - }, props2.plugin.settings.spacesStickers && folderCache ? /* @__PURE__ */ Cn.createElement(FileSticker, { + }, showHeader && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.plugin.settings.spacesStickers && fileCache ? /* @__PURE__ */ Cn.createElement(FileSticker, { plugin: props2.plugin, - fileCache: folderCache + fileCache }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { className: "mk-inline-title inline-title", ref: fileNameRef, - contentEditable: true, + contentEditable: props2.editable, onBlur, onDrop: (e4) => e4.preventDefault(), onKeyDown, onKeyPress, onKeyUp, dangerouslySetInnerHTML: { - __html: name + __html: fileNameToString(file.name) } - })), /* @__PURE__ */ Cn.createElement(TableSelector, { - plugin: props2.plugin, - folderNoteName: (_b2 = getFolderFromPath(app, props2.context.contextPath)) == null ? void 0 : _b2.name, - folderNoteOpen: flowOpen, - folderNotePath: folderNotePathFromAFile( - props2.plugin.settings, - tFileToAFile( - getAbstractFileAtPath(app, props2.context.contextPath) - ) - ), - viewFolderNote - }))), context && !flowOpen && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(FilterBar, { - plugin: props2.plugin - }), /* @__PURE__ */ Cn.createElement(ContextListView, { - plugin: props2.plugin - })), flowOpen && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-folder-outer" + })), /* @__PURE__ */ Cn.createElement("div", { + className: `mk-collapse mk-icon-xsmall mk-file-context-collapse ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse"] + }, + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + } + })), !collapsed && props2.editable ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field-new" + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => newProperty(e4) }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-flowspace-editor mk-foldernote cm-sizer", - ref - }))) : /* @__PURE__ */ Cn.createElement(MDBProvider, { - plugin: props2.plugin, - context + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + }), platformIsMobile() ? "Property" : "Add Property"), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => showContextMenu(e4) }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-context-header" + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-tags"] } + }), platformIsMobile() ? "Tag" : "Add Tag"), props2.showBanner || props2.isFolderNote ? /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => changeCover(e4) }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-inline-title inline-title", - ref: fileNameRef, - contentEditable: true, - onBlur, - onDrop: (e4) => e4.preventDefault(), - onKeyDown, - onKeyPress, - onKeyUp, + className: "mk-icon-xsmall", dangerouslySetInnerHTML: { - __html: name + __html: uiIconSet["mk-make-image"] } - }), props2.context.type == "folder" && /* @__PURE__ */ Cn.createElement(TableSelector, { - plugin: props2.plugin - })), /* @__PURE__ */ Cn.createElement(FilterBar, { - plugin: props2.plugin - }), /* @__PURE__ */ Cn.createElement(ContextListView, { - plugin: props2.plugin - }))); + }), platformIsMobile() ? "Cover" : "Change Cover") : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)), tags.length > 0 ? /* @__PURE__ */ Cn.createElement(TagsView, { + plugin: props2.plugin, + tags, + removeTag, + canOpen: true + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)) : /* @__PURE__ */ Cn.createElement("div", { + style: { height: 16 } + })), !collapsed && fileCache ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component" + }, metadataFilePath && !propertiesPlugin && /* @__PURE__ */ Cn.createElement(FrontmatterView, { + plugin: props2.plugin, + path: fileCache.path, + metadataPath: metadataFilePath, + folder: folderPath, + tags, + excludeKeys: showHeader || props2.isFolderNote ? FMMetadataKeys(props2.plugin) : [], + editable: props2.editable + }), contexts.map((context, i4) => /* @__PURE__ */ Cn.createElement(MDBProvider, { + key: i4, + plugin: props2.plugin, + context, + file: fileCache.path + }, /* @__PURE__ */ Cn.createElement(FileContextList, { + plugin: props2.plugin, + path: fileCache.path, + color: "var(--tag-background)" + }))), props2.editable ? /* @__PURE__ */ Cn.createElement("div", { + style: { height: props2.showHeader ? 16 : 8 } + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); }; -// src/components/ContextView/ContextView.tsx -var CONTEXT_VIEW_TYPE = "make-folder-view"; -var ContextView = class extends import_obsidian34.ItemView { - constructor(leaf, plugin, viewType) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - this.viewType = viewType; - } - getViewType() { - return CONTEXT_VIEW_TYPE; - } - getDisplayText() { - return contextDisplayName(this.context); - } - async onClose() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.contextPath = state.contextPath; - this.context = mdbContextByPath(this.plugin, this.contextPath); - if (!this.context) - return; - this.constructContext(this.context); - const displayName = contextDisplayName(this.context); - 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() { - let state = super.getState(); - state.contextPath = this.contextPath; - return state; - } - constructContext(context) { - this.destroy(); - this.root = createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ Cn.createElement("div", { - className: "mk-folder-view" - }, /* @__PURE__ */ Cn.createElement(ContextViewComponent, { - context, - plugin: this.plugin - })) +// src/components/ContextView/FilterBar/TableSelector.tsx +var import_obsidian37 = require("obsidian"); +var TableSelector = (props2) => { + const { folderNoteOpen, viewFolderNote } = props2; + const { + tables, + setDBSchema, + deleteSchema, + saveSchema, + saveDB: saveDB2, + setSchema, + dbSchema, + contextInfo + } = q2(MDBContext); + const saveNewSchemas = (_schema) => { + const newSchema = { + ..._schema, + id: uniqueNameFromString( + sanitizeTableName(_schema.id), + tables.map((f4) => f4.id) + ) + }; + saveSchema(newSchema).then( + (f4) => saveDB2({ + schema: newSchema, + cols: defaultTableFields.map((f5) => ({ ...f5, schemaId: newSchema.id })), + rows: [] + }) ); - } -}; - -// src/components/FileView/FileView.tsx -var import_obsidian36 = require("obsidian"); - -// src/components/FileView/FileLinkViewComponent.tsx -var import_obsidian35 = require("obsidian"); -var FileLinkViewComponent = (props2) => { - const ref = _2(null); - const [markdown, setMarkdown] = h2(""); - p2(() => { - if (ref.current) - import_obsidian35.MarkdownRenderer.renderMarkdown(markdown, ref.current, props2.path, null); - }, [markdown]); - p2(() => { - fetch(props2.path).then((res) => res.text()).then((f4) => setMarkdown(f4)); - }, [props2.path]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "markdown-preview-view markdown-rendered node-insert-event is-readable-line-width allow-fold-headings show-indentation-guide allow-fold-lists show-frontmatter" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "markdown-preview-sizer markdown-preview-section", - ref - })); -}; - -// src/components/FileView/FileView.tsx -var FILE_VIEW_TYPE = "make-file-view"; -var FileLinkView = class extends import_obsidian36.ItemView { - constructor(leaf, plugin, viewType) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - this.viewType = viewType; - } - getViewType() { - return FILE_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; + }; + const newTable = (e4) => { + let vaultChangeModal = new SaveViewModal( + { + id: "", + name: "", + type: "db" + }, + saveNewSchemas, + "new table" + ); + vaultChangeModal.open(); + }; + const selectView = (_dbschema, value) => { + viewFolderNote(false); + setDBSchema(_dbschema); + value && setSchema(tables.find((f4) => f4.id == value)); + }; + const openView = (e4, _dbschema) => { + const views = tables.filter((f4) => f4.type != "db" && f4.def == _dbschema.id); + if (views.length == 0) { + selectView(_dbschema); + return; } - result.history = true; + selectView(_dbschema, views[0].id); return; - } - getState() { - let state = super.getState(); - state.path = this.path; - return state; - } - constructView(path) { - this.destroy(); - this.root = createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ Cn.createElement("div", { - className: "markdown-reading-view" - }, /* @__PURE__ */ Cn.createElement(FileLinkViewComponent, { - path, - plugin: this.plugin - })) + }; + const folderNoteOptions = (e4) => { + triggerFileMenu( + props2.plugin, + getAbstractFileAtPath(app, props2.folderNotePath), + false, + e4, + "link-context-menu" ); - } + }; + const viewContextMenu = (e4, _schema) => { + const fileMenu = new import_obsidian37.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Rename Table"); + menuItem.onClick(() => { + let vaultChangeModal = new SaveViewModal( + _schema, + (s5) => saveSchema(s5), + "rename table" + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Delete Table"); + menuItem.onClick(() => { + deleteSchema(_schema); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-table-selector" + }, viewFolderNote && /* @__PURE__ */ Cn.createElement("button", { + className: `mk-folder-note ${folderNoteOpen ? "mk-is-active" : ""}`, + onClick: () => viewFolderNote(true), + onContextMenu: (e4) => folderNoteOptions(e4) + }, props2.folderNoteName), tables.filter((f4) => f4.type == "db").map((f4) => /* @__PURE__ */ Cn.createElement("button", { + className: `${!folderNoteOpen && (dbSchema == null ? void 0 : dbSchema.id) == f4.id ? "mk-is-active" : ""}`, + onClick: (e4) => openView(e4, f4), + onContextMenu: (e4) => !f4.primary && viewContextMenu(e4, f4) + }, f4.name)), contextInfo.type == "folder" && /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => newTable(e4) + }, "+")); }; -// src/utils/file.ts -var import_obsidian37 = require("obsidian"); -var tFileToAFile = (file) => { +// src/components/ContextView/ContextViewComponent.tsx +var ContextViewComponent = (props2) => { var _a2, _b2; - if (!file) - return null; - if (file instanceof import_obsidian37.TFile && file.stat) { - return { - isFolder: false, - name: file.basename, - path: file.path, - parent: file.parent.path, - stat: file.stat, - extension: file.extension - }; - } - return { - isFolder: true, - name: file.name, - path: file.path, - parent: (_b2 = (_a2 = file.parent) == null ? void 0 : _a2.path) != null ? _b2 : "/" - }; -}; -var defaultNoteFolder = (plugin, activeFile2) => { - var _a2; - return (_a2 = plugin.settings.newFileLocation == "folder" ? getFolderFromPath(app, plugin.settings.newFileFolderPath) : plugin.settings.newFileLocation == "current" && activeFile2 ? getFolderFromPath(app, activeFile2.path) : plugin.app.vault.getRoot()) != null ? _a2 : plugin.app.vault.getRoot(); -}; -var defaultConfigFile = async (app2) => { - return await app2.vault.adapter.read( - (0, import_obsidian37.normalizePath)(app2.vault.configDir + "/app.json") + const context = props2.context; + const contextCache = props2.plugin.index.contextsIndex.get( + context.contextPath ); -}; -var fileExtensionForFile = (path) => path == null ? void 0 : path.split(".").pop(); -var appendFilesMetaData = (plugin, propType, filesString) => { - const files = parseMultiString(filesString).map((f4) => plugin.index.filesIndex.get(f4)).filter((f4) => f4); - return serializeMultiString(files.map((f4) => appendFileMetaData(propType, f4))); -}; -var appendFileMetaData = (propType, file) => { - var _a2, _b2, _c2; - let value = ""; - if (file) { - if (propType == "folder") { - value = file.parent; - } else if (propType == "ctime") { - value = (_a2 = file.ctime) == null ? void 0 : _a2.toString(); - } else if (propType == "mtime") { - value = (_b2 = file.mtime) == null ? void 0 : _b2.toString(); - } else if (propType == "extension") { - value = file.extension; - } else if (propType == "size") { - value = (_c2 = file.size) == null ? void 0 : _c2.toString(); - } else if (propType == "inlinks") { - value = serializeMultiDisplayString(file.inlinks); - } else if (propType == "outlinks") { - value = serializeMultiDisplayString(file.outlinks); - } else if (propType == "tags") { - value = serializeMultiDisplayString(file.tags); - } else if (propType == "spaces") { - value = serializeMultiDisplayString(file.spaces); + const [folderCache, setFolderCache] = h2(null); + const [currentFlowNotePath, setCurrentFlowNotePath] = h2(null); + const refreshCache = () => { + if (props2.context.type == "folder") { + setFolderCache( + props2.plugin.index.filesIndex.get(props2.context.contextPath) + ); + return; } - } - return value; -}; -var moveFile = async (folder, file) => { - await app.vault.rename(file, folder.path + "/" + file.name); -}; -var renameFile = async (plugin, file, newName) => { - const afile = tFileToAFile(file); - await app.fileManager.renameFile( - file, - file.parent.path == "/" ? newName : file.parent.path + "/" + newName + setFolderCache(null); + }; + const name = (_a2 = contextCache == null ? void 0 : contextCache.name) != null ? _a2 : contextDisplayName(props2.context); + const ref = _2(null); + const [flowOpen, setFlowOpen] = h2( + props2.plugin.settings.folderNoteDefaultView && props2.plugin.settings.enableFolderNote ); - if (afile.isFolder && plugin.settings.enableFolderNote) { - const folderNotePath = folderNotePathFromAFile(plugin.settings, afile); + const loadFile = async () => { + if (!folderCache) + return; + const folderNotePath = folderNotePathFromAFile( + props2.plugin.settings, + folderCache + ); const folderNote = getAbstractFileAtPath(app, folderNotePath); - if (folderNote) - await app.fileManager.renameFile( - folderNote, - folderNotePathFromAFile(plugin.settings, tFileToAFile(file)) - ); - } -}; -function getAllAbstractFilesInVault(plugin, app2) { - const files = []; - const rootFolder = app2.vault.getRoot(); - function recursiveFx(folder) { - for (const child of folderChildren(plugin, folder)) { - if (child instanceof import_obsidian37.TFolder) { - const childFolder = child; - if (childFolder.children) - recursiveFx(childFolder); - } - files.push(child); + if ((currentFlowNotePath == null ? void 0 : currentFlowNotePath.path) == folderNote.path) { + return; + } else { + setCurrentFlowNotePath(folderNote); } - } - recursiveFx(rootFolder); - return files; -} -var removeTrailingSlashFromFolder = (path) => path == "/" ? path : path.slice(-1) == "/" ? path.substring(0, path.length - 1) : path; -var getFolderFromPath = (app2, path) => { - if (!path) - return null; - const afile = getAbstractFileAtPath(app2, removeTrailingSlashFromFolder(path)); - if (!afile) - return null; - return afile instanceof import_obsidian37.TFolder ? afile : afile.parent; -}; -var getFolderPathFromString = (file) => { - var _a2; - return (_a2 = getFolderFromPath(app, file)) == null ? void 0 : _a2.path; -}; -var getParentPathFromString = (file) => { - const indexOfLastSlash = file.lastIndexOf("/"); - if (indexOfLastSlash == -1) { - return "/"; - } - return file.substring(0, indexOfLastSlash + 1); -}; -var deleteFiles = (plugin, files) => { - files.forEach((f4) => { - const file = getAbstractFileAtPath(app, f4); - deleteFile(plugin, file); - }); -}; -var deleteFile = (plugin, file) => { - const deleteOption = plugin.settings.deleteFileOption; - if (deleteOption === "permanent") { - return plugin.app.vault.delete(file, true); - } else if (deleteOption === "system-trash") { - return plugin.app.vault.trash(file, true); - } else if (deleteOption === "trash") { - return plugin.app.vault.trash(file, false); - } -}; -var getFolderName = (folderPath, app2) => { - if (folderPath === "/") - return app2.vault.getName(); - const index = folderPath.lastIndexOf("/"); - if (index !== -1) - return folderPath.substring(index + 1); - return folderPath; -}; -var openFile = async (file, plugin, newLeaf) => { - openAFile(getAbstractFileAtPath(plugin.app, file.path), plugin, newLeaf); -}; -var openSpace = async (spaceName, plugin, newLeaf) => { - if (!plugin.settings.contextEnabled) - return; - const leaf = app.workspace.getLeaf(newLeaf); - const viewType = CONTEXT_VIEW_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { contextPath: spaceContextPathFromName(spaceName) } - }); - await app.workspace.requestSaveLayout(); - if (platformIsMobile()) { - app.workspace.leftSplit.collapse(); - } - const evt = new CustomEvent(eventTypes.activePathChange, { - detail: { path: pathByString(spaceContextPathFromName(spaceName)) } - }); - window.dispatchEvent(evt); -}; -var openURL = async (url) => { - const leaf = app.workspace.getLeaf(false); - if (url.endsWith(".md")) { - const viewType = FILE_VIEW_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: url } - }); - await app.workspace.requestSaveLayout(); - } else if (url.endsWith(".mdb")) { - const viewType = CONTEXT_VIEW_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { contextPath: url } - }); - await app.workspace.requestSaveLayout(); - } - if (platformIsMobile()) { - app.workspace.leftSplit.collapse(); - } -}; -function getAllFoldersInVault(app2) { - const folders = []; - const rootFolder = app2.vault.getRoot(); - folders.push(rootFolder); - function recursiveFx(folder) { - for (const child of folder.children) { - if (child instanceof import_obsidian37.TFolder) { - const childFolder = child; - folders.push(childFolder); - if (childFolder.children) - recursiveFx(childFolder); + const div = ref.current; + spawnPortal(props2.plugin, div, folderCache.name, async (editor) => { + var _a3, _b3; + let leaf; + if (folderNote) { + leaf = await editor.openFile(folderNote); + } else { + const newFile = await app.fileManager.createNewMarkdownFile( + app.vault.getRoot(), + folderNotePath + ); + leaf = await editor.openFile(newFile); + } + if (!((_a3 = leaf == null ? void 0 : leaf.view) == null ? void 0 : _a3.editor)) { + return; } + const view = (_b3 = leaf.view.editor) == null ? void 0 : _b3.cm; + view.dispatch({ + annotations: [portalTypeAnnotation.of("foldernote")] + }); + }); + }; + const cacheChanged = (evt) => { + if (evt.detail.type == "file" && evt.detail.name == context.contextPath) { + refreshCache(); } - } - recursiveFx(rootFolder); - return folders; -} -var openAFile = async (file, plugin, newLeaf) => { - if (file instanceof import_obsidian37.TFolder) { - openTFolder(file, plugin, newLeaf); - } else if (file instanceof import_obsidian37.TFile) { - openTFile(file, plugin, newLeaf); - } - let evt = new CustomEvent(eventTypes.activePathChange, { - detail: { path: pathByString(file.path) } - }); - window.dispatchEvent(evt); -}; -var openTFile = async (file, plugin, newLeaf) => { - let leaf = app.workspace.getLeaf(newLeaf); - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.openFile(file, { eState: { focus: true } }); - const fileCache = plugin.index.filesIndex.get(file.path); - if ((fileCache == null ? void 0 : fileCache.sticker) && leaf.tabHeaderInnerIconEl) { - const icon = stickerFromString(fileCache.sticker, plugin); - leaf.tabHeaderInnerIconEl.innerHTML = icon; - } -}; -var openTFolder = async (file, plugin, newLeaf) => { - if (!plugin.settings.contextEnabled) - return; - let leaf = app.workspace.getLeaf(newLeaf); - const viewType = CONTEXT_VIEW_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { contextPath: file.path } - }); - const fileCache = plugin.index.filesIndex.get(file.path); - if ((fileCache == null ? void 0 : fileCache.sticker) && leaf.tabHeaderInnerIconEl) { - const icon = stickerFromString(fileCache.sticker, plugin); - leaf.tabHeaderInnerIconEl.innerHTML = icon; - } - await app.workspace.requestSaveLayout(); - if (platformIsMobile()) { - app.workspace.leftSplit.collapse(); - } -}; -var openTagContext = async (tag, plugin, newLeaf) => { - let leaf = app.workspace.getLeaf(newLeaf); - const viewType = CONTEXT_VIEW_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ type: viewType, state: { contextPath: tag } }); - await app.workspace.requestSaveLayout(); - if (platformIsMobile()) { - app.workspace.leftSplit.collapse(); - } - const evt = new CustomEvent(eventTypes.activePathChange, { - detail: { path: pathByString(tag) } - }); - window.dispatchEvent(evt); -}; -var getAbstractFileAtPath = (app2, path) => { - return app2.vault.getAbstractFileByPath(path); -}; -var abstractFileAtPathExists = (app2, path) => { - return app2.vault.getAbstractFileByPath(path) ? true : false; -}; -var openFileInNewPane = (plugin, file) => { - openFile(file, plugin, true); -}; -var createNewCanvasFile = async (plugin, folder, newFileName, dontOpen) => { - const newFile = await app.fileManager.createNewMarkdownFile( - folder, - newFileName - ); - await app.vault.modify(newFile, "{}"); - await renameFile( - plugin, - newFile, - newFile.name.substring(0, newFile.name.lastIndexOf(".")) + ".canvas" - ); - if (dontOpen) { - return newFile; - } - await openAFile(newFile, plugin, false); - const evt = new CustomEvent(eventTypes.activePathChange, { - detail: { path: pathByString(newFile.path) } - }); - window.dispatchEvent(evt); - return newFile; -}; -var createNewMarkdownFile = async (plugin, folder, newFileName, content, dontOpen) => { - const newFile = await app.fileManager.createNewMarkdownFile( - folder, - newFileName - ); - if (content && content !== "") - await app.vault.modify(newFile, content); - if (dontOpen) { - return newFile; - } - await openAFile(newFile, plugin, false); - const titleEl = app.workspace.activeLeaf.view.containerEl.querySelector( - ".inline-title" - ); - if (titleEl) { - titleEl.focus(); - selectElementContents(titleEl); - } - const evt = new CustomEvent(eventTypes.activePathChange, { - detail: { path: pathByString(newFile.path) } - }); - window.dispatchEvent(evt); - return newFile; -}; -var platformIsMobile = () => { - return import_obsidian37.Platform.isMobile; -}; -var newFileInFolder = async (plugin, data, dontOpen) => { - await createNewMarkdownFile( - plugin, - data.parent.children.find((f4) => f4.name == data.name), - "", - "", - dontOpen - ); -}; -var noteToFolderNote = async (plugin, file, open) => { - const folderPath = fileNameToString(file.path); - const folder = getAbstractFileAtPath(app, folderPath); - if (folder && folder instanceof import_obsidian37.TFolder) { - if (open) { - openTFolder(folder, plugin, false); + }; + p2(() => { + window.addEventListener(eventTypes.spacesChange, cacheChanged); + refreshCache(); + return () => { + window.removeEventListener(eventTypes.spacesChange, cacheChanged); + }; + }, [props2.context]); + p2(() => { + if (flowOpen && folderCache) { + loadFile(); + } else { + if (ref.current) + ref.current.empty(); } - return; - } - await app.vault.createFolder(folderPath); - plugin.index.filesIndex.delete(file.path); - const newFolderNotePath = folderNotePathFromAFile(plugin.settings, tFileToAFile(getAbstractFileAtPath(app, folderPath))); - if (newFolderNotePath != file.path) { - await app.vault.rename(file, newFolderNotePath); - } - if (open) { - openTFolder(getAbstractFileAtPath(app, folderPath), plugin, false); - } -}; -var folderNoteCache = (plugin, file) => { - if (!file.extension || file.extension.length == 0) { - const folderNotePath = folderNotePathFromAFile(plugin.settings, file); - if (abstractFileAtPathExists(app, folderNotePath)) { - return { - folderNotePath, - folderPath: file.path - }; + }, [flowOpen, folderCache]); + const viewFolderNote = (open) => { + setFlowOpen(open); + }; + const fileNameRef = _2(null); + const onBlur = (e4) => { + const newValue = e4.target.innerHTML; + if (newValue != name) { + renameContext(props2.plugin, context, newValue); + } + }; + const onKeyPress = (e4) => { + e4.stopPropagation(); + }; + const onKeyUp = (e4) => { + e4.stopPropagation(); + }; + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "a" && e4.metaKey) { + e4.preventDefault(); + const selection = window.getSelection(); + const range = document.createRange(); + range.selectNodeContents(e4.target); + selection.removeAllRanges(); + selection.addRange(range); } - } else if (file.extension == "md") { - const folderPath = getAbstractFileAtPath(app, folderPathFromFolderNoteFile(plugin.settings, file)); - if (folderPath instanceof import_obsidian37.TFolder && folderPath.name == file.name) { - return { - folderNotePath: file.path, - folderPath: folderPath.path - }; + if (e4.key == "Enter") { + e4.target.blur(); + e4.preventDefault(); } - } - return null; -}; - -// src/components/ui/modals/vaultChangeModals.ts -var VaultChangeModal = class extends import_obsidian38.Modal { - constructor(plugin, file, action, space) { - super(plugin.app); - this.file = file; - this.action = action; - this.plugin = plugin; - this.space = space; - } - onOpen() { - const { contentEl } = this; - const myModal = this; - let headerText; - if (this.action === "rename") { - headerText = i18n_default.labels.rename; - } else if (this.action === "create folder") { - headerText = i18n_default.labels.createFolder; - } else if (this.action === "create note") { - headerText = i18n_default.labels.createNote; + if (e4.key == "Escape") { + e4.target.blur(); + e4.preventDefault(); } - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - const inputEl = contentEl.createEl("input"); - inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; - if (this.action === "rename") { - if (this.file instanceof import_obsidian38.TFolder) { - inputEl.value = this.file.name; - } else { - inputEl.value = this.file.name.substring( - 0, - indexOfCharElseEOS(".", this.file.name) - ); - } + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-folder-scroller markdown-source-view mod-cm6 is-readable-line-width" + }, props2.plugin.settings.enableFolderNote && props2.context.type == "folder" ? /* @__PURE__ */ Cn.createElement(MDBProvider, { + plugin: props2.plugin, + context + }, (folderCache == null ? void 0 : folderCache.banner) && /* @__PURE__ */ Cn.createElement(NoteBannerView, { + plugin: props2.plugin, + link: folderCache.banner + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-folder-outer cm-line" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-folder-header" + }, folderCache && /* @__PURE__ */ Cn.createElement("div", { + className: `mk-spacer`, + style: { + "--header-height": folderCache.banner ? ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!folderCache.sticker || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" : 0 + }, + onContextMenu: (e4) => e4.preventDefault() + }), /* @__PURE__ */ Cn.createElement("div", { + className: `mk-file-context-file ${props2.plugin.settings.inlineContextNameLayout == "horizontal" ? "mk-file-context-file-horizontal" : ""}` + }, props2.plugin.settings.spacesStickers && folderCache ? /* @__PURE__ */ Cn.createElement(FileSticker, { + plugin: props2.plugin, + fileCache: folderCache + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-inline-title inline-title", + ref: fileNameRef, + contentEditable: true, + onBlur, + onDrop: (e4) => e4.preventDefault(), + onKeyDown, + onKeyPress, + onKeyUp, + dangerouslySetInnerHTML: { + __html: name } - inputEl.focus(); - let changeButtonText; - if (this.action === "rename") { - changeButtonText = i18n_default.buttons.rename; - } else if (this.action === "create folder") { - changeButtonText = i18n_default.buttons.createFolder; - } else if (this.action === "create note") { - changeButtonText = i18n_default.buttons.createNote; + })), /* @__PURE__ */ Cn.createElement(TableSelector, { + plugin: props2.plugin, + folderNoteName: (_b2 = getFolderFromPath(app, props2.context.contextPath)) == null ? void 0 : _b2.name, + folderNoteOpen: flowOpen, + folderNotePath: folderNotePathFromAFile( + props2.plugin.settings, + tFileToAFile( + getAbstractFileAtPath(app, props2.context.contextPath) + ) + ), + viewFolderNote + }))), context && !flowOpen && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(FilterBar, { + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(ContextListView, { + plugin: props2.plugin + })), flowOpen && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-folder-outer" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "cm-sizer" + }, currentFlowNotePath && /* @__PURE__ */ Cn.createElement(InlineFileContextView, { + plugin: props2.plugin, + file: currentFlowNotePath, + showHeader: false, + showBanner: false, + editable: true + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-flowspace-editor mk-foldernote", + ref + })))) : /* @__PURE__ */ Cn.createElement(MDBProvider, { + plugin: props2.plugin, + context + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-context-header" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-inline-title inline-title", + ref: fileNameRef, + contentEditable: true, + onBlur, + onDrop: (e4) => e4.preventDefault(), + onKeyDown, + onKeyPress, + onKeyUp, + dangerouslySetInnerHTML: { + __html: name } - const changeButton = contentEl.createEl("button", { - text: changeButtonText - }); - const cancelButton = contentEl.createEl("button", { - text: i18n_default.buttons.cancel - }); - cancelButton.style.cssText = "float: right;"; - cancelButton.addEventListener("click", () => { - myModal.close(); - }); - const onClickAction = async () => { - let newName = inputEl.value; - if (this.action === "rename") { - if (this.file instanceof import_obsidian38.TFile) { - newName = this.file.name.lastIndexOf(".") == -1 ? newName : newName + this.file.name.substring(this.file.name.lastIndexOf(".")); - } - renameFile(this.plugin, this.file, newName); - } else if (this.action === "create folder") { - const path = !this.file || this.file.path == "/" ? newName : this.file.path + "/" + newName; - if (getAbstractFileAtPath(app, path)) { - new import_obsidian38.Notice(i18n_default.notice.folderExists); - return; - } - this.app.vault.createFolder(path); - if (this.space != "/") - addPathsToSpace(this.plugin, this.space, [path]); - } - myModal.close(); - }; - changeButton.addEventListener("click", onClickAction); - inputEl.addEventListener("keydown", (e4) => { - if (e4.key === "Enter") - onClickAction(); - }); - } - onClose() { - const { contentEl } = this; - contentEl.empty(); - } -}; -var MoveSuggestionModal = class extends import_obsidian38.FuzzySuggestModal { - constructor(app2, files) { - super(app2); - this.files = files; - } - getItemText(item) { - return item.path; - } - getItems() { - return getAllFoldersInVault(this.app); - } - onChooseItem(item, evt) { - this.files.forEach((f4) => { - const file = getAbstractFileAtPath(app, f4); - if (file) { - this.app.vault.rename(file, item.path + "/" + file.name); - } - }); - } + }), props2.context.type == "folder" && /* @__PURE__ */ Cn.createElement(TableSelector, { + plugin: props2.plugin + })), /* @__PURE__ */ Cn.createElement(FilterBar, { + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(ContextListView, { + plugin: props2.plugin + }))); }; -var AddToSpaceModal = class extends import_obsidian38.FuzzySuggestModal { - constructor(plugin, files) { - super(app); + +// src/components/ContextView/ContextView.tsx +var CONTEXT_VIEW_TYPE = "make-folder-view"; +var ContextView = class extends import_obsidian38.ItemView { + constructor(leaf, plugin, viewType) { + super(leaf); + this.navigation = true; this.plugin = plugin; - this.files = files; + this.viewType = viewType; } - getItemText(space) { - return space.name; + getViewType() { + return CONTEXT_VIEW_TYPE; } - getItems() { - return this.plugin.index.allSpaces().filter((f4) => f4.def.type == "focus"); + getDisplayText() { + return contextDisplayName(this.context); } - onChooseItem(space, evt) { - this.files.forEach((f4) => { - var _a2; - const file = this.plugin.index.filesIndex.get(f4); - if (file) { - if (((_a2 = space.def.folder) == null ? void 0 : _a2.length) > 0) { - moveAFileToNewParentAtIndex(this.plugin, file, space.def.folder, 0); - } else { - insertSpaceItemAtIndex(this.plugin, space.name, file.path, 0); - } - } - }); + async onClose() { + this.destroy(); } -}; -var RemoveFromSpaceModal = class extends import_obsidian38.FuzzySuggestModal { - constructor(plugin, file) { - super(app); - this.plugin = plugin; - this.file = this.plugin.index.filesIndex.get(file); + destroy() { + if (this.root) + this.root.unmount(); } - getItemText(space) { - return space.name; + async onOpen() { + this.destroy(); } - getItems() { - return this.file ? this.plugin.index.allSpaces().filter((f4) => { - var _a2; - return f4.def.type == "focus" && !(((_a2 = f4.def.folder) == null ? void 0 : _a2.length) > 0) && this.file.spaces.includes(f4.name); - }) : []; + async setState(state, result) { + this.contextPath = state.contextPath; + this.context = mdbContextByPath(this.plugin, this.contextPath); + if (!this.context) + return; + this.constructContext(this.context); + const displayName = contextDisplayName(this.context); + 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; } - onChooseItem(space, evt) { - removePathsFromSpace(this.plugin, space.name, [this.file.path]); + getState() { + let state = super.getState(); + state.contextPath = this.contextPath; + return state; + } + constructContext(context) { + this.destroy(); + this.root = createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ Cn.createElement("div", { + className: "mk-folder-view" + }, /* @__PURE__ */ Cn.createElement(ContextViewComponent, { + context, + plugin: this.plugin + })) + ); } }; -// src/superstate/spacesStore/spaces.ts -var import_lodash8 = __toESM(require_lodash()); -var import_obsidian39 = require("obsidian"); - -// src/schemas/spaces.ts -var vaultSchema = { - uniques: ["path"], - cols: ["path", "parent", "created", "sticker", "color", "folder", "rank"], - rows: [] -}; -var spaceSchema = { - uniques: ["name"], - cols: ["name", "sticker", "color", "pinned", "sort", "def", "rank"], - rows: [] -}; -var spaceItemsSchema = { - uniques: [], - cols: ["space", "path", "rank"], - rows: [] -}; +// src/components/FileView/FileView.tsx +var import_obsidian40 = require("obsidian"); -// src/superstate/cacheParsers.ts -var import_lodash7 = __toESM(require_lodash()); -var fileMetadataToVaultItem = (cache) => { - var _a2, _b2; - return { - path: cache.path, - parent: cache.parent, - color: cache.color, - created: (_b2 = (_a2 = cache.ctime) == null ? void 0 : _a2.toString()) != null ? _b2 : "", - sticker: cache.sticker, - folder: cache.isFolder ? "true" : "false", - rank: cache.rank - }; -}; -var parseSpaceCache = (space, spaceItems) => { - return { - name: space.name, - space, - spaceItems - }; +// src/components/FileView/FileLinkViewComponent.tsx +var import_obsidian39 = require("obsidian"); +var FileLinkViewComponent = (props2) => { + const ref = _2(null); + const [markdown, setMarkdown] = h2(""); + p2(() => { + if (ref.current) + import_obsidian39.MarkdownRenderer.renderMarkdown(markdown, ref.current, props2.path, null); + }, [markdown]); + p2(() => { + fetch(props2.path).then((res) => res.text()).then((f4) => setMarkdown(f4)); + }, [props2.path]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "markdown-preview-view markdown-rendered node-insert-event is-readable-line-width allow-fold-headings show-indentation-guide allow-fold-lists show-frontmatter" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "markdown-preview-sizer markdown-preview-section", + ref + })); }; -// src/superstate/spacesStore/spaces.ts -var rebuildIndex = async (plugin, save) => { - var _a2, _b2; - console.time("Make.md Vault Index"); - const newTables = indexCurrentFileTree(plugin, (_a2 = plugin.index.vaultDBCache) != null ? _a2 : [], (_b2 = plugin.index.spacesItemsDBCache) != null ? _b2 : []); - if (save && (!import_lodash8.default.isEqual(newTables.vault.rows, plugin.index.vaultDBCache) || !import_lodash8.default.isEqual(newTables.spaceItems.rows, plugin.index.spacesItemsDBCache))) { - await plugin.index.saveSpacesDatabaseToDisk(newTables, save); +// src/components/FileView/FileView.tsx +var FILE_VIEW_TYPE = "make-file-view"; +var FileLinkView = class extends import_obsidian40.ItemView { + constructor(leaf, plugin, viewType) { + super(leaf); + this.navigation = true; + this.plugin = plugin; + this.viewType = viewType; } - plugin.index.initialize(); - console.timeEnd("Make.md Vault Index"); -}; -var spaceToTreeNode = (space, collapsed, sortable) => { - return { - id: space.name, - spaceItem: space, - parentId: null, - depth: 0, - index: 0, - space: space.name, - path: space.name + "//", - item: null, - collapsed, - sortable, - childrenCount: 0 - }; -}; -var vaulItemToTreeNode = (item, space, path, depth, i4, collapsed, sortable, childrenCount) => ({ - item, - file: getAbstractFileAtPath(app, item.path), - space, - id: (space == "/" ? "" : space) + "//" + item.path, - parentId: (space == "/" ? "" : space) + "//" + path, - depth, - path, - index: i4, - collapsed, - sortable, - childrenCount -}); -var spaceRowHeight = (plugin) => { - return platformIsMobile() ? 40 : plugin.settings.spaceRowHeight; -}; -var folderSortFn = (sortStrategy, direction) => (a5, b4) => { - var _a2, _b2; - if (sortStrategy == "rank") { - return ((_a2 = a5.rank) != null ? _a2 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); + getViewType() { + return FILE_VIEW_TYPE; } - const sortFns = [ - compareByField("isFolder", false), - compareByField(sortStrategy, direction) - ]; - return sortFns.reduce((p3, c4) => { - return p3 == 0 ? c4(a5, b4) : p3; - }, 0); -}; -var flattenedTreeFromVaultItems = (root, space, vaultItems, openNodes, depth, sortStrategy, direction) => { - if (!vaultItems[root]) { - return []; + getDisplayText() { + return this.path; } - const flattenTree = (path, vaultItems2, openNodes2, depth2, index, folderSort) => { - const items = []; - let i4 = index; - const [sortStrat, dir] = folderSort.length > 0 ? parseSortStrat(folderSort) : [sortStrategy, direction]; - vaultItems2[path].sort(folderSortFn(sortStrat, dir)).forEach((item) => { - const collapsed = !openNodes2.includes(item.path); - i4 = i4 + 1; - const newItems = []; - if (vaultItems2[item.path] && !collapsed) { - newItems.push( - ...flattenTree(item.path, vaultItems2, openNodes2, depth2 + 1, i4, item.folderSort) - ); - } - const node = vaulItemToTreeNode( - item, - space, - path, - depth2, - i4, - collapsed, - sortStrategy == "rank", - newItems.length - ); - if (node.file) - newItems.splice(0, 0, node); - items.push(...newItems); - }); - return items; - }; - return flattenTree(root, vaultItems, openNodes, depth, 0, ""); -}; -var vaultItemForPath = (plugin, path) => { - if (!path) - return null; - return plugin.index.vaultDBCache.find((f4) => f4.path == path); -}; -var saveFileSticker = async (plugin, path, sticker) => { - if (plugin.settings.spacesEnabled) { - const newVaultDB = plugin.index.vaultDBCache.map((f4) => f4.path == path ? { ...f4, sticker } : f4); - await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); + async onClose() { + this.destroy(); } - saveFrontmatterValue( - plugin, - path, - plugin.settings.fmKeySticker, - sticker, - "text", - true - ); - plugin.index.reloadFile(getAbstractFileAtPath(app, path)).then((f4) => plugin.index.broadcast("space")); -}; -var saveFolderSort = async (plugin, path, sort) => { - if (plugin.settings.spacesEnabled) { - const newVaultDB = plugin.index.vaultDBCache.map((f4) => f4.path == path ? { ...f4, folder: sort } : f4); - await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); - plugin.index.reloadFile(getAbstractFileAtPath(app, path)).then((f4) => plugin.index.broadcast("vault")); + destroy() { + if (this.root) + this.root.unmount(); } -}; -var saveFileColor = async (plugin, path, color) => { - if (plugin.settings.spacesEnabled) { - const newVaultDB = plugin.index.vaultDBCache.map((f4) => f4.path == path ? { ...f4, color } : f4); - await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); + async onOpen() { + this.destroy(); } - saveFrontmatterValue( - plugin, - path, - plugin.settings.fmKeyColor, - color, - "text", - true - ); - plugin.index.reloadFile(getAbstractFileAtPath(app, path)).then((f4) => plugin.index.broadcast("space")); -}; -var saveSpaceSticker = async (plugin, name, sticker) => { - const newSpaceDB = plugin.index.spacesDBCache.map((f4) => f4.name == name ? { ...f4, sticker } : f4); - await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceDB } }); - plugin.index.reloadSpace(name); -}; -var updateFileRank = async (plugin, item, rank) => { - let fixedRank = rank; - if (parseInt(item.rank) > rank) - fixedRank = rank + 1; - const newItems = insert( - plugin.index.vaultDBCache.filter((f4) => f4.parent == item.parent).filter((f4) => f4.path != item.path).map((f4, i4) => f4.rank ? f4 : { ...f4, rank: i4.toString() }).sort( - (a5, b4) => a5.rank.localeCompare(b4.rank, void 0, { numeric: true }) - ), - fixedRank, - item - ).map((f4, index) => ({ path: f4.path, rank: index.toString() })); - const newVaultDB = plugin.index.vaultDBCache.map((f4) => { - const newItem = newItems.find((g4) => g4.path == f4.path); - if (newItem) { - return { ...f4, ...newItem }; + 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 f4; - }); - await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); - const promises = newItems.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4.path))); - await Promise.all(promises); - plugin.index.broadcast("space"); -}; -var moveAFileToNewParentAtIndex = async (plugin, item, newParent, index) => { - var _a2; - const currFile = getAbstractFileAtPath(app, item.path); - const newPath = newParent == "/" ? currFile.name : newParent + "/" + currFile.name; - const newItem = { - ...fileMetadataToVaultItem(item), - path: newPath, - parent: newParent, - rank: index.toString() - }; - if (getAbstractFileAtPath(app, newPath)) { - new import_obsidian39.Notice(i18n_default.notice.fileExists); + result.history = true; return; } - const allRows = plugin.index.vaultDBCache.filter((f4) => f4.parent == newParent); - const rows = insert( - (_a2 = allRows.sort( - (a5, b4) => { - var _a3, _b2; - return ((_a3 = a5.rank) != null ? _a3 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); - } - )) != null ? _a2 : [], - index, - newItem - ).map((f4, i4) => ({ ...f4, rank: i4.toString() })); - const newVaultTable = [...plugin.index.vaultDBCache, newItem].filter((f4) => f4.path != item.path).map((f4) => { - const newItem2 = rows.find((g4) => g4.path == f4.path); - if (newItem2) { - return { ...f4, ...newItem2 }; - } - return f4; - }); - await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultTable } }); - const afile = getAbstractFileAtPath(app, item.path); - await moveFile(getAbstractFileAtPath(app, newParent), afile); - const promises = rows.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4.path))); - await Promise.all(promises); - plugin.index.broadcast("space"); + getState() { + let state = super.getState(); + state.path = this.path; + return state; + } + constructView(path) { + this.destroy(); + this.root = createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ Cn.createElement("div", { + className: "markdown-reading-view" + }, /* @__PURE__ */ Cn.createElement(FileLinkViewComponent, { + path, + plugin: this.plugin + })) + ); + } }; -var insertSpaceAtIndex = async (plugin, newSpace, rank) => { - const spaces2 = plugin.index.allSpaces(); - const spaceExists = spaces2.find((f4) => f4.name == newSpace.name); - let fixedRank = rank; - let newSpaceRows = plugin.index.spacesDBCache; - if (spaceExists) { - const newRow = { ...serializeSpace(spaceExists), ...serializeSpace(newSpace) }; - newSpaceRows = newSpaceRows.map((f4) => f4.name == newRow.name ? newRow : f4); - if (parseInt(spaceExists.rank) < rank) - fixedRank = rank - 1; - } else { - const newRow = serializeSpace(newSpace); - newSpaceRows.push(newRow); + +// src/utils/file.ts +var import_obsidian41 = require("obsidian"); +var tFileToAFile = (file) => { + var _a2, _b2; + if (!file) + return null; + if (file instanceof import_obsidian41.TFile && file.stat) { + return { + isFolder: false, + name: file.basename, + path: file.path, + parent: file.parent.path, + stat: file.stat, + extension: file.extension + }; } - const newSpaces = insert( - spaces2.filter((f4) => f4.name != newSpace.name), - fixedRank, - newSpace - ).map((f4, index) => ({ name: f4.name, rank: index.toString() })); - newSpaceRows = newSpaceRows.map((f4) => { - const foundSpace = newSpaces.find((s5) => s5.name == f4.name); - if (foundSpace) { - return { - ...f4, - rank: foundSpace.rank - }; - } - return f4; - }); - await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceRows } }); - plugin.index.initializeSpaces().then((f4) => plugin.index.initalizeFiles()); + return { + isFolder: true, + name: file.name, + path: file.path, + parent: (_b2 = (_a2 = file.parent) == null ? void 0 : _a2.path) != null ? _b2 : "/" + }; }; -var insertSpaceItemAtIndex = async (plugin, spaceName, path, rank) => { +var defaultNoteFolder = (plugin, activeFile2) => { var _a2; - const space = (_a2 = plugin.index.spacesIndex.get(spaceName)) == null ? void 0 : _a2.space; - if (!space) - return; - const newSpace = { - space: space.name, - path, - rank: rank.toString() - }; - const spaceExists = plugin.index.spacesItemsDBCache.filter((f4) => f4.space == space.name); - const pathExists = spaceExists.find((f4) => f4.path == path); - let fixedRank = rank; - let newSpaceItemsRows = plugin.index.spacesItemsDBCache; - if (!pathExists) { - newSpaceItemsRows.push(newSpace); - fixedRank = rank + 1; - } else { - if (parseInt(pathExists.rank) > rank) - fixedRank = rank + 1; - } - const newSpaceItems = insert( - spaceExists.filter((f4) => f4.path != path), - fixedRank, - newSpace - ).map((f4, index) => ({ - space: f4.space, - path: f4.path, - rank: index.toString() - })); - newSpaceItemsRows = newSpaceItemsRows.map((f4) => { - if (f4.space != space.name) - return f4; - const foundItem = newSpaceItems.find((s5) => s5.path == f4.path); - if (foundItem) { - return { - ...f4, - ...foundItem - }; - } - return f4; - }); - await plugin.index.saveSpacesDatabaseToDisk({ spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); - await plugin.index.reloadSpace(space.name); - const promises = newSpaceItemsRows.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4.path))); - await Promise.all(promises); - plugin.index.broadcast("vault"); + return (_a2 = plugin.settings.newFileLocation == "folder" ? getFolderFromPath(app, plugin.settings.newFileFolderPath) : plugin.settings.newFileLocation == "current" && activeFile2 ? getFolderFromPath(app, activeFile2.path) : plugin.app.vault.getRoot()) != null ? _a2 : plugin.app.vault.getRoot(); }; -var saveSpace = async (plugin, space, newSpace) => { - const newSpaceRows = plugin.index.spacesDBCache.map((f4) => f4.name == space ? serializeSpace(newSpace) : f4); - const newSpaceItemsRows = plugin.index.spacesItemsDBCache.map((f4) => f4.space == space ? { ...f4, space: newSpace.name } : f4); - await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceRows }, spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); - plugin.settings.expandedSpaces = plugin.settings.expandedSpaces.map( - (f4) => f4 == space ? newSpace.name : f4 +var defaultConfigFile = async (app2) => { + return await app2.vault.adapter.read( + (0, import_obsidian41.normalizePath)(app2.vault.configDir + "/app.json") ); - plugin.saveSettings(); - if (space != newSpace.name) { - renameSpaceContextFile(plugin, space, newSpace.name); - plugin.index.renameSpace(space, newSpace.name); - } - plugin.index.reloadSpace(space); - plugin.index.initalizeFiles(); -}; -var removeSpace = async (plugin, space) => { - const newSpaceRows = plugin.index.spacesDBCache.filter((f4) => f4.name != space); - const newSpaceItemsRows = plugin.index.spacesItemsDBCache.filter((f4) => f4.space != space); - await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceRows }, spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); - deleteSpaceContext(plugin, space); - plugin.index.deleteSpace(space); }; -var updateSpaceSort = (plugin, spaceName, sort) => { - var _a2; - const space = (_a2 = plugin.index.spacesIndex.get(spaceName)) == null ? void 0 : _a2.space; - if (space) - saveSpace(plugin, spaceName, { - ...space, - sort: JSON.stringify(sort) - }); +var fileExtensionForFile = (path) => path == null ? void 0 : path.split(".").pop(); +var appendFilesMetaData = (plugin, propType, filesString) => { + const files = parseMultiString(filesString).map((f4) => plugin.index.filesIndex.get(f4)).filter((f4) => f4); + return serializeMultiString(files.map((f4) => appendFileMetaData(propType, f4))); }; -var toggleSpacePin = (plugin, spaceName, type) => { - var _a2; - const space = (_a2 = plugin.index.spacesIndex.get(spaceName)) == null ? void 0 : _a2.space; - if (space) - saveSpace(plugin, spaceName, { - ...space, - pinned: type - }); +var appendFileMetaData = (propType, file) => { + var _a2, _b2, _c2; + let value = ""; + if (file) { + if (propType == "folder") { + value = file.parent; + } else if (propType == "ctime") { + value = (_a2 = file.ctime) == null ? void 0 : _a2.toString(); + } else if (propType == "mtime") { + value = (_b2 = file.mtime) == null ? void 0 : _b2.toString(); + } else if (propType == "extension") { + value = file.extension; + } else if (propType == "size") { + value = (_c2 = file.size) == null ? void 0 : _c2.toString(); + } else if (propType == "inlinks") { + value = serializeMultiDisplayString(file.inlinks); + } else if (propType == "outlinks") { + value = serializeMultiDisplayString(file.outlinks); + } else if (propType == "tags") { + value = serializeMultiDisplayString(file.tags); + } else if (propType == "spaces") { + value = serializeMultiDisplayString(file.spaces); + } + } + return value; }; -var addPathsToSpace = async (plugin, space, paths) => { - const newSpaceItemsRows = [...plugin.index.spacesItemsDBCache, ...paths.map((p3) => ({ space, path: p3 }))]; - await plugin.index.saveSpacesDatabaseToDisk({ spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); - await plugin.index.reloadSpace(space); - const promises = paths.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4))); - await Promise.all(promises); - plugin.index.broadcast("vault"); +var moveFile = async (folder, file) => { + await app.vault.rename(file, folder.path + "/" + file.name); }; -var removePathsFromSpace = async (plugin, space, paths) => { - const newSpaceItemsRows = plugin.index.spacesItemsDBCache.filter((f4) => !(f4.space == space && paths.includes(f4.path))); - await plugin.index.saveSpacesDatabaseToDisk({ spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); - await plugin.index.reloadSpace(space); - const promises = paths.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4))); - await Promise.all(promises); - plugin.index.broadcast("vault"); +var renameFile = async (plugin, file, newName) => { + const afile = tFileToAFile(file); + await app.fileManager.renameFile( + file, + file.parent.path == "/" ? newName : file.parent.path + "/" + newName + ); + if (afile.isFolder && plugin.settings.enableFolderNote) { + const folderNotePath = folderNotePathFromAFile(plugin.settings, afile); + const folderNote = getAbstractFileAtPath(app, folderNotePath); + if (folderNote) + await app.fileManager.renameFile( + folderNote, + folderNotePathFromAFile(plugin.settings, tFileToAFile(file)) + ); + } }; -var retrieveSpaceItems = (plugin, spaces2) => { - const retrievedSpaces = {}; - spaces2.forEach((space) => { - const rows = plugin.index.spacesItemsDBCache.filter((f4) => f4.space == space.name); - retrievedSpaces[space.name] = rows.sort( - (a5, b4) => { - var _a2, _b2; - return ((_a2 = a5.rank) != null ? _a2 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); +function getAllAbstractFilesInVault(plugin, app2) { + const files = []; + const rootFolder = app2.vault.getRoot(); + function recursiveFx(folder) { + for (const child of folderChildren(plugin, folder)) { + if (child instanceof import_obsidian41.TFolder) { + const childFolder = child; + if (childFolder.children) + recursiveFx(childFolder); } - ); - }); - return retrievedSpaces; -}; -var retrieveFolders = async (plugin, paths) => { - const retrievedFolders = {}; - paths.forEach((folder) => { - const files = []; - for (const k5 of plugin.index.filesIndex.values()) { - if (k5.parent == folder) - files.push(k5); + files.push(child); } - retrievedFolders[folder] = files.filter( - excludeVaultItemPredicate(plugin.settings) - ).map((f4) => plugin.index.filesIndex.get(f4.path)).filter((f4) => f4); - }); - return retrievedFolders; + } + recursiveFx(rootFolder); + return files; +} +var removeTrailingSlashFromFolder = (path) => path == "/" ? path : path.slice(-1) == "/" ? path.substring(0, path.length - 1) : path; +var getFolderFromPath = (app2, path) => { + if (!path) + return null; + const afile = getAbstractFileAtPath(app2, removeTrailingSlashFromFolder(path)); + if (!afile) + return null; + return afile instanceof import_obsidian41.TFolder ? afile : afile.parent; }; -var retrieveAllRecursiveChildren = (vaultDB, settings, folder) => { - return vaultDB.filter((f4) => f4["parent"].startsWith(folder)).filter( - excludeVaultItemPredicate(settings) - ); +var getFolderPathFromString = (file) => { + var _a2; + return (_a2 = getFolderFromPath(app, file)) == null ? void 0 : _a2.path; }; -var retrieveAllFiles = (vaultDB, settings) => { - return vaultDB.filter( - excludeVaultItemPredicate(settings) - ); +var getParentPathFromString = (file) => { + const indexOfLastSlash = file.lastIndexOf("/"); + if (indexOfLastSlash == -1) { + return "/"; + } + return file.substring(0, indexOfLastSlash + 1); }; -var initiateDB = (db) => { - replaceDB(db, { - vault: vaultSchema, - spaces: spaceSchema, - spaceItems: spaceItemsSchema +var deleteFiles = (plugin, files) => { + files.forEach((f4) => { + const file = getAbstractFileAtPath(app, f4); + deleteFile(plugin, file); }); }; -var indexCurrentFileTree = (plugin, vaultDB, spaceItemsDB) => { - const treeItems = getAllAbstractFilesInVault(plugin, app).map((file) => { - var _a2; - return { - path: file.path, - parent: (_a2 = file.parent) == null ? void 0 : _a2.path, - created: file instanceof import_obsidian39.TFile ? file.stat.ctime.toString() : void 0, - folder: file instanceof import_obsidian39.TFolder ? "true" : "false" - }; - }); - const currentPaths = vaultDB; - const deleteRows = currentPaths.filter( - (item) => !treeItems.some((i4) => i4.path == item.path) - ); - const fixRows = currentPaths.filter( - (item) => treeItems.some((i4) => i4.path == item.path && i4.parent != item.parent) - ).map((item) => ({ - ...item, - ...treeItems.find((i4) => i4.path == item.path) - })); - const newRows = treeItems.filter( - (item) => !currentPaths.some((i4) => i4.path == item.path) - ); - const newVaultRows = [...vaultDB.map((f4) => { - const newItem = fixRows.find((g4) => g4.path == f4.path); - if (newItem) { - return { ...f4, ...newItem }; - } - return f4; - }).filter((f4) => !deleteRows.some((g4) => g4.path == f4.path)), ...newRows]; - const newSpaceItemsRows = spaceItemsDB.filter((f4) => !deleteRows.some((g4) => g4.path == f4.path)); - return { - vault: { - ...vaultSchema, - rows: newVaultRows - }, - spaceItems: { - ...spaceItemsSchema, - rows: newSpaceItemsRows - } - }; +var deleteFile = (plugin, file) => { + const deleteOption = plugin.settings.deleteFileOption; + if (deleteOption === "permanent") { + return plugin.app.vault.delete(file, true); + } else if (deleteOption === "system-trash") { + return plugin.app.vault.trash(file, true); + } else if (deleteOption === "trash") { + return plugin.app.vault.trash(file, false); + } }; -var newFolderInSpace = (plugin, space, activeFile2) => { - const vaultChangeModal = new VaultChangeModal( - plugin, - (space == null ? void 0 : space.def.folder.length) > 0 ? getFolderFromPath(app, space.def.folder) : defaultNoteFolder(plugin, activeFile2), - "create folder", - space.name - ); - vaultChangeModal.open(); +var getFolderName = (folderPath, app2) => { + if (folderPath === "/") + return app2.vault.getName(); + const index = folderPath.lastIndexOf("/"); + if (index !== -1) + return folderPath.substring(index + 1); + return folderPath; }; -var newFileInSpace = async (plugin, space, activeFile2, canvas) => { - let newFile; - if (canvas) { - newFile = await createNewCanvasFile( - plugin, - (space == null ? void 0 : space.def.folder.length) > 0 ? getFolderFromPath(app, space.def.folder) : defaultNoteFolder(plugin, activeFile2), - "" - ); - } else { - newFile = await createNewMarkdownFile( - plugin, - (space == null ? void 0 : space.def.folder.length) > 0 ? getFolderFromPath(app, space.def.folder) : defaultNoteFolder(plugin, activeFile2), - "" - ); - } - if (space.name != "/") - addPathsToSpace(plugin, space.name, [newFile.path]); +var openFile = async (file, plugin, newLeaf) => { + openAFile(getAbstractFileAtPath(plugin.app, file.path), plugin, newLeaf); }; - -// src/utils/contexts/contexts.ts -var renameContext = (plugin, context, newName) => { - var _a2; - if (context.type == "tag") { - renameTag(plugin, tagPathToTag(context.contextPath), newName); - } else if (context.type == "space") { - const space = (_a2 = plugin.index.spacesIndex.get(spaceNameFromContextPath(context.contextPath))) == null ? void 0 : _a2.space; - if (space) { - saveSpace(plugin, space.name, { ...space, name: newName }); - } - } else if (context.type == "folder") { - renameFile(plugin, getAbstractFileAtPath(app, context.contextPath), newName); +var openSpace = async (spaceName, plugin, newLeaf) => { + if (!plugin.settings.contextEnabled) + return; + const leaf = app.workspace.getLeaf(newLeaf); + const viewType = CONTEXT_VIEW_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { contextPath: spaceContextPathFromName(spaceName) } + }); + await app.workspace.requestSaveLayout(); + if (platformIsMobile()) { + app.workspace.leftSplit.collapse(); } + const evt = new CustomEvent(eventTypes.activePathChange, { + detail: { path: pathByString(spaceContextPathFromName(spaceName)) } + }); + window.dispatchEvent(evt); }; -var contextEmbedStringFromContext = (context, schema) => { - if (context.type == "folder") { - if (context.contextPath == "/") - return `![![/#^${schema}]]`; - return `![![${context.contextPath}/#^${schema}]]`; +var openURL = async (url) => { + const leaf = app.workspace.getLeaf(false); + if (url.endsWith(".md")) { + const viewType = FILE_VIEW_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: url } + }); + await app.workspace.requestSaveLayout(); + } else if (url.endsWith(".mdb")) { + const viewType = CONTEXT_VIEW_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { contextPath: url } + }); + await app.workspace.requestSaveLayout(); + } + if (platformIsMobile()) { + app.workspace.leftSplit.collapse(); } - return `![![${context.contextPath}#^${schema}]]`; -}; -var spaceContextFromSpace = (plugin, space, readOnly) => { - return { - type: "space", - sticker: "", - banner: "", - contextPath: space, - isRemote: false, - readOnly, - dbPath: getFolderPathFromString(plugin.settings.tagContextFolder) + "/" + spaceNameFromContextPath(space) + ".mdb" - }; -}; -var tagContextFromTag = (plugin, tag, readOnly) => { - return { - type: "tag", - sticker: "", - banner: "", - contextPath: tag, - isRemote: false, - readOnly, - dbPath: getFolderPathFromString(plugin.settings.tagContextFolder) + "/" + tagToTagPath(tag) + ".mdb" - }; }; -var mdbContextByDBPath = (plugin, dbPath) => { - if (dbPath.match(urlRegex)) { - return remoteContextFromURL(plugin, dbPath); +function getAllFoldersInVault(app2) { + const folders = []; + const rootFolder = app2.vault.getRoot(); + folders.push(rootFolder); + function recursiveFx(folder) { + for (const child of folder.children) { + if (child instanceof import_obsidian41.TFolder) { + const childFolder = child; + folders.push(childFolder); + if (childFolder.children) + recursiveFx(childFolder); + } + } } - if (dbPath.startsWith(plugin.settings.tagContextFolder)) { - const contextPath = filePathToString(dbPath); - if (contextPath.charAt(0) == "#") - return tagContextFromTag(plugin, tagPathToTag(dbPath)); - return spaceContextFromSpace(plugin, spaceContextPathFromName(contextPath)); + recursiveFx(rootFolder); + return folders; +} +var openAFile = async (file, plugin, newLeaf) => { + if (file instanceof import_obsidian41.TFolder) { + openTFolder(file, plugin, newLeaf); + } else if (file instanceof import_obsidian41.TFile) { + openTFile(file, plugin, newLeaf); } - return dbPath.endsWith((plugin == null ? void 0 : plugin.settings.folderContextFile) + ".mdb") ? folderContextFromFolder(plugin, getFolderFromPath(app, dbPath).path) : null; + let evt = new CustomEvent(eventTypes.activePathChange, { + detail: { path: pathByString(file.path) } + }); + window.dispatchEvent(evt); }; -var remoteContextFromURL = (plugin, url) => { - return { - type: "unknown", - sticker: "", - banner: "", - contextPath: url, - isRemote: true, - readOnly: true, - dbPath: url - }; +var openTFile = async (file, plugin, newLeaf) => { + let leaf = app.workspace.getLeaf(newLeaf); + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.openFile(file, { eState: { focus: true } }); + const fileCache = plugin.index.filesIndex.get(file.path); + if ((fileCache == null ? void 0 : fileCache.sticker) && leaf.tabHeaderInnerIconEl) { + const icon = stickerFromString(fileCache.sticker, plugin); + leaf.tabHeaderInnerIconEl.innerHTML = icon; + } }; -var mdbContextByPath = (plugin, contextPath) => { - if (!contextPath) +var openTFolder = async (file, plugin, newLeaf) => { + if (!plugin.settings.contextEnabled) return; - if (contextPath.match(urlRegex)) { - return remoteContextFromURL(plugin, contextPath); + let leaf = app.workspace.getLeaf(newLeaf); + const viewType = CONTEXT_VIEW_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { contextPath: file.path } + }); + const fileCache = plugin.index.filesIndex.get(file.path); + if ((fileCache == null ? void 0 : fileCache.sticker) && leaf.tabHeaderInnerIconEl) { + const icon = stickerFromString(fileCache.sticker, plugin); + leaf.tabHeaderInnerIconEl.innerHTML = icon; } - const viewType = pathTypeByString(contextPath); - if (viewType == "space") { - return spaceContextFromSpace(plugin, contextPath); - } else if (viewType == "folder") { - return folderContextFromFolder(plugin, removeTrailingSlashFromFolder(contextPath)); - } else if (viewType == "tag") { - return tagContextFromTag(plugin, contextPath); + await app.workspace.requestSaveLayout(); + if (platformIsMobile()) { + app.workspace.leftSplit.collapse(); } - return null; }; -var folderContextFromFolder = (plugin, folder, readOnly) => { - return { - type: "folder", - sticker: "", - banner: "", - contextPath: folder, - isRemote: false, - readOnly, - dbPath: (folder == "/" ? "" : folder + "/") + plugin.settings.folderContextFile + ".mdb" - }; +var openTagContext = async (tag, plugin, newLeaf) => { + let leaf = app.workspace.getLeaf(newLeaf); + const viewType = CONTEXT_VIEW_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ type: viewType, state: { contextPath: tag } }); + await app.workspace.requestSaveLayout(); + if (platformIsMobile()) { + app.workspace.leftSplit.collapse(); + } + const evt = new CustomEvent(eventTypes.activePathChange, { + detail: { path: pathByString(tag) } + }); + window.dispatchEvent(evt); }; -var linkContextRow = (plugin, row, fields) => { - return { - ...row, - ...fields.filter((f4) => f4.type == "fileprop").reduce((p3, c4) => { - const { field, property } = parsePropString(c4.value); - const col = fields.find((f4) => f4.name == field); - if (!col || !property) { - return p3; - } - if (col.type == "file" || col.type == "link") { - return { - ...p3, - [c4.name]: appendFilesMetaData(plugin, property, row[col.name]) - }; - } - if (col.type.includes("context")) { - const context = col.value; - const contextCache = plugin.index.contextsIndex.get(context); - if (contextCache) { - return { - ...p3, - [c4.name]: linkContextProp( - property, - row[col.name], - contextCache.rows - ) - }; - } - } - return p3; - }, {}) - }; +var getAbstractFileAtPath = (app2, path) => { + return app2.vault.getAbstractFileByPath(path); }; -var linkContextProp = (propType, rows, contextTableRows) => { - const contextRows = contextTableRows.filter( - (f4) => parseMultiString(rows).contains(f4.File) - ); - return serializeMultiString(uniq(contextRows.map((f4) => f4[propType]).filter((f4) => f4))); +var abstractFileAtPathExists = (app2, path) => { + return app2.vault.getAbstractFileByPath(path) ? true : false; }; - -// src/utils/contexts/mdtable.ts -var createTable2 = (object, columns) => { - const columnNames = columns.map((f4) => f4.name); - const base = "|"; - let outputString = base + columnNames.join(base) + "|\n"; - columns.forEach((f4) => { - outputString += base + "----"; +var openFileInNewPane = (plugin, file) => { + openFile(file, plugin, true); +}; +var createNewCanvasFile = async (plugin, folder, newFileName, dontOpen) => { + const newFile = await app.fileManager.createNewMarkdownFile( + folder, + newFileName + ); + await app.vault.modify(newFile, "{}"); + await renameFile( + plugin, + newFile, + newFile.name.substring(0, newFile.name.lastIndexOf(".")) + ".canvas" + ); + if (dontOpen) { + return newFile; + } + await openAFile(newFile, plugin, false); + const evt = new CustomEvent(eventTypes.activePathChange, { + detail: { path: pathByString(newFile.path) } }); - outputString += base + "\n"; - object.forEach((row) => { - outputString += columnNames.map((c4) => base + row[c4]).join("") + "|\n"; + window.dispatchEvent(evt); + return newFile; +}; +var createNewMarkdownFile = async (plugin, folder, newFileName, content, dontOpen) => { + const newFile = await app.fileManager.createNewMarkdownFile( + folder, + newFileName + ); + if (content && content !== "") + await app.vault.modify(newFile, content); + if (dontOpen) { + return newFile; + } + await openAFile(newFile, plugin, false); + const titleEl = app.workspace.activeLeaf.view.containerEl.querySelector( + ".inline-title" + ); + if (titleEl) { + titleEl.focus(); + selectElementContents(titleEl); + } + const evt = new CustomEvent(eventTypes.activePathChange, { + detail: { path: pathByString(newFile.path) } }); - return outputString; + window.dispatchEvent(evt); + return newFile; }; - -// src/cm-extensions/flowEditor/flowEditor.tsx -var toggleFlowEditor = import_state6.Annotation.define(); -var cacheFlowEditorHeight = import_state6.Annotation.define(); -var preloadFlowEditor = import_state6.EditorState.transactionFilter.of( - (tr) => { - let newTrans = []; - const value = tr.state.field(flowEditorInfo, false); - if (value && !tr.annotation(toggleFlowEditor)) { - newTrans.push( - ...value.filter((f4) => f4.expandedState == 1).map((f4) => { - if (tr.state.field(flowTypeStateField, false) == "doc") { - return { - annotations: toggleFlowEditor.of([f4.id, 2]) - }; - } else { - return { - annotations: toggleFlowEditor.of([f4.id, 0]) - }; - } - }) - ); +var platformIsMobile = () => { + return import_obsidian41.Platform.isMobile; +}; +var newFileInFolder = async (plugin, data, dontOpen) => { + await createNewMarkdownFile( + plugin, + data.parent.children.find((f4) => f4.name == data.name), + "", + "", + dontOpen + ); +}; +var noteToFolderNote = async (plugin, file, open) => { + const folderPath = fileNameToString(file.path); + const folder = getAbstractFileAtPath(app, folderPath); + if (folder && folder instanceof import_obsidian41.TFolder) { + if (open) { + openTFolder(folder, plugin, false); } - return [tr, ...newTrans]; + return; } -); -var internalLinkToggle = import_view4.ViewPlugin.fromClass( - class { - constructor(view) { - } - }, - { - eventHandlers: { - mousedown: (e4, view) => { - if (!e4.shiftKey) { - return; - } - let pos = view.posAtDOM(e4.target); - let { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); - for (let match2 of text2.matchAll(/(?!\!)\[\[([^\]]+)\]\]/g)) { - const stateField = view.state.field(flowEditorInfo, false); - const info = stateField.find( - (f4) => f4.to == lineFrom + match2.index + match2[1].length + 2 && pos >= f4.from && pos <= f4.to - ); - if (info) { - e4.preventDefault(); - view.dispatch({ - annotations: toggleFlowEditor.of([info.id, 2]) - }); - } - } - } - } + await app.vault.createFolder(folderPath); + plugin.index.filesIndex.delete(file.path); + const newFolderNotePath = folderNotePathFromAFile(plugin.settings, tFileToAFile(getAbstractFileAtPath(app, folderPath))); + if (newFolderNotePath != file.path) { + await app.vault.rename(file, newFolderNotePath); } -); -var internalLinkHover = hoverTooltip((view, pos, side) => { - let { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); - let hovObject = null; - iterateTreeInSelection({ from: lineFrom, to: lineTo }, view.state, { - enter: ({ name, from, to }) => { - if (name.contains("hmd-internal-link") && pos <= to && pos >= from) { - const stateField = view.state.field(flowEditorInfo, false); - const info = stateField.find((f4) => f4.to == to); - if (info) { - hovObject = { - pos, - end: to, - above: true, - create(view2) { - let dom = document.createElement("div"); - dom.toggleClass("mk-flow-hover", true); - dom.toggleClass("menu", true); - const openHoverDiv = dom.createDiv(); - openHoverDiv.setAttribute( - "aria-label", - info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow - ); - openHoverDiv.addEventListener("click", () => { - view2.dispatch({ - annotations: toggleFlowEditor.of([info.id, 2]) - }); - }); - const icon = openHoverDiv.createDiv(); - icon.innerHTML = uiIconSet["mk-ui-flow-hover"]; - openHoverDiv.insertAdjacentText( - "beforeend", - info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow - ); - return { dom }; - } - }; - return false; - } - } + if (open) { + openTFolder(getAbstractFileAtPath(app, folderPath), plugin, false); + } +}; +var folderNoteCache = (plugin, file) => { + if (!file.extension || file.extension.length == 0) { + const folderNotePath = folderNotePathFromAFile(plugin.settings, file); + if (abstractFileAtPathExists(app, folderNotePath)) { + return { + folderNotePath, + folderPath: file.path + }; } - }); - return hovObject; -}); -var flowEditorInfo = import_state6.StateField.define({ - create() { - return []; - }, - update(value, tr) { - var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k, _l; - let newValues = []; - const previous = value; - let usedContainers = []; - let str = tr.newDoc.sliceString(0); - const reverseExpandedState = (state) => { - const news = state != 2 ? 2 : 0; - return news; - }; - for (let match2 of str.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)) { - const link = match2[1]; - const existingLinks = previous.filter((f4) => f4.link == link); - const offset = usedContainers.filter((f4) => f4 == link).length; - const existingInfo = existingLinks[offset]; - const id2 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); - const info = { - id: id2, - link: match2[1], - startOfLineFix: false, - from: match2.index + 4, - to: match2.index + 4 + match2[1].length, - embed: 1, - height: existingInfo ? ((_a2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _a2[0]) == id2 && ((_b2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _b2[1]) != 0 ? (_c2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _c2[1] : existingInfo.height : -1, - expandedState: existingInfo ? ((_d2 = tr.annotation(toggleFlowEditor)) == null ? void 0 : _d2[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + } else if (file.extension == "md") { + const folderPath = getAbstractFileAtPath(app, folderPathFromFolderNoteFile(plugin.settings, file)); + if (folderPath instanceof import_obsidian41.TFolder && folderPath.name == file.name) { + return { + folderNotePath: file.path, + folderPath: folderPath.path }; - newValues.push(info); } - for (let match2 of str.matchAll(/\[\[([^\]]+)\]\]/g)) { - if (str.charAt(match2.index - 1) != "!") { - const link = match2[1]; - const existingLinks = previous.filter((f4) => f4.link == link); - const offset = usedContainers.filter((f4) => f4 == link).length; - const existingInfo = existingLinks[offset]; - const id2 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); - const info = { - id: id2, - link: match2[1], - startOfLineFix: false, - from: match2.index + 2, - to: match2.index + 2 + match2[1].length, - embed: 0, - height: existingInfo ? ((_e2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _e2[0]) == id2 && ((_f = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _f[1]) != 0 ? (_g = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _g[1] : existingInfo.height : -1, - expandedState: existingInfo ? ((_h = tr.annotation(toggleFlowEditor)) == null ? void 0 : _h[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 - }; - newValues.push(info); - } else if (str.charAt(match2.index - 2) != "!") { - const link = match2[1]; - const existingLinks = previous.filter((f4) => f4.link == link); - const offset = usedContainers.filter((f4) => f4 == link).length; - const existingInfo = existingLinks[offset]; - const id2 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); - const info = { - id: id2, - link: match2[1], - startOfLineFix: false, - from: match2.index + 3, - to: match2.index + 3 + match2[1].length, - embed: 2, - height: existingInfo ? ((_i = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _i[0]) == id2 && ((_j = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _j[1]) != 0 ? (_k = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _k[1] : existingInfo.height : -1, - expandedState: existingInfo ? ((_l = tr.annotation(toggleFlowEditor)) == null ? void 0 : _l[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 - }; - newValues.push(info); + } + return null; +}; + +// src/components/ui/modals/vaultChangeModals.ts +var VaultChangeModal = class extends import_obsidian42.Modal { + constructor(plugin, file, action, space) { + super(plugin.app); + this.file = file; + this.action = action; + this.plugin = plugin; + this.space = space; + } + onOpen() { + const { contentEl } = this; + const myModal = this; + let headerText; + if (this.action === "rename") { + headerText = i18n_default.labels.rename; + } else if (this.action === "create folder") { + headerText = i18n_default.labels.createFolder; + } else if (this.action === "create note") { + headerText = i18n_default.labels.createNote; + } + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const inputEl = contentEl.createEl("input"); + inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; + if (this.action === "rename") { + if (this.file instanceof import_obsidian42.TFolder) { + inputEl.value = this.file.name; + } else { + inputEl.value = this.file.name.substring( + 0, + indexOfCharElseEOS(".", this.file.name) + ); } } - newValues.sort(compareByField("from", true)); - return newValues; - } -}); -var flowEditorRangeset = (state, plugin) => { - let builder = new import_state6.RangeSetBuilder(); - const infoFields = state.field(flowEditorInfo, false); - for (let info of infoFields) { - const { from, to, embed: embedType, expandedState } = info; - const lineFix = from - 3 == state.doc.lineAt(from).from && to + 2 == state.doc.lineAt(from).to; - if (expandedState == 2) { - if (embedType == 1) { - if (!(state.selection.main.from == from - 4 && state.selection.main.to == to + 2 || state.selection.main.from >= from - 3 && state.selection.main.to <= to + 1)) { - builder.add(from - 4, from - 3, flowEditorSelector(info, plugin)); - if (lineFix) { - builder.add(from - 3, to + 2, flowEditorWidgetDecoration(info)); - } else { - builder.add(from - 3, to + 2, flowEditorDecoration(info)); - } + inputEl.focus(); + let changeButtonText; + if (this.action === "rename") { + changeButtonText = i18n_default.buttons.rename; + } else if (this.action === "create folder") { + changeButtonText = i18n_default.buttons.createFolder; + } else if (this.action === "create note") { + changeButtonText = i18n_default.buttons.createNote; + } + const changeButton = contentEl.createEl("button", { + text: changeButtonText + }); + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel + }); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + myModal.close(); + }); + const onClickAction = async () => { + let newName = inputEl.value; + if (this.action === "rename") { + if (this.file instanceof import_obsidian42.TFile) { + newName = this.file.name.lastIndexOf(".") == -1 ? newName : newName + this.file.name.substring(this.file.name.lastIndexOf(".")); } - } else if (embedType == 0) { - builder.add(to + 2, to + 2, flowEditorDecoration(info)); + renameFile(this.plugin, this.file, newName); + } else if (this.action === "create folder") { + const path = !this.file || this.file.path == "/" ? newName : this.file.path + "/" + newName; + if (getAbstractFileAtPath(app, path)) { + new import_obsidian42.Notice(i18n_default.notice.folderExists); + return; + } + this.app.vault.createFolder(path); + if (this.space != "/") + addPathsToSpace(this.plugin, this.space, [path]); } - } + myModal.close(); + }; + changeButton.addEventListener("click", onClickAction); + inputEl.addEventListener("keydown", (e4) => { + if (e4.key === "Enter") + onClickAction(); + }); + } + onClose() { + const { contentEl } = this; + contentEl.empty(); } - const dec = builder.finish(); - return dec; }; -var flowEditorField = (plugin) => import_state6.StateField.define({ - create(state) { - return flowEditorRangeset(state, plugin); - }, - update(value, tr) { - return flowEditorRangeset(tr.state, plugin); - }, - provide: (f4) => import_view4.EditorView.decorations.from(f4) -}); -var FlowEditorWidget = class extends import_view4.WidgetType { - constructor(info) { - super(); - this.info = info; +var MoveSuggestionModal = class extends import_obsidian42.FuzzySuggestModal { + constructor(app2, files) { + super(app2); + this.files = files; } - eq(other) { - return other.info.id === this.info.id; + getItemText(item) { + return item.path; } - toDOM(view) { - const div = document.createElement("div"); - div.toggleClass("mk-floweditor-container", true); - div.toggleClass("mk-floweditor-fix", this.info.startOfLineFix); - div.setAttribute("id", "mk-flow-" + this.info.id); - const placeholder2 = div.createDiv("mk-floweditor-placeholder"); - placeholder2.style.setProperty("height", this.info.height + "px"); - loadFlowEditorByDOM(div, view, this.info.id); - return div; + getItems() { + return getAllFoldersInVault(this.app); } - get estimatedHeight() { - return this.info.height; + onChooseItem(item, evt) { + this.files.forEach((f4) => { + const file = getAbstractFileAtPath(app, f4); + if (file) { + this.app.vault.rename(file, item.path + "/" + file.name); + } + }); } }; -var FlowEditorSelector = class extends import_view4.WidgetType { - constructor(info, plugin) { - super(); - this.info = info; - this.flowInfo = info; +var AddToSpaceModal = class extends import_obsidian42.FuzzySuggestModal { + constructor(plugin, files) { + super(app); this.plugin = plugin; + this.files = files; } - eq(other) { - return false; + getItemText(space) { + return space.name; } - toDOM(view) { - const div = document.createElement("div"); - div.toggleClass("mk-floweditor-selector", true); - const reactEl = createRoot(div); - if (this.info.link && view.state.field(import_obsidian40.editorInfoField, false)) { - const infoField = view.state.field(import_obsidian40.editorInfoField, false); - const file = infoField.file; - const path = pathByString(this.info.link, file.path); - reactEl.render( - /* @__PURE__ */ Cn.createElement(FlowEditorHover, { - toggle: true, - path: path.path, - type: path.type, - toggleState: true, - convertTable: () => { - const context = mdbContextByPath(this.plugin, path.path); - getMDBTable( - this.plugin, - context, - path.ref.substring(1, path.ref.length) - ).then((mdbTable) => { - const markdown = createTable2(mdbTable.rows, mdbTable.cols); - view.dispatch({ - changes: { - from: this.info.from - 4, - to: this.info.to + 2, - insert: markdown - } - }); - }); - }, - cutTable: () => { - navigator.clipboard.writeText(`![![${this.info.link}]]`); - view.dispatch({ - changes: { from: this.info.from - 4, to: this.info.to + 2 } - }); - }, - deleteTable: () => { - view.dispatch({ - changes: { from: this.info.from - 4, to: this.info.to + 2 } - }); - }, - toggleFlow: () => { - view.dispatch({ - changes: { from: this.info.from - 4, to: this.info.from - 3 } - }); - }, - openLink: () => { - openFileFlowEditor(this.flowInfo.link, "/"); - } - }) - ); - } - return div; + getItems() { + return this.plugin.index.allSpaces().filter((f4) => f4.def.type == "focus"); } -}; -var flowEditorSelector = (info, plugin) => import_view4.Decoration.replace({ - widget: new FlowEditorSelector(info, plugin), - inclusive: true, - block: false -}); -var flowEditorDecoration = (info) => import_view4.Decoration.replace({ - widget: new FlowEditorWidget(info), - inclusive: true, - block: false -}); -var flowEditorWidgetDecoration = (info) => import_view4.Decoration.widget({ - widget: new FlowEditorWidget(info), - block: true -}); - -// src/cm-extensions/flowEditor/flowViewUpdates.ts -var import_view5 = require("@codemirror/view"); -var flowViewUpdates = import_view5.EditorView.updateListener.of((v3) => { - if (v3.heightChanged) { - app.workspace.iterateRootLeaves((leaf) => { - var _a2, _b2; - const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; - if (cm && v3.view.dom == cm.dom && cm.state.field(flowTypeStateField, false)) { - if ((_b2 = leaf.containerEl.parentElement) == null ? void 0 : _b2.hasClass("workspace-tab-container")) { - if (cm.state.field(flowTypeStateField, false) != "doc") { - cm.dispatch({ - annotations: portalTypeAnnotation.of("doc") - }); - } + onChooseItem(space, evt) { + this.files.forEach((f4) => { + var _a2; + const file = this.plugin.index.filesIndex.get(f4); + if (file) { + if (((_a2 = space.def.folder) == null ? void 0 : _a2.length) > 0) { + moveAFileToNewParentAtIndex(this.plugin, file, space.def.folder, 0); + } else { + insertSpaceItemAtIndex(this.plugin, space.name, file.path, 0); } } }); } - if (v3.heightChanged) { - const flowID = v3.state.field(flowIDStateField, false); - if (flowID) { - app.workspace.iterateLeaves((leaf) => { - var _a2; - const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; - if (cm) { - const stateField = cm.state.field(flowEditorInfo, false); - if (stateField) { - if (stateField.find((f4) => f4.id == flowID)) { - cm.dispatch({ - annotations: cacheFlowEditorHeight.of([ - flowID, - v3.view.contentHeight - ]) - }); - } - } - } - }, app.workspace["rootSplit"]); - } +}; +var RemoveFromSpaceModal = class extends import_obsidian42.FuzzySuggestModal { + constructor(plugin, file) { + super(app); + this.plugin = plugin; + this.file = this.plugin.index.filesIndex.get(file); } -}); + getItemText(space) { + return space.name; + } + getItems() { + return this.file ? this.plugin.index.allSpaces().filter((f4) => { + var _a2; + return f4.def.type == "focus" && !(((_a2 = f4.def.folder) == null ? void 0 : _a2.length) > 0) && this.file.spaces.includes(f4.name); + }) : []; + } + onChooseItem(space, evt) { + removePathsFromSpace(this.plugin, space.name, [this.file.path]); + } +}; -// src/cm-extensions/inlineStylerView/inlineStyler.tsx -var import_state8 = require("@codemirror/state"); +// src/superstate/spacesStore/spaces.ts +var import_lodash8 = __toESM(require_lodash()); +var import_obsidian43 = require("obsidian"); -// src/cm-extensions/inlineStylerView/InlineMenu.tsx -var import_classnames5 = __toESM(require_classnames()); +// src/schemas/spaces.ts +var vaultSchema = { + uniques: ["path"], + cols: ["path", "parent", "created", "sticker", "color", "folder", "rank"], + rows: [] +}; +var spaceSchema = { + uniques: ["name"], + cols: ["name", "sticker", "color", "pinned", "sort", "def", "rank"], + rows: [] +}; +var spaceItemsSchema = { + uniques: [], + cols: ["space", "path", "rank"], + rows: [] +}; -// src/cm-extensions/inlineStylerView/marks.ts -var import_state7 = require("@codemirror/state"); +// src/superstate/cacheParsers.ts +var import_lodash7 = __toESM(require_lodash()); +var fileMetadataToVaultItem = (cache) => { + var _a2, _b2; + return { + path: cache.path, + parent: cache.parent, + color: cache.color, + created: (_b2 = (_a2 = cache.ctime) == null ? void 0 : _a2.toString()) != null ? _b2 : "", + sticker: cache.sticker, + folder: cache.isFolder ? "true" : "false", + rank: cache.rank + }; +}; +var parseSpaceCache = (space, spaceItems) => { + return { + name: space.name, + space, + spaceItems + }; +}; -// src/cm-extensions/markSans/obsidianSyntax.ts -var oMarks = [ - { - mark: "em", - formatting: "formatting-em", - altFormatting: "em_formatting_formatting-strong", - formatChar: "*" - }, - { - mark: "strong", - formatting: "formatting-strong", - formatChar: "**" - }, - { - mark: "strikethrough", - formatting: "formatting-strikethrough", - formatChar: "~~" - }, - { - mark: "inline-code", - formatting: "formatting-code", - formatChar: "`" +// src/superstate/spacesStore/spaces.ts +var rebuildIndex = async (plugin, save) => { + var _a2, _b2; + console.time("Make.md Vault Index"); + const newTables = indexCurrentFileTree(plugin, (_a2 = plugin.index.vaultDBCache) != null ? _a2 : [], (_b2 = plugin.index.spacesItemsDBCache) != null ? _b2 : []); + if (save && (!import_lodash8.default.isEqual(newTables.vault.rows, plugin.index.vaultDBCache) || !import_lodash8.default.isEqual(newTables.spaceItems.rows, plugin.index.spacesItemsDBCache))) { + await plugin.index.saveSpacesDatabaseToDisk(newTables, save); } -]; - -// src/cm-extensions/inlineStylerView/marks.ts -var toggleMark = import_state7.Annotation.define(); -var trimSpace = (pos, moveDirLeft, state) => { - if (moveDirLeft && state.sliceDoc(pos, pos + 1) == " ") - return pos + 1; - if (!moveDirLeft && state.sliceDoc(pos - 1, pos) == " ") - return pos - 1; - return pos; + plugin.index.initialize(); + console.timeEnd("Make.md Vault Index"); }; -var newPosAfterFormatting = (pos, moveDirLeft, state) => { - const line = state.doc.lineAt(pos); - const start = moveDirLeft ? line.from : pos; - const end = moveDirLeft ? pos : line.to; - let newPos = start; - let lastFormatPos = start; - let exitFormatRange = false; - iterateTreeInSelection({ from: start, to: end }, state, { - enter: (node) => { - if (exitFormatRange) - return false; - if (node.name.contains("formatting")) { - if (!moveDirLeft && node.from > start) { - return false; - } - if (moveDirLeft) { - newPos = node.from; - lastFormatPos = node.to; - } else { - newPos = node.to; - } - } - } - }); - if (moveDirLeft && lastFormatPos < pos) { - newPos = pos; +var spaceToTreeNode = (space, collapsed, sortable) => { + return { + id: space.name, + spaceItem: space, + parentId: null, + depth: 0, + index: 0, + space: space.name, + path: space.name + "//", + item: null, + collapsed, + sortable, + childrenCount: 0 + }; +}; +var vaulItemToTreeNode = (item, space, path, depth, i4, collapsed, sortable, childrenCount) => ({ + item, + file: getAbstractFileAtPath(app, item.path), + space, + id: (space == "/" ? "" : space) + "//" + item.path, + parentId: (space == "/" ? "" : space) + "//" + path, + depth, + path, + index: i4, + collapsed, + sortable, + childrenCount +}); +var spaceRowHeight = (plugin) => { + return platformIsMobile() ? 40 : plugin.settings.spaceRowHeight; +}; +var folderSortFn = (sortStrategy, direction) => (a5, b4) => { + var _a2, _b2; + if (sortStrategy == "rank") { + return ((_a2 = a5.rank) != null ? _a2 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); } - return newPos; + const sortFns = [ + compareByField("isFolder", false), + compareByField(sortStrategy, direction) + ]; + return sortFns.reduce((p3, c4) => { + return p3 == 0 ? c4(a5, b4) : p3; + }, 0); }; -var expandRange = (selection, state) => { - const from = trimSpace( - newPosAfterFormatting(selection.from, true, state), - true, - state - ); - const to = trimSpace( - newPosAfterFormatting(selection.to, false, state), - false, - state - ); - return { from, to }; +var flattenedTreeFromVaultItems = (root, space, vaultItems, openNodes, depth, sortStrategy, direction) => { + if (!vaultItems[root]) { + return []; + } + const flattenTree = (path, vaultItems2, openNodes2, depth2, index, folderSort) => { + const items = []; + let i4 = index; + const [sortStrat, dir] = folderSort.length > 0 ? parseSortStrat(folderSort) : [sortStrategy, direction]; + vaultItems2[path].sort(folderSortFn(sortStrat, dir)).forEach((item) => { + const collapsed = !openNodes2.includes(item.path); + i4 = i4 + 1; + const newItems = []; + if (vaultItems2[item.path] && !collapsed) { + newItems.push( + ...flattenTree(item.path, vaultItems2, openNodes2, depth2 + 1, i4, item.folderSort) + ); + } + const node = vaulItemToTreeNode( + item, + space, + path, + depth2, + i4, + collapsed, + sortStrategy == "rank", + newItems.length + ); + if (node.file) + newItems.splice(0, 0, node); + items.push(...newItems); + }); + return items; + }; + return flattenTree(root, vaultItems, openNodes, depth, 0, ""); }; -var addMarkAtPos = (pos, mark) => ({ - changes: { from: pos, to: pos, insert: mark.formatChar } -}); -var rangeIsMark = (state, mark, selection) => posIsMark(selection.from, state, mark.mark) && posIsMark(selection.to, state, mark.mark); -var posIsMark = (pos, state, markString) => { - let isMark = false; - iterateTreeAtPos(pos, state, { - enter: ({ name, from, to }) => { - if (nodeNameContainsMark(name, markString)) - isMark = true; - } - }); - return isMark; +var vaultItemForPath = (plugin, path) => { + if (!path) + return null; + return plugin.index.vaultDBCache.find((f4) => f4.path == path); }; -var nodeNameContainsMark = (name, markString) => { - return name.contains(markString); +var saveFileSticker = async (plugin, path, sticker) => { + if (plugin.settings.spacesEnabled) { + const newVaultDB = plugin.index.vaultDBCache.map((f4) => f4.path == path ? { ...f4, sticker } : f4); + await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); + } + saveFrontmatterValue( + plugin, + path, + plugin.settings.fmKeySticker, + sticker, + "text", + true + ); + plugin.index.reloadFile(getAbstractFileAtPath(app, path)).then((f4) => plugin.index.broadcast("space")); }; -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 = (range, mark, state) => { - let newTrans = []; - if (rangeIsMark(state, mark, range)) { - if (edgeIsMarkFormat(range.from, state, mark) && !edgeIsMarkFormat(range.to, state, mark)) { - newTrans.push(addMarkAtPos(range.to, mark)); - } - if (edgeIsMarkFormat(range.to, state, mark) && !edgeIsMarkFormat(range.from, state, mark)) { - newTrans.push(addMarkAtPos(range.from, mark)); - } - } else if (edgeIsMark(range.from, state, mark)) { - if (edgeIsMarkFormat(range.from, state, mark) && !edgeIsMark(range.from - 1, state, mark)) { - newTrans.push(addMarkAtPos(range.from, mark)); - } - newTrans.push(addMarkAtPos(range.to, mark)); - } else if (edgeIsMark(range.to, state, mark)) { - if (edgeIsMarkFormat(range.to, state, mark) && !edgeIsMark(range.to + 1, state, mark)) { - newTrans.push(addMarkAtPos(range.to, mark)); - } - newTrans.push(addMarkAtPos(range.from, mark)); - } else { - newTrans.push(addMarkAtPos(range.to, mark)); - newTrans.push(addMarkAtPos(range.from, mark)); +var saveFolderSort = async (plugin, path, sort) => { + if (plugin.settings.spacesEnabled) { + const newVaultDB = plugin.index.vaultDBCache.map((f4) => f4.path == path ? { ...f4, folder: sort } : f4); + await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); + plugin.index.reloadFile(getAbstractFileAtPath(app, path)).then((f4) => plugin.index.broadcast("vault")); } - return newTrans; }; -var removeAllInternalMarks = (sel, state, mark) => { - let returnTrans = []; - iterateTreeInSelection({ from: sel.from, to: sel.to }, state, { - enter: ({ name, from, to }) => { - if (nodeNameContainsMark(name, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name, mark.altFormatting) : false)) - returnTrans.push({ - from, - to: from + mark.formatChar.length - }); +var saveFileColor = async (plugin, path, color) => { + if (plugin.settings.spacesEnabled) { + const newVaultDB = plugin.index.vaultDBCache.map((f4) => f4.path == path ? { ...f4, color } : f4); + await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); + } + saveFrontmatterValue( + plugin, + path, + plugin.settings.fmKeyColor, + color, + "text", + true + ); + plugin.index.reloadFile(getAbstractFileAtPath(app, path)).then((f4) => plugin.index.broadcast("space")); +}; +var saveSpaceSticker = async (plugin, name, sticker) => { + const newSpaceDB = plugin.index.spacesDBCache.map((f4) => f4.name == name ? { ...f4, sticker } : f4); + await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceDB } }); + plugin.index.reloadSpace(name); +}; +var updateFileRank = async (plugin, item, rank) => { + let fixedRank = rank; + if (parseInt(item.rank) > rank) + fixedRank = rank + 1; + const newItems = insert( + plugin.index.vaultDBCache.filter((f4) => f4.parent == item.parent).filter((f4) => f4.path != item.path).map((f4, i4) => f4.rank ? f4 : { ...f4, rank: i4.toString() }).sort( + (a5, b4) => a5.rank.localeCompare(b4.rank, void 0, { numeric: true }) + ), + fixedRank, + item + ).map((f4, index) => ({ path: f4.path, rank: index.toString() })); + const newVaultDB = plugin.index.vaultDBCache.map((f4) => { + const newItem = newItems.find((g4) => g4.path == f4.path); + if (newItem) { + return { ...f4, ...newItem }; } + return f4; }); - return { - changes: returnTrans - }; + await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); + const promises = newItems.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4.path))); + await Promise.all(promises); + plugin.index.broadcast("space"); }; -var toggleMarkExtension = import_state7.EditorState.transactionFilter.of( - (tr) => { - if (!tr.annotation(toggleMark)) - return tr; - const markToggle = tr.annotation(toggleMark); - const mark = oMarks.find((f4) => f4.mark == markToggle); - if (!mark) { - return tr; - } - const selection = tr.startState.selection.main; - let newTrans = []; - if (selection.head == selection.anchor) { - if (tr.startState.sliceDoc( - selection.head - mark.formatChar.length, - selection.head - ) == mark.formatChar && tr.startState.sliceDoc( - selection.head, - selection.head + mark.formatChar.length - ) == mark.formatChar) { - newTrans.push({ - changes: { - from: selection.head - mark.formatChar.length, - to: selection.head + mark.formatChar.length - } - }); - } else { - newTrans.push({ - changes: { - from: selection.head, - insert: mark.formatChar + mark.formatChar - }, - selection: { - anchor: selection.head + mark.formatChar.length, - head: selection.head + mark.formatChar.length - } - }); +var moveAFileToNewParentAtIndex = async (plugin, item, newParent, index) => { + var _a2; + const currFile = getAbstractFileAtPath(app, item.path); + const newPath = newParent == "/" ? currFile.name : newParent + "/" + currFile.name; + const newItem = { + ...fileMetadataToVaultItem(item), + path: newPath, + parent: newParent, + rank: index.toString() + }; + if (getAbstractFileAtPath(app, newPath)) { + new import_obsidian43.Notice(i18n_default.notice.fileExists); + return; + } + const allRows = plugin.index.vaultDBCache.filter((f4) => f4.parent == newParent); + const rows = insert( + (_a2 = allRows.sort( + (a5, b4) => { + var _a3, _b2; + return ((_a3 = a5.rank) != null ? _a3 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); } - return [tr, ...newTrans]; + )) != null ? _a2 : [], + index, + newItem + ).map((f4, i4) => ({ ...f4, rank: i4.toString() })); + const newVaultTable = [...plugin.index.vaultDBCache, newItem].filter((f4) => f4.path != item.path).map((f4) => { + const newItem2 = rows.find((g4) => g4.path == f4.path); + if (newItem2) { + return { ...f4, ...newItem2 }; } - const range = expandRange(selection, tr.startState); - newTrans.push(removeAllInternalMarks(range, tr.startState, mark)); - let newFrom = range.from; - let newTo = range.to; - newTrans.push(...transactionChangesForMark(range, mark, tr.startState)); - return [tr, ...newTrans, { selection: { anchor: newFrom, head: newTo } }]; - } -); - -// src/cm-extensions/inlineStylerView/Mark.tsx -var Mark = (props2) => { - const { i: i4, style, active, toggleMarkAction } = props2; - return /* @__PURE__ */ Cn.createElement("div", { - key: i4, - "aria-label": !platformIsMobile() ? i18n_default.styles[style.label] : void 0, - className: `mk-mark ${style.mark && active ? "mk-mark-active" : ""}`, - dangerouslySetInnerHTML: { __html: uiIconSet[style.icon] }, - onMouseDown: (e4) => toggleMarkAction(e4, style) + return f4; }); + await plugin.index.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultTable } }); + const afile = getAbstractFileAtPath(app, item.path); + await moveFile(getAbstractFileAtPath(app, newParent), afile); + const promises = rows.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4.path))); + await Promise.all(promises); + plugin.index.broadcast("space"); }; - -// src/cm-extensions/inlineStylerView/styles/default.ts -var default_default = [ - { - label: "bold", - value: `****`, - insertOffset: 2, - icon: "mk-mark-strong", - mark: "strong" - }, - { - label: "italics", - value: "**", - insertOffset: 1, - icon: "mk-mark-em", - mark: "em" - }, - { - label: "strikethrough", - value: "~~~~", - insertOffset: 2, - icon: "mk-mark-strikethrough", - mark: "strikethrough" - }, - { - label: "code", - value: "``", - insertOffset: 1, - icon: "mk-mark-code", - mark: "inline-code" - }, - { - label: "link", - value: "[]()", - insertOffset: 1, - cursorOffset: 2, - icon: "mk-mark-link" - }, - { - label: "blocklink", - value: "[[]]", - insertOffset: 2, - icon: "mk-mark-blocklink" +var insertSpaceAtIndex = async (plugin, newSpace, rank) => { + const spaces2 = plugin.index.allSpaces(); + const spaceExists = spaces2.find((f4) => f4.name == newSpace.name); + let fixedRank = rank; + let newSpaceRows = plugin.index.spacesDBCache; + if (spaceExists) { + const newRow = { ...serializeSpace(spaceExists), ...serializeSpace(newSpace) }; + newSpaceRows = newSpaceRows.map((f4) => f4.name == newRow.name ? newRow : f4); + if (parseInt(spaceExists.rank) < rank) + fixedRank = rank - 1; + } else { + const newRow = serializeSpace(newSpace); + newSpaceRows.push(newRow); } -]; - -// src/cm-extensions/inlineStylerView/styles/index.ts -function resolveStyles() { - return default_default; -} - -// src/cm-extensions/inlineStylerView/InlineMenu.tsx -var loadStylerIntoContainer = (el, plugin) => { - const root = createRoot(el); - root.render( - /* @__PURE__ */ Cn.createElement(InlineMenuComponent, { - mobile: true, - activeMarks: [], - plugin - }) - ); -}; -var InlineMenuComponent = (props2) => { - const [mode, setMode] = h2(props2.mobile ? 0 : 1); - const [colorMode, setColorMode] = h2(null); - const makeMenu = (e4) => { - var _a2; - e4.preventDefault(); - const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); - if (!cm) - return; - const end = cm.state.selection.main.to; - const insertChars = cm.state.sliceDoc(end - 1, end) == cm.state.lineBreak ? props2.plugin.settings.menuTriggerChar : cm.state.lineBreak + props2.plugin.settings.menuTriggerChar; - cm.dispatch({ - changes: { - from: end, - to: end, - insert: insertChars - }, - selection: { - head: end + insertChars.length, - anchor: end + insertChars.length - } - }); - }; - const toggleMarkAction = (e4, s5) => { - var _a2; - e4.preventDefault(); - const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); - if (!cm) - return; - if (s5.mark) { - cm.dispatch({ - annotations: toggleMark.of(s5.mark) - }); - return; + const newSpaces = insert( + spaces2.filter((f4) => f4.name != newSpace.name), + fixedRank, + newSpace + ).map((f4, index) => ({ name: f4.name, rank: index.toString() })); + newSpaceRows = newSpaceRows.map((f4) => { + const foundSpace = newSpaces.find((s5) => s5.name == f4.name); + if (foundSpace) { + return { + ...f4, + rank: foundSpace.rank + }; } - const selection = cm.state.selection.main; - const selectedText = cm.state.sliceDoc(selection.from, selection.to); - cm.dispatch({ - changes: { - from: selection.from, - to: selection.to, - insert: s5.value.substring(0, s5.insertOffset) + selectedText + s5.value.substring(s5.insertOffset) - }, - selection: s5.cursorOffset ? { - anchor: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + s5.cursorOffset, - head: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + s5.cursorOffset - } : { - anchor: selection.from + s5.value.substring(0, s5.insertOffset).length, - head: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length - } - }); + return f4; + }); + await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceRows } }); + plugin.index.initializeSpaces().then((f4) => plugin.index.initalizeFiles()); +}; +var insertSpaceItemAtIndex = async (plugin, spaceName, path, rank) => { + var _a2; + const space = (_a2 = plugin.index.spacesIndex.get(spaceName)) == null ? void 0 : _a2.space; + if (!space) + return; + const newSpace = { + space: space.name, + path, + rank: rank.toString() }; - const makeMode = () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - "aria-label": !platformIsMobile() ? i18n_default.commands.makeMenu : void 0, - onMouseDown: (e4) => { - makeMenu(e4); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-slash"] } - }), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": !platformIsMobile() ? i18n_default.commands.selectStyle : void 0, - onMouseDown: () => { - setMode(1); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-style"] } - }), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": !platformIsMobile() ? i18n_default.commands.image : void 0, - onMouseDown: () => { - const view = getActiveMarkdownView(); - props2.plugin.app.commands.commands["editor:attach-file"].editorCallback(view.editor, view); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-attach"] } - }), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": !platformIsMobile() ? i18n_default.commands.toggleKeyboard : void 0, - onMouseDown: () => { - const view = getActiveMarkdownView(); - props2.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(view.editor, view); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-keyboard"] } + const spaceExists = plugin.index.spacesItemsDBCache.filter((f4) => f4.space == space.name); + const pathExists = spaceExists.find((f4) => f4.path == path); + let fixedRank = rank; + let newSpaceItemsRows = plugin.index.spacesItemsDBCache; + if (!pathExists) { + newSpaceItemsRows.push(newSpace); + fixedRank = rank + 1; + } else { + if (parseInt(pathExists.rank) > rank) + fixedRank = rank + 1; + } + const newSpaceItems = insert( + spaceExists.filter((f4) => f4.path != path), + fixedRank, + newSpace + ).map((f4, index) => ({ + space: f4.space, + path: f4.path, + rank: index.toString() })); - const colorsMode = () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-mark", - onMouseDown: () => { - setColorMode(null); - setMode(1); - }, - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }), colors.map((c4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, - onMouseDown: () => { - var _a2; - setMode(1); - setColorMode(null); - const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); - if (!cm) - return; - const selection = cm.state.selection.main; - const selectedText = cm.state.sliceDoc( - selection.from, - selection.to - ); - cm.dispatch({ - changes: { - from: selection.from, - to: selection.to, - insert: colorMode.prefix + c4[1] + colorMode.suffix + selectedText + colorMode.closeTag - } - }); - }, - className: "mk-color", - style: { background: c4[1] } - }))); - const marksMode = () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.mobile ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-mark", - onMouseDown: () => { - setMode(0); - }, - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), resolveStyles().map((s5, i4) => { - return /* @__PURE__ */ Cn.createElement(Mark, { - i: i4, - style: s5, - active: props2.activeMarks.find((f4) => f4 == s5.mark) ? true : false, - toggleMarkAction - }); - }), props2.plugin.settings.inlineStylerColors ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-divider" - }), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": !platformIsMobile() ? i18n_default.styles.textColor : void 0, - onMouseDown: () => { - setMode(2); - setColorMode({ - prefix: ``, - closeTag: "" - }); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-mark-color"] } - }), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": !platformIsMobile() ? i18n_default.styles.highlight : void 0, - onMouseDown: () => { - setMode(2); - setColorMode({ - prefix: ``, - closeTag: "" - }); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-mark-highlight"] + newSpaceItemsRows = newSpaceItemsRows.map((f4) => { + if (f4.space != space.name) + return f4; + const foundItem = newSpaceItems.find((s5) => s5.path == f4.path); + if (foundItem) { + return { + ...f4, + ...foundItem + }; } - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); - return /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames5.default)("mk-style-menu", props2.mobile ? "" : "menu"), - onMouseDown: (e4) => e4.preventDefault() - }, mode == 0 && props2.mobile ? makeMode() : mode == 2 ? colorsMode() : marksMode()); -}; - -// src/cm-extensions/inlineStylerView/inlineStyler.tsx -var cursorTooltipField = (plugin) => import_state8.StateField.define({ - create: getCursorTooltips(plugin), - update(tooltips2, tr) { - if (!tr.docChanged && !tr.selection) - return tooltips2; - return getCursorTooltips(plugin)(tr.state); - }, - provide: (f4) => showTooltip.computeN([f4], (state) => state.field(f4)) -}); -var getCursorTooltips = (plugin) => (state) => { - return state.selection.ranges.filter((range) => !range.empty).map((range) => { - const expandedRange = expandRange(range, state); - let line = state.doc.lineAt(range.head); - let activeMarks = oMarks.map((f4) => rangeIsMark(state, f4, expandedRange) ? f4.mark : "").filter((f4) => f4 != ""); - return { - pos: Math.min(range.head, range.anchor), - above: true, - strictSide: true, - arrow: false, - create: (view) => { - let dom = document.createElement("div"); - dom.className = "cm-tooltip-cursor"; - const reactElement = createRoot(dom); - reactElement.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(InlineMenuComponent, { - plugin, - cm: view, - activeMarks, - mobile: false - })) - ); - return { dom }; - } - }; + return f4; }); + await plugin.index.saveSpacesDatabaseToDisk({ spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); + await plugin.index.reloadSpace(space.name); + const promises = newSpaceItemsRows.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4.path))); + await Promise.all(promises); + plugin.index.broadcast("vault"); }; -function cursorTooltip(plugin) { - return cursorTooltipField(plugin); -} - -// src/cm-extensions/placeholder.ts -var import_state9 = require("@codemirror/state"); -var import_view6 = require("@codemirror/view"); -var placeholderLine = import_view6.Decoration.line({ - attributes: { "data-ph": i18n_default.labels.placeholder }, - class: "mk-placeholder" -}); -var placeholder = import_state9.StateField.define({ - create() { - return import_view6.Decoration.none; - }, - update(value, tr) { - let builder = new import_state9.RangeSetBuilder(); - const currentLine = tr.state.doc.lineAt(tr.state.selection.main.head); - if ((currentLine == null ? void 0 : currentLine.length) == 0) - builder.add(currentLine.from, currentLine.from, placeholderLine); - const dec = builder.finish(); - return dec; - }, - provide: (f4) => import_view6.EditorView.decorations.from(f4) -}); - -// src/cm-extensions/inlineContext/inlineContext.tsx -var import_state10 = require("@codemirror/state"); -var import_view7 = require("@codemirror/view"); - -// src/components/FileContextView/Backlinks.tsx -var BacklinkItem = (props2) => { - const file = F2( - () => getAbstractFileAtPath(app, props2.path), - [props2.path] +var saveSpace = async (plugin, space, newSpace) => { + const newSpaceRows = plugin.index.spacesDBCache.map((f4) => f4.name == space ? serializeSpace(newSpace) : f4); + const newSpaceItemsRows = plugin.index.spacesItemsDBCache.map((f4) => f4.space == space ? { ...f4, space: newSpace.name } : f4); + await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceRows }, spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); + plugin.settings.expandedSpaces = plugin.settings.expandedSpaces.map( + (f4) => f4 == space ? newSpace.name : f4 ); - const [block, setBlock] = h2([null, null]); - const refreshBlock = (path) => { - var _a2, _b2; - const fCache = app.metadataCache.getCache(path); - const link = [...(_a2 = fCache.links) != null ? _a2 : [], ...(_b2 = fCache.embeds) != null ? _b2 : []].find( - (f4) => props2.source.includes(f4.displayText) - ); - if (link) { - const block2 = fCache.sections.find( - (f4) => f4.position.start.offset <= link.position.start.offset && f4.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]); - } - }; - p2(() => { - refreshBlock(props2.path); - }, []); - p2(() => { - refreshBlock(props2.path); - }, [props2.path]); - const [collapsed, setCollapsed] = h2(false); - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-title" - }, /* @__PURE__ */ Cn.createElement("button", { - className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, - onClick: (e4) => { - setCollapsed(!collapsed); - e4.stopPropagation(); - }, - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-collapse"] - } - }), /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => { - openAFile(file, props2.plugin, false); - e4.stopPropagation(); + plugin.saveSettings(); + if (space != newSpace.name) { + renameSpaceContextFile(plugin, space, newSpace.name); + plugin.index.renameSpace(space, newSpace.name); + } + plugin.index.reloadSpace(space); + plugin.index.initalizeFiles(); +}; +var removeSpace = async (plugin, space) => { + const newSpaceRows = plugin.index.spacesDBCache.filter((f4) => f4.name != space); + const newSpaceItemsRows = plugin.index.spacesItemsDBCache.filter((f4) => f4.space != space); + await plugin.index.saveSpacesDatabaseToDisk({ spaces: { ...spaceSchema, rows: newSpaceRows }, spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); + deleteSpaceContext(plugin, space); + plugin.index.deleteSpace(space); +}; +var updateSpaceSort = (plugin, spaceName, sort) => { + var _a2; + const space = (_a2 = plugin.index.spacesIndex.get(spaceName)) == null ? void 0 : _a2.space; + if (space) + saveSpace(plugin, spaceName, { + ...space, + sort: JSON.stringify(sort) + }); +}; +var toggleSpacePin = (plugin, spaceName, type) => { + var _a2; + const space = (_a2 = plugin.index.spacesIndex.get(spaceName)) == null ? void 0 : _a2.space; + if (space) + saveSpace(plugin, spaceName, { + ...space, + pinned: type + }); +}; +var addPathsToSpace = async (plugin, space, paths) => { + const newSpaceItemsRows = [...plugin.index.spacesItemsDBCache, ...paths.map((p3) => ({ space, path: p3 }))]; + await plugin.index.saveSpacesDatabaseToDisk({ spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); + await plugin.index.reloadSpace(space); + const promises = paths.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4))); + await Promise.all(promises); + plugin.index.broadcast("vault"); +}; +var removePathsFromSpace = async (plugin, space, paths) => { + const newSpaceItemsRows = plugin.index.spacesItemsDBCache.filter((f4) => !(f4.space == space && paths.includes(f4.path))); + await plugin.index.saveSpacesDatabaseToDisk({ spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } }); + await plugin.index.reloadSpace(space); + const promises = paths.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4))); + await Promise.all(promises); + plugin.index.broadcast("vault"); +}; +var retrieveSpaceItems = (plugin, spaces2) => { + const retrievedSpaces = {}; + spaces2.forEach((space) => { + const rows = plugin.index.spacesItemsDBCache.filter((f4) => f4.space == space.name); + retrievedSpaces[space.name] = rows.sort( + (a5, b4) => { + var _a2, _b2; + return ((_a2 = a5.rank) != null ? _a2 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); + } + ); + }); + return retrievedSpaces; +}; +var retrieveFolders = async (plugin, paths) => { + const retrievedFolders = {}; + paths.forEach((folder) => { + const files = []; + for (const k5 of plugin.index.filesIndex.values()) { + if (k5.parent == folder) + files.push(k5); } - }, fileNameToString(file.name))), !collapsed ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-backlink" - }, /* @__PURE__ */ Cn.createElement(FlowView, { - plugin: props2.plugin, - load: true, - path: props2.path, - from: block[0], - to: block[1] - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); + retrievedFolders[folder] = files.filter( + excludeVaultItemPredicate(plugin.settings) + ).map((f4) => plugin.index.filesIndex.get(f4.path)).filter((f4) => f4); + }); + return retrievedFolders; }; -var Backlinks = (props2) => { - const [collapsed, setCollapsed] = h2( - !props2.plugin.settings.inlineBacklinksExpanded +var retrieveAllRecursiveChildren = (vaultDB, settings, folder) => { + return vaultDB.filter((f4) => f4["parent"].startsWith(folder)).filter( + excludeVaultItemPredicate(settings) ); - const [backlinks, setBacklinks] = h2([]); - p2(() => { - if (!props2.file) - return; - const bls = uniq([ - ...props2.plugin.index.linksMap.getInverse(props2.file.path), - ...Object.keys(app.metadataCache.resolvedLinks).filter( - (f4) => props2.file.path in app.metadataCache.resolvedLinks[f4] - ) - ]).filter((f4) => abstractFileAtPathExists(app, f4)); - setBacklinks(bls); - }, [props2.file]); - p2(() => { - props2.plugin.settings.inlineBacklinksExpanded = !collapsed; - props2.plugin.saveSettings(); - }, [collapsed]); - const toggleBacklinks = () => { - setCollapsed(!collapsed); - }; - p2(() => { - window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks); - return () => { - window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks); - }; - }, [collapsed]); - return backlinks.length > 0 && props2.file ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-component mk-note-footer" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-section" - }, /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => { - setCollapsed(!collapsed); - e4.stopPropagation(); - }, - className: "mk-file-context-title" - }, /* @__PURE__ */ Cn.createElement("div", { - className: `mk-icon-xsmall`, - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-backlink"] - } - }), i18n_default.labels.backlinks, /* @__PURE__ */ Cn.createElement("button", { - className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-collapse-sm"] - } - })), /* @__PURE__ */ Cn.createElement("div", null, !collapsed && backlinks.map((f4, i4) => { - var _a2; - return /* @__PURE__ */ Cn.createElement(BacklinkItem, { - path: f4, - key: i4, - plugin: props2.plugin, - source: (_a2 = props2.file) == null ? void 0 : _a2.path - }); - })))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); }; - -// src/components/FileContextView/InlineFileContextView.tsx -var import_obsidian43 = require("obsidian"); - -// src/types/space.ts -var FMMetadataKeys = (plugin) => [plugin.settings.fmKeyBanner, plugin.settings.fmKeySticker, plugin.settings.fmKeyAlias, plugin.settings.fmKeyColor]; - -// src/components/FileContextView/FileContextList.tsx -var FileContextList = (props2) => { - const { path } = props2; - const { - tableData, - newColumn, - cols, - tagContexts, - contextTable, - contextInfo, - saveColumn, - hideColumn, - delColumn, - sortColumn, - updateFieldValue, - updateValue: updateValue2, - loadContextFields, - predicate - } = q2(MDBContext); - const [collapsed, setCollapsed] = h2( - !props2.plugin.settings.inlineContextSectionsExpanded +var retrieveAllFiles = (vaultDB, settings) => { + return vaultDB.filter( + excludeVaultItemPredicate(settings) ); - const fileContext = F2(() => { - const td = tableData ? { - folder: { - cols: tableData.cols.filter( - (f4) => f4.name != FilePropertyName && !(f4.type == "fileprop" && (f4.value.startsWith(FilePropertyName) || f4.value.indexOf(".") == -1)) && f4.hidden != "true" && f4.type != "preview" - ), - data: tableData.rows.find((r3) => r3.File == path), - dataIndex: tableData.rows.findIndex((r3) => r3.File == path) - } - } : {}; - const tags = tagContexts.reduce( - (p3, c4) => contextTable[c4] ? { - ...p3, - [c4]: { - cols: contextTable[c4].cols.filter( - (f4) => f4.name != FilePropertyName && f4.type != "fileprop" && f4.hidden != "true" && f4.type != "preview" - ), - data: contextTable[c4].rows.find( - (r3, index) => index == parseInt(props2.path) - ), - dataIndex: contextTable[c4].rows.findIndex( - (r3) => r3.File == path - ) - } - } : p3, - {} - ); +}; +var initiateDB = (db) => { + replaceDB(db, { + vault: vaultSchema, + spaces: spaceSchema, + spaceItems: spaceItemsSchema + }); +}; +var indexCurrentFileTree = (plugin, vaultDB, spaceItemsDB) => { + const treeItems = getAllAbstractFilesInVault(plugin, app).map((file) => { + var _a2; return { - ...tags, - ...td + path: file.path, + parent: (_a2 = file.parent) == null ? void 0 : _a2.path, + created: file instanceof import_obsidian43.TFile ? file.stat.ctime.toString() : void 0, + folder: file instanceof import_obsidian43.TFolder ? "true" : "false" }; - }, [tableData, contextTable, tagContexts, path]); - const saveField = (field, oldField) => { - if (field.name.length > 0) { - if (field.name != oldField.name || field.type != oldField.type || field.value != oldField.value || field.attrs != oldField.attrs) { - const saveResult = saveColumn(field, oldField); - } + }); + const currentPaths = vaultDB; + const deleteRows = currentPaths.filter( + (item) => !treeItems.some((i4) => i4.path == item.path) + ); + const fixRows = currentPaths.filter( + (item) => treeItems.some((i4) => i4.path == item.path && i4.parent != item.parent) + ).map((item) => ({ + ...item, + ...treeItems.find((i4) => i4.path == item.path) + })); + const newRows = treeItems.filter( + (item) => !currentPaths.some((i4) => i4.path == item.path) + ); + const newVaultRows = [...vaultDB.map((f4) => { + const newItem = fixRows.find((g4) => g4.path == f4.path); + if (newItem) { + return { ...f4, ...newItem }; + } + return f4; + }).filter((f4) => !deleteRows.some((g4) => g4.path == f4.path)), ...newRows]; + const newSpaceItemsRows = spaceItemsDB.filter((f4) => !deleteRows.some((g4) => g4.path == f4.path)); + return { + vault: { + ...vaultSchema, + rows: newVaultRows + }, + spaceItems: { + ...spaceItemsSchema, + rows: newSpaceItemsRows } }; - const saveContext = (field, oldField, value) => { - const newContext = value[0]; - initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { - if (f4) { - return insertContextItems( - props2.plugin, - optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] - ), - newContext - ); - } - }).then((f4) => loadContextFields(newContext)); - const newField = { - ...field, - value: newContext != null ? newContext : "" - }; - saveColumn(newField, oldField); - }; - const showMenu = (e4, field) => { - const offset = e4.target.getBoundingClientRect(); - const options = optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] +}; +var newFolderInSpace = (plugin, space, activeFile2) => { + const vaultChangeModal = new VaultChangeModal( + plugin, + (space == null ? void 0 : space.def.folder.length) > 0 ? getFolderFromPath(app, space.def.folder) : defaultNoteFolder(plugin, activeFile2), + "create folder", + space.name + ); + vaultChangeModal.open(); +}; +var newFileInSpace = async (plugin, space, activeFile2, canvas) => { + let newFile; + if (canvas) { + newFile = await createNewCanvasFile( + plugin, + (space == null ? void 0 : space.def.folder.length) > 0 ? getFolderFromPath(app, space.def.folder) : defaultNoteFolder(plugin, activeFile2), + "" ); - showPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - true, - options, - field, - cols, - contextInfo.contextPath, - (newField) => saveField(newField, field), - (newField, val) => saveContext(newField, field, val), - hideColumn, - delColumn, - sortColumn, - predicate.colsHidden.includes(field.name + field.table) + } else { + newFile = await createNewMarkdownFile( + plugin, + (space == null ? void 0 : space.def.folder.length) > 0 ? getFolderFromPath(app, space.def.folder) : defaultNoteFolder(plugin, activeFile2), + "" ); - }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, fileContext.folder && fileContext.folder.data && fileContext.folder.cols.length > 0 && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-section" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-title", - onClick: (e4) => { - setCollapsed(!collapsed); - e4.stopPropagation(); - } - }, /* @__PURE__ */ Cn.createElement("div", { - className: `mk-icon-xsmall`, - dangerouslySetInnerHTML: { - __html: contextInfo.type == "folder" ? uiIconSet["mk-ui-folder"] : contextInfo.type == "space" ? uiIconSet["mk-ui-spaces"] : uiIconSet["mk-ui-tags"] - } - }), contextDisplayName(contextInfo), /* @__PURE__ */ Cn.createElement("button", { - className: `mk-collapse mk-inline-button mk-icon-xxsmall ${collapsed ? "mk-collapsed" : ""}`, - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-collapse-sm"] - } - })), !collapsed ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, fileContext.folder.cols.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-file-context-row" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-field", - onClick: (e4) => showMenu(e4, { ...f4, table: "" }) - }, f4.name), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-value" - }, /* @__PURE__ */ Cn.createElement(DataTypeView, { - plugin: props2.plugin, - initialValue: fileContext.folder.data[f4.name], - index: fileContext.folder.dataIndex, - file: fileContext.folder.data[FilePropertyName], - column: { ...f4, table: "" }, - editable: !contextInfo.readOnly, - updateValue: (v3) => updateValue2( - f4.name, - v3, - "", - fileContext.folder.dataIndex, - fileContext.folder.data[FilePropertyName] - ), - updateFieldValue: (fv, v3) => updateFieldValue( - f4.name, - fv, - v3, - "", - fileContext.folder.dataIndex, - fileContext.folder.data[FilePropertyName] - ), - contextTable - }))))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))); + } + if (space.name != "/") + addPathsToSpace(plugin, space.name, [newFile.path]); }; -// src/components/ui/menus/fmMenu.tsx -var import_obsidian41 = require("obsidian"); -var showFMMenu = (plugin, position, property, deleteProperty, syncProperty, renameProperty, changeType) => { - const menu = new import_obsidian41.Menu(); - menu.setUseNativeMenu(false); - menu.addItem((menuItem) => { - var _a2; - inputMenuItem( - menuItem, - (_a2 = property == null ? void 0 : property.name) != null ? _a2 : "", - (value) => renameProperty(property.name, value) - ); - menuItem.setIcon("type"); - }); - menu.addSeparator(); - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.changePropertyType); - menuItem.onClick(() => { - changeType(position, property.name); - }); - menuItem.setIcon("list"); - }); - if (property.type != "object") - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.syncToContext); - menuItem.onClick(() => { - syncProperty(property); - }); - menuItem.setIcon("sync"); - }); - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteProperty); - menuItem.onClick(() => { - deleteProperty(property); - }); - menuItem.setIcon("trash-2"); - }); - menu.addSeparator(); - menu.showAtPosition(position); - return menu; +// src/utils/contexts/contexts.ts +var renameContext = (plugin, context, newName) => { + var _a2; + if (context.type == "tag") { + renameTag(plugin, tagPathToTag(context.contextPath), newName); + } else if (context.type == "space") { + const space = (_a2 = plugin.index.spacesIndex.get(spaceNameFromContextPath(context.contextPath))) == null ? void 0 : _a2.space; + if (space) { + saveSpace(plugin, space.name, { ...space, name: newName }); + } + } else if (context.type == "folder") { + renameFile(plugin, getAbstractFileAtPath(app, context.contextPath), newName); + } }; - -// src/components/ui/modals/moveMetadataModal.tsx -var import_obsidian42 = require("obsidian"); -var MovePropertyModal = class extends import_obsidian42.Modal { - constructor(plugin, syncProperty, property, file) { - super(plugin.app); - this.plugin = plugin; - this.file = file; - let closeButton = this.modalEl.querySelector( - ".modal-close-button" - ); - closeButton.style.display = "none"; - this.syncProperty = syncProperty; - this.property = property; +var contextEmbedStringFromContext = (context, schema) => { + if (context.type == "folder") { + if (context.contextPath == "/") + return `![![/#^${schema}]]`; + return `![![${context.contextPath}/#^${schema}]]`; } - onOpen() { - let { contentEl } = this; - let myModal = this; - let headerText; - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - headerEl.innerHTML = i18n_default.labels.syncMetadata; - const root = createRoot(contentEl); - root.render( - /* @__PURE__ */ Cn.createElement(MovePropertyComponent, { - plugin: this.plugin, - syncProperty: this.syncProperty, - close: () => this.close(), - property: this.property, - file: this.file - }) - ); + return `![![${context.contextPath}#^${schema}]]`; +}; +var spaceContextFromSpace = (plugin, space, readOnly) => { + return { + type: "space", + sticker: "", + banner: "", + contextPath: space, + isRemote: false, + readOnly, + dbPath: getFolderPathFromString(plugin.settings.tagContextFolder) + "/" + spaceNameFromContextPath(space) + ".mdb" + }; +}; +var tagContextFromTag = (plugin, tag, readOnly) => { + return { + type: "tag", + sticker: "", + banner: "", + contextPath: tag, + isRemote: false, + readOnly, + dbPath: getFolderPathFromString(plugin.settings.tagContextFolder) + "/" + tagToTagPath(tag) + ".mdb" + }; +}; +var mdbContextByDBPath = (plugin, dbPath) => { + if (dbPath.match(urlRegex)) { + return remoteContextFromURL(plugin, dbPath); } - onClose() { - let { contentEl } = this; - contentEl.empty(); + if (dbPath.startsWith(plugin.settings.tagContextFolder)) { + const contextPath = filePathToString(dbPath); + if (contextPath.charAt(0) == "#") + return tagContextFromTag(plugin, tagPathToTag(dbPath)); + return spaceContextFromSpace(plugin, spaceContextPathFromName(contextPath)); } + return dbPath.endsWith((plugin == null ? void 0 : plugin.settings.folderContextFile) + ".mdb") ? folderContextFromFolder(plugin, getFolderFromPath(app, dbPath).path) : null; }; -var MovePropertyComponent = (props2) => { - const { plugin } = props2; - const [table, setTable] = h2(""); - const saveContexts = (_9, value) => { - setTable(value[0]); +var remoteContextFromURL = (plugin, url) => { + return { + type: "unknown", + sticker: "", + banner: "", + contextPath: url, + isRemote: true, + readOnly: true, + dbPath: url }; - const showContextMenu = async (e4) => { - const offset = e4.target.getBoundingClientRect(); - const tags = allTagsForFile(props2.file); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: false, - value: [], - options: [ - { name: props2.file.parent.name, value: "" }, - ...tags.map((m5) => ({ name: m5, value: m5 })) - ], - saveOptions: saveContexts, - placeholder: i18n_default.labels.tagItemSelectPlaceholder, - searchable: false, - showAll: true +}; +var mdbContextByPath = (plugin, contextPath) => { + if (!contextPath) + return; + if (contextPath.match(urlRegex)) { + return remoteContextFromURL(plugin, contextPath); + } + const viewType = pathTypeByString(contextPath); + if (viewType == "space") { + return spaceContextFromSpace(plugin, contextPath); + } else if (viewType == "folder") { + return folderContextFromFolder(plugin, removeTrailingSlashFromFolder(contextPath)); + } else if (viewType == "tag") { + return tagContextFromTag(plugin, contextPath); + } + return null; +}; +var folderContextFromFolder = (plugin, folder, readOnly) => { + return { + type: "folder", + sticker: "", + banner: "", + contextPath: folder, + isRemote: false, + readOnly, + dbPath: (folder == "/" ? "" : folder + "/") + plugin.settings.folderContextFile + ".mdb" + }; +}; +var linkContextRow = (plugin, row, fields) => { + return { + ...row, + ...fields.filter((f4) => f4.type == "fileprop").reduce((p3, c4) => { + const { field, property } = parsePropString(c4.value); + const col = fields.find((f4) => f4.name == field); + if (!col || !property) { + return p3; + } + if (col.type == "file" || col.type == "link") { + return { + ...p3, + [c4.name]: appendFilesMetaData(plugin, property, row[col.name]) + }; + } + if (col.type.includes("context")) { + const context = col.value; + const contextCache = plugin.index.contextsIndex.get(context); + if (contextCache) { + return { + ...p3, + [c4.name]: linkContextProp( + property, + row[col.name], + contextCache.rows + ) + }; + } } - ); - }; - const sync = () => { - props2.syncProperty(props2.property, table); - props2.close(); + return p3; + }, {}) }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "modal-content" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item setting-item-heading" - }, i18n_default.labels.syncProperties), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-info" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-name" - }, i18n_default.labels.selectContext), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-description" - }, i18n_default.descriptions.selectContext)), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item-control" - }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => showContextMenu(e4) - }, table == "" ? i18n_default.buttons.currentFolder : table))), /* @__PURE__ */ Cn.createElement("button", { - style: { marginRight: 8 }, - onClick: () => sync() - }, i18n_default.buttons.sync), /* @__PURE__ */ Cn.createElement("button", { - onClick: () => props2.close() - }, i18n_default.buttons.cancel)); +}; +var linkContextProp = (propType, rows, contextTableRows) => { + const contextRows = contextTableRows.filter( + (f4) => parseMultiString(rows).contains(f4.File) + ); + return serializeMultiString(uniq(contextRows.map((f4) => f4[propType]).filter((f4) => f4))); }; -// src/components/FileContextView/FrontmatterView.tsx -var FrontmatterView = (props2) => { - const { metadataPath, path } = props2; - const [values, setValues] = h2({}); - const [cols, setCols] = h2([]); - const refreshData = async () => { - var _a2; - const fileContexts = (_a2 = props2.plugin.index.contextsMap.get(path)) != null ? _a2 : /* @__PURE__ */ new Set(); - const columns = [...fileContexts].map((f4) => { - var _a3, _b2; - return (_b2 = (_a3 = props2.plugin.index.contextsIndex.get(f4)) == null ? void 0 : _a3.cols) != null ? _b2 : []; - }).reduce((p3, c4) => [...p3, ...c4], []); - const newCols = []; - const newValues = {}; - const types = guestimateTypes([metadataPath], props2.plugin, false); - const fm = frontMatterForFile(getAbstractFileAtPath(app, metadataPath)); - const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)).filter( - (f4) => !columns.some((g4) => g4.name == f4) - ); - const cols2 = fmKeys.map((f4) => ({ - table: "", - name: f4, - schemaId: "", - type: yamlTypeToMDBType(types[f4]) - })); - if (fm) { - newCols.push(...cols2); - Object.keys(fm).forEach((c4) => { - newValues[c4] = parseFrontMatter(c4, fm[c4]); - }); - } - if (props2.plugin.dataViewAPI() && props2.plugin.settings.dataviewInlineContext) { - const types2 = guestimateTypes([metadataPath], props2.plugin, true); - const fm2 = frontMatterForFile(getAbstractFileAtPath(app, metadataPath)); - const fmKeys2 = uniqCaseInsensitive(frontMatterKeys(fm2)); - const dvValues = props2.plugin.dataViewAPI().page(metadataPath); - const dvKeys = uniqCaseInsensitive( - Object.keys(dvValues != null ? dvValues : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 - ) ? true : false - ).filter((f4) => f4 != "file").filter((f4) => f4 != "tag" && f4 != "tags").filter((f4) => !fmKeys2.includes(f4)).filter((f4) => !columns.some((g4) => g4.name == f4)) - ); - const dvCols = dvKeys.map((f4) => ({ - table: "", - name: f4, - schemaId: "", - type: yamlTypeToMDBType(types2[f4]) - })); - const dv = dvKeys.reduce( - (p3, c4) => ({ - ...p3, - [c4]: parseDataview(c4, dvValues[c4]) - }), - {} +// src/utils/contexts/mdtable.ts +var createTable2 = (object, columns) => { + const columnNames = columns.map((f4) => f4.name); + const base = "|"; + let outputString = base + columnNames.join(base) + "|\n"; + columns.forEach((f4) => { + outputString += base + "----"; + }); + outputString += base + "\n"; + object.forEach((row) => { + outputString += columnNames.map((c4) => base + row[c4]).join("") + "|\n"; + }); + return outputString; +}; + +// src/cm-extensions/flowEditor/flowEditor.tsx +var toggleFlowEditor = import_state6.Annotation.define(); +var cacheFlowEditorHeight = import_state6.Annotation.define(); +var preloadFlowEditor = import_state6.EditorState.transactionFilter.of( + (tr) => { + let newTrans = []; + const value = tr.state.field(flowEditorInfo, false); + if (value && !tr.annotation(toggleFlowEditor)) { + newTrans.push( + ...value.filter((f4) => f4.expandedState == 1).map((f4) => { + if (tr.state.field(flowTypeStateField, false) == "doc") { + return { + annotations: toggleFlowEditor.of([f4.id, 2]) + }; + } else { + return { + annotations: toggleFlowEditor.of([f4.id, 0]) + }; + } + }) ); - newCols.push(...dvCols); - Object.keys(dv).forEach((c4) => { - newValues[c4] = parseDataview(c4, dvValues[c4]); - }); } - setCols( - newCols.filter((f4) => { - var _a3; - return !((_a3 = props2.excludeKeys) == null ? void 0 : _a3.some((g4) => g4 == f4.name)); - }) - ); - setValues(newValues); - }; - p2(() => { - refreshData(); - }, [path, props2.tags]); - const mdbChanged = (evt) => { - if (evt.detail.type == "context" && evt.detail.contextPath && props2.tags.find( - (f4) => tagContextFromTag(props2.plugin, f4).contextPath == evt.detail.contextPath - )) { - refreshData(); - } else if (evt.detail.type == "file" && evt.detail.name == path) { - refreshData(); + return [tr, ...newTrans]; + } +); +var internalLinkToggle = import_view4.ViewPlugin.fromClass( + class { + constructor(view) { } - }; - p2(() => { - window.addEventListener(eventTypes.spacesChange, mdbChanged); - return () => { - window.removeEventListener(eventTypes.spacesChange, mdbChanged); - }; - }, [path, props2.tags]); - const saveFMValue = (value, f4) => { - saveFrontmatterValue(props2.plugin, metadataPath, f4.name, value, f4.type); - }; - const deleteFMValue = (property) => { - deleteFrontmatterValue(props2.plugin, metadataPath, property.name); - }; - const saveMetadata = async (property, table) => { - const field = { - ...property, - schemaId: "files" + }, + { + eventHandlers: { + mousedown: (e4, view) => { + if (!e4.shiftKey) { + return; + } + let pos = view.posAtDOM(e4.target); + let { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); + for (let match2 of text2.matchAll(/(?!\!)\[\[([^\]]+)\]\]/g)) { + const stateField = view.state.field(flowEditorInfo, false); + const info = stateField.find( + (f4) => f4.to == lineFrom + match2.index + match2[1].length + 2 && pos >= f4.from && pos <= f4.to + ); + if (info) { + e4.preventDefault(); + view.dispatch({ + annotations: toggleFlowEditor.of([info.id, 2]) + }); + } + } + } + } + } +); +var internalLinkHover = hoverTooltip((view, pos, side) => { + let { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); + let hovObject = null; + iterateTreeInSelection({ from: lineFrom, to: lineTo }, view.state, { + enter: ({ name, from, to }) => { + if (name.contains("hmd-internal-link") && pos <= to && pos >= from) { + const stateField = view.state.field(flowEditorInfo, false); + const info = stateField.find((f4) => f4.to == to); + if (info) { + hovObject = { + pos, + end: to, + above: true, + create(view2) { + let dom = document.createElement("div"); + dom.toggleClass("mk-flow-hover", true); + dom.toggleClass("menu", true); + const openHoverDiv = dom.createDiv(); + openHoverDiv.setAttribute( + "aria-label", + info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow + ); + openHoverDiv.addEventListener("click", () => { + view2.dispatch({ + annotations: toggleFlowEditor.of([info.id, 2]) + }); + }); + const icon = openHoverDiv.createDiv(); + icon.innerHTML = uiIconSet["mk-ui-flow-hover"]; + openHoverDiv.insertAdjacentText( + "beforeend", + info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow + ); + return { dom }; + } + }; + return false; + } + } + } + }); + return hovObject; +}); +var flowEditorInfo = import_state6.StateField.define({ + create() { + return []; + }, + update(value, tr) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k, _l; + let newValues = []; + const previous = value; + let usedContainers = []; + let str = tr.newDoc.sliceString(0); + const reverseExpandedState = (state) => { + const news = state != 2 ? 2 : 0; + return news; }; - let context; - let tag; - if (table == "") { - context = folderContextFromFolder(props2.plugin, props2.folder); - tag = false; - } else { - context = tagContextFromTag(props2.plugin, table); - tag = true; + for (let match2 of str.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)) { + const link = match2[1]; + const existingLinks = previous.filter((f4) => f4.link == link); + const offset = usedContainers.filter((f4) => f4 == link).length; + const existingInfo = existingLinks[offset]; + const id2 = existingInfo ? existingInfo.id : genId(); + usedContainers.push(link); + const info = { + id: id2, + link: match2[1], + startOfLineFix: false, + from: match2.index + 4, + to: match2.index + 4 + match2[1].length, + embed: 1, + height: existingInfo ? ((_a2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _a2[0]) == id2 && ((_b2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _b2[1]) != 0 ? (_c2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _c2[1] : existingInfo.height : -1, + expandedState: existingInfo ? ((_d2 = tr.annotation(toggleFlowEditor)) == null ? void 0 : _d2[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + }; + newValues.push(info); } - await insertContextColumn(props2.plugin, context, field); - await updateContextValue( - props2.plugin, - context, - path, - field.name, - values[field.name] - ); - }; - const syncFMValue = (property) => { - let vaultChangeModal = new MovePropertyModal( - props2.plugin, - saveMetadata, - property, - getAbstractFileAtPath(app, metadataPath) - ); - vaultChangeModal.open(); - }; - const renameFMKey = (key2, name) => { - renameFrontmatterKey(props2.plugin, metadataPath, key2, name); - }; - const selectedType = (value, key2) => { - changeFrontmatterType(props2.plugin, metadataPath, key2, value[0]); - }; - const selectType = (p3, key2) => { - showSelectMenu(p3, { - multi: false, - editable: false, - searchable: false, - saveOptions: (_9, v3) => selectedType(v3, key2), - value: [], - showAll: true, - options: fieldTypes.filter((f4) => f4.metadata).map((f4, i4) => ({ - id: i4 + 1, - name: f4.label, - value: f4.type, - icon: "" - })) - }); - }; - const showMenu = (e4, property) => { - const offset = e4.target.getBoundingClientRect(); - showFMMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - property, - deleteFMValue, - syncFMValue, - renameFMKey, - selectType - ); - }; - return cols.length > 0 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-section" - }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, cols.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-file-context-row" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-field", - onClick: (e4) => showMenu(e4, f4) - }, f4.name), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-value" - }, /* @__PURE__ */ Cn.createElement(DataTypeView, { - plugin: props2.plugin, - initialValue: values[f4.name], - index: 0, - file: metadataPath, - column: { ...f4, table: "" }, - editable: props2.editable, - updateValue: (value) => saveFMValue(value, f4), - updateFieldValue: (fieldValue, value) => saveFMValue(value, f4), - contextTable: {} - }))))))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); + for (let match2 of str.matchAll(/\[\[([^\]]+)\]\]/g)) { + if (str.charAt(match2.index - 1) != "!") { + const link = match2[1]; + const existingLinks = previous.filter((f4) => f4.link == link); + const offset = usedContainers.filter((f4) => f4 == link).length; + const existingInfo = existingLinks[offset]; + const id2 = existingInfo ? existingInfo.id : genId(); + usedContainers.push(link); + const info = { + id: id2, + link: match2[1], + startOfLineFix: false, + from: match2.index + 2, + to: match2.index + 2 + match2[1].length, + embed: 0, + height: existingInfo ? ((_e2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _e2[0]) == id2 && ((_f = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _f[1]) != 0 ? (_g = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _g[1] : existingInfo.height : -1, + expandedState: existingInfo ? ((_h = tr.annotation(toggleFlowEditor)) == null ? void 0 : _h[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 + }; + newValues.push(info); + } else if (str.charAt(match2.index - 2) != "!") { + const link = match2[1]; + const existingLinks = previous.filter((f4) => f4.link == link); + const offset = usedContainers.filter((f4) => f4 == link).length; + const existingInfo = existingLinks[offset]; + const id2 = existingInfo ? existingInfo.id : genId(); + usedContainers.push(link); + const info = { + id: id2, + link: match2[1], + startOfLineFix: false, + from: match2.index + 3, + to: match2.index + 3 + match2[1].length, + embed: 2, + height: existingInfo ? ((_i = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _i[0]) == id2 && ((_j = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _j[1]) != 0 ? (_k = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _k[1] : existingInfo.height : -1, + expandedState: existingInfo ? ((_l = tr.annotation(toggleFlowEditor)) == null ? void 0 : _l[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + }; + newValues.push(info); + } + } + newValues.sort(compareByField("from", true)); + return newValues; + } +}); +var flowEditorRangeset = (state, plugin) => { + let builder = new import_state6.RangeSetBuilder(); + const infoFields = state.field(flowEditorInfo, false); + for (let info of infoFields) { + const { from, to, embed: embedType, expandedState } = info; + const lineFix = from - 3 == state.doc.lineAt(from).from && to + 2 == state.doc.lineAt(from).to; + if (expandedState == 2) { + if (embedType == 1) { + if (!(state.selection.main.from == from - 4 && state.selection.main.to == to + 2 || state.selection.main.from >= from - 3 && state.selection.main.to <= to + 1)) { + builder.add(from - 4, from - 3, flowEditorSelector(info, plugin)); + if (lineFix) { + builder.add(from - 3, to + 2, flowEditorWidgetDecoration(info)); + } else { + builder.add(from - 3, to + 2, flowEditorDecoration(info)); + } + } + } else if (embedType == 0) { + builder.add(to + 2, to + 2, flowEditorDecoration(info)); + } + } + } + const dec = builder.finish(); + return dec; +}; +var flowEditorField = (plugin) => import_state6.StateField.define({ + create(state) { + return flowEditorRangeset(state, plugin); + }, + update(value, tr) { + return flowEditorRangeset(tr.state, plugin); + }, + provide: (f4) => import_view4.EditorView.decorations.from(f4) +}); +var FlowEditorWidget = class extends import_view4.WidgetType { + constructor(info) { + super(); + this.info = info; + } + eq(other) { + return other.info.id === this.info.id; + } + toDOM(view) { + const div = document.createElement("div"); + div.toggleClass("mk-floweditor-container", true); + div.toggleClass("mk-floweditor-fix", this.info.startOfLineFix); + div.setAttribute("id", "mk-flow-" + this.info.id); + const placeholder2 = div.createDiv("mk-floweditor-placeholder"); + placeholder2.style.setProperty("height", this.info.height + "px"); + loadFlowEditorByDOM(div, view, this.info.id); + return div; + } + get estimatedHeight() { + return this.info.height; + } +}; +var FlowEditorSelector = class extends import_view4.WidgetType { + constructor(info, plugin) { + super(); + this.info = info; + this.flowInfo = info; + this.plugin = plugin; + } + eq(other) { + return false; + } + toDOM(view) { + const div = document.createElement("div"); + div.toggleClass("mk-floweditor-selector", true); + const reactEl = createRoot(div); + if (this.info.link && view.state.field(import_obsidian44.editorInfoField, false)) { + const infoField = view.state.field(import_obsidian44.editorInfoField, false); + const file = infoField.file; + const path = pathByString(this.info.link, file.path); + reactEl.render( + /* @__PURE__ */ Cn.createElement(FlowEditorHover, { + toggle: true, + path: path.path, + type: path.type, + toggleState: true, + convertTable: () => { + const context = mdbContextByPath(this.plugin, path.path); + getMDBTable( + this.plugin, + context, + path.ref.substring(1, path.ref.length) + ).then((mdbTable) => { + const markdown = createTable2(mdbTable.rows, mdbTable.cols); + view.dispatch({ + changes: { + from: this.info.from - 4, + to: this.info.to + 2, + insert: markdown + } + }); + }); + }, + cutTable: () => { + navigator.clipboard.writeText(`![![${this.info.link}]]`); + view.dispatch({ + changes: { from: this.info.from - 4, to: this.info.to + 2 } + }); + }, + deleteTable: () => { + view.dispatch({ + changes: { from: this.info.from - 4, to: this.info.to + 2 } + }); + }, + toggleFlow: () => { + view.dispatch({ + changes: { from: this.info.from - 4, to: this.info.from - 3 } + }); + }, + openLink: () => { + openFileFlowEditor(this.flowInfo.link, "/"); + } + }) + ); + } + return div; + } }; +var flowEditorSelector = (info, plugin) => import_view4.Decoration.replace({ + widget: new FlowEditorSelector(info, plugin), + inclusive: true, + block: false +}); +var flowEditorDecoration = (info) => import_view4.Decoration.replace({ + widget: new FlowEditorWidget(info), + inclusive: true, + block: false +}); +var flowEditorWidgetDecoration = (info) => import_view4.Decoration.widget({ + widget: new FlowEditorWidget(info), + block: true +}); -// src/components/FileContextView/InlineFileContextView.tsx -var InlineFileContextView = (props2) => { - var _a2, _b2; - const { file } = props2; - const folderPath = (_a2 = file == null ? void 0 : file.parent) == null ? void 0 : _a2.path; - const getFileCache = (file2) => { - if (!file2 || file2.path == "/") - return null; - const cache = props2.plugin.index.filesIndex.get(file2.path); - if (!cache) { - return props2.plugin.index.filesIndex.get( - folderPathFromFolderNoteFile(props2.plugin.settings, tFileToAFile(file2)) - ); +// src/cm-extensions/flowEditor/flowViewUpdates.ts +var import_view5 = require("@codemirror/view"); +var flowViewUpdates = import_view5.EditorView.updateListener.of((v3) => { + if (v3.heightChanged) { + app.workspace.iterateRootLeaves((leaf) => { + var _a2, _b2; + const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; + if (cm && v3.view.dom == cm.dom && cm.state.field(flowTypeStateField, false)) { + if ((_b2 = leaf.containerEl.parentElement) == null ? void 0 : _b2.hasClass("workspace-tab-container")) { + if (cm.state.field(flowTypeStateField, false) != "doc") { + cm.dispatch({ + annotations: portalTypeAnnotation.of("doc") + }); + } + } + } + }); + } + if (v3.heightChanged) { + const flowID = v3.state.field(flowIDStateField, false); + if (flowID) { + app.workspace.iterateLeaves((leaf) => { + var _a2; + const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; + if (cm) { + const stateField = cm.state.field(flowEditorInfo, false); + if (stateField) { + if (stateField.find((f4) => f4.id == flowID)) { + cm.dispatch({ + annotations: cacheFlowEditorHeight.of([ + flowID, + v3.view.contentHeight + ]) + }); + } + } + } + }, app.workspace["rootSplit"]); } - return cache; - }; - const [fileCache, setFileCache] = h2( - getFileCache(props2.file) - ); - const metadataFilePath = F2(() => { - if (!fileCache) - return null; - if (fileCache.isFolder && fileCache.folderNote) { - return fileCache.folderNote.folderNotePath; + } +}); + +// src/cm-extensions/inlineStylerView/inlineStyler.tsx +var import_state8 = require("@codemirror/state"); + +// src/cm-extensions/inlineStylerView/InlineMenu.tsx +var import_classnames5 = __toESM(require_classnames()); + +// src/cm-extensions/inlineStylerView/marks.ts +var import_state7 = require("@codemirror/state"); + +// src/cm-extensions/markSans/obsidianSyntax.ts +var oMarks = [ + { + mark: "em", + formatting: "formatting-em", + altFormatting: "em_formatting_formatting-strong", + formatChar: "*" + }, + { + mark: "strong", + formatting: "formatting-strong", + formatChar: "**" + }, + { + mark: "strikethrough", + formatting: "formatting-strikethrough", + formatChar: "~~" + }, + { + mark: "inline-code", + formatting: "formatting-code", + formatChar: "`" + } +]; + +// src/cm-extensions/inlineStylerView/marks.ts +var toggleMark = import_state7.Annotation.define(); +var trimSpace = (pos, moveDirLeft, state) => { + if (moveDirLeft && state.sliceDoc(pos, pos + 1) == " ") + return pos + 1; + if (!moveDirLeft && state.sliceDoc(pos - 1, pos) == " ") + return pos - 1; + return pos; +}; +var newPosAfterFormatting = (pos, moveDirLeft, state) => { + const line = state.doc.lineAt(pos); + const start = moveDirLeft ? line.from : pos; + const end = moveDirLeft ? pos : line.to; + let newPos = start; + let lastFormatPos = start; + let exitFormatRange = false; + iterateTreeInSelection({ from: start, to: end }, state, { + enter: (node) => { + if (exitFormatRange) + return false; + if (node.name.contains("formatting")) { + if (!moveDirLeft && node.from > start) { + return false; + } + if (moveDirLeft) { + newPos = node.from; + lastFormatPos = node.to; + } else { + newPos = node.to; + } + } } - return fileCache.path; - }, [fileCache]); - const showHeader = props2.showHeader; - const [collapsed, setCollapsed] = h2( - !showHeader ? false : !props2.plugin.settings.inlineContextExpanded + }); + if (moveDirLeft && lastFormatPos < pos) { + newPos = pos; + } + return newPos; +}; +var expandRange = (selection, state) => { + const from = trimSpace( + newPosAfterFormatting(selection.from, true, state), + true, + state ); - const tags = (_b2 = fileCache == null ? void 0 : fileCache.tags) != null ? _b2 : []; - const contexts = F2(() => { - var _a3; - return ((_a3 = fileCache == null ? void 0 : fileCache.contexts) != null ? _a3 : []).map((f4) => props2.plugin.index.contextsIndex.get(f4)).filter((f4) => f4).map((f4) => f4.info); - }, [fileCache]); - const banner = fileCache == null ? void 0 : fileCache.banner; - p2(() => { - props2.plugin.settings.inlineContextExpanded = !collapsed; - props2.plugin.saveSettings(); - }, [collapsed]); - const fileNameRef = _2(null); - const refreshFile = () => { - if (!file || !file.parent) { - return; + const to = trimSpace( + newPosAfterFormatting(selection.to, false, state), + false, + state + ); + return { from, to }; +}; +var addMarkAtPos = (pos, mark) => ({ + changes: { from: pos, to: pos, insert: mark.formatChar } +}); +var rangeIsMark = (state, mark, selection) => posIsMark(selection.from, state, mark.mark) && posIsMark(selection.to, state, mark.mark); +var posIsMark = (pos, state, markString) => { + let isMark = false; + iterateTreeAtPos(pos, state, { + enter: ({ name, from, to }) => { + if (nodeNameContainsMark(name, markString)) + isMark = true; } - const fileCache2 = getFileCache(file); - setFileCache(fileCache2); - }; - const cacheChanged = (evt) => { - if (evt.detail.type == "file" && evt.detail.name == file.path) { - refreshFile(); + }); + return isMark; +}; +var nodeNameContainsMark = (name, markString) => { + return name.contains(markString); +}; +var edgeIsMark = (pos, state, mark) => posIsMark(pos, state, mark.mark); +var edgeIsMarkFormat = (pos, state, mark) => posIsMark(pos, state, mark.formatting) ? true : mark.altFormatting ? posIsMark(pos, state, mark.altFormatting) : false; +var transactionChangesForMark = (range, mark, state) => { + let newTrans = []; + if (rangeIsMark(state, mark, range)) { + if (edgeIsMarkFormat(range.from, state, mark) && !edgeIsMarkFormat(range.to, state, mark)) { + newTrans.push(addMarkAtPos(range.to, mark)); } - if (evt.detail.type == "context" && contexts.some((f4) => f4.contextPath == evt.detail.name)) { - refreshFile(); + if (edgeIsMarkFormat(range.to, state, mark) && !edgeIsMarkFormat(range.from, state, mark)) { + newTrans.push(addMarkAtPos(range.from, mark)); } - }; - p2(() => { - window.addEventListener(eventTypes.spacesChange, cacheChanged); - refreshFile(); - return () => { - window.removeEventListener(eventTypes.spacesChange, cacheChanged); - }; - }, [file]); - const changeCover = (e4) => { - const vaultChangeModal = new imageModal( - props2.plugin, - props2.plugin.app, - (image) => saveFrontmatterValue( - props2.plugin, - fileCache.path, - props2.plugin.settings.fmKeyBanner, - image, - "image", - true - ) - ); - vaultChangeModal.open(); - }; - const showContextMenu = (e4) => { - const offset = e4.target.getBoundingClientRect(); - const f4 = loadTags(props2.plugin); - showSelectMenu( - { x: offset.left, y: offset.top + 30 }, - { - multi: false, - editable: true, - value: [], - options: f4.map((m5) => ({ name: m5, value: m5 })), - saveOptions: (_9, value) => addTag2(value[0]), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - }; - const addTag2 = (tag) => { - if (file instanceof import_obsidian43.TFile && file.extension == "md") - addTagToNote(tag, file); - }; - const removeTag = (tag) => { - if (file instanceof import_obsidian43.TFile && file.extension == "md") - removeTagFromFile(tag, file); - }; - const saveField = (source, field) => { - if (source == "fm") { - saveFrontmatterValue( - props2.plugin, - fileCache.path, - field.name, - "", - field.type, - true - ); - return; + } else if (edgeIsMark(range.from, state, mark)) { + if (edgeIsMarkFormat(range.from, state, mark) && !edgeIsMark(range.from - 1, state, mark)) { + newTrans.push(addMarkAtPos(range.from, mark)); } - if (source == "") { - insertContextColumn( - props2.plugin, - mdbContextByPath(props2.plugin, fileCache.parent), - field - ); - return; + newTrans.push(addMarkAtPos(range.to, mark)); + } else if (edgeIsMark(range.to, state, mark)) { + if (edgeIsMarkFormat(range.to, state, mark) && !edgeIsMark(range.to + 1, state, mark)) { + newTrans.push(addMarkAtPos(range.to, mark)); } - insertContextColumn( - props2.plugin, - tagContextFromTag(props2.plugin, source), - field - ); - }; - const newProperty = (e4) => { - const offset = e4.target.getBoundingClientRect(); - showNewPropertyMenu( - props2.plugin, - { x: offset.left, y: offset.top + 30 }, - tags, - [], - saveField, - "files", - folderPath, - true - ); - }; - const onBlur = (e4) => { - const newValue = e4.target.innerHTML; - if (newValue != fileNameToString(file.name)) { - renameFile(props2.plugin, file, newValue + ".md"); + newTrans.push(addMarkAtPos(range.from, mark)); + } else { + newTrans.push(addMarkAtPos(range.to, mark)); + newTrans.push(addMarkAtPos(range.from, mark)); + } + return newTrans; +}; +var removeAllInternalMarks = (sel, state, mark) => { + let returnTrans = []; + iterateTreeInSelection({ from: sel.from, to: sel.to }, state, { + enter: ({ name, from, to }) => { + if (nodeNameContainsMark(name, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name, mark.altFormatting) : false)) + returnTrans.push({ + from, + to: from + mark.formatChar.length + }); } + }); + return { + changes: returnTrans }; - const onKeyPress = (e4) => { - e4.stopPropagation(); - }; - const onKeyUp = (e4) => { - e4.stopPropagation(); - }; - const onKeyDown = (e4) => { - var _a3, _b3; - e4.stopPropagation(); - if (e4.key == "a" && e4.metaKey) { - e4.preventDefault(); - const selection = window.getSelection(); - const range = document.createRange(); - range.selectNodeContents(e4.target); - selection.removeAllRanges(); - selection.addRange(range); - } - if (e4.key == "Enter") { - e4.target.blur(); - (_a3 = props2.editorView) == null ? void 0 : _a3.focus(); - e4.preventDefault(); +}; +var toggleMarkExtension = import_state7.EditorState.transactionFilter.of( + (tr) => { + if (!tr.annotation(toggleMark)) + return tr; + const markToggle = tr.annotation(toggleMark); + const mark = oMarks.find((f4) => f4.mark == markToggle); + if (!mark) { + return tr; } - if (e4.key == "Escape") { - e4.target.blur(); - (_b3 = props2.editorView) == null ? void 0 : _b3.focus(); - e4.preventDefault(); + const selection = tr.startState.selection.main; + let newTrans = []; + if (selection.head == selection.anchor) { + if (tr.startState.sliceDoc( + selection.head - mark.formatChar.length, + selection.head + ) == mark.formatChar && tr.startState.sliceDoc( + selection.head, + selection.head + mark.formatChar.length + ) == mark.formatChar) { + newTrans.push({ + changes: { + from: selection.head - mark.formatChar.length, + to: selection.head + mark.formatChar.length + } + }); + } else { + newTrans.push({ + changes: { + from: selection.head, + insert: mark.formatChar + mark.formatChar + }, + selection: { + anchor: selection.head + mark.formatChar.length, + head: selection.head + mark.formatChar.length + } + }); + } + return [tr, ...newTrans]; } + const range = expandRange(selection, tr.startState); + newTrans.push(removeAllInternalMarks(range, tr.startState, mark)); + let newFrom = range.from; + let newTo = range.to; + newTrans.push(...transactionChangesForMark(range, mark, tr.startState)); + return [tr, ...newTrans, { selection: { anchor: newFrom, head: newTo } }]; + } +); + +// src/cm-extensions/inlineStylerView/Mark.tsx +var Mark = (props2) => { + const { i: i4, style, active, toggleMarkAction } = props2; + return /* @__PURE__ */ Cn.createElement("div", { + key: i4, + "aria-label": !platformIsMobile() ? i18n_default.styles[style.label] : void 0, + className: `mk-mark ${style.mark && active ? "mk-mark-active" : ""}`, + dangerouslySetInnerHTML: { __html: uiIconSet[style.icon] }, + onMouseDown: (e4) => toggleMarkAction(e4, style) + }); +}; + +// src/cm-extensions/inlineStylerView/styles/default.ts +var default_default = [ + { + label: "bold", + value: `****`, + insertOffset: 2, + icon: "mk-mark-strong", + mark: "strong" + }, + { + label: "italics", + value: "**", + insertOffset: 1, + icon: "mk-mark-em", + mark: "em" + }, + { + label: "strikethrough", + value: "~~~~", + insertOffset: 2, + icon: "mk-mark-strikethrough", + mark: "strikethrough" + }, + { + label: "code", + value: "``", + insertOffset: 1, + icon: "mk-mark-code", + mark: "inline-code" + }, + { + label: "link", + value: "[]()", + insertOffset: 1, + cursorOffset: 2, + icon: "mk-mark-link" + }, + { + label: "blocklink", + value: "[[]]", + insertOffset: 2, + icon: "mk-mark-blocklink" + } +]; + +// src/cm-extensions/inlineStylerView/styles/index.ts +function resolveStyles() { + return default_default; +} + +// src/cm-extensions/inlineStylerView/InlineMenu.tsx +var loadStylerIntoContainer = (el, plugin) => { + const root = createRoot(el); + root.render( + /* @__PURE__ */ Cn.createElement(InlineMenuComponent, { + mobile: true, + activeMarks: [], + plugin + }) + ); +}; +var InlineMenuComponent = (props2) => { + const [mode, setMode] = h2(props2.mobile ? 0 : 1); + const [colorMode, setColorMode] = h2(null); + const makeMenu = (e4) => { + var _a2; + e4.preventDefault(); + const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); + if (!cm) + return; + const end = cm.state.selection.main.to; + const insertChars = cm.state.sliceDoc(end - 1, end) == cm.state.lineBreak ? props2.plugin.settings.menuTriggerChar : cm.state.lineBreak + props2.plugin.settings.menuTriggerChar; + cm.dispatch({ + changes: { + from: end, + to: end, + insert: insertChars + }, + selection: { + head: end + insertChars.length, + anchor: end + insertChars.length + } + }); }; - y2(() => { - var _a3; - (_a3 = props2.editorView) == null ? void 0 : _a3.requestMeasure(); - }, []); - p2(() => { - var _a3; - if (file == null ? void 0 : file.name.startsWith("Untitled")) { - selectElementContents(fileNameRef.current); + const toggleMarkAction = (e4, s5) => { + var _a2; + e4.preventDefault(); + const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); + if (!cm) + return; + if (s5.mark) { + cm.dispatch({ + annotations: toggleMark.of(s5.mark) + }); + return; } - const pasteEvent = (e4) => { - e4.preventDefault(); - const text2 = e4.clipboardData.getData("text/plain"); - document.execCommand("insertText", false, text2); - }; - (_a3 = fileNameRef.current) == null ? void 0 : _a3.addEventListener("paste", pasteEvent); - return () => { - var _a4; - (_a4 = fileNameRef.current) == null ? void 0 : _a4.removeEventListener("paste", pasteEvent); - }; - }, [fileNameRef]); - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.showBanner && /* @__PURE__ */ Cn.createElement(NoteBannerView, { - plugin: props2.plugin, - link: banner, - file: props2.file + const selection = cm.state.selection.main; + const selectedText = cm.state.sliceDoc(selection.from, selection.to); + cm.dispatch({ + changes: { + from: selection.from, + to: selection.to, + insert: s5.value.substring(0, s5.insertOffset) + selectedText + s5.value.substring(s5.insertOffset) + }, + selection: s5.cursorOffset ? { + anchor: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + s5.cursorOffset, + head: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + s5.cursorOffset + } : { + anchor: selection.from + s5.value.substring(0, s5.insertOffset).length, + head: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + } + }); + }; + const makeMode = () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + "aria-label": !platformIsMobile() ? i18n_default.commands.makeMenu : void 0, + onMouseDown: (e4) => { + makeMenu(e4); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-slash"] } }), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-component" - }, /* @__PURE__ */ Cn.createElement("div", { - className: `mk-spacer`, - style: { - "--header-height": props2.showBanner && banner ? ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!props2.plugin.settings.spacesStickers || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" : 0 + "aria-label": !platformIsMobile() ? i18n_default.commands.selectStyle : void 0, + onMouseDown: () => { + setMode(1); }, - onContextMenu: (e4) => e4.preventDefault() + className: "mk-mark", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-style"] } }), /* @__PURE__ */ Cn.createElement("div", { - className: `mk-file-context-file ${props2.plugin.settings.inlineContextNameLayout == "horizontal" ? "mk-file-context-file-horizontal" : ""}` - }, showHeader && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.plugin.settings.spacesStickers && fileCache ? /* @__PURE__ */ Cn.createElement(FileSticker, { - plugin: props2.plugin, - fileCache - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-inline-title inline-title", - ref: fileNameRef, - contentEditable: props2.editable, - onBlur, - onDrop: (e4) => e4.preventDefault(), - onKeyDown, - onKeyPress, - onKeyUp, - dangerouslySetInnerHTML: { - __html: fileNameToString(file.name) - } - })), /* @__PURE__ */ Cn.createElement("div", { - className: `mk-collapse mk-icon-xsmall mk-file-context-collapse ${collapsed ? "mk-collapsed" : ""}`, - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-collapse"] + "aria-label": !platformIsMobile() ? i18n_default.commands.image : void 0, + onMouseDown: () => { + const view = getActiveMarkdownView(); + props2.plugin.app.commands.commands["editor:attach-file"].editorCallback(view.editor, view); }, - onClick: (e4) => { - setCollapsed(!collapsed); - e4.stopPropagation(); - } - })), !collapsed && props2.editable ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-field-new" - }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => newProperty(e4) - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - }), platformIsMobile() ? "Property" : "Add Property"), /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => showContextMenu(e4) - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-tags"] } - }), platformIsMobile() ? "Tag" : "Add Tag"), props2.showBanner || props2.isFolderNote ? /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => changeCover(e4) - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", + className: "mk-mark", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-attach"] } + }), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": !platformIsMobile() ? i18n_default.commands.toggleKeyboard : void 0, + onMouseDown: () => { + const view = getActiveMarkdownView(); + props2.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(view.editor, view); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-make-keyboard"] } + })); + const colorsMode = () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + onMouseDown: () => { + setColorMode(null); + setMode(1); + }, + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + }), colors.map((c4, i4) => /* @__PURE__ */ Cn.createElement("div", { + key: i4, + onMouseDown: () => { + var _a2; + setMode(1); + setColorMode(null); + const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); + if (!cm) + return; + const selection = cm.state.selection.main; + const selectedText = cm.state.sliceDoc( + selection.from, + selection.to + ); + cm.dispatch({ + changes: { + from: selection.from, + to: selection.to, + insert: colorMode.prefix + c4[1] + colorMode.suffix + selectedText + colorMode.closeTag + } + }); + }, + className: "mk-color", + style: { background: c4[1] } + }))); + const marksMode = () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.mobile ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + onMouseDown: () => { + setMode(0); + }, + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), resolveStyles().map((s5, i4) => { + return /* @__PURE__ */ Cn.createElement(Mark, { + i: i4, + style: s5, + active: props2.activeMarks.find((f4) => f4 == s5.mark) ? true : false, + toggleMarkAction + }); + }), props2.plugin.settings.inlineStylerColors ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-divider" + }), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": !platformIsMobile() ? i18n_default.styles.textColor : void 0, + onMouseDown: () => { + setMode(2); + setColorMode({ + prefix: ``, + closeTag: "" + }); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-mark-color"] } + }), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": !platformIsMobile() ? i18n_default.styles.highlight : void 0, + onMouseDown: () => { + setMode(2); + setColorMode({ + prefix: ``, + closeTag: "" + }); + }, + className: "mk-mark", dangerouslySetInnerHTML: { - __html: uiIconSet["mk-make-image"] + __html: uiIconSet["mk-mark-highlight"] } - }), platformIsMobile() ? "Cover" : "Change Cover") : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)), tags.length > 0 ? /* @__PURE__ */ Cn.createElement(TagsView, { - plugin: props2.plugin, - tags, - removeTag, - canOpen: true - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)) : /* @__PURE__ */ Cn.createElement("div", { - style: { height: 16 } - })), !collapsed && fileCache ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-component" - }, metadataFilePath && /* @__PURE__ */ Cn.createElement(FrontmatterView, { - plugin: props2.plugin, - path: fileCache.path, - metadataPath: metadataFilePath, - folder: folderPath, - tags, - excludeKeys: showHeader || props2.isFolderNote ? FMMetadataKeys(props2.plugin) : [], - editable: props2.editable - }), contexts.map((context, i4) => /* @__PURE__ */ Cn.createElement(MDBProvider, { - key: i4, - plugin: props2.plugin, - context, - file: fileCache.path - }, /* @__PURE__ */ Cn.createElement(FileContextList, { - plugin: props2.plugin, - path: fileCache.path, - color: "var(--tag-background)" - }))), props2.editable ? /* @__PURE__ */ Cn.createElement("div", { - style: { height: props2.showHeader ? 16 : 8 } - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); + return /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames5.default)("mk-style-menu", props2.mobile ? "" : "menu"), + onMouseDown: (e4) => e4.preventDefault() + }, mode == 0 && props2.mobile ? makeMode() : mode == 2 ? colorsMode() : marksMode()); }; -// src/cm-extensions/inlineContext/inlineContext.tsx -var import_obsidian44 = require("obsidian"); -var InlineContextWidget = class extends import_view7.WidgetType { - constructor(plugin, file, contentEl) { - super(); - this.plugin = plugin; - this.file = file; - this.filePath = file.path; - this.contentEl = contentEl; - this.removeListeners = () => { - }; - } - eq(widget) { - if (widget.filePath == this.filePath) - return true; - return false; - } - toDOM(view) { - const container = document.createElement("div"); - container.toggleClass("mk-header", true); - container.toggleClass("cm-line", true); - const anchor = createRoot(container); - const flowType = view.state.field(flowTypeStateField, false); - const isFolderNote2 = flowType == "foldernote"; - anchor.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(InlineFileContextView, { - plugin: this.plugin, - file: this.file, - editorView: view, - showHeader: !isFolderNote2, - showBanner: !isFolderNote2, - isFolderNote: isFolderNote2, - editable: true - })) - ); - return container; - } - destroy() { - this.removeListeners(); - } -}; -var BacklinksWidget = class extends import_view7.WidgetType { - constructor(plugin, file, contentEl) { - super(); - this.plugin = plugin; - this.file = file; - this.contentEl = contentEl; - this.removeListeners = () => { +// src/cm-extensions/inlineStylerView/inlineStyler.tsx +var cursorTooltipField = (plugin) => import_state8.StateField.define({ + create: getCursorTooltips(plugin), + update(tooltips2, tr) { + if (!tr.docChanged && !tr.selection) + return tooltips2; + return getCursorTooltips(plugin)(tr.state); + }, + provide: (f4) => showTooltip.computeN([f4], (state) => state.field(f4)) +}); +var getCursorTooltips = (plugin) => (state) => { + return state.selection.ranges.filter((range) => !range.empty).map((range) => { + const expandedRange = expandRange(range, state); + let line = state.doc.lineAt(range.head); + let activeMarks = oMarks.map((f4) => rangeIsMark(state, f4, expandedRange) ? f4.mark : "").filter((f4) => f4 != ""); + return { + pos: Math.min(range.head, range.anchor), + above: true, + strictSide: true, + arrow: false, + create: (view) => { + let dom = document.createElement("div"); + dom.className = "cm-tooltip-cursor"; + const reactElement = createRoot(dom); + reactElement.render( + /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(InlineMenuComponent, { + plugin, + cm: view, + activeMarks, + mobile: false + })) + ); + return { dom }; + } }; - } - eq(widget) { - return true; - } - toDOM() { - const container = document.createElement("div"); - const anchor = createRoot(container); - anchor.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(Backlinks, { - plugin: this.plugin, - file: this.file - })) - ); - return container; - } - destroy() { - this.removeListeners(); - } -}; -function defineStatefulDecoration() { - const update = import_state10.StateEffect.define(); - const field = import_state10.StateField.define({ - create() { - return import_view7.Decoration.none; - }, - update(deco, tr) { - return tr.effects.reduce((deco2, effect) => { - return effect.is(update) ? effect.value : deco2; - }, deco.map(tr.changes)); - }, - provide: (field2) => import_view7.EditorView.decorations.from(field2) }); - return { update, field }; -} -var statefulDecorations = defineStatefulDecoration(); -var StatefulDecorationSet = class { - constructor(editor, plugin) { - this.decoCache = /* @__PURE__ */ Object.create(null); - this.editor = editor; - this.plugin = plugin; - } - async computeAsyncDecorations(state, show) { - var _a2; - if (!show) - return import_view7.Decoration.none; - if (!state.field(import_obsidian44.editorInfoField, false)) - return null; - const infoField = state.field(import_obsidian44.editorInfoField); - if (!((_a2 = infoField.editor) == null ? void 0 : _a2.cm)) - return null; - const file = infoField.file; - const contentEl = infoField.editor.cm.contentDOM; - const decorations = []; - decorations.push( - import_view7.Decoration.line({ class: "mk-has-banner" }).range(0), - import_view7.Decoration.widget({ - widget: new InlineContextWidget(this.plugin, file, contentEl), - block: true, - side: -1 - }).range(0) - ); - if (this.plugin.settings.inlineBacklinks) { - const line = state.doc.line(state.doc.lines); - decorations.push( - import_view7.Decoration.line({ class: "mk-has-backlinks" }).range( - line.from, - line.from - ), - import_view7.Decoration.widget({ - widget: new BacklinksWidget(this.plugin, file, contentEl), - side: 1, - block: false - }).range(state.doc.length) - ); - } - return import_view7.Decoration.set(decorations, true); - } - async updateAsyncDecorations(state, show) { - const decorations = await this.computeAsyncDecorations(state, show); - if (decorations || this.editor.state.field(statefulDecorations.field, false).size) { - this.editor.dispatch({ - effects: statefulDecorations.update.of(decorations || import_view7.Decoration.none) - }); - } - } }; +function cursorTooltip(plugin) { + return cursorTooltipField(plugin); +} + +// src/cm-extensions/placeholder.ts +var import_state9 = require("@codemirror/state"); +var import_view6 = require("@codemirror/view"); +var placeholderLine = import_view6.Decoration.line({ + attributes: { "data-ph": i18n_default.labels.placeholder }, + class: "mk-placeholder" +}); +var placeholder = import_state9.StateField.define({ + create() { + return import_view6.Decoration.none; + }, + update(value, tr) { + let builder = new import_state9.RangeSetBuilder(); + const currentLine = tr.state.doc.lineAt(tr.state.selection.main.head); + if ((currentLine == null ? void 0 : currentLine.length) == 0) + builder.add(currentLine.from, currentLine.from, placeholderLine); + const dec = builder.finish(); + return dec; + }, + provide: (f4) => import_view6.EditorView.decorations.from(f4) +}); + +// src/cm-extensions/inlineContext/inlineContext.tsx +var import_state10 = require("@codemirror/state"); +var import_obsidian45 = require("obsidian"); var frontmatterHider = (plugin) => import_state10.EditorState.transactionFilter.of((tr) => { let newTrans = []; const isFM = (typeString) => { @@ -45083,7 +44846,7 @@ var frontmatterHider = (plugin) => import_state10.EditorState.transactionFilter. } } }); - const livePreview = tr.state.field(import_obsidian44.editorLivePreviewField); + const livePreview = tr.state.field(import_obsidian45.editorLivePreviewField); if (fmStart > 1 && fmStart <= tr.state.doc.lines && plugin.settings.hideFrontmatter && livePreview) { newTrans.push({ annotations: [contentRange.of([fmStart, fmEnd])] @@ -45095,47 +44858,10 @@ var frontmatterHider = (plugin) => import_state10.EditorState.transactionFilter. } return [tr, ...newTrans]; }); -var headerViewPlugin = (plugin) => import_view7.ViewPlugin.fromClass( - class { - constructor(view) { - this.statefulDecorationsSet = new StatefulDecorationSet(view, plugin); - this.flowTypeState = view.state.field(flowTypeStateField, false); - if (this.flowTypeState == "doc" || this.flowTypeState == "foldernote" || !this.flowTypeState) - this.statefulDecorationsSet.updateAsyncDecorations(view.state, true); - this.livePreview = view.state.field(import_obsidian44.editorLivePreviewField, false); - } - showHeader(view) { - if ((view.state.field(flowTypeStateField, false) == "doc" || view.state.field(flowTypeStateField, false) == "foldernote" || view.state.field(flowTypeStateField, false) == null) && view.state.field(import_obsidian44.editorLivePreviewField, false)) { - if (!this.headerEnabled) { - this.statefulDecorationsSet.updateAsyncDecorations( - view.state, - true - ); - this.headerEnabled = true; - } - } else { - this.headerEnabled = false; - this.statefulDecorationsSet.updateAsyncDecorations(view.state, false); - } - } - update(update) { - var _a2, _b2; - const infoField = update.state.field(import_obsidian44.editorInfoField, false); - if (update.docChanged || update.state.field(flowTypeStateField, false) != this.flowTypeState || this.filePath != ((_a2 = infoField.file) == null ? void 0 : _a2.path) || this.livePreview != update.state.field(import_obsidian44.editorLivePreviewField, false)) { - this.filePath = (_b2 = infoField.file) == null ? void 0 : _b2.path; - this.livePreview = update.state.field(import_obsidian44.editorLivePreviewField, false); - this.flowTypeState = update.state.field(flowTypeStateField, false); - this.showHeader(update.view); - } - } - destroy() { - } - } -); // src/cm-extensions/lineNumbers.ts -var import_view8 = require("@codemirror/view"); -var lineNumberExtension = (plugin) => (0, import_view8.lineNumbers)({ +var import_view7 = require("@codemirror/view"); +var lineNumberExtension = (plugin) => (0, import_view7.lineNumbers)({ formatNumber: (lineNo, state) => { if (!plugin.settings.inlineContext) { return lineNo.toString(); @@ -45166,8 +44892,8 @@ var cmExtensions = (plugin, mobile) => { if (plugin.settings.inlineContext && plugin.settings.lineNumbers) { extensions.push(lineNumberExtension(plugin)); } - if (plugin.settings.inlineContext && plugin.settings.contextEnabled) - extensions.push(...[statefulDecorations.field, headerViewPlugin(plugin), frontmatterHider(plugin)]); + if (plugin.settings.inlineContext && plugin.settings.contextEnabled && !corePluginEnabled(plugin.app, "properties")) + extensions.push(...[frontmatterHider(plugin)]); extensions.push( ...[toggleMarkExtension, tooltips({ parent: document.body })] ); @@ -45196,7 +44922,7 @@ var cmExtensions = (plugin, mobile) => { }; // src/components/MakeMenu/MakeMenu.tsx -var import_obsidian45 = require("obsidian"); +var import_obsidian47 = require("obsidian"); // src/components/MakeMenu/commands/default.ts var default_default2 = [ @@ -45301,7 +45027,7 @@ function resolveCommands(plugin) { } // src/components/MakeMenu/MakeMenu.tsx -var MakeMenu = class extends import_obsidian45.EditorSuggest { +var MakeMenu = class extends import_obsidian47.EditorSuggest { constructor(app2, plugin) { super(app2); this.inCmd = false; @@ -45394,8 +45120,8 @@ var MakeMenu = class extends import_obsidian45.EditorSuggest { }; // src/components/StickerMenu/StickerMenu.tsx -var import_obsidian46 = require("obsidian"); -var StickerMenu = class extends import_obsidian46.EditorSuggest { +var import_obsidian48 = require("obsidian"); +var StickerMenu = class extends import_obsidian48.EditorSuggest { constructor(app2, plugin) { super(app2); this.inCmd = false; @@ -45465,7 +45191,7 @@ var StickerMenu = class extends import_obsidian46.EditorSuggest { }; // src/main.ts -var import_obsidian63 = require("obsidian"); +var import_obsidian65 = require("obsidian"); // src/utils/flow/markdownPost.tsx var getCMFromElement = (el) => { @@ -45601,7 +45327,7 @@ var replaceAllEmbed = (el, ctx) => { }; // src/components/Spaces/FileTreeView.tsx -var import_obsidian53 = require("obsidian"); +var import_obsidian55 = require("obsidian"); // node_modules/recoil/es/recoil.js function isPromise(p3) { @@ -50696,8 +50422,8 @@ var Recoil_index_34 = Recoil_index.setBatcher; var Recoil_index_35 = Recoil_index.snapshot_UNSTABLE; // src/components/ui/modals/hiddenFilesModal.tsx -var import_obsidian47 = require("obsidian"); -var HiddenItemsModal = class extends import_obsidian47.Modal { +var import_obsidian49 = require("obsidian"); +var HiddenItemsModal = class extends import_obsidian49.Modal { constructor(plugin) { super(plugin.app); this.plugin = plugin; @@ -50836,7 +50562,7 @@ var HiddenFiles = (props2) => { }; // src/components/Spaces/MainMenu.tsx -var import_obsidian48 = require("obsidian"); +var import_obsidian50 = require("obsidian"); // src/recoil/pluginState.ts var activeFile = Recoil_index_4({ @@ -50933,7 +50659,7 @@ var MainMenu = (props2) => { }; const showMenu = (e4) => { const { spaceActive, leafs } = refreshLeafs(); - const menu = new import_obsidian48.Menu(); + const menu = new import_obsidian50.Menu(); !spaceActive && menu.addItem((menuItem) => { menuItem.setIcon("lucide-arrow-left"); menuItem.setTitle(i18n_default.menu.backToSpace); @@ -51486,7 +51212,7 @@ function calculateRange(_ref4) { } // src/components/Spaces/TreeView/FolderTreeView.tsx -var import_obsidian49 = require("obsidian"); +var import_obsidian51 = require("obsidian"); var import_classnames7 = __toESM(require_classnames()); // src/components/Spaces/TreeView/SectionView.tsx @@ -51738,7 +51464,7 @@ var TreeItem = k3( return; } const file = getAbstractFileAtPath(app, data.item.path); - if (file instanceof import_obsidian49.TFolder) { + if (file instanceof import_obsidian51.TFolder) { app.dragManager.onDragStart(e4, { icon: "lucide-folder", source: void 0, @@ -51983,7 +51709,7 @@ function getProjection(items, activeItem, overItemIndex, previousItem, nextItem, } // src/utils/dnd/dropFile.ts -var import_obsidian50 = require("obsidian"); +var import_obsidian52 = require("obsidian"); var dropFileInTree = async (plugin, active, over, projected, flattenedTree, activeSpaces) => { var _a2, _b2, _c2, _d2, _e2, _f, _g, _h; if (projected) { @@ -52056,7 +51782,7 @@ var dropFileInTree = async (plugin, active, over, projected, flattenedTree, acti } } else { if (plugin.app.vault.getAbstractFileByPath(newPath)) { - new import_obsidian50.Notice(i18n_default.notice.duplicateFile); + new import_obsidian52.Notice(i18n_default.notice.duplicateFile); return; } removePathsFromSpace(plugin, activeItem.space, [ @@ -52636,8 +52362,8 @@ var SpaceSwitcher = (props2) => { }; // src/components/ui/modals/tagChangeModal.ts -var import_obsidian51 = require("obsidian"); -var TagChangeModal = class extends import_obsidian51.Modal { +var import_obsidian53 = require("obsidian"); +var TagChangeModal = class extends import_obsidian53.Modal { constructor(plugin, action, tag) { super(plugin.app); this.action = action; @@ -52702,12 +52428,12 @@ var TagChangeModal = class extends import_obsidian51.Modal { // src/components/Spaces/TagContextList/TagContextList.tsx var import_lodash9 = __toESM(require_lodash()); -var import_obsidian52 = require("obsidian"); +var import_obsidian54 = require("obsidian"); var TagContextList = (props2) => { const [allTags, setAllTags] = h2([]); const [allQueries, setAllQueries] = h2([]); const openContextMenu = async (e4, tag) => { - const fileMenu = new import_obsidian52.Menu(); + const fileMenu = new import_obsidian54.Menu(); fileMenu.addItem((menuItem) => { menuItem.setTitle("Rename Tag"); menuItem.setIcon("edit"); @@ -52755,7 +52481,7 @@ var TagContextList = (props2) => { getFolderPathFromString(props2.plugin.settings.tagContextFolder) ); const f4 = (_a2 = folder == null ? void 0 : folder.children.filter( - (f5) => f5 instanceof import_obsidian52.TFile && f5.extension == "mdb" && f5.name.charAt(0) == "#" + (f5) => f5 instanceof import_obsidian54.TFile && f5.extension == "mdb" && f5.name.charAt(0) == "#" ).map((f5) => tagPathToTag(fileNameToString(f5.name)))) != null ? _a2 : []; setAllTags( (0, import_lodash9.uniq)([...f4.filter((g4) => g4), ...Object.keys(app.metadataCache.getTags())]) @@ -52925,14 +52651,14 @@ var MainList = (props2) => { var FILE_TREE_VIEW_TYPE = "mk-file-view"; var VIEW_DISPLAY_TEXT = "Spaces"; var ICON = "layout-grid"; -var FileTreeView = class extends import_obsidian53.ItemView { +var FileTreeView = class extends import_obsidian55.ItemView { constructor(leaf, plugin) { super(leaf); this.navigation = false; this.plugin = plugin; } revealInFolder(file) { - if (file instanceof import_obsidian53.TFolder) { + if (file instanceof import_obsidian55.TFolder) { this.plugin.app.workspace.activeLeaf.setViewState({ type: CONTEXT_VIEW_TYPE, state: { contextPath: file.path } @@ -52987,7 +52713,7 @@ var FileTreeView = class extends import_obsidian53.ItemView { }; // src/settings/settings.ts -var import_obsidian54 = require("obsidian"); +var import_obsidian56 = require("obsidian"); var DEFAULT_SETTINGS = { defaultInitialization: false, filePreviewOnHover: false, @@ -53053,14 +52779,14 @@ var DEFAULT_SETTINGS = { spacesAutoBackupLast: 0, spacesUseAlias: false, precreateVaultSpace: false, - fmKeyAlias: "alias", + fmKeyAlias: "aliases", fmKeyBanner: "banner", fmKeyColor: "color", fmKeySticker: "sticker", openSpacesOnLaunch: true, indexSVG: false }; -var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { +var MakeMDPluginSettingsTab = class extends import_obsidian56.PluginSettingTab { constructor(app2, plugin) { super(app2, plugin); this.plugin = plugin; @@ -53072,7 +52798,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { const { containerEl } = this; containerEl.empty(); containerEl.createEl("h1", { text: i18n_default.settings.sectionSidebar }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.spaces.name).setDesc(i18n_default.settings.spaces.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.spaces.name).setDesc(i18n_default.settings.spaces.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesEnabled).onChange((value) => { this.plugin.settings.spacesEnabled = value; this.plugin.saveSettings(); @@ -53087,55 +52813,55 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { if (this.plugin.settings.spacesEnabled) { containerEl.createEl("h3", { text: i18n_default.settings.sectionAppearance }); const spaceAppearances = containerEl.createEl("div"); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.sidebarTabs.name).setDesc(i18n_default.settings.sidebarTabs.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.sidebarTabs.name).setDesc(i18n_default.settings.sidebarTabs.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.sidebarTabs).onChange((value) => { this.plugin.settings.sidebarTabs = value; this.plugin.saveSettings(); document.body.classList.toggle("mk-hide-tabs", !value); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.hideRibbon.name).setDesc(i18n_default.settings.hideRibbon.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.hideRibbon.name).setDesc(i18n_default.settings.hideRibbon.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.showRibbon).onChange((value) => { this.plugin.settings.showRibbon = value; this.plugin.saveSettings(); document.body.classList.toggle("mk-hide-ribbon", !value); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.compactMode.name).setDesc(i18n_default.settings.compactMode.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.compactMode.name).setDesc(i18n_default.settings.compactMode.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesCompactMode).onChange((value) => { this.plugin.settings.spacesCompactMode = value; this.plugin.detachFileTreeLeafs(); this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.folderIndentationLines.name).setDesc(i18n_default.settings.folderIndentationLines.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.folderIndentationLines.name).setDesc(i18n_default.settings.folderIndentationLines.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.folderIndentationLines).onChange((value) => { this.plugin.settings.folderIndentationLines = value; this.plugin.saveSettings(); document.body.classList.toggle("mk-folder-lines", value); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.spacesStickers.name).setDesc(i18n_default.settings.spacesStickers.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.spacesStickers.name).setDesc(i18n_default.settings.spacesStickers.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesStickers).onChange((value) => { this.plugin.settings.spacesStickers = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.spacesAlias.name).setDesc(i18n_default.settings.spacesAlias.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.spacesAlias.name).setDesc(i18n_default.settings.spacesAlias.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesUseAlias).onChange((value) => { this.plugin.settings.spacesUseAlias = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.openSpacesOnLaunch.name).setDesc(i18n_default.settings.openSpacesOnLaunch.desc).addToggle( + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.openSpacesOnLaunch.name).setDesc(i18n_default.settings.openSpacesOnLaunch.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.openSpacesOnLaunch).onChange((value) => { this.plugin.settings.openSpacesOnLaunch = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text2) => { + new import_obsidian56.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text2) => { text2.setValue(this.plugin.settings.spaceRowHeight.toString()).onChange(async (value) => { text2.setValue(parseInt(value).toString()); this.plugin.settings.spaceRowHeight = parseInt(value); @@ -53143,39 +52869,39 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }); }); containerEl.createEl("h3", { text: "Folder Note" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.folderNote.name).setDesc(i18n_default.settings.folderNote.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.folderNote.name).setDesc(i18n_default.settings.folderNote.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.enableFolderNote).onChange((value) => { this.plugin.settings.enableFolderNote = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.folderNoteLocation.name).setDesc(i18n_default.settings.folderNoteLocation.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.folderNoteLocation.name).setDesc(i18n_default.settings.folderNoteLocation.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.folderNoteInsideFolder).onChange((value) => { this.plugin.settings.folderNoteInsideFolder = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.folderViewDefault.name).setDesc(i18n_default.settings.folderViewDefault.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.folderViewDefault.name).setDesc(i18n_default.settings.folderViewDefault.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.folderNoteDefaultView).onChange((value) => { this.plugin.settings.folderNoteDefaultView = value; this.plugin.saveSettings(); }) ); containerEl.createEl("h3", { text: "Sync and Backup" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.syncTimeout.name).setDesc(i18n_default.settings.syncTimeout.desc).addText((text2) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.syncTimeout.name).setDesc(i18n_default.settings.syncTimeout.desc).addText((text2) => { text2.setValue(this.plugin.settings.spacesSyncTimeoutSeconds.toString()).onChange(async (value) => { text2.setValue(parseInt(value).toString()); this.plugin.settings.spacesSyncTimeoutSeconds = parseInt(value); await this.plugin.saveSettings(); }); }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.spaceAutoBackup.name).setDesc(i18n_default.settings.spaceAutoBackup.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.spaceAutoBackup.name).setDesc(i18n_default.settings.spaceAutoBackup.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesAutoBackup).onChange((value) => { this.plugin.settings.spacesAutoBackup = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.spaceAutoBackupInterval.name).setDesc(i18n_default.settings.spaceAutoBackupInterval.desc).addText((text2) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.spaceAutoBackupInterval.name).setDesc(i18n_default.settings.spaceAutoBackupInterval.desc).addText((text2) => { text2.setValue(this.plugin.settings.spacesAutoBackupInterval.toString()).onChange(async (value) => { text2.setValue(parseInt(value).toString()); this.plugin.settings.spacesAutoBackupInterval = parseInt(value); @@ -53183,37 +52909,37 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }); }); containerEl.createEl("h3", { text: "Advanced" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.hoverPreview.name).setDesc(i18n_default.settings.hoverPreview.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.hoverPreview.name).setDesc(i18n_default.settings.hoverPreview.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.filePreviewOnHover).onChange((value) => { this.plugin.settings.filePreviewOnHover = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.activeFile.name).setDesc(i18n_default.settings.activeFile.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.activeFile.name).setDesc(i18n_default.settings.activeFile.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.revealActiveFile).onChange((value) => { this.plugin.settings.revealActiveFile = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.spacesFileExplorerDual.name).setDesc(i18n_default.settings.spacesFileExplorerDual.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.spacesFileExplorerDual.name).setDesc(i18n_default.settings.spacesFileExplorerDual.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesDisablePatch).onChange((value) => { this.plugin.settings.spacesDisablePatch = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.spacesPerformance.name).setDesc(i18n_default.settings.spacesPerformance.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.spacesPerformance.name).setDesc(i18n_default.settings.spacesPerformance.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.spacesPerformance).onChange((value) => { this.plugin.settings.spacesPerformance = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.indexSVG.name).setDesc(i18n_default.settings.indexSVG.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.indexSVG.name).setDesc(i18n_default.settings.indexSVG.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.indexSVG).onChange((value) => { this.plugin.settings.indexSVG = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.spacesDeleteOption.name).setDesc(i18n_default.settings.spacesDeleteOption.desc).addDropdown((dropdown) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.spacesDeleteOption.name).setDesc(i18n_default.settings.spacesDeleteOption.desc).addDropdown((dropdown) => { dropdown.addOption( "permanent", i18n_default.settings.spacesDeleteOptions.permanant @@ -53231,7 +52957,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }); } containerEl.createEl("h1", { text: "Context" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.contexts.name).setDesc(i18n_default.settings.contexts.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.contexts.name).setDesc(i18n_default.settings.contexts.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.contextEnabled).onChange((value) => { this.plugin.settings.contextEnabled = value; this.plugin.saveSettings(); @@ -53239,27 +52965,27 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }) ); containerEl.createEl("h3", { text: i18n_default.settings.sectionAppearance }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { text2.setValue(this.plugin.settings.defaultDateFormat).onChange(async (value) => { this.plugin.settings.defaultDateFormat = value; await this.plugin.saveSettings(); }); }); containerEl.createEl("h3", { text: i18n_default.settings.sectionAdvanced }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.openFileContext.name).setDesc(i18n_default.settings.openFileContext.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.openFileContext.name).setDesc(i18n_default.settings.openFileContext.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.autoOpenFileContext).onChange((value) => { this.plugin.settings.autoOpenFileContext = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.syncContextToFrontmatter.name).setDesc(i18n_default.settings.syncContextToFrontmatter.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.syncContextToFrontmatter.name).setDesc(i18n_default.settings.syncContextToFrontmatter.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.saveAllContextToFrontmatter).onChange((value) => { this.plugin.settings.saveAllContextToFrontmatter = value; this.plugin.saveSettings(); }) ); containerEl.createEl("h1", { text: "Blink" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.blink.name).setDesc(i18n_default.settings.blink.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.blink.name).setDesc(i18n_default.settings.blink.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.blinkEnabled).onChange(async (value) => { this.plugin.settings.blinkEnabled = value; await this.plugin.saveSettings(); @@ -53267,7 +52993,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }) ); containerEl.createEl("h1", { text: i18n_default.settings.sectionFlow }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.editorMakerMode.name).setDesc(i18n_default.settings.editorMakerMode.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.editorMakerMode.name).setDesc(i18n_default.settings.editorMakerMode.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.makerMode).onChange((value) => { this.plugin.settings.makerMode = value; this.plugin.saveSettings(); @@ -53276,27 +53002,27 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { ); if (this.plugin.settings.makerMode) { containerEl.createEl("h3", { text: "Inline Context" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineContextExplorer.name).setDesc(i18n_default.settings.inlineContextExplorer.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineContextExplorer.name).setDesc(i18n_default.settings.inlineContextExplorer.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.inlineContext).onChange((value) => { this.plugin.settings.inlineContext = value; this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.lineNumbers.name).setDesc(i18n_default.settings.lineNumbers.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.lineNumbers.name).setDesc(i18n_default.settings.lineNumbers.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.lineNumbers).onChange(async (value) => { this.plugin.settings.lineNumbers = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineContextExpanded.name).setDesc(i18n_default.settings.inlineContextExpanded.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineContextExpanded.name).setDesc(i18n_default.settings.inlineContextExpanded.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.inlineContextSectionsExpanded).onChange((value) => { this.plugin.settings.inlineContextSectionsExpanded = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineContextHorizontal.name).setDesc(i18n_default.settings.inlineContextHorizontal.desc).addDropdown((dropdown) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineContextHorizontal.name).setDesc(i18n_default.settings.inlineContextHorizontal.desc).addDropdown((dropdown) => { dropdown.addOption("vertical", i18n_default.settings.layoutVertical); dropdown.addOption("horizontal", i18n_default.settings.layoutHorizontal); dropdown.setValue(this.plugin.settings.inlineContextNameLayout); @@ -53305,20 +53031,20 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { this.plugin.saveSettings(); }); }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.hideFrontmatter.name).setDesc(i18n_default.settings.hideFrontmatter.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.hideFrontmatter.name).setDesc(i18n_default.settings.hideFrontmatter.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.hideFrontmatter).onChange(async (value) => { this.plugin.settings.hideFrontmatter = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.dataviewInlineContext.name).setDesc(i18n_default.settings.dataviewInlineContext.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.dataviewInlineContext.name).setDesc(i18n_default.settings.dataviewInlineContext.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.dataviewInlineContext).onChange((value) => { this.plugin.settings.dataviewInlineContext = value; this.plugin.saveSettings(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineBacklinks.name).setDesc(i18n_default.settings.inlineBacklinks.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineBacklinks.name).setDesc(i18n_default.settings.inlineBacklinks.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.inlineBacklinks).onChange(async (value) => { this.plugin.settings.inlineBacklinks = value; await this.plugin.saveSettings(); @@ -53326,21 +53052,21 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }) ); containerEl.createEl("h3", { text: "Flow Block" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.editorFlowReplace.name).setDesc(i18n_default.settings.editorFlowReplace.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.editorFlowReplace.name).setDesc(i18n_default.settings.editorFlowReplace.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.editorFlow).onChange((value) => { this.plugin.settings.editorFlow = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.internalLinkFlowEditor.name).setDesc(i18n_default.settings.internalLinkFlowEditor.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.internalLinkFlowEditor.name).setDesc(i18n_default.settings.internalLinkFlowEditor.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.internalLinkClickFlow).onChange(async (value) => { this.plugin.settings.internalLinkClickFlow = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.editorFlowStyle.name).setDesc(i18n_default.settings.editorFlowStyle.desc).addDropdown((dropdown) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.editorFlowStyle.name).setDesc(i18n_default.settings.editorFlowStyle.desc).addDropdown((dropdown) => { dropdown.addOption("classic", i18n_default.settings.editorFlowStyle.classic); dropdown.addOption("seamless", i18n_default.settings.editorFlowStyle.seamless); dropdown.addOption("minimal", i18n_default.settings.editorFlowStyle.minimal); @@ -53358,14 +53084,14 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }); }); containerEl.createEl("h3", { text: "Flow Menu" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.editorMakeMenu.name).setDesc(i18n_default.settings.editorMakeMenu.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.editorMakeMenu.name).setDesc(i18n_default.settings.editorMakeMenu.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.flowMenuEnabled).onChange(async (value) => { this.plugin.settings.flowMenuEnabled = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { text2.setValue(this.plugin.settings.menuTriggerChar).onChange(async (value) => { if (value.trim().length < 1) { text2.setValue(this.plugin.settings.menuTriggerChar); @@ -53380,7 +53106,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { await this.plugin.saveSettings(); }); }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.editorMakePlacholder.name).setDesc(i18n_default.settings.editorMakePlacholder.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.editorMakePlacholder.name).setDesc(i18n_default.settings.editorMakePlacholder.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.makeMenuPlaceholder).onChange(async (value) => { this.plugin.settings.makeMenuPlaceholder = value; await this.plugin.saveSettings(); @@ -53388,28 +53114,28 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }) ); containerEl.createEl("h3", { text: "Flow Styler" }); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineStyler.name).setDesc(i18n_default.settings.inlineStyler.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineStyler.name).setDesc(i18n_default.settings.inlineStyler.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.inlineStyler).onChange(async (value) => { this.plugin.settings.inlineStyler = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineStickerMenu.name).setDesc(i18n_default.settings.inlineStickerMenu.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineStickerMenu.name).setDesc(i18n_default.settings.inlineStickerMenu.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.inlineStickerMenu).onChange(async (value) => { this.plugin.settings.inlineStickerMenu = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.inlineStylerColor.name).setDesc(i18n_default.settings.inlineStylerColor.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.inlineStylerColor.name).setDesc(i18n_default.settings.inlineStylerColor.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.inlineStylerColors).onChange((value) => { this.plugin.settings.inlineStylerColors = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian54.Setting(containerEl).setName(i18n_default.settings.mobileMakeBar.name).setDesc(i18n_default.settings.mobileMakeBar.desc).addToggle( + new import_obsidian56.Setting(containerEl).setName(i18n_default.settings.mobileMakeBar.name).setDesc(i18n_default.settings.mobileMakeBar.desc).addToggle( (toggle) => toggle.setValue(this.plugin.settings.mobileMakeBar).onChange((value) => { this.plugin.settings.mobileMakeBar = value; this.plugin.saveSettings(); @@ -53421,7 +53147,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian54.PluginSettingTab { }; // src/components/Blink/Blink.tsx -var import_obsidian55 = require("obsidian"); +var import_obsidian57 = require("obsidian"); // src/components/Blink/BlinkComponent.tsx var BlinkComponent = Cn.forwardRef( @@ -53494,7 +53220,7 @@ BlinkComponent.displayName = "BlinkComponent"; var BlinkComponent_default = BlinkComponent; // src/components/Blink/Blink.tsx -var Blink = class extends import_obsidian55.Modal { +var Blink = class extends import_obsidian57.Modal { constructor(app2, plugin) { super(app2); this.ref = Cn.createRef(); @@ -53527,9 +53253,9 @@ var Blink = class extends import_obsidian55.Modal { }; // src/components/ContextView/MDBFileViewer.tsx -var import_obsidian56 = require("obsidian"); +var import_obsidian58 = require("obsidian"); var MDB_FILE_VIEWER_TYPE = "make-mdb-viewer"; -var MDBFileViewer = class extends import_obsidian56.FileView { +var MDBFileViewer = class extends import_obsidian58.FileView { constructor(leaf, plugin) { super(leaf); this.navigation = true; @@ -53585,11 +53311,131 @@ var MDBFileViewer = class extends import_obsidian56.FileView { }; // src/components/FileContextView/FileContextView.tsx -var import_obsidian57 = require("obsidian"); +var import_obsidian59 = require("obsidian"); + +// src/components/FileContextView/Backlinks.tsx +var BacklinkItem = (props2) => { + const file = F2( + () => getAbstractFileAtPath(app, props2.path), + [props2.path] + ); + const [block, setBlock] = h2([null, null]); + const refreshBlock = (path) => { + var _a2, _b2; + const fCache = app.metadataCache.getCache(path); + const link = [...(_a2 = fCache.links) != null ? _a2 : [], ...(_b2 = fCache.embeds) != null ? _b2 : []].find( + (f4) => props2.source.includes(f4.displayText) + ); + if (link) { + const block2 = fCache.sections.find( + (f4) => f4.position.start.offset <= link.position.start.offset && f4.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]); + } + }; + p2(() => { + refreshBlock(props2.path); + }, []); + p2(() => { + refreshBlock(props2.path); + }, [props2.path]); + const [collapsed, setCollapsed] = h2(false); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse"] + } + }), /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + openAFile(file, props2.plugin, false); + e4.stopPropagation(); + } + }, fileNameToString(file.name))), !collapsed ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-backlink" + }, /* @__PURE__ */ Cn.createElement(FlowView, { + plugin: props2.plugin, + load: true, + path: props2.path, + from: block[0], + to: block[1] + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); +}; +var Backlinks = (props2) => { + const [collapsed, setCollapsed] = h2( + !props2.plugin.settings.inlineBacklinksExpanded + ); + const [backlinks, setBacklinks] = h2([]); + p2(() => { + if (!props2.file) + return; + const bls = uniq([ + ...props2.plugin.index.linksMap.getInverse(props2.file.path), + ...Object.keys(app.metadataCache.resolvedLinks).filter( + (f4) => props2.file.path in app.metadataCache.resolvedLinks[f4] + ) + ]).filter((f4) => abstractFileAtPathExists(app, f4)); + setBacklinks(bls); + }, [props2.file]); + p2(() => { + props2.plugin.settings.inlineBacklinksExpanded = !collapsed; + props2.plugin.saveSettings(); + }, [collapsed]); + const toggleBacklinks = () => { + setCollapsed(!collapsed); + }; + p2(() => { + window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks); + return () => { + window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks); + }; + }, [collapsed]); + return backlinks.length > 0 && props2.file ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component mk-note-footer" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("div", { + className: `mk-icon-xsmall`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-backlink"] + } + }), i18n_default.labels.backlinks, /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + })), /* @__PURE__ */ Cn.createElement("div", null, !collapsed && backlinks.map((f4, i4) => { + var _a2; + return /* @__PURE__ */ Cn.createElement(BacklinkItem, { + path: f4, + key: i4, + plugin: props2.plugin, + source: (_a2 = props2.file) == null ? void 0 : _a2.path + }); + })))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); +}; + +// src/components/FileContextView/FileContextView.tsx var FILE_CONTEXT_VIEW_TYPE = "make-context-view"; var ICON2 = "component"; var VIEW_DISPLAY_TEXT2 = "Context Explorer"; -var FileContextLeafView = class extends import_obsidian57.ItemView { +var FileContextLeafView = class extends import_obsidian59.ItemView { constructor(leaf, plugin) { super(leaf); this.navigation = false; @@ -53650,7 +53496,7 @@ var FileContextView = (props2) => { return afile; }, [selectedPath]); const folderNoteFile = F2(() => { - if (file instanceof import_obsidian57.TFolder) { + if (file instanceof import_obsidian59.TFolder) { const afile2 = getAbstractFileAtPath(app, file.path + ".md"); return afile2; } @@ -53697,8 +53543,8 @@ var FileContextView = (props2) => { }; // src/components/ui/modals/loadSpaceBackupModal.tsx -var import_obsidian58 = require("obsidian"); -var LoadSpaceBackupModal = class extends import_obsidian58.FuzzySuggestModal { +var import_obsidian60 = require("obsidian"); +var LoadSpaceBackupModal = class extends import_obsidian60.FuzzySuggestModal { constructor(plugin, files) { super(app); this.plugin = plugin; @@ -53800,7 +53646,7 @@ var import_obsidian_dataview = __toESM(require_lib()); // src/superstate/superstate.ts var import_lodash10 = __toESM(require_lodash()); -var import_obsidian60 = require("obsidian"); +var import_obsidian62 = require("obsidian"); // src/types/indexMap.ts var _IndexMap = class { @@ -53985,7 +53831,7 @@ var LocalStorageCache = class { }; // src/superstate/workers/manager.ts -var import_obsidian59 = require("obsidian"); +var import_obsidian61 = require("obsidian"); // inline-worker:__inline-worker function inlineWorker(scriptText) { @@ -54002,7 +53848,7 @@ function Worker2() { } // src/superstate/workers/manager.ts -var Manager = class extends import_obsidian59.Component { +var Manager = class extends import_obsidian61.Component { constructor(numWorkers, cache) { super(); this.numWorkers = numWorkers; @@ -54114,7 +53960,7 @@ var loadContexts = (plugin, spaces2) => { getFolderPathFromString(plugin2.settings.tagContextFolder) ); const allcontexts = (_a2 = folder == null ? void 0 : folder.children.filter( - (f4) => f4 instanceof import_obsidian60.TFile && f4.extension == "mdb" && f4.name.charAt(0) == "#" + (f4) => f4 instanceof import_obsidian62.TFile && f4.extension == "mdb" && f4.name.charAt(0) == "#" ).map((f4) => tagContextFromTag(plugin2, tagPathToTag(f4.name)))) != null ? _a2 : []; return allcontexts; }; @@ -54125,7 +53971,7 @@ var loadContexts = (plugin, spaces2) => { getFolderPathFromString(plugin2.settings.tagContextFolder) ); const allcontexts = (_a2 = folder == null ? void 0 : folder.children.filter( - (f4) => f4 instanceof import_obsidian60.TFile && f4.extension == "mdb" && spaces3.some((s5) => s5.name == f4.basename) + (f4) => f4 instanceof import_obsidian62.TFile && f4.extension == "mdb" && spaces3.some((s5) => s5.name == f4.basename) ).map((f4) => spaceContextFromSpace(plugin2, spaceContextPathFromName(f4.basename)))) != null ? _a2 : []; return allcontexts; }; @@ -54134,12 +53980,12 @@ var loadContexts = (plugin, spaces2) => { let rootFolder = app.vault.getRoot(); function recursiveFx(folder) { for (let child of folder.children) { - if (child instanceof import_obsidian60.TFolder) { + if (child instanceof import_obsidian62.TFolder) { let childFolder = child; if (childFolder.children) recursiveFx(childFolder); } - if (child instanceof import_obsidian60.TFile && child.basename == plugin2.settings.folderContextFile && child.path != "/") + if (child instanceof import_obsidian62.TFile && child.basename == plugin2.settings.folderContextFile && child.path != "/") files.push(child); } } @@ -54148,7 +53994,7 @@ var loadContexts = (plugin, spaces2) => { }; return [...getAllTagContextFiles(plugin), ...getAllFolderContextFiles(plugin), ...getAllSpaceContextFiles(plugin, spaces2)]; }; -var Superstate = class extends import_obsidian60.Component { +var Superstate = class extends import_obsidian62.Component { constructor(app2, indexVersion, onChange, plugin) { super(); this.app = app2; @@ -54283,7 +54129,7 @@ var Superstate = class extends import_obsidian60.Component { } } async saveSpacesDatabaseToDisk(tables, save = true) { - if (await app.vault.adapter.exists((0, import_obsidian60.normalizePath)(this.plugin.spacesDBPath)) && !this.spacesDBLoaded) { + if (await app.vault.adapter.exists((0, import_obsidian62.normalizePath)(this.plugin.spacesDBPath)) && !this.spacesDBLoaded) { return; } this.spacesDBLoaded = true; @@ -54330,7 +54176,7 @@ var Superstate = class extends import_obsidian60.Component { async loadFromCache() { const allFiles = getAllAbstractFilesInVault(this.plugin, app); if (this.plugin.settings.indexSVG) { - const cacheIcons = allFiles.filter((f4) => f4 instanceof import_obsidian60.TFile && f4.extension == "svg").map((s5) => this.persister.load(s5.path, "icon").then((string) => { + const cacheIcons = allFiles.filter((f4) => f4 instanceof import_obsidian62.TFile && f4.extension == "svg").map((s5) => this.persister.load(s5.path, "icon").then((string) => { if ((string == null ? void 0 : string.length) > 0) this.iconsCache.set(s5.path, string); })); @@ -54608,7 +54454,7 @@ var Superstate = class extends import_obsidian60.Component { return; } } - const spaceBackupFolder = (0, import_obsidian60.normalizePath)( + const spaceBackupFolder = (0, import_obsidian62.normalizePath)( `${app.vault.configDir}/plugins/make-md/backups` ); if (!await this.app.vault.adapter.exists( @@ -54616,7 +54462,7 @@ var Superstate = class extends import_obsidian60.Component { )) { await this.app.vault.createFolder(spaceBackupFolder); } - const backupPath = (0, import_obsidian60.normalizePath)( + const backupPath = (0, import_obsidian62.normalizePath)( `${spaceBackupFolder}/Spaces ${format(Date.now(), "yyyy-MM-dd HH-mm")}.mdb` ); const dbPathExists = await this.app.vault.adapter.exists(this.plugin.spacesDBPath); @@ -54625,7 +54471,7 @@ var Superstate = class extends import_obsidian60.Component { app.vault.adapter.copy(this.plugin.spacesDBPath, backupPath); } async loadSpaceDBFromBackup(fileName) { - const filePath = (0, import_obsidian60.normalizePath)( + const filePath = (0, import_obsidian62.normalizePath)( `${app.vault.configDir}/plugins/make-md/backups/${fileName}.mdb` ); if (this.app.vault.adapter.exists( @@ -54819,17 +54665,17 @@ var ReadingModeHeader = (props2) => { }; // src/utils/contexts/markdownPost.tsx -var import_obsidian61 = require("obsidian"); +var import_obsidian63 = require("obsidian"); var replaceInlineContext = (plugin, el, ctx) => { replaceMarkdownForReadingMode(el, (dom) => { let element = dom.querySelector(".mod-header"); if (element) { - if (!element.hasClass("mk-header") || element.getAttribute("data-path") != ctx.sourcePath) { + if (!element.hasClass("mk-inline-context") || element.getAttribute("data-path") != ctx.sourcePath) { element.innerHTML = ""; element.setAttribute("data-path", ctx.sourcePath); - element.toggleClass("mk-header", true); + element.toggleClass("mk-inline-context", true); const reactEl = createRoot(element); - ctx.addChild(new import_obsidian61.MarkdownRenderChild(element)); + ctx.addChild(new import_obsidian63.MarkdownRenderChild(element)); if (ctx.sourcePath.match(urlRegex)) { reactEl.render( /* @__PURE__ */ Cn.createElement(FileHeaderContextView, { @@ -54869,6 +54715,49 @@ var loadSQL = async () => { return sql; }; +// src/utils/flow/flow.tsx +var modifyFlowDom = (plugin) => { + if (!app.workspace.activeEditor) + return; + const contentEl = app.workspace.activeEditor.contentEl; + const editorView = app.workspace.activeEditor.editor; + const sizerEl = contentEl.querySelector(".cm-sizer"); + const file = app.workspace.getActiveFile(); + if (sizerEl && file) { + let inlineContext = contentEl.querySelector(".mk-inline-context"); + if (!inlineContext) { + inlineContext = document.createElement("div"); + inlineContext.classList.add("mk-inline-context"); + sizerEl.prepend(inlineContext); + } + const inlineContextReactEl = createRoot(inlineContext); + inlineContextReactEl.render( + /* @__PURE__ */ Cn.createElement(InlineFileContextView, { + plugin, + file, + editorView: editorView.cm, + showHeader: true, + showBanner: true, + isFolderNote: false, + editable: true + }) + ); + let backlinksEl = contentEl.querySelector(".mk-backlinks"); + if (!backlinksEl) { + backlinksEl = document.createElement("div"); + backlinksEl.classList.add("mk-backlinks"); + sizerEl.appendChild(backlinksEl); + } + const backlinksReactEl = createRoot(backlinksEl); + backlinksReactEl.render( + /* @__PURE__ */ Cn.createElement(Backlinks, { + plugin, + file + }) + ); + } +}; + // node_modules/monkey-around/mjs/index.js function around(obj, factories) { const removers = Object.keys(factories).map((key2) => around1(obj, key2, factories[key2])); @@ -54904,10 +54793,10 @@ function around1(obj, method, createWrapper) { } // src/utils/spaces/patches.ts -var import_obsidian62 = require("obsidian"); +var import_obsidian64 = require("obsidian"); var patchFileExplorer = (plugin) => { plugin.register( - around(import_obsidian62.Workspace.prototype, { + around(import_obsidian64.Workspace.prototype, { getLeavesOfType(old) { return function(type) { if (type == "file-explorer") { @@ -54921,7 +54810,7 @@ var patchFileExplorer = (plugin) => { }; var patchWorkspace = (plugin) => { let layoutChanging = false; - const uninstaller = around(import_obsidian62.Workspace.prototype, { + const uninstaller = around(import_obsidian64.Workspace.prototype, { changeLayout(old) { return async function(workspace) { layoutChanging = true; @@ -54942,7 +54831,7 @@ var patchWorkspace = (plugin) => { return false; if (layoutChanging) return false; - if (parent === app.workspace.rootSplit || import_obsidian62.WorkspaceContainer && parent instanceof import_obsidian62.WorkspaceContainer) { + if (parent === app.workspace.rootSplit || import_obsidian64.WorkspaceContainer && parent instanceof import_obsidian64.WorkspaceContainer) { for (const popover of FlowEditor.popoversForWindow( parent.win )) { @@ -55002,7 +54891,7 @@ var patchWorkspace = (plugin) => { }; // src/main.ts -var MakeMDPlugin = class extends import_obsidian63.Plugin { +var MakeMDPlugin = class extends import_obsidian65.Plugin { constructor() { super(...arguments); this.dataViewAPI = () => (0, import_obsidian_dataview.getAPI)(); @@ -55024,12 +54913,12 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { this.onCreate = async (file) => { if (!file) return; - onFileCreated(this, file.path, file instanceof import_obsidian63.TFolder); + onFileCreated(this, file.path, file instanceof import_obsidian65.TFolder); }; this.onDelete = async (file) => { - if (file instanceof import_obsidian63.TFile && file.extension != "mdb") { + if (file instanceof import_obsidian65.TFile && file.extension != "mdb") { onFileDeleted(this, file.path); - } else if (file instanceof import_obsidian63.TFolder) { + } else if (file instanceof import_obsidian65.TFolder) { onFolderDeleted(this, file.path); } this.activeFileChange(); @@ -55038,14 +54927,14 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { if (file.path == this.settings.spacesSyncLastUpdated) { this.index.spacesSynced(); } - if (file instanceof import_obsidian63.TFile && file.extension == "mdb") { + if (file instanceof import_obsidian65.TFile && file.extension == "mdb") { this.index.reloadContext(mdbContextByDBPath(this, file.path)); } }; this.onRename = async (file, oldPath) => { - if (file instanceof import_obsidian63.TFile && file.extension != "mdb") { + if (file instanceof import_obsidian65.TFile && file.extension != "mdb") { await onFileChanged(this, oldPath, file.path); - } else if (file instanceof import_obsidian63.TFolder) { + } else if (file instanceof import_obsidian65.TFolder) { await onFolderChanged(this, oldPath, file.path); } this.activeFileChange(); @@ -55185,7 +55074,7 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { "dataview:metadata-change", (type, file, oldPath) => { if (type === "update" && this.app.metadataCache.fileCache[file.path].mtime >= this.loadTime && this.dataViewAPI().index.revision !== this.dataViewLastIndex && this.dataViewReady) { - if (file instanceof import_obsidian63.TFile) { + if (file instanceof import_obsidian65.TFile) { this.metadataChange(file); } this.dataViewLastIndex = this.dataViewAPI().index.revision; @@ -55221,12 +55110,12 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { convertFolderNote() { const activeLeaf = app.workspace.activeLeaf; if ((activeLeaf == null ? void 0 : activeLeaf.view.getViewType()) == "markdown") { - const view = app.workspace.getActiveViewOfType(import_obsidian63.MarkdownView); - if (view instanceof import_obsidian63.MarkdownView && view.file instanceof import_obsidian63.TFile) { + const view = app.workspace.getActiveViewOfType(import_obsidian65.MarkdownView); + if (view instanceof import_obsidian65.MarkdownView && view.file instanceof import_obsidian65.TFile) { noteToFolderNote(this, view.file, true); } } else { - new import_obsidian63.Notice("The view is not a note"); + new import_obsidian65.Notice("The view is not a note"); } } getActiveFile() { @@ -55247,6 +55136,7 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { } } else if (activeView2.getViewType() == "markdown") { filePath = activeView2.file.path; + modifyFlowDom(this); } return filePath; } @@ -55265,7 +55155,7 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { id: "mk-log", name: "log", callback: () => { - console.log(app.workspace.getActiveViewOfType(import_obsidian63.MarkdownView)); + console.log(app.workspace.getActiveViewOfType(import_obsidian65.MarkdownView)); } }); this.addCommand({ @@ -55318,7 +55208,7 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { name: i18n_default.commandPalette.loadBackupSpace, callback: () => { this.app.vault.adapter.list( - (0, import_obsidian63.normalizePath)(`${app.vault.configDir}/plugins/make-md/backups`) + (0, import_obsidian65.normalizePath)(`${app.vault.configDir}/plugins/make-md/backups`) ).then( (f4) => { const vaultChangeModal = new LoadSpaceBackupModal(this, f4.files.map((f5) => filePathToString(f5))); @@ -55484,14 +55374,14 @@ var MakeMDPlugin = class extends import_obsidian63.Plugin { async onload() { console.time("Loading Make.md"); this.loadTime = Date.now(); - (0, import_obsidian63.addIcon)("mk-logo", mkLogo); + (0, import_obsidian65.addIcon)("mk-logo", mkLogo); await this.loadSettings(); this.index = this.addChild( Superstate.create(this.app, "0.8", () => { this.debouncedRefresh(); }, this) ); - this.spacesDBPath = (0, import_obsidian63.normalizePath)( + this.spacesDBPath = (0, import_obsidian65.normalizePath)( app.vault.configDir + "/plugins/make-md/Spaces.mdb" ); this.loadSuperState(); diff --git a/manifest.json b/manifest.json index 7312f96..c9eceb7 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "make-md", "name": "MAKE.md", - "version": "0.7.18", + "version": "0.7.19", "minAppVersion": "0.16.0", "description": "Make.md brings you features that supercharges Obsidian. Sort your files in custom order and add file icons using Spaces. Edit inline embeds with Flow Editor. And style your text and add new markdown blocks without writing markdown using Maker Mode.", "author": "MAKE.md", diff --git a/styles.css b/styles.css index 237996a..121b856 100644 --- a/styles.css +++ b/styles.css @@ -1,362 +1,445 @@ -/* src/css/FlowComponent.css */ -.mk-folder-scroller { - display: flex !important; +/* src/css/Menu.css */ +.mk-suggestion { + display: flex; flex-direction: column; - align-items: flex-start !important; - line-height: 1.4; - height: 100%; - overflow-x: auto; - position: relative; - z-index: 0; } -.mk-context-header { - margin: var(--file-margins); - margin-bottom: 0; +.mk-menu { + padding: 0; } -.mk-context-header { +.mk-menu .menu-item { + padding: 0; + background-color: unset !important; + gap: 0; +} +.mk-space-settings { + margin-bottom: 12px; +} +.menu-item-title { display: flex; - flex-direction: column; - max-width: var(--file-line-width); - width: 100%; + justify-content: space-between; + align-items: center; } -.markdown-source-view.mod-cm6.is-readable-line-width .mk-folder-outer { - padding: 0 var(--file-margins); - max-width: 100%; +.mk-menu-input.selected { + background-color: unset !important; +} +.mk-menu-input input { + padding: 4px; + border: 0; + outline: 0; + border-radius: 4px; +} +.is-phone .mk-options-container { width: 100%; - margin-left: auto; - margin-right: auto; } -.mk-folder-header { - margin-left: auto; - margin-right: auto; - margin-top: var(--file-margins); +.is-phone .mk-options-menu { width: 100%; - max-width: var(--file-line-width); } -.mk-folder-header .inline-title { - flex-grow: 1; - margin-bottom: 0; +.menu-item-title input[type=text] { + flex: 1; } -.mk-folder-sizer { +.mk-options-menu { + position: relative; + width: 180px; + font-size: 1em; + line-height: 1.2; display: flex; - flex-direction: column; - align-items: stretch; - margin-left: auto; - margin-right: auto; -} -.mk-file-table-header { - margin-top: 24px; - color: var(--text-faint); + flex-wrap: wrap; + cursor: text; } -.mk-file-table { - border-collapse: collapse; - table-layout: fixed; - width: 100%; +.mk-options-menu__selected-tag { + display: inline-block; + box-sizing: border-box; + margin: 0 6px 6px 0; + padding: 6px 8px; + border-radius: 2px; + box-shadow: unset !important; + font-size: inherit; + line-height: inherit; } -.mk-file-row { +.mk-options-menu__selected-tag:after { + content: "\2715"; + color: #aaa; + margin-left: 8px; } -.mk-file-row:hover { - background: var(--background-modifier-hover) !important; +.mk-options-menu__selected-tag:hover, +.mk-options-menu__selected-tag:focus { + border-color: #b1b1b1; } -.mk-file-table tr:nth-child(even) { - background: var(--color-base-10); +.mk-options-menu__selected { + width: 100%; + display: inline-block; + white-space: normal; + padding: 0px 10px; + margin-top: 4px; + border-bottom: thin solid var(--divider-color); } -.mk-file-row td { - padding: 10px 10px; +.mk-options-menu__search { + display: inline-block; + padding: 7px 2px; + max-width: 100%; + width: 100%; } -.mk-file-row .mk-column-file { - width: 99%; +@media screen and (min-width: 30em) { + .mk-options-menu__search { + position: relative; + } } -.mk-file-row p { - text-overflow: ellipsis; - overflow: hidden; - font-size: var(--font-ui-smaller); - color: var(--text-faint); +.mk-options-menu__search-input { + max-width: 100%; + background: unset !important; margin: 0; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - display: -webkit-box; -} -.mk-file-row .mk-file-name { - font-weight: var(--font-medium); -} -.mk-file-date { - font-size: var(--font-ui-smaller); - color: var(--text-muted); - width: 100px; + padding: 0; + border: 0; + outline: none; + font-size: inherit; + line-height: inherit; } -.mk-column-icon { - width: 40px; +.mk-options-menu__search-input::-ms-clear { + display: none; } -.mk-column-icon svg { - width: 16px; - height: 16px; - color: var(--text-muted); +.mk-options-menu__suggestions { + width: 100%; + max-height: 200px; + overflow: auto; } -.mk-flowspace-title svg { - width: 16px; - height: 16px; - color: var(--text-muted); +@media screen and (min-width: 30em) { + .mk-options-menu__suggestions { + width: 240px; + } } -.mk-flowspace-title p { - margin: 0; +.mk-options-menu__suggestions ul { + margin: 4px -1px; padding: 0; - margin-left: 8px; + list-style: none; } -.mk-flowspace-title .mk-flowspace-date { - font-size: var(--font-ui-smaller); - color: var(--text-muted); +.is-phone .mk-options-menu__suggestions li { + padding: var(--size-4-3) var(--size-4-3); } -.mk-flowspace-title { +.mk-options-menu__suggestions li { + margin: 0px 6px; + padding: 6px 8px; + border-radius: var(--radius-s); display: flex; - align-items: center; - padding: 8px 12px; - border-top: 1px solid var(--divider-color); + flex-direction: row; } -.mk-flowspace-editor { - padding: 0px 12px; - width: 100%; +.mk-options-menu__suggestions li .mk-options-menu-inner { + flex: 1; + display: flex; + flex-direction: column; } -.mk-flowspace-editor:not(.mk-foldernote) .mk-floweditor { - padding: 12px 0px; +.mk-options-menu__suggestions li .mk-description { + color: var(--text-faint); + font-size: var(--font-ui-smaller); + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } -.mk-flowspace-editor.mk-foldernote { - width: var(--file-line-width); - max-width: 100%; - margin-left: auto; - margin-right: auto; +.mk-options-menu__suggestions li span { + overflow: hidden; + text-overflow: ellipsis; } -.mk-foldernote .mk-floweditor { - height: 100% !important; +.mk-options-menu__suggestions li mark { + text-decoration: underline; + background: none; + font-weight: 600; + border-radius: unset; + margin: unset; + padding: unset; } -.mk-flowspace-title span { - flex-grow: 1; +.mk-options-menu__suggestions li:hover { + cursor: pointer; + background: var(--background-modifier-hover); } -.mk-flowspace-title button { - padding: 8px; - margin-left: 8px; - width: unset; +.mk-options-menu__suggestions li.is-active { + background: var(--background-modifier-hover); } -.mk-flowspace-title button.mk-open { - background: var(--icon-color-active); +.mk-options-menu__suggestions li.is-disabled { + opacity: 0.5; + cursor: auto; } -.mk-flowspace-title:hover { - background: var(--color-base-10); +.rdp button { + background: initial !important; + box-shadow: initial !important; } -.mk-folder-empty { - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; - font-size: var(--font-ui-small); - font-style: italic; +.rdp .rdp-day_selected { + background: var(--interactive-accent) !important; } -.mk-flow-container { - width: 100%; +.rdp { + --rdp-cell-size: 30px !important; } -.mk-flow-container > div { - border-bottom: thin dotted var(--divider-color); +.mk-properties { + padding: 0 !important; + gap: 0 !important; + background: none !important; } -.mk-flow-container > div > span { - font-size: var(--font-smallest); - padding: var(--size-4-1) var(--context-padding); - color: var(--text-faint); +.mk-properties > .menu-item-title > div { + width: 100%; } -.mk-folder-scroller .mk-flowspace-editor { - padding: 0; +.mk-properties .menu-item span:first-child { + flex-grow: 1; } -.mk-folder-scroller .cm-sizer { +.mk-properties .menu-item span:last-child { + color: var(--text-muted); } -/* src/css/CardsView.css */ -.mk-folder-view .mk-cards-container { - padding-bottom: 60px; -} -.mk-cards-container { - width: 100%; - height: 100%; - overflow-x: auto; -} -.mk-cards-container .mk-list-content > .mk-flowspace-editor { - padding-left: 12px !important; - padding-right: 12px !important; +/* node_modules/react-day-picker/dist/style.css */ +.rdp { + --rdp-cell-size: 40px; + --rdp-accent-color: #0000ff; + --rdp-background-color: #e7edff; + --rdp-accent-color-dark: #3003e1; + --rdp-background-color-dark: #180270; + --rdp-outline: 2px solid var(--rdp-accent-color); + --rdp-outline-selected: 3px solid var(--rdp-accent-color); + margin: 1em; } -.mk-cards-container .mk-list-view { - display: inline-grid; - grid-auto-flow: column; - padding: 20px; - gap: 20px; +.rdp-vhidden { + box-sizing: border-box; + padding: 0; + margin: 0; + background: transparent; + border: 0; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + position: absolute !important; + top: 0; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + overflow: hidden !important; + clip: rect(1px, 1px, 1px, 1px) !important; + border: 0 !important; } -.mk-cards-container .mk-list-item { - border-radius: 4px; - list-style: none; - background: var(--background-secondary); - overflow: hidden; - font-size: var(--font-ui-small); - color: var(--text-muted); - box-shadow: - 0px 1px 2px rgba(0, 0, 0, 0.06), - 0px 3.4px 6.7px rgba(0, 0, 0, 0.06), - 0px 15px 30px rgba(0, 0, 0, 0.15); +.rdp-button_reset { + appearance: none; + position: relative; + margin: 0; + padding: 0; + cursor: default; + color: inherit; + background: none; + font: inherit; + -moz-appearance: none; + -webkit-appearance: none; } -.mk-cards-container .mk-list-group { - width: 200px; +.rdp-button_reset:focus-visible { + outline: none; } -.mk-cards-grid .mk-list-item { - width: 250px; +.rdp-button { + border: 2px solid transparent; } -.mk-cards-container .mk-file-icon svg { - display: none; +.rdp-button[disabled]:not(.rdp-day_selected) { + opacity: 0.25; } -.mk-cards-grid .mk-list-group { - width: 100% !important; +.rdp-button:not([disabled]) { + cursor: pointer; } -.mk-cards-grid .mk-list-group ul { - flex-direction: row !important; - flex-wrap: wrap; +.rdp-button:focus-visible:not([disabled]) { + color: inherit; + background-color: var(--rdp-background-color); + border: var(--rdp-outline); } -.mk-cards-container .mk-list-group ul { - list-style: none; - padding-inline-start: 0px; - display: flex; - flex-direction: column; - gap: 10px; +.rdp-button:hover:not([disabled]):not(.rdp-day_selected) { + background-color: var(--rdp-background-color); } -.mk-list-container .mk-list-group-header { +.rdp-months { display: flex; - padding: 12px 24px 4px 24px; - background-color: var(--titlebar-background); } -.mk-list-container .mk-list-group-header > div { - background: none !important; +.rdp-month { + margin: 0 1em; } -.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container { - padding-bottom: 0; +.rdp-month:first-child { + margin-left: 0; } -.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container .mk-list-item { - padding: 8px; +.rdp-month:last-child { + margin-right: 0; } -.mk-folder-view .mk-list-container { - padding-bottom: 100px; +.rdp-table { + margin: 0; + max-width: calc(var(--rdp-cell-size) * 7); + border-collapse: collapse; } -.mk-list-container { - width: 100%; - height: 100%; - overflow-y: auto; +.rdp-with_weeknumber .rdp-table { + max-width: calc(var(--rdp-cell-size) * 8); + border-collapse: collapse; } -.mk-list-container .mk-list-view { +.rdp-caption { display: flex; - flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 0; + text-align: left; } -.mk-cards-container .mk-list-item.mk-is-active, -.mk-list-container .mk-list-item.mk-is-active { - background: var(--background-modifier-active-hover); +.rdp-multiple_months .rdp-caption { + position: relative; + display: block; + text-align: center; } -.mk-folder-view .mk-list-container .mk-list-item { - padding: 8px var(--context-padding) 0 var(--context-padding); +.rdp-caption_dropdowns { + position: relative; + display: inline-flex; } -.mk-list-container .mk-list-item { - display: flex; - padding: 8px; - list-style: none; - font-size: var(--font-ui-small); - color: var(--text-muted); - align-items: flex-start; +.rdp-caption_label { + position: relative; + z-index: 1; + display: inline-flex; + align-items: center; + margin: 0; + padding: 0 0.25em; + white-space: nowrap; + color: currentColor; + border: 0; + border: 2px solid transparent; + font-family: inherit; + font-size: 140%; + font-weight: bold; } -.mk-list-container .mk-list-content { - flex-grow: 1; - display: flex; - flex-direction: column; - border-bottom: thin solid var(--divider-color); - min-height: 69px; +.rdp-nav { + white-space: nowrap; } -.mk-list-container .mk-list-fields { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 8px; - padding-bottom: 8px; +.rdp-multiple_months .rdp-caption_start .rdp-nav { + position: absolute; + top: 50%; + left: 0; + transform: translateY(-50%); } -.mk-list-container .mk-list-fields > div { - margin-bottom: -8px; +.rdp-multiple_months .rdp-caption_end .rdp-nav { + position: absolute; + top: 50%; + right: 0; + transform: translateY(-50%); } -.mk-list-container .mk-list-fields > div:not(.mk-cell-file):not(.mk-cell-image) { - width: unset !important; +.rdp-nav_button { + display: inline-flex; + align-items: center; + justify-content: center; + width: var(--rdp-cell-size); + height: var(--rdp-cell-size); + padding: 0.25em; + border-radius: 100%; } -.mk-list-container .mk-list-fields > .mk-cell-image { - width: 100%; +.rdp-dropdown_year, +.rdp-dropdown_month { + position: relative; + display: inline-flex; + align-items: center; } -.mk-list-container .mk-list-group { +.rdp-dropdown { + appearance: none; + position: absolute; + z-index: 2; + top: 0; + bottom: 0; + left: 0; width: 100%; + margin: 0; + padding: 0; + cursor: inherit; + opacity: 0; + border: none; + background-color: transparent; + font-family: inherit; + font-size: inherit; + line-height: inherit; } -.mk-cards-container .mk-cell-file-title, -.mk-list-container .mk-cell-file-title { - padding: 4px; - color: var(--text-normal); - margin-bottom: 0; +.rdp-dropdown[disabled] { + opacity: unset; + color: unset; } -.mk-list-container .mk-list-fields .mk-cell-file { - width: 100%; - font-weight: var(--bold-weight); +.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label { + background-color: var(--rdp-background-color); + border: var(--rdp-outline); + border-radius: 6px; } -.mk-cards-container .mk-list-fields { - padding: 12px; - align-items: flex-start; - display: flex; - flex-direction: column; +.rdp-dropdown_icon { + margin: 0 0 0 5px; } -.mk-list-fields .mk-cell-file-preview { - width: 100%; - color: var(--text-normal); - margin-bottom: -8px; - color: var(--text-faint); - text-overflow: ellipsis; - overflow: hidden; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - display: -webkit-box; +.rdp-head { + border: 0; } -.mk-list-container .mk-list-group ul { - list-style: none; - padding-inline-start: 0px; - display: flex; - flex-direction: column; - margin-top: 0; - margin-bottom: 0; +.rdp-head_row, +.rdp-row { + height: 100%; } -.mk-file-preview { - background: var(--label-color); +.rdp-head_cell { + vertical-align: middle; + font-size: 0.75em; + font-weight: 700; + text-align: center; + height: 100%; + height: var(--rdp-cell-size); + padding: 0; } -.mk-list-container .mk-file-preview { - min-width: 48px; - height: 48px; - border-radius: 8px; - margin-right: 8px; - margin-top: 8px; +.rdp-tbody { + border: 0; +} +.rdp-tfoot { + margin: 0.5em; +} +.rdp-cell { + width: var(--rdp-cell-size); + height: 100%; + height: var(--rdp-cell-size); + padding: 0; + text-align: center; +} +.rdp-weeknumber { + font-size: 0.75em; +} +.rdp-weeknumber, +.rdp-day { display: flex; + overflow: hidden; align-items: center; justify-content: center; + box-sizing: border-box; + width: var(--rdp-cell-size); + max-width: var(--rdp-cell-size); + height: var(--rdp-cell-size); + margin: 0; + border: 2px solid transparent; + border-radius: 100%; } -.mk-list-group-header .mk-cell-option-item { - background: none !important; +.rdp-day_today:not(.rdp-day_outside) { + font-weight: bold; +} +.rdp-day_selected, +.rdp-day_selected:focus-visible, +.rdp-day_selected:hover { + color: white; + opacity: 1; + background-color: var(--rdp-accent-color); +} +.rdp-day_outside { + opacity: 0.5; +} +.rdp-day_selected:focus-visible { + outline: var(--rdp-outline); + outline-offset: 2px; + z-index: 1; +} +.rdp:not([dir="rtl"]) .rdp-day_range_start:not(.rdp-day_range_end) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.rdp:not([dir="rtl"]) .rdp-day_range_end:not(.rdp-day_range_start) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.rdp[dir=rtl] .rdp-day_range_start:not(.rdp-day_range_end) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; } -.mk-cards-container .mk-file-preview { - position: relative; - margin-bottom: 4px; - height: 80px; +.rdp[dir=rtl] .rdp-day_range_end:not(.rdp-day_range_start) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; } -.mk-cards-container .mk-file-icon { - position: absolute; - bottom: -6px; - font-size: 24px; - left: 14px; +.rdp-day_range_end.rdp-day_range_start { + border-radius: 100%; } -.mk-list-container .mk-file-icon { - font-size: 20px; - display: flex; - align-items: center; - justify-content: center; +.rdp-day_range_middle { + border-radius: 0; } /* src/css/Table.css */ @@ -722,757 +805,674 @@ body { filter: var(--link-unresolved-filter); } -/* src/css/Menu.css */ -.mk-suggestion { +/* src/css/ContextBuilder.css */ +.is-phone .mk-context-maker { + max-height: 100vh; +} +.mk-context-maker-container { + height: 100%; display: flex; flex-direction: column; } -.mk-menu { - padding: 0; -} -.mk-menu .menu-item { - padding: 0; - background-color: unset !important; - gap: 0; -} -.mk-space-settings { - margin-bottom: 12px; +.mk-context-maker .modal-content { + height: var(--dialog-max-height); } -.menu-item-title { +.mk-context-maker-preview { display: flex; - justify-content: space-between; - align-items: center; -} -.mk-menu-input.selected { - background-color: unset !important; + flex-wrap: wrap; + gap: 4px; + margin-bottom: 16px; + padding: var(--size-4-4); + flex-grow: 1; + overflow: scroll; + padding-bottom: 0; } -.mk-menu-input input { - padding: 4px; - border: 0; - outline: 0; +.mk-context-maker-item { + background: rgba(var(--mono-rgb-100), 0.025); border-radius: 4px; -} -.is-phone .mk-options-container { - width: 100%; -} -.is-phone .mk-options-menu { - width: 100%; -} -.menu-item-title input[type=text] { - flex: 1; -} -.mk-options-menu { - position: relative; - width: 180px; - font-size: 1em; - line-height: 1.2; + overflow: hidden; display: flex; - flex-wrap: wrap; - cursor: text; -} -.mk-options-menu__selected-tag { - display: inline-block; - box-sizing: border-box; - margin: 0 6px 6px 0; - padding: 6px 8px; - border-radius: 2px; - box-shadow: unset !important; - font-size: inherit; - line-height: inherit; -} -.mk-options-menu__selected-tag:after { - content: "\2715"; - color: #aaa; - margin-left: 8px; -} -.mk-options-menu__selected-tag:hover, -.mk-options-menu__selected-tag:focus { - border-color: #b1b1b1; -} -.mk-options-menu__selected { - width: 100%; - display: inline-block; - white-space: normal; - padding: 0px 10px; - margin-top: 4px; - border-bottom: thin solid var(--divider-color); -} -.mk-options-menu__search { - display: inline-block; - padding: 7px 2px; - max-width: 100%; - width: 100%; -} -@media screen and (min-width: 30em) { - .mk-options-menu__search { - position: relative; - } -} -.mk-options-menu__search-input { - max-width: 100%; - background: unset !important; - margin: 0; - padding: 0; - border: 0; - outline: none; - font-size: inherit; - line-height: inherit; -} -.mk-options-menu__search-input::-ms-clear { - display: none; -} -.mk-options-menu__suggestions { - width: 100%; - max-height: 200px; - overflow: auto; -} -@media screen and (min-width: 30em) { - .mk-options-menu__suggestions { - width: 240px; - } -} -.mk-options-menu__suggestions ul { - margin: 4px -1px; - padding: 0; - list-style: none; + align-items: center; + gap: 2px; + padding: 8px; } -.is-phone .mk-options-menu__suggestions li { - padding: var(--size-4-3) var(--size-4-3); +.mk-context-maker-selector { + font-size: var(--font-ui-small); + height: 240px; + overflow-y: scroll; + background: rgba(var(--mono-rgb-100), 0.025); + padding: var(--size-4-4); + border-radius: 4px; } -.mk-options-menu__suggestions li { - margin: 0px 6px; - padding: 6px 8px; - border-radius: var(--radius-s); - display: flex; - flex-direction: row; +.mk-context-maker-selector .mk-cell-option { + margin-bottom: 8px; } -.mk-options-menu__suggestions li .mk-options-menu-inner { - flex: 1; +.mk-context-maker-builder { + min-height: 60px; display: flex; - flex-direction: column; -} -.mk-options-menu__suggestions li .mk-description { - color: var(--text-faint); - font-size: var(--font-ui-smaller); - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; -} -.mk-options-menu__suggestions li span { - overflow: hidden; - text-overflow: ellipsis; -} -.mk-options-menu__suggestions li mark { - text-decoration: underline; - background: none; - font-weight: 600; - border-radius: unset; - margin: unset; - padding: unset; -} -.mk-options-menu__suggestions li:hover { - cursor: pointer; - background: var(--background-modifier-hover); -} -.mk-options-menu__suggestions li.is-active { - background: var(--background-modifier-hover); -} -.mk-options-menu__suggestions li.is-disabled { - opacity: 0.5; - cursor: auto; -} -.rdp button { - background: initial !important; - box-shadow: initial !important; -} -.rdp .rdp-day_selected { - background: var(--interactive-accent) !important; -} -.rdp { - --rdp-cell-size: 30px !important; -} -.mk-properties { - padding: 0 !important; - gap: 0 !important; - background: none !important; -} -.mk-properties > .menu-item-title > div { - width: 100%; -} -.mk-properties .menu-item span:first-child { - flex-grow: 1; -} -.mk-properties .menu-item span:last-child { - color: var(--text-muted); -} - -/* node_modules/react-day-picker/dist/style.css */ -.rdp { - --rdp-cell-size: 40px; - --rdp-accent-color: #0000ff; - --rdp-background-color: #e7edff; - --rdp-accent-color-dark: #3003e1; - --rdp-background-color-dark: #180270; - --rdp-outline: 2px solid var(--rdp-accent-color); - --rdp-outline-selected: 3px solid var(--rdp-accent-color); - margin: 1em; -} -.rdp-vhidden { - box-sizing: border-box; - padding: 0; - margin: 0; - background: transparent; - border: 0; - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; - position: absolute !important; - top: 0; - width: 1px !important; - height: 1px !important; - padding: 0 !important; - overflow: hidden !important; - clip: rect(1px, 1px, 1px, 1px) !important; - border: 0 !important; + flex-wrap: wrap; + padding: 8px; + gap: 4px; } -.rdp-button_reset { - appearance: none; - position: relative; - margin: 0; +.mk-context-maker { padding: 0; - cursor: default; - color: inherit; - background: none; - font: inherit; - -moz-appearance: none; - -webkit-appearance: none; } -.rdp-button_reset:focus-visible { - outline: none; +.mk-context-maker-layout > div > div { + border-bottom: thin solid var(--divider-color); + padding: 4px; } -.rdp-button { - border: 2px solid transparent; +.mk-context-maker-layout > div { + display: flex; + flex-direction: column; + gap: 8px; } -.rdp-button[disabled]:not(.rdp-day_selected) { - opacity: 0.25; + +/* src/css/FilterBar.css */ +.mk-view-selector, +.mk-table-selector { + margin-right: 0; + display: flex; + align-items: center; + gap: 16px; + min-height: 48px; + max-width: 100%; + overflow-x: auto; } -.rdp-button:not([disabled]) { - cursor: pointer; +.mk-view-selector { + margin-left: var(--file-margins); } -.rdp-button:focus-visible:not([disabled]) { - color: inherit; - background-color: var(--rdp-background-color); - border: var(--rdp-outline); +.mk-view-selector::-webkit-scrollbar { + display: none; } -.rdp-button:hover:not([disabled]):not(.rdp-day_selected) { - background-color: var(--rdp-background-color); +.mk-view-selector > div > .mk-collapse { + padding-right: 8px; + padding-left: 0px; } -.rdp-months { - display: flex; +.mk-view-selector .mk-collapse.mk-icon-xsmall svg { + color: unset; } -.rdp-month { - margin: 0 1em; +.mk-view-selector > div > button:not(:last-child) { + padding-right: 0px; } -.rdp-month:first-child { - margin-left: 0; +.mk-view-selector > div, +.mk-view-selector > button { + border-radius: 0; + margin: 4px -8px; + display: flex; + align-items: center; + border-bottom: thin solid transparent; + height: 100%; } -.rdp-month:last-child { - margin-right: 0; +.mk-view-config .mk-is-active button { + color: var(--text-normal); } -.rdp-table { - margin: 0; - max-width: calc(var(--rdp-cell-size) * 7); - border-collapse: collapse; +.mk-view-config .mk-is-active { + border-bottom: thin solid var(--text-normal); + color: var(--text-normal); + background: none !important; } -.rdp-with_weeknumber .rdp-table { - max-width: calc(var(--rdp-cell-size) * 8); - border-collapse: collapse; +.mk-table-selector button, +.mk-view-config button { + background: rgba(var(--nav-item-background-active), 0.3); + border: none; + box-shadow: none; + color: var(--text-faint); } -.rdp-caption { +.mk-view-config button:hover { + color: var(--text-normal); +} +.mk-view-config { + width: 100%; display: flex; - align-items: center; - justify-content: space-between; - padding: 0; - text-align: left; + color: var(--text-faint); + align-items: stretch; + border-bottom: 1px solid var(--divider-color); + flex-wrap: wrap; } -.rdp-multiple_months .rdp-caption { - position: relative; - display: block; - text-align: center; +.mk-view-config input { + background: none; + border: none; + flex-grow: 1; } -.rdp-caption_dropdowns { - position: relative; - display: inline-flex; +.is-phone .mk-view-config { + flex-wrap: wrap; } -.rdp-caption_label { - position: relative; - z-index: 1; - display: inline-flex; +.is-phone .mk-view-config button { + width: unset; +} +.mk-view-search { + background: var(--background-modifier-form-field); + border: var(--input-border-width) solid var(--background-modifier-border); + display: flex; + border-radius: 8px; align-items: center; - margin: 0; - padding: 0 0.25em; - white-space: nowrap; - color: currentColor; - border: 0; - border: 2px solid transparent; - font-family: inherit; - font-size: 140%; - font-weight: bold; + flex-grow: 1; } -.rdp-nav { - white-space: nowrap; +.mk-view-search button:hover { + background: unset !important; } -.rdp-multiple_months .rdp-caption_start .rdp-nav { - position: absolute; - top: 50%; - left: 0; - transform: translateY(-50%); +.mk-view-search button { + margin: 0 !important; + padding: var(--size-4-1) var(--size-4-2) !important; } -.rdp-multiple_months .rdp-caption_end .rdp-nav { - position: absolute; - top: 50%; - right: 0; - transform: translateY(-50%); +.is-phone .mk-view-options { + margin-top: 8px; + margin-bottom: 8px; } -.rdp-nav_button { - display: inline-flex; +.mk-view-options { + display: flex; align-items: center; - justify-content: center; - width: var(--rdp-cell-size); - height: var(--rdp-cell-size); - padding: 0.25em; - border-radius: 100%; + color: var(--text-normal) !important; + min-height: 48px; + padding-left: var(--context-padding); + padding-right: var(--size-4-3); + flex-grow: 1; } -.rdp-dropdown_year, -.rdp-dropdown_month { - position: relative; - display: inline-flex; - align-items: center; +.mk-view-config span { + flex-grow: 10; } -.rdp-dropdown { - appearance: none; - position: absolute; - z-index: 2; - top: 0; - bottom: 0; - left: 0; +.mk-view-config svg { + width: 14px; + height: 14px; +} +.mk-filter-bar { + display: flex; + padding: 8px var(--context-padding); + gap: 8px; width: 100%; - margin: 0; - padding: 0; - cursor: inherit; - opacity: 0; - border: none; - background-color: transparent; - font-family: inherit; - font-size: inherit; - line-height: inherit; + border-bottom: 1px solid var(--divider-color); } -.rdp-dropdown[disabled] { - opacity: unset; - color: unset; +.mk-filter-bar span { + flex-grow: 1; } -.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label { - background-color: var(--rdp-background-color); - border: var(--rdp-outline); - border-radius: 6px; +.mk-view-config .mk-is-active, +.mk-table-selector .mk-is-active { + color: var(--text-normal) !important; } -.rdp-dropdown_icon { - margin: 0 0 0 5px; +.mk-filter { + display: flex; + font-size: var(--font-ui-small); + color: var(--text-muted); + padding: 0px; } -.rdp-head { - border: 0; +.mk-filter > span, +.mk-filter > div { + background: var(--interactive-normal); } -.rdp-head_row, -.rdp-row { - height: 100%; +.mk-filter > span:hover, +.mk-filter > div:hover { + background: var(--interactive-hover); } -.rdp-head_cell { - vertical-align: middle; - font-size: 0.75em; - font-weight: 700; - text-align: center; - height: 100%; - height: var(--rdp-cell-size); - padding: 0; +.mk-filter > *:first-child { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + padding-left: 10px; +} +.mk-filter > *:last-child { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + padding-right: 6px; +} +.mk-filter > span { + border-right: thin solid var(--background-primary); + padding: 4px 8px; + display: flex; + align-items: center; } -.rdp-tbody { - border: 0; +.mk-filter div { + display: flex; + align-items: center; + padding-left: 4px; } -.rdp-tfoot { - margin: 0.5em; +.mk-filter div svg { + width: 14px; + height: 14px; } -.rdp-cell { - width: var(--rdp-cell-size); - height: 100%; - height: var(--rdp-cell-size); - padding: 0; - text-align: center; +.mk-query { + display: flex; + flex-direction: column; + gap: 16px; + margin-bottom: 16px; } -.rdp-weeknumber { - font-size: 0.75em; +.mk-query-filters { + flex-direction: column; + padding: 0; + border-bottom: none; } -.rdp-weeknumber, -.rdp-day { +.mk-query-filter, +.mk-query-group-type { display: flex; - overflow: hidden; + width: 100%; +} +.mk-query-group-type { + padding-bottom: 4px; +} +.mk-query-group-type .mk-filter { align-items: center; - justify-content: center; - box-sizing: border-box; - width: var(--rdp-cell-size); - max-width: var(--rdp-cell-size); - height: var(--rdp-cell-size); - margin: 0; - border: 2px solid transparent; - border-radius: 100%; } -.rdp-day_today:not(.rdp-day_outside) { - font-weight: bold; +.mk-query-group button { + background-color: unset; + box-shadow: none; + width: unset; } -.rdp-day_selected, -.rdp-day_selected:focus-visible, -.rdp-day_selected:hover { - color: white; - opacity: 1; - background-color: var(--rdp-accent-color); +.is-phone .mk-query-group button { + background-color: var(--interative-normal); } -.rdp-day_outside { - opacity: 0.5; +.mk-query-group-type > span, +.mk-query-filter > span { + flex-grow: 1; } -.rdp-day_selected:focus-visible { - outline: var(--rdp-outline); - outline-offset: 2px; - z-index: 1; +.mk-folder-note { + display: flex; + align-items: center; + gap: 4px; } -.rdp:not([dir="rtl"]) .rdp-day_range_start:not(.rdp-day_range_end) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; +.mk-filter-add { + border: thin solid var(--divider-color) !important; + border-radius: 4px; + box-shadow: none !important; + background: none !important; + display: flex; + align-items: center; + padding: 4px; + font-size: var(--font-ui-small); + color: var(--text-muted); + gap: 4px; } -.rdp:not([dir="rtl"]) .rdp-day_range_end:not(.rdp-day_range_start) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; +.mk-filter-add div { + display: flex; } -.rdp[dir=rtl] .rdp-day_range_start:not(.rdp-day_range_end) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; +.mk-search-bar { } -.rdp[dir=rtl] .rdp-day_range_end:not(.rdp-day_range_start) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; +.mk-tag-selector { + display: flex; + gap: 8px; + margin-top: 8px; + margin-bottom: 8px; + flex-wrap: wrap; } -.rdp-day_range_end.rdp-day_range_start { - border-radius: 100%; +.mk-tag-selector svg { + color: var(--tag-color) !important; } -.rdp-day_range_middle { - border-radius: 0; +.mk-tag-selector div { + cursor: var(--cursor-link); + font-size: var(--font-ui-medium); + display: flex; } - -/* src/css/ContextBuilder.css */ -.is-phone .mk-context-maker { - max-height: 100vh; +.mk-tag-selector button { + height: auto; + border-radius: var(--tag-radius); + color: var(--tag-color); + background-color: var(--tag-background); + border: var(--tag-border-width) solid var(--tag-border-color); + box-shadow: none !important; + font-size: var(--tag-size); + vertical-align: baseline; + border-left: none; + border-right: none; + padding-top: var(--tag-padding-y) !important; + padding-bottom: var(--tag-padding-y) !important; } -.mk-context-maker-container { + +/* src/css/FlowComponent.css */ +.mk-folder-scroller { + display: flex !important; + flex-direction: column; + align-items: flex-start !important; + line-height: 1.4; height: 100%; + overflow-x: auto; + position: relative; + z-index: 0; +} +.mk-context-header { + margin: var(--file-margins); + margin-bottom: 0; +} +.mk-context-header { display: flex; flex-direction: column; + max-width: var(--file-line-width); + width: 100%; } -.mk-context-maker .modal-content { - height: var(--dialog-max-height); +.markdown-source-view.mod-cm6.is-readable-line-width .mk-folder-outer { + padding: 0 var(--file-margins); + max-width: 100%; + width: 100%; + margin-left: auto; + margin-right: auto; } -.mk-context-maker-preview { - display: flex; - flex-wrap: wrap; - gap: 4px; - margin-bottom: 16px; - padding: var(--size-4-4); +.mk-folder-header { + margin-left: auto; + margin-right: auto; + margin-top: var(--file-margins); + width: 100%; + max-width: var(--file-line-width); +} +.mk-folder-header .inline-title { flex-grow: 1; - overflow: scroll; - padding-bottom: 0; + margin-bottom: 0; } -.mk-context-maker-item { - background: rgba(var(--mono-rgb-100), 0.025); - border-radius: 4px; - overflow: hidden; +.mk-folder-sizer { display: flex; - align-items: center; - gap: 2px; - padding: 8px; + flex-direction: column; + align-items: stretch; + margin-left: auto; + margin-right: auto; } -.mk-context-maker-selector { - font-size: var(--font-ui-small); - height: 240px; - overflow-y: scroll; - background: rgba(var(--mono-rgb-100), 0.025); - padding: var(--size-4-4); - border-radius: 4px; +.mk-file-table-header { + margin-top: 24px; + color: var(--text-faint); } -.mk-context-maker-selector .mk-cell-option { - margin-bottom: 8px; +.mk-file-table { + border-collapse: collapse; + table-layout: fixed; + width: 100%; } -.mk-context-maker-builder { - min-height: 60px; - display: flex; - flex-wrap: wrap; - padding: 8px; - gap: 4px; +.mk-file-row { } -.mk-context-maker { - padding: 0; +.mk-file-row:hover { + background: var(--background-modifier-hover) !important; } -.mk-context-maker-layout > div > div { - border-bottom: thin solid var(--divider-color); - padding: 4px; +.mk-file-table tr:nth-child(even) { + background: var(--color-base-10); } -.mk-context-maker-layout > div { - display: flex; - flex-direction: column; - gap: 8px; +.mk-file-row td { + padding: 10px 10px; } - -/* src/css/FilterBar.css */ -.mk-view-selector, -.mk-table-selector { - margin-right: 0; - display: flex; - align-items: center; - gap: 16px; - min-height: 48px; - max-width: 100%; - overflow-x: auto; +.mk-file-row .mk-column-file { + width: 99%; +} +.mk-file-row p { + text-overflow: ellipsis; + overflow: hidden; + font-size: var(--font-ui-smaller); + color: var(--text-faint); + margin: 0; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + display: -webkit-box; +} +.mk-file-row .mk-file-name { + font-weight: var(--font-medium); } -.mk-view-selector { - margin-left: var(--file-margins); +.mk-file-date { + font-size: var(--font-ui-smaller); + color: var(--text-muted); + width: 100px; } -.mk-view-selector::-webkit-scrollbar { - display: none; +.mk-column-icon { + width: 40px; } -.mk-view-selector > div > .mk-collapse { - padding-right: 8px; - padding-left: 0px; +.mk-column-icon svg { + width: 16px; + height: 16px; + color: var(--text-muted); } -.mk-view-selector .mk-collapse.mk-icon-xsmall svg { - color: unset; +.mk-flowspace-title svg { + width: 16px; + height: 16px; + color: var(--text-muted); } -.mk-view-selector > div > button:not(:last-child) { - padding-right: 0px; +.mk-flowspace-title p { + margin: 0; + padding: 0; + margin-left: 8px; } -.mk-view-selector > div, -.mk-view-selector > button { - border-radius: 0; - margin: 4px -8px; +.mk-flowspace-title .mk-flowspace-date { + font-size: var(--font-ui-smaller); + color: var(--text-muted); +} +.mk-flowspace-title { display: flex; align-items: center; - border-bottom: thin solid transparent; - height: 100%; -} -.mk-view-config .mk-is-active button { - color: var(--text-normal); + padding: 8px 12px; + border-top: 1px solid var(--divider-color); } -.mk-view-config .mk-is-active { - border-bottom: thin solid var(--text-normal); - color: var(--text-normal); - background: none !important; +.mk-flowspace-editor { + padding: 0px 12px; + width: 100%; } -.mk-table-selector button, -.mk-view-config button { - background: rgba(var(--nav-item-background-active), 0.3); - border: none; - box-shadow: none; - color: var(--text-faint); +.mk-flowspace-editor:not(.mk-foldernote) .mk-floweditor { + padding: 12px 0px; } -.mk-view-config button:hover { - color: var(--text-normal); +.mk-flowspace-editor.mk-foldernote { + width: var(--file-line-width); + max-width: 100%; + margin-left: auto; + margin-right: auto; } -.mk-view-config { - width: 100%; - display: flex; - color: var(--text-faint); - align-items: stretch; - border-bottom: 1px solid var(--divider-color); - flex-wrap: wrap; +.mk-foldernote .mk-floweditor { + height: 100% !important; } -.mk-view-config input { - background: none; - border: none; +.mk-flowspace-title span { flex-grow: 1; } -.is-phone .mk-view-config { - flex-wrap: wrap; -} -.is-phone .mk-view-config button { +.mk-flowspace-title button { + padding: 8px; + margin-left: 8px; width: unset; } -.mk-view-search { - background: var(--background-modifier-form-field); - border: var(--input-border-width) solid var(--background-modifier-border); +.mk-flowspace-title button.mk-open { + background: var(--icon-color-active); +} +.mk-flowspace-title:hover { + background: var(--color-base-10); +} +.mk-folder-empty { + width: 100%; + height: 100%; display: flex; - border-radius: 8px; align-items: center; - flex-grow: 1; + justify-content: center; + font-size: var(--font-ui-small); + font-style: italic; } -.mk-view-search button:hover { - background: unset !important; +.mk-flow-container { + width: 100%; } -.mk-view-search button { - margin: 0 !important; - padding: var(--size-4-1) var(--size-4-2) !important; +.mk-flow-container > div { + border-bottom: thin dotted var(--divider-color); } -.is-phone .mk-view-options { - margin-top: 8px; - margin-bottom: 8px; +.mk-flow-container > div > span { + font-size: var(--font-smallest); + padding: var(--size-4-1) var(--context-padding); + color: var(--text-faint); } -.mk-view-options { - display: flex; - align-items: center; - color: var(--text-normal) !important; - min-height: 48px; - padding-left: var(--context-padding); - padding-right: var(--size-4-3); - flex-grow: 1; +.mk-folder-scroller .mk-flowspace-editor { + padding: 0; } -.mk-view-config span { - flex-grow: 10; +.mk-folder-scroller .cm-sizer { } -.mk-view-config svg { - width: 14px; - height: 14px; + +/* src/css/CardsView.css */ +.mk-folder-view .mk-cards-container { + padding-bottom: 60px; } -.mk-filter-bar { - display: flex; - padding: 8px var(--context-padding); - gap: 8px; +.mk-cards-container { width: 100%; - border-bottom: 1px solid var(--divider-color); + height: 100%; + overflow-x: auto; } -.mk-filter-bar span { - flex-grow: 1; +.mk-cards-container .mk-list-content > .mk-flowspace-editor { + padding-left: 12px !important; + padding-right: 12px !important; } -.mk-view-config .mk-is-active, -.mk-table-selector .mk-is-active { - color: var(--text-normal) !important; +.mk-cards-container .mk-list-view { + display: inline-grid; + grid-auto-flow: column; + padding: 20px; + gap: 20px; } -.mk-filter { - display: flex; +.mk-cards-container .mk-list-item { + border-radius: 4px; + list-style: none; + background: var(--background-secondary); + overflow: hidden; font-size: var(--font-ui-small); color: var(--text-muted); - padding: 0px; + box-shadow: + 0px 1px 2px rgba(0, 0, 0, 0.06), + 0px 3.4px 6.7px rgba(0, 0, 0, 0.06), + 0px 15px 30px rgba(0, 0, 0, 0.15); } -.mk-filter > span, -.mk-filter > div { - background: var(--interactive-normal); +.mk-cards-container .mk-list-group { + width: 200px; } -.mk-filter > span:hover, -.mk-filter > div:hover { - background: var(--interactive-hover); +.mk-cards-grid .mk-list-item { + width: 250px; } -.mk-filter > *:first-child { - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - padding-left: 10px; +.mk-cards-container .mk-file-icon svg { + display: none; } -.mk-filter > *:last-child { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - padding-right: 6px; +.mk-cards-grid .mk-list-group { + width: 100% !important; } -.mk-filter > span { - border-right: thin solid var(--background-primary); - padding: 4px 8px; +.mk-cards-grid .mk-list-group ul { + flex-direction: row !important; + flex-wrap: wrap; +} +.mk-cards-container .mk-list-group ul { + list-style: none; + padding-inline-start: 0px; display: flex; - align-items: center; + flex-direction: column; + gap: 10px; } -.mk-filter div { +.mk-list-container .mk-list-group-header { display: flex; - align-items: center; - padding-left: 4px; + padding: 12px 24px 4px 24px; + background-color: var(--titlebar-background); } -.mk-filter div svg { - width: 14px; - height: 14px; +.mk-list-container .mk-list-group-header > div { + background: none !important; } -.mk-query { +.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container { + padding-bottom: 0; +} +.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container .mk-list-item { + padding: 8px; +} +.mk-folder-view .mk-list-container { + padding-bottom: 100px; +} +.mk-list-container { + width: 100%; + height: 100%; + overflow-y: auto; +} +.mk-list-container .mk-list-view { display: flex; flex-direction: column; - gap: 16px; - margin-bottom: 16px; } -.mk-query-filters { - flex-direction: column; - padding: 0; - border-bottom: none; +.mk-cards-container .mk-list-item.mk-is-active, +.mk-list-container .mk-list-item.mk-is-active { + background: var(--background-modifier-active-hover); +} +.mk-folder-view .mk-list-container .mk-list-item { + padding: 8px var(--context-padding) 0 var(--context-padding); +} +.mk-list-container .mk-list-item { + display: flex; + padding: 8px; + list-style: none; + font-size: var(--font-ui-small); + color: var(--text-muted); + align-items: flex-start; } -.mk-query-filter, -.mk-query-group-type { +.mk-list-container .mk-list-content { + flex-grow: 1; display: flex; - width: 100%; -} -.mk-query-group-type { - padding-bottom: 4px; + flex-direction: column; + border-bottom: thin solid var(--divider-color); + min-height: 69px; } -.mk-query-group-type .mk-filter { +.mk-list-container .mk-list-fields { + display: flex; + flex-wrap: wrap; align-items: center; + gap: 8px; + padding-bottom: 8px; } -.mk-query-group button { - background-color: unset; - box-shadow: none; - width: unset; +.mk-list-container .mk-list-fields > div { + margin-bottom: -8px; } -.is-phone .mk-query-group button { - background-color: var(--interative-normal); +.mk-list-container .mk-list-fields > div:not(.mk-cell-file):not(.mk-cell-image) { + width: unset !important; } -.mk-query-group-type > span, -.mk-query-filter > span { - flex-grow: 1; +.mk-list-container .mk-list-fields > .mk-cell-image { + width: 100%; } -.mk-folder-note { - display: flex; - align-items: center; - gap: 4px; +.mk-list-container .mk-list-group { + width: 100%; } -.mk-filter-add { - border: thin solid var(--divider-color) !important; - border-radius: 4px; - box-shadow: none !important; - background: none !important; - display: flex; - align-items: center; +.mk-cards-container .mk-cell-file-title, +.mk-list-container .mk-cell-file-title { padding: 4px; - font-size: var(--font-ui-small); - color: var(--text-muted); - gap: 4px; + color: var(--text-normal); + margin-bottom: 0; } -.mk-filter-add div { +.mk-list-container .mk-list-fields .mk-cell-file { + width: 100%; + font-weight: var(--bold-weight); +} +.mk-cards-container .mk-list-fields { + padding: 12px; + align-items: flex-start; display: flex; + flex-direction: column; } -.mk-search-bar { +.mk-list-fields .mk-cell-file-preview { + width: 100%; + color: var(--text-normal); + margin-bottom: -8px; + color: var(--text-faint); + text-overflow: ellipsis; + overflow: hidden; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + display: -webkit-box; } -.mk-tag-selector { +.mk-list-container .mk-list-group ul { + list-style: none; + padding-inline-start: 0px; display: flex; - gap: 8px; - margin-top: 8px; - margin-bottom: 8px; - flex-wrap: wrap; + flex-direction: column; + margin-top: 0; + margin-bottom: 0; } -.mk-tag-selector svg { - color: var(--tag-color) !important; +.mk-file-preview { + background: var(--label-color); } -.mk-tag-selector div { - cursor: var(--cursor-link); - font-size: var(--font-ui-medium); +.mk-list-container .mk-file-preview { + min-width: 48px; + height: 48px; + border-radius: 8px; + margin-right: 8px; + margin-top: 8px; display: flex; + align-items: center; + justify-content: center; } -.mk-tag-selector button { - height: auto; - border-radius: var(--tag-radius); - color: var(--tag-color); - background-color: var(--tag-background); - border: var(--tag-border-width) solid var(--tag-border-color); - box-shadow: none !important; - font-size: var(--tag-size); - vertical-align: baseline; - border-left: none; - border-right: none; - padding-top: var(--tag-padding-y) !important; - padding-bottom: var(--tag-padding-y) !important; +.mk-list-group-header .mk-cell-option-item { + background: none !important; +} +.mk-cards-container .mk-file-preview { + position: relative; + margin-bottom: 4px; + height: 80px; +} +.mk-cards-container .mk-file-icon { + position: absolute; + bottom: -6px; + font-size: 24px; + left: 14px; +} +.mk-list-container .mk-file-icon { + font-size: 20px; + display: flex; + align-items: center; + justify-content: center; } /* src/css/FlowEditor.css */ @@ -1716,64 +1716,6 @@ div:not(.mk-flowspace-editor) > .mk-floweditor .cm-content { padding-bottom: 10px !important; } -/* src/css/InlineMenu.css */ -body:not(.is-mobile) .mk-style-menu { - margin-left: -80px; -} -.mk-style-menu { - display: flex; - padding: 0; - margin-top: -50px; -} -.is-mobile .mk-style-menu svg { - width: 32px; - height: 32px; -} -.is-mobile .mk-style-menu { - --mobile-toolbar-height: 48px; - border-radius: 0; - width: 100%; - margin-top: 0; - overflow-x: auto; - justify-content: center; - height: var(--mobile-toolbar-height); - border-top: var(--divider-width) solid var(--divider-color); -} -.mk-style-menu .mk-mark { - margin: 4px; - padding: 4px; - border-radius: 4px; - display: flex; -} -.mk-style-menu .mk-mark:hover { - background: var(--background-modifier-hover); -} -.mk-style-menu .mk-mark-active { - background: var(--background-modifier-hover); -} -.mk-style-menu svg { - color: var(--text-muted); -} -.mk-divider { - border-left: thin solid var(--background-modifier-hover); - width: 1px; -} -.mk-color { - width: 24px; - height: 24px; - border-radius: 12px; - margin: 8px; -} -.mk-color:hover { - opacity: 0.8; -} -mark { - color: unset; - border-radius: 2px; - margin: 0px 2px; - padding: 0px 2px; -} - /* src/css/FileContext.css */ .mk-file-context { margin-bottom: 12px; @@ -1994,15 +1936,23 @@ c .mk-section-title, .mk-file-context-file-horizontal .mk-file-context-collapse { bottom: 8px; } -.mk-header .mk-file-context-collapse.mk-collapsed { +.markdown-source-view:not(.is-live-preview) > .cm-editor > .cm-scroller > .cm-sizer > .mk-inline-context { + display: none; +} +.mk-inline-context { + gap: 8px; + display: flex; + flex-direction: column; +} +.mk-inline-context .mk-file-context-collapse.mk-collapsed { opacity: 1; color: var(--collapse-icon-color-collapsed); } -.mk-header .mk-file-context-collapse.mk-collapsed svg { +.mk-inline-context .mk-file-context-collapse.mk-collapsed svg { color: var(--collapse-icon-color-collapsed); } -.mk-header:hover .mk-file-context-collapse { - opacity: 1; +.mk-inline-context:hover .mk-file-context-collapse { + opacity: 1 !important; } .markdown-source-view.mod-cm6 .cm-content > .cm-line.mk-has-banner { position: inherit !important; @@ -2010,9 +1960,7 @@ c .mk-section-title, .markdown-source-view.mod-cm6 .mk-has-backlinks img.cm-widgetBuffer { display: none !important; } -.mk-header .mk-file-context-component { - z-index: 1; - pointer-events: none; +.mk-inline-context .mk-file-context-component { gap: 8px; } .markdown-source-view.mod-cm6 .cm-content .mk-note-footer { @@ -2057,7 +2005,7 @@ c .mk-section-title, .mk-inline-context-enabled .markdown-reading-view .frontmatter-container { display: none; } -.markdown-reading-view .mk-file-context-component .mk-spacer, +.mk-inline-context .mk-file-context-component .mk-spacer, .markdown-source-view.mod-cm6 .cm-content > .mk-header .mk-spacer, .mk-folder-view .mk-folder-header .mk-spacer { height: var(--header-height) !important; @@ -2074,7 +2022,7 @@ c .mk-section-title, opacity: 1; } .mk-folder-header .mk-file-context-file .mk-file-icon, -.mk-header .mk-file-context-file .mk-file-icon { +.mk-inline-context .mk-file-context-file .mk-file-icon { width: 48px; height: 48px; margin-bottom: 8px; @@ -2095,13 +2043,71 @@ c .mk-section-title, } .mk-folder-header .mk-file-icon svg, .mk-folder-header .mk-file-icon button, -.mk-header .mk-file-icon svg, -.mk-header .mk-file-icon button { +.mk-inline-context .mk-file-icon svg, +.mk-inline-context .mk-file-icon button { width: 48px; height: 48px; font-size: 40px; } +/* src/css/InlineMenu.css */ +body:not(.is-mobile) .mk-style-menu { + margin-left: -80px; +} +.mk-style-menu { + display: flex; + padding: 0; + margin-top: -50px; +} +.is-mobile .mk-style-menu svg { + width: 32px; + height: 32px; +} +.is-mobile .mk-style-menu { + --mobile-toolbar-height: 48px; + border-radius: 0; + width: 100%; + margin-top: 0; + overflow-x: auto; + justify-content: center; + height: var(--mobile-toolbar-height); + border-top: var(--divider-width) solid var(--divider-color); +} +.mk-style-menu .mk-mark { + margin: 4px; + padding: 4px; + border-radius: 4px; + display: flex; +} +.mk-style-menu .mk-mark:hover { + background: var(--background-modifier-hover); +} +.mk-style-menu .mk-mark-active { + background: var(--background-modifier-hover); +} +.mk-style-menu svg { + color: var(--text-muted); +} +.mk-divider { + border-left: thin solid var(--background-modifier-hover); + width: 1px; +} +.mk-color { + width: 24px; + height: 24px; + border-radius: 12px; + margin: 8px; +} +.mk-color:hover { + opacity: 0.8; +} +mark { + color: unset; + border-radius: 2px; + margin: 0px 2px; + padding: 0px 2px; +} + /* src/css/MakeMenu.css */ .mk-slash-item { display: flex;