Repository: obsidian-tasks-group/obsidian-tasks
Pull request #2940 (2024-07-06 10:32:31)

feat: Experimental access to raw frontmatter in query.file & task.file
# Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

Changes visible to users:

- [x] **New feature** (prefix: `feat` - non-breaking change which adds functionality)
  - Issue/discussion: https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2480

Internal changes:

- [x] **Refactor** (prefix: `refactor` - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
- [x] **Tests** (prefix: `test` - additions and improvements to unit tests and the smoke tests)

## Description

Experimental implementation of the following, for `filter by function` etc:

- `query.file.frontmatter`
- `task.file.frontmatter`
<!--- Remember to provide a general summary of your changes in the Title above -->

<!--- Describe your changes in detail -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How has this been tested?

In the sample vault, and some new tests

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

## Screenshots (if appropriate)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [x] My code follows the code style of this project and passes `yarn run lint`.
- [x] My change requires a change to the documentation.
- [ ] I have [updated the documentation](https://publish.obsidian.md/tasks-contributing/Documentation/About+Documentation) accordingly.
- [ ] My change has adequate [Unit Test coverage](https://publish.obsidian.md/tasks-contributing/Testing/About+Testing).

## Terms

<!--
By submitting this pull request, you must agree to follow our
[contributing guide](https://publish.obsidian.md/tasks-contributing) and
[Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md).
Put an x in the boxes to confirm you agree.
-->

- [x] My contribution follows this project's [contributing guide](https://publish.obsidian.md/tasks-contributing)
- [x] I agree to follow this project's [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md)



Patch:
diff --git a/docs/Queries/Grouping.md b/docs/Queries/Grouping.md
index e3ab97c5..2d9f5f36 100644
--- a/docs/Queries/Grouping.md
+++ b/docs/Queries/Grouping.md
@@ -249,7 +249,7 @@ group by function task.due.fromNow.groupText
 ```
 
 - Group by the [time from now](https://momentjs.com/docs/#/displaying/fromnow/), for example `8 days ago`, `in 11 hours`.
-- It uses an empty string (so no heading) if there is no due date.
+- It users an empty string (so no heading) if there is no due date.
 - The values `task.due.fromNow.name` and `task.due.fromNow.sortOrder` are also available.
 
 ```javascript
diff --git a/docs/Scripting/Custom Grouping.md b/docs/Scripting/Custom Grouping.md
index dca51c31..8719f66e 100644
--- a/docs/Scripting/Custom Grouping.md
+++ b/docs/Scripting/Custom Grouping.md
@@ -136,7 +136,7 @@ group by function task.due.fromNow.groupText
 ```
 
 - Group by the [time from now](https://momentjs.com/docs/#/displaying/fromnow/), for example `8 days ago`, `in 11 hours`.
-- It uses an empty string (so no heading) if there is no due date.
+- It users an empty string (so no heading) if there is no due date.
 - The values `task.due.fromNow.name` and `task.due.fromNow.sortOrder` are also available.
 
 ```javascript
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/appearance.json b/resources/sample_vaults/Tasks-Demo/.obsidian/appearance.json
index 439dd7c7..e14039fb 100644
--- a/resources/sample_vaults/Tasks-Demo/.obsidian/appearance.json
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/appearance.json
@@ -1,7 +1,8 @@
 {
   "theme": "system",
   "enabledCssSnippets": [
-    "tasks-code-block-blue-border"
+    "tasks-code-block-blue-border",
+    "js-engine-code-block-border"
   ],
   "accentColor": ""
 }
\ No newline at end of file
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/community-plugins.json b/resources/sample_vaults/Tasks-Demo/.obsidian/community-plugins.json
index 95ed3677..c21b4b39 100644
--- a/resources/sample_vaults/Tasks-Demo/.obsidian/community-plugins.json
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/community-plugins.json
@@ -13,5 +13,6 @@
   "number-headings-obsidian",
   "broken-links",
   "obsidian-plugin-update-tracker",
-  "obsidian-kanban"
+  "obsidian-kanban",
+  "js-engine"
 ]
\ No newline at end of file
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/main.js b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/main.js
new file mode 100644
index 00000000..1d06d918
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/main.js
@@ -0,0 +1,50 @@
+/*
+-------------------------------------------
+JS Engine - Release Build
+-------------------------------------------
+By: Moritz Jung (https://mprojectscode.github.io/)
+Time: Thu, 18 Apr 2024 17:26:39 GMT
+Version: 0.1.6
+-------------------------------------------
+THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
+if you want to view the source, please visit the github repository of this plugin
+*/
+
+"use strict";var Il=Object.create;var Gn=Object.defineProperty;var Pl=Object.getOwnPropertyDescriptor;var Tl=Object.getOwnPropertyNames;var Cl=Object.getPrototypeOf,Fl=Object.prototype.hasOwnProperty;var Ol=(n,e,t)=>e in n?Gn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Gt=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Zs=(n,e)=>{for(var t in e)Gn(n,t,{get:e[t],enumerable:!0})},Ks=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tl(e))!Fl.call(n,i)&&i!==t&&Gn(n,i,{get:()=>e[i],enumerable:!(r=Pl(e,i))||r.enumerable});return n};var Ht=(n,e,t)=>(t=n!=null?Il(Cl(n)):{},Ks(e||!n||!n.__esModule?Gn(t,"default",{value:n,enumerable:!0}):t,n)),Ll=n=>Ks(Gn({},"__esModule",{value:!0}),n);var Fe=(n,e,t)=>(Ol(n,typeof e!="symbol"?e+"":e,t),t);var ka=Gt((ys,gs)=>{(function(n,e){typeof ys=="object"&&typeof gs!="undefined"?gs.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis!="undefined"?globalThis:n||self).dayjs=e()})(ys,function(){"use strict";var n=1e3,e=6e4,t=36e5,r="millisecond",i="second",o="minute",s="hour",a="day",l="week",c="month",d="quarter",h="year",f="date",_="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,W={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(F){var x=["th","st","nd","rd"],b=F%100;return"["+F+(x[(b-20)%10]||x[b]||x[0])+"]"}},B=function(F,x,b){var S=String(F);return!S||S.length>=x?F:""+Array(x+1-S.length).join(b)+F},ne={s:B,z:function(F){var x=-F.utcOffset(),b=Math.abs(x),S=Math.floor(b/60),P=b%60;return(x<=0?"+":"-")+B(S,2,"0")+":"+B(P,2,"0")},m:function F(x,b){if(x.date()<b.date())return-F(b,x);var S=12*(b.year()-x.year())+(b.month()-x.month()),P=x.clone().add(S,c),q=b-P<0,J=x.clone().add(S+(q?-1:1),c);return+(-(S+(b-P)/(q?P-J:J-P))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:c,y:h,w:l,d:a,D:f,h:s,m:o,s:i,ms:r,Q:d}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},$="en",H={};H[$]=W;var ue="$isDayjsObject",ye=function(F){return F instanceof se||!(!F||!F[ue])},g=function F(x,b,S){var P;if(!x)return $;if(typeof x=="string"){var q=x.toLowerCase();H[q]&&(P=q),b&&(H[q]=b,P=q);var J=x.split("-");if(!P&&J.length>1)return F(J[0])}else{var U=x.name;H[U]=x,P=U}return!S&&P&&($=P),P||!S&&$},w=function(F,x){if(ye(F))return F.clone();var b=typeof x=="object"?x:{};return b.date=F,b.args=arguments,new se(b)},m=ne;m.l=g,m.i=ye,m.w=function(F,x){return w(F,{locale:x.$L,utc:x.$u,x:x.$x,$offset:x.$offset})};var se=function(){function F(b){this.$L=g(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[ue]=!0}var x=F.prototype;return x.parse=function(b){this.$d=function(S){var P=S.date,q=S.utc;if(P===null)return new Date(NaN);if(m.u(P))return new Date;if(P instanceof Date)return new Date(P);if(typeof P=="string"&&!/Z$/i.test(P)){var J=P.match(y);if(J){var U=J[2]-1||0,T=(J[7]||"0").substring(0,3);return q?new Date(Date.UTC(J[1],U,J[3]||1,J[4]||0,J[5]||0,J[6]||0,T)):new Date(J[1],U,J[3]||1,J[4]||0,J[5]||0,J[6]||0,T)}}return new Date(P)}(b),this.init()},x.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},x.$utils=function(){return m},x.isValid=function(){return this.$d.toString()!==_},x.isSame=function(b,S){var P=w(b);return this.startOf(S)<=P&&P<=this.endOf(S)},x.isAfter=function(b,S){return w(b)<this.startOf(S)},x.isBefore=function(b,S){return this.endOf(S)<w(b)},x.$g=function(b,S,P){return m.u(b)?this[S]:this.set(P,b)},x.unix=function(){return Math.floor(this.valueOf()/1e3)},x.valueOf=function(){return this.$d.getTime()},x.startOf=function(b,S){var P=this,q=!!m.u(S)||S,J=m.p(b),U=function(Te,Me){var ae=m.w(P.$u?Date.UTC(P.$y,Me,Te):new Date(P.$y,Me,Te),P);return q?ae:ae.endOf(a)},T=function(Te,Me){return m.w(P.toDate()[Te].apply(P.toDate("s"),(q?[0,0,0,0]:[23,59,59,999]).slice(Me)),P)},C=this.$W,j=this.$M,ee=this.$D,lt="set"+(this.$u?"UTC":"");switch(J){case h:return q?U(1,0):U(31,11);case c:return q?U(1,j):U(0,j+1);case l:var Z=this.$locale().weekStart||0,fe=(C<Z?C+7:C)-Z;return U(q?ee-fe:ee+(6-fe),j);case a:case f:return T(lt+"Hours",0);case s:return T(lt+"Minutes",1);case o:return T(lt+"Seconds",2);case i:return T(lt+"Milliseconds",3);default:return this.clone()}},x.endOf=function(b){return this.startOf(b,!1)},x.$set=function(b,S){var P,q=m.p(b),J="set"+(this.$u?"UTC":""),U=(P={},P[a]=J+"Date",P[f]=J+"Date",P[c]=J+"Month",P[h]=J+"FullYear",P[s]=J+"Hours",P[o]=J+"Minutes",P[i]=J+"Seconds",P[r]=J+"Milliseconds",P)[q],T=q===a?this.$D+(S-this.$W):S;if(q===c||q===h){var C=this.clone().set(f,1);C.$d[U](T),C.init(),this.$d=C.set(f,Math.min(this.$D,C.daysInMonth())).$d}else U&&this.$d[U](T);return this.init(),this},x.set=function(b,S){return this.clone().$set(b,S)},x.get=function(b){return this[m.p(b)]()},x.add=function(b,S){var P,q=this;b=Number(b);var J=m.p(S),U=function(j){var ee=w(q);return m.w(ee.date(ee.date()+Math.round(j*b)),q)};if(J===c)return this.set(c,this.$M+b);if(J===h)return this.set(h,this.$y+b);if(J===a)return U(1);if(J===l)return U(7);var T=(P={},P[o]=e,P[s]=t,P[i]=n,P)[J]||1,C=this.$d.getTime()+b*T;return m.w(C,this)},x.subtract=function(b,S){return this.add(-1*b,S)},x.format=function(b){var S=this,P=this.$locale();if(!this.isValid())return P.invalidDate||_;var q=b||"YYYY-MM-DDTHH:mm:ssZ",J=m.z(this),U=this.$H,T=this.$m,C=this.$M,j=P.weekdays,ee=P.months,lt=P.meridiem,Z=function(Me,ae,be,re){return Me&&(Me[ae]||Me(S,q))||be[ae].slice(0,re)},fe=function(Me){return m.s(U%12||12,Me,"0")},Te=lt||function(Me,ae,be){var re=Me<12?"AM":"PM";return be?re.toLowerCase():re};return q.replace(k,function(Me,ae){return ae||function(be){switch(be){case"YY":return String(S.$y).slice(-2);case"YYYY":return m.s(S.$y,4,"0");case"M":return C+1;case"MM":return m.s(C+1,2,"0");case"MMM":return Z(P.monthsShort,C,ee,3);case"MMMM":return Z(ee,C);case"D":return S.$D;case"DD":return m.s(S.$D,2,"0");case"d":return String(S.$W);case"dd":return Z(P.weekdaysMin,S.$W,j,2);case"ddd":return Z(P.weekdaysShort,S.$W,j,3);case"dddd":return j[S.$W];case"H":return String(U);case"HH":return m.s(U,2,"0");case"h":return fe(1);case"hh":return fe(2);case"a":return Te(U,T,!0);case"A":return Te(U,T,!1);case"m":return String(T);case"mm":return m.s(T,2,"0");case"s":return String(S.$s);case"ss":return m.s(S.$s,2,"0");case"SSS":return m.s(S.$ms,3,"0");case"Z":return J}return null}(Me)||J.replace(":","")})},x.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},x.diff=function(b,S,P){var q,J=this,U=m.p(S),T=w(b),C=(T.utcOffset()-this.utcOffset())*e,j=this-T,ee=function(){return m.m(J,T)};switch(U){case h:q=ee()/12;break;case c:q=ee();break;case d:q=ee()/3;break;case l:q=(j-C)/6048e5;break;case a:q=(j-C)/864e5;break;case s:q=j/t;break;case o:q=j/e;break;case i:q=j/n;break;default:q=j}return P?q:m.a(q)},x.daysInMonth=function(){return this.endOf(c).$D},x.$locale=function(){return H[this.$L]},x.locale=function(b,S){if(!b)return this.$L;var P=this.clone(),q=g(b,S,!0);return q&&(P.$L=q),P},x.clone=function(){return m.w(this.$d,this)},x.toDate=function(){return new Date(this.valueOf())},x.toJSON=function(){return this.isValid()?this.toISOString():null},x.toISOString=function(){return this.$d.toISOString()},x.toString=function(){return this.$d.toUTCString()},F}(),me=se.prototype;return w.prototype=me,[["$ms",r],["$s",i],["$m",o],["$H",s],["$W",a],["$M",c],["$y",h],["$D",f]].forEach(function(F){me[F[1]]=function(x){return this.$g(x,F[0],F[1])}}),w.extend=function(F,x){return F.$i||(F(x,se,w),F.$i=!0),w},w.locale=g,w.isDayjs=ye,w.unix=function(F){return w(1e3*F)},w.en=H[$],w.Ls=H,w.p={},w})});var Jr=Gt(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.P_HELPERS=Qe.ParserHelpers=Qe.validateRegexFlags=Qe.validateRange=Qe.getIndex=Qe.arrayUnion=void 0;var Es=rr();function Nu(n,e){if(!(n===void 0&&e===void 0)){if(n===void 0)return e;if(e===void 0)return n;for(let t of e)n.includes(t)||n.push(t);return n}}Qe.arrayUnion=Nu;function qu(n){return n===void 0?-1:n.index}Qe.getIndex=qu;function ju(n,e){if(e<n)throw new Error(`Invalid Range: max might not be smaller than min. Received [${n}, ${e}].`);if(n<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${n}, ${e}].`);if(n===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${n}, ${e}].`);if(!Number.isInteger(n)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${n}, ${e}].`)}Qe.validateRange=ju;function zu(n){for(let e of n)if(e!=="i"&&e!=="m"&&e!=="s"&&e!=="u")throw new Error(`RegExp flag '${e}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}Qe.validateRegexFlags=zu;var Wr=class{followedBy(e){return new Es.Parser(function(r){return e.p(r.copy())})}notFollowedBy(e){return new Es.Parser(function(r){let i=r.copy(),o=e.p(i),s=r.sliceTo(i.position.index);return o.success?r.fail("not '"+s+"'"):r.succeed(void 0)})}test(e){return new Es.Parser(function(r){let i=r.input[r.position.index];return!r.atEOF()&&e(i)?r.succeedOffset(1,i):r.fail(`a character matching ${e}`)})}};Qe.ParserHelpers=Wr;Qe.P_HELPERS=new Wr});var Ss=Gt(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ParserContext=void 0;var Ms=Jr(),As=class n{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new n(this.input,{index:this.position.index,column:this.position.column,line:this.position.line})}getPosition(){return{index:this.position.index,column:this.position.column,line:this.position.line}}atEOF(){return this.position.index>=this.input.length}advanceTo(e){if(e<this.position.index)throw new Error(`Can not advance backwards. Current pos ${this.position.index}. Advance target index ${e}.`);if(e!==this.position.index){for(let t=this.position.index;t<e;t++)this.input[t]===`
+`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,t){return this.succeedAt(this.position.index+e,t)}failOffset(e,t){return this.failAt(this.position.index+e,t)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,t){return this.advanceTo(e),{success:!0,value:t,furthest:void 0,expected:void 0}}failAt(e,t){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(t)?t:[t]}}merge(e,t){if(e===void 0)return t;let r=(0,Ms.getIndex)(e.furthest),i=(0,Ms.getIndex)(t.furthest);if(i>r)return t;let o=i===r?(0,Ms.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=o,t}};Br.ParserContext=As});var Ps=Gt(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.P_UTILS=void 0;var Ur=rr(),pe=Hr(),Is=class n{static position(){return new Ur.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Ur.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Ur.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Ur.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return pe.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return pe.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return pe.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return pe.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return pe.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return pe.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return pe.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return pe.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return pe.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return pe.P.regexp(/^\s+/).describe("whitespace")}static cr(){return pe.P.string("\r")}static lf(){return pe.P.string(`
+`)}static crlf(){return pe.P.string(`\r
+`)}static newline(){return pe.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,r){return pe.P.sequenceMap((i,o)=>i.reduce((s,a)=>r(a,s),o),e.many(),t)}static postfix(e,t,r){return pe.P.sequenceMap((i,o)=>o.reduce((s,a)=>r(a,s),i),t,e.many())}static binaryRight(e,t,r){return pe.P.sequenceMap((i,o)=>i.reverse().reduce((s,a)=>{let[l,c]=a;return r(l,c,s)},o),pe.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,r){return pe.P.sequenceMap((i,o)=>o.reduce((s,a)=>{let[l,c]=a;return r(s,l,c)},i),t,pe.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,r){return pe.P.sequenceMap((i,o,s)=>i.reverse().reduce((a,l)=>{let[c,d,h]=l;return r({from:c,to:s},d,h,a)},o),pe.P.sequence(n.position(),t,e.trim(this.optionalWhitespace())).many(),t,n.position())}static binaryLeftRange(e,t,r){return pe.P.sequenceMap((i,o,s)=>s.reduce((a,l)=>{let[c,d,h]=l;return r({from:i,to:h},a,c,d)},o),n.position(),t,pe.P.sequence(e.trim(this.optionalWhitespace()),t,n.position()).many())}static func(e,t,r){let i=typeof e=="string"?pe.P.string(e):e;return pe.P.sequenceMap((o,s,a,l,c,d)=>r(o,l),i,pe.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),pe.P.string(")"))}};Gr.P_UTILS=Is});var Cs=Gt(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.ParsingError=_n.createParsingErrorMessage=void 0;function qa(n,e,t){let r=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${r} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let s=n.split(`
+`)[e.furthest.line-1],a=`${e.furthest.line} |   `;i+=`
+
+${a}${s}`,i+=`
+${" ".repeat(e.furthest.column-1+a.length)}^ (${r})`}return i}_n.createParsingErrorMessage=qa;var Ts=class extends Error{constructor(e,t){super(qa(e,t,!0))}};_n.ParsingError=Ts});var rr=Gt(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.Parser=void 0;var Wu=Ss(),st=Hr(),Fs=Jr(),vn=Ps(),Ju=Cs(),Os=class n{constructor(e){this.p=e}tryParse(e){return this.p(new Wu.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new Ju.ParsingError(e,t)}or(e){return st.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(st.P.string(e))}wrap(e,t){let r=this;return new n(function(o){let s=e.p(o);if(!s.success)return s;let a=o.merge(s,r.p(o));if(!a.success)return a;let l=o.merge(a,t.p(o));return l.success?o.merge(l,o.succeed(a.value)):l})}wrapString(e,t){return this.wrap(st.P.string(e),st.P.string(t))}then(e){let t=this;return new n(function(i){let o=t.p(i);if(!o.success)return o;let s=i.merge(o,e.p(i));return s.success,s})}skip(e){let t=this;return new n(function(i){let o=t.p(i);if(!o.success)return o;let s=i.merge(o,e.p(i));return s.success?i.merge(s,i.succeed(o.value)):s})}and(e){return st.P.sequence(this,e)}many(){let e=this;return new n(function(r){let i,o=r.position.index,s=[];for(;;){let a=r.copy(),l=e.p(a);if(i=r.merge(i,l),i.success){if(a.position.index===o)throw new Error("infinite loop in many() parser detected");r.moveToPosition(a.position),s.push(i.value)}else return r.merge(i,r.succeed(s))}})}repeat(e,t){(0,Fs.validateRange)(e,t);let r=this;return new n(function(o){let s,a,l=[],c=0;for(;c<e;c++)if(s=r.p(o),a=o.merge(a,s),s.success)l.push(s.value);else return a;for(;c<t;c++){let d=o.copy();if(s=r.p(d),a=o.merge(a,s),s.success)o.moveToPosition(d.position),l.push(s.value);else break}return o.merge(a,o.succeed(l))})}atMost(e){return this.repeat(0,e)}atLeast(e){return st.P.sequenceMap((t,r)=>t.concat(r),this.repeat(e,e),this.many())}separateBy(e){return st.P.separateBy(this,e)}separateByNotEmpty(e){return st.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new n(function(i){let o=t.p(i);return o.success&&(o.value=e(o.value)),o})}marker(){return st.P.sequenceMap(function(t,r,i){return{value:r,range:{from:t,to:i}}},vn.P_UTILS.position(),this,vn.P_UTILS.position())}namedMarker(e){return st.P.sequenceMap(function(r,i,o){return{value:i,name:e,range:{from:r,to:o}}},vn.P_UTILS.position(),this,vn.P_UTILS.position())}node(e){return st.P.sequenceMap(function(r,i,o){return e(i,{from:r,to:o})},vn.P_UTILS.position(),this,vn.P_UTILS.position())}followedBy(e){return this.skip(Fs.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(Fs.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new n(function(i){let o=t.p(i);return o.expected!==void 0&&o.expected.length!==0&&(o.expected=e),o})}box(e){let t=this;return new n(function(i){var o;let s=t.p(i);return s.expected!==void 0&&s.expected.length!==0&&(s.expected=[`(${(o=s.expected)===null||o===void 0?void 0:o.join(" or ")} as part of ${e})`]),s})}optional(e){return this.or(st.P.succeed(e))}chain(e){let t=this;return new n(function(i){let o=t.p(i);if(!o.success)return o;let a=e(o.value).p(i);return i.merge(o,a)})}thenEof(){let e=this;return new n(function(r){let i=e.p(r);return i.success?r.atEOF()?i:r.merge(i,r.fail("eof")):i})}memorize(){let e=this,t="",r=new Map,i=new Map;return new n(function(s){let a=s.position.index;if(s.input!==t)t=s.input,r.clear(),i.clear();else{let c=r.get(a),d=i.get(a);if(c!==void 0&&d!==void 0)return s.moveToPosition(Object.assign({},d)),Object.assign({},c)}let l=e.p(s);return r.set(a,Object.assign({},l)),i.set(a,s.getPosition()),l})}};Vr.Parser=Os});var Hr=Gt(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.P=void 0;var $e=rr(),Yr=Jr(),Ls=class n{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new $e.Parser(function(r){let i,o=new Array(e.length);for(let s=0;s<e.length;s++){let l=e[s].p(r);if(i=r.merge(i,l),!i.success)return i;o[s]=i.value}return i.value=o,i})}static sequenceMap(e,...t){if(t.length===0)throw new Error("sequenceMap must have at least one parser argument");return new $e.Parser(function(i){let o,s=new Array(t.length);for(let a=0;a<t.length;a++){let c=t[a].p(i);if(o=i.merge(o,c),!o.success)return o;s[a]=o.value}return o.value=e(...s),o})}static createLanguage(e){let t={},r={},i={};for(let o in e)i[o]=n.reference(()=>e[o](t,i)),Object.defineProperty(r,o,{get:()=>{if(t[o]!==void 0)return t[o];throw new Error(`Can not access rule '${o}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let o in e)t[o]=e[o](r,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new $e.Parser(function(r){let i;for(let o of e){let s=o,a=r.copy(),l=s.p(a);if(i=r.merge(i,l),i.success)return r.moveToPosition(a.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(n.succeed([]))}static separateByNotEmpty(e,t){return this.sequenceMap(function(i,o){return o.unshift(i),o},e,t.then(e).many())}static string(e){let t="'"+e+"'";return new $e.Parser(function(i){for(let o=0;o<e.length;o++)if(i.input[i.position.index+o]!==e[o])return i.fail(t);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,t){(0,Yr.validateRegexFlags)(e.flags);let r=e.source;return t!==void 0?new $e.Parser(function(o){let s=o.input.slice(o.position.index),a=e.exec(s);if(a!==null){let l=t!=null?t:0;if(l>=0&&l<=a.length){let d=a[0],h=a[l];return o.succeedOffset(d.length,h)}let c="expected valid match group (0 to "+a.length+") in "+r;return o.fail(c)}else return o.fail(r)}):new $e.Parser(function(o){let s=o.input.slice(o.position.index),a=e.exec(s);if(a!==null){let l=a[0];return o.succeedOffset(l.length,l)}else return o.fail(r)})}static succeed(e){return new $e.Parser(function(r){return r.succeed(e)})}static fail(e){return new $e.Parser(function(r){return r.fail(e)})}static oneOf(e){return Yr.P_HELPERS.test(function(r){return e.includes(r)}).describe(`one character of '${e}'`)}static noneOf(e){return Yr.P_HELPERS.test(function(r){return!e.includes(r)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(t=>this.string(t))).describe(e.map(t=>`'${t}'`).join(" or "))}static manyOf(e){return new $e.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&e.includes(r.input[i]);i++);return r.succeedAt(i,r.sliceTo(i))})}static manyNotOf(e){return new $e.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&!e.includes(r.input[i]);i++);return r.succeedAt(i,r.sliceTo(i))})}static custom(e){return new $e.Parser(e)}static range(e,t){let r=e.charCodeAt(0),i=t.charCodeAt(0);return Yr.P_HELPERS.test(function(s){let a=s.charCodeAt(0);return r<=a&&a<=i}).describe(`${e}-${t}`)}static takeWhile(e){return new $e.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&e(r.input[i]);)i++;return r.succeedAt(i,r.input.slice(r.position.index,i))})}static reference(e){return new $e.Parser(function(r){return e().p(r)})}};Qr.P=Ls});var nc={};Zs(nc,{default:()=>Qo});module.exports=Ll(nc);var ul=require("obsidian");var Rl=require("obsidian"),$s={};var Dt=require("obsidian");var ea=require("obsidian"),Et=class{constructor(e){this.content=e}async render(e,t,r,i){await ea.MarkdownRenderer.render(e,this.content,t,r,i)}};var on=class{toMarkdown(){return new Et(this.toString())}};var sn=class extends on{getType(){return"LITERAL"}};var mt=class extends on{constructor(){super();this.markdownElements=[]}getType(){return"NON_LITERAL"}addElement(t){if(this.allowElement(t))this.markdownElements.push(t);else throw new Error("Element not allowed in container.")}addText(t){let r=new ct(t,!1,!1,!1);return this.addElement(r),this}addBoldText(t){let r=new ct(t,!0,!1,!1);return this.addElement(r),this}addCursiveText(t){let r=new ct(t,!1,!0,!1);return this.addElement(r),this}addUnderlinedText(t){let r=new ct(t,!1,!1,!0);return this.addElement(r),this}addCode(t){let r=new Hn(t);return this.addElement(r),this}createParagraph(t){let r=new Qn(t);return this.addElement(r),r}createHeading(t,r){let i=new Yn(t,r);return this.addElement(i),i}createBlockQuote(){let t=new Zn;return this.addElement(t),t}createCallout(t,r,i=""){let o=new Kn(t,r,i);return this.addElement(o),o}createCodeBlock(t,r){let i=new Xn(t,r);return this.addElement(i),i}createTable(t,r){let i=new Vn(t,r);return this.addElement(i),i}createList(t){let r=new $n(t);return this.addElement(r),r}},ct=class extends sn{constructor(t,r,i,o){super();this.content=t,this.bold=r,this.cursive=i,this.underline=o}toString(){let t="",r="";return this.underline&&(t+="<b>",r="</b>"+r),this.bold&&(t+="**",r="**"+r),this.cursive&&(t+="*",r="*"+r),t+this.content+r}},Hn=class extends sn{constructor(t){super();this.content=t}toString(){return`\`${this.content}\``}},Vn=class extends sn{constructor(t,r){super();this.header=t,this.body=r}toString(){let t=this.body.length;if(t===0)return"";let r=this.header.length;if(r===0)return"";for(let s of this.body)if(s.length!==r)throw new Error("Table rows are do not contain the same number of columns.");let i=[];for(let s=0;s<r;s++){let a=0;this.header[s].length>a&&(a=this.header[s].length);for(let l of this.body)l[s].length>a&&(a=l[s].length);i.push(a)}let o="";o+="|";for(let s=0;s<r;s++){let a=this.header[s];a+=" ".repeat(i[s]-a.length),o+=" "+a+" |"}o+=`
+`,o+="|";for(let s=0;s<r;s++)o+=" "+"-".repeat(i[s])+" |";o+=`
+`;for(let s=0;s<t;s++){o+="|";for(let a=0;a<r;a++){let l=this.body[s][a];l+=" ".repeat(i[a]-l.length),o+=" "+l+" |"}o+=`
+`}return o}},Yn=class extends mt{constructor(t,r){super();this.level=t,this.addText(r)}toString(){return`${"#".repeat(this.level)} ${this.markdownElements.map(t=>t.toString()).join("")}`}allowElement(t){return t.getType()==="LITERAL"}},Qn=class extends mt{constructor(e){super(),this.addText(e)}toString(){return this.markdownElements.map(e=>e.toString()).join("")}allowElement(e){return e.getType()==="LITERAL"}},Xn=class extends mt{constructor(t,r){super();this.language=t,this.addText(r)}allowElement(t){return t.getType()==="LITERAL"}toString(){return`\`\`\`${this.language}
+${this.markdownElements.map(t=>t.toString()).join("")}
+\`\`\``}},Zn=class extends mt{allowElement(e){return!0}toString(){return"> "+this.markdownElements.map(e=>e.toString().replaceAll(`
+`,`
+> `)).join(`
+> 
+> `)}},Kn=class extends mt{constructor(t,r,i){super();this.title=t,this.type=r,this.args=i}allowElement(t){return!0}toString(){return`> [!${this.type}|${this.args}] ${this.title}
+> `+this.markdownElements.map(t=>t.toString().replaceAll(`
+`,`
+> `)).join(`
+> 
+> `)}},$n=class n extends mt{constructor(t){super();this.ordered=t}allowElement(t){return!0}getPrefix(t){return this.ordered?`${t+1}. `:"- "}toString(){return this.markdownElements.map((t,r)=>t instanceof n?`	${t.toString().replaceAll(`
+`,`
+	`)}`:`${this.getPrefix(r)}${t.toString().replaceAll(`
+`,`
+	`)}`).join(`
+`)}};var Vt=class extends mt{constructor(){super()}toString(){return this.markdownElements.map(e=>e.toString()).join(`
+
+`)}allowElement(e){return!0}};var Nr=require("obsidian");var Ra=require("obsidian");function le(){}var er=n=>n;function xr(n,e){for(let t in e)n[t]=e[t];return n}function ts(n){return n()}function kr(){return Object.create(null)}function we(n){n.forEach(ts)}function qe(n){return typeof n=="function"}function Q(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function ta(n){return Object.keys(n).length===0}function Nl(n,...e){if(n==null){for(let r of e)r(void 0);return le}let t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function na(n,e,t){n.$$.on_destroy.push(Nl(e,t))}function je(n,e,t,r){if(n){let i=ra(n,e,t,r);return n[0](i)}}function ra(n,e,t,r){return n[1]&&r?xr(t.ctx.slice(),n[1](r(e))):t.ctx}function ze(n,e,t,r){if(n[2]&&r){let i=n[2](r(t));if(e.dirty===void 0)return i;if(typeof i=="object"){let o=[],s=Math.max(e.dirty.length,i.length);for(let a=0;a<s;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function We(n,e,t,r,i,o){if(i){let s=ra(e,t,r,o);n.p(s,i)}}function Je(n){if(n.ctx.length>32){let e=[],t=n.ctx.length/32;for(let r=0;r<t;r++)e[r]=-1;return e}return-1}function yt(n){return n&&qe(n.destroy)?n.destroy:le}var ia=typeof window!="undefined",ns=ia?()=>window.performance.now():()=>Date.now(),tr=ia?n=>requestAnimationFrame(n):le;var an=new Set;function oa(n){an.forEach(e=>{e.c(n)||(an.delete(e),e.f())}),an.size!==0&&tr(oa)}function rs(n){let e;return an.size===0&&tr(oa),{promise:new Promise(t=>{an.add(e={c:n,f:t})}),abort(){an.delete(e)}}}var is=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Er=class n{constructor(e){Fe(this,"_listeners","WeakMap"in is?new WeakMap:void 0);Fe(this,"_observer");Fe(this,"options");this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(t=>{var r;for(let i of t)n.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};Er.entries="WeakMap"in is?new WeakMap:void 0;var sa=!1;function aa(){sa=!0}function la(){sa=!1}function E(n,e){n.appendChild(e)}function Be(n,e,t){let r=Mr(n);if(!r.getElementById(e)){let i=A("style");i.id=e,i.textContent=t,ca(r,i)}}function Mr(n){if(!n)return document;let e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function ua(n){let e=A("style");return e.textContent="/* empty */",ca(Mr(n),e),e.sheet}function ca(n,e){return E(n.head||n,e),e.sheet}function N(n,e,t){n.insertBefore(e,t||null)}function L(n){n.parentNode&&n.parentNode.removeChild(n)}function ln(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function A(n){return document.createElement(n)}function oe(n){return document.createTextNode(n)}function te(){return oe(" ")}function Ae(n,e,t,r){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}function R(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function fa(n){return Array.from(n.childNodes)}function ke(n,e){e=""+e,n.data!==e&&(n.data=e)}function Se(n,e,t){n.classList.toggle(e,!!t)}function Ar(n,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:r})}function da(n){let e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var Sr=new Map,Ir=0;function jl(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function zl(n,e){let t={stylesheet:ua(e),rules:{}};return Sr.set(n,t),t}function Pr(n,e,t,r,i,o,s,a=0){let l=16.666/r,c=`{
+`;for(let W=0;W<=1;W+=l){let B=e+(t-e)*o(W);c+=W*100+`%{${s(B,1-B)}}
+`}let d=c+`100% {${s(t,1-t)}}
+}`,h=`__svelte_${jl(d)}_${a}`,f=Mr(n),{stylesheet:_,rules:y}=Sr.get(f)||zl(f,n);y[h]||(y[h]=!0,_.insertRule(`@keyframes ${h} ${d}`,_.cssRules.length));let k=n.style.animation||"";return n.style.animation=`${k?`${k}, `:""}${h} ${r}ms linear ${i}ms 1 both`,Ir+=1,h}function os(n,e){let t=(n.style.animation||"").split(", "),r=t.filter(e?o=>o.indexOf(e)<0:o=>o.indexOf("__svelte")===-1),i=t.length-r.length;i&&(n.style.animation=r.join(", "),Ir-=i,Ir||Wl())}function Wl(){tr(()=>{Ir||(Sr.forEach(n=>{let{ownerNode:e}=n.stylesheet;e&&L(e)}),Sr.clear())})}var un;function Mt(n){un=n}function rt(n,e){let t=n.$$.callbacks[e.type];t&&t.slice().forEach(r=>r.call(this,e))}var Yt=[];var Ve=[],fn=[],as=[],Jl=Promise.resolve(),ls=!1;function ha(){ls||(ls=!0,Jl.then(Tr))}function At(n){fn.push(n)}function dn(n){as.push(n)}var ss=new Set,cn=0;function Tr(){if(cn!==0)return;let n=un;do{try{for(;cn<Yt.length;){let e=Yt[cn];cn++,Mt(e),Bl(e.$$)}}catch(e){throw Yt.length=0,cn=0,e}for(Mt(null),Yt.length=0,cn=0;Ve.length;)Ve.pop()();for(let e=0;e<fn.length;e+=1){let t=fn[e];ss.has(t)||(ss.add(t),t())}fn.length=0}while(Yt.length);for(;as.length;)as.pop()();ls=!1,ss.clear(),Mt(n)}function Bl(n){if(n.fragment!==null){n.update(),we(n.before_update);let e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(At)}}function pa(n){let e=[],t=[];fn.forEach(r=>n.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),fn=e}var nr;function Ul(){return nr||(nr=Promise.resolve(),nr.then(()=>{nr=null})),nr}function us(n,e,t){n.dispatchEvent(Ar(`${e?"intro":"outro"}${t}`))}var Cr=new Set,St;function ft(){St={r:0,c:[],p:St}}function dt(){St.r||we(St.c),St=St.p}function Y(n,e){n&&n.i&&(Cr.delete(n),n.i(e))}function K(n,e,t,r){if(n&&n.o){if(Cr.has(n))return;Cr.add(n),St.c.push(()=>{Cr.delete(n),r&&(t&&n.d(1),r())}),n.o(e)}else r&&r()}var Gl={duration:0};function Fr(n,e,t,r){let o=e(n,t,{direction:"both"}),s=r?0:1,a=null,l=null,c=null,d;function h(){c&&os(n,c)}function f(y,k){let W=y.b-s;return k*=Math.abs(W),{a:s,b:y.b,d:W,duration:k,start:y.start,end:y.start+k,group:y.group}}function _(y){let{delay:k=0,duration:W=300,easing:B=er,tick:ne=le,css:$}=o||Gl,H={start:ns()+k,b:y};y||(H.group=St,St.r+=1),"inert"in n&&(y?d!==void 0&&(n.inert=d):(d=n.inert,n.inert=!0)),a||l?l=H:($&&(h(),c=Pr(n,s,y,W,k,B,$)),y&&ne(0,1),a=f(H,W),At(()=>us(n,y,"start")),rs(ue=>{if(l&&ue>l.start&&(a=f(l,W),l=null,us(n,a.b,"start"),$&&(h(),c=Pr(n,s,a.b,a.duration,0,B,o.css))),a){if(ue>=a.end)ne(s=a.b,1-s),us(n,a.b,"end"),l||(a.b?h():--a.group.r||we(a.group.c)),a=null;else if(ue>=a.start){let ye=ue-a.start;s=a.a+a.d*B(ye/a.duration),ne(s,1-s)}}return!!(a||l)}))}return{run(y){qe(o)?Ul().then(()=>{o=o({direction:y?"in":"out"}),_(y)}):_(y)},end(){h(),a=l=null}}}function it(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function ma(n,e){n.d(1),e.delete(n.key)}function ya(n,e,t,r,i,o,s,a,l,c,d,h){let f=n.length,_=o.length,y=f,k={};for(;y--;)k[n[y].key]=y;let W=[],B=new Map,ne=new Map,$=[];for(y=_;y--;){let g=h(i,o,y),w=t(g),m=s.get(w);m?r&&$.push(()=>m.p(g,e)):(m=c(w,g),m.c()),B.set(w,W[y]=m),w in k&&ne.set(w,Math.abs(y-k[w]))}let H=new Set,ue=new Set;function ye(g){Y(g,1),g.m(a,d),s.set(g.key,g),d=g.first,_--}for(;f&&_;){let g=W[_-1],w=n[f-1],m=g.key,se=w.key;g===w?(d=g.first,f--,_--):B.has(se)?!s.has(m)||H.has(m)?ye(g):ue.has(se)?f--:ne.get(m)>ne.get(se)?(ue.add(m),ye(g)):(H.add(se),f--):(l(w,s),f--)}for(;f--;){let g=n[f];B.has(g.key)||l(g,s)}for(;_;)ye(W[_-1]);return we($),W}var Hl=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Vl=new Set([...Hl]);function hn(n,e,t){let r=n.$$.props[e];r!==void 0&&(n.$$.bound[r]=t,t(n.$$.ctx[r]))}function Ye(n){n&&n.c()}function Ue(n,e,t){let{fragment:r,after_update:i}=n.$$;r&&r.m(e,t),At(()=>{let o=n.$$.on_mount.map(ts).filter(qe);n.$$.on_destroy?n.$$.on_destroy.push(...o):we(o),n.$$.on_mount=[]}),i.forEach(At)}function Ge(n,e){let t=n.$$;t.fragment!==null&&(pa(t.after_update),we(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Ql(n,e){n.$$.dirty[0]===-1&&(Yt.push(n),ha(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function X(n,e,t,r,i,o,s=null,a=[-1]){let l=un;Mt(n);let c=n.$$={fragment:null,ctx:[],props:o,update:le,not_equal:i,bound:kr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:kr(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};s&&s(c.root);let d=!1;if(c.ctx=t?t(n,e.props||{},(h,f,..._)=>{let y=_.length?_[0]:f;return c.ctx&&i(c.ctx[h],c.ctx[h]=y)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](y),d&&Ql(n,h)),f}):[],c.update(),d=!0,we(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){aa();let h=fa(e.target);c.fragment&&c.fragment.l(h),h.forEach(L)}else c.fragment&&c.fragment.c();e.intro&&Y(n.$$.fragment),Ue(n,e.target,e.anchor),la(),Tr()}Mt(l)}var Xl;typeof HTMLElement=="function"&&(Xl=class extends HTMLElement{constructor(e,t,r){super();Fe(this,"$$ctor");Fe(this,"$$s");Fe(this,"$$c");Fe(this,"$$cn",!1);Fe(this,"$$d",{});Fe(this,"$$r",!1);Fe(this,"$$p_d",{});Fe(this,"$$l",{});Fe(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){let i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(o){return()=>{let s;return{c:function(){s=A("slot"),o!=="default"&&R(s,"name",o)},m:function(c,d){N(c,s,d)},d:function(c){c&&L(s)}}}};if(await Promise.resolve(),!this.$$cn)return;let t={},r=da(this);for(let o of this.$$s)o in r&&(t[o]=[e(o)]);for(let o of this.attributes){let s=this.$$g_p(o.name);s in this.$$d||(this.$$d[s]=cs(s,o.value,this.$$p_d,"toProp"))}for(let o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let o in this.$$p_d)if(this.$$d[o]=this.$$c.$$.ctx[this.$$c.$$.props[o]],this.$$p_d[o].reflect){let s=cs(o,this.$$d[o],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,s)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let o in this.$$l)for(let s of this.$$l[o]){let a=this.$$c.$on(o,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,t,r){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=cs(e,r,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function cs(n,e,t,r){var o;let i=(o=t[n])==null?void 0:o.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var V=class{constructor(){Fe(this,"$$");Fe(this,"$$set")}$destroy(){Ge(this,1),this.$destroy=le}$on(e,t){if(!qe(t))return le;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!ta(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var ga="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ga);var hs=require("obsidian");function gt(n,e){return(0,hs.setIcon)(n,e),{update(t){(0,hs.setIcon)(n,t)}}}function au(n){Be(n,"svelte-12xcpmj","button.svelte-12xcpmj{gap:var(--size-4-1)}.mod-plain.svelte-12xcpmj{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-12xcpmj:hover{color:var(--text-normal)}.disabled.svelte-12xcpmj{opacity:0.6}")}function lu(n){let e,t,r,i,o=n[5].default,s=je(o,n,n[4],null);return{c(){e=A("button"),s&&s.c(),R(e,"aria-label",n[3]),e.disabled=n[2],R(e,"class","svelte-12xcpmj"),Se(e,"mod-cta",n[1]==="primary"),Se(e,"mod-warning",n[1]==="destructive"),Se(e,"mod-plain",n[1]==="plain"),Se(e,"disabled",n[2])},m(a,l){N(a,e,l),s&&s.m(e,null),n[7](e),t=!0,r||(i=Ae(e,"click",n[6]),r=!0)},p(a,[l]){s&&s.p&&(!t||l&16)&&We(s,o,a,a[4],t?ze(o,a[4],l,null):Je(a[4]),null),(!t||l&8)&&R(e,"aria-label",a[3]),(!t||l&4)&&(e.disabled=a[2]),(!t||l&2)&&Se(e,"mod-cta",a[1]==="primary"),(!t||l&2)&&Se(e,"mod-warning",a[1]==="destructive"),(!t||l&2)&&Se(e,"mod-plain",a[1]==="plain"),(!t||l&4)&&Se(e,"disabled",a[2])},i(a){t||(Y(s,a),t=!0)},o(a){K(s,a),t=!1},d(a){a&&L(e),s&&s.d(a),n[7](null),r=!1,i()}}}function uu(n,e,t){let{$$slots:r={},$$scope:i}=e,{variant:o="default"}=e,{disabled:s=!1}=e,{tooltip:a=""}=e,{ref:l=null}=e;function c(h){rt.call(this,n,h)}function d(h){Ve[h?"unshift":"push"](()=>{l=h,t(0,l)})}return n.$$set=h=>{"variant"in h&&t(1,o=h.variant),"disabled"in h&&t(2,s=h.disabled),"tooltip"in h&&t(3,a=h.tooltip),"ref"in h&&t(0,l=h.ref),"$$scope"in h&&t(4,i=h.$$scope)},[l,o,s,a,i,r,c,d]}var ps=class extends V{constructor(e){super(),X(this,e,uu,lu,Q,{variant:1,disabled:2,tooltip:3,ref:0},au)}},Or=ps;var pu=Ht(ka());function Ea(n){let e=n-1;return e*e*e+1}function _s(n,{delay:e=0,duration:t=400,easing:r=Ea,axis:i="y"}={}){let o=getComputedStyle(n),s=+o.opacity,a=i==="y"?"height":"width",l=parseFloat(o[a]),c=i==="y"?["top","bottom"]:["left","right"],d=c.map(B=>`${B[0].toUpperCase()}${B.slice(1)}`),h=parseFloat(o[`padding${d[0]}`]),f=parseFloat(o[`padding${d[1]}`]),_=parseFloat(o[`margin${d[0]}`]),y=parseFloat(o[`margin${d[1]}`]),k=parseFloat(o[`border${d[0]}Width`]),W=parseFloat(o[`border${d[1]}Width`]);return{delay:e,duration:t,easing:r,css:B=>`overflow: hidden;opacity: ${Math.min(B*20,1)*s};${a}: ${B*l}px;padding-${c[0]}: ${B*h}px;padding-${c[1]}: ${B*f}px;margin-${c[0]}: ${B*_}px;margin-${c[1]}: ${B*y}px;border-${c[0]}-width: ${B*k}px;border-${c[1]}-width: ${B*W}px;`}}function Aa(n){let e,t,r,i;return{c(){e=A("div"),R(e,"class","js-engine-message-delete-icon callout-icon"),R(e,"aria-label","remove"),R(e,"role","button"),R(e,"tabindex","0")},m(o,s){N(o,e,s),r||(i=[Ae(e,"click",n[5]),Ae(e,"keydown",n[6]),yt(t=gt.call(null,e,"x"))],r=!0)},p:le,d(o){o&&L(e),r=!1,we(i)}}}function Sa(n){let e,t=n[0].message.content+"",r;return{c(){e=A("p"),r=oe(t)},m(i,o){N(i,e,o),E(e,r)},p(i,o){o&1&&t!==(t=i[0].message.content+"")&&ke(r,t)},d(i){i&&L(e)}}}function Ia(n){let e,t,r=n[0].message.code+"",i;return{c(){e=A("pre"),t=A("code"),i=oe(r),R(e,"class","language-none")},m(o,s){N(o,e,s),E(e,t),E(t,i)},p(o,s){s&1&&r!==(r=o[0].message.code+"")&&ke(i,r)},d(o){o&&L(e)}}}function Pa(n){let e,t,r,i=n[0].message.type+"",o,s,a,l,c=n[0].time.toISOString()+"",d,h,f,_,y=n[3]&&Ta(n);return{c(){e=A("div"),t=A("p"),r=oe("Type: "),o=oe(i),s=te(),a=A("p"),l=oe("Time: "),d=oe(c),h=te(),y&&y.c(),R(e,"class","js-engine-message-detail-content")},m(k,W){N(k,e,W),E(e,t),E(t,r),E(t,o),E(e,s),E(e,a),E(a,l),E(a,d),E(e,h),y&&y.m(e,null),_=!0},p(k,W){(!_||W&1)&&i!==(i=k[0].message.type+"")&&ke(o,i),(!_||W&1)&&c!==(c=k[0].time.toISOString()+"")&&ke(d,c),k[3]?y?y.p(k,W):(y=Ta(k),y.c(),y.m(e,null)):y&&(y.d(1),y=null)},i(k){_||(k&&At(()=>{_&&(f||(f=Fr(e,_s,{duration:100},!0)),f.run(1))}),_=!0)},o(k){k&&(f||(f=Fr(e,_s,{duration:100},!1)),f.run(0)),_=!1},d(k){k&&L(e),y&&y.d(),k&&f&&f.end()}}}function Ta(n){let e,t,r=n[0].source.name+"",i,o,s,a,l=n[0].source.id+"",c;return{c(){e=A("p"),t=oe("Source Name: "),i=oe(r),o=te(),s=A("p"),a=oe("Source ID: "),c=oe(l)},m(d,h){N(d,e,h),E(e,t),E(e,i),N(d,o,h),N(d,s,h),E(s,a),E(s,c)},p(d,h){h&1&&r!==(r=d[0].source.name+"")&&ke(i,r),h&1&&l!==(l=d[0].source.id+"")&&ke(c,l)},d(d){d&&(L(e),L(o),L(s))}}}function Pu(n){let e,t,r,i,o,s,a=n[0].message.title+"",l,c,d,h,f,_,y,k,W,B,ne,$,H,ue,ye,g,w,m,se=n[2]&&Aa(n),me=n[0].message.content&&Sa(n),F=n[0].message.code&&Ia(n),x=n[4]&&Pa(n);return{c(){e=A("div"),t=A("div"),r=A("div"),o=te(),s=A("span"),l=oe(a),c=te(),se&&se.c(),d=te(),h=A("div"),me&&me.c(),f=te(),F&&F.c(),_=te(),y=A("div"),k=A("div"),W=A("span"),W.textContent="Details",B=te(),ne=A("div"),ue=te(),x&&x.c(),R(r,"class","js-engine-message-icon callout-icon"),R(s,"class","js-engine-message-title"),R(t,"class","js-engine-message-header callout-title"),R(ne,"class","js-engine-message-icon"),R(k,"class","js-engine-message-detail-row"),R(k,"aria-expanded",H=n[4]?"true":"false"),R(k,"role","button"),R(k,"tabindex","0"),R(y,"class","js-engine-message-detail"),R(h,"class","js-engine-message-content callout-content"),R(e,"class",ye="js-engine-message callout "+bs(n[0].message.type)),R(e,"data-callout",g=n[0].message.type)},m(b,S){N(b,e,S),E(e,t),E(t,r),E(t,o),E(t,s),E(s,l),E(t,c),se&&se.m(t,null),E(e,d),E(e,h),me&&me.m(h,null),E(h,f),F&&F.m(h,null),E(h,_),E(h,y),E(y,k),E(k,W),E(k,B),E(k,ne),E(y,ue),x&&x.m(y,null),w||(m=[yt(i=gt.call(null,r,ws(n[0].message.type))),yt($=gt.call(null,ne,n[4]?"chevron-down":"chevron-right")),Ae(k,"click",n[7]),Ae(k,"keydown",n[8])],w=!0)},p(b,[S]){i&&qe(i.update)&&S&1&&i.update.call(null,ws(b[0].message.type)),S&1&&a!==(a=b[0].message.title+"")&&ke(l,a),b[2]?se?se.p(b,S):(se=Aa(b),se.c(),se.m(t,null)):se&&(se.d(1),se=null),b[0].message.content?me?me.p(b,S):(me=Sa(b),me.c(),me.m(h,f)):me&&(me.d(1),me=null),b[0].message.code?F?F.p(b,S):(F=Ia(b),F.c(),F.m(h,_)):F&&(F.d(1),F=null),$&&qe($.update)&&S&16&&$.update.call(null,b[4]?"chevron-down":"chevron-right"),S&16&&H!==(H=b[4]?"true":"false")&&R(k,"aria-expanded",H),b[4]?x?(x.p(b,S),S&16&&Y(x,1)):(x=Pa(b),x.c(),Y(x,1),x.m(y,null)):x&&(ft(),K(x,1,1,()=>{x=null}),dt()),S&1&&ye!==(ye="js-engine-message callout "+bs(b[0].message.type))&&R(e,"class",ye),S&1&&g!==(g=b[0].message.type)&&R(e,"data-callout",g)},i(b){Y(x)},o(b){K(x)},d(b){b&&L(e),se&&se.d(),me&&me.d(),F&&F.d(),x&&x.d(),w=!1,we(m)}}}function Tu(n,e,t){let{messageWrapper:r}=e,{messageManager:i}=e,{showDeleteButton:o=!0}=e,{showMessageSource:s=!0}=e,a=!1,l=()=>i.removeMessage(r.uuid),c=f=>f.key===" "?i.removeMessage(r.uuid):void 0,d=()=>t(4,a=!a),h=f=>f.key===" "?t(4,a=!a):void 0;return n.$$set=f=>{"messageWrapper"in f&&t(0,r=f.messageWrapper),"messageManager"in f&&t(1,i=f.messageManager),"showDeleteButton"in f&&t(2,o=f.showDeleteButton),"showMessageSource"in f&&t(3,s=f.showMessageSource)},[r,i,o,s,a,l,c,d,h]}var vs=class extends V{constructor(e){super(),X(this,e,Tu,Pu,Q,{messageWrapper:0,messageManager:1,showDeleteButton:2,showMessageSource:3})}},pn=vs;function Ca(n,e,t){let r=n.slice();return r[5]=e[t][0],r[6]=e[t][1],r[7]=e,r[8]=t,r}function Cu(n){let e;return{c(){e=oe("Clear All Messages")},m(t,r){N(t,e,r)},d(t){t&&L(e)}}}function Fa(n){let e;return{c(){e=A("p"),e.textContent="None"},m(t,r){N(t,e,r)},p:le,d(t){t&&L(e)}}}function Oa(n){let e,t,r;function i(s){n[4](s,n[6],n[7],n[8])}let o={messageManager:n[0]};return n[6]!==void 0&&(o.messageWrapper=n[6]),e=new pn({props:o}),Ve.push(()=>hn(e,"messageWrapper",i)),{c(){Ye(e.$$.fragment)},m(s,a){Ue(e,s,a),r=!0},p(s,a){n=s;let l={};a&1&&(l.messageManager=n[0]),!t&&a&2&&(t=!0,l.messageWrapper=n[6],dn(()=>t=!1)),e.$set(l)},i(s){r||(Y(e.$$.fragment,s),r=!0)},o(s){K(e.$$.fragment,s),r=!1},d(s){Ge(e,s)}}}function Fu(n){let e,t,r,i,o,s;r=new Or({props:{variant:"destructive",$$slots:{default:[Cu]},$$scope:{ctx:n}}}),r.$on("click",n[3]);let a=it(n[1]),l=[];for(let h=0;h<a.length;h+=1)l[h]=Oa(Ca(n,a,h));let c=h=>K(l[h],1,1,()=>{l[h]=null}),d=null;return a.length||(d=Fa(n)),{c(){e=A("h2"),e.textContent="Messages",t=te(),Ye(r.$$.fragment),i=te(),o=A("div");for(let h=0;h<l.length;h+=1)l[h].c();d&&d.c()},m(h,f){N(h,e,f),N(h,t,f),Ue(r,h,f),N(h,i,f),N(h,o,f);for(let _=0;_<l.length;_+=1)l[_]&&l[_].m(o,null);d&&d.m(o,null),s=!0},p(h,[f]){let _={};if(f&512&&(_.$$scope={dirty:f,ctx:h}),r.$set(_),f&3){a=it(h[1]);let y;for(y=0;y<a.length;y+=1){let k=Ca(h,a,y);l[y]?(l[y].p(k,f),Y(l[y],1)):(l[y]=Oa(k),l[y].c(),Y(l[y],1),l[y].m(o,null))}for(ft(),y=a.length;y<l.length;y+=1)c(y);dt(),!a.length&&d?d.p(h,f):a.length?d&&(d.d(1),d=null):(d=Fa(h),d.c(),d.m(o,null))}},i(h){if(!s){Y(r.$$.fragment,h);for(let f=0;f<a.length;f+=1)Y(l[f]);s=!0}},o(h){K(r.$$.fragment,h),l=l.filter(Boolean);for(let f=0;f<l.length;f+=1)K(l[f]);s=!1},d(h){h&&(L(e),L(t),L(i),L(o)),Ge(r,h),ln(l,h),d&&d.d()}}}function Ou(n,e,t){let r,{messageManager:i}=e,o=i.messages;na(n,o,l=>t(1,r=l));let s=()=>i.removeAllMessages();function a(l,c,d,h){d[h][1]=l,o.set(r)}return n.$$set=l=>{"messageManager"in l&&t(0,i=l.messageManager)},[i,r,o,s,a]}var xs=class extends V{constructor(e){super(),X(this,e,Ou,Fu,Q,{messageManager:0})}},La=xs;var Lr=class extends Ra.Modal{constructor(t,r){super(t);this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new La({target:this.contentEl,props:{messageManager:this.plugin.messageManager}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}};function Da(n){return new ks(n)}var ks=class{constructor(e){this.value=e,this.subscriberCounter=0,this.subscribers=new Map}set(e){this.value!==e&&(this.value=e,this.notify())}update(e){this.set(e(this.value))}get(){return this.value}subscribe(e,t){let r=this.subscriberCounter;return this.subscriberCounter+=1,this.subscribers.set(r,e),e(this.value),()=>{this.subscribers.delete(r)}}notify(){for(let e of this.subscribers.values())e(this.value)}};function Na(n){return[...n]}var Lu=["error","warning","success","tip","info"];function bs(n){return`js-engine-message-mod-${n}`}function ws(n){var t;let e=new Map;return e.set("error","zap"),e.set("warning","alert-triangle"),e.set("success","check"),e.set("tip","flame"),e.set("info","info"),(t=e.get(n))!=null?t:"info"}function Ru(n){return`js-engine-message-indicator-mod-${n}`}var Rr=class{constructor(e,t,r,i){this.type=e,this.title=t,this.content=r,this.code=i}},mn=class{constructor(e,t){this.message=e,this.source=t,this.uuid=self.crypto.randomUUID(),this.time=(0,Nr.moment)()}},Dr=class{constructor(e,t){this.app=e,this.plugin=t,this.messages=Da(new Map)}initStatusBarItem(){this.messageDisplay=new Lr(this.app,this.plugin),this.statusBarItem=this.plugin.addStatusBarItem(),this.statusBarItem.addClass("mod-clickable"),this.statusBarItem.addEventListener("click",()=>{var e;(e=this.messageDisplay)==null||e.open()}),this.updateStatusBarItem(),this.messages.subscribe(e=>{this.updateStatusBarItem()})}addMessage(e,t){let r=new mn(e,t);return this.messages.get().set(r.uuid,r),this.messages.notify(),r}removeMessage(e){this.messages.get().delete(e),this.messages.notify()}removeAllMessages(){this.messages.get().clear(),this.messages.notify()}updateStatusBarItem(){if(!this.statusBarItem)return;this.statusBarItem.empty();let e=this.statusBarItem.createEl("div");(0,Nr.setIcon)(e,"message-square");let t=this.statusBarItem.createEl("span");t.addClass("js-engine-message-counter"),t.innerText=this.messages.get().size.toString();let r=new Set(Array.from(this.messages.get().values()).map(i=>i.message.type));for(let i of Lu)if(r.has(i)){t.addClass(Ru(i));break}r.size===0&&t.addClass("js-engine-message-indicator-mod-info")}getMessagesFromSource(e){let t=this.messages.get();return Na(t.values()).filter(r=>r.source.id===e.id)}};var yn=class{constructor(e,t,r){this.apiInstance=e,this._render=t,this.initialArgs=r}async refresh(...e){var r;let t;try{t=await this._render(...e)}catch(i){console.warn("failed to execute JS",i),i instanceof Error&&(t=this.apiInstance.message.createMessage("error","Failed to execute JS",`Failed to execute JS during reactive execution in execution "${this.apiInstance.instanceId.id}"`,i.stack))}(r=this.renderer)==null||r.render(t)}initialRender(){this.refresh(...this.initialArgs)}setRenderer(e){this.renderer=e}};var gn=class{constructor(e,t,r,i){this.plugin=e,this.container=t,this.sourcePath=r,this.component=i}async render(e){if(e!=null){if(this.container.empty(),typeof e=="string"){this.container.innerText=e;return}if(e instanceof Vt&&(e=e.toMarkdown()),e instanceof Et){console.log(`js-engine | Rendering Markdown String
+`,e.content),await e.render(this.plugin.app,this.container,this.sourcePath,this.component);return}if(e instanceof HTMLElement){this.container.append(e);return}if(e instanceof mn){new pn({target:this.container,props:{messageWrapper:e,messageManager:this.plugin.messageManager,showDeleteButton:!1,showMessageSource:!1}});return}if(e instanceof yn){e.setRenderer(this),e.initialRender();return}this.container.innerText=JSON.stringify(e)}}convertToSimpleObject(e){return e instanceof Vt?e.toMarkdown().content:e instanceof Et?e.content:e instanceof HTMLElement?e.outerHTML:e instanceof mn?e.message:e}};var qr=class extends Dt.MarkdownRenderChild{constructor(t,r,i,o){super(t);this.plugin=r,this.content=i,this.ctx=o}getExecutionFile(){if(!this.ctx.sourcePath)return;let t=this.plugin.app.vault.getAbstractFileByPath(this.ctx.sourcePath);if(t&&t instanceof Dt.TFile)return t}buildExecutionContext(){var r;let t=this.getExecutionFile();return{file:t,metadata:t===void 0?void 0:(r=this.plugin.app.metadataCache.getFileCache(t))!=null?r:void 0,block:void 0}}async tryRun(t){return this.plugin.jsEngine.execute({code:this.content,context:t,contextOverrides:{},component:this,container:this.containerEl})}async renderResults(t){let r=this.buildExecutionContext();this.jsExecution=await this.tryRun(r);let i=this.jsExecution.result;await new gn(this.plugin,t,this.ctx.sourcePath,this).render(i)}renderExecutionStats(t){let r=new Dt.Menu;r.addItem(o=>{o.setTitle("Info"),o.setIcon("info"),o.onClick(()=>{var s;(s=this.jsExecution)==null||s.openStatsModal()})}),r.addItem(o=>{o.setTitle("Rerun"),o.setIcon("rotate-ccw"),o.onClick(()=>{this.render()})});let i=t.createDiv();i.addClass("js-engine-execution-stats-button"),i.addEventListener("click",o=>{r.showAtMouseEvent(o)}),(0,Dt.setIcon)(i,"info")}async render(){var t,r;this.containerEl.empty(),this.containerEl.hasClass("js-engine-execution-render-child")||this.containerEl.addClass("js-engine-execution-render-child");try{await this.renderResults(this.containerEl),this.renderExecutionStats(this.containerEl)}catch(i){this.containerEl.innerText=i instanceof Error?(r=(t=i.stack)==null?void 0:t.toString())!=null?r:"":i,this.containerEl.addClass("mod-warning")}}async onload(){await this.render()}onunload(){}};var jr=class{constructor(e){this.apiInstance=e}createBuilder(){return new Vt}create(e){return new Et(e)}createText(e){return new ct(e,!1,!1,!1)}createBoldText(e){return new ct(e,!0,!1,!1)}createCursiveText(e){return new ct(e,!1,!0,!1)}createUnderlinedText(e){return new ct(e,!1,!1,!0)}createCode(e){return new Hn(e)}createParagraph(e){return new Qn(e)}createHeading(e,t){return new Yn(e,t)}createBlockQuote(){return new Zn}createCallout(e,t,r=""){return new Kn(e,t,r)}createCodeBlock(e,t){return new Xn(e,t)}createTable(e,t){return new Vn(e,t)}createList(e){return new $n(e)}};var zr=class{constructor(e){this.apiInstance=e,this.messageManager=e.plugin.messageManager}createMessage(e,t,r,i=""){return this.messageManager.addMessage(new Rr(e,t,r,i),this.apiInstance.instanceId)}getMessageById(e){return this.messageManager.messages.get().get(e)}getMessagesForInstance(){return this.messageManager.getMessagesFromSource(this.apiInstance.instanceId)}};var Xa=Ht(Hr()),Za=Ht(Ps()),Ka=Ht(rr()),Wo=Ht(Cs()),$a=Ht(Ss());var zs={};Zs(zs,{AsyncStream:()=>jo,InvalidArgumentError:()=>ge,LengthError:()=>Xe,Stream:()=>Nt,infinite:()=>Ot,math:()=>Vu,multi:()=>Yu,reduce:()=>Kr,set:()=>Qu,single:()=>bn,summary:()=>Xu,transform:()=>Zu});var ge=class extends Error{},Xe=class extends Error{};var Qt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function l(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},_t=function(n){return this instanceof _t?(this.v=n,this):new _t(n)},ja=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof _t?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}},Ie;(function(n){n[n.SHORTEST=0]="SHORTEST",n[n.LONGEST=1]="LONGEST",n[n.STRICT_EQUAL=2]="STRICT_EQUAL"})(Ie||(Ie={}));function*qt(n,e,...t){if(t.length===0)return;let r=[];for(let i of t)r.push(ir(i));e:for(;;){let i=bn.map(r,l=>l.next()),o=[],s=!0,a=!1;for(let l of i){let c;l.done?(s=!1,c=e):(a=!0,c=l.value),o.push(c)}if(!s&&a)switch(n){case Ie.SHORTEST:break e;case Ie.STRICT_EQUAL:throw new Xe("Iterators must have equal lengths")}if(!a)break;yield o}}function jt(n,e,...t){return ja(this,arguments,function*(){if(t.length===0)return yield _t(void 0);let i=[];for(let o of t)i.push(or(o));e:for(;;){let o=[];for(let c of i){let d=yield _t(c.next());o.push(d)}let s=[],a=!0,l=!1;for(let c of o){let d;c.done?(a=!1,d=e):(l=!0,d=c.value),s.push(d)}if(!a&&l)switch(n){case Ie.SHORTEST:break e;case Ie.STRICT_EQUAL:throw new Xe("Iterators must have equal lengths")}if(!l)break;yield yield _t(s)}})}var Xt=class{constructor(){this.addedMap=new Map,this.deletedMap=new Map}addUsage(e,t){this.addedMap.has(e)||this.addedMap.set(e,new Map);let r=this.addedMap.get(e);r.has(t)||r.set(t,0),r.set(t,r.get(t)+1)}deleteUsage(e){this.deletedMap.has(e)?this.deletedMap.set(e,this.deletedMap.get(e)+1):this.deletedMap.set(e,1)}getOwnersCount(e){var t,r;let i=(t=this.deletedMap.get(e))!==null&&t!==void 0?t:0;return Nt.of((r=this.addedMap.get(e))!==null&&r!==void 0?r:new Map).map(o=>o[1]).filter(o=>o>i).toValue(o=>o+1,0)}getUsagesCount(e,t=1){var r,i;let o=(r=this.deletedMap.get(e))!==null&&r!==void 0?r:0,s=Nt.of((i=this.addedMap.get(e))!==null&&i!==void 0?i:new Map).map(a=>a[1]).map(a=>a-o).filter(a=>a>0).toArray();for(;s.length>t;){let a=Kr.toMin(s);s=Nt.of(s).map(l=>l-a).filter(l=>l>0).toArray()}return Kr.toSum(s)}},Pe=class{},Xr=class{constructor(e,t){this.related=[],this.positions=[],this.cache=new Map,this.lastCacheIndex=0,this.isValid=!0,this.iterator=e;for(let r=0;r<t;++r)this.related.push(new Rs(this,r)),this.positions.push(0);this.cacheNextValue()}current(e){let t=this.getPosition(e);return this.cache.get(t)}next(e){let[t,r,i]=[this.getPosition(e),Math.min(...this.positions),Math.max(...this.positions)];t===i&&this.cacheNextValue(),this.positions[e.getId()]++,r<Math.min(...this.positions)&&this.cache.delete(r)}valid(e){return this.getPosition(e)<this.lastCacheIndex||this.isValid}getRelatedIterables(){return this.related}cacheNextValue(){let e=this.iterator.next();e.done||this.cache.set(this.lastCacheIndex++,e.value),this.isValid=!e.done}getPosition(e){return this.positions[e.getId()]}},Rs=class{constructor(e,t){this.parent=e,this.id=t}getId(){return this.id}valid(){return this.parent.valid(this)}next(){let e={value:this.current(),done:!this.valid()};return e.done||this.parent.next(this),e}current(){return this.parent.valid(this)?this.parent.current(this):void 0}*[Symbol.iterator](){for(;this.parent.valid(this);)yield this.parent.current(this),this.parent.next(this)}},Zr=class{constructor(e,t){this.related=[],this.positions=[],this.cache=new Map,this.lastCacheIndex=0,this.isValid=!0,this.isFirstIteration=!0,this.iterator=e;for(let r=0;r<t;++r)this.related.push(new Ds(this,r)),this.positions.push(0)}current(e){return Qt(this,void 0,void 0,function*(){this.isFirstIteration&&(yield this.cacheNextValue());let t=this.getPosition(e);return this.cache.get(t)})}next(e){return Qt(this,void 0,void 0,function*(){let[t,r,i]=[this.getPosition(e),Math.min(...this.positions),Math.max(...this.positions)];t===i&&(yield this.cacheNextValue()),this.positions[e.getId()]++,r<Math.min(...this.positions)&&this.cache.delete(r)})}valid(e){return Qt(this,void 0,void 0,function*(){return this.isFirstIteration&&(yield this.cacheNextValue()),this.getPosition(e)<this.lastCacheIndex||this.isValid})}getRelatedIterables(){return this.related}cacheNextValue(){return Qt(this,void 0,void 0,function*(){let e=yield this.iterator.next();e.done||this.cache.set(this.lastCacheIndex++,e.value),this.isFirstIteration=!1,this.isValid=!e.done})}getPosition(e){return this.positions[e.getId()]}},Ds=class{constructor(e,t){this.parent=e,this.id=t}getId(){return this.id}valid(){return Qt(this,void 0,void 0,function*(){return yield this.parent.valid(this)})}next(){return Qt(this,void 0,void 0,function*(){let e={value:yield this.current(),done:!(yield this.valid())};return e.done||(yield this.parent.next(this)),e})}current(){return Qt(this,void 0,void 0,function*(){return(yield this.parent.valid(this))?yield this.parent.current(this):void 0})}[Symbol.asyncIterator](){return ja(this,arguments,function*(){for(;yield _t(this.parent.valid(this));)yield yield _t(yield _t(this.parent.current(this))),yield _t(this.parent.next(this))})}};var sr=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},Oe=function(n){return this instanceof Oe?(this.v=n,this):new Oe(n)},ar=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof Oe?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}};function*wn(...n){for(let e of qt(Ie.SHORTEST,void 0,...n))yield e}function xn(...n){return ar(this,arguments,function*(){var t,r,i,o;try{for(var s=!0,a=sr(jt(Ie.SHORTEST,void 0,...n)),l;l=yield Oe(a.next()),t=l.done,!t;){o=l.value,s=!1;try{yield yield Oe(o)}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield Oe(i.call(a)))}finally{if(r)throw r.error}}})}function*$r(n,...e){for(let t of qt(Ie.LONGEST,n,...e))yield t}function ei(n,...e){return ar(this,arguments,function*(){var r,i,o,s;try{for(var a=!0,l=sr(jt(Ie.LONGEST,n,...e)),c;c=yield Oe(l.next()),r=c.done,!r;){s=c.value,a=!1;try{yield yield Oe(s)}finally{a=!0}}}catch(d){i={error:d}}finally{try{!a&&!r&&(o=l.return)&&(yield Oe(o.call(l)))}finally{if(i)throw i.error}}})}function*ti(...n){for(let e of qt(Ie.LONGEST,void 0,...n))yield e}function ni(...n){return ar(this,arguments,function*(){var t,r,i,o;try{for(var s=!0,a=sr(jt(Ie.LONGEST,void 0,...n)),l;l=yield Oe(a.next()),t=l.done,!t;){o=l.value,s=!1;try{yield yield Oe(o)}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield Oe(i.call(a)))}finally{if(r)throw r.error}}})}function*kn(...n){for(let e of qt(Ie.STRICT_EQUAL,void 0,...n))yield e}function En(...n){return ar(this,arguments,function*(){var t,r,i,o;try{for(var s=!0,a=sr(jt(Ie.STRICT_EQUAL,void 0,...n)),l;l=yield Oe(a.next()),t=l.done,!t;){o=l.value,s=!1;try{yield yield Oe(o)}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield Oe(i.call(a)))}finally{if(r)throw r.error}}})}function*ri(...n){for(let e of n)for(let t of z(e))yield t}function ii(...n){return ar(this,arguments,function*(){var t,r,i,o;for(let c of n)try{for(var s=!0,a=(r=void 0,sr(D(c))),l;l=yield Oe(a.next()),t=l.done,!t;){o=l.value,s=!1;try{yield yield Oe(o)}finally{s=!0}}}catch(d){r={error:d}}finally{try{!s&&!t&&(i=a.return)&&(yield Oe(i.call(a)))}finally{if(r)throw r.error}}})}var He=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function l(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},oi=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}};function et(n,e,t){let r=t;for(let i of z(n))r=e(r,i);return r}function tt(n,e,t){var r,i,o,s;return He(this,void 0,void 0,function*(){let a=t;try{for(var l=!0,c=oi(D(n)),d;d=yield c.next(),r=d.done,!r;){s=d.value,l=!1;try{a=yield e(a,s)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield o.call(c))}finally{if(i)throw i.error}}return a})}function si(n){let[e,t]=et(n,(r,i)=>{let[o,s]=r;return[o+1,s+Number(i)]},[0,0]);return e?t/e:void 0}function ai(n){return He(this,void 0,void 0,function*(){let[e,t]=yield tt(n,(r,i)=>{let[o,s]=r;return[o+1,s+Number(i)]},[0,0]);return e?t/e:void 0})}function li(n,e){return e!==void 0?et(n,(t,r)=>e(r)>e(t!=null?t:r)?r:t!=null?t:r):et(n,(t,r)=>{let i=t!=null?t:r,o=r;return i>=o?i:o})}function ui(n,e){return He(this,void 0,void 0,function*(){return e!==void 0?yield tt(n,(t,r)=>He(this,void 0,void 0,function*(){return(yield e(r))>(yield e(t!=null?t:r))?r:t!=null?t:r})):yield tt(n,(t,r)=>{let i=t!=null?t:r,o=r;return i>=o?i:o})})}function ci(n,e){return e!==void 0?et(n,(t,r)=>e(r)<e(t!=null?t:r)?r:t!=null?t:r):et(n,(t,r)=>{let i=t!=null?t:r,o=r;return i<=o?i:o})}function fi(n,e){return He(this,void 0,void 0,function*(){return e!==void 0?yield tt(n,(t,r)=>He(this,void 0,void 0,function*(){return(yield e(r))<(yield e(t!=null?t:r))?r:t!=null?t:r})):yield tt(n,(t,r)=>{let i=t!=null?t:r,o=r;return i<=o?i:o})})}function lr(n,e){let t=e!==void 0?e:r=>r;return et(n,(r,i)=>{var o,s,a,l;return r=r,[t(i)<=t((o=r[0])!==null&&o!==void 0?o:i)?i:(s=r[0])!==null&&s!==void 0?s:i,t(i)>=t((a=r[1])!==null&&a!==void 0?a:i)?i:(l=r[1])!==null&&l!==void 0?l:i]},[void 0,void 0])}function ur(n,e){return He(this,void 0,void 0,function*(){let t=e!==void 0?e:r=>r;return yield tt(n,(r,i)=>He(this,void 0,void 0,function*(){var o,s,a,l;return r=r,[(yield t(i))<=(yield t((o=r[0])!==null&&o!==void 0?o:i))?i:(s=r[0])!==null&&s!==void 0?s:i,(yield t(i))>=(yield t((a=r[1])!==null&&a!==void 0?a:i))?i:(l=r[1])!==null&&l!==void 0?l:i]}),[void 0,void 0])})}function di(n){let[e,t]=lr(zt(n,r=>Number(r)));return(t!=null?t:0)-(e!=null?e:0)}function hi(n){return He(this,void 0,void 0,function*(){let[e,t]=yield ur(bt(n,r=>Number(r)));return(t!=null?t:0)-(e!=null?e:0)})}function pi(n){return et(n,(e,t)=>e+Number(t),0)}function mi(n){return He(this,void 0,void 0,function*(){return yield tt(n,(e,t)=>e+Number(t),0)})}function yi(n){return et(n,(e,t)=>(e!=null?e:1)*t)}function gi(n){return He(this,void 0,void 0,function*(){return yield tt(n,(e,t)=>(e!=null?e:1)*t)})}function Zt(n){switch(!0){case n instanceof Array:return n.length;case vt(n):return n.length;case n instanceof Set:return n.size;case n instanceof Map:return n.size}return et(n,e=>e+1,0)}function Mn(n){return He(this,void 0,void 0,function*(){switch(!0){case n instanceof Array:case vt(n):case n instanceof Set:case n instanceof Map:return Zt(n)}return yield tt(n,e=>e+1,0)})}function _i(n){for(let e of z(n))return e;throw new Xe("Collection is empty")}function vi(n){var e,t,r,i;return He(this,void 0,void 0,function*(){try{for(var o=!0,s=oi(D(n)),a;a=yield s.next(),e=a.done,!e;){i=a.value,o=!1;try{return i}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}throw new Xe("Collection is empty")})}function bi(n){let e=!0,t;for(let r of z(n))t=r,e=!1;if(e)throw new Xe("Collection is empty");return t}function wi(n){var e,t,r,i;return He(this,void 0,void 0,function*(){let o=!0,s;try{for(var a=!0,l=oi(D(n)),c;c=yield l.next(),e=c.done,!e;){i=c.value,a=!1;try{s=i,o=!1}finally{a=!0}}}catch(d){t={error:d}}finally{try{!a&&!e&&(r=l.return)&&(yield r.call(l))}finally{if(t)throw t.error}}if(o)throw new Xe("Collection is empty");return s})}function xi(n){let e=Pe,t=Pe;for(let r of z(n))e===Pe&&(e=r),t=r;if(e===Pe)throw new Xe("Collection is empty");return[e,t]}function ki(n){var e,t,r,i;return He(this,void 0,void 0,function*(){let o=Pe,s=Pe;try{for(var a=!0,l=oi(D(n)),c;c=yield l.next(),e=c.done,!e;){i=c.value,a=!1;try{let d=i;o===Pe&&(o=d),s=d}finally{a=!0}}}catch(d){t={error:d}}finally{try{!a&&!e&&(r=l.return)&&(yield r.call(l))}finally{if(t)throw t.error}}if(o===Pe)throw new Xe("Collection is empty");return[o,s]})}var ht=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function l(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},It=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}};function Ei(n,e){for(let t of z(n))if(!e(t))return!1;return!0}function Mi(n,e){var t,r,i,o;return ht(this,void 0,void 0,function*(){try{for(var s=!0,a=It(D(n)),l;l=yield a.next(),t=l.done,!t;){o=l.value,s=!1;try{if(!(yield e(o)))return!1}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return!0})}function Ai(n){let e=new Set;for(let t of z(n)){if(e.has(t))return!1;e.add(t)}return!0}function Si(n){var e,t,r,i;return ht(this,void 0,void 0,function*(){let o=new Set;try{for(var s=!0,a=It(D(n)),l;l=yield a.next(),e=l.done,!e;){i=l.value,s=!1;try{let c=i;if(o.has(c))return!1;o.add(c)}finally{s=!0}}}catch(c){t={error:c}}finally{try{!s&&!e&&(r=a.return)&&(yield r.call(a))}finally{if(t)throw t.error}}return!0})}function Ii(n,e){for(let t of z(n))if(e(t))return!0;return!1}function Pi(n,e){var t,r,i,o;return ht(this,void 0,void 0,function*(){try{for(var s=!0,a=It(D(n)),l;l=yield a.next(),t=l.done,!t;){o=l.value,s=!1;try{if(yield e(o))return!0}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return!1})}function Ti(n,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let r=0;for(let i of z(n))if(t(i)&&(r++,r>e))return!1;return r===e}function Ci(n,e,t){var r,i,o,s;return ht(this,void 0,void 0,function*(){if(e<0)return!1;t===void 0&&(t=h=>!!h);let a=0;try{for(var l=!0,c=It(D(n)),d;d=yield c.next(),r=d.done,!r;){s=d.value,l=!1;try{if((yield t(s))&&(a++,a>e))return!1}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield o.call(c))}finally{if(i)throw i.error}}return a===e})}function za(n){for(let e of z(n))return!1;return!0}function Wa(n){var e,t,r,i;return ht(this,void 0,void 0,function*(){try{for(var o=!0,s=It(D(n)),a;a=yield s.next(),e=a.done,!e;){i=a.value,o=!1;try{let l=i;return!1}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}return!0})}function Ze(n){return n==null?!1:typeof n[Symbol.iterator]=="function"}function Pt(n){return n==null?!1:typeof n[Symbol.asyncIterator]=="function"}function at(n){return n==null?!1:n.next!==void 0&&typeof n.next=="function"}function Fi(n){for(let[e,t]of Tt(z(n)))if(e<t)return!1;return!0}function Oi(n){var e,t,r,i;return ht(this,void 0,void 0,function*(){try{for(var o=!0,s=It(Kt(D(n))),a;a=yield s.next(),e=a.done,!e;){i=a.value,o=!1;try{let[l,c]=i;if(l<c)return!1}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}return!0})}function Li(n){for(let[e,t]of Tt(z(n)))if(e>t)return!1;return!0}function Ri(n){var e,t,r,i;return ht(this,void 0,void 0,function*(){try{for(var o=!0,s=It(Kt(D(n))),a;a=yield s.next(),e=a.done,!e;){i=a.value,o=!1;try{let[l,c]=i;if(l>c)return!1}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}return!0})}function vt(n){return typeof n=="string"||n instanceof String}function Di(n,e){for(let t of z(n))if(e(t))return!1;return!0}function Ni(n,e){var t,r,i,o;return ht(this,void 0,void 0,function*(){try{for(var s=!0,a=It(D(n)),l;l=yield a.next(),t=l.done,!t;){o=l.value,s=!1;try{if(yield e(o))return!1}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return!0})}function qi(...n){try{for(let e of kn(...n))for(let[t,r]of Tt(e))if(t!==r)return!1}catch(e){return!1}return!0}function ji(...n){var e,t,r,i;return ht(this,void 0,void 0,function*(){try{try{for(var o=!0,s=It(En(...n)),a;a=yield s.next(),e=a.done,!e;){i=a.value,o=!1;try{let l=i;for(let[c,d]of Tt(l))if(c!==d)return!1}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}}catch(l){return!1}return!0})}function zi(...n){if(n.length<=1)return!0;let e=n.map(t=>Zt(t));return new Set(e).size===1}function Wi(...n){return ht(this,void 0,void 0,function*(){if(n.length<=1)return!0;let e=yield bt(n,t=>ht(this,void 0,void 0,function*(){return yield Mn(t)}));return new Set(yield pt(e)).size===1})}var qs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function l(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},wt=function(n){return this instanceof wt?(this.v=n,this):new wt(n)},Ns=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof wt?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}},Ji=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}};function z(n){if(Ze(n))return n;if(at(n))return{[Symbol.iterator](){return n}};if(typeof n=="object"&&n!==null)return function*(){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(yield[e,n[e]])}();throw new ge("Given collection is not iterable or iterator.")}function D(n){if(Pt(n))return n;if(at(n))return{[Symbol.asyncIterator](){return Ns(this,arguments,function*(){for(;;){let t=yield wt(n.next());if(t.done)return yield wt(void 0);yield yield wt(t.value)}})}};if(typeof n=="object"&&n!==null&&(n=z(n)),Ze(n))return{[Symbol.asyncIterator](){return Ns(this,arguments,function*(){for(let t of n)yield yield wt(t)})}};throw new ge("Given collection is not async iterable or iterator.")}function ir(n){if(at(n))return n;if(Ze(n))return function*(){for(let e of n)yield e}();throw new ge("Given collection is not iterable or iterator.")}function or(n){if((at(n)||Ze(n))&&(n=D(n)),Pt(n))return function(){return Ns(this,arguments,function*(){var e,t,r,i;try{for(var o=!0,s=Ji(n),a;a=yield wt(s.next()),e=a.done,!e;){i=a.value,o=!1;try{yield yield wt(i)}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield wt(r.call(s)))}finally{if(t)throw t.error}}})}();throw new ge("Given collection is not iterable or iterator.")}function Ct(n){let e=[];for(let t of z(n))e.push(t);return e}function pt(n){var e,t,r,i;return qs(this,void 0,void 0,function*(){let o=[];try{for(var s=!0,a=Ji(D(n)),l;l=yield a.next(),e=l.done,!e;){i=l.value,s=!1;try{let c=i;o.push(c)}finally{s=!0}}}catch(c){t={error:c}}finally{try{!s&&!e&&(r=a.return)&&(yield r.call(a))}finally{if(t)throw t.error}}return o})}function Bi(n){let e=new Map;for(let[t,r]of z(n))e.set(t,r);return e}function Ui(n){var e,t,r,i;return qs(this,void 0,void 0,function*(){let o=new Map;try{for(var s=!0,a=Ji(D(n)),l;l=yield a.next(),e=l.done,!e;){i=l.value,s=!1;try{let[c,d]=i;o.set(c,d)}finally{s=!0}}}catch(c){t={error:c}}finally{try{!s&&!e&&(r=a.return)&&(yield r.call(a))}finally{if(t)throw t.error}}return o})}function Gi(n){let e=new Set;for(let t of z(n))e.add(t);return e}function Hi(n){var e,t,r,i;return qs(this,void 0,void 0,function*(){let o=new Set;try{for(var s=!0,a=Ji(D(n)),l;l=yield a.next(),e=l.done,!e;){i=l.value,s=!1;try{let c=i;o.add(c)}finally{s=!0}}}catch(c){t={error:c}}finally{try{!s&&!e&&(r=a.return)&&(yield r.call(a))}finally{if(t)throw t.error}}return o})}function An(n,e){return new Xr(ir(n),e).getRelatedIterables()}function Sn(n,e){return new Zr(or(n),e).getRelatedIterables()}var Bu=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function l(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},xe=function(n){return this instanceof xe?(this.v=n,this):new xe(n)},In=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},Pn=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof xe?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}},Ja=function(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,o){e[i]=n[i]?function(s){return(t=!t)?{value:xe(n[i](s)),done:i==="return"}:o?o(s):s}:o}};function*$t(n,e){let t=new Set;if(n instanceof Map){e===void 0&&(e=r=>r[1]);for(let r of n){let i=e(r);t.has(i)||(yield r,t.add(i))}}else{e===void 0&&(e=r=>r);for(let r of z(n)){let i=e(r);t.has(i)||(yield r,t.add(i))}}}function Tn(n,e){return Pn(this,arguments,function*(){var r,i,o,s;let a=new Set;if(n instanceof Map)for(let h of $t(n,e))yield yield xe(yield xe(h));else{e===void 0&&(e=h=>h);try{for(var l=!0,c=In(D(n)),d;d=yield xe(c.next()),r=d.done,!r;){s=d.value,l=!1;try{let h=s,f=e(h);a.has(f)||(yield yield xe(h),a.add(f))}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield xe(o.call(c)))}finally{if(i)throw i.error}}}})}function*Vi(...n){yield*Cn(n.length,...n)}function Yi(...n){return Pn(this,arguments,function*(){yield xe(yield*Ja(In(Fn(n.length,...n))))})}function*Cn(n,...e){let t=new Xt,r=qt(Ie.LONGEST,Pe,...e);for(let i of r)for(let[o,s]of Ft(i))s!==Pe&&(t.addUsage(s,`${o}`),t.getOwnersCount(s)===n&&(yield s,t.deleteUsage(s)))}function Fn(n,...e){return Pn(this,arguments,function*(){var r,i,o,s;let a=new Xt,l=jt(Ie.LONGEST,Pe,...e);try{for(var c=!0,d=In(l),h;h=yield xe(d.next()),r=h.done,!r;){s=h.value,c=!1;try{let f=s;for(let[_,y]of Ft(f))y!==Pe&&(a.addUsage(y,`${_}`),a.getOwnersCount(y)===n&&(yield yield xe(y),a.deleteUsage(y)))}finally{c=!0}}}catch(f){i={error:f}}finally{try{!c&&!r&&(o=d.return)&&(yield xe(o.call(d)))}finally{if(i)throw i.error}}})}function*Qi(...n){let e=new Xt,t=new Set,r=qt(Ie.LONGEST,Pe,...n);for(let i of r)for(let[o,s]of Ft(i))s!==Pe&&(e.addUsage(s,`${o}`),t.add(s),e.getOwnersCount(s)===n.length&&e.deleteUsage(s));for(let i of t)for(let o of bn.repeat(i,e.getUsagesCount(i)))yield o}function Xi(...n){return Pn(this,arguments,function*(){var t,r,i,o;let s=new Xt,a=new Set,l=jt(Ie.LONGEST,Pe,...n);try{for(var c=!0,d=In(l),h;h=yield xe(d.next()),t=h.done,!t;){o=h.value,c=!1;try{let f=o;for(let[_,y]of Ft(f))y!==Pe&&(s.addUsage(y,`${_}`),a.add(y),s.getOwnersCount(y)===n.length&&s.deleteUsage(y))}finally{c=!0}}}catch(f){r={error:f}}finally{try{!c&&!t&&(i=d.return)&&(yield xe(i.call(d)))}finally{if(r)throw r.error}}for(let f of a)for(let _ of bn.repeat(f,s.getUsagesCount(f)))yield yield xe(_)})}function*Zi(...n){yield*Cn(1,...n)}function Ki(...n){return Pn(this,arguments,function*(){yield xe(yield*Ja(In(Fn(1,...n))))})}function*$i(...n){if(n.length===0)return;if(n.length===1){for(let r of z(n[0]))yield[r];return}let t=Ct(zt(n,r=>Ct(r))).reduce((r,i)=>r.flatMap(o=>i.map(s=>[...o,s])),[[]]);for(let r of t)yield r}function eo(...n){return Pn(this,arguments,function*(){var t,r,i,o;if(n.length===0)return yield xe(void 0);if(n.length===1){try{for(var s=!0,a=In(D(n[0])),l;l=yield xe(a.next()),t=l.done,!t;){o=l.value,s=!1;try{yield yield xe([o])}finally{s=!0}}}catch(h){r={error:h}}finally{try{!s&&!t&&(i=a.return)&&(yield xe(i.call(a)))}finally{if(r)throw r.error}}return yield xe(void 0)}let d=(yield xe(pt(bt(n,h=>Bu(this,void 0,void 0,function*(){return yield pt(h)}))))).reduce((h,f)=>h.flatMap(_=>f.map(y=>[..._,y])),[[]]);for(let h of d)yield yield xe(h)})}var Ee=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},M=function(n){return this instanceof M?(this.v=n,this):new M(n)},Ce=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof M?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}};function*zt(n,e){for(let t of z(n))yield e(t)}function bt(n,e){return Ce(this,arguments,function*(){var r,i,o,s;try{for(var a=!0,l=Ee(D(n)),c;c=yield M(l.next()),r=c.done,!r;){s=c.value,a=!1;try{yield yield M(yield M(e(s)))}finally{a=!0}}}catch(d){i={error:d}}finally{try{!a&&!r&&(o=l.return)&&(yield M(o.call(l)))}finally{if(i)throw i.error}}})}function*to(n,e){for(let[t,r]of wn(n,e))r&&(yield t)}function no(n,e){return Ce(this,arguments,function*(){var r,i,o,s;try{for(var a=!0,l=Ee(xn(n,e)),c;c=yield M(l.next()),r=c.done,!r;){s=c.value,a=!1;try{let[d,h]=s;h&&(yield yield M(d))}finally{a=!0}}}catch(d){i={error:d}}finally{try{!a&&!r&&(o=l.return)&&(yield M(o.call(l)))}finally{if(i)throw i.error}}})}function*ro(n,e){let t=!0;for(let r of z(n)){if(t){if(!e(r)){t=!1,yield r;continue}continue}yield r}}function io(n,e){return Ce(this,arguments,function*(){var r,i,o,s;let a=!0;try{for(var l=!0,c=Ee(D(n)),d;d=yield M(c.next()),r=d.done,!r;){s=d.value,l=!1;try{let h=s;if(a){if(!(yield M(e(h)))){a=!1,yield yield M(h);continue}continue}yield yield M(h)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield M(o.call(c)))}finally{if(i)throw i.error}}})}function*oo(n,e){for(let t of z(n))if(e(t))yield t;else break}function so(n,e){return Ce(this,arguments,function*(){var r,i,o,s;try{for(var a=!0,l=Ee(D(n)),c;c=yield M(l.next()),r=c.done,!r;){s=c.value,a=!1;try{let d=s;if(yield M(e(d)))yield yield M(d);else break}finally{a=!0}}}catch(d){i={error:d}}finally{try{!a&&!r&&(o=l.return)&&(yield M(o.call(l)))}finally{if(i)throw i.error}}})}function*Ba(n,e){if(e<0)throw new ge(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield n}function Ua(n,e){return Ce(this,arguments,function*(){if(e<0)throw new ge(`Number of repetitions cannot be negative: ${e}`);let r=yield M(n);for(let i=e;i>0;--i)yield yield M(r)})}function*ao(n,e){for(let t of z(n)){let r=e(t,e);if(Ze(r))for(let i of z(r))yield i;else yield r}}function lo(n,e){return Ce(this,arguments,function*(){var r,i,o,s,a,l,c,d;try{for(var h=!0,f=Ee(D(n)),_;_=yield M(f.next()),r=_.done,!r;){s=_.value,h=!1;try{let ne=yield M(e(s,e));if(Ze(ne)||Pt(ne))try{for(var y=!0,k=(l=void 0,Ee(D(ne))),W;W=yield M(k.next()),a=W.done,!a;){d=W.value,y=!1;try{yield yield M(d)}finally{y=!0}}}catch($){l={error:$}}finally{try{!y&&!a&&(c=k.return)&&(yield M(c.call(k)))}finally{if(l)throw l.error}}else yield yield M(ne)}finally{h=!0}}}catch(B){i={error:B}}finally{try{!h&&!r&&(o=f.return)&&(yield M(o.call(f)))}finally{if(i)throw i.error}}})}function*cr(n,e=1/0){if(e<1){for(let t of z(n))n instanceof Map&&(t=t[1]),yield t;return}for(let t of z(n))if(n instanceof Map&&(t=t[1]),(Ze(t)||at(t))&&!vt(t))for(let r of cr(t,e-1))yield r;else yield t}function fr(n,e=1/0){return Ce(this,arguments,function*(){var r,i,o,s,a,l,c,d,h,f,_,y;if(e<1){try{for(var k=!0,W=Ee(D(n)),B;B=yield M(W.next()),r=B.done,!r;){s=B.value,k=!1;try{let w=s;n instanceof Map&&(w=w[1]),yield yield M(w)}finally{k=!0}}}catch(w){i={error:w}}finally{try{!k&&!r&&(o=W.return)&&(yield M(o.call(W)))}finally{if(i)throw i.error}}return yield M(void 0)}try{for(var ne=!0,$=Ee(D(n)),H;H=yield M($.next()),a=H.done,!a;){d=H.value,ne=!1;try{let w=d;if(n instanceof Map&&(w=w[1]),(Pt(w)||Ze(w)||at(w))&&!vt(w))try{for(var ue=!0,ye=(f=void 0,Ee(fr(w,e-1))),g;g=yield M(ye.next()),h=g.done,!h;){y=g.value,ue=!1;try{yield yield M(y)}finally{ue=!0}}}catch(m){f={error:m}}finally{try{!ue&&!h&&(_=ye.return)&&(yield M(_.call(ye)))}finally{if(f)throw f.error}}else yield yield M(w)}finally{ne=!0}}}catch(w){l={error:w}}finally{try{!ne&&!a&&(c=$.return)&&(yield M(c.call($)))}finally{if(l)throw l.error}}})}function*uo(n,e){for(let t of z(n))e(t)&&(yield t)}function co(n,e){return Ce(this,arguments,function*(){var r,i,o,s;try{for(var a=!0,l=Ee(D(n)),c;c=yield M(l.next()),r=c.done,!r;){s=c.value,a=!1;try{let d=s;(yield M(e(d)))&&(yield yield M(d))}finally{a=!0}}}catch(d){i={error:d}}finally{try{!a&&!r&&(o=l.return)&&(yield M(o.call(l)))}finally{if(i)throw i.error}}})}function*On(n,e,t,r=!0){if(e<1)throw new ge(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new ge("Overlap size must be less than chunk size");let i=[],o=!1;for(let s of z(n))o=!1,i.push(s),i.length===e&&(yield i,i=i.slice(e-t),o=!0);!o&&i.length>0&&r&&(yield i)}function Ln(n,e,t,r=!0){return Ce(this,arguments,function*(){var o,s,a,l;if(e<1)throw new ge(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new ge("Overlap size must be less than chunk size");let c=[],d=!1;try{for(var h=!0,f=Ee(D(n)),_;_=yield M(f.next()),o=_.done,!o;){l=_.value,h=!1;try{let y=l;d=!1,c.push(y),c.length===e&&(yield yield M(c),c=c.slice(e-t),d=!0)}finally{h=!0}}}catch(y){s={error:y}}finally{try{!h&&!o&&(a=f.return)&&(yield M(a.call(f)))}finally{if(s)throw s.error}}!d&&c.length>0&&r&&(yield yield M(c))})}function*fo(n,e){for(let t of On(n,e,0))yield t}function ho(n,e){return Ce(this,arguments,function*(){var r,i,o,s;try{for(var a=!0,l=Ee(Ln(n,e,0)),c;c=yield M(l.next()),r=c.done,!r;){s=c.value,a=!1;try{yield yield M(s)}finally{a=!0}}}catch(d){i={error:d}}finally{try{!a&&!r&&(o=l.return)&&(yield M(o.call(l)))}finally{if(i)throw i.error}}})}function*Tt(n){let e=On(n,2,1,!1);for(let t of e)yield t}function Kt(n){return Ce(this,arguments,function*(){var t,r,i,o;let s=Ln(n,2,1,!1);try{for(var a=!0,l=Ee(s),c;c=yield M(l.next()),t=c.done,!t;){o=c.value,a=!1;try{yield yield M(o)}finally{a=!0}}}catch(d){r={error:d}}finally{try{!a&&!t&&(i=l.return)&&(yield M(i.call(l)))}finally{if(r)throw r.error}}})}function*po(n,e){if(e<0)throw new ge(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let r of z(n)){if(t>=e)return;yield r,++t}}function mo(n,e){return Ce(this,arguments,function*(){var r,i,o,s;if(e<0)throw new ge(`Limit must be \u2265 0. Got ${e}`);let a=0;try{for(var l=!0,c=Ee(D(n)),d;d=yield M(c.next()),r=d.done,!r;){s=d.value,l=!1;try{let h=s;if(a>=e)return yield M(void 0);yield yield M(h),++a}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield M(o.call(c)))}finally{if(i)throw i.error}}})}function*Ft(n){let e=0;for(let t of z(n))yield[e++,t]}function yo(n){return Ce(this,arguments,function*(){var t,r,i,o;let s=0;try{for(var a=!0,l=Ee(D(n)),c;c=yield M(l.next()),t=c.done,!t;){o=c.value,a=!1;try{let d=o;yield yield M([s++,d])}finally{a=!0}}}catch(d){r={error:d}}finally{try{!a&&!t&&(i=l.return)&&(yield M(i.call(l)))}finally{if(r)throw r.error}}})}function*go(n,e=0,t,r=1){if(e<0)throw new ge("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new ge("Parameter 'count' cannot be negative");if(r<=0)throw new ge("Parameter 'step' must be positive");let i=0,o=0;for(let s of z(n))if(!(i++<e||(i-e-1)%r!==0)){if(o++===t&&t!==void 0)break;yield s}}function _o(n,e=0,t,r=1){return Ce(this,arguments,function*(){var o,s,a,l;if(e<0)throw new ge("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new ge("Parameter 'count' cannot be negative");if(r<=0)throw new ge("Parameter 'step' must be positive");let c=0,d=0;try{for(var h=!0,f=Ee(D(n)),_;_=yield M(f.next()),o=_.done,!o;){l=_.value,h=!1;try{let y=l;if(c++<e||(c-e-1)%r!==0)continue;if(d++===t&&t!==void 0)break;yield yield M(y)}finally{h=!0}}}catch(y){s={error:y}}finally{try{!h&&!o&&(a=f.return)&&(yield M(a.call(f)))}finally{if(s)throw s.error}}})}function*vo(n){for(let[e]of z(n))yield e}function bo(n){return Ce(this,arguments,function*(){var t,r,i,o;try{for(var s=!0,a=Ee(D(n)),l;l=yield M(a.next()),t=l.done,!t;){o=l.value,s=!1;try{let[c]=o;yield yield M(c)}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield M(i.call(a)))}finally{if(r)throw r.error}}})}function*wo(n,e,t=0){if(e<0||t<0)throw new ge;let r=-t;for(let i of z(n))(r<0||r>=e)&&(yield i),++r}function xo(n,e,t=0){return Ce(this,arguments,function*(){var i,o,s,a;if(e<0||t<0)throw new ge;let l=-t;try{for(var c=!0,d=Ee(D(n)),h;h=yield M(d.next()),i=h.done,!i;){a=h.value,c=!1;try{let f=a;(l<0||l>=e)&&(yield yield M(f)),++l}finally{c=!0}}}catch(f){o={error:f}}finally{try{!c&&!i&&(s=d.return)&&(yield M(s.call(d)))}finally{if(o)throw o.error}}})}function*ko(n){for(let[,e]of z(n))yield e}function Eo(n){return Ce(this,arguments,function*(){var t,r,i,o;try{for(var s=!0,a=Ee(D(n)),l;l=yield M(a.next()),t=l.done,!t;){o=l.value,s=!1;try{let[,c]=o;yield yield M(c)}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield M(i.call(a)))}finally{if(r)throw r.error}}})}function*Mo(n,e,t){let r=new Map,i=o=>{r.has(o)||(t!==void 0?r.set(o,{}):r.set(o,[]))};for(let o of z(n)){let s=e(o),a=t!==void 0?t(o):void 0,l=(Ze(s)||at(s))&&!vt(s)?s:[s];for(let c of $t(l))i(c),a===void 0?r.get(c).push(o):r.get(c)[a]=o}for(let o of r)yield o}function Ao(n,e,t){return Ce(this,arguments,function*(){var i,o,s,a,l,c,d,h;let f=new Map,_=H=>{f.has(H)||(t!==void 0?f.set(H,{}):f.set(H,[]))};try{for(var y=!0,k=Ee(D(n)),W;W=yield M(k.next()),i=W.done,!i;){a=W.value,y=!1;try{let H=a,ue=yield M(e(H)),ye=t!==void 0?yield M(t(H)):void 0,g=(Pt(ue)||Ze(ue)||at(ue))&&!vt(ue)?ue:[ue];try{for(var B=!0,ne=(c=void 0,Ee(Tn(g))),$;$=yield M(ne.next()),l=$.done,!l;){h=$.value,B=!1;try{let w=h;_(w),ye===void 0?f.get(w).push(H):f.get(w)[ye]=H}finally{B=!0}}}catch(w){c={error:w}}finally{try{!B&&!l&&(d=ne.return)&&(yield M(d.call(ne)))}finally{if(c)throw c.error}}}finally{y=!0}}}catch(H){o={error:H}}finally{try{!y&&!i&&(s=k.return)&&(yield M(s.call(k)))}finally{if(o)throw o.error}}for(let H of f)yield yield M(H)})}function*So(n,e){let t=Ct(n);e!==void 0?t.sort(e):t.sort();for(let r of t)yield r}function Io(n,e){return Ce(this,arguments,function*(){let r=yield M(pt(n));e!==void 0?r.sort(e):r.sort();for(let i of r)yield yield M(i)})}var Ga=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},Wt=function(n){return this instanceof Wt?(this.v=n,this):new Wt(n)},Uu=function(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,o){e[i]=n[i]?function(s){return(t=!t)?{value:Wt(n[i](s)),done:i==="return"}:o?o(s):s}:o}},Gu=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof Wt?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}};function*Ha(n=1,e=1){for(let t=n;;t+=e)yield t}function*js(n){let e=[...z(n)];if(e.length!==0)for(;;)for(let t of e)yield t}function Va(n){return Gu(this,arguments,function*(){var t,r,i,o;let s=[];try{for(var a=!0,l=Ga(D(n)),c;c=yield Wt(l.next()),t=c.done,!t;){o=c.value,a=!1;try{let d=o;s.push(d),yield yield Wt(d)}finally{a=!0}}}catch(d){r={error:d}}finally{try{!a&&!t&&(i=l.return)&&(yield Wt(i.call(l)))}finally{if(r)throw r.error}}yield Wt(yield*Uu(Ga(js(s))))})}function*Ya(n){for(;;)yield n}var Rn=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},_e=function(n){return this instanceof _e?(this.v=n,this):new _e(n)},Dn=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof _e?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}};function*Po(n,e){let t=0;for(let r of dr(z(n),e))t++,yield r/t}function To(n,e){return Dn(this,arguments,function*(){var r,i,o,s;let a=0;try{for(var l=!0,c=Rn(hr(D(n),e)),d;d=yield _e(c.next()),r=d.done,!r;){s=d.value,l=!1;try{let h=s;a++,yield yield _e(h/a)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield _e(o.call(c)))}finally{if(i)throw i.error}}})}function*Co(n,e){e!==void 0&&(yield e);let t=e!=null?e:0;for(let r of z(n))t-=Number(r),yield t}function Fo(n,e){return Dn(this,arguments,function*(){var r,i,o,s;e!==void 0&&(yield yield _e(e));let a=e!=null?e:0;try{for(var l=!0,c=Rn(D(n)),d;d=yield _e(c.next()),r=d.done,!r;){s=d.value,l=!1;try{a-=Number(s),yield yield _e(a)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield _e(o.call(c)))}finally{if(i)throw i.error}}})}function*Oo(n,e){e!==void 0&&(yield e);let t=e!=null?e:-1/0;for(let r of z(n))t=Math.max(t,r),yield t}function Lo(n,e){return Dn(this,arguments,function*(){var r,i,o,s;e!==void 0&&(yield yield _e(e));let a=e!=null?e:-1/0;try{for(var l=!0,c=Rn(D(n)),d;d=yield _e(c.next()),r=d.done,!r;){s=d.value,l=!1;try{a=Math.max(a,s),yield yield _e(a)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield _e(o.call(c)))}finally{if(i)throw i.error}}})}function*Ro(n,e){e!==void 0&&(yield e);let t=e!=null?e:1/0;for(let r of z(n))t=Math.min(t,r),yield t}function Do(n,e){return Dn(this,arguments,function*(){var r,i,o,s;e!==void 0&&(yield yield _e(e));let a=e!=null?e:1/0;try{for(var l=!0,c=Rn(D(n)),d;d=yield _e(c.next()),r=d.done,!r;){s=d.value,l=!1;try{a=Math.min(a,s),yield yield _e(a)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield _e(o.call(c)))}finally{if(i)throw i.error}}})}function*No(n,e){e!==void 0&&(yield e);let t=e!=null?e:1;for(let r of z(n))t*=Number(r),yield t}function qo(n,e){return Dn(this,arguments,function*(){var r,i,o,s;e!==void 0&&(yield yield _e(e));let a=e!=null?e:1;try{for(var l=!0,c=Rn(D(n)),d;d=yield _e(c.next()),r=d.done,!r;){s=d.value,l=!1;try{a*=Number(s),yield yield _e(a)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield _e(o.call(c)))}finally{if(i)throw i.error}}})}function*dr(n,e){e!==void 0&&(yield e);let t=e!=null?e:0;for(let r of z(n))t+=Number(r),yield t}function hr(n,e){return Dn(this,arguments,function*(){var r,i,o,s;e!==void 0&&(yield yield _e(e));let a=e!=null?e:0;try{for(var l=!0,c=Rn(D(n)),d;d=yield _e(c.next()),r=d.done,!r;){s=d.value,l=!1;try{a+=Number(s),yield yield _e(a)}finally{l=!0}}}catch(h){i={error:h}}finally{try{!l&&!r&&(o=c.return)&&(yield _e(o.call(c)))}finally{if(i)throw i.error}}})}var Nt=class n{static of(e){return new n(z(e))}static ofEmpty(){return new n([])}static ofCount(e=1,t=1){return new n(Ot.count(e,t))}static ofCycle(e){return new n(Ot.cycle(e))}static ofRepeat(e){return new n(Ot.repeat(e))}zipWith(...e){return this.data=wn(this.data,...e),this}zipFilledWith(e,...t){return this.data=$r(e,this.data,...t),this}zipLongestWith(...e){return this.data=ti(this.data,...e),this}zipEqualWith(...e){return this.data=kn(this.data,...e),this}chainWith(...e){return this.data=ri(this.data,...e),this}chunkwiseOverlap(e,t,r=!0){return this.data=On(this.data,e,t,r),this}chunkwise(e){return this.data=fo(this.data,e),this}compress(e){return this.data=to(this.data,e),this}dropWhile(e){return this.data=ro(this.data,e),this}filter(e){return this.data=uo(this.data,e),this}enumerate(){return this.data=Ft(this.data),this}keys(){return this.data=vo(this.data),this}limit(e){return this.data=po(this.data,e),this}map(e){return this.data=zt(this.data,e),this}flatMap(e){return this.data=ao(this.data,e),this}flatten(e=1/0){return this.data=cr(this.data,e),this}groupBy(e,t){return this.data=Mo(this.data,e,t),this}pairwise(){return this.data=Tt(this.data),this}runningAverage(e){return this.data=Po(this.data,e),this}runningDifference(e){return this.data=Co(this.data,e),this}runningMax(e){return this.data=Oo(this.data,e),this}runningMin(e){return this.data=Ro(this.data,e),this}runningProduct(e){return this.data=No(this.data,e),this}runningTotal(e){return this.data=dr(this.data,e),this}skip(e,t=0){return this.data=wo(this.data,e,t),this}slice(e=0,t,r=1){return this.data=go(this.data,e,t,r),this}takeWhile(e){return this.data=oo(this.data,e),this}values(){return this.data=ko(this.data),this}sort(e){return this.data=So(this.data,e),this}distinct(e){return this.data=$t(this.data,e),this}intersectionWith(...e){return this.data=Vi(this.data,...e),this}partialIntersectionWith(e,...t){return this.data=Cn(e,this.data,...t),this}symmetricDifferenceWith(...e){return this.data=Qi(this.data,...e),this}unionWith(...e){return this.data=Zi(this.data,...e),this}cartesianProductWith(...e){return this.data=$i(this.data,...e),this}peek(e){let[t,r]=An(this.data,2);this.data=t;for(let i of r)e(i);return this}peekStream(e){let[t,r]=An(this.data,2);return this.data=t,e(n.of(r)),this}toValue(e,t){return et(this,e,t)}toAverage(){return si(this)}toCount(){return Zt(this)}toMax(e){return li(this,e)}toMin(e){return ci(this,e)}toMinMax(e){return lr(this,e)}toFirst(){return _i(this)}toFirstAndLast(){return xi(this)}toLast(){return bi(this)}toSum(){return pi(this)}toProduct(){return yi(this)}toRange(){return di(this)}allMatch(e){return Ei(this,e)}allUnique(){return Ai(this)}anyMatch(e){return Ii(this,e)}exactlyN(e,t){return Ti(this,e,t)}isSorted(){return Li(this)}isReversed(){return Fi(this)}noneMatch(e){return Di(this,e)}sameWith(...e){return qi(this.data,...e)}sameCountWith(...e){return zi(this.data,...e)}tee(e){return An(this.data,e).map(t=>new n(t))}toArray(){return Ct(this)}toMap(){return Bi(this)}toSet(){return Gi(this)}*[Symbol.iterator](){for(let e of this.data)yield e}constructor(e){this.data=e}};var ve=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function l(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},Qa=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},Nn=function(n){return this instanceof Nn?(this.v=n,this):new Nn(n)},Hu=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(_){return new Promise(function(y,k){o.push([f,_,y,k])>1||a(f,_)})})}function a(f,_){try{l(r[f](_))}catch(y){h(o[0][3],y)}}function l(f){f.value instanceof Nn?Promise.resolve(f.value.v).then(c,d):h(o[0][2],f)}function c(f){a("next",f)}function d(f){a("throw",f)}function h(f,_){f(_),o.shift(),o.length&&a(o[0][0],o[0][1])}},jo=class n{static of(e){return new n(D(e))}static ofEmpty(){return new n(D([]))}static ofCount(e=1,t=1){return new n(D(Ot.count(e,t)))}static ofCycle(e){return new n(Ot.cycleAsync(e))}static ofRepeat(e){return new n(D(Ot.repeat(e)))}zipWith(...e){return this.data=xn(this.data,...e),this}zipFilledWith(e,...t){return this.data=ei(e,this.data,...t),this}zipLongestWith(...e){return this.data=ni(this.data,...e),this}zipEqualWith(...e){return this.data=En(this.data,...e),this}chainWith(...e){return this.data=ii(this.data,...e),this}chunkwiseOverlap(e,t,r=!0){return this.data=Ln(this.data,e,t,r),this}chunkwise(e){return this.data=ho(this.data,e),this}compress(e){return this.data=no(this.data,e),this}dropWhile(e){return this.data=io(this.data,e),this}filter(e){return this.data=co(this.data,e),this}enumerate(){return this.data=yo(this.data),this}keys(){return this.data=bo(this.data),this}limit(e){return this.data=mo(this.data,e),this}map(e){return this.data=bt(this.data,e),this}flatMap(e){return this.data=lo(this.data,e),this}flatten(e=1/0){return this.data=fr(this.data,e),this}groupBy(e,t){return this.data=Ao(this.data,e,t),this}pairwise(){return this.data=Kt(this.data),this}runningAverage(e){return this.data=To(this.data,e),this}runningDifference(e){return this.data=Fo(this.data,e),this}runningMax(e){return this.data=Lo(this.data,e),this}runningMin(e){return this.data=Do(this.data,e),this}runningProduct(e){return this.data=qo(this.data,e),this}runningTotal(e){return this.data=hr(this.data,e),this}skip(e,t=0){return this.data=xo(this.data,e,t),this}slice(e=0,t,r=1){return this.data=_o(this.data,e,t,r),this}takeWhile(e){return this.data=so(this.data,e),this}values(){return this.data=Eo(this.data),this}sort(e){return this.data=Io(this.data,e),this}distinct(e){return this.data=Tn(this.data,e),this}intersectionWith(...e){return this.data=Yi(this.data,...e),this}partialIntersectionWith(e,...t){return this.data=Fn(e,this.data,...t),this}symmetricDifferenceWith(...e){return this.data=Xi(this.data,...e),this}unionWith(...e){return this.data=Ki(this.data,...e),this}cartesianProductWith(...e){return this.data=eo(this.data,...e),this}peek(e){let[t,r]=Sn(this.data,2);return this.data=t,ve(this,void 0,void 0,function*(){var i,o,s,a;try{for(var l=!0,c=Qa(r),d;d=yield c.next(),i=d.done,!i;){a=d.value,l=!1;try{e(a)}finally{l=!0}}}catch(h){o={error:h}}finally{try{!l&&!i&&(s=c.return)&&(yield s.call(c))}finally{if(o)throw o.error}}}),this}peekStream(e){let[t,r]=Sn(this.data,2);return this.data=t,e(n.of(r)),this}toValue(e,t){return ve(this,void 0,void 0,function*(){return yield tt(this,e,t)})}toAverage(){return ve(this,void 0,void 0,function*(){return yield ai(this)})}toCount(){return ve(this,void 0,void 0,function*(){return yield Mn(this)})}toMax(e){return ve(this,void 0,void 0,function*(){return yield ui(this,e)})}toMin(e){return ve(this,void 0,void 0,function*(){return yield fi(this,e)})}toMinMax(e){return ve(this,void 0,void 0,function*(){return yield ur(this,e)})}toFirst(){return ve(this,void 0,void 0,function*(){return yield vi(this)})}toFirstAndLast(){return ve(this,void 0,void 0,function*(){return yield ki(this)})}toLast(){return ve(this,void 0,void 0,function*(){return yield wi(this)})}toSum(){return ve(this,void 0,void 0,function*(){return yield mi(this)})}toProduct(){return ve(this,void 0,void 0,function*(){return yield gi(this)})}toRange(){return ve(this,void 0,void 0,function*(){return yield hi(this)})}allMatch(e){return ve(this,void 0,void 0,function*(){return yield Mi(this,e)})}allUnique(){return ve(this,void 0,void 0,function*(){return yield Si(this)})}anyMatch(e){return ve(this,void 0,void 0,function*(){return yield Pi(this,e)})}exactlyNAsync(e,t){return ve(this,void 0,void 0,function*(){return Ci(this,e,t)})}isSorted(){return ve(this,void 0,void 0,function*(){return yield Ri(this)})}isReversed(){return ve(this,void 0,void 0,function*(){return yield Oi(this)})}noneMatch(e){return ve(this,void 0,void 0,function*(){return yield Ni(this,e)})}sameWith(...e){return ve(this,void 0,void 0,function*(){return yield ji(this.data,...e)})}sameCountWith(...e){return ve(this,void 0,void 0,function*(){return yield Wi(this.data,...e)})}tee(e){return Sn(this.data,e).map(t=>new n(t))}toArray(){return ve(this,void 0,void 0,function*(){return yield pt(this)})}toMap(){return ve(this,void 0,void 0,function*(){return yield Ui(this)})}toSet(){return ve(this,void 0,void 0,function*(){return yield Hi(this)})}[Symbol.asyncIterator](){return Hu(this,arguments,function*(){var t,r,i,o;try{for(var s=!0,a=Qa(this.data),l;l=yield Nn(a.next()),t=l.done,!t;){o=l.value,s=!1;try{yield yield Nn(o)}finally{s=!0}}}catch(c){r={error:c}}finally{try{!s&&!t&&(i=a.return)&&(yield Nn(i.call(a)))}finally{if(r)throw r.error}}})}constructor(e){this.data=e}};var bn={chunkwise:fo,chunkwiseOverlap:On,compress:to,dropWhile:ro,enumerate:Ft,filter:uo,flatMap:ao,flatten:cr,groupBy:Mo,keys:vo,limit:po,map:zt,pairwise:Tt,repeat:Ba,skip:wo,slice:go,sort:So,takeWhile:oo,values:ko,chunkwiseAsync:ho,chunkwiseOverlapAsync:Ln,compressAsync:no,dropWhileAsync:io,enumerateAsync:yo,filterAsync:co,flatMapAsync:lo,flattenAsync:fr,groupByAsync:Ao,keysAsync:bo,limitAsync:mo,mapAsync:bt,pairwiseAsync:Kt,repeatAsync:Ua,skipAsync:xo,sliceAsync:_o,sortAsync:Io,takeWhileAsync:so,valuesAsync:Eo},Ot={count:Ha,cycle:js,cycleAsync:Va,repeat:Ya},Vu={runningAverage:Po,runningDifference:Co,runningMax:Oo,runningMin:Ro,runningProduct:No,runningTotal:dr,runningAverageAsync:To,runningDifferenceAsync:Fo,runningMaxAsync:Lo,runningMinAsync:Do,runningProductAsync:qo,runningTotalAsync:hr},Yu={chain:ri,zip:wn,zipFilled:$r,zipLongest:ti,zipEqual:kn,chainAsync:ii,zipAsync:xn,zipFilledAsync:ei,zipLongestAsync:ni,zipEqualAsync:En},Qu={distinct:$t,intersection:Vi,partialIntersection:Cn,symmetricDifference:Qi,union:Zi,cartesianProduct:$i,distinctAsync:Tn,intersectionAsync:Yi,partialIntersectionAsync:Fn,symmetricDifferenceAsync:Xi,unionAsync:Ki,cartesianProductAsync:eo},Kr={toAverage:si,toCount:Zt,toFirst:_i,toFirstAndLast:xi,toLast:bi,toMax:li,toMin:ci,toMinMax:lr,toProduct:yi,toRange:di,toSum:pi,toValue:et,toAverageAsync:ai,toCountAsync:Mn,toFirstAsync:vi,toFirstAndLastAsync:ki,toLastAsync:wi,toMaxAsync:ui,toMinAsync:fi,toMinMaxAsync:ur,toProductAsync:gi,toRangeAsync:hi,toSumAsync:mi,toValueAsync:tt},Xu={allMatch:Ei,allUnique:Ai,anyMatch:Ii,exactlyN:Ti,isEmpty:za,isAsyncIterable:Pt,isIterable:Ze,isIterator:at,isReversed:Fi,isSorted:Li,isString:vt,noneMatch:Di,same:qi,sameCount:zi,allMatchAsync:Mi,allUniqueAsync:Si,anyMatchAsync:Pi,exactlyNAsync:Ci,isEmptyAsync:Wa,isReversedAsync:Oi,isSortedAsync:Ri,noneMatchAsync:Ni,sameAsync:ji,sameCountAsync:Wi},Zu={tee:An,toArray:Ct,toAsyncIterable:D,toAsyncIterator:or,toIterable:z,toIterator:ir,toMap:Bi,toSet:Gi,teeAsync:Sn,toArrayAsync:pt,toMapAsync:Ui,toSetAsync:Hi};var zo=class{constructor(e){this.apiInstance=e}parsinom(){return{P:Xa.P,P_UTILS:Za.P_UTILS,Parser:Ka.Parser,createParsingErrorMessage:Wo.createParsingErrorMessage,ParsingError:Wo.ParsingError,ParserContext:$a.ParserContext}}itertools(){return zs}};var pr=require("obsidian");var Jo=class{constructor(e){this.apiInstance=e}async execute(e){return await this.apiInstance.plugin.jsEngine.execute(e)}createRenderer(e,t,r){return new gn(this.apiInstance.plugin,e,t,r)}async executeFile(e,t){let r=this.apiInstance.app.vault.getAbstractFileByPath(e);if(!r||!(r instanceof pr.TFile))throw new Error(`File ${e} not found.`);let i=t;return i.code=await this.apiInstance.app.vault.read(r),await this.execute(i)}async executeFileSimple(e,t){let r=new pr.Component;r.load();try{return await this.executeFile(e,{component:r,...t})}finally{r.unload()}}async getContextForFile(e){let t=this.apiInstance.app.vault.getAbstractFileByPath(e);if(!t||!(t instanceof pr.TFile))throw new Error(`File ${e} not found.`);let r=this.apiInstance.app.metadataCache.getFileCache(t);return{file:t,metadata:r!=null?r:void 0,block:void 0}}};var qn=class{constructor(e,t,r){this.app=e,this.plugin=t,this.instanceId=r,this.markdown=new jr(this),this.message=new zr(this),this.lib=new zo(this),this.internal=new Jo(this)}async importJs(e){let t=this.app.vault.adapter.getResourcePath(e);if(!t.includes("?")){let r=this.app.metadataCache.getFirstLinkpathDest(e,"");r&&(t+="?"+r.stat.mtime)}return import(t)}getPlugin(e){return this.app.plugins.getPlugin(e)}reactive(e,...t){return new yn(this,e,t)}};var jn=class n{constructor(e,t){this.name=e,this.id=t}toString(){return`plugin:js-engine:${this.name}:${this.id}`}static create(e){return new n(e,self.crypto.randomUUID())}};var $u=Ht(require("obsidian")),Bo=class{constructor(e){this.app=e.app,this.plugin=e.plugin,this.code=e.code,this.context=Object.assign({},e.context,e.contextOverrides),this.uuid=self.crypto.randomUUID(),this.apiInstance=new qn(this.app,this.plugin,new jn("JS_EXECUTION",this.uuid)),this.messages=[],this.func=void 0,this.globals={app:this.app,engine:this.apiInstance,context:this.context,component:e.component,container:e.container,obsidian:$u}}buildFunction(){var t;let e=performance.now();try{this.func=window.eval(`(async function anonymous(${Object.keys(this.globals).join(", ")}) {
+
+${this.code}
+
+})
+ //# sourceURL=${encodeURIComponent(this.apiInstance.instanceId.toString())}`)}catch(r){r instanceof Error&&(this.functionBuildError=r,this.result=(t=this.plugin.api)==null?void 0:t.message.createMessage("error","Failed to parse JS",`Failed to parse JS during execution "${this.uuid}"`,r.stack))}this.functionBuildTime=performance.now()-e}async runFunction(){if(this.functionBuildError)throw new Error("can not run function, function construction failed");if(!this.func)throw new Error("can not run function, function has not been constructed yet");let e=performance.now();try{this.result=await Promise.resolve(this.func(...Object.values(this.globals)))}catch(t){console.warn("failed to execute JS",t),t instanceof Error&&(this.functionRunError=t,this.result=this.apiInstance.message.createMessage("error","Failed to execute JS",`Failed to execute JS during execution "${this.uuid}"`,t.stack))}this.messages=this.apiInstance.message.getMessagesForInstance(),this.functionRunTime=performance.now()-e}isSuccessful(){return!this.functionBuildError&&!this.functionRunError}getMessages(){return this.messages}openStatsModal(){this.plugin.jsEngine.openExecutionStatsModal(this)}};var ll=require("obsidian");function el(n,e,t){let r=n.slice();return r[2]=e[t],r}function tl(n,e,t){let r=n.slice();return r[5]=e[t],r}function nl(n){let e;return{c(){e=A("tr"),e.innerHTML="<td>none</td> <td>-</td> "},m(t,r){N(t,e,r)},p:le,d(t){t&&L(e)}}}function rl(n,e){let t,r,i=e[5][0]+"",o,s,a,l=typeof e[5][1],c,d;return{key:n,first:null,c(){t=A("tr"),r=A("td"),o=oe(i),s=te(),a=A("td"),c=oe(l),d=te(),this.first=t},m(h,f){N(h,t,f),E(t,r),E(r,o),E(t,s),E(t,a),E(a,c),E(t,d)},p(h,f){e=h,f&1&&i!==(i=e[5][0]+"")&&ke(o,i),f&1&&l!==(l=typeof e[5][1])&&ke(c,l)},d(h){h&&L(t)}}}function il(n){let e;return{c(){e=A("p"),e.textContent="None"},m(t,r){N(t,e,r)},p:le,d(t){t&&L(e)}}}function ol(n){let e,t;return e=new pn({props:{messageWrapper:n[2],messageManager:n[0].plugin.messageManager,showDeleteButton:!1,showMessageSource:!1}}),{c(){Ye(e.$$.fragment)},m(r,i){Ue(e,r,i),t=!0},p(r,i){let o={};i&1&&(o.messageManager=r[0].plugin.messageManager),e.$set(o)},i(r){t||(Y(e.$$.fragment,r),t=!0)},o(r){K(e.$$.fragment,r),t=!1},d(r){Ge(e,r)}}}function ec(n){var zn,Wn;let e,t,r,i,o,s=n[0].uuid+"",a,l,c,d,h,f,_=sl(n[0].code)+"",y,k,W,B,ne,$=Math.round((zn=n[0].functionBuildTime)!=null?zn:0)+"",H,ue,ye,g,w,m=Math.round((Wn=n[0].functionRunTime)!=null?Wn:0)+"",se,me,F,x,b,S,P,q,J,U,T=[],C=new Map,j,ee,lt,Z,fe,Te=it(Object.entries(n[0].globals)),Me=G=>G[5][0];for(let G=0;G<Te.length;G+=1){let ce=tl(n,Te,G),Re=Me(ce);C.set(Re,T[G]=rl(Re,ce))}let ae=null;Te.length||(ae=nl(n));let be=it(n[1]),re=[];for(let G=0;G<be.length;G+=1)re[G]=ol(el(n,be,G));let en=G=>K(re[G],1,1,()=>{re[G]=null}),Le=null;return be.length||(Le=il(n)),{c(){e=A("div"),t=A("h2"),t.textContent="JS Execution Stats",r=te(),i=A("p"),o=oe("Execution ID: "),a=oe(s),l=te(),c=A("h3"),c.textContent="Code",d=te(),h=A("pre"),f=A("code"),y=te(),k=A("h3"),k.textContent="Time",W=te(),B=A("p"),ne=oe("Build Time: "),H=oe($),ue=oe(" ms"),ye=te(),g=A("p"),w=oe("Execution Time: "),se=oe(m),me=oe(" ms"),F=te(),x=A("h3"),x.textContent="Arguments",b=te(),S=A("div"),P=A("table"),q=A("thead"),q.innerHTML="<tr><th>Argument Name</th> <th>Value Type</th></tr>",J=te(),U=A("tbody");for(let G=0;G<T.length;G+=1)T[G].c();ae&&ae.c(),j=te(),ee=A("h3"),ee.textContent="Messages",lt=te(),Z=A("div");for(let G=0;G<re.length;G+=1)re[G].c();Le&&Le.c(),R(f,"class","language-js"),R(h,"class","language-js"),R(S,"class","markdown-rendered")},m(G,ce){N(G,e,ce),E(e,t),E(e,r),E(e,i),E(i,o),E(i,a),E(e,l),E(e,c),E(e,d),E(e,h),E(h,f),f.innerHTML=_,E(e,y),E(e,k),E(e,W),E(e,B),E(B,ne),E(B,H),E(B,ue),E(e,ye),E(e,g),E(g,w),E(g,se),E(g,me),E(e,F),E(e,x),E(e,b),E(e,S),E(S,P),E(P,q),E(P,J),E(P,U);for(let Re=0;Re<T.length;Re+=1)T[Re]&&T[Re].m(U,null);ae&&ae.m(U,null),E(e,j),E(e,ee),E(e,lt),E(e,Z);for(let Re=0;Re<re.length;Re+=1)re[Re]&&re[Re].m(Z,null);Le&&Le.m(Z,null),fe=!0},p(G,[ce]){var Re,yr;if((!fe||ce&1)&&s!==(s=G[0].uuid+"")&&ke(a,s),(!fe||ce&1)&&_!==(_=sl(G[0].code)+"")&&(f.innerHTML=_),(!fe||ce&1)&&$!==($=Math.round((Re=G[0].functionBuildTime)!=null?Re:0)+"")&&ke(H,$),(!fe||ce&1)&&m!==(m=Math.round((yr=G[0].functionRunTime)!=null?yr:0)+"")&&ke(se,m),ce&1&&(Te=it(Object.entries(G[0].globals)),T=ya(T,ce,Me,1,G,Te,C,U,ma,rl,null,tl),!Te.length&&ae?ae.p(G,ce):Te.length?ae&&(ae.d(1),ae=null):(ae=nl(G),ae.c(),ae.m(U,null))),ce&3){be=it(G[1]);let De;for(De=0;De<be.length;De+=1){let Jt=el(G,be,De);re[De]?(re[De].p(Jt,ce),Y(re[De],1)):(re[De]=ol(Jt),re[De].c(),Y(re[De],1),re[De].m(Z,null))}for(ft(),De=be.length;De<re.length;De+=1)en(De);dt(),!be.length&&Le?Le.p(G,ce):be.length?Le&&(Le.d(1),Le=null):(Le=il(G),Le.c(),Le.m(Z,null))}},i(G){if(!fe){for(let ce=0;ce<be.length;ce+=1)Y(re[ce]);fe=!0}},o(G){re=re.filter(Boolean);for(let ce=0;ce<re.length;ce+=1)K(re[ce]);fe=!1},d(G){G&&L(e);for(let ce=0;ce<T.length;ce+=1)T[ce].d();ae&&ae.d(),ln(re,G),Le&&Le.d()}}}function sl(n){let e=window.Prism;try{return e.highlight(n,e.languages.javascript,"javascript")}catch(t){return console.warn("js-engine | failed to highlight code",t),n}}function tc(n,e,t){let{execution:r}=e,i=r.getMessages();return n.$$set=o=>{"execution"in o&&t(0,r=o.execution)},[r,i]}var Ws=class extends V{constructor(e){super(),X(this,e,tc,ec,Q,{execution:0})}},al=Ws;var Uo=class extends ll.Modal{constructor(t,r){super(t);this.plugin=r}setExecution(t){this.execution=t}onOpen(){if(this.contentEl.empty(),this.component&&this.component.$destroy(),this.contentEl.hasClass("js-engine-execution-stats-modal")||this.contentEl.addClass("js-engine-execution-stats-modal"),this.execution===void 0){this.contentEl.createEl("p",{cls:"mod-warning",text:"No execution data available."});return}this.component=new al({target:this.contentEl,props:{execution:this.execution}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}};var Go=class{constructor(e,t){this.app=e,this.plugin=t,this.executionStatsModal=new Uo(this.app,this.plugin),this.activeExecutions=new Map}async execute(e){let t=new Bo({app:this.app,plugin:this.plugin,...e});return this.activeExecutions.set(t.uuid,t),t.buildFunction(),t.functionBuildError||await t.runFunction(),this.activeExecutions.delete(t.uuid),t}openExecutionStatsModal(e){this.executionStatsModal.setExecution(e),this.executionStatsModal.open()}};function Ho(n){var e=n.statementIndent,t=n.jsonld,r=n.json||t,i=n.typescript,o=n.wordCharacters||/[\w$\xa1-\uffff]/,s=function(){function u(Ke){return{type:Ke,style:"keyword"}}var p=u("keyword a"),v=u("keyword b"),I=u("keyword c"),O=u("keyword d"),ie=u("operator"),he={type:"atom",style:"atom"};return{if:u("if"),while:p,with:p,else:v,do:v,try:v,finally:v,return:O,break:O,continue:O,new:u("new"),delete:I,void:I,throw:I,debugger:u("debugger"),var:u("var"),const:u("var"),let:u("var"),function:u("function"),catch:u("catch"),for:u("for"),switch:u("switch"),case:u("case"),default:u("default"),in:ie,typeof:ie,instanceof:ie,true:he,false:he,null:he,undefined:he,NaN:he,Infinity:he,this:u("this"),class:u("class"),super:u("atom"),yield:I,export:u("export"),import:u("import"),extends:I,await:I}}(),a=/[+\-*&%=<>!?|~^@]/,l=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function c(u){for(var p=!1,v,I=!1;(v=u.next())!=null;){if(!p){if(v=="/"&&!I)return;v=="["?I=!0:I&&v=="]"&&(I=!1)}p=!p&&v=="\\"}}var d,h;function f(u,p,v){return d=u,h=v,p}function _(u,p){var v=u.next();if(v=='"'||v=="'")return p.tokenize=y(v),p.tokenize(u,p);if(v=="."&&u.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return f("number","number");if(v=="."&&u.match(".."))return f("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(v))return f(v);if(v=="="&&u.eat(">"))return f("=>","operator");if(v=="0"&&u.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return f("number","number");if(/\d/.test(v))return u.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),f("number","number");if(v=="/")return u.eat("*")?(p.tokenize=k,k(u,p)):u.eat("/")?(u.skipToEnd(),f("comment","comment")):Sl(u,p,1)?(c(u),u.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),f("regexp","string.special")):(u.eat("="),f("operator","operator",u.current()));if(v=="`")return p.tokenize=W,W(u,p);if(v=="#"&&u.peek()=="!")return u.skipToEnd(),f("meta","meta");if(v=="#"&&u.eatWhile(o))return f("variable","property");if(v=="<"&&u.match("!--")||v=="-"&&u.match("->")&&!/\S/.test(u.string.slice(0,u.start)))return u.skipToEnd(),f("comment","comment");if(a.test(v))return(v!=">"||!p.lexical||p.lexical.type!=">")&&(u.eat("=")?(v=="!"||v=="=")&&u.eat("="):/[<>*+\-|&?]/.test(v)&&(u.eat(v),v==">"&&u.eat(v))),v=="?"&&u.eat(".")?f("."):f("operator","operator",u.current());if(o.test(v)){u.eatWhile(o);var I=u.current();if(p.lastType!="."){if(s.propertyIsEnumerable(I)){var O=s[I];return f(O.type,O.style,I)}if(I=="async"&&u.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return f("async","keyword",I)}return f("variable","variable",I)}}function y(u){return function(p,v){var I=!1,O;if(t&&p.peek()=="@"&&p.match(l))return v.tokenize=_,f("jsonld-keyword","meta");for(;(O=p.next())!=null&&!(O==u&&!I);)I=!I&&O=="\\";return I||(v.tokenize=_),f("string","string")}}function k(u,p){for(var v=!1,I;I=u.next();){if(I=="/"&&v){p.tokenize=_;break}v=I=="*"}return f("comment","comment")}function W(u,p){for(var v=!1,I;(I=u.next())!=null;){if(!v&&(I=="`"||I=="$"&&u.eat("{"))){p.tokenize=_;break}v=!v&&I=="\\"}return f("quasi","string.special",u.current())}var B="([{}])";function ne(u,p){p.fatArrowAt&&(p.fatArrowAt=null);var v=u.string.indexOf("=>",u.start);if(!(v<0)){if(i){var I=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(u.string.slice(u.start,v));I&&(v=I.index)}for(var O=0,ie=!1,he=v-1;he>=0;--he){var Ke=u.string.charAt(he),nt=B.indexOf(Ke);if(nt>=0&&nt<3){if(!O){++he;break}if(--O==0){Ke=="("&&(ie=!0);break}}else if(nt>=3&&nt<6)++O;else if(o.test(Ke))ie=!0;else if(/["'\/`]/.test(Ke))for(;;--he){if(he==0)return;var Un=u.string.charAt(he-1);if(Un==Ke&&u.string.charAt(he-2)!="\\"){he--;break}}else if(ie&&!O){++he;break}}ie&&!O&&(p.fatArrowAt=he)}}var $={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function H(u,p,v,I,O,ie){this.indented=u,this.column=p,this.type=v,this.prev=O,this.info=ie,I!=null&&(this.align=I)}function ue(u,p){for(var v=u.localVars;v;v=v.next)if(v.name==p)return!0;for(var I=u.context;I;I=I.prev)for(var v=I.vars;v;v=v.next)if(v.name==p)return!0}function ye(u,p,v,I,O){var ie=u.cc;for(g.state=u,g.stream=O,g.marked=null,g.cc=ie,g.style=p,u.lexical.hasOwnProperty("align")||(u.lexical.align=!0);;){var he=ie.length?ie.pop():r?Z:ee;if(he(v,I)){for(;ie.length&&ie[ie.length-1].lex;)ie.pop()();return g.marked?g.marked:v=="variable"&&ue(u,I)?"variableName.local":p}}}var g={state:null,column:null,marked:null,cc:null};function w(){for(var u=arguments.length-1;u>=0;u--)g.cc.push(arguments[u])}function m(){return w.apply(null,arguments),!0}function se(u,p){for(var v=p;v;v=v.next)if(v.name==u)return!0;return!1}function me(u){var p=g.state;if(g.marked="def",p.context){if(p.lexical.info=="var"&&p.context&&p.context.block){var v=F(u,p.context);if(v!=null){p.context=v;return}}else if(!se(u,p.localVars)){p.localVars=new S(u,p.localVars);return}}n.globalVars&&!se(u,p.globalVars)&&(p.globalVars=new S(u,p.globalVars))}function F(u,p){if(p)if(p.block){var v=F(u,p.prev);return v?v==p.prev?p:new b(v,p.vars,!0):null}else return se(u,p.vars)?p:new b(p.prev,new S(u,p.vars),!1);else return null}function x(u){return u=="public"||u=="private"||u=="protected"||u=="abstract"||u=="readonly"}function b(u,p,v){this.prev=u,this.vars=p,this.block=v}function S(u,p){this.name=u,this.next=p}var P=new S("this",new S("arguments",null));function q(){g.state.context=new b(g.state.context,g.state.localVars,!1),g.state.localVars=P}function J(){g.state.context=new b(g.state.context,g.state.localVars,!0),g.state.localVars=null}q.lex=J.lex=!0;function U(){g.state.localVars=g.state.context.vars,g.state.context=g.state.context.prev}U.lex=!0;function T(u,p){var v=function(){var I=g.state,O=I.indented;if(I.lexical.type=="stat")O=I.lexical.indented;else for(var ie=I.lexical;ie&&ie.type==")"&&ie.align;ie=ie.prev)O=ie.indented;I.lexical=new H(O,g.stream.column(),u,null,I.lexical,p)};return v.lex=!0,v}function C(){var u=g.state;u.lexical.prev&&(u.lexical.type==")"&&(u.indented=u.lexical.indented),u.lexical=u.lexical.prev)}C.lex=!0;function j(u){function p(v){return v==u?m():u==";"||v=="}"||v==")"||v=="]"?w():m(p)}return p}function ee(u,p){return u=="var"?m(T("vardef",p),$o,j(";"),C):u=="keyword a"?m(T("form"),Te,ee,C):u=="keyword b"?m(T("form"),ee,C):u=="keyword d"?g.stream.match(/^\s*$/,!1)?m():m(T("stat"),ae,j(";"),C):u=="debugger"?m(j(";")):u=="{"?m(T("}"),J,gr,C,U):u==";"?m():u=="if"?(g.state.lexical.info=="else"&&g.state.cc[g.state.cc.length-1]==C&&g.state.cc.pop()(),m(T("form"),Te,ee,C,Us)):u=="function"?m(Rt):u=="for"?m(T("form"),J,Gs,ee,U,C):u=="class"||i&&p=="interface"?(g.marked="keyword",m(T("form",u=="class"?u:p),Vs,C)):u=="variable"?i&&p=="declare"?(g.marked="keyword",m(ee)):i&&(p=="module"||p=="enum"||p=="type")&&g.stream.match(/^\s*\w/,!1)?(g.marked="keyword",p=="enum"?m(Xs):p=="type"?m(Hs,j("operator"),de,j(";")):m(T("form"),ut,j("{"),T("}"),gr,C,C)):i&&p=="namespace"?(g.marked="keyword",m(T("form"),Z,ee,C)):i&&p=="abstract"?(g.marked="keyword",m(ee)):m(T("stat"),yr):u=="switch"?m(T("form"),Te,j("{"),T("}","switch"),J,gr,C,C,U):u=="case"?m(Z,j(":")):u=="default"?m(j(":")):u=="catch"?m(T("form"),q,lt,ee,C,U):u=="export"?m(T("stat"),wl,C):u=="import"?m(T("stat"),xl,C):u=="async"?m(ee):p=="@"?m(Z,ee):w(T("stat"),Z,j(";"),C)}function lt(u){if(u=="(")return m(Ut,j(")"))}function Z(u,p){return Me(u,p,!1)}function fe(u,p){return Me(u,p,!0)}function Te(u){return u!="("?w():m(T(")"),ae,j(")"),C)}function Me(u,p,v){if(g.state.fatArrowAt==g.stream.start){var I=v?Wn:zn;if(u=="(")return m(q,T(")"),Ne(Ut,")"),C,j("=>"),I,U);if(u=="variable")return w(q,ut,j("=>"),I,U)}var O=v?re:be;return $.hasOwnProperty(u)?m(O):u=="function"?m(Rt,O):u=="class"||i&&p=="interface"?(g.marked="keyword",m(T("form"),bl,C)):u=="keyword c"||u=="async"?m(v?fe:Z):u=="("?m(T(")"),ae,j(")"),C,O):u=="operator"||u=="spread"?m(v?fe:Z):u=="["?m(T("]"),El,C,O):u=="{"?Jn(Jt,"}",null,O):u=="quasi"?w(en,O):u=="new"?m(G(v)):m()}function ae(u){return u.match(/[;\}\)\],]/)?w():w(Z)}function be(u,p){return u==","?m(ae):re(u,p,!1)}function re(u,p,v){var I=v==!1?be:re,O=v==!1?Z:fe;if(u=="=>")return m(q,v?Wn:zn,U);if(u=="operator")return/\+\+|--/.test(p)||i&&p=="!"?m(I):i&&p=="<"&&g.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?m(T(">"),Ne(de,">"),C,I):p=="?"?m(Z,j(":"),O):m(O);if(u=="quasi")return w(en,I);if(u!=";"){if(u=="(")return Jn(fe,")","call",I);if(u==".")return m(De,I);if(u=="[")return m(T("]"),ae,j("]"),C,I);if(i&&p=="as")return g.marked="keyword",m(de,I);if(u=="regexp")return g.state.lastType=g.marked="operator",g.stream.backUp(g.stream.pos-g.stream.start-1),m(O)}}function en(u,p){return u!="quasi"?w():p.slice(p.length-2)!="${"?m(en):m(ae,Le)}function Le(u){if(u=="}")return g.marked="string.special",g.state.tokenize=W,m(en)}function zn(u){return ne(g.stream,g.state),w(u=="{"?ee:Z)}function Wn(u){return ne(g.stream,g.state),w(u=="{"?ee:fe)}function G(u){return function(p){return p=="."?m(u?Re:ce):p=="variable"&&i?m(ml,u?re:be):w(u?fe:Z)}}function ce(u,p){if(p=="target")return g.marked="keyword",m(be)}function Re(u,p){if(p=="target")return g.marked="keyword",m(re)}function yr(u){return u==":"?m(C,ee):w(be,j(";"),C)}function De(u){if(u=="variable")return g.marked="property",m()}function Jt(u,p){if(u=="async")return g.marked="property",m(Jt);if(u=="variable"||g.style=="keyword"){if(g.marked="property",p=="get"||p=="set")return m(cl);var v;return i&&g.state.fatArrowAt==g.stream.start&&(v=g.stream.match(/^\s*:\s*/,!1))&&(g.state.fatArrowAt=g.stream.pos+v[0].length),m(Bt)}else{if(u=="number"||u=="string")return g.marked=t?"property":g.style+" property",m(Bt);if(u=="jsonld-keyword")return m(Bt);if(i&&x(p))return g.marked="keyword",m(Jt);if(u=="[")return m(Z,tn,j("]"),Bt);if(u=="spread")return m(fe,Bt);if(p=="*")return g.marked="keyword",m(Jt);if(u==":")return w(Bt)}}function cl(u){return u!="variable"?w(Bt):(g.marked="property",m(Rt))}function Bt(u){if(u==":")return m(fe);if(u=="(")return w(Rt)}function Ne(u,p,v){function I(O,ie){if(v?v.indexOf(O)>-1:O==","){var he=g.state.lexical;return he.info=="call"&&(he.pos=(he.pos||0)+1),m(function(Ke,nt){return Ke==p||nt==p?w():w(u)},I)}return O==p||ie==p?m():v&&v.indexOf(";")>-1?w(u):m(j(p))}return function(O,ie){return O==p||ie==p?m():w(u,I)}}function Jn(u,p,v){for(var I=3;I<arguments.length;I++)g.cc.push(arguments[I]);return m(T(p,v),Ne(u,p),C)}function gr(u){return u=="}"?m():w(ee,gr)}function tn(u,p){if(i){if(u==":")return m(de);if(p=="?")return m(tn)}}function fl(u,p){if(i&&(u==":"||p=="in"))return m(de)}function Js(u){if(i&&u==":")return g.stream.match(/^\s*\w+\s+is\b/,!1)?m(Z,dl,de):m(de)}function dl(u,p){if(p=="is")return g.marked="keyword",m()}function de(u,p){if(p=="keyof"||p=="typeof"||p=="infer"||p=="readonly")return g.marked="keyword",m(p=="typeof"?fe:de);if(u=="variable"||p=="void")return g.marked="type",m(xt);if(p=="|"||p=="&")return m(de);if(u=="string"||u=="number"||u=="atom")return m(xt);if(u=="[")return m(T("]"),Ne(de,"]",","),C,xt);if(u=="{")return m(T("}"),Xo,C,xt);if(u=="(")return m(Ne(Ko,")"),hl,xt);if(u=="<")return m(Ne(de,">"),de);if(u=="quasi")return w(Zo,xt)}function hl(u){if(u=="=>")return m(de)}function Xo(u){return u.match(/[\}\)\]]/)?m():u==","||u==";"?m(Xo):w(Bn,Xo)}function Bn(u,p){if(u=="variable"||g.style=="keyword")return g.marked="property",m(Bn);if(p=="?"||u=="number"||u=="string")return m(Bn);if(u==":")return m(de);if(u=="[")return m(j("variable"),fl,j("]"),Bn);if(u=="(")return w(rn,Bn);if(!u.match(/[;\}\)\],]/))return m()}function Zo(u,p){return u!="quasi"?w():p.slice(p.length-2)!="${"?m(Zo):m(de,pl)}function pl(u){if(u=="}")return g.marked="string.special",g.state.tokenize=W,m(Zo)}function Ko(u,p){return u=="variable"&&g.stream.match(/^\s*[?:]/,!1)||p=="?"?m(Ko):u==":"?m(de):u=="spread"?m(Ko):w(de)}function xt(u,p){if(p=="<")return m(T(">"),Ne(de,">"),C,xt);if(p=="|"||u=="."||p=="&")return m(de);if(u=="[")return m(de,j("]"),xt);if(p=="extends"||p=="implements")return g.marked="keyword",m(de);if(p=="?")return m(de,j(":"),de)}function ml(u,p){if(p=="<")return m(T(">"),Ne(de,">"),C,xt)}function _r(){return w(de,yl)}function yl(u,p){if(p=="=")return m(de)}function $o(u,p){return p=="enum"?(g.marked="keyword",m(Xs)):w(ut,tn,Lt,_l)}function ut(u,p){if(i&&x(p))return g.marked="keyword",m(ut);if(u=="variable")return me(p),m();if(u=="spread")return m(ut);if(u=="[")return Jn(gl,"]");if(u=="{")return Jn(Bs,"}")}function Bs(u,p){return u=="variable"&&!g.stream.match(/^\s*:/,!1)?(me(p),m(Lt)):(u=="variable"&&(g.marked="property"),u=="spread"?m(ut):u=="}"?w():u=="["?m(Z,j("]"),j(":"),Bs):m(j(":"),ut,Lt))}function gl(){return w(ut,Lt)}function Lt(u,p){if(p=="=")return m(fe)}function _l(u){if(u==",")return m($o)}function Us(u,p){if(u=="keyword b"&&p=="else")return m(T("form","else"),ee,C)}function Gs(u,p){if(p=="await")return m(Gs);if(u=="(")return m(T(")"),vl,C)}function vl(u){return u=="var"?m($o,nn):u=="variable"?m(nn):w(nn)}function nn(u,p){return u==")"?m():u==";"?m(nn):p=="in"||p=="of"?(g.marked="keyword",m(Z,nn)):w(Z,nn)}function Rt(u,p){if(p=="*")return g.marked="keyword",m(Rt);if(u=="variable")return me(p),m(Rt);if(u=="(")return m(q,T(")"),Ne(Ut,")"),C,Js,ee,U);if(i&&p=="<")return m(T(">"),Ne(_r,">"),C,Rt)}function rn(u,p){if(p=="*")return g.marked="keyword",m(rn);if(u=="variable")return me(p),m(rn);if(u=="(")return m(q,T(")"),Ne(Ut,")"),C,Js,U);if(i&&p=="<")return m(T(">"),Ne(_r,">"),C,rn)}function Hs(u,p){if(u=="keyword"||u=="variable")return g.marked="type",m(Hs);if(p=="<")return m(T(">"),Ne(_r,">"),C)}function Ut(u,p){return p=="@"&&m(Z,Ut),u=="spread"?m(Ut):i&&x(p)?(g.marked="keyword",m(Ut)):i&&u=="this"?m(tn,Lt):w(ut,tn,Lt)}function bl(u,p){return u=="variable"?Vs(u,p):vr(u,p)}function Vs(u,p){if(u=="variable")return me(p),m(vr)}function vr(u,p){if(p=="<")return m(T(">"),Ne(_r,">"),C,vr);if(p=="extends"||p=="implements"||i&&u==",")return p=="implements"&&(g.marked="keyword"),m(i?de:Z,vr);if(u=="{")return m(T("}"),kt,C)}function kt(u,p){if(u=="async"||u=="variable"&&(p=="static"||p=="get"||p=="set"||i&&x(p))&&g.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return g.marked="keyword",m(kt);if(u=="variable"||g.style=="keyword")return g.marked="property",m(br,kt);if(u=="number"||u=="string")return m(br,kt);if(u=="[")return m(Z,tn,j("]"),br,kt);if(p=="*")return g.marked="keyword",m(kt);if(i&&u=="(")return w(rn,kt);if(u==";"||u==",")return m(kt);if(u=="}")return m();if(p=="@")return m(Z,kt)}function br(u,p){if(p=="!"||p=="?")return m(br);if(u==":")return m(de,Lt);if(p=="=")return m(fe);var v=g.state.lexical.prev,I=v&&v.info=="interface";return w(I?rn:Rt)}function wl(u,p){return p=="*"?(g.marked="keyword",m(es,j(";"))):p=="default"?(g.marked="keyword",m(Z,j(";"))):u=="{"?m(Ne(Ys,"}"),es,j(";")):w(ee)}function Ys(u,p){if(p=="as")return g.marked="keyword",m(j("variable"));if(u=="variable")return w(fe,Ys)}function xl(u){return u=="string"?m():u=="("?w(Z):u=="."?w(be):w(wr,Qs,es)}function wr(u,p){return u=="{"?Jn(wr,"}"):(u=="variable"&&me(p),p=="*"&&(g.marked="keyword"),m(kl))}function Qs(u){if(u==",")return m(wr,Qs)}function kl(u,p){if(p=="as")return g.marked="keyword",m(wr)}function es(u,p){if(p=="from")return g.marked="keyword",m(Z)}function El(u){return u=="]"?m():w(Ne(fe,"]"))}function Xs(){return w(T("form"),ut,j("{"),T("}"),Ne(Ml,"}"),C,C)}function Ml(){return w(ut,Lt)}function Al(u,p){return u.lastType=="operator"||u.lastType==","||a.test(p.charAt(0))||/[,.]/.test(p.charAt(0))}function Sl(u,p,v){return p.tokenize==_&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(p.lastType)||p.lastType=="quasi"&&/\{\s*$/.test(u.string.slice(0,u.pos-(v||0)))}return{name:n.name,startState:function(u){var p={tokenize:_,lastType:"sof",cc:[],lexical:new H(-u,0,"block",!1),localVars:n.localVars,context:n.localVars&&new b(null,null,!1),indented:0};return n.globalVars&&typeof n.globalVars=="object"&&(p.globalVars=n.globalVars),p},token:function(u,p){if(u.sol()&&(p.lexical.hasOwnProperty("align")||(p.lexical.align=!1),p.indented=u.indentation(),ne(u,p)),p.tokenize!=k&&u.eatSpace())return null;var v=p.tokenize(u,p);return d=="comment"?v:(p.lastType=d=="operator"&&(h=="++"||h=="--")?"incdec":d,ye(p,v,d,h,u))},indent:function(u,p,v){if(u.tokenize==k||u.tokenize==W)return null;if(u.tokenize!=_)return 0;var I=p&&p.charAt(0),O=u.lexical,ie;if(!/^\s*else\b/.test(p))for(var he=u.cc.length-1;he>=0;--he){var Ke=u.cc[he];if(Ke==C)O=O.prev;else if(Ke!=Us&&Ke!=U)break}for(;(O.type=="stat"||O.type=="form")&&(I=="}"||(ie=u.cc[u.cc.length-1])&&(ie==be||ie==re)&&!/^[,\.=+\-*:?[\(]/.test(p));)O=O.prev;e&&O.type==")"&&O.prev.type=="stat"&&(O=O.prev);var nt=O.type,Un=I==nt;return nt=="vardef"?O.indented+(u.lastType=="operator"||u.lastType==","?O.info.length+1:0):nt=="form"&&I=="{"?O.indented:nt=="form"?O.indented+v.unit:nt=="stat"?O.indented+(Al(u,p)?e||v.unit:0):O.info=="switch"&&!Un&&n.doubleIndentSwitch!=!1?O.indented+(/^(?:case|default)\b/.test(p)?v.unit:2*v.unit):O.align?O.column+(Un?0:1):O.indented+(Un?0:v.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:r?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var mr=Ho({name:"javascript"}),H_=Ho({name:"json",json:!0}),V_=Ho({name:"json",jsonld:!0}),Y_=Ho({name:"typescript",typescript:!0});var Yo=require("obsidian"),Vo=class extends Yo.FuzzySuggestModal{constructor(t,r){super(t.app);this.plugin=t,this.selectCallback=r}getItems(){return this.app.vault.getAllLoadedFiles().filter(r=>r instanceof Yo.TFile).filter(r=>r.extension==="js")}getItemText(t){return t.path}onChooseItem(t,r){this.selectCallback(t)}};var Qo=class extends ul.Plugin{constructor(t,r){super(t,r);this.messageManager=new Dr(this.app,this),this.jsEngine=new Go(this.app,this),this.api=new qn(this.app,this,jn.create("PLUGIN"))}async onload(){await this.loadSettings(),this.messageManager.initStatusBarItem(),this.registerMarkdownCodeBlockProcessor("js-engine",(t,r,i)=>{let o=new qr(r,this,t,i);i.addChild(o)}),this.addCommand({id:"execute-js-file",name:"Execute JS File",callback:()=>{new Vo(this,async t=>{await this.api.internal.executeFileSimple(t.path)}).open()}}),await this.registerCodeMirrorMode()}onunload(){}async loadSettings(){let t=await this.loadData();this.settings=Object.assign({},$s,t)}async saveSettings(){await this.saveData(this.settings)}async registerCodeMirrorMode(){window.CodeMirror.defineMode("js-engine",t=>({startState:()=>{var i,o;return(o=(i=mr).startState)==null?void 0:o.call(i,4)},blankLine:i=>{var o,s;return(s=(o=mr).blankLine)==null?void 0:s.call(o,i,4)},copyState:i=>{var o,s;return(s=(o=mr).startState)==null?void 0:s.call(o,4)},token:(i,o)=>{var a,l;return`line-HyperMD-codeblock ${(l=(a=mr).token)==null?void 0:l.call(a,i,o)}`}}))}};
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/manifest.json b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/manifest.json
new file mode 100644
index 00000000..1dc88bb5
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/manifest.json
@@ -0,0 +1,10 @@
+{
+	"id": "js-engine",
+	"name": "JS Engine",
+	"version": "0.1.6",
+	"minAppVersion": "1.4.0",
+	"description": "Run JavaScript from within your notes.",
+	"author": "Moritz Jung",
+	"authorUrl": "https://mprojectscode.github.io/",
+	"isDesktopOnly": false
+}
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/styles.css b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/styles.css
new file mode 100644
index 00000000..9b2f244e
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/js-engine/styles.css
@@ -0,0 +1,118 @@
+/*
+
+This CSS file will be included with your plugin, and
+available in the app when your plugin is enabled.
+
+If your plugin does not need CSS, delete this file.
+
+*/
+
+.js-engine-message-counter {
+	margin-left: var(--size-4-1);
+}
+
+.js-engine-message-indicator-mod-info {
+}
+
+.js-engine-message-indicator-mod-tip {
+	color: var(--color-cyan);
+}
+
+.js-engine-message-indicator-mod-success {
+	color: var(--color-green);
+}
+
+.js-engine-message-indicator-mod-warning {
+	color: var(--color-yellow);
+}
+
+.js-engine-message-indicator-mod-error {
+	color: var(--color-red);
+}
+
+.js-engine-message {
+}
+
+.js-engine-message-header {
+}
+
+.js-engine-message-title {
+	flex: 1;
+}
+
+.js-engine-message-icon {
+	flex: 0 0 auto;
+	display: flex;
+	align-items: center;
+}
+
+.js-engine-message-delete-icon svg.svg-icon {
+	color: var(--text-muted);
+}
+
+.js-engine-message-delete-icon:hover svg.svg-icon {
+	color: var(--text-normal);
+}
+
+.js-engine-message-detail {
+	margin-top: var(--size-4-8);
+}
+
+.js-engine-message-detail-row {
+	display: flex;
+	flex-direction: row;
+	align-items: center;
+	gap: var(--size-4-2);
+	color: var(--text-muted);
+}
+
+.js-engine-message-detail-row:hover {
+	color: var(--text-normal);
+}
+
+.js-engine-message-detail-content {
+	color: var(--text-muted);
+}
+
+.js-engine-message-content pre,
+.js-engine-execution-stats-modal pre {
+	padding: var(--size-4-2) var(--size-4-4);
+	border-radius: var(--radius-s);
+	white-space: pre;
+	overflow-x: auto;
+}
+
+.js-engine-execution-render-child {
+	position: relative;
+}
+
+.js-engine-execution-stats-button {
+	display: none;
+	position: absolute;
+	top: 0;
+	right: 0;
+	color: var(--text-muted);
+	margin: var(--size-4-2);
+	padding: var(--size-4-2);
+	border-radius: var(--radius-s);
+	width: calc(18px + var(--size-4-2) * 2);
+	height: calc(18px + var(--size-4-2) * 2);
+	z-index: 100;
+}
+
+.js-engine-execution-stats-button:hover {
+	background: var(--background-modifier-hover);
+}
+
+.js-engine-execution-render-child:hover .js-engine-execution-stats-button {
+	display: revert;
+}
+
+.js-engine-execution-stats-modal {
+}
+
+.modal:has(> .js-engine-execution-stats-modal) {
+	width: unset;
+	min-width: 80%;
+	max-width: 100%;
+}
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/snippets/js-engine-code-block-border.css b/resources/sample_vaults/Tasks-Demo/.obsidian/snippets/js-engine-code-block-border.css
new file mode 100644
index 00000000..ca080f4f
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/snippets/js-engine-code-block-border.css
@@ -0,0 +1,7 @@
+/* Make JS Engine code blocks stand out visually */
+:not(.callout-content) > .block-language-js-engine {
+    padding: 5px 15px;
+    border: 2px solid var(--color-red);
+    border-radius: 5px;
+    margin: 1em 0;
+}
diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/types.json b/resources/sample_vaults/Tasks-Demo/.obsidian/types.json
new file mode 100644
index 00000000..e0f702de
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/.obsidian/types.json
@@ -0,0 +1,10 @@
+{
+  "types": {
+    "aliases": "aliases",
+    "cssclasses": "multitext",
+    "tags": "tags",
+    "custom_number_prop": "number",
+    "custom_list": "multitext",
+    "custom_list_2": "multitext"
+  }
+}
\ No newline at end of file
diff --git a/resources/sample_vaults/Tasks-Demo/How To/Access properties in frontmatter.md b/resources/sample_vaults/Tasks-Demo/How To/Access properties in frontmatter.md
new file mode 100644
index 00000000..32dc5d73
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/How To/Access properties in frontmatter.md
@@ -0,0 +1,22 @@
+# Access properties in frontmatter
+
+> [!warning]
+> Tasks does not currently sanitise tags from frontmatter, such as adding a  `#` prefix.
+>
+## Accessing a custom property
+
+```tasks
+folder includes Test Data
+group by function \
+    const prop = task.file.frontmatter.custom_number_prop; \
+    return prop ? prop : 'not set'
+```
+
+## Accessing tags
+
+```tasks
+folder includes Test Data
+group by function \
+    const prop = task.file.frontmatter.tags; \
+    return prop ? prop : ''
+```
diff --git a/resources/sample_vaults/Tasks-Demo/How To/Find tasks in notes with particular tag.md b/resources/sample_vaults/Tasks-Demo/How To/Find tasks in notes with particular tag.md
index c780a487..c24b5319 100644
--- a/resources/sample_vaults/Tasks-Demo/How To/Find tasks in notes with particular tag.md
+++ b/resources/sample_vaults/Tasks-Demo/How To/Find tasks in notes with particular tag.md
@@ -2,6 +2,8 @@
 
 Suppose we wanted to find all tasks in notes that had a particular tag in the frontmatter.
 
+## Dataview approach
+
 This is not currently possible in Tasks directly, but we could get dataview to do the search for us and create a Tasks query.
 
 Note that the following finds all tasks where the tag is present anywhere in the file, not just in the frontmatter.
@@ -26,3 +28,17 @@ if ( matching_files.length > 0 ) {
 ```
 
 Credit: jonlemon in [this Obsidian Forum thread](https://forum.obsidian.md/t/how-can-i-list-tasks-from-all-notes-with-a-certain-tag-using-the-tasks-plugin/44634).
+
+## Tasks experimental approach
+
+> [!warning]
+> Tasks does not currently sanitise tags from frontmatter, such as adding a  `#` prefix.
+
+```tasks
+filter by function \
+    let tags = task.file.frontmatter.tags; \
+    return tags?.includes('examples') || false;
+
+# you can add any number of extra Tasks instructions, for example:
+group by path
+```
diff --git a/src/Obsidian/Cache.ts b/src/Obsidian/Cache.ts
index def12b17..56c09656 100644
--- a/src/Obsidian/Cache.ts
+++ b/src/Obsidian/Cache.ts
@@ -27,7 +27,7 @@ export function getTasksFromFileContent2(
     fileCache: CachedMetadata,
     errorReporter: (e: any, filePath: string, listItem: ListItemCache, line: string) => void,
 ) {
-    const tasksFile = new TasksFile(filePath);
+    const tasksFile = new TasksFile(filePath, fileCache);
     const tasks: Task[] = [];
     const fileLines = fileContent.split('\n');
     const linesInFile = fileLines.length;
@@ -278,7 +278,9 @@ export class Cache {
             this.logger.debug(`Cache.subscribeToVault.renamedEventReference() ${file.path}`);
 
             this.tasksMutex.runExclusive(() => {
-                const tasksFile = new TasksFile(file.path);
+                const fileCache = this.metadataCache.getFileCache(file);
+                // TODO What if the file has been renamed but the cache not yet updated?
+                const tasksFile = new TasksFile(file.path, fileCache ?? undefined);
                 const fallbackDate = new Lazy(() => DateFallback.fromPath(file.path));
 
                 this.tasks = this.tasks.map((task: Task): Task => {
diff --git a/src/Scripting/TasksFile.ts b/src/Scripting/TasksFile.ts
index 44e540b1..2391a98c 100644
--- a/src/Scripting/TasksFile.ts
+++ b/src/Scripting/TasksFile.ts
@@ -1,11 +1,15 @@
+import type { CachedMetadata, FrontMatterCache } from 'obsidian';
+
 /**
  * A simple class to provide access to file information via 'task.file' in scripting code.
  */
 export class TasksFile {
     private readonly _path: string;
+    private readonly _cachedMetadata: CachedMetadata;
 
-    constructor(path: string) {
+    constructor(path: string, cachedMetadata: CachedMetadata = {}) {
         this._path = path;
+        this._cachedMetadata = cachedMetadata;
     }
 
     /**
@@ -15,6 +19,31 @@ export class TasksFile {
         return this._path;
     }
 
+    /**
+     * Return Obsidian's [CachedMetadata](https://docs.obsidian.md/Reference/TypeScript+API/CachedMetadata)
+     * for this file, if available.
+     *
+     * @note This is currently only populated for Task objects when read in the Obsidian plugin.
+     *       It's not populated for queries in the plugin, nor in most unit tests.
+     *       If not available, it returns an empty object, {}.
+     */
+    public get cachedMetadata(): CachedMetadata {
+        return this._cachedMetadata;
+    }
+
+    /**
+     * Return Obsidian's [FrontMatterCache](https://docs.obsidian.md/Reference/TypeScript+API/FrontMatterCache)
+     * for this file, if available.
+     *
+     * @note This is currently only populated for Task objects when read in the Obsidian plugin.
+     *       It's not populated for queries in the plugin, nor in most unit tests.
+     *       And it is an empty object, {}, if the {@link cachedMetadata} has not been populated
+     *       or if the markdown file has no frontmatter or empty frontmatter.
+     */
+    public get frontmatter(): FrontMatterCache {
+        return this._cachedMetadata.frontmatter ?? ({} as any as FrontMatterCache);
+    }
+
     /**
      * Return the path to the file, with the filename extension removed.
      */


Test patch:
diff --git a/resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Frontmatter code.canvas b/resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Frontmatter code.canvas
new file mode 100644
index 00000000..d1343f13
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Frontmatter code.canvas
@@ -0,0 +1,22 @@
+{
+	"nodes":[
+		{"id":"296e9f517e9a80ab","x":-500,"y":-413,"width":720,"height":809,"type":"text","text":"Sample frontmatter in Markdown - from the file [[Tags in Frontmatter]]:\n\n```yaml\n---\nTAG:\n  - value1\n  - value2\nALIAS:\n  - test 1\n  - test 2\ncustom_list:\n  - value 1\n  - value 2\ncustom_list_2:\n  - x\ncustom_number_prop: 42\nunknown_property:\n  - hello\n  - world\nunknown_property_2:\n  - 1\n  - 2\nunknown_number_property: 13\nunknown_empty_property:\nunknown_list:\n  -\n  -\nparent:\n  - child1:\n    - grandchild1: 1\n    - grandchild2: 2\n  - child2:\n    - grandchild3: 3\n    - grandchild4: 4\n---\n\n```"},
+		{"id":"4984924a6c7c4a4d","x":320,"y":-260,"width":545,"height":209,"type":"text","text":"Get the content of the file:\n\n```js\nconst path = 'Manual Testing/Frontmatter/Tags in Frontmatter.md';\nlet tfile = app.vault.getAbstractFileByPath(path);\nlet cache = app.metadataCache.getFileCache(tfile);\nlet content = await app.vault.read(tfile);\n```"},
+		{"id":"dd8a7a7c21185654","x":1140,"y":-120,"width":625,"height":1251,"type":"text","text":"Contains this `frontmatter`:\n\n```json\n\"frontmatter\": {\n        \"TAG\": [\n            \"value1\",\n            \"value2\"\n        ],\n        \"ALIAS\": [\n            \"test 1\",\n            \"test 2\"\n        ],\n        \"custom_list\": [\n            \"value 1\",\n            \"value 2\"\n        ],\n        \"custom_list_2\": [\n            \"x\"\n        ],\n        \"custom_number_prop\": 42,\n        \"unknown_property\": [\n            \"hello\",\n            \"world\"\n        ],\n        \"unknown_property_2\": [\n            1,\n            2\n        ],\n        \"unknown_number_property\": 13,\n        \"unknown_empty_property\": null,\n        \"unknown_list\": [\n            null,\n            null\n        ],\n        \"parent\": [\n            {\n                \"child1\": [\n                    {\n                        \"grandchild1\": 1\n                    },\n                    {\n                        \"grandchild2\": 2\n                    }\n                ]\n            },\n            {\n                \"child2\": [\n                    {\n                        \"grandchild3\": 3\n                    },\n                    {\n                        \"grandchild4\": 4\n                    }\n                ]\n            }\n        ]\n    },\n```"},
+		{"id":"8c610797e1f87954","x":1043,"y":-507,"width":819,"height":188,"type":"text","text":"`CachedMetaData`\n\n> [!NOTE]- The whole `CachedMetaData`\n> ```json\n> {\n>     \"tags\": [\n>         {\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 35,\n>                     \"col\": 2,\n>                     \"offset\": 431\n>                 },\n>                 \"end\": {\n>                     \"line\": 35,\n>                     \"col\": 14,\n>                     \"offset\": 443\n>                 }\n>             },\n>             \"tag\": \"#tag-in-body\"\n>         },\n>         {\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 36,\n>                     \"col\": 2,\n>                     \"offset\": 446\n>                 },\n>                 \"end\": {\n>                     \"line\": 36,\n>                     \"col\": 14,\n>                     \"offset\": 458\n>                 }\n>             },\n>             \"tag\": \"#another-tag\"\n>         }\n>     ],\n>     \"headings\": [\n>         {\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 33,\n>                     \"col\": 0,\n>                     \"offset\": 406\n>                 },\n>                 \"end\": {\n>                     \"line\": 33,\n>                     \"col\": 21,\n>                     \"offset\": 427\n>                 }\n>             },\n>             \"heading\": \"Tags in Frontmatter\",\n>             \"level\": 1\n>         },\n>         {\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 38,\n>                     \"col\": 0,\n>                     \"offset\": 460\n>                 },\n>                 \"end\": {\n>                     \"line\": 38,\n>                     \"col\": 30,\n>                     \"offset\": 490\n>                 }\n>             },\n>             \"heading\": \"See the frontmatter in YAML\",\n>             \"level\": 2\n>         }\n>     ],\n>     \"sections\": [\n>         {\n>             \"type\": \"yaml\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 0,\n>                     \"col\": 0,\n>                     \"offset\": 0\n>                 },\n>                 \"end\": {\n>                     \"line\": 31,\n>                     \"col\": 3,\n>                     \"offset\": 404\n>                 }\n>             }\n>         },\n>         {\n>             \"type\": \"heading\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 33,\n>                     \"col\": 0,\n>                     \"offset\": 406\n>                 },\n>                 \"end\": {\n>                     \"line\": 33,\n>                     \"col\": 21,\n>                     \"offset\": 427\n>                 }\n>             }\n>         },\n>         {\n>             \"type\": \"list\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 35,\n>                     \"col\": 0,\n>                     \"offset\": 429\n>                 },\n>                 \"end\": {\n>                     \"line\": 36,\n>                     \"col\": 14,\n>                     \"offset\": 458\n>                 }\n>             }\n>         },\n>         {\n>             \"type\": \"heading\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 38,\n>                     \"col\": 0,\n>                     \"offset\": 460\n>                 },\n>                 \"end\": {\n>                     \"line\": 38,\n>                     \"col\": 30,\n>                     \"offset\": 490\n>                 }\n>             }\n>         },\n>         {\n>             \"type\": \"paragraph\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 40,\n>                     \"col\": 0,\n>                     \"offset\": 492\n>                 },\n>                 \"end\": {\n>                     \"line\": 40,\n>                     \"col\": 181,\n>                     \"offset\": 673\n>                 }\n>             }\n>         },\n>         {\n>             \"type\": \"paragraph\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 42,\n>                     \"col\": 0,\n>                     \"offset\": 675\n>                 },\n>                 \"end\": {\n>                     \"line\": 42,\n>                     \"col\": 99,\n>                     \"offset\": 774\n>                 }\n>             }\n>         },\n>         {\n>             \"type\": \"code\",\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 44,\n>                     \"col\": 0,\n>                     \"offset\": 776\n>                 },\n>                 \"end\": {\n>                     \"line\": 140,\n>                     \"col\": 3,\n>                     \"offset\": 4923\n>                 }\n>             }\n>         }\n>     ],\n>     \"listItems\": [\n>         {\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 35,\n>                     \"col\": 0,\n>                     \"offset\": 429\n>                 },\n>                 \"end\": {\n>                     \"line\": 35,\n>                     \"col\": 14,\n>                     \"offset\": 443\n>                 }\n>             },\n>             \"parent\": -35\n>         },\n>         {\n>             \"position\": {\n>                 \"start\": {\n>                     \"line\": 36,\n>                     \"col\": 0,\n>                     \"offset\": 444\n>                 },\n>                 \"end\": {\n>                     \"line\": 36,\n>                     \"col\": 14,\n>                     \"offset\": 458\n>                 }\n>             },\n>             \"parent\": -35\n>         }\n>     ],\n>     \"frontmatter\": {\n>         \"TAG\": [\n>             \"value1\",\n>             \"value2\"\n>         ],\n>         \"ALIAS\": [\n>             \"test 1\",\n>             \"test 2\"\n>         ],\n>         \"custom_list\": [\n>             \"value 1\",\n>             \"value 2\"\n>         ],\n>         \"custom_list_2\": [\n>             \"x\"\n>         ],\n>         \"custom_number_prop\": 42,\n>         \"unknown_property\": [\n>             \"hello\",\n>             \"world\"\n>         ],\n>         \"unknown_property_2\": [\n>             1,\n>             2\n>         ],\n>         \"unknown_number_property\": 13,\n>         \"unknown_empty_property\": null,\n>         \"unknown_list\": [\n>             null,\n>             null\n>         ],\n>         \"parent\": [\n>             {\n>                 \"child1\": [\n>                     {\n>                         \"grandchild1\": 1\n>                     },\n>                     {\n>                         \"grandchild2\": 2\n>                     }\n>                 ]\n>             },\n>             {\n>                 \"child2\": [\n>                     {\n>                         \"grandchild3\": 3\n>                     },\n>                     {\n>                         \"grandchild4\": 4\n>                     }\n>                 ]\n>             }\n>         ]\n>     },\n>     \"frontmatterPosition\": {\n>         \"start\": {\n>             \"line\": 0,\n>             \"col\": 0,\n>             \"offset\": 0\n>         },\n>         \"end\": {\n>             \"line\": 31,\n>             \"col\": 3,\n>             \"offset\": 404\n>         }\n>     },\n>     \"frontmatterLinks\": []\n> }\n> ```"},
+		{"id":"d2c5f3f4353a3321","x":227,"y":573,"width":816,"height":367,"type":"text","text":"`getFrontMatterInfo(content)`:\n\n```json\n{\n    \"exists\": true,\n    \"frontmatter\": \"TAG:\\n  - value1\\n  - value2\\nALIAS:\\n  - test 1\\n  - test 2\\ncustom_list:\\n  - value 1\\n  - value 2\\ncustom_list_2:\\n  - x\\ncustom_number_prop: 42\\nunknown_property:\\n  - hello\\n  - world\\nunknown_property_2:\\n  - 1\\n  - 2\\nunknown_number_property: 13\\nunknown_empty_property:\\nunknown_list:\\n  -\\n  -\\nparent:\\n  - child1:\\n    - grandchild1: 1\\n    - grandchild2: 2\\n  - child2:\\n    - grandchild3: 3\\n    - grandchild4: 4\\n\",\n    \"from\": 4,\n    \"to\": 401,\n    \"contentStart\": 405\n}!\n```"},
+		{"id":"3896f7c7488dba02","x":768,"y":162,"width":372,"height":234,"type":"text","text":"`getAllTags(cache)`:\n\n```json\n[\n    \"#value1\",\n    \"#value2\",\n    \"#tag-in-body\",\n    \"#another-tag\"\n]\n```"},
+		{"id":"5c5908dbc6b41052","x":467,"y":1160,"width":487,"height":1249,"type":"text","text":"`parseYaml(frontmatterInfo.frontmatter)`:\n\n```json\n{\n    \"TAG\": [\n        \"value1\",\n        \"value2\"\n    ],\n    \"ALIAS\": [\n        \"test 1\",\n        \"test 2\"\n    ],\n    \"custom_list\": [\n        \"value 1\",\n        \"value 2\"\n    ],\n    \"custom_list_2\": [\n        \"x\"\n    ],\n    \"custom_number_prop\": 42,\n    \"unknown_property\": [\n        \"hello\",\n        \"world\"\n    ],\n    \"unknown_property_2\": [\n        1,\n        2\n    ],\n    \"unknown_number_property\": 13,\n    \"unknown_empty_property\": null,\n    \"unknown_list\": [\n        null,\n        null\n    ],\n    \"parent\": [\n        {\n            \"child1\": [\n                {\n                    \"grandchild1\": 1\n                },\n                {\n                    \"grandchild2\": 2\n                }\n            ]\n        },\n        {\n            \"child2\": [\n                {\n                    \"grandchild3\": 3\n                },\n                {\n                    \"grandchild4\": 4\n                }\n            ]\n        }\n    ]\n}\n```"},
+		{"id":"0a49c22303e2e696","x":-80,"y":1240,"width":390,"height":229,"type":"text","text":"`parseFrontMatterTags(frontmatter)`:\n\n```json\n[\n    \"#value1\",\n    \"#value2\"\n]\n```"},
+		{"id":"a63cc39f61c855c4","x":-549,"y":1240,"width":409,"height":181,"type":"text","text":"`parseFrontMatterAliases(frontmatter)`:\n\n```json\n[\n    \"test 1\",\n    \"test 2\"\n]\n```"}
+	],
+	"edges":[
+		{"id":"3f44bd01071ac7ac","fromNode":"296e9f517e9a80ab","fromSide":"right","toNode":"4984924a6c7c4a4d","toSide":"left"},
+		{"id":"d5e918cc17aaf186","fromNode":"8c610797e1f87954","fromSide":"bottom","toNode":"dd8a7a7c21185654","toSide":"top"},
+		{"id":"d80a9914a11034d8","fromNode":"4984924a6c7c4a4d","fromSide":"bottom","toNode":"d2c5f3f4353a3321","toSide":"top"},
+		{"id":"79767f970dae0f8d","fromNode":"d2c5f3f4353a3321","fromSide":"bottom","toNode":"5c5908dbc6b41052","toSide":"top"},
+		{"id":"6cc704eb842c5120","fromNode":"4984924a6c7c4a4d","fromSide":"bottom","toNode":"3896f7c7488dba02","toSide":"top"},
+		{"id":"8cd31558b87f1a65","fromNode":"d2c5f3f4353a3321","fromSide":"bottom","toNode":"a63cc39f61c855c4","toSide":"top"},
+		{"id":"0c52776255080d84","fromNode":"d2c5f3f4353a3321","fromSide":"bottom","toNode":"0a49c22303e2e696","toSide":"top"}
+	]
+}
\ No newline at end of file
diff --git a/resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Tags in Frontmatter.md b/resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Tags in Frontmatter.md
new file mode 100644
index 00000000..2f537d6d
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Tags in Frontmatter.md
@@ -0,0 +1,125 @@
+---
+TAG:
+  - value1
+  - value2
+ALIAS:
+  - test 1
+  - test 2
+custom_list:
+  - value 1
+  - value 2
+custom_list_2:
+  - x
+custom_number_prop: 42
+unknown_property:
+  - hello
+  - world
+unknown_property_2:
+  - 1
+  - 2
+unknown_number_property: 13
+unknown_empty_property:
+unknown_list:
+  -
+  -
+parent:
+  - child1:
+    - grandchild1: 1
+    - grandchild2: 2
+  - child2:
+    - grandchild3: 3
+    - grandchild4: 4
+---
+
+# Tags in Frontmatter
+
+- #tag-in-body
+- #another-tag
+
+## See the frontmatter in YAML
+
+The code-block below is a [js-engine](https://www.moritzjung.dev/obsidian-js-engine-plugin-docs/) script that displays the Obsidian's frontmatter - in JSON - currently in this file.
+
+If you edit the frontmatter, click the `i` button at the top-right of the code-block, then `Rerun`.
+
+```js-engine
+let markdownBuilder = engine.markdown.createBuilder();
+
+const path = 'Manual Testing/Frontmatter/Tags in Frontmatter.md';
+
+let tfile = app.vault.getAbstractFileByPath(path);
+let cache = app.metadataCache.getFileCache(tfile);
+let content = await app.vault.read(tfile);
+
+// -------------------------------------------------------------------------
+markdownBuilder.createHeading(3, '`CachedMetadata`');
+jsonCodeBlock(cache)
+
+// -------------------------------------------------------------------------
+markdownBuilder.createHeading(3, 'get frontmatter text via `getFrontMatterInfo()`');
+markdownBuilder.createParagraph( 'needs v.1.5.7 - released publicly in 1.5.8 on February 22, 2024');
+
+// v.1.5.7 getFrontMatterInfo()
+let frontmatterInfo = obsidian.getFrontMatterInfo(content);
+markdownBuilder.createParagraph('`getFrontMatterInfo(content)`:');
+jsonCodeBlock(frontmatterInfo)
+
+// v0.11.11 parseYaml()
+let parseYamlSays = obsidian.parseYaml(frontmatterInfo.frontmatter)
+markdownBuilder.createParagraph('`parseYaml(frontmatterInfo.frontmatter)`:');
+jsonCodeBlock(parseYamlSays)
+
+// -------------------------------------------------------------------------
+markdownBuilder.createHeading(3, 'get frontmatter text via `metadataCache` and `parseYaml()`');
+markdownBuilder.createParagraph( 'should probably work with any version of Obsidian over the last couple of years???');
+
+// TODO check its type is 'yaml'
+let section = cache.sections[0];
+let manualMetadataContent = content.slice(section.position.start.offset, section.position.end.offset)
+markdownBuilder.createParagraph('metadata content via metadataCache:');
+jsonCodeBlock(manualMetadataContent);
+
+// Need to strip off first and last line
+// TODO Make this work with lines longer than '---'
+let manualMetadataContentStripped = manualMetadataContent.split('\n').filter((l) => l !== '---').join('\n')
+markdownBuilder.createParagraph('metadata content via metadataCache - stripped of leading ---:');
+jsonCodeBlock(manualMetadataContentStripped);
+
+let parseYamlSays2 = obsidian.parseYaml(manualMetadataContentStripped);
+markdownBuilder.createParagraph('`parseYaml(manualMetadataContentStripped)`:');
+jsonCodeBlock(parseYamlSays2)
+
+// -------------------------------------------------------------------------
+markdownBuilder.createHeading(3, 'get all tags');
+let allTags = obsidian.getAllTags(cache);
+markdownBuilder.createParagraph('`getAllTags(cache)`:');
+jsonCodeBlock(allTags)
+
+// -------------------------------------------------------------------------
+markdownBuilder.createHeading(3, 'get frontmatter manually');
+
+let frontmatter = cache.frontmatter;
+markdownBuilder.createParagraph('`cache.frontmatter`:');
+jsonCodeBlock(frontmatter);
+
+// Get the keys of the JSON object
+const keys = Object.keys(frontmatter);
+markdownBuilder.createParagraph('`Object.keys(frontmatter)`:');
+jsonCodeBlock(keys)
+
+// TODO Iterate over the keys and construct a tidied-up frontmatter object.
+
+// v0.9.16 parseFrontMatterAliases()
+markdownBuilder.createParagraph('`parseFrontMatterAliases(frontmatter)`:');
+jsonCodeBlock(obsidian.parseFrontMatterAliases(frontmatter));
+
+// v0.9.16 parseFrontMatterTags()
+markdownBuilder.createParagraph('`parseFrontMatterTags(frontmatter)`:');
+jsonCodeBlock(obsidian.parseFrontMatterTags(frontmatter));
+
+function jsonCodeBlock(value) {
+    markdownBuilder.createCodeBlock('json', JSON.stringify(value, null, 4));
+}
+
+return markdownBuilder;
+```
diff --git a/resources/sample_vaults/Tasks-Demo/Test Data/yaml_complex_example.md b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_complex_example.md
new file mode 100644
index 00000000..ef86d3d7
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_complex_example.md
@@ -0,0 +1,36 @@
+---
+TAG:
+  - value1
+  - value2
+ALIAS:
+  - test 1
+  - test 2
+custom_list:
+  - value 1
+  - value 2
+custom_list_2:
+  - x
+custom_number_prop: 42
+unknown_property:
+  - hello
+  - world
+unknown_property_2:
+  - 1
+  - 2
+unknown_number_property: 13
+unknown_empty_property:
+unknown_list:
+  -
+  -
+parent:
+  - child1:
+    - grandchild1: 1
+    - grandchild2: 2
+  - child2:
+    - grandchild3: 3
+    - grandchild4: 4
+---
+
+# yaml_complex_example
+
+- [ ] #task Task in 'yaml_complex_example'
diff --git a/resources/sample_vaults/Tasks-Demo/Test Data/yaml_complex_example_standardised.md b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_complex_example_standardised.md
new file mode 100644
index 00000000..3758a50e
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_complex_example_standardised.md
@@ -0,0 +1,34 @@
+---
+tags:
+  - value1
+  - value2
+aliases:
+  - test 1
+  - test 2
+custom_list:
+  - value 1
+  - value 2
+custom_list_2:
+  - x
+custom_number_prop: 42
+unknown_property:
+  - hello
+  - world
+unknown_property_2:
+  - 1
+  - 2
+unknown_number_property: 13
+unknown_empty_property: 
+unknown_list: 
+parent:
+  - child1:
+      - grandchild1: 1
+      - grandchild2: 2
+  - child2:
+      - grandchild3: 3
+      - grandchild4: 4
+---
+
+# yaml_complex_example_standardised
+
+- [ ] #task Task in 'yaml_complex_example_standardised'
diff --git a/resources/sample_vaults/Tasks-Demo/Test Data/yaml_custom_number_property.md b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_custom_number_property.md
new file mode 100644
index 00000000..1bcc020a
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_custom_number_property.md
@@ -0,0 +1,5 @@
+---
+custom_number_prop: 42
+---
+
+- [ ] #task Task in 'yaml_custom_number_property'
diff --git a/resources/sample_vaults/Tasks-Demo/Test Data/yaml_tags_with_two_values_on_one_line.md b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_tags_with_two_values_on_one_line.md
new file mode 100644
index 00000000..b31bc5b6
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_tags_with_two_values_on_one_line.md
@@ -0,0 +1,7 @@
+---
+tags: value-1-of-2-on-one-line, value-2-of-2-on-one-line
+---
+
+# yaml_tags_with_two_values_on_one_line
+
+- [ ] #task Task in 'yaml_tags_with_two_values_on_one_line'
diff --git a/resources/sample_vaults/Tasks-Demo/Test Data/yaml_tags_with_two_values_on_two_lines.md b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_tags_with_two_values_on_two_lines.md
new file mode 100644
index 00000000..1a8136c7
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Test Data/yaml_tags_with_two_values_on_two_lines.md
@@ -0,0 +1,9 @@
+---
+tags:
+  - value-1-of-2-on-two-lines
+  - value-2-of-2-on-two-lines
+---
+
+# yaml_tags_with_two_values_on_two_lines
+
+- [ ] #task Task in 'yaml_tags_with_two_values_on_two_lines'
diff --git a/tests/Obsidian/__test_data__/yaml_complex_example.ts b/tests/Obsidian/__test_data__/yaml_complex_example.ts
new file mode 100644
index 00000000..66cfba8a
--- /dev/null
+++ b/tests/Obsidian/__test_data__/yaml_complex_example.ts
@@ -0,0 +1,190 @@
+export const yaml_complex_example = {
+    filePath: 'Test Data/yaml_complex_example.md',
+    fileContents:
+        '---\n' +
+        'TAG:\n' +
+        '  - value1\n' +
+        '  - value2\n' +
+        'ALIAS:\n' +
+        '  - test 1\n' +
+        '  - test 2\n' +
+        'custom_list:\n' +
+        '  - value 1\n' +
+        '  - value 2\n' +
+        'custom_list_2:\n' +
+        '  - x\n' +
+        'custom_number_prop: 42\n' +
+        'unknown_property:\n' +
+        '  - hello\n' +
+        '  - world\n' +
+        'unknown_property_2:\n' +
+        '  - 1\n' +
+        '  - 2\n' +
+        'unknown_number_property: 13\n' +
+        'unknown_empty_property:\n' +
+        'unknown_list:\n' +
+        '  -\n' +
+        '  -\n' +
+        'parent:\n' +
+        '  - child1:\n' +
+        '    - grandchild1: 1\n' +
+        '    - grandchild2: 2\n' +
+        '  - child2:\n' +
+        '    - grandchild3: 3\n' +
+        '    - grandchild4: 4\n' +
+        '---\n' +
+        '\n' +
+        '# yaml_complex_example\n' +
+        '\n' +
+        "- [ ] #task Task in 'yaml_complex_example'\n",
+    cachedMetadata: {
+        tags: [
+            {
+                position: {
+                    start: {
+                        line: 35,
+                        col: 6,
+                        offset: 436,
+                    },
+                    end: {
+                        line: 35,
+                        col: 11,
+                        offset: 441,
+                    },
+                },
+                tag: '#task',
+            },
+        ],
+        headings: [
+            {
+                position: {
+                    start: {
+                        line: 33,
+                        col: 0,
+                        offset: 406,
+                    },
+                    end: {
+                        line: 33,
+                        col: 22,
+                        offset: 428,
+                    },
+                },
+                heading: 'yaml_complex_example',
+                level: 1,
+            },
+        ],
+        sections: [
+            {
+                type: 'yaml',
+                position: {
+                    start: {
+                        line: 0,
+                        col: 0,
+                        offset: 0,
+                    },
+                    end: {
+                        line: 31,
+                        col: 3,
+                        offset: 404,
+                    },
+                },
+            },
+            {
+                type: 'heading',
+                position: {
+                    start: {
+                        line: 33,
+                        col: 0,
+                        offset: 406,
+                    },
+                    end: {
+                        line: 33,
+                        col: 22,
+                        offset: 428,
+                    },
+                },
+            },
+            {
+                type: 'list',
+                position: {
+                    start: {
+                        line: 35,
+                        col: 0,
+                        offset: 430,
+                    },
+                    end: {
+                        line: 35,
+                        col: 42,
+                        offset: 472,
+                    },
+                },
+            },
+        ],
+        listItems: [
+            {
+                position: {
+                    start: {
+                        line: 35,
+                        col: 0,
+                        offset: 430,
+                    },
+                    end: {
+                        line: 35,
+                        col: 42,
+                        offset: 472,
+                    },
+                },
+                parent: -35,
+                task: ' ',
+            },
+        ],
+        frontmatter: {
+            TAG: ['value1', 'value2'],
+            ALIAS: ['test 1', 'test 2'],
+            custom_list: ['value 1', 'value 2'],
+            custom_list_2: ['x'],
+            custom_number_prop: 42,
+            unknown_property: ['hello', 'world'],
+            unknown_property_2: [1, 2],
+            unknown_number_property: 13,
+            unknown_empty_property: null,
+            unknown_list: [null, null],
+            parent: [
+                {
+                    child1: [
+                        {
+                            grandchild1: 1,
+                        },
+                        {
+                            grandchild2: 2,
+                        },
+                    ],
+                },
+                {
+                    child2: [
+                        {
+                            grandchild3: 3,
+                        },
+                        {
+                            grandchild4: 4,
+                        },
+                    ],
+                },
+            ],
+        },
+        frontmatterPosition: {
+            start: {
+                line: 0,
+                col: 0,
+                offset: 0,
+            },
+            end: {
+                line: 31,
+                col: 3,
+                offset: 404,
+            },
+        },
+        frontmatterLinks: [],
+    },
+    obsidianApiVersion: '1.6.5',
+};
diff --git a/tests/Obsidian/__test_data__/yaml_complex_example_standardised.ts b/tests/Obsidian/__test_data__/yaml_complex_example_standardised.ts
new file mode 100644
index 00000000..7d282818
--- /dev/null
+++ b/tests/Obsidian/__test_data__/yaml_complex_example_standardised.ts
@@ -0,0 +1,188 @@
+export const yaml_complex_example_standardised = {
+    filePath: 'Test Data/yaml_complex_example_standardised.md',
+    fileContents:
+        '---\n' +
+        'tags:\n' +
+        '  - value1\n' +
+        '  - value2\n' +
+        'aliases:\n' +
+        '  - test 1\n' +
+        '  - test 2\n' +
+        'custom_list:\n' +
+        '  - value 1\n' +
+        '  - value 2\n' +
+        'custom_list_2:\n' +
+        '  - x\n' +
+        'custom_number_prop: 42\n' +
+        'unknown_property:\n' +
+        '  - hello\n' +
+        '  - world\n' +
+        'unknown_property_2:\n' +
+        '  - 1\n' +
+        '  - 2\n' +
+        'unknown_number_property: 13\n' +
+        'unknown_empty_property: \n' +
+        'unknown_list: \n' +
+        'parent:\n' +
+        '  - child1:\n' +
+        '      - grandchild1: 1\n' +
+        '      - grandchild2: 2\n' +
+        '  - child2:\n' +
+        '      - grandchild3: 3\n' +
+        '      - grandchild4: 4\n' +
+        '---\n' +
+        '\n' +
+        '# yaml_complex_example_standardised\n' +
+        '\n' +
+        "- [ ] #task Task in 'yaml_complex_example_standardised'\n",
+    cachedMetadata: {
+        tags: [
+            {
+                position: {
+                    start: {
+                        line: 33,
+                        col: 6,
+                        offset: 454,
+                    },
+                    end: {
+                        line: 33,
+                        col: 11,
+                        offset: 459,
+                    },
+                },
+                tag: '#task',
+            },
+        ],
+        headings: [
+            {
+                position: {
+                    start: {
+                        line: 31,
+                        col: 0,
+                        offset: 411,
+                    },
+                    end: {
+                        line: 31,
+                        col: 35,
+                        offset: 446,
+                    },
+                },
+                heading: 'yaml_complex_example_standardised',
+                level: 1,
+            },
+        ],
+        sections: [
+            {
+                type: 'yaml',
+                position: {
+                    start: {
+                        line: 0,
+                        col: 0,
+                        offset: 0,
+                    },
+                    end: {
+                        line: 29,
+                        col: 3,
+                        offset: 409,
+                    },
+                },
+            },
+            {
+                type: 'heading',
+                position: {
+                    start: {
+                        line: 31,
+                        col: 0,
+                        offset: 411,
+                    },
+                    end: {
+                        line: 31,
+                        col: 35,
+                        offset: 446,
+                    },
+                },
+            },
+            {
+                type: 'list',
+                position: {
+                    start: {
+                        line: 33,
+                        col: 0,
+                        offset: 448,
+                    },
+                    end: {
+                        line: 33,
+                        col: 55,
+                        offset: 503,
+                    },
+                },
+            },
+        ],
+        listItems: [
+            {
+                position: {
+                    start: {
+                        line: 33,
+                        col: 0,
+                        offset: 448,
+                    },
+                    end: {
+                        line: 33,
+                        col: 55,
+                        offset: 503,
+                    },
+                },
+                parent: -33,
+                task: ' ',
+            },
+        ],
+        frontmatter: {
+            tags: ['value1', 'value2'],
+            aliases: ['test 1', 'test 2'],
+            custom_list: ['value 1', 'value 2'],
+            custom_list_2: ['x'],
+            custom_number_prop: 42,
+            unknown_property: ['hello', 'world'],
+            unknown_property_2: [1, 2],
+            unknown_number_property: 13,
+            unknown_empty_property: null,
+            unknown_list: null,
+            parent: [
+                {
+                    child1: [
+                        {
+                            grandchild1: 1,
+                        },
+                        {
+                            grandchild2: 2,
+                        },
+                    ],
+                },
+                {
+                    child2: [
+                        {
+                            grandchild3: 3,
+                        },
+                        {
+                            grandchild4: 4,
+                        },
+                    ],
+                },
+            ],
+        },
+        frontmatterPosition: {
+            start: {
+                line: 0,
+                col: 0,
+                offset: 0,
+            },
+            end: {
+                line: 29,
+                col: 3,
+                offset: 409,
+            },
+        },
+        frontmatterLinks: [],
+    },
+    obsidianApiVersion: '1.6.5',
+};
diff --git a/tests/Obsidian/__test_data__/yaml_custom_number_property.ts b/tests/Obsidian/__test_data__/yaml_custom_number_property.ts
new file mode 100644
index 00000000..4dc71307
--- /dev/null
+++ b/tests/Obsidian/__test_data__/yaml_custom_number_property.ts
@@ -0,0 +1,91 @@
+export const yaml_custom_number_property = {
+    filePath: 'Test Data/yaml_custom_number_property.md',
+    fileContents:
+        '---\n' + 'custom_number_prop: 42\n' + '---\n' + '\n' + "- [ ] #task Task in 'yaml_custom_number_property'\n",
+    cachedMetadata: {
+        tags: [
+            {
+                position: {
+                    start: {
+                        line: 4,
+                        col: 6,
+                        offset: 38,
+                    },
+                    end: {
+                        line: 4,
+                        col: 11,
+                        offset: 43,
+                    },
+                },
+                tag: '#task',
+            },
+        ],
+        sections: [
+            {
+                type: 'yaml',
+                position: {
+                    start: {
+                        line: 0,
+                        col: 0,
+                        offset: 0,
+                    },
+                    end: {
+                        line: 2,
+                        col: 3,
+                        offset: 30,
+                    },
+                },
+            },
+            {
+                type: 'list',
+                position: {
+                    start: {
+                        line: 4,
+                        col: 0,
+                        offset: 32,
+                    },
+                    end: {
+                        line: 4,
+                        col: 49,
+                        offset: 81,
+                    },
+                },
+            },
+        ],
+        listItems: [
+            {
+                position: {
+                    start: {
+                        line: 4,
+                        col: 0,
+                        offset: 32,
+                    },
+                    end: {
+                        line: 4,
+                        col: 49,
+                        offset: 81,
+                    },
+                },
+                parent: -4,
+                task: ' ',
+            },
+        ],
+        frontmatter: {
+            custom_number_prop: 42,
+        },
+        frontmatterPosition: {
+            start: {
+                line: 0,
+                col: 0,
+                offset: 0,
+            },
+            end: {
+                line: 2,
+                col: 3,
+                offset: 30,
+            },
+        },
+        frontmatterLinks: [],
+    },
+    obsidianApiVersion: '1.6.5',
+};
diff --git a/tests/Obsidian/__test_data__/yaml_tags_with_two_values_on_one_line.ts b/tests/Obsidian/__test_data__/yaml_tags_with_two_values_on_one_line.ts
new file mode 100644
index 00000000..06cbd0ed
--- /dev/null
+++ b/tests/Obsidian/__test_data__/yaml_tags_with_two_values_on_one_line.ts
@@ -0,0 +1,130 @@
+export const yaml_tags_with_two_values_on_one_line = {
+    filePath: 'Test Data/yaml_tags_with_two_values_on_one_line.md',
+    fileContents:
+        '---\n' +
+        'tags: value-1-of-2-on-one-line, value-2-of-2-on-one-line\n' +
+        '---\n' +
+        '\n' +
+        '# yaml_tags_with_two_values_on_one_line\n' +
+        '\n' +
+        "- [ ] #task Task in 'yaml_tags_with_two_values_on_one_line'\n",
+    cachedMetadata: {
+        tags: [
+            {
+                position: {
+                    start: {
+                        line: 6,
+                        col: 6,
+                        offset: 113,
+                    },
+                    end: {
+                        line: 6,
+                        col: 11,
+                        offset: 118,
+                    },
+                },
+                tag: '#task',
+            },
+        ],
+        headings: [
+            {
+                position: {
+                    start: {
+                        line: 4,
+                        col: 0,
+                        offset: 66,
+                    },
+                    end: {
+                        line: 4,
+                        col: 39,
+                        offset: 105,
+                    },
+                },
+                heading: 'yaml_tags_with_two_values_on_one_line',
+                level: 1,
+            },
+        ],
+        sections: [
+            {
+                type: 'yaml',
+                position: {
+                    start: {
+                        line: 0,
+                        col: 0,
+                        offset: 0,
+                    },
+                    end: {
+                        line: 2,
+                        col: 3,
+                        offset: 64,
+                    },
+                },
+            },
+            {
+                type: 'heading',
+                position: {
+                    start: {
+                        line: 4,
+                        col: 0,
+                        offset: 66,
+                    },
+                    end: {
+                        line: 4,
+                        col: 39,
+                        offset: 105,
+                    },
+                },
+            },
+            {
+                type: 'list',
+                position: {
+                    start: {
+                        line: 6,
+                        col: 0,
+                        offset: 107,
+                    },
+                    end: {
+                        line: 6,
+                        col: 59,
+                        offset: 166,
+                    },
+                },
+            },
+        ],
+        listItems: [
+            {
+                position: {
+                    start: {
+                        line: 6,
+                        col: 0,
+                        offset: 107,
+                    },
+                    end: {
+                        line: 6,
+                        col: 59,
+                        offset: 166,
+                    },
+                },
+                parent: -6,
+                task: ' ',
+            },
+        ],
+        frontmatter: {
+            tags: 'value-1-of-2-on-one-line, value-2-of-2-on-one-line',
+        },
+        frontmatterPosition: {
+            start: {
+                line: 0,
+                col: 0,
+                offset: 0,
+            },
+            end: {
+                line: 2,
+                col: 3,
+                offset: 64,
+            },
+        },
+        frontmatterLinks: [],
+    },
+    obsidianApiVersion: '1.6.5',
+};
diff --git a/tests/Obsidian/__test_data__/yaml_tags_with_two_values_on_two_lines.ts b/tests/Obsidian/__test_data__/yaml_tags_with_two_values_on_two_lines.ts
new file mode 100644
index 00000000..5fb326b5
--- /dev/null
+++ b/tests/Obsidian/__test_data__/yaml_tags_with_two_values_on_two_lines.ts
@@ -0,0 +1,132 @@
+export const yaml_tags_with_two_values_on_two_lines = {
+    filePath: 'Test Data/yaml_tags_with_two_values_on_two_lines.md',
+    fileContents:
+        '---\n' +
+        'tags:\n' +
+        '  - value-1-of-2-on-two-lines\n' +
+        '  - value-2-of-2-on-two-lines\n' +
+        '---\n' +
+        '\n' +
+        '# yaml_tags_with_two_values_on_two_lines\n' +
+        '\n' +
+        "- [ ] #task Task in 'yaml_tags_with_two_values_on_two_lines'\n",
+    cachedMetadata: {
+        tags: [
+            {
+                position: {
+                    start: {
+                        line: 8,
+                        col: 6,
+                        offset: 123,
+                    },
+                    end: {
+                        line: 8,
+                        col: 11,
+                        offset: 128,
+                    },
+                },
+                tag: '#task',
+            },
+        ],
+        headings: [
+            {
+                position: {
+                    start: {
+                        line: 6,
+                        col: 0,
+                        offset: 75,
+                    },
+                    end: {
+                        line: 6,
+                        col: 40,
+                        offset: 115,
+                    },
+                },
+                heading: 'yaml_tags_with_two_values_on_two_lines',
+                level: 1,
+            },
+        ],
+        sections: [
+            {
+                type: 'yaml',
+                position: {
+                    start: {
+                        line: 0,
+                        col: 0,
+                        offset: 0,
+                    },
+                    end: {
+                        line: 4,
+                        col: 3,
+                        offset: 73,
+                    },
+                },
+            },
+            {
+                type: 'heading',
+                position: {
+                    start: {
+                        line: 6,
+                        col: 0,
+                        offset: 75,
+                    },
+                    end: {
+                        line: 6,
+                        col: 40,
+                        offset: 115,
+                    },
+                },
+            },
+            {
+                type: 'list',
+                position: {
+                    start: {
+                        line: 8,
+                        col: 0,
+                        offset: 117,
+                    },
+                    end: {
+                        line: 8,
+                        col: 60,
+                        offset: 177,
+                    },
+                },
+            },
+        ],
+        listItems: [
+            {
+                position: {
+                    start: {
+                        line: 8,
+                        col: 0,
+                        offset: 117,
+                    },
+                    end: {
+                        line: 8,
+                        col: 60,
+                        offset: 177,
+                    },
+                },
+                parent: -8,
+                task: ' ',
+            },
+        ],
+        frontmatter: {
+            tags: ['value-1-of-2-on-two-lines', 'value-2-of-2-on-two-lines'],
+        },
+        frontmatterPosition: {
+            start: {
+                line: 0,
+                col: 0,
+                offset: 0,
+            },
+            end: {
+                line: 4,
+                col: 3,
+                offset: 73,
+            },
+        },
+        frontmatterLinks: [],
+    },
+    obsidianApiVersion: '1.6.5',
+};
diff --git a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_docs.approved.md b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_docs.approved.md
index 8ede88de..9e0f32ed 100644
--- a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_docs.approved.md
+++ b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_docs.approved.md
@@ -14,7 +14,7 @@ group by function task.due.fromNow.groupText
 ```
 
 - Group by the [time from now](https://momentjs.com/docs/#/displaying/fromnow/), for example `8 days ago`, `in 11 hours`.
-- It uses an empty string (so no heading) if there is no due date.
+- It users an empty string (so no heading) if there is no due date.
 - The values `task.due.fromNow.name` and `task.due.fromNow.sortOrder` are also available.
 
 ```javascript
diff --git a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_results.approved.txt b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_results.approved.txt
index f95ad081..ed6027f6 100644
--- a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_results.approved.txt
+++ b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.dates_task.due_results.approved.txt
@@ -17,7 +17,7 @@ The values `task.due.category.name` and `task.due.category.sortOrder` are also a
 
 group by function task.due.fromNow.groupText
 Group by the [time from now](https://momentjs.com/docs/#/displaying/fromnow/), for example `8 days ago`, `in 11 hours`.
-It uses an empty string (so no heading) if there is no due date.
+It users an empty string (so no heading) if there is no due date.
 The values `task.due.fromNow.name` and `task.due.fromNow.sortOrder` are also available.
 =>
 %%0%% Invalid date
diff --git a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts
index ac2ccb72..ea7b0457 100644
--- a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts
+++ b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts
@@ -118,7 +118,7 @@ describe('dates', () => {
                 [
                     'group by function task.due.fromNow.groupText',
                     'Group by the [time from now](https://momentjs.com/docs/#/displaying/fromnow/), for example `8 days ago`, `in 11 hours`.',
-                    'It uses an empty string (so no heading) if there is no due date.',
+                    'It users an empty string (so no heading) if there is no due date.',
                     'The values `task.due.fromNow.name` and `task.due.fromNow.sortOrder` are also available.',
                 ],
                 [
diff --git a/tests/Scripting/TasksFile.test.ts b/tests/Scripting/TasksFile.test.ts
index 4fb8cf8d..3bd3c541 100644
--- a/tests/Scripting/TasksFile.test.ts
+++ b/tests/Scripting/TasksFile.test.ts
@@ -1,4 +1,9 @@
+import type { CachedMetadata } from 'obsidian';
 import { TasksFile } from '../../src/Scripting/TasksFile';
+import { no_yaml } from '../Obsidian/__test_data__/no_yaml';
+import { empty_yaml } from '../Obsidian/__test_data__/empty_yaml';
+import { yaml_tags_has_multiple_values } from '../Obsidian/__test_data__/yaml_tags_has_multiple_values';
+import { yaml_custom_number_property } from '../Obsidian/__test_data__/yaml_custom_number_property';
 
 describe('TasksFile', () => {
     it('should provide access to path', () => {
@@ -46,3 +51,55 @@ describe('TasksFile', () => {
         expect(new TasksFile('1.md.only-replace.2,md').filenameWithoutExtension).toEqual('1.md.only-replace.2,md');
     });
 });
+
+describe('TasksFile - reading frontmatter', () => {
+    it('should read file if not given CachedMetadata', () => {
+        const tasksFile = new TasksFile('some path.md', {});
+
+        expect(tasksFile.cachedMetadata.frontmatter).toBeUndefined();
+        expect(tasksFile.frontmatter).toEqual({});
+    });
+
+    it('should read file with no yaml metadata', () => {
+        const data = no_yaml;
+        const cachedMetadata = data.cachedMetadata as any as CachedMetadata;
+        const tasksFile = new TasksFile(data.filePath, cachedMetadata);
+
+        expect(tasksFile.cachedMetadata.frontmatter).toBeUndefined();
+        expect(tasksFile.frontmatter).toEqual({});
+    });
+
+    it('should read file with empty yaml metadata', () => {
+        const data = empty_yaml;
+        const cachedMetadata = data.cachedMetadata as any as CachedMetadata;
+        const tasksFile = new TasksFile(data.filePath, cachedMetadata);
+
+        expect(tasksFile.cachedMetadata.frontmatter).toBeUndefined();
+        expect(tasksFile.frontmatter).toEqual({});
+    });
+
+    it('should read file with multiple tags in yaml metadata', () => {
+        const data = yaml_tags_has_multiple_values;
+        const cachedMetadata = data.cachedMetadata as any as CachedMetadata;
+        const tasksFile = new TasksFile(data.filePath, cachedMetadata);
+
+        expect(tasksFile.cachedMetadata.frontmatter?.tags).toEqual(['multiple1', 'multiple2']);
+        expect(tasksFile.frontmatter.tags).toEqual(['multiple1', 'multiple2']);
+    });
+
+    // See property types: https://help.obsidian.md/Editing+and+formatting/Properties#Property+types
+    // Obsidian supports the following property types:
+    //  Text
+    //  List
+    //  Number
+    //  Checkbox
+    //  Date
+    //  Date & time
+    it('should read file with custom number property', () => {
+        const data = yaml_custom_number_property;
+        const cachedMetadata = data.cachedMetadata as any as CachedMetadata;
+        const tasksFile = new TasksFile(data.filePath, cachedMetadata);
+
+        expect(tasksFile.frontmatter?.custom_number_prop).toEqual(42);
+    });
+});
diff --git a/tests/ui/EditableTask.test.ts b/tests/ui/EditableTask.test.ts
index dd67dfda..d6948405 100644
--- a/tests/ui/EditableTask.test.ts
+++ b/tests/ui/EditableTask.test.ts
@@ -194,6 +194,7 @@ describe('EditableTask tests', () => {
                 "_sectionIndex": 3,
                 "_sectionStart": 5,
                 "_tasksFile": TasksFile {
+                  "_cachedMetadata": {},
                   "_path": "some/folder/fileName.md",
                 },
               },