0){var Dt=i&4&&p===0?r:null;if(l){for(B=0;B ${t} An error occurred: P.includes(N))&&(Ke(`Boosting field "${C}" x${D} for ${_}`),E.score*=D)}for(let C of l)(E.tags??[]).includes(C)&&(E.score*=100)}Ke("Sorting and limiting results"),o=o.sort((E,_)=>_.score-E.score).slice(0,50),Ke("Filtered results:",o),o.length&&Ke("First result:",o[0]);let d=await Promise.all(o.map(async E=>{let _=await this.plugin.documentsRepository.getDocument(E.id);return _||(console.warn(`Omnisearch - Note "${E.id}" not in the live cache`),pc(!0)),_})),p=t.getExactTerms();p.length&&(Ke("Filtering with quoted terms: ",p),o=o.filter(E=>{let _=d.find(D=>D.path===E.id),y=_?.path.toLowerCase()??"",C=(_?.cleanedContent??"").toLowerCase();return p.every(D=>C.includes(D)||Wi(y,this.plugin.settings.ignoreArabicDiacritics).includes(D))}));let g=t.query.exclude.text;return g.length&&(Ke("Filtering with exclusions"),o=o.filter(E=>{let _=(d.find(y=>y.path===E.id)?.content??"").toLowerCase();return g.every(y=>!_.includes(y))})),Ke("Deduping"),o=o.filter((E,_,y)=>y.findIndex(C=>C.id===E.id)===_),o}async getSuggestions(t,r){let n;this.plugin.settings.simpleSearch?n=await this.search(t,{prefixLength:3,singleFilePath:r?.singleFilePath}):n=await this.search(t,{prefixLength:1,singleFilePath:r?.singleFilePath});let i=await Promise.all(n.map(async l=>await this.plugin.documentsRepository.getDocument(l.id))),a=i.length;for(let l=0;l{Ke("Locating matches for",l.id);let d=i.find(_=>_.path===l.id);d||(console.warn(`Omnisearch - Note "${l.id}" not in the live cache`),d={content:"",basename:l.id,path:l.id});let p=[...l.terms,...t.getExactTerms(),...t.getTags()];Ke("Matching tokens:",p),Ke("Getting matches locations...");let g=this.plugin.textProcessor.getMatches(d.content,p,t);return Ke(`Matches for note "${d.path}"`,g),{score:l.score,foundWords:p,matches:g,isEmbed:l.isEmbed,...d}});return Ke("Suggestions:",o),o}getSerializedMiniSearch(){return this.minisearch.toJSON()}getSerializedIndexedDocuments(){return Array.from(this.indexedDocuments).map(([t,r])=>({path:t,mtime:r}))}getOptions(){return{tokenize:this.tokenizer.tokenizeForIndexing.bind(this.tokenizer),extractField:(t,r)=>{if(r==="directory"){let n=t.path.split("/");return n.pop(),n.join("/")}return t[r]},processTerm:t=>(this.plugin.settings.ignoreDiacritics?Wi(t,this.plugin.settings.ignoreArabicDiacritics):t).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags","mtime"],logger(t,r,n){n==="version_conflict"&&new US.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}}}};var yh=require("obsidian");Nr();bc();var xh=class{constructor(t){this.plugin=t;this.documents=new Map;this.errorsCount=0;this.errorsWarned=!1;setInterval(()=>{this.errorsCount>0&&--this.errorsCount},1e3)}async addDocument(t){try{let r=await this.getAndMapIndexedDocument(t);if(!r.path){console.error(`Missing .path field in IndexedDocument "${r.basename}", skipping`);return}this.documents.set(t,r),this.plugin.embedsRepository.refreshEmbedsForNote(t)}catch(r){console.warn(`Omnisearch: Error while adding "${t}" to live cache`,r),this.removeDocument(t),pc()}}removeDocument(t){this.documents.delete(t)}async getDocument(t){if(this.documents.has(t))return this.documents.get(t);Ke("Generating IndexedDocument from",t),await this.addDocument(t);let r=this.documents.get(t);return r||(console.error("Omnisearch",t,"cannot be read"),pc()),r}async getAndMapIndexedDocument(t){t=(0,yh.normalizePath)(t);let r=this.plugin.app,n=r.vault.getAbstractFileByPath(t);if(!n)throw new Error(`Invalid file path: "${t}"`);if(!(n instanceof yh.TFile))throw new Error(`Not a TFile: "${t}"`);let i=null,a=this.plugin.getTextExtractor(),o=this.plugin.getAIImageAnalyzer();if(this.plugin.notesIndexer.isFilePlaintext(t))i=await r.vault.cachedRead(n);else if(Ai(t)){let g=await r.vault.cachedRead(n),E=g?JSON.parse(g):{},_=[];for(let y of E.nodes??[])y.type==="text"?_.push(y.text):y.type==="file"&&_.push(y.file);for(let y of(E.edges??[]).filter(C=>!!C.label))_.push(y.label);i=_.join(`\r
+`)}else if(hc(t))try{let g=JSON.parse(await r.vault.cachedRead(n)),E=[],_=y=>{for(let C in y)typeof y[C]=="object"?_(y[C]):C==="content"&&E.push(y[C])};_(g),i=E.join(`\r
+`)}catch(g){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(g)}else Mn(t)?this.plugin.settings.aiImageIndexing&&o?.canBeAnalyzed(n)?i=await o.analyzeImage(n):this.plugin.settings.imagesIndexing&&a?.canFileBeExtracted(t)&&(i=await a.extractText(n)):ti(t)&&this.plugin.settings.PDFIndexing&&a?.canFileBeExtracted(t)?i=await a.extractText(n):dv(t)&&this.plugin.settings.officeIndexing&&a?.canFileBeExtracted(t)?i=await a.extractText(n):this.plugin.notesIndexer.isFilenameIndexable(t)&&(i=n.path);i==null&&(console.warn(`Omnisearch: ${i} content for file`,n.path),i="");let l=r.metadataCache.getFileCache(n);if(l){let g=_v(this.plugin.app,n,l);for(let E of g.filter(_=>!this.documents.has(_))){let _=this.plugin.notesIndexer.generateIndexableNonexistingDocument(E,n.path)}if(l.frontmatter?.["excalidraw-plugin"]){let E=l.sections?.filter(_=>_.type==="comment")??[];for(let{start:_,end:y}of E.map(C=>C.position))i=i.substring(0,_.offset-1)+i.substring(y.offset)}}let d;this.plugin.settings.displayTitle==="#heading"?d=l?.headings?.find(g=>g.level===1)?.heading??"":d=l?.frontmatter?.[this.plugin.settings.displayTitle]??"";let p=fv(l);return{basename:n.basename,displayTitle:d,content:i,cleanedContent:cv(Wi(i)),path:n.path,mtime:n.stat.mtime,tags:p,unmarkedTags:p.map(g=>g.replace("#","")),aliases:lv(l).join(""),headings1:l?wf(l,1).join(" "):"",headings2:l?wf(l,2).join(" "):"",headings3:l?wf(l,3).join(" "):""}}};Nr();bc();Nr();var Ah=class{constructor(t){this.plugin=t;this.notesToReindex=new Set}flagNoteForReindex(t){this.notesToReindex.add(t)}async refreshIndex(){for(let r of this.notesToReindex)Ke("Updating file",r.path),await this.plugin.documentsRepository.addDocument(r.path);let t=[...this.notesToReindex].map(r=>r.path);t.length&&(this.plugin.searchEngine.removeFromPaths(t),await this.plugin.searchEngine.addFromPaths(t),this.notesToReindex.clear())}isFileIndexable(t){return this.isFilenameIndexable(t)||this.isContentIndexable(t)}isContentIndexable(t){let r=this.plugin.settings,n=!!this.plugin.getTextExtractor(),i=!!this.plugin.getAIImageAnalyzer(),a=n&&r.PDFIndexing,o=n&&r.imagesIndexing,l=i&&r.aiImageIndexing;return this.isFilePlaintext(t)||Ai(t)||hc(t)||a&&ti(t)||o&&Mn(t)||l&&Mn(t)}isFilenameIndexable(t){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(t)||Ai(t)||Cs(t)||hc(t)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(t,r){return t=Om(t),{path:t+(t.endsWith(".md")?"":".md"),basename:t,displayTitle:"",mtime:0,content:"",cleanedContent:"",tags:[],unmarkedTags:[],aliases:"",headings1:"",headings2:"",headings3:"",doesNotExist:!0,parent:r}}isFilePlaintext(t){return[...this.plugin.settings.indexedFileTypes,"md"].some(r=>t.endsWith(`.${r}`))}};o0();var Sh=require("obsidian");Nr();var wh=class{constructor(t){this.plugin=t;this.embeds=new Map}addEmbed(t,r){this.embeds.has(t)||this.embeds.set(t,new Set),this.embeds.get(t).add(r)}removeFile(t){this.embeds.delete(t),this.refreshEmbedsForNote(t)}renameFile(t,r){this.embeds.has(t)&&(this.embeds.set(r,this.embeds.get(t)),this.embeds.delete(t)),this.embeds.forEach((n,i)=>{n.has(t)&&(n.delete(t),n.add(r))})}refreshEmbedsForNote(t){this.embeds.forEach((r,n)=>{r.has(t)&&r.delete(t)}),this.addEmbedsForNote(t)}getEmbeds(t){return this.embeds.has(t)?[...this.embeds.get(t)]:[]}async writeToCache(){Ke("Writing embeds to cache");let t=this.plugin.database,r=[];for(let[n,i]of this.embeds)r.push({embedded:n,referencedBy:[...i]});await t.embeds.clear(),await t.embeds.bulkAdd(r)}async loadFromCache(){try{let t=this.plugin.database;if(!t.embeds){Ke("No embeds in cache");return}Ke("Loading embeds from cache");let r=await t.embeds.toArray();for(let{embedded:n,referencedBy:i}of r)for(let a of i)this.addEmbed(n,a)}catch{this.plugin.database.clearCache(),console.error("Omnisearch - Error while loading embeds cache"),new Sh.Notice("Omnisearch - There was an error while loading the cache. Please restart Obsidian.")}}addEmbedsForNote(t){let r=(this.plugin.app.metadataCache.getCache(t)?.embeds??[]).map(n=>this.plugin.app.metadataCache.getFirstLinkpathDest((0,Sh.getLinkpath)(n.link),t)).filter(n=>!!n);for(let n of r)this.addEmbed(n.path,t)}};var Ch=class{constructor(t){this.plugin=t;this.nextQueryIsEmpty=!1}async addToHistory(t){if(!t){this.nextQueryIsEmpty=!0;return}this.nextQueryIsEmpty=!1;let r=this.plugin.database,n=await r.searchHistory.toArray();n=n.filter(i=>i.query!==t).reverse(),n.unshift({query:t}),n=n.slice(0,10),await r.searchHistory.clear(),await r.searchHistory.bulkAdd(n)}async getHistory(){let t=(await this.plugin.database.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&t.unshift(""),t}};var Ih=class extends zn.Plugin{constructor(r,n){super(r,n);this.apiHttpServer=null;this.settings=kc(this.app);this.embedsRepository=new wh(this);this.database=new Mc(this);this.notesIndexer=new Ah(this);this.textProcessor=new ad(this);this.searchEngine=new Th(this);this.searchHistory=new Ch(this);this.documentsRepository=new xh(this)}async onload(){if(this.settings=await ky(this),this.addSettingTab(new id(this)),zn.Platform.isMobile||Promise.resolve().then(()=>(KS(),YS)).then(i=>this.apiHttpServer=i.getServer(this)),Nf(this.app)){console.debug("Plugin disabled");return}await lF(this.app),await this.database.clearOldDatabases(),rA(this);let r=this.settings;r.ribbonIcon&&this.addRibbonButton(),Me.disable("vault"),Me.disable("infile"),Me.on("global",yf.ToggleExcerpts,()=>{Fa.set(!r.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new ta(this).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(i,a)=>{a.file&&new Rs(this,a.file).open()}});let n=this.searchEngine;this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",i=>{i instanceof zn.TFile&&this.notesIndexer.isFileIndexable(i.path)&&(Ke("Indexing new file",i.path),n.addFromPaths([i.path]),this.embedsRepository.refreshEmbedsForNote(i.path))})),this.registerEvent(this.app.vault.on("delete",i=>{i instanceof zn.TFile&&(Ke("Removing file",i.path),this.documentsRepository.removeDocument(i.path),n.removeFromPaths([i.path]),this.embedsRepository.removeFile(i.path))})),this.registerEvent(this.app.vault.on("modify",async i=>{i instanceof zn.TFile&&(this.notesIndexer.isFileIndexable(i.path)&&this.notesIndexer.flagNoteForReindex(i),this.embedsRepository.refreshEmbedsForNote(i.path))})),this.registerEvent(this.app.vault.on("rename",async(i,a)=>{i instanceof zn.TFile&&this.notesIndexer.isFileIndexable(i.path)&&(Ke("Renaming file",i.path),this.documentsRepository.removeDocument(a),await this.documentsRepository.addDocument(i.path),n.removeFromPaths([a]),await n.addFromPaths([i.path]),this.embedsRepository.renameFile(a,i.path))})),this.refreshIndexCallback=this.notesIndexer.refreshIndex.bind(this.notesIndexer),addEventListener("blur",this.refreshIndexCallback),removeEventListener,await this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&r.httpApiEnabled&&this.apiHttpServer.listen(r.httpApiPort)})}async executeFirstLaunchTasks(){let r="1.21.0";this.settings.welcomeMessage=r,await this.saveData(this.settings)}async onunload(){delete globalThis.omnisearch,this.refreshIndexCallback&&removeEventListener("blur",this.refreshIndexCallback),await this.database.clearCache(),this.apiHttpServer.close()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",r=>{new ta(this).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}getChsSegmenter(){return this.app.plugins?.plugins?.["cm-chs-patch"]}getTextExtractor(){return this.app.plugins?.plugins?.["text-extractor"]?.api}getAIImageAnalyzer(){return this.app.plugins?.plugins?.["ai-image-analyzer"]?.api}async populateIndex(){console.time("Indexing total time"),Ca.set(2);let r=this.app.vault.getFiles().filter(a=>this.notesIndexer.isFileIndexable(a.path));console.debug(`${r.length} files total`),console.debug(`Cache is ${Qi()?"enabled":"disabled"}`);let n=this.searchEngine;Qi()&&(console.time("Loading index from cache"),Ca.set(1),await n.loadCache()&&console.timeEnd("Loading index from cache"));let i=n.getDocumentsToReindex(r.map(a=>({path:a.path,mtime:a.stat.mtime})));if(Qi()&&(i.toAdd.length&&console.debug("Total number of files to add/update: "+i.toAdd.length),i.toRemove.length&&console.debug("Total number of files to remove: "+i.toRemove.length)),i.toAdd.length>=1e3&&Qi()&&new zn.Notice(`${i.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),Ca.set(3),n.removeFromPaths(i.toRemove.map(a=>a.path)),await n.addFromPaths(i.toAdd.map(a=>a.path)),(i.toRemove.length||i.toAdd.length)&&Qi()){Ca.set(4);let a=this.settings.useCache;a&&!this.settings.DANGER_forceSaveCache&&(this.settings.useCache=!1,await ke(this)),await this.database.writeMinisearchCache(),await this.embedsRepository.writeToCache(),a&&(this.settings.useCache=!0,await ke(this))}console.timeEnd("Indexing total time"),i.toAdd.length>=1e3&&Qi()&&new zn.Notice("Your files have been indexed."),Ca.set(0),tA()}};async function lF(e){let t=[`${e.vault.configDir}/plugins/omnisearch/searchIndex.json`,`${e.vault.configDir}/plugins/omnisearch/notesCache.json`,`${e.vault.configDir}/plugins/omnisearch/notesCache.data`,`${e.vault.configDir}/plugins/omnisearch/searchIndex.data`,`${e.vault.configDir}/plugins/omnisearch/historyCache.json`,`${e.vault.configDir}/plugins/omnisearch/pdfCache.data`];for(let r of t)if(await e.vault.adapter.exists(r))try{await e.vault.adapter.remove(r)}catch{}}
+/*! Bundled license information:
+
+lodash-es/lodash.js:
+ (**
+ * @license
+ * Lodash (Custom Build) Your existing weekly-note settings from the Calendar plugin have been
+ migrated over automatically. The functionality will be removed from
+ the Calendar plugin in the future.
+ ${n?`\u{1F44D} You have installed Text Extractor, Omnisearch can use it to index PDFs and images contents.
+
Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:'\u26A0\uFE0F Omnisearch requires Text Extractor to index PDFs and images.'}
+ ${i?'
\u{1F44D} You have installed AI Image Analyzer, Omnisearch can use it to index images contents with ai.':'
\u26A0\uFE0F Omnisearch requires AI Image Analyzer to index images with ai.'}`)),new Ji.Setting(r).setName(`PDFs content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(ar("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(p=>p.setValue(t.PDFIndexing).onChange(async g=>{await a.clearCache(),t.PDFIndexing=g,await ke(e)})).setDisabled(!n),new Ji.Setting(r).setName(`Images OCR indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(ar("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(p=>p.setValue(t.imagesIndexing).onChange(async g=>{await a.clearCache(),t.imagesIndexing=g,await ke(e)})).setDisabled(!n);let l=new DocumentFragment;l.createSpan({},p=>{p.innerHTML='Omnisearch will use Text Extractor to index the content of your office documents (currently .docx
and .xlsx
).'}),new Ji.Setting(r).setName(`Documents content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(l).addToggle(p=>p.setValue(t.officeIndexing).onChange(async g=>{await a.clearCache(),t.officeIndexing=g,await ke(e)})).setDisabled(!n);let d=new DocumentFragment;d.createSpan({},p=>{p.innerHTML=`Omnisearch will use AI Image Analyzer to index the content of your images with ai.
+ \u26A0\uFE0F If both AI Image Analyzer and Text Extractor are enabled, Text Extractor will only be used as a fallback.`}),new Ji.Setting(r).setName(`Images AI indexing ${i?"":"\u26A0\uFE0F Disabled"}`).setDesc(d).addToggle(p=>p.setValue(t.aiImageIndexing).onChange(async g=>{await a.clearCache(),t.aiImageIndexing=g,await ke(e)})).setDisabled(!i),new Ji.Setting(r).setName("Index paths of unsupported files").setDesc(ar(`
+ Omnisearch can index filenames of "unsupported" files, such as e.g. .mp4
+ or non-extracted PDFs & images.
+ "Obsidian setting" will respect the value of "Files & Links > Detect all file extensions".`)).addDropdown(p=>{p.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(t.unsupportedFilesIndexing).onChange(async g=>{await o(),t.unsupportedFilesIndexing=g,await ke(e)})}),new Ji.Setting(r).setName("Set frontmatter property key as title").setDesc(ar(`If you have a custom property in your notes that you want to use as the title in search results. If you set this to '#heading', then use the first heading from a file as the title.
+ Leave empty to disable.`)).addText(p=>{p.setValue(t.displayTitle).onChange(async g=>{await o(),t.displayTitle=g,await ke(e)})}),new Ji.Setting(r).setName("Additional TEXT files to index").setDesc(ar(`In addition to standard md files, Omnisearch can also index other PLAINTEXT files.
+ Add extensions separated by a space, without the dot. Example: "txt org csv".
+ \u26A0\uFE0F Using extensions of non-plaintext files (like .pptx) WILL cause crashes,
+ because Omnisearch will try to index their content.`)).addText(p=>{p.setValue(t.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async g=>{await a.clearCache(),t.indexedFileTypes=g.split(" "),await ke(e)})})}var Ji,vy=v(()=>{Ji=require("obsidian");mr();mr();Dc()});function Ty(e,t,r){let n=e.database;new rn.Setting(r).setName("Behavior").setHeading(),new rn.Setting(r).setName("Save index to cache").setDesc("Enable caching to speed up indexing time. In rare cases, the cache write may cause a crash in Obsidian. This option will disable itself if it happens.").addToggle(i=>i.setValue(t.useCache).onChange(async a=>{t.useCache=a,await ke(e)})),new rn.Setting(r).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(i=>i.setValue(t.showPreviousQueryResults).onChange(async a=>{t.showPreviousQueryResults=a,await ke(e)})),new rn.Setting(r).setName(`Respect Obsidian's "Excluded Files"`).setDesc(`By default, files that are in Obsidian's "Options > Files & Links > Excluded Files" list are downranked in results.
+ Enable this option to completely hide them.`).addToggle(i=>i.setValue(t.hideExcluded).onChange(async a=>{t.hideExcluded=a,await ke(e)})),new rn.Setting(r).setName("Folders to downrank in search results").setDesc("Folders to downrank in search results. Files in these folders will be downranked in results. They will still be indexed for tags, unlike excluded files. Folders should be comma delimited.").addText(i=>{i.setValue(t.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async a=>{let o=a.split(",");o=o.map(l=>l.trim()),t.downrankedFoldersFilters=o,await ke(e)})}),new rn.Setting(r).setName("Split CamelCaseWords").setDesc(ar(`Enable this if you want to be able to search for CamelCaseWords as separate words.
+ \u26A0\uFE0F Changing this setting will clear the cache.
+ ${Ao}`)).addToggle(i=>i.setValue(t.splitCamelCase).onChange(async a=>{await n.clearCache(),t.splitCamelCase=a,await ke(e)})),new rn.Setting(r).setName("Simpler search").setDesc(`Enable this if Obsidian often freezes while making searches.
+ Words shorter than 3 characters won't be used as prefixes; this can reduce search delay but will return fewer results.`).addToggle(i=>i.setValue(t.simpleSearch).onChange(async a=>{t.simpleSearch=a,await ke(e)})),rn.Platform.isIosApp||new rn.Setting(r).setName("Tokenize URLs").setDesc(`Enable this if you want to be able to search for URLs as separate words.
+ This setting has a strong impact on indexing performance, and can crash Obsidian under certain conditions.`).addToggle(i=>i.setValue(t.tokenizeUrls).onChange(async a=>{t.tokenizeUrls=a,await ke(e)})),new rn.Setting(r).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(i=>i.setValue(t.openInNewPane).onChange(async a=>{t.openInNewPane=a,await ke(e)})),new rn.Setting(r).setName("Set Vim like navigation keys").setDesc(`Navigate down the results with ${vn()} + J/N, or navigate up with ${vn()} + K/P.`).addToggle(i=>i.setValue(t.vimLikeNavigationShortcut).onChange(async a=>{t.vimLikeNavigationShortcut=a,await ke(e)})),new rn.Setting(r).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(i=>i.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(t.fuzziness).onChange(async a=>{["0","1","2"].includes(a)||(a="2"),t.fuzziness=a,await ke(e)}))}var rn,xy=v(()=>{rn=require("obsidian");mr();mr();Nr()});function yy(e,t,r){new Ma.Setting(r).setName("User Interface").setHeading(),new Ma.Setting(r).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(n=>n.setValue(t.ribbonIcon).onChange(async i=>{t.ribbonIcon=i,await ke(e),i?e.addRibbonButton():e.removeRibbonButton()})),new Ma.Setting(r).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(n=>n.setValue(t.showExcerpt).onChange(async i=>{Fa.set(i)})),new Ma.Setting(r).setName("Show embed references").setDesc(ar(`Some results are embedded in other notes.
+ This setting controls the maximum number of embeds to show in the search results. Set to 0 to disable.
+ Also works with Text Extractor for embedded images and documents.`)).addSlider(n=>{n.setLimits(0,10,1).setValue(t.maxEmbeds).setDynamicTooltip().onChange(async i=>{t.maxEmbeds=i,await ke(e)})}),new Ma.Setting(r).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(n=>n.setValue(t.renderLineReturnInExcerpts).onChange(async i=>{t.renderLineReturnInExcerpts=i,await ke(e)})),new Ma.Setting(r).setName('Show "Create note" button').setDesc(ar(`Shows a button next to the search input, to create a note.
+ Acts the same as the shift \u21B5 shortcut, can be useful for mobile device users.`)).addToggle(n=>n.setValue(t.showCreateButton).onChange(async i=>{t.showCreateButton=i,await ke(e)})),new Ma.Setting(r).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(n=>n.setValue(t.highlight).onChange(async i=>{t.highlight=i,await ke(e)}))}var Ma,Ay=v(()=>{Ma=require("obsidian");wo();mr();mr()});function Sy(e,t,r,n){function i(o,l){o.setLimits(1,10,.5).setValue(t[l]).setDynamicTooltip().onChange(async d=>{t[l]=d,await ke(e)})}let a=kc(e.app);new Fn.Setting(r).setName("Results weighting").setHeading(),new Fn.Setting(r).setName(`File name & declared aliases (default: ${a.weightBasename})`).addSlider(o=>i(o,"weightBasename")),new Fn.Setting(r).setName(`File directory (default: ${a.weightDirectory})`).addSlider(o=>i(o,"weightDirectory")),new Fn.Setting(r).setName(`Headings level 1 (default: ${a.weightH1})`).addSlider(o=>i(o,"weightH1")),new Fn.Setting(r).setName(`Headings level 2 (default: ${a.weightH2})`).addSlider(o=>i(o,"weightH2")),new Fn.Setting(r).setName(`Headings level 3 (default: ${a.weightH3})`).addSlider(o=>i(o,"weightH3")),new Fn.Setting(r).setName(`Tags (default: ${a.weightUnmarkedTags})`).addSlider(o=>i(o,"weightUnmarkedTags")),new Fn.Setting(r).setName("Header properties fields").setDesc('You can set custom weights for values of header properties (e.g. "keywords"). Weights under 1.0 will downrank the results.');for(let o=0;o
+ \u26A0\uFE0F You probably should NOT disable this.
+ \u26A0\uFE0F Changing this setting will clear the cache.
+ ${Ao}`)).addToggle(a=>a.setValue(t.ignoreDiacritics).onChange(async o=>{await n.clearCache(),t.ignoreDiacritics=o,await ke(e)})),new wi.Setting(r).setName("Ignore Arabic diacritics (beta)").addToggle(a=>a.setValue(t.ignoreArabicDiacritics).onChange(async o=>{await n.clearCache(),t.ignoreArabicDiacritics=o,await ke(e)}));let i=new DocumentFragment;i.createSpan({},a=>{a.innerHTML=`Disable Omnisearch on this device only.
+ ${Ao}`}),new wi.Setting(r).setName("Disable on this device").setDesc(i).addToggle(a=>a.setValue(Nf(e.app)).onChange(async o=>{o?(e.app.saveLocalStorage(Ss,"1"),new wi.Notice("Omnisearch - Disabled. Please restart Obsidian.")):(e.app.saveLocalStorage(Ss),new wi.Notice("Omnisearch - Enabled. Please restart Obsidian."))})),new wi.Setting(r).setName("Force save the cache").setDesc(ar(`Omnisearch has a security feature that automatically disables cache writing if it cannot fully perform the operation.
+ Use this option to force the cache to be saved, even if it causes a crash.
+ \u26A0\uFE0F Enabling this setting could lead to crash loops`)).addToggle(a=>a.setValue(t.DANGER_forceSaveCache).onChange(async o=>{t.DANGER_forceSaveCache=o,await ke(e)})),Qi()&&new wi.Setting(r).setName("Clear cache data").setDesc(ar(`Erase all Omnisearch cache data.
+ Use this if Omnisearch results are inconsistent, missing, or appear outdated.
+ ${Ao}`)).addButton(a=>{a.setButtonText("Clear cache"),a.onClick(async()=>{await n.clearCache()})})}var wi,Dy=v(()=>{wi=require("obsidian");mr();mr();mr();en()});function kc(e){return{useCache:!0,hideExcluded:!1,recencyBoost:"0",downrankedFoldersFilters:[],ignoreDiacritics:!0,ignoreArabicDiacritics:!1,indexedFileTypes:[],displayTitle:"",PDFIndexing:!1,officeIndexing:!1,imagesIndexing:!1,aiImageIndexing:!1,unsupportedFilesIndexing:"default",splitCamelCase:!1,openInNewPane:!1,vimLikeNavigationShortcut:e.vault.getConfig("vimMode"),ribbonIcon:!0,showExcerpt:!0,maxEmbeds:5,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,tokenizeUrls:!1,fuzziness:"1",weightBasename:10,weightDirectory:7,weightH1:6,weightH2:5,weightH3:4,weightUnmarkedTags:2,weightCustomProperties:[],httpApiEnabled:!1,httpApiPort:"51361",httpApiNotice:!0,welcomeMessage:"",verboseLogging:!1,DANGER_httpHost:null,DANGER_forceSaveCache:!1}}async function ky(e){return Or=Object.assign({},kc(e.app),await e.loadData()),Fa.set(Or.showExcerpt),Sm(Or.verboseLogging),Or}var Rc,Fa,id,Or,wo=v(()=>{Rc=require("obsidian");Em();en();Nr();vy();mr();xy();Ay();Cy();Ny();Dy();Fa=yo(!1),id=class extends Rc.PluginSettingTab{constructor(r){super(r.app,r);this.plugin=r,Fa.subscribe(async n=>{Or.showExcerpt=n,await ke(this.plugin)})}display(){let{containerEl:r}=this,n=this.plugin.database;if(r.empty(),this.app.loadLocalStorage(Ss)=="1"){let a=r.createEl("span");a.innerHTML='\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F'}r.createEl("h1",{text:"Omnisearch"});let i=r.createDiv();i.innerHTML=`
+
+
+ `,Ey(this.plugin,Or,r),r.createEl("hr"),Ty(this.plugin,Or,r),r.createEl("hr"),yy(this.plugin,Or,r),r.createEl("hr"),Sy(this.plugin,Or,r,this.display),r.createEl("hr"),Iy(this.plugin,Or,r),r.createEl("hr"),Oy(this.plugin,Or,r),r.createEl("hr"),new Rc.Setting(r).setName("Debugging").setHeading(),new Rc.Setting(r).setName("Enable verbose logging").setDesc('Adds a LOT of logs for debugging purposes. You also need to enable "Verbose" logging in the console to see these logs.').addToggle(a=>a.setValue(Or.verboseLogging).onChange(async o=>{Or.verboseLogging=o,Sm(o),await ke(this.plugin)}))}}});function a0(e){var t=_6();we(e,t)}var _6,Ry=v(()=>{Wn();yi();Pn();_6=Le('')});function Lc(e,t){let r=ze(t,"id",8),n=ze(t,"selected",8,!1),i=ze(t,"glyph",8,!1),a=ze(t,"cssClass",8,"");var o=b6();let l;var d=xe(o);{var p=E=>{a0(E,{})};tt(d,E=>{i()&&E(p)})}var g=Ye(d,2);zi(g,t,"default",{},null),Te(o),rr(E=>{Ki(o,"data-result-id",r()),l=Yi(o,1,`suggestion-item omnisearch-result ${a()??""}`,null,l,E)},[()=>({"is-selected":n()})],Br),pr("mousemove",o,function(E){Jr.call(this,t,E)}),pr("click",o,function(E){Jr.call(this,t,E)}),pr("keypress",o,function(E){Jr.call(this,t,E)}),pr("auxclick",o,function(E){Jr.call(this,t,E)}),we(e,o)}var b6,s0=v(()=>{Wn();yi();Pn();Ry();b6=Le("
")),t}catch(i){return new Ly.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(i),""}}}});async function Py(e){let t=e.app;if(!t.plugins.getPlugin("obsidian-icon-folder"))return{};let n=`${t.vault.configDir}/plugins/obsidian-icon-folder/data.json`;try{let i=await t.vault.adapter.read(n),a=JSON.parse(i),o={};for(let l in a){let d=(0,qo.normalizePath)(l);o[d]=a[l]}return o}catch(i){return Gi("Failed to read data.json:",i),{}}}async function My(e){let t={Li:"lucide-icons"},r="icons",n=e.app,i=n.plugins.getPlugin("obsidian-icon-folder");if(i){r=i.settings?.iconPacksPath||"icons";let o=`${n.vault.configDir}/${r}`;try{let l=await n.vault.adapter.list(o);if(l.folders&&l.folders.length>0)for(let d of l.folders){let p=d.split("/"),g=p[p.length-1],E=E6(g);t[E]=g}}catch(l){Gi("Failed to list icon packs:",l)}}return{prefixToIconPack:t,iconsPath:r}}function E6(e){if(e.includes("-")){let t=e.split("-"),r=t[0].charAt(0).toUpperCase();for(let n=1;n
You have enabled "Simpler Search" in the settings, try to type more
+ characters.`,1),V6=Le("We found 0 results for your search here. ",1),q6=Le(' ',1),z6=Le('
+`:"'+(n?t:xn(t,!0))+`
+`}blockquote(t){return`"+(n?t:xn(t,!0))+`
+${t}
+`}html(t,r){return t}heading(t,r,n){return`
+`}list(t,r,n){let i=r?"ol":"ul",a=r&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
+`+t+""+i+`>
+`}listitem(t,r,n){return`
+
+`+t+`
+`+r+`
+`}tablerow(t){return`
+${t}
+`}tablecell(t,r){let n=r.header?"th":"td";return(r.align?`<${n} align="${r.align}">`:`<${n}>`)+t+`${n}>
+`}strong(t){return`${t}`}em(t){return`${t}`}codespan(t){return`${t}`}br(){return"
"}del(t){return`${t}`}link(t,r,n){let i=bA(t);if(i===null)return n;t=i;let a='"+n+"",a}image(t,r,n){let i=bA(t);if(i===null)return n;t=i;let a=`",a}text(t){return t}},Ko=class{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,r,n){return""+n}image(t,r,n){return""+n}br(){return""}},An=class{options;renderer;textRenderer;constructor(t){this.options=t||Tt.defaults,this.options.renderer=this.options.renderer||new Ps,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ko}static parse(t,r){return new An(r).parse(t)}static parseInline(t,r){return new An(r).parseInline(t)}parse(t,r=!0){let n="";for(let i=0;i
"+xn(n.message+"",!0)+"
";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},Ms=new Ad;function st(e,t){return Ms.parse(e,t)}st.options=st.setOptions=function(e){return Ms.setOptions(e),st.defaults=Ms.defaults,xA(st.defaults),st};st.getDefaults=wd;st.defaults=Tt.defaults;st.use=function(...e){return Ms.use(...e),st.defaults=Ms.defaults,xA(st.defaults),st};st.walkTokens=function(e,t){return Ms.walkTokens(e,t)};st.parseInline=Ms.parseInline;st.Parser=An;st.parser=An.parse;st.Renderer=Ps;st.TextRenderer=Ko;st.Lexer=yn;st.lexer=yn.lex;st.Tokenizer=Ls;st.Hooks=Ba;st.parse=st;var zR=st.options,YR=st.setOptions,KR=st.use,jR=st.walkTokens,WR=st.parseInline,GR=st,QR=An.parse,XR=yn.lex;Tt.Hooks=Ba;Tt.Lexer=yn;Tt.Marked=Ad;Tt.Parser=An;Tt.Renderer=Ps;Tt.TextRenderer=Ko;Tt.Tokenizer=Ls;Tt.getDefaults=wd;Tt.lexer=XR;Tt.marked=st;Tt.options=zR;Tt.parse=GR;Tt.parseInline=WR;Tt.parser=QR;Tt.setOptions=YR;Tt.use=KR;Tt.walkTokens=jR});function RA(e){return e.type===Ze.Tag||e.type===Ze.Script||e.type===Ze.Style}var Ze,LA,PA,MA,FA,BA,$A,HA,UA,VA,jo=v(()=>{(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(Ze||(Ze={}));LA=Ze.Root,PA=Ze.Text,MA=Ze.Directive,FA=Ze.Comment,BA=Ze.Script,$A=Ze.Style,HA=Ze.Tag,UA=Ze.CDATA,VA=Ze.Doctype});function _e(e){return RA(e)}function Wo(e){return e.type===Ze.CDATA}function nn(e){return e.type===Ze.Text}function Hs(e){return e.type===Ze.Comment}function Id(e){return e.type===Ze.Directive}function Bn(e){return e.type===Ze.Root}function ht(e){return Object.prototype.hasOwnProperty.call(e,"children")}function Go(e,t=!1){let r;if(nn(e))r=new Ni(e.data);else if(Hs(e))r=new Fs(e.data);else if(_e(e)){let n=t?B0(e.children):[],i=new $s(e.name,{...e.attribs},n);n.forEach(a=>a.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...e["x-attribsPrefix"]}),r=i}else if(Wo(e)){let n=t?B0(e.children):[],i=new zc(n);n.forEach(a=>a.parent=i),r=i}else if(Bn(e)){let n=t?B0(e.children):[],i=new wn(n);n.forEach(a=>a.parent=i),e["x-mode"]&&(i["x-mode"]=e["x-mode"]),r=i}else if(Id(e)){let n=new Bs(e.name,e.data);e["x-name"]!=null&&(n["x-name"]=e["x-name"],n["x-publicId"]=e["x-publicId"],n["x-systemId"]=e["x-systemId"]),r=n}else throw new Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}function B0(e){let t=e.map(r=>Go(r,!0));for(let r=1;r
If you have an custom hotkeys for daily notes, make sure to update
+ them to use the new "Periodic Notes" commands.`;
+
+ attr(p, "class", "setting-item-description");
+ },
+ m(target, anchor) {
+ insert(target, p, anchor);
+ },
+ d(detaching) {
+ if (detaching) detach(p);
+ }
+ };
+}
+
+// (42:8) {:else}
+function create_else_block_1(ctx) {
+ let button;
+ let mounted;
+ let dispose;
+
+ return {
+ c() {
+ button = element("button");
+ button.textContent = "Migrate";
+ attr(button, "class", "mod-cta svelte-1alo0m9");
+ },
+ m(target, anchor) {
+ insert(target, button, anchor);
+
+ if (!mounted) {
+ dispose = listen(button, "click", function () {
+ if (is_function(/*migrateDailyNoteSettings*/ ctx[2])) /*migrateDailyNoteSettings*/ ctx[2].apply(this, arguments);
+ });
+
+ mounted = true;
+ }
+ },
+ p(new_ctx, dirty) {
+ ctx = new_ctx;
+ },
+ i: noop,
+ o: noop,
+ d(detaching) {
+ if (detaching) detach(button);
+ mounted = false;
+ dispose();
+ }
+ };
+}
+
+// (40:8) {#if $settings.hasMigratedDailyNoteSettings}
+function create_if_block_4(ctx) {
+ let button;
+ let t;
+ let checkmark;
+ let current;
+ checkmark = new Checkmark({});
+
+ return {
+ c() {
+ button = element("button");
+ t = text("Migrated ");
+ create_component(checkmark.$$.fragment);
+ button.disabled = true;
+ attr(button, "class", "svelte-1alo0m9");
+ },
+ m(target, anchor) {
+ insert(target, button, anchor);
+ append(button, t);
+ mount_component(checkmark, button, null);
+ current = true;
+ },
+ p: noop,
+ i(local) {
+ if (current) return;
+ transition_in(checkmark.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(checkmark.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ if (detaching) detach(button);
+ destroy_component(checkmark);
+ }
+ };
+}
+
+// (51:2) {#if hasWeeklyNoteSettings}
+function create_if_block_1$2(ctx) {
+ let div2;
+ let div0;
+ let t3;
+ let div1;
+ let current_block_type_index;
+ let if_block;
+ let current;
+ const if_block_creators = [create_if_block_2, create_else_block];
+ const if_blocks = [];
+
+ function select_block_type_2(ctx, dirty) {
+ if (/*$settings*/ ctx[5].hasMigratedWeeklyNoteSettings) return 0;
+ return 1;
+ }
+
+ current_block_type_index = select_block_type_2(ctx);
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
+
+ return {
+ c() {
+ div2 = element("div");
+ div0 = element("div");
+
+ div0.innerHTML = `Weekly Note settings migrated
+ p)throw new Error(`Chunk size (${L}) is larger than the maximum chunk size (${p}). Please check your chunk separator.`);let w=await G(m,{chunk:z});H.push(w)}let F=ch(b,Z,c,d,Y),J=["prompting",`${H.length} prompts being sent.`];l.setMessage(J[0],J[1]);let E=new _n(5,1e3*30),Q=Promise.all(H.map(z=>E.add(()=>F(z)))),k=(await $n(Q,100,z=>{l.setMessage(J[0],`${J[1]} (${(z/1e3).toFixed(2)}s)`)},z=>{l.setMessage("finished",`Took ${(z/1e3).toFixed(2)}s.`)})).map(z=>z.content).join(I.resultJoiner),f=("> "+k).replace(/\n/g,`
+> `),r={[W]:k,[`${W}-quoted`]:f};return setTimeout(()=>l.hide(),5e3),r}catch(Z){throw l.setMessage("dead",Z.message),setTimeout(()=>l.hide(),5e3),Z}}var pd=require("obsidian"),UY=class b extends pd.Modal{constructor(G,l,Z=[]){super(G);this.items=l;this.selectedItems=Z;this._selectedItems=[...Z],this.promise=new Promise((c,W)=>{this.resolvePromise=c,this.rejectPromise=W}),this.display(),this.open()}static Open(G,l,Z){return new b(G,l,Z).promise}display(){this.contentEl.empty(),this.containerEl.addClass("quickAddModal","checkboxPrompt"),this.addCheckboxRows(),this.addSubmitButton()}onClose(){super.onClose(),this.resolved||this.rejectPromise("no input given.")}addCheckboxRows(){let G=this.contentEl.createDiv("checkboxRowContainer");this.items.forEach(l=>this.addCheckboxRow(l,G))}addCheckboxRow(G,l){let Z=l.createDiv("checkboxRow");Z.createEl("span",{text:G}),new pd.ToggleComponent(Z).setTooltip(`Toggle ${G}`).setValue(this._selectedItems.contains(G)).onChange(W=>{if(W)this._selectedItems.push(G);else{let d=this._selectedItems.findIndex(m=>G===m);this._selectedItems.splice(d,1)}})}addSubmitButton(){let G=this.contentEl.createDiv("submitButtonContainer");new pd.ButtonComponent(G).setButtonText("Submit").setCta().onClick(Z=>{this.resolved=!0,this.resolvePromise(this._selectedItems),this.close()})}};var dh=require("obsidian"),BY=class b extends dh.Modal{constructor(G,l,Z){super(G);this.header=l;this.text=Z;this.waitForClose=new Promise(c=>{this.resolvePromise=c}),this.open(),this.display()}static Show(G,l,Z){return new b(G,l,Z).waitForClose}display(){this.contentEl.empty(),this.titleEl.textContent=this.header,String.isString(this.text)?this.contentEl.createEl("p",{text:this.text}):Array.isArray(this.text)&&this.text.forEach(Z=>this.contentEl.createEl("p",{text:Z}));let G=this.contentEl.createDiv(),l=new dh.ButtonComponent(G).setButtonText("OK").onClick(()=>this.close());Object.assign(G.style,{display:"flex",justifyContent:"flex-end"}),l.buttonEl.focus()}onClose(){super.onClose(),this.resolvePromise()}};var td=require("obsidian");var bW=class b extends td.Modal{constructor(G,l,Z,c,W){super(G);this.header=l;this.linkSourcePath=W;this.didSubmit=!1;this.submitClickCallback=G=>this.submit();this.cancelClickCallback=G=>this.cancel();this.submitEnterCallback=G=>{(G.ctrlKey||G.metaKey)&&G.key==="Enter"&&(G.preventDefault(),this.submit())};this.placeholder=Z??"",this.input=c??"",this.waitForClose=new Promise((d,m)=>{this.resolvePromise=d,this.rejectPromise=m}),this.display(),this.open(),this.fileSuggester=new Rd(G,this.inputComponent.inputEl,{sourcePath:this.linkSourcePath}),this.tagSuggester=new Fd(G,this.inputComponent.inputEl)}static Prompt(G,l,Z,c){return new b(G,l,Z,c,void 0).waitForClose}static PromptWithContext(G,l,Z,c,W){return new b(G,l,Z,c,W).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaWideInputPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header;let G=this.contentEl.createDiv();this.inputComponent=this.createInputField(G,this.placeholder,this.input),this.createButtonBar(G)}createInputField(G,l,Z){let c=new td.TextAreaComponent(G);return c.inputEl.classList.add("wideInputPromptInputEl"),c.inputEl.setAttribute("dir","auto"),c.setPlaceholder(l??"").setValue(Z??"").onChange(W=>this.input=W).inputEl.addEventListener("keydown",this.submitEnterCallback),c}createButton(G,l,Z){let c=new td.ButtonComponent(G);return c.setButtonText(l).onClick(Z),c}createButtonBar(G){let l=G.createDiv();this.createButton(l,"Ok",this.submitClickCallback).setCta().buttonEl.style.marginRight="0",this.createButton(l,"Cancel",this.cancelClickCallback),l.style.display="flex",l.style.flexDirection="row-reverse",l.style.justifyContent="flex-start",l.style.marginTop="1rem",l.style.gap="0.5rem"}escapeBackslashes(G){return G.replace(/\\/g,"\\\\")}submit(){this.didSubmit||(this.didSubmit=!0,this.input=this.escapeBackslashes(this.input),this.close())}cancel(){this.close()}resolveInput(){this.didSubmit?this.resolvePromise(this.input):this.rejectPromise("No input given.")}removeInputListener(){this.inputComponent.inputEl.removeEventListener("keydown",this.submitEnterCallback)}onOpen(){super.onOpen(),this.inputComponent.inputEl.focus(),this.inputComponent.inputEl.select()}onClose(){super.onClose(),this.resolveInput(),this.removeInputListener()}};var OY=require("obsidian"),Vb=class b extends OY.Modal{constructor(G,l,Z){super(G);this.header=l;this.text=Z;this.didSubmit=!1;this.waitForClose=new Promise((c,W)=>{this.resolvePromise=c,this.rejectPromise=W}),this.open(),this.display()}static Prompt(G,l,Z){return new b(G,l,Z).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaYesNoPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header,this.contentEl.createEl("p",{text:this.text});let G=this.contentEl.createDiv({cls:"yesNoPromptButtonContainer"}),l=new OY.ButtonComponent(G).setButtonText("No").onClick(()=>this.submit(!1)),Z=new OY.ButtonComponent(G).setButtonText("Yes").onClick(()=>this.submit(!0)).setWarning();Z.buttonEl.focus(),Mo([l.buttonEl,Z.buttonEl])}submit(G){this.input=G,this.didSubmit=!0,this.close()}onClose(){super.onClose(),this.didSubmit?this.resolvePromise(this.input):this.rejectPromise("No answer given.")}};function Mo(b){b.forEach(I=>{I.addEventListener("keydown",G=>{if(G.key==="ArrowRight"||G.key==="ArrowLeft"){let Z=(b.indexOf(I)+(G.key==="ArrowRight"?1:-1)+b.length)%b.length;b[Z].focus(),G.preventDefault()}})})}var dG=require("obsidian");var ed=class{static parse(I){let G=I.split("|").map(c=>c.trim()),l=G[0],Z={};for(let c=1;c