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

344 lines
407 KiB

2 years ago
/*
3 years ago
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
3 years ago
if you want to view the source visit the plugins github repository
*/
/*
License obsidian-tasks:
MIT License
Copyright (c) 2021 Martin Schenck and Clare Macrae
3 years ago
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
License rrule (included library):
rrule.js: Library for working with recurrence rules for calendar dates.
=======================================================================
Copyright 2010, Jakub Roztocil <jakub@roztocil.name> and Lars Schöning
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of The author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
./rrule.js and ./test/tests.js is based on python-dateutil. LICENCE:
python-dateutil - Extensions to the standard Python datetime module.
====================================================================
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
License chrono-node (included library):
The MIT License
Copyright (c) 2014, Wanasit Tanakitrungruang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
11 months ago
"use strict";var av=Object.create;var ss=Object.defineProperty,ov=Object.defineProperties,uv=Object.getOwnPropertyDescriptor,lv=Object.getOwnPropertyDescriptors,cv=Object.getOwnPropertyNames,eh=Object.getOwnPropertySymbols,dv=Object.getPrototypeOf,rh=Object.prototype.hasOwnProperty,fv=Object.prototype.propertyIsEnumerable;var th=(r,e,t)=>e in r?ss(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,we=(r,e)=>{for(var t in e||(e={}))rh.call(e,t)&&th(r,t,e[t]);if(eh)for(var t of eh(e))fv.call(e,t)&&th(r,t,e[t]);return r},it=(r,e)=>ov(r,lv(e));var _=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),pv=(r,e)=>{for(var t in e)ss(r,t,{get:e[t],enumerable:!0})},nh=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cv(e))!rh.call(r,i)&&i!==t&&ss(r,i,{get:()=>e[i],enumerable:!(n=uv(e,i))||n.enumerable});return r};var as=(r,e,t)=>(t=r!=null?av(dv(r)):{},nh(e||!r||!r.__esModule?ss(t,"default",{value:r,enumerable:!0}):t,r)),hv=r=>nh(ss({},"__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 Tv(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}rn.repeatedTimeunitPattern=Tv;function ih(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}rn.extractTerms=ih;function bv(r){return`(?:${ih(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}rn.matchAnyPattern=bv});var ye=_((Vu,Ku)=>{(function(r,e){typeof Vu=="object"&&typeof Ku!="undefined"?Ku.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(Vu,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},j=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)},G=N;G.l=ie,G.i=z,G.w=function(B,A){return j(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(G.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(zM).filter(function(t){return t!==null});return lt(lt({},e[0]),e[1])}function fa(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=ua(i),e}function zM(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return VT(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return VT(r);case"DTSTART":return fa(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function VT(r){var e=r.replace(/^RRULE:/i,""),t=fa(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=VM(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=KM(o);break;case"DTSTART":case"TZID":var c=fa(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=ua(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function VM(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(KT)}return KT(r)}function KT(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function KM(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 Ge(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=Oi(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:WT(this.date,this.tzid)},r}();function ha(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(da),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 Ge(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=PT(o).map(function(T){return T instanceof Ge?T:ut(T)?new Ge(T[0],T[1]):new Ge(T)}).toString();break;case"DTSTART":t=QM(o,r.tzid);break;case"UNTIL":u=Oi(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 QM(r,e){return r?"DTSTART"+new Wn(new Date(r),e).toString():""}function XM(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 QT=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?Uo(t):$f(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(!XM(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)?$f(n):n instanceof Date?Uo(n):n},r}();var XT=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),ZT=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),ZM=Xt(1,29),JM=Xt(1,30),cn=Xt(1,31),ft=Xt(1,32),JT=M(M(M(M(M(M(M(M(M(M(M(M(M([],ft,!0),JM,!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),eb=M(M(M(M(M(M(M(M(M(M(M(M(M([],ft,!0),ZM,!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),eC=Xt(-28,0),tC=Xt(-29,0),dn=Xt(-30,0),pt=Xt(-31,0),tb=M(M(M(M(M(M(M(M(M(M(M(M(M([],pt,!0),tC,!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),rb=M(M(M(M(M(M(M(M(M(M(M(M(M([],pt,!0),eC,!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),nb=[0,31,60,91,121,152,182,213,244,274,305,335,366],ib=[0,31,59,90,120,151,181,212,243,273,304,334,365],Bf=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Xt(7));return r}();function sb(r,e){var t=vr(r,1,1),n=Si(r)?366:365,i=Si(r+1)?366:365,s=oa(t),a=qr(t),o=lt(lt({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},rC(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=qr(vr(r-1,1,1)),oe=dt(7-L.valueOf()+e.wkst,7),z=Si(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 rC(r){var e=Si(r)?366:365,t=vr(r,1,1),n=qr(t);return e===365?{mmask:XT,mdaymask:eb,nmdaymask:rb,wdaymask:Bf.slice(n),mrange:ib}:{mmask:ZT,mdaymask:JT,nmdaymask:tb,wdaymask:Bf.slice(n),mrange:nb}}function ab(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 ob(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 pC(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function pb(r,e){return pC(e),r.split(",").map(function(t){return ua(t)})}function hb(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 zf=function(r){Di(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=hb.apply(n,["dtstart"]),n.tzid=hb.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return db(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){mb(t,this._rrule)},e.prototype.exrule=function(t){mb(t,this._exrule)},e.prototype.rdate=function(t){gb(t,this._rdate)},e.prototype.exdate=function(t){gb(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return qo(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return qo(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(ha({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
2 years ago
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
11 months ago
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(yb("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(yb("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 mb(r,e){if(!(r instanceof $))throw new TypeError(String(r)+" is not RRule instance");fe(e.map(String),String(r))||e.push(r)}function gb(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 yb(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return Oi(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}function Gr(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||Gr(this.startDate,e.startDate)!==0||Gr(this.scheduledDate,e.scheduledDate)!==0||Gr(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 hC(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=Qf(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 mC(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=Qf(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(ki(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 gC(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=Qf(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 Qf(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 yC(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 bb(r,e){return(t,n,i)=>yC(t.slice
\`\`\`${n}
flowchart LR
1 year ago
classDef TODO stroke:#f33,stroke-width:3px;
classDef DONE stroke:#0c0,stroke-width:3px;
classDef IN_PROGRESS stroke:#fa0,stroke-width:3px;
classDef CANCELLED stroke:#ddd,stroke-width:3px;
classDef NON_TASK stroke:#99e,stroke-width:3px;
${i.join(`
`)}
${s.join(`
`)}
1 year ago
linkStyle default stroke:gray
\`\`\`
11 months ago
`}getMermaidNodeLabel(e,t){let n=Sb(e.name),i=e.type;if(t){let s=Go(e.symbol),a=Go(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 Ob=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 Ob.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 Mi=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!==null?e[1]:""}get filenameWithoutExtension(){return this.withoutExtension(this.filename)}};var Kr=class{static priorityNameUsingNone(e){let t="ERROR";switch(e){case"1":t="High";break;case"0":t=
`),o=a.length,u=new ya(()=>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=Gn.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,Gn.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}
1 year ago
Task line: ${i}
Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.
Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'
The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.
11 months ago
`;this.logger.error(s),e instanceof Error&&this.logger.error(e.stack?e.stack:"Cannot determine stack"),this.state==="Initializing"&&new Ci.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 fp=require("obsidian");var Vb=require("obsidian");function Qr(){}function ip(r){return r()}function Cb(){return Object.create(null)}function Hn(r){r.forEach(ip)}function zo(r){return typeof r=="function"}function Pb(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Nb(r){return Object.keys(r).length===0}var Ib=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,ba=class{constructor(e){this.options=e,this._listeners="WeakMap"in Ib?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)ba.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};ba.entries="WeakMap"in Ib?new WeakMap:void 0;var Fb=!1;function wC(){Fb=!0}function EC(){Fb=!1}function R(r,e){r.appendChild(e)}function Ii(r,e,t){r.insertBefore(e,t||null)}function zn(r){r.parentNode&&r.parentNode.removeChild(r)}function sp(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 kC(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 Lb(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 Ub(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 SC(r){return Array.from(r.childNodes)}function ap(r,e){e=""+e,r.data!==e&&(r.data=e)}function cr(r,e){r.value=e==null?"":e}function op(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 Wb(r){let e=r.querySelector(":checked");return e&&e.__value}function dr(r,e,t){r.classList[t?"add":"remove"](e)}var Bn=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=kC(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)Ii(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(zn)}};var _a;function Ta(r){_a=r}function OC(){if(!_a)throw new Error("Function called outside component initialization");return _a}function up(r){OC().$$.on_mount.push(r)}var Pi=[];var Vo=[],Ni=[],Ab=[],DC=Promise.resolve(),np=!1;function xC(){np||(np=!0,DC.then(qb))}function va(r){Ni.push(r)}var rp=new Set,Ai=0;function qb(){if(Ai!==0)return;let r=_a;do{try{for(;Ai<Pi.length;){let e=Pi[Ai];Ai++,Ta(e),RC(e.$$)}}catch(e){throw Pi.length=0,Ai=0,e}for(Ta(null),Pi.length=0,Ai=0;Vo.length;)Vo.pop()();for(let e=0;e<Ni.length;e+=1){let t=Ni[e];rp.has(t)||(rp.add(t),t())}Ni.length=0}while(Pi.length);for(;Ab.length;)Ab.pop()();np=!1,rp.clear(),Ta(r)}function RC(r){if(r.fragment!==null){r.update(),Hn(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(va)}}function MC(r){let e=[],t=[];Ni.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Ni=e}var CC=new Set;function AC(r,e){r&&r.i&&(CC.delete(r),r.i(e))}var PC=["allowfullscreen","allowpaymentre
<span class="accesskey-first">future</span> dates:`,$p=pe(),mr=K("input"),Yp=pe(),ii=K("div"),Aa=K("label"),Aa.innerHTML='Stat<span class="accesskey">u</span>s',jp=pe(),jt=K("select");for(let Y=0;Y<vt.length;Y+=1)vt[Y].c();Gp=pe(),en=K("div"),es=K("div"),Na=K("label"),Na.textContent="Completed:",Bp=pe(),tn=K("input"),Hp=pe(),ts=K("div"),Gu=K("span"),Gu.textContent="Created on:",zp=pe(),Fa=K("code"),Vp=pe(),rs=K("div"),Bu=K("span"),Bu.textContent="Done on:",Kp=pe(),La=K("code"),Qp=pe(),si=K("div"),kn=K("button"),Xp=mt("Apply"),Zp=pe(),ns=K("button"),ns.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]),G.a=null,U(Le,"for","due"),U(Le,"class","accesskey-first"),U(A,"id","due"),U(A,"type","text"),U(A,"placeholder",lp),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",lp),U(v,"accesskey",k=r[15]("s")),dr(v,"tasks-modal-error",!r[5]),me.a=null,U(te,"for","start"),U(W,"id","start"),U(W,"type","text"),U(W,"placeholder",lp),U(W,"accesskey",Re=r[15]("a")),dr(W,"tasks-modal-error",!r[3]),Ue.a=null,U(Ma,"for","forwardOnly"),U(mr,"id","forwardOnly"),U(mr,"type","checkbox"),U(mr,"class","task-list-item-checkbox tasks-modal-checkbox"),U(mr,"accesskey",Ca=r[15]("f")),U(w,"class","tasks-modal-section tasks-modal-dates"),U(Aa,"for","status"),U(jt,"id","status-type"),U(jt,"class","dropdown"),U(jt,"accesskey",Pa=r[15]("u")),r[1].status===void 0&&va(()=>r[39].call(jt)),U(ii,"class","tasks-modal-section"),U(Na,"for","status"),U(tn,"id","status"),U(tn,"type","checkbox"),U(tn,"class","task-list-item-checkbox tasks-modal-checkbox"),tn.checked=Ia=r[1].status.isCompleted(),tn.disabled=!0,U(en,"class","tasks-modal-section tasks-modal-status"),kn.disabled=Ua=!r[14],U(kn,"type","submit"),U(kn,"class","mod-cta"),U(ns,"type","button"),U(si,"class","tasks-modal-section tasks-modal-buttons"),dr(t,"with-accesskeys",r[9]),U(e,"class","tasks-modal")},m(Y,he){Ii(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,j),G.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,W),cr(W,r[1].startDate),R(w,Ae),R(w,nt),R(nt,Mr),R(nt,qe),Ue.m(r[2],nt),R(w,qp),R(w,Ji),R(Ji,Ma),R(Ji,$p),R(Ji,mr),mr.checked=r[1].forwardOnly,R(t,Yp),R(t,ii),R(ii,Aa),R(ii,jp),R(ii,jt);for(let de=0;de<vt.length;de+=1)vt[de]&&vt[de].m(jt,null);op(jt,r[1].status,!0),R(t,Gp),R(t,en),R(en,es),R(es,Na),R(es,Bp),R(es,tn),R(en,Hp),R(en,ts),R(ts,Gu),R(ts,zp),R(ts,Fa),Fa.innerHTML=r[11],R(en,Vp),R(en,rs),R(rs,Bu),R(rs,Kp),R(rs,La),La.innerHTML=r[13],R(t,Qp),R(t,si),R(si,kn),R(kn,Xp),R(si,Zp),R(si,ns),Hu||(Jp=[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(W,"input",r[37]),Ot(mr,"change",r[38]),Ot(jt,"change",r[39]),Ot(ns,"click",r[22]),Ot(t,"submit",Lb(r[25]))],Hu=!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){ai=Y[20];let de;for(de=0;de<ai.length;de+=1){let is=Gb(Y,ai,de);_t[de]?_t[de].p(is,he):(_t[de]=Bb(is),_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 mn({app:n,task:u,onSubmit:l}).open()};var pp=require("obsidian");var Qb=(r,e,t)=>{var u;if(r)return t instanceof pp.MarkdownView;if(!(t instanceof pp.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=YC(a,n);e.setLine(s,o.text),e.setCursor(jC(i,o))},YC=(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}}}}},jC=(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 Xo=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)=>Kb(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Qb})}};var GC=Object.prototype.toString,Li=Array.isArray||function(e){return GC.call(e)==="[object Array]"};function mp(r){return typeof r=="function"}function BC(r){return Li(r)?"array":typeof r}function hp(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Xb(r,e){return r!=null&&typeof r=="object"&&e in r}function HC(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var zC=RegExp.prototype.test;function VC(r,e){return zC.call(r,e)}var KC=/\S/;function QC(r){return!VC(KC,r)}var XC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function ZC(r){return String(r).replace(/[&<>"'`=\/]/g,function(t){return XC[t]})}var JC=/\s*/,eA=/\s+/,Zb=/\s*=/,tA=/\s*\}/,rA=/#|\^|\/|>|\{|&|=|!/;function nA(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(G){if(typeof G=="string"&&(G=G.split(eA,2)),!Li(G)||G.length!==2)throw new Error("Invalid tags: "+G);f=new RegExp(hp(G[0])+"\\s*"),h=new RegExp("\\s*"+hp(G[1])),T=new RegExp("\\s*"+hp("}"+G[1]))}y(e||Jt.tags);for(var w=new Ea(r),D,C,N,L,oe,z;!w.eos();){if(D=w.pos,N=w.scanUntil(f),N)for(var ie=0,j=N.length;ie<j;++ie)L=N.charAt(ie),QC(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(rA)||"name",w.scan(JC),C==="="?(N=w.scanUntil(Zb),w.scan(Zb),w.scanUntil(h)):C==="{"?(N=w.scanUntil(T),w.scan(tA),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 sA(iA(i))}function iA(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 sA(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 Ea(r){this.string=r,this.tail=r,this.pos=0}Ea.prototype.eos=function(){return this.tail===""};Ea.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};Ea.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 Fi(r,e){this.view=r,this.cache={".":this.view},this.parent=e}Fi.prototype.push=function(e){return new Fi(e,this)};Fi.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=Xb(s,a[o])||HC(s,a[o])),s=s[a[o++]];else s=i.view[e],u=Xb(i.view,e);if(u){n=s;break}i=i.parent}t[e]=n}return mp(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=nA(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 Fi?t:new Fi(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(Li(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(mp(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||Li(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(`
1 year ago
`),a=0;a<s.length;a++)s[a].length&&(a>0||!n)&&(s[a]=i+s[a]);return s.join(`
11 months ago
`)};Dt.prototype.renderPartial=function(e,t,n,i){if(!!n){var s=this.getConfigTags(i),a=mp(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 Li(e)?e:e&&typeof e=="object"?e.tags:void 0};Dt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Li(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){wa.templateCache=r},get templateCache(){return wa.templateCache}},wa=new Dt;Jt.clearCache=function(){return wa.clearCache()};Jt.parse=function(e,t){return wa.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 "'+BC(e)+'" was given as the first argument for mustache#render(template, view, partials)');return wa.render(e,t,n,i)};Jt.escape=ZC;Jt.Scanner=Ea;Jt.Context=Fi;Jt.Writer=Dt;var gp=Jt;var n_=as(r_());function i_(r,e){gp.escape=function(t){return t};try{return gp.render(r,(0,n_.default)(e))}catch(t){let n="";throw t instanceof Error?n=`There was an error expanding one or more placeholders.
1 year ago
The error message was:
${t.message.replace(/ > /g,".").replace("Missing Mustache data property","Unknown property")}`:n="Unknown error expanding placeholders.",n+=`
The problem is in:
11 months ago
${r}`,Error(n)}}function Zo(r){return{query:{file:new Mi(r)}}}function Vn(r,e){let t=`Error: ${r}.
1 year ago
The error message was:
11 months ago
`,n="";return e instanceof Error?n+=e:n+="Unknown error",`${t}"${n}"`}var Xr=class{constructor(e,t,n){this.property=e,this.comparator=Xr.maybeReverse(n,t)}static maybeReverse(e,t){return e?Xr.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var gn=class{constructor(e,t,n){this.property=e,this.grouper=t,this.reverse=n}};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 $o(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")}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new Xr(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")}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(e){return new gn(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}
2 years ago
`:`${e}${this.instruction} =>
${t.asString(" ")}
11 months ago
`}};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 Jo=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 Jo(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 yn=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 yn{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 eu=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
11 months ago
`}};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)=>Gr(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 eu().findUnexpandedDateText(t)}};var Ui=class extends yt{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}};var Tp=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 Tp.priorityRegexp}supportsSorting(){return!0}comparator(){return(e,t)=>e.priority.localeCompare(t.priority)}supportsGrouping(){return!0}grouper(){return e=>[e.priority
1 year ago
Regular expressions must look like this:
/pattern/
or this:
/pattern/flags
Where:
- pattern: The 'regular expression' pattern to search for.
- flags: Optional characters that modify the search.
i => make the search case-insensitive
u => add Unicode support
Examples: /^Log/
/^Log/i
/File Name\.md/
/waiting|waits|waited/i
/\d\d:\d\d/
The following characters have special meaning in the pattern:
to find them literally, you must add a \ before them:
[\^$.|?*+()
CAUTION! Regular expression (or 'regex') searching is a powerful
but advanced feature that requires thorough knowledge in order to
use successfully, and not miss intended search results.
11 months ago
`}explanation(t){let i=aA(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 aA(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 qi(i);else if(n.includes("regex")){try{s=Tn.validateAndConstruct(i)}catch(u){let l=Vn("Parsing regular expression",u)+`
1 year ago
11 months ago
${Tn.helpMessage()}`;return J.fromError(e,l)}if(s===null)return J.fromError(e,`Invalid instruction: '${e}'
1 year ago
11 months ago
${Tn.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 $i=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 Yi=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)}};var ji=class{static by(e,t){let n=[new Yi().comparator(),new Sr().comparator(),new Ui().comparator(),new Kn().comparator(),new $i().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 tu=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var ru=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 tu(n,i,this.groupers[n].property));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var nu=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 iu=class extends nu{},su=class{constructor(e,t,n){this.root=new iu(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 iu([]),a.children.set(l,c),s.push(c)),c.values.push(o)}}n=s}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var au=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()+`
2 years ago
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
1 year ago
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName}
11 months ago
`;return e+=this.tasksAsStringOfLines(),e}};var Gi=class{constructor(e,t,n){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let s=new su(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):
1 year ago
`;for(let n of this._groupers){let i=n.reverse?" reverse":"";e+=`- ${n.property}${i}
1 year ago
`}for(let n of this.groups)e+=n.toString(),e+=`
2 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
11 months ago
`,e}addTaskGroups(e){for(let[t,n]of e){let i=new au(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 ru(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 Qn=class extends Me{fieldName(){return"description"}value(e){return ge.getInstance().removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Qn.cleanDescription(e.description),i=Qn.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 ou=class extends yt{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var uu=class extends yt{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var lu=class extends yn{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 ka=class extends Er{};function bp(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?ka.fromObject(e,i):ka.fromError(e,"Error parsing group function")}catch(n){return ka.fromError(e,Vn(`Failed parsing expression "${e}"`,n))}}function _p(r,e){let t=e.map(([n,i])=>i);return r(...t)}function vp(r,e,t){try{return _p(r,e)}catch(n){return Vn(`Failed calculating expression "${t}"`,n)}}function cu(r,e){return[["task",r],["query",e?e.query:null]]}function s_(r,e,t){let n=cu(r,t||null),i=bp(n,e);return i.error?i.error:vp(i.queryComponent,n,e)}var du=class{constructor(e){this.line=e,this.functionOrError=bp(cu(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 _p(this.functionOrError.queryComponent,cu(e,t||null))}evaluateOrCatch(e,t){return this.isValid()?vp(this.functionOrError.queryComponent,cu(e,t),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};var fu=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 du(n);return i.isValid()?J.fromFilter(new gt(e,oA(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 gn("function",lA(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 oA(r){return(e,t)=>{let n=t.queryContext();return uA(r,e,n)}}function
2 years ago
Allowed options: 'is' and 'is not' (without quotes).
Allowed values: ${t}
Note: values are case-insensitive,
so 'in_progress' works too, for example.
11 months ago
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=bn.groupName(e),i=bn.groupName(t);return n.localeCompare(i,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[bn.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var Du=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 xu=class extends Me{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(this.value(e))]}};var Ru=class extends Me{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(this.value(e))]}};var Mu=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 Cp=[()=>new Ou,()=>new bn,()=>new Sr,()=>new yu,()=>new Kn,()=>new gu,()=>new ou,()=>new mu,()=>new hu,()=>new Ui,()=>new uu,()=>new $i,()=>new xu,()=>new Ru,()=>new Mu,()=>new Qn,()=>new Xn,()=>new pu,()=>new lu,()=>new Su,()=>new Yi,()=>new Du,()=>new fu,()=>new Eu];function ku(r){for(let e of Cp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function __(r){let e=/^sort by /i;if(r.match(e)===null)return null;for(let t of Cp){let i=t().createSorterFromLine(r);if(i)return i}return null}function v_(r){let e=/^group by /i;if(r.match(e)===null)return null;for(let t of Cp){let i=t().createGrouperFromLine(r);if(i)return i}return null}var _n=class{constructor(e,t){this.queryPath=e,this.allTasks=[...t]}static fromAllTasks(e){return new _n(void 0,e)}queryContext(){return this.queryPath?Zo(this.queryPath):void 0}};function w_(r){return`task${r!==1?"s":""}`}var ei=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} ${w_(e)}`:`${e} of ${t} ${w_(t)}`}get groups(){return this.taskGroups.groups}static fromError(e){let t=new ei(new Gi([],[],_n.fromAllTasks([])),0);return t._searchErrorMessage=e,t}};function E_(r){return r.endsWith("\\")}function k_(r){return r.endsWith("\\\\")}function LA(r){return r.replace(/^[ \t]*/,"")}function UA(r){return r.replace(/[ \t]*\\$/,"")}function WA(r,e){let t=r;return e&&(t=LA(r)),k_(t)?t=t.slice(0,-1):E_(r)&&(t=UA(t)),t}function qA(r,e,t){e?r[r.length-1]+=" "+t:r.push(t)}function $A(r){let e=[],t=!1;for(let n of r.split(`
`)){let i=WA(n,t);qA(e,t,i),k_(n)?t=!1:t=E_(n)}return e.join(`
`)}function S_(r){return $A(r).split(`
`).map(e=>e.trim()).filter(e=>e!=="")}var Jr=class{constructor(e,t=void 0){this._limit=void 0;this._taskGroupLimit=void 0;this._layoutOptions=new qn;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.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()}`),S_(e).forEach(n=>{let i=this.expandPlaceholders(n,t);if(this.error===void 0)switch(!0){case this.shortModeRegexp.test(i):this._layoutOptions.shortMode=!0;break;case this.explainQueryRegexp.test(i):this._layoutOptions.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(`
1 year ago
`).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 "}}"
1 year ago
but no file path has been supplied, so cannot expand placeholder values.
The query is:
11 months ago
${e}`,e;let n=e;if(t){let i=Zo(t);try{n=i_(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}
1 year ago
${e.source}`,this.filePath)}explainQuery(){let e="";if(this.error!==void 0)return e+=`Query has an error:
1 year ago
`,e+=this.error+`
`,e;let t=this.filters.length;if(t===0)e+="No filters supplied. All tasks will match the query.";else for(let i=0;i<t;i++)i>0&&(e+=`
1 year ago
`),e+=this.filters[i].explainFilterIndented("");e+=this.explainQueryLimits();let{debugSettings:n}=Q();return n.ignoreSortInstructions&&(e+=`
2 years ago
1 year ago
NOTE: All sort instructions, including default sort order, are disabled, due to 'ignoreSortInstructions' setting.`),e}explainQueryLimits(){let e="";function t(n){let i=`
2 years ago
1 year ago
At most ${n} task`;return n!==1&&(i+="s"),i}return this._limit!==void 0&&(e+=t(this._limit),e+=`.
1 year ago
`),this._taskGroupLimit!==void 0&&(e+=t(this._taskGroupLimit),e+=` per group (if any "group by" options are supplied).
1 year ago
`),e}get limit(){return this._limit}get layoutOptions(){return this._layoutOptions}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}
11 months ago
Problem line: "${t}"`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){this.debug(`Executing query: ${this.formatQueryForLogging()}`);let t=new _n(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 Gi(this.grouping,s,t);return this._taskGroupLimit!==void 0&&a.applyTaskLimit(this._taskGroupLimit),new ei(a,i.length)}catch(n){let i="Search failed";return ei.fromError(Vn(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._layoutOptions.hideTaskCount=n;break;case"backlink":this._layoutOptions.hideBacklinks=n;break;case"postpone button":this._layoutOptions.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._layoutOptions.hideEditButton=n;break;case"urgency":this._layoutOptions.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=ku(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=__(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=v_(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 vn=class{constructor(e=vn.empty){this._source=e}static getInstance(){return vn.instance||(vn.instance=new vn),vn.instance}set(e){this._source=e}query(e=void 0){return new Jr(this._source,e)}hasInstructions(){return this._source.trim()!==vn.empty}},tr=vn;tr.empty="";var Cu=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 Da=require("obsidian");var Oa,Ap,Pp,YA=["md"];function Nu(){return St.getLogger("tasks.File")}var O_=({metadataCache:r,vault:e,workspace:t})=>{Oa=r,Ap=e,Pp=t},ti=t=>F(void 0,[t],function*({originalTask:r,newTasks:e}){if(Ap===void 0||Oa===void 0||Pp===void 0){Au("Tasks: cannot use File before initializing it.");return}Array.isArray(e)||(e=[e]);let n=Nu(),i="replaceTaskWithTasks()";Bo(n,i,r),Ho(n,i,e),x_({originalTask:r,newTasks:e,vault:Ap,metadataCache:Oa,workspace:Pp,previousTries:0})});function Au(r){console.error(r),new Da.Notice(r,15e3)}function D_(r){console.warn(r),new Da.Notice(r,1e4)}function jA(r){Nu().debug(r)}var wn=class extends Error{},Pu=class extends Error{},x_=a=>F(void 0,[a],function*({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:
1 year ago
The task line not updated is:
${r.originalMarkdown}
In this markdown file:
"${r.taskLocation.path}"
Note: further clicks on this checkbox will usually now be ignored until the file is opened (or certain, specific edits are made - it's complicated).
Recommendations:
1. Close all panes that have the above file open, and then re-open the file.
2. Check for exactly identical copies of the task line, in this file, and see if you can make them different.
11 months ago
`;Au(c);return}let l=Math.min(Math.pow(10,s),100);o.debug(`timeout = ${l}`),setTimeout(()=>{x_({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:s+1})},l)};try{let[l,c,f]=yield R_(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 wn)return l.message&&D_(l.message),u();if(l instanceof Pu)return u();l instanceof Error&&Au(l.message)}});function R_(r,e){return F(this,null,function*(){if(Oa===void 0)throw new wn;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof Da.TFile))throw new wn(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!YA.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=Oa.getFileCache(t);if(n==null||n===null)throw new wn(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let i=n.listItems;if(i===void 0||i.length===0)throw new wn(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let a=(yield e.read(t)).split(`
`),o=GA(r,a,i,jA);if(o===void 0)throw new Pu;return[o,t,a]})}function Np(r,e){return F(this,null,function*(){try{let[t,n,i]=yield R_(r,e);return[t,n]}catch(t){t instanceof wn?t.message&&D_(t.message):t instanceof Error&&Au(t.message)}})}function M_(r,e){return r<e.length}function GA(r,e,t,n){let i=BA(r,e);return i!==void 0||(i=HA(r,e),i!==void 0)?i:zA(r,e,t,n)}function BA(r,e){let t=r.taskLocation.lineNumber;if(M_(t,e)&&e[t]===r.originalMarkdown)return Nu().debug(`Found original markdown at original line number ${t}`),t}function HA(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 zA(r,e,t,n){let i,s=0;for(let a of t){let o=a.position.start.line;if(!M_(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}.
1 year ago
Expected task:
${r.originalMarkdown}
Found task:
11 months ago
${u}`);return}break}s++}}return i}var N_=require("obsidian");var P_=require("obsidian");var Iu=class{constructor(){this.data=VA}addDataAttribute(e,t,n){this.data[n].addDataAttribute(e,t,n)}className(e){return this.data[e].className}},Ip=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!==Ip.noAttributeName&&(e.dataset[this.attributeName]=this.attributeValueCalculator(n,t))}},Ce=Ip;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 VA={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 C_=require("obsidian");function A_(r,e){return F(this,null,function*(){yield ti({originalTask:r,newTasks:e})})}var Fu=class extends C_.Menu{constructor(t){super();this.taskSaver=t}};var Lu=class extends Fu{constructor(t,n,i=A_){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 xa=new Iu,En=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 P_.MarkdownRenderer.renderMarkdown(e,t,n,i)})}constructor({textRenderer:e=En.obsidianMarkdownRenderer,obsidianComponent:t,parentUlElement:n,layoutOptions:i}){this.textRenderer=e,this.obsidianComponent=t,this.parentUlElement=n,this.layoutOptions=i}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();ti({originalTask:e,newTasks:u})}),a.addEventListener("contextmenu",o=>{new Lu(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.layoutOptions.shortMode&&this.addTooltip(e,s,n),i})}taskToHtml(e,t,n){return F(this,null,function*(){let i=new pn(this.layoutOptions),s=Hr.tasksPluginEmoji.taskSerializer;for(
`);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 En({obsidianComponent:n,parentUlElement:e,layoutOptions:new qn});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 I_=require("@codemirror/view"),F_=require("obsidian");var L_=()=>I_.ViewPlugin.fromClass(Fp),Fp=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 F_.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 U_(r,e,t,n=void 0){let i="";e.isEmpty()||(i+=`Only tasks containing the global filter '${e.get()}'.
2 years ago
11 months ago
`);let s=new Jr(r,n);return s.ignoreGlobalQuery||t.hasInstructions()&&(i+=`Explanation of the global query:
2 years ago
1 year ago
${t.query(n).explainQuery()}
`),i+=`Explanation of this Tasks code block query:
2 years ago
11 months ago
${s.explainQuery()}`,i}function Wu(r,e,t){let n=new Jr(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}function W_(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 Lp(r){return r.dueDate?"dueDate":r.scheduledDate?"scheduledDate":r.startDate?"startDate":null}function q_(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 $_(r,e){let t=r==null?void 0:r.format("DD MMM YYYY");return`Task's ${e} postponed until ${t}`}function Y_(r,e,t){return`\u2139\uFE0F ${Up(r,e,t)} (right-click for more options)`}function Up(r,e,t){function n(l){return l.charAt(0).toUpperCase()+l.slice(1)}let i=Lp(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 qu=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 Wp({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},Wp=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=Wu(this.source,tr.getInstance(),this.filePath),this.queryType="tasks";break;default:this.query=Wu(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=Wu(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.layoutOptions.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=U_(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 pn(this.query.layoutOptions),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 En({obsidianComponent:this,parentUlElement:s,layoutOptions:this.query.layoutOptions});for(let[u,l]of t.entries()){let c=this.isFilenameUnique({task:l}),f=yield o.
1 year ago
`,this._markdown+=`${t}
`}addRow(e){let t=this.makeRowText(e);this._markdown+=`${t}
`}addRowIfNew(e){let t=this.makeRowText(e);this._markdown.includes(t)||(this._markdown+=`${t}
11 months ago
`)}makeRowText(e){let t="|";return e.forEach(n=>{t+=` ${n} |`}),t}};function j_(r,e){return r.findIndex(t=>t.symbol===e)}function KA(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 QA(r,e,t){let n=j_(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";t.push(`This \`DONE\` status is followed by ${Rr(i.type)}, not \`TODO\` or \`IN_PROGRESS\`: this will not work well for recurring tasks. See [Recurring Tasks and Custom Statuses](${s}).`)}}else t.push("Unexpected failure to find the next status.")}function XA(r,e,t){let n=[];return e.symbol===X.EMPTY.symbol?(n.push("Empty symbol: this status will be ignored."),n):j_(r,e.symbol)!=t?(n.push(`Duplicate symbol '${Rr(e.symbol)}': this status will be ignored.`),n):(KA(e,n),QA(r,e,n),n)}function G_(r){let e=new $u(["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),XA(t,n,i).join("<br>")])}),e.markdown}function B_(r,e,t,n){let s=G_(r),a=e.mermaidDiagram(!0);return`# ${t}
1 year ago
## About this file
This file was created by the Obsidian Tasks plugin (version ${n}) to help visualise the task statuses in this vault.
If you change the Tasks status settings, you can get an updated report by:
- Going to \`Settings\` -> \`Tasks\`.
- Clicking on \`Review and check your Statuses\`.
You can delete this file any time.
## Status Settings
<!--
Switch to Live Preview or Reading Mode to see the table.
If there are any Markdown formatting characters in status names, such as '*' or '_',
Obsidian may only render the table correctly in Reading Mode.
-->
These are the status values in the Core and Custom statuses sections.
${s}
## Loaded Settings
<!-- Switch to Live Preview or Reading Mode to see the diagram. -->
These are the settings actually used by Tasks.
11 months ago
${a}`}function Rr(r){return r===""?r:"`"+(r!==" "?r:"space")+"`"}function H_(){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 z_(){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 V_(){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 K_(){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 Q_(){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 X_(){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","
`)+`
11 months ago
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"}),tP(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...
2 years ago
path does not include _templates/
limit 300
11 months ago
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();J_.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 nv=(r,e)=>{let t=Qo({line:"",path:""});return new mn({app:r,task:t,onSubmit:e})};var iv=r=>({createTaskLineModal:()=>rv(r,nv)});var ju=class extends sv.Plugin{get apiV1(){return iv(app)}onload(){return F(this,null,function*(){St.registerConsoleLogger(),tp("info",`loading plugin "${this.manifest.name}" v${this.manifest.version}`),yield this.loadSettings();let{loggingOptions:t}=Q();St.configure(t),this.addSettingTab(new Ra({plugin:this})),O_({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let n=new Cu({obsidianEvents:this.app.workspace});this.cache=new Gn({metadataCache:this.app.metadataCache,vault:this.app.vault,events:n}),this.inlineRenderer=new Uu({plugin:this}),this.queryRenderer=new qu({plugin:this,events:n}),this.registerEditorExtension(L_()),this.registerEditorSuggest(new Yu(this.app,Q())),new Xo({plugin:this})})}loadTaskStatuses(){return F(this,null,function*(){let{statusSettings:t}=Q();Pe.applyToStatusRegistry(t,ve.getInstance())})}onunload(){var t;tp("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()}};
2 years ago
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
*
* Copyright (c) 2013 hij1nx
* Licensed under the MIT license.
*/
1 year ago
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/