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.

190 lines
340 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.
*/
"use strict";var _T=Object.create;var vi=Object.defineProperty,TT=Object.defineProperties,bT=Object.getOwnPropertyDescriptor,vT=Object.getOwnPropertyDescriptors,ET=Object.getOwnPropertyNames,Pf=Object.getOwnPropertySymbols,wT=Object.getPrototypeOf,Cf=Object.prototype.hasOwnProperty,OT=Object.prototype.propertyIsEnumerable;var xf=(r,e,t)=>e in r?vi(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Re=(r,e)=>{for(var t in e||(e={}))Cf.call(e,t)&&xf(r,t,e[t]);if(Pf)for(var t of Pf(e))OT.call(e,t)&&xf(r,t,e[t]);return r},wt=(r,e)=>TT(r,vT(e));var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),DT=(r,e)=>{for(var t in e)vi(r,t,{get:e[t],enumerable:!0})},Nf=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ET(e))!Cf.call(r,i)&&i!==t&&vi(r,i,{get:()=>e[i],enumerable:!(n=bT(e,i))||n.enumerable});return r};var Xs=(r,e,t)=>(t=r!=null?_T(wT(r)):{},Nf(e||!r||!r.__esModule?vi(t,"default",{value:r,enumerable:!0}):t,r)),RT=r=>Nf(vi({},"__esModule",{value:!0}),r);var N=(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 sp=p((EA,ra)=>{var Lf,qf,Wf,Yf,jf,$f,Bf,Gf,Hf,ea,Uo,zf,Kf,Vf,kn,Xf,Zf,Qf,Jf,ep,tp,rp,np,ip,ta;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(t(e,t(n)))}):typeof ra=="object"&&typeof ra.exports=="object"?r(t(e,t(ra.exports))):r(t(e));function t(n,i){return n!==e&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,a){return n[s]=i?i(s,a):a}}})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};Lf=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(n,i);function s(){this.constructor=n}n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},qf=Object.assign||function(n){for(var i,s=1,a=arguments.length;s<a;s++){i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n},Wf=function(n,i){var s={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.indexOf(a)<0&&(s[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,a=Object.getOwnPropertySymbols(n);o<a.length;o++)i.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(n,a[o])&&(s[a[o]]=n[a[o]]);return s},Yf=function(n,i,s,a){var o=arguments.length,u=o<3?i:a===null?a=Object.getOwnPropertyDescriptor(i,s):a,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,i,s,a);else for(var c=n.length-1;c>=0;c--)(l=n[c])&&(u=(o<3?l(u):o>3?l(i,s,u):l(i,s))||u);return o>3&&u&&Object.defineProperty(i,s,u),u},jf=function(n,i){return function(s,a){i(s,a,n)}},$f=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},Bf=function(n,i,s,a){function o(u){return u instanceof s?u:new s(function(l){l(u)})}return new(s||(s=Promise))(function(u,l){function c(h){try{f(a.next(h))}catch(y){l(y)}}function d(h){try{f(a.throw(h))}catch(y){l(y)}}function f(h){h.done?u(h.value):o(h.value).then(c,d)}f((a=a.apply(n,i||[])).next())})},Gf=function(n,i){var s={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},a,o,u,l;return l={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function c(f){return function(h){return d([f,h])}}function d(f){if(a)throw new TypeError("Generator is already executing.");for(;s;)try{if(a=1,o&&(u=f[0]&2?o.return:f[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,f[1])).done)return u;switch(o=0,u&&(f=[f[0]&2,u.value]),f[0]){case 0:case 1:u=f;break;case 4:return s.label++,{value:f[1],done:!1};case 5:s.label++,o=f[1],
`).map(FT).filter(function(t){return t!==null});return Je(Je({},e[0]),e[1])}function Ri(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=I.untilStringToDate(i),e}function FT(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return mp(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return mp(r);case"DTSTART":return Ri(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function mp(r){var e=r.replace(/^RRULE:/i,""),t=Ri(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=G[o.toUpperCase()];break;case"WKST":t.wkst=Dt[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=UT(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=LT(o);break;case"DTSTART":case"TZID":var c=Ri(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=I.untilStringToDate(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function UT(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(yp)}return yp(r)}function yp(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function LT(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Dt[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=Dt[s].weekday;return new Se(a,i)})}var Vr=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=I.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 Mi(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(Di),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!X(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!pe(o)||Be(o)&&!o.length)){switch(a){case"FREQ":u=k.FREQUENCIES[r.freq];break;case"WKST":pt(o)?u=new Se(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=Ff(o).map(function(h){return h instanceof Se?h:Be(h)?new Se(h[0],h[1]):new Se(h)}).toString();break;case"DTSTART":t=qT(o,r.tzid);break;case"UNTIL":u=I.timeToUntilString(o,!r.tzid);break;default:if(Be(o)){for(var l=[],c=0;c<o.length;c++)l[c]=String(o[c]);u=l.toString()}else u=String(o)}u&&e.push([a,u])}}var d=e.map(function(h){var y=h[0],m=h[1];return"".concat(y,"=").concat(m.toString())}).join(";"),f="";return d!==""&&(f="RRULE:".concat(d)),[t,f].filter(function(h){return!!h}).join(`
`)}function qT(r,e){return r?"DTSTART"+new Vr(new Date(r),e).toString():""}function WT(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 gp=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?I.clone(t):I.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 d=0;d<i.length;d++){var f=i[d];if(!WT(t[f],c[f]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(Be(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 or(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return Be(n)?I.cloneDates(n):n instanceof Date?I.clone(n):n},r}();var _p=T(T(T(T(T(T(T(T(T(T(T(T(T([],K(1,31),!0),K(2,28),!0),K(3,31),!0),K(4,30),!0),K(5,31),!0),K(6,30),!0),K(7,31),!0),K(8,31),!0),K(9,30),!0),K(10,31),!0),K(11,30),!0),K(12,31),!0),K(1,7),!0),Tp=T(T(T(T(T(T(T(T(T(T(T(T(T([],K(1,31),!0),K(2,29),!0),K(3,31),!0),K(4,30),!0),K(5,31),!0),K(6,30),!0),K(7,31),!0),K(8,31),!0),K(9,30),!0),K(10,31),!0),K(11,30),!0),K(12,31),!0),K(1,7),!0),YT=Ot(1,29),jT=Ot(1,30),xr=Ot(1,31),Ve=Ot(1,32),bp=T(T(T(T(T(T(T(T(T(T(T(T(T([],Ve,!0),jT,!0),Ve,!0),xr,!0),Ve,!0),xr,!0),Ve,!0),Ve,!0),xr,!0),Ve,!0),xr,!0),Ve,!0),Ve.slice(0,7),!0),vp=T(T(T(T(T(T(T(T(T(T(T(T(T([],Ve,!0),YT,!0),Ve,!0),xr,!0),Ve,!0),xr,!0),Ve,!0),Ve,!0),xr,!0),Ve,!0),xr,!0),Ve,!0),Ve.slice(0,7),!0),$T=Ot(-28,0),BT=Ot(-29,0),Cr=Ot(-30,0),Xe=Ot(-31,0),Ep=T(T(T(T(T(T(T(T(T(T(T(T(T([],Xe,!0),BT,!0),Xe,!0),Cr,!0),Xe,!0),Cr,!0),Xe,!0),Xe,!0),Cr,!0),Xe,!0),Cr,!0),Xe,!0),Xe.slice(0,7),!0),wp=T(T(T(T(T(T(T(T(T(T(T(T(T([],Xe,!0),$T,!0),Xe,!0),Cr,!0),Xe,!0),Cr,!0),Xe,!0),Xe,!0),Cr,!0),Xe,!0),Cr,!0),Xe,!0),Xe.slice(0,7),!0),Op=[0,31,60,91,121,152,182,213,244,274,305,335,366],Dp=[0,31,59,90,120,151,181,212,243,273,304,334,365],Wo=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Ot(7));return r}();function Rp(r,e){var t=new Date(Date.UTC(r,0,1)),n=I.isLeapYear(r)?366:365,i=I.isLeapYear(r+1)?366:365,s=I.toOrdinal(t),a=I.getWeekday(t),o=Je(Je({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},GT(r)),{wnomask:null});if(ht(e.byweekno))return o;o.wnomask=K(0,n+7);var u,l,c=u=Ke(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+Ke(a-e.wkst,7)):l=n-c;for(var d=Math.floor(l/7),f=Ke(l,7),h=Math.floor(d+f/4),y=0;y<e.byweekno.length;y++){var m=e.byweekno[y];if(m<0&&(m+=h+1),m>0&&m<=h){var g=void 0;m>1?(g=c+(m-1)*7,c!==u&&(g-=7-u)):g=c;for(var O=0;O<7&&(o.wnomask[g]=1,g++,o.wdaymask[g]!==e.wkst);O++);}}if(X(e.byweekno,1)){var g=c+h*7;if(c!==u&&(g-=7-u),g<n)for(var y=0;y<7&&(o.wnomask[g]=1,g+=1,o.wdaymask[g]!==e.wkst);y++);}if(c){var w=void 0;if(X(e.byweekno,-1))w=-1;else{var P=I.getWeekday(new Date(Date.UTC(r-1,0,1))),H=Ke(7-P.valueOf()+e.wkst,7),ye=I.isLeapYear(r-1)?366:365,_e=void 0;H>=4?(H=0,_e=ye+Ke(P-e.wkst,7)):_e=n-c,w=Math.floor(52+Ke(_e,7)/4)}if(X(e.byweekno,w))for(var g=0;g<c;g++)o.wnomask[g]=1}return o}function GT(r){var e=I.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=I.getWeekday(t);return e===365?{mmask:_p,mdaymask:vp,nmdaymask:wp,wdaymask:Wo.slice(n),mrange:Dp}:{mmask:Tp,mdaymask:bp,nmdaymask:Ep,wdaymask:Wo.slice(n),mrange:Op}}function Sp(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===k.YEARLY)if(ht(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===k.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(ht(o))return a;a.nwdaymask=K(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],c=l[0],d=l[1]-1,f=0;f<s.bynweekday.length;f++){var h=void 0,y=s.bynweekday[f],m=y[0],g=y[1];g<0?(h=d+(g+1)*7,h-=Ke(i[h]-m,7)):(h=c+(g-1)*7,h+=Ke(7-i[h]+m,7)),c<=h&&h<=d&&(a.nwdaymask[h]=1)}return a}function Mp(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),i=r%100,s=Math.floor(n/4),a=n%4,o=Math.floor((n+8)/25),u=
`),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 rb(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Np(r,e){return rb(e),r.split(",").map(function(t){return I.untilStringToDate(t)})}function Ip(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 jo=function(r){An(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=Ip.apply(n,["dtstart"]),n.tzid=Ip.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return xp(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){Fp(t,this._rrule)},e.prototype.exrule=function(t){Fp(t,this._exrule)},e.prototype.rdate=function(t){Up(t,this._rdate)},e.prototype.exdate=function(t){Up(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return ia(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return ia(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(Mi({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(`
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(Lp("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(Lp("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}(k);function Fp(r,e){if(!(r instanceof k))throw new TypeError(String(r)+" is not RRule instance");X(e.map(String),String(r))||e.push(r)}function Up(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");X(e.map(Number),Number(r))||(e.push(r),I.sort(e))}function Lp(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return I.timeToUntilString(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}function It(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 Ie=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=k.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 k(u);return new Ie({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}catch(s){}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(){var t;let e;if(this.baseOnToday){let n=window.moment(),i=new k(wt(Re({},this.rrule.origOptions),{dtstart:n.startOf("day").utc(!0).toDate()}));e=this.nextAfter(n.endOf("day"),i)}else{let n=window.moment((t=this.referenceDate)!=null?t:void 0).endOf("day");e=this.nextAfter(n,this.rrule)}if(e!==null){let n=null,i=null,s=null;if(this.referenceDate){if(this.startDate){let a=window.moment.duration(this.startDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(a.asDays()),"days")}if(this.scheduledDate){let a=window.moment.duration(this.scheduledDate.diff(this.referenceDate));i=window.moment(e),i.add(Math.round(a.asDays()),"days")}if(this.dueDate){let a=window.moment.duration(this.dueDate.diff(this.referenceDate));s=window.moment(e),s.add(Math.round(a.asDays()),"days")}}return{startDate:n,scheduledDate:i,dueDate:s}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||It(this.startDate,e.startDate)!==0||It(this.scheduledDate,e.scheduledDate)!==0||It(this.dueDate,e.dueDate)!==0?!1:this.toText()===e.toText()}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=Ie.nextAfterMonths(e,n,t,s[1])));let a=i.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=Ie.nextAfterYears(e,n,t,a[1])),Ie.addTimezone(n).toDate()}static nextAfterMonths(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));Ie.isSkippingTooManyMonths(e,t,s);)t=Ie.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));Ie.isSkippingTooManyYears(e,t,s);)t=Ie.fromOneDayEarlier(e,n);return t}static isSkippingTooManyYears(e,t,n){return t.year()-e.year()>n}static fromOneDayEarlier(e,t){e.subtract(1,"days").endOf("day");let n=t.origOptions;return n.dtstart=e.startOf("day").toDate(),t=new k(n),window.moment(t.after(e.toDate()))}static addTimezone(e){return window.moment.utc(e).local(!0).startOf("day")}};var Rt=(a=>(a.TODO="TODO",a.DONE="DONE",a.IN_PROGRESS="IN_PROGRESS",a.CANCELLED="CANCELLED",a.NON_TASK="NON_TASK",a.EMPTY="EMPTY",a))(Rt||
`),{globalFilter:f}=U(),h,y=0;for(let g of l){if(g.position.start.line<r.sectionStart||g.task===void 0)continue;if(d[g.position.start.line].includes(f)){if(y===r.sectionIndex){h=g;break}y++}}if(h===void 0){console.error("Tasks: could not find task to toggle in the file.");return}let m=[...d.slice(0,h.position.start.line),...e.map(g=>g.toFileLineString()),...d.slice(h.position.start.line+1)];yield t.modify(o,m.join(`
`))});function sb(r,e,t){return N(this,null,function*(){yield Bp.MarkdownRenderer.renderMarkdown(r,e,t,null)})}function Gp(r,e,t=null){return N(this,null,function*(){var a;t||(t=sb);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"),yield ab(r,e,i,t);let s=document.createElement("input");return n.appendChild(s),s.classList.add("task-list-item-checkbox"),s.type="checkbox",r.status.symbol!==" "&&(s.checked=!0,n.classList.add("is-checked")),s.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),s.disabled=!0;let u=r.toggle();sa({originalTask:r,newTasks:u})}),n.prepend(s),n.setAttribute("data-task",r.status.symbol.trim()),n.setAttribute("data-line",e.listIndex.toString()),s.setAttribute("data-line",e.listIndex.toString()),(a=e.layoutOptions)!=null&&a.shortMode&&ub({task:r,element:i,isFilenameUnique:e.isFilenameUnique}),n})}function ab(r,e,t,n){return N(this,null,function*(){let i="",s=new Mn(e.layoutOptions);for(let a of s.layoutComponents){let o=r.componentToString(s,a);o&&(a==="description"&&(o=lb(o)),i+=o)}yield ob(t,i,"description",r,n)})}function ob(r,e,t,n,i){return N(this,null,function*(){if(t==="description"){yield i(e,r,n.path);let s=r.querySelector("blockquote"),a=s!=null?s:r,o=a.querySelector("p");if(o!==null){for(;o.firstChild;)a.insertBefore(o.firstChild,o);o.remove()}r.querySelectorAll("p").forEach(u=>{u.hasChildNodes()||u.remove()}),r.querySelectorAll(".footnotes").forEach(u=>{u.remove()})}else r.innerHTML=e})}function ub({task:r,element:e,isFilenameUnique:t}){e.addEventListener("mouseenter",()=>{let n=e.createDiv();n.addClasses(["tooltip","mod-right"]),r.recurrence&&n.createDiv().setText(`${Ft} ${r.recurrence.toText()}`),r.startDate&&n.createDiv().setText(aa({signifier:Ut,date:r.startDate})),r.scheduledDate&&n.createDiv().setText(aa({signifier:Lt,date:r.scheduledDate})),r.dueDate&&n.createDiv().setText(aa({signifier:qt,date:r.dueDate})),r.doneDate&&n.createDiv().setText(aa({signifier:oa,date:r.doneDate}));let i=r.getLinkText({isFilenameUnique:t});i&&n.createDiv().setText(`\u{1F517} ${i}`),e.addEventListener("mouseleave",()=>{n.remove()})})}function aa({signifier:r,date:e}){return`${r} ${e.format(S.dateFormat)} (${e.from(window.moment().startOf("day"))})`}function lb(r){let{globalFilter:e,removeGlobalFilter:t}=U();return t?r.replace(e,"").trim():r}var st=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=U();return!t||!this.matchesAnyFolder(n,e)?null:this.extractDateFromPath(e)}static matchesAnyFolder(e,t){return e.length===0?!0:e.some(n=>t.startsWith(n+"/"))}static extractDateFromPath(e){let t=Math.max(0,e.lastIndexOf("/")+1),n=e.lastIndexOf("."),i=e.substring(t,n),s=/(\d{4})-(\d{2})-(\d{2})/.exec(i);if(s||(s=/(\d{4})(\d{2})(\d{2})/.exec(i)),s){let a=window.moment([parseInt(s[1]),parseInt(s[2])-1,parseInt(s[3])]);if(a.isValid())return a}return null}static canApplyFallback({startDate:e,scheduledDate:t,dueDate:n}){return e===null&&n===null&&t===null}static updateTaskPath(e,t,n){let i=e.scheduledDate,s=e.scheduledDateIsInferred;return n===null?s&&(s=!1,i=null):s?i=n:this.canApplyFallback(e)&&(i=n,s=!0),new me(wt(Re({},e),{path:t,scheduledDate:i,scheduledDateIsInferred:s}))}static removeInferredStatusIfNeeded(e,t){let n=e.scheduledDateIsInferred?e.scheduledDate:null;return t.map(i=>(n!==null&&!n.isSame(i.scheduledDate,"day")&&(i=new me(wt(Re({},i),{scheduledDateIsInferred:!1}))),i))}};function ua(r){return r.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")}var Ce={High:"\u23EB",Medium:"\u{1F53C}",Low:"\u{1F53D}",None:""},Ft="\u{1F501}",Ut="\u{1F6EB}",Lt="\u23F3",qt="\u{1F4C5}",oa="\u2705",mt=class{},S=mt;S.dateFormat="YYYY-MM-DD",S.indentationRegex=/^([\s\t>]*)/,S.listMarkerRegex=/([-*]|[0-9]+\.)/,S.checkboxRegex=/\[(.)\]/u,S.afterCheckboxRegex=/ *(.*)/u,S.taskRegex=new RegExp(mt.indentationRegex.source+mt.listMarkerRegex.source+" +"+mt.checkboxRegex.source+mt.afterCheckboxRegex.source,"u"),S.nonTaskRegex=new Re
`),o=a.length,u=new ki(()=>st.fromPath(i.path)),l=null,c=0;for(let d of t)if(d.task!==void 0){let f=d.position.start.line;if(f>=o)return console.log(`${i.path} Obsidian gave us a line number ${f} past the end of the file. ${o}.`),s;if((l===null||l.position.end.line<f)&&(l=Zr.getSection(f,n.sections),c=0),l===null)continue;let h=a[f];if(h===void 0){console.log(`${i.path}: line ${f} - ignoring 'undefined' line.`);continue}let y;try{y=me.fromLine({line:h,path:i.path,sectionStart:l.position.start.line,sectionIndex:c,precedingHeader:Zr.getPrecedingHeader(f,n.headings),fallbackDate:u.value})}catch(m){this.reportTaskParsingErrorToUser(m,i,d,h);continue}y!==null&&(c++,s.push(y))}return s}reportTaskParsingErrorToUser(e,t,n,i){let s=`There was an error reading one of the tasks in this vault.
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: ${e}
File: ${t.path}
Line number: ${n.position.start.line}
Task line: ${i}
Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.
Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'
The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.
`;console.error(s),e instanceof Error&&console.error(e.stack),this.state==="Initializing"&&new Cn.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 Hd=require("obsidian");var L_=require("obsidian");function Jr(){}function Ko(r){return r()}function zp(){return Object.create(null)}function en(r){r.forEach(Ko)}function Vp(r){return typeof r=="function"}function Xp(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Zp(r){return Object.keys(r).length===0}var Qp=!1;function cb(){Qp=!0}function db(){Qp=!1}function _(r,e){r.appendChild(e)}function Nn(r,e,t){r.insertBefore(e,t||null)}function tn(r){r.parentNode.removeChild(r)}function Vo(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function L(r){return document.createElement(r)}function fb(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function at(r){return document.createTextNode(r)}function J(){return at(" ")}function St(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function Jp(r){return function(e){return e.preventDefault(),r.call(this,e)}}function D(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function pb(r){return Array.from(r.childNodes)}function Xo(r,e){e=""+e,r.wholeText!==e&&(r.data=e)}function Wt(r,e){r.value=e==null?"":e}function Zo(r,e){for(let t=0;t<r.options.length;t+=1){let n=r.options[t];if(n.__value===e){n.selected=!0;return}}r.selectedIndex=-1}function eh(r){let e=r.querySelector(":checked")||r.options[0];return e&&e.__value}function Yt(r,e,t){r.classList[t?"add":"remove"](e)}var Qr=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=fb(t.nodeName):this.e=L(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)Nn(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(tn)}};var xi;function Pi(r){xi=r}function hb(){if(!xi)throw new Error("Function called outside component initialization");return xi}function Qo(r){hb().$$.on_mount.push(r)}var Ai=[];var da=[],ca=[],Kp=[],mb=Promise.resolve(),zo=!1;function yb(){zo||(zo=!0,mb.then(th))}function Ci(r){ca.push(r)}var Ho=new Set,la=0;function th(){let r=xi;do{for(;la<Ai.length;){let e=Ai[la];la++,Pi(e),gb(e.$$)}for(Pi(null),Ai.length=0,la=0;da.length;)da.pop()();for(let e=0;e<ca.length;e+=1){let t=ca[e];Ho.has(t)||(Ho.add(t),t())}ca.length=0}while(Ai.length);for(;Kp.length;)Kp.pop()();zo=!1,Ho.clear(),Pi(r)}function gb(r){if(r.fragment!==null){r.update(),en(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Ci)}}var _b=new Set;function Tb(r,e){r&&r.i&&(_b.delete(r),r.i(e))}var tN=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function bb(r,e,t,n){let{fragment:i,on_mount:s,on_destroy:a,after_update:o}=r.$$;i&&i.m(e,t),n||Ci(()=>{let u=s.map(Ko).filter(Vp);a?a.push(...u):en(u),r.$$.on_mount=[]}),o.forEach(Ci)}function rh(r,e){let t=r.$$;t.fragment!==null&&(en(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function vb(r,e){r.$$.dirty[0]===-1&&(Ai.push(r),yb(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function nh(r,e,t,n,i,s,a,o=[-1]){let u=xi;Pi(r);let l=r.$$={fragment:null,ctx:null,props:s,update:Jr,not_equal:i,bound:zp(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:zp(),dirty:o,skip_bound:!1,root:e.target||u.$$.root};a&&a(l.root);let c=!1;if(l.ctx=t?t(r,e.props||{},(d,f,...h)=>{let y=h.length?h[0]:f;return l.ctx&&i(l.ctx[d],l.ctx[d]=y)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](y),c&&vb(r,d)),f}):[],l.update(),c=!0,en(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){
<span class="accesskey-first">future</span> dates:`,bf=J(),Xt=L("input"),vf=J(),wn=L("div"),Gs=L("label"),Gs.textContent="Status",Ef=J(),Zt=L("select");for(let M=0;M<rt.length;M+=1)rt[M].c();wf=J(),On=L("div"),gi=L("div"),Hs=L("label"),Hs.textContent="Completed:",Of=J(),Ar=L("input"),Df=J(),_i=L("div"),Co=L("span"),Co.textContent="Done on:",Rf=J(),Ks=L("code"),Sf=J(),Dn=L("div"),Hr=L("button"),Mf=at("Apply"),kf=J(),Ti=L("button"),Ti.textContent="Cancel",D(i,"for","description"),D(a,"id","description"),D(a,"type","text"),D(a,"class","tasks-modal-description"),D(a,"placeholder","Take out the trash"),D(a,"accesskey",o=r[13]("t")),D(n,"class","tasks-modal-section"),D(c,"for",f="priority-"+r[1].priority),D(l,"class","tasks-modal-section tasks-modal-priorities"),D(g,"for","recurrence"),D(g,"class","accesskey-first"),D(w,"id","recurrence"),D(w,"type","text"),D(w,"placeholder","Try 'every 2 weeks on Thursday'."),D(w,"accesskey",P=r[13]("r")),Yt(w,"tasks-modal-error",!r[11]),j.a=null,D(dt,"for","due"),D(dt,"class","accesskey-first"),D(E,"id","due"),D(E,"type","text"),D(E,"placeholder",jd),D(E,"accesskey",b=r[13]("d")),Yt(E,"tasks-modal-error",!r[9]),V.a=null,D(Z,"for","scheduled"),D(Z,"class","accesskey-first"),D(x,"id","scheduled"),D(x,"type","text"),D(x,"placeholder",jd),D(x,"accesskey",ie=r[13]("s")),Yt(x,"tasks-modal-error",!r[8]),Pe.a=null,D(ar,"for","start"),D(ft,"id","start"),D(ft,"type","text"),D(ft,"placeholder",jd),D(ft,"accesskey",Ys=r[13]("a")),Yt(ft,"tasks-modal-error",!r[7]),js.a=null,D($s,"for","forwardOnly"),D(Xt,"id","forwardOnly"),D(Xt,"type","checkbox"),D(Xt,"class","task-list-item-checkbox tasks-modal-checkbox"),D(Xt,"accesskey",Bs=r[13]("f")),D(m,"class","tasks-modal-section tasks-modal-dates"),D(Gs,"for","status"),D(Zt,"id","status-type"),D(Zt,"class","dropdown"),r[1].status===void 0&&Ci(()=>r[30].call(Zt)),D(wn,"class","tasks-modal-section"),D(Hs,"for","status"),D(Ar,"id","status"),D(Ar,"type","checkbox"),D(Ar,"class","task-list-item-checkbox tasks-modal-checkbox"),Ar.checked=zs=r[1].status.isCompleted(),Ar.disabled=!0,D(On,"class","tasks-modal-section tasks-modal-status"),Hr.disabled=Vs=!(r[9]&&r[11]&&r[8]&&r[7]),D(Hr,"type","submit"),D(Hr,"class","mod-cta"),D(Ti,"type","button"),D(Dn,"class","tasks-modal-section tasks-modal-buttons"),Yt(t,"with-accesskeys",r[5]),D(e,"class","tasks-modal")},m(M,ee){Nn(M,e,ee),_(e,t),_(t,n),_(n,i),_(n,s),_(n,a),Wt(a,r[1].description),r[22](a),_(t,u),_(t,l),_(l,c),_(c,d),_(l,h);for(let Q=0;Q<tt.length;Q+=1)tt[Q].m(l,null);_(t,y),_(t,m),_(m,g),_(m,O),_(m,w),Wt(w,r[1].recurrenceRule),_(m,H),_(m,ye),_(ye,_e),_(ye,se),j.m(r[10],ye),_(m,vt),_(m,dt),_(m,A),_(m,E),Wt(E,r[1].dueDate),_(m,C),_(m,v),_(v,q),_(v,F),V.m(r[4],v),_(m,ue),_(m,Z),_(m,ge),_(m,x),Wt(x,r[1].scheduledDate),_(m,Te),_(m,ve),_(ve,Et),_(ve,De),Pe.m(r[3],ve),_(m,kr),_(m,ar),_(m,mf),_(m,ft),Wt(ft,r[1].startDate),_(m,yf),_(m,mi),_(mi,gf),_(mi,_f),js.m(r[2],mi),_(m,Tf),_(m,yi),_(yi,$s),_(yi,bf),_(yi,Xt),Xt.checked=r[1].forwardOnly,_(t,vf),_(t,wn),_(wn,Gs),_(wn,Ef),_(wn,Zt);for(let Q=0;Q<rt.length;Q+=1)rt[Q].m(Zt,null);Zo(Zt,r[1].status),_(t,wf),_(t,On),_(On,gi),_(gi,Hs),_(gi,Of),_(gi,Ar),_(On,Df),_(On,_i),_(_i,Co),_(_i,Rf),_(_i,Ks),Ks.innerHTML=r[12],_(t,Sf),_(t,Dn),_(Dn,Hr),_(Hr,Mf),_(Dn,kf),_(Dn,Ti),No||(Af=[St(a,"input",r[21]),St(l,"keyup",r[15]),St(w,"input",r[25]),St(E,"input",r[26]),St(x,"input",r[27]),St(ft,"input",r[28]),St(Xt,"change",r[29]),St(Zt,"change",r[30]),St(Ti,"click",r[16]),St(t,"submit",Jp(r[17]))],No=!0)},p(M,ee){if(ee[0]&8192&&o!==(o=M[13]("t"))&&D(a,"accesskey",o),ee[0]&3&&a.value!==M[1].description&&Wt(a,M[1].description),ee[0]&3&&f!==(f="priority-"+M[1].priority)&&D(c,"for",f),ee[0]&24578){Rn=M[14];let Q;for(Q=0;Q<Rn.length;Q+=1){let bi=N_(M,Rn,Q);tt[Q]?tt[Q].p(bi,ee):(tt[Q]=I_(bi),tt[Q].c(),tt[Q].m(l,null))}for(;Q<tt.length;Q+=1)tt[Q].d(1);tt.length=Rn.length}if(ee[0]&8192&&P!==(P=M[13]("r"))&&D(w,"accesskey",P),ee[0]&3&&w.value!==M[1].recurrenceRule&&Wt(w,M[1].recurrenceRule),ee[0]&2048&&Yt(w,"tasks-modal-error",!M[11]),ee[0]&1024&&j.p(M[10]),ee[0]&8192&&b!==(b=M[13]("d"))
`);e.setLine(a,h)};new Qn({app:n,task:u,onSubmit:l}).open()};var zd=require("obsidian");var Y_=(r,e,t)=>{var u;if(r)return t instanceof zd.MarkdownView;if(!(t instanceof zd.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=Bk(a,n);e.setLine(s,o),e.setCursor({line:i.line,ch:Hk(i.ch,a,o)})},Bk=(r,e)=>{let t=r,n=me.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null,fallbackDate:null});if(n!==null)t=Gk(n);else{let i=r.match(S.taskRegex);if(i!==null){let s=i[3],o=de.getInstance().bySymbol(s).nextStatusSymbol;t=r.replace(S.taskRegex,`$1- [${o}] $4`)}else S.listItemRegex.test(r)?t=r.replace(S.listItemRegex,"$1$2 [ ]"):t=r.replace(S.indentationRegex,"$1- ")}return t},Gk=r=>r.toggle().map(t=>t.toFileLineString()).join(`
`),Hk=(r,e,t)=>{let n=t.length;if(n<=e.length)return r>=t.length?n:r;let i=13;if(t.match(S.doneDateRegex)&&n-e.length>=i&&(n-=i),n>=2*e.length&&t.search(`.+
.+`)!==-1)return r+n-e.length;let s=t.search(/[-*]/);return r<s?r:r+n-e.length};var io=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)=>W_(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Y_})}};var so=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 ao=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return N(this,null,function*(){var c;let{globalFilter:n}=U(),i=e.findAll(".task-list-item").filter(d=>{var y;let f=(y=d.textContent)==null?void 0:y.split(`
2 years ago
`);if(f===void 0)return!1;let h=null;for(let m=0;m<f.length;m=m+1)if(f[m]!==""){h=f[m];break}return h===null?!1:h.includes(n)});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 d=a.lineStart;d<=a.lineEnd;d++){let f=o[d];if(f===void 0)continue;let h=me.fromLine({line:f,path:s,sectionStart:a.lineStart,sectionIndex:u,precedingHeader:null,fallbackDate:null});h!==null&&(l.push(h),u++)}for(let d=0;d<i.length;d++){let f=l[d],h=i[d];if(f===void 0||h===void 0)continue;let y=(c=h.getAttr("data-line"))!=null?c:"0",m=Number.parseInt(y,10),g=yield f.toLi({parentUlElement:e,listIndex:m}),O=h.childNodes;for(let H=0;H<O.length;H=H+1){let ye=O[H];ye.nodeName.toLowerCase()==="div"?g.prepend(ye):ye.nodeName.toLowerCase()==="ul"&&g.append(ye)}let w=h.querySelectorAll("[data-footnote-id]"),P=g.querySelectorAll("[data-footnote-id]");if(w.length===P.length)for(let H=0;H<w.length;H++)P[H].replaceWith(w[H]);h.replaceWith(g)}})}};var j_=require("@codemirror/view"),$_=require("obsidian");var B_=()=>j_.ViewPlugin.fromClass(Kd),Kd=class{constructor(e){this.view=e,this.handleClickEvent=this.handleClickEvent.bind(this),this.view.dom.addEventListener("click",this.handleClickEvent)}destroy(){this.view.dom.removeEventListener("click",this.handleClickEvent)}handleClickEvent(e){let{target:t}=e;if(!t||!(t instanceof HTMLInputElement)||t.type!=="checkbox")return!1;let n=t.closest("ul.plugin-tasks-query-result, div.callout-content");if(n){if(n.matches("div.callout-content")){let f=`obsidian-tasks-plugin warning: Tasks cannot add or remove completion dates or make the next copy of a recurring task for tasks written inside a callout when you click their checkboxes in Live Preview.
If you wanted Tasks to do these things, please undo your change, then either click the line of the task and use the "Toggle Task Done" command, or switch to Reading View to click the checkbox.`;console.warn(f),new $_.Notice(f,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=me.fromLine({line:a.text,path:"",sectionStart:0,sectionIndex:0,precedingHeader:null,fallbackDate:null});if(console.debug(`Live Preview Extension: toggle called. Position: ${s} Line: ${a.text}`),o===null)return!1;e.preventDefault();let l=o.toggle().map(f=>f.toFileLineString()).join(i.lineBreak),c=i.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let d=t.checked;return setTimeout(()=>{t.checked=d},1),!0}};var Ao=require("obsidian");var br=class{constructor(e,t,n){this.property=e,this.comparator=br.maybeReverse(n,t)}static maybeReverse(e,t){return e?br.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var Jn=class{constructor(e,t){this.property=e,this.grouper=t}};var ce=class{canCreateFilterForLine(e){return ce.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 ua(this.fieldNameSingular())}supportsSorting(){return!1}parseSortLine(e){return!this.supportsSorting()||!this.canCreateSorterForLine(e)?null:this.createSorterFromLine(e)}canCreateSorterForLine(e){return this.supportsSorting()?ce.lineMatchesFilter(this.sorterRegExp(),e):!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=ce.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 br(this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(){return new Jn(this.fieldNameSingular(),this.grouper())}};var be=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 be("None of",e,"NOT")}static booleanXor(e){return new be("Exactly one of",e,"XOR")}asString(e=""){if(this.children.length==0)return e+this.description;let t=e+`${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 be(e,t,n)}};var Ze=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(" ")}
`}},fe=class{constructor(e){this.instruction=e}get filter(){return this._filter}set filter(e){this._filter=e}get filterFunction(){if(this._filter)return this._filter.filterFunction}static fromFilter(e){let t=new fe(e.instruction);return t.filter=e,t}static fromError(e,t){let n=new fe(e);return n.error=t,n}};var oo=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e==this._instruction}createFilterOrErrorMessage(e){let t=new fe(e);return e===this._instruction?(t.filter=new Ze(e,this._filter,new be(e)),t):(t.error=`do not understand filter: ${e}`,t)}};var jr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new oo(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let n of this._filters){let i=n.createFilterOrErrorMessage(e);if(i.error===void 0)return i}let t=new fe(e);return t.error=`do not understand filter: ${e}`,t}};var $r=class extends ce{constructor(){super(...arguments);this._filters=new jr}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var vr=class extends $r{constructor(){super(),this._filters.add("done",e=>e.status.type==="DONE"||e.status.type==="CANCELLED"||e.status.type==="NON_TASK"),this._filters.add("not done",e=>e.status.type==="TODO"||e.status.type==="IN_PROGRESS")}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=vr.oldStatusName(e),i=vr.oldStatusName(t);return n<i?1:n>i?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}};var G_=Xs(Ne()),Er=class{static parseDate(e,t=!1){return window.moment(G_.parseDate(e,void 0,{forwardDate:t})).startOf("day")}};var ct=class extends ce{constructor(){super();this.filterInstructions=new jr,this.filterInstructions.add(`has ${this.fieldName()} date`,t=>this.date(t)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,t=>this.date(t)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,t=>{let n=this.date(t);return n!==null&&!n.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=new fe(t),s=ce.getMatch(this.filterRegExp(),t),a;if(s!==null){let o=Er.parseDate(s[2]);if(!o.isValid())i.error="do not understand "+this.fieldName()+" date";else{let u;s[1]==="before"?(a=c=>{let d=this.date(c);return d?d.isBefore(o):this.filterResultIfFieldMissing()},u=" "+s[1]):s[1]==="after"?(a=c=>{let d=this.date(c);return d?d.isAfter(o):this.filterResultIfFieldMissing()},u=" "+s[1]):(a=c=>{let d=this.date(c);return d?d.isSame(o):this.filterResultIfFieldMissing()},u=" on");let l=ct.getExplanationString(this.fieldName(),u,this.filterResultIfFieldMissing(),o);i.filter=new Ze(t,a,new be(l))}}else i.error="do not understand query filter ("+this.fieldName()+" date)";return i}static getExplanationString(t,n,i,s){let a=s.format("YYYY-MM-DD (dddd Do MMMM YYYY)"),o=`${t} date is${n} ${a}`;return i&&(o+=` OR no ${t} date`),o}supportsSorting(){return!0}comparator(){return(t,n)=>It(this.date(t),this.date(n))}};var Vd=class extends ct{filterRegExp(){return Vd.dueRegexp}fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}},hn=Vd;hn.dueRegexp=/^due (before|after|on)? ?(.*)/;var Xd=class extends ce{createFilterOrErrorMessage(e){let t=new fe(e),n=ce.getMatch(this.filterRegExp(),e);if(n!==null){let i=n[5],s=null;switch(i){case"low":s="4";break;case"none":s="3";break;case"medium":s="2";break;case"high":s="1";break}if(s===null)return t.error="do not understand priority",t;let a=e,o;switch(n[3]){case"above":o=u=>u.priority.localeCompare(s)<0;break;case"below":o=u=>u.priority.localeCompare(s)>0;break;case"not":o=u=>u.priority!==s;break;default:o=u=>u.priority===s,a=`${this.fieldName()} is ${i}`}t.filter=new Ze(e,o,n
Allowed options: 'is' and 'is not' (without quotes).
Allowed values: ${t}
Note: values are case-insensitive,
so 'in_progress' works too, for example.
Example: ${this.fieldNameSingular()} is not NON_TASK`;return fe.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Gr.groupName(e),i=Gr.groupName(t);return n.localeCompare(i,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[Gr.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 bo=class extends Qe{fieldName(){return"recurrence"}value(e){return e.recurrence!==null?e.recurrence.toText():""}};var ff=[()=>new To,()=>new Gr,()=>new vr,()=>new co,()=>new mn,()=>new wr,()=>new Fs,()=>new Is,()=>new hn,()=>new Ns,()=>new ni,()=>new yn,()=>new gn,()=>new lo,()=>new uo,()=>new yo,()=>new _o,()=>new ii,()=>new bo];function go(r){for(let e of ff){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function sT(r){let e=/^sort by /;if(r.match(e)===null)return null;for(let t of ff){let i=t().parseSortLine(r);if(i)return i}return null}function aT(r){let e=/^group by /;if(r.match(e)===null)return null;for(let t of ff){let n=t(),i=n.fieldNameSingular();if(r===`group by ${i}`&&n.supportsGrouping())return n.createGrouper()}return null}var vo=class{constructor(e,t){this.nestingLevel=e,this.name=t}};var Eo=class{constructor(e){this.lastHeadingAtLevel=new Array;let n=e.keys().next().value.length;for(let i=0;i<n;i++)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 vo(n,i));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var wo=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 Oo=class extends Map{},Do=class extends wo{},Ro=class{constructor(e,t){this.groups=new Oo;let n=this.buildGroupingTree(e,t);this.groups=n.generateAllPaths(),this.groups=this.getSortedGroups()}buildGroupingTree(e,t){let n=new Do(t),i=[n];for(let s of e){let a=[];for(let o of i)for(let u of o.values){let l=Mr.getGroupNamesForTask(s,u);for(let c of l){let d=o.children.get(c);d===void 0&&(d=new Do([]),o.children.set(c,d),a.push(d)),d.values.push(u)}}i=a}return n}getSortedGroups(){return new Oo([...this.groups.entries()].sort())}};var So=class{constructor(e,t,n){this.groups=e,this.groupHeadings=t,this.tasks=n}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}]
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} ${t.name}
`;return e+=this.tasksAsStringOfLines(),e}};var Mo=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length;let n=new Ro(e,t);this.addTasks(n)}get groups(){return this._groups}totalTasksCount(){return this._totalTaskCount}toString(){let e="";for(let n of this.groups)e+=n.toString(),e+=`
2 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
`,e}addTasks(e){let t=new Eo(e.groups);for(let[n,i]of e.groups){let s=t.getHeadingsForTaskGroup(n),a=new So(n,s,i);this.add(a)}}add(e){this._groups.push(e)}};var ne=class{static fromGroupingProperty(e){return new Jn(e,ne.grouperForProperty(e))}static by(e,t){return new Mo(e,t)}static getGroupNamesForTask(e,t){return e.grouper(t)}static grouperForProperty(e){return ne.groupers[e]}static escapeMarkdownCharacters(e){return e.replace(/\\/g,"\\\\").replace(/_/g,"\\_")}static groupByPriority(e){let t="ERROR";switch(e.priority){case"1":t="High";break;case"2":t="Medium";break;case"3":t="None";break;case"4":t="Low";break}return[`Priority ${e.priority}: ${t}`]}static groupByRecurrence(e){return e.recurrence!==null?[e.recurrence.toText()]:["None"]}static groupByRecurring(e){return e.recurrence!==null?["Recurring"]:["Not Recurring"]}static groupByStartDate(e){return[ne.stringFromDate(e.startDate,"start")]}static groupByScheduledDate(e){return[ne.stringFromDate(e.scheduledDate,"scheduled")]}static groupByDueDate(e){return[ne.stringFromDate(e.dueDate,"due")]}static groupByDoneDate(e){return[ne.stringFromDate(e.doneDate,"done")]}static groupByHappensDate(e){let t=new wr().earliestDate(e);return[ne.stringFromDate(t,"happens")]}static stringFromDate(e,t){return e===null?"No "+t+" date":e.format(ne.groupDateFormat)}static groupByPath(e){return[ne.escapeMarkdownCharacters(e.path.replace(".md",""))]}static groupByFolder(e){let t=e.path,n=e.filename+".md",i=t.substring(0,t.lastIndexOf(n));return i===""?["/"]:[ne.escapeMarkdownCharacters(i)]}static groupByFileName(e){let t=e.filename;return t===null?["Unknown Location"]:["[["+ne.escapeMarkdownCharacters(t)+"]]"]}static groupByRoot(e){let t=e.path.replace(/\\/g,"/"),n=t.indexOf("/");return n==-1?["/"]:[ne.escapeMarkdownCharacters(t.substring(0,n+1))]}static groupByBacklink(e){if(e.getLinkText({isFilenameUnique:!0})===null)return["Unknown Location"];let n="Unknown Location";if(e.filename!==null&&(n=ne.escapeMarkdownCharacters(e.filename)),e.precedingHeader===null||e.precedingHeader.length===0)return[n];let i=ne.groupByHeading(e)[0];return n===i?[n]:[`${n} > ${i}`]}static groupByStatus(e){return e.status.symbol===" "?["Todo"]:["Done"]}static groupByHeading(e){return e.precedingHeader===null||e.precedingHeader.length===0?["(No heading)"]:[e.precedingHeader]}static groupByTags(e){return e.tags.length==0?["(No tags)"]:e.tags}},Mr=ne;Mr.groupDateFormat="YYYY-MM-DD dddd",Mr.groupers={backlink:ne.groupByBacklink,done:ne.groupByDoneDate,due:ne.groupByDueDate,filename:ne.groupByFileName,folder:ne.groupByFolder,happens:ne.groupByHappensDate,heading:ne.groupByHeading,path:ne.groupByPath,priority:ne.groupByPriority,recurrence:ne.groupByRecurrence,recurring:ne.groupByRecurring,root:ne.groupByRoot,scheduled:ne.groupByScheduledDate,start:ne.groupByStartDate,status:ne.groupByStatus,tags:ne.groupByTags};var fi=class{constructor({source:e}){this._limit=void 0;this._layoutOptions=new Ei;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this.groupByRegexp=/^group by (backlink|done|due|filename|folder|happens|heading|path|priority|recurrence|recurring|root|scheduled|start|status|tags)/;this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|start date|scheduled date|done date|due date|recurrence rule|edit button|urgency)/;this.shortModeRegexp=/^short/;this.explainQueryRegexp=/^explain/;this.limitRegexp=/^limit (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.parseGroupBy2({line:t}):break;case this.groupByRegexp.test(t):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._error=`do not understand query: ${t}`}})}explainQuery(){return`Explanation of this Tasks code block query:
2 years ago
`+this.explainQueryWithoutIntroduction()}explainQueryWithoutIntroduction(){let e="",{globalFilter:t}=U();t.length!==0&&(e+=`Only tasks containing the global filter '${t}'.
2 years ago
`);let n=this.filters.length;if(n===0)e+="No filters supplied. All tasks will match the query.";else for(let i=0;i<n;i++)i>0&&(e+=`
`),e+=this.filters[i].explainFilterIndented("");return this._limit!==void 0&&(e+=`
At most ${this._limit} task`,this._limit!==1&&(e+="s"),e+=`.
`),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}applyQueryToTasks(e){this.filters.forEach(n=>{e=e.filter(n.filterFunction)});let t=si.by(this.sorting,e).slice(0,this.limit);return Mr.by(this.grouping,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"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;default:this._error="do not understand hide/show option"}}}parseFilter(e){let t=go(e);return t!=null?(t.filter?this._filters.push(t.filter):this._error=t.error,!0):!1}parseLimit({line:e}){let t=e.match(this.limitRegexp);t!==null?this._limit=Number.parseInt(t[2],10):this._error="do not understand query limit"}parseSortBy({line:e}){let t=sT(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy({line:e}){let t=e.match(this.groupByRegexp);t!==null?this._grouping.push(Mr.fromGroupingProperty(t[1])):this._error="do not understand query grouping"}parseGroupBy2({line:e}){let t=aT(e);return t?(this._grouping.push(t),!0):!1}};var ko=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 N(this,null,function*(){n.addChild(new pf({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},pf=class extends Ao.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=new fi({source:s}),this.queryType="tasks";break;default:this.query=new fi({source:s}),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=new fi({source:this.source}),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},i+1e3)}render(i){return N(this,arguments,function*({tasks:t,state:n}){var a;let s=this.containerEl.createEl("div");if(n==="Warm"&&this.query.error===void 0){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(s);let o=this.query.applyQueryToTasks(t);for(let l of o.groups){this.addGroupHeadings(s,l.groupHeadings);let{taskList:c}=yield this.createTasksList({tasks:l.tasks,content:s});s.appendChild(c)}let u=o.totalTasksCount();console.debug(`${u} of ${t.length} tasks displayed in a block in "${this.filePath}"`),this.addTaskCount(s,u)}else this.query.error!==void 0?s.createDiv().innerHTML=`<pre>Tasks query: ${this.query.error.replace(/\n/g,"<br>")}</pre>`:s.setText("Loading Tasks ...");(a=this.containerEl.firstChild)==null||a.replaceWith(s)})}createExplanation(t){let n=this.query.explainQuery(),i=t.createEl("pre");i.addClasses(["plugin-tasks-query-explanation"]),i.setText(n),t.appendChild(i)}cr
`)+`
Fix errors before saving.`;new Vt.Notice(d);return}this.saved=!0,this.close()})),l)),u.addExtraButton(l=>(l.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),l))})}onOpen(){this.display()}static setValidationError(t){t.inputEl.addClass("tasks-settings-is-invalid")}static removeValidationError(t){t.inputEl.removeClass("tasks-settings-is-invalid")}static setValid(t,n){n.length===0?bt.removeValidationError(t):bt.setValidationError(t)}};var pi=class extends he.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 N(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:"Global filter Settings"}),new he.Setting(t).setName("Global task filter").setDesc(pi.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://obsidian-tasks-group.github.io/obsidian-tasks/getting-started/global-filter/">documentation</a>.</p>')).addText(i=>{let s=U();i.setPlaceholder("e.g. #task or TODO").setValue(s.globalFilter).onChange(a=>N(this,null,function*(){it({globalFilter:a}),yield this.plugin.saveSettings()}))}),new he.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=U();i.setValue(s.removeGlobalFilter).onChange(a=>N(this,null,function*(){it({removeGlobalFilter:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=U();pT.forEach(i=>{this.addOneSettingsBlock(t,i,n)}),t.createEl("h4",{text:"Date Settings"}),new he.Setting(t).setName("Set done date on every completed task").setDesc("Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done").addToggle(i=>{let s=U();i.setValue(s.setDoneDate).onChange(a=>N(this,null,function*(){it({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new he.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(pi.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://obsidian-tasks-group.github.io/obsidian-tasks/getting-started/use-filename-as-default-date/">documentation</a>.</p>')).addToggle(i=>{let s=U();i.setValue(s.useFilenameAsScheduledDate).onChange(a=>N(this,null,function*(){it({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new he.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=>N(this,null,function*(){let s=U();yield this.plugin.saveSettings(),i.setValue(pi.renderFolderArray(s.filenameAsDateFolders)).onChange(a=>N(thi
`}),n=n.slice(0,t.autoSuggestMaxItems),n}function aA(r){if(Object.values(Ce).some(e=>e.length>0&&r.includes(e)))return!0}function oA(r,e){let t=[];return r.includes(qt)||t.push({displayText:`${qt} due date`,appendText:`${qt} `}),r.includes(Ut)||t.push({displayText:`${Ut} start date`,appendText:`${Ut} `}),r.includes(Lt)||t.push({displayText:`${Lt} scheduled date`,appendText:`${Lt} `}),aA(r)||(t.push({displayText:`${Ce.High} high priority`,appendText:`${Ce.High} `}),t.push({displayText:`${Ce.Medium} medium priority`,appendText:`${Ce.Medium} `}),t.push({displayText:`${Ce.Low} low priority`,appendText:`${Ce.Low} `})),r.includes(Ft)||t.push({displayText:`${Ft} recurring (repeat)`,appendText:`${Ft} `}),t}function uA(r,e,t){let n=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],i=[],s=new RegExp(`([${sA}])\\s*([0-9a-zA-Z ]*)`,"ug"),a=hf(r,s,e);if(a&&a.length>=2){let o=a[1],u=a[2];if(u.length<t.autoSuggestMinMatch)return[];let l=u&&u.length>1?Er.parseDate(Zn(u),!0):null;l&&l.isValid()&&i.push({displayText:`${l.format(S.dateFormat)}`,appendText:`${o} ${l.format(S.dateFormat)} `,insertAt:a.index,insertSkip:a[0].length});let c=1,d=5,f=n.filter(h=>u&&u.length>=c&&h.toLowerCase().includes(u.toLowerCase())).slice(0,d);f.length===0&&(f=n.slice(0,d));for(let h of f){let m=`${Er.parseDate(h,!0).format(S.dateFormat)}`;i.push({suggestionType:"match",displayText:`${h} (${m})`,appendText:`${o} ${m} `,insertAt:a.index,insertSkip:a[0].length})}}return i}function lA(r,e,t){var o;let n=["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=[],s=new RegExp(`(${Ft})\\s*([0-9a-zA-Z ]*)`,"ug"),a=hf(r,s,e);if(a&&a.length>=2){let u=a[1],l=a[2];if(l.length<t.autoSuggestMinMatch)return[];if(l.length>0){let h=(o=Ie.fromText({recurrenceRuleText:l,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:o.toText();if(h){let y=`${u} ${h} `;if(i.push({suggestionType:"match",displayText:`\u2705 ${h}`,appendText:y,insertAt:a.index,insertSkip:a[0].length}),a[0]==y)return[]}}let c=1,d=t.autoSuggestMaxItems/2,f=n.filter(h=>l&&l.length>=c&&h.toLowerCase().includes(l.toLowerCase())).slice(0,d);f.length===0&&l.trim().length===0&&(f=n.slice(0,d));for(let h of f)i.push({suggestionType:"match",displayText:`${h}`,appendText:`${u} ${h} `,insertAt:a.index,insertSkip:a[0].length})}return i}function hf(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;return[]}var Po=class extends yT.EditorSuggest{constructor(t,n){super(t);this.settings=n}onTrigger(t,n,i){if(!this.settings.autoSuggestInEditor)return null;let s=n.getLine(t.line);return s.contains(this.settings.globalFilter)&&s.match(S.taskRegex)?{start:{line:t.line,ch:0},end:{line:t.line,ch:s.length},query:s}:null}getSuggestions(t){let n=t.query,i=t.editor.getCursor(),s=mT(n,i.ch,this.settings),a=[];for(let o of s)a.push(wt(Re({},o),{context:t}));return a}renderSuggestion(t,n){n.setText(t.displayText)}selectSuggestion(t,n){var u,l,c;let i=t.context.editor;if(t.suggestionType==="empty"){this.close();let d=new KeyboardEvent("keydown",{code:"Enter",key:"Enter"});(l=(u=i==null?void 0:i.cm)==null?void 0:u.contentDOM)==null||l.dispatchEvent(d);return}let s=t.context.editor.getCursor(),a={line:s.line,ch:(c=t.insertAt)!=null?c:s.ch},o=t.insertSkip?{line:s.line,ch:a.ch+t.insertSkip}:void 0;t.context.editor.replaceRange(t.appendText,a,o),t.context.editor.setCursor({line:s.line,ch:a.ch+t.appendText.length})}};var xo=class extends gT.Plugin{onload(){return N(this,null,function*(){console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new Ws({plugin:this})),jp({metadataCache:this.app.metadataCache,vault:this.app.vault}),yield this.loadTaskStatuses();let t=new so({obsidianEvents:this.app.workspace});this.cache=new Zr({metadataCache:this.app.metadataCache,vault:this.a