You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
1.3 MiB

7 months ago
"use strict";var YN=Object.defineProperty;var UN=(e,t,n)=>t in e?YN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var De=(e,t,n)=>(UN(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("obsidian"),Lw=require("@codemirror/language"),Cm=require("@codemirror/state"),ul=require("@codemirror/view");function zN(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lx={exports:{}},tm={},ux={exports:{}},ln={},yD;function VN(){if(yD)return ln;yD=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;function v(K){return K===null||typeof K!="object"?null:(K=g&&K[g]||K["@@iterator"],typeof K=="function"?K:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,T={};function I(K,re,pe){this.props=K,this.context=re,this.refs=T,this.updater=pe||w}I.prototype.isReactComponent={},I.prototype.setState=function(K,re){if(typeof K!="object"&&typeof K!="function"&&K!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,K,re,"setState")},I.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};function k(){}k.prototype=I.prototype;function A(K,re,pe){this.props=K,this.context=re,this.refs=T,this.updater=pe||w}var R=A.prototype=new k;R.constructor=A,D(R,I.prototype),R.isPureReactComponent=!0;var j=Array.isArray,B=Object.prototype.hasOwnProperty,L={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function U(K,re,pe){var Ie,Oe={},Ne=null,Be=null;if(re!=null)for(Ie in re.ref!==void 0&&(Be=re.ref),re.key!==void 0&&(Ne=""+re.key),re)B.call(re,Ie)&&!Z.hasOwnProperty(Ie)&&(Oe[Ie]=re[Ie]);var Je=arguments.length-2;if(Je===1)Oe.children=pe;else if(1<Je){for(var ze=Array(Je),Qe=0;Qe<Je;Qe++)ze[Qe]=arguments[Qe+2];Oe.children=ze}if(K&&K.defaultProps)for(Ie in Je=K.defaultProps,Je)Oe[Ie]===void 0&&(Oe[Ie]=Je[Ie]);return{$$typeof:e,type:K,key:Ne,ref:Be,props:Oe,_owner:L.current}}function z(K,re){return{$$typeof:e,type:K.type,key:re,ref:K.ref,props:K.props,_owner:K._owner}}function $(K){return typeof K=="object"&&K!==null&&K.$$typeof===e}function te(K){var re={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(pe){return re[pe]})}var Q=/\/+/g;function ue(K,re){return typeof K=="object"&&K!==null&&K.key!=null?te(""+K.key):re.toString(36)}function ee(K,re,pe,Ie,Oe){var Ne=typeof K;(Ne==="undefined"||Ne==="boolean")&&(K=null);var Be=!1;if(K===null)Be=!0;else switch(Ne){case"string":case"number":Be=!0;break;case"object":switch(K.$$typeof){case e:case t:Be=!0}}if(Be)return Be=K,Oe=Oe(Be),K=Ie===""?"."+ue(Be,0):Ie,j(Oe)?(pe="",K!=null&&(pe=K.replace(Q,"$&/")+"/"),ee(Oe,re,pe,"",function(Qe){return Qe})):Oe!=null&&($(Oe)&&(Oe=z(Oe,pe+(!Oe.key||Be&&Be.key===Oe.key?"":(""+Oe.key).replace(Q,"$&/")+"/")+K)),re.push(Oe)),1;if(Be=0,Ie=Ie===""?".":Ie+":",j(K))for(var Je=0;Je<K.length;Je++){Ne=K[Je];var ze=Ie+ue(Ne,Je);Be+=ee(Ne,re,pe,ze,Oe)}else if(ze=v(K),typeof ze=="function")for(K=ze.call(K),Je=0;!(Ne=K.next()).done;)Ne=Ne.value,ze=Ie+ue(Ne,Je++),Be+=ee(Ne,re,pe,ze,Oe);else if(Ne==="object")throw re=String(K),Error(
`);i.length===0&&await e.vault.adapter.write(vd(e),JSON.stringify({queries:[]},null,2));const a=[];for(let u=0;u<i.length;u++){const d=u,f="Memos";let m="未命名";const g=i[u];let v=C.moment().format("YYYY/MM/DD HH:mm:ss"),w="[]";const D=g.match(/^\d{14,16}/);D&&(v=C.moment(D[0].slice(0,14),"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:ss"));const T=g.match(/\[\{(.+)\}\]/);T&&(w=T[0]);const I=g.match(/\s(.+)\s\[\{/);I&&(m=I[0].slice(1,-3)),a.push({id:d,pinnedAt:"",createdAt:v,updatedAt:v,title:m,querystring:w,userId:f})}await e.vault.adapter.write(vd(e),JSON.stringify({queries:a},null,2))}},S6=async()=>{const{app:e}=_e.getState().dailyNotesState;return await Mx(e,vd(e))||await kx(e),await Mh(e)||[]},D6=(e,t)=>({createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:E("Temp Filter"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),T6=async(e,t)=>{const n=await Mh(_e.getState().dailyNotesState.app)||[],r={createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:C.moment().format("YYYYMMDDHHmmss")+n.length,pinnedAt:"",querystring:t,title:e,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"};return n.push(r),await tg(_e.getState().dailyNotesState.app,n),r};var wv={exports:{}};wv.exports;(function(e,t){(function(){var n,r="4.17.21",o=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",f=500,m="__lodash_placeholder__",g=1,v=2,w=4,D=1,T=2,I=1,k=2,A=4,R=8,j=16,B=32,L=64,Z=128,U=256,z=512,$=30,te="...",Q=800,ue=16,ee=1,le=2,W=3,de=1/0,oe=9007199254740991,he=17976931348623157e292,K=NaN,re=4294967295,pe=re-1,Ie=re>>>1,Oe=[["ary",Z],["bind",I],["bindKey",k],["curry",R],["curryRight",j],["flip",z],["partial",B],["partialRight",L],["rearg",U]],Ne="[object Arguments]",Be="[object Array]",Je="[object AsyncFunction]",ze="[object Boolean]",Qe="[object Date]",It="[object DOMException]",Zt="[object Error]",Re="[object Function]",tt="[object GeneratorFunction]",at="[object Map]",gt="[object Number]",Et="[object Null]",Tt="[object Object]",qt="[object Promise]",zt="[object Proxy]",$t="[object RegExp]",Gt="[object Set]",cn="[object String]",Xt="[object Symbol]",Qn="[object Undefined]",En="[object WeakMap]",Cr="[object WeakSet]",yr="[object ArrayBuffer]",Rn="[object DataView]",ji="[object Float32Array]",xo="[object Float64Array]",Uo="[object Int8Array]",Li="[object Int16Array]",Eo="[object Int32Array]",Ri="[object Uint8Array]",ua="[object Uint8ClampedArray]",ui="[object Uint16Array]",_i="[object Uint32Array]",ne=/\b__p \+= '';/g,ge=/\b(__p \+=) '' \+/g,Ae=/(__e\(.*?\)|\b__t\)) \+\n'';/g,He=/&(?:amp|lt|gt|quot|#39);/g,Ye=/[&<>"']/g,et=RegExp(He.source),nt=RegExp(Ye.source),kt=/<%-([\s\S]+?)%>/g,en=/<%([\s\S]+?)%>/g,jn=/<%=([\s\S]+?)%>/g,wn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lr=/^\w*$/,_n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rr=/[\\^$.*+?()[\]{}|]/g,Rr=RegExp(rr.source),ca=/^\s+/,bn=/\s/,co=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,fo=/\{\n\/\* \[wrapped with (.+)\] \*/,Mr=/,? & /,zo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ho=/[()=,{}\[\]\/\s]/,bl=/\\(\\)?/g,Bi=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Hi=/\w*$/,cu=/^[-+]0x[0-9a-f]+$/i,Sl=/^0b[01]+$/i,Ba=/^\[object .+?Constructor\]$/,da=/^0o[0-7]+$/i,Ha=/^(?:0|[1-9]\d*)$/,Dl=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ya=/($^)/,du=/['\n\r\u2028\u2029\\]/g,Sn="\\ud800-\\udfff",_r="\\u0300-\\u036f",vs="\\ufe20-\\ufe2f",ws="\\u20d0-\\u20ff",Yi=_r+vs+ws,Tl="\\u2700-\\u27bf",ci="a-z\\xdf-\\xf6\\xf8-\\xff",Vo="\\xac\\xb1\\xd7\\xf7",po="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ua="\\u2000-\\u206f",vr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",bs="A-Z\\xc0-\\xd6\\xd8-\\xde",Ss="\\ufe0e\\ufe0f",Ds=Vo+po+Ua+vr,Wo="[']",za="["+Sn+"]",Ui="["+Ds+"]",Zo="["+Yi+"]",M="\\d+",H="["+Tl+"]",J="["+ci+"]",ae="[^"+Sn+Ds+M+Tl+ci+bs
/* [wrapped with `+h+`] */
`)}function uw(c){return Qt(c)||ad(c)||!!(Ag&&c&&c[Ag])}function Di(c,h){var S=typeof c;return h=h??oe,!!h&&(S=="number"||S!="symbol"&&Ha.test(c))&&c>-1&&c%1==0&&c<h}function Dn(c,h,S){if(!ar(S))return!1;var O=typeof h;return(O=="number"?xi(S)&&Di(h,S.length):O=="string"&&h in S)?as(S[h],c):!1}function Fp(c,h){if(Qt(c))return!1;var S=typeof c;return S=="number"||S=="symbol"||S=="boolean"||c==null||ea(c)?!0:Lr.test(c)||!wn.test(c)||h!=null&&c in kn(h)}function vt(c){var h=typeof c;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?c!=="__proto__":c===null}function Zs(c){var h=Qc(c),S=G[h];if(typeof S!="function"||!(h in Jt.prototype))return!1;if(c===S)return!0;var O=Kc(S);return!!O&&c===O[0]}function Pp(c){return!!Vd&&Vd in c}var ay=Su?Zl:jw;function Xc(c){var h=c&&c.constructor,S=typeof h=="function"&&h.prototype||ga;return c===S}function zu(c){return c===c&&!ar(c)}function ed(c,h){return function(S){return S==null?!1:S[c]===h&&(h!==n||c in kn(S))}}function Op(c){var h=we(c,function(O){return S.size===f&&S.clear(),O}),S=h.cache;return h}function sy(c,h){var S=c[1],O=h[1],Y=S|O,X=Y<(I|k|Z),fe=O==Z&&S==R||O==Z&&S==U&&c[7].length<=h[8]||O==(Z|U)&&h[7].length<=h[8]&&S==R;if(!(X||fe))return c;O&I&&(c[2]=h[2],Y|=S&I?0:A);var ve=h[3];if(ve){var Se=c[3];c[3]=Se?Dp(Se,ve,h[4]):ve,c[4]=Se?gi(c[3],m):h[4]}return ve=h[5],ve&&(Se=c[5],c[5]=Se?Tf(Se,ve,h[6]):ve,c[6]=Se?gi(c[5],m):h[6]),ve=h[7],ve&&(c[7]=ve),O&Z&&(c[8]=c[8]==null?h[8]:Gr(c[8],h[8])),c[9]==null&&(c[9]=h[9]),c[0]=h[0],c[1]=Y,c}function ly(c){var h=[];if(c!=null)for(var S in kn(c))h.push(S);return h}function uy(c){return Mc.call(c)}function Af(c,h,S){return h=cr(h===n?c.length-1:h,0),function(){for(var O=arguments,Y=-1,X=cr(O.length-h,0),fe=Pe(X);++Y<X;)fe[Y]=O[h+Y];Y=-1;for(var ve=Pe(h+1);++Y<h;)ve[Y]=O[Y];return ve[h]=S(fe),lr(c,this,ve)}}function Ff(c,h){return h.length<2?c:Qo(c,to(h,0,-1))}function Ur(c,h){for(var S=c.length,O=Gr(h.length,S),Y=bo(c);O--;){var X=h[O];c[O]=Di(X,S)?Y[X]:n}return c}function Xo(c,h){if(!(h==="constructor"&&typeof c[h]=="function")&&h!="__proto__")return c[h]}var os=jp(br),Vu=tp||function(c,h){return An.setTimeout(c,h)},Pf=jp(mf);function Ti(c,h,S){var O=h+"";return Pf(c,lw(O,dy(Np(O),S)))}function jp(c){var h=0,S=0;return function(){var O=ow(),Y=ue-(O-S);if(S=O,Y>0){if(++h>=Q)return arguments[0]}else h=0;return c.apply(n,arguments)}}function ei(c,h){var S=-1,O=c.length,Y=O-1;for(h=h===n?O:h;++S<h;){var X=zc(S,Y),fe=c[X];c[X]=c[S],c[S]=fe}return c.length=h,c}var cy=Op(function(c){var h=[];return c.charCodeAt(0)===46&&h.push(""),c.replace(_n,function(S,O,Y,X){h.push(Y?X.replace(bl,"$1"):O||S)}),h});function Qi(c){if(typeof c=="string"||ea(c))return c;var h=c+"";return h=="0"&&1/c==-de?"-0":h}function $s(c){if(c!=null){try{return Cc.call(c)}catch{}try{return c+""}catch{}}return""}function dy(c,h){return or(Oe,function(S){var O="_."+S[0];h&S[1]&&!ks(c,O)&&c.push(O)}),c.sort()}function Lp(c){if(c instanceof Jt)return c.clone();var h=new Jr(c.__wrapped__,c.__chain__);return h.__actions__=bo(c.__actions__),h.__index__=c.__index__,h.__values__=c.__values__,h}function cw(c,h,S){(S?Dn(c,h,S):h===n)?h=1:h=cr(nn(h),0);var O=c==null?0:c.length;if(!O||h<1)return[];for(var Y=0,X=0,fe=Pe(Al(O/h));Y<O;)fe[X++]=to(c,Y,Y+=h);return fe}function Of(c){for(var h=-1,S=c==null?0:c.length,O=0,Y=[];++h<S;){var X=c[h];X&&(Y[O++]=X)}return Y}function Rp(){var c=arguments.length;if(!c)return[];for(var h=Pe(c-1),S=arguments[0],O=c;O--;)h[O-1]=arguments[O];return mi(Qt(S)?bo(S):[S],wr(h,1))}var Ii=Kt(function(c,h){return xr(c)?Da(c,wr(h,1,xr,!0)):[]}),fn=Kt(function(c,h){var S=Ir(h);return xr(S)&&(S=n),xr(c)?Da(c,wr(h,1,xr,!0),At(S,2)):[]}),Ar=Kt(function(c,h){var S=Ir(h);return xr(S)&&(S=n),xr(c)?Da(c,wr(h,1,xr,!0),n,S):[]});function dr(c,h,S){var O=c==null?0:c.length;return O?(h=S||h===n?1:nn(h),to(c,h<0?0:h,O)):[]}function zr(c,h,S){var O=c==null?0:c.length;return O?(h=S||h===n?1:nn(h),h=O-h,to(c,0,h<0?0:h)):[]}function ti(c,h){return c&&c.length?Lu(c,At(h,3),!0,!0):[]}function Wu(c,h){return c&&c.length?Lu(c,At(h,3),!0):[]}function Tr(c,h,S,O){var Y=c==null
`;c.replace(ft,function(Bt,sn,hn,ta,ri,na){return hn||(hn=ta),Ke+=c.slice(Ze,na).replace(du,xc),sn&&(ve=!0,Ke+=`' +
__e(`+sn+`) +
'`),ri&&(Se=!0,Ke+=`';
`+ri+`;
__p += '`),hn&&(Ke+=`' +
((__t = (`+hn+`)) == null ? '' : __t) +
'`),Ze=na+Bt.length,Bt}),Ke+=`';
`;var _t=mn.call(h,"variable")&&h.variable;if(!_t)Ke=`with (obj) {
`+Ke+`
8 months ago
}
7 months ago
`;else if(ho.test(_t))throw new Wt(u);Ke=(Se?Ke.replace(ne,""):Ke).replace(ge,"$1").replace(Ae,"$1;"),Ke="function("+(_t||"obj")+`) {
`+(_t?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(ve?", __e = _.escape":"")+(Se?`, __j = Array.prototype.join;
8 months ago
function print() { __p += __j.call(arguments, '') }
`:`;
7 months ago
`)+Ke+`return __p
}`;var rn=pD(function(){return pn(X,Ct+"return "+Ke).apply(n,fe)});if(rn.source=Ke,xw(rn))throw rn;return rn}function q4(c){return Nn(c).toLowerCase()}function G4(c){return Nn(c).toUpperCase()}function J4(c,h,S){if(c=Nn(c),c&&(S||h===n))return rt(c);if(!c||!(h=Xn(h)))return c;var O=Go(c),Y=Go(h),X=Mn(O,Y),fe=Yr(O,Y)+1;return ts(O,X,fe).join("")}function K4(c,h,S){if(c=Nn(c),c&&(S||h===n))return c.slice(0,zd(c)+1);if(!c||!(h=Xn(h)))return c;var O=Go(c),Y=Yr(O,Go(h))+1;return ts(O,0,Y).join("")}function Q4(c,h,S){if(c=Nn(c),c&&(S||h===n))return c.replace(ca,"");if(!c||!(h=Xn(h)))return c;var O=Go(c),Y=Mn(O,Go(h));return ts(O,Y).join("")}function X4(c,h){var S=$,O=te;if(ar(h)){var Y="separator"in h?h.separator:Y;S="length"in h?nn(h.length):S,O="omission"in h?Xn(h.omission):O}c=Nn(c);var X=c.length;if(wu(c)){var fe=Go(c);X=fe.length}if(S>=X)return c;var ve=S-kl(O);if(ve<1)return O;var Se=fe?ts(fe,0,ve).join(""):c.slice(0,ve);if(Y===n)return Se+O;if(fe&&(ve+=Se.length-ve),Ew(Y)){if(c.slice(ve).search(Y)){var Ze,$e=Se;for(Y.global||(Y=Ec(Y.source,Nn(Hi.exec(Y))+"g")),Y.lastIndex=0;Ze=Y.exec($e);)var Ke=Ze.index;Se=Se.slice(0,Ke===n?ve:Ke)}}else if(c.indexOf(Xn(Y),ve)!=ve){var ft=Se.lastIndexOf(Y);ft>-1&&(Se=Se.slice(0,ft))}return Se+O}function eN(c){return c=Nn(c),c&&et.test(c)?c.replace(He,Eg):c}var tN=ns(function(c,h,S){return c+(S?" ":"")+h.toUpperCase()}),kw=Ip("toUpperCase");function hD(c,h,S){return c=Nn(c),h=S?n:h,h===n?K0(c)?tw(c):gu(c):c.match(h)||[]}var pD=Kt(function(c,h){try{return lr(c,n,h)}catch(S){return xw(S)?S:new Wt(S)}}),nN=xa(function(c,h){return or(h,function(S){S=Qi(S),Sa(c,S,Ge(c[S],c))}),c});function rN(c){var h=c==null?0:c.length,S=At();return c=h?In(c,function(O){if(typeof O[1]!="function")throw new yi(a);return[S(O[0]),O[1]]}):[],Kt(function(O){for(var Y=-1;++Y<h;){var X=c[Y];if(lr(X[0],this,O))return lr(X[1],this,O)}})}function oN(c){return Hg(Oo(c,g))}function Nw(c){return function(){return c}}function iN(c,h){return c==null||c!==c?h:c}var aN=Yl(),sN=Yl(!0);function Ci(c){return c}function Aw(c){return Hc(typeof c=="function"?c:Oo(c,g))}function lN(c){return Pu(Oo(c,g))}function uN(c,h){return Ji(c,Oo(h,g))}var cN=Kt(function(c,h){return function(S){return Ys(S,c,h)}}),dN=Kt(function(c,h){return function(S){return Ys(c,S,h)}});function Fw(c,h,S){var O=ao(h),Y=wo(h,O);S==null&&!(ar(h)&&(Y.length||!O.length))&&(S=h,h=c,c=this,Y=wo(h,ao(h)));var X=!(ar(S)&&"chain"in S)||!!S.chain,fe=Zl(c);return or(Y,function(ve){var Se=h[ve];c[ve]=Se,fe&&(c.prototype[ve]=function(){var Ze=this.__chain__;if(X||Ze){var $e=c(this.__wrapped__),Ke=$e.__actions__=bo(this.__actions__);return Ke.push({func:Se,args:arguments,thisArg:c}),$e.__chain__=Ze,$e}return Se.apply(c,mi([this.value()],arguments))})}),c}function fN(){return An._===this&&(An._=kg),this}function Pw(){}function hN(c){return c=nn(c),Kt(function(h){return Vs(h,c)})}var pN=Ef(In),mN=Ef(mu),gN=Ef(Ns);function mD(c){return Fp(c)?N(Qi(c)):pp(c)}function yN(c){return function(h){return c==null?n:Qo(c,h)}}var vN=xp(),wN=xp(!0);function Ow(){return[]}function jw(){return!1}function bN(){return{}}function SN(){return""}function DN(){return!0}function TN(c,h){if(c=nn(c),c<1||c>oe)return[];var S=re,O=Gr(c,re);h=At(h),c-=re;for(var Y=xe(O,h);++S<c;)h(S);return Y}function IN(c){return Qt(c)?In(c,Qi):ea(c)?[c]:bo(cy(Nn(c)))}function xN(c){var h=++Du;return Nn(c)+h}var EN=xf(function(c,h){return c+h},0),CN=no("ceil"),MN=xf(function(c,h){return c/h},1),kN=no("floor");function NN(c){return c&&c.length?Rl(c,Ci,qi):n}function AN(c,h){return c&&c.length?Rl(c,At(h,2),qi):n}function FN(c){return Ic(c,Ci)}function PN(c,h){return Ic(c,At(h,2))}function ON(c){return c&&c.length?Rl(c,Ci,Us):n}function jN(c,h){return c&&c.length?Rl(c,At(h,2),Us):n}var LN=xf(function(c,h){return c*h},1),RN=no("round"),_N=xf(function(c,h){return c-h},0);function BN(c){return c&&c.length?Fe(c,Ci):0}function HN(c,h){return c&&c.length?Fe(c,At(h,2)):0}return G.after=ce,G.ary=ye,G.assign=Gk,G.assignIn=aD,G.assignInWith=Cy,G.assignWith=Jk,G.at=Kk,G.before=Le,G.bind=Ge,G.bindAll=nN,G.bindKey=Xe,G.castArray=b
`);let r="",o=[],i=!1,a=1;for(let u=0;u<n.length;u++){const d=n[u];if(d.startsWith("#")&&/^#{1,6}\s/g.test(d)){if(i&&My(d)<=My(t))break;r=d,r===t?(i=!0,a=u+1):i&&My(d)>My(t)?o.push(d):(i=!1,o=[])}else i&&o.push(d)}return t?Nx.isEmpty(o)?{content:"",startLine:-1}:{content:o.join(`
`),startLine:a}:{content:e,startLine:0}}function Ax(e){const t={};for(const n of e)n.parent&&n.parent>0&&(t[n.position.start.line]=n.parent);return t}function I6(e,t,n){var g;const r={},o=(v,w)=>{for(;v[w]!==void 0&&v[w]!==w;)w=v[w];return w},i=yt.getState().app,a=n.split(`
`),u=t+a.length-1,d=(g=i.metadataCache.getFileCache(e))==null?void 0:g.listItems,f={};if(!d)return[];d.forEach(v=>{var T,I;const w=v.position.start.line,D=v.position.end.line;if(w>=t&&D<=u){const k=w-t,A=D-t,R=a.slice(k,A+1),j=R.join(`
`);if(v.parent&&v.parent>0&&(r[v.position.start.line]=v.parent),v.parent&&f[v.parent]){if(w-v.parent===1){const L=(T=a[k])==null?void 0:T.match(/^(\s*)/);L&&(f[v.parent].indent=L[0])}const B=new RegExp("^"+f[v.parent].indent);f[v.parent].content+=`
`+j.split(`
`).map(L=>L==null?void 0:L.replace(B,"")).join(`
`)}else if(v.parent&&f[o(r,v.parent)]){const B=new RegExp("^"+f[o(r,v.parent)].indent);f[o(r,v.parent)].content+=`
`+j.split(`
`).map(L=>L==null?void 0:L.replace(B,"")).join(`
`)}else if(new RegExp(l6).test(j)){f[w]||(f[w]={content:"",indent:""});const B=R.length>1&&((I=R[1])==null?void 0:I.match(/^(\s*)/));B&&(f[w].indent=B[0]),f[w].content=j.split(`
`).map(L=>L==null?void 0:L.replace(f[w].indent,"")).join(`
`)}}}),e.path.includes("2024-04-07");const m=Object.keys(f).map(v=>({line:f[v].content,index:parseInt(v)}));return e.path.includes("2024-04-07"),m}async function x6(e,t){let n=t.vault.getAbstractFileByPath(e);return n||(new C.Notice(E("File not found for the given thino path, is creating a new file")),n=await t.vault.create(e,'{"nodes": [], "edges": []}'),dt.setChangedByMemos(!0)),n}async function E6(e,t){var o;let n;try{n=await t.vault.read(e)}catch(i){console.error(i),n=await t.vault.cachedRead(e)}const r=(o=t.metadataCache.getFileCache(e))==null?void 0:o.frontmatterPosition;return r?n.slice(r.end.offset+1):n}function C6(e){const t=e.split(/\r?\n/),n=[];let r="",o=[],i=0;for(let a=0;a<t.length;a++){const u=t[a];u.startsWith("#")?(r&&n.push({header:r,content:o.join(`
`).trim(),pos:{start:i,end:a-1}}),r=u,o=[],i=a):o.push(u)}return r&&n.push({header:r,content:o.join(`
`).trim(),pos:{start:i,end:t.length-1}}),n}function M6(e){const t=e.split(/\r?\n/),n=[];let r=!1,o=[],i="";for(let a=0;a<t.length;a++){const u=t[a];u.startsWith("> [!thino]")?(r&&(n.push({metadata:i,content:o.join(`
`).trim()}),o=[]),r=!0,i=u.replace("> [!thino]","").trim()):r&&u.startsWith(">")?o.push(u.replace(/^> /,"")):r&&!u.startsWith(">")&&(r=!1,n.push({metadata:i,content:o.join(`
`).trim()}),o=[],i="")}return r&&n.push({metadata:i,content:o.join(`
`).trim()}),n}const k6=e=>{let t;switch(e){case" ":t="TASK-TODO";break;case"x":case"X":t="TASK-DONE";break;default:t="TASK-"+e;break}return t};async function N6(e,t){if(!t)return 0;const{vault:n}=_e.getState().dailyNotesState.app,r=e==null?void 0:e.DefaultMemoComposition,o=e!=null&&e.ProcessEntriesBelow&&(e==null?void 0:e.ProcessContentTarget)!=="whole"?e==null?void 0:e.ProcessEntriesBelow:"",i=(e==null?void 0:e.ProcessContentTarget)!=="whole"?e!=null&&e.DifferentInsertTarget?e!=null&&e.InsertAfterForTask?e==null?void 0:e.InsertAfterForTask:"":o:"";let a;try{a=await n.read(t)}catch(D){console.error(D),a=await n.cachedRead(t)}let u;r!=""&&/{TIME}/g.test(r)&&/{CONTENT}/g.test(r)?u="(-|\\*) (\\[(.{1})\\]\\s)?"+r.replace(/{TIME}/g,"((\\<time\\>)?\\d{1,2}:\\d{2}(\\:\\d{2})?)?").replace(/ {CONTENT}/g,""):u="(-|\\*) (\\[(.{1})\\]\\s)?((\\<time\\>)?\\d{1,2}\\:\\d{2}(\\:\\d{2})?)?";const d=new RegExp(u,"g"),f=(a.match(d)||[]).length,m=new RegExp(o.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),g=new RegExp(i.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),v=(a.match(m)||[]).length,w=(a.match(g)||[]).length;return a=null,v||w?f:0}function ID(e,t,n,r,o){var d,f,m;const i=lh(o,"day")||C.moment(o.stat.ctime);let a;const u=I6(o,n,t);for(const g of u){const v=O6(e.DefaultMemoComposition,g.line),w=j6(e.DefaultMemoComposition,g.line),D=L6(g.line);let T=A6(g.line);if(i.hours(parseInt(v)),i.minutes(parseInt(w)),D&&i.seconds(parseInt(D)),!D&&i.seconds(0),/^\s*[-*]\s(\[(.)\])\s/g.test(g.line)){const U=R6(g.line);T=F6(e.DefaultMemoComposition,g.line),a=k6(U)}else a="JOURNAL";o.path.includes("2024-04-07");let I=T.trim().replaceAll(/<br>/g,`
`);const k=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(T),A=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(T),R=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(T),j=(d=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(T))==null?void 0:d[2],B=(f=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(T))==null?void 0:f[2],L=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(T)?"PUBLIC":"PRIVATE",Z=(m=new RegExp(/(\s|^)\^([0-9a-zA-Z-]+)($|\n)/).exec(T))==null?void 0:m[2];o.path.includes("2024-04-07"),I=I.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,"").replace(/(\s|^)\^([0-9a-zA-Z-]+)($|\n)/g,""),r.push({id:i.format("YYYYMMDDHHmmss")+`${g.index}`,content:I,createdAt:i.format("YYYY/MM/DD HH:mm:ss"),updatedAt:i.format("YYYY/MM/DD HH:mm:ss"),thinoType:a,hasId:Z||"",linkId:"",path:o.path,deletedAt:R?C.moment(j,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:A?"ARCHIVED":"NORMAL",visibility:L,pinned:k,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:B})}}function A6(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)/g,"$4")}function F6(e,t){return P6(e,t)}const P6=(e,t)=>{var o;let n;n="^(-|\\*|\\d\\.)\\s+\\[.\\]\\s(\\d{1,2}:\\d{2}(:\\d{2})?)\\s([\\w\\W]*)";const r=new RegExp(n,"");return t.contains(`
`),(o=r.exec(t))==null?void 0:o[4]},O6=(e,t)=>{var o;let n;return e!=""&&/{TIME}/g.test(e)&&/{CONTENT}/g.test(e)?n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?"+e.replace(/{TIME}/g,"(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)"):n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(.*)",(o=new RegExp(n,"").exec(t))==null?void 0:o[6]},j6=(e,t)=>{var o;let n;return e!=""&&/{TIME}/g.test(e)&&/{CONTENT}/g.test(e)?n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?"+e.replace(/{TIME}/g,"(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)"):n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(.*)",(o=new RegExp(n,"").exec(t))==null?void 0:o[7]},L6=e=>{var r;const t="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\d{1,2})\\:(\\d{2})\\:(\\d{2})(.*)";return(r=new RegExp(t,"").exec(e))==null?void 0:r[7]},R6=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)/.exec(e))==null?void 0:t[2]},Fx=()=>Mm()?!0:(new C.Notice(E("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function Px(e,t){if(!e)return t;const n=_e.getState().dailyNotesState.app||window.app,r=await E6(e,n);let o=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss");await n.fileManager.processFrontMatter(e,i=>{if(i.id||(i.id=ut.randomId(16)),i.createdAt?o=C.moment(i.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?i.createdAt:o:i.createdAt=o,!r.trim())return t;const a=!!i.pinned,u=i.rowStatus&&i.rowStatus==="ARCHIVED",d=!!i.deletedAt,f=i.deletedAt?i.deletedAt:"",m=i.visibility?i.visibility:"PRIVATE",g=i.thinoType?i.thinoType:"JOURNAL",v=i.webId?i.webId:"",w=i.id?i.id:"",D=i.hasId?i.hasId:"",T=i.linkId?i.linkId:"",I=e.path,k="Memo",A="MULTI",R=[];return t.push({id:w,content:r,createdAt:o,updatedAt:o,deletedAt:d?C.moment(f,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:a,rowStatus:u?"ARCHIVED":"NORMAL",visibility:m,thinoType:g,hasId:D,linkId:T,path:I,creatorName:k,sourceType:A,resourceList:R,webId:v}),t})}async function Pb(e,t){var w,D,T,I,k,A;if(!e)return t;const{vault:n}=_e.getState().dailyNotesState.app||window.app;let r;try{r=await n.read(e)}catch(R){console.error(R),r=await n.cachedRead(e)}if(!r)return;const o=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss"),i=C.moment(e.stat.mtime).format("YYYY/MM/DD HH:mm:ss"),a=e.path,u="Thino",d="FILE",f="",m="",g=[],v=await C6(r);for(const R of v){const j=M6(R.content);for(const B of j){const L=B.metadata.match(/\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}/g);if(!L)continue;const Z=(D=(w=B.metadata.match(/id::([^\]]*)/g))==null?void 0:w[0])==null?void 0:D.replace("id::","");if(!Z)continue;const U=L?L[0]:o,z=L?L[0]:i,$=B.metadata.match(/webId::([^\]]*)/g)?(I=(T=B.metadata.match(/webId::([^\]]*)/g))==null?void 0:T[0])==null?void 0:I.replace("webId::",""):"",te=B.metadata.contains("[pinned::true]"),Q=B.metadata.contains("[archived::true]"),ue=B.metadata.contains("[deleted::"),ee=(k=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(B.metadata))==null?void 0:k[2],le=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(B.metadata)?"PUBLIC":"PRIVATE",W=(A=new RegExp(/\[(thinoType|THINOTYPE)::([^\]]*)\]/,"g").exec(B.metadata))==null?void 0:A[2];t.push({id:Z,content:B.content,createdAt:U,updatedAt:z,deletedAt:ue?C.moment(ee,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:te,rowStatus:Q?"ARCHIVED":"NORMAL",visibility:le,thinoType:W||"JOURNAL",hasId:f,linkId:m,path:a,creatorName:u,sourceType:d,resourceList:g,webId:$})}}return t}async function Ox(e,t){if(!e)return[];const n=_e.getState().dailyNotesState.settings,{vault:r}=_e.getState().dailyNotesState.app||window.app;if(await N6(n,e)===0)return;let i;try{i=await r.read(e)}catch(g){console.error(g),i=await r.cachedRead(e)}const{content:a,startLine:u}=TD(i,(n==null?void 0:n.ProcessContentTarget)==="whole"?"":n.ProcessEntriesBelow);let d="",f=0;if(n.DifferentInsertTarget&&(n==null?void 0:n.ProcessContentTarget)!=="whole"&&n.InsertAfterForTask&&!a.includes(n.InsertAfterForTask)){const{content:g,startLin
8 months ago
`);){const r=n.indexOf(`
7 months ago
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function t8({content:e,isList:t,name:n}){const r=_e.getState().dailyNotesState.settings,o=C.moment(),i=ut.randomId(16),a=(r==null?void 0:r.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",u=n||`${o.format("YYYYMMDD")}-${i}`,d=`${a}/${u}.md`,f={id:i,content:e,deletedAt:"",path:d,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"MULTI"},m=yt.getState().app,{vault:g,fileManager:v}=m,w=g.getAbstractFileByPath(a);(!w||!(w instanceof C.TFolder))&&(new C.Notice(E("Folder not found for the given thino path, is creating a new folder")),await g.createFolder(a)),dt.setChangedByMemos(!0);let D;const T=m.vault.getFileByPath(d);return T?D=await g.create(`${a}/${o.format("YYYYMMDD")}-${i}.md`,e):D=await g.create(d,e),await v.processFrontMatter(D,I=>{I.id=i,I.createdAt=o.format("YYYY/MM/DD HH:mm:ss"),I.updatedAt=o.format("YYYY/MM/DD HH:mm:ss"),I.thinoType=t?"JOURNAL":"TASK-TODO"}),(!n||T)&&(r!=null&&r.SetFileNameAfterCreate)&&m.fileManager.promptForFileRename(D),f}async function n8({content:e,isList:t}){const n=_e.getState().dailyNotesState.settings,r=C.moment(),o=ut.randomId(16),i=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",a={id:o,content:e,deletedAt:"",path:i,createdAt:r.format("YYYY/MM/DD HH:mm:ss"),updatedAt:r.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE"},u=yt.getState().app,{vault:d}=u;let f=d.getAbstractFileByPath(i);(!f||!(f instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),f=await d.create(i,""));let m="";try{m=await d.read(f)||await d.cachedRead(f)}catch(k){console.error(k),new C.Notice(E("Failed to read current daily note, check if it exists."))}const g=m.indexOf(`# ${r.format("YYYY-MM-DD")}`);let v=m.indexOf(`
#`,g+1);v===-1&&(v=m.length);const w=`> [!thino] ${r.format("YYYY/MM/DD HH:mm:ss")} %% [id::${o}] [thinoType::${t?"JOURNAL":"TASK-TODO"}] %%`,D=e.replace(/\n/g,`
8 months ago
> `),T=`
7 months ago
${w}
8 months ago
> ${D}
7 months ago
`;let I;if(g===-1){const k=`# ${r.format("YYYY-MM-DD")}`;I=`${m.substring(0,v)}
${k}${T}
${m.substring(v)}`}else I=`${m.substring(0,v)}${T}${m.substring(v)}`;return setTimeout(async()=>{dt.setChangedByMemos(!0),await d.modify(f,I)},200),a}async function ED(e){const t=_e.getState().dailyNotesState.settings,n=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),r=e.id,o=(t==null?void 0:t.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",i={id:r,content:e.content,deletedAt:e.deletedAt||"",path:o,createdAt:n.format("YYYY/MM/DD HH:mm:ss"),updatedAt:n.format("YYYY/MM/DD HH:mm:ss"),thinoType:"JOURNAL",hasId:"",linkId:"",pinned:e.pinned,visibility:"PUBLIC",rowStatus:e.rowStatus||"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE",webId:e.id},a=yt.getState().app,{vault:u}=a;let d=u.getAbstractFileByPath(o);(!d||!(d instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),d=await u.create(o,""));let f="";try{f=await u.read(d)||await u.cachedRead(d)}catch(I){console.error(I),new C.Notice(E("Failed to read current daily note, check if it exists."))}const m=f.indexOf(`# ${n.format("YYYY-MM-DD")}`);let g=f.indexOf(`
#`,m+1);g===-1&&(g=f.length);const v=`> [!thino] ${n.format("YYYY/MM/DD HH:mm:ss")} %% [id::${r}] [thinoType::JOURNAL]${e.rowStatus==="ARCHIVED"?" [archived::true]":""}${e.pinned===!0?" [pinned::true]":""}${e.deletedAt?` [deleted::${e.deletedAt}]`:""}${e.id?` [webId::${e.id}]`:""} %%`,w=e.content.replace(/\n/g,`
> `),D=`
${v}
> ${w}
`;let T;if(m===-1){const I=`# ${n.format("YYYY-MM-DD")}`;T=`${f.substring(0,g)}
${I}${D}
${f.substring(g)}`}else T=`${f.substring(0,g)}${D}${f.substring(g)}`;return dt.setChangedByMemos(!0),await u.modify(d,T),i}async function r8({content:e,isList:t}){const n=_e.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",o=C.moment(),i=ut.randomId(16),a={id:i,content:e,deletedAt:"",path:r,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"CANVAS"},u=yt.getState().app,{vault:d}=u,f=await x6(r,u);if(!f||!(f instanceof C.TFile)){new C.Notice(E("File not found for the given thino path, is creating a new file"));return}const m=await d.read(f),g=JSON.parse(m);if(g.nodes.find(I=>I.id===a.id))return;let w;g.nodes.length>0&&(w=[...g.nodes].reduce((I,k)=>{if(!I.createdAt)return k;const A=C.moment(I.createdAt,"YYYY/MM/DD HH:mm:ss"),R=C.moment(k.createdAt,"YYYY/MM/DD HH:mm:ss");return A.isAfter(R)?I:k}));const D=w?{x:w.x,y:w.y+100,width:w.width,height:w.height}:{x:0,y:0,width:200,height:100};g.nodes.push({...D,type:"text",id:i,text:e,deletedAt:"",createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[]}),dt.setChangedByMemos(!0);const T=JSON.stringify(g,null,2);return await d.modify(f,T),a}async function CD(e,t,n){var $;const{vault:r}=_e.getState().dailyNotesState.app||app,o=_e.getState().dailyNotesState.app||app,i=_e.getState().dailyNotesState.settings,a=o.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,u=a?1:o.vault.getConfig("tabSize"),d=(a?" ":" ").repeat(u),f=e.split(`
`).join(`
`+d),m=n||C.moment(),{DifferentInsertTarget:g,InsertAfterForTask:v,InsertType:w}=i,D=m.format(i.DefaultTimePrefix||"HH:mm"),T=o==null?void 0:o.loadLocalStorage("tokenForSync");let I="";try{e&&T&&i.startSync&&(I=(await M1({content:e,thinoType:"DAILY"})).id)}catch(te){console.error(te)}const k=t?"- ":"- [ ] ",A=i!=null&&i.DefaultMemoComposition?`${k}${($=i==null?void 0:i.DefaultMemoComposition)==null?void 0:$.replace(/{TIME}/g,D).replace(/{CONTENT}/g,(f.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(f)?`
`+d:"")+f)}${f.split(`
`).length>1&&/```/g.test(f.split(`
`)[f.split(`
`).length-1])&&I?`
`+d:" "}${I?`[webId::${I}]`:""}`:`${k}${D} ${f.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(f)?`
`+d:""}${f}${f.split(`
`).length>1&&/```/g.test(f.split(`
`)[f.split(`
`).length-1])&&I?`
`+d:" "}${I?`[webId::${I}]`:""}`,R=su(),j=e0(m,R);let B;if(j?B=j:B=await ut.createDailyNoteCheck(m),!B){new C.Notice(E("Failed to create daily note, check if it exists."));return}j||await yt.fechLocalDailyNotes();let L="";try{L=await r.read(B)||await r.cachedRead(B)}catch(te){console.error(te),new C.Notice(E("Failed to read current daily note, check if it exists."))}const Z=w==="end"?"":t?i.InsertAfter:g&&v||i.InsertAfter,U=await Rx(Z,A,L);await r.modify(B,U.content);const z=U.posNum===-1?_x(U.content).length-(A.split(`
`).length-1)-1:U.posNum+1;return dt.setChangedByMemos(!0),{id:m.format("YYYYMMDDHHmm")+"00"+z,content:e,deletedAt:"",createdAt:m.format("YYYY/MM/DD HH:mm:ss"),updatedAt:m.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:B.path,hasId:"",linkId:"",webId:I,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function o8(e){const{vault:t}=_e.getState().dailyNotesState.app??app,n=_e.getState().dailyNotesState.app||app,{DefaultMemoComposition:r,InsertAfter:o,DefaultTimePrefix:i,DifferentInsertTarget:a,InsertAfterForTask:u,InsertType:d}=_e.getState().dailyNotesState.settings;let f=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PRIVATE"?' [visibility::"PRIVATE"]':"");if(e.id){const $=" [webId::"+e.id+"]";f+=$}const m=C.moment();if(e.deletedAt){const $=" [deleted::"+m.format("YYYYMMDDHHmmss")+"]";f+=$}const g=n.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,v=g?1:n.vault.getConfig("tabSize"),w=(g?" ":" ").repeat(v),D=e.content.split(`
`).join(`
`+w),T=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),I=T.format(i||"HH:mm"),k=e.thinoType?"- [ ] ":"- ",A=r?`${k}${r==null?void 0:r.replace(/{TIME}/g,I).replace(/{CONTENT}/g,(D.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(D)?`
`+w:"")+D)}${D.split(`
`).length>1&&/```/g.test(D.split(`
`)[D.split(`
`).length-1])&&f.trim()?`
`+w:" "}${f}`:`${k}${I} ${D.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(D)?`
`+w:""}${D}${D.split(`
`).length>1&&/```/g.test(D.split(`
`)[D.split(`
`).length-1])&&f.trim()?`
`+w:" "}${f}`,R=su(),j=e0(T,R);let B;if(j?B=j:B=await ut.createDailyNoteCheck(T),!B){new C.Notice(E("Failed to create daily note, check if it exists.")),new C.Notice(E("Your content has been copied to clipboard, and inserted into the editor. Please try it again")),await navigator.clipboard.writeText(e.content);const $=this.app.workspace.getLeavesOfType("thino_view").first();n.workspace.trigger("send-to-thino",e.content,$);return}j||await yt.fechLocalDailyNotes();let L="";try{L=await t.read(B)||await t.cachedRead(B)}catch($){console.error($),new C.Notice(E("Failed to read current daily note, check if it exists."))}const Z=d==="end"?"":e.thinoType&&a&&u||o,U=await Rx(Z,A,L);await t.modify(B,U.content);const z=U.posNum===-1?_x(U.content).length-1:U.posNum+1;return dt.setChangedByMemos(!0),{id:T.format("YYYYMMDDHHmm")+"00"+z,content:e.content,deletedAt:e.deletedAt??"",createdAt:T.format("YYYY/MM/DD HH:mm:ss"),updatedAt:T.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType??"JOURNAL",path:B.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function Rx(e,t,n){const r=new RegExp(`s*${await X6(e)}s*`),o=e8(n),i=o.findIndex(f=>r.test(f)),a=(e==null?void 0:e.trim())===""?!0:i===-1;a&&console.error("unable to find insert after line in file.");const u=o.slice(i+1).findIndex(f=>/^#+ |---/.test(f)),d=u!==-1;if(d){let f;for(let m=u+i;m>i;m--)if(!/^[\s\n ]*$/.test(o[m])){f=m;break}return f||(f=i),await MD(t,n,a?-1:f,d)}else return await MD(t,n,o.length-1,d)}async function MD(e,t,n,r){if(n<-1)throw new Error("Invalid position");if(n===-1)return{content:`${t}
${e}`,posNum:-1};const o=t.split(`
`),i=o.slice(0,n+1).join(`
`),a=o.slice(n+1).join(`
`),u=a.trim().length>0;return{content:`${i}${!u&&!r||!i.endsWith(`
8 months ago
`)?`
7 months ago
`:""}${e}${(u||r?`
`:"")+a}`,posNum:n}}const _x=e=>e.split(/\r?\n/);async function i8(e){const t=_e.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(E("File not found for the given thino path"));return}await t.vault.delete(n)}async function a8(e){const t=_e.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(E("File not found for the given thino path"));return}const o=(await t.vault.read(n)).split(`
`),i=o.findIndex(d=>d.includes(e.id));if(i===-1){new C.Notice(E("Thino not found"));return}const a=o.findIndex((d,f)=>f>i&&d.trim()==="");a===-1?o.splice(i,o.length-i):o.splice(i,a-i);const u=o.join(`
`);if(!u){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),await t.vault.modify(n,u)}async function s8(e){const t=_e.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new C.Notice(E("File not found for the given thino path"));return}const r=await t.vault.read(n),o=JSON.parse(r),i=o.nodes,a=i.findIndex(m=>m.id===e.id);if(a===-1){new C.Notice(E("Thino not found"));return}i.splice(a,1);const u=o.edges;u.filter(m=>m.fromNode===e.id||m.toNode===e.id).forEach(m=>{const g=u.findIndex(v=>v.id===m.id);g!==-1&&u.splice(g,1)}),dt.setChangedByMemos(!0);const f=JSON.stringify(o,null,2);await t.vault.modify(n,f)}async function l8(e){Fx()||new C.Notice(E("If you are disabling the daily note plugin, it would be possible that the thino will not be deleted or patched properly. Please enable the plugin and try again."),5e3);const{vault:t,metadataCache:n}=_e.getState().dailyNotesState.app,r=e.id.toString().slice(0,14),o=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(r,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(r,"YYYYMMDDHHmmss");C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(o,"day");const i=e.path,a=t.getAbstractFileByPath(i);if(!a){new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings"));return}const u=await t.read(a),d=u.split(`
`),f=n.getFileCache(a),m=(f==null?void 0:f.listItems)||[],g=parseInt(e.id.slice(14));let v=g;function w(k,A){let R=[];for(const j in A)A[j]===k&&R.push(parseInt(j),...w(parseInt(j),A));return R}const D=Ax(m),T=m.find(k=>k.position.start.line===g),I=w(g,D);if(I.length>0){const k=I.map(A=>{const R=m.find(j=>j.position.start.line===A);return R?R.position.end.line:-1});v=Math.max(...k,T.position.end.line)}else v=T.position.end.line;if(!u){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),d.splice(g,v-g+1),await t.modify(a,d.join(`
`))}async function u8(){const{vault:e,metadataCache:t}=_e.getState().dailyNotesState.app,n=_e.getState().dailyNotesState.settings,o=t0()+"/"+n.DeleteFileName+".md",i=[],a=t.getFirstLinkpathDest("",o);if(a instanceof C.TFile){let u=await e.read(a),d=c8(u);if(d.length===0)return i;for(let f=0;f<d.length;f++){const m=d[f];if(/- /.test(m)){const v=d8(m).slice(0,13),w=C.moment(v,"YYYYMMDDHHmmss"),D=h8(d[f]),T=C.moment(D.slice(0,13),"YYYYMMDDHHmmss"),I=f8(d[f]);i.push({id:D,content:I,user_id:1,createdAt:w.format("YYYY/MM/DD HH:mm:SS"),updatedAt:w.format("YYYY/MM/DD HH:mm:SS"),deletedAt:T})}else continue}d=null,u=null}return i}const c8=e=>e.split(/\r?\n/),d8=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},f8=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},h8=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function p8(e){const t=await Mh(_e.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await tg(_e.getState().dailyNotesState.app,t)}const m8=async e=>{const{app:t}=_e.getState().dailyNotesState,n=await Mh(t)||[],r=n.find(o=>o.id===e);if(r){const o=C.moment().format("YYYY/MM/DD HH:mm:ss");return r.pinnedAt=o,await tg(t,n),o}else{new C.Notice(E("Query not found"));return}},g8=async e=>{const{app:t}=_e.getState().dailyNotesState,n=await Mh(t)||[],r=n.find(o=>o.id===e);if(r){r.pinnedAt="",await tg(t,n);return}else{new C.Notice(E("Query not found"));return}};function y8(e,t){const n=/%%(.*?)%%/,r=e.match(n);if(!r)return e;const o=r[1].trim(),i={};o.split(" ").forEach(u=>{const[d,f]=u.slice(1,-1).split("::");i[d]=f});for(const u of Object.keys(t))if(u!=="id"&&u!=="content"){if(u==="rowStatus"&&t.rowStatus==="ARCHIVED"){i.archived="true";continue}else if(u==="rowStatus"&&t.rowStatus==="NORMAL"){delete i.archived;continue}if(u==="deleted"&&t.deleted){const d=C.moment().format("YYYYMMDDHHmmss");i.deleted=d}else typeof t[u]=="boolean"?t[u]?i[u]="true":delete i[u]:t[u]&&(i[u]=t[u])}const a=Object.entries(i).map(([u,d])=>`[${u}::${d}]`).join(" ");return e.replace(n,`%% ${a} %%`)}async function fs(e,t){if(!e.sourceType||e.sourceType!=="MULTI")return e;const{vault:n,fileManager:r}=_e.getState().dailyNotesState.app,o=n.getAbstractFileByPath(e.path);if(!o)return e;const i=C.moment();if(await r.processFrontMatter(o,a=>{(t.pinned!==void 0||t.thinoType||t.rowStatus||t.visibility||t.deleted)&&dt.setChangedByMemos(!0),t.id&&(a.id=t.id),t.thinoType&&(a.thinoType=t.thinoType),t.rowStatus&&(a.rowStatus=t.rowStatus),t.visibility&&(a.visibility=t.visibility),t.webId&&(a.webId=t.webId),t.pinned!==void 0&&(a.pinned=t.pinned),t.deleted!==void 0&&(a.deletedAt=t.deleted?i.format("YYYY/MM/DD HH:mm:ss"):""),a.createdAt||(a.createdAt=i.format("YYYY/MM/DD HH:mm:ss")),a.updatedAt=i.format("YYYY/MM/DD HH:mm:ss")}),t.content){const a=await n.read(o);let u=a;const d=t.content.replace(/\$/g,"$$$$");u=a.replace(e.content,d),await n.modify(o,u)}return dt.setChangedByMemos(!0),{...e,id:t.id||e.id,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt||i.format("YYYY/MM/DD HH:mm:ss"),updatedAt:e.updatedAt,content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned!==void 0?t.pinned:e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?i.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function ol(e,t){if(!e.sourceType||e.sourceType!=="FILE")return e;const{vault:n}=_e.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const o=C.moment();let i="";try{i=await n.read(r)}catch(k){console.error(k),i=await n.cachedRead(r)}const a=i.split(/\r?\n/),u=a.findIndex(k=>k.includes(e.id)||e.webId&&k.includes(e.webId)),d=a[u];if(!d)return e;const f=y8(d,t);if(!d)return e;const m=f+`
`,g=a.findIndex((k,A)=>A>u&&k.trim()==="");let v="";g===-1&&(v=a.slice(u+1).join(`
`)),g!==-1&&(v=a.slice(u+1,g).join(`
`));let w=v;t!=null&&t.content&&(w=t.content.split(/\r?\n/).map(j=>"> "+j).join(`
`));const T=(m+w).split(/\r?\n/);a.splice(u,g?g-u:a.length-u,...T);const I=a.join(`
`);return await n.modify(r,I),dt.setChangedByMemos(!0),{...e,id:t.id||e.id,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt||o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:e.updatedAt,content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned!==void 0?t.pinned:e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function il(e,t){if(!e.sourceType||e.sourceType!=="CANVAS")return e;const{vault:n}=_e.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const o=await n.read(r),i=JSON.parse(o),a=i.nodes.find(f=>f.id===e.id);if(!a)return e;t.content&&(a.text=t.content),t.thinoType&&(a.thinoType=t.thinoType),t.rowStatus&&(a.rowStatus=t.rowStatus),t.visibility&&(a.visibility=t.visibility),t.pinned!==void 0&&(a.pinned=t.pinned),t.webId&&(a.webId=t.webId);const u=C.moment();t.deleted!==void 0&&(a.deletedAt=t.deleted?u.format("YYYY/MM/DD HH:mm:ss"):""),a.updatedAt=u.format("YYYY/MM/DD HH:mm:ss");const d=JSON.stringify(i,null,2);return await n.modify(r,d),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:e.updatedAt,content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?u.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function al(e,t){var ue;Fx()||new C.Notice(E("If you are disabling the daily note plugin, it would be possible that the thino will not be deleted or patched properly. Please enable the plugin and try again."));const{vault:n,metadataCache:r}=_e.getState().dailyNotesState.app,o=_e.getState().dailyNotesState.app,{settings:i}=_e.getState().dailyNotesState,a=e.id.toString().slice(0,14),u=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(a,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(a,"YYYYMMDDHHmmss"),d=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(u,"day"),f=e.path,m=n.getAbstractFileByPath(f)||n.getAbstractFileByPath(e.path);if(!m)return new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings")),e;const v=(await n.read(m)).split(`
`),w=r.getFileCache(m),D=(w==null?void 0:w.listItems)||[];if(D.length===0)return new C.Notice(E("Thino not found")),e;const T=parseInt(e.id.slice(14));let I=T;function k(ee,le){let W=[];for(const de in le)le[de]===ee&&W.push(parseInt(de),...k(parseInt(de),le));return W}const A=Ax(D),R=D.find(ee=>ee.position.start.line===T);if(!R)return new C.Notice(E("Thino not found")),e;const j=k(T,A);if(j.length>0){const ee=j.map(le=>{const W=D.find(de=>de.position.start.line===le);return W?W.position.end.line:-1});I=Math.max(...ee,R.position.end.line)}else I=R.position.end.line;const B=v.slice(T,I+1);let L=B.join(`
`);const Z=d?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm"):(parseInt(e.id.toString().slice(10,12))+24).toString()+":"+e.id.toString().slice(12,14);if(!L)return new C.Notice(E("Thino not found")),e;const U=o.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,z=U?1:o.vault.getConfig("tabSize"),$=(U?" ":" ").repeat(z);let te=Z;if(i.DefaultTimePrefix!=="HH:mm"&&(te=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(i.DefaultTimePrefix)),t.content){const ee=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",le=(e.pinned?" [pinned::true]":"")+(e.deletedAt?` [deleted::${e.deletedAt}]`:"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.webId?" [webId::"+e.webId+"]":""),W=t.content.trim().split(`
`)[t.content.trim().split(`
`).length-1].trim(),de=e.hasId&&t.content.trim().split(`
`).length>1&&new RegExp(/(-|\*|\d{1,2}\.)\s/g).test(W)?" ^"+e.hasId:" ";L=`${ee}${te}${de}${t.content.trim().split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(t.content)?`
`+$:""}${t.content.trim().split(`
`).join(`
`+$)}${t.content.split(`
`).length>1&&/```/g.test(t.content.split(`
`)[t.content.split(`
`).length-1])?`
`+$:" "}${le}`}if(t.thinoType){const ee=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";L=L.replace(/^((- \[.\] )|((-|\*) ))/,ee)}if(t.rowStatus){const ee=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";L=L.includes("[archived::")?L.replace(/\[archived::(true|false)\]/,ee):L+`${L.split(`
`).length>1&&/```/g.test(L.split(`
`)[L.split(`
`).length-1])?`
`+$:" "}`+ee}if(t.visibility){const ee='[visibility::"'+t.visibility+'"]';L=L.includes("[visibility::")?L.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,ee):L+`${L.split(`
`).length>1&&/```/g.test(L.split(`
`)[L.split(`
`).length-1])?`
`+$:" "}`+ee}if(t.pinned!==void 0){const ee=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";L=L.includes("[pinned::")?L.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":ee):L+`${L.split(`
`).length>1&&/```/g.test(L.split(`
`)[L.split(`
`).length-1])?`
`+$:" "}`+ee}if(t.webId!==void 0){const ee="[webId::"+t.webId+"]";L=L.includes("[webId::")?L.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":ee):L+`${L.split(`
`).length>1&&/```/g.test(L.split(`
`)[L.split(`
`).length-1])?`
`+$:" "}`+ee}const Q=C.moment();if(t.deleted!==void 0){const ee="[deleted::"+Q.format("YYYYMMDDHHmmss")+"]";t.deleted?(L=L.replace(/\[deleted::([^\]]+)\]/,""),L=L+`${L.split(`
`).length>1&&/```/g.test(L.split(`
`)[L.split(`
`).length-1])?`
`+$:" "}`+ee):t.deleted===!1&&(L=L.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId&&((ue=t.content)==null?void 0:ue.split(`
`).length)===1){const ee=" ^"+e.hasId;L=L.trim().replace(/\s\^([0-9a-zA-Z-]+)($|\n)/g,"")+`${L.split(`
`).length>1&&/```/g.test(L.split(`
`)[L.split(`
`).length-1])?`
`+$:" "}`+ee}return L!==B.join(`
`)?(v.splice(T,I-R.position.start.line+1,L),await n.modify(m,v.join(`
`)),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType??e.thinoType,createdAt:e.createdAt,updatedAt:e.updatedAt,content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?Q.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}const v8=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return il(e,{id:e.id,pinned:!0});case"DAILY":return al(e,{id:e.id,pinned:!0});case"MULTI":return fs(e,{id:e.id,pinned:!0});case"FILE":return ol(e,{id:e.id,pinned:!0})}},w8=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return il(e,{id:e.id,pinned:!1});case"DAILY":return al(e,{id:e.id,pinned:!1});case"MULTI":return fs(e,{id:e.id,pinned:!1});case"FILE":return ol(e,{id:e.id,pinned:!1})}};var Ob;(e=>{async function t(T){return await xD(T)}e.getMyMemos=t;async function n(T){return await xD([T])}e.updateSpecificTypeMemo=n;function r(){return u8()}e.getMyDeletedMemos=r;function o(T){const I=je.getMemoById(T);if(I)switch(I==null?void 0:I.sourceType){case"DAILY":return al(I,{id:I.id,deleted:!1});case"CANVAS":return il(I,{id:I.id,deleted:!1});case"MULTI":return fs(I,{id:I.id,deleted:!1});case"FILE":return ol(I,{id:I.id,deleted:!1})}}e.restoreMemo=o;function i(T){return a8(T)}e.deleteMemoInSingleFile=i;function a(T){return i8(T)}e.deleteMemoInMultiFiles=a;function u(T){return l8(T)}e.deleteMemoInDailyNote=u;function d(T){return s8(T)}e.deleteMemoInCanvas=d;function f(){return S6()}e.getMyQueries=f;async function m(T,I){return await T6(T,I)}e.createQuery=m;function g(T,I,k){return U6(T,I,k)}e.updateQuery=g;function v(T){return p8(T)}e.deleteQueryById=v;function w(T){return m8(T)}e.pinQuery=w;function D(T){return g8(T)}e.unpinQuery=D})(Ob||(Ob={}));const ki=Ob;var lu={};Object.defineProperty(lu,"__esModule",{value:!0});class Ld extends Error{}class b8 extends Ld{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class S8 extends Ld{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class D8 extends Ld{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class pm extends Ld{}class Bx extends Ld{constructor(t){super(`Invalid unit ${t}`)}}class ka extends Ld{}class Gu extends Ld{constructor(){super("Zone is an abstract class")}}const ht="numeric",ms="short",ia="long",bv={year:ht,month:ht,day:ht},Hx={year:ht,month:ms,day:ht},T8={year:ht,month:ms,day:ht,weekday:ms},Yx={year:ht,month:ia,day:ht},Ux={year:ht,month:ia,day:ht,weekday:ia},zx={hour:ht,minute:ht},Vx={hour:ht,minute:ht,second:ht},Wx={hour:ht,minute:ht,second:ht,timeZoneName:ms},Zx={hour:ht,minute:ht,second:ht,timeZoneName:ia},$x={hour:ht,minute:ht,hourCycle:"h23"},qx={hour:ht,minute:ht,second:ht,hourCycle:"h23"},Gx={hour:ht,minute:ht,second:ht,hourCycle:"h23",timeZoneName:ms},Jx={hour:ht,minute:ht,second:ht,hourCycle:"h23",timeZoneName:ia},Kx={year:ht,month:ht,day:ht,hour:ht,minute:ht},Qx={year:ht,month:ht,day:ht,hour:ht,minute:ht,second:ht},Xx={year:ht,month:ms,day:ht,hour:ht,minute:ht},eE={year:ht,month:ms,day:ht,hour:ht,minute:ht,second:ht},I8={year:ht,month:ms,day:ht,weekday:ms,hour:ht,minute:ht},tE={year:ht,month:ia,day:ht,hour:ht,minute:ht,timeZoneName:ms},nE={year:ht,month:ia,day:ht,hour:ht,minute:ht,second:ht,timeZoneName:ms},rE={year:ht,month:ia,day:ht,weekday:ia,hour:ht,minute:ht,timeZoneName:ia},oE={year:ht,month:ia,day:ht,weekday:ia,hour:ht,minute:ht,second:ht,timeZoneName:ia};class rg{get type(){throw new Gu}get name(){throw new Gu}get ianaName(){return this.name}get isUniversal(){throw new Gu}offsetName(t,n){throw new Gu}formatOffset(t,n){throw new Gu}offset(t){throw new Gu}equals(t){throw new Gu}get isValid(){throw new Gu}}let Bw=null;class r0 extends rg{static get instance(){return Bw===null&&(Bw=new r0),Bw}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return aE(t,n,r)}formatOffset(t,n){return bm(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isV
`||ne.charAt(nt)==="\r"&&ne.charAt(nt+1)!==`
`)&&(Ye++,et===0&&(et=nt+1)),nt--}var kt=He+Ye,en=ge-et;return Ae[ge]={line:kt,lineStart:et},{offset:ge,line:kt+1,column:en+1}}function Q(ne){if(!j(ne))throw new Error("not a parser: "+ne)}function ue(ne,ge){return typeof ne=="string"?ne.charAt(ge):ne[ge]}function ee(ne){if(typeof ne!="number")throw new Error("not a number: "+ne)}function le(ne){if(typeof ne!="function")throw new Error("not a function: "+ne)}function W(ne){if(typeof ne!="string")throw new Error("not a string: "+ne)}var de=2,oe=3,he=8,K=5*he,re=4*he,pe=" ";function Ie(ne,ge){return new Array(ge+1).join(ne)}function Oe(ne,ge,Ae){var He=ge-ne.length;return He<=0?ne:Ie(Ae,He)+ne}function Ne(ne,ge,Ae,He){return{from:ne-ge>0?ne-ge:0,to:ne+Ae>He?He:ne+Ae}}function Be(ne,ge){var Ae,He,Ye,et,nt,kt=ge.index,en=kt.offset,jn=1;if(en===ne.length)return"Got the end of the input";if(L(ne)){var wn=en-en%he,Lr=en-wn,_n=Ne(wn,K,re+he,ne.length),rr=f(function(bn){return f(function(co){return Oe(co.toString(16),2,"0")},bn)},function(bn,co){var fo=bn.length,Mr=[],zo=0;if(fo<=co)return[bn.slice()];for(var ho=0;ho<fo;ho++)Mr[zo]||Mr.push([]),Mr[zo].push(bn[ho]),(ho+1)%co==0&&zo++;return Mr}(ne.slice(_n.from,_n.to).toJSON().data,he));et=function(bn){return bn.from===0&&bn.to===1?{from:bn.from,to:bn.to}:{from:bn.from/he,to:Math.floor(bn.to/he)}}(_n),He=wn/he,Ae=3*Lr,Lr>=4&&(Ae+=1),jn=2,Ye=f(function(bn){return bn.length<=4?bn.join(" "):bn.slice(0,4).join(" ")+" "+bn.slice(4).join(" ")},rr),(nt=(8*(et.to>0?et.to-1:et.to)).toString(16).length)<2&&(nt=2)}else{var Rr=ne.split(/\r\n|[\n\r\u2028\u2029]/);Ae=kt.column-1,He=kt.line-1,et=Ne(He,de,oe,Rr.length),Ye=Rr.slice(et.from,et.to),nt=et.to.toString().length}var ca=He-et.from;return L(ne)&&(nt=(8*(et.to>0?et.to-1:et.to)).toString(16).length)<2&&(nt=2),d(function(bn,co,fo){var Mr,zo=fo===ca,ho=zo?"> ":pe;return Mr=L(ne)?Oe((8*(et.from+fo)).toString(16),nt,"0"):Oe((et.from+fo+1).toString(),nt," "),[].concat(bn,[ho+Mr+" | "+co],zo?[pe+Ie(" ",nt)+" | "+Oe("",Ae," ")+Ie("^",jn)]:[])},[],Ye).join(`
`)}function Je(ne,ge){return[`
`,"-- PARSING FAILED "+Ie("-",50),`
8 months ago
7 months ago
`,Be(ne,ge),`
8 months ago
7 months ago
`,(Ae=ge.expected,Ae.length===1?`Expected:
8 months ago
7 months ago
`+Ae[0]:`Expected one of the following:
8 months ago
7 months ago
`+Ae.join(", ")),`
`].join("");var Ae}function ze(ne){return ne.flags!==void 0?ne.flags:[ne.global?"g":"",ne.ignoreCase?"i":"",ne.multiline?"m":"",ne.unicode?"u":"",ne.sticky?"y":""].join("")}function Qe(){for(var ne=[].slice.call(arguments),ge=ne.length,Ae=0;Ae<ge;Ae+=1)Q(ne[Ae]);return i(function(He,Ye){for(var et,nt=new Array(ge),kt=0;kt<ge;kt+=1){if(!(et=z(ne[kt]._(He,Ye),et)).status)return et;nt[kt]=et.value,Ye=et.index}return z(Z(Ye,nt),et)})}function It(){var ne=[].slice.call(arguments);if(ne.length===0)throw new Error("seqMap needs at least one argument");var ge=ne.pop();return le(ge),Qe.apply(null,ne).map(function(Ae){return ge.apply(null,Ae)})}function Zt(){var ne=[].slice.call(arguments),ge=ne.length;if(ge===0)return Tt("zero alternates");for(var Ae=0;Ae<ge;Ae+=1)Q(ne[Ae]);return i(function(He,Ye){for(var et,nt=0;nt<ne.length;nt+=1)if((et=z(ne[nt]._(He,Ye),et)).status)return et;return et})}function Re(ne,ge){return tt(ne,ge).or(Et([]))}function tt(ne,ge){return Q(ne),Q(ge),It(ne,ge.then(ne).many(),function(Ae,He){return[Ae].concat(He)})}function at(ne){W(ne);var ge="'"+ne+"'";return i(function(Ae,He){var Ye=He+ne.length,et=Ae.slice(He,Ye);return et===ne?Z(Ye,et):U(He,ge)})}function gt(ne,ge){(function(Ye){if(!(Ye instanceof RegExp))throw new Error("not a regexp: "+Ye);for(var et=ze(Ye),nt=0;nt<et.length;nt++){var kt=et.charAt(nt);if(kt!=="i"&&kt!=="m"&&kt!=="u"&&kt!=="s")throw new Error('unsupported regexp flag "'+kt+'": '+Ye)}})(ne),arguments.length>=2?ee(ge):ge=0;var Ae=function(Ye){return RegExp("^(?:"+Ye.source+")",ze(Ye))}(ne),He=""+ne;return i(function(Ye,et){var nt=Ae.exec(Ye.slice(et));if(nt){if(0<=ge&&ge<=nt.length){var kt=nt[0],en=nt[ge];return Z(et+kt.length,en)}return U(et,"valid match group (0 to "+nt.length+") in "+He)}return U(et,He)})}function Et(ne){return i(function(ge,Ae){return Z(Ae,ne)})}function Tt(ne){return i(function(ge,Ae){return U(Ae,ne)})}function qt(ne){if(j(ne))return i(function(ge,Ae){var He=ne._(ge,Ae);return He.index=Ae,He.value="",He});if(typeof ne=="string")return qt(at(ne));if(ne instanceof RegExp)return qt(gt(ne));throw new Error("not a string, regexp, or parser: "+ne)}function zt(ne){return Q(ne),i(function(ge,Ae){var He=ne._(ge,Ae),Ye=ge.slice(Ae,He.index);return He.status?U(Ae,'not "'+Ye+'"'):Z(Ae,null)})}function $t(ne){return le(ne),i(function(ge,Ae){var He=ue(ge,Ae);return Ae<ge.length&&ne(He)?Z(Ae+1,He):U(Ae,"a character/byte matching "+ne)})}function Gt(ne,ge){arguments.length<2&&(ge=ne,ne=void 0);var Ae=i(function(He,Ye){return Ae._=ge()._,Ae._(He,Ye)});return ne?Ae.desc(ne):Ae}function cn(){return Tt("fantasy-land/empty")}a.parse=function(ne){if(typeof ne!="string"&&!L(ne))throw new Error(".parse must be called with a string or Buffer as its argument");var ge,Ae=this.skip(Cr)._(ne,0);return ge=Ae.status?{status:!0,value:Ae.value}:{status:!1,index:te(ne,Ae.furthest),expected:Ae.expected},delete $[ne],ge},a.tryParse=function(ne){var ge=this.parse(ne);if(ge.status)return ge.value;var Ae=Je(ne,ge),He=new Error(Ae);throw He.type="ParsimmonError",He.result=ge,He},a.assert=function(ne,ge){return this.chain(function(Ae){return ne(Ae)?Et(Ae):Tt(ge)})},a.or=function(ne){return Zt(this,ne)},a.trim=function(ne){return this.wrap(ne,ne)},a.wrap=function(ne,ge){return It(ne,this,ge,function(Ae,He){return He})},a.thru=function(ne){return ne(this)},a.then=function(ne){return Q(ne),Qe(this,ne).map(function(ge){return ge[1]})},a.many=function(){var ne=this;return i(function(ge,Ae){for(var He=[],Ye=void 0;;){if(!(Ye=z(ne._(ge,Ae),Ye)).status)return z(Z(Ae,He),Ye);if(Ae===Ye.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");Ae=Ye.index,He.push(Ye.value)}})},a.tieWith=function(ne){return W(ne),this.map(function(ge){if(function(Ye){if(!B(Ye))throw new Error("not an array: "+Ye)}(ge),ge.length){W(ge[0]);for(var Ae=ge[0],He=1;He<ge.length;He++)W(ge[He]),Ae+=ne+ge[He];return Ae}return""})},a.tie=function(){return this.tieWith("")},a.times=function(ne,ge){var Ae=this;return arguments.length<2&&(ge=ne),ee(ne)
`),ua=at(`\r
`),ui=Zt(ua,Ri,Eo).desc("newline"),_i=Zt(ui,Cr);i.all=En,i.alt=Zt,i.any=Qn,i.cr=Eo,i.createLanguage=function(ne){var ge={};for(var Ae in ne)({}).hasOwnProperty.call(ne,Ae)&&function(He){ge[He]=Gt(function(){return ne[He](ge)})}(Ae);return ge},i.crlf=ua,i.custom=function(ne){return i(ne(Z,U))},i.digit=yr,i.digits=Rn,i.empty=cn,i.end=_i,i.eof=Cr,i.fail=Tt,i.formatError=Je,i.index=Xt,i.isParser=j,i.lazy=Gt,i.letter=ji,i.letters=xo,i.lf=Ri,i.lookahead=qt,i.makeFailure=U,i.makeSuccess=Z,i.newline=ui,i.noneOf=function(ne){return $t(function(ge){return ne.indexOf(ge)<0}).desc("none of '"+ne+"'")},i.notFollowedBy=zt,i.of=Et,i.oneOf=function(ne){for(var ge=ne.split(""),Ae=0;Ae<ge.length;Ae++)ge[Ae]="'"+ge[Ae]+"'";return $t(function(He){return ne.indexOf(He)>=0}).desc(ge)},i.optWhitespace=Uo,i.Parser=i,i.range=function(ne,ge){return $t(function(Ae){return ne<=Ae&&Ae<=ge}).desc(ne+"-"+ge)},i.regex=gt,i.regexp=gt,i.sepBy=Re,i.sepBy1=tt,i.seq=Qe,i.seqMap=It,i.seqObj=function(){for(var ne,ge={},Ae=0,He=(ne=arguments,Array.prototype.slice.call(ne)),Ye=He.length,et=0;et<Ye;et+=1){var nt=He[et];if(!j(nt)){if(B(nt)&&nt.length===2&&typeof nt[0]=="string"&&j(nt[1])){var kt=nt[0];if(Object.prototype.hasOwnProperty.call(ge,kt))throw new Error("seqObj: duplicate key "+kt);ge[kt]=!0,Ae++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(Ae===0)throw new Error("seqObj expects at least one named parser, found zero");return i(function(en,jn){for(var wn,Lr={},_n=0;_n<Ye;_n+=1){var rr,Rr;if(B(He[_n])?(rr=He[_n][0],Rr=He[_n][1]):(rr=null,Rr=He[_n]),!(wn=z(Rr._(en,jn),wn)).status)return wn;rr&&(Lr[rr]=wn.value),jn=wn.index}return z(Z(jn,Lr),wn)})},i.string=at,i.succeed=Et,i.takeWhile=function(ne){return le(ne),i(function(ge,Ae){for(var He=Ae;He<ge.length&&ne(ue(ge,He));)He++;return Z(He,ge.slice(Ae,He))})},i.test=$t,i.whitespace=Li,i["fantasy-land/empty"]=cn,i["fantasy-land/of"]=Et,i.Binary={bitSeq:w,bitSeqObj:function(ne){v();var ge={},Ae=0,He=f(function(et){if(B(et)){var nt=et;if(nt.length!==2)throw new Error("["+nt.join(", ")+"] should be length 2, got length "+nt.length);if(W(nt[0]),ee(nt[1]),Object.prototype.hasOwnProperty.call(ge,nt[0]))throw new Error("duplicate key in bitSeqObj: "+nt[0]);return ge[nt[0]]=!0,Ae++,nt}return ee(et),[null,et]},ne);if(Ae<1)throw new Error("bitSeqObj expects at least one named pair, got ["+ne.join(", ")+"]");var Ye=f(function(et){return et[0]},He);return w(f(function(et){return et[1]},He)).map(function(et){return d(function(nt,kt){return kt[0]!==null&&(nt[kt[0]]=kt[1]),nt},{},f(function(nt,kt){return[nt,et[kt]]},Ye))})},byte:function(ne){if(v(),ee(ne),ne>255)throw new Error("Value specified to byte constructor ("+ne+"=0x"+ne.toString(16)+") is larger in value than a single byte.");var ge=(ne>15?"0x":"0x0")+ne.toString(16);return i(function(Ae,He){var Ye=ue(Ae,He);return Ye===ne?Z(He+1,Ye):U(He,ge)})},buffer:function(ne){return D("buffer",ne).map(function(ge){return Buffer.from(ge)})},encodedString:function(ne,ge){return D("string",ge).map(function(Ae){return Ae.toString(ne)})},uintBE:I,uint8BE:I(1),uint16BE:I(2),uint32BE:I(4),uintLE:k,uint8LE:k(1),uint16LE:k(2),uint32LE:k(4),intBE:A,int8BE:A(1),int16BE:A(2),int32BE:A(4),intLE:R,int8LE:R(1),int16LE:R(2),int32LE:R(4),floatBE:D("floatBE",4).map(function(ne){return ne.readFloatBE(0)}),floatLE:D("floatLE",4).map(function(ne){return ne.readFloatLE(0)}),doubleBE:D("doubleBE",8).map(function(ne){return ne.readDoubleBE(0)}),doubleLE:D("doubleLE",8).map(function(ne){return ne.readDoubleLE(0)})},n.exports=i}])})})(me);var B1=()=>/(?:[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F
8 months ago
${e}`,posNum:-1};const r=t.split(`
7 months ago
`),o=r.slice(0,n+1).join(`
`),i=r.slice(n+1).join(`
`);return/^\s*$/g.test(r[n+1])?{content:`${o}
8 months ago
${e}
7 months ago
${i}`,posNum:n}:{content:`${o}
8 months ago
${e}
7 months ago
${i}`,posNum:n}}function _F(e,t,n){var o;const r=t.workspace.getLeavesOfType("markdown");for(const i of r){const a=i.view;if(((o=a==null?void 0:a.file)==null?void 0:o.path)===e){t.workspace.revealLeaf(i);try{return i.view.setEphemeralState({line:n}),!0}catch(u){return console.error(u),!1}}}return!1}const Y1=async e=>{var i;const t=yt.getState().app,n=t.workspace.getLeavesOfType("markdown");for(const a of n){const u=a.view;if(((i=u==null?void 0:u.file)==null?void 0:i.path)===e){t.workspace.revealLeaf(a);return}}const r=t.metadataCache.getFirstLinkpathDest("",e);if(!r){new C.Notice(E("File not found for the given thino path"));return}await t.workspace.getLeaf(!0).openFile(r)},U1=async(e,t)=>{const{app:n}=yt.getState(),r=parseInt(e.slice(14));if(_F(t,n,r))return;const o=n.metadataCache.getFirstLinkpathDest("",t);if(!C.Platform.isMobile)await n.workspace.getLeaf(!0).openFile(o,{eState:{line:r}});else{let i=n.workspace.activeLeaf;i===null&&(i=n.workspace.getLeaf(!0)),await i.openFile(o,{eState:{line:r}})}},z1=async(e,t)=>{var f,m,g;const n=yt.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new C.Notice(E("File not found for the given thino path"));return}let o="";try{o=await n.vault.read(r)}catch(v){console.error(v),o=await n.vault.cachedRead(r)}const a=o.split(/\r?\n/).findIndex(v=>v.contains(e)),u=n.workspace.getLeavesOfType("markdown");for(const v of u){const w=v.view;if(((f=w==null?void 0:w.file)==null?void 0:f.path)===r.path){n.workspace.revealLeaf(v);try{(m=v.view.editor)==null||m.setCursor({line:a,ch:1});return}catch(D){console.error(D)}}}const d=n.workspace.getLeaf(!0);await d.openFile(r,{eState:{line:a}});try{(g=d.view.editor)==null||g.setCursor({line:a,ch:1})}catch(v){console.error(v)}},V1=async(e,t)=>{var u;const n=yt.getState().app,r=(d,f)=>{var g;const m=(g=Array.from(d.nodes.values()))==null?void 0:g.find(v=>v.id===f);return m?(d.selectOnly(m),d.zoomToSelection(),!0):!1},o=n.workspace.getLeavesOfType("canvas");for(const d of o){const f=d.view;if(((u=f==null?void 0:f.file)==null?void 0:u.path)===t&&(n.workspace.revealLeaf(d),r(f.canvas,e)))return}const i=n.metadataCache.getFirstLinkpathDest("",t);if(!i){new C.Notice(E("File not found for the given thino path"));return}const a=n.workspace.getLeaf(!0);await a.openFile(i),setTimeout(()=>{var d;r((d=a.view)==null?void 0:d.canvas,e)},10)};class BF{constructor(){De(this,"initialized",!1)}getState(){return _e.getState().memoState}async fetchAllMemos(){const t=yt.getState().settings;ut.checkDailyInMulti(t);const n=await ki.getMyMemos(t.EnabledLocationList.map(i=>i.value)),r=[...n.memos],o=[...n.commentMemos];return _e.dispatch({type:"SET_MEMOS",payload:{memos:r}}),_e.dispatch({type:"SET_COMMENT_MEMOS",payload:{commentMemos:o}}),this.initialized||(this.initialized=!0,dt.setLoaded(!0)),r}async updateTypeMemos(t){const n=await ki.updateSpecificTypeMemo(t),r=this.getState().memos.filter(o=>o.sourceType!==t);_e.dispatch({type:"SET_MEMOS",payload:{memos:[...r,...n.memos]}})}async removeTypeMemos(t){const n=this.getState().memos.filter(r=>r.sourceType!==t);_e.dispatch({type:"SET_MEMOS",payload:{memos:[...n]}})}async fetchDeletedMemos(){const t=await ki.getMyDeletedMemos();return t.sort((n,r)=>ut.getTimeStampByDate(r.deletedAt)-ut.getTimeStampByDate(n.deletedAt)),t}pushMemo(t){_e.dispatch({type:"INSERT_MEMO",payload:{memo:{...t}}})}pushCommentMemo(t){_e.dispatch({type:"INSERT_COMMENT_MEMO",payload:{memo:{...t}}})}getMemoById(t){for(const n of this.getState().memos)if(n.id===t)return n;return null}getCommentMemoById(t){for(const n of this.getState().commentMemos)if(n.id===t)return n;return null}getMemoByWebId(t){for(const n of this.getState().memos)if(n.webId===t||n.id===t)return n;return null}async updateMemoById(t,n,r){const o=this.getMemoByWebId(t);if(!o)return;let i=null;const a=r?{}:{content:n.content,rowStatus:n.rowStatus,pinned:n.pinned,deleted:!!n.deletedAt,thinoType:n.thinoType??""};switch(o.sourceType){case"DAILY":i=await al(o,{id:o.id,webId:n.id,...a});break;case"CANVAS":i=await il(o,{id:o.id,webId:n.id,...a});break;case"MULTI":i=await fs(o,{id:o.id
`+re+s}var Ie=!1;function Oe(s,l){if(!s||Ie)return"";Ie=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(Le){var b=Le}Reflect.construct(s,[],l)}else{try{l.call()}catch(Le){b=Le}s.call(l.prototype)}else{try{throw Error()}catch(Le){b=Le}s()}}catch(Le){if(Le&&b&&typeof Le.stack=="string"){for(var x=Le.stack.split(`
`),P=b.stack.split(`
`),V=x.length-1,ce=P.length-1;1<=V&&0<=ce&&x[V]!==P[ce];)ce--;for(;1<=V&&0<=ce;V--,ce--)if(x[V]!==P[ce]){if(V!==1||ce!==1)do if(V--,ce--,0>ce||x[V]!==P[ce]){var ye=`
`+x[V].replace(" at new "," at ");return s.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",s.displayName)),ye}while(1<=V&&0<=ce);break}}}finally{Ie=!1,Error.prepareStackTrace=p}return(s=s?s.displayName||s.name:"")?pe(s):""}function Ne(s){switch(s.tag){case 5:return pe(s.type);case 16:return pe("Lazy");case 13:return pe("Suspense");case 19:return pe("SuspenseList");case 0:case 2:case 15:return s=Oe(s.type,!1),s;case 11:return s=Oe(s.type.render,!1),s;case 1:return s=Oe(s.type,!0),s;default:return""}}function Be(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case Z:return"Fragment";case L:return"Portal";case z:return"Profiler";case U:return"StrictMode";case ue:return"Suspense";case ee:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case te:return(s.displayName||"Context")+".Consumer";case $:return(s._context.displayName||"Context")+".Provider";case Q:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case le:return l=s.displayName||null,l!==null?l:Be(s.type)||"Memo";case W:l=s._payload,s=s._init;try{return Be(s(l))}catch{}}return null}function Je(s){var l=s.type;switch(s.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=l.render,s=s.displayName||s.name||"",l.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Be(l);case 8:return l===U?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function ze(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Qe(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function It(s){var l=Qe(s)?"checked":"value",p=Object.getOwnPropertyDescriptor(s.constructor.prototype,l),b=""+s[l];if(!s.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var x=p.get,P=p.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return x.call(this)},set:function(V){b=""+V,P.call(this,V)}}),Object.defineProperty(s,l,{enumerable:p.enumerable}),{getValue:function(){return b},setValue:function(V){b=""+V},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function Zt(s){s._valueTracker||(s._valueTracker=It(s))}function Re(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var p=l.getValue(),b="";return s&&(b=Qe(s)?s.checked?"true":"false":s.value),s=b,s!==p?(l.setValue(s),!0):!1}function tt(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function at(s,l){var p=l.checked;return K({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??s._wrapperState.initialChecked})}function gt(s,l){var p=l.defaultValue==null?"":l.defaultValue,b=l.checked!=null?l.checked:l.defaultChecked;p=ze(l.value!=null?l.value:p),s._wrapperState={initialChecked:b,initialValue:p,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function Et(s,l){l=l.checked,l!=null&&R(s,"checked",l,!1)}function Tt(s,l){Et(s,l);var p=ze(l.value),b=l.type;if(p!=null)b==="number"?(p===0&&s.value===""||s.value!=p)&&(s.value=""+p):s.value!==""+p&&(s.value=""+p);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}l.hasOwnProperty("value")?zt(s,l.type,p):l.hasOwnProperty("defaultValue")&&zt(s,l.type,ze(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(s.defaultChecked=!!l.defaultChecked)}function qt(s,l,p){if(l.hasOwnProperty("value")|
`).replace(ow,"")}function Fc(s,l,p){if(l=Pg(l),Pg(s)!==l&&p)throw Error(n(425))}function Kd(){}var Pc=null,Fl=null;function Oc(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Ps=typeof setTimeout=="function"?setTimeout:void 0,jc=typeof clearTimeout=="function"?clearTimeout:void 0,xu=typeof Promise=="function"?Promise:void 0,Qd=typeof queueMicrotask=="function"?queueMicrotask:typeof xu<"u"?function(s){return xu.resolve(null).then(s).catch(Eu)}:Ps;function Eu(s){setTimeout(function(){throw s})}function rp(s,l){var p=l,b=0;do{var x=p.nextSibling;if(s.removeChild(p),x&&x.nodeType===8)if(p=x.data,p==="/$"){if(b===0){s.removeChild(x),an(l);return}b--}else p!=="$"&&p!=="$?"&&p!=="$!"||b++;p=x}while(p);an(l)}function Os(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return s}function Og(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var p=s.data;if(p==="$"||p==="$!"||p==="$?"){if(l===0)return s;l--}else p==="/$"&&l++}s=s.previousSibling}return null}var Cu=Math.random().toString(36).slice(2),ya="__reactFiber$"+Cu,js="__reactProps$"+Cu,Jo="__reactContainer$"+Cu,Xd="__reactEvents$"+Cu,G="__reactListeners$"+Cu,Mu="__reactHandles$"+Cu;function va(s){var l=s[ya];if(l)return l;for(var p=s.parentNode;p;){if(l=p[Jo]||p[ya]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(s=Og(s);s!==null;){if(p=s[ya])return p;s=Og(s)}return l}s=p,p=s.parentNode}return null}function Jr(s){return s=s[ya]||s[Jo],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Jt(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function ef(s){return s[js]||null}var op=[],ku=-1;function Ao(s){return{current:s}}function Hn(s){0>ku||(s.current=op[ku],op[ku]=null,ku--)}function Ln(s,l){ku++,op[ku]=s.current,s.current=l}var Ls={},Kr=Ao(Ls),Fo=Ao(!1),vo=Ls;function Nu(s,l){var p=s.type.contextTypes;if(!p)return Ls;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===l)return b.__reactInternalMemoizedMaskedChildContext;var x={},P;for(P in p)x[P]=l[P];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=l,s.__reactInternalMemoizedMaskedChildContext=x),x}function Po(s){return s=s.childContextTypes,s!=null}function tf(){Hn(Fo),Hn(Kr)}function jg(s,l,p){if(Kr.current!==Ls)throw Error(n(168));Ln(Kr,l),Ln(Fo,p)}function Lg(s,l,p){var b=s.stateNode;if(l=l.childContextTypes,typeof b.getChildContext!="function")return p;b=b.getChildContext();for(var x in b)if(!(x in l))throw Error(n(108,Je(s)||"Unknown",x));return K({},p,b)}function vi(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Ls,vo=Kr.current,Ln(Kr,s),Ln(Fo,Fo.current),!0}function Rg(s,l,p){var b=s.stateNode;if(!b)throw Error(n(169));p?(s=Lg(s,l,vo),b.__reactInternalMemoizedMergedChildContext=s,Hn(Fo),Hn(Kr),Ln(Kr,s)):Hn(Fo),Ln(Fo,p)}var Qa=null,nf=!1,ip=!1;function _g(s){Qa===null?Qa=[s]:Qa.push(s)}function Pl(s){nf=!0,_g(s)}function Rs(){if(!ip&&Qa!==null){ip=!0;var s=0,l=ct;try{var p=Qa;for(ct=1;s<p.length;s++){var b=p[s];do b=b(!0);while(b!==null)}Qa=null,nf=!1}catch(x){throw Qa!==null&&(Qa=Qa.slice(s+1)),Ha(vs,Rs),x}finally{ct=l,ip=!1}}return null}var Au=[],Qr=0,rf=null,of=0,wi=[],bi=0,Ol=null,wa=1,ba="";function jl(s,l){Au[Qr++]=of,Au[Qr++]=rf,rf=s,of=l}function Bg(s,l,p){wi[bi++]=wa,wi[bi++]=ba,wi[bi++]=Ol,Ol=s;var b=wa;s=ba;var x=32-vr(b)-1;b&=~(1<<x),p+=1;var P=32-vr(l)+x;if(30<P){var V=x-x%5;P=(b&(1<<V)-1).toString(32),b>>=V,x-=V,wa=1<<32-vr(l)+x|p<<x|b,ba=P+s}else wa=1<<P|p<<x|b,ba=s}function Lc(s){s.return!==null&&(jl(s,1),Bg(s,1,0))}function Ll(s){for(;s===rf;)rf=Au[--Qr],Au[Qr]=null,of=Au[--Qr],Au[Qr]=null;for(;s===Ol;)Ol=wi[--bi],wi[bi]=null,ba=wi[--bi],wi[bi]=null,wa=wi[--bi],wi[bi]=null}var Xr=null,Ko=null,Yn=!1,Zi=null;function Sa(s,l){var p=ni(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=s,l=s.deletions
Error generating stack: `+P.message+`
`+P.stack}return{value:s,source:l,stack:x,digest:null}}function Hu(s,l,p){return{value:s,source:null,stack:p??null,digest:l??null}}function If(s,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var xf=typeof WeakMap=="function"?WeakMap:Map;function Ef(s,l,p){p=Gi(-1,p),p.tag=3,p.payload={element:null};var b=l.value;return p.callback=function(){Lf||(Lf=!0,Bp=b),If(s,l)},p}function qc(s,l,p){p=Gi(-1,p),p.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var x=l.value;p.payload=function(){return b(x)},p.callback=function(){If(s,l)}}var P=s.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(p.callback=function(){If(s,l),typeof b!="function"&&(Gs===null?Gs=new Set([this]):Gs.add(this));var V=l.stack;this.componentDidCatch(l.value,{componentStack:V!==null?V:""})}),p}function Xg(s,l,p){var b=s.pingCache;if(b===null){b=s.pingCache=new xf;var x=new Set;b.set(l,x)}else x=b.get(l),x===void 0&&(x=new Set,b.set(l,x));x.has(p)||(x.add(p),s=mw.bind(null,s,l,p),l.then(s,s))}function xp(s){do{var l;if((l=s.tag===13)&&(l=s.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return s;s=s.return}while(s!==null);return null}function Gc(s,l,p,b,x){return s.mode&1?(s.flags|=65536,s.lanes=x,s):(s===l?s.flags|=65536:(s.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=Gi(-1,1),l.tag=2,Hs(p,l,1))),p.lanes|=1),s)}var ey=j.ReactCurrentOwner,no=!1;function So(s,l,p,b){l.child=s===null?fp(l,null,p,b):Us(l,s.child,p,b)}function Ep(s,l,p,b,x){p=p.render;var P=l.ref;return _s(l,x),b=gf(s,l,p,b,P,x),p=yf(),s!==null&&!no?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~x,Ea(s,l,x)):(Yn&&p&&Lc(l),l.flags|=1,So(s,l,b,x),l.child)}function Ia(s,l,p,b,x){if(s===null){var P=p.type;return typeof P=="function"&&!$p(P)&&P.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=P,Cp(s,l,P,b,x)):(s=Uf(p.type,null,b,l,l.mode,x),s.ref=l.ref,s.return=l,l.child=s)}if(P=s.child,!(s.lanes&x)){var V=P.memoizedProps;if(p=p.compare,p=p!==null?p:pt,p(V,b)&&s.ref===l.ref)return Ea(s,l,x)}return l.flags|=1,s=Xs(P,b),s.ref=l.ref,s.return=l,l.child=s}function Cp(s,l,p,b,x){if(s!==null){var P=s.memoizedProps;if(pt(P,b)&&s.ref===l.ref)if(no=!1,l.pendingProps=b=P,(s.lanes&x)!==0)s.flags&131072&&(no=!0);else return l.lanes=s.lanes,Ea(s,l,x)}return Cf(s,l,p,b,x)}function Mp(s,l,p){var b=l.pendingProps,x=b.children,P=s!==null?s.memoizedState:null;if(b.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ln(Wu,ti),ti|=p;else{if(!(p&1073741824))return s=P!==null?P.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:s,cachePool:null,transitions:null},l.updateQueue=null,Ln(Wu,ti),ti|=s,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=P!==null?P.baseLanes:p,Ln(Wu,ti),ti|=b}else P!==null?(b=P.baseLanes|p,l.memoizedState=null):b=p,Ln(Wu,ti),ti|=b;return So(s,l,x,p),l.child}function ty(s,l){var p=l.ref;(s===null&&p!==null||s!==null&&s.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Cf(s,l,p,b,x){var P=Po(p)?vo:Kr.current;return P=Nu(l,P),_s(l,x),p=gf(s,l,p,b,P,x),b=yf(),s!==null&&!no?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~x,Ea(s,l,x)):(Yn&&b&&Lc(l),l.flags|=1,So(s,l,p,x),l.child)}function ny(s,l,p,b,x){if(Po(p)){var P=!0;vi(l)}else P=!1;if(_s(l,x),l.stateNode===null)Yu(s,l),cp(l,p,b),dp(l,p,b,x),b=!0;else if(s===null){var V=l.stateNode,ce=l.memoizedProps;V.props=ce;var ye=V.context,Le=p.contextType;typeof Le=="object"&&Le!==null?Le=wo(Le):(Le=Po(p)?vo:Kr.current,Le=Nu(l,Le));var Ge=p.getDerivedStateFromProps,Xe=typeof Ge=="function"||typeof V.getSnapshotBeforeUpdate=="function";Xe||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(ce!==b||ye!==Le)&&Vg(l,V,b,Le),Bs=!1;var qe=l.memoizedState;V.state=qe,cf(l,b,V,x),ye=l.memoizedState,ce!==b||qe!==ye||Fo.current||Bs?(typeof Ge=="function"&&(up(l,p,Ge,b),ye=l.memoizedState),(ce=Bs||ff(l,p,ce,b,qe,ye,Le))?(Xe||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.component
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return e.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error(`Unsupported platform: ${process.platform}`)}}function Jn(e=!1){return new Promise((t,n)=>{n5(i5[process.platform],{},(r,o)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const i=l5(o.toString());return t(e?i:s5(i))})})}const lT={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},u5=e=>{const{dailyNotesState:{app:t,view:n,verifyState:r,settings:o},globalState:{manifest:i,isMobileView:a}}=F.useContext(Ot),u=F.useRef(null),d=F.useRef(null),[f,m]=F.useState((window.app||t).loadLocalStorage("thinoListView")),[g,v]=F.useState(null);F.useEffect(()=>{if(!i||!t)return;const D=t==null?void 0:t.plugins.getPlugin(i.id);v(D),m(D==null?void 0:D.settings.MemoListView),dt.setMemoListView(D==null?void 0:D.settings.MemoListView)},[i,t]),F.useEffect(()=>{if(!t||!n||!g||!g.settings)return;const D=()=>{var I;if(n.leaf.height===0)return;const T=(I=g==null?void 0:g.settings)==null?void 0:I.MemoListView;T==="chat"||T==="moments"||(n.leaf.width>950?(m(T),dt.setMemoListView(T)):n.leaf.width<=950&&(dt.setMemoListView("list"),m("list")))};D(),d.current||(d.current=t.workspace.on("resize",D),n.registerEvent(d.current))},[t,n,g]),F.useEffect(()=>{u&&(C.setIcon(u.current,lT[f||"list"]),dt.setMemoListView(f),C.requireApiVersion("1.4.4")&&C.setTooltip(u.current,E("Switch view")))},[f]);const w=async D=>{var j;const T=!C.Platform.isDesktop&&await((j=window.Capacitor)==null?void 0:j.Plugins.Device.getId()),I=C.Platform.isDesktop?await Jn():T.identifier||T.uuid;if(!r||(r==null?void 0:r.appId)!==I){Fn();return}const k=async B=>{dt.setMemoListView(B),g&&(g.settings.MemoListView=B,await g.saveSettings()),m(B)},A=[{view:"list",title:E("List")},{view:"chat",title:E("Chat")},{view:"moments",title:E("Moments")}];a||A.push({view:"waterfall",title:E("Waterfall")},{view:"calendar",title:E("Calendar")},{view:"table",title:E("Table")});const R=new C.Menu;A.forEach(({view:B,title:L})=>{R.addItem(Z=>{Z.setChecked(f===B).setIcon(lT[B]).setTitle(L).onClick(()=>{f!==B&&k(B)})})}),R.showAtMouseEvent(D.nativeEvent)};return y.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:u,onClick:w})},c5=()=>{const e=F.useRef(null);return F.useEffect(()=>{e&&(C.setIcon(e.current,"calendar-check"),C.setTooltip&&C.setTooltip(e.current,E("Daily Memos")))},[e]),y.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{st.setPathname("/daily")}})},Gw=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),uT={initialValue:"",interval:300};class d5{constructor(t,n=uT){this.listeners=[],this.runUndo=()=>{const r=this.actions[this.currentIndex].selectionStart;this.currentIndex>0&&this.currentIndex--,this.element.value=this.actions[this.currentIndex].value,this.element.setSelectionRange(r,r),this.dispatchChange()},this.runRedo=()=>{this.currentIndex<this.actions.length-1&&this.currentIndex++;const r=this.actions[this.currentIndex].selectionEnd;this.element.value=this.actions[this.currentIndex].value,this.element.setSelectionRange(r,r),this.dispatchChange()},this.getActions=()=>this.actions,this.setState=(r,o)=>{this.actions=[...r],this.currentIndex=o<this.actions.length?o:this.actions.length-1,this.dispatchChange()},this.resetState=()=>{this.actions=[Gw()],this.currentIndex=0,this.dispatchChange()},this.destroy=()=>{this.rmEventListeners()},this.subscribe=r=>{this.listeners.push(r)},this.handleElementKeydown=r=>{const o=r;o.key==="z"&&!o.shiftKey&&(o.metaKey||o.ctrlKey)?(r.preventDefault(),this.runUndo()):(o.key==="z"&&o.shiftKey&&(o.metaKey||o.ctrlKey)||o.key==="y"&&(o.metaKey||o.ctrlKey))&&(r.preventDefault(),this.runRedo())},this.handleElementInput=r=>{const o=r,i=this.actions[this.currentIndex]
8 months ago
7 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},k5=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],Oy=function(t){return I5(t).map(function(n){return k5.includes(n)?"\\".concat(n):n}).join("")},N5=function(e){d0(t,e);function t(){return ug(this,t),c0(this,mh(t).apply(this,arguments))}return u0(t,[{key:"componentDidMount",value:function(){var r=this.props.boundariesElement;if(typeof r=="string"){var o=document.querySelector(r);if(!o)throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");this.containerElem=o}else if(r instanceof HTMLElement)this.containerElem=r;else throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");if(!this.containerElem||!this.containerElem.contains(this.ref))throw new Error("RTA: Invalid prop boundariesElement: it has to be one of the parents of the RTA.")}},{key:"componentDidUpdate",value:function(){var r,o,i=this.props.top||0,a=this.props.left||0,u=[],d=[],f=0,m=0,g=this.containerElem.getBoundingClientRect(),v=this.ref.getBoundingClientRect(),w=this.props.textareaRef.getBoundingClientRect(),D=window.getComputedStyle(this.ref),T=parseInt(D.getPropertyValue("margin-top"),10),I=parseInt(D.getPropertyValue("margin-bottom"),10),k=parseInt(D.getPropertyValue("margin-left"),10),A=parseInt(D.getPropertyValue("margin-right"),10),R=T+I+w.top+i+v.height,j=k+A+w.left+a+v.width;j>g.right&&w.left+a>v.width?(m=a-v.width,u.push(Ku.X.LEFT),d.push(Ku.X.RIGHT)):(m=a,u.push(Ku.X.RIGHT),d.push(Ku.X.LEFT)),R>g.bottom&&w.top+i>v.height?(f=i-v.height,u.push(Ku.Y.TOP),d.push(Ku.Y.BOTTOM)):(f=i,u.push(Ku.Y.BOTTOM),d.push(Ku.Y.TOP)),this.props.renderToBody&&(f+=w.top,m+=w.left),this.ref.style.top="".concat(f,"px"),this.ref.style.left="".concat(m,"px"),(r=this.ref.classList).remove.apply(r,d),(o=this.ref.classList).add.apply(o,u)}},{key:"render",value:function(){var r=this,o=this.props,i=o.style,a=o.className,u=o.innerRef,d=o.children,f=o.renderToBody,m=document.body,g=se.createElement("div",{ref:function(w){r.ref=w,u(w)},className:"rta__autocomplete ".concat(a||""),style:i},d);return f&&m!==null?Z1.createPortal(g,m):g}}]),t}(se.Component),ZE=function(e){d0(t,e);function t(n){var r;ug(this,t),r=c0(this,mh(t).call(this,n)),r.state={top:null,left:null,currentTrigger:null,actualToken:"",data:null,value:"",dataLoading:!1,selectionEnd:0,component:null,textToReplace:null},r.escListenerInit=function(){r.escListener||(r.escListener=yd.add(oa.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(yd.remove(r.escListener),r.escListener=null)},r.getSelectionPosition=function(){return r.textareaRef?{selectionStart:r.textareaRef.selectionStart,selectionEnd:r.textareaRef.selectionEnd}:null},r.getSelectedText=function(){if(!r.textareaRef)return null;var d=r.textareaRef,f=d.selectionStart,m=d.selectionEnd;return f===m?null:r.state.value.substr(f,m-f)},r.setCaretPosition=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;r.textareaRef&&(r.textareaRef.focus(),r.textareaRef.setSelectionRange(d,d))},r.getCaretPosition=function(){if(!r.textareaRef)return 0;var d=r.textareaRef.selectionEnd;return d},r._handleCaretChange=function(d){var f=function(){var v=r.getCaretPosition()-1;r.lastTrigger=r.lastTrigger?v:0};if(d.type==="keydown"){var m=d.keyCode||d.which;switch(m){case oa.UP:case oa.DOWN:r._isAutocompleteOpen()||f();break;case oa.LEFT:case oa.RIGHT:f();break}return}f()},r._onSelect=function(d){var f=r.state,m=f.selectionEnd,g=f.currentTrigger,v=f.value,w=r.props.onItemSelected;if(g){var D=r._getTextToReplace(g);if(!D){r._closeAutocomplete();return}var T=D(d);if(!T){r._closeAutocomplete();return}w&&w({currentTrigger:g,item:d});var I=function($,te,Q){switch($){case"start":return Q;case"next":case"end":return Q+te.length;default:if(!Number.isInteger($))throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');return $}},k=v.slice(0,m),A=Oy(g),R=k.length-k.lastIndexOf(g),j=k.search(new RegExp("(?!".concat(A,")$
Got "`.concat(String(v),'". Check the implementation for trigger "').concat(d,`"
8 months ago
See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.
7 months ago
`));if(v===null)return null;if(typeof v=="string")return{text:v,caretPosition:dT};if(!v.text&&typeof v.text!="string")throw new Error('Output "text" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(d,`"
`));if(!v.caretPosition)throw new Error('Output "caretPosition" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(d,`"
`));return v}if(typeof g!="string")throw new Error(`Output item should be string
7 months ago
`);return{text:"".concat(d).concat(g).concat(d),caretPosition:dT}}},r._getCurrentTriggerSettings=function(){var d=r.state.currentTrigger;return d?r.props.trigger[d]:null},r._getValuesFromProvider=function(){var d=r.state,f=d.currentTrigger,m=d.actualToken,g=r._getCurrentTriggerSettings();if(!(!f||!g)){var v=g.dataProvider,w=g.component;if(typeof v!="function")throw new Error("Trigger provider has to be a function!");r.setState({dataLoading:!0});var D=v(m);D instanceof Promise||(D=Promise.resolve(D)),D.then(function(T){if(!Array.isArray(T))throw new Error("Trigger provider has to provide an array!");if(typeof w!="function")throw new Error("Component should be defined!");if(f===r.state.currentTrigger){if(!T.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:T,component:w})}}).catch(function(T){return fT(T.message)})}},r._getSuggestions=function(){var d=r.state,f=d.currentTrigger,m=d.data;return!f||!m||m&&!m.length?null:m},r._createRegExp=function(){var d=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(d).sort(function(f,m){return f<m?1:f>m?-1:0}).map(function(f){return Oy(f)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(d).sort(function(f,m){return f<m?1:f>m?-1:0}).map(function(f){return Oy(f)}).join("|"),")$"))},r._closeAutocomplete=function(){var d=r.state.currentTrigger;r.escListenerDestroy(),r.setState({data:null,dataLoading:!1,currentTrigger:null},function(){d&&r._onItemHighlightedHandler(null)})},r._cleanUpProps=function(){var d=w5({},r.props),f=["loadingComponent","boundariesElement","containerStyle","minChar","scrollToItem","ref","innerRef","onChange","onCaretPositionChange","className","value","trigger","listStyle","itemStyle","containerStyle","loaderStyle","className","containerClassName","listClassName","itemClassName","loaderClassName","dropdownStyle","dropdownClassName","movePopupAsYouType","textAreaComponent","renderToBody","onItemSelected","onItemHighlighted"];for(var m in d)f.includes(m)&&delete d[m];return d},r._changeHandler=function(d){var f=r.props,m=f.trigger,g=f.onChange,v=f.minChar,w=f.onCaretPositionChange,D=f.movePopupAsYouType,T=r.state,I=T.top,k=T.left,A=d;A||(A=new y5("change",{bubbles:!0}),r.textareaRef.dispatchEvent(A));var R=A.target||r.textareaRef,j=R.selectionEnd,B=R.value;if(r.lastValueBubbledEvent=B,g&&A&&(A.persist&&A.persist(),g(new Proxy(A,{get:function(K,re,pe){return re==="target"?R:Reflect.get(K,re,pe)}}))),w){var L=r.getCaretPosition();w(L)}r.setState({value:B});var Z=function(){var K=p5(R,j),re=K.top,pe=K.left;r.setState({top:re-r.textareaRef.scrollTop||0,left:pe})},U=function(K){r.lastTrigger=j-K,r._closeAutocomplete(),Z()};if(j<=r.lastTrigger){var z=B.slice(0,j),$=r.tokenRegExp.exec(z);U($?$[0].length:0)}var te=B.slice(r.lastTrigger,j),Q=r.tokenRegExp.exec(te),ue=Q&&Q[0],ee=Q&&Q[1]||null,le=ee?ee.length-1:0,W=r.tokenRegExpEnding.exec(te);if(W?U(W[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!ue||ue.length<=v+le)&&(r.state.currentTrigger&&!m[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(ee&&m[ee].afterWhitespace&&!/\s/.test(B[j-ue.length-1])&&B[j-ue.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&m[r.state.currentTrigger].allowWhitespace){if(Q=new RegExp("".concat(Oy(r.state.currentTrigger),".*$")).exec(B.slice(0,j)),ue=Q&&Q[0],!ue){r._closeAutocomplete();return}ee=Object.keys(m).find(function(he){return he.slice(0,le+1)===ue.slice(0,le+1)})||null}var de=ue.slice(1);if(ee){(D||I===null&&k===null||r.state.currentTrigger!==ee)&&Z(),r.escListenerInit();var oe=r._getTextToReplace(ee);r.setState({selectionEnd:j,currentTrigger:ee,textToReplace:oe,actualToken:de},function(){try{r._getValuesFromProvider()}catch(he){fT(he.message)}})}},r._selectHandler=function(d){var f=r.props,m=f.onCaretPositionChange,g=f.onSelect;if(m){var v=r.getCaretPosition();m(v)}g&&(d.persist(),g(d))},r._shouldStayOpen=function(d){var f=d.relatedTarget;return f===null&&(f=document.activeElement),!!(r.dropdownRef&&f instanceof Node&&r.dr
`,tt.id);else{const Et=Re.toPNG(),Tt=new Blob([Et],{type:"image/png"}),qt=new File([Tt],"image.png",{type:"image/png",lastModified:Date.now()});if(!qt)return;const zt=await he(qt);zt&&((gt=T.current)==null||gt.insertText(zt+`
`,tt.id))}})))},[T,u,i]),F.useEffect(()=>{a&&m(a.DefaultPrefix==="List")},[a==null?void 0:a.DefaultPrefix]),F.useEffect(()=>{if(a){if(a.EnabledLocationList.length===1){Q(a.EnabledLocationList[0].value);return}Q(a.MemoSaveLocation||"DAILY")}},[a==null?void 0:a.MemoSaveLocation,a==null?void 0:a.EnabledLocationList]),F.useEffect(()=>{var at;if(!a||!$.current)return;const Re=(at=km.find(gt=>gt.title===te))==null?void 0:at.icon;C.setIcon($.current,Re),C.requireApiVersion("1.4.4")&&C.setTooltip($.current,E("Thino Save To: ")+te),ue.current=te;const tt=o.manifest;if(tt){const gt=i==null?void 0:i.plugins.getPlugin(tt.id);if(gt){if(gt.settings.MemoSaveLocation===te)return;gt.settings.MemoSaveLocation=te,gt.saveSettings()}}},[te,v]),F.useEffect(()=>{T.current&&a.MemoSaveLocation&&Q(a.MemoSaveLocation)},[$,a]),F.useEffect(()=>{if(!T.current||!a||C.Platform.isDesktop||o.globalEditorShown)return;const Re=a.UseButtonToShowEditor&&a.DefaultEditorLocation==="Bottom";if(C.Platform.isDesktop){w(!0);return}if(t&&t==="inline"){w(!0);return}if(w(C.Platform.isMobile&&!Re),!Re||o.memoListView==="chat")return;const tt=document.body.find(".memolist-wrapper");tt&&(tt.onscroll=()=>{if(o.globalEditorShown)return;if(!o.memoListView&&dt.getState().memoListView==="chat"){tt.onscroll=null;return}const at=T.current.getContent();C.Platform.isMobile&&Re&&!at&&w(!1)})},[o.globalEditorShown,t,T]);const ee=()=>{j(!1)};F.useEffect(()=>{var Re,tt,at,gt,Et,Tt,qt,zt,$t;if(i&&(o.markMemoId||(Re=o.editMemoId)!=null&&Re.trim()&&o.editMemoId!==I.current.editMemoId)){const Gt=i.workspace.getLeavesOfType("thino_view");Gt.length>0&&i.workspace.revealLeaf(Gt[0])}if(o.markMemoId){const Gt=`${E("MARK")}: [@THINO](${o.markMemoId})`;(tt=T.current)==null||tt.insertText(Gt),(at=T.current)==null||at.focus(),dt.setMarkMemoId("");return}if((gt=o.editMemoId)!=null&&gt.trim()&&o.editMemoId!==I.current.editMemoId){const Gt=je.getMemoById(o.editMemoId);if(Gt)switch(m(Gt.thinoType==="JOURNAL"),a.EditorType){case"memos":(Et=T.current)==null||Et.setContent(Gt.content.replace(/ \^\S{6}$/,"")||""),(Tt=T.current)==null||Tt.focus();break;case"obsidian":(qt=T.current)==null||qt.clear(),(zt=T.current)==null||zt.setContent(Gt.content.replace(/ \^\S{6}$/,"")||""),($t=T.current)==null||$t.focus();break}}I.current=o},[o.markMemoId,o.editMemoId]),F.useEffect(()=>{var Re,tt,at;!T.current||k||a.EditorType==="memos"&&((Re=T.current)==null||Re.element.addEventListener("paste",le),(tt=T.current)==null||tt.element.addEventListener("drop",W),(at=T.current)==null||at.element.addEventListener("click",de),A(!0))},[T.current]);const le=async Re=>{var tt;if(Re.clipboardData&&Re.clipboardData.files.length>0){Re.preventDefault();const at=Re.clipboardData.files;for(const gt of at){const Et=await he(gt);Et&&((tt=T.current)==null||tt.insertText(Et))}}},W=async Re=>{var tt;if(Re.dataTransfer&&Re.dataTransfer.files.length>0){Re.preventDefault();const at=Re.dataTransfer.files;for(const gt of at){const Et=await he(gt);Et&&((tt=T.current)==null||tt.insertText(Et))}}},de=()=>{var Re;pe(((Re=T.current)==null?void 0:Re.element.value)||"")},oe=async(Re,tt)=>{var Et,Tt,qt;const at=Re.ctrlKey||Re.metaKey,gt=Re.altKey;if(Re.key==="Escape"&&o.globalEditorShown&&(dt.setGlobalEditorShown(!1),Re.preventDefault()),at&&Re.key==="Enter"){Re.preventDefault(),Re.stopPropagation(),tt?(await K((Tt=T.current)==null?void 0:Tt.getContent()),(qt=T.current)==null||qt.clear()):await K((Et=T.current)==null?void 0:Et.element.value);return}if(gt)for(let zt=0;zt<a.EnabledLocationList.length;zt++)Re.key===(zt+1).toString()&&Q(a.EnabledLocationList[zt].value);setTimeout(()=>{var zt;tt||pe(((zt=T.current)==null?void 0:zt.element.value)||"")})},he=F.useCallback(async Re=>{const{type:tt}=Re;if(tt.startsWith("image"))try{return`${await W1.upload(Re)}`}catch(at){new C.Notice(at)}},[]),K=async Re=>{if(!Re||Re.trim()===""){new C.Notice(E("Content cannot be empty"));return}const tt=yt.getState().settings,at=tt==null?void 0:tt.addTagAutomatically,gt=tt==null?void 0:tt.addTagWithNewline,Et=tt==null?void 0:tt.addTagPosition,qt=(nO()||[]).filter(cn=>!Re.incl
`:""}${Re}`:`${Re} ${gt?`
`:""}${qt.map(cn=>`#${cn}`).join(" ")}`:Re;await zt($t,Gt),n&&n(),Ly("")},re=F.useCallback(()=>{var Re;dt.setEditMemoId(""),(Re=T.current)==null||Re.setContent(""),Ly("")},[]),pe=F.useCallback(Re=>{if(Ly(Re??""),!T.current)return;const tt=T.current.getContent(),at=T.current.element.selectionStart,gt=tt.slice(0,at),Et=tt.slice(at);(gt.endsWith("@")||gt.endsWith("📆"))&&Et.startsWith(" ")||(gt.endsWith("@")||gt.endsWith("📆"))&&Et===""?(ze(),j(!0)):j(!1),setTimeout(()=>{var Tt;(Tt=T.current)==null||Tt.focus()})},[a.EditorType]),Ie=Re=>{if(!T.current||!a)return;Re&&(ee(),m(!1));const tt=T.current.getContent(),at=T.current.element.selectionStart,gt=tt.slice(0,at),Et=tt.slice(at),Tt=C.moment(Re);if(gt.endsWith("@"))switch(a.InsertDateFormat){case"Dataview":T.current.element.value=tt.slice(0,T.current.element.selectionStart-1)+"[due::"+Tt.format("YYYY-MM-DD")+"]"+Et,T.current.element.setSelectionRange(at+17,at+17),T.current.focus(),pe(T.current.element.value);break;case"Tasks":T.current.element.value=tt.slice(0,T.current.element.selectionStart-1)+"📆"+Tt.format("YYYY-MM-DD")+Et,T.current.element.setSelectionRange(at+11,at+11),T.current.focus(),pe(T.current.element.value)}else{T.current.element.value=gt+Tt.format("YYYY-MM-DD")+Et,T.current.element.setSelectionRange(at+10,at+10),T.current.focus(),pe(T.current.element.value);return}},Oe=()=>{T.current&&m()},Ne=async()=>{var at;const Re=!C.Platform.isDesktop&&await((at=window.Capacitor)==null?void 0:at.Plugins.Device.getId()),tt=C.Platform.isDesktop?await Jn():Re.identifier||Re.uuid;return!d||(d==null?void 0:d.appId)!==tt?(Fn(),!1):!0},Be=async Re=>{if(!await Ne())return;const tt=new C.Menu;a.EnabledLocationList.forEach(Tt=>{tt.addItem(qt=>{var zt;qt.setTitle(E(Tt.value)).setIcon(((zt=km.find($t=>$t.title===Tt.value))==null?void 0:zt.icon)??"file").setChecked(te===Tt.value).onClick(()=>{Q(Tt.value)})})});let at=Re.target,gt=null;for(;!at.hasClass("location-wrapper")&&(gt=at.parentElement,gt);)at=gt;const Et=at.getBoundingClientRect();setTimeout(()=>{tt.showAtPosition({x:Et.x,y:Et.bottom,width:Et.width,left:!1,overlap:!0})},200)},Je=F.useCallback(()=>{var Re,tt;if(!(!T.current&&a.EditorType==="memos"))switch(a.EditorType){case"obsidian":(Re=T.current)==null||Re.focus(),(tt=T.current)==null||tt.insertTag();break;case"memos":{const at=T.current.getContent(),gt=T.current.element.selectionStart,Et=at.slice(0,gt),Tt=at.slice(gt);let qt=Et+"# "+Tt,zt=Et.length+1;Et.endsWith("#")&&Tt.startsWith(" ")&&(qt=Et.slice(0,Et.length-1)+Tt.slice(1),zt=Et.length-1),T.current.element.value=qt,T.current.element.setSelectionRange(zt,zt),T.current.focus();const $t=new Event("input",{bubbles:!0,cancelable:!0});T.current.element.dispatchEvent($t),pe(T.current.element.value)}}},[i]),ze=F.useCallback(()=>{if(!T.current||!L.current||!a||!i)return;const at=i.workspace.getLeavesOfType(Bo)[0].view.containerEl,gt=280,Et=at.clientWidth,{x:Tt,y:qt}=rO(T.current.element);let zt,$t;C.Platform.isMobile?(window.innerWidth-Tt>gt?zt=(Tt+gt+16>Et,Tt+18):window.innerWidth-Tt<gt?zt=(Tt+gt+16>Et,Tt+34):zt=T.current.element.clientWidth/2,a.DefaultEditorLocation==="Bottom"&&window.innerWidth>875?$t=qt+4:a.DefaultEditorLocation==="Bottom"&&window.innerWidth<=875?$t=qt+19:a.DefaultEditorLocation==="Top"&&window.innerWidth<=875&&($t=qt+36)):(zt=(Tt+gt+16>Et,Tt+18),$t=qt+34),B(Tt),L.current.style.left=`${zt}px`,L.current.style.top=`${$t}px`},[a,i]),Qe=F.useCallback(()=>{const Re=document.createElement("input");document.body.appendChild(Re),Re.type="file",Re.multiple=!1,Re.accept="image/png, image/gif, image/jpeg",Re.onchange=async()=>{var gt;if(!Re.files||Re.files.length===0)return;const tt=Re.files[0],at=await he(tt);at&&((gt=T.current)==null||gt.insertText(at)),document.body.removeChild(Re)},Re.click()},[]),It=!!o.editMemoId,Zt=F.useMemo(()=>({className:"memo-editor",inputerType:a.EditorType||"obsidian",modal:r,initialContent:oO(),placeholder:E("What do you think now..."),showConfirmBtn:!0,showCancelBtn:It,showTools:!0,onConfirmBtnClick:K,onCancelBtnClick:re,onContentChange:pe}),[It,a.EditorType]);return y.jsxs(y.Fragme
`},"")),v+r+I.replace(/ \^\S{6}/g,"")+`
`+k},"");return e.reduce((g,v)=>{const w=t!=null&&t.ShowDate?`- [[${C.moment(v.date,"YYYY-MM-DD").format(n)}]]
`:"",D=m(v.have),T=t!=null&&t.ShowDate&&(t!=null&&t.AddBlankLineWhenDate)&&!(t!=null&&t.CommentOnMemos)?`
`:"";return g+w+D+T},"").replace(/<br>/g,`
`)},lO=[{label:E("Today"),value:C.moment().format("YYYY-MM-DD")},{label:E("Yesterday"),value:C.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:E("Last 7 days"),value:C.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:E("Last 30 days"),value:C.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:E("Last 90 days"),value:C.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:E("Last 180 days"),value:C.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:E("Last 365 days"),value:C.moment().subtract(365,"days").format("YYYY-MM-DD")}],pC=e=>{const{handleValueChange:t,setShownStatus:n}=e;return y.jsxs(y.Fragment,{children:[e.type==="icon"&&y.jsx("div",{className:"quick-date-btn-group",children:lO.map((r,o)=>y.jsx("div",{className:"btn action-btn quick-date-btn",onClick:()=>{t(r.value),n&&n(!1)},children:r.label},o))}),y.jsx(f0,{className:"calendar-date-picker",datestamp:(e==null?void 0:e.defaultValue)||C.moment().startOf("day").valueOf(),handleDateStampChange:(r,o)=>{t(e.type==="icon"?C.moment(r).format("YYYY-MM-DD"):r.toString()),n&&n(!1)}})]})},Cv=e=>{const{handleValueChange:t}=e,[n,r]=se.useState(!1),o=se.useRef(null),i=se.useRef(null),a=p0(i.current,o.current,{placement:"bottom-start"});return cg(o,()=>{r(!1)}),y.jsxs(y.Fragment,{children:[y.jsx("span",{ref:d=>{i.current=d,d&&e.type==="icon"&&C.setIcon(d,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!C.Platform.isMobile&&r(!n),!C.Platform.isMobile&&(a!=null&&a.update)&&(a==null||a.update()),C.Platform.isMobile&&new mC(yt.getState().app,e.type,t).open()},children:e.type==="text"&&e.defaultValue?e.defaultText?e.defaultText:C.moment(e.defaultValue,"x").subtract(e.startOrEnd==="end"?1:0,"days").format("YYYY/MM/DD"):""}),y.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:o,style:a.styles.popper,children:y.jsx(pC,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class mC extends C.Modal{constructor(n,r,o){super(n);De(this,"root");De(this,"type");De(this,"handleValueChange");this.type=r,this.handleValueChange=o}onOpen(){const{contentEl:n}=this;this.root=sg(n),this.root.render(y.jsx(pC,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const uO=(e,t)=>(e%t+t)%t;class cO{constructor(t,n,r){De(this,"owner");De(this,"values");De(this,"suggestions");De(this,"selectedItem");De(this,"containerEl");this.owner=t,this.containerEl=n,n.on("click",".suggestion-item",this.onSuggestionClick.bind(this)),n.on("mousemove",".suggestion-item",this.onSuggestionMouseover.bind(this)),r.register([],"ArrowUp",o=>{if(!o.isComposing)return this.setSelectedItem(this.selectedItem-1,!0),!1}),r.register([],"ArrowDown",o=>{if(!o.isComposing)return this.setSelectedItem(this.selectedItem+1,!0),!1}),r.register([],"Enter",o=>{if(!o.isComposing)return this.useSelectedItem(o),!1})}onSuggestionClick(t,n){t.preventDefault();const r=this.suggestions.indexOf(n);this.setSelectedItem(r,!1),this.useSelectedItem(t)}onSuggestionMouseover(t,n){const r=this.suggestions.indexOf(n);this.setSelectedItem(r,!1)}setSuggestions(t){this.containerEl.empty();const n=[];t.forEach(r=>{const o=this.containerEl.createDiv("suggestion-item");this.owner.renderSuggestion(r,o),n.push(o)}),this.values=t,this.suggestions=n,this.setSelectedItem(0,!1)}useSelectedItem(t){const n=this.values[this.selectedItem];n&&this.owner.selectSuggestion(n,t)}setSelectedItem(t,n){const r=uO(t,this.suggestions.length),o=this.suggestions[this.selectedItem],i=this.suggestions[r];o==null||o.removeClass("is-selected"),i==null||i.addClass("is-selected"),this.selectedItem=r,n&&i.scrollIntoView(!1)}}class gC{constructor(t,n){De(this,"inputEl");De(this,"popper");De(this,"scope");De(this,"suggestEl");De(this,"suggest");De(this,"cb");this.inputEl=t,this.scope=new C.Scope,this.cb=n,this.suggestEl=createDiv("suggestion-container");const r=this.suggestEl.createDiv("suggestion");this.suggest=new cO(this,r,this.scope),this.scope.register([],"Escape",th
`:""}${U}`:`${U} ${B?`
`:""}${R.map(z=>`#${z}`).join(" ")}`),Z&&Z.content!==U){const z=await je.updateMemo(Z.id,U==null?void 0:U.trim());L.push(z)}}L.length>0&&je.editMemoBulk(L),L.length>0&&st.clearQuery()};return y.jsxs("div",{className:"thino-tag-operation",children:[y.jsx("div",{className:"tag-operation-title",children:E("Tag Bulk Edit")}),y.jsxs("div",{className:"tag-operation-content",children:[r.length>0&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"tag-operation-content-title exist-tags",children:[y.jsx("div",{className:"name",children:E("Exist Tags")}),y.jsx("div",{className:"desc",children:E("Click to remove exist tag")})]}),y.jsx("div",{className:"tag-operation-content-tags exist-tags",children:r.map(A=>y.jsx("div",{className:Kn("tag-operation-content-tag",u.includes(A)&&"tag-operation-content-tag-removed"),onClick:()=>{u.includes(A)||d([...u,A]),u.includes(A)&&d(u.filter(R=>R!==A)),i.includes(A)&&a(i.filter(R=>R!==A))},children:A},A))})]}),y.jsxs("div",{className:"tag-operation-content-title selected-tags",children:[y.jsx("div",{className:"name",children:E("Selected Tags")}),y.jsx("div",{className:"desc",children:E("Click to remove selected tag")})]}),y.jsx("div",{className:"tag-operation-content-tags selected-tags",children:i.map(A=>y.jsx("div",{className:"tag-operation-content-tag",onClick:()=>{a(i.filter(R=>R!==A))},children:A},A))}),y.jsx("div",{className:"tag-operation-content-inputer",children:y.jsx("input",{placeholder:E("Input to select exist tag"),ref:D,onKeyDown:A=>{A.key==="Enter"&&T(D.current.value)}})}),y.jsxs("div",{className:"tag-operation-settings",children:[y.jsx("div",{ref:m}),y.jsx("div",{ref:g})]}),y.jsxs("div",{className:"tag-operation-content-btn-group",children:[y.jsx("button",{className:"cancel-btn",onClick:n,children:E("Cancel")}),y.jsx("button",{className:"save-btn",onClick:I,children:E("Save")})]})]})]})},qb=new Map,Id=async(e,t=!0)=>{const{vault:n,metadataCache:r}=yt.getState().app;if(t&&qb.has(e))return Promise.resolve(qb.get(e));if(e.contains("data:image"))return e;let o;const i=await n.adapter.exists(C.normalizePath(e));let a="";try{if(!i&&!/(http|https)/g.test(e)&&!e.includes("data:image")){let u;if(e.startsWith("app://")){const d=C.normalizePath(decodeURIComponent(e).replace(C.Platform.resourcePathPrefix,"").replace(/\?(.*)$/,"").replace(C.normalizePath(app==null?void 0:app.vault.adapter.basePath),""));a=C.normalizePath(decodeURIComponent(d))}else{if(u=r.getFirstLinkpathDest(e,""),!u){new C.Notice(E("File not exist"));return}a=u.path}}else a=e}catch(u){console.error(u)}if(a){if(/(http|https)/g.test(a))if(a.startsWith("http://localhost")){let u=a;u=u.replace("http://localhost/_capacitor_file_",""),u=decodeURIComponent(u).replace(/\?(.*)$/,"").replace(app==null?void 0:app.vault.adapter.basePath,""),u=C.normalizePath(decodeURIComponent(u));const d=await n.adapter.readBinary(u),f=new Uint8Array(d);o=new Blob([f],{type:"image/png"})}else try{const u=await C.requestUrl(e),d=new Uint8Array(u.arrayBuffer);o=new Blob([d],{type:"image/png"})}catch{}else if(a){const u=await n.adapter.readBinary(a),d=new Uint8Array(u);o=new Blob([d],{type:"image/png"})}return o?await gO(o,e):""}},gO=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const o=r.result;qb.set(t,o),n(o)},r.readAsDataURL(e)}),gm=async e=>{if(!e.style.backgroundImage.includes("url(")&&!e.style.backgroundImage.includes("http"))return;let t=e.style.backgroundImage.includes("url(")?e.style.backgroundImage.slice(5,-2):e.style.backgroundImage;return t?(t.startsWith("http://localhost")&&(t=t.replace("http://localhost/_capacitor_file_",""),t=decodeURIComponent(t).replace(/\?(.*)$/,"").replace(app==null?void 0:app.vault.adapter.basePath,""),t=C.normalizePath(decodeURIComponent(t))),await Id(t)):void 0},yO=async e=>{var n;return e.getAttribute("src")?(n=e==null?void 0:e.src)!=null&&n.startsWith("http://localhost")?await Id(e.getAttribute("path")||C.normalizePath(e==null?void 0:e.parentElement.getAttribute("src"))):await Id(e.getAttribute("src")):void 0},Ut=CO(),Mv=MO(),yC=kO(),vC=NO(),ld={copyDefaultStyles:!0,imagePlaceholder:void 0,cach
`)})}function t(){return Promise.resolve(Ut.asArray(document.styleSheets)).then(r).then(n).then(function(i){return i.map(o)});function n(i){return i.filter(function(a){return a.type===CSSRule.FONT_FACE_RULE}).filter(function(a){return Mv.shouldProcess(a.style.getPropertyValue("src"))})}function r(i){const a=[];return i.forEach(function(u){if(Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(u),"cssRules"))try{Ut.asArray(u.cssRules||[]).forEach(a.push.bind(a))}catch(d){console.error(`domtoimage: Error while reading CSS rules from ${u.href}`,d.toString())}}),a}function o(i){return{resolve:function(){const u=(i.parentStyleSheet||{}).href;return Mv.inlineAll(i.cssText,u)},src:function(){return i.style.getPropertyValue("src")}}}}}function NO(){return{inlineAll:t,impl:{newImage:e}};function e(n){return{inline:r};function r(o){return Ut.isDataUrl(n.src)?Promise.resolve():Promise.resolve(n.src).then(o||Ut.getAndEncode).then(function(i){return new Promise(function(a){n.onload=a,n.onerror=a,n.src=i})})}}function t(n){if(!Ut.isElement(n))return Promise.resolve(n);return r(n).then(function(){return Ut.isHTMLImageElement(n)?e(n).inline():Promise.all(Ut.asArray(n.childNodes).map(function(o){return t(o)}))});function r(o){const a=["background","background-image"].map(function(u){const d=o.style.getPropertyValue(u),f=o.style.getPropertyPriority(u);return d?Mv.inlineAll(d).then(function(m){o.style.setProperty(u,m,f)}):Promise.resolve()});return Promise.all(a).then(function(){return o})}}}function AO(e,t,n,r){const o=["background-clip"].indexOf(t)>=0;r?(e.setProperty(t,n,r),o&&e.setProperty(`-webkit-${t}`,n,r)):(e.setProperty(t,n),o&&e.setProperty(`-webkit-${t}`,n))}function FO(e,t,n,r,o){const i=dn.impl.options.copyDefaultStyles?OO(e,t):{},a=o.style;Ut.asArray(n).forEach(function(u){const d=n.getPropertyValue(u),f=i[u],m=r?r.getPropertyValue(u):void 0;if(d!==f||r&&d!==m){const g=n.getPropertyPriority(u);AO(a,u,d,g)}})}let Ry=null,uv={};const PO=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"];function OO(e,t){const n=u(t),r=d(n);if(uv[r])return uv[r];const o=jO(),i=f(o.document,n),a=m(o,i);return g(i),uv[r]=a,a;function u(v){const w=[];do{if(v.nodeType===nS){const D=v.tagName;if(w.push(D),PO.includes(D))break}v=v.parentNode}while(v);return w}function d(v){return e.styleCaching==="relaxed"?v.filter((w,D,T)=>D===0||D===T.length-1).join(">"):v.join(">")}function f(v,w){let D=v.body;do{const T=w.pop(),I=v.createElement(T);D.appendChild(I),D=I}while(w.length>0);return D.textContent="",D}function m(v,w){const D={},T=v.getComputedStyle(w);return Ut.asArray(T).forEach(function(I){D[I]=I==="width"||I==="height"?"auto":T.getPropertyValue(I)}),D}function g(v){do{const w=v.parentElement;w!==null&&w.removeChild(v),v=w}while(v&&v.tagName!=="BODY")}}function jO(){if(ra)return ra.contentWindow;const e=document.characterSet||"UTF-8",t=document.doctype,n=t?`<!DOCTYPE ${r(t.name)} ${r(t.publicId)} ${r(t.systemId)}`.trim()+">":"";return ra=document.createElement("iframe"),ra.id="domtoimage-sandbox-"+Ut.uid(),ra.className="domtoimage-thino",ra.style.visibility="hidden",ra.style.position="fixed",document.body.appendChild(ra),o(ra,n,e,"domtoimage-sandbox");function r(i){if(i){const a=document.createElement("div");return a.innerText=i,a.innerHTML}else return""}function o(i,a,u,d){try{return i.contentWindow.document.write(`${a}<html><head><meta charset='${u}'><title>${d}</title></head><body></body></html>`),i.contentWindow}catch{}const f=document.createElement("meta");f.setAttribute("charset",u);try{const m=document.implementation.createHTMLDocument(d);m.head.appendChild(f);const g=a+m.documentElement.outerHTML;return i.setAttribute("srcdoc",g),i.contentWindow}catch{}return i.contentDocument.head.appendChild(f),i.contentDocument.title=d,i.contentWindow}}function LO(){ra&&(document.body.removeChild(ra),ra=null),Ry&&clearTi
`,a.current,r.path,n),(g=a.current)==null||g.toggleClass(["markdown-rendered"],!0);const m=(v=a.current)==null?void 0:v.querySelectorAll(".internal-link");m==null||m.forEach(w=>{const D=w,T=D.getAttribute("data-href");if(!T)return;t.metadataCache.getFirstLinkpathDest(T,r.path)||w.classList.add("is-unresolved"),D.addEventListener("mouseover",k=>{k.stopPropagation(),t.workspace.trigger("hover-link",{event:k,source:"thino",hoverParent:n.containerEl,targetEl:D,linktext:T,sourcePath:D.href})})})})()},[r.content,n,t]),y.jsx("div",{ref:a,className:"memo-content-text",onClick:f=>o(f,r),onDoubleClick:i,onContextMenu:f=>{f.preventDefault()}})},DC=F.memo(HO),YO=e=>{const[t,n]=F.useState({...e.memo,createdAtStr:ut.getDateTimeString(e.memo.createdAt)}),[r,o]=F.useState([]),[i,a]=F.useState([]);F.useEffect(()=>{(async()=>{try{const g=[],v=[...t.content.matchAll(hc)];for(const D of v)if(D&&D.length===3){const T=D[2],I=je.getMemoById(T);I&&g.push({...I,createdAtStr:ut.getDateTimeString(I.createdAt),dateStr:ut.getDateString(I.createdAt)})}o([...g]);const w=await je.getLinkedMemos(t.id);a(w.sort((D,T)=>ut.getTimeStampByDate(T.createdAt)-ut.getTimeStampByDate(D.createdAt)).map(D=>({...D,createdAtStr:ut.getDateTimeString(D.createdAt),dateStr:ut.getDateString(D.createdAt)})))}catch(g){console.error(g)}})()},[t.id]);const u=F.useCallback(async m=>{var v;const g=m.target;if(g.className==="memo-link-text"){const w=(v=g.dataset)==null?void 0:v.value,D=je.getMemoById(w??"");if(D){const T={...D,createdAtStr:ut.getDateTimeString(D.createdAt)};o([]),a([]),n(T)}else new C.Notice(E("Thino not found")),g.classList.remove("memo-link-text")}},[]),d=F.useCallback(m=>{o([]),a([]),n({...m,createdAtStr:ut.getDateTimeString(m.createdAt)})},[t.id]),f=F.useCallback(()=>{e.destroy(),dt.setEditMemoId(t.id)},[t.id]);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"memo-card-container",children:[y.jsxs("div",{className:"header-container",children:[y.jsx("span",{className:"time-text",children:t.createdAtStr}),y.jsxs("div",{className:"btns-container",children:[y.jsx("button",{ref:m=>{m&&C.setIcon(m,"edit")},className:"btn edit-btn",onClick:f}),y.jsx("button",{ref:m=>{m&&C.setIcon(m,"x")},className:"btn close-btn",onClick:e.destroy})]})]}),y.jsx("div",{className:"memo-container",children:y.jsx("div",{className:"memo-content-text",children:y.jsx(DC,{memo:t,handleMemoContentClick:u,handleMemoDoubleClick:()=>{}})})}),y.jsx("div",{className:"layer-container"})]}),r.length>0?y.jsxs("div",{className:"linked-memos-wrapper",children:[y.jsxs("span",{className:"normal-text",children:[E("LINKED")," ",r.length," THINO"," "]}),r.map(m=>{const g=SD(Fb(m.content)).replaceAll(`
`," ");return y.jsxs("div",{className:"linked-memo-container",onClick:()=>d(m),children:[y.jsxs("span",{className:"time-text",children:[m.dateStr," "]}),g]},m.id)})]}):null,i.length>0?y.jsxs("div",{className:"linked-memos-wrapper",children:[y.jsxs("span",{className:"normal-text",children:[i.length," THINO ",E("LINK TO THE")," THINO"]}),i.map(m=>{const g=SD(Fb(m.content)).replaceAll(`
`," ");return y.jsxs("div",{className:"linked-memo-container",onClick:()=>d(m),children:[y.jsxs("span",{className:"time-text",children:[m.dateStr," "]}),g]},m.id)})]}):null]})};function Lh(e){l0({className:"memo-card-dialog"},YO,{memo:e})}function sc(e){return TC(e)?(e.nodeName||"").toLowerCase():"#document"}function aa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mc(e){var t;return(t=(TC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function TC(e){return e instanceof Node||e instanceof aa(e).Node}function Yo(e){return e instanceof Element||e instanceof aa(e).Element}function yl(e){return e instanceof HTMLElement||e instanceof aa(e).HTMLElement}function Gb(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof aa(e).ShadowRoot}function pg(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=La(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function UO(e){return["table","td","th"].includes(sc(e))}function rS(e){const t=oS(),n=La(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function zO(e){let t=bh(e);for(;yl(t)&&!y0(t);){if(rS(t))return t;t=bh(t)}return null}function oS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function y0(e){return["html","body","#document"].includes(sc(e))}function La(e){return aa(e).getComputedStyle(e)}function v0(e){return Yo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function bh(e){if(sc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Gb(e)&&e.host||mc(e);return Gb(t)?t.host:t}function IC(e){const t=bh(e);return y0(t)?e.ownerDocument?e.ownerDocument.body:e.body:yl(t)&&pg(t)?t:IC(t)}function Jb(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=IC(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=aa(o);return i?t.concat(a,a.visualViewport||[],pg(o)?o:[],a.frameElement&&n?Jb(a.frameElement):[]):t.concat(o,Jb(o,[],n))}function cv(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Gb(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Kb(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function _y(e){return(e==null?void 0:e.ownerDocument)||document}function VO(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Qb=Math.min,fh=Math.max,kv=Math.round,lc=e=>({x:e,y:e}),WO={left:"right",right:"left",bottom:"top",top:"bottom"},ZO={start:"end",end:"start"};function kT(e,t,n){return fh(e,Qb(t,n))}function w0(e,t){return typeof e=="function"?e(t):e}function xd(e){return e.split("-")[0]}function b0(e){return e.split("-")[1]}function xC(e){return e==="x"?"y":"x"}function EC(e){return e==="y"?"height":"width"}function S0(e){return["top","bottom"].includes(xd(e))?"y":"x"}function CC(e){return xC(S0(e))}function $O(e,t,n){n===void 0&&(n=!1);const r=b0(e),o=CC(e),i=EC(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Nv(a)),[a,Nv(a)]}function qO(e){const t=Nv(e);return[Xb(e),t,Xb(t)]}function Xb(e){return e.replace(/start|end/g,t=>ZO[t])}function GO(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}function JO(e,t,n,r){const o=b0(e);let i=GO(xd(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Xb)))),i}function Nv(e){return e.replace(/left|right|bottom|top/g,t=>WO[t])}function KO(e){return{top:0,right:0,bottom:0,left:0,...e}}function QO(e){return typeof e!="number"?KO(e):{top:e,right:e,bottom:e,left:e}}fun
`),o=new Array(n).join("#")+" ",i=new Array(n+1).join("#")+" ",a=[];let u=[];return r.forEach((d,f)=>{d.startsWith(i)?(u.length>0&&(a.push(u),u=[]),u.push(d)):u.length>0&&!d.startsWith(o)?u.push(d):u.length>0&&(a.push(u),u=[]),f===r.length-1&&u.length>0&&a.push(u)}),a}onChooseSuggestion(t,n){this.selectSuggestion(t,n)}renderSuggestion(t,n){n.setText(t.title)}getSuggestions(){return[{id:"splitByHeading1",title:E("Split by Heading 1")},{id:"splitByHeading2",title:E("Split by Heading 2")},{id:"splitByHeading3",title:E("Split by Heading 3")}]}async selectSuggestion(t,n){let r=[];if(t.id==="splitByHeading1"?r=this.contentSplitByHeading(this.thino.content,1):t.id==="splitByHeading2"?r=this.contentSplitByHeading(this.thino.content,2):t.id==="splitByHeading3"&&(r=this.contentSplitByHeading(this.thino.content,3)),r.length===0){new C.Notice("No headings found"),this.close();return}const o=this.ensureUniqueFileNames(r);for(const u of r){const d=r.indexOf(u),f=await je.createThino({content:u.join(`
`),name:o[d],type:"MULTI",isList:!0});je.pushMemo(f)}let i=this.thino.content;r.forEach((u,d)=>{i=i.replace(u.join(`
`),`[[${o[d]}]]`)});const a=await je.updateMemo(this.thino.id,i);a&&je.editMemo(a),this.close()}}const Uj=async(e,t,n)=>{const r=n.getAttribute("href"),o=n.className;if(o.contains("tag"))zj(n.innerText.slice(1));else if(o.contains("internal-link")){const i=n.getAttribute("data-href"),a=je.getMemoById(i??"");a?Lh(a):await e.workspace.openLinkText(i,i,!C.Platform.isMobile&&t.navigation!==!0)}else r&&window.open(r,"_blank")},zj=e=>{const t=st.getState().query.tag;st.setTagQuery(t.contains(",")?t.split(",").includes(e)?t.split(",").filter(n=>n!==e).join(","):t+","+e:t===e?"":e)},Vj=(e,t)=>{const n=t==null?void 0:t.getAttribute("src"),r=t==null?void 0:t.parentElement.getAttribute("src"),o=[...(e==null?void 0:e.querySelectorAll("img"))||[]],i=o.indexOf(t);g0({imgUrl:n,filepath:n.startsWith("app")?r:void 0,otherIMGEls:o,currentIndex:i})},Wj=e=>{var r;const t=(r=e.dataset)==null?void 0:r.value,n=je.getMemoById(t??"");n?Lh(n):(new C.Notice("Thino Not Found"),e.classList.remove("memo-link-text"))},Zj=async(e,t,n,r)=>{var u;const o=e!=null&&e.AppendDateWhenTaskDone?" ✅ "+C.moment().format("YYYY-MM-DD"):"",i=((u=r.parentElement.dataset)==null?void 0:u.task)==="x"?"DONE":"TODO",a=[...(n==null?void 0:n.querySelectorAll("li.task-list-item"))||[]];for(const d of a)if(d===r||d===r.closest("li.task-list-item")){const f=a.indexOf(d),m=t.content.split(/\n/),g=[];for(let I=0;I<m.length;I++)(m[I].trim().startsWith("- [ ]")||m[I].trim().startsWith("- [x]"))&&g.push(I);const v=g[f];let D=m[v].replace(/- \[ \] |- \[x\] /g,i==="TODO"?"- [x] ":"- [ ] ")+(i==="TODO"?o:"");e.AppendDateWhenTaskDone&&i!=="TODO"&&(D=D.replace(/ ✅ \d{4}-\d{2}-\d{2}/g,"")),m[v]=D;const T=m.join(`
`).trim();if(t&&t.content!==T){const I=await je.updateMemo(t.id,T);je.editMemo(I)}}},$j=e=>{const{globalState:{editMemoId:t},dailyNotesState:{app:n,view:r,settings:o,verifyState:i},locationState:{pathname:a}}=F.useContext(Ot),{memo:u,type:d="inline"}=e,f=F.useRef(null),m=F.useRef(null),[g,v]=F.useState(!1);F.useEffect(()=>{g&&setTimeout(()=>{dt.setEditMemoId(u.id)},100)},[g]),F.useEffect(()=>{(a==="/review"||a==="/daily")&&t!==u.id&&g&&v(!1)},[t]);const w=()=>{Lh(u)},D=()=>{if(o!=null&&o.UseButtonToShowEditor&&(o==null?void 0:o.DefaultEditorLocation)==="Bottom"){const W=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");W&&W.trigger("click")}dt.setMarkMemoId(u.id)},T=async()=>{var oe;const W=!C.Platform.isDesktop&&await((oe=window.Capacitor)==null?void 0:oe.Plugins.Device.getId()),de=C.Platform.isDesktop?await Jn():W.identifier||W.uuid;if(!i||(i==null?void 0:i.appId)!==de){Fn();return}u.pinned?await je.unpinMemoById(u.id):await je.pinMemoById(u.id)},I=()=>{if(o!=null&&o.UseButtonToShowEditor&&(o==null?void 0:o.DefaultEditorLocation)==="Bottom"&&C.Platform.isMobile){const W=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");W&&W.trigger("click")}(a==="/review"||a==="/daily")&&v(!0),a!=="/review"&&a!=="/daily"&&dt.setEditMemoId(u.id)},k=async W=>{W.sourceType==="MULTI"&&W.id.trim()===""&&await je.updateMemoProperty(W)},A=async W=>{await je.openThinoByID(W.id)},R=async W=>{try{const de=await je.archiveMemo(W);de&&je.editMemo(de)}catch(de){console.error(de),new C.Notice(de.message)}},j=async(W,de)=>{if(!de&&m.current&&!m.current.confirmStatus){m.current&&m.current.toggleConfirm();return}try{if(o.DeleteThinoDirectly)await je.deleteMemoById(u.id);else{const oe=await je.hideMemoById(u.id);oe&&je.editMemo(oe)}}catch(oe){new C.Notice(oe.message)}dt.getState().editMemoId===u.id&&dt.setEditMemoId("")},B=()=>{if(m.current&&!m.current.confirmStatus){m.current&&m.current.toggleConfirm(!1);return}},L=()=>{md(u)},Z=async()=>{const W=await je.updateMemo(u.id,u.content,u.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");W&&je.editMemo(W)},U=async W=>{W.stopPropagation(),navigator.clipboard.writeText(u.content).then(()=>{new C.Notice(E("COPY SUCCEED"))}).catch(()=>{new C.Notice(E("COPY FAILED"))})},z=async()=>{new Yj(n,u).open()},$=W=>{W&&W.target.tagName!=="INPUT"&&I()},te=async(W,de)=>{W.preventDefault(),W.stopPropagation();const oe=W.target;if(W.ctrlKey||W.metaKey){await A(de);return}if(oe.tagName==="A"){await Uj(n,r,oe);return}if(oe.tagName==="IMG"){Vj(f.current,oe);return}if(oe.tagName==="A"&&oe.getAttribute("href")){const he=oe.getAttribute("href");window.open(he,"_blank");return}if(oe.className==="memo-link-text"){Wj(oe);return}if(oe.tagName==="INPUT"&&oe.hasClass("task-list-item-checkbox")){await Zj(o,de,f.current,oe);return}},Q=W=>{const de=new C.Menu;de.dom.toggleClass("memo-context-menu",!0);const oe=window.getSelection();(oe==null?void 0:oe.toString().length)>0&&de.addItem(he=>{he.setIcon("copy").setTitle(E("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(oe.toString()).then(()=>{new C.Notice(E("COPY SUCCEED"))}).catch(()=>{new C.Notice(E("COPY FAILED"))})})}).addSeparator(),de.addItem(he=>{he.setIcon("copy").setTitle(E("Copy thino").toLocaleUpperCase()).onClick(async K=>{await U(K),de.close()})}).addItem(he=>{he.setIcon("book-open").setTitle(E("READ")).onClick(w)}).addItem(he=>{he.setIcon(u.pinned?"pin-off":"pin").setTitle(u.pinned?E("UNPIN"):E("PIN")).onClick(T)}).addItem(he=>{he.setIcon("bookmark").setTitle(E("MARK")).onClick(D)}).addItem(he=>{he.setIcon("share-2").setTitle(E("SHARE")).onClick(L)}).addItem(he=>{he.setIcon("pencil").setTitle(E("EDIT")).onClick(I)}).addItem(he=>{he.setIcon("home").setTitle(E("SOURCE")).onClick(()=>A(u))}).addSeparator().addItem(he=>{he.setIcon("archive").setTitle(E("ARCHIVE").toLocaleUpperCase()).onClick(()=>R(u))}).addItem(he=>{he.setIcon("trash").setTitle(E("DELETE")).onClick(async K=>{await j(K,!0)})}),de.showAtMouseEvent(W.nativeEvent)},ue=F.useMemo(()=>({memo:u,ha
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ql(e,t){return ZC(e)||g7(e,t)||iS(e,t)||$C()}function mr(){return mr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mr.apply(this,arguments)}var y7=function(e,t,n,r,o,i,a,u){if(!e){var d;if(t===void 0)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,o,i,a,u],m=0;d=new Error(t.replace(/%s/g,function(){return f[m++]})),d.name="Invariant Violation"}throw d.framesToPop=1,d}},v7=y7;const Lm=$r(v7);var w7=function(){};function b7(e,t){var n={};return Object.keys(e).forEach(function(r){n[fv(r)]=w7}),n}function $T(e,t){return e[t]!==void 0}function fv(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function S7(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function D7(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Lv(e,t)}function qC(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function GC(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function JC(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}qC.__suppressDeprecationWarning=!0;GC.__suppressDeprecationWarning=!0;JC.__suppressDeprecationWarning=!0;function T7(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if(typeof e.getDerivedStateFromProps!="function"&&typeof t.getSnapshotBeforeUpdate!="function")return e;var n=null,r=null,o=null;if(typeof t.componentWillMount=="function"?n="componentWillMount":typeof t.UNSAFE_componentWillMount=="function"&&(n="UNSAFE_componentWillMount"),typeof t.componentWillReceiveProps=="function"?r="componentWillReceiveProps":typeof t.UNSAFE_componentWillReceiveProps=="function"&&(r="UNSAFE_componentWillReceiveProps"),typeof t.componentWillUpdate=="function"?o="componentWillUpdate":typeof t.UNSAFE_componentWillUpdate=="function"&&(o="UNSAFE_componentWillUpdate"),n!==null||r!==null||o!==null){var i=e.displayName||e.name,a=typeof e.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.
8 months ago
7 months ago
`+i+" uses "+a+" but also contains the following legacy lifecycles:"+(n!==null?`
8 months ago
`+n:"")+(r!==null?`
7 months ago
`+r:"")+(o!==null?`
`+o:"")+`
8 months ago
The above lifecycles should be removed. Learn more about this warning here:
7 months ago
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=qC,t.componentWillReceiveProps=GC),typeof t.getSnapshotBeforeUpdate=="function"){if(typeof t.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=JC;var u=t.componentDidUpdate;t.componentDidUpdate=function(f,m,g){var v=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:g;u.call(this,f,m,v)}}return e}var I7="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function KC(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",o=S7(e),i=Object.keys(t),a=i.map(fv);o||!n.length||Lm(!1);var u=function(f){D7(m,f);function m(){for(var v,w=arguments.length,D=new Array(w),T=0;T<w;T++)D[T]=arguments[T];v=f.call.apply(f,[this].concat(D))||this,v.handlers=Object.create(null),i.forEach(function(k){var A=t[k],R=function(B){if(v.props[A]){var L;v._notifying=!0;for(var Z=arguments.length,U=new Array(Z>1?Z-1:0),z=1;z<Z;z++)U[z-1]=arguments[z];(L=v.props)[A].apply(L,[B].concat(U)),v._notifying=!1}v.unmounted||v.setState(function($){var te,Q=$.values;return{values:mr(Object.create(null),Q,(te={},te[k]=B,te))}})};v.handlers[A]=R}),n.length&&(v.attachRef=function(k){v.inner=k});var I=Object.create(null);return i.forEach(function(k){I[k]=v.props[fv(k)]}),v.state={values:I,prevProps:{}},v}var g=m.prototype;return g.shouldComponentUpdate=function(){return!this._notifying},m.getDerivedStateFromProps=function(w,D){var T=D.values,I=D.prevProps,k={values:mr(Object.create(null),T),prevProps:{}};return i.forEach(function(A){k.prevProps[A]=w[A],!$T(w,A)&&$T(I,A)&&(k.values[A]=w[fv(A)])}),k},g.componentWillUnmount=function(){this.unmounted=!0},g.render=function(){var w=this,D=this.props,T=D.innerRef,I=D0(D,["innerRef"]);a.forEach(function(A){delete I[A]});var k={};return i.forEach(function(A){var R=w.props[A];k[A]=R!==void 0?R:w.state.values[A]}),se.createElement(e,mr({},I,k,this.handlers,{ref:T||this.attachRef}))},m}(se.Component);T7(u),u.displayName="Uncontrolled("+r+")",u.propTypes=mr({innerRef:function(){}},b7(t)),n.forEach(function(f){u.prototype[f]=function(){var g;return(g=this.inner)[f].apply(g,arguments)}});var d=u;return se.forwardRef&&(d=se.forwardRef(function(f,m){return se.createElement(u,mr({},f,{innerRef:m,__source:{fileName:I7,lineNumber:128},__self:this}))}),d.propTypes=u.propTypes),d.ControlledComponent=e,d.deferControlTo=function(f,m,g){return m===void 0&&(m={}),KC(f,mr({},t,m),g)},d}function QC(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=QC(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Zr(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=QC(e))&&(r&&(r+=" "),r+=t);return r}var XC={exports:{}},tb,qT;function x7(){if(qT)return tb;qT=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return tb=e,tb}var nb,GT;function E7(){if(GT)return nb;GT=1;var e=x7();function t(){}function n(){}return n.resetWarningCache=t,nb=function(){function r(a,u,d,f,m,g){if(g!==e){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},nb}XC.exports=E7()();var C7=XC.exports;const Me=$r(C7);var Rv="milliseconds",Rm="seconds",_m="minutes",Bm="hours",Ed="day",Dh="week",Hm="month",Cd="year",Md="decade",kd="century",eM={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},M7={month:1,year:12,decade:10*12,century:100*12};function k7(e){ret
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hv(e){return R7(e)||sM(e)||iS(e)||_7()}function B7(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}var lM=B7;function H7(e,t){return e===t||e!==e&&t!==t}var yg=H7,Y7=typeof Vr=="object"&&Vr&&Vr.Object===Object&&Vr,uM=Y7,U7=uM,z7=typeof self=="object"&&self&&self.Object===Object&&self,V7=U7||z7||Function("return this")(),wl=V7,W7=wl,Z7=W7.Symbol,Bh=Z7,KT=Bh,cM=Object.prototype,$7=cM.hasOwnProperty,q7=cM.toString,cm=KT?KT.toStringTag:void 0;function G7(e){var t=$7.call(e,cm),n=e[cm];try{e[cm]=void 0;var r=!0}catch{}var o=q7.call(e);return r&&(t?e[cm]=n:delete e[cm]),o}var J7=G7,K7=Object.prototype,Q7=K7.toString;function X7(e){return Q7.call(e)}var eL=X7,QT=Bh,tL=J7,nL=eL,rL="[object Null]",oL="[object Undefined]",XT=QT?QT.toStringTag:void 0;function iL(e){return e==null?e===void 0?oL:rL:XT&&XT in Object(e)?tL(e):nL(e)}var Hh=iL;function aL(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var uu=aL,sL=Hh,lL=uu,uL="[object AsyncFunction]",cL="[object Function]",dL="[object GeneratorFunction]",fL="[object Proxy]";function hL(e){if(!lL(e))return!1;var t=sL(e);return t==cL||t==dL||t==uL||t==fL}var lS=hL,pL=9007199254740991;function mL(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=pL}var uS=mL,gL=lS,yL=uS;function vL(e){return e!=null&&yL(e.length)&&!gL(e)}var vg=vL,wL=9007199254740991,bL=/^(?:0|[1-9]\d*)$/;function SL(e,t){var n=typeof e;return t=t??wL,!!t&&(n=="number"||n!="symbol"&&bL.test(e))&&e>-1&&e%1==0&&e<t}var cS=SL,DL=yg,TL=vg,IL=cS,xL=uu;function EL(e,t,n){if(!xL(n))return!1;var r=typeof t;return(r=="number"?TL(n)&&IL(t,n.length):r=="string"&&t in n)?DL(n[t],e):!1}var I0=EL,CL=/\s/;function ML(e){for(var t=e.length;t--&&CL.test(e.charAt(t)););return t}var kL=ML,NL=kL,AL=/^\s+/;function FL(e){return e&&e.slice(0,NL(e)+1).replace(AL,"")}var PL=FL;function OL(e){return e!=null&&typeof e=="object"}var yc=OL,jL=Hh,LL=yc,RL="[object Symbol]";function _L(e){return typeof e=="symbol"||LL(e)&&jL(e)==RL}var wg=_L,BL=PL,e2=uu,HL=wg,t2=NaN,YL=/^[-+]0x[0-9a-f]+$/i,UL=/^0b[01]+$/i,zL=/^0o[0-7]+$/i,VL=parseInt;function WL(e){if(typeof e=="number")return e;if(HL(e))return t2;if(e2(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=e2(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=BL(e);var n=UL.test(e);return n||zL.test(e)?VL(e.slice(2),n?2:8):YL.test(e)?t2:+e}var ZL=WL,$L=ZL,n2=1/0,qL=17976931348623157e292;function GL(e){if(!e)return e===0?e:0;if(e=$L(e),e===n2||e===-n2){var t=e<0?-1:1;return t*qL}return e===e?e:0}var dM=GL,JL=dM;function KL(e){var t=JL(e),n=t%1;return t===t?n?t-n:t:0}var fM=KL,QL=lM,XL=I0,eR=fM,tR=Math.ceil,nR=Math.max;function rR(e,t,n){(n?XL(e,t,n):t===void 0)?t=1:t=nR(eR(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var o=0,i=0,a=Array(tR(r/t));o<r;)a[i++]=QL(e,o,o+=t);return a}var oR=rR;const iR=$r(oR);function bg(e){return e&&e.ownerDocument||document}function aR(e){var t=bg(e);return t&&t.defaultView||window}function sR(e,t){return aR(e).getComputedStyle(e,t)}var lR=/([A-Z])/g;function uR(e){return e.replace(lR,"-$1").toLowerCase()}var cR=/^ms-/;function By(e){return uR(e).replace(cR,"-ms-")}var dR=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function fR(e){return!!(e&&dR.test(e))}function ah(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(By(t))||sR(e).getPropertyValue(By(t));Object.keys(t).forEach(function(o){var i=t[o];!i&&i!==0?e.style.removeProperty(By(o)):fR(o)?r+=o+"("+i+") ":n+=By(o)+": "+i+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}function Wm(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}function hR(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function dS(e){return"window"in e&&e.window===e?e:hR(e)&&e.defaultView||!1}function hM(e){var t=e==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,o){var i=dS(r);if(o===void 0)retu
`)[0].slice(0,20),r=se.useRef(null),o=se.useRef(null),i=se.useRef(null);F.useEffect(()=>{if(o.current)return C.setIcon(o.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const a=F.useCallback(d=>{i.current&&(i.current.unmount(),i.current=null),i.current=d},[]),u=F.useCallback(d=>{if(!r.current||!C.Keymap.isModifier(d.nativeEvent,"Mod"))return;const f=new C.HoverPopover(yt.getState().view,r.current,100),m=oX(f,t);a(m)},[r.current]);return y.jsxs("span",{className:"rbc-event-renderer","data-source-type":t.sourceType,"data-thino-type":t.thinoType,"data-thino-id":t.id,ref:r,"aria-label":t.path,onMouseOver:u,children:[y.jsx(aX,{event:e}),y.jsx("strong",{children:n})]})}const aX=({event:e})=>{const t=se.useRef(null),n=e.resource;F.useEffect(()=>{t.current&&C.setIcon(t.current,n.thinoType==="JOURNAL"?"calendar":n.thinoType==="TASK-TODO"?"square":"check-square")},[n==null?void 0:n.thinoType,t]);const r=F.useCallback(async o=>{o.stopPropagation(),o.preventDefault(),await(async()=>{const a=await je.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");a&&je.editMemo(a)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return y.jsx(y.Fragment,{children:y.jsxs("span",{className:"rbc-event-icon-group",children:[y.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),y.jsx("span",{className:Kn("rbc-event-time","hidden"),children:y.jsx("span",{className:"rbc-event-time-text",children:C.moment(e.start).format("HH:mm")})})]})})};function w3({views:e,view:t,messages:n,onView:r}){return e.map(o=>y.jsx("button",{type:"button",className:Kn({"rbc-active":t===o}),onClick:()=>r(o),children:n[o]},o))}w3.propTypes={messages:Me.object,onView:Me.func,view:Me.string,views:Me.array};function b3({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:o,view:i,views:a}){const u={previous:F.useRef(null),today:F.useRef(null),next:F.useRef(null)};F.useEffect(()=>{u&&(C.setIcon(u.previous.current,"chevron-left"),C.setIcon(u.today.current,"dot"),C.setIcon(u.next.current,"chevron-right"))},[u]);const d=F.useMemo(()=>y.jsxs(y.Fragment,{children:[y.jsx("button",{ref:u.previous,type:"button",onClick:()=>r(uh.PREVIOUS),"aria-label":n.previous,children:"<"}),y.jsx("button",{ref:u.today,type:"button",onClick:()=>r(uh.TODAY),"aria-label":n.today,children:"•"}),y.jsx("button",{ref:u.next,type:"button",onClick:()=>r(uh.NEXT),"aria-label":n.next,children:">"})]}),[n]);return y.jsxs("div",{className:"rbc-toolbar",children:[y.jsx("span",{className:Kn("rbc-btn-group","thino-view-custom-toolbar"),children:d}),y.jsx("span",{className:"rbc-toolbar-label",children:y.jsx(Cv,{type:"text",handleValueChange:f=>{r(uh.DATE,C.moment(f,"YYYY-MM-DD").format("YYYY-MM-DDTHH:mm:ssZ"))},defaultText:t+(i==="week"?C.moment(e.valueOf(),"x").format(" [W]WW"):""),defaultValue:C.moment(e.valueOf(),"x").valueOf()})}),y.jsx("span",{className:"rbc-btn-group",children:y.jsx(w3,{view:i,views:a,messages:n,onView:o})})]})}b3.propTypes={date:Me.instanceOf(Date),label:Me.string,localizer:Me.object,messages:Me.object,onNavigate:Me.func,onView:Me.func,view:Me.string,views:Me.array};function sX({event:e,children:t,showPopup:n,callRender:r,...o}){const i=F.useRef(null),a=F.useRef(null),u=F.useCallback(d=>{if(!d.isTrusted){r();return}a.current=d.nativeEvent.target,a.current&&(a.current.hasClass("rbc-event")||(a.current=a.current.closest(".rbc-event")),i.current!==null?(window.clearTimeout(i.current),i.current=null):i.current=window.setTimeout(()=>{n(e,a.current),i.current=null},250))},[e,n]);return y.jsx(y.Fragment,{children:y.jsx("div",{className:"rbc-event-wrapper","aria-describedby":"thino",onClick:u,children:t})})}const lX=nX(C.moment),uX=({event:e})=>{const t=e.resource;return y.jsx(y.Fragment,{children:y.jsx(Oi,{memo:t})})},cX=e=>{var Q;const{thinos:t}=e,[n,r]=se.useState([]),[o,i]=se.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[a,u]=se.useState(null),d=se.useRef(null),f=se.useRef(null),[m,g]=se.useState(!1),v=F.useRef(null),[w,D]=F.useState(new Date);F.useEffect(()=>()=>{d.current&&(d.curren
`,L.current,t.path,o||e.view)}de(),setTimeout(async()=>{await Q()},Ex)},[B,L,u,k]);const Q=async()=>{B.current&&(await Lee(B.current),await BS(B.current),Ree(k).then(de=>{de&&setTimeout(()=>{m0(B.current).then(oe=>{j(oe),f(!0)}).catch(()=>{})},600)}))},ue=()=>{n()},ee=F.useCallback(de=>{w(de)},[v]),le=async()=>{const{vault:de}=_e.getState().dailyNotesState.app,oe=B.current.querySelector(".memo-shortcut-img");if(!oe)return;const he=oe==null?void 0:oe.getAttribute("src").split("base64,")[1],K=TI(he,"image/png");let re;K.arrayBuffer().then(async pe=>{const Ie="png",Oe=su();for(const Ne in Oe)if(Oe[Ne]instanceof C.TFile){re=Oe[Ne];break}if(re!==void 0){const Ne=await de.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,Ie,re);await de.createBinary(Ne,pe),new C.Notice(E("Save image successfully"))}})},W=async()=>{ee(!0);const de=B.current.querySelector(".memo-shortcut-img");if(!de)return;const oe=de==null?void 0:de.getAttribute("src").split("base64,")[1],he=TI(oe,"image/png");if(!he){new C.Notice(E("Copy to clipboard failed"));return}const K=new ClipboardItem({"image/png":he});window.navigator.clipboard.write([K]).then(()=>{setTimeout(()=>{ee(!1)},500)}),new C.Notice(E("Copy to clipboard successfully"))};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:Kn("dialog-header-container"),children:[y.jsxs("p",{className:"title-text",children:[y.jsx("span",{className:"icon-text",children:"🥰"}),E("Share Memo Image")]}),y.jsxs("div",{className:"btn-group",children:[C.Platform.isMobile&&y.jsx("button",{ref:I,className:"btn download-btn",onClick:le}),y.jsx("button",{ref:D,className:"btn copy-btn",onClick:W}),y.jsx("button",{ref:T,className:"btn close-btn",onClick:ue})]})]}),y.jsxs("div",{className:Kn("dialog-content-container",k),children:[y.jsx("div",{className:`tip-words-container ${R?"finish":"loading"}`,children:y.jsx("p",{className:"tip-text",children:E(R?"↗Click the button to save":"Image is generating...")})}),y.jsxs("div",{className:"setting-item",children:[y.jsxs("div",{className:"setting-item-info",children:[y.jsx("div",{className:"setting-item-name",children:E("Default sharing style")}),y.jsx("div",{className:"setting-item-description",children:E("Set the default style for sharing thino, 'Modern' by default.")})]}),y.jsx("div",{className:"setting-item-control",children:y.jsxs("select",{className:"dropdown",defaultValue:k,onChange:async de=>{de.currentTarget.value!==k&&(f(!1),j(""),A(de.currentTarget.value),await Q())},children:[y.jsx("option",{value:"modern",children:E("Modern")}),y.jsx("option",{value:"clean",children:E("Clean")}),y.jsx("option",{value:"minimal",children:E("Minimal")}),y.jsx("option",{value:"gradient",children:E("Gradient")})]})})]}),y.jsxs("div",{className:Kn("memo-container",k),ref:B,children:[y.jsx(Aa,{when:R!=="",children:y.jsx("img",{className:"memo-shortcut-img",onClick:W,src:R})}),y.jsxs("div",{className:"memo-background",children:[y.jsx("div",{className:"property-image",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}}),y.jsx("span",{className:"background-container"}),y.jsxs("div",{className:"thino-user-header",children:[y.jsx("div",{className:"thino-user-icon",ref:de=>{if(a!=null&&a.MomentsIcon){de==null||de.empty();return}a!=null&&a.MomentsIcon||de&&C.setIcon(de,"Memos")},style:{backgroundImage:`url("${Z}")`}}),y.jsxs("div",{className:"thino-user-info",children:[y.jsx("div",{className:"thino-user-name",children:a==null?void 0:a.UserName}),(a==null?void 0:a.MomentsQuote)&&y.jsx("div",{className:"thino-user-quote",children:a==null?void 0:a.MomentsQuote})]})]}),y.jsx("div",{ref:L,className:"memo-content-text",style:{minHeight:a.MinHeightForShare||"200px"}}),y.jsx("div",{className:"thino-time-footer",children:u.createdAt}),y.jsxs("div",{className:"watermark-container",children:[y.jsxs("span",{className:"normal-text footer-start",children:[y.jsx("div",{className:"property-social-icons"}),y.jsx("span",{className:"name-text",children:te})]}),y.jsx("span",{className:"normal-text footer-end",children:y.jsx("span",{clas
${ue.content.split(`
`).map(le=>le.trim()?`> ${le}
`:`>
`)}
7 months ago
`+(ee===t.length-1?`
7 months ago
`:`
7 months ago
------
7 months ago
`)});const Q={createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),content:te.replace(/(^|\n),>/g,`
>`),id:"temp-"+Math.random().toString(36).substr(2,9),thinoType:"JOURNAL",sourceType:"DAILY",rowStatus:"NORMAL",visibility:"PRIVATE",pinned:!1,creatorName:"thino",deletedAt:"",path:"",resourceList:[]};md(Q,"clean")})}),z.addSeparator(),o){case"/":z.addItem($=>{$.setTitle(E("Bulk tag operation")).setIcon("hash").onClick(async()=>{await B()})}).addItem($=>{$.setTitle(E("Bulk archive")).setIcon("archive").onClick(async()=>{new fd(a,E("ARCHIVE"),async te=>{te==="confirm"&&await j()}).open()})}).addItem($=>{$.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new fd(a,E("DELETE"),async te=>{te==="confirm"&&await I()}).open()})});break;case"/archive":z.addItem($=>{$.setTitle(E("Bulk restore")).setIcon("archive").onClick(async()=>{new fd(a,E("RESTORE"),async te=>{te==="confirm"&&await A()}).open()})}).addItem($=>{$.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new fd(a,E("DELETE"),async te=>{te==="confirm"&&await I()}).open()})});break;case"/recycle":z.addItem($=>{$.setTitle(E("Bulk restore")).setIcon("archive-restore").onClick(async()=>{new fd(a,E("RESTORE"),async te=>{te==="confirm"&&await R()}).open()})}).addItem($=>{$.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new fd(a,E("DELETE"),async te=>{te==="confirm"&&await k()}).open()})});break}z.showAtMouseEvent(U.nativeEvent)};return y.jsxs("div",{className:`filter-query-container ${w?"":"hidden"}`,children:[y.jsxs("div",{className:"filter-query",children:[y.jsx("span",{className:"tip-text",children:E("FILTER")}),y.jsxs("div",{"data-filter-type":"query",className:"filter-item-container "+(v?"":"hidden"),onClick:()=>{st.setMemoFilter("")},children:[y.jsx("span",{className:"icon-text",children:"🔖"})," ",v==null?void 0:v.title]}),y.jsxs("div",{"data-filter-type":"tag",className:"filter-item-container "+(u?"":"hidden"),onClick:()=>{st.setTagQuery("")},children:[y.jsx("span",{className:"icon-text",children:"🏷️"})," ",u]}),y.jsxs("div",{"data-filter-type":"type",className:"filter-item-container "+(f?"":"hidden"),onClick:()=>{st.setMemoTypeQuery("")},children:[y.jsx("span",{className:"icon-text",children:"📦"})," ",XF(f)]}),d&&d.from<d.to&&y.jsxs("div",{"data-filter-type":"date",className:"filter-item-container",children:[y.jsxs("div",{className:"day-picker-component-group",children:[y.jsx("span",{className:"icon-text",children:"🗓️"})," ",y.jsx(Cv,{type:"text",startOrEnd:"start",defaultValue:C.moment(d.from,"x").valueOf(),handleValueChange:U=>{const z=C.moment(d.to,"x"),$=C.moment(U,"x"),te=$.isAfter(z)||$.isSame(z);st.setFromAndToQuery(te?z.startOf("day").valueOf():C.moment(U,"x").startOf("day").valueOf(),d.to)}}),y.jsx("span",{children:E("to")}),y.jsx(Cv,{type:"text",startOrEnd:"end",defaultValue:C.moment(d.to,"x").add(1,"days").valueOf(),handleValueChange:U=>{const z=C.moment(d.from,"x"),$=C.moment(U,"x"),te=$.isBefore(z)||$.isSame(z),Q=C.moment(U,"x").endOf("day").valueOf();st.setFromAndToQuery(d.from,te?z.endOf("day").valueOf():Q)}})]}),y.jsx("div",{ref:U=>U&&C.setIcon(U,"x"),className:"btn close-btn",onClick:()=>{st.setFromAndToQuery(0,0)}})]}),y.jsxs("div",{className:"filter-item-container "+(m?"":"hidden"),onClick:()=>{st.setTextQuery("")},children:[y.jsx("span",{className:"icon-text",children:"🔍"})," ",m]})]}),y.jsxs("div",{className:"thino-filter-items",children:[e&&y.jsx("div",{className:"thinos-count",children:`${e?`${e} Thinos `:""}`}),y.jsx("div",{ref:D,className:"btn memo-action-menu",onClick:Z})]})]})},gd=async e=>{const{app:t,settings:n}=yt.getState();if(!n.startSync||!(t!=null&&t.loadLocalStorage("tokenForSync")))return;const r=await G6(e);if(!r||r.length===0)return;r.sort((a,u)=>C.moment(a.createdAt,"YYYY/MM/DD HH:mm:ss").isAfter(C.moment(u.createdAt,"YYYY/MM/DD HH:mm:ss"))?1:-1);const o=r.filter(a=>!a.deleted),i=r.filter(a=>a.deleted);for(let a=0;a<o.length;a++){const u=o[a],d=await je.createOrPatchThinoFromWeb(u);d&&je.pushMemo(d)}for(let a=0;a<i.length;a++){const u=i[a],d=je.getMemoByWebId(u.id);d&&await je.deleteMemoById(d.id,"local")}je.updateTagsState(),zee(t)};function Yee(){const{settings:e,app:t,
`&&M.push(`
`),Te!==null&&M.push(D(""+Te)),null;case"input":M.push(Q("input")),ct=Yt=ot=Te=null;for(Ue in J)if(n.call(J,Ue)&&(Nt=J[Ue],Nt!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":ct=Nt;break;case"defaultValue":ot=Nt;break;case"checked":Yt=Nt;break;case"value":Te=Nt;break;default:L(M,ae,Ue,Nt)}return Yt!==null?L(M,ae,"checked",Yt):ct!==null&&L(M,ae,"checked",ct),Te!==null?L(M,ae,"value",Te):ot!==null&&L(M,ae,"value",ot),M.push("/>"),null;case"menuitem":M.push(Q("menuitem"));for(var Co in J)if(n.call(J,Co)&&(Te=J[Co],Te!=null))switch(Co){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:L(M,ae,Co,Te)}return M.push(">"),null;case"title":M.push(Q("title")),Te=null;for(Tn in J)if(n.call(J,Tn)&&(Ue=J[Tn],Ue!=null))switch(Tn){case"children":Te=Ue;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:L(M,ae,Tn,Ue)}return M.push(">"),Te;case"listing":case"pre":M.push(Q(H)),Ue=Te=null;for(ct in J)if(n.call(J,ct)&&(ot=J[ct],ot!=null))switch(ct){case"children":Te=ot;break;case"dangerouslySetInnerHTML":Ue=ot;break;default:L(M,ae,ct,ot)}if(M.push(">"),Ue!=null){if(Te!=null)throw Error(t(60));if(typeof Ue!="object"||!("__html"in Ue))throw Error(t(61));J=Ue.__html,J!=null&&(typeof J=="string"&&0<J.length&&J[0]===`
`?M.push(`
`,J):M.push(""+J))}return typeof Te=="string"&&Te[0]===`
`&&M.push(`
`),Te;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":M.push(Q(H));for(var mo in J)if(n.call(J,mo)&&(Te=J[mo],Te!=null))switch(mo){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,H));default:L(M,ae,mo,Te)}return M.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return z(M,J,H,ae);case"html":return ke.insertionMode===0&&M.push("<!DOCTYPE html>"),z(M,J,H,ae);default:if(H.indexOf("-")===-1&&typeof J.is!="string")return z(M,J,H,ae);M.push(Q(H)),Ue=Te=null;for(Nt in J)if(n.call(J,Nt)&&(ot=J[Nt],ot!=null))switch(Nt){case"children":Te=ot;break;case"dangerouslySetInnerHTML":Ue=ot;break;case"style":B(M,ae,ot);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:a(Nt)&&typeof ot!="function"&&typeof ot!="symbol"&&M.push(" ",Nt,'="',D(ot),'"')}return M.push(">"),Z(M,Ue,Te),Te}}function ee(M,H,J){if(M.push('<!--$?--><template id="'),J===null)throw Error(t(395));return M.push(J),M.push('"></template>')}function le(M,H,J,ae){switch(J.insertionMode){case 0:case 1:return M.push('<div hidden id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 2:return M.push('<svg aria-hidden="true" style="display:none" id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 3:return M.push('<math aria-hidden="true" style="display:none" id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 4:return M.push('<table hidden id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 5:return M.push('<table hidden><tbody id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 6:return M.push('<table hidden><tr id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 7:return M.push('<table hidden><colgroup id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');default:throw Error(t(397))}}function W(M,H){switch(H.insertionMode){case 0:case 1:return M.push("</div>");case 2:return M.push("</svg>");case 3:return M.push("</math>");case 4:return M.push("</table>");case 5:return M.push("</tbody></table>");case 6:return M.push("</tr></table>");case 7:return M.push("</colgroup></table>");default:throw Error(t(397))}}var de=/[<\u2028\u2029]/g;function oe(M){return JSON.stringify(M).replace(de,function(H){switch(H){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function he(M,H){return H=H===void 0?"":H,{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:H+"P:",segmentPrefix:H+"S:",boundaryPrefix:H+"B:",idPrefix:H,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:M}}function K(M,H,J,ae){return J.generateStaticMarkup?(M.push(D(H)),!1):(H===""?M=ae:(ae&&M.push("<!-- -->"),M.push(D(H)),M=!0),M)}var re=Object.assign,pe=Symbol.for("react.element"),Ie=Symbol.for("react.portal"),Oe=Symbol.for("react.fragment"),Ne=Symbol.for("react.strict_mode"),Be=Symbol.for("react.profiler"),Je=Symbol.for("react.provider"),ze=Symbol.for("react.context"),Qe=Symbol.for("react.forward_ref"),It=Symbol.for("react.suspense"),Zt=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),tt=Symbol.for("react.lazy"),at=Symbol.for("react.scope"),gt=Symbol.for("react.debug_trace_mode"),Et=Symbol.for("react.legacy_hidden"),Tt=Symbol.for("react.default_value"),qt=Symbol.iterator;function zt(M){if(M==null)return null;if(typeof M=="function")return M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case Oe:return"Fragment";case Ie:return"Portal";case Be:return"Profiler";case Ne:return"StrictMode";case It:return"Suspense";ca
`),Gt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,cn=new Map;function Xt(N){var _=cn.get(N);if(_===void 0){if(!Gt.test(N))throw Error(t(65,N));_=f("<"+N),cn.set(N,_)}return _}var Qn=f("<!DOCTYPE html>");function En(N,_,q,ie,Fe){switch(_){case"select":N.push(Xt("select"));var xe=null,We=null;for(jt in q)if(g.call(q,jt)){var rt=q[jt];if(rt!=null)switch(jt){case"children":xe=rt;break;case"dangerouslySetInnerHTML":We=rt;break;case"defaultValue":case"value":break;default:tt(N,ie,jt,rt)}}return N.push(at),Et(N,We,xe),xe;case"option":We=Fe.selectedValue,N.push(Xt("option"));var St=rt=null,Vt=null,jt=null;for(xe in q)if(g.call(q,xe)){var Mn=q[xe];if(Mn!=null)switch(xe){case"children":rt=Mn;break;case"selected":Vt=Mn;break;case"dangerouslySetInnerHTML":jt=Mn;break;case"value":St=Mn;default:tt(N,ie,xe,Mn)}}if(We!=null)if(q=St!==null?""+St:Tt(rt),$(We)){for(ie=0;ie<We.length;ie++)if(""+We[ie]===q){N.push(qt);break}}else""+We===q&&N.push(qt);else Vt&&N.push(qt);return N.push(at),Et(N,jt,rt),rt;case"textarea":N.push(Xt("textarea")),jt=We=xe=null;for(rt in q)if(g.call(q,rt)&&(St=q[rt],St!=null))switch(rt){case"children":jt=St;break;case"value":xe=St;break;case"defaultValue":We=St;break;case"dangerouslySetInnerHTML":throw Error(t(91));default:tt(N,ie,rt,St)}if(xe===null&&We!==null&&(xe=We),N.push(at),jt!=null){if(xe!=null)throw Error(t(92));if($(jt)&&1<jt.length)throw Error(t(93));xe=""+jt}return typeof xe=="string"&&xe[0]===`
`&&N.push($t),xe!==null&&N.push(d(Z(""+xe))),null;case"input":N.push(Xt("input")),St=jt=rt=xe=null;for(We in q)if(g.call(q,We)&&(Vt=q[We],Vt!=null))switch(We){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":St=Vt;break;case"defaultValue":rt=Vt;break;case"checked":jt=Vt;break;case"value":xe=Vt;break;default:tt(N,ie,We,Vt)}return jt!==null?tt(N,ie,"checked",jt):St!==null&&tt(N,ie,"checked",St),xe!==null?tt(N,ie,"value",xe):rt!==null&&tt(N,ie,"value",rt),N.push(gt),null;case"menuitem":N.push(Xt("menuitem"));for(var Yr in q)if(g.call(q,Yr)&&(xe=q[Yr],xe!=null))switch(Yr){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:tt(N,ie,Yr,xe)}return N.push(at),null;case"title":N.push(Xt("title")),xe=null;for(Mn in q)if(g.call(q,Mn)&&(We=q[Mn],We!=null))switch(Mn){case"children":xe=We;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:tt(N,ie,Mn,We)}return N.push(at),xe;case"listing":case"pre":N.push(Xt(_)),We=xe=null;for(St in q)if(g.call(q,St)&&(rt=q[St],rt!=null))switch(St){case"children":xe=rt;break;case"dangerouslySetInnerHTML":We=rt;break;default:tt(N,ie,St,rt)}if(N.push(at),We!=null){if(xe!=null)throw Error(t(60));if(typeof We!="object"||!("__html"in We))throw Error(t(61));q=We.__html,q!=null&&(typeof q=="string"&&0<q.length&&q[0]===`
`?N.push($t,d(q)):N.push(d(""+q)))}return typeof xe=="string"&&xe[0]===`
`&&N.push($t),xe;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":N.push(Xt(_));for(var ko in q)if(g.call(q,ko)&&(xe=q[ko],xe!=null))switch(ko){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,_));default:tt(N,ie,ko,xe)}return N.push(gt),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return zt(N,q,_,ie);case"html":return Fe.insertionMode===0&&N.push(Qn),zt(N,q,_,ie);default:if(_.indexOf("-")===-1&&typeof q.is!="string")return zt(N,q,_,ie);N.push(Xt(_)),We=xe=null;for(Vt in q)if(g.call(q,Vt)&&(rt=q[Vt],rt!=null))switch(Vt){case"children":xe=rt;break;case"dangerouslySetInnerHTML":We=rt;break;case"style":ze(N,ie,rt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:T(Vt)&&typeof rt!="function"&&typeof rt!="symbol"&&N.push(Qe,d(Vt),It,d(Z(rt)),Zt)}return N.push(at),Et(N,We,xe),xe}}var Cr=f("</"),yr=f(">"),Rn=f('<template id="'),ji=f('"></template>'),xo=f("<!--$-->"),Uo=f('<!--$?--><template id="'),Li=f('"></template>'),Eo=f("<!--$!-->"),Ri=f("<!--/$-->"),ua=f("<template"),ui=f('"'),_i=f(' data-dgst="');f(' data-msg="'),f(' data-stck="');var ne=f("></template>");function ge(N,_,q){if(o(N,Uo),q===null)throw Error(t(395));return o(N,q),i(N,Li)}var Ae=f('<div hidden id="'),He=f('">'),Ye=f("</div>"),et=f('<svg aria-hidden="true" style="display:none" id="'),nt=f('">'),kt=f("</svg>"),en=f('<math aria-hidden="true" style="display:none" id="'),jn=f('">'),wn=f("</math>"),Lr=f('<table hidden id="'),_n=f('">'),rr=f("</table>"),Rr=f('<table hidden><tbody id="'),ca=f('">'),bn=f("</tbody></table>"),co=f('<table hidden><tr id="'),fo=f('">'),Mr=f("</tr></table>"),zo=f('<table hidden><colgroup id="'),ho=f('">'),bl=f("</colgroup></table>");function Bi(N,_,q,ie){switch(q.insertionMode){case 0:case 1:return o(N,Ae),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,He);case 2:return o(N,et),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,nt);case 3:return o(N,en),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,jn);case 4:return o(N,Lr),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,_n);case 5:return o(N,Rr),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,ca);case 6:return o(N,co),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,fo);case 7:return o(N,zo),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,ho);default:throw Error(t(397))}}function Hi(N,_){switch(_.insertionMode){case 0:case 1:return i(N,Ye);case 2:return i(N,kt);case 3:return i(N,wn);case 4:return i(N,rr);case 5:return i(N,bn);case 6:return i(N,Mr);case 7:return i(N,bl);default:throw Error(t(397))}}var cu=f('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),Sl=f('$RS("'),Ba=f('","'),da=f('")<\/script>'),Ha=f('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),Dl=f('$RC("'),Ya=f('","'),du=f('")<\/script>'),Sn=f('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),_r=f('$RX("'),vs=f('"'),ws=f(")<\/script>"),Yi=f(","),Tl=/[<\u2028\u2029]/g;function ci(N){return JSON.stringify(N).replace(Tl,function(_){switch(_){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no
`,i.current,t.path,I);const A=(R=i.current)==null?void 0:R.querySelectorAll(".internal-link");A==null||A.forEach(j=>{const B=j,L=B.getAttribute("data-href");if(!L)return;r.app.metadataCache.getFirstLinkpathDest(L,t.path)||j.classList.add("is-unresolved"),B.addEventListener("mouseover",U=>{U.stopPropagation(),r.app.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:I.containerEl,targetEl:B,linktext:L,sourcePath:B.href})})})}k()},[t.content,a]);const v=async()=>{if(f)try{await je.deleteMemoById(o.id),n(o.id)}catch(I){new C.Notice(I.message)}else m()},w=async()=>{switch(o.sourceType){case"DAILY":await U1(o.id,o.path);break;case"CANVAS":await V1(o.id,o.path);break;case"MULTI":await Y1(o.path);break;case"FILE":await z1(o.id,o.path);break}},D=async()=>{try{const I=await je.restoreMemoById(o.id),k=r.app,A=k==null?void 0:k.loadLocalStorage("tokenForSync");I&&I.webId&&A&&r.settings.startSync&&await Lx(I.webId),I&&je.editMemo(I),n(o.id),new C.Notice(E("RESTORE SUCCEED"))}catch(I){new C.Notice(I.message)}},T=()=>{f&&m(!1)};return y.jsxs("div",{ref:a,className:`memo-wrapper ${"memos-"+o.id}`,onMouseLeave:T,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[E("DELETE AT")," ",o.deletedAtStr]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:I=>{I&&C.setIcon(I,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:D,children:E("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:w,children:E("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btn delete-btn ${f?"final-confirm":""}`,onClick:v,children:E(f?"CONFIRM":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:i,className:"memo-content-text",onContextMenu:I=>{I.preventDefault(),I.stopPropagation()}})]})},yte=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:o,type:i,text:a,filter:u}=t,d=tn.getQueryById(u);return!!(r||o&&o.from<o.to||i||a||d)||d||n?e.filter(m=>{let g=!0;if(m.thinoType!==void 0&&n&&m.thinoType==="TASK-DONE"&&(g=!1),m.content.contains("comment:")&&(g=!1),d){const v=JSON.parse(d.querystring);Array.isArray(v)&&(g=jh(m,v))}if(r){const v=new Set;for(const w of Array.from(m.content.match(gr)||[])){const T=w.replace(gr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(jr)||[])){const T=w.replace(jr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(so)||[])){const T=w.replace(so,"$2").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}v.has(r)||(g=!1)}return o&&o.from<o.to&&(ut.getTimeStampByDate(m.createdAt)<o.from||ut.getTimeStampByDate(m.createdAt)>o.to)&&(g=!1),i&&(i==="NOT_TAGGED"&&(m.content.match(gr)!==null||m.content.match(so)!==null||m.content.match(jr)!==null)||i==="LINKED"&&m.content.match(Od)===null||i==="IMAGED"&&m.content.match(jd)===null||i==="CONNECTED"&&m.content.match(hc)===null)&&(g=!1),a&&!m.content.toLowerCase().includes(a.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},vte=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=F.useContext(Ot),r=$h(),[o,i]=F.useState([]),a=se.useRef(null);F.useEffect(()=>{const f=yte({memos:n.filter(m=>m.deletedAt!==""&&m.deletedAt),query:e,HideDoneTasks:!1});i(f),r.setFinish()},[n,a.current,e]);const u=F.useCallback(f=>{i(m=>m.filter(g=>g.id!==f))},[]),d=F.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:a,children:[y.jsxs("div",{clas
* **开源项目**
* 😋 精美且细节的视觉样式
* 📑 体验优良的交互逻辑`,a=()=>{dt.setAppSetting({useTinyUndoHistoryCache:!t})},u=()=>{dt.setAppSetting({shouldSplitMemoWord:!r})},d=()=>{dt.setAppSetting({shouldHideImageUrl:!n})},f=()=>{dt.setAppSetting({shouldUseMarkdownParser:!o})},m=async()=>{const g=je.getState().memos.map(D=>({...D})),v=JSON.stringify(g),w=document.createElement("a");w.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(v)),w.setAttribute("download","data.json"),w.style.display="none",document.body.appendChild(w),w.click(),document.body.removeChild(w)};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"section-container preferences-section-container",children:[y.jsx("p",{className:"title-text",children:"Memo 显示相关"}),y.jsx("div",{className:"demo-content-container memo-content-text",dangerouslySetInnerHTML:{__html:Fb(i)}}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:u,children:[y.jsx("span",{className:"normal-text",children:"中英文内容自动间隔"}),y.jsx("img",{className:"icon-img",src:r?Ky:Qy})]}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:f,children:[y.jsx("span",{className:"normal-text",children:"部分 markdown 格式解析"}),y.jsx("img",{className:"icon-img",src:o?Ky:Qy})]}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:d,children:[y.jsx("span",{className:"normal-text",children:"隐藏图片链接地址"}),y.jsx("img",{className:"icon-img",src:n?Ky:Qy})]})]}),y.jsxs("div",{className:"section-container preferences-section-container",children:[y.jsx("p",{className:"title-text",children:"编辑器"}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:a,children:[y.jsxs("span",{className:"normal-text",children:["启用"," ",y.jsx("a",{target:"_blank",href:"https://github.com/boojack/tiny-undo",onClick:g=>g.stopPropagation(),rel:"noreferrer",children:"tiny-undo"})]}),y.jsx("img",{className:"icon-img",src:t?Ky:Qy})]})]}),y.jsxs("div",{className:"section-container hidden",children:[y.jsx("p",{className:"title-text",children:"其他"}),y.jsx("div",{className:"btn-container",children:y.jsx("button",{className:"btn export-btn",onClick:m,children:"导出数据(JSON)"})})]})]})},bte=()=>{const{globalState:{isMobileView:e}}=F.useContext(Ot);F.useEffect(()=>{je.fetchAllMemos()},[]);const t=F.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"preference-wrapper",children:[y.jsx("div",{className:"section-header-container",children:y.jsxs("div",{className:"title-text",children:[y.jsx(Aa,{when:e,children:y.jsx("button",{className:"action-btn",onClick:t})}),y.jsx("span",{className:"normal-text",children:"账号与设置"})]})}),y.jsx("div",{className:"sections-wrapper",children:y.jsx(wte,{})})]})},Ste=e=>{const{dailyNotesState:{app:t,settings:n,view:r}}=F.useContext(Ot),{memo:o,handleUnarchivedMemoAction:i}=e,a=se.useRef(null),u=se.useRef(null),[d,f]=se.useState(""),m={...o,createdAtStr:ut.getDateTimeString(o.createdAt),deletedAtStr:ut.getDateTimeString(o.deletedAt||o.createdAt)},[g,v]=ml(!1),w={restore:F.useRef(null),delete:F.useRef(null),source:F.useRef(null)};F.useEffect(()=>{u&&(C.setIcon(w.restore.current,"archive-restore"),C.setIcon(w.delete.current,"trash"),C.setIcon(w.source.current,"home"))},[u]),F.useEffect(()=>{if(!a.current||!u.current||a.current.hasChildNodes()&&o.content===d||!r)return;f(o.content),a.current.hasChildNodes()&&a.current.empty();async function A(){var j,B;(j=a.current)==null||j.toggleClass(["markdown-rendered"],!0),await C.MarkdownRenderer.render(t,o.content+`
`,a.current,o.path,r);const R=(B=a.current)==null?void 0:B.querySelectorAll(".internal-link");R==null||R.forEach(L=>{const Z=L,U=Z.getAttribute("data-href");if(!U)return;t.metadataCache.getFirstLinkpathDest(U,o.path)||L.classList.add("is-unresolved"),Z.addEventListener("mouseover",$=>{$.stopPropagation(),t.workspace.trigger("hover-link",{event:$,source:"thino",hoverParent:r.containerEl,targetEl:Z,linktext:U,sourcePath:Z.href})})})}A()},[o.content,u]);const D=async()=>{switch(m.sourceType){case"DAILY":await U1(m.id,m.path);break;case"CANVAS":await V1(m.id,m.path);break;case"MULTI":await Y1(m.path);break;case"FILE":await z1(m.id,m.path);break}},T=async()=>{if(g)try{if(n.DeleteThinoDirectly)await je.deleteMemoById(m.id);else{const A=await je.hideMemoById(m.id);A&&je.editMemo(A)}}catch(A){new C.Notice(A.message)}else v()},I=async()=>{try{const A=await je.unarchiveMemo(m);A&&je.editMemo(A),i(m.id),new C.Notice(E("RESTORE SUCCEED"))}catch(A){new C.Notice(A.message)}},k=()=>{g&&v(!1)};return y.jsxs("div",{ref:u,className:`memo-wrapper ${"memos-"+m.id}`,onMouseLeave:k,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[E("ARCHIVED AT")," ",m.updatedAt]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:A=>{A&&C.setIcon(A,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:w.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:I,children:E("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:w.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:D,children:E("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:w.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btn delete-btn ${g?"final-confirm":""}`,onClick:T,children:E(g?"CONFIRM":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:a,className:"memo-content-text"})]})},Dte=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:o,type:i,text:a,filter:u}=t,d=tn.getQueryById(u);return!!(r||o&&o.from<o.to||i||a||d)||d||n?e.filter(m=>{let g=!0;if(m.thinoType!==void 0&&n&&m.thinoType==="TASK-DONE"&&(g=!1),m.content.contains("comment:")&&(g=!1),d){const v=JSON.parse(d.querystring);Array.isArray(v)&&(g=jh(m,v))}if(r){const v=new Set;for(const w of Array.from(m.content.match(gr)||[])){const T=w.replace(gr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(jr)||[])){const T=w.replace(jr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(so)||[])){const T=w.replace(so,"$2").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}v.has(r)||(g=!1)}return o&&o.from<o.to&&(ut.getTimeStampByDate(m.createdAt)<o.from||ut.getTimeStampByDate(m.createdAt)>o.to)&&(g=!1),i&&(i==="NOT_TAGGED"&&(m.content.match(gr)!==null||m.content.match(so)!==null||m.content.match(jr)!==null)||i==="LINKED"&&m.content.match(Od)===null||i==="IMAGED"&&m.content.match(jd)===null||i==="CONNECTED"&&m.content.match(hc)===null)&&(g=!1),a&&!m.content.toLowerCase().includes(a.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},Tte=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=F.useContext(Ot),r=$h(),[o,i]=F.useState([]),a=se.useRef(null);F.useEffect(()=>{const m=Dte({memos:n.filter(g=>g.rowStatus==="ARCHIVED"&&g.deletedAt===""),query:e,HideDoneTasks:!1});i(m),r.setFinish()},[n,a.current,e]);const u=F.useCallback(m=>{i(g=>g.filter(v=>v.id!==m))},[]),d=F.useCallback(m=>{i(g=>g.filter(v=>v.id!==m))},[]),f=F.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:a,children:[y.jsxs("div",{className:"section-header-container",children:[y
${A}`}}}const T=await je.createThino({content:g,isList:d,type:f});T&&(je.pushMemo(T),st.clearQuery()),r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify({status:"success",thino:T,link:`obsidian://thino?openId=${T.id}`}))})}else if(o.pathname==="/search"&&n.method==="GET"){const i=o.query,{keyword:a}=i,u=je.getThinoViaKeyword(a);r.statusCode=200,r.setHeader("Content-Type","application/json");const d=JSON.stringify({status:"success",thinos:u});r.end(d)}else r.statusCode=404,r.end()}}catch(o){console.error(o),r.statusCode=500,r.end({status:"error",message:o.message})}});return{listen(n,r){try{t.listen({port:parseInt(r),host:n})}catch(o){console.error(o),new C.Notice(E("Thino - Failed to start HTTP server, please check the port is available."))}new C.Notice(`${E("Thino - Started HTTP server on port")} ${r}`)},close(){t.close(),new C.Notice(E("Thino - Terminated HTTP server"))}}}const{clipboard:tr}=C.Platform.isDesktop?require("electron"):"";class nre{constructor(){De(this,"eventListeners");this.eventListeners={}}on(t,n){this.eventListeners[t]=this.eventListeners[t]||[],this.eventListeners[t].push(n)}once(t,n){n.$emitOnce=!0,this.on(t,n)}removeListener(t,n){if(this.eventListeners[t]){const r=this.eventListeners[t].findIndex(o=>o===n);r>=0&&this.eventListeners[t].splice(r,1)}}removeAllListeners(t){this.eventListeners[t]&&(this.eventListeners[t].length=0)}emit(t,...n){this.eventListeners[t]&&this.eventListeners[t].forEach(r=>{r.call(this,...n),r.$emitOnce&&this.removeListener(t,r)})}}const ih=new nre;let hm=null,KI=tr==null?void 0:tr.readText(),QI=tr==null?void 0:tr.readImage();tr&&(tr.on=(e,t)=>(ih.on(e,t),tr),tr.once=(e,t)=>(ih.once(e,t),tr),tr.off=(e,t)=>(t?ih.removeListener(e,t):ih.removeAllListeners(e),tr),tr.startWatching=()=>(hm||(hm=setInterval(()=>{rre(KI,KI=tr==null?void 0:tr.readText())&&ih.emit("text-changed"),ore(QI,QI=tr==null?void 0:tr.readImage())&&ih.emit("image-changed")},500)),tr),tr.stopWatching=()=>(hm&&clearInterval(hm),hm=null,tr));function rre(e,t){return t&&e!==t}function ore(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var ix;const xb=(ix=require("electron"))==null?void 0:ix.remote;var ax,sx;const XI=(sx=(ax=require("electron"))==null?void 0:ax.remote)==null?void 0:sx.screen;class ire{constructor(t,n){De(this,"isRegisted");De(this,"leaf");De(this,"clipboard");De(this,"isScreenTop",!1);De(this,"currentSplitWindow");De(this,"intervalNum");De(this,"allowsCopy",!1);De(this,"plugin");De(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=tr}async onload(){C.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{xb.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally)}))}initGlobalCopyEvents(){this.plugin.addCommand({id:"init-global-copy-events",name:E("Global copy"),callback:()=>{this.allowsCopy=!this.allowsCopy,!this.allowsCopy&&this.clipboard.stopWatching(),this.allowsCopy&&this.clipboard.startWatching(),this.leaf&&this.allowsCopy&&(this.actionEl=this.leaf.view.addAction("clipboard-x","Stop global copying",()=>{var t;this.allowsCopy=!1,this.clipboard.stopWatching(),(t=this.actionEl)==null||t.remove()}))}})}onunload(){this.isRegisted&&(xb.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally),this.clipboard.off("text-changed"),this.clipboard.off("image-changed"),this.clipboard.stopWatching(),this.leaf&&this.leaf.detach())}getCurrentLeaf(){var n;return this.leaf?this.app.workspace.getLeavesOfType("thino_view").length>0&&!!this.app.workspace.getLeafById(this.leaf.id)?!0:((n=this.leaf)==null||n.detach(),this.currentSplitWindow.close(),this.currentSplitWindow=null,this.leaf=null,this.isScreenTop=!1,!1):!1}async registerAllShortcuts(){xb.globalShortcut.register(this.plugin.settings.CaptureKey.OpenThinoGlobally,()=>{this.getCurrentLeaf()?this.showThinoView():this.openThinoView()}),this.isRegisted=!0}showThinoView(){var r,o,i,a;const t=XI.getCursorScreenPo
`:" ";switch(t[d==="prepend"?"SharePrependType":"ShareAppendType"]){case"none":f();break;case"preset":t.ShareToThinoWithText&&(d==="prepend"?i=t.ShareToThinoWithTextPrepend+g:a=g+t.ShareToThinoWithTextAppend),f();break;case"input":{const v="Thino "+E(d==="prepend"?"Prepend text":"Append text");new vk(e,v,w=>{d==="prepend"?i=w.trim()+(w.trim()?g:""):a=(w.trim()?g:"")+w,f()}).open();break}case"selectTags":new hO(e,v=>{const w=v.length>0?v.map(D=>"#"+D).join(" "):"";d==="prepend"?i=w.trim()+(w.trim()?g:""):a=(w.trim()?g:"")+w.trim(),f()}).open();break;default:m(new Error("Invalid configuration type."))}});Promise.all([u("append"),u("prepend")]).then(()=>n(i,a)).then(()=>r()).catch(o)})}class Pre extends C.Plugin{constructor(){super(...arguments);De(this,"settings");De(this,"settingTab");De(this,"triggerBySelf",!1);De(this,"updatedID","");De(this,"debounceTimer",0);De(this,"apiHttpServer",null);De(this,"captureService",null);De(this,"loaded",!1)}async onload(){await this.loadSettings(),Rte(),this.registerRibbon(),await this.verify();try{await this.checkVersionAndShowChangeLog()}catch(n){console.error(n)}this.settingTab=new Jte(this.app,this),this.addSettingTab(this.settingTab),this.initApp(),this.initEditor(),this.initURIHandler(),this.registerMobileEvent(),this.registerCommands(),this.registerCanvasNodeMemos(),this.registerHoverEvent(),this.registerLinkOpen(),this.registerCodeBlocks(),this.registerEditorContextMenu(),this.registerEditorSuggest(new Ote(this.app,this)),this.registerEditorExtension([Zne]),this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this)),this.registerView(Bo,n=>new ac(n,this))}async loadSettings(){this.settings=Object.assign({},cs,await this.loadData()),yt.setSettings(this.settings)}async saveSettings(){await this.saveData(this.settings),yt.setSettings(this.settings)}onunload(){var r;this.app.workspace.detachLeavesOfType(Bo),je.clearMemos(),_e.dispatch({type:"CLEAR_MEMOS",payload:null}),_e.dispatch({type:"CLEAR_FILES",payload:null}),_e.dispatch({type:"CLEAR_VIEW",payload:null});const n=document.body.find(".dialog-wrapper");n&&((r=n.parentElement)==null||r.detach()),this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null),this.captureService&&this.captureService.onunload(),new C.Notice(E("Close Memos Successfully"))}initEditor(){const n=()=>{const r=this.app.embedRegistry;if(!r)return!1;const o=r.embedByExtension.md,i=createEl("div"),a=o({app:this.app,containerEl:i},null,null);if(a.editable=!0,a.set(""),a.showEditor(),!a.editMode)return!1;const u=Object.getPrototypeOf(Object.getPrototypeOf(a.editMode));return yt.setEditor(u),i.detach(),!0};this.app.workspace.onLayoutReady(()=>{n()||this.app.workspace.onLayoutReady(()=>{setTimeout(()=>{n()},100)})}),this.register(Sm(C.MetadataCache.prototype,{getFileCache:r=>function(o){return!(o!=null&&o.path)&&!o?null:r.call(this,o)}}))}initApp(){yt.setApp(this.app)}initURIHandler(){this.registerObsidianProtocolHandler("thino",async n=>{var a,u,d;if(!n)return;if(n.userid)try{const f=n.userid;Gne(f,this.app),Jne(C.moment().add(30,"days").valueOf(),this.app),dt.setRefresh(!0)}catch(f){console.error(f),new C.Notice(E("Failed to verify"))}if(n.token)try{const f=n.token;(a=this.app)==null||a.saveLocalStorage("tokenForSync",f),setTimeout(()=>{this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos"),this.settingTab.display()},200),new C.Notice(E("Saved sync token successfully"))}catch(f){console.error(f),new C.Notice(E("Failed to save"))}if(n.copyToken){this.app.setting.open(),this.app.setting.openTabById(this.manifest.id??"obsidian-memos");const f=await ok();await navigator.clipboard.writeText(f),new C.Notice(E("Copied app id successfully"))}const r=(u=yt.getState())==null?void 0:u.verifyState,o=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),i=C.Platform.isDesktop?await Jn():o.identifier||o.uuid;if(!(!r||(r==null?void 0:r.appId)!==i)){if(n.content){const f=n.type,m=decodeURI(n.content)!==n.content?decodeURI(n.content):n.content,g=n.task,v=await je.createThino({content:m,type:f,is
`);try{await ox(this.app,this.settings,async(u,d)=>{a=u+a+d;const f=await je.createThino({content:a,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});je.pushMemo(f)})}catch(u){console.error("Configuration failed:",u);return}})})})))}registerCommands(){nv.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),["Modern","Clean","Minimal","Gradient"].forEach(n=>{this.addCommand({id:`share-thino-via-${n.toLowerCase()}`,name:E("Share thino")+` [${E(n)}]`,editorCallback:(r,o)=>{const i=r.getSelection();if(i.length===0)return;const a={id:`temp-${Date.now()}`,content:i,createdAt:C.moment().format("YYYY-MM-DD HH:mm:ss"),updatedAt:C.moment().format("YYYY-MM-DD HH:mm:ss"),deletedAt:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",thinoType:"JOURNAL",hasId:"",linkId:"",resourceList:[],creatorName:"thino",sourceType:"DAILY",path:o.file.path};md(a,n.toLowerCase(),o)}})}),this.addCommand({id:"insert-task",name:E("Insert task"),checkCallback:n=>{const r=this.app.plugins.getPlugin("obsidian-tasks-plugin"),o=this.app.workspace.getLeavesOfType("thino_view").first();if(r&&o)return n||this.app.plugins.plugins["obsidian-tasks-plugin"].apiV1.createTaskLineModal().then(a=>{this.app.workspace.trigger("send-to-thino",a,o)}),!0}}),this.addCommand({id:"show-thino-editor",name:E("Show thino editor"),checkCallback:n=>{if(je.initialized&&yt.initialized){if(!n){if(!yt.getState().view){new C.Notice(E("Please open thino first"));return}new UC(this.app).open()}return!0}}}),this.addCommand({id:"lock-thino",name:E("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(ac)&&this.settings.needVerify)return n||dt.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:E("Copy debug info"),callback:()=>{try{const n=this.app.internalPlugins.plugins["daily-notes"];let r;r={settings:{...this.settings,tokenForVerify:"***"},plugins:Object.keys(this.app.plugins.plugins),manifest:this.manifest,platform:C.Platform.resourcePathPrefix},n&&(r={...r,dailyNotePluginInfo:{options:n.instance.options}}),navigator.clipboard.writeText(`\`\`\`json
${JSON.stringify(r,null,2)}
7 months ago
\`\`\``),new C.Notice(E("Debug info copied to clipboard"))}catch(n){console.error(n)}}}),this.addCommand({id:"insert-editor",name:E("Insert editor"),checkCallback:n=>{const r=this.app.workspace.getActiveViewOfType(C.MarkdownView);if(r&&r.getViewType()==="markdown")return n||r.editor.replaceSelection("\n```thino\n{\n editor: false\n}\n```\n"),!0}}),this.addCommand({id:"toggle-minimal-thino",name:E("Toggle minimal mode"),callback:()=>{const n=document.body.hasClass("minimal-thino");document.body.toggleClass("minimal-thino",!n)}}),this.addCommand({id:"focus-on-thino-editor",name:E("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:E("ReSync web thinos to local"),callback:()=>{Uee(this.app)}}),this.addCommand({id:"init-thino-sync",name:E("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new C.Notice(E("Please input token first"));return}if(!this.settings.startSync){new C.Notice(E("Please enable sync first"));return}try{await je.initSync()}catch(o){console.error(o),new C.Notice(E("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:E("Show daily thino"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:E("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:E("Show-thino in popover(Hover editor)"),callback:()=>this.showInPopover(),hotkeys:[]})}async onLayoutReady(){await this.stopEnableList(),await this.initServer(),this.initGlobalManifest(),await this.initMemos(),this.autoOpenMemos(),this.registerThinoWidget(),await this.registerToolbarCheck(),await this.initCaptureService(),yt.setPlugin(this);const n=this.app.workspace.editorSuggest.suggests.findIndex(r=>r.type==="customTag");n!==-1?(this.app.workspace.editorSuggest.suggests.splice(n,1),this.app.workspace.editorSuggest.suggests.unshift(new ex(this.app,this))):this.app.workspace.editorSuggest.suggests.unshift(new ex(this.app,this))}async initMemos(){try{await this.initDailyNotes()}catch(n){console.error(n)}yt.getState(),je.getState(),await je.fetchAllMemos()}async initDailyNotes(){this.settings.EnabledLocationList.find(n=>n.value==="DAILY")&&await yt.fechLocalDailyNotes()}registerCanvasNodeMemos(){if(!C.requireApiVersion("1.2.0")||!this.settings.EnabledLocationList.find(i=>i.value==="CANVAS"))return;const n=i=>{clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{setTimeout(async()=>{const a=i.canvas.getData(),u=a.nodes.find(d=>d.id===i.id);if(u&&(r(u),i.canvas.setData(a),je.getMemoById(i.id))){const f=await je.updateMemo(i.id,u.text,u.thinoType);je.editMemo(f)}i.canvas.requestSave(!0)},0)},800)},r=i=>{i.createdAt||(i.createdAt=C.moment().format("YYYY-MM-DD HH:mm:ss")),i.updatedAt=C.moment().format("YYYY-MM-DD HH:mm:ss"),i.deletedAt=i.deletedAt?i.deletedAt:"",i.pinned=i.pinned?i.pinned:!1,i.visibility=i.visibility?i.visibility:"PUBLIC",i.rowStatus=i.rowStatus?i.rowStatus:"NORMAL",i.thinoType=i.thinoType?i.thinoType:"JOURNAL",i.hasId=i.hasId?i.hasId:"",i.linkId=i.linkId?i.linkId:"",i.resourceList=[]},o=()=>{var v,w;const i=(v=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:v.view;if(!i||!(i==null?void 0:i.canvas))return!1;const u=((w=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:w.view).canvas.nodes.values(),f=Array.from(u).filter(D=>D.text!==void 0);if(!f||f.length===0)return!1;const m=f[0].child;if(!m)return!1;const g=Sm(m.constructor.prototype,{save:D=>function(...T){D.call(this,...T),this.node.isEditing&&n(this.node)}});return this.register(g),!0};this.app.workspace.onLayoutReady(()=>{if(!o()){const i=this.app.workspace.on("layout-change",()=>{o()&&this.app.workspace.offref(i)});this.registerEvent(i)}})}registerLinkOpen(){Sm(C.Workspace.prototype,{openLinkText:n=>async function(...r){const o=je.getState().memos;if(o.find(i=>i.id===r[0]||i.id===r[1])){const i=o.find(a=>a.id===r[0]||a.id===r[1]);if(i){Lh(i);return}}await n.call(this,...r)}})}registerHoverEvent(){t
8 months ago
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
7 months ago
-----END PUBLIC KEY-----`,"RS256");try{const{payload:f}=await Mre(i,d),m=JSON.parse(new TextDecoder().decode(f));return!m||m.iss!=="pkmer"||m.type!=="thino"||m.appId!==n?!1:(yt.setVerifyState(m),!0)}catch(f){console.error(f)}}return await r(this.settings.tokenForVerify[n])}async checkVersionAndShowChangeLog(){const n=this.manifest.version,r=this.settings.LastUpdatedVersion;n!==r&&(this.settings.LastUpdatedVersion=n,await this.saveSettings(),this.showChangeLog())}showChangeLog(){new QS(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(Bo).length>0||this.settings.MobileAndDesktop==="Mobile"&&C.Platform.isDesktop||this.settings.MobileAndDesktop==="Desktop"&&C.Platform.isMobile||this.settings.OpenMemosAutomatically&&this.openMemos()}async openDailyMemo(){if(this.app.workspace.getLeavesOfType(Bo).length>0){st.setPathname("/daily");return}await this.openMemos(),st.setPathname("/daily")}async openMemos(n="center",r){const o=this.app.workspace;if(o.getLeavesOfType(Bo).length>0){const u=o.getLeavesOfType(Bo)[0];o.setActiveLeaf(u),o.revealLeaf(u);return}o.detachLeavesOfType(Bo);let i;switch(n){case"left":i=o.getLeftLeaf(!1);break;case"right":i=o.getRightLeaf(!1);break;case"float":i=o.getLeaf("window");break;default:i=o.getLeaf(!0);break}i&&(await i.setViewState({type:Bo}),o.revealLeaf(i));const a=i.view.containerEl.querySelector("textarea");a&&a.focus(),r==null||r()}async searchIt(){const n=this.app.workspace,r=n.getLeavesOfType(Bo);if(!(r.length>0)){await this.openMemos(),this.app.workspace.trigger("focus-on-searchbar");return}const o=r[0];n.revealLeaf(o),this.app.workspace.trigger("focus-on-searchbar")}async focusOnEditor(){if(!(this.app.workspace.getLeavesOfType(Bo).length>0)){await this.openMemos();return}this.app.workspace.trigger("focus-on-textarea")}changeStatus(){const n=this.app.workspace,r=n.getLeavesOfType(Bo);if(!(r.length>0)){new C.Notice(E("Please Open Memos First"));return}const o=r[0];n.setActiveLeaf(o),o.view.containerEl.querySelector(".list-or-task").click()}async showInPopover(){var i,a,u;const n=this.app.workspace;if(n.detachLeavesOfType(Bo),!this.app.plugins.getPlugin("obsidian-hover-editor")){new C.Notice(E("Please install obsidian-hover-editor plugin first"));return}const o=await((i=this.app.plugins.getPlugin("obsidian-hover-editor"))==null?void 0:i.spawnPopover());o&&(await o.setViewState({type:Bo}),n.revealLeaf(o),o.view.containerEl.classList.add("mobile-view"),(a=this.settings)!=null&&a.FocusOnEditor&&o.view.containerEl.querySelector("textarea")!==void 0&&((u=o.view.containerEl.querySelector("textarea"))==null||u.focus()))}}class QS extends C.Modal{constructor(n,r){super(n);De(this,"component");this.version=r}async onOpen(){const{contentEl:n}=this;this.containerEl.toggleClass("thino-changelog-modal",!0),n.createEl("h2",{text:E("Thino update info"),cls:"thino-changelog-title"}).createDiv({cls:"thino-changelog-version",text:`${this.version}`});try{n.createEl("h3",{text:E("Latest version")});const o=n.createDiv("current-change-log");n.createEl("hr"),n.createEl("h3",{text:E("Previous version")});const i=n.createDiv("prev-change-log"),u=await C.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new C.Component;const[d,f]=this.getLatestVersionContent(u.text);let m=d,g=f;try{const v=localStorage.getItem("language"),w=v&&(v==="zh"||v==="zh-TW");m=w?d.replaceAll("> [!tips]+","> [!tips]-").replaceAll("> [!note]-","> [!note]+"):d,g=w?f.replaceAll("> [!tips]+","> [!tips]-").replaceAll("> [!note]-","> [!note]+"):f}catch(v){console.error(v)}await C.MarkdownRenderer.render(this.app,m,o,"",this.component),await C.MarkdownRenderer.render(this.app,g,i,"",this.component)}catch(o){console.error(o),n.createEl("p",{text:E("Failed to load changelog")}),n.createEl("a",{text:E("View online"),attr:{href:"https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md",target:"_blank"}})}}getLatestVersionContent(n){const r=/^# .+/gm,o=[...n.matchAll(r)];if(o.length===0)return[n,""];const i=o[0].index||0;let a=n.length;o.leng