stem/.obsidian/plugins/obsidian-tasks-plugin/main.js

348 lines
410 KiB
JavaScript
Raw Normal View History

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
/*
License obsidian-tasks:
MIT License
Copyright (c) 2021 Martin Schenck and Clare Macrae
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
License rrule (included library):
rrule.js: Library for working with recurrence rules for calendar dates.
=======================================================================
Copyright 2010, Jakub Roztocil <jakub@roztocil.name> and Lars Schöning
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of The author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
./rrule.js and ./test/tests.js is based on python-dateutil. LICENCE:
python-dateutil - Extensions to the standard Python datetime module.
====================================================================
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
License chrono-node (included library):
The MIT License
Copyright (c) 2014, Wanasit Tanakitrungruang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
"use strict";var uv=Object.create;var os=Object.defineProperty,lv=Object.defineProperties,cv=Object.getOwnPropertyDescriptor,dv=Object.getOwnPropertyDescriptors,fv=Object.getOwnPropertyNames,rh=Object.getOwnPropertySymbols,pv=Object.getPrototypeOf,ih=Object.prototype.hasOwnProperty,hv=Object.prototype.propertyIsEnumerable;var nh=(r,e,t)=>e in r?os(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,we=(r,e)=>{for(var t in e||(e={}))ih.call(e,t)&&nh(r,t,e[t]);if(rh)for(var t of rh(e))hv.call(e,t)&&nh(r,t,e[t]);return r},it=(r,e)=>lv(r,dv(e));var _=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),mv=(r,e)=>{for(var t in e)os(r,t,{get:e[t],enumerable:!0})},sh=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fv(e))!ih.call(r,i)&&i!==t&&os(r,i,{get:()=>e[i],enumerable:!(n=cv(e,i))||n.enumerable});return r};var us=(r,e,t)=>(t=r!=null?uv(pv(r)):{},sh(e||!r||!r.__esModule?os(t,"default",{value:r,enumerable:!0}):t,r)),gv=r=>sh(os({},"__esModule",{value:!0}),r);var F=(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 Ee=_(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.matchAnyPattern=rn.extractTerms=rn.repeatedTimeunitPattern=void 0;function _v(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}rn.repeatedTimeunitPattern=_v;function ah(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}rn.extractTerms=ah;function vv(r){return`(?:${ah(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}rn.matchAnyPattern=vv});var ye=_((Qu,Xu)=>{(function(r,e){typeof Qu=="object"&&typeof Xu!="undefined"?Xu.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(Qu,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",f="year",h="date",T="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|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,D={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("_")},C=function(B,A,E){var H=String(B);return!H||H.length>=A?B:""+Array(A+1-H.length).join(E)+B},N={s:C,z:function(B){var A=-B.utcOffset(),E=Math.abs(A),H=Math.floor(E/60),P=E%60;return(A<=0?"+":"-")+C(H,2,"0")+":"+C(P,2,"0")},m:function B(A,E){if(A.date()<E.date())return-B(E,A);var H=12*(E.year()-A.year())+(E.month()-A.month()),P=A.clone().add(H,l),Z=E-P<0,d=A.clone().add(H+(Z?-1:1),l);return+(-(H+(E-P)/(Z?P-d:d-P))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:l,y:f,w:u,d:o,D:h,h:a,m:s,s:i,ms:n,Q:c}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},L="en",oe={};oe[L]=D;var z=function(B){return B instanceof Ne},ie=function(B,A,E){var H;if(!B)return L;if(typeof B=="string")oe[B]&&(H=B),A&&(oe[B]=A,H=B);else{var P=B.name;oe[P]=B,H=P}return!E&&H&&(L=H),H||!E&&L},G=function(B,A){if(z(B))return B.clone();var E=typeof A=="object"?A:{};return E.date=B,E.args=arguments,new Ne(E)},j=N;j.l=ie,j.i=z,j.w=function(B,A){return G(B,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var Ne=function(){function B(E){this.$L=ie(E.locale,null,!0),this.parse(E)}var A=B.prototype;return A.parse=function(E){this.$d=function(H){var P=H.date,Z=H.utc;if(P===null)return new Date(NaN);if(j.u(P))return new Date;if(P instanceof Date)return new Date(P);if(typeof P=="string"&&!/Z$/i.test(P)){var d=P.match(y);if(d){var p=d[2]-1||0,m=(d[7]||"0").substring(0,3);return Z?new Date(Date.UTC(d[1],p,d[3]||1,d[4]||0,d[5]||0,d[6]||0,m)):new Date(d[1],p,d[3]||1,d[4]||0,d[5]||0,d[6]||0,m)}}return new Date(P)}(E),this.$x=E.x||{},this.init()}
`).map(KM).filter(function(t){return t!==null});return lt(lt({},e[0]),e[1])}function ha(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=ca(i),e}function KM(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return QT(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return QT(r);case"DTSTART":return ha(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function QT(r){var e=r.replace(/^RRULE:/i,""),t=ha(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=ae[o.toUpperCase()];break;case"WKST":t.wkst=Zt[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=QM(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=XM(o);break;case"DTSTART":case"TZID":var c=ha(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=ca(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function QM(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(XT)}return XT(r)}function XT(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function XM(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Zt[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=Zt[s].weekday;return new je(a,i)})}var Wn=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=Di(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:$T(this.date,this.tzid)},r}();function ga(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(pa),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!fe(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!xe(o)||ut(o)&&!o.length)){switch(a){case"FREQ":u=$.FREQUENCIES[r.freq];break;case"WKST":It(o)?u=new je(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=IT(o).map(function(T){return T instanceof je?T:ut(T)?new je(T[0],T[1]):new je(T)}).toString();break;case"DTSTART":t=ZM(o,r.tzid);break;case"UNTIL":u=Di(o,!r.tzid);break;default:if(ut(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 f=e.map(function(T){var y=T[0],w=T[1];return"".concat(y,"=").concat(w.toString())}).join(";"),h="";return f!==""&&(h="RRULE:".concat(f)),[t,h].filter(function(T){return!!T}).join(`
`)}function ZM(r,e){return r?"DTSTART"+new Wn(new Date(r),e).toString():""}function JM(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 ZT=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?Wo(t):Gf(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 f=0;f<i.length;f++){var h=i[f];if(!JM(t[h],c[h]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(ut(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 Yr(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return ut(n)?Gf(n):n instanceof Date?Wo(n):n},r}();var JT=M(M(M(M(M(M(M(M(M(M(M(M(M([],ce(1,31),!0),ce(2,28),!0),ce(3,31),!0),ce(4,30),!0),ce(5,31),!0),ce(6,30),!0),ce(7,31),!0),ce(8,31),!0),ce(9,30),!0),ce(10,31),!0),ce(11,30),!0),ce(12,31),!0),ce(1,7),!0),eb=M(M(M(M(M(M(M(M(M(M(M(M(M([],ce(1,31),!0),ce(2,29),!0),ce(3,31),!0),ce(4,30),!0),ce(5,31),!0),ce(6,30),!0),ce(7,31),!0),ce(8,31),!0),ce(9,30),!0),ce(10,31),!0),ce(11,30),!0),ce(12,31),!0),ce(1,7),!0),eC=Xt(1,29),tC=Xt(1,30),cn=Xt(1,31),ft=Xt(1,32),tb=M(M(M(M(M(M(M(M(M(M(M(M(M([],ft,!0),tC,!0),ft,!0),cn,!0),ft,!0),cn,!0),ft,!0),ft,!0),cn,!0),ft,!0),cn,!0),ft,!0),ft.slice(0,7),!0),rb=M(M(M(M(M(M(M(M(M(M(M(M(M([],ft,!0),eC,!0),ft,!0),cn,!0),ft,!0),cn,!0),ft,!0),ft,!0),cn,!0),ft,!0),cn,!0),ft,!0),ft.slice(0,7),!0),rC=Xt(-28,0),nC=Xt(-29,0),dn=Xt(-30,0),pt=Xt(-31,0),nb=M(M(M(M(M(M(M(M(M(M(M(M(M([],pt,!0),nC,!0),pt,!0),dn,!0),pt,!0),dn,!0),pt,!0),pt,!0),dn,!0),pt,!0),dn,!0),pt,!0),pt.slice(0,7),!0),ib=M(M(M(M(M(M(M(M(M(M(M(M(M([],pt,!0),rC,!0),pt,!0),dn,!0),pt,!0),dn,!0),pt,!0),pt,!0),dn,!0),pt,!0),dn,!0),pt,!0),pt.slice(0,7),!0),sb=[0,31,60,91,121,152,182,213,244,274,305,335,366],ab=[0,31,59,90,120,151,181,212,243,273,304,334,365],zf=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Xt(7));return r}();function ob(r,e){var t=vr(r,1,1),n=Oi(r)?366:365,i=Oi(r+1)?366:365,s=la(t),a=Wr(t),o=lt(lt({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},iC(r)),{wnomask:null});if(Ft(e.byweekno))return o;o.wnomask=ce(0,n+7);var u,l,c=u=dt(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+dt(a-e.wkst,7)):l=n-c;for(var f=Math.floor(l/7),h=dt(l,7),T=Math.floor(f+h/4),y=0;y<e.byweekno.length;y++){var w=e.byweekno[y];if(w<0&&(w+=T+1),w>0&&w<=T){var D=void 0;w>1?(D=c+(w-1)*7,c!==u&&(D-=7-u)):D=c;for(var C=0;C<7&&(o.wnomask[D]=1,D++,o.wdaymask[D]!==e.wkst);C++);}}if(fe(e.byweekno,1)){var D=c+T*7;if(c!==u&&(D-=7-u),D<n)for(var y=0;y<7&&(o.wnomask[D]=1,D+=1,o.wdaymask[D]!==e.wkst);y++);}if(c){var N=void 0;if(fe(e.byweekno,-1))N=-1;else{var L=Wr(vr(r-1,1,1)),oe=dt(7-L.valueOf()+e.wkst,7),z=Oi(r-1)?366:365,ie=void 0;oe>=4?(oe=0,ie=z+dt(L-e.wkst,7)):ie=n-c,N=Math.floor(52+dt(ie,7)/4)}if(fe(e.byweekno,N))for(var D=0;D<c;D++)o.wnomask[D]=1}return o}function iC(r){var e=Oi(r)?366:365,t=vr(r,1,1),n=Wr(t);return e===365?{mmask:JT,mdaymask:rb,nmdaymask:ib,wdaymask:zf.slice(n),mrange:ab}:{mmask:eb,mdaymask:tb,nmdaymask:nb,wdaymask:zf.slice(n),mrange:sb}}function ub(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===$.YEARLY)if(Ft(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===$.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Ft(o))return a;a.nwdaymask=ce(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],c=l[0],f=l[1]-1,h=0;h<s.bynweekday.length;h++){var T=void 0,y=s.bynweekday[h],w=y[0],D=y[1];D<0?(T=f+(D+1)*7,T-=dt(i[T]-w,7)):(T=c+(D-1)*7,T+=dt(7-i[T]+w,7)),c<=T&&T<=f&&(a.nwdaymask[T]=1)}return a}function lb(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),f=i%4,h=Math.floor(32+2*a+2*c-l-f)%7,T=Math.floor((t+1
`),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 mC(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function mb(r,e){return mC(e),r.split(",").map(function(t){return ca(t)})}function gb(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 Kf=function(r){xi(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=gb.apply(n,["dtstart"]),n.tzid=gb.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return pb(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){yb(t,this._rrule)},e.prototype.exrule=function(t){yb(t,this._exrule)},e.prototype.rdate=function(t){Tb(t,this._rdate)},e.prototype.exdate=function(t){Tb(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return Yo(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return Yo(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(ga({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(bb("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(bb("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}($);function yb(r,e){if(!(r instanceof $))throw new TypeError(String(r)+" is not RRule instance");fe(e.map(String),String(r))||e.push(r)}function Tb(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");fe(e.map(Number),Number(r))||(e.push(r),$r(e))}function bb(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return Di(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}function jr(r,e){return r!==null&&e===null?-1:r===null&&e!==null?1:r!==null&&e!==null?r.isValid()&&!e.isValid()?-1:!r.isValid()&&e.isValid()||r.isAfter(e)?1:r.isBefore(e)?-1:0:0}var et=class{constructor({rrule:e,baseOnToday:t,referenceDate:n,startDate:i,scheduledDate:s,dueDate:a}){this.rrule=e,this.baseOnToday=t,this.referenceDate=n,this.startDate=i,this.scheduledDate=s,this.dueDate=a}static fromText({recurrenceRuleText:e,startDate:t,scheduledDate:n,dueDate:i}){try{let s=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(s==null)return null;let a=s[1].trim(),o=s[2]!==void 0,u=$.parseText(a);if(u!==null){let l=null;i?l=window.moment(i):n?l=window.moment(n):t&&(l=window.moment(t)),!o&&l!==null?u.dtstart=window.moment(l).startOf("day").utc(!0).toDate():u.dtstart=window.moment().startOf("day").utc(!0).toDate();let c=new $(u);return new et({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}catch(s){s instanceof Error&&console.log(s.message)}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(){let e=this.nextReferenceDate();if(e!==null){let t=null,n=null,i=null;if(this.referenceDate){if(this.startDate){let s=window.moment.duration(this.startDate.diff(this.referenceDate));t=window.moment(e),t.add(Math.round(s.asDays()),"days")}if(this.scheduledDate){let s=window.moment.duration(this.scheduledDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(s.asDays()),"days")}if(this.dueDate){let s=window.moment.duration(this.dueDate.diff(this.referenceDate));i=window.moment(e),i.add(Math.round(s.asDays()),"days")}}return{startDate:t,scheduledDate:n,dueDate:i}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||jr(this.startDate,e.startDate)!==0||jr(this.scheduledDate,e.scheduledDate)!==0||jr(this.dueDate,e.dueDate)!==0?!1:this.toText()===e.toText()}nextReferenceDate(){if(this.baseOnToday){let e=window.moment();return this.nextReferenceDateFromToday(e).toDate()}else return this.nextReferenceDateFromOriginalReferenceDate().toDate()}nextReferenceDateFromToday(e){let t=new $(it(we({},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.referenceDate)!=null?t:void 0).endOf("day");return this.nextAfter(e,this.rrule)}nextAfter(e,t){e.utc(!0);let n=window.moment(t.after(e.toDate())),i=this.toText(),s=i.match(/every( \d+)? month(s)?(.*)?/);s!==null&&(i.includes(" on ")||(n=et.nextAfterMonths(e,n,t,s[1])));let a=i.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=et.nextAfterYears(e,n,t,a[1])),et.addTimezone(n)}static nextAfterMonths(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));et.isSkippingTooManyMonths(e,t,s);)t=et.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));et.isSkippingTooManyYears(e,t,s);)t=et.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").toDat
`}),a=a.slice(0,s.autoSuggestMaxItems),a}}function gC(r,e,t,n){let i=u=>Object.values(n.prioritySymbols).some(l=>l.length>0&&u.includes(l)),s=[];if(r.includes(n.dueDateSymbol)||s.push({displayText:`${n.dueDateSymbol} due date`,appendText:`${n.dueDateSymbol} `}),r.includes(n.startDateSymbol)||s.push({displayText:`${n.startDateSymbol} start date`,appendText:`${n.startDateSymbol} `}),r.includes(n.scheduledDateSymbol)||s.push({displayText:`${n.scheduledDateSymbol} scheduled date`,appendText:`${n.scheduledDateSymbol} `}),i(r)||(s.push({displayText:`${n.prioritySymbols.High} high priority`,appendText:`${n.prioritySymbols.High} `}),s.push({displayText:`${n.prioritySymbols.Medium} medium priority`,appendText:`${n.prioritySymbols.Medium} `}),s.push({displayText:`${n.prioritySymbols.Low} low priority`,appendText:`${n.prioritySymbols.Low} `}),s.push({displayText:`${n.prioritySymbols.Highest} highest priority`,appendText:`${n.prioritySymbols.Highest} `}),s.push({displayText:`${n.prioritySymbols.Lowest} lowest priority`,appendText:`${n.prioritySymbols.Lowest} `})),r.includes(n.recurrenceSymbol)||s.push({displayText:`${n.recurrenceSymbol} recurring (repeat)`,appendText:`${n.recurrenceSymbol} `}),!r.includes(n.createdDateSymbol)){let l=Nt.parseDate("today",!0).format(V.dateFormat);s.push({textToMatch:`${n.createdDateSymbol} created`,displayText:`${n.createdDateSymbol} created today (${l})`,appendText:`${n.createdDateSymbol} ${l} `})}let a=Zf(r,/([a-zA-Z'_-]*)/g,e),o=[];if(a&&a.length>0){let u=a[0];if(u.length>=Math.max(1,t.autoSuggestMinMatch)){let l=s.filter(c=>(c.textToMatch||c.displayText).toLowerCase().includes(u.toLowerCase()));for(let c of l)o.push({suggestionType:"match",displayText:c.displayText,appendText:c.appendText,insertAt:a.index,insertSkip:u.length})}}return o.length===0&&t.autoSuggestMinMatch===0?s:o}function yC(r,e,t,n,i){let s=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],a=[],o=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),u=Zf(r,o,e);if(u&&u.length>=2){let l=u[1],c=u[2];if(c.length<t.autoSuggestMinMatch)return[];let f=c&&c.length>1?Nt.parseDate(Si(c),!0):null;f&&f.isValid()&&a.push({displayText:`${f.format(V.dateFormat)}`,appendText:`${l} ${f.format(V.dateFormat)} `,insertAt:u.index,insertSkip:u[0].length});let h=1,T=s.filter(y=>c&&c.length>=h&&y.toLowerCase().includes(c.toLowerCase())).slice(0,i);T.length===0&&(T=s.slice(0,i));for(let y of T){let D=`${Nt.parseDate(y,!0).format(V.dateFormat)}`;a.push({suggestionType:"match",displayText:`${y} (${D})`,appendText:`${l} ${D} `,insertAt:u.index,insertSkip:u[0].length})}}return a}function TC(r,e,t,n){var u;let i=["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"],s=[],a=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),o=Zf(r,a,e);if(o&&o.length>=2){let l=o[1],c=o[2];if(c.length<t.autoSuggestMinMatch)return[];if(c.length>0){let y=(u=et.fromText({recurrenceRuleText:c,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:u.toText();if(y){let w=`${l} ${y} `;if(s.push({suggestionType:"match",displayText:`\u2705 ${y}`,appendText:w,insertAt:o.index,insertSkip:o[0].length}),o[0]==w)return[]}}let f=1,h=t.autoSuggestMaxItems/2,T=i.filter(y=>c&&c.length>=f&&y.toLowerCase().includes(c.toLowerCase())).slice(0,h);T.length===0&&c.trim().length===0&&(T=i.slice(0,h));for(let y of T)s.push({suggestionType:"match",displayText:`${y}`,appendText:`${l} ${y} `,insertAt:o.index,insertSkip:o[0].length})}return s}function Zf(r,e,t){let n=r.matchAll(e);for(let i of n)if((i==null?void 0:i.index)&&i.index<=t&&t<=i.index+i[0].length)return i}function bC(r,e){if(e.length===0)return!1;let t=Object.fromEntries(e.map(([i,s])=>[i,0])),n=Object.fromEntries(e.map(([i,s])=>[s,i]));for(let i of r)i in t?t[i]++:i in n&&(t[n[i]]=Math.max(0,t[n[i]]-1));return Object.values(t).some(i=>i>0)}function vb(r,e){return(t,n,i)=>bC(t.slice
\`\`\`${n}
flowchart LR
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;
${i.join(`
`)}
${s.join(`
`)}
linkStyle default stroke:gray
\`\`\`
`}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=Db(e.name),i=e.type;if(t){let s=Ho(e.symbol),a=Ho(e.nextStatusSymbol),o=`[${s}] -> [${a}]`,u=`'${n}'`,l=`(${i})`;return`["${u}<br>${o}<br>${l}"]:::${i}`}else return`["${n}"]:::${i}`}};var lr=class{static calculate(e){let t=0;if(e.dueDate!==null){let n=window.moment().startOf("day"),i=Math.round(n.diff(e.dueDate)/lr.milliSecondsPerDay),s;i>=7?s=1:i>=-14?s=(i+14)*.8/21+.2:s=.2,t+=s*lr.dueCoefficient}switch(e.scheduledDate!==null&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*lr.scheduledCoefficient),e.startDate!==null&&window.moment().isBefore(e.startDate)&&(t+=1*lr.startedCoefficient),e.priority){case"0":t+=1.5*lr.priorityCoefficient;break;case"1":t+=1*lr.priorityCoefficient;break;case"2":t+=.65*lr.priorityCoefficient;break;case"3":t+=.325*lr.priorityCoefficient;break;case"5":t-=.3*lr.priorityCoefficient;break}return t}},zr=lr;zr.dueCoefficient=12,zr.scheduledCoefficient=5,zr.startedCoefficient=-3,zr.priorityCoefficient=6,zr.milliSecondsPerDay=1e3*60*60*24;var ht=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=Q();return!t||!this.matchesAnyFolder(n,e)?null:this.extractDateFromPath(e)}static matchesAnyFolder(e,t){return e.length===0?!0:e.some(n=>t.startsWith(n+"/"))}static extractDateFromPath(e){let t=Math.max(0,e.lastIndexOf("/")+1),n=e.lastIndexOf("."),i=e.substring(t,n),s=/(\d{4})-(\d{2})-(\d{2})/.exec(i);if(s||(s=/(\d{4})(\d{2})(\d{2})/.exec(i)),s){let a=window.moment([parseInt(s[1]),parseInt(s[2])-1,parseInt(s[3])]);if(a.isValid())return a}return null}static canApplyFallback({startDate:e,scheduledDate:t,dueDate:n}){return e===null&&n===null&&t===null}static updateTaskPath(e,t,n){let i=e.scheduledDate,s=e.scheduledDateIsInferred;return n===null?s&&(s=!1,i=null):s?i=n:this.canApplyFallback(e)&&(i=n,s=!0),new le(it(we({},e),{taskLocation:e.taskLocation.fromRenamedFile(t),scheduledDate:i,scheduledDateIsInferred:s}))}static removeInferredStatusIfNeeded(e,t){let n=e.scheduledDateIsInferred?e.scheduledDate:null;return t.map(i=>(n!==null&&!n.isSame(i.scheduledDate,"day")&&(i=new le(it(we({},i),{scheduledDateIsInferred:!1}))),i))}};var xb=require("obsidian");var Vr=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var rt=class{constructor(e){this._date=null;this._date=e}get moment(){return this._date}formatAsDate(e=""){return this.format(V.dateFormat,e)}formatAsDateAndTime(e=""){return this.format(V.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 Vr("Overdue",1):t.isSame(e,"day")?new Vr("Today",2):new Vr("Future",3):new Vr("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new Vr("",0);let t=this.fromNowOrder(e);return new Vr(e.fromNow(),t)}fromNowOrder(e){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 xb.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 Ci=class{constructor(e){this._path=e}get path(){return this._path}get pathWithoutExtension(){return this.withoutExtension(this.path)}withoutExtension(e){return e.replace(/\.md$/,"")}get root(){let e=this.path.replace(/\\/g,"/");e.charAt(0)==="/"&&(e=e.substring(1));let t=e.indexOf("/");return t==-1?"/":e.substring(0,t+1)}get folder(){let e=this.path,t=this.filename,n=e.substring(0,e.lastIndexOf(t));return n===""?"/":n}get filename(){let e=this.path.match(/([^/]+)$/);return e!==n
`),o=a.length,u=new ba(()=>ht.fromPath(i.path)),l=null,c=0;for(let f of t)if(f.task!==void 0){let h=f.position.start.line;if(h>=o)return this.logger.debug(`${i.path} Obsidian gave us a line number ${h} past the end of the file. ${o}.`),s;if((l===null||l.position.end.line<h)&&(l=Bn.getSection(h,n.sections),c=0),l===null)continue;let T=a[h];if(T===void 0){this.logger.debug(`${i.path}: line ${h} - ignoring 'undefined' line.`);continue}let y;try{y=le.fromLine({line:T,taskLocation:new ct(i.path,h,l.position.start.line,c,Bn.getPrecedingHeader(h,n.headings)),fallbackDate:u.value})}catch(w){this.reportTaskParsingErrorToUser(w,i,f,T);continue}y!==null&&(c++,s.push(y))}return s}reportTaskParsingErrorToUser(e,t,n,i){let s=`There was an error reading one of the tasks in this vault.
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: ${e}
File: ${t.path}
Line number: ${n.position.start.line}
Task line: ${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.
`;this.logger.error(s),e instanceof Error&&this.logger.error(e.stack?e.stack:"Cannot determine stack"),this.state==="Initializing"&&new Ai.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 hp=require("obsidian");var Qb=require("obsidian");function Qr(){}function ap(r){return r()}function Pb(){return Object.create(null)}function zn(r){r.forEach(ap)}function Ko(r){return typeof r=="function"}function Ib(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Fb(r){return Object.keys(r).length===0}var Lb=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,va=class{constructor(e){this.options=e,this._listeners="WeakMap"in Lb?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)va.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};va.entries="WeakMap"in Lb?new WeakMap:void 0;var Ub=!1;function kC(){Ub=!0}function SC(){Ub=!1}function R(r,e){r.appendChild(e)}function Fi(r,e,t){r.insertBefore(e,t||null)}function Vn(r){r.parentNode&&r.parentNode.removeChild(r)}function op(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function K(r){return document.createElement(r)}function OC(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function mt(r){return document.createTextNode(r)}function pe(){return mt(" ")}function Ot(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function qb(r){return function(e){return e.preventDefault(),r.call(this,e)}}function U(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Wb(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 DC(r){return Array.from(r.childNodes)}function up(r,e){e=""+e,r.data!==e&&(r.data=e)}function cr(r,e){r.value=e==null?"":e}function lp(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 $b(r){let e=r.querySelector(":checked");return e&&e.__value}function dr(r,e,t){r.classList[t?"add":"remove"](e)}var Hn=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=OC(t.nodeName):this.e=K(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)Fi(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(Vn)}};var wa;function _a(r){wa=r}function xC(){if(!wa)throw new Error("Function called outside component initialization");return wa}function cp(r){xC().$$.on_mount.push(r)}var Ni=[];var Qo=[],Ii=[],Nb=[],RC=Promise.resolve(),sp=!1;function MC(){sp||(sp=!0,RC.then(Yb))}function Ea(r){Ii.push(r)}var ip=new Set,Pi=0;function Yb(){if(Pi!==0)return;let r=wa;do{try{for(;Pi<Ni.length;){let e=Ni[Pi];Pi++,_a(e),CC(e.$$)}}catch(e){throw Ni.length=0,Pi=0,e}for(_a(null),Ni.length=0,Pi=0;Qo.length;)Qo.pop()();for(let e=0;e<Ii.length;e+=1){let t=Ii[e];ip.has(t)||(ip.add(t),t())}Ii.length=0}while(Ni.length);for(;Nb.length;)Nb.pop()();sp=!1,ip.clear(),_a(r)}function CC(r){if(r.fragment!==null){r.update(),zn(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Ea)}}function AC(r){let e=[],t=[];Ii.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Ii=e}var PC=new Set;function NC(r,e){r&&r.i&&(PC.delete(r),r.i(e))}var IC=["allowfullscreen","allowpaymentre
<span class="accesskey-first">future</span> dates:`,Gp=pe(),mr=K("input"),jp=pe(),si=K("div"),Na=K("label"),Na.innerHTML='Stat<span class="accesskey">u</span>s',Bp=pe(),Gt=K("select");for(let Y=0;Y<vt.length;Y+=1)vt[Y].c();Hp=pe(),en=K("div"),rs=K("div"),Fa=K("label"),Fa.textContent="Completed:",zp=pe(),tn=K("input"),Vp=pe(),ns=K("div"),Hu=K("span"),Hu.textContent="Created on:",Kp=pe(),Ua=K("code"),Qp=pe(),is=K("div"),zu=K("span"),zu.textContent="Done on:",Xp=pe(),qa=K("code"),Zp=pe(),ai=K("div"),Sn=K("button"),Jp=mt("Apply"),eh=pe(),ss=K("button"),ss.textContent="Cancel",U(i,"for","description"),U(a,"id","description"),U(a,"class","tasks-modal-description"),U(a,"placeholder","Take out the trash"),U(a,"accesskey",o=r[15]("t")),U(n,"class","tasks-modal-section"),U(c,"for",h="priority-"+r[1].priority),U(l,"class","tasks-modal-section tasks-modal-priorities"),U(D,"for","recurrence"),U(D,"class","accesskey-first"),U(N,"id","recurrence"),U(N,"type","text"),U(N,"placeholder","Try 'every 2 weeks on Thursday'."),U(N,"accesskey",L=r[15]("r")),dr(N,"tasks-modal-error",!r[8]),j.a=null,U(Le,"for","due"),U(Le,"class","accesskey-first"),U(A,"id","due"),U(A,"type","text"),U(A,"placeholder",dp),U(A,"accesskey",E=r[15]("d")),dr(A,"tasks-modal-error",!r[7]),p.a=null,U(g,"for","scheduled"),U(g,"class","accesskey-first"),U(v,"id","scheduled"),U(v,"type","text"),U(v,"placeholder",dp),U(v,"accesskey",k=r[15]("s")),dr(v,"tasks-modal-error",!r[5]),me.a=null,U(te,"for","start"),U(q,"id","start"),U(q,"type","text"),U(q,"placeholder",dp),U(q,"accesskey",Re=r[15]("a")),dr(q,"tasks-modal-error",!r[3]),Ue.a=null,U(Aa,"for","forwardOnly"),U(mr,"id","forwardOnly"),U(mr,"type","checkbox"),U(mr,"class","task-list-item-checkbox tasks-modal-checkbox"),U(mr,"accesskey",Pa=r[15]("f")),U(w,"class","tasks-modal-section tasks-modal-dates"),U(Na,"for","status"),U(Gt,"id","status-type"),U(Gt,"class","dropdown"),U(Gt,"accesskey",Ia=r[15]("u")),r[1].status===void 0&&Ea(()=>r[39].call(Gt)),U(si,"class","tasks-modal-section"),U(Fa,"for","status"),U(tn,"id","status"),U(tn,"type","checkbox"),U(tn,"class","task-list-item-checkbox tasks-modal-checkbox"),tn.checked=La=r[1].status.isCompleted(),tn.disabled=!0,U(en,"class","tasks-modal-section tasks-modal-status"),Sn.disabled=Wa=!r[14],U(Sn,"type","submit"),U(Sn,"class","mod-cta"),U(ss,"type","button"),U(ai,"class","tasks-modal-section tasks-modal-buttons"),dr(t,"with-accesskeys",r[9]),U(e,"class","tasks-modal")},m(Y,he){Fi(Y,e,he),R(e,t),R(t,n),R(n,i),R(n,s),R(n,a),cr(a,r[1].description),r[31](a),R(t,u),R(t,l),R(l,c),R(c,f),R(l,T);for(let de=0;de<_t.length;de+=1)_t[de]&&_t[de].m(l,null);R(t,y),R(t,w),R(w,D),R(w,C),R(w,N),cr(N,r[1].recurrenceRule),R(w,oe),R(w,z),R(z,ie),R(z,G),j.m(r[12],z),R(w,Ne),R(w,Le),R(w,B),R(w,A),cr(A,r[1].dueDate),R(w,H),R(w,P),R(P,Z),R(P,d),p.m(r[6],P),R(w,m),R(w,g),R(w,b),R(w,v),cr(v,r[1].scheduledDate),R(w,x),R(w,S),R(S,O),R(S,I),me.m(r[4],S),R(w,se),R(w,te),R(w,De),R(w,q),cr(q,r[1].startDate),R(w,Ae),R(w,nt),R(nt,Mr),R(nt,We),Ue.m(r[2],nt),R(w,Yp),R(w,ts),R(ts,Aa),R(ts,Gp),R(ts,mr),mr.checked=r[1].forwardOnly,R(t,jp),R(t,si),R(si,Na),R(si,Bp),R(si,Gt);for(let de=0;de<vt.length;de+=1)vt[de]&&vt[de].m(Gt,null);lp(Gt,r[1].status,!0),R(t,Hp),R(t,en),R(en,rs),R(rs,Fa),R(rs,zp),R(rs,tn),R(en,Vp),R(en,ns),R(ns,Hu),R(ns,Kp),R(ns,Ua),Ua.innerHTML=r[11],R(en,Qp),R(en,is),R(is,zu),R(is,Xp),R(is,qa),qa.innerHTML=r[13],R(t,Zp),R(t,ai),R(ai,Sn),R(Sn,Jp),R(ai,eh),R(ai,ss),Vu||(th=[Ot(a,"input",r[30]),Ot(a,"keydown",r[23]),Ot(a,"paste",r[24]),Ot(a,"drop",r[24]),Ot(l,"keyup",r[21]),Ot(N,"input",r[34]),Ot(A,"input",r[35]),Ot(v,"input",r[36]),Ot(q,"input",r[37]),Ot(mr,"change",r[38]),Ot(Gt,"change",r[39]),Ot(ss,"click",r[22]),Ot(t,"submit",qb(r[25]))],Vu=!0)},p(Y,he){if(he[0]&32768&&o!==(o=Y[15]("t"))&&U(a,"accesskey",o),he[0]&3&&cr(a,Y[1].description),he[0]&3&&h!==(h="priority-"+Y[1].priority)&&U(c,"for",h),he[0]&1081346){oi=Y[20];let de;for(de=0;de<oi.length;de+=1){let as=Hb(Y,oi,de);_t[de]?_t[de].p(as,he):(_t[de]=zb(as),_t[de].c(),_t[de].m(l,null))}for(;de<_t.length;de+=1)_t[de].d(1);_t.leng
`);e.setLine(a,T)};new gn({app:n,task:u,onSubmit:l}).open()};var mp=require("obsidian");var Zb=(r,e,t)=>{var u;if(r)return t instanceof mp.MarkdownView;if(!(t instanceof mp.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=jC(a,n);e.setLine(s,o.text),e.setCursor(BC(i,o))},jC=(r,e)=>{let t=le.fromLine({line:r,taskLocation:ct.fromUnknownPosition(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(V.taskRegex);if(n!==null){let i=n[3],a=ve.getInstance().bySymbol(i).nextStatusSymbol;return{text:r.replace(V.taskRegex,`$1- [${a}] $4`)}}else if(V.listItemRegex.test(r)){let i=r.replace(V.listItemRegex,"$1$2 [ ]");return{text:i,moveTo:{ch:i.length}}}else{let i=r.replace(V.indentationRegex,"$1- ");return{text:i,moveTo:{ch:i.length}}}}},BC=(r,e)=>{var s;let t={line:0,ch:r.ch},n=we(we({},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 Jo=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)=>Xb(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Zb})}};var HC=Object.prototype.toString,Ui=Array.isArray||function(e){return HC.call(e)==="[object Array]"};function yp(r){return typeof r=="function"}function zC(r){return Ui(r)?"array":typeof r}function gp(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Jb(r,e){return r!=null&&typeof r=="object"&&e in r}function VC(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var KC=RegExp.prototype.test;function QC(r,e){return KC.call(r,e)}var XC=/\S/;function ZC(r){return!QC(XC,r)}var JC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function eA(r){return String(r).replace(/[&<>"'`=\/]/g,function(t){return JC[t]})}var tA=/\s*/,rA=/\s+/,e_=/\s*=/,nA=/\s*\}/,iA=/#|\^|\/|>|\{|&|=|!/;function sA(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 f,h,T;function y(j){if(typeof j=="string"&&(j=j.split(rA,2)),!Ui(j)||j.length!==2)throw new Error("Invalid tags: "+j);f=new RegExp(gp(j[0])+"\\s*"),h=new RegExp("\\s*"+gp(j[1])),T=new RegExp("\\s*"+gp("}"+j[1]))}y(e||Jt.tags);for(var w=new Sa(r),D,C,N,L,oe,z;!w.eos();){if(D=w.pos,N=w.scanUntil(f),N)for(var ie=0,G=N.length;ie<G;++ie)L=N.charAt(ie),ZC(L)?(s.push(i.length),u+=L):(o=!0,t=!0,u+=" "),i.push(["text",L,D,D+1]),D+=1,L===`
`&&(c(),u="",l=0,t=!1);if(!w.scan(f))break;if(a=!0,C=w.scan(iA)||"name",w.scan(tA),C==="="?(N=w.scanUntil(e_),w.scan(e_),w.scanUntil(h)):C==="{"?(N=w.scanUntil(T),w.scan(nA),w.scanUntil(h),C="&"):N=w.scanUntil(h),!w.scan(h))throw new Error("Unclosed tag at "+w.pos);if(C==">"?oe=[C,N,D,w.pos,u,l,t]:oe=[C,N,D,w.pos],l++,i.push(oe),C==="#"||C==="^")n.push(oe);else if(C==="/"){if(z=n.pop(),!z)throw new Error('Unopened section "'+N+'" at '+D);if(z[1]!==N)throw new Error('Unclosed section "'+z[1]+'" at '+D)}else C==="name"||C==="{"||C==="&"?o=!0:C==="="&&y(N)}if(c(),z=n.pop(),z)throw new Error('Unclosed section "'+z[1]+'" at '+w.pos);return oA(aA(i))}function aA(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 oA(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 Sa(r){this.string=r,this.tail=r,this.pos=0}Sa.prototype.eos=function(){return this.tail===""};Sa.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};Sa.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 Li(r,e){this.view=r,this.cache={".":this.view},this.parent=e}Li.prototype.push=function(e){return new Li(e,this)};Li.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=Jb(s,a[o])||VC(s,a[o])),s=s[a[o++]];else s=i.view[e],u=Jb(i.view,e);if(u){n=s;break}i=i.parent}t[e]=n}return yp(n)&&(n=n.call(this.view)),n};function Dt(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Dt.prototype.clearCache=function(){typeof this.templateCache!="undefined"&&this.templateCache.clear()};Dt.prototype.parse=function(e,t){var n=this.templateCache,i=e+":"+(t||Jt.tags).join(":"),s=typeof n!="undefined",a=s?n.get(i):void 0;return a==null&&(a=sA(e,t),s&&n.set(i,a)),a};Dt.prototype.render=function(e,t,n,i){var s=this.getConfigTags(i),a=this.parse(e,s),o=t instanceof Li?t:new Li(t,void 0);return this.renderTokens(a,o,n,e,i)};Dt.prototype.renderTokens=function(e,t,n,i,s){for(var a="",o,u,l,c=0,f=e.length;c<f;++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};Dt.prototype.renderSection=function(e,t,n,i,s){var a=this,o="",u=t.lookup(e[1]);function l(h){return a.render(h,t,n,s)}if(!!u){if(Ui(u))for(var c=0,f=u.length;c<f;++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(yp(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}};Dt.prototype.renderInverted=function(e,t,n,i,s){var a=t.lookup(e[1]);if(!a||Ui(a)&&a.length===0)return this.renderTokens(e[4],t,n,i,s)};Dt.prototype.indentPartial=function(e,t,n){for(var i=t.replace(/[^ \t]/g,""),s=e.split(`
`),a=0;a<s.length;a++)s[a].length&&(a>0||!n)&&(s[a]=i+s[a]);return s.join(`
`)};Dt.prototype.renderPartial=function(e,t,n,i){if(!!n){var s=this.getConfigTags(i),a=yp(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 f=this.parse(c,s);return this.renderTokens(f,t,n,c,i)}}};Dt.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(n!=null)return n};Dt.prototype.escapedValue=function(e,t,n){var i=this.getConfigEscape(n)||Jt.escape,s=t.lookup(e[1]);if(s!=null)return typeof s=="number"&&i===Jt.escape?String(s):i(s)};Dt.prototype.rawValue=function(e){return e[1]};Dt.prototype.getConfigTags=function(e){return Ui(e)?e:e&&typeof e=="object"?e.tags:void 0};Dt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Ui(e))return e.escape};var Jt={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){ka.templateCache=r},get templateCache(){return ka.templateCache}},ka=new Dt;Jt.clearCache=function(){return ka.clearCache()};Jt.parse=function(e,t){return ka.parse(e,t)};Jt.render=function(e,t,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+zC(e)+'" was given as the first argument for mustache#render(template, view, partials)');return ka.render(e,t,n,i)};Jt.escape=eA;Jt.Scanner=Sa;Jt.Context=Li;Jt.Writer=Dt;var Tp=Jt;var s_=us(i_());function a_(r,e){Tp.escape=function(t){return t};try{return Tp.render(r,(0,s_.default)(e))}catch(t){let n="";throw t instanceof Error?n=`There was an error expanding one or more placeholders.
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:
${r}`,Error(n)}}function eu(r){return{query:{file:new Ci(r)}}}function Kn(r,e){let t=`Error: ${r}.
The error message was:
`,n="";return e instanceof Error?n+=e:n+="Unknown error",`${t}"${n}"`}var Xr=class{constructor(e,t,n,i){this.instruction=e,this.property=t,this.comparator=Xr.maybeReverse(i,n)}static maybeReverse(e,t){return e?Xr.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var yn=class{constructor(e,t,n,i){this.instruction=e,this.property=t,this.grouper=n,this.reverse=i}};var ke=class{canCreateFilterForLine(e){return ke.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 Go(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=ke.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 Xr(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=ke.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 yn(this.grouperInstruction(e),this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};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+=`
${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 gt=class{constructor(e,t,n){this.instruction=e,this.explanation=n,this.filterFunction=t}explainFilterIndented(e){let t=this.explanation;return t.asString()===this.instruction?`${e}${this.instruction}
`:`${e}${this.instruction} =>
${t.asString(e+" ")}
`}};var Er=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}static fromObject(e,t){let n=new Er(e);return n._queryComponent=t,n}static fromError(e,t){let n=new Er(e);return n._error=t,n}};var J=class{constructor(e){this.object=e}get instruction(){return this.object.instruction}get filter(){return this.object.queryComponent}get error(){return this.object.error}get filterFunction(){if(this.filter)return this.filter.filterFunction}static fromFilter(e){return new J(Er.fromObject(e.instruction,e))}static fromError(e,t){return new J(Er.fromError(e,t))}};var tu=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e.toLocaleLowerCase()===this._instruction.toLocaleLowerCase()}createFilterOrErrorMessage(e){return this.canCreateFilterForLine(e)?J.fromFilter(new gt(e,this._filter,new Se(e))):J.fromError(e,`do not understand filter: ${e}`)}};var kr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new tu(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let t of this._filters){let n=t.createFilterOrErrorMessage(e);if(n.error===void 0)return n}return J.fromError(e,`do not understand filter: ${e}`)}};var Tn=class extends ke{constructor(){super(...arguments);this._filters=new kr}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var Sr=class extends Tn{constructor(){super(),this._filters.add("done",e=>e.isDone),this._filters.add("not done",e=>!e.isDone)}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Sr.oldStatusName(e),i=Sr.oldStatusName(t);return n<i?1:n>i?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[Sr.oldStatusName(e)]}};var ru=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.
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.
See: https://publish.obsidian.md/tasks/Advanced/Instruction+contains+unexpanded+template+text
`}};var yt=class extends ke{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new kr,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 h;let n=this.checkForUnexpandedTemplateText(t);if(n)return J.fromError(t,n);let i=this.filterInstructions.createFilterOrErrorMessage(t);if(i.filter!==void 0)return i;let s=ke.getMatch(this.filterRegExp(),t);if(s===null)return J.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let a=s[1],o=(h=s[2])==null?void 0:h.toLowerCase(),u=s[3],l=Nt.parseDateRange(u);if(!l.isValid()){let T=Nt.parseDate(a);T.isValid()&&(l=new Et(T,T))}if(!l.isValid())return J.fromError(t,"do not understand "+this.fieldName()+" date");let c=this.buildFilterFunction(o,l),f=yt.buildExplanation(this.fieldNameForExplanation(),o,this.filterResultIfFieldMissing(),l);return J.fromFilter(new gt(t,c,f))}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:`,f=[new Se(`${s.start.format(o)} and`),new Se(`${s.end.format(o)} inclusive`)];return i&&f.push(new Se(`OR no ${t} date`)),new Se(c,f)}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)=>jr(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.format("YYYY-MM-DD dddd")]}}checkForUnexpandedTemplateText(t){return new ru().findUnexpandedDateText(t)}};var qi=class extends yt{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}};var _p=class extends ke{createFilterOrErrorMessage(e){var n;let t=ke.getMatch(this.filterRegExp(),e);if(t!==null){let i=t[5],s=null;switch(i.toLowerCase()){case"lowest":s="5";break;case"low":s="4";break;case"none":s="3";break;case"medium":s="2";break;case"high":s="1";break;case"highest":s="0";break}if(s===null)return J.fromError(e,"do not understand priority");let a=e,o;switch((n=t[3])==null?void 0:n.toLowerCase()){case"above":o=u=>u.priority.localeCompare(s)<0;break;case"below":o=u=>u.priority.localeCompare(s)>0;break;case"not":o=u=>u.priority!==s;break;default:o=u=>u.priority===s,a=`${this.fieldName()} is ${i}`}return J.fromFilter(new gt(e,o,new Se(a)))}else return J.fromError(e,"do not understand query filter (priority)")}fieldName(){return"priority"}filterRegExp(){return _p.priorityRegexp}supportsSorting(){return!0}comparator(){return(e,t)=>e.priority.localeCompare(t.priority)}supportsGrouping(){return!0}grouper(){return e=>[e.priority
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.
`}explanation(t){let i=uA(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 uA(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 Me=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return J.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 $i(i);else if(n.includes("regex")){try{s=bn.validateAndConstruct(i)}catch(u){let l=Kn("Parsing regular expression",u)+`
${bn.helpMessage()}`;return J.fromError(e,l)}if(s===null)return J.fromError(e,`Invalid instruction: '${e}'
${bn.helpMessage()}`)}if(s===null)return J.fromError(e,`do not understand query filter (${this.fieldName()})`);let a=n.match(/not/)!==null,o=new gt(e,this.getFilter(s,a),s.explanation(e));return J.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 Yi=class extends Me{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var Gi=class extends ke{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return J.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 ji=class{static by(e,t){let n=[new Gi().comparator(),new Sr().comparator(),new qi().comparator(),new Qn().comparator(),new Yi().comparator()],i=[];for(let s of e)i.push(s.comparator);return t.sort(ji.makeCompositeComparator([...i,...n]))}static makeCompositeComparator(e){return(t,n)=>{for(let i of e){let s=i(t,n);if(s!==0)return s}return 0}}};var nu=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var iu=class{constructor(e,t){this.lastHeadingAtLevel=new Array;this.groupers=t;let i=e.keys().next().value.length;for(let s=0;s<i;s++)this.lastHeadingAtLevel.push("")}getHeadingsForTaskGroup(e){let t=new Array;for(let n=0;n<e.length;n++){let i=e[n];if(i!=this.lastHeadingAtLevel[n]){t.push(new nu(n,i,this.groupers[n].property));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var su=class{constructor(e){this.children=new Map;this.values=[];this.values=e}generateAllPaths(e=[]){let t=new Map;if(this.children.size==0)return t.set([...e],this.values),t;for(let[n,i]of this.children)e.push(n),i.generateAllPaths(e).forEach((a,o)=>t.set(o,a)),e.pop();return t}};var au=class extends su{},ou=class{constructor(e,t,n){this.root=new au(t),this.buildGroupingTree(e,n)}buildGroupingTree(e,t){let n=[this.root];for(let i of e){let s=[];for(let a of n)for(let o of a.values){let u=i.grouper(o,t);u.length===0&&u.push("");for(let l of u){let c=a.children.get(l);c===void 0&&(c=new au([]),a.children.set(l,c),s.push(c)),c.values.push(o)}}n=s}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var uu=class{constructor(e,t){this.groups=e,this.groupHeadings=[],this.tasks=t}setGroupHeadings(e){for(let t of e)this.groupHeadings.push(t)}applyTaskLimit(e){this.tasks=this.tasks.slice(0,e)}tasksAsStringOfLines(){let e="";for(let t of this.tasks)e+=t.toFileLineString()+`
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName}
`;return e+=this.tasksAsStringOfLines(),e}};var Bi=class{constructor(e,t,n){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let s=new ou(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):
`;for(let n of this._groupers){let i=n.reverse?" reverse":"";e+=`- ${n.property}${i}
`}for(let n of this.groups)e+=n.toString(),e+=`
---
`;return e+=`
${this.totalTasksCount()} tasks
`,e}addTaskGroups(e){for(let[t,n]of e){let i=new uu(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 iu(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 Xn=class extends Me{fieldName(){return"description"}value(e){return ge.getInstance().removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Xn.cleanDescription(e.description),i=Xn.cleanDescription(t.description);return n.localeCompare(i,void 0,{numeric:!0})}}static cleanDescription(e){e=ge.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 lu=class extends yt{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var cu=class extends yt{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var du=class extends Tn{constructor(){super(),this._filters.add("exclude sub-items",e=>{if(e.indentation==="")return!0;let t=e.indentation.lastIndexOf(">");return t===-1?!1:/^ ?$/.test(e.indentation.slice(t+1))})}fieldName(){return"exclude"}};var Oa=class extends Er{};function vp(r,e){let t=r.map(([n])=>n);try{let n=e.includes("return")?e:`return ${e}`,i=e&&new Function(...t,n);return i instanceof Function?Oa.fromObject(e,i):Oa.fromError(e,"Error parsing group function")}catch(n){return Oa.fromError(e,Kn(`Failed parsing expression "${e}"`,n))}}function wp(r,e){let t=e.map(([n,i])=>i);return r(...t)}function Ep(r,e,t){try{return wp(r,e)}catch(n){return Kn(`Failed calculating expression "${t}"`,n)}}function fu(r,e){return[["task",r],["query",e?e.query:null]]}function o_(r,e,t){let n=fu(r,t||null),i=vp(n,e);return i.error?i.error:Ep(i.queryComponent,n,e)}var pu=class{constructor(e){this.line=e,this.functionOrError=vp(fu(null,null),e)}isValid(){return this.functionOrError.error===void 0}get parseError(){return this.functionOrError.error}evaluate(e,t){if(!this.isValid())throw Error(`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`);return wp(this.functionOrError.queryComponent,fu(e,t||null))}evaluateOrCatch(e,t){return this.isValid()?Ep(this.functionOrError.queryComponent,fu(e,t),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};var hu=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return J.fromError(e,"Unable to parse line");let n=t[1],i=new pu(n);return i.isValid()?J.fromFilter(new gt(e,lA(i),new Se(e))):J.fromError(e,i.parseError)}fieldName(){return"function"}filterRegExp(){return new RegExp(`^filter by ${this.fieldNameSingularEscaped()} (.*)`,"i")}supportsGrouping(){return!0}createGrouperFromLine(e){let t=ke.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1],i=t[2];return new yn(e,"function",dA(i),n)}grouperRegExp(){return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`,"i")}grouper(){throw Error("grouper() function not valid for FunctionField. Use createGrouperFromLine() instead.")}};function lA(r){return(e,t)=>{let n=t.queryContext();return cA(r,e,n)}}functi
Allowed options: 'is' and 'is not' (without quotes).
Allowed values: ${t}
Note: values are case-insensitive,
so 'in_progress' works too, for example.
Example: ${this.fieldNameSingular()} is not NON_TASK`;return J.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=_n.groupName(e),i=_n.groupName(t);return n.localeCompare(i,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[_n.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var Ru=class extends Me{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 Mu=class extends Me{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(this.value(e))]}};var Cu=class extends Me{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(this.value(e))]}};var Au=class extends Me{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return J.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 Pp=[()=>new xu,()=>new _n,()=>new Sr,()=>new bu,()=>new Qn,()=>new Tu,()=>new lu,()=>new yu,()=>new gu,()=>new qi,()=>new cu,()=>new Yi,()=>new Mu,()=>new Cu,()=>new Au,()=>new Xn,()=>new Zn,()=>new mu,()=>new du,()=>new Du,()=>new Gi,()=>new Ru,()=>new hu,()=>new Su];function Ou(r){for(let e of Pp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function w_(r){let e=/^sort by /i;if(r.match(e)===null)return null;for(let t of Pp){let i=t().createSorterFromLine(r);if(i)return i}return null}function E_(r){let e=/^group by /i;if(r.match(e)===null)return null;for(let t of Pp){let i=t().createGrouperFromLine(r);if(i)return i}return null}var vn=class{constructor(e,t){this.queryPath=e,this.allTasks=[...t]}static fromAllTasks(e){return new vn(void 0,e)}queryContext(){return this.queryPath?eu(this.queryPath):void 0}};function k_(r){return`task${r!==1?"s":""}`}var ti=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} ${k_(e)}`:`${e} of ${t} ${k_(t)}`}get groups(){return this.taskGroups.groups}static fromError(e){let t=new ti(new Bi([],[],vn.fromAllTasks([])),0);return t._searchErrorMessage=e,t}};function S_(r){return r.endsWith("\\")}function O_(r){return r.endsWith("\\\\")}function qA(r){return r.replace(/^[ \t]*/,"")}function WA(r){return r.replace(/[ \t]*\\$/,"")}function $A(r,e){let t=r;return e&&(t=qA(r)),O_(t)?t=t.slice(0,-1):S_(r)&&(t=WA(t)),t}function YA(r,e,t){e?r[r.length-1]+=" "+t:r.push(t)}function GA(r){let e=[],t=!1;for(let n of r.split(`
`)){let i=$A(n,t);YA(e,t,i),O_(n)?t=!1:t=S_(n)}return e.join(`
`)}function D_(r){return GA(r).split(`
`).map(e=>e.trim()).filter(e=>e!=="")}var Ji=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(`
`)}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.
`):e.filters.map(n=>n.explainFilterIndented(this.indentation)).join(`
`)}explainGroups(e){let t=e.grouping.length;if(t===0)return this.indent(`No grouping instructions supplied.
`);let n="";for(let i=0;i<t;i++)n+=this.indentation+e.grouping[i].instruction+`
`;return n}explainSorters(e){let t=e.sorting.length;if(t===0)return this.indent(`No sorting instructions supplied.
`);let n="";for(let i=0;i<t;i++)n+=this.indentation+e.sorting[i].instruction+`
`;return n}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)+`.
`;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(`
`)}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.
`)),e}indent(e){return this.indentation+e}};var Jr=class{constructor(e,t=void 0){this._limit=void 0;this._taskGroupLimit=void 0;this._layoutOptions=new $n;this._queryLayoutOptions=new pn;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this._ignoreGlobalQuery=!1;this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|postpone button|urgency|tags)/i;this.shortModeRegexp=/^short/i;this.fullModeRegexp=/^full/i;this.explainQueryRegexp=/^explain/i;this.ignoreGlobalQueryRegexp=/^ignore global query/i;this.logger=St.getLogger("tasks.Query");this._queryId="";this.limitRegexp=/^limit (groups )?(to )?(\d+)( tasks?)?/i;this.commentRegexp=/^#.*/;this._queryId=this.generateQueryId(10),this.source=e,this.filePath=t,this.debug(`Creating query: ${this.formatQueryForLogging()}`),D_(e).forEach(n=>{let i=this.expandPlaceholders(n,t);if(this.error===void 0)switch(!0){case this.shortModeRegexp.test(i):this._queryLayoutOptions.shortMode=!0;break;case this.fullModeRegexp.test(i):this._queryLayoutOptions.shortMode=!1;break;case this.explainQueryRegexp.test(i):this._queryLayoutOptions.explainQuery=!0;break;case this.ignoreGlobalQueryRegexp.test(i):this._ignoreGlobalQuery=!0;break;case this.limitRegexp.test(i):this.parseLimit(i);break;case this.parseSortBy(i):break;case this.parseGroupBy(i):break;case this.hideOptionsRegexp.test(i):this.parseHideOptions(i);break;case this.commentRegexp.test(i):break;case this.parseFilter(i):break;default:this.setError("do not understand query",i)}})}formatQueryForLogging(){return`[${this.source.split(`
`).join(" ; ")}]`}expandPlaceholders(e,t){if(e.includes("{{")&&e.includes("}}")&&this.filePath===void 0)return this._error=`The query looks like it contains a placeholder, with "{{" and "}}"
but no file path has been supplied, so cannot expand placeholder values.
The query is:
${e}`,e;let n=e;if(t){let i=eu(t);try{n=a_(e,i)}catch(s){return s instanceof Error?this._error=s.message:this._error="Internal error. expandPlaceholders() threw something other than Error.",e}}return n}append(e){return this.source===""?e:e.source===""?this:new Jr(`${this.source}
${e.source}`,this.filePath)}explainQuery(){return new Ji().explainQuery(this)}get limit(){return this._limit}get taskGroupLimit(){return this._taskGroupLimit}get layoutOptions(){return this._layoutOptions}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=`${e}
Problem line: "${t}"`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){this.debug(`Executing query: ${this.formatQueryForLogging()}`);let t=new vn(this.filePath,e);try{this.filters.forEach(o=>{e=e.filter(u=>o.filterFunction(u,t))});let{debugSettings:n}=Q(),i=n.ignoreSortInstructions?e:ji.by(this.sorting,e),s=i.slice(0,this.limit),a=new Bi(this.grouping,s,t);return this._taskGroupLimit!==void 0&&a.applyTaskLimit(this._taskGroupLimit),new ti(a,i.length)}catch(n){let i="Search failed";return ti.fromError(Kn(i,n))}}parseHideOptions(e){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1].toLowerCase()==="hide";switch(t[2].toLowerCase()){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._layoutOptions.hidePriority=n;break;case"created date":this._layoutOptions.hideCreatedDate=n;break;case"start date":this._layoutOptions.hideStartDate=n;break;case"scheduled date":this._layoutOptions.hideScheduledDate=n;break;case"due date":this._layoutOptions.hideDueDate=n;break;case"done date":this._layoutOptions.hideDoneDate=n;break;case"recurrence rule":this._layoutOptions.hideRecurrenceRule=n;break;case"edit button":this._queryLayoutOptions.hideEditButton=n;break;case"urgency":this._queryLayoutOptions.hideUrgency=n;break;case"tags":this._layoutOptions.hideTags=n;break;default:this.setError("do not understand hide/show option",e)}}}parseFilter(e){var n;let t=Ou(e);return t!=null?(t.filter?this._filters.push(t.filter):this.setError((n=t.error)!=null?n:"Unknown error",e),!0):!1}parseLimit(e){let t=e.match(this.limitRegexp);if(t===null){this.setError("do not understand query limit",e);return}let n=Number.parseInt(t[3],10);t[1]!==void 0?this._taskGroupLimit=n:this._limit=n}parseSortBy(e){let t=w_(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=E_(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 wn=class{constructor(e=wn.empty){this._source=e}static getInstance(){return wn.instance||(wn.instance=new wn),wn.instance}set(e){this._source=e}query(e=void 0){return new Jr(this._source,e)}hasInstructions(){return this._source.trim()!==wn.empty}},tr=wn;tr.empty="";var Pu=class{constructor({obsidianEvents:e}){this.logger=St.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 Ra=require("obsidian");var xa,Np,Ip,jA=["md"];function Fu(){return St.getLogger("tasks.File")}var x_=({metadataCache:r,vault:e,workspace:t})=>{xa=r,Np=e,Ip=t},ri=t=>F(void 0,[t],function*({originalTask:r,newTasks:e}){if(Np===void 0||xa===void 0||Ip===void 0){Nu("Tasks: cannot use File before initializing it.");return}Array.isArray(e)||(e=[e]);let n=Fu(),i="replaceTaskWithTasks()";zo(n,i,r),Vo(n,i,e),M_({originalTask:r,newTasks:e,vault:Np,metadataCache:xa,workspace:Ip,previousTries:0})});function Nu(r){console.error(r),new Ra.Notice(r,15e3)}function R_(r){console.warn(r),new Ra.Notice(r,1e4)}function BA(r){Fu().debug(r)}var En=class extends Error{},Iu=class extends Error{},M_=a=>F(void 0,[a],function*({originalTask:r,newTasks:e,vault:t,metadataCache:n,w
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.
`;Nu(c);return}let l=Math.min(Math.pow(10,s),100);o.debug(`timeout = ${l}`),setTimeout(()=>{M_({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:s+1})},l)};try{let[l,c,f]=yield C_(r,t),h=[...f.slice(0,l),...e.map(T=>T.toFileLineString()),...f.slice(l+1)];yield t.modify(c,h.join(`
`))}catch(l){if(l instanceof En)return l.message&&R_(l.message),u();if(l instanceof Iu)return u();l instanceof Error&&Nu(l.message)}});function C_(r,e){return F(this,null,function*(){if(xa===void 0)throw new En;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof Ra.TFile))throw new En(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!jA.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=xa.getFileCache(t);if(n==null||n===null)throw new En(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let i=n.listItems;if(i===void 0||i.length===0)throw new En(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let a=(yield e.read(t)).split(`
`),o=HA(r,a,i,BA);if(o===void 0)throw new Iu;return[o,t,a]})}function Fp(r,e){return F(this,null,function*(){try{let[t,n,i]=yield C_(r,e);return[t,n]}catch(t){t instanceof En?t.message&&R_(t.message):t instanceof Error&&Nu(t.message)}})}function A_(r,e){return r<e.length}function HA(r,e,t,n){let i=zA(r,e);return i!==void 0||(i=VA(r,e),i!==void 0)?i:KA(r,e,t,n)}function zA(r,e){let t=r.taskLocation.lineNumber;if(A_(t,e)&&e[t]===r.originalMarkdown)return Fu().debug(`Found original markdown at original line number ${t}`),t}function VA(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 KA(r,e,t,n){let i,s=0;for(let a of t){let o=a.position.start.line;if(!A_(o,e))return;if(o<r.taskLocation.sectionStart||a.task===void 0)continue;let u=e[o];if(ge.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}.
Expected task:
${r.originalMarkdown}
Found task:
${u}`);return}break}s++}}return i}var F_=require("obsidian");var I_=require("obsidian");var Lu=class{constructor(){this.data=QA}addDataAttribute(e,t,n){this.data[n].addDataAttribute(e,t,n)}className(e){return this.data[e].className}},Lp=class{constructor(e,t,n){if(e==="")throw Error("Developer note: CSS class cannot be an empty string, please specify one.");this.className=e,this.attributeName=t,this.attributeValueCalculator=n}addDataAttribute(e,t,n){this.attributeName!==Lp.noAttributeName&&(e.dataset[this.attributeName]=this.attributeValueCalculator(n,t))}},Ce=Lp;Ce.noAttributeName="",Ce.noAttributeValueCalculator=()=>"",Ce.dateAttributeCalculator=(e,t)=>{let i="far";function s(o){let u=window.moment().startOf("day"),l="",c=u.diff(o,"days");return isNaN(c)?null:c===0?"today":(c>0?l+="past-":c<0&&(l+="future-"),Math.abs(c)<=7?l+=Math.abs(c).toString()+"d":l+=i,l)}let a=t[e];if(a instanceof window.moment){let o=s(a);if(o)return o}return""};var QA={createdDate:new Ce("task-created","taskCreated",Ce.dateAttributeCalculator),dueDate:new Ce("task-due","taskDue",Ce.dateAttributeCalculator),startDate:new Ce("task-start","taskStart",Ce.dateAttributeCalculator),scheduledDate:new Ce("task-scheduled","taskScheduled",Ce.dateAttributeCalculator),doneDate:new Ce("task-done","taskDone",Ce.dateAttributeCalculator),description:new Ce("task-description",Ce.noAttributeName,Ce.noAttributeValueCalculator),recurrenceRule:new Ce("task-recurring",Ce.noAttributeName,Ce.noAttributeValueCalculator),priority:new Ce("task-priority","taskPriority",(r,e)=>Kr.priorityNameUsingNormal(e.priority).toLocaleLowerCase()),blockLink:new Ce("task-block-link",Ce.noAttributeName,Ce.noAttributeValueCalculator)};var P_=require("obsidian");function N_(r,e){return F(this,null,function*(){yield ri({originalTask:r,newTasks:e})})}var Uu=class extends P_.Menu{constructor(t){super();this.taskSaver=t}};var qu=class extends Uu{constructor(t,n,i=N_){super(i);this.statusRegistry=t;let s="Change status to:",a=(u,l,c,f)=>{let h=`${s} [${f}] ${c}`;l.setTitle(h).setChecked(f===u.status.symbol).onClick(()=>F(this,null,function*(){if(f!==u.status.symbol){let T=this.statusRegistry.bySymbol(f),y=u.handleNewStatusWithRecurrenceInUsersOrder(T);yield this.taskSaver(u,y)}}))},o=new Pe().coreStatuses.map(u=>u.symbol);for(let u of[!0,!1])for(let l of t.registeredStatuses)o.includes(l.symbol)===u&&this.addItem(c=>a(n,c,l.name,l.symbol))}};var Ma=new Lu,kn=class{static obsidianMarkdownRenderer(e,t,n,i){return F(this,null,function*(){if(!i)throw new Error("Must call the Obsidian renderer with an Obsidian Component object");yield I_.MarkdownRenderer.renderMarkdown(e,t,n,i)})}constructor({textRenderer:e=kn.obsidianMarkdownRenderer,obsidianComponent:t,parentUlElement:n,layoutOptions:i,queryLayoutOptions:s}){this.textRenderer=e,this.obsidianComponent=t,this.parentUlElement=n,this.layoutOptions=i,this.queryLayoutOptions=s}renderTaskLine(e,t,n){return F(this,null,function*(){let i=document.createElement("li");this.parentUlElement.appendChild(i),i.classList.add("task-list-item","plugin-tasks-list-item");let s=document.createElement("span");i.appendChild(s),s.classList.add("tasks-list-text"),yield this.taskToHtml(e,s,i);let a=document.createElement("input");return i.appendChild(a),a.classList.add("task-list-item-checkbox"),a.type="checkbox",e.status.symbol!==" "&&(a.checked=!0,i.classList.add("is-checked")),a.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),a.disabled=!0;let u=e.toggleWithRecurrenceInUsersOrder();ri({originalTask:e,newTasks:u})}),a.addEventListener("contextmenu",o=>{new qu(ve.getInstance(),e).showAtPosition({x:o.clientX,y:o.clientY})}),a.setAttribute("title","Right-click for options"),i.prepend(a),i.setAttribute("data-task",e.status.symbol.trim()),i.setAttribute("data-line",t.toString()),i.setAttribute("data-task-status-name",e.status.name),i.setAttribute("data-task-status-type",e.status.type),a.setAttribute("data-line",t.toString()),this.queryLayoutOptions.shortMode&&this.addTooltip(e,s,n),i})}taskToHtml(e,t,n){return F(this,null,function*(){let i=new hn(this.layo
`);if(T===void 0)return!1;let y=null;for(let D=0;D<T.length;D=D+1)if(T[D]!==""){y=T[D];break}return y===null?!1:ge.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 h=a.lineStart;h<=a.lineEnd;h++){let T=o[h];if(T===void 0)continue;let y=null,w=le.fromLine({line:T,taskLocation:new ct(s,h,a.lineStart,u,y),fallbackDate:null});w!==null&&(l.push(w),u++)}let c=new kn({obsidianComponent:n,parentUlElement:e,layoutOptions:new $n,queryLayoutOptions:new pn});for(let h=0;h<i.length;h++){let T=l[h],y=i[h];if(T===void 0||y===void 0)continue;let w=(f=y.getAttr("data-line"))!=null?f:"0",D=Number.parseInt(w,10),C=yield c.renderTaskLine(T,D),N=y.childNodes;for(let z=0;z<N.length;z=z+1){let ie=N[z];ie.nodeName.toLowerCase()==="div"?C.prepend(ie):ie.nodeName.toLowerCase()==="ul"&&C.append(ie)}let L=y.querySelectorAll("[data-footnote-id]"),oe=C.querySelectorAll("[data-footnote-id]");if(L.length===oe.length)for(let z=0;z<L.length;z++)oe[z].replaceWith(L[z]);y.replaceWith(C)}})}};var L_=require("@codemirror/view"),U_=require("obsidian");var q_=()=>L_.ViewPlugin.fromClass(Up),Up=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 h=`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(h),new U_.Notice(h,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=le.fromLine({line:a.text,taskLocation:ct.fromUnknownPosition(""),fallbackDate:null});if(o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(h=>h.toFileLineString()).join(i.lineBreak),c=i.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let f=t.checked;return setTimeout(()=>{t.checked=f},1),!0}};var pr=require("obsidian");function W_(r,e,t,n=void 0){let i="";e.isEmpty()||(i+=`Only tasks containing the global filter '${e.get()}'.
`);let s=new Ji(" "),a=new Jr(r,n);if(!a.ignoreGlobalQuery&&t.hasInstructions()){let o=t.query(n);i+=`Explanation of the global query:
${s.explainQuery(o)}
`}return i+=`Explanation of this Tasks code block query:
${s.explainQuery(a)}`,i}function $u(r,e,t){let n=new Jr(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}function $_(r){for(let t of le.allDateFields()){let n=r[t];if(n&&!n.isValid())return!1}let e=r.happensDates.some(t=>!!(t!=null&&t.isValid()));return!r.isDone&&e}function qp(r){return r.dueDate?"dueDate":r.scheduledDate?"scheduledDate":r.startDate?"startDate":null}function Y_(r,e,t,n){let i=r[e],s=new rt(i).postpone(t,n),a=ht.removeInferredStatusIfNeeded(r,[new le(it(we({},r),{[e]:s}))])[0];return{postponedDate:s,postponedTask:a}}function G_(r,e){let t=r==null?void 0:r.format("DD MMM YYYY");return`Task's ${e} postponed until ${t}`}function j_(r,e,t){return`\u2139\uFE0F ${Wp(r,e,t)} (right-click for more options)`}function Wp(r,e,t){function n(l){return l.charAt(0).toUpperCase()+l.slice(1)}let i=qp(r),s=r[i],o=new rt(s).postpone(t,e).format("ddd Do MMM"),u=e>1?e:"a";return s.isSameOrBefore(window.moment(),"day")?`${n(i.replace("Date",""))} in ${u} ${t}, on ${o}`:`Postpone ${i.replace("Date"," date")} by ${u} ${t}, to ${o}`}var Yu=class{constructor({plugin:e,events:t}){this.addQueryRenderChild=this._addQueryRenderChild.bind(this);this.app=e.app,this.events=t,e.registerMarkdownCodeBlockProcessor("tasks",this._addQueryRenderChild.bind(this))}_addQueryRenderChild(e,t,n){return F(this,null,function*(){n.addChild(new $p({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},$p=class extends pr.MarkdownRenderChild{constructor({app:t,events:n,container:i,source:s,filePath:a}){super(i);switch(this.app=t,this.events=n,this.source=s,this.filePath=a,this.containerEl.className){case"block-language-tasks":this.query=$u(this.source,tr.getInstance(),this.filePath),this.queryType="tasks";break;default:this.query=$u(this.source,tr.getInstance(),this.filePath),this.queryType="tasks";break}}onload(){this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.renderEventRef=this.events.onCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()}onunload(){this.renderEventRef!==void 0&&this.events.off(this.renderEventRef),this.queryReloadTimeout!==void 0&&clearTimeout(this.queryReloadTimeout)}reloadQueryAtMidnight(){let t=new Date;t.setHours(24,0,0,0);let n=new Date,i=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=$u(this.source,tr.getInstance(),this.filePath),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},i+1e3)}render(i){return F(this,arguments,function*({tasks:t,state:n}){var a;let s=this.containerEl.createEl("div");n==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,n,s):this.query.error!==void 0?this.renderErrorMessage(s,this.query.error):this.renderLoadingMessage(s),(a=this.containerEl.firstChild)==null||a.replaceWith(s)})}renderQuerySearchResults(t,n,i){return F(this,null,function*(){this.query.debug(`[render] Render called: plugin state: ${n}; searching ${t.length} tasks`),this.query.queryLayoutOptions.explainQuery&&this.createExplanation(i);let s=this.query.applyQueryToTasks(t);if(s.searchErrorMessage!==void 0){this.renderErrorMessage(i,s.searchErrorMessage);return}yield this.addAllTaskGroups(s.taskGroups,i);let a=s.totalTasksCount;this.addTaskCount(i,s),this.query.debug(`[render] ${a} tasks displayed`)})}renderErrorMessage(t,n){t.createDiv().innerHTML=`<pre>Tasks query: ${n.replace(/\n/g,"<br>")}</pre>`}renderLoadingMessage(t){t.setText("Loading Tasks ...")}createExplanation(t){let n=W_(this.source,ge.getInstance(),tr.getInstance(),this.filePath),i=t.createEl("pre");i.addClasses(["plugin-tasks-query-explanation"]),i.setText(n),t.appendChild(i)}createTaskList(t,n){return F(this,null,function*(){let i=new hn(this.query.layoutOptions,this.query.queryLayoutOptions),s=n.createEl("ul");s.addClasses(["contains-task-list","plugin-tasks-query-result"]),s.addClasses(i.taskListHiddenClasses);let a=this.getGroupingAttribute();a&&a.length>0&&(s.dataset.taskGroupBy=a);let o=new kn({obsidianComponent:this,parentUlElement:s,layoutOptions:this.query.layoutOptions,queryLayoutOptions:this.query.queryLayoutO
`,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}
`)}makeRowText(e){let t="|";return e.forEach(n=>{t+=` ${n} |`}),t}};function B_(r,e){return r.findIndex(t=>t.symbol===e)}function XA(r,e){let t=X.getTypeForUnknownSymbol(r.symbol);r.type!==t&&(t==="TODO"&&r.symbol!==" "||e.push(`For information, the conventional type for status symbol ${Rr(r.symbol)} is ${Rr(t)}: you may wish to review this type.`))}function ZA(r,e,t){let n=B_(r,e.nextStatusSymbol);if(n===-1){t.push(`Next symbol ${Rr(e.nextStatusSymbol)} is unknown: create a status with symbol ${Rr(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 ${Rr(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 JA(r,e,t){let n=[];return e.symbol===X.EMPTY.symbol?(n.push("Empty symbol: this status will be ignored."),n):B_(r,e.symbol)!=t?(n.push(`Duplicate symbol '${Rr(e.symbol)}': this status will be ignored.`),n):(XA(e,n),ZA(r,e,n),n)}function H_(r){let e=new Gu(["Status Symbol","Next Status Symbol","Status Name","Status Type","Problems (if any)"]),t=Pe.allStatuses(r);return t.forEach((n,i)=>{e.addRow([Rr(n.symbol),Rr(n.nextStatusSymbol),n.name,Rr(n.type),JA(t,n,i).join("<br>")])}),e.markdown}function z_(r,e,t,n){let s=H_(r),a=e.mermaidDiagram(!0);return`# ${t}
## 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.
${s}
## Loaded Settings
<!-- Switch to Live Preview or Reading Mode to see the diagram. -->
These are the settings actually used by Tasks.
${a}`}function Rr(r){return r===""?r:"`"+(r!==" "?r:"space")+"`"}function V_(){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 K_(){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 Q_(){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 X_(){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 Z_(){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 J_(){return[[" ","to-do","x","TODO"],["/","incomplete","x","IN_PROGRESS"],["x","done"," ","DONE"],["-","canceled"," ","CANCELLED"],[">","forwarded","x","TODO"],["<","scheduling","x","TODO"],["?","question","x","TODO"],["!","important","x","TODO"],["*","star","x","TODO"],['"',"quote","x","TODO"],["l","location","x","TODO"],["b","bookmark","x","TODO"],["i","information","x","TODO"],["S","savings","x","TODO"],["I","idea","x","TODO"],["p","pros","x","TODO"],["c","cons","x","TODO"],["f","fire","x","TODO"],["k","key","x","TODO"],["w","win","
`)+`
Fix errors before saving.`;new hr.Notice(f);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?$t.removeValidationError(t):$t.setValidationError(t)}};var Yt=class extends be.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 F(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("h3",{text:"Tasks Settings"}),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),t.createEl("h4",{text:"Task Format Settings"}),new be.Setting(t).setName("Task Format").setDesc(Yt.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(i=>{for(let s of Object.keys(Hr))i.addOption(s,Hr[s].displayName);i.setValue(Q().taskFormat).onChange(s=>F(this,null,function*(){tt({taskFormat:s}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new be.Setting(t).setName("Global task filter").setDesc(Yt.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(i=>{i.setPlaceholder("e.g. #task or TODO").setValue(ge.getInstance().get()).onChange(s=>F(this,null,function*(){tt({globalFilter:s}),ge.getInstance().set(s),yield this.plugin.saveSettings()}))}),new be.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(i=>{let s=Q();i.setValue(s.removeGlobalFilter).onChange(a=>F(this,null,function*(){tt({removeGlobalFilter:a}),ge.getInstance().setRemoveGlobalFilter(a),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),nP(new be.Setting(t).setDesc(Yt.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(i=>{let s=Q();i.inputEl.rows=4,i.setPlaceholder(`# For example...
path does not include _templates/
limit 300
show urgency`).setValue(s.globalQuery).onChange(a=>F(this,null,function*(){tt({globalQuery:a}),tr.getInstance().set(a),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=Q();tv.forEach(i=>{this.addOneSettingsBlock(t,i,n)}),t.createEl("h4",{text:"Date Settings"}),new be.Setting(t).setName("Set created date on every added task").setDesc(Yt.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(i=>{let s=Q();i.setValue(s.setCreatedDate).onChange(a=>F(this,null,function*(){tt({setCreatedDate:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Set done date on every completed task").setDesc(Yt.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(i=>{let s=Q();i.setValue(s.setDoneDate).onChange(a=>F(this,null,function*(){tt({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(Yt.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>The date in the file name must be in one of <code>YYYY-MM-DD</code> or <code>YYYYMMDD</code> 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(i=>{let s=Q();i.setValue(s.useFilenameAsScheduledDate).onChange(a=>F(this,null,function*(){tt({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new be.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(i=>F(this,null,function*(){let s=Q();yield this.plugin.saveSettings(),i.setValue(Yt.renderFolderArray(s.filenameAsDateFolders)).onChange(a=>F(this,null,function*(){let o=Yt.parseCommaSeparatedFolders(a);tt({filenameAsDateFolders:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new be.Setting(t).setName("Next recurrence appears on the line below").setDesc(Yt.createFragmentWithHTML('Enabling this will make the next recurrence of a task appear on the line below the completed task. Otherwise the next recurrence will appear before the completed one.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks">documentation</a>.</p>')).addToggle(i=>{let{recurrenceOnNextLine:s}=Q();i.setValue(s).onChange(a=>F(this,null,function*(){tt({recurrenceOnNextLine:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new be.Setting(t).setName("Auto-suggest task content").setDesc(Yt.createFragmentWithHTML('Enabling this will open an intelligent suggest menu while typing inside a recognized task line.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Auto-Suggest">documentation</a>.</p>')).addToggle(i=>{let s=Q();i.setValue(s.autoSuggestInEditor).onChange(a=>F(this,null,function*(){tt({autoSuggestInEditor:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Minimum match length for auto-suggest").setDesc("If higher than 0, auto-suggest will be triggered only when the beginning of any supported keywords is recognized.").addSlider(i=>{let s=Q();i.setLimits(0,3,1).setValue(s.autoSuggestMinMatch).setDynamicTooltip().onChange(a=>F(this,null,function*(){tt({autoSuggestMinMatch:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Maximum
`);t(o)}).open(),n};var sv=(r,e)=>{let t=Zo({line:"",path:""});return new gn({app:r,task:t,onSubmit:e})};var av=r=>({createTaskLineModal:()=>iv(r,sv)});var Bu=class extends ov.Plugin{get apiV1(){return av(app)}onload(){return F(this,null,function*(){St.registerConsoleLogger(),np("info",`loading plugin "${this.manifest.name}" v${this.manifest.version}`),yield this.loadSettings();let{loggingOptions:t}=Q();St.configure(t),this.addSettingTab(new Ca({plugin:this})),x_({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let n=new Pu({obsidianEvents:this.app.workspace});this.cache=new Bn({metadataCache:this.app.metadataCache,vault:this.app.vault,events:n}),this.inlineRenderer=new Wu({plugin:this}),this.queryRenderer=new Yu({plugin:this,events:n}),this.registerEditorExtension(q_()),this.registerEditorSuggest(new ju(this.app,Q())),new Jo({plugin:this})})}loadTaskStatuses(){return F(this,null,function*(){let{statusSettings:t}=Q();Pe.applyToStatusRegistry(t,ve.getInstance())})}onunload(){var t;np("info",`unloading plugin "${this.manifest.name}" v${this.manifest.version}`),(t=this.cache)==null||t.unload()}loadSettings(){return F(this,null,function*(){let t=yield this.loadData();tt(t),t=Q(),ge.getInstance().set(t.globalFilter),ge.getInstance().setRemoveGlobalFilter(t.removeGlobalFilter),tr.getInstance().set(t.globalQuery),yield this.loadTaskStatuses()})}saveSettings(){return F(this,null,function*(){yield this.saveData(Q())})}getTasks(){var t;return(t=this.cache)==null?void 0:t.getTasks()}};
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
*
* Copyright (c) 2013 hij1nx
* Licensed under the MIT license.
*/
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/