diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index c1081fa..8e47cb7 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -59,7 +59,7 @@ interface WaypointSettings { quarterly: PeriodNoteSettings; yearly: PeriodNoteSettings; dateSystems: DateSystemSettings[]; // day-scoped systems beyond the daily note, in menu order - recentFiles: RecentFilesSettings; // maxItems, show, omittedPaths[], omittedTags[], showTypeFilter, types[] + recentFiles: RecentFilesSettings; // maxItems, show, omittedPaths[], omittedTags[], types[] display: DisplaySettings; // px sizing for bookmark rows, fonts, icons, calendar cells } @@ -82,12 +82,11 @@ interface RecentFilesSettings { show: 'all' | 'opened' | 'changed'; // header switch, default 'all' omittedPaths: string[]; // regex patterns (one per line) omittedTags: string[]; // regex patterns for frontmatter/inline tags - showTypeFilter: boolean; // type pills above the list, default true - types: { type: string; icon: string }[]; // frontmatter types: row icon + pill order (empty = pills auto-detected) + types: { type: string; icon: string }[]; // frontmatter types with a row icon each } ``` -Migration in `applySettings`: a saved `filterTags: string[]` becomes `types` with empty icons; the saved `updateOn` is dropped (both kinds are always tracked). +Migration in `applySettings`: the saved `filterTags`, `showTypeFilter` (the removed type filter), and `updateOn` (both kinds are always tracked) are dropped. ```typescript interface DisplaySettings { @@ -357,15 +356,15 @@ Called on every change. Full DOM rebuild — `contentEl.empty()`, then Favorites ``` ┌────────────────────────────────────┐ -│ Q2 June 2026 ◀ Today ▶ │ ← breadcrumb (clickable) + nav +│ Q2 Jun 2026 ◀ Today ▶ │ ← breadcrumb (clickable) + nav ├──┬───┬───┬───┬───┬───┬───┬───┤ -│24│sun│mon│tue│wed│thu│fri│sat│ ← header row + week# col +│24│ S │ M │ T │ W │ T │ F │ S │ ← header row + week# col ├──┼───┼───┼───┼───┼───┼───┼───┤ │25│ 1 │ 2 │ 3 │... ← day cells (clickable) └──┴───┴───┴───┴───┴───┴───┴───┘ ``` -- **Breadcrumb:** Q-label, month name, year — each clickable to open that period note. +- **Breadcrumb:** Q-label, 3-letter month (`MMM`), year — each clickable to open that period note. Weekday headers are single letters. - **Nav buttons:** ◀/▶ shift month ±1. "Today" resets to current month. The `calendar-search` button calls `showPicker()` on a hidden native `` (`.waypoint-calendar-pick-input`); picking a date calls `showDate()` — the calendar jumps to that month and marks the day without opening or creating a note. - **Week number column:** Clicking a week number opens the weekly note for that week's Monday; middle-clicking opens it in a new tab. - **Day cells:** Left-click opens the daily note, middle-click opens it in a new tab, right-click opens the day context menu (below). `.other-month` is muted; `.today` has an inset accent ring; hover receives a quiet fill. With `indicatorMode: 'any'`, `.has-note` shows the existing single neutral dot through the O(1) `plugin.hasNoteForDate(dateStr)` lookup. With `indicatorMode: 'systems'`, the view calls `getDateSystemIndicators()` once for the month and renders one tooltip-labelled coloured dot per matching daily/journal/meeting/custom system. @@ -384,8 +383,6 @@ Renders `recentFilesFor(plugin.recentFiles, settings.show)` as Obsidian-native ` **Header switch** (`.waypoint-recent-show`): `all` / `opened` / `changed`, saved to `settings.recentFiles.show`. -**Type pills** (only when `showTypeFilter`): with `types` configured, one pill per type in that order (count may be 0); otherwise one per frontmatter `type` present, most frequent first. The pill filter is view state (`recentFilesFilter`) and resets when pills are turned off. Types with an empty name (rows being typed in settings) are ignored. - **Type icons** (`.waypoint-recent-icon`): a file whose frontmatter `type` matches a configured type with an icon shows that Lucide icon before its name. Once any type has an icon, every row reserves the slot so names stay aligned. **Per-file features:** diff --git a/QA.md b/QA.md index 40a6780..6626f37 100644 --- a/QA.md +++ b/QA.md @@ -142,9 +142,8 @@ - [ ] Vault startup does not flood the list with every file - [ ] With Max items = N, many background changes do not push out the N most recently opened files - [ ] An existing list from before this version keeps its order (all entries appear under "opened") -- [ ] Settings → Recent Files → Type filter off hides the pills; on shows them again - [ ] File types: add a type, pick an icon in the picker, matching recent files show the icon; names stay aligned; trash removes the type -- [ ] An old "Filter tags" list appears as File types without icons +- [ ] Settings → Recent Files has no "Type filter" toggle and no pills appear above the list; an old saved `filterTags`/`showTypeFilter` loads without error and is dropped ## Mobile diff --git a/README.md b/README.md index 1edfe95..165d7e2 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,16 @@ Calendar, recent files, and custom bookmarks sidebar for Obsidian. +## v1.10.0 + +- Calendar weekday headings use single English letters and month names use English abbreviations. +- Removed Recent Files type-filter pills and their toggle; **File types** icons and **Omitted tags** remain available. + ## Features - **Calendar panel** — refined month grid; left-click a day opens its daily note, middle-click opens it in a tab, and right-click reveals every configured note system for that date. The date button beside **Today** jumps to any date. - **Calendar indicators** — retain a single neutral note dot or show a coloured dot per daily, journal, meeting, or custom date system -- **Recent files** — files you opened and files that changed. The switch beside the title shows all, only opened, or only changed files. A dot marks a file changed in the background (sync, another plugin) until you open it. Give frontmatter types (meeting, daily-note…) an icon under **Settings → Recent Files → File types**; the type filter pills can be turned off. +- **Recent files** — files you opened and files that changed. The switch beside the title shows all, only opened, or only changed files. A dot marks a file changed in the background (sync, another plugin) until you open it. Give frontmatter types (meeting, daily-note…) an icon under **Settings → Recent Files → File types**. - **Mobile** — the whole calendar stays on screen when the sidebar opens; the lists above it scroll on their own. - **Favorites** — custom bookmarks with groups, icons, and rename diff --git a/main.js b/main.js index 725abe5..2a99b29 100644 --- a/main.js +++ b/main.js @@ -2,22 +2,22 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD */ -var ie=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Fe=(c,d)=>{for(var e in d)ie(c,e,{get:d[e],enumerable:!0})},Se=(c,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of be(d))!De.call(c,i)&&i!==e&&ie(c,i,{get:()=>d[i],enumerable:!(n=ke(d,i))||n.enumerable});return c};var xe=c=>Se(ie({},"__esModule",{value:!0}),c);var Ae={};Fe(Ae,{default:()=>ne});module.exports=xe(Ae);var f=require("obsidian");var _={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},P={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,show:"all",omittedPaths:[],omittedTags:[],showTypeFilter:!0,types:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var y=require("obsidian");var me="{title}";function q(c){let d=c.indexOf(me);return d<0?{before:c,after:"",hasTitle:!1}:{before:c.slice(0,d),after:c.slice(d+me.length),hasTitle:!0}}function ae(c,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return c.startsWith(e)}function se(c,d,e,n){return n?!d||c.length|#^[\]]/g;function ge(c){return c.replace(Te,"-").replace(/\s+/g," ").trim()}function $(c){let{before:d}=q(c),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var m=require("obsidian");var Y=require("obsidian");function ye(c,d,e){let n=(0,Y.moment)({year:c,month:d,day:1}),i=(0,Y.moment)(n).endOf("month"),t=(0,Y.moment)(n).subtract((n.day()-e+7)%7,"days"),a=(0,Y.moment)().startOf("day"),r=[],s=(0,Y.moment)(t);for(;s.isBefore(i)||s.month()===d;){let o=[];for(let l=0;l<7;l++)o.push({date:(0,Y.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(a,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:o[0].isoWeekNumber,days:o}),r.length>=6)break}return r}function Ee(c,d){return d==="opened"?c.openedAt:d==="changed"||c.openedAt===void 0?c.changedAt:c.changedAt===void 0?c.openedAt:Math.max(c.openedAt,c.changedAt)}function W(c,d){let e=[];for(let n of c){let i=Ee(n,d);i!==void 0&&e.push({entry:n,key:i})}return e.sort((n,i)=>i.key-n.key),e.map(n=>n.entry)}function K(c,d){let e=new Set([...W(c,"opened").slice(0,d),...W(c,"changed").slice(0,d)]);return W(c,"all").filter(n=>e.has(n))}var E="waypoint-view";function Me(c){return c.dragManager}var z=class extends m.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px");let n=this.contentEl.createDiv({cls:"waypoint-lists"});this.renderFavorites(n),this.renderRecentFiles(n),this.renderCalendar()};this.currentDisplayMonth=(0,m.moment)().month();this.currentDisplayYear=(0,m.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.recentFilesFilter=null;this.selectedDate=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}showDate(e){this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.selectedDate=e.clone(),this.redraw()}renderCalendar(){var le;let n=this.contentEl.createDiv({cls:"waypoint-section waypoint-calendar-section"}).createDiv({cls:"waypoint-calendar"}),i=(0,m.moment)(),t=(0,m.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),a=n.createDiv({cls:"waypoint-calendar-top"}),r=a.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=t.format("[Q]Q"),o=r.createSpan({cls:"waypoint-clickable",text:s});o.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",t)}),o.addEventListener("mousedown",k=>{k.button===1&&(k.preventDefault(),this.plugin.openPeriodNote("quarter",t,this.app.workspace.getLeaf("tab")))});let l=t.format("MMMM"),p=r.createSpan({cls:"waypoint-clickable",text:l});p.addEventListener("click",()=>{this.plugin.openPeriodNote("month",t)}),p.addEventListener("mousedown",k=>{k.button===1&&(k.preventDefault(),this.plugin.openPeriodNote("month",t,this.app.workspace.getLeaf("tab")))});let u=t.format("YYYY"),D=r.createSpan({cls:"waypoint-clickable",text:u});D.addEventListener("click",()=>{this.plugin.openPeriodNote("year",t)}),D.addEventListener("mousedown",k=>{k.button===1&&(k.preventDefault(),this.plugin.openPeriodNote("year",t,this.app.workspace.getLeaf("tab")))});let S=a.createDiv({cls:"waypoint-calendar-today-group"}),M=S.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,m.setIcon)(M,"chevron-left"),M.addEventListener("click",()=>this.navigateMonth(-1)),S.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,m.moment)().month(),this.currentDisplayYear=(0,m.moment)().year(),this.selectedDate=null,this.redraw()});let C=S.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,m.setIcon)(C,"chevron-right"),C.addEventListener("click",()=>this.navigateMonth(1));let I=S.createEl("button",{cls:"waypoint-calendar-nav-btn waypoint-calendar-pick-btn"});(0,m.setIcon)(I,"calendar-search"),(0,m.setTooltip)(I,"Go to date");let h=S.createEl("input",{type:"date",cls:"waypoint-calendar-pick-input"});h.tabIndex=-1,h.value=((le=this.selectedDate)!=null?le:i).format("YYYY-MM-DD"),h.addEventListener("change",()=>{let k=(0,m.moment)(h.value,"YYYY-MM-DD",!0);k.isValid()&&this.showDate(k)}),I.addEventListener("click",()=>{try{h.showPicker()}catch(k){h.click()}});let g=n.createEl("table"),x=g.createEl("thead").createEl("tr");x.createEl("th",{text:""});let b=["sun","mon","tue","wed","thu","fri","sat"],w=this.plugin.settings.calendar.firstDayOfWeek;for(let k=0;k<7;k++){let O=(w+k)%7;x.createEl("th",{text:b[O]})}let F=g.createEl("tbody"),R=ye(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek),L=this.plugin.settings.calendar.showNoteIndicators&&this.plugin.settings.calendar.indicatorMode==="systems"?this.plugin.getDateSystemIndicators(R.reduce((k,O)=>k.concat(O.days.map(H=>H.date)),[])):null;for(let k of R){let O=F.createEl("tr"),H=O.createEl("td",{cls:"waypoint-weeknum"});H.setText(String(k.weekNumber));let ce=k.days[0].date;H.addEventListener("click",()=>{this.plugin.openPeriodNote("week",ce)}),H.addEventListener("mousedown",T=>{T.button===1&&(T.preventDefault(),this.plugin.openPeriodNote("week",ce,this.app.workspace.getLeaf("tab")))});for(let T of k.days){let A=O.createEl("td",{cls:"waypoint-day"});if(A.setText(String(T.dayOfMonth)),T.isCurrentMonth||A.addClass("other-month"),T.isToday&&A.addClass("today"),this.selectedDate&&T.date.isSame(this.selectedDate,"day")&&A.addClass("is-selected"),this.plugin.settings.calendar.showNoteIndicators){let N=T.date.format("YYYY-MM-DD");if(this.plugin.settings.calendar.indicatorMode==="any")this.plugin.hasNoteForDate(N)&&A.addClass("has-note");else{let de=(L==null?void 0:L.get(N))||[];if(de.length>0){let we=A.createDiv({cls:"waypoint-day-indicators"});for(let pe of de){let he=we.createSpan({cls:"waypoint-day-indicator"});he.style.setProperty("--waypoint-indicator-color",pe.color),(0,m.setTooltip)(he,pe.name)}}}}A.addEventListener("click",()=>{this.plugin.openPeriodNote("day",T.date)}),A.addEventListener("mousedown",N=>{N.button===1&&(N.preventDefault(),this.plugin.openPeriodNote("day",T.date,this.app.workspace.getLeaf("tab")))}),A.addEventListener("contextmenu",N=>{N.preventDefault(),N.stopPropagation(),this.showDayContextMenu(N,T.date)})}}}navigateMonth(e){let n=(0,m.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(e,"month");this.currentDisplayMonth=n.month(),this.currentDisplayYear=n.year(),this.selectedDate=null,this.redraw()}showDayContextMenu(e,n){let i=new m.Menu;i.addItem(t=>t.setTitle(n.format("dddd, MMMM D, YYYY")).setIsLabel(!0));for(let t of this.plugin.findDateSystemNotes(n)){let a=t.multiple||t.notes.length===0;if(t.notes.length+(a?1:0)===0)continue;i.addSeparator();for(let s of t.notes)i.addItem(o=>o.setTitle(s.label).setIcon(t.system.icon).onClick(l=>this.focusFile(s.file,m.Keymap.isModEvent(l))));if(!a)continue;let r=t.system.name.toLowerCase();i.addItem(s=>s.setTitle(t.multiple?`New ${r} note\u2026`:`New ${r} note`).setIcon("plus").onClick(o=>this.createDateSystemNote(t,n,m.Keymap.isModEvent(o))))}i.showAtPosition({x:e.clientX,y:e.clientY})}createDateSystemNote(e,n,i){if(!e.multiple){this.plugin.openDateSystemNote(e.system,n,{leaf:i?this.app.workspace.getLeaf(i):void 0});return}let t=e.system.name;new U(this.app,{title:`New ${t.toLowerCase()} note`,placeholder:`${t} with\u2026`,cta:"Create"},a=>{this.plugin.openDateSystemNote(e.system,n,{title:a,leaf:i?this.app.workspace.getLeaf(i):void 0})}).open()}renderRecentFiles(e){var C,I;let n=this.plugin.settings.recentFiles,i=e.createDiv({cls:"waypoint-section waypoint-recent-files"}),t=i.createDiv({cls:"waypoint-section-header"});t.createSpan({text:"Recent Files"});let a=t.createDiv({cls:"waypoint-recent-show"}),r=[{value:"all",label:"all",tooltip:"Opened or changed"},{value:"opened",label:"opened",tooltip:"Files you opened"},{value:"changed",label:"changed",tooltip:"Files that changed, by you or in the background"}];for(let h of r){let g=a.createSpan({cls:`waypoint-recent-show-option${n.show===h.value?" is-active":""}`,text:h.label});(0,m.setTooltip)(g,h.tooltip),g.addEventListener("click",()=>{n.show!==h.value&&(n.show=h.value,this.plugin.saveSettings(),this.redraw())})}let s=W(this.plugin.recentFiles,n.show);if(s.length===0){i.createDiv({cls:"nav-file",text:"No recent files"});return}let o=h=>{var x,b;let g=this.app.vault.getFileByPath(h),v=g?(b=(x=this.app.metadataCache.getFileCache(g))==null?void 0:x.frontmatter)==null?void 0:b.type:null;return typeof v=="string"?v:null},l=n.types.filter(h=>h.type);if(!n.showTypeFilter)this.recentFilesFilter=null;else{let h=new Map;for(let g of l)h.set(g.type,0);for(let g of s){let v=o(g.path);v!==null&&(l.length>0&&!h.has(v)||h.set(v,((C=h.get(v))!=null?C:0)+1))}if(h.size>0){let g=i.createDiv({cls:"waypoint-recent-filter"});g.createSpan({cls:`waypoint-recent-pill${this.recentFilesFilter?"":" is-active"}`,text:"all"}).addEventListener("click",()=>{this.recentFilesFilter=null,this.redraw()});let x=[...h.entries()];l.length===0&&x.sort((b,w)=>w[1]-b[1]);for(let[b,w]of x){let F=g.createSpan({cls:`waypoint-recent-pill${this.recentFilesFilter===b?" is-active":""}`});F.setText(`${b} ${w}`),F.addEventListener("click",()=>{this.recentFilesFilter=this.recentFilesFilter===b?null:b,this.redraw()})}}}let p=this.recentFilesFilter?s.filter(h=>o(h.path)===this.recentFilesFilter):s,u=new Map(l.filter(h=>h.icon).map(h=>[h.type,h.icon])),D=u.size>0,S=this.app.workspace.getActiveFile(),M=i.createDiv({cls:"nav-folder mod-root"}),B=M.createDiv({cls:"nav-folder-children"});for(let h of p){let g=B.createDiv({cls:"tree-item nav-file"}),v=g.createDiv({cls:"tree-item-self is-clickable nav-file-title"});if(D){let w=v.createDiv({cls:"waypoint-recent-icon"}),F=u.get((I=o(h.path))!=null?I:"");F&&(0,m.setIcon)(w,F)}if(v.createDiv({cls:"tree-item-inner nav-file-title-content"}).setText(h.basename),v.createDiv({cls:"tree-item-spacer"}),h.changedInBackground){let w=v.createDiv({cls:"waypoint-recent-changed"});(0,m.setTooltip)(w,"Changed in the background")}let b=v.createDiv({cls:"waypoint-recent-remove"});(0,m.setIcon)(b,"x"),b.addEventListener("click",w=>{w.stopPropagation(),this.plugin.recentFiles=this.plugin.recentFiles.filter(F=>F.path!==h.path),this.plugin.persistRecentFiles(),this.redraw()}),(0,m.setTooltip)(g,h.path),S&&h.path===S.path&&v.addClass("is-active"),v.setAttr("draggable","true"),v.addEventListener("dragstart",w=>{let F=this.app.metadataCache.getFirstLinkpathDest(h.path,"");if(F){let R=Me(this.app),L=R.dragFile(w,F);R.onDragStart(w,L)}}),v.addEventListener("mouseover",w=>{this.app.workspace.trigger("hover-link",{event:w,source:E,hoverParent:M,targetEl:g,linktext:h.path})}),v.addEventListener("contextmenu",w=>{let F=new m.Menu;F.addItem(L=>L.setSection("action").setTitle("Open in new tab").setIcon("file-plus").onClick(()=>this.focusFile(h,"tab"))),F.addItem(L=>L.setSection("action").setTitle("Add to bookmarks").setIcon("bookmark").onClick(()=>{this.plugin.addBookmark(h.path,h.basename,"file"),new m.Notice(`Bookmarked: ${h.basename}`)}));let R=this.app.vault.getAbstractFileByPath(h.path);R&&this.app.workspace.trigger("file-menu",F,R,"link-context-menu"),F.showAtPosition({x:w.clientX,y:w.clientY})}),v.addEventListener("click",w=>{let F=m.Keymap.isModEvent(w);this.focusFile(h,F)}),v.addEventListener("mousedown",w=>{w.button===1&&(w.preventDefault(),this.focusFile(h,"tab"))})}}focusFile(e,n){let i=this.app.vault.getFiles().find(t=>t.path===e.path);i?this.app.workspace.getLeaf(n).openFile(i):(new m.Notice("Cannot find file"),this.plugin.recentFiles=this.plugin.recentFiles.filter(t=>t.path!==e.path),this.plugin.persistRecentFiles(),this.redraw())}renderFavorites(e){let n=e.createDiv({cls:"waypoint-section waypoint-favorites"}),i=n.createDiv({cls:"waypoint-section-header"});i.setText("Waypoint Bookmarks");let t=i.createEl("button",{cls:"waypoint-header-more"});if((0,m.setIcon)(t,"more-horizontal"),(0,m.setTooltip)(t,"Add bookmark"),t.addEventListener("click",a=>{let r=new m.Menu;r.addItem(s=>{s.setTitle("Add current file").setIcon("file-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();o&&this.plugin.addBookmark(o.path,o.basename,"file")})}),r.addItem(s=>{s.setTitle("Add as parent note").setIcon("folder-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();if(!o)return;let l=this.plugin.addBookmark(o.path,o.basename,"group","");l.filePath=o.path,this.plugin.saveWaypointData(),this.redraw()})}),r.addItem(s=>{s.setTitle("New group").setIcon("folder-plus").onClick(()=>{this.plugin.addBookmark("","New Group","group","")})}),r.addSeparator(),r.addItem(s=>{s.setTitle("Add separator").setIcon("minus").onClick(()=>{this.plugin.addBookmark("","","separator")})}),r.addItem(s=>{s.setTitle("Add spacer").setIcon("space").onClick(()=>{this.plugin.addBookmark("","","spacer")})}),r.showAtPosition({x:a.clientX,y:a.clientY})}),this.plugin.waypointData.bookmarks.length===0){n.createDiv({cls:"waypoint-bookmark-item",text:"No bookmarks"});return}this.renderBookmarkList(n,this.plugin.waypointData.bookmarks,0)}renderBookmarkList(e,n,i){for(let t=0;t{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,a)});continue}if(a.type==="spacer"){let o=e.createDiv({cls:"waypoint-bookmark-item waypoint-bookmark-spacer"});o.setAttr("draggable","true"),o.setAttr("data-bm-id",a.id),o.style.paddingLeft=`${8+i*16}px`,o.style.cursor="grab",this.attachBookmarkDragHandlers(o,e,a,!1),o.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,a)});continue}let r=a.type==="group",s=e.createDiv({cls:`waypoint-bookmark-item${r?" waypoint-bookmark-group":""}${a.collapsed?" collapsed":""}`});if(s.setAttr("draggable","true"),s.setAttr("data-bm-id",a.id),r||(s.style.paddingLeft=`${8+i*16}px`),this.attachBookmarkDragHandlers(s,e,a,!0),r){let o=s.createDiv({cls:"waypoint-bm-icon"});a.icon&&(0,m.setIcon)(o,a.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:a.label}),p=s.createDiv({cls:"waypoint-bm-chevron"});(0,m.setIcon)(p,"chevron-down"),p.addEventListener("click",D=>{D.stopPropagation(),this.plugin.updateBookmark(a.id,{collapsed:!a.collapsed})}),s.addEventListener("click",D=>{if(a.filePath){let S=this.app.vault.getFileByPath(a.filePath);if(S){let M=m.Keymap.isModEvent(D);this.app.workspace.getLeaf(M).openFile(S);return}}this.plugin.updateBookmark(a.id,{collapsed:!a.collapsed})}),s.addEventListener("mousedown",D=>{if(D.button===1&&a.filePath){D.preventDefault();let S=this.app.vault.getFileByPath(a.filePath);S&&this.app.workspace.getLeaf("tab").openFile(S)}});let u=e.createDiv({cls:`waypoint-bookmark-children${a.collapsed?" collapsed":""}`});a.children&&a.children.length>0&&this.renderBookmarkList(u,a.children,i+1)}else{let o=s.createDiv({cls:"waypoint-bm-icon"});a.icon&&(0,m.setIcon)(o,a.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:a.label});if(a.children&&a.children.length>0){let p=s.createDiv({cls:"waypoint-bm-chevron"});(0,m.setIcon)(p,"chevron-down"),p.addEventListener("click",u=>{u.stopPropagation(),this.plugin.updateBookmark(a.id,{collapsed:!a.collapsed})}),a.collapsed&&(s.addClass("collapsed"),p.style.transform="rotate(-90deg)")}if((0,m.setTooltip)(s,a.filePath),s.addEventListener("click",p=>{if(a.filePath){let u=this.app.vault.getFileByPath(a.filePath);if(u){let D=m.Keymap.isModEvent(p);this.app.workspace.getLeaf(D).openFile(u)}else new m.Notice("File not found"),this.plugin.removeBookmark(a.id)}}),s.addEventListener("mousedown",p=>{if(p.button===1&&a.filePath){p.preventDefault();let u=this.app.vault.getFileByPath(a.filePath);u&&this.app.workspace.getLeaf("tab").openFile(u)}}),a.children&&a.children.length>0){let p=e.createDiv({cls:`waypoint-bookmark-children${a.collapsed?" collapsed":""}`});this.renderBookmarkList(p,a.children,i+1)}}s.addEventListener("contextmenu",o=>{o.stopPropagation(),o.preventDefault(),this.showBookmarkContextMenu(o,a)})}}showBookmarkContextMenu(e,n){let i=new m.Menu;if(n.type==="separator"||n.type==="spacer"){i.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id))),i.showAtPosition({x:e.clientX,y:e.clientY});return}n.type==="file"?(i.addItem(t=>t.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let a=this.app.vault.getFileByPath(n.filePath);a&&this.app.workspace.getLeaf("tab").openFile(a)})),i.addSeparator(),i.addItem(t=>t.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(n))),i.addItem(t=>t.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(n))),i.addSeparator(),i.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id)))):n.type==="group"&&(n.filePath&&(i.addItem(t=>t.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let a=this.app.vault.getFileByPath(n.filePath);a&&this.app.workspace.getLeaf("tab").openFile(a)})),i.addSeparator()),i.addItem(t=>t.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(n))),i.addItem(t=>t.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(n))),i.addSeparator(),i.addItem(t=>t.setTitle("Add child bookmark").setIcon("file-plus").onClick(()=>{let a=this.app.workspace.getActiveFile();if(!a){new m.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"file",label:a.basename,filePath:a.path,icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),i.addItem(t=>t.setTitle("Add child note").setIcon("folder-plus").onClick(()=>{let a=this.app.workspace.getActiveFile();if(!a){new m.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:a.basename,filePath:a.path,icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),i.addItem(t=>t.setTitle("New sub-group").setIcon("folder-plus").onClick(()=>{let a={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:"New Group",filePath:"",icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(a),this.plugin.saveWaypointData(),this.redraw()})),i.addSeparator(),i.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id)))),i.showAtPosition({x:e.clientX,y:e.clientY})}attachBookmarkDragHandlers(e,n,i,t){let a=()=>{e.removeClass("waypoint-bm-drop-line"),e.removeClass("waypoint-bm-drop-below"),e.removeClass("waypoint-bm-drop-into")};e.addEventListener("dragstart",r=>{this.dragId=i.id,r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",i.id),e.addClass("waypoint-bm-dragging")}),e.addEventListener("dragend",()=>{this.dragId=null,n.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(r=>{r.removeClass("waypoint-bm-dragging"),r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below"),r.removeClass("waypoint-bm-drop-into")})}),e.addEventListener("dragenter",r=>{r.preventDefault(),!(!this.dragId||this.dragId===i.id)&&this.showDropIndicator(e,r,t)}),e.addEventListener("dragover",r=>{r.preventDefault(),!(!this.dragId||this.dragId===i.id)&&this.showDropIndicator(e,r,t)}),e.addEventListener("dragleave",a),e.addEventListener("drop",r=>{var l,p;r.preventDefault(),this.dragId=null,a();let s=(l=r.dataTransfer)==null?void 0:l.getData("text/plain");if(!s||s===i.id)return;let o=this.dropZones.get(e);t&&(o!=null&&o.into)?i.type==="group"?this.moveBookmarkToGroup(s,i.id):this.createParentNoteAndMove(s,i.id):this.moveBookmarkToPosition(s,i.id,(p=o==null?void 0:o.above)!=null?p:!1)})}showDropIndicator(e,n,i){let t=e.parentElement;t&&t.querySelectorAll(".waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(s=>{s.removeClass("waypoint-bm-drop-line"),s.removeClass("waypoint-bm-drop-below"),s.removeClass("waypoint-bm-drop-into")});let a=e.getBoundingClientRect(),r=n.clientY;if(i){let s=a.top+a.height*.25,o=a.top+a.height*.75;ro?(e.addClass("waypoint-bm-drop-line"),e.addClass("waypoint-bm-drop-below"),this.dropZones.set(e,{above:!1,into:!1})):(e.addClass("waypoint-bm-drop-into"),this.dropZones.set(e,{above:!1,into:!0}))}else{let s=r{let r=a.findIndex(s=>s.id===e);if(r>=0){let[s]=a.splice(r,1);return s}for(let s of a){let o=i(s.children);if(o)return o}return null},t=i(this.plugin.waypointData.bookmarks);if(t){if(n){let a=(r,s)=>r.id===s?!0:r.children.some(o=>a(o,s));if(t.id===n||a(t,n))return}if(n){let a=s=>{for(let o of s){if(o.id===n)return o;let l=a(o.children);if(l)return l}return null},r=a(this.plugin.waypointData.bookmarks);r&&(t.indent=r.indent+1,r.children.push(t))}else t.indent=0,this.plugin.waypointData.bookmarks.push(t);this.plugin.saveWaypointData(),this.redraw()}}createParentNoteAndMove(e,n){let i=s=>{let o=s.findIndex(l=>l.id===e);if(o>=0){let[l]=s.splice(o,1);return l}for(let l of s)if(l.children){let p=i(l.children);if(p)return p}return null},t=i(this.plugin.waypointData.bookmarks);if(!t)return;let a=s=>{for(let o of s){if(o.id===n)return o;if(o.children){let l=a(o.children);if(l)return l}}return null},r=a(this.plugin.waypointData.bookmarks);r&&(t.indent=r.indent+1,r.children.push(t),this.plugin.saveWaypointData(),this.redraw())}moveBookmarkToPosition(e,n,i){let t=o=>{let l=o.findIndex(p=>p.id===e);if(l>=0){let[p]=o.splice(l,1);return{item:p,parent:o}}for(let p of o)if(p.children){let u=t(p.children);if(u.item)return u}return{item:null,parent:[]}},{item:a}=t(this.plugin.waypointData.bookmarks);if(!a)return;let r=o=>{let l=o.findIndex(p=>p.id===n);if(l>=0)return{parent:o,idx:l};for(let p of o)if(p.children){let u=r(p.children);if(u)return u}return null},s=r(this.plugin.waypointData.bookmarks);if(!s)a.indent=0,this.plugin.waypointData.bookmarks.push(a);else{let o=i?s.idx:s.idx+1;s.parent.splice(o,0,a)}this.plugin.saveWaypointData(),this.redraw()}promptRename(e){new U(this.app,{title:"Rename bookmark",initialValue:e.label},n=>{n&&n.trim()&&this.plugin.updateBookmark(e.id,{label:n.trim()})}).open()}promptIcon(e){new G(this.app,e.icon,n=>{this.plugin.updateBookmark(e.id,{icon:n})}).open()}},U=class extends m.Modal{constructor(d,e,n){super(d),this.options=e,this.onSubmit=n}onOpen(){var t,a,r;this.titleEl.setText(this.options.title);let d=this.contentEl.createEl("input",{type:"text",value:(t=this.options.initialValue)!=null?t:"",placeholder:(a=this.options.placeholder)!=null?a:""});d.style.width="100%",d.style.marginBottom="12px",d.focus(),d.select();let e=this.contentEl.createDiv({cls:"modal-button-container"}),n=e.createEl("button",{text:"Cancel",cls:"mod-cta"});n.style.marginRight="8px",n.addEventListener("click",()=>this.close()),e.createEl("button",{text:(r=this.options.cta)!=null?r:"Save",cls:"mod-cta"}).addEventListener("click",()=>{this.onSubmit(d.value),this.close()}),d.addEventListener("keydown",s=>{s.key==="Enter"&&(this.onSubmit(d.value),this.close())})}onClose(){this.contentEl.empty()}},Q=null;function Ie(){return Q||(Q=(async()=>{try{return await(await fetch("https://cdn.jsdelivr.net/npm/lucide-static@0.517.0/tags.json")).json()}catch(c){try{return await(await fetch("https://lucide.dev/api/tags")).json()}catch(d){return Q=null,Pe}}})()),Q}var G=class extends m.Modal{constructor(e,n,i){super(e);this.allIcons=[];this.tagsMap={};this.loaded=!1;this.selected=n,this.onSubmit=i}async onOpen(){let e=this.contentEl;e.style.display="flex",e.style.flexDirection="column",e.style.gap="10px",this.titleEl.setText("Change icon");let n=e.createDiv({cls:"waypoint-icon-preview"});n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.style.padding="12px 16px",n.style.borderRadius="8px",n.style.background="var(--background-secondary)",n.style.minHeight="48px";let i=n.createSpan();i.style.display="flex",this.selected&&(0,m.setIcon)(i,this.selected);let t=n.createSpan();t.style.fontWeight="var(--font-medium)",t.style.fontSize="var(--font-ui-medium)",t.setText(this.selected||"No icon");let a=e.createEl("input",{type:"text",placeholder:"Type to search (e.g. arrow, chart, home)..."});Object.assign(a.style,{width:"100%",boxSizing:"border-box",padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--background-modifier-border)",background:"var(--background-primary)",color:"var(--text-normal)",fontSize:"var(--font-ui-medium)"}),a.focus();let r=e.createDiv({cls:"waypoint-icon-grid"});r.style.display="grid",r.style.gridTemplateColumns="repeat(auto-fill, minmax(52px, 1fr))",r.style.gap="4px",r.style.maxHeight="320px",r.style.overflowY="auto",r.style.padding="2px 0";let s=e.createDiv();s.style.display="flex",s.style.justifyContent="space-between",s.style.alignItems="center",s.style.fontSize="var(--font-ui-smaller)",s.style.color="var(--text-muted)",s.style.padding="0 4px";let o=s.createSpan();o.setText("Loading\u2026"),this.loadIcons().then(()=>{this.loaded=!0,o.setText(this.allIcons.length+" icons"),p(a.value)});let l,p=B=>{if(r.empty(),!this.loaded){r.createDiv({text:"Loading\u2026"});return}let C=B.toLowerCase().trim(),I=C?this.allIcons.filter(h=>{if(h.includes(C))return!0;let g=this.tagsMap[h];return g?g.some(v=>v.includes(C)):!1}).slice(0,80):this.allIcons.slice(0,80);if(I.length===0){let h=r.createDiv();h.style.gridColumn="1 / -1",h.style.textAlign="center",h.style.color="var(--text-muted)",h.style.padding="20px",h.setText('No icons match "'+B+'"');return}for(let h of I){let g=r.createDiv();g.setAttr("data-icon",h),g.style.display="flex",g.style.alignItems="center",g.style.justifyContent="center",g.style.aspectRatio="1",g.style.borderRadius="6px",g.style.cursor="var(--cursor-link, pointer)",g.style.transition="background 80ms",g.setAttr("title",h),h===this.selected?(g.style.background="var(--interactive-accent)",g.style.color="var(--text-on-accent)"):g.style.color="var(--text-muted)";let v=g.createSpan();v.style.display="flex",(0,m.setIcon)(v,h),g.addEventListener("mouseenter",()=>{h!==this.selected&&(g.style.background="var(--background-modifier-hover)")}),g.addEventListener("mouseleave",()=>{h!==this.selected&&(g.style.background="")}),g.addEventListener("click",()=>{this.selected=h,p(B),i.empty(),(0,m.setIcon)(i,h),t.setText(h),r.querySelectorAll("div[data-icon]").forEach(x=>{let b=x;b.getAttr("data-icon")===h?(b.style.background="var(--interactive-accent)",b.style.color="var(--text-on-accent)"):(b.style.background="",b.style.color="var(--text-muted)")})})}o.setText(I.length+" of "+this.allIcons.length+" icons")};a.addEventListener("input",()=>{window.clearTimeout(l),l=window.setTimeout(()=>p(a.value),60)}),a.addEventListener("keydown",B=>{B.key==="Escape"&&this.close()});let u=e.createDiv({cls:"modal-button-container"});u.createEl("button",{text:"No icon",cls:"waypoint-icon-clear"}).addEventListener("click",()=>{this.onSubmit(""),this.close()}),u.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close());let M=u.createEl("button",{text:"Save",cls:"mod-cta"});M.style.marginLeft="8px",M.addEventListener("click",()=>{this.onSubmit(this.selected),this.close()})}onClose(){this.contentEl.empty()}async loadIcons(){let e=await Ie();this.tagsMap=e,this.allIcons=Object.keys(e).sort()}},Pe={file:[],folder:[],star:[],heart:[],bookmark:[],flag:[],pin:[],tag:[],book:[],"book-open":[],library:[],calendar:[],"calendar-days":[],clock:[],home:[],inbox:[],mail:[],search:[],settings:[],cog:[],user:[],users:[],zap:[],sparkles:[],target:[],link:[],globe:[],edit:[],pencil:[],anchor:[],award:[],bell:[],"bell-ring":[],brain:[],briefcase:[],camera:[],"chart-bar":[],"chart-line":[],"chart-pie":[],check:[],"check-circle":[],"chevron-down":[],"chevron-left":[],"chevron-right":[],"chevron-up":[],circle:[],clipboard:[],code:[],command:[],compass:[],copy:[],"credit-card":[],crown:[],database:[],download:[],"external-link":[],eye:[],"eye-off":[],"file-text":[],filter:[],fingerprint:[],flashlight:[],"folder-open":[],"folder-plus":[],gift:[],"git-branch":[],"git-commit":[],"git-merge":[],"git-pull-request":[],github:[],grid:[],hash:[],headphones:[],image:[],info:[],key:[],layers:[],layout:[],"life-buoy":[],"link-2":[],list:[],loader:[],lock:[],"log-in":[],"log-out":[],map:[],"map-pin":[],maximize:[],megaphone:[],menu:[],"message-circle":[],"message-square":[],mic:[],minimize:[],moon:[],"more-horizontal":[],"more-vertical":[],"mouse-pointer":[],move:[],music:[],navigation:[],"navigation-2":[],package:[],palette:[],paperclip:[],pause:[],phone:[],play:[],plus:[],"plus-circle":[],power:[],printer:[],radio:[],"refresh-cw":[],repeat:[],"rotate-ccw":[],"rotate-cw":[],rss:[],save:[],scissors:[],screen:[],send:[],server:[],share:[],"share-2":[],shield:[],"shield-off":[],"shopping-bag":[],"shopping-cart":[],shuffle:[],sidebar:[],slack:[],slash:[],sliders:[],smartphone:[],smile:[],speaker:[],square:[],"stop-circle":[],sun:[],sunrise:[],sunset:[],swords:[],table:[],tablet:[],terminal:[],thermometer:[],"thumbs-down":[],"thumbs-up":[],"toggle-left":[],"toggle-right":[],tool:[],trash:[],"trash-2":[],trello:[],"trending-down":[],"trending-up":[],triangle:[],truck:[],tv:[],twitter:[],type:[],umbrella:[],unlock:[],upload:[],"user-check":[],"user-minus":[],"user-plus":[],"user-x":[],video:[],"video-off":[],voicemail:[],volume:[],"volume-1":[],"volume-2":[],"volume-x":[],watch:[],wifi:[],"wifi-off":[],wind:[],x:[],"x-circle":[],"x-square":[],youtube:[],"zap-off":[],"zoom-in":[],"zoom-out":[],"arrow-down":[],"arrow-left":[],"arrow-right":[],"arrow-up":[],airplay:[],"alarm-clock":[],archive:[],armchair:[],atom:[],baby:[],backpack:[],badge:[],"badge-check":[],ban:[],banknote:[],barcode:[],bath:[],battery:[],"battery-charging":[],beer:[],bike:[],bird:[],bluetooth:[],bolt:[],bone:[],"bookmark-plus":[],bot:[],box:[],bug:[],building:[],bus:[],cake:[],calculator:[],car:[],"clipboard-check":[],cloud:[],"cloud-download":[],"cloud-lightning":[],"cloud-rain":[],"cloud-sun":[],"cloud-upload":[],clover:[],coffee:[],coins:[],contact:[],cookie:[],"corner-down-left":[],"corner-down-right":[],"corner-up-left":[],"corner-up-right":[],crosshair:[],"dice-1":[],"dice-6":[],"dollar-sign":[],"door-open":[],drama:[],droplet:[],drum:[],egg:[],equal:[],euro:[],factory:[],fan:[],feather:[],film:[],fish:[],flame:[],flask:[],flower:[],frown:[],fuel:[],gamepad:[],gauge:[],gem:[],ghost:[],glasses:[],"graduation-cap":[],hammer:[],"hard-drive":[],haze:[],"help-circle":[],"ice-cream":[],infinity:[],italic:[],"japanese-yen":[],keyboard:[],knife:[],lamp:[],landmark:[],languages:[],laptop:[],laugh:[],leaf:[],lightbulb:[],"list-plus":[],magnet:[],"mail-plus":[],meh:[],microscope:[],milestone:[],"minimize-2":[],monitor:[],mountain:[],mouse:[],network:[],newspaper:[],"package-check":[],"package-search":[],"paint-bucket":[],parking:[],"party-popper":[],"pen-tool":[],percent:[],"person-standing":[],"picture-in-picture-2":[],plane:[],plug:[],podcast:[],pointer:[],"pound-sterling":[],puzzle:[],"qr-code":[],rabbit:[],radar:[],rainbow:[],rocket:[],"roller-coaster":[],route:[],ruler:[],sailboat:[],scale:[],scan:[],school:[],ship:[],shirt:[],"shopping-basket":[],shovel:[],sigma:[],siren:[],skull:[],snowflake:[],soup:[],space:[],sparkle:[],stamp:[],store:[],subscript:[],superscript:[],syringe:[],tent:[],"tent-tree":[],"test-tube":[],theater:[],timer:[],train:[],"tree-deciduous":[],"tree-pine":[],trophy:[],typing:[],utensils:[],vibrate:[],wallet:[],wand:[],warehouse:[],waves:[],webcam:[],wheat:[],wine:[],wrench:[]};var Z=class extends y.AbstractInputSuggest{constructor(e,n){super(e,n);this.inputEl=n}getSuggestions(e){let n=e.toLowerCase();return this.app.vault.getMarkdownFiles().filter(i=>i.path.toLowerCase().includes(n)).slice(0,200)}renderSuggestion(e,n){n.setText(e.path.replace(/\.md$/,""))}selectSuggestion(e){this.setValue(e.path.replace(/\.md$/,"")),this.inputEl.trigger("input"),this.close()}},J=class extends y.PluginSettingTab{constructor(e,n,i,t){super(e,n);this.activeTab="calendar";this.plugin=n,this.settings=i,this.onSettingsChange=t}display(){let{containerEl:e}=this;e.empty();let n=e.createDiv({cls:"waypoint-settings-tabs"}),i=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"systems",label:"Date systems"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let a of i)n.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===a.key?" is-active":""}`,text:a.label}).addEventListener("click",()=>{this.activeTab=a.key,this.display()});let t=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(t);break;case"periodic":this.renderPeriodicTab(t);break;case"systems":this.renderSystemsTab(t);break;case"recent":this.renderRecentTab(t);break;case"display":this.renderDisplayTab(t);break;case"about":this.renderAboutTab(t);break}}renderCalendarTab(e){new y.Setting(e).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(i=>{this.settings.calendar.firstDayOfWeek=parseInt(i,10),this.saveAndRefresh()})}),new y.Setting(e).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(i=>{this.settings.calendar.showNoteIndicators=i,this.saveAndRefresh()})}),new y.Setting(e).setName("Indicator style").setDesc("Show one neutral dot for any dated note, or one coloured dot for each configured date system.").addDropdown(n=>{n.addOption("any","Single dot").addOption("systems","Colour by note system").setValue(this.settings.calendar.indicatorMode).onChange(i=>{this.settings.calendar.indicatorMode=i,this.saveAndRefresh()})}),new y.Setting(e).setName("Daily indicator colour").setDesc("Colour for daily-note dots when using \u201CColour by note system\u201D.").addColorPicker(n=>{n.setValue(this.settings.calendar.dailyIndicatorColor).onChange(i=>{this.settings.calendar.dailyIndicatorColor=i,this.saveAndRefresh()})})}renderPeriodicTab(e){new y.Setting(e).setName("Use existing tabs").setDesc("If a periodic note is already open, switch to its tab instead of opening it again.").addToggle(n=>{n.setValue(this.settings.reusePeriodicNoteTabs).onChange(i=>{this.settings.reusePeriodicNoteTabs=i,this.saveAndRefresh()})}),this.addPeriodNoteSettings(e,"Daily",this.settings.daily),this.addPeriodNoteSettings(e,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(e,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(e,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(e,"Yearly",this.settings.yearly)}addPeriodNoteSettings(e,n,i){new y.Setting(e).setHeading().setName(n),new y.Setting(e).setName("Folder").setDesc(`Folder path for ${n.toLowerCase()} notes.`).addText(t=>{t.setPlaceholder("periodic/daily"),t.setValue(i.folder),t.onChange(a=>{i.folder=a,this.saveAndRefresh()})}),new y.Setting(e).setName("Name format").setDesc(`Date format for ${n.toLowerCase()} note filenames (moment.js format).`).addText(t=>{t.setPlaceholder("yyyy-MM-dd"),t.setValue(i.nameFormat),t.onChange(a=>{i.nameFormat=a,this.saveAndRefresh()})}),new y.Setting(e).setName("Template file").setDesc("Path to the template file. The .md extension is optional.").addText(t=>{t.setPlaceholder("Templates/Daily note"),t.setValue(i.templateFile),new Z(this.app,t.inputEl),t.onChange(a=>{i.templateFile=a,this.saveAndRefresh()})}),new y.Setting(e).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(t=>{t.setPlaceholder("daily-note"),t.setValue(i.typeProperty),t.onChange(a=>{i.typeProperty=a,this.saveAndRefresh()})})}renderSystemsTab(e){let n=new DocumentFragment;n.createDiv({text:"A date system is a folder of notes whose filenames start with a date. Each one appears in the calendar's right-click menu for that day."}),n.createDiv({text:"The daily note is configured under Periodic Notes and always comes first in that menu."}),n.createDiv({text:"Name format is a moment.js format. Literal words need bracket escaping, e.g. YYYY-MM-DD - [Journal]."}),n.createDiv({text:"Include {title} for systems that hold many notes per date, such as meetings: the text before the token finds the existing notes, and the token marks where a typed title goes. Without it, a date has exactly one note."}),new y.Setting(e).setHeading().setName("Date systems").setDesc(n),this.settings.dateSystems.forEach((i,t,a)=>{new y.Setting(e).setHeading().setName(i.name||"Untitled system").addExtraButton(s=>{s.setIcon("arrow-up").setTooltip("Move up").setDisabled(t===0).onClick(async()=>{if(t===0)return;let o=a[t-1];a[t-1]=a[t],a[t]=o,await this.saveAndRefresh(),this.display()})}).addExtraButton(s=>{s.setIcon("arrow-down").setTooltip("Move down").setDisabled(t===a.length-1).onClick(async()=>{if(t===a.length-1)return;let o=a[t+1];a[t+1]=a[t],a[t]=o,await this.saveAndRefresh(),this.display()})}).addExtraButton(s=>{s.setIcon("trash").setTooltip("Delete this date system").onClick(async()=>{a.splice(t,1),await this.saveAndRefresh(),this.display()})}),this.addSystemTextSetting(e,"Name","Label shown in the calendar right-click menu.",i,"name","Journal"),this.addSystemTextSetting(e,"Folder","Folder these notes live in.",i,"folder","periodic/journal");let r=this.addSystemTextSetting(e,"Name format","Filename format (moment.js format). Include {title} for many notes per date.",i,"nameFormat","YYYY-MM-DD - {title}");i.nameFormat&&!$(i.nameFormat)&&r.descEl.createDiv({cls:"waypoint-settings-warning",text:"This name format has no date placeholder, so it will never match or create dated notes."}),this.addSystemTextSetting(e,"Template file","Path to the template file. The .md extension is optional.",i,"templateFile","resources/template/journal",!0),this.addSystemTextSetting(e,"Type property","Fallback value for the 'type' frontmatter property, used when no template is found.",i,"typeProperty","journal-note"),this.addSystemTextSetting(e,"Icon","Lucide icon name for the menu item. Browse names at lucide.dev.",i,"icon","book-open"),new y.Setting(e).setName("Indicator colour").setDesc("Colour for this system\u2019s dot when using \u201CColour by note system\u201D.").addColorPicker(s=>{s.setValue(i.indicatorColor).onChange(o=>{i.indicatorColor=o,this.saveAndRefresh()})})}),new y.Setting(e).addButton(i=>i.setButtonText("Add date system").setCta().onClick(async()=>{this.settings.dateSystems.push(Object.assign({id:`ds-${Date.now()}-${Math.random().toString(36).slice(2,6)}`},_)),await this.saveAndRefresh(),this.display()}))}addSystemTextSetting(e,n,i,t,a,r,s){return new y.Setting(e).setName(n).setDesc(i).addText(o=>{o.setPlaceholder(r),o.setValue(t[a]),s&&new Z(this.app,o.inputEl),o.onChange(l=>{t[a]=l,this.saveAndRefresh()})})}renderRecentTab(e){new y.Setting(e).setName("Max items").setDesc("How many recently opened files, and separately how many recently changed files, to keep. A burst of synced changes cannot push out the files you opened.").addText(t=>{t.inputEl.setAttr("type","number"),t.inputEl.setAttr("placeholder","50"),t.setValue(String(this.settings.recentFiles.maxItems)),t.inputEl.onblur=()=>{let a=parseInt(t.getValue(),10);!isNaN(a)&&a>0&&(this.settings.recentFiles.maxItems=a,this.saveAndRefresh())}});let n=new DocumentFragment;n.appendText("Regex patterns for paths to exclude. One per line."),new y.Setting(e).setName("Omitted paths").setDesc(n).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`^archives/ +var ne=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Se=(c,d)=>{for(var e in d)ne(c,e,{get:d[e],enumerable:!0})},Fe=(c,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let a of be(d))!De.call(c,a)&&a!==e&&ne(c,a,{get:()=>d[a],enumerable:!(n=ke(d,a))||n.enumerable});return c};var xe=c=>Fe(ne({},"__esModule",{value:!0}),c);var Ae={};Se(Ae,{default:()=>ee});module.exports=xe(Ae);var y=require("obsidian");var G={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},M={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,show:"all",omittedPaths:[],omittedTags:[],types:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var f=require("obsidian");var me="{title}";function V(c){let d=c.indexOf(me);return d<0?{before:c,after:"",hasTitle:!1}:{before:c.slice(0,d),after:c.slice(d+me.length),hasTitle:!0}}function ae(c,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return c.startsWith(e)}function ie(c,d,e,n){return n?!d||c.length|#^[\]]/g;function ge(c){return c.replace(Te,"-").replace(/\s+/g," ").trim()}function W(c){let{before:d}=V(c),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var h=require("obsidian");var B=require("obsidian");function ye(c,d,e){let n=(0,B.moment)({year:c,month:d,day:1}),a=(0,B.moment)(n).endOf("month"),t=(0,B.moment)(n).subtract((n.day()-e+7)%7,"days"),i=(0,B.moment)().startOf("day"),r=[],s=(0,B.moment)(t);for(;s.isBefore(a)||s.month()===d;){let o=[];for(let l=0;l<7;l++)o.push({date:(0,B.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(i,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:o[0].isoWeekNumber,days:o}),r.length>=6)break}return r}function Ee(c,d){return d==="opened"?c.openedAt:d==="changed"||c.openedAt===void 0?c.changedAt:c.changedAt===void 0?c.openedAt:Math.max(c.openedAt,c.changedAt)}function R(c,d){let e=[];for(let n of c){let a=Ee(n,d);a!==void 0&&e.push({entry:n,key:a})}return e.sort((n,a)=>a.key-n.key),e.map(n=>n.entry)}function j(c,d){let e=new Set([...R(c,"opened").slice(0,d),...R(c,"changed").slice(0,d)]);return R(c,"all").filter(n=>e.has(n))}var E="waypoint-view";function Me(c){return c.dragManager}var O=class extends h.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px");let n=this.contentEl.createDiv({cls:"waypoint-lists"});this.renderFavorites(n),this.renderRecentFiles(n),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.selectedDate=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}showDate(e){this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.selectedDate=e.clone(),this.redraw()}renderCalendar(){var le;let n=this.contentEl.createDiv({cls:"waypoint-section waypoint-calendar-section"}).createDiv({cls:"waypoint-calendar"}),a=(0,h.moment)(),t=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),i=n.createDiv({cls:"waypoint-calendar-top"}),r=i.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=t.format("[Q]Q"),o=r.createSpan({cls:"waypoint-clickable",text:s});o.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",t)}),o.addEventListener("mousedown",b=>{b.button===1&&(b.preventDefault(),this.plugin.openPeriodNote("quarter",t,this.app.workspace.getLeaf("tab")))});let l=t.clone().locale("en").format("MMM"),p=r.createSpan({cls:"waypoint-clickable",text:l});p.addEventListener("click",()=>{this.plugin.openPeriodNote("month",t)}),p.addEventListener("mousedown",b=>{b.button===1&&(b.preventDefault(),this.plugin.openPeriodNote("month",t,this.app.workspace.getLeaf("tab")))});let u=t.format("YYYY"),D=r.createSpan({cls:"waypoint-clickable",text:u});D.addEventListener("click",()=>{this.plugin.openPeriodNote("year",t)}),D.addEventListener("mousedown",b=>{b.button===1&&(b.preventDefault(),this.plugin.openPeriodNote("year",t,this.app.workspace.getLeaf("tab")))});let S=i.createDiv({cls:"waypoint-calendar-today-group"}),I=S.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(I,"chevron-left"),I.addEventListener("click",()=>this.navigateMonth(-1)),S.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.selectedDate=null,this.redraw()});let g=S.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(g,"chevron-right"),g.addEventListener("click",()=>this.navigateMonth(1));let F=S.createEl("button",{cls:"waypoint-calendar-nav-btn waypoint-calendar-pick-btn"});(0,h.setIcon)(F,"calendar-search"),(0,h.setTooltip)(F,"Go to date");let m=S.createEl("input",{type:"date",cls:"waypoint-calendar-pick-input"});m.tabIndex=-1,m.value=((le=this.selectedDate)!=null?le:a).format("YYYY-MM-DD"),m.addEventListener("change",()=>{let b=(0,h.moment)(m.value,"YYYY-MM-DD",!0);b.isValid()&&this.showDate(b)}),F.addEventListener("click",()=>{try{m.showPicker()}catch(b){m.click()}});let v=n.createEl("table"),w=v.createEl("thead").createEl("tr");w.createEl("th",{text:""});let k=["S","M","T","W","T","F","S"],A=this.plugin.settings.calendar.firstDayOfWeek;for(let b=0;b<7;b++){let Y=(A+b)%7;w.createEl("th",{text:k[Y]})}let N=v.createEl("tbody"),re=ye(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek),te=this.plugin.settings.calendar.showNoteIndicators&&this.plugin.settings.calendar.indicatorMode==="systems"?this.plugin.getDateSystemIndicators(re.reduce((b,Y)=>b.concat(Y.days.map(z=>z.date)),[])):null;for(let b of re){let Y=N.createEl("tr"),z=Y.createEl("td",{cls:"waypoint-weeknum"});z.setText(String(b.weekNumber));let ce=b.days[0].date;z.addEventListener("click",()=>{this.plugin.openPeriodNote("week",ce)}),z.addEventListener("mousedown",T=>{T.button===1&&(T.preventDefault(),this.plugin.openPeriodNote("week",ce,this.app.workspace.getLeaf("tab")))});for(let T of b.days){let C=Y.createEl("td",{cls:"waypoint-day"});if(C.setText(String(T.dayOfMonth)),T.isCurrentMonth||C.addClass("other-month"),T.isToday&&C.addClass("today"),this.selectedDate&&T.date.isSame(this.selectedDate,"day")&&C.addClass("is-selected"),this.plugin.settings.calendar.showNoteIndicators){let L=T.date.format("YYYY-MM-DD");if(this.plugin.settings.calendar.indicatorMode==="any")this.plugin.hasNoteForDate(L)&&C.addClass("has-note");else{let de=(te==null?void 0:te.get(L))||[];if(de.length>0){let we=C.createDiv({cls:"waypoint-day-indicators"});for(let pe of de){let he=we.createSpan({cls:"waypoint-day-indicator"});he.style.setProperty("--waypoint-indicator-color",pe.color),(0,h.setTooltip)(he,pe.name)}}}}C.addEventListener("click",()=>{this.plugin.openPeriodNote("day",T.date)}),C.addEventListener("mousedown",L=>{L.button===1&&(L.preventDefault(),this.plugin.openPeriodNote("day",T.date,this.app.workspace.getLeaf("tab")))}),C.addEventListener("contextmenu",L=>{L.preventDefault(),L.stopPropagation(),this.showDayContextMenu(L,T.date)})}}}navigateMonth(e){let n=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(e,"month");this.currentDisplayMonth=n.month(),this.currentDisplayYear=n.year(),this.selectedDate=null,this.redraw()}showDayContextMenu(e,n){let a=new h.Menu;a.addItem(t=>t.setTitle(n.format("dddd, MMMM D, YYYY")).setIsLabel(!0));for(let t of this.plugin.findDateSystemNotes(n)){let i=t.multiple||t.notes.length===0;if(t.notes.length+(i?1:0)===0)continue;a.addSeparator();for(let s of t.notes)a.addItem(o=>o.setTitle(s.label).setIcon(t.system.icon).onClick(l=>this.focusFile(s.file,h.Keymap.isModEvent(l))));if(!i)continue;let r=t.system.name.toLowerCase();a.addItem(s=>s.setTitle(t.multiple?`New ${r} note\u2026`:`New ${r} note`).setIcon("plus").onClick(o=>this.createDateSystemNote(t,n,h.Keymap.isModEvent(o))))}a.showAtPosition({x:e.clientX,y:e.clientY})}createDateSystemNote(e,n,a){if(!e.multiple){this.plugin.openDateSystemNote(e.system,n,{leaf:a?this.app.workspace.getLeaf(a):void 0});return}let t=e.system.name;new K(this.app,{title:`New ${t.toLowerCase()} note`,placeholder:`${t} with\u2026`,cta:"Create"},i=>{this.plugin.openDateSystemNote(e.system,n,{title:i,leaf:a?this.app.workspace.getLeaf(a):void 0})}).open()}renderRecentFiles(e){var P;let n=this.plugin.settings.recentFiles,a=e.createDiv({cls:"waypoint-section waypoint-recent-files"}),t=a.createDiv({cls:"waypoint-section-header"});t.createSpan({text:"Recent Files"});let i=t.createDiv({cls:"waypoint-recent-show"}),r=[{value:"all",label:"all",tooltip:"Opened or changed"},{value:"opened",label:"opened",tooltip:"Files you opened"},{value:"changed",label:"changed",tooltip:"Files that changed, by you or in the background"}];for(let g of r){let F=i.createSpan({cls:`waypoint-recent-show-option${n.show===g.value?" is-active":""}`,text:g.label});(0,h.setTooltip)(F,g.tooltip),F.addEventListener("click",()=>{n.show!==g.value&&(n.show=g.value,this.plugin.saveSettings(),this.redraw())})}let s=R(this.plugin.recentFiles,n.show);if(s.length===0){a.createDiv({cls:"nav-file",text:"No recent files"});return}let o=g=>{var v,x;let F=this.app.vault.getFileByPath(g),m=F?(x=(v=this.app.metadataCache.getFileCache(F))==null?void 0:v.frontmatter)==null?void 0:x.type:null;return typeof m=="string"?m:null},l=n.types.filter(g=>g.type),p=new Map(l.filter(g=>g.icon).map(g=>[g.type,g.icon])),u=p.size>0,D=this.app.workspace.getActiveFile(),S=a.createDiv({cls:"nav-folder mod-root"}),I=S.createDiv({cls:"nav-folder-children"});for(let g of s){let F=I.createDiv({cls:"tree-item nav-file"}),m=F.createDiv({cls:"tree-item-self is-clickable nav-file-title"});if(u){let w=m.createDiv({cls:"waypoint-recent-icon"}),k=p.get((P=o(g.path))!=null?P:"");k&&(0,h.setIcon)(w,k)}if(m.createDiv({cls:"tree-item-inner nav-file-title-content"}).setText(g.basename),m.createDiv({cls:"tree-item-spacer"}),g.changedInBackground){let w=m.createDiv({cls:"waypoint-recent-changed"});(0,h.setTooltip)(w,"Changed in the background")}let x=m.createDiv({cls:"waypoint-recent-remove"});(0,h.setIcon)(x,"x"),x.addEventListener("click",w=>{w.stopPropagation(),this.plugin.recentFiles=this.plugin.recentFiles.filter(k=>k.path!==g.path),this.plugin.persistRecentFiles(),this.redraw()}),(0,h.setTooltip)(F,g.path),D&&g.path===D.path&&m.addClass("is-active"),m.setAttr("draggable","true"),m.addEventListener("dragstart",w=>{let k=this.app.metadataCache.getFirstLinkpathDest(g.path,"");if(k){let A=Me(this.app),N=A.dragFile(w,k);A.onDragStart(w,N)}}),m.addEventListener("mouseover",w=>{this.app.workspace.trigger("hover-link",{event:w,source:E,hoverParent:S,targetEl:F,linktext:g.path})}),m.addEventListener("contextmenu",w=>{let k=new h.Menu;k.addItem(N=>N.setSection("action").setTitle("Open in new tab").setIcon("file-plus").onClick(()=>this.focusFile(g,"tab"))),k.addItem(N=>N.setSection("action").setTitle("Add to bookmarks").setIcon("bookmark").onClick(()=>{this.plugin.addBookmark(g.path,g.basename,"file"),new h.Notice(`Bookmarked: ${g.basename}`)}));let A=this.app.vault.getAbstractFileByPath(g.path);A&&this.app.workspace.trigger("file-menu",k,A,"link-context-menu"),k.showAtPosition({x:w.clientX,y:w.clientY})}),m.addEventListener("click",w=>{let k=h.Keymap.isModEvent(w);this.focusFile(g,k)}),m.addEventListener("mousedown",w=>{w.button===1&&(w.preventDefault(),this.focusFile(g,"tab"))})}}focusFile(e,n){let a=this.app.vault.getFiles().find(t=>t.path===e.path);a?this.app.workspace.getLeaf(n).openFile(a):(new h.Notice("Cannot find file"),this.plugin.recentFiles=this.plugin.recentFiles.filter(t=>t.path!==e.path),this.plugin.persistRecentFiles(),this.redraw())}renderFavorites(e){let n=e.createDiv({cls:"waypoint-section waypoint-favorites"}),a=n.createDiv({cls:"waypoint-section-header"});a.setText("Waypoint Bookmarks");let t=a.createEl("button",{cls:"waypoint-header-more"});if((0,h.setIcon)(t,"more-horizontal"),(0,h.setTooltip)(t,"Add bookmark"),t.addEventListener("click",i=>{let r=new h.Menu;r.addItem(s=>{s.setTitle("Add current file").setIcon("file-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();o&&this.plugin.addBookmark(o.path,o.basename,"file")})}),r.addItem(s=>{s.setTitle("Add as parent note").setIcon("folder-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();if(!o)return;let l=this.plugin.addBookmark(o.path,o.basename,"group","");l.filePath=o.path,this.plugin.saveWaypointData(),this.redraw()})}),r.addItem(s=>{s.setTitle("New group").setIcon("folder-plus").onClick(()=>{this.plugin.addBookmark("","New Group","group","")})}),r.addSeparator(),r.addItem(s=>{s.setTitle("Add separator").setIcon("minus").onClick(()=>{this.plugin.addBookmark("","","separator")})}),r.addItem(s=>{s.setTitle("Add spacer").setIcon("space").onClick(()=>{this.plugin.addBookmark("","","spacer")})}),r.showAtPosition({x:i.clientX,y:i.clientY})}),this.plugin.waypointData.bookmarks.length===0){n.createDiv({cls:"waypoint-bookmark-item",text:"No bookmarks"});return}this.renderBookmarkList(n,this.plugin.waypointData.bookmarks,0)}renderBookmarkList(e,n,a){for(let t=0;t{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,i)});continue}if(i.type==="spacer"){let o=e.createDiv({cls:"waypoint-bookmark-item waypoint-bookmark-spacer"});o.setAttr("draggable","true"),o.setAttr("data-bm-id",i.id),o.style.paddingLeft=`${8+a*16}px`,o.style.cursor="grab",this.attachBookmarkDragHandlers(o,e,i,!1),o.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,i)});continue}let r=i.type==="group",s=e.createDiv({cls:`waypoint-bookmark-item${r?" waypoint-bookmark-group":""}${i.collapsed?" collapsed":""}`});if(s.setAttr("draggable","true"),s.setAttr("data-bm-id",i.id),r||(s.style.paddingLeft=`${8+a*16}px`),this.attachBookmarkDragHandlers(s,e,i,!0),r){let o=s.createDiv({cls:"waypoint-bm-icon"});i.icon&&(0,h.setIcon)(o,i.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:i.label}),p=s.createDiv({cls:"waypoint-bm-chevron"});(0,h.setIcon)(p,"chevron-down"),p.addEventListener("click",D=>{D.stopPropagation(),this.plugin.updateBookmark(i.id,{collapsed:!i.collapsed})}),s.addEventListener("click",D=>{if(i.filePath){let S=this.app.vault.getFileByPath(i.filePath);if(S){let I=h.Keymap.isModEvent(D);this.app.workspace.getLeaf(I).openFile(S);return}}this.plugin.updateBookmark(i.id,{collapsed:!i.collapsed})}),s.addEventListener("mousedown",D=>{if(D.button===1&&i.filePath){D.preventDefault();let S=this.app.vault.getFileByPath(i.filePath);S&&this.app.workspace.getLeaf("tab").openFile(S)}});let u=e.createDiv({cls:`waypoint-bookmark-children${i.collapsed?" collapsed":""}`});i.children&&i.children.length>0&&this.renderBookmarkList(u,i.children,a+1)}else{let o=s.createDiv({cls:"waypoint-bm-icon"});i.icon&&(0,h.setIcon)(o,i.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:i.label});if(i.children&&i.children.length>0){let p=s.createDiv({cls:"waypoint-bm-chevron"});(0,h.setIcon)(p,"chevron-down"),p.addEventListener("click",u=>{u.stopPropagation(),this.plugin.updateBookmark(i.id,{collapsed:!i.collapsed})}),i.collapsed&&(s.addClass("collapsed"),p.style.transform="rotate(-90deg)")}if((0,h.setTooltip)(s,i.filePath),s.addEventListener("click",p=>{if(i.filePath){let u=this.app.vault.getFileByPath(i.filePath);if(u){let D=h.Keymap.isModEvent(p);this.app.workspace.getLeaf(D).openFile(u)}else new h.Notice("File not found"),this.plugin.removeBookmark(i.id)}}),s.addEventListener("mousedown",p=>{if(p.button===1&&i.filePath){p.preventDefault();let u=this.app.vault.getFileByPath(i.filePath);u&&this.app.workspace.getLeaf("tab").openFile(u)}}),i.children&&i.children.length>0){let p=e.createDiv({cls:`waypoint-bookmark-children${i.collapsed?" collapsed":""}`});this.renderBookmarkList(p,i.children,a+1)}}s.addEventListener("contextmenu",o=>{o.stopPropagation(),o.preventDefault(),this.showBookmarkContextMenu(o,i)})}}showBookmarkContextMenu(e,n){let a=new h.Menu;if(n.type==="separator"||n.type==="spacer"){a.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id))),a.showAtPosition({x:e.clientX,y:e.clientY});return}n.type==="file"?(a.addItem(t=>t.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let i=this.app.vault.getFileByPath(n.filePath);i&&this.app.workspace.getLeaf("tab").openFile(i)})),a.addSeparator(),a.addItem(t=>t.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(n))),a.addItem(t=>t.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(n))),a.addSeparator(),a.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id)))):n.type==="group"&&(n.filePath&&(a.addItem(t=>t.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let i=this.app.vault.getFileByPath(n.filePath);i&&this.app.workspace.getLeaf("tab").openFile(i)})),a.addSeparator()),a.addItem(t=>t.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(n))),a.addItem(t=>t.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(n))),a.addSeparator(),a.addItem(t=>t.setTitle("Add child bookmark").setIcon("file-plus").onClick(()=>{let i=this.app.workspace.getActiveFile();if(!i){new h.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"file",label:i.basename,filePath:i.path,icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),a.addItem(t=>t.setTitle("Add child note").setIcon("folder-plus").onClick(()=>{let i=this.app.workspace.getActiveFile();if(!i){new h.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:i.basename,filePath:i.path,icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),a.addItem(t=>t.setTitle("New sub-group").setIcon("folder-plus").onClick(()=>{let i={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:"New Group",filePath:"",icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(i),this.plugin.saveWaypointData(),this.redraw()})),a.addSeparator(),a.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id)))),a.showAtPosition({x:e.clientX,y:e.clientY})}attachBookmarkDragHandlers(e,n,a,t){let i=()=>{e.removeClass("waypoint-bm-drop-line"),e.removeClass("waypoint-bm-drop-below"),e.removeClass("waypoint-bm-drop-into")};e.addEventListener("dragstart",r=>{this.dragId=a.id,r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",a.id),e.addClass("waypoint-bm-dragging")}),e.addEventListener("dragend",()=>{this.dragId=null,n.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(r=>{r.removeClass("waypoint-bm-dragging"),r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below"),r.removeClass("waypoint-bm-drop-into")})}),e.addEventListener("dragenter",r=>{r.preventDefault(),!(!this.dragId||this.dragId===a.id)&&this.showDropIndicator(e,r,t)}),e.addEventListener("dragover",r=>{r.preventDefault(),!(!this.dragId||this.dragId===a.id)&&this.showDropIndicator(e,r,t)}),e.addEventListener("dragleave",i),e.addEventListener("drop",r=>{var l,p;r.preventDefault(),this.dragId=null,i();let s=(l=r.dataTransfer)==null?void 0:l.getData("text/plain");if(!s||s===a.id)return;let o=this.dropZones.get(e);t&&(o!=null&&o.into)?a.type==="group"?this.moveBookmarkToGroup(s,a.id):this.createParentNoteAndMove(s,a.id):this.moveBookmarkToPosition(s,a.id,(p=o==null?void 0:o.above)!=null?p:!1)})}showDropIndicator(e,n,a){let t=e.parentElement;t&&t.querySelectorAll(".waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(s=>{s.removeClass("waypoint-bm-drop-line"),s.removeClass("waypoint-bm-drop-below"),s.removeClass("waypoint-bm-drop-into")});let i=e.getBoundingClientRect(),r=n.clientY;if(a){let s=i.top+i.height*.25,o=i.top+i.height*.75;ro?(e.addClass("waypoint-bm-drop-line"),e.addClass("waypoint-bm-drop-below"),this.dropZones.set(e,{above:!1,into:!1})):(e.addClass("waypoint-bm-drop-into"),this.dropZones.set(e,{above:!1,into:!0}))}else{let s=r{let r=i.findIndex(s=>s.id===e);if(r>=0){let[s]=i.splice(r,1);return s}for(let s of i){let o=a(s.children);if(o)return o}return null},t=a(this.plugin.waypointData.bookmarks);if(t){if(n){let i=(r,s)=>r.id===s?!0:r.children.some(o=>i(o,s));if(t.id===n||i(t,n))return}if(n){let i=s=>{for(let o of s){if(o.id===n)return o;let l=i(o.children);if(l)return l}return null},r=i(this.plugin.waypointData.bookmarks);r&&(t.indent=r.indent+1,r.children.push(t))}else t.indent=0,this.plugin.waypointData.bookmarks.push(t);this.plugin.saveWaypointData(),this.redraw()}}createParentNoteAndMove(e,n){let a=s=>{let o=s.findIndex(l=>l.id===e);if(o>=0){let[l]=s.splice(o,1);return l}for(let l of s)if(l.children){let p=a(l.children);if(p)return p}return null},t=a(this.plugin.waypointData.bookmarks);if(!t)return;let i=s=>{for(let o of s){if(o.id===n)return o;if(o.children){let l=i(o.children);if(l)return l}}return null},r=i(this.plugin.waypointData.bookmarks);r&&(t.indent=r.indent+1,r.children.push(t),this.plugin.saveWaypointData(),this.redraw())}moveBookmarkToPosition(e,n,a){let t=o=>{let l=o.findIndex(p=>p.id===e);if(l>=0){let[p]=o.splice(l,1);return{item:p,parent:o}}for(let p of o)if(p.children){let u=t(p.children);if(u.item)return u}return{item:null,parent:[]}},{item:i}=t(this.plugin.waypointData.bookmarks);if(!i)return;let r=o=>{let l=o.findIndex(p=>p.id===n);if(l>=0)return{parent:o,idx:l};for(let p of o)if(p.children){let u=r(p.children);if(u)return u}return null},s=r(this.plugin.waypointData.bookmarks);if(!s)i.indent=0,this.plugin.waypointData.bookmarks.push(i);else{let o=a?s.idx:s.idx+1;s.parent.splice(o,0,i)}this.plugin.saveWaypointData(),this.redraw()}promptRename(e){new K(this.app,{title:"Rename bookmark",initialValue:e.label},n=>{n&&n.trim()&&this.plugin.updateBookmark(e.id,{label:n.trim()})}).open()}promptIcon(e){new H(this.app,e.icon,n=>{this.plugin.updateBookmark(e.id,{icon:n})}).open()}},K=class extends h.Modal{constructor(d,e,n){super(d),this.options=e,this.onSubmit=n}onOpen(){var t,i,r;this.titleEl.setText(this.options.title);let d=this.contentEl.createEl("input",{type:"text",value:(t=this.options.initialValue)!=null?t:"",placeholder:(i=this.options.placeholder)!=null?i:""});d.style.width="100%",d.style.marginBottom="12px",d.focus(),d.select();let e=this.contentEl.createDiv({cls:"modal-button-container"}),n=e.createEl("button",{text:"Cancel",cls:"mod-cta"});n.style.marginRight="8px",n.addEventListener("click",()=>this.close()),e.createEl("button",{text:(r=this.options.cta)!=null?r:"Save",cls:"mod-cta"}).addEventListener("click",()=>{this.onSubmit(d.value),this.close()}),d.addEventListener("keydown",s=>{s.key==="Enter"&&(this.onSubmit(d.value),this.close())})}onClose(){this.contentEl.empty()}},_=null;function Ie(){return _||(_=(async()=>{try{return await(await fetch("https://cdn.jsdelivr.net/npm/lucide-static@0.517.0/tags.json")).json()}catch(c){try{return await(await fetch("https://lucide.dev/api/tags")).json()}catch(d){return _=null,Pe}}})()),_}var H=class extends h.Modal{constructor(e,n,a){super(e);this.allIcons=[];this.tagsMap={};this.loaded=!1;this.selected=n,this.onSubmit=a}async onOpen(){let e=this.contentEl;e.style.display="flex",e.style.flexDirection="column",e.style.gap="10px",this.titleEl.setText("Change icon");let n=e.createDiv({cls:"waypoint-icon-preview"});n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.style.padding="12px 16px",n.style.borderRadius="8px",n.style.background="var(--background-secondary)",n.style.minHeight="48px";let a=n.createSpan();a.style.display="flex",this.selected&&(0,h.setIcon)(a,this.selected);let t=n.createSpan();t.style.fontWeight="var(--font-medium)",t.style.fontSize="var(--font-ui-medium)",t.setText(this.selected||"No icon");let i=e.createEl("input",{type:"text",placeholder:"Type to search (e.g. arrow, chart, home)..."});Object.assign(i.style,{width:"100%",boxSizing:"border-box",padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--background-modifier-border)",background:"var(--background-primary)",color:"var(--text-normal)",fontSize:"var(--font-ui-medium)"}),i.focus();let r=e.createDiv({cls:"waypoint-icon-grid"});r.style.display="grid",r.style.gridTemplateColumns="repeat(auto-fill, minmax(52px, 1fr))",r.style.gap="4px",r.style.maxHeight="320px",r.style.overflowY="auto",r.style.padding="2px 0";let s=e.createDiv();s.style.display="flex",s.style.justifyContent="space-between",s.style.alignItems="center",s.style.fontSize="var(--font-ui-smaller)",s.style.color="var(--text-muted)",s.style.padding="0 4px";let o=s.createSpan();o.setText("Loading\u2026"),this.loadIcons().then(()=>{this.loaded=!0,o.setText(this.allIcons.length+" icons"),p(i.value)});let l,p=P=>{if(r.empty(),!this.loaded){r.createDiv({text:"Loading\u2026"});return}let g=P.toLowerCase().trim(),F=g?this.allIcons.filter(m=>{if(m.includes(g))return!0;let v=this.tagsMap[m];return v?v.some(x=>x.includes(g)):!1}).slice(0,80):this.allIcons.slice(0,80);if(F.length===0){let m=r.createDiv();m.style.gridColumn="1 / -1",m.style.textAlign="center",m.style.color="var(--text-muted)",m.style.padding="20px",m.setText('No icons match "'+P+'"');return}for(let m of F){let v=r.createDiv();v.setAttr("data-icon",m),v.style.display="flex",v.style.alignItems="center",v.style.justifyContent="center",v.style.aspectRatio="1",v.style.borderRadius="6px",v.style.cursor="var(--cursor-link, pointer)",v.style.transition="background 80ms",v.setAttr("title",m),m===this.selected?(v.style.background="var(--interactive-accent)",v.style.color="var(--text-on-accent)"):v.style.color="var(--text-muted)";let x=v.createSpan();x.style.display="flex",(0,h.setIcon)(x,m),v.addEventListener("mouseenter",()=>{m!==this.selected&&(v.style.background="var(--background-modifier-hover)")}),v.addEventListener("mouseleave",()=>{m!==this.selected&&(v.style.background="")}),v.addEventListener("click",()=>{this.selected=m,p(P),a.empty(),(0,h.setIcon)(a,m),t.setText(m),r.querySelectorAll("div[data-icon]").forEach(w=>{let k=w;k.getAttr("data-icon")===m?(k.style.background="var(--interactive-accent)",k.style.color="var(--text-on-accent)"):(k.style.background="",k.style.color="var(--text-muted)")})})}o.setText(F.length+" of "+this.allIcons.length+" icons")};i.addEventListener("input",()=>{window.clearTimeout(l),l=window.setTimeout(()=>p(i.value),60)}),i.addEventListener("keydown",P=>{P.key==="Escape"&&this.close()});let u=e.createDiv({cls:"modal-button-container"});u.createEl("button",{text:"No icon",cls:"waypoint-icon-clear"}).addEventListener("click",()=>{this.onSubmit(""),this.close()}),u.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close());let I=u.createEl("button",{text:"Save",cls:"mod-cta"});I.style.marginLeft="8px",I.addEventListener("click",()=>{this.onSubmit(this.selected),this.close()})}onClose(){this.contentEl.empty()}async loadIcons(){let e=await Ie();this.tagsMap=e,this.allIcons=Object.keys(e).sort()}},Pe={file:[],folder:[],star:[],heart:[],bookmark:[],flag:[],pin:[],tag:[],book:[],"book-open":[],library:[],calendar:[],"calendar-days":[],clock:[],home:[],inbox:[],mail:[],search:[],settings:[],cog:[],user:[],users:[],zap:[],sparkles:[],target:[],link:[],globe:[],edit:[],pencil:[],anchor:[],award:[],bell:[],"bell-ring":[],brain:[],briefcase:[],camera:[],"chart-bar":[],"chart-line":[],"chart-pie":[],check:[],"check-circle":[],"chevron-down":[],"chevron-left":[],"chevron-right":[],"chevron-up":[],circle:[],clipboard:[],code:[],command:[],compass:[],copy:[],"credit-card":[],crown:[],database:[],download:[],"external-link":[],eye:[],"eye-off":[],"file-text":[],filter:[],fingerprint:[],flashlight:[],"folder-open":[],"folder-plus":[],gift:[],"git-branch":[],"git-commit":[],"git-merge":[],"git-pull-request":[],github:[],grid:[],hash:[],headphones:[],image:[],info:[],key:[],layers:[],layout:[],"life-buoy":[],"link-2":[],list:[],loader:[],lock:[],"log-in":[],"log-out":[],map:[],"map-pin":[],maximize:[],megaphone:[],menu:[],"message-circle":[],"message-square":[],mic:[],minimize:[],moon:[],"more-horizontal":[],"more-vertical":[],"mouse-pointer":[],move:[],music:[],navigation:[],"navigation-2":[],package:[],palette:[],paperclip:[],pause:[],phone:[],play:[],plus:[],"plus-circle":[],power:[],printer:[],radio:[],"refresh-cw":[],repeat:[],"rotate-ccw":[],"rotate-cw":[],rss:[],save:[],scissors:[],screen:[],send:[],server:[],share:[],"share-2":[],shield:[],"shield-off":[],"shopping-bag":[],"shopping-cart":[],shuffle:[],sidebar:[],slack:[],slash:[],sliders:[],smartphone:[],smile:[],speaker:[],square:[],"stop-circle":[],sun:[],sunrise:[],sunset:[],swords:[],table:[],tablet:[],terminal:[],thermometer:[],"thumbs-down":[],"thumbs-up":[],"toggle-left":[],"toggle-right":[],tool:[],trash:[],"trash-2":[],trello:[],"trending-down":[],"trending-up":[],triangle:[],truck:[],tv:[],twitter:[],type:[],umbrella:[],unlock:[],upload:[],"user-check":[],"user-minus":[],"user-plus":[],"user-x":[],video:[],"video-off":[],voicemail:[],volume:[],"volume-1":[],"volume-2":[],"volume-x":[],watch:[],wifi:[],"wifi-off":[],wind:[],x:[],"x-circle":[],"x-square":[],youtube:[],"zap-off":[],"zoom-in":[],"zoom-out":[],"arrow-down":[],"arrow-left":[],"arrow-right":[],"arrow-up":[],airplay:[],"alarm-clock":[],archive:[],armchair:[],atom:[],baby:[],backpack:[],badge:[],"badge-check":[],ban:[],banknote:[],barcode:[],bath:[],battery:[],"battery-charging":[],beer:[],bike:[],bird:[],bluetooth:[],bolt:[],bone:[],"bookmark-plus":[],bot:[],box:[],bug:[],building:[],bus:[],cake:[],calculator:[],car:[],"clipboard-check":[],cloud:[],"cloud-download":[],"cloud-lightning":[],"cloud-rain":[],"cloud-sun":[],"cloud-upload":[],clover:[],coffee:[],coins:[],contact:[],cookie:[],"corner-down-left":[],"corner-down-right":[],"corner-up-left":[],"corner-up-right":[],crosshair:[],"dice-1":[],"dice-6":[],"dollar-sign":[],"door-open":[],drama:[],droplet:[],drum:[],egg:[],equal:[],euro:[],factory:[],fan:[],feather:[],film:[],fish:[],flame:[],flask:[],flower:[],frown:[],fuel:[],gamepad:[],gauge:[],gem:[],ghost:[],glasses:[],"graduation-cap":[],hammer:[],"hard-drive":[],haze:[],"help-circle":[],"ice-cream":[],infinity:[],italic:[],"japanese-yen":[],keyboard:[],knife:[],lamp:[],landmark:[],languages:[],laptop:[],laugh:[],leaf:[],lightbulb:[],"list-plus":[],magnet:[],"mail-plus":[],meh:[],microscope:[],milestone:[],"minimize-2":[],monitor:[],mountain:[],mouse:[],network:[],newspaper:[],"package-check":[],"package-search":[],"paint-bucket":[],parking:[],"party-popper":[],"pen-tool":[],percent:[],"person-standing":[],"picture-in-picture-2":[],plane:[],plug:[],podcast:[],pointer:[],"pound-sterling":[],puzzle:[],"qr-code":[],rabbit:[],radar:[],rainbow:[],rocket:[],"roller-coaster":[],route:[],ruler:[],sailboat:[],scale:[],scan:[],school:[],ship:[],shirt:[],"shopping-basket":[],shovel:[],sigma:[],siren:[],skull:[],snowflake:[],soup:[],space:[],sparkle:[],stamp:[],store:[],subscript:[],superscript:[],syringe:[],tent:[],"tent-tree":[],"test-tube":[],theater:[],timer:[],train:[],"tree-deciduous":[],"tree-pine":[],trophy:[],typing:[],utensils:[],vibrate:[],wallet:[],wand:[],warehouse:[],waves:[],webcam:[],wheat:[],wine:[],wrench:[]};var Q=class extends f.AbstractInputSuggest{constructor(e,n){super(e,n);this.inputEl=n}getSuggestions(e){let n=e.toLowerCase();return this.app.vault.getMarkdownFiles().filter(a=>a.path.toLowerCase().includes(n)).slice(0,200)}renderSuggestion(e,n){n.setText(e.path.replace(/\.md$/,""))}selectSuggestion(e){this.setValue(e.path.replace(/\.md$/,"")),this.inputEl.trigger("input"),this.close()}},U=class extends f.PluginSettingTab{constructor(e,n,a,t){super(e,n);this.activeTab="calendar";this.plugin=n,this.settings=a,this.onSettingsChange=t}display(){let{containerEl:e}=this;e.empty();let n=e.createDiv({cls:"waypoint-settings-tabs"}),a=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"systems",label:"Date systems"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let i of a)n.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===i.key?" is-active":""}`,text:i.label}).addEventListener("click",()=>{this.activeTab=i.key,this.display()});let t=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(t);break;case"periodic":this.renderPeriodicTab(t);break;case"systems":this.renderSystemsTab(t);break;case"recent":this.renderRecentTab(t);break;case"display":this.renderDisplayTab(t);break;case"about":this.renderAboutTab(t);break}}renderCalendarTab(e){new f.Setting(e).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(a=>{this.settings.calendar.firstDayOfWeek=parseInt(a,10),this.saveAndRefresh()})}),new f.Setting(e).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(a=>{this.settings.calendar.showNoteIndicators=a,this.saveAndRefresh()})}),new f.Setting(e).setName("Indicator style").setDesc("Show one neutral dot for any dated note, or one coloured dot for each configured date system.").addDropdown(n=>{n.addOption("any","Single dot").addOption("systems","Colour by note system").setValue(this.settings.calendar.indicatorMode).onChange(a=>{this.settings.calendar.indicatorMode=a,this.saveAndRefresh()})}),new f.Setting(e).setName("Daily indicator colour").setDesc("Colour for daily-note dots when using \u201CColour by note system\u201D.").addColorPicker(n=>{n.setValue(this.settings.calendar.dailyIndicatorColor).onChange(a=>{this.settings.calendar.dailyIndicatorColor=a,this.saveAndRefresh()})})}renderPeriodicTab(e){new f.Setting(e).setName("Use existing tabs").setDesc("If a periodic note is already open, switch to its tab instead of opening it again.").addToggle(n=>{n.setValue(this.settings.reusePeriodicNoteTabs).onChange(a=>{this.settings.reusePeriodicNoteTabs=a,this.saveAndRefresh()})}),this.addPeriodNoteSettings(e,"Daily",this.settings.daily),this.addPeriodNoteSettings(e,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(e,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(e,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(e,"Yearly",this.settings.yearly)}addPeriodNoteSettings(e,n,a){new f.Setting(e).setHeading().setName(n),new f.Setting(e).setName("Folder").setDesc(`Folder path for ${n.toLowerCase()} notes.`).addText(t=>{t.setPlaceholder("periodic/daily"),t.setValue(a.folder),t.onChange(i=>{a.folder=i,this.saveAndRefresh()})}),new f.Setting(e).setName("Name format").setDesc(`Date format for ${n.toLowerCase()} note filenames (moment.js format).`).addText(t=>{t.setPlaceholder("yyyy-MM-dd"),t.setValue(a.nameFormat),t.onChange(i=>{a.nameFormat=i,this.saveAndRefresh()})}),new f.Setting(e).setName("Template file").setDesc("Path to the template file. The .md extension is optional.").addText(t=>{t.setPlaceholder("Templates/Daily note"),t.setValue(a.templateFile),new Q(this.app,t.inputEl),t.onChange(i=>{a.templateFile=i,this.saveAndRefresh()})}),new f.Setting(e).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(t=>{t.setPlaceholder("daily-note"),t.setValue(a.typeProperty),t.onChange(i=>{a.typeProperty=i,this.saveAndRefresh()})})}renderSystemsTab(e){let n=new DocumentFragment;n.createDiv({text:"A date system is a folder of notes whose filenames start with a date. Each one appears in the calendar's right-click menu for that day."}),n.createDiv({text:"The daily note is configured under Periodic Notes and always comes first in that menu."}),n.createDiv({text:"Name format is a moment.js format. Literal words need bracket escaping, e.g. YYYY-MM-DD - [Journal]."}),n.createDiv({text:"Include {title} for systems that hold many notes per date, such as meetings: the text before the token finds the existing notes, and the token marks where a typed title goes. Without it, a date has exactly one note."}),new f.Setting(e).setHeading().setName("Date systems").setDesc(n),this.settings.dateSystems.forEach((a,t,i)=>{new f.Setting(e).setHeading().setName(a.name||"Untitled system").addExtraButton(s=>{s.setIcon("arrow-up").setTooltip("Move up").setDisabled(t===0).onClick(async()=>{if(t===0)return;let o=i[t-1];i[t-1]=i[t],i[t]=o,await this.saveAndRefresh(),this.display()})}).addExtraButton(s=>{s.setIcon("arrow-down").setTooltip("Move down").setDisabled(t===i.length-1).onClick(async()=>{if(t===i.length-1)return;let o=i[t+1];i[t+1]=i[t],i[t]=o,await this.saveAndRefresh(),this.display()})}).addExtraButton(s=>{s.setIcon("trash").setTooltip("Delete this date system").onClick(async()=>{i.splice(t,1),await this.saveAndRefresh(),this.display()})}),this.addSystemTextSetting(e,"Name","Label shown in the calendar right-click menu.",a,"name","Journal"),this.addSystemTextSetting(e,"Folder","Folder these notes live in.",a,"folder","periodic/journal");let r=this.addSystemTextSetting(e,"Name format","Filename format (moment.js format). Include {title} for many notes per date.",a,"nameFormat","YYYY-MM-DD - {title}");a.nameFormat&&!W(a.nameFormat)&&r.descEl.createDiv({cls:"waypoint-settings-warning",text:"This name format has no date placeholder, so it will never match or create dated notes."}),this.addSystemTextSetting(e,"Template file","Path to the template file. The .md extension is optional.",a,"templateFile","resources/template/journal",!0),this.addSystemTextSetting(e,"Type property","Fallback value for the 'type' frontmatter property, used when no template is found.",a,"typeProperty","journal-note"),this.addSystemTextSetting(e,"Icon","Lucide icon name for the menu item. Browse names at lucide.dev.",a,"icon","book-open"),new f.Setting(e).setName("Indicator colour").setDesc("Colour for this system\u2019s dot when using \u201CColour by note system\u201D.").addColorPicker(s=>{s.setValue(a.indicatorColor).onChange(o=>{a.indicatorColor=o,this.saveAndRefresh()})})}),new f.Setting(e).addButton(a=>a.setButtonText("Add date system").setCta().onClick(async()=>{this.settings.dateSystems.push(Object.assign({id:`ds-${Date.now()}-${Math.random().toString(36).slice(2,6)}`},G)),await this.saveAndRefresh(),this.display()}))}addSystemTextSetting(e,n,a,t,i,r,s){return new f.Setting(e).setName(n).setDesc(a).addText(o=>{o.setPlaceholder(r),o.setValue(t[i]),s&&new Q(this.app,o.inputEl),o.onChange(l=>{t[i]=l,this.saveAndRefresh()})})}renderRecentTab(e){new f.Setting(e).setName("Max items").setDesc("How many recently opened files, and separately how many recently changed files, to keep. A burst of synced changes cannot push out the files you opened.").addText(t=>{t.inputEl.setAttr("type","number"),t.inputEl.setAttr("placeholder","50"),t.setValue(String(this.settings.recentFiles.maxItems)),t.inputEl.onblur=()=>{let i=parseInt(t.getValue(),10);!isNaN(i)&&i>0&&(this.settings.recentFiles.maxItems=i,this.saveAndRefresh())}});let n=new DocumentFragment;n.appendText("Regex patterns for paths to exclude. One per line."),new f.Setting(e).setName("Omitted paths").setDesc(n).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`^archives/ \\.png$`),t.setValue(this.settings.recentFiles.omittedPaths.join(` `)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=t.getValue().split(` -`).filter(a=>a.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new y.Setting(e).setName("Omitted tags").setDesc(i).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`ignore +`).filter(i=>i.trim()),this.saveAndRefresh()}});let a=new DocumentFragment;a.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new f.Setting(e).setName("Omitted tags").setDesc(a).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`ignore archive`),t.setValue(this.settings.recentFiles.omittedTags.join(` `)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=t.getValue().split(` -`).filter(a=>a.trim()),this.saveAndRefresh()}}),new y.Setting(e).setName("Type filter").setDesc("Show pills above the list to filter recent files by their frontmatter `type`.").addToggle(t=>{t.setValue(this.settings.recentFiles.showTypeFilter).onChange(a=>{this.settings.recentFiles.showTypeFilter=a,this.saveAndRefresh()})}),this.renderRecentTypes(e)}renderRecentTypes(e){let n=this.settings.recentFiles.types;new y.Setting(e).setHeading().setName("File types").setDesc("Frontmatter `type` values. A type's icon shows beside matching recent files. With the type filter on, these types are the pills, in this order; with no types listed, pills are detected automatically."),n.forEach((i,t)=>{new y.Setting(e).addText(a=>{a.setPlaceholder("meeting"),a.setValue(i.type),a.inputEl.onblur=()=>{let r=a.getValue().trim();r!==i.type&&(i.type=r,this.saveAndRefresh())}}).addExtraButton(a=>{a.setIcon(i.icon||"image-off").setTooltip(i.icon?`Icon: ${i.icon}`:"Choose icon").onClick(()=>{new G(this.app,i.icon,r=>{i.icon=r,this.saveAndRefresh(),this.display()}).open()})}).addExtraButton(a=>{a.setIcon("trash").setTooltip("Remove this type").onClick(()=>{n.splice(t,1),this.saveAndRefresh(),this.display()})})}),new y.Setting(e).addButton(i=>{i.setButtonText("Add type").onClick(()=>{n.push({type:"",icon:""}),this.display()})})}renderDisplayTab(e){new y.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new y.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new y.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...P.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,i,t,a,r,s,o,l){let p=new y.Setting(e).setName(n).setDesc(`${i} (${t[a]}${l})`);p.addSlider(u=>{u.setLimits(r,s,o).setValue(t[a]).setDynamicTooltip().onChange(D=>{t[a]=D,p.setDesc(`${i} (${D}${l})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,i=e.createDiv();i.style.display="flex",i.style.alignItems="center",i.style.gap="12px",i.style.marginBottom="16px";let t=i.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,y.setIcon)(t,"compass");let a=i.createDiv(),r=a.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=a.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let o=e.createDiv();o.style.marginBottom="20px",o.style.lineHeight="1.6",o.style.color="var(--text-normal)",o.innerHTML=["

Waypoint is a sidebar plugin that brings three essential panels into one view:

",'
    ',"
  • Calendar \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.
  • ","
  • Recent Files \u2014 a list of recently opened files with type filtering, drag-and-drop, and right-click actions.
  • ","
  • Bookmarks \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.
  • ","
",'

Made by Olivier. Licensed under MIT.

'].join(` -`)}};var ee=require("obsidian"),X=class extends ee.Modal{constructor(e,n,i){super(e);this.initialDate=n;this.onSubmit=i}onOpen(){this.titleEl.setText("Open date");let e=this.contentEl.createEl("input",{type:"date",value:this.initialDate.format("YYYY-MM-DD")});e.style.width="100%",e.style.marginBottom="12px",e.focus();let n=()=>{let t=(0,ee.moment)(e.value,"YYYY-MM-DD",!0);t.isValid()&&(this.close(),this.onSubmit(t))};e.addEventListener("keydown",t=>{t.key==="Enter"&&n()});let i=this.contentEl.createDiv({cls:"modal-button-container"});i.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close()),i.createEl("button",{text:"Open",cls:"mod-cta"}).addEventListener("click",n)}onClose(){this.contentEl.empty()}};function oe(c,d,e){return!c||!d?null:c===d?e:c.startsWith(d+"/")?e+c.slice(d.length):null}var ne=class extends f.Plugin{constructor(){super(...arguments);this.recentFiles=[];this.savePromise=Promise.resolve();this.markdownBasenames=new Set;this.dateSystemIndicators=null;this.dateSystemIndicatorKey="";this.indicatorModeMigrated=!1;this.previouslyActive=null;this.activePath=null}async onload(){console.debug("Waypoint: loading plugin v"+this.manifest.version);let e=await this.loadData(),n=this.applySettings(e);this.applyWaypointData(e),n&&this.persistAll(),this.registerView(E,s=>new z(s,this)),this.addSettingTab(new J(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.invalidateDateSystemIndicators(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let s=this.app.workspace.getLeavesOfType(E);if(s.length>0)await this.app.workspace.revealLeaf(s[0]);else{let o=this.app.workspace.getLeftLeaf(!1);o&&(await o.setViewState({type:E}),await this.app.workspace.revealLeaf(o))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let s=this.app.workspace.getActiveFile();if(!s){new f.Notice("No active file");return}this.addBookmark(s.path,s.basename,"file"),new f.Notice(`Bookmarked: ${s.basename}`)}}),this.addCommand({id:"waypoint-go-to-daily",name:"Go to daily note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"d"}],callback:async()=>{await this.openPeriodNote("day",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-weekly",name:"Go to weekly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"w"}],callback:async()=>{await this.openPeriodNote("week",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-monthly",name:"Go to monthly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"m"}],callback:async()=>{await this.openPeriodNote("month",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-quarterly",name:"Go to quarterly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"q"}],callback:async()=>{await this.openPeriodNote("quarter",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-yearly",name:"Go to yearly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"y"}],callback:async()=>{await this.openPeriodNote("year",(0,f.moment)())}}),this.addCommand({id:"waypoint-open-date",name:"Open daily note for a date\u2026",callback:()=>{new X(this.app,(0,f.moment)(),s=>{this.showDateInViews(s),this.openPeriodNote("day",s)}).open()}});let i=["next","prev"],t=["daily","weekly","monthly","quarterly","yearly"],a={next:"Next",prev:"Previous"};for(let s of t)for(let o of i){let l=`waypoint-go-to-${o}-${s}`,p=`${a[o]} ${s} note`;this.addCommand({id:l,name:p,callback:async()=>{await this.navigatePeriodNote(o)}})}this.registerEvent(this.app.workspace.on("file-open",s=>{s&&this.onFileOpen(s)})),this.registerEvent(this.app.vault.on("create",s=>this.onVaultCreate(s))),this.registerEvent(this.app.vault.on("delete",s=>this.onVaultDelete(s))),this.registerEvent(this.app.vault.on("rename",(s,o)=>this.onRename(s,o))),this.registerEvent(this.app.vault.on("modify",s=>this.onFileChange(s))),this.app.workspace.onLayoutReady(()=>{if(this.buildMarkdownIndex(),this.app.workspace.getLeavesOfType(E).length===0){let o=this.app.workspace.getLeftLeaf(!1);o&&o.setViewState({type:E})}else this.broadcastRedraw()});let r=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let s=new Date().toDateString();s!==r&&(r=s,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(E)}applySettings(e){var r,s,o;let n=(e==null?void 0:e.settings)||{};this.settings=Object.assign({},P,n),this.settings.recentFiles=Object.assign({},P.recentFiles,n.recentFiles||{});let i=this.settings.recentFiles;this.settings.recentFiles.types=Array.isArray((r=n.recentFiles)==null?void 0:r.types)?n.recentFiles.types.map(l=>({...l})):((s=i.filterTags)!=null?s:[]).map(l=>({type:l,icon:""})),delete i.filterTags,delete i.updateOn,this.settings.calendar=Object.assign({},P.calendar,n.calendar||{}),this.settings.display=Object.assign({},P.display,n.display||{});for(let l of Ce)this.settings[l]=Object.assign({},P[l],n[l]||{});this.settings.dateSystems=Array.isArray(n.dateSystems)?n.dateSystems.map(l=>{let p=P.dateSystems.find(u=>u.id===l.id);return Object.assign({},p||_,l)}):P.dateSystems.map(l=>Object.assign({},l));let t=(e==null?void 0:e.indicatorModeMigrated)===!0,a=!1;return!t&&((o=n.calendar)==null?void 0:o.indicatorMode)==="any"&&(this.settings.calendar.indicatorMode="systems",a=!0),this.indicatorModeMigrated=!0,a}applyWaypointData(e){var r,s;let n=(e==null?void 0:e.waypointData)||{};this.waypointData={bookmarks:Array.isArray(n.bookmarks)?n.bookmarks:[],recentFiles:Array.isArray(n.recentFiles)?n.recentFiles:[]};let t=((s=(r=e==null?void 0:e.settings)==null?void 0:r.recentFiles)==null?void 0:s.updateOn)==="file-edit"?"changedAt":"openedAt",a=this.waypointData.recentFiles.length;this.recentFiles=K(this.waypointData.recentFiles.map((o,l)=>o.openedAt===void 0&&o.changedAt===void 0?{...o,[t]:a-l}:o),this.settings.recentFiles.maxItems),this.waypointData.recentFiles=this.recentFiles}persistAll(){let e=this.savePromise.then(()=>(this.waypointData.recentFiles=this.recentFiles,this.saveData({settings:this.settings,waypointData:this.waypointData,indicatorModeMigrated:this.indicatorModeMigrated})));return this.savePromise=e.catch(()=>{}),e}async saveSettings(){await this.persistAll()}async saveWaypointData(){await this.persistAll()}enforceRecentFilesLimit(){let e=K(this.recentFiles,this.settings.recentFiles.maxItems);e.length!==this.recentFiles.length&&(this.recentFiles=e,this.persistRecentFiles())}persistRecentFiles(){this.waypointData.recentFiles=this.recentFiles,window.clearTimeout(this.recentFilesSaveTimer),this.recentFilesSaveTimer=window.setTimeout(()=>{this.saveWaypointData()},300)}onFileOpen(e){this.activePath&&this.activePath!==e.path&&(this.previouslyActive={path:this.activePath,until:Date.now()+Le}),this.activePath=e.path,this.recordRecentFile(e,"opened")}onFileChange(e){e instanceof f.TFile&&this.recordRecentFile(e,"changed",this.isBackgroundChange(e))}isBackgroundChange(e){var i;if(((i=this.app.workspace.getActiveFile())==null?void 0:i.path)===e.path)return!1;let n=this.previouslyActive;return!(n&&n.path===e.path&&Date.now()r.path===e.path),a=n==="changed"&&t!==void 0&&this.recentFiles[0]===t&&W(this.recentFiles,"changed")[0]===t&&!(i&&!t.changedInBackground);t||(t={path:e.path,basename:e.basename},this.recentFiles.push(t)),n==="opened"?(t.openedAt=Date.now(),delete t.changedInBackground):(t.changedAt=Date.now(),i&&(t.changedInBackground=!0)),this.recentFiles=K(this.recentFiles,this.settings.recentFiles.maxItems),this.persistRecentFiles(),a||this.broadcastRedraw()}isOmittedFromRecentFiles(e){for(let r of this.settings.recentFiles.omittedPaths)try{if(new RegExp(r).test(e.path))return!0}catch(s){}let n=this.settings.recentFiles.omittedTags;if(n.length===0)return!1;let i=this.app.metadataCache.getFileCache(e),t=(i?(0,f.getAllTags)(i):null)||[];if(t.length===0)return!1;let a=t.map(r=>r.replace(/^#/,""));for(let r of n)try{let s=new RegExp(r);if(a.some(o=>s.test(o)))return!0}catch(s){}return!1}onRename(e,n){this.invalidateDateSystemIndicators();let i=this.syncIndexForRename(e,n),t=!1;for(let r of this.recentFiles){let s=oe(r.path,n,e.path);s!==null&&(r.path=s,r.basename=ve(s),t=!0)}let a=r=>{for(let s of r){if(s.filePath){let o=oe(s.filePath,n,e.path);o!==null&&(s.filePath=o,t=!0)}s.children&&a(s.children)}};a(this.waypointData.bookmarks),t&&(this.waypointData.recentFiles=this.recentFiles,this.persistAll()),(t||i)&&this.broadcastRedraw()}onVaultCreate(e){e instanceof f.TFile&&e.extension==="md"&&(this.markdownBasenames.add(e.basename),this.invalidateDateSystemIndicators()),this.app.workspace.layoutReady&&this.onFileChange(e),this.broadcastRedraw()}onVaultDelete(e){e instanceof f.TFile&&e.extension==="md"&&(this.removeFromMarkdownIndex(e.basename,e.path),this.invalidateDateSystemIndicators()),this.broadcastRedraw()}buildMarkdownIndex(){this.markdownBasenames.clear();for(let e of this.app.vault.getMarkdownFiles())this.markdownBasenames.add(e.basename)}invalidateDateSystemIndicators(){this.dateSystemIndicators=null,this.dateSystemIndicatorKey=""}removeFromMarkdownIndex(e,n){return!this.markdownBasenames.has(e)||this.app.vault.getMarkdownFiles().some(t=>t.basename===e&&t.path!==n)?!1:(this.markdownBasenames.delete(e),!0)}syncIndexForRename(e,n){if(!(e instanceof f.TFile))return!1;let i=!1,t=ve(n);return n.toLowerCase().endsWith(".md")&&(t!==e.basename||e.extension!=="md")&&(i=this.removeFromMarkdownIndex(t,n)),e.extension==="md"&&!this.markdownBasenames.has(e.basename)&&(this.markdownBasenames.add(e.basename),i=!0),i}hasNoteForDate(e){return this.markdownBasenames.has(e)}addBookmark(e,n,i="file",t=""){let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:i,label:n,filePath:i==="file"?e:"",icon:t,children:[],collapsed:!1,indent:0};return this.waypointData.bookmarks.push(r),this.saveWaypointData(),this.broadcastRedraw(),r}removeBookmark(e){let n=i=>{let t=i.findIndex(a=>a.id===e);if(t>=0)return i.splice(t,1),!0;for(let a of i)if(a.children&&n(a.children))return!0;return!1};n(this.waypointData.bookmarks),this.saveWaypointData(),this.broadcastRedraw()}updateBookmark(e,n){let i=a=>{for(let r of a){if(r.id===e)return r;if(r.children){let s=i(r.children);if(s)return s}}return null},t=i(this.waypointData.bookmarks);t&&(Object.assign(t,n),this.saveWaypointData(),this.broadcastRedraw())}periodAsDateSystem(e){let n=te[e],i=this.settings[n.key];return{id:n.key,name:n.label,folder:i.folder,nameFormat:i.nameFormat,templateFile:i.templateFile,typeProperty:i.typeProperty,icon:"calendar",indicatorColor:this.settings.calendar.dailyIndicatorColor}}dateSystems(){return[this.periodAsDateSystem("day"),...this.settings.dateSystems]}findDateSystemNotes(e){let n=this.dateSystems().map(i=>{let t=q(i.nameFormat);return{result:{system:i,notes:[],multiple:t.hasTitle},before:V(e,t.before),after:V(e,t.after),hasTitle:t.hasTitle,skip:!$(i.nameFormat)}});for(let i of this.app.vault.getMarkdownFiles())for(let t of n){if(t.skip)continue;let a=t.result.system;ae(i.path,a.folder)&&se(i.basename,t.before,t.after,t.hasTitle)&&t.result.notes.push({file:i,label:t.hasTitle?ue(i.basename,t.before,t.after):a.name})}for(let i of n)i.result.notes.sort((t,a)=>t.file.basename.localeCompare(a.file.basename));return n.filter(i=>!i.skip).map(i=>i.result)}getDateSystemIndicators(e){var s;let n=e.map(o=>o.format("YYYY-MM-DD")),i=this.dateSystems().filter(o=>$(o.nameFormat)).map(o=>{let l=q(o.nameFormat);return{system:o,hasTitle:l.hasTitle,dates:e.map((p,u)=>({dateStr:n[u],before:V(p,l.before),after:V(p,l.after)}))}}),t=JSON.stringify({dates:n,systems:i.map(({system:o})=>[o.id,o.name,o.folder,o.nameFormat,o.indicatorColor])});if(this.dateSystemIndicators&&this.dateSystemIndicatorKey===t)return this.dateSystemIndicators;let a=new Map;for(let o of n)a.set(o,new Set);for(let o of this.app.vault.getMarkdownFiles())for(let l of i)if(ae(o.path,l.system.folder))for(let p of l.dates)se(o.basename,p.before,p.after,l.hasTitle)&&((s=a.get(p.dateStr))==null||s.add(l.system.id));let r=new Map;for(let o of n){let l=a.get(o);r.set(o,i.filter(({system:p})=>l==null?void 0:l.has(p.id)).map(({system:p})=>({id:p.id,name:p.name,color:p.indicatorColor})))}return this.dateSystemIndicatorKey=t,this.dateSystemIndicators=r,r}async openDateSystemNote(e,n,i){if(!$(e.nameFormat)){new f.Notice(`Waypoint: ${e.name||"This"} name format needs a date placeholder.`);return}let t=q(e.nameFormat),a=V(n,t.before),r=V(n,t.after),s;if(t.hasTitle){let u=ge((i==null?void 0:i.title)||"");if(!u){new f.Notice(`Waypoint: a ${e.name.toLowerCase()} note needs a title.`);return}s=a+u+r}else s=a+r;let o=e.folder?`${e.folder}/${s}.md`:`${s}.md`,l=this.app.vault.getFileByPath(o);if(!l&&(l=await this.createDatedNote(o,e,n),!l))return;if(i!=null&&i.reuseExistingLeaf&&!i.leaf){let u=this.app.workspace.getLeavesOfType("markdown").find(D=>{var S;return((S=D.getViewState().state)==null?void 0:S.file)===l.path});if(u){await this.app.workspace.revealLeaf(u),this.app.workspace.setActiveLeaf(u,{focus:!0});return}}await((i==null?void 0:i.leaf)||this.app.workspace.getLeaf(!1)).openFile(l)}async openPeriodNote(e,n,i){await this.openDateSystemNote(this.periodAsDateSystem(e),n,{leaf:i,reuseExistingLeaf:this.settings.reusePeriodicNoteTabs})}async createDatedNote(e,n,i){let t=n.name.toLowerCase(),a=e.lastIndexOf("/"),r=a<0?"":e.slice(0,a);try{await this.ensureFolderExists(r)}catch(u){return new f.Notice(`Waypoint: could not create the folder "${r}" for the ${t} note. -${re(u)} -Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,j),null}let s=n.templateFile,o=this.resolveTemplateFile(s),l;if(o)try{l=await this.app.vault.read(o)}catch(u){return new f.Notice(`Waypoint: could not read the template "${o.path}" for the ${t} note. -`+re(u),j),null}else l=`--- +`).filter(i=>i.trim()),this.saveAndRefresh()}}),this.renderRecentTypes(e)}renderRecentTypes(e){let n=this.settings.recentFiles.types;new f.Setting(e).setHeading().setName("File types").setDesc("Frontmatter `type` values. A type's icon shows beside matching recent files."),n.forEach((a,t)=>{new f.Setting(e).addText(i=>{i.setPlaceholder("meeting"),i.setValue(a.type),i.inputEl.onblur=()=>{let r=i.getValue().trim();r!==a.type&&(a.type=r,this.saveAndRefresh())}}).addExtraButton(i=>{i.setIcon(a.icon||"image-off").setTooltip(a.icon?`Icon: ${a.icon}`:"Choose icon").onClick(()=>{new H(this.app,a.icon,r=>{a.icon=r,this.saveAndRefresh(),this.display()}).open()})}).addExtraButton(i=>{i.setIcon("trash").setTooltip("Remove this type").onClick(()=>{n.splice(t,1),this.saveAndRefresh(),this.display()})})}),new f.Setting(e).addButton(a=>{a.setButtonText("Add type").onClick(()=>{n.push({type:"",icon:""}),this.display()})})}renderDisplayTab(e){new f.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new f.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new f.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...M.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,a,t,i,r,s,o,l){let p=new f.Setting(e).setName(n).setDesc(`${a} (${t[i]}${l})`);p.addSlider(u=>{u.setLimits(r,s,o).setValue(t[i]).setDynamicTooltip().onChange(D=>{t[i]=D,p.setDesc(`${a} (${D}${l})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,a=e.createDiv();a.style.display="flex",a.style.alignItems="center",a.style.gap="12px",a.style.marginBottom="16px";let t=a.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,f.setIcon)(t,"compass");let i=a.createDiv(),r=i.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=i.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let o=e.createDiv();o.style.marginBottom="20px",o.style.lineHeight="1.6",o.style.color="var(--text-normal)",o.innerHTML=["

Waypoint is a sidebar plugin that brings three essential panels into one view:

",'
    ',"
  • Calendar \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.
  • ","
  • Recent Files \u2014 a list of recently opened and changed files with type icons, drag-and-drop, and right-click actions.
  • ","
  • Bookmarks \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.
  • ","
",'

Made by Olivier. Licensed under MIT.

'].join(` +`)}};var J=require("obsidian"),Z=class extends J.Modal{constructor(e,n,a){super(e);this.initialDate=n;this.onSubmit=a}onOpen(){this.titleEl.setText("Open date");let e=this.contentEl.createEl("input",{type:"date",value:this.initialDate.format("YYYY-MM-DD")});e.style.width="100%",e.style.marginBottom="12px",e.focus();let n=()=>{let t=(0,J.moment)(e.value,"YYYY-MM-DD",!0);t.isValid()&&(this.close(),this.onSubmit(t))};e.addEventListener("keydown",t=>{t.key==="Enter"&&n()});let a=this.contentEl.createDiv({cls:"modal-button-container"});a.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close()),a.createEl("button",{text:"Open",cls:"mod-cta"}).addEventListener("click",n)}onClose(){this.contentEl.empty()}};function se(c,d,e){return!c||!d?null:c===d?e:c.startsWith(d+"/")?e+c.slice(d.length):null}var ee=class extends y.Plugin{constructor(){super(...arguments);this.recentFiles=[];this.savePromise=Promise.resolve();this.markdownBasenames=new Set;this.dateSystemIndicators=null;this.dateSystemIndicatorKey="";this.indicatorModeMigrated=!1;this.previouslyActive=null;this.activePath=null}async onload(){console.debug("Waypoint: loading plugin v"+this.manifest.version);let e=await this.loadData(),n=this.applySettings(e);this.applyWaypointData(e),n&&this.persistAll(),this.registerView(E,s=>new O(s,this)),this.addSettingTab(new U(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.invalidateDateSystemIndicators(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let s=this.app.workspace.getLeavesOfType(E);if(s.length>0)await this.app.workspace.revealLeaf(s[0]);else{let o=this.app.workspace.getLeftLeaf(!1);o&&(await o.setViewState({type:E}),await this.app.workspace.revealLeaf(o))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let s=this.app.workspace.getActiveFile();if(!s){new y.Notice("No active file");return}this.addBookmark(s.path,s.basename,"file"),new y.Notice(`Bookmarked: ${s.basename}`)}}),this.addCommand({id:"waypoint-go-to-daily",name:"Go to daily note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"d"}],callback:async()=>{await this.openPeriodNote("day",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-weekly",name:"Go to weekly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"w"}],callback:async()=>{await this.openPeriodNote("week",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-monthly",name:"Go to monthly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"m"}],callback:async()=>{await this.openPeriodNote("month",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-quarterly",name:"Go to quarterly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"q"}],callback:async()=>{await this.openPeriodNote("quarter",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-yearly",name:"Go to yearly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"y"}],callback:async()=>{await this.openPeriodNote("year",(0,y.moment)())}}),this.addCommand({id:"waypoint-open-date",name:"Open daily note for a date\u2026",callback:()=>{new Z(this.app,(0,y.moment)(),s=>{this.showDateInViews(s),this.openPeriodNote("day",s)}).open()}});let a=["next","prev"],t=["daily","weekly","monthly","quarterly","yearly"],i={next:"Next",prev:"Previous"};for(let s of t)for(let o of a){let l=`waypoint-go-to-${o}-${s}`,p=`${i[o]} ${s} note`;this.addCommand({id:l,name:p,callback:async()=>{await this.navigatePeriodNote(o)}})}this.registerEvent(this.app.workspace.on("file-open",s=>{s&&this.onFileOpen(s)})),this.registerEvent(this.app.vault.on("create",s=>this.onVaultCreate(s))),this.registerEvent(this.app.vault.on("delete",s=>this.onVaultDelete(s))),this.registerEvent(this.app.vault.on("rename",(s,o)=>this.onRename(s,o))),this.registerEvent(this.app.vault.on("modify",s=>this.onFileChange(s))),this.app.workspace.onLayoutReady(()=>{if(this.buildMarkdownIndex(),this.app.workspace.getLeavesOfType(E).length===0){let o=this.app.workspace.getLeftLeaf(!1);o&&o.setViewState({type:E})}else this.broadcastRedraw()});let r=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let s=new Date().toDateString();s!==r&&(r=s,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(E)}applySettings(e){var r,s;let n=(e==null?void 0:e.settings)||{};this.settings=Object.assign({},M,n),this.settings.recentFiles=Object.assign({},M.recentFiles,n.recentFiles||{});let a=this.settings.recentFiles;this.settings.recentFiles.types=Array.isArray((r=n.recentFiles)==null?void 0:r.types)?n.recentFiles.types.map(o=>({...o})):[],delete a.filterTags,delete a.showTypeFilter,delete a.updateOn,this.settings.calendar=Object.assign({},M.calendar,n.calendar||{}),this.settings.display=Object.assign({},M.display,n.display||{});for(let o of Ce)this.settings[o]=Object.assign({},M[o],n[o]||{});this.settings.dateSystems=Array.isArray(n.dateSystems)?n.dateSystems.map(o=>{let l=M.dateSystems.find(p=>p.id===o.id);return Object.assign({},l||G,o)}):M.dateSystems.map(o=>Object.assign({},o));let t=(e==null?void 0:e.indicatorModeMigrated)===!0,i=!1;return!t&&((s=n.calendar)==null?void 0:s.indicatorMode)==="any"&&(this.settings.calendar.indicatorMode="systems",i=!0),this.indicatorModeMigrated=!0,i}applyWaypointData(e){var r,s;let n=(e==null?void 0:e.waypointData)||{};this.waypointData={bookmarks:Array.isArray(n.bookmarks)?n.bookmarks:[],recentFiles:Array.isArray(n.recentFiles)?n.recentFiles:[]};let t=((s=(r=e==null?void 0:e.settings)==null?void 0:r.recentFiles)==null?void 0:s.updateOn)==="file-edit"?"changedAt":"openedAt",i=this.waypointData.recentFiles.length;this.recentFiles=j(this.waypointData.recentFiles.map((o,l)=>o.openedAt===void 0&&o.changedAt===void 0?{...o,[t]:i-l}:o),this.settings.recentFiles.maxItems),this.waypointData.recentFiles=this.recentFiles}persistAll(){let e=this.savePromise.then(()=>(this.waypointData.recentFiles=this.recentFiles,this.saveData({settings:this.settings,waypointData:this.waypointData,indicatorModeMigrated:this.indicatorModeMigrated})));return this.savePromise=e.catch(()=>{}),e}async saveSettings(){await this.persistAll()}async saveWaypointData(){await this.persistAll()}enforceRecentFilesLimit(){let e=j(this.recentFiles,this.settings.recentFiles.maxItems);e.length!==this.recentFiles.length&&(this.recentFiles=e,this.persistRecentFiles())}persistRecentFiles(){this.waypointData.recentFiles=this.recentFiles,window.clearTimeout(this.recentFilesSaveTimer),this.recentFilesSaveTimer=window.setTimeout(()=>{this.saveWaypointData()},300)}onFileOpen(e){this.activePath&&this.activePath!==e.path&&(this.previouslyActive={path:this.activePath,until:Date.now()+Le}),this.activePath=e.path,this.recordRecentFile(e,"opened")}onFileChange(e){e instanceof y.TFile&&this.recordRecentFile(e,"changed",this.isBackgroundChange(e))}isBackgroundChange(e){var a;if(((a=this.app.workspace.getActiveFile())==null?void 0:a.path)===e.path)return!1;let n=this.previouslyActive;return!(n&&n.path===e.path&&Date.now()r.path===e.path),i=n==="changed"&&t!==void 0&&this.recentFiles[0]===t&&R(this.recentFiles,"changed")[0]===t&&!(a&&!t.changedInBackground);t||(t={path:e.path,basename:e.basename},this.recentFiles.push(t)),n==="opened"?(t.openedAt=Date.now(),delete t.changedInBackground):(t.changedAt=Date.now(),a&&(t.changedInBackground=!0)),this.recentFiles=j(this.recentFiles,this.settings.recentFiles.maxItems),this.persistRecentFiles(),i||this.broadcastRedraw()}isOmittedFromRecentFiles(e){for(let r of this.settings.recentFiles.omittedPaths)try{if(new RegExp(r).test(e.path))return!0}catch(s){}let n=this.settings.recentFiles.omittedTags;if(n.length===0)return!1;let a=this.app.metadataCache.getFileCache(e),t=(a?(0,y.getAllTags)(a):null)||[];if(t.length===0)return!1;let i=t.map(r=>r.replace(/^#/,""));for(let r of n)try{let s=new RegExp(r);if(i.some(o=>s.test(o)))return!0}catch(s){}return!1}onRename(e,n){this.invalidateDateSystemIndicators();let a=this.syncIndexForRename(e,n),t=!1;for(let r of this.recentFiles){let s=se(r.path,n,e.path);s!==null&&(r.path=s,r.basename=ve(s),t=!0)}let i=r=>{for(let s of r){if(s.filePath){let o=se(s.filePath,n,e.path);o!==null&&(s.filePath=o,t=!0)}s.children&&i(s.children)}};i(this.waypointData.bookmarks),t&&(this.waypointData.recentFiles=this.recentFiles,this.persistAll()),(t||a)&&this.broadcastRedraw()}onVaultCreate(e){e instanceof y.TFile&&e.extension==="md"&&(this.markdownBasenames.add(e.basename),this.invalidateDateSystemIndicators()),this.app.workspace.layoutReady&&this.onFileChange(e),this.broadcastRedraw()}onVaultDelete(e){e instanceof y.TFile&&e.extension==="md"&&(this.removeFromMarkdownIndex(e.basename,e.path),this.invalidateDateSystemIndicators()),this.broadcastRedraw()}buildMarkdownIndex(){this.markdownBasenames.clear();for(let e of this.app.vault.getMarkdownFiles())this.markdownBasenames.add(e.basename)}invalidateDateSystemIndicators(){this.dateSystemIndicators=null,this.dateSystemIndicatorKey=""}removeFromMarkdownIndex(e,n){return!this.markdownBasenames.has(e)||this.app.vault.getMarkdownFiles().some(t=>t.basename===e&&t.path!==n)?!1:(this.markdownBasenames.delete(e),!0)}syncIndexForRename(e,n){if(!(e instanceof y.TFile))return!1;let a=!1,t=ve(n);return n.toLowerCase().endsWith(".md")&&(t!==e.basename||e.extension!=="md")&&(a=this.removeFromMarkdownIndex(t,n)),e.extension==="md"&&!this.markdownBasenames.has(e.basename)&&(this.markdownBasenames.add(e.basename),a=!0),a}hasNoteForDate(e){return this.markdownBasenames.has(e)}addBookmark(e,n,a="file",t=""){let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:a,label:n,filePath:a==="file"?e:"",icon:t,children:[],collapsed:!1,indent:0};return this.waypointData.bookmarks.push(r),this.saveWaypointData(),this.broadcastRedraw(),r}removeBookmark(e){let n=a=>{let t=a.findIndex(i=>i.id===e);if(t>=0)return a.splice(t,1),!0;for(let i of a)if(i.children&&n(i.children))return!0;return!1};n(this.waypointData.bookmarks),this.saveWaypointData(),this.broadcastRedraw()}updateBookmark(e,n){let a=i=>{for(let r of i){if(r.id===e)return r;if(r.children){let s=a(r.children);if(s)return s}}return null},t=a(this.waypointData.bookmarks);t&&(Object.assign(t,n),this.saveWaypointData(),this.broadcastRedraw())}periodAsDateSystem(e){let n=X[e],a=this.settings[n.key];return{id:n.key,name:n.label,folder:a.folder,nameFormat:a.nameFormat,templateFile:a.templateFile,typeProperty:a.typeProperty,icon:"calendar",indicatorColor:this.settings.calendar.dailyIndicatorColor}}dateSystems(){return[this.periodAsDateSystem("day"),...this.settings.dateSystems]}findDateSystemNotes(e){let n=this.dateSystems().map(a=>{let t=V(a.nameFormat);return{result:{system:a,notes:[],multiple:t.hasTitle},before:$(e,t.before),after:$(e,t.after),hasTitle:t.hasTitle,skip:!W(a.nameFormat)}});for(let a of this.app.vault.getMarkdownFiles())for(let t of n){if(t.skip)continue;let i=t.result.system;ae(a.path,i.folder)&&ie(a.basename,t.before,t.after,t.hasTitle)&&t.result.notes.push({file:a,label:t.hasTitle?ue(a.basename,t.before,t.after):i.name})}for(let a of n)a.result.notes.sort((t,i)=>t.file.basename.localeCompare(i.file.basename));return n.filter(a=>!a.skip).map(a=>a.result)}getDateSystemIndicators(e){var s;let n=e.map(o=>o.format("YYYY-MM-DD")),a=this.dateSystems().filter(o=>W(o.nameFormat)).map(o=>{let l=V(o.nameFormat);return{system:o,hasTitle:l.hasTitle,dates:e.map((p,u)=>({dateStr:n[u],before:$(p,l.before),after:$(p,l.after)}))}}),t=JSON.stringify({dates:n,systems:a.map(({system:o})=>[o.id,o.name,o.folder,o.nameFormat,o.indicatorColor])});if(this.dateSystemIndicators&&this.dateSystemIndicatorKey===t)return this.dateSystemIndicators;let i=new Map;for(let o of n)i.set(o,new Set);for(let o of this.app.vault.getMarkdownFiles())for(let l of a)if(ae(o.path,l.system.folder))for(let p of l.dates)ie(o.basename,p.before,p.after,l.hasTitle)&&((s=i.get(p.dateStr))==null||s.add(l.system.id));let r=new Map;for(let o of n){let l=i.get(o);r.set(o,a.filter(({system:p})=>l==null?void 0:l.has(p.id)).map(({system:p})=>({id:p.id,name:p.name,color:p.indicatorColor})))}return this.dateSystemIndicatorKey=t,this.dateSystemIndicators=r,r}async openDateSystemNote(e,n,a){if(!W(e.nameFormat)){new y.Notice(`Waypoint: ${e.name||"This"} name format needs a date placeholder.`);return}let t=V(e.nameFormat),i=$(n,t.before),r=$(n,t.after),s;if(t.hasTitle){let u=ge((a==null?void 0:a.title)||"");if(!u){new y.Notice(`Waypoint: a ${e.name.toLowerCase()} note needs a title.`);return}s=i+u+r}else s=i+r;let o=e.folder?`${e.folder}/${s}.md`:`${s}.md`,l=this.app.vault.getFileByPath(o);if(!l&&(l=await this.createDatedNote(o,e,n),!l))return;if(a!=null&&a.reuseExistingLeaf&&!a.leaf){let u=this.app.workspace.getLeavesOfType("markdown").find(D=>{var S;return((S=D.getViewState().state)==null?void 0:S.file)===l.path});if(u){await this.app.workspace.revealLeaf(u),this.app.workspace.setActiveLeaf(u,{focus:!0});return}}await((a==null?void 0:a.leaf)||this.app.workspace.getLeaf(!1)).openFile(l)}async openPeriodNote(e,n,a){await this.openDateSystemNote(this.periodAsDateSystem(e),n,{leaf:a,reuseExistingLeaf:this.settings.reusePeriodicNoteTabs})}async createDatedNote(e,n,a){let t=n.name.toLowerCase(),i=e.lastIndexOf("/"),r=i<0?"":e.slice(0,i);try{await this.ensureFolderExists(r)}catch(u){return new y.Notice(`Waypoint: could not create the folder "${r}" for the ${t} note. +${oe(u)} +Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,q),null}let s=n.templateFile,o=this.resolveTemplateFile(s),l;if(o)try{l=await this.app.vault.read(o)}catch(u){return new y.Notice(`Waypoint: could not read the template "${o.path}" for the ${t} note. +`+oe(u),q),null}else l=`--- type: ${n.typeProperty} -date: ${i.format("YYYY-MM-DD")} +date: ${a.format("YYYY-MM-DD")} --- -`;let p;try{p=await this.app.vault.create(e,l)}catch(u){return new f.Notice(`Waypoint: could not create the ${t} note at "${e}". -${re(u)}`,j),null}return s&&!o?new f.Notice(`Created ${t} note: ${p.basename} -Template "${s}" was not found, so a basic note was created instead.`,j):new f.Notice(`Created ${t} note: ${p.basename}`),p}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof f.TFolder)return;let n="";for(let i of e.split("/"))if(i&&(n=n?`${n}/${i}`:i,!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of fe){let i=this.settings[te[n].key].nameFormat;if(!i)continue;let t=(0,f.moment)(e,i,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new f.Notice("No active file");return}let i=this.detectPeriodType(n.basename);if(!i){let o=fe.map(l=>`${te[l].label.toLowerCase()} "${this.settings[te[l].key].nameFormat}"`).join(", ");new f.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format. -Expected one of: ${o}.`,j);return}let{period:t,date:a}=i,r=e==="next"?1:-1,s=t==="quarter"?a.clone().add(r*3,"months"):a.clone().add(r,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof z&&n.view.redraw()}showDateInViews(e){for(let n of this.app.workspace.getLeavesOfType(E))n.view instanceof z&&n.view.showDate(e)}},Ce=["daily","weekly","monthly","quarterly","yearly"],te={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},fe=["day","week","month","quarter","year"];function ve(c){return c.slice(c.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var j=1e4,Le=5e3;function re(c){return c instanceof Error?c.message:String(c)}function V(c,d){return d?c.format(d):""} +`;let p;try{p=await this.app.vault.create(e,l)}catch(u){return new y.Notice(`Waypoint: could not create the ${t} note at "${e}". +${oe(u)}`,q),null}return s&&!o?new y.Notice(`Created ${t} note: ${p.basename} +Template "${s}" was not found, so a basic note was created instead.`,q):new y.Notice(`Created ${t} note: ${p.basename}`),p}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof y.TFolder)return;let n="";for(let a of e.split("/"))if(a&&(n=n?`${n}/${a}`:a,!(this.app.vault.getAbstractFileByPath(n)instanceof y.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof y.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of fe){let a=this.settings[X[n].key].nameFormat;if(!a)continue;let t=(0,y.moment)(e,a,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new y.Notice("No active file");return}let a=this.detectPeriodType(n.basename);if(!a){let o=fe.map(l=>`${X[l].label.toLowerCase()} "${this.settings[X[l].key].nameFormat}"`).join(", ");new y.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format. +Expected one of: ${o}.`,q);return}let{period:t,date:i}=a,r=e==="next"?1:-1,s=t==="quarter"?i.clone().add(r*3,"months"):i.clone().add(r,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof O&&n.view.redraw()}showDateInViews(e){for(let n of this.app.workspace.getLeavesOfType(E))n.view instanceof O&&n.view.showDate(e)}},Ce=["daily","weekly","monthly","quarterly","yearly"],X={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},fe=["day","week","month","quarter","year"];function ve(c){return c.slice(c.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var q=1e4,Le=5e3;function oe(c){return c instanceof Error?c.message:String(c)}function $(c,d){return d?c.format(d):""} diff --git a/manifest.json b/manifest.json index 8e8d68a..4c1644d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "waypoint-sidebar", "name": "Waypoint Sidebar", - "version": "1.9.1", + "version": "1.10.0", "minAppVersion": "1.4.10", "description": "Calendar, recent files, and custom bookmarks sidebar.", "author": "Olivier", diff --git a/package.json b/package.json index 0189a4b..537ff34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "waypoint", - "version": "1.9.1", + "version": "1.10.0", "description": "Calendar, recent files, and custom bookmarks sidebar.", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 65763e6..6f79820 100644 --- a/src/main.ts +++ b/src/main.ts @@ -285,13 +285,15 @@ export default class WaypointPlugin extends Plugin { const s = (saved?.settings || {}) as Partial; this.settings = Object.assign({}, DEFAULT_SETTINGS, s); this.settings.recentFiles = Object.assign({}, DEFAULT_SETTINGS.recentFiles, s.recentFiles || {}); - // `filterTags` (pill names only) became `types` (name + icon), and the - // single `updateOn` mode became the header filter `show`. - const legacyRecent = this.settings.recentFiles as Partial<{ filterTags: string[]; updateOn: string }>; + // Drop keys of removed features: the old type filter (`filterTags`, + // then `showTypeFilter`) and the single `updateOn` mode, now the header + // filter `show`. + const legacyRecent = this.settings.recentFiles as Partial<{ filterTags: string[]; showTypeFilter: boolean; updateOn: string }>; this.settings.recentFiles.types = Array.isArray(s.recentFiles?.types) ? s.recentFiles.types.map(t => ({ ...t })) - : (legacyRecent.filterTags ?? []).map(type => ({ type, icon: '' })); + : []; delete legacyRecent.filterTags; + delete legacyRecent.showTypeFilter; delete legacyRecent.updateOn; this.settings.calendar = Object.assign({}, DEFAULT_SETTINGS.calendar, s.calendar || {}); this.settings.display = Object.assign({}, DEFAULT_SETTINGS.display, s.display || {}); diff --git a/src/settings-tab.ts b/src/settings-tab.ts index 72be1dd..627c7e9 100644 --- a/src/settings-tab.ts +++ b/src/settings-tab.ts @@ -426,29 +426,17 @@ export class WaypointSettingTab extends PluginSettingTab { }; }); - new Setting(container) - .setName('Type filter') - .setDesc('Show pills above the list to filter recent files by their frontmatter `type`.') - .addToggle((toggle) => { - toggle - .setValue(this.settings.recentFiles.showTypeFilter) - .onChange((value) => { - this.settings.recentFiles.showTypeFilter = value; - this.saveAndRefresh(); - }); - }); - this.renderRecentTypes(container); } - /** Frontmatter types with an icon each; also the pill list when the type filter is on. */ + /** Frontmatter types with an icon each. */ private renderRecentTypes(container: HTMLElement): void { const types = this.settings.recentFiles.types; new Setting(container) .setHeading() .setName('File types') - .setDesc('Frontmatter `type` values. A type\'s icon shows beside matching recent files. With the type filter on, these types are the pills, in this order; with no types listed, pills are detected automatically.'); + .setDesc('Frontmatter `type` values. A type\'s icon shows beside matching recent files.'); types.forEach((entry, i) => { new Setting(container) @@ -618,7 +606,7 @@ export class WaypointSettingTab extends PluginSettingTab { `

Waypoint is a sidebar plugin that brings three essential panels into one view:

`, `
    `, `
  • Calendar — a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.
  • `, - `
  • Recent Files — a list of recently opened files with type filtering, drag-and-drop, and right-click actions.
  • `, + `
  • Recent Files — a list of recently opened and changed files with type icons, drag-and-drop, and right-click actions.
  • `, `
  • Bookmarks — custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.
  • `, `
`, `

Made by Olivier. Licensed under MIT.

`, diff --git a/src/settings.ts b/src/settings.ts index 3a7113c..c0f1c0d 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -53,7 +53,7 @@ export interface CalendarSettings { dailyIndicatorColor: string; } -/** A frontmatter `type` value: its icon in Recent Files and, when the type filter is on, a pill. */ +/** A frontmatter `type` value and its icon in Recent Files. */ export interface RecentFileType { type: string; /** Lucide icon name; empty for none. */ @@ -67,9 +67,7 @@ export interface RecentFilesSettings { show: RecentFilesShow; omittedPaths: string[]; omittedTags: string[]; - /** Type pills above the list. */ - showTypeFilter: boolean; - /** Configured types, in pill order; empty = pills auto-detected from frontmatter. */ + /** Frontmatter types with an icon each. */ types: RecentFileType[]; } @@ -162,7 +160,6 @@ export const DEFAULT_SETTINGS: WaypointSettings = { show: 'all', omittedPaths: [], omittedTags: [], - showTypeFilter: true, types: [], }, display: { diff --git a/src/views/waypoint-view.ts b/src/views/waypoint-view.ts index 73d6ff6..94f9cac 100644 --- a/src/views/waypoint-view.ts +++ b/src/views/waypoint-view.ts @@ -90,7 +90,6 @@ export class WaypointView extends ItemView { private currentDisplayYear: number = moment().year(); private dragId: string | null = null; private dropZones = new WeakMap(); - private recentFilesFilter: string | null = null; // null = show all, else filter by type /** Day picked with the date picker or the "Open date" command; cleared by month navigation. */ private selectedDate: moment.Moment | null = null; @@ -113,7 +112,7 @@ export class WaypointView extends ItemView { // ── Top row: breadcrumb + today nav ── const topRow = cal.createDiv({ cls: 'waypoint-calendar-top' }); - // Left: Q2 · June · 2026 + // Left: Q2 · Jun · 2026 const breadcrumb = topRow.createDiv({ cls: 'waypoint-calendar-breadcrumb' }); const qLabel = displayDate.format('[Q]Q'); @@ -128,7 +127,7 @@ export class WaypointView extends ItemView { } }); - const mLabel = displayDate.format('MMMM'); + const mLabel = displayDate.clone().locale('en').format('MMM'); const mEl = breadcrumb.createSpan({ cls: 'waypoint-clickable', text: mLabel }); mEl.addEventListener('click', () => { this.plugin.openPeriodNote('month', displayDate); @@ -200,7 +199,7 @@ export class WaypointView extends ItemView { // Week number column header (blank) headerRow.createEl('th', { text: '' }); - const dayNames = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; + const dayNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S']; const firstDay = this.plugin.settings.calendar.firstDayOfWeek; for (let i = 0; i < 7; i++) { const idx = (firstDay + i) % 7; @@ -417,47 +416,8 @@ export class WaypointView extends ItemView { return typeof type === 'string' ? type : null; }; - // ── Type filter bar ── // Rows still being typed in settings have no name yet. const types = settings.types.filter(t => t.type); - if (!settings.showTypeFilter) { - this.recentFilesFilter = null; - } else { - const typeCounts = new Map(); - // Configured types keep their order and show even at 0; otherwise - // every frontmatter type present is a pill, most frequent first. - for (const t of types) typeCounts.set(t.type, 0); - for (const file of shownFiles) { - const type = typeOf(file.path); - if (type === null) continue; - if (types.length > 0 && !typeCounts.has(type)) continue; - typeCounts.set(type, (typeCounts.get(type) ?? 0) + 1); - } - - if (typeCounts.size > 0) { - const filterBar = section.createDiv({ cls: 'waypoint-recent-filter' }); - const allPill = filterBar.createSpan({ cls: `waypoint-recent-pill${!this.recentFilesFilter ? ' is-active' : ''}`, text: 'all' }); - allPill.addEventListener('click', () => { - this.recentFilesFilter = null; - this.redraw(); - }); - const entries = [...typeCounts.entries()]; - if (types.length === 0) entries.sort((a, b) => b[1] - a[1]); - for (const [type, count] of entries) { - const pill = filterBar.createSpan({ cls: `waypoint-recent-pill${this.recentFilesFilter === type ? ' is-active' : ''}` }); - pill.setText(`${type} ${count}`); - pill.addEventListener('click', () => { - this.recentFilesFilter = this.recentFilesFilter === type ? null : type; - this.redraw(); - }); - } - } - } - - // ── Filter the file list ── - const filteredFiles = this.recentFilesFilter - ? shownFiles.filter(file => typeOf(file.path) === this.recentFilesFilter) - : shownFiles; // Type icons. Every row reserves the icon slot once any type has an // icon, so names stay aligned. @@ -468,7 +428,7 @@ export class WaypointView extends ItemView { const rootEl = section.createDiv({ cls: 'nav-folder mod-root' }); const childrenEl = rootEl.createDiv({ cls: 'nav-folder-children' }); - for (const file of filteredFiles) { + for (const file of shownFiles) { const navFile = childrenEl.createDiv({ cls: 'tree-item nav-file' }); const navFileTitle = navFile.createDiv({ cls: 'tree-item-self is-clickable nav-file-title' }); if (reserveIcon) { diff --git a/styles.css b/styles.css index 2259b91..61be87c 100644 --- a/styles.css +++ b/styles.css @@ -280,34 +280,6 @@ /* ── Recent Files ── */ -.waypoint-recent-filter { - display: flex; - flex-wrap: wrap; - gap: 4px; - margin-bottom: 6px; -} - -.waypoint-recent-pill { - font-size: var(--font-ui-smaller); - color: var(--text-muted); - background: var(--background-modifier-hover); - padding: 1px 6px; - border-radius: 10px; - cursor: var(--cursor-link, pointer); - transition: color 80ms, background 80ms; - user-select: none; -} - -.waypoint-recent-pill:hover { - color: var(--text-normal); - background: var(--background-modifier-active-hover); -} - -.waypoint-recent-pill.is-active { - color: var(--text-on-accent); - background: var(--interactive-accent); -} - .waypoint-recent-files .nav-file { padding: 2px 0; }