Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Merge remote-tracking branch 'origin/main' into standalone
Elian Doran1b7d2da6cbcc
diff --cc apps/client/src/services/frontend_script_api.tsindex a76a09d557,a76a09d557..63f3e77452--- a/apps/client/src/services/frontend_script_api.ts+++ b/apps/client/src/services/frontend_script_api.ts@@@ -206,7 -206,7 +206,7 @@@ export interface Api* Instance name identifies particular Trilium instance. It can be useful for scripts* if some action needs to happen on only one specific instance.*/-- getInstanceName(): string;++ getInstanceName(): string | null;/*** @returns date in YYYY-MM-DD formatdiff --cc apps/client/src/widgets/collections/table/rows.tsindex 47530ecbde,47530ecbde..55a19eae6c--- a/apps/client/src/widgets/collections/table/rows.ts+++ b/apps/client/src/widgets/collections/table/rows.ts@@@ -1,5 -1,5 +1,7 @@@++import { LabelType } from "@triliumnext/commons";++import FNote from "../../../entities/fnote.js";--import { extractAttributeDefinitionTypeAndName, type LabelType } from "../../../services/promoted_attribute_definition_parser.js";++import { extractAttributeDefinitionTypeAndName } from "../../../services/promoted_attribute_definition_parser.js";import type { AttributeDefinitionInformation } from "./columns.js";export type TableData = {@@@ -49,7 -49,7 +51,7 @@@ export async function buildRowDefinitioisArchived: note.isArchived,branchId: branch.branchId,colorClass: note.getColorClass()-- }++ };if (note.hasChildren() && (maxDepth < 0 || currentDepth < maxDepth)) {const { definitions, rowNumber: subRowNumber } = (await buildRowDefinitions(note, infos, includeArchived, maxDepth, currentDepth + 1));diff --cc apps/server/package.jsonindex eb365c6997,f80ed441e6..d36caddd23--- a/apps/server/package.json+++ b/apps/server/package.json@@@ -55,9 -55,11 +55,8 @@@"@types/fs-extra": "11.0.4","@types/html": "1.0.4","@types/ini": "4.1.1",- "@types/multer": "2.0.0",- "@types/mime-types": "3.0.1",+ "@types/multer": "2.1.0","@types/safe-compare": "1.1.2",- "@types/sanitize-html": "2.16.1",-- "@types/sax": "1.2.7","@types/serve-favicon": "2.5.7","@types/serve-static": "2.2.0","@types/stream-throttle": "0.1.4",@@@ -77,13 -79,14 +76,13 @@@"cls-hooked": "4.2.2","compression": "1.8.1","cookie-parser": "1.4.7",- "csrf-csrf": "3.2.2",+ "csrf-csrf": "4.0.3","debounce": "3.0.0","debug": "4.4.3",- "ejs": "4.0.1",- "electron": "40.2.1",+ "ejs": "5.0.1",+ "electron": "41.0.3","electron-debug": "4.1.0","electron-window-state": "5.0.3",- "escape-html": "1.0.3","express": "5.2.1","express-http-proxy": "2.1.2","express-openid-connect": "2.19.4",@@@ -104,14 -107,15 +103,12 @@@"is-svg": "6.1.0","jimp": "1.6.0","lorem-ipsum": "2.0.8",- "marked": "17.0.1",- "multer": "2.0.2",+ "marked": "17.0.5",- "mime-types": "3.0.2",+ "multer": "2.1.1","normalize-strings": "1.1.1",- "ollama": "0.6.3",- "openai": "6.17.0","rand-token": "1.0.1",- "safe-compare": "1.1.4",- "sax": "1.4.4",+ "safe-compare": "1.1.4",- "sanitize-filename": "1.6.4",- "sanitize-html": "2.17.2",+ "sax": "1.6.0","serve-favicon": "2.5.1","stream-throttle": "0.1.3","strip-bom": "5.0.0",@@@ -121,8 -125,10 +118,9 @@@"time2fa": "1.4.2","tmp": "0.2.5","turnish": "1.8.0",- "ws": "8.19.0",- "unescape": "1.0.1",+ "vite": "8.0.1",+ "ws": "8.20.0","xml2js": "0.6.2",- "yauzl": "3.2.0"+ "yauzl": "3.2.1"}}diff --cc apps/server/src/app.tsindex fec992bbe5,3c5f4bdb72..463c0f01ec--- a/apps/server/src/app.ts+++ b/apps/server/src/app.ts@@@ -97,18 -99,18 +98,18 @@@ export default async function buildApp(custom.register(app);error_handlers.register(app);- // triggers sync timer- await import("./services/sync.js");+ const { startSyncTimer } = await import("./services/sync.js");+ startSyncTimer();- // triggers backup timerawait import("./services/backup.js");- // trigger consistency checks timer- await import("./services/consistency_checks.js");+ const { startConsistencyChecks } = await import("./services/consistency_checks.js");+ startConsistencyChecks();- await import("./services/scheduler.js");+ const { startScheduler } = await import("./services/scheduler.js");+ startScheduler();- startScheduledCleanup();+ erase.startScheduledCleanup();if (utils.isElectron) {(await import("@electron/remote/main/index.js")).initialize();diff --cc apps/server/src/etapi/etapi_utils.tsindex 18ab8d7068,34ed0d9cb7..d5285dc04a--- a/apps/server/src/etapi/etapi_utils.ts+++ b/apps/server/src/etapi/etapi_utils.ts@@@ -1,7 -1,7 +1,8 @@@import type { NextFunction, Request, RequestHandler, Response, Router } from "express";+ import type { ParamsDictionary } from "express-serve-static-core";import becca from "../becca/becca.js";+import { namespace } from "../cls_provider.js";import type { ApiRequestHandler, SyncRouteRequestHandler } from "../routes/route_api.js";import cls from "../services/cls.js";import config from "../services/config.js";@@@ -51,10 -51,10 +52,10 @@@ function checkEtapiAuth(req: Request, r}}- function processRequest(req: Request, res: Response, routeHandler: ApiRequestHandler, next: NextFunction, method: string, path: string) {+ function processRequest<P extends ParamsDictionary>(req: Request<P>, res: Response, routeHandler: ApiRequestHandler<P>, next: NextFunction, method: string, path: string) {try {- cls.namespace.bindEmitter(req);- cls.namespace.bindEmitter(res);+ namespace.bindEmitter(req);+ namespace.bindEmitter(res);cls.init(() => {cls.set("componentId", "etapi");@@@ -88,9 -88,8 +89,9 @@@ function getAndCheckNote(noteId: stringif (note) {return note;- }+ }throw new EtapiError(404, "NOTE_NOT_FOUND", `Note '${noteId}' not found.`);-++}function getAndCheckAttachment(attachmentId: string) {@@@ -98,9 -97,8 +99,9 @@@if (attachment) {return attachment;- }+ }throw new EtapiError(404, "ATTACHMENT_NOT_FOUND", `Attachment '${attachmentId}' not found.`);-++}function getAndCheckBranch(branchId: string) {@@@ -108,9 -106,8 +109,9 @@@if (branch) {return branch;- }+ }throw new EtapiError(404, "BRANCH_NOT_FOUND", `Branch '${branchId}' not found.`);-++}function getAndCheckAttribute(attributeId: string) {@@@ -118,9 -115,8 +119,9 @@@if (attribute) {return attribute;- }+ }throw new EtapiError(404, "ATTRIBUTE_NOT_FOUND", `Attribute '${attributeId}' not found.`);-++}function getAndCheckRevision(revisionId: string) {diff --cc apps/server/src/routes/api/clipper.tsindex fe2486059b,b5560c715b..3a91588518--- a/apps/server/src/routes/api/clipper.ts+++ b/apps/server/src/routes/api/clipper.ts@@@ -201,7 -202,7 +201,6 @@@ function openNote(req: Request<{ noteIdreturn {result: "open-in-browser"};--}function handshake() {diff --cc apps/server/src/routes/api/import.tsindex a37124bbbb,7f3b657d24..e6686a86f7--- a/apps/server/src/routes/api/import.ts+++ b/apps/server/src/routes/api/import.ts@@@ -1,4 -1,3 +1,4 @@@- import { becca_loader,ValidationError } from "@triliumnext/core";++import { becca_loader, ValidationError } from "@triliumnext/core";import type { Request } from "express";import path from "path";diff --cc apps/server/src/routes/api/note_map.tsindex 69d8f3bcfa,35b2d35456..fa941b884c--- a/apps/server/src/routes/api/note_map.ts+++ b/apps/server/src/routes/api/note_map.ts@@@ -1,11 -1,12 +1,10 @@@- "use strict";--+ import { BacklinkCountResponse, BacklinksResponse } from "@triliumnext/commons";+ import type { Request } from "express";+ import { HTMLElement, parse, TextNode } from "node-html-parser";import becca from "../../becca/becca.js";- import type BNote from "../../becca/entities/bnote.js";import type BAttribute from "../../becca/entities/battribute.js";- import type { Request } from "express";- import { HTMLElement, parse, TextNode } from "node-html-parser";- import { BacklinkCountResponse, BacklinksResponse } from "@triliumnext/commons";+ import type BNote from "../../becca/entities/bnote.js";interface TreeLink {sourceNoteId: string;@@@ -156,9 -157,9 +155,9 @@@ function getLinkMap(req: Request<{ notereturn false;} else if (excludeRelations.has(rel.name)) {return false;- } else {- return true;- }+ }+ return true;-++}).map((rel) => ({id: `${rel.noteId}-${rel.name}-${rel.value}`,@@@ -351,7 -351,17 +350,7 @@@ function getFilteredBacklinks(note: BNo);}- function getBacklinks(req: Request): BacklinksResponse {-function getBacklinkCount(req: Request<{ noteId: string }>) {- const { noteId } = req.params;-- const note = becca.getNoteOrThrow(noteId);-- return {- count: getFilteredBacklinks(note).length- } satisfies BacklinkCountResponse;-}-+ function getBacklinks(req: Request<{ noteId: string }>): BacklinksResponse {const { noteId } = req.params;const note = becca.getNoteOrThrow(noteId);diff --cc apps/server/src/routes/api/similar_notes.tsindex afa845b102,41449d4154..95306da71d--- a/apps/server/src/routes/api/similar_notes.ts+++ b/apps/server/src/routes/api/similar_notes.ts@@@ -3,8 -2,9 +3,8 @@@ import { similarity } from "@triliumneximport type { Request } from "express";import becca from "../../becca/becca.js";-import similarityService from "../../becca/similarity.js";- async function getSimilarNotes(req: Request) {+ async function getSimilarNotes(req: Request<{ noteId: string }>) {const noteId = req.params.noteId;const _note = becca.getNoteOrThrow(noteId);diff --cc apps/server/src/routes/api/sync.tsindex da55e4ba4b,8597b07c6d..a4307382e9--- a/apps/server/src/routes/api/sync.ts+++ b/apps/server/src/routes/api/sync.ts@@@ -1,5 -1,4 +1,5 @@@- import { type EntityChange,SyncTestResponse } from "@triliumnext/commons";+ import { type EntityChange, SyncTestResponse } from "@triliumnext/commons";+import { ValidationError } from "@triliumnext/core";import type { Request } from "express";import { t } from "i18next";@@@ -286,10 -286,10 +286,9 @@@ function update(req: Request)if (pageIndex !== pageCount - 1) {return;- }+ }body = JSON.parse(partialRequests[requestId].payload);delete partialRequests[requestId];--}const { entities, instanceId } = body;diff --cc apps/server/src/routes/index.tsindex 79eca17588,8094c0bdf6..09bfc924a4--- a/apps/server/src/routes/index.ts+++ b/apps/server/src/routes/index.ts@@@ -8,11 -6,14 +8,10 @@@ import appPath from "../services/app_paimport assetPath from "../services/asset_path.js";import attributeService from "../services/attributes.js";import config from "../services/config.js";-import { getCurrentLocale } from "../services/i18n.js";-import { generateCss, generateIconRegistry, getIconPacks, MIME_TO_EXTENSION_MAPPINGS } from "../services/icon_packs.js";import log from "../services/log.js";import optionService from "../services/options.js";-import protectedSessionService from "../services/protected_session.js";-import { generateCsrfToken } from "./csrf_protection.js";-import sql from "../services/sql.js";import { isDev, isElectron, isMac, isWindows11 } from "../services/utils.js";- import { generateToken as generateCsrfToken } from "./csrf_protection.js";-++import { generateCsrfToken } from "./csrf_protection.js";type View = "desktop" | "mobile" | "print";diff --cc apps/server/src/routes/route_api.tsindex 9adf33c628,444cc260d4..10e3f078ea--- a/apps/server/src/routes/route_api.ts+++ b/apps/server/src/routes/route_api.ts@@@ -1,8 -1,10 +1,9 @@@- import { routes, NotFoundError, ValidationError } from "@triliumnext/core";++import { NotFoundError, routes, ValidationError } from "@triliumnext/core";import express, { type RequestHandler } from "express";+ import type { ParamsDictionary } from "express-serve-static-core";import multer from "multer";-import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js";-import NotFoundError from "../errors/not_found_error.js";-import ValidationError from "../errors/validation_error.js";+import { namespace } from "../cls_provider.js";import auth from "../services/auth.js";import cls from "../services/cls.js";import entityChangesService from "../services/entity_changes.js";@@@ -20,9 -22,37 +21,9 @@@ type HttpMethod = "all" | "get" | "postexport type ApiResultHandler = (req: express.Request, res: express.Response, result: unknown) => number;type NotAPromise<T> = T & { then?: void };- export type ApiRequestHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => unknown;- export type SyncRouteRequestHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => NotAPromise<object> | number | string | void | null;+ export type ApiRequestHandler<P extends ParamsDictionary> = (req: express.Request<P>, res: express.Response, next: express.NextFunction) => unknown;+ export type SyncRouteRequestHandler<P extends ParamsDictionary> = (req: express.Request<P>, res: express.Response, next: express.NextFunction) => NotAPromise<object> | number | string | void | null;-/** Handling common patterns. If entity is not caught, serialization to JSON will fail */-function convertEntitiesToPojo(result: unknown) {- if (result instanceof AbstractBeccaEntity) {- result = result.getPojo();- } else if (Array.isArray(result)) {- for (const idx in result) {- if (result[idx] instanceof AbstractBeccaEntity) {- result[idx] = result[idx].getPojo();- }- }- } else if (result && typeof result === "object") {- if ("note" in result && result.note instanceof AbstractBeccaEntity) {- result.note = result.note.getPojo();- }-- if ("branch" in result && result.branch instanceof AbstractBeccaEntity) {- result.branch = result.branch.getPojo();- }- }-- if (result && typeof result === "object" && "executionResult" in result) {- // from runOnBackend()- result.executionResult = convertEntitiesToPojo(result.executionResult);- }-- return result;-}-export function apiResultHandler(req: express.Request, res: express.Response, result: unknown) {res.setHeader("trilium-max-entity-change-id", entityChangesService.getMaxEntityChangeId());diff --cc apps/server/src/routes/routes.tsindex cebca41bce,ce9b84f0a9..92bc03e1e3--- a/apps/server/src/routes/routes.ts+++ b/apps/server/src/routes/routes.ts@@@ -18,10 -17,15 +18,9 @@@ import auth from "../services/auth.js"import openID from '../services/open_id.js';import { isElectron } from "../services/utils.js";import shareRoutes from "../share/routes.js";- import anthropicRoute from "./api/anthropic.js";-import appInfoRoute from "./api/app_info.js";-import attachmentsApiRoute from "./api/attachments.js";-import attributesRoute from "./api/attributes.js";import autocompleteApiRoute from "./api/autocomplete.js";import backendLogRoute from "./api/backend_log.js";-import branchesApiRoute from "./api/branches.js";-import bulkActionRoute from "./api/bulk_action.js";import clipperRoute from "./api/clipper.js";-import cloningApiRoute from "./api/cloning.js";import databaseRoute from "./api/database.js";import etapiTokensApiRoutes from "./api/etapi_tokens.js";import exportRoute from "./api/export.js";@@@ -29,15 -33,19 +28,12 @@@ import filesRoute from "./api/files.js"import fontsRoute from "./api/fonts.js";import imageRoute from "./api/image.js";import importRoute from "./api/import.js";- import llmRoute from "./api/llm.js";-import keysRoute from "./api/keys.js";import loginApiRoute from "./api/login.js";import metricsRoute from "./api/metrics.js";import noteMapRoute from "./api/note_map.js";- import ollamaRoute from "./api/ollama.js";- import openaiRoute from "./api/openai.js";-import notesApiRoute from "./api/notes.js";-import optionsApiRoute from "./api/options.js";import otherRoute from "./api/other.js";import passwordApiRoute from "./api/password.js";-import recentChangesApiRoute from "./api/recent_changes.js";-import recentNotesRoute from "./api/recent_notes.js";import recoveryCodes from './api/recovery_codes.js';-import relationMapApiRoute from "./api/relation-map.js";-import revisionsApiRoute from "./api/revisions.js";import scriptRoute from "./api/script.js";import searchRoute from "./api/search.js";import senderRoute from "./api/sender.js";diff --cc apps/server/src/services/export/zip.tsindex e9eec69bf5,a6cd5b59c3..5efd4afbe8--- a/apps/server/src/services/export/zip.ts+++ b/apps/server/src/services/export/zip.ts@@@ -1,28 -1,29 +1,28 @@@-"use strict";--import dateUtils from "../date_utils.js";+import { NoteType } from "@triliumnext/commons";+import { ValidationError } from "@triliumnext/core";+import archiver from "archiver";+import type { Response } from "express";+import fs from "fs";import path from "path";-import packageInfo from "../../../package.json" with { type: "json" };-import { getContentDisposition, waitForStreamToFinish } from "../utils.js";-import protectedSessionService from "../protected_session.js";import sanitize from "sanitize-filename";-import fs from "fs";++import packageInfo from "../../../package.json" with { type: "json" };import becca from "../../becca/becca.js";-import archiver from "archiver";+import BBranch from "../../becca/entities/bbranch.js";+import type BNote from "../../becca/entities/bnote.js";+import dateUtils from "../date_utils.js";import log from "../log.js";-import TaskContext from "../task_context.js";-import ValidationError from "../../errors/validation_error.js";-import type NoteMeta from "../meta/note_meta.js";import type AttachmentMeta from "../meta/attachment_meta.js";import type AttributeMeta from "../meta/attribute_meta.js";-import BBranch from "../../becca/entities/bbranch.js";-import type { Response } from "express";+import type NoteMeta from "../meta/note_meta.js";import type { NoteMetaFile } from "../meta/note_meta.js";-import HtmlExportProvider from "./zip/html.js";+import protectedSessionService from "../protected_session.js";+import TaskContext from "../task_context.js";- import { getContentDisposition } from "../utils.js";++import { getContentDisposition, waitForStreamToFinish } from "../utils.js";import { AdvancedExportOptions, type ExportFormat, ZipExportProviderData } from "./zip/abstract_provider.js";+import HtmlExportProvider from "./zip/html.js";import MarkdownExportProvider from "./zip/markdown.js";import ShareThemeExportProvider from "./zip/share_theme.js";-import type BNote from "../../becca/entities/bnote.js";-import { NoteType } from "@triliumnext/commons";async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch, format: ExportFormat, res: Response | fs.WriteStream, setHeaders = true, zipExportOptions?: AdvancedExportOptions) {if (!["html", "markdown", "share"].includes(format)) {diff --cc apps/server/src/services/search/expressions/note_content_fulltext_preprocessor.tsindex 0000000000,795c0346de..f0652e0722mode 000000,100644..100644--- a/apps/server/src/services/search/expressions/note_content_fulltext_preprocessor.ts+++ b/apps/server/src/services/search/expressions/note_content_fulltext_preprocessor.ts@@@ -1,0 -1,126 +1,126 @@@+ import striptags from "striptags";++ import { normalize } from "../../utils.js";+-export default function preprocessContent(content: string | Buffer, type: string, mime: string, raw?: boolean) {- content = normalize(content.toString());++export default function preprocessContent(rawContent: string | Uint8Array, type: string, mime: string, raw?: boolean) {++ let content = normalize(rawContent.toString());++ if (type === "text" && mime === "text/html") {+ if (!raw) {+ // Content size already filtered at DB level, safe to process+ content = stripTags(content);+ }++ content = content.replace(/ /g, " ");+ } else if (type === "mindMap" && mime === "application/json") {+ content = processMindmapContent(content);+ } else if (type === "canvas" && mime === "application/json") {+ content = processCanvasContent(content);+ }++ return content.trim();+ }++ function processMindmapContent(content: string) {+ let mindMapcontent;++ try {+ mindMapcontent = JSON.parse(content);+ } catch (e) {+ return "";+ }++ // Define interfaces for the JSON structure+ interface MindmapNode {+ id: string;+ topic: string;+ children: MindmapNode[]; // Recursive structure+ direction?: number;+ expanded?: boolean;+ }++ interface MindmapData {+ nodedata: MindmapNode;+ arrows: any[]; // If you know the structure, replace `any` with the correct type+ summaries: any[];+ direction: number;+ theme: {+ name: string;+ type: string;+ palette: string[];+ cssvar: Record<string, string>; // Object with string keys and string values+ };+ }++ // Recursive function to collect all topics+ function collectTopics(node?: MindmapNode): string[] {+ if (!node) {+ return [];+ }++ // Collect the current node's topic+ let topics = [node.topic];++ // If the node has children, collect topics recursively+ if (node.children && node.children.length > 0) {+ for (const child of node.children) {+ topics = topics.concat(collectTopics(child));+ }+ }++ return topics;+ }++ // Start extracting from the root node+ const topicsArray = collectTopics(mindMapcontent.nodedata);++ // Combine topics into a single string+ const topicsString = topicsArray.join(", ");++ return normalize(topicsString.toString());+ }++ function processCanvasContent(content: string) {+ interface Element {+ type: string;+ text?: string; // Optional since not all objects have a `text` property+ id: string;+ [key: string]: any; // Other properties that may exist+ }++ let canvasContent;+ try {+ canvasContent = JSON.parse(content);+ } catch (e) {+ return "";+ }+ const elements = canvasContent.elements;++ if (Array.isArray(elements)) {+ const texts = elements+ .filter((element: Element) => element.type === "text" && element.text) // Filter for 'text' type elements with a 'text' property+ .map((element: Element) => element.text!); // Use `!` to assert `text` is defined after filtering++ content = normalize(texts.join(" "));+ } else {+ content = "";+ }+ return content;+ }++ function stripTags(content: string) {+ // we want to allow link to preserve URLs: https://github.com/zadam/trilium/issues/2412+ // we want to insert space in place of block tags (because they imply text separation)+ // but we don't want to insert text for typical formatting inline tags which can occur within one word+ const linkTag = "a";+ const inlineFormattingTags = ["b", "strong", "em", "i", "span", "big", "small", "font", "sub", "sup"];++ // replace tags which imply text separation with a space+ content = striptags(content, [linkTag, ...inlineFormattingTags], " ");++ // replace the inline formatting tags (but not links) without a space+ content = striptags(content, [linkTag], "");++ // at least the closing link tag can be easily stripped+ return content.replace(/<\/a>/gi, "");+ }diff --cc apps/server/src/services/utils.tsindex ec2ad1f211,dc06f6206a..dbdde6c7ee--- a/apps/server/src/services/utils.ts+++ b/apps/server/src/services/utils.ts@@@ -120,34 -154,63 +120,38 @@@ export async function crash(message: st}}+/** @deprecated */export function getContentDisposition(filename: string) {- const sanitizedFilename = sanitize(filename).trim() || "file";- const uriEncodedFilename = encodeURIComponent(sanitizedFilename);- return `file; filename="${uriEncodedFilename}"; filename*=UTF-8''${uriEncodedFilename}`;+ return coreUtils.getContentDisposition(filename);}-// render and book are string note in the sense that they are expected to contain empty string-const STRING_NOTE_TYPES = new Set(["text", "code", "relationMap", "search", "render", "book", "mermaid", "canvas", "webView"]);-const STRING_MIME_TYPES = new Set(["application/javascript", "application/x-javascript", "application/json", "application/x-sql", "image/svg+xml"]);-+/** @deprecated */export function isStringNote(type: string | undefined, mime: string) {- return (type && STRING_NOTE_TYPES.has(type)) || mime.startsWith("text/") || STRING_MIME_TYPES.has(mime);+ return coreUtils.isStringNote(type, mime);}+/** @deprecated */export function quoteRegex(url: string) {- return url.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");+ return coreUtils.quoteRegex(url);}+/** @deprecated */export function replaceAll(string: string, replaceWhat: string, replaceWith: string) {- const quotedReplaceWhat = quoteRegex(replaceWhat);-- return string.replace(new RegExp(quotedReplaceWhat, "g"), replaceWith);+ return coreUtils.replaceAll(string, replaceWhat, replaceWith);}+/** @deprecated */export function formatDownloadTitle(fileName: string, type: string | null, mime: string) {- const fileNameBase = !fileName ? "untitled" : sanitize(fileName);-- const getExtension = () => {- if (type === "text") return ".html";- if (type === "relationMap" || type === "canvas" || type === "search") return ".json";- if (!mime) return "";-- const mimeLc = mime.toLowerCase();-- // better to just return the current name without a fake extension- // it's possible that the title still preserves the correct extension anyways- if (mimeLc === "application/octet-stream") return "";-- // if fileName has an extension matching the mime already - reuse it- const mimeTypeFromFileName = mimeTypes.lookup(fileName);- if (mimeTypeFromFileName === mimeLc) return "";-- // as last resort try to get extension from mimeType- const extensions = mimeTypes.extension(mime);- return extensions ? `.${extensions}` : "";- };-- return `${fileNameBase}${getExtension()}`;+ return coreUtils.formatDownloadTitle(fileName, type, mime);}- export function removeFileExtension(filePath: string) {+ export function removeFileExtension(filePath: string, mime?: string) {const extension = path.extname(filePath).toLowerCase();+ if (mime?.startsWith("video/") || mime?.startsWith("audio/")) {+ return filePath.substring(0, filePath.length - extension.length);+ }+switch (extension) {case ".md":case ".mdx":@@@ -443,17 -519,13 +447,24 @@@ function slugify(text: string).replace(/(^-|-$)+/g, ""); // trim dashes}+/** @deprecated */+export const escapeHtml = coreUtils.escapeHtml;+/** @deprecated */+export const unescapeHtml = coreUtils.unescapeHtml;+/** @deprecated */+export const randomSecureToken = coreUtils.randomSecureToken;+/** @deprecated */+export const safeExtractMessageAndStackFromError = coreUtils.safeExtractMessageAndStackFromError;+/** @deprecated */+export const isEmptyOrWhitespace = coreUtils.isEmptyOrWhitespace;++ export function waitForStreamToFinish(stream: any): Promise<void> {+ return new Promise((resolve, reject) => {+ stream.on("finish", () => resolve());+ stream.on("error", (err) => reject(err));+ });+ }+export default {compareVersions,constantTimeCompare,diff --cc apps/server/src/services/ws.tsindex 32e7f9c557,7c946a2d36..0f1d214dd4--- a/apps/server/src/services/ws.ts+++ b/apps/server/src/services/ws.ts@@@ -79,18 -76,11 +76,11 @@@ function sendMessageToAllClients(messaglog.info(`Sending message to all clients: ${jsonStr}`);}- let clientCount = 0;- webSocketServer.clients.forEach(function each(client) {+ webSocketServer.clients.forEach((client) => {if (client.readyState === WebSocket.OPEN) {client.send(jsonStr);- clientCount++;}});-- // Log WebSocket client count for debugging- if (message.type === "llm-stream") {- log.info(`[WS-SERVER] Sent LLM stream message to ${clientCount} clients`);- }}}diff --cc apps/server/src/share/content_renderer.tsindex bd4be030fc,035f714b61..6f3a2c6083--- a/apps/server/src/share/content_renderer.ts+++ b/apps/server/src/share/content_renderer.ts@@@ -1,4 -1,5 +1,6 @@@-import { sanitizeUrl } from "@braintree/sanitize-url";+ import { renderSpreadsheetToHtml } from "@triliumnext/commons";+import { sanitize } from "@triliumnext/core";++import { icon_packs as iconPackService } from "@triliumnext/core";import { highlightAuto } from "@triliumnext/highlightjs";import ejs from "ejs";import escapeHtml from "escape-html";diff --cc packages/commons/src/lib/rows.tsindex 03599a8b61,2b06e5a6e1..c03ec058b5--- a/packages/commons/src/lib/rows.ts+++ b/packages/commons/src/lib/rows.ts@@@ -16,7 -16,9 +16,9 @@@ export interface AttachmentRowisDeleted?: boolean;deleteId?: string;contentLength?: number;- content?: Buffer | string;+ content?: Uint8Array | string;+ /** If set to `"base64"`, the `content` string will be decoded from base64 to binary before storage. */+ encoding?: "base64";}export interface RevisionRow {diff --cc packages/commons/src/lib/server_api.tsindex 86e2653602,a15192fd28..926a517e33--- a/packages/commons/src/lib/server_api.ts+++ b/packages/commons/src/lib/server_api.ts@@@ -299,45 -298,3 +299,45 @@@ export interface IconRegistry}[]}[];}+- export type LabelType = "text" | "number" | "boolean" | "date" | "datetime" | "time" | "url" | "color";++export type LabelType = "text" | "textarea" | "number" | "boolean" | "date" | "datetime" | "time" | "url" | "color";+export type Multiplicity = "single" | "multi";++export interface DefinitionObject {+ isPromoted?: boolean;+ labelType?: LabelType;+ multiplicity?: Multiplicity;+ numberPrecision?: number;+ promotedAlias?: string;+ inverseRelation?: string;+}++export interface BootstrapDefinition {+ device: "mobile" | "desktop" | "print" | false;+ csrfToken: string;+ themeCssUrl: string | false;+ themeUseNextAsBase?: "next" | "next-light" | "next-dark";+ headingStyle: "plain" | "underline" | "markdown";+ layoutOrientation: "vertical" | "horizontal";+ platform?: typeof process.platform | "web";+ isElectron: boolean;+ isStandalone?: boolean;+ hasNativeTitleBar: boolean;+ hasBackgroundEffects: boolean;+ maxEntityChangeIdAtLoad: number;+ maxEntityChangeSyncIdAtLoad: number;+ instanceName: string | null;+ appCssNoteIds: string[];+ isDev: boolean;+ isMainWindow: boolean;+ isProtectedSessionAvailable: boolean;+ triliumVersion: string;+ assetPath: string;+ appPath: string;+ baseApiUrl: string;+ currentLocale: Locale;+ isRtl: boolean;+ iconPackCss: string;+ iconRegistry: IconRegistry;+ TRILIUM_SAFE_MODE: boolean;+}diff --cc packages/trilium-core/package.jsonindex a575eb1c08,0000000000..c5cebedcfamode 100644,000000..100644--- a/packages/trilium-core/package.json+++ b/packages/trilium-core/package.json@@@ -1,24 -1,0 +1,24 @@@+{+ "name": "@triliumnext/core",+ "version": "1.0.0",+ "description": "",+ "main": "src/index.ts",+ "scripts": {+ "test": "echo \"Error: no test specified\" && exit 1"+ },+ "dependencies": {+ "@braintree/sanitize-url": "7.1.1",+ "@triliumnext/commons": "workspace:*",+ "escape-html": "1.0.3",+ "i18next": "25.7.3",+ "mime-types": "3.0.2",- "sanitize-filename": "1.6.3",- "sanitize-html": "2.17.0",++ "sanitize-filename": "1.6.4",++ "sanitize-html": "2.17.2",+ "unescape": "1.0.1"+ },+ "devDependencies": {+ "@types/escape-html": "1.0.4",+ "@types/mime-types": "3.0.1",- "@types/sanitize-html": "2.16.0"++ "@types/sanitize-html": "2.16.1"+ }+}diff --cc packages/trilium-core/src/becca/entities/bnote.tsindex 75c22dfa98,0000000000..d5f7728279mode 100644,000000..100644--- a/packages/trilium-core/src/becca/entities/bnote.ts+++ b/packages/trilium-core/src/becca/entities/bnote.ts@@@ -1,1793 -1,0 +1,1776 @@@+import type { AttachmentRow, AttributeType, CloneResponse, NoteRow, NoteType, RevisionRow } from "@triliumnext/commons";+import { dayjs, getNoteIcon } from "@triliumnext/commons";- import eventService from "../../services/events";++import cloningService from "../../services/cloning.js";- import dateUtils from "../../services/utils/date";++import dateUtils from "../../services/utils/date.js";+import eraseService from "../../services/erase.js";++import eventService from "../../services/events.js";+import handlers from "../../services/handlers.js";- import { getLog } from "../../services/log.js";+import noteService from "../../services/notes.js";+import optionService from "../../services/options.js";+import protectedSessionService from "../../services/protected_session.js";+import searchService from "../../services/search/services/search.js";+import TaskContext from "../../services/task_context.js";+import type { NotePojo } from "../becca-interface.js";+import AbstractBeccaEntity from "./abstract_becca_entity.js";+import BAttachment from "./battachment.js";+import BAttribute from "./battribute.js";+import type BBranch from "./bbranch.js";+import BRevision from "./brevision.js";++import { getLog } from "../../services/log.js";+import { getSql } from "../../services/sql/index.js";- import { formatDownloadTitle, isStringNote, normalize, randomString, replaceAll } from "../../services/utils";++import { formatDownloadTitle, isStringNote, normalize, randomString, replaceAll } from "../../services/utils/index.js";++const LABEL = "label";+const RELATION = "relation";+- // TODO: Deduplicate with fnote- export const NOTE_TYPE_ICONS = {- file: "bx bx-file",- image: "bx bx-image",- code: "bx bx-code",- render: "bx bx-extension",- search: "bx bx-file-find",- relationMap: "bx bxs-network-chart",- book: "bx bx-book",- noteMap: "bx bxs-network-chart",- mermaid: "bx bx-selection",- canvas: "bx bx-pen",- webView: "bx bx-globe-alt",- launcher: "bx bx-link",- doc: "bx bxs-file-doc",- contentWidget: "bx bxs-widget",- mindMap: "bx bx-sitemap",- geoMap: "bx bx-map-alt"- };-+interface NotePathRecord {+ isArchived: boolean;+ isInHoistedSubTree: boolean;+ notePath: string[];+ isHidden: boolean;+}++interface ContentOpts {+ /** will also save this BNote entity */+ forceSave?: boolean;+ /** override frontend heuristics on when to reload, instruct to reload */+ forceFrontendReload?: boolean;+}++interface Relationship {+ parentNoteId: string;+ childNoteId: string;+}++interface ConvertOpts {+ /** if true, the action is not triggered by user, but e.g. by migration, and only perfect candidates will be migrated */+ autoConversion?: boolean;+}++/**+ * Trilium's main entity, which can represent text note, image, code note, file attachment etc.+ */+class BNote extends AbstractBeccaEntity<BNote> {+ static get entityName() {+ return "notes";+ }+ static get primaryKeyName() {+ return "noteId";+ }+ static get hashedProperties() {+ return ["noteId", "title", "isProtected", "type", "mime", "blobId"];+ }++ noteId!: string;+ title!: string;+ type!: NoteType;+ mime!: string;+ /** set during the deletion operation, before it is completed (removed from becca completely). */+ isBeingDeleted!: boolean;+ isDecrypted!: boolean;++ ownedAttributes!: BAttribute[];+ parentBranches!: BBranch[];+ parents!: BNote[];+ children!: BNote[];+ targetRelations!: BAttribute[];++ __flatTextCache!: string | null;++ private __attributeCache!: BAttribute[] | null;+ private __inheritableAttributeCache!: BAttribute[] | null;+ private __ancestorCache!: BNote[] | null;++ // following attributes are filled during searching in the database+ /** size of the content in bytes */+ contentSize!: number | null;+ /** size of the note content, attachment contents in bytes */+ contentAndAttachmentsSize!: number | null;+ /** size of the note content, attachment contents and revision contents in bytes */+ contentAndAttachmentsAndRevisionsSize!: number | null;+ /** number of note revisions for this note */+ revisionCount!: number | null;++ constructor(row?: Partial<NoteRow>) {+ super();++ if (!row) {+ return;+ }++ this.updateFromRow(row);+ this.init();+ }++ updateFromRow(row: Partial<NoteRow>) {+ this.update([row.noteId, row.title, row.type, row.mime, row.isProtected, row.blobId, row.dateCreated, row.dateModified, row.utcDateCreated, row.utcDateModified]);+ }++ update([noteId, title, type, mime, isProtected, blobId, dateCreated, dateModified, utcDateCreated, utcDateModified]: any) {+ // ------ Database persisted attributes ------++ this.noteId = noteId;+ this.title = title;+ this.type = type;+ this.mime = mime;+ this.isProtected = !!isProtected;+ this.blobId = blobId;+ this.dateCreated = dateCreated || dateUtils.localNowDateTime();+ this.dateModified = dateModified;+ this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime();+ this.utcDateModified = utcDateModified;+ this.isBeingDeleted = false;++ // ------ Derived attributes ------++ this.isDecrypted = !this.noteId || !this.isProtected;++ this.decrypt();++ this.__flatTextCache = null;++ return this;+ }++ override init() {+ this.parentBranches = [];+ this.parents = [];+ this.children = [];+ this.ownedAttributes = [];+ this.__attributeCache = null;+ this.__inheritableAttributeCache = null;+ this.targetRelations = [];++ this.becca.addNote(this.noteId, this);+ this.__ancestorCache = null;++ this.contentSize = null;+ this.contentAndAttachmentsSize = null;+ this.contentAndAttachmentsAndRevisionsSize = null;+ this.revisionCount = null;+ }++ isContentAvailable() {+ return (+ !this.noteId || // new note which was not encrypted yet+ !this.isProtected ||+ protectedSessionService.isProtectedSessionAvailable()+ );+ }++ getTitleOrProtected() {+ return this.isContentAvailable() ? this.title : "[protected]";+ }++ getParentBranches() {+ return this.parentBranches;+ }++ /**+ * Returns <i>strong</i> (as opposed to <i>weak</i>) parent branches. See isWeak for details.+ */+ getStrongParentBranches() {+ return this.getParentBranches().filter((branch) => !branch.isWeak);+ }++ /**+ * @deprecated use getParentBranches() instead+ */+ getBranches() {+ return this.parentBranches;+ }++ getParentNotes() {+ return this.parents;+ }++ getChildNotes() {+ return this.children;+ }++ hasChildren() {+ return this.children && this.children.length > 0;+ }++ getChildBranches(): BBranch[] {+ return this.children.map((childNote) => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId)) as BBranch[];+ }++ /**+ * Note content has quite special handling - it's not a separate entity, but a lazily loaded+ * part of Note entity with its own sync. Reasons behind this hybrid design has been:+ *+ * - content can be quite large, and it's not necessary to load it / fill memory for any note access even if we don't need a content, especially for bulk operations like search+ * - changes in the note metadata or title should not trigger note content sync (so we keep separate utcDateModified and entity changes records)+ * - but to the user note content and title changes are one and the same - single dateModified (so all changes must go through Note and content is not a separate entity)+ */+ getContent() {+ return this._getContent();+ }++ /**+ * @throws Error in case of invalid JSON+ */+ getJsonContent(): any | null {+ const content = this.getContent();++ if (typeof content !== "string" || !content || !content.trim()) {+ return null;+ }++ return JSON.parse(content);+ }++ /** @returns valid object or null if the content cannot be parsed as JSON */+ getJsonContentSafely() {+ try {+ return this.getJsonContent();+ } catch (e) {+ return null;+ }+ }++ setContent(content: Uint8Array | string, opts: ContentOpts = {}) {+ this._setContent(content, opts);++ eventService.emit(eventService.NOTE_CONTENT_CHANGE, { entity: this });+ }++ setJsonContent(content: {}) {+ this.setContent(JSON.stringify(content, null, "\t"));+ }++ get dateCreatedObj() {+ return this.dateCreated === null ? null : dayjs(this.dateCreated);+ }++ get utcDateCreatedObj() {+ return this.utcDateCreated === null ? null : dayjs.utc(this.utcDateCreated);+ }++ get dateModifiedObj() {+ return this.dateModified === null ? null : dayjs(this.dateModified);+ }++ get utcDateModifiedObj() {+ return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified);+ }++ /** @returns true if this note is the root of the note tree. Root note has "root" noteId */+ isRoot() {+ return this.noteId === "root";+ }++ /** @returns true if this note is of application/json content type */+ isJson() {+ return this.mime === "application/json";+ }++ /** @returns true if this note is JavaScript (code or attachment) */+ isJavaScript() {+ return (+ (this.type === "code" || this.type === "file" || this.type === "launcher") &&+ (this.mime.startsWith("application/javascript") || this.mime === "application/x-javascript" || this.mime === "text/javascript")+ );+ }++ isJsx() {+ return (this.type === "code" && this.mime === "text/jsx");+ }++ /** @returns true if this note is HTML */+ isHtml() {+ return ["code", "file", "render"].includes(this.type) && this.mime === "text/html";+ }++ /** @returns true if this note is an image */+ isImage() {+ return this.type === "image" || (this.type === "file" && this.mime?.startsWith("image/"));+ }++ /** @deprecated use hasStringContent() instead */+ isStringNote() {+ return this.hasStringContent();+ }++ /** @returns true if the note has string content (not binary) */+ override hasStringContent() {+ return isStringNote(this.type, this.mime);+ }++ /** @returns JS script environment - either "frontend" or "backend" */+ getScriptEnv() {+ if (this.isHtml() || (this.isJavaScript() && this.mime.endsWith("env=frontend")) || this.isJsx()) {+ return "frontend";+ }++ if (this.type === "render") {+ return "frontend";+ }++ if (this.isJavaScript() && this.mime.endsWith("env=backend")) {+ return "backend";+ }++ return null;+ }++ /**+ * Beware that the method must not create a copy of the array, but actually returns its internal array+ * (for performance reasons)+ *+ * @param type - (optional) attribute type to filter+ * @param name - (optional) attribute name to filter+ * @returns all note's attributes, including inherited ones+ */+ getAttributes(type?: string, name?: string): BAttribute[] {+ this.__validateTypeName(type, name);+ this.__ensureAttributeCacheIsAvailable();++ if (!this.__attributeCache) {+ throw new Error("Attribute cache not available.");+ }++ if (type && name) {+ return this.__attributeCache.filter((attr) => attr.name === name && attr.type === type);+ } else if (type) {+ return this.__attributeCache.filter((attr) => attr.type === type);+ } else if (name) {+ return this.__attributeCache.filter((attr) => attr.name === name);+ }+ return this.__attributeCache;+ }++ private __ensureAttributeCacheIsAvailable() {+ if (!this.__attributeCache) {+ this.__getAttributes([]);+ }+ }++ private __getAttributes(path: string[]) {+ if (path.includes(this.noteId)) {+ return [];+ }++ if (!this.__attributeCache) {+ const parentAttributes = this.ownedAttributes.slice();+ const newPath = [...path, this.noteId];++ // inheritable attrs on root are typically not intended to be applied to hidden subtree #3537+ if (this.noteId !== "root" && this.noteId !== "_hidden") {+ for (const parentNote of this.parents) {+ parentAttributes.push(...parentNote.__getInheritableAttributes(newPath));+ }+ }++ const templateAttributes: BAttribute[] = [];++ for (const ownedAttr of parentAttributes) {+ // parentAttributes so we process also inherited templates+ if (ownedAttr.type === "relation" && ["template", "inherit"].includes(ownedAttr.name)) {+ const templateNote = this.becca.notes[ownedAttr.value];++ if (templateNote) {+ templateAttributes.push(+ ...templateNote+ .__getAttributes(newPath)+ // template attr is used as a marker for templates, but it's not meant to be inherited+ .filter((attr) => !(attr.type === "label" && (attr.name === "template" || attr.name === "workspacetemplate")))+ );+ }+ }+ }++ this.__attributeCache = [];++ const addedAttributeIds = new Set();++ for (const attr of parentAttributes.concat(templateAttributes)) {+ if (!addedAttributeIds.has(attr.attributeId)) {+ addedAttributeIds.add(attr.attributeId);++ this.__attributeCache.push(attr);+ }+ }++ this.__inheritableAttributeCache = [];++ for (const attr of this.__attributeCache) {+ if (attr.isInheritable) {+ this.__inheritableAttributeCache.push(attr);+ }+ }+ }++ return this.__attributeCache;+ }++ private __getInheritableAttributes(path: string[]): BAttribute[] {+ if (path.includes(this.noteId)) {+ return [];+ }++ if (!this.__inheritableAttributeCache) {+ this.__getAttributes(path); // will refresh also this.__inheritableAttributeCache+ }++ return this.__inheritableAttributeCache || [];+ }++ __validateTypeName(type?: string | null, name?: string | null) {+ if (type && type !== "label" && type !== "relation") {+ throw new Error(`Unrecognized attribute type '${type}'. Only 'label' and 'relation' are possible values.`);+ }++ if (name) {+ const firstLetter = name.charAt(0);+ if (firstLetter === "#" || firstLetter === "~") {+ throw new Error(`Detect '#' or '~' in the attribute's name. In the API, attribute names should be set without these characters.`);+ }+ }+ }++ hasAttribute(type: string, name: string, value: string | null = null): boolean {+ return !!this.getAttributes().find((attr) => attr.name === name && (value === undefined || value === null || attr.value === value) && attr.type === type);+ }++ getAttributeCaseInsensitive(type: string, name: string, value?: string | null) {+ name = name.toLowerCase();+ value = value ? value.toLowerCase() : null;++ return this.getAttributes().find((attr) => attr.name.toLowerCase() === name && (!value || attr.value.toLowerCase() === value) && attr.type === type);+ }++ getRelationTarget(name: string) {+ const relation = this.getAttributes().find((attr) => attr.name === name && attr.type === "relation");++ return relation ? relation.targetNote : null;+ }++ /**+ * @param name - label name+ * @param value - label value+ * @returns true if label exists (including inherited)+ */+ hasLabel(name: string, value?: string): boolean {+ return this.hasAttribute(LABEL, name, value);+ }++ /**+ * @param name - label name+ * @returns true if label exists (including inherited) and does not have "false" value.+ */+ isLabelTruthy(name: string): boolean {+ const label = this.getLabel(name);++ if (!label) {+ return false;+ }++ return label && label.value !== "false";+ }++ /**+ * @param name - label name+ * @param value - label value+ * @returns true if label exists (excluding inherited)+ */+ hasOwnedLabel(name: string, value?: string): boolean {+ return this.hasOwnedAttribute(LABEL, name, value);+ }++ /**+ * @param name - relation name+ * @param value - relation value+ * @returns true if relation exists (including inherited)+ */+ hasRelation(name: string, value?: string): boolean {+ return this.hasAttribute(RELATION, name, value);+ }++ /**+ * @param name - relation name+ * @param value - relation value+ * @returns true if relation exists (excluding inherited)+ */+ hasOwnedRelation(name: string, value?: string): boolean {+ return this.hasOwnedAttribute(RELATION, name, value);+ }++ /**+ * @param name - label name+ * @returns label if it exists, null otherwise+ */+ getLabel(name: string): BAttribute | null {+ return this.getAttribute(LABEL, name);+ }++ /**+ * @param name - label name+ * @returns label if it exists, null otherwise+ */+ getOwnedLabel(name: string): BAttribute | null {+ return this.getOwnedAttribute(LABEL, name);+ }++ /**+ * @param name - relation name+ * @returns relation if it exists, null otherwise+ */+ getRelation(name: string): BAttribute | null {+ return this.getAttribute(RELATION, name);+ }++ /**+ * @param name - relation name+ * @returns relation if it exists, null otherwise+ */+ getOwnedRelation(name: string): BAttribute | null {+ return this.getOwnedAttribute(RELATION, name);+ }++ /**+ * @param name - label name+ * @returns label value if label exists, null otherwise+ */+ getLabelValue(name: string): string | null {+ return this.getAttributeValue(LABEL, name);+ }++ /**+ * @param name - label name+ * @returns label value if label exists, null otherwise+ */+ getOwnedLabelValue(name: string): string | null {+ return this.getOwnedAttributeValue(LABEL, name);+ }++ /**+ * @param name - relation name+ * @returns relation value if relation exists, null otherwise+ */+ getRelationValue(name: string): string | null {+ return this.getAttributeValue(RELATION, name);+ }++ /**+ * @param name - relation name+ * @returns relation value if relation exists, null otherwise+ */+ getOwnedRelationValue(name: string): string | null {+ return this.getOwnedAttributeValue(RELATION, name);+ }++ /**+ * @param attribute type (label, relation, etc.)+ * @param name - attribute name+ * @param value - attribute value+ * @returns true if note has an attribute with given type and name (excluding inherited)+ */+ hasOwnedAttribute(type: string, name: string, value?: string): boolean {+ return !!this.getOwnedAttribute(type, name, value);+ }++ /**+ * @param type - attribute type (label, relation, etc.)+ * @param name - attribute name+ * @returns attribute of the given type and name. If there are more such attributes, first is returned.+ * Returns null if there's no such attribute belonging to this note.+ */+ getAttribute(type: string, name: string): BAttribute | null {+ const attributes = this.getAttributes();++ return attributes.find((attr) => attr.name === name && attr.type === type) || null;+ }++ /**+ * @param type - attribute type (label, relation, etc.)+ * @param name - attribute name+ * @returns attribute value of given type and name or null if no such attribute exists.+ */+ getAttributeValue(type: string, name: string): string | null {+ const attr = this.getAttribute(type, name);++ return attr ? attr.value : null;+ }++ /**+ * @param type - attribute type (label, relation, etc.)+ * @param name - attribute name+ * @returns attribute value of given type and name or null if no such attribute exists.+ */+ getOwnedAttributeValue(type: string, name: string): string | null {+ const attr = this.getOwnedAttribute(type, name);++ return attr ? attr.value : null;+ }++ /**+ * @param name - label name to filter+ * @returns all note's labels (attributes with type label), including inherited ones+ */+ getLabels(name?: string): BAttribute[] {+ return this.getAttributes(LABEL, name);+ }++ /**+ * @param name - label name to filter+ * @returns all note's label values, including inherited ones+ */+ getLabelValues(name: string): string[] {+ return this.getLabels(name).map((l) => l.value);+ }++ /**+ * @param name - label name to filter+ * @returns all note's labels (attributes with type label), excluding inherited ones+ */+ getOwnedLabels(name: string): BAttribute[] {+ return this.getOwnedAttributes(LABEL, name);+ }++ /**+ * @param name - label name to filter+ * @returns all note's label values, excluding inherited ones+ */+ getOwnedLabelValues(name: string): string[] {+ return this.getOwnedAttributes(LABEL, name).map((l) => l.value);+ }++ /**+ * @param name - relation name to filter+ * @returns all note's relations (attributes with type relation), including inherited ones+ */+ getRelations(name?: string): BAttribute[] {+ return this.getAttributes(RELATION, name);+ }++ /**+ * @param name - relation name to filter+ * @returns all note's relations (attributes with type relation), excluding inherited ones+ */+ getOwnedRelations(name?: string | null): BAttribute[] {+ return this.getOwnedAttributes(RELATION, name);+ }++ /**+ * Beware that the method must not create a copy of the array, but actually returns its internal array+ * (for performance reasons)+ *+ * @param type - (optional) attribute type to filter+ * @param name - (optional) attribute name to filter+ * @param value - (optional) attribute value to filter+ * @returns note's "owned" attributes - excluding inherited ones+ */+ getOwnedAttributes(type: string | null = null, name: string | null = null, value: string | null = null) {+ this.__validateTypeName(type, name);++ if (type && name && value !== undefined && value !== null) {+ return this.ownedAttributes.filter((attr) => attr.name === name && attr.value === value && attr.type === type);+ } else if (type && name) {+ return this.ownedAttributes.filter((attr) => attr.name === name && attr.type === type);+ } else if (type) {+ return this.ownedAttributes.filter((attr) => attr.type === type);+ } else if (name) {+ return this.ownedAttributes.filter((attr) => attr.name === name);+ }+ return this.ownedAttributes;+ }++ /**+ * @returns attribute belonging to this specific note (excludes inherited attributes)+ *+ * This method can be significantly faster than the getAttribute()+ */+ getOwnedAttribute(type: string, name: string, value: string | null = null) {+ const attrs = this.getOwnedAttributes(type, name, value);++ return attrs.length > 0 ? attrs[0] : null;+ }++ get isArchived() {+ return this.hasAttribute("label", "archived");+ }++ areAllNotePathsArchived() {+ // there's a slight difference between note being itself archived and all its note paths being archived+ // - note is archived when it itself has an archived label or inherits it+ // - note does not have or inherit archived label, but each note path contains a note with (non-inheritable)+ // archived label++ const bestNotePathRecord = this.getSortedNotePathRecords()[0];++ if (!bestNotePathRecord) {+ throw new Error(`No note path available for note '${this.noteId}'`);+ }++ return bestNotePathRecord.isArchived;+ }++ hasInheritableArchivedLabel() {+ for (const attr of this.getAttributes()) {+ if (attr.name === "archived" && attr.type === LABEL && attr.isInheritable) {+ return true;+ }+ }++ return false;+ }++ // will sort the parents so that the non-archived are first and archived at the end+ // this is done so that the non-archived paths are always explored as first when looking for note path+ sortParents() {+ this.parentBranches.sort((a, b) => {+ if (a.parentNote?.isArchived) {+ return 1;+ } else if (a.parentNote?.isHiddenCompletely()) {+ return 1;+ }+ return 0;+ });++ this.parents = this.parentBranches.map((branch) => branch.parentNote).filter((note) => !!note) as BNote[];+ }++ sortChildren() {+ if (this.children.length === 0) {+ return;+ }++ const becca = this.becca;++ this.children.sort((a, b) => {+ const aBranch = becca.getBranchFromChildAndParent(a.noteId, this.noteId);+ const bBranch = becca.getBranchFromChildAndParent(b.noteId, this.noteId);++ return (aBranch?.notePosition || 0) - (bBranch?.notePosition || 0) || 0;+ });+ }++ /**+ * This is used for:+ * - fast searching+ * - note similarity evaluation+ *+ * @returns - returns flattened textual representation of note, prefixes and attributes+ */- getFlatText(): string {++ getFlatText() {+ if (!this.__flatTextCache) {+ this.__flatTextCache = `${this.noteId} ${this.type} ${this.mime} `;++ for (const branch of this.parentBranches) {+ if (branch.prefix) {+ this.__flatTextCache += `${branch.prefix} `;+ }+ }++ this.__flatTextCache += `${this.title} `;++ for (const attr of this.getAttributes()) {+ // it's best to use space as separator since spaces are filtered from the search string by the tokenization into words+ this.__flatTextCache += `${attr.type === "label" ? "#" : "~"}${attr.name}`;++ if (attr.value) {+ this.__flatTextCache += `=${attr.value}`;+ }++ this.__flatTextCache += " ";+ }++ this.__flatTextCache = normalize(this.__flatTextCache);+ }++ return this.__flatTextCache as string;+ }++ invalidateThisCache() {+ this.__flatTextCache = null;++ this.__attributeCache = null;+ this.__inheritableAttributeCache = null;+ this.__ancestorCache = null;+ }++ invalidateSubTree(path: string[] = []) {+ if (path.includes(this.noteId)) {+ return;+ }++ this.invalidateThisCache();++ if (this.children.length || this.targetRelations.length) {+ path = [...path, this.noteId];+ }++ for (const childNote of this.children) {+ childNote.invalidateSubTree(path);+ }++ for (const targetRelation of this.targetRelations) {+ if (targetRelation.name === "template" || targetRelation.name === "inherit") {+ const note = targetRelation.note;++ if (note) {+ note.invalidateSubTree(path);+ }+ }+ }+ }++ getRelationDefinitions() {+ return this.getLabels().filter((l) => l.name.startsWith("relation:"));+ }++ getLabelDefinitions() {+ return this.getLabels().filter((l) => l.name.startsWith("relation:"));+ }++ isInherited() {+ return !!this.targetRelations.find((rel) => rel.name === "template" || rel.name === "inherit");+ }++ getSubtreeNotesIncludingTemplated(): BNote[] {+ const set = new Set<BNote>();++ function inner(note: BNote) {+ // _hidden is not counted as subtree for the purpose of inheritance+ if (set.has(note) || note.noteId === "_hidden") {+ return;+ }++ set.add(note);++ for (const childNote of note.children) {+ inner(childNote);+ }++ for (const targetRelation of note.targetRelations) {+ if (targetRelation.name === "template" || targetRelation.name === "inherit") {+ const targetNote = targetRelation.note;++ if (targetNote) {+ inner(targetNote);+ }+ }+ }+ }++ inner(this);++ return Array.from(set);+ }++ getSearchResultNotes(): BNote[] {+ if (this.type !== "search") {+ return [];+ }++ try {+ const result = searchService.searchFromNote(this);+ const becca = this.becca;+ return result.searchResultNoteIds.map((resultNoteId) => becca.notes[resultNoteId]).filter((note) => !!note);+ } catch (e: any) {+ getLog().error(`Could not resolve search note ${this.noteId}: ${e.message}`);+ return [];+ }+ }++ getSubtree({ includeArchived = true, includeHidden = false, resolveSearch = false } = {}): {+ notes: BNote[];+ relationships: Relationship[];+ } {+ const noteSet = new Set<BNote>();+ const relationships: Relationship[] = []; // list of tuples parentNoteId -> childNoteId++ function resolveSearchNote(searchNote: BNote) {+ try {+ for (const resultNote of searchNote.getSearchResultNotes()) {+ addSubtreeNotesInner(resultNote, searchNote);+ }+ } catch (e: any) {+ getLog().error(`Could not resolve search note ${searchNote?.noteId}: ${e.message}`);+ }+ }++ function addSubtreeNotesInner(note: BNote, parentNote: BNote | null = null) {+ if (note.noteId === "_hidden" && !includeHidden) {+ return;+ }++ if (parentNote) {+ // this needs to happen first before noteSet check to include all clone relationships+ relationships.push({+ parentNoteId: parentNote.noteId,+ childNoteId: note.noteId+ });+ }++ if (noteSet.has(note)) {+ return;+ }++ if (!includeArchived && note.isArchived) {+ return;+ }++ noteSet.add(note);++ if (note.type === "search") {+ if (resolveSearch) {+ resolveSearchNote(note);+ }+ } else {+ for (const childNote of note.children) {+ addSubtreeNotesInner(childNote, note);+ }+ }+ }++ addSubtreeNotesInner(this);++ return {+ notes: Array.from(noteSet),+ relationships+ };+ }++ /** @returns includes the subtree root note as well */+ getSubtreeNoteIds({ includeArchived = true, includeHidden = false, resolveSearch = false } = {}) {+ return this.getSubtree({ includeArchived, includeHidden, resolveSearch }).notes.map((note) => note.noteId);+ }++ /** @deprecated use getSubtreeNoteIds() instead */+ getDescendantNoteIds() {+ return this.getSubtreeNoteIds();+ }++ get parentCount() {+ return this.parents.length;+ }++ get childrenCount() {+ return this.children.length;+ }++ get labelCount() {+ return this.getAttributes().filter((attr) => attr.type === "label").length;+ }++ get ownedLabelCount() {+ return this.ownedAttributes.filter((attr) => attr.type === "label").length;+ }++ get relationCount() {+ return this.getAttributes().filter((attr) => attr.type === "relation" && !attr.isAutoLink()).length;+ }++ get relationCountIncludingLinks() {+ return this.getAttributes().filter((attr) => attr.type === "relation").length;+ }++ get ownedRelationCount() {+ return this.ownedAttributes.filter((attr) => attr.type === "relation" && !attr.isAutoLink()).length;+ }++ get ownedRelationCountIncludingLinks() {+ return this.ownedAttributes.filter((attr) => attr.type === "relation").length;+ }++ get targetRelationCount() {+ return this.targetRelations.filter((attr) => !attr.isAutoLink()).length;+ }++ get targetRelationCountIncludingLinks() {+ return this.targetRelations.length;+ }++ get attributeCount() {+ return this.getAttributes().length;+ }++ get ownedAttributeCount() {+ return this.getOwnedAttributes().length;+ }++ getAncestors() {+ if (!this.__ancestorCache) {+ const noteIds = new Set();+ this.__ancestorCache = [];++ for (const parent of this.parents) {+ if (noteIds.has(parent.noteId)) {+ continue;+ }++ this.__ancestorCache.push(parent);+ noteIds.add(parent.noteId);++ for (const ancestorNote of parent.getAncestors()) {+ if (!noteIds.has(ancestorNote.noteId)) {+ this.__ancestorCache.push(ancestorNote);+ noteIds.add(ancestorNote.noteId);+ }+ }+ }+ }++ return this.__ancestorCache;+ }++ getAncestorNoteIds(): string[] {+ return this.getAncestors().map((note) => note.noteId);+ }++ hasAncestor(ancestorNoteId: string): boolean {+ for (const ancestorNote of this.getAncestors()) {+ if (ancestorNote.noteId === ancestorNoteId) {+ return true;+ }+ }++ return false;+ }++ isInHiddenSubtree() {+ return this.noteId === "_hidden" || this.hasAncestor("_hidden");+ }++ getTargetRelations() {+ return this.targetRelations;+ }++ /** @returns returns only notes which are templated, does not include their subtrees+ * in effect returns notes which are influenced by note's non-inheritable attributes */+ getInheritingNotes(): BNote[] {+ const arr: BNote[] = [this];++ for (const targetRelation of this.targetRelations) {+ if (targetRelation.name === "template" || targetRelation.name === "inherit") {+ const note = targetRelation.note;++ if (note) {+ arr.push(note);+ }+ }+ }++ return arr;+ }++ getDistanceToAncestor(ancestorNoteId: string) {+ if (this.noteId === ancestorNoteId) {+ return 0;+ }++ let minDistance = 999999;++ for (const parent of this.parents) {+ minDistance = Math.min(minDistance, parent.getDistanceToAncestor(ancestorNoteId) + 1);+ }++ return minDistance;+ }++ getRevisions(): BRevision[] {+ return getSql().getRows<RevisionRow>("SELECT * FROM revisions WHERE noteId = ? ORDER BY revisions.utcDateCreated ASC", [this.noteId]).map((row) => new BRevision(row));+ }++ getAttachments() {+ const query = /*sql*/`\+ SELECT attachments.*, LENGTH(blobs.content) AS contentLength+ FROM attachments+ JOIN blobs USING (blobId)+ WHERE ownerId = ? AND isDeleted = 0+ ORDER BY position`;++ return getSql().getRows<AttachmentRow>(query, [this.noteId]).map((row) => new BAttachment(row));+ }++ getAttachmentById(attachmentId: string) {+ const query = /*sql*/`\+ SELECT attachments.*, LENGTH(blobs.content) AS contentLength+ FROM attachments+ JOIN blobs USING (blobId)+ WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`;++ return getSql().getRows<AttachmentRow>(query, [this.noteId, attachmentId]).map((row) => new BAttachment(row))[0];+ }++ getAttachmentsByRole(role: string): BAttachment[] {+ return getSql()+ .getRows<AttachmentRow>(+ `+ SELECT attachments.*+ FROM attachments+ WHERE ownerId = ?+ AND role = ?+ AND isDeleted = 0+ ORDER BY position`,+ [this.noteId, role]+ )+ .map((row) => new BAttachment(row));+ }++ getAttachmentByTitle(title: string): BAttachment | undefined {+ // cannot use SQL to filter by title since it can be encrypted+ return this.getAttachments().filter((attachment) => attachment.title === title)[0];+ }++ /**+ * Gives all possible note paths leading to this note. Paths containing search note are ignored (could form cycles)+ *+ * @returns array of notePaths (each represented by array of noteIds constituting the particular note path)+ */+ getAllNotePaths(): string[][] {+ if (this.noteId === "root") {+ return [["root"]];+ }++ const parentNotes = this.getParentNotes();++ const notePaths =+ parentNotes.length === 1+ ? parentNotes[0].getAllNotePaths() // optimization for the most common case+ : parentNotes.flatMap((parentNote) => parentNote.getAllNotePaths());++ for (const notePath of notePaths) {+ notePath.push(this.noteId);+ }++ return notePaths;+ }++ getSortedNotePathRecords(hoistedNoteId: string = "root"): NotePathRecord[] {+ const isHoistedRoot = hoistedNoteId === "root";++ const notePaths = this.getAllNotePaths().map((path) => ({+ notePath: path,+ isInHoistedSubTree: isHoistedRoot || path.includes(hoistedNoteId),+ isArchived: path.some((noteId) => this.becca.notes[noteId].isArchived),+ isHidden: path.includes("_hidden")+ }));++ notePaths.sort((a, b) => {+ if (a.isInHoistedSubTree !== b.isInHoistedSubTree) {+ return a.isInHoistedSubTree ? -1 : 1;+ } else if (a.isArchived !== b.isArchived) {+ return a.isArchived ? 1 : -1;+ } else if (a.isHidden !== b.isHidden) {+ return a.isHidden ? 1 : -1;+ }+ return a.notePath.length - b.notePath.length;+ });++ return notePaths;+ }++ /**+ * Returns a note path considered to be the "best"+ *+ * @return array of noteIds constituting the particular note path+ */+ getBestNotePath(hoistedNoteId: string = "root"): string[] {+ return this.getSortedNotePathRecords(hoistedNoteId)[0]?.notePath;+ }++ /**+ * Returns a note path considered to be the "best"+ *+ * @return serialized note path (e.g. 'root/a1h315/js725h')+ */+ getBestNotePathString(hoistedNoteId: string = "root"): string {+ const notePath = this.getBestNotePath(hoistedNoteId);++ return notePath?.join("/");+ }++ /**+ * @return boolean - true if there's no non-hidden path, note is not cloned to the visible tree+ */+ isHiddenCompletely() {+ if (this.noteId === "root") {+ return false;+ }++ for (const parentNote of this.parents) {+ if (parentNote.noteId === "root") {+ return false;+ } else if (parentNote.noteId === "_hidden") {+ continue;+ } else if (!parentNote.isHiddenCompletely()) {+ return false;+ }+ }++ return true;+ }++ /**+ * @returns true if ancestorNoteId occurs in at least one of the note's paths+ */+ isDescendantOfNote(ancestorNoteId: string): boolean {+ const notePaths = this.getAllNotePaths();++ return notePaths.some((path) => path.includes(ancestorNoteId));+ }++ /**+ * Update's given attribute's value or creates it if it doesn't exist+ *+ * @param type - attribute type (label, relation, etc.)+ * @param name - attribute name+ * @param value - attribute value (optional)+ */+ setAttribute(type: AttributeType, name: string, value?: string) {+ const attributes = this.getOwnedAttributes();+ const attr = attributes.find((attr) => attr.type === type && attr.name === name);++ value = value?.toString() || "";++ if (attr) {+ if (attr.value !== value) {+ attr.value = value;+ attr.save();+ }+ } else {+ new BAttribute({+ noteId: this.noteId,+ type,+ name,+ value+ }).save();+ }+ }++ /**+ * Removes given attribute name-value pair if it exists.+ *+ * @param type - attribute type (label, relation, etc.)+ * @param name - attribute name+ * @param value - attribute value (optional)+ */+ removeAttribute(type: string, name: string, value?: string) {+ const attributes = this.getOwnedAttributes();++ for (const attribute of attributes) {+ if (attribute.type === type && attribute.name === name && (value === undefined || value === attribute.value)) {+ attribute.markAsDeleted();+ }+ }+ }++ /**+ * Adds a new attribute to this note. The attribute is saved and returned.+ * See addLabel, addRelation for more specific methods.+ *+ * @param type - attribute type (label / relation)+ * @param name - name of the attribute, not including the leading ~/#+ * @param value - value of the attribute - text for labels, target note ID for relations; optional.+ */+ addAttribute(type: AttributeType, name: string, value: string = "", isInheritable: boolean = false, position: number | null = null): BAttribute {+ return new BAttribute({+ noteId: this.noteId,+ type,+ name,+ value,+ isInheritable,+ position+ }).save();+ }++ /**+ * Adds a new label to this note. The label attribute is saved and returned.+ *+ * @param name - name of the label, not including the leading #+ * @param value - text value of the label; optional+ */+ addLabel(name: string, value: string = "", isInheritable: boolean = false): BAttribute {+ return this.addAttribute(LABEL, name, value, isInheritable);+ }++ /**+ * Adds a new relation to this note. The relation attribute is saved and+ * returned.+ *+ * @param name - name of the relation, not including the leading ~+ */+ addRelation(name: string, targetNoteId: string, isInheritable: boolean = false): BAttribute {+ return this.addAttribute(RELATION, name, targetNoteId, isInheritable);+ }++ /**+ * Based on enabled, the attribute is either set or removed.+ *+ * @param type - attribute type ('relation', 'label' etc.)+ * @param enabled - toggle On or Off+ * @param name - attribute name+ * @param value - attribute value (optional)+ */+ toggleAttribute(type: AttributeType, enabled: boolean, name: string, value?: string) {+ if (enabled) {+ this.setAttribute(type, name, value);+ } else {+ this.removeAttribute(type, name, value);+ }+ }++ /**+ * Based on enabled, label is either set or removed.+ *+ * @param enabled - toggle On or Off+ * @param name - label name+ * @param value - label value (optional)+ */+ toggleLabel(enabled: boolean, name: string, value?: string) {+ return this.toggleAttribute(LABEL, enabled, name, value);+ }++ /**+ * Based on enabled, relation is either set or removed.+ *+ * @param enabled - toggle On or Off+ * @param name - relation name+ * @param value - relation value (noteId)+ */+ toggleRelation(enabled: boolean, name: string, value?: string) {+ return this.toggleAttribute(RELATION, enabled, name, value);+ }++ /**+ * Update's given label's value or creates it if it doesn't exist+ *+ * @param name - label name+ * @param value label value+ */+ setLabel(name: string, value?: string) {+ return this.setAttribute(LABEL, name, value);+ }++ /**+ * Update's given relation's value or creates it if it doesn't exist+ *+ * @param name - relation name+ * @param value - relation value (noteId)+ */+ setRelation(name: string, value?: string) {+ return this.setAttribute(RELATION, name, value);+ }++ /**+ * Remove label name-value pair, if it exists.+ *+ * @param name - label name+ * @param value - label value+ */+ removeLabel(name: string, value?: string) {+ return this.removeAttribute(LABEL, name, value);+ }++ /**+ * Remove the relation name-value pair, if it exists.+ *+ * @param name - relation name+ * @param value - relation value (noteId)+ */+ removeRelation(name: string, value?: string) {+ return this.removeAttribute(RELATION, name, value);+ }++ searchNotesInSubtree(searchString: string) {+ return searchService.searchNotes(searchString) as BNote[];+ }++ searchNoteInSubtree(searchString: string) {+ return this.searchNotesInSubtree(searchString)[0];+ }++ cloneTo(parentNoteId: string): CloneResponse {+ const branch = this.becca.getNote(parentNoteId)?.getParentBranches()[0];+ if (!branch?.branchId) {+ return {+ success: false,+ message: "Unable to find the branch ID to clone."+ };+ }++ return cloningService.cloneNoteToBranch(this.noteId, branch.branchId);+ }++ isEligibleForConversionToAttachment(opts: ConvertOpts = { autoConversion: false }) {+ if (this.type !== "image" || !this.isContentAvailable() || this.hasChildren() || this.getParentBranches().length !== 1) {+ return false;+ }++ const targetRelations = this.getTargetRelations().filter((relation) => relation.name === "imageLink");++ if (opts.autoConversion && targetRelations.length === 0) {+ return false;+ } else if (targetRelations.length > 1) {+ return false;+ }++ const parentNote = this.getParentNotes()[0]; // at this point note can have only one parent+ const referencingNote = targetRelations[0]?.getNote();++ if (referencingNote && parentNote !== referencingNote) {+ return false;+ } else if (parentNote.type !== "text" || !parentNote.isContentAvailable()) {+ return false;+ }++ return true;+ }++ /**+ * Some notes are eligible for conversion into an attachment of its parent, note must have these properties:+ * - it has exactly one target relation+ * - it has a relation from its parent note+ * - it has no children+ * - it has no clones+ * - the parent is of type text+ * - both notes are either unprotected or user is in protected session+ *+ * Currently, works only for image notes.+ *+ * In the future, this functionality might get more generic and some of the requirements relaxed.+ *+ * @returns null if note is not eligible for conversion+ */+ convertToParentAttachment(opts: ConvertOpts = { autoConversion: false }): BAttachment | null {+ if (!this.isEligibleForConversionToAttachment(opts)) {+ return null;+ }++ const content = this.getContent();++ const parentNote = this.getParentNotes()[0];+ const attachment = parentNote.saveAttachment({+ role: "image",+ mime: this.mime,+ title: this.title,+ content+ });++ const parentContent = parentNote.getContent();++ const oldNoteUrl = `api/images/${this.noteId}/`;+ const newAttachmentUrl = `api/attachments/${attachment.attachmentId}/image/`;++ if (typeof parentContent !== "string") {+ throw new Error("Unable to convert image note into attachment because parent note does not have a string content.");+ }++ const fixedContent = replaceAll(parentContent, oldNoteUrl, newAttachmentUrl);++ parentNote.setContent(fixedContent);++ noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion++ this.deleteNote();++ return attachment;+ }++ /**+ * (Soft) delete a note and all its descendants.+ *+ * @param deleteId - optional delete identified+ */+ deleteNote(deleteId: string | null = null, taskContext: TaskContext<"deleteNotes"> | null = null) {+ if (this.isDeleted) {+ return;+ }++ if (!deleteId) {+ deleteId = randomString(10);+ }++ if (!taskContext) {+ taskContext = new TaskContext("no-progress-reporting", "deleteNotes", null);+ }++ // needs to be run before branches and attributes are deleted and thus attached relations disappear+ handlers.runAttachedRelations(this, "runOnNoteDeletion", this);+ taskContext.noteDeletionHandlerTriggered = true;++ for (const branch of this.getParentBranches()) {+ branch.deleteBranch(deleteId ?? undefined, taskContext);+ }+ }++ decrypt() {+ if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {+ try {+ this.title = protectedSessionService.decryptString(this.title) || "";+ this.__flatTextCache = null;++ this.isDecrypted = true;+ } catch (e: any) {+ getLog().error(`Could not decrypt note ${this.noteId}: ${e.message} ${e.stack}`);+ }+ }+ }++ isLaunchBarConfig() {+ return this.type === "launcher"+ || ["_lbRoot", "_lbAvailableLaunchers", "_lbVisibleLaunchers"].includes(this.noteId)+ || ["_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers"].includes(this.noteId);+ }++ isOptions() {+ return this.noteId.startsWith("_options");+ }++ override get isDeleted() {+ // isBeingDeleted is relevant only in the transition period when the deletion process has begun, but not yet+ // finished (note is still in becca)+ return !(this.noteId in this.becca.notes) || this.isBeingDeleted;+ }++ saveRevision(): BRevision {+ return getSql().transactional(() => {+ let noteContent = this.getContent();++ const revision = new BRevision(+ {+ noteId: this.noteId,+ // title and text should be decrypted now+ title: this.title,+ type: this.type,+ mime: this.mime,+ isProtected: this.isProtected,+ utcDateLastEdited: this.utcDateModified,+ utcDateCreated: dateUtils.utcNowDateTime(),+ utcDateModified: dateUtils.utcNowDateTime(),+ dateLastEdited: this.dateModified,+ dateCreated: dateUtils.localNowDateTime()+ },+ true+ );++ revision.save(); // to generate revisionId, which is then used to save attachments++ for (const noteAttachment of this.getAttachments()) {+ const revisionAttachment = noteAttachment.copy();++ if (!revision.revisionId) {+ throw new Error("Revision ID is missing.");+ }++ revisionAttachment.ownerId = revision.revisionId;+ revisionAttachment.setContent(noteAttachment.getContent(), { forceSave: true });++ if (this.type === "text" && typeof noteContent === "string") {+ // content is rewritten to point to the revision attachments+ noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);++ noteContent = noteContent.replaceAll(+ new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, "gi"),+ `href="api/attachments/${revisionAttachment.attachmentId}/download"`+ );+ }+ }++ revision.setContent(noteContent);++ this.eraseExcessRevisionSnapshots();+ return revision;+ });+ }++ // Limit the number of Snapshots to revisionSnapshotNumberLimit+ // Delete older Snapshots that exceed the limit+ eraseExcessRevisionSnapshots() {- // label has a higher priority++ // lable has a higher priority+ let revisionSnapshotNumberLimit = parseInt(this.getLabelValue("versioningLimit") ?? "");+ if (!Number.isInteger(revisionSnapshotNumberLimit)) {+ revisionSnapshotNumberLimit = parseInt(optionService.getOption("revisionSnapshotNumberLimit"));+ }+ if (revisionSnapshotNumberLimit >= 0) {+ const revisions = this.getRevisions();+ if (revisions.length - revisionSnapshotNumberLimit > 0) {+ const revisionIds = revisions+ .slice(0, revisions.length - revisionSnapshotNumberLimit)+ .map((revision) => revision.revisionId)+ .filter((id): id is string => id !== undefined);+ eraseService.eraseRevisions(revisionIds);+ }+ }+ }++ /**+ * @param matchBy - choose by which property we detect if to update an existing attachment.+ * Supported values are either 'attachmentId' (default) or 'title'+ */+ saveAttachment({ attachmentId, role, mime, title, content, position }: Omit<AttachmentRow, "ownerId">, matchBy: "attachmentId" | "title" | undefined = "attachmentId") {+ if (!["attachmentId", "title"].includes(matchBy)) {+ throw new Error(`Unsupported value '${matchBy}' for matchBy param, has to be either 'attachmentId' or 'title'.`);+ }++ let attachment;++ if (matchBy === "title" && title) {+ attachment = this.getAttachmentByTitle(title);+ } else if (matchBy === "attachmentId" && attachmentId) {+ attachment = this.becca.getAttachmentOrThrow(attachmentId);+ }++ attachment =+ attachment ||+ new BAttachment({+ ownerId: this.noteId,+ title,+ role,+ mime,+ isProtected: this.isProtected,+ position+ });++ content = content || "";+ attachment.setContent(content, { forceSave: true });++ return attachment;+ }++ getFileName() {+ return formatDownloadTitle(this.title, this.type, this.mime);+ }++ override beforeSaving() {+ super.beforeSaving();++ this.becca.addNote(this.noteId, this);++ this.dateModified = dateUtils.localNowDateTime();+ this.utcDateModified = dateUtils.utcNowDateTime();+ }++ getPojo(): NotePojo {+ return {+ noteId: this.noteId,+ title: this.title,+ isProtected: this.isProtected,+ type: this.type,+ mime: this.mime,+ blobId: this.blobId,+ isDeleted: false,+ dateCreated: this.dateCreated,+ dateModified: this.dateModified,+ utcDateCreated: this.utcDateCreated,+ utcDateModified: this.utcDateModified+ };+ }++ override getPojoToSave() {+ const pojo = this.getPojo();++ if (pojo.isProtected) {+ if (this.isDecrypted && pojo.title) {+ pojo.title = protectedSessionService.encrypt(pojo.title) || undefined;+ } else {+ // updating protected note outside of protected session means we will keep original ciphertexts+ delete pojo.title;+ }+ }++ return pojo;+ }++ getIcon() {+ const iconClassLabels = this.getLabels("iconClass");+ const icon = getNoteIcon({+ noteId: this.noteId,+ type: this.type,+ mime: this.mime,+ iconClass: iconClassLabels.length > 0 ? iconClassLabels[0].value : undefined,+ workspaceIconClass: undefined,+ isFolder: this.isFolder.bind(this)+ });++ return `tn-icon ${icon}`;+ }++ // TODO: Deduplicate with fnote+ isFolder() {+ return this.type === "search" || this.getFilteredChildBranches().length > 0;+ }++ // TODO: Deduplicate with fnote+ getFilteredChildBranches() {+ const childBranches = this.getChildBranches();++ if (!childBranches) {+ console.error(`No children for '${this.noteId}'. This shouldn't happen.`);+ return [];+ }++ // we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes+ // which would seriously slow down everything.+ // we check this flag only once user chooses to expand the parent. This has the negative consequence that+ // note may appear as a folder but not contain any children when all of them are archived++ return childBranches;+ }++ get encodedTitle() {+ return encodeURIComponent(this.title);+ }++ getVisibleChildBranches() {- return this.getChildBranches().filter((branch) => !branch.getNote().isLabelTruthy("shareHiddenFromTree"));++ return this.getChildBranches().filter((branch) => {++ const note = branch.getNote();++ return !note.isLabelTruthy("shareHiddenFromTree") && !note.noteId.startsWith("_");++ });+ }++ getVisibleChildNotes() {+ return this.getVisibleChildBranches().map((branch) => branch.getNote());+ }++ hasVisibleChildren() {+ return this.getVisibleChildNotes().length > 0;+ }++ get shareId() {+ return this.noteId;+ }++ /**+ * Return an attribute by it's attributeId. Requires the attribute cache to be available.+ * @param attributeId - the id of the attribute owned by this note+ * @returns - the BAttribute with the given id or undefined if not found.+ */+ getAttributeById(attributeId : string): BAttribute | undefined {+ this.__ensureAttributeCacheIsAvailable();++ if (!this.__attributeCache) {+ throw new Error("Attribute cache not available.");+ }++ return this.__attributeCache.find((attr) => attr.attributeId === attributeId);+ }++ /**+ * Sets an attribute's value by it's attributeId.+ * @param attributeId - the id of the attribute owned by this note+ * @param value - the new value to replace+ */+ setAttributeValueById(attributeId : string, value? : string) {+ const attributes = this.getOwnedAttributes();+ const attr = attributes.find((attr) => attr.attributeId === attributeId);++ value = value?.toString() || "";++ if (attr) {+ if (attr.value !== value) {+ attr.value = value;+ attr.save();+ }+ } else {+ throw new Error(`Attribute with id ${attributeId} not found.`);+ }+ }+}++export default BNote;diff --cc packages/trilium-core/src/index.tsindex 5f4c3e82f0,0000000000..5e5d7f652amode 100644,000000..100644--- a/packages/trilium-core/src/index.ts+++ b/packages/trilium-core/src/index.ts@@@ -1,95 -1,0 +1,94 @@@+import { ExecutionContext, initContext } from "./services/context";+import { CryptoProvider, initCrypto } from "./services/encryption/crypto";+import { getLog, initLog } from "./services/log";+import { initSql } from "./services/sql/index";+import { SqlService, SqlServiceParams } from "./services/sql/sql";+import { initMessaging, MessagingProvider } from "./services/messaging/index";+import { initTranslations, TranslationProvider } from "./services/i18n";+import appInfo from "./services/app_info";++export type * from "./services/sql/types";+export * from "./services/sql/index";+export * as protected_session from "./services/protected_session";+export { default as data_encryption } from "./services/encryption/data_encryption"+export * as binary_utils from "./services/utils/binary";+export * as utils from "./services/utils/index";+export * from "./services/build";+export { default as date_utils } from "./services/utils/date";+export { default as events } from "./services/events";+export { default as blob } from "./services/blob";+export { default as options } from "./services/options";+export { default as options_init } from "./services/options_init";+export { default as app_info } from "./services/app_info";+export { default as keyboard_actions } from "./services/keyboard_actions";+export { default as entity_changes } from "./services/entity_changes";+export { default as hidden_subtree } from "./services/hidden_subtree";+export * as icon_packs from "./services/icon_packs";+export { getContext, type ExecutionContext } from "./services/context";+export * as cls from "./services/context";+export * as i18n from "./services/i18n";+export * from "./errors";+export { default as getInstanceId } from "./services/instance_id";+export type { CryptoProvider } from "./services/encryption/crypto";+export { default as note_types } from "./services/note_types";+export { default as tree } from "./services/tree";+export { default as cloning } from "./services/cloning";+export { default as handlers } from "./services/handlers";+export { default as TaskContext } from "./services/task_context";+export { default as revisions } from "./services/revisions";+export { default as erase } from "./services/erase";+export { default as getSharedBootstrapItems } from "./services/bootstrap_utils";+export { default as branches } from "./services/branches";+export { default as bulk_actions } from "./services/bulk_actions";++export { default as attribute_formatter} from "./services/attribute_formatter";- export { default as BUILTIN_ATTRIBUTES } from "./services/builtin_attributes";++// Messaging system+export * from "./services/messaging/index";+export type { MessagingProvider, ServerMessagingProvider, MessageClient, MessageHandler } from "./services/messaging/types";++export { default as becca } from "./becca/becca";+export { default as becca_loader } from "./becca/becca_loader";+export { default as becca_service } from "./becca/becca_service";+export { default as entity_constructor } from "./becca/entity_constructor";+export { default as similarity } from "./becca/similarity";+export { default as BAttachment } from "./becca/entities/battachment";+export { default as BAttribute } from "./becca/entities/battribute";+export { default as BBlob } from "./becca/entities/bblob";+export { default as BBranch } from "./becca/entities/bbranch";+export { default as BEtapiToken } from "./becca/entities/betapi_token";- export { default as BNote, NOTE_TYPE_ICONS } from "./becca/entities/bnote";++export { default as BNote } from "./becca/entities/bnote";+export { default as BOption } from "./becca/entities/boption";+export { default as BRecentNote } from "./becca/entities/brecent_note";+export { default as BRevision } from "./becca/entities/brevision";+export { default as AbstractBeccaEntity } from "./becca/entities/abstract_becca_entity";+export { default as Becca } from "./becca/becca-interface";+export type { NotePojo } from "./becca/becca-interface";++export { default as NoteSet } from "./services/search/note_set";+export { default as note_service } from "./services/notes";+export type { NoteParams } from "./services/notes";+export * as sanitize from "./services/sanitizer";+export * as routes from "./routes";++export async function initializeCore({ dbConfig, executionContext, crypto, translations, messaging, extraAppInfo }: {+ dbConfig: SqlServiceParams,+ executionContext: ExecutionContext,+ crypto: CryptoProvider,+ translations: TranslationProvider,+ messaging?: MessagingProvider,+ extraAppInfo?: {+ nodeVersion: string;+ dataDirectory: string;+ };+}) {+ initLog();+ await initTranslations(translations);+ initCrypto(crypto);+ initSql(new SqlService(dbConfig, getLog()));+ initContext(executionContext);+ Object.assign(appInfo, extraAppInfo);+ if (messaging) {+ initMessaging(messaging);+ }+};diff --cc packages/trilium-core/src/routes/api/attachments.tsindex eb775dcc18,03608cf16b..63f7293871--- a/packages/trilium-core/src/routes/api/attachments.ts+++ b/packages/trilium-core/src/routes/api/attachments.ts@@@ -1,12 -1,12 +1,13 @@@import { ConvertAttachmentToNoteResponse } from "@triliumnext/commons";- import blobService from "../../services/blob";+import { ValidationError } from "../../errors";import type { Request } from "express";++import becca from "../../becca/becca.js";-import ValidationError from "../../errors/validation_error.js";+ import blobService from "../../services/blob.js";import imageService from "../../services/image.js";- function getAttachmentBlob(req: Request) {+ function getAttachmentBlob(req: Request<{ attachmentId: string }>) {const preview = req.query.preview === "true";return blobService.getBlobPojo("attachments", req.params.attachmentId, { preview });diff --cc packages/trilium-core/src/routes/api/attributes.tsindex 7c97e3024c,b89747e299..9fd46aa1d7--- a/packages/trilium-core/src/routes/api/attributes.ts+++ b/packages/trilium-core/src/routes/api/attributes.ts@@@ -1,14 -1,16 +1,13 @@@----import { UpdateAttributeResponse } from "@triliumnext/commons";++import { UpdateAttributeResponse, ValidationError } from "@triliumnext/commons";import type { Request } from "express";import becca from "../../becca/becca.js";import BAttribute from "../../becca/entities/battribute.js";-import ValidationError from "../../errors/validation_error.js";import attributeService from "../../services/attributes.js";-import log from "../../services/log.js";-import sql from "../../services/sql.js";+import { getLog } from "../../services/log.js";- import { ValidationError } from "../../errors.js";+import { getSql } from "../../services/sql/index.js";- function getEffectiveNoteAttributes(req: Request) {+ function getEffectiveNoteAttributes(req: Request<{ noteId: string }>) {const note = becca.getNote(req.params.noteId);return note?.getAttributes();@@@ -189,10 -191,10 +188,10 @@@ function getAttributeNames(req: Requestfunction getValuesForAttribute(req: Request) {const attributeName = req.params.attributeName;- return sql.getColumn("SELECT DISTINCT value FROM attributes WHERE isDeleted = 0 AND name = ? AND type = 'label' AND value != '' ORDER BY value", [attributeName]);+ return getSql().getColumn("SELECT DISTINCT value FROM attributes WHERE isDeleted = 0 AND name = ? AND type = 'label' AND value != '' ORDER BY value", [attributeName]);}- function createRelation(req: Request) {+ function createRelation(req: Request<{ noteId: string; targetNoteId: string; name: string }>) {const sourceNoteId = req.params.noteId;const targetNoteId = req.params.targetNoteId;const name = req.params.name;diff --cc packages/trilium-core/src/routes/api/branches.tsindex 86c926a7c7,ff224c04f1..3c782a9348--- a/packages/trilium-core/src/routes/api/branches.ts+++ b/packages/trilium-core/src/routes/api/branches.ts@@@ -149,10 -149,9 +149,10 @@@ function setExpanded(req: Request<{ bra}}- function setExpandedForSubtree(req: Request) {+ function setExpandedForSubtree(req: Request<{ branchId: string, expanded: string }>) {const { branchId } = req.params;const expanded = parseInt(req.params.expanded);+ const sql = getSql();let branchIds = sql.getColumn<string>(`@@@ -260,10 -259,10 +260,10 @@@ function deleteBranch(req: Request<{ br};}- function setPrefix(req: Request) {+ function setPrefix(req: Request<{ branchId: string }>) {const branchId = req.params.branchId;//TriliumNextTODO: req.body arrives as string, so req.body.prefix will be undefined – did the code below ever even work?- const prefix = utils.isEmptyOrWhitespace(req.body.prefix) ? null : req.body.prefix;+ const prefix = isEmptyOrWhitespace(req.body.prefix) ? null : req.body.prefix;const branch = becca.getBranchOrThrow(branchId);branch.prefix = prefix;diff --cc packages/trilium-core/src/routes/api/notes.tsindex 43a35817f9,e95ac75e96..6585ad269c--- a/packages/trilium-core/src/routes/api/notes.ts+++ b/packages/trilium-core/src/routes/api/notes.ts@@@ -196,8 -198,8 +196,8 @@@ function deleteNote(req: Request<{ note}}- function undeleteNote(req: Request) {+ function undeleteNote(req: Request<{ noteId: string }>) {- const taskContext = TaskContext.getInstance(utils.randomString(10), "undeleteNotes", null);+ const taskContext = TaskContext.getInstance(randomString(10), "undeleteNotes", null);noteService.undeleteNote(req.params.noteId, taskContext);diff --cc packages/trilium-core/src/routes/api/recent_changes.tsindex bb694de9d0,3b768b534b..0ec32da19e--- a/packages/trilium-core/src/routes/api/recent_changes.ts+++ b/packages/trilium-core/src/routes/api/recent_changes.ts@@@ -1,13 -1,12 +1,11 @@@- "use strict";-import type { RecentChangeRow } from "@triliumnext/commons";-import type { Request } from "express";---import becca from "../../becca/becca.js";-import noteService from "../../services/notes.js";import protectedSessionService from "../../services/protected_session.js";-import sql from "../../services/sql.js";+import noteService from "../../services/notes.js";+import becca from "../../becca/becca.js";+import type { Request } from "express";+import type { RecentChangeRow } from "@triliumnext/commons";+import { getSql } from "../../services/sql/index.js";- function getRecentChanges(req: Request) {+ function getRecentChanges(req: Request<{ ancestorNoteId: string }>) {const { ancestorNoteId } = req.params;let recentChanges: RecentChangeRow[] = [];diff --cc packages/trilium-core/src/routes/api/revisions.tsindex 37421adc45,34dbce728e..5620cb1400--- a/packages/trilium-core/src/routes/api/revisions.ts+++ b/packages/trilium-core/src/routes/api/revisions.ts@@@ -97,8 -101,8 +97,8 @@@ function downloadRevision(req: Request<res.send(revision.getContent());}- function eraseAllRevisions(req: Request) {+ function eraseAllRevisions(req: Request<{ noteId: string }>) {- const revisionIdsToErase = sql.getColumn<string>("SELECT revisionId FROM revisions WHERE noteId = ?", [req.params.noteId]);+ const revisionIdsToErase = getSql().getColumn<string>("SELECT revisionId FROM revisions WHERE noteId = ?", [req.params.noteId]);eraseService.eraseRevisions(revisionIdsToErase);}diff --cc packages/trilium-core/src/routes/api/sql.tsindex f7f8f61dc0,89401adacc..3df8cd3b77--- a/packages/trilium-core/src/routes/api/sql.ts+++ b/packages/trilium-core/src/routes/api/sql.ts@@@ -25,8 -24,7 +25,8 @@@ function getSchema()return tables;}- function execute(req: Request) {+ function execute(req: Request<{ noteId: string }>) {+ const sql = getSql();const note = becca.getNoteOrThrow(req.params.noteId);const content = note.getContent();diff --cc packages/trilium-core/src/routes/api/stats.tsindex 9245cd3110,4b4f2e8b58..9ad86b49a1--- a/packages/trilium-core/src/routes/api/stats.ts+++ b/packages/trilium-core/src/routes/api/stats.ts@@@ -26,10 -27,11 +26,10 @@@ function getNoteSize(req: Request)} satisfies NoteSizeResponse;}- function getSubtreeSize(req: Request) {+ function getSubtreeSize(req: Request<{ noteId: string }>) {const note = becca.getNoteOrThrow(req.params.noteId);-const subTreeNoteIds = note.getSubtreeNoteIds();-+ const sql = getSql();sql.fillParamList(subTreeNoteIds);const blobSizes = sql.getMap<string, number>(`diff --cc packages/trilium-core/src/services/app_info.tsindex 0aa1097c95,0000000000..178b68c382mode 100644,000000..100644--- a/packages/trilium-core/src/services/app_info.ts+++ b/packages/trilium-core/src/services/app_info.ts@@@ -1,19 -1,0 +1,19 @@@+import build from "./build.js";+import packageJson from "../../package.json" with { type: "json" };+import { AppInfo } from "@triliumnext/commons";+- const APP_DB_VERSION = 233;- const SYNC_VERSION = 36;++const APP_DB_VERSION = 234;++const SYNC_VERSION = 37;+const CLIPPER_PROTOCOL_VERSION = "1.0";++const appInfo: AppInfo = {+ appVersion: packageJson.version,+ dbVersion: APP_DB_VERSION,+ syncVersion: SYNC_VERSION,+ buildDate: build.buildDate,+ buildRevision: build.buildRevision,+ clipperProtocolVersion: CLIPPER_PROTOCOL_VERSION,+ utcDateTime: new Date().toISOString()+}++export default appInfo;diff --cc packages/trilium-core/src/services/attributes.tsindex 2faf916375,2e1a207447..4a197b8a4e--- a/packages/trilium-core/src/services/attributes.ts+++ b/packages/trilium-core/src/services/attributes.ts@@@ -1,18 -1,16 +1,16 @@@- "use strict";+ import { type AttributeRow, BUILTIN_ATTRIBUTES } from "@triliumnext/commons";+import searchService from "./search/services/search.js";import becca from "../becca/becca.js";import BAttribute from "../becca/entities/battribute.js";- import attributeFormatter from "./attribute_formatter.js";- import BUILTIN_ATTRIBUTES from "./builtin_attributes.js";import type BNote from "../becca/entities/bnote.js";- import type { AttributeRow } from "@triliumnext/commons";-import attributeFormatter from "./attribute_formatter.js";-import searchService from "./search/services/search.js";-import sql from "./sql.js";+import { getSql } from "./sql/index.js";++import attribute_formatter from "./attribute_formatter.js";const ATTRIBUTE_TYPES = new Set(["label", "relation"]);function getNotesWithLabel(name: string, value?: string): BNote[] {-- const query = attributeFormatter.formatAttrForSearch({ type: "label", name, value }, value !== undefined);++ const query = attribute_formatter.formatAttrForSearch({ type: "label", name, value }, value !== undefined);return searchService.searchNotes(query, {includeArchivedNotes: true,ignoreHoistedNote: truediff --cc packages/trilium-core/src/services/hidden_subtree.tsindex ba8da6da1f,0000000000..0931b5f1ddmode 100644,000000..100644--- a/packages/trilium-core/src/services/hidden_subtree.ts+++ b/packages/trilium-core/src/services/hidden_subtree.ts@@@ -1,499 -1,0 +1,509 @@@- import BAttribute from "../becca/entities/battribute.js";- import BBranch from "../becca/entities/bbranch.js";+import type { HiddenSubtreeItem } from "@triliumnext/commons";++import { t } from "i18next";++import becca from "../becca/becca.js";- import noteService from "./notes.js";- import { getLog } from "./log.js";- import * as migrationService from "./migration.js";- import { t } from "i18next";- import { cleanUpHelp, getHelpHiddenSubtreeData } from "./in_app_help.js";++import BAttribute from "../becca/entities/battribute.js";++import BBranch from "../becca/entities/bbranch.js";++import BNote from "../becca/entities/bnote.js";+import buildLaunchBarConfig from "./hidden_subtree_launcherbar.js";+import buildHiddenSubtreeTemplates from "./hidden_subtree_templates.js";++import { cleanUpHelp, getHelpHiddenSubtreeData } from "./in_app_help.js";++import * as migrationService from "./migration.js";++import noteService from "./notes.js";++import { getLog } from "./log.js";++export const LBTPL_ROOT = "_lbTplRoot";+export const LBTPL_BASE = "_lbTplBase";+export const LBTPL_HEADER = "_lbTplHeader";+export const LBTPL_NOTE_LAUNCHER = "_lbTplLauncherNote";+export const LBTPL_WIDGET = "_lbTplLauncherWidget";+export const LBTPL_COMMAND = "_lbTplLauncherCommand";+export const LBTPL_SCRIPT = "_lbTplLauncherScript";+export const LBTPL_SPACER = "_lbTplSpacer";+export const LBTPL_CUSTOM_WIDGET = "_lbTplCustomWidget";++/*+ * Hidden subtree is generated as a "predictable structure" which means that it avoids generating random IDs to always+ * produce the same structure. This is needed because it is run on multiple instances in the sync cluster which might produce+ * duplicate subtrees. This way, all instances will generate the same structure with the same IDs.+ */++let hiddenSubtreeDefinition: HiddenSubtreeItem;++function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenSubtreeItem {+ const launchbarConfig = buildLaunchBarConfig();++ return {+ id: "_hidden",+ title: t("hidden-subtree.root-title"),+ type: "doc",+ icon: "bx bx-hide",+ // we want to keep the hidden subtree always last, otherwise there will be problems with e.g., keyboard navigation+ // over tree when it's in the middle+ notePosition: 999_999_999,+ enforceAttributes: true,+ attributes: [+ { type: "label", name: "docName", value: "hidden" }+ ],+ children: [+ {+ id: "_search",+ title: t("hidden-subtree.search-history-title"),+ type: "doc"+ },+ {+ id: "_globalNoteMap",+ title: t("hidden-subtree.note-map-title"),+ type: "noteMap",+ attributes: [+ { type: "label", name: "mapRootNoteId", value: "hoisted" },+ { type: "label", name: "keepCurrentHoisting" }+ ]+ },+ {+ id: "_sqlConsole",+ title: t("hidden-subtree.sql-console-history-title"),+ type: "doc",+ icon: "bx-data"+ },+ {+ id: "_share",+ title: t("hidden-subtree.shared-notes-title"),+ type: "doc",+ attributes: [{ type: "label", name: "docName", value: "share" }]+ },+ {+ id: "_bulkAction",+ title: t("hidden-subtree.bulk-action-title"),+ type: "doc"+ },+ {+ id: "_backendLog",+ title: t("hidden-subtree.backend-log-title"),+ type: "contentWidget",+ icon: "bx-terminal",+ attributes: [+ { type: "label", name: "keepCurrentHoisting" },+ { type: "label", name: "fullContentWidth" }+ ]+ },+ {+ // place for user scripts hidden stuff (scripts should not create notes directly under hidden root)+ id: "_userHidden",+ title: t("hidden-subtree.user-hidden-title"),+ type: "doc",+ attributes: [{ type: "label", name: "docName", value: "user_hidden" }]+ },+ {+ id: LBTPL_ROOT,+ title: t("hidden-subtree.launch-bar-templates-title"),+ type: "doc",+ children: [+ {+ id: LBTPL_BASE,+ title: t("hidden-subtree.base-abstract-launcher-title"),+ type: "doc"+ },+ {+ id: LBTPL_COMMAND,+ title: t("hidden-subtree.command-launcher-title"),+ type: "doc",+ attributes: [+ { type: "relation", name: "template", value: LBTPL_BASE },+ { type: "label", name: "launcherType", value: "command" },+ { type: "label", name: "docName", value: "launchbar_command_launcher" }+ ]+ },+ {+ id: LBTPL_NOTE_LAUNCHER,+ title: t("hidden-subtree.note-launcher-title"),+ type: "doc",+ attributes: [+ { type: "relation", name: "template", value: LBTPL_BASE },+ { type: "label", name: "launcherType", value: "note" },+ { type: "label", name: "relation:target", value: "promoted" },+ { type: "label", name: "relation:hoistedNote", value: "promoted" },+ { type: "label", name: "label:keyboardShortcut", value: "promoted,text" },+ { type: "label", name: "docName", value: "launchbar_note_launcher" }+ ]+ },+ {+ id: LBTPL_SCRIPT,+ title: t("hidden-subtree.script-launcher-title"),+ type: "doc",+ attributes: [+ { type: "relation", name: "template", value: LBTPL_BASE },+ { type: "label", name: "launcherType", value: "script" },+ { type: "label", name: "relation:script", value: "promoted" },+ { type: "label", name: "label:keyboardShortcut", value: "promoted,text" },+ { type: "label", name: "docName", value: "launchbar_script_launcher" }+ ]+ },+ {+ id: LBTPL_WIDGET,+ title: t("hidden-subtree.built-in-widget-title"),+ type: "doc",+ attributes: [+ { type: "relation", name: "template", value: LBTPL_BASE },+ { type: "label", name: "launcherType", value: "builtinWidget" }+ ]+ },+ {+ id: LBTPL_SPACER,+ title: t("hidden-subtree.spacer-title"),+ type: "doc",+ icon: "bx-move-vertical",+ attributes: [+ { type: "relation", name: "template", value: LBTPL_WIDGET },+ { type: "label", name: "builtinWidget", value: "spacer" },+ { type: "label", name: "label:baseSize", value: "promoted,number" },+ { type: "label", name: "label:growthFactor", value: "promoted,number" },+ { type: "label", name: "docName", value: "launchbar_spacer" }+ ]+ },+ {+ id: LBTPL_CUSTOM_WIDGET,+ title: t("hidden-subtree.custom-widget-title"),+ type: "doc",+ attributes: [+ { type: "relation", name: "template", value: LBTPL_BASE },+ { type: "label", name: "launcherType", value: "customWidget" },+ { type: "label", name: "relation:widget", value: "promoted" },+ { type: "label", name: "docName", value: "launchbar_widget_launcher" }+ ]+ }+ ]+ },+ {+ id: "_lbRoot",+ title: t("hidden-subtree.launch-bar-title"),+ type: "doc",+ icon: "bx-sidebar",+ isExpanded: true,+ attributes: [{ type: "label", name: "docName", value: "launchbar_intro" }],+ children: [+ {+ id: "_lbAvailableLaunchers",+ title: t("hidden-subtree.available-launchers-title"),+ type: "doc",+ icon: "bx-hide",+ isExpanded: true,+ attributes: [{ type: "label", name: "docName", value: "launchbar_intro" }],+ children: launchbarConfig.desktopAvailableLaunchers+ },+ {+ id: "_lbVisibleLaunchers",+ title: t("hidden-subtree.visible-launchers-title"),+ type: "doc",+ icon: "bx-show",+ isExpanded: true,+ attributes: [{ type: "label", name: "docName", value: "launchbar_intro" }],+ children: launchbarConfig.desktopVisibleLaunchers+ }+ ]+ },+ {+ id: "_lbMobileRoot",+ title: "Mobile Launch Bar",+ type: "doc",+ icon: "bx-mobile",+ isExpanded: true,+ attributes: [{ type: "label", name: "docName", value: "launchbar_intro" }],+ children: [+ {+ id: "_lbMobileAvailableLaunchers",+ title: t("hidden-subtree.available-launchers-title"),+ type: "doc",+ icon: "bx-hide",+ isExpanded: true,+ attributes: [{ type: "label", name: "docName", value: "launchbar_intro" }],+ children: launchbarConfig.mobileAvailableLaunchers+ },+ {+ id: "_lbMobileVisibleLaunchers",+ title: t("hidden-subtree.visible-launchers-title"),+ type: "doc",+ icon: "bx-show",+ isExpanded: true,+ attributes: [{ type: "label", name: "docName", value: "launchbar_intro" }],+ children: launchbarConfig.mobileVisibleLaunchers+ }+ ]+ },+ {+ id: "_options",+ title: t("hidden-subtree.options-title"),+ type: "book",+ icon: "bx-cog",+ children: [+ { id: "_optionsAppearance", title: t("hidden-subtree.appearance-title"), type: "contentWidget", icon: "bx-layout" },+ { id: "_optionsShortcuts", title: t("hidden-subtree.shortcuts-title"), type: "contentWidget", icon: "bxs-keyboard" },+ { id: "_optionsTextNotes", title: t("hidden-subtree.text-notes"), type: "contentWidget", icon: "bx-text" },+ { id: "_optionsCodeNotes", title: t("hidden-subtree.code-notes-title"), type: "contentWidget", icon: "bx-code" },+ { id: "_optionsImages", title: t("hidden-subtree.images-title"), type: "contentWidget", icon: "bx-image" },+ { id: "_optionsSpellcheck", title: t("hidden-subtree.spellcheck-title"), type: "contentWidget", icon: "bx-check-double" },+ { id: "_optionsPassword", title: t("hidden-subtree.password-title"), type: "contentWidget", icon: "bx-lock" },+ { id: '_optionsMFA', title: t('hidden-subtree.multi-factor-authentication-title'), type: 'contentWidget', icon: 'bx-lock ' },+ { id: "_optionsEtapi", title: t("hidden-subtree.etapi-title"), type: "contentWidget", icon: "bx-extension" },+ { id: "_optionsBackup", title: t("hidden-subtree.backup-title"), type: "contentWidget", icon: "bx-data" },+ { id: "_optionsSync", title: t("hidden-subtree.sync-title"), type: "contentWidget", icon: "bx-wifi" },- { id: "_optionsAi", title: t("hidden-subtree.ai-llm-title"), type: "contentWidget", icon: "bx-bot" },++ { id: "_optionsAi", title: "AI Chat", type: "contentWidget", enforceDeleted: true },+ { id: "_optionsOther", title: t("hidden-subtree.other"), type: "contentWidget", icon: "bx-dots-horizontal" },+ { id: "_optionsLocalization", title: t("hidden-subtree.localization"), type: "contentWidget", icon: "bx-world" },+ { id: "_optionsAdvanced", title: t("hidden-subtree.advanced-title"), type: "contentWidget" }+ ]+ },+ {+ id: "_help",+ title: t("hidden-subtree.user-guide"),+ type: "book",+ icon: "bx-help-circle",+ children: helpSubtree,+ isExpanded: true+ },+ buildHiddenSubtreeTemplates()+ ]+ };+}++interface CheckHiddenExtraOpts {+ restoreNames?: boolean;+}++function checkHiddenSubtree(force = false, extraOpts: CheckHiddenExtraOpts = {}) {+ if (!force && !migrationService.isDbUpToDate()) {+ // on-delete hook might get triggered during some future migration and cause havoc+ getLog().info("Will not check hidden subtree until migration is finished.");+ return;+ }++ const helpSubtree = getHelpHiddenSubtreeData();+ if (!hiddenSubtreeDefinition || force) {+ hiddenSubtreeDefinition = buildHiddenSubtreeDefinition(helpSubtree);+ }++ checkHiddenSubtreeRecursively("root", hiddenSubtreeDefinition, extraOpts);++ try {+ cleanUpHelp(helpSubtree);+ } catch (e) {+ // Non-critical operation should something go wrong.+ console.error(e);+ }+}++/**+ * Get all expected parent IDs for a given note ID from the hidden subtree definition+ */+function getExpectedParentIds(noteId: string, subtree: HiddenSubtreeItem): string[] {+ const expectedParents: string[] = [];++ function traverse(item: HiddenSubtreeItem, parentId: string) {+ if (item.id === noteId) {+ expectedParents.push(parentId);+ }++ if (item.children) {+ for (const child of item.children) {+ traverse(child, item.id);+ }+ }+ }++ // Start traversal from root+ if (subtree.id === noteId) {+ expectedParents.push("root");+ }++ if (subtree.children) {+ for (const child of subtree.children) {+ traverse(child, subtree.id);+ }+ }++ return expectedParents;+}++/**+ * Check if a note ID is within the hidden subtree structure+ */+function isWithinHiddenSubtree(noteId: string): boolean {+ // Consider a note to be within hidden subtree if it starts with underscore+ // This is the convention used for hidden subtree notes+ return noteId.startsWith("_") || noteId === "root";+}++function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtreeItem, extraOpts: CheckHiddenExtraOpts = {}) {+ if (!item.id || !item.type || !item.title) {+ throw new Error(`Item does not contain mandatory properties: ${JSON.stringify(item)}`);+ }++ if (item.id.charAt(0) !== "_") {+ throw new Error(`ID has to start with underscore, given '${item.id}'`);+ }+- let note = becca.notes[item.id];- let branch;++ let note = becca.notes[item.id] as BNote | undefined;++ let branch: BBranch | undefined;+ const log = getLog();+++ if (item.enforceDeleted) {++ note?.deleteNote();++ return;++ }+++ if (!note) {+ // Missing item, add it.+ ({ note, branch } = noteService.createNewNote({+ noteId: item.id,+ title: item.title,+ type: item.type,- parentNoteId: parentNoteId,++ parentNoteId,+ content: item.content ?? "",+ ignoreForbiddenParents: true+ }));+ } else {+ // Existing item, check if it's in the right state.+ branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);++ if (item.content && note.getContent() !== item.content) {+ log.info(`Updating content of ${item.id}.`);+ note.setContent(item.content);+ }+- // Clean up any branches that shouldn't exist according to the meta definition- // For hidden subtree notes, we want to ensure they only exist in their designated locations+ if (item.enforceBranches || item.id.startsWith("_help")) {++ // Clean up any branches that shouldn't exist according to the meta definition++ // For hidden subtree notes, we want to ensure they only exist in their designated locations+++ // If the note exists but doesn't have a branch in the expected parent,+ // create the missing branch to ensure it's in the correct location+ if (!branch) {+ log.info(`Creating missing branch for note ${item.id} under parent ${parentNoteId}.`);+ branch = new BBranch({+ noteId: item.id,- parentNoteId: parentNoteId,++ parentNoteId,+ notePosition: item.notePosition !== undefined ? item.notePosition : undefined,+ isExpanded: item.isExpanded !== undefined ? item.isExpanded : false+ }).save();+ }++ // Remove any branches that are not in the expected parent.+ const expectedParents = getExpectedParentIds(item.id, hiddenSubtreeDefinition);+ const currentBranches = note.getParentBranches();++ for (const currentBranch of currentBranches) {+ // Only delete branches that are not in the expected locations+ // and are within the hidden subtree structure (avoid touching user-created clones)+ if (!expectedParents.includes(currentBranch.parentNoteId) &&+ isWithinHiddenSubtree(currentBranch.parentNoteId)) {+ log.info(`Removing unexpected branch for note '${item.id}' from parent '${currentBranch.parentNoteId}'`);+ currentBranch.markAsDeleted();+ }+ }+ }+ }++ const attrs = [...(item.attributes || [])];++ if (item.icon) {+ attrs.push({ type: "label", name: "iconClass", value: `bx ${item.icon}` });+ }++ if (item.type === "launcher") {+ if (item.command) {+ attrs.push({ type: "relation", name: "template", value: LBTPL_COMMAND });+ attrs.push({ type: "label", name: "command", value: item.command });+ } else if (item.builtinWidget) {+ if (item.builtinWidget === "spacer") {+ attrs.push({ type: "relation", name: "template", value: LBTPL_SPACER });+ attrs.push({ type: "label", name: "baseSize", value: item.baseSize });+ attrs.push({ type: "label", name: "growthFactor", value: item.growthFactor });+ } else {+ attrs.push({ type: "relation", name: "template", value: LBTPL_WIDGET });+ }++ attrs.push({ type: "label", name: "builtinWidget", value: item.builtinWidget });+ } else if (item.targetNoteId) {+ attrs.push({ type: "relation", name: "template", value: LBTPL_NOTE_LAUNCHER });+ attrs.push({ type: "relation", name: "target", value: item.targetNoteId });- } else {++ } else if (!item.enforceDeleted) {+ throw new Error(`No action defined for launcher ${JSON.stringify(item)}`);+ }+ }++ const shouldRestoreNames = extraOpts.restoreNames || note.noteId.startsWith("_help") || item.id.startsWith("_lb") || item.id.startsWith("_template");+ if (shouldRestoreNames && note.title !== item.title) {+ note.title = item.title;+ note.save();+ }++ if (note.type !== item.type) {+ // enforce a correct note type+ note.type = item.type;+ note.save();+ }++ if (branch) {+ // in case of launchers the branch ID is not preserved and should not be relied upon - launchers which move between+ // visible and available will change branch since the branch's parent-child relationship is immutable+ if (item.notePosition !== undefined && branch.notePosition !== item.notePosition) {+ branch.notePosition = item.notePosition;+ branch.save();+ }++ if (item.isExpanded !== undefined && branch.isExpanded !== item.isExpanded) {+ branch.isExpanded = item.isExpanded;+ branch.save();+ }+ }++ // Enforce attribute structure if needed.+ if (item.enforceAttributes) {+ for (const attribute of note.getAttributes()) {+ // Remove unwanted attributes.+ const attrDef = attrs.find(a => a.name === attribute.name);+ if (!attrDef) {++ console.log(`Removing unwanted attribute ${attribute.name} where expected attrs are ${attrs.map(a => a.name).join(", ")}`);+ attribute.markAsDeleted();+ continue;+ }++ // Ensure value is consistent.- if (attribute.value !== attrDef.value) {- note.setAttributeValueById(attribute.attributeId, attrDef.value);++ if (attribute.value !== attrDef.value || attribute.type !== attrDef.type) {++ attribute.type = attrDef.type;++ attribute.value = attrDef.value ?? "";++ attribute.save();+ }+ }+ }++ for (const attr of attrs) {- const attrId = note.noteId + "_" + attr.type.charAt(0) + attr.name;++ const attrId = `${note.noteId}_${attr.type.charAt(0)}${attr.name}`;++ const existingAttribute = note.getAttributes().find((attr) => attr.attributeId === attrId);++ if (!existingAttribute) {+ new BAttribute({+ attributeId: attrId,+ noteId: note.noteId,+ type: attr.type,+ name: attr.name,+ value: attr.value,+ isInheritable: attr.isInheritable+ }).save();+ } else if (attr.name === "docName" || (existingAttribute.noteId.startsWith("_help") && attr.name === "iconClass")) {+ if (existingAttribute.value !== attr.value) {+ log.info(`Updating attribute ${attrId} from "${existingAttribute.value}" to "${attr.value}"`);+ existingAttribute.value = attr.value ?? "";+ existingAttribute.save();+ }+ }+ }++ for (const child of item.children || []) {+ checkHiddenSubtreeRecursively(item.id, child, extraOpts);+ }+}++export default {+ checkHiddenSubtree+};diff --cc packages/trilium-core/src/services/note_types.tsindex 2aa86d0b64,0000000000..bc0574dc83mode 100644,000000..100644--- a/packages/trilium-core/src/services/note_types.ts+++ b/packages/trilium-core/src/services/note_types.ts@@@ -1,34 -1,0 +1,34 @@@+const noteTypes = [+ { type: "text", defaultMime: "text/html" },+ { type: "code", defaultMime: "text/plain" },+ { type: "render", defaultMime: "" },+ { type: "file", defaultMime: "application/octet-stream" },+ { type: "image", defaultMime: "" },+ { type: "search", defaultMime: "" },+ { type: "relationMap", defaultMime: "application/json" },+ { type: "book", defaultMime: "" },+ { type: "noteMap", defaultMime: "" },+ { type: "mermaid", defaultMime: "text/vnd.mermaid" },+ { type: "canvas", defaultMime: "application/json" },+ { type: "webView", defaultMime: "" },+ { type: "launcher", defaultMime: "" },+ { type: "doc", defaultMime: "" },+ { type: "contentWidget", defaultMime: "" },+ { type: "mindMap", defaultMime: "application/json" },- { type: "aiChat", defaultMime: "application/json" }++ { type: "spreadsheet", defaultMime: "application/json" }+];++function getDefaultMimeForNoteType(typeName: string) {+ const typeRec = noteTypes.find((nt) => nt.type === typeName);++ if (!typeRec) {+ throw new Error(`Cannot find note type '${typeName}'`);+ }++ return typeRec.defaultMime;+}++export default {+ getNoteTypeNames: () => noteTypes.map((nt) => nt.type),+ getDefaultMimeForNoteType+};diff --cc packages/trilium-core/src/services/notes.tsindex a02a51f48e,0000000000..b60e2ea86amode 100644,000000..100644--- a/packages/trilium-core/src/services/notes.ts+++ b/packages/trilium-core/src/services/notes.ts@@@ -1,1127 -1,0 +1,1126 @@@- import type { AttachmentRow, AttributeRow, BranchRow, NoteRow, NoteType } from "@triliumnext/commons";- import { dayjs } from "@triliumnext/commons";- import date_utils from "../services/utils/date";- import eventService from "../services/events";- import { ValidationError } from "../errors.js";++import { type AttachmentRow, type AttributeRow, type BranchRow, dayjs, type NoteRow, NoteType } from "@triliumnext/commons";+import fs from "fs";+import html2plaintext from "html2plaintext";+import { t } from "i18next";+import path from "path";+import url from "url";++import becca from "../becca/becca.js";+import BAttachment from "../becca/entities/battachment.js";+import BAttribute from "../becca/entities/battribute.js";+import BBranch from "../becca/entities/bbranch.js";+import BNote from "../becca/entities/bnote.js";- import * as cls from "../services/context.js";++import log, { getLog } from "../services/log.js";+import protectedSessionService from "../services/protected_session.js";+import { newEntityId, quoteRegex, toMap, unescapeHtml } from "./utils/index.js";++import date_utils from "./utils/date.js";+import entityChangesService from "./entity_changes.js";++import eventService from "./events.js";+import imageService from "./image.js";+import noteTypesService from "./note_types.js";+import optionService from "./options.js";+import request from "./request.js";+import revisionService from "./revisions.js";+import type TaskContext from "./task_context.js";+import ws from "./ws.js";- import { getSql } from "./sql/index.js";- import { getLog } from "./log.js";+import { decodeBase64 } from "./utils/binary.js";++import { getSql } from "./sql/index.js";+import { sanitizeHtml } from "./sanitizer.js";++import { ValidationError } from "../errors.js";++import * as cls from "./context.js";++interface FoundLink {+ name: "imageLink" | "internalLink" | "includeNoteLink" | "relationMapLink";+ value: string;+}++interface Attachment {+ attachmentId?: string;+ title: string;+}++export interface NoteParams {+ /** optionally can force specific noteId */+ noteId?: string;+ branchId?: string;+ parentNoteId: string;+ templateNoteId?: string;+ title: string;+ content: string | Uint8Array;+ /** text, code, file, image, search, book, relationMap, canvas, webView */+ type: NoteType;+ /** default value is derived from default mimes for type */+ mime?: string;+ /** default is false */+ isProtected?: boolean;+ /** default is false */+ isExpanded?: boolean;+ /** default is empty string */+ prefix?: string;+ /** default is the last existing notePosition in a parent + 10 */+ notePosition?: number;+ dateCreated?: string;+ utcDateCreated?: string;+ ignoreForbiddenParents?: boolean;+ target?: "into";+ /** Attributes to be set on the note. These are set atomically on note creation, so entity changes are not sent for attributes defined here. */+ attributes?: Omit<AttributeRow, "noteId" | "attributeId">[];+}++function getNewNotePosition(parentNote: BNote) {+ if (parentNote.isLabelTruthy("newNotesOnTop")) {+ const minNotePos = parentNote+ .getChildBranches()+ .filter((branch) => branch?.noteId !== "_hidden") // has "always last" note position+ .reduce((min, note) => Math.min(min, note?.notePosition || 0), 0);++ return minNotePos - 10;+ }+ const maxNotePos = parentNote+ .getChildBranches()+ .filter((branch) => branch?.noteId !== "_hidden") // has "always last" note position+ .reduce((max, note) => Math.max(max, note?.notePosition || 0), 0);++ return maxNotePos + 10;-+}++function triggerNoteTitleChanged(note: BNote) {+ eventService.emit(eventService.NOTE_TITLE_CHANGED, note);+}++function deriveMime(type: string, mime?: string) {+ if (!type) {+ throw new Error(`Note type is a required param`);+ }++ if (mime) {+ return mime;+ }++ return noteTypesService.getDefaultMimeForNoteType(type);+}++function copyChildAttributes(parentNote: BNote, childNote: BNote) {+ for (const attr of parentNote.getAttributes()) {+ if (attr.name.startsWith("child:")) {+ const name = attr.name.substring(6);+ const hasAlreadyTemplate = childNote.hasRelation("template");++ if (hasAlreadyTemplate && attr.type === "relation" && name === "template") {+ // if the note already has a template, it means the template was chosen by the user explicitly+ // in the menu. In that case, we should override the default templates defined in the child: attrs+ continue;+ }++ new BAttribute({+ noteId: childNote.noteId,+ type: attr.type,+ name,+ value: attr.value,+ position: attr.position,+ isInheritable: attr.isInheritable+ }).save();+ }+ }+}++function copyAttachments(origNote: BNote, newNote: BNote) {+ for (const attachment of origNote.getAttachments()) {+ if (attachment.role === "image") {+ // Handled separately, see `checkImageAttachments`.+ continue;+ }++ const newAttachment = new BAttachment({+ ...attachment,+ attachmentId: undefined,+ ownerId: newNote.noteId+ });++ newAttachment.save();+ }+}++function getNewNoteTitle(parentNote: BNote) {+ let title = t("notes.new-note");++ const titleTemplate = parentNote.getLabelValue("titleTemplate");++ if (titleTemplate !== null) {+ try {+ const now = dayjs(date_utils.localNowDateTime() || new Date());++ // "officially" injected values:+ // - now+ // - parentNote++ title = eval(`\`${titleTemplate}\``);+ } catch (e: any) {+ getLog().error(`Title template of note '${parentNote.noteId}' failed with: ${e.message}`);+ }+ }++ // this isn't in theory a good place to sanitize title, but this will catch a lot of XSS attempts.+ // title is supposed to contain text only (not HTML) and be printed text only, but given the number of usages,+ // it's difficult to guarantee correct handling in all cases+ title = sanitizeHtml(title);++ return title;+}++interface GetValidateParams {+ parentNoteId: string;+ type: string;+ ignoreForbiddenParents?: boolean;+}++function getAndValidateParent(params: GetValidateParams) {+ const parentNote = becca.notes[params.parentNoteId];++ if (!parentNote) {+ throw new ValidationError(`Parent note '${params.parentNoteId}' was not found.`);+ }++ if (parentNote.type === "launcher" && parentNote.noteId !== "_lbBookmarks") {+ throw new ValidationError(`Creating child notes into launcher notes is not allowed.`);+ }++ if (["_lbAvailableLaunchers", "_lbVisibleLaunchers"].includes(params.parentNoteId) && params.type !== "launcher") {+ throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);+ }++ if (!params.ignoreForbiddenParents) {+ if (["_lbRoot", "_hidden"].includes(parentNote.noteId)+ || parentNote.noteId.startsWith("_lbTpl")+ || parentNote.noteId.startsWith("_help")+ || parentNote.isOptions()) {+ throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);+ }+ }++ return parentNote;+}++function createNewNote(params: NoteParams): {+ note: BNote;+ branch: BBranch;+} {+ const parentNote = getAndValidateParent(params);++ if (params.title === null || params.title === undefined) {+ params.title = getNewNoteTitle(parentNote);+ }++ if (params.content === null || params.content === undefined) {+ throw new Error(`Note content must be set`);+ }++ let error;+ if ((error = date_utils.validateLocalDateTime(params.dateCreated))) {+ throw new Error(error);+ }++ if ((error = date_utils.validateUtcDateTime(params.utcDateCreated))) {+ throw new Error(error);+ }++ return getSql().transactional(() => {+ let note, branch, isEntityEventsDisabled;++ try {+ isEntityEventsDisabled = cls.isEntityEventsDisabled();++ if (!isEntityEventsDisabled) {+ // it doesn't make sense to run note creation events on a partially constructed note, so+ // defer them until note creation is completed+ cls.disableEntityEvents();+ }++ // TODO: think about what can happen if the note already exists with the forced ID+ // I guess on DB it's going to be fine, but becca references between entities+ // might get messed up (two note instances for the same ID existing in the references)+ note = new BNote({+ noteId: params.noteId, // optionally can force specific noteId+ title: params.title,+ isProtected: !!params.isProtected,+ type: params.type,+ mime: deriveMime(params.type, params.mime),+ dateCreated: params.dateCreated,+ utcDateCreated: params.utcDateCreated+ }).save();++ // Create attributes atomically.+ for (const attribute of params.attributes || []) {+ new BAttribute({+ ...attribute,+ noteId: note.noteId+ }).save();+ }++ note.setContent(params.content);++ branch = new BBranch({+ noteId: note.noteId,+ parentNoteId: params.parentNoteId,+ notePosition: params.notePosition !== undefined ? params.notePosition : getNewNotePosition(parentNote),+ prefix: params.prefix || "",+ isExpanded: !!params.isExpanded+ }).save();+ } finally {+ if (!isEntityEventsDisabled) {+ // re-enable entity events only if they were previously enabled+ // (they can be disabled in case of import)+ cls.enableEntityEvents();+ }+ }++ if (params.templateNoteId) {+ const templateNote = becca.getNote(params.templateNoteId);+ if (!templateNote) {+ throw new Error(`Template note '${params.templateNoteId}' does not exist.`);+ }++ note.addRelation("template", params.templateNoteId);+ copyAttachments(templateNote, note);++ // no special handling for ~inherit since it doesn't matter if it's assigned with the note creation or later+ }++ copyChildAttributes(parentNote, note);++ eventService.emit(eventService.ENTITY_CREATED, { entityName: "notes", entity: note });+ eventService.emit(eventService.ENTITY_CHANGED, { entityName: "notes", entity: note });+ triggerNoteTitleChanged(note);+ // blobs entity doesn't use "created" event+ eventService.emit(eventService.ENTITY_CHANGED, { entityName: "blobs", entity: note });+ eventService.emit(eventService.ENTITY_CREATED, { entityName: "branches", entity: branch });+ eventService.emit(eventService.ENTITY_CHANGED, { entityName: "branches", entity: branch });+ eventService.emit(eventService.CHILD_NOTE_CREATED, { childNote: note, parentNote });++ getLog().info(`Created new note '${note.noteId}', branch '${branch.branchId}' of type '${note.type}', mime '${note.mime}'`);++ return {+ note,+ branch+ };+ });+}++function createNewNoteWithTarget(target: "into" | "after" | "before", targetBranchId: string | undefined, params: NoteParams) {+ if (!params.type) {+ const parentNote = becca.notes[params.parentNoteId];++ // code note type can be inherited, otherwise "text" is the default+ params.type = parentNote.type === "code" ? "code" : "text";+ params.mime = parentNote.type === "code" ? parentNote.mime : "text/html";+ }++ if (target === "into") {+ return createNewNote(params);+ } else if (target === "after" && targetBranchId) {+ const afterBranch = becca.branches[targetBranchId];++ // not updating utcDateModified to avoid having to sync whole rows+ getSql().execute("UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition > ? AND isDeleted = 0", [params.parentNoteId, afterBranch.notePosition]);++ params.notePosition = afterBranch.notePosition + 10;++ const retObject = createNewNote(params);++ entityChangesService.putNoteReorderingEntityChange(params.parentNoteId);++ return retObject;+ } else if (target === "before" && targetBranchId) {+ const beforeBranch = becca.branches[targetBranchId];++ // not updating utcDateModified to avoid having to sync whole rows+ getSql().execute("UPDATE branches SET notePosition = notePosition - 10 WHERE parentNoteId = ? AND notePosition < ? AND isDeleted = 0", [params.parentNoteId, beforeBranch.notePosition]);++ params.notePosition = beforeBranch.notePosition - 10;++ const retObject = createNewNote(params);++ entityChangesService.putNoteReorderingEntityChange(params.parentNoteId);++ return retObject;+ }+ throw new Error(`Unknown target '${target}'`);-+}++function protectNoteRecursively(note: BNote, protect: boolean, includingSubTree: boolean, taskContext: TaskContext<"protectNotes">) {+ protectNote(note, protect);++ taskContext.increaseProgressCount();++ if (includingSubTree) {+ for (const child of note.getChildNotes()) {+ protectNoteRecursively(child, protect, includingSubTree, taskContext);+ }+ }+}++function protectNote(note: BNote, protect: boolean) {+ if (!protectedSessionService.isProtectedSessionAvailable()) {+ throw new Error(`Cannot (un)protect note '${note.noteId}' with protect flag '${protect}' without active protected session`);+ }++ const log = getLog();+ try {+ if (protect !== note.isProtected) {+ const content = note.getContent();++ note.isProtected = protect;+ note.setContent(content, { forceSave: true });+ }++ revisionService.protectRevisions(note);++ for (const attachment of note.getAttachments()) {+ if (protect !== attachment.isProtected) {+ try {+ const content = attachment.getContent();++ attachment.isProtected = protect;+ attachment.setContent(content, { forceSave: true });+ } catch (e) {+ log.error(`Could not un/protect attachment '${attachment.attachmentId}'`);++ throw e;+ }+ }+ }+ } catch (e) {+ log.error(`Could not un/protect note '${note.noteId}'`);++ throw e;+ }+}++function checkImageAttachments(note: BNote, content: string) {+ const foundAttachmentIds = new Set<string>();+ let match;++ const imgRegExp = /src="[^"]*api\/attachments\/([a-zA-Z0-9_]+)\/image/g;+ while ((match = imgRegExp.exec(content))) {+ foundAttachmentIds.add(match[1]);+ }++ const linkRegExp = /href="[^"]+attachmentId=([a-zA-Z0-9_]+)/g;+ while ((match = linkRegExp.exec(content))) {+ foundAttachmentIds.add(match[1]);+ }++ const attachments = note.getAttachments();++ for (const attachment of attachments) {+ const attachmentInContent = attachment.attachmentId && foundAttachmentIds.has(attachment.attachmentId);++ if (attachment.utcDateScheduledForErasureSince && attachmentInContent) {+ attachment.utcDateScheduledForErasureSince = null;+ attachment.save();+ } else if (!attachment.utcDateScheduledForErasureSince && !attachmentInContent) {+ attachment.utcDateScheduledForErasureSince = date_utils.utcNowDateTime();+ attachment.save();+ }+ }++ const existingAttachmentIds = new Set<string | undefined>(attachments.map((att) => att.attachmentId));+ const unknownAttachmentIds = Array.from(foundAttachmentIds).filter((foundAttId) => !existingAttachmentIds.has(foundAttId));+ const unknownAttachments = becca.getAttachments(unknownAttachmentIds);++ for (const unknownAttachment of unknownAttachments) {+ // the attachment belongs to a different note (was copy-pasted). Attachments can be linked only from the note+ // which owns it, so either find an existing attachment having the same content or make a copy.+ let localAttachment = note.getAttachments().find((att) => att.role === unknownAttachment.role && att.blobId === unknownAttachment.blobId);++ if (localAttachment) {+ if (localAttachment.utcDateScheduledForErasureSince) {+ // the attachment is for sure linked now, so reset the scheduled deletion+ localAttachment.utcDateScheduledForErasureSince = null;+ localAttachment.save();+ }++ getLog().info(+ `Found equivalent attachment '${localAttachment.attachmentId}' of note '${note.noteId}' for the linked foreign attachment '${unknownAttachment.attachmentId}' of note '${unknownAttachment.ownerId}'`+ );+ } else {+ localAttachment = unknownAttachment.copy();+ localAttachment.ownerId = note.noteId;+ localAttachment.setContent(unknownAttachment.getContent(), { forceSave: true });++ ws.sendMessageToAllClients({ type: "toast", message: `Attachment '${localAttachment.title}' has been copied to note '${note.title}'.` });+ getLog().info(`Copied attachment '${unknownAttachment.attachmentId}' of note '${unknownAttachment.ownerId}' to new '${localAttachment.attachmentId}' of note '${note.noteId}'`);+ }++ // replace image links+ content = content.replace(`api/attachments/${unknownAttachment.attachmentId}/image`, `api/attachments/${localAttachment.attachmentId}/image`);+ // replace reference links+ content = content.replace(+ new RegExp(`href="[^"]+attachmentId=${unknownAttachment.attachmentId}[^"]*"`, "g"),+ `href="#root/${localAttachment.ownerId}?viewMode=attachments&attachmentId=${localAttachment.attachmentId}"`+ );+ }++ return {+ forceFrontendReload: unknownAttachments.length > 0,+ content+ };+}++function findImageLinks(content: string, foundLinks: FoundLink[]) {+ const re = /src="[^"]*api\/images\/([a-zA-Z0-9_]+)\//g;+ let match;++ while ((match = re.exec(content))) {+ foundLinks.push({+ name: "imageLink",+ value: match[1]+ });+ }++ // removing absolute references to server to keep it working between instances,+ // we also omit / at the beginning to keep the paths relative+ return content.replace(/src="[^"]*\/api\/images\//g, 'src="api/images/');+}++function findInternalLinks(content: string, foundLinks: FoundLink[]) {+ const re = /href="[^"]*#root[a-zA-Z0-9_\/]*\/([a-zA-Z0-9_]+)\/?"/g;+ let match;++ while ((match = re.exec(content))) {+ foundLinks.push({+ name: "internalLink",+ value: match[1]+ });+ }++ // removing absolute references to server to keep it working between instances+ return content.replace(/href="[^"]*#root/g, 'href="#root');+}++function findIncludeNoteLinks(content: string, foundLinks: FoundLink[]) {+ const re = /<section class="include-note[^>]+data-note-id="([a-zA-Z0-9_]+)"[^>]*>/g;+ let match;++ while ((match = re.exec(content))) {+ foundLinks.push({+ name: "includeNoteLink",+ value: match[1]+ });+ }++ return content;+}++function findRelationMapLinks(content: string, foundLinks: FoundLink[]) {+ try {+ const obj = JSON.parse(content);++ for (const note of obj.notes) {+ foundLinks.push({+ name: "relationMapLink",+ value: note.noteId+ });+ }+ } catch (e: any) {- getLog().error(`Could not scan for relation map links: ${ e.message}`);++ getLog().error(`Could not scan for relation map links: ${e.message}`);+ }+}++const imageUrlToAttachmentIdMapping: Record<string, string> = {};++async function downloadImage(noteId: string, imageUrl: string) {+ const unescapedUrl = unescapeHtml(imageUrl);- const log = getLog();++ try {+ let imageBuffer: Uint8Array;++ if (imageUrl.toLowerCase().startsWith("file://")) {+ imageBuffer = await new Promise((res, rej) => {+ const localFilePath = imageUrl.substring("file://".length);++ return fs.readFile(localFilePath, (err, data) => {+ if (err) {+ rej(err);+ } else {+ res(data);+ }+ });+ });+ } else {+ imageBuffer = await request.getImage(unescapedUrl);+ }++ const parsedUrl = url.parse(unescapedUrl);+ const title = path.basename(parsedUrl.pathname || "");++ const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, title, true, true);++ if (attachment.attachmentId) {+ imageUrlToAttachmentIdMapping[imageUrl] = attachment.attachmentId;+ } else {- log.error(`Download of '${imageUrl}' for note '${noteId}' failed due to no attachment ID.`);++ getLog().error(`Download of '${imageUrl}' for note '${noteId}' failed due to no attachment ID.`);+ }+- log.info(`Download of '${imageUrl}' succeeded and was saved as image attachment '${attachment.attachmentId}' of note '${noteId}'`);++ getLog().info(`Download of '${imageUrl}' succeeded and was saved as image attachment '${attachment.attachmentId}' of note '${noteId}'`);+ } catch (e: any) {- log.error(`Download of '${imageUrl}' for note '${noteId}' failed with error: ${e.message} ${e.stack}`);++ getLog().error(`Download of '${imageUrl}' for note '${noteId}' failed with error: ${e.message} ${e.stack}`);+ }+}++/** url => download promise */+const downloadImagePromises: Record<string, Promise<void>> = {};++function replaceUrl(content: string, url: string, attachment: Attachment) {+ const quotedUrl = quoteRegex(url);++ return content.replace(new RegExp(`\\s+src=[\"']${quotedUrl}[\"']`, "ig"), ` src="api/attachments/${attachment.attachmentId}/image/${encodeURIComponent(attachment.title)}"`);+}++function downloadImages(noteId: string, content: string) {+ const imageRe = /<img[^>]*?\ssrc=['"]([^'">]+)['"]/gi;+ let imageMatch;++ while ((imageMatch = imageRe.exec(content))) {+ const url = imageMatch[1];+ const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url);++ if (inlineImageMatch) {+ const imageBase64 = url.substring(inlineImageMatch[0].length);+ const imageBuffer = decodeBase64(imageBase64);++ const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true);++ const encodedTitle = encodeURIComponent(attachment.title);++ content = `${content.substring(0, imageMatch.index)}<img src="api/attachments/${attachment.attachmentId}/image/${encodedTitle}"${content.substring(imageMatch.index + imageMatch[0].length)}`;+ } else if (+ !url.includes("api/images/") &&+ !/api\/attachments\/.+\/image\/?.*/.test(url) &&+ // this is an exception for the web clipper's "imageId"+ (url.length !== 20 || url.toLowerCase().startsWith("http"))+ ) {+ if (!optionService.getOptionBool("downloadImagesAutomatically")) {+ continue;+ }++ if (url in imageUrlToAttachmentIdMapping) {+ const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]);++ if (!attachment) {+ delete imageUrlToAttachmentIdMapping[url];+ } else {+ content = replaceUrl(content, url, attachment);+ continue;+ }+ }++ if (url in downloadImagePromises) {+ // download is already in progress+ continue;+ }++ // this is done asynchronously, it would be too slow to wait for the download+ // given that save can be triggered very often+ downloadImagePromises[url] = downloadImage(noteId, url);+ }+ }++ Promise.all(Object.values(downloadImagePromises)).then(() => {+ setTimeout(() => {+ // the normal expected flow of the offline image saving is that users will paste the image(s)+ // which will get asynchronously downloaded, during that time they keep editing the note+ // once the download is finished, the image note representing the downloaded image will be used+ // to replace the IMG link.+ // However, there's another flow where the user pastes the image and leaves the note before the images+ // are downloaded and the IMG references are not updated. For this occasion we have this code+ // which upon the download of all the images will update the note if the links have not been fixed before++ getSql().transactional(() => {+ const imageNotes = becca.getNotes(Object.values(imageUrlToAttachmentIdMapping), true);+ const log = getLog();++ const origNote = becca.getNote(noteId);++ if (!origNote) {+ log.error(`Cannot find note '${noteId}' to replace image link.`);+ return;+ }++ const origContent = origNote.getContent();+ let updatedContent = origContent;++ if (typeof updatedContent !== "string") {+ log.error(`Note '${noteId}' has a non-string content, cannot replace image link.`);+ return;+ }++ for (const url in imageUrlToAttachmentIdMapping) {+ const imageNote = imageNotes.find((note) => note.noteId === imageUrlToAttachmentIdMapping[url]);++ if (imageNote) {+ updatedContent = replaceUrl(updatedContent, url, imageNote);+ }+ }++ // update only if the links have not been already fixed.+ if (updatedContent !== origContent) {+ origNote.setContent(updatedContent);++ asyncPostProcessContent(origNote, updatedContent);++ console.log(`Fixed the image links for note '${noteId}' to the offline saved.`);+ }+ });+ }, 5000);+ });++ return content;+}++function saveAttachments(note: BNote, content: string) {+ const inlineAttachmentRe = /<a[^>]*?\shref=['"]data:([^;'">]+);base64,([^'">]+)['"][^>]*>(.*?)<\/a>/gim;+ let attachmentMatch;++ while ((attachmentMatch = inlineAttachmentRe.exec(content))) {+ const mime = attachmentMatch[1].toLowerCase();++ const base64data = attachmentMatch[2];+ const buffer = decodeBase64(base64data);++ const title = html2plaintext(attachmentMatch[3]);++ const attachment = note.saveAttachment({+ role: "file",+ mime,+ title,+ content: buffer+ });++ content = `${content.substring(0, attachmentMatch.index)}<a class="reference-link" href="#root/${note.noteId}?viewMode=attachments&attachmentId=${attachment.attachmentId}">${title}</a>${content.substring(attachmentMatch.index + attachmentMatch[0].length)}`;+ }++ // removing absolute references to server to keep it working between instances,+ // we also omit / at the beginning to keep the paths relative+ content = content.replace(/src="[^"]*\/api\/attachments\//g, 'src="api/attachments/');++ return content;+}++function saveLinks(note: BNote, content: string | Uint8Array) {+ if ((note.type !== "text" && note.type !== "relationMap") || (note.isProtected && !protectedSessionService.isProtectedSessionAvailable())) {+ return {+ forceFrontendReload: false,+ content+ };+ }++ const foundLinks: FoundLink[] = [];+ let forceFrontendReload = false;++ if (note.type === "text" && typeof content === "string") {+ content = downloadImages(note.noteId, content);+ content = saveAttachments(note, content);++ content = findImageLinks(content, foundLinks);+ content = findInternalLinks(content, foundLinks);+ content = findIncludeNoteLinks(content, foundLinks);++ ({ forceFrontendReload, content } = checkImageAttachments(note, content));+ } else if (note.type === "relationMap" && typeof content === "string") {+ findRelationMapLinks(content, foundLinks);+ } else {+ throw new Error(`Unrecognized type '${note.type}'`);+ }++ const existingLinks = note.getRelations().filter((rel) => ["internalLink", "imageLink", "relationMapLink", "includeNoteLink"].includes(rel.name));++ for (const foundLink of foundLinks) {+ const targetNote = becca.notes[foundLink.value];+ if (!targetNote) {+ continue;+ }++ const existingLink = existingLinks.find((existingLink) => existingLink.value === foundLink.value && existingLink.name === foundLink.name);++ if (!existingLink) {+ const newLink = new BAttribute({+ noteId: note.noteId,+ type: "relation",+ name: foundLink.name,+ value: foundLink.value+ }).save();++ existingLinks.push(newLink);+ }+ // else the link exists, so we don't need to do anything+ }++ // marking links as deleted if they are not present on the page anymore+ const unusedLinks = existingLinks.filter((existingLink) => !foundLinks.some((foundLink) => existingLink.value === foundLink.value && existingLink.name === foundLink.name));++ for (const unusedLink of unusedLinks) {+ unusedLink.markAsDeleted();+ }++ return { forceFrontendReload, content };+}++function saveRevisionIfNeeded(note: BNote) {+ // files and images are versioned separately+ if (note.type === "file" || note.type === "image" || note.isLabelTruthy("disableVersioning")) {+ return;+ }++ const now = new Date();+ const revisionSnapshotTimeInterval = parseInt(optionService.getOption("revisionSnapshotTimeInterval"));++ const revisionCutoff = date_utils.utcDateTimeStr(new Date(now.getTime() - revisionSnapshotTimeInterval * 1000));++ const existingRevisionId = getSql().getValue("SELECT revisionId FROM revisions WHERE noteId = ? AND utcDateCreated >= ?", [note.noteId, revisionCutoff]);++ const msSinceDateCreated = now.getTime() - date_utils.parseDateTime(note.utcDateCreated).getTime();++ if (!existingRevisionId && msSinceDateCreated >= revisionSnapshotTimeInterval * 1000) {+ note.saveRevision();+ }+}++function updateNoteData(noteId: string, content: string, attachments: AttachmentRow[] = []) {+ const note = becca.getNote(noteId);++ if (!note || !note.isContentAvailable()) {+ throw new Error(`Note '${noteId}' is not available for change!`);+ }++ saveRevisionIfNeeded(note);++ const { forceFrontendReload, content: newContent } = saveLinks(note, content);++ note.setContent(newContent, { forceFrontendReload });++ if (attachments?.length > 0) {+ const existingAttachmentsByTitle = toMap(note.getAttachments(), "title");+- for (const { attachmentId, role, mime, title, position, content } of attachments) {++ for (const { attachmentId, role, mime, title, position, content, encoding } of attachments) {++ const decodedContent = encoding === "base64" && typeof content === "string"++ ? decodeBase64(content) : content;+++ const existingAttachment = existingAttachmentsByTitle.get(title);+ if (attachmentId || !existingAttachment) {- note.saveAttachment({ attachmentId, role, mime, title, content, position });++ note.saveAttachment({ attachmentId, role, mime, title, content: decodedContent, position });+ } else {+ existingAttachment.role = role;+ existingAttachment.mime = mime;+ existingAttachment.position = position;- if (content) {- existingAttachment.setContent(content, { forceSave: true });++ if (decodedContent) {++ existingAttachment.setContent(decodedContent, { forceSave: true });+ }+ }+ }+ }+}++function undeleteNote(noteId: string, taskContext: TaskContext<"undeleteNotes">) {+ const noteRow = getSql().getRow<NoteRow>("SELECT * FROM notes WHERE noteId = ?", [noteId]);++ if (!noteRow.isDeleted || !noteRow.deleteId) {+ getLog().error(`Note '${noteId}' is not deleted and thus cannot be undeleted.`);+ return;+ }++ const undeletedParentBranchIds = getUndeletedParentBranchIds(noteId, noteRow.deleteId);++ if (undeletedParentBranchIds.length === 0) {+ // cannot undelete if there's no undeleted parent+ return;+ }++ for (const parentBranchId of undeletedParentBranchIds) {+ undeleteBranch(parentBranchId, noteRow.deleteId, taskContext);+ }+}++function undeleteBranch(branchId: string, deleteId: string, taskContext: TaskContext<"undeleteNotes">) {+ const sql = getSql();+ const branchRow = sql.getRow<BranchRow>("SELECT * FROM branches WHERE branchId = ?", [branchId]);++ if (!branchRow.isDeleted) {+ return;+ }++ const noteRow = sql.getRow<NoteRow>("SELECT * FROM notes WHERE noteId = ?", [branchRow.noteId]);++ if (noteRow.isDeleted && noteRow.deleteId !== deleteId) {+ return;+ }++ new BBranch(branchRow).save();++ taskContext.increaseProgressCount();++ if (noteRow.isDeleted && noteRow.deleteId === deleteId) {+ // becca entity was already created as skeleton in "new Branch()" above+ const noteEntity = becca.getNote(noteRow.noteId);+ if (!noteEntity) {+ throw new Error("Unable to find the just restored branch.");+ }++ noteEntity.updateFromRow(noteRow);+ noteEntity.save();++ const attributeRows = sql.getRows<AttributeRow>(+ `+ SELECT * FROM attributes+ WHERE isDeleted = 1+ AND deleteId = ?+ AND (noteId = ?+ OR (type = 'relation' AND value = ?))`,+ [deleteId, noteRow.noteId, noteRow.noteId]+ );++ for (const attributeRow of attributeRows) {+ // relation might point to a note which hasn't been undeleted yet and would thus throw up+ new BAttribute(attributeRow).save({ skipValidation: true });+ }++ const attachmentRows = sql.getRows<AttachmentRow>(+ `+ SELECT * FROM attachments+ WHERE isDeleted = 1+ AND deleteId = ?+ AND ownerId = ?`,+ [deleteId, noteRow.noteId]+ );++ for (const attachmentRow of attachmentRows) {+ new BAttachment(attachmentRow).save();+ }++ const childBranchIds = sql.getColumn<string>(+ `+ SELECT branches.branchId+ FROM branches+ WHERE branches.isDeleted = 1+ AND branches.deleteId = ?+ AND branches.parentNoteId = ?`,+ [deleteId, noteRow.noteId]+ );++ for (const childBranchId of childBranchIds) {+ undeleteBranch(childBranchId, deleteId, taskContext);+ }+ }+}++/**+ * @returns return deleted branchIds of an undeleted parent note+ */+function getUndeletedParentBranchIds(noteId: string, deleteId: string) {+ return getSql().getColumn<string>(+ `+ SELECT branches.branchId+ FROM branches+ JOIN notes AS parentNote ON parentNote.noteId = branches.parentNoteId+ WHERE branches.noteId = ?+ AND branches.isDeleted = 1+ AND branches.deleteId = ?+ AND parentNote.isDeleted = 0`,+ [noteId, deleteId]+ );+}++function scanForLinks(note: BNote, content: string | Uint8Array) {+ if (!note || !["text", "relationMap"].includes(note.type)) {+ return;+ }++ try {+ getSql().transactional(() => {+ const { forceFrontendReload, content: newContent } = saveLinks(note, content);++ if (content !== newContent) {+ note.setContent(newContent, { forceFrontendReload });+ }+ });+ } catch (e: any) {+ getLog().error(`Could not scan for links note '${note.noteId}': ${e.message} ${e.stack}`);+ }+}++/**+ * Things which have to be executed after updating content, but asynchronously (separate transaction)+ */+async function asyncPostProcessContent(note: BNote, content: string | Uint8Array) {+ if (cls.isMigrationRunning()) {+ // this is rarely needed for migrations, but can cause trouble by e.g. triggering downloads+ return;+ }++ if (note.hasStringContent() && typeof content !== "string") {+ content = content.toString();+ }++ scanForLinks(note, content);+}++// all keys should be replaced by the corresponding values+function replaceByMap(str: string, mapObj: Record<string, string>) {+ if (!mapObj) {+ return str;+ }++ const re = new RegExp(Object.keys(mapObj).join("|"), "g");++ return str.replace(re, (matched) => mapObj[matched]);+}++function duplicateSubtree(origNoteId: string, newParentNoteId: string) {+ if (origNoteId === "root") {+ throw new Error("Duplicating root is not possible");+ }++ getLog().info(`Duplicating '${origNoteId}' subtree into '${newParentNoteId}'`);++ const origNote = becca.notes[origNoteId];+ // might be null if orig note is not in the target newParentNoteId+ const origBranch = origNote.getParentBranches().find((branch) => branch.parentNoteId === newParentNoteId);++ const noteIdMapping = getNoteIdMapping(origNote);++ const res = duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMapping);++ const duplicateNoteSuffix = t("notes.duplicate-note-suffix");++ if (!res.note.title.endsWith(duplicateNoteSuffix) && !res.note.title.startsWith(duplicateNoteSuffix)) {+ res.note.title = t("notes.duplicate-note-title", { noteTitle: res.note.title, duplicateNoteSuffix });+ }++ res.note.save();++ return res;+}++function duplicateSubtreeWithoutRoot(origNoteId: string, newNoteId: string) {+ if (origNoteId === "root") {+ throw new Error("Duplicating root is not possible");+ }++ const origNote = becca.getNote(origNoteId);+ if (origNote == null) {+ throw new Error("Unable to find note to duplicate.");+ }++ const noteIdMapping = getNoteIdMapping(origNote);+ for (const childBranch of origNote.getChildBranches()) {+ if (childBranch) {+ duplicateSubtreeInner(childBranch.getNote(), childBranch, newNoteId, noteIdMapping);+ }+ }+}++function duplicateSubtreeInner(origNote: BNote, origBranch: BBranch | null | undefined, newParentNoteId: string, noteIdMapping: Record<string, string>) {+ if (origNote.isProtected && !protectedSessionService.isProtectedSessionAvailable()) {+ throw new Error(`Cannot duplicate note '${origNote.noteId}' because it is protected and protected session is not available. Enter protected session and try again.`);+ }++ const newNoteId = noteIdMapping[origNote.noteId];++ function createDuplicatedBranch() {+ return new BBranch({+ noteId: newNoteId,+ parentNoteId: newParentNoteId,+ // here increasing just by 1 to make sure it's directly after original+ notePosition: origBranch ? origBranch.notePosition + 1 : null+ }).save();+ }++ function createDuplicatedNote() {+ const newNote = new BNote({+ ...origNote,+ noteId: newNoteId,+ dateCreated: date_utils.localNowDateTime(),+ utcDateCreated: date_utils.utcNowDateTime()+ }).save();++ let content = origNote.getContent();++ if (typeof content === "string" && ["text", "relationMap", "search"].includes(origNote.type)) {+ // fix links in the content+ content = replaceByMap(content, noteIdMapping);+ }++ newNote.setContent(content);++ for (const attribute of origNote.getOwnedAttributes()) {+ const attr = new BAttribute({+ ...attribute,+ attributeId: undefined,+ noteId: newNote.noteId+ });++ // if relation points to within the duplicated tree then replace the target to the duplicated note+ // if it points outside of duplicated tree then keep the original target+ if (attr.type === "relation" && attr.value in noteIdMapping) {+ attr.value = noteIdMapping[attr.value];+ }++ // the relation targets may not be created yet, the mapping is pre-generated+ attr.save({ skipValidation: true });+ }++ for (const childBranch of origNote.getChildBranches()) {+ if (childBranch) {+ duplicateSubtreeInner(childBranch.getNote(), childBranch, newNote.noteId, noteIdMapping);+ }+ }++ asyncPostProcessContent(newNote, content);++ return newNote;+ }++ const existingNote = becca.notes[newNoteId];++ if (existingNote && existingNote.title !== undefined) {+ // checking that it's not just note's skeleton created because of Branch above+ // note has multiple clones and was already created from another placement in the tree,+ // so a branch is all we need for this clone+ return {+ note: existingNote,+ branch: createDuplicatedBranch()+ };+ }+ return {+ // order here is important, note needs to be created first to not mess up the becca+ note: createDuplicatedNote(),+ branch: createDuplicatedBranch()+ };++}++function getNoteIdMapping(origNote: BNote) {+ const noteIdMapping: Record<string, string> = {};++ // pregenerate new noteIds since we'll need to fix relation references even for not yet created notes+ for (const origNoteId of origNote.getDescendantNoteIds()) {+ noteIdMapping[origNoteId] = newEntityId();+ }++ return noteIdMapping;+}++export default {+ createNewNote,+ createNewNoteWithTarget,+ updateNoteData,+ undeleteNote,+ protectNoteRecursively,+ duplicateSubtree,+ duplicateSubtreeWithoutRoot,+ getUndeletedParentBranchIds,+ triggerNoteTitleChanged,+ saveRevisionIfNeeded,+ downloadImages,+ asyncPostProcessContent+};diff --cc packages/trilium-core/src/services/options.tsindex a2ff346ea9,0000000000..fdfe111d95mode 100644,000000..100644--- a/packages/trilium-core/src/services/options.ts+++ b/packages/trilium-core/src/services/options.ts@@@ -1,146 -1,0 +1,126 @@@+/**+ * @module+ *+ * Options are key-value pairs that are used to store information such as user preferences (for example+ * the current theme, sync server information), but also information about the state of the application.+ *+ * Although options internally are represented as strings, their value can be interpreted as a number or+ * boolean by calling the appropriate methods from this service (e.g. {@link #getOptionInt}).\+ *+ * Generally options are shared across multiple instances of the application via the sync mechanism,+ * however it is possible to have options that are local to an instance. For example, the user can select+ * a theme on a device and it will not affect other devices.+ */++import becca from "../becca/becca.js";+import BOption from "../becca/entities/boption.js";+import type { OptionRow } from "@triliumnext/commons";+import type { FilterOptionsByType, OptionDefinitions, OptionMap, OptionNames } from "@triliumnext/commons";+import { getSql } from "./sql/index.js";++function getOptionOrNull(name: OptionNames): string | null {+ let option;++ if (becca.loaded) {+ option = becca.getOption(name);+ } else {+ // e.g. in initial sync becca is not loaded because DB is not initialized+ try {+ option = getSql().getRow<OptionRow>("SELECT * FROM options WHERE name = ?", [name]);+ } catch (e: unknown) {+ // DB is not initialized.+ return null;+ }+ }++ return option ? option.value : null;+}++function getOption(name: OptionNames) {+ const val = getOptionOrNull(name);++ if (val === null) {+ throw new Error(`Option '${name}' doesn't exist`);+ }++ return val;+}++function getOptionInt(name: FilterOptionsByType<number>, defaultValue?: number): number {+ const val = getOption(name);++ const intVal = parseInt(val);++ if (isNaN(intVal)) {+ if (defaultValue === undefined) {+ throw new Error(`Could not parse '${val}' into integer for option '${name}'`);+ } else {+ return defaultValue;+ }+ }++ return intVal;+}++function getOptionBool(name: FilterOptionsByType<boolean>): boolean {+ const val = getOption(name);++ if (typeof val !== "string" || !["true", "false"].includes(val)) {+ throw new Error(`Could not parse '${val}' into boolean for option '${name}'`);+ }++ return val === "true";+}++function setOption<T extends OptionNames>(name: T, value: string | OptionDefinitions[T]) {+ const option = becca.getOption(name);++ if (option) {+ option.value = value as string;++ option.save();+ } else {+ createOption(name, value, false);+ }+- // Clear current AI provider when AI-related options change- const aiOptions = [- 'aiSelectedProvider', 'openaiApiKey', 'openaiBaseUrl', 'openaiDefaultModel',- 'anthropicApiKey', 'anthropicBaseUrl', 'anthropicDefaultModel',- 'ollamaBaseUrl', 'ollamaDefaultModel'- ];-- // TODO: Disabled AI integration.- // if (aiOptions.includes(name)) {- // // Import dynamically to avoid circular dependencies- // setImmediate(async () => {- // try {- // const aiServiceManager = (await import('./llm/ai_service_manager.js')).default;- // aiServiceManager.getInstance().clearCurrentProvider();- // console.log(`Cleared AI provider after ${name} option changed`);- // } catch (error) {- // console.log(`Could not clear AI provider: ${error}`);- // }- // });- // }+}++/**+ * Creates a new option in the database, with the given name, value and whether it should be synced.+ *+ * @param name the name of the option to be created.+ * @param value the value of the option, as a string. It can then be interpreted as other types such as a number of boolean.+ * @param isSynced `true` if the value should be synced across multiple instances (e.g. locale) or `false` if it should be local-only (e.g. theme).+ */+function createOption<T extends OptionNames>(name: T, value: string | OptionDefinitions[T], isSynced: boolean) {+ new BOption({+ name: name,+ value: value as string,+ isSynced: isSynced+ }).save();+}++function getOptions() {+ return Object.values(becca.options);+}++function getOptionMap() {+ const map: Record<string, string> = {};++ for (const option of Object.values(becca.options)) {+ map[option.name] = option.value;+ }++ return map as OptionMap;+}++export default {+ getOption,+ getOptionInt,+ getOptionBool,+ setOption,+ createOption,+ getOptions,+ getOptionMap,+ getOptionOrNull+};diff --cc packages/trilium-core/src/services/options_init.tsindex 3e605711d8,0000000000..d2cafe0e6amode 100644,000000..100644--- a/packages/trilium-core/src/services/options_init.ts+++ b/packages/trilium-core/src/services/options_init.ts@@@ -1,281 -1,0 +1,265 @@@+import { type KeyboardShortcutWithRequiredActionName, type OptionMap, type OptionNames, SANITIZER_DEFAULT_ALLOWED_TAGS } from "@triliumnext/commons";++import appInfo from "./app_info.js";+import dateUtils from "./utils/date.js";+import keyboardActions from "./keyboard_actions.js";+import { getLog } from "./log.js";+import optionService from "./options.js";+import { isWindows, randomSecureToken } from "./utils/index.js";++function initDocumentOptions() {+ optionService.createOption("documentId", randomSecureToken(16), false);+ optionService.createOption("documentSecret", randomSecureToken(16), false);+}++/**+ * Contains additional options to be initialized for a new database, containing the information entered by the user.+ */+interface NotSyncedOpts {+ syncServerHost?: string;+ syncProxy?: string;+}++/**+ * Represents a correspondence between an option and its default value, to be initialized when the database is missing that particular option (after a migration from an older version, or when creating a new database).+ */+interface DefaultOption {+ name: OptionNames;+ /**+ * The value to initialize the option with, if the option is not already present in the database.+ *- * If a function is passed in instead, the function is called if the option does not exist (with access to the current options) and the return value is used instead. Useful to migrate a new option with a value depending on some other option that might be initialized.++ * If a function is passed Gin instead, the function is called if the option does not exist (with access to the current options) and the return value is used instead. Useful to migrate a new option with a value depending on some other option that might be initialized.+ */+ value: string | ((options: OptionMap) => string);+ isSynced: boolean;+}++/**+ * Initializes the default options for new databases only.+ *+ * @param initialized `true` if the database has been fully initialized (i.e. a new database was created), or `false` if the database is created for sync.+ * @param opts additional options to be initialized, for example the sync configuration.+ */+async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts = {}) {+ optionService.createOption(+ "openNoteContexts",+ JSON.stringify([+ {+ notePath: "root",+ active: true+ }+ ]),+ false+ );++ optionService.createOption("lastDailyBackupDate", dateUtils.utcNowDateTime(), false);+ optionService.createOption("lastWeeklyBackupDate", dateUtils.utcNowDateTime(), false);+ optionService.createOption("lastMonthlyBackupDate", dateUtils.utcNowDateTime(), false);+ optionService.createOption("dbVersion", appInfo.dbVersion.toString(), false);++ optionService.createOption("initialized", initialized ? "true" : "false", false);++ optionService.createOption("lastSyncedPull", "0", false);+ optionService.createOption("lastSyncedPush", "0", false);++ optionService.createOption("theme", "next", false);+ optionService.createOption("textNoteEditorType", "ckeditor-classic", true);++ optionService.createOption("syncServerHost", opts.syncServerHost || "", false);+ optionService.createOption("syncServerTimeout", "120000", false);+ optionService.createOption("syncProxy", opts.syncProxy || "", false);+}++/**+ * Contains all the default options that must be initialized on new and existing databases (at startup). The value can also be determined based on other options, provided they have already been initialized.+ */+const defaultOptions: DefaultOption[] = [+ { name: "revisionSnapshotTimeInterval", value: "600", isSynced: true },+ { name: "revisionSnapshotTimeIntervalTimeScale", value: "60", isSynced: true }, // default to Minutes+ { name: "revisionSnapshotNumberLimit", value: "-1", isSynced: true },+ { name: "protectedSessionTimeout", value: "600", isSynced: true },+ { name: "protectedSessionTimeoutTimeScale", value: "60", isSynced: true },+ { name: "zoomFactor", value: isWindows ? "0.9" : "1.0", isSynced: false },+ { name: "overrideThemeFonts", value: "false", isSynced: false },+ { name: "mainFontFamily", value: "theme", isSynced: false },+ { name: "mainFontSize", value: "100", isSynced: false },+ { name: "treeFontFamily", value: "theme", isSynced: false },+ { name: "treeFontSize", value: "100", isSynced: false },+ { name: "detailFontFamily", value: "theme", isSynced: false },+ { name: "detailFontSize", value: "110", isSynced: false },+ { name: "monospaceFontFamily", value: "theme", isSynced: false },+ { name: "monospaceFontSize", value: "110", isSynced: false },+ { name: "spellCheckEnabled", value: "true", isSynced: false },+ { name: "spellCheckLanguageCode", value: "en-US", isSynced: false },+ { name: "imageMaxWidthHeight", value: "2000", isSynced: true },+ { name: "imageJpegQuality", value: "75", isSynced: true },+ { name: "autoFixConsistencyIssues", value: "true", isSynced: false },+ { name: "vimKeymapEnabled", value: "false", isSynced: false },+ { name: "codeLineWrapEnabled", value: "true", isSynced: false },+ {+ name: "codeNotesMimeTypes",+ value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-elixir","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-sqlite;schema=trilium","text/x-swift","text/xml","text/x-yaml","text/x-sh","application/typescript"]',+ isSynced: true+ },+ { name: "leftPaneWidth", value: "25", isSynced: false },+ { name: "leftPaneVisible", value: "true", isSynced: false },+ { name: "rightPaneWidth", value: "25", isSynced: false },+ { name: "rightPaneVisible", value: "true", isSynced: false },+ { name: "rightPaneCollapsedItems", value: "[]", isSynced: false },+ { name: "nativeTitleBarVisible", value: "false", isSynced: false },+ { name: "eraseEntitiesAfterTimeInSeconds", value: "604800", isSynced: true }, // default is 7 days+ { name: "eraseEntitiesAfterTimeScale", value: "86400", isSynced: true }, // default 86400 seconds = Day+ { name: "hideArchivedNotes_main", value: "false", isSynced: false },+ { name: "debugModeEnabled", value: "false", isSynced: false },+ { name: "headingStyle", value: "underline", isSynced: true },+ { name: "autoCollapseNoteTree", value: "true", isSynced: true },+ { name: "autoReadonlySizeText", value: "32000", isSynced: false },+ { name: "autoReadonlySizeCode", value: "64000", isSynced: false },+ { name: "dailyBackupEnabled", value: "true", isSynced: false },+ { name: "weeklyBackupEnabled", value: "true", isSynced: false },+ { name: "monthlyBackupEnabled", value: "true", isSynced: false },+ { name: "maxContentWidth", value: "1200", isSynced: false },+ { name: "centerContent", value: "false", isSynced: false },+ { name: "compressImages", value: "true", isSynced: true },+ { name: "downloadImagesAutomatically", value: "true", isSynced: true },+ { name: "minTocHeadings", value: "5", isSynced: true },+ { name: "highlightsList", value: '["underline","color","bgColor"]', isSynced: true },+ { name: "checkForUpdates", value: "true", isSynced: true },+ { name: "disableTray", value: "false", isSynced: false },+ { name: "eraseUnusedAttachmentsAfterSeconds", value: "2592000", isSynced: true }, // default 30 days+ { name: "eraseUnusedAttachmentsAfterTimeScale", value: "86400", isSynced: true }, // default 86400 seconds = Day+ { name: "logRetentionDays", value: "90", isSynced: false }, // default 90 days+ { name: "customSearchEngineName", value: "DuckDuckGo", isSynced: true },+ { name: "customSearchEngineUrl", value: "https://duckduckgo.com/?q={keyword}", isSynced: true },+ { name: "editedNotesOpenInRibbon", value: "true", isSynced: true },+ { name: "mfaEnabled", value: "false", isSynced: false },+ { name: "mfaMethod", value: "totp", isSynced: false },+ { name: "encryptedRecoveryCodes", value: "false", isSynced: false },+ { name: "userSubjectIdentifierSaved", value: "false", isSynced: false },++ // Appearance+ { name: "splitEditorOrientation", value: "horizontal", isSynced: true },+ {+ name: "codeNoteTheme",+ value: (optionsMap) => {+ switch (optionsMap.theme) {+ case "light":+ case "next-light":+ return "default:vs-code-light";+ case "dark":+ case "next-dark":+ default:+ return "default:vs-code-dark";+ }+ },+ isSynced: false+ },+ { name: "motionEnabled", value: "true", isSynced: false },+ { name: "shadowsEnabled", value: "true", isSynced: false },+ { name: "backdropEffectsEnabled", value: "true", isSynced: false },+ { name: "smoothScrollEnabled", value: "true", isSynced: false },+ { name: "newLayout", value: "true", isSynced: true },++ // Internationalization+ { name: "locale", value: "en", isSynced: true },+ { name: "formattingLocale", value: "", isSynced: true }, // no value means auto-detect+ { name: "firstDayOfWeek", value: "1", isSynced: true },+ { name: "firstWeekOfYear", value: "0", isSynced: true },+ { name: "minDaysInFirstWeek", value: "4", isSynced: true },+ { name: "languages", value: "[]", isSynced: true },++ // Code block configuration+ {+ name: "codeBlockTheme",+ value: (optionsMap) => {+ if (optionsMap.theme === "light") {+ return "default:stackoverflow-light";+ }+ return "default:stackoverflow-dark";++ },+ isSynced: false+ },+ { name: "codeBlockWordWrap", value: "false", isSynced: true },++ // Text note configuration+ { name: "textNoteEditorType", value: "ckeditor-balloon", isSynced: true },+ { name: "textNoteEditorMultilineToolbar", value: "false", isSynced: true },+ { name: "textNoteEmojiCompletionEnabled", value: "true", isSynced: true },+ { name: "textNoteCompletionEnabled", value: "true", isSynced: true },+ { name: "textNoteSlashCommandsEnabled", value: "true", isSynced: true },++ // HTML import configuration+ { name: "layoutOrientation", value: "vertical", isSynced: false },+ { name: "backgroundEffects", value: "true", isSynced: false },+ {+ name: "allowedHtmlTags",+ value: JSON.stringify(SANITIZER_DEFAULT_ALLOWED_TAGS),+ isSynced: true+ },++ // Share settings+ { name: "redirectBareDomain", value: "false", isSynced: true },+ { name: "showLoginInShareTheme", value: "false", isSynced: true },+- // AI Options- { name: "aiEnabled", value: "false", isSynced: true },- { name: "openaiApiKey", value: "", isSynced: false },- { name: "openaiDefaultModel", value: "", isSynced: true },- { name: "openaiBaseUrl", value: "https://api.openai.com/v1", isSynced: true },- { name: "anthropicApiKey", value: "", isSynced: false },- { name: "anthropicDefaultModel", value: "", isSynced: true },- { name: "voyageApiKey", value: "", isSynced: false },- { name: "anthropicBaseUrl", value: "https://api.anthropic.com/v1", isSynced: true },- { name: "ollamaEnabled", value: "false", isSynced: true },- { name: "ollamaDefaultModel", value: "", isSynced: true },- { name: "ollamaBaseUrl", value: "http://localhost:11434", isSynced: true },- { name: "aiTemperature", value: "0.7", isSynced: true },- { name: "aiSystemPrompt", value: "", isSynced: true },- { name: "aiSelectedProvider", value: "openai", isSynced: true },-+ {+ name: "seenCallToActions",+ value: JSON.stringify([+ "new_layout", "background_effects", "next_theme"+ ]),+ isSynced: true+ },+ { name: "experimentalFeatures", value: "[]", isSynced: true }+];++/**+ * Initializes the options, by checking which options from {@link #allDefaultOptions()} are missing and registering them. It will also check some environment variables such as safe mode, to make any necessary adjustments.+ *+ * This method is called regardless of whether a new database is created, or an existing database is used.+ */+function initStartupOptions() {+ const optionsMap = optionService.getOptionMap();++ const allDefaultOptions = defaultOptions.concat(getKeyboardDefaultOptions());++ const log = getLog();+ for (const { name, value, isSynced } of allDefaultOptions) {+ if (!(name in optionsMap)) {+ let resolvedValue;+ if (typeof value === "function") {+ resolvedValue = value(optionsMap);+ } else {+ resolvedValue = value;+ }++ optionService.createOption(name, resolvedValue, isSynced);+ log.info(`Created option "${name}" with default value "${resolvedValue}"`);+ }+ }++ if (process.env.TRILIUM_START_NOTE_ID || process.env.TRILIUM_SAFE_MODE) {+ optionService.setOption(+ "openNoteContexts",+ JSON.stringify([+ {+ notePath: process.env.TRILIUM_START_NOTE_ID || "root",+ active: true+ }+ ])+ );+ }+}++function getKeyboardDefaultOptions() {+ return (keyboardActions.getDefaultKeyboardActions().filter((ka) => "actionName" in ka) as KeyboardShortcutWithRequiredActionName[]).map((ka) => ({+ name: `keyboardShortcuts${ka.actionName.charAt(0).toUpperCase()}${ka.actionName.slice(1)}`,+ value: JSON.stringify(ka.defaultShortcuts),+ isSynced: false+ })) as DefaultOption[];+}++export default {+ initDocumentOptions,+ initNotSyncedOptions,+ initStartupOptions+};diff --cc packages/trilium-core/src/services/promoted_attribute_definition_parser.tsindex bc9c66bbc0,9d94be5eda..85febb6bbf--- a/packages/trilium-core/src/services/promoted_attribute_definition_parser.ts+++ b/packages/trilium-core/src/services/promoted_attribute_definition_parser.ts@@@ -7,10 -7,10 +7,10 @@@ function parse(value: string): Definitifor (const token of tokens) {if (token === "promoted") {defObj.isPromoted = true;- } else if (["text", "number", "boolean", "date", "datetime", "time", "url"].includes(token)) {+ } else if (["text", "textarea", "number", "boolean", "date", "datetime", "time", "url"].includes(token)) {- defObj.labelType = token;+ defObj.labelType = token as LabelType;} else if (["single", "multi"].includes(token)) {- defObj.multiplicity = token;+ defObj.multiplicity = token as Multiplicity;} else if (token.startsWith("precision")) {const chunks = token.split("=");diff --cc packages/trilium-core/src/services/tree.tsindex 403e26a6ab,0000000000..50e52cd212mode 100644,000000..100644--- a/packages/trilium-core/src/services/tree.ts+++ b/packages/trilium-core/src/services/tree.ts@@@ -1,282 -1,0 +1,282 @@@+"use strict";++import { getLog } from "./log.js";+import BBranch from "../becca/entities/bbranch.js";+import entityChangesService from "./entity_changes.js";+import becca from "../becca/becca.js";+import type BNote from "../becca/entities/bnote.js";+import { getSql } from "./sql/index.js";++export interface ValidationResponse {+ branch: BBranch | null;+ success: boolean;+ message?: string;+}++function validateParentChild(parentNoteId: string, childNoteId: string, branchId: string | null = null): ValidationResponse {+ if (["root", "_hidden", "_share", "_lbRoot", "_lbAvailableLaunchers", "_lbVisibleLaunchers"].includes(childNoteId)) {+ return { branch: null, success: false, message: `Cannot change this note's location.` };+ }++ if (parentNoteId === "none") {+ // this shouldn't happen+ return { branch: null, success: false, message: `Cannot move anything into 'none' parent.` };+ }++ const existingBranch = becca.getBranchFromChildAndParent(childNoteId, parentNoteId);++ if (existingBranch && existingBranch.branchId !== branchId) {+ const parentNote = becca.getNote(parentNoteId);+ const childNote = becca.getNote(childNoteId);++ return {+ branch: existingBranch,+ success: false,+ message: `Note "${childNote?.title}" note already exists in the "${parentNote?.title}".`+ };+ }++ if (wouldAddingBranchCreateCycle(parentNoteId, childNoteId)) {+ return {+ branch: null,+ success: false,+ message: "Moving/cloning note here would create cycle."+ };+ }++ if (parentNoteId !== "_lbBookmarks" && becca.getNote(parentNoteId)?.type === "launcher") {+ return {+ branch: null,+ success: false,+ message: "Launcher note cannot have any children."+ };+ }++ return { branch: null, success: true };+}++/**+ * Tree cycle can be created when cloning or when moving existing clone. This method should detect both cases.+ */+function wouldAddingBranchCreateCycle(parentNoteId: string, childNoteId: string) {+ if (parentNoteId === childNoteId) {+ return true;+ }++ const childNote = becca.getNote(childNoteId);+ const parentNote = becca.getNote(parentNoteId);++ if (!childNote || !parentNote) {+ return false;+ }++ // we'll load the whole subtree - because the cycle can start in one of the notes in the subtree+ const childSubtreeNoteIds = new Set(childNote.getSubtreeNoteIds());+ const parentAncestorNoteIds = parentNote.getAncestorNoteIds();++ return parentAncestorNoteIds.some((parentAncestorNoteId) => childSubtreeNoteIds.has(parentAncestorNoteId));+}++function sortNotes(parentNoteId: string, customSortBy: string = "title", reverse = false, foldersFirst = false, sortNatural = false, _sortLocale?: string | null) {+ if (!customSortBy) {+ customSortBy = "title";+ }++ // sortLocale can not be empty string or null value, default value must be set to undefined.+ const sortLocale = _sortLocale || undefined;++ const sql = getSql();+ sql.transactional(() => {+ const note = becca.getNote(parentNoteId);+ if (!note) {+ throw new Error("Unable to find note");+ }++ const notes = note.getChildNotes();++ function normalize<T>(obj: T | string) {+ return obj && typeof obj === "string" ? obj.toLowerCase() : obj;+ }++ notes.sort((a, b) => {++ function fetchValue(note: BNote, key: string) {+ let rawValue: string | null;++ if (key === "title") {+ const branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);+ const prefix = branch?.prefix;+ rawValue = prefix ? `${prefix} - ${note.title}` : note.title;+ } else {+ rawValue = ["dateCreated", "dateModified"].includes(key) ? (note as any)[key] : note.getLabelValue(key);+ }++ return normalize(rawValue);+ }++ function compare(a: string, b: string) {+ if (!sortNatural) {+ // alphabetical sort+ return b === null || b === undefined || a < b ? -1 : 1;+ } else {+ // natural sort+ return a.localeCompare(b, sortLocale, { numeric: true, sensitivity: "base" });+ }+ }++ const topAEl = fetchValue(a, "top");+ const topBEl = fetchValue(b, "top");++ if (topAEl !== topBEl) {+ if (topAEl === null) return reverse ? -1 : 1;+ if (topBEl === null) return reverse ? 1 : -1;++ // since "top" should not be reversible, we'll reverse it once more to nullify this effect+ return compare(topAEl, topBEl) * (reverse ? -1 : 1);+ }++ const bottomAEl = fetchValue(a, "bottom");+ const bottomBEl = fetchValue(b, "bottom");++ if (bottomAEl !== bottomBEl) {+ if (bottomAEl === null) return reverse ? 1 : -1;+ if (bottomBEl === null) return reverse ? -1 : 1;++ // since "bottom" should not be reversible, we'll reverse it once more to nullify this effect+ return compare(bottomBEl, bottomAEl) * (reverse ? -1 : 1);+ }++ if (foldersFirst) {+ const aHasChildren = a.hasChildren();+ const bHasChildren = b.hasChildren();++ if ((aHasChildren && !bHasChildren) || (!aHasChildren && bHasChildren)) {+ // exactly one note of the two is a directory, so the sorting will be done based on this status+ return aHasChildren ? -1 : 1;+ }+ }++ const customAEl = fetchValue(a, customSortBy) ?? fetchValue(a, "title") as string;+ const customBEl = fetchValue(b, customSortBy) ?? fetchValue(b, "title") as string;++ if (customAEl !== customBEl) {+ return compare(customAEl, customBEl);+ }++ const titleAEl = fetchValue(a, "title") as string;+ const titleBEl = fetchValue(b, "title") as string;++ return compare(titleAEl, titleBEl);+ });++ if (reverse) {+ notes.reverse();+ }++ let position = 10;+ let someBranchUpdated = false;++ for (const note of notes) {+ const branch = note.getParentBranches().find((b) => b.parentNoteId === parentNoteId);+ if (!branch) {+ continue;+ }++ if (branch.noteId === "_hidden") {+ position = 999_999_999;+ }++ if (branch.notePosition !== position) {+ sql.execute("UPDATE branches SET notePosition = ? WHERE branchId = ?", [position, branch.branchId]);++ branch.notePosition = position;+ someBranchUpdated = true;+ }++ position += 10;+ }++ if (someBranchUpdated) {+ entityChangesService.putNoteReorderingEntityChange(parentNoteId);+ }+ });+}++function sortNotesIfNeeded(parentNoteId: string) {+ const parentNote = becca.getNote(parentNoteId);+ if (!parentNote) {+ return;+ }++ const sortedLabel = parentNote.getLabel("sorted");++ if (!sortedLabel || sortedLabel.value === "off") {+ return;+ }++ const sortReversed = parentNote.getLabelValue("sortDirection")?.toLowerCase() === "desc";+ const sortFoldersFirst = parentNote.isLabelTruthy("sortFoldersFirst");+ const sortNatural = parentNote.isLabelTruthy("sortNatural");+ const sortLocale = parentNote.getLabelValue("sortLocale");++ sortNotes(parentNoteId, sortedLabel.value, sortReversed, sortFoldersFirst, sortNatural, sortLocale);+}++/**+ * @deprecated this will be removed in the future+ */+function setNoteToParent(noteId: string, prefix: string, parentNoteId: string) {+ const parentNote = becca.getNote(parentNoteId);++ if (parentNoteId && !parentNote) {+ // null parentNoteId is a valid value+ throw new Error(`Cannot move note to deleted / missing parent note '${parentNoteId}'`);+ }++ // case where there might be more such branches is ignored. It's expected there should be just one- const branchId = sql.getValue<string>("SELECT branchId FROM branches WHERE isDeleted = 0 AND noteId = ? AND prefix = ?", [noteId, prefix]);++ const branchId = getSql().getValue<string>("SELECT branchId FROM branches WHERE isDeleted = 0 AND noteId = ? AND prefix = ?", [noteId, prefix]);+ const branch = becca.getBranch(branchId);++ if (branch) {+ if (!parentNoteId) {+ getLog().info(`Removing note '${noteId}' from parent '${parentNoteId}'`);++ branch.markAsDeleted();+ } else {+ const newBranch = branch.createClone(parentNoteId);+ newBranch.save();++ branch.markAsDeleted();+ }+ } else if (parentNoteId) {+ const note = becca.getNote(noteId);+ if (!note) {+ throw new Error(`Cannot find note '${noteId}.`);+ }++ if (note.isDeleted) {+ throw new Error(`Cannot create a branch for '${noteId}' which is deleted.`);+ }+- const branchId = sql.getValue<string>("SELECT branchId FROM branches WHERE isDeleted = 0 AND noteId = ? AND parentNoteId = ?", [noteId, parentNoteId]);++ const branchId = getSql().getValue<string>("SELECT branchId FROM branches WHERE isDeleted = 0 AND noteId = ? AND parentNoteId = ?", [noteId, parentNoteId]);+ const branch = becca.getBranch(branchId);++ if (branch) {+ branch.prefix = prefix;+ branch.save();+ } else {+ new BBranch({+ noteId: noteId,+ parentNoteId: parentNoteId,+ prefix: prefix+ }).save();+ }+ }+}++export default {+ validateParentChild,+ sortNotes,+ sortNotesIfNeeded,+ setNoteToParent+};diff --cc pnpm-lock.yamlindex d1a85c0f99,a423cb2e5d..5daa67ba13--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@@ -370,217 -400,9 +400,217 @@@ importersspecifier: 0.7.2version: 0.7.2vite-plugin-static-copy:- specifier: 3.2.0- version: 3.2.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ specifier: 3.3.0+ version: 3.3.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ apps/client-standalone:+ dependencies:+ '@excalidraw/excalidraw':+ specifier: 0.18.0+ version: 0.18.0(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@fullcalendar/core':+ specifier: 6.1.20+ version: 6.1.20+ '@fullcalendar/daygrid':+ specifier: 6.1.20+ version: 6.1.20(@fullcalendar/[email protected])+ '@fullcalendar/interaction':+ specifier: 6.1.20+ version: 6.1.20(@fullcalendar/[email protected])+ '@fullcalendar/list':+ specifier: 6.1.20+ version: 6.1.20(@fullcalendar/[email protected])+ '@fullcalendar/multimonth':+ specifier: 6.1.20+ version: 6.1.20(@fullcalendar/[email protected])+ '@fullcalendar/timegrid':+ specifier: 6.1.20+ version: 6.1.20(@fullcalendar/[email protected])+ '@maplibre/maplibre-gl-leaflet':+ specifier: 0.1.3+ '@mermaid-js/layout-elk':+ specifier: 0.2.0- version: 0.2.0([email protected])++ version: 0.2.0([email protected])+ '@mind-elixir/node-menu':+ specifier: 5.0.1+ version: 5.0.1([email protected])+ '@popperjs/core':+ specifier: 2.11.8+ version: 2.11.8+ '@preact/signals':+ specifier: 2.5.1- version: 2.5.1([email protected])++ version: 2.5.1([email protected])+ '@sqlite.org/sqlite-wasm':+ specifier: 3.51.1-build2+ version: 3.51.1-build2+ '@triliumnext/ckeditor5':+ specifier: workspace:*+ version: link:../../packages/ckeditor5+ '@triliumnext/codemirror':+ specifier: workspace:*+ version: link:../../packages/codemirror+ '@triliumnext/commons':+ specifier: workspace:*+ version: link:../../packages/commons+ '@triliumnext/core':+ specifier: workspace:*+ version: link:../../packages/trilium-core+ '@triliumnext/highlightjs':+ specifier: workspace:*+ version: link:../../packages/highlightjs+ '@triliumnext/share-theme':+ specifier: workspace:*+ version: link:../../packages/share-theme+ '@triliumnext/split.js':+ specifier: workspace:*+ version: link:../../packages/splitjs+ '@zumer/snapdom':+ specifier: 2.0.1+ version: 2.0.1+ autocomplete.js:+ specifier: 0.38.1+ version: 0.38.1+ bootstrap:+ specifier: 5.3.8+ version: 5.3.8(@popperjs/[email protected])+ boxicons:+ specifier: 2.1.4+ version: 2.1.4+ clsx:+ specifier: 2.1.1+ version: 2.1.1+ color:+ specifier: 5.0.3+ version: 5.0.3+ debounce:+ specifier: 3.0.0+ version: 3.0.0+ draggabilly:+ specifier: 3.0.0+ version: 3.0.0+ force-graph:+ specifier: 1.51.0+ version: 1.51.0+ globals:+ specifier: 17.0.0+ version: 17.0.0+ i18next:+ specifier: 25.7.3+ version: 25.7.3([email protected])+ i18next-http-backend:+ specifier: 3.0.2+ version: 3.0.2([email protected])+ jquery:+ specifier: 3.7.1+ version: 3.7.1+ jquery.fancytree:+ specifier: 2.38.5+ version: 2.38.5([email protected])+ js-sha1:+ specifier: 0.7.0+ version: 0.7.0+ js-sha512:+ specifier: 0.9.0+ version: 0.9.0+ jsplumb:+ specifier: 2.15.6+ version: 2.15.6+ katex:+ specifier: 0.16.27+ version: 0.16.27+ knockout:+ specifier: 3.5.1+ version: 3.5.1+ leaflet:+ specifier: 1.9.4+ version: 1.9.4+ leaflet-gpx:+ specifier: 2.2.0+ version: 2.2.0+ mark.js:+ specifier: 8.11.1+ version: 8.11.1+ marked:+ specifier: 17.0.1+ version: 17.0.1+ mermaid:- specifier: 11.12.2- version: 11.12.2++ specifier: 11.13.0++ version: 11.13.0+ mind-elixir:+ specifier: 5.4.0+ version: 5.4.0+ normalize.css:+ specifier: 8.0.1+ version: 8.0.1+ panzoom:+ specifier: 9.4.3+ version: 9.4.3+ preact:- specifier: 10.28.3- version: 10.28.3++ specifier: 10.29.0++ version: 10.29.0+ react-i18next:+ specifier: 16.5.1+ version: 16.5.1([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected])+ react-window:+ specifier: 2.2.3+ reveal.js:+ specifier: 5.2.1+ version: 5.2.1+ svg-pan-zoom:+ specifier: 3.6.2+ version: 3.6.2+ tabulator-tables:+ specifier: 6.3.1+ version: 6.3.1+ vanilla-js-wheel-zoom:+ specifier: 9.0.4+ version: 9.0.4+ devDependencies:+ '@ckeditor/ckeditor5-inspector':+ specifier: 5.0.0+ version: 5.0.0+ '@preact/preset-vite':+ specifier: 2.10.2- version: 2.10.2(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))++ version: 2.10.2(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ '@types/bootstrap':+ specifier: 5.2.10+ version: 5.2.10+ '@types/jquery':+ specifier: 3.5.33+ version: 3.5.33+ '@types/leaflet':+ specifier: 1.9.21+ version: 1.9.21+ '@types/leaflet-gpx':+ specifier: 1.3.8+ version: 1.3.8+ '@types/mark.js':+ specifier: 8.11.12+ version: 8.11.12+ '@types/reveal.js':+ specifier: 5.2.2+ version: 5.2.2+ '@types/tabulator-tables':+ specifier: 6.3.1+ version: 6.3.1+ copy-webpack-plugin:+ specifier: 13.0.1- version: 13.0.1([email protected]([email protected]))++ version: 13.0.1([email protected]([email protected]))+ cross-env:+ specifier: 7.0.3+ version: 7.0.3+ happy-dom:+ specifier: 20.0.11+ version: 20.0.11+ script-loader:+ specifier: 0.7.2+ version: 0.7.2+ vite-plugin-static-copy:+ specifier: 3.1.4- version: 3.1.4([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))++ version: 3.1.4([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+apps/db-compare:dependencies:colors:@@@ -803,15 -622,21 +830,12 @@@'@types/ini':specifier: 4.1.1version: 4.1.1- '@types/mime-types':- specifier: 3.0.1- version: 3.0.1'@types/multer':- specifier: 2.0.0- version: 2.0.0+ specifier: 2.1.0+ version: 2.1.0'@types/safe-compare':specifier: 1.1.2version: 1.1.2- '@types/sanitize-html':- specifier: 2.16.1- version: 2.16.1-- '@types/sax':-- specifier: 1.2.7-- version: 1.2.7'@types/serve-favicon':specifier: 2.5.7version: 2.5.7@@@ -951,11 -779,14 +975,11 @@@specifier: 2.0.8version: 2.0.8marked:- specifier: 17.0.1- version: 17.0.1+ specifier: 17.0.5+ version: 17.0.5- mime-types:- specifier: 3.0.2- version: 3.0.2multer:- specifier: 2.0.2- version: 2.0.2+ specifier: 2.1.1+ version: 2.1.1normalize-strings:specifier: 1.1.1version: 1.1.1@@@ -971,9 -796,15 +989,9 @@@safe-compare:specifier: 1.1.4version: 1.1.4- sanitize-filename:- specifier: 1.6.4- version: 1.6.4- sanitize-html:- specifier: 2.17.2- version: 2.17.2sax:- specifier: 1.4.4- version: 1.4.4+ specifier: 1.6.0+ version: 1.6.0serve-favicon:specifier: 2.5.1version: 2.5.1@@@ -1001,9 -832,15 +1019,12 @@@turnish:specifier: 1.8.0version: 1.8.0- unescape:- specifier: 1.0.1- version: 1.0.1+ vite:+ specifier: 8.0.1+ version: 8.0.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])ws:- specifier: 8.19.0- version: 8.19.0([email protected])([email protected])+ specifier: 8.20.0+ version: 8.20.0([email protected])([email protected])xml2js:specifier: 0.6.2version: 0.6.2@@@ -1663,43 -1509,6 +1693,43 @@@specifier: 5.1.0+ packages/trilium-core:+ dependencies:+ '@braintree/sanitize-url':+ specifier: 7.1.1+ version: 7.1.1+ '@triliumnext/commons':+ specifier: workspace:*+ version: link:../commons+ escape-html:+ specifier: 1.0.3+ version: 1.0.3+ i18next:+ specifier: 25.7.3+ version: 25.7.3([email protected])+ mime-types:+ specifier: 3.0.2+ version: 3.0.2+ sanitize-filename:- specifier: 1.6.3- version: 1.6.3++ specifier: 1.6.4++ version: 1.6.4+ sanitize-html:- specifier: 2.17.0- version: 2.17.0++ specifier: 2.17.2++ version: 2.17.2+ unescape:+ specifier: 1.0.1+ version: 1.0.1+ devDependencies:+ '@types/escape-html':+ specifier: 1.0.4+ version: 1.0.4+ '@types/mime-types':+ specifier: 3.0.1+ version: 3.0.1+ '@types/sanitize-html':- specifier: 2.16.0- version: 2.16.0++ specifier: 2.16.1++ version: 2.16.1+packages/turndown-plugin-gfm:devDependencies:turndown:@@@ -4064,13 -3936,13 +4160,18 @@@ packages'@mdn/[email protected]':resolution: {integrity: sha512-7xdrMX0Wk7grrTZQwAoy1GkvPMFoizStUoL+VmtUkAxegbCCec+3FKwOM6yc/uGU5+BEczQHXAlWiqvM8JeENg==}+ '@mermaid-js/[email protected]':+ resolution: {integrity: sha512-vjjYGnCCjYlIA/rR7M//eFi0rHM6dsMyN1JQKfckpt30DTC/esrw36hcrvA2FNPHaqh3Q/SyBWzddyaky8EtUQ==}+ peerDependencies:- mermaid: 11.12.2++ mermaid: 11.13.0+++ '@mermaid-js/[email protected]':+ resolution: {integrity: sha512-MX9jwhMyd5zDcFsYcl3duDUkKhjVRUCGEQrdCeNV5hCIR6+3FuDDbRbFmvVbAu15K1+juzsYGG+K8MDvCY1Amg==}+ peerDependencies:+ mermaid: 11.13.0- '@mermaid-js/[email protected]':- resolution: {integrity: sha512-lnjOhe7zyHjc+If7yT4zoedx2vo4sHaTmtkl1+or8BRTnCtDmcTpAjpzDSfCZrshM5bCoz0GyidzadJAH1xobA==}+ '@mermaid-js/[email protected]':+ resolution: {integrity: sha512-opmV19kN1JsK0T6HhhokHpcVkqKpF+x2pPDKKM2ThHtZAB5F4PROopk0amuVYK5qMrIA4erzpNm8gmPNJgMDxQ==}'@microsoft/[email protected]':resolution: {integrity: sha512-znmFn69wf/AIrwHya3fxX6uB5etSIn6vg4Q4RB/tb5VDDs1rqREc+AvMC/p19MUN13CZ7+V/8pkYPTj7q8tftg==}@@@ -4461,30 -4336,19 +4565,30 @@@'@popperjs/[email protected]':resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}+ '@preact/[email protected]':+ resolution: {integrity: sha512-K9wHlJOtkE+cGqlyQ5v9kL3Ge0Ql4LlIZjkUTL+1zf3nNdF88F9UZN6VTV8jdzBX9Fl7WSzeNMSDG7qECPmSmg==}+ peerDependencies:+ '@babel/core': 7.x+ vite: 2.x || 3.x || 4.x || 5.x || 6.x || 7.x+- '@preact/[email protected]':- resolution: {integrity: sha512-1SiS+vFItpkNdBs7q585PSAIln0wBeBdcpJYbzPs1qipsb/FssnkUioNXuRsb8ZnU8YEQHr+3v8+/mzWSnTQmg==}+ '@preact/[email protected]':+ resolution: {integrity: sha512-p0vJpxiVO7KWWazWny3LUZ+saXyZKWv6Ju0bYMWNJRp2YveufRPgSUB1C4MTqGJfz07EehMgfN+AJNwQy+w6Iw==}peerDependencies:'@babel/core': 7.x- vite: 2.x || 3.x || 4.x || 5.x || 6.x || 7.x+ vite: 2.x || 3.x || 4.x || 5.x || 6.x || 7.x || 8.x- '@preact/[email protected]':- resolution: {integrity: sha512-5Yf8h1Ke3SMHr15xl630KtwPTW4sYDFkkxS0vQ8UiQLWwZQnrF9IKaVG1mN5VcJz52EcWs2acsc/Npjha/7ysA==}+ '@preact/[email protected]':+ resolution: {integrity: sha512-AowtCcCU/33lFlh1zRFf/u+12rfrhtNakj7UpaGEsmMwUKpKWMVvcktOGcwBBNiB4lWrZWc01LhiyyzVklJyaQ==}+ '@preact/[email protected]':+ resolution: {integrity: sha512-VPjk5YFt7i11Fi4UK0tzaEe5xLwfhUxXL3l89ocxQ5aPz7bRo8M5+N73LjBMPklyXKYKz6YsNo4Smp8n6nplng==}+ peerDependencies:- preact: 10.28.3++ preact: 10.29.0+- '@preact/[email protected]':- resolution: {integrity: sha512-80PMfNS3d8t/J3cRNEJP14zRioWnavgqzX/+tsNGiCX6rpD26+eLkUQpa1sIeOERZMink+dAi34y0MJhg11LKQ==}+ '@preact/[email protected]':+ resolution: {integrity: sha512-gym5yoa64c+0w2kL7zRAAjY548qzWXbbuOfjsK9F1nWrEqooDwyWnih5SNdonjhQSp27zUqYh7UrxIRnkCyFCA==}peerDependencies:- preact: 10.28.3+ preact: 10.29.0'@prefresh/[email protected]':resolution: {integrity: sha512-AOl4HG6dAxWkJ5ndPHBgBa49oo/9bOiJuRDKHLSTyH+Fd9x00shTXpdiTj1W41l6oQIwUOAgJeHMn4QwIDpHkA==}@@@ -5870,9 -6104,9 +6348,12 @@@'@types/[email protected]':resolution: {integrity: sha512-MIyNUZipBTbyUNnhvuXJTY7B6qNI78meck9Jbv3wk0OgNwRyOOVEKDutAkOs1snB/tx0FafyR6/SN4Ps0hZPeg==}+ '@types/[email protected]':+ resolution: {integrity: sha512-SeyVJXlCZpEki5F0ghuYe+L+PprQta6nRZqhONt9F13dWBtR/ftoaIbdRQ7cis7womE+X2LKhsDdDtkkDhJS6g==}++ '@types/[email protected]':+ resolution: {integrity: sha512-Z+to+A2VkaHq1DfI2oSwsoCdhCHMpTSgjWzNcbNlRGYzksDBpPUgEcAL+RQjOBJRaLoEAOHXxqDGBVP+BblBwg==}+'@types/[email protected]':resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==}@@@ -6004,12 -6232,12 +6482,9 @@@'@types/[email protected]':resolution: {integrity: sha512-kK/IM1+pvwCMom+Kezt/UlP8LMEwm8rP6UgGbRc6zUnhU/csoBQ5rWgmD2CJuHxiMiX+H1VqPGpo0kDluJGXYA==}- '@types/[email protected]':- resolution: {integrity: sha512-l6rX1MUXje5ztPT0cAFtUayXF06DqPhRyfVXareEN5gGCFaP/iwsxIyKODr9XDhfxPpN6vXUFNfo5kZMXCxBtw==}-- '@types/[email protected]':- resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==}+ '@types/[email protected]':+ resolution: {integrity: sha512-n9wjs8bCOTyN/ynwD8s/nTcTreIHB1vf31vhLMGqUPNHaweKC4/fAl4Dj+hUlCTKYgm4P3k83fmiFfzkZ6sgMA==}- '@types/[email protected]':- resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==}-'@types/[email protected]':resolution: {integrity: sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w==}@@@ -6028,9 -6256,6 +6503,9 @@@'@types/[email protected]':resolution: {integrity: sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==}- '@types/[email protected]':- resolution: {integrity: sha512-xzLEyKB50yqCUPUJkIsrVvoWNfFUbIZI+RspLWt8u+tIW/BetMBZtgV2LY/2o+tYH8dRvQ+eoPf3NdhQCcLE2w==}++ '@types/[email protected]':++ resolution: {integrity: sha512-TC0dmN0K8YcWEAEfiPi5gJP14eJe30TTGjkvek3iM/1NdHHsdCA/Td6GvNndMOo/iSnIsZ4HuuhrYPDAmbxzww==}+'@types/[email protected]':resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==}@@@ -6474,11 -7142,8 +7392,11 @@@resolution: {integrity: sha512-0fztsk/0ryJ+2PPr9EyXS5/Co7OK8q3zY/xOoozEWaUsL5x+C0cyZ4YyMuUffOO2Dx/rAdq4JMPqW0VUtm+vzA==}engines: {bun: '>=0.7.0', deno: '>=1.0.0', node: '>=18.0.0'}+ '@zumer/[email protected]':+ resolution: {integrity: sha512-78/qbYl2FTv4H6qaXcNfAujfIOSzdvs83NW63VbyC9QA3sqNPfPvhn4xYMO6Gy11hXwJUEhd0z65yKiNzDwy9w==}+- '@zumer/[email protected]':- resolution: {integrity: sha512-W6quT4lMcPu8Q9O/Q6witSfc6/+xuY8C8yDoHug/+o7zYKCNE/e0I3//XsWDkyq9C0mDE0TAWF/8bwCR7x3gHQ==}+ '@zumer/[email protected]':+ resolution: {integrity: sha512-cjk1VTc6D/tRWHdvm/UwzetR7FSxDobYJ7Db1b5uuLhVTU0br8Y8hJJ1+TzArJni4BRvHgU60Q0MR+RKhRqyDg==}resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==}@@@ -7580,12 -8255,12 +8508,18 @@@resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==}+ resolution: {integrity: sha512-J+YV3WfhY6W/Xf9h+J1znYuqTye2xkBUIGyTPWuBAT27qajBa5mR4f8WBmfDY3YjRftT2kqZZiLi1qf0H+UOFw==}+ engines: {node: '>= 18.12.0'}+ peerDependencies:+ webpack: ^5.1.0++ resolution: {integrity: sha512-3JLW90aBGeaTLpM7mYQKpnVdgsUZRExY55giiZgLuX/xTQRUs1dOCwbBnWnvY6Q6rfZoXMNwzOQJCSZPppfqXA==}+ engines: {node: '>= 20.9.0'}+ peerDependencies:+ webpack: ^5.1.0+resolution: {integrity: sha512-vDMm9B0xnqqZ8uSBpZ8sNtRtOdmfShrvT6h2TuQGLs0Is+cR0DYbj/KWP6ALVNbWPpqA/qPLoOuppJN07humpA==}@@@ -9020,12 -9670,8 +9929,12 @@@resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-aTnihCmiMA0ItLJLCbrQYS9mzriopW24goFPgUnKAAmAlPogTSmFWqoBPMXzIfPb7bs04Hur5zEI4WYgLW3Sig==}+ engines: {node: '>=12'}+- resolution: {integrity: sha512-uEEX8iRzgq1IKRISOw6RrB2RLMhcI25xznQYrCTVvxZHZZ+A2jH6qIolYuwavVxAMi64pFp2yZm4KFVdD993cg==}+ resolution: {integrity: sha512-zZNdMqx8qIQGurgnbgYIUsdXxSfvhfRSIdncsKGv/twUOZpwCsk9hPHmdjdcme1+epATgb41G0rkIGHJ0Wydng==}engines: {node: '>=12'}@@@ -9323,12 -9975,8 +10238,12 @@@resolution: {integrity: sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==}engines: {node: '>=18'}+ resolution: {integrity: sha512-gv5BeD2EssA793rlFWVPMMCqefTlpusw6/2TbAVMy0FzcG8wKJn4O+NqJ4+XWmmwrayJgw5TzrmWjFgmz1XPqw==}+ engines: {node: '>=18'}+- resolution: {integrity: sha512-yMqGUQVVCkD4tqjOJf3TnrvaaHDMYp4VlUSObbkIiuCPe/ofdMBFIAcBbCSRFWOnos6qRiTVStDwqPLUclaxIw==}+ resolution: {integrity: sha512-hjrNztw/VajQwOLsMNT1cbJiH2muO3OROCHnbehc8eY5JyD2gqz4AcMHPqgaOR59DjgUjYAYLeH699g/eWi2jw==}engines: {node: '>=18'}@@@ -9390,12 -10031,8 +10298,12 @@@engines: {node: '>=0.4.7'}hasBin: true+ resolution: {integrity: sha512-QsCdAUHAmiDeKeaNojb1OHOPF7NjcWPBR7obdu3NwH2a/oyQaLg5d0aaCy/9My6CdPChYF07dvz5chaXBGaD4g==}+ engines: {node: '>=20.0.0'}+- resolution: {integrity: sha512-VQe+Q5CYiGOgcCERXhcfNsbnrN92FDEKciMH/x6LppU9dd0j4aTjCTlqONFOIMcAm/5JxS3+utowbXV1OoFr+g==}+ resolution: {integrity: sha512-GKhjq4OQCYB4VLFBzv8mmccUadwlAusOZOI7hC1D9xDIT5HhzkJK17c4el2f6R6C715P9xB4uiMxeKUa2nHMwQ==}engines: {node: '>=20.0.0'}@@@ -9693,14 -10324,6 +10595,14 @@@typescript:optional: true- resolution: {integrity: sha512-urrg4HMFFMQZ2bbKRK7IZ8/CTE7D8H4JRlAwqA2ZwDRFfdd0K/4cdbNNLgfn9mo+I/h9wJu61qJzH7jCFAhUZQ==}++ resolution: {integrity: sha512-2XaT+HpYGuc2uTExq9TVRhLsso+Dxym6PWaKpn36wfBmTI779OQ7iP/XaZHzrnGyzU4SHpFrTYLKfVyBfAhVNA==}+ peerDependencies:+ typescript: ^5+ peerDependenciesMeta:+ typescript:+ optional: true+resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}engines: {node: '>=0.10.0'}@@@ -10259,12 -10878,9 +11160,15 @@@resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-oQZ1Mo7440BfLSv9TX87VNEyU52pXPVG19F9PL3gTgNt0tVxlZ8F4O6yze3CLuLx28TxotxvlyepCNaaV0ZjMw==}++ resolution: {integrity: sha512-mirki9WS/SUahm+1TbAPkqvbCiCfOAAsyXeHxK1UkullnJVVqoJG2pL9ObvT05CN+tM7fxhfYm0NbXn+1hWoZg==}++ resolution: {integrity: sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==}+resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}@@@ -10411,12 -11020,8 +11308,12 @@@engines: {node: '>= 10'}hasBin: true+ resolution: {integrity: sha512-aeQoDkuRWSqQN6nSvVCEFvfXdqo1OQiCmmW1kc9xSdjutPv7BGO7pqY9sQRJpMOGrEdfDgF2TfRXe5eUAD2Waw==}+ hasBin: true+- resolution: {integrity: sha512-YHzO7721WbmAL6Ov1uzN/l5mY5WWWhJBSW+jq4tkfZfsxmo1hu6frS0EOswvjBUnWE6NtjEs48SFn5CQESRLZg==}+ resolution: {integrity: sha512-1DJcK/L05k1Y9Gf7wMcyuqFOL6BiY3vY0CFcAM/LPRN04NALxcl6u7lOWNsp3f/bCHWxigzQl6FbR95XJ4R84Q==}hasBin: true@@@ -10453,12 -11058,6 +11350,9 @@@resolution: {integrity: sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==}engines: {node: '>= 8'}+ resolution: {integrity: sha512-wRJ9I4az0QcsH7A4v4l0enUpkS++MBx0BnL/68KaLzJg7x1qmbjSlwEoCNol7KTYZ+pmtI7Eh2J0Nu6/2Z5J/Q==}+- resolution: {integrity: sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==}-resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}@@@ -10870,11 -11472,11 +11767,16 @@@engines: {node: '>= 20'}hasBin: true+ resolution: {integrity: sha512-boeBdiS0ghpWcSwoNm/jJBwdpFaMnZWRzjA6SkUMYb40SVaN1x7mmfGKp0jvexGcx+7y2La5zRZsYFZI6Qpypg==}+ engines: {node: '>= 20'}+ hasBin: true++ resolution: {integrity: sha512-6hLvc0/JEbRjRgzI6wnT2P1XuM1/RrrDEX0kPt0N7jGm1133g6X7DlxFasUIx+72aKAr904GTxhSLDrd5DIlZg==}+ engines: {node: '>= 20'}+ hasBin: true+resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==}engines: {node: '>= 12'}@@@ -11140,11 -11735,8 +12035,11 @@@resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}engines: {node: '>=10'}+ resolution: {integrity: sha512-yxXajDWoSF6id8b2LKxlhXidxH/v6mx4JV+isrtsZ62RGCMsRbjUMFO9xOfTVH8vyxWhsbCkiAP6/i5hqbyk6w==}+- resolution: {integrity: sha512-/UpfwZoiySbXoc6nUIK5DSo8HK5vKtW8tnQz63vuoCvuVU3xj1j2mfmMTnGgiV5NoAKxSyAD59RMBpJfD0kbPw==}+ resolution: {integrity: sha512-OTTO6ofvDuzN4fxuBngqhQLJmIqModr2NgQb4OY+5DGRt54B+YNAvNnlspYwUXXGq2Rbht1DhXgeU4dr4CUy6Q==}resolution: {integrity: sha512-ZWYT7ln73Hptxqxk2DxPU9MmapXRhxkJD6tkSR04dnQxm8BGu2hzgKLugK5yySD97u/8yy7Ma7E76k9ZdvtjkQ==}@@@ -12769,24 -13239,8 +13537,24 @@@peerDependencies:react: ^19.2.4+ resolution: {integrity: sha512-Hks6UIRZWW4c+qDAnx1csVsCGYeIR4MoBGQgJ+NUoNnO6qLxXuf8zu0xdcinyXUORgGzCdRsexxO1Xzv3sTdnw==}+ peerDependencies:+ i18next: '>= 25.6.2'+ react: '>= 16.8.0'+ react-dom: '*'+ react-native: '*'+ typescript: ^5+ peerDependenciesMeta:+ react-dom:+ optional: true+ react-native:+ optional: true+ typescript:+ optional: true+- resolution: {integrity: sha512-6yj+dcfMncEC21QPhOTsW8mOSO+pzFmT6uvU7XXdvM/Cp38zJkmTeMeKmTrmCMD5ToT79FmiE/mRWiYWcJYW4g==}+ resolution: {integrity: sha512-bxVftl2q/pfupKVmBH80ui1rHl3ia2sdcR0Yhn6cr0PyoHfO8JLZ19fccwOIH+0dMBCIkdO5gAmEQFCTAggeQg==}peerDependencies:i18next: '>= 25.6.2'react: '>= 16.8.0'@@@ -12858,14 -13312,14 +13626,20 @@@peerDependencies:react: ^18.0.0 || ^19.0.0+ resolution: {integrity: sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==}+ peerDependencies:+ react: '>=16.6.0'+ react-dom: '>=16.6.0'++ resolution: {integrity: sha512-gTRqQYC8ojbiXyd9duYFiSn2TJw0ROXCgYjenOvNKITWzK0m0eCvkUsEUM08xvydkMh7ncp+LE0uS3DeNGZxnQ==}+ peerDependencies:+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0+- resolution: {integrity: sha512-v89O08xRdpCaEuf380B39D1C/0KgUDZA59xft6SVAjzjz/xQxSyXrgDWHymIsYI6TMrqE8WO+G0/PB9AGE8VNA==}+ resolution: {integrity: sha512-SH5nvfUQwGHYyriDUAOt7wfPsfG9Qxd6OdzQxl5oQ4dsSsUicqQvjV7dR+NqZ4coY0fUn3w1jnC5PwzIUWEg5w==}peerDependencies:react: ^18.0.0 || ^19.0.0react-dom: ^18.0.0 || ^19.0.0@@@ -13091,10 -13545,9 +13865,13 @@@resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==}engines: {iojs: '>=1.0.0', node: '>=0.10.0'}+ resolution: {integrity: sha512-r7//6mIM5p34hFiDMvYfXgyjXqGRta+/psd9YtytsgRlrpRzFv4RbH76TXd2qD+7ZPZEbpBDhdRhJaFgfQ7zNQ==}+ engines: {node: '>=18.0.0'}++ resolution: {integrity: sha512-RayDr1FL3Jglnf6p9xHGJ0U18va96PiuLs/JHnd1cdDOXvC+3lsXKe6ujl7PX0pvnhNW2Tpqnr6PEKpJVO2exw==}+resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}@@@ -14152,9 -14566,12 +14890,15 @@@resolution: {integrity: sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==}engines: {node: '>=10.0.0'}+ resolution: {integrity: sha512-qFW7kfadtcaISQIibKAIy0f3eeIXUVi8242Vly1iJfMD79kfEGzfczNuPBN/80hDxHzQJXYbmJ8VipI40hQtfA==}++ resolution: {integrity: sha512-Lxh+leFNoBo/Yyr4USs6gxqbfo8anYUaUMmoT91pfVLtoUgl/dE+qV7ahnFrKVMCYYqGG33aIMPR7FzpPBaNYA==}++ resolution: {integrity: sha512-P+Vu1qXfzediirmHOC3xKGAYeZtPcV9g76X+xg2FD4tYgR71ewMA35Y3sCz3zhiN/dwefRpJX0yBcgwi1fXNQA==}+resolution: {integrity: sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg==}engines: {node: '>=6'}@@@ -14821,17 -15264,11 +15591,17 @@@vite:optional: true+ resolution: {integrity: sha512-iCmr4GSw4eSnaB+G8zc2f4dxSuDjbkjwpuBLLGvQYR9IW7rnDzftnUjOH5p4RYR+d4GsiBqXRvzuFhs5bnzVyw==}+ engines: {node: ^18.0.0 || >=20.0.0}+ peerDependencies:+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0+- resolution: {integrity: sha512-g2k9z8B/1Bx7D4wnFjPLx9dyYGrqWMLTpwTtPHhcU+ElNZP2O4+4OsyaficiDClus0dzVhdGvoGFYMJxoXZ12Q==}+ resolution: {integrity: sha512-XiAtZcev7nppxNFgKoD55rfL+ukVp/RtrnTJONRwRuzv/B2FK2h2ZRCYjvxhwBV/Oarse83SiyXBSxMTfeEM0Q==}engines: {node: ^18.0.0 || >=20.0.0}peerDependencies:- vite: ^5.0.0 || ^6.0.0 || ^7.0.0+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0resolution: {integrity: sha512-WaiOUlmt1fKw1w/WWJnx9gVk42D1BASKZmGCPpy6iTLE5iIemN2lim3MwI7Rffyt3aQnPrLfLSLnI8ZUJ9s49g==}@@@ -16028,13 -16655,13 +16988,15 @@@ snapshots'@bcoe/[email protected]': {}+ '@blazediff/[email protected]': {}+'@braintree/[email protected]': {}+ '@braintree/[email protected]': {}+'@braintree/[email protected]': {}- '@bufbuild/[email protected]':+ '@bufbuild/[email protected]':optional: true'@bundled-es-modules/[email protected]':@@@ -16096,31 -16735,29 +17070,31 @@@- supports-color- utf-8-validate- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-upload': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-upload': 47.6.1+ ckeditor5: 47.6.1+ transitivePeerDependencies:+ - supports-color- dependencies:- '@aws-sdk/client-bedrock-runtime': 3.823.0- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-cloud-services': 47.4.0- '@ckeditor/ckeditor5-collaboration-core': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-markdown-gfm': 47.4.0- '@ckeditor/ckeditor5-real-time-collaboration': 47.4.0([email protected])([email protected])- '@ckeditor/ckeditor5-table': 47.4.0- '@ckeditor/ckeditor5-theme-lark': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0- ckeditor5-collaboration: 47.4.0+ dependencies:+ '@aws-sdk/client-bedrock-runtime': 3.994.0+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-cloud-services': 47.6.1+ '@ckeditor/ckeditor5-collaboration-core': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-markdown-gfm': 47.6.1+ '@ckeditor/ckeditor5-real-time-collaboration': 47.6.1([email protected])([email protected])+ '@ckeditor/ckeditor5-table': 47.6.1+ '@ckeditor/ckeditor5-theme-lark': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1+ ckeditor5-collaboration: 47.6.1diff: 8.0.3dom-serializer: 2.0.0domhandler: 5.0.3@@@ -16235,35 -16873,31 +17210,33 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected](patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)':+ '@ckeditor/[email protected](patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)':dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-enter': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-enter': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1transitivePeerDependencies:- supports-color@@@ -16437,46 -17065,40 +17404,46 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5transitivePeerDependencies:- supports-color@@@ -16492,26 -17114,28 +17459,26 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-export-inline-styles': 47.4.0- '@ckeditor/ckeditor5-font': 47.4.0- '@ckeditor/ckeditor5-html-support': 47.4.0- '@ckeditor/ckeditor5-list': 47.4.0- '@ckeditor/ckeditor5-table': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-mention': 47.4.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-export-inline-styles': 47.6.1+ '@ckeditor/ckeditor5-font': 47.6.1+ '@ckeditor/ckeditor5-html-support': 47.6.1+ '@ckeditor/ckeditor5-list': 47.6.1+ '@ckeditor/ckeditor5-table': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-mention': 47.6.1(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5fuzzysort: 3.1.0transitivePeerDependencies:@@@ -16541,58 -17165,58 +17508,58 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1specificity: 0.4.1- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-cloud-services': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-merge-fields': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-cloud-services': 47.4.0- '@ckeditor/ckeditor5-collaboration-core': 47.4.0- '@ckeditor/ckeditor5-comments': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-merge-fields': 47.4.0- '@ckeditor/ckeditor5-track-changes': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-cloud-services': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-merge-fields': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-cloud-services': 47.6.1+ '@ckeditor/ckeditor5-collaboration-core': 47.6.1+ '@ckeditor/ckeditor5-comments': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-merge-fields': 47.6.1+ '@ckeditor/ckeditor5-track-changes': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1transitivePeerDependencies:- supports-color@@@ -16628,98 -17275,88 +17618,88 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-paragraph': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1++ transitivePeerDependencies:++ - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-enter': 47.4.0- '@ckeditor/ckeditor5-heading': 47.4.0- '@ckeditor/ckeditor5-image': 47.4.0- '@ckeditor/ckeditor5-list': 47.4.0- '@ckeditor/ckeditor5-remove-format': 47.4.0- '@ckeditor/ckeditor5-table': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-enter': 47.6.1+ '@ckeditor/ckeditor5-heading': 47.6.1+ '@ckeditor/ckeditor5-image': 47.6.1+ '@ckeditor/ckeditor5-list': 47.6.1+ '@ckeditor/ckeditor5-remove-format': 47.6.1+ '@ckeditor/ckeditor5-table': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]': {}-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-undo': 47.4.0- '@ckeditor/ckeditor5-upload': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/[email protected]': {}++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-undo': 47.6.1+ '@ckeditor/ckeditor5-upload': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-cloud-services': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-merge-fields': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-heading': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-list': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-cloud-services': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-merge-fields': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-heading': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-list': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1+ transitivePeerDependencies:+ - supports-color'@ckeditor/[email protected]': {}@@@ -16801,79 -17446,85 +17789,79 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-undo': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected](patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0- es-toolkit: 1.39.5+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-undo': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1+ transitivePeerDependencies:+ - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected](patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-image': 47.4.0- '@ckeditor/ckeditor5-mention': 47.4.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-image': 47.6.1+ '@ckeditor/ckeditor5-mention': 47.6.1(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1+ es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5- protobufjs: 7.5.0+ protobufjs: 7.5.4- '@ckeditor/[email protected](@babel/[email protected])(@swc/[email protected](@swc/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected])':+ '@ckeditor/[email protected](@babel/[email protected])(@swc/[email protected](@swc/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected])':dependencies:- '@ckeditor/ckeditor5-dev-translations': 54.0.0(@babel/[email protected])(@swc/[email protected](@swc/[email protected]))([email protected])([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))- '@ckeditor/ckeditor5-dev-utils': 54.0.0(@babel/[email protected])(@swc/[email protected](@swc/[email protected]))([email protected])([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ '@ckeditor/ckeditor5-dev-translations': 54.5.0(@babel/[email protected])(@swc/[email protected](@swc/[email protected]))([email protected])([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ '@ckeditor/ckeditor5-dev-utils': 54.5.0(@babel/[email protected])(@swc/[email protected](@swc/[email protected]))([email protected])([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))buffer: 6.0.3chalk: 5.6.2- css-loader: 5.2.7([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))- fs-extra: 11.3.3- glob: 13.0.0+ css-loader: 5.2.7([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ fs-extra: 11.3.4+ glob: 13.0.6minimist: 1.2.8postcss: 8.5.6- postcss-loader: 4.3.0([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ postcss-loader: 4.3.0([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))process: 0.11.10- raw-loader: 4.0.2([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))- style-loader: 2.0.0([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))- stylelint: 16.26.1([email protected])- stylelint-config-ckeditor5: 2.0.1([email protected]([email protected]))- terser-webpack-plugin: 5.3.14(@swc/[email protected](@swc/[email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))- ts-loader: 9.5.4([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))- ts-node: 10.9.2(@swc/[email protected](@swc/[email protected]))(@types/[email protected])([email protected])+ raw-loader: 4.0.2([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ style-loader: 2.0.0([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ terser-webpack-plugin: 5.3.14(@swc/[email protected](@swc/[email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ ts-loader: 9.5.4([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ ts-node: 10.9.2(@swc/[email protected](@swc/[email protected]))(@types/[email protected])([email protected])typescript: 5.0.4upath: 2.0.1- webpack-dev-server: 5.2.2([email protected])([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))+ webpack-dev-server: 5.2.2([email protected])([email protected])([email protected](@swc/[email protected](@swc/[email protected]))([email protected]))transitivePeerDependencies:- '@babel/core'- '@rspack/core'@@@ -16888,64 -17539,66 +17876,64 @@@- utf-8-validate- webpack-cli- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-theme-lark': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-theme-lark': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-paste-from-office': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- ckeditor5: 47.4.0-- dependencies:- '@ckeditor/ckeditor-cloud-services-collaboration': 53.0.2(@ckeditor/[email protected])([email protected])([email protected])([email protected])- '@ckeditor/ckeditor5-cloud-services': 47.4.0- '@ckeditor/ckeditor5-comments': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-editor-multi-root': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-operations-compressor': 47.4.0- '@ckeditor/ckeditor5-revision-history': 47.4.0- '@ckeditor/ckeditor5-theme-lark': 47.4.0- '@ckeditor/ckeditor5-track-changes': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0- ckeditor5-collaboration: 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-paste-from-office': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ ckeditor5: 47.6.1++ dependencies:+ '@ckeditor/ckeditor-cloud-services-collaboration': 53.0.3(@ckeditor/[email protected])([email protected])([email protected])([email protected])+ '@ckeditor/ckeditor5-cloud-services': 47.6.1+ '@ckeditor/ckeditor5-comments': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-editor-multi-root': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-operations-compressor': 47.6.1+ '@ckeditor/ckeditor5-revision-history': 47.6.1+ '@ckeditor/ckeditor5-theme-lark': 47.6.1+ '@ckeditor/ckeditor5-track-changes': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1+ ckeditor5-collaboration: 47.6.1es-toolkit: 1.39.5transitivePeerDependencies:- bufferutil@@@ -16988,133 -17641,140 +17976,132 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-heading': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-mention': 47.4.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)- '@ckeditor/ckeditor5-style': 47.4.0- '@ckeditor/ckeditor5-template': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-theme-lark': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-heading': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-mention': 47.6.1(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)+ '@ckeditor/ckeditor5-style': 47.6.1+ '@ckeditor/ckeditor5-template': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1- transitivePeerDependencies:- - supports-color++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-theme-lark': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1'@codemirror/autocomplete': 6.18.6'@codemirror/commands': 6.8.1'@codemirror/lang-html': 6.4.11'@codemirror/lang-markdown': 6.3.2- '@codemirror/language': 6.11.0- '@codemirror/state': 6.5.2+ '@codemirror/language': 6.12.2+ '@codemirror/state': 6.6.0'@codemirror/theme-one-dark': 6.1.2- '@codemirror/view': 6.39.12- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-theme-lark': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-html-support': 47.4.0- '@ckeditor/ckeditor5-list': 47.4.0- '@ckeditor/ckeditor5-table': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@codemirror/view': 6.40.0+ ckeditor5: 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-theme-lark': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-html-support': 47.6.1+ '@ckeditor/ckeditor5-list': 47.6.1+ '@ckeditor/ckeditor5-table': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- '@ckeditor/ckeditor5-widget': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ '@ckeditor/ckeditor5-widget': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-ui': 47.4.0-- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-clipboard': 47.4.0- '@ckeditor/ckeditor5-code-block': 47.4.0(patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)- '@ckeditor/ckeditor5-collaboration-core': 47.4.0- '@ckeditor/ckeditor5-comments': 47.4.0- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-editor-multi-root': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-enter': 47.4.0- '@ckeditor/ckeditor5-find-and-replace': 47.4.0- '@ckeditor/ckeditor5-font': 47.4.0- '@ckeditor/ckeditor5-heading': 47.4.0- '@ckeditor/ckeditor5-highlight': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-image': 47.4.0- '@ckeditor/ckeditor5-link': 47.4.0- '@ckeditor/ckeditor5-list': 47.4.0- '@ckeditor/ckeditor5-media-embed': 47.4.0- '@ckeditor/ckeditor5-merge-fields': 47.4.0- '@ckeditor/ckeditor5-restricted-editing': 47.4.0- '@ckeditor/ckeditor5-style': 47.4.0- '@ckeditor/ckeditor5-table': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0- ckeditor5-collaboration: 47.4.0+ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-ui': 47.6.1++ '@ckeditor/[email protected]':+ dependencies:+ '@ckeditor/ckeditor5-clipboard': 47.6.1+ '@ckeditor/ckeditor5-code-block': 47.6.1(patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)+ '@ckeditor/ckeditor5-comments': 47.6.1+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-editor-multi-root': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-enter': 47.6.1+ '@ckeditor/ckeditor5-find-and-replace': 47.6.1+ '@ckeditor/ckeditor5-font': 47.6.1+ '@ckeditor/ckeditor5-heading': 47.6.1+ '@ckeditor/ckeditor5-highlight': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-image': 47.6.1+ '@ckeditor/ckeditor5-link': 47.6.1+ '@ckeditor/ckeditor5-list': 47.6.1+ '@ckeditor/ckeditor5-media-embed': 47.6.1+ '@ckeditor/ckeditor5-merge-fields': 47.6.1+ '@ckeditor/ckeditor5-restricted-editing': 47.6.1+ '@ckeditor/ckeditor5-style': 47.6.1+ '@ckeditor/ckeditor5-table': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1+ ckeditor5-collaboration: 47.6.1es-toolkit: 1.39.5transitivePeerDependencies:- supports-color@@@ -17177,32 -17837,36 +18164,32 @@@transitivePeerDependencies:- supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-editor-multi-root': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-editor-multi-root': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-engine': 47.4.0- '@ckeditor/ckeditor5-enter': 47.4.0- '@ckeditor/ckeditor5-icons': 47.4.0- '@ckeditor/ckeditor5-typing': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-engine': 47.6.1+ '@ckeditor/ckeditor5-enter': 47.6.1+ '@ckeditor/ckeditor5-icons': 47.6.1+ '@ckeditor/ckeditor5-typing': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1es-toolkit: 1.39.5- '@ckeditor/[email protected]':+ '@ckeditor/[email protected]':dependencies:- '@ckeditor/ckeditor5-core': 47.4.0- '@ckeditor/ckeditor5-ui': 47.4.0- '@ckeditor/ckeditor5-utils': 47.4.0- ckeditor5: 47.4.0+ '@ckeditor/ckeditor5-core': 47.6.1+ '@ckeditor/ckeditor5-ui': 47.6.1+ '@ckeditor/ckeditor5-utils': 47.6.1+ ckeditor5: 47.6.1es-toolkit: 1.39.5- transitivePeerDependencies:- - supports-color'@codemirror/[email protected]':dependencies:@@@ -19157,7 -19823,7 +20146,13 @@@'@mdn/[email protected]': {}- '@mermaid-js/[email protected]([email protected])':++ '@mermaid-js/[email protected]([email protected])':++ dependencies:++ d3: 7.9.0++ elkjs: 0.9.3++ mermaid: 11.13.0+++ '@mermaid-js/[email protected]([email protected])':dependencies:d3: 7.9.0elkjs: 0.9.3@@@ -19202,13 -19868,9 +20197,13 @@@'@microsoft/[email protected]': {}+ '@mind-elixir/[email protected]([email protected])':+ dependencies:+ mind-elixir: 5.4.0+- '@mind-elixir/[email protected]([email protected])':+ '@mind-elixir/[email protected]([email protected])':dependencies:- mind-elixir: 5.8.0+ mind-elixir: 5.9.3'@mixmark-io/[email protected]': {}@@@ -19569,50 -20234,31 +20567,52 @@@'@popperjs/[email protected]': {}- '@preact/[email protected](@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':++ '@preact/[email protected](@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':+ dependencies:- '@babel/core': 7.28.0- '@babel/plugin-transform-react-jsx': 7.27.1(@babel/[email protected])- '@babel/plugin-transform-react-jsx-development': 7.27.1(@babel/[email protected])- '@prefresh/vite': 2.4.11([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))++ '@babel/core': 7.29.0++ '@babel/plugin-transform-react-jsx': 7.27.1(@babel/[email protected])++ '@babel/plugin-transform-react-jsx-development': 7.27.1(@babel/[email protected])++ '@prefresh/vite': 2.4.12([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ '@rollup/pluginutils': 4.2.1- babel-plugin-transform-hook-names: 1.0.2(@babel/[email protected])++ babel-plugin-transform-hook-names: 1.0.2(@babel/[email protected])+ debug: 4.4.3([email protected])+ picocolors: 1.1.1- vite: 7.3.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])- vite-prerender-plugin: 0.5.11([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))++ vite: 8.0.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])++ vite-prerender-plugin: 0.5.11([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ transitivePeerDependencies:+ - preact+ - supports-color+- '@preact/[email protected](@babel/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@preact/[email protected](@babel/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:- '@babel/core': 7.28.0- '@babel/plugin-transform-react-jsx': 7.27.1(@babel/[email protected])- '@babel/plugin-transform-react-jsx-development': 7.27.1(@babel/[email protected])- '@prefresh/vite': 2.4.11([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ '@babel/core': 7.29.0+ '@babel/plugin-transform-react-jsx': 7.27.1(@babel/[email protected])+ '@babel/plugin-transform-react-jsx-development': 7.27.1(@babel/[email protected])+ '@prefresh/vite': 2.4.12([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))'@rollup/pluginutils': 5.1.4([email protected])- babel-plugin-transform-hook-names: 1.0.2(@babel/[email protected])+ babel-plugin-transform-hook-names: 1.0.2(@babel/[email protected])debug: 4.4.3([email protected])+ magic-string: 0.30.21picocolors: 1.1.1- vite: 7.3.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])- vite-prerender-plugin: 0.5.11([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ vite: 8.0.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ vite-prerender-plugin: 0.5.11([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ zimmerframe: 1.1.4transitivePeerDependencies:- preact- rollup- supports-color- '@preact/[email protected]': {}+ '@preact/[email protected]': {}- '@preact/[email protected]([email protected])':++ '@preact/[email protected]([email protected])':+ dependencies:- '@preact/signals-core': 1.12.2- preact: 10.28.3++ '@preact/signals-core': 1.14.0++ preact: 10.29.0+- '@preact/[email protected]([email protected])':+ '@preact/[email protected]([email protected])':dependencies:- '@preact/signals-core': 1.12.2- preact: 10.28.3+ '@preact/signals-core': 1.14.0+ preact: 10.29.0'@prefresh/[email protected]': {}@@@ -21184,9 -22165,7 +22521,11 @@@'@types/[email protected]': {}+ '@types/[email protected]':+ dependencies:- '@types/sizzle': 2.3.9++ '@types/sizzle': 2.3.10+++ '@types/[email protected]': {}'@types/[email protected]': {}@@@ -21322,18 -22297,16 +22657,14 @@@'@types/[email protected]': {}+ '@types/[email protected]': {}+'@types/[email protected]': {}- '@types/[email protected]':+ '@types/[email protected]':dependencies:- htmlparser2: 8.0.2-- '@types/[email protected]':- dependencies:- '@types/node': 22.15.21+ htmlparser2: 10.1.0- '@types/[email protected]':- dependencies:- '@types/node': 22.15.21-'@types/[email protected]':dependencies:'@types/mime': 1.3.5@@@ -21360,11 -22333,9 +22691,11 @@@'@types/[email protected]': {}- '@types/[email protected]': {}++ '@types/[email protected]': {}+'@types/[email protected]':dependencies:- '@types/node': 24.10.10+ '@types/node': 24.12.0'@types/[email protected]':optional: true@@@ -22030,9 -24242,7 +24602,9 @@@'@zip.js/[email protected]': {}+ '@zumer/[email protected]': {}+- '@zumer/[email protected]': {}+ '@zumer/[email protected]': {}@@@ -23363,14 -25559,14 +25921,23 @@@is-what: 3.14.1optional: true+ dependencies:+ glob-parent: 6.0.2+ normalize-path: 3.0.0+ schema-utils: 4.3.2+ serialize-javascript: 6.0.2- tinyglobby: 0.2.14- webpack: 5.101.3([email protected])++ tinyglobby: 0.2.15++ webpack: 5.101.3([email protected])+++ dependencies:+ glob-parent: 6.0.2+ normalize-path: 3.0.0+ schema-utils: 4.3.2+ serialize-javascript: 7.0.4+ tinyglobby: 0.2.15+ webpack: 5.101.3([email protected])@@@ -25313,25 -27450,7 +27821,25 @@@dependencies:is-callable: 1.2.7+ dependencies:+ '@tweenjs/tween.js': 25.0.0+ accessor-fn: 1.5.3+ bezier-js: 6.1.4+ canvas-color-tracker: 1.3.2+ d3-array: 3.2.4+ d3-drag: 3.0.0+ d3-force-3d: 3.0.6+ d3-scale: 4.0.2+ d3-scale-chromatic: 3.1.0+ d3-selection: 3.0.0+ d3-zoom: 3.0.0+ float-tooltip: 1.7.5+ index-array-by: 1.4.2+ kapsule: 1.16.3+ lodash-es: 4.17.23+dependencies:'@tweenjs/tween.js': 25.0.0accessor-fn: 1.5.3@@@ -25694,9 -27813,7 +28202,9 @@@+ [email protected]: {}+- [email protected]: {}+ [email protected]: {}dependencies:@@@ -25769,18 -27875,12 +28266,18 @@@optionalDependencies:uglify-js: 3.19.3+ dependencies:+ '@types/node': 20.19.25+ '@types/whatwg-mimetype': 3.0.2+ whatwg-mimetype: 3.0.0+dependencies:- '@types/node': 24.10.9+ '@types/node': 24.12.0'@types/whatwg-mimetype': 3.0.2'@types/ws': 8.18.1- entities: 4.5.0+ entities: 7.0.1whatwg-mimetype: 3.0.0ws: 8.19.0([email protected])([email protected])transitivePeerDependencies:@@@ -26196,12 -28298,6 +28695,12 @@@optionalDependencies:typescript: 5.9.3+ dependencies:- '@babel/runtime': 7.28.4++ '@babel/runtime': 7.29.2+ optionalDependencies:+ typescript: 5.9.3+dependencies:safer-buffer: 2.1.2@@@ -26702,10 -28778,8 +29187,12 @@@+ [email protected]: {}++ [email protected]: {}++ [email protected]: {}+@@@ -26912,11 -28977,7 +29390,11 @@@- supports-color- utf-8-validate+ dependencies:+ commander: 8.3.0+dependencies:commander: 8.3.0@@@ -26944,10 -29005,6 +29422,8 @@@+ [email protected]: {}+- [email protected]: {}-@@@ -27448,8 -29512,8 +29931,10 @@@+ [email protected]: {}++ [email protected]: {}+@@@ -27896,11 -29955,9 +30376,11 @@@+ [email protected]: {}+- [email protected]: {}+ [email protected]: {}- [email protected]([email protected](@swc/[email protected](@swc/[email protected]))([email protected])):+ [email protected]([email protected](@swc/[email protected](@swc/[email protected]))([email protected])):dependencies:schema-utils: 4.3.2tapable: 2.2.3@@@ -28166,8 -30235,16 +30658,14 @@@- [email protected]: {}-+ [email protected]: {}++ dependencies:+ picocolors: 1.1.1+@@@ -29646,22 -31582,11 +32003,22 @@@react: 19.2.4scheduler: 0.27.0+ [email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ dependencies:- '@babel/runtime': 7.28.4++ '@babel/runtime': 7.29.2+ html-parse-stringify: 3.0.1+ i18next: 25.7.3([email protected])+ react: 19.2.4+ use-sync-external-store: 1.6.0([email protected])+ optionalDependencies:+ react-dom: 19.2.4([email protected])+ typescript: 5.9.3+- [email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ [email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]):dependencies:- '@babel/runtime': 7.28.4+ '@babel/runtime': 7.29.2html-parse-stringify: 3.0.1- i18next: 25.8.0([email protected])+ i18next: 25.10.3([email protected])react: 19.2.4use-sync-external-store: 1.6.0([email protected])optionalDependencies:@@@ -29733,12 -31658,16 +32090,21 @@@prop-types: 15.8.1react: 19.2.4+ dependencies:+ '@babel/runtime': 7.29.2+ dom-helpers: 5.2.1+ loose-envify: 1.4.0+ prop-types: 15.8.1+ react: 19.2.4+ react-dom: 19.2.4([email protected])++ dependencies:+ react: 19.2.4+ react-dom: 19.2.4([email protected])+dependencies:react: 19.2.4react-dom: 19.2.4([email protected])@@@ -30039,8 -31968,8 +32405,10 @@@+ [email protected]: {}++ [email protected]: {}+@@@ -31438,10 -33255,14 +33694,16 @@@string-width: 4.2.3strip-ansi: 6.0.1+ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}+dependencies:'@ljharb/resumer': 0.0.1@@@ -32206,15 -34045,7 +34486,15 @@@- rollup- supports-color- [email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):++ [email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):+ dependencies:+ chokidar: 3.6.0+ p-map: 7.0.4+ picocolors: 1.1.1+ tinyglobby: 0.2.15- vite: 7.3.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])++ vite: 8.0.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+- [email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):+ [email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:chokidar: 3.6.0p-map: 7.0.4