45 lines
186 KiB
JavaScript
45 lines
186 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var Fc=Object.create;var Sr=Object.defineProperty,Sc=Object.defineProperties,Ec=Object.getOwnPropertyDescriptor,Dc=Object.getOwnPropertyDescriptors,Tc=Object.getOwnPropertyNames,ro=Object.getOwnPropertySymbols,kc=Object.getPrototypeOf,no=Object.prototype.hasOwnProperty,Ic=Object.prototype.propertyIsEnumerable;var io=(t,e,r)=>e in t?Sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,re=(t,e)=>{for(var r in e||(e={}))no.call(e,r)&&io(t,r,e[r]);if(ro)for(var r of ro(e))Ic.call(e,r)&&io(t,r,e[r]);return t},xe=(t,e)=>Sc(t,Dc(e)),so=t=>Sr(t,"__esModule",{value:!0});var yi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Oc=(t,e)=>{so(t);for(var r in e)Sr(t,r,{get:e[r],enumerable:!0})},Mc=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tc(e))!no.call(t,n)&&n!=="default"&&Sr(t,n,{get:()=>e[n],enumerable:!(r=Ec(e,n))||r.enumerable});return t},be=t=>Mc(so(Sr(t!=null?Fc(kc(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var ya=yi((Xr,bs)=>{(function(t,e){if(typeof Xr=="object"&&typeof bs=="object")bs.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r=e();for(var n in r)(typeof Xr=="object"?Xr:t)[n]=r[n]}})(typeof self!="undefined"?self:Xr,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,s){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:s})},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 s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:n}),2&i&&typeof n!="string")for(var o in n)r.d(s,o,function(a){return n[a]}.bind(null,o));return s},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 b});var n="0123456789abcdef".split(""),i=function(x){for(var h="",v=0;v<4;v++)h+=n[x>>8*v+4&15]+n[x>>8*v&15];return h},s=function(x){for(var h=x.length,v=0;v<h;v++)x[v]=i(x[v]);return x.join("")},o=function(x,h){return x+h&4294967295},a=function(x,h,v,p,m,_,g){return function(j,A,C){return o(j<<A|j>>>32-A,C)}(h=function(j,A,C,F){return A=o(o(A,j),o(C,F))}(x,h,p,_),m,v)},l=function(x,h,v,p,m,_,g,j){return a(v&p|~v&m,h,v,_,g,j,x)},u=function(x,h,v,p,m,_,g,j){return a(v&m|p&~m,h,v,_,g,j,x)},c=function(x,h,v,p,m,_,g,j){return a(v^p^m,h,v,_,g,j,x)},d=function(x,h,v,p,m,_,g,j){return a(p^(v|~m),h,v,_,g,j,x)},f=function(x,h,v){v===void 0&&(v=o);var p=x[0],m=x[1],_=x[2],g=x[3],j=l.bind(null,v);p=j(p,m,_,g,h[0],7,-680876936),g=j(g,p,m,_,h[1],12,-389564586),_=j(_,g,p,m,h[2],17,606105819),m=j(m,_,g,p,h[3],22,-1044525330),p=j(p,m,_,g,h[4],7,-176418897),g=j(g,p,m,_,h[5],12,1200080426),_=j(_,g,p,m,h[6],17,-1473231341),m=j(m,_,g,p,h[7],22,-45705983),p=j(p,m,_,g,h[8],7,1770035416),g=j(g,p,m,_,h[9],12,-1958414417),_=j(_,g,p,m,h[10],17,-42063),m=j(m,_,g,p,h[11],22,-1990404162),p=j(p,m,_,g,h[12],7,1804603682),g=j(g,p,m,_,h[13],12,-40341101),_=j(_,g,p,m,h[14],17,-1502002290),m=j(m,_,g,p,h[15],22,1236535329);var A=u.bind(null,v);p=A(p,m,_,g,h[1],5,-165796510),g=A(g,p,m,_,h[6],9,-1069501632),_=A(_,g,p,m,h[11],14,643717713),m=A(m,_,g,p,h[0],20,-373897302),p=A(p,m,_,g,h[5],5,-701558691),g=A(g,p,m,_,h[10],9,38016083),_=A(_,g,p,m,h[15],14,-660478335),m=A(m,_,g,p,h[4],20,-405537848),p=A(p,m,_,g,h[9],5,568446438),g=A(g,p,m,_,h[14],9,-1019803690),_=A(_,g,p,m,h[3],14,-187363961),m=A(m,_,g,p,h[8],20,1163531501),p=A(p,m,_,g,h[13],5,-1444681467),g=A(g,p,m,_,h[2],9,-51403784),_=A(_,g,p,m,h[7],14,1735328473),m=A(m,_,g,p,h[12],20,-1926607734);var C=c.bind(null,v);p=C(p,m,_,g,h[5],4,-378558),g=C(g,p,m,_,h[8],11,-2022574463),_=C(_,g,p,m,h[11],16,1839030562),m=C(m,_,g,p,h[14],23,-35309556),p=C(p,m,_,g,h[1],4,-1530992060),g=C(g,p,m,_,h[4],11,1272893353),_=C(_,g,p,m,h[7],16,-155497632),m=C(m,_,g,p,h[10],23,-1094730640),p=C(p,m,_,g,h[13],4,681279174),g=C(g,p,m,_,h[0],11,-358537222),_=C(_,g,p,m,h[3],16,-722521979),m=C(m,_,g,p,h[6],23,76029189),p=C(p,m,_,g,h[9],4,-640364487),g=C(g,p,m,_,h[12],11,-421815835),_=C(_,g,p,m,h[15],16,530742520),m=C(m,_,g,p,h[2],23,-995338651);var F=d.bind(null,v);p=F(p,m,_,g,h[0],6,-198630844),g=F(g,p,m,_,h[7],10,1126891415),_=F(_,g,p,m,h[14],15,-1416354905),m=F(m,_,g,p,h[5],21,-57434055),p=F(p,m,_,g,h[12],6,1700485571),g=F(g,p,m,_,h[3],10,-1894986606),_=F(_,g,p,m,h[10],15,-1051523),m=F(m,_,g,p,h[1],21,-2054922799),p=F(p,m,_,g,h[8],6,1873313359),g=F(g,p,m,_,h[15],10,-30611744),_=F(_,g,p,m,h[6],15,-1560198380),m=F(m,_,g,p,h[13],21,1309151649),p=F(p,m,_,g,h[4],6,-145523070),g=F(g,p,m,_,h[11],10,-1120210379),_=F(_,g,p,m,h[2],15,718787259),m=F(m,_,g,p,h[9],21,-343485551),x[0]=v(p,x[0]),x[1]=v(m,x[1]),x[2]=v(_,x[2]),x[3]=v(g,x[3])},y=function(x){for(var h=[],v=0;v<64;v+=4)h[v>>2]=x.charCodeAt(v)+(x.charCodeAt(v+1)<<8)+(x.charCodeAt(v+2)<<16)+(x.charCodeAt(v+3)<<24);return h},w=function(x,h){var v,p=x.length,m=[1732584193,-271733879,-1732584194,271733878];for(v=64;v<=p;v+=64)f(m,y(x.substring(v-64,v)),h);var _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=(x=x.substring(v-64)).length;for(v=0;v<g;v++)_[v>>2]|=x.charCodeAt(v)<<(v%4<<3);if(_[v>>2]|=128<<(v%4<<3),v>55)for(f(m,_,h),v=16;v--;)_[v]=0;return _[14]=8*p,f(m,_,h),m};function b(x){var h;return s(w("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(h=function(v,p){var m=(65535&v)+(65535&p);return(v>>16)+(p>>16)+(m>>16)<<16|65535&m}),s(w(x,h))}}])})});var Ha=yi(Qn=>{Qn.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=[],s=/(\S+:'(?:[^'\\]|\\.)*')|(\S+:"(?:[^"\\]|\\.)*")|(-?"(?:[^"\\]|\\.)*")|(-?'(?:[^'\\]|\\.)*')|\S+|\S+:\S+/g,o;(o=s.exec(t))!==null;){var f=o[0],a=f.indexOf(":");if(a!==-1){var l=f.split(":"),u=f.slice(0,a),c=f.slice(a+1);c=c.replace(/^\"|\"$|^\'|\'$/g,""),c=(c+"").replace(/\\(.?)/g,function(g,j){switch(j){case"\\":return"\\";case"0":return"\0";case"":return"";default:return j}}),i.push({keyword:u,value:c,offsetStart:o.index,offsetEnd:o.index+f.length})}else{var d=!1;f[0]==="-"&&(d=!0,f=f.slice(1)),f=f.replace(/^\"|\"$|^\'|\'$/g,""),f=(f+"").replace(/\\(.?)/g,function(g,j){switch(j){case"\\":return"\\";case"0":return"\0";case"":return"";default:return j}}),d?n.text?(n.text instanceof Array||(n.text=[n.text]),n.text.push(f)):n.text=f:i.push({text:f,offsetStart:o.index,offsetEnd:o.index+f.length})}}i.reverse();for(var f;f=i.pop();)if(f.text)r.text.push(f.text),e.offsets&&r.offsets.push(f);else{var u=f.keyword;e.keywords=e.keywords||[];var y=!1,w=!1;if(!/^-/.test(u))y=e.keywords.indexOf(u)!==-1;else if(u[0]==="-"){var b=u.slice(1);y=e.keywords.indexOf(b)!==-1,y&&(u=b,w=!0)}e.ranges=e.ranges||[];var x=e.ranges.indexOf(u)!==-1;if(y){e.offsets&&r.offsets.push({keyword:u,value:f.value,offsetStart:w?f.offsetStart+1:f.offsetStart,offsetEnd:f.offsetEnd});var h=f.value;if(h.length){var v=h.split(",");w?n[u]?n[u]instanceof Array?v.length>1?n[u]=n[u].concat(v):n[u].push(h):(n[u]=[n[u]],n[u].push(h)):v.length>1?n[u]=v:e.alwaysArray?n[u]=[h]:n[u]=h:r[u]?r[u]instanceof Array?v.length>1?r[u]=r[u].concat(v):r[u].push(h):(r[u]=[r[u]],r[u].push(h)):v.length>1?r[u]=v:e.alwaysArray?r[u]=[h]:r[u]=h}}else if(x){e.offsets&&r.offsets.push(f);var h=f.value,p=h.split("-");r[u]={},p.length===2?(r[u].from=p[0],r[u].to=p[1]):!p.length%2||(r[u].from=h)}else{var m=f.keyword+":"+f.value;r.text.push(m),e.offsets&&r.offsets.push({text:m,offsetStart:f.offsetStart,offsetEnd:f.offsetEnd})}}return r.text.length?e.tokenize||(r.text=r.text.join(" ").trim()):delete r.text,r.exclude=n,r};Qn.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},s=[];if(t.text){var o=[];typeof t.text=="string"?o.push(t.text):o.push.apply(o,t.text),o.length>0&&s.push(o.map(n).map(i).join(" "))}return e.keywords&&e.keywords.forEach(function(a){if(!!t[a]){var l=[];typeof t[a]=="string"?l.push(t[a]):l.push.apply(l,t[a]),l.length>0&&s.push(i(a+":"+l.map(n).join(",")))}}),e.ranges&&e.ranges.forEach(function(a){if(!!t[a]){var l=t[a].from,u=t[a].to;u&&(l=l+"-"+u),l&&s.push(i(a+":"+l))}}),t.exclude&&Object.keys(t.exclude).length>0&&s.push(Qn.stringify(t.exclude,e,"-")),s.join(" ")}});var Ua=yi(($v,Wa)=>{Wa.exports=Ha()});Oc(exports,{default:()=>eo});var Fr=be(require("obsidian"));var wc=be(require("obsidian"));function ne(){}function Pc(t,e){for(let r in e)t[r]=e[r];return t}function vi(t){return t()}function oo(){return Object.create(null)}function Re(t){t.forEach(vi)}function Ut(t){return typeof t=="function"}function fe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}var an;function _i(t,e){return an||(an=document.createElement("a")),an.href=e,t===an.href}function ao(t){return Object.keys(t).length===0}function lo(t,...e){if(t==null)return ne;let r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function ln(t,e,r){t.$$.on_destroy.push(lo(e,r))}function Gt(t,e,r,n){if(t){let i=uo(t,e,r,n);return t[0](i)}}function uo(t,e,r,n){return t[1]&&n?Pc(r.ctx.slice(),t[1](n(e))):r.ctx}function Qt(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 s=[],o=Math.max(e.dirty.length,i.length);for(let a=0;a<o;a+=1)s[a]=e.dirty[a]|i[a];return s}return e.dirty|i}return e.dirty}function qt(t,e,r,n,i,s){if(i){let o=uo(e,r,n,s);t.p(o,i)}}function Yt(t){if(t.ctx.length>32){let e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function co(t){return t&&Ut(t.destroy)?t.destroy:ne}var fo=!1;function Rc(){fo=!0}function Bc(){fo=!1}function k(t,e){t.appendChild(e)}function z(t,e,r){t.insertBefore(e,r||null)}function K(t){t.parentNode&&t.parentNode.removeChild(t)}function un(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}function O(t){return document.createElement(t)}function Fe(t){return document.createTextNode(t)}function U(){return Fe(" ")}function Jt(){return Fe("")}function Te(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function B(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Lc(t){return Array.from(t.childNodes)}function St(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function xi(t,e){t.value=e??""}function ke(t,e,r,n){r===null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":"")}function bi(t,e,r){t.classList[r?"add":"remove"](e)}function Nc(t,e,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}var Er;function Dr(t){Er=t}function wi(){if(!Er)throw new Error("Function called outside component initialization");return Er}function Tr(t){wi().$$.on_mount.push(t)}function kr(t){wi().$$.on_destroy.push(t)}function ji(){let t=wi();return(e,r,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let s=Nc(e,r,{cancelable:n});return i.slice().forEach(o=>{o.call(t,s)}),!s.defaultPrevented}return!0}}function Me(t,e){let r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}var Ir=[];var He=[],cn=[],ho=[],po=Promise.resolve(),Ai=!1;function mo(){Ai||(Ai=!0,po.then(go))}function ot(){return mo(),po}function Ci(t){cn.push(t)}var Fi=new Set,fn=0;function go(){let t=Er;do{for(;fn<Ir.length;){let e=Ir[fn];fn++,Dr(e),Kc(e.$$)}for(Dr(null),Ir.length=0,fn=0;He.length;)He.pop()();for(let e=0;e<cn.length;e+=1){let r=cn[e];Fi.has(r)||(Fi.add(r),r())}cn.length=0}while(Ir.length);for(;ho.length;)ho.pop()();Ai=!1,Fi.clear(),Dr(t)}function Kc(t){if(t.fragment!==null){t.update(),Re(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ci)}}var dn=new Set,Et;function Dt(){Et={r:0,c:[],p:Et}}function Tt(){Et.r||Re(Et.c),Et=Et.p}function Q(t,e){t&&t.i&&(dn.delete(t),t.i(e))}function q(t,e,r,n){if(t&&t.o){if(dn.has(t))return;dn.add(t),Et.c.push(()=>{dn.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}var Py=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function Se(t){t&&t.c()}function we(t,e,r,n){let{fragment:i,after_update:s}=t.$$;i&&i.m(e,r),n||Ci(()=>{let o=t.$$.on_mount.map(vi).filter(Ut);t.$$.on_destroy?t.$$.on_destroy.push(...o):Re(o),t.$$.on_mount=[]}),s.forEach(Ci)}function ge(t,e){let r=t.$$;r.fragment!==null&&(Re(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function zc(t,e){t.$$.dirty[0]===-1&&(Ir.push(t),mo(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ye(t,e,r,n,i,s,o,a=[-1]){let l=Er;Dr(t);let u=t.$$={fragment:null,ctx:[],props:s,update:ne,not_equal:i,bound:oo(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:oo(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};o&&o(u.root);let c=!1;if(u.ctx=r?r(t,e.props||{},(d,f,...y)=>{let w=y.length?y[0]:f;return u.ctx&&i(u.ctx[d],u.ctx[d]=w)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](w),c&&zc(t,d)),f}):[],u.update(),c=!0,Re(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){Rc();let d=Lc(e.target);u.fragment&&u.fragment.l(d),d.forEach(K)}else u.fragment&&u.fragment.c();e.intro&&Q(t.$$.fragment),we(t,e.target,e.anchor,e.customElement),Bc(),go()}Dr(l)}var Vc;typeof HTMLElement=="function"&&(Vc=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(vi).filter(Ut);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){Re(this.$$.on_disconnect)}$destroy(){ge(this,1),this.$destroy=ne}$on(t,e){if(!Ut(e))return ne;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&&!ao(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var pe=class{$destroy(){ge(this,1),this.$destroy=ne}$on(e,r){if(!Ut(r))return ne;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&&!ao(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var Ft=be(require("obsidian"));var Ta=be(require("obsidian"));var Si=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,s])=>!this.disabled.includes(i.split("@")[0]));for(let[i,s]of n)i.endsWith(`@${e}`)&&s(...r)}};var Xt=[];function hn(t,e=ne){let r,n=new Set;function i(a){if(fe(t,a)&&(t=a,r)){let l=!Xt.length;for(let u of n)u[1](),Xt.push(u,t);if(l){for(let u=0;u<Xt.length;u+=2)Xt[u][0](Xt[u+1]);Xt.length=0}}}function s(a){i(a(t))}function o(a,l=ne){let u=[a,l];return n.add(u),n.size===1&&(r=e(i)||ne),a(t),()=>{n.delete(u),n.size===0&&(r(),r=null)}}return{set:i,update:s,subscribe:o}}var G=be(require("obsidian"));var J=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,oe=Object.keys,ve=Array.isArray;typeof Promise!="undefined"&&!J.Promise&&(J.Promise=Promise);function je(t,e){return typeof e!="object"||oe(e).forEach(function(r){t[r]=e[r]}),t}var Or=Object.getPrototypeOf,$c={}.hasOwnProperty;function Ie(t,e){return $c.call(t,e)}function Zt(t,e){typeof e=="function"&&(e=e(Or(t))),(typeof Reflect=="undefined"?oe:Reflect.ownKeys)(e).forEach(r=>{We(t,r,e[r])})}var yo=Object.defineProperty;function We(t,e,r,n){yo(t,e,je(r&&Ie(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function er(t){return{from:function(e){return t.prototype=Object.create(e.prototype),We(t.prototype,"constructor",t),{extend:Zt.bind(null,t.prototype)}}}}var Hc=Object.getOwnPropertyDescriptor;function Ei(t,e){let r=Hc(t,e),n;return r||(n=Or(t))&&Ei(n,e)}var Wc=[].slice;function pn(t,e,r){return Wc.call(t,e,r)}function vo(t,e){return e(t)}function Mr(t){if(!t)throw new Error("Assertion Failed")}function _o(t){J.setImmediate?setImmediate(t):setTimeout(t,0)}function xo(t,e){return t.reduce((r,n,i)=>{var s=e(n,i);return s&&(r[s[0]]=s[1]),r},{})}function Uc(t,e,r){try{t.apply(null,r)}catch(n){e&&e(n)}}function Ue(t,e){if(Ie(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var r=[],n=0,i=e.length;n<i;++n){var s=Ue(t,e[n]);r.push(s)}return r}var o=e.indexOf(".");if(o!==-1){var a=t[e.substr(0,o)];return a===void 0?void 0:Ue(a,e.substr(o+1))}}function Be(t,e,r){if(!(!t||e===void 0)&&!("isFrozen"in Object&&Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Mr(typeof r!="string"&&"length"in r);for(var n=0,i=e.length;n<i;++n)Be(t,e[n],r[n])}else{var s=e.indexOf(".");if(s!==-1){var o=e.substr(0,s),a=e.substr(s+1);if(a==="")r===void 0?ve(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=r;else{var l=t[o];(!l||!Ie(t,o))&&(l=t[o]={}),Be(l,a,r)}}else r===void 0?ve(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=r}}function Gc(t,e){typeof e=="string"?Be(t,e,void 0):"length"in e&&[].map.call(e,function(r){Be(t,r,void 0)})}function bo(t){var e={};for(var r in t)Ie(t,r)&&(e[r]=t[r]);return e}var Qc=[].concat;function wo(t){return Qc.apply([],t)}var jo="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(wo([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>J[t]),qc=jo.map(t=>J[t]);xo(jo,t=>[t,!0]);var at=null;function Pr(t){at=typeof WeakMap!="undefined"&&new WeakMap;let e=Di(t);return at=null,e}function Di(t){if(!t||typeof t!="object")return t;let e=at&&at.get(t);if(e)return e;if(ve(t)){e=[],at&&at.set(t,e);for(var r=0,n=t.length;r<n;++r)e.push(Di(t[r]))}else if(qc.indexOf(t.constructor)>=0)e=t;else{let s=Or(t);e=s===Object.prototype?{}:Object.create(s),at&&at.set(t,e);for(var i in t)Ie(t,i)&&(e[i]=Di(t[i]))}return e}var{toString:Yc}={};function Ti(t){return Yc.call(t).slice(8,-1)}var ki=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",Jc=typeof ki=="symbol"?function(t){var e;return t!=null&&(e=t[ki])&&e.apply(t)}:function(){return null},tr={};function Ge(t){var e,r,n,i;if(arguments.length===1){if(ve(t))return t.slice();if(this===tr&&typeof t=="string")return[t];if(i=Jc(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}var Ii=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,Ke=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Ao(t,e){Ke=t,Co=e}var Co=()=>!0,Xc=!new Error("").stack;function kt(){if(Xc)try{throw kt.arguments,new Error}catch(t){return t}return new Error}function Oi(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(Co).map(n=>`
|
|
`+n).join("")):""}var Zc=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Fo=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Mi=Zc.concat(Fo),ef={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function rr(t,e){this._e=kt(),this.name=t,this.message=e}er(rr).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Oi(this._e,2))}},toString:function(){return this.name+": "+this.message}});function So(t,e){return t+". Errors: "+Object.keys(e).map(r=>e[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
|
|
`)}function mn(t,e,r,n){this._e=kt(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=So(t,e)}er(mn).from(rr);function Rr(t,e){this._e=kt(),this.name="BulkError",this.failures=Object.keys(e).map(r=>e[r]),this.failuresByPos=e,this.message=So(t,e)}er(Rr).from(rr);var Pi=Mi.reduce((t,e)=>(t[e]=e+"Error",t),{}),tf=rr,L=Mi.reduce((t,e)=>{var r=e+"Error";function n(i,s){this._e=kt(),this.name=r,i?typeof i=="string"?(this.message=`${i}${s?`
|
|
`+s:""}`,this.inner=s||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=ef[e]||r,this.inner=null)}return er(n).from(tf),t[e]=n,t},{});L.Syntax=SyntaxError;L.Type=TypeError;L.Range=RangeError;var Eo=Fo.reduce((t,e)=>(t[e+"Error"]=L[e],t),{});function rf(t,e){if(!t||t instanceof rr||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Eo[t.name])return t;var r=new Eo[t.name](e||t.message,t);return"stack"in t&&We(r,"stack",{get:function(){return this.inner.stack}}),r}var gn=Mi.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=L[e]),t),{});gn.ModifyError=mn;gn.DexieError=rr;gn.BulkError=Rr;function Y(){}function Br(t){return t}function nf(t,e){return t==null||t===Br?e:function(r){return e(t(r))}}function It(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function sf(t,e){return t===Y?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 s=e.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?It(n,this.onsuccess):n),i&&(this.onerror=this.onerror?It(i,this.onerror):i),s!==void 0?s:r}}function of(t,e){return t===Y?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?It(r,this.onsuccess):r),n&&(this.onerror=this.onerror?It(n,this.onerror):n)}}function af(t,e){return t===Y?e:function(r){var n=t.apply(this,arguments);je(r,n);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?It(i,this.onsuccess):i),s&&(this.onerror=this.onerror?It(s,this.onerror):s),n===void 0?o===void 0?void 0:o:je(n,o)}}function lf(t,e){return t===Y?e:function(){return e.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}function Ri(t,e){return t===Y?e:function(){var r=t.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return r.then(function(){return e.apply(n,s)})}return e.apply(this,arguments)}}var Lr={},uf=100,cf=20,Do=100,[Bi,yn,Li]=typeof Promise=="undefined"?[]:(()=>{let t=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[t,Or(t),t];let e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Or(e),t]})(),To=yn&&yn.then,vn=Bi&&Bi.constructor,Ni=!!Li,Ki=!1,ff=Li?()=>{Li.then(wn)}:J.setImmediate?setImmediate.bind(null,wn):J.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{wn(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(wn,0)},Nr=function(t,e){Kr.push([t,e]),_n&&(ff(),_n=!1)},zi=!0,_n=!0,Ot=[],xn=[],Vi=null,$i=Br,nr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Ko,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{Ko(t[0],t[1])}catch{}})}},R=nr,Kr=[],Mt=0,bn=[];function I(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Y,this._lib=!1;var e=this._PSD=R;if(Ke&&(this._stackHolder=kt(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==Lr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Wi(this,this._value);return}this._state=null,this._value=null,++e.ref,Io(this,t)}var Hi={get:function(){var t=R,e=Cn;function r(n,i){var s=!t.global&&(t!==R||e!==Cn);let o=s&&!Qe();var a=new I((l,u)=>{Ui(this,new ko(Sn(n,t,s,o),Sn(i,t,s,o),l,u,t))});return Ke&&Po(a,this),a}return r.prototype=Lr,r},set:function(t){We(this,"then",t&&t.prototype===Lr?Hi:{get:function(){return t},set:Hi.set})}};Zt(I.prototype,{then:Hi,_then:function(t,e){Ui(this,new ko(null,null,t,e,R))},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):jn(n)):this.then(null,n=>n&&n.name===e?r(n):jn(n))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),jn(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Ki=!0;var t=Mo(this,[],cf),e=t.join(`
|
|
From previous: `);return this._state!==null&&(this._stack=e),e}finally{Ki=!1}}},timeout:function(t,e){return t<1/0?new I((r,n)=>{var i=setTimeout(()=>n(new L.Timeout(e)),t);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&We(I.prototype,Symbol.toStringTag,"Dexie.Promise");nr.env=Ro();function ko(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}Zt(I,{all:function(){var t=Ge.apply(null,arguments).map(Fn);return new I(function(e,r){t.length===0&&e([]);var n=t.length;t.forEach((i,s)=>I.resolve(i).then(o=>{t[s]=o,--n||e(t)},r))})},resolve:t=>{if(t instanceof I)return t;if(t&&typeof t.then=="function")return new I((r,n)=>{t.then(r,n)});var e=new I(Lr,!0,t);return Po(e,Vi),e},reject:jn,race:function(){var t=Ge.apply(null,arguments).map(Fn);return new I((e,r)=>{t.map(n=>I.resolve(n).then(e,r))})},PSD:{get:()=>R,set:t=>R=t},totalEchoes:{get:()=>Cn},newPSD:lt,usePSD:sr,scheduler:{get:()=>Nr,set:t=>{Nr=t}},rejectionMapper:{get:()=>$i,set:t=>{$i=t}},follow:(t,e)=>new I((r,n)=>lt((i,s)=>{var o=R;o.unhandleds=[],o.onunhandled=s,o.finalize=It(function(){hf(()=>{this.unhandleds.length===0?i():s(this.unhandleds[0])})},o.finalize),t()},e,r,n))});vn&&(vn.allSettled&&We(I,"allSettled",function(){let t=Ge.apply(null,arguments).map(Fn);return new I(e=>{t.length===0&&e([]);let r=t.length,n=new Array(r);t.forEach((i,s)=>I.resolve(i).then(o=>n[s]={status:"fulfilled",value:o},o=>n[s]={status:"rejected",reason:o}).then(()=>--r||e(n)))})}),vn.any&&typeof AggregateError!="undefined"&&We(I,"any",function(){let t=Ge.apply(null,arguments).map(Fn);return new I((e,r)=>{t.length===0&&r(new AggregateError([]));let n=t.length,i=new Array(n);t.forEach((s,o)=>I.resolve(s).then(a=>e(a),a=>{i[o]=a,--n||r(new AggregateError(i))}))})}));function Io(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&&zr();r&&typeof r.then=="function"?Io(t,(i,s)=>{r instanceof I?r._then(i,s):r.then(i,s)}):(t._state=!0,t._value=r,Oo(t)),n&&Vr()}},Wi.bind(null,t))}catch(r){Wi(t,r)}}function Wi(t,e){if(xn.push(e),t._state===null){var r=t._lib&&zr();e=$i(e),t._state=!1,t._value=e,Ke&&e!==null&&typeof e=="object"&&!e._promise&&Uc(()=>{var n=Ei(e,"stack");e._promise=t,We(e,"stack",{get:()=>Ki?n&&(n.get?n.get.apply(e):n.value):t.stack})}),pf(t),Oo(t),r&&Vr()}}function Oo(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r<n;++r)Ui(t,e[r]);var i=t._PSD;--i.ref||i.finalize(),Mt===0&&(++Mt,Nr(()=>{--Mt==0&&Gi()},[]))}function Ui(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,++Mt,Nr(df,[r,t,e])}function df(t,e,r){try{Vi=e;var n,i=e._value;e._state?n=t(i):(xn.length&&(xn=[]),n=t(i),xn.indexOf(i)===-1&&mf(e)),r.resolve(n)}catch(s){r.reject(s)}finally{Vi=null,--Mt==0&&Gi(),--r.psd.ref||r.psd.finalize()}}function Mo(t,e,r){if(e.length===r)return e;var n="";if(t._state===!1){var i=t._value,s,o;i!=null?(s=i.name||"Error",o=i.message||i,n=Oi(i,0)):(s=i,o=""),e.push(s+(o?": "+o:"")+n)}return Ke&&(n=Oi(t._stackHolder,2),n&&e.indexOf(n)===-1&&e.push(n),t._prev&&Mo(t._prev,e,r)),e}function Po(t,e){var r=e?e._numPrev+1:0;r<uf&&(t._prev=e,t._numPrev=r)}function wn(){zr()&&Vr()}function zr(){var t=zi;return zi=!1,_n=!1,t}function Vr(){var t,e,r;do for(;Kr.length>0;)for(t=Kr,Kr=[],r=t.length,e=0;e<r;++e){var n=t[e];n[0].apply(null,n[1])}while(Kr.length>0);zi=!0,_n=!0}function Gi(){var t=Ot;Ot=[],t.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var e=bn.slice(0),r=e.length;r;)e[--r]()}function hf(t){function e(){t(),bn.splice(bn.indexOf(e),1)}bn.push(e),++Mt,Nr(()=>{--Mt==0&&Gi()},[])}function pf(t){Ot.some(e=>e._value===t._value)||Ot.push(t)}function mf(t){for(var e=Ot.length;e;)if(Ot[--e]._value===t._value){Ot.splice(e,1);return}}function jn(t){return new I(Lr,!1,t)}function Z(t,e){var r=R;return function(){var n=zr(),i=R;try{return ut(r,!0),t.apply(this,arguments)}catch(s){e&&e(s)}finally{ut(i,!1),n&&Vr()}}}var _e={awaits:0,echoes:0,id:0},gf=0,An=[],Qi=0,Cn=0,yf=0;function lt(t,e,r,n){var i=R,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++yf;var o=nr.env;s.env=Ni?{Promise:I,PromiseProp:{value:I,configurable:!0,writable:!0},all:I.all,race:I.race,allSettled:I.allSettled,any:I.any,resolve:I.resolve,reject:I.reject,nthen:Lo(o.nthen,s),gthen:Lo(o.gthen,s)}:{},e&&je(s,e),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=sr(s,t,r,n);return s.ref===0&&s.finalize(),a}function ir(){return _e.id||(_e.id=++gf),++_e.awaits,_e.echoes+=Do,_e.id}function Qe(){return _e.awaits?(--_e.awaits==0&&(_e.id=0),_e.echoes=_e.awaits*Do,!0):!1}(""+To).indexOf("[native code]")===-1&&(ir=Qe=Y);function Fn(t){return _e.echoes&&t&&t.constructor===vn?(ir(),t.then(e=>(Qe(),e),e=>(Qe(),le(e)))):t}function vf(t){++Cn,(!_e.echoes||--_e.echoes==0)&&(_e.echoes=_e.id=0),An.push(R),ut(t,!0)}function _f(){var t=An[An.length-1];An.pop(),ut(t,!1)}function ut(t,e){var r=R;if((e?_e.echoes&&(!Qi++||t!==R):Qi&&(!--Qi||t!==R))&&Bo(e?vf.bind(null,t):_f),t!==R&&(R=t,r===nr&&(nr.env=Ro()),Ni)){var n=nr.env.Promise,i=t.env;yn.then=i.nthen,n.prototype.then=i.gthen,(r.global||t.global)&&(Object.defineProperty(J,"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 Ro(){var t=J.Promise;return Ni?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(J,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:yn.then,gthen:t.prototype.then}:{}}function sr(t,e,r,n,i){var s=R;try{return ut(t,!0),e(r,n,i)}finally{ut(s,!1)}}function Bo(t){To.call(Bi,t)}function Sn(t,e,r,n){return typeof t!="function"?t:function(){var i=R;r&&ir(),ut(e,!0);try{return t.apply(this,arguments)}finally{ut(i,!1),n&&Bo(Qe)}}}function Lo(t,e){return function(r,n){return t.call(this,Sn(r,e),Sn(n,e))}}var No="unhandledrejection";function Ko(t,e){var r;try{r=e.onuncatched(t)}catch{}if(r!==!1)try{var n,i={promise:e,reason:t};if(J.document&&document.createEvent?(n=document.createEvent("Event"),n.initEvent(No,!0,!0),je(n,i)):J.CustomEvent&&(n=new CustomEvent(No,{detail:i}),je(n,i)),n&&J.dispatchEvent&&(dispatchEvent(n),!J.PromiseRejectionEvent&&J.onunhandledrejection))try{J.onunhandledrejection(n)}catch{}Ke&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var le=I.reject;function qi(t,e,r,n){if(!t.idbdb||!t._state.openComplete&&!R.letThrough&&!t._vip){if(t._state.openComplete)return le(new L.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return le(new L.DatabaseClosed);t.open().catch(Y)}return t._state.dbReadyPromise.then(()=>qi(t,e,r,n))}else{var i=t._createTransaction(e,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(s){return s.name===Pi.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>qi(t,e,r,n))):le(s)}return i._promise(e,(s,o)=>lt(()=>(R.trans=i,n(s,o,i)))).then(s=>i._completion.then(()=>s))}}var zo="3.2.2",Pt=String.fromCharCode(65535),Yi=-1/0,qe="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Vo="String expected.",$r=[],En=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),xf=En,bf=En,$o=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Dn="__dbnames",Ji="readonly",Xi="readwrite";function Rt(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}var Ho={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Tn(t){return typeof t=="string"&&!/\./.test(t)?e=>(e[t]===void 0&&t in e&&(e=Pr(e),delete e[t]),e):e=>e}var Wo=class{_trans(e,r,n){let i=this._tx||R.trans,s=this.name;function o(l,u,c){if(!c.schema[s])throw new L.NotFound("Table "+s+" not part of transaction");return r(c.idbtrans,c)}let a=zr();try{return i&&i.db===this.db?i===R.trans?i._promise(e,o,n):lt(()=>i._promise(e,o,n),{trans:i,transless:R.transless||R}):qi(this.db,e,[this.name],o)}finally{a&&Vr()}}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(ve(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let r=oe(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(u=>u.compound&&r.every(c=>u.keyPath.indexOf(c)>=0)&&u.keyPath.every(c=>r.indexOf(c)>=0))[0];if(n&&this.db._maxKey!==Pt)return this.where(n.name).equals(n.keyPath.map(u=>e[u]));!n&&Ke&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${r.join("+")}]`);let{idxByName:i}=this.schema,s=this.db._deps.indexedDB;function o(u,c){try{return s.cmp(u,c)===0}catch{return!1}}let[a,l]=r.reduce(([u,c],d)=>{let f=i[d],y=e[d];return[u||f,u||!f?Rt(c,f&&f.multi?w=>{let b=Ue(w,d);return ve(b)&&b.some(x=>o(y,x))}:w=>o(y,Ue(w,d))):c]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(l):n?this.filter(l):this.where(r).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,ve(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 s in n)if(Ie(n,s))try{i[s]=n[s]}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){je(this,r)}return this.mapToClass(e)}add(e,r){let{auto:n,keyPath:i}=this.schema.primKey,s=e;return i&&n&&(s=Tn(i)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"add",keys:r!=null?[r]:null,values:[s]})).then(o=>o.numFailures?I.reject(o.failures[0]):o.lastResult).then(o=>{if(i)try{Be(e,i,o)}catch{}return o})}update(e,r){if(typeof e=="object"&&!ve(e)){let n=Ue(e,this.schema.primKey.keyPath);if(n===void 0)return le(new L.InvalidArgument("Given object does not contain its primary key"));try{typeof r!="function"?oe(r).forEach(i=>{Be(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,s=e;return i&&n&&(s=Tn(i)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"put",values:[s],keys:r!=null?[r]:null})).then(o=>o.numFailures?I.reject(o.failures[0]):o.lastResult).then(o=>{if(i)try{Be(e,i,o)}catch{}return o})}delete(e){return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:[e]})).then(r=>r.numFailures?I.reject(r.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:Ho})).then(e=>e.numFailures?I.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 s=n?n.allKeys:void 0;return this._trans("readwrite",o=>{let{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new L.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new L.InvalidArgument("Arguments objects and keys must have the same length");let u=e.length,c=l&&a?e.map(Tn(l)):e;return this.core.mutate({trans:o,type:"add",keys:i,values:c,wantResults:s}).then(({numFailures:d,results:f,lastResult:y,failures:w})=>{let b=s?f:y;if(d===0)return b;throw new Rr(`${this.name}.bulkAdd(): ${d} of ${u} operations failed`,w)})})}bulkPut(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let s=n?n.allKeys:void 0;return this._trans("readwrite",o=>{let{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new L.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new L.InvalidArgument("Arguments objects and keys must have the same length");let u=e.length,c=l&&a?e.map(Tn(l)):e;return this.core.mutate({trans:o,type:"put",keys:i,values:c,wantResults:s}).then(({numFailures:d,results:f,lastResult:y,failures:w})=>{let b=s?f:y;if(d===0)return b;throw new Rr(`${this.name}.bulkPut(): ${d} of ${u} 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:s})=>{if(n===0)return i;throw new Rr(`${this.name}.bulkDelete(): ${n} of ${r} operations failed`,s)})}};function Hr(t){var e={},r=function(a,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return e[a].subscribe.apply(null,c),t}else if(typeof a=="string")return e[a]};r.addEventType=s;for(var n=1,i=arguments.length;n<i;++n)s(arguments[n]);return r;function s(a,l,u){if(typeof a=="object")return o(a);l||(l=lf),u||(u=Y);var c={subscribers:[],fire:u,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=l(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(f){return f!==d}),c.fire=c.subscribers.reduce(l,u)}};return e[a]=r[a]=c,c}function o(a){oe(a).forEach(function(l){var u=a[l];if(ve(u))s(l,a[l][0],a[l][1]);else if(u==="asap")var c=s(l,Br,function(){for(var f=arguments.length,y=new Array(f);f--;)y[f]=arguments[f];c.subscribers.forEach(function(w){_o(function(){w.apply(null,y)})})});else throw new L.InvalidArgument("Invalid event config")})}}function Wr(t,e){return er(e).from({prototype:t}),e}function wf(t){return Wr(Wo.prototype,function(r,n,i){this.db=t,this._tx=i,this.name=r,this.schema=n,this.hook=t._allTables[r]?t._allTables[r].hook:Hr(null,{creating:[sf,Y],reading:[nf,Br],updating:[af,Y],deleting:[of,Y]})})}function or(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function Zi(t,e){t.filter=Rt(t.filter,e)}function es(t,e,r){var n=t.replayFilter;t.replayFilter=n?()=>Rt(n(),e()):e,t.justLimit=r&&!n}function jf(t,e){t.isMatch=Rt(t.isMatch,e)}function kn(t,e){if(t.isPrimKey)return e.primaryKey;let r=e.getIndexByKeyPath(t.index);if(!r)throw new L.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return r}function Uo(t,e,r){let n=kn(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 In(t,e,r,n){let i=t.replayFilter?Rt(t.filter,t.replayFilter()):t.filter;if(t.or){let s={},o=(a,l,u)=>{if(!i||i(l,u,f=>l.stop(f),f=>l.fail(f))){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),Ie(s,d)||(s[d]=!0,e(a,l,u))}};return Promise.all([t.or._iterate(o,r),Go(Uo(t,n,r),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}else return Go(Uo(t,n,r),Rt(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function Go(t,e,r,n){var i=n?(o,a,l)=>r(n(o),a,l):r,s=Z(i);return t.then(o=>{if(o)return o.start(()=>{var a=()=>o.continue();(!e||e(o,l=>a=l,l=>{o.stop(l),a=Y},l=>{o.fail(l),a=Y}))&&s(o.value,o,l=>a=l),a()})})}function Ae(t,e){try{let r=Qo(t),n=Qo(e);if(r!==n)return r==="Array"?1:n==="Array"?-1:r==="binary"?1:n==="binary"?-1:r==="string"?1:n==="string"?-1:r==="Date"?1:n!=="Date"?NaN:-1;switch(r){case"number":case"Date":case"string":return t>e?1:t<e?-1:0;case"binary":return Cf(qo(t),qo(e));case"Array":return Af(t,e)}}catch{}return NaN}function Af(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let s=0;s<i;++s){let o=Ae(t[s],e[s]);if(o!==0)return o}return r===n?0:r<n?-1:1}function Cf(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let s=0;s<i;++s)if(t[s]!==e[s])return t[s]<e[s]?-1:1;return r===n?0:r<n?-1:1}function Qo(t){let e=typeof t;if(e!=="object")return e;if(ArrayBuffer.isView(t))return"binary";let r=Ti(t);return r==="ArrayBuffer"?"binary":r}function qo(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}var Yo=class{_read(e,r){var n=this._ctx;return n.error?n.table._trans(null,le.bind(null,n.error)):n.table._trans("readonly",e).then(r)}_write(e){var r=this._ctx;return r.error?r.table._trans(null,le.bind(null,r.error)):r.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var r=this._ctx;r.algorithm=Rt(r.algorithm,e)}_iterate(e,r){return In(this._ctx,e,r,this._ctx.table.core)}clone(e){var r=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&je(n,e),r._ctx=n,r}raw(){return this._ctx.valueMapper=null,this}each(e){var r=this._ctx;return this._read(n=>In(r,e,n,r.table.core))}count(e){return this._read(r=>{let n=this._ctx,i=n.table.core;if(or(n,!0))return i.count({trans:r,query:{index:kn(n,i.schema),range:n.range}}).then(o=>Math.min(o,n.limit));var s=0;return In(n,()=>(++s,!1),r,i).then(()=>s)}).then(e)}sortBy(e,r){let n=e.split(".").reverse(),i=n[0],s=n.length-1;function o(u,c){return c?o(u[n[c]],c-1):u[i]}var a=this._ctx.dir==="next"?1:-1;function l(u,c){var d=o(u,s),f=o(c,s);return d<f?-a:d>f?a:0}return this.toArray(function(u){return u.sort(l)}).then(r)}toArray(e){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&or(n,!0)&&n.limit>0){let{valueMapper:i}=n,s=kn(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:s,range:n.range}}).then(({result:o})=>i?o.map(i):o)}else{let i=[];return In(n,s=>i.push(s),r,n.table.core).then(()=>i)}},e)}offset(e){var r=this._ctx;return e<=0?this:(r.offset+=e,or(r)?es(r,()=>{var n=e;return(i,s)=>n===0?!0:n===1?(--n,!1):(s(()=>{i.advance(n),n=0}),!1)}):es(r,()=>{var n=e;return()=>--n<0}),this)}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),es(this._ctx,()=>{var r=e;return function(n,i,s){return--r<=0&&i(s),r>=0}},!0),this}until(e,r){return Zi(this._ctx,function(n,i,s){return e(n.value)?(i(s),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 Zi(this._ctx,function(r){return e(r.value)}),jf(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,s){n.push(s.key)}).then(function(){return n}).then(e)}primaryKeys(e){var r=this._ctx;if(r.dir==="next"&&or(r,!0)&&r.limit>0)return this._read(i=>{var s=kn(r,r.table.core.schema);return r.table.core.query({trans:i,values:!1,limit:r.limit,query:{index:s,range:r.range}})}).then(({result:i})=>i).then(e);r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,s){n.push(s.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 Zi(this._ctx,function(i){var s=i.primaryKey.toString(),o=Ie(n,s);return n[s]=!0,!o}),this}modify(e){var r=this._ctx;return this._write(n=>{var i;if(typeof e=="function")i=e;else{var s=oe(e),o=s.length;i=function(b){for(var x=!1,h=0;h<o;++h){var v=s[h],p=e[v];Ue(b,v)!==p&&(Be(b,v,p),x=!0)}return x}}let a=r.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,d=[],f=0,y=[],w=(b,x)=>{let{failures:h,numFailures:v}=x;f+=b-v;for(let p of oe(h))d.push(h[p])};return this.clone().primaryKeys().then(b=>{let x=h=>{let v=Math.min(c,b.length-h);return a.getMany({trans:n,keys:b.slice(h,h+v),cache:"immutable"}).then(p=>{let m=[],_=[],g=l?[]:null,j=[];for(let C=0;C<v;++C){let F=p[C],D={value:Pr(F),primKey:b[h+C]};i.call(D,D.value,D)!==!1&&(D.value==null?j.push(b[h+C]):!l&&Ae(u(F),u(D.value))!==0?(j.push(b[h+C]),m.push(D.value)):(_.push(D.value),l&&g.push(b[h+C])))}let A=or(r)&&r.limit===1/0&&(typeof e!="function"||e===ts)&&{index:r.index,range:r.range};return Promise.resolve(m.length>0&&a.mutate({trans:n,type:"add",values:m}).then(C=>{for(let F in C.failures)j.splice(parseInt(F),1);w(m.length,C)})).then(()=>(_.length>0||A&&typeof e=="object")&&a.mutate({trans:n,type:"put",keys:g,values:_,criteria:A,changeSpec:typeof e!="function"&&e}).then(C=>w(_.length,C))).then(()=>(j.length>0||A&&e===ts)&&a.mutate({trans:n,type:"delete",keys:j,criteria:A}).then(C=>w(j.length,C))).then(()=>b.length>h+v&&x(h+c))})};return x(0).then(()=>{if(d.length>0)throw new mn("Error modifying one or more objects",d,f,y);return b.length})})})}delete(){var e=this._ctx,r=e.range;return or(e)&&(e.isPrimKey&&!bf||r.type===3)?this._write(n=>{let{primaryKey:i}=e.table.core.schema,s=r;return e.table.core.count({trans:n,query:{index:i,range:s}}).then(o=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then(({failures:a,lastResult:l,results:u,numFailures:c})=>{if(c)throw new mn("Could not delete some values",Object.keys(a).map(d=>a[d]),o-c);return o-c}))}):this.modify(ts)}},ts=(t,e)=>e.value=null;function Ff(t){return Wr(Yo.prototype,function(r,n){this.db=t;let i=Ho,s=null;if(n)try{i=n()}catch(u){s=u}let o=r._ctx,a=o.table,l=a.hook.reading.fire;this._ctx={table:a,index:o.index,isPrimKey:!o.index||a.schema.primKey.keyPath&&o.index===a.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:s,or:o.or,valueMapper:l!==Br?l:null}})}function Sf(t,e){return t<e?-1:t===e?0:1}function Ef(t,e){return t>e?-1:t===e?0:1}function Oe(t,e,r){var n=t instanceof rs?new t.Collection(t):t;return n._ctx.error=r?new r(e):new TypeError(e),n}function ar(t){return new t.Collection(t,()=>Jo("")).limit(0)}function Df(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function Tf(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function kf(t,e,r,n,i,s){for(var o=Math.min(t.length,n.length),a=-1,l=0;l<o;++l){var u=e[l];if(u!==n[l])return i(t[l],r[l])<0?t.substr(0,l)+r[l]+r.substr(l+1):i(t[l],n[l])<0?t.substr(0,l)+n[l]+r.substr(l+1):a>=0?t.substr(0,a)+e[a]+r.substr(a+1):null;i(t[l],u)<0&&(a=l)}return o<n.length&&s==="next"?t+r.substr(t.length):o<t.length&&s==="prev"?t.substr(0,r.length):a<0?null:t.substr(0,a)+n[a]+r.substr(a+1)}function On(t,e,r,n){var i,s,o,a,l,u,c,d=r.length;if(!r.every(b=>typeof b=="string"))return Oe(t,Vo);function f(b){i=Df(b),s=Tf(b),o=b==="next"?Sf:Ef;var x=r.map(function(h){return{lower:s(h),upper:i(h)}}).sort(function(h,v){return o(h.lower,v.lower)});a=x.map(function(h){return h.upper}),l=x.map(function(h){return h.lower}),u=b,c=b==="next"?"":n}f("next");var y=new t.Collection(t,()=>ct(a[0],l[d-1]+n));y._ondirectionchange=function(b){f(b)};var w=0;return y._addAlgorithm(function(b,x,h){var v=b.key;if(typeof v!="string")return!1;var p=s(v);if(e(p,l,w))return!0;for(var m=null,_=w;_<d;++_){var g=kf(v,p,a[_],l[_],o,u);g===null&&m===null?w=_+1:(m===null||o(m,g)>0)&&(m=g)}return x(m!==null?function(){b.continue(m+c)}:h),!1}),y}function ct(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function Jo(t){return{type:1,lower:t,upper:t}}var rs=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)?ar(this):new this.Collection(this,()=>ct(e,r,!n,!i))}catch{return Oe(this,qe)}}equals(e){return e==null?Oe(this,qe):new this.Collection(this,()=>Jo(e))}above(e){return e==null?Oe(this,qe):new this.Collection(this,()=>ct(e,void 0,!0))}aboveOrEqual(e){return e==null?Oe(this,qe):new this.Collection(this,()=>ct(e,void 0,!1))}below(e){return e==null?Oe(this,qe):new this.Collection(this,()=>ct(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Oe(this,qe):new this.Collection(this,()=>ct(void 0,e))}startsWith(e){return typeof e!="string"?Oe(this,Vo):this.between(e,e+Pt,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):On(this,(r,n)=>r.indexOf(n[0])===0,[e],Pt)}equalsIgnoreCase(e){return On(this,(r,n)=>r===n[0],[e],"")}anyOfIgnoreCase(){var e=Ge.apply(tr,arguments);return e.length===0?ar(this):On(this,(r,n)=>n.indexOf(r)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=Ge.apply(tr,arguments);return e.length===0?ar(this):On(this,(r,n)=>n.some(i=>r.indexOf(i)===0),e,Pt)}anyOf(){let e=Ge.apply(tr,arguments),r=this._cmp;try{e.sort(r)}catch{return Oe(this,qe)}if(e.length===0)return ar(this);let n=new this.Collection(this,()=>ct(e[0],e[e.length-1]));n._ondirectionchange=s=>{r=s==="next"?this._ascending:this._descending,e.sort(r)};let i=0;return n._addAlgorithm((s,o,a)=>{let l=s.key;for(;r(l,e[i])>0;)if(++i,i===e.length)return o(a),!1;return r(l,e[i])===0?!0:(o(()=>{s.continue(e[i])}),!1)}),n}notEqual(e){return this.inAnyRange([[Yi,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=Ge.apply(tr,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Oe(this,qe)}let r=e.reduce((n,i)=>n?n.concat([[n[n.length-1][1],i]]):[[Yi,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,s=this._descending,o=this._min,a=this._max;if(e.length===0)return ar(this);if(!e.every(m=>m[0]!==void 0&&m[1]!==void 0&&i(m[0],m[1])<=0))return Oe(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",L.InvalidArgument);let l=!r||r.includeLowers!==!1,u=r&&r.includeUppers===!0;function c(m,_){let g=0,j=m.length;for(;g<j;++g){let A=m[g];if(n(_[0],A[1])<0&&n(_[1],A[0])>0){A[0]=o(A[0],_[0]),A[1]=a(A[1],_[1]);break}}return g===j&&m.push(_),m}let d=i;function f(m,_){return d(m[0],_[0])}let y;try{y=e.reduce(c,[]),y.sort(f)}catch{return Oe(this,qe)}let w=0,b=u?m=>i(m,y[w][1])>0:m=>i(m,y[w][1])>=0,x=l?m=>s(m,y[w][0])>0:m=>s(m,y[w][0])>=0;function h(m){return!b(m)&&!x(m)}let v=b,p=new this.Collection(this,()=>ct(y[0][0],y[y.length-1][1],!l,!u));return p._ondirectionchange=m=>{m==="next"?(v=b,d=i):(v=x,d=s),y.sort(f)},p._addAlgorithm((m,_,g)=>{for(var j=m.key;v(j);)if(++w,w===y.length)return _(g),!1;return h(j)?!0:(this._cmp(j,y[w][1])===0||this._cmp(j,y[w][0])===0||_(()=>{d===i?m.continue(y[w][0]):m.continue(y[w][1])}),!1)}),p}startsWithAnyOf(){let e=Ge.apply(tr,arguments);return e.every(r=>typeof r=="string")?e.length===0?ar(this):this.inAnyRange(e.map(r=>[r,r+Pt])):Oe(this,"startsWithAnyOf() only works with strings")}};function If(t){return Wr(rs.prototype,function(r,n,i){this.db=t,this._ctx={table:r,index:n===":id"?null:n,or:i};let s=t._deps.indexedDB;if(!s)throw new L.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(o,a)=>s.cmp(a,o),this._max=(o,a)=>s.cmp(o,a)>0?o:a,this._min=(o,a)=>s.cmp(o,a)<0?o:a,this._IDBKeyRange=t._deps.IDBKeyRange})}function ze(t){return Z(function(e){return Ur(e),t(e.target.error),!1})}function Ur(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}var Gr="storagemutated",ft="x-storagemutated-1",dt=Hr(null,Gr),Xo=class{_lock(){return Mr(!R.global),++this._reculock,this._reculock===1&&!R.global&&(R.lockOwnerFor=this),this}_unlock(){if(Mr(!R.global),--this._reculock==0)for(R.global||(R.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{sr(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&R.lockOwnerFor!==this}create(e){if(!this.mode)return this;let r=this.db.idbdb,n=this.db._state.dbOpenError;if(Mr(!this.idbtrans),!e&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new L.DatabaseClosed(n);case"MissingAPIError":throw new L.MissingAPI(n.message,n);default:throw new L.OpenFailed(n)}if(!this.active)throw new L.TransactionInactive;return Mr(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=Z(i=>{Ur(i),this._reject(e.error)}),e.onabort=Z(i=>{Ur(i),this.active&&this._reject(new L.Abort(e.error)),this.active=!1,this.on("abort").fire(i)}),e.oncomplete=Z(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&dt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,r,n){if(e==="readwrite"&&this.mode!=="readwrite")return le(new L.ReadOnly("Transaction is readonly"));if(!this.active)return le(new L.TransactionInactive);if(this._locked())return new I((s,o)=>{this._blockedFuncs.push([()=>{this._promise(e,r,n).then(s,o)},R])});if(n)return lt(()=>{var s=new I((o,a)=>{this._lock();let l=r(o,a,this);l&&l.then&&l.then(o,a)});return s.finally(()=>this._unlock()),s._lib=!0,s});var i=new I((s,o)=>{var a=r(s,o,this);a&&a.then&&a.then(s,o)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(e){var r=this._root();let n=I.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 o(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(i.get(-1/0).onsuccess=o)})()}var s=r._waitingFor;return new I((o,a)=>{n.then(l=>r._waitingQueue.push(Z(o.bind(null,l))),l=>r._waitingQueue.push(Z(a.bind(null,l)))).finally(()=>{r._waitingFor===s&&(r._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new L.Abort))}table(e){let r=this._memoizedTables||(this._memoizedTables={});if(Ie(r,e))return r[e];let n=this.schema[e];if(!n)throw new L.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}};function Of(t){return Wr(Xo.prototype,function(r,n,i,s,o){this.db=t,this.mode=r,this.storeNames=n,this.schema=i,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Hr(this,"complete","error","abort"),this.parent=o||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 I((a,l)=>{this._resolve=a,this._reject=l}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},a=>{var l=this.active;return this.active=!1,this.on.error.fire(a),this.parent?this.parent._reject(a):l&&this.idbtrans&&this.idbtrans.abort(),le(a)})})}function ns(t,e,r,n,i,s,o){return{name:t,keyPath:e,unique:r,multi:n,auto:i,compound:s,src:(r&&!o?"&":"")+(n?"*":"")+(i?"++":"")+Zo(e)}}function Zo(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function ea(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:xo(r,n=>[n.name,n])}}function Mf(t){return t.length===1?t[0]:t}var Qr=t=>{try{return t.only([[]]),Qr=()=>[[]],[[]]}catch{return Qr=()=>Pt,Pt}};function is(t){return t==null?()=>{}:typeof t=="string"?Pf(t):e=>Ue(e,t)}function Pf(t){return t.split(".").length===1?r=>r[t]:r=>Ue(r,t)}function ta(t){return[].slice.call(t)}var Rf=0;function qr(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Bf(t,e,r){function n(c,d){let f=ta(c.objectStoreNames);return{schema:{name:c.name,tables:f.map(y=>d.objectStore(y)).map(y=>{let{keyPath:w,autoIncrement:b}=y,x=ve(w),h=w==null,v={},p={name:y.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:h,compound:x,keyPath:w,autoIncrement:b,unique:!0,extractKey:is(w)},indexes:ta(y.indexNames).map(m=>y.index(m)).map(m=>{let{name:_,unique:g,multiEntry:j,keyPath:A}=m,C=ve(A),F={name:_,compound:C,keyPath:A,unique:g,multiEntry:j,extractKey:is(A)};return v[qr(A)]=F,F}),getIndexByKeyPath:m=>v[qr(m)]};return v[":id"]=p.primaryKey,w!=null&&(v[qr(w)]=p.primaryKey),p})},hasGetAll:f.length>0&&"getAll"in d.objectStore(f[0])&&!(typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(c){if(c.type===3)return null;if(c.type===4)throw new Error("Cannot convert never type to IDBKeyRange");let{lower:d,upper:f,lowerOpen:y,upperOpen:w}=c;return d===void 0?f===void 0?null:e.upperBound(f,!!w):f===void 0?e.lowerBound(d,!!y):e.bound(d,f,!!y,!!w)}function s(c){let d=c.name;function f({trans:b,type:x,keys:h,values:v,range:p}){return new Promise((m,_)=>{m=Z(m);let g=b.objectStore(d),j=g.keyPath==null,A=x==="put"||x==="add";if(!A&&x!=="delete"&&x!=="deleteRange")throw new Error("Invalid operation type: "+x);let{length:C}=h||v||{length:1};if(h&&v&&h.length!==v.length)throw new Error("Given keys array must have same length as given values array.");if(C===0)return m({numFailures:0,failures:{},results:[],lastResult:void 0});let F,D=[],P=[],T=0,N=M=>{++T,Ur(M)};if(x==="deleteRange"){if(p.type===4)return m({numFailures:T,failures:P,results:[],lastResult:void 0});p.type===3?D.push(F=g.clear()):D.push(F=g.delete(i(p)))}else{let[M,S]=A?j?[v,h]:[v,null]:[h,null];if(A)for(let V=0;V<C;++V)D.push(F=S&&S[V]!==void 0?g[x](M[V],S[V]):g[x](M[V])),F.onerror=N;else for(let V=0;V<C;++V)D.push(F=g[x](M[V])),F.onerror=N}let $=M=>{let S=M.target.result;D.forEach((V,te)=>V.error!=null&&(P[te]=V.error)),m({numFailures:T,failures:P,results:x==="delete"?h:D.map(V=>V.result),lastResult:S})};F.onerror=M=>{N(M),$(M)},F.onsuccess=$})}function y({trans:b,values:x,query:h,reverse:v,unique:p}){return new Promise((m,_)=>{m=Z(m);let{index:g,range:j}=h,A=b.objectStore(d),C=g.isPrimaryKey?A:A.index(g.name),F=v?p?"prevunique":"prev":p?"nextunique":"next",D=x||!("openKeyCursor"in C)?C.openCursor(i(j),F):C.openKeyCursor(i(j),F);D.onerror=ze(_),D.onsuccess=Z(P=>{let T=D.result;if(!T){m(null);return}T.___id=++Rf,T.done=!1;let N=T.continue.bind(T),$=T.continuePrimaryKey;$&&($=$.bind(T));let M=T.advance.bind(T),S=()=>{throw new Error("Cursor not started")},V=()=>{throw new Error("Cursor not stopped")};T.trans=b,T.stop=T.continue=T.continuePrimaryKey=T.advance=S,T.fail=Z(_),T.next=function(){let te=1;return this.start(()=>te--?this.continue():this.stop()).then(()=>this)},T.start=te=>{let Wt=new Promise((st,to)=>{st=Z(st),D.onerror=ze(to),T.fail=to,T.stop=Cc=>{T.stop=T.continue=T.continuePrimaryKey=T.advance=V,st(Cc)}}),it=()=>{if(D.result)try{te()}catch(st){T.fail(st)}else T.done=!0,T.start=()=>{throw new Error("Cursor behind last entry")},T.stop()};return D.onsuccess=Z(st=>{D.onsuccess=it,it()}),T.continue=N,T.continuePrimaryKey=$,T.advance=M,it(),Wt},m(T)},_)})}function w(b){return x=>new Promise((h,v)=>{h=Z(h);let{trans:p,values:m,limit:_,query:g}=x,j=_===1/0?void 0:_,{index:A,range:C}=g,F=p.objectStore(d),D=A.isPrimaryKey?F:F.index(A.name),P=i(C);if(_===0)return h({result:[]});if(b){let T=m?D.getAll(P,j):D.getAllKeys(P,j);T.onsuccess=N=>h({result:N.target.result}),T.onerror=ze(v)}else{let T=0,N=m||!("openKeyCursor"in D)?D.openCursor(P):D.openKeyCursor(P),$=[];N.onsuccess=M=>{let S=N.result;if(!S)return h({result:$});if($.push(m?S.value:S.primaryKey),++T===_)return h({result:$});S.continue()},N.onerror=ze(v)}})}return{name:d,schema:c,mutate:f,getMany({trans:b,keys:x}){return new Promise((h,v)=>{h=Z(h);let p=b.objectStore(d),m=x.length,_=new Array(m),g=0,j=0,A,C=D=>{let P=D.target;(_[P._pos]=P.result)!=null,++j===g&&h(_)},F=ze(v);for(let D=0;D<m;++D)x[D]!=null&&(A=p.get(x[D]),A._pos=D,A.onsuccess=C,A.onerror=F,++g);g===0&&h(_)})},get({trans:b,key:x}){return new Promise((h,v)=>{h=Z(h);let m=b.objectStore(d).get(x);m.onsuccess=_=>h(_.target.result),m.onerror=ze(v)})},query:w(a),openCursor:y,count({query:b,trans:x}){let{index:h,range:v}=b;return new Promise((p,m)=>{let _=x.objectStore(d),g=h.isPrimaryKey?_:_.index(h.name),j=i(v),A=j?g.count(j):g.count();A.onsuccess=Z(C=>p(C.target.result)),A.onerror=ze(m)})}}}let{schema:o,hasGetAll:a}=n(t,r),l=o.tables.map(c=>s(c)),u={};return l.forEach(c=>u[c.name]=c),{stack:"dbcore",transaction:t.transaction.bind(t),table(c){if(!u[c])throw new Error(`Table '${c}' not found`);return u[c]},MIN_KEY:-1/0,MAX_KEY:Qr(e),schema:o}}function Lf(t,e){return e.reduce((r,{create:n})=>re(re({},r),n(r)),t)}function Nf(t,e,{IDBKeyRange:r,indexedDB:n},i){return{dbcore:Lf(Bf(e,r,i),t.dbcore)}}function ss({_novip:t},e){let r=e.db,n=Nf(t._middlewares,r,t._deps,e);t.core=n.dbcore,t.tables.forEach(i=>{let s=i.name;t.core.schema.tables.some(o=>o.name===s)&&(i.core=t.core.table(s),t[s]instanceof t.Table&&(t[s].core=i.core))})}function Mn({_novip:t},e,r,n){r.forEach(i=>{let s=n[i];e.forEach(o=>{let a=Ei(o,i);(!a||"value"in a&&a.value===void 0)&&(o===t.Transaction.prototype||o instanceof t.Transaction?We(o,i,{get(){return this.table(i)},set(l){yo(this,i,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):o[i]=new t.Table(i,s))})})}function os({_novip:t},e){e.forEach(r=>{for(let n in r)r[n]instanceof t.Table&&delete r[n]})}function Kf(t,e){return t._cfg.version-e._cfg.version}function zf(t,e,r,n){let i=t._dbSchema,s=t._createTransaction("readwrite",t._storeNames,i);s.create(r),s._completion.catch(n);let o=s._reject.bind(s),a=R.transless||R;lt(()=>{R.trans=s,R.transless=a,e===0?(oe(i).forEach(l=>{as(r,l,i[l].primKey,i[l].indexes)}),ss(t,r),I.follow(()=>t.on.populate.fire(s)).catch(o)):Vf(t,e,s,r).catch(o)})}function Vf({_novip:t},e,r,n){let i=[],s=t._versions,o=t._dbSchema=us(t,t.idbdb,n),a=!1;s.filter(c=>c._cfg.version>=e).forEach(c=>{i.push(()=>{let d=o,f=c._cfg.dbschema;cs(t,d,n),cs(t,f,n),o=t._dbSchema=f;let y=ra(d,f);y.add.forEach(b=>{as(n,b[0],b[1].primKey,b[1].indexes)}),y.change.forEach(b=>{if(b.recreate)throw new L.Upgrade("Not yet support for changing primary key");{let x=n.objectStore(b.name);b.add.forEach(h=>ls(x,h)),b.change.forEach(h=>{x.deleteIndex(h.name),ls(x,h)}),b.del.forEach(h=>x.deleteIndex(h))}});let w=c._cfg.contentUpgrade;if(w&&c._cfg.version>e){ss(t,n),r._memoizedTables={},a=!0;let b=bo(f);y.del.forEach(p=>{b[p]=d[p]}),os(t,[t.Transaction.prototype]),Mn(t,[t.Transaction.prototype],oe(b),b),r.schema=b;let x=Ii(w);x&&ir();let h,v=I.follow(()=>{if(h=w(r),h&&x){var p=Qe.bind(null,null);h.then(p,p)}});return h&&typeof h.then=="function"?I.resolve(h):v.then(()=>h)}}),i.push(d=>{if(!a||!xf){let f=c._cfg.dbschema;Hf(f,d)}os(t,[t.Transaction.prototype]),Mn(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema})});function u(){return i.length?I.resolve(i.shift()(r.idbtrans)).then(u):I.resolve()}return u().then(()=>{$f(o,n)})}function ra(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],s=e[n];if(!i)r.add.push([n,s]);else{let o={name:n,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||i.primKey.auto!==s.primKey.auto&&!En)o.recreate=!0,r.change.push(o);else{let a=i.idxByName,l=s.idxByName,u;for(u in a)l[u]||o.del.push(u);for(u in l){let c=a[u],d=l[u];c?c.src!==d.src&&o.change.push(d):o.add.push(d)}(o.del.length>0||o.add.length>0||o.change.length>0)&&r.change.push(o)}}}return r}function as(t,e,r,n){let i=t.db.createObjectStore(e,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(s=>ls(i,s)),i}function $f(t,e){oe(t).forEach(r=>{e.db.objectStoreNames.contains(r)||as(e,r,t[r].primKey,t[r].indexes)})}function Hf(t,e){[].slice.call(e.db.objectStoreNames).forEach(r=>t[r]==null&&e.db.deleteObjectStore(r))}function ls(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function us(t,e,r){let n={};return pn(e.objectStoreNames,0).forEach(s=>{let o=r.objectStore(s),a=o.keyPath,l=ns(Zo(a),a||"",!1,!1,!!o.autoIncrement,a&&typeof a!="string",!0),u=[];for(let d=0;d<o.indexNames.length;++d){let f=o.index(o.indexNames[d]);a=f.keyPath;var c=ns(f.name,a,!!f.unique,!!f.multiEntry,!1,a&&typeof a!="string",!1);u.push(c)}n[s]=ea(s,l,u)}),n}function Wf({_novip:t},e,r){t.verno=e.version/10;let n=t._dbSchema=us(t,e,r);t._storeNames=pn(e.objectStoreNames,0),Mn(t,[t._allTables],oe(n),n)}function Uf(t,e){let r=us(t,t.idbdb,e),n=ra(r,t._dbSchema);return!(n.add.length||n.change.some(i=>i.add.length||i.change.length))}function cs({_novip:t},e,r){let n=r.db.objectStoreNames;for(let i=0;i<n.length;++i){let s=n[i],o=r.objectStore(s);t._hasGetAll="getAll"in o;for(let a=0;a<o.indexNames.length;++a){let l=o.indexNames[a],u=o.index(l).keyPath,c=typeof u=="string"?u:"["+pn(u).join("+")+"]";if(e[s]){let d=e[s].idxByName[c];d&&(d.name=l,delete e[s].idxByName[c],e[s].idxByName[l]=d)}}}typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&J.WorkerGlobalScope&&J instanceof J.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}function Gf(t){return t.split(",").map((e,r)=>{e=e.trim();let n=e.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return ns(n,i||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),ve(i),r===0)})}var na=class{_parseStoresSpec(e,r){oe(e).forEach(n=>{if(e[n]!==null){var i=Gf(e[n]),s=i.shift();if(s.multi)throw new L.Schema("Primary key cannot be multi-valued");i.forEach(o=>{if(o.auto)throw new L.Schema("Only primary key can be marked as autoIncrement (++)");if(!o.keyPath)throw new L.Schema("Index must have a name and cannot be an empty string")}),r[n]=ea(n,s,i)}})}stores(e){let r=this.db;this._cfg.storesSource=this._cfg.storesSource?je(this._cfg.storesSource,e):e;let n=r._versions,i={},s={};return n.forEach(o=>{je(i,o._cfg.storesSource),s=o._cfg.dbschema={},o._parseStoresSpec(i,s)}),r._dbSchema=s,os(r,[r._allTables,r,r.Transaction.prototype]),Mn(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],oe(s),s),r._storeNames=oe(s),this}upgrade(e){return this._cfg.contentUpgrade=Ri(this._cfg.contentUpgrade||Y,e),this}};function Qf(t){return Wr(na.prototype,function(r){this.db=t,this._cfg={version:r,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function fs(t,e){let r=t._dbNamesDB;return r||(r=t._dbNamesDB=new Je(Dn,{addons:[],indexedDB:t,IDBKeyRange:e}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function ds(t){return t&&typeof t.databases=="function"}function qf({indexedDB:t,IDBKeyRange:e}){return ds(t)?Promise.resolve(t.databases()).then(r=>r.map(n=>n.name).filter(n=>n!==Dn)):fs(t,e).toCollection().primaryKeys()}function Yf({indexedDB:t,IDBKeyRange:e},r){!ds(t)&&r!==Dn&&fs(t,e).put({name:r}).catch(Y)}function Jf({indexedDB:t,IDBKeyRange:e},r){!ds(t)&&r!==Dn&&fs(t,e).delete(r).catch(Y)}function hs(t){return lt(function(){return R.letThrough=!0,t()})}function Xf(){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 Zf(t){let e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?le(e.dbOpenError):t);Ke&&(e.openCanceller._stackHolder=kt()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;let n=e.openCanceller;function i(){if(e.openCanceller!==n)throw new L.DatabaseClosed("db.open() was cancelled")}let s=e.dbReadyResolve,o=null,a=!1;return I.race([n,(typeof navigator=="undefined"?I.resolve():Xf()).then(()=>new I((l,u)=>{if(i(),!r)throw new L.MissingAPI;let c=t.name,d=e.autoSchema?r.open(c):r.open(c,Math.round(t.verno*10));if(!d)throw new L.MissingAPI;d.onerror=ze(u),d.onblocked=Z(t._fireOnBlocked),d.onupgradeneeded=Z(f=>{if(o=d.transaction,e.autoSchema&&!t._options.allowEmptyDB){d.onerror=Ur,o.abort(),d.result.close();let w=r.deleteDatabase(c);w.onsuccess=w.onerror=Z(()=>{u(new L.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{o.onerror=ze(u);var y=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;a=y<1,t._novip.idbdb=d.result,zf(t,y/10,o,u)}},u),d.onsuccess=Z(()=>{o=null;let f=t._novip.idbdb=d.result,y=pn(f.objectStoreNames);if(y.length>0)try{let w=f.transaction(Mf(y),"readonly");e.autoSchema?Wf(t,f,w):(cs(t,t._dbSchema,w),Uf(t,w)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),ss(t,w)}catch{}$r.push(t),f.onversionchange=Z(w=>{e.vcFired=!0,t.on("versionchange").fire(w)}),f.onclose=Z(w=>{t.on("close").fire(w)}),a&&Yf(t._deps,c),l()},u)}))]).then(()=>(i(),e.onReadyBeingFired=[],I.resolve(hs(()=>t.on.ready.fire(t.vip))).then(function l(){if(e.onReadyBeingFired.length>0){let u=e.onReadyBeingFired.reduce(Ri,Y);return e.onReadyBeingFired=[],I.resolve(hs(()=>u(t.vip))).then(l)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(l=>{e.dbOpenError=l;try{o&&o.abort()}catch{}return n===e.openCanceller&&t._close(),le(l)}).finally(()=>{e.openComplete=!0,s()})}function ps(t){var e=o=>t.next(o),r=o=>t.throw(o),n=s(e),i=s(r);function s(o){return a=>{var l=o(a),u=l.value;return l.done?u:!u||typeof u.then!="function"?ve(u)?Promise.all(u).then(n,i):n(u):u.then(n,i)}}return s(e)()}function ed(t,e,r){var n=arguments.length;if(n<2)throw new L.InvalidArgument("Too few arguments");for(var i=new Array(n-1);--n;)i[n-1]=arguments[n];r=i.pop();var s=wo(i);return[t,s,r]}function ia(t,e,r,n,i){return I.resolve().then(()=>{let s=R.transless||R,o=t._createTransaction(e,r,t._dbSchema,n),a={trans:o,transless:s};if(n)o.idbtrans=n.idbtrans;else try{o.create(),t._state.PR1398_maxLoop=3}catch(d){return d.name===Pi.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>ia(t,e,r,null,i))):le(d)}let l=Ii(i);l&&ir();let u,c=I.follow(()=>{if(u=i.call(o,o),u)if(l){var d=Qe.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=ps(u))},a);return(u&&typeof u.then=="function"?I.resolve(u).then(d=>o.active?d:le(new L.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>u)).then(d=>(n&&o._resolve(),o._completion.then(()=>d))).catch(d=>(o._reject(d),le(d)))})}function Pn(t,e,r){let n=ve(t)?t.slice():[t];for(let i=0;i<r;++i)n.push(e);return n}function td(t){return xe(re({},t),{table(e){let r=t.table(e),{schema:n}=r,i={},s=[];function o(f,y,w){let b=qr(f),x=i[b]=i[b]||[],h=f==null?0:typeof f=="string"?1:f.length,v=y>0,p=xe(re({},w),{isVirtual:v,keyTail:y,keyLength:h,extractKey:is(f),unique:!v&&w.unique});if(x.push(p),p.isPrimaryKey||s.push(p),h>1){let m=h===2?f[0]:f.slice(0,h-1);o(m,y+1,w)}return x.sort((m,_)=>m.keyTail-_.keyTail),p}let a=o(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[a];for(let f of n.indexes)o(f.keyPath,0,f);function l(f){let y=i[qr(f)];return y&&y[0]}function u(f,y){return{type:f.type===1?2:f.type,lower:Pn(f.lower,f.lowerOpen?t.MAX_KEY:t.MIN_KEY,y),lowerOpen:!0,upper:Pn(f.upper,f.upperOpen?t.MIN_KEY:t.MAX_KEY,y),upperOpen:!0}}function c(f){let y=f.query.index;return y.isVirtual?xe(re({},f),{query:{index:y,range:u(f.query.range,y.keyTail)}}):f}return xe(re({},r),{schema:xe(re({},n),{primaryKey:a,indexes:s,getIndexByKeyPath:l}),count(f){return r.count(c(f))},query(f){return r.query(c(f))},openCursor(f){let{keyTail:y,isVirtual:w,keyLength:b}=f.query.index;if(!w)return r.openCursor(f);function x(h){function v(m){m!=null?h.continue(Pn(m,f.reverse?t.MAX_KEY:t.MIN_KEY,y)):f.unique?h.continue(h.key.slice(0,b).concat(f.reverse?t.MIN_KEY:t.MAX_KEY,y)):h.continue()}return Object.create(h,{continue:{value:v},continuePrimaryKey:{value(m,_){h.continuePrimaryKey(Pn(m,t.MAX_KEY,y),_)}},primaryKey:{get(){return h.primaryKey}},key:{get(){let m=h.key;return b===1?m[0]:m.slice(0,b)}},value:{get(){return h.value}}})}return r.openCursor(c(f)).then(h=>h&&x(h))}})}})}var rd={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:td};function ms(t,e,r,n){return r=r||{},n=n||"",oe(t).forEach(i=>{if(!Ie(e,i))r[n+i]=void 0;else{var s=t[i],o=e[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){let a=Ti(s),l=Ti(o);a!==l?r[n+i]=e[i]:a==="Object"?ms(s,o,r,n+i+"."):s!==o&&(r[n+i]=e[i])}else s!==o&&(r[n+i]=e[i])}}),oe(e).forEach(i=>{Ie(t,i)||(r[n+i]=e[i])}),r}function nd(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}var id={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>xe(re({},t),{table(e){let r=t.table(e),{primaryKey:n}=r.schema;return xe(re({},r),{mutate(s){let o=R.trans,{deleting:a,creating:l,updating:u}=o.table(e).hook;switch(s.type){case"add":if(l.fire===Y)break;return o._promise("readwrite",()=>c(s),!0);case"put":if(l.fire===Y&&u.fire===Y)break;return o._promise("readwrite",()=>c(s),!0);case"delete":if(a.fire===Y)break;return o._promise("readwrite",()=>c(s),!0);case"deleteRange":if(a.fire===Y)break;return o._promise("readwrite",()=>d(s),!0)}return r.mutate(s);function c(y){let w=R.trans,b=y.keys||nd(n,y);if(!b)throw new Error("Keys missing");return y=y.type==="add"||y.type==="put"?xe(re({},y),{keys:b}):re({},y),y.type!=="delete"&&(y.values=[...y.values]),y.keys&&(y.keys=[...y.keys]),sd(r,y,b).then(x=>{let h=b.map((v,p)=>{let m=x[p],_={onerror:null,onsuccess:null};if(y.type==="delete")a.fire.call(_,v,m,w);else if(y.type==="add"||m===void 0){let g=l.fire.call(_,v,y.values[p],w);v==null&&g!=null&&(v=g,y.keys[p]=v,n.outbound||Be(y.values[p],n.keyPath,v))}else{let g=ms(m,y.values[p]),j=u.fire.call(_,g,v,m,w);if(j){let A=y.values[p];Object.keys(j).forEach(C=>{Ie(A,C)?A[C]=j[C]:Be(A,C,j[C])})}}return _});return r.mutate(y).then(({failures:v,results:p,numFailures:m,lastResult:_})=>{for(let g=0;g<b.length;++g){let j=p?p[g]:b[g],A=h[g];j==null?A.onerror&&A.onerror(v[g]):A.onsuccess&&A.onsuccess(y.type==="put"&&x[g]?y.values[g]:j)}return{failures:v,results:p,numFailures:m,lastResult:_}}).catch(v=>(h.forEach(p=>p.onerror&&p.onerror(v)),Promise.reject(v)))})}function d(y){return f(y.trans,y.range,1e4)}function f(y,w,b){return r.query({trans:y,values:!1,query:{index:n,range:w},limit:b}).then(({result:x})=>c({type:"delete",keys:x,trans:y}).then(h=>h.numFailures>0?Promise.reject(h.failures[0]):x.length<b?{failures:[],numFailures:0,lastResult:void 0}:f(y,xe(re({},w),{lower:x[x.length-1],lowerOpen:!0}),b)))}}})}})};function sd(t,e,r){return e.type==="add"?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}function sa(t,e,r){try{if(!e||e.keys.length<t.length)return null;let n=[];for(let i=0,s=0;i<e.keys.length&&s<t.length;++i)Ae(e.keys[i],t[s])===0&&(n.push(r?Pr(e.values[i]):e.values[i]),++s);return n.length===t.length?n:null}catch{return null}}var od={stack:"dbcore",level:-1,create:t=>({table:e=>{let r=t.table(e);return xe(re({},r),{getMany:n=>{if(!n.cache)return r.getMany(n);let i=sa(n.keys,n.trans._cache,n.cache==="clone");return i?I.resolve(i):r.getMany(n).then(s=>(n.trans._cache={keys:n.keys,values:n.cache==="clone"?Pr(s):s},s))},mutate:n=>(n.type!=="add"&&(n.trans._cache=null),r.mutate(n))})}})};function gs(t){return!("from"in t)}var Ye=function(t,e){if(this)je(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0});else{let r=new Ye;return t&&"d"in t&&je(r,t),r}};Zt(Ye.prototype,{add(t){return Rn(this,t),this},addKey(t){return Yr(this,t,t),this},addKeys(t){return t.forEach(e=>Yr(this,e,e)),this},[ki](){return ys(this)}});function Yr(t,e,r){let n=Ae(e,r);if(isNaN(n))return;if(n>0)throw RangeError();if(gs(t))return je(t,{from:e,to:r,d:1});let i=t.l,s=t.r;if(Ae(r,t.from)<0)return i?Yr(i,e,r):t.l={from:e,to:r,d:1,l:null,r:null},oa(t);if(Ae(e,t.to)>0)return s?Yr(s,e,r):t.r={from:e,to:r,d:1,l:null,r:null},oa(t);Ae(e,t.from)<0&&(t.from=e,t.l=null,t.d=s?s.d+1:1),Ae(r,t.to)>0&&(t.to=r,t.r=null,t.d=t.l?t.l.d+1:1);let o=!t.r;i&&!t.l&&Rn(t,i),s&&o&&Rn(t,s)}function Rn(t,e){function r(n,{from:i,to:s,l:o,r:a}){Yr(n,i,s),o&&r(n,o),a&&r(n,a)}gs(e)||r(t,e)}function ad(t,e){let r=ys(e),n=r.next();if(n.done)return!1;let i=n.value,s=ys(t),o=s.next(i.from),a=o.value;for(;!n.done&&!o.done;){if(Ae(a.from,i.to)<=0&&Ae(a.to,i.from)>=0)return!0;Ae(i.from,a.from)<0?i=(n=r.next(a.from)).value:a=(o=s.next(i.from)).value}return!1}function ys(t){let e=gs(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&&Ae(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||Ae(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 oa(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 s=i==="r"?"l":"r",o=re({},t),a=t[i];t.from=a.from,t.to=a.to,t[i]=a[i],o[i]=a[s],t[s]=o,o.d=aa(o)}t.d=aa(t)}function aa({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}var ld={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,r=new Ye(t.MIN_KEY,t.MAX_KEY);return xe(re({},t),{table:n=>{let i=t.table(n),{schema:s}=i,{primaryKey:o}=s,{extractKey:a,outbound:l}=o,u=xe(re({},i),{mutate:f=>{let y=f.trans,w=y.mutatedParts||(y.mutatedParts={}),b=g=>{let j=`idb://${e}/${n}/${g}`;return w[j]||(w[j]=new Ye)},x=b(""),h=b(":dels"),{type:v}=f,[p,m]=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],_=f.trans._cache;return i.mutate(f).then(g=>{if(ve(p)){v!=="delete"&&(p=g.results),x.addKeys(p);let j=sa(p,_);!j&&v!=="add"&&h.addKeys(p),(j||m)&&ud(b,s,j,m)}else if(p){let j={from:p.lower,to:p.upper};h.add(j),x.add(j)}else x.add(r),h.add(r),s.indexes.forEach(j=>b(j.name).add(r));return g})}}),c=({query:{index:f,range:y}})=>{var w,b;return[f,new Ye((w=y.lower)!==null&&w!==void 0?w:t.MIN_KEY,(b=y.upper)!==null&&b!==void 0?b:t.MAX_KEY)]},d={get:f=>[o,new Ye(f.key)],getMany:f=>[o,new Ye().addKeys(f.keys)],count:c,query:c,openCursor:c};return oe(d).forEach(f=>{u[f]=function(y){let{subscr:w}=R;if(w){let b=m=>{let _=`idb://${e}/${n}/${m}`;return w[_]||(w[_]=new Ye)},x=b(""),h=b(":dels"),[v,p]=d[f](y);if(b(v.name||"").add(p),!v.isPrimaryKey)if(f==="count")h.add(r);else{let m=f==="query"&&l&&y.values&&i.query(xe(re({},y),{values:!1}));return i[f].apply(this,arguments).then(_=>{if(f==="query"){if(l&&y.values)return m.then(({result:j})=>(x.addKeys(j),_));let g=y.values?_.result.map(a):_.result;y.values?x.addKeys(g):h.addKeys(g)}else if(f==="openCursor"){let g=_,j=y.values;return g&&Object.create(g,{key:{get(){return h.addKey(g.primaryKey),g.key}},primaryKey:{get(){let A=g.primaryKey;return h.addKey(A),A}},value:{get(){return j&&x.addKey(g.primaryKey),g.value}}})}return _})}}return i[f].apply(this,arguments)}}),u}})}};function ud(t,e,r,n){function i(s){let o=t(s.name||"");function a(u){return u!=null?s.extractKey(u):null}let l=u=>s.multiEntry&&ve(u)?u.forEach(c=>o.addKey(c)):o.addKey(u);(r||n).forEach((u,c)=>{let d=r&&a(r[c]),f=n&&a(n[c]);Ae(d,f)!==0&&(d!=null&&l(d),f!=null&&l(f))})}e.indexes.forEach(i)}var Je=class{constructor(e,r){this._middlewares={},this.verno=0;let n=Je.dependencies;this._options=r=re({addons:Je.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 s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Y,dbReadyPromise:null,cancelOpen:Y,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};s.dbReadyPromise=new I(o=>{s.dbReadyResolve=o}),s.openCanceller=new I((o,a)=>{s.cancelOpen=a}),this._state=s,this.name=e,this.on=Hr(this,"populate","blocked","versionchange","close",{ready:[Ri,Y]}),this.on.ready.subscribe=vo(this.on.ready.subscribe,o=>(a,l)=>{Je.vip(()=>{let u=this._state;if(u.openComplete)u.dbOpenError||I.resolve().then(a),l&&o(a);else if(u.onReadyBeingFired)u.onReadyBeingFired.push(a),l&&o(a);else{o(a);let c=this;l||o(function d(){c.on.ready.unsubscribe(a),c.on.ready.unsubscribe(d)})}})}),this.Collection=Ff(this),this.Table=wf(this),this.Transaction=Of(this),this.Version=Qf(this),this.WhereClause=If(this),this.on("versionchange",o=>{o.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",o=>{!o.newVersion||o.newVersion<o.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${o.oldVersion/10}`)}),this._maxKey=Qr(r.IDBKeyRange),this._createTransaction=(o,a,l,u)=>new this.Transaction(o,a,l,this._options.chromeTransactionDurability,u),this._fireOnBlocked=o=>{this.on("blocked").fire(o),$r.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(o))},this.use(rd),this.use(id),this.use(ld),this.use(od),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(o=>o(this))}version(e){if(isNaN(e)||e<.1)throw new L.Type("Given version is not a positive number");if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new L.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(Kf),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||R.letThrough||this._vip)?e():new I((r,n)=>{if(this._state.openComplete)return n(new L.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen){n(new L.DatabaseClosed);return}this.open().catch(Y)}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 s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:r,level:n??10,name:i}),s.sort((o,a)=>o.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 Zf(this)}_close(){let e=this._state,r=$r.indexOf(this);if(r>=0&&$r.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new I(n=>{e.dbReadyResolve=n}),e.openCanceller=new I((n,i)=>{e.cancelOpen=i})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new L.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,r=this._state;return new I((n,i)=>{let s=()=>{this.close();var o=this._deps.indexedDB.deleteDatabase(this.name);o.onsuccess=Z(()=>{Jf(this._deps,this.name),n()}),o.onerror=ze(i),o.onblocked=this._fireOnBlocked};if(e)throw new L.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(s):s()})}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 oe(this._allTables).map(e=>this._allTables[e])}transaction(){let e=ed.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,r,n){let i=R.trans;(!i||i.db!==this||e.indexOf("!")!==-1)&&(i=null);let s=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");let o,a;try{if(a=r.map(u=>{var c=u instanceof this.Table?u.name:u;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),e=="r"||e===Ji)o=Ji;else if(e=="rw"||e==Xi)o=Xi;else throw new L.InvalidArgument("Invalid transaction mode: "+e);if(i){if(i.mode===Ji&&o===Xi)if(s)i=null;else throw new L.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i&&a.forEach(u=>{if(i&&i.storeNames.indexOf(u)===-1)if(s)i=null;else throw new L.SubTransaction("Table "+u+" not included in parent transaction.")}),s&&i&&!i.active&&(i=null)}}catch(u){return i?i._promise(null,(c,d)=>{d(u)}):le(u)}let l=ia.bind(null,this,o,a,i,n);return i?i._promise(o,l,"lock"):R.trans?sr(R.transless,()=>this._whenReady(l)):this._whenReady(l)}table(e){if(!Ie(this._allTables,e))throw new L.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},cd=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",la=class{constructor(e){this._subscribe=e}subscribe(e,r,n){return this._subscribe(!e||typeof e=="function"?{next:e,error:r,complete:n}:e)}[cd](){return this}};function ua(t,e){return oe(e).forEach(r=>{let n=t[r]||(t[r]=new Ye);Rn(n,e[r])}),t}function fd(t){return new la(e=>{let r=Ii(t);function n(y){r&&ir();let w=()=>lt(t,{subscr:y,trans:null}),b=R.trans?sr(R.transless,w):w();return r&&b.then(Qe,Qe),b}let i=!1,s={},o={},a={get closed(){return i},unsubscribe:()=>{i=!0,dt.storagemutated.unsubscribe(d)}};e.start&&e.start(a);let l=!1,u=!1;function c(){return oe(o).some(y=>s[y]&&ad(s[y],o[y]))}let d=y=>{ua(s,y),c()&&f()},f=()=>{if(l||i)return;s={};let y={},w=n(y);u||(dt(Gr,d),u=!0),l=!0,Promise.resolve(w).then(b=>{l=!1,!i&&(c()?f():(s={},o=y,e.next&&e.next(b)))},b=>{l=!1,e.error&&e.error(b),a.unsubscribe()})};return f(),a})}var vs;try{vs={indexedDB:J.indexedDB||J.mozIndexedDB||J.webkitIndexedDB||J.msIndexedDB,IDBKeyRange:J.IDBKeyRange||J.webkitIDBKeyRange}}catch{vs={indexedDB:null,IDBKeyRange:null}}var Bt=Je;Zt(Bt,xe(re({},gn),{delete(t){return new Bt(t,{addons:[]}).delete()},exists(t){return new Bt(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return qf(Bt.dependencies).then(t)}catch{return le(new L.MissingAPI)}},defineClass(){function t(e){je(this,e)}return t},ignoreTransaction(t){return R.trans?sr(R.transless,t):t()},vip:hs,async:function(t){return function(){try{var e=ps(t.apply(this,arguments));return!e||typeof e.then!="function"?I.resolve(e):e}catch(r){return le(r)}}},spawn:function(t,e,r){try{var n=ps(t.apply(r,e||[]));return!n||typeof n.then!="function"?I.resolve(n):n}catch(i){return le(i)}},currentTransaction:{get:()=>R.trans||null},waitFor:function(t,e){let r=I.resolve(typeof t=="function"?Bt.ignoreTransaction(t):t).timeout(e||6e4);return R.trans?R.trans.waitFor(r):r},Promise:I,debug:{get:()=>Ke,set:t=>{Ao(t,t==="dexie"?()=>!0:$o)}},derive:er,extend:je,props:Zt,override:vo,Events:Hr,on:dt,liveQuery:fd,extendObservabilitySet:ua,getByKeyPath:Ue,setByKeyPath:Be,delByKeyPath:Gc,shallowClone:bo,deepClone:Pr,getObjectDiff:ms,cmp:Ae,asap:_o,minKey:Yi,addons:[],connections:$r,errnames:Pi,dependencies:vs,semVer:zo,version:zo.split(".").map(t=>parseInt(t)).reduce((t,e,r)=>t+e/Math.pow(10,r*2))}));Bt.maxKey=Qr(Bt.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(dt(Gr,t=>{if(!Xe){let e;En?(e=document.createEvent("CustomEvent"),e.initCustomEvent(ft,!0,!0,t)):e=new CustomEvent(ft,{detail:t}),Xe=!0,dispatchEvent(e),Xe=!1}}),addEventListener(ft,({detail:t})=>{Xe||Bn(t)}));function Bn(t){let e=Xe;try{Xe=!0,dt.storagemutated.fire(t)}finally{Xe=e}}var Xe=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(ft);dt(Gr,e=>{Xe||t.postMessage(e)}),t.onmessage=e=>{e.data&&Bn(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){dt(Gr,e=>{try{Xe||(typeof localStorage!="undefined"&&localStorage.setItem(ft,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(r=>r.postMessage({type:ft,changedParts:e})))}catch{}}),typeof addEventListener!="undefined"&&addEventListener("storage",e=>{if(e.key===ft){let r=JSON.parse(e.newValue);r&&Bn(r.changedParts)}});let t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",dd)}function dd({data:t}){t&&t.type===ft&&Bn(t.changedParts)}I.rejectionMapper=rf;Ao(Ke,$o);var Ve=class extends Je{constructor(){super(Ve.dbName);this.version(Ve.dbVersion).stores({searchHistory:"++id",minisearch:"date"})}static async clearOldDatabases(){let e=(await indexedDB.databases()).filter(r=>r.name===Ve.dbName&&r.version!==Ve.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 Ve.instance||(Ve.instance=new Ve),Ve.instance}async clearCache(){await this.minisearch.clear()}},lr=Ve;lr.dbVersion=8,lr.dbName="omnisearch/cache/"+app.appId;var Ee=lr.getInstance();var Lt=hn(!1),_s=class extends G.PluginSettingTab{constructor(e){super(app,e);this.plugin=e,Lt.subscribe(async r=>{E.showExcerpt=r,await ue(this.plugin)})}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"Omnisearch"});let r=e.createDiv();r.innerHTML=`
|
|
<iframe src="https://github.com/sponsors/scambier/button" title="Sponsor scambier" height="35" width="116" style="border: 0;"></iframe>
|
|
<a href='https://ko-fi.com/B0B6LQ2C' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
|
`,new G.Setting(e).setName("Indexing").setHeading();let n=new DocumentFragment;$e()?n.createSpan({},c=>{c.innerHTML=`\u{1F44D} You have installed <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a>, Omnisearch will use it to index PDFs and images.
|
|
<br />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`}):n.createSpan({},c=>{c.innerHTML='\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}),new G.Setting(e).setDesc(n);let i=new DocumentFragment;i.createSpan({},c=>{c.innerHTML="Include PDFs in search results"}),new G.Setting(e).setName(`PDFs Indexing ${$e()?"":"\u26A0\uFE0F Disabled"}`).setDesc(i).addToggle(c=>c.setValue(E.PDFIndexing).onChange(async d=>{E.PDFIndexing=d,await ue(this.plugin)})).setDisabled(!$e());let s=new DocumentFragment;s.createSpan({},c=>{c.innerHTML="Include images in search results"}),new G.Setting(e).setName(`Images Indexing ${$e()?"":"\u26A0\uFE0F Disabled"}`).setDesc(s).addToggle(c=>c.setValue(E.imagesIndexing).onChange(async d=>{E.imagesIndexing=d,await ue(this.plugin)})).setDisabled(!$e());let o=new DocumentFragment;o.createSpan({},c=>{c.innerHTML=`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">plaintext</strong> files.<br/>
|
|
Add extensions separated by a space, without the dot. Example: "<code>txt org</code>".<br />
|
|
\u26A0\uFE0F <span style="color: var(--text-accent)">Using extensions of non-plaintext files (like .docx or .pptx) WILL cause crashes,
|
|
because Omnisearch will try to index their content.</span><br />
|
|
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new G.Setting(e).setName("Additional files to index").setDesc(o).addText(c=>{c.setValue(E.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org").onChange(async d=>{E.indexedFileTypes=d.split(" "),await ue(this.plugin)})}),new G.Setting(e).setName("Behavior").setHeading(),new G.Setting(e).setName("Save index to cache").setDesc("Enable caching to speed up indexing time. In rare cases, the cache write may cause a freeze in Obsidian. This option will disable itself if it happens.").addToggle(c=>c.setValue(E.useCache).onChange(async d=>{E.useCache=d,await ue(this.plugin)})),new G.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(E.hideExcluded).onChange(async d=>{E.hideExcluded=d,await ue(this.plugin)}));let a=new DocumentFragment;a.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".<br/>
|
|
\u26A0\uFE0F <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
|
|
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
|
|
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>
|
|
`}),new G.Setting(e).setName("Ignore diacritics").setDesc(a).addToggle(c=>c.setValue(E.ignoreDiacritics).onChange(async d=>{await Ee.clearCache(),E.ignoreDiacritics=d,await ue(this.plugin)}));let l=new DocumentFragment;l.createSpan({},c=>{c.innerHTML=`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
|
|
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
|
|
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>
|
|
`}),new G.Setting(e).setName("Split CamelCaseWords").setDesc(l).addToggle(c=>c.setValue(E.splitCamelCase).onChange(async d=>{await Ee.clearCache(),E.splitCamelCase=d,await ue(this.plugin)})),new G.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(E.simpleSearch).onChange(async d=>{E.simpleSearch=d,await ue(this.plugin)})),new G.Setting(e).setName("User Interface").setHeading(),new G.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(c=>c.setValue(E.ribbonIcon).onChange(async d=>{E.ribbonIcon=d,await ue(this.plugin),d?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new G.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(E.showExcerpt).onChange(async d=>{Lt.set(d)})),new G.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(c=>c.setValue(E.renderLineReturnInExcerpts).onChange(async d=>{E.renderLineReturnInExcerpts=d,await ue(this.plugin)})),new G.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(c=>c.setValue(E.showPreviousQueryResults).onChange(async d=>{E.showPreviousQueryResults=d,await ue(this.plugin)}));let u=new DocumentFragment;if(u.createSpan({},c=>{c.innerHTML=`Shows a button next to the search input, to create a note.
|
|
Acts the same as the <code>shift \u21B5</code> shortcut, can be useful for mobile device users.`}),new G.Setting(e).setName('Show "Create note" button').setDesc(u).addToggle(c=>c.setValue(E.showCreateButton).onChange(async d=>{E.showCreateButton=d,await ue(this.plugin)})),new G.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(E.highlight).onChange(async d=>{E.highlight=d,await ue(this.plugin)})),new G.Setting(e).setName("Results weighting").setHeading(),new G.Setting(e).setName(`File name & declared aliases (default: ${Nt.weightBasename})`).addSlider(c=>this.weightSlider(c,"weightBasename")),new G.Setting(e).setName(`File directory (default: ${Nt.weightDirectory})`).addSlider(c=>this.weightSlider(c,"weightDirectory")),new G.Setting(e).setName(`Headings level 1 (default: ${Nt.weightH1})`).addSlider(c=>this.weightSlider(c,"weightH1")),new G.Setting(e).setName(`Headings level 2 (default: ${Nt.weightH2})`).addSlider(c=>this.weightSlider(c,"weightH2")),new G.Setting(e).setName(`Headings level 3 (default: ${Nt.weightH3})`).addSlider(c=>this.weightSlider(c,"weightH3")),new G.Setting(e).setName("Debugging").setHeading(),new G.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(E.verboseLogging).onChange(async d=>{E.verboseLogging=d,await ue(this.plugin)})),ht()){new G.Setting(e).setName("Danger Zone").setHeading();let c=new DocumentFragment;c.createSpan({},d=>{d.innerHTML=`Erase all Omnisearch cache data.
|
|
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
|
|
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new G.Setting(e).setName("Clear cache data").setDesc(c).addButton(d=>{d.setButtonText("Clear cache"),d.onClick(async()=>{await Ee.clearCache(),new G.Notice("Omnisearch - Cache cleared. Please restart Obsidian.")})})}}weightSlider(e,r){e.setLimits(1,5,.1).setValue(E[r]).setDynamicTooltip().onChange(n=>{E[r]=n,ue(this.plugin)})}},Nt={useCache:!0,hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!1,imagesIndexing:!1,splitCamelCase:!1,ribbonIcon:!0,showExcerpt:!0,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,weightBasename:3,weightDirectory:2,weightH1:1.5,weightH2:1.3,weightH3:1.1,welcomeMessage:"",verboseLogging:!1},E=Object.assign({},Nt);async function ca(t){E=Object.assign({},Nt,await t.loadData()),Lt.set(E.showExcerpt)}async function ue(t){await t.saveData(E)}var fa=be(require("obsidian"));var da=/[\u4e00-\u9fa5]/;var ha=100,Jr=300,pa=`suggestion-highlight omnisearch-highlight ${E.highlight?"omnisearch-default-highlight":""}`,H=new Si,Ln={ToggleExcerpts:"toggle-excerpts"},Pe=(s=>(s[s.Done=0]="Done",s[s.LoadingCache=1]="LoadingCache",s[s.ReadingFiles=2]="ReadingFiles",s[s.IndexingFiles=3]="IndexingFiles",s[s.WritingCache=4]="WritingCache",s))(Pe||{});var pt=hn(0),ma=!1;function xs(t){ma=t}function ga(){return ma}function Nn(){return app.plugins.plugins["cm-chs-patch"]}function $e(){return app.plugins?.plugins?.["text-extractor"]?.api}function ht(){return!fa.Platform.isIosApp&&E.useCache}var mt=/[|\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var Ea=be(require("obsidian"));var Ze=be(require("obsidian"));var va=be(require("crypto")),_a=be(ya());function gt(...t){return t[1]!==null&&t[1]!==void 0&&t[2]!==null&&t[2]!==void 0?`${t[1]}<span class="${pa}">${t[2]}</span>`:"<no content>"}function hd(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function xa(t){let e=t.split("/");return e.pop(),e.join("/")}function pd(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"[$&]")}function yt(t){if(!t.length)return/^$/g;let e="("+(Nn()?"":E.splitCamelCase?`^|${mt.source}|[A-Z]`:`^|${mt.source}`)+`)(${t.map(n=>pd(n)).join("|")})`;return new RegExp(`${e}`,"giu")}function Kn(t,e){return t.headings?.filter(r=>r.level===e).map(r=>r.heading)??[]}function zn(t,e){return(t+e)%e}function ur(t,e){try{let r=e??-1,n=Math.max(0,r-ha),i=Math.min(t.length,r+Jr);if(r>-1?t=(n>0?"\u2026":"")+t.slice(n,i).trim()+(i<t.length-1?"\u2026":""):t=t.slice(0,Jr),E.renderLineReturnInExcerpts){let s=new RegExp(/(?:\r\n|\r|\n)/g);t=t.split(s).filter(a=>a).join(`
|
|
`);let o=t.lastIndexOf(`
|
|
`,r-n);o>0&&(t=t.slice(o))}return t=hd(t),E.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
|
|
`,"<br>")),t}catch(r){return new Ze.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(r),""}}function ws(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,r,n)=>n)}function ba(t){return t?.frontmatter?(0,Ze.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function wa(t){let e=t?(0,Ze.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 et(t){return t==null?"":(t=t.replaceAll("`","[__omnisearch__backtick__]"),t=t.normalize("NFD").replace(/\p{Diacritic}/gu,""),t=t.replaceAll("[__omnisearch__backtick__]","`"),t)}function Vn(){return Ze.Platform.isMacOS?"\u2318":"ctrl"}function Zr(t){let e=!!$e(),r=e&&E.PDFIndexing,n=e&&E.imagesIndexing;return js(t)||tn(t)||r&&en(t)||n&&$n(t)}function $n(t){let e=Kt(t);return e==="png"||e==="jpg"||e==="jpeg"}function en(t){return Kt(t)==="pdf"}function js(t){return[...E.indexedFileTypes,"md"].some(e=>t.endsWith(`.${e}`))}function tn(t){return t.endsWith(".canvas")}function Kt(t){let e=t.split(".");return e[e.length-1]??""}function ja(t){return Ze.Platform.isMobileApp?(0,_a.md5)(t.toString()):(0,va.createHash)("md5").update(t).digest("hex")}function Aa(t,e){let r=[],n=0,i=t.length;for(;n<i;)r.push(t.slice(n,n+=e));return r}function Ca(t){return t.replace(/([a-z](?=[A-Z]))/g,"$1 ").split(" ")}function ie(...t){Sa(console.log,...t)}function Fa(...t){Sa(console.warn,...t)}function Sa(t,...e){if(E.verboseLogging){let r=new Date,n=`${r.getMinutes()}:${r.getSeconds()}:${r.getMilliseconds()}`;t("Omnisearch -",n+" -",...e)}}async function md(t){let e=app.vault.getFiles().find(s=>s.path===t);if(!e)throw new Error(`Invalid file path: "${t}"`);let r=null,n=$e();if(js(t))r=await app.vault.cachedRead(e);else if(tn(t)){let s=JSON.parse(await app.vault.cachedRead(e)),o=[];for(let a of s.nodes)a.type==="text"?o.push(a.text):a.type==="file"&&o.push(a.file);for(let a of s.edges.filter(l=>!!l.label))o.push(a.label);r=o.join(`\r
|
|
`)}else if(n?.canFileBeExtracted(t))r=await n.extractText(e);else throw new Error(`Unsupported file type: "${t}"`);r==null&&(console.warn(`Omnisearch: ${r} content for file`,e.path),r=""),r=et(r);let i=app.metadataCache.getFileCache(e);if(i&&i.frontmatter?.["excalidraw-plugin"]){let s=i.sections?.filter(o=>o.type==="comment")??[];for(let{start:o,end:a}of s.map(l=>l.position))r=r.substring(0,o.offset-1)+r.substring(a.offset)}return{basename:et(e.basename),content:r,path:e.path,mtime:e.stat.mtime,tags:wa(i),aliases:ba(i).join(""),headings1:i?Kn(i,1).join(" "):"",headings2:i?Kn(i,2).join(" "):"",headings3:i?Kn(i,3).join(" "):""}}var Da=class{constructor(){this.nextQueryIsEmpty=!1;this.documents=new Map}async addToLiveCache(e){try{let r=await md(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):(ie("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 Ee.searchHistory.toArray();r=r.filter(n=>n.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await Ee.searchHistory.clear(),await Ee.searchHistory.bulkAdd(r)}async getSearchHistory(){let e=(await Ee.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&e.unshift(""),e}getDocumentsChecksum(e){return ja(JSON.stringify(e.sort((r,n)=>r.path<n.path?-1:r.path>n.path?1:0)))}async getMinisearchCache(){try{return(await Ee.minisearch.toArray())[0]}catch(e){return new Ea.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,s])=>({path:i,mtime:s}));await Ee.minisearch.clear(),await Ee.minisearch.add({date:new Date().toISOString(),paths:n,data:e.toJSON()}),console.log("Omnisearch - Search cache written")}},de=new Da;function gd(t){let e,r,n,i,s,o,a,l,u=t[9].default,c=Gt(u,t,t[8],null);return{c(){e=O("div"),r=O("div"),n=O("input"),s=U(),c&&c.c(),B(n,"class","prompt-input"),B(n,"placeholder",t[0]),B(n,"spellcheck","false"),B(n,"type","text"),B(r,"class","omnisearch-input-field"),B(e,"class","omnisearch-input-container")},m(d,f){z(d,e,f),k(e,r),k(r,n),t[10](n),xi(n,t[1]),k(e,s),c&&c.m(e,null),o=!0,a||(l=[Te(n,"input",t[11]),co(i=t[3].call(null,n)),Te(n,"compositionend",t[12]),Te(n,"compositionstart",t[13]),Te(n,"input",t[4])],a=!0)},p(d,[f]){(!o||f&1)&&B(n,"placeholder",d[0]),f&2&&n.value!==d[1]&&xi(n,d[1]),c&&c.p&&(!o||f&256)&&qt(c,u,d,d[8],o?Qt(u,d[8],f,null):Yt(d[8]),null)},i(d){o||(Q(c,d),o=!0)},o(d){q(c,d),o=!1},d(d){d&&K(e),t[10](null),c&&c.d(d),a=!1,Re(l)}}}function yd(t,e,r){let{$$slots:n={},$$scope:i}=e,{initialValue:s=""}=e,o=!1,{placeholder:a=""}=e,l="",u,c=ji();function d(v){r(1,l=v)}function f(v){ot().then(()=>(u.focus(),ot())).then(()=>{u.select()})}let y=(0,Ta.debounce)(()=>{de.addToSearchHistory(""),c("input",l)},250);function w(v){He[v?"unshift":"push"](()=>{u=v,r(2,u)})}function b(){l=this.value,r(1,l),r(5,s),r(7,o)}let x=v=>xs(!1),h=v=>xs(!0);return t.$$set=v=>{"initialValue"in v&&r(5,s=v.initialValue),"placeholder"in v&&r(0,a=v.placeholder),"$$scope"in v&&r(8,i=v.$$scope)},t.$$.update=()=>{if(t.$$.dirty&162){e:s&&!o&&!l&&(r(7,o=!0),r(1,l=s),f())}},[a,l,u,f,y,s,d,o,i,n,w,b,x,h]}var ka=class extends pe{constructor(e){super();ye(this,e,yd,gd,fe,{initialValue:5,placeholder:0,setInputValue:6})}get setInputValue(){return this.$$.ctx[6]}},Hn=ka;function vd(t){let e,r,n,i,s=t[1].default,o=Gt(s,t,t[0],null);return{c(){e=O("div"),o&&o.c(),B(e,"class","prompt-results")},m(a,l){z(a,e,l),o&&o.m(e,null),r=!0,n||(i=Te(e,"mousedown",_d),n=!0)},p(a,[l]){o&&o.p&&(!r||l&1)&&qt(o,s,a,a[0],r?Qt(s,a[0],l,null):Yt(a[0]),null)},i(a){r||(Q(o,a),r=!0)},o(a){q(o,a),r=!1},d(a){a&&K(e),o&&o.d(a),n=!1,i()}}}var _d=t=>t.preventDefault();function xd(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}var Ia=class extends pe{constructor(e){super();ye(this,e,xd,vd,fe,{})}},Wn=Ia;var As=be(require("obsidian"));async function Un(t,e=!1){let r=yt(t.foundWords);r.exec(t.content);let n=r.lastIndex,i=!1;app.workspace.iterateAllLeaves(a=>{a.view instanceof As.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 s=app.workspace.getActiveViewOfType(As.MarkdownView);if(!s)return;let o=s.editor.offsetToPos(n);o.ch=0,s.editor.setCursor(o),s.editor.scrollIntoView({from:{line:o.line-10,ch:0},to:{line:o.line+10,ch:0}})}async function Oa(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}}function bd(t){let e;return{c(){e=O("span"),e.innerHTML='<svg viewBox="0 0 100 100" class="add-note-glyph" width="16" height="16"><path fill="currentColor" stroke="currentColor" d="M23.3,6.7c-3.7,0-6.7,3-6.7,6.7v73.3c0,3.7,3,6.7,6.7,6.7h28.4c-3.2-4.8-5.1-10.5-5.1-16.7c0-16.6,13.4-30,30-30 c2.3,0,4.5,0.3,6.7,0.8V31.7c0-0.9-0.3-1.7-1-2.4L60.7,7.6c-0.6-0.6-1.5-1-2.4-1L23.3,6.7z M56.7,13L77,33.3H60 c-1.8,0-3.3-1.5-3.3-3.3L56.7,13z M76.7,53.3c-12.9,0-23.3,10.4-23.3,23.3S63.8,100,76.7,100S100,89.6,100,76.7 S89.6,53.3,76.7,53.3z M76.7,63.3c1.8,0,3.3,1.5,3.3,3.3v6.7h6.7c1.8,0,3.3,1.5,3.3,3.3c0,1.8-1.5,3.3-3.3,3.3H80v6.7 c0,1.8-1.5,3.3-3.3,3.3c-1.8,0-3.3-1.5-3.3-3.3V80h-6.7c-1.8,0-3.3-1.5-3.3-3.3s1.5-3.3,3.3-3.3h6.7v-6.7 C73.3,64.8,74.8,63.3,76.7,63.3L76.7,63.3z"></path></svg>',B(e,"class","suggestion-flair"),B(e,"aria-label","Not created yet, select to create")},m(r,n){z(r,e,n)},p:ne,i:ne,o:ne,d(r){r&&K(e)}}}function wd(t){"use strict";return[]}var Ma=class extends pe{constructor(e){super();ye(this,e,wd,bd,fe,{})}},Pa=Ma;function Ra(t){let e,r;return e=new Pa({}),{c(){Se(e.$$.fragment)},m(n,i){we(e,n,i),r=!0},i(n){r||(Q(e.$$.fragment,n),r=!0)},o(n){q(e.$$.fragment,n),r=!1},d(n){ge(e,n)}}}function jd(t){let e,r,n,i,s,o=t[2]&&Ra(t),a=t[4].default,l=Gt(a,t,t[3],null);return{c(){e=O("div"),o&&o.c(),r=U(),l&&l.c(),B(e,"data-result-id",t[0]),B(e,"class","suggestion-item omnisearch-result"),bi(e,"is-selected",t[1])},m(u,c){z(u,e,c),o&&o.m(e,null),k(e,r),l&&l.m(e,null),n=!0,i||(s=[Te(e,"mousemove",t[5]),Te(e,"click",t[6]),Te(e,"auxclick",t[7])],i=!0)},p(u,[c]){u[2]?o?c&4&&Q(o,1):(o=Ra(u),o.c(),Q(o,1),o.m(e,r)):o&&(Dt(),q(o,1,1,()=>{o=null}),Tt()),l&&l.p&&(!n||c&8)&&qt(l,a,u,u[3],n?Qt(a,u[3],c,null):Yt(u[3]),null),(!n||c&1)&&B(e,"data-result-id",u[0]),(!n||c&2)&&bi(e,"is-selected",u[1])},i(u){n||(Q(o),Q(l,u),n=!0)},o(u){q(o),q(l,u),n=!1},d(u){u&&K(e),o&&o.d(),l&&l.d(u),i=!1,Re(s)}}}function Ad(t,e,r){let{$$slots:n={},$$scope:i}=e,{id:s}=e,{selected:o=!1}=e,{glyph:a=!1}=e;function l(d){Me.call(this,t,d)}function u(d){Me.call(this,t,d)}function c(d){Me.call(this,t,d)}return t.$$set=d=>{"id"in d&&r(0,s=d.id),"selected"in d&&r(1,o=d.selected),"glyph"in d&&r(2,a=d.glyph),"$$scope"in d&&r(3,i=d.$$scope)},[s,o,a,i,n,l,u,c]}var Ba=class extends pe{constructor(e){super();ye(this,e,Ad,jd,fe,{id:0,selected:1,glyph:2})}},Gn=Ba;var cr=be(require("obsidian"));function La(t){let e,r=t[1].matches.length+"",n,i,s=(t[1].matches.length>1?"matches":"match")+"",o;return{c(){e=O("span"),n=Fe(r),i=Fe("\xA0"),o=Fe(s),B(e,"class","omnisearch-result__counter")},m(a,l){z(a,e,l),k(e,n),k(e,i),k(e,o)},p(a,l){l&2&&r!==(r=a[1].matches.length+"")&&St(n,r),l&2&&s!==(s=(a[1].matches.length>1?"matches":"match")+"")&&St(o,s)},d(a){a&&K(e)}}}function Na(t){let e,r,n,i,s;return{c(){e=O("div"),r=O("span"),n=U(),i=O("span"),s=Fe(t[6]),B(e,"class","omnisearch-result__folder-path")},m(o,a){z(o,e,a),k(e,r),t[12](r),k(e,n),k(e,i),k(i,s)},p(o,a){a&64&&St(s,o[6])},d(o){o&&K(e),t[12](null)}}}function Ka(t){let e,r=t[8].replace(t[9],gt)+"";return{c(){e=O("div"),B(e,"class","omnisearch-result__body")},m(n,i){z(n,e,i),e.innerHTML=r},p(n,i){i&768&&r!==(r=n[8].replace(n[9],gt)+"")&&(e.innerHTML=r)},d(n){n&&K(e)}}}function za(t){let e,r,n;return{c(){e=O("div"),r=O("img"),ke(r,"width","100px"),_i(r.src,n=t[5])||B(r,"src",n),B(r,"alt",""),B(e,"class","omnisearch-result__image-container")},m(i,s){z(i,e,s),k(e,r)},p(i,s){s&32&&!_i(r.src,n=i[5])&&B(r,"src",n)},d(i){i&&K(e)}}}function Cd(t){let e,r,n,i,s,o,a=t[2].replace(t[9],gt)+"",l,u,c,d=Kt(t[1].path)+"",f,y,w,b,x,h,v=t[1].matches.length>0&&La(t),p=t[6]&&Na(t),m=t[10]&&Ka(t),_=t[5]&&za(t);return{c(){e=O("div"),r=O("div"),n=O("span"),i=O("span"),s=U(),o=O("span"),l=U(),u=O("span"),c=Fe("."),f=Fe(d),y=U(),v&&v.c(),w=U(),p&&p.c(),b=U(),x=O("div"),m&&m.c(),h=U(),_&&_.c(),B(u,"class","omnisearch-result__extension"),B(n,"class","omnisearch-result__title"),B(r,"class","omnisearch-result__title-container"),ke(x,"display","flex"),ke(x,"flex-direction","row")},m(g,j){z(g,e,j),k(e,r),k(r,n),k(n,i),t[11](i),k(n,s),k(n,o),o.innerHTML=a,k(n,l),k(n,u),k(u,c),k(u,f),k(n,y),v&&v.m(n,null),k(e,w),p&&p.m(e,null),k(e,b),k(e,x),m&&m.m(x,null),k(x,h),_&&_.m(x,null)},p(g,j){j&516&&a!==(a=g[2].replace(g[9],gt)+"")&&(o.innerHTML=a),j&2&&d!==(d=Kt(g[1].path)+"")&&St(f,d),g[1].matches.length>0?v?v.p(g,j):(v=La(g),v.c(),v.m(n,null)):v&&(v.d(1),v=null),g[6]?p?p.p(g,j):(p=Na(g),p.c(),p.m(e,b)):p&&(p.d(1),p=null),g[10]?m?m.p(g,j):(m=Ka(g),m.c(),m.m(x,h)):m&&(m.d(1),m=null),g[5]?_?_.p(g,j):(_=za(g),_.c(),_.m(x,null)):_&&(_.d(1),_=null)},d(g){g&&K(e),t[11](null),v&&v.d(),p&&p.d(),m&&m.d(),_&&_.d()}}}function Fd(t){let e,r;return e=new Gn({props:{glyph:t[7],id:t[1].path,selected:t[0],$$slots:{default:[Cd]},$$scope:{ctx:t}}}),e.$on("click",t[13]),e.$on("auxclick",t[14]),e.$on("mousemove",t[15]),{c(){Se(e.$$.fragment)},m(n,i){we(e,n,i),r=!0},p(n,[i]){let s={};i&128&&(s.glyph=n[7]),i&2&&(s.id=n[1].path),i&1&&(s.selected=n[0]),i&67454&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(Q(e.$$.fragment,n),r=!0)},o(n){q(e.$$.fragment,n),r=!1},d(n){ge(e,n)}}}function Sd(t,e,r){let n,i,s,o;ln(t,Lt,p=>r(10,o=p));let{selected:a=!1}=e,{note:l}=e,u=null,c="",d="",f,y;function w(p){He[p?"unshift":"push"](()=>{y=p,r(4,y)})}function b(p){He[p?"unshift":"push"](()=>{f=p,r(3,f)})}function x(p){Me.call(this,t,p)}function h(p){Me.call(this,t,p)}function v(p){Me.call(this,t,p)}t.$$set=p=>{"selected"in p&&r(0,a=p.selected),"note"in p&&r(1,l=p.note)},t.$$.update=()=>{if(t.$$.dirty&2){e:if(r(5,u=null),$n(l.path)){let p=app.vault.getFiles().find(m=>m.path===l.path);p&&r(5,u=app.vault.getResourcePath(p))}}if(t.$$.dirty&2){e:r(9,n=yt(l.foundWords))}if(t.$$.dirty&2){e:r(8,i=ur(l.content,l.matches[0]?.offset??-1))}if(t.$$.dirty&30){e:r(2,c=l.basename),r(6,d=xa(l.path)),E.ignoreDiacritics&&r(2,c=et(c)),f&&(0,cr.setIcon)(f,"folder-open"),y&&($n(l.path)?(0,cr.setIcon)(y,"image"):en(l.path)?(0,cr.setIcon)(y,"file-text"):tn(l.path)?(0,cr.setIcon)(y,"layout-dashboard"):(0,cr.setIcon)(y,"file"))}};e:r(7,s=!1);return[a,l,c,f,y,u,d,s,i,n,o,w,b,x,h,v]}var Va=class extends pe{constructor(e){super();ye(this,e,Sd,Fd,fe,{selected:0,note:1})}},$a=Va;var Ga=be(Ua()),Cs=["ext","path"],zt=class{constructor(e=""){this.extensions=[];E.ignoreDiacritics&&(e=et(e));let r=(0,Ga.parse)(e.toLowerCase(),{tokenize:!0,keywords:Cs});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]);for(let n of Cs){let i=r[n];i&&(r[n]=Array.isArray(i)?i:[i]);let s=r.exclude[n];s&&(r.exclude[n]=Array.isArray(s)?s:[s])}this.query=r,this.extensions=this.query.ext??[]}isEmpty(){for(let e of Cs)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 this.query.text.filter(e=>e.split(" ").length>1)}};var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},ee.apply(this,arguments)};function Ed(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(d){o(d)}}function l(c){try{u(n.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})}function Dd(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function W(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ae(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}var Td="ENTRIES",Qa="KEYS",qa="VALUES",me="",Fs=function(){function t(e,r){var n=e._tree,i=Array.from(n.keys());this.set=e,this._type=r,this._path=i.length>0?[{node:n,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=fr(this._path),r=e.node,n=e.keys;if(fr(n)===me)return{done:!1,value:this.result()};var i=r.get(fr(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=fr(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 fr(r)}).filter(function(e){return e!==me}).join("")},t.prototype.value=function(){return fr(this._path).node.get(me)},t.prototype.result=function(){switch(this._type){case qa:return this.value();case Qa:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),fr=function(t){return t[t.length-1]},kd=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,s=i+r,o=new Uint8Array(s*i).fill(r+1),a=0;a<i;++a)o[a]=a;for(var l=1;l<s;++l)o[l*i]=l;return Ya(t,e,r,n,o,1,i,""),n},Ya=function(t,e,r,n,i,s,o,a){var l,u,c=s*o;try{e:for(var d=W(t.keys()),f=d.next();!f.done;f=d.next()){var y=f.value;if(y===me){var w=i[c-1];w<=r&&n.set(a,[t.get(y),w])}else{for(var b=s,x=0;x<y.length;++x,++b){for(var h=y[x],v=o*b,p=v-o,m=i[v],_=Math.max(0,b-r-1),g=Math.min(o-1,b+r),j=_;j<g;++j){var A=h!==e[j],C=i[p+j]+ +A,F=i[p+j+1]+1,D=i[v+j]+1,P=i[v+j+1]=Math.min(C,F,D);P<m&&(m=P)}if(m>r)continue e}Ya(t.get(y),e,r,n,i,b,o,a+y)}}}catch(T){l={error:T}}finally{try{f&&!f.done&&(u=d.return)&&u.call(d)}finally{if(l)throw l.error}}},Ss=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=ae(qn(this._tree,e.slice(this._prefix.length)),2),s=i[0],o=i[1];if(s===void 0){var a=ae(Ts(o),2),l=a[0],u=a[1];try{for(var c=W(l.keys()),d=c.next();!d.done;d=c.next()){var f=d.value;if(f!==me&&f.startsWith(u)){var y=new Map;return y.set(f.slice(u.length),l.get(f)),new t(y,e)}}}catch(w){r={error:w}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}return new t(s,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,Id(this._tree,e)},t.prototype.entries=function(){return new Fs(this,Td)},t.prototype.forEach=function(e){var r,n;try{for(var i=W(this),s=i.next();!s.done;s=i.next()){var o=ae(s.value,2),a=o[0],l=o[1];e(a,l,this)}}catch(u){r={error:u}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return kd(this._tree,e,r)},t.prototype.get=function(e){var r=Es(this._tree,e);return r!==void 0?r.get(me):void 0},t.prototype.has=function(e){var r=Es(this._tree,e);return r!==void 0&&r.has(me)},t.prototype.keys=function(){return new Fs(this,Qa)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Ds(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=Ds(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=Ds(this._tree,e),i=n.get(me);return i===void 0&&n.set(me,i=r()),i},t.prototype.values=function(){return new Fs(this,qa)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var s=W(e),o=s.next();!o.done;o=s.next()){var a=ae(o.value,2),l=a[0],u=a[1];i.set(l,u)}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),qn=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var s=W(t.keys()),o=s.next();!o.done;o=s.next()){var a=o.value;if(a!==me&&e.startsWith(a))return r.push([t,a]),qn(t.get(a),e.slice(a.length),r)}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return r.push([t,e]),qn(void 0,"",r)},Es=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=W(t.keys()),s=i.next();!s.done;s=i.next()){var o=s.value;if(o!==me&&e.startsWith(o))return Es(t.get(o),e.slice(o.length))}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Ds=function(t,e){var r,n,i=e.length;e:for(var s=0;t&&s<i;){try{for(var o=(r=void 0,W(t.keys())),a=o.next();!a.done;a=o.next()){var l=a.value;if(l!==me&&e[s]===l[0]){for(var u=Math.min(i-s,l.length),c=1;c<u&&e[s+c]===l[c];)++c;var d=t.get(l);if(c===l.length)t=d;else{var f=new Map;f.set(l.slice(c),d),t.set(e.slice(s,s+c),f),t.delete(l),t=f}s+=c;continue e}}}catch(w){r={error:w}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var y=new Map;return t.set(e.slice(s),y),y}return t},Id=function(t,e){var r=ae(qn(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(me),n.size===0)Ja(i);else if(n.size===1){var s=ae(n.entries().next().value,2),o=s[0],a=s[1];Xa(i,o,a)}}},Ja=function(t){if(t.length!==0){var e=ae(Ts(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)Ja(t.slice(0,-1));else if(r.size===1){var i=ae(r.entries().next().value,2),s=i[0],o=i[1];s!==me&&Xa(t.slice(0,-1),s,o)}}},Xa=function(t,e,r){if(t.length!==0){var n=ae(Ts(t),2),i=n[0],s=n[1];i.set(s+e,r),i.delete(s)}},Ts=function(t){return t[t.length-1]},rn,ks="or",Za="and",Od="and_not",Is=function(){function t(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');var r=e.autoVacuum==null||e.autoVacuum===!0?Bs:e.autoVacuum;this._options=ee(ee(ee({},Ms),e),{autoVacuum:r,searchOptions:ee(ee({},el),e.searchOptions||{}),autoSuggestOptions:ee(ee({},Ld),e.autoSuggestOptions||{})}),this._index=new Ss,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Rs,this.addFields(this._options.fields)}return t.prototype.add=function(e){var r,n,i,s,o,a,l=this._options,u=l.extractField,c=l.tokenize,d=l.processTerm,f=l.fields,y=l.idField,w=u(e,y);if(w==null)throw new Error('MiniSearch: document does not have ID field "'.concat(y,'"'));if(this._idToShortId.has(w))throw new Error("MiniSearch: duplicate ID ".concat(w));var b=this.addDocumentId(w);this.saveStoredFields(b,e);try{for(var x=W(f),h=x.next();!h.done;h=x.next()){var v=h.value,p=u(e,v);if(p!=null){var m=c(p.toString(),v),_=this._fieldIds[v],g=new Set(m).size;this.addFieldLength(b,_,this._documentCount-1,g);try{for(var j=(i=void 0,W(m)),A=j.next();!A.done;A=j.next()){var C=A.value,F=d(C,v);if(Array.isArray(F))try{for(var D=(o=void 0,W(F)),P=D.next();!P.done;P=D.next()){var T=P.value;this.addTerm(_,b,T)}}catch(N){o={error:N}}finally{try{P&&!P.done&&(a=D.return)&&a.call(D)}finally{if(o)throw o.error}}else F&&this.addTerm(_,b,F)}}catch(N){i={error:N}}finally{try{A&&!A.done&&(s=j.return)&&s.call(j)}finally{if(i)throw i.error}}}}}catch(N){r={error:N}}finally{try{h&&!h.done&&(n=x.return)&&n.call(x)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=W(e),s=i.next();!s.done;s=i.next()){var o=s.value;this.add(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.addAllAsync=function(e,r){var n=this;r===void 0&&(r={});var i=r.chunkSize,s=i===void 0?10:i,o={chunk:[],promise:Promise.resolve()},a=e.reduce(function(c,d,f){var y=c.chunk,w=c.promise;return y.push(d),(f+1)%s==0?{chunk:[],promise:w.then(function(){return new Promise(function(b){return setTimeout(b,0)})}).then(function(){return n.addAll(y)})}:{chunk:y,promise:w}},o),l=a.chunk,u=a.promise;return u.then(function(){return n.addAll(l)})},t.prototype.remove=function(e){var r,n,i,s,o,a,l=this._options,u=l.tokenize,c=l.processTerm,d=l.extractField,f=l.fields,y=l.idField,w=d(e,y);if(w==null)throw new Error('MiniSearch: document does not have ID field "'.concat(y,'"'));var b=this._idToShortId.get(w);if(b==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(w,": it is not in the index"));try{for(var x=W(f),h=x.next();!h.done;h=x.next()){var v=h.value,p=d(e,v);if(p!=null){var m=u(p.toString(),v),_=this._fieldIds[v],g=new Set(m).size;this.removeFieldLength(b,_,this._documentCount,g);try{for(var j=(i=void 0,W(m)),A=j.next();!A.done;A=j.next()){var C=A.value,F=c(C,v);if(Array.isArray(F))try{for(var D=(o=void 0,W(F)),P=D.next();!P.done;P=D.next()){var T=P.value;this.removeTerm(_,b,T)}}catch(N){o={error:N}}finally{try{P&&!P.done&&(a=D.return)&&a.call(D)}finally{if(o)throw o.error}}else F&&this.removeTerm(_,b,F)}}catch(N){i={error:N}}finally{try{A&&!A.done&&(s=j.return)&&s.call(j)}finally{if(i)throw i.error}}}}}catch(N){r={error:N}}finally{try{h&&!h.done&&(n=x.return)&&n.call(x)}finally{if(r)throw r.error}}this._storedFields.delete(b),this._documentIds.delete(b),this._idToShortId.delete(w),this._fieldLength.delete(b),this._documentCount-=1},t.prototype.removeAll=function(e){var r,n;if(e)try{for(var i=W(e),s=i.next();!s.done;s=i.next()){var o=s.value;this.remove(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Ss,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,s){r.removeFieldLength(n,s,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,s=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:s},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var s=W(e),o=s.next();!o.done;o=s.next()){var a=o.value;this.discard(a)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}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,s=i(e,n);this.discard(s),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=Rs,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 Ed(this,void 0,void 0,function(){var n,i,s,o,a,l,u,c,d,f,y,w,b,x,h,v,p,m,_,g,j,A,C,F,D;return Dd(this,function(P){switch(P.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||Ps.batchSize,s=e.batchWait||Ps.batchWait,o=1,P.label=1;case 1:P.trys.push([1,7,8,9]),a=W(this._index),l=a.next(),P.label=2;case 2:if(l.done)return[3,6];u=ae(l.value,2),c=u[0],d=u[1];try{for(f=(A=void 0,W(d)),y=f.next();!y.done;y=f.next()){w=ae(y.value,2),b=w[0],x=w[1];try{for(h=(F=void 0,W(x)),v=h.next();!v.done;v=h.next())p=ae(v.value,1),m=p[0],!this._documentIds.has(m)&&(x.size<=1?d.delete(b):x.delete(m))}catch(T){F={error:T}}finally{try{v&&!v.done&&(D=h.return)&&D.call(h)}finally{if(F)throw F.error}}}}catch(T){A={error:T}}finally{try{y&&!y.done&&(C=f.return)&&C.call(f)}finally{if(A)throw A.error}}return this._index.get(c).size===0&&this._index.delete(c),o%i!=0?[3,4]:[4,new Promise(function(T){return setTimeout(T,s)})];case 3:P.sent(),P.label=4;case 4:o+=1,P.label=5;case 5:return l=a.next(),[3,2];case 6:return[3,9];case 7:return _=P.sent(),g={error:_},[3,9];case 8:try{l&&!l.done&&(j=a.return)&&j.call(a)}finally{if(g)throw g.error}return[7];case 9:this._dirtCount-=n,P.label=10;case 10:return[4,null];case 11:return P.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||Bs.minDirtCount,n=n||Bs.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 s=this.executeQuery(e,r),o=[];try{for(var a=W(s),l=a.next();!l.done;l=a.next()){var u=ae(l.value,2),c=u[0],d=u[1],f=d.score,y=d.terms,w=d.match,b=y.length,x={id:this._documentIds.get(c),score:f*b,terms:Object.keys(w),match:w};Object.assign(x,this._storedFields.get(c)),(r.filter==null||r.filter(x))&&o.push(x)}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o.sort(rl),o},t.prototype.autoSuggest=function(e,r){var n,i,s,o;r===void 0&&(r={}),r=ee(ee({},this._options.autoSuggestOptions),r);var a=new Map;try{for(var l=W(this.search(e,r)),u=l.next();!u.done;u=l.next()){var c=u.value,d=c.score,f=c.terms,y=f.join(" "),w=a.get(y);w!=null?(w.score+=d,w.count+=1):a.set(y,{score:d,terms:f,count:1})}}catch(_){n={error:_}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}var b=[];try{for(var x=W(a),h=x.next();!h.done;h=x.next()){var v=ae(h.value,2),w=v[0],p=v[1],d=p.score,f=p.terms,m=p.count;b.push({suggestion:w,terms:f,score:d/m})}}catch(_){s={error:_}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(s)throw s.error}}return b.sort(rl),b},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(Ms.hasOwnProperty(e))return Os(Ms,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,s,o,a,l,u=e.index,c=e.documentCount,d=e.nextId,f=e.documentIds,y=e.fieldIds,w=e.fieldLength,b=e.averageFieldLength,x=e.storedFields,h=e.dirtCount,v=e.serializationVersion;if(v!==1&&v!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var p=new t(r);p._documentCount=c,p._nextId=d,p._documentIds=Yn(f),p._idToShortId=new Map,p._fieldIds=y,p._fieldLength=Yn(w),p._avgFieldLength=b,p._storedFields=Yn(x),p._dirtCount=h||0,p._index=new Ss;try{for(var m=W(p._documentIds),_=m.next();!_.done;_=m.next()){var g=ae(_.value,2),j=g[0],A=g[1];p._idToShortId.set(A,j)}}catch(te){n={error:te}}finally{try{_&&!_.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}try{for(var C=W(u),F=C.next();!F.done;F=C.next()){var D=ae(F.value,2),P=D[0],T=D[1],N=new Map;try{for(var $=(a=void 0,W(Object.keys(T))),M=$.next();!M.done;M=$.next()){var S=M.value,V=T[S];v===1&&(V=V.ds),N.set(parseInt(S,10),Yn(V))}}catch(te){a={error:te}}finally{try{M&&!M.done&&(l=$.return)&&l.call($)}finally{if(a)throw a.error}}p._index.set(P,N)}}catch(te){s={error:te}}finally{try{F&&!F.done&&(o=C.return)&&o.call(C)}finally{if(s)throw s.error}}return p},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),typeof e!="string"){var i=ee(ee(ee({},r),e),{queries:void 0}),s=e.queries.map(function(x){return n.executeQuery(x,i)});return this.combineResults(s,e.combineWith)}var o=this._options,a=o.tokenize,l=o.processTerm,u=o.searchOptions,c=ee(ee({tokenize:a,processTerm:l},u),r),d=c.tokenize,f=c.processTerm,y=d(e).flatMap(function(x){return f(x)}).filter(function(x){return!!x}),w=y.map(Bd(c)),b=w.map(function(x){return n.executeQuerySpec(x,c)});return this.combineResults(b,c.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,s,o,a=ee(ee({},this._options.searchOptions),r),l=(a.fields||this._options.fields).reduce(function(S,V){var te;return ee(ee({},S),(te={},te[V]=Os(S,V)||1,te))},a.boost||{}),u=a.boostDocument,c=a.weights,d=a.maxFuzzy,f=a.bm25,y=ee(ee({},el.weights),c),w=y.fuzzy,b=y.prefix,x=this._index.get(e.term),h=this.termResults(e.term,e.term,1,x,l,u,f),v,p;if(e.prefix&&(v=this._index.atPrefix(e.term)),e.fuzzy){var m=e.fuzzy===!0?.2:e.fuzzy,_=m<1?Math.min(d,Math.round(e.term.length*m)):m;_&&(p=this._index.fuzzyGet(e.term,_))}if(v)try{for(var g=W(v),j=g.next();!j.done;j=g.next()){var A=ae(j.value,2),C=A[0],F=A[1],D=C.length-e.term.length;if(!!D){p==null||p.delete(C);var P=b*C.length/(C.length+.3*D);this.termResults(e.term,C,P,F,l,u,f,h)}}}catch(S){n={error:S}}finally{try{j&&!j.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}if(p)try{for(var T=W(p.keys()),N=T.next();!N.done;N=T.next()){var C=N.value,$=ae(p.get(C),2),M=$[0],D=$[1];if(!!D){var P=w*C.length/(C.length+D);this.termResults(e.term,C,P,M,l,u,f,h)}}}catch(S){s={error:S}}finally{try{N&&!N.done&&(o=T.return)&&o.call(T)}finally{if(s)throw s.error}}return h},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=ks),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(Md[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,s=[];try{for(var o=W(this._index),a=o.next();!a.done;a=o.next()){var l=ae(a.value,2),u=l[0],c=l[1],d={};try{for(var f=(n=void 0,W(c)),y=f.next();!y.done;y=f.next()){var w=ae(y.value,2),b=w[0],x=w[1];d[b]=Object.fromEntries(x)}}catch(h){n={error:h}}finally{try{y&&!y.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}s.push([u,d])}}catch(h){e={error:h}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}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:s,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,s,o,a,l){var u,c,d,f,y;if(l===void 0&&(l=new Map),i==null)return l;try{for(var w=W(Object.keys(s)),b=w.next();!b.done;b=w.next()){var x=b.value,h=s[x],v=this._fieldIds[x],p=i.get(v);if(p!=null){var m=p.size,_=this._avgFieldLength[v];try{for(var g=(d=void 0,W(p.keys())),j=g.next();!j.done;j=g.next()){var A=j.value;if(!this._documentIds.has(A)){this.removeTerm(v,A,r),m-=1;continue}var C=o?o(this._documentIds.get(A),r):1;if(!!C){var F=p.get(A),D=this._fieldLength.get(A)[v],P=Rd(F,m,this._documentCount,D,_,a),T=n*h*C*P,N=l.get(A);if(N){N.score+=T,Nd(N.terms,e);var $=Os(N.match,r);$?$.push(x):N.match[r]=[x]}else l.set(A,{score:T,terms:[e],match:(y={},y[r]=[x],y)})}}}catch(M){d={error:M}}finally{try{j&&!j.done&&(f=g.return)&&f.call(g)}finally{if(d)throw d.error}}}}}catch(M){u={error:M}}finally{try{b&&!b.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}return l},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,nl),s=i.get(e);if(s==null)s=new Map,s.set(r,1),i.set(e,s);else{var o=s.get(r);s.set(r,(o||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,nl),s=i.get(e);s==null||s.get(r)==null?this.warnDocumentChanged(r,e,n):s.get(r)<=1?s.size<=1?i.delete(e):s.delete(r):s.set(r,s.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,s;try{for(var o=W(Object.keys(this._fieldIds)),a=o.next();!a.done;a=o.next()){var l=a.value;if(this._fieldIds[l]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var s=this._fieldLength.get(e);s==null&&this._fieldLength.set(e,s=[]),s[r]=i;var o=this._avgFieldLength[r]||0,a=o*n+i;this._avgFieldLength[r]=a/(n+1)},t.prototype.removeFieldLength=function(e,r,n,i){if(n===1){this._avgFieldLength[r]=0;return}var s=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=s/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,s=this._options,o=s.storeFields,a=s.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var u=W(o),c=u.next();!c.done;c=u.next()){var d=c.value,f=a(r,d);f!==void 0&&(l[d]=f)}}catch(y){n={error:y}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}},t}(),Os=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},Md=(rn={},rn[ks]=function(t,e){var r,n;try{for(var i=W(e.keys()),s=i.next();!s.done;s=i.next()){var o=s.value,a=t.get(o);if(a==null)t.set(o,e.get(o));else{var l=e.get(o),u=l.score,c=l.terms,d=l.match;a.score=a.score+u,a.match=Object.assign(a.match,d),tl(a.terms,c)}}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},rn[Za]=function(t,e){var r,n,i=new Map;try{for(var s=W(e.keys()),o=s.next();!o.done;o=s.next()){var a=o.value,l=t.get(a);if(l!=null){var u=e.get(a),c=u.score,d=u.terms,f=u.match;tl(l.terms,d),i.set(a,{score:l.score+c,terms:l.terms,match:Object.assign(l.match,f)})}}}catch(y){r={error:y}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},rn[Od]=function(t,e){var r,n;try{for(var i=W(e.keys()),s=i.next();!s.done;s=i.next()){var o=s.value;t.delete(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},rn),Pd={k:1.2,b:.7,d:.5},Rd=function(t,e,r,n,i,s){var o=s.k,a=s.b,l=s.d,u=Math.log(1+(r-e+.5)/(e+.5));return u*(l+t*(o+1)/(t+o*(1-a+a*n/i)))},Bd=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,s=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:s}}},Ms={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t,e){return t.split(Kd)},processTerm:function(t,e){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e,r){return console!=null&&console.warn!=null&&console[t](e)},autoVacuum:!0},el={combineWith:ks,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Pd},Ld={combineWith:Za,prefix:function(t,e,r){return e===r.length-1}},Ps={batchSize:1e3,batchWait:10},Rs={minDirtFactor:.1,minDirtCount:20},Bs=ee(ee({},Ps),Rs),Nd=function(t,e){t.includes(e)||t.push(e)},tl=function(t,e){var r,n;try{for(var i=W(e),s=i.next();!s.done;s=i.next()){var o=s.value;t.includes(o)||t.push(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},rl=function(t,e){var r=t.score,n=e.score;return n-r},nl=function(){return new Map},Yn=function(t){var e,r,n=new Map;try{for(var i=W(Object.keys(t)),s=i.next();!s.done;s=i.next()){var o=s.value;n.set(parseInt(o,10),t[o])}}catch(a){e={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},Kd=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var oc=be(require("obsidian"));var zd=typeof global=="object"&&global&&global.Object===Object&&global,Jn=zd;var Vd=typeof self=="object"&&self&&self.Object===Object&&self,$d=Jn||Vd||Function("return this")(),he=$d;var Hd=he.Symbol,Ce=Hd;var il=Object.prototype,Wd=il.hasOwnProperty,Ud=il.toString,nn=Ce?Ce.toStringTag:void 0;function Gd(t){var e=Wd.call(t,nn),r=t[nn];try{t[nn]=void 0;var n=!0}catch{}var i=Ud.call(t);return n&&(e?t[nn]=r:delete t[nn]),i}var sl=Gd;var Qd=Object.prototype,qd=Qd.toString;function Yd(t){return qd.call(t)}var ol=Yd;var Jd="[object Null]",Xd="[object Undefined]",al=Ce?Ce.toStringTag:void 0;function Zd(t){return t==null?t===void 0?Xd:Jd:al&&al in Object(t)?sl(t):ol(t)}var Le=Zd;function eh(t){return t!=null&&typeof t=="object"}var Ne=eh;var th="[object Symbol]";function rh(t){return typeof t=="symbol"||Ne(t)&&Le(t)==th}var tt=rh;function nh(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var dr=nh;var ih=Array.isArray,se=ih;var sh=1/0,ll=Ce?Ce.prototype:void 0,ul=ll?ll.toString:void 0;function cl(t){if(typeof t=="string")return t;if(se(t))return dr(t,cl)+"";if(tt(t))return ul?ul.call(t):"";var e=t+"";return e=="0"&&1/t==-sh?"-0":e}var fl=cl;function oh(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var vt=oh;function ah(t){return t}var _t=ah;var lh="[object AsyncFunction]",uh="[object Function]",ch="[object GeneratorFunction]",fh="[object Proxy]";function dh(t){if(!vt(t))return!1;var e=Le(t);return e==uh||e==ch||e==lh||e==fh}var Xn=dh;var hh=he["__core-js_shared__"],Zn=hh;var dl=function(){var t=/[^.]+$/.exec(Zn&&Zn.keys&&Zn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ph(t){return!!dl&&dl in t}var hl=ph;var mh=Function.prototype,gh=mh.toString;function yh(t){if(t!=null){try{return gh.call(t)}catch{}try{return t+""}catch{}}return""}var rt=yh;var vh=/[\\^$.*+?()[\]{}|]/g,_h=/^\[object .+?Constructor\]$/,xh=Function.prototype,bh=Object.prototype,wh=xh.toString,jh=bh.hasOwnProperty,Ah=RegExp("^"+wh.call(jh).replace(vh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ch(t){if(!vt(t)||hl(t))return!1;var e=Xn(t)?Ah:_h;return e.test(rt(t))}var pl=Ch;function Fh(t,e){return t==null?void 0:t[e]}var ml=Fh;function Sh(t,e){var r=ml(t,e);return pl(r)?r:void 0}var De=Sh;var Eh=De(he,"WeakMap"),ei=Eh;function Dh(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 gl=Dh;var Th=800,kh=16,Ih=Date.now;function Oh(t){var e=0,r=0;return function(){var n=Ih(),i=kh-(n-r);if(r=n,i>0){if(++e>=Th)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var yl=Oh;function Mh(t){return function(){return t}}var vl=Mh;var Ph=function(){try{var t=De(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ls=Ph;var Rh=Ls?function(t,e){return Ls(t,"toString",{configurable:!0,enumerable:!1,value:vl(e),writable:!0})}:_t,_l=Rh;var Bh=yl(_l),xl=Bh;var Lh=9007199254740991,Nh=/^(?:0|[1-9]\d*)$/;function Kh(t,e){var r=typeof t;return e=e??Lh,!!e&&(r=="number"||r!="symbol"&&Nh.test(t))&&t>-1&&t%1==0&&t<e}var hr=Kh;function zh(t,e){return t===e||t!==t&&e!==e}var pr=zh;var bl=Math.max;function Vh(t,e,r){return e=bl(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,s=bl(n.length-e,0),o=Array(s);++i<s;)o[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(o),gl(t,this,a)}}var wl=Vh;function $h(t,e){return xl(wl(t,e,_t),t+"")}var jl=$h;var Hh=9007199254740991;function Wh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Hh}var mr=Wh;function Uh(t){return t!=null&&mr(t.length)&&!Xn(t)}var xt=Uh;function Gh(t,e,r){if(!vt(r))return!1;var n=typeof e;return(n=="number"?xt(r)&&hr(e,r.length):n=="string"&&e in r)?pr(r[e],t):!1}var Ns=Gh;var Qh=Object.prototype;function qh(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Qh;return t===r}var Al=qh;function Yh(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Cl=Yh;var Jh="[object Arguments]";function Xh(t){return Ne(t)&&Le(t)==Jh}var Ks=Xh;var Fl=Object.prototype,Zh=Fl.hasOwnProperty,ep=Fl.propertyIsEnumerable,tp=Ks(function(){return arguments}())?Ks:function(t){return Ne(t)&&Zh.call(t,"callee")&&!ep.call(t,"callee")},gr=tp;function rp(){return!1}var Sl=rp;var El=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dl=El&&typeof module=="object"&&module&&!module.nodeType&&module,np=Dl&&Dl.exports===El,Tl=np?he.Buffer:void 0,ip=Tl?Tl.isBuffer:void 0,sp=ip||Sl,sn=sp;var op="[object Arguments]",ap="[object Array]",lp="[object Boolean]",up="[object Date]",cp="[object Error]",fp="[object Function]",dp="[object Map]",hp="[object Number]",pp="[object Object]",mp="[object RegExp]",gp="[object Set]",yp="[object String]",vp="[object WeakMap]",_p="[object ArrayBuffer]",xp="[object DataView]",bp="[object Float32Array]",wp="[object Float64Array]",jp="[object Int8Array]",Ap="[object Int16Array]",Cp="[object Int32Array]",Fp="[object Uint8Array]",Sp="[object Uint8ClampedArray]",Ep="[object Uint16Array]",Dp="[object Uint32Array]",X={};X[bp]=X[wp]=X[jp]=X[Ap]=X[Cp]=X[Fp]=X[Sp]=X[Ep]=X[Dp]=!0;X[op]=X[ap]=X[_p]=X[lp]=X[xp]=X[up]=X[cp]=X[fp]=X[dp]=X[hp]=X[pp]=X[mp]=X[gp]=X[yp]=X[vp]=!1;function Tp(t){return Ne(t)&&mr(t.length)&&!!X[Le(t)]}var kl=Tp;function kp(t){return function(e){return t(e)}}var ti=kp;var Il=typeof exports=="object"&&exports&&!exports.nodeType&&exports,on=Il&&typeof module=="object"&&module&&!module.nodeType&&module,Ip=on&&on.exports===Il,zs=Ip&&Jn.process,Op=function(){try{var t=on&&on.require&&on.require("util").types;return t||zs&&zs.binding&&zs.binding("util")}catch{}}(),Vs=Op;var Ol=Vs&&Vs.isTypedArray,Mp=Ol?ti(Ol):kl,ri=Mp;var Pp=Object.prototype,Rp=Pp.hasOwnProperty;function Bp(t,e){var r=se(t),n=!r&&gr(t),i=!r&&!n&&sn(t),s=!r&&!n&&!i&&ri(t),o=r||n||i||s,a=o?Cl(t.length,String):[],l=a.length;for(var u in t)(e||Rp.call(t,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||hr(u,l)))&&a.push(u);return a}var Ml=Bp;function Lp(t,e){return function(r){return t(e(r))}}var Pl=Lp;var Np=Pl(Object.keys,Object),Rl=Np;var Kp=Object.prototype,zp=Kp.hasOwnProperty;function Vp(t){if(!Al(t))return Rl(t);var e=[];for(var r in Object(t))zp.call(t,r)&&r!="constructor"&&e.push(r);return e}var Bl=Vp;function $p(t){return xt(t)?Ml(t):Bl(t)}var yr=$p;var Hp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wp=/^\w*$/;function Up(t,e){if(se(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||tt(t)?!0:Wp.test(t)||!Hp.test(t)||e!=null&&t in Object(e)}var vr=Up;var Gp=De(Object,"create"),nt=Gp;function Qp(){this.__data__=nt?nt(null):{},this.size=0}var Ll=Qp;function qp(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Nl=qp;var Yp="__lodash_hash_undefined__",Jp=Object.prototype,Xp=Jp.hasOwnProperty;function Zp(t){var e=this.__data__;if(nt){var r=e[t];return r===Yp?void 0:r}return Xp.call(e,t)?e[t]:void 0}var Kl=Zp;var em=Object.prototype,tm=em.hasOwnProperty;function rm(t){var e=this.__data__;return nt?e[t]!==void 0:tm.call(e,t)}var zl=rm;var nm="__lodash_hash_undefined__";function im(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=nt&&e===void 0?nm:e,this}var Vl=im;function _r(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_r.prototype.clear=Ll;_r.prototype.delete=Nl;_r.prototype.get=Kl;_r.prototype.has=zl;_r.prototype.set=Vl;var $s=_r;function sm(){this.__data__=[],this.size=0}var $l=sm;function om(t,e){for(var r=t.length;r--;)if(pr(t[r][0],e))return r;return-1}var bt=om;var am=Array.prototype,lm=am.splice;function um(t){var e=this.__data__,r=bt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():lm.call(e,r,1),--this.size,!0}var Hl=um;function cm(t){var e=this.__data__,r=bt(e,t);return r<0?void 0:e[r][1]}var Wl=cm;function fm(t){return bt(this.__data__,t)>-1}var Ul=fm;function dm(t,e){var r=this.__data__,n=bt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Gl=dm;function xr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}xr.prototype.clear=$l;xr.prototype.delete=Hl;xr.prototype.get=Wl;xr.prototype.has=Ul;xr.prototype.set=Gl;var wt=xr;var hm=De(he,"Map"),jt=hm;function pm(){this.size=0,this.__data__={hash:new $s,map:new(jt||wt),string:new $s}}var Ql=pm;function mm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ql=mm;function gm(t,e){var r=t.__data__;return ql(e)?r[typeof e=="string"?"string":"hash"]:r.map}var At=gm;function ym(t){var e=At(this,t).delete(t);return this.size-=e?1:0,e}var Yl=ym;function vm(t){return At(this,t).get(t)}var Jl=vm;function _m(t){return At(this,t).has(t)}var Xl=_m;function xm(t,e){var r=At(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Zl=xm;function br(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}br.prototype.clear=Ql;br.prototype.delete=Yl;br.prototype.get=Jl;br.prototype.has=Xl;br.prototype.set=Zl;var Vt=br;var bm="Expected a function";function Hs(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(bm);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Hs.Cache||Vt),r}Hs.Cache=Vt;var eu=Hs;var wm=500;function jm(t){var e=eu(t,function(n){return r.size===wm&&r.clear(),n}),r=e.cache;return e}var tu=jm;var Am=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cm=/\\(\\)?/g,Fm=tu(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Am,function(r,n,i,s){e.push(i?s.replace(Cm,"$1"):n||r)}),e}),ru=Fm;function Sm(t){return t==null?"":fl(t)}var nu=Sm;function Em(t,e){return se(t)?t:vr(t,e)?[t]:ru(nu(t))}var ni=Em;var Dm=1/0;function Tm(t){if(typeof t=="string"||tt(t))return t;var e=t+"";return e=="0"&&1/t==-Dm?"-0":e}var Ct=Tm;function km(t,e){e=ni(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ct(e[r++])];return r&&r==n?t:void 0}var wr=km;function Im(t,e,r){var n=t==null?void 0:wr(t,e);return n===void 0?r:n}var iu=Im;function Om(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var ii=Om;var su=Ce?Ce.isConcatSpreadable:void 0;function Mm(t){return se(t)||gr(t)||!!(su&&t&&t[su])}var ou=Mm;function au(t,e,r,n,i){var s=-1,o=t.length;for(r||(r=ou),i||(i=[]);++s<o;){var a=t[s];e>0&&r(a)?e>1?au(a,e-1,r,n,i):ii(i,a):n||(i[i.length]=a)}return i}var lu=au;function Pm(){this.__data__=new wt,this.size=0}var uu=Pm;function Rm(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var cu=Rm;function Bm(t){return this.__data__.get(t)}var fu=Bm;function Lm(t){return this.__data__.has(t)}var du=Lm;var Nm=200;function Km(t,e){var r=this.__data__;if(r instanceof wt){var n=r.__data__;if(!jt||n.length<Nm-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Vt(n)}return r.set(t,e),this.size=r.size,this}var hu=Km;function jr(t){var e=this.__data__=new wt(t);this.size=e.size}jr.prototype.clear=uu;jr.prototype.delete=cu;jr.prototype.get=fu;jr.prototype.has=du;jr.prototype.set=hu;var Ar=jr;function zm(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r<n;){var o=t[r];e(o,r,t)&&(s[i++]=o)}return s}var pu=zm;function Vm(){return[]}var mu=Vm;var $m=Object.prototype,Hm=$m.propertyIsEnumerable,gu=Object.getOwnPropertySymbols,Wm=gu?function(t){return t==null?[]:(t=Object(t),pu(gu(t),function(e){return Hm.call(t,e)}))}:mu,yu=Wm;function Um(t,e,r){var n=e(t);return se(t)?n:ii(n,r(t))}var vu=Um;function Gm(t){return vu(t,yr,yu)}var Ws=Gm;var Qm=De(he,"DataView"),si=Qm;var qm=De(he,"Promise"),oi=qm;var Ym=De(he,"Set"),ai=Ym;var _u="[object Map]",Jm="[object Object]",xu="[object Promise]",bu="[object Set]",wu="[object WeakMap]",ju="[object DataView]",Xm=rt(si),Zm=rt(jt),eg=rt(oi),tg=rt(ai),rg=rt(ei),$t=Le;(si&&$t(new si(new ArrayBuffer(1)))!=ju||jt&&$t(new jt)!=_u||oi&&$t(oi.resolve())!=xu||ai&&$t(new ai)!=bu||ei&&$t(new ei)!=wu)&&($t=function(t){var e=Le(t),r=e==Jm?t.constructor:void 0,n=r?rt(r):"";if(n)switch(n){case Xm:return ju;case Zm:return _u;case eg:return xu;case tg:return bu;case rg:return wu}return e});var Us=$t;var ng=he.Uint8Array,Gs=ng;var ig="__lodash_hash_undefined__";function sg(t){return this.__data__.set(t,ig),this}var Au=sg;function og(t){return this.__data__.has(t)}var Cu=og;function li(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Vt;++e<r;)this.add(t[e])}li.prototype.add=li.prototype.push=Au;li.prototype.has=Cu;var Fu=li;function ag(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Su=ag;function lg(t,e){return t.has(e)}var Eu=lg;var ug=1,cg=2;function fg(t,e,r,n,i,s){var o=r&ug,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var u=s.get(t),c=s.get(e);if(u&&c)return u==e&&c==t;var d=-1,f=!0,y=r&cg?new Fu:void 0;for(s.set(t,e),s.set(e,t);++d<a;){var w=t[d],b=e[d];if(n)var x=o?n(b,w,d,e,t,s):n(w,b,d,t,e,s);if(x!==void 0){if(x)continue;f=!1;break}if(y){if(!Su(e,function(h,v){if(!Eu(y,v)&&(w===h||i(w,h,r,n,s)))return y.push(v)})){f=!1;break}}else if(!(w===b||i(w,b,r,n,s))){f=!1;break}}return s.delete(t),s.delete(e),f}var ui=fg;function dg(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Du=dg;function hg(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Tu=hg;var pg=1,mg=2,gg="[object Boolean]",yg="[object Date]",vg="[object Error]",_g="[object Map]",xg="[object Number]",bg="[object RegExp]",wg="[object Set]",jg="[object String]",Ag="[object Symbol]",Cg="[object ArrayBuffer]",Fg="[object DataView]",ku=Ce?Ce.prototype:void 0,Qs=ku?ku.valueOf:void 0;function Sg(t,e,r,n,i,s,o){switch(r){case Fg:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Cg:return!(t.byteLength!=e.byteLength||!s(new Gs(t),new Gs(e)));case gg:case yg:case xg:return pr(+t,+e);case vg:return t.name==e.name&&t.message==e.message;case bg:case jg:return t==e+"";case _g:var a=Du;case wg:var l=n&pg;if(a||(a=Tu),t.size!=e.size&&!l)return!1;var u=o.get(t);if(u)return u==e;n|=mg,o.set(t,e);var c=ui(a(t),a(e),n,i,s,o);return o.delete(t),c;case Ag:if(Qs)return Qs.call(t)==Qs.call(e)}return!1}var Iu=Sg;var Eg=1,Dg=Object.prototype,Tg=Dg.hasOwnProperty;function kg(t,e,r,n,i,s){var o=r&Eg,a=Ws(t),l=a.length,u=Ws(e),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var f=a[d];if(!(o?f in e:Tg.call(e,f)))return!1}var y=s.get(t),w=s.get(e);if(y&&w)return y==e&&w==t;var b=!0;s.set(t,e),s.set(e,t);for(var x=o;++d<l;){f=a[d];var h=t[f],v=e[f];if(n)var p=o?n(v,h,f,e,t,s):n(h,v,f,t,e,s);if(!(p===void 0?h===v||i(h,v,r,n,s):p)){b=!1;break}x||(x=f=="constructor")}if(b&&!x){var m=t.constructor,_=e.constructor;m!=_&&"constructor"in t&&"constructor"in e&&!(typeof m=="function"&&m instanceof m&&typeof _=="function"&&_ instanceof _)&&(b=!1)}return s.delete(t),s.delete(e),b}var Ou=kg;var Ig=1,Mu="[object Arguments]",Pu="[object Array]",ci="[object Object]",Og=Object.prototype,Ru=Og.hasOwnProperty;function Mg(t,e,r,n,i,s){var o=se(t),a=se(e),l=o?Pu:Us(t),u=a?Pu:Us(e);l=l==Mu?ci:l,u=u==Mu?ci:u;var c=l==ci,d=u==ci,f=l==u;if(f&&sn(t)){if(!sn(e))return!1;o=!0,c=!1}if(f&&!c)return s||(s=new Ar),o||ri(t)?ui(t,e,r,n,i,s):Iu(t,e,l,r,n,i,s);if(!(r&Ig)){var y=c&&Ru.call(t,"__wrapped__"),w=d&&Ru.call(e,"__wrapped__");if(y||w){var b=y?t.value():t,x=w?e.value():e;return s||(s=new Ar),i(b,x,r,n,s)}}return f?(s||(s=new Ar),Ou(t,e,r,n,i,s)):!1}var Bu=Mg;function Lu(t,e,r,n,i){return t===e?!0:t==null||e==null||!Ne(t)&&!Ne(e)?t!==t&&e!==e:Bu(t,e,r,n,Lu,i)}var fi=Lu;var Pg=1,Rg=2;function Bg(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var l=a[0],u=t[l],c=a[1];if(o&&a[2]){if(u===void 0&&!(l in t))return!1}else{var d=new Ar;if(n)var f=n(u,c,l,t,e,d);if(!(f===void 0?fi(c,u,Pg|Rg,n,d):f))return!1}}return!0}var Nu=Bg;function Lg(t){return t===t&&!vt(t)}var di=Lg;function Ng(t){for(var e=yr(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,di(i)]}return e}var Ku=Ng;function Kg(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var hi=Kg;function zg(t){var e=Ku(t);return e.length==1&&e[0][2]?hi(e[0][0],e[0][1]):function(r){return r===t||Nu(r,t,e)}}var zu=zg;function Vg(t,e){return t!=null&&e in Object(t)}var Vu=Vg;function $g(t,e,r){e=ni(e,t);for(var n=-1,i=e.length,s=!1;++n<i;){var o=Ct(e[n]);if(!(s=t!=null&&r(t,o)))break;t=t[o]}return s||++n!=i?s:(i=t==null?0:t.length,!!i&&mr(i)&&hr(o,i)&&(se(t)||gr(t)))}var $u=$g;function Hg(t,e){return t!=null&&$u(t,e,Vu)}var Hu=Hg;var Wg=1,Ug=2;function Gg(t,e){return vr(t)&&di(e)?hi(Ct(t),e):function(r){var n=iu(r,t);return n===void 0&&n===e?Hu(r,t):fi(e,n,Wg|Ug)}}var Wu=Gg;function Qg(t){return function(e){return e==null?void 0:e[t]}}var Uu=Qg;function qg(t){return function(e){return wr(e,t)}}var Gu=qg;function Yg(t){return vr(t)?Uu(Ct(t)):Gu(t)}var Qu=Yg;function Jg(t){return typeof t=="function"?t:t==null?_t:typeof t=="object"?se(t)?Wu(t[0],t[1]):zu(t):Qu(t)}var qu=Jg;function Xg(t){return function(e,r,n){for(var i=-1,s=Object(e),o=n(e),a=o.length;a--;){var l=o[t?a:++i];if(r(s[l],l,s)===!1)break}return e}}var Yu=Xg;var Zg=Yu(),Ju=Zg;function ey(t,e){return t&&Ju(t,e,yr)}var Xu=ey;function ty(t,e){return function(r,n){if(r==null)return r;if(!xt(r))return t(r,n);for(var i=r.length,s=e?i:-1,o=Object(r);(e?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var Zu=ty;var ry=Zu(Xu),ec=ry;function ny(t,e){var r=-1,n=xt(t)?Array(t.length):[];return ec(t,function(i,s,o){n[++r]=e(i,s,o)}),n}var tc=ny;function iy(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var rc=iy;function sy(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,s=tt(t),o=e!==void 0,a=e===null,l=e===e,u=tt(e);if(!a&&!u&&!s&&t>e||s&&o&&l&&!a&&!u||n&&o&&l||!r&&l||!i)return 1;if(!n&&!s&&!u&&t<e||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!l)return-1}return 0}var nc=sy;function oy(t,e,r){for(var n=-1,i=t.criteria,s=e.criteria,o=i.length,a=r.length;++n<o;){var l=nc(i[n],s[n]);if(l){if(n>=a)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}var ic=oy;function ay(t,e,r){e.length?e=dr(e,function(s){return se(s)?function(o){return wr(o,s.length===1?s[0]:s)}:s}):e=[_t];var n=-1;e=dr(e,ti(qu));var i=tc(t,function(s,o,a){var l=dr(e,function(u){return u(s)});return{criteria:l,index:++n,value:s}});return rc(i,function(s,o){return ic(s,o,r)})}var sc=ay;var ly=jl(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Ns(t,e[0],e[1])?e=[]:r>2&&Ns(e[0],e[1],e[2])&&(e=[e[0]]),sc(t,lu(e,1),[])}),qs=ly;var uy=t=>{let e=t.split(mt),r=Nn();return r?e.flatMap(n=>da.test(n)?r.cut(n):[n]):E.splitCamelCase?[...e,...e.flatMap(Ca)]:e},pi=class{constructor(){this.indexedDocuments=new Map;this.minisearch=new Is(pi.options)}async loadCache(){let e=await de.getMinisearchCache();return e?(this.minisearch=Is.loadJS(e.data,pi.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(s=>[s.path,s.mtime])),n=e.filter(s=>!this.indexedDocuments.has(s.path)||this.indexedDocuments.get(s.path)!==s.mtime),i=[...this.indexedDocuments].filter(([s,o])=>!r.has(s)||r.get(s)!==o).map(s=>({path:s[0],mtime:s[1]}));return{toAdd:n,toRemove:i}}async addFromPaths(e){ie("Adding files",e);let r=(await Promise.all(e.map(async i=>await de.getDocument(i)))).filter(i=>!!i?.path);ie("Sorting documents to first index markdown"),r=qs(r,i=>i.path.endsWith(".md")?0:1),this.removeFromPaths(r.filter(i=>this.indexedDocuments.has(i.path)).map(i=>i.path));let n=Aa(r,500);for(let i of n){ie("Indexing into search engine",i),i.forEach(o=>this.indexedDocuments.set(o.path,o.mtime));let s=i.filter(o=>this.minisearch.has(o.path));this.removeFromPaths(s.map(o=>o.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[];ie("Starting search for",e);let n=this.minisearch.search(e.segmentsToStr(),{prefix:l=>l.length>=r.prefixLength,fuzzy:l=>l.length<=3?0:l.length<=5?.1:.2,combineWith:"AND",boost:{basename:E.weightBasename,directory:E.weightDirectory,aliases:E.weightBasename,headings1:E.weightH1,headings2:E.weightH2,headings3:E.weightH3}});if(ie("Found",n.length,"results"),e.extensions.length&&(n=n.filter(l=>{let u="."+l.id.split(".").pop();return e.extensions.some(c=>u.startsWith(c))})),e.query.path&&(n=n.filter(l=>e.query.path?.some(u=>l.id.toLowerCase().includes(u.toLowerCase())))),e.query.exclude.path&&(n=n.filter(l=>!e.query.exclude.path?.some(u=>l.id.toLowerCase().includes(u.toLowerCase())))),!n.length)return[];if(r.singleFilePath)return n.filter(l=>l.id===r.singleFilePath);E.hideExcluded?n=n.filter(l=>!(app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id))):n.forEach(l=>{app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id)&&(l.score/=10)});let i=e.getTags();for(let l of i)for(let u of n)(u.tags??[]).includes(l)&&(u.score*=100);ie("Sorting and limiting results"),n=n.sort((l,u)=>u.score-l.score).slice(0,50);let s=await Promise.all(n.map(async l=>await de.getDocument(l.id))),o=e.getExactTerms();o.length&&(ie("Filtering with quoted terms"),n=n.filter(l=>{let u=s.find(f=>f.path===l.id),c=u?.path.toLowerCase()??"",d=ws(u?.content??"").toLowerCase();return o.every(f=>d.includes(f)||c.includes(f))}));let a=e.query.exclude.text;return a.length&&(ie("Filtering with exclusions"),n=n.filter(l=>{let u=ws(s.find(c=>c.path===l.id)?.content??"").toLowerCase();return a.every(c=>!u.includes(c))})),ie("Deduping"),n=n.filter((l,u,c)=>c.findIndex(d=>d.id===l.id)===u),n}getMatches(e,r,n){let i=new Date().getTime(),s=null,o=[],a=0;for(;(s=r.exec(e))!==null;){if(++a>=100||new Date().getTime()-i>50){Fa("Stopped getMatches at",a,"results");break}let u=s[0];u&&o.push({match:u,offset:s.index})}let l=e.toLowerCase().indexOf(n.segmentsToStr());return l>-1&&o.unshift({offset:l,match:n.segmentsToStr()}),o}async getSuggestions(e,r){let n;E.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 o=>await de.getDocument(o.id)));return n.map(o=>{ie("Locating matches for",o.id);let a=i.find(d=>d.path===o.id);a||(console.warn(`Omnisearch - Note "${o.id}" not in the live cache`),a={content:"",basename:o.id,path:o.id});let l=[...Object.keys(o.match),...e.getExactTerms(),...e.getTags()].filter(d=>d.length>1||/\p{Emoji}/u.test(d));ie("Matching tokens:",l),ie("Getting matches locations...");let u=this.getMatches(a.content,yt(l),e);return ie("Matches:",u),re({score:o.score,foundWords:l,matches:u},a)})}async writeToCache(){await de.writeMinisearchCache(this.minisearch,this.indexedDocuments)}},Ys=pi;Ys.options={tokenize:uy,extractField:(e,r)=>{if(r==="directory"){let n=e.path.split("/");return n.pop(),n.join("/")}return e[r]},processTerm:e=>(E.ignoreDiacritics?et(e):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,r,n){n==="version_conflict"&&new oc.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}};var ce=new Ys;var Js=new Set;function ac(t){Js.add(t)}async function mi(){let t=[...Js].map(e=>e.path);t.length&&(ce.removeFromPaths(t),ce.addFromPaths(t),Js.clear())}function lc(t,e,r){let n=t.slice();return n[30]=e[r],n[32]=r,n}function cy(t){let e,r,n;return{c(){e=O("button"),e.textContent="Create note"},m(i,s){z(i,e,s),r||(n=Te(e,"click",t[8]),r=!0)},p:ne,d(i){i&&K(e),r=!1,n()}}}function fy(t){let e,r=E.showCreateButton&&cy(t);return{c(){r&&r.c(),e=Jt()},m(n,i){r&&r.m(n,i),z(n,e,i)},p(n,i){E.showCreateButton&&r.p(n,i)},d(n){r&&r.d(n),n&&K(e)}}}function uc(t){let e,r,n;return{c(){e=O("div"),r=Fe("\u23F3 Work in progress: "),n=Fe(t[3]),ke(e,"text-align","center"),ke(e,"color","var(--text-accent)"),ke(e,"margin-top","10px")},m(i,s){z(i,e,s),k(e,r),k(e,n)},p(i,s){s[0]&8&&St(n,i[3])},d(i){i&&K(e)}}}function cc(t){let e,r;function n(...i){return t[14](t[32],...i)}return e=new $a({props:{selected:t[32]===t[0],note:t[30]}}),e.$on("mousemove",n),e.$on("click",t[6]),e.$on("auxclick",t[15]),{c(){Se(e.$$.fragment)},m(i,s){we(e,i,s),r=!0},p(i,s){t=i;let o={};s[0]&1&&(o.selected=t[32]===t[0]),s[0]&4&&(o.note=t[30]),e.$set(o)},i(i){r||(Q(e.$$.fragment,i),r=!0)},o(i){q(e.$$.fragment,i),r=!1},d(i){ge(e,i)}}}function dy(t){let e;return{c(){e=Fe("Searching...")},m(r,n){z(r,e,n)},p:ne,d(r){r&&K(e)}}}function hy(t){let e,r=E.simpleSearch&&t[1].split(mt).some(dc),n,i=r&&fc(t);return{c(){e=Fe(`We found 0 result for your search here.
|
|
`),i&&i.c(),n=Jt()},m(s,o){z(s,e,o),i&&i.m(s,o),z(s,n,o)},p(s,o){o[0]&2&&(r=E.simpleSearch&&s[1].split(mt).some(dc)),r?i||(i=fc(s),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(s){s&&K(e),i&&i.d(s),s&&K(n)}}}function fc(t){let e,r,n;return{c(){e=O("br"),r=U(),n=O("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more
|
|
characters.`,ke(n,"color","var(--text-accent)"),ke(n,"font-size","small")},m(i,s){z(i,e,s),z(i,r,s),z(i,n,s)},d(i){i&&K(e),i&&K(r),i&&K(n)}}}function py(t){let e,r,n,i=t[2],s=[];for(let c=0;c<i.length;c+=1)s[c]=cc(lc(t,i,c));let o=c=>q(s[c],1,1,()=>{s[c]=null});function a(c,d){if(!c[2].length&&c[1]&&!c[4])return hy;if(c[4])return dy}let l=a(t,[-1,-1]),u=l&&l(t);return{c(){for(let c=0;c<s.length;c+=1)s[c].c();e=U(),r=O("div"),u&&u.c(),ke(r,"text-align","center")},m(c,d){for(let f=0;f<s.length;f+=1)s[f].m(c,d);z(c,e,d),z(c,r,d),u&&u.m(r,null),n=!0},p(c,d){if(d[0]&197){i=c[2];let f;for(f=0;f<i.length;f+=1){let y=lc(c,i,f);s[f]?(s[f].p(y,d),Q(s[f],1)):(s[f]=cc(y),s[f].c(),Q(s[f],1),s[f].m(e.parentNode,e))}for(Dt(),f=i.length;f<s.length;f+=1)o(f);Tt()}l===(l=a(c,d))&&u?u.p(c,d):(u&&u.d(1),u=l&&l(c),u&&(u.c(),u.m(r,null)))},i(c){if(!n){for(let d=0;d<i.length;d+=1)Q(s[d]);n=!0}},o(c){s=s.filter(Boolean);for(let d=0;d<s.length;d+=1)q(s[d]);n=!1},d(c){un(s,c),c&&K(e),c&&K(r),u&&u.d()}}}function my(t){let e,r,n,i,s,o,a,l,u,c,d,f,y,w,b,x,h,v,p,m,_,g,j,A,C,F,D,P,T,N={initialValue:t[1],placeholder:"Omnisearch - Vault",$$slots:{default:[fy]},$$scope:{ctx:t}};e=new Hn({props:N}),t[12](e),e.$on("input",t[13]);let $=t[3]&&uc(t);return i=new Wn({props:{$$slots:{default:[py]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment),r=U(),$&&$.c(),n=U(),Se(i.$$.fragment),s=U(),o=O("div"),a=O("div"),a.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',l=U(),u=O("div"),u.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
|
|
<span>to cycle history</span>`,c=U(),d=O("div"),d.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',f=U(),y=O("div"),y.innerHTML=`<span class="prompt-instruction-command">tab</span>
|
|
<span>to switch to In-File Search</span>`,w=U(),b=O("div"),x=O("span"),x.textContent=`${Vn()} \u21B5`,h=U(),v=O("span"),v.textContent="to open in a new pane",p=U(),m=O("div"),m.innerHTML=`<span class="prompt-instruction-command">shift \u21B5</span>
|
|
<span>to create</span>`,_=U(),g=O("div"),g.innerHTML=`<span class="prompt-instruction-command">ctrl shift \u21B5</span>
|
|
<span>to create in a new pane</span>`,j=U(),A=O("div"),A.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
|
|
<span>to insert a link</span>`,C=U(),F=O("div"),F.innerHTML=`<span class="prompt-instruction-command">ctrl+h</span>
|
|
<span>to toggle excerpts</span>`,D=U(),P=O("div"),P.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',B(a,"class","prompt-instruction"),B(u,"class","prompt-instruction"),B(d,"class","prompt-instruction"),B(y,"class","prompt-instruction"),B(x,"class","prompt-instruction-command"),B(b,"class","prompt-instruction"),B(m,"class","prompt-instruction"),B(g,"class","prompt-instruction"),B(A,"class","prompt-instruction"),B(F,"class","prompt-instruction"),B(P,"class","prompt-instruction"),B(o,"class","prompt-instructions")},m(M,S){we(e,M,S),z(M,r,S),$&&$.m(M,S),z(M,n,S),we(i,M,S),z(M,s,S),z(M,o,S),k(o,a),k(o,l),k(o,u),k(o,c),k(o,d),k(o,f),k(o,y),k(o,w),k(o,b),k(b,x),k(b,h),k(b,v),k(o,p),k(o,m),k(o,_),k(o,g),k(o,j),k(o,A),k(o,C),k(o,F),k(o,D),k(o,P),T=!0},p(M,S){let V={};S[0]&2&&(V.initialValue=M[1]),S[1]&4&&(V.$$scope={dirty:S,ctx:M}),e.$set(V),M[3]?$?$.p(M,S):($=uc(M),$.c(),$.m(n.parentNode,n)):$&&($.d(1),$=null);let te={};S[0]&23|S[1]&4&&(te.$$scope={dirty:S,ctx:M}),i.$set(te)},i(M){T||(Q(e.$$.fragment,M),Q(i.$$.fragment,M),T=!0)},o(M){q(e.$$.fragment,M),q(i.$$.fragment,M),T=!1},d(M){t[12](null),ge(e,M),M&&K(r),$&&$.d(M),M&&K(n),ge(i,M),M&&K(s),M&&K(o)}}}var dc=t=>t.length<3;function gy(t,e,r){let n,i;ln(t,pt,S=>r(11,i=S));let{modal:s}=e,{previousQuery:o}=e,a=0,l=0,u,c=[],d,f="",y=!0,w;Tr(async()=>{H.enable("vault"),H.on("vault","enter",p),H.on("vault","create-note",A),H.on("vault","open-in-new-pane",m),H.on("vault","insert-link",C),H.on("vault","tab",F),H.on("vault","arrow-up",()=>D(-1)),H.on("vault","arrow-down",()=>D(1)),H.on("vault","prev-search-history",b),H.on("vault","next-search-history",x),await mi(),E.showPreviousQueryResults&&r(9,o=(await de.getSearchHistory())[0])}),kr(()=>{H.disable("vault")});async function b(){let S=(await de.getSearchHistory()).filter(V=>V);++l>=S.length&&(l=0),r(1,u=S[l]),w?.setInputValue(u)}async function x(){let S=(await de.getSearchHistory()).filter(V=>V);--l<0&&(l=S.length?S.length-1:0),r(1,u=S[l]),w?.setInputValue(u)}async function h(){d=new zt(u),r(2,c=await ce.getSuggestions(d)),r(0,a=0),await P()}function v(S){!n||(S?.ctrlKey?m():p(),s.close())}function p(){!n||(g(n),s.close())}function m(){!n||(g(n,!0),s.close())}function _(){u&&de.addToSearchHistory(u)}function g(S,V=!1){_(),Un(S,V)}async function j(S){await A()}async function A(S){if(u){try{await Oa(u,S?.newLeaf)}catch(V){new Ft.Notice(V.message);return}s.close()}}function C(){if(!n)return;let S=app.vault.getMarkdownFiles().find(st=>st.path===n.path),V=app.workspace.getActiveFile(),te=app.workspace.getActiveViewOfType(Ft.MarkdownView);if(!te?.editor){new Ft.Notice("Omnisearch - Error - No active editor",3e3);return}let Wt;S&&V?Wt=app.fileManager.generateMarkdownLink(S,V.path):Wt=`[[${n.basename}.${Kt(n.path)}]]`;let it=te.editor.getCursor();te.editor.replaceRange(Wt,it,it),it.ch+=Wt.length,te.editor.setCursor(it),s.close()}function F(){if(!(n&&(en(n?.path)||!n?.matches.length)))if(_(),s.close(),n){let S=app.vault.getAbstractFileByPath(n.path);S&&S instanceof Ft.TFile&&new Cr(app,S,u).open()}else{let S=app.workspace.getActiveViewOfType(Ft.MarkdownView);S&&new Cr(app,S.file,u).open()}}function D(S){r(0,a=zn(a+S,c.length)),P()}async function P(){await ot(),n&&activeWindow.document.querySelector(`[data-result-id="${n.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function T(S){He[S?"unshift":"push"](()=>{w=S,r(5,w)})}let N=S=>r(1,u=S.detail),$=(S,V)=>r(0,a=S),M=S=>{S.button==1&&m()};return t.$$set=S=>{"modal"in S&&r(10,s=S.modal),"previousQuery"in S&&r(9,o=S.previousQuery)},t.$$.update=()=>{if(t.$$.dirty[0]&514){e:r(1,u=u??o)}if(t.$$.dirty[0]&2){e:u?(r(4,y=!0),h().then(()=>{r(4,y=!1)})):(r(4,y=!1),r(2,c=[]))}if(t.$$.dirty[0]&5){e:n=c[a]}if(t.$$.dirty[0]&2048){e:switch(i){case Pe.LoadingCache:r(3,f="Loading cache...");break;case Pe.ReadingFiles:r(3,f="Reading files...");break;case Pe.IndexingFiles:r(3,f="Indexing files...");break;case Pe.WritingCache:h(),r(3,f="Updating cache...");break;default:h(),r(3,f="");break}}},[a,u,c,f,y,w,v,m,j,o,s,i,T,N,$,M]}var hc=class extends pe{constructor(e){super();ye(this,e,gy,my,fe,{modal:10,previousQuery:9},null,[-1,-1])}},pc=hc;var yc=be(require("obsidian"));function yy(t){let e,r=t[2].replace(t[3],gt)+"";return{c(){e=O("div"),B(e,"class","omnisearch-result__body")},m(n,i){z(n,e,i),e.innerHTML=r},p(n,i){i&12&&r!==(r=n[2].replace(n[3],gt)+"")&&(e.innerHTML=r)},d(n){n&&K(e)}}}function vy(t){let e,r;return e=new Gn({props:{id:t[0].toString(),selected:t[1],$$slots:{default:[yy]},$$scope:{ctx:t}}}),e.$on("mousemove",t[6]),e.$on("click",t[7]),e.$on("auxclick",t[8]),{c(){Se(e.$$.fragment)},m(n,i){we(e,n,i),r=!0},p(n,[i]){let s={};i&1&&(s.id=n[0].toString()),i&2&&(s.selected=n[1]),i&524&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(Q(e.$$.fragment,n),r=!0)},o(n){q(e.$$.fragment,n),r=!1},d(n){ge(e,n)}}}function _y(t,e,r){let n,i,{offset:s}=e,{note:o}=e,{index:a=0}=e,{selected:l=!1}=e;function u(f){Me.call(this,t,f)}function c(f){Me.call(this,t,f)}function d(f){Me.call(this,t,f)}return t.$$set=f=>{"offset"in f&&r(4,s=f.offset),"note"in f&&r(5,o=f.note),"index"in f&&r(0,a=f.index),"selected"in f&&r(1,l=f.selected)},t.$$.update=()=>{if(t.$$.dirty&32){e:r(3,n=yt(o.foundWords))}if(t.$$.dirty&48){e:r(2,i=ur(o?.content??"",s))}},[a,l,i,n,s,o,u,c,d]}var mc=class extends pe{constructor(e){super();ye(this,e,_y,vy,fe,{offset:4,note:5,index:0,selected:1})}},gc=mc;function vc(t,e,r){let n=t.slice();return n[19]=e[r],n[21]=r,n}function xy(t){let e;return{c(){e=O("div"),e.textContent="We found 0 result for your search here.",ke(e,"text-align","center")},m(r,n){z(r,e,n)},p:ne,i:ne,o:ne,d(r){r&&K(e)}}}function by(t){let e,r,n=t[4],i=[];for(let o=0;o<n.length;o+=1)i[o]=_c(vc(t,n,o));let s=o=>q(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Jt()},m(o,a){for(let l=0;l<i.length;l+=1)i[l].m(o,a);z(o,e,a),r=!0},p(o,a){if(a&120){n=o[4];let l;for(l=0;l<n.length;l+=1){let u=vc(o,n,l);i[l]?(i[l].p(u,a),Q(i[l],1)):(i[l]=_c(u),i[l].c(),Q(i[l],1),i[l].m(e.parentNode,e))}for(Dt(),l=n.length;l<i.length;l+=1)s(l);Tt()}},i(o){if(!r){for(let a=0;a<n.length;a+=1)Q(i[a]);r=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)q(i[a]);r=!1},d(o){un(i,o),o&&K(e)}}}function _c(t){let e,r;function n(...i){return t[11](t[21],...i)}return e=new gc({props:{offset:t[19],note:t[3],index:t[21],selected:t[21]===t[5]}}),e.$on("mousemove",n),e.$on("click",t[12]),e.$on("auxclick",t[13]),{c(){Se(e.$$.fragment)},m(i,s){we(e,i,s),r=!0},p(i,s){t=i;let o={};s&16&&(o.offset=t[19]),s&8&&(o.note=t[3]),s&32&&(o.selected=t[21]===t[5]),e.$set(o)},i(i){r||(Q(e.$$.fragment,i),r=!0)},o(i){q(e.$$.fragment,i),r=!1},d(i){ge(e,i)}}}function wy(t){let e,r,n,i,s=[by,xy],o=[];function a(l,u){return l[4].length&&l[3]?0:1}return e=a(t,-1),r=o[e]=s[e](t),{c(){r.c(),n=Jt()},m(l,u){o[e].m(l,u),z(l,n,u),i=!0},p(l,u){let c=e;e=a(l,u),e===c?o[e].p(l,u):(Dt(),q(o[c],1,1,()=>{o[c]=null}),Tt(),r=o[e],r?r.p(l,u):(r=o[e]=s[e](l),r.c()),Q(r,1),r.m(n.parentNode,n))},i(l){i||(Q(r),i=!0)},o(l){q(r),i=!1},d(l){o[e].d(l),l&&K(n)}}}function jy(t){let e;return{c(){e=O("span"),e.textContent="to close"},m(r,n){z(r,e,n)},d(r){r&&K(e)}}}function Ay(t){let e;return{c(){e=O("span"),e.textContent="to go back to Vault Search"},m(r,n){z(r,e,n)},d(r){r&&K(e)}}}function Cy(t){let e,r,n,i,s,o,a,l,u,c,d,f,y,w,b,x,h,v,p,m;e=new Hn({props:{placeholder:"Omnisearch - File",initialValue:t[1]}}),e.$on("input",t[10]),n=new Wn({props:{$$slots:{default:[wy]},$$scope:{ctx:t}}});function _(A,C){return A[0]?Ay:jy}let g=_(t,-1),j=g(t);return{c(){Se(e.$$.fragment),r=U(),Se(n.$$.fragment),i=U(),s=O("div"),o=O("div"),o.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',a=U(),l=O("div"),l.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',u=U(),c=O("div"),c.innerHTML=`<span class="prompt-instruction-command">tab</span>
|
|
<span>to switch to Vault Search</span>`,d=U(),f=O("div"),y=O("span"),y.textContent="esc",w=U(),j.c(),b=U(),x=O("div"),h=O("span"),h.textContent=`${Vn()} \u21B5`,v=U(),p=O("span"),p.textContent="to open in a new pane",B(o,"class","prompt-instruction"),B(l,"class","prompt-instruction"),B(c,"class","prompt-instruction"),B(y,"class","prompt-instruction-command"),B(f,"class","prompt-instruction"),B(h,"class","prompt-instruction-command"),B(x,"class","prompt-instruction"),B(s,"class","prompt-instructions")},m(A,C){we(e,A,C),z(A,r,C),we(n,A,C),z(A,i,C),z(A,s,C),k(s,o),k(s,a),k(s,l),k(s,u),k(s,c),k(s,d),k(s,f),k(f,y),k(f,w),j.m(f,null),k(s,b),k(s,x),k(x,h),k(x,v),k(x,p),m=!0},p(A,[C]){let F={};C&2&&(F.initialValue=A[1]),e.$set(F);let D={};C&4194360&&(D.$$scope={dirty:C,ctx:A}),n.$set(D),g!==(g=_(A,C))&&(j.d(1),j=g(A),j&&(j.c(),j.m(f,null)))},i(A){m||(Q(e.$$.fragment,A),Q(n.$$.fragment,A),m=!0)},o(A){q(e.$$.fragment,A),q(n.$$.fragment,A),m=!1},d(A){ge(e,A),A&&K(r),ge(n,A),A&&K(i),A&&K(s),j.d()}}}function Fy(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 Sy(t,e,r){let{modal:n}=e,{parent:i=null}=e,{singleFilePath:s=""}=e,{previousQuery:o}=e,a,l=[],u=0,c,d;Tr(()=>{H.enable("infile"),H.on("infile","enter",x),H.on("infile","open-in-new-pane",b),H.on("infile","arrow-up",()=>y(-1)),H.on("infile","arrow-down",()=>y(1)),H.on("infile","tab",h)}),kr(()=>{H.disable("infile")});function f(g){let j=[],A=-1,C=0;for(;;){let F=Fy(g,A,Jr);if(!F.length||(A=F.last().offset,j.push(F),++C>100))break}return j}function y(g){r(5,u=zn(u+g,l.length)),w()}async function w(){await ot(),document.querySelector(`[data-result-id="${u}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function b(){return x(!0)}async function x(g=!1){if(c){n.close(),i&&i.close(),await Un(c,g);let j=app.workspace.getActiveViewOfType(yc.MarkdownView);if(!j)return;let A=l[u]??0,C=j.editor.offsetToPos(A);C.ch=0,j.editor.setCursor(C),j.editor.scrollIntoView({from:{line:C.line-10,ch:0},to:{line:C.line+10,ch:0}})}}function h(){new Ht(app,a??o).open(),n.close()}let v=g=>r(2,a=g.detail),p=(g,j)=>r(5,u=g),m=g=>x(g.ctrlKey),_=g=>{g.button==1&&x(!0)};return t.$$set=g=>{"modal"in g&&r(7,n=g.modal),"parent"in g&&r(0,i=g.parent),"singleFilePath"in g&&r(8,s=g.singleFilePath),"previousQuery"in g&&r(1,o=g.previousQuery)},t.$$.update=()=>{if(t.$$.dirty&2){e:r(2,a=o??"")}if(t.$$.dirty&772){e:(async()=>{a&&(r(9,d=new zt(a)),r(3,c=(await ce.getSuggestions(d,{singleFilePath:s}))[0]??null)),r(5,u=0),await w()})()}if(t.$$.dirty&8){e:if(c){let g=f(c.matches);r(4,l=g.map(j=>Math.round((j.first().offset+j.last().offset)/2)))}}},[i,o,a,c,l,u,x,n,s,d,v,p,m,_]}var xc=class extends pe{constructor(e){super();ye(this,e,Sy,Cy,fe,{modal:7,parent:0,singleFilePath:8,previousQuery:1})}},bc=xc;var Xs=class extends wc.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",r=>{r.preventDefault(),H.emit("arrow-down")}),this.scope.register([],"ArrowUp",r=>{r.preventDefault(),H.emit("arrow-up")});for(let r of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let n of["Ctrl","Mod"])this.scope.register([n],r.k,i=>{this.app.vault.getConfig("vimMode")&&H.emit("arrow-"+r.dir)});for(let r of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let n of["Ctrl","Mod"])this.scope.register([n],r.k,i=>{this.app.vault.getConfig("vimMode")&&H.emit("arrow-"+r.dir)});this.scope.register(["Mod"],"Enter",r=>{r.preventDefault(),H.emit("open-in-new-pane")}),this.scope.register(["Alt"],"Enter",r=>{r.preventDefault(),H.emit("insert-link")}),this.scope.register(["Shift"],"Enter",r=>{r.preventDefault(),H.emit("create-note")}),this.scope.register(["Ctrl","Shift"],"Enter",r=>{r.preventDefault(),H.emit("create-note",{newLeaf:!0})}),this.scope.register([],"Enter",r=>{ga()||(r.preventDefault(),H.emit("enter"))}),this.scope.register([],"Tab",r=>{r.preventDefault(),H.emit("tab")}),this.scope.register(["Alt"],"ArrowDown",r=>{r.preventDefault(),H.emit("next-search-history")}),this.scope.register(["Alt"],"ArrowUp",r=>{r.preventDefault(),H.emit("prev-search-history")}),this.scope.register(["Ctrl"],"H",r=>{H.emit(Ln.ToggleExcerpts)})}},Ht=class extends Xs{constructor(e,r){super(e);let n=new pc({target:this.modalEl,props:{modal:this,previousQuery:r}});this.onClose=()=>{n.$destroy()}}},Cr=class extends Xs{constructor(e,r,n="",i){super(e);let s=new bc({target:this.modalEl,props:{modal:this,singleFilePath:r.path,parent:i,previousQuery:n}});i&&i.containerEl.toggleVisibility(!1),this.onClose=()=>{i&&i.containerEl.toggleVisibility(!0),s.$destroy()}}};var jc=!1,gi=[];function Ey(t){return t.map(e=>{let{score:r,path:n,basename:i,foundWords:s,matches:o,content:a}=e,l=ur(a,o[0]?.offset??-1);return{score:r,path:n,basename:i,foundWords:s,matches:o.map(u=>({match:u.match,offset:u.offset})),excerpt:l}})}async function Dy(t){let e=new zt(t),r=await ce.getSuggestions(e);return Ey(r)}function Ty(t){gi.push(t),jc&&t()}function ky(t){gi=gi.filter(e=>e!==t)}function Ac(){jc=!0,gi.forEach(t=>t())}var Zs={search:Dy,registerOnIndexed:Ty,unregisterOnIndexed:ky,refreshIndex:mi};var eo=class extends Fr.Plugin{async onload(){await ca(this),await Iy(),await lr.clearOldDatabases(),Oy(this),E.ribbonIcon&&this.addRibbonButton(),this.addSettingTab(new _s(this)),H.disable("vault"),H.disable("infile"),H.on("global",Ln.ToggleExcerpts,()=>{Lt.set(!E.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Ht(app).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(e,r)=>{r.file&&new Cr(app,r.file).open()}}),app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",e=>{Zr(e.path)&&(ie("Indexing new file",e.path),ce.addFromPaths([e.path]))})),this.registerEvent(this.app.vault.on("delete",e=>{ie("Removing file",e.path),de.removeFromLiveCache(e.path),ce.removeFromPaths([e.path])})),this.registerEvent(this.app.vault.on("modify",async e=>{Zr(e.path)&&(ie("Updating file",e.path),await de.addToLiveCache(e.path),ac(e))})),this.registerEvent(this.app.vault.on("rename",async(e,r)=>{Zr(e.path)&&(ie("Renaming file",e.path),de.removeFromLiveCache(r),de.addToLiveCache(e.path),ce.removeFromPaths([r]),await ce.addFromPaths([e.path]))})),this.executeFirstLaunchTasks(),await this.populateIndex()})}executeFirstLaunchTasks(){let e="1.10.1";if(E.welcomeMessage!==e){let r=new DocumentFragment;r.createSpan({},n=>{n.innerHTML="\u{1F50E} Omnisearch now requires the <strong>Text Extractor</strong> plugin to index PDF and images. See Omnisearch settings for more information."}),new Fr.Notice(r,2e4)}E.welcomeMessage=e,this.saveData(E)}async onunload(){delete globalThis.omnisearch,await Ee.clearCache()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new Ht(app).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}async populateIndex(){console.time("Omnisearch - Indexing total time"),pt.set(Pe.ReadingFiles);let e=app.vault.getFiles().filter(n=>Zr(n.path));console.log(`Omnisearch - ${e.length} files total`),console.log(`Omnisearch - Cache is ${ht()?"enabled":"disabled"}`),ht()&&(console.time("Omnisearch - Loading index from cache"),pt.set(Pe.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})));ht()&&(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&&ht()&&new Fr.Notice(`Omnisearch - ${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),pt.set(Pe.IndexingFiles),ce.removeFromPaths(r.toRemove.map(n=>n.path)),await ce.addFromPaths(r.toAdd.map(n=>n.path)),(r.toRemove.length||r.toAdd.length)&&ht()&&(pt.set(Pe.WritingCache),E.useCache=!1,ue(this),await ce.writeToCache(),E.useCache=!0,ue(this)),console.timeEnd("Omnisearch - Indexing total time"),r.toAdd.length>=1e3&&new Fr.Notice("Omnisearch - Your files have been indexed."),pt.set(Pe.Done),Ac()}};async function Iy(){let t=[`${app.vault.configDir}/plugins/omnisearch/searchIndex.json`,`${app.vault.configDir}/plugins/omnisearch/notesCache.json`,`${app.vault.configDir}/plugins/omnisearch/notesCache.data`,`${app.vault.configDir}/plugins/omnisearch/searchIndex.data`,`${app.vault.configDir}/plugins/omnisearch/historyCache.json`,`${app.vault.configDir}/plugins/omnisearch/pdfCache.data`];for(let e of t)if(await app.vault.adapter.exists(e))try{await app.vault.adapter.remove(e)}catch{}}function Oy(t){t.registerObsidianProtocolHandler("omnisearch",e=>{new Ht(app,e.query).open()}),globalThis.omnisearch=Zs,app.plugins.plugins.omnisearch.api=Zs}
|