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.

262 lines
389 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.
*/
2 years ago
"use strict";var hb=Object.create;var Ui=Object.defineProperty,gb=Object.defineProperties,yb=Object.getOwnPropertyDescriptor,_b=Object.getOwnPropertyDescriptors,Tb=Object.getOwnPropertyNames,yp=Object.getOwnPropertySymbols,bb=Object.getPrototypeOf,Tp=Object.prototype.hasOwnProperty,vb=Object.prototype.propertyIsEnumerable;var _p=(r,e,t)=>e in r?Ui(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,he=(r,e)=>{for(var t in e||(e={}))Tp.call(e,t)&&_p(r,t,e[t]);if(yp)for(var t of yp(e))vb.call(e,t)&&_p(r,t,e[t]);return r},Dt=(r,e)=>gb(r,_b(e));var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Eb=(r,e)=>{for(var t in e)Ui(r,t,{get:e[t],enumerable:!0})},bp=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tb(e))!Tp.call(r,i)&&i!==t&&Ui(r,i,{get:()=>e[i],enumerable:!(n=yb(e,i))||n.enumerable});return r};var Wi=(r,e,t)=>(t=r!=null?hb(bb(r)):{},bp(e||!r||!r.__esModule?Ui(t,"default",{value:r,enumerable:!0}):t,r)),wb=r=>bp(Ui({},"__esModule",{value:!0}),r);var F=(r,e,t)=>new Promise((n,i)=>{var s=u=>{try{o(t.next(u))}catch(l){i(l)}},a=u=>{try{o(t.throw(u))}catch(l){i(l)}},o=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,a);o((t=t.apply(r,e)).next())});var Ee=b(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.matchAnyPattern=jr.extractTerms=jr.repeatedTimeunitPattern=void 0;function Sb(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}jr.repeatedTimeunitPattern=Sb;function vp(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}jr.extractTerms=vp;function Rb(r){return`(?:${vp(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}jr.matchAnyPattern=Rb});var ge=b((_u,Tu)=>{(function(r,e){typeof _u=="object"&&typeof Tu!="undefined"?Tu.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(_u,function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",i="second",s="minute",a="hour",o="day",u="week",l="month",c="quarter",p="year",m="date",T="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,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,M={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("_")},U=function(j,A,w){var B=String(j);return!B||B.length>=A?j:""+Array(A+1-B.length).join(w)+j},q={s:U,z:function(j){var A=-j.utcOffset(),w=Math.abs(A),B=Math.floor(w/60),C=w%60;return(A<=0?"+":"-")+U(B,2,"0")+":"+U(C,2,"0")},m:function j(A,w){if(A.date()<w.date())return-j(w,A);var B=12*(w.year()-A.year())+(w.month()-A.month()),C=A.clone().add(B,l),X=w-C<0,d=A.clone().add(B+(X?-1:1),l);return+(-(B+(w-C)/(X?C-d:d-C))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:l,y:p,w:u,d:o,D:m,h:a,m:s,s:i,ms:n,Q:c}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},W="en",ie={};ie[W]=M;var re=function(j){return j instanceof Pe},ve=function(j,A,w){var B;if(!j)return W;if(typeof j=="string")ie[j]&&(B=j),A&&(ie[j]=A,B=j);else{var C=j.name;ie[C]=j,B=C}return!w&&B&&(W=B),B||!w&&W},G=function(j,A){if(re(j))return j.clone();var w=typeof A=="object"?A:{};return w.date=j,w.args=arguments,new Pe(w)},K=q;K.l=ve,K.i=re,K.w=function(j,A){return G(j,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var Pe=function(){function j(w){this.$L=ve(w.locale,null,!0),this.parse(w)}var A=j.prototype;return A.parse=function(w){this.$d=function(B){var C=B.date,X=B.utc;if(C===null)return new Date(NaN);if(K.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(y);if(d){var f=d[2]-1||0,h=(d[7]||"0").substring(0,3);return X?new Date(Date.UTC(d[1],f,d[3]||1,d[4]||0,d[5]||0,d[6]||0,h)):new Date(d[1],f,d[3]||1,d[4]||0,d[5]||0,d[6]||0,h)}}return new Date(C)}(w),this.$x=w.x||{},this.init
`).map(ZM).filter(function(t){return t!==null});return _t(_t({},e[0]),e[1])}function js(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],i=t[2];return n&&(e.tzid=n),e.dtstart=z.untilStringToDate(i),e}function ZM(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return M_(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return M_(r);case"DTSTART":return js(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function M_(r){var e=r.replace(/^RRULE:/i,""),t=js(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(i){var s=i.split("="),a=s[0],o=s[1];switch(a.toUpperCase()){case"FREQ":t.freq=oe[o.toUpperCase()];break;case"WKST":t.wkst=Ht[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=JM(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=ex(o);break;case"DTSTART":case"TZID":var c=js(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=z.untilStringToDate(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function JM(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(x_)}return x_(r)}function x_(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function ex(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Ht[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!n||n.length<3)throw new SyntaxError("Invalid weekday string: ".concat(t));var i=Number(n[1]),s=n[2],a=Ht[s].weekday;return new je(a,i)})}var kn=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=z.timeToUntilString(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(e):";TZID=".concat(this.tzid,":").concat(e)},r.prototype.getTime=function(){return this.date.getTime()},r.prototype.rezonedDate=function(){var e;if(this.isUTC)return this.date;var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=new Date(this.date.toLocaleString(void 0,{timeZone:t})),i=new Date(this.date.toLocaleString(void 0,{timeZone:(e=this.tzid)!==null&&e!==void 0?e:"UTC"})),s=i.getTime()-n.getTime();return new Date(this.date.getTime()-s)},r}();function Bs(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys($s),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!de(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!Me(o)||at(o)&&!o.length)){switch(a){case"FREQ":u=Y.FREQUENCIES[r.freq];break;case"WKST":At(o)?u=new je(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=Qy(o).map(function(T){return T instanceof je?T:at(T)?new je(T[0],T[1]):new je(T)}).toString();break;case"DTSTART":t=tx(o,r.tzid);break;case"UNTIL":u=z.timeToUntilString(o,!r.tzid);break;default:if(at(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 p=e.map(function(T){var y=T[0],E=T[1];return"".concat(y,"=").concat(E.toString())}).join(";"),m="";return p!==""&&(m="RRULE:".concat(p)),[t,m].filter(function(T){return!!T}).join(`
`)}function tx(r,e){return r?"DTSTART"+new kn(new Date(r),e).toString():""}function rx(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 A_=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?z.clone(t):z.cloneDates(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,i=t?Object.keys(t):[],s=function(c){for(var p=0;p<i.length;p++){var m=i[p];if(!rx(t[m],c[m]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(at(a))for(var o=0;o<a.length;o++){var u=a[o];if(!(i.length&&s(u))){n=u._value;break}}if(!n&&this.all){for(var l=new Mr(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return at(n)?z.cloneDates(n):n instanceof Date?z.clone(n):n},r}();var C_=x(x(x(x(x(x(x(x(x(x(x(x(x([],le(1,31),!0),le(2,28),!0),le(3,31),!0),le(4,30),!0),le(5,31),!0),le(6,30),!0),le(7,31),!0),le(8,31),!0),le(9,30),!0),le(10,31),!0),le(11,30),!0),le(12,31),!0),le(1,7),!0),P_=x(x(x(x(x(x(x(x(x(x(x(x(x([],le(1,31),!0),le(2,29),!0),le(3,31),!0),le(4,30),!0),le(5,31),!0),le(6,30),!0),le(7,31),!0),le(8,31),!0),le(9,30),!0),le(10,31),!0),le(11,30),!0),le(12,31),!0),le(1,7),!0),nx=Bt(1,29),ix=Bt(1,30),Xr=Bt(1,31),lt=Bt(1,32),N_=x(x(x(x(x(x(x(x(x(x(x(x(x([],lt,!0),ix,!0),lt,!0),Xr,!0),lt,!0),Xr,!0),lt,!0),lt,!0),Xr,!0),lt,!0),Xr,!0),lt,!0),lt.slice(0,7),!0),I_=x(x(x(x(x(x(x(x(x(x(x(x(x([],lt,!0),nx,!0),lt,!0),Xr,!0),lt,!0),Xr,!0),lt,!0),lt,!0),Xr,!0),lt,!0),Xr,!0),lt,!0),lt.slice(0,7),!0),sx=Bt(-28,0),ax=Bt(-29,0),Zr=Bt(-30,0),ct=Bt(-31,0),F_=x(x(x(x(x(x(x(x(x(x(x(x(x([],ct,!0),ax,!0),ct,!0),Zr,!0),ct,!0),Zr,!0),ct,!0),ct,!0),Zr,!0),ct,!0),Zr,!0),ct,!0),ct.slice(0,7),!0),L_=x(x(x(x(x(x(x(x(x(x(x(x(x([],ct,!0),sx,!0),ct,!0),Zr,!0),ct,!0),Zr,!0),ct,!0),ct,!0),Zr,!0),ct,!0),Zr,!0),ct,!0),ct.slice(0,7),!0),U_=[0,31,60,91,121,152,182,213,244,274,305,335,366],W_=[0,31,59,90,120,151,181,212,243,273,304,334,365],ff=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Bt(7));return r}();function q_(r,e){var t=new Date(Date.UTC(r,0,1)),n=z.isLeapYear(r)?366:365,i=z.isLeapYear(r+1)?366:365,s=z.toOrdinal(t),a=z.getWeekday(t),o=_t(_t({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},ox(r)),{wnomask:null});if(Ct(e.byweekno))return o;o.wnomask=le(0,n+7);var u,l,c=u=ut(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+ut(a-e.wkst,7)):l=n-c;for(var p=Math.floor(l/7),m=ut(l,7),T=Math.floor(p+m/4),y=0;y<e.byweekno.length;y++){var E=e.byweekno[y];if(E<0&&(E+=T+1),E>0&&E<=T){var M=void 0;E>1?(M=c+(E-1)*7,c!==u&&(M-=7-u)):M=c;for(var U=0;U<7&&(o.wnomask[M]=1,M++,o.wdaymask[M]!==e.wkst);U++);}}if(de(e.byweekno,1)){var M=c+T*7;if(c!==u&&(M-=7-u),M<n)for(var y=0;y<7&&(o.wnomask[M]=1,M+=1,o.wdaymask[M]!==e.wkst);y++);}if(c){var q=void 0;if(de(e.byweekno,-1))q=-1;else{var W=z.getWeekday(new Date(Date.UTC(r-1,0,1))),ie=ut(7-W.valueOf()+e.wkst,7),re=z.isLeapYear(r-1)?366:365,ve=void 0;ie>=4?(ie=0,ve=re+ut(W-e.wkst,7)):ve=n-c,q=Math.floor(52+ut(ve,7)/4)}if(de(e.byweekno,q))for(var M=0;M<c;M++)o.wnomask[M]=1}return o}function ox(r){var e=z.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=z.getWeekday(t);return e===365?{mmask:C_,mdaymask:I_,nmdaymask:L_,wdaymask:ff.slice(n),mrange:W_}:{mmask:P_,mdaymask:N_,nmdaymask:F_,wdaymask:ff.slice(n),mrange:U_}}function Y_(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===Y.YEARLY)if(Ct(s.bymonth))o=[[0,t]];else for(var u=0;u<s.bymonth.length;u++)e=s.bymonth[u],o.push(n.slice(e-1,e+1));else s.freq===Y.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Ct(o))return a;a.nwdaymask=le(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],c=l[0],p=l[1]-1,m=0;m<s.bynweekday.length;m++){var T=void 0,y=s.bynweekday[m],E=y[0],M=y[1];M<0?(T=p+(M+1)*7,T-=ut(i[T]-E,7)):(T=c+(M-1)*7,T+=ut(7-i[T]+E,7)),c<=T&&T<=p&&(a.nwdaymask[T]=1)}return a}function $_(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),i=r%100,s=Math.floor(n/
`),n=0;n<t.length;){var i=t[n]=t[n].replace(/\s+$/g,"");i?n>0&&i[0]===" "?(t[n-1]+=i.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function _x(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function V_(r,e){return _x(e),r.split(",").map(function(t){return z.untilStringToDate(t)})}function K_(r){var e=this;return function(t){if(t!==void 0&&(e["_".concat(r)]=t),e["_".concat(r)]!==void 0)return e["_".concat(r)];for(var n=0;n<e._rrule.length;n++){var i=e._rrule[n].origOptions[r];if(i)return i}}}var mf=function(r){ci(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=K_.apply(n,["dtstart"]),n.tzid=K_.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return H_(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){Q_(t,this._rrule)},e.prototype.exrule=function(t){Q_(t,this._exrule)},e.prototype.rdate=function(t){X_(t,this._rdate)},e.prototype.exdate=function(t){X_(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return To(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return To(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(Bs({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
3 years ago
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
2 years ago
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(Z_("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(Z_("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}(Y);function Q_(r,e){if(!(r instanceof Y))throw new TypeError(String(r)+" is not RRule instance");de(e.map(String),String(r))||e.push(r)}function X_(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");de(e.map(Number),Number(r))||(e.push(r),z.sort(e))}function Z_(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return z.timeToUntilString(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}function Ar(r,e){return r!==null&&e===null?-1:r===null&&e!==null?1:r!==null&&e!==null?r.isValid()&&!e.isValid()?-1:!r.isValid()&&e.isValid()||r.isAfter(e)?1:r.isBefore(e)?-1:0:0}var et=class{constructor({rrule:e,baseOnToday:t,referenceDate:n,startDate:i,scheduledDate:s,dueDate:a}){this.rrule=e,this.baseOnToday=t,this.referenceDate=n,this.startDate=i,this.scheduledDate=s,this.dueDate=a}static fromText({recurrenceRuleText:e,startDate:t,scheduledDate:n,dueDate:i}){try{let s=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(s==null)return null;let a=s[1].trim(),o=s[2]!==void 0,u=Y.parseText(a);if(u!==null){let l=null;i?l=window.moment(i):n?l=window.moment(n):t&&(l=window.moment(t)),!o&&l!==null?u.dtstart=window.moment(l).startOf("day").utc(!0).toDate():u.dtstart=window.moment().startOf("day").utc(!0).toDate();let c=new Y(u);return new et({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}catch(s){s instanceof Error&&console.log(s.message)}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(){let e=this.nextReferenceDate();if(e!==null){let t=null,n=null,i=null;if(this.referenceDate){if(this.startDate){let s=window.moment.duration(this.startDate.diff(this.referenceDate));t=window.moment(e),t.add(Math.round(s.asDays()),"days")}if(this.scheduledDate){let s=window.moment.duration(this.scheduledDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(s.asDays()),"days")}if(this.dueDate){let s=window.moment.duration(this.dueDate.diff(this.referenceDate));i=window.moment(e),i.add(Math.round(s.asDays()),"days")}}return{startDate:t,scheduledDate:n,dueDate:i}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||Ar(this.startDate,e.startDate)!==0||Ar(this.scheduledDate,e.scheduledDate)!==0||Ar(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 Y(Dt(he({},this.rrule.origOptions),{dtstart:e.startOf("day").utc(!0).toDate()}));return this.nextAfter(e.endOf("day"),t)}nextReferenceDateFromOriginalReferenceDate(){var t;let e=window.moment((t=this.referenceDate)!=null?t:void 0).endOf("day");return this.nextAfter(e,this.rrule)}nextAfter(e,t){e.utc(!0);let n=window.moment(t.after(e.toDate())),i=this.toText(),s=i.match(/every( \d+)? month(s)?(.*)?/);s!==null&&(i.includes(" on ")||(n=et.nextAfterMonths(e,n,t,s[1])));let a=i.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=et.nextAfterYears(e,n,t,a[1])),et.addTimezone(n)}static nextAfterMonths(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));et.isSkippingTooManyMonths(e,t,s);)t=et.fromOneDayEarlier(e,n);return t}static isSkippingTooManyMonths(e,t,n){let i=t.month()-e.month();return i+=(t.year()-e.year())*12,i>n}static nextAfterYears(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));et.isSkippingTooManyYears(e,t,s);)t=et.fromOneDayEarlier(e,n);return t}static isSkippingTooManyYears(e,t,n){return t.year()-e.year()>n}static fromOneDayEarlier(e,t){e.subtract(1,"days").endOf("day");let n=t.origOptions;return n.dtstart=e
`}),a=a.slice(0,s.autoSuggestMaxItems),a}}function Tx(r,e,t,n){let i=u=>Object.values(n.prioritySymbols).some(l=>l.length>0&&u.includes(l)),s=[];if(r.includes(n.dueDateSymbol)||s.push({displayText:`${n.dueDateSymbol} due date`,appendText:`${n.dueDateSymbol} `}),r.includes(n.startDateSymbol)||s.push({displayText:`${n.startDateSymbol} start date`,appendText:`${n.startDateSymbol} `}),r.includes(n.scheduledDateSymbol)||s.push({displayText:`${n.scheduledDateSymbol} scheduled date`,appendText:`${n.scheduledDateSymbol} `}),i(r)||(s.push({displayText:`${n.prioritySymbols.High} high priority`,appendText:`${n.prioritySymbols.High} `}),s.push({displayText:`${n.prioritySymbols.Medium} medium priority`,appendText:`${n.prioritySymbols.Medium} `}),s.push({displayText:`${n.prioritySymbols.Low} low priority`,appendText:`${n.prioritySymbols.Low} `}),s.push({displayText:`${n.prioritySymbols.Highest} highest priority`,appendText:`${n.prioritySymbols.Highest} `}),s.push({displayText:`${n.prioritySymbols.Lowest} lowest priority`,appendText:`${n.prioritySymbols.Lowest} `})),r.includes(n.recurrenceSymbol)||s.push({displayText:`${n.recurrenceSymbol} recurring (repeat)`,appendText:`${n.recurrenceSymbol} `}),!r.includes(n.createdDateSymbol)){let l=xt.parseDate("today",!0).format(H.dateFormat);s.push({textToMatch:`${n.createdDateSymbol} created`,displayText:`${n.createdDateSymbol} created today (${l})`,appendText:`${n.createdDateSymbol} ${l} `})}let a=yf(r,/([a-zA-Z'_-]*)/g,e),o=[];if(a&&a.length>0){let u=a[0];if(u.length>=Math.max(1,t.autoSuggestMinMatch)){let l=s.filter(c=>(c.textToMatch||c.displayText).toLowerCase().includes(u.toLowerCase()));for(let c of l)o.push({suggestionType:"match",displayText:c.displayText,appendText:c.appendText,insertAt:a.index,insertSkip:u.length})}}return o.length===0&&t.autoSuggestMinMatch===0?s:o}function bx(r,e,t,n,i){let s=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],a=[],o=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),u=yf(r,o,e);if(u&&u.length>=2){let l=u[1],c=u[2];if(c.length<t.autoSuggestMinMatch)return[];let p=c&&c.length>1?xt.parseDate(ui(c),!0):null;p&&p.isValid()&&a.push({displayText:`${p.format(H.dateFormat)}`,appendText:`${l} ${p.format(H.dateFormat)} `,insertAt:u.index,insertSkip:u[0].length});let m=1,T=s.filter(y=>c&&c.length>=m&&y.toLowerCase().includes(c.toLowerCase())).slice(0,i);T.length===0&&(T=s.slice(0,i));for(let y of T){let M=`${xt.parseDate(y,!0).format(H.dateFormat)}`;a.push({suggestionType:"match",displayText:`${y} (${M})`,appendText:`${l} ${M} `,insertAt:u.index,insertSkip:u[0].length})}}return a}function vx(r,e,t,n){var u;let i=["every","every day","every week","every month","every month on the","every year","every week on Sunday","every week on Monday","every week on Tuesday","every week on Wednesday","every week on Thursday","every week on Friday","every week on Saturday"],s=[],a=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),o=yf(r,a,e);if(o&&o.length>=2){let l=o[1],c=o[2];if(c.length<t.autoSuggestMinMatch)return[];if(c.length>0){let y=(u=et.fromText({recurrenceRuleText:c,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:u.toText();if(y){let E=`${l} ${y} `;if(s.push({suggestionType:"match",displayText:`\u2705 ${y}`,appendText:E,insertAt:o.index,insertSkip:o[0].length}),o[0]==E)return[]}}let p=1,m=t.autoSuggestMaxItems/2,T=i.filter(y=>c&&c.length>=p&&y.toLowerCase().includes(c.toLowerCase())).slice(0,m);T.length===0&&c.trim().length===0&&(T=i.slice(0,m));for(let y of T)s.push({suggestionType:"match",displayText:`${y}`,appendText:`${l} ${y} `,insertAt:o.index,insertSkip:o[0].length})}return s}function yf(r,e,t){let n=r.matchAll(e);for(let i of n)if((i==null?void 0:i.index)&&i.index<=t&&t<=i.index+i[0].length)return i}var Hs=class{constructor(){this.hideTaskCount=!1;this.hideBacklinks=!1;this.hidePriority=!1;this.hideCreatedDate=!1;this.hideStartDate=!1;this.hideScheduledDate=!1;this.hideDoneDate=!1;this.hideDueDate=!1;this.hideRecurrenceRule=!1;this.hideEditButton=!1;this.hideUrgency=!0;this.hi
2 years 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.
2 years ago
`;ko(l);return}let u=Math.min(Math.pow(10,s),100);Qs.debug(`timeout = ${u}`),setTimeout(()=>{uT({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:s+1})},u)};try{let[u,l,c]=yield lT(r,t),p=[...c.slice(0,u),...e.map(m=>m.toFileLineString()),...c.slice(u+1)];yield t.modify(l,p.join(`
`))}catch(u){if(u instanceof tn)return u.message&&oT(u.message),o();if(u instanceof Oo)return o();u instanceof Error&&ko(u.message)}});function lT(r,e){return F(this,null,function*(){if(Ks===void 0)throw new tn;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof Xs.TFile))throw new tn(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!Ox.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=Ks.getFileCache(t);if(n==null||n===null)throw new tn(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let i=n.listItems;if(i===void 0||i.length===0)throw new tn(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let a=(yield e.read(t)).split(`
`),o=Sx(r,a,i,Dx);if(o===void 0)throw new Oo;return[o,t,a]})}function Of(r,e){return F(this,null,function*(){try{let[t,n,i]=yield lT(r,e);return[t,n]}catch(t){t instanceof tn?t.message&&oT(t.message):t instanceof Error&&ko(t.message)}})}function cT(r,e){return r<e.length}function Sx(r,e,t,n){let i=Rx(r,e);return i!==void 0||(i=Mx(r,e),i!==void 0)?i:xx(r,e,t,n)}function Rx(r,e){let t=r.taskLocation.lineNumber;if(cT(t,e)&&e[t]===r.originalMarkdown)return Qs.debug(`Found original markdown at original line number ${t}`),t}function Mx(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 xx(r,e,t,n){let i,s=0;for(let a of t){let o=a.position.start.line;if(!cT(o,e))return;if(o<r.taskLocation.sectionStart||a.task===void 0)continue;let u=e[o];if(we.includedIn(u)){if(s===r.taskLocation.sectionIndex){if(u===r.originalMarkdown)i=o;else{n(`Tasks: Unable to find task in file ${r.taskLocation.path}.
2 years ago
Expected task:
${r.originalMarkdown}
Found task:
${u}`);return}break}s++}}return i}var mr=class{static priorityNameUsingNone(e){let t="ERROR";switch(e){case"1":t="High";break;case"0":t="Highest";break;case"2":t="Medium";break;case"3":t="None";break;case"4":t="Low";break;case"5":t="Lowest";break}return t}static priorityNameUsingNormal(e){return mr.priorityNameUsingNone(e).replace("None","Normal")}};var rn={description:"task-description",priority:"task-priority",dueDate:"task-due",startDate:"task-start",createdDate:"task-created",scheduledDate:"task-scheduled",doneDate:"task-done",recurrenceRule:"task-recurring",blockLink:""},Ax=7,Cx="far";function Px(r,e,t,n){return F(this,null,function*(){if(!n)throw new Error("Must call the Obsidian renderer with an Obsidian Component object");yield dT.MarkdownRenderer.renderMarkdown(r,e,t,n)})}function fT(r,e,t=null){return F(this,null,function*(){var o;t||(t=Px);let n=document.createElement("li");e.parentUlElement.appendChild(n),n.classList.add("task-list-item","plugin-tasks-list-item");let i=document.createElement("span");n.appendChild(i),i.classList.add("tasks-list-text");let s=yield Nx(r,e,i,t);for(let u in s)n.dataset[u]=s[u];let a=document.createElement("input");return n.appendChild(a),a.classList.add("task-list-item-checkbox"),a.type="checkbox",r.status.symbol!==" "&&(a.checked=!0,n.classList.add("is-checked")),a.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),a.disabled=!0;let l=r.toggleWithRecurrenceInUsersOrder();Do({originalTask:r,newTasks:l})}),n.prepend(a),n.setAttribute("data-task",r.status.symbol.trim()),n.setAttribute("data-line",e.listIndex.toString()),n.setAttribute("data-task-status-name",r.status.name),n.setAttribute("data-task-status-type",r.status.type),a.setAttribute("data-line",e.listIndex.toString()),(o=e.layoutOptions)!=null&&o.shortMode&&Wx({task:r,element:i,isFilenameUnique:e.isFilenameUnique}),n})}function Nx(r,e,t,n){return F(this,null,function*(){let i={},s=new Jr(e.layoutOptions),a=Cr.tasksPluginEmoji.taskSerializer;for(let o of s.layoutComponents){let u=a.componentToString(r,s,o);if(u){o==="description"&&(u=we.removeAsWordFromDependingOnSettings(u));let l=document.createElement("span");if(t.appendChild(l),l){let c=document.createElement("span");l.appendChild(c),yield Ix(c,u,o,r,n,e.obsidianComponent);let[p,m]=Df(o,r);Fx(o,c),l.classList.add(...p);for(let T in m)l.dataset[T]=m[T];i=he(he({},i),m)}}}for(let o of s.hiddenComponents){let[u,l]=Df(o,r);i=he(he({},i),l)}if(i.taskPriority===void 0){let[o,u]=Df("priority",r);i=he(he({},i),u)}return i})}function Ix(r,e,t,n,i,s){return F(this,null,function*(){if(t==="description"){let{debugSettings:a}=Q();a.showTaskHiddenData&&(e+=`<br>\u{1F41B} <b>${n.lineNumber}</b> . ${n.sectionStart} . ${n.sectionIndex} . '<code>${n.originalMarkdown}</code>'<br>'<code>${n.path}</code>' > '<code>${n.precedingHeader}</code>'<br>`),yield i(e,r,n.path,s);let o=r.querySelector("blockquote"),u=o!=null?o:r,l=u.querySelector("p");if(l!==null){for(;l.firstChild;)u.insertBefore(l.firstChild,l);l.remove()}r.querySelectorAll("p").forEach(c=>{c.hasChildNodes()||c.remove()}),r.querySelectorAll(".footnotes").forEach(c=>{c.remove()})}else r.innerHTML=e})}function Df(r,e){let t=[],n={};function i(s,a,o){if(s){t.push(a);let u=Lx(s);u&&(n[o]=u)}}switch(r){case"description":t.push(rn.description);break;case"priority":{n.taskPriority=mr.priorityNameUsingNormal(e.priority).toLocaleLowerCase(),t.push(rn.priority);break}case"createdDate":{i(e.createdDate,rn.createdDate,"taskCreated");break}case"dueDate":{i(e.dueDate,rn.dueDate,"taskDue");break}case"startDate":{i(e.startDate,rn.startDate,"taskStart");break}case"scheduledDate":{i(e.scheduledDate,rn.scheduledDate,"taskScheduled");break}case"doneDate":{i(e.doneDate,rn.doneDate,"taskDone");break}case"recurrenceRule":{t.push(rn.recurrenceRule);break}}return[t,n]}function Fx(r,e){if(r==="description"){let t=e.getElementsByClassName("tag");for(let n=0;n<t.length;n++){let i=t[n].textContent;if(i){let s=Ux(i),a=t[n];s&&(a.dataset.tagName=s)}}}}function Lx(r){let e=window.moment().startOf("day"),t="",n=e.diff(r,"days");return isNaN(n)?nul
2 years ago
`),o=a.length,u=new Js(()=>Ot.fromPath(i.path)),l=null,c=0;for(let p of t)if(p.task!==void 0){let m=p.position.start.line;if(m>=o)return console.log(`${i.path} Obsidian gave us a line number ${m} past the end of the file. ${o}.`),s;if((l===null||l.position.end.line<m)&&(l=Rn.getSection(m,n.sections),c=0),l===null)continue;let T=a[m];if(T===void 0){console.log(`${i.path}: line ${m} - ignoring 'undefined' line.`);continue}let y;try{y=Te.fromLine({line:T,taskLocation:new ot(i.path,m,l.position.start.line,c,Rn.getPrecedingHeader(m,n.headings)),fallbackDate:u.value})}catch(E){this.reportTaskParsingErrorToUser(E,i,p,T);continue}y!==null&&(c++,s.push(y))}return s}reportTaskParsingErrorToUser(e,t,n,i){let s=`There was an error reading one of the tasks in this vault.
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: ${e}
File: ${t.path}
Line number: ${n.position.start.line}
2 years ago
Task line: ${i}
Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.
Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'
The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.
2 years ago
`;console.error(s),e instanceof Error&&console.error(e.stack),this.state==="Initializing"&&new pi.Notice(s,1e4)}static getSection(e,t){if(t===void 0)return null;for(let n of t)if(n.position.start.line<=e&&n.position.end.line>=e)return n;return null}static getPrecedingHeader(e,t){if(t===void 0)return null;let n=null;for(let i of t){if(i.position.start.line>e)return n;n=i.heading}return n}};var Lf=require("obsidian");var AT=require("obsidian");function Nr(){}function Mf(r){return r()}function mT(){return Object.create(null)}function xn(r){r.forEach(Mf)}function Ro(r){return typeof r=="function"}function gT(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function yT(r){return Object.keys(r).length===0}var _T=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,ta=class{constructor(e){this.options=e,this._listeners="WeakMap"in _T?new WeakMap:void 0}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(t=>{var n;for(let i of t)ta.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};ta.entries="WeakMap"in _T?new WeakMap:void 0;var TT=!1;function Yx(){TT=!0}function $x(){TT=!1}function R(r,e){r.appendChild(e)}function yi(r,e,t){r.insertBefore(e,t||null)}function An(r){r.parentNode&&r.parentNode.removeChild(r)}function xf(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 jx(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function dt(r){return document.createTextNode(r)}function fe(){return dt(" ")}function bt(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function bT(r){return function(e){return e.preventDefault(),r.call(this,e)}}function N(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function vT(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 Gx(r){return Array.from(r.childNodes)}function Af(r,e){e=""+e,r.data!==e&&(r.data=e)}function nr(r,e){r.value=e==null?"":e}function Cf(r,e,t){for(let n=0;n<r.options.length;n+=1){let i=r.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function ET(r){let e=r.querySelector(":checked");return e&&e.__value}function ir(r,e,t){r.classList[t?"add":"remove"](e)}var Mn=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=jx(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)yi(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(An)}};var ra;function ea(r){ra=r}function Bx(){if(!ra)throw new Error("Function called outside component initialization");return ra}function Pf(r){Bx().$$.on_mount.push(r)}var hi=[];var Mo=[],gi=[],hT=[],Hx=Promise.resolve(),Rf=!1;function zx(){Rf||(Rf=!0,Hx.then(wT))}function na(r){gi.push(r)}var Sf=new Set,mi=0;function wT(){if(mi!==0)return;let r=ra;do{try{for(;mi<hi.length;){let e=hi[mi];mi++,ea(e),Vx(e.$$)}}catch(e){throw hi.length=0,mi=0,e}for(ea(null),hi.length=0,mi=0;Mo.length;)Mo.pop()();for(let e=0;e<gi.length;e+=1){let t=gi[e];Sf.has(t)||(Sf.add(t),t())}gi.length=0}while(hi.length);for(;hT.length;)hT.pop()();Rf=!1,Sf.clear(),ea(r)}function Vx(r){if(r.fragment!==null){r.update(),xn(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(na)}}function Kx(r){let e=[],t=[];gi.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),gi=e}var Qx=new Set;function Xx(r,e){r&&r.i&&(Qx.delete(r),r.i(e))}var Zx=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","ch
<span class="accesskey-first">future</span> dates:`,ip=fe(),ar=V("input"),sp=fe(),$n=V("div"),fa=V("label"),fa.innerHTML='Stat<span class="accesskey">u</span>s',ap=fe(),Lt=V("select");for(let $=0;$<ht.length;$+=1)ht[$].c();op=fe(),Yr=V("div"),Pi=V("div"),ma=V("label"),ma.textContent="Completed:",up=fe(),$r=V("input"),lp=fe(),Ni=V("div"),mu=V("span"),mu.textContent="Created on:",cp=fe(),ga=V("code"),dp=fe(),Ii=V("div"),hu=V("span"),hu.textContent="Done on:",fp=fe(),ya=V("code"),pp=fe(),jn=V("div"),cn=V("button"),mp=dt("Apply"),hp=fe(),Fi=V("button"),Fi.textContent="Cancel",N(i,"for","description"),N(a,"id","description"),N(a,"class","tasks-modal-description"),N(a,"placeholder","Take out the trash"),N(a,"accesskey",o=r[15]("t")),N(n,"class","tasks-modal-section"),N(c,"for",m="priority-"+r[1].priority),N(l,"class","tasks-modal-section tasks-modal-priorities"),N(M,"for","recurrence"),N(M,"class","accesskey-first"),N(q,"id","recurrence"),N(q,"type","text"),N(q,"placeholder","Try 'every 2 weeks on Thursday'."),N(q,"accesskey",W=r[15]("r")),ir(q,"tasks-modal-error",!r[8]),K.a=null,N(Fe,"for","due"),N(Fe,"class","accesskey-first"),N(A,"id","due"),N(A,"type","text"),N(A,"placeholder",Nf),N(A,"accesskey",w=r[15]("d")),ir(A,"tasks-modal-error",!r[7]),f.a=null,N(g,"for","scheduled"),N(g,"class","accesskey-first"),N(v,"id","scheduled"),N(v,"type","text"),N(v,"placeholder",Nf),N(v,"accesskey",k=r[15]("s")),ir(v,"tasks-modal-error",!r[5]),me.a=null,N(te,"for","start"),N(I,"id","start"),N(I,"type","text"),N(I,"placeholder",Nf),N(I,"accesskey",Ae=r[15]("a")),ir(I,"tasks-modal-error",!r[3]),Le.a=null,N(ca,"for","forwardOnly"),N(ar,"id","forwardOnly"),N(ar,"type","checkbox"),N(ar,"class","task-list-item-checkbox tasks-modal-checkbox"),N(ar,"accesskey",da=r[15]("f")),N(E,"class","tasks-modal-section tasks-modal-dates"),N(fa,"for","status"),N(Lt,"id","status-type"),N(Lt,"class","dropdown"),N(Lt,"accesskey",pa=r[15]("u")),r[1].status===void 0&&na(()=>r[39].call(Lt)),N($n,"class","tasks-modal-section"),N(ma,"for","status"),N($r,"id","status"),N($r,"type","checkbox"),N($r,"class","task-list-item-checkbox tasks-modal-checkbox"),$r.checked=ha=r[1].status.isCompleted(),$r.disabled=!0,N(Yr,"class","tasks-modal-section tasks-modal-status"),cn.disabled=_a=!r[14],N(cn,"type","submit"),N(cn,"class","mod-cta"),N(Fi,"type","button"),N(jn,"class","tasks-modal-section tasks-modal-buttons"),ir(t,"with-accesskeys",r[9]),N(e,"class","tasks-modal")},m($,pe){yi($,e,pe),R(e,t),R(t,n),R(n,i),R(n,s),R(n,a),nr(a,r[1].description),r[31](a),R(t,u),R(t,l),R(l,c),R(c,p),R(l,T);for(let ce=0;ce<mt.length;ce+=1)mt[ce]&&mt[ce].m(l,null);R(t,y),R(t,E),R(E,M),R(E,U),R(E,q),nr(q,r[1].recurrenceRule),R(E,ie),R(E,re),R(re,ve),R(re,G),K.m(r[12],re),R(E,Pe),R(E,Fe),R(E,j),R(E,A),nr(A,r[1].dueDate),R(E,B),R(E,C),R(C,X),R(C,d),f.m(r[6],C),R(E,h),R(E,g),R(E,_),R(E,v),nr(v,r[1].scheduledDate),R(E,S),R(E,O),R(O,D),R(O,P),me.m(r[4],O),R(E,ae),R(E,te),R(E,Se),R(E,I),nr(I,r[1].startDate),R(E,Ce),R(E,rt),R(rt,Tr),R(rt,We),Le.m(r[2],rt),R(E,np),R(E,Ci),R(Ci,ca),R(Ci,ip),R(Ci,ar),ar.checked=r[1].forwardOnly,R(t,sp),R(t,$n),R($n,fa),R($n,ap),R($n,Lt);for(let ce=0;ce<ht.length;ce+=1)ht[ce]&&ht[ce].m(Lt,null);Cf(Lt,r[1].status,!0),R(t,op),R(t,Yr),R(Yr,Pi),R(Pi,ma),R(Pi,up),R(Pi,$r),R(Yr,lp),R(Yr,Ni),R(Ni,mu),R(Ni,cp),R(Ni,ga),ga.innerHTML=r[11],R(Yr,dp),R(Yr,Ii),R(Ii,hu),R(Ii,fp),R(Ii,ya),ya.innerHTML=r[13],R(t,pp),R(t,jn),R(jn,cn),R(cn,mp),R(jn,hp),R(jn,Fi),gu||(gp=[bt(a,"input",r[30]),bt(a,"keydown",r[23]),bt(a,"paste",r[24]),bt(a,"drop",r[24]),bt(l,"keyup",r[21]),bt(q,"input",r[34]),bt(A,"input",r[35]),bt(v,"input",r[36]),bt(I,"input",r[37]),bt(ar,"change",r[38]),bt(Lt,"change",r[39]),bt(Fi,"click",r[22]),bt(t,"submit",bT(r[25]))],gu=!0)},p($,pe){if(pe[0]&32768&&o!==(o=$[15]("t"))&&N(a,"accesskey",o),pe[0]&3&&nr(a,$[1].description),pe[0]&3&&m!==(m="priority-"+$[1].priority)&&N(c,"for",m),pe[0]&1081346){Gn=$[20];let ce;for(ce=0;ce<Gn.length;ce+=1){let Li=ST($,Gn,ce);mt[ce]?mt[ce].p(Li,pe):(mt[ce]=RT(Li),mt[ce].c(),mt[ce].m(l,null))}for(;ce<mt.length;ce+=1)mt[ce].d(1);mt.
`);e.setLine(a,T)};new nn({app:n,task:u,onSubmit:l}).open()};var Uf=require("obsidian");var PT=(r,e,t)=>{var u;if(r)return t instanceof Uf.MarkdownView;if(!(t instanceof Uf.MarkdownView))return;let n=(u=t.file)==null?void 0:u.path;if(n===void 0)return;let i=e.getCursor(),s=i.line,a=e.getLine(s),o=sA(a,n);e.setLine(s,o.text),e.setCursor(aA(i,o))},sA=(r,e)=>{let t=Te.fromLine({line:r,taskLocation:ot.fromUnknownPosition(e),fallbackDate:null});if(t!==null){let n=t.toggleWithRecurrenceInUsersOrder().map(i=>i.toFileLineString());return{text:n.join(`
`),moveTo:{line:n.length-1}}}else{let n=r.match(H.taskRegex);if(n!==null){let i=n[3],a=Re.getInstance().bySymbol(i).nextStatusSymbol;return{text:r.replace(H.taskRegex,`$1- [${a}] $4`)}}else if(H.listItemRegex.test(r)){let i=r.replace(H.listItemRegex,"$1$2 [ ]");return{text:i,moveTo:{ch:i.length}}}else{let i=r.replace(H.indentationRegex,"$1- ");return{text:i,moveTo:{ch:i.length}}}}},aA=(r,e)=>{var s;let t={line:0,ch:r.ch},n=he(he({},t),(s=e.moveTo)!=null?s:{}),i=e.text.split(`
`)[n.line].length;return{line:r.line+n.line,ch:Math.min(n.ch,i)}};var Co=class{get app(){return this.plugin.app}constructor({plugin:e}){this.plugin=e,e.addCommand({id:"edit-task",name:"Create or edit task",icon:"pencil",editorCheckCallback:(t,n,i)=>CT(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:PT})}};var Po=class{constructor({obsidianEvents:e}){this.obsidianEvents=e}onCacheUpdate(e){return this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.obsidianEvents.offref(e)}};var NT=require("obsidian");var No=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return F(this,null,function*(){var c;let n=new NT.MarkdownRenderChild(e);t.addChild(n);let i=e.findAll(".task-list-item").filter(p=>{var y;let m=(y=p.textContent)==null?void 0:y.split(`
`);if(m===void 0)return!1;let T=null;for(let E=0;E<m.length;E=E+1)if(m[E]!==""){T=m[E];break}return T===null?!1:we.includedIn(T)});if(i.length===0)return;let s=t.sourcePath,a=t.getSectionInfo(e);if(a===null)return;let o=a.text.split(`
`),u=0,l=[];for(let p=a.lineStart;p<=a.lineEnd;p++){let m=o[p];if(m===void 0)continue;let T=null,y=Te.fromLine({line:m,taskLocation:new ot(s,p,a.lineStart,u,T),fallbackDate:null});y!==null&&(l.push(y),u++)}for(let p=0;p<i.length;p++){let m=l[p],T=i[p];if(m===void 0||T===void 0)continue;let y=(c=T.getAttr("data-line"))!=null?c:"0",E=Number.parseInt(y,10),M=yield m.toLi({parentUlElement:e,listIndex:E,obsidianComponent:n}),U=T.childNodes;for(let ie=0;ie<U.length;ie=ie+1){let re=U[ie];re.nodeName.toLowerCase()==="div"?M.prepend(re):re.nodeName.toLowerCase()==="ul"&&M.append(re)}let q=T.querySelectorAll("[data-footnote-id]"),W=M.querySelectorAll("[data-footnote-id]");if(q.length===W.length)for(let ie=0;ie<q.length;ie++)W[ie].replaceWith(q[ie]);T.replaceWith(M)}})}};var IT=require("@codemirror/view"),FT=require("obsidian");var LT=()=>IT.ViewPlugin.fromClass(Wf),Wf=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 FT.Notice(m,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=Te.fromLine({line:a.text,taskLocation:ot.fromUnknownPosition(""),fallbackDate:null});if(console.debug(`Live Preview Extension: toggle called. Position: ${s} Line: ${a.text}`),o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(m=>m.toFileLineString()).join(i.lineBreak),c=i.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let p=t.checked;return setTimeout(()=>{t.checked=p},1),!0}};var xi=require("obsidian");function Cn(r,e){let t=`Error: ${r}.
The error message was:
`,n="";return e instanceof Error?n+=e:n+="Unknown error",`${t}"${n}"`}var Ir=class{constructor(e,t,n){this.property=e,this.comparator=Ir.maybeReverse(n,t)}static maybeReverse(e,t){return e?Ir.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var sn=class{constructor(e,t,n){this.property=e,this.grouper=t,this.reverse=n}};var ke=class{canCreateFilterForLine(e){return ke.lineMatchesFilter(this.filterRegExp(),e)}static lineMatchesFilter(e,t){return e?e.test(t):!1}static getMatch(e,t){return e?t.match(e):null}fieldNameSingular(){return this.fieldName()}fieldNameSingularEscaped(){return Eo(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=ke.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createSorter(n)}sorterRegExp(){if(!this.supportsSorting())throw Error(`sorterRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)?`)}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new Ir(this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}createGrouperFromLine(e){if(!this.supportsGrouping())return null;let t=ke.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createGrouper(n)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)?$`)}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(e){return new sn(this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};var Oe=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 Oe("None of",e,"NOT")}static booleanXor(e){return new Oe("Exactly one of",e,"XOR")}asString(e=""){if(this.children.length==0)return e+this.description;let t=e;this.symbol===""?t+=this.description:(t+=this.symbol,this.children.length>1&&(t+=` (${this.description})`),t+=":");let n=e+" ";for(let i=0;i<this.children.length;i++)t+=`
${this.children[i].asString(n)}`;return t}static combineOrCreateExplanation(e,t,n){if(t.length===2){let i=t[0],s=t[1];if(i.symbol===n&&s.symbol==="")return i.children.push(s),i}return new Oe(e,t,n)}};var ft=class{constructor(e,t,n){this.instruction=e,this.explanation=n,this.filterFunction=t}explainFilterIndented(e){let t=this.explanation;return t.asString()===this.instruction?`${e}${this.instruction}
2 years ago
`:`${e}${this.instruction} =>
${t.asString(" ")}
`}};var hr=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 hr(e);return n._queryComponent=t,n}static fromError(e,t){let n=new hr(e);return n._error=t,n}};var Z=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 Z(hr.fromObject(e.instruction,e))}static fromError(e,t){return new Z(hr.fromError(e,t))}};var Io=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e==this._instruction}createFilterOrErrorMessage(e){return e===this._instruction?Z.fromFilter(new ft(e,this._filter,new Oe(e))):Z.fromError(e,`do not understand filter: ${e}`)}};var gr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new Io(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 Z.fromError(e,`do not understand filter: ${e}`)}};var an=class extends ke{constructor(){super(...arguments);this._filters=new gr}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var yr=class extends an{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=yr.oldStatusName(e),i=yr.oldStatusName(t);return n<i?1:n>i?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[yr.oldStatusName(e)]}};var pt=class extends ke{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new gr,this.filterInstructions.add(`has ${this.fieldName()} date`,n=>this.date(n)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,n=>this.date(n)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,n=>{let i=this.date(n);return i!==null&&!i.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);if(n.filter!==void 0)return n;let i=ke.getMatch(this.filterRegExp(),t);if(i===null)return Z.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let s=i[1],a=i[2],o=i[3],u=xt.parseDateRange(o);if(!u.isValid()){let p=xt.parseDate(s);p.isValid()&&(u=new yt(p,p))}if(!u.isValid())return Z.fromError(t,"do not understand "+this.fieldName()+" date");let l=this.buildFilterFunction(a,u),c=pt.buildExplanation(this.fieldNameForExplanation(),a,this.filterResultIfFieldMissing(),u);return Z.fromFilter(new ft(t,l,c))}buildFilterFunction(t,n){let i;return t==="before"?i=s=>s?s.isBefore(n.start):this.filterResultIfFieldMissing():t==="after"?i=s=>s?s.isAfter(n.end):this.filterResultIfFieldMissing():i=s=>s?s.isSameOrAfter(n.start)&&s.isSameOrBefore(n.end):this.filterResultIfFieldMissing(),this.getFilter(i)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} ((before|after|on|in)? ?(.*))`)}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,i,s){let a,o="YYYY-MM-DD (dddd Do MMMM YYYY)",u;switch(n){case"before":a=n,u=s.start.format(o);break;case"after":a=n,u=s.end.format(o);break;default:if(!s.start.isSame(s.end)){let c=`${t} date is between:`,p=[new Oe(`${s.start.format(o)} and`),new Oe(`${s.end.format(o)} inclusive`)];return i&&p.push(new Oe(`OR no ${t} date`)),new Oe(c,p)}a="on",u=s.start.format(o);break}let l=`${t} date is ${a} ${u}`;return
2 years 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.
`}explanation(t){let i=oA(t,"using regex: ",this.regexAsString());return new Oe(i)}regexAsString(){let t=`'${this.regex.source}' with `;switch(this.regex.flags.length){case 0:t+="no flags";break;case 1:t+=`flag '${this.regex.flags}'`;break;default:t+=`flags '${this.regex.flags}'`;break}return t}};function oA(r,e,t){var o;let n=r.match(/\//);if(!n)return"Error explaining instruction. Could not find a slash character";let i=2,s=((o=n.index)!=null?o:i)-i;return`${e.padEnd(s)}${t}`}var xe=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return Z.fromError(e,`do not understand query filter (${this.fieldName()})`);let[n,i,s]=t,a=null;if(i.includes("include"))a=new bi(s);else if(i.includes("regex")){try{a=on.validateAndConstruct(s)}catch(l){let c=Cn("Parsing regular expression",l)+`
${on.helpMessage()}`;return Z.fromError(e,c)}if(a===null)return Z.fromError(e,`Invalid instruction: '${e}'
${on.helpMessage()}`)}if(a===null)return Z.fromError(e,`do not understand query filter (${this.fieldName()})`);let o=i.match(/not/)!==null,u=new ft(e,this.getFilter(a,o),a.explanation(e));return Z.fromFilter(u)}fieldPattern(){return this.fieldNameSingularEscaped()}filterOperatorPattern(){return"includes|does not include|regex matches|regex does not match"}filterRegExp(){return new RegExp(`^(?:${this.fieldPattern()}) (${this.filterOperatorPattern()}) (.*)`)}getFilter(e,t){return n=>{let i=e.matches(this.value(n));return t?!i:i}}comparator(){return(e,t)=>this.value(e).localeCompare(this.value(t),void 0,{numeric:!0})}grouper(){return e=>[this.value(e)]}static escapeMarkdownCharacters(e){return e.replace(/\\/g,"\\\\").replace(/_/g,"\\_")}};var vi=class extends xe{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[xe.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var Ei=class extends ke{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return Z.fromError(e,"Filtering by urgency is not yet supported")}fieldName(){return"urgency"}filterRegExp(){throw Error(`filterRegExp() unimplemented for ${this.fieldName()}`)}supportsSorting(){return!0}comparator(){return(e,t)=>t.urgency-e.urgency}supportsGrouping(){return!0}grouper(){return e=>[`${e.urgency.toFixed(2)}`]}createGrouper(e){return super.createGrouper(!e)}};var wi=class{static by(e,t){let n=[new Ei().comparator(),new yr().comparator(),new _i().comparator(),new Pn().comparator(),new vi().comparator()],i=[];for(let s of e)i.push(s.comparator);return t.sort(wi.makeCompositeComparator([...i,...n]))}static makeCompositeComparator(e){return(t,n)=>{for(let i of e){let s=i(t,n);if(s!==0)return s}return 0}}};var Fo=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var Lo=class{constructor(e,t){this.lastHeadingAtLevel=new Array;this.groupers=t;let i=e.keys().next().value.length;for(let s=0;s<i;s++)this.lastHeadingAtLevel.push("")}getHeadingsForTaskGroup(e){let t=new Array;for(let n=0;n<e.length;n++){let i=e[n];if(i!=this.lastHeadingAtLevel[n]){t.push(new Fo(n,i,this.groupers[n].property));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var Uo=class{constructor(e){this.children=new Map;this.values=[];this.values=e}generateAllPaths(e=[]){let t=new Map;if(this.children.size==0)return t.set([...e],this.values),t;for(let[n,i]of this.children)e.push(n),i.generateAllPaths(e).forEach((a,o)=>t.set(o,a)),e.pop();return t}};var Wo=class extends Uo{},qo=class{constructor(e,t){this.root=new Wo(t),this.buildGroupingTree(e)}buildGroupingTree(e){let t=[this.root];for(let n of e){let i=[];for(let s of t)for(let a of s.values){let o=n.grouper(a);o.length===0&&o.push("");for(let u of o){let l=s.children.get(u);l===void 0&&(l=new Wo([]),s.children.set(u,l),i.push(l)),l.values.push(a)}}t=i}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var Yo=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()+`
3 years ago
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
2 years ago
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName}
2 years ago
`;return e+=this.tasksAsStringOfLines(),e}};var ki=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let i=new qo(e,t).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):
2 years ago
`;for(let n of this._groupers){let i=n.reverse?" reverse":"";e+=`- ${n.property}${i}
2 years ago
`}for(let n of this.groups)e+=n.toString(),e+=`
3 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
2 years ago
`,e}addTaskGroups(e){for(let[t,n]of e){let i=new Yo(t,n);this.addTaskGroup(i)}}addTaskGroup(e){this._groups.push(e)}sortTaskGroups(){let e=(t,n)=>{let i=t.groups,s=n.groups;for(let a=0;a<i.length;a++){let o=this._groupers[a],u=i[a].localeCompare(s[a],void 0,{numeric:!0});if(u!==0)return o.reverse?-u:u}return 0};this._groups.sort(e)}setGroupsHeadings(e){let t=new Lo(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 Nn=class extends xe{fieldName(){return"description"}value(e){return we.removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Nn.cleanDescription(e.description),i=Nn.cleanDescription(t.description);return n.localeCompare(i,void 0,{numeric:!0})}}static cleanDescription(e){e=we.removeAsSubstringFrom(e);let t=/^\[\[?([^\]]*)]]?/,n=e.match(t);if(n!==null){let i=n[1];e=i.substring(i.indexOf("|")+1)+e.replace(t,"")}return e=this.replaceFormatting(e,/^\*\*([^*]+)\*\*/),e=this.replaceFormatting(e,/^\*([^*]+)\*/),e=this.replaceFormatting(e,/^==([^=]+)==/),e=this.replaceFormatting(e,/^__([^_]+)__/),e=this.replaceFormatting(e,/^_([^_]+)_/),e}static replaceFormatting(e,t){let n=e.match(t);return n!==null&&(e=n[1]+e.replace(t,"")),e}};var $o=class extends pt{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var jo=class extends pt{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var Go=class extends an{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 ia=class extends hr{};function sa(r){return[["task",r]]}function Yf(r,e){let t=r.map(([n])=>n);try{let n=e.includes("return")?e:`return ${e}`,i=e&&new Function(...t,n);return i instanceof Function?ia.fromObject(e,i):ia.fromError(e,"Error parsing group function")}catch(n){return ia.fromError(e,Cn(`Failed parsing expression "${e}"`,n))}}function $f(r,e){let t=e.map(([n,i])=>i);return r(...t)}function jf(r,e,t){try{return $f(r,e)}catch(n){return Cn(`Failed calculating expression "${t}"`,n)}}function UT(r,e){let t=sa(r),n=Yf(t,e);return n.error?n.error:jf(n.queryComponent,t,e)}var Bo=class{constructor(e){this.line=e,this.functionOrError=Yf(sa(null),e)}isValid(){return this.functionOrError.error===void 0}get parseError(){return this.functionOrError.error}evaluate(e){if(!this.isValid())throw Error(`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`);return $f(this.functionOrError.queryComponent,sa(e))}evaluateOrCatch(e){return this.isValid()?jf(this.functionOrError.queryComponent,sa(e),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};var Ho=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return Z.fromError(e,"Unable to parse line");let n=t[1],i=new Bo(n);return i.isValid()?Z.fromFilter(new ft(e,uA(i),new Oe(e))):Z.fromError(e,i.parseError)}fieldName(){return"function"}filterRegExp(){return new RegExp(`^filter by ${this.fieldNameSingularEscaped()} (.*)`)}supportsGrouping(){return!0}createGrouperFromLine(e){let t=ke.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1],i=t[2];return new sn("function",cA(i),n)}grouperRegExp(){return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`)}grouper(){throw Error("grouper() function not valid for FunctionField. Use createGrouperFromLine() instead.")}};function uA(r){return e=>lA(r,e)}function lA(r,e){let t=r.evaluate(e);if(typeof t=="boolean")return t;throw Error(`filtering function must return true or false. This retu
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.
2 years ago
Example: ${this.fieldNameSingular()} is not NON_TASK`;return Z.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=ln.groupName(e),i=ln.groupName(t);return n.localeCompare(i,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[ln.groupName(e)]}static groupName(e){let t;switch(e.status.type){case"IN_PROGRESS":t="1";break;case"TODO":t="2";break;case"DONE":t="3";break;case"CANCELLED":t="4";break;case"NON_TASK":t="5";break;case"EMPTY":t="6";break}return`%%${t}%%${e.status.type}`}};var au=class extends xe{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 ou=class extends xe{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[xe.escapeMarkdownCharacters(this.value(e))]}};var uu=class extends xe{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[xe.escapeMarkdownCharacters(this.value(e))]}};var lu=class extends xe{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return Z.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=xe.escapeMarkdownCharacters(t);return e.precedingHeader&&e.precedingHeader!==t&&(n+=" > "+e.precedingHeader),[n]}}};var tp=[()=>new su,()=>new ln,()=>new yr,()=>new Xo,()=>new Pn,()=>new Qo,()=>new $o,()=>new Ko,()=>new Vo,()=>new _i,()=>new jo,()=>new vi,()=>new ou,()=>new uu,()=>new lu,()=>new Nn,()=>new In,()=>new zo,()=>new Go,()=>new iu,()=>new Ei,()=>new au,()=>new Ho,()=>new ru];function nu(r){for(let e of tp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function ZT(r){let e=/^sort by /;if(r.match(e)===null)return null;for(let t of tp){let i=t().createSorterFromLine(r);if(i)return i}return null}function JT(r){let e=/^group by /;if(r.match(e)===null)return null;for(let t of tp){let i=t().createGrouperFromLine(r);if(i)return i}return null}var Wn=class{constructor(e){this._searchErrorMessage=void 0;this.taskGroups=e}get searchErrorMessage(){return this._searchErrorMessage}set searchErrorMessage(e){this._searchErrorMessage=e}get totalTasksCount(){return this.taskGroups.totalTasksCount()}get groups(){return this.taskGroups.groups}static fromError(e){let t=new Wn(new ki([],[]));return t._searchErrorMessage=e,t}};var qr=class{constructor({source:e}){this._limit=void 0;this._taskGroupLimit=void 0;this._layoutOptions=new Hs;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|urgency|tags)/;this.shortModeRegexp=/^short/;this.explainQueryRegexp=/^explain/;this.limitRegexp=/^limit (groups )?(to )?(\d+)( tasks?)?/;this.commentRegexp=/^#.*/;this.source=e,e.split(`
`).map(t=>t.trim()).forEach(t=>{switch(!0){case t==="":break;case this.shortModeRegexp.test(t):this._layoutOptions.shortMode=!0;break;case this.explainQueryRegexp.test(t):this._layoutOptions.explainQuery=!0;break;case this.limitRegexp.test(t):this.parseLimit({line:t});break;case this.parseSortBy({line:t}):break;case this.parseGroupBy({line:t}):break;case this.hideOptionsRegexp.test(t):this.parseHideOptions({line:t});break;case this.commentRegexp.test(t):break;case this.parseFilter(t):break;default:this.setError("do not understand query",t)}})}append(e){return this.source===""?e:e.source===""?this:new qr({source:`${this.source}
2 years ago
${e.source}`})}explainQuery(){let e="",t=this.filters.length;if(t===0)e+="No filters supplied. All tasks will match the query.";else for(let i=0;i<t;i++)i>0&&(e+=`
2 years ago
`),e+=this.filters[i].explainFilterIndented("");e+=this.explainQueryLimits();let{debugSettings:n}=Q();return n.ignoreSortInstructions&&(e+=`
2 years ago
2 years ago
NOTE: All sort instructions, including default sort order, are disabled, due to 'ignoreSortInstructions' setting.`),e}explainQueryLimits(){let e="";function t(n){let i=`
2 years ago
2 years ago
At most ${n} task`;return n!==1&&(i+="s"),i}return this._limit!==void 0&&(e+=t(this._limit),e+=`.
2 years ago
`),this._taskGroupLimit!==void 0&&(e+=t(this._taskGroupLimit),e+=` per group (if any "group by" options are supplied).
2 years ago
`),e}get limit(){return this._limit}get layoutOptions(){return this._layoutOptions}get filters(){return this._filters}get sorting(){return this._sorting}get grouping(){return this._grouping}get error(){return this._error}setError(e,t){this._error=`${e}
Problem line: "${t}"`}applyQueryToTasks(e){try{this.filters.forEach(a=>{e=e.filter(a.filterFunction)});let{debugSettings:t}=Q(),i=(t.ignoreSortInstructions?e:wi.by(this.sorting,e)).slice(0,this.limit),s=new ki(this.grouping,i);return this._taskGroupLimit!==void 0&&s.applyTaskLimit(this._taskGroupLimit),new Wn(s)}catch(t){let n="Search failed";return Wn.fromError(Cn(n,t))}}parseHideOptions({line:e}){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1]==="hide";switch(t[2]){case"task count":this._layoutOptions.hideTaskCount=n;break;case"backlink":this._layoutOptions.hideBacklinks=n;break;case"priority":this._layoutOptions.hidePriority=n;break;case"created date":this._layoutOptions.hideCreatedDate=n;break;case"start date":this._layoutOptions.hideStartDate=n;break;case"scheduled date":this._layoutOptions.hideScheduledDate=n;break;case"due date":this._layoutOptions.hideDueDate=n;break;case"done date":this._layoutOptions.hideDoneDate=n;break;case"recurrence rule":this._layoutOptions.hideRecurrenceRule=n;break;case"edit button":this._layoutOptions.hideEditButton=n;break;case"urgency":this._layoutOptions.hideUrgency=n;break;case"tags":this._layoutOptions.hideTags=n;break;default:this.setError("do not understand hide/show option",e)}}}parseFilter(e){var n;let t=nu(e);return t!=null?(t.filter?this._filters.push(t.filter):this.setError((n=t.error)!=null?n:"Unknown error",e),!0):!1}parseLimit({line: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({line:e}){let t=ZT(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy({line:e}){let t=JT(e);return t?(this._grouping.push(t),!0):!1}};function eb(r){let e="";we.isEmpty()||(e+=`Only tasks containing the global filter '${we.get()}'.
2 years ago
2 years ago
`);let t=new qr(bf());return t.source.trim()!==""&&(e+=`Explanation of the global query:
2 years ago
${t.explainQuery()}
`),e+=`Explanation of this Tasks code block query:
2 years ago
2 years ago
${new qr({source:r}).explainQuery()}`,e}function cu(r){return new qr(bf()).append(new qr({source:r}))}var du=class{constructor({plugin:e,events:t}){this.addQueryRenderChild=this._addQueryRenderChild.bind(this);this.app=e.app,this.events=t,e.registerMarkdownCodeBlockProcessor("tasks",this._addQueryRenderChild.bind(this))}_addQueryRenderChild(e,t,n){return F(this,null,function*(){n.addChild(new rp({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},rp=class extends xi.MarkdownRenderChild{constructor({app:t,events:n,container:i,source:s,filePath:a}){super(i);switch(this.app=t,this.events=n,this.source=s,this.filePath=a,this.containerEl.className){case"block-language-tasks":this.query=cu(this.source),this.queryType="tasks";break;default:this.query=cu(this.source),this.queryType="tasks";break}}onload(){this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.renderEventRef=this.events.onCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()}onunload(){this.renderEventRef!==void 0&&this.events.off(this.renderEventRef),this.queryReloadTimeout!==void 0&&clearTimeout(this.queryReloadTimeout)}reloadQueryAtMidnight(){let t=new Date;t.setHours(24,0,0,0);let n=new Date,i=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=cu(this.source),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},i+1e3)}render(i){return F(this,arguments,function*({tasks:t,state:n}){var a;let s=this.containerEl.createEl("div");n==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,n,s):this.query.error!==void 0?this.renderErrorMessage(s,this.query.error):this.renderLoadingMessage(s),(a=this.containerEl.firstChild)==null||a.replaceWith(s)})}renderQuerySearchResults(t,n,i){return F(this,null,function*(){console.debug(`Render ${this.queryType} called for a block in active file "${this.filePath}", to select from ${t.length} tasks: plugin state: ${n}`),this.query.layoutOptions.explainQuery&&this.createExplanation(i);let s=this.query.applyQueryToTasks(t);if(s.searchErrorMessage!==void 0){this.renderErrorMessage(i,s.searchErrorMessage);return}yield this.addAllTaskGroups(s.taskGroups,i);let a=s.totalTasksCount;console.debug(`${a} of ${t.length} tasks displayed in a block in "${this.filePath}"`),this.addTaskCount(i,a)})}renderErrorMessage(t,n){t.createDiv().innerHTML=`<pre>Tasks query: ${n.replace(/\n/g,"<br>")}</pre>`}renderLoadingMessage(t){t.setText("Loading Tasks ...")}createExplanation(t){let n=eb(this.source),i=t.createEl("pre");i.addClasses(["plugin-tasks-query-explanation"]),i.setText(n),t.appendChild(i)}createTasksList(i){return F(this,arguments,function*({tasks:t,content:n}){let s=t.length,a=new Jr(this.query.layoutOptions),o=n.createEl("ul");o.addClasses(["contains-task-list","plugin-tasks-query-result"]),o.addClasses(a.specificClasses);let u=this.getGroupingAttribute();u&&u.length>0&&(o.dataset.taskGroupBy=u);for(let l=0;l<s;l++){let c=t[l],p=this.isFilenameUnique({task:c}),m=yield c.toLi({parentUlElement:o,listIndex:l,layoutOptions:this.query.layoutOptions,isFilenameUnique:p,taskLayout:a,obsidianComponent:this});m.querySelectorAll("[data-footnote-id]").forEach(M=>M.remove());let y=this.query.layoutOptions.shortMode,E=m.createSpan("task-extras");this.query.layoutOptions.hideUrgency||this.addUrgency(E,c),this.query.layoutOptions.hideBacklinks||this.addBacklinks(E,c,y,p),this.query.layoutOptions.hideEditButton||this.addEditButton(E,c),o.appendChild(m)}return{taskList:o,tasksCount:s}})}addEditButton(t,n){t.createEl("a",{cls:"tasks-edit"}).onClickEvent(s=>{s.preventDefault();let a=u=>{Do({originalTask:n,newTasks:Ot.removeInferredStatusIfNeeded(n,u)})};new nn({app:this.app,task:n,onSubmit:a}).open()})}addUrgency(t,n){let i=new Intl.NumberFormat().format(n.urgency);t.createSpan({text:i,cls:"tasks-urgency"})}addAllTaskGroups(t,n){return F(this,null,function*(){for(let i of t.groups){this.addGroupHeadings(n,i.groupHeadings);let{taskList:s}=yield this.createTasksList({tasks:i.tasks,content:n});n.appendChild(s)}})}addGroupHeadings(t
`)+`
2 years ago
Fix errors before saving.`;new sr.Notice(p);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?It.removeValidationError(t):It.setValidationError(t)}};var Ft=class extends be.PluginSettingTab{constructor({plugin:t}){super(t.app,t);this.customFunctions={insertTaskCoreStatusSettings:this.insertTaskCoreStatusSettings.bind(this),insertCustomTaskStatusSettings:this.insertCustomTaskStatusSettings.bind(this)};this.plugin=t}saveSettings(t){return F(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("h3",{text:"Tasks Settings"}),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),t.createEl("h4",{text:"Task Format Settings"}),new be.Setting(t).setName("Task Format").setDesc(Ft.createFragmentWithHTML('<p>The format that Tasks uses to read and write tasks.</p><p><b>Important:</b> Tasks currently only supports one format at a time. Selecting Dataview will currently <b>stop Tasks reading its own emoji signifiers</b>.</p><p>See the <a href="https://publish.obsidian.md/tasks/Reference/Task+Formats/About+Task+Formats">documentation</a>.</p>')).addDropdown(i=>{for(let s of Object.keys(Cr))i.addOption(s,Cr[s].displayName);i.setValue(Q().taskFormat).onChange(s=>F(this,null,function*(){Ge({taskFormat:s}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new be.Setting(t).setName("Global task filter").setDesc(Ft.createFragmentWithHTML('<p><b>Recommended: Leave empty if you want all checklist items in your vault to be tasks managed by this plugin.</b></p><p>Use a global filter if you want Tasks to only act on a subset of your "<code>- [ ]</code>" checklist items, so that a checklist item must include the specified string in its description in order to be considered a task.<p><p>For example, if you set the global filter to <code>#task</code>, the Tasks plugin will only handle checklist items tagged with <code>#task</code>.</br>Other checklist items will remain normal checklist items and not appear in queries or get a done date set.</p><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Global+Filter">documentation</a>.</p>')).addText(i=>{i.setPlaceholder("e.g. #task or TODO").setValue(we.get()).onChange(s=>F(this,null,function*(){we.set(s),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle(i=>{let s=Q();i.setValue(s.removeGlobalFilter).onChange(a=>F(this,null,function*(){Ge({removeGlobalFilter:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),kA(new be.Setting(t).setDesc(Ft.createFragmentWithHTML('<p>A query that is automatically included at the start of every Tasks block in the vault. Useful for adding default filters, or layout options.</p><p>See the <a href="https://publish.obsidian.md/tasks/Queries/Global+Query">documentation</a>.</p>')).addTextArea(i=>{let s=Q();i.inputEl.rows=4,i.setPlaceholder(`# For example...
2 years ago
path does not include _templates/
limit 300
2 years ago
show urgency`).setValue(s.globalQuery).onChange(a=>F(this,null,function*(){Ge({globalQuery:a}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=Q();ub.forEach(i=>{this.addOneSettingsBlock(t,i,n)}),t.createEl("h4",{text:"Date Settings"}),new be.Setting(t).setName("Set created date on every added task").setDesc(Ft.createFragmentWithHTML(`Enabling this will add a timestamp \u2795 YYYY-MM-DD before other date values, when a task is created with 'Create or edit task', or by completing a recurring task.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Created+date">documentation</a>.</p>`)).addToggle(i=>{let s=Q();i.setValue(s.setCreatedDate).onChange(a=>F(this,null,function*(){Ge({setCreatedDate:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Set done date on every completed task").setDesc(Ft.createFragmentWithHTML('Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Done+date">documentation</a>.</p>')).addToggle(i=>{let s=Q();i.setValue(s.setDoneDate).onChange(a=>F(this,null,function*(){Ge({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(Ft.createFragmentWithHTML('Save time entering Scheduled (\u23F3) dates.</br>If this option is enabled, any undated tasks will be given a default Scheduled date extracted from their file name.</br>The date in the file name must be in one of <code>YYYY-MM-DD</code> or <code>YYYYMMDD</code> formats.</br>Undated tasks have none of Due (\u{1F4C5} ), Scheduled (\u23F3) and Start (\u{1F6EB}) dates.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Use+Filename+as+Default+Date">documentation</a>.</p>')).addToggle(i=>{let s=Q();i.setValue(s.useFilenameAsScheduledDate).onChange(a=>F(this,null,function*(){Ge({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Folders with default Scheduled dates").setDesc("Leave empty if you want to use default Scheduled dates everywhere, or enter a comma-separated list of folders.").addText(i=>F(this,null,function*(){let s=Q();yield this.plugin.saveSettings(),i.setValue(Ft.renderFolderArray(s.filenameAsDateFolders)).onChange(a=>F(this,null,function*(){let o=Ft.parseCommaSeparatedFolders(a);Ge({filenameAsDateFolders:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new be.Setting(t).setName("Next recurrence appears on the line below").setDesc(Ft.createFragmentWithHTML('Enabling this will make the next recurrence of a task appear on the line below the completed task. Otherwise the next recurrence will appear before the completed one.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks">documentation</a>.</p>')).addToggle(i=>{let{recurrenceOnNextLine:s}=Q();i.setValue(s).onChange(a=>F(this,null,function*(){Ge({recurrenceOnNextLine:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new be.Setting(t).setName("Auto-suggest task content").setDesc(Ft.createFragmentWithHTML('Enabling this will open an intelligent suggest menu while typing inside a recognized task line.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Auto-Suggest">documentation</a>.</p>')).addToggle(i=>{let s=Q();i.setValue(s.autoSuggestInEditor).onChange(a=>F(this,null,function*(){Ge({autoSuggestInEditor:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Minimum match length for auto-suggest").setDesc("If higher than 0, auto-suggest will be triggered only when the beginning of any supported keywords is recognized.").addSlider(i=>{let s=Q();i.setLimits(0,3,1).setValue(s.autoSuggestMinMatch).setDynamicTooltip().onChange(a=>F(this,null,function*(){Ge({autoSuggestMinMatch:a}),yield this.plugin.saveSettings()}))}),new be.Setting(t).setName("Maximum number of auto-suggestio
`);t(o)}).open(),n};var fb=(r,e)=>{let t=Ao({line:"",path:""});return new nn({app:r,task:t,onSubmit:e})};var pb=r=>({createTaskLineModal:()=>db(r,fb)});var pu=class extends mb.Plugin{get apiV1(){return pb(app)}onload(){return F(this,null,function*(){wo.registerConsoleLogger(),console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new la({plugin:this})),aT({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let t=new Po({obsidianEvents:this.app.workspace});this.cache=new Rn({metadataCache:this.app.metadataCache,vault:this.app.vault,events:t}),this.inlineRenderer=new No({plugin:this}),this.queryRenderer=new du({plugin:this,events:t}),this.registerEditorExtension(LT()),this.registerEditorSuggest(new fu(this.app,Q())),new Co({plugin:this})})}loadTaskStatuses(){return F(this,null,function*(){let{statusSettings:t}=Q();He.applyToStatusRegistry(t,Re.getInstance())})}onunload(){var t;console.log('unloading plugin "tasks"'),(t=this.cache)==null||t.unload()}loadSettings(){return F(this,null,function*(){let t=yield this.loadData();Ge(t),yield this.loadTaskStatuses()})}saveSettings(){return F(this,null,function*(){yield this.saveData(Q())})}getTasks(){var t;return(t=this.cache)==null?void 0:t.getTasks()}};
2 years ago
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
*
* Copyright (c) 2013 hij1nx
* Licensed under the MIT license.
*/