1
0
Fork 0
digital-art-composition-book/.obsidian/plugins/note-gallery/main.js

20 lines
72 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
*/
"use strict";var Yn=Object.create;var Te=Object.defineProperty,jn=Object.defineProperties,Qn=Object.getOwnPropertyDescriptor,Xn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertyNames,Re=Object.getOwnPropertySymbols,Zn=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable;var Zt=(e,r,t)=>r in e?Te(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,X=(e,r)=>{for(var t in r||(r={}))st.call(r,t)&&Zt(e,t,r[t]);if(Re)for(var t of Re(r))er.call(r,t)&&Zt(e,t,r[t]);return e},ne=(e,r)=>jn(e,Xn(r));var Ne=(e,r)=>{var t={};for(var o in e)st.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&Re)for(var o of Re(e))r.indexOf(o)<0&&er.call(e,o)&&(t[o]=e[o]);return t};var ut=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),eo=(e,r)=>{for(var t in r)Te(e,t,{get:r[t],enumerable:!0})},tr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Jn(r))!st.call(e,s)&&s!==t&&Te(e,s,{get:()=>r[s],enumerable:!(o=Qn(r,s))||o.enumerable});return e};var ct=(e,r,t)=>(t=e!=null?Yn(Zn(e)):{},tr(r||!e||!e.__esModule?Te(t,"default",{value:e,enumerable:!0}):t,e)),to=e=>tr(Te({},"__esModule",{value:!0}),e);var K=(e,r,t)=>new Promise((o,s)=>{var a=v=>{try{p(t.next(v))}catch(P){s(P)}},h=v=>{try{p(t.throw(v))}catch(P){s(P)}},p=v=>v.done?o(v.value):Promise.resolve(v.value).then(a,h);p((t=t.apply(e,r)).next())});var qe=ut((zr,Mt)=>{(function(e){if(typeof zr=="object"&&typeof Mt!="undefined")Mt.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r;typeof window!="undefined"?r=window:typeof global!="undefined"?r=global:typeof self!="undefined"?r=self:r=this,r.localforage=e()}})(function(){var e,r,t;return function o(s,a,h){function p(x,f){if(!a[x]){if(!s[x]){var m=typeof require=="function"&&require;if(!f&&m)return m(x,!0);if(v)return v(x,!0);var y=new Error("Cannot find module '"+x+"'");throw y.code="MODULE_NOT_FOUND",y}var _=a[x]={exports:{}};s[x][0].call(_.exports,function(b){var S=s[x][1][b];return p(S||b)},_,_.exports,o,s,a,h)}return a[x].exports}for(var v=typeof require=="function"&&require,P=0;P<h.length;P++)p(h[P]);return p}({1:[function(o,s,a){(function(h){"use strict";var p=h.MutationObserver||h.WebKitMutationObserver,v;if(p){var P=0,x=new p(b),f=h.document.createTextNode("");x.observe(f,{characterData:!0}),v=function(){f.data=P=++P%2}}else if(!h.setImmediate&&typeof h.MessageChannel!="undefined"){var m=new h.MessageChannel;m.port1.onmessage=b,v=function(){m.port2.postMessage(0)}}else"document"in h&&"onreadystatechange"in h.document.createElement("script")?v=function(){var C=h.document.createElement("script");C.onreadystatechange=function(){b(),C.onreadystatechange=null,C.parentNode.removeChild(C),C=null},h.document.documentElement.appendChild(C)}:v=function(){setTimeout(b,0)};var y,_=[];function b(){y=!0;for(var C,M,N=_.length;N;){for(M=_,_=[],C=-1;++C<N;)M[C]();N=_.length}y=!1}s.exports=S;function S(C){_.push(C)===1&&!y&&v()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,s,a){"use strict";var h=o(1);function p(){}var v={},P=["REJECTED"],x=["FULFILLED"],f=["PENDING"];s.exports=m;function m(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,w!==p&&S(this,w)}m.prototype.catch=function(w){return this.then(null,w)},m.prototype.then=function(w,k){if(typeof w!="function"&&this.state===x||typeof k!="function"&&this.state===P)return this;var A=new this.constructor(p);if(this.state!==f){var L=this.state===x?w:k;_(A,L,this.outcome)}else this.queue.push(new y(A,w,k));return A};function y(w,k,A){this.promise=w,typeof k=="function"&&(this.onFulfilled=k,this.callFulfilled=this.otherCallFulfilled),typeof A=="function"&&(this.onRejected=A,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(w){v.resolve(this.promise,w)},y.prototype.otherCallFulfilled=function(w){_(this.promise,this.onFulfilled,w)},y.prototype.callRejected=function(w){v.reject(this.promise,w)},y.prototype.otherCallRejected=function(w){_(this.promise,this.onRejected,w)};function _(w,k,A){h(function(){var L;try{L=k(A)}catch(z){return v.reject(w,z)}L===w?v.reject(w,new TypeError("Cannot resolve promise with itself")):v.resolve(w,L)})}v.resolve=function(w,k){var A=C(b,k);if(A.status==="error")return v.reject(w,A.value);var L=A.value;if(L)S(w,L);else{w.state=x,w.outcome=k;for(var z=-1,$=w.queue.length;++z<$;)w.queue[z].callFulfilled(k)}return w},v.reject=function(w,k){w.state=P,w.outcome=k;for(var A=-1,L=w.queue.length;++A<L;)w.queue[A].callRejected(k);return w};function b(w){var k=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof k=="function")return function(){k.apply(w,arguments)}}function S(w,k){var A=!1;function L(G){A||(A=!0,v.reject(w,G))}function z(G){A||(A=!0,v.resolve(w,G))}function $(){k(z,L)}var Y=C($);Y.status==="error"&&L(Y.value)}function C(w,k){var A={};try{A.value=w(k),A.status="success"}catch(L){A.status="error",A.value=L}return A}m.resolve=M;function M(w){return w instanceof this?w:v.resolve(new this(p),w)}m.reject=N;function N(w){var k=new this(p);return v.reject(k,w)}m.all=H;function H(w){var k=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=w.length,L=!1;if(!A)return this.resolve([]);for(var z=new Array(A),$=0,Y=-1,G=new this(p);++Y<A;)Z(w[Y],Y);return G;function Z(oe,ie){k.resolve(oe).then(Xe,function(ye){L||(L=!0,v.reject(G,ye))});function Xe(ye){z[ie]=ye,++$===A&&!L&&(L=!0,v.resolve(G,z))}}}m.race=O;function O(w){var k=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=w.length,L=!1;if(!A)return this.resolve([]);for(var z=-1,$=new this(p);++z<A;)Y(w[z]);return $;function Y(G){k.resolve(G).then(function(Z){L||(L=!0,v.resolve($,Z))},function(Z){L||(L=!0,v.reject($,Z))})}}},{1:1}],3:[function(o,s,a){(function(h){"use strict";typeof h.Promise!="function"&&(h.Promise=o(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(o,s,a){"use strict";var h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function p(n,u){if(!(n instanceof u))throw new TypeError("Cannot call a class as a function")}function v(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(n){return}}var P=v();function x(){try{if(!P||!P.open)return!1;var n=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),u=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!n||u)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function f(n,u){n=n||[],u=u||{};try{return new Blob(n,u)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<n.length;d+=1)l.append(n[d]);return l.getBlob(u.type)}}typeof Promise=="undefined"&&o(3);var m=Promise;function y(n,u){u&&n.then(function(i){u(null,i)},function(i){u(i)})}function _(n,u,i){typeof u=="function"&&n.then(u),typeof i=="function"&&n.catch(i)}function b(n){return typeof n!="string"&&(console.warn(n+" used as a key, but it is not a string."),n=String(n)),n}function S(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var C="local-forage-detect-blob-support",M=void 0,N={},H=Object.prototype.toString,O="readonly",w="readwrite";function k(n){for(var u=n.length,i=new ArrayBuffer(u),l=new Uint8Array(i),d=0;d<u;d++)l[d]=n.charCodeAt(d);return i}function A(n){return new m(function(u){var i=n.transaction(C,w),l=f([""]);i.objectStore(C).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),u(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);u(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function L(n){return typeof M=="boolean"?m.resolve(M):A(n).then(function(u){return M=u,M})}function z(n){var u=N[n.name],i={};i.promise=new m(function(l,d){i.resolve=l,i.reject=d}),u.deferredOperations.push(i),u.dbReady?u.dbReady=u.dbReady.then(function(){return i.promise}):u.dbReady=i.promise}function $(n){var u=N[n.name],i=u.deferredOperations.pop();if(i)return i.resolve(),i.promise}function Y(n,u){var i=N[n.name],l=i.deferredOperations.pop();if(l)return l.reject(u),l.promise}function G(n,u){return new m(function(i,l){if(N[n.name]=N[n.name]||Nt(),n.db)if(u)z(n),n.db.close();else return i(n.db);var d=[n.name];u&&d.push(n.version);var c=P.open.apply(P,d);u&&(c.onupgradeneeded=function(g){var E=c.result;try{E.createObjectStore(n.storeName),g.oldVersion<=1&&E.createObjectStore(C)}catch(I){if(I.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+g.oldVersion+" to version "+g.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw I}}),c.onerror=function(g){g.preventDefault(),l(c.error)},c.onsuccess=function(){var g=c.result;g.onversionchange=function(E){E.target.close()},i(g),$(n)}})}function Z(n){return G(n,!1)}function oe(n){return G(n,!0)}function ie(n,u){if(!n.db)return!0;var i=!n.db.objectStoreNames.contains(n.storeName),l=n.version<n.db.version,d=n.version>n.db.version;if(l&&(n.version!==u&&console.warn('The database "'+n.name+`" can't be downgraded from version `+n.db.version+" to version "+n.version+"."),n.version=n.db.version),d||i){if(i){var c=n.db.version+1;c>n.version&&(n.version=c)}return!0}return!1}function Xe(n){return new m(function(u,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");u({__local_forage_encoded_blob:!0,data:c,type:n.type})},l.readAsBinaryString(n)})}function ye(n){var u=k(atob(n.data));return f([u],{type:n.type})}function Rt(n){return n&&n.__local_forage_encoded_blob}function Yr(n){var u=this,i=u._initReady().then(function(){var l=N[u._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return _(i,n,n),i}function jr(n){z(n);for(var u=N[n.name],i=u.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return n.db=null,Z(n).then(function(c){return n.db=c,ie(n)?oe(n):c}).then(function(c){n.db=u.db=c;for(var g=0;g<i.length;g++)i[g]._dbInfo.db=c}).catch(function(c){throw Y(n,c),c})}function ae(n,u,i,l){l===void 0&&(l=1);try{var d=n.db.transaction(n.storeName,u);i(null,d)}catch(c){if(l>0&&(!n.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return m.resolve().then(function(){if(!n.db||c.name==="NotFoundError"&&!n.db.objectStoreNames.contains(n.storeName)&&n.version<=n.db.version)return n.db&&(n.version=n.db.version+1),oe(n)}).then(function(){return jr(n).then(function(){ae(n,u,i,l-1)})}).catch(i);i(c)}}function Nt(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Qr(n){var u=this,i={db:null};if(n)for(var l in n)i[l]=n[l];var d=N[i.name];d||(d=Nt(),N[i.name]=d),d.forages.push(u),u._initReady||(u._initReady=u.ready,u.ready=Yr);var c=[];function g(){return m.resolve()}for(var E=0;E<d.forages.length;E++){var I=d.forages[E];I!==u&&c.push(I._initReady().catch(g))}var T=d.forages.slice(0);return m.all(c).then(function(){return i.db=d.db,Z(i)}).then(function(D){return i.db=D,ie(i,u._defaultConfig.version)?oe(i):D}).then(function(D){i.db=d.db=D,u._dbInfo=i;for(var R=0;R<T.length;R++){var U=T[R];U!==u&&(U._dbInfo.db=i.db,U._dbInfo.version=i.version)}})}function Xr(n,u){var i=this;n=b(n);var l=new m(function(d,c){i.ready().then(function(){ae(i._dbInfo,O,function(g,E){if(g)return c(g);try{var I=E.objectStore(i._dbInfo.storeName),T=I.get(n);T.onsuccess=function(){var D=T.result;D===void 0&&(D=null),Rt(D)&&(D=ye(D)),d(D)},T.onerror=function(){c(T.error)}}catch(D){c(D)}})}).catch(c)});return y(l,u),l}function Jr(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){ae(i._dbInfo,O,function(g,E){if(g)return c(g);try{var I=E.objectStore(i._dbInfo.storeName),T=I.openCursor(),D=1;T.onsuccess=function(){var R=T.result;if(R){var U=R.value;Rt(U)&&(U=ye(U));var W=n(U,R.key,D++);W!==void 0?d(W):R.continue()}else d()},T.onerror=function(){c(T.error)}}catch(R){c(R)}})}).catch(c)});return y(l,u),l}function Zr(n,u,i){var l=this;n=b(n);var d=new m(function(c,g){var E;l.ready().then(function(){return E=l._dbInfo,H.call(u)==="[object Blob]"?L(E.db).then(function(I){return I?u:Xe(u)}):u}).then(function(I){ae(l._dbInfo,w,function(T,D){if(T)return g(T);try{var R=D.objectStore(l._dbInfo.storeName);I===null&&(I=void 0);var U=R.put(I,n);D.oncomplete=function(){I===void 0&&(I=null),c(I)},D.onabort=D.onerror=function(){var W=U.error?U.error:U.transaction.error;g(W)}}catch(W){g(W)}})}).catch(g)});return y(d,i),d}function en(n,u){var i=this;n=b(n);var l=new m(function(d,c){i.ready().then(function(){ae(i._dbInfo,w,function(g,E){if(g)return c(g);try{var I=E.objectStore(i._dbInfo.storeName),T=I.delete(n);E.oncomplete=function(){d()},E.onerror=function(){c(T.error)},E.onabort=function(){var D=T.error?T.error:T.transaction.error;c(D)}}catch(D){c(D)}})}).catch(c)});return y(l,u),l}function tn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){ae(u._dbInfo,w,function(c,g){if(c)return d(c);try{var E=g.objectStore(u._dbInfo.storeName),I=E.clear();g.oncomplete=function(){l()},g.onabort=g.onerror=function(){var T=I.error?I.error:I.transaction.error;d(T)}}catch(T){d(T)}})}).catch(d)});return y(i,n),i}function rn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){ae(u._dbInfo,O,function(c,g){if(c)return d(c);try{var E=g.objectStore(u._dbInfo.storeName),I=E.count();I.onsuccess=function(){l(I.result)},I.onerror=function(){d(I.error)}}catch(T){d(T)}})}).catch(d)});return y(i,n),i}function nn(n,u){var i=this,l=new m(function(d,c){if(n<0){d(null);return}i.ready().then(function(){ae(i._dbInfo,O,function(g,E){if(g)return c(g);try{var I=E.objectStore(i._dbInfo.storeName),T=!1,D=I.openKeyCursor();D.onsuccess=function(){var R=D.result;if(!R){d(null);return}n===0||T?d(R.key):(T=!0,R.advance(n))},D.onerror=function(){c(D.error)}}catch(R){c(R)}})}).catch(c)});return y(l,u),l}function on(n){var u=this,i=new m(function(l,d){u.ready().then(function(){ae(u._dbInfo,O,function(c,g){if(c)return d(c);try{var E=g.objectStore(u._dbInfo.storeName),I=E.openKeyCursor(),T=[];I.onsuccess=function(){var D=I.result;if(!D){l(T);return}T.push(D.key),D.continue()},I.onerror=function(){d(I.error)}}catch(D){d(D)}})}).catch(d)});return y(i,n),i}function an(n,u){u=S.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var l=this,d;if(!n.name)d=m.reject("Invalid arguments");else{var c=n.name===i.name&&l._dbInfo.db,g=c?m.resolve(l._dbInfo.db):Z(n).then(function(E){var I=N[n.name],T=I.forages;I.db=E;for(var D=0;D<T.length;D++)T[D]._dbInfo.db=E;return E});n.storeName?d=g.then(function(E){if(!!E.objectStoreNames.contains(n.storeName)){var I=E.version+1;z(n);var T=N[n.name],D=T.forages;E.close();for(var R=0;R<D.length;R++){var U=D[R];U._dbInfo.db=null,U._dbInfo.version=I}var W=new m(function(V,Q){var j=P.open(n.name,I);j.onerror=function(ee){var Ie=j.result;Ie.close(),Q(ee)},j.onupgradeneeded=function(){var ee=j.result;ee.deleteObjectStore(n.storeName)},j.onsuccess=function(){var ee=j.result;ee.close(),V(ee)}});return W.then(function(V){T.db=V;for(var Q=0;Q<D.length;Q++){var j=D[Q];j._dbInfo.db=V,$(j._dbInfo)}}).catch(function(V){throw(Y(n,V)||m.resolve()).catch(function(){}),V})}}):d=g.then(function(E){z(n);var I=N[n.name],T=I.forages;E.close();for(var D=0;D<T.length;D++){var R=T[D];R._dbInfo.db=null}var U=new m(function(W,V){var Q=P.deleteDatabase(n.name);Q.onerror=function(){var j=Q.result;j&&j.close(),V(Q.error)},Q.onblocked=function(){console.warn('dropInstance blocked for database "'+n.name+'" until all open connections are closed')},Q.onsuccess=function(){var j=Q.result;j&&j.close(),W(j)}});return U.then(function(W){I.db=W;for(var V=0;V<T.length;V++){var Q=T[V];$(Q._dbInfo)}}).catch(function(W){throw(Y(n,W)||m.resolve()).catch(function(){}),W})})}return y(d,u),d}var sn={_driver:"asyncStorage",_initStorage:Qr,_support:x(),iterate:Jr,getItem:Xr,setItem:Zr,removeItem:en,clear:tn,length:rn,key:nn,keys:on,dropInstance:an};function un(){return typeof openDatabase=="function"}var le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cn="~~local_forage_type~",Lt=/^~~local_forage_type~([^~]+)~/,Me="__lfsc__:",Je=Me.length,Ze="arbf",et="blob",kt="si08",Ot="ui08",Ft="uic8",Bt="si16",Ht="si32",zt="ur16",Ut="ui32",Wt="fl32",Vt="fl64",Kt=Je+Ze.length,$t=Object.prototype.toString;function qt(n){var u=n.length*.75,i=n.length,l,d=0,c,g,E,I;n[n.length-1]==="="&&(u--,n[n.length-2]==="="&&u--);var T=new ArrayBuffer(u),D=new Uint8Array(T);for(l=0;l<i;l+=4)c=le.indexOf(n[l]),g=le.indexOf(n[l+1]),E=le.indexOf(n[l+2]),I=le.indexOf(n[l+3]),D[d++]=c<<2|g>>4,D[d++]=(g&15)<<4|E>>2,D[d++]=(E&3)<<6|I&63;return T}function tt(n){var u=new Uint8Array(n),i="",l;for(l=0;l<u.length;l+=3)i+=le[u[l]>>2],i+=le[(u[l]&3)<<4|u[l+1]>>4],i+=le[(u[l+1]&15)<<2|u[l+2]>>6],i+=le[u[l+2]&63];return u.length%3===2?i=i.substring(0,i.length-1)+"=":u.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function ln(n,u){var i="";if(n&&(i=$t.call(n)),n&&(i==="[object ArrayBuffer]"||n.buffer&&$t.call(n.buffer)==="[object ArrayBuffer]")){var l,d=Me;n instanceof ArrayBuffer?(l=n,d+=Ze):(l=n.buffer,i==="[object Int8Array]"?d+=kt:i==="[object Uint8Array]"?d+=Ot:i==="[object Uint8ClampedArray]"?d+=Ft:i==="[object Int16Array]"?d+=Bt:i==="[object Uint16Array]"?d+=zt:i==="[object Int32Array]"?d+=Ht:i==="[object Uint32Array]"?d+=Ut:i==="[object Float32Array]"?d+=Wt:i==="[object Float64Array]"?d+=Vt:u(new Error("Failed to get type for BinaryArray"))),u(d+tt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var g=cn+n.type+"~"+tt(this.result);u(Me+et+g)},c.readAsArrayBuffer(n)}else try{u(JSON.stringify(n))}catch(g){console.error("Couldn't convert value into a JSON string: ",n),u(null,g)}}function fn(n){if(n.substring(0,Je)!==Me)return JSON.parse(n);var u=n.substring(Kt),i=n.substring(Je,Kt),l;if(i===et&&Lt.test(u)){var d=u.match(Lt);l=d[1],u=u.substring(d[0].length)}var c=qt(u);switch(i){case Ze:return c;case et:return f([c],{type:l});case kt:return new Int8Array(c);case Ot:return new Uint8Array(c);case Ft:return new Uint8ClampedArray(c);case Bt:return new Int16Array(c);case zt:return new Uint16Array(c);case Ht:return new Int32Array(c);case Ut:return new Uint32Array(c);case Wt:return new Float32Array(c);case Vt:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var rt={serialize:ln,deserialize:fn,stringToBuffer:qt,bufferToString:tt};function Gt(n,u,i,l){n.executeSql("CREATE TABLE IF NOT EXISTS "+u.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function dn(n){var u=this,i={db:null};if(n)for(var l in n)i[l]=typeof n[l]!="string"?n[l].toString():n[l];var d=new m(function(c,g){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return g(E)}i.db.transaction(function(E){Gt(E,i,function(){u._dbInfo=i,c()},function(I,T){g(T)})},g)});return i.serializer=rt,d}function fe(n,u,i,l,d,c){n.executeSql(i,l,d,function(g,E){E.code===E.SYNTAX_ERR?g.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[u.storeName],function(I,T){T.rows.length?c(I,E):Gt(I,u,function(){I.executeSql(i,l,d,c)},c)},c):c(g,E)},c)}function pn(n,u){var i=this;n=b(n);var l=new m(function(d,c){i.ready().then(function(){var g=i._dbInfo;g.db.transaction(function(E){fe(E,g,"SELECT * FROM "+g.storeName+" WHERE key = ? LIMIT 1",[n],function(I,T){var D=T.rows.length?T.rows.item(0).value:null;D&&(D=g.serializer.deserialize(D)),d(D)},function(I,T){c(T)})})}).catch(c)});return y(l,u),l}function hn(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){var g=i._dbInfo;g.db.transaction(function(E){fe(E,g,"SELECT * FROM "+g.storeName,[],function(I,T){for(var D=T.rows,R=D.length,U=0;U<R;U++){var W=D.item(U),V=W.value;if(V&&(V=g.serializer.deserialize(V)),V=n(V,W.key,U+1),V!==void 0){d(V);return}}d()},function(I,T){c(T)})})}).catch(c)});return y(l,u),l}function Yt(n,u,i,l){var d=this;n=b(n);var c=new m(function(g,E){d.ready().then(function(){u===void 0&&(u=null);var I=u,T=d._dbInfo;T.serializer.serialize(u,function(D,R){R?E(R):T.db.transaction(function(U){fe(U,T,"INSERT OR REPLACE INTO "+T.storeName+" (key, value) VALUES (?, ?)",[n,D],function(){g(I)},function(W,V){E(V)})},function(U){if(U.code===U.QUOTA_ERR){if(l>0){g(Yt.apply(d,[n,I,i,l-1]));return}E(U)}})})}).catch(E)});return y(c,i),c}function mn(n,u,i){return Yt.apply(this,[n,u,i,1])}function _n(n,u){var i=this;n=b(n);var l=new m(function(d,c){i.ready().then(function(){var g=i._dbInfo;g.db.transaction(function(E){fe(E,g,"DELETE FROM "+g.storeName+" WHERE key = ?",[n],function(){d()},function(I,T){c(T)})})}).catch(c)});return y(l,u),l}function vn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(g){fe(g,c,"DELETE FROM "+c.storeName,[],function(){l()},function(E,I){d(I)})})}).catch(d)});return y(i,n),i}function yn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(g){fe(g,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(E,I){var T=I.rows.item(0).c;l(T)},function(E,I){d(I)})})}).catch(d)});return y(i,n),i}function gn(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){var g=i._dbInfo;g.db.transaction(function(E){fe(E,g,"SELECT key FROM "+g.storeName+" WHERE id = ? LIMIT 1",[n+1],function(I,T){var D=T.rows.length?T.rows.item(0).key:null;d(D)},function(I,T){c(T)})})}).catch(c)});return y(l,u),l}function bn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(g){fe(g,c,"SELECT key FROM "+c.storeName,[],function(E,I){for(var T=[],D=0;D<I.rows.length;D++)T.push(I.rows.item(D).key);l(T)},function(E,I){d(I)})})}).catch(d)});return y(i,n),i}function En(n){return new m(function(u,i){n.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var g=[],E=0;E<c.rows.length;E++)g.push(c.rows.item(E).name);u({db:n,storeNames:g})},function(d,c){i(c)})},function(l){i(l)})})}function wn(n,u){u=S.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var l=this,d;return n.name?d=new m(function(c){var g;n.name===i.name?g=l._dbInfo.db:g=openDatabase(n.name,"","",0),n.storeName?c({db:g,storeNames:[n.storeName]}):c(En(g))}).then(function(c){return new m(function(g,E){c.db.transaction(function(I){function T(W){return new m(function(V,Q){I.executeSql("DROP TABLE IF EXISTS "+W,[],function(){V()},function(j,ee){Q(ee)})})}for(var D=[],R=0,U=c.storeNames.length;R<U;R++)D.push(T(c.storeNames[R]));m.all(D).then(function(){g()}).catch(function(W){E(W)})},function(I){E(I)})})}):d=m.reject("Invalid arguments"),y(d,u),d}var Sn={_driver:"webSQLStorage",_initStorage:dn,_support:un(),iterate:hn,getItem:pn,setItem:mn,removeItem:_n,clear:vn,length:yn,key:gn,keys:bn,dropInstance:wn};function Cn(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(n){return!1}}function jt(n,u){var i=n.name+"/";return n.storeName!==u.storeName&&(i+=n.storeName+"/"),i}function In(){var n="_localforage_support_test";try{return localStorage.setItem(n,!0),localStorage.removeItem(n),!1}catch(u){return!0}}function Tn(){return!In()||localStorage.length>0}function Pn(n){var u=this,i={};if(n)for(var l in n)i[l]=n[l];return i.keyPrefix=jt(n,u._defaultConfig),Tn()?(u._dbInfo=i,i.serializer=rt,m.resolve()):m.reject()}function Dn(n){var u=this,i=u.ready().then(function(){for(var l=u._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return y(i,n),i}function xn(n,u){var i=this;n=b(n);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+n);return c&&(c=d.serializer.deserialize(c)),c});return y(l,u),l}function Mn(n,u){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,g=c.length,E=localStorage.length,I=1,T=0;T<E;T++){var D=localStorage.key(T);if(D.indexOf(c)===0){var R=localStorage.getItem(D);if(R&&(R=d.serializer.deserialize(R)),R=n(R,D.substring(g),I++),R!==void 0)return R}}});return y(l,u),l}function An(n,u){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(n)}catch(g){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return y(l,u),l}function Rn(n){var u=this,i=u.ready().then(function(){for(var l=u._dbInfo,d=localStorage.length,c=[],g=0;g<d;g++){var E=localStorage.key(g);E.indexOf(l.keyPrefix)===0&&c.push(E.substring(l.keyPrefix.length))}return c});return y(i,n),i}function Nn(n){var u=this,i=u.keys().then(function(l){return l.length});return y(i,n),i}function Ln(n,u){var i=this;n=b(n);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+n)});return y(l,u),l}function kn(n,u,i){var l=this;n=b(n);var d=l.ready().then(function(){u===void 0&&(u=null);var c=u;return new m(function(g,E){var I=l._dbInfo;I.serializer.serialize(u,function(T,D){if(D)E(D);else try{localStorage.setItem(I.keyPrefix+n,T),g(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&E(R),E(R)}})})});return y(d,i),d}function On(n,u){if(u=S.apply(this,arguments),n=typeof n!="function"&&n||{},!n.name){var i=this.config();n.name=n.name||i.name,n.storeName=n.storeName||i.storeName}var l=this,d;return n.name?d=new m(function(c){n.storeName?c(jt(n,l._defaultConfig)):c(n.name+"/")}).then(function(c){for(var g=localStorage.length-1;g>=0;g--){var E=localStorage.key(g);E.indexOf(c)===0&&localStorage.removeItem(E)}}):d=m.reject("Invalid arguments"),y(d,u),d}var Fn={_driver:"localStorageWrapper",_initStorage:Pn,_support:Cn(),iterate:Mn,getItem:xn,setItem:kn,removeItem:Ln,clear:Dn,length:Nn,key:An,keys:Rn,dropInstance:On},Bn=function(u,i){return u===i||typeof u=="number"&&typeof i=="number"&&isNaN(u)&&isNaN(i)},Hn=function(u,i){for(var l=u.length,d=0;d<l;){if(Bn(u[d],i))return!0;d++}return!1},Qt=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},Ce={},Xt={},ge={INDEXEDDB:sn,WEBSQL:Sn,LOCALSTORAGE:Fn},zn=[ge.INDEXEDDB._driver,ge.WEBSQL._driver,ge.LOCALSTORAGE._driver],Ae=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ae),Un={description:"",driver:zn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Wn(n,u){n[u]=function(){var i=arguments;return n.ready().then(function(){return n[u].apply(n,i)})}}function ot(){for(var n=1;n<arguments.length;n++){var u=arguments[n];if(u)for(var i in u)u.hasOwnProperty(i)&&(Qt(u[i])?arguments[0][i]=u[i].slice():arguments[0][i]=u[i])}return arguments[0]}var Vn=function(){function n(u){p(this,n);for(var i in ge)if(ge.hasOwnProperty(i)){var l=ge[i],d=l._driver;this[i]=d,Ce[d]||this.defineDriver(l)}this._defaultConfig=ot({},Un),this._config=ot({},this._defaultConfig,u),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return n.prototype.config=function(i){if((typeof i=="undefined"?"undefined":h(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},n.prototype.defineDriver=function(i,l,d){var c=new m(function(g,E){try{var I=i._driver,T=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){E(T);return}for(var D=nt.concat("_initStorage"),R=0,U=D.length;R<U;R++){var W=D[R],V=!Hn(Ae,W);if((V||i[W])&&typeof i[W]!="function"){E(T);return}}var Q=function(){for(var Ie=function(qn){return function(){var Gn=new Error("Method "+qn+" is not implemented by the current driver"),Jt=m.reject(Gn);return y(Jt,arguments[arguments.length-1]),Jt}},it=0,$n=Ae.length;it<$n;it++){var at=Ae[it];i[at]||(i[at]=Ie(at))}};Q();var j=function(Ie){Ce[I]&&console.info("Redefining LocalForage driver: "+I),Ce[I]=i,Xt[I]=Ie,g()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(j,E):j(!!i._support):j(!0)}catch(ee){E(ee)}});return _(c,l,d),c},n.prototype.driver=function(){return this._driver||null},n.prototype.getDriver=function(i,l,d){var c=Ce[i]?m.resolve(Ce[i]):m.reject(new Error("Driver not found."));return _(c,l,d),c},n.prototype.getSerializer=function(i){var l=m.resolve(rt);return _(l,i),l},n.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return _(d,i,i),d},n.prototype.setDriver=function(i,l,d){var c=this;Qt(i)||(i=[i]);var g=this._getSupportedDrivers(i);function E(){c._config.driver=c.driver()}function I(R){return c._extend(R),E(),c._ready=c._initStorage(c._config),c._ready}function T(R){return function(){var U=0;function W(){for(;U<R.length;){var V=R[U];return U++,c._dbInfo=null,c._ready=null,c.getDriver(V).then(I).catch(W)}E();var Q=new Error("No available storage method found.");return c._driverSet=m.reject(Q),c._driverSet}return W()}}var D=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.resolve();return this._driverSet=D.then(function(){var R=g[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(U){c._driver=U._driver,E(),c._wrapLibraryMethodsWithReady(),c._initDriver=T(g)})}).catch(function(){E();var R=new Error("No available storage method found.");return c._driverSet=m.reject(R),c._driverSet}),_(this._driverSet,l,d),this._driverSet},n.prototype.supports=function(i){return!!Xt[i]},n.prototype._extend=function(i){ot(this,i)},n.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var g=i[d];this.supports(g)&&l.push(g)}return l},n.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=nt.length;i<l;i++)Wn(this,nt[i])},n.prototype.createInstance=function(i){return new n(i)},n}(),Kn=new Vn;s.exports=Kn},{3:3}]},{},[4])(4)})});var Wr=ut((Ge,Ur)=>{(function(e,r){typeof Ge=="object"&&typeof Ur!="undefined"?r(Ge,qe()):typeof define=="function"&&define.amd?define(["exports","localforage"],r):r(e.localforageGetItems=e.localforageGetItems||{},e.localforage)})(Ge,function(e,r){"use strict";r="default"in r?r.default:r;function t(_){return t.result?t.result:!_||typeof _.getSerializer!="function"?Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!")):(t.result=_.getSerializer(),t.result)}function o(_,b){return b&&_.then(function(S){b(null,S)},function(S){b(S)}),_}function s(_,b){var S=this,C=S.getItem(_).then(function(M){return{key:_,value:M}});return o(C,b),C}function a(_){var b=this,S=new Promise(function(C,M){for(var N=[],H=0,O=_.length;H<O;H++)N.push(s.call(b,_[H]));Promise.all(N).then(function(w){for(var k={},A=0,L=w.length;A<L;A++){var z=w[A];k[z.key]=z.value}C(k)}).catch(M)});return S}function h(){var _=this,b={};return _.iterate(function(S,C){b[C]=S}).then(function(){return b})}function p(){if(typeof IDBKeyRange!="undefined")return IDBKeyRange;if(typeof webkitIDBKeyRange!="undefined")return webkitIDBKeyRange;if(typeof mozIDBKeyRange!="undefined")return mozIDBKeyRange}var v=p();function P(_){_=_.slice();var b=this;function S(M,N){return M<N?-1:M>N?1:0}var C=new Promise(function(M,N){b.ready().then(function(){var H=b._dbInfo,O=H.db.transaction(H.storeName,"readonly").objectStore(H.storeName),w=_.sort(S),k=v.bound(_[0],_[_.length-1],!1,!1),A=O.openCursor(k),L={},z=0;A.onsuccess=function(){var $=A.result;if(!$){M(L);return}for(var Y=$.key;Y>w[z];)if(z++,z===w.length){M(L);return}if(Y===w[z]){var G=$.value;G===void 0&&(G=null),L[Y]=G,$.continue()}else $.continue(w[z])},A.onerror=function(){N(A.error)}}).catch(N)});return C}function x(_){var b=this,S=new Promise(function(C,M){b.ready().then(function(){return t(b)}).then(function(N){var H=b._dbInfo;H.db.transaction(function(O){for(var w=new Array(_.length),k=0,A=_.length;k<A;k++)w[k]="?";O.executeSql("SELECT * FROM "+H.storeName+" WHERE (key IN ("+w.join(",")+"))",_,function(L,z){for(var $={},Y=z.rows,G=0,Z=Y.length;G<Z;G++){var oe=Y.item(G),ie=oe.value;ie&&(ie=N.deserialize(ie)),$[oe.key]=ie}C($)},function(L,z){M(z)})})}).catch(M)});return S}function f(_,b){var S=this,C;if(!arguments.length||_===null)C=h.apply(S);else{var M=S.driver();M===S.INDEXEDDB?C=P.apply(S,arguments):M===S.WEBSQL?C=x.apply(S,arguments):C=a.apply(S,arguments)}return o(C,b),C}function m(_){var b=Object.getPrototypeOf(_);b&&(b.getItems=f,b.getItems.indexedDB=function(){return P.apply(this,arguments)},b.getItems.websql=function(){return x.apply(this,arguments)},b.getItems.generic=function(){return a.apply(this,arguments)})}var y=m(r);e.localforageGetItems=f,e.extendPrototype=m,e.extendPrototypeResult=y,e.getItemsGeneric=a,Object.defineProperty(e,"__esModule",{value:!0})})});var Kr=ut((Ye,Vr)=>{(function(e,r){typeof Ye=="object"&&typeof Vr!="undefined"?r(Ye,qe()):typeof define=="function"&&define.amd?define(["exports","localforage"],r):r(e.localforageSetItems=e.localforageSetItems||{},e.localforage)})(Ye,function(e,r){"use strict";r="default"in r?r.default:r;function t(f){return t.result?t.result:!f||typeof f.getSerializer!="function"?Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!")):(t.result=f.getSerializer(),t.result)}function o(f,m){m&&f.then(function(y){m(null,y)},function(y){m(y)})}function s(f,m,y,_){function b(O,w){var k=O||w;return(!O||typeof O!="function")&&typeof k=="string"&&(O=function(L){return L[k]}),O}var S=[];if(Object.prototype.toString.call(f)==="[object Array]"){m=b(m,"key"),y=b(y,"value");for(var C=0,M=f.length;C<M;C++){var N=f[C];S.push(_(m(N),y(N)))}}else for(var H in f)f.hasOwnProperty(H)&&S.push(_(H,f[H]));return S}function a(f,m,y,_){var b=this,S=b.ready().then(function(){return new Promise(function(C,M){var N=b._dbInfo,H=N.db.transaction(N.storeName,"readwrite"),O=H.objectStore(N.storeName),w;H.oncomplete=function(){C(f)},H.onabort=H.onerror=function(A){M(w||A.target)};function k(A){var L=A.target||this;w=L.error||L.transaction.error,M(w)}s(f,m,y,function(A,L){L===null&&(L=void 0);var z=O.put(L,A);z.onerror=k})})});return o(S,_),S}function h(f,m,y,_){var b=this,S=new Promise(function(C,M){b.ready().then(function(){return t(b)}).then(function(N){var H=b._dbInfo;H.db.transaction(function(O){var w="INSERT OR REPLACE INTO "+H.storeName+" (key, value) VALUES (?, ?)",k=s(f,m,y,function(A,L){return new Promise(function(z,$){N.serialize(L,function(Y,G){G?$(G):O.executeSql(w,[A,Y],function(){z()},function(Z,oe){$(oe)})})})});Promise.all(k).then(function(){C(f)},M)},function(O){M(O)})}).catch(M)});return o(S,_),S}function p(f,m,y,_){var b=this,S=s(f,m,y,function(M,N){return b.setItem(M,N)}),C=Promise.all(S);return o(C,_),C}function v(f,m,y,_){var b=this,S=b.driver();return S===b.INDEXEDDB?a.call(b,f,m,y,_):S===b.WEBSQL?h.call(b,f,m,y,_):p.call(b,f,m,y,_)}function P(f){var m=Object.getPrototypeOf(f);m&&(m.setItems=v,m.setItems.indexedDB=function(){return a.apply(this,arguments)},m.setItems.websql=function(){return h.apply(this,arguments)},m.setItems.generic=function(){return p.apply(this,arguments)})}var x=P(r);e.setItemsGeneric=p,e.localforageSetItems=v,e.extendPrototype=P,e.extendPrototypeResult=x,Object.defineProperty(e,"__esModule",{value:!0})})});var Ao={};eo(Ao,{default:()=>Qe,extractValue:()=>Gr});module.exports=to(Ao);function Le(e,r){let t=Object.keys(r).map(o=>ro(e,o,r[o]));return t.length===1?t[0]:function(){t.forEach(o=>o())}}function ro(e,r,t){let o=e[r],s=e.hasOwnProperty(r),a=t(o);return o&&Object.setPrototypeOf(a,o),Object.setPrototypeOf(h,a),e[r]=h,p;function h(...v){return a===o&&e[r]===h&&p(),a.apply(this,v)}function p(){e[r]===h&&(s?e[r]=o:delete e[r]),a!==o&&(a=o,Object.setPrototypeOf(h,o||Function))}}var ce=require("obsidian");var Hr=require("obsidian");var Be,F,ar,no,me,rr,sr,lt,ur,be={},cr=[],oo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,He=Array.isArray;function de(e,r){for(var t in r)e[t]=r[t];return e}function lr(e){var r=e.parentNode;r&&r.removeChild(e)}function pt(e,r,t){var o,s,a,h={};for(a in r)a=="key"?o=r[a]:a=="ref"?s=r[a]:h[a]=r[a];if(arguments.length>2&&(h.children=arguments.length>3?Be.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)h[a]===void 0&&(h[a]=e.defaultProps[a]);return ke(e,h,o,s,null)}function ke(e,r,t,o,s){var a={type:e,props:r,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:s==null?++ar:s,__i:-1};return s==null&&F.vnode!=null&&F.vnode(a),a}function fr(){return{current:null}}function se(e){return e.children}function Ee(e,r){this.props=e,this.context=r}function Pe(e,r){if(r==null)return e.__?Pe(e.__,e.__i+1):null;for(var t;r<e.__k.length;r++)if((t=e.__k[r])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?Pe(e):null}function dr(e){var r,t;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,r=0;r<e.__k.length;r++)if((t=e.__k[r])!=null&&t.__e!=null){e.__e=e.__c.base=t.__e;break}return dr(e)}}function ft(e){(!e.__d&&(e.__d=!0)&&me.push(e)&&!Oe.__r++||rr!==F.debounceRendering)&&((rr=F.debounceRendering)||sr)(Oe)}function Oe(){var e,r,t,o,s,a,h,p,v;for(me.sort(lt);e=me.shift();)e.__d&&(r=me.length,o=void 0,s=void 0,a=void 0,p=(h=(t=e).__v).__e,(v=t.__P)&&(o=[],s=[],(a=de({},h)).__v=h.__v+1,mt(v,a,h,t.__n,v.ownerSVGElement!==void 0,h.__h!=null?[p]:null,o,p==null?Pe(h):p,h.__h,s),a.__.__k[a.__i]=a,_r(o,a,s),a.__e!=p&&dr(a)),me.length>r&&me.sort(lt));Oe.__r=0}function pr(e,r,t,o,s,a,h,p,v,P,x){var f,m,y,_,b,S,C,M,N,H=0,O=o&&o.__k||cr,w=O.length,k=w,A=r.length;for(t.__k=[],f=0;f<A;f++)(_=t.__k[f]=(_=r[f])==null||typeof _=="boolean"||typeof _=="function"?null:_.constructor==String||typeof _=="number"||typeof _=="bigint"?ke(null,_,null,null,_):He(_)?ke(se,{children:_},null,null,null):_.__b>0?ke(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=t,_.__b=t.__b+1,_.__i=f,(M=io(_,O,C=f+H,k))===-1?y=be:(y=O[M]||be,O[M]=void 0,k--),mt(e,_,y,s,a,h,p,v,P,x),b=_.__e,(m=_.ref)&&y.ref!=m&&(y.ref&&_t(y.ref,null,_),x.push(m,_.__c||b,_)),S==null&&b!=null&&(S=b),(N=y===be||y.__v===null)?M==-1&&H--:M!==C&&(M===C+1?H++:M>C?k>A-C?H+=M-C:H--:H=M<C&&M==C-1?M-C:0),C=f+H,typeof _.type=="function"?(M!==C||y.__k===_.__k?v=hr(_,v,e):_.__d!==void 0?v=_.__d:b&&(v=b.nextSibling),_.__d=void 0):b&&(v=M!==C||N?mr(e,b,v):b.nextSibling),typeof t.type=="function"&&(t.__d=v)):(y=O[f])&&y.key==null&&y.__e&&(y.__e==v&&(v=Pe(y),typeof t.type=="function"&&(t.__d=v)),dt(y,y,!1),O[f]=null);for(t.__e=S,f=w;f--;)O[f]!=null&&(typeof t.type=="function"&&O[f].__e!=null&&O[f].__e==v&&(t.__d=O[f].__e.nextSibling),dt(O[f],O[f]))}function hr(e,r,t){for(var o,s=e.__k,a=0;s&&a<s.length;a++)(o=s[a])&&(o.__=e,r=typeof o.type=="function"?hr(o,r,t):mr(t,o.__e,r));return r}function ht(e,r){return r=r||[],e==null||typeof e=="boolean"||(He(e)?e.some(function(t){ht(t,r)}):r.push(e)),r}function mr(e,r,t){return r!=t&&e.insertBefore(r,t||null),r.nextSibling}function io(e,r,t,o){var s=e.key,a=e.type,h=t-1,p=t+1,v=r[t];if(v===null||v&&s==v.key&&a===v.type)return t;if(o>(v!=null?1:0))for(;h>=0||p<r.length;){if(h>=0){if((v=r[h])&&s==v.key&&a===v.type)return h;h--}if(p<r.length){if((v=r[p])&&s==v.key&&a===v.type)return p;p++}}return-1}function ao(e,r,t,o,s){var a;for(a in t)a==="children"||a==="key"||a in r||Fe(e,a,null,t[a],o);for(a in r)s&&typeof r[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||t[a]===r[a]||Fe(e,a,r[a],t[a],o)}function nr(e,r,t){r[0]==="-"?e.setProperty(r,t==null?"":t):e[r]=t==null?"":typeof t!="number"||oo.test(r)?t:t+"px"}function Fe(e,r,t,o,s){var a;e:if(r==="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(r in o)t&&r in t||nr(e.style,r,"");if(t)for(r in t)o&&t[r]===o[r]||nr(e.style,r,t[r])}else if(r[0]==="o"&&r[1]==="n")a=r!==(r=r.replace(/(PointerCapture)$|Capture$/,"$1")),r=r.toLowerCase()in e?r.toLowerCase().slice(2):r.slice(2),e.l||(e.l={}),e.l[r+a]=t,t?o?t.u=o.u:(t.u=Date.now(),e.addEventListener(r,a?ir:or,a)):e.removeEventListener(r,a?ir:or,a);else if(r!=="dangerouslySetInnerHTML"){if(s)r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!=="width"&&r!=="height"&&r!=="href"&&r!=="list"&&r!=="form"&&r!=="tabIndex"&&r!=="download"&&r!=="rowSpan"&&r!=="colSpan"&&r!=="role"&&r in e)try{e[r]=t==null?"":t;break e}catch(h){}typeof t=="function"||(t==null||t===!1&&r[4]!=="-"?e.removeAttribute(r):e.setAttribute(r,t))}}function or(e){var r=this.l[e.type+!1];if(e.t){if(e.t<=r.u)return}else e.t=Date.now();return r(F.event?F.event(e):e)}function ir(e){return this.l[e.type+!0](F.event?F.event(e):e)}function mt(e,r,t,o,s,a,h,p,v,P){var x,f,m,y,_,b,S,C,M,N,H,O,w,k,A,L=r.type;if(r.constructor!==void 0)return null;t.__h!=null&&(v=t.__h,p=r.__e=t.__e,r.__h=null,a=[p]),(x=F.__b)&&x(r);e:if(typeof L=="function")try{if(C=r.props,M=(x=L.contextType)&&o[x.__c],N=x?M?M.props.value:x.__:o,t.__c?S=(f=r.__c=t.__c).__=f.__E:("prototype"in L&&L.prototype.render?r.__c=f=new L(C,N):(r.__c=f=new Ee(C,N),f.constructor=L,f.render=uo),M&&M.sub(f),f.props=C,f.state||(f.state={}),f.context=N,f.__n=o,m=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),L.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=de({},f.__s)),de(f.__s,L.getDerivedStateFromProps(C,f.__s))),y=f.props,_=f.state,f.__v=r,m)L.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(L.getDerivedStateFromProps==null&&C!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(C,N),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(C,f.__s,N)===!1||r.__v===t.__v)){for(r.__v!==t.__v&&(f.props=C,f.state=f.__s,f.__d=!1),r.__e=t.__e,r.__k=t.__k,r.__k.forEach(function(z){z&&(z.__=r)}),H=0;H<f._sb.length;H++)f.__h.push(f._sb[H]);f._sb=[],f.__h.length&&h.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(C,f.__s,N),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,_,b)})}if(f.context=N,f.props=C,f.__P=e,f.__e=!1,O=F.__r,w=0,"prototype"in L&&L.prototype.render){for(f.state=f.__s,f.__d=!1,O&&O(r),x=f.render(f.props,f.state,f.context),k=0;k<f._sb.length;k++)f.__h.push(f._sb[k]);f._sb=[]}else do f.__d=!1,O&&O(r),x=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++w<25);f.state=f.__s,f.getChildContext!=null&&(o=de(de({},o),f.getChildContext())),m||f.getSnapshotBeforeUpdate==null||(b=f.getSnapshotBeforeUpdate(y,_)),pr(e,He(A=x!=null&&x.type===se&&x.key==null?x.props.children:x)?A:[A],r,t,o,s,a,h,p,v,P),f.base=r.__e,r.__h=null,f.__h.length&&h.push(f),S&&(f.__E=f.__=null)}catch(z){r.__v=null,v||a!=null?(r.__e=p,r.__h=!!v,a[a.indexOf(p)]=null):(r.__e=t.__e,r.__k=t.__k),F.__e(z,r,t)}else a==null&&r.__v===t.__v?(r.__k=t.__k,r.__e=t.__e):r.__e=so(t.__e,r,t,o,s,a,h,v,P);(x=F.diffed)&&x(r)}function _r(e,r,t){r.__d=void 0;for(var o=0;o<t.length;o++)_t(t[o],t[++o],t[++o]);F.__c&&F.__c(r,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(a){a.call(s)})}catch(a){F.__e(a,s.__v)}})}function so(e,r,t,o,s,a,h,p,v){var P,x,f,m=t.props,y=r.props,_=r.type,b=0;if(_==="svg"&&(s=!0),a!=null){for(;b<a.length;b++)if((P=a[b])&&"setAttribute"in P==!!_&&(_?P.localName===_:P.nodeType===3)){e=P,a[b]=null;break}}if(e==null){if(_===null)return document.createTextNode(y);e=s?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,y.is&&y),a=null,p=!1}if(_===null)m===y||p&&e.data===y||(e.data=y);else{if(a=a&&Be.call(e.childNodes),x=(m=t.props||be).dangerouslySetInnerHTML,f=y.dangerouslySetInnerHTML,!p){if(a!=null)for(m={},b=0;b<e.attributes.length;b++)m[e.attributes[b].name]=e.attributes[b].value;(f||x)&&(f&&(x&&f.__html==x.__html||f.__html===e.innerHTML)||(e.innerHTML=f&&f.__html||""))}if(ao(e,y,m,s,p),f)r.__k=[];else if(pr(e,He(b=r.props.children)?b:[b],r,t,o,s&&_!=="foreignObject",a,h,a?a[0]:t.__k&&Pe(t,0),p,v),a!=null)for(b=a.length;b--;)a[b]!=null&&lr(a[b]);p||("value"in y&&(b=y.value)!==void 0&&(b!==e.value||_==="progress"&&!b||_==="option"&&b!==m.value)&&Fe(e,"value",b,m.value,!1),"checked"in y&&(b=y.checked)!==void 0&&b!==e.checked&&Fe(e,"checked",b,m.checked,!1))}return e}function _t(e,r,t){try{typeof e=="function"?e(r):e.current=r}catch(o){F.__e(o,t)}}function dt(e,r,t){var o,s;if(F.unmount&&F.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||_t(o,null,r)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){F.__e(a,r)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&dt(o[s],r,t||typeof e.type!="function");t||e.__e==null||lr(e.__e),e.__=e.__e=e.__d=void 0}function uo(e,r,t){return this.constructor(e,t)}function vt(e,r,t){var o,s,a,h;F.__&&F.__(e,r),s=(o=typeof t=="function")?null:t&&t.__k||r.__k,a=[],h=[],mt(r,e=(!o&&t||r).__k=pt(se,null,[e]),s||be,be,r.ownerSVGElement!==void 0,!o&&t?[t]:s?null:r.firstChild?Be.call(r.childNodes):null,a,!o&&t?t:s?s.__e:r.firstChild,o,h),_r(a,e,h)}function vr(e,r){var t={__c:r="__cC"+ur++,__:e,Consumer:function(o,s){return o.children(s)},Provider:function(o){var s,a;return this.getChildContext||(s=[],(a={})[r]=this,this.getChildContext=function(){return a},this.shouldComponentUpdate=function(h){this.props.value!==h.value&&s.some(function(p){p.__e=!0,ft(p)})},this.sub=function(h){s.push(h);var p=h.componentWillUnmount;h.componentWillUnmount=function(){s.splice(s.indexOf(h),1),p&&p.call(h)}}),o.children}};return t.Provider.__=t.Consumer.contextType=t}Be=cr.slice,F={__e:function(e,r,t,o){for(var s,a,h;r=r.__;)if((s=r.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(e)),h=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,o||{}),h=s.__d),h)return s.__E=s}catch(p){e=p}throw e}},ar=0,no=function(e){return e!=null&&e.constructor==null},Ee.prototype.setState=function(e,r){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=de({},this.state),typeof e=="function"&&(e=e(de({},t),this.props)),e&&de(t,e),e!=null&&this.__v&&(r&&this._sb.push(r),ft(this))},Ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ft(this))},Ee.prototype.render=se,me=[],sr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lt=function(e,r){return e.__v.__b-r.__v.__b},Oe.__r=0,ur=0;var _e,q,yt,yr,We=0,Ir=[],ze=[],gr=F.__b,br=F.__r,Er=F.diffed,wr=F.__c,Sr=F.unmount;function De(e,r){F.__h&&F.__h(q,e,We||r),We=0;var t=q.__H||(q.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({__V:ze}),t.__[e]}function J(e){return We=1,co(Dr,e)}function co(e,r,t){var o=De(_e++,2);if(o.t=e,!o.__c&&(o.__=[t?t(r):Dr(void 0,r),function(p){var v=o.__N?o.__N[0]:o.__[0],P=o.t(v,p);v!==P&&(o.__N=[P,o.__[1]],o.__c.setState({}))}],o.__c=q,!q.u)){var s=function(p,v,P){if(!o.__c.__H)return!0;var x=o.__c.__H.__.filter(function(m){return m.__c});if(x.every(function(m){return!m.__N}))return!a||a.call(this,p,v,P);var f=!1;return x.forEach(function(m){if(m.__N){var y=m.__[0];m.__=m.__N,m.__N=void 0,y!==m.__[0]&&(f=!0)}}),!(!f&&o.__c.props===p)&&(!a||a.call(this,p,v,P))};q.u=!0;var a=q.shouldComponentUpdate,h=q.componentWillUpdate;q.componentWillUpdate=function(p,v,P){if(this.__e){var x=a;a=void 0,s(p,v,P),a=x}h&&h.call(this,p,v,P)},q.shouldComponentUpdate=s}return o.__N||o.__}function pe(e,r){var t=De(_e++,3);!F.__s&&bt(t.__H,r)&&(t.__=e,t.i=r,q.__H.__h.push(t))}function Tr(e,r){var t=De(_e++,4);!F.__s&&bt(t.__H,r)&&(t.__=e,t.i=r,q.__h.push(t))}function ue(e){return We=5,lo(function(){return{current:e}},[])}function lo(e,r){var t=De(_e++,7);return bt(t.__H,r)?(t.__V=e(),t.i=r,t.__h=e,t.__V):t.__}function Pr(e){var r=q.context[e.__c],t=De(_e++,9);return t.c=e,r?(t.__==null&&(t.__=!0,r.sub(q)),r.props.value):e.__}function fo(){for(var e;e=Ir.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ue),e.__H.__h.forEach(gt),e.__H.__h=[]}catch(r){e.__H.__h=[],F.__e(r,e.__v)}}F.__b=function(e){q=null,gr&&gr(e)},F.__r=function(e){br&&br(e),_e=0;var r=(q=e.__c).__H;r&&(yt===q?(r.__h=[],q.__h=[],r.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=ze,t.__N=t.i=void 0})):(r.__h.forEach(Ue),r.__h.forEach(gt),r.__h=[],_e=0)),yt=q},F.diffed=function(e){Er&&Er(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(Ir.push(r)!==1&&yr===F.requestAnimationFrame||((yr=F.requestAnimationFrame)||po)(fo)),r.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==ze&&(t.__=t.__V),t.i=void 0,t.__V=ze})),yt=q=null},F.__c=function(e,r){r.some(function(t){try{t.__h.forEach(Ue),t.__h=t.__h.filter(function(o){return!o.__||gt(o)})}catch(o){r.some(function(s){s.__h&&(s.__h=[])}),r=[],F.__e(o,t.__v)}}),wr&&wr(e,r)},F.unmount=function(e){Sr&&Sr(e);var r,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(o){try{Ue(o)}catch(s){r=s}}),t.__H=void 0,r&&F.__e(r,t.__v))};var Cr=typeof requestAnimationFrame=="function";function po(e){var r,t=function(){clearTimeout(o),Cr&&cancelAnimationFrame(r),setTimeout(e)},o=setTimeout(t,100);Cr&&(r=requestAnimationFrame(t))}function Ue(e){var r=q,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),q=r}function gt(e){var r=q;e.__c=e.__(),q=r}function bt(e,r){return!e||e.length!==r.length||r.some(function(t,o){return t!==e[o]})}function Dr(e,r){return typeof r=="function"?r(e):r}var ho=0;function B(e,r,t,o,s,a){var h,p,v={};for(p in r)p=="ref"?h=r[p]:v[p]=r[p];var P={type:e,props:v,key:t,ref:h,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--ho,__i:-1,__source:s,__self:a};if(typeof e=="function"&&(h=e.defaultProps))for(p in h)v[p]===void 0&&(v[p]=h[p]);return F.vnode&&F.vnode(P),P}var xr=vr(null),te=()=>{let e=Pr(xr);if(e===null)throw new Error("useAppMount() called without a <AppMountProvider /> in the tree.");return e};function Et(e){return B(xr.Provider,{value:X({},e),children:e.children})}var Or=require("obsidian");var wt=2,Ve=class extends Ee{constructor(t){super(t);this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this);let{breakpointCols:o}=t,s;typeof o=="number"?s=o:o&&o.hasOwnProperty("default")?s=o.default:s=wt,this.ref=fr(),this.resizeObserver=null,this.state={columnCount:s}}componentDidMount(){this.reCalculateColumnCount(),this.resizeObserver=new ResizeObserver(()=>{this.reCalculateColumnCountDebounce()});let t=this.ref.current;this.resizeObserver.observe(t)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}reCalculateColumnCountDebounce(){if(!window||!window.requestAnimationFrame){this.reCalculateColumnCount();return}window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})}reCalculateColumnCount(){let t=this.ref.current&&this.ref.current.offsetWidth||1/0,{breakpointCols:o}=this.props;if(t===1/0)return;typeof o=="number"&&(o={default:o||wt});let s=1/0,a=(o==null?void 0:o.default)||wt;for(let h in o){let p=parseInt(h);p>0&&t<=p&&p<s&&(s=p,a=o[p])}a=Math.max(1,a||1),this.state.columnCount!==a&&this.setState({columnCount:a})}itemsInColumns(){let t=this.state.columnCount,o=new Array(t),s=ht(this.props.children);for(let a=0;a<s.length;a++){let h=a%t;o[h]||(o[h]=[]),o[h].push(s[a])}return o}renderColumns(){let{column:t,columnAttrs:o={},columnClassName:s}=this.props,a=this.itemsInColumns(),h=`${100/a.length}%`,p=s;p&&typeof p!="string"&&(this.logDeprecated('The property "columnClassName" requires a string'),typeof p=="undefined"&&(p="my-masonry-grid_column"));let v=ne(X(X({},t),o),{style:ne(X({},o.style),{width:h}),className:p});return a.map((P,x)=>pt("div",ne(X({},v),{key:x}),P))}logDeprecated(t){console.error("[Masonry]",t)}render(){let x=this.props,{children:t,breakpointCols:o,columnClassName:s,columnAttrs:a,column:h,className:p}=x,v=Ne(x,["children","breakpointCols","columnClassName","columnAttrs","column","className"]),P=p;return typeof p!="string"&&(this.logDeprecated('The property "className" requires a string'),typeof p=="undefined"&&(P="my-masonry-grid")),B("div",ne(X({},v),{ref:this.ref,className:P,children:this.renderColumns()}))}};Ve.defaultProps={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0};var Mr=Ve;function we(e){let h=e,{file:r}=h,t=Ne(h,["file"]),{app:o,sourcePath:s}=te(),a=p=>{let v=p.altKey&&(p.ctrlKey||p.metaKey)?"split":p.ctrlKey||p.metaKey?"tab":!1;r&&o.workspace.openLinkText(r.path,s,v)};return B("div",ne(X({},t),{className:"note-card",onClick:a,children:e.children}))}var Nr=require("obsidian");var Se=require("obsidian");var St=(e,r)=>{e!==null&&r!==null&&(e&&!e.firstChild?e.appendChild(r):e.firstChild&&e.firstChild!==r&&e.replaceChild(r,e.firstChild))},mo=(e,r,t,o)=>K(void 0,null,function*(){let s=document.createElement("div");s.style.height="100%",s.style.width="100%";try{t instanceof Se.MarkdownRenderChild&&(yield Se.MarkdownRenderer.render(e,o,s,r,t))}catch(a){console.error(a)}return s}),_o=e=>{let r=new DOMParser,t=document.createElement("div"),o=r.parseFromString(e,"text/html"),s=Array.from(o.body.children);for(let a of s)t.appendChild(a);return t.style.height="100%",t.style.width="100%",t},Ar=(e,r)=>{let{app:t,db:o,component:s,sourcePath:a}=te(),h=ue(null),p=ue(null),[v,P]=J(!1),[x,f]=J(!0);return Tr(()=>{K(void 0,null,function*(){let m=null;if(e.rendered&&e.innerHTML)m=_o(e.innerHTML);else if(e.hasMarkdown&&e.markdown&&e.markdownMobile){let y=Se.Platform.isDesktopApp?e.markdown:e.markdownMobile;if(m=yield mo(t,a,s,y),!m.innerHTML.includes("pdf-embed")&&!m.innerHTML.includes("pdf-viewer")&&!m.innerHTML.includes("block-language-note-gallery")){let _=ne(X({},e),{rendered:!0,innerHTML:m.innerHTML});o.storeKey(r.path,_,r.stat.mtime,!1)}f(!1)}m&&m.innerHTML&&(p.current=m,h.current&&St(h.current,m),P(!0))})},[e,a]),{containerRef:h,renderRef:p,rendered:v,cached:x}},Rr=(e,r)=>e.vault.adapter.getResourcePath(r);function Ke(e,{threshold:r=0,root:t=null,rootMargin:o="0%",freezeOnceVisible:s=!1}){let[a,h]=J(),p=(a==null?void 0:a.isIntersecting)&&s,v=([P])=>{h(P)};return pe(()=>{let P=e==null?void 0:e.current;if(!!!window.IntersectionObserver||p||!P)return;let f={threshold:r,root:t,rootMargin:o},m=new IntersectionObserver(v,f);return m.observe(P),()=>m.disconnect()},[e,r,t,o,p]),a}function Ct(e){let{db:r,settings:t}=te(),{file:o}=e,s=r.getItem(o.path),{data:a}=s,{containerRef:h,renderRef:p,rendered:v,cached:P}=Ar(a,o),x=ue(null),f=Ke(x,{rootMargin:"33%",freezeOnceVisible:!0}),m=!!(f!=null&&f.isIntersecting);return B(se,{children:B("div",{ref:x,children:[t.showtitle&&B("hr",{style:{borderTop:P?"":"1px solid var(--interactive-accent)"}}),B("div",{style:{opacity:m?1:0,transition:"opacity ease-in 100ms"},className:"card-content-container",ref:y=>{a.hasMarkdown&&a.markdown!==""&&v&&m&&(h.current=y,St(y,p.current))},children:B("div",{style:{opacity:0,whiteSpace:"pre-wrap"},children:Nr.Platform.isDesktopApp?a.text:a.textMobile})})]})})}function It(e){let{settings:r}=te(),{file:t}=e;return B(se,{children:[r.showtitle&&B("div",{className:"inline-title",children:t.basename}),B("div",{className:"card-content",children:[B("div",{className:"card-content-wall"}),B(Ct,{file:t})]})]})}function Tt(e){let{hasMore:r,loadMore:t}=e,o=ue(null),s=Ke(o,{}),a=!!(s!=null&&s.isIntersecting);return pe(()=>{r&&a&&t()},[a,r,t]),B("div",{ref:o,children:r&&B(we,{children:[B("h1",{children:"Hold on a second..."}),B("h6",{children:"There are more files!"})]})})}var ve=require("obsidian");var vo=["jpeg","jpg","gif","png","webp","tiff","tif","md"],Lr=(e,r=!1)=>e.reduce((t,o)=>(r&&o instanceof ve.TFolder?t=t.concat(Lr(o.children,!0)):o instanceof ve.TFile&&t.push(o),t),[]),yo=(e,r)=>{let{vault:t}=e,o=t;return o.getAbstractFileByPathInsensitive?o.getAbstractFileByPathInsensitive(r):t.getAbstractFileByPath(r)},go=(e,r)=>{let t=null,o=yo(e,r.path);return o instanceof ve.TFolder?{files:Lr(o.children,r.recursive),error:t}:(r.path&&r.path!==""&&(t="The folder specified in `path` doesn't exist!"),{files:[],error:t})};function bo(e,r){let t=r;for(let o=0;o<e.length;o++)t=t*31+e.charCodeAt(o)&4294967295;return t>>>0}function Eo(e,r){return e.map(t=>({item:t,sortKey:bo(t.path,r)})).sort((t,o)=>t.sortKey-o.sortKey).map(({item:t})=>t)}var wo=(e,r,t,o,s=50)=>{let a=e.filter(p=>p.path!==t&&vo.includes(p.extension)).filter(p=>{if(p.extension!=="md")return!0;let v=r.getItem(p.path);if(!v)return!1;let{data:P}=v;return!P.markdown||!P.hasMarkdown?!1:!(P.markdown.contains("```note-gallery")||P.markdown.contains("~~~note-gallery"))}).sort((p,v)=>{let P=o.sortby==="name"?p.name.toUpperCase():p.stat[o.sortby],x=o.sortby==="name"?v.name.toUpperCase():v.stat[o.sortby],f=o.sort==="asc"?-1:1;return P<x?f:P>x?f*-1:0}),h=o.sortrandom===!0?Eo(a,s):a;return o.limit===0?h:h.splice(0,o.limit)},So=e=>{switch(`${e.sortby}:${e.sort}`){case"mtime:desc":return"byModifiedTime";case"mtime:asc":return"byModifiedTimeReverse";case"ctime:desc":return"byCreatedTime";case"ctime:asc":return"byCreatedTimeReverse";case"name:desc":return"alphabeticalReverse";case"name:asc":return"alphabetical";default:return"byModifiedTime"}},Co=(e,r)=>{if(!!e){if(r.debugquery)e.el.style.maxHeight="300px",e.el.style.padding="10px",e.el.style.marginBottom="12px",e.el.style.border="1px solid var(--background-modifier-border)",e.el.style.borderRadius="5px";else{e.el.style.height="8px";let t=e.el.firstChild;t&&t.remove()}e.el.style.removeProperty("display")}},kr=()=>{let{app:e,db:r,sourcePath:t,settings:o,embeddedSearch:s}=te(),[a,h]=J(null),[p,v]=J([]),P=ue(Math.floor(Math.random()*1e5)),x=100;return pe(()=>{let f=()=>{let{files:S,error:C}=go(e,o);return C?(h(C),[]):S},m=S=>{let C=s==null?void 0:s.dom;if(!C||!C.parent)return[];if(!S||!S.parent)return[];if(!S.parent.sourcePath||S.parent.sourcePath!==C.parent.sourcePath)return[];let M=So(o);C.setSortOrder&&C.sortOrder!==M&&C.setSortOrder(M);let N=S!=null&&S.resultDomLookup?S.resultDomLookup:C==null?void 0:C.resultDomLookup;return N?Array.from(N.keys()):[]},y=(S,C)=>{C&&Co(S,o);let M=[...p,...f(),...m(S)],N=[...new Map(M.map(O=>[O.path,O])).values()],H=wo(N,r,t,o,P.current);H.length&&v(H)};p.length||y(s==null?void 0:s.dom,!0);let _=(0,ve.debounce)(y,x,!0),b=()=>_(s==null?void 0:s.dom,!0);return e.workspace.on("search:onChange",_),r.on("database-update",b),()=>{e.workspace.off("search:onChange",_),r.off("database-update",b)}}),{error:a,files:p}};var Io=({error:e})=>B("p",{style:{borderRadius:"4px",padding:"2px 16px",backgroundColor:"#e50914",color:"#fff",fontWeight:"bolder"},children:["(Error) Note Gallery: ",e]});function Pt(){let{app:e,settings:r}=te(),t=Or.Platform.isDesktopApp?100:10,{error:o,files:s}=kr(),[a,h]=J(!0),[p,v]=J(t),P=()=>{p>=s.length?h(!1):setTimeout(()=>{v(p+t)},100)},x=f=>{let m=[];for(let y=0;y<p;y++){let _=f[y];_&&_.extension==="md"?m.push(B(we,{file:_,children:B(It,{file:_})},_.name)):_&&m.push(B(we,{file:_,children:B("img",{src:Rr(e,_.path)})},_.name))}return m};return B("div",{children:[o&&B(Io,{error:o}),s.length>0&&B(Mr,{breakpointCols:r.breakpoints,className:"masonry-grid",columnClassName:"masonry-grid_column",children:[x(s),B(Tt,{hasMore:a,loadMore:P})]})]})}function Dt({app:e,plugin:r,component:t,containerEl:o,searchEl:s,sourcePath:a,settings:h,db:p}){let[v,P]=J(!1),[x,f]=J(void 0);return pe(()=>{o.style.setProperty("--note-card-font-size",h.fontsize);let m=b=>{if(!x){let S=t.addChild(new b(e,s,h.query,a));f(S)}},y=()=>{v||P(!0),r.EmbeddedSearch&&m(r.EmbeddedSearch)},_=()=>{v&&P(!1)};return p.ready&&y(),p.on("database-update",y),p.on("database-drop",_),e.workspace.on("catchEmbeddedSearch",m),()=>{p.off("database-update",y),p.off("database-drop",_),e.workspace.off("catchEmbeddedSearch",m)}}),B(Et,{app:e,component:t,sourcePath:a,db:p,embeddedSearch:x,settings:h,children:[!v&&B("div",{children:B("h1",{children:"Note Gallery: Indexing Database..."})}),v&&B(Pt,{})]})}var $e=require("obsidian");var To=(e,r)=>{let t=e.createEl("div");t.createEl("p",{text:`(Error) Note Gallery: ${r}`}),t.style.borderRadius="var(--callout-radius)",t.style.padding="var(--callout-padding)",t.style.backgroundColor="var(--background-modifier-error)",t.style.color="var(--text-on-accent-inverted)",t.style.fontWeight="var(--font-bold)"},xt=To;var Po={path:"",query:"",limit:0,recursive:!0,sort:"desc",sortby:"mtime",sortrandom:!1,fontsize:"6pt",showtitle:!0,debugquery:!1,breakpoints:{default:4,1e5:10,3500:10,3100:9,2700:8,2300:7,1900:6,1500:5,1e3:4,700:3,400:2,200:1}},Fr=(e,r=!1)=>Object.keys(e).reduce((t,o)=>(t[o.toLowerCase()]=r&&typeof e[o]=="object"?Fr(e[o]):e[o],t),{}),Do=(e,r,t,o)=>{let s;try{s=(0,$e.parseYaml)(e)}catch(h){let p="Cannot parse YAML!";throw h instanceof Error&&(p=h.message),xt(t,p),h}if(s===void 0){let h="Cannot parse YAML!";throw xt(t,h),new Error(h)}s!==null&&(s=Fr(s));let a=X(X({},Po),s);if(s===null||!s.path&&!s.query){let h=r.vault.getAbstractFileByPath(o.sourcePath).parent;a.path=h.path}return a.path&&(a.path=(0,$e.normalizePath)(a.path)),a.path||(a.path=""),a.query||(a.query=""),a},Br=Do;var xe=class extends Hr.MarkdownRenderChild{constructor(t,o,s,a,h){super(s);this.plugin=t;this.src=o;this.containerEl=s;this.app=a;this.ctx=h;this.settings=Br(o,a,s,h)}onload(){return K(this,null,function*(){this.searchEl=this.containerEl.createEl("div"),this.reactEl=this.containerEl.createEl("div"),this.searchEl.style.display="none",this.searchEl.style.overflowY="scroll",this.plugin.EmbeddedSearch||(yield this.plugin.triggerEmbeddedSearchPatch()),vt(B(Dt,{app:this.app,plugin:this.plugin,component:this,containerEl:this.reactEl,searchEl:this.searchEl,sourcePath:this.ctx.sourcePath,settings:this.settings,db:this.plugin.db}),this.reactEl)})}onunload(){return K(this,null,function*(){vt(null,this.reactEl)})}};var he=ct(qe()),re=require("obsidian"),$r=ct(Wr()),qr=ct(Kr());(0,qr.extendPrototype)(he.default);(0,$r.extendPrototype)(he.default);var At=class extends re.Events{constructor(){super(...arguments);this._events=[]}onunload(){}unload(){for(;this._events.length>0;)this._events.pop()()}register(t){this._events.push(t)}registerEvent(t){this.register(()=>t.e.offref(t))}},je=class extends At{constructor(t,o,s,a,h,p,v,P=2,x=f=>f){super();this.plugin=t;this.name=o;this.title=s;this.version=a;this.description=h;this.defaultValue=p;this.extractValue=v;this.workers=P;this.loadValue=x;this.memory=new Map;this.deleted_keys=new Set;this.ready=!1;this.databaseUpdate=(0,re.debounce)(()=>{this.trigger("database-update",this.allEntries()),this.flushChanges()},100,!0);this.flushChanges=(0,re.debounce)(()=>K(this,null,function*(){yield this.persistMemory(),this.trigger("database-update",this.allEntries())}),1e3,!0);let f=this.plugin.app.loadLocalStorage(o+"-version"),m=f?parseInt(f):null;this.persist=he.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:he.default.INDEXEDDB,description:h,version:a}),this.plugin.app.workspace.onLayoutReady(()=>K(this,null,function*(){yield this.persist.ready(()=>K(this,null,function*(){yield this.loadDatabase(),this.trigger("database-update",this.allEntries());let y=m!==null&&m<a?"Migrating":this.isEmpty()?"Initializing":"Syncing",{progress_bar:_,notice:b}=this.createNotice(y,s);m!==null&&m<a&&!this.isEmpty()?(yield this.clearDatabase(),yield this.rebuildDatabase(_,b),this.trigger("database-migrate"),this.trigger("database-update",this.allEntries())):this.isEmpty()?(yield this.rebuildDatabase(_,b),this.trigger("database-create"),this.trigger("database-update",this.allEntries())):yield this.syncDatabase(_,b),this.ready=!0,this.registerEvent(this.plugin.app.vault.on("modify",S=>K(this,null,function*(){var C;if(S instanceof re.TFile&&S.extension==="md"){let M=this.plugin.app.workspace.activeEditor,N=M&&((C=M.file)==null?void 0:C.path)===S.path&&M.editor?M.editor.cm.state:void 0,H=yield this.plugin.app.vault.cachedRead(S);this.storeKey(S.path,yield this.extractValue(H,S,N),S.stat.mtime)}}))),this.registerEvent(this.plugin.app.vault.on("delete",S=>K(this,null,function*(){S instanceof re.TFile&&S.extension==="md"&&this.deleteKey(S.path)}))),this.registerEvent(this.plugin.app.vault.on("rename",(S,C)=>K(this,null,function*(){S instanceof re.TFile&&S.extension==="md"&&this.renameKey(C,S.path,S.stat.mtime)}))),this.registerEvent(this.plugin.app.vault.on("create",S=>K(this,null,function*(){S instanceof re.TFile&&S.extension==="md"&&this.storeKey(S.path,this.defaultValue(),S.stat.mtime)})))}))}))}on(t,o,s){return super.on(t,o,s)}loadDatabase(){return K(this,null,function*(){this.memory=new Map(Object.entries(yield this.persist.getItems()).map(([t,o])=>(o.data=this.loadValue(o.data),[t,o])))})}regularParseFiles(t,o){return K(this,null,function*(){for(let s=0;s<t.length;s++){let a=t[s],h=this.getItem(a.path);if(h===null||h.mtime<a.stat.mtime){let p=yield this.plugin.app.vault.cachedRead(a);this.storeKey(a.path,yield this.extractValue(p,a),a.stat.mtime,!0)}o.setAttribute("value",(s+1).toString())}})}syncDatabase(t,o){return K(this,null,function*(){let s=this.plugin.app.vault.getMarkdownFiles();this.initializeProgressBar(t,s.length),this.allKeys().forEach(h=>{s.some(p=>p.path===h)||this.deleteKey(h)});let a=s.filter(h=>!this.memory.has(h.path)||this.memory.get(h.path).mtime<h.stat.mtime);yield this.regularParseFiles(a,t),this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString()),o.hide()})}rebuildDatabase(t,o){return K(this,null,function*(){let s=this.plugin.app.vault.getMarkdownFiles();this.initializeProgressBar(t,s.length),yield this.regularParseFiles(s,t),this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString()),o.hide()})}persistMemory(){return K(this,null,function*(){let t={};for(let[o,s]of this.memory.entries())s.dirty&&(t[o]={data:s.data,mtime:s.mtime},this.memory.set(o,{data:s.data,mtime:s.mtime,dirty:!1}));yield this.persist.setItems(t),yield Promise.all(Array.from(this.deleted_keys.values()).map(o=>K(this,null,function*(){return yield this.persist.removeItem(o)}))),this.deleted_keys.clear()})}createNotice(t,o){let s=new DocumentFragment,a=s.createEl("div"),h=s.createEl("div",{cls:"commentator-progress-bar"}),p=new re.Notice(s,0),v=h.createEl("progress");return a.textContent=`${t} ${o} database...`,{progress_bar:v,notice:p}}initializeProgressBar(t,o){t.setAttribute("max",o.toString()),t.setAttribute("value","0")}storeKey(t,o,s,a=!0){this.memory.set(t,{data:o,mtime:s!=null?s:Date.now(),dirty:a}),this.databaseUpdate()}deleteKey(t){if(this.getItem(t)==null)throw new Error("Key does not exist");this.memory.delete(t),this.deleted_keys.add(t),this.databaseUpdate()}renameKey(t,o,s){let a=this.getItem(t);if(a==null)throw new Error("Key does not exist");this.storeKey(o,a.data,s),this.deleteKey(t),this.databaseUpdate()}allKeys(){return Array.from(this.memory.keys())}getValue(t){var o,s;return(s=(o=this.memory.get(t))==null?void 0:o.data)!=null?s:null}allValues(){return Array.from(this.memory.values()).map(t=>t.data)}getItem(t){var o;return(o=this.memory.get(t))!=null?o:null}allItems(){return Array.from(this.memory.values())}allEntries(){return Array.from(this.memory.entries())}dropDatabase(){return K(this,null,function*(){this.trigger("database-drop"),this.memory.clear(),yield he.default.dropInstance({name:this.name+`/${this.plugin.app.appId}`}),localStorage.removeItem(this.plugin.app.appId+"-"+this.name+"-version")})}reinitializeDatabase(){return K(this,null,function*(){yield this.dropDatabase(),this.persist=he.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:he.default.INDEXEDDB,version:this.version,description:this.description});let t="Initializing",{progress_bar:o,notice:s}=this.createNotice(t,this.title);yield this.rebuildDatabase(o,s),this.trigger("database-update",this.allEntries())})}clearDatabase(){return K(this,null,function*(){this.trigger("database-drop"),this.memory.clear(),yield this.persist.clear()})}isEmpty(){return this.memory.size===0}};var xo={text:null,textMobile:null,markdown:null,markdownMobile:null,innerHTML:null,hasMarkdown:!1,rendered:!1};function Gr(e,r,t){return K(this,null,function*(){let a="";if(e.startsWith("---")){let P=e.indexOf("---",3);a=e.slice(0,P+3).trim(),e=e.slice(P+3,e.length).trim()}let h=e.split(`
`).slice(0,200).join(`
`),p=e.split(`
`).slice(0,30).join(`
`);e=[a,h].join(`
`).trim();let v=[a,p].join(`
`).trim();return{text:h,textMobile:p,markdown:e,markdownMobile:v,hasMarkdown:!0,innerHTML:null,rendered:!1}})}function Mo(e){return(e.innerHTML||e.rendered)&&(e=ne(X({},e),{innerHTML:null,rendered:!1})),e}var Qe=class extends ce.Plugin{constructor(){super(...arguments);this.EmbeddedSearchLeafInitializer=null;this.EmbeddedSearch=null;this.isEmbeddedSearchPatched=!1}onload(){return K(this,null,function*(){this.db=this.registerDb(),this.patchCatchEmbeddedSearch(),this.registerMarkdownCodeBlockProcessor("note-gallery",(t,o,s)=>K(this,null,function*(){let a=new xe(this,t,o,this.app,s);s.addChild(a)})),this.addCommand({id:"drop-database",name:"Drop all cache and re-initialize database",callback:()=>{this.db.reinitializeDatabase()}})})}onunload(){return K(this,null,function*(){})}registerDb(){return new je(this,"render-store","Render Store",6,"Stores text and renderedHTML of a file to be rendered by the note gallery",()=>xo,Gr,2,Mo)}patchCatchEmbeddedSearch(){let t=this;t.register(Le(ce.Component.prototype,{addChild(o){return function(s,...a){try{if(s instanceof ce.Component&&s.hasOwnProperty("searchQuery")&&s.hasOwnProperty("sourcePath")&&s.hasOwnProperty("dom")){let p=s;t.EmbeddedSearch||(t.EmbeddedSearch=p.constructor,t.app.workspace.trigger("catchEmbeddedSearch",p.constructor)),t.EmbeddedSearchLeafInitializer&&setTimeout(()=>{var v;(v=t.EmbeddedSearchLeafInitializer)==null||v.detach(),t.EmbeddedSearchLeafInitializer=null},100),t.isEmbeddedSearchPatched||(t.patchEmbeddedSearch(p),t.isEmbeddedSearchPatched=!0)}}catch(p){console.log({type:"Patching CatchEmbeddedSearch Error",err:p})}return o.call(this,s,...a)}}}))}patchEmbeddedSearch(t){let o=this,s=t.dom.constructor;this.register(Le(t.constructor.prototype,{onload(a){return function(...h){try{this.dom&&(this.dom.parent=this)}catch(p){console.log({type:"Patching EmbeddedSearch Error",err:p})}return a.call(this,...h)}}})),o.patchEmbeddedSearchDOM(s)}patchEmbeddedSearchDOM(t){let o=this;o.register(Le(t.prototype,{startLoader(s){return function(...a){var h,p;try{!this.patched&&((h=this.el.parentElement)==null?void 0:h.hasClass("block-language-note-gallery"))&&((p=this.el)==null?void 0:p.closest(".block-language-note-gallery"))&&(this.patched=!0,this.setSortOrder=v=>{console.log(`Note Gallery: Setting native search sort order ${v}`),this.sortOrder=v,this.changed(),this.infinityScroll.invalidateAll()})}catch(v){console.log({type:"Patching EmbeddedSearchDOM.startLoader Error",err:v})}return s.call(this,...a)}},addResult(s){return function(a,h,p,...v){let P;return p.contains("note-gallery")?(P=s.call(this,a,h,p.replace("note-gallery","note-gallery".toUpperCase().replace("-","_")),...v),P):(P=s.call(this,a,h,p,...v),P)}},onChange(s){return function(...a){try{o.app.workspace.trigger("search:onChange",this)}catch(h){console.log({type:"Patching EmbeddedSearchDOM.onChange Error",err:h})}return s.call(this,...a)}}}))}triggerEmbeddedSearchPatch(){return K(this,null,function*(){let t=new ce.WorkspaceSplit(this.app.workspace,"vertical"),o=this.EmbeddedSearchLeafInitializer=this.attachLeaf(t),s=new ce.MarkdownView(o);s.setViewData("```query\n```",!0),yield o.open(s);let a=o.getViewState();a.state.source=!1,o.setViewState(a)})}attachLeaf(t){return t.getRoot=()=>this.app.workspace.rootSplit,t.getContainer=()=>this.app.workspace.rootSplit,this.app.workspace.createLeafInParent(t,0)}};
/*!
localForage -- Offline Storage, Improved
Version 1.10.0
https://localforage.github.io/localForage
(c) 2013-2017 Mozilla, Apache License 2.0
*/
/* nosourcemap */