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.

152 lines
300 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
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 g_=Object.create;var Nn=Object.defineProperty,__=Object.defineProperties,T_=Object.getOwnPropertyDescriptor,b_=Object.getOwnPropertyDescriptors,v_=Object.getOwnPropertyNames,Bd=Object.getOwnPropertySymbols,E_=Object.getPrototypeOf,Hd=Object.prototype.hasOwnProperty,R_=Object.prototype.propertyIsEnumerable;var Gd=(r,e,t)=>e in r?Nn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$e=(r,e)=>{for(var t in e||(e={}))Hd.call(e,t)&&Gd(r,t,e[t]);if(Bd)for(var t of Bd(e))R_.call(e,t)&&Gd(r,t,e[t]);return r},Ut=(r,e)=>__(r,b_(e));var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),w_=(r,e)=>{for(var t in e)Nn(r,t,{get:e[t],enumerable:!0})},zd=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v_(e))!Hd.call(r,i)&&i!==t&&Nn(r,i,{get:()=>e[i],enumerable:!(n=T_(e,i))||n.enumerable});return r};var as=(r,e,t)=>(t=r!=null?g_(E_(r)):{},zd(e||!r||!r.__esModule?Nn(t,"default",{value:r,enumerable:!0}):t,r)),M_=r=>zd(Nn({},"__esModule",{value:!0}),r);var ae=(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 Ef=h((gA,ps)=>{var ef,tf,rf,nf,sf,af,of,uf,lf,ds,Xa,cf,df,ff,Xr,pf,hf,mf,yf,gf,_f,Tf,bf,vf,fs;(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 ps=="object"&&typeof ps.exports=="object"?r(t(e,t(ps.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])};ef=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)},tf=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},rf=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},nf=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},sf=function(n,i){return function(s,a){i(s,a,n)}},af=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},of=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(p){try{f(a.next(p))}catch(y){l(y)}}function d(p){try{f(a.throw(p))}catch(y){l(y)}}function f(p){p.done?u(p.value):o(p.value).then(c,d)}f((a=a.apply(n,i||[])).next())})},uf=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(p){return d([f,p])}}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]
`),{globalFilter:f}=ie(),p,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){p=g;break}y++}}if(p===void 0){console.error("Tasks: could not find task to toggle in the file.");return}let m=[...d.slice(0,p.position.start.line),...e.map(g=>g.toFileLineString()),...d.slice(p.position.start.line+1)];yield t.modify(o,m.join(`
`))});var Zr=class{constructor(){this.hideTaskCount=!1;this.hideBacklinks=!1;this.hidePriority=!1;this.hideStartDate=!1;this.hideScheduledDate=!1;this.hideDoneDate=!1;this.hideDueDate=!1;this.hideRecurrenceRule=!1;this.hideEditButton=!1;this.shortMode=!1}};var ls=["MO","TU","WE","TH","FR","SA","SU"],_e=function(){function r(e,t){if(t===0)throw new Error("Can't create weekday with n == 0");this.weekday=e,this.n=t}return r.fromStr=function(e){return new r(ls.indexOf(e))},r.prototype.nth=function(e){return this.n===e?this:new r(this.weekday,e)},r.prototype.equals=function(e){return this.weekday===e.weekday&&this.n===e.n},r.prototype.toString=function(){var e=ls[this.weekday];return this.n&&(e=(this.n>0?"+":"")+String(this.n)+e),e},r.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},r}();var oe=function(r){return r!=null},Ze=function(r){return typeof r=="number"},Za=function(r){return typeof r=="string"&&ls.includes(r)},xe=Array.isArray,rt=function(r,e){e===void 0&&(e=r),arguments.length===1&&(e=r,r=0);for(var t=[],n=r;n<e;n++)t.push(n);return t};var B=function(r,e){var t=0,n=[];if(xe(r))for(;t<e;t++)n[t]=[].concat(r);else for(;t<e;t++)n[t]=r;return n},Qd=function(r){return xe(r)?r:[r]};function Ar(r,e,t){t===void 0&&(t=" ");var n=String(r);return e=e>>0,n.length>e?String(n):(e=e-n.length,e>t.length&&(t+=B(t,e/t.length)),t.slice(0,e)+String(n))}var Jd=function(r,e,t){var n=r.split(e);return t?n.slice(0,t).concat([n.slice(t).join(e)]):n},Fe=function(r,e){var t=r%e;return t*e<0?t+e:t},cs=function(r,e){return{div:Math.floor(r/e),mod:Fe(r,e)}},Xe=function(r){return!oe(r)||r.length===0},ye=function(r){return!Xe(r)},G=function(r,e){return ye(r)&&r.indexOf(e)!==-1};var cr;(function(r){r.MONTH_DAYS=[31,28,31,30,31,30,31,31,30,31,30,31],r.ONE_DAY=1e3*60*60*24,r.MAXYEAR=9999,r.ORDINAL_BASE=new Date(Date.UTC(1970,0,1)),r.PY_WEEKDAYS=[6,0,1,2,3,4,5],r.getYearDay=function(e){var t=new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.ceil((t.valueOf()-new Date(e.getUTCFullYear(),0,1).valueOf())/r.ONE_DAY)+1},r.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},r.isDate=function(e){return e instanceof Date},r.isValidDate=function(e){return r.isDate(e)&&!isNaN(e.getTime())},r.tzOffset=function(e){return e.getTimezoneOffset()*60*1e3},r.daysBetween=function(e,t){var n=e.getTime()-r.tzOffset(e),i=t.getTime()-r.tzOffset(t),s=n-i;return Math.round(s/r.ONE_DAY)},r.toOrdinal=function(e){return r.daysBetween(e,r.ORDINAL_BASE)},r.fromOrdinal=function(e){return new Date(r.ORDINAL_BASE.getTime()+e*r.ONE_DAY)},r.getMonthDays=function(e){var t=e.getUTCMonth();return t===1&&r.isLeapYear(e.getUTCFullYear())?29:r.MONTH_DAYS[t]},r.getWeekday=function(e){return r.PY_WEEKDAYS[e.getUTCDay()]},r.monthRange=function(e,t){var n=new Date(Date.UTC(e,t,1));return[r.getWeekday(n),r.getMonthDays(n)]},r.combine=function(e,t){return t=t||e,new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))},r.clone=function(e){var t=new Date(e.getTime());return t},r.cloneDates=function(e){for(var t=[],n=0;n<e.length;n++)t.push(r.clone(e[n]));return t},r.sort=function(e){e.sort(function(t,n){return t.getTime()-n.getTime()})},r.timeToUntilString=function(e,t){t===void 0&&(t=!0);var n=new Date(e);return[Ar(n.getUTCFullYear().toString(),4,"0"),Ar(n.getUTCMonth()+1,2,"0"),Ar(n.getUTCDate(),2,"0"),"T",Ar(n.getUTCHours(),2,"0"),Ar(n.getUTCMinutes(),2,"0"),Ar(n.getUTCSeconds(),2,"0"),t?"Z":""].join("")},r.untilStringToDate=function(e){var t=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/,n=t.exec(e);if(!n)throw new Error("Invalid UNTIL value: ".concat(e));return new Date(Date.UTC(parseInt(n[1],10),parseInt(n[2],10)-1,parseInt(n[3],10),parseInt(n[5],10)||0,parseInt(n[6],10)||0,parseInt(n[7],10)||0))}})(cr||(cr={}));var k=cr;var A_=function(){function r(e,t){this.minDate=null,this.maxDate=null,this._result=[],this.total=0,this.method=e,this.args=t,e==="between"?(this.maxDate=t.inc?t.before:new Date(t.before.getTime()-1),this.minDate=t.inc?t.after:new Date(
`).map(U_).filter(function(t){return t!==null});return je(je({},e[0]),e[1])}function In(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=k.untilStringToDate(i),e}function U_(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return Cf(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return Cf(r);case"DTSTART":return In(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function Cf(r){var e=r.replace(/^RRULE:/i,""),t=In(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=Y[o.toUpperCase()];break;case"WKST":t.wkst=nt[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=F_(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=q_(o);break;case"DTSTART":case"TZID":var c=In(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=k.untilStringToDate(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function F_(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(xf)}return xf(r)}function xf(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function q_(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return nt[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=nt[s].weekday;return new _e(a,i)})}var Nr=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=k.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 Fn(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(Sn),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!G(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!oe(o)||xe(o)&&!o.length)){switch(a){case"FREQ":u=w.FREQUENCIES[r.freq];break;case"WKST":Ze(o)?u=new _e(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=Qd(o).map(function(p){return p instanceof _e?p:xe(p)?new _e(p[0],p[1]):new _e(p)}).toString();break;case"DTSTART":t=W_(o,r.tzid);break;case"UNTIL":u=k.timeToUntilString(o,!r.tzid);break;default:if(xe(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(p){var y=p[0],m=p[1];return"".concat(y,"=").concat(m.toString())}).join(";"),f="";return d!==""&&(f="RRULE:".concat(d)),[t,f].filter(function(p){return!!p}).join(`
`)}function W_(r,e){return r?"DTSTART"+new Nr(new Date(r),e).toString():""}function L_(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 Sf=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?k.clone(t):k.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(!L_(t[f],c[f]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(xe(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 qt(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return xe(n)?k.cloneDates(n):n instanceof Date?k.clone(n):n},r}();var If=T(T(T(T(T(T(T(T(T(T(T(T(T([],B(1,31),!0),B(2,28),!0),B(3,31),!0),B(4,30),!0),B(5,31),!0),B(6,30),!0),B(7,31),!0),B(8,31),!0),B(9,30),!0),B(10,31),!0),B(11,30),!0),B(12,31),!0),B(1,7),!0),Uf=T(T(T(T(T(T(T(T(T(T(T(T(T([],B(1,31),!0),B(2,29),!0),B(3,31),!0),B(4,30),!0),B(5,31),!0),B(6,30),!0),B(7,31),!0),B(8,31),!0),B(9,30),!0),B(10,31),!0),B(11,30),!0),B(12,31),!0),B(1,7),!0),Y_=rt(1,29),$_=rt(1,30),dr=rt(1,31),qe=rt(1,32),Ff=T(T(T(T(T(T(T(T(T(T(T(T(T([],qe,!0),$_,!0),qe,!0),dr,!0),qe,!0),dr,!0),qe,!0),qe,!0),dr,!0),qe,!0),dr,!0),qe,!0),qe.slice(0,7),!0),qf=T(T(T(T(T(T(T(T(T(T(T(T(T([],qe,!0),Y_,!0),qe,!0),dr,!0),qe,!0),dr,!0),qe,!0),qe,!0),dr,!0),qe,!0),dr,!0),qe,!0),qe.slice(0,7),!0),j_=rt(-28,0),B_=rt(-29,0),fr=rt(-30,0),We=rt(-31,0),Wf=T(T(T(T(T(T(T(T(T(T(T(T(T([],We,!0),B_,!0),We,!0),fr,!0),We,!0),fr,!0),We,!0),We,!0),fr,!0),We,!0),fr,!0),We,!0),We.slice(0,7),!0),Lf=T(T(T(T(T(T(T(T(T(T(T(T(T([],We,!0),j_,!0),We,!0),fr,!0),We,!0),fr,!0),We,!0),We,!0),fr,!0),We,!0),fr,!0),We,!0),We.slice(0,7),!0),Yf=[0,31,60,91,121,152,182,213,244,274,305,335,366],$f=[0,31,59,90,120,151,181,212,243,273,304,334,365],eo=function(){for(var r=[],e=0;e<55;e++)r=r.concat(rt(7));return r}();function jf(r,e){var t=new Date(Date.UTC(r,0,1)),n=k.isLeapYear(r)?366:365,i=k.isLeapYear(r+1)?366:365,s=k.toOrdinal(t),a=k.getWeekday(t),o=je(je({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},G_(r)),{wnomask:null});if(Xe(e.byweekno))return o;o.wnomask=B(0,n+7);var u,l,c=u=Fe(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+Fe(a-e.wkst,7)):l=n-c;for(var d=Math.floor(l/7),f=Fe(l,7),p=Math.floor(d+f/4),y=0;y<e.byweekno.length;y++){var m=e.byweekno[y];if(m<0&&(m+=p+1),m>0&&m<=p){var g=void 0;m>1?(g=c+(m-1)*7,c!==u&&(g-=7-u)):g=c;for(var A=0;A<7&&(o.wnomask[g]=1,g++,o.wdaymask[g]!==e.wkst);A++);}}if(G(e.byweekno,1)){var g=c+p*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 x=void 0;if(G(e.byweekno,-1))x=-1;else{var C=k.getWeekday(new Date(Date.UTC(r-1,0,1))),z=Fe(7-C.valueOf()+e.wkst,7),ne=k.isLeapYear(r-1)?366:365,fe=void 0;z>=4?(z=0,fe=ne+Fe(C-e.wkst,7)):fe=n-c,x=Math.floor(52+Fe(fe,7)/4)}if(G(e.byweekno,x))for(var g=0;g<c;g++)o.wnomask[g]=1}return o}function G_(r){var e=k.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=k.getWeekday(t);return e===365?{mmask:If,mdaymask:qf,nmdaymask:Lf,wdaymask:eo.slice(n),mrange:$f}:{mmask:Uf,mdaymask:Ff,nmdaymask:Wf,wdaymask:eo.slice(n),mrange:Yf}}function Bf(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===w.YEARLY)if(Xe(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===w.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Xe(o))return a;a.nwdaymask=B(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 p=void 0,y=s.bynweekday[f],m=y[0],g=y[1];g<0?(p=d+(g+1)*7,p-=Fe(i[p]-m,7)):(p=c+(g-1)*7,p+=Fe(7-i[p]+m,7)),c<=p&&p<=d&&(a.nwdaymask[p]=1)}return a}function Gf(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 rT(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Xf(r,e){return rT(e),r.split(",").map(function(t){return k.untilStringToDate(t)})}function Qf(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 ro=function(r){Qr(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=Qf.apply(n,["dtstart"]),n.tzid=Qf.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return Vf(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){Jf(t,this._rrule)},e.prototype.exrule=function(t){Jf(t,this._exrule)},e.prototype.rdate=function(t){ep(t,this._rdate)},e.prototype.exdate=function(t){ep(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return ms(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return ms(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(Fn({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(`
2 years ago
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(tp("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(tp("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}(w);function Jf(r,e){if(!(r instanceof w))throw new TypeError(String(r)+" is not RRule instance");G(e.map(String),String(r))||e.push(r)}function ep(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");G(e.map(Number),Number(r))||(e.push(r),k.sort(e))}function tp(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return k.timeToUntilString(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}var H=class{static by(e,t){let n=[H.compareByUrgency,H.compareByStatus,H.compareByDueDate,H.compareByPriority,H.compareByPath],i=[];for(let{property:s,reverse:a,propertyInstance:o}of e.sorting){let u=H.comparators[s];i.push(a?H.makeReversedComparator(u):u),s==="tag"&&(H.tagPropertyInstance=o)}return t.sort(H.makeCompositeComparator([...i,...n]))}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}static makeCompositeComparator(e){return(t,n)=>{for(let i of e){let s=i(t,n);if(s!==0)return s}return 0}}static compareByUrgency(e,t){return t.urgency-e.urgency}static compareByStatus(e,t){return e.status<t.status?1:e.status>t.status?-1:0}static compareByPriority(e,t){return e.priority.localeCompare(t.priority)}static compareByStartDate(e,t){return H.compareByDate(e.startDate,t.startDate)}static compareByScheduledDate(e,t){return H.compareByDate(e.scheduledDate,t.scheduledDate)}static compareByDueDate(e,t){return H.compareByDate(e.dueDate,t.dueDate)}static compareByDoneDate(e,t){return H.compareByDate(e.doneDate,t.doneDate)}static compareByTag(e,t){if(e.tags.length===0&&t.tags.length===0)return 0;if(e.tags.length===0)return 1;if(t.tags.length===0)return-1;let n=H.tagPropertyInstance-1;return e.tags.length<H.tagPropertyInstance&&t.tags.length>=H.tagPropertyInstance?1:t.tags.length<H.tagPropertyInstance&&e.tags.length>=H.tagPropertyInstance?-1:e.tags.length<H.tagPropertyInstance&&t.tags.length<H.tagPropertyInstance?0:e.tags[n]<t.tags[n]?-1:e.tags[n]>t.tags[n]?1:0}static compareByDate(e,t){return e!==null&&t===null?-1:e===null&&t!==null?1:e!==null&&t!==null?e.isAfter(t)?1:e.isBefore(t)?-1:0:0}static compareByPath(e,t){return e.path<t.path?-1:e.path>t.path?1:0}static compareByDescription(e,t){return H.cleanDescription(e.description).localeCompare(H.cleanDescription(t.description))}static cleanDescription(e){let t=ie().globalFilter;e=e.replace(t,"").trim();let n=/^\[\[?([^\]]*)\]/,i=e.match(n);if(i!==null){let l=i[1];e=l.substring(l.indexOf("|")+1)+e.replace(n,"")}let s=/^\*\*?([^*]*)\*/,a=e.match(s);a!==null&&(e=a[1]+e.replace(n,""));let o=/^==?([^=]*)==/,u=e.match(o);return u!==null&&(e=u[1]+e.replace(o,"")),e}},Ge=H;Ge.tagPropertyInstance=1,Ge.comparators={urgency:H.compareByUrgency,description:H.compareByDescription,priority:H.compareByPriority,start:H.compareByStartDate,scheduled:H.compareByScheduledDate,due:H.compareByDueDate,done:H.compareByDoneDate,path:H.compareByPath,status:H.compareByStatus,tag:H.compareByTag};var pt=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=w.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 w(u);return new pt({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}catch(s){}return null}toText(){let e=this.rrule.toText();
`),o=null,u=0;for(let l of t)if(l.task!==void 0){if((o===null||o.position.end.line<l.position.start.line)&&(o=pr.getSection(l.position.start.line,n.sections),u=0),o===null)continue;let c=a[l.position.start.line],d=N.fromLine({line:c,path:i.path,sectionStart:o.position.start.line,sectionIndex:u,precedingHeader:pr.getPrecedingHeader(l.position.start.line,n.headings)});d!==null&&(u++,s.push(d))}return s}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 nd=require("obsidian");var zg=require("obsidian");function tn(){}function ao(r){return r()}function ip(){return Object.create(null)}function xr(r){r.forEach(ao)}function ap(r){return typeof r=="function"}function op(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function up(r){return Object.keys(r).length===0}var lp=!1;function nT(){lp=!0}function iT(){lp=!1}function b(r,e){r.appendChild(e)}function oo(r,e,t){r.insertBefore(e,t||null)}function vs(r){r.parentNode.removeChild(r)}function U(r){return document.createElement(r)}function sT(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function $t(r){return document.createTextNode(r)}function Z(){return $t(" ")}function hr(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function cp(r){return function(e){return e.preventDefault(),r.call(this,e)}}function $(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function aT(r){return Array.from(r.childNodes)}function dp(r,e){e=""+e,r.wholeText!==e&&(r.data=e)}function ht(r,e){r.value=e==null?"":e}function uo(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 fp(r){let e=r.querySelector(":checked")||r.options[0];return e&&e.__value}var Cr=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=sT(t.nodeName):this.e=U(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)oo(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(vs)}};var Ln;function Wn(r){Ln=r}function oT(){if(!Ln)throw new Error("Function called outside component initialization");return Ln}function lo(r){oT().$$.on_mount.push(r)}var qn=[];var Ts=[],_s=[],sp=[],uT=Promise.resolve(),so=!1;function lT(){so||(so=!0,uT.then(pp))}function Yn(r){_s.push(r)}var io=new Set,gs=0;function pp(){let r=Ln;do{for(;gs<qn.length;){let e=qn[gs];gs++,Wn(e),cT(e.$$)}for(Wn(null),qn.length=0,gs=0;Ts.length;)Ts.pop()();for(let e=0;e<_s.length;e+=1){let t=_s[e];io.has(t)||(io.add(t),t())}_s.length=0}while(qn.length);for(;sp.length;)sp.pop()();so=!1,io.clear(),Wn(r)}function cT(r){if(r.fragment!==null){r.update(),xr(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Yn)}}var dT=new Set;function fT(r,e){r&&r.i&&(dT.delete(r),r.i(e))}var gC=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function pT(r,e,t,n){let{fragment:i,on_mount:s,on_destroy:a,after_update:o}=r.$$;i&&i.m(e,t),n||Yn(()=>{let u=s.map(ao).filter(ap);a?a.push(...u):xr(u),r.$$.on_mount=[]}),o.forEach(Yn)}function hp(r,e){let t=r.$$;t.fragment!==null&&(xr(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function hT(r,e){r.$$.dirty[0]===-1&&(qn.push(r),lT(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function mp(r,e,t,n,i,s,a,o=[-1]){let u=Ln;Wn(r);let l=r.$$={fragment:null,ctx:null,props:s,update:tn,not_equal:i,bound:ip(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:ip(),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,...p)=>{let y=p.lengt
`),Or=U("input"),Ud=Z(),$a=U("code"),ja=$t(rs),Fd=Z(),ns=U("div"),qd=$t(`Done on:
`),is=U("code"),Wd=Z(),Ld=U("hr"),Yd=Z(),Ba=U("div"),$d=Z(),ss=U("div"),ss.innerHTML='<button type="submit" class="mod-cta">Apply</button>',$(i,"for","description"),$(a,"id","description"),$(a,"type","text"),$(a,"class","tasks-modal-description"),$(a,"placeholder","Take out the trash"),$(n,"class","tasks-modal-section"),$(d,"for","priority"),y.__value="none",y.value=y.__value,m.__value="high",m.value=m.__value,g.__value="medium",g.value=g.__value,A.__value="low",A.value=A.__value,$(p,"id","priority"),$(p,"class","dropdown"),r[0].priority===void 0&&Yn(()=>r[14].call(p)),$(c,"class","tasks-modal-section"),$(fe,"for","recurrence"),$(M,"id","description"),$(M,"type","text"),$(M,"placeholder","Try 'every 2 weeks on Thursday'."),_.a=null,$(ne,"class","tasks-modal-section"),$(te,"for","due"),$(se,"id","due"),$(se,"type","text"),$(se,"placeholder",ed),ft.a=null,$(W,"class","tasks-modal-date"),$(ur,"for","scheduled"),$(St,"id","scheduled"),$(St,"type","text"),$(St,"placeholder",ed),Qi.a=null,$(Ce,"class","tasks-modal-date"),$(Ji,"for","start"),$(It,"id","start"),$(It,"type","text"),$(It,"placeholder",ed),es.a=null,$(lr,"class","tasks-modal-date"),$(O,"class","tasks-modal-section"),$(Or,"type","checkbox"),$(Or,"class","task-list-item-checkbox tasks-modal-checkbox"),Or.checked=ts=r[0].status==="Done",Or.disabled=!0,$(Kr,"class","tasks-modal-section"),$(Ba,"class","tasks-modal-section"),$(ss,"class","tasks-modal-section"),$(e,"class","tasks-modal")},m(pe,Ye){oo(pe,e,Ye),b(e,t),b(t,n),b(n,i),b(n,s),b(n,a),ht(a,r[0].description),r[13](a),b(t,o),b(t,u),b(t,l),b(t,c),b(c,d),b(c,f),b(c,p),b(p,y),b(p,m),b(p,g),b(p,A),uo(p,r[0].priority),b(t,x),b(t,C),b(t,z),b(t,ne),b(ne,fe),b(ne,ee),b(ne,M),ht(M,r[0].recurrenceRule),b(ne,ge),b(ne,ce),b(ce,D),b(ce,v),_.m(r[5],ce),b(t,P),b(t,E),b(t,S),b(t,O),b(O,W),b(W,te),b(W,ue),b(W,se),ht(se,r[0].dueDate),b(W,dt),b(W,Le),b(Le,ar),b(Le,or),ft.m(r[4],Le),b(O,Ne),b(O,Ce),b(Ce,ur),b(Ce,Pr),b(Ce,St),ht(St,r[0].scheduledDate),b(Ce,wd),b(Ce,An),b(An,Md),b(An,Dd),Qi.m(r[3],An),b(O,Pd),b(O,lr),b(lr,Ji),b(lr,Od),b(lr,It),ht(It,r[0].startDate),b(lr,Ad),b(lr,kn),b(kn,kd),b(kn,Nd),es.m(r[2],kn),b(t,Cd),b(t,xd),b(t,Sd),b(t,Kr),b(Kr,Vr),b(Vr,Id),b(Vr,Or),b(Vr,Ud),b(Vr,$a),b($a,ja),b(Kr,Fd),b(Kr,ns),b(ns,qd),b(ns,is),is.innerHTML=r[6],b(t,Wd),b(t,Ld),b(t,Yd),b(t,Ba),b(t,$d),b(t,ss),Ga||(jd=[hr(a,"input",r[12]),hr(p,"change",r[14]),hr(M,"input",r[15]),hr(se,"input",r[16]),hr(St,"input",r[17]),hr(It,"input",r[18]),hr(t,"submit",cp(r[7]))],Ga=!0)},p(pe,[Ye]){Ye&1&&a.value!==pe[0].description&&ht(a,pe[0].description),Ye&1&&uo(p,pe[0].priority),Ye&1&&M.value!==pe[0].recurrenceRule&&ht(M,pe[0].recurrenceRule),Ye&32&&_.p(pe[5]),Ye&1&&se.value!==pe[0].dueDate&&ht(se,pe[0].dueDate),Ye&16&&ft.p(pe[4]),Ye&1&&St.value!==pe[0].scheduledDate&&ht(St,pe[0].scheduledDate),Ye&8&&Qi.p(pe[3]),Ye&1&&It.value!==pe[0].startDate&&ht(It,pe[0].startDate),Ye&4&&es.p(pe[2]),Ye&1&&ts!==(ts=pe[0].status==="Done")&&(Or.checked=ts),Ye&1&&rs!==(rs=pe[0].status+"")&&dp(ja,rs),Ye&64&&(is.innerHTML=pe[6])},i:tn,o:tn,d(pe){pe&&vs(e),r[13](null),Ga=!1,xr(jd)}}}var ed="Try 'Monday' or 'tomorrow', or [td|tm|yd|tw|nw|we] then space.";function IO(r,e,t){var n,i;let{task:s}=e,{onSubmit:a}=e,o,u={description:"",status:"Todo",priority:"none",recurrenceRule:"",startDate:"",scheduledDate:"",dueDate:"",doneDate:""},l="",c="",d="",f="",p="",y=!1;function m(M,ge,ce=void 0){if(!ge)return`<i>no ${M} date</i>`;let D=$i.parseDate(ge,ce,{forwardDate:ce!=null});return D!==null?window.moment(D).format("YYYY-MM-DD"):`<i>invalid ${M} date</i>`}lo(()=>{let{globalFilter:M}=ie(),ge=s.getDescriptionWithoutGlobalFilter();(ge!=s.description||ge.indexOf(M)==-1)&&(y=!0);let ce="none";s.priority==="4"?ce="low":s.priority==="2"?ce="medium":s.priority==="1"&&(ce="high"),t(0,u={description:ge,status:s.status,priority:ce,recurrenceRule:s.recurrence?s.recurrence.toText():"",startDate:s.startDate?s.startDate.format("YYYY-MM-DD"):"",scheduledDate:s.scheduledDate?s.scheduledDate.format("YYYY-MM-DD"):"",dueDate:s.dueDate?s.dueDate.format("YYYY-MM-DD"):"",doneDate:s.doneDate?s.do
`);e.setLine(a,p)};new bn({app:n,task:u,onSubmit:l}).open()},UO=({line:r,path:e})=>{var c;let t=N.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null});if(t!==null)return t;let n=r.match(N.nonTaskRegex);if(n===null)return console.error("Tasks: Cannot create task on line:",r),new N({status:"Todo",description:"",path:e,indentation:"",originalStatusCharacter:" ",priority:"3",startDate:null,scheduledDate:null,dueDate:null,doneDate:null,recurrence:null,sectionStart:0,sectionIndex:0,precedingHeader:null,blockLink:"",tags:[]});let i=n[1],s=(c=n[3])!=null?c:" ",a=s===" "?"Todo":"Done",o=n[4],u=r.match(N.blockLinkRegex),l=u!==null?u[0]:"";return l!==""&&(o=o.replace(N.blockLinkRegex,"")),new N({status:a,description:o,path:e,indentation:i,originalStatusCharacter:s,blockLink:l,priority:"3",startDate:null,scheduledDate:null,dueDate:null,doneDate:null,recurrence:null,sectionStart:0,sectionIndex:0,precedingHeader:null,tags:[]})};var id=require("obsidian");var Vg=(r,e,t)=>{var u;if(r)return t instanceof id.MarkdownView;if(!(t instanceof id.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=FO({line:a,path:n});e.setLine(s,o),/[^ [\]*-]/.test(o)&&e.setCursor({line:i.line,ch:i.ch+o.length-a.length})},FO=({line:r,path:e})=>{let t=r,n=N.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null});if(n!==null)t=qO({task:n});else{let i=r.match(N.taskRegex);i!==null?t=WO({regexMatch:i}):N.listItemRegex.test(r)?t=r.replace(N.listItemRegex,"$1$2 [ ]"):t=r.replace(N.indentationRegex,"$1- ")}return t},qO=({task:r})=>r.toggle().map(n=>n.toFileLineString()).join(`
`),WO=({regexMatch:r})=>{let e=r[1],t=r[2].toLowerCase(),n=r[3];return`${e}- [${t===" "?"x":" "}] ${n}`};var pa=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)=>Kg(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Vg})}};var ha=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 ma=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return ae(this,null,function*(){var c;let{globalFilter:n}=ie(),i=e.findAll(".task-list-item").filter(d=>{var y;let f=(y=d.textContent)==null?void 0:y.split(`
`);if(f===void 0)return!1;let p=null;for(let m=0;m<f.length;m=m+1)if(f[m]!==""){p=f[m];break}return p===null?!1:p.includes(n)});if(i.length===0)return;let s=t.sourcePath,a=t.getSectionInfo(e);if(a===null)return;let o=a.text.split(`
2 years ago
`),u=0,l=[];for(let d=a.lineStart;d<=a.lineEnd;d++){let f=o[d];if(f===void 0)continue;let p=N.fromLine({line:f,path:s,sectionStart:a.lineStart,sectionIndex:u,precedingHeader:null});p!==null&&(l.push(p),u++)}for(let d=0;d<i.length;d++){let f=l[d],p=i[d];if(f===void 0||p===void 0)continue;let y=(c=p.getAttr("data-line"))!=null?c:"0",m=Number.parseInt(y,10),g=yield f.toLi({parentUlElement:e,listIndex:m}),A=p.childNodes;for(let z=0;z<A.length;z=z+1){let ne=A[z];ne.nodeName.toLowerCase()==="div"?g.prepend(ne):ne.nodeName.toLowerCase()==="ul"&&g.append(ne)}let x=p.querySelectorAll("[data-footnote-id]"),C=g.querySelectorAll("[data-footnote-id]");if(x.length===C.length)for(let z=0;z<x.length;z++)C[z].replaceWith(x[z]);p.replaceWith(g)}})}};var Zg=require("@codemirror/view"),Xg=require("obsidian");var Qg=()=>Zg.ViewPlugin.fromClass(sd),sd=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 Xg.Notice(f,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=N.fromLine({line:a.text,path:"",sectionStart:0,sectionIndex:0,precedingHeader: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 p_=require("obsidian");var ya=class{constructor(e,t){this.nestingLevel=e,this.name=t}};var ga=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 ya(n,i));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var _a=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 Ta=class extends Map{},ba=class extends _a{},va=class{constructor(e,t){this.groups=new Ta;let n=this.buildGroupingTree(e,t);this.groups=n.generateAllPaths(),this.groups=this.getSortedGroups()}buildGroupingTree(e,t){let n=new ba(t),i=[n];for(let s of e){let a=[];for(let o of i)for(let u of o.values){let l=Er.getGroupNamesForTask(s.property,u);for(let c of l){let d=o.children.get(c);d===void 0&&(d=new ba([]),o.children.set(c,d),a.push(d)),d.values.push(u)}}i=a}return n}getSortedGroups(){return new Ta([...this.groups.entries()].sort())}};var Ea=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}
2 years ago
`;return e+=this.tasksAsStringOfLines(),e}};var Ra=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length;let n=new va(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
2 years ago
`,e}addTasks(e){let t=new ga(e.groups);for(let[n,i]of e.groups){let s=t.getHeadingsForTaskGroup(n),a=new Ea(n,s,i);this.add(a)}}add(e){this._groups.push(e)}};var Jg=as(Ee()),Qt=class{static parseDate(e,t=!1){return window.moment(Jg.parseDate(e,void 0,{forwardDate:t})).startOf("day")}};var de=class{canCreateFilterForLine(e){return de.lineMatchesFilter(this.filterRegexp(),e)}static lineMatchesFilter(e,t){return e?e.test(t):!1}static getMatch(e,t){return e?t.match(e):null}};var J=class{static fromFilter(e){let t=new J;return t.filter=e,t}static fromError(e){let t=new J;return t.error=e,t}};var Rr=class extends de{canCreateFilterForLine(e){return e===Rr.instructionForFieldPresence||e===Rr.instructionForFieldAbsence?!0:super.canCreateFilterForLine(e)}createFilterOrErrorMessage(e){let t=new J;if(e===Rr.instructionForFieldPresence){let i=new J;return i.filter=s=>this.dates(s).some(a=>a!==null),i}if(e===Rr.instructionForFieldAbsence){let i=new J;return i.filter=s=>!this.dates(s).some(a=>a!==null),i}let n=de.getMatch(this.filterRegexp(),e);if(n!==null){let i=Qt.parseDate(n[2]);i.isValid()?n[1]==="before"?t.filter=s=>this.dates(s).some(a=>a&&a.isBefore(i)):n[1]==="after"?t.filter=s=>this.dates(s).some(a=>a&&a.isAfter(i)):t.filter=s=>this.dates(s).some(a=>a&&a.isSame(i)):t.error="do not understand happens date"}else t.error="do not understand query filter (happens date)";return t}earliestDate(e){return new Rr().dates(e).sort(Ge.compareByDate)[0]}filterRegexp(){return Rr.happensRegexp}dates(e){return Array.of(e.startDate,e.scheduledDate,e.dueDate)}fieldName(){return"happens"}},Jt=Rr;Jt.happensRegexp=/^happens (before|after|on)? ?(.*)/,Jt.instructionForFieldPresence="has happens date",Jt.instructionForFieldAbsence="no happens date";var le=class{static by(e,t){return new Ra(e,t)}static getGroupNamesForTask(e,t){let n=le.groupers[e];return n(t)}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[le.stringFromDate(e.startDate,"start")]}static groupByScheduledDate(e){return[le.stringFromDate(e.scheduledDate,"scheduled")]}static groupByDueDate(e){return[le.stringFromDate(e.dueDate,"due")]}static groupByDoneDate(e){return[le.stringFromDate(e.doneDate,"done")]}static groupByHappensDate(e){let t=new Jt().earliestDate(e);return[le.stringFromDate(t,"happens")]}static stringFromDate(e,t){return e===null?"No "+t+" date":e.format(le.groupDateFormat)}static groupByPath(e){return[e.path.replace(".md","")]}static groupByFolder(e){let t=e.path,n=e.filename+".md",i=t.substring(0,t.lastIndexOf(n));return i===""?["/"]:[i]}static groupByFileName(e){let t=e.filename;return t===null?["Unknown Location"]:[t]}static groupByRoot(e){let t=e.path.replace(/\\/g,"/"),n=t.indexOf("/");return n==-1?["/"]:[t.substring(0,n+1)]}static groupByBacklink(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?["Unknown Location"]:[t]}static groupByStatus(e){return[e.status]}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}},Er=le;Er.groupDateFormat="YYYY-MM-DD dddd",Er.groupers={backlink:le.groupByBacklink,done:le.groupByDoneDate,due:le.groupByDueDate,filename:le.groupByFileName,folder:le.groupByFolder,happens:le.groupByHappensDate,heading:le.groupByHeading,path:le.groupByPath,priority:le.groupByPriority,recurrence:le.groupByRecurrence,recurring:le.groupByRecurring,root:le.groupByRoot,scheduled:le.groupByScheduledDate,start:le.groupByStartDate,status:le.groupByStatus,tags:le.groupByTags};var vn=class{matchesAnyOf(e){return e.some(t=>this.matches(t))}};var er=class extends vn{constructor(t){super();this.stringToFind=t}matches(t){return er.stringIncludesCaseInsensitive(t,this.stringToFin
`).map(t=>t.trim()).forEach(t=>{switch(!0){case t==="":break;case this.shortModeRegexp.test(t):this._layoutOptions.shortMode=!0;break;case this.limitRegexp.test(t):this.parseLimit({line:t});break;case this.sortByRegexp.test(t):this.parseSortBy({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}`}})}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)});let t=Ge.by(this,e).slice(0,this.limit);return Er.by(this.grouping,t)}parseHideOptions({line:e}){let t=e.match(this.hideOptionsRegexp);if(t!==null)switch(t[1].trim().toLowerCase()){case"task count":this._layoutOptions.hideTaskCount=!0;break;case"backlink":this._layoutOptions.hideBacklinks=!0;break;case"priority":this._layoutOptions.hidePriority=!0;break;case"start date":this._layoutOptions.hideStartDate=!0;break;case"scheduled date":this._layoutOptions.hideScheduledDate=!0;break;case"due date":this._layoutOptions.hideDueDate=!0;break;case"done date":this._layoutOptions.hideDoneDate=!0;break;case"recurrence rule":this._layoutOptions.hideRecurrenceRule=!0;break;case"edit button":this._layoutOptions.hideEditButton=!0;break;default:this._error="do not understand hide option"}}parseFilter(e){let t=Ua(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=e.match(this.sortByRegexp);t!==null?this._sorting.push({property:t[1],reverse:!!t[2],propertyInstance:isNaN(+t[3])?1:+t[3]}):this._error="do not understand query sorting"}parseGroupBy({line:e}){let t=e.match(this.groupByRegexp);t!==null?this._grouping.push({property:t[1]}):this._error="do not understand query grouping"}};var qa=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 ae(this,null,function*(){n.addChild(new On({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},On=class extends p_.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 Pn({source:s}),this.queryType="tasks";break;default:this.query=new Pn({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 Pn({source:this.source}),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},i+1e3)}render(i){return ae(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}`);let o=this.query.applyQueryToTasks(t);for(let l of o.groups){On.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 blo
`}),n=n.slice(0,t.autoSuggestMaxItems),n}function ZO(r){if(Object.values(Re).some(e=>e.length>0&&r.includes(e)))return!0}function XO(r,e){let t=[];return r.includes(Dt)||t.push({displayText:`${Dt} due date`,appendText:`${Dt} `}),r.includes(wt)||t.push({displayText:`${wt} start date`,appendText:`${wt} `}),r.includes(Mt)||t.push({displayText:`${Mt} scheduled date`,appendText:`${Mt} `}),ZO(r)||(t.push({displayText:`${Re.High} high priority`,appendText:`${Re.High} `}),t.push({displayText:`${Re.Medium} medium priority`,appendText:`${Re.Medium} `}),t.push({displayText:`${Re.Low} low priority`,appendText:`${Re.Low} `})),r.includes(Rt)||t.push({displayText:`${Rt} recurring (repeat)`,appendText:`${Rt} `}),t}function QO(r,e,t){let n=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],i=[],s=new RegExp(`([${VO}])\\s*([0-9a-zA-Z ]*)`,"ug"),a=Rd(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?Qt.parseDate(Tn(u),!0):null;l&&l.isValid()&&i.push({displayText:`${l.format(N.dateFormat)}`,appendText:`${o} ${l.format(N.dateFormat)} `,insertAt:a.index,insertSkip:a[0].length});let c=1,d=5,f=n.filter(p=>u&&u.length>=c&&p.toLowerCase().includes(u.toLowerCase())).slice(0,d);f.length===0&&(f=n.slice(0,d));for(let p of f){let m=`${Qt.parseDate(p,!0).format(N.dateFormat)}`;i.push({suggestionType:"match",displayText:`${p} (${m})`,appendText:`${o} ${m} `,insertAt:a.index,insertSkip:a[0].length})}}return i}function JO(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(`(${Rt})\\s*([0-9a-zA-Z ]*)`,"ug"),a=Rd(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 p=(o=pt.fromText({recurrenceRuleText:l,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:o.toText();if(p){let y=`${u} ${p} `;if(i.push({suggestionType:"match",displayText:`\u2705 ${p}`,appendText:y,insertAt:a.index,insertSkip:a[0].length}),a[0]==y)return[]}}let c=1,d=t.autoSuggestMaxItems/2,f=n.filter(p=>l&&l.length>=c&&p.toLowerCase().includes(l.toLowerCase())).slice(0,d);f.length===0&&l.trim().length===0&&(f=n.slice(0,d));for(let p of f)i.push({suggestionType:"match",displayText:`${p}`,appendText:`${u} ${p} `,insertAt:a.index,insertSkip:a[0].length})}return i}function Rd(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 La=class extends m_.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(N.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=h_(n,i.ch,this.settings),a=[];for(let o of s)a.push(Ut($e({},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 Ya=class extends y_.Plugin{onload(){return ae(this,null,function*(){console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new Wa({plugin:this})),Zd({metadataCache:this.app.metadataCache,vault:this.app.vault});let t=new ha({obsidianEvents:this.app.workspace});this.cache=new pr({metadataCache:this.app.metadataCache,vault:this.app.vault,events:t}),this.inli