<ahref='https://ko-fi.com/B0B6LQ2C'target='_blank'><imgheight='36'style='border:0px;height:36px;'src='https://cdn.ko-fi.com/cdn/kofi2.png?v=3'border='0'alt='Buy Me a Coffee at ko-fi.com'/></a>
${r?`\u{1F44D} You have installed <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a>, Omnisearch can use it to index PDFs and images contents.
<br/>Textextractiononlyworksondesktop,butthecachecanbesynchronizedwithyourmobiledevice.`:'\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}
${i?'<br/>\u{1F44D} You have installed <a href="https://github.com/Swaggeroo/obsidian-ai-image-analyzer">AI Image Analyzer</a>, Omnisearch can use it to index images contents with ai.':'<br/>\u26A0\uFE0F Omnisearch requires <a href="https://github.com/Swaggeroo/obsidian-ai-image-analyzer">AI Image Analyzer</a> to index images with ai.'}`)),new Z.Setting(e).setName(`PDFscontentindexing${r?"":"\u26A0\uFE0F Disabled"}`).setDesc(St("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(f=>f.setValue(V.PDFIndexing).onChange(async h=>{await n.clearCache(),V.PDFIndexing=h,await ce(this.plugin)})).setDisabled(!r),new Z.Setting(e).setName(`ImagesOCRindexing${r?"":"\u26A0\uFE0F Disabled"}`).setDesc(St("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(f=>f.setValue(V.imagesIndexing).onChange(async h=>{await n.clearCache(),V.imagesIndexing=h,await ce(this.plugin)})).setDisabled(!r);let o=new DocumentFragment;o.createSpan({},f=>{f.innerHTML='Omnisearch will use Text Extractor to index the content of your office documents (currently <pre style="display:inline">.docx</pre> and <pre style="display:inline">.xlsx</pre>).'}),new Z.Setting(e).setName(`Documentscontentindexing${r?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(f=>f.setValue(V.officeIndexing).onChange(async h=>{await n.clearCache(),V.officeIndexing=h,await ce(this.plugin)})).setDisabled(!r);let u=new DocumentFragment;u.createSpan({},f=>{f.innerHTML="Omnisearch will use AI Image Analyzer to index the content of your images with ai."}),new Z.Setting(e).setName(`ImagesAIindexing${i?"":"\u26A0\uFE0F Disabled"}`).setDesc(u).addToggle(f=>f.setValue(V.aiImageIndexing).onChange(async h=>{await n.clearCache(),V.aiImageIndexing=h,await ce(this.plugin)})).setDisabled(!i),new Z.Setting(e).setName("Index paths of unsupported files").setDesc(St(`
"Obsidian setting"willrespectthevalueof"Files & Links > Detect all file extensions".`)).addDropdown(f=>{f.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(V.unsupportedFilesIndexing).onChange(async h=>{await s(),V.unsupportedFilesIndexing=h,await ce(this.plugin)})}),new Z.Setting(e).setName("Set frontmatter property key as title").setDesc(St(`Ifyouhaveacustompropertyinyournotesthatyouwanttouseasthetitleinsearchresults.Ifyousetthisto'#heading',thenusethefirstheadingfromafileasthetitle.<br>
Leaveemptytodisable.`)).addText(f=>{f.setValue(V.displayTitle).onChange(async h=>{await s(),V.displayTitle=h,await ce(this.plugin)})}),new Z.Setting(e).setName("Additional TEXT files to index").setDesc(St(`Inadditiontostandard<code>md</code>files,Omnisearchcanalsoindexother<strongstyle="color:var(--text-accent)">PLAINTEXT</strong>files.<br/>
Enablethisoptiontocompletelyhidethem.`).addToggle(f=>f.setValue(V.hideExcluded).onChange(async h=>{V.hideExcluded=h,await ce(this.plugin)})),new Z.Setting(e).setName("Recency boost (experimental)").setDesc("Files that have been modified more recently than [selected cutoff] are given a higher rank.").addDropdown(f=>f.addOptions({[Rt.Disabled]:"Disabled",[Rt.Day]:"24 hours",[Rt.Week]:"7 days",[Rt.Month]:"30 days"}).setValue(V.recencyBoost).onChange(async h=>{V.recencyBoost=h,await ce(this.plugin)})),new Z.Setting(e).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(f=>{f.setValue(V.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async h=>{let p=h.split(",");p=p.map(b=>b.trim()),V.downrankedFoldersFilters=p,await ce(this.plugin)})}),new Z.Setting(e).setName("Split CamelCaseWords").setDesc(St(`EnablethisifyouwanttobeabletosearchforCamelCaseWordsasseparatewords.<br/>
Thissettinghasastrongimpactonindexingperformance,andcancrashObsidianundercertainconditions.`).addToggle(f=>f.setValue(V.tokenizeUrls).onChange(async h=>{V.tokenizeUrls=h,await ce(this.plugin)})),new Z.Setting(e).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(f=>f.setValue(V.openInNewPane).onChange(async h=>{V.openInNewPane=h,await ce(this.plugin)})),new Z.Setting(e).setName("Set Vim like navigation keys").setDesc(`Navigatedowntheresultswith${Lt()}+J/N,ornavigateupwith${Lt()}+K/P.`).addToggle(f=>f.setValue(V.vimLikeNavigationShortcut).onChange(async h=>{V.vimLikeNavigationShortcut=h,await ce(this.plugin)})),new Z.Setting(e).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(f=>f.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(V.fuzziness).onChange(async h=>{["0","1","2"].includes(h)||(h="2"),V.fuzziness=h,await ce(this.plugin)})),new Z.Setting(e).setName("User Interface").setHeading(),new Z.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(f=>f.setValue(V.ribbonIcon).onChange(async h=>{V.ribbonIcon=h,await ce(this.plugin),h?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new Z.Setting(e).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(f=>f.setValue(V.showExcerpt).onChange(async h=>{Ir.set(h)})),new Z.Setting(e).setName("Show embed references").setDesc(St(`Someresultsare<ahref="https://help.obsidian.md/Linking+notes+and+files/Embed+files">embedded</a>inothernotes.<br>
AlsoworkswithTextExtractorforembeddedimagesanddocuments.`)).addSlider(f=>{f.setLimits(0,10,1).setValue(V.maxEmbeds).setDynamicTooltip().onChange(async h=>{V.maxEmbeds=h,await ce(this.plugin)})}),new Z.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(f=>f.setValue(V.renderLineReturnInExcerpts).onChange(async h=>{V.renderLineReturnInExcerpts=h,await ce(this.plugin)})),new Z.Setting(e).setName('Show "Create note" button').setDesc(St(`Showsabuttonnexttothesearchinput,tocreateanote.
Actsthesameasthe<code>shift\u21B5</code> shortcut, can be useful for mobile device users.`)).addToggle(f=>f.setValue(V.showCreateButton).onChange(async h=>{V.showCreateButton=h,await ce(this.plugin)})),new Z.Setting(e).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(f=>f.setValue(V.highlight).onChange(async h=>{V.highlight=h,await ce(this.plugin)}));let l=Oo(this.app);new Z.Setting(e).setName("Results weighting").setHeading(),new Z.Setting(e).setName(`File name & declared aliases (default: ${l.weightBasename})`).addSlider(f=>this.weightSlider(f,"weightBasename")),new Z.Setting(e).setName(`File directory (default: ${l.weightDirectory})`).addSlider(f=>this.weightSlider(f,"weightDirectory")),new Z.Setting(e).setName(`Headings level 1 (default: ${l.weightH1})`).addSlider(f=>this.weightSlider(f,"weightH1")),new Z.Setting(e).setName(`Headings level 2 (default: ${l.weightH2})`).addSlider(f=>this.weightSlider(f,"weightH2")),new Z.Setting(e).setName(`Headings level 3 (default: ${l.weightH3})`).addSlider(f=>this.weightSlider(f,"weightH3")),new Z.Setting(e).setName(`Tags (default: ${l.weightUnmarkedTags})`).addSlider(f=>this.weightSlider(f,"weightUnmarkedTags")),new Z.Setting(e).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 f=0;f<V.weightCustomProperties.length;f++){let h=V.weightCustomProperties[f];new Z.Setting(e).setName((f+1).toString()+".").addText(p=>{p.setPlaceholder("Property name").setValue(h.name).onChange(async b=>{h.name=b,await ce(this.plugin)})}).addSlider(p=>{p.setLimits(.1,5,.1).setValue(h.weight).setDynamicTooltip().onChange(async b=>{h.weight=b,await ce(this.plugin)})}).addButton(p=>{p.setButtonText("Remove"),p.onClick(async()=>{V.weightCustomProperties.splice(f,1),await ce(this.plugin),this.display()})})}new Z.Setting(e).addButton(f=>{f.setButtonText("Add a new property"),f.onClick(h=>{V.weightCustomProperties.push({name:"",weight:1}),this.display()})}),Z.Platform.isMobile||(new Z.Setting(e).setName("API Access Through HTTP").setHeading().setDesc(St('Omnisearch can be used through a simple HTTP server (<a href="https://publish.obsidian.md/omnisearch/Public+API+%26+URL+Scheme#HTTP+Server">more information</a>).')),new Z.Setting(e).setName("EnabletheHTTPserver").addToggle(f=>f.setValue(V.httpApiEnabled).onChange(async h=>{V.httpApiEnabled=h,h?this.plugin.apiHttpServer.listen(V.httpApiPort):this.plugin.apiHttpServer.close(),await ce(this.plugin)})),new Z.Setting(e).setName("HTTPPort").addText(f=>{f.setValue(V.httpApiPort).setPlaceholder("51361").onChange(async h=>{parseInt(h)>65535&&(h=V.httpApiPort,f.setValue(V.httpApiPort)),V.httpApiPort=h,V.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(V.httpApiPort)),await ce(this.plugin)})}),new Z.Setting(e).setName("Showanotificationwhentheserverstarts").setDesc("Willdisplayanotificationiftheserverisenabled,atObsidianstartup.").addToggle(f=>f.setValue(V.httpApiNotice).onChange(async h=>{V.httpApiNotice=h,await ce(this.plugin)}))),new Z.Setting(e).setName("Debugging").setHeading(),new Z.Setting(e).setName("Enableverboselogging").setDesc("AddsaLOToflogsfordebuggingpurposes.Don'tforgettodisableit.").addToggle(f=>f.setValue(V.verboseLogging).onChange(async h=>{V.verboseLogging=h,Dc(h),await ce(this.plugin)})),new Z.Setting(e).setName("DangerZone").setHeading(),new Z.Setting(e).setName("Ignorediacritics").setDesc(St(`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
`,"<br>")),e}catch(s){return new pb.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(s),""}}}});async function mb(t){let e=t.app;if(!e.plugins.getPlugin("obsidian-icon-folder"))return{};let r=`${e.vault.configDir}/plugins/obsidian-icon-folder/data.json`;try{let s=await e.vault.adapter.read(r),i=JSON.parse(s),a={};for(let o in i){let u=(0,bs.normalizePath)(o);a[u]=i[o]}return a}catch(s){return mn("Failed to read data.json:",s),{}}}async function gb(t){let e={Li:"lucide-icons"},n="icons",r=t.app,s=r.plugins.getPlugin("obsidian-icon-folder");if(s){n=s.settings?.iconPacksPath||"icons";let a=`${r.vault.configDir}/${n}`;try{let o=await r.vault.adapter.list(a);if(o.folders&&o.folders.length>0)for(let u of o.folders){let l=u.split("/"),d=l[l.length-1],f=EI(d);e[f]=d}}catch(o){mn("Failed to list icon packs:",o)}}return{prefixToIconPack:e,iconsPath:n}}function EI(t){if(t.includes("-")){let e=t.split("-"),n=e[0].charAt(0).toUpperCase();for(let r=1;r<e.length;r++)n+=e[r].charAt(0).toLowerCase();return n}return t.charAt(0).toUpperCase()+t.charAt(1).toLowerCase()}function bl(t,e){let n=(0,bs.normalizePath)(t),r=e[n];if(r){if(typeof r=="string")return r;if(typeof r=="object"&&r.iconName)return r.iconName}return null}function TI(t){let e=t.match(/^[A-Z][a-z]*/);if(e){let n=e[0],r=t.substring(n.length);return{prefix:n,name:r}}else return{prefix:"",name:t}}async function _l(t,e,n,r){let s=TI(t),{prefix:i,name:a}=s;if(!i)return`<spanclass="omnisearch-result__icon--emoji">${ml(a)}</span>`;let o=r[i];if(!o)return mn(`No icon pack found for prefix: ${i}`),null;if(o==="lucide-icons"){let u=a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),l=(0,bs.getIcon)(u);returnl?l.outerHTML:(mn(`Lucide icon not found: ${u}`),null)}else{if(!n)returnmn("Icons path is not set. Cannot load icon SVG."),null;letu=`${e.app.vault.configDir}/${n}/${o}/${a}.svg`;try{returnawaite.app.vault.adapter.read(u)}catch(l){returnmn(`Failed to load icon SVG for ${t} at ${u}:`,l),null}}}functionEl(t,e){letn="file";on(t)?n="image":un(t)?n="file-text":(pn(t)||Qa(t))&&(n="layout-dashboard");letr=(0,bs.getIcon)(n);returnr?r.outerHTML:""}varbs,bb=A(()=>{bs=Ee(require("obsidian"));ft();gl()});functionyI(t){lete,n=t[8]&&_b(t);return{c(){n&&n.c(),e=Ot()},m(r,s){n&&n.m(r,s),X(r,e,s)},p(r,s){r[8]?n?n.p(r,s):(n=_b(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(r){n&&n.d(r),r&&G(e)}}}functionxI(t){lete;return{c(){e=U("span"),K(e,"title","The document above is embedded in this note")},m(n,r){X(n,e,r),t[15](e)},p:be,d(n){n&&G(e),t[15](null)}}}function_b(t){lete,n,r,s;return{c(){e=U("span"),K(e,"class","omnisearch-result__icon")},m(i,a){X(i,e,a),r||(s=Er(n=wb.call(null,e,t[8])),r=!0)},p(i,a){n&&Wt(n.update)&&a&256&&n.update.call(null,i[8])},d(i){i&&G(e),r=!1,s()}}}functionEb(t){lete,n,r=Kn(t[1].path)+"",s;return{c(){e=U("span"),n=He("."),s=He(r),K(e,"class","omnisearch-result__extension")},m(i,a){X(i,e,a),B(e,n),B(e,s)},p(i,a){a&2&&r!==(r=Kn(i[1].path)+"")&&Dt(s,r)},d(i){i&&G(e)}}}functionTb(t){lete,n=t[1].matches.length+"",r,s,i=(t[1].matches.length>1?"matches":"match")+"",a;return{c(){e=U("span"),r=He(n),s=He("\xA0"),a=He(i),K(e,"class","omnisearch-result__counter")},m(o,u){X(o,e,u),B(e,r),B(e,s),B(e,a)},p(o,u){u&2&&n!==(n=o[1].matches.length+"")&&Dt(r,n),u&2&&i!==(i=(o[1].matches.length>1?"matches":"match")+"")&&Dt(a,i)},d(o){o&&G(e)}}}functionyb(t){lete,n,r,s=t[2].textProcessor.highlightText(t[4],t[11])+"",i=t[7]&&xb(t);return{c(){e=U("div"),i&&i.c(),n=se(),r=U("span"),K(e,"class","omnisearch-result__folder-path")},m(a,o){X(a,e,o),i&&i.m(e,null),B(e,n),B(e,r),r.innerHTML=s},p(a,o){a[7]?i?i.p(a,o):(i=xb(a),i.c(),i.m(e,n)):i&&(i.d(1),i=null),o&2068&&s!==(s=a[2].textProcessor.highlightText(a[4],a[11])+"")&&(r.innerHTML=s)},d(a){a&&G(e),i&&i.d()}}}functionxb(t){lete,n,r,s;return{c(){e=U("span"),K(e,"class","omnisearch-result__icon")},m(i,a){X(i,e,a),r||(s=Er(n=wb.call(null,e,t[7])),r=!0)},p(i,a){n&&Wt(n.update)&&a&128&&n.update.call(null,i[7])},d(i){i&&G(e),r=!1,
Inordertobeiterable,non-arrayobjectsmusthavea[Symbol.iterator]()method.`)}var Ne=!0,$e=!1,dn;return{s:function(){z=z.call(k)},n:function(){var Q=z.next();return Ne=Q.done,Q},e:function(Q){$e=!0,dn=Q},f:function(){try{!Ne&&z.return!=null&&z.return()}finally{if($e)throw dn}}}}function l(k,L){if(!!k){if(typeof k=="string")return d(k,L);var z=Object.prototype.toString.call(k).slice(8,-1);if(z==="Object"&&k.constructor&&(z=k.constructor.name),z==="Map"||z==="Set")return Array.from(k);if(z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(z))return d(k,L)}}function d(k,L){(L==null||L>k.length)&&(L=k.length);for(var z=0,te=new Array(L);z<L;z++)te[z]=k[z];return te}function f(k,L){if(!(k instanceof L))throw new TypeError("Cannot call a class as a function")}function h(k,L){for(var z=0;z<L.length;z++){var te=L[z];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(k,te.key,te)}}function p(k,L,z){return L&&h(k.prototype,L),z&&h(k,z),Object.defineProperty(k,"prototype",{writable:!1}),k}function b(k,L,z){return L in k?Object.defineProperty(k,L,{value:z,enumerable:!0,configurable:!0,writable:!0}):k[L]=z,k}function T(k,L,z){y(k,L),L.set(k,z)}function y(k,L){if(L.has(k))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(k,L){var z=E(k,L,"get");return x(k,z)}function x(k,L){return L.get?L.get.call(k):L.value}function S(k,L,z){var te=E(k,L,"set");return w(k,te,z),z}function E(k,L,z){if(!L.has(k))throw new TypeError("attempted to "+z+" private field on non-instance");return L.get(k)}function w(k,L,z){if(L.set)L.set.call(k,z);else{if(!L.writable)throw new TypeError("attempted to set read only private field");L.value=z}}var I=typeof Symbol!="undefined"?Symbol.toStringTag:"@@toStringTag",N=new WeakMap,D=new WeakMap,P=function(){function k(L){var z=L.executor,te=z===void 0?function(){}:z,le=L.internals,Ne=le===void 0?Se():le,$e=L.promise,dn=$e===void 0?new Promise(function(nt,Q){return te(nt,Q,function(Me){Ne.onCancelList.push(Me)})}):$e;f(this,k),T(this,N,{writable:!0,value:void 0}),T(this,D,{writable:!0,value:void 0}),b(this,I,"CancelablePromise"),this.cancel=this.cancel.bind(this),S(this,N,Ne),S(this,D,dn||new Promise(function(nt,Q){return te(nt,Q,function(Me){Ne.onCancelList.push(Me)})}))}return p(k,[{key:"then",value:function(z,te){return Ce(m(this,D).then(Te(z,m(this,N)),Te(te,m(this,N))),m(this,N))}},{key:"catch",value:function(z){return Ce(m(this,D).catch(Te(z,m(this,N))),m(this,N))}},{key:"finally",value:function(z,te){var le=this;return te&&m(this,N).onCancelList.push(z),Ce(m(this,D).finally(Te(function(){if(z)return te&&(m(le,N).onCancelList=m(le,N).onCancelList.filter(function(Ne){return Ne!==z})),z()},m(this,N))),m(this,N))}},{key:"cancel",value:function(){m(this,N).isCanceled=!0;var z=m(this,N).onCancelList;m(this,N).onCancelList=[];var te=u(z),le;try{for(te.s();!(le=te.n()).done;){var Ne=le.value;if(typeof Ne=="function")try{Ne()}catch($e){console.error($e)}}}catch($e){te.e($e)}finally{te.f()}}},{key:"isCanceled",value:function(){return m(this,N).isCanceled===!0}}]),k}(),M=function(k){e(z,k);var L=r(z);function z(te){return f(this,z),L.call(this,{executor:te})}return p(z)}(P);t.CancelablePromise=M,b(M,"all",function(L){return ye(L,Promise.all(L))}),b(M,"allSettled",function(L){return ye(L,Promise.allSettled(L))}),b(M,"any",function(L){return ye(L,Promise.any(L))}),b(M,"race",function(L){return ye(L,Promise.race(L))}),b(M,"resolve",function(L){return q(Promise.resolve(L))}),b(M,"reject",function(L){return q(Promise.reject(L))}),b(M,"isCancelable",W);var $=M;t.default=$;function q(k){return Ce(k,Se())}function W(k){return k instanceof M||k instanceof P}function Te(k,L){if(k)return function(z){if(!L.isCanceled){var te=k(z);return W(te)&&L.onCancelList.push(te.cancel),te}return z}}function Ce(k,L){return new P({internals:L,promise:k})}function ye(k,L){var z=Se();return z.onCancelList.push(function(){var te=u(k),le;try{for(te.s();!(le=te.n()).done;){var Ne=le.value;W(Ne)&&Ne.cancel()}}catch($e){te.e($e)}finally{
`):[],a={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let o of s)/^ *-+: *$/.test(o)?a.align.push("right"):/^ *:-+: *$/.test(o)?a.align.push("center"):/^ *:-+ *$/.test(o)?a.align.push("left"):a.align.push(null);for(let o of r)a.header.push({text:o,tokens:this.lexer.inline(o)});for(let o of i)a.rows.push(A_(o,a.header.length).map(u=>({text:u,tokens:this.lexer.inline(u)})));return a}}lheading(e){let n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){let n=this.rules.block.paragraph.exec(e);if(n){let r=n[1].charAt(n[1].length-1)===`
`+(a.tokens?this.parseInline(a.tokens):a.text);r+=n?this.renderer.paragraph(o):o;continue}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,n){n=n||this.renderer;let r="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=a||"";continue}}switch(i.type){case"escape":{let a=i;r+=n.text(a.text);break}case"html":{let a=i;r+=n.html(a.text);break}case"link":{let a=i;r+=n.link(a.href,a.title,this.parseInline(a.tokens,n));break}case"image":{let a=i;r+=n.image(a.href,a.title,a.text);break}case"strong":{let a=i;r+=n.strong(this.parseInline(a.tokens,n));break}case"em":{let a=i;r+=n.em(this.parseInline(a.tokens,n));break}case"codespan":{let a=i;r+=n.codespan(a.text);break}case"br":{r+=n.br();break}case"del":{let a=i;r+=n.del(this.parseInline(a.tokens,n));break}case"text":{let a=i;r+=n.text(a.text);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Pr=class{options;constructor(e){this.options=e||ve.defaults}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}};Sh(Pr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var Mf=class{defaults=fu();options=this.setOptions;parse=this.#e(Pt.lex,Mt.parse);parseInline=this.#e(Pt.lexInline,Mt.parseInline);Parser=Mt;Renderer=ks;TextRenderer=ea;Lexer=Pt;Tokenizer=Ds;Hooks=Pr;constructor(...e){this.use(...e)}walkTokens(e,n){let r=[];for(let s of e)switch(r=r.concat(n.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)r=r.concat(this.walkTokens(a.tokens,n));for(let a of i.rows)for(let o of a)r=r.concat(this.walkTokens(o.tokens,n));break}case"list":{let i=s;r=r.concat(this.walkTokens(i.items,n));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);r=r.concat(this.walkTokens(o,n))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,n)))}}return r}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s=H({},r);if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=n.renderers[i.name];a?n.renderers[i.name]=function(...o){let u=i.renderer.apply(this,o);return u===!1&&(u=a.apply(this,o)),u}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=n[i.level];a?a.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),s.extensions=n),r.renderer){let i=this.defaults.renderer||new ks(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer'${a}'doesnotexist`);if(a==="options")continue;let o=a,u=r.renderer[o],l=i[o];i[o]=(...d)=>{let f=u.apply(i,d);return f===!1&&(f=l.apply(i,d)),f||""}}s.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new Ds(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer'${a}'doesnotexist`);if(["options","rules","lexer"].includes(a))continue;let o=a,u=r.tokenizer[o],l=i[o];i[o]=(...d)=>{let f=u.apply(i,d);return f===!1&&(f=l.apply(i,d)),f}}s.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Pr;for(let a in r.hooks){if(!(a in i))throw new Error(`hook'${a}'doesnotexist`);if(a==="options")continue;let o=a,u=r.hooks[o],l=i[o];Pr.passThroughHooks.has(a)?i[o]=d=>{if(this.defaults.async)return Pr
`+r).join("")):""}var E3=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],A1=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],kl=E3.concat(A1),T3={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function xs(t,e){this._e=Nr(),this.name=t,this.message=e}Ts(xs).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Dl(this._e,2))}},toString:function(){return this.name+": "+this.message}});function C1(t,e){return t+". Errors: "+Object.keys(e).map(n=>e[n].toString()).filter((n,r,s)=>s.indexOf(n)===r).join(`
`+i:""}`,this.inner=i||null):typeofs=="object"&&(this.message=`${s.name}${s.message}`,this.inner=s):(this.message=T3[e]||n,this.inner=null)}returnTs(r).from(y3),t[e]=r,t},{});ae.Syntax=SyntaxError;ae.Type=TypeError;ae.Range=RangeError;varS1=A1.reduce((t,e)=>(t[e+"Error"]=ae[e],t),{});functionx3(t,e){if(!t||tinstanceofxs||tinstanceofTypeError||tinstanceofSyntaxError||!t.name||!S1[t.name])returnt;varn=newS1[t.name](e||t.message,t);return"stack"int&&En(n,"stack",{get:function(){returnthis.inner.stack}}),n}varjo=kl.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=ae[e]),t),{});jo.ModifyError=Bo;jo.DexieError=xs;jo.BulkError=Ri;functionIe(){}functionLi(t){returnt}functionA3(t,e){returnt==null||t===Li?e:function(n){returne(t(n))}}functionvr(t,e){returnfunction(){t.apply(this,arguments),e.apply(this,arguments)}}functionC3(t,e){returnt===Ie?e:function(){varn=t.apply(this,arguments);n!==void0&&(arguments[0]=n);varr=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;vari=e.apply(this,arguments);returnr&&(this.onsuccess=this.onsuccess?vr(r,this.onsuccess):r),s&&(this.onerror=this.onerror?vr(s,this.onerror):s),i!==void0?i:n}}functionS3(t,e){returnt===Ie?e:function(){t.apply(this,arguments);varn=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?vr(n,this.onsuccess):n),r&&(this.onerror=this.onerror?vr(r,this.onerror):r)}}functionI3(t,e){returnt===Ie?e:function(n){varr=t.apply(this,arguments);ht(n,r);vars=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;vara=e.apply(this,arguments);returns&&(this.onsuccess=this.onsuccess?vr(s,this.onsuccess):s),i&&(this.onerror=this.onerror?vr(i,this.onerror):i),r===void0?a===void0?void0:a:ht(r,a)}}functionw3(t,e){returnt===Ie?e:function(){returne.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}functionLl(t,e){returnt===Ie?e:function(){varn=t.apply(this,arguments);if(n&&typeofn.then=="function"){for(varr=this,s=arguments.length,i=newArray(s);s--;)i[s]=arguments[s];returnn.then(function(){returne.apply(r,i)})}returne.apply(this,arguments)}}varPi={},N3=100,v3=20,I1=100,[Pl,Ho,Ml]=typeofPromise=="undefined"?[]:(()=>{lett=Promise.resolve();if(typeofcrypto=="undefined"||!crypto.subtle)return[t,Oi(t),t];lete=crypto.subtle.digest("SHA-512",newUint8Array([0]));return[e,Oi(e),t]})(),w1=Ho&&Ho.then,Uo=Pl&&Pl.constructor,Fl=!!Ml,Bl=!1,O3=Ml?()=>{Ml.then(Ko)}:ke.setImmediate?setImmediate.bind(null,Ko):ke.MutationObserver?()=>{vart=document.createElement("div");newMutationObserver(()=>{Ko(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Ko,0)},Mi=function(t,e){Fi.push([t,e]),zo&&(O3(),zo=!1)},jl=!0,zo=!0,Or=[],Vo=[],Hl=null,Ul=Li,As={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:F1,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{F1(t[0],t[1])}catch{}})}},ne=As,Fi=[],Dr=0,qo=[];functionY(t){if(typeofthis!="object")thrownewTypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Ie,this._lib=!1;vare=this._PSD=ne;if(cn&&(this._stackHolder=Nr(),this._prev=null,this._numPrev=0),typeoft!="function"){if(t!==Pi)thrownewTypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Vl(this,this._value);return}this._state=null,this._value=null,++e.ref,v1(this,t)}varzl={get:function(){vart=ne,e=$o;functionn(r,s){vari=!t.global&&(t!==ne||e!==$o);leta=i&&!xn();varo=newY((u,l)=>{ql(this,newN1(Qo(r,t,i,a),Qo(s,t,i,a),u,l,t))});returncn&&k1(o,this),o}returnn.prototype=Pi,n},set:function(t){En(this,"then",t&&t.prototype===Pi?zl:{get:function(){returnt},set:zl.set})}};Es(Y.prototype,{then:zl,_then:function(t,e){ql(this,newN1(null,null,t,e,ne))},catch:function(t){if(arguments.length===1)returnthis.then(null,t);vare=arguments[0],n=arguments[1];returntypeofe=="function"?this.then(null,r=>rinstanceofe?n(r):Wo(r)):this.then(null,r=>r&&r.name===e?n(r):Wo(r))},finally:function(t){returnthis.then(e
`)}else if(di(e))try{let d=JSON.parse(await n.vault.cachedRead(r)),f=[],h=p=>{for(let b in p)typeof p[b]=="object"?h(p[b]):b==="content"&&f.push(p[b])};h(d),s=f.join(`\r
`)}catch(d){console.error("Omnisearch: Error while parsing Dataloom file",e),console.error(d)}else on(e)&&(this.plugin.settings.imagesIndexing&&i?.canFileBeExtracted(e)||this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(r))?(this.plugin.settings.imagesIndexing&&i?.canFileBeExtracted(e)&&(s=await i.extractText(r)),this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(r)&&(s=await a.analyzeImage(r)+(s??""))):un(e)&&this.plugin.settings.PDFIndexing&&i?.canFileBeExtracted(e)?s=await i.extractText(r):e0(e)&&this.plugin.settings.officeIndexing&&i?.canFileBeExtracted(e)?s=await i.extractText(r):this.plugin.notesIndexer.isFilenameIndexable(e)&&(s=r.path);s==null&&(console.warn(`Omnisearch:${s}contentforfile`,r.path),s="");let o=n.metadataCache.getFileCache(r);if(o){let d=o0(this.plugin.app,r,o);for(let f of d.filter(h=>!this.documents.has(h))){let h=this.plugin.notesIndexer.generateIndexableNonexistingDocument(f,r.path)}if(o.frontmatter?.["excalidraw-plugin"]){let f=o.sections?.filter(h=>h.type==="comment")??[];for(let{start:h,end:p}of f.map(b=>b.position))s=s.substring(0,h.offset-1)+s.substring(p.offset)}}let u;this.plugin.settings.displayTitle==="#heading"?u=o?.headings?.find(d=>d.level===1)?.heading??"":u=o?.frontmatter?.[this.plugin.settings.displayTitle]??"";let l=Jh(o);return{basename:r.basename,displayTitle:u,content:s,cleanedContent:Xh(hn(s)),path:r.path,mtime:r.stat.mtime,tags:l,unmarkedTags:l.map(d=>d.replace("#","")),aliases:Zh(o).join(""),headings1:o?Ya(o,1).join(" "):"",headings2:o?Ya(o,2).join(" "):"",headings3:o?Ya(o,3).join(" "):""}}countError(){++this.errorsCount>5&&!this.errorsWarned&&(this.errorsWarned=!0,new ti.Notice("Omnisearch \u26A0\uFE0F There might be an issue with your cache. You should clean it in Omnisearch settings and restart Obsidian."))}};ft();pi();ft();var hh=class{constructor(e){this.plugin=e;this.notesToReindex=new Set}flagNoteForReindex(e){this.notesToReindex.add(e)}async refreshIndex(){for(let n of this.notesToReindex)de("Updating file",n.path),await this.plugin.documentsRepository.addDocument(n.path);let e=[...this.notesToReindex].map(n=>n.path);e.length&&(this.plugin.searchEngine.removeFromPaths(e),await this.plugin.searchEngine.addFromPaths(e),this.notesToReindex.clear())}isFileIndexable(e){return this.isFilenameIndexable(e)||this.isContentIndexable(e)}isContentIndexable(e){let n=this.plugin.settings,r=!!this.plugin.getTextExtractor(),s=!!this.plugin.getAIImageAnalyzer(),i=r&&n.PDFIndexing,a=r&&n.imagesIndexing,o=s&&n.aiImageIndexing;return this.isFilePlaintext(e)||pn(e)||di(e)||i&&un(e)||a&&on(e)||o&&on(e)}isFilenameIndexable(e){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(e)||pn(e)||di(e)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(e,n){return e=Pc(e),{path:e+(e.endsWith(".md")?"":".md"),basename:e,displayTitle:"",mtime:0,content:"",cleanedContent:"",tags:[],unmarkedTags:[],aliases:"",headings1:"",headings2:"",headings3:"",doesNotExist:!0,parent:n}}isFilePlaintext(e){return[...this.plugin.settings.indexedFileTypes,"md"].some(n=>e.endsWith(`.${n}`))}};gl();var cc=Ee(require("obsidian"));ft();var ph=class{constructor(e){this.plugin=e;this.embeds=new Map}addEmbed(e,n){this.embeds.has(e)||this.embeds.set(e,new Set),this.embeds.get(e).add(n)}removeFile(e){this.embeds.delete(e),this.refreshEmbedsForNote(e)}renameFile(e,n){this.embeds.has(e)&&(this.embeds.set(n,this.embeds.get(e)),this.embeds.delete(e)),this.embeds.forEach((r,s)=>{r.has(e)&&(r.delete(e),r.add(n))})}refreshEmbedsForNote(e){this.embeds.forEach((n,r)=>{n.has(e)&&n.delete(e)}),this.addEmbedsForNote(e)}getEmbeds(e){return this.embeds.has(e)?[...this.embeds.get(e)]:[]}async writeToCache(){de("Writing embeds to cache");let e=this.plugin.database,n=[];for(let[r,s]of this.embeds)n.push({embedded:r,referencedBy:[...s]});await e.embeds.clear(),await e.embeds.bulkAdd(n)}async loadFromCache(){try{let e=this.plugin.dat