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.

349 lines
416 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 Uv=Object.create;var _i=Object.defineProperty,qv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptor,Yv=Object.getOwnPropertyDescriptors,Gv=Object.getOwnPropertyNames,Rm=Object.getOwnPropertySymbols,jv=Object.getPrototypeOf,Cm=Object.prototype.hasOwnProperty,$v=Object.prototype.propertyIsEnumerable;var Mm=(r,e,t)=>e in r?_i(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ke=(r,e)=>{for(var t in e||(e={}))Cm.call(e,t)&&Mm(r,t,e[t]);if(Rm)for(var t of Rm(e))$v.call(e,t)&&Mm(r,t,e[t]);return r},ot=(r,e)=>qv(r,Yv(e));var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Bv=(r,e)=>{for(var t in e)_i(r,t,{get:e[t],enumerable:!0})},Am=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Gv(e))!Cm.call(r,s)&&s!==t&&_i(r,s,{get:()=>e[s],enumerable:!(n=Wv(e,s))||n.enumerable});return r};var vi=(r,e,t)=>(t=r!=null?Uv(jv(r)):{},Am(e||!r||!r.__esModule?_i(t,"default",{value:r,enumerable:!0}):t,r)),Hv=r=>Am(_i({},"__esModule",{value:!0}),r);var L=(r,e,t)=>new Promise((n,s)=>{var i=u=>{try{o(t.next(u))}catch(l){s(l)}},a=u=>{try{o(t.throw(u))}catch(l){s(l)}},o=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,a);o((t=t.apply(r,e)).next())});var Se=b(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.matchAnyPattern=fn.extractTerms=fn.repeatedTimeunitPattern=void 0;function Qv(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}fn.repeatedTimeunitPattern=Qv;function Pm(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}fn.extractTerms=Pm;function Xv(r){return`(?:${Pm(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}fn.matchAnyPattern=Xv});var Te=b((pl,ml)=>{(function(r,e){typeof pl=="object"&&typeof ml!="undefined"?ml.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(pl,function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",s="second",i="minute",a="hour",o="day",u="week",l="month",c="quarter",f="year",m="date",y="Invalid Date",k=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|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,x={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("_")},v=function($,N,w){var H=String($);return!H||H.length>=N?$:""+Array(N+1-H.length).join(w)+$},I={s:v,z:function($){var N=-$.utcOffset(),w=Math.abs(N),H=Math.floor(w/60),C=w%60;return(N<=0?"+":"-")+v(H,2,"0")+":"+v(C,2,"0")},m:function $(N,w){if(N.date()<w.date())return-$(w,N);var H=12*(w.year()-N.year())+(w.month()-N.month()),C=N.clone().add(H,l),X=w-C<0,d=N.clone().add(H+(X?-1:1),l);return+(-(H+(w-C)/(X?C-d:d-C))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:l,y:f,w:u,d:o,D:m,h:a,m:i,s,ms:n,Q:c}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},F="en",le={};le[F]=x;var B=function($){return $ instanceof ce},ie=function($,N,w){var H;if(!$)return F;if(typeof $=="string")le[$]&&(H=$),N&&(le[$]=N,H=$);else{var C=$.name;le[C]=$,H=C}return!w&&H&&(F=H),H||!w&&F},W=function($,N){if(B($))return $.clone();var w=typeof N=="object"?N:{};return w.date=$,w.args=arguments,new ce(w)},j=I;j.l=ie,j.i=B,j.w=function($,N){return W($,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var ce=function(){function $(w){this.$L=ie(w.locale,null,!0),this.parse(w)}var N=$.prototype;return N.parse=function(w){this.$d=function(H){var C=H.date,X=H.utc;if(C===null)return new Date(NaN);if(j.u(C))return new Date;if(C instanceof Date)return new Date(C);if(typeof C=="string"&&!/Z$/i.test(C)){var d=C.match(k);if(d){var p=d[2]-1||0,h=(d[7]||"0").substring(0,3);return X?new Date(Date.UTC(d[1],p,d[3]||1,d[4]||0,d[5]||0,d[6]||0,h)):new Date(d[1],p,d[3]||1,d[4]||0,d[5]||0,d[6]||0,h)}}return new Date(C)}(w),this.$x=w.x||{},this.init()},N
`).map(SC).filter(function(t){return t!==null});return ft(ft({},e[0]),e[1])}function Da(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],s=t[2];return n&&(e.tzid=n),e.dtstart=Ea(s),e}function SC(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return Eb(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return Eb(r);case"DTSTART":return Da(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function Eb(r){var e=r.replace(/^RRULE:/i,""),t=Da(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(s){var i=s.split("="),a=i[0],o=i[1];switch(a.toUpperCase()){case"FREQ":t.freq=ue[o.toUpperCase()];break;case"WKST":t.wkst=nr[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=OC(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=DC(o);break;case"DTSTART":case"TZID":var c=Da(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=Ea(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function OC(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(kb)}return kb(r)}function kb(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function DC(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return nr[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!n||n.length<3)throw new SyntaxError("Invalid weekday string: ".concat(t));var s=Number(n[1]),i=n[2],a=nr[i].weekday;return new Be(a,s)})}var Zn=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=Fs(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:mb(this.date,this.tzid)},r}();function Ra(r){for(var e=[],t="",n=Object.keys(r),s=Object.keys(Oa),i=0;i<n.length;i++)if(n[i]!=="tzid"&&!!he(s,n[i])){var a=n[i].toUpperCase(),o=r[n[i]],u="";if(!(!Ae(o)||dt(o)&&!o.length)){switch(a){case"FREQ":u=G.FREQUENCIES[r.freq];break;case"WKST":Yt(o)?u=new Be(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=ub(o).map(function(y){return y instanceof Be?y:dt(y)?new Be(y[0],y[1]):new Be(y)}).toString();break;case"DTSTART":t=xC(o,r.tzid);break;case"UNTIL":u=Fs(o,!r.tzid);break;default:if(dt(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(y){var k=y[0],E=y[1];return"".concat(k,"=").concat(E.toString())}).join(";"),m="";return f!==""&&(m="RRULE:".concat(f)),[t,m].filter(function(y){return!!y}).join(`
`)}function xC(r,e){return r?"DTSTART"+new Zn(new Date(r),e).toString():""}function RC(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 Sb=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?su(t):ap(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,s=t?Object.keys(t):[],i=function(c){for(var f=0;f<s.length;f++){var m=s[f];if(!RC(t[m],c[m]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(dt(a))for(var o=0;o<a.length;o++){var u=a[o];if(!(s.length&&i(u))){n=u._value;break}}if(!n&&this.all){for(var l=new Kr(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return dt(n)?ap(n):n instanceof Date?su(n):n},r}();var Ob=P(P(P(P(P(P(P(P(P(P(P(P(P([],pe(1,31),!0),pe(2,28),!0),pe(3,31),!0),pe(4,30),!0),pe(5,31),!0),pe(6,30),!0),pe(7,31),!0),pe(8,31),!0),pe(9,30),!0),pe(10,31),!0),pe(11,30),!0),pe(12,31),!0),pe(1,7),!0),Db=P(P(P(P(P(P(P(P(P(P(P(P(P([],pe(1,31),!0),pe(2,29),!0),pe(3,31),!0),pe(4,30),!0),pe(5,31),!0),pe(6,30),!0),pe(7,31),!0),pe(8,31),!0),pe(9,30),!0),pe(10,31),!0),pe(11,30),!0),pe(12,31),!0),pe(1,7),!0),MC=rr(1,29),CC=rr(1,30),bn=rr(1,31),yt=rr(1,32),xb=P(P(P(P(P(P(P(P(P(P(P(P(P([],yt,!0),CC,!0),yt,!0),bn,!0),yt,!0),bn,!0),yt,!0),yt,!0),bn,!0),yt,!0),bn,!0),yt,!0),yt.slice(0,7),!0),Rb=P(P(P(P(P(P(P(P(P(P(P(P(P([],yt,!0),MC,!0),yt,!0),bn,!0),yt,!0),bn,!0),yt,!0),yt,!0),bn,!0),yt,!0),bn,!0),yt,!0),yt.slice(0,7),!0),AC=rr(-28,0),PC=rr(-29,0),_n=rr(-30,0),Tt=rr(-31,0),Mb=P(P(P(P(P(P(P(P(P(P(P(P(P([],Tt,!0),PC,!0),Tt,!0),_n,!0),Tt,!0),_n,!0),Tt,!0),Tt,!0),_n,!0),Tt,!0),_n,!0),Tt,!0),Tt.slice(0,7),!0),Cb=P(P(P(P(P(P(P(P(P(P(P(P(P([],Tt,!0),AC,!0),Tt,!0),_n,!0),Tt,!0),_n,!0),Tt,!0),Tt,!0),_n,!0),Tt,!0),_n,!0),Tt,!0),Tt.slice(0,7),!0),Ab=[0,31,60,91,121,152,182,213,244,274,305,335,366],Pb=[0,31,59,90,120,151,181,212,243,273,304,334,365],cp=function(){for(var r=[],e=0;e<55;e++)r=r.concat(rr(7));return r}();function Nb(r,e){var t=Dr(r,1,1),n=Is(r)?366:365,s=Is(r+1)?366:365,i=wa(t),a=zr(t),o=ft(ft({yearlen:n,nextyearlen:s,yearordinal:i,yearweekday:a},NC(r)),{wnomask:null});if(Gt(e.byweekno))return o;o.wnomask=pe(0,n+7);var u,l,c=u=gt(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+gt(a-e.wkst,7)):l=n-c;for(var f=Math.floor(l/7),m=gt(l,7),y=Math.floor(f+m/4),k=0;k<e.byweekno.length;k++){var E=e.byweekno[k];if(E<0&&(E+=y+1),E>0&&E<=y){var x=void 0;E>1?(x=c+(E-1)*7,c!==u&&(x-=7-u)):x=c;for(var v=0;v<7&&(o.wnomask[x]=1,x++,o.wdaymask[x]!==e.wkst);v++);}}if(he(e.byweekno,1)){var x=c+y*7;if(c!==u&&(x-=7-u),x<n)for(var k=0;k<7&&(o.wnomask[x]=1,x+=1,o.wdaymask[x]!==e.wkst);k++);}if(c){var I=void 0;if(he(e.byweekno,-1))I=-1;else{var F=zr(Dr(r-1,1,1)),le=gt(7-F.valueOf()+e.wkst,7),B=Is(r-1)?366:365,ie=void 0;le>=4?(le=0,ie=B+gt(F-e.wkst,7)):ie=n-c,I=Math.floor(52+gt(ie,7)/4)}if(he(e.byweekno,I))for(var x=0;x<c;x++)o.wnomask[x]=1}return o}function NC(r){var e=Is(r)?366:365,t=Dr(r,1,1),n=zr(t);return e===365?{mmask:Ob,mdaymask:Rb,nmdaymask:Cb,wdaymask:cp.slice(n),mrange:Pb}:{mmask:Db,mdaymask:xb,nmdaymask:Mb,wdaymask:cp.slice(n),mrange:Ab}}function Ib(r,e,t,n,s,i){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(i.freq===G.YEARLY)if(Gt(i.bymonth))o=[[0,t]];else for(var u=0;u<i.bymonth.length;u++)e=i.bymonth[u],o.push(n.slice(e-1,e+1));else i.freq===G.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Gt(o))return a;a.nwdaymask=pe(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],c=l[0],f=l[1]-1,m=0;m<i.bynweekday.length;m++){var y=void 0,k=i.bynweekday[m],E=k[0],x=k[1];x<0?(y=f+(x+1)*7,y-=gt(s[y]-E,7)):(y=c+(x-1)*7,y+=gt(7-s[y]+E,7)),c<=y&&y<=f&&(a.nwdaymask[y]=1)}return a}function Fb(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),s=r%100,i=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-i-u+15)%30,c=Math.floor(s/4),f=s%4,m=Math.floor(32+2*a+2*c-l-f)%7,y=Math.floor((t+1
`),n=0;n<t.length;){var s=t[n]=t[n].replace(/\s+$/g,"");s?n>0&&s[0]===" "?(t[n-1]+=s.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function BC(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Gb(r,e){return BC(e),r.split(",").map(function(t){return Ea(t)})}function jb(r){var e=this;return function(t){if(t!==void 0&&(e["_".concat(r)]=t),e["_".concat(r)]!==void 0)return e["_".concat(r)];for(var n=0;n<e._rrule.length;n++){var s=e._rrule[n].origOptions[r];if(s)return s}}}var fp=function(r){Ls(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=jb.apply(n,["dtstart"]),n.tzid=jb.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return Wb(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){$b(t,this._rrule)},e.prototype.exrule=function(t){$b(t,this._exrule)},e.prototype.rdate=function(t){Bb(t,this._rdate)},e.prototype.exdate=function(t){Bb(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return au(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return au(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(Ra({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(s){return s.replace(/^RRULE:/,"EXRULE:")}).filter(function(s){return!/^DTSTART/.test(s)}))}),this._rdate.length&&t.push(Hb("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(Hb("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}(G);function $b(r,e){if(!(r instanceof G))throw new TypeError(String(r)+" is not RRule instance");he(e.map(String),String(r))||e.push(r)}function Bb(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");he(e.map(Number),Number(r))||(e.push(r),Vr(e))}function Hb(r,e,t){var n=!t||t.toUpperCase()==="UTC",s=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),i=e.map(function(a){return Fs(a.valueOf(),n)}).join(",");return"".concat(s).concat(i)}function Xr(r,e){return r!==null&&e===null?-1:r===null&&e!==null?1:r!==null&&e!==null?r.isValid()&&!e.isValid()?-1:!r.isValid()&&e.isValid()||r.isAfter(e)?1:r.isBefore(e)?-1:0:0}var st=class{constructor({rrule:e,baseOnToday:t,referenceDate:n,startDate:s,scheduledDate:i,dueDate:a}){this.rrule=e,this.baseOnToday=t,this.referenceDate=n,this.startDate=s,this.scheduledDate=i,this.dueDate=a}static fromText({recurrenceRuleText:e,startDate:t,scheduledDate:n,dueDate:s}){try{let i=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(i==null)return null;let a=i[1].trim(),o=i[2]!==void 0,u=G.parseText(a);if(u!==null){let l=null;s?l=window.moment(s):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 G(u);return new st({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:s})}}catch(i){i instanceof Error&&console.log(i.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,s=null;if(this.referenceDate){if(this.startDate){let i=window.moment.duration(this.startDate.diff(this.referenceDate));t=window.moment(e),t.add(Math.round(i.asDays()),"days")}if(this.scheduledDate){let i=window.moment.duration(this.scheduledDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(i.asDays()),"days")}if(this.dueDate){let i=window.moment.duration(this.dueDate.diff(this.referenceDate));s=window.moment(e),s.add(Math.round(i.asDays()),"days")}}return{startDate:t,scheduledDate:n,dueDate:s}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||Xr(this.startDate,e.startDate)!==0||Xr(this.scheduledDate,e.scheduledDate)!==0||Xr(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 G(ot(ke({},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())),s=this.toText(),i=s.match(/every( \d+)? month(s)?(.*)?/);i!==null&&(s.includes(" on ")||(n=st.nextAfterMonths(e,n,t,i[1])));let a=s.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=st.nextAfterYears(e,n,t,a[1])),st.addTimezone(n)}static nextAfterMonths(e,t,n,s){let i=1;for(s!==void 0&&(i=Number.parseInt(s.trim(),10));st.isSkippingTooManyMonths(e,t,i);)t=st.fromOneDayEarlier(e,n);return t}static isSkippingTooManyMonths(e,t,n){let s=t.month()-e.month();return s+=(t.year()-e.year())*12,s>n}static nextAfterYears(e,t,n,s){let i=1;for(s!==void 0&&(i=Number.parseInt(s.trim(),10));st.isSkippingTooManyYears(e,t,i);)t=st.fromOneDayEarlier(e,n);return t}static isSkippingTooManyYears(e,t,n){return t.year()-e.year()>n}static fromOneDayEarlier(e,t){e.subtract(1,"days").endOf("day");let n=t.origOptions;return n.dtstart=e.startOf("day").toDat
`}),a=a.slice(0,i.autoSuggestMaxItems),a}}function HC(r,e,t,n){let s=u=>Object.values(n.prioritySymbols).some(l=>l.length>0&&u.includes(l)),i=[];if(r.includes(n.dueDateSymbol)||i.push({displayText:`${n.dueDateSymbol} due date`,appendText:`${n.dueDateSymbol} `}),r.includes(n.startDateSymbol)||i.push({displayText:`${n.startDateSymbol} start date`,appendText:`${n.startDateSymbol} `}),r.includes(n.scheduledDateSymbol)||i.push({displayText:`${n.scheduledDateSymbol} scheduled date`,appendText:`${n.scheduledDateSymbol} `}),s(r)||(i.push({displayText:`${n.prioritySymbols.High} high priority`,appendText:`${n.prioritySymbols.High} `}),i.push({displayText:`${n.prioritySymbols.Medium} medium priority`,appendText:`${n.prioritySymbols.Medium} `}),i.push({displayText:`${n.prioritySymbols.Low} low priority`,appendText:`${n.prioritySymbols.Low} `}),i.push({displayText:`${n.prioritySymbols.Highest} highest priority`,appendText:`${n.prioritySymbols.Highest} `}),i.push({displayText:`${n.prioritySymbols.Lowest} lowest priority`,appendText:`${n.prioritySymbols.Lowest} `})),r.includes(n.recurrenceSymbol)||i.push({displayText:`${n.recurrenceSymbol} recurring (repeat)`,appendText:`${n.recurrenceSymbol} `}),!r.includes(n.createdDateSymbol)){let l=Wt.parseDate("today",!0).format(z.dateFormat);i.push({textToMatch:`${n.createdDateSymbol} created`,displayText:`${n.createdDateSymbol} created today (${l})`,appendText:`${n.createdDateSymbol} ${l} `})}let a=hp(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=i.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?i:o}function zC(r,e,t,n,s){let i=["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=hp(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?Wt.parseDate(Hr(c),!0):null;f&&f.isValid()&&a.push({displayText:`${f.format(z.dateFormat)}`,appendText:`${l} ${f.format(z.dateFormat)} `,insertAt:u.index,insertSkip:u[0].length});let m=1,y=i.filter(k=>c&&c.length>=m&&k.toLowerCase().includes(c.toLowerCase())).slice(0,s);y.length===0&&(y=i.slice(0,s));for(let k of y){let x=`${Wt.parseDate(k,!0).format(z.dateFormat)}`;a.push({suggestionType:"match",displayText:`${k} (${x})`,appendText:`${l} ${x} `,insertAt:u.index,insertSkip:u[0].length})}}return a}function VC(r,e,t,n){var u;let s=["every","every day","every week","every month","every month on the","every year","every week on Sunday","every week on Monday","every week on Tuesday","every week on Wednesday","every week on Thursday","every week on Friday","every week on Saturday"],i=[],a=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),o=hp(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 k=(u=st.fromText({recurrenceRuleText:c,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:u.toText();if(k){let E=`${l} ${k} `;if(i.push({suggestionType:"match",displayText:`\u2705 ${k}`,appendText:E,insertAt:o.index,insertSkip:o[0].length}),o[0]==E)return[]}}let f=1,m=t.autoSuggestMaxItems/2,y=s.filter(k=>c&&c.length>=f&&k.toLowerCase().includes(c.toLowerCase())).slice(0,m);y.length===0&&c.trim().length===0&&(y=s.slice(0,m));for(let k of y)i.push({suggestionType:"match",displayText:`${k}`,appendText:`${l} ${k} `,insertAt:o.index,insertSkip:o[0].length})}return i}function hp(r,e,t){let n=r.matchAll(e);for(let s of n)if((s==null?void 0:s.index)&&s.index<=t&&t<=s.index+s[0].length)return s}function KC(r,e){if(e.length===0)return!1;let t=Object.fromEntries(e.map(([s,i])=>[s,0])),n=Object.fromEntries(e.map(([s,i])=>[i,s]));for(let s of r)s in t?t[s]++:s in n&&(t[n[s]]=Math.max(0,t[n[s]]-1));return Object.values(t).some(s=>s>0)}function Vb(r,e){return(t,n,s)=>KC(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;
${s.join(`
`)}
11 months ago
${i.join(`
`)}
1 year ago
linkStyle default stroke:gray
\`\`\`
11 months ago
`}addEdgeIfNotToInternal(e,t,n,s,i){let a=e.findIndex(l=>l.symbol===t.symbol),o=a!==-1,u=t.type!=="EMPTY";if(o&&u){let l;i?l='-. "\u{1F501}" .-> ':l=" --> ";let c=`${s+1}${l}${a+1}`;n.push(c)}}getMermaidNodeLabel(e,t){let n=e_(e.name),s=e.type;if(t){let i=cu(e.symbol),a=cu(e.nextStatusSymbol),o=`[${i}] -> [${a}]`,u=`'${n}'`,l=`(${s})`;return`["${u}<br>${o}<br>${l}"]:::${s}`}else return`["${n}"]:::${s}`}};var yr=class{static calculate(e){let t=0;if(e.dueDate!==null){let n=window.moment().startOf("day"),s=Math.round(n.diff(e.dueDate)/yr.milliSecondsPerDay),i;s>=7?i=1:s>=-14?i=(s+14)*.8/21+.2:i=.2,t+=i*yr.dueCoefficient}switch(e.scheduledDate!==null&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*yr.scheduledCoefficient),e.startDate!==null&&window.moment().isBefore(e.startDate)&&(t+=1*yr.startedCoefficient),e.priority){case"0":t+=1.5*yr.priorityCoefficient;break;case"1":t+=1*yr.priorityCoefficient;break;case"2":t+=.65*yr.priorityCoefficient;break;case"3":t+=.325*yr.priorityCoefficient;break;case"5":t-=.3*yr.priorityCoefficient;break}return t}},en=yr;en.dueCoefficient=12,en.scheduledCoefficient=5,en.startedCoefficient=-3,en.priorityCoefficient=6,en.milliSecondsPerDay=1e3*60*60*24;var bt=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=K();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("."),s=e.substring(t,n),i=/(\d{4})-(\d{2})-(\d{2})/.exec(s);if(i||(i=/(\d{4})(\d{2})(\d{2})/.exec(s)),i){let a=window.moment([parseInt(i[1]),parseInt(i[2])-1,parseInt(i[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 s=e.scheduledDate,i=e.scheduledDateIsInferred;return n===null?i&&(i=!1,s=null):i?s=n:this.canApplyFallback(e)&&(s=n,i=!0),new fe(ot(ke({},e),{taskLocation:e.taskLocation.fromRenamedFile(t),scheduledDate:s,scheduledDateIsInferred:i}))}static removeInferredStatusIfNeeded(e,t){let n=e.scheduledDateIsInferred?e.scheduledDate:null;return t.map(s=>(n!==null&&!n.isSame(s.scheduledDate,"day")&&(s=new fe(ot(ke({},s),{scheduledDateIsInferred:!1}))),s))}};var t_=require("obsidian");var tn=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var He=class{constructor(e){this._date=null;this._date=e}get moment(){return this._date}formatAsDate(e=""){return this.format(z.dateFormat,e)}formatAsDateAndTime(e=""){return this.format(z.dateTimeFormat,e)}format(e,t=""){return this._date?this._date.format(e):t}toISOString(e){return this._date?this._date.toISOString(e):""}get category(){let e=window.moment(),t=this.moment;return t?t.isBefore(e,"day")?new tn("Overdue",1):t.isSame(e,"day")?new tn("Today",2):new tn("Future",3):new tn("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new tn("",0);let t=this.fromNowOrder(e);return new tn(e.fromNow(),t)}fromNowOrder(e){let t=window.moment(),n=e.isSameOrBefore(t,"day"),s=this.fromNowStartDateOfGroup(e,n,t);return Number((n?1:3)+s.format("YYYYMMDD"))}fromNowStartDateOfGroup(e,t,n){let s=e.fromNow(!0).split(" "),i,a=Number(s[0]);isNaN(a)?i=1:i=a;let o=s[1];return t?n.subtract(i,o):n.add(i,o)}postpone(e="days",t=1){if(!this._date)throw new t_.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 Ws=class{constructor(e){this._path=e}get path(){return this._path}get pathWithoutExtension(){return this.withoutExtension(this.path)}withoutExtension(e){return e.replace(/\.md$/,"")}get root(){let e=this.path.replace(/\\/g,"/");e.charAt(0)==="/"&&(e=e.substring(1));let t=e.indexOf("/");return t==-1?"/":e.substring(0,t+1)}get folder(){let e=this.path,t=this.filename,n=e.substring(0,e.lastIndexOf(t));return n===""?"/":n}get filename(){let e=this.path.match(/([^/]+)$/);return e!==n
`),o=a.length,u=new Aa(()=>bt.fromPath(s.path)),l=null,c=0;for(let f of t)if(f.task!==void 0){let m=f.position.start.line;if(m>=o)return this.logger.debug(`${s.path} Obsidian gave us a line number ${m} past the end of the file. ${o}.`),i;if((l===null||l.position.end.line<m)&&(l=rs.getSection(m,n.sections),c=0),l===null)continue;let y=a[m];if(y===void 0){this.logger.debug(`${s.path}: line ${m} - ignoring 'undefined' line.`);continue}let k;try{k=fe.fromLine({line:y,taskLocation:new pt(s.path,m,l.position.start.line,c,rs.getPrecedingHeader(m,n.headings)),fallbackDate:u.value})}catch(E){this.reportTaskParsingErrorToUser(E,s,f,y);continue}k!==null&&(c++,i.push(k))}return i}reportTaskParsingErrorToUser(e,t,n,s){let i=`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}
11 months ago
Task line: ${s}
Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.
Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'
The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.
11 months ago
`;this.logger.error(i),e instanceof Error&&this.logger.error(e.stack?e.stack:"Cannot determine stack"),this.state==="Initializing"&&new Ys.Notice(i,1e4)}static getSection(e,t){if(t===void 0)return null;for(let n of t)if(n.position.start.line<=e&&n.position.end.line>=e)return n;return null}static getPrecedingHeader(e,t){if(t===void 0)return null;let n=null;for(let s of t){if(s.position.start.line>e)return n;n=s.heading}return n}};var Ap=require("obsidian");var E_=require("obsidian");function nn(){}function Sp(r){return r()}function a_(){return Object.create(null)}function ns(r){r.forEach(Sp)}function pu(r){return typeof r=="function"}function u_(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function l_(r){return Object.keys(r).length===0}var c_=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,Na=class{constructor(e){this.options=e,this._listeners="WeakMap"in c_?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 s of t)Na.entries.set(s.target,s),(n=this._listeners.get(s.target))===null||n===void 0||n(s)})}};Na.entries="WeakMap"in c_?new WeakMap:void 0;var d_=!1;function tA(){d_=!0}function rA(){d_=!1}function O(r,e){r.appendChild(e)}function Bs(r,e,t){r.insertBefore(e,t||null)}function ss(r){r.parentNode&&r.parentNode.removeChild(r)}function Op(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function V(r){return document.createElement(r)}function nA(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Qe(r){return document.createTextNode(r)}function Z(){return Qe(" ")}function it(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function f_(r){return function(e){return e.preventDefault(),r.call(this,e)}}function A(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function p_(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 sA(r){return Array.from(r.childNodes)}function Dp(r,e){e=""+e,r.data!==e&&(r.data=e)}function mt(r,e){r.value=e==null?"":e}function xp(r,e,t){for(let n=0;n<r.options.length;n+=1){let s=r.options[n];if(s.__value===e){s.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function m_(r){let e=r.querySelector(":checked");return e&&e.__value}function ht(r,e,t){r.classList[t?"add":"remove"](e)}var Rr=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=nA(t.nodeName):this.e=V(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)Bs(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(ss)}};var Ia;function Pa(r){Ia=r}function iA(){if(!Ia)throw new Error("Function called outside component initialization");return Ia}function Rp(r){iA().$$.on_mount.push(r)}var js=[];var mu=[],$s=[],o_=[],aA=Promise.resolve(),kp=!1;function oA(){kp||(kp=!0,aA.then(h_))}function Fa(r){$s.push(r)}var Ep=new Set,Gs=0;function h_(){if(Gs!==0)return;let r=Ia;do{try{for(;Gs<js.length;){let e=js[Gs];Gs++,Pa(e),uA(e.$$)}}catch(e){throw js.length=0,Gs=0,e}for(Pa(null),js.length=0,Gs=0;mu.length;)mu.pop()();for(let e=0;e<$s.length;e+=1){let t=$s[e];Ep.has(t)||(Ep.add(t),t())}$s.length=0}while(js.length);for(;o_.length;)o_.pop()();kp=!1,Ep.clear(),Pa(r)}function uA(r){if(r.fragment!==null){r.update(),ns(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Fa)}}function lA(r){let e=[],t=[];$s.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),$s=e}var cA=new Set;function dA(r,e){r&&r.i&&(cA.delete(r),r.i(e))}var fA=["allowfullscreen","allowpaymentreq
<span class="accesskey-first">future</span> dates:`,oe=Z(),Me=V("input"),cn=Z(),vr=V("div"),hs=V("label"),hs.innerHTML='Stat<span class="accesskey">u</span>s',Ha=Z(),Et=V("select");for(let q=0;q<St.length;q+=1)St[q].c();za=Z(),Va=V("label"),Va.textContent=`\u26A0\uFE0F Changing the status does not yet auto-update Done or Cancelled Dates, nor create a new recurrence.
Complete tasks via command, by clicking on task checkboxes or by right-clicking on task checkboxes.`,um=Z(),Ka=V("div"),mi=V("div"),Qa=V("label"),Qa.textContent="Completed:",lm=Z(),dn=V("input"),cm=Z(),Ye=V("div"),Za=V("label"),Za.textContent="Created",dm=Z(),or=V("input"),fm=Z(),hi=V("code"),pm=Qe(r[25]),mm=Z(),Ja=new Rr(!1),hm=Z(),eo=V("label"),eo.textContent="Done",gm=Z(),ur=V("input"),ym=Z(),gi=V("code"),Tm=Qe(r[26]),bm=Z(),to=new Rr(!1),_m=Z(),ro=V("label"),ro.textContent="Cancelled",vm=Z(),lr=V("input"),wm=Z(),yi=V("code"),Em=Qe(r[24]),km=Z(),no=new Rr(!1),Sm=Z(),gs=V("div"),Ln=V("button"),Om=Qe("Apply"),Dm=Z(),Ti=V("button"),Ti.textContent="Cancel",A(s,"for","description"),A(a,"id","description"),A(a,"class","tasks-modal-description"),A(a,"placeholder","Take out the trash"),A(a,"accesskey",o=r[19]("t")),A(n,"class","tasks-modal-section"),A(c,"for",m="priority-"+r[1].priority),A(l,"class","tasks-modal-section tasks-modal-priorities"),A(x,"for","recurrence"),A(x,"class","accesskey-first"),A(I,"id","recurrence"),A(I,"type","text"),A(I,"placeholder","Try 'every 2 weeks on Thursday'."),A(I,"accesskey",F=r[19]("r")),ht(I,"tasks-modal-error",!r[10]),j.a=null,A(Ie,"for","due"),A(Ie,"class","accesskey-first"),A(N,"id","due"),A(N,"type","text"),A(N,"placeholder",Hs),A(N,"accesskey",w=r[19]("d")),ht(N,"tasks-modal-error",!r[9]),p.a=null,A(g,"for","scheduled"),A(g,"class","accesskey-first"),A(_,"id","scheduled"),A(_,"type","text"),A(_,"placeholder",Hs),A(_,"accesskey",S=r[19]("s")),ht(_,"tasks-modal-error",!r[7]),ge.a=null,A(te,"for","start"),A(ve,"id","start"),A(ve,"type","text"),A(ve,"placeholder",Hs),A(ve,"accesskey",_r=r[19]("a")),ht(ve,"tasks-modal-error",!r[5]),qe.a=null,A(ms,"for","forwardOnly"),A(Me,"id","forwardOnly"),A(Me,"type","checkbox"),A(Me,"class","task-list-item-checkbox tasks-modal-checkbox"),A(Me,"accesskey",Fe=r[19]("f")),A(E,"class","tasks-modal-section tasks-modal-dates"),A(hs,"for","status"),A(Et,"id","status-type"),A(Et,"class","dropdown"),A(Et,"accesskey",Vt=r[19]("u")),r[1].status===void 0&&Fa(()=>r[46].call(Et)),A(Va,"class","tasks-modal-warning"),A(vr,"class","tasks-modal-section"),A(Qa,"for","status"),A(dn,"id","status"),A(dn,"type","checkbox"),A(dn,"class","task-list-item-checkbox tasks-modal-checkbox"),dn.checked=Xa=r[1].status.isCompleted(),dn.disabled=!0,A(Ka,"class","tasks-modal-section tasks-modal-status"),A(Za,"for","created"),A(or,"id","created"),A(or,"type","text"),A(or,"placeholder",Hs),ht(or,"tasks-modal-error",!r[3]),Ja.a=null,A(eo,"for","done"),A(ur,"id","done"),A(ur,"type","text"),A(ur,"placeholder",Hs),ht(ur,"tasks-modal-error",!r[12]),to.a=null,A(ro,"for","cancelled"),A(lr,"id","cancelled"),A(lr,"type","text"),A(lr,"placeholder",Hs),ht(lr,"tasks-modal-error",!r[14]),no.a=null,A(Ye,"class","tasks-modal-section tasks-modal-dates"),Ln.disabled=so=!r[18],A(Ln,"type","submit"),A(Ln,"class","mod-cta"),A(Ti,"type","button"),A(gs,"class","tasks-modal-section tasks-modal-buttons"),ht(t,"with-accesskeys",r[15]),A(e,"class","tasks-modal")},m(q,re){Bs(q,e,re),O(e,t),O(t,n),O(n,s),O(n,i),O(n,a),mt(a,r[1].description),r[38](a),O(t,u),O(t,l),O(l,c),O(c,f),O(l,y);for(let me=0;me<kt.length;me+=1)kt[me]&&kt[me].m(l,null);O(t,k),O(t,E),O(E,x),O(E,v),O(E,I),mt(I,r[1].recurrenceRule),O(E,le),O(E,B),O(B,ie),O(B,W),j.m(r[17],B),O(E,ce),O(E,Ie),O(E,$),O(E,N),mt(N,r[1].dueDate),O(E,H),O(E,C),O(C,X),O(C,d),p.m(r[8],C),O(E,h),O(E,g),O(E,T),O(E,_),mt(_,r[1].scheduledDate),O(E,M),O(E,D),O(D,R),O(D,U),ge.m(r[6],D),O(E,ae),O(E,te),O(E,Re),O(E,ve),mt(ve,r[1].startDate),O(E,un),O(E,Ft),O(Ft,ln),O(Ft,Ct),qe.m(r[4],Ft),O(E,Ba),O(E,Fn),O(Fn,ms),O(Fn,oe),O(Fn,Me),Me.checked=r[1].forwardOnly,O(t,cn),O(t,vr),O(vr,hs),O(vr,Ha),O(vr,Et);for(let me=0;me<St.length;me+=1)St[me]&&St[me].m(Et,null);xp(Et,r[1].status,!0),O(vr,za),O(vr,Va),O(t,um),O(t,Ka),O(Ka,mi),O(mi,Qa),O(mi,lm),O(mi,dn),O(t,cm),O(t,Ye),O(Ye,Za),O(Ye,dm),O(Ye,or),mt(or,r[1].createdDate),O(Ye,fm),O(Ye,hi),O(hi,pm),O(hi,mm),Ja.m(r[2],hi),O(Ye,hm),O(Ye,eo),O(Ye,gm),O(Ye,ur),mt(ur,r[1].doneDate),O(Ye,ym),O(Ye,gi),O(gi,Tm),O(gi,bm),to.m(r[11],gi),
`);e.setLine(a,y)};new On({app:n,task:u,onSubmit:l}).open()};var Pp=require("obsidian");var S_=(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 s=e.getCursor(),i=s.line,a=e.getLine(i),o=vA(a,n);e.setLine(i,o.text),e.setCursor(wA(s,o))},vA=(r,e)=>{let t=fe.fromLine({line:r,taskLocation:pt.fromUnknownPosition(e),fallbackDate:null});if(t!==null){let n=t.toggleWithRecurrenceInUsersOrder().map(s=>s.toFileLineString());return{text:n.join(`
`),moveTo:{line:n.length-1}}}else{let n=r.match(z.taskRegex);if(n!==null){let s=n[3],a=Ee.getInstance().bySymbol(s).nextStatusSymbol;return{text:r.replace(z.taskRegex,`$1- [${a}] $4`)}}else if(z.listItemRegex.test(r)){let s=r.replace(z.listItemRegex,"$1$2 [ ]");return{text:s,moveTo:{ch:s.length}}}else{let s=r.replace(z.indentationRegex,"$1- ");return{text:s,moveTo:{ch:s.length}}}}},wA=(r,e)=>{var i;let t={line:0,ch:r.ch},n=ke(ke({},t),(i=e.moveTo)!=null?i:{}),s=e.text.split(`
`)[n.line].length;return{line:r.line+n.line,ch:Math.min(n.ch,s)}};var yu=class{get app(){return this.plugin.app}constructor({plugin:e}){this.plugin=e,e.addCommand({id:"edit-task",name:"Create or edit task",icon:"pencil",editorCheckCallback:(t,n,s)=>k_(t,n,s,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:S_})}};var EA=Object.prototype.toString,Vs=Array.isArray||function(e){return EA.call(e)==="[object Array]"};function Ip(r){return typeof r=="function"}function kA(r){return Vs(r)?"array":typeof r}function Np(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function O_(r,e){return r!=null&&typeof r=="object"&&e in r}function SA(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var OA=RegExp.prototype.test;function DA(r,e){return OA.call(r,e)}var xA=/\S/;function RA(r){return!DA(xA,r)}var MA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function CA(r){return String(r).replace(/[&<>"'`=\/]/g,function(t){return MA[t]})}var AA=/\s*/,PA=/\s+/,D_=/\s*=/,NA=/\s*\}/,IA=/#|\^|\/|>|\{|&|=|!/;function FA(r,e){if(!r)return[];var t=!1,n=[],s=[],i=[],a=!1,o=!1,u="",l=0;function c(){if(a&&!o)for(;i.length;)delete s[i.pop()];else i=[];a=!1,o=!1}var f,m,y;function k(j){if(typeof j=="string"&&(j=j.split(PA,2)),!Vs(j)||j.length!==2)throw new Error("Invalid tags: "+j);f=new RegExp(Np(j[0])+"\\s*"),m=new RegExp("\\s*"+Np(j[1])),y=new RegExp("\\s*"+Np("}"+j[1]))}k(e||sr.tags);for(var E=new Ua(r),x,v,I,F,le,B;!E.eos();){if(x=E.pos,I=E.scanUntil(f),I)for(var ie=0,W=I.length;ie<W;++ie)F=I.charAt(ie),RA(F)?(i.push(s.length),u+=F):(o=!0,t=!0,u+=" "),s.push(["text",F,x,x+1]),x+=1,F===`
`&&(c(),u="",l=0,t=!1);if(!E.scan(f))break;if(a=!0,v=E.scan(IA)||"name",E.scan(AA),v==="="?(I=E.scanUntil(D_),E.scan(D_),E.scanUntil(m)):v==="{"?(I=E.scanUntil(y),E.scan(NA),E.scanUntil(m),v="&"):I=E.scanUntil(m),!E.scan(m))throw new Error("Unclosed tag at "+E.pos);if(v==">"?le=[v,I,x,E.pos,u,l,t]:le=[v,I,x,E.pos],l++,s.push(le),v==="#"||v==="^")n.push(le);else if(v==="/"){if(B=n.pop(),!B)throw new Error('Unopened section "'+I+'" at '+x);if(B[1]!==I)throw new Error('Unclosed section "'+B[1]+'" at '+x)}else v==="name"||v==="{"||v==="&"?o=!0:v==="="&&k(I)}if(c(),B=n.pop(),B)throw new Error('Unclosed section "'+B[1]+'" at '+E.pos);return UA(LA(s))}function LA(r){for(var e=[],t,n,s=0,i=r.length;s<i;++s)t=r[s],t&&(t[0]==="text"&&n&&n[0]==="text"?(n[1]+=t[1],n[3]=t[3]):(e.push(t),n=t));return e}function UA(r){for(var e=[],t=e,n=[],s,i,a=0,o=r.length;a<o;++a)switch(s=r[a],s[0]){case"#":case"^":t.push(s),n.push(s),t=s[4]=[];break;case"/":i=n.pop(),i[5]=s[2],t=n.length>0?n[n.length-1][4]:e;break;default:t.push(s)}return e}function Ua(r){this.string=r,this.tail=r,this.pos=0}Ua.prototype.eos=function(){return this.tail===""};Ua.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};Ua.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 zs(r,e){this.view=r,this.cache={".":this.view},this.parent=e}zs.prototype.push=function(e){return new zs(e,this)};zs.prototype.lookup=function(e){var t=this.cache,n;if(t.hasOwnProperty(e))n=t[e];else{for(var s=this,i,a,o,u=!1;s;){if(e.indexOf(".")>0)for(i=s.view,a=e.split("."),o=0;i!=null&&o<a.length;)o===a.length-1&&(u=O_(i,a[o])||SA(i,a[o])),i=i[a[o++]];else i=s.view[e],u=O_(s.view,e);if(u){n=i;break}s=s.parent}t[e]=n}return Ip(n)&&(n=n.call(this.view)),n};function Mt(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Mt.prototype.clearCache=function(){typeof this.templateCache!="undefined"&&this.templateCache.clear()};Mt.prototype.parse=function(e,t){var n=this.templateCache,s=e+":"+(t||sr.tags).join(":"),i=typeof n!="undefined",a=i?n.get(s):void 0;return a==null&&(a=FA(e,t),i&&n.set(s,a)),a};Mt.prototype.render=function(e,t,n,s){var i=this.getConfigTags(s),a=this.parse(e,i),o=t instanceof zs?t:new zs(t,void 0);return this.renderTokens(a,o,n,e,s)};Mt.prototype.renderTokens=function(e,t,n,s,i){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,s,i):u==="^"?l=this.renderInverted(o,t,n,s,i):u===">"?l=this.renderPartial(o,t,n,i):u==="&"?l=this.unescapedValue(o,t):u==="name"?l=this.escapedValue(o,t,i):u==="text"&&(l=this.rawValue(o)),l!==void 0&&(a+=l);return a};Mt.prototype.renderSection=function(e,t,n,s,i){var a=this,o="",u=t.lookup(e[1]);function l(m){return a.render(m,t,n,i)}if(!!u){if(Vs(u))for(var c=0,f=u.length;c<f;++c)o+=this.renderTokens(e[4],t.push(u[c]),n,s,i);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")o+=this.renderTokens(e[4],t.push(u),n,s,i);else if(Ip(u)){if(typeof s!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(t.view,s.slice(e[3],e[5]),l),u!=null&&(o+=u)}else o+=this.renderTokens(e[4],t,n,s,i);return o}};Mt.prototype.renderInverted=function(e,t,n,s,i){var a=t.lookup(e[1]);if(!a||Vs(a)&&a.length===0)return this.renderTokens(e[4],t,n,s,i)};Mt.prototype.indentPartial=function(e,t,n){for(var s=t.replace(/[^ \t]/g,""),i=e.split(`
`),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=s+i[a]);return i.join(`
`)};Mt.prototype.renderPartial=function(e,t,n,s){if(!!n){var i=this.getConfigTags(s),a=Ip(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,i);return this.renderTokens(f,t,n,c,s)}}};Mt.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(n!=null)return n};Mt.prototype.escapedValue=function(e,t,n){var s=this.getConfigEscape(n)||sr.escape,i=t.lookup(e[1]);if(i!=null)return typeof i=="number"&&s===sr.escape?String(i):s(i)};Mt.prototype.rawValue=function(e){return e[1]};Mt.prototype.getConfigTags=function(e){return Vs(e)?e:e&&typeof e=="object"?e.tags:void 0};Mt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Vs(e))return e.escape};var sr={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){La.templateCache=r},get templateCache(){return La.templateCache}},La=new Mt;sr.clearCache=function(){return La.clearCache()};sr.parse=function(e,t){return La.parse(e,t)};sr.render=function(e,t,n,s){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+kA(e)+'" was given as the first argument for mustache#render(template, view, partials)');return La.render(e,t,n,s)};sr.escape=CA;sr.Scanner=Ua;sr.Context=zs;sr.Writer=Mt;var Fp=sr;var A_=vi(C_());function P_(r,e){Fp.escape=function(t){return t};try{return Fp.render(r,(0,A_.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 Tu(r){return{query:{file:new Ws(r)}}}function is(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 sn=class{constructor(e,t,n,s){this.instruction=e,this.property=t,this.comparator=sn.maybeReverse(s,n)}static maybeReverse(e,t){return e?sn.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var Dn=class{constructor(e,t,n,s){this.instruction=e,this.property=t,this.grouper=n,this.reverse=s}};var Oe=class{canCreateFilterForLine(e){return Oe.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 ou(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=Oe.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createSorter(n)}sorterRegExp(){if(!this.supportsSorting())throw Error(`sorterRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)?`,"i")}sorterInstruction(e){let t=`sort by ${this.fieldNameSingular()}`;return e&&(t+=" reverse"),t}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new sn(this.sorterInstruction(e),this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}createGrouperFromLine(e){if(!this.supportsGrouping())return null;let t=Oe.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createGrouper(n)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)?$`,"i")}grouperInstruction(e){let t=`group by ${this.fieldNameSingular()}`;return e&&(t+=" reverse"),t}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(e){return new Dn(this.grouperInstruction(e),this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};var De=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 De("None of",e,"NOT")}static booleanXor(e){return new De("Exactly one of",e,"XOR")}asString(e=""){if(this.children.length==0)return e+this.description;let t=e;this.symbol===""?t+=this.description:(t+=this.symbol,this.children.length>1&&(t+=` (${this.description})`),t+=":");let n=e+" ";for(let s=0;s<this.children.length;s++)t+=`
${this.children[s].asString(n)}`;return t}static combineOrCreateExplanation(e,t,n){if(t.length===2){let s=t[0],i=t[1];if(s.symbol===n&&i.symbol==="")return s.children.push(i),s}return new De(e,t,n)}};var _t=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} =>
11 months ago
${t.asString(e+" ")}
`}};var Mr=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 Mr(e);return n._queryComponent=t,n}static fromError(e,t){let n=new Mr(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(Mr.fromObject(e.instruction,e))}static fromError(e,t){return new J(Mr.fromError(e,t))}};var bu=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 _t(e,this._filter,new De(e))):J.fromError(e,`do not understand filter: ${e}`)}};var Cr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new bu(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 xn=class extends Oe{constructor(){super(...arguments);this._filters=new Cr}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var Ar=class extends xn{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=Ar.oldStatusName(e),s=Ar.oldStatusName(t);return n<s?1:n>s?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[Ar.oldStatusName(e)]}};var _u=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 at=class extends Oe{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new Cr,this.filterInstructions.add(`has ${this.fieldName()} date`,n=>this.date(n)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,n=>this.date(n)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,n=>{let s=this.date(n);return s!==null&&!s.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){var m;let n=this.checkForUnexpandedTemplateText(t);if(n)return J.fromError(t,n);let s=this.filterInstructions.createFilterOrErrorMessage(t);if(s.filter!==void 0)return s;let i=Oe.getMatch(this.filterRegExp(),t);if(i===null)return J.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let a=i[1],o=(m=i[2])==null?void 0:m.toLowerCase(),u=i[3],l=Wt.parseDateRange(u);if(!l.isValid()){let y=Wt.parseDate(a);y.isValid()&&(l=new Dt(y,y))}if(!l.isValid())return J.fromError(t,"do not understand "+this.fieldName()+" date");let c=this.buildFilterFunction(o,l),f=at.buildExplanation(this.fieldNameForExplanation(),o,this.filterResultIfFieldMissing(),l);return J.fromFilter(new _t(t,c,f))}buildFilterFunction(t,n){let s;switch(t){case"before":s=i=>i?i.isBefore(n.start):this.filterResultIfFieldMissing();break;case"after":s=i=>i?i.isAfter(n.end):this.filterResultIfFieldMissing();break;case"on or before":case"in or before":s=i=>i?i.isSameOrBefore(n.end):this.filterResultIfFieldMissing();break;case"on or after":case"in or after":s=i=>i?i.isSameOrAfter(n.start):this.filterResultIfFieldMissing();break;default:s=i=>i?i.isSameOrAfter(n.start)&&i.isSameOrBefore(n.end):this.filterResultIfFieldMissing()}return this.getFilter(s)}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,s,i){let a=n,o="YYYY-MM-DD (dddd Do MMMM YYYY)",u;switch(n){case"before":case"on or after":u=i.start.format(o);break;case"after":case"on or before":u=i.end.format(o);break;case"in or before":a="on or before",u=i.end.format(o);break;case"in or after":a="on or after",u=i.start.format(o);break;default:if(!i.start.isSame(i.end)){let c=`${t} date is between:`,f=[new De(`${i.start.format(o)} and`),new De(`${i.end.format(o)} inclusive`)];return s&&f.push(new De(`OR no ${t} date`)),new De(c,f)}a="on",u=i.start.format(o);break}let l=`${t} date is ${a} ${u}`;return s&&(l+=` OR no ${t} date`),new De(l)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>Xr(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 _u().findUnexpandedDateText(t)}};var Ks=class extends at{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}};var Up=class extends Oe{createFilterOrErrorMessage(e){var n;let t=Oe.getMatch(this.filterRegExp(),e);if(t!==null){let s=t[5],i=null;switch(s.toLowerCase()){case"lowest":i="5";break;case"low":i="4";break;case"none":i="3";break;case"medium":i="2";break;case"high":i="1";break;case"highest":i="0";break}if(i===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(i)<0;break;case"below":o=u=>u.priority.localeCompare(i)>0;break;case"not":o=u=>u.priority!==i;break;default:o=u=>u.priority===i,a=`${this.fieldName()} is ${s}`}return J.fromFilter(new _t(e,o,new De(a)))}else return J.fromError(e,"do not understand query filter (priority)")}fieldName(){return"priority"}filterRegExp(){return Up.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 s=qA(t,"using regex: ",this.regexAsString());return new De(s)}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 qA(r,e,t){var o;let n=r.match(/\//);if(!n)return"Error explaining instruction. Could not find a slash character";let s=2,i=((o=n.index)!=null?o:s)-s;return`${e.padEnd(i)}${t}`}var Pe=class extends Oe{createFilterOrErrorMessage(e){let t=Oe.getMatch(this.filterRegExp(),e);if(t===null)return J.fromError(e,`do not understand query filter (${this.fieldName()})`);let n=t[1].toLowerCase(),s=t[2],i=null;if(n.includes("include"))i=new Xs(s);else if(n.includes("regex")){try{i=Rn.validateAndConstruct(s)}catch(u){let l=is("Parsing regular expression",u)+`
1 year ago
11 months ago
${Rn.helpMessage()}`;return J.fromError(e,l)}if(i===null)return J.fromError(e,`Invalid instruction: '${e}'
1 year ago
11 months ago
${Rn.helpMessage()}`)}if(i===null)return J.fromError(e,`do not understand query filter (${this.fieldName()})`);let a=n.match(/not/)!==null,o=new _t(e,this.getFilter(i,a),i.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 s=e.matches(this.value(n));return t?!s:s}}comparator(){return(e,t)=>this.value(e).localeCompare(this.value(t),void 0,{numeric:!0})}grouper(){return e=>[this.value(e)]}static escapeMarkdownCharacters(e){return e.replace(/\\/g,"\\\\").replace(/_/g,"\\_")}};var Zs=class extends Pe{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var Js=class extends Oe{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return J.fromError(e,"Filtering by urgency is not yet supported")}fieldName(){return"urgency"}filterRegExp(){throw Error(`filterRegExp() unimplemented for ${this.fieldName()}`)}supportsSorting(){return!0}comparator(){return(e,t)=>t.urgency-e.urgency}supportsGrouping(){return!0}grouper(){return e=>[`${e.urgency.toFixed(2)}`]}createGrouper(e){return super.createGrouper(!e)}grouperInstruction(e){return super.grouperInstruction(!e)}};var ei=class{static by(e,t){let n=[new Js().comparator(),new Ar().comparator(),new Ks().comparator(),new as().comparator(),new Zs().comparator()],s=[];for(let i of e)s.push(i.comparator);return t.sort(ei.makeCompositeComparator([...s,...n]))}static makeCompositeComparator(e){return(t,n)=>{for(let s of e){let i=s(t,n);if(i!==0)return i}return 0}}};var vu=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var wu=class{constructor(e,t){this.lastHeadingAtLevel=new Array;this.groupers=t;let s=e.keys().next().value.length;for(let i=0;i<s;i++)this.lastHeadingAtLevel.push("")}getHeadingsForTaskGroup(e){let t=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s!=this.lastHeadingAtLevel[n]){t.push(new vu(n,s,this.groupers[n].property));for(let i=n;i<e.length;i++)this.lastHeadingAtLevel[i]="";this.lastHeadingAtLevel[n]=s}}return t}};var Eu=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,s]of this.children)e.push(n),s.generateAllPaths(e).forEach((a,o)=>t.set(o,a)),e.pop();return t}};var ku=class extends Eu{},Su=class{constructor(e,t,n){this.root=new ku(t),this.buildGroupingTree(e,n)}buildGroupingTree(e,t){let n=[this.root];for(let s of e){let i=[];for(let a of n)for(let o of a.values){let u=s.grouper(o,t);u.length===0&&u.push("");for(let l of u){let c=a.children.get(l);c===void 0&&(c=new ku([]),a.children.set(l,c),i.push(c)),c.values.push(o)}}n=i}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var Ou=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 ti=class{constructor(e,t,n){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let i=new Su(e,t,n).generateTaskTreeStorage();this.addTaskGroups(i),this.sortTaskGroups(),this.setGroupsHeadings(i)}get groupers(){return this._groupers}get groups(){return this._groups}totalTasksCount(){return this._totalTaskCount}toString(){let e="";e+=`Groupers (if any):
`;for(let n of this._groupers){let s=n.reverse?" reverse":"";e+=`- ${n.property}${s}
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 s=new Ou(t,n);this.addTaskGroup(s)}}addTaskGroup(e){this._groups.push(e)}sortTaskGroups(){let e=(t,n)=>{let s=t.groups,i=n.groups;for(let a=0;a<s.length;a++){let o=this._groupers[a],u=s[a].localeCompare(i[a],void 0,{numeric:!0});if(u!==0)return o.reverse?-u:u}return 0};this._groups.sort(e)}setGroupsHeadings(e){let t=new wu(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 os=class extends Pe{fieldName(){return"description"}value(e){return ye.getInstance().removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=os.cleanDescription(e.description),s=os.cleanDescription(t.description);return n.localeCompare(s,void 0,{numeric:!0})}}static cleanDescription(e){e=ye.getInstance().removeAsSubstringFrom(e);let t=/^\[\[?([^\]]*)]]?/,n=e.match(t);if(n!==null){let s=n[1];e=s.substring(s.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 Du=class extends at{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var xu=class extends at{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var Ru=class extends xn{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 qa=class extends Mr{};function qp(r,e){let t=r.map(([n])=>n);try{let n=e.includes("return")?e:`return ${e}`,s=e&&new Function(...t,n);return s instanceof Function?qa.fromObject(e,s):qa.fromError(e,"Error parsing group function")}catch(n){return qa.fromError(e,is(`Failed parsing expression "${e}"`,n))}}function Wp(r,e){let t=e.map(([n,s])=>s);return r(...t)}function Yp(r,e,t){try{return Wp(r,e)}catch(n){return is(`Failed calculating expression "${t}"`,n)}}function Mu(r,e){return[["task",r],["query",e?e.query:null]]}function N_(r,e,t){let n=Mu(r,t||null),s=qp(n,e);return s.error?s.error:Yp(s.queryComponent,n,e)}var Cu=class{constructor(e){this.line=e,this.functionOrError=qp(Mu(null,null),e)}isValid(){return this.functionOrError.error===void 0}get parseError(){return this.functionOrError.error}evaluate(e,t){if(!this.isValid())throw Error(`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`);return Wp(this.functionOrError.queryComponent,Mu(e,t||null))}evaluateOrCatch(e,t){return this.isValid()?Yp(this.functionOrError.queryComponent,Mu(e,t),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};var Au=class extends Oe{createFilterOrErrorMessage(e){let t=Oe.getMatch(this.filterRegExp(),e);if(t===null)return J.fromError(e,"Unable to parse line");let n=t[1],s=new Cu(n);return s.isValid()?J.fromFilter(new _t(e,WA(s),new De(e))):J.fromError(e,s.parseError)}fieldName(){return"function"}filterRegExp(){return new RegExp(`^filter by ${this.fieldNameSingularEscaped()} (.*)`,"i")}supportsGrouping(){return!0}createGrouperFromLine(e){let t=Oe.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1],s=t[2];return new Dn(e,"function",GA(s),n)}grouperRegExp(){return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`,"i")}grouper(){throw Error("grouper() function not valid for FunctionField. Use createGrouperFromLine() instead.")}};function WA(r){return(e,t)=>{let n=t.queryContext();return YA(r,e,n)}}functi
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=Mn.groupName(e),s=Mn.groupName(t);return n.localeCompare(s,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[Mn.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var zu=class extends Pe{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 Vu=class extends Pe{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(this.value(e))]}};var Ku=class extends Pe{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(this.value(e))]}};var Qu=class extends Pe{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 Xu=class extends at{fieldName(){return"cancelled"}date(e){return e.cancelledDate}filterResultIfFieldMissing(){return!1}};var Xp=[()=>new Hu,()=>new Mn,()=>new Ar,()=>new Lu,()=>new as,()=>new Fu,()=>new Xu,()=>new Du,()=>new Iu,()=>new Nu,()=>new Ks,()=>new xu,()=>new Zs,()=>new Vu,()=>new Ku,()=>new Qu,()=>new os,()=>new us,()=>new Pu,()=>new Ru,()=>new Bu,()=>new Js,()=>new zu,()=>new Au,()=>new ju];function $u(r){for(let e of Xp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function K_(r){let e=/^sort by /i;if(r.match(e)===null)return null;for(let t of Xp){let s=t().createSorterFromLine(r);if(s)return s}return null}function Q_(r){let e=/^group by /i;if(r.match(e)===null)return null;for(let t of Xp){let s=t().createGrouperFromLine(r);if(s)return s}return null}var Cn=class{constructor(e,t){this.queryPath=e,this.allTasks=[...t]}static fromAllTasks(e){return new Cn(void 0,e)}queryContext(){return this.queryPath?Tu(this.queryPath):void 0}};function X_(r){return`task${r!==1?"s":""}`}var ds=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} ${X_(e)}`:`${e} of ${t} ${X_(t)}`}get groups(){return this.taskGroups.groups}static fromError(e){let t=new ds(new ti([],[],Cn.fromAllTasks([])),0);return t._searchErrorMessage=e,t}};function Z_(r){return r.endsWith("\\")}function J_(r){return r.endsWith("\\\\")}function gP(r){return r.replace(/^[ \t]*/,"")}function yP(r){return r.replace(/[ \t]*\\$/,"")}function TP(r,e){let t=r;return e&&(t=gP(r)),J_(t)?t=t.slice(0,-1):Z_(r)&&(t=yP(t)),t}function bP(r,e,t){e?r[r.length-1]+=" "+t:r.push(t)}function _P(r){let e=[],t=!1;for(let n of r.split(`
`)){let s=TP(n,t);bP(e,t,s),J_(n)?t=!1:t=Z_(n)}return e.join(`
`)}function ev(r){return _P(r).split(`
`).map(e=>e.trim()).filter(e=>e!=="")}var li=class{constructor(e=""){this.indentation=e}explainQuery(e){if(e.error!==void 0)return this.explainError(e);let t=[];return t.push(this.explainFilters(e)),t.push(this.explainGroups(e)),t.push(this.explainSorters(e)),t.push(this.explainQueryLimits(e)),t.push(this.explainDebugSettings()),t.filter(n=>n!=="").join(`
`)}explainError(e){let t="";return t+=`Query has an error:
`,t+=e.error+`
`,t}explainFilters(e){return e.filters.length===0?this.indent(`No filters supplied. All tasks will match the query.
`):e.filters.map(n=>n.explainFilterIndented(this.indentation)).join(`
`)}explainGroups(e){let t=e.grouping.length;if(t===0)return this.indent(`No grouping instructions supplied.
`);let n="";for(let s=0;s<t;s++)n+=this.indentation+e.grouping[s].instruction+`
`;return n}explainSorters(e){let t=e.sorting.length;if(t===0)return this.indent(`No sorting instructions supplied.
`);let n="";for(let s=0;s<t;s++)n+=this.indentation+e.sorting[s].instruction+`
`;return n}explainQueryLimits(e){function t(s){let i=`At most ${s} task`;return s!==1&&(i+="s"),i}let n=[];if(e.limit!==void 0){let s=t(e.limit)+`.
`;n.push(this.indent(s))}if(e.taskGroupLimit!==void 0){let s=t(e.taskGroupLimit)+` per group (if any "group by" options are supplied).
`;n.push(this.indent(s))}return n.join(`
`)}explainDebugSettings(){let e="",{debugSettings:t}=K();return t.ignoreSortInstructions&&(e+=this.indent(`NOTE: All sort instructions, including default sort order, are disabled, due to 'ignoreSortInstructions' setting.
`)),e}indent(e){return this.indentation+e}};var on=class{constructor(e,t=void 0){this._limit=void 0;this._taskGroupLimit=void 0;this._taskLayoutOptions=new Jn;this._queryLayoutOptions=new wn;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this._ignoreGlobalQuery=!1;this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|cancelled date|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|postpone button|urgency|tags)/i;this.shortModeRegexp=/^short/i;this.fullModeRegexp=/^full/i;this.explainQueryRegexp=/^explain/i;this.ignoreGlobalQueryRegexp=/^ignore global query/i;this.logger=Rt.getLogger("tasks.Query");this._queryId="";this.limitRegexp=/^limit (groups )?(to )?(\d+)( tasks?)?/i;this.commentRegexp=/^#.*/;this._queryId=this.generateQueryId(10),this.source=e,this.filePath=t,this.debug(`Creating query: ${this.formatQueryForLogging()}`),ev(e).forEach(n=>{let s=this.expandPlaceholders(n,t);if(this.error===void 0)switch(!0){case this.shortModeRegexp.test(s):this._queryLayoutOptions.shortMode=!0;break;case this.fullModeRegexp.test(s):this._queryLayoutOptions.shortMode=!1;break;case this.explainQueryRegexp.test(s):this._queryLayoutOptions.explainQuery=!0;break;case this.ignoreGlobalQueryRegexp.test(s):this._ignoreGlobalQuery=!0;break;case this.limitRegexp.test(s):this.parseLimit(s);break;case this.parseSortBy(s):break;case this.parseGroupBy(s):break;case this.hideOptionsRegexp.test(s):this.parseHideOptions(s);break;case this.commentRegexp.test(s):break;case this.parseFilter(s):break;default:this.setError("do not understand query",s)}})}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 s=Tu(t);try{n=P_(e,s)}catch(i){return i instanceof Error?this._error=i.message:this._error="Internal error. expandPlaceholders() threw something other than Error.",e}}return n}append(e){return this.source===""?e:e.source===""?this:new on(`${this.source}
${e.source}`,this.filePath)}explainQuery(){return new li().explainQuery(this)}get limit(){return this._limit}get taskGroupLimit(){return this._taskGroupLimit}get taskLayoutOptions(){return this._taskLayoutOptions}get queryLayoutOptions(){return this._queryLayoutOptions}get filters(){return this._filters}addFilter(e){this._filters.push(e)}get sorting(){return this._sorting}get grouping(){return this._grouping}get error(){return this._error}setError(e,t){this._error=`${e}
Problem line: "${t}"`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){this.debug(`Executing query: ${this.formatQueryForLogging()}`);let t=new Cn(this.filePath,e);try{this.filters.forEach(o=>{e=e.filter(u=>o.filterFunction(u,t))});let{debugSettings:n}=K(),s=n.ignoreSortInstructions?e:ei.by(this.sorting,e),i=s.slice(0,this.limit),a=new ti(this.grouping,i,t);return this._taskGroupLimit!==void 0&&a.applyTaskLimit(this._taskGroupLimit),new ds(a,s.length)}catch(n){let s="Search failed";return ds.fromError(is(s,n))}}parseHideOptions(e){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1].toLowerCase()==="hide";switch(t[2].toLowerCase()){case"task count":this._queryLayoutOptions.hideTaskCount=n;break;case"backlink":this._queryLayoutOptions.hideBacklinks=n;break;case"postpone button":this._queryLayoutOptions.hidePostponeButton=n;break;case"priority":this._taskLayoutOptions.hidePriority=n;break;case"cancelled date":this._taskLayoutOptions.hideCancelledDate=n;break;case"created date":this._taskLayoutOptions.hideCreatedDate=n;break;case"start date":this._taskLayoutOptions.hideStartDate=n;break;case"scheduled date":this._taskLayoutOptions.hideScheduledDate=n;break;case"due date":this._taskLayoutOptions.hideDueDate=n;break;case"done date":this._taskLayoutOptions.hideDoneDate=n;break;case"recurrence rule":this._taskLayoutOptions.hideRecurrenceRule=n;break;case"edit button":this._queryLayoutOptions.hideEditButton=n;break;case"urgency":this._queryLayoutOptions.hideUrgency=n;break;case"tags":this._taskLayoutOptions.hideTags=n;break;default:this.setError("do not understand hide/show option",e)}}}parseFilter(e){var n;let t=$u(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=K_(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=Q_(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 An=class{constructor(e=An.empty){this._source=e}static getInstance(){return An.instance||(An.instance=new An),An.instance}set(e){this._source=e}query(e=void 0){return new on(this._source,e)}hasInstructions(){return this._source.trim()!==An.empty}},ar=An;ar.empty="";var Zu=class{constructor({obsidianEvents:e}){this.logger=Rt.getLogger("tasks.Events");this.obsidianEvents=e}onCacheUpdate(e){return this.logger.debug("TasksEvents.onCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.logger.debug("TasksEvents.triggerCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.logger.debug("TasksEvents.onRequestCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.logger.debug("TasksEvents.triggerRequestCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.logger.debug("TasksEvents.off()"),this.obsidianEvents.offref(e)}};var Ga=require("obsidian");var Ya,Zp,Jp,vP=["md"];function tl(){return Rt.getLogger("tasks.File")}var tv=({metadataCache:r,vault:e,workspace:t})=>{Ya=r,Zp=e,Jp=t},ci=t=>L(void 0,[t],function*({originalTask:r,newTasks:e}){if(Zp===void 0||Ya===void 0||Jp===void 0){Ju("Tasks: cannot use File before initializing it.");return}Array.isArray(e)||(e=[e]);let n=tl(),s="replaceTaskWithTasks()";du(n,s,r),fu(n,s,e),nv({originalTask:r,newTasks:e,vault:Zp,metadataCache:Ya,workspace:Jp,previousTries:0})});function Ju(r){console.error(r),new Ga.Notice(r,15e3)}function rv(r){console.warn(r),new Ga.Notice(r,1e4)}function wP(r){tl().debug(r)}var Pn=class extends Error{},el=
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
`;Ju(c);return}let l=Math.min(Math.pow(10,i),100);o.debug(`timeout = ${l}`),setTimeout(()=>{nv({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:s,previousTries:i+1})},l)};try{let[l,c,f]=yield sv(r,t),m=[...f.slice(0,l),...e.map(y=>y.toFileLineString()),...f.slice(l+1)];yield t.modify(c,m.join(`
`))}catch(l){if(l instanceof Pn)return l.message&&rv(l.message),u();if(l instanceof el)return u();l instanceof Error&&Ju(l.message)}});function sv(r,e){return L(this,null,function*(){if(Ya===void 0)throw new Pn;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof Ga.TFile))throw new Pn(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!vP.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=Ya.getFileCache(t);if(n==null||n===null)throw new Pn(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let s=n.listItems;if(s===void 0||s.length===0)throw new Pn(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let a=(yield e.read(t)).split(`
`),o=EP(r,a,s,wP);if(o===void 0)throw new el;return[o,t,a]})}function em(r,e){return L(this,null,function*(){try{let[t,n,s]=yield sv(r,e);return[t,n]}catch(t){t instanceof Pn?t.message&&rv(t.message):t instanceof Error&&Ju(t.message)}})}function iv(r,e){return r<e.length}function EP(r,e,t,n){let s=kP(r,e);return s!==void 0||(s=SP(r,e),s!==void 0)?s:OP(r,e,t,n)}function kP(r,e){let t=r.taskLocation.lineNumber;if(iv(t,e)&&e[t]===r.originalMarkdown)return tl().debug(`Found original markdown at original line number ${t}`),t}function SP(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 OP(r,e,t,n){let s,i=0;for(let a of t){let o=a.position.start.line;if(!iv(o,e))return;if(o<r.taskLocation.sectionStart||a.task===void 0)continue;let u=e[o];if(ye.getInstance().includedIn(u)){if(i===r.taskLocation.sectionIndex){if(u===r.originalMarkdown)s=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}i++}}return s}var lv=require("obsidian");var uv=require("obsidian");var rl=class{constructor(){this.data=DP}addDataAttribute(e,t,n){this.data[n].addDataAttribute(e,t,n)}addClassName(e,t){let n=this.data[t].className;e.classList.add(n)}},tm=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){if(this.attributeName===tm.noAttributeName)return;let s=this.attributeValueCalculator(n,t);s!==""&&(e.dataset[this.attributeName]=s)}},Ce=tm;Ce.noAttributeName="",Ce.noAttributeValueCalculator=()=>"",Ce.dateAttributeCalculator=(e,t)=>{let s="far";function i(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+=s,l)}let a=t[e];if(a instanceof window.moment){let o=i(a);if(o)return o}return""};var DP={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),cancelledDate:new Ce("task-cancelled","taskCancelled",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)=>rn.priorityNameUsingNormal(e.priority).toLocaleLowerCase()),blockLink:new Ce("task-block-link",Ce.noAttributeName,Ce.noAttributeValueCalculator)};var rm=class{constructor(e){this.newStatus=e}apply(e){return this.isCheckedForTask(e)?[e]:e.handleNewStatusWithRecurrenceInUsersOrder(this.newStatus)}instructionDisplayName(){return`Change status to: [${this.newStatus.symbol}] ${this.newStatus.name}`}isCheckedForTask(e){return this.newStatus.symbol===e.status.symbol}};function av(r){let e=[],t=new Ne().coreStatuses.map(n=>n.symbol);for(let n of[!0,!1])for(let s of r.registeredStatuses)t.includes(s.symbol)===n&&e.push(new rm(s));return e}var ov=require("obsidian");function ja(r,e){return L(this,null,function*(){yield ci({originalTask:r,newTasks:e})})}var di=class extends ov.Menu{constructor(t){super();this.taskSaver=t}addItemsForInstructions(t,n){for(let s of t)this.addItemForInstruction(n,s)}addItemForInstruction(t,n){this.addItem(s=>this.getMenuItemCallback(t,s,n))}getMenuItemCallback(t,n,s){n.setTitle(s.instructionDisplayName()).setChecked(s.isCheckedForTask(t)).onClick(()=>L(this,null,function*(){let i=s.apply(t);(i.length!==1||!Object.is(i[0],t))&&(yield this.taskSaver(t,i))}))}};var nl=class extends di{constructor(e,t,n=ja){super(n);let s=av(e);this.addItemsForInstructions(s,t)}};var Nn=class{static obsidianMarkdownRenderer(e,t,n,s){return L(this,null,function*(){if(!s)throw new Error("Must call the Obsidian renderer with an Obsidian Component object");yield uv.MarkdownRenderer.renderMarkdown(e,t,n,s)})}constructor({textRenderer:e=Nn.obsidianMarkdownRenderer,obsidianComponent:t,parentUlElement:n,taskLayoutOptions:s,queryLayoutOptions:i}){this.textRenderer=e,this.obsidianComponent=t,this.parentUlElement=n,this.taskLayoutOptions=s,this.queryLayoutOptions=i}renderTaskLine(e,t,n){return L(this,null,function*(){let s=document.createElement("li");this.parentUlElement.appendChild(s),s.classList.add("task-list-item","plugin-tasks-list-item");let i=document.createElement("span");s.appendChild(i),i.classList.add("tasks-list-text"),yield this.taskToHtml(e,i,s);let a=document.createElement("input");return s.appendChild(a),a.classList.add("task-list-item-checkbox"),a.type="checkbox",e.status.symbol!==" "&&(a.checked=!0,s.classList.add("is-checked")),a.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),a.disabled=!0;let u=e.toggleWithRecurrenceInUsersOrder();ci({originalT
`);if(y===void 0)return!1;let k=null;for(let x=0;x<y.length;x=x+1)if(y[x]!==""){k=y[x];break}return k===null?!1:ye.getInstance().includedIn(k)});if(s.length===0)return;let i=t.sourcePath,a=t.getSectionInfo(e);if(a===null)return;let o=a.text.split(`
`),u=0,l=[];for(let m=a.lineStart;m<=a.lineEnd;m++){let y=o[m];if(y===void 0)continue;let k=null,E=fe.fromLine({line:y,taskLocation:new pt(i,m,a.lineStart,u,k),fallbackDate:null});E!==null&&(l.push(E),u++)}let c=new Nn({obsidianComponent:n,parentUlElement:e,taskLayoutOptions:new Jn,queryLayoutOptions:new wn});for(let m=0;m<s.length;m++){let y=l[m],k=s[m];if(y===void 0||k===void 0)continue;let E=(f=k.getAttr("data-line"))!=null?f:"0",x=Number.parseInt(E,10),v=yield c.renderTaskLine(y,x),I=k.childNodes;for(let B=0;B<I.length;B=B+1){let ie=I[B];ie.nodeName.toLowerCase()==="div"?v.prepend(ie):ie.nodeName.toLowerCase()==="ul"&&v.append(ie)}let F=k.querySelectorAll("[data-footnote-id]"),le=v.querySelectorAll("[data-footnote-id]");if(F.length===le.length)for(let B=0;B<F.length;B++)le[B].replaceWith(F[B]);k.replaceWith(v)}})}};var cv=require("@codemirror/view"),dv=require("obsidian");var fv=()=>cv.ViewPlugin.fromClass(nm),nm=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 m=`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(m),new dv.Notice(m,45e3)}return!1}let{state:s}=this.view,i=this.view.posAtDOM(t),a=s.doc.lineAt(i),o=fe.fromLine({line:a.text,taskLocation:pt.fromUnknownPosition(""),fallbackDate:null});if(o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(m=>m.toFileLineString()).join(s.lineBreak),c=s.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 fi=require("obsidian");function pv(r,e,t,n=void 0){let s="";e.isEmpty()||(s+=`Only tasks containing the global filter '${e.get()}'.
2 years ago
11 months ago
`);let i=new li(" "),a=new on(r,n);if(!a.ignoreGlobalQuery&&t.hasInstructions()){let o=t.query(n);s+=`Explanation of the global query:
2 years ago
11 months ago
${i.explainQuery(o)}
`}return s+=`Explanation of this Tasks code block query:
2 years ago
11 months ago
${i.explainQuery(a)}`,s}function il(r,e,t){let n=new on(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}function mv(r){for(let t of fe.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 al(r){return r.dueDate?"dueDate":r.scheduledDate?"scheduledDate":r.startDate?"startDate":null}function sm(r,e,t,n){let s=r[e];return gv(s,r,e,t,n)}function hv(r,e,t,n){let s=window.moment();return gv(s,r,e,t,n)}function gv(r,e,t,n,s){let i=new He(r).postpone(n,s),a=bt.removeInferredStatusIfNeeded(e,[new fe(ot(ke({},e),{[t]:i}))])[0];return{postponedDate:i,postponedTask:a}}function yv(r,e){let t=r==null?void 0:r.format("DD MMM YYYY");return`Task's ${e} changed to ${t}`}function Tv(r,e,t){return`\u2139\uFE0F ${im(r,e,t)} (right-click for more options)`}function xP(r){return r.charAt(0).toUpperCase()+r.slice(1)}function im(r,e,t){let n=al(r),s=r[n];return _v(n,s,e,t)}function bv(r,e,t){let n=al(r),s=window.moment().startOf("day");return _v(n,s,e,t)}function _v(r,e,t,n){let i=new He(e).postpone(n,t).format("ddd Do MMM"),a=t!=1?t:"a";return e.isSameOrBefore(window.moment(),"day")?`${xP(r.replace("Date",""))} in ${a} ${n}, on ${i}`.replace(" in 0 days"," today").replace("in a day","tomorrow"):`Postpone ${r.replace("Date"," date")} by ${a} ${n}, to ${i}`}var am=require("obsidian");var In=class extends di{constructor(e,t,n=ja){super(n);let s=(l,c,f,m,y,k)=>{let E=y(t,m,f);c.setTitle(E).onClick(()=>In.postponeOnClickCallback(l,t,m,f,k,n))},i=bv,a=hv;this.addItem(l=>s(e,l,"days",0,i,a)),this.addItem(l=>s(e,l,"day",1,i,a)),this.addSeparator();let o=im,u=sm;this.addItem(l=>s(e,l,"days",2,o,u)),this.addItem(l=>s(e,l,"days",3,o,u)),this.addItem(l=>s(e,l,"days",4,o,u)),this.addItem(l=>s(e,l,"days",5,o,u)),this.addItem(l=>s(e,l,"days",6,o,u)),this.addSeparator(),this.addItem(l=>s(e,l,"week",1,o,u)),this.addItem(l=>s(e,l,"weeks",2,o,u)),this.addItem(l=>s(e,l,"weeks",3,o,u)),this.addItem(l=>s(e,l,"month",1,o,u))}static postponeOnClickCallback(o,u,l,c){return L(this,arguments,function*(e,t,n,s,i=sm,a=ja){let f=al(t);if(f===null){let k="\u26A0\uFE0F Postponement requires a date: due, scheduled or start.";return new am.Notice(k,1e4)}let{postponedDate:m,postponedTask:y}=i(t,f,s,n);yield a(t,y),In.postponeSuccessCallback(e,f,m)})}static postponeSuccessCallback(e,t,n){e.disabled=!0;let s=yv(n,t);new am.Notice(s,2e3)}};var ol=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 L(this,null,function*(){n.addChild(new om({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},om=class extends fi.MarkdownRenderChild{constructor({app:t,events:n,container:s,source:i,filePath:a}){super(s);switch(this.app=t,this.events=n,this.source=i,this.filePath=a,this.containerEl.className){case"block-language-tasks":this.query=il(this.source,ar.getInstance(),this.filePath),this.queryType="tasks";break;default:this.query=il(this.source,ar.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,s=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=il(this.source,ar.getInstance(),this.filePath),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},s+1e3)}render(s){return L(this,arguments,function*({tasks:t,state:n}){var a;let i=this.containerEl.createEl("div");n==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,n,i):this.query.error!==void 0?this.renderErrorMessage(i,this.query.error):this.renderLoa
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 vv(r,e){return r.findIndex(t=>t.symbol===e)}function RP(r,e){let t=Q.getTypeForUnknownSymbol(r.symbol);r.type!==t&&(t==="TODO"&&r.symbol!==" "||e.push(`For information, the conventional type for status symbol ${Fr(r.symbol)} is ${Fr(t)}: you may wish to review this type.`))}function MP(r,e,t){let n=vv(r,e.nextStatusSymbol);if(n===-1){t.push(`Next symbol ${Fr(e.nextStatusSymbol)} is unknown: create a status with symbol ${Fr(e.nextStatusSymbol)}.`);return}if(e.type!=="DONE")return;let s=r[n];if(s){if(s.type!=="TODO"&&s.type!=="IN_PROGRESS"){let i="https://publish.obsidian.md/tasks/Getting+Started/Statuses/Recurring+Tasks+and+Custom+Statuses",a=[`This \`DONE\` status is followed by ${Fr(s.type)}, not \`TODO\` or \`IN_PROGRESS\`.`,"If used to complete a recurring task, it will instead be followed by `TODO` or `IN_PROGRESS`, to ensure the next task matches the `not done` filter.",`See [Recurring Tasks and Custom Statuses](${i}).`].join("<br>");t.push(a)}}else t.push("Unexpected failure to find the next status.")}function CP(r,e,t){let n=[];return e.symbol===Q.EMPTY.symbol?(n.push("Empty symbol: this status will be ignored."),n):vv(r,e.symbol)!=t?(n.push(`Duplicate symbol '${Fr(e.symbol)}': this status will be ignored.`),n):(RP(e,n),MP(r,e,n),n)}function wv(r){let e=new ul(["Status Symbol","Next Status Symbol","Status Name","Status Type","Problems (if any)"]),t=Ne.allStatuses(r);return t.forEach((n,s)=>{e.addRow([Fr(n.symbol),Fr(n.nextStatusSymbol),n.name,Fr(n.type),CP(t,n,s).join("<br>")])}),e.markdown}function Ev(r,e,t,n){let i=wv(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.
11 months ago
${i}
1 year ago
## 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 Fr(r){return r===""?r:"`"+(r!==" "?r:"space")+"`"}function kv(){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 Sv(){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 Ov(){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 Dv(){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 xv(){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 Rv(){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 br.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?zt.removeValidationError(t):zt.setValidationError(t)}};var It=class extends _e.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 L(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 _e.Setting(t).setName("Task Format").setDesc(It.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(s=>{for(let i of Object.keys(Jr))s.addOption(i,Jr[i].displayName);s.setValue(K().taskFormat).onChange(i=>L(this,null,function*(){Ke({taskFormat:i}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new _e.Setting(t).setName("Global task filter").setDesc(It.createFragmentWithHTML('<p><b>Recommended: Leave empty if you want all checklist items in your vault to be tasks managed by this plugin.</b></p><p>Use a global filter if you want Tasks to only act on a subset of your "<code>- [ ]</code>" checklist items, so that a checklist item must include the specified string in its description in order to be considered a task.<p><p>For example, if you set the global filter to <code>#task</code>, the Tasks plugin will only handle checklist items tagged with <code>#task</code>.</br>Other checklist items will remain normal checklist items and not appear in queries or get a done date set.</p><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Global+Filter">documentation</a>.</p>')).addText(s=>{s.setPlaceholder("e.g. #task or TODO").setValue(ye.getInstance().get()).onChange(i=>L(this,null,function*(){Ke({globalFilter:i}),ye.getInstance().set(i),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle(s=>{let i=K();s.setValue(i.removeGlobalFilter).onChange(a=>L(this,null,function*(){Ke({removeGlobalFilter:a}),ye.getInstance().setRemoveGlobalFilter(a),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),IP(new _e.Setting(t).setDesc(It.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(s=>{let i=K();s.inputEl.rows=4,s.setPlaceholder(`# For example...
2 years ago
path does not include _templates/
limit 300
11 months ago
show urgency`).setValue(i.globalQuery).onChange(a=>L(this,null,function*(){Ke({globalQuery:a}),ar.getInstance().set(a),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=K();Cv.forEach(s=>{this.addOneSettingsBlock(t,s,n)}),t.createEl("h4",{text:"Date Settings"}),new _e.Setting(t).setName("Set created date on every added task").setDesc(It.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(s=>{let i=K();s.setValue(i.setCreatedDate).onChange(a=>L(this,null,function*(){Ke({setCreatedDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Set done date on every completed task").setDesc(It.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(s=>{let i=K();s.setValue(i.setDoneDate).onChange(a=>L(this,null,function*(){Ke({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Set cancelled date on every cancelled task").setDesc(It.createFragmentWithHTML('Enabling this will add a timestamp \u274C YYYY-MM-DD at the end when a task is toggled to cancelled.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Cancelled+date">documentation</a>.</p>')).addToggle(s=>{let i=K();s.setValue(i.setCancelledDate).onChange(a=>L(this,null,function*(){Ke({setCancelledDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(It.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(s=>{let i=K();s.setValue(i.useFilenameAsScheduledDate).onChange(a=>L(this,null,function*(){Ke({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new _e.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(s=>L(this,null,function*(){let i=K();yield this.plugin.saveSettings(),s.setValue(It.renderFolderArray(i.filenameAsDateFolders)).onChange(a=>L(this,null,function*(){let o=It.parseCommaSeparatedFolders(a);Ke({filenameAsDateFolders:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new _e.Setting(t).setName("Next recurrence appears on the line below").setDesc(It.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(s=>{let{recurrenceOnNextLine:i}=K();s.setValue(i).onChange(a=>L(this,null,function*(){Ke({recurrenceOnNextLine:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new _e.Setting(t).setName("Auto-suggest task content").setDesc(It.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(s=>{let i=K();s.setValue(i.autoSuggestInEditor).onChange(a=>L(this,null,function*(){Ke({au
`);t(o)}).open(),n};var Iv=(r,e)=>{let t=gu({line:"",path:""});return new On({app:r,task:t,onSubmit:e})};var Fv=r=>({createTaskLineModal:()=>Nv(r,Iv)});var cl=class extends Lv.Plugin{get apiV1(){return Fv(app)}onload(){return L(this,null,function*(){Rt.registerConsoleLogger(),wp("info",`loading plugin "${this.manifest.name}" v${this.manifest.version}`),yield this.loadSettings();let{loggingOptions:t}=K();Rt.configure(t),this.addSettingTab(new $a({plugin:this})),tv({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let n=new Zu({obsidianEvents:this.app.workspace});this.cache=new rs({metadataCache:this.app.metadataCache,vault:this.app.vault,events:n}),this.inlineRenderer=new sl({plugin:this}),this.queryRenderer=new ol({plugin:this,events:n}),this.registerEditorExtension(fv()),this.registerEditorSuggest(new ll(this.app,K())),new yu({plugin:this})})}loadTaskStatuses(){return L(this,null,function*(){let{statusSettings:t}=K();Ne.applyToStatusRegistry(t,Ee.getInstance())})}onunload(){var t;wp("info",`unloading plugin "${this.manifest.name}" v${this.manifest.version}`),(t=this.cache)==null||t.unload()}loadSettings(){return L(this,null,function*(){let t=yield this.loadData();Ke(t),t=K(),ye.getInstance().set(t.globalFilter),ye.getInstance().setRemoveGlobalFilter(t.removeGlobalFilter),ar.getInstance().set(t.globalQuery),yield this.loadTaskStatuses()})}saveSettings(){return L(this,null,function*(){yield this.saveData(K())})}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
*/