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

412 lines
473 KiB

2 years ago
/*
3 years ago
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
3 years ago
if you want to view the source visit the plugins github repository
*/
/*
License obsidian-tasks:
MIT License
3 months ago
Copyright (c) 2021 Clare Macrae, Ilyas Landikov and Martin Schenck
3 years ago
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.
*/
2 months ago
/*
License flatpickr (included library):
The MIT License (MIT)
Copyright (c) 2017 Gregory Petrosyan
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.
*/
1 week ago
"use strict";var _E=Object.create;var pa=Object.defineProperty,vE=Object.defineProperties,wE=Object.getOwnPropertyDescriptor,kE=Object.getOwnPropertyDescriptors,EE=Object.getOwnPropertyNames,Xo=Object.getOwnPropertySymbols,SE=Object.getPrototypeOf,Nc=Object.prototype.hasOwnProperty,og=Object.prototype.propertyIsEnumerable;var ag=(r,e,t)=>e in r?pa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,K=(r,e)=>{for(var t in e||(e={}))Nc.call(e,t)&&ag(r,t,e[t]);if(Xo)for(var t of Xo(e))og.call(e,t)&&ag(r,t,e[t]);return r},de=(r,e)=>vE(r,kE(e));var Zo=(r,e)=>{var t={};for(var n in r)Nc.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&Xo)for(var n of Xo(r))e.indexOf(n)<0&&og.call(r,n)&&(t[n]=r[n]);return t};var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),OE=(r,e)=>{for(var t in e)pa(r,t,{get:e[t],enumerable:!0})},ug=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of EE(e))!Nc.call(r,i)&&i!==t&&pa(r,i,{get:()=>e[i],enumerable:!(n=wE(e,i))||n.enumerable});return r};var ma=(r,e,t)=>(t=r!=null?_E(SE(r)):{},ug(e||!r||!r.__esModule?pa(t,"default",{value:r,enumerable:!0}):t,r)),DE=r=>ug(pa({},"__esModule",{value:!0}),r);var A=(r,e,t)=>new Promise((n,i)=>{var s=u=>{try{o(t.next(u))}catch(l){i(l)}},a=u=>{try{o(t.throw(u))}catch(l){i(l)}},o=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,a);o((t=t.apply(r,e)).next())});var Re=E(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.matchAnyPattern=Gn.extractTerms=Gn.repeatedTimeunitPattern=void 0;function CE(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}Gn.repeatedTimeunitPattern=CE;function lg(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}Gn.extractTerms=lg;function AE(r){return`(?:${lg(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}Gn.matchAnyPattern=AE});var we=E((Fc,Lc)=>{(function(r,e){typeof Fc=="object"&&typeof Lc!="undefined"?Lc.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(Fc,function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",i="second",s="minute",a="hour",o="day",u="week",l="month",c="quarter",d="year",f="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|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,k={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(j,$,D){var Y=String(j);return!Y||Y.length>=$?j:""+Array($+1-Y.length).join(D)+j},R={s:_,z:function(j){var $=-j.utcOffset(),D=Math.abs($),Y=Math.floor(D/60),I=D%60;return($<=0?"+":"-")+_(Y,2,"0")+":"+_(I,2,"0")},m:function j($,D){if($.date()<D.date())return-j(D,$);var Y=12*(D.year()-$.year())+(D.month()-$.month()),I=$.clone().add(Y,l),J=D-I<0,p=$.clone().add(Y+(J?-1:1),l);return+(-(Y+(D-I)/(J?I-p:p-I))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:l,y:d,w:u,d:o,D:f,h:a,m:s,s:i,ms:n,Q:c}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},S="en",F={};F[S]=k;var q=function(j){return j instanceof ge},ne=function(j,$,D){var Y;if(!j)return S;if(typeof j=="string")F[j]&&(Y=j),$&&(F[j]=$,Y=j);else{var I=j.name;F[I]=j,Y=I}return!D&&Y&&(S=Y),Y||!D&&S},G=function(j,$){if(q(j))return j.clone();var D=typeof $=="object"?$:{};return D.date=j,D.args=arguments,new ge(D)},B=R;B.l=ne,B.i=q,B.w=function(j,$){return G(j,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var ge=function(){function j(D){this.$L=ne(D.locale,null,!0),this.parse(D)}var $=j.prototype;return $.parse=function(D){this.$d=function(Y){var I=Y.date,J=Y.utc;if(I===null)return new Date(NaN);if(B.u(I))return new Date;if(I instanceof Date)return new Date(I);if(typeof I=="string"&&!/Z$/i.test(I)){var p=I.match(y);if(p){var h=p[2]-1||0,g=(p[7]||"0").substring(0,3);return J?new
`).map(oN).filter(function(t){return t!==null});return pt(pt({},e[0]),e[1])}function vo(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],i=t[2];return n&&(e.tzid=n),e.dtstart=yo(i),e}function oN(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return ev(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return ev(r);case"DTSTART":return vo(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function ev(r){var e=r.replace(/^RRULE:/i,""),t=vo(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(i){var s=i.split("="),a=s[0],o=s[1];switch(a.toUpperCase()){case"FREQ":t.freq=ye[o.toUpperCase()];break;case"WKST":t.wkst=mr[o.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var u=uN(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=lN(o);break;case"DTSTART":case"TZID":var c=vo(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=yo(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function uN(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(tv)}return tv(r)}function tv(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function lN(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return mr[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 i=Number(n[1]),s=n[2],a=mr[s].weekday;return new Ve(a,i)})}var Ri=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=gs(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(){return this.isUTC?this.date:B_(this.date,this.tzid)},r}();function ko(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(_o),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!_e(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!Fe(o)||ft(o)&&!o.length)){switch(a){case"FREQ":u=V.FREQUENCIES[r.freq];break;case"WKST":zt(o)?u=new Ve(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=W_(o).map(function(m){return m instanceof Ve?m:ft(m)?new Ve(m[0],m[1]):new Ve(m)}).toString();break;case"DTSTART":t=cN(o,r.tzid);break;case"UNTIL":u=gs(o,!r.tzid);break;default:if(ft(o)){for(var l=[],c=0;c<o.length;c++)l[c]=String(o[c]);u=l.toString()}else u=String(o)}u&&e.push([a,u])}}var d=e.map(function(m){var y=m[0],b=m[1];return"".concat(y,"=").concat(b.toString())}).join(";"),f="";return d!==""&&(f="RRULE:".concat(d)),[t,f].filter(function(m){return!!m}).join(`
`)}function cN(r,e){return r?"DTSTART"+new Ri(new Date(r),e).toString():""}function dN(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 rv=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?Ju(t):Mm(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,i=t?Object.keys(t):[],s=function(c){for(var d=0;d<i.length;d++){var f=i[d];if(!dN(t[f],c[f]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(ft(a))for(var o=0;o<a.length;o++){var u=a[o];if(!(i.length&&s(u))){n=u._value;break}}if(!n&&this.all){for(var l=new On(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return ft(n)?Mm(n):n instanceof Date?Ju(n):n},r}();var nv=L(L(L(L(L(L(L(L(L(L(L(L(L([],be(1,31),!0),be(2,28),!0),be(3,31),!0),be(4,30),!0),be(5,31),!0),be(6,30),!0),be(7,31),!0),be(8,31),!0),be(9,30),!0),be(10,31),!0),be(11,30),!0),be(12,31),!0),be(1,7),!0),iv=L(L(L(L(L(L(L(L(L(L(L(L(L([],be(1,31),!0),be(2,29),!0),be(3,31),!0),be(4,30),!0),be(5,31),!0),be(6,30),!0),be(7,31),!0),be(8,31),!0),be(9,30),!0),be(10,31),!0),be(11,30),!0),be(12,31),!0),be(1,7),!0),fN=pr(1,29),pN=pr(1,30),Qn=pr(1,31),Tt=pr(1,32),sv=L(L(L(L(L(L(L(L(L(L(L(L(L([],Tt,!0),pN,!0),Tt,!0),Qn,!0),Tt,!0),Qn,!0),Tt,!0),Tt,!0),Qn,!0),Tt,!0),Qn,!0),Tt,!0),Tt.slice(0,7),!0),av=L(L(L(L(L(L(L(L(L(L(L(L(L([],Tt,!0),fN,!0),Tt,!0),Qn,!0),Tt,!0),Qn,!0),Tt,!0),Tt,!0),Qn,!0),Tt,!0),Qn,!0),Tt,!0),Tt.slice(0,7),!0),mN=pr(-28,0),hN=pr(-29,0),Xn=pr(-30,0),bt=pr(-31,0),ov=L(L(L(L(L(L(L(L(L(L(L(L(L([],bt,!0),hN,!0),bt,!0),Xn,!0),bt,!0),Xn,!0),bt,!0),bt,!0),Xn,!0),bt,!0),Xn,!0),bt,!0),bt.slice(0,7),!0),uv=L(L(L(L(L(L(L(L(L(L(L(L(L([],bt,!0),mN,!0),bt,!0),Xn,!0),bt,!0),Xn,!0),bt,!0),bt,!0),Xn,!0),bt,!0),Xn,!0),bt,!0),bt.slice(0,7),!0),lv=[0,31,60,91,121,152,182,213,244,274,305,335,366],cv=[0,31,59,90,120,151,181,212,243,273,304,334,365],Nm=function(){for(var r=[],e=0;e<55;e++)r=r.concat(pr(7));return r}();function dv(r,e){var t=Zr(r,1,1),n=hs(r)?366:365,i=hs(r+1)?366:365,s=go(t),a=En(t),o=pt(pt({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},gN(r)),{wnomask:null});if(Kt(e.byweekno))return o;o.wnomask=be(0,n+7);var u,l,c=u=yt(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+yt(a-e.wkst,7)):l=n-c;for(var d=Math.floor(l/7),f=yt(l,7),m=Math.floor(d+f/4),y=0;y<e.byweekno.length;y++){var b=e.byweekno[y];if(b<0&&(b+=m+1),b>0&&b<=m){var k=void 0;b>1?(k=c+(b-1)*7,c!==u&&(k-=7-u)):k=c;for(var _=0;_<7&&(o.wnomask[k]=1,k++,o.wdaymask[k]!==e.wkst);_++);}}if(_e(e.byweekno,1)){var k=c+m*7;if(c!==u&&(k-=7-u),k<n)for(var y=0;y<7&&(o.wnomask[k]=1,k+=1,o.wdaymask[k]!==e.wkst);y++);}if(c){var R=void 0;if(_e(e.byweekno,-1))R=-1;else{var S=En(Zr(r-1,1,1)),F=yt(7-S.valueOf()+e.wkst,7),q=hs(r-1)?366:365,ne=void 0;F>=4?(F=0,ne=q+yt(S-e.wkst,7)):ne=n-c,R=Math.floor(52+yt(ne,7)/4)}if(_e(e.byweekno,R))for(var k=0;k<c;k++)o.wnomask[k]=1}return o}function gN(r){var e=hs(r)?366:365,t=Zr(r,1,1),n=En(t);return e===365?{mmask:nv,mdaymask:av,nmdaymask:uv,wdaymask:Nm.slice(n),mrange:cv}:{mmask:iv,mdaymask:sv,nmdaymask:ov,wdaymask:Nm.slice(n),mrange:lv}}function fv(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===V.YEARLY)if(Kt(s.bymonth))o=[[0,t]];else for(var u=0;u<s.bymonth.length;u++)e=s.bymonth[u],o.push(n.slice(e-1,e+1));else s.freq===V.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Kt(o))return a;a.nwdaymask=be(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],c=l[0],d=l[1]-1,f=0;f<s.bynweekday.length;f++){var m=void 0,y=s.bynweekday[f],b=y[0],k=y[1];k<0?(m=d+(k+1)*7,m-=yt(i[m]-b,7)):(m=c+(k-1)*7,m+=yt(7-i[m]+b,7)),c<=m&&m<=d&&(a.nwdaymask[m]=1)}return a}function pv(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),i=r%100,s=Math.floor(n/4),a=n%4,o=Math.floor((n+8)/25),u=Math.floor((n-o+1)/3),l=Math.floor(19*t+n-s-u+15)%30,c=Math.floor(i/4),d=i%4,f=Math.floor(32+2*a+2*c-l-d)%7,m=Math.floor((t+11*l
`),n=0;n<t.length;){var i=t[n]=t[n].replace(/\s+$/g,"");i?n>0&&i[0]===" "?(t[n-1]+=i.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function DN(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function bv(r,e){return DN(e),r.split(",").map(function(t){return yo(t)})}function _v(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 i=e._rrule[n].origOptions[r];if(i)return i}}}var Fm=function(r){ys(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=_v.apply(n,["dtstart"]),n.tzid=_v.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return yv(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){vv(t,this._rrule)},e.prototype.exrule=function(t){vv(t,this._exrule)},e.prototype.rdate=function(t){wv(t,this._rdate)},e.prototype.exdate=function(t){wv(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return tl(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return tl(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(ko({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
2 years ago
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
1 week ago
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(kv("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(kv("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}(V);function vv(r,e){if(!(r instanceof V))throw new TypeError(String(r)+" is not RRule instance");_e(e.map(String),String(r))||e.push(r)}function wv(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");_e(e.map(Number),Number(r))||(e.push(r),Sn(e))}function kv(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return gs(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}var st=class{constructor({rrule:e,baseOnToday:t,occurrence:n}){this.rrule=e,this.baseOnToday=t,this.occurrence=n}static fromText({recurrenceRuleText:e,occurrence:t}){try{let n=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(n==null)return null;let i=n[1].trim(),s=n[2]!==void 0,a=V.parseText(i);if(a!==null){let o=t.referenceDate;!s&&o!==null?a.dtstart=window.moment(o).startOf("day").utc(!0).toDate():a.dtstart=window.moment().startOf("day").utc(!0).toDate();let u=new V(a);return new st({rrule:u,baseOnToday:s,occurrence:t})}}catch(n){n instanceof Error&&console.log(n.message)}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(e=window.moment()){let t=this.nextReferenceDate(e);return t===null?null:this.occurrence.next(t)}identicalTo(e){return this.baseOnToday!==e.baseOnToday||!this.occurrence.isIdenticalTo(e.occurrence)?!1:this.toText()===e.toText()}nextReferenceDate(e){return this.baseOnToday?this.nextReferenceDateFromToday(e.clone()).toDate():this.nextReferenceDateFromOriginalReferenceDate().toDate()}nextReferenceDateFromToday(e){let t=new V(de(K({},this.rrule.origOptions),{dtstart:e.startOf("day").utc(!0).toDate()}));return this.nextAfter(e.endOf("day"),t)}nextReferenceDateFromOriginalReferenceDate(){var t;let e=window.moment((t=this.occurrence.referenceDate)!=null?t:void 0).endOf("day");return this.nextAfter(e,this.rrule)}nextAfter(e,t){e.utc(!0);let n=window.moment.utc(t.after(e.toDate())),i=this.toText(),s=i.match(/every( \d+)? month(s)?(.*)?/);s!==null&&(i.includes(" on ")||(n=st.nextAfterMonths(e,n,t,s[1])));let a=i.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=st.nextAfterYears(e,n,t,a[1])),st.addTimezone(n)}static nextAfterMonths(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));st.isSkippingTooManyMonths(e,t,s);)t=st.fromOneDayEarlier(e,n);return t}static isSkippingTooManyMonths(e,t,n){let i=t.month()-e.month();return i+=(t.year()-e.year())*12,i>n}static nextAfterYears(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));st.isSkippingTooManyYears(e,t,s);)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 V(n),window.moment.utc(t.after(e.toDate()))}static addTimezone(e){return window.moment.utc(e).set({hour:12,minute:0,second:0,millisecond:0}).local(!0).startOf("day")}};var _s=(m=>(m.Description="description",m.Id="id",m.DependsOn="dependsOn",m.Priority="priority",m.RecurrenceRule="recurrenceRule",m.OnCompletion="onCompletion",m.CreatedDate="createdDate",m.StartDate="startDate",m.ScheduledDate="scheduledDate",m.DueDate="dueDate",m.CancelledDate="cancelledDate",m.DoneDate="doneDate",m.BlockLink="blockLink",m))(_s||{}),rl=Object.values(_s),en=class{constructor(){this.visible={};this.tagsVisible=!0;rl.forEach(e=>{this.visible[e]=!0})}isShown(e){return this.visible[e]}areTagsShown(){return this.tagsVisible}hide(e){this.visible[e]=!1}setVisibility(e,t){this.visible[e]=t}setTagsVisibility(e){this.tagsVisible=e}get shownComponents(){return rl.filter(e=>this.visible[e])}get hiddenComponents(){return rl.filter(e=>!this.visible[e])}get toggleableComponents(){r
`})),c=c.slice(0,a.autoSuggestMaxItems),c}}function NN(r,e,t){let n=HN(e.substring(0,t),[["(",")"],["[","]"]])=="("?")":"]",i=r?n+" ":" ",s=r&&e.length>t&&e.charAt(t)===n?1:0;return{postfix:i,insertSkip:s}}function IN(r,e,t){let n=[],i=t.line;Pi(n,i,r.dueDateSymbol,"due date"),Pi(n,i,r.startDateSymbol,"start date"),Pi(n,i,r.scheduledDateSymbol,"scheduled date"),FN(n,r,t),Pi(n,i,r.recurrenceSymbol,"recurring (repeat)"),LN(n,r,t),Cv(e)&&(Pi(n,i,r.idSymbol,"id"),Pi(n,i,r.dependsOnSymbol,"depends on id")),Pi(n,i,r.onCompletionSymbol,"on completion");let s=UN(n,t);return s.length===0&&t.settings.autoSuggestMinMatch===0?n:s}function Pi(r,e,t,n){e.includes(t)||r.push({displayText:`${t} ${n}`,appendText:`${t} `})}function FN(r,e,t){if(!(i=>Object.values(e.prioritySymbols).some(s=>s.length>0&&i.includes(s)))(t.line)){let i=e.prioritySymbols,s=["High","Medium","Low","Highest","Lowest"];for(let a of s){let o=i[a];r.push({displayText:t.dataviewMode?`${o} priority`:`${o} ${a.toLowerCase()} priority`,appendText:`${o}${t.postfix}`,insertSkip:t.dataviewMode?t.insertSkip:void 0})}}}function LN(r,e,t){if(!t.line.includes(e.createdDateSymbol)){let i=Vt.parseDate("today",!0).format(Z.dateFormat);r.push({textToMatch:`${e.createdDateSymbol} created`,displayText:`${e.createdDateSymbol} created today (${i})`,appendText:`${e.createdDateSymbol} ${i}`+t.postfix,insertSkip:t.dataviewMode?t.insertSkip:void 0})}}function UN(r,e){let t=ws(/([a-zA-Z'_-]*)/g,e),n=[];if(t&&t.length>0){let i=t[0];if(i.length>=Math.max(1,e.settings.autoSuggestMinMatch)){let s=r.filter(a=>{var u;return((u=a.textToMatch)!=null?u:a.displayText).toLowerCase().includes(i.toLowerCase())});for(let a of s){let o=e.dataviewMode&&(a.displayText.includes("priority")||a.displayText.includes("created"))?i.length+e.insertSkip:i.length;n.push({suggestionType:"match",displayText:a.displayText,appendText:a.appendText,insertAt:t.index,insertSkip:o})}}}return n}function Av(r,e){let t=`${e}`,n=`${r} ${e}`;return{displayText:t,appendText:n}}function WN(r,e){let n=`${Vt.parseDate(e,!0).format(Z.dateFormat)}`,i=`${e} (${n})`,s=`${r} ${n}`;return{displayText:i,appendText:s}}function qN(r,e,t){let n=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],i=[],s=new RegExp(`(${r})\\s*([0-9a-zA-Z ]*)`,"ug"),a=ws(s,t);if(a&&a.length>=2){let o=a[2];if(o.length<t.settings.autoSuggestMinMatch)return[];let u=o&&o.length>1?Vt.parseDate(Vu(o),!0):null;if(u!=null&&u.isValid()){let c=u.format(Z.dateFormat);al(t,a,[c],Av,i)}let l=qm(n,o,e,!0);al(t,a,l,WN,i)}return i}function $N(r,e){var a;let t=["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"],n=[],i=new RegExp(`(${r})\\s*([0-9a-zA-Z ]*)`,"ug"),s=ws(i,e);if(s&&s.length>=2){let o=s[1],u=s[2];if(u.length<e.settings.autoSuggestMinMatch)return[];if(u.length>0){let f=(a=st.fromText({recurrenceRuleText:u,occurrence:new fr({startDate:null,scheduledDate:null,dueDate:null})}))==null?void 0:a.toText();if(f){let m=`${o} ${f}`+e.postfix;if(n.push({suggestionType:"match",displayText:`\u2705 ${f}`,appendText:m,insertAt:s.index,insertSkip:$m(s[0],e)}),s[0]==m)return[]}}let l=e.settings.autoSuggestMaxItems/2,c=qm(t,u,l,!1);c.length===0&&u.trim().length===0&&(c=t.slice(0,l)),al(e,s,c,(f,m)=>{let y=`${m}`,b=`${f} ${m}`;return{displayText:y,appendText:b}},n)}return n}function jN(r,e,t){let n=["delete","keep"],i=[],s=new RegExp(`(${r})\\s*([0-9a-zA-Z ]*)`,"ug"),a=ws(s,t);if(a&&a.length>=2){let o=a[2];if(o.length<t.settings.autoSuggestMinMatch)return[];let u=qm(n,o,e,!0);al(t,a,u,Av,i)}return i}function GN(r,e,t){let n=[],i=new RegExp(`(${r})\\s*(${Mi.source})?`,"ug"),s=ws(i,t);if(s&&s[0].trim().length<=r.length){let a=Oo(e.map(o=>o.id));n.push({suggestionType:"match",displayText:"generate unique id",appendText:`${r} ${a}`+t.postfix,insertAt:s.index,insertSkip:$m(s[0],t)})}return n}function YN(r,e,t,n){let i=
\`\`\`${n}
flowchart LR
1 year ago
classDef TODO stroke:#f33,stroke-width:3px;
classDef DONE stroke:#0c0,stroke-width:3px;
classDef IN_PROGRESS stroke:#fa0,stroke-width:3px;
classDef CANCELLED stroke:#ddd,stroke-width:3px;
classDef NON_TASK stroke:#99e,stroke-width:3px;
11 months ago
${i.join(`
`)}
8 months ago
${s.join(`
`)}
1 year ago
linkStyle default stroke:gray
\`\`\`
1 week ago
`}addEdgeIfNotToInternal(e,t,n,i,s){let a=e.findIndex(l=>l.symbol===t.symbol),o=a!==-1,u=t.type!=="EMPTY";if(o&&u){let l;s?l='-. "\u{1F501}" .-> ':l=" --> ";let c=`${i+1}${l}${a+1}`;n.push(c)}}getMermaidNodeLabel(e,t){let n=Lv(e.name),i=e.type;if(t){let s=ll(e.symbol),a=ll(e.nextStatusSymbol),o=`[${s}] -> [${a}]`,u=`'${n}'`,l=`(${i})`;return`["${u}<br>${o}<br>${l}"]:::${i}`}else return`["${n}"]:::${i}`}};var Uv=require("obsidian");var tn=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var mt=class{constructor(e){this._date=null;this._date=e}get moment(){return this._date}formatAsDate(e=""){return this.format(Z.dateFormat,e)}formatAsDateAndTime(e=""){return this.format(Z.dateTimeFormat,e)}format(e,t=""){return this._date?this._date.format(e):t}toISOString(e){return this._date?this._date.toISOString(e):""}get category(){let e=window.moment(),t=this.moment;return t?t.isBefore(e,"day")?new tn("Overdue",1):t.isSame(e,"day")?new tn("Today",2):t.isValid()?new tn("Future",3):new tn("Invalid date",0):new tn("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new tn("",0);let t=this.fromNowOrder(e);return new tn(e.fromNow(),t)}fromNowOrder(e){if(!e.isValid())return 0;let t=window.moment(),n=e.isSameOrBefore(t,"day"),i=this.fromNowStartDateOfGroup(e,n,t);return Number((n?1:3)+i.format("YYYYMMDD"))}fromNowStartDateOfGroup(e,t,n){let i=e.fromNow(!0).split(" "),s,a=Number(i[0]);isNaN(a)?s=1:s=a;let o=i[1];return t?n.subtract(s,o):n.add(s,o)}postpone(e="days",t=1){if(!this._date)throw new Uv.Notice("Cannot postpone a null date");let n=window.moment().startOf("day");return this._date.isSameOrAfter(n,"day")?this._date.clone().add(t,e):n.add(t,e)}};var Mn=class{static priorityNameUsingNone(e){let t="ERROR";switch(e){case"1":t="High";break;case"0":t="Highest";break;case"2":t="Medium";break;case"3":t="None";break;case"4":t="Low";break;case"5":t="Lowest";break}return t}static priorityNameUsingNormal(e){return Mn.priorityNameUsingNone(e).replace("None","Normal")}};var QN=require("obsidian"),jv=ma($v());var Bm=class extends jv.EventEmitter2{constructor(){super(...arguments);this.options={minLevels:{"":"info",tasks:"info"}};this.consoleLoggerRegistered=!1;this.arrAvg=t=>t.reduce((n,i)=>n+i,0)/t.length}configure(t){return this.options=Object.assign({},this.options,t),this}getLogger(t){let n="none",i="";for(let s in this.options.minLevels)t.startsWith(s)&&s.length>=i.length&&(n=this.options.minLevels[s],i=s);return new Hm(this,t,n)}onLogEntry(t){return this.on("log",t),this}registerConsoleLogger(){return this.consoleLoggerRegistered?this:(this.onLogEntry(t=>{let n=`[${window.moment().format("YYYY-MM-DD-HH:mm:ss.SSS")}][${t.level}][${t.module}]`;switch(t.traceId&&(n+=`[${t.traceId}]`),n+=` ${t.message}`,t.objects===void 0&&(t.objects=""),t.level){case"trace":console.trace(n,t.objects);break;case"debug":console.debug(n,t.objects);break;case"info":console.info(n,t.objects);break;case"warn":console.warn(n,t.objects);break;case"error":console.error(n,t.objects);break;default:console.log(`{${t.level}} ${n}`,t.objects)}}),this.consoleLoggerRegistered=!0,this)}},Rt=new Bm,Hm=class{constructor(e,t,n){this.levels={trace:1,debug:2,info:3,warn:4,error:5};this.logManager=e,this.module=t,this.minLevel=this.levelToInt(n)}levelToInt(e){return e.toLowerCase()in this.levels?this.levels[e.toLowerCase()]:99}log(e,t,n){if(this.levelToInt(e)<this.minLevel)return;let s={level:e,module:this.module,message:t,objects:n,traceId:void 0};this.logManager.emit("log",s)}trace(e,t){this.log("trace",e,t)}debug(e,t){this.log("debug",e,t)}info(e,t){this.log("info",e,t)}warn(e,t){this.log("warn",e,t)}error(e,t){this.log("error",e,t)}logWithId(e,t,n,i){if(this.levelToInt(e)<this.minLevel)return;let a={level:e,module:this.module,message:n,objects:i,traceId:t};this.logManager.emit("log",a)}traceWithId(e,t,n){this.logWithId("trace",e,t,n)}debugWithId(e,t,n){this.logWithId("debug",e,t,n)}infoWithId(e,t,n){this.logWithId("info",e,t,n)}warnWithId(e,t,n){this.logWithId("warn",e,t,n)}errorWithId(e,t,n)
`),l=u.length,c=new xo(()=>_t.fromPath(r)),d=null,f=0,m=new Map;for(let k of t){let _=k.position.start.line;if(_>=l)return n.debug(`${r} Obsidian gave us a line number ${_} past the end of the file. ${l}.`),o;if((d===null||d.position.end.line<_)&&(d=Es.getSection(_,i.sections),f=0),d===null)continue;let R=u[_];if(R===void 0){n.debug(`${r}: line ${_} - ignoring 'undefined' line.`);continue}if(k.task!==void 0){let S;try{if(S=ee.fromLine({line:R,taskLocation:new ht(a,_,d.position.start.line,f,Es.getPrecedingHeader(_,i.headings)),fallbackDate:c.value}),S!==null){let F=(y=m.get(k.parent))!=null?y:null;F!==null&&(S=new ee(de(K({},S),{parent:F}))),m.set(_,S)}}catch(F){s(F,r,k,R);continue}S!==null&&(f++,o.push(S))}else{let S=k.position.start.line,F=(b=m.get(k.parent))!=null?b:null;m.set(S,new mn(u[S],F))}}return o}var Es=class{constructor({metadataCache:e,vault:t,workspace:n,events:i}){this.logger=Rt.getLogger("tasks.Cache");this.logger.debug("Creating Cache object"),this.metadataCache=e,this.metadataCacheEventReferences=[],this.vault=t,this.workspace=n,this.vaultEventReferences=[],this.events=i,this.eventsEventReferences=[],this.tasksMutex=new Jo,this.state="Cold",this.logger.debug("Cache.constructor(): state = Cold"),this.tasks=[],this.loadedAfterFirstResolve=!1,this.subscribeToCache(),this.workspace.onLayoutReady(()=>{this.subscribeToVault(),this.loadVault()}),this.subscribeToEvents()}unload(){this.logger.info("Unloading Cache");for(let e of this.metadataCacheEventReferences)this.metadataCache.offref(e);for(let e of this.vaultEventReferences)this.vault.offref(e);for(let e of this.eventsEventReferences)this.events.off(e)}getTasks(){return this.tasks}getState(){return this.state}notifySubscribers(){this.logger.debug("Cache.notifySubscribers()"),this.events.triggerCacheUpdate({tasks:this.tasks,state:this.state})}subscribeToCache(){this.logger.debug("Cache.subscribeToCache()");let e=this.metadataCache.on("resolved",()=>A(this,null,function*(){this.loadedAfterFirstResolve||(this.loadedAfterFirstResolve=!0,this.loadVault())}));this.metadataCacheEventReferences.push(e);let t=this.metadataCache.on("changed",n=>{this.tasksMutex.runExclusive(()=>{this.indexFile(n)})});this.metadataCacheEventReferences.push(t)}subscribeToVault(){this.logger.debug("Cache.subscribeToVault()");let{useFilenameAsScheduledDate:e}=Q(),t=this.vault.on("create",s=>{s instanceof ks.TFile&&(this.logger.debug(`Cache.subscribeToVault.createdEventReference() ${s.path}`),this.tasksMutex.runExclusive(()=>{this.indexFile(s)}))});this.vaultEventReferences.push(t);let n=this.vault.on("delete",s=>{s instanceof ks.TFile&&(this.logger.debug(`Cache.subscribeToVault.deletedEventReference() ${s.path}`),this.tasksMutex.runExclusive(()=>{this.tasks=this.tasks.filter(a=>a.path!==s.path),this.notifySubscribers()}))});this.vaultEventReferences.push(n);let i=this.vault.on("rename",(s,a)=>{s instanceof ks.TFile&&(this.logger.debug(`Cache.subscribeToVault.renamedEventReference() ${s.path}`),this.tasksMutex.runExclusive(()=>{let o=this.metadataCache.getFileCache(s),u=new ut(s.path,o!=null?o:void 0),l=new xo(()=>_t.fromPath(s.path));this.tasks=this.tasks.map(c=>{if(c.path!==a)return c;let d=c.taskLocation.fromRenamedFile(u);return e?_t.updateTaskPath(c,d,l.value):new ee(de(K({},c),{taskLocation:d}))}),this.notifySubscribers()}))});this.vaultEventReferences.push(i)}subscribeToEvents(){this.logger.debug("Cache.subscribeToEvents()");let e=this.events.onRequestCacheUpdate(t=>{t({tasks:this.tasks,state:this.state})});this.eventsEventReferences.push(e)}loadVault(){return this.logger.debug("Cache.loadVault()"),this.tasksMutex.runExclusive(()=>A(this,null,function*(){this.state="Initializing",this.logger.debug("Cache.loadVault(): state = Initializing"),yield Promise.all(this.vault.getMarkdownFiles().map(e=>this.indexFile(e))),this.state="Warm",this.logger.debug("Cache.loadVault(): state = Warm"),this.notifySubscribers()}))}indexFile(e){return A(this,null,function*(){let t=this.metadataCache.getFileCache(e);if(t==null)return;if(!e.path.endsWith(".md")){this.logger.debug("indexFile: skipping non-
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: ${e}
6 months ago
File: ${t}
Line number: ${n.position.start.line}
8 months ago
Task line: ${i}
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.
1 week ago
`;this.logger.error(s),e instanceof Error&&this.logger.error(e.stack?e.stack:"Cannot determine stack"),this.state==="Initializing"&&new ks.Notice(s,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 i of t){if(i.position.start.line>e)return n;n=i.heading}return n}};var gh=require("obsidian");var $w=require("obsidian");function Ue(){}function Xm(r){return r()}function Gv(){return Object.create(null)}function Ut(r){r.forEach(Xm)}function ml(r){return typeof r=="function"}function rn(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Yv(r){return Object.keys(r).length===0}var Bv=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,Mo=class{constructor(e){this.options=e,this._listeners="WeakMap"in Bv?new WeakMap:void 0}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(t=>{var n;for(let i of t)Mo.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};Mo.entries="WeakMap"in Bv?new WeakMap:void 0;var Hv=!1;function ZN(){Hv=!0}function JN(){Hv=!1}function U(r,e){r.appendChild(e)}function pe(r,e,t){r.insertBefore(e,t||null)}function oe(r){r.parentNode&&r.parentNode.removeChild(r)}function Li(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function X(r){return document.createElement(r)}function eI(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Me(r){return document.createTextNode(r)}function ue(){return Me(" ")}function Vv(){return Me("")}function xe(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function zv(r){return function(e){return e.preventDefault(),r.call(this,e)}}function W(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Kv(r){let e;return{p(...t){e=t,e.forEach(n=>r.push(n))},r(){e.forEach(t=>r.splice(r.indexOf(t),1))}}}function tI(r){return Array.from(r.childNodes)}function Fr(r,e){e=""+e,r.data!==e&&(r.data=e)}function yr(r,e){r.value=e==null?"":e}function Zm(r,e,t){for(let n=0;n<r.options.length;n+=1){let i=r.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function Qv(r){let e=r.querySelector(":checked");return e&&e.__value}var fl;function rI(){if(fl===void 0){fl=!1;try{typeof window!="undefined"&&window.parent&&window.parent.document}catch(r){fl=!0}}return fl}function Xv(r,e){getComputedStyle(r).position==="static"&&(r.style.position="relative");let n=X("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;let i=rI(),s;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",s=xe(window,"message",a=>{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=xe(n.contentWindow,"resize",e),e()}),U(r,n),()=>{(i||s&&n.contentWindow)&&s(),oe(n)}}function An(r,e,t){r.classList[t?"add":"remove"](e)}var xs=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=eI(t.nodeName):this.e=X(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)pe(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(oe)}};var Co;function Ro(r){Co=r}function nI(){if(!Co)throw new Error("Function called outside component initialization");return Co}function Jm(r){nI().$$.on_mount.push(r)}var Os=[];var je=[],Ds=[],Km=[],iI=Promise.
9 months ago
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.
1 week ago
`;wl(c);return}let l=Math.min(Math.pow(10,s),100);o.debug(`timeout = ${l}`),setTimeout(()=>A(void 0,null,function*(){yield Mw({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:s+1})}),l)});try{let[l,c,d]=yield Cw(r,t),f=[...d.slice(0,l),...e.map(m=>m.toFileLineString()),...d.slice(l+1)];yield t.modify(c,f.join(`
`))}catch(l){if(l instanceof ei){l.message&&Rw(l.message),yield u();return}else if(l instanceof kl){yield u();return}else l instanceof Error&&wl(l.message)}});function Cw(r,e){return A(this,null,function*(){if(Lo===void 0)throw new ei;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof Uo.TFile))throw new ei(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!II.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=Lo.getFileCache(t);if(n==null||n===null)throw new ei(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let i=n.listItems;if(i===void 0||i.length===0)throw new ei(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let a=(yield e.read(t)).split(`
`),o=LI(r,a,i,FI);if(o===void 0)throw new kl;return[o,t,a]})}function fh(r,e){return A(this,null,function*(){try{let[t,n,i]=yield Cw(r,e);return[t,n]}catch(t){t instanceof ei?t.message&&Rw(t.message):t instanceof Error&&wl(t.message)}})}function Aw(r,e){return r<e.length}function LI(r,e,t,n){let i=UI(r,e);return i!==void 0||(i=WI(r,e),i!==void 0)?i:qI(r,e,t,n)}function UI(r,e){let t=r.taskLocation.lineNumber;if(Aw(t,e)&&e[t]===r.originalMarkdown)return El().debug(`Found original markdown at original line number ${t}`),t}function WI(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 qI(r,e,t,n){let i,s=0;for(let a of t){let o=a.position.start.line;if(!Aw(o,e))return;if(o<r.taskLocation.sectionStart||a.task===void 0)continue;let u=e[o];if(ve.getInstance().includedIn(u)){if(s===r.taskLocation.sectionIndex){if(u===r.originalMarkdown)i=o;else{n(`Tasks: Unable to find task in file ${r.taskLocation.path}.
9 months ago
Expected task:
${r.originalMarkdown}
Found task:
1 week ago
${u}`);return}break}s++}}return i}var Is=class{constructor(e){this.addGlobalFilterOnSave=e.addGlobalFilterOnSave,this.originalBlocking=e.originalBlocking,this.description=e.description,this.status=e.status,this.priority=e.priority,this.onCompletion=e.onCompletion,this.recurrenceRule=e.recurrenceRule,this.createdDate=e.createdDate,this.startDate=e.startDate,this.scheduledDate=e.scheduledDate,this.dueDate=e.dueDate,this.doneDate=e.doneDate,this.cancelledDate=e.cancelledDate,this.forwardOnly=e.forwardOnly,this.blockedBy=e.blockedBy,this.blocking=e.blocking}static fromTask(e,t){let n=ve.getInstance().removeAsWordFrom(e.description),i=n!=e.description||!ve.getInstance().includedIn(e.description),s="none";e.priority==="5"?s="lowest":e.priority==="4"?s="low":e.priority==="2"?s="medium":e.priority==="1"?s="high":e.priority==="0"&&(s="highest");let a=[];for(let u of e.dependsOn){let l=t.find(c=>c.id===u);!l||a.push(l)}let o=t.filter(u=>u.dependsOn.includes(e.id));return new Is({addGlobalFilterOnSave:i,originalBlocking:o,description:n,status:e.status,priority:s,recurrenceRule:e.recurrence?e.recurrence.toText():"",onCompletion:e.onCompletion,createdDate:e.created.formatAsDate(),startDate:e.start.formatAsDate(),scheduledDate:e.scheduled.formatAsDate(),dueDate:e.due.formatAsDate(),doneDate:e.done.formatAsDate(),cancelledDate:e.cancelled.formatAsDate(),forwardOnly:!0,blockedBy:a,blocking:o})}applyEdits(e,t){return A(this,null,function*(){let n=this.description.trim();this.addGlobalFilterOnSave&&(n=ve.getInstance().prependTo(n));let i=Si(this.startDate,this.forwardOnly),s=Si(this.scheduledDate,this.forwardOnly),a=Si(this.dueDate,this.forwardOnly),o=Si(this.cancelledDate,this.forwardOnly),u=Si(this.createdDate,this.forwardOnly),l=Si(this.doneDate,this.forwardOnly),c=null;this.recurrenceRule&&(c=st.fromText({recurrenceRuleText:this.recurrenceRule,occurrence:new fr({startDate:i,scheduledDate:s,dueDate:a})}));let d;switch(this.priority){case"lowest":d="5";break;case"low":d="4";break;case"medium":d="2";break;case"high":d="1";break;case"highest":d="0";break;default:d="3"}let f=this.onCompletion,m=[];for(let S of this.blockedBy){let F=yield $I(S,t);m.push(F)}let y=e.id,b=[],k=[];(this.blocking.toString()!==this.originalBlocking.toString()||this.blocking.length!==0)&&(e.id===""&&(y=Oo(t.filter(S=>S.id!=="").map(S=>S.id))),b=this.originalBlocking.filter(S=>!this.blocking.includes(S)),k=this.blocking.filter(S=>!this.originalBlocking.includes(S)));let _=new ee(de(K({},e),{description:n,status:e.status,priority:d,onCompletion:f,recurrence:c,startDate:i,scheduledDate:s,dueDate:a,doneDate:l,createdDate:u,cancelledDate:o,dependsOn:m.map(S=>S.id),id:y}));for(let S of b){let F=xv(S,_);yield br({originalTask:S,newTasks:F})}for(let S of k){let F=Dv(S,_);yield br({originalTask:S,newTasks:F})}let R=this.inferTodaysDate(this.status.type,l,o);return _.handleNewStatusWithRecurrenceInUsersOrder(this.status,R)})}inferTodaysDate(e,t,n){return e==="DONE"&&t!==null?t:e==="CANCELLED"&&n!==null?n:window.moment()}parseAndValidateRecurrence(){var t;if(!this.recurrenceRule)return{parsedRecurrence:"<i>not recurring</>",isRecurrenceValid:!0};let e=(t=st.fromText({recurrenceRuleText:this.recurrenceRule,occurrence:new fr({startDate:null,scheduledDate:null,dueDate:null})}))==null?void 0:t.toText();return e?this.startDate||this.scheduledDate||this.dueDate?{parsedRecurrence:e,isRecurrenceValid:!0}:{parsedRecurrence:"<i>due, scheduled or start date required</i>",isRecurrenceValid:!1}:{parsedRecurrence:"<i>invalid recurrence rule</i>",isRecurrenceValid:!1}}};function $I(r,e){return A(this,null,function*(){if(r.id!=="")return r;let t=e.filter(i=>i.id!==""),n=il(r,t.map(i=>i.id));return yield br({originalTask:r,newTasks:n}),n})}function jI(r){let e,t=gt("Recurs",r[2])+"",n,i,s,a,o,u,l,c,d;return{c(){e=X("label"),n=ue(),i=X("input"),s=ue(),a=X("code"),o=Me(r[4]),u=ue(),l=new xs(!1),W(e,"for","recurrence"),W(i,"id","recurrence"),W(i,"type","text"),W(i,"class","tasks-modal-date-input"),W(i,"placeholder","Try 'every day when done'"),W(i,"accesskey",r[2]),An(i,"tasks-modal-error",!r[
`);e.setLine(o,y)};new ti({app:n,task:l,onSubmit:c,allTasks:i}).open()};var yh=require("obsidian");var Gw=(r,e,t)=>{var u;if(r)return t instanceof yh.MarkdownView;if(!(t instanceof yh.MarkdownView))return;let n=(u=t.file)==null?void 0:u.path;if(n===void 0)return;let i=e.getCursor(),s=i.line,a=e.getLine(s),o=Th(a,n);e.setLine(s,o.text),e.setCursor(tF(i,o))},Th=(r,e)=>{let t=ee.fromLine({line:r,taskLocation:ht.fromUnknownPosition(new ut(e)),fallbackDate:null});if(t!==null){let n=t.toggleWithRecurrenceInUsersOrder().map(i=>i.toFileLineString());return{text:n.join(`
`),moveTo:{line:n.length-1}}}else{let n=r.match(Z.taskRegex);if(n!==null){let i=n[3],a=De.getInstance().bySymbol(i).nextStatusSymbol;return{text:r.replace(Z.taskRegex,`$1- [${a}] $4`)}}else if(Z.listItemRegex.test(r)){let i=r.replace(Z.listItemRegex,"$1$2 [ ]");return{text:i,moveTo:{ch:i.length}}}else{let i=r.replace(Z.indentationRegex,"$1- ");return{text:i,moveTo:{ch:i.length}}}}},tF=(r,e)=>{var s;let t={line:0,ch:r.ch},n=K(K({},t),(s=e.moveTo)!=null?s:{}),i=e.text.split(`
`)[n.line].length;return{line:r.line+n.line,ch:Math.min(n.ch,i)}};var Ol=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,i)=>jw(t,n,i,this.app,this.plugin.getTasks())}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Gw})}};var ri=class{constructor(){this.hidePostponeButton=!1;this.hideTaskCount=!1;this.hideBacklinks=!1;this.hideEditButton=!1;this.hideUrgency=!0;this.hideTree=!0;this.shortMode=!1;this.explainQuery=!1}};function ji(r,e){let t=`Error: ${r}.
9 months ago
The error message was:
1 week ago
`,n="";return e instanceof Error?n+=e:n+="Unknown error",`${t}"${n}"`}var rF=Object.prototype.toString,Ls=Array.isArray||function(e){return rF.call(e)==="[object Array]"};function _h(r){return typeof r=="function"}function nF(r){return Ls(r)?"array":typeof r}function bh(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Yw(r,e){return r!=null&&typeof r=="object"&&e in r}function iF(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var sF=RegExp.prototype.test;function aF(r,e){return sF.call(r,e)}var oF=/\S/;function uF(r){return!aF(oF,r)}var lF={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function cF(r){return String(r).replace(/[&<>"'`=\/]/g,function(t){return lF[t]})}var dF=/\s*/,fF=/\s+/,Bw=/\s*=/,pF=/\s*\}/,mF=/#|\^|\/|>|\{|&|=|!/;function hF(r,e){if(!r)return[];var t=!1,n=[],i=[],s=[],a=!1,o=!1,u="",l=0;function c(){if(a&&!o)for(;s.length;)delete i[s.pop()];else s=[];a=!1,o=!1}var d,f,m;function y(B){if(typeof B=="string"&&(B=B.split(fF,2)),!Ls(B)||B.length!==2)throw new Error("Invalid tags: "+B);d=new RegExp(bh(B[0])+"\\s*"),f=new RegExp("\\s*"+bh(B[1])),m=new RegExp("\\s*"+bh("}"+B[1]))}y(e||_r.tags);for(var b=new qo(r),k,_,R,S,F,q;!b.eos();){if(k=b.pos,R=b.scanUntil(d),R)for(var ne=0,G=R.length;ne<G;++ne)S=R.charAt(ne),uF(S)?(s.push(i.length),u+=S):(o=!0,t=!0,u+=" "),i.push(["text",S,k,k+1]),k+=1,S===`
`&&(c(),u="",l=0,t=!1);if(!b.scan(d))break;if(a=!0,_=b.scan(mF)||"name",b.scan(dF),_==="="?(R=b.scanUntil(Bw),b.scan(Bw),b.scanUntil(f)):_==="{"?(R=b.scanUntil(m),b.scan(pF),b.scanUntil(f),_="&"):R=b.scanUntil(f),!b.scan(f))throw new Error("Unclosed tag at "+b.pos);if(_==">"?F=[_,R,k,b.pos,u,l,t]:F=[_,R,k,b.pos],l++,i.push(F),_==="#"||_==="^")n.push(F);else if(_==="/"){if(q=n.pop(),!q)throw new Error('Unopened section "'+R+'" at '+k);if(q[1]!==R)throw new Error('Unclosed section "'+q[1]+'" at '+k)}else _==="name"||_==="{"||_==="&"?o=!0:_==="="&&y(R)}if(c(),q=n.pop(),q)throw new Error('Unclosed section "'+q[1]+'" at '+b.pos);return yF(gF(i))}function gF(r){for(var e=[],t,n,i=0,s=r.length;i<s;++i)t=r[i],t&&(t[0]==="text"&&n&&n[0]==="text"?(n[1]+=t[1],n[3]=t[3]):(e.push(t),n=t));return e}function yF(r){for(var e=[],t=e,n=[],i,s,a=0,o=r.length;a<o;++a)switch(i=r[a],i[0]){case"#":case"^":t.push(i),n.push(i),t=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],t=n.length>0?n[n.length-1][4]:e;break;default:t.push(i)}return e}function qo(r){this.string=r,this.tail=r,this.pos=0}qo.prototype.eos=function(){return this.tail===""};qo.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};qo.prototype.scanUntil=function(e){var t=this.tail.search(e),n;switch(t){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=n.length,n};function Fs(r,e){this.view=r,this.cache={".":this.view},this.parent=e}Fs.prototype.push=function(e){return new Fs(e,this)};Fs.prototype.lookup=function(e){var t=this.cache,n;if(t.hasOwnProperty(e))n=t[e];else{for(var i=this,s,a,o,u=!1;i;){if(e.indexOf(".")>0)for(s=i.view,a=e.split("."),o=0;s!=null&&o<a.length;)o===a.length-1&&(u=Yw(s,a[o])||iF(s,a[o])),s=s[a[o++]];else s=i.view[e],u=Yw(i.view,e);if(u){n=s;break}i=i.parent}t[e]=n}return _h(n)&&(n=n.call(this.view)),n};function At(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}At.prototype.clearCache=function(){typeof this.templateCache!="undefined"&&this.templateCache.clear()};At.prototype.parse=function(e,t){var n=this.templateCache,i=e+":"+(t||_r.tags).join(":"),s=typeof n!="undefined",a=s?n.get(i):void 0;return a==null&&(a=hF(e,t),s&&n.set(i,a)),a};At.prototype.render=function(e,t,n,i){var s=this.getConfigTags(i),a=this.parse(e,s),o=t instanceof Fs?t:new Fs(t,void 0);return this.renderTokens(a,o,n,e,i)};At.prototype.renderTokens=function(e,t,n,i,s){for(var a="",o,u,l,c=0,d=e.length;c<d;++c)l=void 0,o=e[c],u=o[0],u==="#"?l=this.renderSection(o,t,n,i,s):u==="^"?l=this.renderInverted(o,t,n,i,s):u===">"?l=this.renderPartial(o,t,n,s):u==="&"?l=this.unescapedValue(o,t):u==="name"?l=this.escapedValue(o,t,s):u==="text"&&(l=this.rawValue(o)),l!==void 0&&(a+=l);return a};At.prototype.renderSection=function(e,t,n,i,s){var a=this,o="",u=t.lookup(e[1]);function l(f){return a.render(f,t,n,s)}if(!!u){if(Ls(u))for(var c=0,d=u.length;c<d;++c)o+=this.renderTokens(e[4],t.push(u[c]),n,i,s);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")o+=this.renderTokens(e[4],t.push(u),n,i,s);else if(_h(u)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(t.view,i.slice(e[3],e[5]),l),u!=null&&(o+=u)}else o+=this.renderTokens(e[4],t,n,i,s);return o}};At.prototype.renderInverted=function(e,t,n,i,s){var a=t.lookup(e[1]);if(!a||Ls(a)&&a.length===0)return this.renderTokens(e[4],t,n,i,s)};At.prototype.indentPartial=function(e,t,n){for(var i=t.replace(/[^ \t]/g,""),s=e.split(`
8 months ago
`),a=0;a<s.length;a++)s[a].length&&(a>0||!n)&&(s[a]=i+s[a]);return s.join(`
1 week ago
`)};At.prototype.renderPartial=function(e,t,n,i){if(!!n){var s=this.getConfigTags(i),a=_h(n)?n(e[1]):n[e[1]];if(a!=null){var o=e[6],u=e[5],l=e[4],c=a;u==0&&l&&(c=this.indentPartial(a,l,o));var d=this.parse(c,s);return this.renderTokens(d,t,n,c,i)}}};At.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(n!=null)return n};At.prototype.escapedValue=function(e,t,n){var i=this.getConfigEscape(n)||_r.escape,s=t.lookup(e[1]);if(s!=null)return typeof s=="number"&&i===_r.escape?String(s):i(s)};At.prototype.rawValue=function(e){return e[1]};At.prototype.getConfigTags=function(e){return Ls(e)?e:e&&typeof e=="object"?e.tags:void 0};At.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Ls(e))return e.escape};var _r={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(r){Wo.templateCache=r},get templateCache(){return Wo.templateCache}},Wo=new At;_r.clearCache=function(){return Wo.clearCache()};_r.parse=function(e,t){return Wo.parse(e,t)};_r.render=function(e,t,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+nF(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Wo.render(e,t,n,i)};_r.escape=cF;_r.Scanner=qo;_r.Context=Fs;_r.Writer=At;var vh=_r;var Qw=ma(Kw());function Xw(r,e){vh.escape=function(t){return t};try{return vh.render(r,(0,Qw.default)(e))}catch(t){let n="";throw t instanceof Error?n=`There was an error expanding one or more placeholders.
1 year ago
The error message was:
${t.message.replace(/ > /g,".").replace("Missing Mustache data property","Unknown property")}`:n="Unknown error expanding placeholders.",n+=`
The problem is in:
1 week ago
${r}`,Error(n)}}function Zw(r){return kh(r,[])}function kh(r,e){return{query:{file:r,allTasks:e}}}var Us=class{constructor(e=""){this.indentation=e}explainQuery(e){if(e.error!==void 0)return this.explainError(e);let t=[];return t.push(this.explainFilters(e)),t.push(this.explainGroups(e)),t.push(this.explainSorters(e)),t.push(this.explainQueryLimits(e)),t.push(this.explainDebugSettings()),t.filter(n=>n!=="").join(`
9 months ago
`)}explainError(e){let t="";return t+=`Query has an error:
`,t+=e.error+`
`,t}explainFilters(e){return e.filters.length===0?this.indent(`No filters supplied. All tasks will match the query.
1 week ago
`):e.filters.map(t=>t.explainFilterIndented(this.indentation)).join(`
`)}explainGroups(e){return e.grouping.length===0?this.indent(`No grouping instructions supplied.
`):e.grouping.map(t=>this.indentation+t.instruction).join(`
`)+`
`}explainSorters(e){return e.sorting.length===0?this.indent(`No sorting instructions supplied.
`):e.sorting.map(t=>this.indentation+t.instruction).join(`
`)+`
`}explainQueryLimits(e){function t(i){let s=`At most ${i} task`;return i!==1&&(s+="s"),s}let n=[];if(e.limit!==void 0){let i=t(e.limit)+`.
8 months ago
`;n.push(this.indent(i))}if(e.taskGroupLimit!==void 0){let i=t(e.taskGroupLimit)+` per group (if any "group by" options are supplied).
`;n.push(this.indent(i))}return n.join(`
1 week ago
`)}explainDebugSettings(){let e="",{debugSettings:t}=Q();return t.ignoreSortInstructions&&(e+=this.indent(`NOTE: All sort instructions, including default sort order, are disabled, due to 'ignoreSortInstructions' setting.
6 months ago
`)),e}indent(e){return this.indentation+e}};var Se=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 Se("None of",e,"NOT")}static booleanXor(e){return new Se("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 i=0;i<this.children.length;i++)t+=`
1 week ago
${this.children[i].asString(n)}`;return t}static combineOrCreateExplanation(e,t,n){if(t.length===2){let i=t[0],s=t[1];if(i.symbol===n&&s.symbol==="")return i.children.push(s),i}return new Se(e,t,n)}};var Ws=class{matchesAnyOf(e){return e.some(t=>this.matches(t))}};var qs=class extends Ws{constructor(t){super();this.stringToFind=t}matches(t){return qs.stringIncludesCaseInsensitive(t,this.stringToFind)}static stringIncludesCaseInsensitive(t,n){return t.toLocaleLowerCase().includes(n.toLocaleLowerCase())}explanation(t){return new Se(t)}};var ni=class extends Ws{constructor(t){super();this.regex=t}static validateAndConstruct(t){let n=/^\/(.+)\/([^/]*)$/,i=t.match(n);if(i!==null){let s=new RegExp(i[1],i[2]);return new ni(s)}else return null}matches(t){return t.match(this.regex)!==null}static helpMessage(){return String.raw`See https://publish.obsidian.md/tasks/Queries/Regular+Expressions
1 year ago
Regular expressions must look like this:
/pattern/
or this:
/pattern/flags
Where:
- pattern: The 'regular expression' pattern to search for.
- flags: Optional characters that modify the search.
i => make the search case-insensitive
u => add Unicode support
Examples: /^Log/
/^Log/i
/File Name\.md/
/waiting|waits|waited/i
/\d\d:\d\d/
The following characters have special meaning in the pattern:
to find them literally, you must add a \ before them:
[\^$.|?*+()
CAUTION! Regular expression (or 'regex') searching is a powerful
but advanced feature that requires thorough knowledge in order to
use successfully, and not miss intended search results.
1 week ago
`}explanation(t){let i=TF(t,"using regex: ",this.regexAsString());return new Se(i)}regexAsString(){let t=`'${this.regex.source}' with `;switch(this.regex.flags.length){case 0:t+="no flags";break;case 1:t+=`flag '${this.regex.flags}'`;break;default:t+=`flags '${this.regex.flags}'`;break}return t}};function TF(r,e,t){var o;let n=r.match(/\//);if(!n)return"Error explaining instruction. Could not find a slash character";let i=2,s=((o=n.index)!=null?o:i)-i;return`${e.padEnd(s)}${t}`}var Wr=class{constructor(e,t,n,i){this.instruction=e,this.property=t,this.comparator=Wr.maybeReverse(i,n)}static maybeReverse(e,t){return e?Wr.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n,i)=>e(t,n,i)*-1}};var ii=class{constructor(e,t,n,i){this.instruction=e,this.property=t,this.grouper=n,this.reverse=i}};var Ee=class{canCreateFilterForLine(e){return Ee.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 Zn(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=Ee.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)?`,"i")}sorterInstruction(e){let t=`sort by ${this.fieldNameSingular()}`;return e&&(t+=" reverse"),t}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new Wr(this.sorterInstruction(e),this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}createGrouperFromLine(e){if(!this.supportsGrouping())return null;let t=Ee.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createGrouper(n)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)?$`,"i")}grouperInstruction(e){let t=`group by ${this.fieldNameSingular()}`;return e&&(t+=" reverse"),t}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(e){return new ii(this.grouperInstruction(e),this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};var Ln=class{constructor(e,t){this._rawInstruction=e,this._anyContinuationLinesRemoved=t.trim(),this._anyPlaceholdersExpanded=this._anyContinuationLinesRemoved}recordExpandedPlaceholders(e){this._anyPlaceholdersExpanded=e}get rawInstruction(){return this._rawInstruction}get anyContinuationLinesRemoved(){return this._anyContinuationLinesRemoved}get anyPlaceholdersExpanded(){return this._anyPlaceholdersExpanded}explainStatement(e){function t(a,o){o!==a&&(s+=` =>
8 months ago
${e}${o}`)}let n=this._rawInstruction.trim(),i=n.split(`
`).join(`
`+e),s=`${e}${i}`;return this._rawInstruction.includes(`
`)&&(s+=`
1 week ago
`+e),t(n,this._anyContinuationLinesRemoved),t(this._anyContinuationLinesRemoved,this._anyPlaceholdersExpanded),s}allLinesIdentical(){return this._rawInstruction===this._anyContinuationLinesRemoved&&this._rawInstruction===this._anyPlaceholdersExpanded}};var vt=class{constructor(e,t,n){this._statement=new Ln(e,e),this.explanation=n,this.filterFunction=t}get statement(){return this._statement}setStatement(e){this._statement=e}get instruction(){return this._statement.anyPlaceholdersExpanded}explainFilterIndented(e){let t=this._statement.explainStatement(e);return this.onlyNeedsOneLineExplanation()?`${t}
7 months ago
`:`${t} =>
${this.explanation.asString(e+" ")}
1 week ago
`}simulateExplainFilter(){return this.onlyNeedsOneLineExplanation()?this.explanation:new Se(this.instruction+" =>",[this.explanation])}onlyNeedsOneLineExplanation(){return this.explanation.asString("")===this.instruction}};var an=class{constructor(e){this.instruction=e}get queryComponent(){return this._queryComponent}set queryComponent(e){this._queryComponent=e}get error(){return this._error}set error(e){this._error=e}isValid(){return this._queryComponent!==void 0}static fromObject(e,t){let n=new an(e);return n._queryComponent=t,n}static fromError(e,t){let n=new an(e);return n._error=t,n}};var se=class{constructor(e){this.object=e}get instruction(){return this.object.instruction}get filter(){return this.object.queryComponent}isValid(){return this.object.isValid()}get error(){return this.object.error}get filterFunction(){if(this.filter)return this.filter.filterFunction}static fromFilter(e){return new se(an.fromObject(e.instruction,e))}static fromError(e,t){return new se(an.fromError(e,t))}};var Ie=class extends Ee{createFilterOrErrorMessage(e){let t=Ee.getMatch(this.filterRegExp(),e);if(t===null)return se.fromError(e,`do not understand query filter (${this.fieldName()})`);let n=t[1].toLowerCase(),i=t[2],s=null;if(n.includes("include"))s=new qs(i);else if(n.includes("regex")){try{s=ni.validateAndConstruct(i)}catch(u){let l=ji("Parsing regular expression",u)+`
1 year ago
1 week ago
${ni.helpMessage()}`;return se.fromError(e,l)}if(s===null)return se.fromError(e,`Invalid instruction: '${e}'
9 months ago
1 week ago
${ni.helpMessage()}`)}if(s===null)return se.fromError(e,`do not understand query filter (${this.fieldName()})`);let a=n.match(/not/)!==null,o=new vt(e,this.getFilter(s,a),s.explanation(e));return se.fromFilter(o)}fieldPattern(){return this.fieldNameSingularEscaped()}filterOperatorPattern(){return"includes|does not include|regex matches|regex does not match"}filterRegExp(){return new RegExp(`^(?:${this.fieldPattern()}) (${this.filterOperatorPattern()}) (.*)`,"i")}getFilter(e,t){return n=>{let i=e.matches(this.value(n));return t?!i:i}}comparator(){return(e,t)=>this.value(e).localeCompare(this.value(t),void 0,{numeric:!0})}grouper(){return e=>[this.value(e)]}static escapeMarkdownCharacters(e){return e.replace(/\\/g,"\\\\").replace(/_/g,"\\_")}};var Gi=class extends Ie{fieldName(){return"description"}value(e){return ve.getInstance().removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Gi.cleanDescription(e.description),i=Gi.cleanDescription(t.description);return n.localeCompare(i,void 0,{numeric:!0})}}static cleanDescription(e){e=ve.getInstance().removeAsSubstringFrom(e);let t=/^\[\[?([^\]]*)]]?/,n=e.match(t);if(n!==null){let i=n[1];e=i.substring(i.indexOf("|")+1)+e.replace(t,"")}return e=this.replaceFormatting(e,/^\*\*([^*]+)\*\*/),e=this.replaceFormatting(e,/^\*([^*]+)\*/),e=this.replaceFormatting(e,/^==([^=]+)==/),e=this.replaceFormatting(e,/^__([^_]+)__/),e=this.replaceFormatting(e,/^_([^_]+)_/),e}static replaceFormatting(e,t){let n=e.match(t);return n!==null&&(e=n[1]+e.replace(t,"")),e}};var Dl=class{findUnexpandedDateText(e){let t=["<%","YYYY-MM-DD"];for(let n of t)if(e.includes(n))return this.unexpandedDateTextMessage(n);return null}unexpandedDateTextMessage(e){return`Instruction contains unexpanded template text: "${e}" - and cannot be interpreted.
9 months ago
Possible causes:
- The query is an a template file, and is not intended to be searched.
- A command such as "Replace templates in the active file" needs to be run.
- The core "Daily notes" plugin is in use, and the template contained
date calculations that it does not support.
- Some sample template text was accidentally pasted in to a tasks query,
instead of in to a template file.
1 year ago
9 months ago
See: https://publish.obsidian.md/tasks/Advanced/Instruction+contains+unexpanded+template+text
1 week ago
`}};var xl=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e.toLocaleLowerCase()===this._instruction.toLocaleLowerCase()}createFilterOrErrorMessage(e){return this.canCreateFilterForLine(e)?se.fromFilter(new vt(e,this._filter,new Se(e))):se.fromError(e,`do not understand filter: ${e}`)}};var jt=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new xl(e,t))}canCreateFilterForLine(e){return this._filters.some(t=>t.canCreateFilterForLine(e))}createFilterOrErrorMessage(e){for(let t of this._filters){let n=t.createFilterOrErrorMessage(e);if(n.isValid())return n}return se.fromError(e,`do not understand filter: ${e}`)}};var at=class extends Ee{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new jt,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 i=this.date(n);return i!==null&&!i.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){var f;let n=this.checkForUnexpandedTemplateText(t);if(n)return se.fromError(t,n);let i=this.filterInstructions.createFilterOrErrorMessage(t);if(i.isValid())return i;let s=Ee.getMatch(this.filterRegExp(),t);if(s===null)return se.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let a=s[1],o=(f=s[2])==null?void 0:f.toLowerCase(),u=s[3],l=Vt.parseDateRange(u);if(!l.isValid()){let m=Vt.parseDate(a);m.isValid()&&(l=new Dt(m,m))}if(!l.isValid())return se.fromError(t,"do not understand "+this.fieldName()+" date");let c=this.buildFilterFunction(o,l),d=at.buildExplanation(this.fieldNameForExplanation(),o,this.filterResultIfFieldMissing(),l);return se.fromFilter(new vt(t,c,d))}buildFilterFunction(t,n){let i;switch(t){case"before":i=s=>s?s.isBefore(n.start):this.filterResultIfFieldMissing();break;case"after":i=s=>s?s.isAfter(n.end):this.filterResultIfFieldMissing();break;case"on or before":case"in or before":i=s=>s?s.isSameOrBefore(n.end):this.filterResultIfFieldMissing();break;case"on or after":case"in or after":i=s=>s?s.isSameOrAfter(n.start):this.filterResultIfFieldMissing();break;default:i=s=>s?s.isSameOrAfter(n.start)&&s.isSameOrBefore(n.end):this.filterResultIfFieldMissing()}return this.getFilter(i)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} (((?:on|in) or before|before|(?:on|in) or after|after|on|in)? ?(.*))`,"i")}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,i,s){let a=n,o="YYYY-MM-DD (dddd Do MMMM YYYY)",u;switch(n){case"before":case"on or after":u=s.start.format(o);break;case"after":case"on or before":u=s.end.format(o);break;case"in or before":a="on or before",u=s.end.format(o);break;case"in or after":a="on or after",u=s.start.format(o);break;default:if(!s.start.isSame(s.end)){let c=`${t} date is between:`,d=[new Se(`${s.start.format(o)} and`),new Se(`${s.end.format(o)} inclusive`)];return i&&d.push(new Se(`OR no ${t} date`)),new Se(c,d)}a="on",u=s.start.format(o);break}let l=`${t} date is ${a} ${u}`;return i&&(l+=` OR no ${t} date`),new Se(l)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>dr(this.date(t),this.date(n))}supportsGrouping(){return!0}grouper(){return t=>{let n=this.date(t);return n===null?["No "+this.fieldName()+" date"]:n.isValid()?[n.format("YYYY-MM-DD dddd")]:["%%0%% Invalid "+this.fieldName()+" date"]}}checkForUnexpandedTemplateText(t){return new Dl().findUnexpandedDateText(t)}};var Rl=class extends at{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var Ml=class extends at{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var $s=class extends at{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){
7 months ago
The instruction was converted to the following simplified line:
${i.simplifiedLine}
Where the sub-expressions in the simplified line are:
${a}
For help, see:
https://publish.obsidian.md/tasks/Queries/Combining+Filters
2 months ago
`;return se.fromError(t,u)}stringifySubExpressionsForErrorMessage(t){return Object.entries(t).map(([n,i])=>` '${n}': '${i}'
7 months ago
=> ${this.stringifySubExpressionStatus(i)}`).join(`
1 week ago
`)}stringifySubExpressionStatus(t){let n=Yo(t);return n?n.error?`ERROR:
7 months ago
${n.error.split(`
`).map(s=>s.trim()).join(`
`)}`:"OK":`ERROR:
do not understand query`}helpMessageFromSimpleError(t,n){return`Could not interpret the following instruction as a Boolean combination:
${t}
The error message is:
1 week ago
${n}`}};var Bl=class extends Ie{fieldName(){return"filename"}value(e){let t=e.filename;return t===null?"":t+".md"}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;return t===null?["Unknown Location"]:["[["+t+"]]"]}}};var Qs=class extends Ee{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return se.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}supportsGrouping(){return!0}grouper(){return e=>[`${e.urgency.toFixed(2)}`]}createGrouper(e){return super.createGrouper(!e)}grouperInstruction(e){return super.grouperInstruction(!e)}};var Hl=class extends Ie{constructor(){super()}fieldName(){return"status.name"}value(e){return e.status.name}supportsSorting(){return!0}supportsGrouping(){return!0}};var cn=class extends Ee{canCreateFilterForLine(e){let t=new RegExp(`^(?:${this.fieldNameSingularEscaped()})`,"i");return Ee.lineMatchesFilter(t,e)}createFilterOrErrorMessage(e){let t=Ee.getMatch(this.filterRegExp(),e);if(t===null)return this.helpMessage(e);let n=t[1].toLowerCase(),i=t[2],s=xt[i.toUpperCase()];if(!s)return this.helpMessage(e);let a;switch(n){case"is":a=o=>o.status.type===s;break;case"is not":a=o=>o.status.type!==s;break;default:return this.helpMessage(e)}return se.fromFilter(new vt(e,a,new Se(e)))}filterRegExp(){return new RegExp(`^(?:${this.fieldNameSingularEscaped()}) (is|is not) ([^ ]+)$`,"i")}helpMessage(e){let t=Object.values(xt).filter(i=>i!=="EMPTY").join(" "),n=`Invalid ${this.fieldNameSingular()} instruction: '${e}'.
9 months ago
Allowed options: 'is' and 'is not' (without quotes).
Allowed values: ${t}
Note: values are case-insensitive,
so 'in_progress' works too, for example.
1 week ago
Example: ${this.fieldNameSingular()} is not NON_TASK`;return se.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=cn.groupName(e),i=cn.groupName(t);return n.localeCompare(i,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[cn.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var Vl=class extends Ie{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 zl=class extends Ie{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Ie.escapeMarkdownCharacters(this.value(e))]}};var Kl=class extends Ie{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Ie.escapeMarkdownCharacters(this.value(e))]}};var Ql=class extends Ie{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return se.fromError(e,"backlink field does not support filtering")}canCreateFilterForLine(e){return!1}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;if(t===null)return["Unknown Location"];let n=e.precedingHeader;return n===null?["[["+t+"]]"]:[`[[${t}#${n}|${t} > ${n}]]`]}}};var Xl=class extends at{fieldName(){return"cancelled"}date(e){return e.cancelledDate}filterResultIfFieldMissing(){return!1}};var Zl=class extends vr{constructor(){super(),this._filters.add("is blocking",(e,t)=>e.isBlocking(t.allTasks)),this._filters.add("is not blocking",(e,t)=>!e.isBlocking(t.allTasks)),this._filters.add("is blocked",(e,t)=>e.isBlocked(t.allTasks)),this._filters.add("is not blocked",(e,t)=>!e.isBlocked(t.allTasks))}fieldName(){return"blocking"}};var Jl=class extends Ie{constructor(){super();this.filterInstructions=new jt;this.filterInstructions.add("has id",t=>t.id.length>0),this.filterInstructions.add("no id",t=>t.id.length===0)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.isValid()?n:super.createFilterOrErrorMessage(t)}fieldName(){return"id"}value(t){return t.id}supportsSorting(){return!0}supportsGrouping(){return!0}};var ec=class extends Ee{constructor(){super();this.filterInstructions=new jt;this.filterInstructions.add("has depends on",t=>t.dependsOn.length>0),this.filterInstructions.add("no depends on",t=>t.dependsOn.length===0)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.isValid()?n:se.fromError(t,"Unknown instruction")}fieldName(){return"blocked by"}filterRegExp(){return null}};var tc=class extends vr{fieldName(){return"random"}supportsSorting(){return!0}comparator(){return(e,t)=>this.sortKey(e)-this.sortKey(t)}sortKey(e){let t=i=>{let s=0,a=9;for(;s<i.length;)a=Math.imul(a^i.charCodeAt(s++),387420489);return a^a>>>9},n=window.moment().format("Y-MM-DD");return t(n+" "+e.description)}};var Wh=[()=>new Hl,()=>new cn,()=>new si,()=>new Ul,()=>new Yi,()=>new Ll,()=>new Xl,()=>new Rl,()=>new Fl,()=>new Il,()=>new $s,()=>new Ml,()=>new js,()=>new zl,()=>new Kl,()=>new Ql,()=>new Gi,()=>new Bi,()=>new Nl,()=>new Cl,()=>new Bl,()=>new Qs,()=>new Vl,()=>new Pl,()=>new Jl,()=>new ec,()=>new Zl,()=>new tc,()=>new Yl];function Yo(r){for(let e of Wh){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function mk(r){let e=/^sort by /i;if(r.match(e)===null)return null;for(let t of Wh){let i=t().createSorterFromLine(r);if(i)return i}return null}function hk(r){let e=/^group by /i;if(r.match(e)===null)return null;for(let t of Wh){let i=t().createGrouperFromLine(r);if(i)return i}return null}var rc=class{constructor(e,t
2 years ago
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
1 year ago
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName}
1 week ago
`;return e+=this.tasksAsStringOfLines(),e}};var Xs=class{constructor(e,t,n){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let s=new ac(e,t,n).generateTaskTreeStorage();this.addTaskGroups(s),this.sortTaskGroups(),this.setGroupsHeadings(s)}get groupers(){return this._groupers}get groups(){return this._groups}totalTasksCount(){return this._totalTaskCount}toString(){let e="";e+=`Groupers (if any):
8 months ago
`;for(let n of this._groupers){let i=n.reverse?" reverse":"";e+=`- ${n.property}${i}
1 year ago
`}for(let n of this.groups)e+=n.toString(),e+=`
2 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
1 week ago
`,e}addTaskGroups(e){for(let[t,n]of e){let i=new oc(t,n);this.addTaskGroup(i)}}addTaskGroup(e){this._groups.push(e)}sortTaskGroups(){let e=(t,n)=>{let i=t.groups,s=n.groups;for(let a=0;a<i.length;a++){let o=this._groupers[a],u=i[a].localeCompare(s[a],void 0,{numeric:!0});if(u!==0)return o.reverse?-u:u}return 0};this._groups.sort(e)}setGroupsHeadings(e){let t=new nc(e,this._groupers);for(let n of this._groups)n.setGroupHeadings(t.getHeadingsForTaskGroup(n.groups))}applyTaskLimit(e){this._groupers.length!==0&&(this._groups.forEach(t=>{t.applyTaskLimit(e)}),this.recalculateTotalTaskCount())}recalculateTotalTaskCount(){let e=[];this._groups.forEach(n=>{e=[...e,...n.tasks]});let t=[...new Set(e)];this._totalTaskCount=t.length}};var ui=class{constructor(e,t){this.tasksFile=e,this.allTasks=[...t]}static fromAllTasks(e){return new ui(void 0,e)}get queryPath(){var e,t;return(t=(e=this.tasksFile)==null?void 0:e.path)!=null?t:void 0}queryContext(){return this.tasksFile?kh(this.tasksFile,this.allTasks):void 0}};function gk(r){return`task${r!==1?"s":""}`}var zi=class{constructor(e,t){this.totalTasksCountBeforeLimit=0;this._searchErrorMessage=void 0;this.taskGroups=e,this.totalTasksCountBeforeLimit=t}get searchErrorMessage(){return this._searchErrorMessage}set searchErrorMessage(e){this._searchErrorMessage=e}get totalTasksCount(){return this.taskGroups.totalTasksCount()}totalTasksCountDisplayText(){let e=this.totalTasksCount,t=this.totalTasksCountBeforeLimit;return e===t?`${e} ${gk(e)}`:`${e} of ${t} ${gk(t)}`}get groups(){return this.taskGroups.groups}static fromError(e){let t=new zi(new Xs([],[],ui.fromAllTasks([])),0);return t._searchErrorMessage=e,t}};function yk(r){return r.endsWith("\\")}function Tk(r){return r.endsWith("\\\\")}function QF(r){return r.replace(/^[ \t]*/,"")}function XF(r){return r.replace(/[ \t]*\\$/,"")}function ZF(r,e){let t=r;return e&&(t=QF(r)),Tk(t)?t=t.slice(0,-1):yk(r)&&(t=XF(t)),t}function bk(r){let e=[],t=!1,n="",i="",s=r+`
`;for(let a of s.split(`
`)){let o=ZF(a,t);t?(n+=`
`+a,i+=" "+o):(n=a,i=o),Tk(a)?t=!1:t=yk(a),t||(i.trim()!==""&&e.push(new Ln(n,i)),n="",i="")}return e}var Zs=class{static by(e,t,n){let i=this.defaultSorters().map(a=>a.comparator),s=[];for(let a of e)s.push(a.comparator);return t.sort(Zs.makeCompositeComparator([...s,...i],n))}static defaultSorters(){return[new cn().createNormalSorter(),new Qs().createNormalSorter(),new $s().createNormalSorter(),new Yi().createNormalSorter(),new js().createNormalSorter()]}static makeCompositeComparator(e,t){return(n,i)=>{for(let s of e){let a=s(n,i,t);if(a!==0)return a}return 0}}};var $r=class{constructor(e,t=void 0){this._limit=void 0;this._taskGroupLimit=void 0;this._taskLayoutOptions=new en;this._queryLayoutOptions=new ri;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this._ignoreGlobalQuery=!1;this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|cancelled date|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|postpone button|urgency|tags|depends on|id|on completion|tree)/i;this.shortModeRegexp=/^short/i;this.fullModeRegexp=/^full/i;this.explainQueryRegexp=/^explain/i;this.ignoreGlobalQueryRegexp=/^ignore global query/i;this.logger=Rt.getLogger("tasks.Query");this._queryId="";this.limitRegexp=/^limit (groups )?(to )?(\d+)( tasks?)?/i;this.commentRegexp=/^#.*/;this._queryId=this.generateQueryId(10),this.source=e,this.tasksFile=t,this.debug(`Creating query: ${this.formatQueryForLogging()}`),bk(e).forEach(n=>{let i=this.expandPlaceholders(n,t);if(this.error===void 0)try{this.parseLine(i,n)}catch(s){let a;s instanceof Error?a=s.message:a="Unknown error",this.setError(a,n);return}})}get filePath(){var e,t;return(t=(e=this.tasksFile)==null?void 0:e.path)!=null?t:void 0}get queryId(){return this._queryId}parseLine(e,t){switch(!0){case this.shortModeRegexp.test(e):this._queryLayoutOptions.shortMode=!0;break;case this.fullModeRegexp.test(e):this._queryLayoutOptions.shortMode=!1;break;case this.explainQueryRegexp.test(e):this._queryLayoutOptions.explainQuery=!0;break;case this.ignoreGlobalQueryRegexp.test(e):this._ignoreGlobalQuery=!0;break;case this.limitRegexp.test(e):this.parseLimit(e);break;case this.parseSortBy(e):break;case this.parseGroupBy(e):break;case this.hideOptionsRegexp.test(e):this.parseHideOptions(e);break;case this.commentRegexp.test(e):break;case this.parseFilter(e,t):break;default:this.setError("do not understand query",t)}}formatQueryForLogging(){return`[${this.source.split(`
3 months ago
`).join(" ; ")}]`}expandPlaceholders(e,t){let n=e.anyContinuationLinesRemoved;if(n.includes("{{")&&n.includes("}}")&&this.tasksFile===void 0)return this._error=`The query looks like it contains a placeholder, with "{{" and "}}"
1 year ago
but no file path has been supplied, so cannot expand placeholder values.
The query is:
1 week ago
${n}`,n;let i=n;if(t){let s=Zw(t);try{i=Xw(n,s)}catch(a){return a instanceof Error?this._error=a.message:this._error="Internal error. expandPlaceholders() threw something other than Error.",n}}return e.recordExpandedPlaceholders(i),i}append(e){return this.source===""?e:e.source===""?this:new $r(`${this.source}
${e.source}`,this.tasksFile)}explainQuery(){return new Us().explainQuery(this)}get limit(){return this._limit}get taskGroupLimit(){return this._taskGroupLimit}get taskLayoutOptions(){return this._taskLayoutOptions}get queryLayoutOptions(){return this._queryLayoutOptions}get filters(){return this._filters}addFilter(e){this._filters.push(e)}get sorting(){return this._sorting}get grouping(){return this._grouping}get error(){return this._error}setError(e,t){this._error=$r.generateErrorMessage(t,e)}static generateErrorMessage(e,t){return e.allLinesIdentical()?`${t}
2 months ago
Problem line: "${e.rawInstruction}"`:`${t}
7 months ago
Problem statement:
2 months ago
${e.explainStatement(" ")}
1 week ago
`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){this.debug(`Executing query: ${this.formatQueryForLogging()}`);let t=new ui(this.tasksFile,e),n;try{this.filters.forEach(u=>{n=u.statement,e=e.filter(l=>u.filterFunction(l,t))}),n=void 0;let{debugSettings:i}=Q(),s=i.ignoreSortInstructions?e:Zs.by(this.sorting,e,t),a=s.slice(0,this.limit),o=new Xs(this.grouping,a,t);return this._taskGroupLimit!==void 0&&o.applyTaskLimit(this._taskGroupLimit),new zi(o,s.length)}catch(i){let a=ji("Search failed",i);return n&&(a=$r.generateErrorMessage(n,a)),zi.fromError(a)}}parseHideOptions(e){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1].toLowerCase()==="hide";switch(t[2].toLowerCase()){case"tree":this._queryLayoutOptions.hideTree=n;break;case"task count":this._queryLayoutOptions.hideTaskCount=n;break;case"backlink":this._queryLayoutOptions.hideBacklinks=n;break;case"postpone button":this._queryLayoutOptions.hidePostponeButton=n;break;case"priority":this._taskLayoutOptions.setVisibility("priority",!n);break;case"cancelled date":this._taskLayoutOptions.setVisibility("cancelledDate",!n);break;case"created date":this._taskLayoutOptions.setVisibility("createdDate",!n);break;case"start date":this._taskLayoutOptions.setVisibility("startDate",!n);break;case"scheduled date":this._taskLayoutOptions.setVisibility("scheduledDate",!n);break;case"due date":this._taskLayoutOptions.setVisibility("dueDate",!n);break;case"done date":this._taskLayoutOptions.setVisibility("doneDate",!n);break;case"recurrence rule":this._taskLayoutOptions.setVisibility("recurrenceRule",!n);break;case"edit button":this._queryLayoutOptions.hideEditButton=n;break;case"urgency":this._queryLayoutOptions.hideUrgency=n;break;case"tags":this._taskLayoutOptions.setTagsVisibility(!n);break;case"id":this._taskLayoutOptions.setVisibility("id",!n);break;case"depends on":this._taskLayoutOptions.setVisibility("dependsOn",!n);break;case"on completion":this._taskLayoutOptions.setVisibility("onCompletion",!n);break;default:this.setError("do not understand hide/show option",new Ln(e,e))}}}parseFilter(e,t){var i;let n=Yo(e);return n!=null?(n.filter?(n.filter.setStatement(t),this._filters.push(n.filter)):this.setError((i=n.error)!=null?i:"Unknown error",t),!0):!1}parseLimit(e){let t=e.match(this.limitRegexp);if(t===null){this.setError("do not understand query limit",new Ln(e,e));return}let n=Number.parseInt(t[3],10);t[1]!==void 0?this._taskGroupLimit=n:this._limit=n}parseSortBy(e){let t=mk(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=hk(e);return t?(this._grouping.push(t),!0):!1}generateQueryId(e){let t="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";return Array.from({length:e},()=>t[Math.floor(Math.random()*t.length)]).join("")}debug(e,t){this.logger.debugWithId(this._queryId,`"${this.filePath}": ${e}`,t)}};var li=class{constructor(e=li.empty){this._source=e}static getInstance(){return li.instance||(li.instance=new li),li.instance}set(e){this._source=e}query(e=void 0){return new $r(this._source,e)}hasInstructions(){return this._source.trim()!==li.empty}},tr=li;tr.empty="";var uc=class{constructor({obsidianEvents:e}){this.logger=Rt.getLogger("tasks.Events");this.obsidianEvents=e}onCacheUpdate(e){return this.logger.debug("TasksEvents.onCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.logger.debug("TasksEvents.triggerCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.logger.debug("TasksEvents.onRequestCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.logger.debug("TasksEvents.triggerRequestCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.logger.debug("TasksEvents.off()"),this.obsidianEvents.offref(e)}};var Fk=require("obsidian");var Ik=require("obsidian");var qh=class{constructor(e){this.newStatus=e}apply(e){return this.isCheckedForTask(e)?[e]:e.handleNewStatusWithRecurre
`);if(m===void 0)return!1;let y=null;for(let k=0;k<m.length;k=k+1)if(m[k]!==""){y=m[k];break}return y===null?!1:ve.getInstance().includedIn(y)});if(i.length===0)return;let s=t.sourcePath,a=t.getSectionInfo(e);if(a===null)return;let o=a.text.split(`
`),u=0,l=[];for(let f=a.lineStart;f<=a.lineEnd;f++){let m=o[f];if(m===void 0)continue;let y=null,b=ee.fromLine({line:m,taskLocation:new ht(new ut(s),f,a.lineStart,u,y),fallbackDate:null});b!==null&&(l.push(b),u++)}let c=new qn({obsidianComponent:n,parentUlElement:e,taskLayoutOptions:new en,queryLayoutOptions:new ri});for(let f=0;f<i.length;f++){let m=l[f],y=i[f];if(m===void 0||y===void 0)continue;let b=(d=y.getAttr("data-line"))!=null?d:"0",k=Number.parseInt(b,10),_=yield c.renderTaskLine(m,k),R=y.childNodes;for(let q=0;q<R.length;q=q+1){let ne=R[q],G=ne.nodeName.toLowerCase();G==="div"?_.prepend(ne):(G==="ul"||G==="ol")&&_.append(ne)}let S=y.querySelectorAll("[data-footnote-id]"),F=_.querySelectorAll("[data-footnote-id]");if(S.length===F.length)for(let q=0;q<S.length;q++)F[q].replaceWith(S[q]);y.replaceWith(_)}})}};var Lk=require("@codemirror/view"),Uk=require("obsidian");var Wk=()=>Lk.ViewPlugin.fromClass(Vh),Vh=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 f=`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(f),new Uk.Notice(f,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=ee.fromLine({line:a.text,taskLocation:ht.fromUnknownPosition(new ut("")),fallbackDate:null});if(o===null)return!1;e.preventDefault();let u=o.toggleWithRecurrenceInUsersOrder(),l=u.map(f=>f.toFileLineString()).join(i.lineBreak),c=i.update({changes:{from:a.from,to:a.to,insert:l}});if(this.view.dispatch(c),u.length===1){let f=u[0].status.symbol!==" ";setTimeout(()=>{t.checked=f},1)}return!0}};var Tc=require("obsidian"),jk=require("obsidian");function qk(r,e,t,n=void 0){let i="";e.isEmpty()||(i+=`Only tasks containing the global filter '${e.get()}'.
7 months ago
1 week ago
`);let s=new Us(" "),a=new $r(r,n);if(!a.ignoreGlobalQuery&&t.hasInstructions()){let o=t.query(n);i+=`Explanation of the global query:
2 years ago
8 months ago
${s.explainQuery(o)}
`}return i+=`Explanation of this Tasks code block query:
2 years ago
1 week ago
${s.explainQuery(a)}`,i}function Ho(r,e,t){let n=new $r(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}function Vo(r,e,t){e&&r.push(tL(t))}function tL(r){return`tasks-layout-hide-${r}`}var mc=class{constructor(e){e?this.queryLayoutOptions=e:this.queryLayoutOptions=new ri}getHiddenClasses(){let e=[],t=[[this.queryLayoutOptions.hideUrgency,"urgency"],[this.queryLayoutOptions.hideBacklinks,"backlinks"],[this.queryLayoutOptions.hideEditButton,"edit-button"],[this.queryLayoutOptions.hidePostponeButton,"postpone-button"]];for(let[n,i]of t)Vo(e,n,i);return this.queryLayoutOptions.shortMode&&e.push("tasks-layout-short-mode"),e}};var hc=class{constructor(e){e?this.taskLayoutOptions=e:this.taskLayoutOptions=new en}generateHiddenClasses(){let e=[];return this.taskLayoutOptions.toggleableComponents.forEach(t=>{Vo(e,!this.taskLayoutOptions.isShown(t),t)}),Vo(e,!this.taskLayoutOptions.areTagsShown(),"tags"),e}};var zo=class{constructor(e){this.label=e,this.start()}start(){!this.recordTimings()||performance.mark(this.labelForStart())}finish(){!this.recordTimings()||(performance.mark(this.labelForEnd()),performance.measure(this.label,this.labelForStart(),this.labelForEnd()),this.printDuration())}printDuration(){let e=performance.getEntriesByName(this.label),t=e[e.length-1];t?console.log(this.label+":",t.duration.toFixed(2),"milliseconds"):console.log(`Measurement for ${this.label} not found`)}labelForStart(){return`${this.label} - start`}labelForEnd(){return`${this.label} - end`}recordTimings(){let{debugSettings:e}=Q();return e.recordTimings}};var zh=require("obsidian");var di=class extends ci{constructor(e,t,n=Wn){super(n);let i=(l,c,d,f,m,y)=>{var R;let b=!1,k=ea(t);if(k){let{postponedDate:S}=y(t,k,d,f);(R=t[k])!=null&&R.isSame(S,"day")&&(b=!0)}let _=m(t,f,d);c.setChecked(b).setTitle(_).onClick(()=>di.postponeOnClickCallback(l,t,f,d,y,n))},s=Rk,a=kk;this.addItem(l=>i(e,l,"days",0,s,a)),this.addItem(l=>i(e,l,"day",1,s,a)),this.addSeparator();let o=Gh,u=jh;this.addItem(l=>i(e,l,"days",2,o,u)),this.addItem(l=>i(e,l,"days",3,o,u)),this.addItem(l=>i(e,l,"days",4,o,u)),this.addItem(l=>i(e,l,"days",5,o,u)),this.addItem(l=>i(e,l,"days",6,o,u)),this.addSeparator(),this.addItem(l=>i(e,l,"week",1,o,u)),this.addItem(l=>i(e,l,"weeks",2,o,u)),this.addItem(l=>i(e,l,"weeks",3,o,u)),this.addItem(l=>i(e,l,"month",1,o,u)),this.addSeparator(),this.addItem(l=>i(e,l,"days",2,Mk,Ek))}static postponeOnClickCallback(o,u,l,c){return A(this,arguments,function*(e,t,n,i,s=jh,a=Wn){var y;let d=ea(t);if(d===null){let b="\u26A0\uFE0F Postponement requires a date: due, scheduled or start.";return new zh.Notice(b,1e4)}let{postponedDate:f,postponedTask:m}=s(t,d,i,n);(y=t[d])!=null&&y.isSame(f,"day")||(yield a(t,m),di.postponeSuccessCallback(e,d,f))})}static postponeSuccessCallback(e,t,n){e.style.pointerEvents="none";let i=Dk(n,t);new zh.Notice(i,2e3)}};function $k(r){let e=r.parent;for(;e!==null&&!(e instanceof ee);)e=e.parent;return e}var gc=class{constructor(e,t,n,i,s,a=qn.obsidianMarkdownRenderer){switch(this.source=t,this.tasksFile=n,this.renderMarkdown=i,this.obsidianComponent=s,this.textRenderer=a,e){case"block-language-tasks":this.query=Ho(this.source,tr.getInstance(),this.tasksFile),this.queryType="tasks";break;default:this.query=Ho(this.source,tr.getInstance(),this.tasksFile),this.queryType="tasks";break}}get filePath(){var e,t;return(t=(e=this.tasksFile)==null?void 0:e.path)!=null?t:void 0}render(e,t,n,i){return A(this,null,function*(){e==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,e,n,i):this.query.error!==void 0?this.renderErrorMessage(n,this.query.error):this.renderLoadingMessage(n)})}renderQuerySearchResults(e,t,n,i){return A(this,null,function*(){let s=this.explainAndPerformSearch(t,e,n);if(s.searchErrorMessage!==void 0){this.renderErrorMessage(n,s.searchErrorMessage);return}yield this.renderSearchResults(s,n,i)})}explainAndPerformSearch(e,t,n){let i=new zo(`Search: ${this.query.queryId} - ${this.filePath}`);i.start(),this.query.debug(`[render] Render called: plugin state: ${e}; searching ${t.length} tasks`),this.que
1 year ago
`,this._markdown+=`${t}
`}addRow(e){let t=this.makeRowText(e);this._markdown+=`${t}
`}addRowIfNew(e){let t=this.makeRowText(e);this._markdown.includes(t)||(this._markdown+=`${t}
1 week ago
`)}makeRowText(e){let t="|";return e.forEach(n=>{t+=` ${n} |`}),t}};function Gk(r,e){return r.findIndex(t=>t.symbol===e)}function $n(r){return r===""?r:"`"+(r!==" "?r:"space")+"`"}function sL(r,e){let t=re.getTypeForUnknownSymbol(r.symbol);r.type!==t&&(t==="TODO"&&r.symbol!==" "||e.push(`For information, the conventional type for status symbol ${$n(r.symbol)} is ${$n(t)}: you may wish to review this type.`))}function aL(r,e,t){let n=Gk(r,e.nextStatusSymbol);if(n===-1){t.push(`Next symbol ${$n(e.nextStatusSymbol)} is unknown: create a status with symbol ${$n(e.nextStatusSymbol)}.`);return}if(e.type!=="DONE")return;let i=r[n];if(i){if(i.type!=="TODO"&&i.type!=="IN_PROGRESS"){let s="https://publish.obsidian.md/tasks/Getting+Started/Statuses/Recurring+Tasks+and+Custom+Statuses",a=[`This \`DONE\` status is followed by ${$n(i.type)}, not \`TODO\` or \`IN_PROGRESS\`.`,"If used to complete a recurring task, it will instead be followed by `TODO` or `IN_PROGRESS`, to ensure the next task matches the `not done` filter.",`See [Recurring Tasks and Custom Statuses](${s}).`].join("<br>");t.push(a)}}else t.push("Unexpected failure to find the next status.")}function oL(r,e,t){let n=[];return e.symbol===re.EMPTY.symbol?(n.push("Empty symbol: this status will be ignored."),n):Gk(r,e.symbol)!=t?(n.push(`Duplicate symbol '${$n(e.symbol)}': this status will be ignored.`),n):(sL(e,n),aL(r,e,n),n)}function Yk(r){let e=new bc(["Status Symbol","Next Status Symbol","Status Name","Status Type","Problems (if any)"]),t=Le.allStatuses(r);return t.forEach((n,i)=>{e.addRow([$n(n.symbol),$n(n.nextStatusSymbol),n.name,$n(n.type),oL(t,n,i).join("<br>")])}),e.markdown}function Bk(r,e,t,n){let s=Yk(r),a=e.mermaidDiagram(!0);return`# ${t}
1 year ago
## About this file
This file was created by the Obsidian Tasks plugin (version ${n}) to help visualise the task statuses in this vault.
If you change the Tasks status settings, you can get an updated report by:
- Going to \`Settings\` -> \`Tasks\`.
- Clicking on \`Review and check your Statuses\`.
You can delete this file any time.
## Status Settings
<!--
Switch to Live Preview or Reading Mode to see the table.
If there are any Markdown formatting characters in status names, such as '*' or '_',
Obsidian may only render the table correctly in Reading Mode.
-->
These are the status values in the Core and Custom statuses sections.
8 months ago
${s}
1 year ago
## Loaded Settings
<!-- Switch to Live Preview or Reading Mode to see the diagram. -->
These are the settings actually used by Tasks.
1 week ago
${a}`}function Hk(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],["?","Question","x","TODO"],["*","Star","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["i","Information","x","TODO"],["I","Idea","x","TODO"],["S","Amount","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["b","Bookmark","x","TODO"],['"',"Quote","x","TODO"],["0","Speech bubble 0","0","NON_TASK"],["1","Speech bubble 1","1","NON_TASK"],["2","Speech bubble 2","2","NON_TASK"],["3","Speech bubble 3","3","NON_TASK"],["4","Speech bubble 4","4","NON_TASK"],["5","Speech bubble 5","5","NON_TASK"],["6","Speech bubble 6","6","NON_TASK"],["7","Speech bubble 7","7","NON_TASK"],["8","Speech bubble 8","8","NON_TASK"],["9","Speech bubble 9","9","NON_TASK"]]}function Vk(){return[[" ","incomplete","x","TODO"],["x","complete / done"," ","DONE"],["-","cancelled"," ","CANCELLED"],[">","deferred","x","TODO"],["/","in progress, or half-done","x","IN_PROGRESS"],["!","Important","x","TODO"],["?","question","x","TODO"],["R","review","x","TODO"],["+","Inbox / task that should be processed later","x","TODO"],["b","bookmark","x","TODO"],["B","brainstorm","x","TODO"],["D","deferred or scheduled","x","TODO"],["I","Info","x","TODO"],["i","idea","x","TODO"],["N","note","x","TODO"],["Q","quote","x","TODO"],["W","win / success / reward","x","TODO"],["P","pro","x","TODO"],["C","con","x","TODO"]]}function zk(){return[[" ","To Do","x","TODO"],["/","In Progress","x","IN_PROGRESS"],["x","Done"," ","DONE"],["-","Cancelled"," ","CANCELLED"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["?","Question","x","TODO"],["i","Infomation","x","TODO"],["S","Amount","x","TODO"],["*","Star","x","TODO"],["b","Bookmark","x","TODO"],["\u201C","Quote","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["I","Idea","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["u","Up","x","TODO"],["d","Down","x","TODO"]]}function Kk(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],[">","Deferred","x","TODO"],["!","Important","x","TODO"],["?","Question","x","TODO"],["r","Review","x","TODO"]]}function Qk(){return[[" ","Unchecked","x","TODO"],["x","Regular"," ","DONE"],["X","Checked"," ","DONE"],["-","Dropped"," ","CANCELLED"],[">","Forward","x","TODO"],["D","Date","x","TODO"],["?","Question","x","TODO"],["/","Half Done","x","IN_PROGRESS"],["+","Add","x","TODO"],["R","Research","x","TODO"],["!","Important","x","TODO"],["i","Idea","x","TODO"],["B","Brainstorm","x","TODO"],["P","Pro","x","TODO"],["C","Con","x","TODO"],["Q","Quote","x","TODO"],["N","Note","x","TODO"],["b","Bookmark","x","TODO"],["I","Information","x","TODO"],["p","Paraphrase","x","TODO"],["L","Location","x","TODO"],["E","Example","x","TODO"],["A","Answer","x","TODO"],["r","Reward","x","TODO"],["c","Choice","x","TODO"],["d","Doing","x","IN_PROGRESS"],["T","Time","x","TODO"],["@","Character / Person","x","TODO"],["t","Talk","x","TODO"],["O","Outline / Plot","x","TODO"],["~","Conflict","x","TODO"],["W","World","x","TODO"],["f","Clue / Find","x","TODO"],["F","Foreshadow","x","TODO"],["H","Favorite / Health","x","TODO"],["&","Symbolism","x","TODO"],["s","Secret","x","TODO"]]}function Xk(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],["?","Question","x","TODO"],["*","Star","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["i","Information","x","TODO"],["I","Idea","x","TODO"],["S","Amount","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["b","Bookmark","x","TODO"],["f","Fire","x","TODO"],["k","Key","x","TODO"],["w","Win","x","TODO"],["u","Up","x","TODO"],["d","Down","x","TODO"]]}function Zk(){return[[" ","to-do","x","TODO
`)+`
1 week ago
Fix errors before saving.`;new Yr.Notice(d);return}this.saved=!0,this.close()})),l)),u.addExtraButton(l=>(l.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),l))})}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?rr.removeValidationError(t):rr.setValidationError(t)}};var Pt=class extends le.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 A(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),new le.Setting(t).setName("Task Format").setDesc(Pt.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/Task+Formats/About+Task+Formats">documentation</a>.</p>')).addDropdown(l=>{for(let c of Object.keys(Nr))l.addOption(c,Nr[c].displayName);l.setValue(Q().taskFormat).onChange(c=>A(this,null,function*(){ze({taskFormat:c}),yield this.plugin.saveSettings()}))}),new le.Setting(t).setName("Global task filter").setHeading();let n=null;new le.Setting(t).setName("Global filter").setDesc(Pt.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(l=>{l.setPlaceholder("e.g. #task or TODO").setValue(ve.getInstance().get()).onChange(c=>A(this,null,function*(){ze({globalFilter:c}),ve.getInstance().set(c),yield this.plugin.saveSettings(),dn(n,c.length>0)}))}),n=new le.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(l=>{let c=Q();l.setValue(c.removeGlobalFilter).onChange(d=>A(this,null,function*(){ze({removeGlobalFilter:d}),ve.getInstance().setRemoveGlobalFilter(d),yield this.plugin.saveSettings()}))}),dn(n,Q().globalFilter.length>0),new le.Setting(t).setName("Global Query").setHeading(),dL(new le.Setting(t).setDesc(Pt.createFragmentWithHTML('<p>A query that is automatically included at the start of every Tasks block in the vault. Useful for adding default filters, or layout options.</p><p>See the <a href="https://publish.obsidian.md/tasks/Queries/Global+Query">documentation</a>.</p>')).addTextArea(l=>{let c=Q();l.inputEl.rows=4,l.setPlaceholder(`# For example...
2 years ago
path does not include _templates/
limit 300
1 week ago
show urgency`).setValue(c.globalQuery).onChange(d=>A(this,null,function*(){ze({globalQuery:d}),tr.getInstance().set(d),yield this.plugin.saveSettings()}))})),new le.Setting(t).setName("Task Statuses").setHeading();let{headingOpened:i}=Q();eE.forEach(l=>{var f;let c=(f=i[l.text])!=null?f:!0,d=this.addOneSettingsBlock(t,l,i);d.open=c}),new le.Setting(t).setName("Dates").setHeading(),new le.Setting(t).setName("Set created date on every added task").setDesc(Pt.createFragmentWithHTML(`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.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Created+date">documentation</a>.</p>`)).addToggle(l=>{let c=Q();l.setValue(c.setCreatedDate).onChange(d=>A(this,null,function*(){ze({setCreatedDate:d}),yield this.plugin.saveSettings()}))}),new le.Setting(t).setName("Set done date on every completed task").setDesc(Pt.createFragmentWithHTML('Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Done+date">documentation</a>.</p>')).addToggle(l=>{let c=Q();l.setValue(c.setDoneDate).onChange(d=>A(this,null,function*(){ze({setDoneDate:d}),yield this.plugin.saveSettings()}))}),new le.Setting(t).setName("Set cancelled date on every cancelled task").setDesc(Pt.createFragmentWithHTML('Enabling this will add a timestamp \u274C YYYY-MM-DD at the end when a task is toggled to cancelled.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Cancelled+date">documentation</a>.</p>')).addToggle(l=>{let c=Q();l.setValue(c.setCancelledDate).onChange(d=>A(this,null,function*(){ze({setCancelledDate:d}),yield this.plugin.saveSettings()}))}),new le.Setting(t).setName("Dates from file names").setHeading();let s=null,a=null;new le.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(Pt.createFragmentWithHTML('Save time entering Scheduled (\u23F3) dates.</br>If this option is enabled, any undated tasks will be given a default Scheduled date extracted from their file name.</br>By default, Tasks plugin will match both <code>YYYY-MM-DD</code> and <code>YYYYMMDD</code> date formats.</br>Undated tasks have none of Due (\u{1F4C5} ), Scheduled (\u23F3) and Start (\u{1F6EB}) dates.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Use+Filename+as+Default+Date">documentation</a>.</p>')).addToggle(l=>{let c=Q();l.setValue(c.useFilenameAsScheduledDate).onChange(d=>A(this,null,function*(){ze({useFilenameAsScheduledDate:d}),dn(s,d),dn(a,d),yield this.plugin.saveSettings()}))}),s=new le.Setting(t).setName("Additional filename date format as Scheduled date for undated tasks").setDesc(Pt.createFragmentWithHTML('An additional date format that Tasks plugin will recogize when using the file name as the Scheduled date for undated tasks.</br><p><a href="https://momentjs.com/docs/#/displaying/format/">Syntax Reference</a></p>')).addText(l=>{let c=Q();l.setPlaceholder("example: MMM DD YYYY").setValue(c.filenameAsScheduledDateFormat).onChange(d=>A(this,null,function*(){ze({filenameAsScheduledDateFormat:d}),yield this.plugin.saveSettings()}))}),a=new le.Setting(t).setName("Folders with default Scheduled dates").setDesc("Leave empty if you want to use default Scheduled dates everywhere, or enter a comma-separated list of folders.").addText(l=>A(this,null,function*(){let c=Q();yield this.plugin.saveSettings(),l.setValue(Pt.renderFolderArray(c.filenameAsDateFolders)).onChange(d=>A(this,null,function*(){let f=Pt.parseCommaSeparatedFolders(d);ze({filenameAsDateFolders:f}),yield this.plugin.saveSettings()}))})),dn(s,Q().useFilenameAsScheduledDate),dn(a,Q().useFilenameAsScheduledDate),new le.Setting(t).setName("Recurring tasks").setHeading(),new le.Setting(t).setName("Next recurrence appears on the line below").setDesc(Pt.createFragmentWithHTML('Enabling this will make the next recurrence of a task appear on the lin
5 months ago
This message has been written to the console.
1 week ago
`,1e4)}var _c=class extends fi.EditorSuggest{constructor(t,n,i){super(t);this.settings=n,this.plugin=i,t.scope.register([],"Tab",()=>{var a;let s=(a=this.context)==null?void 0:a.editor;return s?(s.exec("indentMore"),!1):!0})}onTrigger(t,n,i){if(!this.settings.autoSuggestInEditor)return null;let s=n.getLine(t.line);return Nv(s,t,n)?{start:{line:t.line,ch:0},end:{line:t.line,ch:s.length},query:s}:null}getSuggestions(t){var c,d,f;let n=t.query,i=t.editor.getCursor(),s=this.plugin.getTasks(),a=s.find(m=>m.taskLocation.path==t.file.path&&m.taskLocation.lineNumber==i.line),o=this.getMarkdownFileInfo(t),u=this.canSaveEdits(o);return((f=(d=(c=Do()).buildSuggestions)==null?void 0:d.call(c,n,i.ch,this.settings,s,u,a))!=null?f:[]).map(m=>de(K({},m),{context:t}))}getMarkdownFileInfo(t){return t.editor.cm.state.field(fi.editorInfoField)}canSaveEdits(t){return t instanceof fi.MarkdownView}renderSuggestion(t,n){n.setText(t.displayText)}selectSuggestion(t,n){return A(this,null,function*(){var l,c,d;let i=t.context.editor;if(t.suggestionType==="empty"){this.close();let f=new KeyboardEvent("keydown",{code:"Enter",key:"Enter"});(c=(l=i==null?void 0:i.cm)==null?void 0:l.contentDOM)==null||c.dispatchEvent(f);return}if(t.taskItDependsOn!=null){let f=il(t.taskItDependsOn,this.plugin.getTasks().map(m=>m.id));if(t.appendText+=` ${f.id}`,t.taskItDependsOn!==f)if(t.context.file.path==f.path){let m=t.taskItDependsOn.originalMarkdown,y={line:t.taskItDependsOn.lineNumber,ch:0},b={line:t.taskItDependsOn.lineNumber,ch:m.length},k=t.context.editor.getRange(y,b);if(k!==m){let _=`Error adding new ID, due to mismatched data in Tasks memory and the editor:
5 months ago
task line in memory: '${t.taskItDependsOn.originalMarkdown}'
2 months ago
task line in editor: '${k}'
5 months ago
1 week ago
file: '${f.path}'
`;fL(_);return}t.context.editor.replaceRange(f.toFileLineString(),y,b)}else br({originalTask:t.taskItDependsOn,newTasks:f})}let s=t.context.editor.getCursor(),a={line:s.line,ch:(d=t.insertAt)!=null?d:s.ch},o=t.insertSkip?{line:s.line,ch:a.ch+t.insertSkip}:void 0;t.context.editor.replaceRange(t.appendText,a,o),t.context.editor.setCursor({line:s.line,ch:a.ch+t.appendText.length});let u=this.getMarkdownFileInfo(t.context);this.canSaveEdits(u)&&(yield u.save())})}};var rE=(r,e)=>{let t,n=new Promise((a,o)=>{t=a});return e(r,a=>{let o=a.map(u=>u.toFileLineString()).join(`
`);t(o)}).open(),n};var nE=(r,e)=>{let t=Sl({line:"",path:""});return new ti({app:r,task:t,onSubmit:e,allTasks:[]})};var iE=r=>({createTaskLineModal:()=>rE(r,nE),executeToggleTaskDoneCommand:(e,t)=>Th(e,t).text});var vc=class extends sE.Plugin{get apiV1(){return iE(this.app)}onload(){return A(this,null,function*(){Rt.registerConsoleLogger(),Vm("info",`loading plugin "${this.manifest.name}" v${this.manifest.version}`),yield this.loadSettings();let{loggingOptions:t}=Q();Rt.configure(t),this.addSettingTab(new Ko({plugin:this})),xw({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let n=new uc({obsidianEvents:this.app.workspace});this.cache=new Es({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace,events:n}),this.inlineRenderer=new pc({plugin:this}),this.queryRenderer=new yc({plugin:this,events:n}),this.registerEditorExtension(Wk()),this.registerEditorSuggest(new _c(this.app,Q(),this)),new Ol({plugin:this})})}loadTaskStatuses(){return A(this,null,function*(){let{statusSettings:t}=Q();Le.applyToStatusRegistry(t,De.getInstance())})}onunload(){var t;Vm("info",`unloading plugin "${this.manifest.name}" v${this.manifest.version}`),(t=this.cache)==null||t.unload()}loadSettings(){return A(this,null,function*(){let t=yield this.loadData();ze(t),t=Q(),ve.getInstance().set(t.globalFilter),ve.getInstance().setRemoveGlobalFilter(t.removeGlobalFilter),tr.getInstance().set(t.globalQuery),yield this.loadTaskStatuses()})}saveSettings(){return A(this,null,function*(){yield this.saveData(Q())})}getTasks(){return this.cache===void 0?[]:this.cache.getTasks()}};
2 years ago
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
*
* Copyright (c) 2013 hij1nx
* Licensed under the MIT license.
*/
1 year ago
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
1 week ago
/* nosourcemap */