diff --git a/main.js b/main.js
index 12d7020..610001b 100644
--- a/main.js
+++ b/main.js
@@ -2,21 +2,25 @@
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
*/
-var z=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var U=(b,u)=>{for(var t in u)z(b,t,{get:u[t],enumerable:!0})},X=(b,u,t,i)=>{if(u&&typeof u=="object"||typeof u=="function")for(let o of j(u))!Q.call(b,o)&&o!==t&&z(b,o,{get:()=>u[o],enumerable:!(i=H(u,o))||i.enumerable});return b};var K=b=>X(z({},"__esModule",{value:!0}),b);var ee={};U(ee,{default:()=>O});module.exports=K(ee);var f=require("obsidian");var W={calendar:{firstDayOfWeek:1,showNoteIndicators:!0},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},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"},recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var w=require("obsidian");var $=class extends w.PluginSettingTab{constructor(t,i,o,a){super(t,i);this.activeTab="calendar";this.plugin=i,this.settings=o,this.onSettingsChange=a}display(){let{containerEl:t}=this;t.empty();let i=t.createDiv({cls:"waypoint-settings-tabs"}),o=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let e of o)i.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===e.key?" is-active":""}`,text:e.label}).addEventListener("click",()=>{this.activeTab=e.key,this.display()});let a=t.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(a);break;case"periodic":this.renderPeriodicTab(a);break;case"recent":this.renderRecentTab(a);break;case"display":this.renderDisplayTab(a);break;case"about":this.renderAboutTab(a);break}}renderCalendarTab(t){new w.Setting(t).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(i=>{i.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(o=>{this.settings.calendar.firstDayOfWeek=parseInt(o,10),this.saveAndRefresh()})}),new w.Setting(t).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(i=>{i.setValue(this.settings.calendar.showNoteIndicators).onChange(o=>{this.settings.calendar.showNoteIndicators=o,this.saveAndRefresh()})})}renderPeriodicTab(t){this.addPeriodNoteSettings(t,"Daily",this.settings.daily),this.addPeriodNoteSettings(t,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(t,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(t,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(t,"Yearly",this.settings.yearly)}addPeriodNoteSettings(t,i,o){new w.Setting(t).setHeading().setName(i),new w.Setting(t).setName("Folder").setDesc(`Folder path for ${i.toLowerCase()} notes.`).addText(a=>{a.setPlaceholder("periodic/daily"),a.setValue(o.folder),a.onChange(e=>{o.folder=e,this.saveAndRefresh()})}),new w.Setting(t).setName("Name format").setDesc(`Date format for ${i.toLowerCase()} note filenames (moment.js format).`).addText(a=>{a.setPlaceholder("yyyy-MM-dd"),a.setValue(o.nameFormat),a.onChange(e=>{o.nameFormat=e,this.saveAndRefresh()})}),new w.Setting(t).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(a=>{a.setPlaceholder("Templates/Daily note"),a.setValue(o.templateFile),a.onChange(e=>{o.templateFile=e,this.saveAndRefresh()})}),new w.Setting(t).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(a=>{a.setPlaceholder("daily-note"),a.setValue(o.typeProperty),a.onChange(e=>{o.typeProperty=e,this.saveAndRefresh()})})}renderRecentTab(t){new w.Setting(t).setName("Max items").setDesc("Maximum number of recent files to track.").addText(a=>{a.inputEl.setAttr("type","number"),a.inputEl.setAttr("placeholder","50"),a.setValue(String(this.settings.recentFiles.maxItems)),a.inputEl.onblur=()=>{let e=parseInt(a.getValue(),10);!isNaN(e)&&e>0&&(this.settings.recentFiles.maxItems=e,this.saveAndRefresh())}}),new w.Setting(t).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(a=>{a.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(e=>{this.settings.recentFiles.updateOn=e,this.saveAndRefresh()})});let i=new DocumentFragment;i.appendText("Regex patterns for paths to exclude. One per line."),new w.Setting(t).setName("Omitted paths").setDesc(i).addTextArea(a=>{a.inputEl.setAttr("rows",4),a.setPlaceholder(`^archives/
-\\.png$`),a.setValue(this.settings.recentFiles.omittedPaths.join(`
-`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=a.getValue().split(`
-`).filter(e=>e.trim()),this.saveAndRefresh()}});let o=new DocumentFragment;o.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new w.Setting(t).setName("Omitted tags").setDesc(o).addTextArea(a=>{a.inputEl.setAttr("rows",4),a.setPlaceholder(`ignore
-archive`),a.setValue(this.settings.recentFiles.omittedTags.join(`
-`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=a.getValue().split(`
-`).filter(e=>e.trim()),this.saveAndRefresh()}})}renderDisplayTab(t){new w.Setting(t).setHeading().setName("Bookmarks"),this.addSliderSetting(t,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(t,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(t,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(t,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(t,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new w.Setting(t).setHeading().setName("Calendar"),this.addSliderSetting(t,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new w.Setting(t).addButton(i=>i.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...W.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(t,i,o,a,e,r,s,d,n){let l=new w.Setting(t).setName(i).setDesc(`${o} (${a[e]}${n})`);l.addSlider(c=>{c.setLimits(r,s,d).setValue(a[e]).setDynamicTooltip().onChange(h=>{a[e]=h,l.setDesc(`${o} (${h}${n})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(t){let i=this.plugin.manifest.version,o=t.createDiv();o.style.display="flex",o.style.alignItems="center",o.style.gap="12px",o.style.marginBottom="16px";let a=o.createDiv();a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.width="48px",a.style.height="48px",a.style.borderRadius="12px",a.style.background="var(--interactive-accent)",a.style.color="var(--text-on-accent)",a.style.fontSize="24px",(0,w.setIcon)(a,"compass");let e=o.createDiv(),r=e.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=e.createDiv({text:`v${i}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let d=t.createDiv();d.style.marginBottom="20px",d.style.lineHeight="1.6",d.style.color="var(--text-normal)",d.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 p=require("obsidian");var L=require("obsidian");function _(b,u,t){let i=(0,L.moment)({year:b,month:u,day:1}),o=(0,L.moment)(i).endOf("month"),a=(0,L.moment)(i).subtract((i.day()-t+7)%7,"days"),e=(0,L.moment)().startOf("day"),r=[],s=(0,L.moment)(a);for(;s.isBefore(o)||s.month()===u;){let d=[];for(let n=0;n<7;n++)d.push({date:(0,L.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(e,"day"),isCurrentMonth:s.month()===u,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:d[0].isoWeekNumber,days:d}),r.length>=6)break}return r}var P="waypoint-view",Y=class extends p.ItemView{constructor(t,i){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let t=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",t.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",t.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",t.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",t.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",t.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",t.calendarCellSize+"px"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,p.moment)().month();this.currentDisplayYear=(0,p.moment)().year();this.dragId=null;this.recentFilesFilter=null;this.plugin=i}getViewType(){return P}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let i=t.createDiv({cls:"waypoint-calendar"}),o=(0,p.moment)(),a=(0,p.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),e=i.createDiv({cls:"waypoint-calendar-top"}),r=e.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=a.format("[Q]Q"),d=r.createSpan({cls:"waypoint-clickable",text:s});d.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",a)}),d.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.plugin.openPeriodNoteInLeaf("quarter",a,this.app.workspace.getLeaf("tab")))});let n=a.format("MMMM"),l=r.createSpan({cls:"waypoint-clickable",text:n});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",a)}),l.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.plugin.openPeriodNoteInLeaf("month",a,this.app.workspace.getLeaf("tab")))});let c=a.format("YYYY"),h=r.createSpan({cls:"waypoint-clickable",text:c});h.addEventListener("click",()=>{this.plugin.openPeriodNote("year",a)}),h.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.plugin.openPeriodNoteInLeaf("year",a,this.app.workspace.getLeaf("tab")))});let m=e.createDiv({cls:"waypoint-calendar-today-group"}),g=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,p.setIcon)(g,"chevron-left"),g.addEventListener("click",()=>this.navigateMonth(-1)),m.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,p.moment)().month(),this.currentDisplayYear=(0,p.moment)().year(),this.redraw()});let C=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,p.setIcon)(C,"chevron-right"),C.addEventListener("click",()=>this.navigateMonth(1));let F=i.createEl("table"),T=F.createEl("thead").createEl("tr");T.createEl("th",{text:""});let k=["sun","mon","tue","wed","thu","fri","sat"],R=this.plugin.settings.calendar.firstDayOfWeek;for(let y=0;y<7;y++){let M=(R+y)%7;T.createEl("th",{text:k[M]})}let D=F.createEl("tbody"),E=_(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let y of E){let M=D.createEl("tr"),A=M.createEl("td",{cls:"waypoint-weeknum"});A.setText(String(y.weekNumber)),A.addEventListener("click",()=>{let x=y.days[0].date;this.plugin.openPeriodNote("week",x)}),A.addEventListener("mousedown",x=>{if(x.button===1){x.preventDefault();let I=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("week",monday,I)}});for(let x of y.days){let I=M.createEl("td",{cls:"waypoint-day"});if(I.setText(String(x.dayOfMonth)),x.isCurrentMonth||I.addClass("other-month"),x.isToday&&I.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let B=x.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(G=>G.extension==="md"&&G.basename===B)&&I.addClass("has-note")}I.addEventListener("click",()=>{this.plugin.openPeriodNote("day",x.date)}),I.addEventListener("mousedown",B=>{if(B.button===1){B.preventDefault();let S=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("day",x.date,S)}})}}}navigateMonth(t){let i=(0,p.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=i.month(),this.currentDisplayYear=i.year(),this.redraw()}renderRecentFiles(){var s;let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){t.createDiv({cls:"nav-file",text:"No recent files"});return}let i={};for(let d of this.plugin.recentFiles){let n=this.app.vault.getAbstractFileByPath(d.path);if(n instanceof p.TFile){let l=this.app.metadataCache.getFileCache(n),c=(s=l==null?void 0:l.frontmatter)==null?void 0:s.type;c&&typeof c=="string"&&(i[c]=(i[c]||0)+1)}}if(Object.keys(i).length>0){let d=t.createDiv({cls:"waypoint-recent-filter"});d.createSpan({cls:`waypoint-recent-pill${this.recentFilesFilter?"":" is-active"}`,text:"all"}).addEventListener("click",()=>{this.recentFilesFilter=null,this.redraw()});let l=Object.entries(i).sort(([,c],[,h])=>h-c);for(let[c,h]of l){let m=d.createSpan({cls:`waypoint-recent-pill${this.recentFilesFilter===c?" is-active":""}`});m.setText(`${c} ${h}`),m.addEventListener("click",()=>{this.recentFilesFilter=this.recentFilesFilter===c?null:c,this.redraw()})}}let o=this.plugin.recentFiles;this.recentFilesFilter&&(o=this.plugin.recentFiles.filter(d=>{var l;let n=this.app.vault.getAbstractFileByPath(d.path);if(n instanceof p.TFile){let c=this.app.metadataCache.getFileCache(n);return((l=c==null?void 0:c.frontmatter)==null?void 0:l.type)===this.recentFilesFilter}return!1}));let a=this.app.workspace.getActiveFile(),e=t.createDiv({cls:"nav-folder mod-root"}),r=e.createDiv({cls:"nav-folder-children"});for(let d of o){let n=r.createDiv({cls:"tree-item nav-file"}),l=n.createDiv({cls:"tree-item-self is-clickable nav-file-title"});l.createDiv({cls:"tree-item-inner nav-file-title-content"}).setText(d.basename);let h=l.createDiv({cls:"tree-item-spacer"}),m=l.createDiv({cls:"waypoint-recent-remove"});(0,p.setIcon)(m,"x"),m.addEventListener("click",g=>{g.stopPropagation(),this.plugin.recentFiles=this.plugin.recentFiles.filter(v=>v.path!==d.path),this.plugin.persistRecentFiles(),this.redraw()}),(0,p.setTooltip)(n,d.path),a&&d.path===a.path&&l.addClass("is-active"),l.setAttr("draggable","true"),l.addEventListener("dragstart",g=>{let v=this.app.metadataCache.getFirstLinkpathDest(d.path,"");v&&(this.app.dragManager.dragFile(g,v),this.app.dragManager.onDragStart(g,this.app.dragManager.dragFile(g,v)))}),l.addEventListener("mouseover",g=>{this.app.workspace.trigger("hover-link",{event:g,source:P,hoverParent:e,targetEl:n,linktext:d.path})}),l.addEventListener("contextmenu",g=>{let v=new p.Menu;v.addItem(F=>F.setSection("action").setTitle("Open in new tab").setIcon("file-plus").onClick(()=>this.focusFile(d,"tab"))),v.addItem(F=>F.setSection("action").setTitle("Add to bookmarks").setIcon("bookmark").onClick(()=>{this.plugin.addBookmark(d.path,d.basename,"file"),new p.Notice(`Bookmarked: ${d.basename}`)}));let C=this.app.vault.getAbstractFileByPath(d.path);C&&this.app.workspace.trigger("file-menu",v,C,"link-context-menu"),v.showAtPosition({x:g.clientX,y:g.clientY})}),l.addEventListener("click",g=>{let v=p.Keymap.isModEvent(g);this.focusFile(d,v)}),l.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.focusFile(d,"tab"))})}}focusFile(t,i){let o=this.app.vault.getFiles().find(a=>a.path===t.path);o?this.app.workspace.getLeaf(i).openFile(o):(new p.Notice("Cannot find file"),this.plugin.recentFiles=this.plugin.recentFiles.filter(a=>a.path!==t.path),this.plugin.persistRecentFiles(),this.redraw())}renderFavorites(){let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-favorites"}),i=t.createDiv({cls:"waypoint-section-header"});i.setText("Waypoint Bookmarks");let o=i.createEl("button",{cls:"waypoint-header-more"});if((0,p.setIcon)(o,"more-horizontal"),(0,p.setTooltip)(o,"Add bookmark"),o.addEventListener("click",a=>{let e=new p.Menu;e.addItem(r=>{r.setTitle("Add current file").setIcon("file-plus").onClick(()=>{let s=this.app.workspace.getActiveFile();s&&this.plugin.addBookmark(s.path,s.basename,"file")})}),e.addItem(r=>{r.setTitle("Add as parent note").setIcon("folder-plus").onClick(()=>{let s=this.app.workspace.getActiveFile();if(!s)return;let d=this.plugin.addBookmark(s.path,s.basename,"group","");d.filePath=s.path,this.plugin.saveWaypointData(),this.redraw()})}),e.addItem(r=>{r.setTitle("New group").setIcon("folder-plus").onClick(()=>{this.plugin.addBookmark("","New Group","group","")})}),e.addSeparator(),e.addItem(r=>{r.setTitle("Add separator").setIcon("minus").onClick(()=>{this.plugin.addBookmark("","","separator")})}),e.addItem(r=>{r.setTitle("Add spacer").setIcon("space").onClick(()=>{this.plugin.addBookmark("","","spacer")})}),e.showAtPosition({x:a.clientX,y:a.clientY})}),this.plugin.waypointData.bookmarks.length===0){t.createDiv({cls:"waypoint-bookmark-item",text:"No bookmarks"});return}this.renderBookmarkList(t,this.plugin.waypointData.bookmarks,0)}renderBookmarkList(t,i,o){for(let a=0;a{this.dragId=e.id,l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",e.id),n.addClass("waypoint-bm-dragging")}),n.addEventListener("dragend",()=>{this.dragId=null,t.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(l=>{l.removeClass("waypoint-bm-dragging"),l.removeClass("waypoint-bm-drop-line"),l.removeClass("waypoint-bm-drop-below")})}),n.addEventListener("dragenter",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(n,l,!1)}),n.addEventListener("dragover",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(n,l,!1)}),n.addEventListener("dragleave",()=>{n.removeClass("waypoint-bm-drop-line"),n.removeClass("waypoint-bm-drop-below"),n.removeClass("waypoint-bm-drop-into")}),n.addEventListener("drop",l=>{var m;l.preventDefault(),this.dragId=null,n.removeClass("waypoint-bm-drop-line"),n.removeClass("waypoint-bm-drop-below");let c=(m=l.dataTransfer)==null?void 0:m.getData("text/plain");if(!c||c===e.id)return;let h=n.__dropAbove;this.moveBookmarkToPosition(c,e.id,h)}),n.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,e)});continue}if(e.type==="spacer"){let n=t.createDiv({cls:"waypoint-bookmark-item waypoint-bookmark-spacer"});n.setAttr("draggable","true"),n.setAttr("data-bm-id",e.id),n.style.paddingLeft=`${8+o*16}px`,n.style.cursor="grab",n.addEventListener("dragstart",l=>{this.dragId=e.id,l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",e.id),n.addClass("waypoint-bm-dragging")}),n.addEventListener("dragend",()=>{this.dragId=null,t.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(l=>{l.removeClass("waypoint-bm-dragging"),l.removeClass("waypoint-bm-drop-line"),l.removeClass("waypoint-bm-drop-below")})}),n.addEventListener("dragenter",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(n,l,!1)}),n.addEventListener("dragover",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(n,l,!1)}),n.addEventListener("dragleave",()=>{n.removeClass("waypoint-bm-drop-line"),n.removeClass("waypoint-bm-drop-below"),n.removeClass("waypoint-bm-drop-into")}),n.addEventListener("drop",l=>{var m;l.preventDefault(),this.dragId=null,n.removeClass("waypoint-bm-drop-line"),n.removeClass("waypoint-bm-drop-below");let c=(m=l.dataTransfer)==null?void 0:m.getData("text/plain");if(!c||c===e.id)return;let h=n.__dropAbove;this.moveBookmarkToPosition(c,e.id,h)}),n.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,e)});continue}let r=e.type==="group",s=t.createDiv({cls:`waypoint-bookmark-item${r?" waypoint-bookmark-group":""}${e.collapsed?" collapsed":""}`});s.setAttr("draggable","true"),s.setAttr("data-bm-id",e.id),r||(s.style.paddingLeft=`${8+o*16}px`),s.addEventListener("dragstart",n=>{this.dragId=e.id,n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("text/plain",e.id),s.addClass("waypoint-bm-dragging")});let d=!0;if(s.addEventListener("dragend",()=>{this.dragId=null,t.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(n=>{n.removeClass("waypoint-bm-dragging"),n.removeClass("waypoint-bm-drop-line"),n.removeClass("waypoint-bm-drop-below"),n.removeClass("waypoint-bm-drop-into")})}),s.addEventListener("dragenter",n=>{n.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(s,n,d)}),s.addEventListener("dragover",n=>{n.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(s,n,d)}),s.addEventListener("dragleave",()=>{s.removeClass("waypoint-bm-drop-line"),s.removeClass("waypoint-bm-drop-below"),s.removeClass("waypoint-bm-drop-into")}),s.addEventListener("drop",n=>{var h;n.preventDefault(),this.dragId=null,s.removeClass("waypoint-bm-drop-line"),s.removeClass("waypoint-bm-drop-below"),s.removeClass("waypoint-bm-drop-into");let l=(h=n.dataTransfer)==null?void 0:h.getData("text/plain");if(!l||l===e.id)return;if(s.__dropInto&&d)r?this.moveBookmarkToGroup(l,e.id):this.createParentNoteAndMove(l,e.id);else{let m=s.__dropAbove;this.moveBookmarkToPosition(l,e.id,m)}}),r){let n=s.createDiv({cls:"waypoint-bm-icon"});e.icon&&(0,p.setIcon)(n,e.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:e.label}),c=s.createDiv({cls:"waypoint-bm-chevron"});(0,p.setIcon)(c,"chevron-down"),c.addEventListener("click",m=>{m.stopPropagation(),this.plugin.updateBookmark(e.id,{collapsed:!e.collapsed})}),s.addEventListener("click",m=>{if(e.filePath){let g=this.app.vault.getFileByPath(e.filePath);if(g){let v=p.Keymap.isModEvent(m);this.app.workspace.getLeaf(v).openFile(g);return}}this.plugin.updateBookmark(e.id,{collapsed:!e.collapsed})}),s.addEventListener("mousedown",m=>{if(m.button===1&&e.filePath){m.preventDefault();let g=this.app.vault.getFileByPath(e.filePath);g&&this.app.workspace.getLeaf("tab").openFile(g)}});let h=t.createDiv({cls:`waypoint-bookmark-children${e.collapsed?" collapsed":""}`});e.children&&e.children.length>0&&this.renderBookmarkList(h,e.children,o+1)}else{let n=s.createDiv({cls:"waypoint-bm-icon"});e.icon&&(0,p.setIcon)(n,e.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:e.label});if(e.children&&e.children.length>0){let c=s.createDiv({cls:"waypoint-bm-chevron"});(0,p.setIcon)(c,"chevron-down"),c.addEventListener("click",h=>{h.stopPropagation(),this.plugin.updateBookmark(e.id,{collapsed:!e.collapsed})}),e.collapsed&&(s.addClass("collapsed"),c.style.transform="rotate(-90deg)")}if((0,p.setTooltip)(s,e.filePath),s.addEventListener("click",c=>{if(e.filePath){let h=this.app.vault.getFileByPath(e.filePath);if(h){let m=p.Keymap.isModEvent(c);this.app.workspace.getLeaf(m).openFile(h)}else new p.Notice("File not found"),this.plugin.removeBookmark(e.id)}}),s.addEventListener("mousedown",c=>{if(c.button===1&&e.filePath){c.preventDefault();let h=this.app.vault.getFileByPath(e.filePath);h&&this.app.workspace.getLeaf("tab").openFile(h)}}),e.children&&e.children.length>0){let c=t.createDiv({cls:`waypoint-bookmark-children${e.collapsed?" collapsed":""}`});this.renderBookmarkList(c,e.children,o+1)}}s.addEventListener("contextmenu",n=>{n.stopPropagation(),n.preventDefault(),this.showBookmarkContextMenu(n,e)})}}showBookmarkContextMenu(t,i){let o=new p.Menu;if(i.type==="separator"||i.type==="spacer"){o.addItem(a=>a.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(i.id))),o.showAtPosition({x:t.clientX,y:t.clientY});return}i.type==="file"?(o.addItem(a=>a.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let e=this.app.vault.getFileByPath(i.filePath);e&&this.app.workspace.getLeaf("tab").openFile(e)})),o.addSeparator(),o.addItem(a=>a.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(i))),o.addItem(a=>a.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(i))),o.addSeparator(),o.addItem(a=>a.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(i.id)))):i.type==="group"&&(i.filePath&&(o.addItem(a=>a.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let e=this.app.vault.getFileByPath(i.filePath);e&&this.app.workspace.getLeaf("tab").openFile(e)})),o.addSeparator()),o.addItem(a=>a.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(i))),o.addItem(a=>a.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(i))),o.addSeparator(),o.addItem(a=>a.setTitle("Add child bookmark").setIcon("file-plus").onClick(()=>{let e=this.app.workspace.getActiveFile();if(!e){new p.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"file",label:e.basename,filePath:e.path,icon:"",children:[],collapsed:!1,indent:i.indent+1};i.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),o.addItem(a=>a.setTitle("Add child note").setIcon("folder-plus").onClick(()=>{let e=this.app.workspace.getActiveFile();if(!e){new p.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:e.basename,filePath:e.path,icon:"",children:[],collapsed:!1,indent:i.indent+1};i.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),o.addItem(a=>a.setTitle("New sub-group").setIcon("folder-plus").onClick(()=>{let e={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:"New Group",filePath:"",icon:"",children:[],collapsed:!1,indent:i.indent+1};i.children.push(e),this.plugin.saveWaypointData(),this.redraw()})),o.addSeparator(),o.addItem(a=>a.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(i.id)))),o.showAtPosition({x:t.clientX,y:t.clientY})}showDropIndicator(t,i,o){let a=t.parentElement;a&&a.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 e=t.getBoundingClientRect(),r=i.clientY;if(o){let s=e.top+e.height*.25,d=e.top+e.height*.75;rd?(t.addClass("waypoint-bm-drop-line"),t.addClass("waypoint-bm-drop-below"),t.__dropAbove=!1,t.__dropInto=!1):(t.addClass("waypoint-bm-drop-into"),t.__dropAbove=!1,t.__dropInto=!0)}else{let s=r{let r=e.findIndex(s=>s.id===t);if(r>=0){let[s]=e.splice(r,1);return s}for(let s of e){let d=o(s.children);if(d)return d}return null},a=o(this.plugin.waypointData.bookmarks);if(a){if(i){let e=(r,s)=>r.id===s?!0:r.children.some(d=>e(d,s));if(a.id===i||e(a,i))return}if(i){let e=s=>{for(let d of s){if(d.id===i)return d;let n=e(d.children);if(n)return n}return null},r=e(this.plugin.waypointData.bookmarks);r&&(a.indent=r.indent+1,r.children.push(a))}else a.indent=0,this.plugin.waypointData.bookmarks.push(a);this.plugin.saveWaypointData(),this.redraw()}}createParentNoteAndMove(t,i){let o=s=>{let d=s.findIndex(n=>n.id===t);if(d>=0){let[n]=s.splice(d,1);return n}for(let n of s)if(n.children){let l=o(n.children);if(l)return l}return null},a=o(this.plugin.waypointData.bookmarks);if(!a)return;let e=s=>{for(let d of s){if(d.id===i)return d;if(d.children){let n=e(d.children);if(n)return n}}return null},r=e(this.plugin.waypointData.bookmarks);r&&(a.indent=r.indent+1,r.children.push(a),this.plugin.saveWaypointData(),this.redraw())}moveBookmarkToPosition(t,i,o){let a=d=>{let n=d.findIndex(l=>l.id===t);if(n>=0){let[l]=d.splice(n,1);return{item:l,parent:d}}for(let l of d)if(l.children){let c=a(l.children);if(c.item)return c}return{item:null,parent:[]}},{item:e}=a(this.plugin.waypointData.bookmarks);if(!e)return;let r=d=>{let n=d.findIndex(l=>l.id===i);if(n>=0)return{parent:d,idx:n};for(let l of d)if(l.children){let c=r(l.children);if(c)return c}return null},s=r(this.plugin.waypointData.bookmarks);if(!s)e.indent=0,this.plugin.waypointData.bookmarks.push(e);else{let d=o?s.idx:s.idx+1;s.parent.splice(d,0,e)}this.plugin.saveWaypointData(),this.redraw()}promptRename(t){new q(this.app,t.label,i=>{i&&i.trim()&&this.plugin.updateBookmark(t.id,{label:i.trim()})}).open()}promptIcon(t){new V(this.app,t.icon,i=>{i&&this.plugin.updateBookmark(t.id,{icon:i})}).open()}},q=class extends p.Modal{constructor(u,t,i){super(u),this.currentValue=t,this.onSubmit=i}onOpen(){this.titleEl.setText("Rename bookmark");let u=this.contentEl.createEl("input",{type:"text",value:this.currentValue});u.style.width="100%",u.style.marginBottom="12px",u.focus(),u.select();let t=this.contentEl.createDiv({cls:"modal-button-container"}),i=t.createEl("button",{text:"Cancel",cls:"mod-cta"});i.style.marginRight="8px",i.addEventListener("click",()=>this.close()),t.createEl("button",{text:"Save",cls:"mod-cta"}).addEventListener("click",()=>{this.onSubmit(u.value),this.close()}),u.addEventListener("keydown",a=>{a.key==="Enter"&&(this.onSubmit(u.value),this.close())})}onClose(){this.contentEl.empty()}},V=class extends p.Modal{constructor(t,i,o){super(t);this.allIcons=[];this.tagsMap={};this.loaded=!1;this.selected=i,this.onSubmit=o}async onOpen(){let t=this.contentEl;t.style.display="flex",t.style.flexDirection="column",t.style.gap="10px",this.titleEl.setText("Change icon");let i=t.createDiv({cls:"waypoint-icon-preview"});i.style.display="flex",i.style.alignItems="center",i.style.gap="10px",i.style.padding="12px 16px",i.style.borderRadius="8px",i.style.background="var(--background-secondary)",i.style.minHeight="48px";let o=i.createSpan();o.style.display="flex",this.selected&&(0,p.setIcon)(o,this.selected);let a=i.createSpan();a.style.fontWeight="var(--font-medium)",a.style.fontSize="var(--font-ui-medium)",a.setText(this.selected||"No icon");let e=t.createEl("input",{type:"text",placeholder:"Type to search (e.g. arrow, chart, home)..."});Object.assign(e.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)"}),e.focus();let r=t.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=t.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 d=s.createSpan();d.setText("Loading\u2026");let n=s.createSpan();n.style.cursor="var(--cursor)",n.style.color="var(--text-accent)",n.setText("No icon"),n.addEventListener("click",()=>{this.onSubmit(""),this.close()}),this.loadIcons().then(()=>{this.loaded=!0,d.setText(this.allIcons.length+" icons"),c(e.value)});let l=null,c=v=>{if(r.empty(),!this.loaded){r.createDiv({text:"Loading\u2026"});return}let C=v.toLowerCase().trim(),F=C?this.allIcons.filter(D=>{if(D.includes(C))return!0;let E=this.tagsMap[D];return E?E.some(y=>y.includes(C)):!1}).slice(0,80):this.allIcons.slice(0,80);if(F.length===0){let D=r.createDiv();D.style.gridColumn="1 / -1",D.style.textAlign="center",D.style.color="var(--text-muted)",D.style.padding="20px",D.setText('No icons match "'+v+'"');return}for(var N=0;Nnew Y(e,this)),this.addSettingTab(new $(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let e=this.app.workspace.getLeavesOfType(P);if(e.length>0)await this.app.workspace.revealLeaf(e[0]);else{let r=this.app.workspace.getLeftLeaf(!1);r&&(await r.setViewState({type:P}),await this.app.workspace.revealLeaf(r))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let e=this.app.workspace.getActiveFile();if(!e){new f.Notice("No active file");return}this.addBookmark(e.path,e.basename,"file"),new f.Notice(`Bookmarked: ${e.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)())}});let t=["next","prev"],i=["daily","weekly","monthly","quarterly","yearly"],o={next:"Next",prev:"Previous"};for(let e of i)for(let r of t){let s=`waypoint-go-to-${r}-${e}`,d=`${o[r]} ${e} note`;this.addCommand({id:s,name:d,callback:async()=>{await this.navigatePeriodNote(r)}})}this.registerEvent(this.app.workspace.on("file-open",e=>{e&&this.onFileOpen(e)})),this.registerEvent(this.app.vault.on("create",()=>this.onVaultChange())),this.registerEvent(this.app.vault.on("delete",()=>this.onVaultChange())),this.registerEvent(this.app.vault.on("rename",(e,r)=>this.onRename(e,r))),this.app.workspace.onLayoutReady(()=>{if(this.app.workspace.getLeavesOfType(P).length===0){let r=this.app.workspace.getLeftLeaf(!1);r&&r.setViewState({type:P})}});let a=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let e=new Date().toDateString();e!==a&&(a=e,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(P)}async loadSettings(){let t=await this.loadData(),i=(t==null?void 0:t.settings)||{};this.settings=Object.assign({},W,i)}async saveSettings(){let t=await this.loadData()||{};t.settings=this.settings,await this.saveData(t)}async loadWaypointData(){let t=await this.loadData(),i=(t==null?void 0:t.waypointData)||{};this.waypointData=Object.assign({},Z,i),this.recentFiles=this.waypointData.recentFiles||[],this.recentFiles.length>this.settings.recentFiles.maxItems&&(this.recentFiles=this.recentFiles.slice(0,this.settings.recentFiles.maxItems),this.waypointData.recentFiles=this.recentFiles)}enforceRecentFilesLimit(){this.recentFiles.length>this.settings.recentFiles.maxItems&&(this.recentFiles=this.recentFiles.slice(0,this.settings.recentFiles.maxItems),this.persistRecentFiles())}async saveWaypointData(){this.waypointData.recentFiles=this.recentFiles;let t=await this.loadData()||{};t.waypointData=this.waypointData,await this.saveData(t)}persistRecentFiles(){this.waypointData.recentFiles=this.recentFiles,this.recentFilesSaveTimer&&clearTimeout(this.recentFilesSaveTimer),this.recentFilesSaveTimer=setTimeout(()=>{this.saveWaypointData()},300)}onFileOpen(t){this.settings.recentFiles.updateOn!=="file-edit"&&this.addToRecentFiles(t)}addToRecentFiles(t){if(this.settings.recentFiles.omittedPaths.length>0)for(let i of this.settings.recentFiles.omittedPaths)try{if(new RegExp(i).test(t.path))return}catch(o){}this.recentFiles=this.recentFiles.filter(i=>i.path!==t.path),this.recentFiles.unshift({path:t.path,basename:t.basename}),this.recentFiles.length>this.settings.recentFiles.maxItems&&(this.recentFiles=this.recentFiles.slice(0,this.settings.recentFiles.maxItems)),this.persistRecentFiles(),this.broadcastRedraw()}onRename(t,i){let o=this.recentFiles.find(a=>a.path===i);o&&(o.path=t.path,o.basename=t.basename||t.name.replace(/\.[^/.]+$/,""),this.persistRecentFiles(),this.broadcastRedraw()),this.updateBookmarkPath(i,t.path)}onVaultChange(){this.broadcastRedraw()}addBookmark(t,i,o="file",a=""){let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:o,label:i,filePath:o==="file"?t:"",icon:a,children:[],collapsed:!1,indent:0};return this.waypointData.bookmarks.push(r),this.saveWaypointData(),this.broadcastRedraw(),r}removeBookmark(t){let i=o=>{let a=o.findIndex(e=>e.id===t);if(a>=0)return o.splice(a,1),!0;for(let e of o)if(e.children&&i(e.children))return!0;return!1};i(this.waypointData.bookmarks),this.saveWaypointData(),this.broadcastRedraw()}updateBookmark(t,i){let o=e=>{for(let r of e){if(r.id===t)return r;if(r.children){let s=o(r.children);if(s)return s}}return null},a=o(this.waypointData.bookmarks);a&&(Object.assign(a,i),this.saveWaypointData(),this.broadcastRedraw())}updateBookmarkPath(t,i){let o=a=>{for(let e of a)e.filePath===t&&(e.filePath=i),e.children&&o(e.children)};o(this.waypointData.bookmarks)}async openPeriodNote(t,i){let a={day:{settings:this.settings.daily,label:"Daily"},week:{settings:this.settings.weekly,label:"Weekly"},month:{settings:this.settings.monthly,label:"Monthly"},quarter:{settings:this.settings.quarterly,label:"Quarterly"},year:{settings:this.settings.yearly,label:"Yearly"}}[t];if(!a)return;let{settings:e}=a,r=i.format(e.nameFormat)+".md",s=e.folder?`${e.folder}/${r}`:r,d=this.app.vault.getFileByPath(s);if(!d){try{let n=e.templateFile+".md",l=this.app.vault.getFileByPath(n);if(l){let c=await this.app.vault.read(l);d=await this.app.vault.create(s,c)}else{let c=`---
+var z=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var U=(D,u)=>{for(var t in u)z(D,t,{get:u[t],enumerable:!0})},X=(D,u,t,a)=>{if(u&&typeof u=="object"||typeof u=="function")for(let n of H(u))!Q.call(D,n)&&n!==t&&z(D,n,{get:()=>u[n],enumerable:!(a=j(u,n))||a.enumerable});return D};var K=D=>X(z({},"__esModule",{value:!0}),D);var ee={};U(ee,{default:()=>$});module.exports=K(ee);var f=require("obsidian");var W={calendar:{firstDayOfWeek:1,showNoteIndicators:!0},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},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"},recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[],filterTags:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var v=require("obsidian");var O=class extends v.PluginSettingTab{constructor(t,a,n,i){super(t,a);this.activeTab="calendar";this.plugin=a,this.settings=n,this.onSettingsChange=i}display(){let{containerEl:t}=this;t.empty();let a=t.createDiv({cls:"waypoint-settings-tabs"}),n=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let e of n)a.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===e.key?" is-active":""}`,text:e.label}).addEventListener("click",()=>{this.activeTab=e.key,this.display()});let i=t.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(i);break;case"periodic":this.renderPeriodicTab(i);break;case"recent":this.renderRecentTab(i);break;case"display":this.renderDisplayTab(i);break;case"about":this.renderAboutTab(i);break}}renderCalendarTab(t){new v.Setting(t).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(a=>{a.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(n=>{this.settings.calendar.firstDayOfWeek=parseInt(n,10),this.saveAndRefresh()})}),new v.Setting(t).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(a=>{a.setValue(this.settings.calendar.showNoteIndicators).onChange(n=>{this.settings.calendar.showNoteIndicators=n,this.saveAndRefresh()})})}renderPeriodicTab(t){this.addPeriodNoteSettings(t,"Daily",this.settings.daily),this.addPeriodNoteSettings(t,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(t,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(t,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(t,"Yearly",this.settings.yearly)}addPeriodNoteSettings(t,a,n){new v.Setting(t).setHeading().setName(a),new v.Setting(t).setName("Folder").setDesc(`Folder path for ${a.toLowerCase()} notes.`).addText(i=>{i.setPlaceholder("periodic/daily"),i.setValue(n.folder),i.onChange(e=>{n.folder=e,this.saveAndRefresh()})}),new v.Setting(t).setName("Name format").setDesc(`Date format for ${a.toLowerCase()} note filenames (moment.js format).`).addText(i=>{i.setPlaceholder("yyyy-MM-dd"),i.setValue(n.nameFormat),i.onChange(e=>{n.nameFormat=e,this.saveAndRefresh()})}),new v.Setting(t).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(i=>{i.setPlaceholder("Templates/Daily note"),i.setValue(n.templateFile),i.onChange(e=>{n.templateFile=e,this.saveAndRefresh()})}),new v.Setting(t).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(i=>{i.setPlaceholder("daily-note"),i.setValue(n.typeProperty),i.onChange(e=>{n.typeProperty=e,this.saveAndRefresh()})})}renderRecentTab(t){new v.Setting(t).setName("Max items").setDesc("Maximum number of recent files to track.").addText(e=>{e.inputEl.setAttr("type","number"),e.inputEl.setAttr("placeholder","50"),e.setValue(String(this.settings.recentFiles.maxItems)),e.inputEl.onblur=()=>{let s=parseInt(e.getValue(),10);!isNaN(s)&&s>0&&(this.settings.recentFiles.maxItems=s,this.saveAndRefresh())}}),new v.Setting(t).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(e=>{e.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(s=>{this.settings.recentFiles.updateOn=s,this.saveAndRefresh()})});let a=new DocumentFragment;a.appendText("Regex patterns for paths to exclude. One per line."),new v.Setting(t).setName("Omitted paths").setDesc(a).addTextArea(e=>{e.inputEl.setAttr("rows",4),e.setPlaceholder(`^archives/
+\\.png$`),e.setValue(this.settings.recentFiles.omittedPaths.join(`
+`)),e.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=e.getValue().split(`
+`).filter(s=>s.trim()),this.saveAndRefresh()}});let n=new DocumentFragment;n.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new v.Setting(t).setName("Omitted tags").setDesc(n).addTextArea(e=>{e.inputEl.setAttr("rows",4),e.setPlaceholder(`ignore
+archive`),e.setValue(this.settings.recentFiles.omittedTags.join(`
+`)),e.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=e.getValue().split(`
+`).filter(s=>s.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.appendText("Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property."),new v.Setting(t).setName("Filter tags").setDesc(i).addTextArea(e=>{e.inputEl.setAttr("rows",4),e.setPlaceholder(`meeting
+person
+project`),e.setValue(this.settings.recentFiles.filterTags.join(`
+`)),e.inputEl.onblur=()=>{this.settings.recentFiles.filterTags=e.getValue().split(`
+`).filter(s=>s.trim()),this.saveAndRefresh()}})}renderDisplayTab(t){new v.Setting(t).setHeading().setName("Bookmarks"),this.addSliderSetting(t,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(t,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(t,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(t,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(t,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new v.Setting(t).setHeading().setName("Calendar"),this.addSliderSetting(t,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new v.Setting(t).addButton(a=>a.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...W.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(t,a,n,i,e,s,o,d,r){let l=new v.Setting(t).setName(a).setDesc(`${n} (${i[e]}${r})`);l.addSlider(c=>{c.setLimits(s,o,d).setValue(i[e]).setDynamicTooltip().onChange(p=>{i[e]=p,l.setDesc(`${n} (${p}${r})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(t){let a=this.plugin.manifest.version,n=t.createDiv();n.style.display="flex",n.style.alignItems="center",n.style.gap="12px",n.style.marginBottom="16px";let i=n.createDiv();i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.width="48px",i.style.height="48px",i.style.borderRadius="12px",i.style.background="var(--interactive-accent)",i.style.color="var(--text-on-accent)",i.style.fontSize="24px",(0,v.setIcon)(i,"compass");let e=n.createDiv(),s=e.createEl("h2",{text:"Waypoint Sidebar"});s.style.margin="0",s.style.lineHeight="1.2";let o=e.createDiv({text:`v${a}`});o.style.color="var(--text-muted)",o.style.fontSize="var(--font-ui-small)";let d=t.createDiv();d.style.marginBottom="20px",d.style.lineHeight="1.6",d.style.color="var(--text-normal)",d.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 h=require("obsidian");var M=require("obsidian");function _(D,u,t){let a=(0,M.moment)({year:D,month:u,day:1}),n=(0,M.moment)(a).endOf("month"),i=(0,M.moment)(a).subtract((a.day()-t+7)%7,"days"),e=(0,M.moment)().startOf("day"),s=[],o=(0,M.moment)(i);for(;o.isBefore(n)||o.month()===u;){let d=[];for(let r=0;r<7;r++)d.push({date:(0,M.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(e,"day"),isCurrentMonth:o.month()===u,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(s.push({weekNumber:d[0].isoWeekNumber,days:d}),s.length>=6)break}return s}var C="waypoint-view",N=class extends h.ItemView{constructor(t,a){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let t=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",t.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",t.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",t.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",t.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",t.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",t.calendarCellSize+"px"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.recentFilesFilter=null;this.plugin=a}getViewType(){return C}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let a=t.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),i=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),e=a.createDiv({cls:"waypoint-calendar-top"}),s=e.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=i.format("[Q]Q"),d=s.createSpan({cls:"waypoint-clickable",text:o});d.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",i)}),d.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.plugin.openPeriodNoteInLeaf("quarter",i,this.app.workspace.getLeaf("tab")))});let r=i.format("MMMM"),l=s.createSpan({cls:"waypoint-clickable",text:r});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",i)}),l.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.plugin.openPeriodNoteInLeaf("month",i,this.app.workspace.getLeaf("tab")))});let c=i.format("YYYY"),p=s.createSpan({cls:"waypoint-clickable",text:c});p.addEventListener("click",()=>{this.plugin.openPeriodNote("year",i)}),p.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.plugin.openPeriodNoteInLeaf("year",i,this.app.workspace.getLeaf("tab")))});let m=e.createDiv({cls:"waypoint-calendar-today-group"}),b=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(b,"chevron-left"),b.addEventListener("click",()=>this.navigateMonth(-1)),m.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.redraw()});let y=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(y,"chevron-right"),y.addEventListener("click",()=>this.navigateMonth(1));let w=a.createEl("table"),I=w.createEl("thead").createEl("tr");I.createEl("th",{text:""});let k=["sun","mon","tue","wed","thu","fri","sat"],R=this.plugin.settings.calendar.firstDayOfWeek;for(let g=0;g<7;g++){let B=(R+g)%7;I.createEl("th",{text:k[B]})}let F=w.createEl("tbody"),P=_(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let g of P){let B=F.createEl("tr"),Y=B.createEl("td",{cls:"waypoint-weeknum"});Y.setText(String(g.weekNumber)),Y.addEventListener("click",()=>{let E=g.days[0].date;this.plugin.openPeriodNote("week",E)}),Y.addEventListener("mousedown",E=>{if(E.button===1){E.preventDefault();let T=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("week",monday,T)}});for(let E of g.days){let T=B.createEl("td",{cls:"waypoint-day"});if(T.setText(String(E.dayOfMonth)),E.isCurrentMonth||T.addClass("other-month"),E.isToday&&T.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let A=E.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(G=>G.extension==="md"&&G.basename===A)&&T.addClass("has-note")}T.addEventListener("click",()=>{this.plugin.openPeriodNote("day",E.date)}),T.addEventListener("mousedown",A=>{if(A.button===1){A.preventDefault();let S=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("day",E.date,S)}})}}}navigateMonth(t){let a=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=a.month(),this.currentDisplayYear=a.year(),this.redraw()}renderRecentFiles(){var d,r;let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){t.createDiv({cls:"nav-file",text:"No recent files"});return}let a=this.plugin.settings.recentFiles.filterTags,n={};if(a.length>0){for(let l of a)n[l]=0;for(let l of this.plugin.recentFiles){let c=this.app.vault.getAbstractFileByPath(l.path);if(c instanceof h.TFile){let p=this.app.metadataCache.getFileCache(c),m=(d=p==null?void 0:p.frontmatter)==null?void 0:d.type;m&&typeof m=="string"&&n.hasOwnProperty(m)&&n[m]++}}}else for(let l of this.plugin.recentFiles){let c=this.app.vault.getAbstractFileByPath(l.path);if(c instanceof h.TFile){let p=this.app.metadataCache.getFileCache(c),m=(r=p==null?void 0:p.frontmatter)==null?void 0:r.type;m&&typeof m=="string"&&(n[m]=(n[m]||0)+1)}}if(Object.keys(n).length>0){let l=t.createDiv({cls:"waypoint-recent-filter"});l.createSpan({cls:`waypoint-recent-pill${this.recentFilesFilter?"":" is-active"}`,text:"all"}).addEventListener("click",()=>{this.recentFilesFilter=null,this.redraw()});let p=a.length>0?Object.entries(n):Object.entries(n).sort(([,m],[,b])=>b-m);for(let[m,b]of p){let x=l.createSpan({cls:`waypoint-recent-pill${this.recentFilesFilter===m?" is-active":""}`});x.setText(`${m} ${b}`),x.addEventListener("click",()=>{this.recentFilesFilter=this.recentFilesFilter===m?null:m,this.redraw()})}}let i=this.plugin.recentFiles;this.recentFilesFilter&&(i=this.plugin.recentFiles.filter(l=>{var p;let c=this.app.vault.getAbstractFileByPath(l.path);if(c instanceof h.TFile){let m=this.app.metadataCache.getFileCache(c);return((p=m==null?void 0:m.frontmatter)==null?void 0:p.type)===this.recentFilesFilter}return!1}));let e=this.app.workspace.getActiveFile(),s=t.createDiv({cls:"nav-folder mod-root"}),o=s.createDiv({cls:"nav-folder-children"});for(let l of i){let c=o.createDiv({cls:"tree-item nav-file"}),p=c.createDiv({cls:"tree-item-self is-clickable nav-file-title"});p.createDiv({cls:"tree-item-inner nav-file-title-content"}).setText(l.basename);let b=p.createDiv({cls:"tree-item-spacer"}),x=p.createDiv({cls:"waypoint-recent-remove"});(0,h.setIcon)(x,"x"),x.addEventListener("click",y=>{y.stopPropagation(),this.plugin.recentFiles=this.plugin.recentFiles.filter(w=>w.path!==l.path),this.plugin.persistRecentFiles(),this.redraw()}),(0,h.setTooltip)(c,l.path),e&&l.path===e.path&&p.addClass("is-active"),p.setAttr("draggable","true"),p.addEventListener("dragstart",y=>{let w=this.app.metadataCache.getFirstLinkpathDest(l.path,"");w&&(this.app.dragManager.dragFile(y,w),this.app.dragManager.onDragStart(y,this.app.dragManager.dragFile(y,w)))}),p.addEventListener("mouseover",y=>{this.app.workspace.trigger("hover-link",{event:y,source:C,hoverParent:s,targetEl:c,linktext:l.path})}),p.addEventListener("contextmenu",y=>{let w=new h.Menu;w.addItem(I=>I.setSection("action").setTitle("Open in new tab").setIcon("file-plus").onClick(()=>this.focusFile(l,"tab"))),w.addItem(I=>I.setSection("action").setTitle("Add to bookmarks").setIcon("bookmark").onClick(()=>{this.plugin.addBookmark(l.path,l.basename,"file"),new h.Notice(`Bookmarked: ${l.basename}`)}));let L=this.app.vault.getAbstractFileByPath(l.path);L&&this.app.workspace.trigger("file-menu",w,L,"link-context-menu"),w.showAtPosition({x:y.clientX,y:y.clientY})}),p.addEventListener("click",y=>{let w=h.Keymap.isModEvent(y);this.focusFile(l,w)}),p.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.focusFile(l,"tab"))})}}focusFile(t,a){let n=this.app.vault.getFiles().find(i=>i.path===t.path);n?this.app.workspace.getLeaf(a).openFile(n):(new h.Notice("Cannot find file"),this.plugin.recentFiles=this.plugin.recentFiles.filter(i=>i.path!==t.path),this.plugin.persistRecentFiles(),this.redraw())}renderFavorites(){let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-favorites"}),a=t.createDiv({cls:"waypoint-section-header"});a.setText("Waypoint Bookmarks");let n=a.createEl("button",{cls:"waypoint-header-more"});if((0,h.setIcon)(n,"more-horizontal"),(0,h.setTooltip)(n,"Add bookmark"),n.addEventListener("click",i=>{let e=new h.Menu;e.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")})}),e.addItem(s=>{s.setTitle("Add as parent note").setIcon("folder-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();if(!o)return;let d=this.plugin.addBookmark(o.path,o.basename,"group","");d.filePath=o.path,this.plugin.saveWaypointData(),this.redraw()})}),e.addItem(s=>{s.setTitle("New group").setIcon("folder-plus").onClick(()=>{this.plugin.addBookmark("","New Group","group","")})}),e.addSeparator(),e.addItem(s=>{s.setTitle("Add separator").setIcon("minus").onClick(()=>{this.plugin.addBookmark("","","separator")})}),e.addItem(s=>{s.setTitle("Add spacer").setIcon("space").onClick(()=>{this.plugin.addBookmark("","","spacer")})}),e.showAtPosition({x:i.clientX,y:i.clientY})}),this.plugin.waypointData.bookmarks.length===0){t.createDiv({cls:"waypoint-bookmark-item",text:"No bookmarks"});return}this.renderBookmarkList(t,this.plugin.waypointData.bookmarks,0)}renderBookmarkList(t,a,n){for(let i=0;i{this.dragId=e.id,l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",e.id),r.addClass("waypoint-bm-dragging")}),r.addEventListener("dragend",()=>{this.dragId=null,t.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(l=>{l.removeClass("waypoint-bm-dragging"),l.removeClass("waypoint-bm-drop-line"),l.removeClass("waypoint-bm-drop-below")})}),r.addEventListener("dragenter",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(r,l,!1)}),r.addEventListener("dragover",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(r,l,!1)}),r.addEventListener("dragleave",()=>{r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below"),r.removeClass("waypoint-bm-drop-into")}),r.addEventListener("drop",l=>{var m;l.preventDefault(),this.dragId=null,r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below");let c=(m=l.dataTransfer)==null?void 0:m.getData("text/plain");if(!c||c===e.id)return;let p=r.__dropAbove;this.moveBookmarkToPosition(c,e.id,p)}),r.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,e)});continue}if(e.type==="spacer"){let r=t.createDiv({cls:"waypoint-bookmark-item waypoint-bookmark-spacer"});r.setAttr("draggable","true"),r.setAttr("data-bm-id",e.id),r.style.paddingLeft=`${8+n*16}px`,r.style.cursor="grab",r.addEventListener("dragstart",l=>{this.dragId=e.id,l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",e.id),r.addClass("waypoint-bm-dragging")}),r.addEventListener("dragend",()=>{this.dragId=null,t.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(l=>{l.removeClass("waypoint-bm-dragging"),l.removeClass("waypoint-bm-drop-line"),l.removeClass("waypoint-bm-drop-below")})}),r.addEventListener("dragenter",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(r,l,!1)}),r.addEventListener("dragover",l=>{l.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(r,l,!1)}),r.addEventListener("dragleave",()=>{r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below"),r.removeClass("waypoint-bm-drop-into")}),r.addEventListener("drop",l=>{var m;l.preventDefault(),this.dragId=null,r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below");let c=(m=l.dataTransfer)==null?void 0:m.getData("text/plain");if(!c||c===e.id)return;let p=r.__dropAbove;this.moveBookmarkToPosition(c,e.id,p)}),r.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,e)});continue}let s=e.type==="group",o=t.createDiv({cls:`waypoint-bookmark-item${s?" waypoint-bookmark-group":""}${e.collapsed?" collapsed":""}`});o.setAttr("draggable","true"),o.setAttr("data-bm-id",e.id),s||(o.style.paddingLeft=`${8+n*16}px`),o.addEventListener("dragstart",r=>{this.dragId=e.id,r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",e.id),o.addClass("waypoint-bm-dragging")});let d=!0;if(o.addEventListener("dragend",()=>{this.dragId=null,t.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")})}),o.addEventListener("dragenter",r=>{r.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(o,r,d)}),o.addEventListener("dragover",r=>{r.preventDefault(),!(!this.dragId||this.dragId===e.id)&&this.showDropIndicator(o,r,d)}),o.addEventListener("dragleave",()=>{o.removeClass("waypoint-bm-drop-line"),o.removeClass("waypoint-bm-drop-below"),o.removeClass("waypoint-bm-drop-into")}),o.addEventListener("drop",r=>{var p;r.preventDefault(),this.dragId=null,o.removeClass("waypoint-bm-drop-line"),o.removeClass("waypoint-bm-drop-below"),o.removeClass("waypoint-bm-drop-into");let l=(p=r.dataTransfer)==null?void 0:p.getData("text/plain");if(!l||l===e.id)return;if(o.__dropInto&&d)s?this.moveBookmarkToGroup(l,e.id):this.createParentNoteAndMove(l,e.id);else{let m=o.__dropAbove;this.moveBookmarkToPosition(l,e.id,m)}}),s){let r=o.createDiv({cls:"waypoint-bm-icon"});e.icon&&(0,h.setIcon)(r,e.icon);let l=o.createDiv({cls:"waypoint-bm-label",text:e.label}),c=o.createDiv({cls:"waypoint-bm-chevron"});(0,h.setIcon)(c,"chevron-down"),c.addEventListener("click",m=>{m.stopPropagation(),this.plugin.updateBookmark(e.id,{collapsed:!e.collapsed})}),o.addEventListener("click",m=>{if(e.filePath){let b=this.app.vault.getFileByPath(e.filePath);if(b){let x=h.Keymap.isModEvent(m);this.app.workspace.getLeaf(x).openFile(b);return}}this.plugin.updateBookmark(e.id,{collapsed:!e.collapsed})}),o.addEventListener("mousedown",m=>{if(m.button===1&&e.filePath){m.preventDefault();let b=this.app.vault.getFileByPath(e.filePath);b&&this.app.workspace.getLeaf("tab").openFile(b)}});let p=t.createDiv({cls:`waypoint-bookmark-children${e.collapsed?" collapsed":""}`});e.children&&e.children.length>0&&this.renderBookmarkList(p,e.children,n+1)}else{let r=o.createDiv({cls:"waypoint-bm-icon"});e.icon&&(0,h.setIcon)(r,e.icon);let l=o.createDiv({cls:"waypoint-bm-label",text:e.label});if(e.children&&e.children.length>0){let c=o.createDiv({cls:"waypoint-bm-chevron"});(0,h.setIcon)(c,"chevron-down"),c.addEventListener("click",p=>{p.stopPropagation(),this.plugin.updateBookmark(e.id,{collapsed:!e.collapsed})}),e.collapsed&&(o.addClass("collapsed"),c.style.transform="rotate(-90deg)")}if((0,h.setTooltip)(o,e.filePath),o.addEventListener("click",c=>{if(e.filePath){let p=this.app.vault.getFileByPath(e.filePath);if(p){let m=h.Keymap.isModEvent(c);this.app.workspace.getLeaf(m).openFile(p)}else new h.Notice("File not found"),this.plugin.removeBookmark(e.id)}}),o.addEventListener("mousedown",c=>{if(c.button===1&&e.filePath){c.preventDefault();let p=this.app.vault.getFileByPath(e.filePath);p&&this.app.workspace.getLeaf("tab").openFile(p)}}),e.children&&e.children.length>0){let c=t.createDiv({cls:`waypoint-bookmark-children${e.collapsed?" collapsed":""}`});this.renderBookmarkList(c,e.children,n+1)}}o.addEventListener("contextmenu",r=>{r.stopPropagation(),r.preventDefault(),this.showBookmarkContextMenu(r,e)})}}showBookmarkContextMenu(t,a){let n=new h.Menu;if(a.type==="separator"||a.type==="spacer"){n.addItem(i=>i.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(a.id))),n.showAtPosition({x:t.clientX,y:t.clientY});return}a.type==="file"?(n.addItem(i=>i.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let e=this.app.vault.getFileByPath(a.filePath);e&&this.app.workspace.getLeaf("tab").openFile(e)})),n.addSeparator(),n.addItem(i=>i.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(a))),n.addItem(i=>i.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(a))),n.addSeparator(),n.addItem(i=>i.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(a.id)))):a.type==="group"&&(a.filePath&&(n.addItem(i=>i.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let e=this.app.vault.getFileByPath(a.filePath);e&&this.app.workspace.getLeaf("tab").openFile(e)})),n.addSeparator()),n.addItem(i=>i.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(a))),n.addItem(i=>i.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(a))),n.addSeparator(),n.addItem(i=>i.setTitle("Add child bookmark").setIcon("file-plus").onClick(()=>{let e=this.app.workspace.getActiveFile();if(!e){new h.Notice("No active file");return}let s={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"file",label:e.basename,filePath:e.path,icon:"",children:[],collapsed:!1,indent:a.indent+1};a.children.push(s),this.plugin.saveWaypointData(),this.redraw()})),n.addItem(i=>i.setTitle("Add child note").setIcon("folder-plus").onClick(()=>{let e=this.app.workspace.getActiveFile();if(!e){new h.Notice("No active file");return}let s={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:e.basename,filePath:e.path,icon:"",children:[],collapsed:!1,indent:a.indent+1};a.children.push(s),this.plugin.saveWaypointData(),this.redraw()})),n.addItem(i=>i.setTitle("New sub-group").setIcon("folder-plus").onClick(()=>{let e={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:"New Group",filePath:"",icon:"",children:[],collapsed:!1,indent:a.indent+1};a.children.push(e),this.plugin.saveWaypointData(),this.redraw()})),n.addSeparator(),n.addItem(i=>i.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(a.id)))),n.showAtPosition({x:t.clientX,y:t.clientY})}showDropIndicator(t,a,n){let i=t.parentElement;i&&i.querySelectorAll(".waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(o=>{o.removeClass("waypoint-bm-drop-line"),o.removeClass("waypoint-bm-drop-below"),o.removeClass("waypoint-bm-drop-into")});let e=t.getBoundingClientRect(),s=a.clientY;if(n){let o=e.top+e.height*.25,d=e.top+e.height*.75;sd?(t.addClass("waypoint-bm-drop-line"),t.addClass("waypoint-bm-drop-below"),t.__dropAbove=!1,t.__dropInto=!1):(t.addClass("waypoint-bm-drop-into"),t.__dropAbove=!1,t.__dropInto=!0)}else{let o=s{let s=e.findIndex(o=>o.id===t);if(s>=0){let[o]=e.splice(s,1);return o}for(let o of e){let d=n(o.children);if(d)return d}return null},i=n(this.plugin.waypointData.bookmarks);if(i){if(a){let e=(s,o)=>s.id===o?!0:s.children.some(d=>e(d,o));if(i.id===a||e(i,a))return}if(a){let e=o=>{for(let d of o){if(d.id===a)return d;let r=e(d.children);if(r)return r}return null},s=e(this.plugin.waypointData.bookmarks);s&&(i.indent=s.indent+1,s.children.push(i))}else i.indent=0,this.plugin.waypointData.bookmarks.push(i);this.plugin.saveWaypointData(),this.redraw()}}createParentNoteAndMove(t,a){let n=o=>{let d=o.findIndex(r=>r.id===t);if(d>=0){let[r]=o.splice(d,1);return r}for(let r of o)if(r.children){let l=n(r.children);if(l)return l}return null},i=n(this.plugin.waypointData.bookmarks);if(!i)return;let e=o=>{for(let d of o){if(d.id===a)return d;if(d.children){let r=e(d.children);if(r)return r}}return null},s=e(this.plugin.waypointData.bookmarks);s&&(i.indent=s.indent+1,s.children.push(i),this.plugin.saveWaypointData(),this.redraw())}moveBookmarkToPosition(t,a,n){let i=d=>{let r=d.findIndex(l=>l.id===t);if(r>=0){let[l]=d.splice(r,1);return{item:l,parent:d}}for(let l of d)if(l.children){let c=i(l.children);if(c.item)return c}return{item:null,parent:[]}},{item:e}=i(this.plugin.waypointData.bookmarks);if(!e)return;let s=d=>{let r=d.findIndex(l=>l.id===a);if(r>=0)return{parent:d,idx:r};for(let l of d)if(l.children){let c=s(l.children);if(c)return c}return null},o=s(this.plugin.waypointData.bookmarks);if(!o)e.indent=0,this.plugin.waypointData.bookmarks.push(e);else{let d=n?o.idx:o.idx+1;o.parent.splice(d,0,e)}this.plugin.saveWaypointData(),this.redraw()}promptRename(t){new q(this.app,t.label,a=>{a&&a.trim()&&this.plugin.updateBookmark(t.id,{label:a.trim()})}).open()}promptIcon(t){new V(this.app,t.icon,a=>{a&&this.plugin.updateBookmark(t.id,{icon:a})}).open()}},q=class extends h.Modal{constructor(u,t,a){super(u),this.currentValue=t,this.onSubmit=a}onOpen(){this.titleEl.setText("Rename bookmark");let u=this.contentEl.createEl("input",{type:"text",value:this.currentValue});u.style.width="100%",u.style.marginBottom="12px",u.focus(),u.select();let t=this.contentEl.createDiv({cls:"modal-button-container"}),a=t.createEl("button",{text:"Cancel",cls:"mod-cta"});a.style.marginRight="8px",a.addEventListener("click",()=>this.close()),t.createEl("button",{text:"Save",cls:"mod-cta"}).addEventListener("click",()=>{this.onSubmit(u.value),this.close()}),u.addEventListener("keydown",i=>{i.key==="Enter"&&(this.onSubmit(u.value),this.close())})}onClose(){this.contentEl.empty()}},V=class extends h.Modal{constructor(t,a,n){super(t);this.allIcons=[];this.tagsMap={};this.loaded=!1;this.selected=a,this.onSubmit=n}async onOpen(){let t=this.contentEl;t.style.display="flex",t.style.flexDirection="column",t.style.gap="10px",this.titleEl.setText("Change icon");let a=t.createDiv({cls:"waypoint-icon-preview"});a.style.display="flex",a.style.alignItems="center",a.style.gap="10px",a.style.padding="12px 16px",a.style.borderRadius="8px",a.style.background="var(--background-secondary)",a.style.minHeight="48px";let n=a.createSpan();n.style.display="flex",this.selected&&(0,h.setIcon)(n,this.selected);let i=a.createSpan();i.style.fontWeight="var(--font-medium)",i.style.fontSize="var(--font-ui-medium)",i.setText(this.selected||"No icon");let e=t.createEl("input",{type:"text",placeholder:"Type to search (e.g. arrow, chart, home)..."});Object.assign(e.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)"}),e.focus();let s=t.createDiv({cls:"waypoint-icon-grid"});s.style.display="grid",s.style.gridTemplateColumns="repeat(auto-fill, minmax(52px, 1fr))",s.style.gap="4px",s.style.maxHeight="320px",s.style.overflowY="auto",s.style.padding="2px 0";let o=t.createDiv();o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.fontSize="var(--font-ui-smaller)",o.style.color="var(--text-muted)",o.style.padding="0 4px";let d=o.createSpan();d.setText("Loading\u2026");let r=o.createSpan();r.style.cursor="var(--cursor)",r.style.color="var(--text-accent)",r.setText("No icon"),r.addEventListener("click",()=>{this.onSubmit(""),this.close()}),this.loadIcons().then(()=>{this.loaded=!0,d.setText(this.allIcons.length+" icons"),c(e.value)});let l=null,c=x=>{if(s.empty(),!this.loaded){s.createDiv({text:"Loading\u2026"});return}let y=x.toLowerCase().trim(),w=y?this.allIcons.filter(F=>{if(F.includes(y))return!0;let P=this.tagsMap[F];return P?P.some(g=>g.includes(y)):!1}).slice(0,80):this.allIcons.slice(0,80);if(w.length===0){let F=s.createDiv();F.style.gridColumn="1 / -1",F.style.textAlign="center",F.style.color="var(--text-muted)",F.style.padding="20px",F.setText('No icons match "'+x+'"');return}for(var L=0;Lnew N(e,this)),this.addSettingTab(new O(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let e=this.app.workspace.getLeavesOfType(C);if(e.length>0)await this.app.workspace.revealLeaf(e[0]);else{let s=this.app.workspace.getLeftLeaf(!1);s&&(await s.setViewState({type:C}),await this.app.workspace.revealLeaf(s))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let e=this.app.workspace.getActiveFile();if(!e){new f.Notice("No active file");return}this.addBookmark(e.path,e.basename,"file"),new f.Notice(`Bookmarked: ${e.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)())}});let t=["next","prev"],a=["daily","weekly","monthly","quarterly","yearly"],n={next:"Next",prev:"Previous"};for(let e of a)for(let s of t){let o=`waypoint-go-to-${s}-${e}`,d=`${n[s]} ${e} note`;this.addCommand({id:o,name:d,callback:async()=>{await this.navigatePeriodNote(s)}})}this.registerEvent(this.app.workspace.on("file-open",e=>{e&&this.onFileOpen(e)})),this.registerEvent(this.app.vault.on("create",()=>this.onVaultChange())),this.registerEvent(this.app.vault.on("delete",()=>this.onVaultChange())),this.registerEvent(this.app.vault.on("rename",(e,s)=>this.onRename(e,s))),this.app.workspace.onLayoutReady(()=>{if(this.app.workspace.getLeavesOfType(C).length===0){let s=this.app.workspace.getLeftLeaf(!1);s&&s.setViewState({type:C})}});let i=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let e=new Date().toDateString();e!==i&&(i=e,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(C)}async loadSettings(){let t=await this.loadData(),a=(t==null?void 0:t.settings)||{};this.settings=Object.assign({},W,a)}async saveSettings(){let t=await this.loadData()||{};t.settings=this.settings,await this.saveData(t)}async loadWaypointData(){let t=await this.loadData(),a=(t==null?void 0:t.waypointData)||{};this.waypointData=Object.assign({},Z,a),this.recentFiles=this.waypointData.recentFiles||[],this.recentFiles.length>this.settings.recentFiles.maxItems&&(this.recentFiles=this.recentFiles.slice(0,this.settings.recentFiles.maxItems),this.waypointData.recentFiles=this.recentFiles)}enforceRecentFilesLimit(){this.recentFiles.length>this.settings.recentFiles.maxItems&&(this.recentFiles=this.recentFiles.slice(0,this.settings.recentFiles.maxItems),this.persistRecentFiles())}async saveWaypointData(){this.waypointData.recentFiles=this.recentFiles;let t=await this.loadData()||{};t.waypointData=this.waypointData,await this.saveData(t)}persistRecentFiles(){this.waypointData.recentFiles=this.recentFiles,this.recentFilesSaveTimer&&clearTimeout(this.recentFilesSaveTimer),this.recentFilesSaveTimer=setTimeout(()=>{this.saveWaypointData()},300)}onFileOpen(t){this.settings.recentFiles.updateOn!=="file-edit"&&this.addToRecentFiles(t)}addToRecentFiles(t){if(this.settings.recentFiles.omittedPaths.length>0)for(let a of this.settings.recentFiles.omittedPaths)try{if(new RegExp(a).test(t.path))return}catch(n){}this.recentFiles=this.recentFiles.filter(a=>a.path!==t.path),this.recentFiles.unshift({path:t.path,basename:t.basename}),this.recentFiles.length>this.settings.recentFiles.maxItems&&(this.recentFiles=this.recentFiles.slice(0,this.settings.recentFiles.maxItems)),this.persistRecentFiles(),this.broadcastRedraw()}onRename(t,a){let n=this.recentFiles.find(i=>i.path===a);n&&(n.path=t.path,n.basename=t.basename||t.name.replace(/\.[^/.]+$/,""),this.persistRecentFiles(),this.broadcastRedraw()),this.updateBookmarkPath(a,t.path)}onVaultChange(){this.broadcastRedraw()}addBookmark(t,a,n="file",i=""){let s={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:n,label:a,filePath:n==="file"?t:"",icon:i,children:[],collapsed:!1,indent:0};return this.waypointData.bookmarks.push(s),this.saveWaypointData(),this.broadcastRedraw(),s}removeBookmark(t){let a=n=>{let i=n.findIndex(e=>e.id===t);if(i>=0)return n.splice(i,1),!0;for(let e of n)if(e.children&&a(e.children))return!0;return!1};a(this.waypointData.bookmarks),this.saveWaypointData(),this.broadcastRedraw()}updateBookmark(t,a){let n=e=>{for(let s of e){if(s.id===t)return s;if(s.children){let o=n(s.children);if(o)return o}}return null},i=n(this.waypointData.bookmarks);i&&(Object.assign(i,a),this.saveWaypointData(),this.broadcastRedraw())}updateBookmarkPath(t,a){let n=i=>{for(let e of i)e.filePath===t&&(e.filePath=a),e.children&&n(e.children)};n(this.waypointData.bookmarks)}async openPeriodNote(t,a){let i={day:{settings:this.settings.daily,label:"Daily"},week:{settings:this.settings.weekly,label:"Weekly"},month:{settings:this.settings.monthly,label:"Monthly"},quarter:{settings:this.settings.quarterly,label:"Quarterly"},year:{settings:this.settings.yearly,label:"Yearly"}}[t];if(!i)return;let{settings:e}=i,s=a.format(e.nameFormat)+".md",o=e.folder?`${e.folder}/${s}`:s,d=this.app.vault.getFileByPath(o);if(!d){try{let r=e.templateFile+".md",l=this.app.vault.getFileByPath(r);if(l){let c=await this.app.vault.read(l);d=await this.app.vault.create(o,c)}else{let c=`---
type: ${e.typeProperty}
-date: ${i.format("YYYY-MM-DD")}
+date: ${a.format("YYYY-MM-DD")}
---
-`;d=await this.app.vault.create(s,c)}}catch(n){new f.Notice(`Failed to create ${a.label.toLowerCase()} note: ${n.message}`);return}new f.Notice(`Created ${a.label.toLowerCase()} note: ${r}`)}d&&await this.app.workspace.getLeaf(!1).openFile(d)}async openPeriodNoteInLeaf(t,i,o){let e={day:{settings:this.settings.daily,label:"Daily"},week:{settings:this.settings.weekly,label:"Weekly"},month:{settings:this.settings.monthly,label:"Monthly"},quarter:{settings:this.settings.quarterly,label:"Quarterly"},year:{settings:this.settings.yearly,label:"Yearly"}}[t];if(!e)return;let{settings:r}=e,s=i.format(r.nameFormat)+".md",d=r.folder?`${r.folder}/${s}`:s,n=this.app.vault.getFileByPath(d);if(!n)try{let l=r.templateFile+".md",c=this.app.vault.getFileByPath(l);if(c){let h=await this.app.vault.read(c);n=await this.app.vault.create(d,h)}else{let h=`---
-type: ${r.typeProperty}
-date: ${i.format("YYYY-MM-DD")}
+`;d=await this.app.vault.create(o,c)}}catch(r){new f.Notice(`Failed to create ${i.label.toLowerCase()} note: ${r.message}`);return}new f.Notice(`Created ${i.label.toLowerCase()} note: ${s}`)}d&&await this.app.workspace.getLeaf(!1).openFile(d)}async openPeriodNoteInLeaf(t,a,n){let e={day:{settings:this.settings.daily,label:"Daily"},week:{settings:this.settings.weekly,label:"Weekly"},month:{settings:this.settings.monthly,label:"Monthly"},quarter:{settings:this.settings.quarterly,label:"Quarterly"},year:{settings:this.settings.yearly,label:"Yearly"}}[t];if(!e)return;let{settings:s}=e,o=a.format(s.nameFormat)+".md",d=s.folder?`${s.folder}/${o}`:o,r=this.app.vault.getFileByPath(d);if(!r)try{let l=s.templateFile+".md",c=this.app.vault.getFileByPath(l);if(c){let p=await this.app.vault.read(c);r=await this.app.vault.create(d,p)}else{let p=`---
+type: ${s.typeProperty}
+date: ${a.format("YYYY-MM-DD")}
---
-`;n=await this.app.vault.create(d,h)}}catch(l){new f.Notice(`Failed to create ${e.label.toLowerCase()} note: ${l.message}`);return}n&&await o.openFile(n)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,f.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,f.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,f.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,f.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,f.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let i=this.app.workspace.getActiveFile();if(!i){new f.Notice("No active file");return}let o=this.detectPeriodType(i.basename);if(!o){new f.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:a,date:e}=o;if(!e.isValid()){new f.Notice(`Could not parse date from filename: ${i.basename}`);return}let r=t==="next"?1:-1,s=a==="quarter"?e.clone().add(r*3,"months"):e.clone().add(r,`${a}s`);await this.openPeriodNote(a,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(P);for(let i of t)i.view instanceof Y&&i.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(i=>i.extension==="md"&&i.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(i=>i.extension==="md"&&i.basename===t)}};
+`;r=await this.app.vault.create(d,p)}}catch(l){new f.Notice(`Failed to create ${e.label.toLowerCase()} note: ${l.message}`);return}r&&await n.openFile(r)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,f.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,f.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,f.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,f.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,f.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let a=this.app.workspace.getActiveFile();if(!a){new f.Notice("No active file");return}let n=this.detectPeriodType(a.basename);if(!n){new f.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:i,date:e}=n;if(!e.isValid()){new f.Notice(`Could not parse date from filename: ${a.basename}`);return}let s=t==="next"?1:-1,o=i==="quarter"?e.clone().add(s*3,"months"):e.clone().add(s,`${i}s`);await this.openPeriodNote(i,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(C);for(let a of t)a.view instanceof N&&a.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(a=>a.extension==="md"&&a.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(a=>a.extension==="md"&&a.basename===t)}};
diff --git a/manifest.json b/manifest.json
index 5075a5a..c89f5b9 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"id": "waypoint-sidebar",
"name": "Waypoint Sidebar",
- "version": "1.4.1",
+ "version": "1.5.0",
"minAppVersion": "0.16.3",
"description": "Calendar, recent files, and custom bookmarks sidebar.",
"author": "Olivier",
diff --git a/package.json b/package.json
index ef60b9c..a376bfc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "waypoint",
- "version": "1.4.1",
+ "version": "1.5.0",
"description": "Calendar, recent files, and custom bookmarks sidebar.",
"main": "main.js",
"scripts": {
diff --git a/src/settings-tab.ts b/src/settings-tab.ts
index 4cc22b7..2e1174a 100644
--- a/src/settings-tab.ts
+++ b/src/settings-tab.ts
@@ -220,6 +220,21 @@ export class WaypointSettingTab extends PluginSettingTab {
this.saveAndRefresh();
};
});
+
+ const filterDesc = new DocumentFragment();
+ filterDesc.appendText('Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property.');
+ new Setting(container)
+ .setName('Filter tags')
+ .setDesc(filterDesc)
+ .addTextArea((text) => {
+ text.inputEl.setAttr('rows', 4);
+ text.setPlaceholder('meeting\nperson\nproject');
+ text.setValue(this.settings.recentFiles.filterTags.join('\n'));
+ text.inputEl.onblur = () => {
+ this.settings.recentFiles.filterTags = text.getValue().split('\n').filter(t => t.trim());
+ this.saveAndRefresh();
+ };
+ });
}
// ═══════════════════════════════
diff --git a/src/settings.ts b/src/settings.ts
index 1777575..5ca7491 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -17,6 +17,7 @@ export interface RecentFilesSettings {
updateOn: 'file-open' | 'file-edit';
omittedPaths: string[];
omittedTags: string[];
+ filterTags: string[]; // tags to show as filter pills (empty = auto-detect from frontmatter)
}
export interface DisplaySettings {
@@ -79,6 +80,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
updateOn: 'file-open',
omittedPaths: [],
omittedTags: [],
+ filterTags: [],
},
display: {
rowSize: 26,
diff --git a/src/views/waypoint-view.ts b/src/views/waypoint-view.ts
index deb9aa4..f4e9603 100644
--- a/src/views/waypoint-view.ts
+++ b/src/views/waypoint-view.ts
@@ -241,14 +241,34 @@ export class WaypointView extends ItemView {
}
// ── Type filter bar ──
- const typeCounts: Record = {};
- for (const file of this.plugin.recentFiles) {
- const tfile = this.app.vault.getAbstractFileByPath(file.path);
- if (tfile instanceof TFile) {
- const cache = this.app.metadataCache.getFileCache(tfile);
- const type = cache?.frontmatter?.type;
- if (type && typeof type === 'string') {
- typeCounts[type] = (typeCounts[type] || 0) + 1;
+ const configuredTags = this.plugin.settings.recentFiles.filterTags;
+ let typeCounts: Record = {};
+
+ if (configuredTags.length > 0) {
+ // Use configured tags — count occurrences in recent files
+ for (const tag of configuredTags) {
+ typeCounts[tag] = 0;
+ }
+ for (const file of this.plugin.recentFiles) {
+ const tfile = this.app.vault.getAbstractFileByPath(file.path);
+ if (tfile instanceof TFile) {
+ const cache = this.app.metadataCache.getFileCache(tfile);
+ const type = cache?.frontmatter?.type;
+ if (type && typeof type === 'string' && typeCounts.hasOwnProperty(type)) {
+ typeCounts[type]++;
+ }
+ }
+ }
+ } else {
+ // Auto-detect from frontmatter `type` property
+ for (const file of this.plugin.recentFiles) {
+ const tfile = this.app.vault.getAbstractFileByPath(file.path);
+ if (tfile instanceof TFile) {
+ const cache = this.app.metadataCache.getFileCache(tfile);
+ const type = cache?.frontmatter?.type;
+ if (type && typeof type === 'string') {
+ typeCounts[type] = (typeCounts[type] || 0) + 1;
+ }
}
}
}
@@ -262,7 +282,9 @@ export class WaypointView extends ItemView {
this.redraw();
});
// Type pills
- const sortedTypes = Object.entries(typeCounts).sort(([,a], [,b]) => b - a);
+ const sortedTypes = configuredTags.length > 0
+ ? Object.entries(typeCounts) // preserve configured order
+ : Object.entries(typeCounts).sort(([,a], [,b]) => b - a); // sort by count
for (const [type, count] of sortedTypes) {
const pill = filterBar.createSpan({ cls: `waypoint-recent-pill${this.recentFilesFilter === type ? ' is-active' : ''}` });
pill.setText(`${type} ${count}`);