/* 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(D){s(D)}},h=v=>{try{p(t.throw(v))}catch(D){s(D)}},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 g=new Error("Cannot find module '"+x+"'");throw g.code="MODULE_NOT_FOUND",g}var _=a[x]={exports:{}};s[x][0].call(_.exports,function(y){var w=s[x][1][y];return p(w||y)},_,_.exports,o,s,a,h)}return a[x].exports}for(var v=typeof require=="function"&&require,D=0;D=43)}}).catch(function(){return!1})}function N(n){return typeof M=="boolean"?m.resolve(M):A(n).then(function(u){return M=u,M})}function z(n){var u=L[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=L[n.name],i=u.deferredOperations.pop();if(i)return i.resolve(),i.promise}function Y(n,u){var i=L[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(L[n.name]=L[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=D.open.apply(D,d);u&&(c.onupgradeneeded=function(b){var E=c.result;try{E.createObjectStore(n.storeName),b.oldVersion<=1&&E.createObjectStore(T)}catch(C){if(C.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw C}}),c.onerror=function(b){b.preventDefault(),l(c.error)},c.onsuccess=function(){var b=c.result;b.onversionchange=function(E){E.target.close()},i(b),$(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.versionn.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=L[u._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return _(i,n,n),i}function jr(n){z(n);for(var u=L[n.name],i=u.forages,l=0;l0&&(!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=L[i.name];d||(d=Nt(),L[i.name]=d),d.forages.push(u),u._initReady||(u._initReady=u.ready,u.ready=Yr);var c=[];function b(){return m.resolve()}for(var E=0;E>4,P[d++]=(b&15)<<4|E>>2,P[d++]=(E&3)<<6|C&63;return I}function tt(n){var u=new Uint8Array(n),i="",l;for(l=0;l>2],i+=ce[(u[l]&3)<<4|u[l+1]>>4],i+=ce[(u[l+1]&15)<<2|u[l+2]>>6],i+=ce[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 b=cn+n.type+"~"+tt(this.result);u(Me+et+b)},c.readAsArrayBuffer(n)}else try{u(JSON.stringify(n))}catch(b){console.error("Couldn't convert value into a JSON string: ",n),u(null,b)}}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,b){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return b(E)}i.db.transaction(function(E){Gt(E,i,function(){u._dbInfo=i,c()},function(C,I){b(I)})},b)});return i.serializer=rt,d}function le(n,u,i,l,d,c){n.executeSql(i,l,d,function(b,E){E.code===E.SYNTAX_ERR?b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[u.storeName],function(C,I){I.rows.length?c(C,E):Gt(C,u,function(){C.executeSql(i,l,d,c)},c)},c):c(b,E)},c)}function pn(n,u){var i=this;n=y(n);var l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"SELECT * FROM "+b.storeName+" WHERE key = ? LIMIT 1",[n],function(C,I){var P=I.rows.length?I.rows.item(0).value:null;P&&(P=b.serializer.deserialize(P)),d(P)},function(C,I){c(I)})})}).catch(c)});return g(l,u),l}function hn(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"SELECT * FROM "+b.storeName,[],function(C,I){for(var P=I.rows,R=P.length,U=0;U0){b(Yt.apply(d,[n,C,i,l-1]));return}E(U)}})})}).catch(E)});return g(c,i),c}function mn(n,u,i){return Yt.apply(this,[n,u,i,1])}function _n(n,u){var i=this;n=y(n);var l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"DELETE FROM "+b.storeName+" WHERE key = ?",[n],function(){d()},function(C,I){c(I)})})}).catch(c)});return g(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(b){le(b,c,"DELETE FROM "+c.storeName,[],function(){l()},function(E,C){d(C)})})}).catch(d)});return g(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(b){le(b,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(E,C){var I=C.rows.item(0).c;l(I)},function(E,C){d(C)})})}).catch(d)});return g(i,n),i}function gn(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"SELECT key FROM "+b.storeName+" WHERE id = ? LIMIT 1",[n+1],function(C,I){var P=I.rows.length?I.rows.item(0).key:null;d(P)},function(C,I){c(I)})})}).catch(c)});return g(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(b){le(b,c,"SELECT key FROM "+c.storeName,[],function(E,C){for(var I=[],P=0;P '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var b=[],E=0;E0}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 g(i,n),i}function xn(n,u){var i=this;n=y(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 g(l,u),l}function Mn(n,u){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,b=c.length,E=localStorage.length,C=1,I=0;I=0;b--){var E=localStorage.key(b);E.indexOf(c)===0&&localStorage.removeItem(E)}}):d=m.reject("Invalid arguments"),g(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{(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(_,y){return y&&_.then(function(w){y(null,w)},function(w){y(w)}),_}function s(_,y){var w=this,T=w.getItem(_).then(function(M){return{key:_,value:M}});return o(T,y),T}function a(_){var y=this,w=new Promise(function(T,M){for(var L=[],B=0,H=_.length;BL?1:0}var T=new Promise(function(M,L){y.ready().then(function(){var B=y._dbInfo,H=B.db.transaction(B.storeName,"readonly").objectStore(B.storeName),S=_.sort(w),k=v.bound(_[0],_[_.length-1],!1,!1),A=H.openCursor(k),N={},z=0;A.onsuccess=function(){var $=A.result;if(!$){M(N);return}for(var Y=$.key;Y>S[z];)if(z++,z===S.length){M(N);return}if(Y===S[z]){var G=$.value;G===void 0&&(G=null),N[Y]=G,$.continue()}else $.continue(S[z])},A.onerror=function(){L(A.error)}}).catch(L)});return T}function x(_){var y=this,w=new Promise(function(T,M){y.ready().then(function(){return t(y)}).then(function(L){var B=y._dbInfo;B.db.transaction(function(H){for(var S=new Array(_.length),k=0,A=_.length;k{(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(g){m(null,g)},function(g){m(g)})}function s(f,m,g,_){function y(H,S){var k=H||S;return(!H||typeof H!="function")&&typeof k=="string"&&(H=function(N){return N[k]}),H}var w=[];if(Object.prototype.toString.call(f)==="[object Array]"){m=y(m,"key"),g=y(g,"value");for(var T=0,M=f.length;TQe,extractValue:()=>Gr});module.exports=to(xo);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 ue=require("obsidian");var Hr=require("obsidian");var Be,O,ar,no,he,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 fe(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&&O.vnode!=null&&O.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;rr&&he.sort(lt));Oe.__r=0}function pr(e,r,t,o,s,a,h,p,v,D,x){var f,m,g,_,y,w,T,M,L,B=0,H=o&&o.__k||cr,S=H.length,k=S,A=r.length;for(t.__k=[],f=0;f0?ke(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=t,_.__b=t.__b+1,_.__i=f,(M=io(_,H,T=f+B,k))===-1?g=be:(g=H[M]||be,H[M]=void 0,k--),mt(e,_,g,s,a,h,p,v,D,x),y=_.__e,(m=_.ref)&&g.ref!=m&&(g.ref&&_t(g.ref,null,_),x.push(m,_.__c||y,_)),w==null&&y!=null&&(w=y),(L=g===be||g.__v===null)?M==-1&&B--:M!==T&&(M===T+1?B++:M>T?k>A-T?B+=M-T:B--:B=M(v!=null?1:0))for(;h>=0||p=0){if((v=r[h])&&s==v.key&&a===v.type)return h;h--}if(p=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(me++,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],D=o.t(v,p);v!==D&&(o.__N=[D,o.__[1]],o.__c.setState({}))}],o.__c=q,!q.u)){var s=function(p,v,D){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,D);var f=!1;return x.forEach(function(m){if(m.__N){var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(f=!0)}}),!(!f&&o.__c.props===p)&&(!a||a.call(this,p,v,D))};q.u=!0;var a=q.shouldComponentUpdate,h=q.componentWillUpdate;q.componentWillUpdate=function(p,v,D){if(this.__e){var x=a;a=void 0,s(p,v,D),a=x}h&&h.call(this,p,v,D)},q.shouldComponentUpdate=s}return o.__N||o.__}function de(e,r){var t=De(me++,3);!O.__s&&bt(t.__H,r)&&(t.__=e,t.i=r,q.__H.__h.push(t))}function Tr(e,r){var t=De(me++,4);!O.__s&&bt(t.__H,r)&&(t.__=e,t.i=r,q.__h.push(t))}function _e(e){return We=5,lo(function(){return{current:e}},[])}function lo(e,r){var t=De(me++,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(me++,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=[],O.__e(r,e.__v)}}O.__b=function(e){q=null,gr&&gr(e)},O.__r=function(e){br&&br(e),me=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=[],me=0)),yt=q},O.diffed=function(e){Er&&Er(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(Ir.push(r)!==1&&yr===O.requestAnimationFrame||((yr=O.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},O.__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=[],O.__e(o,t.__v)}}),wr&&wr(e,r)},O.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&&O.__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 F(e,r,t,o,s,a){var h,p,v={};for(p in r)p=="ref"?h=r[p]:v[p]=r[p];var D={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 O.vnode&&O.vnode(D),D}var xr=vr(null),te=()=>{let e=Pr(xr);if(e===null)throw new Error("useAppMount() called without a in the tree.");return e};function Et(e){return F(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&&ppt("div",ne(X({},v),{key:x}),D))}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"]),D=p;return typeof p!="string"&&(this.logDeprecated('The property "className" requires a string'),typeof p=="undefined"&&(D="my-masonry-grid")),F("div",ne(X({},v),{ref:this.ref,className:D,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 F("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=_e(null),p=_e(null),[v,D]=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 g=Se.Platform.isDesktopApp?e.markdown:e.markdownMobile;if(m=yield mo(t,a,s,g),!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),D(!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=([D])=>{h(D)};return de(()=>{let D=e==null?void 0:e.current;if(!!!window.IntersectionObserver||p||!D)return;let f={threshold:r,root:t,rootMargin:o},m=new IntersectionObserver(v,f);return m.observe(D),()=>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:D}=Ar(a,o),x=_e(null),f=Ke(x,{rootMargin:"33%",freezeOnceVisible:!0}),m=!!(f!=null&&f.isIntersecting);return F(se,{children:F("div",{ref:x,children:[t.showtitle&&F("hr",{style:{borderTop:D?"":"1px solid var(--interactive-accent)"}}),F("div",{style:{opacity:m?1:0,transition:"opacity ease-in 100ms"},className:"card-content-container",ref:g=>{a.hasMarkdown&&a.markdown!==""&&v&&m&&(h.current=g,St(g,p.current))},children:F("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 F(se,{children:[r.showtitle&&F("div",{className:"inline-title",children:t.basename}),F("div",{className:"card-content",children:[F("div",{className:"card-content-wall"}),F(Ct,{file:t})]})]})}function Tt(e){let{hasMore:r,loadMore:t}=e,o=_e(null),s=Ke(o,{}),a=!!(s!=null&&s.isIntersecting);return de(()=>{r&&a&&t()},[a,r,t]),F("div",{ref:o,children:r&&F(we,{children:[F("h1",{children:"Hold on a second..."}),F("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})},bo=(e,r,t,o)=>{let s=e.filter(a=>a.path!==t&&vo.includes(a.extension)).filter(a=>{if(a.extension!=="md")return!0;let h=r.getItem(a.path);if(!h)return!1;let{data:p}=h;return!p.markdown||!p.hasMarkdown?!1:!(p.markdown.contains("```note-gallery")||p.markdown.contains("~~~note-gallery"))}).sort((a,h)=>{let p=o.sortby==="name"?a.name.toUpperCase():a.stat[o.sortby],v=o.sortby==="name"?h.name.toUpperCase():h.stat[o.sortby],D=o.sort==="asc"?-1:1;return pv?D*-1:0});return o.limit===0?s:s.splice(0,o.limit)},Eo=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"}},wo=(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([]),D=100;return de(()=>{let x=()=>{let{files:y,error:w}=go(e,o);return w?(h(w),[]):y},f=y=>{let w=s==null?void 0:s.dom;if(!w||!w.parent)return[];if(!y||!y.parent)return[];if(!y.parent.sourcePath||y.parent.sourcePath!==w.parent.sourcePath)return[];let T=Eo(o);w.setSortOrder&&w.sortOrder!==T&&w.setSortOrder(T);let M=y!=null&&y.resultDomLookup?y.resultDomLookup:w==null?void 0:w.resultDomLookup;return M?Array.from(M.keys()):[]},m=(y,w)=>{w&&wo(y,o);let T=[...p,...x(),...f(y)],M=[...new Map(T.map(B=>[B.path,B])).values()],L=bo(M,r,t,o);L.length&&v(L)};p.length||m(s==null?void 0:s.dom,!0);let g=(0,ve.debounce)(m,D,!0),_=()=>g(s==null?void 0:s.dom,!0);return e.workspace.on("search:onChange",g),r.on("database-update",_),()=>{e.workspace.off("search:onChange",g),r.off("database-update",_)}}),{error:a,files:p}};var So=({error:e})=>F("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),D=()=>{p>=s.length?h(!1):setTimeout(()=>{v(p+t)},100)},x=f=>{let m=[];for(let g=0;g0&&F(Mr,{breakpointCols:r.breakpoints,className:"masonry-grid",columnClassName:"masonry-grid_column",children:[x(s),F(Tt,{hasMore:a,loadMore:D})]})]})}function Dt({app:e,plugin:r,component:t,containerEl:o,searchEl:s,sourcePath:a,settings:h,db:p}){let[v,D]=J(!1),[x,f]=J(void 0);return de(()=>{o.style.setProperty("--note-card-font-size",h.fontsize);let m=y=>{if(!x){let w=t.addChild(new y(e,s,h.query,a));f(w)}},g=()=>{v||D(!0),r.EmbeddedSearch&&m(r.EmbeddedSearch)},_=()=>{v&&D(!1)};return p.ready&&g(),p.on("database-update",g),p.on("database-drop",_),e.workspace.on("catchEmbeddedSearch",m),()=>{p.off("database-update",g),p.off("database-drop",_),e.workspace.off("catchEmbeddedSearch",m)}}),F(Et,{app:e,component:t,sourcePath:a,db:p,embeddedSearch:x,settings:h,children:[!v&&F("div",{children:F("h1",{children:"Note Gallery: Indexing Database..."})}),v&&F(Pt,{})]})}var $e=require("obsidian");var Co=(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=Co;var Io={path:"",query:"",limit:0,recursive:!0,sort:"desc",sortby:"mtime",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),{}),To=(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({},Io),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=To;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(F(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 pe=ct(qe()),re=require("obsidian"),$r=ct(Wr()),qr=ct(Kr());(0,qr.extendPrototype)(pe.default);(0,$r.extendPrototype)(pe.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,D=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=D;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=pe.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:pe.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 g=m!==null&&mK(this,null,function*(){var T;if(w instanceof re.TFile&&w.extension==="md"){let M=this.plugin.app.workspace.activeEditor,L=M&&((T=M.file)==null?void 0:T.path)===w.path&&M.editor?M.editor.cm.state:void 0,B=yield this.plugin.app.vault.cachedRead(w);this.storeKey(w.path,yield this.extractValue(B,w,L),w.stat.mtime)}}))),this.registerEvent(this.plugin.app.vault.on("delete",w=>K(this,null,function*(){w instanceof re.TFile&&w.extension==="md"&&this.deleteKey(w.path)}))),this.registerEvent(this.plugin.app.vault.on("rename",(w,T)=>K(this,null,function*(){w instanceof re.TFile&&w.extension==="md"&&this.renameKey(T,w.path,w.stat.mtime)}))),this.registerEvent(this.plugin.app.vault.on("create",w=>K(this,null,function*(){w instanceof re.TFile&&w.extension==="md"&&this.storeKey(w.path,this.defaultValue(),w.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{s.some(p=>p.path===h)||this.deleteKey(h)});let a=s.filter(h=>!this.memory.has(h.path)||this.memory.get(h.path).mtimeK(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 pe.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=pe.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:pe.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 Po={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 D=e.indexOf("---",3);a=e.slice(0,D+3).trim(),e=e.slice(D+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 Do(e){return(e.innerHTML||e.rendered)&&(e=ne(X({},e),{innerHTML:null,rendered:!1})),e}var Qe=class extends ue.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",()=>Po,Gr,2,Do)}patchCatchEmbeddedSearch(){let t=this;t.register(Le(ue.Component.prototype,{addChild(o){return function(s,...a){try{if(s instanceof ue.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 D;return p.contains("note-gallery")?(D=s.call(this,a,h,p.replace("note-gallery","note-gallery".toUpperCase().replace("-","_")),...v),D):(D=s.call(this,a,h,p,...v),D)}},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 ue.WorkspaceSplit(this.app.workspace,"vertical"),o=this.EmbeddedSearchLeafInitializer=this.attachLeaf(t),s=new ue.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 */