36 lines
134 KiB
JavaScript
36 lines
134 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var _i=Object.create;var xt=Object.defineProperty;var zi=Object.getOwnPropertyDescriptor;var Mi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var Vt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$n=(e,t)=>{for(var n in t)xt(e,n,{get:t[n],enumerable:!0})},qn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Mi(t))!Ni.call(e,i)&&i!==n&&xt(e,i,{get:()=>t[i],enumerable:!(r=zi(t,i))||r.enumerable});return e};var yt=(e,t,n)=>(n=e!=null?_i(vi(e)):{},qn(t||!e||!e.__esModule?xt(n,"default",{value:e,enumerable:!0}):n,e)),Ui=e=>qn(xt({},"__esModule",{value:!0}),e);var Yn=Vt((as,$t)=>{(function(){var e;typeof $t!="undefined"?e=$t.exports=r:e=function(){return this||(0,eval)("this")}(),e.format=r,e.vsprintf=n,typeof console!="undefined"&&typeof console.log=="function"&&(e.printf=t);function t(){console.log(r.apply(null,arguments))}function n(i,u){return r.apply(null,[i].concat(u))}function r(i){for(var u=1,o=[].slice.call(arguments),s=0,p=i.length,a="",l,h=!1,f,c,F=!1,g,C=function(){return o[u++]},y=function(){for(var b="";/\d/.test(i[s]);)b+=i[s++],l=i[s];return b.length>0?parseInt(b):null};s<p;++s)if(l=i[s],h)switch(h=!1,l=="."?(F=!1,l=i[++s]):l=="0"&&i[s+1]=="."?(F=!0,s+=2,l=i[s]):F=!0,g=y(),l){case"b":a+=parseInt(C(),10).toString(2);break;case"c":f=C(),typeof f=="string"||f instanceof String?a+=f:a+=String.fromCharCode(parseInt(f,10));break;case"d":a+=parseInt(C(),10);break;case"f":c=String(parseFloat(C()).toFixed(g||6)),a+=F?c:c.replace(/^0/,"");break;case"j":a+=JSON.stringify(C());break;case"o":a+="0"+parseInt(C(),10).toString(8);break;case"s":a+=C();break;case"x":a+="0x"+parseInt(C(),10).toString(16);break;case"X":a+="0x"+parseInt(C(),10).toString(16).toUpperCase();break;default:a+=l;break}else l==="%"?h=!0:a+=l;return a}})()});var yn=Vt((uh,$r)=>{$r.exports=function(t){return t!=null&&t.constructor!=null&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}});var Gr=Vt((oh,Xr)=>{"use strict";var Lt=Object.prototype.hasOwnProperty,Zr=Object.prototype.toString,qr=Object.defineProperty,Hr=Object.getOwnPropertyDescriptor,Yr=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Zr.call(t)==="[object Array]"},Qr=function(t){if(!t||Zr.call(t)!=="[object Object]")return!1;var n=Lt.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Lt.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i=="undefined"||Lt.call(t,i)},Wr=function(t,n){qr&&n.name==="__proto__"?qr(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Kr=function(t,n){if(n==="__proto__")if(Lt.call(t,n)){if(Hr)return Hr(t,n).value}else return;return t[n]};Xr.exports=function e(){var t,n,r,i,u,o,s=arguments[0],p=1,a=arguments.length,l=!1;for(typeof s=="boolean"&&(l=s,s=arguments[1]||{},p=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});p<a;++p)if(t=arguments[p],t!=null)for(n in t)r=Kr(s,n),i=Kr(t,n),s!==i&&(l&&i&&(Qr(i)||(u=Yr(i)))?(u?(u=!1,o=r&&Yr(r)?r:[]):o=r&&Qr(r)?r:{},Wr(s,{name:n,newValue:e(l,o,i)})):typeof i!="undefined"&&Wr(s,{name:n,newValue:i}));return s}});var Xo={};$n(Xo,{SUGGESTIONS:()=>Mt,default:()=>vt});module.exports=Ui(Xo);var ue=require("obsidian");var N=require("obsidian");var je={children(e){return e.children},annotatetextnode(e,t){return e.type==="text"?{offset:{end:e.position.end.offset,start:e.position.start.offset},text:t.substring(e.position.start.offset,e.position.end.offset)}:null},interpretmarkup(e=""){return e}};function ji(e,t,n=je){let r=[];function i(u){let o=n.annotatetextnode(u,t);o!==null&&r.push(o);let s=n.children(u);s!==null&&Array.isArray(s)&&s.forEach(i)}return i(e),r}function Vi(e,t,n=je){let r=[],i={offset:{end:0,start:0}};for(let o of t){let s=e.substring(i.offset.end,o.offset.start);r.push({interpretAs:n.interpretmarkup(s),markup:s,offset:{end:o.offset.start,start:i.offset.end}}),r.push(o),i=o}let u=e.substring(i.offset.end,e.length);return r.push({interpretAs:n.interpretmarkup(u),markup:u,offset:{end:e.length,start:i.offset.end}}),{annotation:r}}function Hn(e,t,n=je){let r=ji(t,e,n);return Vi(e,r,n)}var Jo=ye(/[A-Za-z]/),es=ye(/[\dA-Za-z]/),ts=ye(/[#-'*+\--9=?A-Z^-~]/);var ns=ye(/\d/),rs=ye(/[\dA-Fa-f]/),is=ye(/[!-/:-@[-`{-~]/);function nt(e){return e!==null&&e<-2}function rt(e){return e===-2||e===-1||e===32}var us=ye(/\p{P}|\p{S}/u),os=ye(/\s/);function ye(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}var Qn=yt(Yn(),1),it=Object.assign(Le(Error),{eval:Le(EvalError),range:Le(RangeError),reference:Le(ReferenceError),syntax:Le(SyntaxError),type:Le(TypeError),uri:Le(URIError)});function Le(e){return t.displayName=e.displayName||e.name,t;function t(n,...r){let i=n&&(0,Qn.default)(n,...r);return new e(i)}}var Et={}.hasOwnProperty,Wn={yaml:"-",toml:"+"};function Ve(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:["yaml"];for(;++n<r.length;)t[n]=qi(r[n]);return t}function qi(e){let t=e;if(typeof t=="string"){if(!Et.call(Wn,t))throw it("Missing matter definition for `%s`",t);t={type:t,marker:Wn[t]}}else if(typeof t!="object")throw it("Expected matter to be an object, not `%j`",t);if(!Et.call(t,"type"))throw it("Missing `type` in matter `%j`",t);if(!Et.call(t,"fence")&&!Et.call(t,"marker"))throw it("Missing `marker` or `fence` in matter `%j`",t);return t}function Ht(e){let t=Ve(e),n={},r=-1;for(;++r<t.length;){let i=t[r],u=qt(i,"open").charCodeAt(0),o=Hi(i),s=n[u];Array.isArray(s)?s.push(o):n[u]=[o]}return{flow:n}}function Hi(e){let t=e.anywhere,n=e.type,r=n+"Fence",i=r+"Sequence",u=n+"Value",o={tokenize:l,partial:!0},s,p=0;return{tokenize:a,concrete:!0};function a(h,f,c){let F=this;return g;function g(w){let L=F.now();return L.column===1&&(L.line===1||t)&&(s=qt(e,"open"),p=0,w===s.charCodeAt(p))?(h.enter(n),h.enter(r),h.enter(i),C(w)):c(w)}function C(w){return p===s.length?(h.exit(i),rt(w)?(h.enter("whitespace"),y(w)):b(w)):w===s.charCodeAt(p++)?(h.consume(w),C):c(w)}function y(w){return rt(w)?(h.consume(w),y):(h.exit("whitespace"),b(w))}function b(w){return nt(w)?(h.exit(r),h.enter("lineEnding"),h.consume(w),h.exit("lineEnding"),s=qt(e,"close"),p=0,h.attempt(o,x,A)):c(w)}function A(w){return w===null||nt(w)?R(w):(h.enter(u),T(w))}function T(w){return w===null||nt(w)?(h.exit(u),R(w)):(h.consume(w),T)}function R(w){return w===null?c(w):(h.enter("lineEnding"),h.consume(w),h.exit("lineEnding"),h.attempt(o,x,A))}function x(w){return h.exit(n),f(w)}}function l(h,f,c){let F=0;return g;function g(A){return A===s.charCodeAt(F)?(h.enter(r),h.enter(i),C(A)):c(A)}function C(A){return F===s.length?(h.exit(i),rt(A)?(h.enter("whitespace"),y(A)):b(A)):A===s.charCodeAt(F++)?(h.consume(A),C):c(A)}function y(A){return rt(A)?(h.consume(A),y):(h.exit("whitespace"),b(A))}function b(A){return A===null||nt(A)?(h.exit(r),f(A)):c(A)}}}function qt(e,t){return e.marker?Kn(e.marker,t).repeat(3):Kn(e.fence,t)}function Kn(e,t){return typeof e=="string"?e:e[t]}function Yt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Wt(e){let t=Ve(e),n={},r={},i=-1;for(;++i<t.length;){let u=t[i];n[u.type]=Yi(u),r[u.type]=Qi,r[u.type+"Value"]=Wi}return{enter:n,exit:r}}function Yi(e){return t;function t(n){this.enter({type:e.type,value:""},n),this.buffer()}}function Qi(e){let t=this.resume(),n=this.stack[this.stack.length-1];"value"in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function Wi(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function Kt(e){let t=[],n={},r=Ve(e),i=-1;for(;++i<r.length;){let u=r[i];n[u.type]=Ki(u);let o=Qt(u,"open");t.push({atBreak:!0,character:o.charAt(0),after:Yt(o.charAt(1))})}return{unsafe:t,handlers:n}}function Ki(e){let t=Qt(e,"open"),n=Qt(e,"close");return r;function r(i){return t+(i.value?`
|
|
`+i.value:"")+`
|
|
`+n}}function Qt(e,t){return e.marker?Zn(e.marker,t).repeat(3):Zn(e.fence,t)}function Zn(e,t){return typeof e=="string"?e:e[t]}var Zi="yaml";function Ft(e){let t=this,n=e||Zi,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ht(n)),u.push(Wt(n)),o.push(Kt(n))}var Xi={};function Zt(e,t){let n=t||Xi,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Gn(e,r,i)}function Gn(e,t,n){if(Gi(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Xn(e.children,t,n)}return Array.isArray(e)?Xn(e,t,n):""}function Xn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Gn(e[i],t,n);return r.join("")}function Gi(e){return!!(e&&typeof e=="object")}function Z(e,t,n,r){let i=e.length,u=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);u<r.length;)o=r.slice(u,u+1e4),o.unshift(t,0),e.splice(...o),u+=1e4,t+=1e4}function J(e,t){return e.length>0?(Z(e,e.length,0,t),e):t}var Jn={}.hasOwnProperty;function er(e){let t={},n=-1;for(;++n<e.length;)Ji(t,e[n]);return t}function Ji(e,t){let n;for(n in t){let i=(Jn.call(e,n)?e[n]:void 0)||(e[n]={}),u=t[n],o;if(u)for(o in u){Jn.call(i,o)||(i[o]=[]);let s=u[o];eu(i[o],Array.isArray(s)?s:s?[s]:[])}}}function eu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Z(e,0,0,r)}var tr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var Ms=Ee(/[A-Za-z]/),vs=Ee(/[\dA-Za-z]/),Ns=Ee(/[#-'*+\--9=?A-Z^-~]/);var Us=Ee(/\d/),js=Ee(/[\dA-Fa-f]/),Vs=Ee(/[!-/:-@[-`{-~]/);function Xt(e){return e===-2||e===-1||e===32}var $s=Ee(tr),qs=Ee(/\s/);function Ee(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function P(e,t,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,u=0;return o;function o(p){return Xt(p)?(e.enter(n),s(p)):t(p)}function s(p){return Xt(p)&&u++<i?(e.consume(p),s):(e.exit(n),t(p))}}var nr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var Zs=Fe(/[A-Za-z]/),Xs=Fe(/[\dA-Za-z]/),Gs=Fe(/[#-'*+\--9=?A-Z^-~]/);var Js=Fe(/\d/),ea=Fe(/[\dA-Fa-f]/),ta=Fe(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}var na=Fe(nr),ra=Fe(/\s/);function Fe(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}var rr={tokenize:tu};function tu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),P(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),u(s)}function u(s){let p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return $e(s)?(e.consume(s),e.exit("chunkText"),u):(e.consume(s),o)}}var ur={tokenize:nu},ir={tokenize:ru};function nu(e){let t=this,n=[],r=0,i,u,o;return s;function s(A){if(r<n.length){let T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,p,a)(A)}return a(A)}function p(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&b();let T=t.events.length,R=T,x;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){x=t.events[R][1].end;break}y(r);let w=T;for(;w<t.events.length;)t.events[w][1].end=Object.assign({},x),w++;return Z(t.events,R+1,0,t.events.slice(T)),t.events.length=w,a(A)}return s(A)}function a(A){if(r===n.length){if(!i)return f(A);if(i.currentConstruct&&i.currentConstruct.concrete)return F(A);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ir,l,h)(A)}function l(A){return i&&b(),y(r),f(A)}function h(A){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,F(A)}function f(A){return t.containerState={},e.attempt(ir,c,F)(A)}function c(A){return r++,n.push([t.currentConstruct,t.containerState]),f(A)}function F(A){if(A===null){i&&b(),y(0),e.consume(A);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:u,_tokenizer:i}),g(A)}function g(A){if(A===null){C(e.exit("chunkFlow"),!0),y(0),e.consume(A);return}return $e(A)?(e.consume(A),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(A),g)}function C(A,T){let R=t.sliceStream(A);if(T&&R.push(null),A.previous=u,u&&(u.next=A),u=A,i.defineSkip(A.start),i.write(R),t.parser.lazy[A.start.line]){let x=i.events.length;for(;x--;)if(i.events[x][1].start.offset<o&&(!i.events[x][1].end||i.events[x][1].end.offset>o))return;let w=t.events.length,L=w,B,q;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(B){q=t.events[L][1].end;break}B=!0}for(y(r),x=w;x<t.events.length;)t.events[x][1].end=Object.assign({},q),x++;Z(t.events,L+1,0,t.events.slice(w)),t.events.length=x}}function y(A){let T=n.length;for(;T-- >A;){let R=n[T];t.containerState=R[1],R[0].exit.call(t,e)}n.length=A}function b(){i.write([null]),u=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ru(e,t,n){return P(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var or=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var re=Ae(/[A-Za-z]/),ee=Ae(/[\dA-Za-z]/),sr=Ae(/[#-'*+\--9=?A-Z^-~]/);function ar(e){return e!==null&&(e<32||e===127)}var ut=Ae(/\d/),lr=Ae(/[\dA-Fa-f]/),cr=Ae(/[!-/:-@[-`{-~]/);function D(e){return e!==null&&e<-2}function W(e){return e!==null&&(e<0||e===32)}function M(e){return e===-2||e===-1||e===32}var pr=Ae(or),hr=Ae(/\s/);function Ae(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Gt(e){if(e===null||W(e)||hr(e))return 1;if(pr(e))return 2}function qe(e,t,n){let r=[],i=-1;for(;++i<e.length;){let u=e[i].resolveAll;u&&!r.includes(u)&&(t=u(t,n),r.push(u))}return t}var ot={name:"attention",tokenize:uu,resolveAll:iu};function iu(e,t){let n=-1,r,i,u,o,s,p,a,l;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let h=Object.assign({},e[r][1].end),f=Object.assign({},e[n][1].start);fr(h,-p),fr(f,p),o={type:p>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},s={type:p>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:f},u={type:p>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:p>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[r][1].end=Object.assign({},o.start),e[n][1].start=Object.assign({},s.end),a=[],e[r][1].end.offset-e[r][1].start.offset&&(a=J(a,[["enter",e[r][1],t],["exit",e[r][1],t]])),a=J(a,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",u,t]]),a=J(a,qe(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),a=J(a,[["exit",u,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(l=2,a=J(a,[["enter",e[n][1],t],["exit",e[n][1],t]])):l=0,Z(e,r-1,n-r+3,a),n=r+a.length-l-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function uu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Gt(r),u;return o;function o(p){return u=p,e.enter("attentionSequence"),s(p)}function s(p){if(p===u)return e.consume(p),s;let a=e.exit("attentionSequence"),l=Gt(p),h=!l||l===2&&i||n.includes(p),f=!i||i===2&&l||n.includes(r);return a._open=!!(u===42?h:h&&(i||!f)),a._close=!!(u===42?f:f&&(l||!h)),t(p)}}function fr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Jt={name:"autolink",tokenize:ou};function ou(e,t,n){let r=0;return i;function i(c){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(c),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(c){return re(c)?(e.consume(c),o):a(c)}function o(c){return c===43||c===45||c===46||ee(c)?(r=1,s(c)):a(c)}function s(c){return c===58?(e.consume(c),r=0,p):(c===43||c===45||c===46||ee(c))&&r++<32?(e.consume(c),s):(r=0,a(c))}function p(c){return c===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(c),e.exit("autolinkMarker"),e.exit("autolink"),t):c===null||c===32||c===60||ar(c)?n(c):(e.consume(c),p)}function a(c){return c===64?(e.consume(c),l):sr(c)?(e.consume(c),a):n(c)}function l(c){return ee(c)?h(c):n(c)}function h(c){return c===46?(e.consume(c),r=0,l):c===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(c),e.exit("autolinkMarker"),e.exit("autolink"),t):f(c)}function f(c){if((c===45||ee(c))&&r++<63){let F=c===45?f:h;return e.consume(c),F}return n(c)}}var Ce={tokenize:su,partial:!0};function su(e,t,n){return r;function r(u){return M(u)?P(e,i,"linePrefix")(u):i(u)}function i(u){return u===null||D(u)?t(u):n(u)}}var At={name:"blockQuote",tokenize:au,continuation:{tokenize:lu},exit:cu};function au(e,t,n){let r=this;return i;function i(o){if(o===62){let s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),u}return n(o)}function u(o){return M(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function lu(e,t,n){let r=this;return i;function i(o){return M(o)?P(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):u(o)}function u(o){return e.attempt(At,t,n)(o)}}function cu(e){e.exit("blockQuote")}var Ct={name:"characterEscape",tokenize:pu};function pu(e,t,n){return r;function r(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),i}function i(u){return cr(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(u)}}var mr=document.createElement("i");function He(e){let t="&"+e+";";mr.innerHTML=t;let n=mr.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}var wt={name:"characterReference",tokenize:hu};function hu(e,t,n){let r=this,i=0,u,o;return s;function s(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),p}function p(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),u=31,o=ee,l(h))}function a(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,o=lr,l):(e.enter("characterReferenceValue"),u=7,o=ut,l(h))}function l(h){if(h===59&&i){let f=e.exit("characterReferenceValue");return o===ee&&!He(r.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&i++<u?(e.consume(h),l):n(h)}}var dr={tokenize:mu,partial:!0},kt={name:"codeFenced",tokenize:fu,concrete:!0};function fu(e,t,n){let r=this,i={tokenize:R,partial:!0},u=0,o=0,s;return p;function p(x){return a(x)}function a(x){let w=r.events[r.events.length-1];return u=w&&w[1].type==="linePrefix"?w[2].sliceSerialize(w[1],!0).length:0,s=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(x)}function l(x){return x===s?(o++,e.consume(x),l):o<3?n(x):(e.exit("codeFencedFenceSequence"),M(x)?P(e,h,"whitespace")(x):h(x))}function h(x){return x===null||D(x)?(e.exit("codeFencedFence"),r.interrupt?t(x):e.check(dr,g,T)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===null||D(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(x)):M(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),P(e,c,"whitespace")(x)):x===96&&x===s?n(x):(e.consume(x),f)}function c(x){return x===null||D(x)?h(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),F(x))}function F(x){return x===null||D(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(x)):x===96&&x===s?n(x):(e.consume(x),F)}function g(x){return e.attempt(i,T,C)(x)}function C(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y}function y(x){return u>0&&M(x)?P(e,b,"linePrefix",u+1)(x):b(x)}function b(x){return x===null||D(x)?e.check(dr,g,T)(x):(e.enter("codeFlowValue"),A(x))}function A(x){return x===null||D(x)?(e.exit("codeFlowValue"),b(x)):(e.consume(x),A)}function T(x){return e.exit("codeFenced"),t(x)}function R(x,w,L){let B=0;return q;function q(I){return x.enter("lineEnding"),x.consume(I),x.exit("lineEnding"),V}function V(I){return x.enter("codeFencedFence"),M(I)?P(x,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):z(I)}function z(I){return I===s?(x.enter("codeFencedFenceSequence"),S(I)):L(I)}function S(I){return I===s?(B++,x.consume(I),S):B>=o?(x.exit("codeFencedFenceSequence"),M(I)?P(x,_,"whitespace")(I):_(I)):L(I)}function _(I){return I===null||D(I)?(x.exit("codeFencedFence"),w(I)):L(I)}}}function mu(e,t,n){let r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),u)}function u(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}var st={name:"codeIndented",tokenize:gu},du={tokenize:xu,partial:!0};function gu(e,t,n){let r=this;return i;function i(a){return e.enter("codeIndented"),P(e,u,"linePrefix",5)(a)}function u(a){let l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?o(a):n(a)}function o(a){return a===null?p(a):D(a)?e.attempt(du,o,p)(a):(e.enter("codeFlowValue"),s(a))}function s(a){return a===null||D(a)?(e.exit("codeFlowValue"),o(a)):(e.consume(a),s)}function p(a){return e.exit("codeIndented"),t(a)}}function xu(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):D(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):P(e,u,"linePrefix",5)(o)}function u(o){let s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):D(o)?i(o):n(o)}}var en={name:"codeText",tokenize:Fu,resolve:yu,previous:Eu};function yu(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Eu(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Fu(e,t,n){let r=this,i=0,u,o;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),p(f)}function p(f){return f===96?(e.consume(f),i++,p):(e.exit("codeTextSequence"),a(f))}function a(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),a):f===96?(o=e.enter("codeTextSequence"),u=0,h(f)):D(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(f))}function l(f){return f===null||f===32||f===96||D(f)?(e.exit("codeTextData"),a(f)):(e.consume(f),l)}function h(f){return f===96?(e.consume(f),u++,h):u===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",l(f))}}function bt(e){let t={},n=-1,r,i,u,o,s,p,a;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(p=r[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Au(e,n)),n=t[n],a=!0);else if(r[1]._container){for(u=n,i=void 0;u--&&(o=e[u],o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(e[i][1].type="lineEndingBlank"),o[1].type="lineEnding",i=u);i&&(r[1].end=Object.assign({},e[i][1].start),s=e.slice(i,n),s.unshift(r),Z(e,i,n-i+1,s))}}return!a}function Au(e,t){let n=e[t][1],r=e[t][2],i=t-1,u=[],o=n._tokenizer||r.parser[n.contentType](n.start),s=o.events,p=[],a={},l,h,f=-1,c=n,F=0,g=0,C=[g];for(;c;){for(;e[++i][1]!==c;);u.push(i),c._tokenizer||(l=r.sliceStream(c),c.next||l.push(null),h&&o.defineSkip(c.start),c._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(l),c._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=c,c=c.next}for(c=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(g=f+1,C.push(g),c._tokenizer=void 0,c.previous=void 0,c=c.next);for(o.events=[],c?(c._tokenizer=void 0,c.previous=void 0):C.pop(),f=C.length;f--;){let y=s.slice(C[f],C[f+1]),b=u.pop();p.unshift([b,b+y.length-1]),Z(e,b,2,y)}for(f=-1;++f<p.length;)a[F+p[f][0]]=F+p[f][1],F+=p[f][1]-p[f][0]-1;return a}var tn={tokenize:ku,resolve:wu},Cu={tokenize:bu,partial:!0};function wu(e){return bt(e),e}function ku(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?u(s):D(s)?e.check(Cu,o,u)(s):(e.consume(s),i)}function u(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function bu(e,t,n){let r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),P(e,u,"linePrefix")}function u(o){if(o===null||D(o))return n(o);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}var gr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var Ja=we(/[A-Za-z]/),el=we(/[\dA-Za-z]/),tl=we(/[#-'*+\--9=?A-Z^-~]/);function nn(e){return e!==null&&(e<32||e===127)}var nl=we(/\d/),rl=we(/[\dA-Fa-f]/),il=we(/[!-/:-@[-`{-~]/);function xr(e){return e!==null&&e<-2}function yr(e){return e!==null&&(e<0||e===32)}var ul=we(gr),ol=we(/\s/);function we(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function St(e,t,n,r,i,u,o,s,p){let a=p||Number.POSITIVE_INFINITY,l=0;return h;function h(y){return y===60?(e.enter(r),e.enter(i),e.enter(u),e.consume(y),e.exit(u),f):y===null||y===32||y===41||nn(y)?n(y):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),g(y))}function f(y){return y===62?(e.enter(u),e.consume(y),e.exit(u),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),c(y))}function c(y){return y===62?(e.exit("chunkString"),e.exit(s),f(y)):y===null||y===60||xr(y)?n(y):(e.consume(y),y===92?F:c)}function F(y){return y===60||y===62||y===92?(e.consume(y),c):c(y)}function g(y){return!l&&(y===null||y===41||yr(y))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(y)):l<a&&y===40?(e.consume(y),l++,g):y===41?(e.consume(y),l--,g):y===null||y===32||y===40||nn(y)?n(y):(e.consume(y),y===92?C:g)}function C(y){return y===40||y===41||y===92?(e.consume(y),g):g(y)}}var Er=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var hl=ke(/[A-Za-z]/),fl=ke(/[\dA-Za-z]/),ml=ke(/[#-'*+\--9=?A-Z^-~]/);var dl=ke(/\d/),gl=ke(/[\dA-Fa-f]/),xl=ke(/[!-/:-@[-`{-~]/);function rn(e){return e!==null&&e<-2}function Fr(e){return e===-2||e===-1||e===32}var yl=ke(Er),El=ke(/\s/);function ke(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Dt(e,t,n,r,i,u){let o=this,s=0,p;return a;function a(c){return e.enter(r),e.enter(i),e.consume(c),e.exit(i),e.enter(u),l}function l(c){return s>999||c===null||c===91||c===93&&!p||c===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(c):c===93?(e.exit(u),e.enter(i),e.consume(c),e.exit(i),e.exit(r),t):rn(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),h(c))}function h(c){return c===null||c===91||c===93||rn(c)||s++>999?(e.exit("chunkString"),l(c)):(e.consume(c),p||(p=!Fr(c)),c===92?f:h)}function f(c){return c===91||c===92||c===93?(e.consume(c),s++,h):h(c)}}var Ar=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var bl=be(/[A-Za-z]/),Sl=be(/[\dA-Za-z]/),Dl=be(/[#-'*+\--9=?A-Z^-~]/);var Tl=be(/\d/),Ol=be(/[\dA-Fa-f]/),Bl=be(/[!-/:-@[-`{-~]/);function un(e){return e!==null&&e<-2}var Pl=be(Ar),Ll=be(/\s/);function be(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Tt(e,t,n,r,i,u){let o;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,p):n(f)}function p(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(u),a(f))}function a(f){return f===o?(e.exit(u),p(o)):f===null?n(f):un(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),P(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(f))}function l(f){return f===o||f===null||un(f)?(e.exit("chunkString"),a(f)):(e.consume(f),f===92?h:l)}function h(f){return f===o||f===92?(e.consume(f),l):l(f)}}var Cr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var Nl=Se(/[A-Za-z]/),Ul=Se(/[\dA-Za-z]/),jl=Se(/[#-'*+\--9=?A-Z^-~]/);var Vl=Se(/\d/),$l=Se(/[\dA-Fa-f]/),ql=Se(/[!-/:-@[-`{-~]/);function wr(e){return e!==null&&e<-2}function kr(e){return e===-2||e===-1||e===32}var Hl=Se(Cr),Yl=Se(/\s/);function Se(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Ie(e,t){let n;return r;function r(i){return wr(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):kr(i)?P(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function de(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var on={name:"definition",tokenize:Du},Su={tokenize:Tu,partial:!0};function Du(e,t,n){let r=this,i;return u;function u(c){return e.enter("definition"),o(c)}function o(c){return Dt.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(c)}function s(c){return i=de(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),c===58?(e.enter("definitionMarker"),e.consume(c),e.exit("definitionMarker"),p):n(c)}function p(c){return W(c)?Ie(e,a)(c):a(c)}function a(c){return St(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(c)}function l(c){return e.attempt(Su,h,h)(c)}function h(c){return M(c)?P(e,f,"whitespace")(c):f(c)}function f(c){return c===null||D(c)?(e.exit("definition"),r.parser.defined.push(i),t(c)):n(c)}}function Tu(e,t,n){return r;function r(s){return W(s)?Ie(e,i)(s):n(s)}function i(s){return Tt(e,u,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function u(s){return M(s)?P(e,o,"whitespace")(s):o(s)}function o(s){return s===null||D(s)?t(s):n(s)}}var sn={name:"hardBreakEscape",tokenize:Ou};function Ou(e,t,n){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),i}function i(u){return D(u)?(e.exit("hardBreakEscape"),t(u)):n(u)}}var an={name:"headingAtx",tokenize:Pu,resolve:Bu};function Bu(e,t){let n=e.length-2,r=3,i,u;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},u={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Z(e,r,n-r+1,[["enter",i,t],["enter",u,t],["exit",u,t],["exit",i,t]])),e}function Pu(e,t,n){let r=0;return i;function i(l){return e.enter("atxHeading"),u(l)}function u(l){return e.enter("atxHeadingSequence"),o(l)}function o(l){return l===35&&r++<6?(e.consume(l),o):l===null||W(l)?(e.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(e.enter("atxHeadingSequence"),p(l)):l===null||D(l)?(e.exit("atxHeading"),t(l)):M(l)?P(e,s,"whitespace")(l):(e.enter("atxHeadingText"),a(l))}function p(l){return l===35?(e.consume(l),p):(e.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||W(l)?(e.exit("atxHeadingText"),s(l)):(e.consume(l),a)}}var br=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ln=["pre","script","style","textarea"];var cn={name:"htmlFlow",tokenize:_u,resolveTo:Ru,concrete:!0},Lu={tokenize:Mu,partial:!0},Iu={tokenize:zu,partial:!0};function Ru(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function _u(e,t,n){let r=this,i,u,o,s,p;return a;function a(d){return l(d)}function l(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),h}function h(d){return d===33?(e.consume(d),f):d===47?(e.consume(d),u=!0,g):d===63?(e.consume(d),i=3,r.interrupt?t:m):re(d)?(e.consume(d),o=String.fromCharCode(d),C):n(d)}function f(d){return d===45?(e.consume(d),i=2,c):d===91?(e.consume(d),i=5,s=0,F):re(d)?(e.consume(d),i=4,r.interrupt?t:m):n(d)}function c(d){return d===45?(e.consume(d),r.interrupt?t:m):n(d)}function F(d){let ne="CDATA[";return d===ne.charCodeAt(s++)?(e.consume(d),s===ne.length?r.interrupt?t:z:F):n(d)}function g(d){return re(d)?(e.consume(d),o=String.fromCharCode(d),C):n(d)}function C(d){if(d===null||d===47||d===62||W(d)){let ne=d===47,Ne=o.toLowerCase();return!ne&&!u&&ln.includes(Ne)?(i=1,r.interrupt?t(d):z(d)):br.includes(o.toLowerCase())?(i=6,ne?(e.consume(d),y):r.interrupt?t(d):z(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(d):u?b(d):A(d))}return d===45||ee(d)?(e.consume(d),o+=String.fromCharCode(d),C):n(d)}function y(d){return d===62?(e.consume(d),r.interrupt?t:z):n(d)}function b(d){return M(d)?(e.consume(d),b):q(d)}function A(d){return d===47?(e.consume(d),q):d===58||d===95||re(d)?(e.consume(d),T):M(d)?(e.consume(d),A):q(d)}function T(d){return d===45||d===46||d===58||d===95||ee(d)?(e.consume(d),T):R(d)}function R(d){return d===61?(e.consume(d),x):M(d)?(e.consume(d),R):A(d)}function x(d){return d===null||d===60||d===61||d===62||d===96?n(d):d===34||d===39?(e.consume(d),p=d,w):M(d)?(e.consume(d),x):L(d)}function w(d){return d===p?(e.consume(d),p=null,B):d===null||D(d)?n(d):(e.consume(d),w)}function L(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||W(d)?R(d):(e.consume(d),L)}function B(d){return d===47||d===62||M(d)?A(d):n(d)}function q(d){return d===62?(e.consume(d),V):n(d)}function V(d){return d===null||D(d)?z(d):M(d)?(e.consume(d),V):n(d)}function z(d){return d===45&&i===2?(e.consume(d),H):d===60&&i===1?(e.consume(d),Q):d===62&&i===4?(e.consume(d),oe):d===63&&i===3?(e.consume(d),m):d===93&&i===5?(e.consume(d),ce):D(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Lu,pe,S)(d)):d===null||D(d)?(e.exit("htmlFlowData"),S(d)):(e.consume(d),z)}function S(d){return e.check(Iu,_,pe)(d)}function _(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),I}function I(d){return d===null||D(d)?S(d):(e.enter("htmlFlowData"),z(d))}function H(d){return d===45?(e.consume(d),m):z(d)}function Q(d){return d===47?(e.consume(d),o="",se):z(d)}function se(d){if(d===62){let ne=o.toLowerCase();return ln.includes(ne)?(e.consume(d),oe):z(d)}return re(d)&&o.length<8?(e.consume(d),o+=String.fromCharCode(d),se):z(d)}function ce(d){return d===93?(e.consume(d),m):z(d)}function m(d){return d===62?(e.consume(d),oe):d===45&&i===2?(e.consume(d),m):z(d)}function oe(d){return d===null||D(d)?(e.exit("htmlFlowData"),pe(d)):(e.consume(d),oe)}function pe(d){return e.exit("htmlFlow"),t(d)}}function zu(e,t,n){let r=this;return i;function i(o){return D(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),u):n(o)}function u(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Mu(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ce,t,n)}}var pn={name:"htmlText",tokenize:vu};function vu(e,t,n){let r=this,i,u,o;return s;function s(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),p}function p(m){return m===33?(e.consume(m),a):m===47?(e.consume(m),R):m===63?(e.consume(m),A):re(m)?(e.consume(m),L):n(m)}function a(m){return m===45?(e.consume(m),l):m===91?(e.consume(m),u=0,F):re(m)?(e.consume(m),b):n(m)}function l(m){return m===45?(e.consume(m),c):n(m)}function h(m){return m===null?n(m):m===45?(e.consume(m),f):D(m)?(o=h,Q(m)):(e.consume(m),h)}function f(m){return m===45?(e.consume(m),c):h(m)}function c(m){return m===62?H(m):m===45?f(m):h(m)}function F(m){let oe="CDATA[";return m===oe.charCodeAt(u++)?(e.consume(m),u===oe.length?g:F):n(m)}function g(m){return m===null?n(m):m===93?(e.consume(m),C):D(m)?(o=g,Q(m)):(e.consume(m),g)}function C(m){return m===93?(e.consume(m),y):g(m)}function y(m){return m===62?H(m):m===93?(e.consume(m),y):g(m)}function b(m){return m===null||m===62?H(m):D(m)?(o=b,Q(m)):(e.consume(m),b)}function A(m){return m===null?n(m):m===63?(e.consume(m),T):D(m)?(o=A,Q(m)):(e.consume(m),A)}function T(m){return m===62?H(m):A(m)}function R(m){return re(m)?(e.consume(m),x):n(m)}function x(m){return m===45||ee(m)?(e.consume(m),x):w(m)}function w(m){return D(m)?(o=w,Q(m)):M(m)?(e.consume(m),w):H(m)}function L(m){return m===45||ee(m)?(e.consume(m),L):m===47||m===62||W(m)?B(m):n(m)}function B(m){return m===47?(e.consume(m),H):m===58||m===95||re(m)?(e.consume(m),q):D(m)?(o=B,Q(m)):M(m)?(e.consume(m),B):H(m)}function q(m){return m===45||m===46||m===58||m===95||ee(m)?(e.consume(m),q):V(m)}function V(m){return m===61?(e.consume(m),z):D(m)?(o=V,Q(m)):M(m)?(e.consume(m),V):B(m)}function z(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,S):D(m)?(o=z,Q(m)):M(m)?(e.consume(m),z):(e.consume(m),_)}function S(m){return m===i?(e.consume(m),i=void 0,I):m===null?n(m):D(m)?(o=S,Q(m)):(e.consume(m),S)}function _(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||W(m)?B(m):(e.consume(m),_)}function I(m){return m===47||m===62||W(m)?B(m):n(m)}function H(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function Q(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),se}function se(m){return M(m)?P(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):ce(m)}function ce(m){return e.enter("htmlTextData"),o(m)}}var Re={name:"labelEnd",tokenize:qu,resolveTo:$u,resolveAll:Vu},Nu={tokenize:Hu},Uu={tokenize:Yu},ju={tokenize:Qu};function Vu(e){let t=-1;for(;++t<e.length;){let n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function $u(e,t){let n=e.length,r=0,i,u,o,s;for(;n--;)if(i=e[n][1],u){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(u=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);let p={type:e[u][1].type==="labelLink"?"link":"image",start:Object.assign({},e[u][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"label",start:Object.assign({},e[u][1].start),end:Object.assign({},e[o][1].end)},l={type:"labelText",start:Object.assign({},e[u+r+2][1].end),end:Object.assign({},e[o-2][1].start)};return s=[["enter",p,t],["enter",a,t]],s=J(s,e.slice(u+1,u+r+3)),s=J(s,[["enter",l,t]]),s=J(s,qe(t.parser.constructs.insideSpan.null,e.slice(u+r+4,o-3),t)),s=J(s,[["exit",l,t],e[o-2],e[o-1],["exit",a,t]]),s=J(s,e.slice(o+1)),s=J(s,[["exit",p,t]]),Z(e,u,e.length,s),e}function qu(e,t,n){let r=this,i=r.events.length,u,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){u=r.events[i][1];break}return s;function s(f){return u?u._inactive?h(f):(o=r.parser.defined.includes(de(r.sliceSerialize({start:u.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),p):n(f)}function p(f){return f===40?e.attempt(Nu,l,o?l:h)(f):f===91?e.attempt(Uu,l,o?a:h)(f):o?l(f):h(f)}function a(f){return e.attempt(ju,l,h)(f)}function l(f){return t(f)}function h(f){return u._balanced=!0,n(f)}}function Hu(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return W(h)?Ie(e,u)(h):u(h)}function u(h){return h===41?l(h):St(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return W(h)?Ie(e,p)(h):l(h)}function s(h){return n(h)}function p(h){return h===34||h===39||h===40?Tt(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):l(h)}function a(h){return W(h)?Ie(e,l)(h):l(h)}function l(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Yu(e,t,n){let r=this;return i;function i(s){return Dt.call(r,e,u,o,"reference","referenceMarker","referenceString")(s)}function u(s){return r.parser.defined.includes(de(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Qu(e,t,n){return r;function r(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),i}function i(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):n(u)}}var hn={name:"labelStartImage",tokenize:Wu,resolveAll:Re.resolveAll};function Wu(e,t,n){let r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),u}function u(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}var fn={name:"labelStartLink",tokenize:Ku,resolveAll:Re.resolveAll};function Ku(e,t,n){let r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),u}function u(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}var at={name:"lineEnding",tokenize:Zu};function Zu(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),P(e,t,"linePrefix")}}var _e={name:"thematicBreak",tokenize:Xu};function Xu(e,t,n){let r=0,i;return u;function u(a){return e.enter("thematicBreak"),o(a)}function o(a){return i=a,s(a)}function s(a){return a===i?(e.enter("thematicBreakSequence"),p(a)):r>=3&&(a===null||D(a))?(e.exit("thematicBreak"),t(a)):n(a)}function p(a){return a===i?(e.consume(a),r++,p):(e.exit("thematicBreakSequence"),M(a)?P(e,s,"whitespace")(a):s(a))}}var X={name:"list",tokenize:eo,continuation:{tokenize:to},exit:ro},Gu={tokenize:io,partial:!0},Ju={tokenize:no,partial:!0};function eo(e,t,n){let r=this,i=r.events[r.events.length-1],u=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(c){let F=r.containerState.type||(c===42||c===43||c===45?"listUnordered":"listOrdered");if(F==="listUnordered"?!r.containerState.marker||c===r.containerState.marker:ut(c)){if(r.containerState.type||(r.containerState.type=F,e.enter(F,{_container:!0})),F==="listUnordered")return e.enter("listItemPrefix"),c===42||c===45?e.check(_e,n,a)(c):a(c);if(!r.interrupt||c===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(c)}return n(c)}function p(c){return ut(c)&&++o<10?(e.consume(c),p):(!r.interrupt||o<2)&&(r.containerState.marker?c===r.containerState.marker:c===41||c===46)?(e.exit("listItemValue"),a(c)):n(c)}function a(c){return e.enter("listItemMarker"),e.consume(c),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||c,e.check(Ce,r.interrupt?n:l,e.attempt(Gu,f,h))}function l(c){return r.containerState.initialBlankLine=!0,u++,f(c)}function h(c){return M(c)?(e.enter("listItemPrefixWhitespace"),e.consume(c),e.exit("listItemPrefixWhitespace"),f):n(c)}function f(c){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(c)}}function to(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ce,i,u);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,P(e,t,"listItemIndent",r.containerState.size+1)(s)}function u(s){return r.containerState.furtherBlankLines||!M(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ju,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,P(e,e.attempt(X,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function no(e,t,n){let r=this;return P(e,i,"listItemIndent",r.containerState.size+1);function i(u){let o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(u):n(u)}}function ro(e){e.exit(this.containerState.type)}function io(e,t,n){let r=this;return P(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(u){let o=r.events[r.events.length-1];return!M(u)&&o&&o[1].type==="listItemPrefixWhitespace"?t(u):n(u)}}var Ot={name:"setextUnderline",tokenize:oo,resolveTo:uo};function uo(e,t){let n=e.length,r,i,u;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!u&&e[n][1].type==="definition"&&(u=n);let o={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",u?(e.splice(i,0,["enter",o,t]),e.splice(u+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[u][1].end)):e[r][1]=o,e.push(["exit",o,t]),e}function oo(e,t,n){let r=this,i;return u;function u(a){let l=r.events.length,h;for(;l--;)if(r.events[l][1].type!=="lineEnding"&&r.events[l][1].type!=="linePrefix"&&r.events[l][1].type!=="content"){h=r.events[l][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=a,o(a)):n(a)}function o(a){return e.enter("setextHeadingLineSequence"),s(a)}function s(a){return a===i?(e.consume(a),s):(e.exit("setextHeadingLineSequence"),M(a)?P(e,p,"lineSuffix")(a):p(a))}function p(a){return a===null||D(a)?(e.exit("setextHeadingLine"),t(a)):n(a)}}var Sr={tokenize:so};function so(e){let t=this,n=e.attempt(Ce,r,e.attempt(this.parser.constructs.flowInitial,i,P(e,e.attempt(this.parser.constructs.flow,i,e.attempt(tn,i)),"linePrefix")));return n;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var Dr={resolveAll:Pr()},Tr=Br("string"),Or=Br("text");function Br(e){return{tokenize:t,resolveAll:Pr(e==="text"?ao:void 0)};function t(n){let r=this,i=this.parser.constructs[e],u=n.attempt(i,o,s);return o;function o(l){return a(l)?u(l):s(l)}function s(l){if(l===null){n.consume(l);return}return n.enter("data"),n.consume(l),p}function p(l){return a(l)?(n.exit("data"),u(l)):(n.consume(l),p)}function a(l){if(l===null)return!0;let h=i[l],f=-1;if(h)for(;++f<h.length;){let c=h[f];if(!c.previous||c.previous.call(r,r.previous))return!0}return!1}}}function Pr(e){return t;function t(n,r){let i=-1,u;for(;++i<=n.length;)u===void 0?n[i]&&n[i][1].type==="data"&&(u=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==u+2&&(n[u][1].end=n[i-1][1].end,n.splice(u+2,i-u-2),i=u+2),u=void 0);return e?e(n,r):n}}function ao(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){let r=e[n-1][1],i=t.sliceStream(r),u=i.length,o=-1,s=0,p;for(;u--;){let a=i[u];if(typeof a=="string"){for(o=a.length;a.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(a===-2)p=!0,s++;else if(a!==-1){u++;break}}if(s){let a={type:n===e.length||p||s<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-s,offset:r.end.offset-s,_index:r.start._index+u,_bufferIndex:u?o:r.start._bufferIndex+o},end:Object.assign({},r.end)};r.end=Object.assign({},a.start),r.start.offset===r.end.offset?Object.assign(r,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}function Lr(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},u=[],o=[],s=[],p=!0,a={consume:T,enter:R,exit:x,attempt:B(w),check:B(L),interrupt:B(L,{interrupt:!0})},l={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:g,sliceSerialize:F,now:C,defineSkip:y,write:c},h=t.tokenize.call(l,a),f;return t.resolveAll&&u.push(t),l;function c(S){return o=J(o,S),b(),o[o.length-1]!==null?[]:(q(t,0),l.events=qe(u,l.events,l),l.events)}function F(S,_){return co(g(S),_)}function g(S){return lo(o,S)}function C(){let{line:S,column:_,offset:I,_index:H,_bufferIndex:Q}=r;return{line:S,column:_,offset:I,_index:H,_bufferIndex:Q}}function y(S){i[S.line]=S.column,z()}function b(){let S;for(;r._index<o.length;){let _=o[r._index];if(typeof _=="string")for(S=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===S&&r._bufferIndex<_.length;)A(_.charCodeAt(r._bufferIndex));else A(_)}}function A(S){p=void 0,f=S,h=h(S)}function T(S){$e(S)?(r.line++,r.column=1,r.offset+=S===-3?2:1,z()):S!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=S,p=!0}function R(S,_){let I=_||{};return I.type=S,I.start=C(),l.events.push(["enter",I,l]),s.push(I),I}function x(S){let _=s.pop();return _.end=C(),l.events.push(["exit",_,l]),_}function w(S,_){q(S,_.from)}function L(S,_){_.restore()}function B(S,_){return I;function I(H,Q,se){let ce,m,oe,pe;return Array.isArray(H)?ne(H):"tokenize"in H?ne([H]):d(H);function d(K){return Je;function Je(he){let Ue=he!==null&&K[he],Pe=he!==null&&K.null,Ut=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return ne(Ut)(he)}}function ne(K){return ce=K,m=0,K.length===0?se:Ne(K[m])}function Ne(K){return Je;function Je(he){return pe=V(),oe=K,K.partial||(l.currentConstruct=K),K.name&&l.parser.constructs.disable.null.includes(K.name)?Ge(he):K.tokenize.call(_?Object.assign(Object.create(l),_):l,a,Nt,Ge)(he)}}function Nt(K){return p=!0,S(oe,pe),Q}function Ge(K){return p=!0,pe.restore(),++m<ce.length?Ne(ce[m]):se}}}function q(S,_){S.resolveAll&&!u.includes(S)&&u.push(S),S.resolve&&Z(l.events,_,l.events.length-_,S.resolve(l.events.slice(_),l)),S.resolveTo&&(l.events=S.resolveTo(l.events,l))}function V(){let S=C(),_=l.previous,I=l.currentConstruct,H=l.events.length,Q=Array.from(s);return{restore:se,from:H};function se(){r=S,l.previous=_,l.currentConstruct=I,l.events.length=H,s=Q,z()}}function z(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function lo(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,u=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,u)];else{if(o=e.slice(n,i),r>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}u>0&&o.push(e[i].slice(0,u))}return o}function co(e,t){let n=-1,r=[],i;for(;++n<e.length;){let u=e[n],o;if(typeof u=="string")o=u;else switch(u){case-5:{o="\r";break}case-4:{o=`
|
|
`;break}case-3:{o=`\r
|
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(u)}i=u===-2,r.push(o)}return r.join("")}var mn={};$n(mn,{attentionMarkers:()=>Eo,contentInitial:()=>ho,disable:()=>Fo,document:()=>po,flow:()=>mo,flowInitial:()=>fo,insideSpan:()=>yo,string:()=>go,text:()=>xo});var po={42:X,43:X,45:X,48:X,49:X,50:X,51:X,52:X,53:X,54:X,55:X,56:X,57:X,62:At},ho={91:on},fo={[-2]:st,[-1]:st,32:st},mo={35:an,42:_e,45:[Ot,_e],60:cn,61:Ot,95:_e,96:kt,126:kt},go={38:wt,92:Ct},xo={[-5]:at,[-4]:at,[-3]:at,33:hn,38:wt,42:ot,60:[Jt,pn],91:fn,92:[sn,Ct],93:Re,95:ot,96:en},yo={null:[ot,Dr]},Eo={null:[42,95]},Fo={null:[]};function Ir(e){let n=er([mn,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(rr),document:i(ur),flow:i(Sr),string:i(Tr),text:i(Or)};return r;function i(u){return o;function o(s){return Lr(r,u,s)}}}var Rr=/[\0\t\n\r]/g;function _r(){let e=1,t="",n=!0,r;return i;function i(u,o,s){let p=[],a,l,h,f,c;for(u=t+u.toString(o),h=0,t="",n&&(u.charCodeAt(0)===65279&&h++,n=void 0);h<u.length;){if(Rr.lastIndex=h,a=Rr.exec(u),f=a&&a.index!==void 0?a.index:u.length,c=u.charCodeAt(f),!a){t=u.slice(h);break}if(c===10&&h===f&&r)p.push(-3),r=void 0;else switch(r&&(p.push(-5),r=void 0),h<f&&(p.push(u.slice(h,f)),e+=f-h),c){case 0:{p.push(65533),e++;break}case 9:{for(l=Math.ceil(e/4)*4,p.push(-2);e++<l;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:r=!0,e=1}h=f+1}return s&&(r&&p.push(-5),t&&p.push(t),p.push(null)),p}}function zr(e){for(;!bt(e););return e}function Bt(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCharCode(n)}var Ao=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Mr(e){return e.replace(Ao,Co)}function Co(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let i=n.charCodeAt(1),u=i===120||i===88;return Bt(n.slice(u?2:1),u?16:10)}return He(n)||e}function De(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vr(e.position):"start"in e||"end"in e?vr(e):"line"in e||"column"in e?dn(e):""}function dn(e){return Nr(e&&e.line)+":"+Nr(e&&e.column)}function vr(e){return dn(e&&e.start)+"-"+dn(e&&e.end)}function Nr(e){return e&&typeof e=="number"?e:1}var jr={}.hasOwnProperty,gn=function(e,t,n){return typeof t!="string"&&(n=t,t=void 0),wo(n)(zr(Ir(n).document().write(_r()(e,t,!0))))};function wo(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(jn),autolinkProtocol:V,autolinkEmail:V,atxHeading:s(vn),blockQuote:s(Ue),characterEscape:V,characterReference:V,codeFenced:s(Pe),codeFencedFenceInfo:p,codeFencedFenceMeta:p,codeIndented:s(Pe,p),codeText:s(Ut,p),codeTextData:V,data:V,codeFlowValue:V,definition:s(Di),definitionDestinationString:p,definitionLabelString:p,definitionTitleString:p,emphasis:s(Ti),hardBreakEscape:s(Nn),hardBreakTrailing:s(Nn),htmlFlow:s(Un,p),htmlFlowData:V,htmlText:s(Un,p),htmlTextData:V,image:s(Oi),label:p,link:s(jn),listItem:s(Bi),listItemValue:F,listOrdered:s(Vn,c),listUnordered:s(Vn),paragraph:s(Pi),reference:Ne,referenceString:p,resourceDestinationString:p,resourceTitleString:p,setextHeading:s(vn),strong:s(Li),thematicBreak:s(Ri)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:he,autolinkProtocol:Je,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Ge,characterReferenceMarkerNumeric:Ge,characterReferenceValue:K,codeFenced:l(b),codeFencedFence:y,codeFencedFenceInfo:g,codeFencedFenceMeta:C,codeFlowValue:z,codeIndented:l(A),codeText:l(Q),codeTextData:z,data:z,definition:l(),definitionDestinationString:x,definitionLabelString:T,definitionTitleString:R,emphasis:l(),hardBreakEscape:l(_),hardBreakTrailing:l(_),htmlFlow:l(I),htmlFlowData:z,htmlText:l(H),htmlTextData:z,image:l(ce),label:oe,labelText:m,lineEnding:S,link:l(se),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Nt,resourceDestinationString:pe,resourceTitleString:d,resource:ne,setextHeading:l(q),setextHeadingLineSequence:B,setextHeadingText:L,strong:l(),thematicBreak:l()}};Vr(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(E){let k={type:"root",children:[]},O={stack:[k],tokenStack:[],config:t,enter:a,exit:h,buffer:p,resume:f,setData:u,getData:o},U=[],$=-1;for(;++$<E.length;)if(E[$][1].type==="listOrdered"||E[$][1].type==="listUnordered")if(E[$][0]==="enter")U.push($);else{let ae=U.pop();$=i(E,ae,$)}for($=-1;++$<E.length;){let ae=t[E[$][0]];jr.call(ae,E[$][1].type)&&ae[E[$][1].type].call(Object.assign({sliceSerialize:E[$][2].sliceSerialize},O),E[$][1])}if(O.tokenStack.length>0){let ae=O.tokenStack[O.tokenStack.length-1];(ae[1]||Ur).call(O,void 0,ae[0])}for(k.position={start:Te(E.length>0?E[0][1].start:{line:1,column:1,offset:0}),end:Te(E.length>0?E[E.length-2][1].end:{line:1,column:1,offset:0})},$=-1;++$<t.transforms.length;)k=t.transforms[$](k)||k;return k}function i(E,k,O){let U=k-1,$=-1,ae=!1,xe,fe,et,tt;for(;++U<=O;){let Y=E[U];if(Y[1].type==="listUnordered"||Y[1].type==="listOrdered"||Y[1].type==="blockQuote"?(Y[0]==="enter"?$++:$--,tt=void 0):Y[1].type==="lineEndingBlank"?Y[0]==="enter"&&(xe&&!tt&&!$&&!et&&(et=U),tt=void 0):Y[1].type==="linePrefix"||Y[1].type==="listItemValue"||Y[1].type==="listItemMarker"||Y[1].type==="listItemPrefix"||Y[1].type==="listItemPrefixWhitespace"||(tt=void 0),!$&&Y[0]==="enter"&&Y[1].type==="listItemPrefix"||$===-1&&Y[0]==="exit"&&(Y[1].type==="listUnordered"||Y[1].type==="listOrdered")){if(xe){let jt=U;for(fe=void 0;jt--;){let me=E[jt];if(me[1].type==="lineEnding"||me[1].type==="lineEndingBlank"){if(me[0]==="exit")continue;fe&&(E[fe][1].type="lineEndingBlank",ae=!0),me[1].type="lineEnding",fe=jt}else if(!(me[1].type==="linePrefix"||me[1].type==="blockQuotePrefix"||me[1].type==="blockQuotePrefixWhitespace"||me[1].type==="blockQuoteMarker"||me[1].type==="listItemIndent"))break}et&&(!fe||et<fe)&&(xe._spread=!0),xe.end=Object.assign({},fe?E[fe][1].start:Y[1].end),E.splice(fe||U,0,["exit",xe,Y[2]]),U++,O++}Y[1].type==="listItemPrefix"&&(xe={type:"listItem",_spread:!1,start:Object.assign({},Y[1].start),end:void 0},E.splice(U,0,["enter",xe,Y[2]]),U++,O++,et=void 0,tt=!0)}}return E[k][1]._spread=ae,O}function u(E,k){n[E]=k}function o(E){return n[E]}function s(E,k){return O;function O(U){a.call(this,E(U),U),k&&k.call(this,U)}}function p(){this.stack.push({type:"fragment",children:[]})}function a(E,k,O){return this.stack[this.stack.length-1].children.push(E),this.stack.push(E),this.tokenStack.push([k,O]),E.position={start:Te(k.start)},E}function l(E){return k;function k(O){E&&E.call(this,O),h.call(this,O)}}function h(E,k){let O=this.stack.pop(),U=this.tokenStack.pop();if(U)U[0].type!==E.type&&(k?k.call(this,E,U[0]):(U[1]||Ur).call(this,E,U[0]));else throw new Error("Cannot close `"+E.type+"` ("+De({start:E.start,end:E.end})+"): it\u2019s not open");return O.position.end=Te(E.end),O}function f(){return Zt(this.stack.pop())}function c(){u("expectingFirstListItemValue",!0)}function F(E){if(o("expectingFirstListItemValue")){let k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(E),10),u("expectingFirstListItemValue")}}function g(){let E=this.resume(),k=this.stack[this.stack.length-1];k.lang=E}function C(){let E=this.resume(),k=this.stack[this.stack.length-1];k.meta=E}function y(){o("flowCodeInside")||(this.buffer(),u("flowCodeInside",!0))}function b(){let E=this.resume(),k=this.stack[this.stack.length-1];k.value=E.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u("flowCodeInside")}function A(){let E=this.resume(),k=this.stack[this.stack.length-1];k.value=E.replace(/(\r?\n|\r)$/g,"")}function T(E){let k=this.resume(),O=this.stack[this.stack.length-1];O.label=k,O.identifier=de(this.sliceSerialize(E)).toLowerCase()}function R(){let E=this.resume(),k=this.stack[this.stack.length-1];k.title=E}function x(){let E=this.resume(),k=this.stack[this.stack.length-1];k.url=E}function w(E){let k=this.stack[this.stack.length-1];if(!k.depth){let O=this.sliceSerialize(E).length;k.depth=O}}function L(){u("setextHeadingSlurpLineEnding",!0)}function B(E){let k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(E).charCodeAt(0)===61?1:2}function q(){u("setextHeadingSlurpLineEnding")}function V(E){let k=this.stack[this.stack.length-1],O=k.children[k.children.length-1];(!O||O.type!=="text")&&(O=Ii(),O.position={start:Te(E.start)},k.children.push(O)),this.stack.push(O)}function z(E){let k=this.stack.pop();k.value+=this.sliceSerialize(E),k.position.end=Te(E.end)}function S(E){let k=this.stack[this.stack.length-1];if(o("atHardBreak")){let O=k.children[k.children.length-1];O.position.end=Te(E.end),u("atHardBreak");return}!o("setextHeadingSlurpLineEnding")&&t.canContainEols.includes(k.type)&&(V.call(this,E),z.call(this,E))}function _(){u("atHardBreak",!0)}function I(){let E=this.resume(),k=this.stack[this.stack.length-1];k.value=E}function H(){let E=this.resume(),k=this.stack[this.stack.length-1];k.value=E}function Q(){let E=this.resume(),k=this.stack[this.stack.length-1];k.value=E}function se(){let E=this.stack[this.stack.length-1];if(o("inReference")){let k=o("referenceType")||"shortcut";E.type+="Reference",E.referenceType=k,delete E.url,delete E.title}else delete E.identifier,delete E.label;u("referenceType")}function ce(){let E=this.stack[this.stack.length-1];if(o("inReference")){let k=o("referenceType")||"shortcut";E.type+="Reference",E.referenceType=k,delete E.url,delete E.title}else delete E.identifier,delete E.label;u("referenceType")}function m(E){let k=this.sliceSerialize(E),O=this.stack[this.stack.length-2];O.label=Mr(k),O.identifier=de(k).toLowerCase()}function oe(){let E=this.stack[this.stack.length-1],k=this.resume(),O=this.stack[this.stack.length-1];if(u("inReference",!0),O.type==="link"){let U=E.children;O.children=U}else O.alt=k}function pe(){let E=this.resume(),k=this.stack[this.stack.length-1];k.url=E}function d(){let E=this.resume(),k=this.stack[this.stack.length-1];k.title=E}function ne(){u("inReference")}function Ne(){u("referenceType","collapsed")}function Nt(E){let k=this.resume(),O=this.stack[this.stack.length-1];O.label=k,O.identifier=de(this.sliceSerialize(E)).toLowerCase(),u("referenceType","full")}function Ge(E){u("characterReferenceType",E.type)}function K(E){let k=this.sliceSerialize(E),O=o("characterReferenceType"),U;O?(U=Bt(k,O==="characterReferenceMarkerNumeric"?10:16),u("characterReferenceType")):U=He(k);let $=this.stack.pop();$.value+=U,$.position.end=Te(E.end)}function Je(E){z.call(this,E);let k=this.stack[this.stack.length-1];k.url=this.sliceSerialize(E)}function he(E){z.call(this,E);let k=this.stack[this.stack.length-1];k.url="mailto:"+this.sliceSerialize(E)}function Ue(){return{type:"blockquote",children:[]}}function Pe(){return{type:"code",lang:null,meta:null,value:""}}function Ut(){return{type:"inlineCode",value:""}}function Di(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ti(){return{type:"emphasis",children:[]}}function vn(){return{type:"heading",depth:void 0,children:[]}}function Nn(){return{type:"break"}}function Un(){return{type:"html",value:""}}function Oi(){return{type:"image",title:null,url:"",alt:null}}function jn(){return{type:"link",title:null,url:"",children:[]}}function Vn(E){return{type:"list",ordered:E.type==="listOrdered",start:null,spread:E._spread,children:[]}}function Bi(E){return{type:"listItem",spread:E._spread,checked:null,children:[]}}function Pi(){return{type:"paragraph",children:[]}}function Li(){return{type:"strong",children:[]}}function Ii(){return{type:"text",value:""}}function Ri(){return{type:"thematicBreak"}}}function Te(e){return{line:e.line,column:e.column,offset:e.offset}}function Vr(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Vr(e,r):ko(e,r)}}function ko(e,t){let n;for(n in t)if(jr.call(t,n)){if(n==="canContainEols"){let r=t[n];r&&e[n].push(...r)}else if(n==="transforms"){let r=t[n];r&&e[n].push(...r)}else if(n==="enter"||n==="exit"){let r=t[n];r&&Object.assign(e[n],r)}}}function Ur(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+De({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+De({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+De({start:t.start,end:t.end})+") is still open")}function Pt(e){Object.assign(this,{Parser:n=>{let r=this.data("settings");return gn(n,Object.assign({},r,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function xn(e){if(e)throw e}var si=yt(yn(),1),Sn=yt(Gr(),1);function lt(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function En(){let e=[],t={run:n,use:r};return t;function n(...i){let u=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(p,...a){let l=e[++u],h=-1;if(p){o(p);return}for(;++h<i.length;)(a[h]===null||a[h]===void 0)&&(a[h]=i[h]);i=a,l?Jr(l,s)(...a):o(null,...a)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Jr(e,t){let n;return r;function r(...o){let s=e.length>o.length,p;s&&o.push(i);try{p=e.apply(this,o)}catch(a){let l=a;if(s&&n)throw l;return i(l)}s||(p&&p.then&&typeof p.then=="function"?p.then(u,i):p instanceof Error?i(p):u(p))}function i(o,...s){n||(n=!0,t(o,...s))}function u(o){i(null,o)}}var ri=yt(yn(),1);var G=class extends Error{constructor(t,n,r){let i=[null,null],u={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof n=="string"&&(r=n,n=void 0),typeof r=="string"){let o=r.indexOf(":");o===-1?i[1]=r:(i[0]=r.slice(0,o),i[1]=r.slice(o+1))}n&&("type"in n||"position"in n?n.position&&(u=n.position):"start"in n||"end"in n?u=n:("line"in n||"column"in n)&&(u.start=n)),this.name=De(n)||"1:1",this.message=typeof t=="object"?t.message:t,this.stack="",typeof t=="object"&&t.stack&&(this.stack=t.stack),this.reason=this.message,this.fatal,this.line=u.start.line,this.column=u.start.column,this.position=u,this.source=i[0],this.ruleId=i[1],this.file,this.actual,this.expected,this.url,this.note}};G.prototype.file="";G.prototype.name="";G.prototype.reason="";G.prototype.message="";G.prototype.stack="";G.prototype.fatal=null;G.prototype.column=null;G.prototype.line=null;G.prototype.source=null;G.prototype.ruleId=null;G.prototype.position=null;var le={basename:bo,dirname:So,extname:Do,join:To,sep:"/"};function bo(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ct(e);let n=0,r=-1,i=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(u){n=i+1;break}}else r<0&&(u=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(e.charCodeAt(i)===47){if(u){n=i+1;break}}else o<0&&(u=!0,o=i+1),s>-1&&(e.charCodeAt(i)===t.charCodeAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function So(e){if(ct(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.charCodeAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.charCodeAt(0)===47?"/":".":t===1&&e.charCodeAt(0)===47?"//":e.slice(0,t)}function Do(e){ct(e);let t=e.length,n=-1,r=0,i=-1,u=0,o;for(;t--;){let s=e.charCodeAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:u!==1&&(u=1):i>-1&&(u=-1)}return i<0||n<0||u===0||u===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function To(...e){let t=-1,n;for(;++t<e.length;)ct(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Oo(n)}function Oo(e){ct(e);let t=e.charCodeAt(0)===47,n=Bo(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.charCodeAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Bo(e,t){let n="",r=0,i=-1,u=0,o=-1,s,p;for(;++o<=e.length;){if(o<e.length)s=e.charCodeAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||u===1))if(i!==o-1&&u===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",r=0):(n=n.slice(0,p),r=n.length-1-n.lastIndexOf("/")),i=o,u=0;continue}}else if(n.length>0){n="",r=0,i=o,u=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,u=0}else s===46&&u>-1?u++:u=-1}return n}function ct(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var ei={cwd:Po};function Po(){return"/"}function Ye(e){return e!==null&&typeof e=="object"&&e.href&&e.origin}function ti(e){if(typeof e=="string")e=new URL(e);else if(!Ye(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Lo(e)}function Lo(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.charCodeAt(n)===37&&t.charCodeAt(n+1)===50){let r=t.charCodeAt(n+2);if(r===70||r===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}var Fn=["history","path","basename","stem","extname","dirname"],pt=class{constructor(t){let n;t?typeof t=="string"||Io(t)?n={value:t}:Ye(t)?n={path:t}:n=t:n={},this.data={},this.messages=[],this.history=[],this.cwd=ei.cwd(),this.value,this.stored,this.result,this.map;let r=-1;for(;++r<Fn.length;){let u=Fn[r];u in n&&n[u]!==void 0&&n[u]!==null&&(this[u]=u==="history"?[...n[u]]:n[u])}let i;for(i in n)Fn.includes(i)||(this[i]=n[i])}get path(){return this.history[this.history.length-1]}set path(t){Ye(t)&&(t=ti(t)),Cn(t,"path"),this.path!==t&&this.history.push(t)}get dirname(){return typeof this.path=="string"?le.dirname(this.path):void 0}set dirname(t){ni(this.basename,"dirname"),this.path=le.join(t||"",this.basename)}get basename(){return typeof this.path=="string"?le.basename(this.path):void 0}set basename(t){Cn(t,"basename"),An(t,"basename"),this.path=le.join(this.dirname||"",t)}get extname(){return typeof this.path=="string"?le.extname(this.path):void 0}set extname(t){if(An(t,"extname"),ni(this.dirname,"extname"),t){if(t.charCodeAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=le.join(this.dirname,this.stem+(t||""))}get stem(){return typeof this.path=="string"?le.basename(this.path,this.extname):void 0}set stem(t){Cn(t,"stem"),An(t,"stem"),this.path=le.join(this.dirname||"",t+(this.extname||""))}toString(t){return(this.value||"").toString(t||void 0)}message(t,n,r){let i=new G(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}info(t,n,r){let i=this.message(t,n,r);return i.fatal=null,i}fail(t,n,r){let i=this.message(t,n,r);throw i.fatal=!0,i}};function An(e,t){if(e&&e.includes(le.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+le.sep+"`")}function Cn(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ni(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Io(e){return(0,ri.default)(e)}var Dn=li().freeze(),ai={}.hasOwnProperty;function li(){let e=En(),t=[],n={},r,i=-1;return u.data=o,u.Parser=void 0,u.Compiler=void 0,u.freeze=s,u.attachers=t,u.use=p,u.parse=a,u.stringify=l,u.run=h,u.runSync=f,u.process=c,u.processSync=F,u;function u(){let g=li(),C=-1;for(;++C<t.length;)g.use(...t[C]);return g.data((0,Sn.default)(!0,{},n)),g}function o(g,C){return typeof g=="string"?arguments.length===2?(bn("data",r),n[g]=C,u):ai.call(n,g)&&n[g]||null:g?(bn("data",r),n=g,u):n}function s(){if(r)return u;for(;++i<t.length;){let[g,...C]=t[i];if(C[0]===!1)continue;C[0]===!0&&(C[0]=void 0);let y=g.call(u,...C);typeof y=="function"&&e.use(y)}return r=!0,i=Number.POSITIVE_INFINITY,u}function p(g,...C){let y;if(bn("use",r),g!=null)if(typeof g=="function")R(g,...C);else if(typeof g=="object")Array.isArray(g)?T(g):A(g);else throw new TypeError("Expected usable value, not `"+g+"`");return y&&(n.settings=Object.assign(n.settings||{},y)),u;function b(x){if(typeof x=="function")R(x);else if(typeof x=="object")if(Array.isArray(x)){let[w,...L]=x;R(w,...L)}else A(x);else throw new TypeError("Expected usable value, not `"+x+"`")}function A(x){T(x.plugins),x.settings&&(y=Object.assign(y||{},x.settings))}function T(x){let w=-1;if(x!=null)if(Array.isArray(x))for(;++w<x.length;){let L=x[w];b(L)}else throw new TypeError("Expected a list of plugins, not `"+x+"`")}function R(x,w){let L=-1,B;for(;++L<t.length;)if(t[L][0]===x){B=t[L];break}B?(lt(B[1])&<(w)&&(w=(0,Sn.default)(!0,B[1],w)),B[1]=w):t.push([...arguments])}}function a(g){u.freeze();let C=ht(g),y=u.Parser;return wn("parse",y),ii(y,"parse")?new y(String(C),C).parse():y(String(C),C)}function l(g,C){u.freeze();let y=ht(C),b=u.Compiler;return kn("stringify",b),ui(g),ii(b,"compile")?new b(g,y).compile():b(g,y)}function h(g,C,y){if(ui(g),u.freeze(),!y&&typeof C=="function"&&(y=C,C=void 0),!y)return new Promise(b);b(null,y);function b(A,T){e.run(g,ht(C),R);function R(x,w,L){w=w||g,x?T(x):A?A(w):y(null,w,L)}}}function f(g,C){let y,b;return u.run(g,C,A),oi("runSync","run",b),y;function A(T,R){xn(T),y=R,b=!0}}function c(g,C){if(u.freeze(),wn("process",u.Parser),kn("process",u.Compiler),!C)return new Promise(y);y(null,C);function y(b,A){let T=ht(g);u.run(u.parse(T),T,(x,w,L)=>{if(x||!w||!L)R(x);else{let B=u.stringify(w,L);B==null||(zo(B)?L.value=B:L.result=B),R(x,L)}});function R(x,w){x||!w?A(x):b?b(w):C(null,w)}}}function F(g){let C;u.freeze(),wn("processSync",u.Parser),kn("processSync",u.Compiler);let y=ht(g);return u.process(y,b),oi("processSync","process",C),y;function b(A){C=!0,xn(A)}}}function ii(e,t){return typeof e=="function"&&e.prototype&&(Ro(e.prototype)||t in e.prototype)}function Ro(e){let t;for(t in e)if(ai.call(e,t))return!0;return!1}function wn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `Parser`")}function kn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `Compiler`")}function bn(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ui(e){if(!lt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function oi(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ht(e){return _o(e)?e:new pt(e)}function _o(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zo(e){return typeof e=="string"||(0,si.default)(e)}var Tn={children(e){return je.children(e)},annotatetextnode(e,t){return je.annotatetextnode(e,t)},interpretmarkup(e=""){return`
|
|
`.repeat((e.match(/\n/g)||[]).length)},remarkoptions:{}};function ci(e,t=Tn){let n=Dn().use(Pt,t.remarkoptions).use(Ft,["yaml","toml"]).parse(e);return Hn(e,n,t)}var zn=require("obsidian");var Bn=class{add(t,n,r){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],n&&this[i][r?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}},Pn=class{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(i=>{if(typeof i!="object"||!i.name||!i.init)throw new Error("Invalid JSEP plugin format");this.registered[i.name]||(i.init(this.jsep),this.registered[i.name]=i)})}},te=class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,n,r){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=n,r?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,n){return e.literals[t]=n,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}static removeAllBinaryOps(){return e.binary_ops={},e.max_binop_len=0,e}static removeLiteral(t){return delete e.literals[t],e}static removeAllLiterals(){return e.literals={},e}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new e(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return e.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}throwError(t){let n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(e.hooks[t]){let r={context:this,node:n};return e.hooks.run(t,r),r.node}return n}searchHook(t){if(e.hooks[t]){let n={context:this};return e.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],r,i;for(;this.index<this.expr.length;)if(r=this.code,r===e.SEMCOL_CODE||r===e.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())n.push(i);else if(this.index<this.expr.length){if(r===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,e.max_binop_len),n=t.length;for(;n>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,r,i,u,o,s,p,a;if(o=this.gobbleToken(),!o||(n=this.gobbleBinaryOp(),!n))return o;for(u={value:n,prec:e.binaryPrecedence(n),right_a:e.right_associative.has(n)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+n),i=[o,u,s];n=this.gobbleBinaryOp();){if(r=e.binaryPrecedence(n),r===0){this.index-=n.length;break}u={value:n,prec:r,right_a:e.right_associative.has(n)},a=n;let l=h=>u.right_a&&h.right_a?r>h.prec:r<=h.prec;for(;i.length>2&&l(i[i.length-2]);)s=i.pop(),n=i.pop().value,o=i.pop(),t={type:e.BINARY_EXP,operator:n,left:o,right:s},i.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+a),i.push(u,t)}for(p=i.length-1,t=i[p];p>1;)t={type:e.BINARY_EXP,operator:i[p-1].value,left:i[p-2],right:t},p-=2;return t}gobbleToken(){let t,n,r,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,e.max_unop_len),r=n.length;r>0;){if(e.unary_ops.hasOwnProperty(n)&&(!e.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=r;let u=this.gobbleToken();return u||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:e.UNARY_EXP,operator:n,argument:u,prefix:!0})}n=n.substr(0,--r)}e.isIdentifierStart(t)?(i=this.gobbleIdentifier(),e.literals.hasOwnProperty(i.name)?i={type:e.LITERAL,value:e.literals[i.name],raw:i.name}:i.name===e.this_str&&(i={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===e.PERIOD_CODE||n===e.OBRACK_CODE||n===e.OPAREN_CODE||n===e.QUMARK_CODE;){let r;if(n===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),n=this.code,n!==e.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(n===e.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),r&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,r;for(;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return r=this.code,e.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(r===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:e.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="",n=this.index,r=this.expr.charAt(this.index++),i=!1;for(;this.index<this.expr.length;){let u=this.expr.charAt(this.index++);if(u===r){i=!0;break}else if(u==="\\")switch(u=this.expr.charAt(this.index++),u){case"n":t+=`
|
|
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=u}else t+=u}return i||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){let n=[],r=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let u=this.code;if(u===t){r=!0,this.index++,t===e.CPAREN_CODE&&i&&i>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(u===e.COMMA_CODE){if(this.index++,i++,i!==n.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let o=n.length;o<i;o++)n.push(null)}}else if(n.length!==i&&i!==0)this.throwError("Expected comma");else{let o=this.gobbleExpression();(!o||o.type===e.COMPOUND)&&this.throwError("Expected comma"),n.push(o)}}return r||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}},vo=new Bn;Object.assign(te,{hooks:vo,plugins:new Pn(te),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});te.max_unop_len=te.getMaxKeyLen(te.unary_ops);te.max_binop_len=te.getMaxKeyLen(te.binary_ops);var ge=e=>new te(e).parse(),No=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(te).filter(e=>!No.includes(e)&&ge[e]===void 0).forEach(e=>{ge[e]=te[e]});ge.Jsep=te;var Uo="ConditionalExpression",jo={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;let r=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let u=this.gobbleExpression();if(u||this.throwError("Expected expression"),n.node={type:Uo,test:r,consequent:i,alternate:u},r.operator&&e.binary_ops[r.operator]<=.9){let o=r;for(;o.right.operator&&e.binary_ops[o.right.operator]<=.9;)o=o.right;n.node.test=o.right,o.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};ge.plugins.register(jo);var pi=47,Vo=92,$o={name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(this.code===pi){let r=++this.index,i=!1;for(;this.index<this.expr.length;){if(this.code===pi&&!i){let u=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let p=this.code;if(p>=97&&p<=122||p>=65&&p<=90||p>=48&&p<=57)o+=this.char;else break}let s;try{s=new RegExp(u,o)}catch(p){this.throwError(p.message)}return n.node={type:e.LITERAL,value:s,raw:this.expr.slice(r-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?i=!0:i&&this.code===e.CBRACK_CODE&&(i=!1),this.index+=this.code===Vo?2:1}this.throwError("Unclosed Regex")}})}},On=43,qo=45,Qe={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[On,qo],assignmentPrecedence:.9,init(e){let t=[e.IDENTIFIER,e.MEMBER_EXP];Qe.assignmentOperators.forEach(r=>e.addBinaryOp(r,Qe.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(i){let u=this.code;Qe.updateOperators.some(o=>o===u&&o===this.expr.charCodeAt(this.index+1))&&(this.index+=2,i.node={type:"UpdateExpression",operator:u===On?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!i.node.argument||!t.includes(i.node.argument.type))&&this.throwError(`Unexpected ${i.node.operator}`))}),e.hooks.add("after-token",function(i){if(i.node){let u=this.code;Qe.updateOperators.some(o=>o===u&&o===this.expr.charCodeAt(this.index+1))&&(t.includes(i.node.type)||this.throwError(`Unexpected ${i.node.operator}`),this.index+=2,i.node={type:"UpdateExpression",operator:u===On?"++":"--",argument:i.node,prefix:!1})}}),e.hooks.add("after-expression",function(i){i.node&&n(i.node)});function n(r){Qe.assignmentOperators.has(r.operator)?(r.type="AssignmentExpression",n(r.left),n(r.right)):r.operator||Object.values(r).forEach(i=>{i&&typeof i=="object"&&n(i)})}}};ge.plugins.register($o,Qe);ge.addUnaryOp("typeof");ge.addLiteral("null",null);ge.addLiteral("undefined",void 0);var Ho=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),j={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return j.evalBinaryExpression(e,t);case"Compound":return j.evalCompound(e,t);case"ConditionalExpression":return j.evalConditionalExpression(e,t);case"Identifier":return j.evalIdentifier(e,t);case"Literal":return j.evalLiteral(e,t);case"MemberExpression":return j.evalMemberExpression(e,t);case"UnaryExpression":return j.evalUnaryExpression(e,t);case"ArrayExpression":return j.evalArrayExpression(e,t);case"CallExpression":return j.evalCallExpression(e,t);case"AssignmentExpression":return j.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(r,i)=>r||i(),"&&":(r,i)=>r&&i(),"|":(r,i)=>r|i(),"^":(r,i)=>r^i(),"&":(r,i)=>r&i(),"==":(r,i)=>r==i(),"!=":(r,i)=>r!=i(),"===":(r,i)=>r===i(),"!==":(r,i)=>r!==i(),"<":(r,i)=>r<i(),">":(r,i)=>r>i(),"<=":(r,i)=>r<=i(),">=":(r,i)=>r>=i(),"<<":(r,i)=>r<<i(),">>":(r,i)=>r>>i(),">>>":(r,i)=>r>>>i(),"+":(r,i)=>r+i(),"-":(r,i)=>r-i(),"*":(r,i)=>r*i(),"/":(r,i)=>r/i(),"%":(r,i)=>r%i()}[e.operator](j.evalAst(e.left,t),()=>j.evalAst(e.right,t))},evalCompound(e,t){let n;for(let r=0;r<e.body.length;r++){e.body[r].type==="Identifier"&&["var","let","const"].includes(e.body[r].name)&&e.body[r+1]&&e.body[r+1].type==="AssignmentExpression"&&(r+=1);let i=e.body[r];n=j.evalAst(i,t)}return n},evalConditionalExpression(e,t){return j.evalAst(e.test,t)?j.evalAst(e.consequent,t):j.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){let n=e.computed?j.evalAst(e.property):e.property.name,r=j.evalAst(e.object,t);if(r==null)throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);if(!Object.hasOwn(r,n)&&Ho.has(n))throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);let i=r[n];return typeof i=="function"?i.bind(r):i},evalUnaryExpression(e,t){return{"-":r=>-j.evalAst(r,t),"!":r=>!j.evalAst(r,t),"~":r=>~j.evalAst(r,t),"+":r=>+j.evalAst(r,t),typeof:r=>typeof j.evalAst(r,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(n=>j.evalAst(n,t))},evalCallExpression(e,t){let n=e.arguments.map(i=>j.evalAst(i,t));return j.evalAst(e.callee,t)(...n)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");let n=e.left.name,r=j.evalAst(e.right,t);return t[n]=r,t[n]}},Ln=class{constructor(t){this.code=t,this.ast=ge(this.code)}runInNewContext(t){let n=Object.assign(Object.create(null),t);return j.evalAst(this.ast,n)}};function Oe(e,t){return e=e.slice(),e.push(t),e}function In(e,t){return t=t.slice(),t.unshift(e),t}var Rn=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function v(e,t,n,r,i){if(!(this instanceof v))try{return new v(e,t,n,r,i)}catch(o){if(!o.avoidNew)throw o;return o.value}typeof e=="string"&&(i=r,r=n,n=t,t=e,e=null);let u=e&&typeof e=="object";if(e=e||{},this.json=e.json||n,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors=="undefined"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||r||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let o={path:u?e.path:t};u?"json"in e&&(o.json=e.json):o.json=n;let s=this.evaluate(o);if(!s||typeof s!="object")throw new Rn(s);return s}}v.prototype.evaluate=function(e,t,n,r){let i=this.parent,u=this.parentProperty,{flatten:o,wrap:s}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),o=Object.hasOwn(e,"flatten")?e.flatten:o,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,s=Object.hasOwn(e,"wrap")?e.wrap:s,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,n=Object.hasOwn(e,"callback")?e.callback:n,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(e,"parent")?e.parent:i,u=Object.hasOwn(e,"parentProperty")?e.parentProperty:u,e=e.path}if(i=i||null,u=u||null,Array.isArray(e)&&(e=v.toPathString(e)),!e&&e!==""||!t)return;let p=v.toPathArray(e);p[0]==="$"&&p.length>1&&p.shift(),this._hasParentSelector=null;let a=this._trace(p,t,["$"],i,u,n).filter(function(l){return l&&!l.isParentSelector});return a.length?!s&&a.length===1&&!a[0].hasArrExpr?this._getPreferredOutput(a[0]):a.reduce((l,h)=>{let f=this._getPreferredOutput(h);return o&&Array.isArray(f)?l=l.concat(f):l.push(f),l},[]):s?[]:void 0};v.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let n=Array.isArray(e.path)?e.path:v.toPathArray(e.path);return e.pointer=v.toPointer(n),e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return v.toPathString(e[t]);case"pointer":return v.toPointer(e.path);default:throw new TypeError("Unknown result type")}};v.prototype._handleCallback=function(e,t,n){if(t){let r=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),t(r,n,e)}};v.prototype._trace=function(e,t,n,r,i,u,o,s){let p;if(!e.length)return p={path:n,value:t,parent:r,parentProperty:i,hasArrExpr:o},this._handleCallback(p,u,"value"),p;let a=e[0],l=e.slice(1),h=[];function f(c){Array.isArray(c)?c.forEach(F=>{h.push(F)}):h.push(c)}if((typeof a!="string"||s)&&t&&Object.hasOwn(t,a))f(this._trace(l,t[a],Oe(n,a),t,a,u,o));else if(a==="*")this._walk(t,c=>{f(this._trace(l,t[c],Oe(n,c),t,c,u,!0,!0))});else if(a==="..")f(this._trace(l,t,n,r,i,u,o)),this._walk(t,c=>{typeof t[c]=="object"&&f(this._trace(e.slice(),t[c],Oe(n,c),t,c,u,!0))});else{if(a==="^")return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:l,isParentSelector:!0};if(a==="~")return p={path:Oe(n,a),value:i,parent:r,parentProperty:null},this._handleCallback(p,u,"property"),p;if(a==="$")f(this._trace(l,t,n,null,null,u,o));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(a))f(this._slice(a,l,t,n,r,i,u));else if(a.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=a.replace(/^\?\((.*?)\)$/u,"$1"),F=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(c);F?this._walk(t,g=>{let C=[F[2]],y=F[1]?t[g][F[1]]:t[g];this._trace(C,y,n,r,i,u,!0).length>0&&f(this._trace(l,t[g],Oe(n,g),t,g,u,!0))}):this._walk(t,g=>{this._eval(c,t[g],g,n,r,i)&&f(this._trace(l,t[g],Oe(n,g),t,g,u,!0))})}else if(a[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(In(this._eval(a,t,n.at(-1),n.slice(0,-1),r,i),l),t,n,r,i,u,o))}else if(a[0]==="@"){let c=!1,F=a.slice(1,-2);switch(F){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===F&&(c=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(c=!0);break;case"number":Number.isFinite(t)&&(c=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(c=!0);break;case"object":t&&typeof t===F&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,n,r,i);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+F)}if(c)return p={path:n,value:t,parent:r,parentProperty:i},this._handleCallback(p,u,"value"),p}else if(a[0]==="`"&&t&&Object.hasOwn(t,a.slice(1))){let c=a.slice(1);f(this._trace(l,t[c],Oe(n,c),t,c,u,o,!0))}else if(a.includes(",")){let c=a.split(",");for(let F of c)f(this._trace(In(F,l),t,n,r,i,u,!0))}else!s&&t&&Object.hasOwn(t,a)&&f(this._trace(l,t[a],Oe(n,a),t,a,u,o,!0))}if(this._hasParentSelector)for(let c=0;c<h.length;c++){let F=h[c];if(F&&F.isParentSelector){let g=this._trace(F.expr,t,F.path,r,i,u,o);if(Array.isArray(g)){h[c]=g[0];let C=g.length;for(let y=1;y<C;y++)c++,h.splice(c,0,g[y])}else h[c]=g}}return h};v.prototype._walk=function(e,t){if(Array.isArray(e)){let n=e.length;for(let r=0;r<n;r++)t(r)}else e&&typeof e=="object"&&Object.keys(e).forEach(n=>{t(n)})};v.prototype._slice=function(e,t,n,r,i,u,o){if(!Array.isArray(n))return;let s=n.length,p=e.split(":"),a=p[2]&&Number.parseInt(p[2])||1,l=p[0]&&Number.parseInt(p[0])||0,h=p[1]&&Number.parseInt(p[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),h=h<0?Math.max(0,h+s):Math.min(s,h);let f=[];for(let c=l;c<h;c+=a)this._trace(In(c,t),n,r,i,u,o,!0).forEach(g=>{f.push(g)});return f};v.prototype._eval=function(e,t,n,r,i,u){this.currSandbox._$_parentProperty=u,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let o=e.includes("@path");o&&(this.currSandbox._$_path=v.toPathString(r.concat([n])));let s=this.currEval+"Script:"+e;if(!v.cache[s]){let p=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(o&&(p=p.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)v.cache[s]=new this.safeVm.Script(p);else if(this.currEval==="native")v.cache[s]=new this.vm.Script(p);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){let a=this.currEval;v.cache[s]=new a(p)}else if(typeof this.currEval=="function")v.cache[s]={runInNewContext:a=>this.currEval(p,a)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return v.cache[s].runInNewContext(this.currSandbox)}catch(p){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+p.message+": "+e)}};v.cache={};v.toPathString=function(e){let t=e,n=t.length,r="$";for(let i=1;i<n;i++)/^(~|\^|@.*?\(\))$/u.test(t[i])||(r+=/^[0-9*]+$/u.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']");return r};v.toPointer=function(e){let t=e,n=t.length,r="";for(let i=1;i<n;i++)/^(~|\^|@.*?\(\))$/u.test(t[i])||(r+="/"+t[i].toString().replaceAll("~","~0").replaceAll("/","~1"));return r};v.toPathArray=function(e){let{cache:t}=v;if(t[e])return t[e].concat();let n=[],i=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(u,o){return"[#"+(n.push(o)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(u,o){return"['"+o.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(u,o){return";"+o.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(u){let o=u.match(/#(\d+)/u);return!o||!o[1]?u:n[o[1]]});return t[e]=i,t[e].concat()};v.prototype.safeVm={Script:Ln};var Yo=function(e,t,n){let r=e.length;for(let i=0;i<r;i++){let u=e[i];n(u)&&t.push(e.splice(i--,1)[0])}},_n=class{constructor(t){this.code=t}runInNewContext(t){let n=this.code,r=Object.keys(t),i=[];Yo(r,i,a=>typeof t[a]=="function");let u=r.map(a=>t[a]);n=i.reduce((a,l)=>{let h=t[l].toString();return/function/u.test(h)||(h="function "+h),"var "+l+"="+h+";"+a},"")+n,!/(['"])use strict\1/u.test(n)&&!r.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;\s*$/u,"");let s=n.lastIndexOf(";"),p=s!==-1?n.slice(0,s+1)+" return "+n.slice(s+1):" return "+n;return new Function(...r,p)(...u)}};v.prototype.vm={Script:_n};var ie;(f=>{async function e(c,F,g,C){var L;let y=ci(g,{...Tn,interpretmarkup(B=""){var V,z;if(/^`[^`]+`$/.test(B))return B;let q=`
|
|
`.repeat((z=(V=B.match(/\n/g))==null?void 0:V.length)!=null?z:0);return B.match(/^\s*(-|\d+\.) $/m)?q+"\u2022 ":q}}),b=JSON.stringify(y),A=(L=C!=null?C:c.staticLanguage)!=null?L:"auto",T={data:b,language:A,enabledOnly:"false",level:c.pickyMode?"picky":"default"};c.motherTongue&&(T.motherTongue=c.motherTongue),c.enabledCategories&&(T.enabledCategories=c.enabledCategories),c.disabledCategories&&(T.disabledCategories=c.disabledCategories),c.enabledRules&&(T.enabledRules=c.enabledRules),c.disabledRules&&(T.disabledRules=c.disabledRules),A=="auto"&&(T.preferredVariants=Object.values(c.languageVariety).join(",")),ze(c.serverUrl)!=="standard"&&c.apikey&&c.username&&(T.username=c.username,T.apiKey=c.apikey);let x=await p({url:`${c.serverUrl}/v2/check`,method:"POST",body:new URLSearchParams(T).toString(),headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}});if(x.json==null)throw new Error("Error processing response from LanguageTool.");return l("$.matches[*]",x.json).map(B=>{let q=a("$.offset@number()",B),V=q+a("$.length@number()",B);return{text:g.slice(q,V),from:F+q,to:F+V,title:a("$.shortMessage@string()",B),message:a("$.message@string()",B),replacements:l("$.replacements[*].value@string()",B),categoryId:a("$.rule.category.id@string()",B),ruleId:a("$.rule.id@string()",B)}})}f.check=e;async function t(c){let F=await(0,zn.requestUrl)({url:`${c}/v2/languages`}).json;if(F==null||!(F instanceof Array))throw new Error("Error processing response from LanguageTool.");return F}f.languages=t;async function n(c){if(c.username==null||c.apikey==null)throw Error("Syncing words is only supported for premium users");try{let F=(await p({url:h(`${c.serverUrl}/v2/words`,{username:c.username,apiKey:c.apikey,limit:"1000"}).href})).json;return l("$.words[*]@string()",F)}catch(F){throw new Error(`Requesting words failed
|
|
${F}`)}}f.words=n;async function r(c,F){if(c.username==null||c.apikey==null)throw Error("Syncing words is only supported for premium users");try{let g=(await p({url:h(`${c.serverUrl}/v2/words/add`,{username:c.username,apiKey:c.apikey,word:F}).href,method:"POST"})).json;return a("$.added@boolean()",g)}catch(g){throw new Error(`Adding words failed
|
|
${g}`)}}f.wordsAdd=r;async function i(c,F){if(c.username==null||c.apikey==null)throw Error("Syncing words is only supported for premium users");try{let g=(await p({url:h(`${c.serverUrl}/v2/words/delete`,{username:c.username,apiKey:c.apikey,word:F}).href,method:"POST"})).json;return a("$.deleted@boolean()",g)}catch(g){throw new Error(`Deleting words failed
|
|
${g}`)}}f.wordsDel=i;class u{constructor(){this.url="https://qb-grammar-en.languagetool.org/phrasal-paraphraser/subscribe"}async query(F,g){let C=F.slice(0,g.from).split(/\s+/).length,y=F.slice(g.from,g.to),b={message:{indices:[C],mode:0,phrases:[y],text:F},meta:{clientStatus:"string",product:"string",traceID:"string",userID:"string"},response_queue:"string"};try{let A=(await p({url:this.url,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})).json;return l("$.data.suggestions[*][*]@string()",A)}catch(A){throw new Error(`Requesting synonyms failed
|
|
${A}`)}}}class o{constructor(){this.url="https://synonyms.languagetool.org/synonyms/de"}async query(F,g){let C=F.slice(g.from,g.to).trim(),y=F.slice(0,g.from).split(/\s+/).join("+"),b=F.slice(g.to).split(/\s+/).join("+");try{let A=(await p({url:h(`${this.url}/${C}`,{before:y,after:b}).href,method:"GET"})).json;return l("$.synsets[*].terms[*].term@string()",A)}catch(A){throw new Error(`Requesting synonyms failed
|
|
${A}`)}}}f.SYNONYMS={en:new u,de:new o};async function p(c){let F;try{F=await(0,zn.requestUrl)({...c,throw:!1})}catch(g){throw new Error(`Request to LanguageTool failed: Please check your connection and server URL.
|
|
${g}`)}if(F.status===504||F.status===503)throw new Error("Request to LanguageTool timed out. Please try again later.");if(F.status!==200){let g=F.text;throw g.length>310&&(g=g.substring(0,300)+"..."),new Error(`Request to LanguageTool failed ${F.status}:
|
|
${g}`)}return F}function a(c,F){let g=v({path:c,json:F,wrap:!1,eval:!1});if(g==null)throw new Error("Error parsing response.");return g}function l(c,F){let g=v({path:c,json:F,wrap:!0,eval:!1});if(g==null||!(g instanceof Array))throw new Error("Error parsing response.");return g}function h(c,F){let g=new URL(c);return g.search=new URLSearchParams(F).toString(),g}})(ie||(ie={}));function It(e){switch(e){case"COLLOQUIALISMS":case"REDUNDANCY":case"STYLE":case"SYNONYMS":return"lt-style";case"TYPOS":return"lt-major"}return"lt-minor"}function We(e,t){let n=new Set(e);for(let r of t)n.delete(r);return n}function hi(e,t){let n=new Set(e);for(let r of t)n.add(r);return n}function fi(e,t){let n=new Set;for(let r of t)e.has(r)&&n.add(r);return n}function Ke(e,t){return e=e.toLowerCase(),t=t.toLowerCase(),e>t?1:e<t?-1:0}var mi=5e3,Qo=250,ft=class{constructor(t,n,r){this.url=t,this.requestsPerSec=n,this.maxSize=r}get minDelay(){return 60/this.requestsPerSec*1e3}},mt={standard:new ft("https://api.languagetool.org",20,2e4),premium:new ft("https://api.languagetoolplus.com",80,75e3),custom:new ft("",120,1e6)};function ze(e){for(let[t,n]of Object.entries(mt))if(n.url===e)return t;return"custom"}var gi={serverUrl:mt.standard.url,autoCheckDelay:mt.standard.minDelay,shouldAutoCheck:!1,languageVariety:{en:"en-US",de:"de-DE",pt:"pt-PT",ca:"ca-ES"},dictionary:[],syncDictionary:!1,remoteDictionary:[],pickyMode:!1};function di(e,t){return e=e.filter(n=>n.code===t).filter(n=>n.longCode!==n.code),Object.fromEntries(e.map(n=>[n.longCode,n.name]))}var Rt=class extends N.PluginSettingTab{constructor(n,r){super(n,r);this.endpointListeners=[];this.languageListeners=[];this.languages=[];this.plugin=r}configureCheckDelay(n,r){let i=mt[r].minDelay;this.plugin.settings.autoCheckDelay=Math.clamp(this.plugin.settings.autoCheckDelay,i,mi),n.setLimits(i,mi,Qo)}async notifyEndpointChange(n){for(let r of this.endpointListeners)await r(n.serverUrl)}async configureLanguageVariants(n,r){var o;let i=this.plugin.settings.languageVariety,u=di(this.languages,r);i[r]=(o=i[r])!=null?o:Object.keys(u)[0],n.addOptions(u).setValue(i[r]).onChange(async s=>{i[r]=s,await this.plugin.saveSettings()}),this.languageListeners.push(async s=>{var a;for(;n.selectEl.options.length>0;)n.selectEl.remove(0);let p=di(s,r);i[r]=(a=i[r])!=null?a:Object.keys(p)[0],n.addOptions(p).setValue(i[r])})}async display(){let{containerEl:n}=this;n.empty();let r=this.plugin.settings;this.endpointListeners=[],this.endpointListeners.push(async a=>{let l=[];a&&(l=await ie.languages(a)),this.languages=l;for(let h of this.languageListeners)await h(l)}),this.endpointListeners.push(async a=>{await this.plugin.syncDictionary()}),this.languageListeners=[],new N.Setting(n).setName("Error logs").setDesc(`${this.plugin.logs.length} messages`).addButton(a=>{a.setButtonText("Copy to clipboard").onClick(async()=>{await window.navigator.clipboard.writeText(this.plugin.logs.join(`
|
|
`)),new N.Notice("Logs copied to clipboard")})});let i=ze(r.serverUrl),u=null;new N.Setting(n).setName("Endpoint").setDesc("Choose the LanguageTool server url").then(a=>{a.controlEl.classList.add("lt-settings-grid");let l=null,h=null;a.addDropdown(f=>{l=f,f.addOptions({standard:"(Standard) api.languagetool.org",premium:"(Premium) api.languagetoolplus.com",custom:"Custom URL"}).setValue(i).onChange(async c=>{i=c,r.serverUrl=mt[i].url,h&&h.setValue(r.serverUrl).setDisabled(c!=="custom"),u&&this.configureCheckDelay(u,i),await this.notifyEndpointChange(r),await this.plugin.saveSettings()})}),a.addText(f=>{h=f,f.setPlaceholder("https://your-custom-url.com").setValue(r.serverUrl).setDisabled(i!=="custom").onChange(async c=>{r.serverUrl=c.replace(/\/v2\/check\/$/,"").replace(/\/$/,""),i=ze(r.serverUrl),i!=="custom"&&(l==null||l.setValue(i),h==null||h.setDisabled(!0)),await this.notifyEndpointChange(r),await this.plugin.saveSettings()})})}),new N.Setting(n).setName("API username").setDesc("Enter a username/mail for API access").addText(a=>a.setPlaceholder("peterlustig@example.com").setValue(r.username||"").onChange(async l=>{r.username=l.replace(/\s+/g,""),await this.plugin.saveSettings()})),new N.Setting(n).setName("API key").setDesc(createFragment(a=>{a.createEl("a",{text:"Click here for information about Premium Access",href:"https://github.com/wrenger/obsidian-languagetool#premium-accounts",attr:{target:"_blank"}})})).addText(a=>a.setValue(r.apikey||"").onChange(async l=>{r.apikey=l.replace(/\s+/g,""),r.apikey&&i!=="premium"&&new N.Notice("You have entered an API Key but you are not using the Premium Endpoint"),await this.plugin.saveSettings()})),new N.Setting(n).setName("Auto check text").setDesc("Check text as you type").addToggle(a=>{a.setValue(r.shouldAutoCheck).onChange(async l=>{r.shouldAutoCheck=l,await this.plugin.saveSettings()})}),new N.Setting(n).setName("Auto check delay (ms)").setDesc("Time to wait for autocheck after the last key press").addSlider(a=>{u=a,this.configureCheckDelay(a,i),a.setValue(r.autoCheckDelay).onChange(async l=>{r.autoCheckDelay=l,await this.plugin.saveSettings()}).setDynamicTooltip()});function o(a){if(a.appendText("Enables the context menu for synonyms fetched from"),a.createEl("br"),r.synonyms!=null){let l=ie.SYNONYMS[r.synonyms];if(!l){a.appendText(" (unknown API)");return}a.createEl("a",{text:l.url,href:l.url,attr:{target:"_blank"}})}else a.appendText("(none)")}let s=new N.Setting(n).setName("Find synonyms").setDesc(createFragment(o));s.addDropdown(a=>{var l;a.addOption("none","---");for(let h of Object.keys(ie.SYNONYMS))a.addOption(h,h);a.setValue((l=r.synonyms)!=null?l:"none").onChange(async h=>{r.synonyms=h!=="none"?h:void 0,await this.plugin.saveSettings(),s.setDesc(createFragment(o))})}),new N.Setting(n).setName("Language settings").setHeading(),new N.Setting(n).setName("Mother tongue").setDesc("Set mother tongue if you want to be warned about false friends when writing in other languages. This setting will also be used for automatic language detection.").addDropdown(a=>{this.languageListeners.push(async l=>{var h;for(;a.selectEl.options.length>0;)a.selectEl.remove(0);a.addOption("none","---").addOptions(Object.fromEntries(l.filter(f=>f.longCode==f.code).map(f=>[f.longCode,f.name]))).setValue((h=r.motherTongue)!=null?h:"none").onChange(async f=>{r.motherTongue=f!=="none"?f:void 0,await this.plugin.saveSettings()})})}),new N.Setting(n).setName("Static language").setDesc("Set a static language that will always be used (LanguageTool tries to auto detect the language, this is usually not necessary)").addDropdown(a=>{this.languageListeners.push(async l=>{var h;for(;a.selectEl.options.length>0;)a.selectEl.remove(0);a.addOption("auto","Auto Detect").addOptions(Object.fromEntries(l.map(f=>[f.longCode,f.name]))).setValue((h=r.staticLanguage)!=null?h:"auto").onChange(async f=>{r.staticLanguage=f!=="auto"?f:void 0,await this.plugin.saveSettings()})})}),new N.Setting(n).setName("Language varieties").setHeading().setDesc("Some languages have varieties depending on the country they are spoken in.");let p={en:"English",de:"German",pt:"Portuguese",ca:"Catalan"};for(let[a,l]of Object.entries(p))new N.Setting(n).setName(`Interpret ${l} as`).addDropdown(async h=>{this.configureLanguageVariants(h,a)});new N.Setting(n).setName("Spellcheck Dictionary").setHeading(),new N.Setting(n).setName("Ignored Words").setDesc("Words that should not be highlighted as spelling mistakes.").addButton(a=>{a.setIcon("settings").setTooltip("Edit dictionary").onClick(()=>{new Mn(this.app,this.plugin).open()})}),new N.Setting(n).setName("Sync with LanguageTool").setDesc("This is only supported for premium users.").addToggle(a=>{a.setDisabled(i!=="premium").setValue(r.syncDictionary).onChange(async l=>{r.syncDictionary=l,await this.plugin.syncDictionary()}),this.endpointListeners.push(async l=>{a.setDisabled(ze(l)!=="premium")})}),new N.Setting(n).setName("Rule categories").setHeading().setDesc(createFragment(a=>{a.appendText("The picky mode enables a lot of extra categories and rules. Additionally, you can enable or disable specific rules down below."),a.createEl("br"),a.createEl("a",{text:"Click here for a list of rules and categories",href:"https://community.languagetool.org/rule/list",attr:{target:"_blank"}})})),new N.Setting(n).setName("Picky mode").setDesc("Provides more style and tonality suggestions, detects long or complex sentences, recognizes colloquialism and redundancies, proactively suggests synonyms for commonly overused words").addToggle(a=>{a.setValue(r.pickyMode).onChange(async l=>{r.pickyMode=l,await this.plugin.saveSettings()})}),new N.Setting(n).setName("Enabled categories").setDesc("Comma-separated list of categories").addText(a=>{var l;return a.setPlaceholder("CATEGORY_1,CATEGORY_2").setValue((l=r.enabledCategories)!=null?l:"").onChange(async h=>{r.enabledCategories=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),new N.Setting(n).setName("Disabled categories").setDesc("Comma-separated list of categories").addText(a=>{var l;return a.setPlaceholder("CATEGORY_1,CATEGORY_2").setValue((l=r.disabledCategories)!=null?l:"").onChange(async h=>{r.disabledCategories=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),new N.Setting(n).setName("Enabled rules").setDesc("Comma-separated list of rules").addText(a=>{var l;return a.setPlaceholder("RULE_1,RULE_2").setValue((l=r.enabledRules)!=null?l:"").onChange(async h=>{r.enabledRules=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),new N.Setting(n).setName("Disabled rules").setDesc("Comma-separated list of rules").addText(a=>{var l;return a.setPlaceholder("RULE_1,RULE_2").setValue((l=r.disabledRules)!=null?l:"").onChange(async h=>{r.disabledRules=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),await this.notifyEndpointChange(r)}},Mn=class extends N.Modal{constructor(t,n){super(t),this.setTitle("Spellcheck dictionary"),this.plugin=n,this.words=n.settings.dictionary}async onOpen(){this.words=this.plugin.settings.dictionary;let{contentEl:t}=this,n=s=>{s.replaceChildren(...this.words.map(p=>s.createDiv({cls:"multi-select-pill"},a=>{a.createDiv({cls:"multi-select-pill-content"},l=>l.createSpan({text:p})),a.createDiv({cls:"multi-select-pill-remove-button"},l=>{l.appendChild((0,N.getIcon)("x")),l.onClickEvent(()=>{this.words.remove(p),n(s)})})})))},r=null;t.createDiv({cls:"multi-select-container"},s=>{r=s,n(s)}),this.plugin.syncDictionary().then(s=>{s&&(this.words=this.plugin.settings.dictionary,r&&n(r))});let i="",u=null,o=()=>{i&&(this.words=[...new Set([...this.words,i])].sort(Ke),r&&n(r),u&&u.setValue(""),i="")};new N.Setting(t).setName("Add").addText(s=>{u=s.setValue(i).onChange(p=>i=p.trim()),s.inputEl.addEventListener("keypress",p=>{p.key==="Enter"&&o()})}).addExtraButton(s=>{s.setIcon("plus").setTooltip("Add").onClick(()=>{o()})})}async onClose(){this.contentEl.empty(),this.plugin.settings.dictionary=this.words,await this.plugin.syncDictionary()}};var ki=require("@codemirror/view");var xi=require("@codemirror/view");function yi(e){let t=-1,n=1/0,r=-1/0;return xi.EditorView.updateListener.of(i=>{if(!i.docChanged||!e.settings.shouldAutoCheck)return;i.changes.iterChangedRanges((o,s,p,a)=>{n=Math.min(n,p,a),r=Math.max(r,p,a)});let u=i.view;clearTimeout(t),t=window.setTimeout(()=>{e.runDetection(u,{from:n,to:r}).catch(o=>{console.error(o)}),n=1/0,r=-1/0},e.settings.autoCheckDelay)})}var Ai=require("@codemirror/view"),Ci=require("@codemirror/state");var gt=require("obsidian");var Ze=require("@codemirror/view"),Me=require("@codemirror/state"),Xe=require("@codemirror/language");var Wo=/(frontmatter|code|math|templater|blockid|hashtag|internal)/,_t=Me.StateEffect.define(),dt=Me.StateEffect.define(),ve=Me.StateEffect.define(),zt=Me.StateEffect.define();function Ei(e,t){return e.from<=t.from&&t.from<=e.to||e.from<=t.to&&t.to<=e.to||t.from<=e.from&&e.from<=t.to||t.from<=e.to&&e.to<=t.to}var Be=Me.StateField.define({create(){return Ze.Decoration.none},update(e,t){e=e.map(t.changes);let n=new Set,r={},i=null,u=s=>{if(r[s]==null){i||(i=(0,Xe.syntaxTree)(t.state));let p=i.resolveInner(s,1).type.prop(Xe.tokenClassNodeProp);r[s]=!(p&&Wo.test(p))}return r[s]},o=s=>{i||(i=(0,Xe.syntaxTree)(t.state));let p=i.resolve(t.newDoc.lineAt(s.from).from,1).type.prop(Xe.tokenClassNodeProp);return!(p!=null&&p.includes("table")&&s.ruleId==="WHITESPACE_RULE")};t.docChanged&&t.selection&&e.size&&(e=e.update({filter:(s,p)=>!Ei({from:s,to:p},t.selection.main)}));for(let s of t.effects)if(s.is(_t)){let p=s.value,a=`${p.from},${p.to}`;!n.has(a)&&u(p.from)&&u(p.to)&&o(p)&&(n.add(a),e=e.update({add:[Ze.Decoration.mark({class:`lt-underline ${It(p.categoryId)}`,underline:p}).range(p.from,p.to)]}))}else s.is(dt)?e=Ze.Decoration.none:s.is(ve)?e=e.update({filterFrom:s.value.from,filterTo:s.value.to,filter:(p,a)=>!Ei({from:p,to:a},s.value)}):s.is(zt)&&(e=e.update({filter:(p,a,l)=>!s.value(l.spec.underline)}));return e},provide:e=>Ze.EditorView.decorations.from(e)});function Ko(e,t,n){let r=n.replacements.slice(0,Mt),i=n.categoryId,u=n.ruleId;return createDiv({cls:["lt-predictions-container",It(i)]},o=>{n.title&&o.createSpan({cls:"lt-title"},p=>{p.createSpan({text:n.title})}),n.message&&o.createSpan({cls:"lt-message",text:n.message});let s=ve.of({...n});o.createDiv({cls:"lt-bottom"},p=>{r.length&&p.createDiv({cls:"lt-buttoncontainer"},a=>{for(let l of r)a.createEl("button",{text:l||"(delete)"},h=>{h.onclick=()=>{t.dispatch({changes:[{from:n.from,to:n.to,insert:l}],effects:[s]})}})}),p.createDiv({cls:"lt-info-container"},a=>{a.createEl("button",{cls:"lt-info-button clickable-icon"},l=>{(0,gt.setIcon)(l,"info"),l.onclick=()=>{let h=document.getElementsByClassName("lt-info-box").item(0);if(!h)throw Error("Programming error: failed to create popup.");h.hasClass("hidden")?h.removeClass("hidden"):h.addClass("hidden")}}),a.createDiv({cls:"lt-info-box hidden"},l=>{l.createDiv({cls:"lt-info",text:`Category:\xA0${i}`}),l.createDiv({cls:"lt-info",text:`Rule:\xA0${u}`})})})}),o.createDiv({cls:"lt-ignorecontainer"},p=>{p.createEl("button",{cls:"lt-ignore-btn"},a=>{i==="TYPOS"?((0,gt.setIcon)(a.createSpan(),"plus-with-circle"),a.createSpan({text:"Add to personal dictionary"}),a.onclick=async()=>{e.settings.dictionary.push(n.text),await e.syncDictionary(),t.dispatch({effects:[zt.of(l=>l.text===n.text)]})}):((0,gt.setIcon)(a.createSpan(),"cross"),a.createSpan({text:"Ignore suggestion"}),a.onclick=()=>{t.dispatch({effects:[s]})})}),i!=="TYPOS"&&i!=="SYNONYMS"&&p.createEl("button",{cls:"lt-ignore-btn"},a=>{(0,gt.setIcon)(a.createSpan(),"circle-off"),a.createSpan({text:"Disable rule"}),a.onclick=()=>{e.settings.disabledRules?e.settings.disabledRules+=","+u:e.settings.disabledRules=u,e.saveSettings(),t.dispatch({effects:[zt.of(l=>l.ruleId===u)]})}})})})}function Fi(e,t,n){let r=n.field(Be);if(r.size===0||n.selection.ranges.length>1)return[];let i=null;if(r.between(n.selection.main.from,n.selection.main.to,(u,o,s)=>{i={...s.spec.underline,from:u,to:o}}),i!=null){let{from:u,to:o}=i;if(e.length){let s=e[0];if(s.pos===u&&s.end===o)return e}return[{pos:u,end:o,above:!0,strictSide:!1,arrow:!1,create:s=>({dom:Ko(t,s,i)})}]}return[]}function wi(e){return Ci.StateField.define({create:t=>Fi([],e,t),update:(t,n)=>Fi(t,e,n.state),provide:t=>Ai.showTooltip.computeN([t],n=>n.field(t))})}function bi(e){return[(0,ki.tooltips)({position:"absolute",tooltipSpace:t=>t.dom.getBoundingClientRect()}),Be,wi(e),yi(e)]}var Si=require("@codemirror/language");var Mt=5,vt=class extends ue.Plugin{constructor(){super(...arguments);this.isLoading=!1;this.logs=[]}async onload(){await this.loadSettings(),this.settingTab=new Rt(this.app,this),this.addSettingTab(this.settingTab),this.app.workspace.onLayoutReady(()=>{this.statusBarText=this.addStatusBarItem(),this.setStatusBarReady(),this.registerDomEvent(this.statusBarText,"click",()=>this.handleStatusBarClick())}),this.registerEditorExtension(bi(this)),this.registerCommands(),this.registerMenuItems();let n=new Set(this.settings.dictionary.map(r=>r.trim()));n.delete(""),this.settings.dictionary=[...n].sort(Ke),this.syncDictionary(),await this.saveSettings()}onunload(){this.logs=[],this.isLoading=!1}registerCommands(){this.addCommand({id:"check",name:"Check text",editorCallback:(n,r)=>{let i=n.cm;this.runDetection(i).catch(u=>{console.error(u)})}}),this.addCommand({id:"toggle-auto-check",name:"Toggle automatic checking",callback:async()=>{this.settings.shouldAutoCheck=!this.settings.shouldAutoCheck,await this.saveSettings()}}),this.addCommand({id:"clear",name:"Clear suggestions",editorCallback:n=>{n.cm.dispatch({effects:[dt.of(null)]})}}),this.addCommand({id:"accept-all",name:"Accept all suggestions",editorCallback:n=>{let r=n.cm,i=[],u=[];r.state.field(Be).between(0,1/0,(o,s,p)=>{var a,l,h;(h=(l=(a=p.spec)==null?void 0:a.underline)==null?void 0:l.replacements)!=null&&h.length&&(i.push({from:o,to:s,insert:p.spec.underline.replacements[0]}),u.push(ve.of({from:o,to:s})))}),r.dispatch({changes:i,effects:u})}}),this.addCommand({id:"next",name:"Jump to next suggestion",editorCheckCallback:(n,r)=>{let i=r.cm,u=r.posToOffset(r.getCursor()),o=null;if(i.state.field(Be).between(u+1,1/0,(s,p)=>{(!o||o.from>s)&&(o={from:s,to:p})}),n)return o!=null;o!=null&&i.dispatch({selection:{anchor:o.from,head:o.to}})}});for(let n=1;n<=Mt;n++)this.addCommand(this.applySuggestionCommand(n));this.addCommand({id:"synonyms",name:"Show synonyms",editorCheckCallback:(n,r)=>this.showSynonyms(r,n)})}applySuggestionCommand(n){return{id:`accept-${n}`,name:`Accept suggestion ${n}`,editorCheckCallback(r,i){var c,F,g;let u=i.cm,o=i.posToOffset(i.getCursor()),s=[];u.state.field(Be).between(o,o,(C,y,b)=>{s.push({from:C,to:y,value:b})});let p=s.length===1&&((g=(F=(c=s[0].value.spec)==null?void 0:c.underline)==null?void 0:F.replacements)==null?void 0:g.length)>=n;if(r)return p;if(!p)return;let{from:a,to:l,value:h}=s[0],f={from:a,to:l,insert:h.spec.underline.replacements[n-1]};u.dispatch({changes:[f],effects:[ve.of({from:a,to:l})]})}}}registerMenuItems(){this.registerEvent(this.app.workspace.on("editor-menu",(n,r,i)=>{this.showSynonyms(r,!0)&&n.addItem(u=>{u.setTitle("Synonyms"),u.setIcon("square-stack"),u.onClick(()=>this.showSynonyms(r))})}))}showSynonyms(n,r=!1){if(!this.settings.synonyms||!(this.settings.synonyms in ie.SYNONYMS))return!1;let i=ie.SYNONYMS[this.settings.synonyms];if(!i)return!1;let u=n.cm,o=u.state.selection.main;if(o.empty)return!1;let s=u.state.sliceDoc(u.state.selection.main.from,u.state.selection.main.to);if(s.match(/[\s\.]/))return!1;if(r)return!0;let p=u.state.doc.lineAt(o.from),a=p.text.slice(0,o.from-p.from).lastIndexOf(".")+1,l=p.text.slice(a),h=l.trimStart(),f=p.from+a+l.length-h.length,c={from:o.from-f,to:o.to-f};h=h.trimEnd();let F=h.indexOf(".");return F!==-1&&(h=h.slice(0,F+1)),i.query(h,c).then(g=>u.dispatch({effects:[_t.of({text:s,from:o.from,to:o.to,title:"Synonyms",message:"",categoryId:"SYNONYMS",ruleId:"SYNONYMS",replacements:g})]})).catch(g=>{console.error(g),this.pushLogs(g),new ue.Notice(g.message,3e4)}),!0}setStatusBarReady(){this.isLoading=!1,this.statusBarText.empty(),this.statusBarText.createSpan({cls:"lt-status-bar-btn"},n=>{n.createSpan({cls:"lt-status-bar-check-icon",text:"Aa"})})}setStatusBarWorking(){this.isLoading||(this.isLoading=!0,this.statusBarText.empty(),this.statusBarText.createSpan({cls:["lt-status-bar-btn","lt-loading"]},n=>{(0,ue.setIcon)(n,"sync-small")}))}handleStatusBarClick(){var i;let n=(i=this.statusBarText.parentElement)==null?void 0:i.getBoundingClientRect(),r=this.statusBarText.getBoundingClientRect();new ue.Menu().addItem(u=>{u.setTitle("Check text"),u.setIcon("checkbox-glyph"),u.onClick(async()=>{let o=this.app.workspace.getActiveViewOfType(ue.MarkdownView);if(o&&o.getMode()==="source"){let s=o.editor.cm;await this.runDetection(s)}})}).addItem(u=>{u.setTitle(this.settings.shouldAutoCheck?"Disable automatic checking":"Enable automatic checking"),u.setIcon("uppercase-lowercase-a"),u.onClick(async()=>{this.settings.shouldAutoCheck=!this.settings.shouldAutoCheck,await this.saveSettings()})}).addItem(u=>{u.setTitle("Clear suggestions"),u.setIcon("reset"),u.onClick(()=>{let o=this.app.workspace.getActiveViewOfType(ue.MarkdownView);if(!o)return;o.editor.cm.dispatch({effects:[dt.of(null)]})})}).showAtPosition({x:r.right+5,y:((n==null?void 0:n.top)||0)-5})}async runDetection(n,r){var f;let i=this.app.workspace.getActiveFile(),u=i&&this.app.metadataCache.getFileCache(i),o=(f=u==null?void 0:u.frontmatter)==null?void 0:f.lt_language,s=n.state.selection.main;!r&&!s.empty&&(r={...s});let p=0,a="";if(r?(r=Zo(n,r),p=r.from,a=n.state.sliceDoc(r.from,r.to)):a=n.state.sliceDoc(0),!a.trim())return;let l;try{this.setStatusBarWorking(),l=await ie.check(this.settings,p,a,o)}catch(c){console.error(c),c instanceof Error&&(this.pushLogs(c),new ue.Notice(c.message,3e4));return}finally{this.setStatusBarReady()}let h=[];if(r?h.push(ve.of(r)):h.push(dt.of(null)),l){let c=this.settings.dictionary;for(let F of l)F.to>n.state.doc.length||F.categoryId==="TYPOS"&&c.includes(F.text)||h.push(_t.of(F))}h.length&&n.dispatch({effects:h})}async pushLogs(n){let r=`${new Date().toLocaleString()}:
|
|
Error: '${n.message}'
|
|
Settings: ${JSON.stringify({...this.settings,username:"REDACTED",apikey:"REDACTED"})}
|
|
`;this.settings.username&&(r=r.replaceAll(this.settings.username,"<<username>>")),this.settings.apikey&&(r=r.replaceAll(this.settings.apikey,"<<username>>")),this.logs.push(r),this.logs.length>10&&this.logs.shift()}async loadSettings(){this.settings=Object.assign({},gi,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onExternalSettingsChange(){this.settingTab.notifyEndpointChange(this.settings)}async syncDictionary(){if(!this.settings.syncDictionary||ze(this.settings.serverUrl)!=="premium")return await this.saveSettings(),!1;try{let n=new Set(this.settings.remoteDictionary),r=new Set(this.settings.dictionary),i=new Set(await ie.words(this.settings)),u=We(n,r);u=fi(u,i);for(let h of u)await ie.wordsDel(this.settings,h);let o=We(n,i);i=We(i,u),r=We(r,o);let s=We(r,i);for(let h of s)await ie.wordsAdd(this.settings,h);let p=hi(i,r),l=new Set(this.settings.dictionary).size!==p.size;return this.settings.dictionary=[...p].sort(Ke),this.settings.remoteDictionary=[...p].sort(Ke),await this.saveSettings(),l}catch(n){this.pushLogs(n),new ue.Notice(n.message,3e4),console.error("Failed sync spellcheck with LanguageTool",n)}return await this.saveSettings(),!1}};function Zo(e,t){let n=null;if(t.from>0){n=(0,Si.syntaxTree)(e.state);let r=n.resolveInner(t.from,-1);r.type.name.startsWith("list-")?t.from=r.from:t.from=e.state.doc.lineAt(t.from).from}else t.from=0;return t.to<e.state.doc.length?t.to=e.state.doc.lineAt(t.to).to:t.to=e.state.doc.length,t}
|
|
/*! Bundled license information:
|
|
|
|
is-buffer/index.js:
|
|
(*!
|
|
* Determine if an object is a Buffer
|
|
*
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
* @license MIT
|
|
*)
|
|
*/
|
|
|
|
/* nosourcemap */ |