/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var Rm=Object.create;var jn=Object.defineProperty,Lm=Object.defineProperties,Nm=Object.getOwnPropertyDescriptor,Bm=Object.getOwnPropertyDescriptors,Km=Object.getOwnPropertyNames,dl=Object.getOwnPropertySymbols,zm=Object.getPrototypeOf,pl=Object.prototype.hasOwnProperty,Hm=Object.prototype.propertyIsEnumerable;var hl=(t,e,r)=>e in t?jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ge=(t,e)=>{for(var r in e||(e={}))pl.call(e,r)&&hl(t,r,e[r]);if(dl)for(var r of dl(e))Hm.call(e,r)&&hl(t,r,e[r]);return t},ze=(t,e)=>Lm(t,Bm(e)),ml=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),gl=(t,e)=>{ml(t);for(var r in e)jn(t,r,{get:e[r],enumerable:!0})},Vm=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Km(e))!pl.call(t,n)&&n!=="default"&&jn(t,n,{get:()=>e[n],enumerable:!(r=Nm(e,n))||r.enumerable});return t},_e=t=>Vm(ml(jn(t!=null?Rm(zm(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);function fe(){}function Wm(t,e){for(let r in e)t[r]=e[r];return t}function os(t){return t()}function yl(){return Object.create(null)}function nt(t){t.forEach(os)}function Cr(t){return typeof t=="function"}function Fe(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 _l(t){return Object.keys(t).length===0}function vl(t,...e){if(t==null)return fe;let r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function _i(t,e,r){t.$$.on_destroy.push(vl(e,r))}function Er(t,e,r,n){if(t){let i=bl(t,e,r,n);return t[0](i)}}function bl(t,e,r,n){return t[1]&&n?Wm(r.ctx.slice(),t[1](n(e))):r.ctx}function Fr(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;a32){let e=[],r=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,r,n)}function N(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Gm(t){return Array.from(t.childNodes)}function ut(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 Qm(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=Qm(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function qe(t,e){let r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}function Cl(){fs||(fs=!0,Sl.then(El))}function kt(){return Cl(),Sl}function ds(t){Ir.push(t)}function El(){if(Pr!==0)return;let t=Sn;do{try{for(;Prt.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),Ir=e}function nr(){rr={r:0,c:[],p:rr}}function ir(){rr.r||nt(rr.c),rr=rr.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),rr.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(Cr);t.$$.on_destroy?t.$$.on_destroy.push(...s):nt(s),t.$$.on_mount=[]}),o.forEach(ds)}function Le(t,e){let r=t.$$;r.fragment!==null&&(Ym(r.after_update),nt(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Xm(t,e){t.$$.dirty[0]===-1&&(Or.push(t),Cl(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let w=h.length?h[0]:c;return l.ctx&&i(l.ctx[p],l.ctx[p]=w)&&(!l.skip_bound&&l.bound[p]&&l.bound[p](w),f&&Xm(t,p)),c}):[],l.update(),f=!0,nt(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){$m();let p=Gm(e.target);l.fragment&&l.fragment.l(p),p.forEach(W)}else l.fragment&&l.fragment.c();e.intro&&te(t.$$.fragment),He(t,e.target,e.anchor,e.customElement),Um(),El()}Cn(u)}var yi,wl,vi,jl,Sn,Or,_t,Ir,Al,Sl,fs,ps,Pr,xi,rr,Jm,$1,Zm,ke,Xe=A(()=>{wl=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,vi=class{constructor(e){this.options=e,this._listeners="WeakMap"in wl?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 wl?new WeakMap:void 0;jl=!1;Or=[],_t=[],Ir=[],Al=[],Sl=Promise.resolve(),fs=!1;ps=new Set,Pr=0;xi=new Set;Jm=["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"],$1=new Set([...Jm]);typeof HTMLElement=="function"&&(Zm=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(os).filter(Cr);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){nt(this.$$.on_disconnect)}$destroy(){Le(this,1),this.$destroy=fe}$on(t,e){if(!Cr(e))return fe;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&&!_l(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});ke=class{$destroy(){Le(this,1),this.$destroy=fe}$on(e,r){if(!Cr(r))return fe;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&&!_l(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}});var hs,Fl=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=fe){let r,n=new Set;function i(a){if(Fe(t,a)&&(t=a,r)){let u=!kr.length;for(let l of n)l[1](),kr.push(l,t);if(u){for(let l=0;l{n.delete(l),n.size===0&&r&&(r(),r=null)}}return{set:i,update:o,subscribe:s}}var kr,ms=A(()=>{Xe();Xe();kr=[]});function Ve(t,e){return typeof e!="object"||be(e).forEach(function(r){t[r]=e[r]}),t}function Ye(t,e){return eg.call(t,e)}function Mr(t,e){typeof e=="function"&&(e=e(Tn(t))),(typeof Reflect=="undefined"?be:Reflect.ownKeys)(e).forEach(r=>{vt(t,r,e[r])})}function vt(t,e,r,n){Tl(t,e,Ve(r&&Ye(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function Rr(t){return{from:function(e){return t.prototype=Object.create(e.prototype),vt(t.prototype,"constructor",t),{extend:Mr.bind(null,t.prototype)}}}}function gs(t,e){let r=tg(t,e),n;return r||(n=Tn(t))&&gs(n,e)}function ji(t,e,r){return rg.call(t,e,r)}function Dl(t,e){return e(t)}function Dn(t){if(!t)throw new Error("Assertion Failed")}function Ol(t){ue.setImmediate?setImmediate(t):setTimeout(t,0)}function Il(t,e){return t.reduce((r,n,i)=>{var o=e(n,i);return o&&(r[o[0]]=o[1]),r},{})}function ng(t,e,r){try{t.apply(null,r)}catch(n){e&&e(n)}}function bt(t,e){if(Ye(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var r=[],n=0,i=e.length;n=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)Ye(t,i)&&(e[i]=ys(t[i]))}return e}function _s(t){return ag.call(t).slice(8,-1)}function xt(t){var e,r,n,i;if(arguments.length===1){if(Be(t))return t.slice();if(this===Lr&&typeof t=="string")return[t];if(i=lg(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 Rl(t,e){ct=t,Ll=e}function or(){if(ug)try{throw or.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(Ll).map(n=>` `+n).join("")):""}function Nr(t,e){this._e=or(),this.name=t,this.message=e}function Bl(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=or(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=Bl(t,e)}function In(t,e){this._e=or(),this.name="BulkError",this.failures=Object.keys(e).map(r=>e[r]),this.failuresByPos=e,this.message=Bl(t,e)}function pg(t,e){if(!t||t instanceof Nr||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Kl[t.name])return t;var r=new Kl[t.name](e||t.message,t);return"stack"in t&&vt(r,"stack",{get:function(){return this.inner.stack}}),r}function ie(){}function Pn(t){return t}function hg(t,e){return t==null||t===Pn?e:function(r){return e(t(r))}}function sr(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function mg(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?sr(n,this.onsuccess):n),i&&(this.onerror=this.onerror?sr(i,this.onerror):i),o!==void 0?o:r}}function gg(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?sr(r,this.onsuccess):r),n&&(this.onerror=this.onerror?sr(n,this.onerror):n)}}function yg(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?sr(i,this.onsuccess):i),o&&(this.onerror=this.onerror?sr(o,this.onerror):o),n===void 0?s===void 0?void 0:s:Ve(n,s)}}function _g(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(ct&&(this._stackHolder=or(),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,Wl(this,t)}function Vl(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 Wl(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"?Wl(t,(i,o)=>{r instanceof R?r._then(i,o):r.then(i,o)}):(t._state=!0,t._value=r,$l(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,ct&&e!==null&&typeof e=="object"&&!e._promise&&ng(()=>{var n=gs(e,"stack");e._promise=t,vt(e,"stack",{get:()=>Fs?n&&(n.get?n.get.apply(e):n.value):t.stack})}),Ag(t),$l(t),r&&Nn()}}function $l(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r{--lr==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,++lr,Mn(wg,[r,t,e])}function wg(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&&Sg(e)),r.resolve(n)}catch(o){r.reject(o)}finally{Ds=null,--lr==0&&Ms(),--r.psd.ref||r.psd.finalize()}}function Ul(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 ct&&(n=xs(t._stackHolder,2),n&&e.indexOf(n)===-1&&e.push(n),t._prev&&Ul(t._prev,e,r)),e}function Gl(t,e){var r=e?e._numPrev+1:0;r0;)for(t=Rn,Rn=[],r=t.length,e=0;e0);Ts=!0,Fi=!0}function Ms(){var t=ar;ar=[],t.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var e=Di.slice(0),r=e.length;r;)e[--r]()}function jg(t){function e(){t(),Di.splice(Di.indexOf(e),1)}Di.push(e),++lr,Mn(()=>{--lr==0&&Ms()},[])}function Ag(t){ar.some(e=>e._value===t._value)||ar.push(t)}function Sg(t){for(var e=ar.length;e;)if(ar[--e]._value===t._value){ar.splice(e,1);return}}function Ii(t){return new R(kn,!1,t)}function de(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=++Eg;var s=Br.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:Yl(s.nthen,o),gthen:Yl(s.gthen,o)}:{},e&&Ve(o,e),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=zr(o,t,r,n);return o.ref===0&&o.finalize(),a}function Kr(){return Ke.id||(Ke.id=++Cg),++Ke.awaits,Ke.echoes+=zl,Ke.id}function wt(){return Ke.awaits?(--Ke.awaits==0&&(Ke.id=0),Ke.echoes=Ke.awaits*zl,!0):!1}function Mi(t){return Ke.echoes&&t&&t.constructor===Ei?(Kr(),t.then(e=>(wt(),e),e=>(wt(),je(e)))):t}function Fg(t){++ki,(!Ke.echoes||--Ke.echoes==0)&&(Ke.echoes=Ke.id=0),Pi.push(z),Lt(t,!0)}function Tg(){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))&&ql(e?Fg.bind(null,t):Tg),t!==z&&(z=t,r===Br&&(Br.env=Ql()),Es)){var n=Br.env.Promise,i=t.env;Ci.then=i.nthen,n.prototype.then=i.gthen,(r.global||t.global)&&(Object.defineProperty(ue,"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 Ql(){var t=ue.Promise;return Es?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(ue,"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 zr(t,e,r,n,i){var o=z;try{return Lt(t,!0),e(r,n,i)}finally{Lt(o,!1)}}function ql(t){Hl.call(Ss,t)}function Ri(t,e,r,n){return typeof t!="function"?t:function(){var i=z;r&&Kr(),Lt(e,!0);try{return t.apply(this,arguments)}finally{Lt(i,!1),n&&ql(wt)}}}function Yl(t,e){return function(r,n){return t.call(this,Ri(r,e),Ri(n,e))}}function Xl(t,e){var r;try{r=e.onuncatched(t)}catch{}if(r!==!1)try{var n,i={promise:e,reason:t};if(ue.document&&document.createEvent?(n=document.createEvent("Event"),n.initEvent(Jl,!0,!0),Ve(n,i)):ue.CustomEvent&&(n=new CustomEvent(Jl,{detail:i}),Ve(n,i)),n&&ue.dispatchEvent&&(dispatchEvent(n),!ue.PromiseRejectionEvent&&ue.onunhandledrejection))try{ue.onunhandledrejection(n)}catch{}ct&&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 cr(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,u){if(u){for(var l=arguments.length,f=new Array(l-1);--l;)f[l-1]=arguments[l];return e[a].subscribe.apply(null,f),t}else if(typeof a=="string")return e[a]};r.addEventType=o;for(var n=1,i=arguments.length;ncr(n(),e()):e,t.justLimit=r&&!n}function Pg(t,e){t.isMatch=cr(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 iu(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?cr(t.filter,t.replayFilter()):t.filter;if(t.or){let o={},s=(a,u,l)=>{if(!i||i(u,l,c=>u.stop(c),c=>u.fail(c))){var f=u.primaryKey,p=""+f;p==="[object ArrayBuffer]"&&(p=""+new Uint8Array(f)),Ye(o,p)||(o[p]=!0,e(a,u,l))}};return Promise.all([t.or._iterate(s,r),ou(iu(t,n,r),t.algorithm,s,!t.keysOnly&&t.valueMapper)])}else return ou(iu(t,n,r),cr(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function ou(t,e,r,n){var i=n?(s,a,u)=>r(n(s),a,u):r,o=de(i);return t.then(s=>{if(s)return s.start(()=>{var a=()=>s.continue();(!e||e(s,u=>a=u,u=>{s.stop(u),a=ie},u=>{s.fail(u),a=ie}))&&o(s.value,s,u=>a=u),a()})})}function We(t,e){try{let r=su(t),n=su(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:te?-1:t===e?0:1}function Je(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 Vr(t){return new t.Collection(t,()=>uu("")).limit(0)}function Bg(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function Kg(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function zg(t,e,r,n,i,o){for(var s=Math.min(t.length,n.length),a=-1,u=0;u=0?t.substr(0,a)+e[a]+r.substr(a+1):null;i(t[u],l)<0&&(a=u)}return stypeof j=="string"))return Je(t,eu);function c(j){i=Bg(j),o=Kg(j),s=j==="next"?Lg:Ng;var _=r.map(function(d){return{lower:o(d),upper:i(d)}}).sort(function(d,v){return s(d.lower,v.lower)});a=_.map(function(d){return d.upper}),u=_.map(function(d){return d.lower}),l=j,f=j==="next"?"":n}c("next");var h=new t.Collection(t,()=>Nt(a[0],u[p-1]+n));h._ondirectionchange=function(j){c(j)};var w=0;return h._addAlgorithm(function(j,_,d){var v=j.key;if(typeof v!="string")return!1;var m=o(v);if(e(m,u,w))return!0;for(var g=null,b=w;b0)&&(g=y)}return _(g!==null?function(){j.continue(g+f)}:d),!1}),h}function Nt(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function uu(t){return{type:1,lower:t,upper:t}}function Hg(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 ft(t){return de(function(e){return Hn(e),t(e.target.error),!1})}function Hn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}function Vg(t){return zn(cu.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,u)=>{this._resolve=a,this._reject=u}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},a=>{var u=this.active;return this.active=!1,this.on.error.fire(a),this.parent?this.parent._reject(a):u&&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?"++":"")+fu(e)}}function fu(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function du(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:Il(r,n=>[n.name,n])}}function Wg(t){return t.length===1?t[0]:t}function Us(t){return t==null?()=>{}:typeof t=="string"?$g(t):e=>bt(e,t)}function $g(t){return t.split(".").length===1?r=>r[t]:r=>bt(r,t)}function pu(t){return[].slice.call(t)}function $n(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Gg(t,e,r){function n(f,p){let c=pu(f.objectStoreNames);return{schema:{name:f.name,tables:c.map(h=>p.objectStore(h)).map(h=>{let{keyPath:w,autoIncrement:j}=h,_=Be(w),d=w==null,v={},m={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:d,compound:_,keyPath:w,autoIncrement:j,unique:!0,extractKey:Us(w)},indexes:pu(h.indexNames).map(g=>h.index(g)).map(g=>{let{name:b,unique:y,multiEntry:x,keyPath:S}=g,E=Be(S),D={name:b,compound:E,keyPath:S,unique:y,multiEntry:x,extractKey:Us(S)};return v[$n(S)]=D,D}),getIndexByKeyPath:g=>v[$n(g)]};return v[":id"]=m.primaryKey,w!=null&&(v[$n(w)]=m.primaryKey),m})},hasGetAll:c.length>0&&"getAll"in p.objectStore(c[0])&&!(typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(f){if(f.type===3)return null;if(f.type===4)throw new Error("Cannot convert never type to IDBKeyRange");let{lower:p,upper:c,lowerOpen:h,upperOpen:w}=f;return p===void 0?c===void 0?null:e.upperBound(c,!!w):c===void 0?e.lowerBound(p,!!h):e.bound(p,c,!!h,!!w)}function o(f){let p=f.name;function c({trans:j,type:_,keys:d,values:v,range:m}){return new Promise((g,b)=>{g=de(g);let y=j.objectStore(p),x=y.keyPath==null,S=_==="put"||_==="add";if(!S&&_!=="delete"&&_!=="deleteRange")throw new Error("Invalid operation type: "+_);let{length:E}=d||v||{length:1};if(d&&v&&d.length!==v.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,P=[],L=[],k=0,H=Y=>{++k,Hn(Y)};if(_==="deleteRange"){if(m.type===4)return g({numFailures:k,failures:L,results:[],lastResult:void 0});m.type===3?P.push(D=y.clear()):P.push(D=y.delete(i(m)))}else{let[Y,J]=S?x?[v,d]:[v,null]:[d,null];if(S)for(let C=0;C{let J=Y.target.result;P.forEach((C,F)=>C.error!=null&&(L[F]=C.error)),g({numFailures:k,failures:L,results:_==="delete"?d:P.map(C=>C.result),lastResult:J})};D.onerror=Y=>{H(Y),X(Y)},D.onsuccess=X})}function h({trans:j,values:_,query:d,reverse:v,unique:m}){return new Promise((g,b)=>{g=de(g);let{index:y,range:x}=d,S=j.objectStore(p),E=y.isPrimaryKey?S:S.index(y.name),D=v?m?"prevunique":"prev":m?"nextunique":"next",P=_||!("openKeyCursor"in E)?E.openCursor(i(x),D):E.openKeyCursor(i(x),D);P.onerror=ft(b),P.onsuccess=de(L=>{let k=P.result;if(!k){g(null);return}k.___id=++Ug,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=de(b),k.next=function(){let F=1;return this.start(()=>F--?this.continue():this.stop()).then(()=>this)},k.start=F=>{let I=new Promise((Z,oe)=>{Z=de(Z),P.onerror=ft(oe),k.fail=oe,k.stop=Ee=>{k.stop=k.continue=k.continuePrimaryKey=k.advance=C,Z(Ee)}}),K=()=>{if(P.result)try{F()}catch(Z){k.fail(Z)}else k.done=!0,k.start=()=>{throw new Error("Cursor behind last entry")},k.stop()};return P.onsuccess=de(Z=>{P.onsuccess=K,K()}),k.continue=H,k.continuePrimaryKey=X,k.advance=Y,K(),I},g(k)},b)})}function w(j){return _=>new Promise((d,v)=>{d=de(d);let{trans:m,values:g,limit:b,query:y}=_,x=b===1/0?void 0:b,{index:S,range:E}=y,D=m.objectStore(p),P=S.isPrimaryKey?D:D.index(S.name),L=i(E);if(b===0)return d({result:[]});if(j){let k=g?P.getAll(L,x):P.getAllKeys(L,x);k.onsuccess=H=>d({result:H.target.result}),k.onerror=ft(v)}else{let k=0,H=g||!("openKeyCursor"in P)?P.openCursor(L):P.openKeyCursor(L),X=[];H.onsuccess=Y=>{let J=H.result;if(!J)return d({result:X});if(X.push(g?J.value:J.primaryKey),++k===b)return d({result:X});J.continue()},H.onerror=ft(v)}})}return{name:p,schema:f,mutate:c,getMany({trans:j,keys:_}){return new Promise((d,v)=>{d=de(d);let m=j.objectStore(p),g=_.length,b=new Array(g),y=0,x=0,S,E=P=>{let L=P.target;(b[L._pos]=L.result)!=null,++x===y&&d(b)},D=ft(v);for(let P=0;P{d=de(d);let g=j.objectStore(p).get(_);g.onsuccess=b=>d(b.target.result),g.onerror=ft(v)})},query:w(a),openCursor:h,count({query:j,trans:_}){let{index:d,range:v}=j;return new Promise((m,g)=>{let b=_.objectStore(p),y=d.isPrimaryKey?b:b.index(d.name),x=i(v),S=x?y.count(x):y.count();S.onsuccess=de(E=>m(E.target.result)),S.onerror=ft(g)})}}}let{schema:s,hasGetAll:a}=n(t,r),u=s.tables.map(f=>o(f)),l={};return u.forEach(f=>l[f.name]=f),{stack:"dbcore",transaction:t.transaction.bind(t),table(f){if(!l[f])throw new Error(`Table '${f}' not found`);return l[f]},MIN_KEY:-1/0,MAX_KEY:Wn(e),schema:s}}function Qg(t,e){return e.reduce((r,{create:n})=>ge(ge({},r),n(r)),t)}function qg(t,e,{IDBKeyRange:r,indexedDB:n},i){return{dbcore:Qg(Gg(e,r,i),t.dbcore)}}function Gs({_novip:t},e){let r=e.db,n=qg(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?vt(s,i,{get(){return this.table(i)},set(u){Tl(this,i,{value:u,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 Yg(t,e){return t._cfg.version-e._cfg.version}function Jg(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?(be(i).forEach(u=>{qs(r,u,i[u].primKey,i[u].indexes)}),Gs(t,r),R.follow(()=>t.on.populate.fire(o)).catch(s)):Xg(t,e,o,r).catch(s)})}function Xg({_novip:t},e,r,n){let i=[],o=t._versions,s=t._dbSchema=Js(t,t.idbdb,n),a=!1;o.filter(f=>f._cfg.version>=e).forEach(f=>{i.push(()=>{let p=s,c=f._cfg.dbschema;Xs(t,p,n),Xs(t,c,n),s=t._dbSchema=c;let h=hu(p,c);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 _=n.objectStore(j.name);j.add.forEach(d=>Ys(_,d)),j.change.forEach(d=>{_.deleteIndex(d.name),Ys(_,d)}),j.del.forEach(d=>_.deleteIndex(d))}});let w=f._cfg.contentUpgrade;if(w&&f._cfg.version>e){Gs(t,n),r._memoizedTables={},a=!0;let j=Pl(c);h.del.forEach(m=>{j[m]=p[m]}),Qs(t,[t.Transaction.prototype]),Vi(t,[t.Transaction.prototype],be(j),j),r.schema=j;let _=bs(w);_&&Kr();let d,v=R.follow(()=>{if(d=w(r),d&&_){var m=wt.bind(null,null);d.then(m,m)}});return d&&typeof d.then=="function"?R.resolve(d):v.then(()=>d)}}),i.push(p=>{if(!a||!Dg){let c=f._cfg.dbschema;ey(c,p)}Qs(t,[t.Transaction.prototype]),Vi(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema})});function l(){return i.length?R.resolve(i.shift()(r.idbtrans)).then(l):R.resolve()}return l().then(()=>{Zg(s,n)})}function hu(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,u=o.idxByName,l;for(l in a)u[l]||s.del.push(l);for(l in u){let f=a[l],p=u[l];f?f.src!==p.src&&s.change.push(p):s.add.push(p)}(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 Zg(t,e){be(t).forEach(r=>{e.db.objectStoreNames.contains(r)||qs(e,r,t[r].primKey,t[r].indexes)})}function ey(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,u=$s(fu(a),a||"",!1,!1,!!s.autoIncrement,a&&typeof a!="string",!0),l=[];for(let p=0;pi.add.length||i.change.length))}function Xs({_novip:t},e,r){let n=r.db.objectStoreNames;for(let i=0;i{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 iy(t){return zn(mu.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 St(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 oy({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 sy({indexedDB:t,IDBKeyRange:e},r){!ea(t)&&r!==Ni&&Zs(t,e).put({name:r}).catch(ie)}function ay({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 ly(){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 uy(t){let e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?je(e.dbOpenError):t);ct&&(e.openCanceller._stackHolder=or()),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():ly()).then(()=>new R((u,l)=>{if(i(),!r)throw new V.MissingAPI;let f=t.name,p=e.autoSchema?r.open(f):r.open(f,Math.round(t.verno*10));if(!p)throw new V.MissingAPI;p.onerror=ft(l),p.onblocked=de(t._fireOnBlocked),p.onupgradeneeded=de(c=>{if(s=p.transaction,e.autoSchema&&!t._options.allowEmptyDB){p.onerror=Hn,s.abort(),p.result.close();let w=r.deleteDatabase(f);w.onsuccess=w.onerror=de(()=>{l(new V.NoSuchDatabase(`Database ${f} doesnt exist`))})}else{s.onerror=ft(l);var h=c.oldVersion>Math.pow(2,62)?0:c.oldVersion;a=h<1,t._novip.idbdb=p.result,Jg(t,h/10,s,l)}},l),p.onsuccess=de(()=>{s=null;let c=t._novip.idbdb=p.result,h=ji(c.objectStoreNames);if(h.length>0)try{let w=c.transaction(Wg(h),"readonly");e.autoSchema?ty(t,c,w):(Xs(t,t._dbSchema,w),ry(t,w)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Gs(t,w)}catch{}Bn.push(t),c.onversionchange=de(w=>{e.vcFired=!0,t.on("versionchange").fire(w)}),c.onclose=de(w=>{t.on("close").fire(w)}),a&&sy(t._deps,f),u()},l)}))]).then(()=>(i(),e.onReadyBeingFired=[],R.resolve(ta(()=>t.on.ready.fire(t.vip))).then(function u(){if(e.onReadyBeingFired.length>0){let l=e.onReadyBeingFired.reduce(As,ie);return e.onReadyBeingFired=[],R.resolve(ta(()=>l(t.vip))).then(u)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(u=>{e.dbOpenError=u;try{s&&s.abort()}catch{}return n===e.openCanceller&&t._close(),je(u)}).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 u=s(a),l=u.value;return u.done?l:!l||typeof l.then!="function"?Be(l)?Promise.all(l).then(n,i):n(l):l.then(n,i)}}return o(e)()}function cy(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=kl(i);return[t,o,r]}function gu(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(p){return p.name===js.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>gu(t,e,r,null,i))):je(p)}let u=bs(i);u&&Kr();let l,f=R.follow(()=>{if(l=i.call(s,s),l)if(u){var p=wt.bind(null,null);l.then(p,p)}else typeof l.next=="function"&&typeof l.throw=="function"&&(l=ra(l))},a);return(l&&typeof l.then=="function"?R.resolve(l).then(p=>s.active?p:je(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):f.then(()=>l)).then(p=>(n&&s._resolve(),s._completion.then(()=>p))).catch(p=>(s._reject(p),je(p)))})}function Wi(t,e,r){let n=Be(t)?t.slice():[t];for(let i=0;i0,m=ze(ge({},w),{isVirtual:v,keyTail:h,keyLength:d,extractKey:Us(c),unique:!v&&w.unique});if(_.push(m),m.isPrimaryKey||o.push(m),d>1){let g=d===2?c[0]:c.slice(0,d-1);s(g,h+1,w)}return _.sort((g,b)=>g.keyTail-b.keyTail),m}let a=s(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[a];for(let c of n.indexes)s(c.keyPath,0,c);function u(c){let h=i[$n(c)];return h&&h[0]}function l(c,h){return{type:c.type===1?2:c.type,lower:Wi(c.lower,c.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:Wi(c.upper,c.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0}}function f(c){let h=c.query.index;return h.isVirtual?ze(ge({},c),{query:{index:h,range:l(c.query.range,h.keyTail)}}):c}return ze(ge({},r),{schema:ze(ge({},n),{primaryKey:a,indexes:o,getIndexByKeyPath:u}),count(c){return r.count(f(c))},query(c){return r.query(f(c))},openCursor(c){let{keyTail:h,isVirtual:w,keyLength:j}=c.query.index;if(!w)return r.openCursor(c);function _(d){function v(g){g!=null?d.continue(Wi(g,c.reverse?t.MAX_KEY:t.MIN_KEY,h)):c.unique?d.continue(d.key.slice(0,j).concat(c.reverse?t.MIN_KEY:t.MAX_KEY,h)):d.continue()}return Object.create(d,{continue:{value:v},continuePrimaryKey:{value(g,b){d.continuePrimaryKey(Wi(g,t.MAX_KEY,h),b)}},primaryKey:{get(){return d.primaryKey}},key:{get(){let g=d.key;return j===1?g[0]:g.slice(0,j)}},value:{get(){return d.value}}})}return r.openCursor(f(c)).then(d=>d&&_(d))}})}})}function na(t,e,r,n){return r=r||{},n=n||"",be(t).forEach(i=>{if(!Ye(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),u=_s(s);a!==u?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])}}),be(e).forEach(i=>{Ye(t,i)||(r[n+i]=e[i])}),r}function py(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}function my(t,e,r){return e.type==="add"?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}function yu(t,e,r){try{if(!e||e.keys.length0)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},_u(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},_u(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 yy(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 _u(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=ge({},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=vu(s)}t.d=vu(t)}function vu({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function vy(t,e,r,n){function i(o){let s=t(o.name||"");function a(l){return l!=null?o.extractKey(l):null}let u=l=>o.multiEntry&&Be(l)?l.forEach(f=>s.addKey(f)):s.addKey(l);(r||n).forEach((l,f)=>{let p=r&&a(r[f]),c=n&&a(n[f]);We(p,c)!==0&&(p!=null&&u(p),c!=null&&u(c))})}e.indexes.forEach(i)}function xu(t,e){return be(e).forEach(r=>{let n=t[r]||(t[r]=new At);$i(n,e[r])}),t}function xy(t){let e=!1,r,n=new bu(i=>{let o=bs(t);function s(_){o&&Kr();let d=()=>Rt(t,{subscr:_,trans:null}),v=z.trans?zr(z.transless,d):d();return o&&v.then(wt,wt),v}let a=!1,u={},l={},f={get closed(){return a},unsubscribe:()=>{a=!0,Kt.storagemutated.unsubscribe(w)}};i.start&&i.start(f);let p=!1,c=!1;function h(){return be(l).some(_=>u[_]&&yy(u[_],l[_]))}let w=_=>{xu(u,_),h()&&j()},j=()=>{if(p||a)return;u={};let _={},d=s(_);c||(Kt(Vn,w),c=!0),p=!0,Promise.resolve(d).then(v=>{e=!0,r=v,p=!1,!a&&(h()?j():(u={},l=_,i.next&&i.next(v)))},v=>{p=!1,e=!1,i.error&&i.error(v),f.unsubscribe()})};return j(),f});return n.hasValue=()=>e,n.getValue=()=>r,n}function Ui(t){let e=Ct;try{Ct=!0,Kt.storagemutated.fire(t)}finally{Ct=e}}function wy({data:t}){t&&t.type===Bt&&Ui(t.changedParts)}var ue,be,Be,Tn,eg,Tl,tg,rg,og,Ml,sg,Mt,ag,vs,lg,Lr,bs,ct,Ll,ug,cg,Nl,ws,fg,js,dg,V,Kl,Si,kn,vg,bg,zl,Ss,Ci,Cs,Hl,Ei,Es,Fs,xg,Mn,Ts,Fi,ar,Ti,Ds,Os,Br,z,Rn,lr,Di,Is,Ke,Cg,Pi,Rs,ki,Eg,Jl,je,Zl,ur,Ns,jt,eu,Bn,Li,Dg,Og,tu,Ni,Bs,Ks,ru,nu,lu,Vs,Ws,Vn,Bt,Kt,cu,Wn,Ug,mu,dy,hy,gy,At,_y,St,by,bu,sa,fr,Ct,wu=A(()=>{ue=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,be=Object.keys,Be=Array.isArray;typeof Promise!="undefined"&&!ue.Promise&&(ue.Promise=Promise);Tn=Object.getPrototypeOf,eg={}.hasOwnProperty;Tl=Object.defineProperty;tg=Object.getOwnPropertyDescriptor;rg=[].slice;og=[].concat;Ml="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(kl([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>ue[t]),sg=Ml.map(t=>ue[t]);Il(Ml,t=>[t,!0]);Mt=null;({toString:ag}={});vs=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",lg=typeof vs=="symbol"?function(t){var e;return t!=null&&(e=t[vs])&&e.apply(t)}:function(){return null},Lr={};bs=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,ct=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);Ll=()=>!0,ug=!new Error("").stack;cg=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Nl=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ws=cg.concat(Nl),fg={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"};Rr(Nr).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}});Rr(Ai).from(Nr);Rr(In).from(Nr);js=ws.reduce((t,e)=>(t[e]=e+"Error",t),{}),dg=Nr,V=ws.reduce((t,e)=>{var r=e+"Error";function n(i,o){this._e=or(),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=fg[e]||r,this.inner=null)}return Rr(n).from(dg),t[e]=n,t},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;Kl=Nl.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=Nr;Si.BulkError=In;kn={},vg=100,bg=20,zl=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]})(),Hl=Ci&&Ci.then,Ei=Ss&&Ss.constructor,Es=!!Cs,Fs=!1,xg=Cs?()=>{Cs.then(Oi)}:ue.setImmediate?setImmediate.bind(null,Oi):ue.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&&(xg(),Fi=!1)},Ts=!0,Fi=!0,ar=[],Ti=[],Ds=null,Os=Pn,Br={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Xl,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{Xl(t[0],t[1])}catch{}})}},z=Br,Rn=[],lr=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&&!wt();var a=new R((u,l)=>{ks(this,new Vl(Ri(n,t,o,s),Ri(i,t,o,s),u,l,t))});return ct&&Gl(a,this),a}return r.prototype=kn,r},set:function(t){vt(this,"then",t&&t.prototype===kn?Is:{get:function(){return t},set:Is.set})}};Mr(R.prototype,{then:Is,_then:function(t,e){ks(this,new Vl(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=Ul(this,[],bg),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&&vt(R.prototype,Symbol.toStringTag,"Dexie.Promise");Br.env=Ql();Mr(R,{all:function(){var t=xt.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 Gl(e,Ds),e},reject:Ii,race:function(){var t=xt.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:zr,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=sr(function(){jg(()=>{this.unhandleds.length===0?i():o(this.unhandleds[0])})},s.finalize),t()},e,r,n))});Ei&&(Ei.allSettled&&vt(R,"allSettled",function(){let t=xt.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"&&vt(R,"any",function(){let t=xt.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},Cg=0,Pi=[],Rs=0,ki=0,Eg=0;(""+Hl).indexOf("[native code]")===-1&&(Kr=wt=ie);Jl="unhandledrejection";je=R.reject;Zl="3.2.4",ur=String.fromCharCode(65535),Ns=-1/0,jt="Invalid key provided. Keys must be of type string, number, Date or Array.",eu="String expected.",Bn=[],Li=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Dg=Li,Og=Li,tu=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Ni="__dbnames",Bs="readonly",Ks="readwrite";ru={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};nu=class{_trans(e,r,n){let i=this._tx||z.trans,o=this.name;function s(u,l,f){if(!f.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return r(f.idbtrans,f)}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=be(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(l=>l.compound&&r.every(f=>l.keyPath.indexOf(f)>=0)&&l.keyPath.every(f=>r.indexOf(f)>=0))[0];if(n&&this.db._maxKey!==ur)return this.where(n.name).equals(n.keyPath.map(l=>e[l]));!n&&ct&&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(l,f){try{return o.cmp(l,f)===0}catch{return!1}}let[a,u]=r.reduce(([l,f],p)=>{let c=i[p],h=e[p];return[l||c,l||!c?cr(f,c&&c.multi?w=>{let j=bt(w,p);return Be(j)&&j.some(_=>s(h,_))}:w=>s(h,bt(w,p))):f]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(u):n?this.filter(u):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(Ye(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{it(e,i,s)}catch{}return s})}update(e,r){if(typeof e=="object"&&!Be(e)){let n=bt(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"?be(r).forEach(i=>{it(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{it(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:ru})).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:u}=this.schema.primKey;if(u&&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 l=e.length,f=u&&a?e.map(Bi(u)):e;return this.core.mutate({trans:s,type:"add",keys:i,values:f,wantResults:o}).then(({numFailures:p,results:c,lastResult:h,failures:w})=>{let j=o?c:h;if(p===0)return j;throw new In(`${this.name}.bulkAdd(): ${p} of ${l} operations failed`,w)})})}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:u}=this.schema.primKey;if(u&&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 l=e.length,f=u&&a?e.map(Bi(u)):e;return this.core.mutate({trans:s,type:"put",keys:i,values:f,wantResults:o}).then(({numFailures:p,results:c,lastResult:h,failures:w})=>{let j=o?c:h;if(p===0)return j;throw new In(`${this.name}.bulkPut(): ${p} of ${l} operations failed`,w)})})}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)})}};lu=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=cr(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(Hr(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(l,f){return f?s(l[n[f]],f-1):l[i]}var a=this._ctx.dir==="next"?1:-1;function u(l,f){var p=s(l,o),c=s(f,o);return pc?a:0}return this.toArray(function(l){return l.sort(u)}).then(r)}toArray(e){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&Hr(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,Hr(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)}),Pg(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"&&Hr(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=Ye(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=be(e),s=o.length;i=function(j){for(var _=!1,d=0;d{let{failures:d,numFailures:v}=_;c+=j-v;for(let m of be(d))p.push(d[m])};return this.clone().primaryKeys().then(j=>{let _=d=>{let v=Math.min(f,j.length-d);return a.getMany({trans:n,keys:j.slice(d,d+v),cache:"immutable"}).then(m=>{let g=[],b=[],y=u?[]:null,x=[];for(let E=0;E0&&a.mutate({trans:n,type:"add",values:g}).then(E=>{for(let D in E.failures)x.splice(parseInt(D),1);w(g.length,E)})).then(()=>(b.length>0||S&&typeof e=="object")&&a.mutate({trans:n,type:"put",keys:y,values:b,criteria:S,changeSpec:typeof e!="function"&&e}).then(E=>w(b.length,E))).then(()=>(x.length>0||S&&e===Vs)&&a.mutate({trans:n,type:"delete",keys:x,criteria:S}).then(E=>w(x.length,E))).then(()=>j.length>d+v&&_(d+f))})};return _(0).then(()=>{if(p.length>0)throw new Ai("Error modifying one or more objects",p,c,h);return j.length})})})}delete(){var e=this._ctx,r=e.range;return Hr(e)&&(e.isPrimKey&&!Og||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:u,results:l,numFailures:f})=>{if(f)throw new Ai("Could not delete some values",Object.keys(a).map(p=>a[p]),s-f);return s-f}))}):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)?Vr(this):new this.Collection(this,()=>Nt(e,r,!n,!i))}catch{return Je(this,jt)}}equals(e){return e==null?Je(this,jt):new this.Collection(this,()=>uu(e))}above(e){return e==null?Je(this,jt):new this.Collection(this,()=>Nt(e,void 0,!0))}aboveOrEqual(e){return e==null?Je(this,jt):new this.Collection(this,()=>Nt(e,void 0,!1))}below(e){return e==null?Je(this,jt):new this.Collection(this,()=>Nt(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Je(this,jt):new this.Collection(this,()=>Nt(void 0,e))}startsWith(e){return typeof e!="string"?Je(this,eu):this.between(e,e+ur,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):Hi(this,(r,n)=>r.indexOf(n[0])===0,[e],ur)}equalsIgnoreCase(e){return Hi(this,(r,n)=>r===n[0],[e],"")}anyOfIgnoreCase(){var e=xt.apply(Lr,arguments);return e.length===0?Vr(this):Hi(this,(r,n)=>n.indexOf(r)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=xt.apply(Lr,arguments);return e.length===0?Vr(this):Hi(this,(r,n)=>n.some(i=>r.indexOf(i)===0),e,ur)}anyOf(){let e=xt.apply(Lr,arguments),r=this._cmp;try{e.sort(r)}catch{return Je(this,jt)}if(e.length===0)return Vr(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 u=o.key;for(;r(u,e[i])>0;)if(++i,i===e.length)return s(a),!1;return r(u,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=xt.apply(Lr,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Je(this,jt)}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 Vr(this);if(!e.every(g=>g[0]!==void 0&&g[1]!==void 0&&i(g[0],g[1])<=0))return Je(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 u=!r||r.includeLowers!==!1,l=r&&r.includeUppers===!0;function f(g,b){let y=0,x=g.length;for(;y0){S[0]=s(S[0],b[0]),S[1]=a(S[1],b[1]);break}}return y===x&&g.push(b),g}let p=i;function c(g,b){return p(g[0],b[0])}let h;try{h=e.reduce(f,[]),h.sort(c)}catch{return Je(this,jt)}let w=0,j=l?g=>i(g,h[w][1])>0:g=>i(g,h[w][1])>=0,_=u?g=>o(g,h[w][0])>0:g=>o(g,h[w][0])>=0;function d(g){return!j(g)&&!_(g)}let v=j,m=new this.Collection(this,()=>Nt(h[0][0],h[h.length-1][1],!u,!l));return m._ondirectionchange=g=>{g==="next"?(v=j,p=i):(v=_,p=o),h.sort(c)},m._addAlgorithm((g,b,y)=>{for(var x=g.key;v(x);)if(++w,w===h.length)return b(y),!1;return d(x)?!0:(this._cmp(x,h[w][1])===0||this._cmp(x,h[w][0])===0||b(()=>{p===i?g.continue(h[w][0]):g.continue(h[w][1])}),!1)}),m}startsWithAnyOf(){let e=xt.apply(Lr,arguments);return e.every(r=>typeof r=="string")?e.length===0?Vr(this):this.inAnyRange(e.map(r=>[r,r+ur])):Je(this,"startsWithAnyOf() only works with strings")}};Vn="storagemutated",Bt="x-storagemutated-1",Kt=Kn(null,Vn),cu=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{zr(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=de(i=>{Hn(i),this._reject(e.error)}),e.onabort=de(i=>{Hn(i),this.active&&this._reject(new V.Abort(e.error)),this.active=!1,this.on("abort").fire(i)}),e.oncomplete=de(()=>{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 u=r(s,a,this);u&&u.then&&u.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(u=>r._waitingQueue.push(de(s.bind(null,u))),u=>r._waitingQueue.push(de(a.bind(null,u)))).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(Ye(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=()=>ur,ur}};Ug=0;mu=class{_parseStoresSpec(e,r){be(e).forEach(n=>{if(e[n]!==null){var i=ny(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]=du(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],be(o),o),r._storeNames=be(o),this}upgrade(e){return this._cfg.contentUpgrade=As(this._cfg.contentUpgrade||ie,e),this}};dy={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:fy};hy={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>ze(ge({},t),{table(e){let r=t.table(e),{primaryKey:n}=r.schema;return ze(ge({},r),{mutate(o){let s=z.trans,{deleting:a,creating:u,updating:l}=s.table(e).hook;switch(o.type){case"add":if(u.fire===ie)break;return s._promise("readwrite",()=>f(o),!0);case"put":if(u.fire===ie&&l.fire===ie)break;return s._promise("readwrite",()=>f(o),!0);case"delete":if(a.fire===ie)break;return s._promise("readwrite",()=>f(o),!0);case"deleteRange":if(a.fire===ie)break;return s._promise("readwrite",()=>p(o),!0)}return r.mutate(o);function f(h){let w=z.trans,j=h.keys||py(n,h);if(!j)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?ze(ge({},h),{keys:j}):ge({},h),h.type!=="delete"&&(h.values=[...h.values]),h.keys&&(h.keys=[...h.keys]),my(r,h,j).then(_=>{let d=j.map((v,m)=>{let g=_[m],b={onerror:null,onsuccess:null};if(h.type==="delete")a.fire.call(b,v,g,w);else if(h.type==="add"||g===void 0){let y=u.fire.call(b,v,h.values[m],w);v==null&&y!=null&&(v=y,h.keys[m]=v,n.outbound||it(h.values[m],n.keyPath,v))}else{let y=na(g,h.values[m]),x=l.fire.call(b,y,v,g,w);if(x){let S=h.values[m];Object.keys(x).forEach(E=>{Ye(S,E)?S[E]=x[E]:it(S,E,x[E])})}}return b});return r.mutate(h).then(({failures:v,results:m,numFailures:g,lastResult:b})=>{for(let y=0;y(d.forEach(m=>m.onerror&&m.onerror(v)),Promise.reject(v)))})}function p(h){return c(h.trans,h.range,1e4)}function c(h,w,j){return r.query({trans:h,values:!1,query:{index:n,range:w},limit:j}).then(({result:_})=>f({type:"delete",keys:_,trans:h}).then(d=>d.numFailures>0?Promise.reject(d.failures[0]):_.length({table:e=>{let r=t.table(e);return ze(ge({},r),{getMany:n=>{if(!n.cache)return r.getMany(n);let i=yu(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))})}})};At=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 At;return t&&"d"in t&&Ve(r,t),r}};Mr(At.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)}});_y={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,r=new At(t.MIN_KEY,t.MAX_KEY);return ze(ge({},t),{table:n=>{let i=t.table(n),{schema:o}=i,{primaryKey:s}=o,{extractKey:a,outbound:u}=s,l=ze(ge({},i),{mutate:c=>{let h=c.trans,w=h.mutatedParts||(h.mutatedParts={}),j=y=>{let x=`idb://${e}/${n}/${y}`;return w[x]||(w[x]=new At)},_=j(""),d=j(":dels"),{type:v}=c,[m,g]=c.type==="deleteRange"?[c.range]:c.type==="delete"?[c.keys]:c.values.length<50?[[],c.values]:[],b=c.trans._cache;return i.mutate(c).then(y=>{if(Be(m)){v!=="delete"&&(m=y.results),_.addKeys(m);let x=yu(m,b);!x&&v!=="add"&&d.addKeys(m),(x||g)&&vy(j,o,x,g)}else if(m){let x={from:m.lower,to:m.upper};d.add(x),_.add(x)}else _.add(r),d.add(r),o.indexes.forEach(x=>j(x.name).add(r));return y})}}),f=({query:{index:c,range:h}})=>{var w,j;return[c,new At((w=h.lower)!==null&&w!==void 0?w:t.MIN_KEY,(j=h.upper)!==null&&j!==void 0?j:t.MAX_KEY)]},p={get:c=>[s,new At(c.key)],getMany:c=>[s,new At().addKeys(c.keys)],count:f,query:f,openCursor:f};return be(p).forEach(c=>{l[c]=function(h){let{subscr:w}=z;if(w){let j=g=>{let b=`idb://${e}/${n}/${g}`;return w[b]||(w[b]=new At)},_=j(""),d=j(":dels"),[v,m]=p[c](h);if(j(v.name||"").add(m),!v.isPrimaryKey)if(c==="count")d.add(r);else{let g=c==="query"&&u&&h.values&&i.query(ze(ge({},h),{values:!1}));return i[c].apply(this,arguments).then(b=>{if(c==="query"){if(u&&h.values)return g.then(({result:x})=>(_.addKeys(x),b));let y=h.values?b.result.map(a):b.result;h.values?_.addKeys(y):d.addKeys(y)}else if(c==="openCursor"){let y=b,x=h.values;return y&&Object.create(y,{key:{get(){return d.addKey(y.primaryKey),y.key}},primaryKey:{get(){let S=y.primaryKey;return d.addKey(S),S}},value:{get(){return x&&_.addKey(y.primaryKey),y.value}}})}return b})}}return i[c].apply(this,arguments)}}),l}})}};St=class{constructor(e,r){this._middlewares={},this.verno=0;let n=St.dependencies;this._options=r=ge({addons:St.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=Dl(this.on.ready.subscribe,s=>(a,u)=>{St.vip(()=>{let l=this._state;if(l.openComplete)l.dbOpenError||R.resolve().then(a),u&&s(a);else if(l.onReadyBeingFired)l.onReadyBeingFired.push(a),u&&s(a);else{s(a);let f=this;u||s(function p(){f.on.ready.unsubscribe(a),f.on.ready.unsubscribe(p)})}})}),this.Collection=Rg(this),this.Table=Ig(this),this.Transaction=Vg(this),this.Version=iy(this),this.WhereClause=Hg(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.newVersionnew this.Transaction(s,a,u,this._options.chromeTransactionDurability,l),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(dy),this.use(hy),this.use(_y),this.use(gy),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(Yg),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 uy(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=de(()=>{ay(this._deps,this.name),n()}),s.onerror=ft(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 be(this._allTables).map(e=>this._allTables[e])}transaction(){let e=cy.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(l=>{var f=l instanceof this.Table?l.name:l;if(typeof f!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return f}),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(l=>{if(i&&i.storeNames.indexOf(l)===-1)if(o)i=null;else throw new V.SubTransaction("Table "+l+" not included in parent transaction.")}),o&&i&&!i.active&&(i=null)}}catch(l){return i?i._promise(null,(f,p)=>{p(l)}):je(l)}let u=gu.bind(null,this,s,a,i,n);return i?i._promise(s,u,"lock"):z.trans?zr(z.transless,()=>this._whenReady(u)):this._whenReady(u)}table(e){if(!Ye(this._allTables,e))throw new V.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},by=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",bu=class{constructor(e){this._subscribe=e}subscribe(e,r,n){return this._subscribe(!e||typeof e=="function"?{next:e,error:r,complete:n}:e)}[by](){return this}};try{sa={indexedDB:ue.indexedDB||ue.mozIndexedDB||ue.webkitIndexedDB||ue.msIndexedDB,IDBKeyRange:ue.IDBKeyRange||ue.webkitIDBKeyRange}}catch{sa={indexedDB:null,IDBKeyRange:null}}fr=St;Mr(fr,ze(ge({},Si),{delete(t){return new fr(t,{addons:[]}).delete()},exists(t){return new fr(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return oy(fr.dependencies).then(t)}catch{return je(new V.MissingAPI)}},defineClass(){function t(e){Ve(this,e)}return t},ignoreTransaction(t){return z.trans?zr(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"?fr.ignoreTransaction(t):t).timeout(e||6e4);return z.trans?z.trans.waitFor(r):r},Promise:R,debug:{get:()=>ct,set:t=>{Rl(t,t==="dexie"?()=>!0:tu)}},derive:Rr,extend:Ve,props:Mr,override:Dl,Events:Kn,on:Kt,liveQuery:xy,extendObservabilitySet:xu,getByKeyPath:bt,setByKeyPath:it,delByKeyPath:ig,shallowClone:Pl,deepClone:On,getObjectDiff:na,cmp:We,asap:Ol,minKey:Ns,addons:[],connections:Bn,errnames:js,dependencies:sa,semVer:Zl,version:Zl.split(".").map(t=>parseInt(t)).reduce((t,e,r)=>t+e/Math.pow(10,r*2))}));fr.maxKey=Wn(fr.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(Kt(Vn,t=>{if(!Ct){let e;Li?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Bt,!0,!0,t)):e=new CustomEvent(Bt,{detail:t}),Ct=!0,dispatchEvent(e),Ct=!1}}),addEventListener(Bt,({detail:t})=>{Ct||Ui(t)}));Ct=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(Bt);typeof t.unref=="function"&&t.unref(),Kt(Vn,e=>{Ct||t.postMessage(e)}),t.onmessage=e=>{e.data&&Ui(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){Kt(Vn,e=>{try{Ct||(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",wy)}R.rejectionMapper=pg;Rl(ct,tu)});var ju,dt,Wr,Te,Gi=A(()=>{wu();ju=_e(require("obsidian")),dt=class extends St{constructor(){super(dt.dbName);this.version(dt.dbVersion).stores({searchHistory:"++id",minisearch:"date"})}static async clearOldDatabases(){let e=(await indexedDB.databases()).filter(r=>r.name===dt.dbName&&r.version!==dt.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 dt.instance||(dt.instance=new dt),dt.instance}async clearCache(){new ju.Notice("Omnisearch - Cache cleared. Please restart Obsidian."),await this.minisearch.clear()}},Wr=dt;Wr.dbVersion=8,Wr.dbName="omnisearch/cache/"+app.appId;Te=Wr.getInstance()});async function Au(t){T=Object.assign({},zt,await t.loadData()),dr.set(T.showExcerpt)}async function se(t){await t.saveData(T)}function la(){return app.loadLocalStorage(Gn)==="1"}function Su(){return T.unsupportedFilesIndexing==="yes"||T.unsupportedFilesIndexing==="default"&&!!app.vault.getConfig("showUnsupportedFiles")}var U,dr,Qi,aa,zt,T,Ze=A(()=>{U=_e(require("obsidian"));ms();Gi();ot();dr=wi(!1),Qi='Needs a restart to fully take effect.',aa=class extends U.PluginSettingTab{constructor(e){super(e.app,e);this.plugin=e,dr.subscribe(async r=>{T.showExcerpt=r,await se(this.plugin)})}display(){let{containerEl:e}=this;if(e.empty(),this.app.loadLocalStorage(Gn)=="1"){let c=e.createEl("span");c.innerHTML='\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F'}e.createEl("h2",{text:"Omnisearch"});let r=e.createDiv();r.innerHTML=` Buy Me a Coffee at ko-fi.com `;let n=new DocumentFragment;n.createSpan({},c=>{c.innerHTML='\u26A0\uFE0F Changing indexing settings will clear the cache, and requires a restart of Obsidian.

',pt()?c.innerHTML+=` \u{1F44D} You have installed Text Extractor, Omnisearch can use it to index PDFs and images contents.
Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:c.innerHTML+='\u26A0\uFE0F Omnisearch requires Text Extractor to index PDFs and images.'}),new U.Setting(e).setName("Indexing").setHeading().setDesc(n);let i=new DocumentFragment;i.createSpan({},c=>{c.innerHTML="Omnisearch will use Text Extractor to index the content of your PDFs"}),new U.Setting(e).setName(`PDFs content indexing ${pt()?"":"\u26A0\uFE0F Disabled"}`).setDesc(i).addToggle(c=>c.setValue(T.PDFIndexing).onChange(async h=>{await Te.clearCache(),T.PDFIndexing=h,await se(this.plugin)})).setDisabled(!pt());let o=new DocumentFragment;o.createSpan({},c=>{c.innerHTML="Omnisearch will use Text Extractor to OCR your images and index their content"}),new U.Setting(e).setName(`Images OCR indexing ${pt()?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(c=>c.setValue(T.imagesIndexing).onChange(async h=>{await Te.clearCache(),T.imagesIndexing=h,await se(this.plugin)})).setDisabled(!pt());let s=new DocumentFragment;s.createSpan({},c=>{c.innerHTML=` Omnisearch can index filenames of "unsupported" files, such as e.g.
.mp4
,
.xlsx
, or non-extracted PDFs & images.
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions"`}),new U.Setting(e).setName("Index paths of unsupported files").setDesc(s).addDropdown(c=>{c.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(T.unsupportedFilesIndexing).onChange(async h=>{await Te.clearCache(),T.unsupportedFilesIndexing=h,await se(this.plugin)})});let a=new DocumentFragment;a.createSpan({},c=>{c.innerHTML=`In addition to standard md files, Omnisearch can also index other PLAINTEXT files.
Add extensions separated by a space, without the dot. Example: "txt org csv".
\u26A0\uFE0F Using extensions of non-plaintext files (like .docx or .pptx) WILL cause crashes, because Omnisearch will try to index their content.`}),new U.Setting(e).setName("Additional TEXT files to index").setDesc(a).addText(c=>{c.setValue(T.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async h=>{await Te.clearCache(),T.indexedFileTypes=h.split(" "),await se(this.plugin)})}),new U.Setting(e).setName("Behavior").setHeading(),new U.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(c=>c.setValue(T.useCache).onChange(async h=>{T.useCache=h,await se(this.plugin)})),new U.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(c=>c.setValue(T.showPreviousQueryResults).onChange(async h=>{T.showPreviousQueryResults=h,await se(this.plugin)})),new U.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(c=>c.setValue(T.hideExcluded).onChange(async h=>{T.hideExcluded=h,await se(this.plugin)}));let u=new DocumentFragment;u.createSpan({},c=>{c.innerHTML=`Enable this if you want to be able to search for CamelCaseWords as separate words.
\u26A0\uFE0F Changing this setting will clear the cache.
${Qi} `}),new U.Setting(e).setName("Split CamelCaseWords").setDesc(u).addToggle(c=>c.setValue(T.splitCamelCase).onChange(async h=>{await Te.clearCache(),T.splitCamelCase=h,await se(this.plugin)})),new U.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(c=>c.setValue(T.simpleSearch).onChange(async h=>{T.simpleSearch=h,await se(this.plugin)})),new U.Setting(e).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(c=>c.setValue(T.openInNewPane).onChange(async h=>{T.openInNewPane=h,await se(this.plugin)})),new U.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(c=>c.setValue(T.vimLikeNavigationShortcut).onChange(async h=>{T.vimLikeNavigationShortcut=h,await se(this.plugin)})),new U.Setting(e).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(c=>c.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(T.fuzziness).onChange(async h=>{["0","1","2"].includes(h)||(h="2"),T.fuzziness=h,await se(this.plugin)})),new U.Setting(e).setName("User Interface").setHeading(),new U.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(c=>c.setValue(T.ribbonIcon).onChange(async h=>{T.ribbonIcon=h,await se(this.plugin),h?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new U.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(c=>c.setValue(T.showExcerpt).onChange(async h=>{dr.set(h)})),new U.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(c=>c.setValue(T.renderLineReturnInExcerpts).onChange(async h=>{T.renderLineReturnInExcerpts=h,await se(this.plugin)}));let l=new DocumentFragment;if(l.createSpan({},c=>{c.innerHTML=`Shows a button next to the search input, to create a note. Acts the same as the shift \u21B5 shortcut, can be useful for mobile device users.`}),new U.Setting(e).setName('Show "Create note" button').setDesc(l).addToggle(c=>c.setValue(T.showCreateButton).onChange(async h=>{T.showCreateButton=h,await se(this.plugin)})),new U.Setting(e).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(c=>c.setValue(T.highlight).onChange(async h=>{T.highlight=h,await se(this.plugin)})),new U.Setting(e).setName("Results weighting").setHeading(),new U.Setting(e).setName(`File name & declared aliases (default: ${zt.weightBasename})`).addSlider(c=>this.weightSlider(c,"weightBasename")),new U.Setting(e).setName(`File directory (default: ${zt.weightDirectory})`).addSlider(c=>this.weightSlider(c,"weightDirectory")),new U.Setting(e).setName(`Headings level 1 (default: ${zt.weightH1})`).addSlider(c=>this.weightSlider(c,"weightH1")),new U.Setting(e).setName(`Headings level 2 (default: ${zt.weightH2})`).addSlider(c=>this.weightSlider(c,"weightH2")),new U.Setting(e).setName(`Headings level 3 (default: ${zt.weightH3})`).addSlider(c=>this.weightSlider(c,"weightH3")),new U.Setting(e).setName(`Tags without the # (default: ${zt.weightUnmarkedTags})`).addSlider(c=>this.weightSlider(c,"weightUnmarkedTags")),new U.Setting(e).setName("Debugging").setHeading(),new U.Setting(e).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(c=>c.setValue(T.verboseLogging).onChange(async h=>{T.verboseLogging=h,await se(this.plugin)})),!U.Platform.isMobile){let c=new DocumentFragment;c.createSpan({},h=>{h.innerHTML='Omnisearch can be used through a simple HTTP server (more information).'}),new U.Setting(e).setName("API Access Through HTTP").setHeading().setDesc(c),new U.Setting(e).setName("Enable the HTTP server").addToggle(h=>h.setValue(T.httpApiEnabled).onChange(async w=>{T.httpApiEnabled=w,w?this.plugin.apiHttpServer.listen(T.httpApiPort):this.plugin.apiHttpServer.close(),await se(this.plugin)})),new U.Setting(e).setName("HTTP Port").addText(h=>{h.setValue(T.httpApiPort).setPlaceholder("51361").onChange(async w=>{parseInt(w)>65535&&(w=T.httpApiPort,h.setValue(T.httpApiPort)),T.httpApiPort=w,T.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(T.httpApiPort)),await se(this.plugin)})}),new U.Setting(e).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(h=>h.setValue(T.httpApiNotice).onChange(async w=>{T.httpApiNotice=w,await se(this.plugin)}))}new U.Setting(e).setName("Danger Zone").setHeading();let f=new DocumentFragment;f.createSpan({},c=>{c.innerHTML=`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".
\u26A0\uFE0F You probably should NOT disable this.
\u26A0\uFE0F Changing this setting will clear the cache.
${Qi} `}),new U.Setting(e).setName("Ignore diacritics").setDesc(f).addToggle(c=>c.setValue(T.ignoreDiacritics).onChange(async h=>{await Te.clearCache(),T.ignoreDiacritics=h,await se(this.plugin)}));let p=new DocumentFragment;if(p.createSpan({},c=>{c.innerHTML=`Disable Omnisearch on this device only.
${Qi}`}),new U.Setting(e).setName("Disable on this device").setDesc(p).addToggle(c=>c.setValue(la()).onChange(async h=>{h?this.app.saveLocalStorage(Gn,"1"):this.app.saveLocalStorage(Gn),new U.Notice("Omnisearch - Disabled. Please restart Obsidian.")})),Et()){let c=new DocumentFragment;c.createSpan({},h=>{h.innerHTML=`Erase all Omnisearch cache data. Use this if Omnisearch results are inconsistent, missing, or appear outdated.
${Qi}`}),new U.Setting(e).setName("Clear cache data").setDesc(c).addButton(h=>{h.setButtonText("Clear cache"),h.onClick(async()=>{await Te.clearCache()})})}}weightSlider(e,r){e.setLimits(1,5,.1).setValue(T[r]).setDynamicTooltip().onChange(async n=>{T[r]=n,await se(this.plugin)})}},zt={useCache:!0,hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!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 ua(t){Du=t}function ca(){return Du}function Ou(){return app.plugins.plugins["cm-chs-patch"]}function pt(){return app.plugins?.plugins?.["text-extractor"]?.api}function Et(){return!Cu.Platform.isIosApp&&T.useCache}var Cu,Eu,Fu,Qn,Tu,Gn,Q,qi,et,re,Ht,Du,fa,qn,Iu,ot=A(()=>{Fl();ms();Ze();Cu=_e(require("obsidian")),Eu=/[\u4e00-\u9fa5]/,Fu=100,Qn=300,Tu=`suggestion-highlight omnisearch-highlight ${T.highlight?"omnisearch-default-highlight":""}`,Gn="omnisearch-disabled",Q=new hs,qi={ToggleExcerpts:"toggle-excerpts"},et=(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))(et||{}),re=(f=>(f.Enter="enter",f.OpenInBackground="open-in-background",f.CreateNote="create-note",f.OpenInNewPane="open-in-new-pane",f.InsertLink="insert-link",f.Tab="tab",f.ArrowUp="arrow-up",f.ArrowDown="arrow-down",f.PrevSearchHistory="prev-search-history",f.NextSearchHistory="next-search-history",f))(re||{}),Ht=wi(0),Du=!1;fa=/[|\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(`${fa}+`,"u"),Iu=/[|\[\]\(\)<>\{\} \t\n\r]/u});var Pu=gi((Yn,da)=>{(function(t,e){if(typeof Yn=="object"&&typeof da=="object")da.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(_){for(var d="",v=0;v<4;v++)d+=n[_>>8*v+4&15]+n[_>>8*v&15];return d},o=function(_){for(var d=_.length,v=0;v>>32-S,E)}(d=function(x,S,E,D){return S=s(s(S,x),s(E,D))}(_,d,m,b),g,v)},u=function(_,d,v,m,g,b,y,x){return a(v&m|~v&g,d,v,b,y,x,_)},l=function(_,d,v,m,g,b,y,x){return a(v&g|m&~g,d,v,b,y,x,_)},f=function(_,d,v,m,g,b,y,x){return a(v^m^g,d,v,b,y,x,_)},p=function(_,d,v,m,g,b,y,x){return a(m^(v|~g),d,v,b,y,x,_)},c=function(_,d,v){v===void 0&&(v=s);var m=_[0],g=_[1],b=_[2],y=_[3],x=u.bind(null,v);m=x(m,g,b,y,d[0],7,-680876936),y=x(y,m,g,b,d[1],12,-389564586),b=x(b,y,m,g,d[2],17,606105819),g=x(g,b,y,m,d[3],22,-1044525330),m=x(m,g,b,y,d[4],7,-176418897),y=x(y,m,g,b,d[5],12,1200080426),b=x(b,y,m,g,d[6],17,-1473231341),g=x(g,b,y,m,d[7],22,-45705983),m=x(m,g,b,y,d[8],7,1770035416),y=x(y,m,g,b,d[9],12,-1958414417),b=x(b,y,m,g,d[10],17,-42063),g=x(g,b,y,m,d[11],22,-1990404162),m=x(m,g,b,y,d[12],7,1804603682),y=x(y,m,g,b,d[13],12,-40341101),b=x(b,y,m,g,d[14],17,-1502002290),g=x(g,b,y,m,d[15],22,1236535329);var S=l.bind(null,v);m=S(m,g,b,y,d[1],5,-165796510),y=S(y,m,g,b,d[6],9,-1069501632),b=S(b,y,m,g,d[11],14,643717713),g=S(g,b,y,m,d[0],20,-373897302),m=S(m,g,b,y,d[5],5,-701558691),y=S(y,m,g,b,d[10],9,38016083),b=S(b,y,m,g,d[15],14,-660478335),g=S(g,b,y,m,d[4],20,-405537848),m=S(m,g,b,y,d[9],5,568446438),y=S(y,m,g,b,d[14],9,-1019803690),b=S(b,y,m,g,d[3],14,-187363961),g=S(g,b,y,m,d[8],20,1163531501),m=S(m,g,b,y,d[13],5,-1444681467),y=S(y,m,g,b,d[2],9,-51403784),b=S(b,y,m,g,d[7],14,1735328473),g=S(g,b,y,m,d[12],20,-1926607734);var E=f.bind(null,v);m=E(m,g,b,y,d[5],4,-378558),y=E(y,m,g,b,d[8],11,-2022574463),b=E(b,y,m,g,d[11],16,1839030562),g=E(g,b,y,m,d[14],23,-35309556),m=E(m,g,b,y,d[1],4,-1530992060),y=E(y,m,g,b,d[4],11,1272893353),b=E(b,y,m,g,d[7],16,-155497632),g=E(g,b,y,m,d[10],23,-1094730640),m=E(m,g,b,y,d[13],4,681279174),y=E(y,m,g,b,d[0],11,-358537222),b=E(b,y,m,g,d[3],16,-722521979),g=E(g,b,y,m,d[6],23,76029189),m=E(m,g,b,y,d[9],4,-640364487),y=E(y,m,g,b,d[12],11,-421815835),b=E(b,y,m,g,d[15],16,530742520),g=E(g,b,y,m,d[2],23,-995338651);var D=p.bind(null,v);m=D(m,g,b,y,d[0],6,-198630844),y=D(y,m,g,b,d[7],10,1126891415),b=D(b,y,m,g,d[14],15,-1416354905),g=D(g,b,y,m,d[5],21,-57434055),m=D(m,g,b,y,d[12],6,1700485571),y=D(y,m,g,b,d[3],10,-1894986606),b=D(b,y,m,g,d[10],15,-1051523),g=D(g,b,y,m,d[1],21,-2054922799),m=D(m,g,b,y,d[8],6,1873313359),y=D(y,m,g,b,d[15],10,-30611744),b=D(b,y,m,g,d[6],15,-1560198380),g=D(g,b,y,m,d[13],21,1309151649),m=D(m,g,b,y,d[4],6,-145523070),y=D(y,m,g,b,d[11],10,-1120210379),b=D(b,y,m,g,d[2],15,718787259),g=D(g,b,y,m,d[9],21,-343485551),_[0]=v(m,_[0]),_[1]=v(g,_[1]),_[2]=v(b,_[2]),_[3]=v(y,_[3])},h=function(_){for(var d=[],v=0;v<64;v+=4)d[v>>2]=_.charCodeAt(v)+(_.charCodeAt(v+1)<<8)+(_.charCodeAt(v+2)<<16)+(_.charCodeAt(v+3)<<24);return d},w=function(_,d){var v,m=_.length,g=[1732584193,-271733879,-1732584194,271733878];for(v=64;v<=m;v+=64)c(g,h(_.substring(v-64,v)),d);var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=(_=_.substring(v-64)).length;for(v=0;v>2]|=_.charCodeAt(v)<<(v%4<<3);if(b[v>>2]|=128<<(v%4<<3),v>55)for(c(g,b,d),v=16;v--;)b[v]=0;return b[14]=8*m,c(g,b,d),g};function j(_){var d;return o(w("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(d=function(v,m){var g=(65535&v)+(65535&m);return(v>>16)+(m>>16)+(g>>16)<<16|65535&g}),o(w(_,d))}}])})});function Ru(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 Lu(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,r,n)=>n)}function Nu(t){return t?.frontmatter?(0,pr.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function Bu(t){let e=t?(0,pr.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 Ft(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 hr(){return pr.Platform.isMacOS?"\u2318":"ctrl"}function jy(t){let e=!!pt(),r=e&&T.PDFIndexing,n=e&&T.imagesIndexing;return Xi(t)||Ur(t)||Zi(t)||r&&mr(t)||n&&$r(t)}function pa(t){return Su()||Xi(t)||Ur(t)||Zi(t)}function Jn(t){return pa(t)||jy(t)}function $r(t){let e=gr(t);return e==="png"||e==="jpg"||e==="jpeg"||e==="webp"}function mr(t){return gr(t)==="pdf"}function Xi(t){return[...T.indexedFileTypes,"md"].some(e=>t.endsWith(`.${e}`))}function Ur(t){return t.endsWith(".canvas")}function Zi(t){return t.endsWith(".loom")}function gr(t){let e=t.split(".");return e[e.length-1]??""}function Ku(t){return pr.Platform.isMobileApp?(0,Mu.md5)(t.toString()):(0,ku.createHash)("md5").update(t).digest("hex")}function zu(t,e){let r=[],n=0,i=t.length;for(;nr):[]}function Vu(t){return t.includes("-")?t.split("-").filter(e=>e):[]}function he(...t){$u(console.log,...t)}function Wu(...t){$u(console.warn,...t)}function $u(t,...e){if(T.verboseLogging){let r=new Date,n=`${r.getMinutes()}:${r.getSeconds()}:${r.getMilliseconds()}`;t("Omnisearch -",n+" -",...e)}}var pr,ku,Mu,Tt=A(()=>{pr=_e(require("obsidian"));ot();Ze();ku=_e(require("crypto")),Mu=_e(Pu())});async function Ay(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=pt();if(Xi(t))r=await app.vault.cachedRead(e);else if(Ur(t)){let s=JSON.parse(await app.vault.cachedRead(e)),a=[];for(let u of s.nodes)u.type==="text"?a.push(u.text):u.type==="file"&&a.push(u.file);for(let u of s.edges.filter(l=>!!l.label))a.push(u.label);r=a.join(`\r `)}else if(Zi(t))try{let s=JSON.parse(await app.vault.cachedRead(e)),a=[],u=l=>{for(let f in l)typeof l[f]=="object"?u(l[f]):f==="content"&&a.push(l[f])};u(s),r=a.join(`\r `)}catch(s){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(s)}else $r(t)&&T.imagesIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):mr(t)&&T.PDFIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):pa(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:u}of s.map(l=>l.position))r=r.substring(0,a.offset-1)+r.substring(u.offset)}let o=Bu(i);return{basename:e.basename,content:r,cleanedContent:Lu(Ft(r)),path:e.path,mtime:e.stat.mtime,tags:o,unmarkedTags:o.map(s=>s.replace("#","")),aliases:Nu(i).join(""),headings1:i?Yi(i,1).join(" "):"",headings2:i?Yi(i,2).join(" "):"",headings3:i?Yi(i,3).join(" "):""}}var eo,Uu,Ae,Gr=A(()=>{eo=_e(require("obsidian"));ot();Gi();Tt();Ze();Uu=class{constructor(){this.nextQueryIsEmpty=!1;this.documents=new Map}async addToLiveCache(e){try{let r=await Ay(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 Te.searchHistory.toArray();r=r.filter(n=>n.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await Te.searchHistory.clear(),await Te.searchHistory.bulkAdd(r)}async getSearchHistory(){let e=(await Te.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&e.unshift(""),e}getDocumentsChecksum(e){return Ku(JSON.stringify(e.sort((r,n)=>r.pathn.path?1:0)))}async getMinisearchCache(){try{return(await Te.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 Te.minisearch.clear(),await Te.minisearch.add({date:new Date().toISOString(),paths:n,data:e.toJSON()}),console.log("Omnisearch - Search cache written")}},Ae=new Uu});var Dy,no,ha=A(()=>{Dy=typeof global=="object"&&global&&global.Object===Object&&global,no=Dy});var Oy,Iy,ye,tt=A(()=>{ha();Oy=typeof self=="object"&&self&&self.Object===Object&&self,Iy=no||Oy||Function("return this")(),ye=Iy});var Py,De,yr=A(()=>{tt();Py=ye.Symbol,De=Py});function Ry(t){var e=ky.call(t,Xn),r=t[Xn];try{t[Xn]=void 0;var n=!0}catch{}var i=My.call(t);return n&&(e?t[Xn]=r:delete t[Xn]),i}var Yu,ky,My,Xn,Ju,Xu=A(()=>{yr();Yu=Object.prototype,ky=Yu.hasOwnProperty,My=Yu.toString,Xn=De?De.toStringTag:void 0;Ju=Ry});function By(t){return Ny.call(t)}var Ly,Ny,Zu,ec=A(()=>{Ly=Object.prototype,Ny=Ly.toString;Zu=By});function Hy(t){return t==null?t===void 0?zy:Ky:tc&&tc in Object(t)?Ju(t):Zu(t)}var Ky,zy,tc,st,Qr=A(()=>{yr();Xu();ec();Ky="[object Null]",zy="[object Undefined]",tc=De?De.toStringTag:void 0;st=Hy});function Vy(t){return t!=null&&typeof t=="object"}var $e,Vt=A(()=>{$e=Vy});function $y(t){return typeof t=="symbol"||$e(t)&&st(t)==Wy}var Wy,at,qr=A(()=>{Qr();Vt();Wy="[object Symbol]";at=$y});function Uy(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r{Yr=Uy});var Gy,me,rt=A(()=>{Gy=Array.isArray,me=Gy});function ic(t){if(typeof t=="string")return t;if(me(t))return Yr(t,ic)+"";if(at(t))return nc?nc.call(t):"";var e=t+"";return e=="0"&&1/t==-Qy?"-0":e}var Qy,rc,nc,oc,sc=A(()=>{yr();ma();rt();qr();Qy=1/0,rc=De?De.prototype:void 0,nc=rc?rc.toString:void 0;oc=ic});function Yy(t){for(var e=t.length;e--&&qy.test(t.charAt(e)););return e}var qy,ac,lc=A(()=>{qy=/\s/;ac=Yy});function Xy(t){return t&&t.slice(0,ac(t)+1).replace(Jy,"")}var Jy,uc,cc=A(()=>{lc();Jy=/^\s+/;uc=Xy});function Zy(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Se,ht=A(()=>{Se=Zy});function i_(t){if(typeof t=="number")return t;if(at(t))return fc;if(Se(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Se(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=uc(t);var r=t_.test(t);return r||r_.test(t)?n_(t.slice(2),r?2:8):e_.test(t)?fc:+t}var fc,e_,t_,r_,n_,ga,dc=A(()=>{cc();ht();qr();fc=0/0,e_=/^[-+]0x[0-9a-f]+$/i,t_=/^0b[01]+$/i,r_=/^0o[0-7]+$/i,n_=parseInt;ga=i_});function o_(t){return t}var Wt,Zn=A(()=>{Wt=o_});function c_(t){if(!Se(t))return!1;var e=st(t);return e==a_||e==l_||e==s_||e==u_}var s_,a_,l_,u_,io,ya=A(()=>{Qr();ht();s_="[object AsyncFunction]",a_="[object Function]",l_="[object GeneratorFunction]",u_="[object Proxy]";io=c_});var f_,oo,pc=A(()=>{tt();f_=ye["__core-js_shared__"],oo=f_});function d_(t){return!!hc&&hc in t}var hc,mc,gc=A(()=>{pc();hc=function(){var t=/[^.]+$/.exec(oo&&oo.keys&&oo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();mc=d_});function m_(t){if(t!=null){try{return h_.call(t)}catch{}try{return t+""}catch{}}return""}var p_,h_,Dt,_a=A(()=>{p_=Function.prototype,h_=p_.toString;Dt=m_});function j_(t){if(!Se(t)||mc(t))return!1;var e=io(t)?w_:y_;return e.test(Dt(t))}var g_,y_,__,v_,b_,x_,w_,yc,_c=A(()=>{ya();gc();ht();_a();g_=/[\\^$.*+?()[\]{}|]/g,y_=/^\[object .+?Constructor\]$/,__=Function.prototype,v_=Object.prototype,b_=__.toString,x_=v_.hasOwnProperty,w_=RegExp("^"+b_.call(x_).replace(g_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");yc=j_});function A_(t,e){return t==null?void 0:t[e]}var vc,bc=A(()=>{vc=A_});function S_(t,e){var r=vc(t,e);return yc(r)?r:void 0}var Ge,$t=A(()=>{_c();bc();Ge=S_});var C_,so,xc=A(()=>{$t();tt();C_=Ge(ye,"WeakMap"),so=C_});var wc,E_,jc,Ac=A(()=>{ht();wc=Object.create,E_=function(){function t(){}return function(e){if(!Se(e))return{};if(wc)return wc(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),jc=E_});function F_(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 Sc,Cc=A(()=>{Sc=F_});function T_(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r{Ec=T_});function P_(t){var e=0,r=0;return function(){var n=I_(),i=O_-(n-r);if(r=n,i>0){if(++e>=D_)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var D_,O_,I_,Tc,Dc=A(()=>{D_=800,O_=16,I_=Date.now;Tc=P_});function k_(t){return function(){return t}}var Oc,Ic=A(()=>{Oc=k_});var M_,Jr,va=A(()=>{$t();M_=function(){try{var t=Ge(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Jr=M_});var R_,Pc,kc=A(()=>{Ic();va();Zn();R_=Jr?function(t,e){return Jr(t,"toString",{configurable:!0,enumerable:!1,value:Oc(e),writable:!0})}:Wt,Pc=R_});var L_,Mc,Rc=A(()=>{kc();Dc();L_=Tc(Pc),Mc=L_});function N_(t,e){for(var r=-1,n=t==null?0:t.length;++r{Lc=N_});function z_(t,e){var r=typeof t;return e=e??B_,!!e&&(r=="number"||r!="symbol"&&K_.test(t))&&t>-1&&t%1==0&&t{B_=9007199254740991,K_=/^(?:0|[1-9]\d*)$/;Xr=z_});function H_(t,e,r){e=="__proto__"&&Jr?Jr(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var lo,ba=A(()=>{va();lo=H_});function V_(t,e){return t===e||t!==t&&e!==e}var Ut,ei=A(()=>{Ut=V_});function U_(t,e,r){var n=t[e];(!($_.call(t,e)&&Ut(n,r))||r===void 0&&!(e in t))&&lo(t,e,r)}var W_,$_,uo,xa=A(()=>{ba();ei();W_=Object.prototype,$_=W_.hasOwnProperty;uo=U_});function G_(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o{xa();ba();Gt=G_});function Q_(t,e,r){return e=Bc(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Bc(n.length-e,0),s=Array(o);++i{Cc();Bc=Math.max;Kc=Q_});function q_(t,e){return Mc(Kc(t,e,Wt),t+"")}var Hc,Vc=A(()=>{Zn();zc();Rc();Hc=q_});function J_(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Y_}var Y_,Zr,co=A(()=>{Y_=9007199254740991;Zr=J_});function X_(t){return t!=null&&Zr(t.length)&&!io(t)}var mt,en=A(()=>{ya();co();mt=X_});function Z_(t,e,r){if(!Se(r))return!1;var n=typeof e;return(n=="number"?mt(r)&&Xr(e,r.length):n=="string"&&e in r)?Ut(r[e],t):!1}var wa,Wc=A(()=>{ei();en();ao();ht();wa=Z_});function tv(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||ev;return t===r}var ev,tn,fo=A(()=>{ev=Object.prototype;tn=tv});function rv(t,e){for(var r=-1,n=Array(t);++r{$c=rv});function iv(t){return $e(t)&&st(t)==nv}var nv,ja,Gc=A(()=>{Qr();Vt();nv="[object Arguments]";ja=iv});var Qc,ov,sv,av,rn,po=A(()=>{Gc();Vt();Qc=Object.prototype,ov=Qc.hasOwnProperty,sv=Qc.propertyIsEnumerable,av=ja(function(){return arguments}())?ja:function(t){return $e(t)&&ov.call(t,"callee")&&!sv.call(t,"callee")},rn=av});function lv(){return!1}var qc,Yc=A(()=>{qc=lv});var Jc,Xc,uv,Zc,cv,fv,_r,ho=A(()=>{tt();Yc();Jc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xc=Jc&&typeof module=="object"&&module&&!module.nodeType&&module,uv=Xc&&Xc.exports===Jc,Zc=uv?ye.Buffer:void 0,cv=Zc?Zc.isBuffer:void 0,fv=cv||qc,_r=fv});function Rv(t){return $e(t)&&Zr(t.length)&&!!ce[st(t)]}var dv,pv,hv,mv,gv,yv,_v,vv,bv,xv,wv,jv,Av,Sv,Cv,Ev,Fv,Tv,Dv,Ov,Iv,Pv,kv,Mv,ce,ef,tf=A(()=>{Qr();co();Vt();dv="[object Arguments]",pv="[object Array]",hv="[object Boolean]",mv="[object Date]",gv="[object Error]",yv="[object Function]",_v="[object Map]",vv="[object Number]",bv="[object Object]",xv="[object RegExp]",wv="[object Set]",jv="[object String]",Av="[object WeakMap]",Sv="[object ArrayBuffer]",Cv="[object DataView]",Ev="[object Float32Array]",Fv="[object Float64Array]",Tv="[object Int8Array]",Dv="[object Int16Array]",Ov="[object Int32Array]",Iv="[object Uint8Array]",Pv="[object Uint8ClampedArray]",kv="[object Uint16Array]",Mv="[object Uint32Array]",ce={};ce[Ev]=ce[Fv]=ce[Tv]=ce[Dv]=ce[Ov]=ce[Iv]=ce[Pv]=ce[kv]=ce[Mv]=!0;ce[dv]=ce[pv]=ce[Sv]=ce[hv]=ce[Cv]=ce[mv]=ce[gv]=ce[yv]=ce[_v]=ce[vv]=ce[bv]=ce[xv]=ce[wv]=ce[jv]=ce[Av]=!1;ef=Rv});function Lv(t){return function(e){return t(e)}}var Qt,ri=A(()=>{Qt=Lv});var rf,ni,Nv,Aa,Bv,Ot,mo=A(()=>{ha();rf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ni=rf&&typeof module=="object"&&module&&!module.nodeType&&module,Nv=ni&&ni.exports===rf,Aa=Nv&&no.process,Bv=function(){try{var t=ni&&ni.require&&ni.require("util").types;return t||Aa&&Aa.binding&&Aa.binding("util")}catch{}}(),Ot=Bv});var nf,Kv,go,Sa=A(()=>{tf();ri();mo();nf=Ot&&Ot.isTypedArray,Kv=nf?Qt(nf):ef,go=Kv});function Vv(t,e){var r=me(t),n=!r&&rn(t),i=!r&&!n&&_r(t),o=!r&&!n&&!i&&go(t),s=r||n||i||o,a=s?$c(t.length,String):[],u=a.length;for(var l in t)(e||Hv.call(t,l))&&!(s&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Xr(l,u)))&&a.push(l);return a}var zv,Hv,yo,Ca=A(()=>{Uc();po();rt();ho();ao();Sa();zv=Object.prototype,Hv=zv.hasOwnProperty;yo=Vv});function Wv(t,e){return function(r){return t(e(r))}}var _o,Ea=A(()=>{_o=Wv});var $v,of,sf=A(()=>{Ea();$v=_o(Object.keys,Object),of=$v});function Qv(t){if(!tn(t))return of(t);var e=[];for(var r in Object(t))Gv.call(t,r)&&r!="constructor"&&e.push(r);return e}var Uv,Gv,af,lf=A(()=>{fo();sf();Uv=Object.prototype,Gv=Uv.hasOwnProperty;af=Qv});function qv(t){return mt(t)?yo(t):af(t)}var gt,nn=A(()=>{Ca();lf();en();gt=qv});function Yv(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var uf,cf=A(()=>{uf=Yv});function Zv(t){if(!Se(t))return uf(t);var e=tn(t),r=[];for(var n in t)n=="constructor"&&(e||!Xv.call(t,n))||r.push(n);return r}var Jv,Xv,ff,df=A(()=>{ht();fo();cf();Jv=Object.prototype,Xv=Jv.hasOwnProperty;ff=Zv});function eb(t){return mt(t)?yo(t,!0):ff(t)}var on,vo=A(()=>{Ca();df();en();on=eb});function nb(t,e){if(me(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||at(t)?!0:rb.test(t)||!tb.test(t)||e!=null&&t in Object(e)}var tb,rb,sn,bo=A(()=>{rt();qr();tb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rb=/^\w*$/;sn=nb});var ib,It,ii=A(()=>{$t();ib=Ge(Object,"create"),It=ib});function ob(){this.__data__=It?It(null):{},this.size=0}var pf,hf=A(()=>{ii();pf=ob});function sb(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var mf,gf=A(()=>{mf=sb});function cb(t){var e=this.__data__;if(It){var r=e[t];return r===ab?void 0:r}return ub.call(e,t)?e[t]:void 0}var ab,lb,ub,yf,_f=A(()=>{ii();ab="__lodash_hash_undefined__",lb=Object.prototype,ub=lb.hasOwnProperty;yf=cb});function pb(t){var e=this.__data__;return It?e[t]!==void 0:db.call(e,t)}var fb,db,vf,bf=A(()=>{ii();fb=Object.prototype,db=fb.hasOwnProperty;vf=pb});function mb(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=It&&e===void 0?hb:e,this}var hb,xf,wf=A(()=>{ii();hb="__lodash_hash_undefined__";xf=mb});function an(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{hf();gf();_f();bf();wf();an.prototype.clear=pf;an.prototype.delete=mf;an.prototype.get=yf;an.prototype.has=vf;an.prototype.set=xf;Fa=an});function gb(){this.__data__=[],this.size=0}var Af,Sf=A(()=>{Af=gb});function yb(t,e){for(var r=t.length;r--;)if(Ut(t[r][0],e))return r;return-1}var qt,oi=A(()=>{ei();qt=yb});function bb(t){var e=this.__data__,r=qt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():vb.call(e,r,1),--this.size,!0}var _b,vb,Cf,Ef=A(()=>{oi();_b=Array.prototype,vb=_b.splice;Cf=bb});function xb(t){var e=this.__data__,r=qt(e,t);return r<0?void 0:e[r][1]}var Ff,Tf=A(()=>{oi();Ff=xb});function wb(t){return qt(this.__data__,t)>-1}var Df,Of=A(()=>{oi();Df=wb});function jb(t,e){var r=this.__data__,n=qt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var If,Pf=A(()=>{oi();If=jb});function ln(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{Sf();Ef();Tf();Of();Pf();ln.prototype.clear=Af;ln.prototype.delete=Cf;ln.prototype.get=Ff;ln.prototype.has=Df;ln.prototype.set=If;Yt=ln});var Ab,Jt,xo=A(()=>{$t();tt();Ab=Ge(ye,"Map"),Jt=Ab});function Sb(){this.size=0,this.__data__={hash:new Fa,map:new(Jt||Yt),string:new Fa}}var kf,Mf=A(()=>{jf();si();xo();kf=Sb});function Cb(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Rf,Lf=A(()=>{Rf=Cb});function Eb(t,e){var r=t.__data__;return Rf(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Xt,ai=A(()=>{Lf();Xt=Eb});function Fb(t){var e=Xt(this,t).delete(t);return this.size-=e?1:0,e}var Nf,Bf=A(()=>{ai();Nf=Fb});function Tb(t){return Xt(this,t).get(t)}var Kf,zf=A(()=>{ai();Kf=Tb});function Db(t){return Xt(this,t).has(t)}var Hf,Vf=A(()=>{ai();Hf=Db});function Ob(t,e){var r=Xt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Wf,$f=A(()=>{ai();Wf=Ob});function un(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{Mf();Bf();zf();Vf();$f();un.prototype.clear=kf;un.prototype.delete=Nf;un.prototype.get=Kf;un.prototype.has=Hf;un.prototype.set=Wf;vr=un});function Ta(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Ib);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(Ta.Cache||vr),r}var Ib,Uf,Gf=A(()=>{wo();Ib="Expected a function";Ta.Cache=vr;Uf=Ta});function kb(t){var e=Uf(t,function(n){return r.size===Pb&&r.clear(),n}),r=e.cache;return e}var Pb,Qf,qf=A(()=>{Gf();Pb=500;Qf=kb});var Mb,Rb,Lb,Yf,Jf=A(()=>{qf();Mb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rb=/\\(\\)?/g,Lb=Qf(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Mb,function(r,n,i,o){e.push(i?o.replace(Rb,"$1"):n||r)}),e}),Yf=Lb});function Nb(t){return t==null?"":oc(t)}var jo,Da=A(()=>{sc();jo=Nb});function Bb(t,e){return me(t)?t:sn(t,e)?[t]:Yf(jo(t))}var Ao,Oa=A(()=>{rt();bo();Jf();Da();Ao=Bb});function zb(t){if(typeof t=="string"||at(t))return t;var e=t+"";return e=="0"&&1/t==-Kb?"-0":e}var Kb,Zt,li=A(()=>{qr();Kb=1/0;Zt=zb});function Hb(t,e){e=Ao(e,t);for(var r=0,n=e.length;t!=null&&r{Oa();li();cn=Hb});function Vb(t,e,r){var n=t==null?void 0:cn(t,e);return n===void 0?r:n}var Xf,Zf=A(()=>{So();Xf=Vb});function Wb(t,e){for(var r=-1,n=e.length,i=t.length;++r{fn=Wb});function $b(t){return me(t)||rn(t)||!!(ed&&t&&t[ed])}var ed,td,rd=A(()=>{yr();po();rt();ed=De?De.isConcatSpreadable:void 0;td=$b});function nd(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=td),i||(i=[]);++o0&&r(a)?e>1?nd(a,e-1,r,n,i):fn(i,a):n||(i[i.length]=a)}return i}var id,od=A(()=>{Co();rd();id=nd});var Ub,Eo,Ia=A(()=>{Ea();Ub=_o(Object.getPrototypeOf,Object),Eo=Ub});function Gb(){this.__data__=new Yt,this.size=0}var sd,ad=A(()=>{si();sd=Gb});function Qb(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ld,ud=A(()=>{ld=Qb});function qb(t){return this.__data__.get(t)}var cd,fd=A(()=>{cd=qb});function Yb(t){return this.__data__.has(t)}var dd,pd=A(()=>{dd=Yb});function Xb(t,e){var r=this.__data__;if(r instanceof Yt){var n=r.__data__;if(!Jt||n.length{si();xo();wo();Jb=200;hd=Xb});function dn(t){var e=this.__data__=new Yt(t);this.size=e.size}var er,Fo=A(()=>{si();ad();ud();fd();pd();md();dn.prototype.clear=sd;dn.prototype.delete=ld;dn.prototype.get=cd;dn.prototype.has=dd;dn.prototype.set=hd;er=dn});function Zb(t,e){return t&&Gt(e,gt(e),t)}var gd,yd=A(()=>{ti();nn();gd=Zb});function ex(t,e){return t&&Gt(e,on(e),t)}var _d,vd=A(()=>{ti();vo();_d=ex});function rx(t,e){if(e)return t.slice();var r=t.length,n=jd?jd(r):new t.constructor(r);return t.copy(n),n}var bd,xd,tx,wd,jd,Ad,Sd=A(()=>{tt();bd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xd=bd&&typeof module=="object"&&module&&!module.nodeType&&module,tx=xd&&xd.exports===bd,wd=tx?ye.Buffer:void 0,jd=wd?wd.allocUnsafe:void 0;Ad=rx});function nx(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r{Cd=nx});function ix(){return[]}var To,Pa=A(()=>{To=ix});var ox,sx,Fd,ax,pn,Do=A(()=>{Ed();Pa();ox=Object.prototype,sx=ox.propertyIsEnumerable,Fd=Object.getOwnPropertySymbols,ax=Fd?function(t){return t==null?[]:(t=Object(t),Cd(Fd(t),function(e){return sx.call(t,e)}))}:To,pn=ax});function lx(t,e){return Gt(t,pn(t),e)}var Td,Dd=A(()=>{ti();Do();Td=lx});var ux,cx,Oo,ka=A(()=>{Co();Ia();Do();Pa();ux=Object.getOwnPropertySymbols,cx=ux?function(t){for(var e=[];t;)fn(e,pn(t)),t=Eo(t);return e}:To,Oo=cx});function fx(t,e){return Gt(t,Oo(t),e)}var Od,Id=A(()=>{ti();ka();Od=fx});function dx(t,e,r){var n=e(t);return me(t)?n:fn(n,r(t))}var Io,Ma=A(()=>{Co();rt();Io=dx});function px(t){return Io(t,gt,pn)}var ui,Ra=A(()=>{Ma();Do();nn();ui=px});function hx(t){return Io(t,on,Oo)}var Pd,kd=A(()=>{Ma();ka();vo();Pd=hx});var mx,Po,Md=A(()=>{$t();tt();mx=Ge(ye,"DataView"),Po=mx});var gx,ko,Rd=A(()=>{$t();tt();gx=Ge(ye,"Promise"),ko=gx});var yx,Mo,Ld=A(()=>{$t();tt();yx=Ge(ye,"Set"),Mo=yx});var Nd,_x,Bd,Kd,zd,Hd,vx,bx,xx,wx,jx,br,Pt,ci=A(()=>{Md();xo();Rd();Ld();xc();Qr();_a();Nd="[object Map]",_x="[object Object]",Bd="[object Promise]",Kd="[object Set]",zd="[object WeakMap]",Hd="[object DataView]",vx=Dt(Po),bx=Dt(Jt),xx=Dt(ko),wx=Dt(Mo),jx=Dt(so),br=st;(Po&&br(new Po(new ArrayBuffer(1)))!=Hd||Jt&&br(new Jt)!=Nd||ko&&br(ko.resolve())!=Bd||Mo&&br(new Mo)!=Kd||so&&br(new so)!=zd)&&(br=function(t){var e=st(t),r=e==_x?t.constructor:void 0,n=r?Dt(r):"";if(n)switch(n){case vx:return Hd;case bx:return Nd;case xx:return Bd;case wx:return Kd;case jx:return zd}return e});Pt=br});function Cx(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Sx.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Ax,Sx,Vd,Wd=A(()=>{Ax=Object.prototype,Sx=Ax.hasOwnProperty;Vd=Cx});var Ex,hn,La=A(()=>{tt();Ex=ye.Uint8Array,hn=Ex});function Fx(t){var e=new t.constructor(t.byteLength);return new hn(e).set(new hn(t)),e}var mn,Ro=A(()=>{La();mn=Fx});function Tx(t,e){var r=e?mn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var $d,Ud=A(()=>{Ro();$d=Tx});function Ox(t){var e=new t.constructor(t.source,Dx.exec(t));return e.lastIndex=t.lastIndex,e}var Dx,Gd,Qd=A(()=>{Dx=/\w*$/;Gd=Ox});function Ix(t){return Yd?Object(Yd.call(t)):{}}var qd,Yd,Jd,Xd=A(()=>{yr();qd=De?De.prototype:void 0,Yd=qd?qd.valueOf:void 0;Jd=Ix});function Px(t,e){var r=e?mn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Zd,ep=A(()=>{Ro();Zd=Px});function Zx(t,e,r){var n=t.constructor;switch(e){case Hx:return mn(t);case kx:case Mx:return new n(+t);case Vx:return $d(t,r);case Wx:case $x:case Ux:case Gx:case Qx:case qx:case Yx:case Jx:case Xx:return Zd(t,r);case Rx:return new n;case Lx:case Kx:return new n(t);case Nx:return Gd(t);case Bx:return new n;case zx:return Jd(t)}}var kx,Mx,Rx,Lx,Nx,Bx,Kx,zx,Hx,Vx,Wx,$x,Ux,Gx,Qx,qx,Yx,Jx,Xx,tp,rp=A(()=>{Ro();Ud();Qd();Xd();ep();kx="[object Boolean]",Mx="[object Date]",Rx="[object Map]",Lx="[object Number]",Nx="[object RegExp]",Bx="[object Set]",Kx="[object String]",zx="[object Symbol]",Hx="[object ArrayBuffer]",Vx="[object DataView]",Wx="[object Float32Array]",$x="[object Float64Array]",Ux="[object Int8Array]",Gx="[object Int16Array]",Qx="[object Int32Array]",qx="[object Uint8Array]",Yx="[object Uint8ClampedArray]",Jx="[object Uint16Array]",Xx="[object Uint32Array]";tp=Zx});function ew(t){return typeof t.constructor=="function"&&!tn(t)?jc(Eo(t)):{}}var np,ip=A(()=>{Ac();Ia();fo();np=ew});function rw(t){return $e(t)&&Pt(t)==tw}var tw,op,sp=A(()=>{ci();Vt();tw="[object Map]";op=rw});var ap,nw,lp,up=A(()=>{sp();ri();mo();ap=Ot&&Ot.isMap,nw=ap?Qt(ap):op,lp=nw});function ow(t){return $e(t)&&Pt(t)==iw}var iw,cp,fp=A(()=>{ci();Vt();iw="[object Set]";cp=ow});var dp,sw,pp,hp=A(()=>{fp();ri();mo();dp=Ot&&Ot.isSet,sw=dp?Qt(dp):cp,pp=sw});function Lo(t,e,r,n,i,o){var s,a=e&aw,u=e&lw,l=e&uw;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Se(t))return t;var f=me(t);if(f){if(s=Vd(t),!a)return Ec(t,s)}else{var p=Pt(t),c=p==gp||p==hw;if(_r(t))return Ad(t,a);if(p==yp||p==mp||c&&!i){if(s=u||c?{}:np(t),!a)return u?Od(t,_d(s,t)):Td(t,gd(s,t))}else{if(!ae[p])return i?t:{};s=tp(t,p,a)}}o||(o=new er);var h=o.get(t);if(h)return h;o.set(t,s),pp(t)?t.forEach(function(_){s.add(Lo(_,e,r,_,t,o))}):lp(t)&&t.forEach(function(_,d){s.set(d,Lo(_,e,r,d,t,o))});var w=l?u?Pd:ui:u?on:gt,j=f?void 0:w(t);return Lc(j||t,function(_,d){j&&(d=_,_=t[d]),uo(s,d,Lo(_,e,r,d,t,o))}),s}var aw,lw,uw,mp,cw,fw,dw,pw,gp,hw,mw,gw,yp,yw,_w,vw,bw,xw,ww,jw,Aw,Sw,Cw,Ew,Fw,Tw,Dw,Ow,Iw,ae,_p,vp=A(()=>{Fo();Nc();xa();yd();vd();Sd();Fc();Dd();Id();Ra();kd();ci();Wd();rp();ip();rt();ho();up();ht();hp();nn();vo();aw=1,lw=2,uw=4,mp="[object Arguments]",cw="[object Array]",fw="[object Boolean]",dw="[object Date]",pw="[object Error]",gp="[object Function]",hw="[object GeneratorFunction]",mw="[object Map]",gw="[object Number]",yp="[object Object]",yw="[object RegExp]",_w="[object Set]",vw="[object String]",bw="[object Symbol]",xw="[object WeakMap]",ww="[object ArrayBuffer]",jw="[object DataView]",Aw="[object Float32Array]",Sw="[object Float64Array]",Cw="[object Int8Array]",Ew="[object Int16Array]",Fw="[object Int32Array]",Tw="[object Uint8Array]",Dw="[object Uint8ClampedArray]",Ow="[object Uint16Array]",Iw="[object Uint32Array]",ae={};ae[mp]=ae[cw]=ae[ww]=ae[jw]=ae[fw]=ae[dw]=ae[Aw]=ae[Sw]=ae[Cw]=ae[Ew]=ae[Fw]=ae[mw]=ae[gw]=ae[yp]=ae[yw]=ae[_w]=ae[vw]=ae[bw]=ae[Tw]=ae[Dw]=ae[Ow]=ae[Iw]=!0;ae[pw]=ae[gp]=ae[xw]=!1;_p=Lo});function Mw(t){return _p(t,Pw|kw)}var Pw,kw,fi,bp=A(()=>{vp();Pw=1,kw=4;fi=Mw});function Lw(t){return this.__data__.set(t,Rw),this}var Rw,xp,wp=A(()=>{Rw="__lodash_hash_undefined__";xp=Lw});function Nw(t){return this.__data__.has(t)}var jp,Ap=A(()=>{jp=Nw});function No(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new vr;++e{wo();wp();Ap();No.prototype.add=No.prototype.push=xp;No.prototype.has=jp;Sp=No});function Bw(t,e){for(var r=-1,n=t==null?0:t.length;++r{Ep=Bw});function Kw(t,e){return t.has(e)}var Tp,Dp=A(()=>{Tp=Kw});function Vw(t,e,r,n,i,o){var s=r&zw,a=t.length,u=e.length;if(a!=u&&!(s&&u>a))return!1;var l=o.get(t),f=o.get(e);if(l&&f)return l==e&&f==t;var p=-1,c=!0,h=r&Hw?new Sp:void 0;for(o.set(t,e),o.set(e,t);++p{Cp();Fp();Dp();zw=1,Hw=2;Bo=Vw});function Ww(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Op,Ip=A(()=>{Op=Ww});function $w(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Pp,kp=A(()=>{Pp=$w});function o0(t,e,r,n,i,o,s){switch(r){case i0:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case n0:return!(t.byteLength!=e.byteLength||!o(new hn(t),new hn(e)));case Qw:case qw:case Xw:return Ut(+t,+e);case Yw:return t.name==e.name&&t.message==e.message;case Zw:case t0:return t==e+"";case Jw:var a=Op;case e0:var u=n&Uw;if(a||(a=Pp),t.size!=e.size&&!u)return!1;var l=s.get(t);if(l)return l==e;n|=Gw,s.set(t,e);var f=Bo(a(t),a(e),n,i,o,s);return s.delete(t),f;case r0:if(Ba)return Ba.call(t)==Ba.call(e)}return!1}var Uw,Gw,Qw,qw,Yw,Jw,Xw,Zw,e0,t0,r0,n0,i0,Mp,Ba,Rp,Lp=A(()=>{yr();La();ei();Na();Ip();kp();Uw=1,Gw=2,Qw="[object Boolean]",qw="[object Date]",Yw="[object Error]",Jw="[object Map]",Xw="[object Number]",Zw="[object RegExp]",e0="[object Set]",t0="[object String]",r0="[object Symbol]",n0="[object ArrayBuffer]",i0="[object DataView]",Mp=De?De.prototype:void 0,Ba=Mp?Mp.valueOf:void 0;Rp=o0});function u0(t,e,r,n,i,o){var s=r&s0,a=ui(t),u=a.length,l=ui(e),f=l.length;if(u!=f&&!s)return!1;for(var p=u;p--;){var c=a[p];if(!(s?c in e:l0.call(e,c)))return!1}var h=o.get(t),w=o.get(e);if(h&&w)return h==e&&w==t;var j=!0;o.set(t,e),o.set(e,t);for(var _=s;++p{Ra();s0=1,a0=Object.prototype,l0=a0.hasOwnProperty;Np=u0});function d0(t,e,r,n,i,o){var s=me(t),a=me(e),u=s?zp:Pt(t),l=a?zp:Pt(e);u=u==Kp?Ko:u,l=l==Kp?Ko:l;var f=u==Ko,p=l==Ko,c=u==l;if(c&&_r(t)){if(!_r(e))return!1;s=!0,f=!1}if(c&&!f)return o||(o=new er),s||go(t)?Bo(t,e,r,n,i,o):Rp(t,e,u,r,n,i,o);if(!(r&c0)){var h=f&&Hp.call(t,"__wrapped__"),w=p&&Hp.call(e,"__wrapped__");if(h||w){var j=h?t.value():t,_=w?e.value():e;return o||(o=new er),i(j,_,r,n,o)}}return c?(o||(o=new er),Np(t,e,r,n,i,o)):!1}var c0,Kp,zp,Ko,f0,Hp,Vp,Wp=A(()=>{Fo();Na();Lp();Bp();ci();rt();ho();Sa();c0=1,Kp="[object Arguments]",zp="[object Array]",Ko="[object Object]",f0=Object.prototype,Hp=f0.hasOwnProperty;Vp=d0});function $p(t,e,r,n,i){return t===e?!0:t==null||e==null||!$e(t)&&!$e(e)?t!==t&&e!==e:Vp(t,e,r,n,$p,i)}var zo,Ka=A(()=>{Wp();Vt();zo=$p});function m0(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{Fo();Ka();p0=1,h0=2;Up=m0});function g0(t){return t===t&&!Se(t)}var Ho,za=A(()=>{ht();Ho=g0});function y0(t){for(var e=gt(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Ho(i)]}return e}var Qp,qp=A(()=>{za();nn();Qp=y0});function _0(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Vo,Ha=A(()=>{Vo=_0});function v0(t){var e=Qp(t);return e.length==1&&e[0][2]?Vo(e[0][0],e[0][1]):function(r){return r===t||Up(r,t,e)}}var Yp,Jp=A(()=>{Gp();qp();Ha();Yp=v0});function b0(t,e){return t!=null&&e in Object(t)}var Xp,Zp=A(()=>{Xp=b0});function x0(t,e,r){e=Ao(e,t);for(var n=-1,i=e.length,o=!1;++n{Oa();po();rt();ao();co();li();eh=x0});function w0(t,e){return t!=null&&eh(t,e,Xp)}var rh,nh=A(()=>{Zp();th();rh=w0});function S0(t,e){return sn(t)&&Ho(e)?Vo(Zt(t),e):function(r){var n=Xf(r,t);return n===void 0&&n===e?rh(r,t):zo(e,n,j0|A0)}}var j0,A0,ih,oh=A(()=>{Ka();Zf();nh();bo();za();Ha();li();j0=1,A0=2;ih=S0});function C0(t){return function(e){return e==null?void 0:e[t]}}var sh,ah=A(()=>{sh=C0});function E0(t){return function(e){return cn(e,t)}}var lh,uh=A(()=>{So();lh=E0});function F0(t){return sn(t)?sh(Zt(t)):lh(t)}var ch,fh=A(()=>{ah();uh();bo();li();ch=F0});function T0(t){return typeof t=="function"?t:t==null?Wt:typeof t=="object"?me(t)?ih(t[0],t[1]):Yp(t):ch(t)}var dh,ph=A(()=>{Jp();oh();Zn();rt();fh();dh=T0});function D0(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++i];if(r(o[u],u,o)===!1)break}return e}}var hh,mh=A(()=>{hh=D0});var O0,gh,yh=A(()=>{mh();O0=hh(),gh=O0});function I0(t,e){return t&&gh(t,e,gt)}var _h,vh=A(()=>{yh();nn();_h=I0});function P0(t,e){return function(r,n){if(r==null)return r;if(!mt(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o{en();bh=P0});var k0,wh,jh=A(()=>{vh();xh();k0=bh(_h),wh=k0});var M0,Wo,Ah=A(()=>{tt();M0=function(){return ye.Date.now()},Wo=M0});function B0(t,e,r){var n,i,o,s,a,u,l=0,f=!1,p=!1,c=!0;if(typeof t!="function")throw new TypeError(R0);e=ga(e)||0,Se(r)&&(f=!!r.leading,p="maxWait"in r,o=p?L0(ga(r.maxWait)||0,e):o,c="trailing"in r?!!r.trailing:c);function h(y){var x=n,S=i;return n=i=void 0,l=y,s=t.apply(S,x),s}function w(y){return l=y,a=setTimeout(d,e),f?h(y):s}function j(y){var x=y-u,S=y-l,E=e-x;return p?N0(E,o-S):E}function _(y){var x=y-u,S=y-l;return u===void 0||x>=e||x<0||p&&S>=o}function d(){var y=Wo();if(_(y))return v(y);a=setTimeout(d,j(y))}function v(y){return a=void 0,c&&n?h(y):(n=i=void 0,s)}function m(){a!==void 0&&clearTimeout(a),l=0,n=u=i=a=void 0}function g(){return a===void 0?s:v(Wo())}function b(){var y=Wo(),x=_(y);if(n=arguments,i=this,u=y,x){if(a===void 0)return w(u);if(p)return clearTimeout(a),a=setTimeout(d,e),h(u)}return a===void 0&&(a=setTimeout(d,e)),s}return b.cancel=m,b.flush=g,b}var R0,L0,N0,Va,Sh=A(()=>{ht();Ah();dc();R0="Expected a function",L0=Math.max,N0=Math.min;Va=B0});function z0(t){return t=jo(t),t&&K0.test(t)?t.replace(Ch,"\\$&"):t}var Ch,K0,xr,Eh=A(()=>{Da();Ch=/[\\^$.*+?()[\]{}|]/g,K0=RegExp(Ch.source);xr=z0});function H0(t,e){var r=-1,n=mt(t)?Array(t.length):[];return wh(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var Fh,Th=A(()=>{jh();en();Fh=H0});function V0(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var Dh,Oh=A(()=>{Dh=V0});function W0(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,o=at(t),s=e!==void 0,a=e===null,u=e===e,l=at(e);if(!a&&!l&&!o&&t>e||o&&s&&u&&!a&&!l||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!l&&t{qr();Ih=W0});function $0(t,e,r){for(var n=-1,i=t.criteria,o=e.criteria,s=i.length,a=r.length;++n=a)return u;var l=r[n];return u*(l=="desc"?-1:1)}}return t.index-e.index}var kh,Mh=A(()=>{Ph();kh=$0});function U0(t,e,r){e.length?e=Yr(e,function(o){return me(o)?function(s){return cn(s,o.length===1?o[0]:o)}:o}):e=[Wt];var n=-1;e=Yr(e,Qt(dh));var i=Fh(t,function(o,s,a){var u=Yr(e,function(l){return l(o)});return{criteria:u,index:++n,value:o}});return Dh(i,function(o,s){return kh(o,s,r)})}var Rh,Lh=A(()=>{ma();So();ph();Th();Oh();ri();Mh();Zn();rt();Rh=U0});var G0,Wa,Nh=A(()=>{od();Lh();Vc();Wc();G0=Hc(function(t,e){if(t==null)return[];var r=e.length;return r>1&&wa(t,e[0],e[1])?e=[]:r>2&&wa(e[0],e[1],e[2])&&(e=[e[0]]),Rh(t,id(e,1),[])}),Wa=G0});var gn=A(()=>{bp();Sh();Eh();Nh();});function yt(t,e){if(!e.length)return t;try{let r=new RegExp(e.map(i=>`\\b${xr(i.match)}\\b${/[a-zA-Z]/.test(i.match)?"":`|${xr(i.match)}`}`).join("|"),"giu"),n=i=>e.find(s=>i.match(new RegExp(`\\b${xr(s.match)}\\b${/[a-zA-Z]/.test(s.match)?"":`|${xr(s.match)}`}`,"giu")))?`${i}`:i;return t.replace(r,n)}catch(r){return console.error("Omnisearch - Error in highlightText()",r),t}}function Q0(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function yn(t){if(!t.length)return/^$/g;t.sort((r,n)=>n.length-r.length);let e=`(${t.map(r=>xr(r)).join("|")})`;return new RegExp(`${e}`,"gui")}function di(t,e,r){let n=new RegExp(fa,"gu"),i=t;t=t.toLowerCase().replace(n," "),T.ignoreDiacritics&&(t=Ft(t));let o=new Date().getTime(),s=null,a=[],u=0;for(;(s=e.exec(t))!==null;){if(++u>=100||new Date().getTime()-o>50){Wu("Stopped getMatches at",u,"results");break}let l=s.index,f=l+s[0].length,p=i.substring(l,f).trim();p&&s.index>=0&&a.push({match:p,offset:s.index+1})}if(r&&r.query.text.length>1){let l=t.indexOf(r.segmentsToStr());l>-1&&a.find(f=>f.offset===l)&&(a=a.filter(f=>f.offset!==l),a.unshift({offset:l,match:r.segmentsToStr()}))}return a}function _n(t,e){try{let r=e??-1,n=Math.max(0,r-Fu),i=Math.min(t.length,r+Qn);if(r>-1?t=(n>0?"\u2026":"")+t.slice(n,i).trim()+(ia).join(` `);let s=t.lastIndexOf(` `,r-n);s>0&&(t=t.slice(s))}return t=Q0(t),T.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(` `,"
")),{content:t,offset:r}}catch(r){return new Bh.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(r),{content:"",offset:-1}}}var Bh,vn=A(()=>{ot();Ze();Tt();Bh=_e(require("obsidian"));gn()});var Jh=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 c=s[0],a=c.indexOf(":");if(a!==-1){var u=c.split(":"),l=c.slice(0,a),f=c.slice(a+1);f=f.replace(/^\"|\"$|^\'|\'$/g,""),f=(f+"").replace(/\\(.?)/g,function(y,x){switch(x){case"\\":return"\\";case"0":return"\0";case"":return"";default:return x}}),i.push({keyword:l,value:f,offsetStart:s.index,offsetEnd:s.index+c.length})}else{var p=!1;c[0]==="-"&&(p=!0,c=c.slice(1)),c=c.replace(/^\"|\"$|^\'|\'$/g,""),c=(c+"").replace(/\\(.?)/g,function(y,x){switch(x){case"\\":return"\\";case"0":return"\0";case"":return"";default:return x}}),p?n.text?(n.text instanceof Array||(n.text=[n.text]),n.text.push(c)):n.text=c:i.push({text:c,offsetStart:s.index,offsetEnd:s.index+c.length})}}i.reverse();for(var c;c=i.pop();)if(c.text)r.text.push(c.text),e.offsets&&r.offsets.push(c);else{var l=c.keyword;e.keywords=e.keywords||[];var h=!1,w=!1;if(!/^-/.test(l))h=e.keywords.indexOf(l)!==-1;else if(l[0]==="-"){var j=l.slice(1);h=e.keywords.indexOf(j)!==-1,h&&(l=j,w=!0)}e.ranges=e.ranges||[];var _=e.ranges.indexOf(l)!==-1;if(h){e.offsets&&r.offsets.push({keyword:l,value:c.value,offsetStart:w?c.offsetStart+1:c.offsetStart,offsetEnd:c.offsetEnd});var d=c.value;if(d.length){var v=d.split(",");w?n[l]?n[l]instanceof Array?v.length>1?n[l]=n[l].concat(v):n[l].push(d):(n[l]=[n[l]],n[l].push(d)):v.length>1?n[l]=v:e.alwaysArray?n[l]=[d]:n[l]=d:r[l]?r[l]instanceof Array?v.length>1?r[l]=r[l].concat(v):r[l].push(d):(r[l]=[r[l]],r[l].push(d)):v.length>1?r[l]=v:e.alwaysArray?r[l]=[d]:r[l]=d}}else if(_){e.offsets&&r.offsets.push(c);var d=c.value,m=d.split("-");r[l]={},m.length===2?(r[l].from=m[0],r[l].to=m[1]):!m.length%2||(r[l].from=d)}else{var g=c.keyword+":"+c.value;r.text.push(g),e.offsets&&r.offsets.push({text:g,offsetStart:c.offsetStart,offsetEnd:c.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 u=[];typeof t[a]=="string"?u.push(t[a]):u.push.apply(u,t[a]),u.length>0&&o.push(i(a+":"+u.map(n).join(",")))}}),e.ranges&&e.ranges.forEach(function(a){if(!!t[a]){var u=t[a].from,l=t[a].to;l&&(u=u+"-"+l),u&&o.push(i(a+":"+u))}}),t.exclude&&Object.keys(t.exclude).length>0&&o.push(Go.stringify(t.exclude,e,"-")),o.join(" ")}});var Zh=gi((dP,Xh)=>{Xh.exports=Jh()});var em,Ua,wr,Qo=A(()=>{Ze();Tt();em=_e(Zh()),Ua=["ext","path"],wr=class{#e;constructor(e=""){T.ignoreDiacritics&&(e=Ft(e));let r=(0,em.parse)(e.toLowerCase(),{tokenize:!0,keywords:Ua});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 Ua){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 Ua)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()))]}}});function r1(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(f){try{l(n.next(f))}catch(p){s(p)}}function u(f){try{l(n.throw(f))}catch(p){s(p)}}function l(f){f.done?o(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function n1(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(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]=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 xe(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 pe,i1,tm,rm,Me,Ga,bn,o1,nm,Qa,qo,qa,Ya,s1,im,om,Ja,pi,Xa,sm,a1,Za,el,l1,u1,c1,f1,tl,am,d1,rl,nl,il,p1,lm,um,cm,Yo,h1,fm=A(()=>{pe=function(){return pe=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0?[{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 rm:return this.value();case tm: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]},o1=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;ar)continue e}nm(t.get(h),e,r,n,i,j,s,a+h)}}}catch(k){u={error:k}}finally{try{c&&!c.done&&(l=p.return)&&l.call(p)}finally{if(u)throw u.error}}},Qa=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=xe(qo(this._tree,e.slice(this._prefix.length)),2),o=i[0],s=i[1];if(o===void 0){var a=xe(Ja(s),2),u=a[0],l=a[1];try{for(var f=q(u.keys()),p=f.next();!p.done;p=f.next()){var c=p.value;if(c!==Me&&c.startsWith(l)){var h=new Map;return h.set(c.slice(l.length),u.get(c)),new t(h,e)}}}catch(w){r={error:w}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}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,s1(this._tree,e)},t.prototype.entries=function(){return new Ga(this,i1)},t.prototype.forEach=function(e){var r,n;try{for(var i=q(this),o=i.next();!o.done;o=i.next()){var s=xe(o.value,2),a=s[0],u=s[1];e(a,u,this)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return o1(this._tree,e,r)},t.prototype.get=function(e){var r=qa(this._tree,e);return r!==void 0?r.get(Me):void 0},t.prototype.has=function(e){var r=qa(this._tree,e);return r!==void 0&&r.has(Me)},t.prototype.keys=function(){return new Ga(this,tm)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Ya(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=Ya(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=Ya(this._tree,e),i=n.get(Me);return i===void 0&&n.set(Me,i=r()),i},t.prototype.values=function(){return new Ga(this,rm)},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=xe(s.value,2),u=a[0],l=a[1];i.set(u,l)}}catch(f){r={error:f}}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(u){n={error:u}}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)},qa=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 qa(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}}},Ya=function(t,e){var r,n,i=e.length;e:for(var o=0;t&&o0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Qa,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(u){r={error:u}}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=nl,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 r1(this,void 0,void 0,function(){var n,i,o,s,a,u,l,f,p,c,h,w,j,_,d,v,m,g,b,y,x,S,E,D,P;return n1(this,function(L){switch(L.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||rl.batchSize,o=e.batchWait||rl.batchWait,s=1,L.label=1;case 1:L.trys.push([1,7,8,9]),a=q(this._index),u=a.next(),L.label=2;case 2:if(u.done)return[3,6];l=xe(u.value,2),f=l[0],p=l[1];try{for(c=(S=void 0,q(p)),h=c.next();!h.done;h=c.next()){w=xe(h.value,2),j=w[0],_=w[1];try{for(d=(D=void 0,q(_)),v=d.next();!v.done;v=d.next())m=xe(v.value,1),g=m[0],!this._documentIds.has(g)&&(_.size<=1?p.delete(j):_.delete(g))}catch(k){D={error:k}}finally{try{v&&!v.done&&(P=d.return)&&P.call(d)}finally{if(D)throw D.error}}}}catch(k){S={error:k}}finally{try{h&&!h.done&&(E=c.return)&&E.call(c)}finally{if(S)throw S.error}}return this._index.get(f).size===0&&this._index.delete(f),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 u=a.next(),[3,2];case 6:return[3,9];case 7:return b=L.sent(),y={error:b},[3,9];case 8:try{u&&!u.done&&(x=a.return)&&x.call(a)}finally{if(y)throw y.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||il.minDirtCount,n=n||il.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.search=function(e,r){var n,i;r===void 0&&(r={});var o=this.executeQuery(e,r),s=[];try{for(var a=q(o),u=a.next();!u.done;u=a.next()){var l=xe(u.value,2),f=l[0],p=l[1],c=p.score,h=p.terms,w=p.match,j=h.length,_={id:this._documentIds.get(f),score:c*j,terms:Object.keys(w),match:w};Object.assign(_,this._storedFields.get(f)),(r.filter==null||r.filter(_))&&s.push(_)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s.sort(um),s},t.prototype.autoSuggest=function(e,r){var n,i,o,s;r===void 0&&(r={}),r=pe(pe({},this._options.autoSuggestOptions),r);var a=new Map;try{for(var u=q(this.search(e,r)),l=u.next();!l.done;l=u.next()){var f=l.value,p=f.score,c=f.terms,h=c.join(" "),w=a.get(h);w!=null?(w.score+=p,w.count+=1):a.set(h,{score:p,terms:c,count:1})}}catch(b){n={error:b}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}var j=[];try{for(var _=q(a),d=_.next();!d.done;d=_.next()){var v=xe(d.value,2),w=v[0],m=v[1],p=m.score,c=m.terms,g=m.count;j.push({suggestion:w,terms:c,score:p/g})}}catch(b){o={error:b}}finally{try{d&&!d.done&&(s=_.return)&&s.call(_)}finally{if(o)throw o.error}}return j.sort(um),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(tl.hasOwnProperty(e))return el(tl,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,o,s,a,u,l=e.index,f=e.documentCount,p=e.nextId,c=e.documentIds,h=e.fieldIds,w=e.fieldLength,j=e.averageFieldLength,_=e.storedFields,d=e.dirtCount,v=e.serializationVersion;if(v!==1&&v!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var m=new t(r);m._documentCount=f,m._nextId=p,m._documentIds=Yo(c),m._idToShortId=new Map,m._fieldIds=h,m._fieldLength=Yo(w),m._avgFieldLength=j,m._storedFields=Yo(_),m._dirtCount=d||0,m._index=new Qa;try{for(var g=q(m._documentIds),b=g.next();!b.done;b=g.next()){var y=xe(b.value,2),x=y[0],S=y[1];m._idToShortId.set(S,x)}}catch(F){n={error:F}}finally{try{b&&!b.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}try{for(var E=q(l),D=E.next();!D.done;D=E.next()){var P=xe(D.value,2),L=P[0],k=P[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];v===1&&(C=C.ds),H.set(parseInt(J,10),Yo(C))}}catch(F){a={error:F}}finally{try{Y&&!Y.done&&(u=X.return)&&u.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={}),typeof e!="string"){var i=pe(pe(pe({},r),e),{queries:void 0}),o=e.queries.map(function(_){return n.executeQuery(_,i)});return this.combineResults(o,e.combineWith)}var s=this._options,a=s.tokenize,u=s.processTerm,l=s.searchOptions,f=pe(pe({tokenize:a,processTerm:u},l),r),p=f.tokenize,c=f.processTerm,h=p(e).flatMap(function(_){return c(_)}).filter(function(_){return!!_}),w=h.map(f1(f)),j=w.map(function(_){return n.executeQuerySpec(_,f)});return this.combineResults(j,f.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,o,s,a=pe(pe({},this._options.searchOptions),r),u=(a.fields||this._options.fields).reduce(function(J,C){var F;return pe(pe({},J),(F={},F[C]=el(J,C)||1,F))},a.boost||{}),l=a.boostDocument,f=a.weights,p=a.maxFuzzy,c=a.bm25,h=pe(pe({},am.weights),f),w=h.fuzzy,j=h.prefix,_=this._index.get(e.term),d=this.termResults(e.term,e.term,1,_,u,l,c),v,m;if(e.prefix&&(v=this._index.atPrefix(e.term)),e.fuzzy){var g=e.fuzzy===!0?.2:e.fuzzy,b=g<1?Math.min(p,Math.round(e.term.length*g)):g;b&&(m=this._index.fuzzyGet(e.term,b))}if(v)try{for(var y=q(v),x=y.next();!x.done;x=y.next()){var S=xe(x.value,2),E=S[0],D=S[1],P=E.length-e.term.length;if(!!P){m==null||m.delete(E);var L=j*E.length/(E.length+.3*P);this.termResults(e.term,E,L,D,u,l,c,d)}}}catch(J){n={error:J}}finally{try{x&&!x.done&&(i=y.return)&&i.call(y)}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=xe(m.get(E),2),Y=X[0],P=X[1];if(!!P){var L=w*E.length/(E.length+P);this.termResults(e.term,E,L,Y,u,l,c,d)}}}catch(J){o={error:J}}finally{try{H&&!H.done&&(s=k.return)&&s.call(k)}finally{if(o)throw o.error}}return d},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=Xa),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(l1[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 u=xe(a.value,2),l=u[0],f=u[1],p={};try{for(var c=(n=void 0,q(f)),h=c.next();!h.done;h=c.next()){var w=xe(h.value,2),j=w[0],_=w[1];p[j]=Object.fromEntries(_)}}catch(d){n={error:d}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}o.push([l,p])}}catch(d){e={error:d}}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,u){var l,f,p,c,h;if(u===void 0&&(u=new Map),i==null)return u;try{for(var w=q(Object.keys(o)),j=w.next();!j.done;j=w.next()){var _=j.value,d=o[_],v=this._fieldIds[_],m=i.get(v);if(m!=null){var g=m.size,b=this._avgFieldLength[v];try{for(var y=(p=void 0,q(m.keys())),x=y.next();!x.done;x=y.next()){var S=x.value;if(!this._documentIds.has(S)){this.removeTerm(v,S,r),g-=1;continue}var E=s?s(this._documentIds.get(S),r):1;if(!!E){var D=m.get(S),P=this._fieldLength.get(S)[v],L=c1(D,g,this._documentCount,P,b,a),k=n*d*E*L,H=u.get(S);if(H){H.score+=k,p1(H.terms,e);var X=el(H.match,r);X?X.push(_):H.match[r]=[_]}else u.set(S,{score:k,terms:[e],match:(h={},h[r]=[_],h)})}}}catch(Y){p={error:Y}}finally{try{x&&!x.done&&(c=y.return)&&c.call(y)}finally{if(p)throw p.error}}}}}catch(Y){l={error:Y}}finally{try{j&&!j.done&&(f=w.return)&&f.call(w)}finally{if(l)throw l.error}}return u},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,cm),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,cm),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 u=a.value;if(this._fieldIds[u]===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(u,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(l){i={error:l}}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{fm();ot();Ze();Tt();dm=_e(require("obsidian"));Gr();gn();vn();m1=t=>{let e=t.split(Iu),r=t.split(qn);r=[...r,...r.flatMap(Vu)],r=[...r,...r.flatMap(Hu)],r=[...r,...e];let n=Ou();if(n){let i=r.flatMap(o=>Eu.test(o)?n.cut(o):[o]);r=[...r,...i]}return r=[...new Set(r)],r},Jo=class{constructor(){this.indexedDocuments=new Map;this.minisearch=new Za(Jo.options)}async loadCache(){let e=await Ae.getMinisearchCache();return e?(this.minisearch=Za.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 Ae.getDocument(i)))).filter(i=>!!i?.path);he("Sorting documents to first index markdown"),r=Wa(r,i=>i.path.endsWith(".md")?0:1),this.removeFromPaths(r.filter(i=>this.indexedDocuments.has(i.path)).map(i=>i.path));let n=zu(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=this.minisearch.search(e.segmentsToStr(),{prefix:l=>l.length>=r.prefixLength,fuzzy:l=>l.length<=3?0:l.length<=5?n/2:n,combineWith:"AND",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",i.length,"results"),e.query.ext?.length&&(i=i.filter(l=>{let f="."+l.id.split(".").pop();return e.query.ext?.some(p=>f.startsWith(p.startsWith(".")?p:"."+p))})),e.query.path&&(i=i.filter(l=>e.query.path?.some(f=>l.id.toLowerCase().includes(f.toLowerCase())))),e.query.exclude.path&&(i=i.filter(l=>!e.query.exclude.path?.some(f=>l.id.toLowerCase().includes(f.toLowerCase())))),!i.length)return[];if(r.singleFilePath)return i.filter(l=>l.id===r.singleFilePath);T.hideExcluded?i=i.filter(l=>!(app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id))):i.forEach(l=>{app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id)&&(l.score/=10)});let o=e.getTags();for(let l of o)for(let f of i)(f.tags??[]).includes(l)&&(f.score*=100);he("Sorting and limiting results"),i=i.sort((l,f)=>f.score-l.score).slice(0,50),i.length&&he("First result:",i[0]);let s=await Promise.all(i.map(async l=>await Ae.getDocument(l.id))),a=e.getExactTerms();a.length&&(he("Filtering with quoted terms: ",a),i=i.filter(l=>{let f=s.find(h=>h.path===l.id),p=f?.path.toLowerCase()??"",c=(f?.cleanedContent??"").toLowerCase();return a.every(h=>c.includes(h)||Ft(p).includes(h))}));let u=e.query.exclude.text;return u.length&&(he("Filtering with exclusions"),i=i.filter(l=>{let f=(s.find(p=>p.path===l.id)?.content??"").toLowerCase();return u.every(p=>!f.includes(p))})),he("Deduping"),i=i.filter((l,f,p)=>p.findIndex(c=>c.id===l.id)===f),i}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 Ae.getDocument(s.id)));return n.map(s=>{he("Locating matches for",s.id);let a=i.find(p=>p.path===s.id);a||(console.warn(`Omnisearch - Note "${s.id}" not in the live cache`),a={content:"",basename:s.id,path:s.id});let u=[...Object.keys(s.match),...e.getExactTerms(),...e.getTags()].filter(p=>p.length>1||/\p{Emoji}/u.test(p));he("Matching tokens:",u),he("Getting matches locations...");let l=di(a.content,yn(u),e);return he(`Matches for ${a.basename}`,l),ge({score:s.score,foundWords:u,matches:l},a)})}async writeToCache(){await Ae.writeMinisearchCache(this.minisearch,this.indexedDocuments)}},ol=Jo;ol.options={tokenize:m1,extractField:(e,r)=>{if(r==="directory"){let n=e.path.split("/");return n.pop(),n.join("/")}return e[r]},processTerm:e=>(T.ignoreDiacritics?Ft(e):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,r,n){n==="version_conflict"&&new dm.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}};Ce=new ol});function pm(t){sl.add(t)}async function Xo(){let t=[...sl].map(e=>e.path);t.length&&(Ce.removeFromPaths(t),await Ce.addFromPaths(t),sl.clear())}var sl,Zo=A(()=>{xn();sl=new Set});var hm=gi(es=>{function al(t){return al=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},al(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 oe=a(this).constructor;Z=Reflect.construct(K,arguments,oe)}else Z=K.apply(this,arguments);return i(this,Z)}}function i(C,F){if(F&&(al(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(I){return I.__proto__||Object.getPrototypeOf(I)},a(C)}function u(C,F){var I=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(!I){if(Array.isArray(C)||(I=l(C))||F&&C&&typeof C.length=="number"){I&&(C=I);var K=0,Z=function(){};return{s:Z,n:function(){return K>=C.length?{done:!0}:{done:!1,value:C[K++]}},e:function(ve){throw ve},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 oe=!0,Ee=!1,B;return{s:function(){I=I.call(C)},n:function(){var ve=I.next();return oe=ve.done,ve},e:function(ve){Ee=!0,B=ve},f:function(){try{!oe&&I.return!=null&&I.return()}finally{if(Ee)throw B}}}}function l(C,F){if(!!C){if(typeof C=="string")return f(C,F);var I=Object.prototype.toString.call(C).slice(8,-1);if(I==="Object"&&C.constructor&&(I=C.constructor.name),I==="Map"||I==="Set")return Array.from(C);if(I==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(I))return f(C,F)}}function f(C,F){(F==null||F>C.length)&&(F=C.length);for(var I=0,K=new Array(F);I{let{score:r,path:n,basename:i,foundWords:o,matches:s,content:a}=e,u=_n(a,s[0]?.offset??-1);return{score:r,vault:app.vault.getName(),path:n,basename:i,foundWords:o,matches:s.map(f=>({match:f.match,offset:f.offset})),excerpt:u.content}})}async function N1(t){let e=new wr(t),r=await Ce.getSuggestions(e);return L1(r)}function B1(t){rs.push(t),Tm&&t()}function K1(t){rs=rs.filter(e=>e!==t)}function Dm(){Tm=!0,rs.forEach(t=>t())}var Tm,rs,mi,ul=A(()=>{Qo();xn();vn();Zo();Tm=!1,rs=[];mi={search:N1,registerOnIndexed:B1,unregisterOnIndexed:K1,refreshIndex:Xo}});var km={};gl(km,{default:()=>z1,getServer:()=>Pm});function Pm(){let t=Om.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=Im.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.httpApiNotice&&new ns.Notice("Omnisearch - Terminated HTTP server")}}}var Om,Im,ns,z1,Mm=A(()=>{Om=_e(require("http")),Im=_e(require("url"));ul();ns=_e(require("obsidian"));Ze();z1=Pm});gl(exports,{default:()=>cl});var Ar=_e(require("obsidian"));var ts=_e(require("obsidian"));Xe();var lt=_e(require("obsidian"));Xe();Xe();var Gu=_e(require("obsidian"));ot();Gr();function Sy(t){let e,r,n,i,o,s,a,u,l=t[8].default,f=Er(l,t,t[7],null);return{c(){e=M("div"),r=M("div"),n=M("input"),o=G(),f&&f.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(p,c){$(p,e,c),O(e,r),O(r,n),t[9](n),as(n,t[1]),O(e,o),f&&f.m(e,null),s=!0,a||(u=[Pe(n,"input",t[10]),xl(i=t[3].call(null,n)),Pe(n,"compositionend",t[11]),Pe(n,"compositionstart",t[12]),Pe(n,"input",t[4])],a=!0)},p(p,[c]){(!s||c&1)&&N(n,"placeholder",p[0]),c&2&&n.value!==p[1]&&as(n,p[1]),f&&f.p&&(!s||c&128)&&Tr(f,l,p,p[7],s?Fr(l,p[7],c,null):Dr(p[7]),null)},i(p){s||(te(f,p),s=!0)},o(p){ne(f,p),s=!1},d(p){p&&W(e),t[9](null),f&&f.d(p),a=!1,nt(u)}}}function Cy(t,e,r){let{$$slots:n={},$$scope:i}=e,{initialValue:o=""}=e,{placeholder:s=""}=e,a=!1,u="",l,f=cs();function p(m){r(1,u=m)}function c(m){m&&!a&&!u&&(a=!0,r(1,u=m),h())}function h(m){kt().then(()=>(l.focus(),kt())).then(()=>{l.select()})}let w=(0,Gu.debounce)(()=>{Ae.addToSearchHistory(""),f("input",u)},300);function j(m){_t[m?"unshift":"push"](()=>{l=m,r(2,l)})}function _(){u=this.value,r(1,u)}let d=m=>ua(!1),v=m=>ua(!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:c(o)}},[s,u,l,h,w,o,p,i,n,j,_,d,v]}var Qu=class extends ke{constructor(e){super();Ne(this,e,Cy,Sy,Fe,{initialValue:5,placeholder:0,setInputValue:6})}get setInputValue(){return this.$$.ctx[6]}},to=Qu;Xe();function Ey(t){let e,r,n,i,o=t[1].default,s=Er(o,t,t[0],null);return{c(){e=M("div"),s&&s.c(),N(e,"class","prompt-results")},m(a,u){$(a,e,u),s&&s.m(e,null),r=!0,n||(i=Pe(e,"mousedown",Fy),n=!0)},p(a,[u]){s&&s.p&&(!r||u&1)&&Tr(s,o,a,a[0],r?Fr(o,a[0],u,null):Dr(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 Fy=t=>t.preventDefault();function Ty(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}var qu=class extends ke{constructor(e){super();Ne(this,e,Ty,Ey,Fe,{})}},ro=qu;ot();var $a=_e(require("obsidian"));vn();async function $o(t,e=!1){let r=yn(t.foundWords);r.exec(t.content);let n=r.lastIndex,i=!1;app.workspace.iterateAllLeaves(a=>{a.view instanceof $a.MarkdownView&&!e&&a.getViewState().state?.file===t.path&&a.getViewState()?.pinned&&(app.workspace.setActiveLeaf(a,{focus:!0}),i=!0)}),i||await app.workspace.openLinkText(t.path,"",e);let o=app.workspace.getActiveViewOfType($a.MarkdownView);if(!o)return;let s=o.editor.offsetToPos(n);o.editor.setCursor(s),o.editor.scrollIntoView({from:{line:s.line-10,ch:0},to:{line:s.line+10,ch:0}})}async function Kh(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}}Tt();Xe();Ze();Tt();Xe();Xe();function q0(t){let e;return{c(){e=M("span"),e.innerHTML='',N(e,"class","suggestion-flair"),N(e,"aria-label","Not created yet, select to create")},m(r,n){$(r,e,n)},p:fe,i:fe,o:fe,d(r){r&&W(e)}}}function Y0(t){"use strict";return[]}var zh=class extends ke{constructor(e){super();Ne(this,e,Y0,q0,Fe,{})}},Hh=zh;function Vh(t){let e,r;return e=new Hh({}),{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 J0(t){let e,r,n,i,o,s=t[2]&&Vh(t),a=t[4].default,u=Er(a,t,t[3],null);return{c(){e=M("div"),s&&s.c(),r=G(),u&&u.c(),N(e,"data-result-id",t[0]),N(e,"class","suggestion-item omnisearch-result"),ls(e,"is-selected",t[1])},m(l,f){$(l,e,f),s&&s.m(e,null),O(e,r),u&&u.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(l,[f]){l[2]?s?f&4&&te(s,1):(s=Vh(l),s.c(),te(s,1),s.m(e,r)):s&&(nr(),ne(s,1,1,()=>{s=null}),ir()),u&&u.p&&(!n||f&8)&&Tr(u,a,l,l[3],n?Fr(a,l[3],f,null):Dr(l[3]),null),(!n||f&1)&&N(e,"data-result-id",l[0]),(!n||f&2)&&ls(e,"is-selected",l[1])},i(l){n||(te(s),te(u,l),n=!0)},o(l){ne(s),ne(u,l),n=!1},d(l){l&&W(e),s&&s.d(),u&&u.d(l),i=!1,nt(o)}}}function X0(t,e,r){let{$$slots:n={},$$scope:i}=e,{id:o}=e,{selected:s=!1}=e,{glyph:a=!1}=e;function u(c){qe.call(this,t,c)}function l(c){qe.call(this,t,c)}function f(c){qe.call(this,t,c)}function p(c){qe.call(this,t,c)}return t.$$set=c=>{"id"in c&&r(0,o=c.id),"selected"in c&&r(1,s=c.selected),"glyph"in c&&r(2,a=c.glyph),"$$scope"in c&&r(3,i=c.$$scope)},[o,s,a,i,n,u,l,f,p]}var Wh=class extends ke{constructor(e){super();Ne(this,e,X0,J0,Fe,{id:0,selected:1,glyph:2})}},Uo=Wh;var tr=_e(require("obsidian"));gn();vn();function $h(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,u){$(a,e,u),O(e,n),O(e,i),O(e,s)},p(a,u){u&2&&r!==(r=a[1].matches.length+"")&&ut(n,r),u&2&&o!==(o=(a[1].matches.length>1?"matches":"match")+"")&&ut(s,o)},d(a){a&&W(e)}}}function Uh(t){let e,r,n,i,o=yt(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){$(s,e,a),O(e,r),t[16](r),O(e,n),O(e,i),i.innerHTML=o},p(s,a){a&1032&&o!==(o=yt(s[3],s[10])+"")&&(i.innerHTML=o)},d(s){s&&W(e),t[16](null)}}}function Gh(t){let e,r=yt(t[6].content,t[9])+"";return{c(){e=M("div"),N(e,"class","omnisearch-result__body")},m(n,i){$(n,e,i),e.innerHTML=r},p(n,i){i&576&&r!==(r=yt(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){$(i,e,o),O(e,r)},p(i,o){o&128&&!ss(r.src,n=i[7])&&N(r,"src",n)},d(i){i&&W(e)}}}function Z0(t){let e,r,n,i,o,s,a=yt(t[2],t[11])+"",u,l,f,p=gr(t[1].path)+"",c,h,w,j,_,d,v=t[1].matches.length>0&&$h(t),m=t[3]&&Uh(t),g=t[12]&&Gh(t),b=t[7]&&Qh(t);return{c(){e=M("div"),r=M("div"),n=M("span"),i=M("span"),o=G(),s=M("span"),u=G(),l=M("span"),f=Ie("."),c=Ie(p),h=G(),v&&v.c(),w=G(),m&&m.c(),j=G(),_=M("div"),g&&g.c(),d=G(),b&&b.c(),N(l,"class","omnisearch-result__extension"),N(n,"class","omnisearch-result__title"),N(r,"class","omnisearch-result__title-container"),Qe(_,"display","flex"),Qe(_,"flex-direction","row")},m(y,x){$(y,e,x),O(e,r),O(r,n),O(n,i),t[15](i),O(n,o),O(n,s),s.innerHTML=a,O(n,u),O(n,l),O(l,f),O(l,c),O(n,h),v&&v.m(n,null),O(e,w),m&&m.m(e,null),O(e,j),O(e,_),g&&g.m(_,null),O(_,d),b&&b.m(_,null)},p(y,x){x&2052&&a!==(a=yt(y[2],y[11])+"")&&(s.innerHTML=a),x&2&&p!==(p=gr(y[1].path)+"")&&ut(c,p),y[1].matches.length>0?v?v.p(y,x):(v=$h(y),v.c(),v.m(n,null)):v&&(v.d(1),v=null),y[3]?m?m.p(y,x):(m=Uh(y),m.c(),m.m(e,j)):m&&(m.d(1),m=null),y[12]?g?g.p(y,x):(g=Gh(y),g.c(),g.m(_,d)):g&&(g.d(1),g=null),y[7]?b?b.p(y,x):(b=Qh(y),b.c(),b.m(_,null)):b&&(b.d(1),b=null)},d(y){y&&W(e),t[15](null),v&&v.d(),m&&m.d(),g&&g.d(),b&&b.d()}}}function e1(t){let e,r;return e=new Uo({props:{glyph:t[8],id:t[1].path,selected:t[0],$$slots:{default:[Z0]},$$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 t1(t,e,r){let n,i,o,s,a,u,l;_i(t,dr,x=>r(12,l=x));let{selected:f=!1}=e,{note:p}=e,{app:c}=e,h=null,w="",j="",_,d;function v(x){_t[x?"unshift":"push"](()=>{d=x,r(5,d)})}function m(x){_t[x?"unshift":"push"](()=>{_=x,r(4,_)})}function g(x){qe.call(this,t,x)}function b(x){qe.call(this,t,x)}function y(x){qe.call(this,t,x)}t.$$set=x=>{"selected"in x&&r(0,f=x.selected),"note"in x&&r(1,p=x.note),"app"in x&&r(13,c=x.app)},t.$$.update=()=>{if(t.$$.dirty&8194){e:if(r(7,h=null),$r(p.path)){let x=c.vault.getAbstractFileByPath(p.path);x instanceof tr.TFile&&r(7,h=c.vault.getResourcePath(x))}}if(t.$$.dirty&2){e:r(14,n=yn(p.foundWords))}if(t.$$.dirty&50){e:r(2,w=p.basename),r(3,j=Ru(p.path)),_&&(0,tr.setIcon)(_,"folder-open"),d&&($r(p.path)?(0,tr.setIcon)(d,"image"):mr(p.path)?(0,tr.setIcon)(d,"file-text"):Ur(p.path)?(0,tr.setIcon)(d,"layout-dashboard"):(0,tr.setIcon)(d,"file"))}if(t.$$.dirty&16388){e:r(11,i=di(w,n))}if(t.$$.dirty&16392){e:r(10,o=di(j,n))}if(t.$$.dirty&2){e:r(6,a=_n(p.content,p.matches[0]?.offset??-1))}if(t.$$.dirty&66){e:r(9,s=fi(p.matches).map(x=>(x.offset=x.offset-a.offset,x)))}};e:r(8,u=!1);return[f,p,w,j,_,d,a,h,u,s,o,i,l,c,n,v,m,g,b,y]}var qh=class extends ke{constructor(e){super();Ne(this,e,t1,e1,Fe,{selected:0,note:1,app:13})}},Yh=qh;Qo();Ze();Zo();Gr();xn();var mm=_e(hm());gn();function gm(t,e,r){let n=t.slice();return n[38]=e[r],n[40]=r,n}function g1(t){let e,r,n;return{c(){e=M("button"),e.textContent="Create note"},m(i,o){$(i,e,o),r||(n=Pe(e,"click",t[13]),r=!0)},p:fe,d(i){i&&W(e),r=!1,n()}}}function y1(t){let e,r,n;return{c(){e=M("button"),e.textContent="In-File search"},m(i,o){$(i,e,o),r||(n=Pe(e,"click",t[14]),r=!0)},p:fe,d(i){i&&W(e),r=!1,n()}}}function _1(t){let e,r,n=T.showCreateButton&&g1(t),i=lt.Platform.isMobile&&y1(t);return{c(){e=M("div"),n&&n.c(),r=G(),i&&i.c(),N(e,"class","omnisearch-input-container__buttons")},m(o,s){$(o,e,s),n&&n.m(e,null),O(e,r),i&&i.m(e,null)},p(o,s){T.showCreateButton&&n.p(o,s),lt.Platform.isMobile&&i.p(o,s)},d(o){o&&W(e),n&&n.d(),i&&i.d()}}}function ym(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){$(i,e,o),O(e,r),O(e,n)},p(i,o){o[0]&16&&ut(n,i[4])},d(i){i&&W(e)}}}function _m(t){let e,r;function n(...i){return t[20](t[40],...i)}return e=new Yh({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 v1(t){let e;return{c(){e=Ie("Searching...")},m(r,n){$(r,e,n)},p:fe,d(r){r&&W(e)}}}function b1(t){let e,r=T.simpleSearch&&t[2].split(qn).some(bm),n,i=r&&vm(t);return{c(){e=Ie(`We found 0 result for your search here. `),i&&i.c(),n=An()},m(o,s){$(o,e,s),i&&i.m(o,s),$(o,n,s)},p(o,s){s[0]&4&&(r=T.simpleSearch&&o[2].split(qn).some(bm)),r?i||(i=vm(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 vm(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){$(i,e,o),$(i,r,o),$(i,n,o)},d(i){i&&W(e),i&&W(r),i&&W(n)}}}function x1(t){let e,r,n,i=t[3],o=[];for(let f=0;fne(o[f],1,1,()=>{o[f]=null});function a(f,p){if(!f[3].length&&f[2]&&!f[5])return b1;if(f[5])return v1}let u=a(t,[-1,-1]),l=u&&u(t);return{c(){for(let f=0;f\u2191\u2193to navigate',u=G(),l=M("div"),l.innerHTML=`alt \u2191\u2193 to cycle history`,f=G(),p=M("div"),c=M("span"),h=Ie(t[8]),w=G(),j=M("span"),j.textContent="to open",_=G(),d=M("div"),d.innerHTML=`tab to switch to In-File Search`,v=G(),m=M("div"),g=M("span"),b=Ie(t[7]),y=G(),x=M("span"),x.textContent="to open in a new pane",S=G(),E=M("div"),E.innerHTML=`alt o to open in the background`,D=G(),P=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]),I=G(),K=M("span"),K.textContent="to create in a new pane",Z=G(),oe=M("div"),oe.innerHTML=`alt \u21B5 to insert a link`,Ee=G(),B=M("div"),B.innerHTML=`ctrl h to toggle excerpts`,le=G(),ve=M("div"),ve.innerHTML='escto close',N(a,"class","prompt-instruction"),N(l,"class","prompt-instruction"),N(c,"class","prompt-instruction-command"),N(p,"class","prompt-instruction"),N(d,"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(P,"class","prompt-instruction"),N(C,"class","prompt-instruction-command"),N(J,"class","prompt-instruction"),N(oe,"class","prompt-instruction"),N(B,"class","prompt-instruction"),N(ve,"class","prompt-instruction"),N(s,"class","prompt-instructions")},m(ee,we){He(e,ee,we),$(ee,r,we),Re&&Re.m(ee,we),$(ee,n,we),He(i,ee,we),$(ee,o,we),$(ee,s,we),O(s,a),O(s,u),O(s,l),O(s,f),O(s,p),O(p,c),O(c,h),O(p,w),O(p,j),O(s,_),O(s,d),O(s,v),O(s,m),O(m,g),O(g,b),O(m,y),O(m,x),O(s,S),O(s,E),O(s,D),O(s,P),O(P,L),O(L,k),O(P,H),O(P,X),O(s,Y),O(s,J),O(J,C),O(C,F),O(J,I),O(J,K),O(s,Z),O(s,oe),O(s,Ee),O(s,B),O(s,le),O(s,ve),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=ym(ee),Re.c(),Re.m(n.parentNode,n)):Re&&(Re.d(1),Re=null);let fl={};we[0]&47|we[1]&1024&&(fl.$$scope={dirty:we,ctx:ee}),i.$set(fl),(!Oe||we[0]&256)&&ut(h,ee[8]),(!Oe||we[0]&128)&&ut(b,ee[7]),(!Oe||we[0]&1024)&&ut(k,ee[10]),(!Oe||we[0]&512)&&ut(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 bm=t=>t.length<3;function j1(t,e,r){let n,i;_i(t,Ht,B=>r(17,i=B));let{modal:o}=e,{previousQuery:s}=e,{app:a}=e,u=0,l=0,f,p=[],c,h="",w=!0,j,_,d,v,m;En(async()=>{Q.enable("vault"),Q.on("vault",re.Enter,D),Q.on("vault",re.OpenInBackground,P),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,b),await Xo(),await S()}),Fn(()=>{Q.disable("vault")});async function g(){let B=(await Ae.getSearchHistory()).filter(le=>le);++l>=B.length&&(l=0),r(2,f=B[l]),j?.setInputValue(f)}async function b(){let B=(await Ae.getSearchHistory()).filter(le=>le);--l<0&&(l=B.length?B.length-1:0),r(2,f=B[l]),j?.setInputValue(f)}let y=null;async function x(){r(5,w=!0),y&&(y.cancel(),y=null),c=new wr(f),y=(0,mm.cancelable)(new Promise(B=>{B(Ce.getSuggestions(c))})),r(3,p=await y),r(1,u=0),await I(),r(5,w=!1)}let S=Va(x,0);function E(B){!n||(B?.ctrlKey?L():D(),o.close())}function D(){!n||(H(n),o.close())}function P(){!n||H(n,!0)}function L(){!n||(H(n,!0),o.close())}function k(){f&&Ae.addToSearchHistory(f)}function H(B,le=!1){k(),$o(B,le)}async function X(B){await Y()}async function Y(B){if(f){try{await Kh(f,B?.newLeaf)}catch(le){new lt.Notice(le.message);return}o.close()}}function J(){if(!n)return;let B=a.vault.getMarkdownFiles().find(Re=>Re.path===n.path),le=a.workspace.getActiveFile(),ve=a.workspace.getActiveViewOfType(lt.MarkdownView);if(!ve?.editor){new lt.Notice("Omnisearch - Error - No active editor",3e3);return}let Oe;B&&le?Oe=a.fileManager.generateMarkdownLink(B,le.path):Oe=`[[${n.basename}.${gr(n.path)}]]`;let Sr=ve.editor.getCursor();ve.editor.replaceRange(Oe,Sr,Sr),Sr.ch+=Oe.length,ve.editor.setCursor(Sr),o.close()}function C(){if(!(n&&(mr(n?.path)||!n?.matches.length)))if(k(),o.close(),n){let B=a.vault.getAbstractFileByPath(n.path);B&&B instanceof lt.TFile&&new wn(a,B,f).open()}else{let B=a.workspace.getActiveViewOfType(lt.MarkdownView);B?.file&&new wn(a,B.file,f).open()}}function F(B){r(1,u=Ji(u+B,p.length)),I()}async function I(){await kt(),n&&activeWindow.document.querySelector(`[data-result-id="${n.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function K(B){_t[B?"unshift":"push"](()=>{j=B,r(6,j)})}let Z=B=>r(2,f=B.detail),oe=(B,le)=>r(1,u=B),Ee=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,f=f??s)}if(t.$$.dirty[0]&4){e:f?S():(r(5,w=!1),r(3,p=[]))}if(t.$$.dirty[0]&10){e:n=p[u]}if(t.$$.dirty[0]&131072){e:switch(i){case et.LoadingCache:r(4,h="Loading cache...");break;case et.ReadingFiles:r(4,h="Reading files...");break;case et.IndexingFiles:r(4,h="Indexing files...");break;case et.WritingCache:S(),r(4,h="Updating cache...");break;default:S(),r(4,h="");break}}};e:T.openInNewPane?(r(7,_="\u21B5"),r(8,d=hr()+" \u21B5"),r(9,v="shift \u21B5"),r(10,m=hr()+" shift \u21B5")):(r(7,_=hr()+" \u21B5"),r(8,d="\u21B5"),r(9,v=hr()+" shift \u21B5"),r(10,m="shift \u21B5"));return[a,u,f,p,h,w,j,_,d,v,m,E,L,X,C,o,s,i,K,Z,oe,Ee]}var xm=class extends ke{constructor(e){super();Ne(this,e,j1,w1,Fe,{modal:15,previousQuery:16,app:0},null,[-1,-1])}},wm=xm;Xe();ot();Tt();var hi=_e(require("obsidian"));Xe();vn();gn();function A1(t){let e,r=yt(t[2].content,t[3])+"";return{c(){e=M("div"),N(e,"class","omnisearch-result__body")},m(n,i){$(n,e,i),e.innerHTML=r},p(n,i){i&12&&r!==(r=yt(n[2].content,n[3])+"")&&(e.innerHTML=r)},d(n){n&&W(e)}}}function S1(t){let e,r;return e=new Uo({props:{id:t[0].toString(),selected:t[1],$$slots:{default:[A1]},$$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 C1(t,e,r){let n,i,{offset:o}=e,{note:s}=e,{index:a=0}=e,{selected:u=!1}=e;function l(c){qe.call(this,t,c)}function f(c){qe.call(this,t,c)}function p(c){qe.call(this,t,c)}return t.$$set=c=>{"offset"in c&&r(4,o=c.offset),"note"in c&&r(5,s=c.note),"index"in c&&r(0,a=c.index),"selected"in c&&r(1,u=c.selected)},t.$$.update=()=>{if(t.$$.dirty&48){e:r(2,n=_n(s?.content??"",o))}if(t.$$.dirty&36){e:r(3,i=fi(s.matches).map(c=>(c.offset=c.offset-n.offset,c)))}},[a,u,n,i,o,s,l,f,p]}var jm=class extends ke{constructor(e){super();Ne(this,e,C1,S1,Fe,{offset:4,note:5,index:0,selected:1})}},Am=jm;Qo();xn();function Sm(t,e,r){let n=t.slice();return n[20]=e[r],n[22]=r,n}function E1(t){let e,r,n;return{c(){e=M("button"),e.textContent="Vault search"},m(i,o){$(i,e,o),r||(n=Pe(e,"click",t[7]),r=!0)},p:fe,d(i){i&&W(e),r=!1,n()}}}function F1(t){let e,r=hi.Platform.isMobile&&E1(t);return{c(){e=M("div"),r&&r.c(),N(e,"class","omnisearch-input-container__buttons")},m(n,i){$(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 T1(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){$(r,e,n)},p:fe,i:fe,o:fe,d(r){r&&W(e)}}}function D1(t){let e,r,n=t[4],i=[];for(let s=0;sne(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s{s[f]=null}),ir(),r=s[e],r?r.p(u,l):(r=s[e]=o[e](u),r.c()),te(r,1),r.m(n.parentNode,n))},i(u){i||(te(r),i=!0)},o(u){ne(r),i=!1},d(u){s[e].d(u),u&&W(n)}}}function I1(t){let e;return{c(){e=M("span"),e.textContent="to close"},m(r,n){$(r,e,n)},d(r){r&&W(e)}}}function P1(t){let e;return{c(){e=M("span"),e.textContent="to go back to Vault Search"},m(r,n){$(r,e,n)},d(r){r&&W(e)}}}function k1(t){let e,r,n,i,o,s,a,u,l,f,p,c,h,w,j,_,d,v,m,g;e=new to({props:{placeholder:"Omnisearch - File",initialValue:t[1],$$slots:{default:[F1]},$$scope:{ctx:t}}}),e.$on("input",t[12]),n=new ro({props:{$$slots:{default:[O1]},$$scope:{ctx:t}}});function b(S,E){return S[0]?P1:I1}let y=b(t,-1),x=y(t);return{c(){Ue(e.$$.fragment),r=G(),Ue(n.$$.fragment),i=G(),o=M("div"),s=M("div"),s.innerHTML='\u2191\u2193to navigate',a=G(),u=M("div"),u.innerHTML='\u21B5to open',l=G(),f=M("div"),f.innerHTML=`tab to switch to Vault Search`,p=G(),c=M("div"),h=M("span"),h.textContent="esc",w=G(),x.c(),j=G(),_=M("div"),d=M("span"),d.textContent=`${hr()} \u21B5`,v=G(),m=M("span"),m.textContent="to open in a new pane",N(s,"class","prompt-instruction"),N(u,"class","prompt-instruction"),N(f,"class","prompt-instruction"),N(h,"class","prompt-instruction-command"),N(c,"class","prompt-instruction"),N(d,"class","prompt-instruction-command"),N(_,"class","prompt-instruction"),N(o,"class","prompt-instructions")},m(S,E){He(e,S,E),$(S,r,E),He(n,S,E),$(S,i,E),$(S,o,E),O(o,s),O(o,a),O(o,u),O(o,l),O(o,f),O(o,p),O(o,c),O(c,h),O(c,w),x.m(c,null),O(o,j),O(o,_),O(_,d),O(_,v),O(_,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 P={};E&8388664&&(P.$$scope={dirty:E,ctx:S}),n.$set(P),y!==(y=b(S,E))&&(x.d(1),x=y(S),x&&(x.c(),x.m(c,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),x.d()}}}function M1(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 R1(t,e,r){let{modal:n}=e,{parent:i=null}=e,{singleFilePath:o=""}=e,{previousQuery:s}=e,{app:a}=e,u,l=[],f=0,p,c;En(()=>{Q.enable("infile"),Q.on("infile",re.Enter,d),Q.on("infile",re.OpenInNewPane,_),Q.on("infile",re.ArrowUp,()=>w(-1)),Q.on("infile",re.ArrowDown,()=>w(1)),Q.on("infile",re.Tab,v)}),Fn(()=>{Q.disable("infile")});function h(x){let S=[],E=-1,D=0;for(;;){let P=M1(x,E,Qn);if(!P.length||(E=P.last().offset,S.push(P),++D>100))break}return S}function w(x){r(5,f=Ji(f+x,l.length)),j()}async function j(){await kt(),document.querySelector(`[data-result-id="${f}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function _(){return d(!0)}async function d(x=!1){if(p){n.close(),i&&i.close(),await $o(p,x);let S=a.workspace.getActiveViewOfType(hi.MarkdownView);if(!S)return;let E=l[f]??0,D=S.editor.offsetToPos(E);D.ch=0,S.editor.setCursor(D),S.editor.scrollIntoView({from:{line:D.line-10,ch:0},to:{line:D.line+10,ch:0}})}}function v(){new jr(a,u??s).open(),n.close()}let m=x=>r(2,u=x.detail),g=(x,S)=>r(5,f=x),b=x=>d(x.ctrlKey),y=x=>{x.button==1&&d(!0)};return t.$$set=x=>{"modal"in x&&r(8,n=x.modal),"parent"in x&&r(0,i=x.parent),"singleFilePath"in x&&r(9,o=x.singleFilePath),"previousQuery"in x&&r(1,s=x.previousQuery),"app"in x&&r(10,a=x.app)},t.$$.update=()=>{if(t.$$.dirty&2){e:r(2,u=s??"")}if(t.$$.dirty&2564){e:(async()=>{u&&(r(11,c=new wr(u)),r(3,p=(await Ce.getSuggestions(c,{singleFilePath:o}))[0]??null)),r(5,f=0),await j()})()}if(t.$$.dirty&8){e:if(p){let x=h(p.matches);r(4,l=x.map(S=>Math.round((S.first().offset+S.last().offset)/2)))}}},[i,s,u,p,l,f,d,v,n,o,a,c,m,g,b,y]}var Em=class extends ke{constructor(e){super();Ne(this,e,R1,k1,Fe,{modal:8,parent:0,singleFilePath:9,previousQuery:1,app:10})}},Fm=Em;ot();Ze();Gr();var ll=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,u=>{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,u=>{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=>{ca()||(s.preventDefault(),Q.emit(re.Enter))}),this.scope.register(["Alt"],"O",s=>{ca()||(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)})}},jr=class extends ll{constructor(e,r){super(e);let n=e.workspace.getActiveViewOfType(ts.MarkdownView)?.editor.getSelection();Ae.getSearchHistory().then(i=>{let o=T.showPreviousQueryResults?i[0]:null,s=new wm({target:this.modalEl,props:{app:e,modal:this,previousQuery:r||n||o||""}});this.onClose=()=>{s.$destroy()}})}},wn=class extends ll{constructor(e,r,n="",i){super(e);let o=new Fm({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()}}};Ze();ot();ul();Tt();Gi();Zo();xn();Gr();var cl=class extends Ar.Plugin{constructor(){super(...arguments);this.apiHttpServer=null}async onload(){if(await Au(this),this.addSettingTab(new aa(this)),Ar.Platform.isMobile||Promise.resolve().then(()=>(Mm(),km)).then(e=>this.apiHttpServer=e.getServer()),la()){console.log("Omnisearch - Plugin disabled");return}await H1(this.app),await Wr.clearOldDatabases(),V1(this),T.ribbonIcon&&this.addRibbonButton(),Q.disable("vault"),Q.disable("infile"),Q.on("global",qi.ToggleExcerpts,()=>{dr.set(!T.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new jr(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),Ce.addFromPaths([e.path]))})),this.registerEvent(this.app.vault.on("delete",e=>{he("Removing file",e.path),Ae.removeFromLiveCache(e.path),Ce.removeFromPaths([e.path])})),this.registerEvent(this.app.vault.on("modify",async e=>{Jn(e.path)&&(he("Updating file",e.path),await Ae.addToLiveCache(e.path),pm(e))})),this.registerEvent(this.app.vault.on("rename",async(e,r)=>{Jn(e.path)&&(he("Renaming file",e.path),Ae.removeFromLiveCache(r),await Ae.addToLiveCache(e.path),Ce.removeFromPaths([r]),await Ce.addFromPaths([e.path]))})),this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&T.httpApiEnabled&&this.apiHttpServer.listen(T.httpApiPort)})}executeFirstLaunchTasks(){let e="1.10.1";T.welcomeMessage!==e,T.welcomeMessage=e,this.saveData(T)}async onunload(){delete globalThis.omnisearch,await Te.clearCache(),this.apiHttpServer.close()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new jr(this.app).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}async populateIndex(){console.time("Omnisearch - Indexing total time"),Ht.set(et.ReadingFiles);let e=this.app.vault.getFiles().filter(n=>Jn(n.path));console.log(`Omnisearch - ${e.length} files total`),console.log(`Omnisearch - Cache is ${Et()?"enabled":"disabled"}`),Et()&&(console.time("Omnisearch - Loading index from cache"),Ht.set(et.LoadingCache),await Ce.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let r=Ce.getDiff(e.map(n=>({path:n.path,mtime:n.stat.mtime})));Et()&&(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&&Et()&&new Ar.Notice(`Omnisearch - ${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),Ht.set(et.IndexingFiles),Ce.removeFromPaths(r.toRemove.map(n=>n.path)),await Ce.addFromPaths(r.toAdd.map(n=>n.path)),(r.toRemove.length||r.toAdd.length)&&Et()&&(Ht.set(et.WritingCache),T.useCache=!1,await se(this),await Ce.writeToCache(),T.useCache=!0,await se(this)),console.timeEnd("Omnisearch - Indexing total time"),r.toAdd.length>=1e3&&Et()&&new Ar.Notice("Omnisearch - Your files have been indexed."),Ht.set(et.Done),Dm()}};async function H1(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 V1(t){t.registerObsidianProtocolHandler("omnisearch",e=>{new jr(t.app,e.query).open()}),globalThis.omnisearch=mi,t.app.plugins.plugins.omnisearch.api=mi}