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.

188 lines
209 KiB

3 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
var eh=Object.create;var vr=Object.defineProperty,th=Object.defineProperties,rh=Object.getOwnPropertyDescriptor,nh=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertyNames,Qa=Object.getOwnPropertySymbols,sh=Object.getPrototypeOf,Xa=Object.prototype.hasOwnProperty,ah=Object.prototype.propertyIsEnumerable;var Ja=(r,e,t)=>e in r?vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Le=(r,e)=>{for(var t in e||(e={}))Xa.call(e,t)&&Ja(r,t,e[t]);if(Qa)for(var t of Qa(e))ah.call(e,t)&&Ja(r,t,e[t]);return r},St=(r,e)=>th(r,nh(e)),eo=r=>vr(r,"__esModule",{value:!0});var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),oh=(r,e)=>{eo(r);for(var t in e)vr(r,t,{get:e[t],enumerable:!0})},uh=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ih(e))!Xa.call(r,n)&&n!=="default"&&vr(r,n,{get:()=>e[n],enumerable:!(t=rh(e,n))||t.enumerable});return r},Ye=r=>uh(eo(vr(r!=null?eh(sh(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var te=(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 Oo=p((qv,On)=>{var uo,lo,co,fo,ho,po,mo,yo,go,Pn,Oi,_o,To,Xt,bo,vo,wo,Do,Eo,ko,Mo,Ro,Po;(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 On=="object"&&typeof On.exports=="object"?r(t(e,t(On.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(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])};uo=function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},lo=Object.assign||function(t){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},co=function(t,n){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&n.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)n.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(i[s[a]]=t[s[a]]);return i},fo=function(t,n,i,s){var a=arguments.length,o=a<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,n,i,s);else for(var l=t.length-1;l>=0;l--)(u=t[l])&&(o=(a<3?u(o):a>3?u(n,i,o):u(n,i))||o);return a>3&&o&&Object.defineProperty(n,i,o),o},ho=function(t,n){return function(i,s){n(i,s,t)}},po=function(t,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,n)},mo=function(t,n,i,s){function a(o){return o instanceof i?o:new i(function(u){u(o)})}return new(i||(i=Promise))(function(o,u){function l(f){try{c(s.next(f))}catch(h){u(h)}}function d(f){try{c(s.throw(f))}catch(h){u(h)}}function c(f){f.done?o(f.value):a(f.value).then(l,d)}c((s=s.apply(t,n||[])).next())})},yo=function(t,n){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s,a,o,u;return u={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function l(c){return function(f){return d([c,f])}}function d(c){if(s)throw new TypeError("Generator is already executing.");for(;i;)try{if(s=1,a&&(o=c[0]&2?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,a=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(o=i.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]
2 years ago
`),{globalFilter:f}=se(),h,m=0;for(let b of l){if(b.position.start.line<r.sectionStart||b.task===void 0)continue;if(c[b.position.start.line].includes(f)){if(m===r.sectionIndex){h=b;break}m++}}if(h===void 0){console.error("Tasks: could not find task to toggle in the file.");return}let g=[...c.slice(0,h.position.start.line),...e.map(b=>b.toFileLineString()),...c.slice(h.position.start.line+1)];yield t.modify(o,g.join(`
2 years ago
`))});var wr=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 Mn=["MO","TU","WE","TH","FR","SA","SU"],le=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(Mn.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=Mn[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 Z=function(r){return r!=null},Ue=function(r){return typeof r=="number"},Pi=function(r){return Mn.indexOf(r)>=0},be=Array.isArray,Be=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 W=function(r,e){var t=0,n=[];if(be(r))for(;t<e;t++)n[t]=[].concat(r);else for(;t<e;t++)n[t]=r;return n},ao=function(r){return be(r)?r:[r]};function Ft(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+=W(t,e/t.length)),t.slice(0,e)+String(n))}var oo=function(r,e,t){var n=r.split(e);return t?n.slice(0,t).concat([n.slice(t).join(e)]):n},ke=function(r,e){var t=r%e;return t*e<0?t+e:t},Rn=function(r,e){return{div:Math.floor(r/e),mod:ke(r,e)}},qe=function(r){return!Z(r)||r.length===0},oe=function(r){return!qe(r)},L=function(r,e){return oe(r)&&r.indexOf(e)!==-1};var _t;(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[Ft(n.getUTCFullYear().toString(),4,"0"),Ft(n.getUTCMonth()+1,2,"0"),Ft(n.getUTCDate(),2,"0"),"T",Ft(n.getUTCHours(),2,"0"),Ft(n.getUTCMinutes(),2,"0"),Ft(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: "+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))}})(_t||(_t={}));var R=_t;var fh=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(t.after.getTime()+1)):e==="befo
`).map(Th).filter(function(t){return t!==null});return xe(xe({},e[0]),e[1])}function Rr(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[0],i=t[1],s=t[2];return i&&(e.tzid=i),e.dtstart=R.untilStringToDate(s),e}function Th(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return Yo(r);var t=e[0],n=e[1];switch(n.toUpperCase()){case"RRULE":case"EXRULE":return Yo(r);case"DTSTART":return Rr(r);default:throw new Error("Unsupported RFC prop "+n+" in "+r)}}function Yo(r){var e=r.replace(/^RRULE:/i,""),t=Rr(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=I[o.toUpperCase()];break;case"WKST":t.wkst=Ge[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=bh(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=vh(o);break;case"DTSTART":case"TZID":var d=Rr(r);t.tzid=d.tzid,t.dtstart=d.dtstart;break;case"UNTIL":t.until=R.untilStringToDate(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function bh(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(Uo)}return Uo(r)}function Uo(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function vh(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Ge[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/),i=Number(n[1]),s=n[2],a=Ge[s].weekday;return new le(a,i)})}var Yt=function(){function r(e,t){this.date=e,this.tzid=t}return Object.defineProperty(r.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!0,configurable:!0}),r.prototype.toString=function(){var e=R.timeToUntilString(this.date.getTime(),this.isUTC);return this.isUTC?":"+e:";TZID="+this.tzid+":"+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,e!=null?e:"UTC")})),s=i.getTime()-n.getTime();return new Date(this.date.getTime()-s)},r}();function Pr(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(kr),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!L(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!Z(o)||be(o)&&!o.length)){switch(a){case"FREQ":u=w.FREQUENCIES[r.freq];break;case"WKST":Ue(o)?u=new le(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=ao(o).map(function(h){return h instanceof le?h:be(h)?new le(h[0],h[1]):new le(h)}).toString();break;case"DTSTART":t=wh(o,r.tzid);break;case"UNTIL":u=R.timeToUntilString(o,!r.tzid);break;default:if(be(o)){for(var l=[],d=0;d<o.length;d++)l[d]=String(o[d]);u=l.toString()}else u=String(o)}u&&e.push([a,u])}}var c=e.map(function(h){var m=h[0],g=h[1];return m+"="+g.toString()}).join(";"),f="";return c!==""&&(f="RRULE:"+c),[t,f].filter(function(h){return!!h}).join(`
`)}function wh(r,e){return r?"DTSTART"+new Yt(new Date(r),e).toString():""}function Dh(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 qo=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?R.clone(t):R.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(d){for(var c=0;c<i.length;c++){var f=i[c];if(!Dh(t[f],d[f]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(be(a))for(var o=0;o<a.length;o++){var u=a[o];if(!(i.length&&s(u))){n=u._value;break}}if(!n&&this.all){for(var l=new ot(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return be(n)?R.cloneDates(n):n instanceof Date?R.clone(n):n},r}();var $o=Wt(W(1,31),W(2,28),W(3,31),W(4,30),W(5,31),W(6,30),W(7,31),W(8,31),W(9,30),W(10,31),W(11,30),W(12,31),W(1,7)),jo=Wt(W(1,31),W(2,29),W(3,31),W(4,30),W(5,31),W(6,30),W(7,31),W(8,31),W(9,30),W(10,31),W(11,30),W(12,31),W(1,7)),Eh=Be(1,29),kh=Be(1,30),Tt=Be(1,31),Me=Be(1,32),Bo=Wt(Me,kh,Me,Tt,Me,Tt,Me,Me,Tt,Me,Tt,Me,Me.slice(0,7)),Go=Wt(Me,Eh,Me,Tt,Me,Tt,Me,Me,Tt,Me,Tt,Me,Me.slice(0,7)),Mh=Be(-28,0),Rh=Be(-29,0),bt=Be(-30,0),Re=Be(-31,0),Ho=Wt(Re,Rh,Re,bt,Re,bt,Re,Re,bt,Re,bt,Re,Re.slice(0,7)),zo=Wt(Re,Mh,Re,bt,Re,bt,Re,Re,bt,Re,bt,Re,Re.slice(0,7)),Ko=[0,31,60,91,121,152,182,213,244,274,305,335,366],Vo=[0,31,59,90,120,151,181,212,243,273,304,334,365],Ci=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Be(7));return r}();function Zo(r,e){var t=new Date(Date.UTC(r,0,1)),n=R.isLeapYear(r)?366:365,i=R.isLeapYear(r+1)?366:365,s=R.toOrdinal(t),a=R.getWeekday(t),o=xe(xe({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},Ph(r)),{wnomask:null});if(qe(e.byweekno))return o;o.wnomask=W(0,n+7);var u,l,d=u=ke(7-a+e.wkst,7);d>=4?(d=0,l=o.yearlen+ke(a-e.wkst,7)):l=n-d;for(var c=Math.floor(l/7),f=ke(l,7),h=Math.floor(c+f/4),m=0;m<e.byweekno.length;m++){var g=e.byweekno[m];if(g<0&&(g+=h+1),g>0&&g<=h){var b=void 0;g>1?(b=d+(g-1)*7,d!==u&&(b-=7-u)):b=d;for(var O=0;O<7&&(o.wnomask[b]=1,b++,o.wdaymask[b]!==e.wkst);O++);}}if(L(e.byweekno,1)){var b=d+h*7;if(d!==u&&(b-=7-u),b<n)for(var m=0;m<7&&(o.wnomask[b]=1,b+=1,o.wdaymask[b]!==e.wkst);m++);}if(d){var K=void 0;if(L(e.byweekno,-1))K=-1;else{var J=R.getWeekday(new Date(Date.UTC(r-1,0,1))),j=ke(7-J.valueOf()+e.wkst,7),V=R.isLeapYear(r-1)?366:365,re=void 0;j>=4?(j=0,re=V+ke(J-e.wkst,7)):re=n-d,K=Math.floor(52+ke(re,7)/4)}if(L(e.byweekno,K))for(var b=0;b<d;b++)o.wnomask[b]=1}return o}function Ph(r){var e=R.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=R.getWeekday(t);return e===365?{mmask:$o,mdaymask:Go,nmdaymask:zo,wdaymask:Ci.slice(n),mrange:Vo}:{mmask:jo,mdaymask:Bo,nmdaymask:Ho,wdaymask:Ci.slice(n),mrange:Ko}}function Qo(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===w.YEARLY)if(qe(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(qe(o))return a;a.nwdaymask=W(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],d=l[0],c=l[1]-1,f=0;f<s.bynweekday.length;f++){var h=void 0,m=s.bynweekday[f],g=m[0],b=m[1];b<0?(h=c+(b+1)*7,h-=ke(i[h]-g,7)):(h=d+(b-1)*7,h+=ke(7-i[h]+g,7)),d<=h&&h<=c&&(a.nwdaymask[h]=1)}return a}function Xo(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=Math.floor((n-o+1)/3),l=Math.floor(19*t+n-s-u+15)%30,d=Math.floor(i/4),c=i%4,f=Math.floor(32+2*a+2*d-l-c)%7,h=Math.floor((t+11*l+22*f)/451),m=Math.floor((l+f-7*h+114)/31),g=(l+f-7*h+114)%31+1,b=Date.UTC(r,m-1,g+e),O=Date.UTC(r,0,1);return[Math.ceil((b-O)/(1e3*60*60*24))]}var Oh=function(){function r(e){this.options=e}return r.prototype.rebuild=function(e,t){var n=this.options;if(e!==this.lastyear&&(this.yearinfo=Zo(e,n)),oe(n.bynweekday)&&(t!==this.lastmonth||
`),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 Yh(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function iu(r,e){return Yh(e),r.split(",").map(function(t){return R.untilStringToDate(t)})}function su(r){var e=this;return function(t){if(t!==void 0&&(e["_"+r]=t),e["_"+r]!==void 0)return e["_"+r];for(var n=0;n<e._rrule.length;n++){var i=e._rrule[n].origOptions[r];if(i)return i}}}var Ii=function(r){Jt(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=su.apply(n,["dtstart"]),n.tzid=su.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return ru(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){au(t,this._rrule)},e.prototype.exrule=function(t){au(t,this._exrule)},e.prototype.rdate=function(t){ou(t,this._rdate)},e.prototype.exdate=function(t){ou(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return xn(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return xn(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(Pr({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(uu("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(uu("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 au(r,e){if(!(r instanceof w))throw new TypeError(String(r)+" is not RRule instance");L(e.map(String),String(r))||e.push(r)}function ou(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");L(e.map(Number),Number(r))||(e.push(r),R.sort(e))}function uu(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?r+":":r+";TZID="+t+":",s=e.map(function(a){return R.timeToUntilString(a.valueOf(),n)}).join(",");return""+i+s}var vt=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 d=new w(u);return new vt({rrule:d,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}catch(s){}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(){var t;let e;if(this.baseOnToday){let n=window.moment();e=new w(St(Le({},this.rrule.origOptions),{dtstart:n.startOf("day").utc(!0).toDate()})).after(n.endOf("day").utc(!0).toDate())}else{let n=window.moment((t=this.referenceDate)!=null?t:void 0).endOf("day").utc(!0);e=this.rrule.after(n.toDate())}if(e!==null){let i=window.moment.utc(e).local(!0).startOf("day"),s=null,a=null,o=null;if(this.referenceDate){if(this.startDate){let u=window.moment.duration(this.startDate.diff(this.referenceDate));s=window.moment(i),s.add(Math.round(u.asDays()),"days")}if(this.scheduledDate){let u=window.moment.duration(this.scheduledDate.diff(this.referenceDate));a=window.moment(i),a.add(Math.round(u.asDays()),"days")}if(this.dueDate){let u=window.moment.duration(this.dueDate.diff(this.referenceDate));o=window.moment(i),o.add(Math.round(u.asDays()),"days")}}return{startDate:s,scheduledDate:a,dueDate:o}}return null}};var lt=class{static calculate(e){let t=0;if(e.dueDate!==null){let n=window.moment().diff(e.dueDate)/lt.milliSecondsPerDay,i;n>=7?i=1:n>=-14?i=(n+14)*.8/21+.2:i=.2,t+=i*lt.dueCoefficient}switch(e.scheduledDate!==null&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*lt.scheduledCoefficient),e.startDate!==null&&window.moment().isBefore(e.startDate)&&(t+=1*lt.startedCoefficient),e.priority){case"1":t+=1*lt.priorityCoefficient;break;case"2":t+=.65*lt.priorityCoefficient;break;case"3":t+=.325*lt.priorityCoefficient;break}return t}},wt=lt;wt.dueCoefficient=12,wt.scheduledCoefficient=5,wt.startedCoefficient=-3,wt.priorityCoefficient=6,wt.milliSecondsPerDay=1e3*60*60*24;var ue;(function(t){t.Todo="Todo",t.Done="Done"})(ue||(ue={}));var X;(function(i){i.High="1",i.Medium="2",i.None="3",i.Low="4"})(X||(X={}));var B=class{constructor({status:e,description:t,path:n,indentation:i,sectionStart:s,sectionIndex:a,originalStatusCharacter:o,precedingHeader:u,priority:l,startDate:d,scheduledDate:c,dueDate:f,doneDate:h,recurrence:m,blockLink:g,tags:b}){this._urgency=null;this.status=e,this.description=t,this.path=n,this.indentation=i,this.sectionStart=s,this.sectionIndex=a,this.originalStatusCharacter=o,this.precedingHeader=u,this.tags=b,this.priority=l,this.startDate=d,this.scheduledDate=c,this.dueDate=f,this.doneDate=h,this.recurrence=m,this.blockLink=g}static fromLine({line:e,path:t,sectionStart:n,sectionIndex:i,precedingHeader:s}){let a=e.match(B.taskRegex);if(a===null)return null;let o=a[3].trim(),{globalFilter:u}=se();if(!o.incl
`);this.tasks=this.tasks.filter(u=>u.path!==e.path);let a=null,o=0;for(let u of n)if(u.task!==void 0){if((a===null||a.position.end.line<u.position.start.line)&&(a=this.getSection({lineNumberTask:u.position.start.line,sections:t.sections}),o=0),a===null)continue;let l=s[u.position.start.line],d=H.fromLine({line:l,path:e.path,sectionStart:a.position.start.line,sectionIndex:o,precedingHeader:this.getPrecedingHeader({lineNumberTask:u.position.start.line,sections:t.sections,fileLines:s})});d!==null&&(o++,this.tasks.push(d))}this.notifySubscribers()})}getSection({lineNumberTask:e,sections:t}){if(t===void 0)return null;for(let n of t)if(n.type==="list"&&n.position.start.line<=e&&n.position.end.line>=e)return n;return null}getPrecedingHeader({lineNumberTask:e,sections:t,fileLines:n}){if(t===void 0)return null;let i;for(let l of t)if(l.type==="heading"){if(l.position.start.line>e)break;i=l}if(i===void 0)return null;let s=i.position.start.line,a=n[s],o=/^#+ +(.*)/u,u=a.match(o);return u===null?null:u[1]}};var aa=Ye(require("obsidian"));var Gf=Ye(require("obsidian"));function rr(){}function Fi(r){return r()}function cu(){return Object.create(null)}function qt(r){r.forEach(Fi)}function du(r){return typeof r=="function"}function fu(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function hu(r){return Object.keys(r).length===0}var L1=new Set;var pu=!1;function Uh(){pu=!0}function qh(){pu=!1}function _(r,e){r.appendChild(e)}function Wi(r,e,t){r.insertBefore(e,t||null)}function Nn(r){r.parentNode.removeChild(r)}function A(r){return document.createElement(r)}function $h(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function ct(r){return document.createTextNode(r)}function Q(){return ct(" ")}function Dt(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function mu(r){return function(e){return e.preventDefault(),r.call(this,e)}}function S(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function jh(r){return Array.from(r.childNodes)}function yu(r,e){e=""+e,r.wholeText!==e&&(r.data=e)}function Ve(r,e){r.value=e==null?"":e}function Li(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 gu(r){let e=r.querySelector(":checked")||r.options[0];return e&&e.__value}var nr=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=$h(t.nodeName):this.e=A(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)Wi(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(Nn)}};var Y1=new Map;var Or;function Ar(r){Or=r}function Bh(){if(!Or)throw new Error("Function called outside component initialization");return Or}function Yi(r){Bh().$$.on_mount.push(r)}var xr=[];var In=[],Sn=[],_u=[],Gh=Promise.resolve(),Ui=!1;function Hh(){Ui||(Ui=!0,Gh.then(Tu))}function Cr(r){Sn.push(r)}var qi=new Set,Fn=0;function Tu(){let r=Or;do{for(;Fn<xr.length;){let e=xr[Fn];Fn++,Ar(e),zh(e.$$)}for(Ar(null),xr.length=0,Fn=0;In.length;)In.pop()();for(let e=0;e<Sn.length;e+=1){let t=Sn[e];qi.has(t)||(qi.add(t),t())}Sn.length=0}while(xr.length);for(;_u.length;)_u.pop()();Ui=!1,qi.clear(),Ar(r)}function zh(r){if(r.fragment!==null){r.update(),qt(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Cr)}}var Kh=new Set;function Vh(r,e){r&&r.i&&(Kh.delete(r),r.i(e))}var U1=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var q1=new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);function Zh(r,e,t,n){let{fragment:i,on_mount:s,on_destroy:a,after_update:o}=r.$$;i&&i.m(e,t),n||Cr(()=>{let u=s.map(Fi).filter(du);a?a.push(...u):qt(u),r
`),It=A("input"),ja=Q(),bi=A("code"),vi=ct(vn),Ba=Q(),wn=A("div"),Ga=ct(`Done on:
`),Dn=A("code"),Ha=Q(),za=A("hr"),Ka=Q(),wi=A("div"),Va=Q(),En=A("div"),En.innerHTML='<button type="submit" class="mod-cta">Apply</button>',S(i,"for","description"),S(a,"id","description"),S(a,"type","text"),S(a,"class","tasks-modal-description"),S(a,"placeholder","Take out the trash"),S(n,"class","tasks-modal-section"),S(c,"for","priority"),m.__value="none",m.value=m.__value,g.__value="high",g.value=g.__value,b.__value="medium",b.value=b.__value,O.__value="low",O.value=O.__value,S(h,"id","priority"),S(h,"class","dropdown"),r[0].priority===void 0&&Cr(()=>r[14].call(h)),S(d,"class","tasks-modal-section"),S(re,"for","recurrence"),S(M,"id","description"),S(M,"type","text"),S(M,"placeholder","Try 'every 2 weeks on Thursday'."),v.a=null,S(V,"class","tasks-modal-section"),S(G,"for","due"),S(q,"id","due"),S(q,"type","text"),S(q,"placeholder",sa),tt.a=null,S(P,"class","tasks-modal-date"),S(he,"for","scheduled"),S(We,"id","scheduled"),S(We,"type","text"),S(We,"placeholder",sa),yn.a=null,S(Oe,"class","tasks-modal-date"),S(gn,"for","start"),S(at,"id","start"),S(at,"type","text"),S(at,"placeholder",sa),Tn.a=null,S(gt,"class","tasks-modal-date"),S(k,"class","tasks-modal-section"),S(It,"type","checkbox"),S(It,"class","task-list-item-checkbox tasks-modal-checkbox"),It.checked=bn=r[0].status===ue.Done,It.disabled=!0,S(Vt,"class","tasks-modal-section"),S(wi,"class","tasks-modal-section"),S(En,"class","tasks-modal-section"),S(e,"class","tasks-modal")},m(ie,Ae){Wi(ie,e,Ae),_(e,t),_(t,n),_(n,i),_(n,s),_(n,a),Ve(a,r[0].description),r[13](a),_(t,o),_(t,u),_(t,l),_(t,d),_(d,c),_(d,f),_(d,h),_(h,m),_(h,g),_(h,b),_(h,O),Li(h,r[0].priority),_(t,K),_(t,J),_(t,j),_(t,V),_(V,re),_(V,x),_(V,M),Ve(M,r[0].recurrenceRule),_(V,ne),_(V,Ne),_(Ne,D),v.m(r[5],Ne),_(t,y),_(t,E),_(t,T),_(t,k),_(k,P),_(P,G),_(P,ee),_(P,q),Ve(q,r[0].dueDate),_(P,fe),_(P,Fe),_(Fe,je),tt.m(r[4],Fe),_(k,yt),_(k,Oe),_(Oe,he),_(Oe,Ke),_(Oe,We),Ve(We,r[0].scheduledDate),_(Oe,Nt),_(Oe,mn),_(mn,Ia),yn.m(r[3],mn),_(k,Sa),_(k,gt),_(gt,gn),_(gt,Fa),_(gt,at),Ve(at,r[0].startDate),_(gt,Wa),_(gt,_n),_(_n,La),Tn.m(r[2],_n),_(t,Ya),_(t,Ua),_(t,qa),_(t,Vt),_(Vt,Zt),_(Zt,$a),_(Zt,It),_(Zt,ja),_(Zt,bi),_(bi,vi),_(Vt,Ba),_(Vt,wn),_(wn,Ga),_(wn,Dn),Dn.innerHTML=r[6],_(t,Ha),_(t,za),_(t,Ka),_(t,wi),_(t,Va),_(t,En),Di||(Za=[Dt(a,"input",r[12]),Dt(h,"change",r[14]),Dt(M,"input",r[15]),Dt(q,"input",r[16]),Dt(We,"input",r[17]),Dt(at,"input",r[18]),Dt(t,"submit",mu(r[7]))],Di=!0)},p(ie,[Ae]){Ae&1&&a.value!==ie[0].description&&Ve(a,ie[0].description),Ae&1&&Li(h,ie[0].priority),Ae&1&&M.value!==ie[0].recurrenceRule&&Ve(M,ie[0].recurrenceRule),Ae&32&&v.p(ie[5]),Ae&1&&q.value!==ie[0].dueDate&&Ve(q,ie[0].dueDate),Ae&16&&tt.p(ie[4]),Ae&1&&We.value!==ie[0].scheduledDate&&Ve(We,ie[0].scheduledDate),Ae&8&&yn.p(ie[3]),Ae&1&&at.value!==ie[0].startDate&&Ve(at,ie[0].startDate),Ae&4&&Tn.p(ie[2]),Ae&1&&bn!==(bn=ie[0].status===ue.Done)&&(It.checked=bn),Ae&1&&vn!==(vn=ie[0].status+"")&&yu(vi,vn),Ae&64&&(Dn.innerHTML=ie[6])},i:rr,o:rr,d(ie){ie&&Nn(e),r[13](null),Di=!1,qt(Za)}}}var sa="Try 'Monday' or 'tomorrow', or [td|tm|yd|tw|nw|we] then space.";function Tv(r,e,t){var n,i;let{task:s}=e,{onSubmit:a}=e,o,u={description:"",status:ue.Todo,priority:"none",recurrenceRule:"",startDate:"",scheduledDate:"",dueDate:"",doneDate:""},l="",d="",c="",f="",h="";function m(x,M,ne=void 0){if(!M)return`<i>no ${x} date</i>`;let Ne=ln.default.parseDate(M,ne,{forwardDate:ne!=null});return Ne!==null?window.moment(Ne).format("YYYY-MM-DD"):`<i>invalid ${x} date</i>`}Yi(()=>{let{globalFilter:x}=se(),M=s.description.replace(x,"").replace(" "," ").trim(),ne="none";s.priority===X.Low?ne="low":s.priority===X.Medium?ne="medium":s.priority===X.High&&(ne="high"),t(0,u={description:M,status:s.status,priority:ne,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.doneDate.format("YYYY-MM-DD"):""}),setTimeout(()=>{o.focus()},10)});let g=()=
`);e.setLine(a,h)};new cn({app:n,task:u,onSubmit:l}).open()},bv=({line:r,path:e})=>{var c;let t=H.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null});if(t!==null)return t;let n=/^([\s\t]*)[-*]? *(\[(.)\])? *(.*)/u,i=r.match(n);if(i===null)return console.error("Tasks: Cannot create task on line:",r),new H({status:ue.Todo,description:"",path:e,indentation:"",originalStatusCharacter:" ",priority:X.None,startDate:null,scheduledDate:null,dueDate:null,doneDate:null,recurrence:null,sectionStart:0,sectionIndex:0,precedingHeader:null,blockLink:"",tags:[]});let s=i[1],a=(c=i[3])!=null?c:" ",o=a===" "?ue.Todo:ue.Done,u=i[4],l=r.match(H.blockLinkRegex),d=l!==null?l[0]:"";return d!==""&&(u=u.replace(H.blockLinkRegex,"")),new H({status:o,description:u,path:e,indentation:s,originalStatusCharacter:a,blockLink:d,priority:X.None,startDate:null,scheduledDate:null,dueDate:null,doneDate:null,recurrence:null,sectionStart:0,sectionIndex:0,precedingHeader:null,tags:[]})};var oa=Ye(require("obsidian"));var zf=(r,e,t)=>{var u;if(r)return t instanceof oa.MarkdownView;if(!(t instanceof oa.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=vv({line:a,path:n});e.setLine(s,o),/[^ [\]*-]/.test(o)&&e.setCursor({line:i.line,ch:i.ch+o.length-a.length})},vv=({line:r,path:e})=>{let t=r,n=H.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null});if(n!==null)t=wv({task:n});else{let i=r.match(H.taskRegex);if(i!==null)t=Dv({regexMatch:i});else{let s=/^([\s\t]*)([-*])/;s.test(r)?t=r.replace(s,"$1$2 [ ]"):t=r.replace(/^([\s\t]*)/,"$1- ")}}return t},wv=({task:r})=>r.toggle().map(n=>n.toFileLineString()).join(`
`),Dv=({regexMatch:r})=>{let e=r[1],t=r[2].toLowerCase(),n=r[3];return`${e}- [${t===" "?"x":" "}] ${n}`};var ua=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)=>Hf(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:zf})}};var _r;(function(t){t.CacheUpdate="obsidian-tasks-plugin:cache-update",t.RequestCacheUpdate="obsidian-tasks-plugin:request-cache-update"})(_r||(_r={}));var la=class{constructor({obsidianEents:e}){this.obsidianEvents=e}onCacheUpdate(e){return this.obsidianEvents.on(_r.CacheUpdate,e)}triggerCacheUpdate(e){this.obsidianEvents.trigger(_r.CacheUpdate,e)}onRequestCacheUpdate(e){return this.obsidianEvents.on(_r.RequestCacheUpdate,e)}triggerRequestCacheUpdate(e){this.obsidianEvents.trigger(_r.RequestCacheUpdate,e)}off(e){this.obsidianEvents.offref(e)}};var ca=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return te(this,null,function*(){var d;let{globalFilter:n}=se(),i=e.findAll(".task-list-item").filter(c=>{var m;let f=(m=c.textContent)==null?void 0:m.split(`
2 years ago
`);if(f===void 0)return!1;let h=null;for(let g=0;g<f.length;g=g+1)if(f[g]!==""){h=f[g];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(`
2 years ago
`),u=0,l=[];for(let c=a.lineStart;c<=a.lineEnd;c++){let f=o[c];if(f===void 0)continue;let h=H.fromLine({line:f,path:s,sectionStart:a.lineStart,sectionIndex:u,precedingHeader:null});h!==null&&(l.push(h),u++)}for(let c=0;c<i.length;c++){let f=l[c],h=i[c];if(f===void 0||h===void 0)continue;let m=(d=h.getAttr("data-line"))!=null?d:"0",g=Number.parseInt(m,10),b=yield f.toLi({parentUlElement:e,listIndex:g}),O=h.childNodes;for(let j=0;j<O.length;j=j+1){let V=O[j];V.nodeName.toLowerCase()==="div"?b.prepend(V):V.nodeName.toLowerCase()==="ul"&&b.append(V)}let K=h.querySelectorAll("[data-footnote-id]"),J=b.querySelectorAll("[data-footnote-id]");if(K.length===J.length)for(let j=0;j<K.length;j++)J[j].replaceWith(K[j]);h.replaceWith(b)}})}};var Kf=Ye(require("@codemirror/view"));var Vf=()=>Kf.ViewPlugin.fromClass(Zf),Zf=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{state:n}=this.view,i=this.view.posAtDOM(t),s=n.doc.lineAt(i),a=H.fromLine({line:s.text,path:"",sectionStart:0,sectionIndex:0,precedingHeader:null});if(a===null)return!1;e.preventDefault();let u=a.toggle().map(c=>c.toFileLineString()).join(n.lineBreak),l=n.update({changes:{from:s.from,to:s.to,insert:u}});this.view.dispatch(l);let d=t.checked;return setTimeout(()=>{t.checked=d},1),!0}};var Xf=Ye(require("obsidian"));var da=class{constructor(e,t){this.nestingLevel=e,this.name=t}};var fa=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 da(n,i));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var ha=class extends Map{},pa=class{constructor(e,t){this.groups=new ha;if(e.length===0||t.length===0)this.groups.set([],t);else{let n=Ct.getGroupersForAllQueryGroupings(e);for(let i of t){let s=Ct.getGroupNamesForTask(n,i);this.addTask(s,i)}this.groups=this.getSortedGroups()}}addTask(e,t){let n=this.getOrCreateGroupForGroupNames(e);n==null||n.push(t)}getOrCreateGroupForGroupNames(e){for(let[n,i]of this.groups)if(JSON.stringify(n)===JSON.stringify(e))return i;let t=[];return this.groups.set(e,t),t}getSortedGroups(){return new ha([...this.groups.entries()].sort())}};var ma=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 ya=class{constructor(e,t){this._groups=new Array;let n=new pa(e,t);this.addTasks(n)}get groups(){return this._groups}totalTasksCount(){let e=0;for(let t of this.groups)e+=t.tasks.length;return e}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 fa(e.groups);for(let[n,i]of e.groups){let s=t.getHeadingsForTaskGroup(n),a=new ma(n,s,i);this.add(a)}}add(e){this._groups.push(e)}};var pe=class{static by(e,t){return new ya(e,t)}static getGroupersForAllQueryGroupings(e){let t=[];for(let{property:n}of e){let i=pe.groupers[n];t.push(i)}return t}static getGroupNamesForTask(e,t){let n=[];for(let i of e){let s=i(t);n.push(s)}return n}static getGroupNameForTask(e,t){return pe.groupers[e](t)}static groupByStartDate(e){return pe.groupByDate(e.startDate,"start")}static groupByScheduledDate(e){return pe.groupByDate(e.scheduledDate,"scheduled")}static groupByDueDate(e){return pe.groupByDate(e.dueDate,"due")}static groupByDoneDate(e){return pe.groupByDate(e.doneDate,"done")}static groupByDate(e,t){return e===null?"No "+t+" date":e.format(pe.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 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}},Ct=pe;Ct.groupDateFormat="YYYY-MM-DD dddd",Ct.groupers={backlink:pe.groupByBacklink,done:pe.groupByDoneDate,due:pe.groupByDueDate,filename:pe.groupByFileName,folder:pe.groupByFolder,heading:pe.groupByHeading,path:pe.groupByPath,scheduled:pe.groupByScheduledDate,start:pe.groupByStartDate,status:pe.groupByStatus};var U=class{static by(e,t){let n=[U.compareByUrgency,U.compareByStatus,U.compareByDueDate,U.compareByPriority,U.compareByPath],i=[];for(let{property:s,reverse:a,propertyInstance:o}of e.sorting){let u=U.comparators[s];i.push(a?U.makeReversedComparator(u):u),s==="tag"&&(U.tagPropertyInstance=o)}return t.sort(U.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 U.compareByDate(e.startDate,t.startDate)}static compareByScheduledDate(e,t){return U.compareByDate(e.scheduledDate,t.scheduledDate)}static compareByDueDate(e,t){return U.compareByDate(e.dueDate,t.dueDate)}static compareByDoneDate(e,t){return U.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=U.tagPropertyInstance-1;return e.tags.length<U.tagPropertyInstance&&t.tags.length>=U.tagPropertyInstance?1:t.tags.length<U.tagPropertyInstance&&e.tags.length>=U.tagPropertyInstance?-1:e.tags.length<U.tagPropertyInstance&&t.tags.length<U.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 U.cleanDescription(e.description).localeCompare(U.cleanDescription(t.description))}static cleanDescription(e){let t=se().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}},dn=U;dn.tagPropertyInstance=1,dn.comparators={urgency:U.compareByUrgency,description:U.compareByDescription,priority:U.compareByPriority,start:U.compareByStartDate,scheduled:U.compareByScheduledDate,due:U.compareByDueDate,done:U.compareByDoneDate,path:U.compareByPath,status:U.compareByStatus,
`).map(t=>t.trim()).forEach(t=>{switch(!0){case t==="":break;case this.shortModeRegexp.test(t):this._layoutOptions.shortMode=!0;break;case this.parseFilter(t,new Oa):break;case this.parseFilter(t,new Pa):break;case this.parseFilter(t,new yi):break;case this.parseFilter(t,new Tr):break;case this.parseFilter(t,new _i):break;case this.parseFilter(t,new gi):break;case this.parseFilter(t,new hi):break;case this.parseFilter(t,new fi):break;case this.parseFilter(t,new mi):break;case this.parseFilter(t,new di):break;case this.parseFilter(t,new Ti):break;case this.parseFilter(t,new pi):break;case this.parseFilter(t,new wa):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;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=dn.by(this,e).slice(0,this.limit);return Ct.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,t){if(t.canCreateFilterForLine(e)){let{filter:n,error:i}=t.createFilterOrErrorMessage(e);return n?this._filters.push(n):this._error=i,!0}else return!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 xa=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 te(this,null,function*(){n.addChild(new pn({app:this.app,events:this.events,container:t,source:e}))})}},pn=class extends Xf.MarkdownRenderChild{constructor({app:e,events:t,container:n,source:i}){super(n);switch(this.app=e,this.events=t,this.source=i,this.containerEl.className){case"block-language-tasks":this.query=new hn({source:i}),this.queryType="tasks";break;default:this.query=new hn({source:i}),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 e=new Date;e.setHours(24,0,0,0);let t=new Date,n=e.getTime()-t.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=new hn({source:this.source}),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},n+1e3)}render(n){return te(this,arguments,function*({tasks:e,state:t}){var s;console.debug(`Render ${this.qu
3 years ago
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
* Based on:
* 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>
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */