Files
MechanicalNotes/.obsidian/plugins/position-restore/main.js
T

13 lines
187 KiB
JavaScript

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
https://github.com/aisahpA/obsidian-position-restore
*/
"use strict";var rt=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var ln=Object.getOwnPropertyNames;var dn=Object.prototype.hasOwnProperty;var cn=(r,e)=>{for(var t in e)rt(r,t,{get:e[t],enumerable:!0})},pn=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ln(e))!dn.call(r,n)&&n!==t&&rt(r,n,{get:()=>e[n],enumerable:!(i=an(e,n))||i.enumerable});return r};var hn=r=>pn(rt({},"__esModule",{value:!0}),r);var os={};cn(os,{default:()=>tt});module.exports=hn(os);var it=require("obsidian");var Wt=require("obsidian");var ie=require("obsidian");var Dt=require("obsidian");var st={"lastPosition.heading":"Last position","lastPosition.intro":"Every note remembers where its cursor sat and how far it was scrolled, and opening it again lands on that spot, with no flash at the top first and no jump afterwards.","openAndRestore.heading":"Open & restore","openAndRestore.linkOpenPosition.name":"When opening from a link","openAndRestore.linkOpenPosition.desc":"When you click a wikilink with no # heading or ^ block target: open at the file start, or return to the saved position. A link that names a target is landed by Obsidian itself, on the spot you clicked, and is out of reach here; other ways of opening (file explorer, search results, bookmarks, quick switcher) are unaffected too and land on the saved position.","openAndRestore.linkOpenPosition.options.start":"File start","openAndRestore.linkOpenPosition.options.restore":"Saved position","openAndRestore.restoreBreadcrumb.name":"Name the restored section","openAndRestore.restoreBreadcrumb.desc":"After a position is restored, briefly show the heading path of where you landed, but only when no heading is visible on screen. Nothing is shown when a heading is already in view (you can see where you are), when the note has only one heading, or when the note has exactly one level-1 heading, which is usually just the note title and already on the tab.","openAndRestore.flashLandingLine.name":"Mark the landing line","openAndRestore.flashLandingLine.desc":"Mark where you land: after a restore or back/forward, editing view marks the cursor line. In reading view, only a jump to a section marks that section.","recordingRules.heading":"Recording rules","recordingRules.folders.name":"Excluded folders","recordingRules.folders.desc":"Don't record the cursor/scroll position for files in these folders and their subfolders.","recordingRules.folders.list.empty":"No folders excluded","recordingRules.folders.add":"Add folder","recordingRules.folders.search.placeholder":"Type to search folders...","recordingRules.folders.search.empty":"No folders found","recordingRules.minLinesToRecord.name":"Do not record files shorter than","recordingRules.minLinesToRecord.desc":`Don't record the cursor/scroll position for a note with fewer lines than this value; views other than a note are not measured by line count. Set to "0" to disable this filter.`,"recordingRules.frontmatterExclude.name":"Exclude by frontmatter property/value","recordingRules.frontmatterExclude.desc":"Exclude a whole class of notes by frontmatter: a file matching any entry in the list is not recorded.","recordingRules.frontmatterExclude.formName":"A property name on its own (`status`): any file carrying the property is skipped, whatever its value.","recordingRules.frontmatterExclude.formValue":"A name with a value (`status: archived`): only files whose value equals it are skipped. yes/no/on/off compare as booleans; an array matches when any one element does.","recordingRules.frontmatterExclude.list.empty":"No properties excluded","recordingRules.frontmatterExclude.add":"Add property","recordingRules.frontmatterExclude.search.placeholder":"Type to search properties...","recordingRules.frontmatterExclude.search.empty":"No properties found","recordingRules.frontmatterExclude.value.title":"Exclude when {0} equals","recordingRules.frontmatterExclude.value.name":"Value","recordingRules.frontmatterExclude.value.desc":"Leave empty to exclude any file that has this property, whatever its value.","recordingRules.frontmatterExclude.value.placeholder":"e.g. true","recordingRules.frontmatterExclude.duplicate":"{0} is already in the list","recordingRules.escapeHatch.name":"Per-file override property","recordingRules.escapeHatch.desc":"This page can also be bypassed one file at a time: in its frontmatter, `{0}: false` means never record it \u2014 while `{0}: true` means record it anyway, over excluded folders, the minimum-length filter and the property rule above. Only true and false mean anything; write anything else and it reads as if you had never written the property.","recordingRules.recordBaseScroll.name":"Record scroll position for Base files","recordingRules.recordBaseScroll.desc":"A Base has no line numbers to anchor to the way Markdown does, so the only thing worth saving is the pixel offset you scrolled to. That stops meaning anything once the screen size differs: two devices syncing the database would overwrite each other's number. Off by default. This switch concerns Base alone. PDF reading positions are already remembered natively on each device, and images and other non-Markdown files have no scroll state worth keeping.","dataStorage.heading":"Data storage","dataStorage.dbFileName.name":"Database file","dataStorage.dbFileName.desc":"JSON file that stores position records.","dataStorage.dbFileName.current":"Current path: {0}","dataStorage.dbFileName.change":"Change","dataStorage.dbFileName.modal.title":"Set database file","dataStorage.dbFileName.modal.default":"Use default","dataStorage.dbFileName.modal.cancel":"Cancel","dataStorage.dbFileName.apply":"Confirm and apply","dataStorage.dbFileName.pickFolder":"Choose folder","dataStorage.dbFileName.pickFile":"Pick an existing JSON file in the vault","dataStorage.dbFileName.search.placeholder":"Type to search JSON files in the vault","dataStorage.dbFileName.search.empty":"No JSON file found","dataStorage.dbFileName.messages.default":"Using the default database file.","dataStorage.dbFileName.messages.invalid":"The database file must be a vault-relative path ending in .json.","dataStorage.dbFileName.messages.exists":"A file already exists at that path but is not a valid position database. Nothing was changed \u2014 pick another file or remove it first.","dataStorage.dbFileName.mergeHint":"If the chosen file already exists, its records are merged into the current database before moving there. If it does not exist, the current database is simply moved to it.","dataStorage.dbFileName.messages.merged":"Adopted the existing database file and merged {0} record(s) from it.","dataStorage.dbFileName.messages.moveFailed":"Failed to move the database file: {0}","dataStorage.dbFileName.messages.set":"Database file set to {0}","dataStorage.dbFileName.syncLocal":'Inside the plugin folder (the default). Obsidian Sync does not carry this file out of the plugin folder; to take positions to another device, click "Change" and point the path inside the vault. Whether other sync clients carry it depends on whether they sync the plugin folder.',"dataStorage.dbFileName.syncVault":"Inside the vault. This is an ordinary vault file, which any sync client can carry.","dataStorage.dbFileName.syncHidden":'Inside a hidden folder. Some sync clients skip folders whose name starts with ".".',"dataStorage.dbFileName.syncSummary":"Will Obsidian Sync carry this file?","dataStorage.dbFileName.syncHint":'Obsidian Sync takes only data.json, main.js, manifest.json and styles.css out of a community plugin folder, so the database never leaves the device it was written on while it sits in the default location. To make positions follow you between devices, point this setting at a path inside the vault \u2014 the buttons below pick or create the folder for you \u2014 and enable "Sync all other types" in Obsidian Sync on every device. Folders whose name starts with "." are never synced by Obsidian Sync, so choose an ordinary vault folder.',"dataStorage.corruptDb.notice":"Position Restore: The database file could not be parsed (a sync client may have been rewriting it). A copy was kept at {0}. Starting from empty \u2014 positions are re-recorded as you open notes.","dataStorage.corruptDb.noticeNoCopy":"Position Restore: The database file could not be parsed (a sync client may have been rewriting it) and no copy could be written, so its positions are unrecoverable. Starting from empty \u2014 positions are re-recorded as you open notes (see the console for details).","dataStorage.legacyDb.notice":"Position Restore: the data file is in the format an older version of the plugin wrote. Every position in it was read, and the next save writes the whole file in the current format. If another device still runs an older version, update it too: the older version cannot read the new file, treats it as empty and rewrites it whole, so only the notes opened on that device survive. While versions differ, every sync can drop a batch of positions.","dataStorage.legacyDb.noticeOverwritten":"Position Restore: the data file was just rewritten in the older format by a device that has not been updated yet. The older version cannot read the new file, so it wrote back only its own positions; everything another device had recorded in the new format is gone from the file. What this device recorded is untouched and goes back on the next save. Update the plugin on your other devices, or this repeats on every sync.","dataStorage.entries.name":"Entry count","dataStorage.entries.desc":"Currently recording positions for {0} files, up to 750 entries. When the limit is exceeded, the records sitting at the default position that have gone unvisited the longest are dropped first, then the rest least-recently-visited. Each pass drops well past the limit, so it does not trim again on every save.","dataStorage.entries.atDefault":"Of these, {0} sit at the default position (the first line after the frontmatter) and hold no actual position.","hotkeys.name":"Hotkeys","hotkeys.unbound":"Not bound","hotkeys.hint":"To bind one: use the keyboard button on this row to open Settings \u2192 Hotkeys. A bound key only fires from a physical keyboard.","hotkeys.open":"Open hotkey settings","hotkeys.openFailed":"Could not open the hotkey settings. Go to Settings \u2192 Hotkeys and find this plugin's commands there.","navHistory.heading":"Back and forward","navHistory.steps.heading":"Steps recorded","navHistory.intro":`Walk back through the order you came, VSCode-style "navigate back" / "navigate forward". Each of these takes a step: opening another note; jumping somewhere inside one, by a link, the outline or a search result; switching tabs; opening a view with no file behind it, such as the graph; and a cursor move that crosses many lines at once (desktop only). A switch inside one tab travels on Obsidian's own per-tab history, so PDF, canvas and the other views this plugin cannot reposition come back too. This history belongs to the device it was made on: it does not sync with the vault, and it survives restarts.`,"navHistory.hotkeys.desc":"One command per direction, walking the steps above. Neither is bound by default, so run either by name from the command palette.","navHistory.stackCap.name":"Back/forward steps kept","navHistory.stackCap.desc":"Maximum number of entries kept in the navigation history. When exceeded, the oldest entries are dropped first.","navHistory.recordActivation.name":"Record tab switches","navHistory.recordActivation.desc":"Clicking another tab pushes a step. Turned off, switching tabs stops leaving steps and the history keeps file opens and in-file jumps, except for views with no file behind them, such as the graph, which still take one: without that step, back from the graph would overshoot to an earlier note.","navHistory.teleportMinLines.name":"Minimum lines in one cursor move","navHistory.teleportMinLines.desc":"A cursor move crossing at least this many lines in one action, whether that is clicking a spot far away in the note, a go-to-line command, or a keyboard motion that crosses many lines at once, counts as an in-file jump and pushes a step. Set 0 to never record one, which is the default, since a step inferred from a cursor move is one the reader never asked for. Desktop only: the phone and tablet apps run no such detection.","navHistory.commands.navigateBack":"Navigate back","navHistory.commands.navigateForward":"Navigate forward","noteEdge.commands.top":"Go to top of note","noteEdge.commands.bottom":"Go to bottom of note","recentFiles.name":"Recent files","recentFiles.rules.heading":"What gets listed","recentFiles.display.heading":"Display","recentFiles.intro":"A list of the notes you opened recently: one row per note, with the main area's file-less views (the graph above all) taking a row each too, and a row opens that note. The filter can also search the headings inside each note: whichever ones it matches are drawn as rows beneath it, and one jumps straight to that section. The list belongs to the device it was made on: it does not sync with the vault, and it survives restarts.","recentFiles.folders.name":"Folders not listed","recentFiles.folders.desc":"Files in these folders are not added to the recent files list. Pinned rows are not affected.","recentFiles.folders.list.empty":"Every folder is listed.","recentFiles.folders.add":"Add folder","recentFiles.frontmatterExclude.name":"Properties not listed","recentFiles.frontmatterExclude.desc":"Exclude a whole class of notes by frontmatter: a file matching any entry in the list is never added to the recent files list. Pinned rows are not affected.","recentFiles.frontmatterExclude.formName":"A property name on its own (`status`): any file carrying the property is left out, whatever its value.","recentFiles.frontmatterExclude.formValue":"A name with a value (`status: archived`): only files whose value equals it are left out. yes/no/on/off compare as booleans; an array matches when any one element does.","recentFiles.frontmatterExclude.list.empty":"Every file is listed.","recentFiles.frontmatterExclude.add":"Add property","recentFiles.excludeImages.name":"Leave out images","recentFiles.excludeImages.desc":"Opening an image file no longer adds it to the recent files list. Turning this on also drops the image rows already on the list (pinned rows are left alone); turning it off starts listing images again, but the rows it dropped do not come back.","recentFiles.cap.name":"Notes to remember","recentFiles.cap.desc":"How many notes the recent files list remembers (a view counts as one). Past that, the ones you have not opened for the longest are dropped; lowering it takes effect at once, and what it drops does not come back. Pinned rows do not count.","recentFiles.outlineSearch.name":"Search headings","recentFiles.outlineSearch.desc":"Whether the filter matches the headings inside each note, on top of its name (and its aliases and path). On: every heading it matches is drawn as a row beneath that note, five at most, and clicking one jumps to it. Off: a query only ever names the note itself.","recentFiles.pathDisplay.name":"Folder path in the list","recentFiles.pathDisplay.desc":"Whether a row shows the folder its note sits in, on every row or only where another row on screen shares the name, and on which side of the name. The side also decides which half gives way when the row runs out of width: the one laid out last drops to a second line.","recentFiles.pathDisplay.options.smart":"Only when names repeat","recentFiles.pathDisplay.options.before":"Always, before the name","recentFiles.pathDisplay.options.after":"Always, after the name","recentFiles.rowTime.name":"Time on each row","recentFiles.rowTime.desc":"Show how long ago each row was last visited. That is the last time you were there, and not the file's modification time. The exact moment is one hover away, on the label itself.","recentFiles.titleProperty.name":"Name from a property","recentFiles.titleProperty.desc":"Which frontmatter property a row shows as the note's name. Pick \u201CTitle\u201D or \u201CAliases\u201D, or type a custom property name; leave empty (off) to keep the file name. A list value uses its first item.","recentFiles.titleProperty.placeholder":"e.g. title","recentFiles.titleProperty.off":"Off (file name)","recentFiles.titleProperty.optTitle":"Title (title)","recentFiles.titleProperty.optAliases":"Aliases (aliases)","recentFiles.titleProperty.custom":"Custom property\u2026","recentFiles.age.now":"now","recentFiles.age.m":"m ago","recentFiles.age.h":"h ago","recentFiles.age.d":"d ago","recentFiles.age.w":"w ago","recentFiles.age.mo":"mo ago","recentFiles.age.y":"y ago","recentFiles.title":"title:","recentFiles.aliases":"aliases:","recentFiles.openInNewTab":"Open in new tab","recentFiles.openHereInNewTab":"Open here in a new tab","recentFiles.forget":"Remove from recent files","recentFiles.clearList":"Clear the whole list","recentFiles.rowMenu":"More actions","recentFiles.pin":"Pin to top","recentFiles.unpin":"Unpin","recentFiles.unpinExcluded":"Unpin and remove from list","recentFiles.unpin.removedByRule":"Unpinned: this row matches the \u201C{0}\u201D rule and was removed from the list.","recentFiles.unpin.removed":"Unpinned. The row was removed from the list.","recentFiles.unpin.undo":"Undo","recentFiles.pinUp":"Move up","recentFiles.pinDown":"Move down","recentFiles.pinFirst":"Move to front","recentFiles.pinLast":"Move to end","recentFiles.commands.open":"Browse recent files","recentFiles.commands.openSidebar":"Open recent files in sidebar","recentFiles.hotkeys.desc":"Two ways into the list: a dialog that answers once and closes, or a panel that stays in the sidebar. Neither is bound by default, so the command palette opens either by name.","recentFiles.graphView":"Graph view","recentFiles.viewBadge":"View","recentFiles.searchPlaceholder":"Filter by note name or text\u2026","recentFiles.clearFilter":"Clear filter","recentFiles.close":"Close","recentFiles.noMatch":"No matching entry.","recentFiles.empty":"Nowhere to go.","recentFiles.moreHits":"{0} more matching sections","previewFocus.recentFiles.name":"Where hovering a row opens the note","previewFocus.recentFiles.desc":"Where the preview card opens a note hovered on a row: at its top, or where you last left off in that note. The latter is exactly where clicking the row lands you, visible without actually opening the note, but it costs a wait: the card draws the whole note from the top first and only then moves to that line, so on a long note you first see an empty card that then jumps over. Notes with no saved position still open at the top. Rows produced by a heading search are unaffected; they always preview that section directly.","previewFocus.recentFiles.options.head":"Note top","previewFocus.recentFiles.options.line":"Where you left off","previewFocus.fileExplorer.name":"Where a file list preview opens the note","previewFocus.fileExplorer.desc":"When you hover a file in Obsidian's own file list, where the preview card opens the note: at its top (Obsidian's native behavior), or where you last left off in that note. The saved spot costs a wait: the card draws the whole note from the top first and only then moves to that line, so on a long note it flashes empty and then jumps. The line used is the last one recorded; it is not recomputed against the note's current contents, so after the note has been edited on another device the preview may stop somewhere other than where you left it. Notes with no saved position still open at the top.","previewFocus.fileExplorer.options.head":"Note top","previewFocus.fileExplorer.options.line":"Where you left off"};var Nt={"lastPosition.heading":"\u6700\u540E\u4F4D\u7F6E","lastPosition.intro":"\u6BCF\u7BC7\u7B14\u8BB0\u90FD\u8BB0\u5F97\u5149\u6807\u505C\u5728\u54EA\u4E00\u884C\u3001\u6EDA\u5230\u4E86\u54EA\u91CC\uFF0C\u518D\u6B21\u6253\u5F00\u76F4\u63A5\u843D\u56DE\u90A3\u4E00\u5904\uFF0C\u4E0D\u4F1A\u5148\u5728\u6587\u4EF6\u9876\u90E8\u95EA\u4E00\u4E0B\u518D\u8DF3\u8FC7\u53BB\u3002","openAndRestore.heading":"\u6253\u5F00\u4E0E\u6062\u590D","openAndRestore.linkOpenPosition.name":"\u70B9\u53CC\u94FE\u6253\u5F00\u65F6","openAndRestore.linkOpenPosition.desc":"\u70B9\u4E0D\u5E26 # \u6807\u9898\u6216 ^ \u5757\u76EE\u6807\u7684\u53CC\u94FE\u65F6\uFF0C\u4ECE\u6587\u4EF6\u5F00\u5934\u6253\u5F00\uFF0C\u8FD8\u662F\u56DE\u5230\u5DF2\u4FDD\u5B58\u7684\u4F4D\u7F6E\u3002\u5E26\u76EE\u6807\u7684\u53CC\u94FE\u7531 Obsidian \u81EA\u5DF1\u843D\u5230\u4F60\u70B9\u7684\u90A3\u4E00\u5904\uFF0C\u8FD9\u91CC\u7BA1\u4E0D\u7740\uFF1B\u5176\u5B83\u6253\u5F00\u65B9\u5F0F\uFF08\u6587\u4EF6\u5217\u8868\u3001\u641C\u7D22\u7ED3\u679C\u3001\u4E66\u7B7E\u3001\u5FEB\u901F\u5207\u6362\u5668\uFF09\u4E5F\u4E0D\u53D7\u5F71\u54CD\uFF0C\u4E00\u5F8B\u56DE\u5230\u5DF2\u4FDD\u5B58\u7684\u4F4D\u7F6E\u3002","openAndRestore.linkOpenPosition.options.start":"\u6587\u4EF6\u5F00\u5934","openAndRestore.linkOpenPosition.options.restore":"\u5DF2\u4FDD\u5B58\u7684\u4F4D\u7F6E","openAndRestore.restoreBreadcrumb.name":"\u6253\u5F00\u7B14\u8BB0\u65F6\u63D0\u793A\u6240\u5728\u5C0F\u8282","openAndRestore.restoreBreadcrumb.desc":"\u6062\u590D\u4F4D\u7F6E\u540E\uFF0C\u5982\u679C\u8FD9\u4E00\u5C4F\u91CC\u770B\u4E0D\u5230\u4EFB\u4F55\u5C0F\u8282\u6807\u9898\uFF0C\u5C31\u5728\u7B14\u8BB0\u4E2D\u95F4\u77ED\u6682\u663E\u793A\u4F60\u6240\u5728\u7684\u5C0F\u8282\u8DEF\u5F84\u3002\u6807\u9898\u5DF2\u7ECF\u5728\u5C4F\u5E55\u4E0A\u65F6\u4E0D\u663E\u793A\uFF08\u4E00\u773C\u5C31\u80FD\u770B\u51FA\u843D\u5728\u54EA\u4E00\u8282\uFF09\uFF1B\u6574\u7BC7\u53EA\u6709\u4E00\u4E2A\u6807\u9898\u65F6\u4E5F\u4E0D\u663E\u793A\uFF1B\u6574\u7BC7\u53EA\u6709\u4E00\u4E2A\u4E00\u7EA7\u6807\u9898\u65F6\uFF0C\u90A3\u591A\u534A\u5C31\u662F\u6587\u7AE0\u6807\u9898\uFF0C\u6807\u7B7E\u9875\u4E0A\u5DF2\u7ECF\u5199\u7740\uFF0C\u4E0D\u518D\u5FF5\u4E00\u904D\u3002","openAndRestore.flashLandingLine.name":"\u6807\u51FA\u843D\u70B9\u90A3\u4E00\u884C","openAndRestore.flashLandingLine.desc":"\u6807\u51FA\u5230\u8FBE\u7684\u4F4D\u7F6E\uFF1A\u6062\u590D\u4F4D\u7F6E\u6216\u524D\u8FDB/\u540E\u9000\u540E\uFF0C\u7F16\u8F91\u6A21\u5F0F\u6807\u51FA\u5149\u6807\u6240\u5728\u884C\uFF1B\u9605\u8BFB\u6A21\u5F0F\u53EA\u5728\u8DF3\u8F6C\u5230\u5C0F\u8282\u65F6\u6807\u51FA\u8BE5\u5C0F\u8282\u3002","recordingRules.heading":"\u8BB0\u5F55\u89C4\u5219","recordingRules.folders.name":"\u6392\u9664\u7684\u6587\u4EF6\u5939","recordingRules.folders.desc":"\u4E0D\u8BB0\u5F55\u8FD9\u4E9B\u6587\u4EF6\u5939\u53CA\u5B50\u6587\u4EF6\u5939\u4E2D\u6587\u4EF6\u7684\u5149\u6807\u548C\u6EDA\u52A8\u4F4D\u7F6E\u3002","recordingRules.folders.list.empty":"\u672A\u6392\u9664\u4EFB\u4F55\u6587\u4EF6\u5939","recordingRules.folders.add":"\u6DFB\u52A0\u6587\u4EF6\u5939","recordingRules.folders.search.placeholder":"\u8F93\u5165\u4EE5\u641C\u7D22\u6587\u4EF6\u5939\u2026","recordingRules.folders.search.empty":"\u672A\u627E\u5230\u6587\u4EF6\u5939","recordingRules.minLinesToRecord.name":"\u4E0D\u8BB0\u5F55\u8FC7\u77ED\u6587\u4EF6","recordingRules.minLinesToRecord.desc":"\u884C\u6570\u5C11\u4E8E\u6B64\u503C\u7684\u7B14\u8BB0\u4E0D\u8BB0\u5F55\u5B83\u7684\u5149\u6807\u548C\u6EDA\u52A8\u4F4D\u7F6E\uFF0C\u5176\u5B83\u89C6\u56FE\u4E0D\u770B\u884C\u6570\u3002\u8BBE\u4E3A\u201C0\u201D\u53EF\u5173\u95ED\u8FD9\u6761\u8FC7\u6EE4\u3002","recordingRules.frontmatterExclude.name":"\u6309 frontmatter \u5C5E\u6027/\u503C\u6392\u9664","recordingRules.frontmatterExclude.desc":"\u6309 frontmatter \u6392\u9664\u4E00\u6574\u7C7B\u7B14\u8BB0\uFF1A\u547D\u4E2D\u5217\u8868\u91CC\u4EFB\u4E00\u6761\u76EE\u7684\u6587\u4EF6\uFF0C\u4E0D\u8BB0\u5F55\u5B83\u7684\u4F4D\u7F6E\u3002","recordingRules.frontmatterExclude.formName":"\u53EA\u5199\u5C5E\u6027\u540D\uFF08\u5982 `status`\uFF09\uFF1A\u6587\u4EF6\u53EA\u8981\u5E26\u8FD9\u4E2A\u5C5E\u6027\u5C31\u4E0D\u8BB0\u5F55\uFF0C\u4E0D\u8BBA\u503C\u662F\u591A\u5C11\u3002","recordingRules.frontmatterExclude.formValue":"\u5199\u6210 `\u5C5E\u6027: \u503C`\uFF08\u5982 `status: archived`\uFF09\uFF1A\u53EA\u6709\u503C\u76F8\u7B49\u624D\u4E0D\u8BB0\u5F55\u3002yes/no/on/off \u6309\u5E03\u5C14\u6BD4\u8F83\uFF1B\u6570\u7EC4\u91CC\u4EFB\u4E00\u5143\u7D20\u76F8\u7B49\u5373\u7B97\u547D\u4E2D\u3002","recordingRules.frontmatterExclude.list.empty":"\u672A\u6392\u9664\u4EFB\u4F55\u5C5E\u6027","recordingRules.frontmatterExclude.add":"\u6DFB\u52A0\u5C5E\u6027","recordingRules.frontmatterExclude.search.placeholder":"\u8F93\u5165\u4EE5\u641C\u7D22\u5C5E\u6027\u2026","recordingRules.frontmatterExclude.search.empty":"\u672A\u627E\u5230\u5C5E\u6027","recordingRules.frontmatterExclude.value.title":"{0} \u7B49\u4E8E\u4EE5\u4E0B\u503C\u65F6\u6392\u9664","recordingRules.frontmatterExclude.value.name":"\u503C","recordingRules.frontmatterExclude.value.desc":"\u7559\u7A7A\u8868\u793A\u53EA\u8981\u6587\u4EF6\u542B\u8BE5\u5C5E\u6027\u5373\u6392\u9664\uFF0C\u65E0\u8BBA\u5176\u503C\u5982\u4F55\u3002","recordingRules.frontmatterExclude.value.placeholder":"\u5982 true","recordingRules.frontmatterExclude.duplicate":"{0} \u5DF2\u5728\u5217\u8868\u4E2D","recordingRules.escapeHatch.name":"\u5355\u6587\u4EF6\u8986\u76D6\u5C5E\u6027","recordingRules.escapeHatch.desc":"\u4E5F\u53EF\u4EE5\u7ED5\u8FC7\u8FD9\u4E2A\u9875\u9762\uFF0C\u8BA9\u67D0\u4E00\u7BC7\u81EA\u5DF1\u51B3\u5B9A\uFF1A\u5728\u5B83\u7684 frontmatter \u91CC\u5199 `{0}: false`\uFF0C\u8FD9\u7BC7\u6C38\u4E0D\u8BB0\u5F55\uFF1B\u5199 `{0}: true`\uFF0C\u5219\u8FDE\u6392\u9664\u7684\u6587\u4EF6\u5939\u3001\u6700\u77ED\u884C\u6570\u548C\u4E0A\u9762\u7684\u5C5E\u6027\u89C4\u5219\u4E00\u8D77\u538B\u8FC7\u53BB\uFF0C\u7167\u8BB0\u4E0D\u8BEF\u3002\u53EA\u8BA4 true / false\uFF0C\u5199\u522B\u7684\u503C\u7B49\u4E8E\u6CA1\u5199\u3002","recordingRules.recordBaseScroll.name":"\u8BB0\u5F55 Base \u6587\u4EF6\u7684\u6EDA\u52A8\u4F4D\u7F6E","recordingRules.recordBaseScroll.desc":"Base \u6587\u4EF6\u4E0D\u50CF Markdown \u90A3\u6837\u6709\u884C\u53F7\u53EF\u4F9B\u951A\u5B9A\uFF0C\u80FD\u5B58\u7684\u53EA\u6709\u6EDA\u8FC7\u7684\u50CF\u7D20\u6570\uFF0C\u5C4F\u5E55\u5C3A\u5BF8\u4E00\u53D8\u5C31\u5BF9\u4E0D\u4E0A\uFF0C\u6570\u636E\u6587\u4EF6\u8DE8\u8BBE\u5907\u540C\u6B65\u65F6\u8FD8\u4F1A\u88AB\u53E6\u4E00\u53F0\u8BBE\u5907\u7684\u8BB0\u5F55\u8986\u76D6\uFF0C\u6240\u4EE5\u9ED8\u8BA4\u5173\u7740\u3002\u8FD9\u4E2A\u5F00\u5173\u53EA\u7BA1 Base\u3002PDF \u7684\u9605\u8BFB\u4F4D\u7F6E Obsidian \u539F\u751F\u5DF2\u5728\u6BCF\u53F0\u8BBE\u5907\u4E0A\u8BB0\u4F4F\uFF1B\u56FE\u7247\u7B49\u5176\u4ED6\u975E Markdown \u6587\u4EF6\uFF0C\u4E5F\u6CA1\u6709\u503C\u5F97\u8BB0\u5F55\u7684\u6EDA\u52A8\u72B6\u6001\u3002","dataStorage.heading":"\u6570\u636E\u5B58\u50A8","dataStorage.dbFileName.name":"\u6570\u636E\u6587\u4EF6","dataStorage.dbFileName.desc":"\u4FDD\u5B58\u4F4D\u7F6E\u8BB0\u5F55\u7684 JSON \u6587\u4EF6\u3002","dataStorage.dbFileName.current":"\u5F53\u524D\u8DEF\u5F84\uFF1A{0}","dataStorage.dbFileName.change":"\u66F4\u6539","dataStorage.dbFileName.modal.title":"\u8BBE\u7F6E\u6570\u636E\u6587\u4EF6","dataStorage.dbFileName.modal.default":"\u6062\u590D\u9ED8\u8BA4","dataStorage.dbFileName.modal.cancel":"\u53D6\u6D88","dataStorage.dbFileName.apply":"\u786E\u8BA4\u5E76\u5E94\u7528","dataStorage.dbFileName.pickFolder":"\u9009\u62E9\u6587\u4EF6\u5939","dataStorage.dbFileName.pickFile":"\u4ECE\u4ED3\u5E93\u5DF2\u6709\u7684 JSON \u6587\u4EF6\u4E2D\u9009\u62E9","dataStorage.dbFileName.search.placeholder":"\u8F93\u5165\u4EE5\u641C\u7D22\u4ED3\u5E93\u5185\u7684 JSON \u6587\u4EF6","dataStorage.dbFileName.search.empty":"\u672A\u627E\u5230 JSON \u6587\u4EF6","dataStorage.dbFileName.messages.default":"\u5F53\u524D\u4F7F\u7528\u9ED8\u8BA4\u6570\u636E\u6587\u4EF6\u3002","dataStorage.dbFileName.messages.invalid":"\u6570\u636E\u6587\u4EF6\u5FC5\u987B\u662F\u4ED3\u5E93\u5185\u7684\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4E14\u9700\u4EE5 .json \u7ED3\u5C3E\u3002","dataStorage.dbFileName.messages.exists":"\u8BE5\u8DEF\u5F84\u5DF2\u5B58\u5728\u6587\u4EF6\uFF0C\u4F46\u5B83\u4E0D\u662F\u6709\u6548\u7684\u672C\u63D2\u4EF6\u6570\u636E\u6587\u4EF6\u3002\u672A\u505A\u4EFB\u4F55\u6539\u52A8\uFF0C\u8BF7\u53E6\u9009\u6587\u4EF6\u6216\u5148\u624B\u52A8\u5220\u9664\u5B83\u3002","dataStorage.dbFileName.mergeHint":"\u82E5\u6240\u9009\u6587\u4EF6\u5DF2\u5B58\u5728\uFF0C\u4F1A\u5148\u5C06\u5176\u4E2D\u7684\u8BB0\u5F55\u5408\u5E76\u5230\u5F53\u524D\u6570\u636E\uFF0C\u518D\u79FB\u52A8\u8FC7\u53BB\uFF1B\u6587\u4EF6\u4E0D\u5B58\u5728\u65F6\u5219\u76F4\u63A5\u79FB\u52A8\u3002","dataStorage.dbFileName.messages.merged":"\u5DF2\u91C7\u7528\u73B0\u6709\u6570\u636E\u6587\u4EF6\uFF0C\u5E76\u5408\u5E76\u4E86\u5176\u4E2D {0} \u6761\u8BB0\u5F55\u3002","dataStorage.dbFileName.messages.moveFailed":"\u79FB\u52A8\u6570\u636E\u6587\u4EF6\u5931\u8D25\uFF1A{0}","dataStorage.dbFileName.messages.set":"\u6570\u636E\u6587\u4EF6\u5DF2\u8BBE\u4E3A {0}","dataStorage.dbFileName.syncLocal":"\u4F4D\u4E8E\u63D2\u4EF6\u76EE\u5F55\u5185\uFF08\u9ED8\u8BA4\uFF09\u3002Obsidian Sync \u4E0D\u4F1A\u4ECE\u63D2\u4EF6\u76EE\u5F55\u5E26\u8D70\u8FD9\u4E2A\u6587\u4EF6\uFF1B\u60F3\u8BA9\u4F4D\u7F6E\u8DDF\u7740\u6362\u8BBE\u5907\uFF0C\u70B9\u300C\u66F4\u6539\u300D\u628A\u8DEF\u5F84\u6539\u5230\u4ED3\u5E93\u5185\u3002\u5176\u4ED6\u540C\u6B65\u5DE5\u5177\u662F\u5426\u5E26\u8D70\u5B83\uFF0C\u53D6\u51B3\u4E8E\u5B83\u4EEC\u4F1A\u4E0D\u4F1A\u540C\u6B65\u63D2\u4EF6\u76EE\u5F55\u3002","dataStorage.dbFileName.syncVault":"\u4F4D\u4E8E\u4ED3\u5E93\u5185\u3002\u8FD9\u662F\u4E00\u4E2A\u666E\u901A\u4ED3\u5E93\u6587\u4EF6\uFF0C\u4EFB\u4F55\u540C\u6B65\u5DE5\u5177\u90FD\u80FD\u540C\u6B65\u5B83\u3002","dataStorage.dbFileName.syncHidden":"\u4F4D\u4E8E\u9690\u85CF\u6587\u4EF6\u5939\u5185\u3002\u90E8\u5206\u540C\u6B65\u5DE5\u5177\u4F1A\u8DF3\u8FC7\u4EE5\u201C.\u201D\u5F00\u5934\u7684\u6587\u4EF6\u5939\u3002","dataStorage.dbFileName.syncSummary":"\u8FD9\u4E2A\u6587\u4EF6\u4F1A\u88AB Obsidian Sync \u540C\u6B65\u5417\uFF1F","dataStorage.dbFileName.syncHint":"Obsidian Sync \u53EA\u4F1A\u4ECE\u793E\u533A\u63D2\u4EF6\u76EE\u5F55\u4E2D\u540C\u6B65 data.json\u3001main.js\u3001manifest.json \u548C styles.css\uFF0C\u56E0\u6B64\u6570\u636E\u6587\u4EF6\u7559\u5728\u9ED8\u8BA4\u4F4D\u7F6E\u65F6\u4E0D\u4F1A\u79BB\u5F00\u5199\u5165\u5B83\u7684\u90A3\u53F0\u8BBE\u5907\u3002\u60F3\u8BA9\u4F4D\u7F6E\u5728\u8BBE\u5907\u4E4B\u95F4\u8DDF\u7740\u4F60\u8D70\uFF0C\u8BF7\u628A\u6570\u636E\u6587\u4EF6\u6307\u5411\u4ED3\u5E93\u5185\u7684\u8DEF\u5F84\uFF08\u7528\u4E0B\u65B9\u7684\u6309\u94AE\u9009\u62E9\u6216\u65B0\u5EFA\u6587\u4EF6\u5939\uFF09\uFF0C\u5E76\u5728\u6BCF\u53F0\u8BBE\u5907\u7684 Obsidian Sync \u4E2D\u5F00\u542F\u201C\u540C\u6B65\u5176\u4ED6\u6240\u6709\u7C7B\u578B\u6587\u4EF6\u201D\u3002\u4EE5\u201C.\u201D\u5F00\u5934\u7684\u6587\u4EF6\u5939\u6C38\u8FDC\u4E0D\u4F1A\u88AB Obsidian Sync \u540C\u6B65\uFF0C\u8BF7\u9009\u62E9\u666E\u901A\u7684\u4ED3\u5E93\u6587\u4EF6\u5939\u3002","dataStorage.corruptDb.notice":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u65E0\u6CD5\u89E3\u6790\uFF08\u53EF\u80FD\u6B63\u88AB\u540C\u6B65\u5DE5\u5177\u6539\u5199\uFF09\uFF0C\u5DF2\u4FDD\u7559\u4E00\u4EFD\u526F\u672C\uFF1A{0}\u3002\u672C\u6B21\u4ECE\u7A7A\u6570\u636E\u7EE7\u7EED\uFF0C\u91CD\u65B0\u6253\u5F00\u7B14\u8BB0\u4F1A\u91CD\u65B0\u8BB0\u5F55\u4F4D\u7F6E\u3002","dataStorage.corruptDb.noticeNoCopy":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u65E0\u6CD5\u89E3\u6790\uFF08\u53EF\u80FD\u6B63\u88AB\u540C\u6B65\u5DE5\u5177\u6539\u5199\uFF09\uFF0C\u4E14\u672A\u80FD\u5199\u51FA\u526F\u672C\uFF0C\u5176\u4E2D\u7684\u4F4D\u7F6E\u8BB0\u5F55\u65E0\u6CD5\u627E\u56DE\u3002\u672C\u6B21\u4ECE\u7A7A\u6570\u636E\u7EE7\u7EED\uFF0C\u91CD\u65B0\u6253\u5F00\u7B14\u8BB0\u4F1A\u91CD\u65B0\u8BB0\u5F55\u4F4D\u7F6E\uFF08\u8BE6\u60C5\u89C1\u63A7\u5236\u53F0\uFF09\u3002","dataStorage.legacyDb.notice":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u662F\u65E7\u7248\u63D2\u4EF6\u5199\u5165\u7684\u683C\u5F0F\uFF0C\u4F4D\u7F6E\u8BB0\u5F55\u5DF2\u5168\u90E8\u8BFB\u51FA\uFF0C\u4E0B\u6B21\u4FDD\u5B58\u65F6\u4F1A\u4EE5\u65B0\u7248\u683C\u5F0F\u6574\u4EFD\u5199\u56DE\u3002\u82E5\u5176\u4ED6\u8BBE\u5907\u4E0A\u7684\u672C\u63D2\u4EF6\u4ECD\u662F\u65E7\u7248\uFF0C\u8BF7\u4E00\u5E76\u66F4\u65B0\uFF1A\u65E7\u7248\u8BFB\u4E0D\u61C2\u65B0\u7248\u6587\u4EF6\uFF0C\u4F1A\u628A\u5B83\u5F53\u6210\u7A7A\u6587\u4EF6\u6574\u4EFD\u91CD\u5199\uFF0C\u53EA\u5269\u90A3\u53F0\u8BBE\u5907\u81EA\u5DF1\u6253\u5F00\u8FC7\u7684\u7B14\u8BB0\u3002\u4E24\u7AEF\u7248\u672C\u4E0D\u4E00\u81F4\u65F6\uFF0C\u6BCF\u540C\u6B65\u4E00\u6B21\u5C31\u53EF\u80FD\u4E22\u4E00\u6279\u4F4D\u7F6E\u3002","dataStorage.legacyDb.noticeOverwritten":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u521A\u88AB\u53E6\u4E00\u53F0\u5C1A\u672A\u66F4\u65B0\u7684\u8BBE\u5907\u91CD\u5199\u6210\u65E7\u7248\u683C\u5F0F\u3002\u65E7\u7248\u8BFB\u4E0D\u61C2\u65B0\u7248\u6587\u4EF6\uFF0C\u53EA\u5199\u56DE\u5B83\u81EA\u5DF1\u90A3\u4E00\u4EFD\uFF0C\u4E8E\u662F\u6587\u4EF6\u4E2D\u7531\u65B0\u7248\u8BB0\u5F55\u7684\u4F4D\u7F6E\u5DF2\u7ECF\u4E0D\u5728\u4E86\u3002\u672C\u673A\u8BB0\u5F55\u7684\u4F4D\u7F6E\u4E0D\u53D7\u5F71\u54CD\uFF0C\u4E0B\u6B21\u4FDD\u5B58\u4F1A\u4E00\u5E76\u5199\u56DE\u3002\u8BF7\u66F4\u65B0\u5176\u4ED6\u8BBE\u5907\u4E0A\u7684\u672C\u63D2\u4EF6\uFF0C\u5426\u5219\u6BCF\u6B21\u540C\u6B65\u90FD\u4F1A\u91CD\u6F14\u4E00\u6B21\u3002","dataStorage.entries.name":"\u8BB0\u5F55\u6570","dataStorage.entries.desc":"\u5F53\u524D\u8BB0\u5F55\u4E86 {0} \u4E2A\u6587\u4EF6\u7684\u4F4D\u7F6E\uFF0C\u6700\u591A 750 \u6761\u3002\u8D85\u51FA\u540E\u5148\u79FB\u9664\u505C\u5728\u9ED8\u8BA4\u4F4D\u7F6E\u3001\u53C8\u8F83\u4E45\u6CA1\u6253\u5F00\u8FC7\u7684\u8BB0\u5F55\uFF0C\u5176\u4F59\u6309\u6700\u4E45\u672A\u8BBF\u95EE\u79FB\u9664\uFF1B\u4E00\u6B21\u4F1A\u591A\u6E05\u6389\u4E00\u4E9B\uFF0C\u4E0D\u4F1A\u8D34\u7740\u4E0A\u9650\u53CD\u590D\u6E05\u3002","dataStorage.entries.atDefault":"\u5176\u4E2D {0} \u4E2A\u505C\u5728\u9ED8\u8BA4\u4F4D\u7F6E\uFF08frontmatter \u4E0B\u9762\u7B2C\u4E00\u884C\uFF09\uFF0C\u6CA1\u6709\u8BB0\u4E0B\u5B9E\u9645\u4F4D\u7F6E\u3002","hotkeys.name":"\u5FEB\u6377\u952E","hotkeys.unbound":"\u672A\u7ED1\u5B9A","hotkeys.hint":"\u60F3\u7ED1\u5230\u67D0\u4E2A\u952E\uFF1A\u7528\u672C\u884C\u7684\u952E\u76D8\u6309\u94AE\u6253\u5F00\u300C\u8BBE\u7F6E \u2192 \u5FEB\u6377\u952E\u300D\u3002\u7ED1\u597D\u4E4B\u540E\u8981\u9760\u7269\u7406\u952E\u76D8\u624D\u6309\u5F97\u51FA\u6765\u3002","hotkeys.open":"\u6253\u5F00\u5FEB\u6377\u952E\u8BBE\u7F6E","hotkeys.openFailed":"\u6CA1\u80FD\u6253\u5F00\u5FEB\u6377\u952E\u8BBE\u7F6E\uFF0C\u8BF7\u5230\u300C\u8BBE\u7F6E \u2192 \u5FEB\u6377\u952E\u300D\u91CC\u627E\u5230\u672C\u63D2\u4EF6\u7684\u547D\u4EE4\u3002","navHistory.heading":"\u524D\u8FDB\u4E0E\u540E\u9000","navHistory.steps.heading":"\u8BB0\u5F55\u54EA\u4E9B\u6B65","navHistory.intro":"\u6309\u4F60\u8D70\u8FC7\u7684\u987A\u5E8F\u5F80\u56DE\u8D70\uFF0C\u7C7B\u4F3C VSCode \u7684\u201C\u540E\u9000 / \u524D\u8FDB\u201D\u3002\u4E0B\u9762\u8FD9\u4E9B\u52A8\u4F5C\u4F1A\u5404\u5360\u4E00\u6B65\uFF1A\u6253\u5F00\u53E6\u4E00\u7BC7\u7B14\u8BB0\uFF1B\u70B9\u94FE\u63A5\u3001\u5927\u7EB2\u6216\u641C\u7D22\u7ED3\u679C\u8DF3\u5230\u7B14\u8BB0\u91CC\u7684\u67D0\u4E00\u5904\uFF1B\u5207\u6362\u6807\u7B7E\u9875\uFF1B\u6253\u5F00\u56FE\u8C31\u8FD9\u7C7B\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\uFF1B\u5149\u6807\u4E00\u6B21\u6027\u8DE8\u8FC7\u5F88\u591A\u884C\u7684\u79FB\u52A8\uFF08\u4EC5\u7535\u8111\u7AEF\uFF09\u3002\u540C\u4E00\u6807\u7B7E\u9875\u5185\u7684\u5207\u6362\u501F Obsidian \u81EA\u5DF1\u7684\u6807\u7B7E\u9875\u5386\u53F2\u8D70\u56DE\u53BB\uFF0CPDF\u3001Canvas \u8FD9\u7C7B\u672C\u63D2\u4EF6\u5B9A\u4F4D\u4E0D\u4E86\u7684\u89C6\u56FE\u4E5F\u7167\u6837\u56DE\u5F97\u53BB\u3002\u8FD9\u4EFD\u5386\u53F2\u53EA\u7559\u5728\u8FD9\u53F0\u8BBE\u5907\u4E0A\uFF0C\u4E0D\u968F\u4ED3\u5E93\u540C\u6B65\uFF1B\u91CD\u542F\u4E4B\u540E\u8FD8\u5728\u3002","navHistory.hotkeys.desc":"\u4E00\u4E2A\u65B9\u5411\u4E00\u4E2A\u547D\u4EE4\uFF0C\u8D70\u7684\u6B63\u662F\u4E0A\u9762\u90A3\u4E9B\u6B65\u3002\u9ED8\u8BA4\u90FD\u4E0D\u7ED1\u5FEB\u6377\u952E\uFF0C\u5728\u547D\u4EE4\u9762\u677F\u91CC\u6309\u540D\u5B57\u8FD0\u884C\u5373\u53EF\u3002","navHistory.stackCap.name":"\u524D\u8FDB/\u540E\u9000\u4FDD\u7559\u6B65\u6570","navHistory.stackCap.desc":"\u5BFC\u822A\u5386\u53F2\u6700\u591A\u4FDD\u7559\u7684\u6761\u76EE\u6570\uFF0C\u8D85\u51FA\u540E\u4F18\u5148\u4E22\u5F03\u6700\u65E7\u7684\u8BB0\u5F55\u3002","navHistory.recordActivation.name":"\u8BB0\u5F55\u6807\u7B7E\u9875\u5207\u6362","navHistory.recordActivation.desc":"\u70B9\u51FB\u5176\u4ED6\u6807\u7B7E\u9875\u4F1A\u5F80\u5386\u53F2\u91CC\u63A8\u5165\u4E00\u6B65\u3002\u5173\u95ED\u540E\uFF0C\u5207\u6807\u7B7E\u9875\u4E0D\u518D\u7559\u4E0B\u6B65\u9AA4\uFF0C\u5386\u53F2\u53EA\u8BB0\u6587\u4EF6\u6253\u5F00\u4E0E\u6587\u4EF6\u5185\u8DF3\u8F6C\uFF1B\u5173\u7CFB\u56FE\u8C31\u8FD9\u7C7B\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\u662F\u4F8B\u5916\uFF0C\u4ECD\u5404\u5360\u4E00\u6B65\uFF0C\u5426\u5219\u5728\u56FE\u8C31\u91CC\u6309\u540E\u9000\u4F1A\u9000\u8FC7\u5934\uFF0C\u843D\u5230\u66F4\u65E9\u7684\u90A3\u4E00\u7BC7\u3002","navHistory.teleportMinLines.name":"\u5149\u6807\u4E00\u6B21\u8DE8\u8D8A\u591A\u5C11\u884C\u624D\u7B97\u4E00\u6B65","navHistory.teleportMinLines.desc":"\u5149\u6807\u4E00\u6B21\u79FB\u52A8\u8DE8\u8FC7\u8FD9\u4E48\u591A\u884C\uFF0C\u5C31\u5F53\u4F5C\u4E00\u6B21\u6587\u4EF6\u5185\u8DF3\u8F6C\uFF0C\u5F80\u5386\u53F2\u91CC\u63A8\u5165\u4E00\u6B65\uFF1A\u5728\u7B14\u8BB0\u91CC\u70B9\u4E00\u4E2A\u5F88\u8FDC\u7684\u4F4D\u7F6E\u3001\u7528\u547D\u4EE4\u8DF3\u5230\u67D0\u4E00\u884C\u3001\u6216\u4E00\u6B21\u8DE8\u8FC7\u5F88\u591A\u884C\u7684\u952E\u76D8\u79FB\u52A8\u3002\u8BBE 0 \u8868\u793A\u5B8C\u5168\u4E0D\u8BB0\u5F55\u8FD9\u7C7B\u79FB\u52A8\uFF0C\u9ED8\u8BA4\u5C31\u662F 0\uFF1A\u8FD9\u7C7B\u6B65\u662F\u63A8\u65AD\u51FA\u6765\u7684\uFF0C\u60F3\u8981\u7684\u4EBA\u81EA\u5DF1\u5B9A\u8DDD\u79BB\u3002\u4EC5\u5728\u7535\u8111\u7AEF\u751F\u6548\uFF0C\u624B\u673A\u548C\u5E73\u677F\u4E0D\u505A\u8FD9\u9879\u68C0\u6D4B\u3002","navHistory.commands.navigateBack":"\u540E\u9000","navHistory.commands.navigateForward":"\u524D\u8FDB","noteEdge.commands.top":"\u8DF3\u5230\u7B14\u8BB0\u5F00\u5934","noteEdge.commands.bottom":"\u8DF3\u5230\u7B14\u8BB0\u672B\u5C3E","recentFiles.name":"\u6700\u8FD1\u6587\u4EF6","recentFiles.rules.heading":"\u6536\u5F55\u89C4\u5219","recentFiles.display.heading":"\u663E\u793A","recentFiles.intro":"\u4E00\u4EFD\u6700\u8FD1\u6253\u5F00\u8FC7\u7684\u7B14\u8BB0\u7684\u6E05\u5355\uFF1A\u4E00\u884C\u5C31\u662F\u4E00\u7BC7\u7B14\u8BB0\uFF0C\u4E3B\u533A\u57DF\u91CC\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\uFF08\u5173\u7CFB\u56FE\u8C31\u8FD9\u7C7B\uFF09\u4E5F\u5404\u5360\u4E00\u884C\uFF0C\u70B9\u4E00\u884C\u5C31\u6253\u5F00\u90A3\u4E00\u7BC7\u3002\u641C\u7D22\u6846\u8FD8\u80FD\u6309\u7B14\u8BB0\u91CC\u7684\u5C0F\u8282\u6807\u9898\u627E\uFF0C\u547D\u4E2D\u54EA\u51E0\u8282\u5C31\u628A\u5B83\u4EEC\u5404\u753B\u4E00\u884C\uFF0C\u70B9\u4E00\u884C\u8DF3\u5230\u90A3\u4E00\u8282\u3002\u8FD9\u4EFD\u6E05\u5355\u662F\u8FD9\u53F0\u8BBE\u5907\u7684\uFF0C\u4E0D\u968F\u4ED3\u5E93\u540C\u6B65\uFF1B\u91CD\u542F\u540E\u4ECD\u5728\u3002","recentFiles.folders.name":"\u4E0D\u6536\u5F55\u7684\u6587\u4EF6\u5939","recentFiles.folders.desc":"\u8FD9\u4E9B\u6587\u4EF6\u5939\u91CC\u7684\u6587\u4EF6\u4E0D\u4F1A\u8FDB\u5165\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u3002\u5DF2\u7F6E\u9876\u7684\u884C\u4E0D\u53D7\u5F71\u54CD\u3002","recentFiles.folders.list.empty":"\u6240\u6709\u6587\u4EF6\u5939\u90FD\u4F1A\u6536\u5F55\u3002","recentFiles.folders.add":"\u6DFB\u52A0\u6587\u4EF6\u5939","recentFiles.frontmatterExclude.name":"\u4E0D\u6536\u5F55\u7684\u5C5E\u6027","recentFiles.frontmatterExclude.desc":"\u6309 frontmatter \u6392\u9664\u4E00\u6574\u7C7B\u7B14\u8BB0\uFF1A\u547D\u4E2D\u5217\u8868\u91CC\u4EFB\u4E00\u6761\u76EE\u7684\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u8FDB\u5165\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u3002\u5DF2\u7F6E\u9876\u7684\u884C\u4E0D\u53D7\u5F71\u54CD\u3002","recentFiles.frontmatterExclude.formName":"\u53EA\u5199\u5C5E\u6027\u540D\uFF08\u5982 `status`\uFF09\uFF1A\u6587\u4EF6\u53EA\u8981\u5E26\u8FD9\u4E2A\u5C5E\u6027\u5C31\u4E0D\u6536\u5F55\uFF0C\u4E0D\u8BBA\u503C\u662F\u591A\u5C11\u3002","recentFiles.frontmatterExclude.formValue":"\u5199\u6210 `\u5C5E\u6027: \u503C`\uFF08\u5982 `status: archived`\uFF09\uFF1A\u53EA\u6709\u503C\u76F8\u7B49\u624D\u4E0D\u6536\u5F55\u3002yes/no/on/off \u6309\u5E03\u5C14\u6BD4\u8F83\uFF1B\u6570\u7EC4\u91CC\u4EFB\u4E00\u5143\u7D20\u76F8\u7B49\u5373\u7B97\u547D\u4E2D\u3002","recentFiles.frontmatterExclude.list.empty":"\u6240\u6709\u6587\u4EF6\u90FD\u4F1A\u6536\u5F55\u3002","recentFiles.frontmatterExclude.add":"\u6DFB\u52A0\u5C5E\u6027","recentFiles.excludeImages.name":"\u4E0D\u6536\u5F55\u56FE\u7247","recentFiles.excludeImages.desc":"\u6253\u5F00\u56FE\u7247\u6587\u4EF6\u4E0D\u518D\u8BB0\u5165\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u3002\u6253\u5F00\u8FD9\u9879\u4F1A\u987A\u624B\u6E05\u6389\u5217\u8868\u4E0A\u5DF2\u6709\u7684\u56FE\u7247\u884C\uFF08\u5DF2\u7F6E\u9876\u7684\u4E0D\u6E05\uFF09\uFF1B\u5173\u6389\u4E4B\u540E\u56FE\u7247\u7167\u5E38\u6536\u5F55\uFF0C\u4F46\u88AB\u6E05\u6389\u7684\u884C\u4E0D\u4F1A\u56DE\u6765\u3002","recentFiles.cap.name":"\u8BB0\u4F4F\u591A\u5C11\u7BC7\u7B14\u8BB0","recentFiles.cap.desc":"\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u6700\u591A\u8BB0\u4F4F\u591A\u5C11\u7BC7\u7B14\u8BB0\uFF08\u4E3B\u533A\u57DF\u91CC\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\u4E5F\u5404\u7B97\u4E00\u4E2A\uFF09\u3002\u8D85\u4E86\u5C31\u4E22\u6389\u6700\u4E45\u6CA1\u6253\u5F00\u8FC7\u7684\u90A3\u4E9B\uFF1B\u8C03\u5C0F\u4F1A\u7ACB\u523B\u751F\u6548\uFF0C\u4E22\u6389\u7684\u627E\u4E0D\u56DE\u6765\u3002\u7F6E\u9876\u7684\u884C\u4E0D\u5360\u8FD9\u91CC\u7684\u6570\u3002","recentFiles.outlineSearch.name":"\u641C\u7D22\u5C0F\u8282\u6807\u9898","recentFiles.outlineSearch.desc":"\u641C\u7D22\u6846\u9664\u4E86\u7B14\u8BB0\u540D\uFF08\u4EE5\u53CA\u5B83\u7684\u522B\u540D\u3001\u8DEF\u5F84\uFF09\u4E4B\u5916\uFF0C\u662F\u5426\u4E5F\u5339\u914D\u5404\u7BC7\u7B14\u8BB0\u91CC\u7684\u5C0F\u8282\u6807\u9898\u3002\u5F00\u7740\u65F6\uFF0C\u547D\u4E2D\u7684\u5C0F\u8282\u5404\u753B\u4E00\u884C\u5728\u90A3\u7BC7\u7B14\u8BB0\u4E0B\u9762\uFF08\u6BCF\u7BC7\u6700\u591A 5 \u4E2A\uFF09\uFF0C\u70B9\u4E00\u884C\u5C31\u8DF3\u5230\u90A3\u4E00\u8282\u3002\u5173\u6389\u65F6\u641C\u7D22\u53EA\u8BA4\u7B14\u8BB0\u81EA\u5DF1\u3002","recentFiles.pathDisplay.name":"\u5217\u8868\u91CC\u7684\u8DEF\u5F84","recentFiles.pathDisplay.desc":"\u4E00\u884C\u662F\u5426\u663E\u793A\u7B14\u8BB0\u6240\u5728\u7684\u6587\u4EF6\u5939\uFF1A\u6BCF\u884C\u90FD\u663E\u793A\uFF0C\u8FD8\u662F\u53EA\u5728\u540D\u5B57\u4E0E\u5C4F\u5E55\u4E0A\u522B\u7684\u884C\u649E\u8F66\u65F6\u624D\u663E\u793A\u3002\u663E\u793A\u5728\u540D\u5B57\u7684\u54EA\u4E00\u4FA7\uFF0C\u4E5F\u5C31\u5B9A\u4E0B\u4E86\u884C\u6324\u4E0D\u4E0B\u65F6\u8C01\u8BA9\u4F4D\uFF1A\u6392\u5728\u540E\u9762\u7684\u90A3\u4E00\u534A\u4F1A\u843D\u5230\u7B2C\u4E8C\u884C\u3002","recentFiles.pathDisplay.options.smart":"\u4EC5\u5728\u91CD\u540D\u65F6\u663E\u793A","recentFiles.pathDisplay.options.before":"\u603B\u662F\u663E\u793A\uFF0C\u8DEF\u5F84\u5728\u524D","recentFiles.pathDisplay.options.after":"\u603B\u662F\u663E\u793A\uFF0C\u8DEF\u5F84\u5728\u540E","recentFiles.rowTime.name":"\u6BCF\u884C\u7684\u65F6\u95F4","recentFiles.rowTime.desc":"\u5728\u6BCF\u884C\u4E0A\u663E\u793A\u300C\u8DDD\u4E0A\u6B21\u5230\u8BBF\u8FC7\u4E86\u591A\u4E45\u300D\u3002\u90A3\u662F\u4F60\u4E0A\u4E00\u6B21\u5728\u90A3\u91CC\u7684\u65F6\u95F4\uFF0C\u4E0D\u662F\u6587\u4EF6\u7684\u4FEE\u6539\u65F6\u95F4\uFF1B\u786E\u5207\u65F6\u523B\u60AC\u505C\u5728\u8FD9\u884C\u7684\u65F6\u95F4\u4E0A\u53EF\u4EE5\u770B\u5230\u3002","recentFiles.titleProperty.name":"\u884C\u540D\u53D6\u81EA\u5C5E\u6027","recentFiles.titleProperty.desc":"\u5217\u8868\u91CC\u7528\u54EA\u4E2A frontmatter \u5C5E\u6027\u5F53\u7B14\u8BB0\u540D\u3002\u53EF\u9009\u300C\u6807\u9898 / \u522B\u540D\u300D\uFF0C\u6216\u81EA\u5B9A\u4E49\u4E00\u4E2A\u5C5E\u6027\u540D\uFF1B\u7559\u7A7A\uFF08\u4E0D\u4F7F\u7528\uFF09\u65F6\u663E\u793A\u6587\u4EF6\u540D\u3002\u5C5E\u6027\u503C\u662F\u5217\u8868\u65F6\u53D6\u7B2C\u4E00\u9879\u3002","recentFiles.titleProperty.placeholder":"\u4F8B\u5982 title","recentFiles.titleProperty.off":"\u4E0D\u4F7F\u7528","recentFiles.titleProperty.optTitle":"\u6807\u9898 (title)","recentFiles.titleProperty.optAliases":"\u522B\u540D (aliases)","recentFiles.titleProperty.custom":"\u81EA\u5B9A\u4E49\u5C5E\u6027\u2026","recentFiles.age.now":"\u521A\u521A","recentFiles.age.m":"\u5206\u949F","recentFiles.age.h":"\u5C0F\u65F6","recentFiles.age.d":"\u5929","recentFiles.age.w":"\u5468","recentFiles.age.mo":"\u4E2A\u6708","recentFiles.age.y":"\u5E74","recentFiles.title":"title:","recentFiles.aliases":"aliases:","recentFiles.openInNewTab":"\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00","recentFiles.openHereInNewTab":"\u5728\u6B64\u5904\u6253\u5F00\u65B0\u6807\u7B7E\u9875","recentFiles.forget":"\u4ECE\u6700\u8FD1\u6587\u4EF6\u79FB\u9664","recentFiles.clearList":"\u6E05\u7A7A\u6574\u4E2A\u5217\u8868","recentFiles.rowMenu":"\u66F4\u591A\u64CD\u4F5C","recentFiles.pin":"\u7F6E\u9876","recentFiles.unpin":"\u53D6\u6D88\u7F6E\u9876","recentFiles.unpinExcluded":"\u53D6\u6D88\u7F6E\u9876\u5E76\u79FB\u51FA\u5217\u8868","recentFiles.unpin.removedByRule":"\u5DF2\u53D6\u6D88\u7F6E\u9876\uFF1A\u8BE5\u884C\u547D\u4E2D\u300C{0}\u300D\u89C4\u5219\uFF0C\u5DF2\u79FB\u51FA\u5217\u8868\u3002","recentFiles.unpin.removed":"\u5DF2\u53D6\u6D88\u7F6E\u9876\uFF0C\u8BE5\u884C\u5DF2\u79FB\u51FA\u5217\u8868\u3002","recentFiles.unpin.undo":"\u64A4\u9500","recentFiles.pinUp":"\u4E0A\u79FB","recentFiles.pinDown":"\u4E0B\u79FB","recentFiles.pinFirst":"\u79FB\u5230\u6700\u524D","recentFiles.pinLast":"\u79FB\u5230\u6700\u540E","recentFiles.commands.open":"\u6D4F\u89C8\u6700\u8FD1\u6587\u4EF6","recentFiles.commands.openSidebar":"\u5728\u4FA7\u8FB9\u680F\u6253\u5F00\u6700\u8FD1\u6587\u4EF6","recentFiles.hotkeys.desc":"\u8FDB\u5165\u5217\u8868\u7684\u4E24\u79CD\u65B9\u5F0F\uFF1A\u4E00\u6B21\u6027\u7684\u5F39\u7A97\uFF0C\u6216\u5E38\u9A7B\u4FA7\u8FB9\u680F\u7684\u9762\u677F\u3002\u4E24\u8005\u9ED8\u8BA4\u90FD\u4E0D\u7ED1\u5FEB\u6377\u952E\uFF0C\u5728\u547D\u4EE4\u9762\u677F\u91CC\u6309\u540D\u5B57\u6253\u5F00\u5373\u53EF\u3002","recentFiles.graphView":"\u5173\u7CFB\u56FE\u8C31","recentFiles.viewBadge":"\u89C6\u56FE","recentFiles.searchPlaceholder":"\u6309\u7B14\u8BB0\u540D\u6216\u6587\u672C\u8FC7\u6EE4\u2026","recentFiles.clearFilter":"\u6E05\u7A7A\u7B5B\u9009","recentFiles.close":"\u5173\u95ED","recentFiles.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u5386\u53F2\u3002","recentFiles.empty":"\u6682\u65E0\u53EF\u8DF3\u8F6C\u7684\u4F4D\u7F6E\u3002","recentFiles.moreHits":"\u8FD8\u6709 {0} \u4E2A\u5339\u914D\u7684\u5C0F\u8282","previewFocus.recentFiles.name":"\u60AC\u505C\u4E00\u884C\u65F6\u9884\u89C8\u6253\u5F00\u5728\u54EA\u91CC","previewFocus.recentFiles.desc":"\u60AC\u505C\u5217\u8868\u91CC\u7684\u4E00\u884C\u65F6\uFF0C\u9884\u89C8\u5361\u7247\u628A\u7B14\u8BB0\u6253\u5F00\u5728\u54EA\u513F\uFF1A\u5F00\u5934\uFF0C\u8FD8\u662F\u4F60\u4E0A\u6B21\u79BB\u5F00\u8FD9\u7BC7\u7B14\u8BB0\u65F6\u7684\u4F4D\u7F6E\u3002\u540E\u8005\u5C31\u662F\u76F4\u63A5\u70B9\u51FB\u8FD9\u4E00\u884C\u4F1A\u843D\u5230\u7684\u5730\u65B9\uFF0C\u4E0D\u7528\u771F\u7684\u6253\u5F00\u5C31\u80FD\u5148\u770B\u5230\uFF0C\u4F46\u8981\u591A\u7B49\u4E00\u4E0B\uFF1A\u5361\u7247\u5148\u628A\u6574\u7BC7\u7B14\u8BB0\u4ECE\u5934\u753B\u51FA\u6765\uFF0C\u518D\u632A\u5230\u90A3\u4E00\u884C\uFF0C\u957F\u7B14\u8BB0\u4E0A\u4F1A\u5148\u770B\u5230\u4E00\u5F20\u7A7A\u767D\u5361\u7247\u3001\u7136\u540E\u624D\u8DF3\u8FC7\u53BB\u3002\u6CA1\u8BB0\u4E0B\u4F4D\u7F6E\u7684\u7B14\u8BB0\u4ECD\u4ECE\u5F00\u5934\u663E\u793A\u3002\u641C\u7D22\u5C0F\u8282\u6807\u9898\u5F97\u5230\u7684\u884C\u4E0D\u53D7\u5F71\u54CD\uFF0C\u5B83\u4EEC\u672C\u6765\u5C31\u76F4\u63A5\u9884\u89C8\u90A3\u4E00\u8282\u3002","previewFocus.recentFiles.options.head":"\u7B14\u8BB0\u5F00\u5934","previewFocus.recentFiles.options.line":"\u4E0A\u6B21\u79BB\u5F00\u65F6\u7684\u4F4D\u7F6E","previewFocus.fileExplorer.name":"\u6587\u4EF6\u5217\u8868\u7684\u9884\u89C8\u6253\u5F00\u5728\u54EA\u91CC","previewFocus.fileExplorer.desc":"\u5728 Obsidian \u81EA\u5E26\u7684\u6587\u4EF6\u5217\u8868\u91CC\u60AC\u505C\u4E00\u4E2A\u6587\u4EF6\u65F6\uFF0C\u9884\u89C8\u5361\u7247\u628A\u7B14\u8BB0\u6253\u5F00\u5728\u54EA\u513F\uFF1A\u5F00\u5934\uFF08Obsidian \u539F\u672C\u7684\u884C\u4E3A\uFF09\uFF0C\u8FD8\u662F\u4F60\u4E0A\u6B21\u79BB\u5F00\u8FD9\u7BC7\u7B14\u8BB0\u65F6\u7684\u4F4D\u7F6E\u3002\u9009\u4F4D\u7F6E\u8981\u591A\u7B49\u4E00\u4E0B\uFF1A\u5361\u7247\u5148\u628A\u6574\u7BC7\u7B14\u8BB0\u4ECE\u5934\u753B\u51FA\u6765\uFF0C\u518D\u632A\u5230\u90A3\u4E00\u884C\uFF0C\u957F\u7B14\u8BB0\u4E0A\u4F1A\u5148\u7A7A\u767D\u4E00\u4E0B\u3001\u7136\u540E\u624D\u8DF3\u8FC7\u53BB\u3002\u8FD9\u91CC\u7528\u7684\u662F\u6700\u540E\u8BB0\u4E0B\u7684\u884C\u53F7\uFF0C\u4E0D\u4F1A\u6309\u7B14\u8BB0\u73B0\u5728\u7684\u6837\u5B50\u91CD\u7B97\uFF0C\u6240\u4EE5\u7B14\u8BB0\u5728\u522B\u7684\u8BBE\u5907\u4E0A\u88AB\u589E\u5220\u6539\u8FC7\u540E\uFF0C\u53EF\u80FD\u505C\u4E0D\u5230\u4F60\u79BB\u5F00\u65F6\u7684\u90A3\u4E00\u5904\u3002\u6CA1\u8BB0\u4E0B\u4F4D\u7F6E\u7684\u7B14\u8BB0\u4ECD\u4ECE\u5F00\u5934\u663E\u793A\u3002","previewFocus.fileExplorer.options.head":"\u7B14\u8BB0\u5F00\u5934","previewFocus.fileExplorer.options.line":"\u4E0A\u6B21\u79BB\u5F00\u65F6\u7684\u4F4D\u7F6E"};var un={en:st,zh:Nt},fn=un[(0,Dt.getLanguage)().toLowerCase().split(/[-_]/)[0]]??st;function l(r,...e){let t=fn[r];return e.forEach((i,n)=>{t=t.split(`{${n}}`).join(String(i))}),t}function B(r){return{name:"",searchable:!1,render:e=>{e.setDesc(r),e.settingEl.addClass("position-restore-page-intro")}}}function pe(r,e,t){return{name:l("hotkeys.name"),render:i=>{let n=createFragment();n.createDiv({text:e});let s=n.createEl("ul",{cls:"mod-muted"});for(let o of t)s.createEl("li",{text:`${o.name}: ${gn(r,o.id)}`});n.createDiv({cls:"mod-muted",text:l("hotkeys.hint")}),i.setDesc(n),i.addExtraButton(o=>{o.setIcon("keyboard").setTooltip(l("hotkeys.open")).onClick(()=>vn(r))})}}}function mn(r){let e=ie.Platform.isMacOS,t={Mod:e?"\u2318":"Ctrl",Ctrl:e?"\u2303":"Ctrl",Meta:e?"\u2318":"Win",Shift:e?"\u21E7":"Shift",Alt:e?"\u2325":"Alt"},n=["Mod","Ctrl","Meta","Shift","Alt"].filter(o=>r.modifiers.includes(o)).map(o=>t[o]).join(e?" ":"+"),s;return r.key==="ArrowLeft"?s="\u2190":r.key==="ArrowRight"?s="\u2192":s=r.key,n?`${n}${e?" ":"+"}${s}`:s}function gn(r,e){let i=r.app.hotkeyManager?.getHotkeys(`${r.manifest.id}:${e}`);return!i||i.length===0?l("hotkeys.unbound"):i.map(mn).join(" / ")}function vn(r){let e=r.app.setting;if(!e){new ie.Notice(l("hotkeys.openFailed"));return}e.open();let t=e.openTabById("hotkeys");if(!t){new ie.Notice(l("hotkeys.openFailed"));return}t.setQuery?.(r.manifest.name)}var T=require("obsidian");var D=class extends T.FuzzySuggestModal{constructor(t,i,n){super(t);this.excludedFolders=i;this.onSelect=n;this.setPlaceholder(l("recordingRules.folders.search.placeholder")),this.limit=50,this.emptyStateText=l("recordingRules.folders.search.empty")}getItems(){return this.app.vault.getAllFolders(!1).filter(t=>!this.excludedFolders.some(i=>t.path===i||t.path.startsWith(i+"/"))).sort((t,i)=>t.path.localeCompare(i.path))}getItemText(t){return t.path}onChooseItem(t){this.onSelect(t.path)}},he=class extends T.FuzzySuggestModal{constructor(t,i){super(t);this.onSelect=i;this.setPlaceholder(l("dataStorage.dbFileName.search.placeholder")),this.limit=50,this.emptyStateText=l("dataStorage.dbFileName.search.empty")}getItems(){return this.app.vault.getFiles().filter(t=>t.extension==="json").sort((t,i)=>t.path.localeCompare(i.path))}getItemText(t){return t.path}onChooseItem(t){this.onSelect(t)}},W=class extends T.FuzzySuggestModal{constructor(t,i){super(t);this.onSelect=i;this.setPlaceholder(l("recordingRules.frontmatterExclude.search.placeholder")),this.limit=50,this.emptyStateText=l("recordingRules.frontmatterExclude.search.empty")}getItems(){return Object.values(this.app.metadataCache.getAllPropertyInfos()).map(t=>t.name).sort((t,i)=>t.localeCompare(i))}getItemText(t){return t}onChooseItem(t){this.onSelect(t)}},j=class extends T.Modal{constructor(t,i,n,s){super(t);this.name=i;this.excluded=n;this.onSelect=s}onOpen(){let{contentEl:t}=this;t.createEl("h3",{text:l("recordingRules.frontmatterExclude.value.title",this.name)});let i;new T.Setting(t).setName(l("recordingRules.frontmatterExclude.value.name")).setDesc(l("recordingRules.frontmatterExclude.value.desc")).addText(n=>{i=n,n.setPlaceholder(l("recordingRules.frontmatterExclude.value.placeholder")),n.inputEl.addEventListener("keydown",s=>{s.key==="Enter"&&this.submit(i)})}),new T.Setting(t).addButton(n=>n.setButtonText(l("recordingRules.frontmatterExclude.add")).setCta().onClick(()=>this.submit(i)))}submit(t){let i=t.getValue().trim(),n=i===""?this.name:`${this.name}: ${i}`;if(this.excluded.includes(n)){new T.Notice(l("recordingRules.frontmatterExclude.duplicate",n));return}this.onSelect(n),this.close()}onClose(){this.contentEl.empty()}};var Ct=require("obsidian");function Ot(r,e){let t=e.trim().toLowerCase();if(Array.isArray(r))return r.some(i=>Ot(i,e));if(typeof r=="boolean"){let i={true:!0,false:!1,yes:!0,no:!1,on:!0,off:!1};return t in i&&i[t]===r}return r===null||typeof r=="object"||typeof r!="string"&&typeof r!="number"?!1:r.toString().toLowerCase()===t}function ue(r,e){if(!r||typeof r!="object")return!1;let t=r;for(let i of e){if(!i)continue;let n=i.indexOf(":"),s=(n===-1?i:i.slice(0,n)).trim(),o=n===-1?"":i.slice(n+1).trim();if(!(!s||!Object.prototype.hasOwnProperty.call(t,s))&&(o===""||Ot(t[s],o)))return!0}return!1}function It(r,e){let t=r.vault.getAbstractFileByPath(e);return t instanceof Ct.TFile?r.metadataCache.getFileCache(t)?.frontmatter:void 0}var ot="position-restore";function wn(r){if(typeof r=="boolean")return r;if(typeof r=="string"){let e=r.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}}function yn(r,e){let t={forceRecord:!1,skip:!1};if(!r||typeof r!="object")return t;let n=wn(r[ot]);return n===!0?t.forceRecord=!0:(n===!1||ue(r,e.frontmatterExcludeProperties??[]))&&(t.skip=!0),t}function U(r,e,t){if(!e)return;let i=r.metadataCache.getFileCache(e);if(i)return yn(i.frontmatter,t)}var me=require("obsidian");function Ht(r,e){return e===r.vault.configDir||e.startsWith(`${r.vault.configDir}/`)?"config":e.split("/")[0].startsWith(".")?"hidden":"vault"}var fe=class extends me.Modal{constructor(t,i,n){super(t);this.plugin=i;this.onApply=n}onOpen(){let{contentEl:t}=this;t.createEl("h3",{text:l("dataStorage.dbFileName.modal.title")}),t.createEl("p",{cls:"mod-muted",text:l("dataStorage.dbFileName.desc")}),t.createEl("p",{cls:"mod-muted",text:l("dataStorage.dbFileName.mergeHint")});let i=t.createEl("details",{cls:"position-restore-db-path-hint"});i.createEl("summary",{text:l("dataStorage.dbFileName.syncSummary")}),i.createEl("p",{cls:"mod-muted",text:l("dataStorage.dbFileName.syncHint")});let n=t.createEl("input",{type:"text",cls:"position-restore-db-path-input",attr:{autocapitalize:"off",autocorrect:"off",autocomplete:"off",spellcheck:"false"}});n.placeholder=this.plugin.database.defaultDbFileName,n.value=this.plugin.settings.dbFileName||"";let s=async()=>{let d=n.value.trim();await this.plugin.database.switchDbFile(d)&&(this.plugin.settings.dbFileName=d,await this.plugin.saveSettings(),new me.Notice(d===""?l("dataStorage.dbFileName.messages.default"):l("dataStorage.dbFileName.messages.set",d)),this.close(),this.onApply())};n.addEventListener("keydown",d=>{d.key==="Enter"&&s()});let o=t.createDiv({cls:"position-restore-db-path-row is-pickers"});o.createEl("button",{text:l("dataStorage.dbFileName.pickFolder")}).addEventListener("click",()=>{let d=n.value.trim()||this.plugin.database.defaultDbFileName,c=d.substring(d.lastIndexOf("/")+1);new D(this.app,[],p=>{n.value=`${p}/${c}`}).open()}),o.createEl("button",{text:l("dataStorage.dbFileName.pickFile")}).addEventListener("click",()=>{new he(this.app,d=>{n.value=d.path}).open()}),o.createEl("button",{text:l("dataStorage.dbFileName.modal.default")}).addEventListener("click",()=>{n.value=""});let a=t.createDiv({cls:"position-restore-db-path-row is-actions"});a.createEl("button",{text:l("dataStorage.dbFileName.modal.cancel")}).addEventListener("click",()=>this.close()),a.createEl("button",{text:l("dataStorage.dbFileName.apply"),cls:"mod-cta"}).addEventListener("click",()=>{s()})}onClose(){this.contentEl.empty()}};function Vt(r){return[{type:"group",items:[B(l("lastPosition.intro"))]},{type:"group",heading:l("openAndRestore.heading"),items:[{name:l("openAndRestore.linkOpenPosition.name"),desc:l("openAndRestore.linkOpenPosition.desc"),control:{type:"dropdown",key:"linkOpenPosition",options:{start:l("openAndRestore.linkOpenPosition.options.start"),restore:l("openAndRestore.linkOpenPosition.options.restore")}}},{name:l("previewFocus.fileExplorer.name"),desc:l("previewFocus.fileExplorer.desc"),control:{type:"dropdown",key:"fileExplorerPreviewFocus",options:{head:l("previewFocus.fileExplorer.options.head"),line:l("previewFocus.fileExplorer.options.line")}}},{name:l("openAndRestore.restoreBreadcrumb.name"),desc:l("openAndRestore.restoreBreadcrumb.desc"),control:{type:"toggle",key:"restoreBreadcrumb"}},{name:l("openAndRestore.flashLandingLine.name"),desc:l("openAndRestore.flashLandingLine.desc"),control:{type:"toggle",key:"flashLandingLine"}}]},{type:"group",heading:l("recordingRules.heading"),items:[{type:"page",name:l("recordingRules.folders.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recordingRules.folders.desc")});let t=r.plugin.settings.excludedFolders;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n+"/"});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recordingRules.folders.list.empty"),items:r.plugin.settings.excludedFolders.map(e=>({name:e+"/"})),onDelete:e=>{let t=r.plugin.settings.excludedFolders.filter((i,n)=>n!==e);r.setValue("excludedFolders",t)},addItem:{name:l("recordingRules.folders.add"),action:()=>{new D(r.app,r.plugin.settings.excludedFolders,e=>{let t=[...r.plugin.settings.excludedFolders,e];r.setValue("excludedFolders",t)}).open()}}}]},{name:l("recordingRules.minLinesToRecord.name"),desc:l("recordingRules.minLinesToRecord.desc"),control:{type:"number",key:"minLinesToRecord",min:0,max:1e5,step:1}},{type:"page",name:l("recordingRules.frontmatterExclude.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recordingRules.frontmatterExclude.desc")}),e.createDiv({cls:"mod-muted",text:l("recordingRules.frontmatterExclude.formName")}),e.createDiv({cls:"mod-muted",text:l("recordingRules.frontmatterExclude.formValue")});let t=r.plugin.settings.frontmatterExcludeProperties;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recordingRules.frontmatterExclude.list.empty"),items:r.plugin.settings.frontmatterExcludeProperties.map(e=>({name:e})),onDelete:e=>{let t=r.plugin.settings.frontmatterExcludeProperties.filter((i,n)=>n!==e);r.setValue("frontmatterExcludeProperties",t)},addItem:{name:l("recordingRules.frontmatterExclude.add"),action:()=>{new W(r.app,e=>{new j(r.app,e,r.plugin.settings.frontmatterExcludeProperties,t=>{let i=[...r.plugin.settings.frontmatterExcludeProperties,t];r.setValue("frontmatterExcludeProperties",i)}).open()}).open()}}}]},{name:l("recordingRules.escapeHatch.name"),desc:l("recordingRules.escapeHatch.desc",ot)},{name:l("recordingRules.recordBaseScroll.name"),desc:l("recordingRules.recordBaseScroll.desc"),control:{type:"toggle",key:"recordBaseScroll"}}]},{type:"group",heading:l("dataStorage.heading"),items:[{name:l("dataStorage.dbFileName.name"),desc:(()=>{let e=r.plugin.settings.dbFileName||r.plugin.database.defaultDbFileName,t=Ht(r.app,e),i=createFragment();return i.createDiv({text:l("dataStorage.dbFileName.desc")}),i.createDiv({cls:"mod-muted",text:l("dataStorage.dbFileName.current",e)}),i.createDiv({cls:"mod-muted",text:t==="config"?l("dataStorage.dbFileName.syncLocal"):t==="hidden"?l("dataStorage.dbFileName.syncHidden"):l("dataStorage.dbFileName.syncVault")}),i})(),render:e=>{e.addButton(t=>{t.setButtonText(l("dataStorage.dbFileName.change")).onClick(()=>new fe(r.app,r.plugin,()=>r.refresh()).open())})}},{name:l("dataStorage.entries.name"),render:e=>{let t=Object.keys(r.plugin.database.db).length,i=createFragment();i.createDiv({text:l("dataStorage.entries.desc",String(t))});let n=r.plugin.database.countDefaultPosition();n>0&&i.createDiv({cls:"mod-muted",text:l("dataStorage.entries.atDefault",String(n))}),e.setDesc(i)}}]}]}function _t(r){return[{type:"group",items:[B(l("navHistory.intro")),pe(r.plugin,l("navHistory.hotkeys.desc"),[{id:"navigate-back",name:l("navHistory.commands.navigateBack")},{id:"navigate-forward",name:l("navHistory.commands.navigateForward")}]),{name:l("navHistory.stackCap.name"),desc:l("navHistory.stackCap.desc"),control:{type:"number",key:"navHistoryCap",min:10,max:500,step:1}}]},{type:"group",heading:l("navHistory.steps.heading"),items:[{name:l("navHistory.recordActivation.name"),desc:l("navHistory.recordActivation.desc"),control:{type:"toggle",key:"navHistoryRecordActivation"}},{name:l("navHistory.teleportMinLines.name"),desc:l("navHistory.teleportMinLines.desc"),control:{type:"number",key:"navHistoryTeleportMinLines",min:0,max:500,step:1}}]}]}function Bt(r){return[{type:"group",items:[B(l("recentFiles.intro")),pe(r.plugin,l("recentFiles.hotkeys.desc"),[{id:"browse-recent-files",name:l("recentFiles.commands.open")},{id:"open-recent-files-sidebar",name:l("recentFiles.commands.openSidebar")}])]},{type:"group",heading:l("recentFiles.rules.heading"),items:[{type:"page",name:l("recentFiles.folders.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recentFiles.folders.desc")});let t=r.plugin.settings.recentFilesExcludeFolders;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n+"/"});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recentFiles.folders.list.empty"),items:r.plugin.settings.recentFilesExcludeFolders.map(e=>({name:e+"/"})),onDelete:e=>{let t=r.plugin.settings.recentFilesExcludeFolders.filter((i,n)=>n!==e);r.setValue("recentFilesExcludeFolders",t)},addItem:{name:l("recentFiles.folders.add"),action:()=>{new D(r.app,r.plugin.settings.recentFilesExcludeFolders,e=>{let t=[...r.plugin.settings.recentFilesExcludeFolders,e];r.setValue("recentFilesExcludeFolders",t)}).open()}}}]},{type:"page",name:l("recentFiles.frontmatterExclude.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recentFiles.frontmatterExclude.desc")}),e.createDiv({cls:"mod-muted",text:l("recentFiles.frontmatterExclude.formName")}),e.createDiv({cls:"mod-muted",text:l("recentFiles.frontmatterExclude.formValue")});let t=r.plugin.settings.recentFilesExcludeProperties;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recentFiles.frontmatterExclude.list.empty"),items:r.plugin.settings.recentFilesExcludeProperties.map(e=>({name:e})),onDelete:e=>{let t=r.plugin.settings.recentFilesExcludeProperties.filter((i,n)=>n!==e);r.setValue("recentFilesExcludeProperties",t)},addItem:{name:l("recentFiles.frontmatterExclude.add"),action:()=>{new W(r.app,e=>{new j(r.app,e,r.plugin.settings.recentFilesExcludeProperties,t=>{let i=[...r.plugin.settings.recentFilesExcludeProperties,t];r.setValue("recentFilesExcludeProperties",i)}).open()}).open()}}}]},{name:l("recentFiles.excludeImages.name"),desc:l("recentFiles.excludeImages.desc"),control:{type:"toggle",key:"recentFilesExcludeImages"}},{name:l("recentFiles.cap.name"),desc:l("recentFiles.cap.desc"),control:{type:"number",key:"recentFilesCap",min:20,max:500,step:10}}]},{type:"group",heading:l("recentFiles.display.heading"),items:[{name:l("recentFiles.outlineSearch.name"),desc:l("recentFiles.outlineSearch.desc"),control:{type:"toggle",key:"recentFilesOutlineSearch"}},{name:l("recentFiles.pathDisplay.name"),desc:l("recentFiles.pathDisplay.desc"),control:{type:"dropdown",key:"recentFilesPathDisplay",options:{smart:l("recentFiles.pathDisplay.options.smart"),before:l("recentFiles.pathDisplay.options.before"),after:l("recentFiles.pathDisplay.options.after")}}},{name:l("recentFiles.rowTime.name"),desc:l("recentFiles.rowTime.desc"),control:{type:"toggle",key:"recentFilesRowTime"}},{name:l("recentFiles.titleProperty.name"),desc:l("recentFiles.titleProperty.desc"),render:e=>{let t=r.plugin.settings.recentFilesTitleProperty,i=t==="title"||t==="aliases",n;e.addDropdown(s=>{s.addOption("",l("recentFiles.titleProperty.off")),s.addOption("title",l("recentFiles.titleProperty.optTitle")),s.addOption("aliases",l("recentFiles.titleProperty.optAliases")),s.addOption("__custom__",l("recentFiles.titleProperty.custom")),s.setValue(i?t:t===""?"":"__custom__"),s.onChange(o=>{o==="__custom__"?n.inputEl.setCssProps({display:""}):(n.inputEl.setCssProps({display:"none"}),r.setValue("recentFilesTitleProperty",o))})}),e.addText(s=>{n=s,s.setPlaceholder(l("recentFiles.titleProperty.placeholder")),s.setValue(i?"":t),s.inputEl.addEventListener("blur",()=>{r.setValue("recentFilesTitleProperty",s.getValue().trim())})}),n.inputEl.setCssProps({display:i||t===""?"none":""})}},{name:l("previewFocus.recentFiles.name"),desc:l("previewFocus.recentFiles.desc"),control:{type:"dropdown",key:"recentFilesPreviewFocus",options:{head:l("previewFocus.recentFiles.options.head"),line:l("previewFocus.recentFiles.options.line")}}}]}]}var bn=new Set(["recentFilesOutlineSearch","recentFilesPathDisplay","recentFilesRowTime","recentFilesTitleProperty"]),En=new Set,ge=class extends Wt.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t}getControlValue(e){return this.plugin.settings[e]}async setControlValue(e,t){let i={...this.plugin.settings};this.plugin.settings[e]=t,this.plugin.manager.applyChangedSettings(i),bn.has(e)&&this.plugin.manager.refreshNavPanels(),await this.plugin.saveSettings(),En.has(e)&&this.update()}getSettingDefinitions(){let e=this.pageContext();return[{type:"page",name:l("lastPosition.heading"),items:Vt(e)},{type:"page",name:l("navHistory.heading"),items:_t(e)},{type:"page",name:l("recentFiles.name"),items:Bt(e)}]}pageContext(){return{app:this.app,plugin:this.plugin,setValue:async(e,t)=>{await this.setControlValue(e,t),this.update()},refresh:()=>this.update()}}};var H={dbFileName:"",minLinesToRecord:20,excludedFolders:[],frontmatterExcludeProperties:[],linkOpenPosition:"restore",restoreBreadcrumb:!0,flashLandingLine:!0,recordBaseScroll:!1,navHistoryCap:50,navHistoryRecordActivation:!0,navHistoryTeleportMinLines:0,recentFilesExcludeFolders:[],recentFilesExcludeProperties:[],recentFilesExcludeImages:!1,recentFilesOutlineSearch:!0,recentFilesCap:50,recentFilesPathDisplay:"smart",recentFilesRowTime:!0,recentFilesTitleProperty:"",recentFilesPreviewFocus:"head",fileExplorerPreviewFocus:"head"};var C=require("obsidian");var jt=require("obsidian");function ve(r){new jt.Notice(r,0)}var ne=3;function we(r,e){return r?r.from.ch!==0||r.to.ch!==0||r.from.line!==r.to.line?!1:r.from.line===(e??0):!0}function Ut(r,e){let t={},i=r.scroll??0;i>0&&(t.s=i);let n=r.cursor;return n&&(i>0||!we(n,e))&&(t.c=[n.from.line,n.from.ch,n.to.line,n.to.ch]),r.time!==void 0&&(t.t=r.time),t}function Kt(r){if(!r||typeof r!="object"||Array.isArray(r))return{};let e=r,t={};typeof e.s=="number"&&Number.isFinite(e.s)&&e.s>0&&(t.scroll=e.s),typeof e.t=="number"&&Number.isFinite(e.t)&&(t.time=e.t);let i=e.c;if(Array.isArray(i)&&i.length>=4&&i.every(n=>typeof n=="number"&&Number.isFinite(n))){let[n,s,o,a]=i,d={line:n,ch:s},c={line:o,ch:a};we({from:d,to:c},void 0)||(t.cursor={from:d,to:c})}return t}function Sn(r){if(!Array.isArray(r)||r.some(i=>!Number.isFinite(i)))return{};let e=r,t={};if(e[0]>0&&(t.scroll=e[0]),e.length===3){let i={line:e[1],ch:e[2]};t.cursor={from:i,to:i}}else e.length>=5&&(t.cursor={from:{line:e[1],ch:e[2]},to:{line:e[3],ch:e[4]}});return t}function ye(r){let e=JSON.parse(r);if(!e||typeof e!="object"||Array.isArray(e))throw new Error("database content is not a JSON object");let t=e,i=typeof t.schema=="number"?t.schema:1,n;return i>=3?n=xn(t):i>=2?n=Fn(t):n=kn(t),{schema:i,db:n}}function kn(r){let e={};for(let t of Object.keys(r))e[t]=Sn(r[t]);return e}function Fn(r){let e=r.positions;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("database has no position map");let t=e,i={};for(let n of Object.keys(t))i[n]=Kt(t[n]);return i}function xn(r){let e=r.lastPositions;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("database has no lastPositions map");let t=e,i={};for(let n of Object.keys(t))i[n]=Kt(t[n]);return i}function $t(r){let e;try{e=ye(r)}catch{return null}for(let t of Object.keys(e.db)){let i=t.toLowerCase();if(!i.endsWith(".md")&&!i.endsWith(".base"))return null}return e.db}var at=750,Pn=Math.floor(at*3/4),Tn=Math.floor(at/4),Gt="position-restore-data.json",Ln="positions.json",be=class{constructor(e,t){this.db={};this.dbDirty=!1;this.rev=0;this.lastDiskMtime=0;this.lastSeenSchema=0;this.legacyStartupNotified=!1;this.legacyOverwriteNotified=!1;this.mergeChain=Promise.resolve();this.preservedCorrupt=null;this.corruptNotified=!1;this.corruptCopySeq=0;this.lastKey=null;this.app=e.app,this.plugin=e,this.manifestDir=e.manifest.dir,this.settings=t}get defaultDbFileName(){return this.manifestDir+"/"+Gt}getDbPath(){return this.settings.dbFileName||this.defaultDbFileName}corruptCopyPath(){let e=this.getDbPath().split("/").pop()??Gt,t=new Date().toISOString().replace(/[:.]/g,"-");return`${this.manifestDir}/${e.replace(/\.json$/i,"")}.corrupt-${t}-${++this.corruptCopySeq}.json`}async ensureDbFolder(){let e=this.getDbPath(),t=e.substring(0,e.lastIndexOf("/"));if(t)try{await this.app.vault.adapter.exists(t)||await this.app.vault.adapter.mkdir(t)}catch(i){console.error("Can't create db folder:",i),this.settings.dbFileName="",this.plugin.saveSettings()}}async switchDbFile(e){let t=e===""?this.defaultDbFileName:e;if(!t.endsWith(".json")||t.startsWith("/")||t.includes("\\")||t.split("/").includes(".."))return new C.Notice(l("dataStorage.dbFileName.messages.invalid")),!1;let i=this.app.vault.adapter,n=this.getDbPath();if(t===n)return!0;let s=async()=>{try{let o=$t(await i.read(t));if(o===null)return null;await i.exists(n)&&await i.remove(n);let a=this.mergeDiskDb(o);return this.markDirty(),a}catch(o){return console.error("Can't adopt existing database file:",o),null}};try{let o=t.lastIndexOf("/"),a=o===-1?"":t.substring(0,o);if(a&&!await i.exists(a)&&await i.mkdir(a),await i.exists(t)){let d=await s();if(d===null)return new C.Notice(l("dataStorage.dbFileName.messages.exists")),!1;new C.Notice(l("dataStorage.dbFileName.messages.merged",String(d)))}else await i.exists(n)&&await i.rename(n,t)}catch(o){return console.error("Can't switch database file:",o),new C.Notice(l("dataStorage.dbFileName.messages.moveFailed",String(o))),!1}return this.lastDiskMtime=0,await this.cacheDiskMtime(),!0}pruneDb(){let e=Object.keys(this.db).length;this.removeExcludedFolders(),this.removeFrontmatterExcluded(),this.trimToLimit();let t=e-Object.keys(this.db).length;return t>0&&this.markDirty(),t}removeExcludedFolders(){let e=this.settings.excludedFolders;if(e.length!==0)for(let t of Object.keys(this.db))e.some(i=>t===i||t.startsWith(i+"/"))&&delete this.db[t]}removeFrontmatterExcluded(){for(let e of Object.keys(this.db)){let t=this.app.vault.getAbstractFileByPath(e);if(!(t instanceof C.TFile))continue;U(this.app,t,this.settings)?.skip&&delete this.db[e]}}markDirty(){this.dbDirty=!0,this.rev++}setState(e,t){let i=t.time===void 0?{...t,time:Date.now()}:t,n=this.db[e]!==void 0;n&&e===this.lastKey?this.db[e]=i:(n&&delete this.db[e],this.db[e]=i,this.lastKey=e),this.markDirty()}trimToLimit(){let e=Object.keys(this.db);if(e.length<=at)return;let t=Math.max(0,e.length-Tn),i=[],n=[];for(let o=0;o<e.length;o++){let a=e[o];o<t&&this.isEmptyRecord(a,this.db[a])?i.push(a):n.push(a)}let s=new Set([...i,...n].slice(0,e.length-Pn));this.db=Object.fromEntries(e.filter(o=>!s.has(o)).map(o=>[o,this.db[o]]))}async migrateDefaultDbFileName(){if(this.settings.dbFileName)return;let e=this.app.vault.adapter,t=this.manifestDir+"/"+Ln;try{if(await e.exists(this.defaultDbFileName)||!await e.exists(t))return;await e.rename(t,this.defaultDbFileName)}catch(i){console.error("Can't rename the legacy default database file:",i)}}async readDb(){if(this.lastDiskMtime=0,await this.migrateDefaultDbFileName(),await this.cacheDiskMtime(),this.lastDiskMtime===0)return;let e;try{e=await this.app.vault.adapter.read(this.getDbPath())}catch(t){console.error("Can't read database:",t),this.db={};return}try{let{schema:t,db:i}=ye(e);this.db=i,this.noteSchema(t,!0)}catch(t){console.error("Can't read database:",t),this.db={},await this.preserveUnreadableDb(e,t)}}noteSchema(e,t){let i=this.lastSeenSchema>=ne;if(this.lastSeenSchema=e,!(e>=ne)){if(t){if(this.legacyStartupNotified)return;this.legacyStartupNotified=!0,ve(l("dataStorage.legacyDb.notice"));return}!i||this.legacyOverwriteNotified||(this.legacyOverwriteNotified=!0,ve(l("dataStorage.legacyDb.noticeOverwritten")))}}countDefaultPosition(){let e=0;for(let t of Object.keys(this.db))this.isEmptyRecord(t,this.db[t])&&e++;return e}isEmptyRecord(e,t){return(t.scroll??0)>0?!1:t.cursor?we(t.cursor,this.defaultCursorLine(e)):!0}defaultCursorLine(e){let t=this.app.vault.getAbstractFileByPath(e);if(!(t instanceof C.TFile))return;let i=this.app.metadataCache.getFileCache(t);if(i)return i.frontmatterPosition?i.frontmatterPosition.end.line+1:0}async preserveUnreadableDb(e,t){if(e===this.preservedCorrupt)return;this.preservedCorrupt=e;let i=this.corruptCopyPath(),n=!0;try{await this.app.vault.adapter.write(i,e)}catch(s){n=!1,console.error("Can't keep a copy of the unreadable database:",s)}console.error(n?`Position Restore: unreadable database file, kept a copy at ${i}`:"Position Restore: unreadable database file, and no copy could be written",t),!this.corruptNotified&&(this.corruptNotified=!0,ve(n?l("dataStorage.corruptDb.notice",i):l("dataStorage.corruptDb.noticeNoCopy")))}async cacheDiskMtime(){try{let e=await this.app.vault.adapter.stat(this.getDbPath());this.lastDiskMtime=e?e.mtime:0}catch{this.lastDiskMtime=0}}mergeDiskDb(e){let t=Object.keys(e).length;for(let i of Object.keys(this.db)){let n=(this.db[i].time??0)>=(e[i]?.time??0);(e[i]===void 0||n)&&(e[i]!==void 0&&t--,e[i]=this.db[i])}return this.db=e,this.lastKey=null,t}async mergeExternalChanges(){let e=this.mergeChain.then(()=>this.runMergePass());this.mergeChain=e.catch(()=>{}),await e}async runMergePass(){let e;try{let i=await this.app.vault.adapter.stat(this.getDbPath());if(!i)return;e=i.mtime}catch{return}if(e===this.lastDiskMtime)return;let t;try{t=await this.app.vault.adapter.read(this.getDbPath())}catch(i){console.error("Can't merge external db changes:",i);return}try{let{schema:i,db:n}=ye(t);this.mergeDiskDb(n),this.lastDiskMtime=e,this.noteSchema(i,!1)}catch(i){console.error("Can't merge external db changes:",i),await this.preserveUnreadableDb(t,i)}}async writeDb(){if(!this.dbDirty)return;await this.mergeExternalChanges(),this.trimToLimit();let e=this.rev,t={};for(let s of Object.keys(this.db)){let o=this.db[s],a=(o.scroll??0)>0?void 0:this.defaultCursorLine(s);t[s]=Ut(o,a)}let i=JSON.stringify({schema:ne,lastPositions:t}),n=this.getDbPath();try{await this.app.vault.adapter.write(n,i)}catch{await this.ensureDbFolder();try{await this.app.vault.adapter.write(this.getDbPath(),i)}catch(s){console.error("Can't write database:",s);return}}await this.cacheDiskMtime(),this.lastSeenSchema=ne,this.dbDirty=e!==this.rev}renameFile(e,t){this.db[t]&&(this.db[e]=this.db[t],delete this.db[t],this.markDirty())}deleteFile(e){this.db[e]&&(delete this.db[e],this.markDirty())}};var te=require("obsidian");function lt(r,e){return!!r!=!!e?!1:!r||!e?!0:r.from.ch===e.from.ch&&r.from.line===e.from.line&&r.to.ch===e.to.ch&&r.to.line===e.to.line}function K(r,e){let t=r.cursor,i=e.cursor;return lt(t,i)?r.scroll===e.scroll:!1}var Ee=class r{constructor(e,t){this.lastPersisted="";this.leavesByPath=new Map;this.app=e,this.database=t,this.leafStates=r.loadLeafStates(e),this.reindexLeaves()}static storageKeyFor(e){return`position-restore:tabs:${e.appId??e.vault.getName()}`}static loadLeafStates(e){try{let t=r.storageKeyFor(e),i=window.localStorage.getItem(t);if(!i)return new Map;let n=JSON.parse(i),s=new Map;for(let[o,a]of Object.entries(n))a&&typeof a.filePath=="string"&&a.st&&s.set(o,a);return s}catch(t){return console.error("Position Restore: can not read the position overlay:",t),new Map}}leafRecord(e){return this.leafStates.get(e)}leafEntries(){return this.leafStates.entries()}leafIdsOnPath(e){let t=this.leavesByPath.get(e);return t?[...t]:[]}putLeaf(e,t){this.leafStates.set(e,t),this.reindexLeaves()}dropLeaf(e){this.leafStates.delete(e),this.reindexLeaves()}reindexLeaves(){this.leavesByPath.clear();for(let[e,t]of this.leafStates){let i=this.leavesByPath.get(t.filePath);i?i.add(e):this.leavesByPath.set(t.filePath,new Set([e]))}}dropLeavesWhere(e){let t=!1;for(let[i,n]of this.leafEntries())e(i,n)&&(this.dropLeaf(i),t=!0);return t}read(e,t){let i=this.leafRecord(e);return i&&i.filePath===t?i.st:this.database.db[t]}fileLayerHolds(e,t){let i=this.database.db[e];return i!==void 0&&K(i,t)}write(e,t,i){let n=this.leafRecord(e),s=n!==void 0&&n.filePath===t;s&&K(n.st,i)||(this.putLeaf(e,{filePath:t,st:i}),(s||!this.fileLayerHolds(t,i))&&this.database.setState(t,i))}forgetLeaf(e){this.dropLeaf(e)}dropPath(e){this.database.deleteFile(e);for(let t of this.leafIdsOnPath(e))this.dropLeaf(t)}deleteFile(e){this.dropPath(e)}dropExcluded(e){this.dropPath(e)}renameFile(e,t){this.database.renameFile(e,t);for(let i of this.leafIdsOnPath(t)){let n=this.leafRecord(i);n&&this.putLeaf(i,{...n,filePath:e})}}pruneDeadLeaves(e){return this.dropLeavesWhere(t=>!e.has(t))}pruneDatabase(){let e=new Set(Object.keys(this.database.db)),t=this.database.pruneDb();return t===0?0:(this.dropLeavesWhere((n,s)=>e.has(s.filePath)&&this.database.db[s.filePath]===void 0)&&this.persist(),t)}overlayRecords(){let e={};for(let[t,i]of this.leafEntries())i.filePath&&(this.fileLayerHolds(i.filePath,i.st)||(e[t]=i));return e}persist(){try{let e=JSON.stringify(this.overlayRecords());if(e===this.lastPersisted)return;let t=r.storageKeyFor(this.app);window.localStorage.setItem(t,e),this.lastPersisted=e}catch(e){console.error("Position Restore: can not persist the position overlay:",e)}}};var qt=require("obsidian");function A(r,e){let t=r.workspace.rootSplit,i=e.containerEl;return!!t?.containerEl&&!!i&&t.containerEl.contains(i)}function re(r){let e=r.containerEl;return!!e&&!!e.closest?.(".hover-popover")}function dt(r){let e=r.workspace.getActiveViewOfType(qt.MarkdownView);if(e?.file)return e;let t,i=-1;for(let n of r.workspace.getLeavesOfType("markdown")){if(re(n)||ct(n))continue;let s=n.view;if(!s?.file)continue;let o=n.activeTime??0;o>i&&(i=o,t=s)}return t}function Jt(r){return r.id}function $(r){if(r)try{let e=r.getDisplayText();return typeof e=="string"&&e?e:void 0}catch{return}}function G(r){if(r)try{let e=r.getIcon();return typeof e=="string"&&e?e:void 0}catch{return}}function ct(r){return!!r?.isDeferred}function se(r,e){let t=r.viewRegistry;if(!t?.getViewCreatorByType)return!1;try{return!t.getViewCreatorByType(e)}catch{return!1}}function Xt(r){return r.navigation!==!1}function Yt(r){let e=O(r)?.file;return typeof e=="string"&&e?e:void 0}var Rn=2048;function O(r){if(r)try{let e=r.getState();if(!e||typeof e!="object"||Array.isArray(e))return;let t=JSON.stringify(e);if(!t||t==="{}"||t.length>Rn)return;let i=JSON.parse(t);return i&&typeof i=="object"&&!Array.isArray(i)?i:void 0}catch{return}}var ke=require("obsidian"),zt=2e3;function q(r){return r.containerEl}var Se=class{constructor(){this.covered=new Map}isCovered(e){return this.covered.has(e)}appliedAt(e){return this.covered.get(e)?.appliedAt}contentArrived(e){let t=this.covered.get(e);return t?.ready?t.ready():!0}cover(e,t){let i=this.covered.get(e);i&&window.clearTimeout(i.timer);let n={timer:0,ready:t??i?.ready,appliedAt:i?.appliedAt};this.covered.set(e,n),this.applyCover(e),this.markVisible(e,n),n.timer=window.setTimeout(()=>{this.uncover(e)},zt),i||window.requestAnimationFrame(()=>this.reapplyCover(e))}uncover(e){let t=this.covered.get(e);if(!t)return;window.clearTimeout(t.timer),this.covered.delete(e);let i=q(e).querySelector(".view-content");i instanceof HTMLElement&&i.setCssStyles({opacity:""}),q(e).setCssStyles({opacity:""}),q(e).setCssStyles({backgroundColor:""})}restoreCover(e){e.contentEl.setCssStyles({opacity:"0"})}revealRestoreCover(e){e.contentEl.setCssStyles({opacity:""})}applyCover(e){let t=q(e).querySelector(".view-content");if(!(t instanceof HTMLElement)){q(e).setCssStyles({backgroundColor:"var(--background-primary)"});return}t.setCssStyles({opacity:"0"}),q(e).setCssStyles({backgroundColor:""})}markVisible(e,t){if(t.appliedAt===void 0){if(ke.Platform.isPhone){if(t.ready){if(!t.ready())return}else if(!this.contentShown(e))return}t.appliedAt=Date.now()}}contentShown(e){let t=e.view;return t instanceof ke.MarkdownView&&t.data.length>0}reapplyCover(e){let t=this.covered.get(e);if(!t)return;this.applyCover(e);let i=t.appliedAt;this.markVisible(e,t),i===void 0&&t.appliedAt!==void 0&&(window.clearTimeout(t.timer),t.timer=window.setTimeout(()=>{this.uncover(e)},zt)),window.requestAnimationFrame(()=>this.reapplyCover(e))}};function Fe(r){let e=[],t,i=!1,n=!1,s=r[0]?.trim()==="---";for(let o=0;o<r.length;o++){let a=r[o];if(s){o>0&&a.trim()==="---"&&(s=!1);continue}if(i){a.includes("-->")&&(i=!1);continue}if(n){a.includes("%%")&&(n=!1);continue}let d=a.match(/^ {0,3}(`{3,}|~{3,})/);if(d){t?d[1][0]===t[0]&&d[1].length>=t.length&&(t=void 0):t=d[1];continue}if(t)continue;let c=a.indexOf("<!--");if(c!==-1&&a.indexOf("-->",c)===-1){i=!0;continue}let p=a.indexOf("%%");if(p!==-1&&a.indexOf("%%",p+2)===-1){n=!0;continue}let h=a.match(/^ {0,3}(#{1,6})(?:[ \t]|$)(.*)$/);if(!h)continue;let f=h[2].replace(/[ \t]+#+[ \t]*$/,"").replace(/<!--[\s\S]*-->/g,"").replace(/%%[\s\S]*?%%/g,"").trim();f&&e.push({heading:f,level:h[1].length,line:o})}return e}function J(r,e){if(!r||!r.length)return[];let t=[];for(let i of r){if(i.line>e)break;for(;t.length&&t[t.length-1].level>=i.level;)t.pop();t.push(i)}return t.map(i=>i.heading)}var oi=require("obsidian");function M(r){let e=Qt(r);if(e===void 0)return;let t={scroll:e},i=Zt(r);return i&&(t.cursor=i),t}function Qt(r){let e=r.currentMode?.getScroll();if(!(e==null||!Number.isFinite(e)))return Math.round(e)}function Zt(r){let e=r.editor;if(!e)return;let t=e.getCursor("anchor"),i=e.getCursor("head");if(!(!t||!i||t.line===0&&t.ch===0&&i.line===0&&i.ch===0))return{from:{ch:t.ch,line:t.line},to:{ch:i.ch,line:i.line}}}var An=/^(?:-{3,}|\*{3,}|_{3,})$/;function ei(r,e){let t={},i=r.editor;if(!i||typeof i.getLine!="function")return t;if(e>=0&&e<=(i.lastLine?.()??-1)){let s=i.getLine(e).trim().slice(0,80);s&&!An.test(s)&&(t.anchor=s)}let n=r.file&&typeof r.file.stat?.mtime=="number"?r.file.stat.mtime:void 0;return n!==void 0&&(t.mtime=n),t}function xe(r,e){return{...r,cursor:{from:{line:e,ch:0},to:{line:e,ch:0}}}}function ti(r){let e=r.scroll;return e!=null&&Number.isFinite(e)?Math.round(e):void 0}function ii(r){let e=ti(r)??Qt(r);if(e===void 0)return;let t={scroll:e},i=Zt(r);return i&&(t.cursor=i),t}function Mn(r,e){let t=r.editor?.cm?.scrollDOM;return!t||t.offsetParent!==null?e:ti(r)??e}function S(r){let e=M(r);if(!e)return;let t=Mn(r,e.scroll);return{...e,scroll:t,...ei(r,t??-1)}}var ni=S;function ri(r,e){return{...e,...ei(r,e.scroll??-1)}}var Nn=30;function F(r){return r.toLowerCase().replace(/[\s\p{P}\p{S}]/gu,"")}function Dn(r,e,t){if(!r||e===void 0||e<0)return;let i=t.lastLine(),n=F(r);for(let s of[o=>o.trim()===r,o=>F(o)===n]){if(e<=i&&s(t.getLine(e)))return e;for(let o=1;o<=Nn;o++)for(let a of[e+o,e-o])if(!(a<0||a>i)&&s(t.getLine(a)))return a}}function si(r,e){let t=e.scroll??e.cursor?.from.line;if(t===void 0||t<0)return e;let i=Dn(e.anchor,t,r);return i===void 0||i===t?e:oe(e,i-t)}function oe(r,e){if(e===0)return r;let t={...r,anchor:void 0};return t.scroll!==void 0&&(t.scroll=Math.max(0,t.scroll+e)),t.cursor&&(t.cursor={from:{...t.cursor.from,line:Math.max(0,t.cursor.from.line+e)},to:{...t.cursor.to,line:Math.max(0,t.cursor.to.line+e)}}),t}function L(r,e){let t={};e.cursor&&(t.cursor=e.cursor),e.scroll&&e.scroll>0&&(t.scroll=e.scroll),Object.keys(t).length>0&&r.setEphemeralState(t)}var ai=100,pt=2e3,ht=600,li=1500;function X(r){return new Promise(e=>window.setTimeout(e,r))}function u(){return new Promise(r=>{let e=!1,t=window.setTimeout(()=>{e||(e=!0,r())},100);window.requestAnimationFrame(()=>{e||(e=!0,window.clearTimeout(t),r())})})}async function ut(r,e,t=pt){let i=Date.now()+t;for(;e()&&Date.now()<i;){if(Cn(r))return;await u()}}function Cn(r){if(r.getMode()==="source")return!0;let e=r.containerEl.querySelector(".markdown-preview-sizer");return!!e&&e.children.length>0&&e.scrollHeight>0&&r.currentMode?.getScroll()!=null}function On(r,e){let t=M(r);if(!t||(e.scroll??0)>0&&(t.scroll!==e.scroll||r.getMode()==="preview"&&!mt(r)))return!1;let i=e.cursor;if(!i)return!0;let n=t.cursor??{from:{line:0,ch:0},to:{line:0,ch:0}};return i.from.line===n.from.line&&i.from.ch===n.from.ch&&i.to.line===n.to.line&&i.to.ch===n.to.ch}async function ft(r,e,t,i=ht){let n=Date.now()+i,s=0;for(;Date.now()<n&&t();){if(await u(),!t())return;if(On(r,e)){if(++s>=3)return}else s=0,L(r,e)}}function x(r){return r instanceof oi.MarkdownView?r.getMode()==="source"?r.contentEl.querySelector(".cm-scroller"):r.containerEl.querySelector(".markdown-preview-view"):r.containerEl.querySelector(".bases-view")}function mt(r){let e=x(r);return!!e&&e.scrollTop>0}var In=4e3,Hn=2e3,Vn=750;function _n(r,e){if(r.length<=1)return[];let t=r.filter(i=>i.level===1).length===1?r.filter(i=>i.level!==1):r;return J(t,e)}var Pe=class{constructor(e){this.chip=null;this.hideTimer=0;this.shownAt=0;this.settings=e}show(e,t){if(this.clearHideTimer(),!this.settings.restoreBreadcrumb)return;let i=t??Math.round(e.currentMode?.getScroll()??0),n=Fe((e.data??"").split(`
`)),s=_n(n,i);s.length!==0&&(this.hasVisibleHeading(e,n)||(this.removeChip(),this.showChip(e,s),this.shownAt=Date.now(),this.hideTimer=window.setTimeout(()=>this.hide(),In)))}flashLine(e,t){if(!this.settings.flashLandingLine)return;if(e.getMode()==="preview"){let s=this.previewLineElement(e,t);s&&this.flash(s);return}let i=e.editor.cm,n=i?this.sourceLineElement(i,t):null;n&&this.flash(n)}dismissOnMove(){this.chip&&(Date.now()-this.shownAt<Hn||this.hide())}hide(){this.clearHideTimer();let e=this.chip;e&&(this.chip=null,e.setCssStyles({opacity:"0"}),e.animate([{opacity:1},{opacity:0}],{duration:200,easing:"ease-in",fill:"forwards"}),window.setTimeout(()=>e.remove(),220))}hasVisibleHeading(e,t){if(t.length===0)return!1;if(e.getMode()==="preview"){let c=x(e);if(!c)return!1;let p=c.getBoundingClientRect();for(let h of Array.from(c.querySelectorAll("h1, h2, h3, h4, h5, h6"))){let f=h.getBoundingClientRect();if(f.top<p.bottom&&f.bottom>p.top)return!0}return!1}let i=e.editor.cm,n=x(e);if(!i||!n)return!1;let s=n.getBoundingClientRect();if(s.height<=0)return!1;let o=i.state.doc,a=o.lineAt(i.viewport.from).number,d=o.lineAt(i.viewport.to).number;for(let c of t){let p=c.line+1;if(p<a||p>d)continue;let h=this.sourceLineElement(i,c.line);if(!h)continue;let f=h.getBoundingClientRect();if(f.top<s.bottom&&f.bottom>s.top)return!0}return!1}previewLineElement(e,t){let n=e.previewMode?.renderer?.sections;if(!Array.isArray(n))return null;for(let s of n){let o=s?.start?.line,a=s?.lines;if(!(typeof o!="number"||typeof a!="number")&&t>=o&&t<=o+Math.max(0,a-1))return s.el??null}return null}sourceLineElement(e,t){try{let i=e.state.doc,n=Math.min(Math.max(0,t),i.lines-1)+1,s=e.domAtPos(i.line(n).from);return(s.node.instanceOf(Element)?s.node:s.node.parentElement)?.closest(".cm-line")??null}catch{return null}}flash(e){e.addClass("is-flashing"),window.setTimeout(()=>e.removeClass("is-flashing"),Vn)}showChip(e,t){let i=e.contentEl;getComputedStyle(i).position==="static"&&i.addClass("position-restore-cue-host");let n=i.createDiv({cls:"position-restore-cue"});for(let s=0;s<t.length;s++){s>0&&n.createSpan({text:" / ",cls:"position-restore-cue-sep"});let o=s===t.length-1;n.createSpan({text:t[s],cls:o?"position-restore-cue-seg is-deepest":"position-restore-cue-seg"})}n.setAttribute("title",t.join(" / ")),this.chip=n,n.animate([{opacity:0},{opacity:1}],{duration:150,easing:"ease-out"}),n.setCssStyles({opacity:"1"})}removeChip(){this.clearHideTimer(),this.chip&&(this.chip.remove(),this.chip=null)}clearHideTimer(){this.hideTimer&&(window.clearTimeout(this.hideTimer),this.hideTimer=0)}};var Le=3e3,Te=class{constructor(e){this.injectedOpenLeafIds=new Set;this.lastActiveFilePath=void 0;this.restoreRun=0;this.activeRestores=0;this.inFlightRestoreLeafRuns=new Map;this.noAnchorLeafIds=new Set;this.lastAnchorAt=0;this.lastTouchAt=0;this.lastUserInputAt=0;this.handledLeafIdMap=new Map;this.pendingOpenKind=new Map;this.pendingLinkKindTimeout=0;this.pendingHistoryNav=!1;this.pendingHistoryNavTimeout=0;this.injectedLeafStates=new Map;this.cueSuppressUntil=0;this.searchAnchorUntil=0;this.cover=new Se;this.cue=new Pe(e)}beginLeafRestore(e,t){let i=++this.restoreRun;return this.inFlightRestoreLeafRuns.set(e,{filePath:t,run:i}),i}isCurrentLeafRestore(e,t){let i=this.inFlightRestoreLeafRuns.get(e);return!!i&&i.run===t}isRestoringFile(){return this.activeRestores>0}restoreStarted(){this.activeRestores++}restoreEnded(){this.activeRestores--}isSearchAnchored(){return Date.now()<this.searchAnchorUntil}leafId(e){return Jt(e)}};var vt=require("obsidian");var mi=require("obsidian");var di=require("obsidian");var Bn=3e3,Wn=200,jn=700,gt=800,Un=200,Kn=200,$n=100,ci=1250,Gn=150,pi=1e3,qn=32,Jn=400,hi=1200,Y=class{constructor(e){this.state=e}async relandDriftedScroll(e,t,i){if(!t||!t.scroll||t.scroll<=0)return;let n=t.scroll,s=this.state.lastTouchAt,o=Date.now()+Bn;if(e.getMode()==="source"){await this.relandSourcePixels(e,n,i,s);return}let a=n,d=1/0,c=0,p=Wn;for(;i()&&Date.now()<o;){if(this.state.lastTouchAt>s||!mt(e))return;let h=M(e);if(!h||h.scroll===void 0||h.scroll===n)return;let f=Math.abs(h.scroll-n);if(f>=d){if(++c>=2)return}else c=0,d=f;if(a+=n-h.scroll,a<=0)return;L(e,{...t,scroll:a}),await X(p),p=Math.min(p*1.4,jn)}}cmOf(e){let t=e.editor.cm;return t?.state?.doc&&t.scrollDOM?t:null}docMatchesView(e,t){let i=e.data;if(typeof i!="string"||i.length===0)return!0;let n=t.state.doc;return n.length!==i.length?!1:n.toString()===i}docIdentity(e){return this.cmOf(e)?.state.doc}noteArrived(e,t){if(!(e instanceof di.MarkdownView))return!0;if(e===t.view&&t.doc!==void 0){let i=this.docIdentity(e);if(i!==void 0)return i!==t.doc}return typeof e.data=="string"&&e.data.length>0&&e.data!==t.data}targetTopMeasurer(e,t,i){let n=t.scrollDOM,s=!1;return()=>{if(!s){if(!this.docMatchesView(e,t))return null;s=!0}if(i+1>t.state.doc.lines)return null;let o=t.state.doc.line(i+1).from;if(o<t.viewport.from||o>=t.viewport.to)return null;let a=t.coordsAtPos(o);return a?a.top-n.getBoundingClientRect().top:null}}bottomVisibleMeasurer(e){let t=e.scrollDOM;return()=>{let i=t.getBoundingClientRect(),n=e.posAtCoords({x:i.left+i.width/2,y:i.bottom-2})??e.state.doc.line(e.state.doc.lines).from,s=e.coordsAtPos(n);return s?s.top-i.top:null}}async landingNotInSight(e,t,i){if(t<=0)return!1;let n=this.cmOf(e);if(!n||t+1>n.state.doc.lines||(n.requestMeasure(),await u(),await u(),!i()))return!1;let s=this.targetTopMeasurer(e,n,t)();return s===null?!0:Math.abs(s)>n.scrollDOM.clientHeight/2}async settleShortCover(e,t,i,n,s){let o=this.cmOf(e);if(!o){let b=Math.min(s,Date.now()+Jn);for(;i()&&Date.now()<b&&(await u(),o=this.cmOf(e),!o););if(!o)return}if(o.requestMeasure(),await u(),await u(),!i())return;let a=this.targetTopMeasurer(e,o,t),d=this.bottomVisibleMeasurer(o),p=(o.defaultLineHeight||20)/2,h=null,f=0,v=-1,m=-1,w=Date.now();for(;i()&&Date.now()<s;){if(this.state.lastTouchAt>n)return;let b=a();if(b===null){o.requestMeasure(),h=null,v=-1,await u();continue}let g=Date.now(),P=Math.max(1,g-w);w=g,m<0&&(m=g);let nt=d();if(nt===null){o.requestMeasure(),h=null,v=-1,await u();continue}if(h===null||Math.abs(b-h)>p||Math.abs(nt-f)>p){h=b,f=nt,v=-1,await u();continue}if(v<0&&(v=g,o.requestMeasure()),g-v>=Math.max(qn,P*2)&&g>=m+Gn)return;await u()}}async settleAndHold(e,t,i,n,s){let o=this.cmOf(e);if(!o)return;let a=this.targetTopMeasurer(e,o,t),d=o.scrollDOM,c=o.defaultLineHeight||20,p=c*2,h=null,f=-1,v=0;for(;i()&&Date.now()<s;){if(this.state.lastTouchAt>n)return;let m=a();if(m===null){o.requestMeasure(),h=null,f=-1,await u();continue}h!==null&&Math.abs(m-h)<=c/2?f<0&&(f=Date.now(),o.requestMeasure()):f=-1,h=m;let w=f>=0&&Date.now()-f>=$n,b=Math.abs(m)>p;if(!b&&!w){await u();continue}if(b){if(o.requestMeasure(),await u(),await u(),!i())return;let P=a();if(P===null)return;if(Math.abs(P)>p){if(v>=2)return;d.scrollTop+=P,v++,h=null,f=-1,await u();continue}if(h=P,w)return;await u();continue}let g=a();if(g===null)return;if(Math.abs(g)>p||Math.abs(g-m)>c/2){f=-1,h=g,await u();continue}return}}async settleSourcePixels(e,t,i,n){if(!t||!t.scroll||t.scroll<=0||e.getMode()!=="source")return;let s=this.cmOf(e);if(!s)return;let o=s.scrollDOM,a=t.scroll,d=s.defaultLineHeight||20,c=this.state.lastTouchAt,p=Date.now(),h=p+n,f=this.targetTopMeasurer(e,s,a),v=!1,m=null;for(;i()&&Date.now()<h;){if(this.state.lastTouchAt>c)return;let b=f();if(b===null){m=null,s.requestMeasure(),await u();continue}if(Date.now()-p>=Un&&m!==null&&Math.abs(b-m)<=d/2){v=!0;break}m=b,await u()}if(!v)return;let w=0;for(;w<2&&i();){if(this.state.lastTouchAt>c)return;let b=f();if(b===null||Math.abs(b)<=d*2)return;s.requestMeasure(),await u(),await u();let g=f();if(g===null||Math.abs(g)<=d*2)return;o.scrollTop+=g,w++;let P=Date.now()+Kn;for(;i()&&Date.now()<P;){if(this.state.lastTouchAt>c)return;await u()}}}async relandSourcePixels(e,t,i,n){if(!i()||this.state.lastTouchAt>n)return;let s=this.cmOf(e);if(!s)return;let o=s.scrollDOM;if(!this.docMatchesView(e,s)||t+1>s.state.doc.lines)return;let a=s.state.doc.line(t+1).from;if(a<s.viewport.from||a>=s.viewport.to)return;s.requestMeasure(),await u(),await u();let d=s.coordsAtPos(a);if(!d)return;let c=d.top-o.getBoundingClientRect().top;Math.abs(c)>o.clientHeight/2&&(o.scrollTop+=c)}};var ui=5e3,fi=8,Xn=3,I=class{constructor(e){this.state=e,this.pixels=new Y(e)}async restoreInjectedSource(e,t,i){let n=this.state.lastTouchAt,s=Date.now()+hi,o=t;try{let a=await this.waitContentArrived(e,i,s),d=t?.scroll??0;a&&i()&&d>0&&t&&await this.pixels.landingNotInSight(e,d,i)&&(L(e,t),await u());let c=a&&i()&&t?.scroll?await this.centerNamedLine(e,i):void 0;c!==void 0&&t&&(o={...t,scroll:c});let p=o?.scroll,h=await this.waitCoverApplied(e,i,s);h!==void 0&&i()&&p&&await this.pixels.settleShortCover(e,p,i,n,h+pi)}finally{i()&&this.state.cover.uncover(e.leaf)}await this.anchorToSettledState(e,o,i)}async waitContentArrived(e,t,i){for(;t()&&Date.now()<i;){if(this.state.cover.contentArrived(e.leaf))return!0;await u()}return this.state.cover.contentArrived(e.leaf)}async waitCoverApplied(e,t,i){for(;t()&&Date.now()<i;){let n=this.state.cover.appliedAt(e.leaf);if(n!==void 0||!this.state.cover.isCovered(e.leaf))return n;await u()}return this.state.cover.appliedAt(e.leaf)}async settleInjectedReveal(e,t,i){let n=Date.now(),s=this.state.lastTouchAt;try{i()&&t?.scroll&&await this.pixels.settleAndHold(e,t.scroll,i,s,n+ci)}finally{i()&&this.state.cover.uncover(e.leaf)}}async maskedRestore(e,t,i,n){this.state.cover.restoreCover(e);let s=Date.now()+(e.getMode()==="preview"?li:ht),o=Math.max(this.state.lastTouchAt,this.state.lastUserInputAt),a=()=>i()&&Math.max(this.state.lastTouchAt,this.state.lastUserInputAt)<=o;try{if(await ut(e,i,Math.min(pt,s-Date.now())),!i()||e.containerEl.querySelector(".is-flashing")||(await u(),!i()))return;if(n()&&t){let c=s-Date.now();c>0&&await ft(e,t,a,c)}else await u(),await u();if(!i())return;await this.pixels.settleSourcePixels(e,t,i,gt)}finally{i()&&(this.state.cover.uncover(e.leaf),this.state.cover.revealRestoreCover(e))}await this.anchorToSettledState(e,t,i)}async maskedRestoreSt(e,t,i){if((t.scroll??0)<=0){if(L(e,t),await u(),!i()||(await u(),!i()))return;await this.anchorToSettledState(e,t,i);return}await this.maskedRestore(e,t,i,()=>(L(e,t),!0))}async landPreview(e,t,i){try{if(await ut(e,i),!i()||e.containerEl.querySelector(".is-flashing"))return;await ft(e,t,i)}finally{i()&&this.state.cover.uncover(e.leaf)}await this.anchorToSettledState(e,t,i)}async historyJumpApply(e,t,i,n){n!==void 0?t=oe(t,n):t=si(e.editor,t);let s=this.namedLineAsk(e)!==void 0;if(L(e,s?{...t,scroll:0}:t),await u(),!i())return;let o=await this.centerNamedLine(e,i);if(o!==void 0)t={...t,scroll:o};else if(s&&(L(e,t),await u(),!i()))return;e.getMode()==="source"&&(t.scroll??0)>0&&await this.pixels.settleSourcePixels(e,t,i,gt),await this.anchorToSettledState(e,t,i)}namedLineTarget(e){let t=this.state.pendingLineFlash;if(!(!t||e.getMode()!=="source"||e.file?.path!==t.path)&&!(Date.now()-t.at>=ui))return t}namedLineAsk(e){let t=this.namedLineTarget(e);if(t&&t.center!==!1&&typeof e.editor?.scrollIntoView=="function")return t}async centerNamedLine(e,t){let i=this.namedLineTarget(e);if(i&&i.center!==!1&&!this.namedLineAsk(e))for(let o=0;o<Xn&&!(!t()||this.namedLineAsk(e)||!this.namedLineTarget(e));o++)await u();let n=this.namedLineAsk(e);if(!n||!t())return;let s=this.readScroll(e);try{e.editor.scrollIntoView({from:{line:n.line,ch:0},to:{line:n.line,ch:0}},!0)}catch{return}return this.settledScroll(e,t,s)}async settledScroll(e,t,i){let n,s=0;for(let o=0;o<fi&&t();o++){await u();let a=this.readScroll(e);if(a===void 0){s=0;continue}s=n!==void 0&&Math.abs(a-n)<.01?s+1:0,n=a;let d=i===void 0||Math.abs(a-i)>.01;if(s>=1&&(d||o>=fi-1))return Math.max(1,Math.round(a))}return n===void 0?void 0:Math.max(1,Math.round(n))}readScroll(e){let t=e.currentMode?.getScroll();return typeof t=="number"&&Number.isFinite(t)?t:void 0}async anchorToSettledState(e,t,i){if(!this.state.noAnchorLeafIds.has(this.state.leafId(e.leaf))&&(await X(ai),i()&&(e.getMode()==="source"||mi.Platform.isMobileApp)&&await this.pixels.relandDriftedScroll(e,t,i),i())){this.state.lastEphemeralState=M(e)??t,this.state.lastAnchorAt=Date.now();let n=this.markLandingLine(e);Date.now()>=this.state.cueSuppressUntil&&(this.markRestoredLine(e),this.state.cue.show(e,n))}}markLandingLine(e){let t=this.state.pendingLineFlash;if(t){if(Date.now()-t.at>=ui){this.state.pendingLineFlash=void 0;return}if(e.file?.path===t.path&&(this.state.pendingLineFlash=void 0,!(t.sourceOnly&&e.getMode()!=="source")))return this.state.cue.flashLine(e,t.line),t.line}}markRestoredLine(e){if(e.getMode()==="preview")return;let t=e.editor?.getCursor()?.line;t&&this.state.cue.flashLine(e,t)}};var Re=class{constructor(e,t,i){this.settleInProgress=!1;this.app=e,this.store=t,this.state=i,this.modes=new I(this.state)}start(e){let t=Date.now()+1e4,i=window.setInterval(()=>{this.settleInProgress||this.completeBackgroundRestores().then(n=>{(n||Date.now()>t)&&window.clearInterval(i)})},200);e(()=>window.clearInterval(i))}async completeBackgroundRestores(){if(this.settleInProgress)return!1;this.settleInProgress=!0;try{return await this.completeBackgroundRestoresInner()}finally{this.settleInProgress=!1}}async completeBackgroundRestoresInner(){if(!this.app.workspace.layoutReady)return!1;await u();let e=[];this.app.workspace.iterateAllLeaves(s=>{e.push(s)});let t=this.app.workspace.getActiveViewOfType(vt.MarkdownView),i=t?.leaf?this.state.leafId(t.leaf):void 0,n=!1;for(let s of e){let o=s.view;if(!(o instanceof vt.MarkdownView)||!o.file)continue;let a=this.state.leafId(s),d=o.file.path;if(a===i||this.state.inFlightRestoreLeafRuns.get(a)?.filePath===d)continue;let c=this.state.injectedOpenLeafIds.has(a);if(c&&this.state.handledLeafIdMap.get(a)!==d){this.state.injectedOpenLeafIds.delete(a);continue}if(!o.editor){n=!0;continue}if(c)await this.settleBackground(o,a,d);else if(this.state.handledLeafIdMap.get(a)!==d){let p=this.store.read(a,d);if(!p)continue;await this.restoreBackground(o,a,d,p)}}return!n}async settleBackground(e,t,i){let n=this.store.read(t,i),s=()=>e.file?.path===i;if(!!n&&(n.scroll??0)>0){this.state.cover.isCovered(e.leaf)||this.state.cover.cover(e.leaf),this.state.restoreStarted();try{await this.modes.settleInjectedReveal(e,n,s)}finally{this.state.restoreEnded()}}else s()&&this.state.cover.uncover(e.leaf);s()&&this.state.injectedOpenLeafIds.delete(t)}async restoreBackground(e,t,i,n){let s=()=>e.file?.path===i;this.state.noAnchorLeafIds.add(t),this.state.restoreStarted();try{await this.modes.maskedRestoreSt(e,n,s)}finally{this.state.noAnchorLeafIds.delete(t),this.state.restoreEnded()}s()&&this.state.handledLeafIdMap.set(t,i)}};var z=require("obsidian");var Ae=class{constructor(e,t,i,n){this.app=e,this.settings=t,this.store=i,this.state=n,this.modes=new I(this.state)}async restoreEphemeralState(){let e=this.app.workspace.getActiveViewOfType(z.FileView);if(e?.file&&!re(e.leaf)){if(e instanceof z.MarkdownView){await this.restoreMarkdown(e);return}e.getViewType()==="bases"&&this.settings.recordBaseScroll?await this.restoreFileViewScroll(e):this.state.cue.hide()}}async completeInjectedRestore(e){if(!this.app.workspace.layoutReady)return;let t=this.state.lastActiveFilePath,i=e?.view?.file?.path;this.state.lastActiveFilePath=i,await u();let n=this.app.workspace.getActiveViewOfType(z.MarkdownView);if(!n?.file)return;let s=this.state.leafId(n.leaf),o=n.file.path;if(this.state.injectedOpenLeafIds.has(s)){await this.restoreEphemeralState();return}t===o&&this.state.handledLeafIdMap.get(s)!==o&&await this.restoreEphemeralState()}async restoreMarkdown(e){let t=e.file?.path;t&&await this.restoreOpen(e,t,async(i,n,s)=>{let o=s??this.store.read(this.state.leafId(e.leaf),t),a=e.getMode();if(a==="source"){if(!o)return;n?await this.modes.restoreInjectedSource(e,o,i):await this.modes.maskedRestoreSt(e,o,i);return}if(a==="preview")if(o)n?await this.modes.landPreview(e,o,i):await this.modes.maskedRestoreSt(e,o,i);else return})}async restoreFileViewScroll(e){let t=e.file?.path;t&&await this.restoreOpen(e,t,async i=>{await this.landBaseScroll(e,t,i)})}async restoreOpen(e,t,i){let n=e instanceof z.MarkdownView,s=this.state.leafId(e.leaf),o=this.state.inFlightRestoreLeafRuns.get(s);if(o&&o.filePath===t)return;let a=n&&this.state.injectedOpenLeafIds.delete(s),d=a?this.state.injectedLeafStates.get(s):void 0;if(a&&this.state.injectedLeafStates.delete(s),n&&!(a&&this.state.cover.isCovered(e.leaf))&&this.state.cover.revealRestoreCover(e),this.state.pendingOpenKind.get(e.leaf)){this.state.pendingOpenKind.delete(e.leaf),this.state.cue.hide(),this.skipRestoreAndAnchor(e,t);return}if(!a&&this.hasOpenedLeafPath(e.leaf,t)){this.skipRestoreAndAnchor(e,t);return}this.state.cue.hide();let p=this.state.beginLeafRestore(s,t),h=()=>this.state.isCurrentLeafRestore(s,p)&&e.file?.path===t;this.state.restoreStarted();try{this.state.lastEphemeralState=void 0,this.state.lastLoadedFilePath=t,await i(h,a,d)}finally{let f=this.state.inFlightRestoreLeafRuns.get(s);f&&f.run===p&&this.state.inFlightRestoreLeafRuns.delete(s),this.state.restoreEnded()}}async landBaseScroll(e,t,i){let s=this.store.read(this.state.leafId(e.leaf),t)?.scroll??0;if(s<=0)return;let o=Date.now()+500,a=null;for(;i()&&!a&&Date.now()<o;)a=x(e),a||await u();let d=Date.now()+2e3,c=0,p=0;for(;i()&&a&&Date.now()<d;){if(Math.abs(a.scrollTop-s)<=1){if(++p>=3)break}else p=0,Date.now()-c>=100&&(a.scrollTop=s,c=Date.now());await u()}}skipRestoreAndAnchor(e,t){this.state.lastEphemeralState=void 0,this.state.lastLoadedFilePath=t,this.state.lastAnchorAt=Date.now(),this.state.cover.uncover(e.leaf)}hasOpenedLeafPath(e,t){let i=this.state.leafId(e),n=this.state.handledLeafIdMap.get(i);return n?n===t?!0:(this.state.handledLeafIdMap.set(i,t),!1):(this.pruneStaleLeafIds(),this.state.handledLeafIdMap.set(i,t),!1)}pruneStaleLeafIds(){let e=new Set;this.app.workspace.iterateAllLeaves(t=>{e.add(this.state.leafId(t))});for(let t of this.state.handledLeafIdMap.keys())e.has(t)||this.state.handledLeafIdMap.delete(t);for(let t of this.state.injectedOpenLeafIds)e.has(t)||this.state.injectedOpenLeafIds.delete(t);for(let t of this.state.injectedLeafStates.keys())e.has(t)||this.state.injectedLeafStates.delete(t);for(let t of this.state.pendingOpenKind.keys())e.has(this.state.leafId(t))||this.state.pendingOpenKind.delete(t);this.store.pruneDeadLeaves(e)}};var N=require("obsidian");var Yn=new Set(["empty"]);function Me(r){return!!r&&!Yn.has(r)}function y(r){return r.kind==="view"?`view:${r.viewType}`:r.path}function Ne(r){if(r.kind!=="view")return;let e=r;e.state!==void 0&&(!e.state||typeof e.state!="object"||Array.isArray(e.state))&&delete e.state,e.icon!==void 0&&!(typeof e.icon=="string"&&e.icon)&&delete e.icon,e.label!==void 0&&!(typeof e.label=="string"&&e.label)&&delete e.label}function gi(r){let e=r.indexOf("|");return e<0?r:r.slice(0,e)}function De(r){let e=r.indexOf("#"),t=r.indexOf("^"),i=t<0?e:e<0?t:Math.min(e,t);if(i<0)return;let n=r.slice(i+1);return r[i]!=="^"&&!n.startsWith("^")?void 0:(n.startsWith("^")?n.slice(1):n).toLowerCase()}function wt(r){if(r.kind==="view")return;if(r.kind==="jump"&&typeof r.keyLine=="number")return r.keyLine;let e=r.st;if(e)return e.scroll??e.cursor?.from.line}var Ce=class{constructor(e,t,i,n,s,o){this.app=e,this.settings=t,this.store=i,this.funnel=s,this.sampler=o,this.state=n,this.pixels=new Y(n)}installPatches(e){this.patchSetViewState(e),this.patchOpenLinkText(e)}patchSetViewState(e){let t=N.WorkspaceLeaf.prototype,i=t.setViewState;if(!i)return;let n=(s,o,a)=>this.injectEphemeralStateOnOpen(s,o,a);t.setViewState=function(s,o){return o=n(this,s,o),i.call(this,s,o)},e(()=>{t.setViewState=i})}patchOpenLinkText(e){let t=this.app.workspace,i=t.openLinkText;if(typeof i!="function")return;let n=this.state,s=this.settings;t.openLinkText=async function(...o){n.pendingLinkKind=void 0,n.pendingLinkText=void 0;let a=o[0];typeof a=="string"&&(a.includes("#")||a.includes("^"))?(n.pendingLinkKind="anchorLink",n.pendingLinkText=gi(a)):s.linkOpenPosition==="start"&&(n.pendingLinkKind="startPlainLink");try{return await i.apply(this,o)}finally{window.clearTimeout(n.pendingLinkKindTimeout),n.pendingLinkKindTimeout=window.setTimeout(()=>{n.pendingLinkKind=void 0,n.pendingLinkText=void 0},500)}},e(()=>{t.openLinkText=i})}injectEphemeralStateOnOpen(e,t,i){if(!t||typeof t.type!="string")return i;let n=t.state?.file;if(typeof n!="string"||!n||re(e))return i;let s=this.state.leafId(e),o=this.state.handledLeafIdMap.get(s)===n;o?this.state.pendingOpenKind.delete(e):this.resetLeafOpenState(e);let a=e.view;if(a instanceof N.MarkdownView&&a.file){let v=S(a);v&&(this.funnel.leave(a.file.path,s,v),this.sampler.flushOnLeave(a,a.file.path,v))}let d=!!i?.match||!!i?.["is-flashing"];if(A(this.app,e)&&this.funnel.recordOpen(n,s,{key:this.state.pendingLinkText??(d?`caller:${Date.now()}`:void 0),force:d}),this.state.pendingHistoryNav){let v=this.state.pendingHistoryNavPath===n?this.state.pendingHistoryNavState:void 0;if(this.state.pendingHistoryNav=!1,this.state.pendingHistoryNavState=void 0,this.state.pendingHistoryNavPath=void 0,window.clearTimeout(this.state.pendingHistoryNavTimeout),!o&&t.type==="markdown"){let m=v??this.store.read(s,n);if(m&&((m.scroll??0)>0||m.cursor)){let w=this.isSourceModeOpen(e,t),b=this.buildMergedState(m);return this.maybeCoverOpen(e,n,w&&(b.scroll??0)>0),this.state.injectedOpenLeafIds.add(s),this.state.injectedLeafStates.set(s,m),this.state.handledLeafIdMap.set(s,n),{...i,...b}}}return this.state.handledLeafIdMap.set(s,n),i}if(this.takeOverridingOpenKind(e,i,o))return this.state.handledLeafIdMap.set(s,n),this.state.searchAnchorUntil=Date.now()+Le,i;if(t.type!=="markdown"||!this.isSourceModeOpen(e,t))return i;let p=this.store.read(s,n),h=this.buildMergedState(p);if(h.scroll===void 0&&h.cursor===void 0)return i;let f=!this.app.workspace.layoutReady&&!i?.scroll&&!i?.cursor;return o&&!(i&&(i.scroll??0)===(h.scroll??0)&&(i.cursor?.from.line??-1)===(h.cursor?.from.line??-1))&&!f?i:(this.maybeCoverOpen(e,n,(h.scroll??0)>0),this.state.injectedOpenLeafIds.add(s),this.state.handledLeafIdMap.set(s,n),{...h,...i})}resetLeafOpenState(e){this.state.handledLeafIdMap.delete(this.state.leafId(e)),this.state.pendingOpenKind.delete(e)}takeOverridingOpenKind(e,t,i){let n=this.state.pendingLinkKind;if(n)return this.state.pendingOpenKind.set(e,n),this.state.pendingLinkKind=void 0,this.state.pendingLinkText=void 0,window.clearTimeout(this.state.pendingLinkKindTimeout),n;if(this.hasCallerTarget(t,i))return this.state.pendingOpenKind.set(e,"callerTarget"),"callerTarget"}hasCallerTarget(e,t=!1){return e?e.match||e["is-flashing"]?!0:t?!1:!!(e.cursor||e.scroll!=null):!1}buildMergedState(e){let t={};return e&&((e.scroll??0)>0&&(t.scroll=e.scroll),e.cursor&&(t.cursor=e.cursor)),t}maybeCoverOpen(e,t,i){i&&this.state.cover.cover(e,this.contentSwapGate(e,t))}contentSwapGate(e,t){let i=this.screenNote(e,t);if(i===void 0)return;let n=this.expectedContent(e,t);return()=>this.pixels.noteArrived(e.view,i)&&(n===void 0||n())}expectedContent(e,t){let i=this.app.vault,n=i?.getAbstractFileByPath?.(t);if(!(n instanceof N.TFile)||typeof i?.cachedRead!="function")return;let s;i.cachedRead(n).then(d=>{s=d},()=>{});let o,a=!1;return()=>{let d=s;if(d===void 0)return!1;let c=e.view;if(!(c instanceof N.MarkdownView))return!1;let p=this.pixels.docIdentity(c);return p!==void 0&&p===o||(o=p,a=typeof c.data=="string"&&c.data===d),a}}screenNote(e,t){let i=e.view;if(!(!(i instanceof N.MarkdownView)||i.file?.path===t))return{view:i,doc:this.pixels.docIdentity(i),data:i.data}}isSourceModeOpen(e,t){let i=t.state?.mode;if(i==="source"||i==="preview")return i==="source";let n=e.view;return n instanceof N.MarkdownView?n.getMode()==="source":this.app.vault.getConfig("defaultViewMode")!=="preview"}};var vi=require("obsidian"),zn="file-explorer",Oe=class{constructor(e,t,i){this.app=e;this.database=t;this.settings=i}install(e){let t=this.app.workspace,i=t.trigger;typeof i=="function"&&(t.trigger=(n,...s)=>(n==="hover-link"&&this.aim(s[0]),i.call(t,n,...s)),e(()=>{t.trigger=i}),this.patchScrollFlash(e))}patchScrollFlash(e){let t=vi.MarkdownPreviewRenderer.prototype,i=t.applyScrollDelayed;if(typeof i!="function")return;let n=(s,o)=>this.withoutOwnFlash(s,o);t.applyScrollDelayed=function(s,o){return i.call(this,s,n(s,o))},e(()=>{t.applyScrollDelayed=i})}withoutOwnFlash(e,t){return!t?.highlight||e!==this.aimedLine?t:(this.aimedLine=void 0,{...t,highlight:!1})}aim(e){if(this.aimedLine=void 0,this.settings.fileExplorerPreviewFocus!=="line"||!e||typeof e!="object")return;let t=e;if(t.source!==zn||!t.linktext||t.state)return;let i=this.app.vault.getFileByPath(t.linktext);if(!i||i.extension!=="md")return;let n=this.database.db[i.path];(n?.scroll??0)>0&&(t.state={scroll:n.scroll},this.aimedLine=n.scroll)}};var k=require("obsidian");var wi=require("obsidian");var Ie=class{constructor(e,t){this.app=e,this.settings=t}shouldSkipRecording(e){if(e.file){let n=U(this.app,e.file,this.settings);if(n?.forceRecord)return!1;if(n?.skip||this.isExcludedPath(e.file.path))return!0}let t=e instanceof wi.MarkdownView?e.editor:void 0,i=this.settings.minLinesToRecord;return!!(i>0&&t&&t.lineCount()<i)}isExcludedPath(e){let t=this.settings.excludedFolders;if(t.length===0)return!1;for(let i of t)if(e===i||e.startsWith(i+"/"))return!0;return!1}};var He=class{constructor(e,t,i,n,s){this.STORE_INTERVAL=97;this.SEARCH_INPUT_SELECTOR=".document-search-input, .cm-search input, .prompt-input, .search-input-container input";this.SEARCH_ANCHOR_GRACE_MS=250;this.searchGraceTimer=0;this.searchSettledTicks=0;this.lastAnchorDeadline=0;this.INTENT_WINDOW_MS=2e3;this.EMBED_BOUNDARY_SELECTOR='.internal-embed, .cm-embed-block, [class*="block-language"]';this.teleportAnchorAt=0;this.onScrollCapture=e=>{let t=e.target;if(!t||this.state.isRestoringFile()||this.state.isSearchAnchored()||!this.hasUserIntent())return;let i=this.findOwnerLeaf(t),n=i?.view;if(!i||!(n instanceof k.FileView)||!n.file)return;let s=t.closest(this.EMBED_BOUNDARY_SELECTOR);if(s&&n.containerEl.contains(s))return;let o=n.file.path,a=this.state.leafId(i);if(this.exclusions.shouldSkipRecording(n)){this.store.dropExcluded(o);return}if(n instanceof k.MarkdownView){let d=ii(n);if(!d)return;this.store.write(a,o,d);return}if(n.getViewType()!=="bases"||!this.settings.recordBaseScroll){this.store.forgetLeaf(a);return}this.store.write(a,o,{scroll:Math.round(t.scrollTop)})};this.onEditorSelection=e=>{let t=this.teleportMinLines;if(t<=0){this.teleportFrom=void 0;return}let i=this.app.workspace.getActiveViewOfType(k.MarkdownView);if(!i||i.editor!==e)return;let n=i.file?.path;if(!n||n!==this.state.lastLoadedFilePath)return;let s=e.getCursor("anchor"),o=this.teleportAnchorAt!==this.state.lastAnchorAt;this.teleportAnchorAt=this.state.lastAnchorAt;let a=o?void 0:this.teleportFrom,d=o?void 0:this.teleportFromPath;if(this.teleportFrom=s,this.teleportFromPath=n,e.somethingSelected()){this.teleportFrom=void 0;return}if(!a||d!==n||Math.abs(s.line-a.line)<t||this.state.isRestoringFile()||this.state.isSearchAnchored())return;let c=this.state.leafId(i.leaf);this.state.lastEphemeralState&&this.funnel.leave(n,c,ri(i,this.state.lastEphemeralState)),this.funnel.recordTeleport(n,c,s.line,S(i)),window.requestAnimationFrame(()=>{if(this.app.workspace.getActiveViewOfType(k.MarkdownView)!==i||i.file?.path!==n||e.getCursor("anchor").line!==s.line)return;let p=S(i);p&&this.funnel.landing({kind:"teleport",path:n,leafId:c,line:s.line,st:p})})};this.app=e,this.store=t,this.settings=i,this.exclusions=new Ie(e,i),this.state=n,this.funnel=s}get teleportMinLines(){let e=Math.floor(this.settings.navHistoryTeleportMinLines);return Number.isFinite(e)&&e>0?e:0}sampleActiveView(){if(this.state.searchAnchorUntil===Number.POSITIVE_INFINITY&&!this.searchGraceTimer){let a=document.activeElement;(!a||!a.closest(this.SEARCH_INPUT_SELECTOR))&&(this.state.searchAnchorUntil=0)}let e=this.app.workspace.getActiveViewOfType(k.MarkdownView);if(!e||!e.file)return;let t=e.file.path;if(this.state.isRestoringFile()||t!==this.state.lastLoadedFilePath)return;let i=this.exclusions.shouldSkipRecording(e);i&&this.store.dropExcluded(t);let n=M(e);if(!n)return;let s=this.state.lastEphemeralState;this.state.searchAnchorUntil!==this.lastAnchorDeadline&&(this.lastAnchorDeadline=this.state.searchAnchorUntil,this.searchSettledTicks=0),Number.isFinite(this.state.searchAnchorUntil)&&this.state.isSearchAnchored()&&(s&&K(n,s)?++this.searchSettledTicks>=2&&(this.state.searchAnchorUntil=Date.now(),this.searchSettledTicks=0,this.funnel.settled(t,this.state.leafId(e.leaf),ni(e)??n)):this.searchSettledTicks=0);let o;s&&(this.state.isSearchAnchored()||(k.Platform.isMobileApp?!K(n,s)&&this.hasUserIntent()&&(o=n):!lt(n.cursor,s.cursor)&&this.hasUserIntent()&&(o=n)),o&&(i||(this.store.write(this.state.leafId(e.leaf),t,o),this.state.cue.dismissOnMove()))),this.state.lastEphemeralState=n}findOwnerLeaf(e){let t=this.app.workspace.getActiveViewOfType(k.FileView);if(t?.file&&t.containerEl.contains(e))return t.leaf;let i;return this.app.workspace.iterateAllLeaves(n=>{if(i)return;let s=n.view;s instanceof k.FileView&&s.file&&s.containerEl.contains(e)&&(i=n)}),i}flushOnLeave(e,t,i){this.state.isRestoringFile()||this.exclusions.shouldSkipRecording(e)||this.store.write(this.state.leafId(e.leaf),t,i)}installScrollCapture(e){let t=this.app.workspace.containerEl,i=(0,k.debounce)(this.onScrollCapture,this.STORE_INTERVAL,!0);t.addEventListener("scroll",i,{capture:!0,passive:!0}),e(()=>t.removeEventListener("scroll",i,{capture:!0}))}installUserIntentTracker(e){let t=this.app.workspace.containerEl,i=()=>{this.state.lastUserInputAt=Date.now()};t.addEventListener("wheel",i,{capture:!0,passive:!0}),t.addEventListener("pointerdown",i,{capture:!0,passive:!0}),document.addEventListener("keydown",i,{capture:!0}),e(()=>{t.removeEventListener("wheel",i,{capture:!0}),t.removeEventListener("pointerdown",i,{capture:!0}),document.removeEventListener("keydown",i,{capture:!0})})}installTeleportWatcher(e){let t=this.app.workspace.on("editor-selection-change",this.onEditorSelection);e(()=>this.app.workspace.offref(t))}hasUserIntent(){let e=Math.max(this.state.lastTouchAt,this.state.lastUserInputAt);return Date.now()-e<this.INTENT_WINDOW_MS}installTouchListener(e){let t=this.app.workspace.containerEl,i=()=>{this.state.lastTouchAt=Date.now()},n=()=>{this.state.lastUserInputAt=Date.now()};t.addEventListener("touchstart",i,{capture:!0,passive:!0}),document.addEventListener("keydown",n,{capture:!0}),e(()=>{t.removeEventListener("touchstart",i,{capture:!0}),document.removeEventListener("keydown",n,{capture:!0})})}installSearchAnchor(e){let t=s=>{let o=s.target;return!!o&&typeof o.closest=="function"&&!!o.closest(this.SEARCH_INPUT_SELECTOR)},i=s=>{t(s)&&(this.searchGraceTimer&&(window.clearTimeout(this.searchGraceTimer),this.searchGraceTimer=0),this.state.searchAnchorUntil=Number.POSITIVE_INFINITY)},n=s=>{t(s)&&(this.searchGraceTimer&&window.clearTimeout(this.searchGraceTimer),this.searchGraceTimer=window.setTimeout(()=>{this.searchGraceTimer=0,!Number.isFinite(this.state.searchAnchorUntil)&&(this.state.searchAnchorUntil=Date.now())},this.SEARCH_ANCHOR_GRACE_MS))};document.addEventListener("focusin",i,!0),document.addEventListener("focusout",n,!0),e(()=>{document.removeEventListener("focusin",i,!0),document.removeEventListener("focusout",n,!0),this.searchGraceTimer&&window.clearTimeout(this.searchGraceTimer)})}installFrontmatterWatch(e){let t=n=>{U(this.app,n,this.settings)?.skip&&this.store.dropExcluded(n.path)},i=this.app.metadataCache.on("changed",t);e(()=>{this.app.metadataCache.offref(i)})}};var bi=require("obsidian");var ae=require("obsidian");function yi(r,e,t){let i=n=>{if(!(n.target instanceof HTMLElement)||n.target.closest(".collapse-icon"))return;let s=n.target.closest(".tree-item-self.is-clickable"),o=s?.closest('.workspace-leaf-content[data-type="outline"]');if(!s||!o)return;let a;r.workspace.iterateAllLeaves(m=>{!a&&m.view.getViewType()==="outline"&&m.view.containerEl===o&&(a=m)});let d=a?.view?.file;if(!(d instanceof ae.TFile))return;let c=a?.group,p;if(c)for(let m of r.workspace.getGroupLeaves(c)){let w=m.view;if(w instanceof ae.MarkdownView&&w.file===d){p=w;break}}else{let m=r.workspace.getActiveFileView?.();m instanceof ae.MarkdownView&&m.file===d&&(p=m)}if(!p||!p.file)return;let h=e.state.leafId(p.leaf),f=S(p);f&&e.leave(p.file.path,h,f);let v=s.querySelector(".tree-item-inner")?.textContent?.trim();v&&(e.recordOpen(p.file.path,h,{key:`outline:${v}`}),e.state.searchAnchorUntil=Date.now()+Le)};r.workspace.containerEl.addEventListener("click",i,{capture:!0}),t(()=>r.workspace.containerEl.removeEventListener("click",i,{capture:!0}))}var Qn=5e3,Ve=class{constructor(e,t){this.sinks=new Set;this.moving=!1;this.app=e,this.state=t}subscribe(e){return this.sinks.add(e),()=>{this.sinks.delete(e)}}isRecording(){return!this.moving&&this.app.workspace.layoutReady}isMoving(){return this.moving}recordOpen(e,t,i={}){if(this.isRecording()){if(i.viewType){let n={kind:"view",leafId:t,viewType:i.viewType};i.viewLabel&&(n.label=i.viewLabel),i.viewIcon&&(n.icon=i.viewIcon),i.viewState&&(n.state=i.viewState),this.publish({record:n,cause:"open"});return}e&&this.publish({record:i.key?{kind:"jump",path:e,leafId:t,key:i.key}:{kind:"visit",path:e,leafId:t},cause:i.key?"jump":"open",forced:i.force})}}recordTeleport(e,t,i,n){if(!this.isRecording())return;let s={kind:"teleport",path:e,leafId:t,line:i};n&&(s.st=n),this.publish({record:s,cause:"teleport"})}recordActivation(e){if(!e||!A(this.app,e)||!this.isRecording())return;this.publishLeave({cause:"tab",leaf:e});let t=e.view,i=this.state.leafId(e);if(t instanceof bi.FileView&&Xt(t)){t.file&&this.publish({record:{kind:"visit",path:t.file.path,leafId:i},cause:"tab"});return}if(ct(e)){let c=Yt(t);if(c){this.publish({record:{kind:"visit",path:c,leafId:i},cause:"tab"});return}}let n=t?.getViewType();if(!n||!Me(n)||se(this.app,n)||n==="markdown")return;let s={kind:"view",leafId:i,viewType:n},o=$(t);o&&(s.label=o);let a=G(t);a&&(s.icon=a);let d=O(t);d&&(s.state=d),this.publish({record:s,cause:"tab"})}leave(e,t,i){this.publishLeave({cause:"read",path:e,leafId:t,st:i})}settled(e,t,i){this.publishLeave({cause:"settled",path:e,leafId:t,st:i})}installOutlineCapture(e){yi(this.app,{state:this.state,leave:(t,i,n)=>this.leave(t,i,n),recordOpen:(t,i,n)=>this.recordOpen(t,i,n)},e)}async runBracketed(e){if(this.moving)return;this.moving=!0,this.state.restoreStarted();let t=!1,i=()=>{t||(t=!0,window.clearTimeout(n),this.state.restoreEnded(),this.moving=!1)},n=window.setTimeout(i,Qn);try{await e()}finally{i()}}visit(e){this.publish(e)}landing(e){for(let t of this.sinks)t.onLanded?.(e)}here(e){for(let t of this.sinks)t.onHere?.(e)}publish(e){for(let t of this.sinks)t.onVisit?.(e)}publishLeave(e){for(let t of this.sinks)t.onLeave?.(e)}};var E=require("obsidian");function Ei(r,e,t){let i=Zn(r,e,t);return i===void 0?void 0:i-t}function Zn(r,e,t){if(!r||!e)return;if(e.startsWith("outline:")){let a=e.slice(8).trim(),d=/^(#{1,6})\s+(.+)$/.exec(a),c=d?.[1].length,p=(d?d[2]:a).trim(),h=F(p);return h?er(r,p,h,t,c):void 0}let i=De(e);if(i!==void 0)return r.blocks?.[i]?.position.start.line;let n=e.indexOf("#");if(n===-1)return;let s=e.slice(n+1);if(!s)return;let o=F(bt(s));return o?yt(r.headings??[],a=>F(a.heading)===o,t):void 0}function er(r,e,t,i,n){let s=r.headings??[],o=d=>n===void 0||d.level===n,a=yt(s,d=>o(d)&&d.heading.trim()===e,i);return a!==void 0?a:yt(s,d=>o(d)&&F(d.heading)===t,i)}function bt(r){try{return decodeURIComponent(r)}catch{return r}}function Et(r,e,t){let i=F(e);if(!r||!i)return;let n,s=1/0;for(let o of r.headings??[]){if(F(o.heading)!==i)continue;if(t===void 0)return{line:o.position.start.line,level:o.level,heading:o.heading};let a=Math.abs(o.position.start.line-t);a<s&&(s=a,n={line:o.position.start.line,level:o.level,heading:o.heading})}return n}function yt(r,e,t){let i,n=1/0;for(let s of r){if(!e(s))continue;let o=s.position.start.line;if(t===void 0)return o;let a=Math.abs(o-t);a<n&&(n=a,i=o)}return i}var Si=3;function ki(r){return`position-restore:nav-history:${r.appId??r.vault.getName()}`}function Fi(r){try{let e=window.localStorage.getItem(ki(r));if(!e)return{entries:[],index:-1};let t=JSON.parse(e);if(t.v!==Si)return{entries:[],index:-1};let i=Array.isArray(t.entries)?t.entries.filter(s=>tr(s)):[];for(let s of i)Ne(s);let n=typeof t.index=="number"&&Number.isInteger(t.index)&&t.index>=-1&&t.index<i.length?t.index:i.length-1;return{entries:i,index:n}}catch(e){return console.error("Position Restore: can not read navigation history:",e),{entries:[],index:-1}}}function tr(r){if(!r||typeof r!="object")return!1;let e=r,t=i=>typeof i=="string"&&!!i;if(!t(e.leafId)||typeof e.t!="number")return!1;switch(e.kind){case"view":return t(e.viewType);case"jump":return t(e.path)&&t(e.key);case"teleport":return t(e.path)&&typeof e.line=="number";case"visit":return t(e.path);default:return!1}}function ir(r,e){return JSON.stringify({v:Si,entries:r,index:e})}function xi(r,e,t,i){let n=ir(e,t);if(n===i)return i;try{return window.localStorage.setItem(ki(r),n),n}catch(s){return console.error("Position Restore: can not persist navigation history:",s),i}}var nr=80,rr=1e3,Pi=3e3,Ti=10,_e=class{constructor(e,t,i,n,s){this.savedPosition=s;this.entries=[];this.index=-1;this.lastPersisted="";this.app=e,this.state=i,this.settings=t,this.funnel=n;let o=Fi(e);this.entries=o.entries,this.index=o.index,this.applyStackCap(),this.modes=new I(i)}onVisit(e){e.cause==="tab"&&e.record.kind!=="view"&&!this.settings.navHistoryRecordActivation||e.cause==="teleport"&&this.settings.navHistoryTeleportMinLines<=0||this.pushIfNew(e.record,e.forced)}onLeave(e){if(e.cause==="tab"){this.refreshTopLeafOnActivation(e.leaf);return}this.refreshTop(e.path,e.leafId,e.st,{landing:e.cause==="settled"})}onLanded(e){if(e.kind==="view"){if(!e.state)return;let i=this.entries[this.index];if(!i||i.kind!=="view"||i.viewType!==e.viewType||i.leafId!==e.leafId)return;i.state=e.state,e.label!==void 0&&(i.label=e.label),e.icon!==void 0&&(i.icon=e.icon);return}if(e.kind!=="teleport"||!e.st)return;let t=this.entries[this.index];!t||t.kind!=="teleport"||t.path!==e.path||t.leafId!==e.leafId||t.line!==e.line||(t.st=e.st,this.reviewDeparture(t))}stackCap(){let e=Math.floor(this.settings.navHistoryCap);return Number.isFinite(e)?Math.max(1,e):H.navHistoryCap}applyStackCap(){let e=this.stackCap();if(this.entries.length<=e)return 0;let t=this.entries.length-e;return this.entries.splice(0,t),this.index=this.entries.length===0?-1:Math.max(0,this.index-t),t}knownPaths(){let e=new Set;for(let t of this.entries)t.kind!=="view"&&e.add(t.path);return Array.from(e)}pushIfNew(e,t){let i=this.flushDeparture(),n=this.entries[this.index];if(!t&&n&&this.sameLocation(n,e)){i&&(this.pendingDepartureCheck=void 0);return}this.push(e);let s=this.entries[this.index];this.pendingDepartureCheck=i&&(s.kind==="jump"||s.kind==="teleport")&&s.path===i.visit.path&&s.leafId===i.visit.leafId?{visit:i.visit,owner:i.owner,nav:s}:void 0}sameLocation(e,t){if(e.leafId!==t.leafId)return!1;switch(t.kind){case"view":return e.kind==="view"&&e.viewType===t.viewType;case"jump":return e.kind==="jump"&&e.path===t.path&&(e.key===t.key||e.key.startsWith("outline:")&&t.key.startsWith("outline:")&&F(e.key.slice(8))===F(t.key.slice(8)));case"teleport":return e.kind==="teleport"&&e.path===t.path&&e.line===t.line;case"visit":return e.kind!=="view"&&e.path===t.path}}push(e){this.entries.length=this.index+1,this.entries.push({...e,t:Date.now()}),this.index=this.entries.length-1,this.applyStackCap()}refreshTop(e,t,i,n={}){let s=this.entries[this.index];if(!(!s||s.kind==="view"||s.path!==e||s.leafId!==t)){if(s.kind==="jump"||s.kind==="teleport"){if(n.landing){s.st=i,s.kind==="jump"&&(this.upgradeKeyLine(s,i),this.funnel.landing(s)),this.reviewDeparture(s);return}if(!s.st){s.st=i,s.kind==="jump"&&this.upgradeKeyLine(s,i);return}if(n.traversal){delete s.leftAt;return}s.leftAt=i;return}s.st=i}}leftBehind(e,t){let i=t.scroll,n=e.st?.scroll;return i!==void 0&&n!==void 0&&Math.abs(i-n)>Ti}flushDeparture(){let e=this.entries[this.index];if(!e||e.kind!=="jump"&&e.kind!=="teleport"||!e.leftAt)return;let t=e.leftAt;if(!this.leftBehind(e,t))return;delete e.leftAt;let i=e;return this.push({kind:"visit",path:e.path,leafId:e.leafId,st:t}),{visit:this.entries[this.index],owner:i}}reviewDeparture(e){let t=this.pendingDepartureCheck;if(this.pendingDepartureCheck=void 0,!t||t.nav!==e)return;let i=this.index-1;if(this.entries[this.index]!==t.nav||this.entries[i]!==t.visit||this.entries.indexOf(t.owner)===-1)return;let n=e.st?.scroll,s=t.visit.st?.scroll;n===void 0||s===void 0||Math.abs(n-s)>Ti||(this.entries.splice(i,1),this.index--)}refreshTopLeafOnActivation(e){if(!e||!this.funnel.isRecording()||!A(this.app,e))return;let t=this.entries[this.index];if(!t)return;let i=this.findLeafById(t.leafId)??(t.kind==="view"?this.findLeafShowing(t.viewType):void 0);if(!i||i===e)return;if(t.kind==="view"){if(i.isDeferred||i.view.getViewType()!==t.viewType)return;let s=O(i.view);s&&this.funnel.landing({kind:"view",leafId:t.leafId,viewType:t.viewType,state:s,label:$(i.view),icon:G(i.view)});return}let n=i.view;if(n instanceof E.MarkdownView&&n.file&&n.file.path===t.path){let s=S(n);s&&this.refreshTop(t.path,t.leafId,s)}}upgradeKeyLine(e,t){let i=this.app.vault.getAbstractFileByPath(e.path),n=i instanceof E.TFile?this.app.metadataCache.getFileCache(i):null,s=t.scroll??t.cursor?.from.line;if(e.key.startsWith("outline:")){let c=Et(n,e.key.slice(8),s);if(!c)return;e.key=`outline:${"#".repeat(c.level)} ${c.heading}`,e.keyLine=c.line;return}let o=De(e.key);if(o!==void 0){let c=n?.blocks?.[o]?.position.start.line;c!==void 0&&(e.keyLine=c);return}let a=e.key.indexOf("#");if(a===-1)return;let d=Et(n,bt(e.key.slice(a+1)),s);d&&(e.keyLine=d.line)}canStep(e){return e<0?this.index>0:this.index>=0&&this.index<this.entries.length-1}whereToStart(){return!!this.app.workspace.getActiveViewOfType(E.FileView)?.file||!!this.startLeaf()}hasStep(e){return this.canStep(e)&&this.whereToStart()}canNavigate(e){return this.funnel.isMoving()?!1:this.hasStep(e)}startLeaf(){return this.findLeafById(this.entries[this.index]?.leafId)??this.app.workspace.getMostRecentLeaf()??void 0}async navigate(e){this.canStep(e)&&(await this.funnel.runBracketed(()=>this.traverse(e)),this.funnel.here(this.entries[this.index]))}async travelTo(e,t){e.kind!=="teleport"&&(await this.funnel.runBracketed(async()=>{this.refreshTopFromActiveView(),this.funnel.visit({record:{...e},cause:e.kind==="jump"?"jump":"open"}),await this.execute(this.entries[this.index],-1,!0,t)}),this.funnel.here(this.entries[this.index]))}async openFilePlain(e,t,i){if(i){let a=this.app.vault.getAbstractFileByPath(e);if(!(a instanceof E.TFile))return;let d=this.app.workspace.getLeaf(i);await d.openFile(a),this.app.workspace.setActiveLeaf(d,{focus:!0});return}let n=this.findLeafById(t)??this.app.workspace.getMostRecentLeaf()??void 0;if(!n||(this.app.workspace.getActiveViewOfType(E.FileView)?.leaf!==n&&this.app.workspace.setActiveLeaf(n,{focus:!0}),n.isDeferred&&await n.loadIfDeferred(),n.view?.file?.path===e))return;let o=this.app.vault.getAbstractFileByPath(e);o instanceof E.TFile&&await n.openFile(o)}async openViewPlace(e,t){e.kind==="view"&&await this.execute(e,1,!1,t)}async traverse(e){let t=this.app.workspace.getActiveViewOfType(E.FileView);if(!t?.file){let i=this.entries[this.index];if(!i||i.kind==="view"){this.index+=e,await this.execute(this.entries[this.index],e);return}let n=this.startLeaf();if(!n)return;if(this.app.workspace.setActiveLeaf(n,{focus:!0}),t=this.app.workspace.getActiveViewOfType(E.FileView),!t?.file){await this.execute(this.entries[this.index],e);return}}this.refreshTopFromActiveView({traversal:!0}),this.index+=e,await this.execute(this.entries[this.index],e)}refreshTopFromActiveView(e={}){let t=this.entries[this.index];if(!t||t.kind==="view")return;let i=this.app.workspace.getActiveViewOfType(E.FileView),n=i?.file&&t.leafId===this.state.leafId(i.leaf)?i:this.findLeafById(t.leafId)?.view;if(n instanceof E.MarkdownView&&n.file?.path===t.path){let s=S(n);s&&this.refreshTop(t.path,t.leafId,s,e)}}async execute(e,t,i=!1,n){if(this.armLandingMark(e),n){let h=this.app.workspace.getLeaf(n);if(e.kind==="view"){await h.setViewState({type:e.viewType,state:e.state??{},active:!0});return}await this.openInLeaf(h,e);return}let o=this.app.workspace.getActiveViewOfType(E.FileView)?.leaf??this.app.workspace.getMostRecentLeaf()??void 0,a=this.findLeafById(e.leafId);if(e.kind==="view"){let h=a??this.findLeafShowing(e.viewType);if(!h){await this.showViewInNewTab(e.viewType,e.state);return}if(h!==o&&this.app.workspace.setActiveLeaf(h,{focus:!0}),h.isDeferred&&await h.loadIfDeferred(),h.view?.getViewType?.()===e.viewType){await this.relandViewState(h,e);return}if(h===o&&await this.delegateNative(t,h,void 0,e.viewType))return;await h.setViewState({type:e.viewType,state:e.state??{},active:!0});return}if(a&&a!==o){await this.openInLeaf(a,e);return}let d=a??o;if(!d)return;if(a||(e.leafId=this.state.leafId(d)),d.isDeferred&&await d.loadIfDeferred(),d.view?.file?.path===e.path){let h=d.view;h instanceof E.MarkdownView&&await this.applyLanding(h,e);return}let p=this.landingFor(e);await this.delegateNative(t,d,e.path,void 0,p)||i&&await this.delegateNative(t===1?-1:1,d,e.path,void 0,p)||await this.openInLeaf(d,e)}async relandViewState(e,t){if(!t.state)return;let i=O(e.view);i&&JSON.stringify(i)===JSON.stringify(t.state)||await e.setViewState({type:t.viewType,state:t.state,active:!0})}async applyLanding(e,t){let i=this.appliedLanding(t);if(!i)return;let n=()=>e.file?.path===t.path;this.state.cueSuppressUntil=Date.now()+Pi,await this.modes.historyJumpApply(e,i,n,this.resolveAnchorShift(t))}armLandingMark(e){if(e.kind==="view")return;let t=e.kind==="jump"?{line:wt(e),center:!0}:e.kind==="teleport"?{line:e.line,center:!0}:{line:e.st?.scroll??e.st?.cursor?.from.line,center:!1},i=t.line;if(i===void 0)return;let n=this.resolveAnchorShift(e);this.state.pendingLineFlash={path:e.path,line:Math.max(0,i+(n??0)),at:Date.now(),sourceOnly:e.kind!=="jump"||void 0,center:t.center}}appliedLanding(e){return this.landingOf(e)??this.savedPosition?.(e.path)}landingOf(e){if(e.st){let t=e.kind==="jump"?wt(e):void 0;return t===void 0?e.st:xe(e.st,t)}if(e.kind==="teleport"&&Number.isFinite(e.line))return{scroll:Math.max(0,e.line)}}landingFor(e){let t=this.landingOf(e);if(!t)return;let i=this.resolveAnchorShift(e);return i?oe(t,i):t}armHistoryNav(e,t){this.state.pendingHistoryNav=!0,this.state.pendingHistoryNavState=e,this.state.pendingHistoryNavPath=t,this.state.cueSuppressUntil=Date.now()+Pi,window.clearTimeout(this.state.pendingHistoryNavTimeout),this.state.pendingHistoryNavTimeout=window.setTimeout(()=>{this.state.pendingHistoryNav=!1,this.state.pendingHistoryNavState=void 0,this.state.pendingHistoryNavPath=void 0},rr)}async openInLeaf(e,t){this.app.workspace.getActiveViewOfType(E.FileView)?.leaf!==e&&this.app.workspace.setActiveLeaf(e,{focus:!0}),e.isDeferred&&await e.loadIfDeferred();let i=e.view;if(i?.file?.path===t.path){i instanceof E.MarkdownView&&await this.applyLanding(i,t);return}let s=this.app.vault.getAbstractFileByPath(t.path);s instanceof E.TFile&&(this.armHistoryNav(this.landingFor(t),t.path),await e.openFile(s))}async delegateNative(e,t,i,n,s){let o=t.history,a=e<0?o?.backHistory:o?.forwardHistory,d=a?.[a.length-1];return(i!==void 0?d?.state?.state?.file===i:d?.state?.type===n)?(i!==void 0&&this.armHistoryNav(s,i),this.app.commands.executeCommandById(e<0?"app:go-back":"app:go-forward"),await X(nr),i!==void 0?t.view?.file?.path===i:t.view?.getViewType?.()===n):!1}findLeafById(e){if(!e)return;let t;return this.app.workspace.iterateAllLeaves(i=>{!t&&this.state.leafId(i)===e&&(t=i)}),t}findLeafShowing(e){if(!se(this.app,e))return this.app.workspace.getLeavesOfType(e).find(t=>A(this.app,t))}async showViewInNewTab(e,t){let i=this.app.workspace.getLeaf("tab"),n=i;try{await n.setViewState({type:e,state:t??{},active:!0})}catch{n.detach();return}let s=i.view?.getViewType?.();(se(this.app,e)||s!==e)&&n.detach()}resolveAnchorShift(e){if(e.kind!=="jump"||!e.key||typeof e.keyLine!="number")return;let t=this.app.vault.getAbstractFileByPath(e.path);if(t instanceof E.TFile)return Ei(this.app.metadataCache.getFileCache(t),e.key,e.keyLine)}renameFile(e,t){for(let i of this.entries)i.kind!=="view"&&i.path===e&&(i.path=t)}deleteFile(e){let t=[],i=0;for(let n=0;n<this.entries.length;n++){let s=this.entries[n];if(s.kind!=="view"&&s.path===e){n<this.index&&i++;continue}t.push(s)}t.length!==this.entries.length&&(this.entries=t,this.index=t.length===0?-1:Math.min(this.index-i,t.length-1))}persist(){this.lastPersisted=xi(this.app,this.entries,this.index,this.lastPersisted)}};var St=require("obsidian");function Ai(r){if(!r)return 0;let e=r;if(!e.contentEl||!e.containerEl)return 0;let t=x(r);if(!t)return 0;if(r.getMode()==="preview"){let i=or(e.containerEl,t);if(i<=0)return 0;let n=ar(t);return n>0?Math.ceil(i/n):0}return Math.max(0,Math.floor(lr(r,t)/2)-1)}var sr=12;function or(r,e){let t=r.querySelector(".view-header");if(!t)return 0;let i=t.getBoundingClientRect();if(i.height<=0)return 0;let n=i.bottom-e.getBoundingClientRect().top;return n<=0?0:Math.round(n)+sr}function Li(r){let e=parseFloat(r);return Number.isFinite(e)?e:0}function ar(r){let e=getComputedStyle(r),t=Li(e.lineHeight);if(t>0)return t;let i=Li(e.fontSize);return i>0?i*1.6:0}function lr(r,e){let t=e.getBoundingClientRect();if(t.height<=0)return 0;let i=r.editor.cm;if(!i?.state?.doc)return 0;let n=t.left+t.width/2,s=Ri(i,n,t.top+2),o=Ri(i,n,t.bottom-2);return s!==null&&o!==null&&o>=s?o-s+1:i.defaultLineHeight>0?Math.round(t.height/i.defaultLineHeight):0}function Ri(r,e,t){try{let i=r.posAtCoords({x:e,y:t});return i===null?null:r.state.doc.lineAt(i).number-1}catch{return null}}var Mi=3;function Ni(r){return`position-restore:nav-recent:${r.appId??r.vault.getName()}`}function Di(r){try{let e=window.localStorage.getItem(Ni(r));if(!e)return{entries:[],pinned:[]};let t=JSON.parse(e);if(t.v!==Mi)return{entries:[],pinned:[]};let i=Array.isArray(t.places)?t.places.filter(n=>cr(n)):[];for(let n of i)Ne(n);return{entries:i,pinned:dr(t.pinned)}}catch(e){return console.error("Position Restore: can not read the recent files list:",e),{entries:[],pinned:[]}}}function dr(r){return Array.isArray(r)?r.filter(e=>typeof e=="string"&&!!e):[]}function cr(r){if(!r||typeof r!="object")return!1;let e=r.kind;return e!=="visit"&&e!=="view"?!1:pr(r)}function pr(r){let e=r,t=i=>typeof i=="string"&&!!i;return!t(e.leafId)||typeof e.t!="number"?!1:e.kind==="view"?t(e.viewType):t(e.path)}function hr(r,e){return JSON.stringify({v:Mi,places:r,pinned:e})}function Ci(r,e,t,i){let n=hr(e,t);if(n===i)return i;try{return window.localStorage.setItem(Ni(r),n),n}catch(s){return console.error("Position Restore: can not persist the recent files list:",s),i}}var ur={openFile:async()=>{},openJump:async()=>{},openView:async()=>{}};function Oi(r){let e=r.containerEl.getBoundingClientRect();return e.width>0&&e.height>0}var fr=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","avif","jfif","ico","tif","tiff","heic","heif"]);function mr(r,e){let t=e.lastIndexOf(".");if(t<0||t<e.lastIndexOf("/"))return!1;let i=e.slice(t+1).toLowerCase();if(!i)return!1;let n=r.viewRegistry;if(typeof n?.getTypeByExtension=="function")try{return n.getTypeByExtension(i)==="image"}catch{}return fr.has(i)}var Be=class{constructor(e,t){this.app=e;this.settings=t;this.entries=[];this.index=-1;this.pinned=[];this.listeners=new Set;this.open=ur;this.lastPersisted="";let i=Di(e);this.entries=i.entries,this.pinned=i.pinned}attach(e){this.open=e}cap(){let e=Math.floor(this.settings.recentFilesCap);return Number.isFinite(e)?Math.max(1,e):H.recentFilesCap}recordable(e){return this.exclusionReason(e)===void 0}exclusionReason(e){if(!e)return"system";let t=this.app.vault.configDir;return t&&(e===t||e.startsWith(`${t}/`))||e.startsWith(".trash/")?"system":(this.settings.recentFilesExcludeFolders??[]).some(n=>{let s=n.replace(/\/+$/,"");return!!s&&(e===s||e.startsWith(`${s}/`))})?"folder":this.settings.recentFilesExcludeImages&&mr(this.app,e)?"image":this.excludedByFrontmatter(e)?"property":void 0}excludedByFrontmatter(e){let t=this.settings.recentFilesExcludeProperties??[];return t.length===0?!1:ue(It(this.app,e),t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}changed(){for(let e of this.listeners)e()}remember(e){if(e.kind==="teleport")return;let t=e.kind==="jump"?{kind:"visit",path:e.path,leafId:e.leafId}:e;if(t.kind!=="view"&&!this.recordable(t.path))return;let i=this.indexOf(y(t)),n=i>=0?this.entries[i]:void 0;i>=0&&this.entries.splice(i,1),this.entries.push(gr(t,n)),this.index=this.entries.length-1,this.trim(),this.changed()}settle(e){if(e.kind!=="view"||!e.state)return;let t=this.indexOf(y(e));if(t<0)return;let i=this.entries[t];i.kind==="view"&&(i.state=e.state,e.label!==void 0&&(i.label=e.label),e.icon!==void 0&&(i.icon=e.icon),i.t=Date.now(),this.changed())}markCurrent(e){let t=this.indexFor(e);t!==this.index&&(this.index=t,this.changed())}pin(e){!e||this.pinned.includes(e)||(this.pinned.push(e),this.afterPinChange())}unpin(e){let t=this.pinned.indexOf(e);if(t<0)return{dropped:!1};this.pinned.splice(t,1);let i=this.entries.find(s=>y(s)===e),n=i&&i.kind!=="view"?this.exclusionReason(i.path):void 0;if(n){let s=i;return this.dropRow(e),this.afterPinChange(),{dropped:!0,reason:n,place:s}}return this.afterPinChange(),{dropped:!1}}wouldUnpinDrop(e){let t=this.entries.find(i=>y(i)===e);if(!(!t||t.kind==="view"))return this.exclusionReason(t.path)}restorePinned(e){let t=y(e);this.entries.some(i=>y(i)===t)||this.entries.push(e),this.pinned.includes(t)||this.pinned.push(t),this.afterPinChange()}movePinned(e,t){let i=this.pinned.indexOf(e);if(i<0)return;let n=Math.min(Math.max(i+t,0),this.pinned.length-1);n!==i&&(this.pinned.splice(i,1),this.pinned.splice(n,0,e),this.afterPinChange())}isPinned(e){return this.pinned.includes(e)}afterPinChange(){this.persist(),this.changed()}renameFile(e,t){let i=!1;for(let s of this.entries)s.kind==="view"||s.path!==e||(s.path=t,i=!0);let n=this.pinned.indexOf(e);n>=0&&(this.pinned[n]=t,i=!0),i&&this.changed()}deleteFile(e){this.dropRow(e)}forget(e){this.dropRow(e)}clear(){let e=new Set(this.pinned),t=this.entries.filter(i=>e.has(y(i)));t.length!==this.entries.length&&(this.keep(t),this.persist(),this.changed())}dropRow(e){let t=this.entries[this.index],i=this.entries.filter(o=>y(o)!==e),n=this.pinned.indexOf(e),s=n>=0;s&&this.pinned.splice(n,1),!(i.length===this.entries.length&&!s)&&(this.entries=i,this.index=t&&i.includes(t)?i.indexOf(t):-1,this.changed())}pruneExcluded(){let e=this.entries[this.index],t=new Set(this.pinned),i=this.entries.filter(s=>t.has(y(s))||s.kind==="view"||this.recordable(s.path)),n=this.entries.length-i.length;return n===0?0:(this.entries=i,this.index=e&&i.includes(e)?i.indexOf(e):-1,this.changed(),n)}knownPaths(){let e=new Set;for(let t of this.entries)t.kind!=="view"&&e.add(t.path);return Array.from(e)}async travel(e,t){let i=this.entries[e];if(i){if(i.kind==="view"){await this.open.openView(i,t);return}await this.open.openFile(i.path,i.leafId,t)}}async travelToHeading(e,t,i,n,s){let o=Math.max(0,i),a=o>0?Math.max(1,o-Ai(this.alignView(e))):0,d={kind:"jump",path:e,key:`outline:${t}`,keyLine:o,st:xe({scroll:a},o),leafId:n,t:Date.now()};await this.open.openJump(d,s)}alignView(e){let t=this.app.workspace;if(!t||typeof t.iterateAllLeaves!="function")return null;let i=null,n=null,s=null,o=null;t.iterateAllLeaves(d=>{let c=d.view;if(!(c instanceof St.MarkdownView)||!c.file)return;let p=Oi(c);c.file.path===e&&(p?i??=c:n??=c),p&&(s??=c),o??=c});let a=typeof t.getActiveViewOfType=="function"?t.getActiveViewOfType(St.MarkdownView):null;return i??(a&&Oi(a)?a:null)??s??n??a??o}applyCap(){let e=this.trim();return e>0&&this.changed(),e}persist(){this.lastPersisted=Ci(this.app,this.entries,this.pinned,this.lastPersisted)}indexOf(e){for(let t=0;t<this.entries.length;t++)if(y(this.entries[t])===e)return t;return-1}indexFor(e){if(!e)return-1;if(e.kind!=="teleport"){let t=this.indexOf(y(e));if(t>=0)return t}return e.kind==="view"?-1:this.indexOf(e.path)}trim(){let e=this.entries.length,t=new Set(this.pinned),i=0;for(let a of this.entries)t.has(y(a))||i++;let n=i-this.cap();if(n<=0)return 0;let s=[],o=0;for(let a=0;a<this.entries.length;a++){let d=this.entries[a];if(o<n&&a!==this.index&&!t.has(y(d))){o++;continue}s.push(d)}return this.keep(s),e-this.entries.length}keep(e){if(e.length===this.entries.length)return;let t=this.entries[this.index];this.entries=e,this.index=t&&e.includes(t)?e.indexOf(t):-1}};function gr(r,e){let t=Date.now(),i=e?.kind==="view"?e:void 0;return r.kind==="view"?{kind:"view",leafId:r.leafId,viewType:r.viewType,t,label:r.label,icon:r.icon,state:r.state??i?.state}:{kind:"visit",path:r.path,leafId:r.leafId,t}}var ze=require("obsidian");var Q="position-restore-recent-files";var R=require("obsidian");var je=require("obsidian");function Pt(r){return r.split("/").pop()??r}function We(r){let e=Pt(r),t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}function Hi(r){if(!r)return;let e=r.lastIndexOf(".");if(e<=r.lastIndexOf("/")+1)return"FILE";let t=r.slice(e+1).toLowerCase();return t==="md"?void 0:t.toUpperCase()}function Tt(r){if(r==="")return;let e=r.lastIndexOf("/");return e===-1?"":r.slice(0,e)}function Vi(r,e){let t=Tt(r);return t===void 0?"":e!==We(r)?r:t===""?"/":`${t}/`}function _i(r){let e=new Set,t=new Set;for(let i of r)e.has(i)&&t.add(i),e.add(i);return t}function Lt(r){return r.label?r.label:r.viewType==="graph"?l("recentFiles.graphView"):r.viewType}function Bi(r,e,t){if(r.kind==="view")return{name:Lt(r)};let i=e?.(r.path);return{name:t?.(r.path)??We(r.path),lineIndex:i?.cursor?.from.line??i?.scroll}}var Ft=6e4,xt=60*Ft,le=24*xt,kt=7*le,vr=30*le,Ii=365*le;function wr(r,e){let t=Math.max(0,e-r);return t<Ft?{n:0,unit:"now"}:t<xt?{n:Math.floor(t/Ft),unit:"m"}:t<le?{n:Math.floor(t/xt),unit:"h"}:t<kt?{n:Math.floor(t/le),unit:"d"}:t<5*kt?{n:Math.floor(t/kt),unit:"w"}:t<Ii?{n:Math.floor(t/vr),unit:"mo"}:{n:Math.floor(t/Ii),unit:"y"}}function Wi(r,e){let{n:t,unit:i}=wr(r,e);switch(i){case"now":return l("recentFiles.age.now");case"m":return`${t}${l("recentFiles.age.m")}`;case"h":return`${t}${l("recentFiles.age.h")}`;case"d":return`${t}${l("recentFiles.age.d")}`;case"w":return`${t}${l("recentFiles.age.w")}`;case"mo":return`${t}${l("recentFiles.age.mo")}`;case"y":return`${t}${l("recentFiles.age.y")}`}}var Ue=class{constructor(e,t){this.app=e;this.opts=t;this.descCache=new Map;this.meta=new Map;this.heads=new Map;this.reading=new Set;this.hasFile=e=>this.app.vault.getAbstractFileByPath(e)instanceof je.TFile;this.titleOf=e=>{if(!(!e||!this.opts.titleProperty?.()))return this.metaFor(e).title};this.metaRef=e.metadataCache?.on?.("changed",i=>{let n=this.meta.get(i.path)?.title;this.meta.delete(i.path),this.opts.titleProperty?.()&&this.titleOf(i.path)!==n&&this.opts.onTitleChange?.()})}dispose(){this.metaRef&&this.app.metadataCache?.offref?.(this.metaRef),this.metaRef=void 0}describe(e){let t=this.descCache.get(e);return t||(t=Bi(this.opts.entries()[e],this.opts.savedPosition,this.titleOf),this.descCache.set(e,t)),t}clearDescribeCache(){this.descCache.clear()}metaFor(e){let t=this.opts.titleProperty?.()??"";t!==this.titledFor&&(this.titledFor=t,this.meta.clear());let i=this.meta.get(e);if(i)return i;let n=yr(this.app,e,t);return n?(this.meta.set(e,n),n):br()}headingsFor(e){let t=this.metaFor(e).headings;return t&&t.length?t:this.textHeadings(e)}textHeadings(e){return this.ensureText(e,!0),this.heads.get(e)?.headings}ensureText(e,t){let i=e?this.app.vault.getAbstractFileByPath(e):null;if(!(i instanceof je.TFile))return;let n=i.stat.mtime;return this.heads.get(e)?.mtime!==n&&t&&!this.reading.has(e)&&(this.reading.add(e),this.readText(e,i,n)),n}async readText(e,t,i){let n=[];try{n=Fe((await this.app.vault.cachedRead(t)).split(`
`))}catch{}this.reading.delete(e),this.heads.set(e,{mtime:i,headings:n}),this.opts.onLateRead?.()}otherNamesFor(e,t){if(!e)return{aliases:[]};let i=this.metaFor(e),n=t?i.aliases.filter(s=>s!==t):i.aliases;return{frontTitle:i.frontTitle===t?void 0:i.frontTitle,aliases:n}}};function ji(r,e){if(!e||!r)return;let t=s=>{let o=Array.isArray(s)?s[0]:s;return typeof o!="string"?void 0:o.trim()||void 0},i=t(r[e]);if(i)return i;let n=e.toLowerCase();for(let s of Object.keys(r))if(s.toLowerCase()===n)return t(r[s])}function yr(r,e,t){let i=e?r.vault.getAbstractFileByPath(e):null,n=i instanceof je.TFile?r.metadataCache?.getFileCache?.(i):null;if(!n)return null;let s=n.headings?.map(p=>({heading:p.heading,level:p.level,line:p.position.start.line})),o=n.frontmatter,a=[],d=new Set,c=p=>{if(typeof p=="string"){let h=p.trim();h&&!d.has(h)&&(d.add(h),a.push(h))}else if(Array.isArray(p))for(let h of p)c(h)};return c(o?.aliases),{headings:s,aliases:a,frontTitle:ji(o,"title"),title:ji(o,t)}}function br(){return{headings:void 0,aliases:[]}}var V=require("obsidian");var Er="";function Ui(r,e,t=()=>!0,i){let n=new Map,s=(a,d)=>{let c=y(a),p={path:a.kind==="view"?Er:a.path,key:c,rep:d,current:d===e};return n.set(c,p),p};for(let a=r.length-1;a>=0;a--){if(!t(a))continue;let d=r[a];n.has(y(d))||s(d,a)}let o=Array.from(n.values());if(i){let a=new Map(i.map((d,c)=>[d,c]));o.sort((d,c)=>(a.get(d.key)??-1)-(a.get(c.key)??-1))}return o}function Ki(r){return r.toLowerCase().split(/\s+/).filter(Boolean)}function Sr(r,e,t,i){let n=Ki(e);if(n.length===0)return!0;let s=`${Pr(r)} ${t??""} ${i??""}`.toLowerCase();return n.every(o=>s.includes(o))}function kr(r,e){let t=r.entries[e];return t.kind==="view"||r.noteExists(t.path)}function Fr(r,e){let t=r.entries[e],i=r.describe(e),n=t.kind==="view"?void 0:r.otherNames(t.path,i.name),s=n?[n.frontTitle??"",...n.aliases]:[];return`${i.name??""} ${s.join(" ")}`}function xr(r,e){if(!r.outlineSearch())return;let t=r.entries[e];if(t.kind==="view")return;let i=r.headingsFor(t.path);return i?.length?i.map(n=>n.heading).join(`
`):void 0}function $i(r,e,t){return kr(r,e)?t?Sr(r.entries[e],t,Fr(r,e),xr(r,e)):!0:!1}function Gi(r,e,t){let i=Ki(e);if(!r?.length||!i.length||t!==void 0&&t<=0)return[];let n=[],s=[];for(let a of r){let d=a.heading.toLowerCase();d&&(i.every(c=>d.includes(c))?s.push(a):d.includes(i[0])&&n.push(a))}let o=s.length?s:n;return t===void 0?o:o.slice(0,t)}function Pr(r){return r.kind==="view"?`${r.viewType} ${Lt(r)}`:[Pt(r.path),r.path].filter(Boolean).join(" ")}var Ke=class{constructor(e,t){this.list=e;this.quiet=t;this.tips=new WeakMap;this.held=!1;this.onOver=e=>{if(e.pointerType==="touch"){this.forget();return}if(this.quiet?.()){this.forget();return}let t=this.subject(e.target);if(t===this.anchor||(this.forget(),!t))return;let i=this.tips.get(t);i&&(this.anchor=t,this.timer=this.win.setTimeout(()=>{this.timer=void 0,this.anchor===t&&!this.quiet?.()&&this.show(t,i)},1e3))};this.onOut=e=>{if(this.held)return;let t=e.relatedTarget;this.anchor&&t&&this.anchor.contains(t)||this.forget()};this.onLeave=()=>{this.forget()};this.doc=e.ownerDocument,this.win=this.doc.defaultView??window,this.list.addEventListener("pointerover",this.onOver),this.list.addEventListener("pointerout",this.onOut),this.list.addEventListener("pointerdown",this.onLeave),this.list.addEventListener("scroll",this.onLeave,{passive:!0})}attach(e,t){this.tips.set(e,t)}retract(){this.forget()}speak(e){if(this.quiet?.())return;let t=this.subject(e);if(!t)return;let i=this.tips.get(t);i&&(this.forget(),this.anchor=t,this.held=!0,this.show(t,i))}reset(){this.forget()}destroy(){this.forget(),this.list.removeEventListener("pointerover",this.onOver),this.list.removeEventListener("pointerout",this.onOut),this.list.removeEventListener("pointerdown",this.onLeave),this.list.removeEventListener("scroll",this.onLeave)}subject(e){let t=e&&e.nodeType===1?e:e?.parentElement??null;for(;t&&t!==this.list;){if(this.tips.has(t))return t;t=t.parentElement}}forget(){this.clearTimer(),this.hide(),this.anchor=void 0,this.held=!1}clearTimer(){this.timer!==void 0&&(this.win.clearTimeout(this.timer),this.timer=void 0)}hide(){this.el?.remove(),this.el=void 0}show(e,t){let i=this.doc.body.createDiv({cls:"position-restore-nav-tip",attr:{"aria-hidden":"true"}});t.path&&this.pathLine(i,t.path),t.frontTitle&&i.createDiv({cls:"nav-tip-text",text:t.frontTitle}),t.text&&i.createDiv({cls:"nav-tip-text",text:t.text}),t.trail&&i.createDiv({cls:"nav-tip-trail",text:t.trail}),this.el=i,this.place(i,e)}pathLine(e,t){let i=e.createDiv({cls:"nav-tip-path"}),n=t.split("/");n.forEach((s,o)=>{o>0&&i.createSpan({cls:"nav-tip-sep",text:"/"}),s&&i.createSpan({cls:o===n.length-1?"nav-tip-name":"nav-tip-seg",text:s})})}place(e,t){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect(),s={w:this.win.innerWidth,h:this.win.innerHeight},o=i.bottom+6;o+n.height>s.h&&(o=Math.max(6,i.top-6-n.height));let a=i.left;a+n.width>s.w&&(a=s.w-n.width-6),e.setCssStyles({top:`${Math.round(o)}px`,left:`${Math.round(Math.max(6,a))}px`})}};var $e=class{constructor(e,t){this.el=e;this.opts=t;this.claimed=!1;this.onDown=e=>{if(this.cancel(),this.claimed=!1,e.button!==0)return;this.at={x:e.clientX,y:e.clientY};let t=e.target instanceof Node?e.target:this.el;this.timer=this.win.setTimeout(()=>{this.timer=void 0,this.at=void 0,this.opts.onArm(t)},this.opts.ms)};this.onMove=e=>{this.at&&(Math.abs(e.clientX-this.at.x)>this.opts.slop||Math.abs(e.clientY-this.at.y)>this.opts.slop)&&this.cancel()};this.onEnd=()=>{this.cancel()};this.win=e.ownerDocument.defaultView??window,this.el.addEventListener("pointerdown",this.onDown),this.el.addEventListener("pointermove",this.onMove),this.el.addEventListener("pointerup",this.onEnd),this.el.addEventListener("pointercancel",this.onEnd)}destroy(){this.cancel(),this.el.removeEventListener("pointerdown",this.onDown),this.el.removeEventListener("pointermove",this.onMove),this.el.removeEventListener("pointerup",this.onEnd),this.el.removeEventListener("pointercancel",this.onEnd)}markArmed(){this.claimed=!0}consumeClick(){let e=this.claimed;return this.claimed=!1,e}release(){this.cancel(),this.claimed=!1}cancel(){this.timer!==void 0&&this.win.clearTimeout(this.timer),this.timer=void 0,this.at=void 0}};var Rt="position-restore-nav-row";function Dr(r,e,t,i){if(!(r>=t&&r+e<=t+i))return Math.round(r-(t+(i-e)/2))}function Cr(r){return r.join(" \u203A ")}var Ge=class{constructor(e){this.opts=e;this.refs=[];this.groups=[];this.pinnedCount=0;this.menuTapCloses=!1;this.onLift=e=>{if(e.type==="pointercancel"){this.disarm(),this.unmark();return}this.armed&&!(e.target instanceof Node&&this.armed.el.contains(e.target))&&this.disarm(),this.releaseMark()};this.tip=new Ke(e.list,e.tipsQuiet),e.touch&&(this.press=new $e(e.list,{ms:500,slop:10,onArm:t=>this.armAt(t)}),this.opts.list.addEventListener("click",()=>this.disarm()),this.opts.list.addEventListener("scroll",()=>{this.disarm(),this.unmark()},{passive:!0})),this.opts.list.addEventListener("pointermove",t=>this.hoverAt(t)),this.opts.list.addEventListener("pointerover",t=>this.hoverAt(t)),this.opts.list.addEventListener("pointerleave",t=>{this.hovered=void 0,this.pointerAt={x:t.clientX,y:t.clientY},this.opts.onHoverEnd?.()}),this.doc=this.opts.list.ownerDocument,this.doc.addEventListener("pointerup",this.onLift),this.doc.addEventListener("pointercancel",this.onLift)}activeRep(e){return e.hit?-1:this.groups[e.group]?.rep??-1}rowRep(e){return this.groups[e.group]?.rep??-1}pullPinnedToTop(){let e=new Map(this.groups.map(s=>[s.key,s])),t=this.opts.pinned(),i=[];for(let s of t){let o=e.get(s);o&&i.push(o)}if(this.pinnedCount=i.length,i.length===0)return;let n=new Set(i);this.groups=[...i,...this.groups.filter(s=>!n.has(s))]}endsPinnedBlock(e){return this.pinnedCount>0&&e===this.pinnedCount-1&&this.groups.length>this.pinnedCount}render(){this.disarm(),this.unmark(),this.tip.reset();let e=this.selected,t=e?.group,i=e?.hit?.heading;this.opts.list.empty(),this.opts.clearDescribeCache(),this.refs=[],this.groups=[],this.selected=void 0,this.hovered=void 0;let n=this.opts.filter().trim(),s=this.facts();this.groups=Ui(this.opts.entries,this.opts.currentIndex,a=>$i(s,a,n),this.opts.order()),this.pullPinnedToTop();let o=_i(this.groups.map(a=>this.printedName(a)));if(this.groups.forEach((a,d)=>{this.fileRow(a,d,o);let{hits:c,hidden:p}=this.hitsFor(a,n);for(let h of c)this.headingRow(h,d);p>0&&this.hiddenHits(p),this.endsPinnedBlock(d)&&this.opts.list.createDiv({cls:"position-restore-nav-pinned-sep"})}),this.refs.length||this.opts.list.createDiv({cls:"position-restore-nav-empty",text:this.emptyText(n)}),t!==void 0){let a=this.refs.find(c=>c.group===t&&(i===void 0?!c.hit:c.hit?.heading===i)),d=this.refs.find(c=>c.group===t&&!c.hit);a?this.choose(a):d?this.choose(d):this.clearSelection()}}emptyText(e){return e?l("recentFiles.noMatch"):l("recentFiles.empty")}orderedKeys(){return this.groups.map(e=>e.key)}printedName(e){return this.opts.describe(e.rep)?.name??We(e.path)}facts(){return{entries:this.opts.entries,describe:e=>this.opts.describe(e),otherNames:(e,t)=>this.opts.otherNames(e,t),headingsFor:e=>this.opts.headingsFor(e),noteExists:e=>this.opts.noteExists(e),outlineSearch:()=>this.opts.outlineSearch()}}hitsFor(e,t){if(!t||!e.path||!this.opts.outlineSearch())return{hits:[],hidden:0};let i=Gi(this.opts.headingsFor(e.path),t),n=i.slice(0,5),s=this.opts.entries[e.rep]?.leafId??"";return{hits:n.map(o=>({path:e.path,heading:o.heading,line:o.line,leafId:s})),hidden:i.length-n.length}}fileRow(e,t,i){let n=this.opts.entries[e.rep],s=this.printedName(e),o=this.opts.list.createDiv({cls:`${Rt} is-file`});e.current&&o.addClass("is-current"),t<this.pinnedCount&&o.addClass("is-pinned");let a=this.opts.pathDisplay();a!=="after"&&o.addClass("is-path-before"),o.dataset.group=String(t),o.setAttr("id",`${this.opts.listId}-row-g${t}`),o.setAttr("role","option"),o.setAttr("aria-selected","false");let d={el:o,group:t};o.addEventListener("click",g=>this.onClick(d,g)),o.addEventListener("pointerdown",g=>this.onPress(d,g)),o.addEventListener("contextmenu",g=>this.onContextMenu(g,d)),this.refs.push(d);let c=o.createDiv({cls:"nav-row-file"}),p=c.createDiv({cls:"nav-row-head"});p.createSpan({text:s,cls:"nav-row-name"});let h=Hi(e.path);if(h)p.createSpan({text:h,cls:"nav-file-tag"});else if(n?.kind==="view"){let g=l("recentFiles.viewBadge");if(n.icon){let P=p.createSpan({cls:"nav-row-view-icon"});(0,V.setIcon)(P,n.icon),P.setAttr("aria-label",g)}else p.createSpan({text:g,cls:"nav-file-tag"})}let v=(e.path?Tt(e.path):void 0)!==void 0&&(a!=="smart"||i.has(s));if(v&&c.createSpan({text:Vi(e.path,s),cls:"nav-row-path"}),this.opts.rowTime()&&n){let g=o.createSpan({text:Wi(n.t,Date.now()),cls:"nav-row-time"});o.addClass("is-timed"),this.tip.attach(g,{text:new Date(n.t).toLocaleString()})}let m=e.path?this.opts.otherNames(e.path,s):void 0,w={};e.path&&!v&&(w.path=e.path),m?.frontTitle&&(w.frontTitle=`${l("recentFiles.title")} ${m.frontTitle}`),m?.aliases.length&&(w.text=`${l("recentFiles.aliases")} ${m.aliases.join(" \xB7 ")}`),(w.path||w.text||w.frontTitle)&&this.tip.attach(o,w);let b=this.actionStrip(o);this.opts.touch&&this.menuControl(b,d),this.forgetControl(b,l("recentFiles.forget"),()=>this.opts.onForget(e.key))}headingRow(e,t){let i=this.opts.list.createDiv({cls:`${Rt} is-heading`});i.setAttr("role","option"),i.setAttr("aria-selected","false");let n={el:i,group:t,hit:e};i.setAttr("id",`${this.opts.listId}-row-g${t}-h${this.refs.length}`),i.addEventListener("click",a=>this.onClick(n,a)),i.addEventListener("pointerdown",a=>this.onPress(n,a)),i.addEventListener("contextmenu",a=>this.onContextMenu(a,n)),this.refs.push(n),i.createDiv({cls:"nav-row-file"}).createSpan({text:e.heading,cls:"nav-row-heading"});let o=J(this.opts.headingsFor(e.path),e.line);o.length>1&&this.tip.attach(i,{trail:Cr(o)}),this.opts.touch&&this.menuControl(this.actionStrip(i),n)}hiddenHits(e){this.opts.list.createDiv({cls:"position-restore-nav-more",text:l("recentFiles.moreHits",e)})}forgetControl(e,t,i){let n=e.createDiv({cls:"nav-row-forget clickable-icon"});n.setAttr("role","button"),n.setAttr("tabindex","-1"),n.setAttr("aria-label",t),(0,V.setIcon)(n,"x"),n.addEventListener("pointerdown",s=>{s.stopPropagation(),this.press?.release()}),n.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),!this.press?.consumeClick()&&i()})}onContextMenu(e,t){if(e.preventDefault(),this.opts.touch){this.arm(t,e.target instanceof Node?e.target:t.el);return}let i=this.rowRep(t);i>=0&&this.opts.onContextRow(i,{x:e.clientX,y:e.clientY},!t.hit,t.hit)}armAt(e){let t=this.rowAt(e);t&&this.arm(t,e)}arm(e,t){this.armed&&this.armed!==e&&this.disarm(),this.armed=e,e.el.addClass("is-armed"),this.markPressed(e.el),this.holdMark(),this.press?.markArmed(),this.tip.speak(t)}disarm(){this.armed&&(this.armed.el.removeClass("is-armed"),this.armed=void 0,this.tip.retract(),this.unmark())}markPressed(e){this.marked&&this.marked!==e&&this.marked.removeClass("is-pressed"),this.marked=e,e.addClass("is-pressed"),this.markFade!==void 0&&window.clearTimeout(this.markFade),this.markFade=window.setTimeout(()=>this.unmark(),820)}holdMark(){this.markFade!==void 0&&(window.clearTimeout(this.markFade),this.markFade=void 0)}unmark(){this.holdMark(),this.marked?.removeClass("is-pressed"),this.marked=void 0}releaseMark(){if(this.markFade!==void 0&&window.clearTimeout(this.markFade),this.armed){this.markFade=void 0;return}this.markFade=window.setTimeout(()=>this.unmark(),320)}actionStrip(e){let t=e.createDiv({cls:"nav-row-actions"});return t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.press?.consumeClick()}),t}menuControl(e,t){let i=e.createDiv({cls:"nav-row-menu clickable-icon"});i.setAttr("role","button"),i.setAttr("tabindex","-1"),i.setAttr("aria-label",l("recentFiles.rowMenu")),(0,V.setIcon)(i,"more-vertical"),i.addEventListener("pointerdown",n=>{n.stopPropagation(),this.press?.release(),this.menuTapCloses=this.opts.takeMenuBack()}),i.addEventListener("click",n=>{if(n.preventDefault(),n.stopPropagation(),this.press?.consumeClick())return;if(this.menuTapCloses){this.menuTapCloses=!1;return}let s=this.rowRep(t);if(s<0)return;let o=i.getBoundingClientRect();this.opts.onContextRow(s,{x:o.left+o.width/2,y:o.bottom},!t.hit,t.hit)})}hoverAt(e){if(e.pointerType==="touch")return;let t={x:e.clientX,y:e.clientY},i=this.pointerAt!==void 0&&(this.pointerAt.x!==t.x||this.pointerAt.y!==t.y);if(this.pointerAt=t,!i)return;let n=this.rowAt(e.target);if(!n||n===this.hovered)return;this.hovered=n;let s=this.rowRep(n);s>=0&&this.opts.onHoverRow(s,e,n.el,!n.hit,n.hit)}rowAt(e){let t=e instanceof HTMLElement?e.closest(`.${Rt}`):null;return t?this.refs.find(i=>i.el===t):void 0}collapse(){this.clearSelection()}onClick(e,t){if(t.preventDefault(),this.press?.consumeClick()){this.pressed=void 0,this.pressedAt=void 0,t.stopPropagation();return}let i=V.Keymap.isModEvent(t)||void 0,n=this.pressed;this.pressed=void 0,this.pressedAt=void 0;let s=this.refs.includes(e)?e:n===void 0?void 0:this.findRowByKey(n);s&&this.goTo(s,i)}onUnansweredClick(e){if(e.defaultPrevented)return;let t=this.stillAtPress(e),i=this.pressed;if(this.pressed=void 0,this.pressedAt=void 0,i===void 0||!t)return;let n=this.findRowByKey(i);n&&this.goTo(n,void 0)}stillAtPress(e){return!this.pressedAt||!(e instanceof MouseEvent)?!1:Math.abs(e.clientX-this.pressedAt.x)<=10&&Math.abs(e.clientY-this.pressedAt.y)<=10}onPress(e,t){if(t.button===1){t.preventDefault(),this.goTo(e,V.Keymap.isModEvent(t)||void 0);return}if(t.button!==0)return;let i=this.activeRep(e);this.pressed=i<0?void 0:this.opts.keyOf(i),this.pressedAt={x:t.clientX,y:t.clientY},this.markPressed(e.el)}findRowByKey(e){let t;for(let i of this.refs){let n=this.activeRep(i);if(!(n<0||this.opts.keyOf(n)!==e)){if(t)return;t=i}}return t}goTo(e,t){if(e.hit){this.opts.onTravelHeading(e.hit,t);return}let i=this.activeRep(e);i>=0&&this.opts.onTravel(i,t)}travel(e,t){let i=e??this.selected;return!i||!i.hit&&this.activeRep(i)<0?!1:(this.goTo(i,t),!0)}choose(e,t=!1){this.selected?.el!==e.el&&(this.selected?.el.removeClass("is-selected"),this.selected?.el.setAttr("aria-selected","false")),this.selected=e,e.el.addClass("is-selected"),e.el.setAttr("aria-selected","true"),this.reveal(e.el,t),this.opts.onActiveRow(e.el.id)}reveal(e,t){let i=this.opts.list.getBoundingClientRect();if(!t||i.height<=0){e.scrollIntoView({block:"nearest"});return}let n=e.getBoundingClientRect(),s=Dr(n.top,n.height,i.top,i.height);s!==void 0&&(this.opts.list.scrollTop+=s)}clearSelection(){this.selected?.el.removeClass("is-selected"),this.selected?.el.setAttr("aria-selected","false"),this.selected=void 0,this.opts.onActiveRow(void 0)}hideTip(){this.tip.retract()}destroy(){this.tip.destroy(),this.press?.destroy(),this.unmark(),this.doc.removeEventListener("pointerup",this.onLift),this.doc.removeEventListener("pointercancel",this.onLift)}move(e){let t=this.refs.length;if(t===0)return;let i=this.selected?this.refs.indexOf(this.selected):-1;if(i===-1){this.choose(this.refs[e>0?0:t-1],!0);return}this.choose(this.refs[(i+e+t)%t],!0)}};var Ji=require("obsidian");var Or=[["back","forward"],["top","bottom"]],Ir={back:"arrow-left",forward:"arrow-right",top:"arrow-up-to-line",bottom:"arrow-down-to-line"},Hr={back:"navHistory.commands.navigateBack",forward:"navHistory.commands.navigateForward",top:"noteEdge.commands.top",bottom:"noteEdge.commands.bottom"},qe=class{constructor(e,t,i){this.host=e;this.arrows=t;this.beforeAct=i;this.byAct=new Map;let n=e.createDiv({cls:"position-restore-nav-arrows"});for(let s of Or){let o=n.createDiv({cls:"position-restore-nav-arrow-group"});for(let a of s)this.byAct.set(a,this.button(o,a))}}refresh(){let e=this.arrows;this.enabled("back",e.canBack()),this.enabled("forward",e.canForward());let t=e.canEdge();this.enabled("top",t),this.enabled("bottom",t)}press(e){this.beforeAct();let t=this.arrows,i=e==="back"?t.back():e==="forward"?t.forward():e==="top"?t.top():t.bottom();Promise.resolve(i).then(()=>this.refresh())}forget(){this.byAct.clear()}button(e,t){let i=l(Hr[t]),n=e.createEl("button",{cls:"clickable-icon position-restore-nav-arrow",attr:{type:"button","aria-label":i,title:i}});return(0,Ji.setIcon)(n,Ir[t]),n.addEventListener("mousedown",s=>s.preventDefault()),n.addEventListener("click",()=>this.press(t)),n}enabled(e,t){let i=this.byAct.get(e);i&&(i.disabled=!t,i.toggleClass("is-disabled",!t))}};var Vr=600,At="is-flashing",Je=class{constructor(){this.running=!1;this.session=!1;this.wantCover=!1;this.hidden=[];this.deadline=0}attach(e,t){this.parent=e,this.onOpen=t}ask(e){if(this.session=!0,this.wantCover=e,e){let t=this.parent?.hoverPopover?.hoverEl;t&&t.isConnected&&this.beginCover(t)}this.start()}hoverEnded(){this.session=!1,this.wantCover=!1,this.coveredEl&&(this.reveal(),this.coveredEl=void 0)}isOpen(){let e=this.parent?.hoverPopover?.hoverEl;return!!e&&e.isConnected}stop(){this.running=!1,this.session=!1,this.wantCover=!1,this.popover=void 0,this.coveredEl=void 0,this.reveal()}start(){this.running||(this.running=!0,this.loop())}async loop(){for(;this.running&&(this.session||this.coveredEl);)this.tick(),await u();this.running=!1}tick(){let e=this.parent?.hoverPopover??void 0,t=e?.hoverEl;if(!e||!t||!t.isConnected){this.popover=void 0,this.coveredEl=void 0,this.reveal();return}if(e!==this.popover){this.reveal(),this.popover=e,this.coveredEl=void 0,this.onOpen?.(t),this.wantCover&&this.beginCover(t);return}if(this.coveredEl&&this.coveredEl!==t&&(this.reveal(),this.beginCover(t)),!!this.coveredEl){if(this.hideNew(this.coveredEl),this.coveredEl.querySelector(`.${At}`)){this.unflash(this.coveredEl),this.reveal(),this.coveredEl=void 0;return}Date.now()>this.deadline&&(this.reveal(),this.coveredEl=void 0)}}beginCover(e){this.reveal(),this.coveredEl=e,this.deadline=Date.now()+Vr,this.hideNew(e)}hideNew(e){for(let t of Array.from(e.children))t.instanceOf(HTMLElement)&&!this.hidden.includes(t)&&(t.setCssStyles({opacity:"0"}),this.hidden.push(t))}unflash(e){for(let t of Array.from(e.querySelectorAll(`.${At}`)))t.classList.remove(At)}reveal(){for(let e of this.hidden)e.setCssStyles({opacity:""});this.hidden=[]}};var _r=/[#^|[\]]/,Br="position-restore-nav-preview",Xe=class{constructor(e,t,i,n,s){this.app=e;this.reads=t;this.entries=i;this.previewFocus=n;this.onShown=s;this.hoverParent={hoverPopover:null};this.settle=new Je;this.settle.attach(this.hoverParent,o=>{this.lift(o),this.onShown()})}hoverRow(e,t,i,n,s){let o=this.entries()[e];if(!o||o.kind==="view")return;let a=this.reads.describe(e),d=s?s.line:this.wantsLine(n)?a.lineIndex:void 0,c=this.askFor(o,o.path,n,d);this.app.workspace.trigger("hover-link",{event:t,source:Q,hoverParent:this.hoverParent,targetEl:i,linktext:c.linktext,sourcePath:o.path,state:c.state}),this.settle.ask(c.state!==void 0)}hoverEnded(){this.settle.hoverEnded()}quiet(){return this.settle.isOpen()}stop(){this.settle.stop()}wantsLine(e){return!e||this.previewFocus()==="line"}askFor(e,t,i,n){if(i)return this.wantsLine(i)?{linktext:t,state:n===void 0?void 0:{scroll:n}}:{linktext:t};let s=n===void 0?void 0:this.subpathHeading(e,t,n);return s!==void 0?{linktext:`${t}#${s}`}:{linktext:t,state:n===void 0?void 0:{scroll:n}}}subpathHeading(e,t,i){if(e.kind==="view")return;let n=this.reads.headingsFor(t),s=J(n,i),o=s[s.length-1];if(!(!o||_r.test(o))&&!(n&&n.filter(a=>a.heading===o).length!==1))return o}lift(e){e.addClass(Br)}};var Kr=0;function $r(r){switch(r){case"folder":return l("recentFiles.folders.name");case"property":return l("recentFiles.frontmatterExclude.name");case"image":return l("recentFiles.excludeImages.name");case"system":return}}var Z=class{constructor(e){this.opts=e;this.filter="";this.listId=`position-restore-nav-list-${++Kr}`;this.existenceRefs=[];this.onVisibilityChange=()=>{!document.hidden&&this.opts.prefs.rowTime()&&this.render()};this.forgetMenu=()=>{this.hearPresses(!1),this.menu=void 0};this.onAnyPress=e=>{!this.menu||(e.target instanceof Element?e.target:null)?.closest(".menu-item, .nav-row-menu")||this.closeMenu()};this.reads=new Ue(e.app,{savedPosition:e.savedPosition,entries:()=>e.places.entries,onLateRead:()=>this.redrawSoon(),titleProperty:()=>this.opts.prefs.titleProperty(),onTitleChange:()=>this.render()})}mount(){this.opts.host.addClass("position-restore-nav-host"),this.opts.touch&&this.opts.host.addClass("is-touch"),this.toolbar();let e=this.opts.host.createDiv({cls:"position-restore-nav-list"});e.setAttr("id",this.listId),e.setAttr("role","listbox"),e.setAttr("aria-label",l("recentFiles.name")),this.listOpts={list:e,listId:this.listId,outlineSearch:()=>this.opts.prefs.outlineSearch(),pathDisplay:()=>this.opts.prefs.pathDisplay(),rowTime:()=>this.opts.prefs.rowTime(),pinned:()=>this.opts.places.pinned,order:()=>this.frozenOrder,keyOf:t=>{let i=this.opts.places.entries[t];return i?y(i):void 0},entries:this.opts.places.entries,currentIndex:this.opts.places.index,filter:()=>this.filter,describe:t=>this.reads.describe(t),clearDescribeCache:()=>this.reads.clearDescribeCache(),noteExists:t=>this.reads.hasFile(t),headingsFor:t=>this.reads.headingsFor(t),otherNames:(t,i)=>this.reads.otherNamesFor(t,i),onActiveRow:t=>this.setActiveRow(t),onTravel:(t,i)=>this.jump(t,i),onTravelHeading:(t,i)=>this.jumpToHeading(t,i),onHoverRow:(t,i,n,s,o)=>this.preview.hoverRow(t,i,n,s,o),tipsQuiet:()=>this.preview.quiet(),onHoverEnd:()=>this.preview.hoverEnded(),onContextRow:(t,i,n,s)=>this.contextRow(t,i,n,s),takeMenuBack:()=>this.takeMenuBack(),onForget:t=>this.forgetRow(t),touch:this.opts.touch},this.list=new Ge(this.listOpts),this.preview=new Xe(this.opts.app,this.reads,()=>this.opts.places.entries,()=>this.opts.prefs.previewFocus(),()=>this.list.hideTip()),e.addEventListener("pointerover",t=>{t.pointerType!=="touch"&&this.freezeOrder()}),e.addEventListener("pointerleave",t=>{t.pointerType!=="touch"&&this.thawOrder()}),e.addEventListener("click",t=>this.list.onUnansweredClick(t)),this.arrowBar=new qe(this.opts.host,this.opts.arrows,()=>this.shellReacts()),this.opts.host.addEventListener("keydown",t=>this.onKeyDown(t)),this.render(),this.timer=window.setInterval(()=>{document.hidden||!this.opts.prefs.rowTime()||this.render()},3e5),document.addEventListener("visibilitychange",this.onVisibilityChange),this.watchExistence(),this.opts.focusFilter&&!this.opts.touch&&this.opts.places.entries.length>0&&this.filterInput.focus()}render(){this.reads.clearDescribeCache(),this.listOpts.entries=this.opts.places.entries,this.listOpts.currentIndex=this.opts.places.index,this.list.render(),this.arrowBar.refresh()}freezeOrder(){if(this.frozenOrder)return;let e=this.list.orderedKeys();e.length&&(this.frozenOrder=e)}thawOrder(){this.frozenOrder&&(this.frozenOrder=void 0,this.render())}redrawSoon(){this.lateTimer===void 0&&(this.lateTimer=window.setTimeout(()=>{this.lateTimer=void 0,this.render()},60))}watchExistence(){let e=this.opts.app.vault;this.existenceRefs=[e.on("create",t=>this.redrawForPath(t.path)),e.on("delete",t=>this.redrawForPath(t.path)),e.on("rename",(t,i)=>{this.redrawForPath(i),this.redrawForPath(t.path)})]}redrawForPath(e){this.opts.places.entries.some(t=>t.kind!=="view"&&t.path===e)&&this.redrawSoon()}destroy(){this.closeMenu(),this.list.destroy(),this.reads.dispose(),this.preview.stop(),this.timer!==void 0&&window.clearInterval(this.timer),this.timer=void 0,this.lateTimer!==void 0&&window.clearTimeout(this.lateTimer),this.lateTimer=void 0,document.removeEventListener("visibilitychange",this.onVisibilityChange);for(let e of this.existenceRefs)this.opts.app.vault.offref(e);this.existenceRefs=[],this.arrowBar.forget()}onKeyDown(e){if(!(e.target instanceof Element?e.target:null)?.closest(".position-restore-nav-arrows")){if(e.key==="ArrowDown")e.preventDefault(),this.list.move(1);else if(e.key==="ArrowUp")e.preventDefault(),this.list.move(-1);else if(e.key==="Enter"){let i=R.Keymap.isModifier(e,"Mod")?"tab":void 0;this.list.travel(void 0,i)&&e.preventDefault()}}}setActiveRow(e){e?this.filterInput.setAttr("aria-activedescendant",e):this.filterInput.removeAttribute("aria-activedescendant")}toolbar(){let t=this.opts.host.createDiv({cls:"position-restore-nav-toolbar"}).createDiv({cls:"position-restore-nav-search"}),i=t.createEl("input",{type:"text",cls:"position-restore-nav-filter",attr:{placeholder:l("recentFiles.searchPlaceholder"),role:"combobox","aria-controls":this.listId,"aria-expanded":"true","aria-autocomplete":"list"}}),n=t.createDiv({cls:"clickable-icon position-restore-nav-clear"});(0,R.setIcon)(n,"x");let s=()=>{let a=i.value!==""||!this.opts.onDismiss?l("recentFiles.clearFilter"):l("recentFiles.close");n.setAttr("aria-label",a),n.setAttr("title",a)},o=()=>{this.filter=i.value,s(),this.render()};i.addEventListener("input",a=>{a.isComposing||o()}),i.addEventListener("compositionend",o),this.filterInput=i,s(),n.addEventListener("mousedown",a=>a.preventDefault()),n.addEventListener("click",()=>{if(i.value===""){this.opts.onDismiss?.();return}i.value="",o(),this.opts.touch||i.focus()})}depart(e){this.opts.collapseOnJump&&this.list.collapse(),this.shellReacts(),e().catch(t=>console.error("Position Restore: recent-files travel failed:",t))}jump(e,t){this.depart(()=>this.opts.places.travel(e,t))}jumpToHeading(e,t){this.depart(()=>this.opts.places.travelToHeading(e.path,e.heading,e.line,e.leafId,t))}contextRow(e,t,i,n){let s=this.opts.places.entries[e];if(!s)return;if(this.menu){this.closeMenu();return}let o=new R.Menu;if(o.addItem(a=>a.setSection("action").setTitle(l(n?"recentFiles.openHereInNewTab":"recentFiles.openInNewTab")).setIcon("file-plus").onClick(()=>n?this.jumpToHeading(n,"tab"):this.jump(e,"tab"))),i&&this.pinItems(o,y(s)),s.kind!=="view"){let a=this.opts.app.vault.getAbstractFileByPath(s.path);if(!(a instanceof R.TFile))return;this.opts.app.workspace.trigger("file-menu",o,a,"link-context-menu")}this.menu=o,o.onHide(this.forgetMenu),o.showAtPosition(t),this.hearPresses(!0)}pinItems(e,t){let i=this.opts.places.pinned.indexOf(t);if(i<0){this.pinItem(e,"recentFiles.pin","pin",()=>this.pin(t));return}let n=this.opts.places.pinned.length-1,s=this.opts.places.wouldUnpinDrop(t);this.pinItem(e,s?"recentFiles.unpinExcluded":"recentFiles.unpin","pin-off",()=>this.unpin(t),!!s),i>0&&(this.pinItem(e,"recentFiles.pinUp","arrow-up",()=>this.movePin(t,-1)),i>1&&this.pinItem(e,"recentFiles.pinFirst","arrow-up-to-line",()=>this.movePin(t,-i))),i<n&&(this.pinItem(e,"recentFiles.pinDown","arrow-down",()=>this.movePin(t,1)),i<n-1&&this.pinItem(e,"recentFiles.pinLast","arrow-down-to-line",()=>this.movePin(t,n-i)))}pinItem(e,t,i,n,s=!1){e.addItem(o=>{o.setSection("action").setTitle(l(t)).setIcon(i).onClick(n),s&&o.setWarning(!0)})}pin(e){this.opts.places.pin(e),this.render()}unpin(e){let t=this.opts.places.unpin(e);this.render(),t.dropped&&t.place&&this.explainUnpinDrop(t,t.place)}explainUnpinDrop(e,t){let i=e.reason?$r(e.reason):void 0,n=new R.Notice(i?l("recentFiles.unpin.removedByRule",i):l("recentFiles.unpin.removed"),8e3);n.messageEl.createEl("button",{text:l("recentFiles.unpin.undo"),cls:"position-restore-unpin-undo"}).addEventListener("click",()=>{this.opts.places.restorePinned(t),this.render(),n.hide()})}movePin(e,t){this.opts.places.movePinned(e,t),this.render()}closeMenu(){this.hearPresses(!1);let e=this.menu;this.menu=void 0,e?.hide()}takeMenuBack(){return this.menu?(this.closeMenu(),!0):!1}hearPresses(e){let t=this.opts.host.ownerDocument;t&&(e?t.addEventListener("pointerdown",this.onAnyPress,!0):t.removeEventListener("pointerdown",this.onAnyPress,!0))}forgetRow(e){this.opts.places.forget(e),this.render()}shellReacts(){try{this.opts.onJump?.()}catch(e){console.error("Position Restore: the panel shell failed to react to a travel:",e)}}};var Ye=class extends ze.Modal{constructor(t,i,n,s,o){super(t);this.places=i;this.savedPosition=n;this.prefs=s;this.arrows=o;this.mobile=ze.Platform.isMobile}onOpen(){this.modalEl.addClass("position-restore-nav-modal"),this.modalEl.addClass("position-restore-nav-panel"),this.modalEl.toggleClass("is-touch",this.mobile),this.modalEl.toggleClass("is-fixed",!this.mobile||this.places.entries.length>12),this.modalEl.toggleClass("is-dismissive",!this.mobile),this.titleEl.setText(l("recentFiles.name")),this.browser=new Z({app:this.app,places:this.places,host:this.contentEl,savedPosition:this.savedPosition,touch:this.mobile,collapseOnJump:!1,focusFilter:!0,onJump:()=>this.close(),onDismiss:()=>this.close(),arrows:this.arrows,prefs:this.prefs}),this.browser.mount()}onClose(){this.browser.destroy()}};var ee=require("obsidian");var _=Q,ce=class extends ee.ItemView{constructor(t,i,n,s,o){super(t);this.places=i;this.savedPosition=n;this.prefs=s;this.arrows=o;this.browser=null;this.unsubscribe=null;this.missedRender=!1}getViewType(){return _}getDisplayText(){return l("recentFiles.name")}getIcon(){return"clock"}async onOpen(){this.contentEl.addClass("position-restore-nav-panel","position-restore-nav-view"),ee.Platform.isMobile&&this.contentEl.addClass("is-touch"),this.browser=new Z({app:this.app,places:this.places,host:this.contentEl,savedPosition:this.savedPosition,touch:ee.Platform.isMobile,collapseOnJump:!0,onJump:()=>this.standAside(),focusFilter:!1,arrows:this.arrows,prefs:this.prefs}),this.browser.mount(),this.unsubscribe=this.places.subscribe(()=>this.hearPlaces())}async onClose(){this.unsubscribe?.(),this.unsubscribe=null,this.browser?.destroy(),this.browser=null,this.stopSuspending()}refresh(){this.browser?.render()}onPaneMenu(t){this.clearable()&&t.addItem(i=>i.setSection("action").setTitle(l("recentFiles.clearList")).setIcon("eraser").onClick(()=>this.places.clear()))}clearable(){return this.places.entries.some(t=>!this.places.isPinned(y(t)))}hearPlaces(){if(this.suspendTimer!==void 0){this.missedRender=!0;return}this.browser?.render()}standAside(){ee.Platform.isMobile&&(this.browser?.closeMenu(),this.dismissOnMobile(),this.suspendRedraws())}suspendRedraws(){this.stopSuspending(),this.suspendTimer=window.setTimeout(()=>{this.suspendTimer=void 0,this.missedRender&&(this.missedRender=!1,this.browser?.render())},300)}stopSuspending(){this.suspendTimer!==void 0&&(window.clearTimeout(this.suspendTimer),this.suspendTimer=void 0,this.missedRender=!1)}dismissOnMobile(){let t=this.leaf.parent;t?.collapsed===!1&&typeof t.collapse=="function"&&t.collapse()}};async function Xi(r,e,t,i){let n=r.workspace.getLeavesOfType(_)[0];if(n){await r.workspace.revealLeaf(n);return}let s=r.workspace.getRightLeaf(!1);s&&(await s.setViewState({type:_,active:!0}),await r.workspace.revealLeaf(s))}function Yi(r,e,t,i){return n=>new ce(n,r,e,t,i)}var Jr=1e4,Qe=class{constructor(e,t,i,n){this.app=e;this.store=t;this.navStores=i;this.state=n;this.pendingDeletes=new Map;this.pendingSweeps=new Map}renameFile(e,t){this.cancelPending(e.path),this.store.renameFile(e.path,t);for(let i of this.navStores)i.renameFile(t,e.path);this.state.lastLoadedFilePath==t&&(this.state.lastLoadedFilePath=e.path)}deleteFile(e){this.deferMissing(this.pendingDeletes,e.path,()=>this.prune(e.path))}fileCreated(e){this.cancelPending(e.path)}cancelPending(e){for(let t of[this.pendingDeletes,this.pendingSweeps]){let i=t.get(e);i!==void 0&&(window.clearTimeout(i),t.delete(e))}}sweepMissingHistory(){let e=new Set;for(let t of this.navStores)for(let i of t.knownPaths())e.add(i);for(let t of e)this.app.vault.getAbstractFileByPath(t)||this.deferMissing(this.pendingSweeps,t,()=>{for(let i of this.navStores)i.deleteFile(t);for(let i of this.navStores)i.persist()})}deferMissing(e,t,i){let n=e.get(t);n!==void 0&&window.clearTimeout(n);let s=window.setTimeout(()=>{this.confirmGone(e,t,s,i)},Jr);e.set(t,s)}async confirmGone(e,t,i,n){if(this.app.vault.getAbstractFileByPath(t)){e.delete(t);return}let s;try{s=await this.app.vault.adapter.exists(t)}catch{s=!0}s||e.get(t)!==i||(e.delete(t),n())}prune(e){this.store.deleteFile(e);for(let t of this.navStores)t.deleteFile(e)}dispose(){for(let e of[this.pendingDeletes,this.pendingSweeps]){for(let t of e.values())window.clearTimeout(t);e.clear()}}};var Xr=400,Yr=2,zi=["pointerdown","touchstart","wheel","keydown"],zr=3,Qr=".embedded-backlinks",Zr=[".mobile-navbar",".mobile-toolbar"],es=1;function Qi(r,e){let t=x(r);return!!t&&sn(t,e)}function Zi(r,e){let t=r.editor;if(!t)return!0;let i=t.getCursor();if(e==="top")return i.line===0&&i.ch===0;let n=t.lastLine();return i.line===n&&i.ch>=(t.getLine(n)??"").length}function en(r,e){Mt(r,e);let t=x(r);t&&on(t,e)}async function tn(r,e){let t=x(r);if(!t)return;let i=!1,n=()=>{i=!0};for(let s of zi)t.addEventListener(s,n,{capture:!0,once:!0});try{let s=Date.now()+Xr,o=0;for(;!i&&t.isConnected&&Date.now()<s;)if(await u(),!(i||!t.isConnected||sn(t,e))){if(++o>Yr)return;on(t,e)}}finally{for(let s of zi)t.removeEventListener(s,n,{capture:!0})}}async function nn(r){for(let e=0;e<zr;e++){let t=r.currentMode?.getScroll();if(t!=null&&Number.isFinite(t)){r.setEphemeralState({scroll:t});return}await u()}}function ts(r){let e=r.querySelector(Qr);if(!e)return r.scrollHeight;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return r.scrollHeight;let i=t.top-r.getBoundingClientRect().top+r.scrollTop;return i>0?i:r.scrollHeight}function is(r){let e=r.getBoundingClientRect();if(e.height<=0)return 0;let t=0;for(let i of Zr)for(let n of Array.from(r.ownerDocument.querySelectorAll(i))){let s=n.getBoundingClientRect();s.height<=0||s.bottom<e.bottom||s.right<=e.left||s.left>=e.right||(t=Math.max(t,Math.min(e.bottom,s.bottom)-Math.max(e.top,s.top)))}return Math.max(0,Math.min(t,e.height))}function ns(r){let e=Math.max(0,r.scrollHeight-r.clientHeight),t=r.clientHeight-is(r);return Math.max(0,Math.min(e,Math.round(ts(r)-t)))}function rn(r,e){return e==="top"?0:ns(r)}function sn(r,e){return Math.abs(r.scrollTop-rn(r,e))<=es}function on(r,e){r.scrollTop=rn(r,e)}function Mt(r,e){let t=r.editor;if(!t)return;let i=e==="top"?0:t.lastLine();t.setCursor({line:i,ch:e==="top"?0:t.getLine(i).length})}var et=class{constructor(e,t,i){this.settings=i;this.app=e,this.database=t,this.state=new Te(i),this.funnel=new Ve(e,this.state),this.stack=new _e(e,i,this.state,this.funnel,n=>this.database.db[n]),this.places=new Be(e,i),this.funnel.subscribe(this.stack),this.funnel.subscribe({onVisit:n=>this.places.remember(n.record),onLanded:n=>this.places.settle(n),onHere:n=>this.places.markCurrent(n)}),this.places.attach({openFile:(n,s,o)=>this.stack.openFilePlain(n,s,o),openJump:(n,s)=>this.stack.travelTo(n,s),openView:(n,s)=>this.stack.openViewPlace(n,s)}),this.store=new Ee(e,t),this.restorer=new Ae(e,i,this.store,this.state),this.sampler=new He(e,this.store,i,this.state,this.funnel),this.patcher=new Ce(e,i,this.store,this.state,this.funnel,this.sampler),this.explorerPreview=new Oe(e,t,i),this.backgroundSettler=new Re(e,this.store,this.state),this.bookkeeper=new Qe(e,this.store,[this.stack,this.places],this.state)}installPatches(e){this.patcher.installPatches(e),this.funnel.installOutlineCapture(e),this.sampler.installSearchAnchor(e),this.sampler.installFrontmatterWatch(e),te.Platform.isDesktopApp?(this.sampler.installScrollCapture(e),this.sampler.installUserIntentTracker(e),this.sampler.installTeleportWatcher(e)):this.sampler.installTouchListener(e)}installExplorerPreview(e){this.explorerPreview.install(e)}restoreEphemeralState(){this.restorer.restoreEphemeralState().catch(e=>console.error("Position Restore: restore failed:",e))}completeInjectedRestore(e){this.restorer.completeInjectedRestore(e).catch(t=>console.error("Position Restore: complete injected restore failed:",t))}installBackgroundSettle(e){this.backgroundSettler.start(e)}sampleActiveView(){this.sampler.sampleActiveView()}sampleActiveViewState(){if(!this.funnel.isRecording())return;let e=this.app.workspace.getActiveViewOfType(te.View);if(!e||e instanceof te.FileView)return;let t=e.getViewType();if(!Me(t))return;let i=this.stack.entries[this.stack.index];if(!i||i.kind!=="view"||i.viewType!==t||!A(this.app,e.leaf))return;let n=O(e);!n||JSON.stringify(n)===JSON.stringify(i.state)||this.funnel.landing({kind:"view",leafId:i.leafId,viewType:t,state:n,label:$(e),icon:G(e)})}async storePositionData(){try{this.restorer.pruneStaleLeafIds(),this.store.persist(),this.stack.persist(),this.places.persist(),await this.database.writeDb()}catch(e){console.error("Position Restore: could not save positions:",e)}}navigateBack(){return this.stack.navigate(-1).catch(e=>console.error("Position Restore: navigate back failed:",e))}navigateForward(){return this.stack.navigate(1).catch(e=>console.error("Position Restore: navigate forward failed:",e))}goToEdge(e){let t=dt(this.app);if(!t?.file)return;if(Qi(t,e)){Zi(t,e)||this.funnel.runBracketed(async()=>{Mt(t,e)}).catch(o=>console.error("Position Restore: move caret to edge failed:",o));return}let i=t.file.path,n=this.state.leafId(t.leaf),s=S(t);s&&this.funnel.leave(i,n,s),this.funnel.visit({record:{kind:"visit",path:i,leafId:n},cause:"open",forced:!0}),this.funnel.runBracketed(async()=>{en(t,e),await tn(t,e),await nn(t)}).catch(o=>console.error("Position Restore: go to edge failed:",o))}canGoToEdge(){return!!dt(this.app)?.file}canNavigate(e){return this.stack.canNavigate(e)}openRecentFilesModal(){new Ye(this.app,this.places,e=>this.database.db[e],this.browserPrefs(),this.recentFilesArrows()).open()}openRecentFilesSidebar(){Xi(this.app,this.places,e=>this.database.db[e],this.browserPrefs())}recentFilesViewCreator(){return Yi(this.places,e=>this.database.db[e],this.browserPrefs(),this.recentFilesArrows())}recentFilesArrows(){return{back:()=>this.navigateBack(),forward:()=>this.navigateForward(),top:()=>this.goToEdge("top"),bottom:()=>this.goToEdge("bottom"),canBack:()=>this.stack.hasStep(-1),canForward:()=>this.stack.hasStep(1),canEdge:()=>this.canGoToEdge()}}browserPrefs(){return{outlineSearch:()=>this.settings.recentFilesOutlineSearch,placesCap:()=>this.settings.recentFilesCap,pathDisplay:()=>this.settings.recentFilesPathDisplay,rowTime:()=>this.settings.recentFilesRowTime,titleProperty:()=>this.settings.recentFilesTitleProperty,previewFocus:()=>this.settings.recentFilesPreviewFocus}}refreshNavPanels(){for(let e of this.app.workspace.getLeavesOfType(_)){let t=e.view;t instanceof ce&&t.refresh()}}recordActivation(e){this.funnel.recordActivation(e)}isSearchAnchored(){return this.state.isSearchAnchored()}renameFile(e,t){this.bookkeeper.renameFile(e,t)}deleteFile(e){this.bookkeeper.deleteFile(e)}fileCreated(e){this.bookkeeper.fileCreated(e)}sweepMissingHistory(){this.bookkeeper.sweepMissingHistory()}installPathBookkeeping(e){e(()=>this.bookkeeper.dispose())}applyNavHistoryCap(){this.stack.applyStackCap()}applyRecentFilesExclusions(){this.places.pruneExcluded()>0&&this.places.applyCap()}applyRecentFilesCap(){this.places.applyCap()}applyChangedSettings(e){this.settings.navHistoryCap!==e.navHistoryCap&&this.applyNavHistoryCap(),this.settings.recentFilesCap!==e.recentFilesCap&&this.applyRecentFilesCap(),(!Ze(this.settings.recentFilesExcludeFolders,e.recentFilesExcludeFolders)||!Ze(this.settings.recentFilesExcludeProperties,e.recentFilesExcludeProperties)||this.settings.recentFilesExcludeImages!==e.recentFilesExcludeImages)&&this.applyRecentFilesExclusions(),(!Ze(this.settings.excludedFolders,e.excludedFolders)||!Ze(this.settings.frontmatterExcludeProperties,e.frontmatterExcludeProperties))&&this.prunePositions()}prunePositions(){return this.store.pruneDatabase()}};function Ze(r,e){return r.length===e.length&&r.every((t,i)=>t===e[i])}var tt=class extends it.Plugin{async onload(){await this.loadSettings(),this.database=new be(this,this.settings),this.manager=new et(this.app,this.database,this.settings),await this.database.readDb(),this.addSettingTab(new ge(this.app,this)),this.registerView(_,this.manager.recentFilesViewCreator()),this.registerPreviewSource(),this.manager.installPatches(e=>this.register(e)),this.manager.installExplorerPreview(e=>this.register(e)),this.manager.installBackgroundSettle(e=>this.register(e)),this.manager.installPathBookkeeping(e=>this.register(e)),this.registerCommands(),this.registerWorkspaceEvents(),this.registerPolling(),this.registerDbFlush(),this.registerSuspendFlush(),this.app.workspace.onLayoutReady(()=>{this.manager.prunePositions(),this.manager.sweepMissingHistory()}),this.manager.restoreEphemeralState()}async loadSettings(){let e=await this.loadData();this.settings?Object.assign(this.settings,H,e):this.settings={...H,...e}}async saveSettings(){await this.saveData(this.settings)}async onExternalSettingsChange(){let e={...this.settings};await this.loadSettings(),this.manager.applyChangedSettings(e)}registerPreviewSource(){this.registerHoverLinkSource(Q,{display:l("recentFiles.name"),defaultMod:!0})}registerCommands(){this.addCommand({id:"navigate-back",name:l("navHistory.commands.navigateBack"),icon:"arrow-left",checkCallback:t=>this.manager.canNavigate(-1)?(t||this.manager.navigateBack(),!0):!1}),this.addCommand({id:"navigate-forward",name:l("navHistory.commands.navigateForward"),icon:"arrow-right",checkCallback:t=>this.manager.canNavigate(1)?(t||this.manager.navigateForward(),!0):!1}),this.addCommand({id:"go-to-top",name:l("noteEdge.commands.top"),icon:"arrow-up",checkCallback:t=>this.manager.canGoToEdge()?(t||this.manager.goToEdge("top"),!0):!1}),this.addCommand({id:"go-to-bottom",name:l("noteEdge.commands.bottom"),icon:"arrow-down",checkCallback:t=>this.manager.canGoToEdge()?(t||this.manager.goToEdge("bottom"),!0):!1}),this.addCommand({id:"browse-recent-files",name:l("recentFiles.commands.open"),icon:"clock",callback:()=>this.manager.openRecentFilesModal()}),this.addCommand({id:"open-recent-files-sidebar",name:l("recentFiles.commands.openSidebar"),icon:"panel-right",callback:()=>this.manager.openRecentFilesSidebar()});let e=it.Platform.isMobile?()=>this.manager.openRecentFilesModal():()=>this.manager.openRecentFilesSidebar();this.addRibbonIcon("clock",l("recentFiles.name"),e)}registerWorkspaceEvents(){this.registerEvent(this.app.workspace.on("file-open",()=>this.manager.restoreEphemeralState())),this.registerEvent(this.app.workspace.on("active-leaf-change",e=>{this.manager.completeInjectedRestore(e),this.manager.recordActivation(e)})),this.registerEvent(this.app.vault.on("rename",(e,t)=>this.manager.renameFile(e,t))),this.registerEvent(this.app.vault.on("delete",e=>this.manager.deleteFile(e))),this.registerEvent(this.app.vault.on("create",e=>this.manager.fileCreated(e))),this.registerEvent(this.app.workspace.on("quit",e=>{e.addPromise(this.manager.storePositionData())}))}registerPolling(){this.registerInterval(window.setInterval(()=>this.manager.sampleActiveView(),100)),this.registerInterval(window.setInterval(()=>this.manager.sampleActiveViewState(),1e3))}registerDbFlush(){this.registerInterval(window.setInterval(()=>{this.database.mergeExternalChanges().then(()=>this.manager.storePositionData()).catch(e=>console.error("Position Restore: periodic flush failed:",e))},5e3))}registerSuspendFlush(){let e=()=>{this.manager.isSearchAnchored()||(this.manager.sampleActiveView(),this.manager.sampleActiveViewState()),this.manager.storePositionData()};this.registerDomEvent(document,"visibilitychange",()=>{document.hidden&&e()}),this.registerDomEvent(window,"pagehide",()=>e())}};
module.exports = module.exports.default || module.exports;
/* nosourcemap */