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 Kf=Object.create;var Dr=Object.defineProperty,Vf=Object.defineProperties,Zf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyDescriptors,Xf=Object.getOwnPropertyNames,Ga=Object.getOwnPropertySymbols,Jf=Object.getPrototypeOf,Ha=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable;var za=(r,e,t)=>e in r?Dr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,We=(r,e)=>{for(var t in e||(e={}))Ha.call(e,t)&&za(r,t,e[t]);if(Ga)for(var t of Ga(e))eh.call(e,t)&&za(r,t,e[t]);return r},It=(r,e)=>Vf(r,Qf(e)),Ka=r=>Dr(r,"__esModule",{value:!0});var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),th=(r,e)=>{Ka(r);for(var t in e)Dr(r,t,{get:e[t],enumerable:!0})},rh=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xf(e))!Ha.call(r,n)&&n!=="default"&&Dr(r,n,{get:()=>e[n],enumerable:!(t=Zf(e,n))||t.enumerable});return r},Le=r=>rh(Ka(Dr(r!=null?Kf(Jf(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 wo=p((Iv,An)=>{var ro,no,io,so,ao,oo,uo,lo,co,On,Oi,fo,ho,Xt,po,mo,yo,go,_o,To,bo,vo,Do;(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 An=="object"&&typeof An.exports=="object"?r(t(e,t(An.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])};ro=function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},no=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},io=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},so=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},ao=function(t,n){return function(i,s){n(i,s,t)}},oo=function(t,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,n)},uo=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())})},lo=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]
`),{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(`
`))});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 Pn=["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(Pn.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=Pn[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},Ye=function(r){return typeof r=="number"},Mi=function(r){return Pn.indexOf(r)>=0},Te=Array.isArray,je=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(Te(r))for(;t<e;t++)n[t]=[].concat(r);else for(;t<e;t++)n[t]=r;return n},eo=function(r){return Te(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 to=function(r,e,t){var n=r.split(e);return t?n.slice(0,t).concat([n.slice(t).join(e)]):n},we=function(r,e){var t=r%e;return t*e<0?t+e:t},Mn=function(r,e){return{div:Math.floor(r/e),mod:we(r,e)}},Ue=function(r){return!Z(r)||r.length===0},oe=function(r){return!Ue(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 P=_t;var ah=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(hh).filter(function(t){return t!==null});return Ae(Ae({},e[0]),e[1])}function Mr(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=P.untilStringToDate(s),e}function hh(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return No(r);var t=e[0],n=e[1];switch(n.toUpperCase()){case"RRULE":case"EXRULE":return No(r);case"DTSTART":return Mr(r);default:throw new Error("Unsupported RFC prop "+n+" in "+r)}}function No(r){var e=r.replace(/^RRULE:/i,""),t=Mr(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=S[o.toUpperCase()];break;case"WKST":t.wkst=Be[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=ph(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=mh(o);break;case"DTSTART":case"TZID":var d=Mr(r);t.tzid=d.tzid,t.dtstart=d.dtstart;break;case"UNTIL":t.until=P.untilStringToDate(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function ph(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(So)}return So(r)}function So(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function mh(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Be[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/),i=Number(n[1]),s=n[2],a=Be[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=P.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 Or(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(Rr),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)||Te(o)&&!o.length)){switch(a){case"FREQ":u=D.FREQUENCIES[r.freq];break;case"WKST":Ye(o)?u=new le(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=eo(o).map(function(h){return h instanceof le?h:Te(h)?new le(h[0],h[1]):new le(h)}).toString();break;case"DTSTART":t=yh(o,r.tzid);break;case"UNTIL":u=P.timeToUntilString(o,!r.tzid);break;default:if(Te(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 yh(r,e){return r?"DTSTART"+new Yt(new Date(r),e).toString():""}function gh(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 Io=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?P.clone(t):P.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(!gh(t[f],d[f]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(Te(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 Te(n)?P.cloneDates(n):n instanceof Date?P.clone(n):n},r}();var Fo=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)),Wo=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)),_h=je(1,29),Th=je(1,30),Tt=je(1,31),Ee=je(1,32),Lo=Wt(Ee,Th,Ee,Tt,Ee,Tt,Ee,Ee,Tt,Ee,Tt,Ee,Ee.slice(0,7)),Yo=Wt(Ee,_h,Ee,Tt,Ee,Tt,Ee,Ee,Tt,Ee,Tt,Ee,Ee.slice(0,7)),bh=je(-28,0),vh=je(-29,0),bt=je(-30,0),ke=je(-31,0),Uo=Wt(ke,vh,ke,bt,ke,bt,ke,ke,bt,ke,bt,ke,ke.slice(0,7)),qo=Wt(ke,bh,ke,bt,ke,bt,ke,ke,bt,ke,bt,ke,ke.slice(0,7)),$o=[0,31,60,91,121,152,182,213,244,274,305,335,366],jo=[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(je(7));return r}();function Bo(r,e){var t=new Date(Date.UTC(r,0,1)),n=P.isLeapYear(r)?366:365,i=P.isLeapYear(r+1)?366:365,s=P.toOrdinal(t),a=P.getWeekday(t),o=Ae(Ae({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},Dh(r)),{wnomask:null});if(Ue(e.byweekno))return o;o.wnomask=W(0,n+7);var u,l,d=u=we(7-a+e.wkst,7);d>=4?(d=0,l=o.yearlen+we(a-e.wkst,7)):l=n-d;for(var c=Math.floor(l/7),f=we(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=P.getWeekday(new Date(Date.UTC(r-1,0,1))),j=we(7-J.valueOf()+e.wkst,7),V=P.isLeapYear(r-1)?366:365,re=void 0;j>=4?(j=0,re=V+we(J-e.wkst,7)):re=n-d,K=Math.floor(52+we(re,7)/4)}if(L(e.byweekno,K))for(var b=0;b<d;b++)o.wnomask[b]=1}return o}function Dh(r){var e=P.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=P.getWeekday(t);return e===365?{mmask:Fo,mdaymask:Yo,nmdaymask:qo,wdaymask:Ci.slice(n),mrange:jo}:{mmask:Wo,mdaymask:Lo,nmdaymask:Uo,wdaymask:Ci.slice(n),mrange:$o}}function Go(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===D.YEARLY)if(Ue(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===D.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Ue(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-=we(i[h]-g,7)):(h=d+(b-1)*7,h+=we(7-i[h]+g,7)),d<=h&&h<=c&&(a.nwdaymask[h]=1)}return a}function Ho(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 wh=function(){function r(e){this.options=e}return r.prototype.rebuild=function(e,t){var n=this.options;if(e!==this.lastyear&&(this.yearinfo=Bo(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 Nh(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Xo(r,e){return Nh(e),r.split(",").map(function(t){return P.untilStringToDate(t)})}function Jo(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 Si=function(r){Jt(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=Jo.apply(n,["dtstart"]),n.tzid=Jo.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return Zo(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){eu(t,this._rrule)},e.prototype.exrule=function(t){eu(t,this._exrule)},e.prototype.rdate=function(t){tu(t,this._rdate)},e.prototype.exdate=function(t){tu(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return Cn(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return Cn(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(Or({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(ru("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(ru("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}(D);function eu(r,e){if(!(r instanceof D))throw new TypeError(String(r)+" is not RRule instance");L(e.map(String),String(r))||e.push(r)}function tu(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");L(e.map(Number),Number(r))||(e.push(r),P.sort(e))}function ru(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?r+":":r+";TZID="+t+":",s=e.map(function(a){return P.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=D.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 D(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 D(It(We({},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}},Dt=lt;Dt.dueCoefficient=12,Dt.scheduledCoefficient=5,Dt.startedCoefficient=-3,Dt.priorityCoefficient=6,Dt.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=Le(require("obsidian"));var Yf=Le(require("obsidian"));function rr(){}function Fi(r){return r()}function iu(){return Object.create(null)}function qt(r){r.forEach(Fi)}function su(r){return typeof r=="function"}function au(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function ou(r){return Object.keys(r).length===0}var C1=new Set;var uu=!1;function Sh(){uu=!0}function Ih(){uu=!1}function _(r,e){r.appendChild(e)}function Wi(r,e,t){r.insertBefore(e,t||null)}function Sn(r){r.parentNode.removeChild(r)}function A(r){return document.createElement(r)}function Fh(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function ct(r){return document.createTextNode(r)}function Q(){return ct(" ")}function wt(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function lu(r){return function(e){return e.preventDefault(),r.call(this,e)}}function I(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Wh(r){return Array.from(r.childNodes)}function cu(r,e){e=""+e,r.wholeText!==e&&(r.data=e)}function Ke(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 du(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=Fh(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(Sn)}};var N1=new Map;var Ar;function xr(r){Ar=r}function Lh(){if(!Ar)throw new Error("Function called outside component initialization");return Ar}function Yi(r){Lh().$$.on_mount.push(r)}var Cr=[];var In=[],Fn=[],fu=[],Yh=Promise.resolve(),Ui=!1;function Uh(){Ui||(Ui=!0,Yh.then(hu))}function Nr(r){Fn.push(r)}var qi=new Set,Wn=0;function hu(){let r=Ar;do{for(;Wn<Cr.length;){let e=Cr[Wn];Wn++,xr(e),qh(e.$$)}for(xr(null),Cr.length=0,Wn=0;In.length;)In.pop()();for(let e=0;e<Fn.length;e+=1){let t=Fn[e];qi.has(t)||(qi.add(t),t())}Fn.length=0}while(Cr.length);for(;fu.length;)fu.pop()();Ui=!1,qi.clear(),xr(r)}function qh(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(Nr)}}var $h=new Set;function jh(r,e){r&&r.i&&($h.delete(r),r.i(e))}var S1=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var I1=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 Bh(r,e,t,n){let{fragment:i,on_mount:s,on_destroy:a,after_update:o}=r.$$;i&&i.m(e,t),n||Nr(()=>{let u=s.map(Fi).filter(su);a?a.push(...u):qt(u),r
`),St=A("input"),Wa=Q(),bi=A("code"),vi=ct(Dn),La=Q(),wn=A("div"),Ya=ct(`Done on:
`),En=A("code"),Ua=Q(),qa=A("hr"),$a=Q(),Di=A("div"),ja=Q(),kn=A("div"),kn.innerHTML='<button type="submit" class="mod-cta">Apply</button>',I(i,"for","description"),I(a,"id","description"),I(a,"type","text"),I(a,"class","tasks-modal-description"),I(a,"placeholder","Take out the trash"),I(n,"class","tasks-modal-section"),I(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,I(h,"id","priority"),I(h,"class","dropdown"),r[0].priority===void 0&&Nr(()=>r[14].call(h)),I(d,"class","tasks-modal-section"),I(re,"for","recurrence"),I(R,"id","description"),I(R,"type","text"),I(R,"placeholder","Try 'every 2 weeks on Thursday'."),v.a=null,I(V,"class","tasks-modal-section"),I(G,"for","due"),I(q,"id","due"),I(q,"type","text"),I(q,"placeholder",sa),tt.a=null,I(M,"class","tasks-modal-date"),I(fe,"for","scheduled"),I(Fe,"id","scheduled"),I(Fe,"type","text"),I(Fe,"placeholder",sa),gn.a=null,I(Me,"class","tasks-modal-date"),I(_n,"for","start"),I(at,"id","start"),I(at,"type","text"),I(at,"placeholder",sa),bn.a=null,I(gt,"class","tasks-modal-date"),I(k,"class","tasks-modal-section"),I(St,"type","checkbox"),I(St,"class","task-list-item-checkbox tasks-modal-checkbox"),St.checked=vn=r[0].status===ue.Done,St.disabled=!0,I(Vt,"class","tasks-modal-section"),I(Di,"class","tasks-modal-section"),I(kn,"class","tasks-modal-section"),I(e,"class","tasks-modal")},m(ie,Oe){Wi(ie,e,Oe),_(e,t),_(t,n),_(n,i),_(n,s),_(n,a),Ke(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,R),Ke(R,r[0].recurrenceRule),_(V,ne),_(V,Ce),_(Ce,w),v.m(r[5],Ce),_(t,y),_(t,E),_(t,T),_(t,k),_(k,M),_(M,G),_(M,ee),_(M,q),Ke(q,r[0].dueDate),_(M,de),_(M,Ie),_(Ie,$e),tt.m(r[4],Ie),_(k,yt),_(k,Me),_(Me,fe),_(Me,ze),_(Me,Fe),Ke(Fe,r[0].scheduledDate),_(Me,Nt),_(Me,yn),_(yn,Ma),gn.m(r[3],yn),_(k,Oa),_(k,gt),_(gt,_n),_(gt,Aa),_(gt,at),Ke(at,r[0].startDate),_(gt,xa),_(gt,Tn),_(Tn,Ca),bn.m(r[2],Tn),_(t,Na),_(t,Sa),_(t,Ia),_(t,Vt),_(Vt,Zt),_(Zt,Fa),_(Zt,St),_(Zt,Wa),_(Zt,bi),_(bi,vi),_(Vt,La),_(Vt,wn),_(wn,Ya),_(wn,En),En.innerHTML=r[6],_(t,Ua),_(t,qa),_(t,$a),_(t,Di),_(t,ja),_(t,kn),wi||(Ba=[wt(a,"input",r[12]),wt(h,"change",r[14]),wt(R,"input",r[15]),wt(q,"input",r[16]),wt(Fe,"input",r[17]),wt(at,"input",r[18]),wt(t,"submit",lu(r[7]))],wi=!0)},p(ie,[Oe]){Oe&1&&a.value!==ie[0].description&&Ke(a,ie[0].description),Oe&1&&Li(h,ie[0].priority),Oe&1&&R.value!==ie[0].recurrenceRule&&Ke(R,ie[0].recurrenceRule),Oe&32&&v.p(ie[5]),Oe&1&&q.value!==ie[0].dueDate&&Ke(q,ie[0].dueDate),Oe&16&&tt.p(ie[4]),Oe&1&&Fe.value!==ie[0].scheduledDate&&Ke(Fe,ie[0].scheduledDate),Oe&8&&gn.p(ie[3]),Oe&1&&at.value!==ie[0].startDate&&Ke(at,ie[0].startDate),Oe&4&&bn.p(ie[2]),Oe&1&&vn!==(vn=ie[0].status===ue.Done)&&(St.checked=vn),Oe&1&&Dn!==(Dn=ie[0].status+"")&&cu(vi,Dn),Oe&64&&(En.innerHTML=ie[6])},i:rr,o:rr,d(ie){ie&&Sn(e),r[13](null),wi=!1,qt(Ba)}}}var sa="Try 'Monday' or 'tomorrow', or [td|tm|yd|tw|nw|we] then space.";function hv(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,R,ne=void 0){if(!R)return`<i>no ${x} date</i>`;let Ce=cn.default.parseDate(R,ne,{forwardDate:ne!=null});return Ce!==null?window.moment(Ce).format("YYYY-MM-DD"):`<i>invalid ${x} date</i>`}Yi(()=>{let{globalFilter:x}=se(),R=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:R,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 dn({app:n,task:u,onSubmit:l}).open()},pv=({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=Le(require("obsidian"));var qf=(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=mv({line:a,path:n});e.setLine(s,o),/[^ [\]*-]/.test(o)&&e.setCursor({line:i.line,ch:i.ch+o.length-a.length})},mv=({line:r,path:e})=>{let t=r,n=H.fromLine({line:r,path:e,sectionStart:0,sectionIndex:0,precedingHeader:null});if(n!==null)t=yv({task:n});else{let i=r.match(H.taskRegex);if(i!==null)t=gv({regexMatch:i});else{let s=/^([\s\t]*)([-*])/;s.test(r)?t=r.replace(s,"$1$2 [ ]"):t=r.replace(/^([\s\t]*)/,"$1- ")}}return t},yv=({task:r})=>r.toggle().map(n=>n.toFileLineString()).join(`
`),gv=({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)=>Uf(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:qf})}};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(`
`);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(`
`),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 $f=Le(require("@codemirror/view"));var jf=()=>$f.ViewPlugin.fromClass(Bf),Bf=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 Hf=Le(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 he=class{static by(e,t){return new ya(e,t)}static getGroupersForAllQueryGroupings(e){let t=[];for(let{property:n}of e){let i=he.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 he.groupers[e](t)}static groupByStartDate(e){return he.groupByDate(e.startDate,"start")}static groupByScheduledDate(e){return he.groupByDate(e.scheduledDate,"scheduled")}static groupByDueDate(e){return he.groupByDate(e.dueDate,"due")}static groupByDoneDate(e){return he.groupByDate(e.doneDate,"done")}static groupByDate(e,t){return e===null?"No "+t+" date":e.format(he.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=he;Ct.groupDateFormat="YYYY-MM-DD dddd",Ct.groupers={backlink:he.groupByBacklink,done:he.groupByDoneDate,due:he.groupByDueDate,filename:he.groupByFileName,folder:he.groupByFolder,heading:he.groupByHeading,path:he.groupByPath,scheduled:he.groupByScheduledDate,start:he.groupByStartDate,status:he.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}},fn=U;fn.tagPropertyInstance=1,fn.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 t===this.doneString:this._filters.push(n=>n.status===ue.Done);break;case t===this.notDoneString:this._filters.push(n=>n.status!==ue.Done);break;case t===this.recurringString:this._filters.push(n=>n.recurrence!==null);break;case t===this.notRecurringString:this._filters.push(n=>n.recurrence===null);break;case t===this.excludeSubItemsString:this._filters.push(n=>n.indentation==="");break;case t===this.noStartString:this._filters.push(n=>n.startDate===null);break;case t===this.noScheduledString:this._filters.push(n=>n.scheduledDate===null);break;case t===this.noDueString:this._filters.push(n=>n.dueDate===null);break;case t===this.hasStartString:this._filters.push(n=>n.startDate!==null);break;case t===this.hasScheduledString:this._filters.push(n=>n.scheduledDate!==null);break;case t===this.hasDueString:this._filters.push(n=>n.dueDate!==null);break;case this.shortModeRegexp.test(t):this._layoutOptions.shortMode=!0;break;case this.parseFilter(t,new yi):break;case this.parseFilter(t,new br):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 Tr):break;case this.parseFilter(t,new mi):break;case this.parseFilter(t,new fi):break;case this.parseFilter(t,new Ti):break;case this.parseFilter(t,new pi):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=fn.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 ka=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 mn({app:this.app,events:this.events,container:t,source:e}))})}},mn=class extends Hf.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 pn({source:i}),this.queryType="tasks";break;default:this.query=new
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.
***************************************************************************** */