Files
TI-Studium-Mitschriften/.obsidian/plugins/omnisearch/main.js
2025-07-02 14:34:34 +02:00

51 lines
218 KiB
JavaScript
Executable File

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Hm=Object.create;var jn=Object.defineProperty,Vm=Object.defineProperties,Wm=Object.getOwnPropertyDescriptor,$m=Object.getOwnPropertyDescriptors,Um=Object.getOwnPropertyNames,gl=Object.getOwnPropertySymbols,Gm=Object.getPrototypeOf,yl=Object.prototype.hasOwnProperty,Qm=Object.prototype.propertyIsEnumerable;var _l=(t,e,r)=>e in t?jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ye=(t,e)=>{for(var r in e||(e={}))yl.call(e,r)&&_l(t,r,e[r]);if(gl)for(var r of gl(e))Qm.call(e,r)&&_l(t,r,e[r]);return t},ze=(t,e)=>Vm(t,$m(e)),vl=t=>jn(t,"__esModule",{value:!0});var A=(t,e)=>()=>(t&&(e=t(t=0)),e);var gi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bl=(t,e)=>{vl(t);for(var r in e)jn(t,r,{get:e[r],enumerable:!0})},qm=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Um(e))!yl.call(t,n)&&n!=="default"&&jn(t,n,{get:()=>e[n],enumerable:!(r=Wm(e,n))||r.enumerable});return t},ve=t=>qm(vl(jn(t!=null?Hm(Gm(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);function de(){}function Ym(t,e){for(let r in e)t[r]=e[r];return t}function os(t){return t()}function xl(){return Object.create(null)}function it(t){t.forEach(os)}function Er(t){return typeof t=="function"}function Te(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ss(t,e){return yi||(yi=document.createElement("a")),yi.href=e,t===yi.href}function wl(t){return Object.keys(t).length===0}function jl(t,...e){if(t==null)return de;let r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function _i(t,e,r){t.$$.on_destroy.push(jl(e,r))}function Fr(t,e,r,n){if(t){let i=Al(t,e,r,n);return t[0](i)}}function Al(t,e,r,n){return t[1]&&n?Ym(r.ctx.slice(),t[1](n(e))):r.ctx}function Tr(t,e,r,n){if(t[2]&&n){let i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){let o=[],s=Math.max(e.dirty.length,i.length);for(let a=0;a<s;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function Dr(t,e,r,n,i,o){if(i){let s=Al(e,r,n,o);t.p(s,i)}}function Or(t){if(t.ctx.length>32){let e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function Sl(t){return t&&Er(t.destroy)?t.destroy:de}function Jm(){El=!0}function Xm(){El=!1}function I(t,e){t.appendChild(e)}function U(t,e,r){t.insertBefore(e,r||null)}function W(t){t.parentNode&&t.parentNode.removeChild(t)}function bi(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}function M(t){return document.createElement(t)}function Ie(t){return document.createTextNode(t)}function G(){return Ie(" ")}function An(){return Ie("")}function Pe(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function N(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Zm(t){return Array.from(t.childNodes)}function ct(t,e){e=""+e,t.data!==e&&(t.data=e)}function as(t,e){t.value=e??""}function qe(t,e,r,n){r==null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":"")}function ls(t,e,r){t.classList[r?"add":"remove"](e)}function eg(t,e,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}function Cn(t){Sn=t}function us(){if(!Sn)throw new Error("Function called outside component initialization");return Sn}function En(t){us().$$.on_mount.push(t)}function Fn(t){us().$$.on_destroy.push(t)}function cs(){let t=us();return(e,r,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let o=eg(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function Ye(t,e){let r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}function Dl(){fs||(fs=!0,Tl.then(Ol))}function kt(){return Dl(),Tl}function ds(t){Pr.push(t)}function Ol(){if(kr!==0)return;let t=Sn;do{try{for(;kr<Ir.length;){let e=Ir[kr];kr++,Cn(e),tg(e.$$)}}catch(e){throw Ir.length=0,kr=0,e}for(Cn(null),Ir.length=0,kr=0;vt.length;)vt.pop()();for(let e=0;e<Pr.length;e+=1){let r=Pr[e];ps.has(r)||(ps.add(r),r())}Pr.length=0}while(Ir.length);for(;Fl.length;)Fl.pop()();fs=!1,ps.clear(),Cn(t)}function tg(t){if(t.fragment!==null){t.update(),it(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(ds)}}function rg(t){let e=[],r=[];Pr.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),Pr=e}function or(){ir={r:0,c:[],p:ir}}function sr(){ir.r||it(ir.c),ir=ir.p}function te(t,e){t&&t.i&&(xi.delete(t),t.i(e))}function ne(t,e,r,n){if(t&&t.o){if(xi.has(t))return;xi.add(t),ir.c.push(()=>{xi.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function Ue(t){t&&t.c()}function He(t,e,r,n){let{fragment:i,after_update:o}=t.$$;i&&i.m(e,r),n||ds(()=>{let s=t.$$.on_mount.map(os).filter(Er);t.$$.on_destroy?t.$$.on_destroy.push(...s):it(s),t.$$.on_mount=[]}),o.forEach(ds)}function Le(t,e){let r=t.$$;r.fragment!==null&&(rg(r.after_update),it(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function ig(t,e){t.$$.dirty[0]===-1&&(Ir.push(t),Dl(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Ne(t,e,r,n,i,o,s,a=[-1]){let l=Sn;Cn(t);let u=t.$$={fragment:null,ctx:[],props:o,update:de,not_equal:i,bound:xl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:xl(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};s&&s(u.root);let c=!1;if(u.ctx=r?r(t,e.props||{},(d,f,...h)=>{let y=h.length?h[0]:f;return u.ctx&&i(u.ctx[d],u.ctx[d]=y)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](y),c&&ig(t,d)),f}):[],u.update(),c=!0,it(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){Jm();let d=Zm(e.target);u.fragment&&u.fragment.l(d),d.forEach(W)}else u.fragment&&u.fragment.c();e.intro&&te(t.$$.fragment),He(t,e.target,e.anchor,e.customElement),Xm(),Ol()}Cn(l)}var yi,Cl,vi,El,Sn,Ir,vt,Pr,Fl,Tl,fs,ps,kr,xi,ir,ng,Y1,og,ke,Ze=A(()=>{Cl=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,vi=class{constructor(e){this.options=e,this._listeners="WeakMap"in Cl?new WeakMap:void 0}observe(e,r){return this._listeners.set(e,r),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(r=>{var n;for(let i of r)vi.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};vi.entries="WeakMap"in Cl?new WeakMap:void 0;El=!1;Ir=[],vt=[],Pr=[],Fl=[],Tl=Promise.resolve(),fs=!1;ps=new Set,kr=0;xi=new Set;ng=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Y1=new Set([...ng]);typeof HTMLElement=="function"&&(og=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(os).filter(Er);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){it(this.$$.on_disconnect)}$destroy(){Le(this,1),this.$destroy=de}$on(t,e){if(!Er(e))return de;let r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(e),()=>{let n=r.indexOf(e);n!==-1&&r.splice(n,1)}}$set(t){this.$$set&&!wl(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});ke=class{$destroy(){Le(this,1),this.$destroy=de}$on(e,r){if(!Er(r))return de;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{let i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!wl(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}});var hs,Il=A(()=>{hs=class{constructor(){this.handlers=new Map;this.disabled=[]}on(e,r,n){if(e.includes("@")||r.includes("@"))throw new Error("Invalid context/event name - Cannot contain @");this.handlers.set(`${e}@${r}`,n)}off(e,r){if(r)this.handlers.delete(`${e}@${r}`);else for(let[n]of this.handlers.entries())n.startsWith(`${e}@`)&&this.handlers.delete(n)}disable(e){this.enable(e),this.disabled.push(e)}enable(e){this.disabled=this.disabled.filter(r=>r!==e)}emit(e,...r){let n=[...this.handlers.entries()].filter(([i,o])=>!this.disabled.includes(i.split("@")[0]));for(let[i,o]of n)i.endsWith(`@${e}`)&&o(...r)}}});function wi(t,e=de){let r,n=new Set;function i(a){if(Te(t,a)&&(t=a,r)){let l=!Mr.length;for(let u of n)u[1](),Mr.push(u,t);if(l){for(let u=0;u<Mr.length;u+=2)Mr[u][0](Mr[u+1]);Mr.length=0}}}function o(a){i(a(t))}function s(a,l=de){let u=[a,l];return n.add(u),n.size===1&&(r=e(i)||de),a(t),()=>{n.delete(u),n.size===0&&r&&(r(),r=null)}}return{set:i,update:o,subscribe:s}}var Mr,ms=A(()=>{Ze();Ze();Mr=[]});function Ve(t,e){return typeof e!="object"||xe(e).forEach(function(r){t[r]=e[r]}),t}function Je(t,e){return sg.call(t,e)}function Rr(t,e){typeof e=="function"&&(e=e(Tn(t))),(typeof Reflect=="undefined"?xe:Reflect.ownKeys)(e).forEach(r=>{bt(t,r,e[r])})}function bt(t,e,r,n){Pl(t,e,Ve(r&&Je(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function Lr(t){return{from:function(e){return t.prototype=Object.create(e.prototype),bt(t.prototype,"constructor",t),{extend:Rr.bind(null,t.prototype)}}}}function gs(t,e){let r=ag(t,e),n;return r||(n=Tn(t))&&gs(n,e)}function ji(t,e,r){return lg.call(t,e,r)}function kl(t,e){return e(t)}function Dn(t){if(!t)throw new Error("Assertion Failed")}function Ml(t){ce.setImmediate?setImmediate(t):setTimeout(t,0)}function Rl(t,e){return t.reduce((r,n,i)=>{var o=e(n,i);return o&&(r[o[0]]=o[1]),r},{})}function ug(t,e,r){try{t.apply(null,r)}catch(n){e&&e(n)}}function xt(t,e){if(Je(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var r=[],n=0,i=e.length;n<i;++n){var o=xt(t,e[n]);r.push(o)}return r}var s=e.indexOf(".");if(s!==-1){var a=t[e.substr(0,s)];return a===void 0?void 0:xt(a,e.substr(s+1))}}function ot(t,e,r){if(!(!t||e===void 0)&&!("isFrozen"in Object&&Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Dn(typeof r!="string"&&"length"in r);for(var n=0,i=e.length;n<i;++n)ot(t,e[n],r[n])}else{var o=e.indexOf(".");if(o!==-1){var s=e.substr(0,o),a=e.substr(o+1);if(a==="")r===void 0?Be(t)&&!isNaN(parseInt(s))?t.splice(s,1):delete t[s]:t[s]=r;else{var l=t[s];(!l||!Je(t,s))&&(l=t[s]={}),ot(l,a,r)}}else r===void 0?Be(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=r}}function cg(t,e){typeof e=="string"?ot(t,e,void 0):"length"in e&&[].map.call(e,function(r){ot(t,r,void 0)})}function Ll(t){var e={};for(var r in t)Je(t,r)&&(e[r]=t[r]);return e}function Nl(t){return fg.apply([],t)}function On(t){Mt=typeof WeakMap!="undefined"&&new WeakMap;let e=ys(t);return Mt=null,e}function ys(t){if(!t||typeof t!="object")return t;let e=Mt&&Mt.get(t);if(e)return e;if(Be(t)){e=[],Mt&&Mt.set(t,e);for(var r=0,n=t.length;r<n;++r)e.push(ys(t[r]))}else if(dg.indexOf(t.constructor)>=0)e=t;else{let o=Tn(t);e=o===Object.prototype?{}:Object.create(o),Mt&&Mt.set(t,e);for(var i in t)Je(t,i)&&(e[i]=ys(t[i]))}return e}function _s(t){return pg.call(t).slice(8,-1)}function wt(t){var e,r,n,i;if(arguments.length===1){if(Be(t))return t.slice();if(this===Nr&&typeof t=="string")return[t];if(i=hg(t)){for(r=[];n=i.next(),!n.done;)r.push(n.value);return r}if(t==null)return[t];if(e=t.length,typeof e=="number"){for(r=new Array(e);e--;)r[e]=t[e];return r}return[t]}for(e=arguments.length,r=new Array(e);e--;)r[e]=arguments[e];return r}function Kl(t,e){ft=t,zl=e}function ar(){if(mg)try{throw ar.arguments,new Error}catch(t){return t}return new Error}function xs(t,e){var r=t.stack;return r?(e=e||0,r.indexOf(t.name)===0&&(e+=(t.name+t.message).split(`
`).length),r.split(`
`).slice(e).filter(zl).map(n=>`
`+n).join("")):""}function Br(t,e){this._e=ar(),this.name=t,this.message=e}function Vl(t,e){return t+". Errors: "+Object.keys(e).map(r=>e[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
`)}function Ai(t,e,r,n){this._e=ar(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=Vl(t,e)}function In(t,e){this._e=ar(),this.name="BulkError",this.failures=Object.keys(e).map(r=>e[r]),this.failuresByPos=e,this.message=Vl(t,e)}function vg(t,e){if(!t||t instanceof Br||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Wl[t.name])return t;var r=new Wl[t.name](e||t.message,t);return"stack"in t&&bt(r,"stack",{get:function(){return this.inner.stack}}),r}function ie(){}function Pn(t){return t}function bg(t,e){return t==null||t===Pn?e:function(r){return e(t(r))}}function lr(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function xg(t,e){return t===ie?e:function(){var r=t.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?lr(n,this.onsuccess):n),i&&(this.onerror=this.onerror?lr(i,this.onerror):i),o!==void 0?o:r}}function wg(t,e){return t===ie?e:function(){t.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?lr(r,this.onsuccess):r),n&&(this.onerror=this.onerror?lr(n,this.onerror):n)}}function jg(t,e){return t===ie?e:function(r){var n=t.apply(this,arguments);Ve(r,n);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=e.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?lr(i,this.onsuccess):i),o&&(this.onerror=this.onerror?lr(o,this.onerror):o),n===void 0?s===void 0?void 0:s:Ve(n,s)}}function Ag(t,e){return t===ie?e:function(){return e.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}function As(t,e){return t===ie?e:function(){var r=t.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return r.then(function(){return e.apply(n,o)})}return e.apply(this,arguments)}}function R(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ie,this._lib=!1;var e=this._PSD=z;if(ft&&(this._stackHolder=ar(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==kn)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Ps(this,this._value);return}this._state=null,this._value=null,++e.ref,Ql(this,t)}function Gl(t,e,r,n,i){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof e=="function"?e:null,this.resolve=r,this.reject=n,this.psd=i}function Ql(t,e){try{e(r=>{if(t._state===null){if(r===t)throw new TypeError("A promise cannot be resolved with itself.");var n=t._lib&&Ln();r&&typeof r.then=="function"?Ql(t,(i,o)=>{r instanceof R?r._then(i,o):r.then(i,o)}):(t._state=!0,t._value=r,ql(t)),n&&Nn()}},Ps.bind(null,t))}catch(r){Ps(t,r)}}function Ps(t,e){if(Ti.push(e),t._state===null){var r=t._lib&&Ln();e=Os(e),t._state=!1,t._value=e,ft&&e!==null&&typeof e=="object"&&!e._promise&&ug(()=>{var n=gs(e,"stack");e._promise=t,bt(e,"stack",{get:()=>Fs?n&&(n.get?n.get.apply(e):n.value):t.stack})}),Dg(t),ql(t),r&&Nn()}}function ql(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r<n;++r)ks(t,e[r]);var i=t._PSD;--i.ref||i.finalize(),cr===0&&(++cr,Mn(()=>{--cr==0&&Ms()},[]))}function ks(t,e){if(t._state===null){t._listeners.push(e);return}var r=t._state?e.onFulfilled:e.onRejected;if(r===null)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++cr,Mn(Fg,[r,t,e])}function Fg(t,e,r){try{Ds=e;var n,i=e._value;e._state?n=t(i):(Ti.length&&(Ti=[]),n=t(i),Ti.indexOf(i)===-1&&Og(e)),r.resolve(n)}catch(o){r.reject(o)}finally{Ds=null,--cr==0&&Ms(),--r.psd.ref||r.psd.finalize()}}function Yl(t,e,r){if(e.length===r)return e;var n="";if(t._state===!1){var i=t._value,o,s;i!=null?(o=i.name||"Error",s=i.message||i,n=xs(i,0)):(o=i,s=""),e.push(o+(s?": "+s:"")+n)}return ft&&(n=xs(t._stackHolder,2),n&&e.indexOf(n)===-1&&e.push(n),t._prev&&Yl(t._prev,e,r)),e}function Jl(t,e){var r=e?e._numPrev+1:0;r<Sg&&(t._prev=e,t._numPrev=r)}function Oi(){Ln()&&Nn()}function Ln(){var t=Ts;return Ts=!1,Fi=!1,t}function Nn(){var t,e,r;do for(;Rn.length>0;)for(t=Rn,Rn=[],r=t.length,e=0;e<r;++e){var n=t[e];n[0].apply(null,n[1])}while(Rn.length>0);Ts=!0,Fi=!0}function Ms(){var t=ur;ur=[],t.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var e=Di.slice(0),r=e.length;r;)e[--r]()}function Tg(t){function e(){t(),Di.splice(Di.indexOf(e),1)}Di.push(e),++cr,Mn(()=>{--cr==0&&Ms()},[])}function Dg(t){ur.some(e=>e._value===t._value)||ur.push(t)}function Og(t){for(var e=ur.length;e;)if(ur[--e]._value===t._value){ur.splice(e,1);return}}function Ii(t){return new R(kn,!1,t)}function pe(t,e){var r=z;return function(){var n=Ln(),i=z;try{return Lt(r,!0),t.apply(this,arguments)}catch(o){e&&e(o)}finally{Lt(i,!1),n&&Nn()}}}function Rt(t,e,r,n){var i=z,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Pg;var s=Kr.env;o.env=Es?{Promise:R,PromiseProp:{value:R,configurable:!0,writable:!0},all:R.all,race:R.race,allSettled:R.allSettled,any:R.any,resolve:R.resolve,reject:R.reject,nthen:eu(s.nthen,o),gthen:eu(s.gthen,o)}:{},e&&Ve(o,e),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=Hr(o,t,r,n);return o.ref===0&&o.finalize(),a}function zr(){return Ke.id||(Ke.id=++Ig),++Ke.awaits,Ke.echoes+=$l,Ke.id}function jt(){return Ke.awaits?(--Ke.awaits==0&&(Ke.id=0),Ke.echoes=Ke.awaits*$l,!0):!1}function Mi(t){return Ke.echoes&&t&&t.constructor===Ei?(zr(),t.then(e=>(jt(),e),e=>(jt(),je(e)))):t}function kg(t){++ki,(!Ke.echoes||--Ke.echoes==0)&&(Ke.echoes=Ke.id=0),Pi.push(z),Lt(t,!0)}function Mg(){var t=Pi[Pi.length-1];Pi.pop(),Lt(t,!1)}function Lt(t,e){var r=z;if((e?Ke.echoes&&(!Rs++||t!==z):Rs&&(!--Rs||t!==z))&&Zl(e?kg.bind(null,t):Mg),t!==z&&(z=t,r===Kr&&(Kr.env=Xl()),Es)){var n=Kr.env.Promise,i=t.env;Ci.then=i.nthen,n.prototype.then=i.gthen,(r.global||t.global)&&(Object.defineProperty(ce,"Promise",i.PromiseProp),n.all=i.all,n.race=i.race,n.resolve=i.resolve,n.reject=i.reject,i.allSettled&&(n.allSettled=i.allSettled),i.any&&(n.any=i.any))}}function Xl(){var t=ce.Promise;return Es?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(ce,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:Ci.then,gthen:t.prototype.then}:{}}function Hr(t,e,r,n,i){var o=z;try{return Lt(t,!0),e(r,n,i)}finally{Lt(o,!1)}}function Zl(t){Ul.call(Ss,t)}function Ri(t,e,r,n){return typeof t!="function"?t:function(){var i=z;r&&zr(),Lt(e,!0);try{return t.apply(this,arguments)}finally{Lt(i,!1),n&&Zl(jt)}}}function eu(t,e){return function(r,n){return t.call(this,Ri(r,e),Ri(n,e))}}function ru(t,e){var r;try{r=e.onuncatched(t)}catch{}if(r!==!1)try{var n,i={promise:e,reason:t};if(ce.document&&document.createEvent?(n=document.createEvent("Event"),n.initEvent(tu,!0,!0),Ve(n,i)):ce.CustomEvent&&(n=new CustomEvent(tu,{detail:i}),Ve(n,i)),n&&ce.dispatchEvent&&(dispatchEvent(n),!ce.PromiseRejectionEvent&&ce.onunhandledrejection))try{ce.onunhandledrejection(n)}catch{}ft&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}function Ls(t,e,r,n){if(!t.idbdb||!t._state.openComplete&&!z.letThrough&&!t._vip){if(t._state.openComplete)return je(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return je(new V.DatabaseClosed);t.open().catch(ie)}return t._state.dbReadyPromise.then(()=>Ls(t,e,r,n))}else{var i=t._createTransaction(e,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===js.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Ls(t,e,r,n))):je(o)}return i._promise(e,(o,s)=>Rt(()=>(z.trans=i,n(o,s,i)))).then(o=>i._completion.then(()=>o))}}function dr(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}function Bi(t){return typeof t=="string"&&!/\./.test(t)?e=>(e[t]===void 0&&t in e&&(e=On(e),delete e[t]),e):e=>e}function Kn(t){var e={},r=function(a,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return e[a].subscribe.apply(null,c),t}else if(typeof a=="string")return e[a]};r.addEventType=o;for(var n=1,i=arguments.length;n<i;++n)o(arguments[n]);return r;function o(a,l,u){if(typeof a=="object")return s(a);l||(l=Ag),u||(u=ie);var c={subscribers:[],fire:u,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=l(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(f){return f!==d}),c.fire=c.subscribers.reduce(l,u)}};return e[a]=r[a]=c,c}function s(a){xe(a).forEach(function(l){var u=a[l];if(Be(u))o(l,a[l][0],a[l][1]);else if(u==="asap")var c=o(l,Pn,function(){for(var f=arguments.length,h=new Array(f);f--;)h[f]=arguments[f];c.subscribers.forEach(function(y){Ml(function(){y.apply(null,h)})})});else throw new V.InvalidArgument("Invalid event config")})}}function zn(t,e){return Lr(e).from({prototype:t}),e}function Ng(t){return zn(au.prototype,function(r,n,i){this.db=t,this._tx=i,this.name=r,this.schema=n,this.hook=t._allTables[r]?t._allTables[r].hook:Kn(null,{creating:[xg,ie],reading:[bg,Pn],updating:[jg,ie],deleting:[wg,ie]})})}function Vr(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function zs(t,e){t.filter=dr(t.filter,e)}function Hs(t,e,r){var n=t.replayFilter;t.replayFilter=n?()=>dr(n(),e()):e,t.justLimit=r&&!n}function Bg(t,e){t.isMatch=dr(t.isMatch,e)}function Ki(t,e){if(t.isPrimKey)return e.primaryKey;let r=e.getIndexByKeyPath(t.index);if(!r)throw new V.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return r}function lu(t,e,r){let n=Ki(t,e.schema);return e.openCursor({trans:r,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:n,range:t.range}})}function zi(t,e,r,n){let i=t.replayFilter?dr(t.filter,t.replayFilter()):t.filter;if(t.or){let o={},s=(a,l,u)=>{if(!i||i(l,u,f=>l.stop(f),f=>l.fail(f))){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),Je(o,d)||(o[d]=!0,e(a,l,u))}};return Promise.all([t.or._iterate(s,r),uu(lu(t,n,r),t.algorithm,s,!t.keysOnly&&t.valueMapper)])}else return uu(lu(t,n,r),dr(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function uu(t,e,r,n){var i=n?(s,a,l)=>r(n(s),a,l):r,o=pe(i);return t.then(s=>{if(s)return s.start(()=>{var a=()=>s.continue();(!e||e(s,l=>a=l,l=>{s.stop(l),a=ie},l=>{s.fail(l),a=ie}))&&o(s.value,s,l=>a=l),a()})})}function We(t,e){try{let r=cu(t),n=cu(e);if(r!==n)return r==="Array"?1:n==="Array"?-1:r==="binary"?1:n==="binary"?-1:r==="string"?1:n==="string"?-1:r==="Date"?1:n!=="Date"?NaN:-1;switch(r){case"number":case"Date":case"string":return t>e?1:t<e?-1:0;case"binary":return zg(fu(t),fu(e));case"Array":return Kg(t,e)}}catch{}return NaN}function Kg(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let o=0;o<i;++o){let s=We(t[o],e[o]);if(s!==0)return s}return r===n?0:r<n?-1:1}function zg(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let o=0;o<i;++o)if(t[o]!==e[o])return t[o]<e[o]?-1:1;return r===n?0:r<n?-1:1}function cu(t){let e=typeof t;if(e!=="object")return e;if(ArrayBuffer.isView(t))return"binary";let r=_s(t);return r==="ArrayBuffer"?"binary":r}function fu(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}function Hg(t){return zn(du.prototype,function(r,n){this.db=t;let i=su,o=null;if(n)try{i=n()}catch(u){o=u}let s=r._ctx,a=s.table,l=a.hook.reading.fire;this._ctx={table:a,index:s.index,isPrimKey:!s.index||a.schema.primKey.keyPath&&s.index===a.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:s.or,valueMapper:l!==Pn?l:null}})}function Vg(t,e){return t<e?-1:t===e?0:1}function Wg(t,e){return t>e?-1:t===e?0:1}function Xe(t,e,r){var n=t instanceof Ws?new t.Collection(t):t;return n._ctx.error=r?new r(e):new TypeError(e),n}function Wr(t){return new t.Collection(t,()=>pu("")).limit(0)}function $g(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function Ug(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function Gg(t,e,r,n,i,o){for(var s=Math.min(t.length,n.length),a=-1,l=0;l<s;++l){var u=e[l];if(u!==n[l])return i(t[l],r[l])<0?t.substr(0,l)+r[l]+r.substr(l+1):i(t[l],n[l])<0?t.substr(0,l)+n[l]+r.substr(l+1):a>=0?t.substr(0,a)+e[a]+r.substr(a+1):null;i(t[l],u)<0&&(a=l)}return s<n.length&&o==="next"?t+r.substr(t.length):s<t.length&&o==="prev"?t.substr(0,r.length):a<0?null:t.substr(0,a)+n[a]+r.substr(a+1)}function Hi(t,e,r,n){var i,o,s,a,l,u,c,d=r.length;if(!r.every(j=>typeof j=="string"))return Xe(t,iu);function f(j){i=$g(j),o=Ug(j),s=j==="next"?Vg:Wg;var v=r.map(function(p){return{lower:o(p),upper:i(p)}}).sort(function(p,b){return s(p.lower,b.lower)});a=v.map(function(p){return p.upper}),l=v.map(function(p){return p.lower}),u=j,c=j==="next"?"":n}f("next");var h=new t.Collection(t,()=>Nt(a[0],l[d-1]+n));h._ondirectionchange=function(j){f(j)};var y=0;return h._addAlgorithm(function(j,v,p){var b=j.key;if(typeof b!="string")return!1;var m=o(b);if(e(m,l,y))return!0;for(var g=null,x=y;x<d;++x){var _=Gg(b,m,a[x],l[x],s,u);_===null&&g===null?y=x+1:(g===null||s(g,_)>0)&&(g=_)}return v(g!==null?function(){j.continue(g+c)}:p),!1}),h}function Nt(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function pu(t){return{type:1,lower:t,upper:t}}function Qg(t){return zn(Ws.prototype,function(r,n,i){this.db=t,this._ctx={table:r,index:n===":id"?null:n,or:i};let o=t._deps.indexedDB;if(!o)throw new V.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(s,a)=>o.cmp(a,s),this._max=(s,a)=>o.cmp(s,a)>0?s:a,this._min=(s,a)=>o.cmp(s,a)<0?s:a,this._IDBKeyRange=t._deps.IDBKeyRange})}function dt(t){return pe(function(e){return Hn(e),t(e.target.error),!1})}function Hn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}function qg(t){return zn(hu.prototype,function(r,n,i,o,s){this.db=t,this.mode=r,this.storeNames=n,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=Kn(this,"complete","error","abort"),this.parent=s||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new R((a,l)=>{this._resolve=a,this._reject=l}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},a=>{var l=this.active;return this.active=!1,this.on.error.fire(a),this.parent?this.parent._reject(a):l&&this.idbtrans&&this.idbtrans.abort(),je(a)})})}function $s(t,e,r,n,i,o,s){return{name:t,keyPath:e,unique:r,multi:n,auto:i,compound:o,src:(r&&!s?"&":"")+(n?"*":"")+(i?"++":"")+mu(e)}}function mu(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function gu(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:Rl(r,n=>[n.name,n])}}function Yg(t){return t.length===1?t[0]:t}function Us(t){return t==null?()=>{}:typeof t=="string"?Jg(t):e=>xt(e,t)}function Jg(t){return t.split(".").length===1?r=>r[t]:r=>xt(r,t)}function yu(t){return[].slice.call(t)}function $n(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Zg(t,e,r){function n(c,d){let f=yu(c.objectStoreNames);return{schema:{name:c.name,tables:f.map(h=>d.objectStore(h)).map(h=>{let{keyPath:y,autoIncrement:j}=h,v=Be(y),p=y==null,b={},m={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:p,compound:v,keyPath:y,autoIncrement:j,unique:!0,extractKey:Us(y)},indexes:yu(h.indexNames).map(g=>h.index(g)).map(g=>{let{name:x,unique:_,multiEntry:w,keyPath:S}=g,E=Be(S),D={name:x,compound:E,keyPath:S,unique:_,multiEntry:w,extractKey:Us(S)};return b[$n(S)]=D,D}),getIndexByKeyPath:g=>b[$n(g)]};return b[":id"]=m.primaryKey,y!=null&&(b[$n(y)]=m.primaryKey),m})},hasGetAll:f.length>0&&"getAll"in d.objectStore(f[0])&&!(typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(c){if(c.type===3)return null;if(c.type===4)throw new Error("Cannot convert never type to IDBKeyRange");let{lower:d,upper:f,lowerOpen:h,upperOpen:y}=c;return d===void 0?f===void 0?null:e.upperBound(f,!!y):f===void 0?e.lowerBound(d,!!h):e.bound(d,f,!!h,!!y)}function o(c){let d=c.name;function f({trans:j,type:v,keys:p,values:b,range:m}){return new Promise((g,x)=>{g=pe(g);let _=j.objectStore(d),w=_.keyPath==null,S=v==="put"||v==="add";if(!S&&v!=="delete"&&v!=="deleteRange")throw new Error("Invalid operation type: "+v);let{length:E}=p||b||{length:1};if(p&&b&&p.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(E===0)return g({numFailures:0,failures:{},results:[],lastResult:void 0});let D,O=[],L=[],k=0,H=Y=>{++k,Hn(Y)};if(v==="deleteRange"){if(m.type===4)return g({numFailures:k,failures:L,results:[],lastResult:void 0});m.type===3?O.push(D=_.clear()):O.push(D=_.delete(i(m)))}else{let[Y,J]=S?w?[b,p]:[b,null]:[p,null];if(S)for(let C=0;C<E;++C)O.push(D=J&&J[C]!==void 0?_[v](Y[C],J[C]):_[v](Y[C])),D.onerror=H;else for(let C=0;C<E;++C)O.push(D=_[v](Y[C])),D.onerror=H}let X=Y=>{let J=Y.target.result;O.forEach((C,F)=>C.error!=null&&(L[F]=C.error)),g({numFailures:k,failures:L,results:v==="delete"?p:O.map(C=>C.result),lastResult:J})};D.onerror=Y=>{H(Y),X(Y)},D.onsuccess=X})}function h({trans:j,values:v,query:p,reverse:b,unique:m}){return new Promise((g,x)=>{g=pe(g);let{index:_,range:w}=p,S=j.objectStore(d),E=_.isPrimaryKey?S:S.index(_.name),D=b?m?"prevunique":"prev":m?"nextunique":"next",O=v||!("openKeyCursor"in E)?E.openCursor(i(w),D):E.openKeyCursor(i(w),D);O.onerror=dt(x),O.onsuccess=pe(L=>{let k=O.result;if(!k){g(null);return}k.___id=++Xg,k.done=!1;let H=k.continue.bind(k),X=k.continuePrimaryKey;X&&(X=X.bind(k));let Y=k.advance.bind(k),J=()=>{throw new Error("Cursor not started")},C=()=>{throw new Error("Cursor not stopped")};k.trans=j,k.stop=k.continue=k.continuePrimaryKey=k.advance=J,k.fail=pe(x),k.next=function(){let F=1;return this.start(()=>F--?this.continue():this.stop()).then(()=>this)},k.start=F=>{let P=new Promise((Z,se)=>{Z=pe(Z),O.onerror=dt(se),k.fail=se,k.stop=Fe=>{k.stop=k.continue=k.continuePrimaryKey=k.advance=C,Z(Fe)}}),K=()=>{if(O.result)try{F()}catch(Z){k.fail(Z)}else k.done=!0,k.start=()=>{throw new Error("Cursor behind last entry")},k.stop()};return O.onsuccess=pe(Z=>{O.onsuccess=K,K()}),k.continue=H,k.continuePrimaryKey=X,k.advance=Y,K(),P},g(k)},x)})}function y(j){return v=>new Promise((p,b)=>{p=pe(p);let{trans:m,values:g,limit:x,query:_}=v,w=x===1/0?void 0:x,{index:S,range:E}=_,D=m.objectStore(d),O=S.isPrimaryKey?D:D.index(S.name),L=i(E);if(x===0)return p({result:[]});if(j){let k=g?O.getAll(L,w):O.getAllKeys(L,w);k.onsuccess=H=>p({result:H.target.result}),k.onerror=dt(b)}else{let k=0,H=g||!("openKeyCursor"in O)?O.openCursor(L):O.openKeyCursor(L),X=[];H.onsuccess=Y=>{let J=H.result;if(!J)return p({result:X});if(X.push(g?J.value:J.primaryKey),++k===x)return p({result:X});J.continue()},H.onerror=dt(b)}})}return{name:d,schema:c,mutate:f,getMany({trans:j,keys:v}){return new Promise((p,b)=>{p=pe(p);let m=j.objectStore(d),g=v.length,x=new Array(g),_=0,w=0,S,E=O=>{let L=O.target;(x[L._pos]=L.result)!=null,++w===_&&p(x)},D=dt(b);for(let O=0;O<g;++O)v[O]!=null&&(S=m.get(v[O]),S._pos=O,S.onsuccess=E,S.onerror=D,++_);_===0&&p(x)})},get({trans:j,key:v}){return new Promise((p,b)=>{p=pe(p);let g=j.objectStore(d).get(v);g.onsuccess=x=>p(x.target.result),g.onerror=dt(b)})},query:y(a),openCursor:h,count({query:j,trans:v}){let{index:p,range:b}=j;return new Promise((m,g)=>{let x=v.objectStore(d),_=p.isPrimaryKey?x:x.index(p.name),w=i(b),S=w?_.count(w):_.count();S.onsuccess=pe(E=>m(E.target.result)),S.onerror=dt(g)})}}}let{schema:s,hasGetAll:a}=n(t,r),l=s.tables.map(c=>o(c)),u={};return l.forEach(c=>u[c.name]=c),{stack:"dbcore",transaction:t.transaction.bind(t),table(c){if(!u[c])throw new Error(`Table '${c}' not found`);return u[c]},MIN_KEY:-1/0,MAX_KEY:Wn(e),schema:s}}function ey(t,e){return e.reduce((r,{create:n})=>ye(ye({},r),n(r)),t)}function ty(t,e,{IDBKeyRange:r,indexedDB:n},i){return{dbcore:ey(Zg(e,r,i),t.dbcore)}}function Gs({_novip:t},e){let r=e.db,n=ty(t._middlewares,r,t._deps,e);t.core=n.dbcore,t.tables.forEach(i=>{let o=i.name;t.core.schema.tables.some(s=>s.name===o)&&(i.core=t.core.table(o),t[o]instanceof t.Table&&(t[o].core=i.core))})}function Vi({_novip:t},e,r,n){r.forEach(i=>{let o=n[i];e.forEach(s=>{let a=gs(s,i);(!a||"value"in a&&a.value===void 0)&&(s===t.Transaction.prototype||s instanceof t.Transaction?bt(s,i,{get(){return this.table(i)},set(l){Pl(this,i,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):s[i]=new t.Table(i,o))})})}function Qs({_novip:t},e){e.forEach(r=>{for(let n in r)r[n]instanceof t.Table&&delete r[n]})}function ry(t,e){return t._cfg.version-e._cfg.version}function ny(t,e,r,n){let i=t._dbSchema,o=t._createTransaction("readwrite",t._storeNames,i);o.create(r),o._completion.catch(n);let s=o._reject.bind(o),a=z.transless||z;Rt(()=>{z.trans=o,z.transless=a,e===0?(xe(i).forEach(l=>{qs(r,l,i[l].primKey,i[l].indexes)}),Gs(t,r),R.follow(()=>t.on.populate.fire(o)).catch(s)):iy(t,e,o,r).catch(s)})}function iy({_novip:t},e,r,n){let i=[],o=t._versions,s=t._dbSchema=Js(t,t.idbdb,n),a=!1;o.filter(c=>c._cfg.version>=e).forEach(c=>{i.push(()=>{let d=s,f=c._cfg.dbschema;Xs(t,d,n),Xs(t,f,n),s=t._dbSchema=f;let h=_u(d,f);h.add.forEach(j=>{qs(n,j[0],j[1].primKey,j[1].indexes)}),h.change.forEach(j=>{if(j.recreate)throw new V.Upgrade("Not yet support for changing primary key");{let v=n.objectStore(j.name);j.add.forEach(p=>Ys(v,p)),j.change.forEach(p=>{v.deleteIndex(p.name),Ys(v,p)}),j.del.forEach(p=>v.deleteIndex(p))}});let y=c._cfg.contentUpgrade;if(y&&c._cfg.version>e){Gs(t,n),r._memoizedTables={},a=!0;let j=Ll(f);h.del.forEach(m=>{j[m]=d[m]}),Qs(t,[t.Transaction.prototype]),Vi(t,[t.Transaction.prototype],xe(j),j),r.schema=j;let v=bs(y);v&&zr();let p,b=R.follow(()=>{if(p=y(r),p&&v){var m=jt.bind(null,null);p.then(m,m)}});return p&&typeof p.then=="function"?R.resolve(p):b.then(()=>p)}}),i.push(d=>{if(!a||!Rg){let f=c._cfg.dbschema;sy(f,d)}Qs(t,[t.Transaction.prototype]),Vi(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema})});function u(){return i.length?R.resolve(i.shift()(r.idbtrans)).then(u):R.resolve()}return u().then(()=>{oy(s,n)})}function _u(t,e){let r={del:[],add:[],change:[]},n;for(n in t)e[n]||r.del.push(n);for(n in e){let i=t[n],o=e[n];if(!i)r.add.push([n,o]);else{let s={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!Li)s.recreate=!0,r.change.push(s);else{let a=i.idxByName,l=o.idxByName,u;for(u in a)l[u]||s.del.push(u);for(u in l){let c=a[u],d=l[u];c?c.src!==d.src&&s.change.push(d):s.add.push(d)}(s.del.length>0||s.add.length>0||s.change.length>0)&&r.change.push(s)}}}return r}function qs(t,e,r,n){let i=t.db.createObjectStore(e,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(o=>Ys(i,o)),i}function oy(t,e){xe(t).forEach(r=>{e.db.objectStoreNames.contains(r)||qs(e,r,t[r].primKey,t[r].indexes)})}function sy(t,e){[].slice.call(e.db.objectStoreNames).forEach(r=>t[r]==null&&e.db.deleteObjectStore(r))}function Ys(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function Js(t,e,r){let n={};return ji(e.objectStoreNames,0).forEach(o=>{let s=r.objectStore(o),a=s.keyPath,l=$s(mu(a),a||"",!1,!1,!!s.autoIncrement,a&&typeof a!="string",!0),u=[];for(let d=0;d<s.indexNames.length;++d){let f=s.index(s.indexNames[d]);a=f.keyPath;var c=$s(f.name,a,!!f.unique,!!f.multiEntry,!1,a&&typeof a!="string",!1);u.push(c)}n[o]=gu(o,l,u)}),n}function ay({_novip:t},e,r){t.verno=e.version/10;let n=t._dbSchema=Js(t,e,r);t._storeNames=ji(e.objectStoreNames,0),Vi(t,[t._allTables],xe(n),n)}function ly(t,e){let r=Js(t,t.idbdb,e),n=_u(r,t._dbSchema);return!(n.add.length||n.change.some(i=>i.add.length||i.change.length))}function Xs({_novip:t},e,r){let n=r.db.objectStoreNames;for(let i=0;i<n.length;++i){let o=n[i],s=r.objectStore(o);t._hasGetAll="getAll"in s;for(let a=0;a<s.indexNames.length;++a){let l=s.indexNames[a],u=s.index(l).keyPath,c=typeof u=="string"?u:"["+ji(u).join("+")+"]";if(e[o]){let d=e[o].idxByName[c];d&&(d.name=l,delete e[o].idxByName[c],e[o].idxByName[l]=d)}}}typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&ce.WorkerGlobalScope&&ce instanceof ce.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}function uy(t){return t.split(",").map((e,r)=>{e=e.trim();let n=e.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return $s(n,i||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),Be(i),r===0)})}function cy(t){return zn(vu.prototype,function(r){this.db=t,this._cfg={version:r,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Zs(t,e){let r=t._dbNamesDB;return r||(r=t._dbNamesDB=new Ct(Ni,{addons:[],indexedDB:t,IDBKeyRange:e}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function ea(t){return t&&typeof t.databases=="function"}function fy({indexedDB:t,IDBKeyRange:e}){return ea(t)?Promise.resolve(t.databases()).then(r=>r.map(n=>n.name).filter(n=>n!==Ni)):Zs(t,e).toCollection().primaryKeys()}function dy({indexedDB:t,IDBKeyRange:e},r){!ea(t)&&r!==Ni&&Zs(t,e).put({name:r}).catch(ie)}function py({indexedDB:t,IDBKeyRange:e},r){!ea(t)&&r!==Ni&&Zs(t,e).delete(r).catch(ie)}function ta(t){return Rt(function(){return z.letThrough=!0,t()})}function hy(){var t=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!t||!indexedDB.databases)return Promise.resolve();var e;return new Promise(function(r){var n=function(){return indexedDB.databases().finally(r)};e=setInterval(n,100),n()}).finally(function(){return clearInterval(e)})}function my(t){let e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?je(e.dbOpenError):t);ft&&(e.openCanceller._stackHolder=ar()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;let n=e.openCanceller;function i(){if(e.openCanceller!==n)throw new V.DatabaseClosed("db.open() was cancelled")}let o=e.dbReadyResolve,s=null,a=!1;return R.race([n,(typeof navigator=="undefined"?R.resolve():hy()).then(()=>new R((l,u)=>{if(i(),!r)throw new V.MissingAPI;let c=t.name,d=e.autoSchema?r.open(c):r.open(c,Math.round(t.verno*10));if(!d)throw new V.MissingAPI;d.onerror=dt(u),d.onblocked=pe(t._fireOnBlocked),d.onupgradeneeded=pe(f=>{if(s=d.transaction,e.autoSchema&&!t._options.allowEmptyDB){d.onerror=Hn,s.abort(),d.result.close();let y=r.deleteDatabase(c);y.onsuccess=y.onerror=pe(()=>{u(new V.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{s.onerror=dt(u);var h=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;a=h<1,t._novip.idbdb=d.result,ny(t,h/10,s,u)}},u),d.onsuccess=pe(()=>{s=null;let f=t._novip.idbdb=d.result,h=ji(f.objectStoreNames);if(h.length>0)try{let y=f.transaction(Yg(h),"readonly");e.autoSchema?ay(t,f,y):(Xs(t,t._dbSchema,y),ly(t,y)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Gs(t,y)}catch{}Bn.push(t),f.onversionchange=pe(y=>{e.vcFired=!0,t.on("versionchange").fire(y)}),f.onclose=pe(y=>{t.on("close").fire(y)}),a&&dy(t._deps,c),l()},u)}))]).then(()=>(i(),e.onReadyBeingFired=[],R.resolve(ta(()=>t.on.ready.fire(t.vip))).then(function l(){if(e.onReadyBeingFired.length>0){let u=e.onReadyBeingFired.reduce(As,ie);return e.onReadyBeingFired=[],R.resolve(ta(()=>u(t.vip))).then(l)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(l=>{e.dbOpenError=l;try{s&&s.abort()}catch{}return n===e.openCanceller&&t._close(),je(l)}).finally(()=>{e.openComplete=!0,o()})}function ra(t){var e=s=>t.next(s),r=s=>t.throw(s),n=o(e),i=o(r);function o(s){return a=>{var l=s(a),u=l.value;return l.done?u:!u||typeof u.then!="function"?Be(u)?Promise.all(u).then(n,i):n(u):u.then(n,i)}}return o(e)()}function gy(t,e,r){var n=arguments.length;if(n<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(n-1);--n;)i[n-1]=arguments[n];r=i.pop();var o=Nl(i);return[t,o,r]}function bu(t,e,r,n,i){return R.resolve().then(()=>{let o=z.transless||z,s=t._createTransaction(e,r,t._dbSchema,n),a={trans:s,transless:o};if(n)s.idbtrans=n.idbtrans;else try{s.create(),t._state.PR1398_maxLoop=3}catch(d){return d.name===js.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>bu(t,e,r,null,i))):je(d)}let l=bs(i);l&&zr();let u,c=R.follow(()=>{if(u=i.call(s,s),u)if(l){var d=jt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=ra(u))},a);return(u&&typeof u.then=="function"?R.resolve(u).then(d=>s.active?d:je(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>u)).then(d=>(n&&s._resolve(),s._completion.then(()=>d))).catch(d=>(s._reject(d),je(d)))})}function Wi(t,e,r){let n=Be(t)?t.slice():[t];for(let i=0;i<r;++i)n.push(e);return n}function yy(t){return ze(ye({},t),{table(e){let r=t.table(e),{schema:n}=r,i={},o=[];function s(f,h,y){let j=$n(f),v=i[j]=i[j]||[],p=f==null?0:typeof f=="string"?1:f.length,b=h>0,m=ze(ye({},y),{isVirtual:b,keyTail:h,keyLength:p,extractKey:Us(f),unique:!b&&y.unique});if(v.push(m),m.isPrimaryKey||o.push(m),p>1){let g=p===2?f[0]:f.slice(0,p-1);s(g,h+1,y)}return v.sort((g,x)=>g.keyTail-x.keyTail),m}let a=s(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[a];for(let f of n.indexes)s(f.keyPath,0,f);function l(f){let h=i[$n(f)];return h&&h[0]}function u(f,h){return{type:f.type===1?2:f.type,lower:Wi(f.lower,f.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:Wi(f.upper,f.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0}}function c(f){let h=f.query.index;return h.isVirtual?ze(ye({},f),{query:{index:h,range:u(f.query.range,h.keyTail)}}):f}return ze(ye({},r),{schema:ze(ye({},n),{primaryKey:a,indexes:o,getIndexByKeyPath:l}),count(f){return r.count(c(f))},query(f){return r.query(c(f))},openCursor(f){let{keyTail:h,isVirtual:y,keyLength:j}=f.query.index;if(!y)return r.openCursor(f);function v(p){function b(g){g!=null?p.continue(Wi(g,f.reverse?t.MAX_KEY:t.MIN_KEY,h)):f.unique?p.continue(p.key.slice(0,j).concat(f.reverse?t.MIN_KEY:t.MAX_KEY,h)):p.continue()}return Object.create(p,{continue:{value:b},continuePrimaryKey:{value(g,x){p.continuePrimaryKey(Wi(g,t.MAX_KEY,h),x)}},primaryKey:{get(){return p.primaryKey}},key:{get(){let g=p.key;return j===1?g[0]:g.slice(0,j)}},value:{get(){return p.value}}})}return r.openCursor(c(f)).then(p=>p&&v(p))}})}})}function na(t,e,r,n){return r=r||{},n=n||"",xe(t).forEach(i=>{if(!Je(e,i))r[n+i]=void 0;else{var o=t[i],s=e[i];if(typeof o=="object"&&typeof s=="object"&&o&&s){let a=_s(o),l=_s(s);a!==l?r[n+i]=e[i]:a==="Object"?na(o,s,r,n+i+"."):o!==s&&(r[n+i]=e[i])}else o!==s&&(r[n+i]=e[i])}}),xe(e).forEach(i=>{Je(t,i)||(r[n+i]=e[i])}),r}function vy(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}function xy(t,e,r){return e.type==="add"?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}function xu(t,e,r){try{if(!e||e.keys.length<t.length)return null;let n=[];for(let i=0,o=0;i<e.keys.length&&o<t.length;++i)We(e.keys[i],t[o])===0&&(n.push(r?On(e.values[i]):e.values[i]),++o);return n.length===t.length?n:null}catch{return null}}function ia(t){return!("from"in t)}function Un(t,e,r){let n=We(e,r);if(isNaN(n))return;if(n>0)throw RangeError();if(ia(t))return Ve(t,{from:e,to:r,d:1});let i=t.l,o=t.r;if(We(r,t.from)<0)return i?Un(i,e,r):t.l={from:e,to:r,d:1,l:null,r:null},wu(t);if(We(e,t.to)>0)return o?Un(o,e,r):t.r={from:e,to:r,d:1,l:null,r:null},wu(t);We(e,t.from)<0&&(t.from=e,t.l=null,t.d=o?o.d+1:1),We(r,t.to)>0&&(t.to=r,t.r=null,t.d=t.l?t.l.d+1:1);let s=!t.r;i&&!t.l&&$i(t,i),o&&s&&$i(t,o)}function $i(t,e){function r(n,{from:i,to:o,l:s,r:a}){Un(n,i,o),s&&r(n,s),a&&r(n,a)}ia(e)||r(t,e)}function jy(t,e){let r=oa(e),n=r.next();if(n.done)return!1;let i=n.value,o=oa(t),s=o.next(i.from),a=s.value;for(;!n.done&&!s.done;){if(We(a.from,i.to)<=0&&We(a.to,i.from)>=0)return!0;We(i.from,a.from)<0?i=(n=r.next(a.from)).value:a=(s=o.next(i.from)).value}return!1}function oa(t){let e=ia(t)?null:{s:0,n:t};return{next(r){let n=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,n)for(;e.n.l&&We(r,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!n||We(r,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function wu(t){var e,r;let n=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((r=t.l)===null||r===void 0?void 0:r.d)||0),i=n>1?"r":n<-1?"l":"";if(i){let o=i==="r"?"l":"r",s=ye({},t),a=t[i];t.from=a.from,t.to=a.to,t[i]=a[i],s[i]=a[o],t[o]=s,s.d=ju(s)}t.d=ju(t)}function ju({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function Sy(t,e,r,n){function i(o){let s=t(o.name||"");function a(u){return u!=null?o.extractKey(u):null}let l=u=>o.multiEntry&&Be(u)?u.forEach(c=>s.addKey(c)):s.addKey(u);(r||n).forEach((u,c)=>{let d=r&&a(r[c]),f=n&&a(n[c]);We(d,f)!==0&&(d!=null&&l(d),f!=null&&l(f))})}e.indexes.forEach(i)}function Su(t,e){return xe(e).forEach(r=>{let n=t[r]||(t[r]=new St);$i(n,e[r])}),t}function Ey(t){let e=!1,r,n=new Au(i=>{let o=bs(t);function s(v){o&&zr();let p=()=>Rt(t,{subscr:v,trans:null}),b=z.trans?Hr(z.transless,p):p();return o&&b.then(jt,jt),b}let a=!1,l={},u={},c={get closed(){return a},unsubscribe:()=>{a=!0,Kt.storagemutated.unsubscribe(y)}};i.start&&i.start(c);let d=!1,f=!1;function h(){return xe(u).some(v=>l[v]&&jy(l[v],u[v]))}let y=v=>{Su(l,v),h()&&j()},j=()=>{if(d||a)return;l={};let v={},p=s(v);f||(Kt(Vn,y),f=!0),d=!0,Promise.resolve(p).then(b=>{e=!0,r=b,d=!1,!a&&(h()?j():(l={},u=v,i.next&&i.next(b)))},b=>{d=!1,e=!1,i.error&&i.error(b),c.unsubscribe()})};return j(),c});return n.hasValue=()=>e,n.getValue=()=>r,n}function Ui(t){let e=Et;try{Et=!0,Kt.storagemutated.fire(t)}finally{Et=e}}function Fy({data:t}){t&&t.type===Bt&&Ui(t.changedParts)}var ce,xe,Be,Tn,sg,Pl,ag,lg,fg,Bl,dg,Mt,pg,vs,hg,Nr,bs,ft,zl,mg,gg,Hl,ws,yg,js,_g,V,Wl,Si,kn,Sg,Cg,$l,Ss,Ci,Cs,Ul,Ei,Es,Fs,Eg,Mn,Ts,Fi,ur,Ti,Ds,Os,Kr,z,Rn,cr,Di,Is,Ke,Ig,Pi,Rs,ki,Pg,tu,je,nu,fr,Ns,At,iu,Bn,Li,Rg,Lg,ou,Ni,Bs,Ks,su,au,du,Vs,Ws,Vn,Bt,Kt,hu,Wn,Xg,vu,_y,by,wy,St,Ay,Ct,Cy,Au,sa,pr,Et,Cu=A(()=>{ce=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,xe=Object.keys,Be=Array.isArray;typeof Promise!="undefined"&&!ce.Promise&&(ce.Promise=Promise);Tn=Object.getPrototypeOf,sg={}.hasOwnProperty;Pl=Object.defineProperty;ag=Object.getOwnPropertyDescriptor;lg=[].slice;fg=[].concat;Bl="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Nl([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>ce[t]),dg=Bl.map(t=>ce[t]);Rl(Bl,t=>[t,!0]);Mt=null;({toString:pg}={});vs=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",hg=typeof vs=="symbol"?function(t){var e;return t!=null&&(e=t[vs])&&e.apply(t)}:function(){return null},Nr={};bs=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,ft=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);zl=()=>!0,mg=!new Error("").stack;gg=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Hl=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ws=gg.concat(Hl),yg={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"};Lr(Br).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+xs(this._e,2))}},toString:function(){return this.name+": "+this.message}});Lr(Ai).from(Br);Lr(In).from(Br);js=ws.reduce((t,e)=>(t[e]=e+"Error",t),{}),_g=Br,V=ws.reduce((t,e)=>{var r=e+"Error";function n(i,o){this._e=ar(),this.name=r,i?typeof i=="string"?(this.message=`${i}${o?`
`+o:""}`,this.inner=o||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=yg[e]||r,this.inner=null)}return Lr(n).from(_g),t[e]=n,t},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;Wl=Hl.reduce((t,e)=>(t[e+"Error"]=V[e],t),{});Si=ws.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=V[e]),t),{});Si.ModifyError=Ai;Si.DexieError=Br;Si.BulkError=In;kn={},Sg=100,Cg=20,$l=100,[Ss,Ci,Cs]=typeof Promise=="undefined"?[]:(()=>{let t=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[t,Tn(t),t];let e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Tn(e),t]})(),Ul=Ci&&Ci.then,Ei=Ss&&Ss.constructor,Es=!!Cs,Fs=!1,Eg=Cs?()=>{Cs.then(Oi)}:ce.setImmediate?setImmediate.bind(null,Oi):ce.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{Oi(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Oi,0)},Mn=function(t,e){Rn.push([t,e]),Fi&&(Eg(),Fi=!1)},Ts=!0,Fi=!0,ur=[],Ti=[],Ds=null,Os=Pn,Kr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ru,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{ru(t[0],t[1])}catch{}})}},z=Kr,Rn=[],cr=0,Di=[];Is={get:function(){var t=z,e=ki;function r(n,i){var o=!t.global&&(t!==z||e!==ki);let s=o&&!jt();var a=new R((l,u)=>{ks(this,new Gl(Ri(n,t,o,s),Ri(i,t,o,s),l,u,t))});return ft&&Jl(a,this),a}return r.prototype=kn,r},set:function(t){bt(this,"then",t&&t.prototype===kn?Is:{get:function(){return t},set:Is.set})}};Rr(R.prototype,{then:Is,_then:function(t,e){ks(this,new Gl(null,null,t,e,z))},catch:function(t){if(arguments.length===1)return this.then(null,t);var e=arguments[0],r=arguments[1];return typeof e=="function"?this.then(null,n=>n instanceof e?r(n):Ii(n)):this.then(null,n=>n&&n.name===e?r(n):Ii(n))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),Ii(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Fs=!0;var t=Yl(this,[],Cg),e=t.join(`
From previous: `);return this._state!==null&&(this._stack=e),e}finally{Fs=!1}}},timeout:function(t,e){return t<1/0?new R((r,n)=>{var i=setTimeout(()=>n(new V.Timeout(e)),t);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&bt(R.prototype,Symbol.toStringTag,"Dexie.Promise");Kr.env=Xl();Rr(R,{all:function(){var t=wt.apply(null,arguments).map(Mi);return new R(function(e,r){t.length===0&&e([]);var n=t.length;t.forEach((i,o)=>R.resolve(i).then(s=>{t[o]=s,--n||e(t)},r))})},resolve:t=>{if(t instanceof R)return t;if(t&&typeof t.then=="function")return new R((r,n)=>{t.then(r,n)});var e=new R(kn,!0,t);return Jl(e,Ds),e},reject:Ii,race:function(){var t=wt.apply(null,arguments).map(Mi);return new R((e,r)=>{t.map(n=>R.resolve(n).then(e,r))})},PSD:{get:()=>z,set:t=>z=t},totalEchoes:{get:()=>ki},newPSD:Rt,usePSD:Hr,scheduler:{get:()=>Mn,set:t=>{Mn=t}},rejectionMapper:{get:()=>Os,set:t=>{Os=t}},follow:(t,e)=>new R((r,n)=>Rt((i,o)=>{var s=z;s.unhandleds=[],s.onunhandled=o,s.finalize=lr(function(){Tg(()=>{this.unhandleds.length===0?i():o(this.unhandleds[0])})},s.finalize),t()},e,r,n))});Ei&&(Ei.allSettled&&bt(R,"allSettled",function(){let t=wt.apply(null,arguments).map(Mi);return new R(e=>{t.length===0&&e([]);let r=t.length,n=new Array(r);t.forEach((i,o)=>R.resolve(i).then(s=>n[o]={status:"fulfilled",value:s},s=>n[o]={status:"rejected",reason:s}).then(()=>--r||e(n)))})}),Ei.any&&typeof AggregateError!="undefined"&&bt(R,"any",function(){let t=wt.apply(null,arguments).map(Mi);return new R((e,r)=>{t.length===0&&r(new AggregateError([]));let n=t.length,i=new Array(n);t.forEach((o,s)=>R.resolve(o).then(a=>e(a),a=>{i[s]=a,--n||r(new AggregateError(i))}))})}));Ke={awaits:0,echoes:0,id:0},Ig=0,Pi=[],Rs=0,ki=0,Pg=0;(""+Ul).indexOf("[native code]")===-1&&(zr=jt=ie);tu="unhandledrejection";je=R.reject;nu="3.2.4",fr=String.fromCharCode(65535),Ns=-1/0,At="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",iu="String expected.",Bn=[],Li=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Rg=Li,Lg=Li,ou=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Ni="__dbnames",Bs="readonly",Ks="readwrite";su={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};au=class{_trans(e,r,n){let i=this._tx||z.trans,o=this.name;function s(l,u,c){if(!c.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return r(c.idbtrans,c)}let a=Ln();try{return i&&i.db===this.db?i===z.trans?i._promise(e,s,n):Rt(()=>i._promise(e,s,n),{trans:i,transless:z.transless||z}):Ls(this.db,e,[this.name],s)}finally{a&&Nn()}}get(e,r){return e&&e.constructor===Object?this.where(e).first(r):this._trans("readonly",n=>this.core.get({trans:n,key:e}).then(i=>this.hook.reading.fire(i))).then(r)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(Be(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let r=xe(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(u=>u.compound&&r.every(c=>u.keyPath.indexOf(c)>=0)&&u.keyPath.every(c=>r.indexOf(c)>=0))[0];if(n&&this.db._maxKey!==fr)return this.where(n.name).equals(n.keyPath.map(u=>e[u]));!n&&ft&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${r.join("+")}]`);let{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function s(u,c){try{return o.cmp(u,c)===0}catch{return!1}}let[a,l]=r.reduce(([u,c],d)=>{let f=i[d],h=e[d];return[u||f,u||!f?dr(c,f&&f.multi?y=>{let j=xt(y,d);return Be(j)&&j.some(v=>s(h,v))}:y=>s(h,xt(y,d))):c]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(l):n?this.filter(l):this.where(r).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,Be(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let r=n=>{if(!n)return n;let i=Object.create(e.prototype);for(var o in n)if(Je(n,o))try{i[o]=n[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=r,this.hook("reading",r),e}defineClass(){function e(r){Ve(this,r)}return this.mapToClass(e)}add(e,r){let{auto:n,keyPath:i}=this.schema.primKey,o=e;return i&&n&&(o=Bi(i)(e)),this._trans("readwrite",s=>this.core.mutate({trans:s,type:"add",keys:r!=null?[r]:null,values:[o]})).then(s=>s.numFailures?R.reject(s.failures[0]):s.lastResult).then(s=>{if(i)try{ot(e,i,s)}catch{}return s})}update(e,r){if(typeof e=="object"&&!Be(e)){let n=xt(e,this.schema.primKey.keyPath);if(n===void 0)return je(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof r!="function"?xe(r).forEach(i=>{ot(e,i,r[i])}):r(e,{value:e,primKey:n})}catch{}return this.where(":id").equals(n).modify(r)}else return this.where(":id").equals(e).modify(r)}put(e,r){let{auto:n,keyPath:i}=this.schema.primKey,o=e;return i&&n&&(o=Bi(i)(e)),this._trans("readwrite",s=>this.core.mutate({trans:s,type:"put",values:[o],keys:r!=null?[r]:null})).then(s=>s.numFailures?R.reject(s.failures[0]):s.lastResult).then(s=>{if(i)try{ot(e,i,s)}catch{}return s})}delete(e){return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:[e]})).then(r=>r.numFailures?R.reject(r.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:su})).then(e=>e.numFailures?R.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",r=>this.core.getMany({keys:e,trans:r}).then(n=>n.map(i=>this.hook.reading.fire(i))))}bulkAdd(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let o=n?n.allKeys:void 0;return this._trans("readwrite",s=>{let{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");let u=e.length,c=l&&a?e.map(Bi(l)):e;return this.core.mutate({trans:s,type:"add",keys:i,values:c,wantResults:o}).then(({numFailures:d,results:f,lastResult:h,failures:y})=>{let j=o?f:h;if(d===0)return j;throw new In(`${this.name}.bulkAdd(): ${d} of ${u} operations failed`,y)})})}bulkPut(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let o=n?n.allKeys:void 0;return this._trans("readwrite",s=>{let{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");let u=e.length,c=l&&a?e.map(Bi(l)):e;return this.core.mutate({trans:s,type:"put",keys:i,values:c,wantResults:o}).then(({numFailures:d,results:f,lastResult:h,failures:y})=>{let j=o?f:h;if(d===0)return j;throw new In(`${this.name}.bulkPut(): ${d} of ${u} operations failed`,y)})})}bulkDelete(e){let r=e.length;return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:e})).then(({numFailures:n,lastResult:i,failures:o})=>{if(n===0)return i;throw new In(`${this.name}.bulkDelete(): ${n} of ${r} operations failed`,o)})}};du=class{_read(e,r){var n=this._ctx;return n.error?n.table._trans(null,je.bind(null,n.error)):n.table._trans("readonly",e).then(r)}_write(e){var r=this._ctx;return r.error?r.table._trans(null,je.bind(null,r.error)):r.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var r=this._ctx;r.algorithm=dr(r.algorithm,e)}_iterate(e,r){return zi(this._ctx,e,r,this._ctx.table.core)}clone(e){var r=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&Ve(n,e),r._ctx=n,r}raw(){return this._ctx.valueMapper=null,this}each(e){var r=this._ctx;return this._read(n=>zi(r,e,n,r.table.core))}count(e){return this._read(r=>{let n=this._ctx,i=n.table.core;if(Vr(n,!0))return i.count({trans:r,query:{index:Ki(n,i.schema),range:n.range}}).then(s=>Math.min(s,n.limit));var o=0;return zi(n,()=>(++o,!1),r,i).then(()=>o)}).then(e)}sortBy(e,r){let n=e.split(".").reverse(),i=n[0],o=n.length-1;function s(u,c){return c?s(u[n[c]],c-1):u[i]}var a=this._ctx.dir==="next"?1:-1;function l(u,c){var d=s(u,o),f=s(c,o);return d<f?-a:d>f?a:0}return this.toArray(function(u){return u.sort(l)}).then(r)}toArray(e){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&Vr(n,!0)&&n.limit>0){let{valueMapper:i}=n,o=Ki(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:o,range:n.range}}).then(({result:s})=>i?s.map(i):s)}else{let i=[];return zi(n,o=>i.push(o),r,n.table.core).then(()=>i)}},e)}offset(e){var r=this._ctx;return e<=0?this:(r.offset+=e,Vr(r)?Hs(r,()=>{var n=e;return(i,o)=>n===0?!0:n===1?(--n,!1):(o(()=>{i.advance(n),n=0}),!1)}):Hs(r,()=>{var n=e;return()=>--n<0}),this)}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Hs(this._ctx,()=>{var r=e;return function(n,i,o){return--r<=0&&i(o),r>=0}},!0),this}until(e,r){return zs(this._ctx,function(n,i,o){return e(n.value)?(i(o),r):!0}),this}first(e){return this.limit(1).toArray(function(r){return r[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){return zs(this._ctx,function(r){return e(r.value)}),Bg(this._ctx,e),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){e(i.key,i)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){e(i.primaryKey,i)})}keys(e){var r=this._ctx;r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.key)}).then(function(){return n}).then(e)}primaryKeys(e){var r=this._ctx;if(r.dir==="next"&&Vr(r,!0)&&r.limit>0)return this._read(i=>{var o=Ki(r,r.table.core.schema);return r.table.core.query({trans:i,values:!1,limit:r.limit,query:{index:o,range:r.range}})}).then(({result:i})=>i).then(e);r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.primaryKey)}).then(function(){return n}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(r){return r[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,r=e.index&&e.table.schema.idxByName[e.index];if(!r||!r.multi)return this;var n={};return zs(this._ctx,function(i){var o=i.primaryKey.toString(),s=Je(n,o);return n[o]=!0,!s}),this}modify(e){var r=this._ctx;return this._write(n=>{var i;if(typeof e=="function")i=e;else{var o=xe(e),s=o.length;i=function(j){for(var v=!1,p=0;p<s;++p){var b=o[p],m=e[b];xt(j,b)!==m&&(ot(j,b,m),v=!0)}return v}}let a=r.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,d=[],f=0,h=[],y=(j,v)=>{let{failures:p,numFailures:b}=v;f+=j-b;for(let m of xe(p))d.push(p[m])};return this.clone().primaryKeys().then(j=>{let v=p=>{let b=Math.min(c,j.length-p);return a.getMany({trans:n,keys:j.slice(p,p+b),cache:"immutable"}).then(m=>{let g=[],x=[],_=l?[]:null,w=[];for(let E=0;E<b;++E){let D=m[E],O={value:On(D),primKey:j[p+E]};i.call(O,O.value,O)!==!1&&(O.value==null?w.push(j[p+E]):!l&&We(u(D),u(O.value))!==0?(w.push(j[p+E]),g.push(O.value)):(x.push(O.value),l&&_.push(j[p+E])))}let S=Vr(r)&&r.limit===1/0&&(typeof e!="function"||e===Vs)&&{index:r.index,range:r.range};return Promise.resolve(g.length>0&&a.mutate({trans:n,type:"add",values:g}).then(E=>{for(let D in E.failures)w.splice(parseInt(D),1);y(g.length,E)})).then(()=>(x.length>0||S&&typeof e=="object")&&a.mutate({trans:n,type:"put",keys:_,values:x,criteria:S,changeSpec:typeof e!="function"&&e}).then(E=>y(x.length,E))).then(()=>(w.length>0||S&&e===Vs)&&a.mutate({trans:n,type:"delete",keys:w,criteria:S}).then(E=>y(w.length,E))).then(()=>j.length>p+b&&v(p+c))})};return v(0).then(()=>{if(d.length>0)throw new Ai("Error modifying one or more objects",d,f,h);return j.length})})})}delete(){var e=this._ctx,r=e.range;return Vr(e)&&(e.isPrimKey&&!Lg||r.type===3)?this._write(n=>{let{primaryKey:i}=e.table.core.schema,o=r;return e.table.core.count({trans:n,query:{index:i,range:o}}).then(s=>e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(({failures:a,lastResult:l,results:u,numFailures:c})=>{if(c)throw new Ai("Could not delete some values",Object.keys(a).map(d=>a[d]),s-c);return s-c}))}):this.modify(Vs)}},Vs=(t,e)=>e.value=null;Ws=class{get Collection(){return this._ctx.table.db.Collection}between(e,r,n,i){n=n!==!1,i=i===!0;try{return this._cmp(e,r)>0||this._cmp(e,r)===0&&(n||i)&&!(n&&i)?Wr(this):new this.Collection(this,()=>Nt(e,r,!n,!i))}catch{return Xe(this,At)}}equals(e){return e==null?Xe(this,At):new this.Collection(this,()=>pu(e))}above(e){return e==null?Xe(this,At):new this.Collection(this,()=>Nt(e,void 0,!0))}aboveOrEqual(e){return e==null?Xe(this,At):new this.Collection(this,()=>Nt(e,void 0,!1))}below(e){return e==null?Xe(this,At):new this.Collection(this,()=>Nt(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Xe(this,At):new this.Collection(this,()=>Nt(void 0,e))}startsWith(e){return typeof e!="string"?Xe(this,iu):this.between(e,e+fr,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):Hi(this,(r,n)=>r.indexOf(n[0])===0,[e],fr)}equalsIgnoreCase(e){return Hi(this,(r,n)=>r===n[0],[e],"")}anyOfIgnoreCase(){var e=wt.apply(Nr,arguments);return e.length===0?Wr(this):Hi(this,(r,n)=>n.indexOf(r)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=wt.apply(Nr,arguments);return e.length===0?Wr(this):Hi(this,(r,n)=>n.some(i=>r.indexOf(i)===0),e,fr)}anyOf(){let e=wt.apply(Nr,arguments),r=this._cmp;try{e.sort(r)}catch{return Xe(this,At)}if(e.length===0)return Wr(this);let n=new this.Collection(this,()=>Nt(e[0],e[e.length-1]));n._ondirectionchange=o=>{r=o==="next"?this._ascending:this._descending,e.sort(r)};let i=0;return n._addAlgorithm((o,s,a)=>{let l=o.key;for(;r(l,e[i])>0;)if(++i,i===e.length)return s(a),!1;return r(l,e[i])===0?!0:(s(()=>{o.continue(e[i])}),!1)}),n}notEqual(e){return this.inAnyRange([[Ns,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=wt.apply(Nr,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Xe(this,At)}let r=e.reduce((n,i)=>n?n.concat([[n[n.length-1][1],i]]):[[Ns,i]],null);return r.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(r,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,r){let n=this._cmp,i=this._ascending,o=this._descending,s=this._min,a=this._max;if(e.length===0)return Wr(this);if(!e.every(g=>g[0]!==void 0&&g[1]!==void 0&&i(g[0],g[1])<=0))return Xe(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);let l=!r||r.includeLowers!==!1,u=r&&r.includeUppers===!0;function c(g,x){let _=0,w=g.length;for(;_<w;++_){let S=g[_];if(n(x[0],S[1])<0&&n(x[1],S[0])>0){S[0]=s(S[0],x[0]),S[1]=a(S[1],x[1]);break}}return _===w&&g.push(x),g}let d=i;function f(g,x){return d(g[0],x[0])}let h;try{h=e.reduce(c,[]),h.sort(f)}catch{return Xe(this,At)}let y=0,j=u?g=>i(g,h[y][1])>0:g=>i(g,h[y][1])>=0,v=l?g=>o(g,h[y][0])>0:g=>o(g,h[y][0])>=0;function p(g){return!j(g)&&!v(g)}let b=j,m=new this.Collection(this,()=>Nt(h[0][0],h[h.length-1][1],!l,!u));return m._ondirectionchange=g=>{g==="next"?(b=j,d=i):(b=v,d=o),h.sort(f)},m._addAlgorithm((g,x,_)=>{for(var w=g.key;b(w);)if(++y,y===h.length)return x(_),!1;return p(w)?!0:(this._cmp(w,h[y][1])===0||this._cmp(w,h[y][0])===0||x(()=>{d===i?g.continue(h[y][0]):g.continue(h[y][1])}),!1)}),m}startsWithAnyOf(){let e=wt.apply(Nr,arguments);return e.every(r=>typeof r=="string")?e.length===0?Wr(this):this.inAnyRange(e.map(r=>[r,r+fr])):Xe(this,"startsWithAnyOf() only works with strings")}};Vn="storagemutated",Bt="x-storagemutated-1",Kt=Kn(null,Vn),hu=class{_lock(){return Dn(!z.global),++this._reculock,this._reculock===1&&!z.global&&(z.lockOwnerFor=this),this}_unlock(){if(Dn(!z.global),--this._reculock==0)for(z.global||(z.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Hr(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&z.lockOwnerFor!==this}create(e){if(!this.mode)return this;let r=this.db.idbdb,n=this.db._state.dbOpenError;if(Dn(!this.idbtrans),!e&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new V.DatabaseClosed(n);case"MissingAPIError":throw new V.MissingAPI(n.message,n);default:throw new V.OpenFailed(n)}if(!this.active)throw new V.TransactionInactive;return Dn(this._completion._state===null),e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),e.onerror=pe(i=>{Hn(i),this._reject(e.error)}),e.onabort=pe(i=>{Hn(i),this.active&&this._reject(new V.Abort(e.error)),this.active=!1,this.on("abort").fire(i)}),e.oncomplete=pe(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&Kt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,r,n){if(e==="readwrite"&&this.mode!=="readwrite")return je(new V.ReadOnly("Transaction is readonly"));if(!this.active)return je(new V.TransactionInactive);if(this._locked())return new R((o,s)=>{this._blockedFuncs.push([()=>{this._promise(e,r,n).then(o,s)},z])});if(n)return Rt(()=>{var o=new R((s,a)=>{this._lock();let l=r(s,a,this);l&&l.then&&l.then(s,a)});return o.finally(()=>this._unlock()),o._lib=!0,o});var i=new R((o,s)=>{var a=r(o,s,this);a&&a.then&&a.then(o,s)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(e){var r=this._root();let n=R.resolve(e);if(r._waitingFor)r._waitingFor=r._waitingFor.then(()=>n);else{r._waitingFor=n,r._waitingQueue=[];var i=r.idbtrans.objectStore(r.storeNames[0]);(function s(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(i.get(-1/0).onsuccess=s)})()}var o=r._waitingFor;return new R((s,a)=>{n.then(l=>r._waitingQueue.push(pe(s.bind(null,l))),l=>r._waitingQueue.push(pe(a.bind(null,l)))).finally(()=>{r._waitingFor===o&&(r._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))}table(e){let r=this._memoizedTables||(this._memoizedTables={});if(Je(r,e))return r[e];let n=this.schema[e];if(!n)throw new V.NotFound("Table "+e+" not part of transaction");let i=new this.db.Table(e,n,this);return i.core=this.db.core.table(e),r[e]=i,i}};Wn=t=>{try{return t.only([[]]),Wn=()=>[[]],[[]]}catch{return Wn=()=>fr,fr}};Xg=0;vu=class{_parseStoresSpec(e,r){xe(e).forEach(n=>{if(e[n]!==null){var i=uy(e[n]),o=i.shift();if(o.multi)throw new V.Schema("Primary key cannot be multi-valued");i.forEach(s=>{if(s.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!s.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")}),r[n]=gu(n,o,i)}})}stores(e){let r=this.db;this._cfg.storesSource=this._cfg.storesSource?Ve(this._cfg.storesSource,e):e;let n=r._versions,i={},o={};return n.forEach(s=>{Ve(i,s._cfg.storesSource),o=s._cfg.dbschema={},s._parseStoresSpec(i,o)}),r._dbSchema=o,Qs(r,[r._allTables,r,r.Transaction.prototype]),Vi(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],xe(o),o),r._storeNames=xe(o),this}upgrade(e){return this._cfg.contentUpgrade=As(this._cfg.contentUpgrade||ie,e),this}};_y={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:yy};by={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>ze(ye({},t),{table(e){let r=t.table(e),{primaryKey:n}=r.schema;return ze(ye({},r),{mutate(o){let s=z.trans,{deleting:a,creating:l,updating:u}=s.table(e).hook;switch(o.type){case"add":if(l.fire===ie)break;return s._promise("readwrite",()=>c(o),!0);case"put":if(l.fire===ie&&u.fire===ie)break;return s._promise("readwrite",()=>c(o),!0);case"delete":if(a.fire===ie)break;return s._promise("readwrite",()=>c(o),!0);case"deleteRange":if(a.fire===ie)break;return s._promise("readwrite",()=>d(o),!0)}return r.mutate(o);function c(h){let y=z.trans,j=h.keys||vy(n,h);if(!j)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?ze(ye({},h),{keys:j}):ye({},h),h.type!=="delete"&&(h.values=[...h.values]),h.keys&&(h.keys=[...h.keys]),xy(r,h,j).then(v=>{let p=j.map((b,m)=>{let g=v[m],x={onerror:null,onsuccess:null};if(h.type==="delete")a.fire.call(x,b,g,y);else if(h.type==="add"||g===void 0){let _=l.fire.call(x,b,h.values[m],y);b==null&&_!=null&&(b=_,h.keys[m]=b,n.outbound||ot(h.values[m],n.keyPath,b))}else{let _=na(g,h.values[m]),w=u.fire.call(x,_,b,g,y);if(w){let S=h.values[m];Object.keys(w).forEach(E=>{Je(S,E)?S[E]=w[E]:ot(S,E,w[E])})}}return x});return r.mutate(h).then(({failures:b,results:m,numFailures:g,lastResult:x})=>{for(let _=0;_<j.length;++_){let w=m?m[_]:j[_],S=p[_];w==null?S.onerror&&S.onerror(b[_]):S.onsuccess&&S.onsuccess(h.type==="put"&&v[_]?h.values[_]:w)}return{failures:b,results:m,numFailures:g,lastResult:x}}).catch(b=>(p.forEach(m=>m.onerror&&m.onerror(b)),Promise.reject(b)))})}function d(h){return f(h.trans,h.range,1e4)}function f(h,y,j){return r.query({trans:h,values:!1,query:{index:n,range:y},limit:j}).then(({result:v})=>c({type:"delete",keys:v,trans:h}).then(p=>p.numFailures>0?Promise.reject(p.failures[0]):v.length<j?{failures:[],numFailures:0,lastResult:void 0}:f(h,ze(ye({},y),{lower:v[v.length-1],lowerOpen:!0}),j)))}}})}})};wy={stack:"dbcore",level:-1,create:t=>({table:e=>{let r=t.table(e);return ze(ye({},r),{getMany:n=>{if(!n.cache)return r.getMany(n);let i=xu(n.keys,n.trans._cache,n.cache==="clone");return i?R.resolve(i):r.getMany(n).then(o=>(n.trans._cache={keys:n.keys,values:n.cache==="clone"?On(o):o},o))},mutate:n=>(n.type!=="add"&&(n.trans._cache=null),r.mutate(n))})}})};St=function(t,e){if(this)Ve(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0});else{let r=new St;return t&&"d"in t&&Ve(r,t),r}};Rr(St.prototype,{add(t){return $i(this,t),this},addKey(t){return Un(this,t,t),this},addKeys(t){return t.forEach(e=>Un(this,e,e)),this},[vs](){return oa(this)}});Ay={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,r=new St(t.MIN_KEY,t.MAX_KEY);return ze(ye({},t),{table:n=>{let i=t.table(n),{schema:o}=i,{primaryKey:s}=o,{extractKey:a,outbound:l}=s,u=ze(ye({},i),{mutate:f=>{let h=f.trans,y=h.mutatedParts||(h.mutatedParts={}),j=_=>{let w=`idb://${e}/${n}/${_}`;return y[w]||(y[w]=new St)},v=j(""),p=j(":dels"),{type:b}=f,[m,g]=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],x=f.trans._cache;return i.mutate(f).then(_=>{if(Be(m)){b!=="delete"&&(m=_.results),v.addKeys(m);let w=xu(m,x);!w&&b!=="add"&&p.addKeys(m),(w||g)&&Sy(j,o,w,g)}else if(m){let w={from:m.lower,to:m.upper};p.add(w),v.add(w)}else v.add(r),p.add(r),o.indexes.forEach(w=>j(w.name).add(r));return _})}}),c=({query:{index:f,range:h}})=>{var y,j;return[f,new St((y=h.lower)!==null&&y!==void 0?y:t.MIN_KEY,(j=h.upper)!==null&&j!==void 0?j:t.MAX_KEY)]},d={get:f=>[s,new St(f.key)],getMany:f=>[s,new St().addKeys(f.keys)],count:c,query:c,openCursor:c};return xe(d).forEach(f=>{u[f]=function(h){let{subscr:y}=z;if(y){let j=g=>{let x=`idb://${e}/${n}/${g}`;return y[x]||(y[x]=new St)},v=j(""),p=j(":dels"),[b,m]=d[f](h);if(j(b.name||"").add(m),!b.isPrimaryKey)if(f==="count")p.add(r);else{let g=f==="query"&&l&&h.values&&i.query(ze(ye({},h),{values:!1}));return i[f].apply(this,arguments).then(x=>{if(f==="query"){if(l&&h.values)return g.then(({result:w})=>(v.addKeys(w),x));let _=h.values?x.result.map(a):x.result;h.values?v.addKeys(_):p.addKeys(_)}else if(f==="openCursor"){let _=x,w=h.values;return _&&Object.create(_,{key:{get(){return p.addKey(_.primaryKey),_.key}},primaryKey:{get(){let S=_.primaryKey;return p.addKey(S),S}},value:{get(){return w&&v.addKey(_.primaryKey),_.value}}})}return x})}}return i[f].apply(this,arguments)}}),u}})}};Ct=class{constructor(e,r){this._middlewares={},this.verno=0;let n=Ct.dependencies;this._options=r=ye({addons:Ct.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};let{addons:i}=r;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;let o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ie,dbReadyPromise:null,cancelOpen:ie,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};o.dbReadyPromise=new R(s=>{o.dbReadyResolve=s}),o.openCanceller=new R((s,a)=>{o.cancelOpen=a}),this._state=o,this.name=e,this.on=Kn(this,"populate","blocked","versionchange","close",{ready:[As,ie]}),this.on.ready.subscribe=kl(this.on.ready.subscribe,s=>(a,l)=>{Ct.vip(()=>{let u=this._state;if(u.openComplete)u.dbOpenError||R.resolve().then(a),l&&s(a);else if(u.onReadyBeingFired)u.onReadyBeingFired.push(a),l&&s(a);else{s(a);let c=this;l||s(function d(){c.on.ready.unsubscribe(a),c.on.ready.unsubscribe(d)})}})}),this.Collection=Hg(this),this.Table=Ng(this),this.Transaction=qg(this),this.Version=cy(this),this.WhereClause=Qg(this),this.on("versionchange",s=>{s.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",s=>{!s.newVersion||s.newVersion<s.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${s.oldVersion/10}`)}),this._maxKey=Wn(r.IDBKeyRange),this._createTransaction=(s,a,l,u)=>new this.Transaction(s,a,l,this._options.chromeTransactionDurability,u),this._fireOnBlocked=s=>{this.on("blocked").fire(s),Bn.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(s))},this.use(_y),this.use(by),this.use(Ay),this.use(wy),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(s=>s(this))}version(e){if(isNaN(e)||e<.1)throw new V.Type("Given version is not a positive number");if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let r=this._versions;var n=r.filter(i=>i._cfg.version===e)[0];return n||(n=new this.Version(e),r.push(n),r.sort(ry),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||z.letThrough||this._vip)?e():new R((r,n)=>{if(this._state.openComplete)return n(new V.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen){n(new V.DatabaseClosed);return}this.open().catch(ie)}this._state.dbReadyPromise.then(r,n)}).then(e)}use({stack:e,create:r,level:n,name:i}){i&&this.unuse({stack:e,name:i});let o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:r,level:n??10,name:i}),o.sort((s,a)=>s.level-a.level),this}unuse({stack:e,name:r,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(i=>n?i.create!==n:r?i.name!==r:!1)),this}open(){return my(this)}_close(){let e=this._state,r=Bn.indexOf(this);if(r>=0&&Bn.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new R(n=>{e.dbReadyResolve=n}),e.openCanceller=new R((n,i)=>{e.cancelOpen=i})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new V.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,r=this._state;return new R((n,i)=>{let o=()=>{this.close();var s=this._deps.indexedDB.deleteDatabase(this.name);s.onsuccess=pe(()=>{py(this._deps,this.name),n()}),s.onerror=dt(i),s.onblocked=this._fireOnBlocked};if(e)throw new V.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(o):o()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){let e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return xe(this._allTables).map(e=>this._allTables[e])}transaction(){let e=gy.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,r,n){let i=z.trans;(!i||i.db!==this||e.indexOf("!")!==-1)&&(i=null);let o=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");let s,a;try{if(a=r.map(u=>{var c=u instanceof this.Table?u.name:u;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),e=="r"||e===Bs)s=Bs;else if(e=="rw"||e==Ks)s=Ks;else throw new V.InvalidArgument("Invalid transaction mode: "+e);if(i){if(i.mode===Bs&&s===Ks)if(o)i=null;else throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i&&a.forEach(u=>{if(i&&i.storeNames.indexOf(u)===-1)if(o)i=null;else throw new V.SubTransaction("Table "+u+" not included in parent transaction.")}),o&&i&&!i.active&&(i=null)}}catch(u){return i?i._promise(null,(c,d)=>{d(u)}):je(u)}let l=bu.bind(null,this,s,a,i,n);return i?i._promise(s,l,"lock"):z.trans?Hr(z.transless,()=>this._whenReady(l)):this._whenReady(l)}table(e){if(!Je(this._allTables,e))throw new V.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},Cy=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",Au=class{constructor(e){this._subscribe=e}subscribe(e,r,n){return this._subscribe(!e||typeof e=="function"?{next:e,error:r,complete:n}:e)}[Cy](){return this}};try{sa={indexedDB:ce.indexedDB||ce.mozIndexedDB||ce.webkitIndexedDB||ce.msIndexedDB,IDBKeyRange:ce.IDBKeyRange||ce.webkitIDBKeyRange}}catch{sa={indexedDB:null,IDBKeyRange:null}}pr=Ct;Rr(pr,ze(ye({},Si),{delete(t){return new pr(t,{addons:[]}).delete()},exists(t){return new pr(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return fy(pr.dependencies).then(t)}catch{return je(new V.MissingAPI)}},defineClass(){function t(e){Ve(this,e)}return t},ignoreTransaction(t){return z.trans?Hr(z.transless,t):t()},vip:ta,async:function(t){return function(){try{var e=ra(t.apply(this,arguments));return!e||typeof e.then!="function"?R.resolve(e):e}catch(r){return je(r)}}},spawn:function(t,e,r){try{var n=ra(t.apply(r,e||[]));return!n||typeof n.then!="function"?R.resolve(n):n}catch(i){return je(i)}},currentTransaction:{get:()=>z.trans||null},waitFor:function(t,e){let r=R.resolve(typeof t=="function"?pr.ignoreTransaction(t):t).timeout(e||6e4);return z.trans?z.trans.waitFor(r):r},Promise:R,debug:{get:()=>ft,set:t=>{Kl(t,t==="dexie"?()=>!0:ou)}},derive:Lr,extend:Ve,props:Rr,override:kl,Events:Kn,on:Kt,liveQuery:Ey,extendObservabilitySet:Su,getByKeyPath:xt,setByKeyPath:ot,delByKeyPath:cg,shallowClone:Ll,deepClone:On,getObjectDiff:na,cmp:We,asap:Ml,minKey:Ns,addons:[],connections:Bn,errnames:js,dependencies:sa,semVer:nu,version:nu.split(".").map(t=>parseInt(t)).reduce((t,e,r)=>t+e/Math.pow(10,r*2))}));pr.maxKey=Wn(pr.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(Kt(Vn,t=>{if(!Et){let e;Li?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Bt,!0,!0,t)):e=new CustomEvent(Bt,{detail:t}),Et=!0,dispatchEvent(e),Et=!1}}),addEventListener(Bt,({detail:t})=>{Et||Ui(t)}));Et=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(Bt);typeof t.unref=="function"&&t.unref(),Kt(Vn,e=>{Et||t.postMessage(e)}),t.onmessage=e=>{e.data&&Ui(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){Kt(Vn,e=>{try{Et||(typeof localStorage!="undefined"&&localStorage.setItem(Bt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(r=>r.postMessage({type:Bt,changedParts:e})))}catch{}}),typeof addEventListener!="undefined"&&addEventListener("storage",e=>{if(e.key===Bt){let r=JSON.parse(e.newValue);r&&Ui(r.changedParts)}});let t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",Fy)}R.rejectionMapper=vg;Kl(ft,ou)});var Eu,pt,$r,Ae,Gi=A(()=>{Cu();Eu=ve(require("obsidian")),pt=class extends Ct{constructor(){super(pt.dbName);this.version(pt.dbVersion).stores({searchHistory:"++id",minisearch:"date"})}static async clearOldDatabases(){let e=(await indexedDB.databases()).filter(r=>r.name===pt.dbName&&r.version!==pt.dbVersion*10);if(e.length){console.log("Omnisearch - Those IndexedDb databases will be deleted:");for(let r of e)r.name&&indexedDB.deleteDatabase(r.name)}}static getInstance(){return pt.instance||(pt.instance=new pt),pt.instance}async clearCache(){new Eu.Notice("Omnisearch - Cache cleared. Please restart Obsidian."),await this.minisearch.clear()}},$r=pt;$r.dbVersion=8,$r.dbName="omnisearch/cache/"+app.appId;Ae=$r.getInstance()});async function Fu(t){T=Object.assign({},zt,await t.loadData()),hr.set(T.showExcerpt)}async function oe(t){await t.saveData(T)}function la(){return app.loadLocalStorage(Gn)==="1"}function Tu(){return T.unsupportedFilesIndexing==="yes"||T.unsupportedFilesIndexing==="default"&&!!app.vault.getConfig("showUnsupportedFiles")}var $,hr,Qi,aa,zt,T,et=A(()=>{$=ve(require("obsidian"));ms();Gi();st();hr=wi(!1),Qi='<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>',aa=class extends $.PluginSettingTab{constructor(e){super(e.app,e);this.plugin=e,hr.subscribe(async r=>{T.showExcerpt=r,await oe(this.plugin)})}display(){let{containerEl:e}=this;if(e.empty(),this.app.loadLocalStorage(Gn)=="1"){let h=e.createEl("span");h.innerHTML='<strong style="color: var(--text-accent)">\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F</strong>'}e.createEl("h2",{text:"Omnisearch"});let r=e.createDiv();r.innerHTML=`
<iframe src="https://github.com/sponsors/scambier/button" title="Sponsor scambier" height="35" width="116" style="border: 0;"></iframe>
<a href='https://ko-fi.com/B0B6LQ2C' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
`;let n=new DocumentFragment;n.createSpan({},h=>{h.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/>',Ge()?h.innerHTML+=`
\u{1F44D} You have installed <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a>, Omnisearch can use it to index PDFs and images contents.
<br />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:h.innerHTML+='\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}),new $.Setting(e).setName("Indexing").setHeading().setDesc(n);let i=new DocumentFragment;i.createSpan({},h=>{h.innerHTML="Omnisearch will use Text Extractor to index the content of your PDFs"}),new $.Setting(e).setName(`PDFs content indexing ${Ge()?"":"\u26A0\uFE0F Disabled"}`).setDesc(i).addToggle(h=>h.setValue(T.PDFIndexing).onChange(async y=>{await Ae.clearCache(),T.PDFIndexing=y,await oe(this.plugin)})).setDisabled(!Ge());let o=new DocumentFragment;o.createSpan({},h=>{h.innerHTML="Omnisearch will use Text Extractor to OCR your images and index their content"}),new $.Setting(e).setName(`Images OCR indexing ${Ge()?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(h=>h.setValue(T.imagesIndexing).onChange(async y=>{await Ae.clearCache(),T.imagesIndexing=y,await oe(this.plugin)})).setDisabled(!Ge());let s=new DocumentFragment;s.createSpan({},h=>{h.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 $.Setting(e).setName(`Documents content indexing ${Ge()?"":"\u26A0\uFE0F Disabled"}`).setDesc(s).addToggle(h=>h.setValue(T.officeIndexing).onChange(async y=>{await Ae.clearCache(),T.officeIndexing=y,await oe(this.plugin)})).setDisabled(!Ge());let a=new DocumentFragment;a.createSpan({},h=>{h.innerHTML=`
Omnisearch can index file<strong>names</strong> of "unsupported" files, such as e.g. <pre style="display:inline">.mp4</pre>
or non-extracted PDFs & images.<br/>
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions"`}),new $.Setting(e).setName("Index paths of unsupported files").setDesc(a).addDropdown(h=>{h.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(T.unsupportedFilesIndexing).onChange(async y=>{await Ae.clearCache(),T.unsupportedFilesIndexing=y,await oe(this.plugin)})});let l=new DocumentFragment;l.createSpan({},h=>{h.innerHTML=`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">PLAINTEXT</strong> files.<br/>
Add extensions separated by a space, without the dot. Example: "<code>txt org csv</code>".<br />
\u26A0\uFE0F <span style="color: var(--text-accent)">Using extensions of non-plaintext files (like .pptx) WILL cause crashes,
because Omnisearch will try to index their content.</span>`}),new $.Setting(e).setName("Additional TEXT files to index").setDesc(l).addText(h=>{h.setValue(T.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async y=>{await Ae.clearCache(),T.indexedFileTypes=y.split(" "),await oe(this.plugin)})}),new $.Setting(e).setName("Behavior").setHeading(),new $.Setting(e).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(h=>h.setValue(T.useCache).onChange(async y=>{T.useCache=y,await oe(this.plugin)})),new $.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(h=>h.setValue(T.showPreviousQueryResults).onChange(async y=>{T.showPreviousQueryResults=y,await oe(this.plugin)})),new $.Setting(e).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(h=>h.setValue(T.hideExcluded).onChange(async y=>{T.hideExcluded=y,await oe(this.plugin)}));let u=new DocumentFragment;u.createSpan({},h=>{h.innerHTML=`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
${Qi}
`}),new $.Setting(e).setName("Split CamelCaseWords").setDesc(u).addToggle(h=>h.setValue(T.splitCamelCase).onChange(async y=>{await Ae.clearCache(),T.splitCamelCase=y,await oe(this.plugin)})),new $.Setting(e).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(h=>h.setValue(T.simpleSearch).onChange(async y=>{T.simpleSearch=y,await oe(this.plugin)})),new $.Setting(e).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(h=>h.setValue(T.openInNewPane).onChange(async y=>{T.openInNewPane=y,await oe(this.plugin)})),new $.Setting(e).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(h=>h.setValue(T.vimLikeNavigationShortcut).onChange(async y=>{T.vimLikeNavigationShortcut=y,await oe(this.plugin)})),new $.Setting(e).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(h=>h.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(T.fuzziness).onChange(async y=>{["0","1","2"].includes(y)||(y="2"),T.fuzziness=y,await oe(this.plugin)})),new $.Setting(e).setName("User Interface").setHeading(),new $.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(h=>h.setValue(T.ribbonIcon).onChange(async y=>{T.ribbonIcon=y,await oe(this.plugin),y?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new $.Setting(e).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(h=>h.setValue(T.showExcerpt).onChange(async y=>{hr.set(y)})),new $.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(h=>h.setValue(T.renderLineReturnInExcerpts).onChange(async y=>{T.renderLineReturnInExcerpts=y,await oe(this.plugin)}));let c=new DocumentFragment;if(c.createSpan({},h=>{h.innerHTML=`Shows a button next to the search input, to create a note.
Acts the same as the <code>shift \u21B5</code> shortcut, can be useful for mobile device users.`}),new $.Setting(e).setName('Show "Create note" button').setDesc(c).addToggle(h=>h.setValue(T.showCreateButton).onChange(async y=>{T.showCreateButton=y,await oe(this.plugin)})),new $.Setting(e).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(h=>h.setValue(T.highlight).onChange(async y=>{T.highlight=y,await oe(this.plugin)})),new $.Setting(e).setName("Results weighting").setHeading(),new $.Setting(e).setName(`File name & declared aliases (default: ${zt.weightBasename})`).addSlider(h=>this.weightSlider(h,"weightBasename")),new $.Setting(e).setName(`File directory (default: ${zt.weightDirectory})`).addSlider(h=>this.weightSlider(h,"weightDirectory")),new $.Setting(e).setName(`Headings level 1 (default: ${zt.weightH1})`).addSlider(h=>this.weightSlider(h,"weightH1")),new $.Setting(e).setName(`Headings level 2 (default: ${zt.weightH2})`).addSlider(h=>this.weightSlider(h,"weightH2")),new $.Setting(e).setName(`Headings level 3 (default: ${zt.weightH3})`).addSlider(h=>this.weightSlider(h,"weightH3")),new $.Setting(e).setName(`Tags without the # (default: ${zt.weightUnmarkedTags})`).addSlider(h=>this.weightSlider(h,"weightUnmarkedTags")),!$.Platform.isMobile){let h=new DocumentFragment;h.createSpan({},y=>{y.innerHTML='Omnisearch can be used through a simple HTTP server (<a href="https://publish.obsidian.md/omnisearch/Public+API+%26+URL+Scheme#HTTP+Server">more information</a>).'}),new $.Setting(e).setName("API Access Through HTTP").setHeading().setDesc(h),new $.Setting(e).setName("Enable the HTTP server").addToggle(y=>y.setValue(T.httpApiEnabled).onChange(async j=>{T.httpApiEnabled=j,j?this.plugin.apiHttpServer.listen(T.httpApiPort):this.plugin.apiHttpServer.close(),await oe(this.plugin)})),new $.Setting(e).setName("HTTP Port").addText(y=>{y.setValue(T.httpApiPort).setPlaceholder("51361").onChange(async j=>{parseInt(j)>65535&&(j=T.httpApiPort,y.setValue(T.httpApiPort)),T.httpApiPort=j,T.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(T.httpApiPort)),await oe(this.plugin)})}),new $.Setting(e).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(y=>y.setValue(T.httpApiNotice).onChange(async j=>{T.httpApiNotice=j,await oe(this.plugin)}))}new $.Setting(e).setName("Debugging").setHeading(),new $.Setting(e).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(h=>h.setValue(T.verboseLogging).onChange(async y=>{T.verboseLogging=y,await oe(this.plugin)})),new $.Setting(e).setName("Danger Zone").setHeading();let d=new DocumentFragment;d.createSpan({},h=>{h.innerHTML=`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
${Qi}
`}),new $.Setting(e).setName("Ignore diacritics").setDesc(d).addToggle(h=>h.setValue(T.ignoreDiacritics).onChange(async y=>{await Ae.clearCache(),T.ignoreDiacritics=y,await oe(this.plugin)}));let f=new DocumentFragment;if(f.createSpan({},h=>{h.innerHTML=`Disable Omnisearch on this device only.<br>
${Qi}`}),new $.Setting(e).setName("Disable on this device").setDesc(f).addToggle(h=>h.setValue(la()).onChange(async y=>{y?this.app.saveLocalStorage(Gn,"1"):this.app.saveLocalStorage(Gn),new $.Notice("Omnisearch - Disabled. Please restart Obsidian.")})),Ft()){let h=new DocumentFragment;h.createSpan({},y=>{y.innerHTML=`Erase all Omnisearch cache data.
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
${Qi}`}),new $.Setting(e).setName("Clear cache data").setDesc(h).addButton(y=>{y.setButtonText("Clear cache"),y.onClick(async()=>{await Ae.clearCache()})})}}weightSlider(e,r){e.setLimits(1,5,.1).setValue(T[r]).setDynamicTooltip().onChange(async n=>{T[r]=n,await oe(this.plugin)})}},zt={useCache:!0,hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!1,officeIndexing:!1,imagesIndexing:!1,unsupportedFilesIndexing:"no",splitCamelCase:!1,openInNewPane:!1,vimLikeNavigationShortcut:app.vault.getConfig("vimMode"),ribbonIcon:!0,showExcerpt:!0,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,fuzziness:"1",weightBasename:3,weightDirectory:2,weightH1:1.5,weightH2:1.3,weightH3:1.1,weightUnmarkedTags:1.1,httpApiEnabled:!1,httpApiPort:"51361",httpApiNotice:!0,welcomeMessage:"",verboseLogging:!1},T=Object.assign({},zt)});function ca(t){Pu=t}function fa(){return Pu}function da(){return app.plugins.plugins["cm-chs-patch"]}function Ge(){return app.plugins?.plugins?.["text-extractor"]?.api}function Ft(){return!Du.Platform.isIosApp&&T.useCache}var Du,ua,Ou,Qn,Iu,Gn,Q,qi,tt,re,Ht,Pu,pa,qn,ku,st=A(()=>{Il();ms();et();Du=ve(require("obsidian")),ua=/[\u4e00-\u9fa5]/,Ou=100,Qn=300,Iu=`suggestion-highlight omnisearch-highlight ${T.highlight?"omnisearch-default-highlight":""}`,Gn="omnisearch-disabled",Q=new hs,qi={ToggleExcerpts:"toggle-excerpts"},tt=(o=>(o[o.Done=0]="Done",o[o.LoadingCache=1]="LoadingCache",o[o.ReadingFiles=2]="ReadingFiles",o[o.IndexingFiles=3]="IndexingFiles",o[o.WritingCache=4]="WritingCache",o))(tt||{}),re=(c=>(c.Enter="enter",c.OpenInBackground="open-in-background",c.CreateNote="create-note",c.OpenInNewPane="open-in-new-pane",c.InsertLink="insert-link",c.Tab="tab",c.ArrowUp="arrow-up",c.ArrowDown="arrow-down",c.PrevSearchHistory="prev-search-history",c.NextSearchHistory="next-search-history",c))(re||{}),Ht=wi(0),Pu=!1;pa=/[|\t\n\r\^"= -#%-*,.`\/<>:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/.toString().slice(1,-1),qn=new RegExp(`${pa}+`,"u"),ku=/[|\[\]\(\)<>\{\} \t\n\r]/u});var Mu=gi((Yn,ha)=>{(function(t,e){if(typeof Yn=="object"&&typeof ha=="object")ha.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r=e();for(var n in r)(typeof Yn=="object"?Yn:t)[n]=r[n]}})(typeof self!="undefined"?self:Yn,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(n,i,o){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:o})},r.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,i){if(1&i&&(n=r(n)),8&i||4&i&&typeof n=="object"&&n&&n.__esModule)return n;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&i&&typeof n!="string")for(var s in n)r.d(o,s,function(a){return n[a]}.bind(null,s));return o},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"md5",function(){return j});var n="0123456789abcdef".split(""),i=function(v){for(var p="",b=0;b<4;b++)p+=n[v>>8*b+4&15]+n[v>>8*b&15];return p},o=function(v){for(var p=v.length,b=0;b<p;b++)v[b]=i(v[b]);return v.join("")},s=function(v,p){return v+p&4294967295},a=function(v,p,b,m,g,x,_){return function(w,S,E){return s(w<<S|w>>>32-S,E)}(p=function(w,S,E,D){return S=s(s(S,w),s(E,D))}(v,p,m,x),g,b)},l=function(v,p,b,m,g,x,_,w){return a(b&m|~b&g,p,b,x,_,w,v)},u=function(v,p,b,m,g,x,_,w){return a(b&g|m&~g,p,b,x,_,w,v)},c=function(v,p,b,m,g,x,_,w){return a(b^m^g,p,b,x,_,w,v)},d=function(v,p,b,m,g,x,_,w){return a(m^(b|~g),p,b,x,_,w,v)},f=function(v,p,b){b===void 0&&(b=s);var m=v[0],g=v[1],x=v[2],_=v[3],w=l.bind(null,b);m=w(m,g,x,_,p[0],7,-680876936),_=w(_,m,g,x,p[1],12,-389564586),x=w(x,_,m,g,p[2],17,606105819),g=w(g,x,_,m,p[3],22,-1044525330),m=w(m,g,x,_,p[4],7,-176418897),_=w(_,m,g,x,p[5],12,1200080426),x=w(x,_,m,g,p[6],17,-1473231341),g=w(g,x,_,m,p[7],22,-45705983),m=w(m,g,x,_,p[8],7,1770035416),_=w(_,m,g,x,p[9],12,-1958414417),x=w(x,_,m,g,p[10],17,-42063),g=w(g,x,_,m,p[11],22,-1990404162),m=w(m,g,x,_,p[12],7,1804603682),_=w(_,m,g,x,p[13],12,-40341101),x=w(x,_,m,g,p[14],17,-1502002290),g=w(g,x,_,m,p[15],22,1236535329);var S=u.bind(null,b);m=S(m,g,x,_,p[1],5,-165796510),_=S(_,m,g,x,p[6],9,-1069501632),x=S(x,_,m,g,p[11],14,643717713),g=S(g,x,_,m,p[0],20,-373897302),m=S(m,g,x,_,p[5],5,-701558691),_=S(_,m,g,x,p[10],9,38016083),x=S(x,_,m,g,p[15],14,-660478335),g=S(g,x,_,m,p[4],20,-405537848),m=S(m,g,x,_,p[9],5,568446438),_=S(_,m,g,x,p[14],9,-1019803690),x=S(x,_,m,g,p[3],14,-187363961),g=S(g,x,_,m,p[8],20,1163531501),m=S(m,g,x,_,p[13],5,-1444681467),_=S(_,m,g,x,p[2],9,-51403784),x=S(x,_,m,g,p[7],14,1735328473),g=S(g,x,_,m,p[12],20,-1926607734);var E=c.bind(null,b);m=E(m,g,x,_,p[5],4,-378558),_=E(_,m,g,x,p[8],11,-2022574463),x=E(x,_,m,g,p[11],16,1839030562),g=E(g,x,_,m,p[14],23,-35309556),m=E(m,g,x,_,p[1],4,-1530992060),_=E(_,m,g,x,p[4],11,1272893353),x=E(x,_,m,g,p[7],16,-155497632),g=E(g,x,_,m,p[10],23,-1094730640),m=E(m,g,x,_,p[13],4,681279174),_=E(_,m,g,x,p[0],11,-358537222),x=E(x,_,m,g,p[3],16,-722521979),g=E(g,x,_,m,p[6],23,76029189),m=E(m,g,x,_,p[9],4,-640364487),_=E(_,m,g,x,p[12],11,-421815835),x=E(x,_,m,g,p[15],16,530742520),g=E(g,x,_,m,p[2],23,-995338651);var D=d.bind(null,b);m=D(m,g,x,_,p[0],6,-198630844),_=D(_,m,g,x,p[7],10,1126891415),x=D(x,_,m,g,p[14],15,-1416354905),g=D(g,x,_,m,p[5],21,-57434055),m=D(m,g,x,_,p[12],6,1700485571),_=D(_,m,g,x,p[3],10,-1894986606),x=D(x,_,m,g,p[10],15,-1051523),g=D(g,x,_,m,p[1],21,-2054922799),m=D(m,g,x,_,p[8],6,1873313359),_=D(_,m,g,x,p[15],10,-30611744),x=D(x,_,m,g,p[6],15,-1560198380),g=D(g,x,_,m,p[13],21,1309151649),m=D(m,g,x,_,p[4],6,-145523070),_=D(_,m,g,x,p[11],10,-1120210379),x=D(x,_,m,g,p[2],15,718787259),g=D(g,x,_,m,p[9],21,-343485551),v[0]=b(m,v[0]),v[1]=b(g,v[1]),v[2]=b(x,v[2]),v[3]=b(_,v[3])},h=function(v){for(var p=[],b=0;b<64;b+=4)p[b>>2]=v.charCodeAt(b)+(v.charCodeAt(b+1)<<8)+(v.charCodeAt(b+2)<<16)+(v.charCodeAt(b+3)<<24);return p},y=function(v,p){var b,m=v.length,g=[1732584193,-271733879,-1732584194,271733878];for(b=64;b<=m;b+=64)f(g,h(v.substring(b-64,b)),p);var x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=(v=v.substring(b-64)).length;for(b=0;b<_;b++)x[b>>2]|=v.charCodeAt(b)<<(b%4<<3);if(x[b>>2]|=128<<(b%4<<3),b>55)for(f(g,x,p),b=16;b--;)x[b]=0;return x[14]=8*m,f(g,x,p),g};function j(v){var p;return o(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(p=function(b,m){var g=(65535&b)+(65535&m);return(b>>16)+(m>>16)+(g>>16)<<16|65535&g}),o(y(v,p))}}])})});function Nu(t){let e=t.split("/");return e.pop(),e.join("/")}function Yi(t,e){return t.headings?.filter(r=>r.level===e).map(r=>r.heading)??[]}function Ji(t,e){return(t+e)%e}function Bu(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,r,n)=>n)}function Ku(t){return t?.frontmatter?(0,mr.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function zu(t){let e=t?(0,mr.getAllTags)(t)??[]:[];return e=[...new Set(e.reduce((r,n)=>[...r,...n.split("/").filter(i=>i).map(i=>i.startsWith("#")?i:`#${i}`),n],[]))],e}function Tt(t){let r=["\\u30FC","\\u309A","\\u3099"].join("|"),n=new RegExp(`(?!${r})\\p{Diacritic}`,"gu");return t==null?"":(t=t.replaceAll("`","[__omnisearch__backtick__]"),t=t.replaceAll("^","[__omnisearch__caret__]"),t=t.normalize("NFD").replace(n,"").normalize("NFC"),t=t.replaceAll("[__omnisearch__backtick__]","`"),t=t.replaceAll("[__omnisearch__caret__]","^"),t)}function gr(){return mr.Platform.isMacOS?"\u2318":"ctrl"}function Ty(t){let e=!!Ge(),r=e&&T.PDFIndexing,n=e&&T.imagesIndexing;return Xi(t)||Gr(t)||Zi(t)||r&&yr(t)||n&&Ur(t)}function ma(t){return Tu()||Xi(t)||Gr(t)||Zi(t)}function Jn(t){return ma(t)||Ty(t)}function Ur(t){let e=Vt(t);return e==="png"||e==="jpg"||e==="jpeg"||e==="webp"}function yr(t){return Vt(t)==="pdf"}function Hu(t){let e=Vt(t);return e==="docx"||e==="xlsx"}function Xi(t){return[...T.indexedFileTypes,"md"].some(e=>t.endsWith(`.${e}`))}function Gr(t){return t.endsWith(".canvas")}function Zi(t){return t.endsWith(".loom")}function Vt(t){let e=t.split(".");return e[e.length-1]??""}function Vu(t){return mr.Platform.isMobileApp?(0,Lu.md5)(t.toString()):(0,Ru.createHash)("md5").update(t).digest("hex")}function Wu(t,e){let r=[],n=0,i=t.length;for(;n<i;)r.push(t.slice(n,n+=e));return r}function ga(t){return/[a-z][A-Z]/.test(t)?t.replace(/([a-z](?=[A-Z]))/g,"$1 ").split(" ").filter(r=>r):[]}function ya(t){return t.includes("-")?t.split("-").filter(e=>e):[]}function he(...t){Uu(console.log,...t)}function $u(...t){Uu(console.warn,...t)}function Uu(t,...e){if(T.verboseLogging){let r=new Date,n=`${r.getMinutes()}:${r.getSeconds()}:${r.getMilliseconds()}`;t("Omnisearch -",n+" -",...e)}}var mr,Ru,Lu,ht=A(()=>{mr=ve(require("obsidian"));st();et();Ru=ve(require("crypto")),Lu=ve(Mu())});async function Dy(t){let e=app.vault.getAbstractFileByPath(t);if(!e)throw new Error(`Invalid file path: "${t}"`);if(!(e instanceof eo.TFile))throw new Error(`Not a TFile: "${t}"`);let r=null,n=Ge();if(Xi(t))r=await app.vault.cachedRead(e);else if(Gr(t)){let s=JSON.parse(await app.vault.cachedRead(e)),a=[];for(let l of s.nodes)l.type==="text"?a.push(l.text):l.type==="file"&&a.push(l.file);for(let l of s.edges.filter(u=>!!u.label))a.push(l.label);r=a.join(`\r
`)}else if(Zi(t))try{let s=JSON.parse(await app.vault.cachedRead(e)),a=[],l=u=>{for(let c in u)typeof u[c]=="object"?l(u[c]):c==="content"&&a.push(u[c])};l(s),r=a.join(`\r
`)}catch(s){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(s)}else Ur(t)&&T.imagesIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):yr(t)&&T.PDFIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):Hu(t)&&T.officeIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):ma(t)&&(r=e.path);r==null&&(console.warn(`Omnisearch: ${r} content for file`,e.path),r="");let i=app.metadataCache.getFileCache(e);if(i&&i.frontmatter?.["excalidraw-plugin"]){let s=i.sections?.filter(a=>a.type==="comment")??[];for(let{start:a,end:l}of s.map(u=>u.position))r=r.substring(0,a.offset-1)+r.substring(l.offset)}let o=zu(i);return{basename:e.basename,content:r,cleanedContent:Bu(Tt(r)),path:e.path,mtime:e.stat.mtime,tags:o,unmarkedTags:o.map(s=>s.replace("#","")),aliases:Ku(i).join(""),headings1:i?Yi(i,1).join(" "):"",headings2:i?Yi(i,2).join(" "):"",headings3:i?Yi(i,3).join(" "):""}}var eo,Gu,Se,Qr=A(()=>{eo=ve(require("obsidian"));st();Gi();ht();et();Gu=class{constructor(){this.nextQueryIsEmpty=!1;this.documents=new Map}async addToLiveCache(e){try{let r=await Dy(e);if(!r.path){console.error(`Missing .path field in IndexedDocument "${r.basename}", skipping`);return}this.documents.set(e,r)}catch(r){console.warn(`Omnisearch: Error while adding "${e}" to live cache`,r),this.removeFromLiveCache(e)}}removeFromLiveCache(e){this.documents.delete(e)}async getDocument(e){return this.documents.has(e)?this.documents.get(e):(he("Generating IndexedDocument from",e),await this.addToLiveCache(e),this.documents.get(e))}async addToSearchHistory(e){if(!e){this.nextQueryIsEmpty=!0;return}this.nextQueryIsEmpty=!1;let r=await Ae.searchHistory.toArray();r=r.filter(n=>n.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await Ae.searchHistory.clear(),await Ae.searchHistory.bulkAdd(r)}async getSearchHistory(){let e=(await Ae.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&e.unshift(""),e}getDocumentsChecksum(e){return Vu(JSON.stringify(e.sort((r,n)=>r.path<n.path?-1:r.path>n.path?1:0)))}async getMinisearchCache(){try{return(await Ae.minisearch.toArray())[0]}catch(e){return new eo.Notice("Omnisearch - Cache missing or invalid. Some freezes may occur while Omnisearch indexes your vault."),console.error("Omnisearch - Error while loading Minisearch cache"),console.error(e),null}}async writeMinisearchCache(e,r){let n=Array.from(r).map(([i,o])=>({path:i,mtime:o}));await Ae.minisearch.clear(),await Ae.minisearch.add({date:new Date().toISOString(),paths:n,data:e.toJSON()}),console.log("Omnisearch - Search cache written")}},Se=new Gu});var Ry,no,_a=A(()=>{Ry=typeof global=="object"&&global&&global.Object===Object&&global,no=Ry});var Ly,Ny,_e,rt=A(()=>{_a();Ly=typeof self=="object"&&self&&self.Object===Object&&self,Ny=no||Ly||Function("return this")(),_e=Ny});var By,De,_r=A(()=>{rt();By=_e.Symbol,De=By});function Hy(t){var e=Ky.call(t,Xn),r=t[Xn];try{t[Xn]=void 0;var n=!0}catch{}var i=zy.call(t);return n&&(e?t[Xn]=r:delete t[Xn]),i}var Ju,Ky,zy,Xn,Xu,Zu=A(()=>{_r();Ju=Object.prototype,Ky=Ju.hasOwnProperty,zy=Ju.toString,Xn=De?De.toStringTag:void 0;Xu=Hy});function $y(t){return Wy.call(t)}var Vy,Wy,ec,tc=A(()=>{Vy=Object.prototype,Wy=Vy.toString;ec=$y});function Qy(t){return t==null?t===void 0?Gy:Uy:rc&&rc in Object(t)?Xu(t):ec(t)}var Uy,Gy,rc,at,qr=A(()=>{_r();Zu();tc();Uy="[object Null]",Gy="[object Undefined]",rc=De?De.toStringTag:void 0;at=Qy});function qy(t){return t!=null&&typeof t=="object"}var $e,Wt=A(()=>{$e=qy});function Jy(t){return typeof t=="symbol"||$e(t)&&at(t)==Yy}var Yy,lt,Yr=A(()=>{qr();Wt();Yy="[object Symbol]";lt=Jy});function Xy(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Jr,va=A(()=>{Jr=Xy});var Zy,me,nt=A(()=>{Zy=Array.isArray,me=Zy});function oc(t){if(typeof t=="string")return t;if(me(t))return Jr(t,oc)+"";if(lt(t))return ic?ic.call(t):"";var e=t+"";return e=="0"&&1/t==-e_?"-0":e}var e_,nc,ic,sc,ac=A(()=>{_r();va();nt();Yr();e_=1/0,nc=De?De.prototype:void 0,ic=nc?nc.toString:void 0;sc=oc});function r_(t){for(var e=t.length;e--&&t_.test(t.charAt(e)););return e}var t_,lc,uc=A(()=>{t_=/\s/;lc=r_});function i_(t){return t&&t.slice(0,lc(t)+1).replace(n_,"")}var n_,cc,fc=A(()=>{uc();n_=/^\s+/;cc=i_});function o_(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ce,mt=A(()=>{Ce=o_});function c_(t){if(typeof t=="number")return t;if(lt(t))return dc;if(Ce(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ce(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=cc(t);var r=a_.test(t);return r||l_.test(t)?u_(t.slice(2),r?2:8):s_.test(t)?dc:+t}var dc,s_,a_,l_,u_,ba,pc=A(()=>{fc();mt();Yr();dc=0/0,s_=/^[-+]0x[0-9a-f]+$/i,a_=/^0b[01]+$/i,l_=/^0o[0-7]+$/i,u_=parseInt;ba=c_});function f_(t){return t}var $t,Zn=A(()=>{$t=f_});function g_(t){if(!Ce(t))return!1;var e=at(t);return e==p_||e==h_||e==d_||e==m_}var d_,p_,h_,m_,io,xa=A(()=>{qr();mt();d_="[object AsyncFunction]",p_="[object Function]",h_="[object GeneratorFunction]",m_="[object Proxy]";io=g_});var y_,oo,hc=A(()=>{rt();y_=_e["__core-js_shared__"],oo=y_});function __(t){return!!mc&&mc in t}var mc,gc,yc=A(()=>{hc();mc=function(){var t=/[^.]+$/.exec(oo&&oo.keys&&oo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();gc=__});function x_(t){if(t!=null){try{return b_.call(t)}catch{}try{return t+""}catch{}}return""}var v_,b_,Dt,wa=A(()=>{v_=Function.prototype,b_=v_.toString;Dt=x_});function T_(t){if(!Ce(t)||gc(t))return!1;var e=io(t)?F_:j_;return e.test(Dt(t))}var w_,j_,A_,S_,C_,E_,F_,_c,vc=A(()=>{xa();yc();mt();wa();w_=/[\\^$.*+?()[\]{}|]/g,j_=/^\[object .+?Constructor\]$/,A_=Function.prototype,S_=Object.prototype,C_=A_.toString,E_=S_.hasOwnProperty,F_=RegExp("^"+C_.call(E_).replace(w_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");_c=T_});function D_(t,e){return t==null?void 0:t[e]}var bc,xc=A(()=>{bc=D_});function O_(t,e){var r=bc(t,e);return _c(r)?r:void 0}var Qe,Ut=A(()=>{vc();xc();Qe=O_});var I_,so,wc=A(()=>{Ut();rt();I_=Qe(_e,"WeakMap"),so=I_});var jc,P_,Ac,Sc=A(()=>{mt();jc=Object.create,P_=function(){function t(){}return function(e){if(!Ce(e))return{};if(jc)return jc(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Ac=P_});function k_(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Cc,Ec=A(()=>{Cc=k_});function M_(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Fc,Tc=A(()=>{Fc=M_});function B_(t){var e=0,r=0;return function(){var n=N_(),i=L_-(n-r);if(r=n,i>0){if(++e>=R_)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var R_,L_,N_,Dc,Oc=A(()=>{R_=800,L_=16,N_=Date.now;Dc=B_});function K_(t){return function(){return t}}var Ic,Pc=A(()=>{Ic=K_});var z_,Xr,ja=A(()=>{Ut();z_=function(){try{var t=Qe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Xr=z_});var H_,kc,Mc=A(()=>{Pc();ja();Zn();H_=Xr?function(t,e){return Xr(t,"toString",{configurable:!0,enumerable:!1,value:Ic(e),writable:!0})}:$t,kc=H_});var V_,Rc,Lc=A(()=>{Mc();Oc();V_=Dc(kc),Rc=V_});function W_(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Nc,Bc=A(()=>{Nc=W_});function G_(t,e){var r=typeof t;return e=e??$_,!!e&&(r=="number"||r!="symbol"&&U_.test(t))&&t>-1&&t%1==0&&t<e}var $_,U_,Zr,ao=A(()=>{$_=9007199254740991,U_=/^(?:0|[1-9]\d*)$/;Zr=G_});function Q_(t,e,r){e=="__proto__"&&Xr?Xr(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var lo,Aa=A(()=>{ja();lo=Q_});function q_(t,e){return t===e||t!==t&&e!==e}var Gt,ei=A(()=>{Gt=q_});function X_(t,e,r){var n=t[e];(!(J_.call(t,e)&&Gt(n,r))||r===void 0&&!(e in t))&&lo(t,e,r)}var Y_,J_,uo,Sa=A(()=>{Aa();ei();Y_=Object.prototype,J_=Y_.hasOwnProperty;uo=X_});function Z_(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],l=n?n(r[a],t[a],a,r,t):void 0;l===void 0&&(l=t[a]),i?lo(r,a,l):uo(r,a,l)}return r}var Qt,ti=A(()=>{Sa();Aa();Qt=Z_});function ev(t,e,r){return e=Kc(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Kc(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),Cc(t,this,a)}}var Kc,zc,Hc=A(()=>{Ec();Kc=Math.max;zc=ev});function tv(t,e){return Rc(zc(t,e,$t),t+"")}var Vc,Wc=A(()=>{Zn();Hc();Lc();Vc=tv});function nv(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=rv}var rv,en,co=A(()=>{rv=9007199254740991;en=nv});function iv(t){return t!=null&&en(t.length)&&!io(t)}var gt,tn=A(()=>{xa();co();gt=iv});function ov(t,e,r){if(!Ce(r))return!1;var n=typeof e;return(n=="number"?gt(r)&&Zr(e,r.length):n=="string"&&e in r)?Gt(r[e],t):!1}var Ca,$c=A(()=>{ei();tn();ao();mt();Ca=ov});function av(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||sv;return t===r}var sv,rn,fo=A(()=>{sv=Object.prototype;rn=av});function lv(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Uc,Gc=A(()=>{Uc=lv});function cv(t){return $e(t)&&at(t)==uv}var uv,Ea,Qc=A(()=>{qr();Wt();uv="[object Arguments]";Ea=cv});var qc,fv,dv,pv,nn,po=A(()=>{Qc();Wt();qc=Object.prototype,fv=qc.hasOwnProperty,dv=qc.propertyIsEnumerable,pv=Ea(function(){return arguments}())?Ea:function(t){return $e(t)&&fv.call(t,"callee")&&!dv.call(t,"callee")},nn=pv});function hv(){return!1}var Yc,Jc=A(()=>{Yc=hv});var Xc,Zc,mv,ef,gv,yv,vr,ho=A(()=>{rt();Jc();Xc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zc=Xc&&typeof module=="object"&&module&&!module.nodeType&&module,mv=Zc&&Zc.exports===Xc,ef=mv?_e.Buffer:void 0,gv=ef?ef.isBuffer:void 0,yv=gv||Yc,vr=yv});function Hv(t){return $e(t)&&en(t.length)&&!!fe[at(t)]}var _v,vv,bv,xv,wv,jv,Av,Sv,Cv,Ev,Fv,Tv,Dv,Ov,Iv,Pv,kv,Mv,Rv,Lv,Nv,Bv,Kv,zv,fe,tf,rf=A(()=>{qr();co();Wt();_v="[object Arguments]",vv="[object Array]",bv="[object Boolean]",xv="[object Date]",wv="[object Error]",jv="[object Function]",Av="[object Map]",Sv="[object Number]",Cv="[object Object]",Ev="[object RegExp]",Fv="[object Set]",Tv="[object String]",Dv="[object WeakMap]",Ov="[object ArrayBuffer]",Iv="[object DataView]",Pv="[object Float32Array]",kv="[object Float64Array]",Mv="[object Int8Array]",Rv="[object Int16Array]",Lv="[object Int32Array]",Nv="[object Uint8Array]",Bv="[object Uint8ClampedArray]",Kv="[object Uint16Array]",zv="[object Uint32Array]",fe={};fe[Pv]=fe[kv]=fe[Mv]=fe[Rv]=fe[Lv]=fe[Nv]=fe[Bv]=fe[Kv]=fe[zv]=!0;fe[_v]=fe[vv]=fe[Ov]=fe[bv]=fe[Iv]=fe[xv]=fe[wv]=fe[jv]=fe[Av]=fe[Sv]=fe[Cv]=fe[Ev]=fe[Fv]=fe[Tv]=fe[Dv]=!1;tf=Hv});function Vv(t){return function(e){return t(e)}}var qt,ri=A(()=>{qt=Vv});var nf,ni,Wv,Fa,$v,Ot,mo=A(()=>{_a();nf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ni=nf&&typeof module=="object"&&module&&!module.nodeType&&module,Wv=ni&&ni.exports===nf,Fa=Wv&&no.process,$v=function(){try{var t=ni&&ni.require&&ni.require("util").types;return t||Fa&&Fa.binding&&Fa.binding("util")}catch{}}(),Ot=$v});var of,Uv,go,Ta=A(()=>{rf();ri();mo();of=Ot&&Ot.isTypedArray,Uv=of?qt(of):tf,go=Uv});function qv(t,e){var r=me(t),n=!r&&nn(t),i=!r&&!n&&vr(t),o=!r&&!n&&!i&&go(t),s=r||n||i||o,a=s?Uc(t.length,String):[],l=a.length;for(var u in t)(e||Qv.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Zr(u,l)))&&a.push(u);return a}var Gv,Qv,yo,Da=A(()=>{Gc();po();nt();ho();ao();Ta();Gv=Object.prototype,Qv=Gv.hasOwnProperty;yo=qv});function Yv(t,e){return function(r){return t(e(r))}}var _o,Oa=A(()=>{_o=Yv});var Jv,sf,af=A(()=>{Oa();Jv=_o(Object.keys,Object),sf=Jv});function eb(t){if(!rn(t))return sf(t);var e=[];for(var r in Object(t))Zv.call(t,r)&&r!="constructor"&&e.push(r);return e}var Xv,Zv,lf,uf=A(()=>{fo();af();Xv=Object.prototype,Zv=Xv.hasOwnProperty;lf=eb});function tb(t){return gt(t)?yo(t):lf(t)}var yt,on=A(()=>{Da();uf();tn();yt=tb});function rb(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var cf,ff=A(()=>{cf=rb});function ob(t){if(!Ce(t))return cf(t);var e=rn(t),r=[];for(var n in t)n=="constructor"&&(e||!ib.call(t,n))||r.push(n);return r}var nb,ib,df,pf=A(()=>{mt();fo();ff();nb=Object.prototype,ib=nb.hasOwnProperty;df=ob});function sb(t){return gt(t)?yo(t,!0):df(t)}var sn,vo=A(()=>{Da();pf();tn();sn=sb});function ub(t,e){if(me(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||lt(t)?!0:lb.test(t)||!ab.test(t)||e!=null&&t in Object(e)}var ab,lb,an,bo=A(()=>{nt();Yr();ab=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lb=/^\w*$/;an=ub});var cb,It,ii=A(()=>{Ut();cb=Qe(Object,"create"),It=cb});function fb(){this.__data__=It?It(null):{},this.size=0}var hf,mf=A(()=>{ii();hf=fb});function db(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var gf,yf=A(()=>{gf=db});function gb(t){var e=this.__data__;if(It){var r=e[t];return r===pb?void 0:r}return mb.call(e,t)?e[t]:void 0}var pb,hb,mb,_f,vf=A(()=>{ii();pb="__lodash_hash_undefined__",hb=Object.prototype,mb=hb.hasOwnProperty;_f=gb});function vb(t){var e=this.__data__;return It?e[t]!==void 0:_b.call(e,t)}var yb,_b,bf,xf=A(()=>{ii();yb=Object.prototype,_b=yb.hasOwnProperty;bf=vb});function xb(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=It&&e===void 0?bb:e,this}var bb,wf,jf=A(()=>{ii();bb="__lodash_hash_undefined__";wf=xb});function ln(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var Ia,Af=A(()=>{mf();yf();vf();xf();jf();ln.prototype.clear=hf;ln.prototype.delete=gf;ln.prototype.get=_f;ln.prototype.has=bf;ln.prototype.set=wf;Ia=ln});function wb(){this.__data__=[],this.size=0}var Sf,Cf=A(()=>{Sf=wb});function jb(t,e){for(var r=t.length;r--;)if(Gt(t[r][0],e))return r;return-1}var Yt,oi=A(()=>{ei();Yt=jb});function Cb(t){var e=this.__data__,r=Yt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Sb.call(e,r,1),--this.size,!0}var Ab,Sb,Ef,Ff=A(()=>{oi();Ab=Array.prototype,Sb=Ab.splice;Ef=Cb});function Eb(t){var e=this.__data__,r=Yt(e,t);return r<0?void 0:e[r][1]}var Tf,Df=A(()=>{oi();Tf=Eb});function Fb(t){return Yt(this.__data__,t)>-1}var Of,If=A(()=>{oi();Of=Fb});function Tb(t,e){var r=this.__data__,n=Yt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Pf,kf=A(()=>{oi();Pf=Tb});function un(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var Jt,si=A(()=>{Cf();Ff();Df();If();kf();un.prototype.clear=Sf;un.prototype.delete=Ef;un.prototype.get=Tf;un.prototype.has=Of;un.prototype.set=Pf;Jt=un});var Db,Xt,xo=A(()=>{Ut();rt();Db=Qe(_e,"Map"),Xt=Db});function Ob(){this.size=0,this.__data__={hash:new Ia,map:new(Xt||Jt),string:new Ia}}var Mf,Rf=A(()=>{Af();si();xo();Mf=Ob});function Ib(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Lf,Nf=A(()=>{Lf=Ib});function Pb(t,e){var r=t.__data__;return Lf(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Zt,ai=A(()=>{Nf();Zt=Pb});function kb(t){var e=Zt(this,t).delete(t);return this.size-=e?1:0,e}var Bf,Kf=A(()=>{ai();Bf=kb});function Mb(t){return Zt(this,t).get(t)}var zf,Hf=A(()=>{ai();zf=Mb});function Rb(t){return Zt(this,t).has(t)}var Vf,Wf=A(()=>{ai();Vf=Rb});function Lb(t,e){var r=Zt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var $f,Uf=A(()=>{ai();$f=Lb});function cn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var br,wo=A(()=>{Rf();Kf();Hf();Wf();Uf();cn.prototype.clear=Mf;cn.prototype.delete=Bf;cn.prototype.get=zf;cn.prototype.has=Vf;cn.prototype.set=$f;br=cn});function Pa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Nb);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Pa.Cache||br),r}var Nb,Gf,Qf=A(()=>{wo();Nb="Expected a function";Pa.Cache=br;Gf=Pa});function Kb(t){var e=Gf(t,function(n){return r.size===Bb&&r.clear(),n}),r=e.cache;return e}var Bb,qf,Yf=A(()=>{Qf();Bb=500;qf=Kb});var zb,Hb,Vb,Jf,Xf=A(()=>{Yf();zb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hb=/\\(\\)?/g,Vb=qf(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(zb,function(r,n,i,o){e.push(i?o.replace(Hb,"$1"):n||r)}),e}),Jf=Vb});function Wb(t){return t==null?"":sc(t)}var jo,ka=A(()=>{ac();jo=Wb});function $b(t,e){return me(t)?t:an(t,e)?[t]:Jf(jo(t))}var Ao,Ma=A(()=>{nt();bo();Xf();ka();Ao=$b});function Gb(t){if(typeof t=="string"||lt(t))return t;var e=t+"";return e=="0"&&1/t==-Ub?"-0":e}var Ub,er,li=A(()=>{Yr();Ub=1/0;er=Gb});function Qb(t,e){e=Ao(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[er(e[r++])];return r&&r==n?t:void 0}var fn,So=A(()=>{Ma();li();fn=Qb});function qb(t,e,r){var n=t==null?void 0:fn(t,e);return n===void 0?r:n}var Zf,ed=A(()=>{So();Zf=qb});function Yb(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var dn,Co=A(()=>{dn=Yb});function Jb(t){return me(t)||nn(t)||!!(td&&t&&t[td])}var td,rd,nd=A(()=>{_r();po();nt();td=De?De.isConcatSpreadable:void 0;rd=Jb});function id(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=rd),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?id(a,e-1,r,n,i):dn(i,a):n||(i[i.length]=a)}return i}var od,sd=A(()=>{Co();nd();od=id});var Xb,Eo,Ra=A(()=>{Oa();Xb=_o(Object.getPrototypeOf,Object),Eo=Xb});function Zb(){this.__data__=new Jt,this.size=0}var ad,ld=A(()=>{si();ad=Zb});function ex(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ud,cd=A(()=>{ud=ex});function tx(t){return this.__data__.get(t)}var fd,dd=A(()=>{fd=tx});function rx(t){return this.__data__.has(t)}var pd,hd=A(()=>{pd=rx});function ix(t,e){var r=this.__data__;if(r instanceof Jt){var n=r.__data__;if(!Xt||n.length<nx-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new br(n)}return r.set(t,e),this.size=r.size,this}var nx,md,gd=A(()=>{si();xo();wo();nx=200;md=ix});function pn(t){var e=this.__data__=new Jt(t);this.size=e.size}var tr,Fo=A(()=>{si();ld();cd();dd();hd();gd();pn.prototype.clear=ad;pn.prototype.delete=ud;pn.prototype.get=fd;pn.prototype.has=pd;pn.prototype.set=md;tr=pn});function ox(t,e){return t&&Qt(e,yt(e),t)}var yd,_d=A(()=>{ti();on();yd=ox});function sx(t,e){return t&&Qt(e,sn(e),t)}var vd,bd=A(()=>{ti();vo();vd=sx});function lx(t,e){if(e)return t.slice();var r=t.length,n=Ad?Ad(r):new t.constructor(r);return t.copy(n),n}var xd,wd,ax,jd,Ad,Sd,Cd=A(()=>{rt();xd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wd=xd&&typeof module=="object"&&module&&!module.nodeType&&module,ax=wd&&wd.exports===xd,jd=ax?_e.Buffer:void 0,Ad=jd?jd.allocUnsafe:void 0;Sd=lx});function ux(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var Ed,Fd=A(()=>{Ed=ux});function cx(){return[]}var To,La=A(()=>{To=cx});var fx,dx,Td,px,hn,Do=A(()=>{Fd();La();fx=Object.prototype,dx=fx.propertyIsEnumerable,Td=Object.getOwnPropertySymbols,px=Td?function(t){return t==null?[]:(t=Object(t),Ed(Td(t),function(e){return dx.call(t,e)}))}:To,hn=px});function hx(t,e){return Qt(t,hn(t),e)}var Dd,Od=A(()=>{ti();Do();Dd=hx});var mx,gx,Oo,Na=A(()=>{Co();Ra();Do();La();mx=Object.getOwnPropertySymbols,gx=mx?function(t){for(var e=[];t;)dn(e,hn(t)),t=Eo(t);return e}:To,Oo=gx});function yx(t,e){return Qt(t,Oo(t),e)}var Id,Pd=A(()=>{ti();Na();Id=yx});function _x(t,e,r){var n=e(t);return me(t)?n:dn(n,r(t))}var Io,Ba=A(()=>{Co();nt();Io=_x});function vx(t){return Io(t,yt,hn)}var ui,Ka=A(()=>{Ba();Do();on();ui=vx});function bx(t){return Io(t,sn,Oo)}var kd,Md=A(()=>{Ba();Na();vo();kd=bx});var xx,Po,Rd=A(()=>{Ut();rt();xx=Qe(_e,"DataView"),Po=xx});var wx,ko,Ld=A(()=>{Ut();rt();wx=Qe(_e,"Promise"),ko=wx});var jx,Mo,Nd=A(()=>{Ut();rt();jx=Qe(_e,"Set"),Mo=jx});var Bd,Ax,Kd,zd,Hd,Vd,Sx,Cx,Ex,Fx,Tx,xr,Pt,ci=A(()=>{Rd();xo();Ld();Nd();wc();qr();wa();Bd="[object Map]",Ax="[object Object]",Kd="[object Promise]",zd="[object Set]",Hd="[object WeakMap]",Vd="[object DataView]",Sx=Dt(Po),Cx=Dt(Xt),Ex=Dt(ko),Fx=Dt(Mo),Tx=Dt(so),xr=at;(Po&&xr(new Po(new ArrayBuffer(1)))!=Vd||Xt&&xr(new Xt)!=Bd||ko&&xr(ko.resolve())!=Kd||Mo&&xr(new Mo)!=zd||so&&xr(new so)!=Hd)&&(xr=function(t){var e=at(t),r=e==Ax?t.constructor:void 0,n=r?Dt(r):"";if(n)switch(n){case Sx:return Vd;case Cx:return Bd;case Ex:return Kd;case Fx:return zd;case Tx:return Hd}return e});Pt=xr});function Ix(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Ox.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Dx,Ox,Wd,$d=A(()=>{Dx=Object.prototype,Ox=Dx.hasOwnProperty;Wd=Ix});var Px,mn,za=A(()=>{rt();Px=_e.Uint8Array,mn=Px});function kx(t){var e=new t.constructor(t.byteLength);return new mn(e).set(new mn(t)),e}var gn,Ro=A(()=>{za();gn=kx});function Mx(t,e){var r=e?gn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Ud,Gd=A(()=>{Ro();Ud=Mx});function Lx(t){var e=new t.constructor(t.source,Rx.exec(t));return e.lastIndex=t.lastIndex,e}var Rx,Qd,qd=A(()=>{Rx=/\w*$/;Qd=Lx});function Nx(t){return Jd?Object(Jd.call(t)):{}}var Yd,Jd,Xd,Zd=A(()=>{_r();Yd=De?De.prototype:void 0,Jd=Yd?Yd.valueOf:void 0;Xd=Nx});function Bx(t,e){var r=e?gn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ep,tp=A(()=>{Ro();ep=Bx});function ow(t,e,r){var n=t.constructor;switch(e){case Qx:return gn(t);case Kx:case zx:return new n(+t);case qx:return Ud(t,r);case Yx:case Jx:case Xx:case Zx:case ew:case tw:case rw:case nw:case iw:return ep(t,r);case Hx:return new n;case Vx:case Ux:return new n(t);case Wx:return Qd(t);case $x:return new n;case Gx:return Xd(t)}}var Kx,zx,Hx,Vx,Wx,$x,Ux,Gx,Qx,qx,Yx,Jx,Xx,Zx,ew,tw,rw,nw,iw,rp,np=A(()=>{Ro();Gd();qd();Zd();tp();Kx="[object Boolean]",zx="[object Date]",Hx="[object Map]",Vx="[object Number]",Wx="[object RegExp]",$x="[object Set]",Ux="[object String]",Gx="[object Symbol]",Qx="[object ArrayBuffer]",qx="[object DataView]",Yx="[object Float32Array]",Jx="[object Float64Array]",Xx="[object Int8Array]",Zx="[object Int16Array]",ew="[object Int32Array]",tw="[object Uint8Array]",rw="[object Uint8ClampedArray]",nw="[object Uint16Array]",iw="[object Uint32Array]";rp=ow});function sw(t){return typeof t.constructor=="function"&&!rn(t)?Ac(Eo(t)):{}}var ip,op=A(()=>{Sc();Ra();fo();ip=sw});function lw(t){return $e(t)&&Pt(t)==aw}var aw,sp,ap=A(()=>{ci();Wt();aw="[object Map]";sp=lw});var lp,uw,up,cp=A(()=>{ap();ri();mo();lp=Ot&&Ot.isMap,uw=lp?qt(lp):sp,up=uw});function fw(t){return $e(t)&&Pt(t)==cw}var cw,fp,dp=A(()=>{ci();Wt();cw="[object Set]";fp=fw});var pp,dw,hp,mp=A(()=>{dp();ri();mo();pp=Ot&&Ot.isSet,dw=pp?qt(pp):fp,hp=dw});function Lo(t,e,r,n,i,o){var s,a=e&pw,l=e&hw,u=e&mw;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Ce(t))return t;var c=me(t);if(c){if(s=Wd(t),!a)return Fc(t,s)}else{var d=Pt(t),f=d==yp||d==bw;if(vr(t))return Sd(t,a);if(d==_p||d==gp||f&&!i){if(s=l||f?{}:ip(t),!a)return l?Id(t,vd(s,t)):Dd(t,yd(s,t))}else{if(!ae[d])return i?t:{};s=rp(t,d,a)}}o||(o=new tr);var h=o.get(t);if(h)return h;o.set(t,s),hp(t)?t.forEach(function(v){s.add(Lo(v,e,r,v,t,o))}):up(t)&&t.forEach(function(v,p){s.set(p,Lo(v,e,r,p,t,o))});var y=u?l?kd:ui:l?sn:yt,j=c?void 0:y(t);return Nc(j||t,function(v,p){j&&(p=v,v=t[p]),uo(s,p,Lo(v,e,r,p,t,o))}),s}var pw,hw,mw,gp,gw,yw,_w,vw,yp,bw,xw,ww,_p,jw,Aw,Sw,Cw,Ew,Fw,Tw,Dw,Ow,Iw,Pw,kw,Mw,Rw,Lw,Nw,ae,vp,bp=A(()=>{Fo();Bc();Sa();_d();bd();Cd();Tc();Od();Pd();Ka();Md();ci();$d();np();op();nt();ho();cp();mt();mp();on();vo();pw=1,hw=2,mw=4,gp="[object Arguments]",gw="[object Array]",yw="[object Boolean]",_w="[object Date]",vw="[object Error]",yp="[object Function]",bw="[object GeneratorFunction]",xw="[object Map]",ww="[object Number]",_p="[object Object]",jw="[object RegExp]",Aw="[object Set]",Sw="[object String]",Cw="[object Symbol]",Ew="[object WeakMap]",Fw="[object ArrayBuffer]",Tw="[object DataView]",Dw="[object Float32Array]",Ow="[object Float64Array]",Iw="[object Int8Array]",Pw="[object Int16Array]",kw="[object Int32Array]",Mw="[object Uint8Array]",Rw="[object Uint8ClampedArray]",Lw="[object Uint16Array]",Nw="[object Uint32Array]",ae={};ae[gp]=ae[gw]=ae[Fw]=ae[Tw]=ae[yw]=ae[_w]=ae[Dw]=ae[Ow]=ae[Iw]=ae[Pw]=ae[kw]=ae[xw]=ae[ww]=ae[_p]=ae[jw]=ae[Aw]=ae[Sw]=ae[Cw]=ae[Mw]=ae[Rw]=ae[Lw]=ae[Nw]=!0;ae[vw]=ae[yp]=ae[Ew]=!1;vp=Lo});function zw(t){return vp(t,Bw|Kw)}var Bw,Kw,fi,xp=A(()=>{bp();Bw=1,Kw=4;fi=zw});function Vw(t){return this.__data__.set(t,Hw),this}var Hw,wp,jp=A(()=>{Hw="__lodash_hash_undefined__";wp=Vw});function Ww(t){return this.__data__.has(t)}var Ap,Sp=A(()=>{Ap=Ww});function No(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new br;++e<r;)this.add(t[e])}var Cp,Ep=A(()=>{wo();jp();Sp();No.prototype.add=No.prototype.push=wp;No.prototype.has=Ap;Cp=No});function $w(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Fp,Tp=A(()=>{Fp=$w});function Uw(t,e){return t.has(e)}var Dp,Op=A(()=>{Dp=Uw});function qw(t,e,r,n,i,o){var s=r&Gw,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(t),c=o.get(e);if(u&&c)return u==e&&c==t;var d=-1,f=!0,h=r&Qw?new Cp:void 0;for(o.set(t,e),o.set(e,t);++d<a;){var y=t[d],j=e[d];if(n)var v=s?n(j,y,d,e,t,o):n(y,j,d,t,e,o);if(v!==void 0){if(v)continue;f=!1;break}if(h){if(!Fp(e,function(p,b){if(!Dp(h,b)&&(y===p||i(y,p,r,n,o)))return h.push(b)})){f=!1;break}}else if(!(y===j||i(y,j,r,n,o))){f=!1;break}}return o.delete(t),o.delete(e),f}var Gw,Qw,Bo,Ha=A(()=>{Ep();Tp();Op();Gw=1,Qw=2;Bo=qw});function Yw(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Ip,Pp=A(()=>{Ip=Yw});function Jw(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var kp,Mp=A(()=>{kp=Jw});function f0(t,e,r,n,i,o,s){switch(r){case c0:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case u0:return!(t.byteLength!=e.byteLength||!o(new mn(t),new mn(e)));case e0:case t0:case i0:return Gt(+t,+e);case r0:return t.name==e.name&&t.message==e.message;case o0:case a0:return t==e+"";case n0:var a=Ip;case s0:var l=n&Xw;if(a||(a=kp),t.size!=e.size&&!l)return!1;var u=s.get(t);if(u)return u==e;n|=Zw,s.set(t,e);var c=Bo(a(t),a(e),n,i,o,s);return s.delete(t),c;case l0:if(Va)return Va.call(t)==Va.call(e)}return!1}var Xw,Zw,e0,t0,r0,n0,i0,o0,s0,a0,l0,u0,c0,Rp,Va,Lp,Np=A(()=>{_r();za();ei();Ha();Pp();Mp();Xw=1,Zw=2,e0="[object Boolean]",t0="[object Date]",r0="[object Error]",n0="[object Map]",i0="[object Number]",o0="[object RegExp]",s0="[object Set]",a0="[object String]",l0="[object Symbol]",u0="[object ArrayBuffer]",c0="[object DataView]",Rp=De?De.prototype:void 0,Va=Rp?Rp.valueOf:void 0;Lp=f0});function m0(t,e,r,n,i,o){var s=r&d0,a=ui(t),l=a.length,u=ui(e),c=u.length;if(l!=c&&!s)return!1;for(var d=l;d--;){var f=a[d];if(!(s?f in e:h0.call(e,f)))return!1}var h=o.get(t),y=o.get(e);if(h&&y)return h==e&&y==t;var j=!0;o.set(t,e),o.set(e,t);for(var v=s;++d<l;){f=a[d];var p=t[f],b=e[f];if(n)var m=s?n(b,p,f,e,t,o):n(p,b,f,t,e,o);if(!(m===void 0?p===b||i(p,b,r,n,o):m)){j=!1;break}v||(v=f=="constructor")}if(j&&!v){var g=t.constructor,x=e.constructor;g!=x&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof x=="function"&&x instanceof x)&&(j=!1)}return o.delete(t),o.delete(e),j}var d0,p0,h0,Bp,Kp=A(()=>{Ka();d0=1,p0=Object.prototype,h0=p0.hasOwnProperty;Bp=m0});function _0(t,e,r,n,i,o){var s=me(t),a=me(e),l=s?Hp:Pt(t),u=a?Hp:Pt(e);l=l==zp?Ko:l,u=u==zp?Ko:u;var c=l==Ko,d=u==Ko,f=l==u;if(f&&vr(t)){if(!vr(e))return!1;s=!0,c=!1}if(f&&!c)return o||(o=new tr),s||go(t)?Bo(t,e,r,n,i,o):Lp(t,e,l,r,n,i,o);if(!(r&g0)){var h=c&&Vp.call(t,"__wrapped__"),y=d&&Vp.call(e,"__wrapped__");if(h||y){var j=h?t.value():t,v=y?e.value():e;return o||(o=new tr),i(j,v,r,n,o)}}return f?(o||(o=new tr),Bp(t,e,r,n,i,o)):!1}var g0,zp,Hp,Ko,y0,Vp,Wp,$p=A(()=>{Fo();Ha();Np();Kp();ci();nt();ho();Ta();g0=1,zp="[object Arguments]",Hp="[object Array]",Ko="[object Object]",y0=Object.prototype,Vp=y0.hasOwnProperty;Wp=_0});function Up(t,e,r,n,i){return t===e?!0:t==null||e==null||!$e(t)&&!$e(e)?t!==t&&e!==e:Wp(t,e,r,n,Up,i)}var zo,Wa=A(()=>{$p();Wt();zo=Up});function x0(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var l=a[0],u=t[l],c=a[1];if(s&&a[2]){if(u===void 0&&!(l in t))return!1}else{var d=new tr;if(n)var f=n(u,c,l,t,e,d);if(!(f===void 0?zo(c,u,v0|b0,n,d):f))return!1}}return!0}var v0,b0,Gp,Qp=A(()=>{Fo();Wa();v0=1,b0=2;Gp=x0});function w0(t){return t===t&&!Ce(t)}var Ho,$a=A(()=>{mt();Ho=w0});function j0(t){for(var e=yt(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Ho(i)]}return e}var qp,Yp=A(()=>{$a();on();qp=j0});function A0(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Vo,Ua=A(()=>{Vo=A0});function S0(t){var e=qp(t);return e.length==1&&e[0][2]?Vo(e[0][0],e[0][1]):function(r){return r===t||Gp(r,t,e)}}var Jp,Xp=A(()=>{Qp();Yp();Ua();Jp=S0});function C0(t,e){return t!=null&&e in Object(t)}var Zp,eh=A(()=>{Zp=C0});function E0(t,e,r){e=Ao(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=er(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&en(i)&&Zr(s,i)&&(me(t)||nn(t)))}var th,rh=A(()=>{Ma();po();nt();ao();co();li();th=E0});function F0(t,e){return t!=null&&th(t,e,Zp)}var nh,ih=A(()=>{eh();rh();nh=F0});function O0(t,e){return an(t)&&Ho(e)?Vo(er(t),e):function(r){var n=Zf(r,t);return n===void 0&&n===e?nh(r,t):zo(e,n,T0|D0)}}var T0,D0,oh,sh=A(()=>{Wa();ed();ih();bo();$a();Ua();li();T0=1,D0=2;oh=O0});function I0(t){return function(e){return e==null?void 0:e[t]}}var ah,lh=A(()=>{ah=I0});function P0(t){return function(e){return fn(e,t)}}var uh,ch=A(()=>{So();uh=P0});function k0(t){return an(t)?ah(er(t)):uh(t)}var fh,dh=A(()=>{lh();ch();bo();li();fh=k0});function M0(t){return typeof t=="function"?t:t==null?$t:typeof t=="object"?me(t)?oh(t[0],t[1]):Jp(t):fh(t)}var ph,hh=A(()=>{Xp();sh();Zn();nt();dh();ph=M0});function R0(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var l=s[t?a:++i];if(r(o[l],l,o)===!1)break}return e}}var mh,gh=A(()=>{mh=R0});var L0,yh,_h=A(()=>{gh();L0=mh(),yh=L0});function N0(t,e){return t&&yh(t,e,yt)}var vh,bh=A(()=>{_h();on();vh=N0});function B0(t,e){return function(r,n){if(r==null)return r;if(!gt(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var xh,wh=A(()=>{tn();xh=B0});var K0,jh,Ah=A(()=>{bh();wh();K0=xh(vh),jh=K0});var z0,Wo,Sh=A(()=>{rt();z0=function(){return _e.Date.now()},Wo=z0});function $0(t,e,r){var n,i,o,s,a,l,u=0,c=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(H0);e=ba(e)||0,Ce(r)&&(c=!!r.leading,d="maxWait"in r,o=d?V0(ba(r.maxWait)||0,e):o,f="trailing"in r?!!r.trailing:f);function h(_){var w=n,S=i;return n=i=void 0,u=_,s=t.apply(S,w),s}function y(_){return u=_,a=setTimeout(p,e),c?h(_):s}function j(_){var w=_-l,S=_-u,E=e-w;return d?W0(E,o-S):E}function v(_){var w=_-l,S=_-u;return l===void 0||w>=e||w<0||d&&S>=o}function p(){var _=Wo();if(v(_))return b(_);a=setTimeout(p,j(_))}function b(_){return a=void 0,f&&n?h(_):(n=i=void 0,s)}function m(){a!==void 0&&clearTimeout(a),u=0,n=l=i=a=void 0}function g(){return a===void 0?s:b(Wo())}function x(){var _=Wo(),w=v(_);if(n=arguments,i=this,l=_,w){if(a===void 0)return y(l);if(d)return clearTimeout(a),a=setTimeout(p,e),h(l)}return a===void 0&&(a=setTimeout(p,e)),s}return x.cancel=m,x.flush=g,x}var H0,V0,W0,Ga,Ch=A(()=>{mt();Sh();pc();H0="Expected a function",V0=Math.max,W0=Math.min;Ga=$0});function G0(t){return t=jo(t),t&&U0.test(t)?t.replace(Eh,"\\$&"):t}var Eh,U0,wr,Fh=A(()=>{ka();Eh=/[\\^$.*+?()[\]{}|]/g,U0=RegExp(Eh.source);wr=G0});function Q0(t,e){var r=-1,n=gt(t)?Array(t.length):[];return jh(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var Th,Dh=A(()=>{Ah();tn();Th=Q0});function q0(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var Oh,Ih=A(()=>{Oh=q0});function Y0(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,o=lt(t),s=e!==void 0,a=e===null,l=e===e,u=lt(e);if(!a&&!u&&!o&&t>e||o&&s&&l&&!a&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!o&&!u&&t<e||u&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!l)return-1}return 0}var Ph,kh=A(()=>{Yr();Ph=Y0});function J0(t,e,r){for(var n=-1,i=t.criteria,o=e.criteria,s=i.length,a=r.length;++n<s;){var l=Ph(i[n],o[n]);if(l){if(n>=a)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}var Mh,Rh=A(()=>{kh();Mh=J0});function X0(t,e,r){e.length?e=Jr(e,function(o){return me(o)?function(s){return fn(s,o.length===1?o[0]:o)}:o}):e=[$t];var n=-1;e=Jr(e,qt(ph));var i=Th(t,function(o,s,a){var l=Jr(e,function(u){return u(o)});return{criteria:l,index:++n,value:o}});return Oh(i,function(o,s){return Mh(o,s,r)})}var Lh,Nh=A(()=>{va();So();hh();Dh();Ih();ri();Rh();Zn();nt();Lh=X0});var Z0,Qa,Bh=A(()=>{sd();Nh();Wc();$c();Z0=Vc(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Ca(t,e[0],e[1])?e=[]:r>2&&Ca(e[0],e[1],e[2])&&(e=[e[0]]),Lh(t,od(e,1),[])}),Qa=Z0});var yn=A(()=>{xp();Ch();Fh();Bh();});function _t(t,e){if(!e.length)return t;try{let r=new RegExp(e.map(i=>`\\b${wr(i.match)}\\b${/[a-zA-Z]/.test(i.match)?"":`|${wr(i.match)}`}`).join("|"),"giu"),n=i=>e.find(s=>i.match(new RegExp(`\\b${wr(s.match)}\\b${/[a-zA-Z]/.test(s.match)?"":`|${wr(s.match)}`}`,"giu")))?`<span class="${Iu}">${i}</span>`:i;return t.replace(r,n)}catch(r){return console.error("Omnisearch - Error in highlightText()",r),t}}function e1(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function _n(t){if(!t.length)return/^$/g;t.sort((r,n)=>n.length-r.length);let e=`(${t.map(r=>wr(r)).join("|")})`;return new RegExp(`${e}`,"gui")}function di(t,e,r){let n=new RegExp(pa,"gu"),i=t;t=t.toLowerCase().replace(n," "),T.ignoreDiacritics&&(t=Tt(t));let o=new Date().getTime(),s=null,a=[],l=0;for(;(s=e.exec(t))!==null;){if(++l>=100||new Date().getTime()-o>50){$u("Stopped getMatches at",l,"results");break}let u=s.index,c=u+s[0].length,d=i.substring(u,c).trim();d&&s.index>=0&&a.push({match:d,offset:s.index})}if(r&&(r.query.text.length>1||r.getExactTerms().length>0)){let u=t.indexOf(r.getBestStringForExcerpt());u>-1&&a.find(c=>c.offset===u)&&(a=a.filter(c=>c.offset!==u),a.unshift({offset:u,match:r.getBestStringForExcerpt()}))}return a}function vn(t,e){try{let r=e??-1,n=Math.max(0,r-Ou),i=Math.min(t.length,r+Qn);if(r>-1?t=(n>0?"\u2026":"")+t.slice(n,i).trim()+(i<t.length-1?"\u2026":""):t=t.slice(0,Qn),T.renderLineReturnInExcerpts){let o=new RegExp(/(?:\r\n|\r|\n)/g);t=t.split(o).filter(a=>a).join(`
`);let s=t.lastIndexOf(`
`,r-n);s>0&&(t=t.slice(s))}return t=e1(t),T.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
`,"<br>")),{content:t,offset:r}}catch(r){return new Kh.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(r),{content:"",offset:-1}}}var Kh,jr=A(()=>{st();et();ht();Kh=ve(require("obsidian"));yn()});var Xh=gi(Go=>{Go.parse=function(t,e){if(e?e.offsets=typeof e.offsets=="undefined"?!0:e.offsets:e={offsets:!0},t||(t=""),t.indexOf(":")===-1&&!e.tokenize)return t;if(!e.keywords&&!e.ranges&&!e.tokenize)return t;var r={text:[]};e.offsets&&(r.offsets=[]);for(var n={},i=[],o=/(\S+:'(?:[^'\\]|\\.)*')|(\S+:"(?:[^"\\]|\\.)*")|(-?"(?:[^"\\]|\\.)*")|(-?'(?:[^'\\]|\\.)*')|\S+|\S+:\S+/g,s;(s=o.exec(t))!==null;){var f=s[0],a=f.indexOf(":");if(a!==-1){var l=f.split(":"),u=f.slice(0,a),c=f.slice(a+1);c=c.replace(/^\"|\"$|^\'|\'$/g,""),c=(c+"").replace(/\\(.?)/g,function(_,w){switch(w){case"\\":return"\\";case"0":return"\0";case"":return"";default:return w}}),i.push({keyword:u,value:c,offsetStart:s.index,offsetEnd:s.index+f.length})}else{var d=!1;f[0]==="-"&&(d=!0,f=f.slice(1)),f=f.replace(/^\"|\"$|^\'|\'$/g,""),f=(f+"").replace(/\\(.?)/g,function(_,w){switch(w){case"\\":return"\\";case"0":return"\0";case"":return"";default:return w}}),d?n.text?(n.text instanceof Array||(n.text=[n.text]),n.text.push(f)):n.text=f:i.push({text:f,offsetStart:s.index,offsetEnd:s.index+f.length})}}i.reverse();for(var f;f=i.pop();)if(f.text)r.text.push(f.text),e.offsets&&r.offsets.push(f);else{var u=f.keyword;e.keywords=e.keywords||[];var h=!1,y=!1;if(!/^-/.test(u))h=e.keywords.indexOf(u)!==-1;else if(u[0]==="-"){var j=u.slice(1);h=e.keywords.indexOf(j)!==-1,h&&(u=j,y=!0)}e.ranges=e.ranges||[];var v=e.ranges.indexOf(u)!==-1;if(h){e.offsets&&r.offsets.push({keyword:u,value:f.value,offsetStart:y?f.offsetStart+1:f.offsetStart,offsetEnd:f.offsetEnd});var p=f.value;if(p.length){var b=p.split(",");y?n[u]?n[u]instanceof Array?b.length>1?n[u]=n[u].concat(b):n[u].push(p):(n[u]=[n[u]],n[u].push(p)):b.length>1?n[u]=b:e.alwaysArray?n[u]=[p]:n[u]=p:r[u]?r[u]instanceof Array?b.length>1?r[u]=r[u].concat(b):r[u].push(p):(r[u]=[r[u]],r[u].push(p)):b.length>1?r[u]=b:e.alwaysArray?r[u]=[p]:r[u]=p}}else if(v){e.offsets&&r.offsets.push(f);var p=f.value,m=p.split("-");r[u]={},m.length===2?(r[u].from=m[0],r[u].to=m[1]):!m.length%2||(r[u].from=p)}else{var g=f.keyword+":"+f.value;r.text.push(g),e.offsets&&r.offsets.push({text:g,offsetStart:f.offsetStart,offsetEnd:f.offsetEnd})}}return r.text.length?e.tokenize||(r.text=r.text.join(" ").trim()):delete r.text,r.exclude=n,r};Go.stringify=function(t,e,r){if(e||(e={offsets:!0}),!t)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");if(!Object.keys(t).length)return"";if(Object.keys(t).length===3&&!!t.text&&!!t.offsets&&!!t.exclude&&typeof t.text=="string")return t.text;r||(r="");var n=function(a){return a.indexOf(" ")>-1?JSON.stringify(a):a},i=function(a){return r+a},o=[];if(t.text){var s=[];typeof t.text=="string"?s.push(t.text):s.push.apply(s,t.text),s.length>0&&o.push(s.map(n).map(i).join(" "))}return e.keywords&&e.keywords.forEach(function(a){if(!!t[a]){var l=[];typeof t[a]=="string"?l.push(t[a]):l.push.apply(l,t[a]),l.length>0&&o.push(i(a+":"+l.map(n).join(",")))}}),e.ranges&&e.ranges.forEach(function(a){if(!!t[a]){var l=t[a].from,u=t[a].to;u&&(l=l+"-"+u),l&&o.push(i(a+":"+l))}}),t.exclude&&Object.keys(t.exclude).length>0&&o.push(Go.stringify(t.exclude,e,"-")),o.join(" ")}});var em=gi((_P,Zh)=>{Zh.exports=Xh()});var tm,Ya,Ar,Qo=A(()=>{et();ht();tm=ve(em()),Ya=["ext","path"],Ar=class{#e;constructor(e=""){T.ignoreDiacritics&&(e=Tt(e));let r=(0,tm.parse)(e.toLowerCase(),{tokenize:!0,keywords:Ya});r.text=r.text??[],r.exclude=r.exclude??{},r.exclude.text=r.exclude.text??[],Array.isArray(r.exclude.text)||(r.exclude.text=[r.exclude.text]),r.exclude.text=r.exclude.text.filter(i=>i.length);for(let i of Ya){let o=r[i];o&&(r[i]=Array.isArray(o)?o:[o]);let s=r.exclude[i];s&&(r.exclude[i]=Array.isArray(s)?s:[s])}this.query=r;let n=this.query.text.filter(i=>i.startsWith(".")).map(i=>i.slice(1));this.query.ext=[...new Set([...n,...this.query.ext??[]])],this.query.text=this.query.text.filter(i=>!i.startsWith(".")),this.#e=e.match(/"([^"]+)"/g)?.map(i=>i.replace(/"/g,""))??[]}isEmpty(){for(let e of Ya)if(this.query[e]?.length||this.query.text.length)return!1;return!0}segmentsToStr(){return this.query.text.join(" ")}getTags(){return this.query.text.filter(e=>e.startsWith("#"))}getTagsWithoutHashtag(){return this.getTags().map(e=>e.replace(/^#/,""))}getExactTerms(){return[...new Set([...this.query.text.filter(e=>e.split(" ").length>1),...this.#e].map(e=>e.toLowerCase()))]}getBestStringForExcerpt(){return this.#e.length?this.#e.sort((e,r)=>r.length-e.length)[0]??"":this.segmentsToStr()}}});function l1(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(n.next(c))}catch(d){s(d)}}function l(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})}function u1(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function q(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function be(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}var le,c1,rm,nm,Me,Ja,bn,f1,im,Xa,qo,Za,el,d1,om,sm,tl,pi,rl,am,p1,nl,il,h1,m1,g1,y1,ol,lm,_1,sl,al,ll,v1,um,cm,fm,Yo,b1,dm=A(()=>{le=function(){return le=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},le.apply(this,arguments)};c1="ENTRIES",rm="KEYS",nm="VALUES",Me="",Ja=function(){function t(e,r){var n=e._tree,i=Array.from(n.keys());this.set=e,this._type=r,this._path=i.length>0?[{node:n,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=bn(this._path),r=e.node,n=e.keys;if(bn(n)===Me)return{done:!1,value:this.result()};var i=r.get(bn(n));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},t.prototype.backtrack=function(){if(this._path.length!==0){var e=bn(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var r=e.keys;return bn(r)}).filter(function(e){return e!==Me}).join("")},t.prototype.value=function(){return bn(this._path).node.get(Me)},t.prototype.result=function(){switch(this._type){case nm:return this.value();case rm:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),bn=function(t){return t[t.length-1]},f1=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,o=i+r,s=new Uint8Array(o*i).fill(r+1),a=0;a<i;++a)s[a]=a;for(var l=1;l<o;++l)s[l*i]=l;return im(t,e,r,n,s,1,i,""),n},im=function(t,e,r,n,i,o,s,a){var l,u,c=o*s;try{e:for(var d=q(t.keys()),f=d.next();!f.done;f=d.next()){var h=f.value;if(h===Me){var y=i[c-1];y<=r&&n.set(a,[t.get(h),y])}else{for(var j=o,v=0;v<h.length;++v,++j){for(var p=h[v],b=s*j,m=b-s,g=i[b],x=Math.max(0,j-r-1),_=Math.min(s-1,j+r),w=x;w<_;++w){var S=p!==e[w],E=i[m+w]+ +S,D=i[m+w+1]+1,O=i[b+w]+1,L=i[b+w+1]=Math.min(E,D,O);L<g&&(g=L)}if(g>r)continue e}im(t.get(h),e,r,n,i,j,s,a+h)}}}catch(k){l={error:k}}finally{try{f&&!f.done&&(u=d.return)&&u.call(d)}finally{if(l)throw l.error}}},Xa=function(){function t(e,r){e===void 0&&(e=new Map),r===void 0&&(r=""),this._size=void 0,this._tree=e,this._prefix=r}return t.prototype.atPrefix=function(e){var r,n;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=be(qo(this._tree,e.slice(this._prefix.length)),2),o=i[0],s=i[1];if(o===void 0){var a=be(tl(s),2),l=a[0],u=a[1];try{for(var c=q(l.keys()),d=c.next();!d.done;d=c.next()){var f=d.value;if(f!==Me&&f.startsWith(u)){var h=new Map;return h.set(f.slice(u.length),l.get(f)),new t(h,e)}}}catch(y){r={error:y}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}return new t(o,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,d1(this._tree,e)},t.prototype.entries=function(){return new Ja(this,c1)},t.prototype.forEach=function(e){var r,n;try{for(var i=q(this),o=i.next();!o.done;o=i.next()){var s=be(o.value,2),a=s[0],l=s[1];e(a,l,this)}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return f1(this._tree,e,r)},t.prototype.get=function(e){var r=Za(this._tree,e);return r!==void 0?r.get(Me):void 0},t.prototype.has=function(e){var r=Za(this._tree,e);return r!==void 0&&r.has(Me)},t.prototype.keys=function(){return new Ja(this,rm)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=el(this._tree,e);return n.set(Me,r),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=el(this._tree,e);return n.set(Me,r(n.get(Me))),this},t.prototype.fetch=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=el(this._tree,e),i=n.get(Me);return i===void 0&&n.set(Me,i=r()),i},t.prototype.values=function(){return new Ja(this,nm)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var o=q(e),s=o.next();!s.done;s=o.next()){var a=be(s.value,2),l=a[0],u=a[1];i.set(l,u)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),qo=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var o=q(t.keys()),s=o.next();!s.done;s=o.next()){var a=s.value;if(a!==Me&&e.startsWith(a))return r.push([t,a]),qo(t.get(a),e.slice(a.length),r)}}catch(l){n={error:l}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r.push([t,e]),qo(void 0,"",r)},Za=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=q(t.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!==Me&&e.startsWith(s))return Za(t.get(s),e.slice(s.length))}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},el=function(t,e){var r,n,i=e.length;e:for(var o=0;t&&o<i;){try{for(var s=(r=void 0,q(t.keys())),a=s.next();!a.done;a=s.next()){var l=a.value;if(l!==Me&&e[o]===l[0]){for(var u=Math.min(i-o,l.length),c=1;c<u&&e[o+c]===l[c];)++c;var d=t.get(l);if(c===l.length)t=d;else{var f=new Map;f.set(l.slice(c),d),t.set(e.slice(o,o+c),f),t.delete(l),t=f}o+=c;continue e}}}catch(y){r={error:y}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}var h=new Map;return t.set(e.slice(o),h),h}return t},d1=function(t,e){var r=be(qo(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(Me),n.size===0)om(i);else if(n.size===1){var o=be(n.entries().next().value,2),s=o[0],a=o[1];sm(i,s,a)}}},om=function(t){if(t.length!==0){var e=be(tl(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)om(t.slice(0,-1));else if(r.size===1){var i=be(r.entries().next().value,2),o=i[0],s=i[1];o!==Me&&sm(t.slice(0,-1),o,s)}}},sm=function(t,e,r){if(t.length!==0){var n=be(tl(t),2),i=n[0],o=n[1];i.set(o+e,r),i.delete(o)}},tl=function(t){return t[t.length-1]},rl="or",am="and",p1="and_not",nl=function(){function t(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');var r=e.autoVacuum==null||e.autoVacuum===!0?ll:e.autoVacuum;this._options=le(le(le({},ol),e),{autoVacuum:r,searchOptions:le(le({},lm),e.searchOptions||{}),autoSuggestOptions:le(le({},_1),e.autoSuggestOptions||{})}),this._index=new Xa,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=al,this.addFields(this._options.fields)}return t.prototype.add=function(e){var r,n,i,o,s,a,l=this._options,u=l.extractField,c=l.tokenize,d=l.processTerm,f=l.fields,h=l.idField,y=u(e,h);if(y==null)throw new Error('MiniSearch: document does not have ID field "'.concat(h,'"'));if(this._idToShortId.has(y))throw new Error("MiniSearch: duplicate ID ".concat(y));var j=this.addDocumentId(y);this.saveStoredFields(j,e);try{for(var v=q(f),p=v.next();!p.done;p=v.next()){var b=p.value,m=u(e,b);if(m!=null){var g=c(m.toString(),b),x=this._fieldIds[b],_=new Set(g).size;this.addFieldLength(j,x,this._documentCount-1,_);try{for(var w=(i=void 0,q(g)),S=w.next();!S.done;S=w.next()){var E=S.value,D=d(E,b);if(Array.isArray(D))try{for(var O=(s=void 0,q(D)),L=O.next();!L.done;L=O.next()){var k=L.value;this.addTerm(x,j,k)}}catch(H){s={error:H}}finally{try{L&&!L.done&&(a=O.return)&&a.call(O)}finally{if(s)throw s.error}}else D&&this.addTerm(x,j,D)}}catch(H){i={error:H}}finally{try{S&&!S.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}}}}catch(H){r={error:H}}finally{try{p&&!p.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=q(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.add(s)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.addAllAsync=function(e,r){var n=this;r===void 0&&(r={});var i=r.chunkSize,o=i===void 0?10:i,s={chunk:[],promise:Promise.resolve()},a=e.reduce(function(c,d,f){var h=c.chunk,y=c.promise;return h.push(d),(f+1)%o==0?{chunk:[],promise:y.then(function(){return new Promise(function(j){return setTimeout(j,0)})}).then(function(){return n.addAll(h)})}:{chunk:h,promise:y}},s),l=a.chunk,u=a.promise;return u.then(function(){return n.addAll(l)})},t.prototype.remove=function(e){var r,n,i,o,s,a,l=this._options,u=l.tokenize,c=l.processTerm,d=l.extractField,f=l.fields,h=l.idField,y=d(e,h);if(y==null)throw new Error('MiniSearch: document does not have ID field "'.concat(h,'"'));var j=this._idToShortId.get(y);if(j==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(y,": it is not in the index"));try{for(var v=q(f),p=v.next();!p.done;p=v.next()){var b=p.value,m=d(e,b);if(m!=null){var g=u(m.toString(),b),x=this._fieldIds[b],_=new Set(g).size;this.removeFieldLength(j,x,this._documentCount,_);try{for(var w=(i=void 0,q(g)),S=w.next();!S.done;S=w.next()){var E=S.value,D=c(E,b);if(Array.isArray(D))try{for(var O=(s=void 0,q(D)),L=O.next();!L.done;L=O.next()){var k=L.value;this.removeTerm(x,j,k)}}catch(H){s={error:H}}finally{try{L&&!L.done&&(a=O.return)&&a.call(O)}finally{if(s)throw s.error}}else D&&this.removeTerm(x,j,D)}}catch(H){i={error:H}}finally{try{S&&!S.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}}}}catch(H){r={error:H}}finally{try{p&&!p.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}this._storedFields.delete(j),this._documentIds.delete(j),this._idToShortId.delete(y),this._fieldLength.delete(j),this._documentCount-=1},t.prototype.removeAll=function(e){var r,n;if(e)try{for(var i=q(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.remove(s)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Xa,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var r=this,n=this._idToShortId.get(e);if(n==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach(function(i,o){r.removeFieldLength(n,o,r._documentCount,i)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,r=e.minDirtFactor,n=e.minDirtCount,i=e.batchSize,o=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:o},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var o=q(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.discard(a)}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var r=this._options,n=r.idField,i=r.extractField,o=i(e,n);this.discard(o),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,r){var n=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=n._enqueuedVacuumConditions;return n._enqueuedVacuumConditions=al,n.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},t.prototype.performVacuuming=function(e,r){return l1(this,void 0,void 0,function(){var n,i,o,s,a,l,u,c,d,f,h,y,j,v,p,b,m,g,x,_,w,S,E,D,O;return u1(this,function(L){switch(L.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||sl.batchSize,o=e.batchWait||sl.batchWait,s=1,L.label=1;case 1:L.trys.push([1,7,8,9]),a=q(this._index),l=a.next(),L.label=2;case 2:if(l.done)return[3,6];u=be(l.value,2),c=u[0],d=u[1];try{for(f=(S=void 0,q(d)),h=f.next();!h.done;h=f.next()){y=be(h.value,2),j=y[0],v=y[1];try{for(p=(D=void 0,q(v)),b=p.next();!b.done;b=p.next())m=be(b.value,1),g=m[0],!this._documentIds.has(g)&&(v.size<=1?d.delete(j):v.delete(g))}catch(k){D={error:k}}finally{try{b&&!b.done&&(O=p.return)&&O.call(p)}finally{if(D)throw D.error}}}}catch(k){S={error:k}}finally{try{h&&!h.done&&(E=f.return)&&E.call(f)}finally{if(S)throw S.error}}return this._index.get(c).size===0&&this._index.delete(c),s%i!=0?[3,4]:[4,new Promise(function(k){return setTimeout(k,o)})];case 3:L.sent(),L.label=4;case 4:s+=1,L.label=5;case 5:return l=a.next(),[3,2];case 6:return[3,9];case 7:return x=L.sent(),_={error:x},[3,9];case 8:try{l&&!l.done&&(w=a.return)&&w.call(a)}finally{if(_)throw _.error}return[7];case 9:this._dirtCount-=n,L.label=10;case 10:return[4,null];case 11:return L.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var r=e.minDirtCount,n=e.minDirtFactor;return r=r||ll.minDirtCount,n=n||ll.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.getStoredFields=function(e){var r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)},t.prototype.search=function(e,r){var n,i;r===void 0&&(r={});var o=this.executeQuery(e,r),s=[];try{for(var a=q(o),l=a.next();!l.done;l=a.next()){var u=be(l.value,2),c=u[0],d=u[1],f=d.score,h=d.terms,y=d.match,j=h.length||1,v={id:this._documentIds.get(c),score:f*j,terms:Object.keys(y),queryTerms:h,match:y};Object.assign(v,this._storedFields.get(c)),(r.filter==null||r.filter(v))&&s.push(v)}}catch(p){n={error:p}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return e===t.wildcard&&r.boostDocument==null&&this._options.searchOptions.boostDocument==null||s.sort(cm),s},t.prototype.autoSuggest=function(e,r){var n,i,o,s;r===void 0&&(r={}),r=le(le({},this._options.autoSuggestOptions),r);var a=new Map;try{for(var l=q(this.search(e,r)),u=l.next();!u.done;u=l.next()){var c=u.value,d=c.score,f=c.terms,h=f.join(" "),y=a.get(h);y!=null?(y.score+=d,y.count+=1):a.set(h,{score:d,terms:f,count:1})}}catch(x){n={error:x}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}var j=[];try{for(var v=q(a),p=v.next();!p.done;p=v.next()){var b=be(p.value,2),y=b[0],m=b[1],d=m.score,f=m.terms,g=m.count;j.push({suggestion:y,terms:f,score:d/g})}}catch(x){o={error:x}}finally{try{p&&!p.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return j.sort(cm),j},Object.defineProperty(t.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),t.loadJSON=function(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)},t.getDefault=function(e){if(ol.hasOwnProperty(e))return il(ol,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,o,s,a,l,u=e.index,c=e.documentCount,d=e.nextId,f=e.documentIds,h=e.fieldIds,y=e.fieldLength,j=e.averageFieldLength,v=e.storedFields,p=e.dirtCount,b=e.serializationVersion;if(b!==1&&b!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var m=new t(r);m._documentCount=c,m._nextId=d,m._documentIds=Yo(f),m._idToShortId=new Map,m._fieldIds=h,m._fieldLength=Yo(y),m._avgFieldLength=j,m._storedFields=Yo(v),m._dirtCount=p||0,m._index=new Xa;try{for(var g=q(m._documentIds),x=g.next();!x.done;x=g.next()){var _=be(x.value,2),w=_[0],S=_[1];m._idToShortId.set(S,w)}}catch(F){n={error:F}}finally{try{x&&!x.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}try{for(var E=q(u),D=E.next();!D.done;D=E.next()){var O=be(D.value,2),L=O[0],k=O[1],H=new Map;try{for(var X=(a=void 0,q(Object.keys(k))),Y=X.next();!Y.done;Y=X.next()){var J=Y.value,C=k[J];b===1&&(C=C.ds),H.set(parseInt(J,10),Yo(C))}}catch(F){a={error:F}}finally{try{Y&&!Y.done&&(l=X.return)&&l.call(X)}finally{if(a)throw a.error}}m._index.set(L,H)}}catch(F){o={error:F}}finally{try{D&&!D.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}return m},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),e===t.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){var i=le(le(le({},r),e),{queries:void 0}),o=e.queries.map(function(v){return n.executeQuery(v,i)});return this.combineResults(o,i.combineWith)}var s=this._options,a=s.tokenize,l=s.processTerm,u=s.searchOptions,c=le(le({tokenize:a,processTerm:l},u),r),d=c.tokenize,f=c.processTerm,h=d(e).flatMap(function(v){return f(v)}).filter(function(v){return!!v}),y=h.map(y1(c)),j=y.map(function(v){return n.executeQuerySpec(v,c)});return this.combineResults(j,c.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,o,s,a=le(le({},this._options.searchOptions),r),l=(a.fields||this._options.fields).reduce(function(J,C){var F;return le(le({},J),(F={},F[C]=il(a.boost,C)||1,F))},{}),u=a.boostDocument,c=a.weights,d=a.maxFuzzy,f=a.bm25,h=le(le({},lm.weights),c),y=h.fuzzy,j=h.prefix,v=this._index.get(e.term),p=this.termResults(e.term,e.term,1,v,l,u,f),b,m;if(e.prefix&&(b=this._index.atPrefix(e.term)),e.fuzzy){var g=e.fuzzy===!0?.2:e.fuzzy,x=g<1?Math.min(d,Math.round(e.term.length*g)):g;x&&(m=this._index.fuzzyGet(e.term,x))}if(b)try{for(var _=q(b),w=_.next();!w.done;w=_.next()){var S=be(w.value,2),E=S[0],D=S[1],O=E.length-e.term.length;if(!!O){m==null||m.delete(E);var L=j*E.length/(E.length+.3*O);this.termResults(e.term,E,L,D,l,u,f,p)}}}catch(J){n={error:J}}finally{try{w&&!w.done&&(i=_.return)&&i.call(_)}finally{if(n)throw n.error}}if(m)try{for(var k=q(m.keys()),H=k.next();!H.done;H=k.next()){var E=H.value,X=be(m.get(E),2),Y=X[0],O=X[1];if(!!O){var L=y*E.length/(E.length+O);this.termResults(e.term,E,L,Y,l,u,f,p)}}}catch(J){o={error:J}}finally{try{H&&!H.done&&(s=k.return)&&s.call(k)}finally{if(o)throw o.error}}return p},t.prototype.executeWildcardQuery=function(e){var r,n,i=new Map,o=le(le({},this._options.searchOptions),e);try{for(var s=q(this._documentIds),a=s.next();!a.done;a=s.next()){var l=be(a.value,2),u=l[0],c=l[1],d=o.boostDocument?o.boostDocument(c,"",this._storedFields.get(u)):1;i.set(u,{score:d,terms:[],match:{}})}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=rl),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(h1[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,o=[];try{for(var s=q(this._index),a=s.next();!a.done;a=s.next()){var l=be(a.value,2),u=l[0],c=l[1],d={};try{for(var f=(n=void 0,q(c)),h=f.next();!h.done;h=f.next()){var y=be(h.value,2),j=y[0],v=y[1];d[j]=Object.fromEntries(v)}}catch(p){n={error:p}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}o.push([u,d])}}catch(p){e={error:p}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:o,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,o,s,a,l){var u,c,d,f,h;if(l===void 0&&(l=new Map),i==null)return l;try{for(var y=q(Object.keys(o)),j=y.next();!j.done;j=y.next()){var v=j.value,p=o[v],b=this._fieldIds[v],m=i.get(b);if(m!=null){var g=m.size,x=this._avgFieldLength[b];try{for(var _=(d=void 0,q(m.keys())),w=_.next();!w.done;w=_.next()){var S=w.value;if(!this._documentIds.has(S)){this.removeTerm(b,S,r),g-=1;continue}var E=s?s(this._documentIds.get(S),r,this._storedFields.get(S)):1;if(!!E){var D=m.get(S),O=this._fieldLength.get(S)[b],L=g1(D,g,this._documentCount,O,x,a),k=n*p*E*L,H=l.get(S);if(H){H.score+=k,v1(H.terms,e);var X=il(H.match,r);X?X.push(v):H.match[r]=[v]}else l.set(S,{score:k,terms:[e],match:(h={},h[r]=[v],h)})}}}catch(Y){d={error:Y}}finally{try{w&&!w.done&&(f=_.return)&&f.call(_)}finally{if(d)throw d.error}}}}}catch(Y){u={error:Y}}finally{try{j&&!j.done&&(c=y.return)&&c.call(y)}finally{if(u)throw u.error}}return l},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,fm),o=i.get(e);if(o==null)o=new Map,o.set(r,1),i.set(e,o);else{var s=o.get(r);o.set(r,(s||0)+1)}},t.prototype.removeTerm=function(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}var i=this._index.fetch(n,fm),o=i.get(e);o==null||o.get(r)==null?this.warnDocumentChanged(r,e,n):o.get(r)<=1?o.size<=1?i.delete(e):o.delete(r):o.set(r,o.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,o;try{for(var s=q(Object.keys(this._fieldIds)),a=s.next();!a.done;a=s.next()){var l=a.value;if(this._fieldIds[l]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var o=this._fieldLength.get(e);o==null&&this._fieldLength.set(e,o=[]),o[r]=i;var s=this._avgFieldLength[r]||0,a=s*n+i;this._avgFieldLength[r]=a/(n+1)},t.prototype.removeFieldLength=function(e,r,n,i){if(n===1){this._avgFieldLength[r]=0;return}var o=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=o/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,o=this._options,s=o.storeFields,a=o.extractField;if(!(s==null||s.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var u=q(s),c=u.next();!c.done;c=u.next()){var d=c.value,f=a(r,d);f!==void 0&&(l[d]=f)}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}},t.wildcard=Symbol("*"),t}(),il=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},h1=(pi={},pi[rl]=function(t,e){var r,n;try{for(var i=q(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value,a=t.get(s);if(a==null)t.set(s,e.get(s));else{var l=e.get(s),u=l.score,c=l.terms,d=l.match;a.score=a.score+u,a.match=Object.assign(a.match,d),um(a.terms,c)}}}catch(f){r={error:f}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},pi[am]=function(t,e){var r,n,i=new Map;try{for(var o=q(e.keys()),s=o.next();!s.done;s=o.next()){var a=s.value,l=t.get(a);if(l!=null){var u=e.get(a),c=u.score,d=u.terms,f=u.match;um(l.terms,d),i.set(a,{score:l.score+c,terms:l.terms,match:Object.assign(l.match,f)})}}}catch(h){r={error:h}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},pi[p1]=function(t,e){var r,n;try{for(var i=q(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;t.delete(s)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},pi),m1={k:1.2,b:.7,d:.5},g1=function(t,e,r,n,i,o){var s=o.k,a=o.b,l=o.d,u=Math.log(1+(r-e+.5)/(e+.5));return u*(l+t*(s+1)/(t+s*(1-a+a*n/i)))},y1=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,o=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:o}}},ol={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t){return t.split(b1)},processTerm:function(t){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e){typeof(console==null?void 0:console[t])=="function"&&console[t](e)},autoVacuum:!0},lm={combineWith:rl,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:m1},_1={combineWith:am,prefix:function(t,e,r){return e===r.length-1}},sl={batchSize:1e3,batchWait:10},al={minDirtFactor:.1,minDirtCount:20},ll=le(le({},sl),al),v1=function(t,e){t.includes(e)||t.push(e)},um=function(t,e){var r,n;try{for(var i=q(e),o=i.next();!o.done;o=i.next()){var s=o.value;t.includes(s)||t.push(s)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},cm=function(t,e){var r=t.score,n=e.score;return n-r},fm=function(){return new Map},Yo=function(t){var e,r,n=new Map;try{for(var i=q(Object.keys(t)),o=i.next();!o.done;o=i.next()){var s=o.value;n.set(parseInt(s,10),t[s])}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},b1=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u});function pm(t){return t.split(ku)}function hm(t){return t.split(qn)}function mm(t){let e=pm(t),r=hm(t);r=[...r,...r.flatMap(ya)],r=[...r,...r.flatMap(ga)],r=[...r,...e];let n=da();if(n){let i=r.flatMap(o=>ua.test(o)?n.cut(o):[o]);r=[...r,...i]}return r=[...new Set(r)],r}function gm(t){let e=hm(t),r=[],n=da();return n&&(r=e.flatMap(i=>ua.test(i)?n.cut(i):[i])),{combineWith:"OR",queries:[{combineWith:"AND",queries:e},{combineWith:"AND",queries:pm(t)},{combineWith:"AND",queries:e.flatMap(ya)},{combineWith:"AND",queries:e.flatMap(ga)},{combineWith:"AND",queries:r}]}}var ym=A(()=>{st();ht()});var _m,Jo,ul,Ee,xn=A(()=>{dm();et();ht();_m=ve(require("obsidian"));Qr();yn();jr();ym();Jo=class{constructor(){this.indexedDocuments=new Map;this.minisearch=new nl(Jo.options)}async loadCache(){let e=await Se.getMinisearchCache();return e?(this.minisearch=nl.loadJS(e.data,Jo.options),this.indexedDocuments=new Map(e.paths.map(r=>[r.path,r.mtime])),!0):(console.log("Omnisearch - No cache found"),!1)}getDiff(e){let r=new Map(e.map(o=>[o.path,o.mtime])),n=e.filter(o=>!this.indexedDocuments.has(o.path)||this.indexedDocuments.get(o.path)!==o.mtime),i=[...this.indexedDocuments].filter(([o,s])=>!r.has(o)||r.get(o)!==s).map(o=>({path:o[0],mtime:o[1]}));return{toAdd:n,toRemove:i}}async addFromPaths(e){he("Adding files",e);let r=(await Promise.all(e.map(async i=>await Se.getDocument(i)))).filter(i=>!!i?.path);he("Sorting documents to first index markdown"),r=Qa(r,i=>i.path.endsWith(".md")?0:1),this.removeFromPaths(r.filter(i=>this.indexedDocuments.has(i.path)).map(i=>i.path));let n=Wu(r,500);for(let i of n){he("Indexing into search engine",i),i.forEach(s=>this.indexedDocuments.set(s.path,s.mtime));let o=i.filter(s=>this.minisearch.has(s.path));this.removeFromPaths(o.map(s=>s.path)),await this.minisearch.addAllAsync(i)}}removeFromPaths(e){e.forEach(n=>this.indexedDocuments.delete(n));let r=e.filter(n=>this.minisearch.has(n));this.minisearch.discardAll(r)}async search(e,r){if(e.isEmpty())return[];he("=== New search ==="),he("Starting search for",e);let n;switch(T.fuzziness){case"0":n=0;break;case"1":n=.1;break;default:n=.2;break}let i=gm(e.segmentsToStr());he(JSON.stringify(i,null,1));let o=this.minisearch.search(i,{prefix:c=>c.length>=r.prefixLength,fuzzy:c=>c.length<=3?0:c.length<=5?n/2:n,boost:{basename:T.weightBasename,directory:T.weightDirectory,aliases:T.weightBasename,headings1:T.weightH1,headings2:T.weightH2,headings3:T.weightH3,unmarkedTags:T.weightUnmarkedTags}});if(he("Found",o.length,"results"),e.query.ext?.length&&(o=o.filter(c=>{let d="."+c.id.split(".").pop();return e.query.ext?.some(f=>d.startsWith(f.startsWith(".")?f:"."+f))})),e.query.path&&(o=o.filter(c=>e.query.path?.some(d=>c.id.toLowerCase().includes(d.toLowerCase())))),e.query.exclude.path&&(o=o.filter(c=>!e.query.exclude.path?.some(d=>c.id.toLowerCase().includes(d.toLowerCase())))),!o.length)return[];if(r.singleFilePath)return o.filter(c=>c.id===r.singleFilePath);T.hideExcluded?o=o.filter(c=>!(app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(c.id))):o.forEach(c=>{app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(c.id)&&(c.score/=10)});let s=e.getTags();for(let c of s)for(let d of o)(d.tags??[]).includes(c)&&(d.score*=100);he("Sorting and limiting results"),o=o.sort((c,d)=>d.score-c.score).slice(0,50),o.length&&he("First result:",o[0]);let a=await Promise.all(o.map(async c=>await Se.getDocument(c.id))),l=e.getExactTerms();l.length&&(he("Filtering with quoted terms: ",l),o=o.filter(c=>{let d=a.find(y=>y.path===c.id),f=d?.path.toLowerCase()??"",h=(d?.cleanedContent??"").toLowerCase();return l.every(y=>h.includes(y)||Tt(f).includes(y))}));let u=e.query.exclude.text;return u.length&&(he("Filtering with exclusions"),o=o.filter(c=>{let d=(a.find(f=>f.path===c.id)?.content??"").toLowerCase();return u.every(f=>!d.includes(f))})),he("Deduping"),o=o.filter((c,d,f)=>f.findIndex(h=>h.id===c.id)===d),o}async getSuggestions(e,r){let n;T.simpleSearch?n=await this.search(e,{prefixLength:3,singleFilePath:r?.singleFilePath}):n=await this.search(e,{prefixLength:1,singleFilePath:r?.singleFilePath});let i=await Promise.all(n.map(async s=>await Se.getDocument(s.id)));return n.map(s=>{he("Locating matches for",s.id);let a=i.find(d=>d.path===s.id);a||(console.warn(`Omnisearch - Note "${s.id}" not in the live cache`),a={content:"",basename:s.id,path:s.id});let l=[...s.terms,...e.getExactTerms(),...e.getTags()].filter(d=>d.length>1||/\p{Emoji}/u.test(d));he("Matching tokens:",l),he("Getting matches locations...");let u=di(a.content,_n(l),e);return he(`Matches for ${a.basename}`,u),ye({score:s.score,foundWords:l,matches:u},a)})}async writeToCache(){await Se.writeMinisearchCache(this.minisearch,this.indexedDocuments)}},ul=Jo;ul.options={tokenize:mm,extractField:(e,r)=>{if(r==="directory"){let n=e.path.split("/");return n.pop(),n.join("/")}return e[r]},processTerm:e=>(T.ignoreDiacritics?Tt(e):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,r,n){n==="version_conflict"&&new _m.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}};Ee=new ul});function vm(t){cl.add(t)}async function Xo(){let t=[...cl].map(e=>e.path);t.length&&(Ee.removeFromPaths(t),await Ee.addFromPaths(t),cl.clear())}var cl,Zo=A(()=>{xn();cl=new Set});var bm=gi(es=>{function fl(t){return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fl(t)}(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof es!="undefined")e(es);else{var r={exports:{}};e(r.exports),t.CancelablePromise=r.exports}})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:es,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancelablePromise=void 0,t.cancelable=L,t.default=void 0,t.isCancelablePromise=k;function e(C,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function");C.prototype=Object.create(F&&F.prototype,{constructor:{value:C,writable:!0,configurable:!0}}),Object.defineProperty(C,"prototype",{writable:!1}),F&&r(C,F)}function r(C,F){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(K,Z){return K.__proto__=Z,K},r(C,F)}function n(C){var F=s();return function(){var K=a(C),Z;if(F){var se=a(this).constructor;Z=Reflect.construct(K,arguments,se)}else Z=K.apply(this,arguments);return i(this,Z)}}function i(C,F){if(F&&(fl(F)==="object"||typeof F=="function"))return F;if(F!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return o(C)}function o(C){if(C===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C}function s(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(C){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},a(C)}function l(C,F){var P=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(!P){if(Array.isArray(C)||(P=u(C))||F&&C&&typeof C.length=="number"){P&&(C=P);var K=0,Z=function(){};return{s:Z,n:function(){return K>=C.length?{done:!0}:{done:!1,value:C[K++]}},e:function(ge){throw ge},f:Z}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var se=!0,Fe=!1,B;return{s:function(){P=P.call(C)},n:function(){var ge=P.next();return se=ge.done,ge},e:function(ge){Fe=!0,B=ge},f:function(){try{!se&&P.return!=null&&P.return()}finally{if(Fe)throw B}}}}function u(C,F){if(!!C){if(typeof C=="string")return c(C,F);var P=Object.prototype.toString.call(C).slice(8,-1);if(P==="Object"&&C.constructor&&(P=C.constructor.name),P==="Map"||P==="Set")return Array.from(C);if(P==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(P))return c(C,F)}}function c(C,F){(F==null||F>C.length)&&(F=C.length);for(var P=0,K=new Array(F);P<F;P++)K[P]=C[P];return K}function d(C,F){if(!(C instanceof F))throw new TypeError("Cannot call a class as a function")}function f(C,F){for(var P=0;P<F.length;P++){var K=F[P];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(C,K.key,K)}}function h(C,F,P){return F&&f(C.prototype,F),P&&f(C,P),Object.defineProperty(C,"prototype",{writable:!1}),C}function y(C,F,P){return F in C?Object.defineProperty(C,F,{value:P,enumerable:!0,configurable:!0,writable:!0}):C[F]=P,C}function j(C,F,P){v(C,F),F.set(C,P)}function v(C,F){if(F.has(C))throw new TypeError("Cannot initialize the same private elements twice on an object")}function p(C,F){var P=g(C,F,"get");return b(C,P)}function b(C,F){return F.get?F.get.call(C):F.value}function m(C,F,P){var K=g(C,F,"set");return x(C,K,P),P}function g(C,F,P){if(!F.has(C))throw new TypeError("attempted to "+P+" private field on non-instance");return F.get(C)}function x(C,F,P){if(F.set)F.set.call(C,P);else{if(!F.writable)throw new TypeError("attempted to set read only private field");F.value=P}}var _=typeof Symbol!="undefined"?Symbol.toStringTag:"@@toStringTag",w=new WeakMap,S=new WeakMap,E=function(){function C(F){var P=F.executor,K=P===void 0?function(){}:P,Z=F.internals,se=Z===void 0?J():Z,Fe=F.promise,B=Fe===void 0?new Promise(function(ue,ge){return K(ue,ge,function(Oe){se.onCancelList.push(Oe)})}):Fe;d(this,C),j(this,w,{writable:!0,value:void 0}),j(this,S,{writable:!0,value:void 0}),y(this,_,"CancelablePromise"),this.cancel=this.cancel.bind(this),m(this,w,se),m(this,S,B||new Promise(function(ue,ge){return K(ue,ge,function(Oe){se.onCancelList.push(Oe)})}))}return h(C,[{key:"then",value:function(P,K){return X(p(this,S).then(H(P,p(this,w)),H(K,p(this,w))),p(this,w))}},{key:"catch",value:function(P){return X(p(this,S).catch(H(P,p(this,w))),p(this,w))}},{key:"finally",value:function(P,K){var Z=this;return K&&p(this,w).onCancelList.push(P),X(p(this,S).finally(H(function(){if(P)return K&&(p(Z,w).onCancelList=p(Z,w).onCancelList.filter(function(se){return se!==P})),P()},p(this,w))),p(this,w))}},{key:"cancel",value:function(){p(this,w).isCanceled=!0;var P=p(this,w).onCancelList;p(this,w).onCancelList=[];var K=l(P),Z;try{for(K.s();!(Z=K.n()).done;){var se=Z.value;if(typeof se=="function")try{se()}catch(Fe){console.error(Fe)}}}catch(Fe){K.e(Fe)}finally{K.f()}}},{key:"isCanceled",value:function(){return p(this,w).isCanceled===!0}}]),C}(),D=function(C){e(P,C);var F=n(P);function P(K){return d(this,P),F.call(this,{executor:K})}return h(P)}(E);t.CancelablePromise=D,y(D,"all",function(F){return Y(F,Promise.all(F))}),y(D,"allSettled",function(F){return Y(F,Promise.allSettled(F))}),y(D,"any",function(F){return Y(F,Promise.any(F))}),y(D,"race",function(F){return Y(F,Promise.race(F))}),y(D,"resolve",function(F){return L(Promise.resolve(F))}),y(D,"reject",function(F){return L(Promise.reject(F))}),y(D,"isCancelable",k);var O=D;t.default=O;function L(C){return X(C,J())}function k(C){return C instanceof D||C instanceof E}function H(C,F){if(C)return function(P){if(!F.isCanceled){var K=C(P);return k(K)&&F.onCancelList.push(K.cancel),K}return P}}function X(C,F){return new E({internals:F,promise:C})}function Y(C,F){var P=J();return P.onCancelList.push(function(){var K=l(C),Z;try{for(K.s();!(Z=K.n()).done;){var se=Z.value;k(se)&&se.cancel()}}catch(Fe){K.e(Fe)}finally{K.f()}}),new E({internals:P,promise:F})}function J(){return{isCanceled:!1,onCancelList:[]}}})});function H1(t){return t.map(e=>{let{score:r,path:n,basename:i,foundWords:o,matches:s,content:a}=e,l=vn(a,s[0]?.offset??-1);return{score:r,vault:app.vault.getName(),path:n,basename:i,foundWords:o,matches:s.map(c=>({match:c.match,offset:c.offset})),excerpt:l.content}})}async function V1(t){let e=new Ar(t),r=await Ee.getSuggestions(e);return H1(r)}function W1(t){rs.push(t),Mm&&t()}function $1(t){rs=rs.filter(e=>e!==t)}function Rm(){Mm=!0,rs.forEach(t=>t())}var Mm,rs,mi,pl=A(()=>{Qo();xn();jr();Zo();Mm=!1,rs=[];mi={search:V1,registerOnIndexed:W1,unregisterOnIndexed:$1,refreshIndex:Xo}});var Km={};bl(Km,{default:()=>U1,getServer:()=>Bm});function Bm(){let t=Lm.createServer(async function(e,r){r.setHeader("Access-Control-Allow-Origin","*"),r.setHeader("Access-Control-Allow-Methods","GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE"),r.setHeader("Access-Control-Allow-Headers","Access-Control-Allow-Headers, Origin, Authorization,Accept,x-client-id, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, hypothesis-client-version"),r.setHeader("Access-Control-Allow-Credentials","true");try{if(e.url){let n=Nm.parse(e.url,!0);if(n.pathname==="/search"){let i=n.query.q,o=await mi.search(i);r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify(o))}else r.end()}}catch(n){r.statusCode=500,r.end(n)}});return{listen(e){console.log(`Omnisearch - Starting HTTP server on port ${e}`),t.listen({port:parseInt(e),host:"localhost"},()=>{console.log(`Omnisearch - Started HTTP server on port ${e}`),T.httpApiNotice&&new ns.Notice(`Omnisearch - Started HTTP server on port ${e}`)}),t.on("error",r=>{console.error(r),new ns.Notice(`Omnisearch - Cannot start HTTP server on ${e}. See console for more details.`)})},close(){t.close(),console.log("Omnisearch - Terminated HTTP server"),T.httpApiEnabled&&T.httpApiNotice&&new ns.Notice("Omnisearch - Terminated HTTP server")}}}var Lm,Nm,ns,U1,zm=A(()=>{Lm=ve(require("http")),Nm=ve(require("url"));pl();ns=ve(require("obsidian"));et();U1=Bm});bl(exports,{default:()=>hl});var nr=ve(require("obsidian"));var ts=ve(require("obsidian"));Ze();var ut=ve(require("obsidian"));Ze();Ze();var Qu=ve(require("obsidian"));st();Qr();function Oy(t){let e,r,n,i,o,s,a,l,u=t[8].default,c=Fr(u,t,t[7],null);return{c(){e=M("div"),r=M("div"),n=M("input"),o=G(),c&&c.c(),N(n,"class","prompt-input"),N(n,"placeholder",t[0]),N(n,"spellcheck","false"),N(n,"type","text"),N(r,"class","omnisearch-input-field"),N(e,"class","omnisearch-input-container")},m(d,f){U(d,e,f),I(e,r),I(r,n),t[9](n),as(n,t[1]),I(e,o),c&&c.m(e,null),s=!0,a||(l=[Pe(n,"input",t[10]),Sl(i=t[3].call(null,n)),Pe(n,"compositionend",t[11]),Pe(n,"compositionstart",t[12]),Pe(n,"input",t[4])],a=!0)},p(d,[f]){(!s||f&1)&&N(n,"placeholder",d[0]),f&2&&n.value!==d[1]&&as(n,d[1]),c&&c.p&&(!s||f&128)&&Dr(c,u,d,d[7],s?Tr(u,d[7],f,null):Or(d[7]),null)},i(d){s||(te(c,d),s=!0)},o(d){ne(c,d),s=!1},d(d){d&&W(e),t[9](null),c&&c.d(d),a=!1,it(l)}}}function Iy(t,e,r){let{$$slots:n={},$$scope:i}=e,{initialValue:o=""}=e,{placeholder:s=""}=e,a=!1,l="",u,c=cs();function d(m){r(1,l=m)}function f(m){m&&!a&&!l&&(a=!0,r(1,l=m),h())}function h(m){kt().then(()=>(u.focus(),kt())).then(()=>{u.select()})}let y=(0,Qu.debounce)(()=>{Se.addToSearchHistory(""),c("input",l)},300);function j(m){vt[m?"unshift":"push"](()=>{u=m,r(2,u)})}function v(){l=this.value,r(1,l)}let p=m=>ca(!1),b=m=>ca(!0);return t.$$set=m=>{"initialValue"in m&&r(5,o=m.initialValue),"placeholder"in m&&r(0,s=m.placeholder),"$$scope"in m&&r(7,i=m.$$scope)},t.$$.update=()=>{if(t.$$.dirty&32){e:f(o)}},[s,l,u,h,y,o,d,i,n,j,v,p,b]}var qu=class extends ke{constructor(e){super();Ne(this,e,Iy,Oy,Te,{initialValue:5,placeholder:0,setInputValue:6})}get setInputValue(){return this.$$.ctx[6]}},to=qu;Ze();function Py(t){let e,r,n,i,o=t[1].default,s=Fr(o,t,t[0],null);return{c(){e=M("div"),s&&s.c(),N(e,"class","prompt-results")},m(a,l){U(a,e,l),s&&s.m(e,null),r=!0,n||(i=Pe(e,"mousedown",ky),n=!0)},p(a,[l]){s&&s.p&&(!r||l&1)&&Dr(s,o,a,a[0],r?Tr(o,a[0],l,null):Or(a[0]),null)},i(a){r||(te(s,a),r=!0)},o(a){ne(s,a),r=!1},d(a){a&&W(e),s&&s.d(a),n=!1,i()}}}var ky=t=>t.preventDefault();function My(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}var Yu=class extends ke{constructor(e){super();Ne(this,e,My,Py,Te,{})}},ro=Yu;st();var qa=ve(require("obsidian"));jr();async function $o(t,e=0,r=!1){let n=!1;app.workspace.iterateAllLeaves(s=>{s.view instanceof qa.MarkdownView&&!r&&s.getViewState().state?.file===t.path&&s.getViewState()?.pinned&&(app.workspace.setActiveLeaf(s,{focus:!0}),n=!0)}),n||await app.workspace.openLinkText(t.path,"",r);let i=app.workspace.getActiveViewOfType(qa.MarkdownView);if(!i)return;let o=i.editor.offsetToPos(e);i.editor.setCursor(o),i.editor.scrollIntoView({from:{line:o.line-10,ch:0},to:{line:o.line+10,ch:0}})}async function zh(t,e=!1){try{let r;switch(app.vault.getConfig("newFileLocation")){case"current":r=(app.workspace.getActiveFile()?.parent?.path??"")+"/";break;case"folder":r=app.vault.getConfig("newFileFolderPath")+"/";break;default:r="";break}await app.workspace.openLinkText(`${r}${t}.md`,"",e)}catch(r){throw r.message="OmniSearch - Could not create note: "+r.message,console.error(r),r}}ht();Ze();et();ht();Ze();Ze();function t1(t){let e;return{c(){e=M("span"),e.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>',N(e,"class","suggestion-flair"),N(e,"aria-label","Not created yet, select to create")},m(r,n){U(r,e,n)},p:de,i:de,o:de,d(r){r&&W(e)}}}function r1(t){"use strict";return[]}var Hh=class extends ke{constructor(e){super();Ne(this,e,r1,t1,Te,{})}},Vh=Hh;function Wh(t){let e,r;return e=new Vh({}),{c(){Ue(e.$$.fragment)},m(n,i){He(e,n,i),r=!0},i(n){r||(te(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Le(e,n)}}}function n1(t){let e,r,n,i,o,s=t[2]&&Wh(t),a=t[4].default,l=Fr(a,t,t[3],null);return{c(){e=M("div"),s&&s.c(),r=G(),l&&l.c(),N(e,"data-result-id",t[0]),N(e,"class","suggestion-item omnisearch-result"),ls(e,"is-selected",t[1])},m(u,c){U(u,e,c),s&&s.m(e,null),I(e,r),l&&l.m(e,null),n=!0,i||(o=[Pe(e,"mousemove",t[5]),Pe(e,"click",t[6]),Pe(e,"keypress",t[7]),Pe(e,"auxclick",t[8])],i=!0)},p(u,[c]){u[2]?s?c&4&&te(s,1):(s=Wh(u),s.c(),te(s,1),s.m(e,r)):s&&(or(),ne(s,1,1,()=>{s=null}),sr()),l&&l.p&&(!n||c&8)&&Dr(l,a,u,u[3],n?Tr(a,u[3],c,null):Or(u[3]),null),(!n||c&1)&&N(e,"data-result-id",u[0]),(!n||c&2)&&ls(e,"is-selected",u[1])},i(u){n||(te(s),te(l,u),n=!0)},o(u){ne(s),ne(l,u),n=!1},d(u){u&&W(e),s&&s.d(),l&&l.d(u),i=!1,it(o)}}}function i1(t,e,r){let{$$slots:n={},$$scope:i}=e,{id:o}=e,{selected:s=!1}=e,{glyph:a=!1}=e;function l(f){Ye.call(this,t,f)}function u(f){Ye.call(this,t,f)}function c(f){Ye.call(this,t,f)}function d(f){Ye.call(this,t,f)}return t.$$set=f=>{"id"in f&&r(0,o=f.id),"selected"in f&&r(1,s=f.selected),"glyph"in f&&r(2,a=f.glyph),"$$scope"in f&&r(3,i=f.$$scope)},[o,s,a,i,n,l,u,c,d]}var $h=class extends ke{constructor(e){super();Ne(this,e,i1,n1,Te,{id:0,selected:1,glyph:2})}},Uo=$h;var rr=ve(require("obsidian"));yn();jr();function Uh(t){let e,r=t[1].matches.length+"",n,i,o=(t[1].matches.length>1?"matches":"match")+"",s;return{c(){e=M("span"),n=Ie(r),i=Ie("\xA0"),s=Ie(o),N(e,"class","omnisearch-result__counter")},m(a,l){U(a,e,l),I(e,n),I(e,i),I(e,s)},p(a,l){l&2&&r!==(r=a[1].matches.length+"")&&ct(n,r),l&2&&o!==(o=(a[1].matches.length>1?"matches":"match")+"")&&ct(s,o)},d(a){a&&W(e)}}}function Gh(t){let e,r,n,i,o=_t(t[3],t[10])+"";return{c(){e=M("div"),r=M("span"),n=G(),i=M("span"),N(e,"class","omnisearch-result__folder-path")},m(s,a){U(s,e,a),I(e,r),t[16](r),I(e,n),I(e,i),i.innerHTML=o},p(s,a){a&1032&&o!==(o=_t(s[3],s[10])+"")&&(i.innerHTML=o)},d(s){s&&W(e),t[16](null)}}}function Qh(t){let e,r=_t(t[6].content,t[9])+"";return{c(){e=M("div"),N(e,"class","omnisearch-result__body")},m(n,i){U(n,e,i),e.innerHTML=r},p(n,i){i&576&&r!==(r=_t(n[6].content,n[9])+"")&&(e.innerHTML=r)},d(n){n&&W(e)}}}function qh(t){let e,r,n;return{c(){e=M("div"),r=M("img"),qe(r,"width","100px"),ss(r.src,n=t[7])||N(r,"src",n),N(r,"alt",""),N(e,"class","omnisearch-result__image-container")},m(i,o){U(i,e,o),I(e,r)},p(i,o){o&128&&!ss(r.src,n=i[7])&&N(r,"src",n)},d(i){i&&W(e)}}}function o1(t){let e,r,n,i,o,s,a=_t(t[2],t[11])+"",l,u,c,d=Vt(t[1].path)+"",f,h,y,j,v,p,b=t[1].matches.length>0&&Uh(t),m=t[3]&&Gh(t),g=t[12]&&Qh(t),x=t[7]&&qh(t);return{c(){e=M("div"),r=M("div"),n=M("span"),i=M("span"),o=G(),s=M("span"),l=G(),u=M("span"),c=Ie("."),f=Ie(d),h=G(),b&&b.c(),y=G(),m&&m.c(),j=G(),v=M("div"),g&&g.c(),p=G(),x&&x.c(),N(u,"class","omnisearch-result__extension"),N(n,"class","omnisearch-result__title"),N(r,"class","omnisearch-result__title-container"),qe(v,"display","flex"),qe(v,"flex-direction","row")},m(_,w){U(_,e,w),I(e,r),I(r,n),I(n,i),t[15](i),I(n,o),I(n,s),s.innerHTML=a,I(n,l),I(n,u),I(u,c),I(u,f),I(n,h),b&&b.m(n,null),I(e,y),m&&m.m(e,null),I(e,j),I(e,v),g&&g.m(v,null),I(v,p),x&&x.m(v,null)},p(_,w){w&2052&&a!==(a=_t(_[2],_[11])+"")&&(s.innerHTML=a),w&2&&d!==(d=Vt(_[1].path)+"")&&ct(f,d),_[1].matches.length>0?b?b.p(_,w):(b=Uh(_),b.c(),b.m(n,null)):b&&(b.d(1),b=null),_[3]?m?m.p(_,w):(m=Gh(_),m.c(),m.m(e,j)):m&&(m.d(1),m=null),_[12]?g?g.p(_,w):(g=Qh(_),g.c(),g.m(v,p)):g&&(g.d(1),g=null),_[7]?x?x.p(_,w):(x=qh(_),x.c(),x.m(v,null)):x&&(x.d(1),x=null)},d(_){_&&W(e),t[15](null),b&&b.d(),m&&m.d(),g&&g.d(),x&&x.d()}}}function s1(t){let e,r;return e=new Uo({props:{glyph:t[8],id:t[1].path,selected:t[0],$$slots:{default:[o1]},$$scope:{ctx:t}}}),e.$on("click",t[17]),e.$on("auxclick",t[18]),e.$on("mousemove",t[19]),{c(){Ue(e.$$.fragment)},m(n,i){He(e,n,i),r=!0},p(n,[i]){let o={};i&256&&(o.glyph=n[8]),i&2&&(o.id=n[1].path),i&1&&(o.selected=n[0]),i&1056510&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(te(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Le(e,n)}}}function a1(t,e,r){let n,i,o,s,a,l,u;_i(t,hr,w=>r(12,u=w));let{selected:c=!1}=e,{note:d}=e,{app:f}=e,h=null,y="",j="",v,p;function b(w){vt[w?"unshift":"push"](()=>{p=w,r(5,p)})}function m(w){vt[w?"unshift":"push"](()=>{v=w,r(4,v)})}function g(w){Ye.call(this,t,w)}function x(w){Ye.call(this,t,w)}function _(w){Ye.call(this,t,w)}t.$$set=w=>{"selected"in w&&r(0,c=w.selected),"note"in w&&r(1,d=w.note),"app"in w&&r(13,f=w.app)},t.$$.update=()=>{if(t.$$.dirty&8194){e:if(r(7,h=null),Ur(d.path)){let w=f.vault.getAbstractFileByPath(d.path);w instanceof rr.TFile&&r(7,h=f.vault.getResourcePath(w))}}if(t.$$.dirty&2){e:r(14,n=_n(d.foundWords))}if(t.$$.dirty&50){e:r(2,y=d.basename),r(3,j=Nu(d.path)),v&&(0,rr.setIcon)(v,"folder-open"),p&&(Ur(d.path)?(0,rr.setIcon)(p,"image"):yr(d.path)?(0,rr.setIcon)(p,"file-text"):Gr(d.path)?(0,rr.setIcon)(p,"layout-dashboard"):(0,rr.setIcon)(p,"file"))}if(t.$$.dirty&16388){e:r(11,i=di(y,n))}if(t.$$.dirty&16392){e:r(10,o=di(j,n))}if(t.$$.dirty&2){e:r(6,a=vn(d.content,d.matches[0]?.offset??-1))}if(t.$$.dirty&66){e:r(9,s=fi(d.matches).map(w=>(w.offset=w.offset-a.offset,w)))}};e:r(8,l=!1);return[c,d,y,j,v,p,a,h,l,s,o,i,u,f,n,b,m,g,x,_]}var Yh=class extends ke{constructor(e){super();Ne(this,e,a1,s1,Te,{selected:0,note:1,app:13})}},Jh=Yh;Qo();et();Zo();Qr();xn();var xm=ve(bm());yn();function wm(t,e,r){let n=t.slice();return n[38]=e[r],n[40]=r,n}function x1(t){let e,r,n;return{c(){e=M("button"),e.textContent="Create note"},m(i,o){U(i,e,o),r||(n=Pe(e,"click",t[13]),r=!0)},p:de,d(i){i&&W(e),r=!1,n()}}}function w1(t){let e,r,n;return{c(){e=M("button"),e.textContent="In-File search"},m(i,o){U(i,e,o),r||(n=Pe(e,"click",t[14]),r=!0)},p:de,d(i){i&&W(e),r=!1,n()}}}function j1(t){let e,r,n=T.showCreateButton&&x1(t),i=ut.Platform.isMobile&&w1(t);return{c(){e=M("div"),n&&n.c(),r=G(),i&&i.c(),N(e,"class","omnisearch-input-container__buttons")},m(o,s){U(o,e,s),n&&n.m(e,null),I(e,r),i&&i.m(e,null)},p(o,s){T.showCreateButton&&n.p(o,s),ut.Platform.isMobile&&i.p(o,s)},d(o){o&&W(e),n&&n.d(),i&&i.d()}}}function jm(t){let e,r,n;return{c(){e=M("div"),r=Ie("\u23F3 Work in progress: "),n=Ie(t[4]),qe(e,"text-align","center"),qe(e,"color","var(--text-accent)"),qe(e,"margin-top","10px")},m(i,o){U(i,e,o),I(e,r),I(e,n)},p(i,o){o[0]&16&&ct(n,i[4])},d(i){i&&W(e)}}}function Am(t){let e,r;function n(...i){return t[20](t[40],...i)}return e=new Jh({props:{app:t[0],selected:t[40]===t[1],note:t[38]}}),e.$on("mousemove",n),e.$on("click",t[11]),e.$on("auxclick",t[21]),{c(){Ue(e.$$.fragment)},m(i,o){He(e,i,o),r=!0},p(i,o){t=i;let s={};o[0]&1&&(s.app=t[0]),o[0]&2&&(s.selected=t[40]===t[1]),o[0]&8&&(s.note=t[38]),e.$set(s)},i(i){r||(te(e.$$.fragment,i),r=!0)},o(i){ne(e.$$.fragment,i),r=!1},d(i){Le(e,i)}}}function A1(t){let e;return{c(){e=Ie("Searching...")},m(r,n){U(r,e,n)},p:de,d(r){r&&W(e)}}}function S1(t){let e,r=T.simpleSearch&&t[2].split(qn).some(Cm),n,i=r&&Sm(t);return{c(){e=Ie(`We found 0 result for your search here.
`),i&&i.c(),n=An()},m(o,s){U(o,e,s),i&&i.m(o,s),U(o,n,s)},p(o,s){s[0]&4&&(r=T.simpleSearch&&o[2].split(qn).some(Cm)),r?i||(i=Sm(o),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(o){o&&W(e),i&&i.d(o),o&&W(n)}}}function Sm(t){let e,r,n;return{c(){e=M("br"),r=G(),n=M("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more
characters.`,qe(n,"color","var(--text-accent)"),qe(n,"font-size","small")},m(i,o){U(i,e,o),U(i,r,o),U(i,n,o)},d(i){i&&W(e),i&&W(r),i&&W(n)}}}function C1(t){let e,r,n,i=t[3],o=[];for(let c=0;c<i.length;c+=1)o[c]=Am(wm(t,i,c));let s=c=>ne(o[c],1,1,()=>{o[c]=null});function a(c,d){if(!c[3].length&&c[2]&&!c[5])return S1;if(c[5])return A1}let l=a(t,[-1,-1]),u=l&&l(t);return{c(){for(let c=0;c<o.length;c+=1)o[c].c();e=G(),r=M("div"),u&&u.c(),qe(r,"text-align","center")},m(c,d){for(let f=0;f<o.length;f+=1)o[f]&&o[f].m(c,d);U(c,e,d),U(c,r,d),u&&u.m(r,null),n=!0},p(c,d){if(d[0]&6155){i=c[3];let f;for(f=0;f<i.length;f+=1){let h=wm(c,i,f);o[f]?(o[f].p(h,d),te(o[f],1)):(o[f]=Am(h),o[f].c(),te(o[f],1),o[f].m(e.parentNode,e))}for(or(),f=i.length;f<o.length;f+=1)s(f);sr()}l===(l=a(c,d))&&u?u.p(c,d):(u&&u.d(1),u=l&&l(c),u&&(u.c(),u.m(r,null)))},i(c){if(!n){for(let d=0;d<i.length;d+=1)te(o[d]);n=!0}},o(c){o=o.filter(Boolean);for(let d=0;d<o.length;d+=1)ne(o[d]);n=!1},d(c){bi(o,c),c&&W(e),c&&W(r),u&&u.d()}}}function E1(t){let e,r,n,i,o,s,a,l,u,c,d,f,h,y,j,v,p,b,m,g,x,_,w,S,E,D,O,L,k,H,X,Y,J,C,F,P,K,Z,se,Fe,B,ue,ge,Oe,Cr={initialValue:t[2],placeholder:"Omnisearch - Vault",$$slots:{default:[j1]},$$scope:{ctx:t}};e=new to({props:Cr}),t[18](e),e.$on("input",t[19]);let Re=t[4]&&jm(t);return i=new ro({props:{$$slots:{default:[C1]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment),r=G(),Re&&Re.c(),n=G(),Ue(i.$$.fragment),o=G(),s=M("div"),a=M("div"),a.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',l=G(),u=M("div"),u.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
<span>to cycle history</span>`,c=G(),d=M("div"),f=M("span"),h=Ie(t[8]),y=G(),j=M("span"),j.textContent="to open",v=G(),p=M("div"),p.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to In-File Search</span>`,b=G(),m=M("div"),g=M("span"),x=Ie(t[7]),_=G(),w=M("span"),w.textContent="to open in a new pane",S=G(),E=M("div"),E.innerHTML=`<span class="prompt-instruction-command">alt o</span>
<span>to open in the background</span>`,D=G(),O=M("div"),L=M("span"),k=Ie(t[10]),H=G(),X=M("span"),X.textContent="to create",Y=G(),J=M("div"),C=M("span"),F=Ie(t[9]),P=G(),K=M("span"),K.textContent="to create in a new pane",Z=G(),se=M("div"),se.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,Fe=G(),B=M("div"),B.innerHTML=`<span class="prompt-instruction-command">ctrl h</span>
<span>to toggle excerpts</span>`,ue=G(),ge=M("div"),ge.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',N(a,"class","prompt-instruction"),N(u,"class","prompt-instruction"),N(f,"class","prompt-instruction-command"),N(d,"class","prompt-instruction"),N(p,"class","prompt-instruction"),N(g,"class","prompt-instruction-command"),N(m,"class","prompt-instruction"),N(E,"class","prompt-instruction"),N(L,"class","prompt-instruction-command"),N(O,"class","prompt-instruction"),N(C,"class","prompt-instruction-command"),N(J,"class","prompt-instruction"),N(se,"class","prompt-instruction"),N(B,"class","prompt-instruction"),N(ge,"class","prompt-instruction"),N(s,"class","prompt-instructions")},m(ee,we){He(e,ee,we),U(ee,r,we),Re&&Re.m(ee,we),U(ee,n,we),He(i,ee,we),U(ee,o,we),U(ee,s,we),I(s,a),I(s,l),I(s,u),I(s,c),I(s,d),I(d,f),I(f,h),I(d,y),I(d,j),I(s,v),I(s,p),I(s,b),I(s,m),I(m,g),I(g,x),I(m,_),I(m,w),I(s,S),I(s,E),I(s,D),I(s,O),I(O,L),I(L,k),I(O,H),I(O,X),I(s,Y),I(s,J),I(J,C),I(C,F),I(J,P),I(J,K),I(s,Z),I(s,se),I(s,Fe),I(s,B),I(s,ue),I(s,ge),Oe=!0},p(ee,we){let is={};we[0]&4&&(is.initialValue=ee[2]),we[1]&1024&&(is.$$scope={dirty:we,ctx:ee}),e.$set(is),ee[4]?Re?Re.p(ee,we):(Re=jm(ee),Re.c(),Re.m(n.parentNode,n)):Re&&(Re.d(1),Re=null);let ml={};we[0]&47|we[1]&1024&&(ml.$$scope={dirty:we,ctx:ee}),i.$set(ml),(!Oe||we[0]&256)&&ct(h,ee[8]),(!Oe||we[0]&128)&&ct(x,ee[7]),(!Oe||we[0]&1024)&&ct(k,ee[10]),(!Oe||we[0]&512)&&ct(F,ee[9])},i(ee){Oe||(te(e.$$.fragment,ee),te(i.$$.fragment,ee),Oe=!0)},o(ee){ne(e.$$.fragment,ee),ne(i.$$.fragment,ee),Oe=!1},d(ee){t[18](null),Le(e,ee),ee&&W(r),Re&&Re.d(ee),ee&&W(n),Le(i,ee),ee&&W(o),ee&&W(s)}}}var Cm=t=>t.length<3;function F1(t,e,r){let n,i;_i(t,Ht,B=>r(17,i=B));let{modal:o}=e,{previousQuery:s}=e,{app:a}=e,l=0,u=0,c,d=[],f,h="",y=!0,j,v,p,b,m;En(async()=>{Q.enable("vault"),Q.on("vault",re.Enter,D),Q.on("vault",re.OpenInBackground,O),Q.on("vault",re.CreateNote,Y),Q.on("vault",re.OpenInNewPane,L),Q.on("vault",re.InsertLink,J),Q.on("vault",re.Tab,C),Q.on("vault",re.ArrowUp,()=>F(-1)),Q.on("vault",re.ArrowDown,()=>F(1)),Q.on("vault",re.PrevSearchHistory,g),Q.on("vault",re.NextSearchHistory,x),await Xo(),await S()}),Fn(()=>{Q.disable("vault")});async function g(){let B=(await Se.getSearchHistory()).filter(ue=>ue);++u>=B.length&&(u=0),r(2,c=B[u]),j?.setInputValue(c??"")}async function x(){let B=(await Se.getSearchHistory()).filter(ue=>ue);--u<0&&(u=B.length?B.length-1:0),r(2,c=B[u]),j?.setInputValue(c??"")}let _=null;async function w(){r(5,y=!0),_&&(_.cancel(),_=null),f=new Ar(c),_=(0,xm.cancelable)(new Promise(B=>{B(Ee.getSuggestions(f))})),r(3,d=await _),r(1,l=0),await P(),r(5,y=!1)}let S=Ga(w,0);function E(B){!n||(B?.ctrlKey?L():D(),o.close())}function D(){!n||(H(n),o.close())}function O(){!n||H(n,!0)}function L(){!n||(H(n,!0),o.close())}function k(){c&&Se.addToSearchHistory(c)}function H(B,ue=!1){k();let ge=B.matches?.[0]?.offset??0;$o(B,ge,ue)}async function X(B){await Y()}async function Y(B){if(c){try{await zh(c,B?.newLeaf)}catch(ue){new ut.Notice(ue.message);return}o.close()}}function J(){if(!n)return;let B=a.vault.getMarkdownFiles().find(Re=>Re.path===n.path),ue=a.workspace.getActiveFile(),ge=a.workspace.getActiveViewOfType(ut.MarkdownView);if(!ge?.editor){new ut.Notice("Omnisearch - Error - No active editor",3e3);return}let Oe;B&&ue?Oe=a.fileManager.generateMarkdownLink(B,ue.path):Oe=`[[${n.basename}.${Vt(n.path)}]]`;let Cr=ge.editor.getCursor();ge.editor.replaceRange(Oe,Cr,Cr),Cr.ch+=Oe.length,ge.editor.setCursor(Cr),o.close()}function C(){if(!(n&&(yr(n?.path)||!n?.matches.length)))if(k(),o.close(),n){let B=a.vault.getAbstractFileByPath(n.path);B&&B instanceof ut.TFile&&new wn(a,B,c).open()}else{let B=a.workspace.getActiveViewOfType(ut.MarkdownView);B?.file&&new wn(a,B.file,c).open()}}function F(B){r(1,l=Ji(l+B,d.length)),P()}async function P(){await kt(),n&&activeWindow.document.querySelector(`[data-result-id="${n.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function K(B){vt[B?"unshift":"push"](()=>{j=B,r(6,j)})}let Z=B=>r(2,c=B.detail),se=(B,ue)=>r(1,l=B),Fe=B=>{B.button==1&&L()};t.$$set=B=>{"modal"in B&&r(15,o=B.modal),"previousQuery"in B&&r(16,s=B.previousQuery),"app"in B&&r(0,a=B.app)},t.$$.update=()=>{if(t.$$.dirty[0]&65540){e:r(2,c=c??s)}if(t.$$.dirty[0]&4){e:c?S():(r(5,y=!1),r(3,d=[]))}if(t.$$.dirty[0]&10){e:n=d[l]}if(t.$$.dirty[0]&131072){e:switch(i){case tt.LoadingCache:r(4,h="Loading cache...");break;case tt.ReadingFiles:r(4,h="Reading files...");break;case tt.IndexingFiles:r(4,h="Indexing files...");break;case tt.WritingCache:S(),r(4,h="Updating cache...");break;default:S(),r(4,h="");break}}};e:T.openInNewPane?(r(7,v="\u21B5"),r(8,p=gr()+" \u21B5"),r(9,b="shift \u21B5"),r(10,m=gr()+" shift \u21B5")):(r(7,v=gr()+" \u21B5"),r(8,p="\u21B5"),r(9,b=gr()+" shift \u21B5"),r(10,m="shift \u21B5"));return[a,l,c,d,h,y,j,v,p,b,m,E,L,X,C,o,s,i,K,Z,se,Fe]}var Em=class extends ke{constructor(e){super();Ne(this,e,F1,E1,Te,{modal:15,previousQuery:16,app:0},null,[-1,-1])}},Fm=Em;Ze();st();ht();var hi=ve(require("obsidian"));Ze();jr();yn();function T1(t){let e,r=_t(t[2].content,t[3])+"";return{c(){e=M("div"),N(e,"class","omnisearch-result__body")},m(n,i){U(n,e,i),e.innerHTML=r},p(n,i){i&12&&r!==(r=_t(n[2].content,n[3])+"")&&(e.innerHTML=r)},d(n){n&&W(e)}}}function D1(t){let e,r;return e=new Uo({props:{id:t[0].toString(),selected:t[1],$$slots:{default:[T1]},$$scope:{ctx:t}}}),e.$on("mousemove",t[6]),e.$on("click",t[7]),e.$on("auxclick",t[8]),{c(){Ue(e.$$.fragment)},m(n,i){He(e,n,i),r=!0},p(n,[i]){let o={};i&1&&(o.id=n[0].toString()),i&2&&(o.selected=n[1]),i&524&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(te(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Le(e,n)}}}function O1(t,e,r){let n,i,{offset:o}=e,{note:s}=e,{index:a=0}=e,{selected:l=!1}=e;function u(f){Ye.call(this,t,f)}function c(f){Ye.call(this,t,f)}function d(f){Ye.call(this,t,f)}return t.$$set=f=>{"offset"in f&&r(4,o=f.offset),"note"in f&&r(5,s=f.note),"index"in f&&r(0,a=f.index),"selected"in f&&r(1,l=f.selected)},t.$$.update=()=>{if(t.$$.dirty&48){e:r(2,n=vn(s?.content??"",o))}if(t.$$.dirty&36){e:r(3,i=fi(s.matches).map(f=>(f.offset=f.offset-n.offset,f)))}},[a,l,n,i,o,s,u,c,d]}var Tm=class extends ke{constructor(e){super();Ne(this,e,O1,D1,Te,{offset:4,note:5,index:0,selected:1})}},Dm=Tm;Qo();xn();jr();function Om(t,e,r){let n=t.slice();return n[20]=e[r],n[22]=r,n}function I1(t){let e,r,n;return{c(){e=M("button"),e.textContent="Vault search"},m(i,o){U(i,e,o),r||(n=Pe(e,"click",t[7]),r=!0)},p:de,d(i){i&&W(e),r=!1,n()}}}function P1(t){let e,r=hi.Platform.isMobile&&I1(t);return{c(){e=M("div"),r&&r.c(),N(e,"class","omnisearch-input-container__buttons")},m(n,i){U(n,e,i),r&&r.m(e,null)},p(n,i){hi.Platform.isMobile&&r.p(n,i)},d(n){n&&W(e),r&&r.d()}}}function k1(t){let e;return{c(){e=M("div"),e.textContent="We found 0 result for your search here.",qe(e,"text-align","center")},m(r,n){U(r,e,n)},p:de,i:de,o:de,d(r){r&&W(e)}}}function M1(t){let e,r,n=t[4],i=[];for(let s=0;s<n.length;s+=1)i[s]=Im(Om(t,n,s));let o=s=>ne(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=An()},m(s,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(s,a);U(s,e,a),r=!0},p(s,a){if(a&120){n=s[4];let l;for(l=0;l<n.length;l+=1){let u=Om(s,n,l);i[l]?(i[l].p(u,a),te(i[l],1)):(i[l]=Im(u),i[l].c(),te(i[l],1),i[l].m(e.parentNode,e))}for(or(),l=n.length;l<i.length;l+=1)o(l);sr()}},i(s){if(!r){for(let a=0;a<n.length;a+=1)te(i[a]);r=!0}},o(s){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)ne(i[a]);r=!1},d(s){bi(i,s),s&&W(e)}}}function Im(t){let e,r;function n(...i){return t[13](t[22],...i)}return e=new Dm({props:{offset:t[20],note:t[3],index:t[22],selected:t[22]===t[5]}}),e.$on("mousemove",n),e.$on("click",t[14]),e.$on("auxclick",t[15]),{c(){Ue(e.$$.fragment)},m(i,o){He(e,i,o),r=!0},p(i,o){t=i;let s={};o&16&&(s.offset=t[20]),o&8&&(s.note=t[3]),o&32&&(s.selected=t[22]===t[5]),e.$set(s)},i(i){r||(te(e.$$.fragment,i),r=!0)},o(i){ne(e.$$.fragment,i),r=!1},d(i){Le(e,i)}}}function R1(t){let e,r,n,i,o=[M1,k1],s=[];function a(l,u){return l[4].length&&l[3]?0:1}return e=a(t,-1),r=s[e]=o[e](t),{c(){r.c(),n=An()},m(l,u){s[e].m(l,u),U(l,n,u),i=!0},p(l,u){let c=e;e=a(l,u),e===c?s[e].p(l,u):(or(),ne(s[c],1,1,()=>{s[c]=null}),sr(),r=s[e],r?r.p(l,u):(r=s[e]=o[e](l),r.c()),te(r,1),r.m(n.parentNode,n))},i(l){i||(te(r),i=!0)},o(l){ne(r),i=!1},d(l){s[e].d(l),l&&W(n)}}}function L1(t){let e;return{c(){e=M("span"),e.textContent="to close"},m(r,n){U(r,e,n)},d(r){r&&W(e)}}}function N1(t){let e;return{c(){e=M("span"),e.textContent="to go back to Vault Search"},m(r,n){U(r,e,n)},d(r){r&&W(e)}}}function B1(t){let e,r,n,i,o,s,a,l,u,c,d,f,h,y,j,v,p,b,m,g;e=new to({props:{placeholder:"Omnisearch - File",initialValue:t[1],$$slots:{default:[P1]},$$scope:{ctx:t}}}),e.$on("input",t[12]),n=new ro({props:{$$slots:{default:[R1]},$$scope:{ctx:t}}});function x(S,E){return S[0]?N1:L1}let _=x(t,-1),w=_(t);return{c(){Ue(e.$$.fragment),r=G(),Ue(n.$$.fragment),i=G(),o=M("div"),s=M("div"),s.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',a=G(),l=M("div"),l.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',u=G(),c=M("div"),c.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to Vault Search</span>`,d=G(),f=M("div"),h=M("span"),h.textContent="esc",y=G(),w.c(),j=G(),v=M("div"),p=M("span"),p.textContent=`${gr()} \u21B5`,b=G(),m=M("span"),m.textContent="to open in a new pane",N(s,"class","prompt-instruction"),N(l,"class","prompt-instruction"),N(c,"class","prompt-instruction"),N(h,"class","prompt-instruction-command"),N(f,"class","prompt-instruction"),N(p,"class","prompt-instruction-command"),N(v,"class","prompt-instruction"),N(o,"class","prompt-instructions")},m(S,E){He(e,S,E),U(S,r,E),He(n,S,E),U(S,i,E),U(S,o,E),I(o,s),I(o,a),I(o,l),I(o,u),I(o,c),I(o,d),I(o,f),I(f,h),I(f,y),w.m(f,null),I(o,j),I(o,v),I(v,p),I(v,b),I(v,m),g=!0},p(S,[E]){let D={};E&2&&(D.initialValue=S[1]),E&8388608&&(D.$$scope={dirty:E,ctx:S}),e.$set(D);let O={};E&8388664&&(O.$$scope={dirty:E,ctx:S}),n.$set(O),_!==(_=x(S,E))&&(w.d(1),w=_(S),w&&(w.c(),w.m(f,null)))},i(S){g||(te(e.$$.fragment,S),te(n.$$.fragment,S),g=!0)},o(S){ne(e.$$.fragment,S),ne(n.$$.fragment,S),g=!1},d(S){Le(e,S),S&&W(r),Le(n,S),S&&W(i),S&&W(o),w.d()}}}function K1(t,e,r){let n=t.find(i=>i.offset>e);return n?t.filter(i=>i.offset>e&&i.offset<=n.offset+r):[]}function z1(t,e,r){let{modal:n}=e,{parent:i=null}=e,{singleFilePath:o=""}=e,{previousQuery:s}=e,{app:a}=e,l,u=[],c=0,d,f;En(()=>{Q.enable("infile"),Q.on("infile",re.Enter,p),Q.on("infile",re.OpenInNewPane,v),Q.on("infile",re.ArrowUp,()=>y(-1)),Q.on("infile",re.ArrowDown,()=>y(1)),Q.on("infile",re.Tab,b)}),Fn(()=>{Q.disable("infile")});function h(w){let S=[],E=-1,D=0;for(;;){let O=K1(w,E,Qn);if(!O.length||(E=O.last().offset,S.push(O),++D>100))break}return S}function y(w){r(5,c=Ji(c+w,u.length)),j()}async function j(){await kt(),document.querySelector(`[data-result-id="${c}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function v(){return p(!0)}async function p(w=!1){if(d){n.close(),i&&i.close();let S=_n(d.foundWords);S.exec(d.content),await $o(d,S.lastIndex,w);let E=a.workspace.getActiveViewOfType(hi.MarkdownView);if(!E)return;let D=u[c]??0,O=E.editor.offsetToPos(D);O.ch=0,E.editor.setCursor(O),E.editor.scrollIntoView({from:{line:O.line-10,ch:0},to:{line:O.line+10,ch:0}})}}function b(){new Sr(a,l??s).open(),n.close()}let m=w=>r(2,l=w.detail),g=(w,S)=>r(5,c=w),x=w=>p(w.ctrlKey),_=w=>{w.button==1&&p(!0)};return t.$$set=w=>{"modal"in w&&r(8,n=w.modal),"parent"in w&&r(0,i=w.parent),"singleFilePath"in w&&r(9,o=w.singleFilePath),"previousQuery"in w&&r(1,s=w.previousQuery),"app"in w&&r(10,a=w.app)},t.$$.update=()=>{if(t.$$.dirty&2){e:r(2,l=s??"")}if(t.$$.dirty&2564){e:(async()=>{l&&(r(11,f=new Ar(l)),r(3,d=(await Ee.getSuggestions(f,{singleFilePath:o}))[0]??null)),r(5,c=0),await j()})()}if(t.$$.dirty&8){e:if(d){let w=h(d.matches);r(4,u=w.map(S=>Math.round((S.first().offset+S.last().offset)/2)))}}},[i,s,l,d,u,c,p,b,n,o,a,f,m,g,x,_]}var Pm=class extends ke{constructor(e){super();Ne(this,e,z1,B1,Te,{modal:8,parent:0,singleFilePath:9,previousQuery:1,app:10})}},km=Pm;st();et();Qr();var dl=class extends ts.Modal{constructor(e){super(e);this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",s=>{s.preventDefault(),Q.emit(re.ArrowDown)}),this.scope.register([],"ArrowUp",s=>{s.preventDefault(),Q.emit(re.ArrowUp)});for(let s of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let a of["Ctrl","Mod"])this.scope.register([a],s.k,l=>{T.vimLikeNavigationShortcut&&Q.emit("arrow-"+s.dir)});for(let s of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let a of["Ctrl","Mod"])this.scope.register([a],s.k,l=>{T.vimLikeNavigationShortcut&&Q.emit("arrow-"+s.dir)});let r,n,i,o;T.openInNewPane?(r=["Mod"],n=[],i=["Mod","Shift"],o=["Shift"]):(r=[],n=["Mod"],i=["Shift"],o=["Mod","Shift"]),this.scope.register(n,"Enter",s=>{s.preventDefault(),Q.emit(re.OpenInNewPane)}),this.scope.register(["Alt"],"Enter",s=>{s.preventDefault(),Q.emit(re.InsertLink)}),this.scope.register(i,"Enter",s=>{s.preventDefault(),Q.emit(re.CreateNote)}),this.scope.register(o,"Enter",s=>{s.preventDefault(),Q.emit(re.CreateNote,{newLeaf:!0})}),this.scope.register(r,"Enter",s=>{fa()||(s.preventDefault(),Q.emit(re.Enter))}),this.scope.register(["Alt"],"O",s=>{fa()||(s.preventDefault(),Q.emit(re.OpenInBackground))}),this.scope.register([],"Tab",s=>{s.preventDefault(),Q.emit(re.Tab)}),this.scope.register(["Alt"],"ArrowDown",s=>{s.preventDefault(),Q.emit(re.NextSearchHistory)}),this.scope.register(["Alt"],"ArrowUp",s=>{s.preventDefault(),Q.emit(re.PrevSearchHistory)}),this.scope.register(["Ctrl"],"H",s=>{Q.emit(qi.ToggleExcerpts)})}},Sr=class extends dl{constructor(e,r){super(e);let n=e.workspace.getActiveViewOfType(ts.MarkdownView)?.editor.getSelection();Se.getSearchHistory().then(i=>{let o=T.showPreviousQueryResults?i[0]:null,s=new Fm({target:this.modalEl,props:{app:e,modal:this,previousQuery:r||n||o||""}});this.onClose=()=>{s.$destroy()}})}},wn=class extends dl{constructor(e,r,n="",i){super(e);let o=new km({target:this.modalEl,props:{app:e,modal:this,singleFilePath:r.path,parent:i,previousQuery:n}});i&&i.containerEl.toggleVisibility(!1),this.onClose=()=>{i&&i.containerEl.toggleVisibility(!0),o.$destroy()}}};et();st();pl();ht();Gi();Zo();xn();Qr();var hl=class extends nr.Plugin{constructor(){super(...arguments);this.apiHttpServer=null}async onload(){if(await Fu(this),this.addSettingTab(new aa(this)),nr.Platform.isMobile||Promise.resolve().then(()=>(zm(),Km)).then(e=>this.apiHttpServer=e.getServer()),la()){console.log("Omnisearch - Plugin disabled");return}await G1(this.app),await $r.clearOldDatabases(),Q1(this),T.ribbonIcon&&this.addRibbonButton(),Q.disable("vault"),Q.disable("infile"),Q.on("global",qi.ToggleExcerpts,()=>{hr.set(!T.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Sr(this.app).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(e,r)=>{r.file&&new wn(this.app,r.file).open()}}),this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",e=>{Jn(e.path)&&(he("Indexing new file",e.path),Ee.addFromPaths([e.path]))})),this.registerEvent(this.app.vault.on("delete",e=>{he("Removing file",e.path),Se.removeFromLiveCache(e.path),Ee.removeFromPaths([e.path])})),this.registerEvent(this.app.vault.on("modify",async e=>{Jn(e.path)&&(he("Updating file",e.path),await Se.addToLiveCache(e.path),vm(e))})),this.registerEvent(this.app.vault.on("rename",async(e,r)=>{Jn(e.path)&&(he("Renaming file",e.path),Se.removeFromLiveCache(r),await Se.addToLiveCache(e.path),Ee.removeFromPaths([r]),await Ee.addFromPaths([e.path]))})),await this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&T.httpApiEnabled&&this.apiHttpServer.listen(T.httpApiPort)})}async executeFirstLaunchTasks(){let e="1.21.0";if(T.welcomeMessage!==e&&Ge()){let r=new DocumentFragment;r.createSpan({},n=>{n.innerHTML="\u{1F50E} Omnisearch can now index .docx and .xlsx documents. Don't forget to update Text Extractor and enable the toggle in Omnisearch settings."}),new nr.Notice(r,2e4)}T.welcomeMessage=e,await this.saveData(T)}async onunload(){delete globalThis.omnisearch,await Ae.clearCache(),this.apiHttpServer.close()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new Sr(this.app).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}async populateIndex(){console.time("Omnisearch - Indexing total time"),Ht.set(tt.ReadingFiles);let e=this.app.vault.getFiles().filter(n=>Jn(n.path));console.log(`Omnisearch - ${e.length} files total`),console.log(`Omnisearch - Cache is ${Ft()?"enabled":"disabled"}`),Ft()&&(console.time("Omnisearch - Loading index from cache"),Ht.set(tt.LoadingCache),await Ee.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let r=Ee.getDiff(e.map(n=>({path:n.path,mtime:n.stat.mtime})));Ft()&&(r.toAdd.length&&console.log("Omnisearch - Total number of files to add/update: "+r.toAdd.length),r.toRemove.length&&console.log("Omnisearch - Total number of files to remove: "+r.toRemove.length)),r.toAdd.length>=1e3&&Ft()&&new nr.Notice(`Omnisearch - ${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),Ht.set(tt.IndexingFiles),Ee.removeFromPaths(r.toRemove.map(n=>n.path)),await Ee.addFromPaths(r.toAdd.map(n=>n.path)),(r.toRemove.length||r.toAdd.length)&&Ft()&&(Ht.set(tt.WritingCache),T.useCache=!1,await oe(this),await Ee.writeToCache(),T.useCache=!0,await oe(this)),console.timeEnd("Omnisearch - Indexing total time"),r.toAdd.length>=1e3&&Ft()&&new nr.Notice("Omnisearch - Your files have been indexed."),Ht.set(tt.Done),Rm()}};async function G1(t){let e=[`${t.vault.configDir}/plugins/omnisearch/searchIndex.json`,`${t.vault.configDir}/plugins/omnisearch/notesCache.json`,`${t.vault.configDir}/plugins/omnisearch/notesCache.data`,`${t.vault.configDir}/plugins/omnisearch/searchIndex.data`,`${t.vault.configDir}/plugins/omnisearch/historyCache.json`,`${t.vault.configDir}/plugins/omnisearch/pdfCache.data`];for(let r of e)if(await t.vault.adapter.exists(r))try{await t.vault.adapter.remove(r)}catch{}}function Q1(t){t.registerObsidianProtocolHandler("omnisearch",e=>{new Sr(t.app,e.query).open()}),globalThis.omnisearch=mi,t.app.plugins.plugins.omnisearch.api=mi}