'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>>0;for(t=0;t0)for(n=0;n=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{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,R=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,W={},C={};function H(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(C[e]=i),t&&(C[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),n&&(C[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)});}function U(e,t){return e.isValid()?(t=F(t,e.localeData()),W[t]=W[t]||function(e){var t,n,s,i=e.match(P);for(t=0,n=i.length;t=0&&R.test(e);)e=e.replace(R,s),R.lastIndex=0,n-=1;return e}var L={};function V(e,t){var n=e.toLowerCase();L[n]=L[n+"s"]=L[t]=e;}function G(e){return "string"==typeof e?L[e]||L[e.toLowerCase()]:void 0}function E(e){var t,n,s={};for(n in e)a(e,n)&&(t=G(n))&&(s[t]=e[n]);return s}var j={};function A(e,t){j[e]=t;}function I(e){return e%4==0&&e%100!=0||e%400==0}function Z(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function z(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=Z(t)),n}function $(e,t){return function(n){return null!=n?(B(this,e,n),s.updateOffset(this,t),this):q(this,e)}}function q(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function B(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&I(e.year())&&1===e.month()&&29===e.date()?(n=z(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Ne(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n));}var J,Q=/\d/,X=/\d\d/,K=/\d{3}/,ee=/\d{4}/,te=/[+-]?\d{6}/,ne=/\d\d?/,se=/\d\d\d\d?/,ie=/\d\d\d\d\d\d?/,re=/\d{1,3}/,ae=/\d{1,4}/,oe=/[+-]?\d{1,6}/,ue=/\d+/,le=/[+-]?\d+/,he=/Z|[+-]\d\d:?\d\d/gi,de=/Z|[+-]\d\d(?::?\d\d)?/gi,ce=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function fe(e,t,n){J[e]=b(t)?t:function(e,s){return e&&n?n:t};}function me(e,t){return a(J,e)?J[e](t._strict,t._locale):new RegExp(_e(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,s,i){return t||n||s||i}))))}function _e(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}J={};var ye={};function ge(e,t){var n,s,i=t;for("string"==typeof e&&(e=[e]),l(t)&&(i=function(e,n){n[t]=z(e);}),s=e.length,n=0;n68?1900:2e3)};var Ee=$("FullYear",!0);function je(e,t,n,s,i,r,a){var o;return e<100&&e>=0?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}function Ae(e){var t,n;return e<100&&e>=0?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ie(e,t,n){var s=7+t-n;return -(7+Ae(e,0,s).getUTCDay()-t)%7+s-1}function Ze(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ie(e,s,i);return o<=0?a=Ge(r=e-1)+o:o>Ge(e)?(r=e+1,a=o-Ge(e)):(r=e,a=o),{year:r,dayOfYear:a}}function ze(e,t,n){var s,i,r=Ie(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+$e(i=e.year()-1,t,n):a>$e(e.year(),t,n)?(s=a-$e(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function $e(e,t,n){var s=Ie(e,t,n),i=Ie(e+1,t,n);return (Ge(e)-s+i)/7}function qe(e,t){return e.slice(t,7).concat(e.slice(0,t))}H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),V("week","w"),V("isoWeek","W"),A("week",5),A("isoWeek",5),fe("w",ne),fe("ww",ne,X),fe("W",ne),fe("WW",ne,X),pe(["w","ww","W","WW"],(function(e,t,n,s){t[s.substr(0,1)]=z(e);})),H("d",0,"do","day"),H("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),H("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),H("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),V("day","d"),V("weekday","e"),V("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),fe("d",ne),fe("e",ne),fe("E",ne),fe("dd",(function(e,t){return t.weekdaysMinRegex(e)})),fe("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),fe("dddd",(function(e,t){return t.weekdaysRegex(e)})),pe(["dd","ddd","dddd"],(function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:m(n).invalidWeekday=e;})),pe(["d","e","E"],(function(e,t,n,s){t[s]=z(e);}));var Be="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Je="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Qe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Xe=ce,Ke=ce,et=ce;function tt(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=f([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=ve.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=ve.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=ve.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=ve.call(this._weekdaysParse,a))||-1!==(i=ve.call(this._shortWeekdaysParse,a))||-1!==(i=ve.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=ve.call(this._shortWeekdaysParse,a))||-1!==(i=ve.call(this._weekdaysParse,a))||-1!==(i=ve.call(this._minWeekdaysParse,a))?i:null:-1!==(i=ve.call(this._minWeekdaysParse,a))||-1!==(i=ve.call(this._weekdaysParse,a))||-1!==(i=ve.call(this._shortWeekdaysParse,a))?i:null}function nt(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=f([2e3,1]).day(t),s=_e(this.weekdaysMin(n,"")),i=_e(this.weekdaysShort(n,"")),r=_e(this.weekdays(n,"")),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);a.sort(e),o.sort(e),u.sort(e),l.sort(e),this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i");}function st(){return this.hours()%12||12}function it(e,t){H(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}));}function rt(e,t){return t._meridiemParse}H("H",["HH",2],0,"hour"),H("h",["hh",2],0,st),H("k",["kk",2],0,(function(){return this.hours()||24})),H("hmm",0,0,(function(){return ""+st.apply(this)+N(this.minutes(),2)})),H("hmmss",0,0,(function(){return ""+st.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)})),H("Hmm",0,0,(function(){return ""+this.hours()+N(this.minutes(),2)})),H("Hmmss",0,0,(function(){return ""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)})),it("a",!0),it("A",!1),V("hour","h"),A("hour",13),fe("a",rt),fe("A",rt),fe("H",ne),fe("h",ne),fe("k",ne),fe("HH",ne,X),fe("hh",ne,X),fe("kk",ne,X),fe("hmm",se),fe("hmmss",ie),fe("Hmm",se),fe("Hmmss",ie),ge(["H","HH"],Se),ge(["k","kk"],(function(e,t,n){var s=z(e);t[Se]=24===s?0:s;})),ge(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e;})),ge(["h","hh"],(function(e,t,n){t[Se]=z(e),m(n).bigHour=!0;})),ge("hmm",(function(e,t,n){var s=e.length-2;t[Se]=z(e.substr(0,s)),t[Ye]=z(e.substr(s)),m(n).bigHour=!0;})),ge("hmmss",(function(e,t,n){var s=e.length-4,i=e.length-2;t[Se]=z(e.substr(0,s)),t[Ye]=z(e.substr(s,2)),t[Oe]=z(e.substr(i)),m(n).bigHour=!0;})),ge("Hmm",(function(e,t,n){var s=e.length-2;t[Se]=z(e.substr(0,s)),t[Ye]=z(e.substr(s));})),ge("Hmmss",(function(e,t,n){var s=e.length-4,i=e.length-2;t[Se]=z(e.substr(0,s)),t[Ye]=z(e.substr(s,2)),t[Oe]=z(e.substr(i));}));var at,ot=$("Hours",!0),ut={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Pe,monthsShort:Re,week:{dow:0,doy:6},weekdays:Be,weekdaysMin:Qe,weekdaysShort:Je,meridiemParse:/[ap]\.?m?\.?/i},lt={},ht={};function dt(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n0;){if(s=ft(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&dt(i,n)>=t-1)break;t--;}r++;}return at}(e)}function gt(e){var t,n=e._a;return n&&-2===m(e).overflow&&(t=n[Me]<0||n[Me]>11?Me:n[De]<1||n[De]>Ne(n[ke],n[Me])?De:n[Se]<0||n[Se]>24||24===n[Se]&&(0!==n[Ye]||0!==n[Oe]||0!==n[be])?Se:n[Ye]<0||n[Ye]>59?Ye:n[Oe]<0||n[Oe]>59?Oe:n[be]<0||n[be]>999?be:-1,m(e)._overflowDayOfYear&&(tDe)&&(t=De),m(e)._overflowWeeks&&-1===t&&(t=xe),m(e)._overflowWeekday&&-1===t&&(t=Te),m(e).overflow=t),e}var pt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,vt=/Z|[+-]\d\d(?::?\d\d)?/,kt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Mt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Dt=/^\/?Date\((-?\d+)/i,St=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Yt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ot(e){var t,n,s,i,r,a,o=e._i,u=pt.exec(o)||wt.exec(o),l=kt.length,h=Mt.length;if(u){for(m(e).iso=!0,t=0,n=l;t7)&&(u=!0)):(r=e._locale._week.dow,a=e._locale._week.doy,l=ze(Ct(),r,a),n=Tt(t.gg,e._a[ke],l.year),s=Tt(t.w,l.week),null!=t.d?((i=t.d)<0||i>6)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||t.e>6)&&(u=!0)):i=r),s<1||s>$e(n,r,a)?m(e)._overflowWeeks=!0:null!=u?m(e)._overflowWeekday=!0:(o=Ze(n,s,i,r,a),e._a[ke]=o.year,e._dayOfYear=o.dayOfYear);}(e),null!=e._dayOfYear&&(a=Tt(e._a[ke],i[ke]),(e._dayOfYear>Ge(a)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),n=Ae(a,0,e._dayOfYear),e._a[Me]=n.getUTCMonth(),e._a[De]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=o[t]=i[t];for(;t<7;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Se]&&0===e._a[Ye]&&0===e._a[Oe]&&0===e._a[be]&&(e._nextDay=!0,e._a[Se]=0),e._d=(e._useUTC?Ae:je).apply(null,o),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Se]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(m(e).weekdayMismatch=!0);}}function Pt(e){if(e._f!==s.ISO_8601)if(e._f!==s.RFC_2822){e._a=[],m(e).empty=!0;var t,n,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(u=(i=F(e._f,e._locale).match(P)||[]).length,t=0;t0&&m(e).unusedInput.push(a),l=l.slice(l.indexOf(n)+n.length),d+=n.length),C[r]?(n?m(e).empty=!1:m(e).unusedTokens.push(r),we(r,n,e)):e._strict&&!n&&m(e).unusedTokens.push(r);m(e).charsLeftOver=h-d,l.length>0&&m(e).unusedInput.push(l),e._a[Se]<=12&&!0===m(e).bigHour&&e._a[Se]>0&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[Se]=function(e,t,n){var s;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0),t):t}(e._locale,e._a[Se],e._meridiem),null!==(o=m(e).era)&&(e._a[ke]=e._locale.erasConvertYear(o,e._a[ke])),Nt(e),gt(e);}else xt(e);else Ot(e);}function Rt(e){var t=e._i,n=e._f;return e._locale=e._locale||yt(e._l),null===t||void 0===n&&""===t?y({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),k(t)?new v(gt(t)):(h(t)?e._d=t:i(n)?function(e){var t,n,s,i,r,a,o=!1,u=e._f.length;if(0===u)return m(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;ithis?this:e:y()}));function Ft(e,t){var n,s;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Ct();for(n=t[0],s=1;s=0?new Date(e+400,t,n)-fn:new Date(e,t,n).valueOf()}function yn(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-fn:Date.UTC(e,t,n)}function gn(e,t){return t.erasAbbrRegex(e)}function pn(){var e,t,n=[],s=[],i=[],r=[],a=this.eras();for(e=0,t=a.length;e(r=$e(e,s,i))&&(t=r),kn.call(this,e,t,n,s,i))}function kn(e,t,n,s,i){var r=Ze(e,t,n,s,i),a=Ae(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}H("N",0,0,"eraAbbr"),H("NN",0,0,"eraAbbr"),H("NNN",0,0,"eraAbbr"),H("NNNN",0,0,"eraName"),H("NNNNN",0,0,"eraNarrow"),H("y",["y",1],"yo","eraYear"),H("y",["yy",2],0,"eraYear"),H("y",["yyy",3],0,"eraYear"),H("y",["yyyy",4],0,"eraYear"),fe("N",gn),fe("NN",gn),fe("NNN",gn),fe("NNNN",(function(e,t){return t.erasNameRegex(e)})),fe("NNNNN",(function(e,t){return t.erasNarrowRegex(e)})),ge(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,n,s){var i=n._locale.erasParse(e,s,n._strict);i?m(n).era=i:m(n).invalidEra=e;})),fe("y",ue),fe("yy",ue),fe("yyy",ue),fe("yyyy",ue),fe("yo",(function(e,t){return t._eraYearOrdinalRegex||ue})),ge(["y","yy","yyy","yyyy"],ke),ge(["yo"],(function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[ke]=n._locale.eraYearOrdinalParse(e,i):t[ke]=parseInt(e,10);})),H(0,["gg",2],0,(function(){return this.weekYear()%100})),H(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),wn("gggg","weekYear"),wn("ggggg","weekYear"),wn("GGGG","isoWeekYear"),wn("GGGGG","isoWeekYear"),V("weekYear","gg"),V("isoWeekYear","GG"),A("weekYear",1),A("isoWeekYear",1),fe("G",le),fe("g",le),fe("GG",ne,X),fe("gg",ne,X),fe("GGGG",ae,ee),fe("gggg",ae,ee),fe("GGGGG",oe,te),fe("ggggg",oe,te),pe(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,s){t[s.substr(0,2)]=z(e);})),pe(["gg","GG"],(function(e,t,n,i){t[i]=s.parseTwoDigitYear(e);})),H("Q",0,"Qo","quarter"),V("quarter","Q"),A("quarter",7),fe("Q",Q),ge("Q",(function(e,t){t[Me]=3*(z(e)-1);})),H("D",["DD",2],"Do","date"),V("date","D"),A("date",9),fe("D",ne),fe("DD",ne,X),fe("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),ge(["D","DD"],De),ge("Do",(function(e,t){t[De]=z(e.match(ne)[0]);}));var Mn=$("Date",!0);H("DDD",["DDDD",3],"DDDo","dayOfYear"),V("dayOfYear","DDD"),A("dayOfYear",4),fe("DDD",re),fe("DDDD",K),ge(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=z(e);})),H("m",["mm",2],0,"minute"),V("minute","m"),A("minute",14),fe("m",ne),fe("mm",ne,X),ge(["m","mm"],Ye);var Dn=$("Minutes",!1);H("s",["ss",2],0,"second"),V("second","s"),A("second",15),fe("s",ne),fe("ss",ne,X),ge(["s","ss"],Oe);var Sn,Yn,On=$("Seconds",!1);for(H("S",0,0,(function(){return ~~(this.millisecond()/100)})),H(0,["SS",2],0,(function(){return ~~(this.millisecond()/10)})),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),H(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),H(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),H(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),H(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),H(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),V("millisecond","ms"),A("millisecond",16),fe("S",re,Q),fe("SS",re,X),fe("SSS",re,K),Sn="SSSS";Sn.length<=9;Sn+="S")fe(Sn,ue);function bn(e,t){t[be]=z(1e3*("0."+e));}for(Sn="S";Sn.length<=9;Sn+="S")ge(Sn,bn);Yn=$("Milliseconds",!1),H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");var xn=v.prototype;function Tn(e){return e}xn.add=tn,xn.calendar=function(e,t){1===arguments.length&&(arguments[0]?rn(arguments[0])?(e=arguments[0],t=void 0):function(e){var t,n=r(e)&&!o(e),s=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;tn.valueOf():n.valueOf()9999?U(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",U(n,"Z")):U(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},xn.inspect=function(){if(!this.isValid())return "moment.invalid(/* "+this._i+" */)";var e,t,n,s="moment",i="";return this.isLocal()||(s=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+s+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(xn[Symbol.for("nodejs.util.inspect.custom")]=function(){return "Moment<"+this.format()+">"}),xn.toJSON=function(){return this.isValid()?this.toISOString():null},xn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},xn.unix=function(){return Math.floor(this.valueOf()/1e3)},xn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},xn.creationData=function(){return {input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},xn.eraName=function(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;ethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},xn.isLocal=function(){return !!this.isValid()&&!this._isUTC},xn.isUtcOffset=function(){return !!this.isValid()&&this._isUTC},xn.isUtc=$t,xn.isUTC=$t,xn.zoneAbbr=function(){return this._isUTC?"UTC":""},xn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},xn.dates=D("dates accessor is deprecated. Use date instead.",Mn),xn.months=D("months accessor is deprecated. Use month instead",Le),xn.years=D("years accessor is deprecated. Use year instead",Ee),xn.zone=D("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),xn.isDSTShifted=D("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!u(this._isDSTShifted))return this._isDSTShifted;var e,t={};return w(t,this),(t=Rt(t))._a?(e=t._isUTC?f(t._a):Ct(t._a),this._isDSTShifted=this.isValid()&&function(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s0):this._isDSTShifted=!1,this._isDSTShifted}));var Nn=T.prototype;function Pn(e,t,n,s){var i=yt(),r=f().set(s,t);return i[n](r,e)}function Rn(e,t,n){if(l(e)&&(t=e,e=void 0),e=e||"",null!=t)return Pn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=Pn(e,s,n,"month");return i}function Wn(e,t,n,s){"boolean"==typeof e?(l(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,l(t)&&(n=t,t=void 0),t=t||"");var i,r=yt(),a=e?r._week.dow:0,o=[];if(null!=n)return Pn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=Pn(t,(i+a)%7,s,"day");return o}Nn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},Nn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(P).map((function(e){return "MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])},Nn.invalidDate=function(){return this._invalidDate},Nn.ordinal=function(e){return this._ordinal.replace("%d",e)},Nn.preparse=Tn,Nn.postformat=Tn,Nn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},Nn.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},Nn.set=function(e){var t,n;for(n in e)a(e,n)&&(b(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source);},Nn.eras=function(e,t){var n,i,r,a=this._eras||yt("en")._eras;for(n=0,i=a.length;n=0)return u[s]},Nn.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?s(e.since).year():s(e.since).year()+(t-e.offset)*n},Nn.erasAbbrRegex=function(e){return a(this,"_erasAbbrRegex")||pn.call(this),e?this._erasAbbrRegex:this._erasRegex},Nn.erasNameRegex=function(e){return a(this,"_erasNameRegex")||pn.call(this),e?this._erasNameRegex:this._erasRegex},Nn.erasNarrowRegex=function(e){return a(this,"_erasNarrowRegex")||pn.call(this),e?this._erasNarrowRegex:this._erasRegex},Nn.months=function(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:i(this._months)?this._months:this._months.standalone},Nn.monthsShort=function(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Nn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return Ue.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=f([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},Nn.monthsRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||Ve.call(this),e?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=He),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},Nn.monthsShortRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||Ve.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ce),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},Nn.week=function(e){return ze(e,this._week.dow,this._week.doy).week},Nn.firstDayOfYear=function(){return this._week.doy},Nn.firstDayOfWeek=function(){return this._week.dow},Nn.weekdays=function(e,t){var n=i(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return !0===e?qe(n,this._week.dow):e?n[e.day()]:n},Nn.weekdaysMin=function(e){return !0===e?qe(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},Nn.weekdaysShort=function(e){return !0===e?qe(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},Nn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return tt.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=f([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},Nn.weekdaysRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Xe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},Nn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ke),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Nn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=et),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Nn.isPM=function(e){return "p"===(e+"").toLowerCase().charAt(0)},Nn.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},mt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===z(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),s.lang=D("moment.lang is deprecated. Use moment.locale instead.",mt),s.langData=D("moment.langData is deprecated. Use moment.localeData instead.",yt);var Cn=Math.abs;function Hn(e,t,n,s){var i=Jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function Un(e){return e<0?Math.floor(e):Math.ceil(e)}function Fn(e){return 4800*e/146097}function Ln(e){return 146097*e/4800}function Vn(e){return function(){return this.as(e)}}var Gn=Vn("ms"),En=Vn("s"),jn=Vn("m"),An=Vn("h"),In=Vn("d"),Zn=Vn("w"),zn=Vn("M"),$n=Vn("Q"),qn=Vn("y");function Bn(e){return function(){return this.isValid()?this._data[e]:NaN}}var Jn=Bn("milliseconds"),Qn=Bn("seconds"),Xn=Bn("minutes"),Kn=Bn("hours"),es=Bn("days"),ts=Bn("months"),ns=Bn("years"),ss=Math.round,is={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rs(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}var as=Math.abs;function os(e){return (e>0)-(e<0)||+e}function us(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o,u=as(this._milliseconds)/1e3,l=as(this._days),h=as(this._months),d=this.asSeconds();return d?(e=Z(u/60),t=Z(e/60),u%=60,e%=60,n=Z(h/12),h%=12,s=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",r=os(this._months)!==os(d)?"-":"",a=os(this._days)!==os(d)?"-":"",o=os(this._milliseconds)!==os(d)?"-":"",i+"P"+(n?r+n+"Y":"")+(h?r+h+"M":"")+(l?a+l+"D":"")+(t||e||u?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(u?o+s+"S":"")):"P0D"}var ls=Vt.prototype;return ls.isValid=function(){return this._isValid},ls.abs=function(){var e=this._data;return this._milliseconds=Cn(this._milliseconds),this._days=Cn(this._days),this._months=Cn(this._months),e.milliseconds=Cn(e.milliseconds),e.seconds=Cn(e.seconds),e.minutes=Cn(e.minutes),e.hours=Cn(e.hours),e.months=Cn(e.months),e.years=Cn(e.years),this},ls.add=function(e,t){return Hn(this,e,t,1)},ls.subtract=function(e,t){return Hn(this,e,t,-1)},ls.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=G(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Fn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Ln(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},ls.asMilliseconds=Gn,ls.asSeconds=En,ls.asMinutes=jn,ls.asHours=An,ls.asDays=In,ls.asWeeks=Zn,ls.asMonths=zn,ls.asQuarters=$n,ls.asYears=qn,ls.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*z(this._months/12):NaN},ls._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return r>=0&&a>=0&&o>=0||r<=0&&a<=0&&o<=0||(r+=864e5*Un(Ln(o)+a),a=0,o=0),u.milliseconds=r%1e3,e=Z(r/1e3),u.seconds=e%60,t=Z(e/60),u.minutes=t%60,n=Z(t/60),u.hours=n%24,a+=Z(n/24),o+=i=Z(Fn(a)),a-=Un(Ln(i)),s=Z(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},ls.clone=function(){return Jt(this)},ls.get=function(e){return e=G(e),this.isValid()?this[e+"s"]():NaN},ls.milliseconds=Jn,ls.seconds=Qn,ls.minutes=Xn,ls.hours=Kn,ls.days=es,ls.weeks=function(){return Z(this.days()/7)},ls.months=ts,ls.years=ns,ls.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,s,i=!1,r=is;return "object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(r=Object.assign({},is,t),null!=t.s&&null==t.ss&&(r.ss=t.s-1)),s=function(e,t,n,s){var i=Jt(e).abs(),r=ss(i.as("s")),a=ss(i.as("m")),o=ss(i.as("h")),u=ss(i.as("d")),l=ss(i.as("M")),h=ss(i.as("w")),d=ss(i.as("y")),c=r<=n.ss&&["s",r]||r0,c[4]=s,rs.apply(null,c)}(this,!i,r,n=this.localeData()),i&&(s=n.pastFuture(+this,s)),n.postformat(s)},ls.toISOString=us,ls.toString=us,ls.toJSON=us,ls.locale=on,ls.localeData=ln,ls.toIsoString=D("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",us),ls.lang=un,H("X",0,0,"unix"),H("x",0,0,"valueOf"),fe("x",le),fe("X",/[+-]?\d+(\.\d{1,3})?/),ge("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e));})),ge("x",(function(e,t,n){n._d=new Date(z(e));})), //! 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>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 _0x5e8124;return __awaiter(this,void 0x0,void 0x0,function*(){let _0x31dbc8=0x64,_0x558bde=-0x1;for(;_0x31dbc8-->0x0;){_0x558bde++;const _0x581a57=_0x558bde>0x0?'\x20('+_0x558bde+').md':'.md',_0x4b0e98=this['getFitFileName'](_0x1907ed,_0x581a57,_0x4d0e35,_0x502f39,_0x4ba158),_0xbbfb79=_0x93b539(_0x4b0e98,_0x581a57);if(!_0xbbfb79)continue;if(_0xbbfb79===_0x116206)return _0xbbfb79;const _0x4c8d6a=yield _0x7e366['getAbstractFileByPath'](_0xbbfb79);if(!(_0x4c8d6a&&_0x4c8d6a instanceof obsidian.TFile))return _0xbbfb79;const _0xe706bf=(null===(_0x5e8124=_0x31a232['getFileCache'](_0x4c8d6a))||void 0x0===_0x5e8124?void 0x0:_0x5e8124['frontmatter'])||{};if(this['isEmptyObj'](_0xe706bf))return _0xbbfb79;for(let _0x772684 of _0x1e2a4b)if(_0xe706bf[_0x772684]===_0x3e8982)return _0xbbfb79;}return '';});}static['getFitFileName'](_0xa3b877,_0x325109,_0x18d227,_0x5a300f,_0x597086){let _0x4c48af=_0x597086['render'](_0x18d227);if(_0x5a300f<=0x0)return _0x4c48af;const _0x111508=_0x325109['length'];let _0x1c7006=_0x4c48af['lastIndexOf']('/'),_0x3dcfd6=_0x4c48af['length']-(_0x1c7006+0x1)+_0x111508-_0x5a300f;return _0x3dcfd6>0x0&&(_0x18d227['title']=this['normalTitle'](_0xa3b877,_0xa3b877['length']-_0x3dcfd6),_0x4c48af=_0x597086['render'](_0x18d227)),this['truncateFileName'](_0x4c48af,_0x111508,_0x5a300f);}static['getPrefxFromAnnoPrefix'](_0x2164c0){if(!_0x2164c0||_0x2164c0['length']<=0x0)return '';let _0x1277de=_0x2164c0['indexOf']('\x20');return _0x1277de>0x0?_0x2164c0['substring'](0x0,_0x1277de+0x1):'';}static['trimWithLine'](_0x202bad){if(!_0x202bad||_0x202bad['length']<=0x0)return '';let _0x284b93=_0x202bad['split']('\x0a'),_0x4847d7=[];if(_0x284b93['length']>0x1){for(let _0x59b14a=0x0;_0x59b14a<_0x284b93['length'];_0x59b14a++){let _0x49e38f=_0x284b93[_0x59b14a]['replace'](/[\s\t]+/,'\x20')['replace'](/[\r\n]+/g,'')['trim']();_0x49e38f['length']>0x0&&_0x4847d7['push'](_0x49e38f);}_0x202bad=_0x4847d7['join']('\x0a');}else _0x202bad=_0x202bad['trim']();return _0x202bad;}static['removeEmojis'](_0x4be55a){if(!_0x4be55a||_0x4be55a['length']<=0x0)return '';return _0x4be55a['replace'](/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/gu,'');}static['normalTitle'](_0x2149e5,_0x5e7f0a=0x0){return _0x2149e5=(_0x2149e5=(_0x2149e5=_0x2149e5||'')['replace'](/[\s\t\n]+/g,'\x20'))['replace'](/[\~\\、\/\*"'<>%\$#&;;:??。,!!\|]/g,''),(_0x2149e5=this['removeEmojis'](_0x2149e5))['length']<=0x0?'No\x20title':_0x5e7f0a>0x0?_0x2149e5['substring'](0x0,_0x5e7f0a):_0x2149e5;}static['isWhiteSpaceForTagParser'](_0x2f422f){return 0xff0c==_0x2f422f||0x3002==_0x2f422f||0xff1b==_0x2f422f||0xff1f==_0x2f422f||(0xa==_0x2f422f||0xd==_0x2f422f||0x20<=_0x2f422f&&_0x2f422f<=0x22||0x24<=_0x2f422f&&_0x2f422f<=0x2c||0x2e==_0x2f422f||0x3a<=_0x2f422f&&_0x2f422f<=0x3f||0x3b==_0x2f422f||0x40==_0x2f422f||0x5b<=_0x2f422f&&_0x2f422f<=0x5e||0x7b<=_0x2f422f&&_0x2f422f<=0x7e||0xff0c==_0x2f422f);}static['convert2backlink'](_0x3ea1b1){if((_0x3ea1b1=_0x3ea1b1||'')['length']<=0x0)return _0x3ea1b1;if(_0x3ea1b1['indexOf']('#')<0x0)return _0x3ea1b1;const _0x4eebcd=_0x3ea1b1['length'];let _0x5947aa=-0x1;const _0x327984=_0x4eebcd-0x1,_0x27ea29=[];for(let _0x38a8c0=0x0;_0x38a8c0<_0x4eebcd;_0x38a8c0++){const _0x107be1=_0x3ea1b1['charCodeAt'](_0x38a8c0),_0x23a1a6=_0x38a8c0==_0x327984,_0x45e4a3=this['isWhiteSpaceForTagParser'](_0x107be1),_0x1059e6=_0x38a8c0-_0x5947aa;0x23===_0x107be1?(_0x5947aa>-0x1&&_0x1059e6>0x1&&_0x27ea29['push']([_0x5947aa,_0x38a8c0]),_0x5947aa=_0x38a8c0):_0x5947aa>-0x1&&(_0x45e4a3||_0x23a1a6)&&_0x1059e6>=0x1&&(_0x23a1a6&&!_0x45e4a3&&_0x1059e6>=0x1?_0x27ea29['push']([_0x5947aa,_0x38a8c0+0x1]):_0x1059e6>0x1&&_0x27ea29['push']([_0x5947aa,_0x38a8c0]),_0x5947aa=-0x1);}if(_0x27ea29['length']<=0x0)return _0x3ea1b1;const _0x22268f=[];let _0x12292a=0x0;for(const _0x4ba3dc of _0x27ea29){const _0x1cf24c=_0x4ba3dc[0x0],_0x364eef=_0x4ba3dc[0x1];_0x1cf24c-_0x12292a>0x0&&_0x22268f['push'](_0x3ea1b1['substring'](_0x12292a,_0x1cf24c)),_0x22268f['push']('[['+_0x3ea1b1['substring'](_0x1cf24c+0x1,_0x364eef)+']]'),_0x12292a=_0x364eef;}return _0x12292a>0x0&&_0x12292a<_0x3ea1b1['length']&&_0x22268f['push'](_0x3ea1b1['substring'](_0x12292a,_0x3ea1b1['length'])),_0x22268f['join']('');}static['gnpfte'](_0x7ddef5){if(!_0x7ddef5||_0x7ddef5['indexOf'](this['noteidxprop'])<0x0)return '';let _0x4c69b2=(_0x7ddef5=_0x7ddef5['trim']())['split']('\x0a')['filter'](_0x16d97f=>_0x16d97f),_0x392fe6=0x0,_0x13cf3f=[];for(let _0x536e7d of _0x4c69b2){if(_0x536e7d=_0x536e7d['trim'](),_0x392fe6>=0x2)break;'---'===_0x536e7d?_0x392fe6++:_0x536e7d&&_0x13cf3f['push'](_0x536e7d['trim']());}return _0x13cf3f=_0x13cf3f['filter'](_0x384941=>{if(!_0x384941)return !0x1;let _0xfc021=_0x384941['split'](':')['map'](_0x78f792=>_0x78f792['trim']());return 0x2===_0xfc021['length']&&(_0xfc021[0x1]=_0xfc021[0x1]['replace'](/['"]/g,''),_0xfc021[0x1]===this['noteidxprop']);})['map'](_0x4cceef=>{let _0x4315e5=_0x4cceef['split'](':')['map'](_0x150e30=>_0x150e30['trim']());return _0x4315e5[0x1]=_0x4315e5[0x1]['replace'](/['"]/g,''),_0x4315e5;}),_0x13cf3f['length']>0x0?_0x13cf3f[0x0][0x0]:'';}static['isIgnoreSync'](_0x30a377,_0x387d80){if(!_0x30a377||this['isEmptyObj'](_0x387d80))return !0x1;const _0x185d64=_0x30a377['split']('::');if(0x2!==_0x185d64['length'])return !0x1;const _0x2cddb9=_0x185d64[0x0]['trim'](),_0x2df725=_0x185d64[0x1]['trim']();if(_0x2cddb9&&_0x2df725&&void 0x0!==_0x387d80[_0x2cddb9]&&'object'!=typeof _0x387d80[_0x2cddb9]){const _0x279395=''+(_0x387d80[_0x2cddb9]||'');if(_0x2df725&&_0x279395===_0x2df725)return !0x0;}return !0x1;}static['isFileExists'](_0x269c4c,_0x43037a){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x117a5c=yield _0x269c4c['getAbstractFileByPath'](_0x43037a);return !!(_0x117a5c&&_0x117a5c instanceof obsidian.TFile);});}static['getNoteIdxByFile'](_0x4b6f8e,_0xed5ea9,_0x49b771,_0x4252ff){var _0x4e3c9c;return __awaiter(this,void 0x0,void 0x0,function*(){if(!_0x49b771||!_0x4252ff||_0x4252ff['length']<=0x0)return '';const _0x3fe3b7=yield _0x4b6f8e['getAbstractFileByPath'](_0x49b771);if(!(_0x3fe3b7&&_0x3fe3b7 instanceof obsidian.TFile))return '';const _0x869c88=(null===(_0x4e3c9c=_0xed5ea9['getFileCache'](_0x3fe3b7))||void 0x0===_0x4e3c9c?void 0x0:_0x4e3c9c['frontmatter'])||{};if(this['isEmptyObj'](_0x869c88))return '';for(let _0x5cf772 of _0x4252ff){const _0x109aa0=_0x869c88[_0x5cf772];if('string'==typeof _0x109aa0&&_0x109aa0&&_0x109aa0['length']>0x0)return _0x109aa0;}return '';});}static['cnfoOl'](_0x2090fc,_0x24c4de,_0x25f0f0){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x41355a=!0x1,_0x3243e7=!0x1;const _0xb8534d=this['getDirFromPath'](_0x25f0f0);if(_0x24c4de&&_0x24c4de!==_0x25f0f0){const _0x3bb315=yield _0x2090fc['getAbstractFileByPath'](_0x24c4de);if(_0x3bb315&&_0x3bb315 instanceof obsidian.TFile){if(_0xb8534d){const _0x4041db=yield _0x2090fc['getAbstractFileByPath'](_0xb8534d);_0x4041db&&_0x4041db instanceof obsidian.TFolder||(yield _0x2090fc['createFolder'](_0xb8534d)),_0x41355a=!0x0;}(yield this['isFileExists'](_0x2090fc,_0x25f0f0))||(yield _0x2090fc['rename'](_0x3bb315,_0x25f0f0)),_0x3243e7=!0x0;}}if(_0x41355a||!_0xb8534d)return _0x3243e7;const _0x3798ed=yield _0x2090fc['getAbstractFileByPath'](_0xb8534d);if(!(_0x3798ed&&_0x3798ed instanceof obsidian.TFile))try{yield _0x2090fc['createFolder'](_0xb8534d);}catch(_0x106184){if(!this['isErrorX'](_0x106184,'already\x20exists'))throw logger({'error':_0x106184}),_0x106184;}return _0x3243e7;});}static['formatTime'](_0x4ad86e,_0x512969='YYYY-MM-DD\x20HH:mm'){if(_0x4ad86e<=0x0)return '';let _0x45c03f=new Date(0x3e8*_0x4ad86e);return this['formatDateTime'](_0x45c03f,_0x512969);}static['isOnlyDateTimeLine'](_0xed0a71){return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/['test'](_0xed0a71)&&!0x0;}static['repeatStr'](_0x6b20b8,_0x5478b8){if(_0x5478b8<=0x0||!_0x6b20b8||_0x6b20b8['length']<=0x0)return '';let _0xc97bf4=[];for(let _0x36d855=0x0;_0x36d855<_0x5478b8;_0x36d855++)_0xc97bf4['push'](_0x6b20b8);return _0xc97bf4['join']('');}static['formatPageNote'](_0x59e325,_0x818644){return _0x818644?_0x59e325||'':this['convert2backlink'](_0x59e325)||'';}static['countAnnoCount'](_0x59ebd4){let _0x315fc6=0x0;if(!_0x59ebd4||_0x59ebd4['length']<=0x0)return 0x0;for(let _0x406d2b of _0x59ebd4)_0x406d2b&&_0x406d2b['annonation']&&_0x315fc6++;return _0x315fc6;}static['isEmptyObj'](_0x270adf){if(!_0x270adf)return !0x0;for(let _0x36d83f in _0x270adf)return !0x1;return !0x0;}static['getRemainData'](_0x382bc3,_0x39d8b1){if(!_0x382bc3||_0x382bc3['length']<=0x0||!_0x39d8b1||this['isEmptyObj'](_0x39d8b1))return;const _0x5d4516=(_0x382bc3||'')['split'](',')['map'](_0x2f41d2=>_0x2f41d2['trim']())['filter'](_0x39fbdc=>_0x39fbdc);if(_0x5d4516['length']<=0x0)return;let _0x3c645b={};for(let _0x9dd075 of _0x5d4516)void 0x0!==_0x39d8b1[_0x9dd075]&&(_0x3c645b[_0x9dd075]=_0x39d8b1[_0x9dd075]);return _0x3c645b;}static['allTagsV2'](_0x5943a6,_0x13fee7){_0x5943a6=_0x5943a6||[],_0x13fee7=_0x13fee7||[];let _0x2dc2df={};for(let _0x21d456 of _0x5943a6)_0x21d456=this['trimTag'](_0x21d456),_0x21d456&&(_0x2dc2df[_0x21d456]=0x1);for(let _0x1d84de of _0x13fee7){let _0x1eadf0=(_0x1d84de['tags']||'')['split'](',')['map'](_0x4fda86=>_0x4fda86['trim']())['filter'](_0x5894d4=>_0x5894d4);for(let _0x526fe2 of _0x1eadf0)_0x526fe2=this['trimTag'](_0x526fe2),_0x526fe2&&(_0x2dc2df[_0x526fe2]=0x1);}return Object['keys'](_0x2dc2df)['sort']();}static['formatNoteLinks'](_0x50255c){if(!_0x50255c||_0x50255c['length']<=0x0||'{}'===_0x50255c)return [];let _0x4036f6=JSON['parse'](_0x50255c),_0x204702=[];for(let _0x1d0767 in _0x4036f6)_0x204702['push']({'url':_0x1d0767,'title':_0x4036f6[_0x1d0767],'_rndstr':''});return _0x204702;}static['joinStr'](_0xa2575a,_0x3b53d0,_0x20f3c0='\x20'){return [_0xa2575a||'',_0x3b53d0||'']['filter'](_0x76a2b3=>_0x76a2b3)['join'](_0x20f3c0);}static['formatHighlights'](_0xe0f9f9,_0xa1c9e3,_0x5c7dff){var _0x273edb,_0x47134c;if(!_0xa1c9e3)return [];const _0x3d576b=0x1===_0x5c7dff['tagStyle'];let _0x3f18a4=[];for(let _0x25b32d of _0xa1c9e3){if(!_0x25b32d)continue;const _0x9f6e1c=_0x25b32d['highlighttype']||0x1;let _0x46a160={'note':_0x25b32d['note']||_0x25b32d['imageUrl']||'','notelinks':this['formatNoteLinks'](_0x25b32d['notelinks']),'imageurl':_0x25b32d['imageUrl'],'updateat_ts':_0x25b32d['updateat'],'createat_ts':_0x25b32d['createat'],'type':this['highlightTypeMaps'][_0x9f6e1c]||'highlight','annotation':_0x25b32d['annonation']||'','color':_0x25b32d['color'],'slotid':_0x25b32d['slotid'],'refid':_0x25b32d['refid'],'refurl':Utils['getHighlightRefUrl'](_0xe0f9f9,_0x25b32d['refurl']||''),'tags':_0x25b32d['tags']||'','remaintags':''};if(_0x46a160['tags']){let _0x428596=_0x46a160['tags']['split'](',')['filter'](_0x475dd3=>_0x475dd3)['map'](_0x5a33a9=>_0x5a33a9['trim']()),_0x1cf5af=[];for(let _0x4e9a32 of _0x428596)(null===(_0x273edb=_0x25b32d['note'])||void 0x0===_0x273edb?void 0x0:_0x273edb['indexOf'](_0x4e9a32))<0x0&&(null===(_0x47134c=_0x25b32d['annonation'])||void 0x0===_0x47134c?void 0x0:_0x47134c['indexOf'](_0x4e9a32))<0x0&&_0x1cf5af['push'](_0x4e9a32);_0x46a160['remaintags']=_0x1cf5af['map'](_0x2b5086=>Utils['formatTag'](_0x2b5086,_0x3d576b))['join']('\x20'),_0x46a160['tags']=_0x428596['map'](_0x31b2cd=>Utils['formatTag'](_0x31b2cd,_0x3d576b))['filter'](_0x548b50=>_0x548b50)['join']('\x20');}_0x3d576b||(_0x46a160['annotation']&&(_0x46a160['annotation']=this['convert2backlink'](_0x46a160['annotation'])),_0x46a160['note']&&(_0x46a160['note']=this['convert2backlink'](_0x46a160['note']))),_0x3f18a4['push'](_0x46a160);}return _0x3f18a4;}static['mergeLinksToNote'](_0x4a4aa4,_0x2903a5){if(!_0x4a4aa4||_0x4a4aa4['length']<=0x0||!_0x2903a5||_0x2903a5['length']<=0x0)return;let _0x33dd0f=0x0;for(let _0x41fb3b of _0x2903a5)_0x41fb3b['_rndstr']='wucailinkbhn69k-'+_0x33dd0f+',',_0x33dd0f++,_0x4a4aa4=_0x4a4aa4['replace'](_0x41fb3b['title'],_0x41fb3b['_rndstr']);for(let _0x39b6fb of _0x2903a5)_0x4a4aa4=_0x4a4aa4['replace'](_0x39b6fb['_rndstr'],'['+_0x39b6fb['title']+']('+_0x39b6fb['url']+')'),_0x39b6fb['_rndstr']='';return _0x4a4aa4;}static['toYAMLList'](_0x36ac07){return !_0x36ac07||_0x36ac07['length']<=0x0?'':'\x0a\x20\x20-\x20'+_0x36ac07['join']('\x0a\x20\x20-\x20');}static['mergeTags'](_0x34e775,_0x566a5b,_0x3f11a7){_0x566a5b=_0x566a5b||'';let _0x106163=(_0x34e775=_0x34e775||[])['concat'](_0x566a5b['split'](','))['map'](_0x2aeee1=>Utils['formatTag'](_0x2aeee1,_0x3f11a7));return this['removeDupAndSort'](_0x106163)['join']('\x20');}static['trimTags'](_0x2c919a,_0xb6501e='\x20'){return _0x2c919a?(_0x2c919a=_0x2c919a||'')['split'](_0xb6501e)['filter'](_0xf4b458=>_0xf4b458)['map'](_0x2da353=>_0x2da353['replace'](/[#\[\]]/g,'')['replace'](/\s+/g,'-'))['filter'](_0x2733a5=>_0x2733a5):[];}static['trimTag'](_0x2c5cc5){return (_0x2c5cc5=(_0x2c5cc5||'')['trim']())['replace'](/[#\[\]]/g,'')['replace'](/\s+/g,'-');}static['formatPageMirror'](_0xfa2bb0){return (_0xfa2bb0=_0xfa2bb0||'')?_0xfa2bb0['replace'](/g1proxy\.nostrabc\.com/g,'g1proxy.wimg.site'):'';}static['removeDupAndSort'](_0x2ba94e){if(!_0x2ba94e||_0x2ba94e['length']<=0x1)return _0x2ba94e;let _0x3f58fe={};for(let _0x4e304c of _0x2ba94e)_0x4e304c&&void 0x0===_0x3f58fe[_0x4e304c]&&(_0x3f58fe[_0x4e304c]=0x1);return Object['keys'](_0x3f58fe)['sort']();}static['formatTag'](_0xb3aa69,_0x28c2b2){if(!(_0xb3aa69=_0xb3aa69['trim']()))return;if(!(_0xb3aa69=_0xb3aa69['replace'](/\s+/g,'-')))return _0xb3aa69;let _0x2e596f='#'===_0xb3aa69[0x0],_0x563958='['===_0xb3aa69[0x0];if(!_0x2e596f&&!_0x563958)return _0x28c2b2?'#'+_0xb3aa69:'[['+_0xb3aa69+']]';if(_0x563958)return _0xb3aa69;if(_0x2e596f&&_0x28c2b2)return _0xb3aa69;let _0x5f255b='';return _0x2e596f&&(_0x5f255b=_0xb3aa69['substring'](0x1)['trim']()),_0x5f255b?'[['+_0x5f255b+']]':'';}static['formatTags'](_0x3fa26f,_0x2422cc){let _0x5711bc=[];return _0x5711bc=(_0x3fa26f=_0x3fa26f||[])['map'](_0x1da33a=>Utils['formatTag'](_0x1da33a,_0x2422cc))['filter'](_0x3d965d=>_0x3d965d),_0x5711bc['join']('\x20');}static['wrapBlock'](_0x40179c,_0x5b1b99,_0x44bf42='\x0a'){return '\x0a%%begin\x20'+_0x5b1b99+'%%\x0a'+_0x40179c+'\x0a%%end\x20'+_0x5b1b99+'%%\x0a';}static['wrapBlockNoBreak'](_0x11d522,_0x46e583){return '%%begin\x20'+_0x46e583+'%%\x0a'+_0x11d522+'\x0a%%end\x20'+_0x46e583+'%%';}static['renderTemplate'](_0x5b9f7c,_0x4dfa9a){return _0x4dfa9a['pageEngine']['render'](_0x5b9f7c);}static['renderTemplateWithEditable'](_0xaa5a43,_0x5766ab,_0x5ee355){let _0x3855c6={};if(_0x5ee355['blocks']['pagenote']){let _0x13727e=_0x5ee355['pagenoteEngine']['render'](_0xaa5a43);_0x13727e&&(_0x3855c6['pagenote']=_0x13727e);}if(_0x5ee355['blocks']['highlights']){let _0xdcbb6c=_0x5ee355['highlightsEngine']['render'](_0xaa5a43);_0xdcbb6c&&(_0x3855c6['highlights']=_0xdcbb6c);}if(_0x5ee355['blocks']['mdcontent']){let _0x1da319=_0x5ee355['mdcontentEngine']['render'](_0xaa5a43);_0x1da319&&(_0x3855c6['mdcontent']=_0x1da319);}return this['replaceHolders'](_0x5766ab,_0x3855c6);}static['getDirFromPath'](_0x225e22){if(!_0x225e22)return '';const _0x45e145=_0x225e22['lastIndexOf']('/');return _0x45e145<=0x0?'':_0x225e22['substring'](0x0,_0x45e145);}static['getDomain'](_0x5225b5){if(!_0x5225b5)return '';/^www\./['test'](_0x5225b5)&&(_0x5225b5='https://'+_0x5225b5);try{let _0x4c75c7=new URL(_0x5225b5);return _0x4c75c7?_0x4c75c7['hostname']['toLocaleLowerCase']():'';}catch(_0x1093ea){return '';}}static['getDomain2'](_0x325370){if(!_0x325370||_0x325370['length']<=0x0)return '';let _0x240c54=_0x325370['split']('.');const _0x275660=_0x240c54['length'];return _0x275660<=0x2?_0x325370:_0x240c54[_0x275660-0x2]+'.'+_0x240c54[_0x275660-0x1];}static['isMardownFormat'](_0x3b5c8d){return !(!_0x3b5c8d||_0x3b5c8d['length']<=0x0)&&(!!(/^- \[[ x]\] +/['test'](_0x3b5c8d)&&_0x3b5c8d['indexOf']('\x0a')<0x0)||!(!/^\`\`\`/['test'](_0x3b5c8d)||!/\`\`\`\s*$/['test'](_0x3b5c8d)));}static['getNoteIdxFromFilePath'](_0x34fa3d){if(!_0x34fa3d||_0x34fa3d['length']<=0x0)return '';if(!/-([a-z0-9_]+)\.md$/i['test'](_0x34fa3d))return '';const _0x1eb5f1=_0x34fa3d['lastIndexOf']('-');return _0x1eb5f1<0x0?'':_0x34fa3d['substring'](_0x1eb5f1+0x1,_0x34fa3d['length']-0x3);}static['getHighlightRefUrl'](_0x20a16a,_0x4168c3){if(!_0x4168c3)return _0x20a16a;let _0x1bc941='';if(_0x4168c3['indexOf']('#')>=0x0&&(_0x1bc941=_0x4168c3['split']('-')[0x1]),!_0x1bc941)return _0x20a16a;let _0xd17436=_0x20a16a['indexOf']('#');if(_0xd17436<0x0)return _0x20a16a+('#WCREFX-'+_0x1bc941);let _0x49c686=_0x20a16a['substring'](_0xd17436+0x1);if(!_0x49c686)return (_0x20a16a=_0x20a16a['substring'](0x0,_0xd17436))+('#WCREFX-'+_0x1bc941);if(_0x20a16a['indexOf']('WCREFX-')>0x0)return _0x20a16a['replace'](/WCREFX-([a-z\d]+)/g,'WCREFX-'+_0x1bc941);if(_0x49c686['indexOf']('/')>=0x0||_0x49c686['indexOf']('?')>=0x0){if(_0x49c686['indexOf']('?')>=0x0||_0x49c686['indexOf']('=')>=0x0){let _0x1f427e=encodeURIComponent('WCREFX-'+_0x1bc941);return (_0x20a16a=_0x20a16a['replace'](/&+$/,''))+'&wucairefx='+_0x1f427e;}return _0x20a16a;}return _0x20a16a['substring'](0x0,_0xd17436)+('#WCREFX-'+_0x1bc941);}static['isErrorX'](_0x9625e1,_0x47c2c7){return !(!_0x9625e1||!_0x47c2c7)&&(_0x9625e1&&_0x9625e1['message']&&_0x9625e1['message']['indexOf'](_0x47c2c7)>=0x0);}static['getRegionFromToken'](_0x2d85b5){const _0x50da9f=(_0x2d85b5||'')['trim']();if(!_0x50da9f)return '';const _0x36f1b0=_0x50da9f['split']('.');if(0x2!==_0x36f1b0['length'])return '';let _0x21e89c=_0x36f1b0[0x0]||'';if(!_0x21e89c)return '';_0x21e89c=_0x21e89c['replaceAll']('%3D','='),_0x21e89c=_0x21e89c['replaceAll']('%3d','=');const _0x4dcb50=decode(_0x21e89c);if(!_0x4dcb50)return '';try{const _0xf8495d=JSON['parse'](_0x4dcb50);if(_0xf8495d)return _0xf8495d['rgn']||'chn';}catch(_0x46bb94){}return '';}static['getPageMirror'](_0x1ff2a0){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x4b8cd5=yield fetch(_0x1ff2a0,{'method':'GET'});return _0x4b8cd5&&0xc8===_0x4b8cd5['status']&&_0x4b8cd5['ok']?new Promise((_0x2dafa9,_0x1eb76f)=>{try{_0x4b8cd5['text']()['then'](_0x520332=>{if(!_0x520332||_0x520332['length']<=0x0)return '';let _0x18f7d6=_0x520332['indexOf'](':');if(_0x18f7d6<=0x0)return void _0x2dafa9('');let _0x22a2a2=parseInt(_0x520332['substring'](0x0,_0x18f7d6));_0x2dafa9(_0x520332['substring'](_0x22a2a2+_0x18f7d6+0x1));})['catch'](_0x49094c=>{_0x2dafa9('');});}catch(_0x392524){_0x2dafa9('');}}):new Promise((_0x50b98d,_0x224beb)=>{_0x50b98d('');});});}}Utils['allowedBlock']=['highlights','pagenote'],Utils['fetchBlocksRegExp']=new RegExp('\x5c{%\x5cs*block\x5cs+([a-z0-9-_]+)\x5cs*%\x5c}[\x5cs\x5cS]*?\x5c{%\x5cs*endblock\x5cs*%\x5c}','ig'),Utils['blocksRegExpMap']={'highlights':new RegExp('\x5c{%\x5cs*block\x5cs+highlights\x5cs*%\x5c}[\x5cs\x5cS]*?\x5c{%\x5cs*endblock\x5cs*%\x5c}','img'),'pagenote':new RegExp('\x5c{%\x5cs*block\x5cs+pagenote\x5cs*%\x5c}[\x5cs\x5cS]*?\x5c{%\x5cs*endblock\x5cs*%\x5c}','img'),'mdcontent':new RegExp('\x5c{%\x5cs*block\x5cs+mdcontent\x5cs*%\x5c}[\x5cs\x5cS]*?\x5c{%\x5cs*endblock\x5cs*%\x5c}','img')},Utils['holdersRegExpMap']={'highlights':new RegExp('(%%\x5cs*begin\x5cs+highlights\x5cs*%%([\x5cs\x5cS]*?)%%\x5cs*end\x5cs+highlights\x5cs*%%)','ig'),'pagenote':new RegExp('(%%\x5cs*begin\x5cs+pagenote\x5cs*%%([\x5cs\x5cS]*?)%%\x5cs*end\x5cs+pagenote\x5cs*%%)','ig'),'mdcontent':new RegExp('(%%\x5cs*begin\x5cs+mdcontent\x5cs*%%([\x5cs\x5cS]*?)%%\x5cs*end\x5cs+mdcontent\x5cs*%%)','ig')},Utils['noteidxprop']='{{noteid}}',Utils['highlightTypeMaps']={0x1:'highlight',0x2:'image',0x3:'math',0x4:'quote'}; 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={"&":"&",'"':""","'":"'","<":"<",">":">","\\":"\"},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;ie.length)s=r.slice(0,e.length),r.slice(s.length,l).forEach((function(e,n){n2?r-2:0),s=2;s0||!n)&&process.stdout.write(" ".repeat(t));var o=r===i.length-1?"":"\n";process.stdout.write(""+e+o);}));}e.exports={Node:c,Root:h,NodeList:u,Value:l,Literal:f,Symbol:p,Group:m,Array:d,Pair:v,Dict:_,Output:D,Capture:U,TemplateData:V,If:g,IfAsync:b,InlineIf:k,For:E,AsyncEach:w,AsyncAll:x,Macro:O,Caller:L,Import:T,FromImport:S,FunCall:A,Filter:N,FilterAsync:C,KeywordArgs:B,Block:F,Super:j,Extends:R,Include:P,Set:K,Switch:I,Case:M,LookupVal:y,BinOp:W,In:H,Is:Y,Or:$,And:q,Not:z,Add:J,Concat:X,Sub:Q,Mul:Z,Div:ee,FloorDiv:te,Mod:ne,Pow:ie,Neg:re,Pos:oe,Compare:se,CompareOperand:ae,CallExtension:ce,CallExtensionAsync:le,printNodes:function e(t,n){if(n=n||0,ue(t.typename+": ",n),t instanceof u)ue("\n"),t.children.forEach((function(t){e(t,n+2);}));else if(t instanceof ce)ue(t.extName+"."+t.prop+"\n"),t.args&&e(t.args,n+2),t.contentArgs&&t.contentArgs.forEach((function(t){e(t,n+2);}));else {var i=[],r=null;t.iterFields((function(e,t){e instanceof c?i.push([t,e]):(r=r||{})[t]=e;})),r?ue(JSON.stringify(r,null,2)+"\n",null,!0):ue("\n"),i.forEach((function(t){var i=t[0],r=t[1];ue("["+i+"] =>",n+2),e(r,n+4);}));}}};},function(e,t){},function(e,t,n){function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var r=n(8),o=n(17),s=n(3),a=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},h=function(e){var t,n;function r(){return e.apply(this,arguments)||this}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var o=r.prototype;return o.init=function(e,t){this.templateName=e,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=t;},o.fail=function(e,t,n){throw void 0!==t&&(t+=1),void 0!==n&&(n+=1),new a(e,t,n)},o._pushBuffer=function(){var e=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=e,this._emit("var "+this.buffer+' = "";'),e},o._popBuffer=function(){this.buffer=this.bufferStack.pop();},o._emit=function(e){this.codebuf.push(e);},o._emitLine=function(e){this._emit(e+"\n");},o._emitLines=function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i0&&r._emit(","),r.compile(e,t);})),i&&this._emit(i);},o._compileExpression=function(e,t){this.assertType(e,s.Literal,s.Symbol,s.Group,s.Array,s.Dict,s.FunCall,s.Caller,s.Filter,s.LookupVal,s.Compare,s.InlineIf,s.In,s.Is,s.And,s.Or,s.Not,s.Add,s.Concat,s.Sub,s.Mul,s.Div,s.FloorDiv,s.Mod,s.Pow,s.Neg,s.Pos,s.Compare,s.NodeList),this.compile(e,t);},o.assertType=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i0&&i._emit(","),e){i._emitLine("function(cb) {"),i._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var r=i._pushBuffer();i._withScopedSyntax((function(){i.compile(e,t),i._emitLine("cb(null, "+r+");");})),i._popBuffer(),i._emitLine("return "+r+";"),i._emitLine("}");}else i._emit("null");})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+a+" && env.opts.autoescape);"),this._addScopeLevel();}else this._emit(")"),this._emit(", "+a+" && env.opts.autoescape);\n");},o.compileCallExtensionAsync=function(e,t){this.compileCallExtension(e,t,!0);},o.compileNodeList=function(e,t){this._compileChildren(e,t);},o.compileLiteral=function(e){if("string"==typeof e.value){var t=e.value.replace(/\\/g,"\\\\");t=(t=(t=(t=(t=t.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+t+'"');}else null===e.value?this._emit("null"):this._emit(e.value.toString());},o.compileSymbol=function(e,t){var n=e.value,i=t.lookup(n);i?this._emit(i):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")');},o.compileGroup=function(e,t){this._compileAggregate(e,t,"(",")");},o.compileArray=function(e,t){this._compileAggregate(e,t,"[","]");},o.compileDict=function(e,t){this._compileAggregate(e,t,"{","}");},o.compilePair=function(e,t){var n=e.key,i=e.value;n instanceof s.Symbol?n=new s.Literal(n.lineno,n.colno,n.value):n instanceof s.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,t),this._emit(": "),this._compileExpression(i,t);},o.compileInlineIf=function(e,t){this._emit("("),this.compile(e.cond,t),this._emit("?"),this.compile(e.body,t),this._emit(":"),null!==e.else_?this.compile(e.else_,t):this._emit('""'),this._emit(")");},o.compileIn=function(e,t){this._emit("runtime.inOperator("),this.compile(e.left,t),this._emit(","),this.compile(e.right,t),this._emit(")");},o.compileIs=function(e,t){var n=e.right.name?e.right.name.value:e.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(e.left,t),e.right.args&&(this._emit(","),this.compile(e.right.args,t)),this._emit(") === true");},o._binOpEmitter=function(e,t,n){this.compile(e.left,t),this._emit(n),this.compile(e.right,t);},o.compileOr=function(e,t){return this._binOpEmitter(e,t," || ")},o.compileAnd=function(e,t){return this._binOpEmitter(e,t," && ")},o.compileAdd=function(e,t){return this._binOpEmitter(e,t," + ")},o.compileConcat=function(e,t){return this._binOpEmitter(e,t,' + "" + ')},o.compileSub=function(e,t){return this._binOpEmitter(e,t," - ")},o.compileMul=function(e,t){return this._binOpEmitter(e,t," * ")},o.compileDiv=function(e,t){return this._binOpEmitter(e,t," / ")},o.compileMod=function(e,t){return this._binOpEmitter(e,t," % ")},o.compileNot=function(e,t){this._emit("!"),this.compile(e.target,t);},o.compileFloorDiv=function(e,t){this._emit("Math.floor("),this.compile(e.left,t),this._emit(" / "),this.compile(e.right,t),this._emit(")");},o.compilePow=function(e,t){this._emit("Math.pow("),this.compile(e.left,t),this._emit(", "),this.compile(e.right,t),this._emit(")");},o.compileNeg=function(e,t){this._emit("-"),this.compile(e.target,t);},o.compilePos=function(e,t){this._emit("+"),this.compile(e.target,t);},o.compileCompare=function(e,t){var n=this;this.compile(e.expr,t),e.ops.forEach((function(e){n._emit(" "+u[e.type]+" "),n.compile(e.expr,t);}));},o.compileLookupVal=function(e,t){this._emit("runtime.memberLookup(("),this._compileExpression(e.target,t),this._emit("),"),this._compileExpression(e.val,t),this._emit(")");},o._getNodeName=function(e){switch(e.typename){case"Symbol":return e.value;case"FunCall":return "the return value of ("+this._getNodeName(e.name)+")";case"LookupVal":return this._getNodeName(e.target)+'["'+this._getNodeName(e.val)+'"]';case"Literal":return e.value.toString();default:return "--expression--"}},o.compileFunCall=function(e,t){this._emit("(lineno = "+e.lineno+", colno = "+e.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(e.name,t),this._emit(', "'+this._getNodeName(e.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(e.args,t,"[","])"),this._emit(")");},o.compileFilter=function(e,t){var n=e.name;this.assertType(n,s.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emit(")");},o.compileFilterAsync=function(e,t){var n=e.name,i=e.symbol.value;this.assertType(n,s.Symbol),t.set(i,i),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emitLine(", "+this._makeCallback(i)),this._addScopeLevel();},o.compileKeywordArgs=function(e,t){this._emit("runtime.makeKeywordArgs("),this.compileDict(e,t),this._emit(")");},o.compileSet=function(e,t){var n=this,i=[];e.targets.forEach((function(e){var r=e.value,o=t.lookup(r);null==o&&(o=n._tmpid(),n._emitLine("var "+o+";")),i.push(o);})),e.value?(this._emit(i.join(" = ")+" = "),this._compileExpression(e.value,t),this._emitLine(";")):(this._emit(i.join(" = ")+" = "),this.compile(e.body,t),this._emitLine(";")),e.targets.forEach((function(e,t){var r=i[t],o=e.value;n._emitLine('frame.set("'+o+'", '+r+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+o+'", '+r+");"),n._emitLine("}"),"_"!==o.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+o+'", '+r+");"),n._emitLine("}"));}));},o.compileSwitch=function(e,t){var n=this;this._emit("switch ("),this.compile(e.expr,t),this._emit(") {"),e.cases.forEach((function(e,i){n._emit("case "),n.compile(e.cond,t),n._emit(": "),n.compile(e.body,t),e.body.children.length&&n._emitLine("break;");})),e.default&&(this._emit("default:"),this.compile(e.default,t)),this._emit("}");},o.compileIf=function(e,t,n){var i=this;this._emit("if("),this._compileExpression(e.cond,t),this._emitLine(") {"),this._withScopedSyntax((function(){i.compile(e.body,t),n&&i._emit("cb()");})),e.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){i.compile(e.else_,t),n&&i._emit("cb()");}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}");},o.compileIfAsync=function(e,t){this._emit("(function(cb) {"),this.compileIf(e,t,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel();},o._emitLoopBindings=function(e,t,n,i){var r=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:i+" - "+n},{name:"revindex0",val:i+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+i+" - 1"},{name:"length",val:i}].forEach((function(e){r._emitLine('frame.set("loop.'+e.name+'", '+e.val+");");}));},o.compileFor=function(e,t){var n=this,i=this._tmpid(),r=this._tmpid(),o=this._tmpid();if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+o+" = "),this._compileExpression(e.arr,t),this._emitLine(";"),this._emit("if("+o+") {"),this._emitLine(o+" = runtime.fromIterator("+o+");"),e.name instanceof s.Array){this._emitLine("var "+i+";"),this._emitLine("if(runtime.isArray("+o+")) {"),this._emitLine("var "+r+" = "+o+".length;"),this._emitLine("for("+i+"=0; "+i+" < "+o+".length; "+i+"++) {"),e.name.children.forEach((function(r,s){var a=n._tmpid();n._emitLine("var "+a+" = "+o+"["+i+"]["+s+"];"),n._emitLine('frame.set("'+r+'", '+o+"["+i+"]["+s+"]);"),t.set(e.name.children[s].value,a);})),this._emitLoopBindings(e,o,i,r),this._withScopedSyntax((function(){n.compile(e.body,t);})),this._emitLine("}"),this._emitLine("} else {");var a=e.name.children,c=a[0],l=a[1],u=this._tmpid(),h=this._tmpid();t.set(c.value,u),t.set(l.value,h),this._emitLine(i+" = -1;"),this._emitLine("var "+r+" = runtime.keys("+o+").length;"),this._emitLine("for(var "+u+" in "+o+") {"),this._emitLine(i+"++;"),this._emitLine("var "+h+" = "+o+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+h+");"),this._emitLoopBindings(e,o,i,r),this._withScopedSyntax((function(){n.compile(e.body,t);})),this._emitLine("}"),this._emitLine("}");}else {var f=this._tmpid();t.set(e.name.value,f),this._emitLine("var "+r+" = "+o+".length;"),this._emitLine("for(var "+i+"=0; "+i+" < "+o+".length; "+i+"++) {"),this._emitLine("var "+f+" = "+o+"["+i+"];"),this._emitLine('frame.set("'+e.name.value+'", '+f+");"),this._emitLoopBindings(e,o,i,r),this._withScopedSyntax((function(){n.compile(e.body,t);})),this._emitLine("}");}this._emitLine("}"),e.else_&&(this._emitLine("if (!"+r+") {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();");},o._compileAsyncLoop=function(e,t,n){var i=this,r=this._tmpid(),o=this._tmpid(),a=this._tmpid(),c=n?"asyncAll":"asyncEach";if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = runtime.fromIterator("),this._compileExpression(e.arr,t),this._emitLine(");"),e.name instanceof s.Array){var l=e.name.children.length;this._emit("runtime."+c+"("+a+", "+l+", function("),e.name.children.forEach((function(e){i._emit(e.value+",");})),this._emit(r+","+o+",next) {"),e.name.children.forEach((function(e){var n=e.value;t.set(n,n),i._emitLine('frame.set("'+n+'", '+n+");");}));}else {var u=e.name.value;this._emitLine("runtime."+c+"("+a+", 1, function("+u+", "+r+", "+o+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),t.set(u,u);}this._emitLoopBindings(e,a,r,o),this._withScopedSyntax((function(){var o;n&&(o=i._pushBuffer()),i.compile(e.body,t),i._emitLine("next("+r+(o?","+o:"")+");"),n&&i._popBuffer();}));var h=this._tmpid();this._emitLine("}, "+this._makeCallback(h)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+h+";"),e.else_&&(this._emitLine("if (!"+a+".length) {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();");},o.compileAsyncEach=function(e,t){this._compileAsyncLoop(e,t);},o.compileAsyncAll=function(e,t){this._compileAsyncLoop(e,t,!0);},o._compileMacro=function(e,t){var n=this,i=[],r=null,o="macro_"+this._tmpid(),a=void 0!==t;e.args.children.forEach((function(t,o){o===e.args.children.length-1&&t instanceof s.Dict?r=t:(n.assertType(t,s.Symbol),i.push(t));}));var l,u=[].concat(i.map((function(e){return "l_"+e.value})),["kwargs"]),h=i.map((function(e){return '"'+e.value+'"'})),f=(r&&r.children||[]).map((function(e){return '"'+e.key.value+'"'}));l=a?t.push(!0):new c,this._emitLines("var "+o+" = runtime.makeMacro(","["+h.join(", ")+"], ","["+f.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(a?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),i.forEach((function(e){n._emitLine('frame.set("'+e.value+'", l_'+e.value+");"),l.set(e.value,"l_"+e.value);})),r&&r.children.forEach((function(e){var t=e.key.value;n._emit('frame.set("'+t+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+t+'")'),n._emit(' ? kwargs["'+t+'"] : '),n._compileExpression(e.value,l),n._emit(");");}));var p=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(e.body,l);})),this._emitLine("frame = "+(a?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+p+");"),this._emitLine("});"),this._popBuffer(),o},o.compileMacro=function(e,t){var n=this._compileMacro(e),i=e.name.value;t.set(i,n),t.parent?this._emitLine('frame.set("'+i+'", '+n+");"):("_"!==e.name.value.charAt(0)&&this._emitLine('context.addExport("'+i+'");'),this._emitLine('context.setVariable("'+i+'", '+n+");"));},o.compileCaller=function(e,t){this._emit("(function (){");var n=this._compileMacro(e,t);this._emit("return "+n+";})()");},o._compileGetTemplate=function(e,t,n,i){var r=this._tmpid(),o=this._templateName(),s=this._makeCallback(r),a=n?"true":"false",c=i?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(e.template,t),this._emitLine(", "+a+", "+o+", "+c+", "+s),r},o.compileImport=function(e,t){var n=e.target.value,i=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(i+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(i)),this._addScopeLevel(),t.set(n,i),t.parent?this._emitLine('frame.set("'+n+'", '+i+");"):this._emitLine('context.setVariable("'+n+'", '+i+");");},o.compileFromImport=function(e,t){var n=this,i=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(i+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(i)),this._addScopeLevel(),e.names.children.forEach((function(e){var r,o,a=n._tmpid();e instanceof s.Pair?(r=e.key.value,o=e.value.value):o=r=e.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+i+', "'+r+'")) {'),n._emitLine("var "+a+" = "+i+"."+r+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+r+"'\")); return;"),n._emitLine("}"),t.set(o,a),t.parent?n._emitLine('frame.set("'+o+'", '+a+");"):n._emitLine('context.setVariable("'+o+'", '+a+");");}));},o.compileBlock=function(e){var t=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+e.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(t)),this._emitLine(this.buffer+" += "+t+";"),this._addScopeLevel();},o.compileSuper=function(e,t){var n=e.blockName.value,i=e.symbol.value,r=this._makeCallback(i);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+r),this._emitLine(i+" = runtime.markSafe("+i+");"),this._addScopeLevel(),t.set(i,i);},o.compileExtends=function(e,t){var n=this._tmpid(),i=this._compileGetTemplate(e,t,!0,!1);this._emitLine("parentTemplate = "+i),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel();},o.compileInclude=function(e,t){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(e,t,!1,e.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var i=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(i)),this._emitLine("callback(null,"+i+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel();},o.compileTemplateData=function(e,t){this.compileLiteral(e,t);},o.compileCapture=function(e,t){var n=this,i=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(e.body,t);})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=i;},o.compileOutput=function(e,t){var n=this;e.children.forEach((function(i){i instanceof s.TemplateData?i.value&&(n._emit(n.buffer+" += "),n.compileLiteral(i,t),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(i,t),n.throwOnUndefined&&n._emit(","+e.lineno+","+e.colno+")"),n._emit(", env.opts.autoescape);\n"));}));},o.compileRoot=function(e,t){var n=this;t&&this.fail("compileRoot: root node can't have frame"),t=new c,this._emitFuncBegin(e,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(e,t),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var i=[],r=e.findAll(s.Block);r.forEach((function(e,t){var r=e.name.value;if(-1!==i.indexOf(r))throw new Error('Block "'+r+'" defined more than once.');i.push(r),n._emitFuncBegin(e,"b_"+r);var o=new c;n._emitLine("var frame = frame.push(true);"),n.compile(e.body,o),n._emitFuncEnd();})),this._emitLine("return {"),r.forEach((function(e,t){var i="b_"+e.name.value;n._emitLine(i+": "+i+",");})),this._emitLine("root: root\n};");},o.compile=function(e,t){var n=this["compile"+e.typename];n?n.call(this,e,t):this.fail("compile: Cannot compile node: "+e.typename,e.lineno,e.colno);},o.getCode=function(){return this.codebuf.join("")},r}(l);e.exports={compile:function(e,t,n,i,s){void 0===s&&(s={});var a=new h(i,s.throwOnUndefined),c=(n||[]).map((function(e){return e.preprocess})).filter((function(e){return !!e})).reduce((function(e,t){return t(e)}),e);return a.compile(o.transform(r.parse(c,n,s),t,i)),a.getCode()},Compiler:h};},function(e,t,n){function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var r=n(4),o=n(1).EmitterObj;e.exports=function(e){var t,n;function o(){return e.apply(this,arguments)||this}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var s=o.prototype;return s.resolve=function(e,t){return r.resolve(r.dirname(e),t)},s.isRelative=function(e){return 0===e.indexOf("./")||0===e.indexOf("../")},o}(o);},function(e,t,n){function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t);}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}var o=n(12),s=n(15),a=n(0),c=n(5),l=n(18),u=n(10),h=u.FileSystemLoader,f=u.WebLoader,p=u.PrecompiledLoader,m=n(20),d=n(21),v=n(1),_=v.Obj,y=v.EmitterObj,g=n(2),b=g.handleError,k=g.Frame,E=n(22);function w(e,t,n){o((function(){e(t,n);}));}var x={type:"code",obj:{root:function(e,t,n,i,r){try{r(null,"");}catch(e){r(b(e,null,null));}}}},O=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(e,t){var n=this;t=this.opts=t||{},this.opts.dev=!!t.dev,this.opts.autoescape=null==t.autoescape||t.autoescape,this.opts.throwOnUndefined=!!t.throwOnUndefined,this.opts.trimBlocks=!!t.trimBlocks,this.opts.lstripBlocks=!!t.lstripBlocks,this.loaders=[],e?this.loaders=a.isArray(e)?e:[e]:h?this.loaders=[new h("views")]:f&&(this.loaders=[new f("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new p(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=d(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],a._entries(l).forEach((function(e){var t=e[0],i=e[1];return n.addFilter(t,i)})),a._entries(m).forEach((function(e){var t=e[0],i=e[1];return n.addTest(t,i)}));},n._initLoaders=function(){var e=this;this.loaders.forEach((function(t){t.cache={},"function"==typeof t.on&&(t.on("update",(function(n,i){t.cache[n]=null,e.emit("update",n,i,t);})),t.on("load",(function(n,i){e.emit("load",n,i,t);})));}));},n.invalidateCache=function(){this.loaders.forEach((function(e){e.cache={};}));},n.addExtension=function(e,t){return t.__name=e,this.extensions[e]=t,this.extensionsList.push(t),this},n.removeExtension=function(e){var t=this.getExtension(e);t&&(this.extensionsList=a.without(this.extensionsList,t),delete this.extensions[e]);},n.getExtension=function(e){return this.extensions[e]},n.hasExtension=function(e){return !!this.extensions[e]},n.addGlobal=function(e,t){return this.globals[e]=t,this},n.getGlobal=function(e){if(void 0===this.globals[e])throw new Error("global not found: "+e);return this.globals[e]},n.addFilter=function(e,t,n){var i=t;return n&&this.asyncFilters.push(e),this.filters[e]=i,this},n.getFilter=function(e){if(!this.filters[e])throw new Error("filter not found: "+e);return this.filters[e]},n.addTest=function(e,t){return this.tests[e]=t,this},n.getTest=function(e){if(!this.tests[e])throw new Error("test not found: "+e);return this.tests[e]},n.resolveTemplate=function(e,t,n){return e.isRelative&&t&&e.isRelative(n)&&e.resolve?e.resolve(t,n):n},n.getTemplate=function(e,t,n,i,r){var o,s=this,c=this,l=null;if(e&&e.raw&&(e=e.raw),a.isFunction(n)&&(r=n,n=null,t=t||!1),a.isFunction(t)&&(r=t,t=!1),e instanceof T)l=e;else {if("string"!=typeof e)throw new Error("template names must be a string: "+e);for(var u=0;u0&&!this.skip(r.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",e.lineno,e.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var c=this.parsePrimary();i.addChild(new o.Pair(a.lineno,a.colno,a,c));}else i.addChild(a);n=this.parseWithContext();}return new o.FromImport(e.lineno,e.colno,t,i,n)},c.parseBlock=function(){var e=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",e.lineno,e.colno);var t=new o.Block(e.lineno,e.colno);t.name=this.parsePrimary(),t.name instanceof o.Symbol||this.fail("parseBlock: variable name expected",e.lineno,e.colno),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(t.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),t},c.parseExtends=function(){var e="extends",t=this.peekToken();this.skipSymbol(e)||this.fail("parseTemplateRef: expected "+e);var n=new o.Extends(t.lineno,t.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(t.value),n},c.parseInclude=function(){var e="include",t=this.peekToken();this.skipSymbol(e)||this.fail("parseInclude: expected "+e);var n=new o.Include(t.lineno,t.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(t.value),n},c.parseIf=function(){var e,t=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?e=new o.If(t.lineno,t.colno):this.skipSymbol("ifAsync")?e=new o.IfAsync(t.lineno,t.colno):this.fail("parseIf: expected if, elif, or elseif",t.lineno,t.colno),e.cond=this.parseExpression(),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":e.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),e.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":e.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file");}return e},c.parseSet=function(){var e=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",e.lineno,e.colno);for(var t,n=new o.Set(e.lineno,e.colno,[]);(t=this.parsePrimary())&&(n.targets.push(t),this.skip(r.TOKEN_COMMA)););return this.skipValue(r.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(e.value)):this.skip(r.TOKEN_BLOCK_END)?(n.body=new o.Capture(e.lineno,e.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",e.lineno,e.colno),n},c.parseSwitch=function(){var e="switch",t="endswitch",n="case",i="default",r=this.peekToken();this.skipSymbol(e)||this.skipSymbol(n)||this.skipSymbol(i)||this.fail('parseSwitch: expected "switch," "case" or "default"',r.lineno,r.colno);var s=this.parseExpression();this.advanceAfterBlockEnd(e),this.parseUntilBlocks(n,i,t);var a,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(e);var h=this.parseUntilBlocks(n,i,t);l.push(new o.Case(c.line,c.col,u,h)),c=this.peekToken();}while(c&&c.value===n);switch(c.value){case i:this.advanceAfterBlockEnd(),a=this.parseUntilBlocks(t),this.advanceAfterBlockEnd();break;case t:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.');}return new o.Switch(r.lineno,r.colno,s,l,a)},c.parseStatement=function(){var e=this.peekToken();if(e.type!==r.TOKEN_SYMBOL&&this.fail("tag name expected",e.lineno,e.colno),this.breakOnBlocks&&-1!==a.indexOf(this.breakOnBlocks,e.value))return null;switch(e.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var t=0;t0;){var c=s[0],l=s[1],u=s[2];u===e?i+=1:u===t&&(i-=1),0===i?(r+=l,this.tokens.backN(c.length-l.length)):r+=c;}return new o.Output(a.lineno,a.colno,[new o.TemplateData(a.lineno,a.colno,r)])},c.parsePostfix=function(e){for(var t,n=this.peekToken();n;){if(n.type===r.TOKEN_LEFT_PAREN)e=new o.FunCall(n.lineno,n.colno,e,this.parseSignature());else if(n.type===r.TOKEN_LEFT_BRACKET)(t=this.parseAggregate()).children.length>1&&this.fail("invalid index"),e=new o.LookupVal(n.lineno,n.colno,e,t.children[0]);else {if(n.type!==r.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var i=this.nextToken();i.type!==r.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+i.value,i.lineno,i.colno),t=new o.Literal(i.lineno,i.colno,i.value),e=new o.LookupVal(n.lineno,n.colno,e,t);}n=this.peekToken();}return e},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var e=this.parseOr();if(this.skipSymbol("if")){var t=this.parseOr(),n=e;(e=new o.InlineIf(e.lineno,e.colno)).body=n,e.cond=t,this.skipSymbol("else")?e.else_=this.parseOr():e.else_=null;}return e},c.parseOr=function(){for(var e=this.parseAnd();this.skipSymbol("or");){var t=this.parseAnd();e=new o.Or(e.lineno,e.colno,e,t);}return e},c.parseAnd=function(){for(var e=this.parseNot();this.skipSymbol("and");){var t=this.parseNot();e=new o.And(e.lineno,e.colno,e,t);}return e},c.parseNot=function(){var e=this.peekToken();return this.skipSymbol("not")?new o.Not(e.lineno,e.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var e=this.parseIs();;){var t=this.nextToken();if(!t)break;var n=t.type===r.TOKEN_SYMBOL&&"not"===t.value;if(n||this.pushToken(t),!this.skipSymbol("in")){n&&this.pushToken(t);break}var i=this.parseIs();e=new o.In(e.lineno,e.colno,e,i),n&&(e=new o.Not(e.lineno,e.colno,e));}return e},c.parseIs=function(){var e=this.parseCompare();if(this.skipSymbol("is")){var t=this.skipSymbol("not"),n=this.parseCompare();e=new o.Is(e.lineno,e.colno,e,n),t&&(e=new o.Not(e.lineno,e.colno,e));}return e},c.parseCompare=function(){for(var e=["==","===","!=","!==","<",">","<=",">="],t=this.parseConcat(),n=[];;){var i=this.nextToken();if(!i)break;if(-1===e.indexOf(i.value)){this.pushToken(i);break}n.push(new o.CompareOperand(i.lineno,i.colno,this.parseConcat(),i.value));}return n.length?new o.Compare(n[0].lineno,n[0].colno,t,n):t},c.parseConcat=function(){for(var e=this.parseAdd();this.skipValue(r.TOKEN_TILDE,"~");){var t=this.parseAdd();e=new o.Concat(e.lineno,e.colno,e,t);}return e},c.parseAdd=function(){for(var e=this.parseSub();this.skipValue(r.TOKEN_OPERATOR,"+");){var t=this.parseSub();e=new o.Add(e.lineno,e.colno,e,t);}return e},c.parseSub=function(){for(var e=this.parseMul();this.skipValue(r.TOKEN_OPERATOR,"-");){var t=this.parseMul();e=new o.Sub(e.lineno,e.colno,e,t);}return e},c.parseMul=function(){for(var e=this.parseDiv();this.skipValue(r.TOKEN_OPERATOR,"*");){var t=this.parseDiv();e=new o.Mul(e.lineno,e.colno,e,t);}return e},c.parseDiv=function(){for(var e=this.parseFloorDiv();this.skipValue(r.TOKEN_OPERATOR,"/");){var t=this.parseFloorDiv();e=new o.Div(e.lineno,e.colno,e,t);}return e},c.parseFloorDiv=function(){for(var e=this.parseMod();this.skipValue(r.TOKEN_OPERATOR,"//");){var t=this.parseMod();e=new o.FloorDiv(e.lineno,e.colno,e,t);}return e},c.parseMod=function(){for(var e=this.parsePow();this.skipValue(r.TOKEN_OPERATOR,"%");){var t=this.parsePow();e=new o.Mod(e.lineno,e.colno,e,t);}return e},c.parsePow=function(){for(var e=this.parseUnary();this.skipValue(r.TOKEN_OPERATOR,"**");){var t=this.parseUnary();e=new o.Pow(e.lineno,e.colno,e,t);}return e},c.parseUnary=function(e){var t,n=this.peekToken();return t=this.skipValue(r.TOKEN_OPERATOR,"-")?new o.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(r.TOKEN_OPERATOR,"+")?new o.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),e||(t=this.parseFilter(t)),t},c.parsePrimary=function(e){var t,n=this.nextToken(),i=null;if(n?n.type===r.TOKEN_STRING?t=n.value:n.type===r.TOKEN_INT?t=parseInt(n.value,10):n.type===r.TOKEN_FLOAT?t=parseFloat(n.value):n.type===r.TOKEN_BOOLEAN?"true"===n.value?t=!0:"false"===n.value?t=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===r.TOKEN_NONE?t=null:n.type===r.TOKEN_REGEX&&(t=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==t?i=new o.Literal(n.lineno,n.colno,t):n.type===r.TOKEN_SYMBOL?i=new o.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),i=this.parseAggregate()),e||(i=this.parsePostfix(i)),i)return i;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var e=this.expect(r.TOKEN_SYMBOL),t=e.value;this.skipValue(r.TOKEN_OPERATOR,".");)t+="."+this.expect(r.TOKEN_SYMBOL).value;return new o.Symbol(e.lineno,e.colno,t)},c.parseFilterArgs=function(e){return this.peekToken().type===r.TOKEN_LEFT_PAREN?this.parsePostfix(e).args.children:[]},c.parseFilter=function(e){for(;this.skip(r.TOKEN_PIPE);){var t=this.parseFilterName();e=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[e].concat(this.parseFilterArgs(e))));}return e},c.parseFilterStatement=function(){var e=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var t=this.parseFilterName(),n=this.parseFilterArgs(t);this.advanceAfterBlockEnd(e.value);var i=new o.Capture(t.lineno,t.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var r=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[i].concat(n)));return new o.Output(t.lineno,t.colno,[r])},c.parseAggregate=function(){var e,t=this.nextToken();switch(t.type){case r.TOKEN_LEFT_PAREN:e=new o.Group(t.lineno,t.colno);break;case r.TOKEN_LEFT_BRACKET:e=new o.Array(t.lineno,t.colno);break;case r.TOKEN_LEFT_CURLY:e=new o.Dict(t.lineno,t.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===r.TOKEN_RIGHT_PAREN||n===r.TOKEN_RIGHT_BRACKET||n===r.TOKEN_RIGHT_CURLY){this.nextToken();break}if(e.children.length>0&&(this.skip(r.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",t.lineno,t.colno)),e instanceof o.Dict){var i=this.parsePrimary();this.skip(r.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",t.lineno,t.colno);var s=this.parseExpression();e.addChild(new o.Pair(i.lineno,i.colno,i,s));}else {var a=this.parseExpression();e.addChild(a);}}return e},c.parseSignature=function(e,t){var n=this.peekToken();if(!t&&n.type!==r.TOKEN_LEFT_PAREN){if(e)return null;this.fail("expected arguments",n.lineno,n.colno);}n.type===r.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var i=new o.NodeList(n.lineno,n.colno),s=new o.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!t&&n.type===r.TOKEN_RIGHT_PAREN){this.nextToken();break}if(t&&n.type===r.TOKEN_BLOCK_END)break;if(a&&!this.skip(r.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else {var c=this.parseExpression();this.skipValue(r.TOKEN_OPERATOR,"=")?s.addChild(new o.Pair(c.lineno,c.colno,c,this.parseExpression())):i.addChild(c);}a=!0;}return s.children.length&&i.addChild(s),i},c.parseUntilBlocks=function(){for(var e=this.breakOnBlocks,t=arguments.length,n=new Array(t),i=0;i=","//","**"],K=C+this.current();switch(-1!==i.indexOf(P,K)&&(this.forward(),C=K,-1!==i.indexOf(P,K+this.current())&&(C=K+this.current(),this.forward())),C){case"(":R=m;break;case")":R=d;break;case"[":R=v;break;case"]":R=_;break;case"{":R=y;break;case"}":R=g;break;case",":R=k;break;case":":R=E;break;case"~":R=w;break;case"|":R=x;break;default:R=b;}return N(R,C,t,n)}if((e=this._extractUntil(r+o)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var I=this._extract("0123456789");return N(O,e+"."+I,t,n)}return N("int",e,t,n)}if(e.match(/^(true|false)$/))return N(L,e,t,n);if("none"===e)return N(T,e,t,n);if("null"===e)return N(T,e,t,n);if(e)return N(S,e,t,n);throw new Error("Unexpected value while parsing: "+e)}var M,D=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((e=this._extractString(this.tags.BLOCK_START+"-"))||(e=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,N(l,e,t,n);if((e=this._extractString(this.tags.VARIABLE_START+"-"))||(e=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,N(h,e,t,n);e="";var U=!1;for(this._matches(this.tags.COMMENT_START)&&(U=!0,e=this._extractString(this.tags.COMMENT_START));null!==(M=this._extractUntil(D));){if(e+=M,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!U){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=e.length){var V=e.slice(-this.colno);if(/^\s+$/.test(V)&&!(e=e.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!U)throw new Error("unexpected end of comment");e+=this._extractString(this.tags.COMMENT_END);break}e+=this.current(),this.forward();}if(null===M&&U)throw new Error("expected end of comment, got end of file");return N(U?p:c,e,t,n)},t._parseString=function(e){this.forward();for(var t="";!this.isFinished()&&this.current()!==e;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":t+="\n";break;case"t":t+="\t";break;case"r":t+="\r";break;default:t+=this.current();}this.forward();}else t+=n,this.forward();}return this.forward(),t},t._matches=function(e){return this.index+e.length>this.len?null:this.str.slice(this.index,this.index+e.length)===e},t._extractString=function(e){return this._matches(e)?(this.forwardN(e.length),e):null},t._extractUntil=function(e){return this._extractMatching(!0,e||"")},t._extract=function(e){return this._extractMatching(!1,e)},t._extractMatching=function(e,t){if(this.isFinished())return null;var n=t.indexOf(this.current());if(e&&-1===n||!e&&-1!==n){var i=this.current();this.forward();for(var r=t.indexOf(this.current());(e&&-1===r||!e&&-1!==r)&&!this.isFinished();)i+=this.current(),this.forward(),r=t.indexOf(this.current());return i}return ""},t._extractRegex=function(e){var t=this.currentStr().match(e);return t?(this.forwardN(t[0].length),t):null},t.isFinished=function(){return this.index>=this.len},t.forwardN=function(e){for(var t=0;t1024){for(var t=0,n=r.length-o;t0&&s.length>r&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a);}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=f.bind(i);return r.listener=n,i.wrapFn=r,r}function m(e,t,n){var i=e._events;if(void 0===i)return [];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=r[e];if(void 0===c)return !1;if("function"==typeof c)o(c,this,t);else {var l=c.length,u=v(c,l);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return m(this,e,!0)},a.prototype.rawListeners=function(e){return m(this,e,!1)},a.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};},function(e,t,n){var i=n(3),r=n(0),o=0;function s(){return "hole_"+o++}function a(e,t){for(var n=null,i=0;i=t)return e;var n=t-e.length,s=i.repeat(" ",n/2-n%2),a=i.repeat(" ",n/2);return r.copySafeness(e,s+e+a)},t.default=function(e,t,n){return n?e||t:void 0!==e?e:t},t.dictsort=function(e,t,n){if(!i.isObject(e))throw new i.TemplateError("dictsort filter: val must be an object");var r,o=[];for(var s in e)o.push([s,e[s]]);if(void 0===n||"key"===n)r=0;else {if("value"!==n)throw new i.TemplateError("dictsort filter: You can only sort by either key or value");r=1;}return o.sort((function(e,n){var o=e[r],s=n[r];return t||(i.isString(o)&&(o=o.toUpperCase()),i.isString(s)&&(s=s.toUpperCase())),o>s?1:o===s?0:-1})),o},t.dump=function(e,t){return JSON.stringify(e,null,t)},t.escape=function(e){return e instanceof r.SafeString?e:(e=null==e?"":e,r.markSafe(i.escape(e.toString())))},t.safe=function(e){return e instanceof r.SafeString?e:(e=null==e?"":e,r.markSafe(e.toString()))},t.first=function(e){return e[0]},t.forceescape=function(e){return e=null==e?"":e,r.markSafe(i.escape(e.toString()))},t.groupby=function(e,t){return i.groupBy(e,t,this.env.opts.throwOnUndefined)},t.indent=function(e,t,n){if(""===(e=o(e,"")))return "";t=t||4;var s=e.split("\n"),a=i.repeat(" ",t),c=s.map((function(e,t){return 0!==t||n?""+a+e:e})).join("\n");return r.copySafeness(e,c)},t.join=function(e,t,n){return t=t||"",n&&(e=i.map(e,(function(e){return e[n]}))),e.join(t)},t.last=function(e){return e[e.length-1]},t.length=function(e){var t=o(e,"");return void 0!==t?"function"==typeof Map&&t instanceof Map||"function"==typeof Set&&t instanceof Set?t.size:!i.isObject(t)||t instanceof r.SafeString?t.length:i.keys(t).length:0},t.list=c,t.lower=function(e){return (e=o(e,"")).toLowerCase()},t.nl2br=function(e){return null==e?"":r.copySafeness(e,e.replace(/\r\n|\n/g,"
\n"))},t.random=function(e){return e[Math.floor(Math.random()*e.length)]},t.reject=l(!1),t.rejectattr=function(e,t){return e.filter((function(e){return !e[t]}))},t.select=l(!0),t.selectattr=function(e,t){return e.filter((function(e){return !!e[t]}))},t.replace=function(e,t,n,i){var o=e;if(t instanceof RegExp)return e.replace(t,n);void 0===i&&(i=-1);var s="";if("number"==typeof t)t=""+t;else if("string"!=typeof t)return e;if("number"==typeof e&&(e=""+e),"string"!=typeof e&&!(e instanceof r.SafeString))return e;if(""===t)return s=n+e.split("").join(n)+n,r.copySafeness(e,s);var a=e.indexOf(t);if(0===i||-1===a)return e;for(var c=0,l=0;a>-1&&(-1===i||l=r&&u.push(n),o.push(u);}return o},t.sum=function(e,t,n){return void 0===n&&(n=0),t&&(e=i.map(e,(function(e){return e[t]}))),n+e.reduce((function(e,t){return e+t}),0)},t.sort=r.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(e,t,n,r){var o=this,s=i.map(e,(function(e){return e})),a=i.getAttrGetter(r);return s.sort((function(e,s){var c=r?a(e):e,l=r?a(s):s;if(o.env.opts.throwOnUndefined&&r&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+r+'" resolved to undefined');return !n&&i.isString(c)&&i.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?t?-1:1:0})),s})),t.string=function(e){return r.copySafeness(e,e)},t.striptags=function(e,t){var n=u((e=o(e,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,"")),i="";return i=t?n.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):n.replace(/\s+/gi," "),r.copySafeness(e,i)},t.title=function(e){var t=(e=o(e,"")).split(" ").map((function(e){return a(e)}));return r.copySafeness(e,t.join(" "))},t.trim=u,t.truncate=function(e,t,n,i){var s=e;if(t=t||255,(e=o(e,"")).length<=t)return e;if(n)e=e.substring(0,t);else {var a=e.lastIndexOf(" ",t);-1===a&&(a=t),e=e.substring(0,a);}return e+=null!=i?i:"...",r.copySafeness(s,e)},t.upper=function(e){return (e=o(e,"")).toUpperCase()},t.urlencode=function(e){var t=encodeURIComponent;return i.isString(e)?t(e):(i.isArray(e)?e:i._entries(e)).map((function(e){var n=e[0],i=e[1];return t(n)+"="+t(i)})).join("&")};var h=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,f=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,p=/^https?:\/\/.*$/,m=/^www\./,d=/\.(?:org|net|com)(?:\:|\/|$)/;t.urlize=function(e,t,n){s(t)&&(t=1/0);var i=!0===n?' rel="nofollow"':"";return e.split(/(\s+)/).filter((function(e){return e&&e.length})).map((function(e){var n=e.match(h),r=n?n[1]:e,o=r.substr(0,t);return p.test(r)?'"+o+"":m.test(r)?'"+o+"":f.test(r)?''+r+"":d.test(r)?'"+o+"":e})).join("")},t.wordcount=function(e){var t=(e=o(e,""))?e.match(/\w+/g):null;return t?t.length:null},t.float=function(e,t){var n=parseFloat(e);return s(n)?t:n};var v=r.makeMacro(["value","default","base"],[],(function(e,t,n){void 0===n&&(n=10);var i=parseInt(e,n);return s(i)?t:i}));t.int=v,t.d=t.default,t.e=t.escape;},function(e,t,n){function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var r=function(e){var t,n;function r(t){var n;return (n=e.call(this)||this).precompiled=t||{},n}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n),r.prototype.getSource=function(e){return this.precompiled[e]?{src:{type:"code",obj:this.precompiled[e]},path:e}:null},r}(n(6));e.exports={PrecompiledLoader:r};},function(e,t,n){var i=n(2).SafeString;t.callable=function(e){return "function"==typeof e},t.defined=function(e){return void 0!==e},t.divisibleby=function(e,t){return e%t==0},t.escaped=function(e){return e instanceof i},t.equalto=function(e,t){return e===t},t.eq=t.equalto,t.sameas=t.equalto,t.even=function(e){return e%2==0},t.falsy=function(e){return !e},t.ge=function(e,t){return e>=t},t.greaterthan=function(e,t){return e>t},t.gt=t.greaterthan,t.le=function(e,t){return e<=t},t.lessthan=function(e,t){return e0)for(var r=e;rt;o+=n)i.push(o);return i},cycler:function(){return e=Array.prototype.slice.call(arguments),t=-1,{current:null,reset:function(){t=-1,this.current=null;},next:function(){return ++t>=e.length&&(t=0),this.current=e[t],this.current}};var e,t;},joiner:function(e){return function(e){e=e||",";var t=!0;return function(){var n=t?"":e;return t=!1,n}}(e)}}};},function(e,t,n){var i=n(4);e.exports=function(e,t){function n(e,t){if(this.name=e,this.path=e,this.defaultEngine=t.defaultEngine,this.ext=i.extname(e),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine);}return n.prototype.render=function(t,n){e.render(this.name,t,n);},t.set("view",n),t.set("nunjucksEnv",e),e};},function(e,t,n){var i=n(4),r=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,c=n(24);function l(e,t){return !!Array.isArray(t)&&t.some((function(t){return e.match(t)}))}function u(e,t){(t=t||{}).isString=!0;var n=t.env||new a([]),i=t.wrapper||c;if(!t.name)throw new Error('the "name" option is required when compiling a string');return i([h(e,t.name,n)],t)}function h(e,t,n){var i,r=(n=n||new a([])).asyncFilters,c=n.extensionsList;t=t.replace(/\\/g,"/");try{i=s.compile(e,r,c,t,n.opts);}catch(e){throw o(t,!1,e)}return {name:t,template:i}}e.exports={precompile:function(e,t){var n=(t=t||{}).env||new a([]),o=t.wrapper||c;if(t.isString)return u(e,t);var s=i.existsSync(e)&&i.statSync(e),f=[],p=[];if(s.isFile())f.push(h(i.readFileSync(e,"utf-8"),t.name||e,n));else if(s.isDirectory()){!function n(o){i.readdirSync(o).forEach((function(s){var a=r.join(o,s),c=a.substr(r.join(e,"/").length),u=i.statSync(a);u&&u.isDirectory()?l(c+="/",t.exclude)||n(a):l(c,t.include)&&p.push(a);}));}(e);for(var m=0;me.length||r>0&&s>=i||r<0&&s<=i);s+=r)o.push(n.memberLookup(e,s));return o}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var m={pop:function(e){if(void 0===e)return this.pop();if(e>=this.length||e<0)throw new Error("KeyError");return this.splice(e,1)},append:function(e){return this.push(e)},remove:function(e){for(var t=0;t_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=_0x48b3ac['annotation']||'',_0x160a9c=_0x6ac7d8['anno']||'',_0x122b70=_0x6ac7d8['annosuffix']||'',_0x4d610c=_0x48b3ac['type']||'highlight',_0x2cda6e=_0x6ac7d8['color_tags']||[],_0x523377=_0x6ac7d8['color']||'',_0x396c3f=_0x6ac7d8['color_line']||_0x6ac7d8['colorline']||!0x1,_0x28714f=_0x48b3ac['slotid']||0x1,_0x5bea56=_0x6ac7d8['refid']&&!0x0,_0x1427fd=_0x6ac7d8['links']&&!0x0,_0x3a6b81=_0x48b3ac['remaintags']||'',_0x283724=[],_0x1d1e25=!0x1;if(_0x1427fd&&['math','image']['indexOf'](_0x4d610c)<0x0&&(_0x48db22=Utils['mergeLinksToNote'](_0x48db22,_0x48b3ac['notelinks'])||_0x48db22),'math'===_0x4d610c)_0x283724['push']('\x0a$$\x0a'+_0x48db22+'\x0a$$\x0a'),_0x3a6b81&&_0x283724['push'](_0x3a6b81),_0x1d1e25=!0x0;else {if('image'===_0x4d610c)_0x283724['push'](_0x48e9c3+'![]('+_0x48db22+')\x20'+_0x3a6b81),_0x1d1e25=!0x0;else {if(Utils['isMardownFormat'](_0x48db22))_0x283724['push'](_0x48db22+'\x20'+_0x3a6b81),_0x1d1e25=!0x0;else {if(_0xc6e60d){let _0x3cd6c9=Utils['formatText'](_0x48db22,'\x0d\x09');_0x523377?(_0x2cda6e&&_0x2cda6e['length']>0x0&&(_0x523377=_0x2cda6e[_0x28714f-0x1]),_0x3cd6c9=''+_0x523377+''+_0x3cd6c9):_0x396c3f&&(_0x3cd6c9=''+_0x3cd6c9+''),_0x1d1e25=!0x0,_0x283724['push'](_0x48e9c3+_0x3cd6c9+'\x20'+_0x3a6b81);}else {if(_0x2e8f95||_0x294d6b){let _0x519bc4=(_0x48db22+'\x20'+_0x3a6b81)['split'](/\n/),_0x3fe2d7=0x0;for(let _0x7279df of _0x519bc4)_0x7279df=Utils['trimString'](_0x7279df),_0x7279df&&(0x0==_0x3fe2d7&&_0x2cda6e&&_0x2cda6e['length']>0x0&&(_0x523377=_0x2cda6e[_0x28714f-0x1]),_0x523377&&0x0==_0x3fe2d7?_0x283724['push'](_0x48e9c3+''+_0x523377+''+_0x7279df):_0x396c3f?_0x283724['push'](_0x48e9c3+''+_0x7279df+''):_0x283724['push'](_0x48e9c3+_0x7279df),_0x3fe2d7++,_0x1d1e25=!0x0);}}}}}if(_0x1d1e25&&_0x599854&&_0x283724['length']>0x0&&(_0x599854='\x20'+_0x599854['trim'](),_0x283724[_0x283724['length']-0x1]+=_0x599854),_0xb7bc08){if(_0x1d1e25=!0x1,Utils['isMardownFormat'](_0xb7bc08))_0x283724['push'](_0x22adf1+_0xb7bc08),_0x1d1e25=!0x0;else {let _0x4a4ded=Utils['getPrefxFromAnnoPrefix'](_0x160a9c),_0x245199=_0xb7bc08['split'](/\n/),_0x5aaba2=0x0;for(let _0x3926db of _0x245199)_0x3926db=Utils['trimString'](_0x3926db),_0x3926db['length']<=0x0||(_0x160a9c&&(/^#/['test'](_0x3926db)&&(_0x3926db='\x20'+_0x3926db),_0x3926db=0x0==_0x5aaba2?_0x160a9c+_0x3926db:_0x4a4ded+_0x3926db),_0x283724['push'](_0x22adf1+_0x3926db),_0x5aaba2++,_0x1d1e25=!0x0);}_0x1d1e25&&_0x122b70&&_0x283724['length']>0x0&&(_0x122b70='\x20'+_0x122b70,_0x283724[_0x283724['length']-0x1]+=_0x122b70);}let _0x4179d6=_0x283724['length'];return _0x5bea56&&_0x4179d6>0x0&&(_0x283724[_0x4179d6-0x1]+='\x20^'+_0x48b3ac['refid']),!_0xc6e60d&&_0x4179d6>0x0&&_0x283724['push'](''),_0x283724['join']('\x0a');});}['precompile'](_0x1afff1){let _0x41c126=_0x1afff1['obTemplate']||TestData['templateObStyle1'];if(_0x41c126=_0x41c126['replace'](/annonation/g,'annotation'),_0x41c126=_0x41c126['replace'](/imageUrl/g,'imageurl'),this['pageTemplateStr']=_0x41c126,this['isHaveAnnoCountVar']=_0x41c126['indexOf']('annotationcount')>0x0,this['isHaveAllTagsVar']=_0x41c126['indexOf']('alltagsv2')>0x0,this['isHavePageMirrorVar']=_0x41c126['indexOf']('mdcontent')>0x0,this['obNoteProps']=this['detectNoteIDProp'](_0x1afff1['obNoteProps'],this['pageTemplateStr']),0x2===_0x1afff1['writeStyle']){const _0x21e249=Utils['getBlocks'](_0x41c126);let _0xb9c978={};_0x21e249['pagenote']&&(_0xb9c978['pagenote']=Utils['wrapBlock'](_0x21e249['pagenote'],'pagenote')),_0x21e249['highlights']&&(_0xb9c978['highlights']=Utils['wrapBlock'](_0x21e249['highlights'],'highlights')),_0x21e249['mdcontent']&&(_0xb9c978['mdcontent']=Utils['wrapBlock'](_0x21e249['mdcontent'],'mdcontent')),this['pagenoteEngine']=_0x57995a['compile'](_0x21e249['pagenote'],this['templateEnv']),this['highlightsEngine']=_0x57995a['compile'](_0x21e249['highlights'],this['templateEnv']),this['mdcontentEngine']=_0x57995a['compile'](_0x21e249['mdcontent'],this['templateEnv']),this['blocks']=_0x21e249;let _0x23c70a=Utils['replaceBlocks'](_0x41c126,_0xb9c978);this['pageEngine']=_0x57995a['compile'](_0x23c70a,this['templateEnv']);}else this['pageEngine']=_0x57995a['compile'](this['pageTemplateStr'],this['templateEnv']);let _0x8d530e=_0x1afff1['titleTemplate'];_0x8d530e=_0x8d530e||'wucai-{{\x20createat_ts\x20|\x20date(\x22YYYY-MM-DD\x22)\x20}}',_0x8d530e=_0x8d530e['replace'](/[\n]+/,'')['trim'](),this['titleTemplateStr']=_0x8d530e,this['titleEngine']=_0x57995a['compile'](_0x8d530e,this['templateEnv']);let _0x597622='',_0x1962b2=[{'name':'Template','tpl':this['pageEngine'],'view':TestData['ViewOfObsidianTemplate']},{'name':'Title\x20Template','tpl':this['titleEngine'],'view':TestData['ViewOfObsidianTitle']}];for(let _0x4970e9 of _0x1962b2)try{_0x4970e9['tpl']['render'](_0x4970e9['view']);}catch(_0x16c112){_0x597622+='Template\x20Error:\x20'+_0x16c112;break;}return _0x597622;}['detectNoteIDProp'](_0x28a6f5,_0x1ad861){const _0x43e99f=[],_0x2087c5=[_0x28a6f5=(_0x28a6f5||'')['trim'](),Utils['gnpfte'](_0x1ad861),'笔记ID'];for(let _0x128b6a of _0x2087c5)_0x128b6a&&_0x43e99f['indexOf'](_0x128b6a)<0x0&&_0x43e99f['push'](_0x128b6a);return _0x43e99f['filter'](_0x254cd1=>_0x254cd1);}['isHaveNoteIdProp'](){return this['obNoteProps']&&this['obNoteProps']['length']>0x0;}}Templates['leftHolder']='{{',Templates['rightHolder']='}}'; 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,'lastCursor2':_0x48f452};try{_0x31fb0b=yield this['callApi']('/init',_0x58bb53);}catch(_0x2a8745){logger({'msg':'WuCai\x20Official\x20plugin:\x20fetch\x20failed\x20in\x20exportInit:\x20','e':_0x2a8745});}if(!_0x31fb0b||!_0x31fb0b['ok'])return logger({'msg':'WuCai\x20Official\x20plugin:\x20bad\x20response\x20in\x20exportInit:\x20','rsp':_0x31fb0b}),this['handleSyncError'](_0x47216d,this['getErrorFromRsp'](_0x31fb0b)),void(this['isSyncing']=!0x1);let _0xb5df77=yield _0x31fb0b['json']();if(this['checkResponseBody'](_0x47216d,_0xb5df77))return void(this['isSyncing']=!0x1);let _0x486a55=_0xb5df77['data']||{};logger({'msg':'in\x20exportInit','initRet':_0x486a55,'lastCursor2':_0x48f452,'flagx':_0x5c0090}),this['settings']['exportConfig']=_0x486a55['exportConfig'];const _0x152421={'obTemplate':_0x486a55['exportConfig']['obTemplate'],'titleTemplate':_0x486a55['exportConfig']['titleTemplate'],'writeStyle':_0x486a55['exportConfig']['writeStyle'],'obNoteProps':_0x486a55['exportConfig']['obNoteProps']},_0x117dd6=this['template']['precompile'](_0x152421);if(_0x117dd6)return logger({'msg':'compile\x20template\x20error','err':_0x117dd6}),this['handleSyncError'](_0x47216d,_0x117dd6),void(this['isSyncing']=!0x1);if(_0x48f452=this['getLastCursor'](_0x486a55['lastCursor2'],_0x48f452),_0x48f452&&(this['settings']['lastCursor']=_0x48f452),yield this['saveSettings'](),'onlyinit'!==_0x16b178){if('SYNCED'===_0x486a55['taskStatus']){this['handleSyncSuccess'](_0x47216d,'Synced',_0x48f452);let _0x21a40a='Latest\x20WuCai\x20sync\x20already\x20happened\x20on\x20your\x20other\x20device.\x20Data\x20should\x20be\x20up\x20to\x20date';this['notice'](_0x21a40a,!0x1,0x4,!0x0),logger({'msg':'syncing\x20->\x20false','flagx':_0x5c0090+'\x20init+ck+synced'}),this['isSyncing']=!0x1;}else {if('EXPIRED'==_0x486a55['taskStatus'])this['handleSyncError'](_0x47216d,'sync\x20service\x20expried'),logger({'msg':'syncing\x20->\x20false','flagx':_0x5c0090+'\x20init+ck+expired'}),this['isSyncing']=!0x1;else {if(WAITING_STATUSES['includes'](_0x486a55['taskStatus'])){if(_0x486a55['notesExported']>0x0){const _0x1dafb7=localize('Exporting\x20WuCai\x20data')+('\x20('+_0x486a55['notesExported']+'\x20/\x20'+_0x486a55['totalNotes']+')\x20...');this['notice'](_0x1dafb7);}else this['notice']('Building\x20export...');yield new Promise(_0x2c7ab4=>setTimeout(_0x2c7ab4,0xbb8)),yield this['exportInit'](_0x47216d,!0x1,'exportInit\x20timeout');}else 'SYNCING'===_0x486a55['taskStatus']?(this['notice']('Syncing\x20WuCai\x20data'),yield this['downloadArchive'](_0x48f452,[],_0x47216d,_0x5c0090+'\x20init+ck')):(this['handleSyncError'](_0x47216d,'Sync\x20failed,'+_0x486a55['taskStatus']),logger({'msg':'syncing\x20->\x20false','flagx':_0x5c0090+'\x20init+ck+exception'}),this['isSyncing']=!0x1);}}}else this['isSyncing']=!0x1;});}['notice'](_0x10c2cd,_0x31237a=!0x1,_0x511a93=0x0,_0x5b7d15=!0x1){_0x31237a&&new obsidian.Notice(_0x10c2cd),obsidian.Platform['isMobileApp']?_0x31237a||new obsidian.Notice(_0x10c2cd):this['statusBar']['displayMessage'](_0x10c2cd['toLowerCase'](),_0x511a93,_0x5b7d15);}['showInfoStatus'](_0x26ded1,_0x11ab4c,_0x2e9ab8=''){let _0x583500=_0x26ded1['find']('.wc-info-container');_0x583500&&(_0x583500['setText'](_0x11ab4c),_0x583500['addClass'](_0x2e9ab8));}['clearInfoStatus'](_0x1d4d47){_0x1d4d47['find']('.wc-info-container')['empty']();}['getAuthHeaders'](){return {'AUTHORIZATION':'Token\x20'+(this['settings']['token']||''),'Obsidian-Client':''+this['getClientID']()};}['getLastCursor'](_0x3e3e5f,_0x2615c8){return _0x3e3e5f||_0x2615c8||'';}['isRejectByCondition'](_0x1902e9,_0x3e9b7a){if(!_0x1902e9)return !0x1;if(_0x3e9b7a['forceupdate'])return !0x1;if(0x3===_0x3e9b7a['noteType'])return !0x1;if(_0x3e9b7a['pageNote'])return !0x1;if((_0x1902e9['indexOf']('unread')>=0x0?0x1:0x0)>0x0){if(0x2===_0x3e9b7a['readstatus'])return !0x0;if(_0x3e9b7a['highlights']=_0x3e9b7a['highlights']||[],_0x3e9b7a['highlights']['length']<=0x0)return !0x0;}return !0x1;}['processEntry'](_0x48388c){var _0x545b22,_0x3b0abe;return __awaiter(this,void 0x0,void 0x0,function*(){const _0xae2d91=this['app']['vault'],_0x43f041=this['settings']['exportConfig'],_0x5256ee=_0x48388c['noteIdX'],_0x281ca1=Utils['getDomain'](_0x48388c['url']),_0x24ec69=Utils['getDomain2'](_0x281ca1)||'',_0x35dc6c=0x3===_0x48388c['noteType'],_0xff4ec2=_0x35dc6c?'dailynote':'page',_0x59271a=Utils['normalTitle'](_0x48388c['title'],0x0),_0x116fec={'title':_0x59271a,'createat_ts':_0x48388c['createAt'],'updateat_ts':Math['max'](_0x48388c['updateAt'],_0x48388c['createAt']),'domain2':_0x24ec69,'domain':_0x281ca1||'','notetype':_0xff4ec2,'isdailynote':_0x35dc6c};let _0x449baa=this['settings']['notePaths'][_0x5256ee]||'';const _0x856583=yield Utils['lffnw'](_0xae2d91,_0x5256ee,_0x449baa,_0x59271a,_0x116fec,_0x43f041['truncateTile255'],this['template']['titleEngine'],this['app']['metadataCache'],this['template']['obNoteProps'],(_0x102e8c,_0x2e997d)=>{const _0x56a508=this['settings']['wuCaiDir']+'/'+_0x102e8c+_0x2e997d;return obsidian.normalizePath(_0x56a508)['replace'](/[\/ \s]+$/,'');});if(!_0x856583||_0x856583['length']<=0x0)logger({'msg':'generate\x20file\x20name\x20error','noteid':_0x5256ee,'entry':_0x48388c,'oldPath':_0x449baa});else try{let _0x5e9317=yield this['app']['vault']['getAbstractFileByPath'](_0x856583),_0x1d3324=_0x5e9317&&_0x5e9317 instanceof obsidian.TFile,_0x2c9c8e={};_0x1d3324&&(_0x2c9c8e=(null===(_0x545b22=this['app']['metadataCache']['getFileCache'](_0x5e9317))||void 0x0===_0x545b22?void 0x0:_0x545b22['frontmatter'])||{});if(_0x1d3324&&Utils['isIgnoreSync'](_0x43f041['obNotSyncProps'],_0x2c9c8e))return void logger({'msg':'skip,\x20because\x20of\x20not-sync-prop','outFilename':_0x856583},0x2);try{(yield Utils['cnfoOl'](_0xae2d91,_0x449baa,_0x856583))&&(_0x5e9317=yield this['app']['vault']['getAbstractFileByPath'](_0x856583),_0x1d3324=_0x5e9317&&_0x5e9317 instanceof obsidian.TFile);}catch(_0x2a9e4a){return void logger({'error':_0x2a9e4a,'outFilename':_0x856583});}this['settings']['notePaths'][_0x5256ee]=_0x856583;const _0x526cf6=this['template']['obNoteProps'][0x0];_0x48388c['highlights']=_0x48388c['highlights']||[],_0x48388c['pageScore']=_0x48388c['pageScore']||0x0,_0x48388c['sou']=_0x48388c['sou']||'';const _0x2b31d5=0x1===_0x43f041['tagStyle'],_0xaad7df=_0x48388c['pageScore']>0x0,_0x39f2ad=Utils['formatTags'](_0x48388c['tags'],_0x2b31d5),_0x331031=Utils['mergeTags'](_0x48388c['tags'],_0x48388c['notetags'],_0x2b31d5),_0x4e458e=Utils['toYAMLList'](Utils['trimTags'](_0x39f2ad)),_0xcf7c84=Utils['toYAMLList'](Utils['trimTags'](_0x331031));let _0x251626='',_0x259605=!0x1;0x2!==_0x43f041['pageMirrorStyle']&&_0x48388c['sou']&&this['template']['isHavePageMirrorVar']&&(_0x251626=yield Utils['getPageMirror'](_0x48388c['sou']),_0x251626=Utils['formatPageMirror'](_0x251626),_0x259605=!0x0);let _0x8ac021=0x0;this['template']['isHaveAnnoCountVar']&&(_0x8ac021=Utils['countAnnoCount'](_0x48388c['highlights']));let _0x5b105a=[];this['template']['isHaveAllTagsVar']&&(_0x5b105a=Utils['allTagsV2'](_0x48388c['tags'],_0x48388c['highlights']));const _0x18a6cc={'title':Utils['formatPageTitle'](_0x48388c['title']),'url':_0x48388c['url'],'wucaiurl':_0x48388c['wucaiurl']||'','readurl':_0x48388c['readurl']||'','folder':_0x48388c['folder']||'','tags':_0x39f2ad,'alltags':_0x331031,'alltagsv2':_0x5b105a,'trimtags':_0x4e458e,'mergedtags':_0xcf7c84,'notetype':_0xff4ec2,'pagenote':Utils['formatPageNote'](_0x48388c['pageNote'],_0x2b31d5),'pagescore':_0x48388c['pageScore'],'isstar':_0xaad7df,'ispagemirror':_0x259605,'isdailynote':_0x35dc6c,'highlights':Utils['formatHighlights'](_0x48388c['url']||'',_0x48388c['highlights'],_0x43f041),'highlightcount':_0x48388c['highlights']['length'],'annotationcount':_0x8ac021,'createat':Utils['formatTime'](_0x48388c['createAt']),'createat_ts':_0x48388c['createAt'],'updateat':Utils['formatTime'](_0x48388c['updateAt']),'updateat_ts':_0x48388c['updateAt'],'noteid':_0x5256ee,'citekey':_0x48388c['citekey']||'','author':_0x48388c['author']||'','orgauthor':_0x48388c['orgauthor']||'','orgname':_0x48388c['orgname']||'','publishat':Utils['formatTime'](_0x48388c['publishat']),'publishat_ts':_0x48388c['publishat']||0x0,'diffupdateat_ts':Utils['getDiffDay'](_0x48388c['createAt'],_0x48388c['updateAt']),'domain':_0x281ca1,'domain2':_0x24ec69,'mdcontent':_0x251626};if(_0x1d3324&&0x1!==_0x43f041['writeStyle']){if(0x2===_0x43f041['writeStyle']){const _0x4d8969=yield this['app']['vault']['read'](_0x5e9317),_0x14d8a7=Utils['renderTemplateWithEditable'](_0x18a6cc,_0x4d8969,this['template']);yield this['app']['vault']['modify'](_0x5e9317,_0x14d8a7),_0x1d3324&&_0x2c9c8e[_0x526cf6]!==_0x5256ee&&(yield this['app']['fileManager']['processFrontMatter'](_0x5e9317,_0x42f6f0=>{_0x42f6f0[_0x526cf6]=_0x5256ee;}));}else this['notice']('WuCai:\x20error\x20writeStyle\x20'+_0x43f041['writeStyle'],!0x0,0x4,!0x0);}else {const _0xe8f27c=Utils['renderTemplate'](_0x18a6cc,this['template']);let _0x3bdd7c={};_0x1d3324?(yield _0xae2d91['modify'](_0x5e9317,_0xe8f27c),_0x3bdd7c=Utils['getRemainData'](_0x43f041['obRemainProps'],_0x2c9c8e)||{}):(yield _0xae2d91['create'](_0x856583,_0xe8f27c),_0x5e9317=yield _0xae2d91['getAbstractFileByPath'](_0x856583),_0x2c9c8e=(null===(_0x3b0abe=this['app']['metadataCache']['getFileCache'](_0x5e9317))||void 0x0===_0x3b0abe?void 0x0:_0x3b0abe['frontmatter'])||{}),_0x2c9c8e[_0x526cf6]!==_0x5256ee&&(_0x3bdd7c[_0x526cf6]=_0x5256ee),Utils['isEmptyObj'](_0x3bdd7c)||(yield this['app']['fileManager']['processFrontMatter'](_0x5e9317,_0x1f2763=>{for(let _0x20c338 in _0x3bdd7c)_0x1f2763[_0x20c338]=_0x3bdd7c[_0x20c338];}));}}catch(_0x6760fa){logger(['WuCai\x20Official\x20plugin:\x20error\x20writing\x20'+_0x856583+':',_0x6760fa]),this['notice']('WuCai:\x20error\x20while\x20writing\x20'+_0x856583+':\x20'+_0x6760fa,!0x0,0x4,!0x0),_0x48388c['noteIdX']&&(yield this['saveSettings']());}});}['downloadArchive'](_0x2bfae2,_0x3c9ef5,_0x2f7f43,_0x35f9d0=''){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x459434;const {writeStyle:_0x41b6f7,obQuery:_0x36d505,obExcludeCondition:_0x2f1fdd}=this['settings']['exportConfig'];logger({'msg':'download','flagx':_0x35f9d0,'lastCursor2':_0x2bfae2,'obQuery':_0x36d505});try{_0x459434=yield this['callApi']('/download',{'lastCursor2':_0x2bfae2,'noteIdXs':_0x3c9ef5,'flagx':_0x35f9d0,'writeStyle':_0x41b6f7,'q':_0x36d505||''});}catch(_0x1a7f07){logger({'msg':'WuCai\x20Official\x20plugin:\x20fetch\x20failed\x20in\x20downloadArchive:\x20','e':_0x1a7f07});}if(!_0x459434||!_0x459434['ok'])return logger({'msg':'WuCai,\x20bad\x20rsp\x20in\x20download\x20','response':_0x459434,'flagx':_0x35f9d0+'\x20download+exception'}),this['handleSyncError'](_0x2f7f43,this['getErrorFromRsp'](_0x459434)),void(this['isSyncing']=!0x1);const _0x4a7990=yield _0x459434['json']();if(this['checkResponseBody'](_0x2f7f43,_0x4a7990))return logger({'msg':'syncing\x20->\x20false','flagx':_0x35f9d0+'\x20download+nil'}),void(this['isSyncing']=!0x1);const _0x3cdc3c=_0x4a7990['data'],_0x18f261=_0x3cdc3c['notes']||[],_0x42ee50=(_0x2f1fdd||'')['split'](',')['filter'](_0x2d2885=>_0x2d2885);for(const _0x57a11c of _0x18f261)if(_0x57a11c&&(!_0x42ee50||!this['isRejectByCondition'](_0x42ee50,_0x57a11c)))try{yield this['processEntry'](_0x57a11c);}catch(_0x33c8dc){logger({'msg':'process\x20entry\x20err','err2':_0x33c8dc,'entry':_0x57a11c});}(_0x2bfae2=this['getLastCursor'](_0x3cdc3c['lastCursor2'],_0x2bfae2))&&(this['settings']['lastCursor']=_0x2bfae2),yield this['saveSettings'](),_0x18f261['length']<=0x0?(logger({'msg':'syncing\x20->\x20false','flagx':_0x35f9d0+'\x20download+done'}),this['isSyncing']=!0x1,yield this['acknowledgeSyncCompleted'](_0x2f7f43),this['handleSyncSuccess'](_0x2f7f43,'Synced!',_0x2bfae2),this['notice']('WuCai\x20sync\x20completed',!0x0,0x1,!0x0)):this['stopSyncing']?(this['isSyncing']=!0x1,this['notice']('WuCai\x20sync\x20stoped,\x20because\x20of\x20stopSyncing',!0x0,0x1,!0x0)):(this['handleSyncSuccess'](_0x2f7f43,'Syncing',_0x2bfae2),yield new Promise(_0x1c1fa4=>setTimeout(_0x1c1fa4,0x1388)),this['downloadArchive'](_0x2bfae2,[],_0x2f7f43,_0x35f9d0));});}['acknowledgeSyncCompleted'](_0x429508){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x3cc38a;try{let _0x3fcfb6={'lastCursor2':this['settings']['lastCursor']};_0x3cc38a=yield this['callApi']('/ack',_0x3fcfb6);}catch(_0x2411d2){logger(['WuCai\x20Official\x20plugin:\x20fetch\x20failed\x20to\x20acknowledged\x20sync:\x20',_0x2411d2]);}_0x3cc38a&&!_0x3cc38a['ok']&&(logger(['WuCai\x20Official\x20plugin:\x20bad\x20response\x20in\x20acknowledge\x20sync:\x20',_0x3cc38a]),this['handleSyncError'](_0x429508,this['getErrorFromRsp'](_0x3cc38a)));});}['configureSchedule'](){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1b1d75=Math['max'](parseInt(this['settings']['frequency']),0xb4);let _0x551a02=0x3c*_0x1b1d75*0x3e8;logger(['WuCai\x20Official\x20plugin:\x20setting\x20interval\x20to\x20',_0x1b1d75,'minutes']),window['clearInterval'](this['scheduleInterval']),this['scheduleInterval']=null,_0x551a02&&(this['scheduleInterval']=window['setInterval'](()=>{this['isSyncing']||this['stopSyncing']||(this['isSyncing']=!0x0,logger(['start\x20sync,\x20schedule',this['settings']['lastCursor'],this['isSyncing']]),this['exportInit'](null,!0x0,'schedule\x20init'));},_0x551a02),this['registerInterval'](this['scheduleInterval']));});}['startSync'](_0x44e766='',_0x252cbd=null){return __awaiter(this,void 0x0,void 0x0,function*(){if(this['isSyncing'])this['notice']('WuCai\x20sync\x20already\x20in\x20progress',!0x0);else {this['isSyncing']=!0x0,yield new Promise(_0x519fca=>setTimeout(_0x519fca,0x3e8)),this['saveSettings']();try{yield this['exportInit'](_0x252cbd,!0x1,_0x44e766||'startSync\x20init');}catch(_0x236639){return this['notice']('WuCai\x20sync\x20error,\x20'+_0x236639),void(this['isSyncing']=!0x1);}}});}['logout'](_0x3c7745){this['stopSyncing']=!0x0,this['settings']['lastSyncFailed']=!0x1,this['settings']['lastCursor']='',this['settings']['token']='',this['settings']['region']='',this['settings']['useridx']='',this['resetRegion'](),this['resetClientID'](),this['saveSettings'](),_0x3c7745&&_0x3c7745();}['checkInitDone'](){return __awaiter(this,void 0x0,void 0x0,function*(){this['isInitDone']||(yield this['exportInit'](null,!0x1,'migrate\x20init','onlyinit'),this['isInitDone']=!0x0);});}['tryGetNoteIdX'](_0x1f0511){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x375767=yield Utils['getNoteIdxByFile'](this['app']['vault'],this['app']['metadataCache'],_0x1f0511,this['template']['obNoteProps']);return _0x375767||this['isInitDone']?_0x375767:(yield this['checkInitDone'](),yield Utils['getNoteIdxByFile'](this['app']['vault'],this['app']['metadataCache'],_0x1f0511,this['template']['obNoteProps']));});}['checkLogin'](){return !(!this['settings']['token']||!this['apiurl'])||(this['notice']('Please\x20Login\x20WuCai',!0x0),!0x1);}['onload'](){return __awaiter(this,void 0x0,void 0x0,function*(){logger({'msg':'load\x20WuCai\x20plugin'}),this['stopSyncing']=!0x1,obsidian.Platform['isMobileApp']||(this['statusBar']=new StatusBar(this['addStatusBarItem']()),this['registerInterval'](window['setInterval'](()=>this['statusBar']['display'](),0x3e8)));let _0x793954=this;if(yield this['loadSettings'](),this['addCommand']({'id':'sync','name':'Sync\x20your\x20data\x20now','callback':()=>{this['checkLogin']()&&this['startSync']();}}),this['addCommand']({'id':'migratetitle','name':'Migrate\x20title\x20to\x20new\x20format','callback'(){var _0x1b66b1;return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x793954['isSyncing'])return void _0x793954['notice']('Sync\x20in\x20progress,\x20migrate\x20is\x20not\x20ALLOWED');if(!_0x793954['checkLogin']())return;if(yield _0x793954['checkInitDone'](),!_0x793954['template']['isHaveNoteIdProp']())return void _0x793954['notice']('Not\x20found\x20noteid\x20property\x20in\x20template');const _0x408001=_0x793954['template']['obNoteProps'][0x0],_0x39d38e=_0x793954['settings']['notePaths']||{};let _0x1ee30f=!0x1,_0x2986b6=0x0;for(let _0x5df9e9 in _0x39d38e){if(_0x793954['stopSyncing'])break;const _0x76170e=_0x39d38e[_0x5df9e9];if(!_0x76170e){_0x1ee30f=!0x0,delete _0x39d38e[_0x5df9e9];continue;}const _0x1ac487='-'+_0x5df9e9+'.md';if(!_0x76170e['endsWith'](_0x1ac487))continue;let _0x5089c1=yield _0x793954['app']['vault']['getAbstractFileByPath'](_0x76170e);if(!(_0x5089c1&&_0x5089c1 instanceof obsidian.TFile)){_0x1ee30f=!0x0,delete _0x39d38e[_0x5df9e9];continue;}const _0x5f564c=yield Utils['lmfn'](_0x793954['app']['vault'],_0x5df9e9,_0x76170e,_0x793954['app']['metadataCache'],_0x793954['template']['obNoteProps']);if(!_0x5f564c)continue;((yield Utils['isFileExists'](_0x793954['app']['vault'],_0x5f564c))||(yield _0x793954['app']['vault']['rename'](_0x5089c1,_0x5f564c),_0x5089c1=yield _0x793954['app']['vault']['getAbstractFileByPath'](_0x5f564c)),_0x5089c1&&_0x5089c1 instanceof obsidian.TFile)&&(((null===(_0x1b66b1=_0x793954['app']['metadataCache']['getFileCache'](_0x5089c1))||void 0x0===_0x1b66b1?void 0x0:_0x1b66b1['frontmatter'])||{})[_0x408001]!==_0x5df9e9&&(yield _0x793954['app']['fileManager']['processFrontMatter'](_0x5089c1,_0x458f37=>{_0x458f37[_0x408001]=_0x5df9e9;}))),_0x1ee30f=!0x0,_0x2986b6++,_0x793954['settings']['notePaths'][_0x5df9e9]=_0x5f564c,logger({'msg':'migrate\x20file','filePath':_0x76170e,'fp':_0x5df9e9,'fnReal':_0x5f564c});}_0x1ee30f&&_0x793954['saveSettings'](),_0x793954['notice']('Migrate\x20done,\x20move\x20'+_0x2986b6+'\x20files',!0x0,0x4,!0x0);});}}),this['addCommand']({'id':'openinwucai','name':'Open\x20this\x20Note\x20in\x20WuCai','editorCallback':(_0x33b8dd,_0x55a136)=>__awaiter(this,void 0x0,void 0x0,function*(){if(!_0x793954['checkLogin']())return;const _0x52cdaf=yield _0x793954['tryGetNoteIdX'](_0x55a136['file']['path']);if(!_0x52cdaf)return void _0x793954['notice']('error,\x20noteid\x20is\x20EMPTY',!0x0,0x4,!0x0);const _0x4092ea=_0x793954['myurl']+('/#/?noteidx='+_0x52cdaf);window['open'](_0x4092ea);})}),this['addCommand']({'id':'syncoff','name':'Turn\x20off\x20sync\x20for\x20this\x20file','editorCallback':(_0x11987d,_0x3d4cec)=>__awaiter(this,void 0x0,void 0x0,function*(){if(!_0x793954['checkLogin']())return;const _0x573e00=yield _0x793954['tryGetNoteIdX'](_0x3d4cec['file']['path']);if(_0x573e00)try{_0x793954['callApi']('/syncstatus',{'noteid':_0x573e00,'status':0x2})['then'](function(_0x1d78aa){return __awaiter(this,void 0x0,void 0x0,function*(){if(!_0x1d78aa||!_0x1d78aa['ok'])return logger({'msg':'WuCai\x20Official\x20plugin:\x20bad\x20response\x20in\x20delete\x20server\x20note:\x20','rsp':_0x1d78aa}),void _0x793954['handleSyncError'](null,_0x793954['getErrorFromRsp'](_0x1d78aa));let _0x397257=yield _0x1d78aa['json']();_0x793954['checkResponseBody'](null,_0x397257)||_0x793954['notice']('update\x20sync\x20status\x20success,\x20Now\x20is\x20OFF',!0x0,0x4,!0x0);});});}catch(_0x4717d0){logger({'msg':'WuCai\x20Official\x20plugin:\x20update\x20sync\x20status\x20error\x20','e':_0x4717d0});}else _0x793954['notice']('error,\x20noteid\x20is\x20EMPTY',!0x0,0x4,!0x0);})}),this['addCommand']({'id':'syncon','name':'Turn\x20on\x20sync\x20for\x20this\x20file','editorCallback':(_0xb878c4,_0xafeebb)=>__awaiter(this,void 0x0,void 0x0,function*(){if(!_0x793954['checkLogin']())return;const _0x1fc033=yield _0x793954['tryGetNoteIdX'](_0xafeebb['file']['path']);if(_0x1fc033)try{_0x793954['callApi']('/syncstatus',{'noteid':_0x1fc033,'status':0x1})['then'](function(_0x5c1012){return __awaiter(this,void 0x0,void 0x0,function*(){if(!_0x5c1012||!_0x5c1012['ok'])return logger({'msg':'WuCai\x20Official\x20plugin:\x20bad\x20response\x20in\x20delete\x20server\x20note:\x20','rsp':_0x5c1012}),void _0x793954['handleSyncError'](null,_0x793954['getErrorFromRsp'](_0x5c1012));let _0x4ca548=yield _0x5c1012['json']();_0x793954['checkResponseBody'](null,_0x4ca548)||_0x793954['notice']('update\x20sync\x20status\x20success,\x20Now\x20is\x20ON',!0x0,0x4,!0x0);});});}catch(_0xe8c675){logger({'msg':'WuCai\x20Official\x20plugin:\x20update\x20sync\x20status\x20error\x20','e':_0xe8c675});}else _0x793954['notice']('error,\x20noteid\x20is\x20EMPTY',!0x0,0x4,!0x0);})}),this['addCommand']({'id':'archive','name':'Archive\x20this\x20file','editorCallback':(_0xdd7975,_0x1283b5)=>__awaiter(this,void 0x0,void 0x0,function*(){if(!_0x793954['checkLogin']())return;const _0x312d72=yield _0x793954['tryGetNoteIdX'](_0x1283b5['file']['path']);if(_0x312d72)try{_0x793954['callApi']('/archive',{'noteid':_0x312d72})['then'](function(_0x5beb10){return __awaiter(this,void 0x0,void 0x0,function*(){if(!_0x5beb10||!_0x5beb10['ok'])return logger({'msg':'WuCai\x20Official\x20plugin:\x20bad\x20response\x20in\x20delete\x20server\x20note:\x20','rsp':_0x5beb10}),void _0x793954['handleSyncError'](null,_0x793954['getErrorFromRsp'](_0x5beb10));let _0x46b631=yield _0x5beb10['json']();_0x793954['checkResponseBody'](null,_0x46b631)||_0x793954['notice']('archive\x20file\x20success',!0x0,0x4,!0x0);});});}catch(_0x58f23a){logger({'msg':'WuCai\x20Official\x20plugin:\x20archive\x20note,\x20error\x20','e':_0x58f23a});}else _0x793954['notice']('error,\x20noteid\x20is\x20EMPTY',!0x0,0x4,!0x0);})}),this['addCommand']({'id':'deletefromserver','name':'Delete\x20this\x20file\x20from\x20server','editorCallback':(_0x429e9b,_0x2ab8b9)=>__awaiter(this,void 0x0,void 0x0,function*(){if(!_0x793954['checkLogin']())return;const _0x13198b=yield _0x793954['tryGetNoteIdX'](_0x2ab8b9['file']['path']);if(_0x13198b)try{_0x793954['callApi']('/delete',{'noteid':_0x13198b})['then'](function(_0x36fd5b){return __awaiter(this,void 0x0,void 0x0,function*(){if(!_0x36fd5b||!_0x36fd5b['ok'])return logger({'msg':'WuCai\x20Official\x20plugin:\x20bad\x20response\x20in\x20delete\x20server\x20note:\x20','rsp':_0x36fd5b}),void _0x793954['handleSyncError'](null,_0x793954['getErrorFromRsp'](_0x36fd5b));let _0x387d19=yield _0x36fd5b['json']();_0x793954['checkResponseBody'](null,_0x387d19)||_0x793954['notice']('delete\x20file\x20success',!0x0,0x4,!0x0);});});}catch(_0xaa727e){logger({'msg':'WuCai\x20Official\x20plugin:\x20delete\x20server\x20note,\x20error\x20','e':_0xaa727e});}else _0x793954['notice']('error,\x20noteid\x20is\x20EMPTY',!0x0,0x4,!0x0);})}),this['addRibbonIcon']('zap','Start\x20WuCai\x20syncing',_0x5b6593=>{this['checkLogin']()&&this['startSync']();}),this['addSettingTab'](new WuCaiSettingTab(this['app'],this)),yield this['configureSchedule'](),this['isSyncing']=!0x1,this['settings']['token']&&this['settings']['triggerOnLoad']&&!this['isSyncing']){const _0x2e52e7=this['app']['vault']['getAbstractFileByPath'](this['settings']['wuCaiDir']);!(_0x2e52e7&&_0x2e52e7 instanceof obsidian.TFolder)?this['app']['workspace']['onLayoutReady'](()=>{logger(['onload\x20last\x20cursor\x201',this['settings']['lastCursor'],this['isSyncing']]),this['startSync']('onload\x20+\x20not\x20exists');}):this['startSync']('onload\x20+\x20exists\x202');}});}['onunload'](){this['stopSyncing']=!0x0,logger({'msg':'unload\x20WuCai\x20plugin'});}['loadSettings'](){return __awaiter(this,void 0x0,void 0x0,function*(){this['settings']=Object['assign']({},DefaultSettings,yield this['loadData']()),this['template']=new Templates();let _0xb87ddd=this['settings']['region'];!_0xb87ddd&&this['settings']['token']&&(_0xb87ddd=Utils['getRegionFromToken'](this['settings']['token'])),this['initRegion'](_0xb87ddd);});}['saveSettings'](){return __awaiter(this,void 0x0,void 0x0,function*(){yield this['saveData'](this['settings']);});}['resetClientID'](){return window['localStorage']['setItem']('wc-ObsidianClientId',''),this['getClientID']();}['getClientID'](){let _0x322a41=window['localStorage']['getItem']('wc-ObsidianClientId')||'';return _0x322a41&&_0x322a41['length']>0x0||(_0x322a41=Math['random']()['toString'](0x24)['substring'](0x2,0xf)+Math['random']()['toString'](0x24)['substring'](0x2,0xf),window['localStorage']['setItem']('wc-ObsidianClientId',_0x322a41)),_0x322a41;}['updateProfile'](_0x39fc2b,_0x4a5921,_0x28c89e){return __awaiter(this,void 0x0,void 0x0,function*(){this['settings']['token']=_0x39fc2b||'',this['initRegion'](_0x4a5921);const _0x484939=yield this['callApi']('/profile',{'serviceId':BGCONSTS['SID']});if(!_0x484939||!_0x484939['ok'])return this['settings']['token']='',void this['resetRegion']();const _0x558cee=yield _0x484939['json']();_0x558cee&&_0x558cee['data']&&_0x558cee['data']['useridx']?(this['settings']['useridx']=_0x558cee['data']['useridx']||'',this['saveSettings'](),_0x28c89e&&_0x28c89e()):(this['settings']['token']='',this['resetRegion'](),this['saveSettings'](),new obsidian.Notice(_0x558cee?_0x558cee['message']:'Login\x20failed'));});}}class ConfirmDialog extends obsidian.Modal{constructor(_0x2871fa,_0x5316a3){super(_0x2871fa),this['args']=_0x5316a3;}['onOpen'](){const {contentEl:_0xdeeb}=this;_0xdeeb['createEl']('h2',{'text':this['args']['title']}),_0xdeeb['createEl']('p',{'text':this['args']['msg']});const _0x6f434d=_0xdeeb['createDiv']();_0x6f434d['addClass']('dialogbtns');const _0x204753=_0x6f434d['createEl']('button',{'text':'Cancel'});_0x6f434d['createEl']('button',{'text':'OK'})['onclick']=()=>{this['args']['onok']&&this['args']['onok'](),this['close']();},_0x204753['onclick']=()=>{this['args']['oncancel']&&this['args']['oncancel'](),this['close']();};}['onClose'](){const {contentEl:_0x296dce}=this;_0x296dce['empty']();}}class WuCaiSettingTab extends obsidian.PluginSettingTab{constructor(_0x1e2f7c,_0x2206bf){super(_0x1e2f7c,_0x2206bf),this['plugin']=_0x2206bf,this['plugin']['isSyncing']=!0x1;}['display'](){let _0x50445c=this['plugin']['getClientID']()||'',{containerEl:_0x5b2bfa}=this;_0x5b2bfa['empty'](),_0x5b2bfa['createEl']('h1',{'text':'WuCai\x20Highlights\x20Official'}),_0x5b2bfa['createEl']('p',{'text':'Created\x20by\x20WuCai'}),_0x5b2bfa['getElementsByTagName']('p')[0x0]['appendText'](',\x20version\x20'+BGCONSTS['VERSION']),_0x5b2bfa['createEl']('h2',{'text':'Settings'});let _0xfff0a8=this['plugin']['settings']['token'];if(_0xfff0a8&&_0xfff0a8['length']>0x0){const _0x54d8b9=Utils['getRegionFromToken'](_0xfff0a8);this['plugin']['initRegion'](_0x54d8b9);let _0xdfadcd='Start\x20Syncing';this['plugin']['isSyncing']&&(_0xdfadcd='Syncing\x20...'),new obsidian.Setting(_0x5b2bfa)['setName']('Sync\x20your\x20WuCai\x20data\x20with\x20Obsidian')['setDesc']('On\x20first\x20sync,\x20the\x20WuCai\x20plugin\x20will\x20create\x20a\x20new\x20folder\x20containing\x20all\x20your\x20highlights')['setClass']('wc-setting-sync')['addButton'](_0x1d795a=>{_0x1d795a['setCta']()['setTooltip']('Once\x20the\x20sync\x20begins,\x20you\x20can\x20close\x20this\x20plugin\x20page')['setButtonText'](_0xdfadcd)['onClick'](()=>__awaiter(this,void 0x0,void 0x0,function*(){this['plugin']['isSyncing']?new obsidian.Notice('WuCai\x20sync\x20already\x20in\x20progress'):(this['plugin']['stopSyncing']=!0x1,this['plugin']['clearInfoStatus'](_0x5b2bfa),yield this['plugin']['saveData'](this['plugin']['settings']),_0x1d795a['setButtonText']('Syncing...'),this['plugin']['startSync']('click\x20sync',_0x1d795a));}));});let _0x2d5f43=_0x5b2bfa['createEl']('div',{'cls':'wc-info-container'});_0x5b2bfa['find']('.wc-setting-sync\x20>\x20.setting-item-control\x20')['prepend'](_0x2d5f43),new obsidian.Setting(_0x5b2bfa)['setName']('Customize\x20formatting\x20options')['setDesc']('You\x20can\x20customize\x20which\x20items\x20export\x20to\x20Obsidian\x20and\x20how\x20they\x20appear\x20from\x20the\x20WuCai\x20website')['addButton'](_0x2e1e16=>{_0x2e1e16['setButtonText']('Customize')['onClick'](()=>{window['open'](this['plugin']['myurl']+'/page/plugins/obsidian/preferences');});}),new obsidian.Setting(_0x5b2bfa)['setName']('Customize\x20base\x20folder')['setDesc']('By\x20default,\x20the\x20plugin\x20will\x20save\x20all\x20your\x20highlights\x20into\x20a\x20folder\x20named\x20WuCai')['addText'](_0x4ba2db=>_0x4ba2db['setPlaceholder']('Defaults\x20to:\x20WuCai')['setValue'](this['plugin']['settings']['wuCaiDir'])['onChange'](_0x356292=>__awaiter(this,void 0x0,void 0x0,function*(){this['plugin']['isSyncing']?new obsidian.Notice('WuCai\x20sync\x20already\x20in\x20progress'):(this['plugin']['settings']['wuCaiDir']=obsidian.normalizePath(_0x356292||'WuCai'),yield this['plugin']['saveSettings']());}))),new obsidian.Setting(_0x5b2bfa)['setName']('Configure\x20resync\x20frequency')['setDesc']('If\x20not\x20set\x20to\x20Manual,\x20WuCai\x20will\x20automatically\x20resync\x20with\x20Obsidian\x20when\x20the\x20app\x20is\x20open\x20at\x20the\x20specified\x20interval')['addDropdown'](_0x2bd8c9=>{_0x2bd8c9['addOption']('0','Manual'),_0x2bd8c9['addOption']('180','Every\x203\x20hour'),_0x2bd8c9['addOption'](0x2d0['toString'](),'Every\x2012\x20hours'),_0x2bd8c9['addOption'](0x5a0['toString'](),'Every\x2024\x20hours'),_0x2bd8c9['setValue'](this['plugin']['settings']['frequency']),_0x2bd8c9['onChange'](_0x56094f=>{this['plugin']['settings']['frequency']=_0x56094f,this['plugin']['saveSettings'](),this['plugin']['configureSchedule']();});}),new obsidian.Setting(_0x5b2bfa)['setName']('Sync\x20automatically\x20when\x20Obsidian\x20opens')['setDesc']('If\x20enabled,\x20WuCai\x20will\x20automatically\x20resync\x20with\x20Obsidian\x20each\x20time\x20you\x20open\x20the\x20app')['addToggle'](_0x5c8766=>{_0x5c8766['setValue'](this['plugin']['settings']['triggerOnLoad']),_0x5c8766['onChange'](_0x54c076=>{this['plugin']['settings']['triggerOnLoad']=_0x54c076,this['plugin']['saveSettings']();});}),this['plugin']['settings']['lastSyncFailed']&&this['plugin']['showInfoStatus'](_0x5b2bfa['find']('.wc-setting-sync\x20.wc-info-container')['parentElement'],'Last\x20sync\x20failed','wc-error');const _0x8861d4=this['plugin']['settings']['useridx']||'',_0xacd917=Regions[this['plugin']['settings']['region']||'']||{'name':''};new obsidian.Setting(_0x5b2bfa)['setName']('Client\x20ID')['setDesc']('Client\x20id\x20is\x20'+_0x50445c)['addButton'](_0x3e73bd=>{_0x3e73bd['setButtonText']('Dashboard')['setCta']()['onClick'](()=>window['open'](this['plugin']['myurl']));}),new obsidian.Setting(_0x5b2bfa)['setName']('Logout')['setDesc']('Account\x20is\x20'+_0x8861d4+'\x20,\x20region\x20is\x20'+_0xacd917['name'])['addButton'](_0x26ebab=>{_0x26ebab['setButtonText']('Logout')['setClass']('wucai-danger')['setCta']()['onClick'](()=>{const _0x4f1076={'title':'Logout\x20Account','msg':'Sure\x20to\x20logout?','onok':()=>{this['plugin']['logout'](()=>{this['display']();}),new obsidian.Notice('Logout\x20success');}};new ConfirmDialog(this['app'],_0x4f1076)['open']();});});}else {_0x50445c=this['plugin']['resetClientID']();const _0x1b5b14=['为了拥有最快的访问速度,我们在全球部署了多个独立服务,建议选择离你最近的区域,以便获得最佳使用体验。','To\x20achieve\x20the\x20fastest\x20access\x20speed,\x20we\x20have\x20deployed\x20multiple\x20independent\x20services\x20worldwide.\x20It\x20is\x20recommended\x20that\x20you\x20choose\x20the\x20region\x20closest\x20to\x20you\x20to\x20enjoy\x20the\x20optimal\x20user\x20experience.'];new obsidian.Setting(_0x5b2bfa)['setName']('Description')['setDesc'](_0x1b5b14['join']('\x0a\x0a')),new obsidian.Setting(_0x5b2bfa)['setName']('Get\x20your\x20WuCai\x20Sync\x20Token')['setDesc']('Open\x20page,\x20then\x20copy\x20your\x20token')['addDropdown'](_0x12faef=>{_0x12faef['addOption']('','Choose\x20Region'),_0x12faef['addOption']('chn','Asia\x20-\x20亚洲\x20-\x20dotalk.cn'),_0x12faef['addOption']('euro','Europe\x20-\x20欧洲\x20-\x20wucainote.com'),_0x12faef['addOption']('us','America\x20-\x20北美\x20-\x20wucainote.com'),_0x12faef['onChange'](_0x49a1a7=>{if(!_0x49a1a7)return;const _0x5bce81=Regions[_0x49a1a7];if(!_0x5bce81||!_0x5bce81['my'])return;const _0x582076=_0x5bce81['my']+'/#/personSetting/synctoken?type='+BGCONSTS['SID'];window['open'](_0x582076,'_blank');});});let _0x5a7e8c='';new obsidian.Setting(_0x5b2bfa)['setName']('Paste\x20your\x20Token')['addTextArea'](_0xff18ca=>{_0xff18ca['inputEl']['rows']=0x6,_0xff18ca['inputEl']['cols']=0x30,_0xff18ca['setValue'](_0xfff0a8),_0xff18ca['onChange'](_0x4189a4=>{_0x5a7e8c=_0x4189a4;});}),new obsidian.Setting(_0x5b2bfa)['setName']('Login\x20to\x20WuCai\x20Highlight')['setClass']('wc-setting-connect')['addButton'](_0x57d68c=>{_0x57d68c['setButtonText']('Login')['setCta']()['onClick'](_0x29a5a6=>__awaiter(this,void 0x0,void 0x0,function*(){if(!_0x5a7e8c)return void new obsidian.Notice('Please\x20input\x20your\x20token');const _0x16fd7f=Utils['getRegionFromToken'](_0x5a7e8c);_0x16fd7f?(this['plugin']['initRegion'](_0x16fd7f),this['plugin']['updateProfile'](_0x5a7e8c,_0x16fd7f,()=>{this['display']();})):new obsidian.Notice('Error\x20Sync\x20Token');}));});let _0x31b3d9=_0x5b2bfa['createEl']('div',{'cls':'wc-info-container'});_0x5b2bfa['find']('.wc-setting-connect\x20>\x20.setting-item-control\x20')['prepend'](_0x31b3d9);}_0x5b2bfa['createEl']('p')['innerHTML']='Question?\x20Please\x20see\x20our\x20feedback\x20or\x20view\x20changelog';}} module.exports = WuCaiPlugin; /* nosourcemap */