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.

164 lines
312 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 A_=Object.create;var Bn=Object.defineProperty,k_=Object.defineProperties,N_=Object.getOwnPropertyDescriptor,x_=Object.getOwnPropertyDescriptors,S_=Object.getOwnPropertyNames,Jd=Object.getOwnPropertySymbols,C_=Object.getPrototypeOf,tf=Object.prototype.hasOwnProperty,I_=Object.prototype.propertyIsEnumerable;var ef=(r,e,t)=>e in r?Bn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,De=(r,e)=>{for(var t in e||(e={}))tf.call(e,t)&&ef(r,t,e[t]);if(Jd)for(var t of Jd(e))I_.call(e,t)&&ef(r,t,e[t]);return r},ft=(r,e)=>k_(r,x_(e));var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),F_=(r,e)=>{for(var t in e)Bn(r,t,{get:e[t],enumerable:!0})},rf=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of S_(e))!tf.call(r,i)&&i!==t&&Bn(r,i,{get:()=>e[i],enumerable:!(n=N_(e,i))||n.enumerable});return r};var vs=(r,e,t)=>(t=r!=null?A_(C_(r)):{},rf(e||!r||!r.__esModule?Bn(t,"default",{value:r,enumerable:!0}):t,r)),U_=r=>rf(Bn({},"__esModule",{value:!0}),r);var J=(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 xf=p((CA,Ps)=>{var df,ff,pf,hf,mf,yf,gf,_f,Tf,Ms,fo,bf,vf,Ef,an,wf,Rf,Df,Mf,Of,Pf,Af,kf,Nf,Os;(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])};df=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)},ff=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},pf=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},hf=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},mf=function(n,i){return function(s,a){i(s,a,n)}},yf=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},gf=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(g){l(g)}}function d(h){try{f(a.throw(h))}catch(g){l(g)}}function f(h){h.done?u(h.value):o(h.value).then(c,d)}f((a=a.apply(n,i||[])).next())})},_f=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],
`),{globalFilter:f}=B(),h,g=0;for(let _ of l){if(_.position.start.line<r.sectionStart||_.task===void 0)continue;if(d[_.position.start.line].includes(f)){if(g===r.sectionIndex){h=_;break}g++}}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(_=>_.toFileLineString()),...d.slice(h.position.start.line+1)];yield t.modify(o,m.join(`
`))});var sn=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.hideUrgency=!0;this.shortMode=!1;this.explainQuery=!1}};var Rs=["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(Rs.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=Rs[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 le=function(r){return r!=null},it=function(r){return typeof r=="number"},co=function(r){return typeof r=="string"&&Rs.includes(r)},Fe=Array.isArray,ht=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 G=function(r,e){var t=0,n=[];if(Fe(r))for(;t<e;t++)n[t]=[].concat(r);else for(;t<e;t++)n[t]=r;return n},lf=function(r){return Fe(r)?r:[r]};function Sr(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+=G(t,e/t.length)),t.slice(0,e)+String(n))}var cf=function(r,e,t){var n=r.split(e);return t?n.slice(0,t).concat([n.slice(t).join(e)]):n},Ye=function(r,e){var t=r%e;return t*e<0?t+e:t},Ds=function(r,e){return{div:Math.floor(r/e),mod:Ye(r,e)}},st=function(r){return!le(r)||r.length===0},ye=function(r){return!st(r)},z=function(r,e){return ye(r)&&r.indexOf(e)!==-1};var gr;(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[Sr(n.getUTCFullYear().toString(),4,"0"),Sr(n.getUTCMonth()+1,2,"0"),Sr(n.getUTCDate(),2,"0"),"T",Sr(n.getUTCHours(),2,"0"),Sr(n.getUTCMinutes(),2,"0"),Sr(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))}})(gr||(gr={}));var C=gr;var $_=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(
`).map(V_).filter(function(t){return t!==null});return Be(Be({},e[0]),e[1])}function Vn(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=C.untilStringToDate(i),e}function V_(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return $f(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return $f(r);case"DTSTART":return Vn(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function $f(r){var e=r.replace(/^RRULE:/i,""),t=Vn(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=$[o.toUpperCase()];break;case"WKST":t.wkst=mt[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=X_(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=Z_(o);break;case"DTSTART":case"TZID":var c=Vn(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=C.untilStringToDate(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function X_(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(jf)}return jf(r)}function jf(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function Z_(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return mt[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=mt[s].weekday;return new _e(a,i)})}var Ir=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=C.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 Zn(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(Kn),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!z(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!le(o)||Fe(o)&&!o.length)){switch(a){case"FREQ":u=O.FREQUENCIES[r.freq];break;case"WKST":it(o)?u=new _e(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=lf(o).map(function(h){return h instanceof _e?h:Fe(h)?new _e(h[0],h[1]):new _e(h)}).toString();break;case"DTSTART":t=Q_(o,r.tzid);break;case"UNTIL":u=C.timeToUntilString(o,!r.tzid);break;default:if(Fe(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 g=h[0],m=h[1];return"".concat(g,"=").concat(m.toString())}).join(";"),f="";return d!==""&&(f="RRULE:".concat(d)),[t,f].filter(function(h){return!!h}).join(`
`)}function Q_(r,e){return r?"DTSTART"+new Ir(new Date(r),e).toString():""}function J_(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 Bf=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?C.clone(t):C.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(!J_(t[f],c[f]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(Fe(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 Zt(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return Fe(n)?C.cloneDates(n):n instanceof Date?C.clone(n):n},r}();var Gf=T(T(T(T(T(T(T(T(T(T(T(T(T([],G(1,31),!0),G(2,28),!0),G(3,31),!0),G(4,30),!0),G(5,31),!0),G(6,30),!0),G(7,31),!0),G(8,31),!0),G(9,30),!0),G(10,31),!0),G(11,30),!0),G(12,31),!0),G(1,7),!0),Hf=T(T(T(T(T(T(T(T(T(T(T(T(T([],G(1,31),!0),G(2,29),!0),G(3,31),!0),G(4,30),!0),G(5,31),!0),G(6,30),!0),G(7,31),!0),G(8,31),!0),G(9,30),!0),G(10,31),!0),G(11,30),!0),G(12,31),!0),G(1,7),!0),eT=ht(1,29),tT=ht(1,30),_r=ht(1,31),$e=ht(1,32),zf=T(T(T(T(T(T(T(T(T(T(T(T(T([],$e,!0),tT,!0),$e,!0),_r,!0),$e,!0),_r,!0),$e,!0),$e,!0),_r,!0),$e,!0),_r,!0),$e,!0),$e.slice(0,7),!0),Kf=T(T(T(T(T(T(T(T(T(T(T(T(T([],$e,!0),eT,!0),$e,!0),_r,!0),$e,!0),_r,!0),$e,!0),$e,!0),_r,!0),$e,!0),_r,!0),$e,!0),$e.slice(0,7),!0),rT=ht(-28,0),nT=ht(-29,0),Tr=ht(-30,0),je=ht(-31,0),Vf=T(T(T(T(T(T(T(T(T(T(T(T(T([],je,!0),nT,!0),je,!0),Tr,!0),je,!0),Tr,!0),je,!0),je,!0),Tr,!0),je,!0),Tr,!0),je,!0),je.slice(0,7),!0),Xf=T(T(T(T(T(T(T(T(T(T(T(T(T([],je,!0),rT,!0),je,!0),Tr,!0),je,!0),Tr,!0),je,!0),je,!0),Tr,!0),je,!0),Tr,!0),je,!0),je.slice(0,7),!0),Zf=[0,31,60,91,121,152,182,213,244,274,305,335,366],Qf=[0,31,59,90,120,151,181,212,243,273,304,334,365],mo=function(){for(var r=[],e=0;e<55;e++)r=r.concat(ht(7));return r}();function Jf(r,e){var t=new Date(Date.UTC(r,0,1)),n=C.isLeapYear(r)?366:365,i=C.isLeapYear(r+1)?366:365,s=C.toOrdinal(t),a=C.getWeekday(t),o=Be(Be({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},iT(r)),{wnomask:null});if(st(e.byweekno))return o;o.wnomask=G(0,n+7);var u,l,c=u=Ye(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+Ye(a-e.wkst,7)):l=n-c;for(var d=Math.floor(l/7),f=Ye(l,7),h=Math.floor(d+f/4),g=0;g<e.byweekno.length;g++){var m=e.byweekno[g];if(m<0&&(m+=h+1),m>0&&m<=h){var _=void 0;m>1?(_=c+(m-1)*7,c!==u&&(_-=7-u)):_=c;for(var R=0;R<7&&(o.wnomask[_]=1,_++,o.wdaymask[_]!==e.wkst);R++);}}if(z(e.byweekno,1)){var _=c+h*7;if(c!==u&&(_-=7-u),_<n)for(var g=0;g<7&&(o.wnomask[_]=1,_+=1,o.wdaymask[_]!==e.wkst);g++);}if(c){var w=void 0;if(z(e.byweekno,-1))w=-1;else{var A=C.getWeekday(new Date(Date.UTC(r-1,0,1))),H=Ye(7-A.valueOf()+e.wkst,7),de=C.isLeapYear(r-1)?366:365,fe=void 0;H>=4?(H=0,fe=de+Ye(A-e.wkst,7)):fe=n-c,w=Math.floor(52+Ye(fe,7)/4)}if(z(e.byweekno,w))for(var _=0;_<c;_++)o.wnomask[_]=1}return o}function iT(r){var e=C.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=C.getWeekday(t);return e===365?{mmask:Gf,mdaymask:Kf,nmdaymask:Xf,wdaymask:mo.slice(n),mrange:Qf}:{mmask:Hf,mdaymask:zf,nmdaymask:Vf,wdaymask:mo.slice(n),mrange:Zf}}function ep(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===O.YEARLY)if(st(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===O.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(st(o))return a;a.nwdaymask=G(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,g=s.bynweekday[f],m=g[0],_=g[1];_<0?(h=d+(_+1)*7,h-=Ye(i[h]-m,7)):(h=c+(_-1)*7,h+=Ye(7-i[h]+m,7)),c<=h&&h<=d&&(a.nwdaymask[h]=1)}return a}function tp(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 mT(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function op(r,e){return mT(e),r.split(",").map(function(t){return C.untilStringToDate(t)})}function up(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 go=function(r){on(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=up.apply(n,["dtstart"]),n.tzid=up.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return sp(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){lp(t,this._rrule)},e.prototype.exrule=function(t){lp(t,this._exrule)},e.prototype.rdate=function(t){cp(t,this._rdate)},e.prototype.exdate=function(t){cp(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return ks(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return ks(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(Zn({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(dp("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(dp("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}(O);function lp(r,e){if(!(r instanceof O))throw new TypeError(String(r)+" is not RRule instance");z(e.map(String),String(r))||e.push(r)}function cp(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");z(e.map(Number),Number(r))||(e.push(r),C.sort(e))}function dp(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return C.timeToUntilString(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}var V=class{static by(e,t){let n=[V.compareByUrgency,V.compareByStatus,V.compareByDueDate,V.compareByPriority,V.compareByPath],i=[];for(let{property:s,reverse:a,propertyInstance:o}of e.sorting){let u=V.comparators[s];i.push(a?V.makeReversedComparator(u):u),s==="tag"&&(V.tagPropertyInstance=o)}return t.sort(V.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 V.compareByDate(e.startDate,t.startDate)}static compareByScheduledDate(e,t){return V.compareByDate(e.scheduledDate,t.scheduledDate)}static compareByDueDate(e,t){return V.compareByDate(e.dueDate,t.dueDate)}static compareByDoneDate(e,t){return V.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=V.tagPropertyInstance-1;return e.tags.length<V.tagPropertyInstance&&t.tags.length>=V.tagPropertyInstance?1:t.tags.length<V.tagPropertyInstance&&e.tags.length>=V.tagPropertyInstance?-1:e.tags.length<V.tagPropertyInstance&&t.tags.length<V.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.isValid()&&!t.isValid()?-1:!e.isValid()&&t.isValid()||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 V.cleanDescription(e.description).localeCompare(V.cleanDescription(t.description))}static cleanDescription(e){let t=B().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}},Ke=V;Ke.tagPropertyInstance=1,Ke.comparators={urgency:V.compareByUrgency,description:V.compareByDescription,priority:V.compareByPriority,start:V.compareByStartDate,scheduled:V.compareByScheduledDate,due:V.compareByDueDate,done:V.compareByDoneDate,path:V.compareByPath,status:V.compareByStatus,tag:V.compareByTag};var Me=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=O.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 O(u);return new Me({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}ca
`),o=new Qn(()=>Ve.fromPath(i.path)),u=null,l=0;for(let c of t)if(c.task!==void 0){if((u===null||u.position.end.line<c.position.start.line)&&(u=br.getSection(c.position.start.line,n.sections),l=0),u===null)continue;let d=a[c.position.start.line],f=ne.fromLine({line:d,path:i.path,sectionStart:u.position.start.line,sectionIndex:l,precedingHeader:br.getPrecedingHeader(c.position.start.line,n.headings),fallbackDate:o.value});f!==null&&(l++,s.push(f))}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 gd=require("obsidian");var s_=require("obsidian");function Ur(){}function Eo(r){return r()}function hp(){return Object.create(null)}function qr(r){r.forEach(Eo)}function yp(r){return typeof r=="function"}function gp(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function _p(r){return Object.keys(r).length===0}var Tp=!1;function yT(){Tp=!0}function gT(){Tp=!1}function v(r,e){r.appendChild(e)}function ri(r,e,t){r.insertBefore(e,t||null)}function cn(r){r.parentNode.removeChild(r)}function bp(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function q(r){return document.createElement(r)}function _T(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function $t(r){return document.createTextNode(r)}function X(){return $t(" ")}function Mt(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function vp(r){return function(e){return e.preventDefault(),r.call(this,e)}}function P(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function TT(r){return Array.from(r.childNodes)}function Ep(r,e){e=""+e,r.wholeText!==e&&(r.data=e)}function Ot(r,e){r.value=e==null?"":e}function wo(r,e,t){r.classList[t?"add":"remove"](e)}var Fr=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=_T(t.nodeName):this.e=q(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)ri(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(cn)}};var ti;function ei(r){ti=r}function bT(){if(!ti)throw new Error("Function called outside component initialization");return ti}function Ro(r){bT().$$.on_mount.push(r)}var Jn=[];var Cs=[],Ss=[],mp=[],vT=Promise.resolve(),bo=!1;function ET(){bo||(bo=!0,vT.then(wp))}function vo(r){Ss.push(r)}var To=new Set,xs=0;function wp(){let r=ti;do{for(;xs<Jn.length;){let e=Jn[xs];xs++,ei(e),wT(e.$$)}for(ei(null),Jn.length=0,xs=0;Cs.length;)Cs.pop()();for(let e=0;e<Ss.length;e+=1){let t=Ss[e];To.has(t)||(To.add(t),t())}Ss.length=0}while(Jn.length);for(;mp.length;)mp.pop()();bo=!1,To.clear(),ei(r)}function wT(r){if(r.fragment!==null){r.update(),qr(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(vo)}}var RT=new Set;function DT(r,e){r&&r.i&&(RT.delete(r),r.i(e))}var $x=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function MT(r,e,t,n){let{fragment:i,on_mount:s,on_destroy:a,after_update:o}=r.$$;i&&i.m(e,t),n||vo(()=>{let u=s.map(Eo).filter(yp);a?a.push(...u):qr(u),r.$$.on_mount=[]}),o.forEach(vo)}function Rp(r,e){let t=r.$$;t.fragment!==null&&(qr(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function OT(r,e){r.$$.dirty[0]===-1&&(Jn.push(r),ET(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function Dp(r,e,t,n,i,s,a,o=[-1]){let u=ti;ei(r);let l=r.$$={fragment:null,ctx:null,props:s,update:Ur,not_equal:i,bound:hp(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:hp(),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 g=h.length?h[0]:f;return l.ctx&&i(l.ctx[d],l.ctx[d]=g)&
<span class="accesskey-first">future</span> dates:`,jd=X(),It=q("input"),Bd=X(),tn=q("div"),xr=q("div"),gs=q("label"),gs.textContent="Status:",Gd=X(),yr=q("input"),Hd=X(),no=q("code"),io=$t(Ts),zd=X(),Yn=q("div"),so=q("span"),so.textContent="Done on:",Kd=X(),bs=q("code"),Vd=X(),rn=q("div"),$n=q("button"),$n.textContent="Apply",Xd=X(),jn=q("button"),jn.textContent="Cancel",P(i,"for","description"),P(a,"id","description"),P(a,"type","text"),P(a,"class","tasks-modal-description"),P(a,"placeholder","Take out the trash"),P(a,"accesskey",o=r[8]("t")),P(n,"class","tasks-modal-section"),P(c,"for",f="priority-"+r[0].priority),P(l,"class","tasks-modal-section tasks-modal-priorities"),P(_,"for","recurrence"),P(_,"class","accesskey-first"),P(w,"id","description"),P(w,"type","text"),P(w,"placeholder","Try 'every 2 weeks on Thursday'."),P(w,"accesskey",A=r[8]("r")),Y.a=null,P(tt,"for","due"),P(tt,"class","accesskey-first"),P(E,"id","due"),P(E,"type","text"),P(E,"placeholder",hd),P(E,"accesskey",b=r[8]("d")),I.a=null,P(K,"for","scheduled"),P(K,"class","accesskey-first"),P(ue,"id","scheduled"),P(ue,"type","text"),P(ue,"placeholder",hd),P(ue,"accesskey",Ce=r[8]("s")),nt.a=null,P(Xt,"for","start"),P(Dt,"id","start"),P(Dt,"type","text"),P(Dt,"placeholder",hd),P(Dt,"accesskey",ps=r[8]("a")),hs.a=null,P(ms,"for","forwardOnly"),P(It,"id","forwardOnly"),P(It,"type","checkbox"),P(It,"class","task-list-item-checkbox tasks-modal-checkbox"),P(It,"accesskey",ys=r[8]("f")),P(m,"class","tasks-modal-section tasks-modal-dates"),P(gs,"for","status"),P(yr,"id","status"),P(yr,"type","checkbox"),P(yr,"class","task-list-item-checkbox tasks-modal-checkbox"),yr.checked=_s=r[0].status==="Done",yr.disabled=!0,P(tn,"class","tasks-modal-section tasks-modal-status"),P($n,"type","submit"),P($n,"class","mod-cta"),P(jn,"type","button"),P(rn,"class","tasks-modal-section tasks-modal-buttons"),wo(t,"with-accesskeys",r[1]),P(e,"class","tasks-modal")},m(F,ce){ri(F,e,ce),v(e,t),v(t,n),v(n,i),v(n,s),v(n,a),Ot(a,r[0].description),r[18](a),v(t,u),v(t,l),v(l,c),v(c,d),v(l,h);for(let Le=0;Le<ze.length;Le+=1)ze[Le].m(l,null);v(t,g),v(t,m),v(m,_),v(m,R),v(m,w),Ot(w,r[0].recurrenceRule),v(m,H),v(m,de),v(de,fe),v(de,se),Y.m(r[6],de),v(m,dt),v(m,tt),v(m,k),v(m,E),Ot(E,r[0].dueDate),v(m,x),v(m,y),v(y,S),v(y,N),I.m(r[5],y),v(m,te),v(m,K),v(m,oe),v(m,ue),Ot(ue,r[0].scheduledDate),v(m,He),v(m,rt),v(rt,Vt),v(rt,Ie),nt.m(r[4],rt),v(m,en),v(m,Xt),v(m,qd),v(m,Dt),Ot(Dt,r[0].startDate),v(m,Wd),v(m,Wn),v(Wn,Ld),v(Wn,Yd),hs.m(r[3],Wn),v(m,$d),v(m,Ln),v(Ln,ms),v(Ln,jd),v(Ln,It),It.checked=r[0].forwardOnly,v(t,Bd),v(t,tn),v(tn,xr),v(xr,gs),v(xr,Gd),v(xr,yr),v(xr,Hd),v(xr,no),v(no,io),v(tn,zd),v(tn,Yn),v(Yn,so),v(Yn,Kd),v(Yn,bs),bs.innerHTML=r[7],v(t,Vd),v(t,rn),v(rn,$n),v(rn,Xd),v(rn,jn),ao||(Zd=[Mt(a,"input",r[17]),Mt(l,"keyup",r[10]),Mt(w,"input",r[21]),Mt(E,"input",r[22]),Mt(ue,"input",r[23]),Mt(Dt,"input",r[24]),Mt(It,"change",r[25]),Mt(jn,"click",r[11]),Mt(t,"submit",vp(r[12]))],ao=!0)},p(F,ce){if(ce[0]&256&&o!==(o=F[8]("t"))&&P(a,"accesskey",o),ce[0]&1&&a.value!==F[0].description&&Ot(a,F[0].description),ce[0]&1&&f!==(f="priority-"+F[0].priority)&&P(c,"for",f),ce[0]&769){nn=F[9];let Le;for(Le=0;Le<nn.length;Le+=1){let Qd=t_(F,nn,Le);ze[Le]?ze[Le].p(Qd,ce):(ze[Le]=r_(Qd),ze[Le].c(),ze[Le].m(l,null))}for(;Le<ze.length;Le+=1)ze[Le].d(1);ze.length=nn.length}ce[0]&256&&A!==(A=F[8]("r"))&&P(w,"accesskey",A),ce[0]&1&&w.value!==F[0].recurrenceRule&&Ot(w,F[0].recurrenceRule),ce[0]&64&&Y.p(F[6]),ce[0]&256&&b!==(b=F[8]("d"))&&P(E,"accesskey",b),ce[0]&1&&E.value!==F[0].dueDate&&Ot(E,F[0].dueDate),ce[0]&32&&I.p(F[5]),ce[0]&256&&Ce!==(Ce=F[8]("s"))&&P(ue,"accesskey",Ce),ce[0]&1&&ue.value!==F[0].scheduledDate&&Ot(ue,F[0].scheduledDate),ce[0]&16&&nt.p(F[4]),ce[0]&256&&ps!==(ps=F[8]("a"))&&P(Dt,"accesskey",ps),ce[0]&1&&Dt.value!==F[0].startDate&&Ot(Dt,F[0].startDate),ce[0]&8&&hs.p(F[3]),ce[0]&256&&ys!==(ys=F[8]("f"))&&P(It,"accesskey",ys),ce[0]&1&&(It.checked=F[0].forwardOnly),ce[0]&1&&_s!==(_s=F[0].status==="Done")&&(yr.checked=_s),ce[0]&1&&Ts!==(Ts=F[0].status+"")&&Ep(io,Ts),ce[0]&128
`);e.setLine(a,h)};new Pn({app:n,task:u,onSubmit:l}).open()};var _d=require("obsidian");var u_=(r,e,t)=>{var u;if(r)return t instanceof _d.MarkdownView;if(!(t instanceof _d.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=XP(a,n);e.setLine(s,o),e.setCursor({line:i.line,ch:QP(i.ch,a,o)})},XP=(r,e)=>{let t=r,n=ne.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null,fallbackDate:null});if(n!==null)t=ZP(n);else{let i=r.match(M.taskRegex);if(i!==null){let a=i[3].toLowerCase()===" "?"x":" ";t=r.replace(M.taskRegex,`$1- [${a}] $4`)}else M.listItemRegex.test(r)?t=r.replace(M.listItemRegex,"$1$2 [ ]"):t=r.replace(M.indentationRegex,"$1- ")}return t},ZP=r=>r.toggle().map(n=>n.toFileLineString()).join(`
`),QP=(r,e,t)=>{let n=t.length;if(n<=e.length)return r>=t.length?n:r;let i=13;if(t.match(M.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 Oa=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)=>o_(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:u_})}};var Pa=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 Aa=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return J(this,null,function*(){var c;let{globalFilter:n}=B(),i=e.findAll(".task-list-item").filter(d=>{var g;let f=(g=d.textContent)==null?void 0:g.split(`
`);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=ne.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 g=(c=h.getAttr("data-line"))!=null?c:"0",m=Number.parseInt(g,10),_=yield f.toLi({parentUlElement:e,listIndex:m}),R=h.childNodes;for(let H=0;H<R.length;H=H+1){let de=R[H];de.nodeName.toLowerCase()==="div"?_.prepend(de):de.nodeName.toLowerCase()==="ul"&&_.append(de)}let w=h.querySelectorAll("[data-footnote-id]"),A=_.querySelectorAll("[data-footnote-id]");if(w.length===A.length)for(let H=0;H<w.length;H++)A[H].replaceWith(w[H]);h.replaceWith(_)}})}};var l_=require("@codemirror/view"),c_=require("obsidian");var d_=()=>l_.ViewPlugin.fromClass(Td),Td=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 c_.Notice(f,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=ne.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 eo=require("obsidian");var An=class{matchesAnyOf(e){return e.some(t=>this.matches(t))}};var Xr=class extends An{constructor(t){super();this.stringToFind=t}matches(t){return Xr.stringIncludesCaseInsensitive(t,this.stringToFind)}static stringIncludesCaseInsensitive(t,n){return t.toLocaleLowerCase().includes(n.toLocaleLowerCase())}};var kn=class extends An{constructor(t){super();this.regex=t}static validateAndConstruct(t){let n=/\/((?![*+?])(?:[^\r\n[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*])+)\/((?:g(?:im?|mi?)?|i(?:gm?|mg?)?|m(?:gi?|ig?)?)?)/,i=t.match(n);if(i!==null){let s=new RegExp(i[1],i[2]);return new kn(s)}else return null}matches(t){return t.match(this.regex)!==null}};var ge=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 ge("None of",e,"NOT")}static booleanXor(e){return new ge("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 ge(e,t,n)}};var Ee=class{canCreateFilterForLine(e){return Ee.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 Je=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}
`:`${e}${this.instruction} =>
${t.asString(" ")}
`}},he=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 he(e.instruction);return t.filter=e,t}static fromError(e,t){let n=new he(e);return n.error=t,n}};var wt=class extends Ee{createFilterOrErrorMessage(e){let t=Ee.getMatch(this.filterRegExp(),e);if(t===null)return he.fromError(e,`do not understand query filter (${this.fieldName()})`);let[n,i,s]=t,a=null;if(i.includes("include"))a=new Xr(s);else if(i.includes("regex")&&(a=kn.validateAndConstruct(s),a===null))return he.fromError(e,`cannot parse regex (${this.fieldName()}); check your leading and trailing slashes for your query`);if(a===null)return he.fromError(e,`do not understand query filter (${this.fieldName()})`);let o=i.match(/not/)!==null,u=new Je(e,this.getFilter(a,o),new ge(e));return he.fromFilter(u)}static stringIncludesCaseInsensitive(e,t){return Xr.stringIncludesCaseInsensitive(e,t)}fieldPattern(){return this.fieldName()}filterOperatorPattern(){return"includes|does not include|regex matches|regex does not match"}filterRegExp(){return new RegExp(`^(?:${this.fieldPattern()}) (${this.filterOperatorPattern()}) (.*)`)}getFilter(e,t){return n=>{let i=e.matches(this.value(n));return t?!i:i}}};var ka=class extends wt{fieldName(){return"description"}value(e){let t=B().globalFilter;return e.description.replace(t,"").trim()}};var f_=vs(Re()),cr=class{static parseDate(e,t=!1){return window.moment(f_.parseDate(e,void 0,{forwardDate:t})).startOf("day")}};var Na=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e==this._instruction}createFilterOrErrorMessage(e){let t=new he(e);return e===this._instruction?(t.filter=new Je(e,this._filter,new ge(e)),t):(t.error=`do not understand filter: ${e}`,t)}};var Pr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new Na(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 he(e);return t.error=`do not understand filter: ${e}`,t}};var et=class extends Ee{constructor(){super();this.filterInstructions=new Pr,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 he(t),s=Ee.getMatch(this.filterRegExp(),t),a;if(s!==null){let o=cr.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=et.getExplanationString(this.fieldName(),u,this.filterResultIfFieldMissing(),o);i.filter=new Je(t,a,new ge(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}};var bd=class extends et{filterRegExp(){return bd.doneRegexp}fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}},is=bd;is.doneRegexp=/^done (before|after|on)? ?(.*)/;var vd=class extends et{filterRegExp(){return vd.dueRegexp}fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}},ss=vd;ss.dueRegexp=/^due (before|after|on)? ?(.*)/;var
3 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 Qa=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length;let n=new Xa(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+=`
3 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
2 years ago
`,e}addTasks(e){let t=new Ha(e.groups);for(let[n,i]of e.groups){let s=t.getHeadingsForTaskGroup(n),a=new Za(n,s,i);this.add(a)}}add(e){this._groups.push(e)}};var ee=class{static by(e,t){return new Qa(e,t)}static getGroupNamesForTask(e,t){let n=ee.groupers[e];return n(t)}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[ee.stringFromDate(e.startDate,"start")]}static groupByScheduledDate(e){return[ee.stringFromDate(e.scheduledDate,"scheduled")]}static groupByDueDate(e){return[ee.stringFromDate(e.dueDate,"due")]}static groupByDoneDate(e){return[ee.stringFromDate(e.doneDate,"done")]}static groupByHappensDate(e){let t=new dr().earliestDate(e);return[ee.stringFromDate(t,"happens")]}static stringFromDate(e,t){return e===null?"No "+t+" date":e.format(ee.groupDateFormat)}static groupByPath(e){return[ee.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===""?["/"]:[ee.escapeMarkdownCharacters(i)]}static groupByFileName(e){let t=e.filename;return t===null?["Unknown Location"]:[ee.escapeMarkdownCharacters(t)]}static groupByRoot(e){let t=e.path.replace(/\\/g,"/"),n=t.indexOf("/");return n==-1?["/"]:[ee.escapeMarkdownCharacters(t.substring(0,n+1))]}static groupByBacklink(e){if(e.getLinkText({isFilenameUnique:!0})===null)return["Unknown Location"];let n=ee.groupByFileName(e)[0];if(e.precedingHeader===null||e.precedingHeader.length===0)return[n];let i=ee.groupByHeading(e)[0];return n===i?[n]:[`${n} > ${i}`]}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}},Nr=ee;Nr.groupDateFormat="YYYY-MM-DD dddd",Nr.groupers={backlink:ee.groupByBacklink,done:ee.groupByDoneDate,due:ee.groupByDueDate,filename:ee.groupByFileName,folder:ee.groupByFolder,happens:ee.groupByHappensDate,heading:ee.groupByHeading,path:ee.groupByPath,priority:ee.groupByPriority,recurrence:ee.groupByRecurrence,recurring:ee.groupByRecurring,root:ee.groupByRoot,scheduled:ee.groupByScheduledDate,start:ee.groupByStartDate,status:ee.groupByStatus,tags:ee.groupByTags};var Un=class{constructor({source:e}){this._limit=void 0;this._layoutOptions=new sn;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this.sortByRegexp=/^sort by (urgency|status|priority|start|scheduled|due|done|path|description|tag)( reverse)?[\s]*(\d+)?/;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.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}`}})}explainQuery(){return`Explanation of this Tasks code block query:
`+this.explainQueryWithoutIntroduction()}explainQueryWithoutIntroduction(){let e="",{globalFilter:t}=B();t.length!==0&&(e+=`Only tasks containing the global filter '${t}'.
`);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=Ke.by(this,e).slice(0,this.limit);return Nr.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=ja(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 Ja=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 J(this,null,function*(){n.addChild(new Fd({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},Fd=class extends eo.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 Un({source:s}),this.queryType="tasks";break;default:this.query=new Un({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 Un({source:this.source}),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},i+1e3)}render(i){return J(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.setText(`Tasks query: ${this.query.error}`):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)}createTasksList(i){r
`}),n=n.slice(0,t.autoSuggestMaxItems),n}function lA(r){if(Object.values(we).some(e=>e.length>0&&r.includes(e)))return!0}function cA(r,e){let t=[];return r.includes(Yt)||t.push({displayText:`${Yt} due date`,appendText:`${Yt} `}),r.includes(Wt)||t.push({displayText:`${Wt} start date`,appendText:`${Wt} `}),r.includes(Lt)||t.push({displayText:`${Lt} scheduled date`,appendText:`${Lt} `}),lA(r)||(t.push({displayText:`${we.High} high priority`,appendText:`${we.High} `}),t.push({displayText:`${we.Medium} medium priority`,appendText:`${we.Medium} `}),t.push({displayText:`${we.Low} low priority`,appendText:`${we.Low} `})),r.includes(qt)||t.push({displayText:`${qt} recurring (repeat)`,appendText:`${qt} `}),t}function dA(r,e,t){let n=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],i=[],s=new RegExp(`([${uA}])\\s*([0-9a-zA-Z ]*)`,"ug"),a=Ud(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?cr.parseDate(On(u),!0):null;l&&l.isValid()&&i.push({displayText:`${l.format(M.dateFormat)}`,appendText:`${o} ${l.format(M.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=`${cr.parseDate(h,!0).format(M.dateFormat)}`;i.push({suggestionType:"match",displayText:`${h} (${m})`,appendText:`${o} ${m} `,insertAt:a.index,insertSkip:a[0].length})}}return i}function fA(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(`(${qt})\\s*([0-9a-zA-Z ]*)`,"ug"),a=Ud(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=Me.fromText({recurrenceRuleText:l,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:o.toText();if(h){let g=`${u} ${h} `;if(i.push({suggestionType:"match",displayText:`\u2705 ${h}`,appendText:g,insertAt:a.index,insertSkip:a[0].length}),a[0]==g)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 Ud(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 to=class extends O_.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(M.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=M_(n,i.ch,this.settings),a=[];for(let o of s)a.push(ft(De({},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 ro=class extends P_.Plugin{onload(){return J(this,null,function*(){console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new fs({plugin:this})),of({metadataCache:this.app.metadataCache,vault:this.app.vault});let t=new Pa({obsidianEvents:this.app.workspace});this.cache=new br({metadataCache:this.app.metadataCache,vault:this.app.vault,events:t}),this.inlin