Files

53 lines
226 KiB
JavaScript
Raw Permalink Normal View History

2025-10-25 20:35:10 +08:00
'use strict';
var obsidian = require('obsidian');
function __awaiter(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{s(n.next(e));}catch(e){a(e);}}function c(e){try{s(n.throw(e));}catch(e){a(e);}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(i,c);}s((n=n.apply(e,t||[])).next());}))}"function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};
class StatusBar{constructor(_0x4e8f0c){this['messages']=[],this['statusBarEl']=_0x4e8f0c;}['displayMessage'](_0x3354b3,_0x277e78,_0x4605bc=!0x1){this['messages'][0x0]&&this['messages'][0x0]['message']===_0x3354b3||(this['messages']['push']({'message':'希果壳五彩:\x20'+_0x3354b3['slice'](0x0,0x64),'timeout':0x3e8*_0x277e78}),_0x4605bc&&(this['currentMessage']=null,this['lastMessageTimestamp']=null,this['statusBarEl']['setText']('')),this['display']());}['display'](){if(this['currentMessage'])Date['now']()-this['lastMessageTimestamp']>=this['currentMessage']['timeout']&&(this['currentMessage']=null,this['lastMessageTimestamp']=null);else {if(this['messages']['length'])return this['currentMessage']=this['messages']['shift'](),this['statusBarEl']['setText'](this['currentMessage']['message']),void(this['lastMessageTimestamp']=Date['now']());this['statusBarEl']['setText']('');}}}
class BGCONSTS{}BGCONSTS['APPID']=0x14,BGCONSTS['API']='prod',BGCONSTS['SID']=0x7,BGCONSTS['MKT']='obsidian-plugin',BGCONSTS['EP']='obsidianwucai',BGCONSTS['VERSION']='25.2.17',BGCONSTS['VERSION_NUM']=0x3d169,BGCONSTS['IS_DEBUG']=!0x1;
function logger(_0x3e68cf,_0x322909=0x1){(0x1!==_0x322909||BGCONSTS['IS_DEBUG'])&&console['log'](_0x3e68cf);}
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}
function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
var moment=createCommonjsModule((function(e,t){var n;n=function(){var t,n;function s(){return t.apply(null,arguments)}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(a(e,t))return !1;return !0}function u(e){return void 0===e}function l(e){return "number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function h(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var n,s=[],i=e.length;for(n=0;n<i;++n)s.push(t(e[n],n));return s}function c(e,t){for(var n in t)a(t,n)&&(e[n]=t[n]);return a(t,"toString")&&(e.toString=t.toString),a(t,"valueOf")&&(e.valueOf=t.valueOf),e}function f(e,t,n,s){return Wt(e,t,n,s,!0).utc()}function m(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function _(e){if(null==e._isValid){var t=m(e),s=n.call(t.parsedDateParts,(function(e){return null!=e})),i=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&s);if(e._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i;}return e._isValid}function y(e){var t=f(NaN);return null!=e?c(m(t),e):m(t).userInvalidated=!0,t}n=Array.prototype.some?Array.prototype.some:function(e){var t,n=Object(this),s=n.length>>>0;for(t=0;t<s;t++)if(t in n&&e.call(this,n[t],t,n))return !0;return !1};var g=s.momentProperties=[],p=!1;function w(e,t){var n,s,i,r=g.length;if(u(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),u(t._i)||(e._i=t._i),u(t._f)||(e._f=t._f),u(t._l)||(e._l=t._l),u(t._strict)||(e._strict=t._strict),u(t._tzm)||(e._tzm=t._tzm),u(t._isUTC)||(e._isUTC=t._isUTC),u(t._offset)||(e._offset=t._offset),u(t._pf)||(e._pf=m(t)),u(t._locale)||(e._locale=t._locale),r>0)for(n=0;n<r;n++)u(i=t[s=g[n]])||(e[s]=i);return e}function v(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===p&&(p=!0,s.updateOffset(this),p=!1);}function k(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}function M(e){!1===s.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e);}function D(e,t){var n=!0;return c((function(){if(null!=s.deprecationHandler&&s.deprecationHandler(null,e),n){var i,r,o,u=[],l=arguments.length;for(r=0;r<l;r++){if(i="","object"==typeof arguments[r]){for(o in i+="\n["+r+"] ",arguments[0])a(arguments[0],o)&&(i+=o+": "+arguments[0][o]+", ");i=i.slice(0,-2);}else i=arguments[r];u.push(i);}M(e+"\nArguments: "+Array.prototype.slice.call(u).join("")+"\n"+(new Error).stack),n=!1;}return t.apply(this,arguments)}),t)}var S,Y={};function O(e,t){null!=s.deprecationHandler&&s.deprecationHandler(e,t),Y[e]||(M(t),Y[e]=!0);}function b(e){return "undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=c({},e);for(n in t)a(t,n)&&(r(e[n])&&r(t[n])?(s[n]={},c(s[n],e[n]),c(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)a(e,n)&&!a(t,n)&&r(e[n])&&(s[n]=c({},s[n]));return s}function T(e){null!=e&&this.set(e);}function N(e,t,n){var s=""+Math.abs(e),i=t-s.length;return (e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}s.suppressDeprecationWarnings=!1,s.deprecationHandler=null,S=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)a(e,t)&&n.push(t);return n};var P=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{
//! moment.js
s.version="2.29.4",t=Ct,s.fn=xn,s.min=function(){return Ft("isBefore",[].slice.call(arguments,0))},s.max=function(){return Ft("isAfter",[].slice.call(arguments,0))},s.now=function(){return Date.now?Date.now():+new Date},s.utc=f,s.unix=function(e){return Ct(1e3*e)},s.months=function(e,t){return Rn(e,t,"months")},s.isDate=h,s.locale=mt,s.invalid=y,s.duration=Jt,s.isMoment=k,s.weekdays=function(e,t,n){return Wn(e,t,n,"weekdays")},s.parseZone=function(){return Ct.apply(null,arguments).parseZone()},s.localeData=yt,s.isDuration=Gt,s.monthsShort=function(e,t){return Rn(e,t,"monthsShort")},s.weekdaysMin=function(e,t,n){return Wn(e,t,n,"weekdaysMin")},s.defineLocale=_t,s.updateLocale=function(e,t){if(null!=t){var n,s,i=ut;null!=lt[e]&&null!=lt[e].parentLocale?lt[e].set(x(lt[e]._config,t)):(null!=(s=ft(e))&&(i=s._config),t=x(i,t),null==s&&(t.abbr=e),(n=new T(t)).parentLocale=lt[e],lt[e]=n),mt(e);}else null!=lt[e]&&(null!=lt[e].parentLocale?(lt[e]=lt[e].parentLocale,e===mt()&&mt(e)):null!=lt[e]&&delete lt[e]);return lt[e]},s.locales=function(){return S(lt)},s.weekdaysShort=function(e,t,n){return Wn(e,t,n,"weekdaysShort")},s.normalizeUnits=G,s.relativeTimeRounding=function(e){return void 0===e?ss:"function"==typeof e&&(ss=e,!0)},s.relativeTimeThreshold=function(e,t){return void 0!==is[e]&&(void 0===t?is[e]:(is[e]=t,"s"===e&&(is.ss=t-1),!0))},s.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},s.prototype=xn,s.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},s},e.exports=n();}));
const _hasBuffer="function"==typeof Buffer,_TD="function"==typeof TextDecoder?new TextDecoder:void 0;"function"==typeof TextEncoder?new TextEncoder:void 0;const b64ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b64chs=Array.prototype.slice.call(b64ch),b64tab=(()=>{let e={};return b64chs.forEach(((t,r)=>e[t]=r)),e})(),b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_fromCC=String.fromCharCode.bind(String),_U8Afrom="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),_tidyB64=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return _fromCC(55296+(t>>>10))+_fromCC(56320+(1023&t));case 3:return _fromCC((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return _fromCC((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=e=>e.replace(re_btou,cb_btou),atobPolyfill=e=>{if(e=e.replace(/\s+/g,""),!b64re.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,o,n="";for(let a=0;a<e.length;)t=b64tab[e.charAt(a++)]<<18|b64tab[e.charAt(a++)]<<12|(r=b64tab[e.charAt(a++)])<<6|(o=b64tab[e.charAt(a++)]),n+=64===r?_fromCC(t>>16&255):64===o?_fromCC(t>>16&255,t>>8&255):_fromCC(t>>16&255,t>>8&255,255&t);return n},_atob="function"==typeof atob?e=>atob(_tidyB64(e)):_hasBuffer?e=>Buffer.from(e,"base64").toString("binary"):atobPolyfill,_toUint8Array=_hasBuffer?e=>_U8Afrom(Buffer.from(e,"base64")):e=>_U8Afrom(_atob(e).split("").map((e=>e.charCodeAt(0)))),_decode=_hasBuffer?e=>Buffer.from(e,"base64").toString("utf8"):_TD?e=>_TD.decode(_toUint8Array(e)):e=>btou(_atob(e)),_unURI=e=>_tidyB64(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),decode=e=>_decode(_unURI(e));
class Utils{static['getBlocks'](_0x3f5dd0){let _0x55f58c=(_0x3f5dd0||'')['matchAll'](this['fetchBlocksRegExp']),_0x5b53e5={'highlights':'','pagenote':'','mdcontent':''};if(!_0x55f58c)return _0x5b53e5;for(const _0x540e47 of _0x55f58c){switch((_0x540e47[0x1]||'')['toLowerCase']()){case'pagenote':_0x5b53e5['pagenote']['length']<=0x0&&(_0x5b53e5['pagenote']=_0x540e47[0x0]||'');break;case'highlights':_0x5b53e5['highlights']['length']<=0x0&&(_0x5b53e5['highlights']=_0x540e47[0x0]||'');break;case'mdcontent':_0x5b53e5['mdcontent']['length']<=0x0&&(_0x5b53e5['mdcontent']=_0x540e47[0x0]||'');}}return _0x5b53e5;}static['getDiffDay'](_0xa68cba,_0x15b0f8){if(_0x15b0f8<=0x0||_0xa68cba<=0x0)return 0x0;return this['formatDateTime'](new Date(0x3e8*_0xa68cba),'YYYY-MM-DD')!==this['formatDateTime'](new Date(0x3e8*_0x15b0f8),'YYYY-MM-DD')?_0x15b0f8:0x0;}static['formatText'](_0x3d31ca='',_0x2df509='\x0d'){return _0x3d31ca?_0x3d31ca['split']('\x0a')['filter'](_0x269a36=>Utils['trimString'](_0x269a36))['join'](_0x2df509):'';}static['formatPageTitle'](_0x5cd3e0){return (_0x5cd3e0=_0x5cd3e0||_0x5cd3e0)['length']<=0x0?_0x5cd3e0:(_0x5cd3e0=_0x5cd3e0['replace'](/["]/g,''))['replace'](/(:\s+)/g,':');}static['replaceHolders'](_0x587b1d,_0x56d6b2){return _0x587b1d=_0x587b1d||'',(Object['keys'](_0x56d6b2||{})['forEach'](_0x288e4e=>{let _0x4f8773=this['holdersRegExpMap'][_0x288e4e];if(!_0x4f8773)return;let _0xd827a8=(_0x56d6b2[_0x288e4e]||'')['replace'](/(^[\r\n]+|[\r\n]+$)/g,'');if(!_0xd827a8||_0xd827a8['length']<=0x0)return;let _0x39b936=_0x587b1d['matchAll'](_0x4f8773);if(!_0x39b936)return _0x587b1d+=this['wrapBlock'](_0xd827a8,_0x288e4e);let _0x267240=0x0;for(const _0x1f1e71 of _0x39b936){let _0x47f7a8=_0x1f1e71[0x1]['length'],_0x4c0395=_0x587b1d['substring'](_0x1f1e71['index']+_0x47f7a8);_0x587b1d=_0x587b1d['substring'](0x0,_0x1f1e71['index'])+this['wrapBlockNoBreak'](_0xd827a8,_0x288e4e)+_0x4c0395,_0x267240++;break;}_0x267240<=0x0&&(_0x587b1d+=this['wrapBlock'](_0xd827a8,_0x288e4e));}),_0x587b1d);}static['replaceBlocks'](_0x320c91,_0x26dc36){return _0x320c91=_0x320c91||'',(Object['keys'](_0x26dc36||{})['forEach'](_0x186f71=>{let _0x25cef1=this['blocksRegExpMap'][_0x186f71];if(!_0x25cef1)return;let _0x248a3f=(_0x26dc36[_0x186f71]||'')['replace'](/(^[\r\n]+|[\r\n]+$)/g,'');if(!_0x248a3f||_0x248a3f['length']<=0x0)return;let _0x31538d=_0x320c91['matchAll'](_0x25cef1);if(_0x31538d)for(const _0x1289ca of _0x31538d){let _0x345090=_0x1289ca[0x0]||'';_0x320c91=_0x320c91['replace'](_0x345090,_0x248a3f);break;}}),_0x320c91);}static['formatDateTime'](_0x10ef06,_0x27bd29='YYYY-MM-DD\x20HH:mm'){return _0x10ef06?moment(_0x10ef06)['format'](_0x27bd29):'';}static['trimString'](_0xb7c909){return !_0xb7c909||_0xb7c909['length']<=0x0?'':_0xb7c909['replace'](/^\s+|\s+$/g,'');}static['truncateFileName'](_0x2afbf5,_0x1b73ca,_0x15c37f){let _0x4d21b9=_0x2afbf5['lastIndexOf']('/');return (_0x15c37f<=0x40||_0x15c37f>=0xff)&&(_0x15c37f=0x40),_0x2afbf5['length']-(_0x4d21b9+0x1)+_0x1b73ca<=_0x15c37f?_0x2afbf5:_0x2afbf5['substring'](0x0,_0x4d21b9+0x1+(_0x15c37f-_0x1b73ca));}static['removeNoteIdFromName'](_0xba3e5f){return _0xba3e5f;}static['lmfn'](_0x50ab19,_0x407d83,_0x101daf,_0x40a755,_0x176205){var _0x1741b5;return __awaiter(this,void 0x0,void 0x0,function*(){let _0x51bb7c=0x1e,_0x290668=-0x1;const _0x175597=('-'+_0x407d83+'.md')['length'],_0x48dd4b=_0x101daf['substring'](0x0,_0x101daf['length']-_0x175597);for(;_0x51bb7c-->0x0;){_0x290668++;const _0x3364a4=_0x48dd4b+(_0x290668>0x0?'\x20('+_0x290668+').md':'.md');if(_0x3364a4===_0x101daf)return '';const _0x8edea8=yield _0x50ab19['getAbstractFileByPath'](_0x3364a4);if(!(_0x8edea8&&_0x8edea8 instanceof obsidian.TFile))return _0x3364a4;const _0x1bc2b0=(null===(_0x1741b5=_0x40a755['getFileCache'](_0x8edea8))||void 0x0===_0x1741b5?void 0x0:_0x1741b5['frontmatter'])||{};if(this['isEmptyObj'](_0x1bc2b0))return _0x3364a4;for(let _0x453613 of _0x176205)if(_0x1bc2b0[_0x453613]===_0x407d83)return _0x3364a4;}return '';});}static['lffnw'](_0x7e366,_0x3e8982,_0x116206,_0x1907ed,_0x4d0e35,_0x502f39,_0x4ba158,_0x31a232,_0x1e2a4b,_0x93b539){
var nunjucks=createCommonjsModule((function(e,t){
/*! Browser bundle of nunjucks 3.2.4 */
var n;n=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i});},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){var i=Array.prototype,r=Object.prototype,o={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","\\":"&#92;"},s=/[&"'<>\\]/g;function a(e,t){return r.hasOwnProperty.call(e,t)}function c(e){return o[e]}function l(e,t,n){var i,r,o;if(e instanceof Error&&(e=(r=e).name+": "+r.message),Object.setPrototypeOf?(i=new Error(e),Object.setPrototypeOf(i,l.prototype)):(i=this,Object.defineProperty(i,"message",{enumerable:!1,writable:!0,value:e})),Object.defineProperty(i,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(i,this.constructor),r){var s=Object.getOwnPropertyDescriptor(r,"stack");(o=s&&(s.get||function(){return s.value}))||(o=function(){return r.stack});}else {var a=new Error(e).stack;o=function(){return a};}return Object.defineProperty(i,"stack",{get:function(){return o.call(i)}}),Object.defineProperty(i,"cause",{value:r}),i.lineno=t,i.colno=n,i.firstUpdate=!0,i.Update=function(e){var t="("+(e||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?t+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(t+=" [Line "+this.lineno+"]")),t+="\n ",this.firstUpdate&&(t+=" "),this.message=t+(this.message||""),this.firstUpdate=!1,this},i}function u(e){return "[object Function]"===r.toString.call(e)}function h(e){return "[object Array]"===r.toString.call(e)}function f(e){return "[object String]"===r.toString.call(e)}function p(e){return "[object Object]"===r.toString.call(e)}function m(e){var t,n=(t=e)?"string"==typeof t?t.split("."):[t]:[];return function(e){for(var t=e,i=0;i<n.length;i++){var r=n[i];if(!a(t,r))return;t=t[r];}return t}}function d(e){return Array.prototype.slice.call(e)}function v(e,t,n){return Array.prototype.indexOf.call(e||[],t,n)}function _(e){var t=[];for(var n in e)a(e,n)&&t.push(n);return t}(t=e.exports={}).hasOwnProp=a,t._prettifyError=function(e,n,i){if(i.Update||(i=new t.TemplateError(i)),i.Update(e),!n){var r=i;(i=new Error(r.message)).name=r.name;}return i},Object.setPrototypeOf?Object.setPrototypeOf(l.prototype,Error.prototype):l.prototype=Object.create(Error.prototype,{constructor:{value:l}}),t.TemplateError=l,t.escape=function(e){return e.replace(s,c)},t.isFunction=u,t.isArray=h,t.isString=f,t.isObject=p,t.getAttrGetter=m,t.groupBy=function(e,t,n){for(var i={},r=u(t)?t:m(t),o=0;o<e.length;o++){var s=e[o],a=r(s,o);if(void 0===a&&!0===n)throw new TypeError('groupby: attribute "'+t+'" resolved to undefined');(i[a]||(i[a]=[])).push(s);}return i},t.toArray=d,t.without=function(e){var t=[];if(!e)return t;for(var n=e.length,i=d(arguments).slice(1),r=-1;++r<n;)-1===v(i,e[r])&&t.push(e[r]);return t},t.repeat=function(e,t){for(var n="",i=0;i<t;i++)n+=e;return n},t.each=function(e,t,n){if(null!=e)if(i.forEach&&e.forEach===i.forEach)e.forEach(t,n);else if(e.length===+e.length)for(var r=0,o=e.length;r<o;r++)t.call(n,e[r],r,e);},t.map=function(e,t){var n=[];if(null==e)return n;if(i.map&&e.map===i.map)return e.map(t);for(var r=0;r<e.length;r++)n[n.length]=t(e[r],r);return e.length===+e.length&&(n.length=e.length),n},t.asyncIter=function(e,t,n){var i=-1;!function r(){++i<e.length?t(e[i],i,r,n):n();}();},t.asyncFor=function(e,t,n){var i=_(e||{}),r=i.length,o=-1;!function s(){o++;var a=i[o];o<r?t(a,e[a],o,r,s):n();}();},t.indexOf=v,t.keys=_,t._entries=function(e){return _(e).map((function(t){return [t,e[t]]}))},t._values=function(e){return _(e).map((function(t){return e[t]}))},t._assign=t.extend=function(e,t){return e=e||{},_(t).forEach((function(n){e[n]=t[n];})),e},t.inOperator=function(e,t){if(h(t)||f(t))return -1!==t.indexOf(e);if(p(t))return
class TestData{}TestData['ViewOfObsidianTemplate']={'title':'test\x20title\x202','url':'https://doc.wucai.site/','wucaiurl':'','readurl':'','tags':'','alltags':'','alltagsv2':[],'trimtags':'','mergedtags':'','notetype':'page','pagenote':'','pagescore':0x1,'isstar':!0x1,'ispagemirror':!0x1,'isdailynote':!0x1,'highlights':[{'note':'','notelinks':[],'imageurl':'','updateat_ts':0x6580f8db,'createat_ts':0x6580f8db,'type':'highlight','annotation':'好的','color':'','slotid':0x1,'refid':'323aef','refurl':'','tags':'','remaintags':''}],'highlightcount':0xc,'createat':'','createat_ts':0x6580f8db,'updateat':'','updateat_ts':0x6580f8db,'noteid':'232ad','citekey':'','author':'','orgauthor':'','orgname':'','publishat':'','publishat_ts':0x6580f8db,'diffupdateat_ts':0x0,'domain2':'','domain':'','mdcontent':'','folder':'','annotationcount':0x0},TestData['ViewOfObsidianTitle']={'title':'网页标题','createat_ts':Math['floor'](+new Date()/0x3e8),'updateat_ts':Math['floor'](+new Date()/0x3e8),'domain2':'aa.com','domain':'bb.aa.com','notetype':'page','isdailynote':!0x1},TestData['templateObStyle1']='---\x0a标题:\x20\x22{{title}}\x22\x0a笔记ID:\x20{{noteid}}\x0a笔记类型:\x20{{notetype}}\x0a星标:\x20{{isstar}}\x0atags:\x20{{mergedtags}}\x0a{%\x20if\x20not\x20isdailynote\x20%}\x0a域名:\x20{{domain}}\x0a域名2:\x20{{domain2}}\x0a作者:\x20\x22{{author}}\x22\x0a原文链接:\x20\x22{{url}}\x22\x0a{%\x20endif\x20%}\x0a五彩链接:\x20\x22{{wucaiurl}}\x22\x0a划线数量:\x20{{highlightcount}}\x0a创建时间:\x20{{createat}}\x0a更新时间:\x20{{updateat}}\x0a---\x0a\x0a##\x20{{title}}\x20\x0a{{alltags}}\x0a\x0a##\x20页面笔记\x0a{%\x20block\x20pagenote\x20%}\x0a{{pagenote}}\x0a{%\x20endblock\x20%}\x0a\x0a##\x20划线列表\x0a{%\x20block\x20highlights\x20%}\x0a{%\x20for\x20item\x20in\x20highlights\x20%}\x0a{%\x20set\x20suffix\x20=\x20\x22[Link](\x22+item.refurl+\x22)\x22\x20%}\x0a{{\x20item\x20|\x20style1({prefix:\x22-\x20\x22,\x20suffix:suffix,\x20anno:\x22\x09-\x20\x22\x20})\x20}}\x0a{%\x20endfor\x20%}\x0a{%\x20endblock\x20%}\x0a\x0a##\x20全文剪藏\x0a{%\x20block\x20mdcontent\x20%}\x0a{{mdcontent}}\x0a{%\x20endblock\x20%}';
const strref='string';class Templates{constructor(){this['templateEnv']=_0x57995a['configure']({'autoescape':!0x1,'trimBlocks':!0x0,'lstripBlocks':!0x0}),this['templateEnv']['addFilter']('date',function(_0x5aef0c,_0x56e18f){if(_0x5aef0c<=0x0)return '';let _0x38e363=new Date(0x3e8*_0x5aef0c);return Utils['formatDateTime'](_0x38e363,_0x56e18f);}),this['templateEnv']['addFilter']('pretty',function(_0xa52a1e,_0x2f78a6){let _0x14aaa7=(_0x2f78a6=_0x2f78a6||{})['prefix']||'',_0x2c0425=void 0x0===_0x2f78a6['trim']||_0x2f78a6['trim'];if((_0xa52a1e=_0xa52a1e||'')['length']<=0x0)return '';let _0x8876b0=_0xa52a1e['split'](/\n/),_0x55af0a=[];for(let _0x1efb52=0x0;_0x1efb52<_0x8876b0['length'];_0x1efb52++){let _0x33b7c4=_0x8876b0[_0x1efb52]||'';_0x2c0425&&(_0x33b7c4=_0x33b7c4['replace'](/^\s+|\s+$/g,'')),_0x33b7c4['length']<=0x0||_0x55af0a['push'](_0x14aaa7+_0x33b7c4+'\x0a');}return _0x55af0a['join']('\x0a');}),this['templateEnv']['addFilter']('yaml_text',function(_0x14c2a5){return _0x14c2a5?typeof _0x14c2a5!==strref?'error\x20type':'\x20|-\x0a\x20\x20'+_0x14c2a5['replace'](/\n/g,'\x0a\x20\x20'):'';}),this['templateEnv']['addFilter']('yaml_field',function(_0xb58e3d,_0x586e34){return _0x586e34&&_0xb58e3d?(_0x586e34['indexOf'](':')<0x0&&(_0x586e34+=':'),_0x586e34+'\x20'+_0xb58e3d):'';}),this['templateEnv']['addFilter']('yaml_list',function(_0x410308,_0x432144=',',_0x543197=!0x1){if(!_0x410308)return '';let _0x2a269f=[];return typeof _0x410308===strref?(_0x432144||(_0x432144=','),_0x2a269f=_0x410308['split'](_0x432144)):Array['isArray'](_0x410308)&&(_0x2a269f=_0x410308),_0x2a269f=_0x2a269f['filter'](_0x32ed0a=>_0x32ed0a),!_0x2a269f||_0x2a269f['length']<=0x0?'':Utils['toYAMLList'](_0x2a269f);}),this['templateEnv']['addFilter']('tobacklink',function(_0x248db2){if(!_0x248db2)return _0x248db2;let _0x29a0e4=_0x248db2['split']('\x20');return Utils['formatTags'](_0x29a0e4,!0x1);}),this['templateEnv']['addFilter']('anno_lines',function(_0x5ea43e){let _0x409e99=0x0;if(!_0x5ea43e||_0x5ea43e['length']<=0x0)return _0x409e99;for(let _0x244959 of _0x5ea43e)_0x409e99+=(_0x244959['annotation']||'')['split']('\x0a')['filter'](_0x2585ef=>_0x2585ef)['length'];return _0x409e99;}),this['templateEnv']['addFilter']('style_dailynote',function(_0x1eb80b,_0xec07cd){let _0x1a0f5b=[],_0x5709ad=(_0xec07cd=_0xec07cd||{})['groupby']||'YYYY-MM-DD\x20HH:mm',_0x20d9f7={},_0x32733b=[];for(let _0x12658e of _0x1eb80b){let _0x4239ad=Utils['formatTime'](_0x12658e['createat_ts']||_0x12658e['updateat_ts']||0x0,_0x5709ad);null==_0x20d9f7[_0x4239ad]&&(_0x32733b['push'](_0x4239ad),_0x20d9f7[_0x4239ad]=[]),_0x20d9f7[_0x4239ad]['push'](_0x12658e);}_0x1eb80b=void 0x0;for(let _0x1fde93 of _0x32733b){_0x1a0f5b['push']('-\x20'+_0x1fde93);let _0xfd1e67=0x1,_0x4521b9=Utils['repeatStr']('\x09',_0xfd1e67),_0x28bbf9=Utils['repeatStr']('\x09',_0xfd1e67+0x1);for(let _0x588ca1 of _0x20d9f7[_0x1fde93]){let _0x14eb16='',_0x579ce1=_0x588ca1['remaintags']||'';if(_0x588ca1['imageurl'])_0x14eb16='![]('+_0x588ca1['imageurl']+')',_0x579ce1&&(_0x14eb16+='\x0d'+_0x579ce1);else {if(_0x588ca1['note']){let _0x50e957=Utils['formatText'](_0x588ca1['note']||'','\x0d\x09\x09');_0x50e957=''+_0x4521b9+(Utils['isMardownFormat'](_0x50e957)?'':'-\x20')+_0x50e957+'\x20'+_0x579ce1,_0x1a0f5b['push'](_0x50e957);}}if(_0x588ca1['annotation']){let _0x3fff6f=(_0x588ca1['annotation']||'')['split']('\x0a');for(let _0x13eed9 of _0x3fff6f){if(!_0x13eed9||Utils['isOnlyDateTimeLine'](_0x13eed9))continue;let _0xbead8c=Utils['isMardownFormat'](_0x13eed9)?'':'-\x20';_0x14eb16?_0x1a0f5b['push'](''+_0x4521b9+_0xbead8c+_0x13eed9):_0x1a0f5b['push'](''+_0x28bbf9+_0xbead8c+_0x13eed9);}}_0x14eb16&&_0x1a0f5b['push'](_0x14eb16);}}return _0x1a0f5b['join']('\x0a');}),this['templateEnv']['addFilter']('style1',function(_0x48b3ac,_0x6ac7d8){_0x6ac7d8=_0x6ac7d8||{};let _0x48db22=_0x48b3ac['note']||'',_0x48e9c3=_0x6ac7d8['prefix']||'';const _0xc6e60d=_0x48e9c3['startsWith']('-\x20'),_0x2e8f95=_0x48e9c3['startsWith']('>\x20'),_0x294d6b=!_0xc6e60d&&!_0x2e8f95,_0x22adf1=_0xc6e60d?'\x09':'';let _0x599854=(_0x6ac7d8['suffix']||'')['trim'](),_0xb7bc08=_
const usHost='us.wucainote.com',euHost='eu.wucainote.com',chnHost='marker.dotalk.cn',chnHosts=[chnHost,'my.wucai.site'],usHosts=[usHost],euHosts=[euHost],Regions={'chn':{'id':'chn','name':'Asia\x20-\x20亚洲','apis':{'beta':'https://syncbeta.wucai.site/apix/openapi/wucai/sync','prod':'https://sync.wucai.site/apix/openapi/wucai/sync'},'my':'https://'+chnHost,'hosts':chnHosts},'us':{'id':'us','name':'America','apis':{'prod':'https://'+usHost+'/apix/openapi/wucai/sync'},'my':'https://'+usHost,'hosts':usHosts},'euro':{'id':'euro','name':'Europe','apis':{'prod':'https://'+euHost+'/apix/openapi/wucai/sync'},'my':'https://'+euHost,'hosts':euHosts}};
const WAITING_STATUSES=['PENDING','RECEIVED','STARTED','RETRY'],DefaultSettings={'token':'','region':'','useridx':'','wuCaiDir':'WuCai','frequency':'0','triggerOnLoad':!0x0,'lastSyncFailed':!0x1,'refreshNotes':!0x1,'notesToRefresh':[],'reimportShowConfirmation':!0x0,'lastCursor':'','dataVersion':0x0,'notePaths':{},'exportConfig':{'pageMirrorStyle':0x2,'truncateTile255':0x0,'writeStyle':0x2,'highlightStyle':0x1,'annotationStyle':0x1,'tagStyle':0x1,'obTemplate':'','titleTemplate':'','obQuery':'','obExcludeCondition':'','obDailyPath':'','obNoteProps':'','obNotSyncProps':'','obRemainProps':''}};function localize(_0x23ddbd){return _0x23ddbd;}class WuCaiPlugin extends obsidian.Plugin{constructor(){super(...arguments),this['scheduleInterval']=null,this['isInitDone']=!0x1,this['apiurl']='',this['myurl']='';}['initRegion'](_0x3432f1){if(!_0x3432f1)return;this['settings']['lastSyncFailed']=!0x1;const _0x441eed=this['settings']['region'];if(!_0x441eed||_0x3432f1&&_0x441eed!==_0x3432f1){const _0x74cb59=_0x3432f1||'chn';this['region']=_0x74cb59,this['settings']['region']=_0x74cb59,this['saveSettings']();}const _0x36708f=Regions[_0x3432f1||'chn'];_0x36708f&&(this['region']=_0x3432f1,this['apiurl']=_0x36708f['apis'][BGCONSTS['API']]||'',this['myurl']=_0x36708f['my']);}['resetRegion'](){this['region']='',this['apiurl']='',this['myurl']='';}['checkResponseBody'](_0x27e5fd,_0x14b6f0){if(!_0x14b6f0)return !0x1;if(_0x14b6f0&&0x1===_0x14b6f0['code'])return !0x1;let _0x3eafa1=_0x14b6f0['code'];0x2710===_0x3eafa1&&(this['settings']['token']='',this['settings']['useridx']='');let _0x18e1f9=localize(_0x14b6f0['message']||'call\x20api\x20failed');return _0x3eafa1&&(_0x18e1f9+=',\x20error:'+_0x3eafa1),this['handleSyncError'](_0x27e5fd,_0x18e1f9),!0x0;}['getErrorFromRsp'](_0x1d2224){return _0x1d2224&&0x199===_0x1d2224['status']?'Sync\x20in\x20progress\x20initiated\x20by\x20different\x20client':_0x1d2224&&0x1a1===_0x1d2224['status']?'Obsidian\x20export\x20is\x20locked.\x20Wait\x20for\x20an\x20hour.':''+(_0x1d2224?_0x1d2224['statusText']:'Can\x27t\x20connect\x20to\x20server');}['handleSyncError'](_0x4c1319,_0x5980e8){this['settings']['lastSyncFailed']=!0x0,this['saveSettings'](),_0x4c1319?(this['showInfoStatus'](_0x4c1319['buttonEl']['parentElement'],_0x5980e8,'wc-error'),_0x4c1319['buttonEl']['setText'](localize('Run\x20sync'))):this['notice'](_0x5980e8,!0x0,0x4,!0x0);}['handleSyncSuccess'](_0x5110f5,_0x4fd3af='Synced',_0x1c44a3=''){this['settings']['lastSyncFailed']=!0x1;let _0x255b13=this['getLastCursor'](_0x1c44a3,this['settings']['lastCursor']);_0x255b13&&(this['settings']['lastCursor']=_0x255b13),this['saveSettings'](),_0x5110f5&&(this['showInfoStatus'](_0x5110f5['buttonEl']['parentNode']['parentElement'],_0x4fd3af,'wc-success'),_0x5110f5['buttonEl']['setText']('Run\x20sync'));}['callApi'](_0x243b7f,_0x5c8192){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5b0173=Math['floor'](+new Date()/0x3e8);return _0x5c8192['v']=BGCONSTS['VERSION_NUM'],_0x5c8192['serviceId']=BGCONSTS['SID'],_0x243b7f+='?appid='+BGCONSTS['APPID']+'&ep='+BGCONSTS['EP']+'&version='+BGCONSTS['VERSION']+'&reqtime='+_0x5b0173,fetch(this['apiurl']+_0x243b7f,{'headers':Object['assign'](Object['assign']({},this['getAuthHeaders']()),{'Content-Type':'application/json'}),'method':'POST','body':JSON['stringify'](_0x5c8192)});});}['exportInit'](_0x47216d,_0x86dcc6,_0x5c0090='',_0x16b178=''){return __awaiter(this,void 0x0,void 0x0,function*(){if(this['stopSyncing'])return void logger({'msg':'WuCai\x20sync\x20stoped,\x20because\x20of\x20stopSyncing\x20status'});const _0x5bf49d=this['app']['vault']['getAbstractFileByPath'](this['settings']['wuCaiDir']),_0x4a94e2=!(_0x5bf49d&&_0x5bf49d instanceof obsidian.TFolder);_0x4a94e2&&(this['settings']['lastCursor']='',this['settings']['notePaths']={}),this['settings']['notesToRefresh']=[],logger({'msg':'onload\x20last\x20cursor','lastCursor':this['settings']['lastCursor'],'flagx':_0x5c0090,'isDirDeleted':_0x4a94e2,'isSync':this['isSyncing']});let _0x31fb0b,_0x48f452=this['settings']['lastCursor'],_0x58bb53={'noteDirDeleted':_0x4a94e2,
module.exports = WuCaiPlugin;
/* nosourcemap */