From cdc2cc102a34b893644dd96a147e4074c7c73195 Mon Sep 17 00:00:00 2001 From: linyibing Date: Wed, 13 Mar 2024 23:05:40 +0800 Subject: [PATCH] feat: update plugin version to 1.12.0 --- .obsidian/plugins/obsidian-tasks-plugin/main.js | 10 +++++----- .../plugins/obsidian-tasks-plugin/manifest.json | 2 +- .obsidian/plugins/periodic-para/main.js | 12 ++++++------ .obsidian/plugins/periodic-para/manifest.json | 6 +++--- .obsidian/workspace.json | 14 +++++++------- README.md | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.obsidian/plugins/obsidian-tasks-plugin/main.js b/.obsidian/plugins/obsidian-tasks-plugin/main.js index c5a2089..b25ec1f 100644 --- a/.obsidian/plugins/obsidian-tasks-plugin/main.js +++ b/.obsidian/plugins/obsidian-tasks-plugin/main.js @@ -146,7 +146,7 @@ ${i.join(` linkStyle default stroke:gray \`\`\` -`}addEdgeIfNotToInternal(e,t,n,s,i){let a=e.findIndex(l=>l.symbol===t.symbol),o=a!==-1,u=t.type!=="EMPTY";if(o&&u){let l;i?l='-. "\u{1F501}" .-> ':l=" --> ";let c=`${s+1}${l}${a+1}`;n.push(c)}}getMermaidNodeLabel(e,t){let n=Tv(e.name),s=e.type;if(t){let i=al(e.symbol),a=al(e.nextStatusSymbol),o=`[${i}] -> [${a}]`,u=`'${n}'`,l=`(${s})`;return`["${u}
${o}
${l}"]:::${s}`}else return`["${n}"]:::${s}`}};var _v=require("obsidian");var Qr=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var ze=class{constructor(e){this._date=null;this._date=e}get moment(){return this._date}formatAsDate(e=""){return this.format(Z.dateFormat,e)}formatAsDateAndTime(e=""){return this.format(Z.dateTimeFormat,e)}format(e,t=""){return this._date?this._date.format(e):t}toISOString(e){return this._date?this._date.toISOString(e):""}get category(){let e=window.moment(),t=this.moment;return t?t.isBefore(e,"day")?new Qr("Overdue",1):t.isSame(e,"day")?new Qr("Today",2):t.isValid()?new Qr("Future",3):new Qr("Invalid date",0):new Qr("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new Qr("",0);let t=this.fromNowOrder(e);return new Qr(e.fromNow(),t)}fromNowOrder(e){if(!e.isValid())return 0;let t=window.moment(),n=e.isSameOrBefore(t,"day"),s=this.fromNowStartDateOfGroup(e,n,t);return Number((n?1:3)+s.format("YYYYMMDD"))}fromNowStartDateOfGroup(e,t,n){let s=e.fromNow(!0).split(" "),i,a=Number(s[0]);isNaN(a)?i=1:i=a;let o=s[1];return t?n.subtract(i,o):n.add(i,o)}postpone(e="days",t=1){if(!this._date)throw new _v.Notice("Cannot postpone a null date");let n=window.moment().startOf("day");return this._date.isSameOrAfter(n,"day")?this._date.clone().add(t,e):n.add(t,e)}};var wi=class{constructor(e){this._path=e}get path(){return this._path}get pathWithoutExtension(){return this.withoutExtension(this.path)}withoutExtension(e){return e.replace(/\.md$/,"")}get root(){let e=this.path.replace(/\\/g,"/");e.charAt(0)==="/"&&(e=e.substring(1));let t=e.indexOf("/");return t==-1?"/":e.substring(0,t+1)}get folder(){let e=this.path,t=this.filename,n=e.substring(0,e.lastIndexOf(t));return n===""?"/":n}get filename(){let e=this.path.match(/([^/]+)$/);return e!==null?e[1]:""}get filenameWithoutExtension(){return this.withoutExtension(this.filename)}};var Sn=class{static priorityNameUsingNone(e){let t="ERROR";switch(e){case"1":t="High";break;case"0":t="Highest";break;case"2":t="Medium";break;case"3":t="None";break;case"4":t="Low";break;case"5":t="Lowest";break}return t}static priorityNameUsingNormal(e){return Sn.priorityNameUsingNone(e).replace("None","Normal")}};var VP=require("obsidian"),Ev=ua(kv());var Mm=class extends Ev.EventEmitter2{constructor(){super(...arguments);this.options={minLevels:{"":"info",tasks:"info"}};this.consoleLoggerRegistered=!1;this.arrAvg=t=>t.reduce((n,s)=>n+s,0)/t.length}configure(t){return this.options=Object.assign({},this.options,t),this}getLogger(t){let n="none",s="";for(let i in this.options.minLevels)t.startsWith(i)&&i.length>=s.length&&(n=this.options.minLevels[i],s=i);return new Cm(this,t,n)}onLogEntry(t){return this.on("log",t),this}registerConsoleLogger(){return this.consoleLoggerRegistered?this:(this.onLogEntry(t=>{let n=`[${window.moment().format("YYYY-MM-DD-HH:mm:ss.SSS")}][${t.level}][${t.module}]`;switch(t.traceId&&(n+=`[${t.traceId}]`),n+=` ${t.message}`,t.objects===void 0&&(t.objects=""),t.level){case"trace":console.trace(n,t.objects);break;case"debug":console.debug(n,t.objects);break;case"info":console.info(n,t.objects);break;case"warn":console.warn(n,t.objects);break;case"error":console.error(n,t.objects);break;default:console.log(`{${t.level}} ${n}`,t.objects)}}),this.consoleLoggerRegistered=!0,this)}},Ft=new Mm,Cm=class{constructor(e,t,n){this.levels={trace:1,debug:2,info:3,warn:4,error:5};this.logManager=e,this.module=t,this.minLevel=this.levelToInt(n)}levelToInt(e){return e.toLowerCase()in this.levels?this.levels[e.toLowerCase()]:99}log(e,t,n){if(this.levelToInt(e){r.debug(`${e} ==> ${s+1} : ${n.toFileLineString()}`)})}var Dt=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=ee();return!t||!this.matchesAnyFolder(n,e)?null:this.extractDateFromPath(e)}static matchesAnyFolder(e,t){return e.length===0?!0:e.some(n=>t.startsWith(n+"/"))}static extractDateFromPath(e){let t=Math.max(0,e.lastIndexOf("/")+1),n=e.lastIndexOf("."),s=e.substring(t,n),i=/(\d{4})-(\d{2})-(\d{2})/.exec(s);if(i||(i=/(\d{4})(\d{2})(\d{2})/.exec(s)),i){let a=window.moment([parseInt(i[1]),parseInt(i[2])-1,parseInt(i[3])]);if(a.isValid())return a}return null}static canApplyFallback({startDate:e,scheduledDate:t,dueDate:n}){return e===null&&n===null&&t===null}static updateTaskPath(e,t,n){let s=e.scheduledDate,i=e.scheduledDateIsInferred;return n===null?i&&(i=!1,s=null):i?s=n:this.canApplyFallback(e)&&(s=n,i=!0),new oe(be(X({},e),{taskLocation:e.taskLocation.fromRenamedFile(t),scheduledDate:s,scheduledDateIsInferred:i}))}static removeInferredStatusIfNeeded(e,t){let n=e.scheduledDateIsInferred?e.scheduledDate:null;return t.map(s=>(n!==null&&!n.isSame(s.scheduledDate,"day")&&(s=new oe(be(X({},s),{scheduledDateIsInferred:!1}))),s))}};var Ar=class{static calculate(e){var n,s,i;let t=0;if((n=e.dueDate)!=null&&n.isValid()){let a=window.moment().startOf("day"),o=Math.round(a.diff(e.dueDate)/Ar.milliSecondsPerDay),u;o>=7?u=1:o>=-14?u=(o+14)*.8/21+.2:u=.2,t+=u*Ar.dueCoefficient}switch((s=e.scheduledDate)!=null&&s.isValid()&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*Ar.scheduledCoefficient),(i=e.startDate)!=null&&i.isValid()&&window.moment().isBefore(e.startDate)&&(t+=1*Ar.startedCoefficient),e.priority){case"0":t+=1.5*Ar.priorityCoefficient;break;case"1":t+=1*Ar.priorityCoefficient;break;case"2":t+=.65*Ar.priorityCoefficient;break;case"3":t+=.325*Ar.priorityCoefficient;break;case"5":t-=.3*Ar.priorityCoefficient;break}return t}},On=Ar;On.dueCoefficient=12,On.scheduledCoefficient=5,On.startedCoefficient=-3,On.priorityCoefficient=6,On.milliSecondsPerDay=1e3*60*60*24;var oe=class{constructor({status:e,description:t,taskLocation:n,indentation:s,listMarker:i,priority:a,createdDate:o,startDate:u,scheduledDate:l,dueDate:c,doneDate:f,cancelledDate:p,recurrence:m,dependsOn:_,id:g,blockLink:E,tags:C,originalMarkdown:R,scheduledDateIsInferred:b}){this._urgency=null;this.status=e,this.description=t,this.indentation=s,this.listMarker=i,this.taskLocation=n,this.tags=C,this.priority=a,this.createdDate=o,this.startDate=u,this.scheduledDate=l,this.dueDate=c,this.doneDate=f,this.cancelledDate=p,this.recurrence=m,this.dependsOn=_,this.id=g,this.blockLink=E,this.originalMarkdown=R,this.scheduledDateIsInferred=b}static fromLine({line:e,taskLocation:t,fallbackDate:n}){let s=oe.extractTaskComponents(e);return s===null||!ye.getInstance().includedIn(s.body)?null:oe.parseTaskSignifiers(e,t,n)}static parseTaskSignifiers(e,t,n){let s=oe.extractTaskComponents(e);if(s===null)return null;let{taskSerializer:i}=To(),a=i.deserialize(s.body),o=!1;return Dt.canApplyFallback(a)&&n!==null&&(a.scheduledDate=n,o=!0),a.tags=a.tags.map(u=>u.trim()),a.tags=a.tags.filter(u=>!ye.getInstance().equals(u)),new oe(be(X(X({},s),a),{taskLocation:t,originalMarkdown:e,scheduledDateIsInferred:o}))}static extractTaskComponents(e){let t=e.match(Z.taskRegex);if(t===null)return null;let n=t[1],s=t[2],i=t[3],a=Oe.getInstance().bySymbolOrCreate(i),o=t[4].trim(),u=o.match(Z.blockLinkRegex),l=u!==null?u[0]:"";return l!==""&&(o=o.replace(Z.blockLinkRegex,"").trim()),{indentation:n,listMarker:s,status:a,body:o,blockLink:l}}toString(){return To().taskSerializer.serialize(this)}toFileLineString(){return`${this.indentation}${this.listMarker} [${this.status.symbol}] ${this.toString()}`}toggle(){let e=Ft.getLogger("tasks.Task"),t="toggle()";ol(e,t,this);let n=Oe.getInstance().getNextStatusOrCreate(this.status),s=this.handleNewStatus(n);return ul(e,t,s),s}handleNewStatus(e,t=window.moment()){if(e.identicalTo(this.status))return[this];let{setDoneDate:n}=ee(),s=this.newDate(e,"DONE",this.doneDate,n,t),{setCancelledDate:i}=ee(),a=this.newDate(e,"CANCELLED",this.cancelledDate,i,t),o=null;e.isCompleted()&&!this.status.isCompleted()&&this.recurrence!==null&&(o=this.recurrence.next(t));let u=new oe(be(X({},this),{status:e,doneDate:s,cancelledDate:a})),l=[];if(o!==null){let c=this.createNextOccurrence(e,o);l.push(c)}return l.push(u),l}newDate(e,t,n,s,i){let a=null;return e.type===t&&(this.status.type!==t?s&&(a=i):a=n),a}createNextOccurrence(e,t){let{setCreatedDate:n}=ee(),s=null;n&&(s=window.moment());let i=null,a=null,u=Oe.getInstance().getNextRecurrenceStatusOrCreate(e);return new oe(be(X(X({},this),t),{status:u,blockLink:"",id:"",dependsOn:[],createdDate:s,cancelledDate:i,doneDate:a}))}toggleWithRecurrenceInUsersOrder(){let e=this.toggle();return this.putRecurrenceInUsersOrder(e)}handleNewStatusWithRecurrenceInUsersOrder(e,t=window.moment()){Ft.getLogger("tasks.Task").debug(`changed task ${this.taskLocation.path} ${this.taskLocation.lineNumber} ${this.originalMarkdown} status to '${e.symbol}'`);let s=this.handleNewStatus(e,t);return this.putRecurrenceInUsersOrder(s)}putRecurrenceInUsersOrder(e){let{recurrenceOnNextLine:t}=ee();return t?e.reverse():e}get isDone(){return this.status.type==="DONE"||this.status.type==="CANCELLED"||this.status.type==="NON_TASK"}isBlocked(e){if(this.dependsOn.length===0||this.isDone)return!1;for(let t of this.dependsOn)if(!!e.find(s=>s.id===t&&!s.isDone))return!0;return!1}isBlocking(e){return this.id===""||this.isDone?!1:e.some(t=>t.isDone?!1:t.dependsOn.includes(this.id))}get priorityNumber(){return Number.parseInt(this.priority)}get priorityNameGroupText(){let e=Sn.priorityNameUsingNormal(this.priority);return`%%${this.priority}%%${e} priority`}get descriptionWithoutTags(){return this.description.replace(Z.hashTags,"").trim()}get priorityName(){return Sn.priorityNameUsingNormal(this.priority)}get urgency(){return this._urgency===null&&(this._urgency=On.calculate(this)),this._urgency}get path(){return this.taskLocation.path}get cancelled(){return new ze(this.cancelledDate)}get created(){return new ze(this.createdDate)}get done(){return new ze(this.doneDate)}get due(){return new ze(this.dueDate)}get scheduled(){return new ze(this.scheduledDate)}get start(){return new ze(this.startDate)}get happensDates(){return Array.of(this.startDate,this.scheduledDate,this.dueDate)}get happens(){let e=this.happensDates,t=Array.from(e).sort(_r);for(let n of t)if(n!=null&&n.isValid())return new ze(n);return new ze(null)}get isRecurring(){return this.recurrence!==null}get recurrenceRule(){return this.recurrence?this.recurrence.toText():""}get heading(){return this.precedingHeader}get hasHeading(){return this.precedingHeader!==null}get file(){return new wi(this.path)}get filename(){let e=this.path.match(/([^/]+)\.md$/);return e!==null?e[1]:null}get lineNumber(){return this.taskLocation.lineNumber}get sectionStart(){return this.taskLocation.sectionStart}get sectionIndex(){return this.taskLocation.sectionIndex}get precedingHeader(){return this.taskLocation.precedingHeader}getLinkText({isFilenameUnique:e}){let t;return e?t=this.filename:t="/"+this.path,t===null?null:(this.precedingHeader!==null&&this.precedingHeader!==t&&(t=t+" > "+this.precedingHeader),t)}static tasksListsIdentical(e,t){return e.length!==t.length?!1:e.every((n,s)=>n.identicalTo(t[s]))}identicalTo(e){var i,a;let t=["description","path","indentation","listMarker","lineNumber","sectionStart","sectionIndex","precedingHeader","priority","blockLink","scheduledDateIsInferred","id","dependsOn"];for(let o of t)if(((i=this[o])==null?void 0:i.toString())!==((a=e[o])==null?void 0:a.toString()))return!1;if(!this.status.identicalTo(e.status)||this.tags.length!==e.tags.length||!this.tags.every(function(o,u){return o===e.tags[u]}))return!1;t=oe.allDateFields();for(let o of t){let u=this[o],l=e[o];if(_r(u,l)!==0)return!1}let n=this.recurrence,s=e.recurrence;return n===null&&s!==null||n!==null&&s===null?!1:!(n&&s&&!n.identicalTo(s))}static allDateFields(){return["createdDate","startDate","scheduledDate","dueDate","doneDate","cancelledDate"]}static extractHashtags(e){var t,n;return(n=(t=e.match(Z.hashTags))==null?void 0:t.map(s=>s.trim()))!=null?n:[]}};var _o=class{constructor(e){this.fetch=e;this._value=void 0}get value(){return this._value===void 0&&(this._value=this.fetch()),this._value}};var vt=class{constructor(e,t,n,s,i){this._path=e,this._lineNumber=t,this._sectionStart=n,this._sectionIndex=s,this._precedingHeader=i}static fromUnknownPosition(e){return new vt(e,0,0,0,null)}fromRenamedFile(e){return new vt(e,this.lineNumber,this.sectionStart,this.sectionIndex,this.precedingHeader)}get path(){return this._path}get lineNumber(){return this._lineNumber}get sectionStart(){return this._sectionStart}get sectionIndex(){return this._sectionIndex}get precedingHeader(){return this._precedingHeader}};var Ds=class{constructor({metadataCache:e,vault:t,events:n}){this.logger=Ft.getLogger("tasks.Cache");this.logger.debug("Creating Cache object"),this.metadataCache=e,this.metadataCacheEventReferences=[],this.vault=t,this.vaultEventReferences=[],this.events=n,this.eventsEventReferences=[],this.tasksMutex=new tu,this.state="Cold",this.logger.debug("Cache.constructor(): state = Cold"),this.tasks=[],this.loadedAfterFirstResolve=!1,this.subscribeToCache(),this.subscribeToVault(),this.subscribeToEvents(),this.loadVault()}unload(){this.logger.info("Unloading Cache");for(let e of this.metadataCacheEventReferences)this.metadataCache.offref(e);for(let e of this.vaultEventReferences)this.vault.offref(e);for(let e of this.eventsEventReferences)this.events.off(e)}getTasks(){return this.tasks}getState(){return this.state}notifySubscribers(){this.logger.debug("Cache.notifySubscribers()"),this.events.triggerCacheUpdate({tasks:this.tasks,state:this.state})}subscribeToCache(){this.logger.debug("Cache.subscribeToCache()");let e=this.metadataCache.on("resolved",()=>L(this,null,function*(){this.loadedAfterFirstResolve||(this.loadedAfterFirstResolve=!0,this.loadVault())}));this.metadataCacheEventReferences.push(e);let t=this.metadataCache.on("changed",n=>{this.tasksMutex.runExclusive(()=>{this.indexFile(n)})});this.metadataCacheEventReferences.push(t)}subscribeToVault(){this.logger.debug("Cache.subscribeToVault()");let{useFilenameAsScheduledDate:e}=ee(),t=this.vault.on("create",i=>{i instanceof ki.TFile&&(this.logger.debug(`Cache.subscribeToVault.createdEventReference() ${i.path}`),this.tasksMutex.runExclusive(()=>{this.indexFile(i)}))});this.vaultEventReferences.push(t);let n=this.vault.on("delete",i=>{i instanceof ki.TFile&&(this.logger.debug(`Cache.subscribeToVault.deletedEventReference() ${i.path}`),this.tasksMutex.runExclusive(()=>{this.tasks=this.tasks.filter(a=>a.path!==i.path),this.notifySubscribers()}))});this.vaultEventReferences.push(n);let s=this.vault.on("rename",(i,a)=>{i instanceof ki.TFile&&(this.logger.debug(`Cache.subscribeToVault.renamedEventReference() ${i.path}`),this.tasksMutex.runExclusive(()=>{let o=new _o(()=>Dt.fromPath(i.path));this.tasks=this.tasks.map(u=>u.path===a?e?Dt.updateTaskPath(u,i.path,o.value):new oe(be(X({},u),{taskLocation:u.taskLocation.fromRenamedFile(i.path)})):u),this.notifySubscribers()}))});this.vaultEventReferences.push(s)}subscribeToEvents(){this.logger.debug("Cache.subscribeToEvents()");let e=this.events.onRequestCacheUpdate(t=>{t({tasks:this.tasks,state:this.state})});this.eventsEventReferences.push(e)}loadVault(){return this.logger.debug("Cache.loadVault()"),this.tasksMutex.runExclusive(()=>L(this,null,function*(){this.state="Initializing",this.logger.debug("Cache.loadVault(): state = Initializing"),yield Promise.all(this.vault.getMarkdownFiles().map(e=>this.indexFile(e))),this.state="Warm",this.logger.debug("Cache.loadVault(): state = Warm"),this.notifySubscribers()}))}indexFile(e){return L(this,null,function*(){let t=this.metadataCache.getFileCache(e);if(t==null)return;if(!e.path.endsWith(".md")){this.logger.debug("indexFile: skipping non-markdown file: "+e.path);return}this.logger.debug("Cache.indexFile: "+e.path);let n=this.tasks.filter(a=>a.path===e.path),s=t.listItems,i=[];if(s!==void 0){let a=yield this.vault.cachedRead(e);i=this.getTasksFromFileContent(a,s,t,e)}oe.tasksListsIdentical(n,i)||(this.tasks=this.tasks.filter(a=>a.path!==e.path),this.tasks.push(...i),this.logger.debug("Cache.indexFile: "+e.path+`: read ${i.length} task(s)`),this.notifySubscribers())})}getTasksFromFileContent(e,t,n,s){let i=[],a=e.split(` +`}addEdgeIfNotToInternal(e,t,n,s,i){let a=e.findIndex(l=>l.symbol===t.symbol),o=a!==-1,u=t.type!=="EMPTY";if(o&&u){let l;i?l='-. "\u{1F501}" .-> ':l=" --> ";let c=`${s+1}${l}${a+1}`;n.push(c)}}getMermaidNodeLabel(e,t){let n=Tv(e.name),s=e.type;if(t){let i=al(e.symbol),a=al(e.nextStatusSymbol),o=`[${i}] -> [${a}]`,u=`'${n}'`,l=`(${s})`;return`["${u}
${o}
${l}"]:::${s}`}else return`["${n}"]:::${s}`}};var _v=require("obsidian");var Qr=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var ze=class{constructor(e){this._date=null;this._date=e}get moment(){return this._date}formatAsDate(e=""){return this.format(Z.dateFormat,e)}formatAsDateAndTime(e=""){return this.format(Z.dateTimeFormat,e)}format(e,t=""){return this._date?this._date.format(e):t}toISOString(e){return this._date?this._date.toISOString(e):""}get category(){let e=window.moment(),t=this.moment;return t?t.isBefore(e,"day")?new Qr("Overdue",1):t.isSame(e,"day")?new Qr("Today",2):t.isValid()?new Qr("Future",3):new Qr("Invalid date",0):new Qr("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new Qr("",0);let t=this.fromNowOrder(e);return new Qr(e.fromNow(),t)}fromNowOrder(e){if(!e.isValid())return 0;let t=window.moment(),n=e.isSameOrBefore(t,"day"),s=this.fromNowStartDateOfGroup(e,n,t);return Number((n?1:3)+s.format("YYYYMMDD"))}fromNowStartDateOfGroup(e,t,n){let s=e.fromNow(!0).split(" "),i,a=Number(s[0]);isNaN(a)?i=1:i=a;let o=s[1];return t?n.subtract(i,o):n.add(i,o)}postpone(e="days",t=1){if(!this._date)throw new _v.Notice("Cannot postpone a null date");let n=window.moment().startOf("day");return this._date.isSameOrAfter(n,"day")?this._date.clone().add(t,e):n.add(t,e)}};var wi=class{constructor(e){this._path=e}get path(){return this._path}get pathWithoutExtension(){return this.withoutExtension(this.path)}withoutExtension(e){return e.replace(/\.md$/,"")}get root(){let e=this.path.replace(/\\/g,"/");e.charAt(0)==="/"&&(e=e.substring(1));let t=e.indexOf("/");return t==-1?"/":e.substring(0,t+1)}get folder(){let e=this.path,t=this.filename,n=e.substring(0,e.lastIndexOf(t));return n===""?"/":n}get filename(){let e=this.path.match(/([^/]+)$/);return e!==null?e[1]:""}get filenameWithoutExtension(){return this.withoutExtension(this.filename)}};var Sn=class{static priorityNameUsingNone(e){let t="ERROR";switch(e){case"1":t="High";break;case"0":t="Highest";break;case"2":t="Medium";break;case"3":t="None";break;case"4":t="Low";break;case"5":t="Lowest";break}return t}static priorityNameUsingNormal(e){return Sn.priorityNameUsingNone(e).replace("None","Normal")}};var VP=require("obsidian"),Ev=ua(kv());var Mm=class extends Ev.EventEmitter2{constructor(){super(...arguments);this.options={minLevels:{"":"info",tasks:"info"}};this.consoleLoggerRegistered=!1;this.arrAvg=t=>t.reduce((n,s)=>n+s,0)/t.length}configure(t){return this.options=Object.assign({},this.options,t),this}getLogger(t){let n="none",s="";for(let i in this.options.minLevels)t.startsWith(i)&&i.length>=s.length&&(n=this.options.minLevels[i],s=i);return new Cm(this,t,n)}onLogEntry(t){return this.on("log",t),this}registerConsoleLogger(){return this.consoleLoggerRegistered?this:(this.onLogEntry(t=>{let n=`[${window.moment().format("YYYY-MM-DD-HH:mm:ss.SSS")}][${t.level}][${t.module}]`;switch(t.traceId&&(n+=`[${t.traceId}]`),n+=` ${t.message}`,t.objects===void 0&&(t.objects=""),t.level){case"trace":console.trace(n,t.objects);break;case"debug":console.debug(n,t.objects);break;case"info":console.info(n,t.objects);break;case"warn":console.warn(n,t.objects);break;case"error":console.error(n,t.objects);break;default:console.log(`{${t.level}} ${n}`,t.objects)}}),this.consoleLoggerRegistered=!0,this)}},Ft=new Mm,Cm=class{constructor(e,t,n){this.levels={trace:1,debug:2,info:3,warn:4,error:5};this.logManager=e,this.module=t,this.minLevel=this.levelToInt(n)}levelToInt(e){return e.toLowerCase()in this.levels?this.levels[e.toLowerCase()]:99}log(e,t,n){if(this.levelToInt(e){r.debug(`${e} ==> ${s+1} : ${n.toFileLineString()}`)})}var Dt=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=ee();return!t||!this.matchesAnyFolder(n,e)?null:this.extractDateFromPath(e)}static matchesAnyFolder(e,t){return e.length===0?!0:e.some(n=>t.startsWith(n+"/"))}static extractDateFromPath(e){let t=Math.max(0,e.lastIndexOf("/")+1),n=e.lastIndexOf("."),s=e.substring(t,n),i=/(\d{4})-(\d{2})-(\d{2})/.exec(s);if(i||(i=/(\d{4})(\d{2})(\d{2})/.exec(s)),i){let a=window.moment([parseInt(i[1]),parseInt(i[2])-1,parseInt(i[3])]);if(a.isValid())return a}return null}static canApplyFallback({startDate:e,scheduledDate:t,dueDate:n}){return e===null&&n===null&&t===null}static updateTaskPath(e,t,n){let s=e.scheduledDate,i=e.scheduledDateIsInferred;return n===null?i&&(i=!1,s=null):i?s=n:this.canApplyFallback(e)&&(s=n,i=!0),new oe(be(X({},e),{taskLocation:e.taskLocation.fromRenamedFile(t),scheduledDate:s,scheduledDateIsInferred:i}))}static removeInferredStatusIfNeeded(e,t){let n=e.scheduledDateIsInferred?e.scheduledDate:null;return t.map(s=>(n!==null&&!n.isSame(s.scheduledDate,"day")&&(s=new oe(be(X({},s),{scheduledDateIsInferred:!1}))),s))}};var Ar=class{static calculate(e){var n,s,i;let t=0;if((n=e.dueDate)!=null&&n.isValid()){let a=window.moment().startOf("day"),o=Math.round(a.diff(e.dueDate)/Ar.milliSecondsPerDay),u;o>=7?u=1:o>=-14?u=(o+14)*.8/21+.2:u=.2,t+=u*Ar.dueCoefficient}switch((s=e.scheduledDate)!=null&&s.isValid()&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*Ar.scheduledCoefficient),(i=e.startDate)!=null&&i.isValid()&&window.moment().isBefore(e.startDate)&&(t+=1*Ar.startedCoefficient),e.priority){case"0":t+=1.5*Ar.priorityCoefficient;break;case"1":t+=1*Ar.priorityCoefficient;break;case"2":t+=.65*Ar.priorityCoefficient;break;case"3":t+=.325*Ar.priorityCoefficient;break;case"5":t-=.3*Ar.priorityCoefficient;break}return t}},On=Ar;On.dueCoefficient=12,On.scheduledCoefficient=5,On.startedCoefficient=-3,On.priorityCoefficient=6,On.milliSecondsPerDay=1e3*60*60*24;var oe=class{constructor({status:e,description:t,taskLocation:n,indentation:s,listMarker:i,priority:a,createdDate:o,startDate:u,scheduledDate:l,dueDate:c,doneDate:f,cancelledDate:p,recurrence:m,dependsOn:_,id:g,blockLink:E,tags:C,originalMarkdown:R,scheduledDateIsInferred:b}){this._urgency=null;this.status=e,this.description=t,this.indentation=s,this.listMarker=i,this.taskLocation=n,this.tags=C,this.priority=a,this.createdDate=o,this.startDate=u,this.scheduledDate=l,this.dueDate=c,this.doneDate=f,this.cancelledDate=p,this.recurrence=m,this.dependsOn=_,this.id=g,this.blockLink=E,this.originalMarkdown=R,this.scheduledDateIsInferred=b}static fromLine({line:e,taskLocation:t,fallbackDate:n}){let s=oe.extractTaskComponents(e);return s===null||!ye.getInstance().includedIn(s.body)?null:oe.parseTaskSignifiers(e,t,n)}static parseTaskSignifiers(e,t,n){let s=oe.extractTaskComponents(e);if(s===null)return null;let{taskSerializer:i}=To(),a=i.deserialize(s.body),o=!1;return Dt.canApplyFallback(a)&&n!==null&&(a.scheduledDate=n,o=!0),a.tags=a.tags.map(u=>u.trim()),a.tags=a.tags.filter(u=>!ye.getInstance().equals(u)),new oe(be(X(X({},s),a),{taskLocation:t,originalMarkdown:e,scheduledDateIsInferred:o}))}static extractTaskComponents(e){let t=e.match(Z.taskRegex);if(t===null)return null;let n=t[1],s=t[2],i=t[3],a=Oe.getInstance().bySymbolOrCreate(i),o=t[4].trim(),u=o.match(Z.blockLinkRegex),l=u!==null?u[0]:"";return l!==""&&(o=o.replace(Z.blockLinkRegex,"").trim()),{indentation:n,listMarker:s,status:a,body:o,blockLink:l}}toString(){return To().taskSerializer.serialize(this)}toFileLineString(){return`${this.indentation}${this.listMarker} [${this.status.symbol}] ${this.toString()}`}toggle(){let e=Ft.getLogger("tasks.Task"),t="toggle()";ol(e,t,this);let n=Oe.getInstance().getNextStatusOrCreate(this.status),s=this.handleNewStatus(n);return ul(e,t,s),s}handleNewStatus(e,t=window.moment()){if(e.identicalTo(this.status))return[this];let{setDoneDate:n}=ee(),s=this.newDate(e,"DONE",this.doneDate,n,t),{setCancelledDate:i}=ee(),a=this.newDate(e,"CANCELLED",this.cancelledDate,i,t),o=null;e.isCompleted()&&!this.status.isCompleted()&&this.recurrence!==null&&(o=this.recurrence.next(t));let u=new oe(be(X({},this),{status:e,doneDate:s,cancelledDate:a})),l=[];if(o!==null){let c=this.createNextOccurrence(e,o);l.push(c)}return l.push(u),l}newDate(e,t,n,s,i){let a=null;return e.type===t&&(this.status.type!==t?s&&(a=i):a=n),a}createNextOccurrence(e,t){let{setCreatedDate:n}=ee(),s=null;n&&(s=window.moment());let i=null,a=null,u=Oe.getInstance().getNextRecurrenceStatusOrCreate(e);return new oe(be(X(X({},this),t),{status:u,blockLink:"",id:"",dependsOn:[],createdDate:s,cancelledDate:i,doneDate:a}))}toggleWithRecurrenceInUsersOrder(){let e=this.toggle();return this.putRecurrenceInUsersOrder(e)}handleNewStatusWithRecurrenceInUsersOrder(e,t=window.moment()){Ft.getLogger("tasks.Task").debug(`changed task ${this.taskLocation.path} ${this.taskLocation.lineNumber} ${this.originalMarkdown} status to '${e.symbol}'`);let s=this.handleNewStatus(e,t);return this.putRecurrenceInUsersOrder(s)}putRecurrenceInUsersOrder(e){let{recurrenceOnNextLine:t}=ee();return t?e.reverse():e}get isDone(){return this.status.type==="DONE"||this.status.type==="CANCELLED"||this.status.type==="NON_TASK"}isBlocked(e){if(this.dependsOn.length===0||this.isDone)return!1;for(let t of this.dependsOn)if(!!e.find(s=>s.id===t&&!s.isDone))return!0;return!1}isBlocking(e){return this.id===""||this.isDone?!1:e.some(t=>t.isDone?!1:t.dependsOn.includes(this.id))}get priorityNumber(){return Number.parseInt(this.priority)}get priorityNameGroupText(){let e=Sn.priorityNameUsingNormal(this.priority);return`%%${this.priority}%%${e} priority`}get descriptionWithoutTags(){return this.description.replace(Z.hashTags,"").trim()}get priorityName(){return Sn.priorityNameUsingNormal(this.priority)}get urgency(){return this._urgency===null&&(this._urgency=On.calculate(this)),this._urgency}get path(){return this.taskLocation.path}get cancelled(){return new ze(this.cancelledDate)}get created(){return new ze(this.createdDate)}get done(){return new ze(this.doneDate)}get due(){return new ze(this.dueDate)}get scheduled(){return new ze(this.scheduledDate)}get start(){return new ze(this.startDate)}get happensDates(){return Array.of(this.startDate,this.scheduledDate,this.dueDate)}get happens(){let e=this.happensDates,t=Array.from(e).sort(_r);for(let n of t)if(n!=null&&n.isValid())return new ze(n);return new ze(null)}get isRecurring(){return this.recurrence!==null}get recurrenceRule(){return this.recurrence?this.recurrence.toText():""}get heading(){return this.precedingHeader}get hasHeading(){return this.precedingHeader!==null}get file(){return new wi(this.path)}get filename(){let e=this.path.match(/([^/]+)\.md$/);return e!==null?e[1]:null}get lineNumber(){return this.taskLocation.lineNumber}get sectionStart(){return this.taskLocation.sectionStart}get sectionIndex(){return this.taskLocation.sectionIndex}get precedingHeader(){return this.taskLocation.precedingHeader}getLinkText({isFilenameUnique:e}){let t;return e?t=this.filename:t="/"+this.path,t===null?null:(this.precedingHeader!==null&&this.precedingHeader!==t&&(t=t+" > "+this.precedingHeader),t)}static tasksListsIdentical(e,t){return e.length!==t.length?!1:e.every((n,s)=>n.identicalTo(t[s]))}identicalTo(e){var i,a;let t=["description","path","indentation","listMarker","lineNumber","sectionStart","sectionIndex","precedingHeader","priority","blockLink","scheduledDateIsInferred","id","dependsOn"];for(let o of t)if(((i=this[o])==null?void 0:i.toString())!==((a=e[o])==null?void 0:a.toString()))return!1;if(!this.status.identicalTo(e.status)||this.tags.length!==e.tags.length||!this.tags.every(function(o,u){return o===e.tags[u]}))return!1;t=oe.allDateFields();for(let o of t){let u=this[o],l=e[o];if(_r(u,l)!==0)return!1}let n=this.recurrence,s=e.recurrence;return n===null&&s!==null||n!==null&&s===null?!1:!(n&&s&&!n.identicalTo(s))}static allDateFields(){return["createdDate","startDate","scheduledDate","dueDate","doneDate","cancelledDate"]}static extractHashtags(e){var t,n;return(n=(t=e.match(Z.hashTags))==null?void 0:t.map(s=>s.trim()))!=null?n:[]}};var _o=class{constructor(e){this.fetch=e;this._value=void 0}get value(){return this._value===void 0&&(this._value=this.fetch()),this._value}};var vt=class{constructor(e,t,n,s,i){this._path=e,this._lineNumber=t,this._sectionStart=n,this._sectionIndex=s,this._precedingHeader=i}static fromUnknownPosition(e){return new vt(e,0,0,0,null)}fromRenamedFile(e){return new vt(e,this.lineNumber,this.sectionStart,this.sectionIndex,this.precedingHeader)}get path(){return this._path}get lineNumber(){return this._lineNumber}get sectionStart(){return this._sectionStart}get sectionIndex(){return this._sectionIndex}get precedingHeader(){return this._precedingHeader}get hasKnownPath(){return this.path!==""}};var Ds=class{constructor({metadataCache:e,vault:t,events:n}){this.logger=Ft.getLogger("tasks.Cache");this.logger.debug("Creating Cache object"),this.metadataCache=e,this.metadataCacheEventReferences=[],this.vault=t,this.vaultEventReferences=[],this.events=n,this.eventsEventReferences=[],this.tasksMutex=new tu,this.state="Cold",this.logger.debug("Cache.constructor(): state = Cold"),this.tasks=[],this.loadedAfterFirstResolve=!1,this.subscribeToCache(),this.subscribeToVault(),this.subscribeToEvents(),this.loadVault()}unload(){this.logger.info("Unloading Cache");for(let e of this.metadataCacheEventReferences)this.metadataCache.offref(e);for(let e of this.vaultEventReferences)this.vault.offref(e);for(let e of this.eventsEventReferences)this.events.off(e)}getTasks(){return this.tasks}getState(){return this.state}notifySubscribers(){this.logger.debug("Cache.notifySubscribers()"),this.events.triggerCacheUpdate({tasks:this.tasks,state:this.state})}subscribeToCache(){this.logger.debug("Cache.subscribeToCache()");let e=this.metadataCache.on("resolved",()=>L(this,null,function*(){this.loadedAfterFirstResolve||(this.loadedAfterFirstResolve=!0,this.loadVault())}));this.metadataCacheEventReferences.push(e);let t=this.metadataCache.on("changed",n=>{this.tasksMutex.runExclusive(()=>{this.indexFile(n)})});this.metadataCacheEventReferences.push(t)}subscribeToVault(){this.logger.debug("Cache.subscribeToVault()");let{useFilenameAsScheduledDate:e}=ee(),t=this.vault.on("create",i=>{i instanceof ki.TFile&&(this.logger.debug(`Cache.subscribeToVault.createdEventReference() ${i.path}`),this.tasksMutex.runExclusive(()=>{this.indexFile(i)}))});this.vaultEventReferences.push(t);let n=this.vault.on("delete",i=>{i instanceof ki.TFile&&(this.logger.debug(`Cache.subscribeToVault.deletedEventReference() ${i.path}`),this.tasksMutex.runExclusive(()=>{this.tasks=this.tasks.filter(a=>a.path!==i.path),this.notifySubscribers()}))});this.vaultEventReferences.push(n);let s=this.vault.on("rename",(i,a)=>{i instanceof ki.TFile&&(this.logger.debug(`Cache.subscribeToVault.renamedEventReference() ${i.path}`),this.tasksMutex.runExclusive(()=>{let o=new _o(()=>Dt.fromPath(i.path));this.tasks=this.tasks.map(u=>u.path===a?e?Dt.updateTaskPath(u,i.path,o.value):new oe(be(X({},u),{taskLocation:u.taskLocation.fromRenamedFile(i.path)})):u),this.notifySubscribers()}))});this.vaultEventReferences.push(s)}subscribeToEvents(){this.logger.debug("Cache.subscribeToEvents()");let e=this.events.onRequestCacheUpdate(t=>{t({tasks:this.tasks,state:this.state})});this.eventsEventReferences.push(e)}loadVault(){return this.logger.debug("Cache.loadVault()"),this.tasksMutex.runExclusive(()=>L(this,null,function*(){this.state="Initializing",this.logger.debug("Cache.loadVault(): state = Initializing"),yield Promise.all(this.vault.getMarkdownFiles().map(e=>this.indexFile(e))),this.state="Warm",this.logger.debug("Cache.loadVault(): state = Warm"),this.notifySubscribers()}))}indexFile(e){return L(this,null,function*(){let t=this.metadataCache.getFileCache(e);if(t==null)return;if(!e.path.endsWith(".md")){this.logger.debug("indexFile: skipping non-markdown file: "+e.path);return}this.logger.debug("Cache.indexFile: "+e.path);let n=this.tasks.filter(a=>a.path===e.path),s=t.listItems,i=[];if(s!==void 0){let a=yield this.vault.cachedRead(e);i=this.getTasksFromFileContent(a,s,t,e)}oe.tasksListsIdentical(n,i)||(this.tasks=this.tasks.filter(a=>a.path!==e.path),this.tasks.push(...i),this.logger.debug("Cache.indexFile: "+e.path+`: read ${i.length} task(s)`),this.notifySubscribers())})}getTasksFromFileContent(e,t,n,s){let i=[],a=e.split(` `),o=a.length,u=new _o(()=>Dt.fromPath(s.path)),l=null,c=0;for(let f of t)if(f.task!==void 0){let p=f.position.start.line;if(p>=o)return this.logger.debug(`${s.path} Obsidian gave us a line number ${p} past the end of the file. ${o}.`),i;if((l===null||l.position.end.linee(t,n,s)*-1}};var es=class{constructor(e,t,n,s){this.instruction=e,this.property=t,this.grouper=n,this.reverse=s}};var ke=class{canCreateFilterForLine(e){return ke.lineMatchesFilter(this.filterRegExp(),e)}static lineMatchesFilter(e,t){return e?e.test(t):!1}static getMatch(e,t){return e?t.match(e):null}fieldNameSingular(){return this.fieldName()}fieldNameSingularEscaped(){return rl(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=ke.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createSorter(n)}sorterRegExp(){if(!this.supportsSorting())throw Error(`sorterRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)?`,"i")}sorterInstruction(e){let t=`sort by ${this.fieldNameSingular()}`;return e&&(t+=" reverse"),t}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new Nr(this.sorterInstruction(e),this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}createGrouperFromLine(e){if(!this.supportsGrouping())return null;let t=ke.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createGrouper(n)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)?$`,"i")}grouperInstruction(e){let t=`group by ${this.fieldNameSingular()}`;return e&&(t+=" reverse"),t}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(e){return new es(this.grouperInstruction(e),this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};var xt=class{constructor(e,t,n){this.instruction=e,this.explanation=n,this.filterFunction=t}explainFilterIndented(e){let t=this.explanation;return t.asString()===this.instruction?`${e}${this.instruction} `:`${e}${this.instruction} => ${t.asString(e+" ")} -`}};var en=class{constructor(e){this.instruction=e}get queryComponent(){return this._queryComponent}set queryComponent(e){this._queryComponent=e}get error(){return this._error}set error(e){this._error=e}static fromObject(e,t){let n=new en(e);return n._queryComponent=t,n}static fromError(e,t){let n=new en(e);return n._error=t,n}};var re=class{constructor(e){this.object=e}get instruction(){return this.object.instruction}get filter(){return this.object.queryComponent}get error(){return this.object.error}get filterFunction(){if(this.filter)return this.filter.filterFunction}static fromFilter(e){return new re(en.fromObject(e.instruction,e))}static fromError(e,t){return new re(en.fromError(e,t))}};var Pe=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return re.fromError(e,`do not understand query filter (${this.fieldName()})`);let n=t[1].toLowerCase(),s=t[2],i=null;if(n.includes("include"))i=new qi(s);else if(n.includes("regex")){try{i=Jn.validateAndConstruct(s)}catch(u){let l=Is("Parsing regular expression",u)+` +`}};var en=class{constructor(e){this.instruction=e}get queryComponent(){return this._queryComponent}set queryComponent(e){this._queryComponent=e}get error(){return this._error}set error(e){this._error=e}isValid(){return this._queryComponent!==void 0}static fromObject(e,t){let n=new en(e);return n._queryComponent=t,n}static fromError(e,t){let n=new en(e);return n._error=t,n}};var re=class{constructor(e){this.object=e}get instruction(){return this.object.instruction}get filter(){return this.object.queryComponent}isValid(){return this.object.isValid()}get error(){return this.object.error}get filterFunction(){if(this.filter)return this.filter.filterFunction}static fromFilter(e){return new re(en.fromObject(e.instruction,e))}static fromError(e,t){return new re(en.fromError(e,t))}};var Pe=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return re.fromError(e,`do not understand query filter (${this.fieldName()})`);let n=t[1].toLowerCase(),s=t[2],i=null;if(n.includes("include"))i=new qi(s);else if(n.includes("regex")){try{i=Jn.validateAndConstruct(s)}catch(u){let l=Is("Parsing regular expression",u)+` ${Jn.helpMessage()}`;return re.fromError(e,l)}if(i===null)return re.fromError(e,`Invalid instruction: '${e}' @@ -259,12 +259,12 @@ Possible causes: instead of in to a template file. See: https://publish.obsidian.md/tasks/Advanced/Instruction+contains+unexpanded+template+text -`}};var xl=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e.toLocaleLowerCase()===this._instruction.toLocaleLowerCase()}createFilterOrErrorMessage(e){return this.canCreateFilterForLine(e)?re.fromFilter(new xt(e,this._filter,new Me(e))):re.fromError(e,`do not understand filter: ${e}`)}};var Bt=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new xl(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let t of this._filters){let n=t.createFilterOrErrorMessage(e);if(n.error===void 0)return n}return re.fromError(e,`do not understand filter: ${e}`)}};var ht=class extends ke{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new Bt,this.filterInstructions.add(`has ${this.fieldName()} date`,n=>this.date(n)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,n=>this.date(n)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,n=>{let s=this.date(n);return s!==null&&!s.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){var p;let n=this.checkForUnexpandedTemplateText(t);if(n)return re.fromError(t,n);let s=this.filterInstructions.createFilterOrErrorMessage(t);if(s.filter!==void 0)return s;let i=ke.getMatch(this.filterRegExp(),t);if(i===null)return re.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let a=i[1],o=(p=i[2])==null?void 0:p.toLowerCase(),u=i[3],l=Qt.parseDateRange(u);if(!l.isValid()){let m=Qt.parseDate(a);m.isValid()&&(l=new Nt(m,m))}if(!l.isValid())return re.fromError(t,"do not understand "+this.fieldName()+" date");let c=this.buildFilterFunction(o,l),f=ht.buildExplanation(this.fieldNameForExplanation(),o,this.filterResultIfFieldMissing(),l);return re.fromFilter(new xt(t,c,f))}buildFilterFunction(t,n){let s;switch(t){case"before":s=i=>i?i.isBefore(n.start):this.filterResultIfFieldMissing();break;case"after":s=i=>i?i.isAfter(n.end):this.filterResultIfFieldMissing();break;case"on or before":case"in or before":s=i=>i?i.isSameOrBefore(n.end):this.filterResultIfFieldMissing();break;case"on or after":case"in or after":s=i=>i?i.isSameOrAfter(n.start):this.filterResultIfFieldMissing();break;default:s=i=>i?i.isSameOrAfter(n.start)&&i.isSameOrBefore(n.end):this.filterResultIfFieldMissing()}return this.getFilter(s)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} (((?:on|in) or before|before|(?:on|in) or after|after|on|in)? ?(.*))`,"i")}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,s,i){let a=n,o="YYYY-MM-DD (dddd Do MMMM YYYY)",u;switch(n){case"before":case"on or after":u=i.start.format(o);break;case"after":case"on or before":u=i.end.format(o);break;case"in or before":a="on or before",u=i.end.format(o);break;case"in or after":a="on or after",u=i.start.format(o);break;default:if(!i.start.isSame(i.end)){let c=`${t} date is between:`,f=[new Me(`${i.start.format(o)} and`),new Me(`${i.end.format(o)} inclusive`)];return s&&f.push(new Me(`OR no ${t} date`)),new Me(c,f)}a="on",u=i.start.format(o);break}let l=`${t} date is ${a} ${u}`;return s&&(l+=` OR no ${t} date`),new Me(l)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>_r(this.date(t),this.date(n))}supportsGrouping(){return!0}grouper(){return t=>{let n=this.date(t);return n===null?["No "+this.fieldName()+" date"]:n.isValid()?[n.format("YYYY-MM-DD dddd")]:["%%0%% Invalid "+this.fieldName()+" date"]}}checkForUnexpandedTemplateText(t){return new Dl().findUnexpandedDateText(t)}};var Rl=class extends ht{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var Ml=class extends ht{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var ji=class extends ht{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}};var tn=class extends ke{constructor(){super(...arguments);this._filters=new Bt}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var Cl=class extends tn{constructor(){super(),this._filters.add("exclude sub-items",e=>{if(e.indentation==="")return!0;let t=e.indentation.lastIndexOf(">");return t===-1?!1:/^ ?$/.test(e.indentation.slice(t+1))})}fieldName(){return"exclude"}};var Io=class extends en{};function uh(r,e){let t=r.map(([n])=>n);try{let n=e.includes("return")?e:`return ${e}`,s=e&&new Function(...t,n);return s instanceof Function?Io.fromObject(e,s):Io.fromError(e,"Error parsing group function")}catch(n){return Io.fromError(e,Is(`Failed parsing expression "${e}"`,n))}}function lh(r,e){let t=e.map(([n,s])=>s);return r(...t)}function ch(r,e,t){try{return lh(r,e)}catch(n){return Is(`Failed calculating expression "${t}"`,n)}}function Al(r,e){return[["task",r],["query",e?e.query:null]]}function Iw(r,e,t){let n=Al(r,t||null),s=uh(n,e);return s.error?s.error:ch(s.queryComponent,n,e)}var Fo=class{constructor(e){this.line=e,this.functionOrError=uh(Al(null,null),e)}isValid(){return this.functionOrError.error===void 0}get parseError(){return this.functionOrError.error}evaluate(e,t){if(!this.isValid())throw Error(`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`);return lh(this.functionOrError.queryComponent,Al(e,t||null))}evaluateOrCatch(e,t){return this.isValid()?ch(this.functionOrError.queryComponent,Al(e,t),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};function dh(r){if(r===null)return"null";let e=typeof r;return e==="object"?r.constructor.name:e}var Pl=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return re.fromError(e,"Unable to parse line");let n=t[1],s=new Fo(n);return s.isValid()?re.fromFilter(new xt(e,lI(s),new Me(e))):re.fromError(e,s.parseError)}fieldName(){return"function"}filterRegExp(){return new RegExp(`^filter by ${this.fieldNameSingularEscaped()} (.*)`,"i")}supportsSorting(){return!0}sorterRegExp(){return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`,"i")}createSorterFromLine(e){let t=ke.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1],s=t[2],i=new Fo(s);if(!i.isValid())throw new Error(i.parseError);let a=(o,u,l)=>{try{let c=l.queryContext(),f=this.validateTaskSortKey(i.evaluate(o,c)),p=this.validateTaskSortKey(i.evaluate(u,c));return this.compareTaskSortKeys(f,p)}catch(c){throw c instanceof Error&&(c.message+=`: while evaluating instruction '${e}'`),c}};return new Nr(e,this.fieldNameSingular(),a,n)}validateTaskSortKey(e){function t(n){throw new Error(`"${n}" is not a valid sort key`)}return e===void 0&&t("undefined"),Number.isNaN(e)&&t("NaN (Not a Number)"),Array.isArray(e)&&t("array"),e}compareTaskSortKeys(e,t){let n=dh(e),s=dh(t),i=this.compareTaskSortKeysIfOptionalMoment(e,t,n,s);if(i!==void 0)return i;let a=this.compareTaskSortKeysIfEitherIsNull(e,t);if(a!==void 0)return a;if(n!==s)throw new Error(`Unable to compare two different sort key types '${n}' and '${s}' order`);if(n==="string")return e.localeCompare(t,void 0,{numeric:!0});if(n==="TasksDate")return _r(e.moment,t.moment);if(n==="boolean")return Number(t)-Number(e);let o=Number(e)-Number(t);if(isNaN(o))throw new Error(`Unable to determine sort order for sort key types '${n}' and '${s}'`);return o}compareTaskSortKeysIfOptionalMoment(e,t,n,s){let i=n==="Moment",a=s==="Moment";if(i&&a||i&&t===null||a&&e===null)return _r(e,t)}compareTaskSortKeysIfEitherIsNull(e,t){if(e===null&&t===null)return 0;if(e===null&&t!==null)return-1;if(e!==null&&t===null)return 1}supportsGrouping(){return!0}createGrouperFromLine(e){let t=ke.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1],s=t[2];return new es(e,"function",dI(s),n)}grouperRegExp(){return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`,"i")}grouper(){throw Error("grouper() function not valid for FunctionField. Use createGrouperFromLine() instead.")}};function lI(r){return(e,t)=>{let n=t.queryContext();return cI(r,e,n)}}function cI(r,e,t){let n=r.evaluate(e,t);if(typeof n=="boolean")return n;throw Error(`filtering function must return true or false. This returned "${n}".`)}function dI(r){return(e,t)=>{let n=t.queryContext();return fI(e,r,n)}}function fI(r,e,t){try{let n=Iw(r,e,t);return Array.isArray(n)?n.map(i=>i.toString()):n===null?[]:[n.toString()]}catch(n){let s=`Error: Failed calculating expression "${e}". The error message was: `;return n instanceof Error?[s+n.message]:[s+"Unknown error"]}}var Nl=class extends Pe{fieldName(){return"heading"}value(e){return e.precedingHeader?e.precedingHeader:""}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>e.precedingHeader===null||e.precedingHeader.length===0?["(No heading)"]:[e.precedingHeader]}};var Gi=class extends Pe{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var fh=class extends ke{createFilterOrErrorMessage(e){var n;let t=ke.getMatch(this.filterRegExp(),e);if(t!==null){let s=t[5],i=null;switch(s.toLowerCase()){case"lowest":i="5";break;case"low":i="4";break;case"none":i="3";break;case"medium":i="2";break;case"high":i="1";break;case"highest":i="0";break}if(i===null)return re.fromError(e,"do not understand priority");let a=e,o;switch((n=t[3])==null?void 0:n.toLowerCase()){case"above":o=u=>u.priority.localeCompare(i)<0;break;case"below":o=u=>u.priority.localeCompare(i)>0;break;case"not":o=u=>u.priority!==i;break;default:o=u=>u.priority===i,a=`${this.fieldName()} is ${s}`}return re.fromFilter(new xt(e,o,new Me(a)))}else return re.fromError(e,"do not understand query filter (priority)")}fieldName(){return"priority"}filterRegExp(){return fh.priorityRegexp}supportsSorting(){return!0}comparator(){return(e,t)=>e.priority.localeCompare(t.priority)}supportsGrouping(){return!0}grouper(){return e=>[e.priorityNameGroupText]}},Ls=fh;Ls.priorityRegexp=/^priority(\s+is)?(\s+(above|below|not))?(\s+(lowest|low|none|medium|high|highest))$/i;var Il=class extends ht{fieldName(){return"scheduled"}date(e){return e.scheduledDate}filterResultIfFieldMissing(){return!1}};var Fl=class extends ht{fieldName(){return"start"}fieldNameForFilterInstruction(){return"starts"}date(e){return e.startDate}filterResultIfFieldMissing(){return!0}};var Ll=class extends ht{constructor(){let e=new Bt;e.add("has happens date",t=>this.dates(t).some(n=>n!==null)),e.add("no happens date",t=>!this.dates(t).some(n=>n!==null)),super(e)}fieldName(){return"happens"}fieldNameForExplanation(){return"due, start or scheduled"}date(e){return this.earliestDate(e)}dates(e){return e.happensDates}earliestDate(e){return e.happens.moment}filterResultIfFieldMissing(){return!1}getFilter(e){return t=>this.dates(t).some(n=>e(n))}};var Ul=class extends tn{constructor(){super(),this._filters.add("is recurring",e=>e.recurrence!==null),this._filters.add("is not recurring",e=>e.recurrence===null)}fieldName(){return"recurring"}supportsSorting(){return!0}comparator(){return(e,t)=>e.recurrence!==null&&t.recurrence===null?-1:e.recurrence===null&&t.recurrence!==null?1:0}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?["Recurring"]:["Not Recurring"]}};var ts=class extends tn{constructor(){super(),this._filters.add("done",e=>e.isDone),this._filters.add("not done",e=>!e.isDone)}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=ts.oldStatusName(e),s=ts.oldStatusName(t);return ns?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[ts.oldStatusName(e)]}};var Wl=class extends Pe{fieldNamePlural(){return this.fieldNameSingular()+"s"}fieldName(){return`${this.fieldNameSingular()}/${this.fieldNamePlural()}`}fieldPattern(){return`${this.fieldNameSingular()}|${this.fieldNamePlural()}`}filterOperatorPattern(){return`${super.filterOperatorPattern()}|include|do not include`}value(e){return this.values(e).join(", ")}getFilter(e,t){return n=>{let s=e.matchesAnyOf(this.values(n));return t?!s:s}}createGrouper(e){return new es(this.grouperInstruction(e),this.fieldNamePlural(),this.grouper(),e)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNamePlural()}( reverse)?$`,"i")}grouperInstruction(e){let t=`group by ${this.fieldNamePlural()}`;return e&&(t+=" reverse"),t}};var Us=class extends Wl{constructor(){super();this.filterInstructions=new Bt,this.filterInstructions.add(`has ${this.fieldNameSingular()}`,t=>this.values(t).length>0),this.filterInstructions.add(`has ${this.fieldNamePlural()}`,t=>this.values(t).length>0),this.filterInstructions.add(`no ${this.fieldNameSingular()}`,t=>this.values(t).length===0),this.filterInstructions.add(`no ${this.fieldNamePlural()}`,t=>this.values(t).length===0)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.filter!==void 0?n:super.createFilterOrErrorMessage(t)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}fieldNameSingular(){return"tag"}values(t){return t.tags}supportsSorting(){return!0}createSorterFromLine(t){let n=t.match(this.sorterRegExp());if(n===null)return null;let s=!!n[1],i=isNaN(+n[2])?1:+n[2],a=Us.makeCompareByTagComparator(i);return new Nr(t,this.fieldNameSingular(),a,s)}sorterRegExp(){return/^sort by tag( reverse)?[\s]*(\d+)?/i}comparator(){return Us.makeCompareByTagComparator(1)}static makeCompareByTagComparator(t){return(n,s)=>{if(n.tags.length===0&&s.tags.length===0)return 0;if(n.tags.length===0)return 1;if(s.tags.length===0)return-1;let i=t-1;if(n.tags.length=t)return 1;if(s.tags.length=t)return-1;if(n.tags.lengtht.tags.length==0?["(No tags)"]:t.tags}};var Kw=ua(Vw());var Bl=class extends ke{constructor(){super(...arguments);this.basicBooleanRegexp=/(.*(AND|OR|XOR|NOT)\s*[("].*|\(.+\))/g;this.supportedOperators=["AND","OR","XOR","NOT"];this.subFields={}}filterRegExp(){return this.basicBooleanRegexp}createFilterOrErrorMessage(t){return this.parseLine(t)}fieldName(){return"boolean query"}parseLine(t){if(t.length===0)return re.fromError(t,"empty line");let n=this.preprocessExpression(t);try{let s=(0,Kw.parse)(n);for(let o of s)if(o.name==="IDENTIFIER"&&o.value){let u=o.value.trim();if(!(u in this.subFields)){let l=$l(u);if(l===null)return re.fromError(t,`couldn't parse sub-expression '${u}'`);if(l.error)return re.fromError(t,`couldn't parse sub-expression '${u}': ${l.error}`);l.filter&&(this.subFields[u]=l.filter)}}else if(o.name==="OPERATOR"){if(o.value==null)return re.fromError(t,"empty operator in boolean query");if(!this.supportedOperators.includes(o.value))return re.fromError(t,`unknown boolean operator '${o.value}'`)}let i=(o,u)=>this.filterTaskWithParsedQuery(o,s,u),a=this.constructExplanation(s);return re.fromFilter(new xt(t,i,a))}catch(s){let i=s instanceof Error?s.message:"unknown error type";return re.fromError(t,`malformed boolean query -- ${i} (check the documentation for guidelines)`)}}preprocessExpression(t){return t.replace(/\(([^()]+)\)/g,'("$1")')}filterTaskWithParsedQuery(t,n,s){let i=u=>u==="true",a=u=>u?"true":"false",o=[];for(let u of n)if(u.name==="IDENTIFIER"){if(u.value==null)throw Error("null token value");let c=this.subFields[u.value.trim()].filterFunction(t,s);o.push(a(c))}else if(u.name==="OPERATOR")if(u.value==="NOT"){let l=i(o.pop());o.push(a(!l))}else if(u.value==="OR"){let l=i(o.pop()),c=i(o.pop());o.push(a(l||c))}else if(u.value==="AND"){let l=i(o.pop()),c=i(o.pop());o.push(a(l&&c))}else if(u.value==="XOR"){let l=i(o.pop()),c=i(o.pop());o.push(a(l&&!c||!l&&c))}else throw Error("Unsupported operator: "+u.value);else throw Error("Unsupported token type: "+u);return i(o[0])}constructExplanation(t){let n=[];for(let s of t)if(s.name==="IDENTIFIER"){if(s.value==null)throw Error("null token value");let i=this.subFields[s.value.trim()];n.push(i.explanation)}else if(s.name==="OPERATOR")if(s.value==="NOT"){let i=n.pop();n.push(Me.booleanNot([i]))}else if(s.value==="OR"){let i=n.pop(),a=n.pop();n.push(Me.booleanOr([a,i]))}else if(s.value==="AND"){let i=n.pop(),a=n.pop();n.push(Me.booleanAnd([a,i]))}else if(s.value==="XOR"){let i=n.pop(),a=n.pop();n.push(Me.booleanXor([a,i]))}else throw Error("Unsupported operator: "+s.value);else throw Error("Unsupported token type: "+s.name);return n[0]}};var Hl=class extends Pe{fieldName(){return"filename"}value(e){let t=e.filename;return t===null?"":t+".md"}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;return t===null?["Unknown Location"]:["[["+t+"]]"]}}};var Qi=class extends ke{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return re.fromError(e,"Filtering by urgency is not yet supported")}fieldName(){return"urgency"}filterRegExp(){throw Error(`filterRegExp() unimplemented for ${this.fieldName()}`)}supportsSorting(){return!0}comparator(){return(e,t)=>t.urgency-e.urgency}supportsGrouping(){return!0}grouper(){return e=>[`${e.urgency.toFixed(2)}`]}createGrouper(e){return super.createGrouper(!e)}grouperInstruction(e){return super.grouperInstruction(!e)}};var zl=class extends Pe{constructor(){super()}fieldName(){return"status.name"}value(e){return e.status.name}supportsSorting(){return!0}supportsGrouping(){return!0}};var an=class extends ke{canCreateFilterForLine(e){let t=new RegExp(`^(?:${this.fieldNameSingularEscaped()})`,"i");return ke.lineMatchesFilter(t,e)}createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return this.helpMessage(e);let n=t[1].toLowerCase(),s=t[2],i=er[s.toUpperCase()];if(!i)return this.helpMessage(e);let a;switch(n){case"is":a=o=>o.status.type===i;break;case"is not":a=o=>o.status.type!==i;break;default:return this.helpMessage(e)}return re.fromFilter(new xt(e,a,new Me(e)))}filterRegExp(){return new RegExp(`^(?:${this.fieldNameSingularEscaped()}) (is|is not) ([^ ]+)$`,"i")}helpMessage(e){let t=Object.values(er).filter(s=>s!=="EMPTY").join(" "),n=`Invalid ${this.fieldNameSingular()} instruction: '${e}'. +`}};var xl=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e.toLocaleLowerCase()===this._instruction.toLocaleLowerCase()}createFilterOrErrorMessage(e){return this.canCreateFilterForLine(e)?re.fromFilter(new xt(e,this._filter,new Me(e))):re.fromError(e,`do not understand filter: ${e}`)}};var Bt=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new xl(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let t of this._filters){let n=t.createFilterOrErrorMessage(e);if(n.error===void 0)return n}return re.fromError(e,`do not understand filter: ${e}`)}};var ht=class extends ke{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new Bt,this.filterInstructions.add(`has ${this.fieldName()} date`,n=>this.date(n)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,n=>this.date(n)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,n=>{let s=this.date(n);return s!==null&&!s.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){var p;let n=this.checkForUnexpandedTemplateText(t);if(n)return re.fromError(t,n);let s=this.filterInstructions.createFilterOrErrorMessage(t);if(s.isValid())return s;let i=ke.getMatch(this.filterRegExp(),t);if(i===null)return re.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let a=i[1],o=(p=i[2])==null?void 0:p.toLowerCase(),u=i[3],l=Qt.parseDateRange(u);if(!l.isValid()){let m=Qt.parseDate(a);m.isValid()&&(l=new Nt(m,m))}if(!l.isValid())return re.fromError(t,"do not understand "+this.fieldName()+" date");let c=this.buildFilterFunction(o,l),f=ht.buildExplanation(this.fieldNameForExplanation(),o,this.filterResultIfFieldMissing(),l);return re.fromFilter(new xt(t,c,f))}buildFilterFunction(t,n){let s;switch(t){case"before":s=i=>i?i.isBefore(n.start):this.filterResultIfFieldMissing();break;case"after":s=i=>i?i.isAfter(n.end):this.filterResultIfFieldMissing();break;case"on or before":case"in or before":s=i=>i?i.isSameOrBefore(n.end):this.filterResultIfFieldMissing();break;case"on or after":case"in or after":s=i=>i?i.isSameOrAfter(n.start):this.filterResultIfFieldMissing();break;default:s=i=>i?i.isSameOrAfter(n.start)&&i.isSameOrBefore(n.end):this.filterResultIfFieldMissing()}return this.getFilter(s)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} (((?:on|in) or before|before|(?:on|in) or after|after|on|in)? ?(.*))`,"i")}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,s,i){let a=n,o="YYYY-MM-DD (dddd Do MMMM YYYY)",u;switch(n){case"before":case"on or after":u=i.start.format(o);break;case"after":case"on or before":u=i.end.format(o);break;case"in or before":a="on or before",u=i.end.format(o);break;case"in or after":a="on or after",u=i.start.format(o);break;default:if(!i.start.isSame(i.end)){let c=`${t} date is between:`,f=[new Me(`${i.start.format(o)} and`),new Me(`${i.end.format(o)} inclusive`)];return s&&f.push(new Me(`OR no ${t} date`)),new Me(c,f)}a="on",u=i.start.format(o);break}let l=`${t} date is ${a} ${u}`;return s&&(l+=` OR no ${t} date`),new Me(l)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>_r(this.date(t),this.date(n))}supportsGrouping(){return!0}grouper(){return t=>{let n=this.date(t);return n===null?["No "+this.fieldName()+" date"]:n.isValid()?[n.format("YYYY-MM-DD dddd")]:["%%0%% Invalid "+this.fieldName()+" date"]}}checkForUnexpandedTemplateText(t){return new Dl().findUnexpandedDateText(t)}};var Rl=class extends ht{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var Ml=class extends ht{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var ji=class extends ht{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}};var tn=class extends ke{constructor(){super(...arguments);this._filters=new Bt}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var Cl=class extends tn{constructor(){super(),this._filters.add("exclude sub-items",e=>{if(e.indentation==="")return!0;let t=e.indentation.lastIndexOf(">");return t===-1?!1:/^ ?$/.test(e.indentation.slice(t+1))})}fieldName(){return"exclude"}};var Io=class extends en{};function uh(r,e){let t=r.map(([n])=>n);try{let n=e.includes("return")?e:`return ${e}`,s=e&&new Function(...t,n);return s instanceof Function?Io.fromObject(e,s):Io.fromError(e,"Error parsing group function")}catch(n){return Io.fromError(e,Is(`Failed parsing expression "${e}"`,n))}}function lh(r,e){let t=e.map(([n,s])=>s);return r(...t)}function ch(r,e,t){try{return lh(r,e)}catch(n){return Is(`Failed calculating expression "${t}"`,n)}}function Al(r,e){return[["task",r],["query",e?e.query:null]]}function Iw(r,e,t){let n=Al(r,t||null),s=uh(n,e);return s.error?s.error:ch(s.queryComponent,n,e)}var Fo=class{constructor(e){this.line=e,this.functionOrError=uh(Al(null,null),e)}isValid(){return this.functionOrError.isValid()}get parseError(){return this.functionOrError.error}evaluate(e,t){if(!this.isValid())throw Error(`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`);return lh(this.functionOrError.queryComponent,Al(e,t||null))}evaluateOrCatch(e,t){return this.isValid()?ch(this.functionOrError.queryComponent,Al(e,t),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};function dh(r){if(r===null)return"null";let e=typeof r;return e==="object"?r.constructor.name:e}var Pl=class extends ke{createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return re.fromError(e,"Unable to parse line");let n=t[1],s=new Fo(n);return s.isValid()?re.fromFilter(new xt(e,lI(s),new Me(e))):re.fromError(e,s.parseError)}fieldName(){return"function"}filterRegExp(){return new RegExp(`^filter by ${this.fieldNameSingularEscaped()} (.*)`,"i")}supportsSorting(){return!0}sorterRegExp(){return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`,"i")}createSorterFromLine(e){let t=ke.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1],s=t[2],i=new Fo(s);if(!i.isValid())throw new Error(i.parseError);let a=(o,u,l)=>{try{let c=l.queryContext(),f=this.validateTaskSortKey(i.evaluate(o,c)),p=this.validateTaskSortKey(i.evaluate(u,c));return this.compareTaskSortKeys(f,p)}catch(c){throw c instanceof Error&&(c.message+=`: while evaluating instruction '${e}'`),c}};return new Nr(e,this.fieldNameSingular(),a,n)}validateTaskSortKey(e){function t(n){throw new Error(`"${n}" is not a valid sort key`)}return e===void 0&&t("undefined"),Number.isNaN(e)&&t("NaN (Not a Number)"),Array.isArray(e)&&t("array"),e}compareTaskSortKeys(e,t){let n=dh(e),s=dh(t),i=this.compareTaskSortKeysIfOptionalMoment(e,t,n,s);if(i!==void 0)return i;let a=this.compareTaskSortKeysIfEitherIsNull(e,t);if(a!==void 0)return a;if(n!==s)throw new Error(`Unable to compare two different sort key types '${n}' and '${s}' order`);if(n==="string")return e.localeCompare(t,void 0,{numeric:!0});if(n==="TasksDate")return _r(e.moment,t.moment);if(n==="boolean")return Number(t)-Number(e);let o=Number(e)-Number(t);if(isNaN(o))throw new Error(`Unable to determine sort order for sort key types '${n}' and '${s}'`);return o}compareTaskSortKeysIfOptionalMoment(e,t,n,s){let i=n==="Moment",a=s==="Moment";if(i&&a||i&&t===null||a&&e===null)return _r(e,t)}compareTaskSortKeysIfEitherIsNull(e,t){if(e===null&&t===null)return 0;if(e===null&&t!==null)return-1;if(e!==null&&t===null)return 1}supportsGrouping(){return!0}createGrouperFromLine(e){let t=ke.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1],s=t[2];return new es(e,"function",dI(s),n)}grouperRegExp(){return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`,"i")}grouper(){throw Error("grouper() function not valid for FunctionField. Use createGrouperFromLine() instead.")}};function lI(r){return(e,t)=>{let n=t.queryContext();return cI(r,e,n)}}function cI(r,e,t){let n=r.evaluate(e,t);if(typeof n=="boolean")return n;throw Error(`filtering function must return true or false. This returned "${n}".`)}function dI(r){return(e,t)=>{let n=t.queryContext();return fI(e,r,n)}}function fI(r,e,t){try{let n=Iw(r,e,t);return Array.isArray(n)?n.map(i=>i.toString()):n===null?[]:[n.toString()]}catch(n){let s=`Error: Failed calculating expression "${e}". The error message was: `;return n instanceof Error?[s+n.message]:[s+"Unknown error"]}}var Nl=class extends Pe{fieldName(){return"heading"}value(e){return e.precedingHeader?e.precedingHeader:""}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>e.precedingHeader===null||e.precedingHeader.length===0?["(No heading)"]:[e.precedingHeader]}};var Gi=class extends Pe{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var fh=class extends ke{createFilterOrErrorMessage(e){var n;let t=ke.getMatch(this.filterRegExp(),e);if(t!==null){let s=t[5],i=null;switch(s.toLowerCase()){case"lowest":i="5";break;case"low":i="4";break;case"none":i="3";break;case"medium":i="2";break;case"high":i="1";break;case"highest":i="0";break}if(i===null)return re.fromError(e,"do not understand priority");let a=e,o;switch((n=t[3])==null?void 0:n.toLowerCase()){case"above":o=u=>u.priority.localeCompare(i)<0;break;case"below":o=u=>u.priority.localeCompare(i)>0;break;case"not":o=u=>u.priority!==i;break;default:o=u=>u.priority===i,a=`${this.fieldName()} is ${s}`}return re.fromFilter(new xt(e,o,new Me(a)))}else return re.fromError(e,"do not understand query filter (priority)")}fieldName(){return"priority"}filterRegExp(){return fh.priorityRegexp}supportsSorting(){return!0}comparator(){return(e,t)=>e.priority.localeCompare(t.priority)}supportsGrouping(){return!0}grouper(){return e=>[e.priorityNameGroupText]}},Ls=fh;Ls.priorityRegexp=/^priority(\s+is)?(\s+(above|below|not))?(\s+(lowest|low|none|medium|high|highest))$/i;var Il=class extends ht{fieldName(){return"scheduled"}date(e){return e.scheduledDate}filterResultIfFieldMissing(){return!1}};var Fl=class extends ht{fieldName(){return"start"}fieldNameForFilterInstruction(){return"starts"}date(e){return e.startDate}filterResultIfFieldMissing(){return!0}};var Ll=class extends ht{constructor(){let e=new Bt;e.add("has happens date",t=>this.dates(t).some(n=>n!==null)),e.add("no happens date",t=>!this.dates(t).some(n=>n!==null)),super(e)}fieldName(){return"happens"}fieldNameForExplanation(){return"due, start or scheduled"}date(e){return this.earliestDate(e)}dates(e){return e.happensDates}earliestDate(e){return e.happens.moment}filterResultIfFieldMissing(){return!1}getFilter(e){return t=>this.dates(t).some(n=>e(n))}};var Ul=class extends tn{constructor(){super(),this._filters.add("is recurring",e=>e.recurrence!==null),this._filters.add("is not recurring",e=>e.recurrence===null)}fieldName(){return"recurring"}supportsSorting(){return!0}comparator(){return(e,t)=>e.recurrence!==null&&t.recurrence===null?-1:e.recurrence===null&&t.recurrence!==null?1:0}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?["Recurring"]:["Not Recurring"]}};var ts=class extends tn{constructor(){super(),this._filters.add("done",e=>e.isDone),this._filters.add("not done",e=>!e.isDone)}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=ts.oldStatusName(e),s=ts.oldStatusName(t);return ns?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[ts.oldStatusName(e)]}};var Wl=class extends Pe{fieldNamePlural(){return this.fieldNameSingular()+"s"}fieldName(){return`${this.fieldNameSingular()}/${this.fieldNamePlural()}`}fieldPattern(){return`${this.fieldNameSingular()}|${this.fieldNamePlural()}`}filterOperatorPattern(){return`${super.filterOperatorPattern()}|include|do not include`}value(e){return this.values(e).join(", ")}getFilter(e,t){return n=>{let s=e.matchesAnyOf(this.values(n));return t?!s:s}}createGrouper(e){return new es(this.grouperInstruction(e),this.fieldNamePlural(),this.grouper(),e)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNamePlural()}( reverse)?$`,"i")}grouperInstruction(e){let t=`group by ${this.fieldNamePlural()}`;return e&&(t+=" reverse"),t}};var Us=class extends Wl{constructor(){super();this.filterInstructions=new Bt,this.filterInstructions.add(`has ${this.fieldNameSingular()}`,t=>this.values(t).length>0),this.filterInstructions.add(`has ${this.fieldNamePlural()}`,t=>this.values(t).length>0),this.filterInstructions.add(`no ${this.fieldNameSingular()}`,t=>this.values(t).length===0),this.filterInstructions.add(`no ${this.fieldNamePlural()}`,t=>this.values(t).length===0)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.isValid()?n:super.createFilterOrErrorMessage(t)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}fieldNameSingular(){return"tag"}values(t){return t.tags}supportsSorting(){return!0}createSorterFromLine(t){let n=t.match(this.sorterRegExp());if(n===null)return null;let s=!!n[1],i=isNaN(+n[2])?1:+n[2],a=Us.makeCompareByTagComparator(i);return new Nr(t,this.fieldNameSingular(),a,s)}sorterRegExp(){return/^sort by tag( reverse)?[\s]*(\d+)?/i}comparator(){return Us.makeCompareByTagComparator(1)}static makeCompareByTagComparator(t){return(n,s)=>{if(n.tags.length===0&&s.tags.length===0)return 0;if(n.tags.length===0)return 1;if(s.tags.length===0)return-1;let i=t-1;if(n.tags.length=t)return 1;if(s.tags.length=t)return-1;if(n.tags.lengtht.tags.length==0?["(No tags)"]:t.tags}};var Kw=ua(Vw());var Bl=class extends ke{constructor(){super(...arguments);this.basicBooleanRegexp=/(.*(AND|OR|XOR|NOT)\s*[("].*|\(.+\))/g;this.supportedOperators=["AND","OR","XOR","NOT"];this.subFields={}}filterRegExp(){return this.basicBooleanRegexp}createFilterOrErrorMessage(t){return this.parseLine(t)}fieldName(){return"boolean query"}parseLine(t){if(t.length===0)return re.fromError(t,"empty line");let n=this.preprocessExpression(t);try{let s=(0,Kw.parse)(n);for(let o of s)if(o.name==="IDENTIFIER"&&o.value){let u=o.value.trim();if(!(u in this.subFields)){let l=$l(u);if(l===null)return re.fromError(t,`couldn't parse sub-expression '${u}'`);if(l.error)return re.fromError(t,`couldn't parse sub-expression '${u}': ${l.error}`);l.filter&&(this.subFields[u]=l.filter)}}else if(o.name==="OPERATOR"){if(o.value==null)return re.fromError(t,"empty operator in boolean query");if(!this.supportedOperators.includes(o.value))return re.fromError(t,`unknown boolean operator '${o.value}'`)}let i=(o,u)=>this.filterTaskWithParsedQuery(o,s,u),a=this.constructExplanation(s);return re.fromFilter(new xt(t,i,a))}catch(s){let i=s instanceof Error?s.message:"unknown error type";return re.fromError(t,`malformed boolean query -- ${i} (check the documentation for guidelines)`)}}preprocessExpression(t){return t.replace(/\(([^()]+)\)/g,'("$1")')}filterTaskWithParsedQuery(t,n,s){let i=u=>u==="true",a=u=>u?"true":"false",o=[];for(let u of n)if(u.name==="IDENTIFIER"){if(u.value==null)throw Error("null token value");let c=this.subFields[u.value.trim()].filterFunction(t,s);o.push(a(c))}else if(u.name==="OPERATOR")if(u.value==="NOT"){let l=i(o.pop());o.push(a(!l))}else if(u.value==="OR"){let l=i(o.pop()),c=i(o.pop());o.push(a(l||c))}else if(u.value==="AND"){let l=i(o.pop()),c=i(o.pop());o.push(a(l&&c))}else if(u.value==="XOR"){let l=i(o.pop()),c=i(o.pop());o.push(a(l&&!c||!l&&c))}else throw Error("Unsupported operator: "+u.value);else throw Error("Unsupported token type: "+u);return i(o[0])}constructExplanation(t){let n=[];for(let s of t)if(s.name==="IDENTIFIER"){if(s.value==null)throw Error("null token value");let i=this.subFields[s.value.trim()];n.push(i.explanation)}else if(s.name==="OPERATOR")if(s.value==="NOT"){let i=n.pop();n.push(Me.booleanNot([i]))}else if(s.value==="OR"){let i=n.pop(),a=n.pop();n.push(Me.booleanOr([a,i]))}else if(s.value==="AND"){let i=n.pop(),a=n.pop();n.push(Me.booleanAnd([a,i]))}else if(s.value==="XOR"){let i=n.pop(),a=n.pop();n.push(Me.booleanXor([a,i]))}else throw Error("Unsupported operator: "+s.value);else throw Error("Unsupported token type: "+s.name);return n[0]}};var Hl=class extends Pe{fieldName(){return"filename"}value(e){let t=e.filename;return t===null?"":t+".md"}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;return t===null?["Unknown Location"]:["[["+t+"]]"]}}};var Qi=class extends ke{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return re.fromError(e,"Filtering by urgency is not yet supported")}fieldName(){return"urgency"}filterRegExp(){throw Error(`filterRegExp() unimplemented for ${this.fieldName()}`)}supportsSorting(){return!0}comparator(){return(e,t)=>t.urgency-e.urgency}supportsGrouping(){return!0}grouper(){return e=>[`${e.urgency.toFixed(2)}`]}createGrouper(e){return super.createGrouper(!e)}grouperInstruction(e){return super.grouperInstruction(!e)}};var zl=class extends Pe{constructor(){super()}fieldName(){return"status.name"}value(e){return e.status.name}supportsSorting(){return!0}supportsGrouping(){return!0}};var an=class extends ke{canCreateFilterForLine(e){let t=new RegExp(`^(?:${this.fieldNameSingularEscaped()})`,"i");return ke.lineMatchesFilter(t,e)}createFilterOrErrorMessage(e){let t=ke.getMatch(this.filterRegExp(),e);if(t===null)return this.helpMessage(e);let n=t[1].toLowerCase(),s=t[2],i=er[s.toUpperCase()];if(!i)return this.helpMessage(e);let a;switch(n){case"is":a=o=>o.status.type===i;break;case"is not":a=o=>o.status.type!==i;break;default:return this.helpMessage(e)}return re.fromFilter(new xt(e,a,new Me(e)))}filterRegExp(){return new RegExp(`^(?:${this.fieldNameSingularEscaped()}) (is|is not) ([^ ]+)$`,"i")}helpMessage(e){let t=Object.values(er).filter(s=>s!=="EMPTY").join(" "),n=`Invalid ${this.fieldNameSingular()} instruction: '${e}'. Allowed options: 'is' and 'is not' (without quotes). Allowed values: ${t} Note: values are case-insensitive, so 'in_progress' works too, for example. - Example: ${this.fieldNameSingular()} is not NON_TASK`;return re.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=an.groupName(e),s=an.groupName(t);return n.localeCompare(s,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[an.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var Vl=class extends Pe{fieldName(){return"recurrence"}value(e){return e.recurrence!==null?e.recurrence.toText():""}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?[e.recurrence.toText()]:["None"]}};var Kl=class extends Pe{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(this.value(e))]}};var Ql=class extends Pe{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(this.value(e))]}};var Xl=class extends Pe{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return re.fromError(e,"backlink field does not support filtering")}canCreateFilterForLine(e){return!1}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;if(t===null)return["Unknown Location"];let n=e.precedingHeader;return n===null?["[["+t+"]]"]:[`[[${t}#${n}|${t} > ${n}]]`]}}};var Zl=class extends ht{fieldName(){return"cancelled"}date(e){return e.cancelledDate}filterResultIfFieldMissing(){return!1}};var Jl=class extends tn{constructor(){super(),this._filters.add("is blocking",(e,t)=>e.isBlocking(t.allTasks)),this._filters.add("is not blocking",(e,t)=>!e.isBlocking(t.allTasks)),this._filters.add("is blocked",(e,t)=>e.isBlocked(t.allTasks)),this._filters.add("is not blocked",(e,t)=>!e.isBlocked(t.allTasks))}fieldName(){return"blocking"}};var ec=class extends Pe{constructor(){super();this.filterInstructions=new Bt;this.filterInstructions.add("has id",t=>t.id.length>0),this.filterInstructions.add("no id",t=>t.id.length===0)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.filter!==void 0?n:super.createFilterOrErrorMessage(t)}fieldName(){return"id"}value(t){return t.id}supportsSorting(){return!0}supportsGrouping(){return!0}};var tc=class extends ke{constructor(){super();this.filterInstructions=new Bt;this.filterInstructions.add("has depends on",t=>t.dependsOn.length>0),this.filterInstructions.add("no depends on",t=>t.dependsOn.length===0)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.filter!==void 0?n:re.fromError(t,"Unknown instruction")}fieldName(){return"blocked by"}filterRegExp(){return null}};var wh=[()=>new zl,()=>new an,()=>new ts,()=>new Ul,()=>new Ls,()=>new Ll,()=>new Zl,()=>new Rl,()=>new Fl,()=>new Il,()=>new ji,()=>new Ml,()=>new Gi,()=>new Kl,()=>new Ql,()=>new Xl,()=>new Fs,()=>new Us,()=>new Nl,()=>new Cl,()=>new Hl,()=>new Qi,()=>new Vl,()=>new Pl,()=>new ec,()=>new tc,()=>new Jl,()=>new Bl];function $l(r){for(let e of wh){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function Qw(r){let e=/^sort by /i;if(r.match(e)===null)return null;for(let t of wh){let s=t().createSorterFromLine(r);if(s)return s}return null}function Xw(r){let e=/^group by /i;if(r.match(e)===null)return null;for(let t of wh){let s=t().createGrouperFromLine(r);if(s)return s}return null}var rc=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var nc=class{constructor(e,t){this.lastHeadingAtLevel=new Array;this.groupers=t;let s=e.keys().next().value.length;for(let i=0;it.set(o,a)),e.pop();return t}};var ic=class extends sc{},ac=class{constructor(e,t,n){this.root=new ic(t),this.buildGroupingTree(e,n)}buildGroupingTree(e,t){let n=[this.root];for(let s of e){let i=[];for(let a of n)for(let o of a.values){let u=s.grouper(o,t);u.length===0&&u.push("");for(let l of u){let c=a.children.get(l);c===void 0&&(c=new ic([]),a.children.set(l,c),i.push(c)),c.values.push(o)}}n=i}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var oc=class{constructor(e,t){this.groups=e,this.groupHeadings=[],this.tasks=t}setGroupHeadings(e){for(let t of e)this.groupHeadings.push(t)}applyTaskLimit(e){this.tasks=this.tasks.slice(0,e)}tasksAsStringOfLines(){let e="";for(let t of this.tasks)e+=t.toFileLineString()+` + Example: ${this.fieldNameSingular()} is not NON_TASK`;return re.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=an.groupName(e),s=an.groupName(t);return n.localeCompare(s,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[an.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var Vl=class extends Pe{fieldName(){return"recurrence"}value(e){return e.recurrence!==null?e.recurrence.toText():""}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?[e.recurrence.toText()]:["None"]}};var Kl=class extends Pe{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(this.value(e))]}};var Ql=class extends Pe{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Pe.escapeMarkdownCharacters(this.value(e))]}};var Xl=class extends Pe{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return re.fromError(e,"backlink field does not support filtering")}canCreateFilterForLine(e){return!1}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;if(t===null)return["Unknown Location"];let n=e.precedingHeader;return n===null?["[["+t+"]]"]:[`[[${t}#${n}|${t} > ${n}]]`]}}};var Zl=class extends ht{fieldName(){return"cancelled"}date(e){return e.cancelledDate}filterResultIfFieldMissing(){return!1}};var Jl=class extends tn{constructor(){super(),this._filters.add("is blocking",(e,t)=>e.isBlocking(t.allTasks)),this._filters.add("is not blocking",(e,t)=>!e.isBlocking(t.allTasks)),this._filters.add("is blocked",(e,t)=>e.isBlocked(t.allTasks)),this._filters.add("is not blocked",(e,t)=>!e.isBlocked(t.allTasks))}fieldName(){return"blocking"}};var ec=class extends Pe{constructor(){super();this.filterInstructions=new Bt;this.filterInstructions.add("has id",t=>t.id.length>0),this.filterInstructions.add("no id",t=>t.id.length===0)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.isValid()?n:super.createFilterOrErrorMessage(t)}fieldName(){return"id"}value(t){return t.id}supportsSorting(){return!0}supportsGrouping(){return!0}};var tc=class extends ke{constructor(){super();this.filterInstructions=new Bt;this.filterInstructions.add("has depends on",t=>t.dependsOn.length>0),this.filterInstructions.add("no depends on",t=>t.dependsOn.length===0)}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);return n.isValid()?n:re.fromError(t,"Unknown instruction")}fieldName(){return"blocked by"}filterRegExp(){return null}};var wh=[()=>new zl,()=>new an,()=>new ts,()=>new Ul,()=>new Ls,()=>new Ll,()=>new Zl,()=>new Rl,()=>new Fl,()=>new Il,()=>new ji,()=>new Ml,()=>new Gi,()=>new Kl,()=>new Ql,()=>new Xl,()=>new Fs,()=>new Us,()=>new Nl,()=>new Cl,()=>new Hl,()=>new Qi,()=>new Vl,()=>new Pl,()=>new ec,()=>new tc,()=>new Jl,()=>new Bl];function $l(r){for(let e of wh){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function Qw(r){let e=/^sort by /i;if(r.match(e)===null)return null;for(let t of wh){let s=t().createSorterFromLine(r);if(s)return s}return null}function Xw(r){let e=/^group by /i;if(r.match(e)===null)return null;for(let t of wh){let s=t().createGrouperFromLine(r);if(s)return s}return null}var rc=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var nc=class{constructor(e,t){this.lastHeadingAtLevel=new Array;this.groupers=t;let s=e.keys().next().value.length;for(let i=0;it.set(o,a)),e.pop();return t}};var ic=class extends sc{},ac=class{constructor(e,t,n){this.root=new ic(t),this.buildGroupingTree(e,n)}buildGroupingTree(e,t){let n=[this.root];for(let s of e){let i=[];for(let a of n)for(let o of a.values){let u=s.grouper(o,t);u.length===0&&u.push("");for(let l of u){let c=a.children.get(l);c===void 0&&(c=new ic([]),a.children.set(l,c),i.push(c)),c.values.push(o)}}n=i}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var oc=class{constructor(e,t){this.groups=e,this.groupHeadings=[],this.tasks=t}setGroupHeadings(e){for(let t of e)this.groupHeadings.push(t)}applyTaskLimit(e){this.tasks=this.tasks.slice(0,e)}tasksAsStringOfLines(){let e="";for(let t of this.tasks)e+=t.toFileLineString()+` `;return e}toString(){let e=` `;e+=`Group names: [${this.groups}] `;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName} @@ -283,7 +283,7 @@ but no file path has been supplied, so cannot expand placeholder values. The query is: ${e}`,e;let n=e;if(t){let s=Nw(t);try{n=Pw(e,s)}catch(i){return i instanceof Error?this._error=i.message:this._error="Internal error. expandPlaceholders() threw something other than Error.",e}}return n}append(e){return this.source===""?e:e.source===""?this:new Pn(`${this.source} ${e.source}`,this.filePath)}explainQuery(){return new Ui().explainQuery(this)}get limit(){return this._limit}get taskGroupLimit(){return this._taskGroupLimit}get taskLayoutOptions(){return this._taskLayoutOptions}get queryLayoutOptions(){return this._queryLayoutOptions}get filters(){return this._filters}addFilter(e){this._filters.push(e)}get sorting(){return this._sorting}get grouping(){return this._grouping}get error(){return this._error}setError(e,t){this._error=`${e} -Problem line: "${t}"`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){this.debug(`Executing query: ${this.formatQueryForLogging()}`);let t=new rs(this.filePath,e);try{this.filters.forEach(o=>{e=e.filter(u=>o.filterFunction(u,t))});let{debugSettings:n}=ee(),s=n.ignoreSortInstructions?e:Zi.by(this.sorting,e,t),i=s.slice(0,this.limit),a=new Xi(this.grouping,i,t);return this._taskGroupLimit!==void 0&&a.applyTaskLimit(this._taskGroupLimit),new js(a,s.length)}catch(n){let s="Search failed";return js.fromError(Is(s,n))}}parseHideOptions(e){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1].toLowerCase()==="hide";switch(t[2].toLowerCase()){case"task count":this._queryLayoutOptions.hideTaskCount=n;break;case"backlink":this._queryLayoutOptions.hideBacklinks=n;break;case"postpone button":this._queryLayoutOptions.hidePostponeButton=n;break;case"priority":this._taskLayoutOptions.setVisibility("priority",!n);break;case"cancelled date":this._taskLayoutOptions.setVisibility("cancelledDate",!n);break;case"created date":this._taskLayoutOptions.setVisibility("createdDate",!n);break;case"start date":this._taskLayoutOptions.setVisibility("startDate",!n);break;case"scheduled date":this._taskLayoutOptions.setVisibility("scheduledDate",!n);break;case"due date":this._taskLayoutOptions.setVisibility("dueDate",!n);break;case"done date":this._taskLayoutOptions.setVisibility("doneDate",!n);break;case"recurrence rule":this._taskLayoutOptions.setVisibility("recurrenceRule",!n);break;case"edit button":this._queryLayoutOptions.hideEditButton=n;break;case"urgency":this._queryLayoutOptions.hideUrgency=n;break;case"tags":this._taskLayoutOptions.setTagsVisibility(!n);break;case"id":this._taskLayoutOptions.setVisibility("id",!n);break;case"depends on":this._taskLayoutOptions.setVisibility("dependsOn",!n);break;default:this.setError("do not understand hide/show option",e)}}}parseFilter(e){var n;let t=$l(e);return t!=null?(t.filter?this._filters.push(t.filter):this.setError((n=t.error)!=null?n:"Unknown error",e),!0):!1}parseLimit(e){let t=e.match(this.limitRegexp);if(t===null){this.setError("do not understand query limit",e);return}let n=Number.parseInt(t[3],10);t[1]!==void 0?this._taskGroupLimit=n:this._limit=n}parseSortBy(e){let t=Qw(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=Xw(e);return t?(this._grouping.push(t),!0):!1}generateQueryId(e){let t="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";return Array.from({length:e},()=>t[Math.floor(Math.random()*t.length)]).join("")}debug(e,t){this.logger.debugWithId(this._queryId,`"${this.filePath}": ${e}`,t)}};var ns=class{constructor(e=ns.empty){this._source=e}static getInstance(){return ns.instance||(ns.instance=new ns),ns.instance}set(e){this._source=e}query(e=void 0){return new Pn(this._source,e)}hasInstructions(){return this._source.trim()!==ns.empty}},Er=ns;Er.empty="";var uc=class{constructor({obsidianEvents:e}){this.logger=Ft.getLogger("tasks.Events");this.obsidianEvents=e}onCacheUpdate(e){return this.logger.debug("TasksEvents.onCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.logger.debug("TasksEvents.triggerCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.logger.debug("TasksEvents.onRequestCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.logger.debug("TasksEvents.triggerRequestCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.logger.debug("TasksEvents.off()"),this.obsidianEvents.offref(e)}};var ik=require("obsidian");var sk=require("obsidian");var kh=class{constructor(e){this.newStatus=e}apply(e){return this.isCheckedForTask(e)?[e]:e.handleNewStatusWithRecurrenceInUsersOrder(this.newStatus)}instructionDisplayName(){return`Change status to: [${this.newStatus.symbol}] ${this.newStatus.name}`}isCheckedForTask(e){return this.newStatus.symbol===e.status.symbol}};function rk(r){let e=[],t=new Ue().coreStatuses.map(n=>n.symbol);for(let n of[!0,!1])for(let s of r.registeredStatuses)t.includes(s.symbol)===n&&e.push(new kh(s));return e}var nk=require("obsidian");function Uo(r,e){return L(this,null,function*(){yield Zr({originalTask:r,newTasks:e})})}var Ji=class extends nk.Menu{constructor(t){super();this.taskSaver=t}addItemsForInstructions(t,n){for(let s of t)this.addItemForInstruction(n,s)}addItemForInstruction(t,n){this.addItem(s=>this.getMenuItemCallback(t,s,n))}getMenuItemCallback(t,n,s){n.setTitle(s.instructionDisplayName()).setChecked(s.isCheckedForTask(t)).onClick(()=>L(this,null,function*(){let i=s.apply(t);(i.length!==1||!Object.is(i[0],t))&&(yield this.taskSaver(t,i))}))}};var lc=class extends Ji{constructor(e,t,n=Uo){super(n);let s=rk(e);this.addItemsForInstructions(s,t)}};var cc=class{constructor(){this.data=BI}addDataAttribute(e,t,n){this.data[n].addDataAttribute(e,t,n)}addClassName(e,t){let n=this.data[t].className;e.classList.add(n)}},Eh=class{constructor(e,t,n){if(e==="")throw Error("Developer note: CSS class cannot be an empty string, please specify one.");this.className=e,this.attributeName=t,this.attributeValueCalculator=n}addDataAttribute(e,t,n){if(this.attributeName===Eh.noAttributeName)return;let s=this.attributeValueCalculator(n,t);s!==""&&(e.dataset[this.attributeName]=s)}},Fr=Eh;Fr.noAttributeName="",Fr.noAttributeValueCalculator=()=>"",Fr.dateAttributeCalculator=(e,t)=>{let s="far";function i(o){let u=window.moment().startOf("day"),l="",c=u.diff(o,"days");return isNaN(c)?null:c===0?"today":(c>0?l+="past-":c<0&&(l+="future-"),Math.abs(c)<=7?l+=Math.abs(c).toString()+"d":l+=s,l)}let a=t[e];if(!Array.isArray(a)&&a instanceof window.moment){let o=i(a);if(o)return o}return""};function Wo(r){return new Fr(r,Fr.noAttributeName,Fr.noAttributeValueCalculator)}function ea(r,e){return new Fr(r,e,Fr.dateAttributeCalculator)}var BI={createdDate:ea("task-created","taskCreated"),dueDate:ea("task-due","taskDue"),startDate:ea("task-start","taskStart"),scheduledDate:ea("task-scheduled","taskScheduled"),doneDate:ea("task-done","taskDone"),cancelledDate:ea("task-cancelled","taskCancelled"),priority:new Fr("task-priority","taskPriority",(r,e)=>Sn.priorityNameUsingNormal(e.priority).toLocaleLowerCase()),description:Wo("task-description"),recurrenceRule:Wo("task-recurring"),dependsOn:Wo("task-dependsOn"),id:Wo("task-id"),blockLink:Wo("task-block-link")};function ir(r,e){let t=document.createElement(r);return e.appendChild(t),t}var ss=class{static obsidianMarkdownRenderer(e,t,n,s){return L(this,null,function*(){if(!s)throw new Error("Must call the Obsidian renderer with an Obsidian Component object");yield sk.MarkdownRenderer.renderMarkdown(e,t,n,s)})}constructor({textRenderer:e=ss.obsidianMarkdownRenderer,obsidianComponent:t,parentUlElement:n,taskLayoutOptions:s,queryLayoutOptions:i}){this.textRenderer=e,this.obsidianComponent=t,this.parentUlElement=n,this.taskLayoutOptions=s,this.queryLayoutOptions=i}renderTaskLine(e,t,n){return L(this,null,function*(){let s=ir("li",this.parentUlElement);s.classList.add("task-list-item","plugin-tasks-list-item");let i=ir("span",s);i.classList.add("tasks-list-text"),yield this.taskToHtml(e,i,s);let a=ir("input",s);return a.classList.add("task-list-item-checkbox"),a.type="checkbox",e.status.symbol!==" "&&(a.checked=!0,s.classList.add("is-checked")),a.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),a.disabled=!0;let u=e.toggleWithRecurrenceInUsersOrder();Zr({originalTask:e,newTasks:u})}),a.addEventListener("contextmenu",o=>{new lc(Oe.getInstance(),e).showAtPosition({x:o.clientX,y:o.clientY})}),a.setAttribute("title","Right-click for options"),s.prepend(a),s.setAttribute("data-task",e.status.symbol.trim()),s.setAttribute("data-line",t.toString()),s.setAttribute("data-task-status-name",e.status.name),s.setAttribute("data-task-status-type",e.status.type),a.setAttribute("data-line",t.toString()),this.queryLayoutOptions.shortMode&&this.addTooltip(e,i,n),s})}taskToHtml(e,t,n){return L(this,null,function*(){let s=new cc,i=En.tasksPluginEmoji.taskSerializer;for(let a of this.taskLayoutOptions.shownComponents){let o=i.componentToString(e,this.queryLayoutOptions.shortMode,a);if(o){let u=ir("span",t),l=ir("span",u);yield this.renderComponentText(l,o,a,e),this.addInternalClasses(a,l),s.addClassName(u,a),s.addDataAttribute(u,e,a),s.addDataAttribute(n,e,a)}}for(let a of this.taskLayoutOptions.hiddenComponents)s.addDataAttribute(n,e,a);n.dataset.taskPriority===void 0&&s.addDataAttribute(n,e,"priority")})}renderComponentText(e,t,n,s){return L(this,null,function*(){if(n==="description"){t=ye.getInstance().removeAsWordFromDependingOnSettings(t);let{debugSettings:i}=ee();i.showTaskHiddenData&&(t+=`
\u{1F41B} ${s.lineNumber} . ${s.sectionStart} . ${s.sectionIndex} . '${s.originalMarkdown}'
'${s.path}' > '${s.precedingHeader}'
`),yield this.textRenderer(t,e,s.path,this.obsidianComponent);let a=e.querySelector("blockquote"),o=a!=null?a:e,u=o.querySelector("p");if(u!==null){for(;u.firstChild;)o.insertBefore(u.firstChild,u);u.remove()}e.querySelectorAll("p").forEach(l=>{l.hasChildNodes()||l.remove()}),e.querySelectorAll(".footnotes").forEach(l=>{l.remove()})}else e.innerHTML=t})}addInternalClasses(e,t){function n(s){let i=/["&\x00\r\n]/g,a=s.replace(i,"-");return a=a.replace(/^[-_]+/,""),a.length>0?a:null}if(e==="description"){let s=t.getElementsByClassName("tag");for(let i=0;i{function f(g,E,C){E&&g.createDiv().setText(p({signifier:C,date:E}))}function p({signifier:g,date:E}){return`${g} ${E.format(Z.dateFormat)} (${E.from(window.moment().startOf("day"))})`}let m=t.createDiv();m.addClasses(["tooltip","pop-up"]),e.recurrence&&m.createDiv().setText(`${s} ${e.recurrence.toText()}`),f(m,e.createdDate,a),f(m,e.startDate,i),f(m,e.scheduledDate,o),f(m,e.dueDate,u),f(m,e.cancelledDate,l),f(m,e.doneDate,c);let _=e.getLinkText({isFilenameUnique:n});_&&m.createDiv().setText(`\u{1F517} ${_}`),t.addEventListener("mouseleave",()=>{m.remove()})})}};var dc=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return L(this,null,function*(){var f;let n=new ik.MarkdownRenderChild(e);t.addChild(n);let s=e.findAll(".task-list-item").filter(p=>{var g;let m=(g=p.textContent)==null?void 0:g.split(` +Problem line: "${t}"`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){this.debug(`Executing query: ${this.formatQueryForLogging()}`);let t=new rs(this.filePath,e);try{this.filters.forEach(o=>{e=e.filter(u=>o.filterFunction(u,t))});let{debugSettings:n}=ee(),s=n.ignoreSortInstructions?e:Zi.by(this.sorting,e,t),i=s.slice(0,this.limit),a=new Xi(this.grouping,i,t);return this._taskGroupLimit!==void 0&&a.applyTaskLimit(this._taskGroupLimit),new js(a,s.length)}catch(n){let s="Search failed";return js.fromError(Is(s,n))}}parseHideOptions(e){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1].toLowerCase()==="hide";switch(t[2].toLowerCase()){case"task count":this._queryLayoutOptions.hideTaskCount=n;break;case"backlink":this._queryLayoutOptions.hideBacklinks=n;break;case"postpone button":this._queryLayoutOptions.hidePostponeButton=n;break;case"priority":this._taskLayoutOptions.setVisibility("priority",!n);break;case"cancelled date":this._taskLayoutOptions.setVisibility("cancelledDate",!n);break;case"created date":this._taskLayoutOptions.setVisibility("createdDate",!n);break;case"start date":this._taskLayoutOptions.setVisibility("startDate",!n);break;case"scheduled date":this._taskLayoutOptions.setVisibility("scheduledDate",!n);break;case"due date":this._taskLayoutOptions.setVisibility("dueDate",!n);break;case"done date":this._taskLayoutOptions.setVisibility("doneDate",!n);break;case"recurrence rule":this._taskLayoutOptions.setVisibility("recurrenceRule",!n);break;case"edit button":this._queryLayoutOptions.hideEditButton=n;break;case"urgency":this._queryLayoutOptions.hideUrgency=n;break;case"tags":this._taskLayoutOptions.setTagsVisibility(!n);break;case"id":this._taskLayoutOptions.setVisibility("id",!n);break;case"depends on":this._taskLayoutOptions.setVisibility("dependsOn",!n);break;default:this.setError("do not understand hide/show option",e)}}}parseFilter(e){var n;let t=$l(e);return t!=null?(t.filter?this._filters.push(t.filter):this.setError((n=t.error)!=null?n:"Unknown error",e),!0):!1}parseLimit(e){let t=e.match(this.limitRegexp);if(t===null){this.setError("do not understand query limit",e);return}let n=Number.parseInt(t[3],10);t[1]!==void 0?this._taskGroupLimit=n:this._limit=n}parseSortBy(e){let t=Qw(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=Xw(e);return t?(this._grouping.push(t),!0):!1}generateQueryId(e){let t="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";return Array.from({length:e},()=>t[Math.floor(Math.random()*t.length)]).join("")}debug(e,t){this.logger.debugWithId(this._queryId,`"${this.filePath}": ${e}`,t)}};var ns=class{constructor(e=ns.empty){this._source=e}static getInstance(){return ns.instance||(ns.instance=new ns),ns.instance}set(e){this._source=e}query(e=void 0){return new Pn(this._source,e)}hasInstructions(){return this._source.trim()!==ns.empty}},Er=ns;Er.empty="";var uc=class{constructor({obsidianEvents:e}){this.logger=Ft.getLogger("tasks.Events");this.obsidianEvents=e}onCacheUpdate(e){return this.logger.debug("TasksEvents.onCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.logger.debug("TasksEvents.triggerCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.logger.debug("TasksEvents.onRequestCacheUpdate()"),this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.logger.debug("TasksEvents.triggerRequestCacheUpdate()"),this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.logger.debug("TasksEvents.off()"),this.obsidianEvents.offref(e)}};var ik=require("obsidian");var sk=require("obsidian");var kh=class{constructor(e){this.newStatus=e}apply(e){return this.isCheckedForTask(e)?[e]:e.handleNewStatusWithRecurrenceInUsersOrder(this.newStatus)}instructionDisplayName(){return`Change status to: [${this.newStatus.symbol}] ${this.newStatus.name}`}isCheckedForTask(e){return this.newStatus.symbol===e.status.symbol}};function rk(r){let e=[],t=new Ue().coreStatuses.map(n=>n.symbol);for(let n of[!0,!1])for(let s of r.registeredStatuses)t.includes(s.symbol)===n&&e.push(new kh(s));return e}var nk=require("obsidian");function Uo(r,e){return L(this,null,function*(){yield Zr({originalTask:r,newTasks:e})})}var Ji=class extends nk.Menu{constructor(t){super();this.taskSaver=t}addItemsForInstructions(t,n){for(let s of t)this.addItemForInstruction(n,s)}addItemForInstruction(t,n){this.addItem(s=>this.getMenuItemCallback(t,s,n))}getMenuItemCallback(t,n,s){n.setTitle(s.instructionDisplayName()).setChecked(s.isCheckedForTask(t)).onClick(()=>L(this,null,function*(){let i=s.apply(t);(i.length!==1||!Object.is(i[0],t))&&(yield this.taskSaver(t,i))}))}};var lc=class extends Ji{constructor(e,t,n=Uo){super(n);let s=rk(e);this.addItemsForInstructions(s,t)}};var cc=class{constructor(){this.data=BI}addDataAttribute(e,t,n){this.data[n].addDataAttribute(e,t,n)}addClassName(e,t){let n=this.data[t].className;e.classList.add(n)}},Eh=class{constructor(e,t,n){if(e==="")throw Error("Developer note: CSS class cannot be an empty string, please specify one.");this.className=e,this.attributeName=t,this.attributeValueCalculator=n}addDataAttribute(e,t,n){if(this.attributeName===Eh.noAttributeName)return;let s=this.attributeValueCalculator(n,t);s!==""&&(e.dataset[this.attributeName]=s)}},Fr=Eh;Fr.noAttributeName="",Fr.noAttributeValueCalculator=()=>"",Fr.dateAttributeCalculator=(e,t)=>{let s="far";function i(o){let u=window.moment().startOf("day"),l="",c=u.diff(o,"days");return isNaN(c)?null:c===0?"today":(c>0?l+="past-":c<0&&(l+="future-"),Math.abs(c)<=7?l+=Math.abs(c).toString()+"d":l+=s,l)}let a=t[e];if(!Array.isArray(a)&&a instanceof window.moment){let o=i(a);if(o)return o}return""};function Wo(r){return new Fr(r,Fr.noAttributeName,Fr.noAttributeValueCalculator)}function ea(r,e){return new Fr(r,e,Fr.dateAttributeCalculator)}var BI={createdDate:ea("task-created","taskCreated"),dueDate:ea("task-due","taskDue"),startDate:ea("task-start","taskStart"),scheduledDate:ea("task-scheduled","taskScheduled"),doneDate:ea("task-done","taskDone"),cancelledDate:ea("task-cancelled","taskCancelled"),priority:new Fr("task-priority","taskPriority",(r,e)=>Sn.priorityNameUsingNormal(e.priority).toLocaleLowerCase()),description:Wo("task-description"),recurrenceRule:Wo("task-recurring"),dependsOn:Wo("task-dependsOn"),id:Wo("task-id"),blockLink:Wo("task-block-link")};function ir(r,e){let t=document.createElement(r);return e.appendChild(t),t}var ss=class{static obsidianMarkdownRenderer(e,t,n,s){return L(this,null,function*(){if(!s)throw new Error("Must call the Obsidian renderer with an Obsidian Component object");yield sk.MarkdownRenderer.renderMarkdown(e,t,n,s)})}constructor({textRenderer:e=ss.obsidianMarkdownRenderer,obsidianComponent:t,parentUlElement:n,taskLayoutOptions:s,queryLayoutOptions:i}){this.textRenderer=e,this.obsidianComponent=t,this.parentUlElement=n,this.taskLayoutOptions=s,this.queryLayoutOptions=i}renderTaskLine(e,t,n){return L(this,null,function*(){let s=ir("li",this.parentUlElement);s.classList.add("task-list-item","plugin-tasks-list-item");let i=ir("span",s);i.classList.add("tasks-list-text"),yield this.taskToHtml(e,i,s);let a=ir("input",s);return a.classList.add("task-list-item-checkbox"),a.type="checkbox",e.status.symbol!==" "&&(a.checked=!0,s.classList.add("is-checked")),e.taskLocation.hasKnownPath&&(a.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),a.disabled=!0;let l=e.toggleWithRecurrenceInUsersOrder();Zr({originalTask:e,newTasks:l})}),a.addEventListener("contextmenu",u=>{new lc(Oe.getInstance(),e).showAtPosition({x:u.clientX,y:u.clientY})}),a.setAttribute("title","Right-click for options")),s.prepend(a),s.setAttribute("data-task",e.status.symbol.trim()),s.setAttribute("data-line",t.toString()),s.setAttribute("data-task-status-name",e.status.name),s.setAttribute("data-task-status-type",e.status.type),a.setAttribute("data-line",t.toString()),this.queryLayoutOptions.shortMode&&this.addTooltip(e,i,n),s})}taskToHtml(e,t,n){return L(this,null,function*(){let s=new cc,i=En.tasksPluginEmoji.taskSerializer;for(let a of this.taskLayoutOptions.shownComponents){let o=i.componentToString(e,this.queryLayoutOptions.shortMode,a);if(o){let u=ir("span",t),l=ir("span",u);yield this.renderComponentText(l,o,a,e),this.addInternalClasses(a,l),s.addClassName(u,a),s.addDataAttribute(u,e,a),s.addDataAttribute(n,e,a)}}for(let a of this.taskLayoutOptions.hiddenComponents)s.addDataAttribute(n,e,a);n.dataset.taskPriority===void 0&&s.addDataAttribute(n,e,"priority")})}renderComponentText(e,t,n,s){return L(this,null,function*(){if(n==="description"){t=ye.getInstance().removeAsWordFromDependingOnSettings(t);let{debugSettings:i}=ee();i.showTaskHiddenData&&(t+=`
\u{1F41B} ${s.lineNumber} . ${s.sectionStart} . ${s.sectionIndex} . '${s.originalMarkdown}'
'${s.path}' > '${s.precedingHeader}'
`),yield this.textRenderer(t,e,s.path,this.obsidianComponent);let a=e.querySelector("blockquote"),o=a!=null?a:e,u=o.querySelector("p");if(u!==null){for(;u.firstChild;)o.insertBefore(u.firstChild,u);u.remove()}e.querySelectorAll("p").forEach(l=>{l.hasChildNodes()||l.remove()}),e.querySelectorAll(".footnotes").forEach(l=>{l.remove()})}else e.innerHTML=t})}addInternalClasses(e,t){function n(s){let i=/["&\x00\r\n]/g,a=s.replace(i,"-");return a=a.replace(/^[-_]+/,""),a.length>0?a:null}if(e==="description"){let s=t.getElementsByClassName("tag");for(let i=0;i{function f(g,E,C){E&&g.createDiv().setText(p({signifier:C,date:E}))}function p({signifier:g,date:E}){return`${g} ${E.format(Z.dateFormat)} (${E.from(window.moment().startOf("day"))})`}let m=t.createDiv();m.addClasses(["tooltip","pop-up"]),e.recurrence&&m.createDiv().setText(`${s} ${e.recurrence.toText()}`),f(m,e.createdDate,a),f(m,e.startDate,i),f(m,e.scheduledDate,o),f(m,e.dueDate,u),f(m,e.cancelledDate,l),f(m,e.doneDate,c);let _=e.getLinkText({isFilenameUnique:n});_&&m.createDiv().setText(`\u{1F517} ${_}`),t.addEventListener("mouseleave",()=>{m.remove()})})}};var dc=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return L(this,null,function*(){var f;let n=new ik.MarkdownRenderChild(e);t.addChild(n);let s=e.findAll(".task-list-item").filter(p=>{var g;let m=(g=p.textContent)==null?void 0:g.split(` `);if(m===void 0)return!1;let _=null;for(let E=0;Eak.ViewPlugin.fromClass(Sh),Sh=class{constructor(e){this.view=e,this.handleClickEvent=this.handleClickEvent.bind(this),this.view.dom.addEventListener("click",this.handleClickEvent)}destroy(){this.view.dom.removeEventListener("click",this.handleClickEvent)}handleClickEvent(e){let{target:t}=e;if(!t||!(t instanceof HTMLInputElement)||t.type!=="checkbox")return!1;let n=t.closest("ul.plugin-tasks-query-result, div.callout-content");if(n){if(n.matches("div.callout-content")){let p=`obsidian-tasks-plugin warning: Tasks cannot add or remove completion dates or make the next copy of a recurring task for tasks written inside a callout when you click their checkboxes in Live Preview. If you wanted Tasks to do these things, please undo your change, then either click the line of the task and use the "Toggle Task Done" command, or switch to Reading View to click the checkbox.`;console.warn(p),new ok.Notice(p,45e3)}return!1}let{state:s}=this.view,i=this.view.posAtDOM(t),a=s.doc.lineAt(i),o=oe.fromLine({line:a.text,taskLocation:vt.fromUnknownPosition(""),fallbackDate:null});if(o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(p=>p.toFileLineString()).join(s.lineBreak),c=s.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let f=t.checked;return setTimeout(()=>{t.checked=f},1),!0}};var ta=require("obsidian");function qo(r,e,t){e&&r.push($I(t))}function $I(r){return`tasks-layout-hide-${r}`}var fc=class{constructor(e){e?this.queryLayoutOptions=e:this.queryLayoutOptions=new Zn}getHiddenClasses(){let e=[],t=[[this.queryLayoutOptions.hideUrgency,"urgency"],[this.queryLayoutOptions.hideBacklinks,"backlinks"],[this.queryLayoutOptions.hideEditButton,"edit-button"],[this.queryLayoutOptions.hidePostponeButton,"postpone-button"]];for(let[n,s]of t)qo(e,n,s);return this.queryLayoutOptions.shortMode&&e.push("tasks-layout-short-mode"),e}};function lk(r,e,t,n=void 0){let s="";e.isEmpty()||(s+=`Only tasks containing the global filter '${e.get()}'. diff --git a/.obsidian/plugins/obsidian-tasks-plugin/manifest.json b/.obsidian/plugins/obsidian-tasks-plugin/manifest.json index 2ddd503..207e9ad 100644 --- a/.obsidian/plugins/obsidian-tasks-plugin/manifest.json +++ b/.obsidian/plugins/obsidian-tasks-plugin/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-tasks-plugin", "name": "Tasks", - "version": "6.1.1", + "version": "6.1.2", "minAppVersion": "1.1.1", "description": "Task management for Obsidian", "helpUrl": "https://publish.obsidian.md/tasks/", diff --git a/.obsidian/plugins/periodic-para/main.js b/.obsidian/plugins/periodic-para/main.js index b33db73..70cc343 100644 --- a/.obsidian/plugins/periodic-para/main.js +++ b/.obsidian/plugins/periodic-para/main.js @@ -39162,12 +39162,10 @@ ${finalRecordContent} if (isResourceExists) { return; } - const { data: data2 } = await this.axios.get( - `${origin}/o/r/${resource.name || resource.id}`, - { - responseType: "arraybuffer" - } - ); + const resourceURL = resource.externalLink || `${origin}/o/r/${resource.name || resource.id}`; + const { data: data2 } = await this.axios.get(resourceURL, { + responseType: "arraybuffer" + }); if (!data2) { return; } @@ -77710,6 +77708,8 @@ var PeriodicPARA = class extends import_obsidian14.Plugin { }; } onunload() { + clearTimeout(this.timeout); + clearInterval(this.interval); } async loadSettings() { this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); diff --git a/.obsidian/plugins/periodic-para/manifest.json b/.obsidian/plugins/periodic-para/manifest.json index 3ee8aba..71b2221 100644 --- a/.obsidian/plugins/periodic-para/manifest.json +++ b/.obsidian/plugins/periodic-para/manifest.json @@ -1,9 +1,9 @@ { "id": "periodic-para", - "name": "Periodic PARA", - "version": "1.11.3", + "name": "LifeOS", + "version": "1.12.0", "minAppVersion": "0.15.0", - "description": "Assist in practicing the PARA method with periodic notes and usememos.", + "description": "Life management system(Assist in practicing the PARA method with periodic notes and usememos).", "author": "YiBing Lin", "authorUrl": "https://quanru.github.io", "fundingUrl": "https://www.buymeacoffee.com/leyang", diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index d49c91c..8ba9aa3 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -158,13 +158,13 @@ }, "left-ribbon": { "hiddenItems": { - "switcher:Open quick switcher": false, - "graph:Open graph view": false, - "canvas:Create new canvas": false, - "daily-notes:Open today's daily note": false, - "command-palette:Open command palette": false, - "random-note:Open random note": false, - "workspaces:Manage workspace layouts": false, + "switcher:打开快速切换": false, + "graph:查看关系图谱": false, + "canvas:新建白板": false, + "daily-notes:打开/创建今天的日记": false, + "command-palette:打开命令面板": false, + "random-note:开始漫游笔记": false, + "workspaces:管理工作区布局": false, "templater-obsidian:Templater": false, "periodic-para:Periodic PARA": false } diff --git a/README.md b/README.md index b840c32..3641c6a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ - [Download](https://github.com/quanru/obsidian-example-LifeOS/releases/latest/download/LifeOS.zip) -## Periodic Para Plugin +## LifeOS Plugin - [README.md](https://github.com/quanru/obsidian-periodic-para)