1
0
Fork 0
obsidian-vault-starter/.obsidian/plugins/obsidian-tasks-plugin/main.js

227 lines
434 KiB
JavaScript
Raw Normal View History

/*
2022-04-07 16:18:07 +00:00
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
/*
License obsidian-tasks:
MIT License
2023-03-29 16:30:35 +00:00
Copyright (c) 2021 Martin Schenck and Clare Macrae
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
License rrule (included library):
rrule.js: Library for working with recurrence rules for calendar dates.
=======================================================================
Copyright 2010, Jakub Roztocil <jakub@roztocil.name> and Lars Schöning
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of The author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
./rrule.js and ./test/tests.js is based on python-dateutil. LICENCE:
python-dateutil - Extensions to the standard Python datetime module.
====================================================================
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
License chrono-node (included library):
The MIT License
Copyright (c) 2014, Wanasit Tanakitrungruang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
2023-04-21 15:21:53 +00:00
"use strict";var kk=Object.create;var Bi=Object.defineProperty,Dk=Object.defineProperties,Ek=Object.getOwnPropertyDescriptor,Sk=Object.getOwnPropertyDescriptors,Ok=Object.getOwnPropertyNames,tm=Object.getOwnPropertySymbols,Mk=Object.getPrototypeOf,nm=Object.prototype.hasOwnProperty,Rk=Object.prototype.propertyIsEnumerable;var rm=(r,e,t)=>e in r?Bi(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ae=(r,e)=>{for(var t in e||(e={}))nm.call(e,t)&&rm(r,t,e[t]);if(tm)for(var t of tm(e))Rk.call(e,t)&&rm(r,t,e[t]);return r},tr=(r,e)=>Dk(r,Sk(e));var S=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),xk=(r,e)=>{for(var t in e)Bi(r,t,{get:e[t],enumerable:!0})},sm=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ok(e))!nm.call(r,s)&&s!==t&&Bi(r,s,{get:()=>e[s],enumerable:!(n=Ek(e,s))||n.enumerable});return r};var Fn=(r,e,t)=>(t=r!=null?kk(Mk(r)):{},sm(e||!r||!r.__esModule?Bi(t,"default",{value:r,enumerable:!0}):t,r)),Pk=r=>sm(Bi({},"__esModule",{value:!0}),r);var J=(r,e,t)=>new Promise((n,s)=>{var a=c=>{try{l(t.next(c))}catch(f){s(f)}},o=c=>{try{l(t.throw(c))}catch(f){s(f)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);l((t=t.apply(r,e)).next())});var Ie=S(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.matchAnyPattern=Ln.extractTerms=Ln.repeatedTimeunitPattern=void 0;function Ik(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}Ln.repeatedTimeunitPattern=Ik;function im(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}Ln.extractTerms=im;function Fk(r){return`(?:${im(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}Ln.matchAnyPattern=Fk});var Re=S((Il,Fl)=>{(function(r,e){typeof Il=="object"&&typeof Fl!="undefined"?Fl.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(Il,function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",s="second",a="minute",o="hour",l="day",c="week",f="month",p="quarter",g="year",T="date",O="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},$=function(V,q,P){var Q=String(V);return!Q||Q.length>=q?V:""+Array(q+1-Q.length).join(P)+V},B={s:$,z:function(V){var q=-V.utcOffset(),P=Math.abs(q),Q=Math.floor(P/60),Y=P%60;return(q<=0?"+":"-")+$(Q,2,"0")+":"+$(Y,2,"0")},m:function V(q,P){if(q.date()<P.date())return-V(P,q);var Q=12*(P.year()-q.year())+(P.month()-q.month()),Y=q.clone().add(Q,f),oe=P-Y<0,y=q.clone().add(Q+(oe?-1:1),f);return+(-(Q+(P-Y)/(oe?Y-y:y-Y))||0)},a:function(V){return V<0?Math.ceil(V)||0:Math.floor(V)},p:function(V){return{M:f,y:g,w:c,d:l,D:T,h:o,m:a,s,ms:n,Q:p}[V]||String(V||"").toLowerCase().replace(/s$/,"")},u:function(V){return V===void 0}},W="en",ke={};ke[W]=C;var Te=function(V){return V instanceof It},be=function(V,q,P){var Q;if(!V)return W;if(typeof V=="string")ke[V]&&(Q=V),q&&(ke[V]=q,Q=V);else{var Y=V.name;ke[Y]=V,Q=Y}return!P&&Q&&(W=Q),Q||!P&&W},ee=function(V,q){if(Te(V))return V.clone();var P=typeof q=="object"?q:{};return P.date=V,P.args=arguments,new It(P)},ne=B;ne.l=be,ne.i=Te,ne.w=function(V,q){return ee(V,{locale:q.$L,utc:q.$u,x:q.$x,$offset:q.$offset})};var It=function(){function V(P){this.$L=be(P.locale,null,!0),this.parse(P)}var q=V.prototype;return q.parse=function(P){this.$d=function(Q){var Y=Q.date,oe=Q.utc;if(Y===null)return new Date(NaN);if(ne.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var y=Y.match(v);if(y){var _=y[2]-1||0,w=(y[7]||"0").substring(0,3);return oe?new Date(Date.UTC(y[1],_,y[3]||1,y[4]||0,y[5]||0,y[6]||0,w)):new Date(y[1],_,y[3]||1,y[4]||0,y[5]||0,y[6]||0,w)}}return new Date(Y)}(P),this.$x=P.x||{}
[`+b+"] ";for(x in arguments[0])a(arguments[0],x)&&(m+=x+": "+arguments[0][x]+", ");m=m.slice(0,-2)}else m=arguments[b];h.push(m)}ee(i+`
Arguments: `+Array.prototype.slice.call(h).join("")+`
`+new Error().stack),d=!1}return u.apply(this,arguments)},u)}var It={};function yt(i,u){e.deprecationHandler!=null&&e.deprecationHandler(i,u),It[i]||(ee(u),It[i]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function V(i){return typeof Function!="undefined"&&i instanceof Function||Object.prototype.toString.call(i)==="[object Function]"}function q(i){var u,d;for(d in i)a(i,d)&&(u=i[d],V(u)?this[d]=u:this["_"+d]=u);this._config=i,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function P(i,u){var d=g({},i),h;for(h in u)a(u,h)&&(s(i[h])&&s(u[h])?(d[h]={},g(d[h],i[h]),g(d[h],u[h])):u[h]!=null?d[h]=u[h]:delete d[h]);for(h in i)a(i,h)&&!a(u,h)&&s(i[h])&&(d[h]=g({},d[h]));return d}function Q(i){i!=null&&this.set(i)}var Y;Object.keys?Y=Object.keys:Y=function(i){var u,d=[];for(u in i)a(i,u)&&d.push(u);return d};var oe={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function y(i,u,d){var h=this._calendar[i]||this._calendar.sameElse;return V(h)?h.call(u,d):h}function _(i,u,d){var h=""+Math.abs(i),m=u-h.length,b=i>=0;return(b?d?"+":"":"-")+Math.pow(10,Math.max(0,m)).toString().substr(1)+h}var w=/(\[[^\[]*\])|(\\)?([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,k=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,E={},M={};function D(i,u,d,h){var m=h;typeof h=="string"&&(m=function(){return this[h]()}),i&&(M[i]=m),u&&(M[u[0]]=function(){return _(m.apply(this,arguments),u[1],u[2])}),d&&(M[d]=function(){return this.localeData().ordinal(m.apply(this,arguments),i)})}function I(i){return i.match(/\[[\s\S]/)?i.replace(/^\[|\]$/g,""):i.replace(/\\/g,"")}function A(i){var u=i.match(w),d,h;for(d=0,h=u.length;d<h;d++)M[u[d]]?u[d]=M[u[d]]:u[d]=I(u[d]);return function(m){var b="",x;for(x=0;x<h;x++)b+=V(u[x])?u[x].call(m,i):u[x];return b}}function N(i,u){return i.isValid()?(u=j(u,i.localeData()),E[u]=E[u]||A(u),E[u](i)):i.localeData().invalidDate()}function j(i,u){var d=5;function h(m){return u.longDateFormat(m)||m}for(k.lastIndex=0;d>=0&&k.test(i);)i=i.replace(k,h),k.lastIndex=0,d-=1;return i}var De={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"};function pe(i){var u=this._longDateFormat[i],d=this._longDateFormat[i.toUpperCase()];return u||!d?u:(this._longDateFormat[i]=d.match(w).map(function(h){return h==="MMMM"||h==="MM"||h==="DD"||h==="dddd"?h.slice(1):h}).join(""),this._longDateFormat[i])}var le="Invalid date";function Ce(){return this._invalidDate}var K="%d",qe=/\d{1,2}/;function Xe(i){return this._ordinal.replace("%d",i)}var ct={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"};function Or(i,u,d,h){var m=this._relativeTime[d];return V(m)?m(i,u,d,h):m.replace(/%d/i,i)}function it(i,u){var d=this._relativeTime[i>0?"future":"past"];return V(d)?d(u):d.replace(/%s/i,u)}var je={};function dt(i,u){var d=i.toLowerCase();je[d]=je[d+"s"]=je[u]=i}function gt(i){return typeof i=="string"?je[i]||je[i.toLowerCase()]:void 0}function Mn(i){var u={},d,h;for(h in i)a(i,h)&&(d=gt(h),d&&(u[d]=i[h]));return u}var Li={};function $e(i,u){Li[i]=u}function qs(i){var u=[],d;for(d in i)a(i,d)&&u.push({unit:d,priority:Li[d]});return u.sort(function(h,m){return h.priority-m.priority}),u}function ts(i){return i%4===0&&i%100!==0||i%400===0}function ft(i){return i<0?Math.ceil(i)||0:Math.floor(i)}function ce(i){var u=+i,d=0;return u!==0&&isFinite(u)&&(d=ft(u)),d}function Jr(i,u){return function(d){return d!=null?(rs(this,i,d),e.updateOffset(this,u),this):Rt(this,i)}}function Rt(i,u){return i.isValid()?i._d["get"+(i._isUTC?"UTC":"")+u]():NaN}function rs(i,u,d){i.isValid()&&!isNaN(d)&&(u==="FullYear"&&ts(i.ye
`).map(aI).filter(function(t){return t!==null});return Ht(Ht({},e[0]),e[1])}function Ka(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],s=t[2];return n&&(e.tzid=n),e.dtstart=se.untilStringToDate(s),e}function aI(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return hb(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return hb(r);case"DTSTART":return Ka(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function hb(r){var e=r.replace(/^RRULE:/i,""),t=Ka(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(s){var a=s.split("="),o=a[0],l=a[1];switch(o.toUpperCase()){case"FREQ":t.freq=_e[l.toUpperCase()];break;case"WKST":t.wkst=Dr[l.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var c=oI(l),f=o.toLowerCase();t[f]=c;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=uI(l);break;case"DTSTART":case"TZID":var p=Ka(r);t.tzid=p.tzid,t.dtstart=p.dtstart;break;case"UNTIL":t.until=se.untilStringToDate(l);break;case"BYEASTER":t.byeaster=Number(l);break;default:throw new Error("Unknown RRULE property '"+o+"'")}}),t}function oI(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(pb)}return pb(r)}function pb(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function uI(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Dr[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!n||n.length<3)throw new SyntaxError("Invalid weekday string: ".concat(t));var s=Number(n[1]),a=n[2],o=Dr[a].weekday;return new lt(o,s)})}var ks=function(){function r(e,t){if(isNaN(e.getTime()))throw new RangeError("Invalid date passed to DateWithZone");this.date=e,this.tzid=t}return Object.defineProperty(r.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!1,configurable:!0}),r.prototype.toString=function(){var e=se.timeToUntilString(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(e):";TZID=".concat(this.tzid,":").concat(e)},r.prototype.getTime=function(){return this.date.getTime()},r.prototype.rezonedDate=function(){var e;if(this.isUTC)return this.date;var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=new Date(this.date.toLocaleString(void 0,{timeZone:t})),s=new Date(this.date.toLocaleString(void 0,{timeZone:(e=this.tzid)!==null&&e!==void 0?e:"UTC"})),a=s.getTime()-n.getTime();return new Date(this.date.getTime()-a)},r}();function Xa(r){for(var e=[],t="",n=Object.keys(r),s=Object.keys(Va),a=0;a<n.length;a++)if(n[a]!=="tzid"&&!!Ee(s,n[a])){var o=n[a].toUpperCase(),l=r[n[a]],c="";if(!(!He(l)||Nt(l)&&!l.length)){switch(o){case"FREQ":c=X.FREQUENCIES[r.freq];break;case"WKST":ar(l)?c=new lt(l).toString():c=l.toString();break;case"BYWEEKDAY":o="BYDAY",c=CT(l).map(function(O){return O instanceof lt?O:Nt(O)?new lt(O[0],O[1]):new lt(O)}).toString();break;case"DTSTART":t=lI(l,r.tzid);break;case"UNTIL":c=se.timeToUntilString(l,!r.tzid);break;default:if(Nt(l)){for(var f=[],p=0;p<l.length;p++)f[p]=String(l[p]);c=f.toString()}else c=String(l)}c&&e.push([o,c])}}var g=e.map(function(O){var v=O[0],R=O[1];return"".concat(v,"=").concat(R.toString())}).join(";"),T="";return g!==""&&(T="RRULE:".concat(g)),[t,T].filter(function(O){return!!O}).join(`
`)}function lI(r,e){return r?"DTSTART"+new ks(new Date(r),e).toString():""}function cI(r,e){return Array.isArray(r)?!Array.isArray(e)||r.length!==e.length?!1:r.every(function(t,n){return t.getTime()===e[n].getTime()}):r instanceof Date?e instanceof Date&&r.getTime()===e.getTime():r===e}var mb=function(){function r(){this.all=!1,this.before=[],this.after=[],this.between=[]}return r.prototype._cacheAdd=function(e,t,n){t&&(t=t instanceof Date?se.clone(t):se.cloneDates(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,s=t?Object.keys(t):[],a=function(p){for(var g=0;g<s.length;g++){var T=s[g];if(!cI(t[T],p[T]))return!0}return!1},o=this[e];if(e==="all")n=this.all;else if(Nt(o))for(var l=0;l<o.length;l++){var c=o[l];if(!(s.length&&a(c))){n=c._value;break}}if(!n&&this.all){for(var f=new _n(e,t),l=0;l<this.all.length&&f.accept(this.all[l]);l++);n=f.getValue(),this._cacheAdd(e,n,t)}return Nt(n)?se.cloneDates(n):n instanceof Date?se.clone(n):n},r}();var yb=U(U(U(U(U(U(U(U(U(U(U(U(U([],we(1,31),!0),we(2,28),!0),we(3,31),!0),we(4,30),!0),we(5,31),!0),we(6,30),!0),we(7,31),!0),we(8,31),!0),we(9,30),!0),we(10,31),!0),we(11,30),!0),we(12,31),!0),we(1,7),!0),gb=U(U(U(U(U(U(U(U(U(U(U(U(U([],we(1,31),!0),we(2,29),!0),we(3,31),!0),we(4,30),!0),we(5,31),!0),we(6,30),!0),we(7,31),!0),we(8,31),!0),we(9,30),!0),we(10,31),!0),we(11,30),!0),we(12,31),!0),we(1,7),!0),dI=kr(1,29),fI=kr(1,30),Bn=kr(1,31),Yt=kr(1,32),_b=U(U(U(U(U(U(U(U(U(U(U(U(U([],Yt,!0),fI,!0),Yt,!0),Bn,!0),Yt,!0),Bn,!0),Yt,!0),Yt,!0),Bn,!0),Yt,!0),Bn,!0),Yt,!0),Yt.slice(0,7),!0),Tb=U(U(U(U(U(U(U(U(U(U(U(U(U([],Yt,!0),dI,!0),Yt,!0),Bn,!0),Yt,!0),Bn,!0),Yt,!0),Yt,!0),Bn,!0),Yt,!0),Bn,!0),Yt,!0),Yt.slice(0,7),!0),hI=kr(-28,0),pI=kr(-29,0),Hn=kr(-30,0),Ut=kr(-31,0),bb=U(U(U(U(U(U(U(U(U(U(U(U(U([],Ut,!0),pI,!0),Ut,!0),Hn,!0),Ut,!0),Hn,!0),Ut,!0),Ut,!0),Hn,!0),Ut,!0),Hn,!0),Ut,!0),Ut.slice(0,7),!0),vb=U(U(U(U(U(U(U(U(U(U(U(U(U([],Ut,!0),hI,!0),Ut,!0),Hn,!0),Ut,!0),Hn,!0),Ut,!0),Ut,!0),Hn,!0),Ut,!0),Hn,!0),Ut,!0),Ut.slice(0,7),!0),wb=[0,31,60,91,121,152,182,213,244,274,305,335,366],kb=[0,31,59,90,120,151,181,212,243,273,304,334,365],xh=function(){for(var r=[],e=0;e<55;e++)r=r.concat(kr(7));return r}();function Db(r,e){var t=new Date(Date.UTC(r,0,1)),n=se.isLeapYear(r)?366:365,s=se.isLeapYear(r+1)?366:365,a=se.toOrdinal(t),o=se.getWeekday(t),l=Ht(Ht({yearlen:n,nextyearlen:s,yearordinal:a,yearweekday:o},mI(r)),{wnomask:null});if(or(e.byweekno))return l;l.wnomask=we(0,n+7);var c,f,p=c=Lt(7-o+e.wkst,7);p>=4?(p=0,f=l.yearlen+Lt(o-e.wkst,7)):f=n-p;for(var g=Math.floor(f/7),T=Lt(f,7),O=Math.floor(g+T/4),v=0;v<e.byweekno.length;v++){var R=e.byweekno[v];if(R<0&&(R+=O+1),R>0&&R<=O){var C=void 0;R>1?(C=p+(R-1)*7,p!==c&&(C-=7-c)):C=p;for(var $=0;$<7&&(l.wnomask[C]=1,C++,l.wdaymask[C]!==e.wkst);$++);}}if(Ee(e.byweekno,1)){var C=p+O*7;if(p!==c&&(C-=7-c),C<n)for(var v=0;v<7&&(l.wnomask[C]=1,C+=1,l.wdaymask[C]!==e.wkst);v++);}if(p){var B=void 0;if(Ee(e.byweekno,-1))B=-1;else{var W=se.getWeekday(new Date(Date.UTC(r-1,0,1))),ke=Lt(7-W.valueOf()+e.wkst,7),Te=se.isLeapYear(r-1)?366:365,be=void 0;ke>=4?(ke=0,be=Te+Lt(W-e.wkst,7)):be=n-p,B=Math.floor(52+Lt(be,7)/4)}if(Ee(e.byweekno,B))for(var C=0;C<p;C++)l.wnomask[C]=1}return l}function mI(r){var e=se.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=se.getWeekday(t);return e===365?{mmask:yb,mdaymask:Tb,nmdaymask:vb,wdaymask:xh.slice(n),mrange:kb}:{mmask:gb,mdaymask:_b,nmdaymask:bb,wdaymask:xh.slice(n),mrange:wb}}function Eb(r,e,t,n,s,a){var o={lastyear:r,lastmonth:e,nwdaymask:[]},l=[];if(a.freq===X.YEARLY)if(or(a.bymonth))l=[[0,t]];else for(var c=0;c<a.bymonth.length;c++)e=a.bymonth[c],l.push(n.slice(e-1,e+1));else a.freq===X.MONTHLY&&(l=[n.slice(e-1,e+1)]);if(or(l))return o;o.nwdaymask=we(0,t);for(var c=0;c<l.length;c++)for(var f=l[c],p=f[0],g=f[1]-1,T=0;T<a.bynweekday.length;T++){var O=void 0,v=a.bynweekday[T],R=v[0],C=v[1];C<0?(O=g+(C+1)*7,O-=Lt(s[O]-R,7)):(O=p+(C-1)*7,O+=Lt(7-s[O]+R,7)),p<=O&&O<=g&&(o.nwdaymask[O]=1)}return o}function Sb(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),s=r%100,a=M
`),n=0;n<t.length;){var s=t[n]=t[n].replace(/\s+$/g,"");s?n>0&&s[0]===" "?(t[n-1]+=s.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function SI(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Ab(r,e){return SI(e),r.split(",").map(function(t){return se.untilStringToDate(t)})}function Nb(r){var e=this;return function(t){if(t!==void 0&&(e["_".concat(r)]=t),e["_".concat(r)]!==void 0)return e["_".concat(r)];for(var n=0;n<e._rrule.length;n++){var s=e._rrule[n].origOptions[r];if(s)return s}}}var Ah=function(r){mi(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=Nb.apply(n,["dtstart"]),n.tzid=Nb.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return xb(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){Cb(t,this._rrule)},e.prototype.exrule=function(t){Cb(t,this._exrule)},e.prototype.rdate=function(t){Ib(t,this._rdate)},e.prototype.exdate=function(t){Ib(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return xu(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return xu(t.toString())})},e.prototype.rdates=function(){return this._rdate.map(function(t){return new Date(t.getTime())})},e.prototype.exdates=function(){return this._exdate.map(function(t){return new Date(t.getTime())})},e.prototype.valueOf=function(){var t=[];return!this._rrule.length&&this._dtstart&&(t=t.concat(Xa({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
2022-06-15 22:20:02 +00:00
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
2023-04-21 15:21:53 +00:00
`).map(function(s){return s.replace(/^RRULE:/,"EXRULE:")}).filter(function(s){return!/^DTSTART/.test(s)}))}),this._rdate.length&&t.push(Fb("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(Fb("EXDATE",this._exdate,this.tzid())),t},e.prototype.toString=function(){return this.valueOf().join(`
`)},e.prototype.clone=function(){var t=new e(!!this._cache);return this._rrule.forEach(function(n){return t.rrule(n.clone())}),this._exrule.forEach(function(n){return t.exrule(n.clone())}),this._rdate.forEach(function(n){return t.rdate(new Date(n.getTime()))}),this._exdate.forEach(function(n){return t.exdate(new Date(n.getTime()))}),t},e}(X);function Cb(r,e){if(!(r instanceof X))throw new TypeError(String(r)+" is not RRule instance");Ee(e.map(String),String(r))||e.push(r)}function Ib(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");Ee(e.map(Number),Number(r))||(e.push(r),se.sort(e))}function Fb(r,e,t){var n=!t||t.toUpperCase()==="UTC",s=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),a=e.map(function(o){return se.timeToUntilString(o.valueOf(),n)}).join(",");return"".concat(s).concat(a)}function Hr(r,e){return r!==null&&e===null?-1:r===null&&e!==null?1:r!==null&&e!==null?r.isValid()&&!e.isValid()?-1:!r.isValid()&&e.isValid()||r.isAfter(e)?1:r.isBefore(e)?-1:0:0}var St=class{constructor({rrule:e,baseOnToday:t,referenceDate:n,startDate:s,scheduledDate:a,dueDate:o}){this.rrule=e,this.baseOnToday=t,this.referenceDate=n,this.startDate=s,this.scheduledDate=a,this.dueDate=o}static fromText({recurrenceRuleText:e,startDate:t,scheduledDate:n,dueDate:s}){try{let a=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(a==null)return null;let o=a[1].trim(),l=a[2]!==void 0,c=X.parseText(o);if(c!==null){let f=null;s?f=window.moment(s):n?f=window.moment(n):t&&(f=window.moment(t)),!l&&f!==null?c.dtstart=window.moment(f).startOf("day").utc(!0).toDate():c.dtstart=window.moment().startOf("day").utc(!0).toDate();let p=new X(c);return new St({rrule:p,baseOnToday:l,referenceDate:f,startDate:t,scheduledDate:n,dueDate:s})}}catch(a){}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(){var t;let e;if(this.baseOnToday){let n=window.moment(),s=new X(tr(Ae({},this.rrule.origOptions),{dtstart:n.startOf("day").utc(!0).toDate()}));e=this.nextAfter(n.endOf("day"),s)}else{let n=window.moment((t=this.referenceDate)!=null?t:void 0).endOf("day");e=this.nextAfter(n,this.rrule)}if(e!==null){let n=null,s=null,a=null;if(this.referenceDate){if(this.startDate){let o=window.moment.duration(this.startDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(o.asDays()),"days")}if(this.scheduledDate){let o=window.moment.duration(this.scheduledDate.diff(this.referenceDate));s=window.moment(e),s.add(Math.round(o.asDays()),"days")}if(this.dueDate){let o=window.moment.duration(this.dueDate.diff(this.referenceDate));a=window.moment(e),a.add(Math.round(o.asDays()),"days")}}return{startDate:n,scheduledDate:s,dueDate:a}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||Hr(this.startDate,e.startDate)!==0||Hr(this.scheduledDate,e.scheduledDate)!==0||Hr(this.dueDate,e.dueDate)!==0?!1:this.toText()===e.toText()}nextAfter(e,t){e.utc(!0);let n=window.moment(t.after(e.toDate())),s=this.toText(),a=s.match(/every( \d+)? month(s)?(.*)?/);a!==null&&(s.includes(" on ")||(n=St.nextAfterMonths(e,n,t,a[1])));let o=s.match(/every( \d+)? year(s)?(.*)?/);return o!==null&&(n=St.nextAfterYears(e,n,t,o[1])),St.addTimezone(n).toDate()}static nextAfterMonths(e,t,n,s){let a=1;for(s!==void 0&&(a=Number.parseInt(s.trim(),10));St.isSkippingTooManyMonths(e,t,a);)t=St.fromOneDayEarlier(e,n);return t}static isSkippingTooManyMonths(e,t,n){let s=t.month()-e.month();return s+=(t.year()-e.year())*12,s>n}static nextAfterYears(e,t,n,s){let a=1;for(s!==void 0&&(a=Number.parseInt(s.trim(),10));St.isSkippingTooManyYears(e,t,a);)t=St.fromOneDayEarlier(e,n);return t}static isSkippingTooManyYears(e,t,n){return t.year()-e.year()>n}static fromOneDayEarlier(e,t){e.subtract(1,"days").endOf("day");let n=t.origOptions;return n.dtstart=e.startOf("day").toDate(),t=new X(n),window.moment(t.after(e.toDate()))}static addTimezone(e){return window.moment.utc(e).local(!0).startOf("day")}};function Nh(r){let e=[r.startDateSymbol,r.scheduledDateSymbol,r.dueDateSymbol].join("|");return(t,n,s)=>{let a=[];a=a.concat(MI(t,n,s,
`}),a=a.slice(0,s.autoSuggestMaxItems),a}}function OI(r,e,t){let n=a=>Object.values(t.prioritySymbols).some(o=>o.length>0&&a.includes(o)),s=[];if(r.includes(t.dueDateSymbol)||s.push({displayText:`${t.dueDateSymbol} due date`,appendText:`${t.dueDateSymbol} `}),r.includes(t.startDateSymbol)||s.push({displayText:`${t.startDateSymbol} start date`,appendText:`${t.startDateSymbol} `}),r.includes(t.scheduledDateSymbol)||s.push({displayText:`${t.scheduledDateSymbol} scheduled date`,appendText:`${t.scheduledDateSymbol} `}),n(r)||(s.push({displayText:`${t.prioritySymbols.High} high priority`,appendText:`${t.prioritySymbols.High} `}),s.push({displayText:`${t.prioritySymbols.Medium} medium priority`,appendText:`${t.prioritySymbols.Medium} `}),s.push({displayText:`${t.prioritySymbols.Low} low priority`,appendText:`${t.prioritySymbols.Low} `})),r.includes(t.recurrenceSymbol)||s.push({displayText:`${t.recurrenceSymbol} recurring (repeat)`,appendText:`${t.recurrenceSymbol} `}),!r.includes(t.createdDateSymbol)){let o=ir.parseDate("today",!0).format(ie.dateFormat);s.push({displayText:`${t.createdDateSymbol} created today (${o})`,appendText:`${t.createdDateSymbol} ${o} `})}return s}function MI(r,e,t,n){let s=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],a=[],o=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),l=Ch(r,o,e);if(l&&l.length>=2){let c=l[1],f=l[2];if(f.length<t.autoSuggestMinMatch)return[];let p=f&&f.length>1?ir.parseDate(hi(f),!0):null;p&&p.isValid()&&a.push({displayText:`${p.format(ie.dateFormat)}`,appendText:`${c} ${p.format(ie.dateFormat)} `,insertAt:l.index,insertSkip:l[0].length});let g=1,T=5,O=s.filter(v=>f&&f.length>=g&&v.toLowerCase().includes(f.toLowerCase())).slice(0,T);O.length===0&&(O=s.slice(0,T));for(let v of O){let C=`${ir.parseDate(v,!0).format(ie.dateFormat)}`;a.push({suggestionType:"match",displayText:`${v} (${C})`,appendText:`${c} ${C} `,insertAt:l.index,insertSkip:l[0].length})}}return a}function RI(r,e,t,n){var c;let s=["every","every day","every week","every month","every month on the","every year","every week on Sunday","every week on Monday","every week on Tuesday","every week on Wednesday","every week on Thursday","every week on Friday","every week on Saturday"],a=[],o=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),l=Ch(r,o,e);if(l&&l.length>=2){let f=l[1],p=l[2];if(p.length<t.autoSuggestMinMatch)return[];if(p.length>0){let v=(c=St.fromText({recurrenceRuleText:p,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:c.toText();if(v){let R=`${f} ${v} `;if(a.push({suggestionType:"match",displayText:`\u2705 ${v}`,appendText:R,insertAt:l.index,insertSkip:l[0].length}),l[0]==R)return[]}}let g=1,T=t.autoSuggestMaxItems/2,O=s.filter(v=>p&&p.length>=g&&v.toLowerCase().includes(p.toLowerCase())).slice(0,T);O.length===0&&p.trim().length===0&&(O=s.slice(0,T));for(let v of O)a.push({suggestionType:"match",displayText:`${v}`,appendText:`${f} ${v} `,insertAt:l.index,insertSkip:l[0].length})}return a}function Ch(r,e,t){let n=r.matchAll(e);for(let s of n)if((s==null?void 0:s.index)&&s.index<=t&&t<=s.index+s[0].length)return s;return[]}var Qa=class{constructor(){this.hideTaskCount=!1;this.hideBacklinks=!1;this.hidePriority=!1;this.hideCreatedDate=!1;this.hideStartDate=!1;this.hideScheduledDate=!1;this.hideDoneDate=!1;this.hideDueDate=!1;this.hideRecurrenceRule=!1;this.hideEditButton=!1;this.hideUrgency=!0;this.shortMode=!1;this.explainQuery=!1}},zn=class{constructor(e,t){this.defaultLayout=["description","priority","recurrenceRule","createdDate","startDate","scheduledDate","dueDate","doneDate","blockLink"];this.hiddenComponents=[];this.specificClasses=[];e?this.options=e:this.options=new Qa,t?this.layoutComponents=t:this.layoutComponents=this.defaultLayout,this.layoutComponents=this.applyOptions(this.options)}applyOptions(e){let t=(s,a,o)=>a?(this.specificClasses.push(`tasks-layout-hide-${o}`),this.hiddenComponents.push(o),s.filter(l=>l!=o)):s,n=this.layoutComponents;return n=t(n,e.hidePriority,"priority"),n=t(n,e.hideRecurrenceRule,"rec
2023-03-29 16:30:35 +00:00
The task line not updated is:
${r.originalMarkdown}
In this markdown file:
"${r.taskLocation.path}"
Note: further clicks on this checkbox will usually now be ignored until the file is opened (or certain, specific edits are made - it's complicated).
Recommendations:
1. Close all panes that have the above file open, and then re-open the file.
2. Check for exactly identical copies of the task line, in this file, and see if you can make them different.
2023-04-21 15:21:53 +00:00
`;$h(C);return}let R=Math.min(Math.pow(10,a),100);to.debug(`timeout = ${R}`),setTimeout(()=>{Hb({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:s,previousTries:a+1})},R)},c=t.getAbstractFileByPath(r.path);if(!(c instanceof ro.TFile))return Uh(`Tasks: No file found for task ${r.description}. Retrying ...`),l();if(!NI.includes(c.extension)){$h(`Tasks: Does not support files with the ${c.extension} file extension.`);return}let f=n.getFileCache(c);if(f==null||f===null)return Uh(`Tasks: No file cache found for file ${c.path}. Retrying ...`),l();let p=f.listItems;if(p===void 0||p.length===0)return Uh(`Tasks: No list items found in file cache of ${c.path}. Retrying ...`),l();let T=(yield t.read(c)).split(`
`),O=II(r,T,p,CI);if(O===void 0)return l();let v=[...T.slice(0,O),...e.map(R=>R.toFileLineString()),...T.slice(O+1)];yield t.modify(c,v.join(`
`))});function zb(r,e){return r<e.length}function II(r,e,t,n){let s=FI(r,e);return s!==void 0||(s=LI(r,e),s!==void 0)?s:YI(r,e,t,n)}function FI(r,e){let t=r.taskLocation.lineNumber;if(zb(t,e)&&e[t]===r.originalMarkdown)return to.debug(`Found original markdown at original line number ${t}`),t}function LI(r,e){let t=[];for(let n=0;n<e.length;n++)e[n]===r.originalMarkdown&&t.push(n);if(t.length===1)return t[0]}function YI(r,e,t,n){let s,a=0;for(let o of t){let l=o.position.start.line;if(!zb(l,e))return;if(l<r.taskLocation.sectionStart||o.task===void 0)continue;let c=e[l];if(Fe.includedIn(c)){if(a===r.taskLocation.sectionIndex){if(c===r.originalMarkdown)s=l;else{n(`Tasks: Unable to find task in file ${r.taskLocation.path}.
2023-03-29 16:30:35 +00:00
Expected task:
${r.originalMarkdown}
Found task:
2023-04-21 15:21:53 +00:00
${c}`);return}break}a++}}return s}var Kn={description:"task-description",priority:"task-priority",dueDate:"task-due",startDate:"task-start",createdDate:"task-created",scheduledDate:"task-scheduled",doneDate:"task-done",recurrenceRule:"task-recurring",blockLink:""},UI=7,WI="far";function qI(r,e,t){return J(this,null,function*(){yield Vb.MarkdownRenderer.renderMarkdown(r,e,t,null)})}function Kb(r,e,t=null){return J(this,null,function*(){var l;t||(t=qI);let n=document.createElement("li");e.parentUlElement.appendChild(n),n.classList.add("task-list-item","plugin-tasks-list-item");let s=document.createElement("span");n.appendChild(s),s.classList.add("tasks-list-text");let a=yield jI(r,e,s,t);for(let c in a)n.dataset[c]=a[c];let o=document.createElement("input");return n.appendChild(o),o.classList.add("task-list-item-checkbox"),o.type="checkbox",r.status.symbol!==" "&&(o.checked=!0,n.classList.add("is-checked")),o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),o.disabled=!0;let f=r.toggle();Iu({originalTask:r,newTasks:f})}),n.prepend(o),n.setAttribute("data-task",r.status.symbol.trim()),n.setAttribute("data-line",e.listIndex.toString()),n.setAttribute("data-task-status-name",r.status.name),n.setAttribute("data-task-status-type",r.status.type),o.setAttribute("data-line",e.listIndex.toString()),(l=e.layoutOptions)!=null&&l.shortMode&&zI({task:r,element:s,isFilenameUnique:e.isFilenameUnique}),n})}function jI(r,e,t,n){return J(this,null,function*(){let s={},a=new zn(e.layoutOptions),o=bn.tasksPluginEmoji.taskSerializer;for(let l of a.layoutComponents){let c=o.componentToString(r,a,l);if(c){l==="description"&&(c=Fe.removeAsSubstringFromDependingOnSettings(c));let f=document.createElement("span");if(t.appendChild(f),f){let p=document.createElement("span");f.appendChild(p),yield $I(p,c,l,r,n);let[g,T]=Gh(l,r);GI(l,p),f.classList.add(...g);for(let O in T)f.dataset[O]=T[O];s=Ae(Ae({},s),T)}}}for(let l of a.hiddenComponents){let[c,f]=Gh(l,r);s=Ae(Ae({},s),f)}if(s.taskPriority===void 0){let[l,c]=Gh("priority",r);s=Ae(Ae({},s),c)}return s})}function $I(r,e,t,n,s){return J(this,null,function*(){if(t==="description"){let{debugSettings:a}=de();a.showTaskHiddenData&&(e+=`<br>\u{1F41B} <b>${n.lineNumber}</b> . ${n.sectionStart} . ${n.sectionIndex} . '<code>${n.originalMarkdown}</code>'<br>'<code>${n.path}</code>' > '<code>${n.precedingHeader}</code>'<br>`),yield s(e,r,n.path);let o=r.querySelector("blockquote"),l=o!=null?o:r,c=l.querySelector("p");if(c!==null){for(;c.firstChild;)l.insertBefore(c.firstChild,c);c.remove()}r.querySelectorAll("p").forEach(f=>{f.hasChildNodes()||f.remove()}),r.querySelectorAll(".footnotes").forEach(f=>{f.remove()})}else r.innerHTML=e})}function Gh(r,e){let t=[],n={},s=(a,o)=>{let l=BI(a);l&&(n[o]=l)};switch(r){case"description":t.push(Kn.description);break;case"priority":{let a=null;e.priority==="1"?a="high":e.priority==="2"?a="medium":e.priority==="4"?a="low":a="normal",n.taskPriority=a,t.push(Kn.priority);break}case"createdDate":{let a=e.createdDate;a&&(t.push(Kn.createdDate),s(a,"taskCreated"));break}case"dueDate":{let a=e.dueDate;a&&(t.push(Kn.dueDate),s(a,"taskDue"));break}case"startDate":{let a=e.startDate;a&&(t.push(Kn.startDate),s(a,"taskStart"));break}case"scheduledDate":{let a=e.scheduledDate;a&&(t.push(Kn.scheduledDate),s(a,"taskScheduled"));break}case"doneDate":{let a=e.doneDate;a&&(t.push(Kn.doneDate),s(a,"taskDone"));break}case"recurrenceRule":{t.push(Kn.recurrenceRule);break}}return[t,n]}function GI(r,e){if(r==="description"){let t=e.getElementsByClassName("tag");for(let n=0;n<t.length;n++){let s=t[n].textContent;if(s){let a=HI(s),o=t[n];a&&(o.dataset.tagName=a)}}}}function BI(r){let e=window.moment().startOf("day"),t="",n=e.diff(r,"days");return isNaN(n)?null:n===0?"today":(n>0?t+="past-":n<0&&(t+="future-"),Math.abs(n)<=UI?t+=Math.abs(n).toString()+"d":t+=WI,t)}function HI(r){let e=/["&\x00\r\n]/g,t=r.replace(e,"-");return t=t.replace(/^[-_]+/,""),t.length>0?t:null}function zI({task:r,element:e,isFilenameUnique:t}){let{recurrenceSymbol:n,startDateSymbol:s,createdDateSymbol:a,sc
`),l=o.length,c=new so(()=>Qt.fromPath(s.path)),f=null,p=0;for(let g of t)if(g.task!==void 0){let T=g.position.start.line;if(T>=l)return console.log(`${s.path} Obsidian gave us a line number ${T} past the end of the file. ${l}.`),a;if((f===null||f.position.end.line<T)&&(f=Os.getSection(T,n.sections),p=0),f===null)continue;let O=o[T];if(O===void 0){console.log(`${s.path}: line ${T} - ignoring 'undefined' line.`);continue}let v;try{v=Ge.fromLine({line:O,taskLocation:new Ct(s.path,T,f.position.start.line,p,Os.getPrecedingHeader(T,n.headings)),fallbackDate:c.value})}catch(R){this.reportTaskParsingErrorToUser(R,s,g,O);continue}v!==null&&(p++,a.push(v))}return a}reportTaskParsingErrorToUser(e,t,n,s){let a=`There was an error reading one of the tasks in this vault.
2023-03-29 16:30:35 +00:00
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: ${e}
File: ${t.path}
Line number: ${n.position.start.line}
Task line: ${s}
Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.
Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'
The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.
2023-04-21 15:21:53 +00:00
`;console.error(a),e instanceof Error&&console.error(e.stack),this.state==="Initializing"&&new _i.Notice(a,1e4)}static getSection(e,t){if(t===void 0)return null;for(let n of t)if(n.position.start.line<=e&&n.position.end.line>=e)return n;return null}static getPrecedingHeader(e,t){if(t===void 0)return null;let n=null;for(let s of t){if(s.position.start.line>e)return n;n=s.heading}return n}};var tp=require("obsidian");var hv=require("obsidian");function Rs(){}function zh(r){return r()}function Xb(){return Object.create(null)}function xs(r){r.forEach(zh)}function Jb(r){return typeof r=="function"}function ev(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function tv(r){return Object.keys(r).length===0}var rv=!1;function VI(){rv=!0}function KI(){rv=!1}function L(r,e){r.appendChild(e)}function Ti(r,e,t){r.insertBefore(e,t||null)}function Ps(r){r.parentNode.removeChild(r)}function Vh(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function ae(r){return document.createElement(r)}function ZI(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Jt(r){return document.createTextNode(r)}function Se(){return Jt(" ")}function zt(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function nv(r){return function(e){return e.preventDefault(),r.call(this,e)}}function z(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function XI(r){return Array.from(r.childNodes)}function Kh(r,e){e=""+e,r.wholeText!==e&&(r.data=e)}function Fr(r,e){r.value=e==null?"":e}function Zh(r,e){for(let t=0;t<r.options.length;t+=1){let n=r.options[t];if(n.__value===e){n.selected=!0;return}}r.selectedIndex=-1}function sv(r){let e=r.querySelector(":checked")||r.options[0];return e&&e.__value}function Lr(r,e,t){r.classList[t?"add":"remove"](e)}var Ms=class{constructor(e=!1){this.is_svg=!1,this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=ZI(t.nodeName):this.e=ae(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)Ti(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(Ps)}};var oo;function ao(r){oo=r}function QI(){if(!oo)throw new Error("Function called outside component initialization");return oo}function Xh(r){QI().$$.on_mount.push(r)}var io=[];var Yu=[],Lu=[],Qb=[],JI=Promise.resolve(),Hh=!1;function eF(){Hh||(Hh=!0,JI.then(iv))}function uo(r){Lu.push(r)}var Bh=new Set,Fu=0;function iv(){let r=oo;do{for(;Fu<io.length;){let e=io[Fu];Fu++,ao(e),tF(e.$$)}for(ao(null),io.length=0,Fu=0;Yu.length;)Yu.pop()();for(let e=0;e<Lu.length;e+=1){let t=Lu[e];Bh.has(t)||(Bh.add(t),t())}Lu.length=0}while(io.length);for(;Qb.length;)Qb.pop()();Hh=!1,Bh.clear(),ao(r)}function tF(r){if(r.fragment!==null){r.update(),xs(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(uo)}}var rF=new Set;function nF(r,e){r&&r.i&&(rF.delete(r),r.i(e))}var Dj=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function sF(r,e,t,n){let{fragment:s,on_mount:a,on_destroy:o,after_update:l}=r.$$;s&&s.m(e,t),n||uo(()=>{let c=a.map(zh).filter(Jb);o?o.push(...c):xs(c),r.$$.on_mount=[]}),l.forEach(uo)}function av(r,e){let t=r.$$;t.fragment!==null&&(xs(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function iF(r,e){r.$$.dirty[0]===-1&&(io.push(r),eF(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function ov(r,e,t,n,s,a,o,l=[-1]){let c=oo;ao(r);let f=r.$$={fragment:null,ctx:null,props:a,update:Rs,not_equal:s,bound:Xb(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Xb(),dirty:l,skip_bound:!1,root:e.target||c.$$.root};o&&o(f.root);let p=!1;if(f.ctx=t?t(r,e.props||{},(g,T,...O)=>{let v=O.length?O[0]:T;return f.ctx&&s(f.ctx[g],f.ctx[g]=v)&&(!f.skip_bound&&f.bound[g]&&f.bound[g](v),p&&iF(r,g)),T}):[],f.update(),p=!0,xs(f.before_update),f.fragment=n?n(f.ctx):!1,e.targe
<span class="accesskey-first">future</span> dates:`,Li=Se(),$e=ae("input"),ts=Se(),ft=ae("div"),ce=ae("label"),ce.innerHTML='Stat<span class="accesskey">u</span>s',Jr=Se(),Rt=ae("select");for(let G=0;G<Qe.length;G+=1)Qe[G].c();po=Se(),Ur=ae("div"),Rn=ae("div"),_t=ae("label"),_t.textContent="Completed:",Yi=Se(),dr=ae("input"),Le=Se(),xn=ae("div"),js=ae("span"),js.textContent="Created on:",ns=Se(),Pn=ae("code"),ss=Se(),fr=ae("div"),An=ae("span"),An.textContent="Done on:",mo=Se(),tn=ae("code"),yo=Se(),hr=ae("div"),pr=ae("button"),H=Jt("Apply"),go=Se(),ht=ae("button"),ht.textContent="Cancel",z(s,"for","description"),z(o,"id","description"),z(o,"type","text"),z(o,"class","tasks-modal-description"),z(o,"placeholder","Take out the trash"),z(o,"accesskey",l=r[15]("t")),z(n,"class","tasks-modal-section"),z(p,"for",T="priority-"+r[1].priority),z(f,"class","tasks-modal-section tasks-modal-priorities"),z(C,"for","recurrence"),z(C,"class","accesskey-first"),z(B,"id","recurrence"),z(B,"type","text"),z(B,"placeholder","Try 'every 2 weeks on Thursday'."),z(B,"accesskey",W=r[15]("r")),Lr(B,"tasks-modal-error",!r[8]),ne.a=null,z(yt,"for","due"),z(yt,"class","accesskey-first"),z(q,"id","due"),z(q,"type","text"),z(q,"placeholder",Qh),z(q,"accesskey",P=r[15]("d")),Lr(q,"tasks-modal-error",!r[7]),_.a=null,z(k,"for","scheduled"),z(k,"class","accesskey-first"),z(M,"id","scheduled"),z(M,"type","text"),z(M,"placeholder",Qh),z(M,"accesskey",D=r[15]("s")),Lr(M,"tasks-modal-error",!r[5]),De.a=null,z(le,"for","start"),z(K,"id","start"),z(K,"type","text"),z(K,"placeholder",Qh),z(K,"accesskey",qe=r[15]("a")),Lr(K,"tasks-modal-error",!r[3]),je.a=null,z(Mn,"for","forwardOnly"),z($e,"id","forwardOnly"),z($e,"type","checkbox"),z($e,"class","task-list-item-checkbox tasks-modal-checkbox"),z($e,"accesskey",qs=r[15]("f")),z(R,"class","tasks-modal-section tasks-modal-dates"),z(ce,"for","status"),z(Rt,"id","status-type"),z(Rt,"class","dropdown"),z(Rt,"accesskey",rs=r[15]("u")),r[1].status===void 0&&uo(()=>r[39].call(Rt)),z(ft,"class","tasks-modal-section"),z(_t,"for","status"),z(dr,"id","status"),z(dr,"type","checkbox"),z(dr,"class","task-list-item-checkbox tasks-modal-checkbox"),dr.checked=en=r[1].status.isCompleted(),dr.disabled=!0,z(Ur,"class","tasks-modal-section tasks-modal-status"),pr.disabled=$s=!r[14],z(pr,"type","submit"),z(pr,"class","mod-cta"),z(ht,"type","button"),z(hr,"class","tasks-modal-section tasks-modal-buttons"),Lr(t,"with-accesskeys",r[9]),z(e,"class","tasks-modal")},m(G,re){Ti(G,e,re),L(e,t),L(t,n),L(n,s),L(n,a),L(n,o),Fr(o,r[1].description),r[31](o),L(t,c),L(t,f),L(f,p),L(p,g),L(f,O);for(let ue=0;ue<Ft.length;ue+=1)Ft[ue].m(f,null);L(t,v),L(t,R),L(R,C),L(R,$),L(R,B),Fr(B,r[1].recurrenceRule),L(R,ke),L(R,Te),L(Te,be),L(Te,ee),ne.m(r[12],Te),L(R,It),L(R,yt),L(R,V),L(R,q),Fr(q,r[1].dueDate),L(R,Q),L(R,Y),L(Y,oe),L(Y,y),_.m(r[6],Y),L(R,w),L(R,k),L(R,E),L(R,M),Fr(M,r[1].scheduledDate),L(R,I),L(R,A),L(A,N),L(A,j),De.m(r[4],A),L(R,pe),L(R,le),L(R,Ce),L(R,K),Fr(K,r[1].startDate),L(R,Xe),L(R,ct),L(ct,Or),L(ct,it),je.m(r[2],ct),L(R,dt),L(R,gt),L(gt,Mn),L(gt,Li),L(gt,$e),$e.checked=r[1].forwardOnly,L(t,ts),L(t,ft),L(ft,ce),L(ft,Jr),L(ft,Rt);for(let ue=0;ue<Qe.length;ue+=1)Qe[ue].m(Rt,null);Zh(Rt,r[1].status),L(t,po),L(t,Ur),L(Ur,Rn),L(Rn,_t),L(Rn,Yi),L(Rn,dr),L(Ur,Le),L(Ur,xn),L(xn,js),L(xn,ns),L(xn,Pn),Pn.innerHTML=r[11],L(Ur,ss),L(Ur,fr),L(fr,An),L(fr,mo),L(fr,tn),tn.innerHTML=r[13],L(t,yo),L(t,hr),L(hr,pr),L(pr,H),L(hr,go),L(hr,ht),is||(Pe=[zt(o,"input",r[30]),zt(o,"keydown",r[23]),zt(o,"paste",r[24]),zt(o,"drop",r[24]),zt(f,"keyup",r[21]),zt(B,"input",r[34]),zt(q,"input",r[35]),zt(M,"input",r[36]),zt(K,"input",r[37]),zt($e,"change",r[38]),zt(Rt,"change",r[39]),zt(ht,"click",r[22]),zt(t,"submit",nv(r[25]))],is=!0)},p(G,re){if(re[0]&32768&&l!==(l=G[15]("t"))&&z(o,"accesskey",l),re[0]&3&&Fr(o,G[1].description),re[0]&3&&T!==(T="priority-"+G[1].priority)&&z(p,"for",T),re[0]&1081346){mr=G[20];let ue;for(ue=0;ue<mr.length;ue+=1){let jt=lv(G,mr,ue);Ft[ue]?Ft[ue].p(jt,re):(Ft[ue]=cv(jt),Ft[ue].c(),Ft[ue].m(f,null))}for(;ue<Ft.length;ue
`);e.setLine(o,O)};new Zn({app:n,task:c,onSubmit:f}).open()};var rp=require("obsidian");var mv=(r,e,t)=>{var c;if(r)return t instanceof rp.MarkdownView;if(!(t instanceof rp.MarkdownView))return;let n=(c=t.file)==null?void 0:c.path;if(n===void 0)return;let s=e.getCursor(),a=s.line,o=e.getLine(a),l=cF(o,n);e.setLine(a,l.text),e.setCursor(dF(s,l))},cF=(r,e)=>{let t=Ge.fromLine({line:r,taskLocation:Ct.fromUnknownPosition(e),fallbackDate:null});if(t!==null){let n=t.toggle().map(s=>s.toFileLineString());return{text:n.join(`
`),moveTo:{line:n.length-1}}}else{let n=r.match(ie.taskRegex);if(n!==null){let s=n[3],o=Be.getInstance().bySymbol(s).nextStatusSymbol;return{text:r.replace(ie.taskRegex,`$1- [${o}] $4`)}}else if(ie.listItemRegex.test(r)){let s=r.replace(ie.listItemRegex,"$1$2 [ ]");return{text:s,moveTo:{ch:s.length}}}else{let s=r.replace(ie.indentationRegex,"$1- ");return{text:s,moveTo:{ch:s.length}}}}},dF=(r,e)=>{var a;let t={line:0,ch:r.ch},n=Ae(Ae({},t),(a=e.moveTo)!=null?a:{}),s=e.text.split(`
`)[n.line].length;return{line:r.line+n.line,ch:Math.min(n.ch,s)}};var qu=class{get app(){return this.plugin.app}constructor({plugin:e}){this.plugin=e,e.addCommand({id:"edit-task",name:"Create or edit task",icon:"pencil",editorCheckCallback:(t,n,s)=>pv(t,n,s,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:mv})}};var ju=class{constructor({obsidianEvents:e}){this.obsidianEvents=e}onCacheUpdate(e){return this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.obsidianEvents.offref(e)}};var $u=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return J(this,null,function*(){var f;let n=e.findAll(".task-list-item").filter(p=>{var O;let g=(O=p.textContent)==null?void 0:O.split(`
`);if(g===void 0)return!1;let T=null;for(let v=0;v<g.length;v=v+1)if(g[v]!==""){T=g[v];break}return T===null?!1:Fe.includedIn(T)});if(n.length===0)return;let s=t.sourcePath,a=t.getSectionInfo(e);if(a===null)return;let o=a.text.split(`
`),l=0,c=[];for(let p=a.lineStart;p<=a.lineEnd;p++){let g=o[p];if(g===void 0)continue;let T=null,O=Ge.fromLine({line:g,taskLocation:new Ct(s,p,a.lineStart,l,T),fallbackDate:null});O!==null&&(c.push(O),l++)}for(let p=0;p<n.length;p++){let g=c[p],T=n[p];if(g===void 0||T===void 0)continue;let O=(f=T.getAttr("data-line"))!=null?f:"0",v=Number.parseInt(O,10),R=yield g.toLi({parentUlElement:e,listIndex:v}),C=T.childNodes;for(let W=0;W<C.length;W=W+1){let ke=C[W];ke.nodeName.toLowerCase()==="div"?R.prepend(ke):ke.nodeName.toLowerCase()==="ul"&&R.append(ke)}let $=T.querySelectorAll("[data-footnote-id]"),B=R.querySelectorAll("[data-footnote-id]");if($.length===B.length)for(let W=0;W<$.length;W++)B[W].replaceWith($[W]);T.replaceWith(R)}})}};var yv=require("@codemirror/view"),gv=require("obsidian");var _v=()=>yv.ViewPlugin.fromClass(np),np=class{constructor(e){this.view=e,this.handleClickEvent=this.handleClickEvent.bind(this),this.view.dom.addEventListener("click",this.handleClickEvent)}destroy(){this.view.dom.removeEventListener("click",this.handleClickEvent)}handleClickEvent(e){let{target:t}=e;if(!t||!(t instanceof HTMLInputElement)||t.type!=="checkbox")return!1;let n=t.closest("ul.plugin-tasks-query-result, div.callout-content");if(n){if(n.matches("div.callout-content")){let T=`obsidian-tasks-plugin warning: Tasks cannot add or remove completion dates or make the next copy of a recurring task for tasks written inside a callout when you click their checkboxes in Live Preview.
If you wanted Tasks to do these things, please undo your change, then either click the line of the task and use the "Toggle Task Done" command, or switch to Reading View to click the checkbox.`;console.warn(T),new gv.Notice(T,45e3)}return!1}let{state:s}=this.view,a=this.view.posAtDOM(t),o=s.doc.lineAt(a),l=Ge.fromLine({line:o.text,taskLocation:Ct.fromUnknownPosition(""),fallbackDate:null});if(console.debug(`Live Preview Extension: toggle called. Position: ${a} Line: ${o.text}`),l===null)return!1;e.preventDefault();let f=l.toggle().map(T=>T.toFileLineString()).join(s.lineBreak),p=s.update({changes:{from:o.from,to:o.to,insert:f}});this.view.dispatch(p);let g=t.checked;return setTimeout(()=>{t.checked=g},1),!0}};var pl=require("obsidian");var kn=class{constructor(e,t,n){this.property=e,this.comparator=kn.maybeReverse(n,t)}static maybeReverse(e,t){return e?kn.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var Xn=class{constructor(e,t){this.property=e,this.grouper=t}};var Ve=class{canCreateFilterForLine(e){return Ve.lineMatchesFilter(this.filterRegExp(),e)}static lineMatchesFilter(e,t){return e?e.test(t):!1}static getMatch(e,t){return e?t.match(e):null}fieldNameSingular(){return this.fieldName()}fieldNameSingularEscaped(){return Nu(this.fieldNameSingular())}supportsSorting(){return!1}parseSortLine(e){return!this.supportsSorting()||!this.canCreateSorterForLine(e)?null:this.createSorterFromLine(e)}canCreateSorterForLine(e){return this.supportsSorting()?Ve.lineMatchesFilter(this.sorterRegExp(),e):!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=Ve.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createSorter(n)}sorterRegExp(){if(!this.supportsSorting())throw Error(`sorterRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)?`)}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new kn(this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(){return new Xn(this.fieldNameSingular(),this.grouper())}};var Ke=class{constructor(e,t=[],n=""){this.description=e,this.symbol=n,this.children=t}static booleanAnd(e){return this.combineOrCreateExplanation("All of",e,"AND")}static booleanOr(e){return this.combineOrCreateExplanation("At least one of",e,"OR")}static booleanNot(e){return new Ke("None of",e,"NOT")}static booleanXor(e){return new Ke("Exactly one of",e,"XOR")}asString(e=""){if(this.children.length==0)return e+this.description;let t=e;this.symbol===""?t+=this.description:(t+=this.symbol,this.children.length>1&&(t+=` (${this.description})`),t+=":");let n=e+" ";for(let s=0;s<this.children.length;s++)t+=`
${this.children[s].asString(n)}`;return t}static combineOrCreateExplanation(e,t,n){if(t.length===2){let s=t[0],a=t[1];if(s.symbol===n&&a.symbol==="")return s.children.push(a),s}return new Ke(e,t,n)}};var er=class{constructor(e,t,n){this.instruction=e,this.explanation=n,this.filterFunction=t}explainFilterIndented(e){let t=this.explanation;return t.asString()===this.instruction?`${e}${this.instruction}
2023-03-29 16:30:35 +00:00
`:`${e}${this.instruction} =>
${t.asString(" ")}
2023-04-21 15:21:53 +00:00
`}},Ze=class{constructor(e){this.instruction=e}get filter(){return this._filter}set filter(e){this._filter=e}get filterFunction(){if(this._filter)return this._filter.filterFunction}static fromFilter(e){let t=new Ze(e.instruction);return t.filter=e,t}static fromError(e,t){let n=new Ze(e);return n.error=t,n}};var Gu=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e==this._instruction}createFilterOrErrorMessage(e){let t=new Ze(e);return e===this._instruction?(t.filter=new er(e,this._filter,new Ke(e)),t):(t.error=`do not understand filter: ${e}`,t)}};var Vr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new Gu(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let n of this._filters){let s=n.createFilterOrErrorMessage(e);if(s.error===void 0)return s}let t=new Ze(e);return t.error=`do not understand filter: ${e}`,t}};var Qn=class extends Ve{constructor(){super(...arguments);this._filters=new Vr}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var Kr=class extends Qn{constructor(){super(),this._filters.add("done",e=>e.status.type==="DONE"||e.status.type==="CANCELLED"||e.status.type==="NON_TASK"),this._filters.add("not done",e=>e.status.type==="TODO"||e.status.type==="IN_PROGRESS")}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Kr.oldStatusName(e),s=Kr.oldStatusName(t);return n<s?1:n>s?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[Kr.oldStatusName(e)]}};var Wt=class extends Ve{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new Vr,this.filterInstructions.add(`has ${this.fieldName()} date`,n=>this.date(n)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,n=>this.date(n)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,n=>{let s=this.date(n);return s!==null&&!s.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);if(n.filter!==void 0)return n;let s=new Ze(t),a=Ve.getMatch(this.filterRegExp(),t);if(a!==null){let o=a[1],l=a[2],c=a[3],f=ir.parseDateRange(c);if(!f.isValid()){let p=ir.parseDate(o);p.isValid()&&(f=new Bt(p,p))}if(!f.isValid())s.error="do not understand "+this.fieldName()+" date";else{let p=this.buildFilterFunction(l,f),g=Wt.buildExplanation(this.fieldNameForExplanation(),l,this.filterResultIfFieldMissing(),f);s.filter=new er(t,p,g)}}else s.error="do not understand query filter ("+this.fieldName()+" date)";return s}buildFilterFunction(t,n){let s;return t==="before"?s=a=>a?a.isBefore(n.start):this.filterResultIfFieldMissing():t==="after"?s=a=>a?a.isAfter(n.end):this.filterResultIfFieldMissing():s=a=>a?a.isSameOrAfter(n.start)&&a.isSameOrBefore(n.end):this.filterResultIfFieldMissing(),this.getFilter(s)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} ((before|after|on|in)? ?(.*))`)}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,s,a){let o,l="YYYY-MM-DD (dddd Do MMMM YYYY)",c;switch(n){case"before":o=n,c=a.start.format(l);break;case"after":o=n,c=a.end.format(l);break;default:if(a.start.isSame(a.end))o="on",c=a.start.format(l);else{let p=`${t} date is between:`,g=[new Ke(`${a.start.format(l)} and`),new Ke(`${a.end.format(l)} inclusive`)];return s&&g.push(new Ke(`OR no ${t} date`)),new Ke(p,g)}break}let f=`${t} date is ${o} ${c}`;return s&&(f+=` OR no ${t} date`),new Ke(f)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>Hr(this.date(t),this.date(n))}supportsGrouping(){return!0}grouper(){return t=>{let n=this.date(t);return n===null
2022-06-15 22:20:02 +00:00
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} ${t.name}
2023-04-21 15:21:53 +00:00
`;return e+=this.tasksAsStringOfLines(),e}};var Qu=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length;let n=new Zu(e,t);this.addTasks(n)}get groups(){return this._groups}totalTasksCount(){return this._totalTaskCount}toString(){let e="";for(let n of this.groups)e+=n.toString(),e+=`
2022-06-15 22:20:02 +00:00
---
`;return e+=`
${this.totalTasksCount()} tasks
2023-04-21 15:21:53 +00:00
`,e}addTasks(e){let t=new Hu(e.groups);for(let[n,s]of e.groups){let a=t.getHeadingsForTaskGroup(n),o=new Xu(n,a,s);this.add(o)}}add(e){this._groups.push(e)}};var vi=class{matchesAnyOf(e){return e.some(t=>this.matches(t))}};var wi=class extends vi{constructor(t){super();this.stringToFind=t}matches(t){return wi.stringIncludesCaseInsensitive(t,this.stringToFind)}static stringIncludesCaseInsensitive(t,n){return t.toLocaleLowerCase().includes(n.toLocaleLowerCase())}};var ki=class extends vi{constructor(t){super();this.regex=t}static validateAndConstruct(t){let n=/\/((?![*+?])(?:[^\r\n[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*])+)\/((?:g(?:im?|mi?)?|i(?:gm?|mg?)?|m(?:gi?|ig?)?)?)/,s=t.match(n);if(s!==null){let a=new RegExp(s[1],s[2]);return new ki(a)}else return null}matches(t){return t.match(this.regex)!==null}};var qt=class extends Ve{createFilterOrErrorMessage(e){let t=Ve.getMatch(this.filterRegExp(),e);if(t===null)return Ze.fromError(e,`do not understand query filter (${this.fieldName()})`);let[n,s,a]=t,o=null;if(s.includes("include"))o=new wi(a);else if(s.includes("regex")&&(o=ki.validateAndConstruct(a),o===null))return Ze.fromError(e,`cannot parse regex (${this.fieldName()}); check your leading and trailing slashes for your query`);if(o===null)return Ze.fromError(e,`do not understand query filter (${this.fieldName()})`);let l=s.match(/not/)!==null,c=new er(e,this.getFilter(o,l),new Ke(e));return Ze.fromFilter(c)}fieldPattern(){return this.fieldNameSingularEscaped()}filterOperatorPattern(){return"includes|does not include|regex matches|regex does not match"}filterRegExp(){return new RegExp(`^(?:${this.fieldPattern()}) (${this.filterOperatorPattern()}) (.*)`)}getFilter(e,t){return n=>{let s=e.matches(this.value(n));return t?!s:s}}comparator(){return(e,t)=>this.value(e).localeCompare(this.value(t),void 0,{numeric:!0})}grouper(){return e=>[this.value(e)]}};var Di=class extends qt{fieldName(){return"heading"}value(e){return e.precedingHeader?e.precedingHeader:""}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>e.precedingHeader===null||e.precedingHeader.length===0?["(No heading)"]:[e.precedingHeader]}};var Xr=class{static fromGroupingProperty(e){return new Xn(e,Xr.grouperForProperty(e))}static by(e,t){return new Qu(e,t)}static getGroupNamesForTask(e,t){return e.grouper(t)}static grouperForProperty(e){return Xr.groupers[e]}static escapeMarkdownCharacters(e){return e.replace(/\\/g,"\\\\").replace(/_/g,"\\_")}static groupByFolder(e){let t=e.path,n=e.filename+".md",s=t.substring(0,t.lastIndexOf(n));return s===""?["/"]:[Xr.escapeMarkdownCharacters(s)]}static groupByRoot(e){let t=e.path.replace(/\\/g,"/"),n=t.indexOf("/");return n==-1?["/"]:[Xr.escapeMarkdownCharacters(t.substring(0,n+1))]}static groupByBacklink(e){if(e.getLinkText({isFilenameUnique:!0})===null)return["Unknown Location"];let n="Unknown Location";if(e.filename!==null&&(n=Xr.escapeMarkdownCharacters(e.filename)),e.precedingHeader===null||e.precedingHeader.length===0)return[n];let s=new Di().createGrouper().grouper,a=s(e)[0];return n===a?[n]:[`${n} > ${a}`]}},Zr=Xr;Zr.groupers={backlink:Xr.groupByBacklink,folder:Xr.groupByFolder,root:Xr.groupByRoot};var Ei=class extends qt{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[Zr.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var Si=class extends Ve{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return Ze.fromError(e,"Filtering by urgency is not yet supported")}fieldName(){return"urgency"}filterRegExp(){throw Error(`filterRegExp() unimplemented for ${this.fieldName()}`)}supportsSorting(){return!0}comparator(){return(e,t)=>t.urgency-e.urgency}};var Oi=class{static by(e,t){let n=[new Si().comparator(),new Kr().comparator(),new bi().comparator(),new As().comparator(),new Ei().comparator()],s=[];for(let a of e)s.push(a.comparator);return t.sort(Oi.makeCompositeComparator([...s,...n]))}static makeCompositeComparator(e){return(t,n)=>{for(let s of e){let a=s(t,n);if(a!==0)return a}return 0}}};var Ns=class extends qt
Allowed options: 'is' and 'is not' (without quotes).
Allowed values: ${t}
Note: values are case-insensitive,
so 'in_progress' works too, for example.
Example: ${this.fieldNameSingular()} is not NON_TASK`;return Ze.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=es.groupName(e),s=es.groupName(t);return n.localeCompare(s,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[es.groupName(e)]}static groupName(e){let t;switch(e.status.type){case"IN_PROGRESS":t="1";break;case"TODO":t="2";break;case"DONE":t="3";break;case"CANCELLED":t="4";break;case"NON_TASK":t="5";break;case"EMPTY":t="6";break}return t+" "+e.status.type}};var fl=class extends qt{fieldName(){return"recurrence"}value(e){return e.recurrence!==null?e.recurrence.toText():""}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?[e.recurrence.toText()]:["None"]}};var yp=[()=>new dl,()=>new es,()=>new Kr,()=>new sl,()=>new As,()=>new Mi,()=>new Ju,()=>new nl,()=>new rl,()=>new bi,()=>new el,()=>new Ei,()=>new Ns,()=>new Cs,()=>new Di,()=>new tl,()=>new ul,()=>new cl,()=>new Si,()=>new fl];function ll(r){for(let e of yp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function Av(r){let e=/^sort by /;if(r.match(e)===null)return null;for(let t of yp){let s=t().parseSortLine(r);if(s)return s}return null}function Nv(r){let e=/^group by /;if(r.match(e)===null)return null;for(let t of yp){let n=t(),s=n.fieldNameSingular();if(n.supportsGrouping()&&(r===`group by ${s}`||n instanceof Ri&&r===`group by ${n.fieldNamePlural()}`))return n.createGrouper()}return null}var Ii=class{constructor({source:e}){this._limit=void 0;this._layoutOptions=new Qa;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this.groupByRegexp=/^group by (backlink|folder|root)/;this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|urgency)/;this.shortModeRegexp=/^short/;this.explainQueryRegexp=/^explain/;this.limitRegexp=/^limit (to )?(\d+)( tasks?)?/;this.commentRegexp=/^#.*/;this.source=e,e.split(`
2023-03-29 16:30:35 +00:00
`).map(t=>t.trim()).forEach(t=>{switch(!0){case t==="":break;case this.shortModeRegexp.test(t):this._layoutOptions.shortMode=!0;break;case this.explainQueryRegexp.test(t):this._layoutOptions.explainQuery=!0;break;case this.limitRegexp.test(t):this.parseLimit({line:t});break;case this.parseSortBy({line:t}):break;case this.parseGroupBy2({line:t}):break;case this.groupByRegexp.test(t):this.parseGroupBy({line:t});break;case this.hideOptionsRegexp.test(t):this.parseHideOptions({line:t});break;case this.commentRegexp.test(t):break;case this.parseFilter(t):break;default:this._error=`do not understand query: ${t}`}})}explainQuery(){return`Explanation of this Tasks code block query:
2023-04-21 15:21:53 +00:00
`+this.explainQueryWithoutIntroduction()}explainQueryWithoutIntroduction(){let e="";Fe.isEmpty()||(e+=`Only tasks containing the global filter '${Fe.get()}'.
2023-03-29 16:30:35 +00:00
2023-04-21 15:21:53 +00:00
`);let t=this.filters.length;if(t===0)e+="No filters supplied. All tasks will match the query.";else for(let s=0;s<t;s++)s>0&&(e+=`
`),e+=this.filters[s].explainFilterIndented("");this._limit!==void 0&&(e+=`
2023-03-29 16:30:35 +00:00
At most ${this._limit} task`,this._limit!==1&&(e+="s"),e+=`.
2023-04-21 15:21:53 +00:00
`);let{debugSettings:n}=de();return n.ignoreSortInstructions&&(e+=`
2023-03-29 16:30:35 +00:00
2023-04-21 15:21:53 +00:00
NOTE: All sort instructions, including default sort order, are disabled, due to 'ignoreSortInstructions' setting.`),e}get limit(){return this._limit}get layoutOptions(){return this._layoutOptions}get filters(){return this._filters}get sorting(){return this._sorting}get grouping(){return this._grouping}get error(){return this._error}applyQueryToTasks(e){this.filters.forEach(a=>{e=e.filter(a.filterFunction)});let{debugSettings:t}=de(),s=(t.ignoreSortInstructions?e:Oi.by(this.sorting,e)).slice(0,this.limit);return Zr.by(this.grouping,s)}parseHideOptions({line:e}){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1]==="hide";switch(t[2]){case"task count":this._layoutOptions.hideTaskCount=n;break;case"backlink":this._layoutOptions.hideBacklinks=n;break;case"priority":this._layoutOptions.hidePriority=n;break;case"created date":this._layoutOptions.hideCreatedDate=n;break;case"start date":this._layoutOptions.hideStartDate=n;break;case"scheduled date":this._layoutOptions.hideScheduledDate=n;break;case"due date":this._layoutOptions.hideDueDate=n;break;case"done date":this._layoutOptions.hideDoneDate=n;break;case"recurrence rule":this._layoutOptions.hideRecurrenceRule=n;break;case"edit button":this._layoutOptions.hideEditButton=n;break;case"urgency":this._layoutOptions.hideUrgency=n;break;default:this._error="do not understand hide/show option"}}}parseFilter(e){let t=ll(e);return t!=null?(t.filter?this._filters.push(t.filter):this._error=t.error,!0):!1}parseLimit({line:e}){let t=e.match(this.limitRegexp);t!==null?this._limit=Number.parseInt(t[2],10):this._error="do not understand query limit"}parseSortBy({line:e}){let t=Av(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy({line:e}){let t=e.match(this.groupByRegexp);t!==null?this._grouping.push(Zr.fromGroupingProperty(t[1])):this._error="do not understand query grouping"}parseGroupBy2({line:e}){let t=Nv(e);return t?(this._grouping.push(t),!0):!1}};var hl=class{constructor({plugin:e,events:t}){this.addQueryRenderChild=this._addQueryRenderChild.bind(this);this.app=e.app,this.events=t,e.registerMarkdownCodeBlockProcessor("tasks",this._addQueryRenderChild.bind(this))}_addQueryRenderChild(e,t,n){return J(this,null,function*(){n.addChild(new gp({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},gp=class extends pl.MarkdownRenderChild{constructor({app:t,events:n,container:s,source:a,filePath:o}){super(s);switch(this.app=t,this.events=n,this.source=a,this.filePath=o,this.containerEl.className){case"block-language-tasks":this.query=new Ii({source:a}),this.queryType="tasks";break;default:this.query=new Ii({source:a}),this.queryType="tasks";break}}onload(){this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.renderEventRef=this.events.onCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()}onunload(){this.renderEventRef!==void 0&&this.events.off(this.renderEventRef),this.queryReloadTimeout!==void 0&&clearTimeout(this.queryReloadTimeout)}reloadQueryAtMidnight(){let t=new Date;t.setHours(24,0,0,0);let n=new Date,s=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=new Ii({source:this.source}),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},s+1e3)}render(s){return J(this,arguments,function*({tasks:t,state:n}){var o;let a=this.containerEl.createEl("div");if(n==="Warm"&&this.query.error===void 0){console.debug(`Render ${this.queryType} called for a block in active file "${this.filePath}", to select from ${t.length} tasks: plugin state: ${n}`),this.query.layoutOptions.explainQuery&&this.createExplanation(a);let l=this.query.applyQueryToTasks(t);for(let f of l.groups){this.addGroupHeadings(a,f.groupHeadings);let{taskList:p}=yield this.createTasksList({tasks:f.tasks,content:a});a.appendChild(p)}let c=l.totalTasksCount();console.debug(`${c} of ${t.length} tasks displayed in a block in "${this.filePath}"`),this.addTaskCount(a,c)}else this.query.error!==void 0?a.createDiv().innerHTML=`<pre>Tasks query: ${this.query.error.replace(/\n/g,"<br>")}</pre>`:a.setText("Loadi
2023-03-29 16:30:35 +00:00
`)+`
2023-04-21 15:21:53 +00:00
Fix errors before saving.`;new Yr.Notice(g);return}this.saved=!0,this.close()})),f)),c.addExtraButton(f=>(f.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),f))})}onOpen(){this.display()}static setValidationError(t){t.inputEl.addClass("tasks-settings-is-invalid")}static removeValidationError(t){t.inputEl.removeClass("tasks-settings-is-invalid")}static setValid(t,n){n.length===0?cr.removeValidationError(t):cr.setValidationError(t)}};var Ws=class extends We.PluginSettingTab{constructor({plugin:t}){super(t.app,t);this.customFunctions={insertTaskCoreStatusSettings:this.insertTaskCoreStatusSettings.bind(this),insertCustomTaskStatusSettings:this.insertCustomTaskStatusSettings.bind(this)};this.plugin=t}saveSettings(t){return J(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("h3",{text:"Tasks Settings"}),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),t.createEl("h4",{text:"Task Format Settings"}),new We.Setting(t).setName("Task Format").setDesc(Ws.createFragmentWithHTML('<p>The format that Tasks uses to read and write tasks.</p><p><b>Important:</b> Tasks currently only supports one format at a time. Selecting Dataview will currently <b>stop Tasks reading its own emoji signifiers</b>.</p><p>See the <a href="https://publish.obsidian.md/tasks/Reference/Formats/About+Formats">documentation</a>.</p>')).addDropdown(s=>{for(let a of Object.keys(bn))s.addOption(a,bn[a].displayName);s.setValue(de().taskFormat).onChange(a=>J(this,null,function*(){Mt({taskFormat:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new We.Setting(t).setName("Global task filter").setDesc(Ws.createFragmentWithHTML('<p><b>Recommended: Leave empty if you want all checklist items in your vault to be tasks managed by this plugin.</b></p><p>Use a global filter if you want Tasks to only act on a subset of your "<code>- [ ]</code>" checklist items, so that a checklist item must include the specified string in its description in order to be considered a task.<p><p>For example, if you set the global filter to <code>#task</code>, the Tasks plugin will only handle checklist items tagged with <code>#task</code>.</br>Other checklist items will remain normal checklist items and not appear in queries or get a done date set.</p><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Global+Filter">documentation</a>.</p>')).addText(s=>{s.setPlaceholder("e.g. #task or TODO").setValue(Fe.get()).onChange(a=>J(this,null,function*(){Fe.set(a),yield this.plugin.saveSettings()}))}),new We.Setting(t).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle(s=>{let a=de();s.setValue(a.removeGlobalFilter).onChange(o=>J(this,null,function*(){Mt({removeGlobalFilter:o}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=de();qv.forEach(s=>{this.addOneSettingsBlock(t,s,n)}),t.createEl("h4",{text:"Date Settings"}),new We.Setting(t).setName("Set created date on every added task").setDesc("Enabling this will add a timestamp \u2795 YYYY-MM-DD before other date values, when a task is created with 'Create or edit task', or by completing a recurring task.").addToggle(s=>{let a=de();s.setValue(a.setCreatedDate).onChange(o=>J(this,null,function*(){Mt({setCreatedDate:o}),yield this.plugin.saveSettings()}))}),new We.Setting(t).setName("Set done date on every completed task").setDesc("Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done.").addToggle(s=>{let a=de();s.setValue(a.setDoneDate).onChange(o=>J(this,null,function*(){Mt({setDoneDate:o}),yield this.plugin.saveSettings()}))}),new We.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(Ws.createFragmentWithHTML('Save time entering Scheduled (
`);t(l)}).open(),n};var Bv=(r,e)=>{let t=Wu({line:"",path:""});return new Zn({app:r,task:t,onSubmit:e})};var Hv=r=>({createTaskLineModal:()=>Gv(r,Bv)});var yl=class extends zv.Plugin{get apiV1(){return Hv(app)}onload(){return J(this,null,function*(){Cu.registerConsoleLogger(),console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new ho({plugin:this})),Bb({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let t=new ju({obsidianEvents:this.app.workspace});this.cache=new Os({metadataCache:this.app.metadataCache,vault:this.app.vault,events:t}),this.inlineRenderer=new $u({plugin:this}),this.queryRenderer=new hl({plugin:this,events:t}),this.registerEditorExtension(_v()),this.registerEditorSuggest(new ml(this.app,de())),new qu({plugin:this})})}loadTaskStatuses(){return J(this,null,function*(){let{statusSettings:t}=de();mt.applyToStatusRegistry(t,Be.getInstance())})}onunload(){var t;console.log('unloading plugin "tasks"'),(t=this.cache)==null||t.unload()}loadSettings(){return J(this,null,function*(){let t=yield this.loadData();Mt(t),yield this.loadTaskStatuses()})}saveSettings(){return J(this,null,function*(){yield this.saveData(de())})}getTasks(){var t;return(t=this.cache)==null?void 0:t.getTasks()}};
2023-03-29 16:30:35 +00:00
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
*
* Copyright (c) 2013 hij1nx
* Licensed under the MIT license.
*/
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! moment.js
//! momentjs.com
//! version : 2.29.4