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

107 lines
595 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
*/
2024-08-09 08:39:12 +03:00
var Fy=Object.create;var Xs=Object.defineProperty,By=Object.defineProperties,jy=Object.getOwnPropertyDescriptor,Hy=Object.getOwnPropertyDescriptors,Uy=Object.getOwnPropertyNames,Uh=Object.getOwnPropertySymbols,Gy=Object.getPrototypeOf,Gh=Object.prototype.hasOwnProperty,qy=Object.prototype.propertyIsEnumerable;var Qc=(e,t,r)=>t in e?Xs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J=(e,t)=>{for(var r in t||(t={}))Gh.call(t,r)&&Qc(e,r,t[r]);if(Uh)for(var r of Uh(t))qy.call(t,r)&&Qc(e,r,t[r]);return e},Fe=(e,t)=>By(e,Hy(t)),qh=e=>Xs(e,"__esModule",{value:!0});var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zh=(e,t)=>{qh(e);for(var r in t)Xs(e,r,{get:t[r],enumerable:!0})},zy=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Uy(t))!Gh.call(e,n)&&n!=="default"&&Xs(e,n,{get:()=>t[n],enumerable:!(r=jy(t,n))||r.enumerable});return e},Xe=e=>zy(qh(Xs(e!=null?Fy(Gy(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Vh=(e,t,r)=>(Qc(e,typeof t!="symbol"?t+"":t,r),r);function qe(){}function Vy(e,t){for(let r in t)e[r]=t[r];return e}function $c(e){return e()}function Kh(){return Object.create(null)}function lr(e){e.forEach($c)}function Li(e){return typeof e=="function"}function ot(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Xc(e,t){return Du||(Du=document.createElement("a")),Du.href=t,e===Du.href}function Wh(e){return Object.keys(e).length===0}function Yh(e,...t){if(e==null)return qe;let r=e.subscribe(...t);return r.unsubscribe?()=>r.unsubscribe():r}function Su(e,t,r){e.$$.on_destroy.push(Yh(t,r))}function Mi(e,t,r,n){if(e){let i=Qh(e,t,r,n);return e[0](i)}}function Qh(e,t,r,n){return e[1]&&n?Vy(r.ctx.slice(),e[1](n(t))):r.ctx}function ki(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 Fi(e,t,r,n,i,s){if(i){let a=Qh(t,r,n,s);e.p(a,i)}}function Bi(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 $h(e){return e&&Li(e.destroy)?e.destroy:qe}function Ky(){Zh=!0}function Wy(){Zh=!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 Ou(e,t){for(let r=0;r<e.length;r+=1)e[r]&&e[r].d(t)}function V(e){return document.createElement(e)}function dt(e){return document.createTextNode(e)}function ue(){return dt(" ")}function Zs(){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 Yy(e){return Array.from(e.childNodes)}function xr(e,t){t=""+t,e.data!==t&&(e.data=t)}function Zc(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 Jc(e,t,r){e.classList[r?"add":"remove"](t)}function Qy(e,t,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(e,r,n,t),i}function ea(e){Js=e}function el(){if(!Js)throw new Error("Function called outside component initialization");return Js}function ta(e){el().$$.on_mount.push(e)}function ra(e){el().$$.on_destroy.push(e)}function tl(){let e=el();return(t,r,{cancelable:n=!1}={})=>{let i=e.$$.callbacks[t];if(i){let s=Qy(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 t0(){rl||(rl=!0,e0.then(r0))}function mn(){return t0(),e0}function nl(e){Hi.push(e)}function r0(){if(Ui!==0)return;let e=Js;do{try{for(;Ui<ji.length;){let t=ji[Ui];Ui++,ea(t),$y(t.$$)}}catch(t){throw ji.length=0,Ui=0,t}for(ea(null),ji.length=0,Ui=0;Yr.length;)Yr.pop()();for(let t=0;t<Hi.length;t+=1){let r=Hi[t];il.has(r)||(il.add(r),r())}Hi.length=0}while(ji.
2024-06-13 21:01:37 +03:00
<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>
2024-08-09 08:39:12 +03:00
`,new DocumentFragment().createSpan({},f=>{f.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?f.innerHTML+=`
2024-06-13 21:01:37 +03:00
\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.
2024-08-09 08:39:12 +03:00
<br />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:f.innerHTML+='\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.',s?f.innerHTML+='<br/>\u{1F44D} You have installed <a href="https://github.com/Swaggeroo/obsidian-ai-image-analyzer">AI Image Analyzer</a>, Omnisearch can use it to index images contents with ai.':f.innerHTML+='<br/>\u26A0\uFE0F Omnisearch requires <a href="https://github.com/Swaggeroo/obsidian-ai-image-analyzer">AI Image Analyzer</a> to index images with ai.'}),new ee.Setting(t).setName("Indexing").setHeading().setDesc(sr(`\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?`\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.`:'\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}`)),new ee.Setting(t).setName(`PDFs content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(sr("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(f=>f.setValue(z.PDFIndexing).onChange(async p=>{await r.clearCache(),z.PDFIndexing=p,await pe(this.plugin)})).setDisabled(!n),new ee.Setting(t).setName(`Images OCR indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(sr("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(f=>f.setValue(z.imagesIndexing).onChange(async p=>{await r.clearCache(),z.imagesIndexing=p,await pe(this.plugin)})).setDisabled(!n);let o=new DocumentFragment;o.createSpan({},f=>{f.innerHTML='Omnisearch will use Text Extractor to index the content of your office documents (currently <pre style="display:inline">.docx</pre> and <pre style="display:inline">.xlsx</pre>).'}),new ee.Setting(t).setName(`Documents content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(f=>f.setValue(z.officeIndexing).onChange(async p=>{await r.clearCache(),z.officeIndexing=p,await pe(this.plugin)})).setDisabled(!n);let c=new DocumentFragment;c.createSpan({},f=>{f.innerHTML="Omnisearch will use AI Image Analyzer to index the content of your images with ai."}),new ee.Setting(t).setName(`Images AI indexing ${s?"":"\u26A0\uFE0F Disabled"}`).setDesc(c).addToggle(f=>f.setValue(z.aiImageIndexing).onChange(async p=>{await r.clearCache(),z.aiImageIndexing=p,await pe(this.plugin)})).setDisabled(!s),new ee.Setting(t).setName("Index paths of unsupported files").setDesc(sr(`
2024-06-13 21:01:37 +03:00
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/>
2024-08-09 08:39:12 +03:00
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions".`)).addDropdown(f=>{f.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(z.unsupportedFilesIndexing).onChange(async p=>{await i(),z.unsupportedFilesIndexing=p,await pe(this.plugin)})}),new ee.Setting(t).setName("Set frontmatter property key as title").setDesc(sr(`If you have a custom property in your notes that you want to use as the title in search results.<br>
Leave empty to disable.`)).addText(f=>{f.setValue(z.displayTitle).onChange(async p=>{await i(),z.displayTitle=p,await pe(this.plugin)})}),new ee.Setting(t).setName("Additional TEXT files to index").setDesc(sr(`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">PLAINTEXT</strong> files.<br/>
2024-06-13 21:01:37 +03:00
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,
2024-08-09 08:39:12 +03:00
because Omnisearch will try to index their content.</span>`)).addText(f=>{f.setValue(z.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async p=>{await r.clearCache(),z.indexedFileTypes=p.split(" "),await pe(this.plugin)})}),new ee.Setting(t).setName("Behavior").setHeading(),new ee.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(f=>f.setValue(z.useCache).onChange(async p=>{z.useCache=p,await pe(this.plugin)})),new ee.Setting(t).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(f=>f.setValue(z.showPreviousQueryResults).onChange(async p=>{z.showPreviousQueryResults=p,await pe(this.plugin)})),new ee.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(f=>f.setValue(z.hideExcluded).onChange(async p=>{z.hideExcluded=p,await pe(this.plugin)})),new ee.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(f=>{f.setValue(z.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async p=>{let A=p.split(",");A=A.map(b=>b.trim()),z.downrankedFoldersFilters=A,await pe(this.plugin)})}),new ee.Setting(t).setName("Split CamelCaseWords").setDesc(sr(`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
2024-06-13 21:01:37 +03:00
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
2024-08-09 08:39:12 +03:00
${po}`)).addToggle(f=>f.setValue(z.splitCamelCase).onChange(async p=>{await r.clearCache(),z.splitCamelCase=p,await pe(this.plugin)})),new ee.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(f=>f.setValue(z.simpleSearch).onChange(async p=>{z.simpleSearch=p,await pe(this.plugin)})),ee.Platform.isIosApp||new ee.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(f=>f.setValue(z.tokenizeUrls).onChange(async p=>{z.tokenizeUrls=p,await pe(this.plugin)})),new ee.Setting(t).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(f=>f.setValue(z.openInNewPane).onChange(async p=>{z.openInNewPane=p,await pe(this.plugin)})),new ee.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(f=>f.setValue(z.vimLikeNavigationShortcut).onChange(async p=>{z.vimLikeNavigationShortcut=p,await pe(this.plugin)})),new ee.Setting(t).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(f=>f.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(z.fuzziness).onChange(async p=>{["0","1","2"].includes(p)||(p="2"),z.fuzziness=p,await pe(this.plugin)})),new ee.Setting(t).setName("User Interface").setHeading(),new ee.Setting(t).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(f=>f.setValue(z.ribbonIcon).onChange(async p=>{z.ribbonIcon=p,await pe(this.plugin),p?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new ee.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(f=>f.setValue(z.showExcerpt).onChange(async p=>{ai.set(p)})),new ee.Setting(t).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(f=>f.setValue(z.renderLineReturnInExcerpts).onChange(async p=>{z.renderLineReturnInExcerpts=p,await pe(this.plugin)})),new ee.Setting(t).setName('Show "Create note" button').setDesc(sr(`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.`)).addToggle(f=>f.setValue(z.showCreateButton).onChange(async p=>{z.showCreateButton=p,await pe(this.plugin)})),new ee.Setting(t).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(f=>f.setValue(z.highlight).onChange(async p=>{z.highlight=p,await pe(this.plugin)}));let d=mo(this.app);new ee.Setting(t).setName("Results weighting").setHeading(),new ee.Setting(t).setName(`File name & declared aliases (default: ${d.weightBasename})`).addSlider(f=>this.weightSlider(f,"weightBasename")),new ee.Setting(t).setName(`File directory (default: ${d.weightDirectory})`).addSlider(f=>this.weightSlider(f,"weightDirectory")),new ee.Setting(t).setName(`Headings level 1 (default: ${d.weightH1})`).addSlider(f=>this.weightSlider(f,"weightH1")),new ee.Setting(t).setName(`Headings level 2 (default: ${d.weightH2})`).addSlider(f=>this.weightSlider(f,"weightH2")),new ee.Setting(t).setName(`Headings level 3 (default: ${d.weightH3})`).addSlider(f=>this.weightSlider(f,"weightH3")),new ee.Setting(t).setName(`Tags (default: ${d.weightUnmarkedTags})`).addSlider(f=>this.weightSlider(f,"weightUnmarkedTags")),new ee.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 f=0;f<z.weightCustomProperties.length;f++){let p=z.weightCustomProperties[f];new ee.Setting(t).setName((f+1).toString()+".").addText(A=>{A.setPlaceholder("Property name").setValue(p.name).onChange(async b=>{p.name=b,await pe(this.plugin)})}).addSlider(A=>{A.setLimits(.1,5,.1).setValue(p.weight).setDynamicTooltip().onChange(async b=>{p.weight=b,await pe(this.plugin)})}).addButton(A=>{A.setButtonText("Remove"),A.onClick(async()=>{z.weightCustomProperties.splice(f,1),await pe(this.plugin),this.display()})})}new ee.Setting(t).addButton(f=>{f.setButtonText("Add a new property"),f.onClick(p=>{z.weightCustomProperties.push({name:"",weight:1}),this.display()})}),ee.Platform.isMobile||(new ee.Setting(t).setName("API Access Through HTTP").setHeading().setDesc(sr('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 ee.Setting(t).setName("Enable the HTTP server").addToggle(f=>f.setValue(z.httpApiEnabled).onChange(async p=>{z.httpApiEnabled=p,p?this.plugin.apiHttpServer.listen(z.httpApiPort):this.plugin.apiHttpServer.close(),await pe(this.plugin)})),new ee.Setting(t).setName("HTTP Port").addText(f=>{f.setValue(z.httpApiPort).setPlaceholder("51361").onChange(async p=>{parseInt(p)>65535&&(p=z.httpApiPort,f.setValue(z.httpApiPort)),z.httpApiPort=p,z.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(z.httpApiPort)),await pe(this.plugin)})}),new ee.Setting(t).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(f=>f.setValue(z.httpApiNotice).onChange(async p=>{z.httpApiNotice=p,await pe(this.plugin)}))),new ee.Setting(t).setName("Debugging").setHeading(),new ee.Setting(t).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(f=>f.setValue(z.verboseLogging).onChange(async p=>{z.verboseLogging=p,gl(p),await pe(this.plugin)})),new ee.Setting(t).setName("Danger Zone").setHeading(),new ee.Setting(t).setName("Ignore diacritics").setDesc(sr(`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
2024-06-13 21:01:37 +03:00
\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>
2024-08-09 08:39:12 +03:00
${po}`)).addToggle(f=>f.setValue(z.ignoreDiacritics).onChange(async p=>{await r.clearCache(),z.ignoreDiacritics=p,await pe(this.plugin)})),new ee.Setting(t).setName("Ignore Arabic diacritics (beta)").addToggle(f=>f.setValue(z.ignoreArabicDiacritics).onChange(async p=>{await r.clearCache(),z.ignoreArabicDiacritics=p,await pe(this.plugin)}));let h=new DocumentFragment;h.createSpan({},f=>{f.innerHTML=`Disable Omnisearch on this device only.<br>
${po}`}),new ee.Setting(t).setName("Disable on this device").setDesc(h).addToggle(f=>f.setValue(Kl(this.app)).onChange(async p=>{p?(this.app.saveLocalStorage(ia,"1"),new ee.Notice("Omnisearch - Disabled. Please restart Obsidian.")):(this.app.saveLocalStorage(ia),new ee.Notice("Omnisearch - Enabled. Please restart Obsidian."))})),new ee.Setting(t).setName("Force save the cache").setDesc(sr(`Omnisearch has a security feature that automatically disables cache writing if it cannot fully perform the operation.<br>
Use this option to force the cache to be saved, even if it causes a crash.<br>
\u26A0\uFE0F <span style="color: var(--text-accent)">Enabling this setting could lead to crash loops</span>`)).addToggle(f=>f.setValue(z.DANGER_forceSaveCache).onChange(async p=>{z.DANGER_forceSaveCache=p,await pe(this.plugin)})),Nn()&&new ee.Setting(t).setName("Clear cache data").setDesc(sr(`Erase all Omnisearch cache data.
2024-06-13 21:01:37 +03:00
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
2024-08-09 08:39:12 +03:00
${po}`)).addButton(f=>{f.setButtonText("Clear cache"),f.onClick(async()=>{await r.clearCache()})})}weightSlider(t,r){t.setLimits(1,5,.1).setValue(z[r]).setDynamicTooltip().onChange(async n=>{z[r]=n,await pe(this.plugin)})}}});function WS(e){let t;return{c(){t=V("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 YS(e){"use strict";return[]}var C_,D_,S_=x(()=>{rr();C_=class extends pt{constructor(t){super();bt(this,t,YS,WS,ot,{})}},D_=C_});function x_(e){let t,r;return t=new D_({}),{c(){Lt(t.$$.fragment)},m(n,i){Dt(t,n,i),r=!0},i(n){r||(Ee(t.$$.fragment,n),r=!0)},o(n){Oe(t.$$.fragment,n),r=!1},d(n){Tt(t,n)}}}function QS(e){let t,r,n,i,s,a=e[2]&&x_(e),u=e[4].default,o=Mi(u,e,e[3],null);return{c(){t=V("div"),a&&a.c(),r=ue(),o&&o.c(),Z(t,"data-result-id",e[0]),Z(t,"class","suggestion-item omnisearch-result"),Jc(t,"is-selected",e[1])},m(c,d){ae(c,t,d),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,[d]){c[2]?a?d&4&&Ee(a,1):(a=x_(c),a.c(),Ee(a,1),a.m(t,r)):a&&(ei(),Oe(a,1,1,()=>{a=null}),ti()),o&&o.p&&(!n||d&8)&&Fi(o,u,c,c[3],n?ki(u,c[3],d,null):Bi(c[3]),null),(!n||d&1)&&Z(t,"data-result-id",c[0]),(!n||d&2)&&Jc(t,"is-selected",c[1])},i(c){n||(Ee(a),Ee(o,c),n=!0)},o(c){Oe(a),Oe(o,c),n=!1},d(c){c&&se(t),a&&a.d(),o&&o.d(c),i=!1,lr(s)}}}function $S(e,t,r){let{$$slots:n={},$$scope:i}=t,{id:s}=t,{selected:a=!1}=t,{glyph:u=!1}=t;function o(f){Vt.call(this,e,f)}function c(f){Vt.call(this,e,f)}function d(f){Vt.call(this,e,f)}function h(f){Vt.call(this,e,f)}return e.$$set=f=>{"id"in f&&r(0,s=f.id),"selected"in f&&r(1,a=f.selected),"glyph"in f&&r(2,u=f.glyph),"$$scope"in f&&r(3,i=f.$$scope)},[s,a,u,i,n,o,c,d,h]}var O_,go,Yl=x(()=>{rr();S_();O_=class extends pt{constructor(t){super();bt(this,t,$S,QS,ot,{id:0,selected:1,glyph:2})}},go=O_});function N_(e){let t,r=e[1].matches.length+"",n,i,s=(e[1].matches.length>1?"matches":"match")+"",a;return{c(){t=V("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+"")&&xr(n,r),o&2&&s!==(s=(u[1].matches.length>1?"matches":"match")+"")&&xr(a,s)},d(u){u&&se(t)}}}function w_(e){let t,r,n,i,s=e[2].textProcessor.highlightText(e[4],e[10])+"";return{c(){t=V("div"),r=V("span"),n=ue(),i=V("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 R_(e){let t,r=e[2].textProcessor.highlightText(e[9],e[1].matches)+"";return{c(){t=V("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 P_(e){let t,r,n;return{c(){t=V("div"),r=V("img"),zt(r,"width","100px"),Xc(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&&!Xc(r.src,n=i[7])&&Z(r,"src",n)},d(i){i&&se(t)}}}function XS(e){let t,r,n,i,s,a,u=e[2].textProcessor.highlightText(e[3],e[11])+"",o,c,d,h=En(e[1].path)+"",f,p,A,b,D,g,v=e[1].m
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var we=!0,tt=!1,Kr;return{s:function(){H=H.call(R)},n:function(){var X=H.next();return we=X.done,X},e:function(X){tt=!0,Kr=X},f:function(){try{!we&&H.return!=null&&H.return()}finally{if(tt)throw Kr}}}}function c(R,F){if(!!R){if(typeof R=="string")return d(R,F);var H=Object.prototype.toString.call(R).slice(8,-1);if(H==="Object"&&R.constructor&&(H=R.constructor.name),H==="Map"||H==="Set")return Array.from(R);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return d(R,F)}}function d(R,F){(F==null||F>R.length)&&(F=R.length);for(var H=0,te=new Array(F);H<F;H++)te[H]=R[H];return te}function h(R,F){if(!(R instanceof F))throw new TypeError("Cannot call a class as a function")}function f(R,F){for(var H=0;H<F.length;H++){var te=F[H];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(R,te.key,te)}}function p(R,F,H){return F&&f(R.prototype,F),H&&f(R,H),Object.defineProperty(R,"prototype",{writable:!1}),R}function A(R,F,H){return F in R?Object.defineProperty(R,F,{value:H,enumerable:!0,configurable:!0,writable:!0}):R[F]=H,R}function b(R,F,H){D(R,F),F.set(R,H)}function D(R,F){if(F.has(R))throw new TypeError("Cannot initialize the same private elements twice on an object")}function g(R,F){var H=T(R,F,"get");return v(R,H)}function v(R,F){return F.get?F.get.call(R):F.value}function I(R,F,H){var te=T(R,F,"set");return E(R,te,H),H}function T(R,F,H){if(!F.has(R))throw new TypeError("attempted to "+H+" private field on non-instance");return F.get(R)}function E(R,F,H){if(F.set)F.set.call(R,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 R(F){var H=F.executor,te=H===void 0?function(){}:H,de=F.internals,we=de===void 0?Ke():de,tt=F.promise,Kr=tt===void 0?new Promise(function(_t,X){return te(_t,X,function($e){we.onCancelList.push($e)})}):tt;h(this,R),b(this,S,{writable:!0,value:void 0}),b(this,N,{writable:!0,value:void 0}),A(this,C,"CancelablePromise"),this.cancel=this.cancel.bind(this),I(this,S,we),I(this,N,Kr||new Promise(function(_t,X){return te(_t,X,function($e){we.onCancelList.push($e)})}))}return p(R,[{key:"then",value:function(H,te){return ke(g(this,N).then(he(H,g(this,S)),he(te,g(this,S))),g(this,S))}},{key:"catch",value:function(H){return ke(g(this,N).catch(he(H,g(this,S))),g(this,S))}},{key:"finally",value:function(H,te){var de=this;return te&&g(this,S).onCancelList.push(H),ke(g(this,N).finally(he(function(){if(H)return te&&(g(de,S).onCancelList=g(de,S).onCancelList.filter(function(we){return we!==H})),H()},g(this,S))),g(this,S))}},{key:"cancel",value:function(){g(this,S).isCanceled=!0;var H=g(this,S).onCancelList;g(this,S).onCancelList=[];var te=o(H),de;try{for(te.s();!(de=te.n()).done;){var we=de.value;if(typeof we=="function")try{we()}catch(tt){console.error(tt)}}}catch(tt){te.e(tt)}finally{te.f()}}},{key:"isCanceled",value:function(){return g(this,S).isCanceled===!0}}]),R}(),q=function(R){t(H,R);var F=n(H);function H(te){return h(this,H),F.call(this,{executor:te})}return p(H)}(P);e.CancelablePromise=q,A(q,"all",function(F){return Ie(F,Promise.all(F))}),A(q,"allSettled",function(F){return Ie(F,Promise.allSettled(F))}),A(q,"any",function(F){return Ie(F,Promise.any(F))}),A(q,"race",function(F){return Ie(F,Promise.race(F))}),A(q,"resolve",function(F){return ge(Promise.resolve(F))}),A(q,"reject",function(F){return ge(Promise.reject(F))}),A(q,"isCancelable",W);var $=q;e.default=$;function ge(R){return ke(R,Ke())}function W(R){return R instanceof q||R instanceof P}function he(R,F){if(R)return function(H){if(!F.isCanceled){var te=R(H);return W(te)&&F.onCancelList.push(te.cancel),te}return H}}function ke(R,F){return new P({internals:F,promise:R})}function Ie(R,F){var H=Ke();return H.onCancelList.push(function(){var te=o(R),de;try{for(te.s();!(de=te.n()).done;){var we=de.value;W(we)&&we.cancel()}}catch(tt){te.e(tt)}final
`),i&&i.c(),n=Zs()},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(sa).some(Y_)),r?i||(i=W_(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 W_(e){let t,r,n;return{c(){t=V("br"),r=ue(),n=V("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 ix(e){let t,r,n,i=e[3],s=[];for(let d=0;d<i.length;d+=1)s[d]=K_(q_(e,i,d));let a=d=>Oe(s[d],1,1,()=>{s[d]=null});function u(d,h){if(!d[3].length&&d[2]&&!d[5])return nx;if(d[5])return rx}let o=u(e,[-1,-1]),c=o&&o(e);return{c(){for(let d=0;d<s.length;d+=1)s[d].c();t=ue(),r=V("div"),c&&c.c(),zt(r,"text-align","center")},m(d,h){for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(d,h);ae(d,t,h),ae(d,r,h),c&&c.m(r,null),n=!0},p(d,h){if(h[0]&12299){i=d[3];let f;for(f=0;f<i.length;f+=1){let p=q_(d,i,f);s[f]?(s[f].p(p,h),Ee(s[f],1)):(s[f]=K_(p),s[f].c(),Ee(s[f],1),s[f].m(t.parentNode,t))}for(ei(),f=i.length;f<s.length;f+=1)a(f);ti()}o===(o=u(d,h))&&c?c.p(d,h):(c&&c.d(1),c=o&&o(d),c&&(c.c(),c.m(r,null)))},i(d){if(!n){for(let h=0;h<i.length;h+=1)Ee(s[h]);n=!0}},o(d){s=s.filter(Boolean);for(let h=0;h<s.length;h+=1)Oe(s[h]);n=!1},d(d){Ou(s,d),d&&se(t),d&&se(r),c&&c.d()}}}function sx(e){let t,r,n,i,s,a,u,o,c,d,h,f,p,A,b,D,g,v,I,T,E,C,S,N,P,q,$,ge,W,he,ke,Ie,Ke,R,F,H,te,de,we,tt,Kr,_t,X,$e,Wr,cr,Zn,Pi,pn,ky={plugin:e[0],initialValue:e[2],placeholder:"Omnisearch - Vault",$$slots:{default:[tx]},$$scope:{ctx:e}};t=new Lu({props:ky}),e[19](t),t.$on("input",e[20]);let Pt=e[4]&&V_(e);return i=new Mu({props:{$$slots:{default:[ix]},$$scope:{ctx:e}}}),{c(){Lt(t.$$.fragment),r=ue(),Pt&&Pt.c(),n=ue(),Lt(i.$$.fragment),s=ue(),a=V("div"),u=V("div"),u.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',o=ue(),c=V("div"),c.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
<span>to cycle history</span>`,d=ue(),h=V("div"),f=V("span"),p=dt(e[8]),A=ue(),b=V("span"),b.textContent="to open",D=ue(),g=V("div"),g.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to In-File Search</span>`,v=ue(),I=V("div"),T=V("span"),E=dt(e[7]),C=ue(),S=V("span"),S.textContent="to open in a new pane",N=ue(),P=V("div"),q=V("span"),q.textContent=`${e[11]}`,$=ue(),ge=V("span"),ge.textContent="to open in a new split",W=ue(),he=V("div"),he.innerHTML=`<span class="prompt-instruction-command">alt o</span>
<span>to open in the background</span>`,ke=ue(),Ie=V("div"),Ke=V("span"),R=dt(e[10]),F=ue(),H=V("span"),H.textContent="to create",te=ue(),de=V("div"),we=V("span"),tt=dt(e[9]),Kr=ue(),_t=V("span"),_t.textContent="to create in a new pane",X=ue(),$e=V("div"),$e.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,Wr=ue(),cr=V("div"),cr.innerHTML=`<span class="prompt-instruction-command">ctrl g</span>
<span>to toggle excerpts</span>`,Zn=ue(),Pi=V("div"),Pi.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',Z(u,"class","prompt-instruction"),Z(c,"class","prompt-instruction"),Z(f,"class","prompt-instruction-command"),Z(h,"class","prompt-instruction"),Z(g,"class","prompt-instruction"),Z(T,"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(we,"class","prompt-instruction-command"),Z(de,"class","prompt-instruction"),Z($e,"class","prompt-instruction"),Z(cr,"class","prompt-instruction"),Z(Pi,"class","prompt-instruction"),Z(a,"class","prompt-instructions")},m(me,Ye){Dt(t,me,Ye),ae(me,r,Ye),Pt&&Pt.m(me,Ye),ae(me,n,Ye),Dt(i,me,Ye),ae(me,s,Ye),ae(me,a,Ye),j(a,u),j(a,o),j(a,c),j(a,d),j(a,h),j(h,f),j(f,p),j(h,A),j(h,b),j(a,D),j(a,g),j(a,v),j(a,I),j(I,T),j(T,E),j(I,C),j(I,S),j(a,N),j(a,P),j(P,q),j(P,$),j(P,ge),j(a,W),j(a,he),j(a,ke),j(a,Ie),j(Ie,Ke),j(Ke,R),j(Ie,F),j(Ie,H),j(a,te),j(a,de),j(de,we),j(we,tt),j(de,Kr),j(de,_t),j(a,X),j(a,$e),j(a,Wr),j(a,cr),j(a,Zn),j(a,Pi),pn=!0},p(me,Ye){let Cu={};Ye[0]&1&&(Cu.plugin=me[0]),Ye[0]&4&&(Cu.initialValue=me[2]),Ye[0]&1|Ye[1]&4096&&(Cu.$$scope={dirty:Ye,ctx:me}),t.$set(Cu),me[4]?Pt?Pt.p(me,Ye):(Pt=V_(me),Pt.c(),Pt.m(n.parentNode,n)):Pt&&(Pt.d(1),Pt=null);let Hh={};Ye[0]&47|Ye[1]&4096&&(Hh.$$scope={dirty:Ye,ctx:me}),i.$set(Hh),(!pn||Ye[0]&256)&&xr(p,me[8]),(!pn||Ye[0]&128)&&xr(E,me[7]),(!pn||Ye[0]&1024)&&xr(R,me[10]),(!pn||Ye[0]&512)&&xr(tt,me[9])},i(me){pn||(Ee(t.$$.fragment,me),Ee(i.$$.fragment,me),pn=!0)},o(me){Oe(t.$$.fragment,me),Oe(i.$$.fragment,me),pn=!1},d(me){e[19](null),Tt(t,me),me&&se(r),Pt&&Pt.d(me),me&&se(n),Tt(i,me),me&&se(s),me&&se(a)}}}function ax(e,t,r){let n,i;Su(e,gn,X=>r(18,i=X));let{modal:s}=t,{previousQuery:a}=t,{plugin:u}=t,o=0,c=0,d,h=[],f,p="",A=!0,b,D,g,v,I,T=_n()+" alt \u21B5";ta(async()=>{ce.enable("vault"),ce.on("vault",_e.Enter,$),ce.on("vault",_e.OpenInBackground,ge),ce.on("vault",_e.CreateNote,R),ce.on("vault",_e.OpenInNewPane,W),ce.on("vault",_e.InsertLink,F),ce.on("vault",_e.Tab,H),ce.on("vault",_e.ArrowUp,()=>te(-1)),ce.on("vault",_e.ArrowDown,()=>te(1)),ce.on("vault",_e.PrevSearchHistory,E),ce.on("vault",_e.NextSearchHistory,C),ce.on("vault",_e.OpenInNewLeaf,he),await u.notesIndexer.refreshIndex(),await P()}),ra(()=>{ce.disable("vault")});async function E(){let X=(await u.cacheManager.getSearchHistory()).filter($e=>$e);++c>=X.length&&(c=0),r(2,d=X[c]),b?.setInputValue(d??"")}async function C(){let X=(await u.cacheManager.getSearchHistory()).filter($e=>$e);--c<0&&(c=X.length?X.length-1:0),r(2,d=X[c]),b?.setInputValue(d??"")}let S=null;async function N(){r(5,A=!0),S&&(S.cancel(),S=null),f=new ui(d,{ignoreDiacritics:u.settings.ignoreDiacritics,ignoreArabicDiacritics:u.settings.ignoreArabicDiacritics}),S=(0,G_.cancelable)(new Promise(X=>{X(u.searchEngine.getSuggestions(f))})),r(3,h=await S),r(1,o=0),await de(),r(5,A=!1)}let P=ba(N,0);function q(X){!n||(X?.ctrlKey?W():$(),s.close())}function $(){!n||(Ie(n),s.close())}function ge(){!n||Ie(n,!0)}function W(){!n||(Ie(n,!0),s.close())}function he(){!n||(Ie(n,!0,!0),s.close())}function ke(){d&&u.cacheManager.addToSearchHistory(d)}function Ie(X,$e=!1,Wr=!1){ke();let cr=X.matches?.[0]?.offset??0;ku(u.app,X,cr,$e,Wr)}async function Ke(X){await R()}async function R(X){if(d){try{await f0(u.app,d,X?.newLeaf)}catch($e){new gr.Notice($e.message);return}s.close()}}function F(){if(!n)return;let X=u.app.vault.getMarkdownFiles().find(Pi=>Pi.path===n.path),$e=u.app.workspace.getActiveFile(),Wr=u.app.workspace.getActiveViewOfType(gr.MarkdownView);if(!Wr?.editor){new gr.Notice("Omnisearch - Error - No active editor",3e3);return}let cr;X&&$e?cr=u.app.fileManager.generateMarkdownLink(X,$e.path):cr=`[[${n.basename}.${En(n.path)}]]`;let Zn=Wr.editor.getCursor();Wr.editor.replaceRange(cr,Zn,Zn),Zn.ch+=cr.length,Wr.editor.setCursor(Zn),s.close()}function H(){if(!(n&&(bn(n?.path)||!n?.matches
<span>to switch to Vault Search</span>`,h=ue(),f=V("div"),p=V("span"),p.textContent="esc",A=ue(),S.c(),b=ue(),D=V("div"),g=V("span"),g.textContent=`${_n()} \u21B5`,v=ue(),I=V("span"),I.textContent="to open in a new pane",Z(a,"class","prompt-instruction"),Z(o,"class","prompt-instruction"),Z(d,"class","prompt-instruction"),Z(p,"class","prompt-instruction-command"),Z(f,"class","prompt-instruction"),Z(g,"class","prompt-instruction-command"),Z(D,"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,d),j(s,h),j(s,f),j(f,p),j(f,A),S.m(f,null),j(s,b),j(s,D),j(D,g),j(D,v),j(D,I),T=!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=E(N,P))&&(S.d(1),S=C(N),S&&(S.c(),S.m(f,null)))},i(N){T||(Ee(t.$$.fragment,N),Ee(n.$$.fragment,N),T=!0)},o(N){Oe(t.$$.fragment,N),Oe(n.$$.fragment,N),T=!1},d(N){Tt(t,N),N&&se(r),Tt(n,N),N&&se(i),N&&se(s),S.d()}}}function Tx(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 bx(e,t,r){let{plugin:n}=t,{modal:i}=t,{parent:s=null}=t,{singleFilePath:a=""}=t,{previousQuery:u}=t,o,c=[],d=0,h,f;ta(()=>{ce.enable("infile"),ce.on("infile",_e.Enter,g),ce.on("infile",_e.OpenInNewPane,D),ce.on("infile",_e.ArrowUp,()=>A(-1)),ce.on("infile",_e.ArrowDown,()=>A(1)),ce.on("infile",_e.Tab,v)}),ra(()=>{ce.disable("infile")});function p(S){let N=[],P=-1,q=0;for(;++q<100;){let $=Tx(S,P,na);if(!$.length)break;P=$.last().offset,N.push($)}return N}function A(S){r(6,d=Bu(d+S,c.length)),b()}async function b(){await mn(),document.querySelector(`[data-result-id="${d}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function D(){return g(!0)}async function g(S=!1){if(h){i.close(),s&&s.close();let N=n.textProcessor.stringsToRegex(h.foundWords);N.exec(h.content),await ku(n.app,h,N.lastIndex,S);let P=n.app.workspace.getActiveViewOfType(ya.MarkdownView);if(!P)return;let q=c[d]??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 v(){new Rn(n,o??u).open(),i.close()}let I=S=>r(3,o=S.detail),T=(S,N)=>r(6,d=S),E=S=>g(S.ctrlKey),C=S=>{S.button==1&&g(!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,f=new ui(o,{ignoreDiacritics:n.settings.ignoreDiacritics})),r(4,h=(await n.searchEngine.getSuggestions(f,{singleFilePath:a}))[0]??null)),r(6,d=0),await b()})()}if(e.$$.dirty&2064){e:if(h){let S=p(h.matches),N=f.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,d,g,v,i,a,f,I,T,E,C]}var ya,nT,iT,sT=x(()=>{rr();cl();Or();ir();wu();ya=Xe(require("obsidian"));ll();Aa();eT();To();aa();nT=class extends pt{constructor(t){super();bt(this,t,bx,_x,ot,{plugin:0,modal:9,parent:1,singleFilePath:10,previousQuery:2})}},iT=nT});var Eo,Xl,Rn,us,Aa=x(()=>{Eo=Xe(require("obsidian"));X_();sT();Or();Xl=class extends Eo.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(_e.ArrowDown)}),this.scope.register([],"ArrowUp",o=>{o.preventDefault(),ce.emit(_e.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,d=>{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,d=>{r.vimLikeNavigationShortcut&&ce.emit("arrow-"+o.dir)});let n,i,s,a,u=["Mod","Alt"];r.openInNewPane?(n=["Mod"],i=[]
2024-06-13 21:01:37 +03:00
`).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(`
2024-08-09 08:39:12 +03:00
`)}var Es=class{options;rules;lexer;constructor(t){this.options=t||Re.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:Xo(n,`
`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let n=r[0],i=u2(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=Xo(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=Xo(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 d=!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+/,g=>" ".repeat(3*g.length)),f=t.split(`
`,1)[0],p=0;this.options.pedantic?(p=2,o=h.trimStart()):(p=r[2].search(/[^ ]/),p=p>4?1:p,o=h.slice(p),p+=r[1].length);let A=!1;if(!h&&/^ *$/.test(f)&&(u+=f+`
`,t=t.substring(f.length+1),d=!0),!d){let g=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),v=new RegExp(`^ {0,${Math.min(3,p-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),I=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,p-1)}}#`);for(;t;){let E=t.split(`
`,1)[0];if(f=E,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),I.test(f)||T.test(f)||g.test(f)||v.test(t))break;if(f.search(/[^ ]/)>=p||!f.trim())o+=`
`+f.slice(p);else{if(A||h.search(/[^ ]/)>=4||I.test(h)||T.test(h)||v.test(h))break;o+=`
`+f}!A&&!f.trim()&&(A=!0),u+=E+`
`,t=t.substring(E.length+1),h=f.slice(p)}}s.loose||(c?s.loose=!0:/\n *\n *$/.test(u)&&(c=!0));let b=null,D;this.options.gfm&&(b=/^\[[ xX]\] /.exec(o),b&&(D=b[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:u,task:!!b,checked:D,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 d=0;d<s.items.length;d++)if(this.lexer.state.top=!1,s.items[d].tokens=this.lexer.blockTokens(s.items[d].text,[]),!s.loose){let h=s.items[d].tokens.filter(p=>p.type==="space"),f=h.length>0&&h.some(p=>/\n.*\n/.test(p.raw));s.loose=f}if(s.loose)for(let d=0;d<s.items.length;d++)s.items[d].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=bb(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(bb(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=Xo(n.slice(0,-1),"\\");if((n.length-a.length)%2==0)return}else{let a=a2(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)),Eb(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 Eb(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,d=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)){d+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+d);let f=[...i[0]][0].length,p=t.slice(0,a+i.index+f+o);if(Math.min(a,o)%2){let b=p.slice(1,-1);return{type:"em",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}let A=p.slice(2,-2);return{type:"strong",raw:p,text:A,tokens:this.lexer.inlineTokens(A)}}}}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}}}},o2=/^(?: *(?:\n|$))+/,c2=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,l2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,za=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,f2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ab=/(?:[*+-]|\d{1,9}[.)])/,yb=Se(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\
]`).replace("lheading",yb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Cb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,b2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Db=/^( {2,}|\\)\n(?!\s*$)/,E2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Va="\\p{P}\\p{S}",A2=Se(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Va).getRegex(),y2=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,I2=Se(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Va).getRegex(),v2=Se("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Va).getRegex(),C2=Se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Va).getRegex(),D2=Se(/\\([punct])/,"gu").replace(/punct/g,Va).getRegex(),S2=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(),x2=Se(ad).replace("(?:-->|$)","-->").getRegex(),O2=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",x2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Jo=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,N2=Se(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Jo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Sb=Se(/^!?\[(label)\]\[(ref)\]/).replace("label",Jo).replace("ref",sd).getRegex(),xb=Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",sd).getRegex(),w2=Se("reflink|nolink(?!\\()","g").replace("reflink",Sb).replace("nolink",xb).getRegex(),od={_backpedal:qa,anyPunctuation:D2,autolink:S2,blockSkip:y2,br:Db,code:b2,del:qa,emStrongLDelim:I2,emStrongRDelimAst:v2,emStrongRDelimUnd:C2,escape:Cb,link:N2,nolink:xb,punctuation:A2,reflink:Sb,reflinkSearch:w2,tag:O2,text:E2,url:qa},R2=Fe(J({},od),{link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",Jo).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Jo).getRegex()}),cd=Fe(J({},od),{escape:Se(Cb).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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),P2=Fe(J({},cd),{br:Se(Db).replace("{2,}","*").getRegex(),text:Se(cd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),ec={normal:ud,gfm:_2,pedantic:T2},Ka={normal:od,gfm:cd,breaks:P2,pedantic:R2},ar=class{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Re.defaults,this.options.tokenizer=this.options.tokenizer||new Es,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:ec.normal,inline:Ka.normal};this.options.pedantic?(r.block=ec.pedantic,r.inline=Ka.pedantic):this.options.gfm&&(r.block
2024-06-13 21:01:37 +03:00
`),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+=`
2024-08-09 08:39:12 +03:00
`+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(d=>{c=d.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+=`
2024-06-13 21:01:37 +03:00
`+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+=`
2024-08-09 08:39:12 +03:00
`+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 d=Object.keys(this.tokens.links);if(d.length>0)for(;(u=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.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(d=>(n=d.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 d=1/0,h=t.slice(1),f;this.options.extensions.startInline.forEach(p=>{f=p.call({lexer:this},h),typeof f=="number"&&f>=0&&(d=Math.min(d,f))}),d<1/0&&d>=0&&(s=t.substring(0,d+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 d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}},As=class{options;constructor(t){this.options=t||Re.defaults}code(t,r,n){let i=(r||"").match(/^\S*/)?.[0];return t=t.replace(/\n$/,"")+`
2024-06-13 21:01:37 +03:00
`,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}>
2024-08-09 08:39:12 +03:00
`}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=Tb(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=Tb(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}},Wa=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""}},ur=class{options;renderer;textRenderer;constructor(t){this.options=t||Re.defaults,this.options.renderer=this.options.renderer||new As,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Wa}static parse(t,r){return new ur(r).parse(t)}static parseInline(t,r){return new ur(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,i2(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 d=0;d<a.header.length;d++)o+=this.renderer.tablecell(this.parseInline(a.header[d].tokens),{header:!0,align:a.align[d]});u+=this.renderer.tablerow(o);let c="";for(let d=0;d<a.rows.length;d++){let h=a.rows[d];o="";for(let f=0;f<h.length;f++)o+=this.renderer.tablecell(this.parseInline(h[f].tokens),{header:!1,align:a.align[f]});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,d="";for(let h=0;h<a.items.length;h++){let f=a.items[h],p=f.checked,A=f.task,b="";if(f.task){let D=this.renderer.checkbox(!!p);c?f.tokens.length>0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=D+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=D+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:D+" "}):b+=D+" "}b+=this.parse(f.tokens,c),d+=this.renderer.listitem(b,A,!!p)}n+=this.renderer.list(d,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}},mi=class{options;constructor(t){this.options=t||Re.defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}};Vh(mi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var ld=class{defaults=$o();options=this.setOptions;parse=this.#e(ar.lex,ur.parse);parseInline=this.#e(ar.lexInline,ur.parseInline);Parser=ur;Renderer=As;TextRenderer=Wa;Lexer=ar;Tokenizer=Es;Hooks=mi;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 As(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]=(...d)=>{let h=o.apply(s,d);return h===!1&&(h=c.apply(s,d)),h||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Es(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]=(...d)=>{let h=o.apply(s,d);return h===!1&&(h=c.apply(s,d)),h}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new mi;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];mi.passThroughHooks.has(a)?s[u]=d=>{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}}},gi=new ld;function Ce(e,t){return gi.parse(e,t)}Ce.options=Ce.setOptions=function(e){return gi.setOptions(e),Ce.defaults=gi.defaults,pb(Ce.defaults),Ce};Ce.getDefaults=$o;Ce.defaults=Re.defaults;Ce.use=function(...e){return gi.use(...e),Ce.defaults=gi.defaults,pb(Ce.defaults),Ce};Ce.walkTokens=function(e,t){return gi.walkTokens(e,t)};Ce.parseInline=gi.parseInline;Ce.Parser=ur;Ce.parser=ur.parse;Ce.Renderer=As;Ce.TextRenderer=Wa;Ce.Lexer=ar;Ce.lexer=ar.lex;Ce.Tokenizer=Es;Ce.Hooks=mi;Ce.parse=Ce;var L2=Ce.options,M2=Ce.setOptions,k2=Ce.use,F2=Ce.walkTokens,B2=Ce.parseInline,j2=Ce,H2=ur.parse,U2=ar.lex;Re.Hooks=mi;Re.Lexer=ar;Re.Marked=ld;Re.Parser=ur;Re.Renderer=As;Re.TextRenderer=Wa;Re.Tokenizer=Es;Re.getDefaults=$o;Re.lexer=U2;Re.marked=Ce;Re.options=L2;Re.parse=j2;Re.parseInline=B2;Re.parser=H2;Re.setOptions=M2;Re.use=k2;Re.walkTokens=F2});var wb=U(Nb=>{"use strict";Object.defineProperty(Nb,"__esModule",{value:!0})});var fd=U(_i=>{"use strict";var tc=_i&&_i.__assign||function(){return tc=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},tc.apply(this,arguments)};Object.defineProperty(_i,"__esModule",{value:!0});_i.flatten=void 0;var G2={xml:!1,decodeEntities:!0};_i.default=G2;var Rb={_useHtmlParser2:!0,xmlMode:!0};function q2(e){return(e==null?void 0:e.xml)?typeof e.xml=="boolean"?Rb:tc(tc({},Rb),e.xml):e??void 0}_i.flatten=q2});var ys=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 z2(e){return e.type===$t.Tag||e.type===$t.Script||e.type===$t.Style}He.isTag=z2;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 md=U(le=>{"use strict";var jn=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)}}(),Ya=le&&le.__assign||function(){return Ya=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},Ya.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=ys(),dd=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),hd(this,t)},e}();le.Node=dd;var rc=function(e){jn(t,e);function t(r){var n=e.call(this)||this;ret
`:cc(e.children):(0,Lr.isCDATA)(e)?cc(e.children):(0,Lr.isText)(e)?e.data:""}Ft.getText=cc;function Od(e){return Array.isArray(e)?e.map(Od).join(""):(0,Lr.hasChildren)(e)&&!(0,Lr.isComment)(e)?Od(e.children):(0,Lr.isText)(e)?e.data:""}Ft.textContent=Od;function Nd(e){return Array.isArray(e)?e.map(Nd).join(""):(0,Lr.hasChildren)(e)&&(e.type===wN.ElementType.Tag||(0,Lr.isCDATA)(e))?Nd(e.children):(0,Lr.isText)(e)?e.data:""}Ft.innerText=Nd});var _E=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 mE(e){return(0,Rd.hasChildren)(e)?e.children:[]}ft.getChildren=mE;function gE(e){return e.parent||null}ft.getParent=gE;function PN(e){var t,r,n=gE(e);if(n!=null)return mE(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=PN;function LN(e,t){var r;return(r=e.attribs)===null||r===void 0?void 0:r[t]}ft.getAttributeValue=LN;function MN(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}ft.hasAttrib=MN;function kN(e){return e.name}ft.getName=kN;function FN(e){for(var t,r=e.next;r!==null&&!(0,Rd.isTag)(r);)t=r,r=t.next;return r}ft.nextElementSibling=FN;function BN(e){for(var t,r=e.prev;r!==null&&!(0,Rd.isTag)(r);)t=r,r=t.prev;return r}ft.prevElementSibling=BN});var TE=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 Za(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=Za;function jN(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=jN;function HN(e,t){if(Za(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=HN;function UN(e,t){Za(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=UN;function GN(e,t){if(Za(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=GN;function qN(e,t){Za(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=qN});var Pd=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 lc=yt();function zN(e,t,r,n){return r===void 0&&(r=!0),n===void 0&&(n=1/0),bE(e,Array.isArray(t)?t:[t],r,n)}jt.filter=zN;function bE(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,lc.hasChildren)(u)&&u.children.length>0&&(a.unshift(0),s.unshift(u.children))}}jt.find=bE;function VN(e,t){return t.find(e)}jt.findOneChild=VN;function EE(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,lc.isTag)(s))e(s)?n=s:r&&s.children.length>0&&(n=EE(e,s.children,!0));else continue}return n}jt.findOne=EE;function AE(e,t){return t.some(function(r){return(0,lc.isTag)(r)&&(e(r)||AE(e,r.children))})}jt.existsOne=AE;function KN(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,lc.isTag)(s)||(e(s)&&r.push(s),s.children.length>0&&(i.unshift(0),n.unshift(s.children)))}}jt.findAll=KN});var Ld=U(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getElementsByTagType=or.getElementsByTagName=or.getElementById=or.getElements=or.testElement=void 0;var bi=yt(),fc=Pd(),dc={tag
2024-06-13 21:01:37 +03:00
:is(button, input, select, textarea, optgroup, option)[disabled],
optgroup[disabled] > option,
fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
2024-08-09 08:39:12 +03:00
)`,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 Cc=U(Nt=>{"use strict";var m1=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))},lw=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 Ir=lw(zn()),fw=Ud();Nt.PLACEHOLDER_ELEMENT={};function g1(e,t){return e===Ir.default.falseFunc?Ir.default.falseFunc:function(r){return t.isTag(r)&&e(r)}}Nt.ensureIsTag=g1;function _1(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=_1;function zd(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 Vd=function(e,t,r,n,i){var s=i(t,zd(r),n);return s===Ir.default.trueFunc?e:s===Ir.default.falseFunc?Ir.default.falseFunc:function(a){return s(a)&&e(a)}};Nt.subselects={is:Vd,matches:Vd,where:Vd,not:function(e,t,r,n,i){var s=i(t,zd(r),n);return s===Ir.default.falseFunc?e:s===Ir.default.trueFunc?Ir.default.falseFunc:function(a){return!s(a)&&e(a)}},has:function(e,t,r,n,i){var s=r.adapter,a=zd(r);a.relativeSelector=!0;var u=t.some(function(f){return f.some(fw.isTraversal)})?[Nt.PLACEHOLDER_ELEMENT]:void 0,o=i(t,a,u);if(o===Ir.default.falseFunc)return Ir.default.falseFunc;var c=g1(o,s);if(u&&o!==Ir.default.trueFunc){var d=o.shouldTestNextSiblings,h=d===void 0?!1:d;return function(f){if(!e(f))return!1;u[0]=f;var p=s.getChildren(f),A=h?m1(m1([],p,!0),_1(f,s),!0):p;return s.existsOne(c,A)}}return function(f){return e(f)&&s.existsOne(c,s.getChildren(f))}}}});var Yd=U(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.compilePseudoSelector=Fr.aliases=Fr.pseudos=Fr.filters=void 0;var dw=Ps(),Kd=d1();Object.defineProperty(Fr,"filters",{enumerable:!0,get:function(){return Kd.filters}});var nu=h1();Object.defineProperty(Fr,"pseudos",{enumerable:!0,get:function(){return nu.pseudos}});var T1=p1();Object.defineProperty(Fr,"aliases",{enumerable:!0,get:function(){return T1.aliases}});var Wd=Cc();function hw(e,t,r,n,i){var s,a=t.name,u=t.data;if(Array.isArray(u)){if(!(a in Wd.subselects))throw new Error("Unknown pseudo-class :".concat(a,"(").concat(u,")"));return Wd.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:T1.aliases[a];if(typeof c=="string"){if(u!=null)throw new Error("Pseudo ".concat(a," doesn't have any arguments"));var d=(0,dw.parse)(c);return Wd.subselects.is(e,d,r,n,i)}if(typeof o=="function")return(0,nu.verifyPseudoArgs)(o,a,u,1),function(f){return o(f,u)&&e(f)};if(a in Kd.filters)return Kd.filters[a](e,u,r,n);if(a in nu.pseudos){var h=nu.pseudos[a];return(0,nu.verifyPseudoArgs)(h,a,u,2),function(f){return h(f,r,u)&&e(f)}}throw new Error("Unknown pseudo-class :".concat(a))}Fr.compilePseudoSelector=hw});var b1=U(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.compileGeneralSelector=void 0;var pw=s1(),mw=Yd(),vr=Ps();function Qd(e,t){var r=t.getParent(e);return r&&t.isTag(r)?r:null}function gw(e,t,r,n,i){var s=r.adapter,a=r.equals;switch(t.type){case
`)}}):{name:s,value:a.replace(Q1,`\r
`)}}).toArray()}Us.serializeArray=VR});var X1=U(Ur=>{"use strict";var KR=Ur&&Ur.__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]}),WR=Ur&&Ur.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ou=Ur&&Ur.__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)&&KR(t,e,r);return WR(t,e),t};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.Cheerio=void 0;var YR=ou(UE()),QR=ou(B1()),$R=ou(z1()),XR=ou(W1()),ZR=ou($1()),cu=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}();Ur.Cheerio=cu;cu.prototype.cheerio="[cheerio object]";cu.prototype.splice=Array.prototype.splice;cu.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator];Object.assign(cu.prototype,YR,QR,$R,XR,ZR)});var J1=U(Ut=>{"use strict";var JR=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)}}(),Gs=Ut&&Ut.__assign||function(){return Gs=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},Gs.apply(this,arguments)},eP=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]}),tP=Ut&&Ut.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Z1=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)&&eP(t,e,r);return tP(t,e),t};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.getLoad=void 0;var mh=Z1(fd()),rP=Z1(yi()),nP=X1(),lu=vi();function iP(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=Gs(Gs({},mh.default),(0,mh.flatten)(i)),u=e(n,a,s,null),o=function(d){JR(h,d);function h(){return d!==null&&d.apply(this,arguments)||this}return h.prototype._make=function(f,p){var A=c(f,p);return A.prevObject=this,A},h.prototype._parse=function(f,p,A,b){return e(f,p,A,b)},h.prototype._render=function(f){return t(f,this.options)},h}(nP.Cheerio);function c(d,h,f,p){if(f===void 0&&(f=u),d&&(0,lu.isCheerio)(d))return d;var A=Gs(Gs({},a),(0,mh.flatten)(p)),b=typeof f=="string"?[e(f,A,!1,null)]:"length"in f?f:[f],D=(0,lu.isCheerio)(b)?b:new o(b,null,A);if(D._root=D,!d)return new o(void 0,D,A);var g=typeof d=="string"&&(0,lu.isHtml)(d)?e(d,A,!1,null).children:sP(d)?[d]:Array.isArray(d)?d:void 0,v=new o(g,D,A);if(g)return v;if(typeof d!="string")throw new Error("Unexpected type of selector");var I=d,T=h?typeof h=="string"?(0,lu.isHtml)(h)?new o([e(h,A,!1,null)],D,A):(I="".concat(h," ").concat(I),D):(0,lu.isCheerio)(h)?h:new o(Array.isArray(h)?h:[h],D,A):D;return T?T.find(I):v}return Object.assign(c,rP,{load:r,_root:u,_options:a,fn:o.prototype,prototype:o.prototype}),c}}Ut.getLoad=iP;function sP(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}});var wc=U(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.
2024-06-13 21:01:37 +03:00
`).length),r.split(`
2024-08-09 08:39:12 +03:00
`).slice(t).filter(TT).map(n=>`
`+n).join("")):""}var wx=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],bT=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],uf=wx.concat(bT),Rx={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 fs(e,t){this._e=oi(),this.name=e,this.message=t}cs(fs).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+af(this._e,2))}},toString:function(){return this.name+": "+this.message}});function ET(e,t){return e+". Errors: "+Object.keys(t).map(r=>t[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
`)}function Io(e,t,r,n){this._e=oi(),this.failures=t,this.failedKeys=n,this.successCount=r,this.message=ET(e,t)}cs(Io).from(fs);function Da(e,t){this._e=oi(),this.name="BulkError",this.failures=Object.keys(t).map(r=>t[r]),this.failuresByPos=t,this.message=ET(e,t)}cs(Da).from(fs);var of=uf.reduce((e,t)=>(e[t]=t+"Error",e),{}),Px=fs,ie=uf.reduce((e,t)=>{var r=t+"Error";function n(i,s){this._e=oi(),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=Rx[t]||r,this.inner=null)}return cs(n).from(Px),e[t]=n,e},{});ie.Syntax=SyntaxError;ie.Type=TypeError;ie.Range=RangeError;var AT=bT.reduce((e,t)=>(e[t+"Error"]=ie[t],e),{});function Lx(e,t){if(!e||e instanceof fs||e instanceof TypeError||e instanceof SyntaxError||!e.name||!AT[e.name])return e;var r=new AT[e.name](t||e.message,e);return"stack"in e&&Zr(r,"stack",{get:function(){return this.inner.stack}}),r}var vo=uf.reduce((e,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=ie[t]),e),{});vo.ModifyError=Io;vo.DexieError=fs;vo.BulkError=Da;function Ne(){}function Sa(e){return e}function Mx(e,t){return e==null||e===Sa?t:function(r){return t(e(r))}}function ci(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function kx(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?ci(n,this.onsuccess):n),i&&(this.onerror=this.onerror?ci(i,this.onerror):i),s!==void 0?s:r}}function Fx(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?ci(r,this.onsuccess):r),n&&(this.onerror=this.onerror?ci(n,this.onerror):n)}}function Bx(e,t){return e===Ne?t:function(r){var n=e.apply(this,arguments);xt(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?ci(i,this.onsuccess):i),s&&(this.onerror=this.onerror?ci(s,this.onerror):s),n===void 0?a===void 0?void 0:a:xt(n,a)}}function jx(e,t){return e===Ne?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function cf(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 xa={},Hx=100,Ux=20,yT=100,[lf,Co,ff]=typeof Promise=="undefined"?[]:(()=>{let e=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[e,Ia(e),e];let t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Ia(t),e]})(),IT=Co&&Co.then,Do=lf&&lf.constructor,df=!!ff,hf=!1,Gx=ff?()=>{ff.then(No)}:je.setImmediate?setImmediate.bind(null,No):je.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{No(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(No,0)},Oa=function(e,t){Na.push([e,t]),So&&(Gx(),So=!1)},pf=!0,So=!0,li=[],xo=[],mf=null,gf=Sa,ds={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:PT,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{PT(e[0],e[1])}catch{}})}},ne=ds,Na=[],fi=0,Oo=[];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=ne;if(Nr&&(this._stackHolder=oi(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==xa)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Tf(this,this._value);return}this._state=null,this._value=null,++t.ref,CT(this,e)}var _f={get:function(){var e=ne,t=Po;function r(n,i){var s=!e.global&&(e!==ne||t!==Po);let a=s&&!tn();var u=new Y((o,c)=>{bf(this,new vT(Mo(n,e,s,a),Mo(i,e,s,a),o,c,e))});return Nr&&xT(u,this),u}return r.prototype=xa,r},set:function(e){Zr(this,"then",e&&e.prototype===xa?_f:{get:function(){return e},set:_f.set})}};os(Y.prototype,{then:_f,_then:function(e,t){bf(this,new vT(null,null,e,t,ne))},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):wo(n)):this.then(null,n=>n&&n.name===t?r(n):wo(n))},finally:function(e){return this.then(t
From previous: `);return this._state!==null&&(this._stack=t),t}finally{hf=!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&&Zr(Y.prototype,Symbol.toStringTag,"Dexie.Promise");ds.env=OT();function vT(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}os(Y,{all:function(){var e=en.apply(null,arguments).map(Lo);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(xa,!0,e);return xT(t,mf),t},reject:wo,race:function(){var e=en.apply(null,arguments).map(Lo);return new Y((t,r)=>{e.map(n=>Y.resolve(n).then(t,r))})},PSD:{get:()=>ne,set:e=>ne=e},totalEchoes:{get:()=>Po},newPSD:Ln,usePSD:ps,scheduler:{get:()=>Oa,set:e=>{Oa=e}},rejectionMapper:{get:()=>gf,set:e=>{gf=e}},follow:(e,t)=>new Y((r,n)=>Ln((i,s)=>{var a=ne;a.unhandleds=[],a.onunhandled=s,a.finalize=ci(function(){zx(()=>{this.unhandleds.length===0?i():s(this.unhandleds[0])})},a.finalize),e()},t,r,n))});Do&&(Do.allSettled&&Zr(Y,"allSettled",function(){let e=en.apply(null,arguments).map(Lo);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)))})}),Do.any&&typeof AggregateError!="undefined"&&Zr(Y,"any",function(){let e=en.apply(null,arguments).map(Lo);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 CT(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&&wa();r&&typeof r.then=="function"?CT(e,(i,s)=>{r instanceof Y?r._then(i,s):r.then(i,s)}):(e._state=!0,e._value=r,DT(e)),n&&Ra()}},Tf.bind(null,e))}catch(r){Tf(e,r)}}function Tf(e,t){if(xo.push(t),e._state===null){var r=e._lib&&wa();t=gf(t),e._state=!1,e._value=t,Nr&&t!==null&&typeof t=="object"&&!t._promise&&vx(()=>{var n=ef(t,"stack");t._promise=e,Zr(t,"stack",{get:()=>hf?n&&(n.get?n.get.apply(t):n.value):e.stack})}),Vx(e),DT(e),r&&Ra()}}function DT(e){var t=e._listeners;e._listeners=[];for(var r=0,n=t.length;r<n;++r)bf(e,t[r]);var i=e._PSD;--i.ref||i.finalize(),fi===0&&(++fi,Oa(()=>{--fi==0&&Ef()},[]))}function bf(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,++fi,Oa(qx,[r,e,t])}function qx(e,t,r){try{mf=t;var n,i=t._value;t._state?n=e(i):(xo.length&&(xo=[]),n=e(i),xo.indexOf(i)===-1&&Kx(t)),r.resolve(n)}catch(s){r.reject(s)}finally{mf=null,--fi==0&&Ef(),--r.psd.ref||r.psd.finalize()}}function ST(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=af(i,0)):(s=i,a=""),t.push(s+(a?": "+a:"")+n)}return Nr&&(n=af(e._stackHolder,2),n&&t.indexOf(n)===-1&&t.push(n),e._prev&&ST(e._prev,t,r)),t}function xT(e,t){var r=t?t._numPrev+1:0;r<Hx&&(e._prev=t,e._numPrev=r)}function No(){wa()&&Ra()}function wa(){var e=pf;return pf=!1,So=!1,e}function Ra(){var e,t,r;do for(;Na.length>0;)for(e=Na,Na=[],r=e.length,t=0;t<r;++t){var n=e[t];n[0].apply(null,n[1])}while(Na.length>0);pf=!0,So=!0}function Ef(){var e=li;li=[],e.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var t=Oo.slice(0),r=t.length;r;)t[--r]()}function zx(e){function t(){e(),Oo.splice(Oo.indexOf(t),1)}Oo.push(t),++fi,Oa(()=>{--fi==0&&Ef()},[])}function Vx(e){li.some(t=>t._value===e._value)||li.push(e)}function Kx(e){for(var t=li.length;t;)if(li[--t]._value===e._value){li.splice(t,1);return}}function wo(e){return new Y(xa,!1,e)}function ze(e,t){var r=ne;return function(){var n=wa(),i=ne;try{return Mn(r,!0),
`)}else if(oa(t))try{let d=JSON.parse(await r.vault.cachedRead(n)),h=[],f=p=>{for(let A in p)typeof p[A]=="object"?f(p[A]):A==="content"&&h.push(p[A])};f(d),i=h.join(`\r
`)}catch(d){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(d)}else Tn(t)&&(this.plugin.settings.imagesIndexing&&s?.canFileBeExtracted(t)||this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(n))?(this.plugin.settings.imagesIndexing&&s?.canFileBeExtracted(t)&&(i=await s.extractText(n)),this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(n)&&(i=await a.analyzeImage(n)+(i??""))):bn(t)&&this.plugin.settings.PDFIndexing&&s?.canFileBeExtracted(t)?i=await s.extractText(n):T0(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 u=r.metadataCache.getFileCache(n);if(u){let d=d0(this.plugin.app,n,u);for(let h of d.filter(f=>!this.documents.has(f))){let f=this.plugin.notesIndexer.generateIndexableNonexistingDocument(h,n.path)}if(u.frontmatter?.["excalidraw-plugin"]){let h=u.sections?.filter(f=>f.type==="comment")??[];for(let{start:f,end:p}of h.map(A=>A.position))i=i.substring(0,f.offset-1)+i.substring(p.offset)}}let o=u?.frontmatter?.[this.plugin.settings.displayTitle]??"",c=_0(u);return{basename:n.basename,displayTitle:o,content:i,cleanedContent:m0(Qr(i)),path:n.path,mtime:n.stat.mtime,tags:c,unmarkedTags:c.map(d=>d.replace("#","")),aliases:g0(u).join(""),headings1:u?Fu(u,1).join(" "):"",headings2:u?Fu(u,2).join(" "):"",headings3:u?Fu(u,3).join(" "):""}}};ir();aa();ir();var Fh=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=!!this.plugin.getAIImageAnalyzer(),s=n&&r.PDFIndexing,a=n&&r.imagesIndexing,u=i&&r.aiImageIndexing;return this.isFilePlaintext(t)||ri(t)||oa(t)||s&&bn(t)||a&&Tn(t)||u&&Tn(t)}isFilenameIndexable(t){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(t)||ri(t)||oa(t)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(t,r){return t=dl(t),{path:t+(t.endsWith(".md")?"":".md"),basename:t,displayTitle:"",mtime:0,content:"",cleanedContent:"",tags:[],unmarkedTags:[],aliases:"",headings1:"",headings2:"",headings3:"",doesNotExist:!0,parent:r}}isFilePlaintext(t){return[...this.plugin.settings.indexedFileTypes,"md"].some(r=>t.endsWith(`.${r}`))}};Or();ir();var Ny=Xe(require("obsidian"));Ea();var Bh=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=On(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${On(c.match)}\\b${/[a-zA-Z]/.test(c.match)?"":`|${On(c.match)}`}`,"giu")))?`<span class="${n}">${u}</span>`:u,a=t.replace(i,s);if(a===t){let u=new RegExp(r.map(o=>On(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${On(n)}\\b|${On(n)}`).join("|")})`;return new RegExp(`${r}`,"gui")}getMatches(t,r,n){let i=this.stringsToRegex(r),s=t;this.plugin.settings.ignoreDiacritics&&(t=Qr(t,this.plugin.settings.ignoreArabicDiacritics));l
2024-06-13 21:01:37 +03:00
`);let o=t.lastIndexOf(`
2024-08-09 08:39:12 +03:00
`,i-s);o>0&&(t=t.slice(o))}return t=FM(t),n.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
`,"<br>")),t}catch(i){return new Ny.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(i),""}}};function FM(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var jh=class extends Ri.Plugin{constructor(t,r){super(t,r);this.apiHttpServer=null;this.settings=mo(this.app);this.database=new Ko(this);this.notesIndexer=new Fh(this);this.textProcessor=new Bh(this);this.searchEngine=new Mh(this);this.cacheManager=new kh(this)}async onload(){if(this.settings=await v_(this),this.addSettingTab(new Vl(this)),Ri.Platform.isMobile||Promise.resolve().then(()=>(My(),Ly)).then(n=>this.apiHttpServer=n.getServer(this)),Kl(this.app)){console.log("Omnisearch - Plugin disabled");return}await jM(this.app),await this.database.clearOldDatabases(),cT(this);let t=this.settings;t.ribbonIcon&&this.addRibbonButton(),ce.disable("vault"),ce.disable("infile"),ce.on("global",Pu.ToggleExcerpts,()=>{ai.set(!t.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Rn(this).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(n,i)=>{i.file&&new us(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 Rn(this).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}getChsSegmenter(){return this.app.plugins.plugins["cm-chs-patch"]}getTextExtractor(){return this.app.plugins?.plugins?.["text-extractor"]?.api}getAIImageAnalyzer(){return this.app.plugins?.plugins?.["ai-image-analyzer"]?.api}async populateIndex(){console.time("Omnisearch - Indexing total time"),gn.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 ${Nn()?"enabled":"disabled"}`);let r=this.searchEngine;Nn()&&(console.time("Omnisearch - Loading index from cache"),gn.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})));if(Nn()&&(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&&Nn()&&new Ri.Notice(`Omnisearch - ${n.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),gn.set(nr.IndexingFiles),r.removeFromPaths(n.toRemove.map(i=