digital-garden/.obsidian/plugins/omnisearch/main.js

104 lines
592 KiB
JavaScript
Raw Normal View History

2024-06-13 21:01:37 +03:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var My=Object.create;var $s=Object.defineProperty,ky=Object.defineProperties,Fy=Object.getOwnPropertyDescriptor,By=Object.getOwnPropertyDescriptors,jy=Object.getOwnPropertyNames,Hh=Object.getOwnPropertySymbols,Hy=Object.getPrototypeOf,Uh=Object.prototype.hasOwnProperty,Uy=Object.prototype.propertyIsEnumerable;var Wc=(e,t,r)=>t in e?$s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J=(e,t)=>{for(var r in t||(t={}))Uh.call(t,r)&&Wc(e,r,t[r]);if(Hh)for(var r of Hh(t))Uy.call(t,r)&&Wc(e,r,t[r]);return e},Fe=(e,t)=>ky(e,By(t)),Gh=e=>$s(e,"__esModule",{value:!0});var O=(e,t)=>()=>(e&&(t=e(e=0)),t);var U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qh=(e,t)=>{Gh(e);for(var r in t)$s(e,r,{get:t[r],enumerable:!0})},Gy=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of jy(t))!Uh.call(e,n)&&n!=="default"&&$s(e,n,{get:()=>t[n],enumerable:!(r=Fy(t,n))||r.enumerable});return e},Xe=e=>Gy(Gh($s(e!=null?My(Hy(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var zh=(e,t,r)=>(Wc(e,typeof t!="symbol"?t+"":t,r),r);function qe(){}function qy(e,t){for(let r in t)e[r]=t[r];return e}function Yc(e){return e()}function Vh(){return Object.create(null)}function cr(e){e.forEach(Yc)}function Pi(e){return typeof e=="function"}function ot(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Qc(e,t){return Iu||(Iu=document.createElement("a")),Iu.href=t,e===Iu.href}function Kh(e){return Object.keys(e).length===0}function Wh(e,...t){if(e==null)return qe;let r=e.subscribe(...t);return r.unsubscribe?()=>r.unsubscribe():r}function vu(e,t,r){e.$$.on_destroy.push(Wh(t,r))}function Li(e,t,r,n){if(e){let i=Yh(e,t,r,n);return e[0](i)}}function Yh(e,t,r,n){return e[1]&&n?qy(r.ctx.slice(),e[1](n(t))):r.ctx}function Mi(e,t,r,n){if(e[2]&&n){let i=e[2](n(r));if(t.dirty===void 0)return i;if(typeof i=="object"){let s=[],a=Math.max(t.dirty.length,i.length);for(let u=0;u<a;u+=1)s[u]=t.dirty[u]|i[u];return s}return t.dirty|i}return t.dirty}function ki(e,t,r,n,i,s){if(i){let a=Yh(t,r,n,s);e.p(a,i)}}function Fi(e){if(e.ctx.length>32){let t=[],r=e.ctx.length/32;for(let n=0;n<r;n++)t[n]=-1;return t}return-1}function Qh(e){return e&&Pi(e.destroy)?e.destroy:qe}function zy(){Xh=!0}function Vy(){Xh=!1}function j(e,t){e.appendChild(t)}function ae(e,t,r){e.insertBefore(t,r||null)}function se(e){e.parentNode&&e.parentNode.removeChild(e)}function Du(e,t){for(let r=0;r<e.length;r+=1)e[r]&&e[r].d(t)}function z(e){return document.createElement(e)}function dt(e){return document.createTextNode(e)}function ue(){return dt(" ")}function Xs(){return dt("")}function ht(e,t,r,n){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}function Z(e,t,r){r==null?e.removeAttribute(t):e.getAttribute(t)!==r&&e.setAttribute(t,r)}function Ky(e){return Array.from(e.childNodes)}function Sr(e,t){t=""+t,e.data!==t&&(e.data=t)}function $c(e,t){e.value=t??""}function zt(e,t,r,n){r==null?e.style.removeProperty(t):e.style.setProperty(t,r,n?"important":"")}function Xc(e,t,r){e.classList[r?"add":"remove"](t)}function Wy(e,t,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(e,r,n,t),i}function Js(e){Zs=e}function Zc(){if(!Zs)throw new Error("Function called outside component initialization");return Zs}function ea(e){Zc().$$.on_mount.push(e)}function ta(e){Zc().$$.on_destroy.push(e)}function Jc(){let e=Zc();return(t,r,{cancelable:n=!1}={})=>{let i=e.$$.callbacks[t];if(i){let s=Wy(t,r,{cancelable:n});return i.slice().forEach(a=>{a.call(e,s)}),!s.defaultPrevented}return!0}}function Vt(e,t){let r=e.$$.callbacks[t.type];r&&r.slice().forEach(n=>n.call(this,t))}function e0(){el||(el=!0,Jh.then(t0))}function pn(){return e0(),Jh}function tl(e){ji.push(e)}function t0(){if(Hi!==0)return;let e=Zs;do{try{for(;Hi<Bi.length;){let t=Bi[Hi];Hi++,Js(t),Yy(t.$$)}}catch(t){throw Bi.length=0,Hi=0,t}for(Js(null),Bi.length=0,Hi=0;Wr.length;)Wr.pop()();for(let t=0;t<ji.length;t+=1){let r=ji[t];rl.has(r)||(rl.add(r),r())}ji.length=0}while(Bi.
<iframe sandbox="allow-top-navigation-by-user-activation" src="https://github.com/sponsors/scambier/button" title="Sponsor scambier" height="35" width="116" style="border: 0;"></iframe>
<a href='https://ko-fi.com/B0B6LQ2C' target='_blank'><img height='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>
`;let s=new DocumentFragment;s.createSpan({},g=>{g.innerHTML='\u26A0\uFE0F <span style="color: var(--text-accent)">Changing indexing settings will clear the cache, and requires a restart of Obsidian.</span><br/><br/>',n?g.innerHTML+=`
\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 />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:g.innerHTML+='\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}),new ne.Setting(t).setName("Indexing").setHeading().setDesc(s);let a=new DocumentFragment;a.createSpan({},g=>{g.innerHTML="Omnisearch will use Text Extractor to index the content of your PDFs."}),new ne.Setting(t).setName(`PDFs content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(a).addToggle(g=>g.setValue(W.PDFIndexing).onChange(async p=>{await r.clearCache(),W.PDFIndexing=p,await _e(this.plugin)})).setDisabled(!n);let u=new DocumentFragment;u.createSpan({},g=>{g.innerHTML="Omnisearch will use Text Extractor to OCR your images and index their content."}),new ne.Setting(t).setName(`Images OCR indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(u).addToggle(g=>g.setValue(W.imagesIndexing).onChange(async p=>{await r.clearCache(),W.imagesIndexing=p,await _e(this.plugin)})).setDisabled(!n);let o=new DocumentFragment;o.createSpan({},g=>{g.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 ne.Setting(t).setName(`Documents content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(g=>g.setValue(W.officeIndexing).onChange(async p=>{await r.clearCache(),W.officeIndexing=p,await _e(this.plugin)})).setDisabled(!n);let c=new DocumentFragment;c.createSpan({},g=>{g.innerHTML=`
Omnisearch can index file<strong>names</strong> of "unsupported" files, such as e.g. <pre style="display:inline">.mp4</pre>
or non-extracted PDFs & images.<br/>
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions".`}),new ne.Setting(t).setName("Index paths of unsupported files").setDesc(c).addDropdown(g=>{g.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(W.unsupportedFilesIndexing).onChange(async p=>{await r.clearCache(),W.unsupportedFilesIndexing=p,await _e(this.plugin)})});let f=new DocumentFragment;f.createSpan({},g=>{g.innerHTML=`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">PLAINTEXT</strong> files.<br/>
Add extensions separated by a space, without the dot. Example: "<code>txt org csv</code>".<br />
\u26A0\uFE0F <span style="color: var(--text-accent)">Using extensions of non-plaintext files (like .pptx) WILL cause crashes,
because Omnisearch will try to index their content.</span>`}),new ne.Setting(t).setName("Additional TEXT files to index").setDesc(f).addText(g=>{g.setValue(W.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async p=>{await r.clearCache(),W.indexedFileTypes=p.split(" "),await _e(this.plugin)})}),new ne.Setting(t).setName("Behavior").setHeading(),new ne.Setting(t).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(g=>g.setValue(W.useCache).onChange(async p=>{W.useCache=p,await _e(this.plugin)})),new ne.Setting(t).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(g=>g.setValue(W.showPreviousQueryResults).onChange(async p=>{W.showPreviousQueryResults=p,await _e(this.plugin)})),new ne.Setting(t).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(g=>g.setValue(W.hideExcluded).onChange(async p=>{W.hideExcluded=p,await _e(this.plugin)})),new ne.Setting(t).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(g=>{g.setValue(W.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async p=>{let A=p.split(",");A=A.map(I=>I.trim()),W.downrankedFoldersFilters=A,await _e(this.plugin)})});let h=new DocumentFragment;h.createSpan({},g=>{g.innerHTML=`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
${ku}
`}),new ne.Setting(t).setName("Split CamelCaseWords").setDesc(h).addToggle(g=>g.setValue(W.splitCamelCase).onChange(async p=>{await r.clearCache(),W.splitCamelCase=p,await _e(this.plugin)})),new ne.Setting(t).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(g=>g.setValue(W.simpleSearch).onChange(async p=>{W.simpleSearch=p,await _e(this.plugin)})),ne.Platform.isIosApp||new ne.Setting(t).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(g=>g.setValue(W.tokenizeUrls).onChange(async p=>{W.tokenizeUrls=p,await _e(this.plugin)})),new ne.Setting(t).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(g=>g.setValue(W.openInNewPane).onChange(async p=>{W.openInNewPane=p,await _e(this.plugin)})),new ne.Setting(t).setName("Set Vim like navigation keys").setDesc("Navigate down the results with Ctrl/\u2318 + J/N, or navigate up with Ctrl/\u2318 + K/P").addToggle(g=>g.setValue(W.vimLikeNavigationShortcut).onChange(async p=>{W.vimLikeNavigationShortcut=p,await _e(this.plugin)})),new ne.Setting(t).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(g=>g.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(W.fuzziness).onChange(async p=>{["0","1","2"].includes(p)||(p="2"),W.fuzziness=p,await _e(this.plugin)})),new ne.Setting(t).setName("User Interface").setHeading(),new ne.Setting(t).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(g=>g.setValue(W.ribbonIcon).onChange(async p=>{W.ribbonIcon=p,await _e(this.plugin),p?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new ne.Setting(t).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(g=>g.setValue(W.showExcerpt).onChange(async p=>{ri.set(p)})),new ne.Setting(t).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(g=>g.setValue(W.renderLineReturnInExcerpts).onChange(async p=>{W.renderLineReturnInExcerpts=p,await _e(this.plugin)}));let d=new DocumentFragment;d.createSpan({},g=>{g.innerHTML=`Shows a button next to the search input, to create a note.
Acts the same as the <code>shift \u21B5</code> shortcut, can be useful for mobile device users.`}),new ne.Setting(t).setName('Show "Create note" button').setDesc(d).addToggle(g=>g.setValue(W.showCreateButton).onChange(async p=>{W.showCreateButton=p,await _e(this.plugin)})),new ne.Setting(t).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(g=>g.setValue(W.highlight).onChange(async p=>{W.highlight=p,await _e(this.plugin)}));let _=Fu(this.app);new ne.Setting(t).setName("Results weighting").setHeading(),new ne.Setting(t).setName(`File name & declared aliases (default: ${_.weightBasename})`).addSlider(g=>this.weightSlider(g,"weightBasename")),new ne.Setting(t).setName(`File directory (default: ${_.weightDirectory})`).addSlider(g=>this.weightSlider(g,"weightDirectory")),new ne.Setting(t).setName(`Headings level 1 (default: ${_.weightH1})`).addSlider(g=>this.weightSlider(g,"weightH1")),new ne.Setting(t).setName(`Headings level 2 (default: ${_.weightH2})`).addSlider(g=>this.weightSlider(g,"weightH2")),new ne.Setting(t).setName(`Headings level 3 (default: ${_.weightH3})`).addSlider(g=>this.weightSlider(g,"weightH3")),new ne.Setting(t).setName(`Tags (default: ${_.weightUnmarkedTags})`).addSlider(g=>this.weightSlider(g,"weightUnmarkedTags")),new ne.Setting(t).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 g=0;g<W.weightCustomProperties.length;g++){let p=W.weightCustomProperties[g];new ne.Setting(t).setName((g+1).toString()+".").addText(A=>{A.setPlaceholder("Property name").setValue(p.name).onChange(async I=>{p.name=I,await _e(this.plugin)})}).addSlider(A=>{A.setLimits(.1,5,.1).setValue(p.weight).setDynamicTooltip().onChange(async I=>{p.weight=I,await _e(this.plugin)})}).addButton(A=>{A.setButtonText("Remove"),A.onClick(async()=>{W.weightCustomProperties.splice(g,1),await _e(this.plugin),this.display()})})}if(new ne.Setting(t).addButton(g=>{g.setButtonText("Add a new property"),g.onClick(p=>{W.weightCustomProperties.push({name:"",weight:1}),this.display()})}),!ne.Platform.isMobile){let g=new DocumentFragment;g.createSpan({},p=>{p.innerHTML='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 ne.Setting(t).setName("API Access Through HTTP").setHeading().setDesc(g),new ne.Setting(t).setName("Enable the HTTP server").addToggle(p=>p.setValue(W.httpApiEnabled).onChange(async A=>{W.httpApiEnabled=A,A?this.plugin.apiHttpServer.listen(W.httpApiPort):this.plugin.apiHttpServer.close(),await _e(this.plugin)})),new ne.Setting(t).setName("HTTP Port").addText(p=>{p.setValue(W.httpApiPort).setPlaceholder("51361").onChange(async A=>{parseInt(A)>65535&&(A=W.httpApiPort,p.setValue(W.httpApiPort)),W.httpApiPort=A,W.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(W.httpApiPort)),await _e(this.plugin)})}),new ne.Setting(t).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(p=>p.setValue(W.httpApiNotice).onChange(async A=>{W.httpApiNotice=A,await _e(this.plugin)}))}new ne.Setting(t).setName("Debugging").setHeading(),new ne.Setting(t).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(g=>g.setValue(W.verboseLogging).onChange(async p=>{W.verboseLogging=p,pl(p),await _e(this.plugin)})),new ne.Setting(t).setName("Danger Zone").setHeading();let D=new DocumentFragment;D.createSpan({},g=>{g.innerHTML=`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
${ku}
`}),new ne.Setting(t).setName("Ignore diacritics").setDesc(D).addToggle(g=>g.setValue(W.ignoreDiacritics).onChange(async p=>{await r.clearCache(),W.ignoreDiacritics=p,await _e(this.plugin)}));let E=new DocumentFragment;if(E.createSpan({},g=>{g.innerHTML=`Disable Omnisearch on this device only.<br>
${ku}`}),new ne.Setting(t).setName("Disable on this device").setDesc(E).addToggle(g=>g.setValue(gl(this.app)).onChange(async p=>{p?this.app.saveLocalStorage(na,"1"):this.app.saveLocalStorage(na),new ne.Notice("Omnisearch - Disabled. Please restart Obsidian.")})),bn()){let g=new DocumentFragment;g.createSpan({},p=>{p.innerHTML=`Erase all Omnisearch cache data.
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
${ku}`}),new ne.Setting(t).setName("Clear cache data").setDesc(g).addButton(p=>{p.setButtonText("Clear cache"),p.onClick(async()=>{await r.clearCache()})})}}weightSlider(t,r){t.setLimits(1,5,.1).setValue(W[r]).setDynamicTooltip().onChange(async n=>{W[r]=n,await _e(this.plugin)})}}});function uI(e){let t;return{c(){t=z("span"),t.innerHTML='<svg viewBox="0 0 100 100" class="add-note-glyph" width="16" height="16"><path fill="currentColor" stroke="currentColor" d="M23.3,6.7c-3.7,0-6.7,3-6.7,6.7v73.3c0,3.7,3,6.7,6.7,6.7h28.4c-3.2-4.8-5.1-10.5-5.1-16.7c0-16.6,13.4-30,30-30 c2.3,0,4.5,0.3,6.7,0.8V31.7c0-0.9-0.3-1.7-1-2.4L60.7,7.6c-0.6-0.6-1.5-1-2.4-1L23.3,6.7z M56.7,13L77,33.3H60 c-1.8,0-3.3-1.5-3.3-3.3L56.7,13z M76.7,53.3c-12.9,0-23.3,10.4-23.3,23.3S63.8,100,76.7,100S100,89.6,100,76.7 S89.6,53.3,76.7,53.3z M76.7,63.3c1.8,0,3.3,1.5,3.3,3.3v6.7h6.7c1.8,0,3.3,1.5,3.3,3.3c0,1.8-1.5,3.3-3.3,3.3H80v6.7 c0,1.8-1.5,3.3-3.3,3.3c-1.8,0-3.3-1.5-3.3-3.3V80h-6.7c-1.8,0-3.3-1.5-3.3-3.3s1.5-3.3,3.3-3.3h6.7v-6.7 C73.3,64.8,74.8,63.3,76.7,63.3L76.7,63.3z"></path></svg>',Z(t,"class","suggestion-flair"),Z(t,"aria-label","Not created yet, select to create")},m(r,n){ae(r,t,n)},p:qe,i:qe,o:qe,d(r){r&&se(t)}}}function oI(e){"use strict";return[]}var I0,v0,C0=O(()=>{rr();I0=class extends pt{constructor(t){super();bt(this,t,oI,uI,ot,{})}},v0=I0});function D0(e){let t,r;return t=new v0({}),{c(){Lt(t.$$.fragment)},m(n,i){Dt(t,n,i),r=!0},i(n){r||(Ee(t.$$.fragment,n),r=!0)},o(n){xe(t.$$.fragment,n),r=!1},d(n){Tt(t,n)}}}function cI(e){let t,r,n,i,s,a=e[2]&&D0(e),u=e[4].default,o=Li(u,e,e[3],null);return{c(){t=z("div"),a&&a.c(),r=ue(),o&&o.c(),Z(t,"data-result-id",e[0]),Z(t,"class","suggestion-item omnisearch-result"),Xc(t,"is-selected",e[1])},m(c,f){ae(c,t,f),a&&a.m(t,null),j(t,r),o&&o.m(t,null),n=!0,i||(s=[ht(t,"mousemove",e[5]),ht(t,"click",e[6]),ht(t,"keypress",e[7]),ht(t,"auxclick",e[8])],i=!0)},p(c,[f]){c[2]?a?f&4&&Ee(a,1):(a=D0(c),a.c(),Ee(a,1),a.m(t,r)):a&&(Zn(),xe(a,1,1,()=>{a=null}),Jn()),o&&o.p&&(!n||f&8)&&ki(o,u,c,c[3],n?Mi(u,c[3],f,null):Fi(c[3]),null),(!n||f&1)&&Z(t,"data-result-id",c[0]),(!n||f&2)&&Xc(t,"is-selected",c[1])},i(c){n||(Ee(a),Ee(o,c),n=!0)},o(c){xe(a),xe(o,c),n=!1},d(c){c&&se(t),a&&a.d(),o&&o.d(c),i=!1,cr(s)}}}function lI(e,t,r){let{$$slots:n={},$$scope:i}=t,{id:s}=t,{selected:a=!1}=t,{glyph:u=!1}=t;function o(d){Vt.call(this,e,d)}function c(d){Vt.call(this,e,d)}function f(d){Vt.call(this,e,d)}function h(d){Vt.call(this,e,d)}return e.$$set=d=>{"id"in d&&r(0,s=d.id),"selected"in d&&r(1,a=d.selected),"glyph"in d&&r(2,u=d.glyph),"$$scope"in d&&r(3,i=d.$$scope)},[s,a,u,i,n,o,c,f,h]}var S0,Bu,Tl=O(()=>{rr();C0();S0=class extends pt{constructor(t){super();bt(this,t,lI,cI,ot,{id:0,selected:1,glyph:2})}},Bu=S0});function O0(e){let t,r=e[1].matches.length+"",n,i,s=(e[1].matches.length>1?"matches":"match")+"",a;return{c(){t=z("span"),n=dt(r),i=dt("\xA0"),a=dt(s),Z(t,"class","omnisearch-result__counter")},m(u,o){ae(u,t,o),j(t,n),j(t,i),j(t,a)},p(u,o){o&2&&r!==(r=u[1].matches.length+"")&&Sr(n,r),o&2&&s!==(s=(u[1].matches.length>1?"matches":"match")+"")&&Sr(a,s)},d(u){u&&se(t)}}}function x0(e){let t,r,n,i,s=e[2].textProcessor.highlightText(e[4],e[10])+"";return{c(){t=z("div"),r=z("span"),n=ue(),i=z("span"),Z(t,"class","omnisearch-result__folder-path")},m(a,u){ae(a,t,u),j(t,r),e[14](r),j(t,n),j(t,i),i.innerHTML=s},p(a,u){u&1044&&s!==(s=a[2].textProcessor.highlightText(a[4],a[10])+"")&&(i.innerHTML=s)},d(a){a&&se(t),e[14](null)}}}function N0(e){let t,r=e[2].textProcessor.highlightText(e[9],e[1].matches)+"";return{c(){t=z("div"),Z(t,"class","omnisearch-result__body")},m(n,i){ae(n,t,i),t.innerHTML=r},p(n,i){i&518&&r!==(r=n[2].textProcessor.highlightText(n[9],n[1].matches)+"")&&(t.innerHTML=r)},d(n){n&&se(t)}}}function R0(e){let t,r,n;return{c(){t=z("div"),r=z("img"),zt(r,"width","100px"),Qc(r.src,n=e[7])||Z(r,"src",n),Z(r,"alt",""),Z(t,"class","omnisearch-result__image-container")},m(i,s){ae(i,t,s),j(t,r)},p(i,s){s&128&&!Qc(r.src,n=i[7])&&Z(r,"src",n)},d(i){i&&se(t)}}}function fI(e){let t,r,n,i,s,a,u=e[2].textProcessor.highlightText(e[
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Re=!0,tt=!1,Vr;return{s:function(){H=H.call(w)},n:function(){var X=H.next();return Re=X.done,X},e:function(X){tt=!0,Vr=X},f:function(){try{!Re&&H.return!=null&&H.return()}finally{if(tt)throw Vr}}}}function c(w,F){if(!!w){if(typeof w=="string")return f(w,F);var H=Object.prototype.toString.call(w).slice(8,-1);if(H==="Object"&&w.constructor&&(H=w.constructor.name),H==="Map"||H==="Set")return Array.from(w);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return f(w,F)}}function f(w,F){(F==null||F>w.length)&&(F=w.length);for(var H=0,ee=new Array(F);H<F;H++)ee[H]=w[H];return ee}function h(w,F){if(!(w instanceof F))throw new TypeError("Cannot call a class as a function")}function d(w,F){for(var H=0;H<F.length;H++){var ee=F[H];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(w,ee.key,ee)}}function _(w,F,H){return F&&d(w.prototype,F),H&&d(w,H),Object.defineProperty(w,"prototype",{writable:!1}),w}function D(w,F,H){return F in w?Object.defineProperty(w,F,{value:H,enumerable:!0,configurable:!0,writable:!0}):w[F]=H,w}function E(w,F,H){g(w,F),F.set(w,H)}function g(w,F){if(F.has(w))throw new TypeError("Cannot initialize the same private elements twice on an object")}function p(w,F){var H=b(w,F,"get");return A(w,H)}function A(w,F){return F.get?F.get.call(w):F.value}function I(w,F,H){var ee=b(w,F,"set");return y(w,ee,H),H}function b(w,F,H){if(!F.has(w))throw new TypeError("attempted to "+H+" private field on non-instance");return F.get(w)}function y(w,F,H){if(F.set)F.set.call(w,H);else{if(!F.writable)throw new TypeError("attempted to set read only private field");F.value=H}}var C=typeof Symbol!="undefined"?Symbol.toStringTag:"@@toStringTag",S=new WeakMap,N=new WeakMap,P=function(){function w(F){var H=F.executor,ee=H===void 0?function(){}:H,de=F.internals,Re=de===void 0?Ke():de,tt=F.promise,Vr=tt===void 0?new Promise(function(_t,X){return ee(_t,X,function($e){Re.onCancelList.push($e)})}):tt;h(this,w),E(this,S,{writable:!0,value:void 0}),E(this,N,{writable:!0,value:void 0}),D(this,C,"CancelablePromise"),this.cancel=this.cancel.bind(this),I(this,S,Re),I(this,N,Vr||new Promise(function(_t,X){return ee(_t,X,function($e){Re.onCancelList.push($e)})}))}return _(w,[{key:"then",value:function(H,ee){return ke(p(this,N).then(he(H,p(this,S)),he(ee,p(this,S))),p(this,S))}},{key:"catch",value:function(H){return ke(p(this,N).catch(he(H,p(this,S))),p(this,S))}},{key:"finally",value:function(H,ee){var de=this;return ee&&p(this,S).onCancelList.push(H),ke(p(this,N).finally(he(function(){if(H)return ee&&(p(de,S).onCancelList=p(de,S).onCancelList.filter(function(Re){return Re!==H})),H()},p(this,S))),p(this,S))}},{key:"cancel",value:function(){p(this,S).isCanceled=!0;var H=p(this,S).onCancelList;p(this,S).onCancelList=[];var ee=o(H),de;try{for(ee.s();!(de=ee.n()).done;){var Re=de.value;if(typeof Re=="function")try{Re()}catch(tt){console.error(tt)}}}catch(tt){ee.e(tt)}finally{ee.f()}}},{key:"isCanceled",value:function(){return p(this,S).isCanceled===!0}}]),w}(),q=function(w){t(H,w);var F=n(H);function H(ee){return h(this,H),F.call(this,{executor:ee})}return _(H)}(P);e.CancelablePromise=q,D(q,"all",function(F){return Ie(F,Promise.all(F))}),D(q,"allSettled",function(F){return Ie(F,Promise.allSettled(F))}),D(q,"any",function(F){return Ie(F,Promise.any(F))}),D(q,"race",function(F){return Ie(F,Promise.race(F))}),D(q,"resolve",function(F){return me(Promise.resolve(F))}),D(q,"reject",function(F){return me(Promise.reject(F))}),D(q,"isCancelable",K);var $=q;e.default=$;function me(w){return ke(w,Ke())}function K(w){return w instanceof q||w instanceof P}function he(w,F){if(w)return function(H){if(!F.isCanceled){var ee=w(H);return K(ee)&&F.onCancelList.push(ee.cancel),ee}return H}}function ke(w,F){return new P({internals:F,promise:w})}function Ie(w,F){var H=Ke();return H.onCancelList.push(function(){var ee=o(w),de;try{for(ee.s();!(de=ee.n()).done;){var Re=de.value;K(Re)&&Re.cancel()}}catch(tt){ee.e(tt)}final
`),i&&i.c(),n=Xs()},m(s,a){ae(s,t,a),i&&i.m(s,a),ae(s,n,a)},p(s,a){a[0]&5&&(r=s[0].settings.simpleSearch&&s[2].split(ia).some(K_)),r?i||(i=V_(s),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(s){s&&se(t),i&&i.d(s),s&&se(n)}}}function V_(e){let t,r,n;return{c(){t=z("br"),r=ue(),n=z("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more
characters.`,zt(n,"color","var(--text-accent)"),zt(n,"font-size","small")},m(i,s){ae(i,t,s),ae(i,r,s),ae(i,n,s)},d(i){i&&se(t),i&&se(r),i&&se(n)}}}function rO(e){let t,r,n,i=e[3],s=[];for(let f=0;f<i.length;f+=1)s[f]=z_(U_(e,i,f));let a=f=>xe(s[f],1,1,()=>{s[f]=null});function u(f,h){if(!f[3].length&&f[2]&&!f[5])return tO;if(f[5])return eO}let o=u(e,[-1,-1]),c=o&&o(e);return{c(){for(let f=0;f<s.length;f+=1)s[f].c();t=ue(),r=z("div"),c&&c.c(),zt(r,"text-align","center")},m(f,h){for(let d=0;d<s.length;d+=1)s[d]&&s[d].m(f,h);ae(f,t,h),ae(f,r,h),c&&c.m(r,null),n=!0},p(f,h){if(h[0]&12299){i=f[3];let d;for(d=0;d<i.length;d+=1){let _=U_(f,i,d);s[d]?(s[d].p(_,h),Ee(s[d],1)):(s[d]=z_(_),s[d].c(),Ee(s[d],1),s[d].m(t.parentNode,t))}for(Zn(),d=i.length;d<s.length;d+=1)a(d);Jn()}o===(o=u(f,h))&&c?c.p(f,h):(c&&c.d(1),c=o&&o(f),c&&(c.c(),c.m(r,null)))},i(f){if(!n){for(let h=0;h<i.length;h+=1)Ee(s[h]);n=!0}},o(f){s=s.filter(Boolean);for(let h=0;h<s.length;h+=1)xe(s[h]);n=!1},d(f){Du(s,f),f&&se(t),f&&se(r),c&&c.d()}}}function nO(e){let t,r,n,i,s,a,u,o,c,f,h,d,_,D,E,g,p,A,I,b,y,C,S,N,P,q,$,me,K,he,ke,Ie,Ke,w,F,H,ee,de,Re,tt,Vr,_t,X,$e,Kr,or,$n,wi,hn,Ly={plugin:e[0],initialValue:e[2],placeholder:"Omnisearch - Vault",$$slots:{default:[JS]},$$scope:{ctx:e}};t=new Ru({props:Ly}),e[19](t),t.$on("input",e[20]);let Pt=e[4]&&q_(e);return i=new wu({props:{$$slots:{default:[rO]},$$scope:{ctx:e}}}),{c(){Lt(t.$$.fragment),r=ue(),Pt&&Pt.c(),n=ue(),Lt(i.$$.fragment),s=ue(),a=z("div"),u=z("div"),u.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',o=ue(),c=z("div"),c.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
<span>to cycle history</span>`,f=ue(),h=z("div"),d=z("span"),_=dt(e[8]),D=ue(),E=z("span"),E.textContent="to open",g=ue(),p=z("div"),p.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to In-File Search</span>`,A=ue(),I=z("div"),b=z("span"),y=dt(e[7]),C=ue(),S=z("span"),S.textContent="to open in a new pane",N=ue(),P=z("div"),q=z("span"),q.textContent=`${e[11]}`,$=ue(),me=z("span"),me.textContent="to open in a new split",K=ue(),he=z("div"),he.innerHTML=`<span class="prompt-instruction-command">alt o</span>
<span>to open in the background</span>`,ke=ue(),Ie=z("div"),Ke=z("span"),w=dt(e[10]),F=ue(),H=z("span"),H.textContent="to create",ee=ue(),de=z("div"),Re=z("span"),tt=dt(e[9]),Vr=ue(),_t=z("span"),_t.textContent="to create in a new pane",X=ue(),$e=z("div"),$e.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,Kr=ue(),or=z("div"),or.innerHTML=`<span class="prompt-instruction-command">ctrl g</span>
<span>to toggle excerpts</span>`,$n=ue(),wi=z("div"),wi.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',Z(u,"class","prompt-instruction"),Z(c,"class","prompt-instruction"),Z(d,"class","prompt-instruction-command"),Z(h,"class","prompt-instruction"),Z(p,"class","prompt-instruction"),Z(b,"class","prompt-instruction-command"),Z(I,"class","prompt-instruction"),Z(q,"class","prompt-instruction-command"),Z(P,"class","prompt-instruction"),Z(he,"class","prompt-instruction"),Z(Ke,"class","prompt-instruction-command"),Z(Ie,"class","prompt-instruction"),Z(Re,"class","prompt-instruction-command"),Z(de,"class","prompt-instruction"),Z($e,"class","prompt-instruction"),Z(or,"class","prompt-instruction"),Z(wi,"class","prompt-instruction"),Z(a,"class","prompt-instructions")},m(pe,Ye){Dt(t,pe,Ye),ae(pe,r,Ye),Pt&&Pt.m(pe,Ye),ae(pe,n,Ye),Dt(i,pe,Ye),ae(pe,s,Ye),ae(pe,a,Ye),j(a,u),j(a,o),j(a,c),j(a,f),j(a,h),j(h,d),j(d,_),j(h,D),j(h,E),j(a,g),j(a,p),j(a,A),j(a,I),j(I,b),j(b,y),j(I,C),j(I,S),j(a,N),j(a,P),j(P,q),j(P,$),j(P,me),j(a,K),j(a,he),j(a,ke),j(a,Ie),j(Ie,Ke),j(Ke,w),j(Ie,F),j(Ie,H),j(a,ee),j(a,de),j(de,Re),j(Re,tt),j(de,Vr),j(de,_t),j(a,X),j(a,$e),j(a,Kr),j(a,or),j(a,$n),j(a,wi),hn=!0},p(pe,Ye){let yu={};Ye[0]&1&&(yu.plugin=pe[0]),Ye[0]&4&&(yu.initialValue=pe[2]),Ye[0]&1|Ye[1]&4096&&(yu.$$scope={dirty:Ye,ctx:pe}),t.$set(yu),pe[4]?Pt?Pt.p(pe,Ye):(Pt=q_(pe),Pt.c(),Pt.m(n.parentNode,n)):Pt&&(Pt.d(1),Pt=null);let jh={};Ye[0]&47|Ye[1]&4096&&(jh.$$scope={dirty:Ye,ctx:pe}),i.$set(jh),(!hn||Ye[0]&256)&&Sr(_,pe[8]),(!hn||Ye[0]&128)&&Sr(y,pe[7]),(!hn||Ye[0]&1024)&&Sr(w,pe[10]),(!hn||Ye[0]&512)&&Sr(tt,pe[9])},i(pe){hn||(Ee(t.$$.fragment,pe),Ee(i.$$.fragment,pe),hn=!0)},o(pe){xe(t.$$.fragment,pe),xe(i.$$.fragment,pe),hn=!1},d(pe){e[19](null),Tt(t,pe),pe&&se(r),Pt&&Pt.d(pe),pe&&se(n),Tt(i,pe),pe&&se(s),pe&&se(a)}}}function iO(e,t,r){let n,i;vu(e,mn,X=>r(18,i=X));let{modal:s}=t,{previousQuery:a}=t,{plugin:u}=t,o=0,c=0,f,h=[],d,_="",D=!0,E,g,p,A,I,b=gn()+" alt \u21B5";ea(async()=>{ce.enable("vault"),ce.on("vault",ge.Enter,$),ce.on("vault",ge.OpenInBackground,me),ce.on("vault",ge.CreateNote,w),ce.on("vault",ge.OpenInNewPane,K),ce.on("vault",ge.InsertLink,F),ce.on("vault",ge.Tab,H),ce.on("vault",ge.ArrowUp,()=>ee(-1)),ce.on("vault",ge.ArrowDown,()=>ee(1)),ce.on("vault",ge.PrevSearchHistory,y),ce.on("vault",ge.NextSearchHistory,C),ce.on("vault",ge.OpenInNewLeaf,he),await u.notesIndexer.refreshIndex(),await P()}),ta(()=>{ce.disable("vault")});async function y(){let X=(await u.cacheManager.getSearchHistory()).filter($e=>$e);++c>=X.length&&(c=0),r(2,f=X[c]),E?.setInputValue(f??"")}async function C(){let X=(await u.cacheManager.getSearchHistory()).filter($e=>$e);--c<0&&(c=X.length?X.length-1:0),r(2,f=X[c]),E?.setInputValue(f??"")}let S=null;async function N(){r(5,D=!0),S&&(S.cancel(),S=null),d=new ni(f,{ignoreDiacritics:u.settings.ignoreDiacritics}),S=(0,H_.cancelable)(new Promise(X=>{X(u.searchEngine.getSuggestions(d))})),r(3,h=await S),r(1,o=0),await de(),r(5,D=!1)}let P=Yl(N,0);function q(X){!n||(X?.ctrlKey?K():$(),s.close())}function $(){!n||(Ie(n),s.close())}function me(){!n||Ie(n,!0)}function K(){!n||(Ie(n,!0),s.close())}function he(){!n||(Ie(n,!0,!0),s.close())}function ke(){f&&u.cacheManager.addToSearchHistory(f)}function Ie(X,$e=!1,Kr=!1){ke();let or=X.matches?.[0]?.offset??0;Pu(u.app,X,or,$e,Kr)}async function Ke(X){await w()}async function w(X){if(f){try{await l0(u.app,f,X?.newLeaf)}catch($e){new mr.Notice($e.message);return}s.close()}}function F(){if(!n)return;let X=u.app.vault.getMarkdownFiles().find(wi=>wi.path===n.path),$e=u.app.workspace.getActiveFile(),Kr=u.app.workspace.getActiveViewOfType(mr.MarkdownView);if(!Kr?.editor){new mr.Notice("Omnisearch - Error - No active editor",3e3);return}let or;X&&$e?or=u.app.fileManager.generateMarkdownLink(X,$e.path):or=`[[${n.basename}.${Tn(n.path)}]]`;let $n=Kr.editor.getCursor();Kr.editor.replaceRange(or,$n,$n),$n.ch+=or.length,Kr.editor.setCursor($n),s.close()}function H(){if(!(n&&(_n(n?.path)||!n?.matches.length)))if(ke(),s.close(),n){let X=u.app.vault.getAbstr
<span>to switch to Vault Search</span>`,h=ue(),d=z("div"),_=z("span"),_.textContent="esc",D=ue(),S.c(),E=ue(),g=z("div"),p=z("span"),p.textContent=`${gn()} \u21B5`,A=ue(),I=z("span"),I.textContent="to open in a new pane",Z(a,"class","prompt-instruction"),Z(o,"class","prompt-instruction"),Z(f,"class","prompt-instruction"),Z(_,"class","prompt-instruction-command"),Z(d,"class","prompt-instruction"),Z(p,"class","prompt-instruction-command"),Z(g,"class","prompt-instruction"),Z(s,"class","prompt-instructions")},m(N,P){Dt(t,N,P),ae(N,r,P),Dt(n,N,P),ae(N,i,P),ae(N,s,P),j(s,a),j(s,u),j(s,o),j(s,c),j(s,f),j(s,h),j(s,d),j(d,_),j(d,D),S.m(d,null),j(s,E),j(s,g),j(g,p),j(g,A),j(g,I),b=!0},p(N,[P]){let q={};P&1&&(q.plugin=N[0]),P&4&&(q.initialValue=N[2]),P&8388608&&(q.$$scope={dirty:P,ctx:N}),t.$set(q);let $={};P&8388721&&($.$$scope={dirty:P,ctx:N}),n.$set($),C!==(C=y(N,P))&&(S.d(1),S=C(N),S&&(S.c(),S.m(d,null)))},i(N){b||(Ee(t.$$.fragment,N),Ee(n.$$.fragment,N),b=!0)},o(N){xe(t.$$.fragment,N),xe(n.$$.fragment,N),b=!1},d(N){Tt(t,N),N&&se(r),Tt(n,N),N&&se(i),N&&se(s),S.d()}}}function gO(e,t,r){let n=e.find(i=>i.offset>t);return n?e.filter(i=>i.offset>t&&i.offset<=n.offset+r):[]}function _O(e,t,r){let{plugin:n}=t,{modal:i}=t,{parent:s=null}=t,{singleFilePath:a=""}=t,{previousQuery:u}=t,o,c=[],f=0,h,d;ea(()=>{ce.enable("infile"),ce.on("infile",ge.Enter,p),ce.on("infile",ge.OpenInNewPane,g),ce.on("infile",ge.ArrowUp,()=>D(-1)),ce.on("infile",ge.ArrowDown,()=>D(1)),ce.on("infile",ge.Tab,A)}),ta(()=>{ce.disable("infile")});function _(S){let N=[],P=-1,q=0;for(;++q<100;){let $=gO(S,P,ra);if(!$.length)break;P=$.last().offset,N.push($)}return N}function D(S){r(6,f=Mu(f+S,c.length)),E()}async function E(){await pn(),document.querySelector(`[data-result-id="${f}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function g(){return p(!0)}async function p(S=!1){if(h){i.close(),s&&s.close();let N=n.textProcessor.stringsToRegex(h.foundWords);N.exec(h.content),await Pu(n.app,h,N.lastIndex,S);let P=n.app.workspace.getActiveViewOfType(ba.MarkdownView);if(!P)return;let q=c[f]??0,$=P.editor.offsetToPos(q);$.ch=0,P.editor.setCursor($),P.editor.scrollIntoView({from:{line:$.line-10,ch:0},to:{line:$.line+10,ch:0}})}}function A(){new Nn(n,o??u).open(),i.close()}let I=S=>r(3,o=S.detail),b=(S,N)=>r(6,f=S),y=S=>p(S.ctrlKey),C=S=>{S.button==1&&p(!0)};return e.$$set=S=>{"plugin"in S&&r(0,n=S.plugin),"modal"in S&&r(9,i=S.modal),"parent"in S&&r(1,s=S.parent),"singleFilePath"in S&&r(10,a=S.singleFilePath),"previousQuery"in S&&r(2,u=S.previousQuery)},e.$$.update=()=>{if(e.$$.dirty&4){e:r(3,o=u??"")}if(e.$$.dirty&3081){e:(async()=>{o&&(r(11,d=new ni(o,{ignoreDiacritics:n.settings.ignoreDiacritics})),r(4,h=(await n.searchEngine.getSuggestions(d,{singleFilePath:a}))[0]??null)),r(6,f=0),await E()})()}if(e.$$.dirty&2064){e:if(h){let S=_(h.matches),N=d.getExactTerms();N.length&&(S=S.filter(P=>N.every(q=>P.some($=>$.match.includes(q))))),r(5,c=S.map(P=>Math.round(P.first().offset)))}}},[n,s,u,o,h,c,f,p,A,i,a,d,I,b,y,C]}var ba,tT,rT,nT=O(()=>{rr();ul();Or();ir();Ou();ba=Xe(require("obsidian"));ol();Ta();Z_();Hu();sa();tT=class extends pt{constructor(t){super();bt(this,t,_O,mO,ot,{plugin:0,modal:9,parent:1,singleFilePath:10,previousQuery:2})}},rT=tT});var To,$l,Nn,as,Ta=O(()=>{To=Xe(require("obsidian"));Q_();nT();Or();$l=class extends To.Modal{constructor(t){super(t.app);let r=t.settings;this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",o=>{o.preventDefault(),ce.emit(ge.ArrowDown)}),this.scope.register([],"ArrowUp",o=>{o.preventDefault(),ce.emit(ge.ArrowUp)});for(let o of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let c of["Ctrl","Mod"])this.scope.register([c],o.k,f=>{r.vimLikeNavigationShortcut&&ce.emit("arrow-"+o.dir)});for(let o of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let c of["Ctrl","Mod"])this.scope.register([c],o.k,f=>{r.vimLikeNavigationShortcut&&ce.emit("arrow-"+o.dir)});let n,i,s,a,u=["Mod","Alt"];r.openInNewPane?(n=["Mod"],i=[]
`).map(i=>{let s=i.match(/^\s+/);if(s===null)return i;let[a]=s;return a.length>=n.length?i.slice(n.length):i}).join(`
`)}var bs=class{options;rules;lexer;constructor(t){this.options=t||we.defaults}space(t){let r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){let r=this.rules.block.code.exec(t);if(r){let n=r[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Qo(n,`
`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let n=r[0],i=s2(n,r[3]||"");return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(t){let r=this.rules.block.heading.exec(t);if(r){let n=r[2].trim();if(/#$/.test(n)){let i=Qo(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:r[0]}}blockquote(t){let r=this.rules.block.blockquote.exec(t);if(r){let n=r[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`);n=Qo(n.replace(/^ *>[ \t]?/gm,""),`
`);let i=this.lexer.state.top;this.lexer.state.top=!0;let s=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:r[0],tokens:s,text:n}}}list(t){let r=this.rules.block.list.exec(t);if(r){let n=r[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let a=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),u="",o="",c=!1;for(;t;){let f=!1;if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;u=r[0],t=t.substring(u.length);let h=r[2].split(`
`,1)[0].replace(/^\t+/,p=>" ".repeat(3*p.length)),d=t.split(`
`,1)[0],_=0;this.options.pedantic?(_=2,o=h.trimStart()):(_=r[2].search(/[^ ]/),_=_>4?1:_,o=h.slice(_),_+=r[1].length);let D=!1;if(!h&&/^ *$/.test(d)&&(u+=d+`
`,t=t.substring(d.length+1),f=!0),!f){let p=new RegExp(`^ {0,${Math.min(3,_-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),A=new RegExp(`^ {0,${Math.min(3,_-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),I=new RegExp(`^ {0,${Math.min(3,_-1)}}(?:\`\`\`|~~~)`),b=new RegExp(`^ {0,${Math.min(3,_-1)}}#`);for(;t;){let y=t.split(`
`,1)[0];if(d=y,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),I.test(d)||b.test(d)||p.test(d)||A.test(t))break;if(d.search(/[^ ]/)>=_||!d.trim())o+=`
`+d.slice(_);else{if(D||h.search(/[^ ]/)>=4||I.test(h)||b.test(h)||A.test(h))break;o+=`
`+d}!D&&!d.trim()&&(D=!0),u+=y+`
`,t=t.substring(y.length+1),h=d.slice(_)}}s.loose||(c?s.loose=!0:/\n *\n *$/.test(u)&&(c=!0));let E=null,g;this.options.gfm&&(E=/^\[[ xX]\] /.exec(o),E&&(g=E[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:u,task:!!E,checked:g,loose:!1,text:o,tokens:[]}),s.raw+=u}s.items[s.items.length-1].raw=u.trimEnd(),s.items[s.items.length-1].text=o.trimEnd(),s.raw=s.raw.trimEnd();for(let f=0;f<s.items.length;f++)if(this.lexer.state.top=!1,s.items[f].tokens=this.lexer.blockTokens(s.items[f].text,[]),!s.loose){let h=s.items[f].tokens.filter(_=>_.type==="space"),d=h.length>0&&h.some(_=>/\n.*\n/.test(_.raw));s.loose=d}if(s.loose)for(let f=0;f<s.items.length;f++)s.items[f].loose=!0;return s}}html(t){let r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){let r=this.rules.block.def.exec(t);if(r){let n=r[1].toLowerCase().replace(/\s+/g," "),i=r[2]?r[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:i,title:s}}}table(t){let r=this.rules.block.table.exec(t);if(!r||!/[:|]/.test(r[2]))return;let n=_b(r[1]),i=r[2].replace(/^\||\| *$/g,"").split("|"),s=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(`
`):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let u of i)/^ *-+: *$/.test(u)?a.align.push("right"):/^ *:-+: *$/.test(u)?a.align.push("center"):/^ *:-+ *$/.test(u)?a.align.push("left"):a.align.push(null);for(let u of n)a.header.push({text:u,tokens:this.lexer.inline(u)});for(let u of s)a.rows.push(_b(u,a.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return a}}lheading(t){let r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){let r=this.rules.block.paragraph.exec(t);if(r){let n=r[1].charAt(r[1].length-1)===`
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){let r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:Qt(r[1])}}tag(t){let r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&/^<a /i.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){let r=this.rules.inline.link.exec(t);if(r){let n=r[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;let a=Qo(n.slice(0,-1),"\\");if((n.length-a.length)%2==0)return}else{let a=i2(r[2],"()");if(a>-1){let o=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,o).trim(),r[3]=""}}let i=r[2],s="";if(this.options.pedantic){let a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],s=a[3])}else s=r[3]?r[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),Tb(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(t,r){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let i=(n[2]||n[1]).replace(/\s+/g," "),s=r[i.toLowerCase()];if(!s){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Tb(n,s,n[0],this.lexer)}}emStrong(t,r,n=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let a=[...i[0]].length-1,u,o,c=a,f=0,h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,r=r.slice(-1*t.length+a);(i=h.exec(r))!=null;){if(u=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!u)continue;if(o=[...u].length,i[3]||i[4]){c+=o;continue}else if((i[5]||i[6])&&a%3&&!((a+o)%3)){f+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+f);let d=[...i[0]][0].length,_=t.slice(0,a+i.index+d+o);if(Math.min(a,o)%2){let E=_.slice(1,-1);return{type:"em",raw:_,text:E,tokens:this.lexer.inlineTokens(E)}}let D=_.slice(2,-2);return{type:"strong",raw:_,text:D,tokens:this.lexer.inlineTokens(D)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(/\n/g," "),i=/[^ ]/.test(n),s=/^ /.test(n)&&/ $/.test(n);return i&&s&&(n=n.substring(1,n.length-1)),n=Qt(n,!0),{type:"codespan",raw:r[0],text:n}}}br(t){let r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){let r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){let r=this.rules.inline.autolink.exec(t);if(r){let n,i;return r[2]==="@"?(n=Qt(r[1]),i="mailto:"+n):(n=Qt(r[1]),i=n),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let r;if(r=this.rules.inline.url.exec(t)){let n,i;if(r[2]==="@")n=Qt(r[0]),i="mailto:"+n;else{let s;do s=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(s!==r[0]);n=Qt(r[0]),r[1]==="www."?i="http://"+r[0]:i=r[0]}return{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let r=this.rules.inline.text.exec(t);if(r){let n;return this.lexer.state.inRawBlock?n=r[0]:n=Qt(r[0]),{type:"text",raw:r[0],text:n}}}},a2=/^(?: *(?:\n|$))+/,u2=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,o2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ua=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,c2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bb=/(?:[*+-]|\d{1,9}[.)])/,Eb=Se(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\
]`).replace("lheading",Eb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Ib=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,vb=/^( {2,}|\\)\n(?!\s*$)/,T2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ga="\\p{P}\\p{S}",b2=Se(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Ga).getRegex(),E2=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,A2=Se(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Ga).getRegex(),y2=Se("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Ga).getRegex(),I2=Se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Ga).getRegex(),v2=Se(/\\([punct])/,"gu").replace(/punct/g,Ga).getRegex(),C2=Se(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),D2=Se(sd).replace("(?:-->|$)","-->").getRegex(),S2=Se("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",D2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Xo=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,O2=Se(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Xo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Cb=Se(/^!?\[(label)\]\[(ref)\]/).replace("label",Xo).replace("ref",id).getRegex(),Db=Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",id).getRegex(),x2=Se("reflink|nolink(?!\\()","g").replace("reflink",Cb).replace("nolink",Db).getRegex(),ud={_backpedal:Ha,anyPunctuation:v2,autolink:C2,blockSkip:E2,br:vb,code:_2,del:Ha,emStrongLDelim:A2,emStrongRDelimAst:y2,emStrongRDelimUnd:I2,escape:Ib,link:O2,nolink:Db,punctuation:b2,reflink:Cb,reflinkSearch:x2,tag:S2,text:T2,url:Ha},N2=Fe(J({},ud),{link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",Xo).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Xo).getRegex()}),od=Fe(J({},ud),{escape:Se(Ib).replace("])","~|])").getRegex(),url:Se(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),R2=Fe(J({},od),{br:Se(vb).replace("{2,}","*").getRegex(),text:Se(od.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),Zo={normal:ad,gfm:m2,pedantic:g2},qa={normal:ud,gfm:od,breaks:R2,pedantic:N2},sr=class{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||we.defaults,this.options.tokenizer=this.options.tokenizer||new bs,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={block:Zo.normal,inline:qa.normal};this.options.pedantic?(r.block=Zo.pedantic,r.inline=qa.pedantic):this.options.gfm&&(r.block
`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(u,o,c)=>o+" ".repeat(c.length));let n,i,s,a;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(u=>(n=u.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length),n.raw.length===1&&r.length>0?r[r.length-1].raw+=`
`:r.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+n.raw,i.text+=`
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+n.raw,i.text+=`
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),r.push(n);continue}if(s=t,this.options.extensions&&this.options.extensions.startBlock){let u=1/0,o=t.slice(1),c;this.options.extensions.startBlock.forEach(f=>{c=f.call({lexer:this},o),typeof c=="number"&&c>=0&&(u=Math.min(u,c))}),u<1/0&&u>=0&&(s=t.substring(0,u+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s))){i=r[r.length-1],a&&i.type==="paragraph"?(i.raw+=`
`+n.raw,i.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n),a=s.length!==t.length,t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&i.type==="text"?(i.raw+=`
`+n.raw,i.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n,i,s,a=t,u,o,c;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(u=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)f.includes(u[0].slice(u[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,u.index)+"["+"a".repeat(u[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(u=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,u.index)+"["+"a".repeat(u[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(u=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,u.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(o||(c=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(f=>(n=f.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),i=r[r.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(n=this.tokenizer.emStrong(t,a,c)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),r.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),r.push(n);continue}if(s=t,this.options.extensions&&this.options.extensions.startInline){let f=1/0,h=t.slice(1),d;this.options.extensions.startInline.forEach(_=>{d=_.call({lexer:this},h),typeof d=="number"&&d>=0&&(f=Math.min(f,d))}),f<1/0&&f>=0&&(s=t.substring(0,f+1))}if(n=this.tokenizer.inlineText(s)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(c=n.raw.slice(-1)),o=!0,i=r[r.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(t){let f="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return r}},Es=class{options;constructor(t){this.options=t||we.defaults}code(t,r,n){let i=(r||"").match(/^\S*/)?.[0];return t=t.replace(/\n$/,"")+`
`,i?'<pre><code class="language-'+Qt(i)+'">'+(n?t:Qt(t,!0))+`</code></pre>
`:"<pre><code>"+(n?t:Qt(t,!0))+`</code></pre>
`}blockquote(t){return`<blockquote>
${t}</blockquote>
`}html(t,r){return t}heading(t,r,n){return`<h${r}>${t}</h${r}>
`}hr(){return`<hr>
`}list(t,r,n){let i=r?"ol":"ul",s=r&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
`+t+"</"+i+`>
`}listitem(t,r,n){return`<li>${t}</li>
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>
`}table(t,r){return r&&(r=`<tbody>${r}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow(t){return`<tr>
${t}</tr>
`}tablecell(t,r){let n=r.header?"th":"td";return(r.align?`<${n} align="${r.align}">`:`<${n}>`)+t+`</${n}>
`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,r,n){let i=gb(t);if(i===null)return n;t=i;let s='<a href="'+t+'"';return r&&(s+=' title="'+r+'"'),s+=">"+n+"</a>",s}image(t,r,n){let i=gb(t);if(i===null)return n;t=i;let s=`<img src="${t}" alt="${n}"`;return r&&(s+=` title="${r}"`),s+=">",s}text(t){return t}},za=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""}},ar=class{options;renderer;textRenderer;constructor(t){this.options=t||we.defaults,this.options.renderer=this.options.renderer||new Es,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new za}static parse(t,r){return new ar(r).parse(t)}static parseInline(t,r){return new ar(r).parseInline(t)}parse(t,r=!0){let n="";for(let i=0;i<t.length;i++){let s=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){let a=s,u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=u||"";continue}}switch(s.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{let a=s;n+=this.renderer.heading(this.parseInline(a.tokens),a.depth,r2(this.parseInline(a.tokens,this.textRenderer)));continue}case"code":{let a=s;n+=this.renderer.code(a.text,a.lang,!!a.escaped);continue}case"table":{let a=s,u="",o="";for(let f=0;f<a.header.length;f++)o+=this.renderer.tablecell(this.parseInline(a.header[f].tokens),{header:!0,align:a.align[f]});u+=this.renderer.tablerow(o);let c="";for(let f=0;f<a.rows.length;f++){let h=a.rows[f];o="";for(let d=0;d<h.length;d++)o+=this.renderer.tablecell(this.parseInline(h[d].tokens),{header:!1,align:a.align[d]});c+=this.renderer.tablerow(o)}n+=this.renderer.table(u,c);continue}case"blockquote":{let a=s,u=this.parse(a.tokens);n+=this.renderer.blockquote(u);continue}case"list":{let a=s,u=a.ordered,o=a.start,c=a.loose,f="";for(let h=0;h<a.items.length;h++){let d=a.items[h],_=d.checked,D=d.task,E="";if(d.task){let g=this.renderer.checkbox(!!_);c?d.tokens.length>0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=g+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&d.tokens[0].tokens[0].type==="text"&&(d.tokens[0].tokens[0].text=g+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:g+" "}):E+=g+" "}E+=this.parse(d.tokens,c),f+=this.renderer.listitem(E,D,!!_)}n+=this.renderer.list(f,u,o);continue}case"html":{let a=s;n+=this.renderer.html(a.text,a.block);continue}case"paragraph":{let a=s;n+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=s,u=a.tokens?this.parseInline(a.tokens):a.text;for(;i+1<t.length&&t[i+1].type==="text";)a=t[++i],u+=`
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=r?this.renderer.paragraph(u):u;continue}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,r){r=r||this.renderer;let n="";for(let i=0;i<t.length;i++){let s=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=a||"";continue}}switch(s.type){case"escape":{let a=s;n+=r.text(a.text);break}case"html":{let a=s;n+=r.html(a.text);break}case"link":{let a=s;n+=r.link(a.href,a.title,this.parseInline(a.tokens,r));break}case"image":{let a=s;n+=r.image(a.href,a.title,a.text);break}case"strong":{let a=s;n+=r.strong(this.parseInline(a.tokens,r));break}case"em":{let a=s;n+=r.em(this.parseInline(a.tokens,r));break}case"codespan":{let a=s;n+=r.codespan(a.text);break}case"br":{n+=r.br();break}case"del":{let a=s;n+=r.del(this.parseInline(a.tokens,r));break}case"text":{let a=s;n+=r.text(a.text);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},pi=class{options;constructor(t){this.options=t||we.defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}};zh(pi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var cd=class{defaults=Yo();options=this.setOptions;parse=this.#e(sr.lex,ar.parse);parseInline=this.#e(sr.lexInline,ar.parseInline);Parser=ar;Renderer=Es;TextRenderer=za;Lexer=sr;Tokenizer=bs;Hooks=pi;constructor(...t){this.use(...t)}walkTokens(t,r){let n=[];for(let i of t)switch(n=n.concat(r.call(this,i)),i.type){case"table":{let s=i;for(let a of s.header)n=n.concat(this.walkTokens(a.tokens,r));for(let a of s.rows)for(let u of a)n=n.concat(this.walkTokens(u.tokens,r));break}case"list":{let s=i;n=n.concat(this.walkTokens(s.items,r));break}default:{let s=i;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{let u=s[a].flat(1/0);n=n.concat(this.walkTokens(u,r))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,r)))}}return n}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let i=J({},n);if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let a=r.renderers[s.name];a?r.renderers[s.name]=function(...u){let o=s.renderer.apply(this,u);return o===!1&&(o=a.apply(this,u)),o}:r.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=r[s.level];a?a.unshift(s.tokenizer):r[s.level]=[s.tokenizer],s.start&&(s.level==="block"?r.startBlock?r.startBlock.push(s.start):r.startBlock=[s.start]:s.level==="inline"&&(r.startInline?r.startInline.push(s.start):r.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(r.childTokens[s.name]=s.childTokens)}),i.extensions=r),n.renderer){let s=this.defaults.renderer||new Es(this.defaults);for(let a in n.renderer){if(!(a in s))throw new Error(`renderer '${a}' does not exist`);if(a==="options")continue;let u=a,o=n.renderer[u],c=s[u];s[u]=(...f)=>{let h=o.apply(s,f);return h===!1&&(h=c.apply(s,f)),h||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new bs(this.defaults);for(let a in n.tokenizer){if(!(a in s))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let u=a,o=n.tokenizer[u],c=s[u];s[u]=(...f)=>{let h=o.apply(s,f);return h===!1&&(h=c.apply(s,f)),h}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new pi;for(let a in n.hooks){if(!(a in s))throw new Error(`hook '${a}' does not exist`);if(a==="options")continue;let u=a,o=n.hooks[u],c=s[u];pi.passThroughHooks.has(a)?s[u]=f=>{if(this.defaults.async)return Pr
Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+Qt(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},mi=new cd;function Ce(e,t){return mi.parse(e,t)}Ce.options=Ce.setOptions=function(e){return mi.setOptions(e),Ce.defaults=mi.defaults,db(Ce.defaults),Ce};Ce.getDefaults=Yo;Ce.defaults=we.defaults;Ce.use=function(...e){return mi.use(...e),Ce.defaults=mi.defaults,db(Ce.defaults),Ce};Ce.walkTokens=function(e,t){return mi.walkTokens(e,t)};Ce.parseInline=mi.parseInline;Ce.Parser=ar;Ce.parser=ar.parse;Ce.Renderer=Es;Ce.TextRenderer=za;Ce.Lexer=sr;Ce.lexer=sr.lex;Ce.Tokenizer=bs;Ce.Hooks=pi;Ce.parse=Ce;var w2=Ce.options,P2=Ce.setOptions,L2=Ce.use,M2=Ce.walkTokens,k2=Ce.parseInline,F2=Ce,B2=ar.parse,j2=sr.lex;we.Hooks=pi;we.Lexer=sr;we.Marked=cd;we.Parser=ar;we.Renderer=Es;we.TextRenderer=za;we.Tokenizer=bs;we.getDefaults=Yo;we.lexer=j2;we.marked=Ce;we.options=w2;we.parse=F2;we.parseInline=k2;we.parser=B2;we.setOptions=P2;we.use=L2;we.walkTokens=M2});var xb=U(Ob=>{"use strict";Object.defineProperty(Ob,"__esModule",{value:!0})});var ld=U(gi=>{"use strict";var Jo=gi&&gi.__assign||function(){return Jo=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Jo.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});gi.flatten=void 0;var H2={xml:!1,decodeEntities:!0};gi.default=H2;var Nb={_useHtmlParser2:!0,xmlMode:!0};function U2(e){return(e==null?void 0:e.xml)?typeof e.xml=="boolean"?Nb:Jo(Jo({},Nb),e.xml):e??void 0}gi.flatten=U2});var As=U(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.Doctype=He.CDATA=He.Tag=He.Style=He.Script=He.Comment=He.Directive=He.Text=He.Root=He.isTag=He.ElementType=void 0;var $t;(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"})($t=He.ElementType||(He.ElementType={}));function G2(e){return e.type===$t.Tag||e.type===$t.Script||e.type===$t.Style}He.isTag=G2;He.Root=$t.Root;He.Text=$t.Text;He.Directive=$t.Directive;He.Comment=$t.Comment;He.Script=$t.Script;He.Style=$t.Style;He.Tag=$t.Tag;He.CDATA=$t.CDATA;He.Doctype=$t.Doctype});var pd=U(le=>{"use strict";var Fn=le&&le.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Va=le&&le.__assign||function(){return Va=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Va.apply(this,arguments)};Object.defineProperty(le,"__esModule",{value:!0});le.cloneNode=le.hasChildren=le.isDocument=le.isDirective=le.isComment=le.isText=le.isCDATA=le.isTag=le.Element=le.Document=le.CDATA=le.NodeWithChildren=le.ProcessingInstruction=le.Comment=le.Text=le.DataNode=le.Node=void 0;var kt=As(),fd=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(t){this.parent=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(t){this.prev=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(t){this.next=t},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(t){return t===void 0&&(t=!1),dd(this,t)},e}();le.Node=fd;var ec=function(e){Fn(t,e);function t(r){var n=e.call(this)||this;ret
`:uc(e.children):(0,Pr.isCDATA)(e)?uc(e.children):(0,Pr.isText)(e)?e.data:""}Ft.getText=uc;function Od(e){return Array.isArray(e)?e.map(Od).join(""):(0,Pr.hasChildren)(e)&&!(0,Pr.isComment)(e)?Od(e.children):(0,Pr.isText)(e)?e.data:""}Ft.textContent=Od;function xd(e){return Array.isArray(e)?e.map(xd).join(""):(0,Pr.hasChildren)(e)&&(e.type===xN.ElementType.Tag||(0,Pr.isCDATA)(e))?xd(e.children):(0,Pr.isText)(e)?e.data:""}Ft.innerText=xd});var mE=U(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.prevElementSibling=ft.nextElementSibling=ft.getName=ft.hasAttrib=ft.getAttributeValue=ft.getSiblings=ft.getParent=ft.getChildren=void 0;var Rd=yt();function hE(e){return(0,Rd.hasChildren)(e)?e.children:[]}ft.getChildren=hE;function pE(e){return e.parent||null}ft.getParent=pE;function RN(e){var t,r,n=pE(e);if(n!=null)return hE(n);for(var i=[e],s=e.prev,a=e.next;s!=null;)i.unshift(s),t=s,s=t.prev;for(;a!=null;)i.push(a),r=a,a=r.next;return i}ft.getSiblings=RN;function wN(e,t){var r;return(r=e.attribs)===null||r===void 0?void 0:r[t]}ft.getAttributeValue=wN;function PN(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}ft.hasAttrib=PN;function LN(e){return e.name}ft.getName=LN;function MN(e){for(var t,r=e.next;r!==null&&!(0,Rd.isTag)(r);)t=r,r=t.next;return r}ft.nextElementSibling=MN;function kN(e){for(var t,r=e.prev;r!==null&&!(0,Rd.isTag)(r);)t=r,r=t.prev;return r}ft.prevElementSibling=kN});var gE=U(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.prepend=Bt.prependChild=Bt.append=Bt.appendChild=Bt.replaceElement=Bt.removeElement=void 0;function Qa(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var t=e.parent.children,r=t.lastIndexOf(e);r>=0&&t.splice(r,1)}e.next=null,e.prev=null,e.parent=null}Bt.removeElement=Qa;function FN(e,t){var r=t.prev=e.prev;r&&(r.next=t);var n=t.next=e.next;n&&(n.prev=t);var i=t.parent=e.parent;if(i){var s=i.children;s[s.lastIndexOf(e)]=t,e.parent=null}}Bt.replaceElement=FN;function BN(e,t){if(Qa(t),t.next=null,t.parent=e,e.children.push(t)>1){var r=e.children[e.children.length-2];r.next=t,t.prev=r}else t.prev=null}Bt.appendChild=BN;function jN(e,t){Qa(t);var r=e.parent,n=e.next;if(t.next=n,t.prev=e,e.next=t,t.parent=r,n){if(n.prev=t,r){var i=r.children;i.splice(i.lastIndexOf(n),0,t)}}else r&&r.children.push(t)}Bt.append=jN;function HN(e,t){if(Qa(t),t.parent=e,t.prev=null,e.children.unshift(t)!==1){var r=e.children[1];r.prev=t,t.next=r}else t.next=null}Bt.prependChild=HN;function UN(e,t){Qa(t);var r=e.parent;if(r){var n=r.children;n.splice(n.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=r,t.prev=e.prev,t.next=e,e.prev=t}Bt.prepend=UN});var wd=U(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.findAll=jt.existsOne=jt.findOne=jt.findOneChild=jt.find=jt.filter=void 0;var oc=yt();function GN(e,t,r,n){return r===void 0&&(r=!0),n===void 0&&(n=1/0),_E(e,Array.isArray(t)?t:[t],r,n)}jt.filter=GN;function _E(e,t,r,n){for(var i=[],s=[t],a=[0];;){if(a[0]>=s[0].length){if(a.length===1)return i;s.shift(),a.shift();continue}var u=s[0][a[0]++];if(e(u)&&(i.push(u),--n<=0))return i;r&&(0,oc.hasChildren)(u)&&u.children.length>0&&(a.unshift(0),s.unshift(u.children))}}jt.find=_E;function qN(e,t){return t.find(e)}jt.findOneChild=qN;function TE(e,t,r){r===void 0&&(r=!0);for(var n=null,i=0;i<t.length&&!n;i++){var s=t[i];if((0,oc.isTag)(s))e(s)?n=s:r&&s.children.length>0&&(n=TE(e,s.children,!0));else continue}return n}jt.findOne=TE;function bE(e,t){return t.some(function(r){return(0,oc.isTag)(r)&&(e(r)||bE(e,r.children))})}jt.existsOne=bE;function zN(e,t){for(var r=[],n=[t],i=[0];;){if(i[0]>=n[0].length){if(n.length===1)return r;n.shift(),i.shift();continue}var s=n[0][i[0]++];!(0,oc.isTag)(s)||(e(s)&&r.push(s),s.children.length>0&&(i.unshift(0),n.unshift(s.children)))}}jt.findAll=zN});var Pd=U(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.getElementsByTagType=ur.getElementsByTagName=ur.getElementById=ur.getElements=ur.testElement=void 0;var Ti=yt(),cc=wd(),lc={tag
:is(button, input, select, textarea, optgroup, option)[disabled],
optgroup[disabled] > option,
fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
)`,enabled:":not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"}});var Ic=U(Nt=>{"use strict";var h1=Nt&&Nt.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))},oR=Nt&&Nt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.subselects=Nt.getNextSiblings=Nt.ensureIsTag=Nt.PLACEHOLDER_ELEMENT=void 0;var yr=oR(Gn()),cR=Hd();Nt.PLACEHOLDER_ELEMENT={};function p1(e,t){return e===yr.default.falseFunc?yr.default.falseFunc:function(r){return t.isTag(r)&&e(r)}}Nt.ensureIsTag=p1;function m1(e,t){var r=t.getSiblings(e);if(r.length<=1)return[];var n=r.indexOf(e);return n<0||n===r.length-1?[]:r.slice(n+1).filter(t.isTag)}Nt.getNextSiblings=m1;function qd(e){return{xmlMode:!!e.xmlMode,lowerCaseAttributeNames:!!e.lowerCaseAttributeNames,lowerCaseTags:!!e.lowerCaseTags,quirksMode:!!e.quirksMode,cacheResults:!!e.cacheResults,pseudos:e.pseudos,adapter:e.adapter,equals:e.equals}}var zd=function(e,t,r,n,i){var s=i(t,qd(r),n);return s===yr.default.trueFunc?e:s===yr.default.falseFunc?yr.default.falseFunc:function(a){return s(a)&&e(a)}};Nt.subselects={is:zd,matches:zd,where:zd,not:function(e,t,r,n,i){var s=i(t,qd(r),n);return s===yr.default.falseFunc?e:s===yr.default.trueFunc?yr.default.falseFunc:function(a){return!s(a)&&e(a)}},has:function(e,t,r,n,i){var s=r.adapter,a=qd(r);a.relativeSelector=!0;var u=t.some(function(d){return d.some(cR.isTraversal)})?[Nt.PLACEHOLDER_ELEMENT]:void 0,o=i(t,a,u);if(o===yr.default.falseFunc)return yr.default.falseFunc;var c=p1(o,s);if(u&&o!==yr.default.trueFunc){var f=o.shouldTestNextSiblings,h=f===void 0?!1:f;return function(d){if(!e(d))return!1;u[0]=d;var _=s.getChildren(d),D=h?h1(h1([],_,!0),m1(d,s),!0):_;return s.existsOne(c,D)}}return function(d){return e(d)&&s.existsOne(c,s.getChildren(d))}}}});var Wd=U(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.compilePseudoSelector=kr.aliases=kr.pseudos=kr.filters=void 0;var lR=ws(),Vd=l1();Object.defineProperty(kr,"filters",{enumerable:!0,get:function(){return Vd.filters}});var eu=f1();Object.defineProperty(kr,"pseudos",{enumerable:!0,get:function(){return eu.pseudos}});var g1=d1();Object.defineProperty(kr,"aliases",{enumerable:!0,get:function(){return g1.aliases}});var Kd=Ic();function fR(e,t,r,n,i){var s,a=t.name,u=t.data;if(Array.isArray(u)){if(!(a in Kd.subselects))throw new Error("Unknown pseudo-class :".concat(a,"(").concat(u,")"));return Kd.subselects[a](e,u,r,n,i)}var o=(s=r.pseudos)===null||s===void 0?void 0:s[a],c=typeof o=="string"?o:g1.aliases[a];if(typeof c=="string"){if(u!=null)throw new Error("Pseudo ".concat(a," doesn't have any arguments"));var f=(0,lR.parse)(c);return Kd.subselects.is(e,f,r,n,i)}if(typeof o=="function")return(0,eu.verifyPseudoArgs)(o,a,u,1),function(d){return o(d,u)&&e(d)};if(a in Vd.filters)return Vd.filters[a](e,u,r,n);if(a in eu.pseudos){var h=eu.pseudos[a];return(0,eu.verifyPseudoArgs)(h,a,u,2),function(d){return h(d,r,u)&&e(d)}}throw new Error("Unknown pseudo-class :".concat(a))}kr.compilePseudoSelector=fR});var _1=U(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.compileGeneralSelector=void 0;var dR=n1(),hR=Wd(),Ir=ws();function Yd(e,t){var r=t.getParent(e);return r&&t.isTag(r)?r:null}function pR(e,t,r,n,i){var s=r.adapter,a=r.equals;switch(t.type){case
`)}}):{name:s,value:a.replace(W1,`\r
`)}}).toArray()}Hs.serializeArray=qw});var Q1=U(Hr=>{"use strict";var zw=Hr&&Hr.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Vw=Hr&&Hr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),su=Hr&&Hr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zw(t,e,r);return Vw(t,e),t};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Cheerio=void 0;var Kw=su(jE()),Ww=su(k1()),Yw=su(G1()),Qw=su(V1()),$w=su(Y1()),au=function(){function e(t,r,n){if(this.length=0,this.options=n,this._root=r,t){for(var i=0;i<t.length;i++)this[i]=t[i];this.length=t.length}}return e}();Hr.Cheerio=au;au.prototype.cheerio="[cheerio object]";au.prototype.splice=Array.prototype.splice;au.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator];Object.assign(au.prototype,Kw,Ww,Yw,Qw,$w)});var X1=U(Ut=>{"use strict";var Xw=Ut&&Ut.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Us=Ut&&Ut.__assign||function(){return Us=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Us.apply(this,arguments)},Zw=Ut&&Ut.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Jw=Ut&&Ut.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$1=Ut&&Ut.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Zw(t,e,r);return Jw(t,e),t};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.getLoad=void 0;var ph=$1(ld()),eP=$1(Ai()),tP=Q1(),uu=Ii();function rP(e,t){return function r(n,i,s){if(s===void 0&&(s=!0),n==null)throw new Error("cheerio.load() expects a string");var a=Us(Us({},ph.default),(0,ph.flatten)(i)),u=e(n,a,s,null),o=function(f){Xw(h,f);function h(){return f!==null&&f.apply(this,arguments)||this}return h.prototype._make=function(d,_){var D=c(d,_);return D.prevObject=this,D},h.prototype._parse=function(d,_,D,E){return e(d,_,D,E)},h.prototype._render=function(d){return t(d,this.options)},h}(tP.Cheerio);function c(f,h,d,_){if(d===void 0&&(d=u),f&&(0,uu.isCheerio)(f))return f;var D=Us(Us({},a),(0,ph.flatten)(_)),E=typeof d=="string"?[e(d,D,!1,null)]:"length"in d?d:[d],g=(0,uu.isCheerio)(E)?E:new o(E,null,D);if(g._root=g,!f)return new o(void 0,g,D);var p=typeof f=="string"&&(0,uu.isHtml)(f)?e(f,D,!1,null).children:nP(f)?[f]:Array.isArray(f)?f:void 0,A=new o(p,g,D);if(p)return A;if(typeof f!="string")throw new Error("Unexpected type of selector");var I=f,b=h?typeof h=="string"?(0,uu.isHtml)(h)?new o([e(h,D,!1,null)],g,D):(I="".concat(h," ").concat(I),g):(0,uu.isCheerio)(h)?h:new o(Array.isArray(h)?h:[h],g,D):g;return b?b.find(I):A}return Object.assign(c,eP,{load:r,_root:u,_options:a,fn:o.prototype,prototype:o.prototype}),c}}Ut.getLoad=rP;function nP(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}});var xc=U(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.
`).length),r.split(`
`).slice(t).filter(gT).map(n=>`
`+n).join("")):""}var xO=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],_T=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],af=xO.concat(_T),NO={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 ls(e,t){this._e=ui(),this.name=e,this.message=t}os(ls).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+sf(this._e,2))}},toString:function(){return this.name+": "+this.message}});function TT(e,t){return e+". Errors: "+Object.keys(t).map(r=>t[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
`)}function Ao(e,t,r,n){this._e=ui(),this.failures=t,this.failedKeys=n,this.successCount=r,this.message=TT(e,t)}os(Ao).from(ls);function Ia(e,t){this._e=ui(),this.name="BulkError",this.failures=Object.keys(t).map(r=>t[r]),this.failuresByPos=t,this.message=TT(e,t)}os(Ia).from(ls);var uf=af.reduce((e,t)=>(e[t]=t+"Error",e),{}),RO=ls,ie=af.reduce((e,t)=>{var r=t+"Error";function n(i,s){this._e=ui(),this.name=r,i?typeof i=="string"?(this.message=`${i}${s?`
`+s:""}`,this.inner=s||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=NO[t]||r,this.inner=null)}return os(n).from(RO),e[t]=n,e},{});ie.Syntax=SyntaxError;ie.Type=TypeError;ie.Range=RangeError;var bT=_T.reduce((e,t)=>(e[t+"Error"]=ie[t],e),{});function wO(e,t){if(!e||e instanceof ls||e instanceof TypeError||e instanceof SyntaxError||!e.name||!bT[e.name])return e;var r=new bT[e.name](t||e.message,e);return"stack"in e&&Xr(r,"stack",{get:function(){return this.inner.stack}}),r}var yo=af.reduce((e,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=ie[t]),e),{});yo.ModifyError=Ao;yo.DexieError=ls;yo.BulkError=Ia;function Ne(){}function va(e){return e}function PO(e,t){return e==null||e===va?t:function(r){return t(e(r))}}function oi(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function LO(e,t){return e===Ne?t:function(){var r=e.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var s=t.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?oi(n,this.onsuccess):n),i&&(this.onerror=this.onerror?oi(i,this.onerror):i),s!==void 0?s:r}}function MO(e,t){return e===Ne?t:function(){e.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?oi(r,this.onsuccess):r),n&&(this.onerror=this.onerror?oi(n,this.onerror):n)}}function kO(e,t){return e===Ne?t:function(r){var n=e.apply(this,arguments);Ot(r,n);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?oi(i,this.onsuccess):i),s&&(this.onerror=this.onerror?oi(s,this.onerror):s),n===void 0?a===void 0?void 0:a:Ot(n,a)}}function FO(e,t){return e===Ne?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function of(e,t){return e===Ne?t:function(){var r=e.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return r.then(function(){return t.apply(n,s)})}return t.apply(this,arguments)}}var Ca={},BO=100,jO=20,ET=100,[cf,Io,lf]=typeof Promise=="undefined"?[]:(()=>{let e=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[e,Ea(e),e];let t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Ea(t),e]})(),AT=Io&&Io.then,vo=cf&&cf.constructor,ff=!!lf,df=!1,HO=lf?()=>{lf.then(Oo)}:je.setImmediate?setImmediate.bind(null,Oo):je.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{Oo(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Oo,0)},Da=function(e,t){Sa.push([e,t]),Co&&(HO(),Co=!1)},hf=!0,Co=!0,ci=[],Do=[],pf=null,mf=va,fs={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:RT,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{RT(e[0],e[1])}catch{}})}},re=fs,Sa=[],li=0,So=[];function Y(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Ne,this._lib=!1;var t=this._PSD=re;if(xr&&(this._stackHolder=ui(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==Ca)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&_f(this,this._value);return}this._state=null,this._value=null,++t.ref,IT(this,e)}var gf={get:function(){var e=re,t=Ro;function r(n,i){var s=!e.global&&(e!==re||t!==Ro);let a=s&&!en();var u=new Y((o,c)=>{Tf(this,new yT(Po(n,e,s,a),Po(i,e,s,a),o,c,e))});return xr&&DT(u,this),u}return r.prototype=Ca,r},set:function(e){Xr(this,"then",e&&e.prototype===Ca?gf:{get:function(){return e},set:gf.set})}};us(Y.prototype,{then:gf,_then:function(e,t){Tf(this,new yT(null,null,e,t,re))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],r=arguments[1];return typeof t=="function"?this.then(null,n=>n instanceof t?r(n):xo(n)):this.then(null,n=>n&&n.name===t?r(n):xo(n))},finally:function(e){return this.then(t
From previous: `);return this._state!==null&&(this._stack=t),t}finally{df=!1}}},timeout:function(e,t){return e<1/0?new Y((r,n)=>{var i=setTimeout(()=>n(new ie.Timeout(t)),e);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&Xr(Y.prototype,Symbol.toStringTag,"Dexie.Promise");fs.env=ST();function yT(e,t,r,n,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=r,this.reject=n,this.psd=i}us(Y,{all:function(){var e=Jr.apply(null,arguments).map(wo);return new Y(function(t,r){e.length===0&&t([]);var n=e.length;e.forEach((i,s)=>Y.resolve(i).then(a=>{e[s]=a,--n||t(e)},r))})},resolve:e=>{if(e instanceof Y)return e;if(e&&typeof e.then=="function")return new Y((r,n)=>{e.then(r,n)});var t=new Y(Ca,!0,e);return DT(t,pf),t},reject:xo,race:function(){var e=Jr.apply(null,arguments).map(wo);return new Y((t,r)=>{e.map(n=>Y.resolve(n).then(t,r))})},PSD:{get:()=>re,set:e=>re=e},totalEchoes:{get:()=>Ro},newPSD:wn,usePSD:hs,scheduler:{get:()=>Da,set:e=>{Da=e}},rejectionMapper:{get:()=>mf,set:e=>{mf=e}},follow:(e,t)=>new Y((r,n)=>wn((i,s)=>{var a=re;a.unhandleds=[],a.onunhandled=s,a.finalize=oi(function(){GO(()=>{this.unhandleds.length===0?i():s(this.unhandleds[0])})},a.finalize),e()},t,r,n))});vo&&(vo.allSettled&&Xr(Y,"allSettled",function(){let e=Jr.apply(null,arguments).map(wo);return new Y(t=>{e.length===0&&t([]);let r=e.length,n=new Array(r);e.forEach((i,s)=>Y.resolve(i).then(a=>n[s]={status:"fulfilled",value:a},a=>n[s]={status:"rejected",reason:a}).then(()=>--r||t(n)))})}),vo.any&&typeof AggregateError!="undefined"&&Xr(Y,"any",function(){let e=Jr.apply(null,arguments).map(wo);return new Y((t,r)=>{e.length===0&&r(new AggregateError([]));let n=e.length,i=new Array(n);e.forEach((s,a)=>Y.resolve(s).then(u=>t(u),u=>{i[a]=u,--n||r(new AggregateError(i))}))})}));function IT(e,t){try{t(r=>{if(e._state===null){if(r===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Oa();r&&typeof r.then=="function"?IT(e,(i,s)=>{r instanceof Y?r._then(i,s):r.then(i,s)}):(e._state=!0,e._value=r,vT(e)),n&&xa()}},_f.bind(null,e))}catch(r){_f(e,r)}}function _f(e,t){if(Do.push(t),e._state===null){var r=e._lib&&Oa();t=mf(t),e._state=!1,e._value=t,xr&&t!==null&&typeof t=="object"&&!t._promise&&yO(()=>{var n=Jl(t,"stack");t._promise=e,Xr(t,"stack",{get:()=>df?n&&(n.get?n.get.apply(t):n.value):e.stack})}),qO(e),vT(e),r&&xa()}}function vT(e){var t=e._listeners;e._listeners=[];for(var r=0,n=t.length;r<n;++r)Tf(e,t[r]);var i=e._PSD;--i.ref||i.finalize(),li===0&&(++li,Da(()=>{--li==0&&bf()},[]))}function Tf(e,t){if(e._state===null){e._listeners.push(t);return}var r=e._state?t.onFulfilled:t.onRejected;if(r===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++li,Da(UO,[r,e,t])}function UO(e,t,r){try{pf=t;var n,i=t._value;t._state?n=e(i):(Do.length&&(Do=[]),n=e(i),Do.indexOf(i)===-1&&zO(t)),r.resolve(n)}catch(s){r.reject(s)}finally{pf=null,--li==0&&bf(),--r.psd.ref||r.psd.finalize()}}function CT(e,t,r){if(t.length===r)return t;var n="";if(e._state===!1){var i=e._value,s,a;i!=null?(s=i.name||"Error",a=i.message||i,n=sf(i,0)):(s=i,a=""),t.push(s+(a?": "+a:"")+n)}return xr&&(n=sf(e._stackHolder,2),n&&t.indexOf(n)===-1&&t.push(n),e._prev&&CT(e._prev,t,r)),t}function DT(e,t){var r=t?t._numPrev+1:0;r<BO&&(e._prev=t,e._numPrev=r)}function Oo(){Oa()&&xa()}function Oa(){var e=hf;return hf=!1,Co=!1,e}function xa(){var e,t,r;do for(;Sa.length>0;)for(e=Sa,Sa=[],r=e.length,t=0;t<r;++t){var n=e[t];n[0].apply(null,n[1])}while(Sa.length>0);hf=!0,Co=!0}function bf(){var e=ci;ci=[],e.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var t=So.slice(0),r=t.length;r;)t[--r]()}function GO(e){function t(){e(),So.splice(So.indexOf(t),1)}So.push(t),++li,Da(()=>{--li==0&&bf()},[])}function qO(e){ci.some(t=>t._value===e._value)||ci.push(e)}function zO(e){for(var t=ci.length;t;)if(ci[--t]._value===e._value){ci.splice(t,1);return}}function xo(e){return new Y(Ca,!1,e)}function ze(e,t){var r=re;return function(){var n=Oa(),i=re;try{return Pn(r,!0),
`)}else if(ua(t))try{let o=JSON.parse(await r.vault.cachedRead(n)),c=[],f=h=>{for(let d in h)typeof h[d]=="object"?f(h[d]):d==="content"&&c.push(h[d])};f(o),i=c.join(`\r
`)}catch(o){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(o)}else ei(t)&&this.plugin.settings.imagesIndexing&&s?.canFileBeExtracted(t)?i=await s.extractText(n):_n(t)&&this.plugin.settings.PDFIndexing&&s?.canFileBeExtracted(t)?i=await s.extractText(n):_0(t)&&this.plugin.settings.officeIndexing&&s?.canFileBeExtracted(t)?i=await s.extractText(n):this.plugin.notesIndexer.isFilenameIndexable(t)&&(i=n.path);i==null&&(console.warn(`Omnisearch: ${i} content for file`,n.path),i="");let a=r.metadataCache.getFileCache(n);if(a){let o=f0(this.plugin.app,n,a);for(let c of o.filter(f=>!this.documents.has(f))){let f=this.plugin.notesIndexer.generateIndexableNonexistingDocument(c,n.path)}if(a.frontmatter?.["excalidraw-plugin"]){let c=a.sections?.filter(f=>f.type==="comment")??[];for(let{start:f,end:h}of c.map(d=>d.position))i=i.substring(0,f.offset-1)+i.substring(h.offset)}}let u=g0(a);return{basename:n.basename,content:i,cleanedContent:p0(Yr(i)),path:n.path,mtime:n.stat.mtime,tags:u,unmarkedTags:u.map(o=>o.replace("#","")),aliases:m0(a).join(""),headings1:a?Lu(a,1).join(" "):"",headings2:a?Lu(a,2).join(" "):"",headings3:a?Lu(a,3).join(" "):""}}};ir();sa();ir();var kh=class{constructor(t){this.plugin=t;this.notesToReindex=new Set}flagNoteForReindex(t){this.notesToReindex.add(t)}async refreshIndex(){for(let r of this.notesToReindex)ve("Updating file",r.path),await this.plugin.cacheManager.addToLiveCache(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=n&&r.PDFIndexing,s=n&&r.imagesIndexing;return this.isFilePlaintext(t)||ti(t)||ua(t)||i&&_n(t)||s&&ei(t)}isFilenameIndexable(t){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(t)||ti(t)||ua(t)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(t,r){return t=ll(t),{path:t+(t.endsWith(".md")?"":".md"),basename:t,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}`))}};Or();ir();var Oy=Xe(require("obsidian"));_o();var Fh=class{constructor(t){this.plugin=t}highlightText(t,r){let n=`suggestion-highlight omnisearch-highlight ${this.plugin.settings.highlight?"omnisearch-default-highlight":""}`;if(!r.length)return t;try{let i=new RegExp(r.map(u=>{let o=xn(u.match);return`\\b${o}\\b${/[a-zA-Z]/.test(u.match)?"":`|${o}`}`}).join("|"),"giu"),s=u=>r.find(c=>u.match(new RegExp(`\\b${xn(c.match)}\\b${/[a-zA-Z]/.test(c.match)?"":`|${xn(c.match)}`}`,"giu")))?`<span class="${n}">${u}</span>`:u,a=t.replace(i,s);if(a===t){let u=new RegExp(r.map(o=>xn(o.match)).join("|"),"giu");a=t.replace(u,s)}return a}catch(i){return console.error("Omnisearch - Error in highlightText()",i),t}}escapeHTML(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}stringsToRegex(t){if(!t.length)return/^$/g;t.sort((n,i)=>i.length-n.length);let r=`(${t.map(n=>`\\b${xn(n)}\\b|${xn(n)}`).join("|")})`;return new RegExp(`${r}`,"gui")}getMatches(t,r,n){let i=this.stringsToRegex(r),s=t;this.plugin.settings.ignoreDiacritics&&(t=Yr(t));let a=new Date().getTime(),u=null,o=[],c=0;for(;(u=i.exec(t))!==null;){if(++c>=100||new Date().getTime()-a>50){b0("Stopped getMatches at",c,"results");break}let f=u.index,h=f+u[0].length,d=s.substring(f,h).trim();d&&u.index>=0&&o.push({match:d,offset:u.index})}if(n&&(n.query.text.length>1||n.getExactTerms().length>0)){let f=t.indexOf(n.getBestStringForExcerpt());f>-1&&o.find(h=>h.offset===f)&&o.unshift({offset:f,match:n.get
`);let o=t.lastIndexOf(`
`,i-s);o>0&&(t=t.slice(o))}return t=MM(t),n.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
`,"<br>")),t}catch(i){return new Oy.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(i),""}}};function MM(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var Bh=class extends Ri.Plugin{constructor(t,r){super(t,r);this.apiHttpServer=null;this.settings=Fu(this.app);this.database=new zo(this);this.notesIndexer=new kh(this);this.textProcessor=new Fh(this);this.searchEngine=new Lh(this);this.cacheManager=new Mh(this)}async onload(){if(this.settings=await y0(this),this.addSettingTab(new ml(this)),Ri.Platform.isMobile||Promise.resolve().then(()=>(Py(),wy)).then(n=>this.apiHttpServer=n.getServer(this)),gl(this.app)){console.log("Omnisearch - Plugin disabled");return}await FM(this.app),await this.database.clearOldDatabases(),uT(this);let t=this.settings;t.ribbonIcon&&this.addRibbonButton(),ce.disable("vault"),ce.disable("infile"),ce.on("global",Nu.ToggleExcerpts,()=>{ri.set(!t.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Nn(this).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(n,i)=>{i.file&&new as(this,i.file).open()}});let r=this.searchEngine;this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",n=>{this.notesIndexer.isFileIndexable(n.path)&&(ve("Indexing new file",n.path),r.addFromPaths([n.path]))})),this.registerEvent(this.app.vault.on("delete",n=>{ve("Removing file",n.path),this.cacheManager.removeFromLiveCache(n.path),r.removeFromPaths([n.path])})),this.registerEvent(this.app.vault.on("modify",async n=>{this.notesIndexer.isFileIndexable(n.path)&&this.notesIndexer.flagNoteForReindex(n)})),this.registerEvent(this.app.vault.on("rename",async(n,i)=>{this.notesIndexer.isFileIndexable(n.path)&&(ve("Renaming file",n.path),this.cacheManager.removeFromLiveCache(i),await this.cacheManager.addToLiveCache(n.path),r.removeFromPaths([i]),await r.addFromPaths([n.path]))})),this.refreshIndexCallback=this.notesIndexer.refreshIndex.bind(this.notesIndexer),addEventListener("blur",this.refreshIndexCallback),removeEventListener,await this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&t.httpApiEnabled&&this.apiHttpServer.listen(t.httpApiPort)})}async executeFirstLaunchTasks(){let t="1.21.0";this.settings.welcomeMessage=t,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",t=>{new Nn(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}async populateIndex(){console.time("Omnisearch - Indexing total time"),mn.set(nr.ReadingFiles);let t=this.app.vault.getFiles().filter(i=>this.notesIndexer.isFileIndexable(i.path));console.log(`Omnisearch - ${t.length} files total`),console.log(`Omnisearch - Cache is ${bn()?"enabled":"disabled"}`);let r=this.searchEngine;bn()&&(console.time("Omnisearch - Loading index from cache"),mn.set(nr.LoadingCache),await r.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let n=r.getDiff(t.map(i=>({path:i.path,mtime:i.stat.mtime})));bn()&&(n.toAdd.length&&console.log("Omnisearch - Total number of files to add/update: "+n.toAdd.length),n.toRemove.length&&console.log("Omnisearch - Total number of files to remove: "+n.toRemove.length)),n.toAdd.length>=1e3&&bn()&&new Ri.Notice(`Omnisearch - ${n.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),mn.set(nr.IndexingFiles),r.removeFromPaths(n.toRemove.map(i=>i.path)),await r.addFromPaths(n.toAdd.map(i=>i.path)),(n.toRemove.length||n.toAdd.le