mirror of
https://github.com/logos-storage/logos-storage-docs-obsidian.git
synced 2026-05-18 15:19:33 +00:00
92 lines
594 KiB
JavaScript
92 lines
594 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 at https://github.com/Fevol/obsidian-translate
|
|
|
|
Commentator — 0.2.6 [PRODUCTION BUILD]
|
|
Author: kometenstaub and Fevol
|
|
Version: 0.2.6
|
|
Time: Sat, 20 Dec 2025 18:16:05 GMT
|
|
|
|
=======================================================
|
|
*/
|
|
|
|
"use strict";var l0=Object.create;var Ba=Object.defineProperty;var c0=Object.getOwnPropertyDescriptor;var f0=Object.getOwnPropertyNames;var d0=Object.getPrototypeOf,h0=Object.prototype.hasOwnProperty;var Fa=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),p0=(r,e)=>{for(var t in e)Ba(r,t,{get:e[t],enumerable:!0})},gd=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f0(e))!h0.call(r,i)&&i!==t&&Ba(r,i,{get:()=>e[i],enumerable:!(n=c0(e,i))||n.enumerable});return r};var za=(r,e,t)=>(t=r!=null?l0(d0(r)):{},gd(e||!r||!r.__esModule?Ba(t,"default",{value:r,enumerable:!0}):t,r)),m0=r=>gd(Ba({},"__esModule",{value:!0}),r);var Ih=Fa((Yk,Vs)=>{var Q=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},it=-1,ut=1,Ie=0;Q.Diff=function(r,e){return[r,e]};Q.prototype.diff_main=function(r,e,t,n){typeof n>"u"&&(this.Diff_Timeout<=0?n=Number.MAX_VALUE:n=new Date().getTime()+this.Diff_Timeout*1e3);var i=n;if(r==null||e==null)throw new Error("Null input. (diff_main)");if(r==e)return r?[new Q.Diff(Ie,r)]:[];typeof t>"u"&&(t=!0);var s=t,o=this.diff_commonPrefix(r,e),a=r.substring(0,o);r=r.substring(o),e=e.substring(o),o=this.diff_commonSuffix(r,e);var u=r.substring(r.length-o);r=r.substring(0,r.length-o),e=e.substring(0,e.length-o);var l=this.diff_compute_(r,e,s,i);return a&&l.unshift(new Q.Diff(Ie,a)),u&&l.push(new Q.Diff(Ie,u)),this.diff_cleanupMerge(l),l};Q.prototype.diff_compute_=function(r,e,t,n){var i;if(!r)return[new Q.Diff(ut,e)];if(!e)return[new Q.Diff(it,r)];var s=r.length>e.length?r:e,o=r.length>e.length?e:r,a=s.indexOf(o);if(a!=-1)return i=[new Q.Diff(ut,s.substring(0,a)),new Q.Diff(Ie,o),new Q.Diff(ut,s.substring(a+o.length))],r.length>e.length&&(i[0][0]=i[2][0]=it),i;if(o.length==1)return[new Q.Diff(it,r),new Q.Diff(ut,e)];var u=this.diff_halfMatch_(r,e);if(u){var l=u[0],d=u[1],c=u[2],f=u[3],p=u[4],m=this.diff_main(l,c,t,n),g=this.diff_main(d,f,t,n);return m.concat([new Q.Diff(Ie,p)],g)}return t&&r.length>100&&e.length>100?this.diff_lineMode_(r,e,n):this.diff_bisect_(r,e,n)};Q.prototype.diff_lineMode_=function(r,e,t){var n=this.diff_linesToChars_(r,e);r=n.chars1,e=n.chars2;var i=n.lineArray,s=this.diff_main(r,e,!1,t);this.diff_charsToLines_(s,i),this.diff_cleanupSemantic(s),s.push(new Q.Diff(Ie,""));for(var o=0,a=0,u=0,l="",d="";o<s.length;){switch(s[o][0]){case ut:u++,d+=s[o][1];break;case it:a++,l+=s[o][1];break;case Ie:if(a>=1&&u>=1){s.splice(o-a-u,a+u),o=o-a-u;for(var c=this.diff_main(l,d,!1,t),f=c.length-1;f>=0;f--)s.splice(o,0,c[f]);o=o+c.length}u=0,a=0,l="",d="";break}o++}return s.pop(),s};Q.prototype.diff_bisect_=function(r,e,t){for(var n=r.length,i=e.length,s=Math.ceil((n+i)/2),o=s,a=2*s,u=new Array(a),l=new Array(a),d=0;d<a;d++)u[d]=-1,l[d]=-1;u[o+1]=0,l[o+1]=0;for(var c=n-i,f=c%2!=0,p=0,m=0,g=0,_=0,v=0;v<s&&!(new Date().getTime()>t);v++){for(var k=-v+p;k<=v-m;k+=2){var S=o+k,T;k==-v||k!=v&&u[S-1]<u[S+1]?T=u[S+1]:T=u[S-1]+1;for(var E=T-k;T<n&&E<i&&r.charAt(T)==e.charAt(E);)T++,E++;if(u[S]=T,T>n)m+=2;else if(E>i)p+=2;else if(f){var y=o+c-k;if(y>=0&&y<a&&l[y]!=-1){var x=n-l[y];if(T>=x)return this.diff_bisectSplit_(r,e,T,E,t)}}}for(var M=-v+g;M<=v-_;M+=2){var y=o+M,x;M==-v||M!=v&&l[y-1]<l[y+1]?x=l[y+1]:x=l[y-1]+1;for(var A=x-M;x<n&&A<i&&r.charAt(n-x-1)==e.charAt(i-A-1);)x++,A++;if(l[y]=x,x>n)_+=2;else if(A>i)g+=2;else if(!f){var S=o+c-M;if(S>=0&&S<a&&u[S]!=-1){var T=u[S],E=o+T-S;if(x=n-x,T>=x)return this.diff_bisectSplit_(r,e,T,E,t)}}}}return[new Q.Diff(it,r),new Q.Diff(ut,e)]};Q.prototype.diff_bisectSplit_=function(r,e,t,n,i){var s=r.substring(0,t),o=e.substring(0,n),a=r.substring(t),u=e.substring(n),l=this.diff_main(s,o,!1,i),d=this.diff_main(a,u,!1,i);return l.concat(d)};Q.prototype.diff_linesToChars_=function(r,e){var t=[],n={};t[0]="";function i(u){for(var l="",d=0,c=-1,f=t.length;c<u.length-1;){c=u.indexOf(`
|
|
`,d),c==-1&&(c=u.length-1);var p=u.substring(d,c+1);(n.hasOwnProperty?n.hasOwnProperty(p):n[p]!==void 0)?l+=String.fromCharCode(n[p]):(f==s&&(p=u.substring(d),c=u.length),l+=String.fromCharCode(f),n[p]=f,t[f++]=p),d=c+1}return l}var s=4e4,o=i(r);s=65535;var a=i(e);return{chars1:o,chars2:a,lineArray:t}};Q.prototype.diff_charsToLines_=function(r,e){for(var t=0;t<r.length;t++){for(var n=r[t][1],i=[],s=0;s<n.length;s++)i[s]=e[n.charCodeAt(s)];r[t][1]=i.join("")}};Q.prototype.diff_commonPrefix=function(r,e){if(!r||!e||r.charAt(0)!=e.charAt(0))return 0;for(var t=0,n=Math.min(r.length,e.length),i=n,s=0;t<i;)r.substring(s,i)==e.substring(s,i)?(t=i,s=t):n=i,i=Math.floor((n-t)/2+t);return i};Q.prototype.diff_commonSuffix=function(r,e){if(!r||!e||r.charAt(r.length-1)!=e.charAt(e.length-1))return 0;for(var t=0,n=Math.min(r.length,e.length),i=n,s=0;t<i;)r.substring(r.length-i,r.length-s)==e.substring(e.length-i,e.length-s)?(t=i,s=t):n=i,i=Math.floor((n-t)/2+t);return i};Q.prototype.diff_commonOverlap_=function(r,e){var t=r.length,n=e.length;if(t==0||n==0)return 0;t>n?r=r.substring(t-n):t<n&&(e=e.substring(0,t));var i=Math.min(t,n);if(r==e)return i;for(var s=0,o=1;;){var a=r.substring(i-o),u=e.indexOf(a);if(u==-1)return s;o+=u,(u==0||r.substring(i-o)==e.substring(0,o))&&(s=o,o++)}};Q.prototype.diff_halfMatch_=function(r,e){if(this.Diff_Timeout<=0)return null;var t=r.length>e.length?r:e,n=r.length>e.length?e:r;if(t.length<4||n.length*2<t.length)return null;var i=this;function s(m,g,_){for(var v=m.substring(_,_+Math.floor(m.length/4)),k=-1,S="",T,E,y,x;(k=g.indexOf(v,k+1))!=-1;){var M=i.diff_commonPrefix(m.substring(_),g.substring(k)),A=i.diff_commonSuffix(m.substring(0,_),g.substring(0,k));S.length<A+M&&(S=g.substring(k-A,k)+g.substring(k,k+M),T=m.substring(0,_-A),E=m.substring(_+M),y=g.substring(0,k-A),x=g.substring(k+M))}return S.length*2>=m.length?[T,E,y,x,S]:null}var o=s(t,n,Math.ceil(t.length/4)),a=s(t,n,Math.ceil(t.length/2)),u;if(!o&&!a)return null;a?o?u=o[4].length>a[4].length?o:a:u=a:u=o;var l,d,c,f;r.length>e.length?(l=u[0],d=u[1],c=u[2],f=u[3]):(c=u[0],f=u[1],l=u[2],d=u[3]);var p=u[4];return[l,d,c,f,p]};Q.prototype.diff_cleanupSemantic=function(r){for(var e=!1,t=[],n=0,i=null,s=0,o=0,a=0,u=0,l=0;s<r.length;)r[s][0]==Ie?(t[n++]=s,o=u,a=l,u=0,l=0,i=r[s][1]):(r[s][0]==ut?u+=r[s][1].length:l+=r[s][1].length,i&&i.length<=Math.max(o,a)&&i.length<=Math.max(u,l)&&(r.splice(t[n-1],0,new Q.Diff(it,i)),r[t[n-1]+1][0]=ut,n--,n--,s=n>0?t[n-1]:-1,o=0,a=0,u=0,l=0,i=null,e=!0)),s++;for(e&&this.diff_cleanupMerge(r),this.diff_cleanupSemanticLossless(r),s=1;s<r.length;){if(r[s-1][0]==it&&r[s][0]==ut){var d=r[s-1][1],c=r[s][1],f=this.diff_commonOverlap_(d,c),p=this.diff_commonOverlap_(c,d);f>=p?(f>=d.length/2||f>=c.length/2)&&(r.splice(s,0,new Q.Diff(Ie,c.substring(0,f))),r[s-1][1]=d.substring(0,d.length-f),r[s+1][1]=c.substring(f),s++):(p>=d.length/2||p>=c.length/2)&&(r.splice(s,0,new Q.Diff(Ie,d.substring(0,p))),r[s-1][0]=ut,r[s-1][1]=c.substring(0,c.length-p),r[s+1][0]=it,r[s+1][1]=d.substring(p),s++),s++}s++}};Q.prototype.diff_cleanupSemanticLossless=function(r){function e(p,m){if(!p||!m)return 6;var g=p.charAt(p.length-1),_=m.charAt(0),v=g.match(Q.nonAlphaNumericRegex_),k=_.match(Q.nonAlphaNumericRegex_),S=v&&g.match(Q.whitespaceRegex_),T=k&&_.match(Q.whitespaceRegex_),E=S&&g.match(Q.linebreakRegex_),y=T&&_.match(Q.linebreakRegex_),x=E&&p.match(Q.blanklineEndRegex_),M=y&&m.match(Q.blanklineStartRegex_);return x||M?5:E||y?4:v&&!S&&T?3:S||T?2:v||k?1:0}for(var t=1;t<r.length-1;){if(r[t-1][0]==Ie&&r[t+1][0]==Ie){var n=r[t-1][1],i=r[t][1],s=r[t+1][1],o=this.diff_commonSuffix(n,i);if(o){var a=i.substring(i.length-o);n=n.substring(0,n.length-o),i=a+i.substring(0,i.length-o),s=a+s}for(var u=n,l=i,d=s,c=e(n,i)+e(i,s);i.charAt(0)===s.charAt(0);){n+=i.charAt(0),i=i.substring(1)+s.charAt(0),s=s.substring(1);var f=e(n,i)+e(i,s);f>=c&&(c=f,u=n,l=i,d=s)}r[t-1][1]!=u&&(u?r[t-1][1]=u:(r.splice(t-1,1),t--),r[t][1]=l,d?r[t+1][1]=d:(r.splice(t+1,1),t--))}t++}};Q.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;Q.whitespaceRegex_=/\s/;Q.linebreakRegex_=/[\r\n]/;Q.blanklineEndRegex_=/\n\r?\n$/;Q.blanklineStartRegex_=/^\r?\n\r?\n/;Q.prototype.diff_cleanupEfficiency=function(r){for(var e=!1,t=[],n=0,i=null,s=0,o=!1,a=!1,u=!1,l=!1;s<r.length;)r[s][0]==Ie?(r[s][1].length<this.Diff_EditCost&&(u||l)?(t[n++]=s,o=u,a=l,i=r[s][1]):(n=0,i=null),u=l=!1):(r[s][0]==it?l=!0:u=!0,i&&(o&&a&&u&&l||i.length<this.Diff_EditCost/2&&o+a+u+l==3)&&(r.splice(t[n-1],0,new Q.Diff(it,i)),r[t[n-1]+1][0]=ut,n--,i=null,o&&a?(u=l=!0,n=0):(n--,s=n>0?t[n-1]:-1,u=l=!1),e=!0)),s++;e&&this.diff_cleanupMerge(r)};Q.prototype.diff_cleanupMerge=function(r){r.push(new Q.Diff(Ie,""));for(var e=0,t=0,n=0,i="",s="",o;e<r.length;)switch(r[e][0]){case ut:n++,s+=r[e][1],e++;break;case it:t++,i+=r[e][1],e++;break;case Ie:t+n>1?(t!==0&&n!==0&&(o=this.diff_commonPrefix(s,i),o!==0&&(e-t-n>0&&r[e-t-n-1][0]==Ie?r[e-t-n-1][1]+=s.substring(0,o):(r.splice(0,0,new Q.Diff(Ie,s.substring(0,o))),e++),s=s.substring(o),i=i.substring(o)),o=this.diff_commonSuffix(s,i),o!==0&&(r[e][1]=s.substring(s.length-o)+r[e][1],s=s.substring(0,s.length-o),i=i.substring(0,i.length-o))),e-=t+n,r.splice(e,t+n),i.length&&(r.splice(e,0,new Q.Diff(it,i)),e++),s.length&&(r.splice(e,0,new Q.Diff(ut,s)),e++),e++):e!==0&&r[e-1][0]==Ie?(r[e-1][1]+=r[e][1],r.splice(e,1)):e++,n=0,t=0,i="",s="";break}r[r.length-1][1]===""&&r.pop();var a=!1;for(e=1;e<r.length-1;)r[e-1][0]==Ie&&r[e+1][0]==Ie&&(r[e][1].substring(r[e][1].length-r[e-1][1].length)==r[e-1][1]?(r[e][1]=r[e-1][1]+r[e][1].substring(0,r[e][1].length-r[e-1][1].length),r[e+1][1]=r[e-1][1]+r[e+1][1],r.splice(e-1,1),a=!0):r[e][1].substring(0,r[e+1][1].length)==r[e+1][1]&&(r[e-1][1]+=r[e+1][1],r[e][1]=r[e][1].substring(r[e+1][1].length)+r[e+1][1],r.splice(e+1,1),a=!0)),e++;a&&this.diff_cleanupMerge(r)};Q.prototype.diff_xIndex=function(r,e){var t=0,n=0,i=0,s=0,o;for(o=0;o<r.length&&(r[o][0]!==ut&&(t+=r[o][1].length),r[o][0]!==it&&(n+=r[o][1].length),!(t>e));o++)i=t,s=n;return r.length!=o&&r[o][0]===it?s:s+(e-i)};Q.prototype.diff_prettyHtml=function(r){for(var e=[],t=/&/g,n=/</g,i=/>/g,s=/\n/g,o=0;o<r.length;o++){var a=r[o][0],u=r[o][1],l=u.replace(t,"&").replace(n,"<").replace(i,">").replace(s,"¶<br>");switch(a){case ut:e[o]='<ins style="background:#e6ffe6;">'+l+"</ins>";break;case it:e[o]='<del style="background:#ffe6e6;">'+l+"</del>";break;case Ie:e[o]="<span>"+l+"</span>";break}}return e.join("")};Q.prototype.diff_text1=function(r){for(var e=[],t=0;t<r.length;t++)r[t][0]!==ut&&(e[t]=r[t][1]);return e.join("")};Q.prototype.diff_text2=function(r){for(var e=[],t=0;t<r.length;t++)r[t][0]!==it&&(e[t]=r[t][1]);return e.join("")};Q.prototype.diff_levenshtein=function(r){for(var e=0,t=0,n=0,i=0;i<r.length;i++){var s=r[i][0],o=r[i][1];switch(s){case ut:t+=o.length;break;case it:n+=o.length;break;case Ie:e+=Math.max(t,n),t=0,n=0;break}}return e+=Math.max(t,n),e};Q.prototype.diff_toDelta=function(r){for(var e=[],t=0;t<r.length;t++)switch(r[t][0]){case ut:e[t]="+"+encodeURI(r[t][1]);break;case it:e[t]="-"+r[t][1].length;break;case Ie:e[t]="="+r[t][1].length;break}return e.join(" ").replace(/%20/g," ")};Q.prototype.diff_fromDelta=function(r,e){for(var t=[],n=0,i=0,s=e.split(/\t/g),o=0;o<s.length;o++){var a=s[o].substring(1);switch(s[o].charAt(0)){case"+":try{t[n++]=new Q.Diff(ut,decodeURI(a))}catch{throw new Error("Illegal escape in diff_fromDelta: "+a)}break;case"-":case"=":var u=parseInt(a,10);if(isNaN(u)||u<0)throw new Error("Invalid number in diff_fromDelta: "+a);var l=r.substring(i,i+=u);s[o].charAt(0)=="="?t[n++]=new Q.Diff(Ie,l):t[n++]=new Q.Diff(it,l);break;default:if(s[o])throw new Error("Invalid diff operation in diff_fromDelta: "+s[o])}}if(i!=r.length)throw new Error("Delta length ("+i+") does not equal source text length ("+r.length+").");return t};Q.prototype.match_main=function(r,e,t){if(r==null||e==null||t==null)throw new Error("Null input. (match_main)");return t=Math.max(0,Math.min(t,r.length)),r==e?0:r.length?r.substring(t,t+e.length)==e?t:this.match_bitap_(r,e,t):-1};Q.prototype.match_bitap_=function(r,e,t){if(e.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var n=this.match_alphabet_(e),i=this;function s(T,E){var y=T/e.length,x=Math.abs(t-E);return i.Match_Distance?y+x/i.Match_Distance:x?1:y}var o=this.Match_Threshold,a=r.indexOf(e,t);a!=-1&&(o=Math.min(s(0,a),o),a=r.lastIndexOf(e,t+e.length),a!=-1&&(o=Math.min(s(0,a),o)));var u=1<<e.length-1;a=-1;for(var l,d,c=e.length+r.length,f,p=0;p<e.length;p++){for(l=0,d=c;l<d;)s(p,t+d)<=o?l=d:c=d,d=Math.floor((c-l)/2+l);c=d;var m=Math.max(1,t-d+1),g=Math.min(t+d,r.length)+e.length,_=Array(g+2);_[g+1]=(1<<p)-1;for(var v=g;v>=m;v--){var k=n[r.charAt(v-1)];if(p===0?_[v]=(_[v+1]<<1|1)&k:_[v]=(_[v+1]<<1|1)&k|((f[v+1]|f[v])<<1|1)|f[v+1],_[v]&u){var S=s(p,v-1);if(S<=o)if(o=S,a=v-1,a>t)m=Math.max(1,2*t-a);else break}}if(s(p+1,t)>o)break;f=_}return a};Q.prototype.match_alphabet_=function(r){for(var e={},t=0;t<r.length;t++)e[r.charAt(t)]=0;for(var t=0;t<r.length;t++)e[r.charAt(t)]|=1<<r.length-t-1;return e};Q.prototype.patch_addContext_=function(r,e){if(e.length!=0){if(r.start2===null)throw Error("patch not initialized");for(var t=e.substring(r.start2,r.start2+r.length1),n=0;e.indexOf(t)!=e.lastIndexOf(t)&&t.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)n+=this.Patch_Margin,t=e.substring(r.start2-n,r.start2+r.length1+n);n+=this.Patch_Margin;var i=e.substring(r.start2-n,r.start2);i&&r.diffs.unshift(new Q.Diff(Ie,i));var s=e.substring(r.start2+r.length1,r.start2+r.length1+n);s&&r.diffs.push(new Q.Diff(Ie,s)),r.start1-=i.length,r.start2-=i.length,r.length1+=i.length+s.length,r.length2+=i.length+s.length}};Q.prototype.patch_make=function(r,e,t){var n,i;if(typeof r=="string"&&typeof e=="string"&&typeof t>"u")n=r,i=this.diff_main(n,e,!0),i.length>2&&(this.diff_cleanupSemantic(i),this.diff_cleanupEfficiency(i));else if(r&&typeof r=="object"&&typeof e>"u"&&typeof t>"u")i=r,n=this.diff_text1(i);else if(typeof r=="string"&&e&&typeof e=="object"&&typeof t>"u")n=r,i=e;else if(typeof r=="string"&&typeof e=="string"&&t&&typeof t=="object")n=r,i=t;else throw new Error("Unknown call format to patch_make.");if(i.length===0)return[];for(var s=[],o=new Q.patch_obj,a=0,u=0,l=0,d=n,c=n,f=0;f<i.length;f++){var p=i[f][0],m=i[f][1];switch(!a&&p!==Ie&&(o.start1=u,o.start2=l),p){case ut:o.diffs[a++]=i[f],o.length2+=m.length,c=c.substring(0,l)+m+c.substring(l);break;case it:o.length1+=m.length,o.diffs[a++]=i[f],c=c.substring(0,l)+c.substring(l+m.length);break;case Ie:m.length<=2*this.Patch_Margin&&a&&i.length!=f+1?(o.diffs[a++]=i[f],o.length1+=m.length,o.length2+=m.length):m.length>=2*this.Patch_Margin&&a&&(this.patch_addContext_(o,d),s.push(o),o=new Q.patch_obj,a=0,d=c,u=l);break}p!==ut&&(u+=m.length),p!==it&&(l+=m.length)}return a&&(this.patch_addContext_(o,d),s.push(o)),s};Q.prototype.patch_deepCopy=function(r){for(var e=[],t=0;t<r.length;t++){var n=r[t],i=new Q.patch_obj;i.diffs=[];for(var s=0;s<n.diffs.length;s++)i.diffs[s]=new Q.Diff(n.diffs[s][0],n.diffs[s][1]);i.start1=n.start1,i.start2=n.start2,i.length1=n.length1,i.length2=n.length2,e[t]=i}return e};Q.prototype.patch_apply=function(r,e){if(r.length==0)return[e,[]];r=this.patch_deepCopy(r);var t=this.patch_addPadding(r);e=t+e+t,this.patch_splitMax(r);for(var n=0,i=[],s=0;s<r.length;s++){var o=r[s].start2+n,a=this.diff_text1(r[s].diffs),u,l=-1;if(a.length>this.Match_MaxBits?(u=this.match_main(e,a.substring(0,this.Match_MaxBits),o),u!=-1&&(l=this.match_main(e,a.substring(a.length-this.Match_MaxBits),o+a.length-this.Match_MaxBits),(l==-1||u>=l)&&(u=-1))):u=this.match_main(e,a,o),u==-1)i[s]=!1,n-=r[s].length2-r[s].length1;else{i[s]=!0,n=u-o;var d;if(l==-1?d=e.substring(u,u+a.length):d=e.substring(u,l+this.Match_MaxBits),a==d)e=e.substring(0,u)+this.diff_text2(r[s].diffs)+e.substring(u+a.length);else{var c=this.diff_main(a,d,!1);if(a.length>this.Match_MaxBits&&this.diff_levenshtein(c)/a.length>this.Patch_DeleteThreshold)i[s]=!1;else{this.diff_cleanupSemanticLossless(c);for(var f=0,p,m=0;m<r[s].diffs.length;m++){var g=r[s].diffs[m];g[0]!==Ie&&(p=this.diff_xIndex(c,f)),g[0]===ut?e=e.substring(0,u+p)+g[1]+e.substring(u+p):g[0]===it&&(e=e.substring(0,u+p)+e.substring(u+this.diff_xIndex(c,f+g[1].length))),g[0]!==it&&(f+=g[1].length)}}}}}return e=e.substring(t.length,e.length-t.length),[e,i]};Q.prototype.patch_addPadding=function(r){for(var e=this.Patch_Margin,t="",n=1;n<=e;n++)t+=String.fromCharCode(n);for(var n=0;n<r.length;n++)r[n].start1+=e,r[n].start2+=e;var i=r[0],s=i.diffs;if(s.length==0||s[0][0]!=Ie)s.unshift(new Q.Diff(Ie,t)),i.start1-=e,i.start2-=e,i.length1+=e,i.length2+=e;else if(e>s[0][1].length){var o=e-s[0][1].length;s[0][1]=t.substring(s[0][1].length)+s[0][1],i.start1-=o,i.start2-=o,i.length1+=o,i.length2+=o}if(i=r[r.length-1],s=i.diffs,s.length==0||s[s.length-1][0]!=Ie)s.push(new Q.Diff(Ie,t)),i.length1+=e,i.length2+=e;else if(e>s[s.length-1][1].length){var o=e-s[s.length-1][1].length;s[s.length-1][1]+=t.substring(0,o),i.length1+=o,i.length2+=o}return t};Q.prototype.patch_splitMax=function(r){for(var e=this.Match_MaxBits,t=0;t<r.length;t++)if(!(r[t].length1<=e)){var n=r[t];r.splice(t--,1);for(var i=n.start1,s=n.start2,o="";n.diffs.length!==0;){var a=new Q.patch_obj,u=!0;for(a.start1=i-o.length,a.start2=s-o.length,o!==""&&(a.length1=a.length2=o.length,a.diffs.push(new Q.Diff(Ie,o)));n.diffs.length!==0&&a.length1<e-this.Patch_Margin;){var l=n.diffs[0][0],d=n.diffs[0][1];l===ut?(a.length2+=d.length,s+=d.length,a.diffs.push(n.diffs.shift()),u=!1):l===it&&a.diffs.length==1&&a.diffs[0][0]==Ie&&d.length>2*e?(a.length1+=d.length,i+=d.length,u=!1,a.diffs.push(new Q.Diff(l,d)),n.diffs.shift()):(d=d.substring(0,e-a.length1-this.Patch_Margin),a.length1+=d.length,i+=d.length,l===Ie?(a.length2+=d.length,s+=d.length):u=!1,a.diffs.push(new Q.Diff(l,d)),d==n.diffs[0][1]?n.diffs.shift():n.diffs[0][1]=n.diffs[0][1].substring(d.length))}o=this.diff_text2(a.diffs),o=o.substring(o.length-this.Patch_Margin);var c=this.diff_text1(n.diffs).substring(0,this.Patch_Margin);c!==""&&(a.length1+=c.length,a.length2+=c.length,a.diffs.length!==0&&a.diffs[a.diffs.length-1][0]===Ie?a.diffs[a.diffs.length-1][1]+=c:a.diffs.push(new Q.Diff(Ie,c))),u||r.splice(++t,0,a)}}};Q.prototype.patch_toText=function(r){for(var e=[],t=0;t<r.length;t++)e[t]=r[t];return e.join("")};Q.prototype.patch_fromText=function(r){var e=[];if(!r)return e;for(var t=r.split(`
|
|
`),n=0,i=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;n<t.length;){var s=t[n].match(i);if(!s)throw new Error("Invalid patch string: "+t[n]);var o=new Q.patch_obj;for(e.push(o),o.start1=parseInt(s[1],10),s[2]===""?(o.start1--,o.length1=1):s[2]=="0"?o.length1=0:(o.start1--,o.length1=parseInt(s[2],10)),o.start2=parseInt(s[3],10),s[4]===""?(o.start2--,o.length2=1):s[4]=="0"?o.length2=0:(o.start2--,o.length2=parseInt(s[4],10)),n++;n<t.length;){var a=t[n].charAt(0);try{var u=decodeURI(t[n].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+u)}if(a=="-")o.diffs.push(new Q.Diff(it,u));else if(a=="+")o.diffs.push(new Q.Diff(ut,u));else if(a==" ")o.diffs.push(new Q.Diff(Ie,u));else{if(a=="@")break;if(a!=="")throw new Error('Invalid patch mode "'+a+'" in: '+u)}n++}}return e};Q.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0};Q.patch_obj.prototype.toString=function(){var r,e;this.length1===0?r=this.start1+",0":this.length1==1?r=this.start1+1:r=this.start1+1+","+this.length1,this.length2===0?e=this.start2+",0":this.length2==1?e=this.start2+1:e=this.start2+1+","+this.length2;for(var t=["@@ -"+r+" +"+e+` @@
|
|
`],n,i=0;i<this.diffs.length;i++){switch(this.diffs[i][0]){case ut:n="+";break;case it:n="-";break;case Ie:n=" ";break}t[i+1]=n+encodeURI(this.diffs[i][1])+`
|
|
`}return t.join("").replace(/%20/g," ")};Vs.exports=Q;Vs.exports.diff_match_patch=Q;Vs.exports.DIFF_DELETE=it;Vs.exports.DIFF_INSERT=ut;Vs.exports.DIFF_EQUAL=Ie});var Nu=Fa((Dh,qc)=>{(function(r){if(typeof Dh=="object"&&typeof qc<"u")qc.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return function n(i,s,o){function a(d,c){if(!s[d]){if(!i[d]){var f=typeof require=="function"&&require;if(!c&&f)return f(d,!0);if(u)return u(d,!0);var p=new Error("Cannot find module '"+d+"'");throw p.code="MODULE_NOT_FOUND",p}var m=s[d]={exports:{}};i[d][0].call(m.exports,function(g){var _=i[d][1][g];return a(_||g)},m,m.exports,n,i,s,o)}return s[d].exports}for(var u=typeof require=="function"&&require,l=0;l<o.length;l++)a(o[l]);return a}({1:[function(n,i,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,u;if(a){var l=0,d=new a(g),c=o.document.createTextNode("");d.observe(c,{characterData:!0}),u=function(){c.data=l=++l%2}}else if(!o.setImmediate&&typeof o.MessageChannel<"u"){var f=new o.MessageChannel;f.port1.onmessage=g,u=function(){f.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?u=function(){var v=o.document.createElement("script");v.onreadystatechange=function(){g(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},o.document.documentElement.appendChild(v)}:u=function(){setTimeout(g,0)};var p,m=[];function g(){p=!0;for(var v,k,S=m.length;S;){for(k=m,m=[],v=-1;++v<S;)k[v]();S=m.length}p=!1}i.exports=_;function _(v){m.push(v)===1&&!p&&u()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,s){"use strict";var o=n(1);function a(){}var u={},l=["REJECTED"],d=["FULFILLED"],c=["PENDING"];i.exports=f;function f(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,y!==a&&_(this,y)}f.prototype.catch=function(y){return this.then(null,y)},f.prototype.then=function(y,x){if(typeof y!="function"&&this.state===d||typeof x!="function"&&this.state===l)return this;var M=new this.constructor(a);if(this.state!==c){var A=this.state===d?y:x;m(M,A,this.outcome)}else this.queue.push(new p(M,y,x));return M};function p(y,x,M){this.promise=y,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof M=="function"&&(this.onRejected=M,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function(y){u.resolve(this.promise,y)},p.prototype.otherCallFulfilled=function(y){m(this.promise,this.onFulfilled,y)},p.prototype.callRejected=function(y){u.reject(this.promise,y)},p.prototype.otherCallRejected=function(y){m(this.promise,this.onRejected,y)};function m(y,x,M){o(function(){var A;try{A=x(M)}catch(N){return u.reject(y,N)}A===y?u.reject(y,new TypeError("Cannot resolve promise with itself")):u.resolve(y,A)})}u.resolve=function(y,x){var M=v(g,x);if(M.status==="error")return u.reject(y,M.value);var A=M.value;if(A)_(y,A);else{y.state=d,y.outcome=x;for(var N=-1,R=y.queue.length;++N<R;)y.queue[N].callFulfilled(x)}return y},u.reject=function(y,x){y.state=l,y.outcome=x;for(var M=-1,A=y.queue.length;++M<A;)y.queue[M].callRejected(x);return y};function g(y){var x=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof x=="function")return function(){x.apply(y,arguments)}}function _(y,x){var M=!1;function A(H){M||(M=!0,u.reject(y,H))}function N(H){M||(M=!0,u.resolve(y,H))}function R(){x(N,A)}var D=v(R);D.status==="error"&&A(D.value)}function v(y,x){var M={};try{M.value=y(x),M.status="success"}catch(A){M.status="error",M.value=A}return M}f.resolve=k;function k(y){return y instanceof this?y:u.resolve(new this(a),y)}f.reject=S;function S(y){var x=new this(a);return u.reject(x,y)}f.all=T;function T(y){var x=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=y.length,A=!1;if(!M)return this.resolve([]);for(var N=new Array(M),R=0,D=-1,H=new this(a);++D<M;)j(y[D],D);return H;function j(ee,ie){x.resolve(ee).then(Me,function(Se){A||(A=!0,u.reject(H,Se))});function Me(Se){N[ie]=Se,++R===M&&!A&&(A=!0,u.resolve(H,N))}}}f.race=E;function E(y){var x=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=y.length,A=!1;if(!M)return this.resolve([]);for(var N=-1,R=new this(a);++N<M;)D(y[N]);return R;function D(H){x.resolve(H).then(function(j){A||(A=!0,u.resolve(R,j))},function(j){A||(A=!0,u.reject(R,j))})}}},{1:1}],3:[function(n,i,s){(function(o){"use strict";typeof o.Promise!="function"&&(o.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,s){"use strict";var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b};function a(b,$){if(!(b instanceof $))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=u();function d(){try{if(!l||!l.open)return!1;var b=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),$=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!b||$)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function c(b,$){b=b||[],$=$||{};try{return new Blob(b,$)}catch(O){if(O.name!=="TypeError")throw O;for(var w=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new w,I=0;I<b.length;I+=1)C.append(b[I]);return C.getBlob($.type)}}typeof Promise>"u"&&n(3);var f=Promise;function p(b,$){$&&b.then(function(w){$(null,w)},function(w){$(w)})}function m(b,$,w){typeof $=="function"&&b.then($),typeof w=="function"&&b.catch(w)}function g(b){return typeof b!="string"&&(b=String(b)),b}function _(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var v="local-forage-detect-blob-support",k=void 0,S={},T=Object.prototype.toString,E="readonly",y="readwrite";function x(b){for(var $=b.length,w=new ArrayBuffer($),C=new Uint8Array(w),I=0;I<$;I++)C[I]=b.charCodeAt(I);return w}function M(b){return new f(function($){var w=b.transaction(v,y),C=c([""]);w.objectStore(v).put(C,"key"),w.onabort=function(I){I.preventDefault(),I.stopPropagation(),$(!1)},w.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),O=navigator.userAgent.match(/Edge\//);$(O||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function A(b){return typeof k=="boolean"?f.resolve(k):M(b).then(function($){return k=$,k})}function N(b){var $=S[b.name],w={};w.promise=new f(function(C,I){w.resolve=C,w.reject=I}),$.deferredOperations.push(w),$.dbReady?$.dbReady=$.dbReady.then(function(){return w.promise}):$.dbReady=w.promise}function R(b){var $=S[b.name],w=$.deferredOperations.pop();if(w)return w.resolve(),w.promise}function D(b,$){var w=S[b.name],C=w.deferredOperations.pop();if(C)return C.reject($),C.promise}function H(b,$){return new f(function(w,C){if(S[b.name]=S[b.name]||Ue(),b.db)if($)N(b),b.db.close();else return w(b.db);var I=[b.name];$&&I.push(b.version);var O=l.open.apply(l,I);$&&(O.onupgradeneeded=function(z){var Y=O.result;try{Y.createObjectStore(b.storeName),z.oldVersion<=1&&Y.createObjectStore(v)}catch(J){if(J.name!=="ConstraintError")throw J}}),O.onerror=function(z){z.preventDefault(),C(O.error)},O.onsuccess=function(){var z=O.result;z.onversionchange=function(Y){Y.target.close()},w(z),R(b)}})}function j(b){return H(b,!1)}function ee(b){return H(b,!0)}function ie(b,$){if(!b.db)return!0;var w=!b.db.objectStoreNames.contains(b.storeName),C=b.version<b.db.version,I=b.version>b.db.version;if(C&&(b.version,b.version=b.db.version),I||w){if(w){var O=b.db.version+1;O>b.version&&(b.version=O)}return!0}return!1}function Me(b){return new f(function($,w){var C=new FileReader;C.onerror=w,C.onloadend=function(I){var O=btoa(I.target.result||"");$({__local_forage_encoded_blob:!0,data:O,type:b.type})},C.readAsBinaryString(b)})}function Se(b){var $=x(atob(b.data));return c([$],{type:b.type})}function ge(b){return b&&b.__local_forage_encoded_blob}function Ae(b){var $=this,w=$._initReady().then(function(){var C=S[$._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return m(w,b,b),w}function Be(b){N(b);for(var $=S[b.name],w=$.forages,C=0;C<w.length;C++){var I=w[C];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return b.db=null,j(b).then(function(O){return b.db=O,ie(b)?ee(b):O}).then(function(O){b.db=$.db=O;for(var z=0;z<w.length;z++)w[z]._dbInfo.db=O}).catch(function(O){throw D(b,O),O})}function ye(b,$,w,C){C===void 0&&(C=1);try{var I=b.db.transaction(b.storeName,$);w(null,I)}catch(O){if(C>0&&(!b.db||O.name==="InvalidStateError"||O.name==="NotFoundError"))return f.resolve().then(function(){if(!b.db||O.name==="NotFoundError"&&!b.db.objectStoreNames.contains(b.storeName)&&b.version<=b.db.version)return b.db&&(b.version=b.db.version+1),ee(b)}).then(function(){return Be(b).then(function(){ye(b,$,w,C-1)})}).catch(w);w(O)}}function Ue(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function tt(b){var $=this,w={db:null};if(b)for(var C in b)w[C]=b[C];var I=S[w.name];I||(I=Ue(),S[w.name]=I),I.forages.push($),$._initReady||($._initReady=$.ready,$.ready=Ae);var O=[];function z(){return f.resolve()}for(var Y=0;Y<I.forages.length;Y++){var J=I.forages[Y];J!==$&&O.push(J._initReady().catch(z))}var W=I.forages.slice(0);return f.all(O).then(function(){return w.db=I.db,j(w)}).then(function(Z){return w.db=Z,ie(w,$._defaultConfig.version)?ee(w):Z}).then(function(Z){w.db=I.db=Z,$._dbInfo=w;for(var ce=0;ce<W.length;ce++){var ze=W[ce];ze!==$&&(ze._dbInfo.db=w.db,ze._dbInfo.version=w.version)}})}function Ve(b,$){var w=this;b=g(b);var C=new f(function(I,O){w.ready().then(function(){ye(w._dbInfo,E,function(z,Y){if(z)return O(z);try{var J=Y.objectStore(w._dbInfo.storeName),W=J.get(b);W.onsuccess=function(){var Z=W.result;Z===void 0&&(Z=null),ge(Z)&&(Z=Se(Z)),I(Z)},W.onerror=function(){O(W.error)}}catch(Z){O(Z)}})}).catch(O)});return p(C,$),C}function $e(b,$){var w=this,C=new f(function(I,O){w.ready().then(function(){ye(w._dbInfo,E,function(z,Y){if(z)return O(z);try{var J=Y.objectStore(w._dbInfo.storeName),W=J.openCursor(),Z=1;W.onsuccess=function(){var ce=W.result;if(ce){var ze=ce.value;ge(ze)&&(ze=Se(ze));var Qe=b(ze,ce.key,Z++);Qe!==void 0?I(Qe):ce.continue()}else I()},W.onerror=function(){O(W.error)}}catch(ce){O(ce)}})}).catch(O)});return p(C,$),C}function Ne(b,$,w){var C=this;b=g(b);var I=new f(function(O,z){var Y;C.ready().then(function(){return Y=C._dbInfo,T.call($)==="[object Blob]"?A(Y.db).then(function(J){return J?$:Me($)}):$}).then(function(J){ye(C._dbInfo,y,function(W,Z){if(W)return z(W);try{var ce=Z.objectStore(C._dbInfo.storeName);J===null&&(J=void 0);var ze=ce.put(J,b);Z.oncomplete=function(){J===void 0&&(J=null),O(J)},Z.onabort=Z.onerror=function(){var Qe=ze.error?ze.error:ze.transaction.error;z(Qe)}}catch(Qe){z(Qe)}})}).catch(z)});return p(I,w),I}function Xt(b,$){var w=this;b=g(b);var C=new f(function(I,O){w.ready().then(function(){ye(w._dbInfo,y,function(z,Y){if(z)return O(z);try{var J=Y.objectStore(w._dbInfo.storeName),W=J.delete(b);Y.oncomplete=function(){I()},Y.onerror=function(){O(W.error)},Y.onabort=function(){var Z=W.error?W.error:W.transaction.error;O(Z)}}catch(Z){O(Z)}})}).catch(O)});return p(C,$),C}function Ke(b){var $=this,w=new f(function(C,I){$.ready().then(function(){ye($._dbInfo,y,function(O,z){if(O)return I(O);try{var Y=z.objectStore($._dbInfo.storeName),J=Y.clear();z.oncomplete=function(){C()},z.onabort=z.onerror=function(){var W=J.error?J.error:J.transaction.error;I(W)}}catch(W){I(W)}})}).catch(I)});return p(w,b),w}function L(b){var $=this,w=new f(function(C,I){$.ready().then(function(){ye($._dbInfo,E,function(O,z){if(O)return I(O);try{var Y=z.objectStore($._dbInfo.storeName),J=Y.count();J.onsuccess=function(){C(J.result)},J.onerror=function(){I(J.error)}}catch(W){I(W)}})}).catch(I)});return p(w,b),w}function U(b,$){var w=this,C=new f(function(I,O){if(b<0){I(null);return}w.ready().then(function(){ye(w._dbInfo,E,function(z,Y){if(z)return O(z);try{var J=Y.objectStore(w._dbInfo.storeName),W=!1,Z=J.openKeyCursor();Z.onsuccess=function(){var ce=Z.result;if(!ce){I(null);return}b===0||W?I(ce.key):(W=!0,ce.advance(b))},Z.onerror=function(){O(Z.error)}}catch(ce){O(ce)}})}).catch(O)});return p(C,$),C}function ue(b){var $=this,w=new f(function(C,I){$.ready().then(function(){ye($._dbInfo,E,function(O,z){if(O)return I(O);try{var Y=z.objectStore($._dbInfo.storeName),J=Y.openKeyCursor(),W=[];J.onsuccess=function(){var Z=J.result;if(!Z){C(W);return}W.push(Z.key),Z.continue()},J.onerror=function(){I(J.error)}}catch(Z){I(Z)}})}).catch(I)});return p(w,b),w}function se(b,$){$=_.apply(this,arguments);var w=this.config();b=typeof b!="function"&&b||{},b.name||(b.name=b.name||w.name,b.storeName=b.storeName||w.storeName);var C=this,I;if(!b.name)I=f.reject("Invalid arguments");else{var O=b.name===w.name&&C._dbInfo.db,z=O?f.resolve(C._dbInfo.db):j(b).then(function(Y){var J=S[b.name],W=J.forages;J.db=Y;for(var Z=0;Z<W.length;Z++)W[Z]._dbInfo.db=Y;return Y});b.storeName?I=z.then(function(Y){if(Y.objectStoreNames.contains(b.storeName)){var J=Y.version+1;N(b);var W=S[b.name],Z=W.forages;Y.close();for(var ce=0;ce<Z.length;ce++){var ze=Z[ce];ze._dbInfo.db=null,ze._dbInfo.version=J}var Qe=new f(function(Ze,kt){var bt=l.open(b.name,J);bt.onerror=function(jr){var bo=bt.result;bo.close(),kt(jr)},bt.onupgradeneeded=function(){var jr=bt.result;jr.deleteObjectStore(b.storeName)},bt.onsuccess=function(){var jr=bt.result;jr.close(),Ze(jr)}});return Qe.then(function(Ze){W.db=Ze;for(var kt=0;kt<Z.length;kt++){var bt=Z[kt];bt._dbInfo.db=Ze,R(bt._dbInfo)}}).catch(function(Ze){throw(D(b,Ze)||f.resolve()).catch(function(){}),Ze})}}):I=z.then(function(Y){N(b);var J=S[b.name],W=J.forages;Y.close();for(var Z=0;Z<W.length;Z++){var ce=W[Z];ce._dbInfo.db=null}var ze=new f(function(Qe,Ze){var kt=l.deleteDatabase(b.name);kt.onerror=function(){var bt=kt.result;bt&&bt.close(),Ze(kt.error)},kt.onblocked=function(){},kt.onsuccess=function(){var bt=kt.result;bt&&bt.close(),Qe(bt)}});return ze.then(function(Qe){J.db=Qe;for(var Ze=0;Ze<W.length;Ze++){var kt=W[Ze];R(kt._dbInfo)}}).catch(function(Qe){throw(D(b,Qe)||f.resolve()).catch(function(){}),Qe})})}return p(I,$),I}var He={_driver:"asyncStorage",_initStorage:tt,_support:d(),iterate:$e,getItem:Ve,setItem:Ne,removeItem:Xt,clear:Ke,length:L,key:U,keys:ue,dropInstance:se};function Ee(){return typeof openDatabase=="function"}var _e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",je="~~local_forage_type~",ot=/^~~local_forage_type~([^~]+)~/,We="__lfsc__:",Le=We.length,pt="arbf",X="blob",he="si08",oe="ui08",Fe="uic8",at="si16",gr="si32",_r="ur16",Mt="ui32",vr="fl32",br="fl64",Ft=Le+pt.length,wt=Object.prototype.toString;function zt(b){var $=b.length*.75,w=b.length,C,I=0,O,z,Y,J;b[b.length-1]==="="&&($--,b[b.length-2]==="="&&$--);var W=new ArrayBuffer($),Z=new Uint8Array(W);for(C=0;C<w;C+=4)O=_e.indexOf(b[C]),z=_e.indexOf(b[C+1]),Y=_e.indexOf(b[C+2]),J=_e.indexOf(b[C+3]),Z[I++]=O<<2|z>>4,Z[I++]=(z&15)<<4|Y>>2,Z[I++]=(Y&3)<<6|J&63;return W}function Vt(b){var $=new Uint8Array(b),w="",C;for(C=0;C<$.length;C+=3)w+=_e[$[C]>>2],w+=_e[($[C]&3)<<4|$[C+1]>>4],w+=_e[($[C+1]&15)<<2|$[C+2]>>6],w+=_e[$[C+2]&63];return $.length%3===2?w=w.substring(0,w.length-1)+"=":$.length%3===1&&(w=w.substring(0,w.length-2)+"=="),w}function _t(b,$){var w="";if(b&&(w=wt.call(b)),b&&(w==="[object ArrayBuffer]"||b.buffer&&wt.call(b.buffer)==="[object ArrayBuffer]")){var C,I=We;b instanceof ArrayBuffer?(C=b,I+=pt):(C=b.buffer,w==="[object Int8Array]"?I+=he:w==="[object Uint8Array]"?I+=oe:w==="[object Uint8ClampedArray]"?I+=Fe:w==="[object Int16Array]"?I+=at:w==="[object Uint16Array]"?I+=_r:w==="[object Int32Array]"?I+=gr:w==="[object Uint32Array]"?I+=Mt:w==="[object Float32Array]"?I+=vr:w==="[object Float64Array]"?I+=br:$(new Error("Failed to get type for BinaryArray"))),$(I+Vt(C))}else if(w==="[object Blob]"){var O=new FileReader;O.onload=function(){var z=je+b.type+"~"+Vt(this.result);$(We+X+z)},O.readAsArrayBuffer(b)}else try{$(JSON.stringify(b))}catch(z){$(null,z)}}function Zt(b){if(b.substring(0,Le)!==We)return JSON.parse(b);var $=b.substring(Ft),w=b.substring(Le,Ft),C;if(w===X&&ot.test($)){var I=$.match(ot);C=I[1],$=$.substring(I[0].length)}var O=zt($);switch(w){case pt:return O;case X:return c([O],{type:C});case he:return new Int8Array(O);case oe:return new Uint8Array(O);case Fe:return new Uint8ClampedArray(O);case at:return new Int16Array(O);case _r:return new Uint16Array(O);case gr:return new Int32Array(O);case Mt:return new Uint32Array(O);case vr:return new Float32Array(O);case br:return new Float64Array(O);default:throw new Error("Unkown type: "+w)}}var yr={serialize:_t,deserialize:Zt,stringToBuffer:zt,bufferToString:Vt};function kn(b,$,w,C){b.executeSql("CREATE TABLE IF NOT EXISTS "+$.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],w,C)}function Ar(b){var $=this,w={db:null};if(b)for(var C in b)w[C]=typeof b[C]!="string"?b[C].toString():b[C];var I=new f(function(O,z){try{w.db=openDatabase(w.name,String(w.version),w.description,w.size)}catch(Y){return z(Y)}w.db.transaction(function(Y){kn(Y,w,function(){$._dbInfo=w,O()},function(J,W){z(W)})},z)});return w.serializer=yr,I}function xt(b,$,w,C,I,O){b.executeSql(w,C,I,function(z,Y){Y.code===Y.SYNTAX_ERR?z.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[$.storeName],function(J,W){W.rows.length?O(J,Y):kn(J,$,function(){J.executeSql(w,C,I,O)},O)},O):O(z,Y)},O)}function Bi(b,$){var w=this;b=g(b);var C=new f(function(I,O){w.ready().then(function(){var z=w._dbInfo;z.db.transaction(function(Y){xt(Y,z,"SELECT * FROM "+z.storeName+" WHERE key = ? LIMIT 1",[b],function(J,W){var Z=W.rows.length?W.rows.item(0).value:null;Z&&(Z=z.serializer.deserialize(Z)),I(Z)},function(J,W){O(W)})})}).catch(O)});return p(C,$),C}function on(b,$){var w=this,C=new f(function(I,O){w.ready().then(function(){var z=w._dbInfo;z.db.transaction(function(Y){xt(Y,z,"SELECT * FROM "+z.storeName,[],function(J,W){for(var Z=W.rows,ce=Z.length,ze=0;ze<ce;ze++){var Qe=Z.item(ze),Ze=Qe.value;if(Ze&&(Ze=z.serializer.deserialize(Ze)),Ze=b(Ze,Qe.key,ze+1),Ze!==void 0){I(Ze);return}}I()},function(J,W){O(W)})})}).catch(O)});return p(C,$),C}function Fi(b,$,w,C){var I=this;b=g(b);var O=new f(function(z,Y){I.ready().then(function(){$===void 0&&($=null);var J=$,W=I._dbInfo;W.serializer.serialize($,function(Z,ce){ce?Y(ce):W.db.transaction(function(ze){xt(ze,W,"INSERT OR REPLACE INTO "+W.storeName+" (key, value) VALUES (?, ?)",[b,Z],function(){z(J)},function(Qe,Ze){Y(Ze)})},function(ze){if(ze.code===ze.QUOTA_ERR){if(C>0){z(Fi.apply(I,[b,J,w,C-1]));return}Y(ze)}})})}).catch(Y)});return p(O,w),O}function ms(b,$,w){return Fi.apply(this,[b,$,w,1])}function mo(b,$){var w=this;b=g(b);var C=new f(function(I,O){w.ready().then(function(){var z=w._dbInfo;z.db.transaction(function(Y){xt(Y,z,"DELETE FROM "+z.storeName+" WHERE key = ?",[b],function(){I()},function(J,W){O(W)})})}).catch(O)});return p(C,$),C}function Ia(b){var $=this,w=new f(function(C,I){$.ready().then(function(){var O=$._dbInfo;O.db.transaction(function(z){xt(z,O,"DELETE FROM "+O.storeName,[],function(){C()},function(Y,J){I(J)})})}).catch(I)});return p(w,b),w}function go(b){var $=this,w=new f(function(C,I){$.ready().then(function(){var O=$._dbInfo;O.db.transaction(function(z){xt(z,O,"SELECT COUNT(key) as c FROM "+O.storeName,[],function(Y,J){var W=J.rows.item(0).c;C(W)},function(Y,J){I(J)})})}).catch(I)});return p(w,b),w}function Da(b,$){var w=this,C=new f(function(I,O){w.ready().then(function(){var z=w._dbInfo;z.db.transaction(function(Y){xt(Y,z,"SELECT key FROM "+z.storeName+" WHERE id = ? LIMIT 1",[b+1],function(J,W){var Z=W.rows.length?W.rows.item(0).key:null;I(Z)},function(J,W){O(W)})})}).catch(O)});return p(C,$),C}function gs(b){var $=this,w=new f(function(C,I){$.ready().then(function(){var O=$._dbInfo;O.db.transaction(function(z){xt(z,O,"SELECT key FROM "+O.storeName,[],function(Y,J){for(var W=[],Z=0;Z<J.rows.length;Z++)W.push(J.rows.item(Z).key);C(W)},function(Y,J){I(J)})})}).catch(I)});return p(w,b),w}function Ra(b){return new f(function($,w){b.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,O){for(var z=[],Y=0;Y<O.rows.length;Y++)z.push(O.rows.item(Y).name);$({db:b,storeNames:z})},function(I,O){w(O)})},function(C){w(C)})})}function Rl(b,$){$=_.apply(this,arguments);var w=this.config();b=typeof b!="function"&&b||{},b.name||(b.name=b.name||w.name,b.storeName=b.storeName||w.storeName);var C=this,I;return b.name?I=new f(function(O){var z;b.name===w.name?z=C._dbInfo.db:z=openDatabase(b.name,"","",0),b.storeName?O({db:z,storeNames:[b.storeName]}):O(Ra(z))}).then(function(O){return new f(function(z,Y){O.db.transaction(function(J){function W(Qe){return new f(function(Ze,kt){J.executeSql("DROP TABLE IF EXISTS "+Qe,[],function(){Ze()},function(bt,jr){kt(jr)})})}for(var Z=[],ce=0,ze=O.storeNames.length;ce<ze;ce++)Z.push(W(O.storeNames[ce]));f.all(Z).then(function(){z()}).catch(function(Qe){Y(Qe)})},function(J){Y(J)})})}):I=f.reject("Invalid arguments"),p(I,$),I}var Pl={_driver:"webSQLStorage",_initStorage:Ar,_support:Ee(),iterate:on,getItem:Bi,setItem:ms,removeItem:mo,clear:Ia,length:go,key:Da,keys:gs,dropInstance:Rl};function Nl(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Pa(b,$){var w=b.name+"/";return b.storeName!==$.storeName&&(w+=b.storeName+"/"),w}function _s(){var b="_localforage_support_test";try{return localStorage.setItem(b,!0),localStorage.removeItem(b),!1}catch{return!0}}function Na(){return!_s()||localStorage.length>0}function vs(b){var $=this,w={};if(b)for(var C in b)w[C]=b[C];return w.keyPrefix=Pa(b,$._defaultConfig),Na()?($._dbInfo=w,w.serializer=yr,f.resolve()):f.reject()}function La(b){var $=this,w=$.ready().then(function(){for(var C=$._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var O=localStorage.key(I);O.indexOf(C)===0&&localStorage.removeItem(O)}});return p(w,b),w}function Ll(b,$){var w=this;b=g(b);var C=w.ready().then(function(){var I=w._dbInfo,O=localStorage.getItem(I.keyPrefix+b);return O&&(O=I.serializer.deserialize(O)),O});return p(C,$),C}function Bl(b,$){var w=this,C=w.ready().then(function(){for(var I=w._dbInfo,O=I.keyPrefix,z=O.length,Y=localStorage.length,J=1,W=0;W<Y;W++){var Z=localStorage.key(W);if(Z.indexOf(O)===0){var ce=localStorage.getItem(Z);if(ce&&(ce=I.serializer.deserialize(ce)),ce=b(ce,Z.substring(z),J++),ce!==void 0)return ce}}});return p(C,$),C}function Fl(b,$){var w=this,C=w.ready().then(function(){var I=w._dbInfo,O;try{O=localStorage.key(b)}catch{O=null}return O&&(O=O.substring(I.keyPrefix.length)),O});return p(C,$),C}function zl(b){var $=this,w=$.ready().then(function(){for(var C=$._dbInfo,I=localStorage.length,O=[],z=0;z<I;z++){var Y=localStorage.key(z);Y.indexOf(C.keyPrefix)===0&&O.push(Y.substring(C.keyPrefix.length))}return O});return p(w,b),w}function te(b){var $=this,w=$.keys().then(function(C){return C.length});return p(w,b),w}function me(b,$){var w=this;b=g(b);var C=w.ready().then(function(){var I=w._dbInfo;localStorage.removeItem(I.keyPrefix+b)});return p(C,$),C}function vt(b,$,w){var C=this;b=g(b);var I=C.ready().then(function(){$===void 0&&($=null);var O=$;return new f(function(z,Y){var J=C._dbInfo;J.serializer.serialize($,function(W,Z){if(Z)Y(Z);else try{localStorage.setItem(J.keyPrefix+b,W),z(O)}catch(ce){(ce.name==="QuotaExceededError"||ce.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Y(ce),Y(ce)}})})});return p(I,w),I}function Ht(b,$){if($=_.apply(this,arguments),b=typeof b!="function"&&b||{},!b.name){var w=this.config();b.name=b.name||w.name,b.storeName=b.storeName||w.storeName}var C=this,I;return b.name?I=new f(function(O){b.storeName?O(Pa(b,C._defaultConfig)):O(b.name+"/")}).then(function(O){for(var z=localStorage.length-1;z>=0;z--){var Y=localStorage.key(z);Y.indexOf(O)===0&&localStorage.removeItem(Y)}}):I=f.reject("Invalid arguments"),p(I,$),I}var wr={_driver:"localStorageWrapper",_initStorage:vs,_support:Nl(),iterate:Bl,getItem:Ll,setItem:vt,removeItem:me,clear:La,length:te,key:Fl,keys:zl,dropInstance:Ht},Ir=function($,w){return $===w||typeof $=="number"&&typeof w=="number"&&isNaN($)&&isNaN(w)},mt=function($,w){for(var C=$.length,I=0;I<C;){if(Ir($[I],w))return!0;I++}return!1},qr=Array.isArray||function(b){return Object.prototype.toString.call(b)==="[object Array]"},Gt={},ci={},Dr={INDEXEDDB:He,WEBSQL:Pl,LOCALSTORAGE:wr},_o=[Dr.INDEXEDDB._driver,Dr.WEBSQL._driver,Dr.LOCALSTORAGE._driver],xr=["dropInstance"],Ln=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(xr),zi={description:"",driver:_o.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Bn(b,$){b[$]=function(){var w=arguments;return b.ready().then(function(){return b[$].apply(b,w)})}}function Fn(){for(var b=1;b<arguments.length;b++){var $=arguments[b];if($)for(var w in $)$.hasOwnProperty(w)&&(qr($[w])?arguments[0][w]=$[w].slice():arguments[0][w]=$[w])}return arguments[0]}var fi=function(){function b($){a(this,b);for(var w in Dr)if(Dr.hasOwnProperty(w)){var C=Dr[w],I=C._driver;this[w]=I,Gt[I]||this.defineDriver(C)}this._defaultConfig=Fn({},zi),this._config=Fn({},this._defaultConfig,$),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return b.prototype.config=function(w){if((typeof w>"u"?"undefined":o(w))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in w){if(C==="storeName"&&(w[C]=w[C].replace(/\W/g,"_")),C==="version"&&typeof w[C]!="number")return new Error("Database version must be a number.");this._config[C]=w[C]}return"driver"in w&&w.driver?this.setDriver(this._config.driver):!0}else return typeof w=="string"?this._config[w]:this._config},b.prototype.defineDriver=function(w,C,I){var O=new f(function(z,Y){try{var J=w._driver,W=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!w._driver){Y(W);return}for(var Z=Ln.concat("_initStorage"),ce=0,ze=Z.length;ce<ze;ce++){var Qe=Z[ce],Ze=!mt(xr,Qe);if((Ze||w[Qe])&&typeof w[Qe]!="function"){Y(W);return}}var kt=function(){for(var bo=function(a0){return function(){var u0=new Error("Method "+a0+" is not implemented by the current driver"),md=f.reject(u0);return p(md,arguments[arguments.length-1]),md}},Vl=0,o0=xr.length;Vl<o0;Vl++){var Hl=xr[Vl];w[Hl]||(w[Hl]=bo(Hl))}};kt();var bt=function(bo){Gt[J],Gt[J]=w,ci[J]=bo,z()};"_support"in w?w._support&&typeof w._support=="function"?w._support().then(bt,Y):bt(!!w._support):bt(!0)}catch(jr){Y(jr)}});return m(O,C,I),O},b.prototype.driver=function(){return this._driver||null},b.prototype.getDriver=function(w,C,I){var O=Gt[w]?f.resolve(Gt[w]):f.reject(new Error("Driver not found."));return m(O,C,I),O},b.prototype.getSerializer=function(w){var C=f.resolve(yr);return m(C,w),C},b.prototype.ready=function(w){var C=this,I=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return m(I,w,w),I},b.prototype.setDriver=function(w,C,I){var O=this;qr(w)||(w=[w]);var z=this._getSupportedDrivers(w);function Y(){O._config.driver=O.driver()}function J(ce){return O._extend(ce),Y(),O._ready=O._initStorage(O._config),O._ready}function W(ce){return function(){var ze=0;function Qe(){for(;ze<ce.length;){var Ze=ce[ze];return ze++,O._dbInfo=null,O._ready=null,O.getDriver(Ze).then(J).catch(Qe)}Y();var kt=new Error("No available storage method found.");return O._driverSet=f.reject(kt),O._driverSet}return Qe()}}var Z=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Z.then(function(){var ce=z[0];return O._dbInfo=null,O._ready=null,O.getDriver(ce).then(function(ze){O._driver=ze._driver,Y(),O._wrapLibraryMethodsWithReady(),O._initDriver=W(z)})}).catch(function(){Y();var ce=new Error("No available storage method found.");return O._driverSet=f.reject(ce),O._driverSet}),m(this._driverSet,C,I),this._driverSet},b.prototype.supports=function(w){return!!ci[w]},b.prototype._extend=function(w){Fn(this,w)},b.prototype._getSupportedDrivers=function(w){for(var C=[],I=0,O=w.length;I<O;I++){var z=w[I];this.supports(z)&&C.push(z)}return C},b.prototype._wrapLibraryMethodsWithReady=function(){for(var w=0,C=Ln.length;w<C;w++)Bn(this,Ln[w])},b.prototype.createInstance=function(w){return new b(w)},b}(),vo=new fi;i.exports=vo},{3:3}]},{},[4])(4)})});var Ph=Fa((Lu,Rh)=>{(function(r,e){typeof Lu=="object"&&typeof Rh<"u"?e(Lu,Nu()):typeof define=="function"&&define.amd?define(["exports","localforage"],e):e(r.localforageSetItems=r.localforageSetItems||{},r.localforage)})(Lu,function(r,e){"use strict";e="default"in e?e.default:e;function t(c){return t.result?t.result:!c||typeof c.getSerializer!="function"?Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!")):(t.result=c.getSerializer(),t.result)}function n(c,f){f&&c.then(function(p){f(null,p)},function(p){f(p)})}function i(c,f,p,m){function g(E,y){var x=E||y;return(!E||typeof E!="function")&&typeof x=="string"&&(E=function(A){return A[x]}),E}var _=[];if(Object.prototype.toString.call(c)==="[object Array]"){f=g(f,"key"),p=g(p,"value");for(var v=0,k=c.length;v<k;v++){var S=c[v];_.push(m(f(S),p(S)))}}else for(var T in c)c.hasOwnProperty(T)&&_.push(m(T,c[T]));return _}function s(c,f,p,m){var g=this,_=g.ready().then(function(){return new Promise(function(v,k){var S=g._dbInfo,T=S.db.transaction(S.storeName,"readwrite"),E=T.objectStore(S.storeName),y;T.oncomplete=function(){v(c)},T.onabort=T.onerror=function(M){k(y||M.target)};function x(M){var A=M.target||this;y=A.error||A.transaction.error,k(y)}i(c,f,p,function(M,A){A===null&&(A=void 0);var N=E.put(A,M);N.onerror=x})})});return n(_,m),_}function o(c,f,p,m){var g=this,_=new Promise(function(v,k){g.ready().then(function(){return t(g)}).then(function(S){var T=g._dbInfo;T.db.transaction(function(E){var y="INSERT OR REPLACE INTO "+T.storeName+" (key, value) VALUES (?, ?)",x=i(c,f,p,function(M,A){return new Promise(function(N,R){S.serialize(A,function(D,H){H?R(H):E.executeSql(y,[M,D],function(){N()},function(j,ee){R(ee)})})})});Promise.all(x).then(function(){v(c)},k)},function(E){k(E)})}).catch(k)});return n(_,m),_}function a(c,f,p,m){var g=this,_=i(c,f,p,function(k,S){return g.setItem(k,S)}),v=Promise.all(_);return n(v,m),v}function u(c,f,p,m){var g=this,_=g.driver();return _===g.INDEXEDDB?s.call(g,c,f,p,m):_===g.WEBSQL?o.call(g,c,f,p,m):a.call(g,c,f,p,m)}function l(c){var f=Object.getPrototypeOf(c);f&&(f.setItems=u,f.setItems.indexedDB=function(){return s.apply(this,arguments)},f.setItems.websql=function(){return o.apply(this,arguments)},f.setItems.generic=function(){return a.apply(this,arguments)})}var d=l(e);r.setItemsGeneric=a,r.localforageSetItems=u,r.extendPrototype=l,r.extendPrototypeResult=d,Object.defineProperty(r,"__esModule",{value:!0})})});var Lh=Fa((Bu,Nh)=>{(function(r,e){typeof Bu=="object"&&typeof Nh<"u"?e(Bu,Nu()):typeof define=="function"&&define.amd?define(["exports","localforage"],e):e(r.localforageGetItems=r.localforageGetItems||{},r.localforage)})(Bu,function(r,e){"use strict";e="default"in e?e.default:e;function t(m){return t.result?t.result:!m||typeof m.getSerializer!="function"?Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!")):(t.result=m.getSerializer(),t.result)}function n(m,g){return g&&m.then(function(_){g(null,_)},function(_){g(_)}),m}function i(m,g){var _=this,v=_.getItem(m).then(function(k){return{key:m,value:k}});return n(v,g),v}function s(m){var g=this,_=new Promise(function(v,k){for(var S=[],T=0,E=m.length;T<E;T++)S.push(i.call(g,m[T]));Promise.all(S).then(function(y){for(var x={},M=0,A=y.length;M<A;M++){var N=y[M];x[N.key]=N.value}v(x)}).catch(k)});return _}function o(){var m=this,g={};return m.iterate(function(_,v){g[v]=_}).then(function(){return g})}function a(){if(typeof IDBKeyRange<"u")return IDBKeyRange;if(typeof webkitIDBKeyRange<"u")return webkitIDBKeyRange;if(typeof mozIDBKeyRange<"u")return mozIDBKeyRange}var u=a();function l(m){m=m.slice();var g=this;function _(k,S){return k<S?-1:k>S?1:0}var v=new Promise(function(k,S){g.ready().then(function(){var T=g._dbInfo,E=T.db.transaction(T.storeName,"readonly").objectStore(T.storeName),y=m.sort(_),x=u.bound(m[0],m[m.length-1],!1,!1),M;if("getAll"in E)M=E.getAll(x),M.onsuccess=function(){var R=M.result;R===void 0&&(R=null),k(R)};else{M=E.openCursor(x);var A={},N=0;M.onsuccess=function(){var R=M.result;if(!R){k(A);return}for(var D=R.key;D>y[N];)if(N++,N===y.length){k(A);return}if(D===y[N]){var H=R.value;H===void 0&&(H=null),A[D]=H,R.continue()}else R.continue(y[N])}}M.onerror=function(){S(M.error)}}).catch(S)});return v}function d(m){var g=this,_=new Promise(function(v,k){g.ready().then(function(){return t(g)}).then(function(S){var T=g._dbInfo;T.db.transaction(function(E){for(var y=new Array(m.length),x=0,M=m.length;x<M;x++)y[x]="?";E.executeSql("SELECT * FROM "+T.storeName+" WHERE (key IN ("+y.join(",")+"))",m,function(A,N){for(var R={},D=N.rows,H=0,j=D.length;H<j;H++){var ee=D.item(H),ie=ee.value;ie&&(ie=S.deserialize(ie)),R[ee.key]=ie}v(R)},function(A,N){k(N)})})}).catch(k)});return _}function c(m,g){var _=this,v;if(!arguments.length||m===null)v=o.apply(_);else{var k=_.driver();k===_.INDEXEDDB?v=l.apply(_,arguments):k===_.WEBSQL?v=d.apply(_,arguments):v=s.apply(_,arguments)}return n(v,g),v}function f(m){var g=Object.getPrototypeOf(m);g&&(g.getItems=c,g.getItems.indexedDB=function(){return l.apply(this,arguments)},g.getItems.websql=function(){return d.apply(this,arguments)},g.getItems.generic=function(){return s.apply(this,arguments)})}var p=f(e);r.localforageGetItems=c,r.extendPrototype=f,r.extendPrototypeResult=p,r.getItemsGeneric=s,Object.defineProperty(r,"__esModule",{value:!0})})});var Jb={};p0(Jb,{default:()=>Dl});module.exports=m0(Jb);var xn=require("obsidian"),po=require("@codemirror/state"),s0=require("@codemirror/view");var ct=(s=>(s.ADDITION="addition",s.DELETION="deletion",s.SUBSTITUTION="substitution",s.HIGHLIGHT="highlight",s.COMMENT="comment",s))(ct||{}),_d={Addition:"addition",Deletion:"deletion",Substitution:"substitution",Highlight:"highlight",Comment:"comment"};var gt={addition:["{++","++}"],deletion:["{--","--}"],substitution:["{~~","~>","~~}"],highlight:["{==","==}"],comment:["{>>","<<}"]},vd={"{++":["++}"],"{--":["--}"],"{~~":["~>","~~}"],"{==":["==}"],"{>>":["<<}"]},bd={addition:"plus-circle",deletion:"minus-square",substitution:"replace",highlight:"highlighter",comment:"message-square"};var Va={a:"author",t:"time",d:"done",s:"style",c:"color"},Yr=class{constructor(e,t,n,i,s,o){this.from=e;this.to=t;this.type=n;this.repr=i;this.text=s;this.metadata=o;if(o!==void 0){let a=o-e,u=s.slice(3,a);this.text=s.slice(0,3)+s.slice(a+2);try{this.fields=JSON.parse(u);for(let l in this.fields)l in Va&&(this.fields[Va[l]]=this.fields[l],delete this.fields[l])}catch{this.fields={}}}}fields={};replies=[];get base_range(){return this}get full_thread(){return[this,...this.replies]}get thread(){return[...this.replies]}get length(){return this.to-this.from-6}get full_text(){return this.text+this.replies.map(e=>e.text).join("")}get range_start(){return this.metadata?this.metadata+2:this.from+3}get range_front(){return this.metadata?this.metadata-1:this.from}get full_range_front(){return this.base_range.from}get full_range_back(){return this.base_range.replies.length?this.base_range.replies[this.base_range.replies.length-1].to:this.to}range_type(e,t){return this.type}remove_metadata(){return this.metadata?[{from:this.from+3,to:this.metadata+2,insert:""}]:[]}delete_metadata(e){return e in Va&&(e=Va[e]),e in this.fields&&(delete this.fields[e],Object.keys(this.fields).length===0?this.remove_metadata():this.set_metadata(this.fields)),[]}add_metadata(e,t){return this.fields[e]=t,this.set_metadata(this.fields)}set_metadata(e){return this.fields=e,this.metadata!==void 0?[{from:this.from+3,to:this.metadata,insert:JSON.stringify(e)}]:[{from:this.from+3,to:this.from+3,insert:JSON.stringify(e)+"@@"}]}has_comment(e){return this.thread.includes(e)}copy(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}equals(e){return this.type===e.type&&this.from===e.from&&this.to===e.to&&this.replies.length===e.replies.length&&this.full_text===e.full_text}left_adjacent(e){return this.from===e.to}right_adjacent(e){return this.to===e.from}part_is_empty(e){return!1}empty(){return this.to-this.from===6}unwrap(){return this.text.slice(3,-3)}unwrap_bracket(e=!1){return e?this.text.slice(3):this.text.slice(0,-3)}unwrap_parts(){return[this.unwrap()]}unwrap_slice(e,t){return e-=this.range_front,t-=this.range_front,t<=0||e===t?"":this.text.slice(Math.max(3,e),Math.min(this.text.length-3,t))}partially_in_range(e,t){return!(e>this.to||t<this.from)}partially_in_full_range(e,t){return!(e>this.full_range_back||t<this.full_range_front)}encloses_range(e,t,n=!1){return n?this.from<e&&this.to>t:this.from<=e&&this.to>=t}part_encloses_range(e,t,n){return this.encloses_range(e,t)}accept(e=!0){return this.text}reject(e=!0){return this.text}touches(e){return this.from===e||this.to===e}cursor_inside(e){return this.from<=e&&e<=this.to}cursor_before_range(e){return e<this.from}cursor_after_range(e){return e>this.to}cursor_move_inside(e,t=!1){return Math.min(Math.max(t&&this.metadata?this.metadata+2:this.from+3,e),this.to-3)}cursor_pass_syntax(e,t,n=!1){return t?(this.touches_left_bracket(e,!0,!1,n)&&(e=n&&this.metadata?this.metadata+2:this.from+3),this.touches_right_bracket(e,!1,!0)&&(e=this.to)):(this.touches_right_bracket(e,!0,!1)&&(e=this.to-3),this.touches_left_bracket(e,!1,!0,n)&&(e=this.from)),e}cursor_move_through(e,t,n){return n=="unchanged"||!this.cursor_inside(e)||(n=="ignore_completely"?e=t?this.to:this.from:e=this.cursor_pass_syntax(e,t,n=="ignore_metadata")),e}touches_left_bracket(e,t=!1,n=!1,i=!1){return e+(t?0:1)>=this.from&&e+(n?0:1)<=(i&&this.metadata?this.metadata+2:this.from+3)}touches_separator(e,t=!1,n=!1){return!1}touches_right_bracket(e,t=!1,n=!1){return e-(n?0:1)>=this.to-3&&e-(t?0:1)<=this.to}touches_bracket(e,t,n=!1,i=!1){return t?this.touches_left_bracket(e,n,i):this.touches_right_bracket(e,n,i)}postprocess(e=!0,t=0,n="div",i=null,s){let o=s??this.text;return!s&&e&&(this.to>=o.length&&!o.endsWith(gt[this.type].at(-1))?o=this.unwrap_bracket(!0):o=this.unwrap()),`<${n} class='cmtr-${this.repr.toLowerCase()}'>${o}</${n}>`}apply_offset(e){this.from+=e,this.to+=e,this.metadata!==void 0&&(this.metadata+=e)}split_range(e){return[this.text.slice(-3),this.text.slice(0,3)+(this.metadata?JSON.stringify(this.fields)+"@@":"")]}};var Hi=class extends Yr{constructor(e,t,n,i){super(e,t,"addition","Addition",n,i)}accept(){return this.unwrap()}reject(){return""}postprocess(e=!0,t=0,n="div",i=null,s){let o=s??this.text;!s&&e&&(this.to>=o.length&&!o.endsWith(gt[this.type].at(-1))?o=this.unwrap_bracket(!0):o=this.unwrap());let a="cmtr-preview";return t===0?a+=" cmtr-addition":t===2&&(o=""),`<${n} class='${a}'>${o}</${n}>`}};var bs=class extends Yr{reply_depth=0;attached_comment=null;get base_range(){return this.attached_comment||this}get thread(){return this.attached_comment?[...this.attached_comment.thread]:[this,...this.replies]}accept(e=!0){return e?"":this.unwrap()}reject(e=!0){return e?"":this.unwrap()}clear_references(){this.attached_comment=null,this.reply_depth=0}add_reply(e){this.attach_to_range(e.type==="comment"?e.base_range:e)}attach_to_range(e){e.replies.push(this),this.reply_depth=e.replies.length-(e.type==="comment"?0:1),this.attached_comment=e}constructor(e,t,n,i){super(e,t,"comment","Comment",n,i)}};var ys=class extends Yr{constructor(e,t,n,i){super(e,t,"deletion","Deletion",n,i)}accept(){return""}reject(){return this.unwrap()}postprocess(e=!0,t=0,n="div",i=null,s){let o=s??this.text;!s&&e&&(this.to>=o.length&&!o.endsWith(gt[this.type].at(-1))?o=this.unwrap_bracket(!0):o=this.unwrap());let a="cmtr-preview";return t===0?a+=" cmtr-deletion":t===1&&(o=""),`<${n} class='${a}'>${o}</${n}>`}};var ws=class extends Yr{constructor(e,t,n,i){super(e,t,"highlight","Highlight",n,i)}};var Sn=class extends Yr{constructor(t,n,i,s,o){super(t,i,"substitution","Substitution",s,o);this.middle=n}get length(){return this.to-this.from-8}get char_middle(){return this.middle-this.range_front}range_type(t,n){return n<=this.middle+2?"deletion":t>=this.middle?"addition":"substitution"}unwrap(){return this.text.slice(3,this.char_middle)+this.text.slice(this.char_middle+2,-3)}unwrap_parts(){return[this.text.slice(3,this.char_middle),this.text.slice(this.char_middle+2,-3)]}unwrap_slice_parts_inverted(t,n){return t-=this.range_front,n-=this.range_front,t=Math.max(0,t),n<=0?this.unwrap_parts():n<=this.char_middle?[this.text.slice(3,t)+this.text.slice(n,this.char_middle),this.text.slice(this.char_middle+2,-3)]:t>=this.char_middle+2?[this.text.slice(3,this.char_middle),this.text.slice(this.char_middle+2,t)+this.text.slice(n,-3)]:[this.text.slice(3,t),this.text.slice(n,-3)]}unwrap_parts_bracket(t,n=0){return t?[this.text.slice(3,this.char_middle),this.text.slice(this.char_middle+2)]:[this.text.slice(0,this.char_middle),this.text.slice(this.char_middle+2,-3)]}unwrap_slice(t,n){return t-=this.range_front,n-=this.range_front,n<=0||t===n?"":t>=this.char_middle?this.text.slice(Math.max(this.char_middle+2,t),Math.min(this.text.length-3,n)):n<=this.char_middle?this.text.slice(Math.max(3,t),Math.min(this.char_middle,n)):this.text.slice(Math.max(3,t),this.char_middle)+this.text.slice(this.char_middle+2,Math.min(this.text.length-3,n))}accept(){return this.unwrap_parts()[1]}reject(){return this.unwrap_parts()[0]}touches_separator(t,n=!1,i=!1){return t+(n?1:0)>=this.middle&&t-(i?0:1)<=this.middle+2}contains_separator(t,n){return t<=this.middle+2&&n>=this.middle}contains_part(t,n,i=!0){return i?n<this.middle?!0:t>this.middle+2?!1:void 0:n<=this.middle?!0:t>=this.middle+2?!1:void 0}cursor_pass_syntax(t,n,i=!1){return n?(this.touches_left_bracket(t,!0,!1,i)&&(t=i&&this.metadata?this.metadata+2:this.from+3),this.touches_separator(t,!1,!0)&&(t=this.middle+2),this.touches_right_bracket(t,!1,!0)&&(t=this.to)):(this.touches_right_bracket(t,!0,!1)&&(t=this.to-3),this.touches_separator(t,!1,!0)&&(t=this.middle),this.touches_left_bracket(t,!1,!0,i)&&(t=this.from)),t}part_encloses_range(t,n,i){return i?this.from<=t&&n<=this.middle+2:this.middle<=t&&n<=this.to}empty(){return this.from+3===this.middle&&this.middle+2===this.to-3}part_is_empty(t){return t?this.from+3===this.middle:this.middle+2===this.to-3}postprocess(t=!0,n=0,i="div",s=null,o){let a=o??this.text,u=[a];!o&&t&&(this.to>=a.length&&!a.endsWith(gt.substitution[2])?u=this.unwrap_parts_bracket(!0):this.from<=0&&!a.startsWith(gt.substitution[0])?u=this.unwrap_parts_bracket(!1):u=this.unwrap_parts());let l="cmtr-preview";return u.length===1&&(u[+s]=u[0],u[+!s]=""),a="",n===0?(u[0].length&&(a+=`<${i} class='${l} cmtr-deletion'>${u[0]}</${i}>`),u[1].length&&(a+=`<${i} class='${l} cmtr-addition'>${u[1]}</${i}>`)):n===1?u[1].length&&(a+=`<${i} class='${l}'>${u[1]}</${i}>`):u[0].length&&(a+=`<${i} class='${l}'>${u[0]}</${i}>`),a}apply_offset(t){this.from+=t,this.middle+=t,this.to+=t,this.metadata!==void 0&&(this.metadata+=t)}split_range(t){let n=super.split_range(t);return t<=this.middle?n[0]=gt.substitution[1]+n[0]:n[1]=n[1]+gt.substitution[1],n}cursor_move_inside(t,n=!1){return t=super.cursor_move_inside(t,n),t==this.middle+1&&(t=this.middle+2),t}};var M1=require("@codemirror/state");var g0=class Gl{constructor(e,t){this.low=e,this.high=t}clone(){return new Gl(this.low,this.high)}get max(){return this.clone()}less_than(e){return this.low<e.low||this.low===e.low&&this.high<e.high}equal_to(e){return this.low===e.low&&this.high===e.high}intersect(e){return!this.not_intersect(e)}not_intersect(e){return this.high<e.low||e.high<this.low}merge(e){return new Gl(this.low===void 0?e.low:this.low<e.low?this.low:e.low,this.high===void 0?e.high:this.high>e.high?this.high:e.high)}output(){return[this.low,this.high]}static comparable_max(e,t){return e.merge(t)}static comparable_less_than(e,t){return e<t}},Ut=0,et=1,zn=class{constructor(e=void 0,t=void 0,n=null,i=null,s=null,o=et){if(this.left=n,this.right=i,this.parent=s,this.color=o,this.item={key:e,value:t},e&&e instanceof Array&&e.length===2&&!Number.isNaN(e[0])&&!Number.isNaN(e[1])){let[a,u]=e;a>u&&([a,u]=[u,a]),this.item.key=new g0(a,u)}this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.value===void 0&&this.left===null&&this.right===null&&this.color===et}_value_less_than(e){return this.item.value&&e.item.value&&this.item.value.less_than?this.item.value.less_than(e.item.value):this.item.value<e.item.value}less_than(e){return this.item.value===this.item.key&&e.item.value===e.item.key?this.item.key.less_than(e.item.key):this.item.key.less_than(e.item.key)||this.item.key.equal_to(e.item.key)&&this._value_less_than(e)}_value_equal(e){return this.item.value&&e.item.value&&this.item.value.equal_to?this.item.value.equal_to(e.item.value):this.item.value===e.item.value}equal_to(e){return this.item.value===this.item.key&&e.item.value===e.item.key?this.item.key.equal_to(e.item.key):this.item.key.equal_to(e.item.key)&&this._value_equal(e)}intersect(e){return this.item.key.intersect(e.item.key)}copy_data(e){this.item.key=e.item.key,this.item.value=e.item.value}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right&&this.right.max){let e=this.item.key.constructor.comparable_max;this.max=e(this.max,this.right.max)}if(this.left&&this.left.max){let e=this.item.key.constructor.comparable_max;this.max=e(this.max,this.left.max)}}not_intersect_left_subtree(e){let t=this.item.key.constructor.comparable_less_than,n=this.left.max.high!==void 0?this.left.max.high:this.left.max;return t(n,e.item.key.low)}not_intersect_right_subtree(e){let t=this.item.key.constructor.comparable_less_than,n=this.right.max.low!==void 0?this.right.max.low:this.right.item.key.low;return t(e.item.key.high,n)}},Ha=class r{constructor(){this.root=null,this.nil_node=new zn}get size(){let e=0;return this.tree_walk(this.root,()=>e++),e}get keys(){let e=[];return this.tree_walk(this.root,t=>e.push(t.item.key.output?t.item.key.output():t.item.key)),e}get values(){let e=[];return this.tree_walk(this.root,t=>e.push(t.item.value)),e}get items(){let e=[];return this.tree_walk(this.root,t=>e.push({key:t.item.key.output?t.item.key.output():t.item.key,value:t.item.value})),e}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(e,t=e){if(e===void 0)return;let n=new zn(e,t,this.nil_node,this.nil_node,null,Ut);return this.tree_insert(n),this.recalc_max(n),n}exist(e,t=e){let n=new zn(e,t);return!!this.tree_search(this.root,n)}remove(e,t=e){let n=new zn(e,t),i=this.tree_search(this.root,n);return i&&this.tree_delete(i),i}search(e,t=(n,i)=>n===i?i.output():n){let n=new zn(e),i=[];return this.tree_search_interval(this.root,n,i),i.map(s=>t(s.item.value,s.item.key))}intersect_any(e){let t=new zn(e);return this.tree_find_any_interval(this.root,t)}forEach(e){this.tree_walk(this.root,t=>e(t.item.key,t.item.value))}map(e){let t=new r;return this.tree_walk(this.root,n=>t.insert(n.item.key,e(n.item.value,n.item.key))),t}*iterate(e,t=(n,i)=>n===i?i.output():n){let n;for(e?n=this.tree_search_nearest_forward(this.root,new zn(e)):this.root&&(n=this.local_minimum(this.root));n;)yield t(n.item.value,n.item.key),n=this.tree_successor(n)}recalc_max(e){let t=e;for(;t.parent!=null;)t.parent.update_max(),t=t.parent}tree_insert(e){let t=this.root,n=null;if(this.root==null||this.root===this.nil_node)this.root=e;else{for(;t!==this.nil_node;)n=t,e.less_than(t)?t=t.left:t=t.right;e.parent=n,e.less_than(n)?n.left=e:n.right=e}this.insert_fixup(e)}insert_fixup(e){let t,n;for(t=e;t!==this.root&&t.parent.color===Ut;)t.parent===t.parent.parent.left?(n=t.parent.parent.right,n.color===Ut?(t.parent.color=et,n.color=et,t.parent.parent.color=Ut,t=t.parent.parent):(t===t.parent.right&&(t=t.parent,this.rotate_left(t)),t.parent.color=et,t.parent.parent.color=Ut,this.rotate_right(t.parent.parent))):(n=t.parent.parent.left,n.color===Ut?(t.parent.color=et,n.color=et,t.parent.parent.color=Ut,t=t.parent.parent):(t===t.parent.left&&(t=t.parent,this.rotate_right(t)),t.parent.color=et,t.parent.parent.color=Ut,this.rotate_left(t.parent.parent)));this.root.color=et}tree_delete(e){let t,n;e.left===this.nil_node||e.right===this.nil_node?t=e:t=this.tree_successor(e),t.left!==this.nil_node?n=t.left:n=t.right,n.parent=t.parent,t===this.root?this.root=n:(t===t.parent.left?t.parent.left=n:t.parent.right=n,t.parent.update_max()),this.recalc_max(n),t!==e&&(e.copy_data(t),e.update_max(),this.recalc_max(e)),t.color===et&&this.delete_fixup(n)}delete_fixup(e){let t=e,n;for(;t!==this.root&&t.parent!=null&&t.color===et;)t===t.parent.left?(n=t.parent.right,n.color===Ut&&(n.color=et,t.parent.color=Ut,this.rotate_left(t.parent),n=t.parent.right),n.left.color===et&&n.right.color===et?(n.color=Ut,t=t.parent):(n.right.color===et&&(n.color=Ut,n.left.color=et,this.rotate_right(n),n=t.parent.right),n.color=t.parent.color,t.parent.color=et,n.right.color=et,this.rotate_left(t.parent),t=this.root)):(n=t.parent.left,n.color===Ut&&(n.color=et,t.parent.color=Ut,this.rotate_right(t.parent),n=t.parent.left),n.left.color===et&&n.right.color===et?(n.color=Ut,t=t.parent):(n.left.color===et&&(n.color=Ut,n.right.color=et,this.rotate_left(n),n=t.parent.left),n.color=t.parent.color,t.parent.color=et,n.left.color=et,this.rotate_right(t.parent),t=this.root));t.color=et}tree_search(e,t){if(!(e==null||e===this.nil_node))return t.equal_to(e)?e:t.less_than(e)?this.tree_search(e.left,t):this.tree_search(e.right,t)}tree_search_nearest_forward(e,t){let n,i=e;for(;i&&i!==this.nil_node;)i.less_than(t)?i.intersect(t)?(n=i,i=i.left):i=i.right:((!n||i.less_than(n))&&(n=i),i=i.left);return n||null}tree_search_interval(e,t,n){e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(t)&&this.tree_search_interval(e.left,t,n),e.intersect(t)&&n.push(e),e.right!==this.nil_node&&!e.not_intersect_right_subtree(t)&&this.tree_search_interval(e.right,t,n))}tree_find_any_interval(e,t){let n=!1;return e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(t)&&(n=this.tree_find_any_interval(e.left,t)),n||(n=e.intersect(t)),!n&&e.right!==this.nil_node&&!e.not_intersect_right_subtree(t)&&(n=this.tree_find_any_interval(e.right,t))),n}local_minimum(e){let t=e;for(;t.left!=null&&t.left!==this.nil_node;)t=t.left;return t}local_maximum(e){let t=e;for(;t.right!=null&&t.right!==this.nil_node;)t=t.right;return t}tree_successor(e){let t,n,i;if(e.right!==this.nil_node)t=this.local_minimum(e.right);else{for(n=e,i=e.parent;i!=null&&i.right===n;)n=i,i=i.parent;t=i}return t}rotate_left(e){let t=e.right;e.right=t.left,t.left!==this.nil_node&&(t.left.parent=e),t.parent=e.parent,e===this.root?this.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,e!=null&&e!==this.nil_node&&e.update_max(),t=e.parent,t!=null&&t!==this.nil_node&&t.update_max()}rotate_right(e){let t=e.left;e.left=t.right,t.right!==this.nil_node&&(t.right.parent=e),t.parent=e.parent,e===this.root?this.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.right=e,e.parent=t,e!==null&&e!==this.nil_node&&e.update_max(),t=e.parent,t!=null&&t!==this.nil_node&&t.update_max()}tree_walk(e,t){e!=null&&e!==this.nil_node&&(this.tree_walk(e.left,t),t(e),this.tree_walk(e.right,t))}testRedBlackProperty(){let e=!0;return this.tree_walk(this.root,function(t){t.color===Ut&&(t.left.color===et&&t.right.color===et||(e=!1))}),e}testBlackHeightProperty(e){let t=0,n=0,i=0;if(e.color===et&&t++,e.left!==this.nil_node?n=this.testBlackHeightProperty(e.left):n=1,e.right!==this.nil_node?i=this.testBlackHeightProperty(e.right):i=1,n!==i)throw new Error("Red-black height property violated");return t+=n,t}};var Ga=class{ranges;tree;constructor(e){this.ranges=e,this.tree=new Ha;for(let t of e)this.tree.insert([t.from,t.to],t)}empty(){return this.ranges.length===0}get(e){return e<0?this.ranges[this.ranges.length+e]:this.ranges[e]}at_cursor(e,t=!1){let n=this.tree.search([e,e]);return n.length?t&&n.length>1?n[1]:n[0]:void 0}contains_range(e,t){return this.tree.intersect_any([e,t])}range_adjacent_to_cursor(e,t,n=!1,i=!1){let s=t?this.ranges.slice().reverse():this.ranges;return i?s.find(o=>t?(n?o.from:o.to)<e:e<(n?o.to:o.from)):s.find(o=>t?(n?o.from:o.to)<=e:e<=(n?o.to:o.from))}adjacent_range(e,t,n=!1){let i=this.ranges.findIndex(o=>o===e);if(i===-1)return;let s=t?this.ranges[i-1]:this.ranges[i+1];if(s)if(n){if(t?s.to===e.from:e.to===s.from)return s}else return s}ranges_in_interval(e,t){return this.tree.search([e,t])}ranges_in_intervals(e){let t=new Set;for(let n of e)for(let i of this.tree.search([n.from,n.to]))if(t.add(i),i.base_range){t.add(i.base_range);for(let s of i.base_range.replies)t.add(s)}return Array.from(t).sort((n,i)=>n.from-i.from)}unwrap_in_range(e,t=0,n=e.length,i=null){let s,o;if(i||(i=this.ranges_in_interval(t,n)),i.length===0)return{output:e.sliceString(t,n),from:t,to:n};let a="";t<i[0].from?a+=e.sliceString(t,i[0].from):s=i[0];let u=-1;for(let c of i)u!==-1&&(a+=e.sliceString(u,c.from)),a+=c.unwrap_slice(Math.max(0,t),n),u=c.to;n>=i.at(-1).to?a+=e.sliceString(i.at(-1).to,n):o=i.at(-1);let l=s?s.cursor_pass_syntax(t,!1):t,d=o?o.cursor_pass_syntax(n,!0):n;return(l!==t||t===s?.from)&&(s=void 0),(d!==n||n===o?.to)&&(o=void 0),{output:a,from:l,to:d,front_range:s,back_range:o}}};var tk=require("@codemirror/view");var j1=require("@codemirror/state");var B1=require("@codemirror/state");function wd(r){return r.ranges.length===1&&r.ranges[0].anchor===r.ranges[0].head}function xs(r){return r.startState.selection.ranges[0].from!==r.selection.ranges[0].from||r.startState.selection.ranges[0].to!==r.selection.ranges[0].to}function yo(r,e,t){let n=[],i=0;return e.iterChanges((s,o,a,u,l)=>{n.push({from:s,to:o,anchor:r.ranges[i].anchor,offset:{removed:o-s,added:u-a},inserted:l.toString(),deleted:o-s?t.sliceString(s,o):"",selection:r.ranges[i].anchor!==r.ranges[i].head}),i<r.ranges.length-1&&i++}),n}function Ua(r,e,t){let n="",i=0;for(let s of t)n+=r.slice(i,s.from)+e(s,r),i=s.to;return n+r.slice(i)}function xd(r,e){return r.main.head<e.main.head}var kh=require("@codemirror/state"),Sh=require("@codemirror/language");var _0=0;var ht=class{constructor(e={}){this.id=_0++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Hn.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};ht.closedBy=new ht({deserialize:r=>r.split(" ")});ht.openedBy=new ht({deserialize:r=>r.split(" ")});ht.group=new ht({deserialize:r=>r.split(" ")});ht.isolate=new ht({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});ht.contextHash=new ht({perNode:!0});ht.lookAhead=new ht({perNode:!0});ht.mounted=new ht({perNode:!0});var ks=class{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[ht.mounted.id]}},v0=Object.create(null),Hn=class r{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):v0,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new r(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ht.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(ht.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}};Hn.none=new Hn("",Object.create(null),0,8);var qa=new WeakMap,kd=new WeakMap,er;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(er||(er={}));var Vn=class r{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ks.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new ko(this.topNode,e)}cursorAt(e,t=0,n=0){let i=qa.get(this)||this.topNode,s=new ko(i);return s.moveTo(e,t),qa.set(this,s._tree),s}get topNode(){return new En(this,0,0,null)}resolve(e,t=0){let n=wo(qa.get(this)||this.topNode,e,t,!1);return qa.set(this,n),n}resolveInner(e,t=0){let n=wo(kd.get(this)||this.topNode,e,t,!0);return kd.set(this,n),n}resolveStack(e,t=0){return b0(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&er.IncludeAnonymous)>0;for(let u=this.cursor(o|er.IncludeAnonymous);;){let l=!1;if(u.from<=s&&u.to>=i&&(!a&&u.type.isAnonymous||t(u)!==!1)){if(u.firstChild())continue;l=!0}for(;l&&n&&(a||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Jl(Hn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new r(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new r(Hn.none,t,n,i)))}static build(e){return y0(e)}};Vn.empty=new Vn(Hn.none,[],[],0);var Ul=class r{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new r(this.buffer,this.index)}},di=class r{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Hn.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,n,i,s){let{buffer:o}=this,a=-1;for(let u=e;u!=t&&!(Td(s,i,o[u+1],o[u+2])&&(a=u,n>0));u=o[u+3]);return a}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,u=0;a<t;){s[u++]=i[a++],s[u++]=i[a++]-n;let l=s[u++]=i[a++]-n;s[u++]=i[a++]-e,o=Math.max(o,l)}return new r(s,o,this.set)}};function Td(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function wo(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!n&&r instanceof En&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:er.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof En&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=a);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}var Ya=class{cursor(e=0){return new ko(this,e)}getChild(e,t=null,n=null){let i=Sd(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Sd(this,e,t,n)}resolve(e,t=0){return wo(this,e,t,!1)}resolveInner(e,t=0){return wo(this,e,t,!0)}matchContext(e){return ql(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}},En=class r extends Ya{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,s=0){for(let o=this;;){for(let{children:a,positions:u}=o._tree,l=t>0?a.length:-1;e!=l;e+=t){let d=a[e],c=u[e]+o.from;if(Td(i,n,c,c+d.length)){if(d instanceof di){if(s&er.ExcludeBuffers)continue;let f=d.findChild(0,d.buffer.length,t,n-c,i);if(f>-1)return new xo(new jl(o,d,e,c),null,f)}else if(s&er.IncludeAnonymous||!d.type.isAnonymous||Wl(d)){let f;if(!(s&er.IgnoreMounts)&&(f=ks.get(d))&&!f.overlay)return new r(f.tree,c,e,o);let p=new r(d,c,e,o);return s&er.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?d.children.length-1:0,t,n,i)}}}if(s&er.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&er.IgnoreOverlays)&&(i=ks.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new r(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Sd(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function ql(r,e,t=e.length-1){for(let n=r;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}var jl=class{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}},xo=class r extends Ya{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new r(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&er.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new r(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new r(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new r(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),t.push(0)}return new Vn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function $d(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let n=t instanceof En&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new Yl(i,t)}var Yl=class{constructor(e,t){this.heads=e,this.node=t}get next(){return $d(this.heads)}};function b0(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof En?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,t)),s=o}else{let o=ks.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new En(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(wo(a,e,t,!1))}}return i?$d(i):n}var ko=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof En)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof En?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&er.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&er.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&er.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&er.IncludeAnonymous||a instanceof di||!a.type.isAnonymous||Wl(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)t=new xo(this.buffer,t,this.stack[i]);return this.bufferNode=new xo(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return ql(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return ql(this._tree,e,i);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}};function Wl(r){return r.children.some(e=>e instanceof di||!e.type.isAnonymous||Wl(e))}function y0(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=1024,reused:s=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new Ul(t,t.length):t,u=n.types,l=0,d=0;function c(E,y,x,M,A,N){let{id:R,start:D,end:H,size:j}=a,ee=d,ie=l;for(;j<0;)if(a.next(),j==-1){let Be=s[R];x.push(Be),M.push(D-E);return}else if(j==-3){l=R;return}else if(j==-4){d=R;return}else throw new RangeError(`Unrecognized record size: ${j}`);let Me=u[R],Se,ge,Ae=D-E;if(H-D<=i&&(ge=_(a.pos-y,A))){let Be=new Uint16Array(ge.size-ge.skip),ye=a.pos-ge.size,Ue=Be.length;for(;a.pos>ye;)Ue=v(ge.start,Be,Ue);Se=new di(Be,H-ge.start,n),Ae=ge.start-E}else{let Be=a.pos-j;a.next();let ye=[],Ue=[],tt=R>=o?R:-1,Ve=0,$e=H;for(;a.pos>Be;)tt>=0&&a.id==tt&&a.size>=0?(a.end<=$e-i&&(m(ye,Ue,D,Ve,a.end,$e,tt,ee,ie),Ve=ye.length,$e=a.end),a.next()):N>2500?f(D,Be,ye,Ue):c(D,Be,ye,Ue,tt,N+1);if(tt>=0&&Ve>0&&Ve<ye.length&&m(ye,Ue,D,Ve,D,$e,tt,ee,ie),ye.reverse(),Ue.reverse(),tt>-1&&Ve>0){let Ne=p(Me,ie);Se=Jl(Me,ye,Ue,0,ye.length,0,H-D,Ne,Ne)}else Se=g(Me,ye,Ue,H-D,ee-H,ie)}x.push(Se),M.push(Ae)}function f(E,y,x,M){let A=[],N=0,R=-1;for(;a.pos>y;){let{id:D,start:H,end:j,size:ee}=a;if(ee>4)a.next();else{if(R>-1&&H<R)break;R<0&&(R=j-i),A.push(D,H,j),N++,a.next()}}if(N){let D=new Uint16Array(N*4),H=A[A.length-2];for(let j=A.length-3,ee=0;j>=0;j-=3)D[ee++]=A[j],D[ee++]=A[j+1]-H,D[ee++]=A[j+2]-H,D[ee++]=ee;x.push(new di(D,A[2]-H,n)),M.push(H-E)}}function p(E,y){return(x,M,A)=>{let N=0,R=x.length-1,D,H;if(R>=0&&(D=x[R])instanceof Vn){if(!R&&D.type==E&&D.length==A)return D;(H=D.prop(ht.lookAhead))&&(N=M[R]+D.length+H)}return g(E,x,M,A,N,y)}}function m(E,y,x,M,A,N,R,D,H){let j=[],ee=[];for(;E.length>M;)j.push(E.pop()),ee.push(y.pop()+x-A);E.push(g(n.types[R],j,ee,N-A,D-N,H)),y.push(A-x)}function g(E,y,x,M,A,N,R){if(N){let D=[ht.contextHash,N];R=R?[D].concat(R):[D]}if(A>25){let D=[ht.lookAhead,A];R=R?[D].concat(R):[D]}return new Vn(E,y,x,M,R)}function _(E,y){let x=a.fork(),M=0,A=0,N=0,R=x.end-i,D={size:0,start:0,skip:0};e:for(let H=x.pos-E;x.pos>H;){let j=x.size;if(x.id==y&&j>=0){D.size=M,D.start=A,D.skip=N,N+=4,M+=4,x.next();continue}let ee=x.pos-j;if(j<0||ee<H||x.start<R)break;let ie=x.id>=o?4:0,Me=x.start;for(x.next();x.pos>ee;){if(x.size<0)if(x.size==-3)ie+=4;else break e;else x.id>=o&&(ie+=4);x.next()}A=Me,M+=j,N+=ie}return(y<0||M==E)&&(D.size=M,D.start=A,D.skip=N),D.size>4?D:void 0}function v(E,y,x){let{id:M,start:A,end:N,size:R}=a;if(a.next(),R>=0&&M<o){let D=x;if(R>4){let H=a.pos-(R-4);for(;a.pos>H;)x=v(E,y,x)}y[--x]=D,y[--x]=N-E,y[--x]=A-E,y[--x]=M}else R==-3?l=M:R==-4&&(d=M);return x}let k=[],S=[];for(;a.pos>0;)c(r.start||0,r.bufferStart||0,k,S,-1,0);let T=(e=r.length)!==null&&e!==void 0?e:k.length?S[0]+k[0].length:0;return new Vn(u[r.topID],k.reverse(),S.reverse(),T)}var Ed=new WeakMap;function ja(r,e){if(!r.isAnonymous||e instanceof di||e.type!=r)return 1;let t=Ed.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof Vn)){t=1;break}t+=ja(r,n)}Ed.set(e,t)}return t}function Jl(r,e,t,n,i,s,o,a,u){let l=0;for(let m=n;m<i;m++)l+=ja(r,e[m]);let d=Math.ceil(l*1.5/8),c=[],f=[];function p(m,g,_,v,k){for(let S=_;S<v;){let T=S,E=g[S],y=ja(r,m[S]);for(S++;S<v;S++){let x=ja(r,m[S]);if(y+x>=d)break;y+=x}if(S==T+1){if(y>d){let x=m[T];p(x.children,x.positions,0,x.children.length,g[T]+k);continue}c.push(m[T])}else{let x=g[S-1]+m[S-1].length-E;c.push(Jl(r,m,g,T,S,E,x,null,u))}f.push(E+k-s)}}return p(e,t,n,i,0),(a||u)(c,f,o)}var Ss=class r{constructor(e,t,n,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new r(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,u=0,l=0;;a++){let d=a<t.length?t[a]:null,c=d?d.fromA:1e9;if(c-u>=n)for(;o&&o.from<c;){let f=o;if(u>=f.from||c<=f.to||l){let p=Math.max(f.from,u)-l,m=Math.min(f.to,c)-l;f=p>=m?null:new r(p,m,f.tree,f.offset+l,a>0,!!d)}if(f&&i.push(f),o.to>c)break;o=s<e.length?e[s++]:null}if(!d)break;u=d.toA,l=d.toA-d.toB}return i}};var Z1=new ht({perNode:!0});var Wr=require("@codemirror/state");var an=Wr.Facet.define({combine:r=>r[0]}),Es=new Wr.Compartment,qt=Wr.Facet.define({combine:r=>r[0]}),Ts=new Wr.Compartment,kr=Wr.Facet.define({combine:r=>r[0]}),$s=new Wr.Compartment,Ms=new Wr.Compartment,Os=Wr.StateEffect.define();var dc=require("@codemirror/language");var w0=0,So=class{constructor(e,t){this.from=e,this.to=t}},nt=class{constructor(e={}){this.id=w0++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Jr.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};nt.closedBy=new nt({deserialize:r=>r.split(" ")});nt.openedBy=new nt({deserialize:r=>r.split(" ")});nt.group=new nt({deserialize:r=>r.split(" ")});nt.isolate=new nt({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});nt.contextHash=new nt({perNode:!0});nt.lookAhead=new nt({perNode:!0});nt.mounted=new nt({perNode:!0});var Cs=class{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[nt.mounted.id]}},x0=Object.create(null),Jr=class r{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):x0,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new r(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(nt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(nt.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}};Jr.none=new Jr("",Object.create(null),0,8);var Ka=class r{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let s of e){let o=s(n);o&&(i||(i=Object.assign({},n.props)),i[o[0].id]=o[1])}t.push(i?new Jr(n.name,i,n.id,n.flags):n)}return new r(t)}},Wa=new WeakMap,Md=new WeakMap,Dt;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(Dt||(Dt={}));var Sr=class r{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Cs.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new $o(this.topNode,e)}cursorAt(e,t=0,n=0){let i=Wa.get(this)||this.topNode,s=new $o(i);return s.moveTo(e,t),Wa.set(this,s._tree),s}get topNode(){return new Tn(this,0,0,null)}resolve(e,t=0){let n=Eo(Wa.get(this)||this.topNode,e,t,!1);return Wa.set(this,n),n}resolveInner(e,t=0){let n=Eo(Md.get(this)||this.topNode,e,t,!0);return Md.set(this,n),n}resolveStack(e,t=0){return k0(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Dt.IncludeAnonymous)>0;for(let u=this.cursor(o|Dt.IncludeAnonymous);;){let l=!1;if(u.from<=s&&u.to>=i&&(!a&&u.type.isAnonymous||t(u)!==!1)){if(u.firstChild())continue;l=!0}for(;l&&n&&(a||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:rc(Jr.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new r(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new r(Jr.none,t,n,i)))}static build(e){return S0(e)}};Sr.empty=new Sr(Jr.none,[],[],0);var Kl=class r{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new r(this.buffer,this.index)}},hi=class r{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Jr.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,n,i,s){let{buffer:o}=this,a=-1;for(let u=e;u!=t&&!(Ad(s,i,o[u+1],o[u+2])&&(a=u,n>0));u=o[u+3]);return a}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,u=0;a<t;){s[u++]=i[a++],s[u++]=i[a++]-n;let l=s[u++]=i[a++]-n;s[u++]=i[a++]-e,o=Math.max(o,l)}return new r(s,o,this.set)}};function Ad(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Eo(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!n&&r instanceof Tn&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:Dt.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof Tn&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=a);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}var Qa=class{cursor(e=0){return new $o(this,e)}getChild(e,t=null,n=null){let i=Od(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Od(this,e,t,n)}resolve(e,t=0){return Eo(this,e,t,!1)}resolveInner(e,t=0){return Eo(this,e,t,!0)}matchContext(e){return Ql(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}},Tn=class r extends Qa{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,s=0){for(let o=this;;){for(let{children:a,positions:u}=o._tree,l=t>0?a.length:-1;e!=l;e+=t){let d=a[e],c=u[e]+o.from;if(Ad(i,n,c,c+d.length)){if(d instanceof hi){if(s&Dt.ExcludeBuffers)continue;let f=d.findChild(0,d.buffer.length,t,n-c,i);if(f>-1)return new To(new Xl(o,d,e,c),null,f)}else if(s&Dt.IncludeAnonymous||!d.type.isAnonymous||tc(d)){let f;if(!(s&Dt.IgnoreMounts)&&(f=Cs.get(d))&&!f.overlay)return new r(f.tree,c,e,o);let p=new r(d,c,e,o);return s&Dt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?d.children.length-1:0,t,n,i)}}}if(s&Dt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&Dt.IgnoreOverlays)&&(i=Cs.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new r(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Od(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function Ql(r,e,t=e.length-1){for(let n=r;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}var Xl=class{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}},To=class r extends Qa{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new r(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&Dt.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new r(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new r(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new r(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),t.push(0)}return new Sr(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Id(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let n=t instanceof Tn&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new Zl(i,t)}var Zl=class{constructor(e,t){this.heads=e,this.node=t}get next(){return Id(this.heads)}};function k0(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof Tn?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,t)),s=o}else{let o=Cs.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Tn(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(Eo(a,e,t,!1))}}return i?Id(i):n}var $o=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Tn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof Tn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Dt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Dt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Dt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&Dt.IncludeAnonymous||a instanceof hi||!a.type.isAnonymous||tc(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)t=new To(this.buffer,t,this.stack[i]);return this.bufferNode=new To(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return Ql(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return Ql(this._tree,e,i);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}};function tc(r){return r.children.some(e=>e instanceof hi||!e.type.isAnonymous||tc(e))}function S0(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=1024,reused:s=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new Kl(t,t.length):t,u=n.types,l=0,d=0;function c(E,y,x,M,A,N){let{id:R,start:D,end:H,size:j}=a,ee=d,ie=l;for(;j<0;)if(a.next(),j==-1){let Be=s[R];x.push(Be),M.push(D-E);return}else if(j==-3){l=R;return}else if(j==-4){d=R;return}else throw new RangeError(`Unrecognized record size: ${j}`);let Me=u[R],Se,ge,Ae=D-E;if(H-D<=i&&(ge=_(a.pos-y,A))){let Be=new Uint16Array(ge.size-ge.skip),ye=a.pos-ge.size,Ue=Be.length;for(;a.pos>ye;)Ue=v(ge.start,Be,Ue);Se=new hi(Be,H-ge.start,n),Ae=ge.start-E}else{let Be=a.pos-j;a.next();let ye=[],Ue=[],tt=R>=o?R:-1,Ve=0,$e=H;for(;a.pos>Be;)tt>=0&&a.id==tt&&a.size>=0?(a.end<=$e-i&&(m(ye,Ue,D,Ve,a.end,$e,tt,ee,ie),Ve=ye.length,$e=a.end),a.next()):N>2500?f(D,Be,ye,Ue):c(D,Be,ye,Ue,tt,N+1);if(tt>=0&&Ve>0&&Ve<ye.length&&m(ye,Ue,D,Ve,D,$e,tt,ee,ie),ye.reverse(),Ue.reverse(),tt>-1&&Ve>0){let Ne=p(Me,ie);Se=rc(Me,ye,Ue,0,ye.length,0,H-D,Ne,Ne)}else Se=g(Me,ye,Ue,H-D,ee-H,ie)}x.push(Se),M.push(Ae)}function f(E,y,x,M){let A=[],N=0,R=-1;for(;a.pos>y;){let{id:D,start:H,end:j,size:ee}=a;if(ee>4)a.next();else{if(R>-1&&H<R)break;R<0&&(R=j-i),A.push(D,H,j),N++,a.next()}}if(N){let D=new Uint16Array(N*4),H=A[A.length-2];for(let j=A.length-3,ee=0;j>=0;j-=3)D[ee++]=A[j],D[ee++]=A[j+1]-H,D[ee++]=A[j+2]-H,D[ee++]=ee;x.push(new hi(D,A[2]-H,n)),M.push(H-E)}}function p(E,y){return(x,M,A)=>{let N=0,R=x.length-1,D,H;if(R>=0&&(D=x[R])instanceof Sr){if(!R&&D.type==E&&D.length==A)return D;(H=D.prop(nt.lookAhead))&&(N=M[R]+D.length+H)}return g(E,x,M,A,N,y)}}function m(E,y,x,M,A,N,R,D,H){let j=[],ee=[];for(;E.length>M;)j.push(E.pop()),ee.push(y.pop()+x-A);E.push(g(n.types[R],j,ee,N-A,D-N,H)),y.push(A-x)}function g(E,y,x,M,A,N,R){if(N){let D=[nt.contextHash,N];R=R?[D].concat(R):[D]}if(A>25){let D=[nt.lookAhead,A];R=R?[D].concat(R):[D]}return new Sr(E,y,x,M,R)}function _(E,y){let x=a.fork(),M=0,A=0,N=0,R=x.end-i,D={size:0,start:0,skip:0};e:for(let H=x.pos-E;x.pos>H;){let j=x.size;if(x.id==y&&j>=0){D.size=M,D.start=A,D.skip=N,N+=4,M+=4,x.next();continue}let ee=x.pos-j;if(j<0||ee<H||x.start<R)break;let ie=x.id>=o?4:0,Me=x.start;for(x.next();x.pos>ee;){if(x.size<0)if(x.size==-3)ie+=4;else break e;else x.id>=o&&(ie+=4);x.next()}A=Me,M+=j,N+=ie}return(y<0||M==E)&&(D.size=M,D.start=A,D.skip=N),D.size>4?D:void 0}function v(E,y,x){let{id:M,start:A,end:N,size:R}=a;if(a.next(),R>=0&&M<o){let D=x;if(R>4){let H=a.pos-(R-4);for(;a.pos>H;)x=v(E,y,x)}y[--x]=D,y[--x]=N-E,y[--x]=A-E,y[--x]=M}else R==-3?l=M:R==-4&&(d=M);return x}let k=[],S=[];for(;a.pos>0;)c(r.start||0,r.bufferStart||0,k,S,-1,0);let T=(e=r.length)!==null&&e!==void 0?e:k.length?S[0]+k[0].length:0;return new Sr(u[r.topID],k.reverse(),S.reverse(),T)}var Cd=new WeakMap;function Ja(r,e){if(!r.isAnonymous||e instanceof hi||e.type!=r)return 1;let t=Cd.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof Sr)){t=1;break}t+=Ja(r,n)}Cd.set(e,t)}return t}function rc(r,e,t,n,i,s,o,a,u){let l=0;for(let m=n;m<i;m++)l+=Ja(r,e[m]);let d=Math.ceil(l*1.5/8),c=[],f=[];function p(m,g,_,v,k){for(let S=_;S<v;){let T=S,E=g[S],y=Ja(r,m[S]);for(S++;S<v;S++){let x=Ja(r,m[S]);if(y+x>=d)break;y+=x}if(S==T+1){if(y>d){let x=m[T];p(x.children,x.positions,0,x.children.length,g[T]+k);continue}c.push(m[T])}else{let x=g[S-1]+m[S-1].length-E;c.push(rc(r,m,g,T,S,E,x,null,u))}f.push(E+k-s)}}return p(e,t,n,i,0),(a||u)(c,f,o)}var Xa=class{startParse(e,t,n){return typeof e=="string"&&(e=new ec(e)),n=n?n.length?n.map(i=>new So(i.from,i.to)):[new So(0,0)]:[new So(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let s=i.advance();if(s)return s}}},ec=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var oy=new nt({perNode:!0});var ic=class r{constructor(e,t,n,i,s,o,a,u,l,d=0,c){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=u,this.curContext=l,this.lookAhead=d,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new r(e,[],t,n,n,0,[],0,i?new Za(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),n==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),u=a?this.stack[a-2]:this.p.ranges[0].from,l=this.reducePos-u;l>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSize<l&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=u,this.p.lastBigReductionSize=l));let d=a?this.stack[a-1]:0,c=this.bufferBase+this.buffer.length-d;if(i<s.minRepeatTerm||e&131072){let f=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,u,f,c+4,!0)}if(e&262144)this.state=this.stack[a];else{let f=this.stack[a-3];this.state=s.getGoto(f,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,u)}storeNode(e,t,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==n)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(e,t,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,i,4)}else this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4)}apply(e,t,n,i){e&65536?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new r(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new sc(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let o=t[s+1];i.some((a,u)=>u&1&&a==o)||i.push(t[s],o)}t=i}let n=[];for(let i=0;i<t.length&&n.length<4;i+=2){let s=t[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[i],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let u=o&65535,l=this.stack.length-a*3;if(l>=0&&e.getGoto(this.stack[l],u,!1)>=0)return a<<19|65536|u}}else{let a=n(o,s+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Za(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Za=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},sc=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}},oc=class r{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new r(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new r(this.stack,this.pos,this.index)}};function Mo(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,i=0;n<r.length;){let s=0;for(;;){let o=r.charCodeAt(n++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let u=o-32;if(u>=46&&(u-=46,a=!0),s+=u,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}var As=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Dd=new As,ac=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Dd,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!i)return null;let o=this.ranges[--i];s-=n.from-o.to,n=o}for(;t<0?s>n.to:s>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,i;if(t>=0&&t<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Dd,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}},pi=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Bd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};pi.prototype.contextual=pi.prototype.fallback=pi.prototype.extend=!1;var Un=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Mo(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Bd(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}};Un.prototype.contextual=pi.prototype.fallback=pi.prototype.extend=!1;function Bd(r,e,t,n,i,s){let o=0,a=1<<n,{dialect:u}=t.p.parser;e:for(;(a&r[o])!=0;){let l=r[o+1];for(let p=o+3;p<l;p+=2)if((r[p+1]&a)>0){let m=r[p];if(u.allows(m)&&(e.token.value==-1||e.token.value==m||T0(m,e.token.value,i,s))){e.acceptToken(m);break}}let d=e.next,c=0,f=r[o+2];if(e.next<0&&f>c&&r[l+f*3-3]==65535){o=r[l+f*3-1];continue e}for(;c<f;){let p=c+f>>1,m=l+p+(p<<1),g=r[m],_=r[m+1]||65536;if(d<g)f=p;else if(d>=_)c=p+1;else{o=r[m+2],e.advance();continue e}}break}}function Rd(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function T0(r,e,t,n){let i=Rd(t,n,e);return i<0||Rd(t,n,r)<i}var Rr=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),nc=null;function Pd(r,e,t){let n=r.cursor(Dt.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}var uc=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Pd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Pd(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[i],o=this.start[t]+n.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof Sr){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let u=s.prop(nt.lookAhead);if(!u||a+u<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}},lc=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new As)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,u=0;for(let l=0;l<s.length;l++){if((1<<l&o)==0)continue;let d=s[l],c=this.tokens[l];if(!(n&&!d.fallback)&&((d.contextual||c.start!=e.pos||c.mask!=o||c.context!=a)&&(this.updateCachedToken(c,d,e),c.mask=o,c.context=a),c.lookAhead>c.end+25&&(u=Math.max(c.lookAhead,u)),c.value!=0)){let f=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!d.extend&&(n=c,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return u&&e.setLookAhead(u),!n&&e.pos==this.stream.end&&(n=new As,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new As,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let u=0;u<2;u++)for(let l=o.stateSlot(s,u?2:1);;l+=3){if(a[l]==65535)if(a[l+1]==1)l=Gn(a,l+2);else{i==0&&a[l+1]==2&&(i=this.putAction(Gn(a,l+2),t,n,i));break}a[l]==t&&(i=this.putAction(Gn(a,l+1),t,n,i))}return i}},cc=class{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new ac(t,i),this.tokens=new lc(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ic.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new uc(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],s=[]),i.push(a);let u=this.tokens.getMainToken(a);s.push(u.value,u.end)}}break}}if(!n.length){let o=i&&$0(i);if(o)return this.stackToTree(o);if(this.parser.strict)throw new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(o)return this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,u)=>u.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let u=o+1;u<n.length;u++){let l=n[u];if(a.sameState(l)||a.buffer.length>500&&l.buffer.length>500)if((a.score-l.score||a.buffer.length-l.buffer.length)>0)n.splice(u--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:s}=this,o=Rr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let l=e.curContext&&e.curContext.tracker.strict,d=l?e.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let f=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(f>-1&&c.length&&(!l||(c.prop(nt.contextHash)||0)==d))return e.useNode(c,f),!0;if(!(c instanceof Sr)||c.children.length==0||c.positions[0]>0)break;let p=c.children[0];if(p instanceof Sr&&c.positions[0]==0)c=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let u=this.tokens.getActions(e);for(let l=0;l<u.length;){let d=u[l++],c=u[l++],f=u[l++],p=l==u.length||!n,m=p?e:e.split(),g=this.tokens.mainToken;if(m.apply(d,c,g?g.start:m.pos,f),p)return!0;m.pos>i?t.push(m):n.push(m)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Nd(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],u=t[o<<1],l=t[(o<<1)+1],d=Rr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),this.advanceFully(a,n))))continue;let c=a.split(),f=d;for(let p=0;c.forceReduce()&&p<10&&!this.advanceFully(c,n);p++)Rr&&(f=this.stackID(c)+" -> ");for(let p of a.recoverByInsert(u))this.advanceFully(p,n);this.stream.end>a.pos?(l==a.pos&&(l++,u=0),a.recoverByDelete(u,l),Nd(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Sr.build({buffer:oc.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(nc||(nc=new WeakMap)).get(e);return t||nc.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function Nd(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}var fc=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}};var eu=class r extends Xa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,u,l){i[a].push([u,u.deserialize(String(l))])}if(e.nodeProps)for(let a of e.nodeProps){let u=a[0];typeof u=="string"&&(u=nt[u]);for(let l=1;l<a.length;){let d=a[l++];if(d>=0)s(d,u,a[l++]);else{let c=a[l+-d];for(let f=-d;f>0;f--)s(a[l++],u,c);l++}}}this.nodeSet=new Ka(t.map((a,u)=>Jr.define({name:u>=this.minRepeatTerm?void 0:a,id:u,props:i[u],top:n.indexOf(u)>-1,error:u==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(u)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=Mo(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Ld),this.states=Mo(e.states,Uint32Array),this.data=Mo(e.stateData),this.goto=Mo(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new pi(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new cc(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,u=i[s++];if(a&&n)return u;for(let l=s+(o>>1);s<l;s++)if(i[s]==e)return u;if(a)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=Gn(n,s+2)];else{if(n[s+1]==2)return Gn(n,s+2);break}if(o==t||o==0)return Gn(n,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Gn(this.data,s+2);else break;i=t(Gn(this.data,s+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Gn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[n],i)}}return t}configure(e){let t=Object.assign(Object.create(r.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=Ld(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!n[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new fc(e,n,i)}static deserialize(e){return new r(e)}};function Gn(r,e){return r[e]|r[e+1]<<16}function $0(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Ld(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}var M0=eu.deserialize({version:14,states:")`QQOPOOOfOQO'#C^OqOSO'#C`O|OWO'#CbO!XO`O'#CeO!dOpO'#CgOOOO'#Ck'#CkOOOO'#Ci'#CiQQOPOOOOOO,58x,58xO!oOQO,58xO!wOQO,58xOOOO,58z,58zO#POSO,58zO#XOSO,58zO#aOWO,58|O#iOWO,58|O#qOWO,58|OOOO,59P,59PO#yO`O,59PO$RO`O,59POOOO,59R,59RO$ZOpO,59RO$cOpO,59ROOOO-E6g-E6gOOOO1G.d1G.dO$kOQO1G.dO$nOQO1G.dOOOO1G.f1G.fO$sOSO1G.fO$vOSO1G.fOOOO1G.h1G.hO${OWO1G.hO%QOWO1G.hO%YOWO1G.hO%bOWO1G.hOOOO1G.k1G.kO%gO`O1G.kO%jO`O1G.kOOOO1G.m1G.mO%oOpO1G.mO%rOpO1G.mOOOO7+$O7+$OO%wOQO7+$OOOOO7+$Q7+$QO%|OSO7+$QOOOO7+$S7+$SO&ROWO7+$SO&WOWO7+$SO&`OWO7+$SOOOO7+$V7+$VO&eO`O7+$VOOOO7+$X7+$XO&jOpO7+$XOOOO<<Gj<<GjOOOO<<Gl<<GlOOOO<<Gn<<GnO&oOWO<<GnO&tOWO<<GnOOOO<<Gq<<GqOOOO<<Gs<<GsOOOOAN=YAN=YO&|OWOAN=YOOOOG22tG22t",stateData:"'R~O`POcQOfROiSOlTOoVO~ORZOaYObXO~OT^Od]Oe[O~OVaOW_Og`O~OYdOjcOkbO~O[gOmfOneO~ORjObiO~OakObiO~OTmOelO~OdnOelO~OgpOhoO~OVrOWqO~OWqOgsO~OYuOktO~OjvOktO~O[xOnwO~OmyOnwO~Oa{ObzO~Od}Oe|O~Oh!OO~Og!POh!OO~OW!QOg!RO~OW!QO~Oj!TOk!SO~Om!VOn!UO~Ob!WO~Oe!XO~Oh!YO~Og!ZOh!YO~OW![O~Ok!]O~On!^O~Oh!_O~Og!`Oh!_O~Oh!aO~O",goto:"o`PPaPaPaPPaPaPePkTUOWQWORhWTVOW",nodeNames:"\u26A0 CriticMarkup Addition MDSepAdd Deletion MDSepDel Substitution MDSepSub MSub Comment MDSepCom Highlight MDSepHig",maxTerm:31,skippedNodes:[0],repeatNodeCount:1,tokenData:"'o~R]XYzYZz]^zpqzqrzrszs#Oz#O#P!P#P#oz#o#p#s#p;'Sz;'S;=`'i<%lOz~!POo~~!UXo~rsz!P!Qz#O#Pz#U#Vz#Y#Zz#b#cz#f#gz#h#iz#i#j!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![#Z!c!i#Z#T#Z#Z~#^R!Q![#g!c!i#g#T#Z#g~#jR!Q![z!c!iz#T#Zz~#xVo~vw$_{|%`}!O%k!^!_%v!_!`'V!`!a']#r#s'c~$bP#Z#[$e~$hP#h#i$k~$nP!]!^$q~$tPvw$w~$zP#Z#[$}~%QP#h#i%T~%WP!]!^%Z~%`Oi~~%cP{|%f~%kO`~~%nP}!O%q~%vOc~~%yQ#W#X&P#a#b&h~&SP#X#Y&V~&YP#`#a&]~&`P!`!a&c~&hOf~~&kP#T#U&n~&qP#f#g&t~&wP#_#`&z~&}P!`!a'Q~'VOl~~'YP!_!`'Q~'`P!`!a%Z~'fP#r#s&c~'lP;=`<%lz",tokenizers:[5,new Un("v~RQ{|X!b!cj~[P{|_~bP#q#re~jOb~~mP!b!cp~uOR~~",37,17),new Un("v~RQ}!OX!b!cj~[P}!O_~bP#q#re~jOe~~mP!b!cp~uOT~~",37,20),new Un("#W~RR!^!_[!b!c!V#r#s!b~_P!P!Qb~eP#W#Xh~kP#X#Yn~qP#`#at~wP!`!az~}P#q#r!Q~!VOh~~!YP!b!c!]~!bOV~~!eRvw!n!`!a#Q#r#sz~!qP#Z#[!t~!wP#h#i!z~!}P!]!^#Q~#VOW~~",99,23),new Un("!u~RRvw[!^!_!c!b!c!i~_P#`#ab~eP#h#ih~kP!]!^n~qPvwt~wP#`#az~}P#h#i!Q~!TP!]!^!W~!ZP#q#r!^~!cOk~~!fP!^!_!W~!lP!b!c!o~!tOY~~",82,26),new Un("!o~RR!^!_[!_!`!]!b!c!c~_P!P!Qb~eP#a#bh~kP#T#Un~qP#f#gt~wP#_#`z~}P!`!a!Q~!TP#q#r!W~!]On~~!`P!_!`!Q~!fP!b!c!i~!nO[~~",76,29)],topRules:{CriticMarkup:[0,1]},tokenPrec:0}),tu=dc.LRLanguage.define({name:"criticmarkup",parser:M0.configure({})});var Pc=require("obsidian");var Nx=require("@codemirror/state");var Hd=require("obsidian"),$n=require("@codemirror/state");var Fd=require("@codemirror/view"),Rt=null,hc=Fd.EditorView.domEventHandlers({keydown:(r,e)=>{Rt=r},contextmenu:(r,e)=>{Rt=r}});var zd=require("@codemirror/state");function ru(r,e,t,n,i){if(e.includes("select.pointer")||Rt&&i.key==="a"&&(Rt.ctrlKey||Rt.metaKey))return;let s=e.includes("select.backward"),o=e.includes("select.group"),a=e.includes("select.extend");!t&&i&&(s=i.key==="ArrowLeft",i.key==="ArrowLeft"?s=!0:i.key==="ArrowRight"?s=!1:s=!xd(r.startState.selection,r.selection),a=i.shiftKey,o=i.ctrlKey||i.metaKey);let u=r.startState.field(Pe).ranges,l=r.selection.ranges.map((d,c)=>Vd(r.startState.selection.ranges[c],d,u,!s,o,a,t,r.startState,n.suggestion_mode_operations.cursor_movement,n.suggestion_mode_operations.bracket_movement).selection);return{selection:zd.EditorSelection.create(l),filter:!1}}var pc=r=>$n.EditorState.transactionFilter.of(e=>O0(e,r));function O0(r,e){let t=Oo(r),{app:n}=r.startState.field(Hd.editorInfoField),i=n.workspace.activeEditor?.editor?.cm.cm!==void 0;if(!r.docChanged&&i&&xs(r)&&t.push(r.startState.selection.ranges[0].from<r.newSelection.ranges[0].from?"select.forward":"select.backward"),r.docChanged){let s=yo(r.startState.selection,r.changes,r.startState.doc);if(!(r.isUserEvent("input")||r.isUserEvent("paste")||r.isUserEvent("delete")))return r;let o=r.startState.field(Pe).ranges,a=[],u=[],l=Rt?.key==="Backspace",d=Rt?.ctrlKey,c=0;for(let p of s){r.isUserEvent("delete")&&(p=iu(p,o,l,d,r.startState));let m=o.ranges_in_interval(p.from,p.to);if(!m.length){a.push({from:p.from,to:p.to,insert:p.inserted}),u.push(r.newSelection.ranges[0]),c+=p.inserted.length;continue}if(p.from===p.to){let v=m[0];if(v){let k=v.touches_left_bracket(p.from,!1,!0,!0)?!0:v.touches_right_bracket(p.from,!1,!0)?!1:void 0;if(k!==void 0){let S=p.from;S!==v.to-3&&(S=k?v.from:v.to),a.push({from:S,to:S,insert:p.inserted}),c+=p.inserted.length,u.push($n.EditorSelection.cursor(S+c));continue}}}else if(!p.inserted.length){let v=p.from<m[0].from?p.from:m[0].touches_left_bracket(p.from,!1,!0,!0)?m[0].from:void 0,k=p.to>m[0].to?p.to:m[0].touches_right_bracket(p.to,!1,!0)?m[0].to:void 0;if(v!==void 0&&k!==void 0){a.push({from:v,to:k,insert:""}),u.push($n.EditorSelection.cursor(v+c)),c-=k-v;continue}}let g=Co(o,r.startState.doc,p.from,p.to,p.inserted,"regular"),_=g.slice(0,-1).reduce((v,k)=>v-(k.to-k.from)+k.insert.length,0);g&&(a.push(g),u.push($n.EditorSelection.cursor((l?g[0].start:g[g.length-1].end+_)+c)),c+=_-(g[g.length-1].to-g[g.length-1].from)+g[g.length-1].insert.length)}if(!a.length)return r;let f=Is(r);return r.startState.update({changes:a,selection:$n.EditorSelection.create(u),annotations:f?[$n.Transaction.userEvent.of(f)]:void 0,filter:!1})}else if(nu("select",t)&&xs(r)&&e.alternative_cursor_movement&&Rt&&Rt.instanceOf(KeyboardEvent)){let s=ru(r,t,i,e,Rt);if(s){let o=Is(r);return r.startState.update({...s,annotations:o?[$n.Transaction.userEvent.of(o)]:s.annotations,filter:!1})}return r}return r}var Gd=require("obsidian"),mi=require("@codemirror/state"),Ty=require("@codemirror/view");var A0={moveByCharacters:{group:!1}},mc=r=>mi.EditorState.transactionFilter.of(e=>I0(e,r));function I0(r,e){let t=r.startState.field(Gd.editorEditorField),n=Oo(r),i=t.cm!==void 0;if(i&&!r.docChanged&&r.selection&&(xs(r)&&n.push(r.startState.selection.ranges[0].from<r.selection.ranges[0].from?"select.forward":"select.backward"),A0[t.cm.state.vim.lastMotion?.name]?.group&&n.push("select.group")),r.docChanged){let s=yo(r.startState.selection,r.changes,r.startState.doc);if(!(r.isUserEvent("input")||r.isUserEvent("paste")||r.isUserEvent("delete")))return r;let a=r.startState.field(Pe).ranges,u=[],l=[],d=Gi(e),c=Rt?.key==="Backspace",f=Rt?.ctrlKey,p=0;for(let g of s){let _=g.deleted?g.inserted?"substitution":"deletion":"addition";if(_==="deletion"){g=iu(g,a,c,f,r.startState,e.suggestion_mode_operations.cursor_movement,e.suggestion_mode_operations.bracket_movement);let S=a.ranges_in_interval(g.from,g.to);if(S.length===1){let T=S[0];T.encloses_range(g.from,g.to)&&su(T,d)&&(T.type==="addition"||(T.type==="substitution"&&T.contains_part(g.from,g.to,!1))===!1)&&(_="regular")}}let v=Co(a,r.startState.doc,g.from,g.to,g.inserted,_,d),k=v.slice(0,-1).reduce((S,T)=>S-(T.to-T.from)+T.insert.length,0);v&&(u.push(v),l.push(mi.EditorSelection.cursor((c?v[0].start:v[v.length-1].end+k)+p)),p+=k-(v[v.length-1].to-v[v.length-1].from)+v[v.length-1].insert.length)}if(!u.length)return r;let m=Is(r);return r.startState.update({changes:u,selection:mi.EditorSelection.create(l),annotations:m?[mi.Transaction.userEvent.of(m)]:void 0,filter:!1})}else if(nu("select",n)&&xs(r)&&e.alternative_cursor_movement&&Rt&&Rt.instanceOf(KeyboardEvent)){let s=ru(r,n,i,e,Rt);if(s){let o=Is(r);return r.startState.update({...s,annotations:o?[mi.Transaction.userEvent.of(o)]:s.annotations,filter:!1})}return r}return r}var Ny=require("@codemirror/state");function gi(r,e){return r===0?[]:r===1?[pc(e)]:r===2?[mc(e)]:[]}var un=require("obsidian");async function D0(r){let e,t;if(un.Platform.isMobileApp){let i=await window.Capacitor.nativePromise("App","getInfo");i&&(e=i.version+" ("+i.build+")");let s=await window.Capacitor.nativePromise("Device","getInfo");s?t=`${s.platform} ${s.osVersion} (${s.manufacturer} ${s.model})`:t=navigator.userAgent.match(/(Android|iOS) ([\d.]+)/)?.[0]||"unknown"}else if(un.Platform.isDesktopApp){let i=require("os");t=i.version()+" "+i.release(),e=navigator.userAgent.match(/obsidian\/([\d.]+\d+)/)?.[1]||"unknown"}else t=navigator.userAgent.match(/(Windows|Mac OS X|Linux) ([\d.]+)/)?.[0]||"unknown",e=navigator.userAgent.match(/obsidian\/([\d.]+\d+)/)?.[1]||"unknown";let n=Object.values(r.plugins.plugins).filter(i=>i.manifest.id!=="commentator").map(i=>i.manifest.id+(i.manifest.version?` (v${i.manifest.version})`:""));return{plugin_version:r.plugins.plugins.commentator.manifest.version,other_plugins:n,operating_system:t,platform:un.Platform.isMobileApp?un.Platform.isAndroidApp?"Android":un.Platform.isIosApp?"iOS":"mobile":un.Platform.isMacOS?"macOS":"Desktop",framework_version:e,obsidian_version:un.apiVersion}}async function R0(r,e,t={}){let i={...await D0(r),...t};return"https://github.com/Fevol/obsidian-criticmarkup/issues/new?"+new URLSearchParams({title:e,template:"bug-report.yml","installer-version":i.framework_version,"app-version":i.obsidian_version,"commentator-version":i.plugin_version,"operating-systems":i.operating_system,"installed-plugins":i.other_plugins.join(", ")})}async function Ud(r,e="",t={}){window.open(await R0(r,e,t),"_blank")}function ou(r,e,t=100,n=3e3,i){let s=new un.Notice("",0);s.messageEl.appendChild(createEl("span",{text:r})),i&&(s.messageEl.appendChild(createEl("br")),s.messageEl.appendChild(createEl("span",{cls:"u-small",text:i})));let o=createEl("progress");return o.value=0,o.max=t,s.messageEl.appendChild(o),a=>{a>=t?(s.setMessage(e),s.noticeEl.addClass("mod-success"),activeWindow.setTimeout(()=>{s.hide()},n)):o.value=Math.round(a)}}function au(r,e,t,n){for(let{icon:i,tooltip:s,value:o}of t)r.addItem(a=>{a.setTitle(s).setIcon(i).setChecked(e===o).onClick(()=>{n(o);for(let u of r.items){let l=u===a;u.dom.classList.toggle("mod-checked",l),u.setChecked(l)}})})}var sh=require("@codemirror/state");var cn=require("@codemirror/state"),tx=require("@codemirror/view"),ln=require("obsidian");var Ds=require("@codemirror/state"),Pr=require("@codemirror/view");function uu(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].compare(e[t]))return!1;return!0}var P0={class:"",renderEmptyElements:!1,markers:()=>Ds.RangeSet.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};function _c(r,e,t){for(;r.value&&r.from<=t;)r.from<=t&&e.push(r.value),r.next()}function qd(r){return Array.isArray(r)?r:[r]}var Rs=class{dom;height=-1;above=0;markers=[];constructor(e,t,n,i){this.dom=createDiv(),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),uu(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,u=s<t.length?t[s++]:null,l=!1;if(u){let d=u.elementClass;d&&(n+=" "+d);for(let c=o;c<this.markers.length;c++)if(this.markers[c].compare(u)){a=c,l=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM&&i){d.preventUnload||d.destroy(i),d.preventUnload=!1;let c=i.nextSibling;i.remove(),i=c}}if(!u)break;u.toDOM&&e&&(l?i=i.nextSibling:this.dom.insertBefore(u.toDOM(e),i)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}},Ao=class{constructor(e,t,n){this.gutter=e;this.height=n;this.cursor=Ds.RangeSet.iter(e.markers,t.from)}cursor;i=0;addElement(e,t,n){let{gutter:i}=this,s=t.top-this.height,o=t.height;if(this.i==i.elements.length){let a=new Rs(e,o,s,n);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];_c(this.cursor,i,t.to);let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},_i=class{constructor(e,t){this.view=e;this.config=t;this.dom=createDiv(),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let u=s.getBoundingClientRect();o=(u.top+u.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,i)&&i.preventDefault()});this.markers=qd(t.markers(e)),t.initialSpacer&&(this.spacer=new Rs(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}dom;elements=[];markers;spacer=null;update(e){let t=this.markers;if(this.markers=qd(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let n=e.view.viewport;return!Ds.RangeSet.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},Ps=class{constructor(e,t,n){this.view=e;this.unfixGutters=t;this.activeGutters=n;this.prevViewport=e.viewport,this.dom=createDiv(),this.dom.className="cm-gutters",this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=this.createGutters(e);for(let i of this.gutters)this.dom.appendChild(i.dom);this.fixed=!e.state.facet(this.unfixGutters),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),this.insertGutters(e)}gutters;dom;fixed;prevViewport;createGutters(e){return e.state.facet(this.activeGutters).map(t=>new _i(e,t))}insertGutters(e){e.contentDOM.parentNode.insertBefore(this.dom,e.contentDOM)}insertDetachedGutters(e){e.parentNode.insertBefore(this.dom,e)}getUpdateContexts(){return this.gutters.map(e=>new Ao(e,this.view.viewport,-this.view.documentPadding.top))}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<(n.to-n.from)*.8)}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(this.unfixGutters)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=Ds.RangeSet.iter(this.view.state.facet(Pr.gutterLineClass),this.view.viewport.from),i=[],s=this.getUpdateContexts();for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==Pr.BlockType.Text&&a){_c(n,i,u.from);for(let l of s)l.line(this.view,u,i);a=!1}else if(u.widget)for(let l of s)l.widget(this.view,u)}else if(o.type==Pr.BlockType.Text){_c(n,i,o.from);for(let a of s)a.line(this.view,o,i)}for(let o of s)o.finish();e&&this.insertDetachedGutters(t)}updateGutters(e){let t=e.startState.facet(this.activeGutters),n=e.state.facet(this.activeGutters),i=e.docChanged||e.heightChanged||e.viewportChanged||!Ds.RangeSet.eq(e.startState.facet(Pr.gutterLineClass),e.state.facet(Pr.gutterLineClass),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let s of this.gutters)s.update(e)&&(i=!0);else{i=!0;let s=[];for(let o of n){let a=t.indexOf(o);a<0?s.push(new _i(this.view,o)):(this.gutters[a].update(e),s.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),s.indexOf(o)<0&&o.destroy();for(let o of s)this.dom.appendChild(o.dom);this.gutters=s}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}};function lu(r){return Pr.ViewPlugin.fromClass(r,{provide:e=>Pr.EditorView.scrollMargins.of(t=>{let n=t.plugin(e);return!n||n.gutters.length==0||!n.fixed?null:t.textDirection==Pr.Direction.LTR?{left:n.dom.offsetWidth}:{right:n.dom.offsetWidth}})})}function N0(r,e,t){let n=[r];return e&&e.fixed===!1&&n.push(t.of(!0)),n}function cu(r,e,t,n){return[N0(r,{},n),t.of({...P0,...e})]}var pu=require("@codemirror/state"),eh=require("@codemirror/view"),jt=require("obsidian");var jd=require("obsidian"),du=require("@codemirror/state"),Ns=require("@codemirror/view");function Ui(r,e){let t=Object.keys(e).map(n=>L0(r,n,e[n]));return t.length===1?t[0]:function(){t.forEach(n=>n())}}function L0(r,e,t){let n=r[e],i=r.hasOwnProperty(e),s=i?n:function(){return Object.getPrototypeOf(r)[e].apply(this,arguments)},o=t(s);return n&&Object.setPrototypeOf(o,n),Object.setPrototypeOf(a,o),r[e]=a,u;function a(...l){return o===s&&r[e]===a&&u(),o.apply(this,l)}function u(){r[e]===a&&(i?r[e]=s:delete r[e]),o!==s&&(o=s,Object.setPrototypeOf(a,n||Function))}}function B0(r){let e=r.embedRegistry.embedByExtension.md({app:r,containerEl:createDiv()},null,"");e.editable=!0,e.showEditor();let t=Object.getPrototypeOf(Object.getPrototypeOf(e.editMode));return e.unload(),t.constructor}var fu={cursorLocation:{anchor:0,head:0},value:"",cls:"",placeholder:"",focus:!0,filteredExtensions:[],onEnter:(r,e,t)=>(e&&r.options.onSubmit(r),e),onEscape:r=>{r.options.onBlur(r)},onSubmit:()=>{},onBlur:()=>{},onPaste:()=>{},onChange:()=>{}},vi=class extends B0(app){options;initial_value;scope;constructor(e,t,n){super(e,t,{app:e,onMarkdownScroll:()=>{},getMode:()=>"source"}),this.options={...fu,...n},this.initial_value=this.options.value,this.scope=new jd.Scope(this.app.scope),this.scope.register(["Mod"],"Enter",(i,s)=>!0),this.owner.editMode=this,this.owner.editor=this.editor,this.set(n.value||"",!0),this.register(Ui(this.app.workspace,{setActiveLeaf:i=>(s,o)=>{this.activeCM.hasFocus||i.call(this.app.workspace,s,o)}})),this.options.onBlur!==fu.onBlur&&this.editor?.cm.contentDOM.addEventListener("blur",()=>{this._loaded&&this.options.onBlur(this)}),this.editor?.cm.contentDOM.addEventListener("focusin",()=>{this.app.keymap.pushScope(this.scope),this.app.workspace.activeEditor=this.owner}),this.editorEl.classList.remove("markdown-source-view"),n.cls&&this.editorEl.classList.add(...[].concat(n.cls)),n.cursorLocation&&this.editor?.cm.dispatch({selection:du.EditorSelection.range(n.cursorLocation.anchor,n.cursorLocation.head)})}onUpdate(e,t){super.onUpdate(e,t),t&&this.options.onChange(e)}buildLocalExtensions(){let e=super.buildLocalExtensions();return this.options.placeholder&&e.push((0,Ns.placeholder)(this.options.placeholder)),e.push(Ns.EditorView.domEventHandlers({paste:t=>{this.options.onPaste(t,this)}})),e.push(du.Prec.highest(Ns.keymap.of([{key:"Enter",run:t=>this.options.onEnter(this,!1,!1),shift:t=>this.options.onEnter(this,!1,!0)},{key:"Mod-Enter",run:t=>this.options.onEnter(this,!0,!1),shift:t=>this.options.onEnter(this,!0,!0)},{key:"Escape",run:t=>(this.options.onEscape(this),!0),preventDefault:!0}]))),e}getDynamicExtensions(){return super.getDynamicExtensions().filter(e=>!this.options.filteredExtensions.includes(e))}updateBottomPadding(e){return 0}destroy(){this._loaded&&this.unload(),this.app.keymap.popScope(this.scope),this.app.workspace.activeEditor===this.owner&&(this.app.workspace.activeEditor=null),this.containerEl.empty(),super.destroy()}onunload(){super.onunload(),this.destroy()}onload(){super.onload(),this.options.focus&&this.editor?.focus()}};var F0="0.2.3",Yd=4,Ls={version:F0,default_edit_mode:1,default_preview_mode:0,comment_style:"icon",editor_styling:!1,markup_focus:{0:{show_styling:!0,show_syntax:!0,show_metadata:!0,focus_annotation:!0,show_comment:!0},1:{show_styling:!0,show_syntax:!1,show_metadata:!1,focus_annotation:!0,show_comment:!1},2:{show_styling:!0,show_syntax:!1,show_metadata:!1,focus_annotation:!0,show_comment:!1}},diff_gutter:!0,diff_gutter_hide_empty:!0,annotation_gutter:!0,annotation_gutter_included_types:31,annotation_gutter_hide_empty:!0,annotation_gutter_default_fold_state:!1,annotation_gutter_fold_button:!0,annotation_gutter_resize_handle:!0,annotation_gutter_focus_on_click:!0,annotation_gutter_width:300,tag_completion:!0,tag_correcter:!0,clipboard_remove_syntax:!0,edit_info:!0,toolbar_preview_button:!0,toolbar_edit_button:!0,toolbar_show_buttons_labels:!0,status_bar_preview_button:!0,status_bar_edit_button:!0,status_bar_metadata_button:!0,database_workers:2,post_processor:!0,live_preview:!0,alternative_cursor_movement:!0,enable_metadata:!1,enable_author_metadata:!1,enable_timestamp_metadata:!1,enable_completed_metadata:!1,enable_style_metadata:!1,enable_color_metadata:!1,add_metadata:!1,add_author_metadata:!1,add_timestamp_metadata:!1,add_completed_metadata:!1,add_style_metadata:!1,add_color_metadata:!1,author:"",suggestion_mode_operations:{cursor_movement:{addition:"ignore_metadata",deletion:"ignore_metadata",substitution:"ignore_metadata",highlight:"ignore_metadata",comment:"ignore_completely"},bracket_movement:{addition:"stay_inside",deletion:"stay_inside",substitution:"stay_inside",highlight:"stay_inside",comment:"stay_inside"}}},Wd=new Set(["live_preview","diff_gutter","annotation_gutter","annotation_gutter_focus_on_click","comment_style","tag_completion","tag_correcter"]),Jd=new Set(["enable_metadata"]),Kd=new Set(["enable_metadata"]),qi=(s=>(s[s.ADDITION=1]="ADDITION",s[s.DELETION=2]="DELETION",s[s.SUBSTITUTION=4]="SUBSTITUTION",s[s.HIGHLIGHT=8]="HIGHLIGHT",s[s.COMMENT=16]="COMMENT",s))(qi||{});var ji=require("obsidian");var bi=(r=!1)=>{let e=Ui(ji.Menu.prototype,{onEnter:i=>function(s){let o=this.items[this.selected];return o&&o instanceof ji.MenuItem&&o.handleEvent(s)||!0},onMenuClick:i=>function(s){if(!r||this.currentSubmenu&&this.currentSubmenu.dom.contains(s.target))s.stopImmediatePropagation();else return i&&i.apply(this,[s])},hide:i=>function(){return this.parentMenu||n(),i&&i.apply(this)}}),t=Ui(ji.MenuItem.prototype,{setChecked:i=>function(...s){return this.checkIconEl&&(this.checkIconEl.remove(),this.checkIconEl=void 0),i&&i.apply(this,s)}}),n=()=>{e(),t()};return n},Qd=(r,e,t,n=()=>{})=>Ui(ji.MarkdownView.prototype,{setState:i=>async function(...s){return s[0]&&await r(this,s[0]),i&&i.apply(this,s)},getState:i=>function(){let s=i&&i.apply(this);return s&&e(this,s),s},setData:i=>async function(...s){s[1]&&t(this);let o=i&&i.apply(this,s);return s[1]&&n(this),o}}),Xd=(r,e,t)=>Ui(r.app.plugins,{uninstallPlugin:n=>async(...i)=>{try{i[0]===e&&await t()}catch{}n&&await n.apply(r.app.plugins,i)}});var vc=require("obsidian");function V0(r){if(r.children.length>0){let e=createSpan({cls:"cmtr-metadata-info-separator",text:" \u2022 "});r.appendChild(e)}}function yi(r,e,t="icon"){let n=createDiv({cls:["cmtr-metadata-info"].concat(e??[])});if(r.fields.author){let i=createSpan({cls:"cmtr-metadata-info-field"});if(t==="label"){let o=createSpan({cls:"cmtr-metadata-info-label",text:"Author: "});i.appendChild(o)}else if(t==="icon"){let o=createSpan({cls:"cmtr-metadata-info-icon"});(0,vc.setIcon)(o,"user"),i.appendChild(o)}let s=createSpan({cls:"cmtr-metadata-info-author-data",text:r.fields.author});i.appendChild(s),n.appendChild(i)}if(r.fields.time){t!=="icon"&&V0(n);let i=createSpan({cls:"cmtr-metadata-info-field"});if(t==="label"){let o=createSpan({cls:"cmtr-metadata-info-label",text:"Updated at: "});i.appendChild(o)}else if(t==="icon"){let o=createSpan({cls:"cmtr-metadata-info-icon"});(0,vc.setIcon)(o,"clock"),i.appendChild(o)}let s=createSpan({cls:"cmtr-metadata-info-time-data",text:window.moment.unix(r.fields.time).format("MMM DD YYYY, HH:mm")});i.appendChild(s),n.appendChild(i)}return n}var bc=class extends jt.Component{constructor(t,n){super();this.range=t;this.marker=n;this.text=t.unwrap(),this.annotation_container=this.marker.annotation_thread.createDiv({cls:"cmtr-anno-gutter-annotation"}),this.annotation_container.addEventListener("blur",this.renderPreview.bind(this)),this.annotation_container.addEventListener("dblclick",this.renderSource.bind(this)),this.annotation_container.addEventListener("contextmenu",this.onCommentContextmenu.bind(this)),this.range.metadata&&(this.metadata_view=yi(this.range),this.annotation_container.appendChild(this.metadata_view)),this.annotation_view=this.annotation_container.createDiv({cls:"cmtr-anno-gutter-annotation-view"}),this.renderPreview()}text;new_text=null;annotation_container;metadata_view=null;annotation_view;currentMode=null;editMode=null;onload(){super.onload()}onunload(){super.onunload(),this.annotation_container.remove(),this.editMode=null}renderSource(t){if(this.range.type!=="comment")new jt.Notice("[Commentator] You can only edit comments.");else{if(t?.stopPropagation(),this.currentMode==="source")return;let{app:n}=this.marker.view.state.field(jt.editorInfoField);if(this.annotation_container.toggleClass("cmtr-anno-gutter-annotation-editing",!0),this.range.fields.author&&this.range.fields.author!==n.plugins.plugins.commentator.settings.author){new jt.Notice("[Commentator] You cannot edit comments from other authors.");return}this.annotation_view.empty(),this.editMode=this.addChild(new vi(n,this.annotation_view,{value:this.text,cls:"cmtr-anno-gutter-annotation-editor",onSubmit:i=>{this.new_text=i.get(),this.renderPreview()},filteredExtensions:[n.plugins.plugins.commentator.editorExtensions],onBlur:i=>{this.new_text=i.get(),this.renderPreview()}})),this.currentMode="source"}}renderPreview(){if(this.currentMode!=="preview")if(this.annotation_container.toggleClass("cmtr-anno-gutter-annotation-editing",!1),this.text===this.new_text||this.new_text===null){let{app:t}=this.marker.view.state.field(jt.editorInfoField);if(this.new_text=null,this.editMode&&(this.removeChild(this.editMode),this.editMode=null),this.annotation_view.empty(),this.range.type!=="substitution"){let n="";switch(this.range.type){case"addition":n="Added: ";break;case"deletion":n="Deleted: ";break;case"highlight":break;case"comment":break}let i=createDiv({cls:"cmtr-anno-gutter-annotation-content"});jt.MarkdownRenderer.render(t,this.text||" ",i,"",this).then(()=>{(i.children[0]??i).prepend(createSpan({cls:"cmtr-anno-gutter-annotation-desc",text:n})),this.annotation_view.append(...i.childNodes),i.remove()})}else{let n=this.range.unwrap_parts(),i=createDiv(),s=createDiv();jt.MarkdownRenderer.render(t,n[0]||" ",i,"",this).then(()=>{(i.children[0]??i).prepend(createSpan({cls:"cmtr-anno-gutter-annotation-desc",text:"Changed: "})),this.annotation_view.append(...i.childNodes),jt.MarkdownRenderer.render(t,n[1]||" ",s,"",this).then(()=>{(s.children[0]??s).prepend(createSpan({cls:"cmtr-anno-gutter-annotation-desc",text:"To: "})),this.annotation_view.append(...s.childNodes),i.remove(),s.remove()})})}this.annotation_view.addClass("cmtr-anno-gutter-annotation-"+this.range.type),this.currentMode="preview"}else{let t=this.marker.view.state.field(ur);this.text=this.new_text,activeWindow.setTimeout(()=>{this.marker.view.dispatch({changes:{from:this.range.from,to:this.range.to,insert:jn(t,"comment",this.new_text)}})})}}onCommentContextmenu(t){t.preventDefault(),t.stopPropagation(),bi(!0);let n=new jt.Menu;this.range.type!=="comment"&&this.range.type!=="highlight"&&(n.addItem(i=>{i.setTitle("Accept changes").setIcon("check").setSection("close-annotation").onClick(()=>{this.marker.view.dispatch({changes:Yn(this.marker.view.state,this.range.from,this.range.to)})})}),n.addItem(i=>{i.setTitle("Reject changes").setIcon("cross").setSection("close-annotation").onClick(()=>{this.marker.view.dispatch({changes:Wn(this.marker.view.state,this.range.from,this.range.to)})})})),this.range.type==="comment"?(this.range.replies.length>0&&n.addItem(i=>{i.setTitle("Close comment thread").setIcon("message-square-off").setSection("close-annotation").onClick(()=>{this.marker.view.dispatch({changes:{from:this.range.full_range_front,to:this.range.full_range_back,insert:""}})})}),n.addItem(i=>{i.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{Kr(this.marker.view,this.range)})}),n.addItem(i=>{i.setTitle("Edit comment").setIcon("pencil").setSection("comment-handling").onClick(()=>{this.renderSource()})}),n.addItem(i=>{i.setTitle("Remove comment").setIcon("cross").setSection("comment-handling").onClick(()=>{this.marker.view.dispatch({changes:{from:this.range.from,to:this.range.to,insert:""}})})})):this.range.type!=="highlight"?(n.addItem(i=>{i.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{Kr(this.marker.view,this.range)})}),this.range.replies.length>0&&n.addItem(i=>{i.setTitle("Remove all comments").setIcon("message-square-x").setSection("comment-handling").onClick(()=>{this.marker.view.dispatch({changes:{from:this.range.replies[0].from,to:this.range.replies[this.range.replies.length-1].to,insert:""}})})})):n.addItem(i=>{i.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{Kr(this.marker.view,this.range)})}),n.addItem(i=>{i.setTitle("Fold gutter").setSection("gutter-controls").setIcon("arrow-right-from-line").onClick(()=>{this.marker.view.dispatch({annotations:[wi.of(null)]})})}),n.addItem(i=>{let s=i.setTitle("Included annotations").setIcon("eye").setSection("gutter-controls").setSubmenu(),o=this.marker.view.state.facet(an);for(let{title:a,icon:u,value:l}of[{title:"Additions",icon:"plus-circle",value:1},{title:"Deletions",icon:"minus-square",value:2},{title:"Substitutions",icon:"replace",value:4},{title:"Highlights",icon:"highlighter",value:8},{title:"Comments",icon:"message-square",value:16}])s.addItem(d=>{d.setTitle(a).setIcon(u).setChecked((o&l)!==0).onClick(()=>{o^=l,d.setChecked((o&l)!==0),this.marker.view.dispatch(this.marker.view.state.update({effects:[Es.reconfigure(an.of(o))]}))})})}),n.showAtPosition(t)}},hu=class extends eh.GutterMarker{constructor(t,n,i,s=0){super();this.annotation=t;this.annotations=n;this.view=i;this.itr=s}annotation_thread;component=new jt.Component;preventUnload=!1;eq(t){return this.itr===t.itr&&this.annotations===t.annotations&&this.annotations[0].equals(t.annotations[0])}onCommentThreadClick(){this.view.dispatch({annotations:[mu.of({marker:this,index:-1,scroll:!0,focus_markup:!0})]}),this.annotation_thread.classList.toggle("cmtr-anno-gutter-thread-highlight",!0)}toDOM(){this.annotation_thread=createDiv({cls:"cmtr-anno-gutter-thread"}),this.annotation_thread.addEventListener("click",this.onCommentThreadClick.bind(this));for(let t of this.annotations)this.component.addChild(new bc(t,this));return this.component.load(),this.annotation_thread}focus(){this.annotation_thread.focus()}focus_annotation(t=-1,n=!1){t===-1?this.annotation_thread.classList.toggle("cmtr-anno-gutter-thread-highlight",!0):t>=0&&t<this.annotation_thread.children.length&&this.annotation_thread.children.item(t).dispatchEvent(new MouseEvent("dblclick")),n&&activeWindow.setTimeout(()=>{let i=this.view.lineBlockAt(this.annotations[0].from).top-100;this.view.scrollDOM.scrollTo({top:i,behavior:"smooth"})},200)}unfocus_annotation(t=-1){t===-1?this.annotation_thread.classList.toggle("cmtr-anno-gutter-thread-highlight",!1):this.annotation_thread.children.item(t).classList.toggle("cmtr-anno-gutter-thread-highlight",!1)}destroy(t){this.component.unload(),this.annotation_thread.remove(),super.destroy(t)}};function Zd(r,e,t){let n=r.field(jt.editorEditorField),i=(t&1)!==0,s=(t&2)!==0,o=(t&4)!==0,a=(t&8)!==0,u=(t&16)!==0,l=[];for(let d of e){let c=d.full_thread;switch(u||(c=c.slice(0,1)),d.type){case"addition":i||c.shift();break;case"deletion":s||c.shift();break;case"substitution":o||c.shift();break;case"highlight":a||c.shift();break;case"comment":u||c.shift();break}if(c.length){let f=new hu(d,c,n,th);f.preventUnload=!0,l.push(f.range(d.from,d.to))}}return l}var th=0,qn=pu.StateField.define({create(r){let e=r.field(Pe).ranges.ranges.reduce((t,n)=>{let i=n.base_range;return t.includes(i)||t.push(i),t},[]);return pu.RangeSet.of(Zd(r,e,r.facet(an)))},update(r,e){let t=e.state.facet(an);if(e.startState.facet(an)!==t)return this.create(e.state);if(!e.docChanged)return r;th+=1;let n=[];for(let s of e.state.field(Pe).inserted_ranges)n.includes(s.base_range)||n.push(s.base_range);let i=e.state.field(Pe).deleted_ranges.map(s=>s.base_range);return r.map(e.changes).update({filter:(s,o,a)=>{let u=!i.includes(a.annotation);return a.preventUnload=u,u},add:Zd(e.state,n.map(s=>s.full_thread[0]),t)})}});var rh=require("@codemirror/view"),lr=require("obsidian");var _u=require("obsidian");var H0={mode:"preview",focus_mode:"click",onViewSwitch:()=>{},isEditable:()=>!0},gu=class extends _u.Component{constructor(t,n,i={}){super();this.app=t;this.container=n;this.options={...fu,...H0,...i},this.clickContainer=this.options.click_container??this.container,this.options.mode==="edit"?this.renderEdit():this.renderPreview()}options;currentMode;clickContainer;cleanup(){if(this.container.children.length!==0){this.container.className="";for(let t of this._children)t.unload();this._children=[],this.container.empty()}}unload(){this.container.remove(),super.unload()}getMode(){return this.currentMode}switchMode(){this.currentMode==="edit"?this.renderPreview():this.renderEdit(),this.options.onViewSwitch(this)}setMode(t){t==="edit"?this.renderEdit():this.renderPreview(),this.options.onViewSwitch(this)}renderEdit(){this.currentMode==="edit"||!this.options.isEditable(this)||(this.currentMode="edit",this.cleanup(),this.options.editor_cls&&this.container.addClass(...[].concat(this.options.editor_cls)),this.addChild(new vi(this.app,this.container,{...this.options,onSubmit:t=>{this.options.onSubmit(t),this.switchMode()},onBlur:t=>{this.options.onBlur(t),this.switchMode()},onEscape:t=>{this.options.onEscape(t),this.switchMode()}})))}renderPreview(){if(this.currentMode==="preview")return;this.currentMode="preview",this.cleanup(),this.options.preview_cls&&this.container.addClass(...[].concat(this.options.preview_cls)),_u.MarkdownRenderer.render(this.app,this.options.value,this.container,"",this);let t=()=>{this.clickContainer.removeEventListener(this.options.focus_mode,t),setImmediate(()=>{this.switchMode()})};this.clickContainer.addEventListener(this.options.focus_mode,t)}};function yc(r,e,t,n=!1){let i=t??e.text;!t&&n&&(e.to>=i.length&&!i.endsWith(gt[e.type].at(-1))?i=e.unwrap_bracket(!0):i=e.unwrap());let s=createSpan({cls:"cmtr-comment-icon"});(0,lr.setIcon)(s,"message-square");let o=null,a=new lr.Component;return s.onmouseenter=()=>{if(o)return;o=createDiv({cls:"cmtr-comment-tooltip"}),lr.MarkdownRenderer.render(r,i,o,"",a),a.load(),s.appendChild(o);let u=s.getBoundingClientRect(),l=o.getBoundingClientRect();o.style.left=u.x-l.x+12+"px"},s.onmouseleave=()=>{o&&(a.unload(),s.removeChild(o),o=null)},s}var Io=class extends rh.WidgetType{constructor(t,n,i=!1){super();this.view=t;this.range=n;this.annotation_gutter=i;this.component=new lr.Component}tooltip=null;icon=null;component;focused=!1;context_menu=null;setFocused(t){this.icon.classList.toggle("cmtr-comment-icon-focused",t),this.focused=t}renderRange(t,n,i=[]){let s=createDiv({cls:i});n.metadata&&s.appendChild(yi(n,"cmtr-comment-tooltip-metadata"));let o=s.appendChild(createDiv()),a=this.component.addChild(new gu(t,o,{value:n.unwrap(),editor_cls:["markdown-source-view","mod-cm6","cmtr-comment-tooltip-editor"],preview_cls:["cmtr-comment-tooltip-preview"],click_container:s,filteredExtensions:[t.plugins.plugins.commentator.editorExtensions],onSubmit:u=>{this.view.dispatch(this.view.state.update({changes:{from:n.from,to:n.to,insert:jn(this.view.state.field(ur),n.type,u.get())}}))},onBlur:u=>{this.view.dispatch(this.view.state.update({changes:{from:n.from,to:n.to,insert:jn(this.view.state.field(ur),n.type,u.get())}}))},isEditable:u=>n.fields.author&&n.fields.author!==t.plugins.plugins.commentator.settings.author?(new lr.Notice("[Commentator] You cannot edit comments from other authors."),!1):!0}));return s.addEventListener("contextmenu",u=>{u.preventDefault(),u.stopPropagation();let l=new lr.Menu;this.context_menu=l,l.dom.addEventListener("click",()=>{this.setFocused(!0)}),l.onHide(()=>{this.context_menu=null}),n.replies.length>0&&l.addItem(d=>{d.setTitle("Close comment thread").setIcon("message-square-off").setSection("close-annotation").onClick(()=>{this.view.dispatch({changes:{from:n.full_range_front,to:n.full_range_back,insert:""}}),this.unrenderTooltip()})}),l.addItem(d=>{d.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{let c=this.tooltip.appendChild(createDiv({cls:"cmtr-comment-tooltip-range cmtr-comment-tooltip-reply"})),f=this.component.addChild(new vi(t,c,{value:"",cls:["markdown-source-view","mod-cm6","cmtr-comment-tooltip-editor"],filteredExtensions:[t.plugins.plugins.commentator.editorExtensions],onSubmit:p=>{this.view.dispatch(this.view.state.update({changes:{from:n.full_range_back,to:n.full_range_back,insert:jn(this.view.state.field(ur),n.type,p.get())}})),this.unrenderTooltip()},onEscape:()=>{f.unload(),c.remove()},onBlur:p=>{let m=p.get();m.trim()&&this.view.dispatch(this.view.state.update({changes:{from:n.full_range_back,to:n.full_range_back,insert:jn(this.view.state.field(ur),n.type,m)}})),f.unload(),c.remove()}}))})}),l.addItem(d=>{d.setTitle("Edit comment").setIcon("pencil").setSection("comment-handling").onClick(()=>{a.setMode("edit")})}),l.addItem(d=>{d.setTitle("Remove comment").setIcon("cross").setSection("comment-handling").onClick(c=>{this.tooltip.removeChild(s),this.view.dispatch({changes:{from:n.from,to:n.to,insert:""}}),a.unload()})}),l.showAtMouseEvent(u)}),s}renderTooltip(){if(!this.tooltip){let{app:t}=this.view.state.field(lr.editorInfoField);this.tooltip=createDiv({cls:"cmtr-comment-tooltip popover hover-popover"}),this.component.registerDomEvent(this.view.dom.doc,"click",u=>{this.tooltip&&!(this.context_menu&&this.context_menu.dom.contains(u.target))&&(this.tooltip.contains(u.target)?(this.setFocused(!0),u.stopPropagation()):(this.unrenderTooltip(),this.setFocused(!1)))}),this.tooltip.addEventListener("mouseleave",u=>{!this.focused&&!this.context_menu&&!this.tooltip.contains(u.relatedTarget)&&this.unrenderTooltip()}),this.tooltip.appendChild(this.renderRange(t,this.range,["cmtr-comment-tooltip-range cmtr-comment-tooltip-base"]));for(let u of this.range.replies)this.tooltip.appendChild(this.renderRange(t,u,["cmtr-comment-tooltip-range","cmtr-comment-tooltip-reply"]));this.component.load(),this.view.dom.doc.body.appendChild(this.tooltip);let n=this.icon.getBoundingClientRect(),i=this.tooltip.getBoundingClientRect(),s=this.view.contentDOM.getBoundingClientRect(),o=Math.clamp(n.x-i.x-i.width/2+12,t.vault.getConfig("readableLineLength")?0:s.x,s.x+s.width-i.width-12),a=n.y+(n.height+i.height>this.view.scrollDOM.clientHeight?-i.height:n.height)+4;this.tooltip.style.left=o+"px",this.tooltip.style.top=a+"px"}}focusAnnotation(t){this.view.dispatch({annotations:[Mn.of({from:this.range.from,to:this.range.to})]})}unrenderTooltip(){this.component.unload(),this.tooltip&&(this.tooltip.remove(),this.tooltip=null),this.setFocused(!1)}toDOM(t){return this.icon=createSpan({cls:"cmtr-comment-icon"}),(0,lr.setIcon)(this.icon,"message-square"),this.annotation_gutter&&(this.icon.onclick=n=>this.focusAnnotation(n),this.icon.oncontextmenu=n=>{n.preventDefault();let i=new lr.Menu;i.addItem(s=>{s.setTitle("Close comment thread").setIcon("message-square-off").setSection("close-annotation").onClick(()=>{this.view.dispatch({changes:{from:this.range.full_range_front,to:this.range.full_range_back,insert:""}})})}),i.addItem(s=>{s.setTitle("Focus annotation").setSection("comment-handling").setIcon("eye").onClick(o=>this.focusAnnotation(o))}),i.addItem(s=>{s.setTitle("Add comment").setSection("comment-handling").setIcon("message-square").onClick(o=>{o.preventDefault(),Kr(t,this.range)})}),i.showAtMouseEvent(n)}),this.range.length&&(this.icon.onmouseenter=()=>{this.renderTooltip()},this.icon.onclick=n=>{this.renderTooltip(),this.setFocused(!0),this.focusAnnotation(n),n.stopPropagation()},this.icon.onmouseleave=n=>{!this.focused&&!this.context_menu&&this.tooltip&&!(this.tooltip.contains(n.relatedTarget)||this.icon.getBoundingClientRect().bottom-n.clientY<6)&&(this.unrenderTooltip(),this.focused=!1)}),this.icon}destroy(t){this.unrenderTooltip(),super.destroy(t)}};var Yi=require("@codemirror/state"),Bs=require("@codemirror/view");var Fs=Yi.StateEffect.define(),Do=Yi.StateField.define({create(r){return{from:r.selection.main.from,to:r.selection.main.to}},update(r,e){for(let t of e.effects)if(t.is(Fs))return t.value;return r}}),wc=Yi.StateField.define({create(r){return Bs.Decoration.none},update(r,e){let t=e.startState.field(Do,!1),n=e.state.field(Do);if(t!==n){let i=e.state.field(Pe).ranges.ranges_in_interval(n.from,n.to);return i.length&&i[0].base_range===i.at(-1)?.base_range&&n.from>=i[0].from&&n.to<=i.at(-1).to?Yi.RangeSet.of([Bs.Decoration.mark({attributes:{class:"cmtr-focused"}}).range(i[0].full_range_front,i[0].full_range_back)]):Bs.Decoration.none}else return r},provide(r){return Bs.EditorView.decorations.from(r)}});var No=require("@codemirror/state"),Jn=require("@codemirror/view"),Ji=require("obsidian");var Po=Jn.Decoration.replace({}),xc=(r,e="",t=!1)=>Jn.Decoration.mark({attributes:{"data-contents":"string","data-type":"cmtr-"+r.repr.toLowerCase(),class:e,style:t&&r.fields.color?`background-color: #${r.fields.color};`:""}});function Nr(r,e,t,n=!1){n||(t===-1?r.push(Po.range(e.from,e.from+3)):t===1?r.push(Po.range(e.to-3,e.to)):r.push(Po.range(e.middle,e.middle+2)))}function Ro(r,e,t=!1){!e.metadata||t||r.push(Po.range(e.from+3,e.metadata+2))}function vu(r,e){r.push(Po.range(e.from,e.to))}function Wi(r,e,t,n=0,i=!1,s=!0){let o=i?0:3;n===0?e.empty()||r.push(xc(e,t,s).range(e.from+o,e.to-o)):n<0?e.part_is_empty(!0)||r.push(xc(e,t,s).range(e.from+o,e.middle)):n>0&&(e.part_is_empty(!1)||r.push(xc(e,t,s).range(e.middle+2,e.to-o)))}function kc(r,e,t=""){Nr(r,e,-1),Ro(r,e),Wi(r,e,t),Nr(r,e,1)}function bu(r,e,t,n,i,s){let o=[],{show_styling:a,show_syntax:u,show_metadata:l,show_comment:d}=s.markup_focus[i];for(let c of e)if(n===0){let f=t?t.ranges.some(v=>c.partially_in_full_range(v.from,v.to)):void 0,p=`cmtr-inline cmtr-${c.repr.toLowerCase()} `+(c.fields.style||"");c.replies.length&&(p+=" cmtr-has-reply");let m=f?u:void 0,g=f?l:void 0,_=f?a:void 0;!(d&&f)&&c.type==="comment"&&s.comment_style!=="inline"?s.comment_style==="icon"&&c.base_range===c?o.push(Jn.Decoration.replace({widget:new Io(r,c,s.annotation_gutter)}).range(c.from,c.to)):o.push(Jn.Decoration.replace({}).range(c.from,c.to)):(Nr(o,c,-1,m),Ro(o,c,g),c.type==="substitution"?(Wi(o,c,p+" cmtr-deletion",-1,!1,_),Nr(o,c,0,m),Wi(o,c,p+" cmtr-addition",1,!1,_)):Wi(o,c,p,0,!1,_),Nr(o,c,1,m))}else n===1?c.type==="addition"?kc(o,c,"cmtr-accepted"):c.type==="deletion"?vu(o,c):c.type==="substitution"?(Nr(o,c,-1),Ro(o,c),Nr(o,c,0),Wi(o,c,"cmtr-accepted",1),Nr(o,c,1)):c.type==="comment"?vu(o,c):kc(o,c,""):n===2&&(c.type==="addition"?vu(o,c):c.type==="deletion"?(Nr(o,c,-1),Ro(o,c),Wi(o,c,"cmtr-accepted"),Nr(o,c,1)):c.type==="substitution"?(Nr(o,c,-1),Ro(o,c),Wi(o,c,"cmtr-accepted",-1),Nr(o,c,0),Nr(o,c,1)):c.type==="comment"?vu(o,c):kc(o,c,""));return o}var Sc=r=>No.StateField.define({create(e){if(!e.field(Ji.editorLivePreviewField))return Jn.Decoration.none;let n=e.facet(qt),i=e.facet(kr),s=e.field(Pe),o=e.field(Ji.editorEditorField);return No.RangeSet.of(bu(o,s.ranges.ranges,null,n,i,r))},update(e,t){let n=t.state.field(Ji.editorLivePreviewField);if(!n)return Jn.Decoration.none;let i=t.state.facet(qt),s=t.state.facet(kr),o=t.state.field(Pe),a=t.state.field(Ji.editorEditorField);if(n!==t.startState.field(Ji.editorLivePreviewField)||i!==t.startState.facet(qt)||t.effects.some(u=>u.is(Os)))return No.RangeSet.of(bu(a,o.ranges.ranges,t.state.selection,i,s,r));if(t.docChanged||!t.docChanged&&o.inserted_ranges.length){let u=0;return e.update({filter:(l,d,c)=>{for(;u<o.deleted_ranges.length&&o.deleted_ranges[u].to<=l;)u++;let f=o.deleted_ranges[u];return!(f&&l<f.to&&f.from<d)}}).map(t.changes).update({add:bu(a,o.inserted_ranges,t.state.selection,i,s,r)})}if(t.newSelection!==t.startState.selection){let u=t.newSelection;for(let c of t.startState.selection.ranges)u=u.addRange(c);let l=o.ranges.ranges_in_intervals(u.ranges),d=0;return e.map(t.changes).update({filter:(c,f,p)=>{for(;d<l.length&&l[d].to<=c;)d++;let m=l[d];return!(m&&c<m.to&&m.from<f)},add:bu(a,l,t.newSelection,i,s,r)})}return e},provide(e){return Jn.EditorView.decorations.from(e)}});var Lo=24,nh=cn.Facet.define({combine:r=>r.some(e=>e)}),Ec=cn.Facet.define(),Mn=cn.Annotation.define(),wi=cn.Annotation.define(),mu=cn.Annotation.define(),wu=cn.Annotation.define(),xu=cn.Annotation.define(),ku=cn.Annotation.define(),Su=cn.Annotation.define(),yu=class extends Ps{previously_focused=void 0;constructor(e){super(e,nh,Ec),e.dom.parentElement.classList.contains("markdown-source-view")||(this.dom.style.display="none",setImmediate(()=>{e.dispatch(e.state.update({effects:[Tu.reconfigure([])]}))}))}debouncedMoveGutter=(0,ln.debounce)(this.moveGutter.bind(this),200);createGutters(e){return e.state.facet(Ec).map(t=>new $c(e,t,this.dom))}insertGutters(e){e.contentDOM.parentNode.insertBefore(this.dom,e.contentDOM.nextSibling)}insertDetachedGutters(e){this.view.contentDOM.parentNode.insertBefore(this.dom,this.view.contentDOM.nextSibling)}getUpdateContexts(){return this.gutters.map(e=>new Tc(e,this.view.viewport,-this.view.documentPadding.top))}update(e){for(let t of e.transactions){let n=t.annotation(mu);if(n){let{marker:i,index:s,scroll:o=!1,focus_markup:a=!1}=n;this.unfocusAnnotation(),this.focusAnnotation(i,s,o,a)}}super.update(e)}unfocusAnnotation(){this.previously_focused?.unfocus_annotation(),this.previously_focused=void 0}focusAnnotation(e,t,n=!1,i=!1){this.previously_focused=e,this.debouncedMoveGutter(e),e.focus_annotation(t,n),i&&activeWindow.setTimeout(()=>{this.view.dispatch(this.view.state.update({effects:[Fs.of({from:e.annotation.from,to:e.annotation.full_range_back})]}))})}updateGutters(e){let t=e.transactions.flatMap(n=>n.annotation(Mn)).find(n=>n);if((t||e.startState.selection!==e.state.selection)&&this.unfocusAnnotation(),t){let{from:n,to:i,index:s=-1,scroll:o=!1}=t;e:for(let a of this.gutters[0].elements)if(n>=a.block.from){for(let u of a.markers)if(n>=u.annotation.from&&i<=u.annotation.full_range_back){this.focusAnnotation(u,s,o);break e}}else if(n<a.block.from)break}return super.updateGutters(e)}moveGutter(e){let t=this.gutters[0],n=t.elements.find(u=>u.markers.includes(e));if(!n)return;let i=n.markers.indexOf(e),s=n.block.top,o=n.dom.children[i].offsetTop,a=s-o;if(Math.abs(a)>=10&&a){let u=t.elements[0];u.dom.style.marginTop=parseInt(u.dom.style.marginTop||"0")+a+"px"}}foldGutter(){this.gutters[0].foldGutter()}},Eu=lu(yu);function ih(r){return cu(Eu,r,Ec,nh)}var Tc=class extends Ao{constructor(t,n,i){super(t,n,i);this.gutter=t;this.height=i;this.previous_element_end=i}previous_element_end=0;new_gutter_elements=[];added_elements=[];async addElement(t,n,i){let s=Math.max(n.top-this.previous_element_end,0),o=s<=0?this.previous_element_end:n.top;i.sort((d,c)=>d.annotation.from-c.annotation.from);let u=this.gutter.elements[this.i]?.dom.clientHeight||36,l=this.gutter.elements.findIndex(d=>uu(d.markers,i));if(l!==-1){let d=this.gutter.elements[l];for(let c=this.i;c<l;c++)this.gutter.dom.removeChild(this.gutter.elements[c].dom),this.gutter.elements[c].destroy();for(let c of this.added_elements)this.gutter.dom.insertBefore(c.dom,d.dom);this.new_gutter_elements.push(...this.added_elements),this.added_elements=[],this.i=l+1,this.new_gutter_elements.push(d),d.update(t,u,s,i,n)}else this.added_elements.push(new Mc(t,u,s,i,n));this.previous_element_end=o+u}finish(){for(let t=this.i;t<this.gutter.elements.length;t++)this.gutter.dom.removeChild(this.gutter.elements[t].dom),this.gutter.elements[t].destroy();for(let t of this.added_elements)this.gutter.dom.appendChild(t.dom);this.gutter.elements=[...this.new_gutter_elements,...this.added_elements],this.new_gutter_elements=[],this.added_elements=[]}},$c=class extends _i{constructor(t,n,i){super(t,n);this.view=t;this.config=n;this.gutterDom=i;this.folded=n.foldState,this.width=n.width,this.view.dom.parentElement?.parentElement?.parentElement?.classList.contains("markdown-embed")&&(this.folded=!0),this.hide_on_empty=n.hideOnEmpty,this.add_fold_button=n.includeFoldButton,this.add_resize_handle=n.includeResizeHandle,this.hide_on_empty&&t.state.field(qn).size===0||this.folded?this.dom.style.width="0":this.dom.style.width=this.width+"px",this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.folded?"0px":this.width+"px"),this.gutterDom.style.marginInlineStart=this.folded?"0":Lo+"px",this.gutter_position=this.view.scrollDOM.getBoundingClientRect().right-this.view.contentDOM.getBoundingClientRect().right+Lo,this.add_fold_button&&this.createFoldButton(),this.add_resize_handle&&this.createResizeHandle()}folded=!1;hide_on_empty=!1;width=0;add_fold_button=!1;add_resize_handle=!1;gutter_position=0;fold_button_el=void 0;resize_handle_el=void 0;createFoldButton(){let t=createEl("a",{cls:["view-action"]});(0,ln.setIcon)(t,"arrow-right-from-line"),t.setAttribute("data-tooltip-position","left"),t.style.display=this.view.state.field(qn).size?"":"none",t.onclick=()=>{this.folded=!this.folded,this.view.state.field(ln.editorInfoField).app.workspace.requestSaveLayout(),this.foldGutter()},this.setFoldButtonState(),this.fold_button_el=createDiv({cls:["cmtr-anno-gutter-button"]}),this.fold_button_el.appendChild(t),this.gutterDom.appendChild(this.fold_button_el)}createResizeHandle(){this.resize_handle_el=createEl("hr",{cls:["cmtr-anno-gutter-resize-handle"]}),this.resize_handle_el.style.display=this.view.state.field(qn).size&&!this.folded?"":"none",this.resize_handle_el.addEventListener("mousedown",t=>{let n=t.clientX,i=this.view.state.field(ln.editorInfoField).app.vault.getConfig("readableLineLength"),s=this.view.dom.doc.styleSheets[0],o=(0,ln.debounce)(d=>{this.width=Math.round(Math.max(0,d)),this.view.state.field(ln.editorInfoField).app.workspace.requestSaveLayout(),this.dom.style.width=this.width+"px",this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px"),i&&(s.deleteRule(s.cssRules.length-1),s.insertRule(`.cmtr-anno-gutter-resizing .cm-line { width: ${this.view.contentDOM.clientWidth}px !important; }`,s.cssRules.length),this.gutter_position=this.view.scrollDOM.getBoundingClientRect().right-this.view.contentDOM.getBoundingClientRect().right+Lo)},25);this.resize_handle_el.classList.toggle("cmtr-anno-gutter-resize-handle-hover",!0),this.view.scrollDOM.classList.toggle("cmtr-anno-gutter-resizing",!0);let a=parseInt(this.dom.style.width.slice(0,-2)),u=d=>{let c=d.clientX-n;return n=d.clientX,a-=c,o(a),!0},l=()=>{this.view.dom.doc.removeEventListener("mousemove",u),this.view.dom.doc.removeEventListener("mouseup",l),this.resize_handle_el.classList.toggle("cmtr-anno-gutter-resize-handle-hover",!1),this.view.scrollDOM.classList.toggle("cmtr-anno-gutter-resizing",!1),i&&s.deleteRule(s.cssRules.length-1)};return this.view.dom.doc.addEventListener("mousemove",u),this.view.dom.doc.addEventListener("mouseup",l),!0}),this.gutterDom.appendChild(this.resize_handle_el)}setFoldButtonState(){this.fold_button_el&&(this.folded?(this.fold_button_el.children[0].setAttribute("style","rotate: -180deg;"),this.fold_button_el.children[0].ariaLabel="Unfold gutter",this.resize_handle_el&&(this.resize_handle_el.style.display="none")):(this.fold_button_el.children[0].setAttribute("style","rotate: 0deg;"),this.fold_button_el.children[0].ariaLabel="Fold gutter",this.resize_handle_el&&(this.resize_handle_el.style.display="")))}foldGutter(){if(this.setFoldButtonState(),this.folded?this.elements.forEach(t=>{Array.from(t.dom.getElementsByClassName("cmtr-anno-gutter-annotation")).forEach(n=>{n.setAttribute("style",`max-height: ${n.clientHeight}px; overflow: hidden;`)})}):this.dom.addEventListener("transitionend",()=>{this.elements.forEach(t=>{Array.from(t.dom.getElementsByClassName("cmtr-anno-gutter-annotation")).forEach(n=>{n.removeAttribute("style")})})},{once:!0}),this.dom.style.width=this.folded?"0":this.width+"px",this.gutterDom.style.marginInlineStart=this.folded?"0":Lo+"px",this.view.state.field(ln.editorInfoField).app.vault.getConfig("readableLineLength")){let t=parseInt(getComputedStyle(this.view.scrollDOM).getPropertyValue("--file-line-width").trim()),n=Math.max(0,this.view.scrollDOM.innerWidth-t),i=Math.max(0,n-this.width),s=(this.folded?n:i)/2,o=(this.folded?i:n)/2;this.view.contentDOM.style.width=this.view.contentDOM.clientWidth+(this.folded?Lo:0)+"px !important",this.view.scrollDOM.children[0].setAttribute("style",`margin: 0 ${o}px; transition: margin 0.4s ease-in-out, max-width 0.4s ease-in-out;`),this.folded||this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px"),setTimeout(()=>{this.view.scrollDOM.children[0].setAttribute("style",`margin: 0 ${s}px; transition: margin 0.4s ease-in-out, max-width 0.4s ease-in-out;`),this.dom.addEventListener("transitionend",()=>{this.view.contentDOM.removeAttribute("style"),this.view.scrollDOM.children[0].removeAttribute("style"),this.folded&&this.view.dom.style.setProperty("--cmtr-anno-gutter-width","0px")},{once:!0})})}}update(t){let n=super.update(t),i=t.state.field(qn);for(let s of t.transactions){let o=s.annotation(wi),a=s.annotation(wu),u=s.annotation(xu),l=s.annotation(ku),d=s.annotation(Su);a!==void 0&&(this.width=a,!this.hide_on_empty&&!this.folded&&(this.dom.style.width=a+"px",this.setFoldButtonState()),this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px")),o!==void 0&&(o===null?(this.folded=!this.folded,this.view.state.field(ln.editorInfoField).app.workspace.requestSaveLayout()):this.folded=o,this.foldGutter()),u!==void 0&&(this.hide_on_empty=u,this.hide_on_empty&&i.size===0?this.dom.style.width="0":this.dom.style.width=this.width+"px",this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px")),l!==void 0&&(this.add_fold_button=l,this.add_fold_button&&!this.fold_button_el?this.createFoldButton():!this.add_fold_button&&this.fold_button_el&&(this.fold_button_el.remove(),this.fold_button_el=void 0),this.setFoldButtonState()),d!==void 0&&(this.add_resize_handle=d,this.add_resize_handle&&!this.resize_handle_el?this.createResizeHandle():!this.add_resize_handle&&this.resize_handle_el&&(this.resize_handle_el.remove(),this.resize_handle_el=void 0))}return i.size!==t.startState.field(qn).size&&(i.size===0?(this.fold_button_el&&(this.fold_button_el.style.display="none"),this.resize_handle_el&&(this.resize_handle_el.style.display="none"),this.hide_on_empty&&(this.dom.style.width="0")):(this.fold_button_el&&(this.fold_button_el.style.display=""),this.resize_handle_el&&(this.resize_handle_el.style.display=""),this.folded||(this.dom.style.width=this.width+"px"))),n}destroy(){this.fold_button_el?.remove(),this.resize_handle_el?.remove(),super.destroy()}},Mc=class extends Rs{constructor(t,n,i,s,o=null){super(t,n,i,s);this.block=o}update(t,n,i,s,o=null){this.block=o,this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),uu(this.markers,s)||this.setMarkers(t,s)}};var oh=r=>[qn,ih({class:"cmtr-anno-gutter "+(r.app.vault.getConfig("cssTheme")==="Minimal"?" is-minimal":""),markers:e=>e.state.field(qn),foldState:r.settings.annotation_gutter_default_fold_state,width:r.settings.annotation_gutter_width,hideOnEmpty:r.settings.annotation_gutter_hide_empty,includeFoldButton:r.settings.annotation_gutter_fold_button,includeResizeHandle:r.settings.annotation_gutter_resize_handle})],Tu=new sh.Compartment;var lh=require("obsidian"),ch=require("@codemirror/state");var Bo=require("@codemirror/state"),mx=require("@codemirror/view");var ah=Bo.Facet.define({combine:r=>r.some(e=>e)}),Oc=Bo.Facet.define(),$u=Bo.Annotation.define(),Cc=class extends Ps{constructor(e){super(e,ah,Oc),e.dom.parentElement.classList.contains("markdown-source-view")||(this.dom.style.display="none",setImmediate(()=>{e.dispatch(e.state.update({effects:[Mu.reconfigure([])]}))}))}createGutters(e){return e.state.facet(Oc).map(t=>new Ac(e,t))}},Ac=class extends _i{constructor(t,n){super(t,n);this.view=t;this.config=n;this.hide_on_empty=n.hideOnEmpty}hide_on_empty=!1;showing=!0;update(t){let n=super.update(t);for(let i of t.transactions){let s=i.annotation($u);s!==void 0&&(this.hide_on_empty=s)}return this.showing&&this.hide_on_empty&&t.state.field(Pe).ranges.empty()?(this.dom.parentElement.classList.add("gutter-hidden"),this.showing=!1):!this.showing&&(!this.hide_on_empty||!t.state.field(Pe).ranges.empty())&&(this.dom.parentElement.classList.remove("gutter-hidden"),this.showing=!0),n}},G0=lu(Cc);function uh(r){return cu(G0,r,Oc,ah)}var Ou=require("@codemirror/state"),Cu=require("@codemirror/view");var Ic=class extends Cu.GutterMarker{constructor(t,n,i){super();this.type=t;this.top=n;this.bottom=i}toDOM(){let t="";return this.type.has("addition")&&(t+="cmtr-diff-gutter-addition "),this.type.has("deletion")&&(t+="cmtr-diff-gutter-deletion "),this.type.has("substitution")&&(t+="cmtr-diff-gutter-substitution "),this.top&&(t+="cmtr-diff-gutter-top "),this.bottom&&(t+="cmtr-diff-gutter-bottom "),createDiv({cls:t})}},Dc=Cu.ViewPlugin.fromClass(class{markers=Ou.RangeSet.empty;constructMarkers(e){let t=e.state.field(Pe).ranges,n=new Ou.RangeSetBuilder,i={};for(let s of t.ranges_in_interval(e.viewport.from,e.viewport.to)){let o=e.state.doc.lineAt(s.from).number,a=e.state.doc.lineAt(s.to).number,u=Array.from({length:a-o+1},(l,d)=>o+d);i[o]?i[o].isStart=!0:i[o]={isStart:!0,isEnd:!1,types:new Set};for(let l of u)i[l]?(i[l].isEnd=!1,i[l].types.add(s.type)):i[l]={isStart:!1,isEnd:!1,types:new Set([s.type])};i[a]&&(i[a].isEnd=!0)}for(let[s,o]of Object.entries(i)){let a=e.state.doc.line(Number(s));n.add(a.from,a.to,new Ic(o.types,o.isStart,o.isEnd))}this.markers=n.finish()}constructor(e){this.constructMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.heightChanged)&&this.constructMarkers(e.view)}});var fh=[Dc,uh({class:"cmtr-diff-gutter",markers:r=>r.plugin(Dc).markers,domEventHandlers:{click:(r,e,t)=>{let n=new lh.Menu;return n.addItem(i=>{i.setTitle("Accept changes").setIcon("check").onClick(()=>{r.dispatch({changes:Yn(r.state,e.from,e.to)})})}),n.addItem(i=>{i.setTitle("Reject changes").setIcon("cross").onClick(()=>{r.dispatch({changes:Wn(r.state,e.from,e.to)})})}),n.showAtMouseEvent(t),!1}}})],Mu=new ch.Compartment;function dh(r,e){let t={};for(let n in r)r[n]!==e[n]&&(t[n]=r[n]);return t}function hh(r){let e=r.lastIndexOf(".");return e===-1||e===r.length-1||e===0?r:r.slice(0,e)}var U0=r=>Object.entries(_d).map(([e,t])=>({id:`toggle-${e.toLowerCase()}`,name:`Mark as ${e}`,icon:e.toLowerCase(),editor_context:!0,regular_callback:(n,i)=>{mh(n,t,r.settings)}})),q0=r=>[{id:"accept-all-suggestions",name:"Accept all suggestions",icon:"check-check",editor_context:!0,regular_callback:(e,t)=>{e.cm.dispatch(e.cm.state.update({changes:Yn(e.cm.state)}))}},{id:"reject-all-suggestions",name:"Reject all suggestions",icon:"cross",editor_context:!0,regular_callback:(e,t)=>{e.cm.dispatch(e.cm.state.update({changes:Wn(e.cm.state)}))}},{id:"accept-selected-suggestions",name:"Accept suggestions in selection",icon:"check",editor_context:!0,check_callback:(e,t,n)=>{let i=Rc(t.cm.state);if(e||!i)return i;let o=t.cm.state.selection.ranges.map(a=>Yn(t.cm.state,a.from,a.to));t.cm.dispatch(t.cm.state.update({changes:o}))}},{id:"reject-selected-suggestions",name:"Reject suggestions in selection",icon:"cross",editor_context:!0,check_callback:(e,t,n)=>{let i=Rc(t.cm.state);if(e||!i)return i;let o=t.cm.state.selection.ranges.map(a=>Wn(t.cm.state,a.from,a.to));t.cm.dispatch(t.cm.state.update({changes:o}))}},{id:"comment",name:"Add comment",icon:"message-square",editor_context:!0,regular_callback:(e,t)=>{Kr(e.cm,e.cm.state.field(Pe).ranges.at_cursor(e.cm.state.selection.main.head))}},{id:"fold-gutter",name:"Fold annotation gutter",icon:"arrow-right-from-line",editor_context:!0,regular_callback:(e,t)=>{e.cm.dispatch({annotations:[wi.of(null)]})}},{id:"toggle-preview-mode",name:"Cycle preview mode",icon:"comment",editor_context:!0,regular_callback:(e,t)=>{let n=(e.cm.state.facet(qt)+1)%3;e.cm.dispatch(e.cm.state.update({effects:Ts.reconfigure(qt.of(n))})),r.setPreviewMode(t,n)}},{id:"suggest-mode",name:"Toggle suggestion mode",icon:"file-edit",editor_context:!0,regular_callback:(e,t)=>{let i=e.cm.state.facet(kr)===2?1:2;e.cm.dispatch(e.cm.state.update({effects:[$s.reconfigure(kr.of(i)),Ms.reconfigure(gi(i,r.settings))]})),r.setEditMode(t,i)}},{id:"generate-text-diff",name:"Generate text diff from clipboard",icon:"diff",editor_context:!0,regular_callback:async(e,t)=>{let n=await navigator.clipboard.readText(),i=e.cm.state.field(Pe).ranges,s=e.cm.state.selection.main,o=i.unwrap_in_range(e.cm.state.doc,s.from,s.to).output,a=gh(r.settings,o,n);e.cm.dispatch(e.cm.state.update({changes:[{from:s.from,to:s.to,insert:a}]}))}},{id:"save-clean-copy",name:Pc.Platform.isMacOS?"Duplicate current file without markup":"Make a copy of the current file without markup",icon:"copy",editor_context:!0,regular_callback:async(e,t)=>{if(t.file){let n=r.app.vault.getAvailablePath(hh(t.file.path),t.file.extension),i=await r.app.vault.read(t.file),s=await r.app.vault.copy(t.file,n),o=Ua(i,(a,u)=>a.unwrap(),e.cm.state.field(Pe).ranges.ranges);await r.app.vault.modify(s,o),await r.app.workspace.getLeaf("tab").openFile(s,{active:!0,eState:{rename:"all"}})}}}],j0=r=>[{id:"view",name:"Open global annotation view",icon:"comment",regular_callback:async()=>{await r.activateView()}}],ph=r=>Y0([...U0(r),...q0(r),...j0(r)]);function Y0(r){for(let e of r)Pc.Platform.isMobile||e.editor_context?e.regular_callback?(e.editorCallback=e.regular_callback,delete e.regular_callback):(e.editorCheckCallback=e.check_callback,delete e.check_callback):e.regular_callback?(e.callback=e.regular_callback,delete e.regular_callback):(e.checkCallback=e.check_callback,delete e.check_callback);return r}var _h=r=>r.app.workspace.on("editor-menu",(e,t)=>{let n=t.cm.state.field(Pe).ranges;if(e.addItem(i=>{i.setTitle("Add comment").setIcon("message-square").setSection("commentator").onClick(()=>{Kr(t.cm,n.at_cursor(t.cm.state.selection.main.head))})}),n.contains_range(t.cm.state.selection.main.from,t.cm.state.selection.main.to)&&(e.addItem(i=>{i.setTitle("Accept changes").setIcon("check").setSection("commentator").onClick(()=>{let o=t.cm.state.selection.ranges.map(a=>Yn(t.cm.state,a.from,a.to));t.cm.dispatch(t.cm.state.update({changes:o}))})}),e.addItem(i=>{i.setTitle("Reject changes").setIcon("cross").setSection("commentator").onClick(()=>{let o=t.cm.state.selection.ranges.map(a=>Wn(t.cm.state,a.from,a.to));t.cm.dispatch(t.cm.state.update({changes:o}))})}),wd(t.cm.state.selection))){let i=t.cm.state.field(Pe).ranges.at_cursor(t.cm.state.selection.ranges[0].head);e.addItem(s=>{let o=s.setTitle("Set metadata").setIcon("tags").setSection("commentator").setSubmenu();o.addItem(a=>{a.setTitle("Set author").setIcon("lucide-user").onClick(()=>{t.cm.dispatch(t.cm.state.update({changes:i.add_metadata("author",r.settings.author)}))})}),o.addItem(a=>{a.setTitle("Set time").setIcon("lucide-calendar").onClick(()=>{t.cm.dispatch(t.cm.state.update({changes:i.add_metadata("time",Math.round(Date.now()/1e3))}))})}),o.addItem(a=>{a.setTitle("Set completed").setIcon("lucide-check").onClick(()=>{t.cm.dispatch(t.cm.state.update({changes:i.add_metadata("done",!0)}))})})})}}),vh=r=>r.app.workspace.on("markdown-viewport-menu",(e,t,n,i)=>{if(r.settings.annotation_gutter){let s=t.editor.cm,o=s.state.field(an);bi(!0),e.addItem(a=>{a.setTitle("Fold gutter").setIcon("arrow-right-from-line").setSection("commentator").onClick(()=>{s.dispatch(s.state.update({annotations:[wi.of(null)]}))})}),e.addItem(a=>{let u=a.setTitle("Included annotations").setIcon("eye").setSection("commentator").setSubmenu();for(let{title:l,icon:d,value:c}of[{title:"Additions",icon:"plus-circle",value:1},{title:"Deletions",icon:"minus-square",value:2},{title:"Substitutions",icon:"replace",value:4},{title:"Highlights",icon:"highlighter",value:8},{title:"Comments",icon:"message-square",value:16}])u.addItem(f=>{f.setTitle(l).setIcon(d).setChecked((o&c)!==0).onClick(()=>{o^=c,f.setChecked((o&c)!==0),s.dispatch(s.state.update({effects:[Es.reconfigure(an.of(o))]}))})})})}});function zs(r,e){r.scrollIntoView({from:r.offsetToPos(e.from),to:r.offsetToPos(e.to)},!0)}var Au=require("@codemirror/state"),bh=require("@codemirror/view");var Nc=Au.Prec.high(bh.EditorView.inputHandler.of((r,e,t,n)=>{let i=r.state.doc.sliceString(e-2,e)+n,s;if((s=vd[i])!==void 0){let o=[{from:e,to:t+1,insert:n+s.join("")}];return r.dispatch({changes:o,selection:Au.EditorSelection.cursor(t+1)}),!0}return!1}));var Iu=require("@codemirror/state");var Lc=Iu.EditorState.transactionFilter.of(r=>{if(r.isUserEvent("select")){let e=r.startState.selection.main,t=r.selection.main;if(t.anchor===t.head){let n=r.startState.field(Pe).ranges,i=n.at_cursor(e.head),s=n.at_cursor(t.head);if(i&&i!==s&&(i.type==="substitution"||i.type==="highlight")){let o=i.unwrap(),a=!1,u=0,l=o.search(/\S/);l>=1&&(a=!0,o=o.slice(l),u+=l);let d=o.match(/\n\s*\n/g);if(d&&(a=!0,o=o.replace(/\n\s*\n/g,`
|
|
`),u+=d.reduce((c,f)=>c+f.length,0)),a)return{changes:[{from:i.from+3,to:i.to-3,insert:o}],selection:Iu.EditorSelection.cursor(t.head-u)}}}}return r});var yh=require("@codemirror/state");var Bc=r=>yh.EditorState.transactionExtender.of(e=>{if(e.selection&&e.newSelection.main!==e.startState.selection.main){let t=[],n=[];return r.annotation_gutter_focus_on_click&&n.push(Mn.of({from:e.selection.main.from,to:e.selection.main.to})),t.push(Fs.of({from:e.selection.main.from,to:e.selection.main.to})),{effects:t,annotations:n}}return{}});var wh=require("@codemirror/state"),ur;function Fc(r){return ur=xh(r),ur}var xh=r=>wh.StateField.define({create(){return r.settings},update(){return r.settings}});var Ki=require("obsidian");async function fn(r,e,t,n=!0){let i=Ru(e),s={},o=()=>{};Object.keys(i).length>=100&&(o=ou("Applying operations...","Operations applied.",Object.keys(i).length,3e3,"Please do not apply other operations until this progress bar has completed."));let a=0;for(let[u,l]of Object.entries(i)){let d=r.app.vault.getAbstractFileByPath(u);!d||!(d instanceof Ki.TFile)||(s[u]=await r.app.vault.cachedRead(d),n&&(l=l.flatMap(c=>[c,...c.replies])),l.sort((c,f)=>c.from-f.from),await t(r.app,d,l),o(++a))}r.file_history.push({changes:s,mtime:Date.now()})}async function zc(r){if(r.file_history.length===0){new Ki.Notice("No changes to undo.",3e3);return}let e=r.file_history.pop();if(!e)return;let{changes:t,mtime:n}=e,i=()=>{};Object.keys(t).length>=100&&(i=ou("Undoing changes...","Changes undone.",Object.keys(t).length,3e3,"Please do not apply other operations until this progress bar has completed."));let s=0;for(let[o,a]of Object.entries(t)){let u=r.app.vault.getAbstractFileByPath(o);if(!(!u||!(u instanceof Ki.TFile))){if(u.stat.mtime>n){new Ki.Notice("File has been modified since the changes were made, skipping: "+o,3e3);continue}await r.app.vault.modify(u,a),i(++s)}}}async function Du(r,e){let t=r.app.workspace.getLeavesOfType("markdown");if(!t.length)return;let n=t.reduce((o,a)=>(o.activeTime??0)>(a.activeTime??0)?o:a),i=r.app.vault.getAbstractFileByPath(e.path);if(!i||!(i instanceof Ki.TFile))return;await r.app.workspace.revealLeaf(n);let s=n.view;i!==s.file&&await n.openFile(i),zs(s.editor,e.range)}var Pe=kh.StateField.define({create(r){let e=r.doc.toString(),t=tu.parser.parse(e),n=r.field(ur),i=new Ga(Vc(t,e,n));return{tree:t,fragments:Ss.addTree(t),ranges:i,inserted_ranges:i.ranges,deleted_ranges:[]}},update(r,e){let t=e.state.field(ur);if(e.effects.some(g=>g.is(Os)))return this.create(e.state);if(!e.docChanged)return r.inserted_ranges=[],r.deleted_ranges=[],r;let n=[];e.changes.iterChangedRanges((g,_,v,k)=>n.push({fromA:g,toA:_,fromB:v,toB:k}));let i=Ss.applyChanges(r.fragments,n),s=e.state.doc.toString(),o=tu.parser.parse(new Sh.DocInput(e.state.doc),i);i=Ss.addTree(o,i);let a=new Map,u=[],l=new Map,d=new Set;for(let g of n){r.ranges.tree.search([g.fromA,g.toA],(_,v)=>{r.ranges.tree.remove(v,_),d.add(_);for(let k of _.base_range.thread)l.set(k.from,k);return!0});for(let _ of Vc(o,s,t,g.fromB,g.toB))a.set(_.from,_);u.push([g.toA,g.toB-g.fromB-(g.toA-g.fromA)])}for(let g of d)g.type==="comment"&&l.delete(g.from);let c=0,f=r.ranges.tree.nil_node;function p(g){if(g!=null&&g!=f){for(p(g.left);u.length&&g.item.key.low>=u[0][0];)c+=u.shift()[1];g.item.value.apply_offset(c),g.item.key.low=g.item.value.from,g.item.key.high=g.item.value.to,p(g.right),g.left!=f&&(g.max.low=g.left.max.low),g.right!=f&&(g.max.high=g.right.max.high)}}p(r.ranges.tree.root);let m=Array.from(a.values());for(let g of m)r.ranges.tree.insert([g.from,g.to],g);for(let g of m)g.type==="comment"&&l.set(g.from,g);if(l.size){let g=[],_,v=[];for(let k of Array.from(l.values()).sort((S,T)=>S.from-T.from))k.clear_references(),k.replies.length=0,!_||_?.right_adjacent(k)?v.push(k):(g.push(v),v=[k]),_=k;g.push(v);for(let k of g){let S=k[0],T=r.ranges.tree.search([S.from,S.from])[0];T.replies.length=0;for(let E of k.slice(T===S?1:0))E.add_reply(T)}}return r.ranges.ranges=r.ranges.tree.values,{tree:o,ranges:r.ranges,fragments:i,inserted_ranges:m,deleted_ranges:[...d]}}});function W0(r,e,t){let n=r.enable_metadata&&e.firstChild?.type.name.startsWith("MDSep")?e.firstChild.from:void 0,i;if(e.type.name==="Substitution"){let s=n?e.firstChild?.nextSibling:e.firstChild;if(!s||s.type.name!=="MSub")return;i=s.from}return J0(e.from,e.to,e.type.name,t.slice(e.from,e.to),i,n)}function Vc(r,e,t,n=0,i=e.length){let s=[],o,a=r.cursor();if(a.childAfter(n-1),a.node.type.name==="CriticMarkup"||a.node.from>i)return s;if(a)do{let u=a.node;if(u.type.name==="\u26A0")continue;let l=W0(t,u,e);l&&(l.type==="comment"&&o&&o.right_adjacent(l)&&l.add_reply(o),s.push(l),o=l)}while(a.nextSibling()&&a.node.from<=i);return s}function Rc(r){let e=r.field(Pe).ranges;return e.ranges.length?r.selection.ranges.some(t=>e.contains_range(t.from,t.to)):!1}function Fo(r,e){let t=tu.parser.parse(r);return Vc(t,r,e)}function J0(r,e,t,n,i,s){switch(t){case"Addition":return new Hi(r,e,n,s);case"Deletion":return new ys(r,e,n,s);case"Substitution":return new Sn(r,i,e,n,s);case"Highlight":return new ws(r,e,n,s);case"Comment":return new bs(r,e,n,s);default:return new Hi(r,e,n,s)}}var zo={addition:Hi,deletion:ys,highlight:ws,substitution:Sn,comment:bs};function Ru(r){let e={};for(let{path:t,range:n}of r)e[t]||(e[t]=[]),e[t].push(n);return e}function Gi(r){let e;return r.add_metadata&&(e={},r.add_author_metadata&&(e.author=r.author||void 0),r.add_timestamp_metadata&&(e.time=Math.floor(Date.now()/1e3)),Object.keys(e).length===0&&(e=void 0)),e}var K0={author:"split"};function su(r,e,t=K0){if(!e)return{compatible:!0,merged_metadata:r.fields};if(!r.fields)return{compatible:!1,merged_metadata:void 0};let n=Object.assign({},r.fields,e);for(let i of[...new Set(Object.keys(e).concat(Object.keys(r.fields)))])if(e[i]!==r.fields[i]){let s=t[i];if(s==="split"||s==="move_outside")return{compatible:!1,merged_metadata:void 0};s==="old"&&(n[i]=r.fields[i])}return{compatible:!0,merged_metadata:n}}function Vo(r,e,t,n=0,i=0){return Kn(r,e,r&&e?"substitution":r?"addition":"deletion",t,n,i)}function Kn(r,e,t,n,i=0,s=0){if(!t)return{insert:e+r,start_offset:i,end_offset:s};let o=gt[t],a=n&&Object.keys(n).length?JSON.stringify(n)+"@@":"",u=o[0]+a+(t==="substitution"?e+o[1]+r+o[2]:e+r+o[1]),l=o[0].length+a.length;return i+=l,s+=t==="substitution"?o[1].length:0,{insert:u,start_offset:i,end_offset:s}}function Eh(r,e,t=""){return Vo(e,t,Gi(r)).insert}function jn(r,e,t,n=""){return Kn(t,n,e,Gi(r)).insert}var Pu=require("@codemirror/state");function Th(r,e,t,n=!1,i=null){let s=r,o=t.doc.lineAt(s),a=t.charCategorizer(s);i===Pu.CharCategory.Space&&(i=null);let u=null;for(i;;){if(s==(e?o.to:o.from)){s==r&&o.number!=(e?t.doc.lines:1)&&(s+=e?1:-1);break}let l=(0,Pu.findClusterBreak)(o.text,s-o.from,e)+o.from,d=o.text.slice(Math.min(s,l)-o.from,Math.max(s,l)-o.from);if(u=a(d),i!=null&&u!=i)if(i==1&&n)n=!1;else break;(d!=" "||s!=r)&&(i=u),s=l}return[s,i]}function Hc(r,e,t=!1){let n=e.doc.lineAt(r),i=e.charCategorizer(r);return t&&(r-=1),i(n.text.slice(r-n.from,r-n.from+1))}var G2=require("@codemirror/state");function Oo(r){return r.annotations.map(e=>e.value).filter(e=>typeof e=="string")}function nu(r,e){return e.some(t=>t.startsWith(r))}function Is(r){return r.isUserEvent("input")?"input":r.isUserEvent("paste")?"paste":r.isUserEvent("delete")?"delete":Oo(r).find(n=>n.startsWith("select"))}function $h(r,e,t){if(e.clipboardData&&r.clipboard_remove_syntax){let n=t.state.selection.main,s=t.state.field(Pe).ranges.unwrap_in_range(t.state.doc,n.from,n.to).output;e.clipboardData.setData("text/plain",s),e.preventDefault()}}var Go=require("@codemirror/state");function Q0(r){return r===Go.CharCategory.Space||r===null}function X0(r,e){return r!==null&&r!==Go.CharCategory.Space&&r!==e}function Z0(r,e,t){if(t.cursor_inside(r))return t;{let n=t.cursor_before_range(r),i=e.ranges.indexOf(t)+(n?-1:1);for(;i>=0&&i<e.ranges.length;)if(t=e.ranges[i],n?t.cursor_before_range(r):t.cursor_after_range(r))i+=n?-1:1;else return t.cursor_inside(r)?t:void 0}}function Ho(r,e,t,n,i,s){n?n=Z0(r,t,n):n=t.range_adjacent_to_cursor(r,!e,!0,!0);let o=!0;for(;o&&n;){let a=r;if(r=n.cursor_move_through(r,e,i[n.type]),o=r!==a,o&&r===(e?n.to:n.from)&&(n=t.adjacent_range(n,!e,!0),n&&s&&s[n.type]==="stay_outside"))break}return[r,n]}function Mh(r,e,t,n,i,s=!1,o,a,u){let l=t.range_adjacent_to_cursor(r,!n,!0,!i);if(!l||(n?l.cursor_before_range(e):l.cursor_after_range(e))||a[l.type]==="unchanged")return e;if(!i&&Math.abs(r-e)===1)[e,l]=Ho(r,n,t,l,a,u),e=e+(n?1:-1);else if(!i)[e,l]=Ho(e,n,t,l,a,u);else{let d=Ho(e,!n,t,l,a,null)[0],c=null,f=d===r?null:Hc(d,o,n),p=e;for(;!X0(c,f)&&(e=p,c=f,[e,l]=Ho(e,n,t,l,a,u),p=Th(e,n,o,Q0(c),c)[0],p!==e);)d=Ho(p,!n,t,l,a,null)[0],f=Hc(d,o,n)}if(l&&!(e===0||e===o.doc.length)){let d=n?l.to:l.from,c=n?1:-1;e===d?u[l.type]==="stay_inside"&&(e=d-3*c):l.touches_bracket(e,n,!1,!0)&&(e=n?l.from:l.to)}return Math.clamp(e,0,o.doc.length)}function Vd(r,e,t,n,i,s,o=!1,a,u,l){let d=Mh(r.head,e.head,t,n,i,o,a,u,l),c=r.anchor;return s||(c=d),{selection:Go.EditorSelection.range(c,d)}}var eg={addition:"ignore_metadata",deletion:"ignore_metadata",substitution:"ignore_metadata",comment:"ignore_metadata",highlight:"ignore_metadata"},tg={addition:"stay_inside",deletion:"stay_inside",substitution:"stay_inside",comment:"stay_inside",highlight:"stay_inside"};function iu(r,e,t,n,i,s=eg,o=tg){if(!r.selection){let a=r.anchor,u=t?r.from:r.to;u=Mh(a,u,e,!t,n,!1,i,s,o),t?r.from=u:r.to=u}return r}var fk=require("@codemirror/state");var bk=require("@codemirror/view"),Oh=require("@codemirror/state");function Kr(r,e,t=!1){let n=r.state.field(ur),i=e?e.full_range_back:r.state.selection.main.head,s=e?e.full_thread.length:-1;r.dispatch(r.state.update({changes:{from:i,to:i,insert:jn(n,"comment","")},selection:Oh.EditorSelection.cursor(i),scrollIntoView:t})),activeWindow.setTimeout(()=>{r.dispatch(r.state.update({annotations:[Mn.of({from:i,to:i,index:s})]}))})}var $k=require("@codemirror/state");function Yn(r,e,t,n=!0){let i=r.field(Pe).ranges;return(e||t?i.ranges_in_interval(e??0,t??1/0):i.ranges).filter(s=>s.type==="addition"||s.type==="deletion"||s.type==="substitution").map(s=>({from:s.from,to:n?s.full_range_back:s.to,insert:s.accept()}))}function Wn(r,e,t,n=!0){let i=r.field(Pe).ranges;return(e||t?i.ranges_in_interval(e??0,t??1/0):i.ranges).filter(s=>s.type==="addition"||s.type==="deletion"||s.type==="substitution").map(s=>({from:s.from,to:n?s.full_range_back:s.to,insert:s.reject()}))}async function dn(r,e,t,n){n.sort((o,a)=>o.from-a.from);let i=await e.vault.read(t),s=Ua(i,r,n);await e.vault.modify(t,s)}var Uc=require("@codemirror/state");function Ah(r,e){return e==="regular"||e==="clear"?!0:!((r.type==="comment"||r.type==="highlight")&&r.type!==e)}function rg(r,e,t,n={}){return Ah(r,e)?!t||!r.fields?!1:[...new Set(Object.keys(t).concat(Object.keys(r.fields)))].some(i=>t[i]!==r.fields[i]&&(n[i]==="move_outside"||i==="author"&&r.type==="comment")):!0}function ng(r,e){if(r!=="substitution"&&r===e)return r;if(r==="deletion"&&e==="addition")return"substitution";if(r==="substitution"&&e==="addition")return"substitution";if(r==="deletion"&&e==="substitution")return"substitution"}function Gc(r,e,t,n,i=!1,s=!1){if(!e||!t||!Ah(e,t))return{};if(!s&&(i&&e.touches_left_bracket(r,!1,!0,!0)||!i&&e.touches_right_bracket(r,!1,!0)))return{};let{compatible:o,merged_metadata:a}=su(e,n);if(!o)return{};let u,l;return i?(u=e.range_type(-1/0,r),l=t):(u=t,l=e.range_type(r,1/0)),t=ng(u,l),{type:t,merged_metadata:t?a:void 0}}function Ch(r,e,t,n,i,s,o){let a=r.ranges_in_interval(t,n),u=r.at_cursor(t,!1),l=r.at_cursor(n,!0),d=["",""],c=!1,f=i,p=0,m=0;function g(v=!1){u?.type&&(u.touches_left_bracket(t,!1,!0,!0)?t=u.from:u.touches_right_bracket(t,!1,!0)?t=u.to:u.type==="substitution"&&(v||u.contains_separator(t,n))?(d[0]=Kn("",u.unwrap_slice(0,t),"deletion",u.fields).insert,t=u.from):d[0]=u.split_range(t)[0])}function _(v=!1){if(l?.type)if(l.touches_right_bracket(n,!1,!0))n=l.to;else if(l.touches_left_bracket(n,!1,!0,!0))n=l.from;else if(l.type==="substitution"&&(v||l.contains_separator(t,n))){let k=l.unwrap_slice(n,1/0);d[1]=Kn(k,"","addition",l.fields).insert,n=l.to,c=!0}else d[1]=l.split_range(n)[1]}if(s==="none")n=t,f="";else if(s==="regular")if(u!==void 0&&u===l){let v=t===n?"":u.unwrap_slice(t,n);if(v){if(t=u.cursor_move_inside(t,!0),n=u.cursor_move_inside(n,!1),u.type==="substitution"){let k=u.contains_part(t,n),S=u.unwrap_parts();if(k){let T=u.unwrap_slice(0,t);p+=T.length,m+=i.length-2;let E=u.unwrap_slice(n,u.middle);v=T+i+E,f=S[1]}else if(k===!1){v=S[0];let T=u.unwrap_slice(u.middle+2,t);p=v.length+T.length;let E=u.unwrap_slice(n,1/0);f=T+i+E}else{let[T,E]=u.unwrap_slice_parts_inverted(t,n);p=T.length,v=T,f=i+E}t=u.from,n=u.to,{insert:f,start_offset:p,end_offset:m}=Vo(f,v,u.fields,p,m)}}else{let k=u.cursor_move_inside(t,!0);t=k,n=k,f=i}}else if(t===n?"":r.unwrap_in_range(e,t,n,a).output)g(),_(),p+=d[0].length,c?f=d[0]+i+d[1]:(m=d[1].length,f=d[0]+d[1]+i);else{let k=u||l,S=k?k.cursor_move_inside(t,!0):t;t=S,n=S,f=i}else if(s==="clear"){g(),_();let v=t===n?"":r.unwrap_in_range(e,t,n,a).output;p+=d[0].length,m+=v.length,f=d[0]+v+d[1]}else if(u!==void 0&&u===l&&u.type==="substitution"){let v=u.contains_part(t,n),k=v?t:n,S=Gc(k,u,s,o,v,!0);if(S.type){let T="",E=u.unwrap_parts();if(S.type==="addition"){T=E[0];let y=Math.clamp(k-u.middle-2,0,E[1].length);p=E[0].length+y,f=E[1].slice(0,y)+i+E[1].slice(y),{insert:f,start_offset:p,end_offset:m}=Vo(f,T,S.merged_metadata,p,m),t=u.from,n=u.to}else if(S.type==="deletion")m=n-t,n=t,f="";else if(v){let y=u.unwrap_slice(0,t),x=u.unwrap_slice(t,n);_(),p=y.length,m=x.length,{insert:f,start_offset:p,end_offset:m}=Kn(i,y+x,S.type,S.merged_metadata,p,m),t=u.from}else if(v===!1)T=u.unwrap_slice(t,n),m=T.length,f=i+u.unwrap_slice(n,1/0),i.length||(m-=2),g(),{insert:f,start_offset:p,end_offset:m}=Kn(f,T,S.type,S.merged_metadata,p,m),n=u.to;else{let y=Math.clamp(n-u.middle-2,0,E[1].length);T=E[0]+E[1].slice(0,y),p=t-u.range_start,m=y+(E[0].length-t+u.range_start),f=i+E[1].slice(y),f.length&&!i.length&&(m-=2),{insert:f,start_offset:p,end_offset:m}=Vo(f,T,S.merged_metadata,p,m),t=u.from,n=u.to}}else{let T=u.unwrap_slice(t,n);g(n<u.middle),_(t>u.middle+2),{insert:f,start_offset:p,end_offset:m}=Kn(i,T,s,o,p,m+i.length+T.length)}}else{let v=t===n?"":r.unwrap_in_range(e,t,n,a).output;if(!v){if(s==="substitution")s="addition";else if(s==="deletion")return{from:t,to:t,insert:"",start:t,end:t}}m=v.length;let k=Gc(t,u,s,o,!0),S=k.merged_metadata;if(f=i,k.type){if(u.type==="substitution"){let E=u.unwrap_parts();p=E[0].length,m+=E[1].length,v=E[0]+v,f=E[1]+i}else{let E=u.unwrap_slice(0,t);p=E.length,v=E+v}t=u.from,o=S}else g();let T=Gc(n,l,s,o,!1);if(S=T.merged_metadata,T.type){if(l.type==="substitution"){let E=l.unwrap_slice_parts_inverted(t,n);f=i+E[1],v+=E[0]}else f+=l.unwrap_slice(n,1/0);n=l.to,o=S}else _();(k.type==="substitution"||T.type==="substitution")&&(s="substitution"),{insert:f,start_offset:p,end_offset:m}=Kn(f,v,s,o,p,m)}return p+=d[0].length,f=d[0]+f+d[1],{from:t,to:n,insert:f,start:t+p,end:t+p+m+i.length}}function Co(r,e,t,n,i,s,o,a=!1){let u=r.ranges_in_interval(t,n),l=u.at(0),d=u.at(-1);l?.touches_left_bracket(t,!0,!0,!0)&&(t=l.from),d?.touches_right_bracket(n,!0,!0)&&(n=d.to);let c=t,f=[];if(!a){for(let m of u)if(rg(m,s,o)){if(c<m.from){let g=s==="substitution"?"deletion":s,_=Ch(r,e,c,m.from,"",g,o);_&&f.push(_)}c=m.to}}c>n&&(n=c);let p=Ch(r,e,c,n,i,s,o);return p&&f.push(p),f}function mh(r,e,t){let n=r.cm.state.field(Pe).ranges,i=r.cm.state.selection.ranges,s=[],o=[];for(let a of i){let u=Co(n,r.cm.state.doc,a.from,a.to,"",e,Gi(t));o.push(...u),s.push(Uc.EditorSelection.range(u[0].start,u[u.length-1].end))}r.cm.dispatch(r.cm.state.update({changes:o,selection:Uc.EditorSelection.create(s)}))}var xi=za(Ih(),1);xi.default.DIFF_DELETE=-1;xi.default.DIFF_INSERT=1;xi.default.DIFF_EQUAL=0;function ig(r,e){let t=new xi.default,n=t.diff_main(r,e);t.diff_cleanupSemantic(n);let i=0,s=[],o=null;for(let[a,u]of n)a===xi.default.DIFF_EQUAL?(o&&(s.push(o),o=null),i+=u.length):a===xi.default.DIFF_INSERT?o?o.insert?(s.push(o),o={from:i,to:i,insert:u}):o.insert+=u:o={from:i,to:i,insert:u}:a===xi.default.DIFF_DELETE&&(o?(s.push(o),o={from:i,to:i+u.length,insert:""}):o={from:i,to:i+u.length,insert:""},i+=u.length);return o&&s.push(o),s}function gh(r,e,t){let n=ig(e,t),i="",s=0;for(let o of n)o.from>s&&(i+=e.slice(s,o.from)),o.insert&&(i+=Eh(r,o.insert,e.slice(o.from,o.to))),s=o.to;return s<e.length&&(i+=e.slice(s)),i}var ki=za(Nu(),1),Bh=za(Ph(),1),Fh=za(Lh(),1),d3=require("@codemirror/state"),On=require("obsidian");function jc(r){let e=new Blob([r],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function Yc(){return jc('"use strict";var zn=Object.create;var Ht=Object.defineProperty;var Vn=Object.getOwnPropertyDescriptor;var Hn=Object.getOwnPropertyNames,Gi=Object.getOwnPropertySymbols,jn=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty,$n=Object.prototype.propertyIsEnumerable;var Vt=(s,e,t)=>e in s?Ht(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,he=(s,e)=>{for(var t in e||(e={}))Li.call(e,t)&&Vt(s,t,e[t]);if(Gi)for(var t of Gi(e))$n.call(e,t)&&Vt(s,t,e[t]);return s};var Wn=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Yn=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Hn(e))!Li.call(s,n)&&n!==t&&Ht(s,n,{get:()=>e[n],enumerable:!(i=Vn(e,n))||i.enumerable});return s};var qn=(s,e,t)=>(t=s!=null?zn(jn(s)):{},Yn(e||!s||!s.__esModule?Ht(t,"default",{value:s,enumerable:!0}):t,s));var E=(s,e,t)=>Vt(s,typeof e!="symbol"?e+"":e,t);var Un=Wn((Bf,Qe)=>{var m=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},L=-1,B=1,R=0;m.Diff=function(s,e){return[s,e]};m.prototype.diff_main=function(s,e,t,i){typeof i=="undefined"&&(this.Diff_Timeout<=0?i=Number.MAX_VALUE:i=new Date().getTime()+this.Diff_Timeout*1e3);var n=i;if(s==null||e==null)throw new Error("Null input. (diff_main)");if(s==e)return s?[new m.Diff(R,s)]:[];typeof t=="undefined"&&(t=!0);var r=t,o=this.diff_commonPrefix(s,e),a=s.substring(0,o);s=s.substring(o),e=e.substring(o),o=this.diff_commonSuffix(s,e);var l=s.substring(s.length-o);s=s.substring(0,s.length-o),e=e.substring(0,e.length-o);var h=this.diff_compute_(s,e,r,n);return a&&h.unshift(new m.Diff(R,a)),l&&h.push(new m.Diff(R,l)),this.diff_cleanupMerge(h),h};m.prototype.diff_compute_=function(s,e,t,i){var n;if(!s)return[new m.Diff(B,e)];if(!e)return[new m.Diff(L,s)];var r=s.length>e.length?s:e,o=s.length>e.length?e:s,a=r.indexOf(o);if(a!=-1)return n=[new m.Diff(B,r.substring(0,a)),new m.Diff(R,o),new m.Diff(B,r.substring(a+o.length))],s.length>e.length&&(n[0][0]=n[2][0]=L),n;if(o.length==1)return[new m.Diff(L,s),new m.Diff(B,e)];var l=this.diff_halfMatch_(s,e);if(l){var h=l[0],u=l[1],f=l[2],c=l[3],g=l[4],b=this.diff_main(h,f,t,i),p=this.diff_main(u,c,t,i);return b.concat([new m.Diff(R,g)],p)}return t&&s.length>100&&e.length>100?this.diff_lineMode_(s,e,i):this.diff_bisect_(s,e,i)};m.prototype.diff_lineMode_=function(s,e,t){var i=this.diff_linesToChars_(s,e);s=i.chars1,e=i.chars2;var n=i.lineArray,r=this.diff_main(s,e,!1,t);this.diff_charsToLines_(r,n),this.diff_cleanupSemantic(r),r.push(new m.Diff(R,""));for(var o=0,a=0,l=0,h="",u="";o<r.length;){switch(r[o][0]){case B:l++,u+=r[o][1];break;case L:a++,h+=r[o][1];break;case R:if(a>=1&&l>=1){r.splice(o-a-l,a+l),o=o-a-l;for(var f=this.diff_main(h,u,!1,t),c=f.length-1;c>=0;c--)r.splice(o,0,f[c]);o=o+f.length}l=0,a=0,h="",u="";break}o++}return r.pop(),r};m.prototype.diff_bisect_=function(s,e,t){for(var i=s.length,n=e.length,r=Math.ceil((i+n)/2),o=r,a=2*r,l=new Array(a),h=new Array(a),u=0;u<a;u++)l[u]=-1,h[u]=-1;l[o+1]=0,h[o+1]=0;for(var f=i-n,c=f%2!=0,g=0,b=0,p=0,I=0,M=0;M<r&&!(new Date().getTime()>t);M++){for(var T=-M+g;T<=M-b;T+=2){var k=o+T,A;T==-M||T!=M&&l[k-1]<l[k+1]?A=l[k+1]:A=l[k-1]+1;for(var w=A-T;A<i&&w<n&&s.charAt(A)==e.charAt(w);)A++,w++;if(l[k]=A,A>i)b+=2;else if(w>n)g+=2;else if(c){var y=o+f-T;if(y>=0&&y<a&&h[y]!=-1){var d=i-h[y];if(A>=d)return this.diff_bisectSplit_(s,e,A,w,t)}}}for(var x=-M+p;x<=M-I;x+=2){var y=o+x,d;x==-M||x!=M&&h[y-1]<h[y+1]?d=h[y+1]:d=h[y-1]+1;for(var S=d-x;d<i&&S<n&&s.charAt(i-d-1)==e.charAt(n-S-1);)d++,S++;if(h[y]=d,d>i)I+=2;else if(S>n)p+=2;else if(!c){var k=o+f-x;if(k>=0&&k<a&&l[k]!=-1){var A=l[k],w=o+A-k;if(d=i-d,A>=d)return this.diff_bisectSplit_(s,e,A,w,t)}}}}return[new m.Diff(L,s),new m.Diff(B,e)]};m.prototype.diff_bisectSplit_=function(s,e,t,i,n){var r=s.substring(0,t),o=e.substring(0,i),a=s.substring(t),l=e.substring(i),h=this.diff_main(r,o,!1,n),u=this.diff_main(a,l,!1,n);return h.concat(u)};m.prototype.diff_linesToChars_=function(s,e){var t=[],i={};t[0]="";function n(l){for(var h="",u=0,f=-1,c=t.length;f<l.length-1;){f=l.indexOf(`\n`,u),f==-1&&(f=l.length-1);var g=l.substring(u,f+1);(i.hasOwnProperty?i.hasOwnProperty(g):i[g]!==void 0)?h+=String.fromCharCode(i[g]):(c==r&&(g=l.substring(u),f=l.length),h+=String.fromCharCode(c),i[g]=c,t[c++]=g),u=f+1}return h}var r=4e4,o=n(s);r=65535;var a=n(e);return{chars1:o,chars2:a,lineArray:t}};m.prototype.diff_charsToLines_=function(s,e){for(var t=0;t<s.length;t++){for(var i=s[t][1],n=[],r=0;r<i.length;r++)n[r]=e[i.charCodeAt(r)];s[t][1]=n.join("")}};m.prototype.diff_commonPrefix=function(s,e){if(!s||!e||s.charAt(0)!=e.charAt(0))return 0;for(var t=0,i=Math.min(s.length,e.length),n=i,r=0;t<n;)s.substring(r,n)==e.substring(r,n)?(t=n,r=t):i=n,n=Math.floor((i-t)/2+t);return n};m.prototype.diff_commonSuffix=function(s,e){if(!s||!e||s.charAt(s.length-1)!=e.charAt(e.length-1))return 0;for(var t=0,i=Math.min(s.length,e.length),n=i,r=0;t<n;)s.substring(s.length-n,s.length-r)==e.substring(e.length-n,e.length-r)?(t=n,r=t):i=n,n=Math.floor((i-t)/2+t);return n};m.prototype.diff_commonOverlap_=function(s,e){var t=s.length,i=e.length;if(t==0||i==0)return 0;t>i?s=s.substring(t-i):t<i&&(e=e.substring(0,t));var n=Math.min(t,i);if(s==e)return n;for(var r=0,o=1;;){var a=s.substring(n-o),l=e.indexOf(a);if(l==-1)return r;o+=l,(l==0||s.substring(n-o)==e.substring(0,o))&&(r=o,o++)}};m.prototype.diff_halfMatch_=function(s,e){if(this.Diff_Timeout<=0)return null;var t=s.length>e.length?s:e,i=s.length>e.length?e:s;if(t.length<4||i.length*2<t.length)return null;var n=this;function r(b,p,I){for(var M=b.substring(I,I+Math.floor(b.length/4)),T=-1,k="",A,w,y,d;(T=p.indexOf(M,T+1))!=-1;){var x=n.diff_commonPrefix(b.substring(I),p.substring(T)),S=n.diff_commonSuffix(b.substring(0,I),p.substring(0,T));k.length<S+x&&(k=p.substring(T-S,T)+p.substring(T,T+x),A=b.substring(0,I-S),w=b.substring(I+x),y=p.substring(0,T-S),d=p.substring(T+x))}return k.length*2>=b.length?[A,w,y,d,k]:null}var o=r(t,i,Math.ceil(t.length/4)),a=r(t,i,Math.ceil(t.length/2)),l;if(!o&&!a)return null;a?o?l=o[4].length>a[4].length?o:a:l=a:l=o;var h,u,f,c;s.length>e.length?(h=l[0],u=l[1],f=l[2],c=l[3]):(f=l[0],c=l[1],h=l[2],u=l[3]);var g=l[4];return[h,u,f,c,g]};m.prototype.diff_cleanupSemantic=function(s){for(var e=!1,t=[],i=0,n=null,r=0,o=0,a=0,l=0,h=0;r<s.length;)s[r][0]==R?(t[i++]=r,o=l,a=h,l=0,h=0,n=s[r][1]):(s[r][0]==B?l+=s[r][1].length:h+=s[r][1].length,n&&n.length<=Math.max(o,a)&&n.length<=Math.max(l,h)&&(s.splice(t[i-1],0,new m.Diff(L,n)),s[t[i-1]+1][0]=B,i--,i--,r=i>0?t[i-1]:-1,o=0,a=0,l=0,h=0,n=null,e=!0)),r++;for(e&&this.diff_cleanupMerge(s),this.diff_cleanupSemanticLossless(s),r=1;r<s.length;){if(s[r-1][0]==L&&s[r][0]==B){var u=s[r-1][1],f=s[r][1],c=this.diff_commonOverlap_(u,f),g=this.diff_commonOverlap_(f,u);c>=g?(c>=u.length/2||c>=f.length/2)&&(s.splice(r,0,new m.Diff(R,f.substring(0,c))),s[r-1][1]=u.substring(0,u.length-c),s[r+1][1]=f.substring(c),r++):(g>=u.length/2||g>=f.length/2)&&(s.splice(r,0,new m.Diff(R,u.substring(0,g))),s[r-1][0]=B,s[r-1][1]=f.substring(0,f.length-g),s[r+1][0]=L,s[r+1][1]=u.substring(g),r++),r++}r++}};m.prototype.diff_cleanupSemanticLossless=function(s){function e(g,b){if(!g||!b)return 6;var p=g.charAt(g.length-1),I=b.charAt(0),M=p.match(m.nonAlphaNumericRegex_),T=I.match(m.nonAlphaNumericRegex_),k=M&&p.match(m.whitespaceRegex_),A=T&&I.match(m.whitespaceRegex_),w=k&&p.match(m.linebreakRegex_),y=A&&I.match(m.linebreakRegex_),d=w&&g.match(m.blanklineEndRegex_),x=y&&b.match(m.blanklineStartRegex_);return d||x?5:w||y?4:M&&!k&&A?3:k||A?2:M||T?1:0}for(var t=1;t<s.length-1;){if(s[t-1][0]==R&&s[t+1][0]==R){var i=s[t-1][1],n=s[t][1],r=s[t+1][1],o=this.diff_commonSuffix(i,n);if(o){var a=n.substring(n.length-o);i=i.substring(0,i.length-o),n=a+n.substring(0,n.length-o),r=a+r}for(var l=i,h=n,u=r,f=e(i,n)+e(n,r);n.charAt(0)===r.charAt(0);){i+=n.charAt(0),n=n.substring(1)+r.charAt(0),r=r.substring(1);var c=e(i,n)+e(n,r);c>=f&&(f=c,l=i,h=n,u=r)}s[t-1][1]!=l&&(l?s[t-1][1]=l:(s.splice(t-1,1),t--),s[t][1]=h,u?s[t+1][1]=u:(s.splice(t+1,1),t--))}t++}};m.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;m.whitespaceRegex_=/\\s/;m.linebreakRegex_=/[\\r\\n]/;m.blanklineEndRegex_=/\\n\\r?\\n$/;m.blanklineStartRegex_=/^\\r?\\n\\r?\\n/;m.prototype.diff_cleanupEfficiency=function(s){for(var e=!1,t=[],i=0,n=null,r=0,o=!1,a=!1,l=!1,h=!1;r<s.length;)s[r][0]==R?(s[r][1].length<this.Diff_EditCost&&(l||h)?(t[i++]=r,o=l,a=h,n=s[r][1]):(i=0,n=null),l=h=!1):(s[r][0]==L?h=!0:l=!0,n&&(o&&a&&l&&h||n.length<this.Diff_EditCost/2&&o+a+l+h==3)&&(s.splice(t[i-1],0,new m.Diff(L,n)),s[t[i-1]+1][0]=B,i--,n=null,o&&a?(l=h=!0,i=0):(i--,r=i>0?t[i-1]:-1,l=h=!1),e=!0)),r++;e&&this.diff_cleanupMerge(s)};m.prototype.diff_cleanupMerge=function(s){s.push(new m.Diff(R,""));for(var e=0,t=0,i=0,n="",r="",o;e<s.length;)switch(s[e][0]){case B:i++,r+=s[e][1],e++;break;case L:t++,n+=s[e][1],e++;break;case R:t+i>1?(t!==0&&i!==0&&(o=this.diff_commonPrefix(r,n),o!==0&&(e-t-i>0&&s[e-t-i-1][0]==R?s[e-t-i-1][1]+=r.substring(0,o):(s.splice(0,0,new m.Diff(R,r.substring(0,o))),e++),r=r.substring(o),n=n.substring(o)),o=this.diff_commonSuffix(r,n),o!==0&&(s[e][1]=r.substring(r.length-o)+s[e][1],r=r.substring(0,r.length-o),n=n.substring(0,n.length-o))),e-=t+i,s.splice(e,t+i),n.length&&(s.splice(e,0,new m.Diff(L,n)),e++),r.length&&(s.splice(e,0,new m.Diff(B,r)),e++),e++):e!==0&&s[e-1][0]==R?(s[e-1][1]+=s[e][1],s.splice(e,1)):e++,i=0,t=0,n="",r="";break}s[s.length-1][1]===""&&s.pop();var a=!1;for(e=1;e<s.length-1;)s[e-1][0]==R&&s[e+1][0]==R&&(s[e][1].substring(s[e][1].length-s[e-1][1].length)==s[e-1][1]?(s[e][1]=s[e-1][1]+s[e][1].substring(0,s[e][1].length-s[e-1][1].length),s[e+1][1]=s[e-1][1]+s[e+1][1],s.splice(e-1,1),a=!0):s[e][1].substring(0,s[e+1][1].length)==s[e+1][1]&&(s[e-1][1]+=s[e+1][1],s[e][1]=s[e][1].substring(s[e+1][1].length)+s[e+1][1],s.splice(e+1,1),a=!0)),e++;a&&this.diff_cleanupMerge(s)};m.prototype.diff_xIndex=function(s,e){var t=0,i=0,n=0,r=0,o;for(o=0;o<s.length&&(s[o][0]!==B&&(t+=s[o][1].length),s[o][0]!==L&&(i+=s[o][1].length),!(t>e));o++)n=t,r=i;return s.length!=o&&s[o][0]===L?r:r+(e-n)};m.prototype.diff_prettyHtml=function(s){for(var e=[],t=/&/g,i=/</g,n=/>/g,r=/\\n/g,o=0;o<s.length;o++){var a=s[o][0],l=s[o][1],h=l.replace(t,"&").replace(i,"<").replace(n,">").replace(r,"¶<br>");switch(a){case B:e[o]=\'<ins style="background:#e6ffe6;">\'+h+"</ins>";break;case L:e[o]=\'<del style="background:#ffe6e6;">\'+h+"</del>";break;case R:e[o]="<span>"+h+"</span>";break}}return e.join("")};m.prototype.diff_text1=function(s){for(var e=[],t=0;t<s.length;t++)s[t][0]!==B&&(e[t]=s[t][1]);return e.join("")};m.prototype.diff_text2=function(s){for(var e=[],t=0;t<s.length;t++)s[t][0]!==L&&(e[t]=s[t][1]);return e.join("")};m.prototype.diff_levenshtein=function(s){for(var e=0,t=0,i=0,n=0;n<s.length;n++){var r=s[n][0],o=s[n][1];switch(r){case B:t+=o.length;break;case L:i+=o.length;break;case R:e+=Math.max(t,i),t=0,i=0;break}}return e+=Math.max(t,i),e};m.prototype.diff_toDelta=function(s){for(var e=[],t=0;t<s.length;t++)switch(s[t][0]){case B:e[t]="+"+encodeURI(s[t][1]);break;case L:e[t]="-"+s[t][1].length;break;case R:e[t]="="+s[t][1].length;break}return e.join(" ").replace(/%20/g," ")};m.prototype.diff_fromDelta=function(s,e){for(var t=[],i=0,n=0,r=e.split(/\\t/g),o=0;o<r.length;o++){var a=r[o].substring(1);switch(r[o].charAt(0)){case"+":try{t[i++]=new m.Diff(B,decodeURI(a))}catch(u){throw new Error("Illegal escape in diff_fromDelta: "+a)}break;case"-":case"=":var l=parseInt(a,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+a);var h=s.substring(n,n+=l);r[o].charAt(0)=="="?t[i++]=new m.Diff(R,h):t[i++]=new m.Diff(L,h);break;default:if(r[o])throw new Error("Invalid diff operation in diff_fromDelta: "+r[o])}}if(n!=s.length)throw new Error("Delta length ("+n+") does not equal source text length ("+s.length+").");return t};m.prototype.match_main=function(s,e,t){if(s==null||e==null||t==null)throw new Error("Null input. (match_main)");return t=Math.max(0,Math.min(t,s.length)),s==e?0:s.length?s.substring(t,t+e.length)==e?t:this.match_bitap_(s,e,t):-1};m.prototype.match_bitap_=function(s,e,t){if(e.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var i=this.match_alphabet_(e),n=this;function r(A,w){var y=A/e.length,d=Math.abs(t-w);return n.Match_Distance?y+d/n.Match_Distance:d?1:y}var o=this.Match_Threshold,a=s.indexOf(e,t);a!=-1&&(o=Math.min(r(0,a),o),a=s.lastIndexOf(e,t+e.length),a!=-1&&(o=Math.min(r(0,a),o)));var l=1<<e.length-1;a=-1;for(var h,u,f=e.length+s.length,c,g=0;g<e.length;g++){for(h=0,u=f;h<u;)r(g,t+u)<=o?h=u:f=u,u=Math.floor((f-h)/2+h);f=u;var b=Math.max(1,t-u+1),p=Math.min(t+u,s.length)+e.length,I=Array(p+2);I[p+1]=(1<<g)-1;for(var M=p;M>=b;M--){var T=i[s.charAt(M-1)];if(g===0?I[M]=(I[M+1]<<1|1)&T:I[M]=(I[M+1]<<1|1)&T|((c[M+1]|c[M])<<1|1)|c[M+1],I[M]&l){var k=r(g,M-1);if(k<=o)if(o=k,a=M-1,a>t)b=Math.max(1,2*t-a);else break}}if(r(g+1,t)>o)break;c=I}return a};m.prototype.match_alphabet_=function(s){for(var e={},t=0;t<s.length;t++)e[s.charAt(t)]=0;for(var t=0;t<s.length;t++)e[s.charAt(t)]|=1<<s.length-t-1;return e};m.prototype.patch_addContext_=function(s,e){if(e.length!=0){if(s.start2===null)throw Error("patch not initialized");for(var t=e.substring(s.start2,s.start2+s.length1),i=0;e.indexOf(t)!=e.lastIndexOf(t)&&t.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,t=e.substring(s.start2-i,s.start2+s.length1+i);i+=this.Patch_Margin;var n=e.substring(s.start2-i,s.start2);n&&s.diffs.unshift(new m.Diff(R,n));var r=e.substring(s.start2+s.length1,s.start2+s.length1+i);r&&s.diffs.push(new m.Diff(R,r)),s.start1-=n.length,s.start2-=n.length,s.length1+=n.length+r.length,s.length2+=n.length+r.length}};m.prototype.patch_make=function(s,e,t){var i,n;if(typeof s=="string"&&typeof e=="string"&&typeof t=="undefined")i=s,n=this.diff_main(i,e,!0),n.length>2&&(this.diff_cleanupSemantic(n),this.diff_cleanupEfficiency(n));else if(s&&typeof s=="object"&&typeof e=="undefined"&&typeof t=="undefined")n=s,i=this.diff_text1(n);else if(typeof s=="string"&&e&&typeof e=="object"&&typeof t=="undefined")i=s,n=e;else if(typeof s=="string"&&typeof e=="string"&&t&&typeof t=="object")i=s,n=t;else throw new Error("Unknown call format to patch_make.");if(n.length===0)return[];for(var r=[],o=new m.patch_obj,a=0,l=0,h=0,u=i,f=i,c=0;c<n.length;c++){var g=n[c][0],b=n[c][1];switch(!a&&g!==R&&(o.start1=l,o.start2=h),g){case B:o.diffs[a++]=n[c],o.length2+=b.length,f=f.substring(0,h)+b+f.substring(h);break;case L:o.length1+=b.length,o.diffs[a++]=n[c],f=f.substring(0,h)+f.substring(h+b.length);break;case R:b.length<=2*this.Patch_Margin&&a&&n.length!=c+1?(o.diffs[a++]=n[c],o.length1+=b.length,o.length2+=b.length):b.length>=2*this.Patch_Margin&&a&&(this.patch_addContext_(o,u),r.push(o),o=new m.patch_obj,a=0,u=f,l=h);break}g!==B&&(l+=b.length),g!==L&&(h+=b.length)}return a&&(this.patch_addContext_(o,u),r.push(o)),r};m.prototype.patch_deepCopy=function(s){for(var e=[],t=0;t<s.length;t++){var i=s[t],n=new m.patch_obj;n.diffs=[];for(var r=0;r<i.diffs.length;r++)n.diffs[r]=new m.Diff(i.diffs[r][0],i.diffs[r][1]);n.start1=i.start1,n.start2=i.start2,n.length1=i.length1,n.length2=i.length2,e[t]=n}return e};m.prototype.patch_apply=function(s,e){if(s.length==0)return[e,[]];s=this.patch_deepCopy(s);var t=this.patch_addPadding(s);e=t+e+t,this.patch_splitMax(s);for(var i=0,n=[],r=0;r<s.length;r++){var o=s[r].start2+i,a=this.diff_text1(s[r].diffs),l,h=-1;if(a.length>this.Match_MaxBits?(l=this.match_main(e,a.substring(0,this.Match_MaxBits),o),l!=-1&&(h=this.match_main(e,a.substring(a.length-this.Match_MaxBits),o+a.length-this.Match_MaxBits),(h==-1||l>=h)&&(l=-1))):l=this.match_main(e,a,o),l==-1)n[r]=!1,i-=s[r].length2-s[r].length1;else{n[r]=!0,i=l-o;var u;if(h==-1?u=e.substring(l,l+a.length):u=e.substring(l,h+this.Match_MaxBits),a==u)e=e.substring(0,l)+this.diff_text2(s[r].diffs)+e.substring(l+a.length);else{var f=this.diff_main(a,u,!1);if(a.length>this.Match_MaxBits&&this.diff_levenshtein(f)/a.length>this.Patch_DeleteThreshold)n[r]=!1;else{this.diff_cleanupSemanticLossless(f);for(var c=0,g,b=0;b<s[r].diffs.length;b++){var p=s[r].diffs[b];p[0]!==R&&(g=this.diff_xIndex(f,c)),p[0]===B?e=e.substring(0,l+g)+p[1]+e.substring(l+g):p[0]===L&&(e=e.substring(0,l+g)+e.substring(l+this.diff_xIndex(f,c+p[1].length))),p[0]!==L&&(c+=p[1].length)}}}}}return e=e.substring(t.length,e.length-t.length),[e,n]};m.prototype.patch_addPadding=function(s){for(var e=this.Patch_Margin,t="",i=1;i<=e;i++)t+=String.fromCharCode(i);for(var i=0;i<s.length;i++)s[i].start1+=e,s[i].start2+=e;var n=s[0],r=n.diffs;if(r.length==0||r[0][0]!=R)r.unshift(new m.Diff(R,t)),n.start1-=e,n.start2-=e,n.length1+=e,n.length2+=e;else if(e>r[0][1].length){var o=e-r[0][1].length;r[0][1]=t.substring(r[0][1].length)+r[0][1],n.start1-=o,n.start2-=o,n.length1+=o,n.length2+=o}if(n=s[s.length-1],r=n.diffs,r.length==0||r[r.length-1][0]!=R)r.push(new m.Diff(R,t)),n.length1+=e,n.length2+=e;else if(e>r[r.length-1][1].length){var o=e-r[r.length-1][1].length;r[r.length-1][1]+=t.substring(0,o),n.length1+=o,n.length2+=o}return t};m.prototype.patch_splitMax=function(s){for(var e=this.Match_MaxBits,t=0;t<s.length;t++)if(!(s[t].length1<=e)){var i=s[t];s.splice(t--,1);for(var n=i.start1,r=i.start2,o="";i.diffs.length!==0;){var a=new m.patch_obj,l=!0;for(a.start1=n-o.length,a.start2=r-o.length,o!==""&&(a.length1=a.length2=o.length,a.diffs.push(new m.Diff(R,o)));i.diffs.length!==0&&a.length1<e-this.Patch_Margin;){var h=i.diffs[0][0],u=i.diffs[0][1];h===B?(a.length2+=u.length,r+=u.length,a.diffs.push(i.diffs.shift()),l=!1):h===L&&a.diffs.length==1&&a.diffs[0][0]==R&&u.length>2*e?(a.length1+=u.length,n+=u.length,l=!1,a.diffs.push(new m.Diff(h,u)),i.diffs.shift()):(u=u.substring(0,e-a.length1-this.Patch_Margin),a.length1+=u.length,n+=u.length,h===R?(a.length2+=u.length,r+=u.length):l=!1,a.diffs.push(new m.Diff(h,u)),u==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(u.length))}o=this.diff_text2(a.diffs),o=o.substring(o.length-this.Patch_Margin);var f=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);f!==""&&(a.length1+=f.length,a.length2+=f.length,a.diffs.length!==0&&a.diffs[a.diffs.length-1][0]===R?a.diffs[a.diffs.length-1][1]+=f:a.diffs.push(new m.Diff(R,f))),l||s.splice(++t,0,a)}}};m.prototype.patch_toText=function(s){for(var e=[],t=0;t<s.length;t++)e[t]=s[t];return e.join("")};m.prototype.patch_fromText=function(s){var e=[];if(!s)return e;for(var t=s.split(`\n`),i=0,n=/^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$/;i<t.length;){var r=t[i].match(n);if(!r)throw new Error("Invalid patch string: "+t[i]);var o=new m.patch_obj;for(e.push(o),o.start1=parseInt(r[1],10),r[2]===""?(o.start1--,o.length1=1):r[2]=="0"?o.length1=0:(o.start1--,o.length1=parseInt(r[2],10)),o.start2=parseInt(r[3],10),r[4]===""?(o.start2--,o.length2=1):r[4]=="0"?o.length2=0:(o.start2--,o.length2=parseInt(r[4],10)),i++;i<t.length;){var a=t[i].charAt(0);try{var l=decodeURI(t[i].substring(1))}catch(h){throw new Error("Illegal escape in patch_fromText: "+l)}if(a=="-")o.diffs.push(new m.Diff(L,l));else if(a=="+")o.diffs.push(new m.Diff(B,l));else if(a==" ")o.diffs.push(new m.Diff(R,l));else{if(a=="@")break;if(a!=="")throw new Error(\'Invalid patch mode "\'+a+\'" in: \'+l)}i++}}return e};m.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0};m.patch_obj.prototype.toString=function(){var s,e;this.length1===0?s=this.start1+",0":this.length1==1?s=this.start1+1:s=this.start1+1+","+this.length1,this.length2===0?e=this.start2+",0":this.length2==1?e=this.start2+1:e=this.start2+1+","+this.length2;for(var t=["@@ -"+s+" +"+e+` @@\n`],i,n=0;n<this.diffs.length;n++){switch(this.diffs[n][0]){case B:i="+";break;case L:i="-";break;case R:i=" ";break}t[n+1]=i+encodeURI(this.diffs[n][1])+`\n`}return t.join("").replace(/%20/g," ")};Qe.exports=m;Qe.exports.diff_match_patch=m;Qe.exports.DIFF_DELETE=L;Qe.exports.DIFF_INSERT=B;Qe.exports.DIFF_EQUAL=R});var Z={addition:["{++","++}"],deletion:["{--","--}"],substitution:["{~~","~>","~~}"],highlight:["{==","==}"],comment:["{>>","<<}"]},Bi={"{++":["++}"],"{--":["--}"],"{~~":["~>","~~}"],"{==":["==}"],"{>>":["<<}"]};var pt={a:"author",t:"time",d:"done",s:"style",c:"color"},ne=class{constructor(e,t,i,n,r,o){this.from=e;this.to=t;this.type=i;this.repr=n;this.text=r;this.metadata=o;E(this,"fields",{});E(this,"replies",[]);if(o!==void 0){let a=o-e,l=r.slice(3,a);this.text=r.slice(0,3)+r.slice(a+2);try{this.fields=JSON.parse(l);for(let h in this.fields)h in pt&&(this.fields[pt[h]]=this.fields[h],delete this.fields[h])}catch(h){this.fields={}}}}get base_range(){return this}get full_thread(){return[this,...this.replies]}get thread(){return[...this.replies]}get length(){return this.to-this.from-6}get full_text(){return this.text+this.replies.map(e=>e.text).join("")}get range_start(){return this.metadata?this.metadata+2:this.from+3}get range_front(){return this.metadata?this.metadata-1:this.from}get full_range_front(){return this.base_range.from}get full_range_back(){return this.base_range.replies.length?this.base_range.replies[this.base_range.replies.length-1].to:this.to}range_type(e,t){return this.type}remove_metadata(){return this.metadata?[{from:this.from+3,to:this.metadata+2,insert:""}]:[]}delete_metadata(e){return e in pt&&(e=pt[e]),e in this.fields&&(delete this.fields[e],Object.keys(this.fields).length===0?this.remove_metadata():this.set_metadata(this.fields)),[]}add_metadata(e,t){return this.fields[e]=t,this.set_metadata(this.fields)}set_metadata(e){return this.fields=e,this.metadata!==void 0?[{from:this.from+3,to:this.metadata,insert:JSON.stringify(e)}]:[{from:this.from+3,to:this.from+3,insert:JSON.stringify(e)+"@@"}]}has_comment(e){return this.thread.includes(e)}copy(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}equals(e){return this.type===e.type&&this.from===e.from&&this.to===e.to&&this.replies.length===e.replies.length&&this.full_text===e.full_text}left_adjacent(e){return this.from===e.to}right_adjacent(e){return this.to===e.from}part_is_empty(e){return!1}empty(){return this.to-this.from===6}unwrap(){return this.text.slice(3,-3)}unwrap_bracket(e=!1){return e?this.text.slice(3):this.text.slice(0,-3)}unwrap_parts(){return[this.unwrap()]}unwrap_slice(e,t){return e-=this.range_front,t-=this.range_front,t<=0||e===t?"":this.text.slice(Math.max(3,e),Math.min(this.text.length-3,t))}partially_in_range(e,t){return!(e>this.to||t<this.from)}partially_in_full_range(e,t){return!(e>this.full_range_back||t<this.full_range_front)}encloses_range(e,t,i=!1){return i?this.from<e&&this.to>t:this.from<=e&&this.to>=t}part_encloses_range(e,t,i){return this.encloses_range(e,t)}accept(e=!0){return this.text}reject(e=!0){return this.text}touches(e){return this.from===e||this.to===e}cursor_inside(e){return this.from<=e&&e<=this.to}cursor_before_range(e){return e<this.from}cursor_after_range(e){return e>this.to}cursor_move_inside(e,t=!1){return Math.min(Math.max(t&&this.metadata?this.metadata+2:this.from+3,e),this.to-3)}cursor_pass_syntax(e,t,i=!1){return t?(this.touches_left_bracket(e,!0,!1,i)&&(e=i&&this.metadata?this.metadata+2:this.from+3),this.touches_right_bracket(e,!1,!0)&&(e=this.to)):(this.touches_right_bracket(e,!0,!1)&&(e=this.to-3),this.touches_left_bracket(e,!1,!0,i)&&(e=this.from)),e}cursor_move_through(e,t,i){return i=="unchanged"||!this.cursor_inside(e)||(i=="ignore_completely"?e=t?this.to:this.from:e=this.cursor_pass_syntax(e,t,i=="ignore_metadata")),e}touches_left_bracket(e,t=!1,i=!1,n=!1){return e+(t?0:1)>=this.from&&e+(i?0:1)<=(n&&this.metadata?this.metadata+2:this.from+3)}touches_separator(e,t=!1,i=!1){return!1}touches_right_bracket(e,t=!1,i=!1){return e-(i?0:1)>=this.to-3&&e-(t?0:1)<=this.to}touches_bracket(e,t,i=!1,n=!1){return t?this.touches_left_bracket(e,i,n):this.touches_right_bracket(e,i,n)}postprocess(e=!0,t=0,i="div",n=null,r){let o=r!=null?r:this.text;return!r&&e&&(this.to>=o.length&&!o.endsWith(Z[this.type].at(-1))?o=this.unwrap_bracket(!0):o=this.unwrap()),`<${i} class=\'cmtr-${this.repr.toLowerCase()}\'>${o}</${i}>`}apply_offset(e){this.from+=e,this.to+=e,this.metadata!==void 0&&(this.metadata+=e)}split_range(e){return[this.text.slice(-3),this.text.slice(0,3)+(this.metadata?JSON.stringify(this.fields)+"@@":"")]}};var xe=class extends ne{constructor(e,t,i,n){super(e,t,"addition","Addition",i,n)}accept(){return this.unwrap()}reject(){return""}postprocess(e=!0,t=0,i="div",n=null,r){let o=r!=null?r:this.text;!r&&e&&(this.to>=o.length&&!o.endsWith(Z[this.type].at(-1))?o=this.unwrap_bracket(!0):o=this.unwrap());let a="cmtr-preview";return t===0?a+=" cmtr-addition":t===2&&(o=""),`<${i} class=\'${a}\'>${o}</${i}>`}};var Oe=class extends ne{constructor(t,i,n,r){super(t,i,"comment","Comment",n,r);E(this,"reply_depth",0);E(this,"attached_comment",null)}get base_range(){return this.attached_comment||this}get thread(){return this.attached_comment?[...this.attached_comment.thread]:[this,...this.replies]}accept(t=!0){return t?"":this.unwrap()}reject(t=!0){return t?"":this.unwrap()}clear_references(){this.attached_comment=null,this.reply_depth=0}add_reply(t){this.attach_to_range(t.type==="comment"?t.base_range:t)}attach_to_range(t){t.replies.push(this),this.reply_depth=t.replies.length-(t.type==="comment"?0:1),this.attached_comment=t}};var Ie=class extends ne{constructor(e,t,i,n){super(e,t,"deletion","Deletion",i,n)}accept(){return""}reject(){return this.unwrap()}postprocess(e=!0,t=0,i="div",n=null,r){let o=r!=null?r:this.text;!r&&e&&(this.to>=o.length&&!o.endsWith(Z[this.type].at(-1))?o=this.unwrap_bracket(!0):o=this.unwrap());let a="cmtr-preview";return t===0?a+=" cmtr-deletion":t===1&&(o=""),`<${i} class=\'${a}\'>${o}</${i}>`}};var Ae=class extends ne{constructor(e,t,i,n){super(e,t,"highlight","Highlight",i,n)}};var Pe=class extends ne{constructor(t,i,n,r,o){super(t,n,"substitution","Substitution",r,o);this.middle=i}get length(){return this.to-this.from-8}get char_middle(){return this.middle-this.range_front}range_type(t,i){return i<=this.middle+2?"deletion":t>=this.middle?"addition":"substitution"}unwrap(){return this.text.slice(3,this.char_middle)+this.text.slice(this.char_middle+2,-3)}unwrap_parts(){return[this.text.slice(3,this.char_middle),this.text.slice(this.char_middle+2,-3)]}unwrap_slice_parts_inverted(t,i){return t-=this.range_front,i-=this.range_front,t=Math.max(0,t),i<=0?this.unwrap_parts():i<=this.char_middle?[this.text.slice(3,t)+this.text.slice(i,this.char_middle),this.text.slice(this.char_middle+2,-3)]:t>=this.char_middle+2?[this.text.slice(3,this.char_middle),this.text.slice(this.char_middle+2,t)+this.text.slice(i,-3)]:[this.text.slice(3,t),this.text.slice(i,-3)]}unwrap_parts_bracket(t,i=0){return t?[this.text.slice(3,this.char_middle),this.text.slice(this.char_middle+2)]:[this.text.slice(0,this.char_middle),this.text.slice(this.char_middle+2,-3)]}unwrap_slice(t,i){return t-=this.range_front,i-=this.range_front,i<=0||t===i?"":t>=this.char_middle?this.text.slice(Math.max(this.char_middle+2,t),Math.min(this.text.length-3,i)):i<=this.char_middle?this.text.slice(Math.max(3,t),Math.min(this.char_middle,i)):this.text.slice(Math.max(3,t),this.char_middle)+this.text.slice(this.char_middle+2,Math.min(this.text.length-3,i))}accept(){return this.unwrap_parts()[1]}reject(){return this.unwrap_parts()[0]}touches_separator(t,i=!1,n=!1){return t+(i?1:0)>=this.middle&&t-(n?0:1)<=this.middle+2}contains_separator(t,i){return t<=this.middle+2&&i>=this.middle}contains_part(t,i,n=!0){return n?i<this.middle?!0:t>this.middle+2?!1:void 0:i<=this.middle?!0:t>=this.middle+2?!1:void 0}cursor_pass_syntax(t,i,n=!1){return i?(this.touches_left_bracket(t,!0,!1,n)&&(t=n&&this.metadata?this.metadata+2:this.from+3),this.touches_separator(t,!1,!0)&&(t=this.middle+2),this.touches_right_bracket(t,!1,!0)&&(t=this.to)):(this.touches_right_bracket(t,!0,!1)&&(t=this.to-3),this.touches_separator(t,!1,!0)&&(t=this.middle),this.touches_left_bracket(t,!1,!0,n)&&(t=this.from)),t}part_encloses_range(t,i,n){return n?this.from<=t&&i<=this.middle+2:this.middle<=t&&i<=this.to}empty(){return this.from+3===this.middle&&this.middle+2===this.to-3}part_is_empty(t){return t?this.from+3===this.middle:this.middle+2===this.to-3}postprocess(t=!0,i=0,n="div",r=null,o){let a=o!=null?o:this.text,l=[a];!o&&t&&(this.to>=a.length&&!a.endsWith(Z.substitution[2])?l=this.unwrap_parts_bracket(!0):this.from<=0&&!a.startsWith(Z.substitution[0])?l=this.unwrap_parts_bracket(!1):l=this.unwrap_parts());let h="cmtr-preview";return l.length===1&&(l[+r]=l[0],l[+!r]=""),a="",i===0?(l[0].length&&(a+=`<${n} class=\'${h} cmtr-deletion\'>${l[0]}</${n}>`),l[1].length&&(a+=`<${n} class=\'${h} cmtr-addition\'>${l[1]}</${n}>`)):i===1?l[1].length&&(a+=`<${n} class=\'${h}\'>${l[1]}</${n}>`):l[0].length&&(a+=`<${n} class=\'${h}\'>${l[0]}</${n}>`),a}apply_offset(t){this.from+=t,this.middle+=t,this.to+=t,this.metadata!==void 0&&(this.metadata+=t)}split_range(t){let i=super.split_range(t);return t<=this.middle?i[0]=Z.substitution[1]+i[0]:i[1]=i[1]+Z.substitution[1],i}cursor_move_inside(t,i=!1){return t=super.cursor_move_inside(t,i),t==this.middle+1&&(t=this.middle+2),t}};var Rs=require("@codemirror/state");var Qn=class jt{constructor(e,t){this.low=e,this.high=t}clone(){return new jt(this.low,this.high)}get max(){return this.clone()}less_than(e){return this.low<e.low||this.low===e.low&&this.high<e.high}equal_to(e){return this.low===e.low&&this.high===e.high}intersect(e){return!this.not_intersect(e)}not_intersect(e){return this.high<e.low||e.high<this.low}merge(e){return new jt(this.low===void 0?e.low:this.low<e.low?this.low:e.low,this.high===void 0?e.high:this.high>e.high?this.high:e.high)}output(){return[this.low,this.high]}static comparable_max(e,t){return e.merge(t)}static comparable_less_than(e,t){return e<t}},W=0,N=1,pe=class{constructor(e=void 0,t=void 0,i=null,n=null,r=null,o=N){if(this.left=i,this.right=n,this.parent=r,this.color=o,this.item={key:e,value:t},e&&e instanceof Array&&e.length===2&&!Number.isNaN(e[0])&&!Number.isNaN(e[1])){let[a,l]=e;a>l&&([a,l]=[l,a]),this.item.key=new Qn(a,l)}this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.value===void 0&&this.left===null&&this.right===null&&this.color===N}_value_less_than(e){return this.item.value&&e.item.value&&this.item.value.less_than?this.item.value.less_than(e.item.value):this.item.value<e.item.value}less_than(e){return this.item.value===this.item.key&&e.item.value===e.item.key?this.item.key.less_than(e.item.key):this.item.key.less_than(e.item.key)||this.item.key.equal_to(e.item.key)&&this._value_less_than(e)}_value_equal(e){return this.item.value&&e.item.value&&this.item.value.equal_to?this.item.value.equal_to(e.item.value):this.item.value===e.item.value}equal_to(e){return this.item.value===this.item.key&&e.item.value===e.item.key?this.item.key.equal_to(e.item.key):this.item.key.equal_to(e.item.key)&&this._value_equal(e)}intersect(e){return this.item.key.intersect(e.item.key)}copy_data(e){this.item.key=e.item.key,this.item.value=e.item.value}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right&&this.right.max){let e=this.item.key.constructor.comparable_max;this.max=e(this.max,this.right.max)}if(this.left&&this.left.max){let e=this.item.key.constructor.comparable_max;this.max=e(this.max,this.left.max)}}not_intersect_left_subtree(e){let t=this.item.key.constructor.comparable_less_than,i=this.left.max.high!==void 0?this.left.max.high:this.left.max;return t(i,e.item.key.low)}not_intersect_right_subtree(e){let t=this.item.key.constructor.comparable_less_than,i=this.right.max.low!==void 0?this.right.max.low:this.right.item.key.low;return t(e.item.key.high,i)}},mt=class s{constructor(){this.root=null,this.nil_node=new pe}get size(){let e=0;return this.tree_walk(this.root,()=>e++),e}get keys(){let e=[];return this.tree_walk(this.root,t=>e.push(t.item.key.output?t.item.key.output():t.item.key)),e}get values(){let e=[];return this.tree_walk(this.root,t=>e.push(t.item.value)),e}get items(){let e=[];return this.tree_walk(this.root,t=>e.push({key:t.item.key.output?t.item.key.output():t.item.key,value:t.item.value})),e}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(e,t=e){if(e===void 0)return;let i=new pe(e,t,this.nil_node,this.nil_node,null,W);return this.tree_insert(i),this.recalc_max(i),i}exist(e,t=e){let i=new pe(e,t);return!!this.tree_search(this.root,i)}remove(e,t=e){let i=new pe(e,t),n=this.tree_search(this.root,i);return n&&this.tree_delete(n),n}search(e,t=(i,n)=>i===n?n.output():i){let i=new pe(e),n=[];return this.tree_search_interval(this.root,i,n),n.map(r=>t(r.item.value,r.item.key))}intersect_any(e){let t=new pe(e);return this.tree_find_any_interval(this.root,t)}forEach(e){this.tree_walk(this.root,t=>e(t.item.key,t.item.value))}map(e){let t=new s;return this.tree_walk(this.root,i=>t.insert(i.item.key,e(i.item.value,i.item.key))),t}*iterate(e,t=(i,n)=>i===n?n.output():i){let i;for(e?i=this.tree_search_nearest_forward(this.root,new pe(e)):this.root&&(i=this.local_minimum(this.root));i;)yield t(i.item.value,i.item.key),i=this.tree_successor(i)}recalc_max(e){let t=e;for(;t.parent!=null;)t.parent.update_max(),t=t.parent}tree_insert(e){let t=this.root,i=null;if(this.root==null||this.root===this.nil_node)this.root=e;else{for(;t!==this.nil_node;)i=t,e.less_than(t)?t=t.left:t=t.right;e.parent=i,e.less_than(i)?i.left=e:i.right=e}this.insert_fixup(e)}insert_fixup(e){let t,i;for(t=e;t!==this.root&&t.parent.color===W;)t.parent===t.parent.parent.left?(i=t.parent.parent.right,i.color===W?(t.parent.color=N,i.color=N,t.parent.parent.color=W,t=t.parent.parent):(t===t.parent.right&&(t=t.parent,this.rotate_left(t)),t.parent.color=N,t.parent.parent.color=W,this.rotate_right(t.parent.parent))):(i=t.parent.parent.left,i.color===W?(t.parent.color=N,i.color=N,t.parent.parent.color=W,t=t.parent.parent):(t===t.parent.left&&(t=t.parent,this.rotate_right(t)),t.parent.color=N,t.parent.parent.color=W,this.rotate_left(t.parent.parent)));this.root.color=N}tree_delete(e){let t,i;e.left===this.nil_node||e.right===this.nil_node?t=e:t=this.tree_successor(e),t.left!==this.nil_node?i=t.left:i=t.right,i.parent=t.parent,t===this.root?this.root=i:(t===t.parent.left?t.parent.left=i:t.parent.right=i,t.parent.update_max()),this.recalc_max(i),t!==e&&(e.copy_data(t),e.update_max(),this.recalc_max(e)),t.color===N&&this.delete_fixup(i)}delete_fixup(e){let t=e,i;for(;t!==this.root&&t.parent!=null&&t.color===N;)t===t.parent.left?(i=t.parent.right,i.color===W&&(i.color=N,t.parent.color=W,this.rotate_left(t.parent),i=t.parent.right),i.left.color===N&&i.right.color===N?(i.color=W,t=t.parent):(i.right.color===N&&(i.color=W,i.left.color=N,this.rotate_right(i),i=t.parent.right),i.color=t.parent.color,t.parent.color=N,i.right.color=N,this.rotate_left(t.parent),t=this.root)):(i=t.parent.left,i.color===W&&(i.color=N,t.parent.color=W,this.rotate_right(t.parent),i=t.parent.left),i.left.color===N&&i.right.color===N?(i.color=W,t=t.parent):(i.left.color===N&&(i.color=W,i.right.color=N,this.rotate_left(i),i=t.parent.left),i.color=t.parent.color,t.parent.color=N,i.left.color=N,this.rotate_right(t.parent),t=this.root));t.color=N}tree_search(e,t){if(!(e==null||e===this.nil_node))return t.equal_to(e)?e:t.less_than(e)?this.tree_search(e.left,t):this.tree_search(e.right,t)}tree_search_nearest_forward(e,t){let i,n=e;for(;n&&n!==this.nil_node;)n.less_than(t)?n.intersect(t)?(i=n,n=n.left):n=n.right:((!i||n.less_than(i))&&(i=n),n=n.left);return i||null}tree_search_interval(e,t,i){e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(t)&&this.tree_search_interval(e.left,t,i),e.intersect(t)&&i.push(e),e.right!==this.nil_node&&!e.not_intersect_right_subtree(t)&&this.tree_search_interval(e.right,t,i))}tree_find_any_interval(e,t){let i=!1;return e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(t)&&(i=this.tree_find_any_interval(e.left,t)),i||(i=e.intersect(t)),!i&&e.right!==this.nil_node&&!e.not_intersect_right_subtree(t)&&(i=this.tree_find_any_interval(e.right,t))),i}local_minimum(e){let t=e;for(;t.left!=null&&t.left!==this.nil_node;)t=t.left;return t}local_maximum(e){let t=e;for(;t.right!=null&&t.right!==this.nil_node;)t=t.right;return t}tree_successor(e){let t,i,n;if(e.right!==this.nil_node)t=this.local_minimum(e.right);else{for(i=e,n=e.parent;n!=null&&n.right===i;)i=n,n=n.parent;t=n}return t}rotate_left(e){let t=e.right;e.right=t.left,t.left!==this.nil_node&&(t.left.parent=e),t.parent=e.parent,e===this.root?this.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,e!=null&&e!==this.nil_node&&e.update_max(),t=e.parent,t!=null&&t!==this.nil_node&&t.update_max()}rotate_right(e){let t=e.left;e.left=t.right,t.right!==this.nil_node&&(t.right.parent=e),t.parent=e.parent,e===this.root?this.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.right=e,e.parent=t,e!==null&&e!==this.nil_node&&e.update_max(),t=e.parent,t!=null&&t!==this.nil_node&&t.update_max()}tree_walk(e,t){e!=null&&e!==this.nil_node&&(this.tree_walk(e.left,t),t(e),this.tree_walk(e.right,t))}testRedBlackProperty(){let e=!0;return this.tree_walk(this.root,function(t){t.color===W&&(t.left.color===N&&t.right.color===N||(e=!1))}),e}testBlackHeightProperty(e){let t=0,i=0,n=0;if(e.color===N&&t++,e.left!==this.nil_node?i=this.testBlackHeightProperty(e.left):i=1,e.right!==this.nil_node?n=this.testBlackHeightProperty(e.right):n=1,i!==n)throw new Error("Red-black height property violated");return t+=i,t}};var gt=class{constructor(e){E(this,"ranges");E(this,"tree");this.ranges=e,this.tree=new mt;for(let t of e)this.tree.insert([t.from,t.to],t)}empty(){return this.ranges.length===0}get(e){return e<0?this.ranges[this.ranges.length+e]:this.ranges[e]}at_cursor(e,t=!1){let i=this.tree.search([e,e]);return i.length?t&&i.length>1?i[1]:i[0]:void 0}contains_range(e,t){return this.tree.intersect_any([e,t])}range_adjacent_to_cursor(e,t,i=!1,n=!1){let r=t?this.ranges.slice().reverse():this.ranges;return n?r.find(o=>t?(i?o.from:o.to)<e:e<(i?o.to:o.from)):r.find(o=>t?(i?o.from:o.to)<=e:e<=(i?o.to:o.from))}adjacent_range(e,t,i=!1){let n=this.ranges.findIndex(o=>o===e);if(n===-1)return;let r=t?this.ranges[n-1]:this.ranges[n+1];if(r)if(i){if(t?r.to===e.from:e.to===r.from)return r}else return r}ranges_in_interval(e,t){return this.tree.search([e,t])}ranges_in_intervals(e){let t=new Set;for(let i of e)for(let n of this.tree.search([i.from,i.to]))if(t.add(n),n.base_range){t.add(n.base_range);for(let r of n.base_range.replies)t.add(r)}return Array.from(t).sort((i,n)=>i.from-n.from)}unwrap_in_range(e,t=0,i=e.length,n=null){let r,o;if(n||(n=this.ranges_in_interval(t,i)),n.length===0)return{output:e.sliceString(t,i),from:t,to:i};let a="";t<n[0].from?a+=e.sliceString(t,n[0].from):r=n[0];let l=-1;for(let f of n)l!==-1&&(a+=e.sliceString(l,f.from)),a+=f.unwrap_slice(Math.max(0,t),i),l=f.to;i>=n.at(-1).to?a+=e.sliceString(n.at(-1).to,i):o=n.at(-1);let h=r?r.cursor_pass_syntax(t,!1):t,u=o?o.cursor_pass_syntax(i,!0):i;return(h!==t||t===(r==null?void 0:r.from))&&(r=void 0),(u!==i||i===(o==null?void 0:o.to))&&(o=void 0),{output:a,from:h,to:u,front_range:r,back_range:o}}};var Fu=require("@codemirror/view");var Zs=require("@codemirror/state");var js=require("@codemirror/state");var Pn=require("@codemirror/state"),Rn=require("@codemirror/language");var Xn=0;var z=class{constructor(e={}){this.id=Xn++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn\'t define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can\'t add per-node props to node types");return typeof e!="function"&&(e=ge.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}};z.closedBy=new z({deserialize:s=>s.split(" ")});z.openedBy=new z({deserialize:s=>s.split(" ")});z.group=new z({deserialize:s=>s.split(" ")});z.isolate=new z({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});z.contextHash=new z({perNode:!0});z.lookAhead=new z({perNode:!0});z.mounted=new z({perNode:!0});var Re=class{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[z.mounted.id]}},Kn=Object.create(null),ge=class s{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Kn,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new s(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can\'t store a per-node prop on a node type");t[r[0].id]=r[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(z.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(z.group),r=-1;r<(n?n.length:0);r++){let o=t[r<0?i.name:n[r]];if(o)return o}}}};ge.none=new ge("",Object.create(null),0,8);var _t=new WeakMap,zi=new WeakMap,Q;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays"})(Q||(Q={}));var me=class s{constructor(e,t,i,n,r){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Re.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new tt(this.topNode,e)}cursorAt(e,t=0,i=0){let n=_t.get(this)||this.topNode,r=new tt(n);return r.moveTo(e,t),_t.set(this,r._tree),r}get topNode(){return new ue(this,0,0,null)}resolve(e,t=0){let i=Je(_t.get(this)||this.topNode,e,t,!1);return _t.set(this,i),i}resolveInner(e,t=0){let i=Je(zi.get(this)||this.topNode,e,t,!0);return zi.set(this,i),i}resolveStack(e,t=0){return Zn(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:r=this.length}=e,o=e.mode||0,a=(o&Q.IncludeAnonymous)>0;for(let l=this.cursor(o|Q.IncludeAnonymous);;){let h=!1;if(l.from<=r&&l.to>=n&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;h=!0}for(;h&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Xt(ge.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new s(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new s(ge.none,t,i,n)))}static build(e){return Jn(e)}};me.empty=new me(ge.none,[],[],0);var $t=class s{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s(this.buffer,this.index)}},ve=class s{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ge.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],r=n.name;if(/\\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),e+=4,i==e)return r;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,i,n,r){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(ji(r,n,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(e,t,i){let n=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){r[l++]=n[a++],r[l++]=n[a++]-i;let h=r[l++]=n[a++]-i;r[l++]=n[a++]-e,o=Math.max(o,h)}return new s(r,o,this.set)}};function ji(s,e,t,i){switch(s){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Je(s,e,t,i){for(var n;s.from==s.to||(t<1?s.from>=e:s.from>e)||(t>-1?s.to<=e:s.to<e);){let o=!i&&s instanceof ue&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:Q.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof ue&&o.index<0&&((n=a.enter(e,t,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=a);for(;;){let o=s.enter(e,t,r);if(!o)return s;s=o}}var wt=class{cursor(e=0){return new tt(this,e)}getChild(e,t=null,i=null){let n=Vi(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Vi(this,e,t,i)}resolve(e,t=0){return Je(this,e,t,!1)}resolveInner(e,t=0){return Je(this,e,t,!0)}matchContext(e){return Wt(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}},ue=class s extends wt{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,r=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,h=t>0?a.length:-1;e!=h;e+=t){let u=a[e],f=l[e]+o.from;if(ji(n,i,f,f+u.length)){if(u instanceof ve){if(r&Q.ExcludeBuffers)continue;let c=u.findChild(0,u.buffer.length,t,i-f,n);if(c>-1)return new et(new Yt(o,u,e,f),null,c)}else if(r&Q.IncludeAnonymous||!u.type.isAnonymous||Qt(u)){let c;if(!(r&Q.IgnoreMounts)&&(c=Re.get(u))&&!c.overlay)return new s(c.tree,f,e,o);let g=new s(u,f,e,o);return r&Q.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(t<0?u.children.length-1:0,t,i,n)}}}if(r&Q.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let n;if(!(i&Q.IgnoreOverlays)&&(n=Re.get(this._tree))&&n.overlay){let r=e-this.from;for(let{from:o,to:a}of n.overlay)if((t>0?o<=r:o<r)&&(t<0?a>=r:a>r))return new s(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Vi(s,e,t,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(e)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function Wt(s,e,t=e.length-1){for(let i=s;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}var Yt=class{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}},et=class s extends wt{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new s(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&Q.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new s(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new s(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new s(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];e.push(i.slice(n,r,o)),t.push(0)}return new me(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function $i(s){if(!s.length)return null;let e=0,t=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>t.from||o.to<t.to)&&(t=o,e=r)}let i=t instanceof ue&&t.index<0?null:t.parent,n=s.slice();return i?n[e]=i:n.splice(e,1),new qt(n,t)}var qt=class{constructor(e,t){this.heads=e,this.node=t}get next(){return $i(this.heads)}};function Zn(s,e,t){let i=s.resolveInner(e,t),n=null;for(let r=i instanceof ue?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(e,t)),r=o}else{let o=Re.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new ue(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(Je(a,e,t,!1))}}return n?$i(n):i}var tt=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ue)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof ue?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&Q.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Q.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Q.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let a=i._tree.children[r];if(this.mode&Q.IncludeAnonymous||a instanceof ve||!a.type.isAnonymous||Qt(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=r+1;break e}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)t=new et(this.buffer,t,this.stack[n]);return this.bufferNode=new et(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return Wt(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return Wt(this._tree,e,n);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}};function Qt(s){return s.children.some(e=>e instanceof ve||!e.type.isAnonymous||Qt(e))}function Jn(s){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=1024,reused:r=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(t)?new $t(t,t.length):t,l=i.types,h=0,u=0;function f(w,y,d,x,S,P){let{id:v,start:_,end:C,size:O}=a,D=u,$=h;for(;O<0;)if(a.next(),O==-1){let H=r[v];d.push(H),x.push(_-w);return}else if(O==-3){h=v;return}else if(O==-4){u=v;return}else throw new RangeError(`Unrecognized record size: ${O}`);let oe=l[v],ce,X,Xe=_-w;if(C-_<=n&&(X=I(a.pos-y,S))){let H=new Uint16Array(X.size-X.skip),U=a.pos-X.size,V=H.length;for(;a.pos>U;)V=M(X.start,H,V);ce=new ve(H,C-X.start,i),Xe=X.start-w}else{let H=a.pos-O;a.next();let U=[],V=[],K=v>=o?v:-1,ee=0,de=C;for(;a.pos>H;)K>=0&&a.id==K&&a.size>=0?(a.end<=de-n&&(b(U,V,_,ee,a.end,de,K,D,$),ee=U.length,de=a.end),a.next()):P>2500?c(_,H,U,V):f(_,H,U,V,K,P+1);if(K>=0&&ee>0&&ee<U.length&&b(U,V,_,ee,_,de,K,D,$),U.reverse(),V.reverse(),K>-1&&ee>0){let Ke=g(oe,$);ce=Xt(oe,U,V,0,U.length,0,C-_,Ke,Ke)}else ce=p(oe,U,V,C-_,D-C,$)}d.push(ce),x.push(Xe)}function c(w,y,d,x){let S=[],P=0,v=-1;for(;a.pos>y;){let{id:_,start:C,end:O,size:D}=a;if(D>4)a.next();else{if(v>-1&&C<v)break;v<0&&(v=O-n),S.push(_,C,O),P++,a.next()}}if(P){let _=new Uint16Array(P*4),C=S[S.length-2];for(let O=S.length-3,D=0;O>=0;O-=3)_[D++]=S[O],_[D++]=S[O+1]-C,_[D++]=S[O+2]-C,_[D++]=D;d.push(new ve(_,S[2]-C,i)),x.push(C-w)}}function g(w,y){return(d,x,S)=>{let P=0,v=d.length-1,_,C;if(v>=0&&(_=d[v])instanceof me){if(!v&&_.type==w&&_.length==S)return _;(C=_.prop(z.lookAhead))&&(P=x[v]+_.length+C)}return p(w,d,x,S,P,y)}}function b(w,y,d,x,S,P,v,_,C){let O=[],D=[];for(;w.length>x;)O.push(w.pop()),D.push(y.pop()+d-S);w.push(p(i.types[v],O,D,P-S,_-P,C)),y.push(S-d)}function p(w,y,d,x,S,P,v){if(P){let _=[z.contextHash,P];v=v?[_].concat(v):[_]}if(S>25){let _=[z.lookAhead,S];v=v?[_].concat(v):[_]}return new me(w,y,d,x,v)}function I(w,y){let d=a.fork(),x=0,S=0,P=0,v=d.end-n,_={size:0,start:0,skip:0};e:for(let C=d.pos-w;d.pos>C;){let O=d.size;if(d.id==y&&O>=0){_.size=x,_.start=S,_.skip=P,P+=4,x+=4,d.next();continue}let D=d.pos-O;if(O<0||D<C||d.start<v)break;let $=d.id>=o?4:0,oe=d.start;for(d.next();d.pos>D;){if(d.size<0)if(d.size==-3)$+=4;else break e;else d.id>=o&&($+=4);d.next()}S=oe,x+=O,P+=$}return(y<0||x==w)&&(_.size=x,_.start=S,_.skip=P),_.size>4?_:void 0}function M(w,y,d){let{id:x,start:S,end:P,size:v}=a;if(a.next(),v>=0&&x<o){let _=d;if(v>4){let C=a.pos-(v-4);for(;a.pos>C;)d=M(w,y,d)}y[--d]=_,y[--d]=P-w,y[--d]=S-w,y[--d]=x}else v==-3?h=x:v==-4&&(u=x);return d}let T=[],k=[];for(;a.pos>0;)f(s.start||0,s.bufferStart||0,T,k,-1,0);let A=(e=s.length)!==null&&e!==void 0?e:T.length?k[0]+T[0].length:0;return new me(l[s.topID],T.reverse(),k.reverse(),A)}var Hi=new WeakMap;function bt(s,e){if(!s.isAnonymous||e instanceof ve||e.type!=s)return 1;let t=Hi.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=s||!(i instanceof me)){t=1;break}t+=bt(s,i)}Hi.set(e,t)}return t}function Xt(s,e,t,i,n,r,o,a,l){let h=0;for(let b=i;b<n;b++)h+=bt(s,e[b]);let u=Math.ceil(h*1.5/8),f=[],c=[];function g(b,p,I,M,T){for(let k=I;k<M;){let A=k,w=p[k],y=bt(s,b[k]);for(k++;k<M;k++){let d=bt(s,b[k]);if(y+d>=u)break;y+=d}if(k==A+1){if(y>u){let d=b[A];g(d.children,d.positions,0,d.children.length,p[A]+T);continue}f.push(b[A])}else{let d=p[k-1]+b[k-1].length-w;f.push(Xt(s,b,p,A,k,w,d,null,l))}c.push(w+T-r)}}return g(e,t,i,n,0),(a||l)(f,c,o)}var De=class s{constructor(e,t,i,n,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new s(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],r=1,o=e.length?e[0]:null;for(let a=0,l=0,h=0;;a++){let u=a<t.length?t[a]:null,f=u?u.fromA:1e9;if(f-l>=i)for(;o&&o.from<f;){let c=o;if(l>=c.from||f<=c.to||h){let g=Math.max(c.from,l)-h,b=Math.min(c.to,f)-h;c=g>=b?null:new s(g,b,c.tree,c.offset+h,a>0,!!u)}if(c&&n.push(c),o.to>f)break;o=r<e.length?e[r++]:null}if(!u)break;l=u.toA,h=u.toA-u.toB}return n}};var so=new z({perNode:!0});var re=require("@codemirror/state");var Ee=re.Facet.define({combine:s=>s[0]}),Kt=new re.Compartment,Wi=re.Facet.define({combine:s=>s[0]}),er=new re.Compartment,Yi=re.Facet.define({combine:s=>s[0]}),tr=new re.Compartment,ir=new re.Compartment,Zt=re.StateEffect.define();var mi=require("@codemirror/language");var nr=0,it=class{constructor(e,t){this.from=e,this.to=t}},G=class{constructor(e={}){this.id=nr++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn\'t define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can\'t add per-node props to node types");return typeof e!="function"&&(e=se.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}};G.closedBy=new G({deserialize:s=>s.split(" ")});G.openedBy=new G({deserialize:s=>s.split(" ")});G.group=new G({deserialize:s=>s.split(" ")});G.isolate=new G({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});G.contextHash=new G({perNode:!0});G.lookAhead=new G({perNode:!0});G.mounted=new G({perNode:!0});var Ne=class{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[G.mounted.id]}},rr=Object.create(null),se=class s{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):rr,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new s(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can\'t store a per-node prop on a node type");t[r[0].id]=r[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(G.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(G.group),r=-1;r<(n?n.length:0);r++){let o=t[r<0?i.name:n[r]];if(o)return o}}}};se.none=new se("",Object.create(null),0,8);var kt=class s{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let n=null;for(let r of e){let o=r(i);o&&(n||(n=Object.assign({},i.props)),n[o[0].id]=o[1])}t.push(n?new se(i.name,n,i.id,i.flags):i)}return new s(t)}},vt=new WeakMap,qi=new WeakMap,j;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays"})(j||(j={}));var J=class s{constructor(e,t,i,n,r){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Ne.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new st(this.topNode,e)}cursorAt(e,t=0,i=0){let n=vt.get(this)||this.topNode,r=new st(n);return r.moveTo(e,t),vt.set(this,r._tree),r}get topNode(){return new fe(this,0,0,null)}resolve(e,t=0){let i=nt(vt.get(this)||this.topNode,e,t,!1);return vt.set(this,i),i}resolveInner(e,t=0){let i=nt(qi.get(this)||this.topNode,e,t,!0);return qi.set(this,i),i}resolveStack(e,t=0){return sr(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:r=this.length}=e,o=e.mode||0,a=(o&j.IncludeAnonymous)>0;for(let l=this.cursor(o|j.IncludeAnonymous);;){let h=!1;if(l.from<=r&&l.to>=n&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;h=!0}for(;h&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:si(se.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new s(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new s(se.none,t,i,n)))}static build(e){return or(e)}};J.empty=new J(se.none,[],[],0);var Jt=class s{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s(this.buffer,this.index)}},ye=class s{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return se.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],r=n.name;if(/\\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),e+=4,i==e)return r;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,i,n,r){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(Ki(r,n,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(e,t,i){let n=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){r[l++]=n[a++],r[l++]=n[a++]-i;let h=r[l++]=n[a++]-i;r[l++]=n[a++]-e,o=Math.max(o,h)}return new s(r,o,this.set)}};function Ki(s,e,t,i){switch(s){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function nt(s,e,t,i){for(var n;s.from==s.to||(t<1?s.from>=e:s.from>e)||(t>-1?s.to<=e:s.to<e);){let o=!i&&s instanceof fe&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:j.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof fe&&o.index<0&&((n=a.enter(e,t,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=a);for(;;){let o=s.enter(e,t,r);if(!o)return s;s=o}}var St=class{cursor(e=0){return new st(this,e)}getChild(e,t=null,i=null){let n=Qi(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Qi(this,e,t,i)}resolve(e,t=0){return nt(this,e,t,!1)}resolveInner(e,t=0){return nt(this,e,t,!0)}matchContext(e){return ei(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}},fe=class s extends St{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,r=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,h=t>0?a.length:-1;e!=h;e+=t){let u=a[e],f=l[e]+o.from;if(Ki(n,i,f,f+u.length)){if(u instanceof ye){if(r&j.ExcludeBuffers)continue;let c=u.findChild(0,u.buffer.length,t,i-f,n);if(c>-1)return new rt(new ti(o,u,e,f),null,c)}else if(r&j.IncludeAnonymous||!u.type.isAnonymous||ri(u)){let c;if(!(r&j.IgnoreMounts)&&(c=Ne.get(u))&&!c.overlay)return new s(c.tree,f,e,o);let g=new s(u,f,e,o);return r&j.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(t<0?u.children.length-1:0,t,i,n)}}}if(r&j.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let n;if(!(i&j.IgnoreOverlays)&&(n=Ne.get(this._tree))&&n.overlay){let r=e-this.from;for(let{from:o,to:a}of n.overlay)if((t>0?o<=r:o<r)&&(t<0?a>=r:a>r))return new s(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Qi(s,e,t,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(e)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function ei(s,e,t=e.length-1){for(let i=s;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}var ti=class{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}},rt=class s extends St{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new s(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&j.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new s(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new s(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new s(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];e.push(i.slice(n,r,o)),t.push(0)}return new J(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Zi(s){if(!s.length)return null;let e=0,t=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>t.from||o.to<t.to)&&(t=o,e=r)}let i=t instanceof fe&&t.index<0?null:t.parent,n=s.slice();return i?n[e]=i:n.splice(e,1),new ii(n,t)}var ii=class{constructor(e,t){this.heads=e,this.node=t}get next(){return Zi(this.heads)}};function sr(s,e,t){let i=s.resolveInner(e,t),n=null;for(let r=i instanceof fe?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(e,t)),r=o}else{let o=Ne.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new fe(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(nt(a,e,t,!1))}}return n?Zi(n):i}var st=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof fe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof fe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&j.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&j.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&j.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let a=i._tree.children[r];if(this.mode&j.IncludeAnonymous||a instanceof ye||!a.type.isAnonymous||ri(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=r+1;break e}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)t=new rt(this.buffer,t,this.stack[n]);return this.bufferNode=new rt(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return ei(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return ei(this._tree,e,n);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}};function ri(s){return s.children.some(e=>e instanceof ye||!e.type.isAnonymous||ri(e))}function or(s){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=1024,reused:r=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(t)?new Jt(t,t.length):t,l=i.types,h=0,u=0;function f(w,y,d,x,S,P){let{id:v,start:_,end:C,size:O}=a,D=u,$=h;for(;O<0;)if(a.next(),O==-1){let H=r[v];d.push(H),x.push(_-w);return}else if(O==-3){h=v;return}else if(O==-4){u=v;return}else throw new RangeError(`Unrecognized record size: ${O}`);let oe=l[v],ce,X,Xe=_-w;if(C-_<=n&&(X=I(a.pos-y,S))){let H=new Uint16Array(X.size-X.skip),U=a.pos-X.size,V=H.length;for(;a.pos>U;)V=M(X.start,H,V);ce=new ye(H,C-X.start,i),Xe=X.start-w}else{let H=a.pos-O;a.next();let U=[],V=[],K=v>=o?v:-1,ee=0,de=C;for(;a.pos>H;)K>=0&&a.id==K&&a.size>=0?(a.end<=de-n&&(b(U,V,_,ee,a.end,de,K,D,$),ee=U.length,de=a.end),a.next()):P>2500?c(_,H,U,V):f(_,H,U,V,K,P+1);if(K>=0&&ee>0&&ee<U.length&&b(U,V,_,ee,_,de,K,D,$),U.reverse(),V.reverse(),K>-1&&ee>0){let Ke=g(oe,$);ce=si(oe,U,V,0,U.length,0,C-_,Ke,Ke)}else ce=p(oe,U,V,C-_,D-C,$)}d.push(ce),x.push(Xe)}function c(w,y,d,x){let S=[],P=0,v=-1;for(;a.pos>y;){let{id:_,start:C,end:O,size:D}=a;if(D>4)a.next();else{if(v>-1&&C<v)break;v<0&&(v=O-n),S.push(_,C,O),P++,a.next()}}if(P){let _=new Uint16Array(P*4),C=S[S.length-2];for(let O=S.length-3,D=0;O>=0;O-=3)_[D++]=S[O],_[D++]=S[O+1]-C,_[D++]=S[O+2]-C,_[D++]=D;d.push(new ye(_,S[2]-C,i)),x.push(C-w)}}function g(w,y){return(d,x,S)=>{let P=0,v=d.length-1,_,C;if(v>=0&&(_=d[v])instanceof J){if(!v&&_.type==w&&_.length==S)return _;(C=_.prop(G.lookAhead))&&(P=x[v]+_.length+C)}return p(w,d,x,S,P,y)}}function b(w,y,d,x,S,P,v,_,C){let O=[],D=[];for(;w.length>x;)O.push(w.pop()),D.push(y.pop()+d-S);w.push(p(i.types[v],O,D,P-S,_-P,C)),y.push(S-d)}function p(w,y,d,x,S,P,v){if(P){let _=[G.contextHash,P];v=v?[_].concat(v):[_]}if(S>25){let _=[G.lookAhead,S];v=v?[_].concat(v):[_]}return new J(w,y,d,x,v)}function I(w,y){let d=a.fork(),x=0,S=0,P=0,v=d.end-n,_={size:0,start:0,skip:0};e:for(let C=d.pos-w;d.pos>C;){let O=d.size;if(d.id==y&&O>=0){_.size=x,_.start=S,_.skip=P,P+=4,x+=4,d.next();continue}let D=d.pos-O;if(O<0||D<C||d.start<v)break;let $=d.id>=o?4:0,oe=d.start;for(d.next();d.pos>D;){if(d.size<0)if(d.size==-3)$+=4;else break e;else d.id>=o&&($+=4);d.next()}S=oe,x+=O,P+=$}return(y<0||x==w)&&(_.size=x,_.start=S,_.skip=P),_.size>4?_:void 0}function M(w,y,d){let{id:x,start:S,end:P,size:v}=a;if(a.next(),v>=0&&x<o){let _=d;if(v>4){let C=a.pos-(v-4);for(;a.pos>C;)d=M(w,y,d)}y[--d]=_,y[--d]=P-w,y[--d]=S-w,y[--d]=x}else v==-3?h=x:v==-4&&(u=x);return d}let T=[],k=[];for(;a.pos>0;)f(s.start||0,s.bufferStart||0,T,k,-1,0);let A=(e=s.length)!==null&&e!==void 0?e:T.length?k[0]+T[0].length:0;return new J(l[s.topID],T.reverse(),k.reverse(),A)}var Xi=new WeakMap;function yt(s,e){if(!s.isAnonymous||e instanceof ye||e.type!=s)return 1;let t=Xi.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=s||!(i instanceof J)){t=1;break}t+=yt(s,i)}Xi.set(e,t)}return t}function si(s,e,t,i,n,r,o,a,l){let h=0;for(let b=i;b<n;b++)h+=yt(s,e[b]);let u=Math.ceil(h*1.5/8),f=[],c=[];function g(b,p,I,M,T){for(let k=I;k<M;){let A=k,w=p[k],y=yt(s,b[k]);for(k++;k<M;k++){let d=yt(s,b[k]);if(y+d>=u)break;y+=d}if(k==A+1){if(y>u){let d=b[A];g(d.children,d.positions,0,d.children.length,p[A]+T);continue}f.push(b[A])}else{let d=p[k-1]+b[k-1].length-w;f.push(si(s,b,p,A,k,w,d,null,l))}c.push(w+T-r)}}return g(e,t,i,n,0),(a||l)(f,c,o)}var xt=class{startParse(e,t,i){return typeof e=="string"&&(e=new ni(e)),i=i?i.length?i.map(n=>new it(n.from,n.to)):[new it(0,0)]:[new it(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let r=n.advance();if(r)return r}}},ni=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var co=new G({perNode:!0});var ai=class s{constructor(e,t,i,n,r,o,a,l,h,u=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=r,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=h,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new s(e,[],t,i,i,0,[],0,n?new Et(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:r}=this.p,o=r.dynamicPrecedence(n);if(o&&(this.score+=o),i==0){this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,h=this.reducePos-l;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=h));let u=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-u;if(n<r.minRepeatTerm||e&131072){let c=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,l,c,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let c=this.stack[a-3];this.state=r.getGoto(c,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,t,i,n=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==i)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(e,t,i,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;(n>this.pos||t<=o.maxNode)&&(this.pos=n,o.stateFlag(r,1)||(this.reducePos=n)),this.pushState(r,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,n,4)}else this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4)}apply(e,t,i,n){e&65536?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new li(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,o;r<t.length;r+=2)(o=t[r+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[r],o);if(this.stack.length<120)for(let r=0;n.length<8&&r<t.length;r+=2){let o=t[r+1];n.some((a,l)=>l&1&&a==o)||n.push(t[r],o)}t=n}let i=[];for(let n=0;n<t.length&&i.length<4;n+=2){let r=t[n+1];if(r==this.state)continue;let o=this.split();o.pushState(r,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,n=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,r)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-r;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&e.getGoto(this.stack[h],l,!1)>=0)return a<<19|65536|l}}else{let a=i(o,r+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Et(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Et=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},li=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}},hi=class s{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new s(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new s(this.stack,this.pos,this.index)}};function ot(s,e=Uint16Array){if(typeof s!="string")return s;let t=null;for(let i=0,n=0;i<s.length;){let r=0;for(;;){let o=s.charCodeAt(i++),a=!1;if(o==126){r=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),r+=l,a)break;r*=46}t?t[n++]=r:t=new e(r)}return t}var Ge=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Ji=new Ge,ui=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Ji,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,r=this.pos+e;for(;r<i.from;){if(!n)return null;let o=this.ranges[--n];r-=i.from-o.to,i=o}for(;t<0?r>i.to:r>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,n;if(t>=0&&t<this.chunk.length)i=this.pos+e,n=this.chunk.charCodeAt(t);else{let r=this.resolveOffset(e,1);if(r==null)return-1;if(i=r,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=i;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Ji,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}},ke=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;sn(this.data,e,t,this.id,i.data,i.tokenPrecTable)}};ke.prototype.contextual=ke.prototype.fallback=ke.prototype.extend=!1;var be=class{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?ot(e):e}token(e,t){let i=e.pos,n=0;for(;;){let r=e.next<0,o=e.resolveOffset(1,1);if(sn(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(r||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(i,e.token),e.acceptToken(this.elseToken,n))}};be.prototype.contextual=ke.prototype.fallback=ke.prototype.extend=!1;function sn(s,e,t,i,n,r){let o=0,a=1<<i,{dialect:l}=t.p.parser;e:for(;(a&s[o])!=0;){let h=s[o+1];for(let g=o+3;g<h;g+=2)if((s[g+1]&a)>0){let b=s[g];if(l.allows(b)&&(e.token.value==-1||e.token.value==b||lr(b,e.token.value,n,r))){e.acceptToken(b);break}}let u=e.next,f=0,c=s[o+2];if(e.next<0&&c>f&&s[h+c*3-3]==65535){o=s[h+c*3-1];continue e}for(;f<c;){let g=f+c>>1,b=h+g+(g<<1),p=s[b],I=s[b+1]||65536;if(u<p)c=g;else if(u>=I)f=g+1;else{o=s[b+2],e.advance();continue e}}break}}function en(s,e,t){for(let i=e,n;(n=s[i])!=65535;i++)if(n==t)return i-e;return-1}function lr(s,e,t,i){let n=en(t,i,e);return n<0||en(t,i,s)<n}var te=typeof process!="undefined"&&process.env&&/\\bparse\\b/.test(process.env.LOG),oi=null;function tn(s,e,t){let i=s.cursor(j.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(s.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:s.length}}var fi=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?tn(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?tn(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],n=this.index[t];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=i.children[n],o=this.start[t]+i.positions[n];if(o>e)return this.nextStart=o,null;if(r instanceof J){if(o==e){if(o<this.safeFrom)return null;let a=o+r.length;if(a<=this.safeTo){let l=r.prop(G.lookAhead);if(!l||a+l<this.fragment.to)return r}}this.index[t]++,o+r.length>=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}},ci=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Ge)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:r}=n,o=n.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let h=0;h<r.length;h++){if((1<<h&o)==0)continue;let u=r[h],f=this.tokens[h];if(!(i&&!u.fallback)&&((u.contextual||f.start!=e.pos||f.mask!=o||f.context!=a)&&(this.updateCachedToken(f,u,e),f.mask=o,f.context=a),f.lookAhead>f.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let c=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!u.extend&&(i=f,t>c))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!i&&e.pos==this.stream.end&&(i=new Ge,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Ge,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o<r.specialized.length;o++)if(r.specialized[o]==e.value){let a=r.specializers[o](this.stream.read(e.start,e.end),i);if(a>=0&&i.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let r=0;r<n;r+=3)if(this.actions[r]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=i,n}addActions(e,t,i,n){let{state:r}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(r,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=_e(a,h+2);else{n==0&&a[h+1]==2&&(n=this.putAction(_e(a,h+2),t,i,n));break}a[h]==t&&(n=this.putAction(_e(a,h+1),t,i,n))}return n}},di=class{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new ui(t,n),this.tokens=new ci(e,this.stream),this.topTerm=e.top[1];let{from:r}=n[0];this.stacks=[ai.start(this,e.top[0],r)],this.fragments=i.length&&this.stream.end-r>e.bufferLength*4?new fi(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],n,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)i.push(a);else{if(this.advanceStack(a,i,e))continue;{n||(n=[],r=[]),n.push(a);let l=this.tokens.getMainToken(a);r.push(l.value,l.end)}}break}}if(!i.length){let o=n&&hr(n);if(o)return te&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw te&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,r,i);if(o)return te&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((a,l)=>l.score-a.score);i.length>o;)i.pop();i.some(a=>a.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let a=i[o];for(let l=o+1;l<i.length;l++){let h=i[l];if(a.sameState(h)||a.buffer.length>500&&h.buffer.length>500)if((a.score-h.score||a.buffer.length-h.buffer.length)>0)i.splice(l--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can\'t move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let n=e.pos,{parser:r}=this,o=te?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,u=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(n);f;){let c=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(c>-1&&f.length&&(!h||(f.prop(G.contextHash)||0)==u))return e.useNode(f,c),te&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof J)||f.children.length==0||f.positions[0]>0)break;let g=f.children[0];if(g instanceof J&&f.positions[0]==0)f=g;else break}}let a=r.stateSlot(e.state,4);if(a>0)return e.reduce(a),te&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let h=0;h<l.length;){let u=l[h++],f=l[h++],c=l[h++],g=h==l.length||!i,b=g?e:e.split(),p=this.tokens.mainToken;if(b.apply(u,f,p?p.start:b.pos,c),te&&console.log(o+this.stackID(b)+` (via ${(u&65536)==0?"shift":`reduce of ${r.getName(u&65535)}`} for ${r.getName(f)} @ ${n}${b==e?"":", split"})`),g)return!0;b.pos>n?t.push(b):i.push(b)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return nn(e,t),!0}}runRecovery(e,t,i){let n=null,r=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],h=t[(o<<1)+1],u=te?this.stackID(a)+" -> ":"";if(a.deadEnd&&(r||(r=!0,a.restart(),te&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let f=a.split(),c=u;for(let g=0;f.forceReduce()&&g<10&&(te&&console.log(c+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));g++)te&&(c=this.stackID(f)+" -> ");for(let g of a.recoverByInsert(l))te&&console.log(u+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,i);this.stream.end>a.pos?(h==a.pos&&(h++,l=0),a.recoverByDelete(l,h),te&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),nn(a,i)):(!n||n.score<a.score)&&(n=a)}return n}stackToTree(e){return e.close(),J.build({buffer:hi.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(oi||(oi=new WeakMap)).get(e);return t||oi.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function nn(s,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==s.pos&&i.sameState(s)){e[t].score<s.score&&(e[t]=s);return}}e.push(s)}var pi=class{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}};var Tt=class s extends xt{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn\'t match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let i=Object.keys(e.topRules).map(a=>e.topRules[a][1]),n=[];for(let a=0;a<t.length;a++)n.push([]);function r(a,l,h){n[a].push([l,l.deserialize(String(h))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=G[l]);for(let h=1;h<a.length;){let u=a[h++];if(u>=0)r(u,l,a[h++]);else{let f=a[h+-u];for(let c=-u;c>0;c--)r(a[h++],l,f);h++}}}this.nodeSet=new kt(t.map((a,l)=>se.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:i.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=ot(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(rn),this.states=ot(e.states,Uint32Array),this.data=ot(e.stateData),this.goto=ot(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new ke(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new di(this,e,t,i);for(let r of this.wrappers)n=r(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let r=n[t+1];;){let o=n[r++],a=o&1,l=n[r++];if(a&&i)return l;for(let h=r+(o>>1);r<h;r++)if(n[r]==e)return l;if(a)return-1}}hasAction(e,t){let i=this.data;for(let n=0;n<2;n++)for(let r=this.stateSlot(e,n?2:1),o;;r+=3){if((o=i[r])==65535)if(i[r+1]==1)o=i[r=_e(i,r+2)];else{if(i[r+1]==2)return _e(i,r+2);break}if(o==t||o==0)return _e(i,r+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let r=this.stateSlot(e,1);n==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=_e(this.data,r+2);else break;n=t(_e(this.data,r+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=_e(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];t.some((r,o)=>o&1&&r==n)||t.push(this.data[i],n)}}return t}configure(e){let t=Object.assign(Object.create(s.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let n=e.tokenizers.find(r=>r.from==i);return n?n.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let r=e.specializers.find(a=>a.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[n]=rn(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let n=null;for(let r=0;r<t.length;r++)if(!i[r])for(let o=this.dialects[t[r]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new pi(e,i,n)}static deserialize(e){return new s(e)}};function _e(s,e){return s[e]|s[e+1]<<16}function hr(s){let e=null;for(let t of s){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function rn(s){if(s.external){let e=s.extend?1:0;return(t,i)=>s.external(t,i)<<1|e}return s.get}var ur=Tt.deserialize({version:14,states:")`QQOPOOOfOQO\'#C^OqOSO\'#C`O|OWO\'#CbO!XO`O\'#CeO!dOpO\'#CgOOOO\'#Ck\'#CkOOOO\'#Ci\'#CiQQOPOOOOOO,58x,58xO!oOQO,58xO!wOQO,58xOOOO,58z,58zO#POSO,58zO#XOSO,58zO#aOWO,58|O#iOWO,58|O#qOWO,58|OOOO,59P,59PO#yO`O,59PO$RO`O,59POOOO,59R,59RO$ZOpO,59RO$cOpO,59ROOOO-E6g-E6gOOOO1G.d1G.dO$kOQO1G.dO$nOQO1G.dOOOO1G.f1G.fO$sOSO1G.fO$vOSO1G.fOOOO1G.h1G.hO${OWO1G.hO%QOWO1G.hO%YOWO1G.hO%bOWO1G.hOOOO1G.k1G.kO%gO`O1G.kO%jO`O1G.kOOOO1G.m1G.mO%oOpO1G.mO%rOpO1G.mOOOO7+$O7+$OO%wOQO7+$OOOOO7+$Q7+$QO%|OSO7+$QOOOO7+$S7+$SO&ROWO7+$SO&WOWO7+$SO&`OWO7+$SOOOO7+$V7+$VO&eO`O7+$VOOOO7+$X7+$XO&jOpO7+$XOOOO<<Gj<<GjOOOO<<Gl<<GlOOOO<<Gn<<GnO&oOWO<<GnO&tOWO<<GnOOOO<<Gq<<GqOOOO<<Gs<<GsOOOOAN=YAN=YO&|OWOAN=YOOOOG22tG22t",stateData:"\'R~O`POcQOfROiSOlTOoVO~ORZOaYObXO~OT^Od]Oe[O~OVaOW_Og`O~OYdOjcOkbO~O[gOmfOneO~ORjObiO~OakObiO~OTmOelO~OdnOelO~OgpOhoO~OVrOWqO~OWqOgsO~OYuOktO~OjvOktO~O[xOnwO~OmyOnwO~Oa{ObzO~Od}Oe|O~Oh!OO~Og!POh!OO~OW!QOg!RO~OW!QO~Oj!TOk!SO~Om!VOn!UO~Ob!WO~Oe!XO~Oh!YO~Og!ZOh!YO~OW![O~Ok!]O~On!^O~Oh!_O~Og!`Oh!_O~Oh!aO~O",goto:"o`PPaPaPaPPaPaPePkTUOWQWORhWTVOW",nodeNames:"\\u26A0 CriticMarkup Addition MDSepAdd Deletion MDSepDel Substitution MDSepSub MSub Comment MDSepCom Highlight MDSepHig",maxTerm:31,skippedNodes:[0],repeatNodeCount:1,tokenData:"\'o~R]XYzYZz]^zpqzqrzrszs#Oz#O#P!P#P#oz#o#p#s#p;\'Sz;\'S;=`\'i<%lOz~!POo~~!UXo~rsz!P!Qz#O#Pz#U#Vz#Y#Zz#b#cz#f#gz#h#iz#i#j!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![#Z!c!i#Z#T#Z#Z~#^R!Q![#g!c!i#g#T#Z#g~#jR!Q![z!c!iz#T#Zz~#xVo~vw$_{|%`}!O%k!^!_%v!_!`\'V!`!a\']#r#s\'c~$bP#Z#[$e~$hP#h#i$k~$nP!]!^$q~$tPvw$w~$zP#Z#[$}~%QP#h#i%T~%WP!]!^%Z~%`Oi~~%cP{|%f~%kO`~~%nP}!O%q~%vOc~~%yQ#W#X&P#a#b&h~&SP#X#Y&V~&YP#`#a&]~&`P!`!a&c~&hOf~~&kP#T#U&n~&qP#f#g&t~&wP#_#`&z~&}P!`!a\'Q~\'VOl~~\'YP!_!`\'Q~\'`P!`!a%Z~\'fP#r#s&c~\'lP;=`<%lz",tokenizers:[5,new be("v~RQ{|X!b!cj~[P{|_~bP#q#re~jOb~~mP!b!cp~uOR~~",37,17),new be("v~RQ}!OX!b!cj~[P}!O_~bP#q#re~jOe~~mP!b!cp~uOT~~",37,20),new be("#W~RR!^!_[!b!c!V#r#s!b~_P!P!Qb~eP#W#Xh~kP#X#Yn~qP#`#at~wP!`!az~}P#q#r!Q~!VOh~~!YP!b!c!]~!bOV~~!eRvw!n!`!a#Q#r#sz~!qP#Z#[!t~!wP#h#i!z~!}P!]!^#Q~#VOW~~",99,23),new be("!u~RRvw[!^!_!c!b!c!i~_P#`#ab~eP#h#ih~kP!]!^n~qPvwt~wP#`#az~}P#h#i!Q~!TP!]!^!W~!ZP#q#r!^~!cOk~~!fP!^!_!W~!lP!b!c!o~!tOY~~",82,26),new be("!o~RR!^!_[!_!`!]!b!c!c~_P!P!Qb~eP#a#bh~kP#T#Un~qP#f#gt~wP#_#`z~}P!`!a!Q~!TP#q#r!W~!]On~~!`P!_!`!Q~!fP!b!c!i~!nO[~~",76,29)],topRules:{CriticMarkup:[0,1]},tokenPrec:0}),Mt=mi.LRLanguage.define({name:"criticmarkup",parser:ur.configure({})});var Hr=require("obsidian");var fh=require("@codemirror/state");var mr=require("obsidian"),gi=require("@codemirror/state");var on=require("@codemirror/view"),at=null,fr=on.EditorView.domEventHandlers({keydown:(s,e)=>{at=s},contextmenu:(s,e)=>{at=s}});var cr=require("@codemirror/state");var kr=require("obsidian"),_i=require("@codemirror/state"),Go=require("@codemirror/view");var Yo=require("@codemirror/state");var bi=require("obsidian");var Sn=require("@codemirror/state");var le=require("@codemirror/state"),Sl=require("@codemirror/view"),ae=require("obsidian");var Le=require("@codemirror/state"),ie=require("@codemirror/view");function Ot(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++)if(!s[t].compare(e[t]))return!1;return!0}var Tr={class:"",renderEmptyElements:!1,markers:()=>Le.RangeSet.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};function wi(s,e,t){for(;s.value&&s.from<=t;)s.from<=t&&e.push(s.value),s.next()}function hn(s){return Array.isArray(s)?s:[s]}var Be=class{constructor(e,t,i,n){E(this,"dom");E(this,"height",-1);E(this,"above",0);E(this,"markers",[]);this.dom=createDiv(),this.dom.className="cm-gutterElement",this.update(e,t,i,n)}update(e,t,i,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Ot(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,t){let i="cm-gutterElement",n=this.dom.firstChild;for(let r=0,o=0;;){let a=o,l=r<t.length?t[r++]:null,h=!1;if(l){let u=l.elementClass;u&&(i+=" "+u);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(l)){a=f,h=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM&&n){u.preventUnload||u.destroy(n),u.preventUnload=!1;let f=n.nextSibling;n.remove(),n=f}}if(!l)break;l.toDOM&&e&&(h?n=n.nextSibling:this.dom.insertBefore(l.toDOM(e),n)),h&&o++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}},lt=class{constructor(e,t,i){this.gutter=e;this.height=i;E(this,"cursor");E(this,"i",0);this.cursor=Le.RangeSet.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:n}=this,r=t.top-this.height,o=t.height;if(this.i==n.elements.length){let a=new Be(e,o,r,i);n.elements.push(a),n.dom.appendChild(a.dom)}else n.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let n=[];wi(this.cursor,n,t.to);let r=this.gutter.config.lineMarker(e,t,n);r&&n.unshift(r);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,n)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t);i&&this.addElement(e,t,[i])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Se=class{constructor(e,t){this.view=e;this.config=t;E(this,"dom");E(this,"elements",[]);E(this,"markers");E(this,"spacer",null);this.dom=createDiv(),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,n=>{let r=n.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let l=r.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=n.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,a,n)&&n.preventDefault()});this.markers=hn(t.markers(e)),t.initialSpacer&&(this.spacer=new Be(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=hn(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}let i=e.view.viewport;return!Le.RangeSet.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},Ue=class{constructor(e,t,i){this.view=e;this.unfixGutters=t;this.activeGutters=i;E(this,"gutters");E(this,"dom");E(this,"fixed");E(this,"prevViewport");this.prevViewport=e.viewport,this.dom=createDiv(),this.dom.className="cm-gutters",this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=this.createGutters(e);for(let n of this.gutters)this.dom.appendChild(n.dom);this.fixed=!e.state.facet(this.unfixGutters),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),this.insertGutters(e)}createGutters(e){return e.state.facet(this.activeGutters).map(t=>new Se(e,t))}insertGutters(e){e.contentDOM.parentNode.insertBefore(this.dom,e.contentDOM)}insertDetachedGutters(e){e.parentNode.insertBefore(this.dom,e)}getUpdateContexts(){return this.gutters.map(e=>new lt(e,this.view.viewport,-this.view.documentPadding.top))}update(e){if(this.updateGutters(e)){let t=this.prevViewport,i=e.view.viewport,n=Math.min(t.to,i.to)-Math.max(t.from,i.from);this.syncGutters(n<(i.to-i.from)*.8)}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(this.unfixGutters)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let i=Le.RangeSet.iter(this.view.state.facet(ie.gutterLineClass),this.view.viewport.from),n=[],r=this.getUpdateContexts();for(let o of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(o.type)){let a=!0;for(let l of o.type)if(l.type==ie.BlockType.Text&&a){wi(i,n,l.from);for(let h of r)h.line(this.view,l,n);a=!1}else if(l.widget)for(let h of r)h.widget(this.view,l)}else if(o.type==ie.BlockType.Text){wi(i,n,o.from);for(let a of r)a.line(this.view,o,n)}for(let o of r)o.finish();e&&this.insertDetachedGutters(t)}updateGutters(e){let t=e.startState.facet(this.activeGutters),i=e.state.facet(this.activeGutters),n=e.docChanged||e.heightChanged||e.viewportChanged||!Le.RangeSet.eq(e.startState.facet(ie.gutterLineClass),e.state.facet(ie.gutterLineClass),e.view.viewport.from,e.view.viewport.to);if(t==i)for(let r of this.gutters)r.update(e)&&(n=!0);else{n=!0;let r=[];for(let o of i){let a=t.indexOf(o);a<0?r.push(new Se(this.view,o)):(this.gutters[a].update(e),r.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)this.dom.appendChild(o.dom);this.gutters=r}return n}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}};function It(s){return ie.ViewPlugin.fromClass(s,{provide:e=>ie.EditorView.scrollMargins.of(t=>{let i=t.plugin(e);return!i||i.gutters.length==0||!i.fixed?null:t.textDirection==ie.Direction.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}})})}function Mr(s,e,t){let i=[s];return e&&e.fixed===!1&&i.push(t.of(!0)),i}function vi(s,e,t,i){return[Mr(s,{},i),t.of(he(he({},Tr),e))]}var Dt=require("@codemirror/state"),cn=require("@codemirror/view"),Y=require("obsidian");var un=require("obsidian"),At=require("@codemirror/state"),ze=require("@codemirror/view");function ht(s,e){let t=Object.keys(e).map(i=>Cr(s,i,e[i]));return t.length===1?t[0]:function(){t.forEach(i=>i())}}function Cr(s,e,t){let i=s[e],n=s.hasOwnProperty(e),r=n?i:function(){return Object.getPrototypeOf(s)[e].apply(this,arguments)},o=t(r);return i&&Object.setPrototypeOf(o,i),Object.setPrototypeOf(a,o),s[e]=a,l;function a(...h){return o===r&&s[e]===a&&l(),o.apply(this,h)}function l(){s[e]===a&&(n?s[e]=r:delete s[e]),o!==r&&(o=r,Object.setPrototypeOf(a,i||Function))}}function Or(s){let e=s.embedRegistry.embedByExtension.md({app:s,containerEl:createDiv()},null,"");e.editable=!0,e.showEditor();let t=Object.getPrototypeOf(Object.getPrototypeOf(e.editMode));return e.unload(),t.constructor}var yi={cursorLocation:{anchor:0,head:0},value:"",cls:"",placeholder:"",focus:!0,filteredExtensions:[],onEnter:(s,e,t)=>(e&&s.options.onSubmit(s),e),onEscape:s=>{s.options.onBlur(s)},onSubmit:()=>{},onBlur:()=>{},onPaste:()=>{},onChange:()=>{}},Fe=class extends Or(app){constructor(t,i,n){var r,o,a;super(t,i,{app:t,onMarkdownScroll:()=>{},getMode:()=>"source"});E(this,"options");E(this,"initial_value");E(this,"scope");this.options=he(he({},yi),n),this.initial_value=this.options.value,this.scope=new un.Scope(this.app.scope),this.scope.register(["Mod"],"Enter",(l,h)=>!0),this.owner.editMode=this,this.owner.editor=this.editor,this.set(n.value||"",!0),this.register(ht(this.app.workspace,{setActiveLeaf:l=>(h,u)=>{this.activeCM.hasFocus||l.call(this.app.workspace,h,u)}})),this.options.onBlur!==yi.onBlur&&((r=this.editor)==null||r.cm.contentDOM.addEventListener("blur",()=>{this._loaded&&this.options.onBlur(this)})),(o=this.editor)==null||o.cm.contentDOM.addEventListener("focusin",()=>{this.app.keymap.pushScope(this.scope),this.app.workspace.activeEditor=this.owner}),this.editorEl.classList.remove("markdown-source-view"),n.cls&&this.editorEl.classList.add(...[].concat(n.cls)),n.cursorLocation&&((a=this.editor)==null||a.cm.dispatch({selection:At.EditorSelection.range(n.cursorLocation.anchor,n.cursorLocation.head)}))}onUpdate(t,i){super.onUpdate(t,i),i&&this.options.onChange(t)}buildLocalExtensions(){let t=super.buildLocalExtensions();return this.options.placeholder&&t.push((0,ze.placeholder)(this.options.placeholder)),t.push(ze.EditorView.domEventHandlers({paste:i=>{this.options.onPaste(i,this)}})),t.push(At.Prec.highest(ze.keymap.of([{key:"Enter",run:i=>this.options.onEnter(this,!1,!1),shift:i=>this.options.onEnter(this,!1,!0)},{key:"Mod-Enter",run:i=>this.options.onEnter(this,!0,!1),shift:i=>this.options.onEnter(this,!0,!0)},{key:"Escape",run:i=>(this.options.onEscape(this),!0),preventDefault:!0}]))),t}getDynamicExtensions(){return super.getDynamicExtensions().filter(t=>!this.options.filteredExtensions.includes(t))}updateBottomPadding(t){return 0}destroy(){this._loaded&&this.unload(),this.app.keymap.popScope(this.scope),this.app.workspace.activeEditor===this.owner&&(this.app.workspace.activeEditor=null),this.containerEl.empty(),super.destroy()}onunload(){super.onunload(),this.destroy()}onload(){var t;super.onload(),this.options.focus&&((t=this.editor)==null||t.focus())}};var Ar="0.2.3";var wa={version:Ar,default_edit_mode:1,default_preview_mode:0,comment_style:"icon",editor_styling:!1,markup_focus:{0:{show_styling:!0,show_syntax:!0,show_metadata:!0,focus_annotation:!0,show_comment:!0},1:{show_styling:!0,show_syntax:!1,show_metadata:!1,focus_annotation:!0,show_comment:!1},2:{show_styling:!0,show_syntax:!1,show_metadata:!1,focus_annotation:!0,show_comment:!1}},diff_gutter:!0,diff_gutter_hide_empty:!0,annotation_gutter:!0,annotation_gutter_included_types:31,annotation_gutter_hide_empty:!0,annotation_gutter_default_fold_state:!1,annotation_gutter_fold_button:!0,annotation_gutter_resize_handle:!0,annotation_gutter_focus_on_click:!0,annotation_gutter_width:300,tag_completion:!0,tag_correcter:!0,clipboard_remove_syntax:!0,edit_info:!0,toolbar_preview_button:!0,toolbar_edit_button:!0,toolbar_show_buttons_labels:!0,status_bar_preview_button:!0,status_bar_edit_button:!0,status_bar_metadata_button:!0,database_workers:2,post_processor:!0,live_preview:!0,alternative_cursor_movement:!0,enable_metadata:!1,enable_author_metadata:!1,enable_timestamp_metadata:!1,enable_completed_metadata:!1,enable_style_metadata:!1,enable_color_metadata:!1,add_metadata:!1,add_author_metadata:!1,add_timestamp_metadata:!1,add_completed_metadata:!1,add_style_metadata:!1,add_color_metadata:!1,author:"",suggestion_mode_operations:{cursor_movement:{addition:"ignore_metadata",deletion:"ignore_metadata",substitution:"ignore_metadata",highlight:"ignore_metadata",comment:"ignore_completely"},bracket_movement:{addition:"stay_inside",deletion:"stay_inside",substitution:"stay_inside",highlight:"stay_inside",comment:"stay_inside"}}};var Ve=require("obsidian");var ki=(s=!1)=>{let e=ht(Ve.Menu.prototype,{onEnter:n=>function(r){let o=this.items[this.selected];return o&&o instanceof Ve.MenuItem&&o.handleEvent(r)||!0},onMenuClick:n=>function(r){if(!s||this.currentSubmenu&&this.currentSubmenu.dom.contains(r.target))r.stopImmediatePropagation();else return n&&n.apply(this,[r])},hide:n=>function(){return this.parentMenu||i(),n&&n.apply(this)}}),t=ht(Ve.MenuItem.prototype,{setChecked:n=>function(...r){return this.checkIconEl&&(this.checkIconEl.remove(),this.checkIconEl=void 0),n&&n.apply(this,r)}}),i=()=>{e(),t()};return i};var Si=require("obsidian");function Pr(s){if(s.children.length>0){let e=createSpan({cls:"cmtr-metadata-info-separator",text:" \\u2022 "});s.appendChild(e)}}function Pt(s,e,t="icon"){let i=createDiv({cls:["cmtr-metadata-info"].concat(e!=null?e:[])});if(s.fields.author){let n=createSpan({cls:"cmtr-metadata-info-field"});if(t==="label"){let o=createSpan({cls:"cmtr-metadata-info-label",text:"Author: "});n.appendChild(o)}else if(t==="icon"){let o=createSpan({cls:"cmtr-metadata-info-icon"});(0,Si.setIcon)(o,"user"),n.appendChild(o)}let r=createSpan({cls:"cmtr-metadata-info-author-data",text:s.fields.author});n.appendChild(r),i.appendChild(n)}if(s.fields.time){t!=="icon"&&Pr(i);let n=createSpan({cls:"cmtr-metadata-info-field"});if(t==="label"){let o=createSpan({cls:"cmtr-metadata-info-label",text:"Updated at: "});n.appendChild(o)}else if(t==="icon"){let o=createSpan({cls:"cmtr-metadata-info-icon"});(0,Si.setIcon)(o,"clock"),n.appendChild(o)}let r=createSpan({cls:"cmtr-metadata-info-time-data",text:window.moment.unix(s.fields.time).format("MMM DD YYYY, HH:mm")});n.appendChild(r),i.appendChild(n)}return i}var xi=class extends Y.Component{constructor(t,i){super();this.range=t;this.marker=i;E(this,"text");E(this,"new_text",null);E(this,"annotation_container");E(this,"metadata_view",null);E(this,"annotation_view");E(this,"currentMode",null);E(this,"editMode",null);this.text=t.unwrap(),this.annotation_container=this.marker.annotation_thread.createDiv({cls:"cmtr-anno-gutter-annotation"}),this.annotation_container.addEventListener("blur",this.renderPreview.bind(this)),this.annotation_container.addEventListener("dblclick",this.renderSource.bind(this)),this.annotation_container.addEventListener("contextmenu",this.onCommentContextmenu.bind(this)),this.range.metadata&&(this.metadata_view=Pt(this.range),this.annotation_container.appendChild(this.metadata_view)),this.annotation_view=this.annotation_container.createDiv({cls:"cmtr-anno-gutter-annotation-view"}),this.renderPreview()}onload(){super.onload()}onunload(){super.onunload(),this.annotation_container.remove(),this.editMode=null}renderSource(t){if(this.range.type!=="comment")new Y.Notice("[Commentator] You can only edit comments.");else{if(t==null||t.stopPropagation(),this.currentMode==="source")return;let{app:i}=this.marker.view.state.field(Y.editorInfoField);if(this.annotation_container.toggleClass("cmtr-anno-gutter-annotation-editing",!0),this.range.fields.author&&this.range.fields.author!==i.plugins.plugins.commentator.settings.author){new Y.Notice("[Commentator] You cannot edit comments from other authors.");return}this.annotation_view.empty(),this.editMode=this.addChild(new Fe(i,this.annotation_view,{value:this.text,cls:"cmtr-anno-gutter-annotation-editor",onSubmit:n=>{this.new_text=n.get(),this.renderPreview()},filteredExtensions:[i.plugins.plugins.commentator.editorExtensions],onBlur:n=>{this.new_text=n.get(),this.renderPreview()}})),this.currentMode="source"}}renderPreview(){if(this.currentMode!=="preview")if(this.annotation_container.toggleClass("cmtr-anno-gutter-annotation-editing",!1),this.text===this.new_text||this.new_text===null){let{app:t}=this.marker.view.state.field(Y.editorInfoField);if(this.new_text=null,this.editMode&&(this.removeChild(this.editMode),this.editMode=null),this.annotation_view.empty(),this.range.type!=="substitution"){let i="";switch(this.range.type){case"addition":i="Added: ";break;case"deletion":i="Deleted: ";break;case"highlight":break;case"comment":break}let n=createDiv({cls:"cmtr-anno-gutter-annotation-content"});Y.MarkdownRenderer.render(t,this.text||" ",n,"",this).then(()=>{var r;((r=n.children[0])!=null?r:n).prepend(createSpan({cls:"cmtr-anno-gutter-annotation-desc",text:i})),this.annotation_view.append(...n.childNodes),n.remove()})}else{let i=this.range.unwrap_parts(),n=createDiv(),r=createDiv();Y.MarkdownRenderer.render(t,i[0]||" ",n,"",this).then(()=>{var o;((o=n.children[0])!=null?o:n).prepend(createSpan({cls:"cmtr-anno-gutter-annotation-desc",text:"Changed: "})),this.annotation_view.append(...n.childNodes),Y.MarkdownRenderer.render(t,i[1]||" ",r,"",this).then(()=>{var a;((a=r.children[0])!=null?a:r).prepend(createSpan({cls:"cmtr-anno-gutter-annotation-desc",text:"To: "})),this.annotation_view.append(...r.childNodes),n.remove(),r.remove()})})}this.annotation_view.addClass("cmtr-anno-gutter-annotation-"+this.range.type),this.currentMode="preview"}else{let t=this.marker.view.state.field(we);this.text=this.new_text,activeWindow.setTimeout(()=>{this.marker.view.dispatch({changes:{from:this.range.from,to:this.range.to,insert:ut(t,"comment",this.new_text)}})})}}onCommentContextmenu(t){t.preventDefault(),t.stopPropagation(),ki(!0);let i=new Y.Menu;this.range.type!=="comment"&&this.range.type!=="highlight"&&(i.addItem(n=>{n.setTitle("Accept changes").setIcon("check").setSection("close-annotation").onClick(()=>{this.marker.view.dispatch({changes:je(this.marker.view.state,this.range.from,this.range.to)})})}),i.addItem(n=>{n.setTitle("Reject changes").setIcon("cross").setSection("close-annotation").onClick(()=>{this.marker.view.dispatch({changes:$e(this.marker.view.state,this.range.from,this.range.to)})})})),this.range.type==="comment"?(this.range.replies.length>0&&i.addItem(n=>{n.setTitle("Close comment thread").setIcon("message-square-off").setSection("close-annotation").onClick(()=>{this.marker.view.dispatch({changes:{from:this.range.full_range_front,to:this.range.full_range_back,insert:""}})})}),i.addItem(n=>{n.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{Te(this.marker.view,this.range)})}),i.addItem(n=>{n.setTitle("Edit comment").setIcon("pencil").setSection("comment-handling").onClick(()=>{this.renderSource()})}),i.addItem(n=>{n.setTitle("Remove comment").setIcon("cross").setSection("comment-handling").onClick(()=>{this.marker.view.dispatch({changes:{from:this.range.from,to:this.range.to,insert:""}})})})):this.range.type!=="highlight"?(i.addItem(n=>{n.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{Te(this.marker.view,this.range)})}),this.range.replies.length>0&&i.addItem(n=>{n.setTitle("Remove all comments").setIcon("message-square-x").setSection("comment-handling").onClick(()=>{this.marker.view.dispatch({changes:{from:this.range.replies[0].from,to:this.range.replies[this.range.replies.length-1].to,insert:""}})})})):i.addItem(n=>{n.setTitle("Add reply").setSection("comment-handling").setIcon("reply").onClick(()=>{Te(this.marker.view,this.range)})}),i.addItem(n=>{n.setTitle("Fold gutter").setSection("gutter-controls").setIcon("arrow-right-from-line").onClick(()=>{this.marker.view.dispatch({annotations:[He.of(null)]})})}),i.addItem(n=>{let r=n.setTitle("Included annotations").setIcon("eye").setSection("gutter-controls").setSubmenu(),o=this.marker.view.state.facet(Ee);for(let{title:a,icon:l,value:h}of[{title:"Additions",icon:"plus-circle",value:1},{title:"Deletions",icon:"minus-square",value:2},{title:"Substitutions",icon:"replace",value:4},{title:"Highlights",icon:"highlighter",value:8},{title:"Comments",icon:"message-square",value:16}])r.addItem(u=>{u.setTitle(a).setIcon(l).setChecked((o&h)!==0).onClick(()=>{o^=h,u.setChecked((o&h)!==0),this.marker.view.dispatch(this.marker.view.state.update({effects:[Kt.reconfigure(Ee.of(o))]}))})})}),i.showAtPosition(t)}},Rt=class extends cn.GutterMarker{constructor(t,i,n,r=0){super();this.annotation=t;this.annotations=i;this.view=n;this.itr=r;E(this,"annotation_thread");E(this,"component",new Y.Component);E(this,"preventUnload",!1)}eq(t){return this.itr===t.itr&&this.annotations===t.annotations&&this.annotations[0].equals(t.annotations[0])}onCommentThreadClick(){this.view.dispatch({annotations:[Nt.of({marker:this,index:-1,scroll:!0,focus_markup:!0})]}),this.annotation_thread.classList.toggle("cmtr-anno-gutter-thread-highlight",!0)}toDOM(){this.annotation_thread=createDiv({cls:"cmtr-anno-gutter-thread"}),this.annotation_thread.addEventListener("click",this.onCommentThreadClick.bind(this));for(let t of this.annotations)this.component.addChild(new xi(t,this));return this.component.load(),this.annotation_thread}focus(){this.annotation_thread.focus()}focus_annotation(t=-1,i=!1){t===-1?this.annotation_thread.classList.toggle("cmtr-anno-gutter-thread-highlight",!0):t>=0&&t<this.annotation_thread.children.length?this.annotation_thread.children.item(t).dispatchEvent(new MouseEvent("dblclick")):console.error("[Commentator] Invalid index for focusing annotation:",t),i&&activeWindow.setTimeout(()=>{let n=this.view.lineBlockAt(this.annotations[0].from).top-100;this.view.scrollDOM.scrollTo({top:n,behavior:"smooth"})},200)}unfocus_annotation(t=-1){t===-1?this.annotation_thread.classList.toggle("cmtr-anno-gutter-thread-highlight",!1):this.annotation_thread.children.item(t).classList.toggle("cmtr-anno-gutter-thread-highlight",!1)}destroy(t){this.component.unload(),this.annotation_thread.remove(),super.destroy(t)}};function fn(s,e,t){let i=s.field(Y.editorEditorField),n=(t&1)!==0,r=(t&2)!==0,o=(t&4)!==0,a=(t&8)!==0,l=(t&16)!==0,h=[];for(let u of e){let f=u.full_thread;switch(l||(f=f.slice(0,1)),u.type){case"addition":n||f.shift();break;case"deletion":r||f.shift();break;case"substitution":o||f.shift();break;case"highlight":a||f.shift();break;case"comment":l||f.shift();break}if(f.length){let c=new Rt(u,f,i,dn);c.preventUnload=!0,h.push(c.range(u.from,u.to))}}return h}var dn=0,Me=Dt.StateField.define({create(s){let e=s.field(F).ranges.ranges.reduce((t,i)=>{let n=i.base_range;return t.includes(n)||t.push(n),t},[]);return Dt.RangeSet.of(fn(s,e,s.facet(Ee)))},update(s,e){let t=e.state.facet(Ee);if(e.startState.facet(Ee)!==t)return this.create(e.state);if(!e.docChanged)return s;dn+=1;let i=[];for(let r of e.state.field(F).inserted_ranges)i.includes(r.base_range)||i.push(r.base_range);let n=e.state.field(F).deleted_ranges.map(r=>r.base_range);return s.map(e.changes).update({filter:(r,o,a)=>{let l=!n.includes(a.annotation);return a.preventUnload=l,l},add:fn(e.state,i.map(r=>r.full_thread[0]),t)})}});var Dr=require("@codemirror/view"),We=require("obsidian");var pn=require("obsidian");var Ce=require("@codemirror/state"),qe=require("@codemirror/view");var ft=Ce.StateEffect.define(),Ei=Ce.StateField.define({create(s){return{from:s.selection.main.from,to:s.selection.main.to}},update(s,e){for(let t of e.effects)if(t.is(ft))return t.value;return s}}),Nr=Ce.StateField.define({create(s){return qe.Decoration.none},update(s,e){var n;let t=e.startState.field(Ei,!1),i=e.state.field(Ei);if(t!==i){let r=e.state.field(F).ranges.ranges_in_interval(i.from,i.to);return r.length&&r[0].base_range===((n=r.at(-1))==null?void 0:n.base_range)&&i.from>=r[0].from&&i.to<=r.at(-1).to?Ce.RangeSet.of([qe.Decoration.mark({attributes:{class:"cmtr-focused"}}).range(r[0].full_range_front,r[0].full_range_back)]):qe.Decoration.none}else return s},provide(s){return qe.EditorView.decorations.from(s)}});var mn=require("@codemirror/state"),Ti=require("@codemirror/view"),gn=require("obsidian");var ml=Ti.Decoration.replace({});var ct=24,Lr=le.Facet.define({combine:s=>s.some(e=>e)}),_n=le.Facet.define(),Ye=le.Annotation.define(),He=le.Annotation.define(),Nt=le.Annotation.define(),bn=le.Annotation.define(),wn=le.Annotation.define(),vn=le.Annotation.define(),yn=le.Annotation.define(),Gt=class extends Ue{constructor(t){super(t,Lr,_n);E(this,"previously_focused");E(this,"debouncedMoveGutter",(0,ae.debounce)(this.moveGutter.bind(this),200));t.dom.parentElement.classList.contains("markdown-source-view")||(this.dom.style.display="none",setImmediate(()=>{t.dispatch(t.state.update({effects:[kn.reconfigure([])]}))}))}createGutters(t){return t.state.facet(_n).map(i=>new Ci(t,i,this.dom))}insertGutters(t){t.contentDOM.parentNode.insertBefore(this.dom,t.contentDOM.nextSibling)}insertDetachedGutters(t){this.view.contentDOM.parentNode.insertBefore(this.dom,this.view.contentDOM.nextSibling)}getUpdateContexts(){return this.gutters.map(t=>new Mi(t,this.view.viewport,-this.view.documentPadding.top))}update(t){for(let i of t.transactions){let n=i.annotation(Nt);if(n){let{marker:r,index:o,scroll:a=!1,focus_markup:l=!1}=n;this.unfocusAnnotation(),this.focusAnnotation(r,o,a,l)}}super.update(t)}unfocusAnnotation(){var t;(t=this.previously_focused)==null||t.unfocus_annotation(),this.previously_focused=void 0}focusAnnotation(t,i,n=!1,r=!1){this.previously_focused=t,this.debouncedMoveGutter(t),t.focus_annotation(i,n),r&&activeWindow.setTimeout(()=>{this.view.dispatch(this.view.state.update({effects:[ft.of({from:t.annotation.from,to:t.annotation.full_range_back})]}))})}updateGutters(t){let i=t.transactions.flatMap(n=>n.annotation(Ye)).find(n=>n);if((i||t.startState.selection!==t.state.selection)&&this.unfocusAnnotation(),i){let{from:n,to:r,index:o=-1,scroll:a=!1}=i;e:for(let l of this.gutters[0].elements)if(n>=l.block.from){for(let h of l.markers)if(n>=h.annotation.from&&r<=h.annotation.full_range_back){this.focusAnnotation(h,o,a);break e}}else if(n<l.block.from)break}return super.updateGutters(t)}moveGutter(t){let i=this.gutters[0],n=i.elements.find(h=>h.markers.includes(t));if(!n)return;let r=n.markers.indexOf(t),o=n.block.top,a=n.dom.children[r].offsetTop,l=o-a;if(Math.abs(l)>=10&&l){let h=i.elements[0];h.dom.style.marginTop=parseInt(h.dom.style.marginTop||"0")+l+"px"}}foldGutter(){this.gutters[0].foldGutter()}},Br=It(Gt);var Mi=class extends lt{constructor(t,i,n){super(t,i,n);this.gutter=t;this.height=n;E(this,"previous_element_end",0);E(this,"new_gutter_elements",[]);E(this,"added_elements",[]);this.previous_element_end=n}async addElement(t,i,n){var u;let r=Math.max(i.top-this.previous_element_end,0),o=r<=0?this.previous_element_end:i.top;n.sort((f,c)=>f.annotation.from-c.annotation.from);let l=((u=this.gutter.elements[this.i])==null?void 0:u.dom.clientHeight)||36,h=this.gutter.elements.findIndex(f=>Ot(f.markers,n));if(h!==-1){let f=this.gutter.elements[h];for(let c=this.i;c<h;c++)this.gutter.dom.removeChild(this.gutter.elements[c].dom),this.gutter.elements[c].destroy();for(let c of this.added_elements)this.gutter.dom.insertBefore(c.dom,f.dom);this.new_gutter_elements.push(...this.added_elements),this.added_elements=[],this.i=h+1,this.new_gutter_elements.push(f),f.update(t,l,r,n,i)}else this.added_elements.push(new Oi(t,l,r,n,i));this.previous_element_end=o+l}finish(){for(let t=this.i;t<this.gutter.elements.length;t++)this.gutter.dom.removeChild(this.gutter.elements[t].dom),this.gutter.elements[t].destroy();for(let t of this.added_elements)this.gutter.dom.appendChild(t.dom);this.gutter.elements=[...this.new_gutter_elements,...this.added_elements],this.new_gutter_elements=[],this.added_elements=[]}},Ci=class extends Se{constructor(t,i,n){var r,o,a;super(t,i);this.view=t;this.config=i;this.gutterDom=n;E(this,"folded",!1);E(this,"hide_on_empty",!1);E(this,"width",0);E(this,"add_fold_button",!1);E(this,"add_resize_handle",!1);E(this,"gutter_position",0);E(this,"fold_button_el");E(this,"resize_handle_el");this.folded=i.foldState,this.width=i.width,(a=(o=(r=this.view.dom.parentElement)==null?void 0:r.parentElement)==null?void 0:o.parentElement)!=null&&a.classList.contains("markdown-embed")&&(this.folded=!0),this.hide_on_empty=i.hideOnEmpty,this.add_fold_button=i.includeFoldButton,this.add_resize_handle=i.includeResizeHandle,this.hide_on_empty&&t.state.field(Me).size===0||this.folded?this.dom.style.width="0":this.dom.style.width=this.width+"px",this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.folded?"0px":this.width+"px"),this.gutterDom.style.marginInlineStart=this.folded?"0":ct+"px",this.gutter_position=this.view.scrollDOM.getBoundingClientRect().right-this.view.contentDOM.getBoundingClientRect().right+ct,this.add_fold_button&&this.createFoldButton(),this.add_resize_handle&&this.createResizeHandle()}createFoldButton(){let t=createEl("a",{cls:["view-action"]});(0,ae.setIcon)(t,"arrow-right-from-line"),t.setAttribute("data-tooltip-position","left"),t.style.display=this.view.state.field(Me).size?"":"none",t.onclick=()=>{this.folded=!this.folded,this.view.state.field(ae.editorInfoField).app.workspace.requestSaveLayout(),this.foldGutter()},this.setFoldButtonState(),this.fold_button_el=createDiv({cls:["cmtr-anno-gutter-button"]}),this.fold_button_el.appendChild(t),this.gutterDom.appendChild(this.fold_button_el)}createResizeHandle(){this.resize_handle_el=createEl("hr",{cls:["cmtr-anno-gutter-resize-handle"]}),this.resize_handle_el.style.display=this.view.state.field(Me).size&&!this.folded?"":"none",this.resize_handle_el.addEventListener("mousedown",t=>{let i=t.clientX,n=this.view.state.field(ae.editorInfoField).app.vault.getConfig("readableLineLength"),r=this.view.dom.doc.styleSheets[0],o=(0,ae.debounce)(u=>{this.width=Math.round(Math.max(0,u)),this.view.state.field(ae.editorInfoField).app.workspace.requestSaveLayout(),this.dom.style.width=this.width+"px",this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px"),n&&(r.deleteRule(r.cssRules.length-1),r.insertRule(`.cmtr-anno-gutter-resizing .cm-line { width: ${this.view.contentDOM.clientWidth}px !important; }`,r.cssRules.length),this.gutter_position=this.view.scrollDOM.getBoundingClientRect().right-this.view.contentDOM.getBoundingClientRect().right+ct)},25);this.resize_handle_el.classList.toggle("cmtr-anno-gutter-resize-handle-hover",!0),this.view.scrollDOM.classList.toggle("cmtr-anno-gutter-resizing",!0);let a=parseInt(this.dom.style.width.slice(0,-2)),l=u=>{let f=u.clientX-i;return i=u.clientX,a-=f,o(a),!0},h=()=>{this.view.dom.doc.removeEventListener("mousemove",l),this.view.dom.doc.removeEventListener("mouseup",h),this.resize_handle_el.classList.toggle("cmtr-anno-gutter-resize-handle-hover",!1),this.view.scrollDOM.classList.toggle("cmtr-anno-gutter-resizing",!1),n&&r.deleteRule(r.cssRules.length-1)};return this.view.dom.doc.addEventListener("mousemove",l),this.view.dom.doc.addEventListener("mouseup",h),!0}),this.gutterDom.appendChild(this.resize_handle_el)}setFoldButtonState(){this.fold_button_el&&(this.folded?(this.fold_button_el.children[0].setAttribute("style","rotate: -180deg;"),this.fold_button_el.children[0].ariaLabel="Unfold gutter",this.resize_handle_el&&(this.resize_handle_el.style.display="none")):(this.fold_button_el.children[0].setAttribute("style","rotate: 0deg;"),this.fold_button_el.children[0].ariaLabel="Fold gutter",this.resize_handle_el&&(this.resize_handle_el.style.display="")))}foldGutter(){if(this.setFoldButtonState(),this.folded?this.elements.forEach(t=>{Array.from(t.dom.getElementsByClassName("cmtr-anno-gutter-annotation")).forEach(i=>{i.setAttribute("style",`max-height: ${i.clientHeight}px; overflow: hidden;`)})}):this.dom.addEventListener("transitionend",()=>{this.elements.forEach(t=>{Array.from(t.dom.getElementsByClassName("cmtr-anno-gutter-annotation")).forEach(i=>{i.removeAttribute("style")})})},{once:!0}),this.dom.style.width=this.folded?"0":this.width+"px",this.gutterDom.style.marginInlineStart=this.folded?"0":ct+"px",this.view.state.field(ae.editorInfoField).app.vault.getConfig("readableLineLength")){let t=parseInt(getComputedStyle(this.view.scrollDOM).getPropertyValue("--file-line-width").trim()),i=Math.max(0,this.view.scrollDOM.innerWidth-t),n=Math.max(0,i-this.width),r=(this.folded?i:n)/2,o=(this.folded?n:i)/2;this.view.contentDOM.style.width=this.view.contentDOM.clientWidth+(this.folded?ct:0)+"px !important",this.view.scrollDOM.children[0].setAttribute("style",`margin: 0 ${o}px; transition: margin 0.4s ease-in-out, max-width 0.4s ease-in-out;`),this.folded||this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px"),setTimeout(()=>{this.view.scrollDOM.children[0].setAttribute("style",`margin: 0 ${r}px; transition: margin 0.4s ease-in-out, max-width 0.4s ease-in-out;`),this.dom.addEventListener("transitionend",()=>{this.view.contentDOM.removeAttribute("style"),this.view.scrollDOM.children[0].removeAttribute("style"),this.folded&&this.view.dom.style.setProperty("--cmtr-anno-gutter-width","0px")},{once:!0})})}}update(t){let i=super.update(t),n=t.state.field(Me);for(let r of t.transactions){let o=r.annotation(He),a=r.annotation(bn),l=r.annotation(wn),h=r.annotation(vn),u=r.annotation(yn);a!==void 0&&(this.width=a,!this.hide_on_empty&&!this.folded&&(this.dom.style.width=a+"px",this.setFoldButtonState()),this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px")),o!==void 0&&(o===null?(this.folded=!this.folded,this.view.state.field(ae.editorInfoField).app.workspace.requestSaveLayout()):this.folded=o,this.foldGutter()),l!==void 0&&(this.hide_on_empty=l,this.hide_on_empty&&n.size===0?this.dom.style.width="0":this.dom.style.width=this.width+"px",this.view.dom.style.setProperty("--cmtr-anno-gutter-width",this.width+"px")),h!==void 0&&(this.add_fold_button=h,this.add_fold_button&&!this.fold_button_el?this.createFoldButton():!this.add_fold_button&&this.fold_button_el&&(this.fold_button_el.remove(),this.fold_button_el=void 0),this.setFoldButtonState()),u!==void 0&&(this.add_resize_handle=u,this.add_resize_handle&&!this.resize_handle_el?this.createResizeHandle():!this.add_resize_handle&&this.resize_handle_el&&(this.resize_handle_el.remove(),this.resize_handle_el=void 0))}return n.size!==t.startState.field(Me).size&&(n.size===0?(this.fold_button_el&&(this.fold_button_el.style.display="none"),this.resize_handle_el&&(this.resize_handle_el.style.display="none"),this.hide_on_empty&&(this.dom.style.width="0")):(this.fold_button_el&&(this.fold_button_el.style.display=""),this.resize_handle_el&&(this.resize_handle_el.style.display=""),this.folded||(this.dom.style.width=this.width+"px"))),i}destroy(){var t,i;(t=this.fold_button_el)==null||t.remove(),(i=this.resize_handle_el)==null||i.remove(),super.destroy()}},Oi=class extends Be{constructor(t,i,n,r,o=null){super(t,i,n,r);this.block=o}update(t,i,n,r,o=null){this.block=o,this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),Ot(this.markers,r)||this.setMarkers(t,r)}};var kn=new Sn.Compartment;var Cn=require("obsidian"),On=require("@codemirror/state");var dt=require("@codemirror/state"),Ul=require("@codemirror/view");var xn=dt.Facet.define({combine:s=>s.some(e=>e)}),Ii=dt.Facet.define(),En=dt.Annotation.define(),Ai=class extends Ue{constructor(e){super(e,xn,Ii),e.dom.parentElement.classList.contains("markdown-source-view")||(this.dom.style.display="none",setImmediate(()=>{e.dispatch(e.state.update({effects:[Mn.reconfigure([])]}))}))}createGutters(e){return e.state.facet(Ii).map(t=>new Pi(e,t))}},Pi=class extends Se{constructor(t,i){super(t,i);this.view=t;this.config=i;E(this,"hide_on_empty",!1);E(this,"showing",!0);this.hide_on_empty=i.hideOnEmpty}update(t){let i=super.update(t);for(let n of t.transactions){let r=n.annotation(En);r!==void 0&&(this.hide_on_empty=r)}return this.showing&&this.hide_on_empty&&t.state.field(F).ranges.empty()?(this.dom.parentElement.classList.add("gutter-hidden"),this.showing=!1):!this.showing&&(!this.hide_on_empty||!t.state.field(F).ranges.empty())&&(this.dom.parentElement.classList.remove("gutter-hidden"),this.showing=!0),i}},Ur=It(Ai);function Tn(s){return vi(Ur,s,Ii,xn)}var Lt=require("@codemirror/state"),Bt=require("@codemirror/view");var Ri=class extends Bt.GutterMarker{constructor(t,i,n){super();this.type=t;this.top=i;this.bottom=n}toDOM(){let t="";return this.type.has("addition")&&(t+="cmtr-diff-gutter-addition "),this.type.has("deletion")&&(t+="cmtr-diff-gutter-deletion "),this.type.has("substitution")&&(t+="cmtr-diff-gutter-substitution "),this.top&&(t+="cmtr-diff-gutter-top "),this.bottom&&(t+="cmtr-diff-gutter-bottom "),createDiv({cls:t})}},Di=Bt.ViewPlugin.fromClass(class{constructor(e){E(this,"markers",Lt.RangeSet.empty);this.constructMarkers(e)}constructMarkers(e){let t=e.state.field(F).ranges,i=new Lt.RangeSetBuilder,n={};for(let r of t.ranges_in_interval(e.viewport.from,e.viewport.to)){let o=e.state.doc.lineAt(r.from).number,a=e.state.doc.lineAt(r.to).number,l=Array.from({length:a-o+1},(h,u)=>o+u);n[o]?n[o].isStart=!0:n[o]={isStart:!0,isEnd:!1,types:new Set};for(let h of l)n[h]?(n[h].isEnd=!1,n[h].types.add(r.type)):n[h]={isStart:!1,isEnd:!1,types:new Set([r.type])};n[a]&&(n[a].isEnd=!0)}for(let[r,o]of Object.entries(n)){let a=e.state.doc.line(Number(r));i.add(a.from,a.to,new Ri(o.types,o.isStart,o.isEnd))}this.markers=i.finish()}update(e){(e.docChanged||e.viewportChanged||e.heightChanged)&&this.constructMarkers(e.view)}});var ih=[Di,Tn({class:"cmtr-diff-gutter",markers:s=>s.plugin(Di).markers,domEventHandlers:{click:(s,e,t)=>{let i=new Cn.Menu;return i.addItem(n=>{n.setTitle("Accept changes").setIcon("check").onClick(()=>{s.dispatch({changes:je(s.state,e.from,e.to)})})}),i.addItem(n=>{n.setTitle("Reject changes").setIcon("cross").onClick(()=>{s.dispatch({changes:$e(s.state,e.from,e.to)})})}),i.showAtMouseEvent(t),!1}}})],Mn=new On.Compartment;var Ut=require("@codemirror/state"),In=require("@codemirror/view");var jr=Ut.Prec.high(In.EditorView.inputHandler.of((s,e,t,i)=>{let n=s.state.doc.sliceString(e-2,e)+i,r;if((r=Bi[n])!==void 0){let o=[{from:e,to:t+1,insert:i+r.join("")}];return s.dispatch({changes:o,selection:Ut.EditorSelection.cursor(t+1)}),!0}return!1}));var Ft=require("@codemirror/state");var $r=Ft.EditorState.transactionFilter.of(s=>{if(s.isUserEvent("select")){let e=s.startState.selection.main,t=s.selection.main;if(t.anchor===t.head){let i=s.startState.field(F).ranges,n=i.at_cursor(e.head),r=i.at_cursor(t.head);if(n&&n!==r&&(n.type==="substitution"||n.type==="highlight")){let o=n.unwrap(),a=!1,l=0,h=o.search(/\\S/);h>=1&&(a=!0,o=o.slice(h),l+=h);let u=o.match(/\\n\\s*\\n/g);if(u&&(a=!0,o=o.replace(/\\n\\s*\\n/g,`\n`),l+=u.reduce((f,c)=>f+c.length,0)),a)return{changes:[{from:n.from+3,to:n.to-3,insert:o}],selection:Ft.EditorSelection.cursor(t.head-l)}}}}return s});var Wr=require("@codemirror/state");var Yr=require("@codemirror/state"),we;var An=require("obsidian");var F=Pn.StateField.define({create(s){let e=s.doc.toString(),t=Mt.parser.parse(e),i=s.field(we),n=new gt(Ni(t,e,i));return{tree:t,fragments:De.addTree(t),ranges:n,inserted_ranges:n.ranges,deleted_ranges:[]}},update(s,e){let t=e.state.field(we);if(e.effects.some(p=>p.is(Zt)))return this.create(e.state);if(!e.docChanged)return s.inserted_ranges=[],s.deleted_ranges=[],s;let i=[];e.changes.iterChangedRanges((p,I,M,T)=>i.push({fromA:p,toA:I,fromB:M,toB:T}));let n=De.applyChanges(s.fragments,i),r=e.state.doc.toString(),o=Mt.parser.parse(new Rn.DocInput(e.state.doc),n);n=De.addTree(o,n);let a=new Map,l=[],h=new Map,u=new Set;for(let p of i){s.ranges.tree.search([p.fromA,p.toA],(I,M)=>{s.ranges.tree.remove(M,I),u.add(I);for(let T of I.base_range.thread)h.set(T.from,T);return!0});for(let I of Ni(o,r,t,p.fromB,p.toB))a.set(I.from,I);l.push([p.toA,p.toB-p.fromB-(p.toA-p.fromA)])}for(let p of u)p.type==="comment"&&h.delete(p.from);let f=0,c=s.ranges.tree.nil_node;function g(p){if(p!=null&&p!=c){for(g(p.left);l.length&&p.item.key.low>=l[0][0];)f+=l.shift()[1];p.item.value.apply_offset(f),p.item.key.low=p.item.value.from,p.item.key.high=p.item.value.to,g(p.right),p.left!=c&&(p.max.low=p.left.max.low),p.right!=c&&(p.max.high=p.right.max.high)}}g(s.ranges.tree.root);let b=Array.from(a.values());for(let p of b)s.ranges.tree.insert([p.from,p.to],p);for(let p of b)p.type==="comment"&&h.set(p.from,p);if(h.size){let p=[],I,M=[];for(let T of Array.from(h.values()).sort((k,A)=>k.from-A.from))T.clear_references(),T.replies.length=0,!I||I!=null&&I.right_adjacent(T)?M.push(T):(p.push(M),M=[T]),I=T;p.push(M);for(let T of p){let k=T[0],A=s.ranges.tree.search([k.from,k.from])[0];A.replies.length=0;for(let w of T.slice(A===k?1:0))w.add_reply(A)}}return s.ranges.ranges=s.ranges.tree.values,{tree:o,ranges:s.ranges,fragments:n,inserted_ranges:b,deleted_ranges:[...u]}}});function qr(s,e,t){var r,o;let i=s.enable_metadata&&((r=e.firstChild)!=null&&r.type.name.startsWith("MDSep"))?e.firstChild.from:void 0,n;if(e.type.name==="Substitution"){let a=i?(o=e.firstChild)==null?void 0:o.nextSibling:e.firstChild;if(!a||a.type.name!=="MSub")return;n=a.from}return Qr(e.from,e.to,e.type.name,t.slice(e.from,e.to),n,i)}function Ni(s,e,t,i=0,n=e.length){let r=[],o,a=s.cursor();if(a.childAfter(i-1),a.node.type.name==="CriticMarkup"||a.node.from>n)return r;if(a)do{let l=a.node;if(l.type.name==="\\u26A0")continue;let h=qr(t,l,e);h&&(h.type==="comment"&&o&&o.right_adjacent(h)&&h.add_reply(o),r.push(h),o=h)}while(a.nextSibling()&&a.node.from<=n);return r}function Dn(s,e){let t=Mt.parser.parse(s);return Ni(t,s,e)}function Qr(s,e,t,i,n,r){switch(t){case"Addition":return new xe(s,e,i,r);case"Deletion":return new Ie(s,e,i,r);case"Substitution":return new Pe(s,n,e,i,r);case"Highlight":return new Ae(s,e,i,r);case"Comment":return new Oe(s,e,i,r);default:return new xe(s,e,i,r)}}var _u={addition:xe,deletion:Ie,highlight:Ae,substitution:Pe,comment:Oe};function Ct(s){let e;return s.add_metadata&&(e={},s.add_author_metadata&&(e.author=s.author||void 0),s.add_timestamp_metadata&&(e.time=Math.floor(Date.now()/1e3)),Object.keys(e).length===0&&(e=void 0)),e}function Nn(s,e,t,i,n=0,r=0){if(!t)return{insert:e+s,start_offset:n,end_offset:r};let o=Z[t],a=i&&Object.keys(i).length?JSON.stringify(i)+"@@":"",l=o[0]+a+(t==="substitution"?e+o[1]+s+o[2]:e+s+o[1]),h=o[0].length+a.length;return n+=h,r+=t==="substitution"?o[1].length:0,{insert:l,start_offset:n,end_offset:r}}function ut(s,e,t,i=""){return Nn(t,i,e,Ct(s)).insert}var Gn=require("@codemirror/state");var Cu=require("@codemirror/state");var Ln=require("@codemirror/state");var Ku={addition:"ignore_metadata",deletion:"ignore_metadata",substitution:"ignore_metadata",comment:"ignore_metadata",highlight:"ignore_metadata"},Zu={addition:"stay_inside",deletion:"stay_inside",substitution:"stay_inside",comment:"stay_inside",highlight:"stay_inside"};var ef=require("@codemirror/state");var hf=require("@codemirror/view"),Bn=require("@codemirror/state");function Te(s,e,t=!1){let i=s.state.field(we),n=e?e.full_range_back:s.state.selection.main.head,r=e?e.full_thread.length:-1;s.dispatch(s.state.update({changes:{from:n,to:n,insert:ut(i,"comment","")},selection:Bn.EditorSelection.cursor(n),scrollIntoView:t})),activeWindow.setTimeout(()=>{s.dispatch(s.state.update({annotations:[Ye.of({from:n,to:n,index:r})]}))})}var _f=require("@codemirror/state");function je(s,e,t,i=!0){let n=s.field(F).ranges;return(e||t?n.ranges_in_interval(e!=null?e:0,t!=null?t:1/0):n.ranges).filter(r=>r.type==="addition"||r.type==="deletion"||r.type==="substitution").map(r=>({from:r.from,to:i?r.full_range_back:r.to,insert:r.accept()}))}function $e(s,e,t,i=!0){let n=s.field(F).ranges;return(e||t?n.ranges_in_interval(e!=null?e:0,t!=null?t:1/0):n.ranges).filter(r=>r.type==="addition"||r.type==="deletion"||r.type==="substitution").map(r=>({from:r.from,to:i?r.full_range_back:r.to,insert:r.reject()}))}var Xr=require("@codemirror/state");var zt=qn(Un(),1);zt.default.DIFF_DELETE=-1;zt.default.DIFF_INSERT=1;zt.default.DIFF_EQUAL=0;async function Fn(s,e){return await Promise.all(s.map(async t=>Dn(t,e)))}self.onmessage=async s=>{self.postMessage(await Fn(s.data.files,s.data.settings))};\n')}(0,Bh.extendPrototype)(ki.default);(0,Fh.extendPrototype)(ki.default);var Wc=class extends On.Events{_events=[];onunload(){}unload(){for(;this._events.length>0;)this._events.pop()()}register(e){this._events.push(e)}registerEvent(e){this.register(()=>e.e.offref(e))}},Uo=class extends Wc{constructor(t,n,i,s,o,a,u,l=2,d=p=>p,c=()=>this.plugin.settings,f=!0){super();this.plugin=t;this.name=n;this.title=i;this.version=s;this.description=o;this.defaultValue=a;this.extractValue=u;this.workers=l;this.loadValue=d;this.getSettings=c;this.old_version=parseInt(this.plugin.app.loadLocalStorage(n+"-version"))||null,this.persist=ki.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:ki.default.INDEXEDDB,description:o,version:s}),f&&this.startDatabase()}memory=new Map;persist;old_version=null;deleted_keys=new Set;databaseUpdate=(0,On.debounce)(()=>{this.trigger("database-update",this.allEntries()),this.flushChanges()},100,!0);flushChanges=(0,On.debounce)(async()=>{await this.persistMemory(),this.trigger("database-update",this.allEntries())},1e3,!0);on(t,n,i){return super.on(t,n,i)}async startDatabase(){this.plugin.app.workspace.onLayoutReady(async()=>{await this.persist.ready(async()=>{this.old_version===null?(await this.rebuildDatabase(),this.trigger("database-create")):this.old_version<this.version?(await this.clearDatabase(),await this.rebuildDatabase(),this.trigger("database-migrate")):(await this.loadDatabase(),await this.syncDatabase()),this.trigger("database-update",this.allEntries()),this.registerEvent(this.plugin.app.vault.on("modify",async t=>{if(t instanceof On.TFile&&t.extension==="md"){let n=this.plugin.app.workspace.activeEditor,i=n&&n.file?.path===t.path&&n.editor?n.editor.cm.state:void 0;this.storeKey(t.path,await this.extractValue(t,i),t.stat.mtime)}})),this.registerEvent(this.plugin.app.vault.on("delete",async t=>{t instanceof On.TFile&&t.extension==="md"&&this.deleteKey(t.path)})),this.registerEvent(this.plugin.app.vault.on("rename",async(t,n)=>{t instanceof On.TFile&&t.extension==="md"&&this.renameKey(n,t.path,t.stat.mtime)})),this.registerEvent(this.plugin.app.vault.on("create",async t=>{t instanceof On.TFile&&t.extension==="md"&&this.storeKey(t.path,this.defaultValue(),t.stat.mtime)}))})})}async loadDatabase(){this.memory=new Map(Object.entries(await this.persist.getItems()).map(([t,n])=>(n.data=this.loadValue(n.data),[t,n])))}async regularParseFiles(t){for(let n=0;n<t.length;n++){let i=t[n],s=this.getItem(i.path);(s===null||s.mtime<i.stat.mtime)&&this.storeKey(i.path,await this.extractValue(i),i.stat.mtime,!0)}}async workerParseFiles(t){let n=await Promise.all(t.map(async s=>await this.plugin.app.vault.cachedRead(s))),i=Math.ceil(t.length/this.workers);for(let s=0;s<this.workers;s++){let o=new Yc(null,{name:this.title+" indexer "+(s+1)}),a=t.slice(s*i,(s+1)*i),u=n.slice(s*i,(s+1)*i);o.onmessage=l=>{for(let d=0;d<a.length;d++){let c=a[d],f=this.loadValue(l.data[d]);this.storeKey(c.path,f,c.stat.mtime,!0)}o.terminate()},o.postMessage({files:u,settings:this.getSettings()})}this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString())}async syncDatabase(){let t=this.plugin.app.vault.getMarkdownFiles();this.allKeys().forEach(i=>{t.some(s=>s.path===i)||this.deleteKey(i)});let n=t.filter(i=>!this.memory.has(i.path)||this.memory.get(i.path).mtime<i.stat.mtime);n.length<=100?await this.regularParseFiles(n):await this.workerParseFiles(n),this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString())}async rebuildDatabase(){await this.workerParseFiles(this.plugin.app.vault.getMarkdownFiles()),this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString())}async persistMemory(){let t={};for(let[n,i]of this.memory.entries())i.dirty&&(t[n]={data:i.data,mtime:i.mtime},this.memory.set(n,{data:i.data,mtime:i.mtime,dirty:!1}));await this.persist.setItems(t),await Promise.all(Array.from(this.deleted_keys.values()).map(async n=>await this.persist.removeItem(n))),this.deleted_keys.clear()}storeKey(t,n,i,s=!0){this.memory.set(t,{data:n,mtime:i??Date.now(),dirty:s}),this.databaseUpdate()}deleteKey(t){if(this.getItem(t)==null)throw new Error("Key does not exist");this.memory.delete(t),this.deleted_keys.add(t),this.databaseUpdate()}renameKey(t,n,i){let s=this.getItem(t);if(s==null)throw new Error("Key does not exist");this.storeKey(n,s.data,i),this.deleteKey(t),this.databaseUpdate()}allKeys(){return Array.from(this.memory.keys())}getValue(t){return this.memory.get(t)?.data??null}allValues(){return Array.from(this.memory.values()).map(t=>t.data)}getItem(t){return this.memory.get(t)??null}allItems(){return Array.from(this.memory.values())}allEntries(){return Array.from(this.memory.entries())}async dropDatabase(){this.memory.clear(),await ki.default.dropInstance({name:this.name+`/${this.plugin.app.appId}`}),localStorage.removeItem(this.plugin.app.appId+"-"+this.name+"-version")}async reinitializeDatabase(){await this.dropDatabase(),this.persist=ki.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:ki.default.INDEXEDDB,version:this.version,description:this.description}),await this.rebuildDatabase(),this.trigger("database-update",this.allEntries())}async clearDatabase(){this.memory.clear(),await this.persist.clear()}isEmpty(){return this.memory.size===0}};var Jc=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(r=>r.charCodeAt(0)));var Kc,sg=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Qc=(Kc=String.fromCodePoint)!==null&&Kc!==void 0?Kc:function(r){let e="";return r>65535&&(r-=65536,e+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),e+=String.fromCharCode(r),e};function Xc(r){var e;return r>=55296&&r<=57343||r>1114111?65533:(e=sg.get(r))!==null&&e!==void 0?e:r}var Nt;(function(r){r[r.NUM=35]="NUM",r[r.SEMI=59]="SEMI",r[r.EQUALS=61]="EQUALS",r[r.ZERO=48]="ZERO",r[r.NINE=57]="NINE",r[r.LOWER_A=97]="LOWER_A",r[r.LOWER_F=102]="LOWER_F",r[r.LOWER_X=120]="LOWER_X",r[r.LOWER_Z=122]="LOWER_Z",r[r.UPPER_A=65]="UPPER_A",r[r.UPPER_F=70]="UPPER_F",r[r.UPPER_Z=90]="UPPER_Z"})(Nt||(Nt={}));var ag=32,Si;(function(r){r[r.VALUE_LENGTH=49152]="VALUE_LENGTH",r[r.BRANCH_LENGTH=16256]="BRANCH_LENGTH",r[r.JUMP_TABLE=127]="JUMP_TABLE"})(Si||(Si={}));function Zc(r){return r>=Nt.ZERO&&r<=Nt.NINE}function ug(r){return r>=Nt.UPPER_A&&r<=Nt.UPPER_F||r>=Nt.LOWER_A&&r<=Nt.LOWER_F}function lg(r){return r>=Nt.UPPER_A&&r<=Nt.UPPER_Z||r>=Nt.LOWER_A&&r<=Nt.LOWER_Z||Zc(r)}function cg(r){return r===Nt.EQUALS||lg(r)}var Pt;(function(r){r[r.EntityStart=0]="EntityStart",r[r.NumericStart=1]="NumericStart",r[r.NumericDecimal=2]="NumericDecimal",r[r.NumericHex=3]="NumericHex",r[r.NamedEntity=4]="NamedEntity"})(Pt||(Pt={}));var Qr;(function(r){r[r.Legacy=0]="Legacy",r[r.Strict=1]="Strict",r[r.Attribute=2]="Attribute"})(Qr||(Qr={}));var Fu=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Pt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Qr.Strict}startEntity(e){this.decodeMode=e,this.state=Pt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Pt.EntityStart:return e.charCodeAt(t)===Nt.NUM?(this.state=Pt.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Pt.NamedEntity,this.stateNamedEntity(e,t));case Pt.NumericStart:return this.stateNumericStart(e,t);case Pt.NumericDecimal:return this.stateNumericDecimal(e,t);case Pt.NumericHex:return this.stateNumericHex(e,t);case Pt.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|ag)===Nt.LOWER_X?(this.state=Pt.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Pt.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,i){if(t!==n){let s=n-t;this.result=this.result*Math.pow(i,s)+Number.parseInt(e.substr(t,s),i),this.consumed+=s}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let i=e.charCodeAt(t);if(Zc(i)||ug(i))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let i=e.charCodeAt(t);if(Zc(i))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)===null||n===void 0||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Nt.SEMI)this.consumed+=1;else if(this.decodeMode===Qr.Strict)return 0;return this.emitCodePoint(Xc(this.result),this.consumed),this.errors&&(e!==Nt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,i=n[this.treeIndex],s=(i&Si.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let o=e.charCodeAt(t);if(this.treeIndex=dg(n,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===Qr.Attribute&&(s===0||cg(o))?0:this.emitNotTerminatedNamedEntity();if(i=n[this.treeIndex],s=(i&Si.VALUE_LENGTH)>>14,s!==0){if(o===Nt.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Qr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,i=(n[t]&Si.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:i}=this;return this.emitCodePoint(t===1?i[e]&~Si.VALUE_LENGTH:i[e+1],n),t===3&&this.emitCodePoint(i[e+2],n),n}end(){var e;switch(this.state){case Pt.NamedEntity:return this.result!==0&&(this.decodeMode!==Qr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Pt.NumericDecimal:return this.emitNumericEntity(0,2);case Pt.NumericHex:return this.emitNumericEntity(0,3);case Pt.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Pt.EntityStart:return 0}}};function fg(r){let e="",t=new Fu(r,n=>e+=Qc(n));return function(i,s){let o=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(o,a),t.startEntity(s);let l=t.write(i,a+1);if(l<0){o=a+t.end();break}o=a+l,a=l===0?o+1:o}let u=e+i.slice(o);return e="",u}}function dg(r,e,t,n){let i=(e&Si.BRANCH_LENGTH)>>7,s=e&Si.JUMP_TABLE;if(i===0)return s!==0&&n===s?t:-1;if(s){let u=n-s;return u<0||u>=i?-1:r[t+u]-1}let o=t,a=o+i-1;for(;o<=a;){let u=o+a>>>1,l=r[u];if(l<n)o=u+1;else if(l>n)a=u-1;else return r[u+i]}return-1}var hg=fg(Jc);function Hs(r,e=Qr.Legacy){return hg(r,e)}var pg=String.prototype.codePointAt==null?(r,e)=>(r.charCodeAt(e)&64512)===55296?(r.charCodeAt(e)-55296)*1024+r.charCodeAt(e+1)-56320+65536:r.charCodeAt(e):(r,e)=>r.codePointAt(e);var zh;(function(r){r[r.XML=0]="XML",r[r.HTML=1]="HTML"})(zh||(zh={}));var Vh;(function(r){r[r.UTF8=0]="UTF8",r[r.ASCII=1]="ASCII",r[r.Extensive=2]="Extensive",r[r.Attribute=3]="Attribute",r[r.Text=4]="Text"})(Vh||(Vh={}));var Gs=require("obsidian");function qo(r,e,t=!0,n=0,i="div",s=null,o){return e.type==="comment"?yc(r,e,o,t):e.postprocess(t,n,i,s,o)}async function zu(r,e,t){let n=null,i=null,s=null,o=Hs(r.getHTML(),Qr.Strict),a=t.settings.default_preview_mode;if(e){if(t.app.workspace.activeLeaf?.view instanceof Gs.MarkdownView){let v=t.app.workspace.activeLeaf.view;v.previewMode.docId===e.docId&&(a=v.editor.cm.state.field(qt))}let _=e.getSectionInfo(r);if(_){let v=Fo(_.text,t.settings),k=[..._.text.matchAll(/\n/g)].map(S=>S.index);if(i=_.lineStart?k[_.lineStart-1]+1:0,s=k[_.lineEnd]??_.text.length,n=v.filter(S=>S.partially_in_range(i,s)),!n.length)return;if(n.length===1){let S=n[0],T=!1,E=null;if(S.type==="substitution"?S.part_encloses_range(i,s,!0)&&(T=!0,E=!0)||S.part_encloses_range(i,s,!1)&&(T=!0,E=!1):T=S.encloses_range(i,s),T){S.type==="substitution"&&(o=o.replace(/~>/g,""));let y=i===S.from;if(s===S.to){let A=o.lastIndexOf(gt[S.type].at(-1));o=o.substring(0,A)+o.substring(A+3)}if(y){let A=o.indexOf(gt[S.type][0]);o=o.substring(0,A)+o.substring(A+3)}let M=qo(t.app,S,!1,a,"div",E,o);r.empty(),typeof M=="string"?r.append((0,Gs.sanitizeHTMLToDom)(M)):r.appendChild(M);return}}}}o=o.replaceAll(/{<del>|{<\/del>/g,"{~~").replaceAll(/<del>}|<\/del>}/g,"~~}").replaceAll(/{<mark>|{<\/mark>/g,"{==").replaceAll(/<mark>}|<\/mark>}/g,"==}").replaceAll(/{=<mark>=}|{=<\/mark>=}/g,"{====}");let u=Fo(o,t.settings);for(let _=0;_<u.length-1;_++){let v=u[_],k=u[_+1];v.equals(k)&&(u.splice(_,1),_--)}if(!u.length&&!n?.length)return;let l=0,d=[],c=null,f=null,p=null;if(n!==null&&u.length!==n.length&&(f=i>n[0].from,p=s<n.at(-1).to,c=p?n.at(-1):n[0]),c&&f&&p&&c.type==="substitution"){let _=o.indexOf(gt.substitution[1]),v=new Sn(-1/0,_,1/0,o);r.append((0,Gs.sanitizeHTMLToDom)(qo(t.app,v,!0,a,"span")));return}if(c&&!p){let _=o.indexOf(gt[c.type].at(-1))+3,v;if(c.type==="substitution"){let k=o.indexOf(gt.substitution[1]);v=new Sn(-1/0,k===-1?-1/0:k,_,o)}else v=new zo[c.type](-1/0,_,o);d.push(qo(t.app,v,!0,a,"span")),l=v.to}for(let _ of u)d.push(o.slice(l,_.from)),d.push(qo(t.app,_,!0,a,"span")),l=_.to;if(c&&p){let _=o.lastIndexOf(gt[c.type][0]),v;c.type==="substitution"?v=new Sn(0,1/0,1/0,o.slice(_,-4)):v=new zo[c.type](0,1/0,o.slice(_,-4)),d.push(o.slice(l,_)),d.push(qo(t.app,v,!0,t.settings.default_preview_mode,"span")),l=1/0}d.push(o.slice(l)),r.empty();let m=[],g="";for(let _ of d)typeof _=="string"?g+=_:(g+="<placeholder></placeholder>",m.push(_));r.append((0,Gs.sanitizeHTMLToDom)(g)),r.querySelectorAll("placeholder").forEach((_,v)=>{_.replaceWith(m[v])})}var yg=require("@codemirror/state"),tf=require("obsidian");function rf(r){for(let e of r.workspace.getLeavesOfType("markdown"))if(e.view instanceof tf.MarkdownView){for(let t of e.view.previewMode.renderer.sections.filter(n=>n.el.querySelector(".cmtr-preview")))t.rendered=!1,t.html="";e.view.previewMode.renderer.queueRender()}}function Vu(r){for(let e of r.workspace.getLeavesOfType("markdown"))e.view instanceof tf.MarkdownView&&e.view.previewMode.rerender(!0)}var Gu=require("obsidian");var Hu=class{constructor(e,t=!1){this.plugin=e;this.setRendering(t)}button=null;index=0;metadata_settings_toggles=[{icon:"lucide-user",text:"Author",attribute:"author"},{icon:"lucide-calendar",text:"Time",attribute:"timestamp"},{icon:"lucide-check",text:"Completed",attribute:"completed"},{icon:"brush",text:"Style",attribute:"style"},{icon:"paintbrush",text:"Color",attribute:"color"}];showMenu(e){bi();let t=new Gu.Menu;t.addItem(n=>{n.setTitle("Add metadata"),n.setIcon("tags"),n.setChecked(this.plugin.settings.add_metadata),n.onClick(async()=>{await this.plugin.setSetting("add_metadata",!this.plugin.settings.add_metadata),n.setChecked(this.plugin.settings.add_metadata),t.items.slice(1).forEach(i=>{i.setDisabled(!this.plugin.settings.add_metadata)})})});for(let{icon:n,text:i,attribute:s}of this.metadata_settings_toggles){let o=`add_${s}_metadata`;t.addItem(a=>{a.setTitle(i),a.setIcon(n),a.setChecked(this.plugin.settings[o]),a.setDisabled(!this.plugin.settings.add_metadata),a.onClick(async()=>{await this.plugin.setSetting(o,!this.plugin.settings[o]),a.setChecked(this.plugin.settings[o])}),a.dom.addClass("cmtr-submenu-nested")})}t.showAtMouseEvent(e)}setRendering(e){e===void 0||e===!!this.button||(e?this.renderButton():this.detachButton())}renderButton(){this.button=this.plugin.addStatusBarItem();let e=this.button.createSpan({cls:"status-bar-item-icon"});(0,Gu.setIcon)(e,"tags"),this.button.classList.add("mod-clickable"),this.button.setAttribute("aria-label","Metadata"),this.button.setAttribute("data-tooltip-position","top"),this.button.addEventListener("click",t=>this.showMenu(t)),this.button.addEventListener("contextmenu",t=>this.showMenu(t))}detachButton(){this.button&&(this.button.detach(),this.button=null)}};var Qi=require("obsidian"),jo=class{constructor(e,t,n,i,s=!1){this.states=e;this.onchange=t;this.getvalue=n;this.plugin=i;this.setRendering(s),this.plugin.app.workspace.onLayoutReady(()=>this.currentView=this.plugin.app.workspace.activeEditor)}button=null;value=0;changeEvent=null;currentView=null;showMenu(e){let t=new Qi.Menu;for(let[n,i]of this.states.entries())t.addItem(s=>{s.setTitle(i.text),s.setIcon(i.icon),s.setChecked(n===this.value),s.onClick(()=>this.onchange(this.currentView,n))});t.showAtMouseEvent(e),e.preventDefault()}setRendering(e){e===void 0||e===!!this.button||(e?this.renderButton():this.detachButton())}updateButton(e){if(!this.button||e===void 0)return;this.value=e;let{icon:t,text:n}=this.states[e];(0,Qi.setIcon)(this.button,t),this.button.setAttribute("aria-label",n)}renderButton(){let{icon:e,text:t}=this.states[this.value];this.changeEvent=this.plugin.app.workspace.on("active-leaf-change",i=>{i&&i.view instanceof Qi.MarkdownView?(this.currentView=i.view,this.updateButton(this.getvalue(i.view.editor)),this.button.style.display=""):(this.currentView=null,this.button.style.display="none")}),this.button=this.plugin.addStatusBarItem();let n=this.button.createSpan({cls:"status-bar-item-icon"});(0,Qi.setIcon)(n,e),this.button.classList.add("mod-clickable"),this.button.setAttribute("aria-label",t),this.button.setAttribute("data-tooltip-position","top"),this.button.addEventListener("click",i=>this.showMenu(i)),this.button.addEventListener("contextmenu",i=>this.showMenu(i))}detachButton(){this.button&&(this.button.detach(),this.button=null,this.plugin.app.workspace.offref(this.changeEvent))}};var Uh=(r,e)=>new jo([{icon:"message-square",text:"Showing all suggestions"},{icon:"check",text:'Previewing "accept all"'},{icon:"cross",text:'Previewing "reject all"'}],r.setPreviewMode.bind(r),t=>t.cm.state.facet(qt),r,e),qh=(r,e)=>new jo([{icon:"pencil",text:"Editing (Regular)"},{icon:"edit",text:"Editing (Corrected)"},{icon:"file-edit",text:"Suggesting"}],r.setEditMode.bind(r),t=>t.cm.state.facet(kr),r,e),jh=(r,e)=>new Hu(r,e);var Ei=require("obsidian"),Yo=class{constructor(e,t,n,i,s,o,a=!1){this.states=e;this.has_label=t;this.cls=n;this.onchange=i;this.getvalue=s;this.plugin=o;this.setRendering(a)}active_mapping=new WeakMap;changeEvent=null;setRendering(e){e===void 0||e===!!this.changeEvent||(e?this.attachButtons():this.detachButtons())}setLabelRendering(e){if(!(e===void 0||!this.changeEvent||e===this.has_label)){this.has_label=e;for(let t of this.plugin.app.workspace.getLeavesOfType("markdown")){if(!(t.view instanceof Ei.MarkdownView))continue;let{view:n}=t,{text:i}=this.states[this.getvalue(n)],s=this.active_mapping.get(n);if(s)if(s.status)s.status.detach(),s.status=null;else{let o=s.button.createSpan({text:i,cls:this.cls});s.button.parentElement.insertBefore(o,s.button),s.status=o}}}}updateButton(e,t){let n=this.active_mapping.get(e);if(n)if(this.states[t]){let{tooltip:i,text:s}=this.states[t];(0,Ei.setIcon)(n.button,this.states[(t+1)%this.states.length].icon),n.button.setAttribute("aria-label",i),n.button.style.display="",this.has_label&&(n.status.innerText=s)}else n.button.style.display="none"}attachButtons(){this.changeEvent||(this.changeEvent=this.plugin.app.workspace.on("layout-change",this.attachButtons.bind(this)));for(let e of this.plugin.app.workspace.getLeavesOfType("markdown")){if(!(e.view instanceof Ei.MarkdownView))continue;let{view:t}=e;if(this.active_mapping.has(t))continue;let n=e.on("history-change",()=>{this.updateButton(t,this.getvalue(t))}),i=this.getvalue(t);if(i===void 0)return;let{tooltip:s,text:o}=this.states[i],a=t.addAction(this.states[(i+1)%this.states.length].icon,s,async()=>{let l=(this.getvalue(t)+1)%this.states.length;this.onchange(t,l)}),u=this.has_label?a.createSpan({text:o,cls:this.cls}):null;this.has_label&&a.parentElement.insertBefore(u,a),a.oncontextmenu=l=>{let d=new Ei.Menu,c=this.getvalue(t);for(let[f,{icon:p,text:m}]of this.states.entries())d.addItem(g=>{g.setIcon(p).setTitle(m).setChecked(f===c).onClick(()=>{this.onchange(t,f)})});d.showAtMouseEvent(l)},this.active_mapping.set(t,{button:a,status:u,event:n})}}detachButton(e){let t=e.view,n=this.active_mapping.get(t);n&&(e.offref(n.event),n.button.detach(),n.status?.detach(),this.active_mapping.delete(t))}detachButtons(){if(this.changeEvent){for(let e of this.plugin.app.workspace.getLeavesOfType("markdown"))e.view instanceof Ei.MarkdownView&&this.detachButton(e);this.plugin.app.workspace.offref(this.changeEvent),this.changeEvent=null}}};var Yh=(r,e)=>new Yo([{icon:"message-square",tooltip:`Current mode: show all suggestions
|
|
Click to preview 'accept all'`,text:"Showing all suggestions"},{icon:"check",tooltip:`Current mode: preview 'accept all'
|
|
Click to preview 'reject all'`,text:'Previewing "accept all"'},{icon:"cross",tooltip:`Current mode: preview 'reject all'
|
|
Click to preview 'show all'`,text:'Previewing "reject all"'}],r.settings.toolbar_show_buttons_labels,"cmtr-suggestion-status",r.setPreviewMode.bind(r),t=>t.editor.cm.state.facet(qt),r,e),Wh=(r,e)=>new Yo([{icon:"pencil",tooltip:`Current mode: editing (regular)
|
|
Click to edit (corrected)`,text:"Editing (REG)"},{icon:"edit",tooltip:`Current mode: editing (corrected)
|
|
Click to suggest`,text:"Editing (ALT)"},{icon:"file-edit",tooltip:`Current mode: suggesting
|
|
Click to edit (regular)`,text:"Suggesting"}],r.settings.toolbar_show_buttons_labels,"cmtr-suggestion-status",r.setEditMode.bind(r),t=>t.editor.cm.state.facet(kr),r,e);var r0=require("obsidian");var Uu=!0;var Jh=globalThis.process?.env?.NODE_ENV,re=Jh&&!Jh.toLowerCase().startsWith("prod");var Xr=Array.isArray,Kh=Array.prototype.indexOf,Wo=Array.from,nf=Object.keys,Yt=Object.defineProperty,Zr=Object.getOwnPropertyDescriptor,qu=Object.getOwnPropertyDescriptors,ju=Object.prototype,Qh=Array.prototype,Ti=Object.getPrototypeOf,sf=Object.isExtensible;function of(r){return typeof r=="function"}var St=()=>{};function Jo(r){for(var e=0;e<r.length;e++)r[e]()}var cr=Symbol("$state"),Ko=Symbol("legacy props"),Xh=Symbol("");function Yu(r){return r===this.v}function Us(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function Zh(r,e){return r!==e}function qs(r){return!Us(r,this.v)}function af(){if(re){let r=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function ep(){if(re){let r=new Error(`derived_references_self
|
|
A derived value cannot reference itself recursively
|
|
https://svelte.dev/e/derived_references_self`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/derived_references_self")}function tp(r){if(re){let e=new Error(`effect_in_teardown
|
|
\`${r}\` cannot be used inside an effect cleanup function
|
|
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function rp(){if(re){let r=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function np(r){if(re){let e=new Error(`effect_orphan
|
|
\`${r}\` can only be used inside an effect (e.g. during component initialisation)
|
|
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function ip(){if(re){let r=new Error(`effect_update_depth_exceeded
|
|
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
|
|
https://svelte.dev/e/effect_update_depth_exceeded`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function sp(){if(re){let r=new Error(`hydration_failed
|
|
Failed to hydrate the application
|
|
https://svelte.dev/e/hydration_failed`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/hydration_failed")}function op(){if(re){let r=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/invalid_snippet")}function ap(r){if(re){let e=new Error(`props_invalid_value
|
|
Cannot do \`bind:${r}={undefined}\` when \`${r}\` has a fallback value
|
|
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function up(r){if(re){let e=new Error(`rune_outside_svelte
|
|
The \`${r}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
|
|
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function lp(){if(re){let r=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function cp(){if(re){let r=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function fp(){if(re){let r=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}var Qn=!1,Cn=!1;var $i="[",Mi="[!",Xi="]",Xn={};var yt=Symbol(),Lr=Symbol("filename"),dp=Symbol("hmr"),hp="http://www.w3.org/1999/xhtml";var wg=[];function Xo(r,e=!1){if(re&&!e){let t=[],n=Qo(r,new Map,"",t);if(t.length===1&&t[0]==="");else if(t.length>0){let i=t.length>10?t.slice(0,7):t.slice(0,10),s=t.length-i.length,o=i.map(a=>`- <value>${a}`).join(`
|
|
`);s>0&&(o+=`
|
|
- ...and ${s} more`)}return n}return Qo(r,new Map,"",wg)}function Qo(r,e,t,n,i=null){if(typeof r=="object"&&r!==null){var s=e.get(r);if(s!==void 0)return s;if(r instanceof Map)return new Map(r);if(r instanceof Set)return new Set(r);if(Xr(r)){var o=Array(r.length);e.set(r,o),i!==null&&e.set(i,o);for(var a=0;a<r.length;a+=1){var u=r[a];a in r&&(o[a]=Qo(u,e,re?`${t}[${a}]`:t,n))}return o}if(Ti(r)===ju){o={},e.set(r,o),i!==null&&e.set(i,o);for(var l in r)o[l]=Qo(r[l],e,re?`${t}.${l}`:t,n);return o}if(r instanceof Date)return structuredClone(r);if(typeof r.toJSON=="function")return Qo(r.toJSON(),e,re?`${t}.toJSON()`:t,n,r)}if(r instanceof EventTarget)return r;try{return structuredClone(r)}catch{return re&&n.push(t),r}}var Zo=null;function Zn(r){let e=Error(),t=e.stack;if(t){let n=t.split(`
|
|
`),i=[`
|
|
`];for(let s=0;s<n.length;s++){let o=n[s];if(o!=="Error"){if(o.includes("validate_each_keys"))return null;o.includes("svelte/src/internal")||i.push(o)}}if(i.length===1)return null;Yt(e,"stack",{value:i.join(`
|
|
`)}),Yt(e,"name",{value:`${r}Error`})}return e}function ta(r){if(re){let e=new Error(`lifecycle_outside_component
|
|
\`${r}(...)\` can only be used during component initialisation
|
|
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var Ge=null;function ra(r){Ge=r}var Br=null;function na(r){Br=r}function ve(r,e=!1,t){var n=Ge={p:Ge,c:null,d:!1,e:null,m:!1,s:r,x:null,l:null};Qn&&!e&&(Ge.l={s:null,u:null,r1:[],r2:Ct(!1)}),Er(()=>{n.d=!0}),re&&(Ge.function=t,Br=t)}function be(r){let e=Ge;if(e!==null){r!==void 0&&(e.x=r);let o=e.e;if(o!==null){var t=we,n=Oe;e.e=null;try{for(var i=0;i<o.length;i++){var s=o[i];Ot(s.effect),ft(s.reaction),tr(s.fn)}}finally{Ot(t),ft(n)}}Ge=e.p,re&&(Br=e.p?.function??null),e.m=!0}return r||{}}function hn(){return!Qn||Ge!==null&&Ge.l===null}function De(r){if(typeof r!="object"||r===null||cr in r)return r;let e=Ti(r);if(e!==ju&&e!==Qh)return r;var t=new Map,n=Xr(r),i=ae(0),s=re&&Cn?Zn("CreatedAt"):null,o=Oe,a=u=>{var l=Oe;ft(o);var d=u();return ft(l),d};return n&&t.set("length",ae(r.length,s)),new Proxy(r,{defineProperty(u,l,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&lp();var c=t.get(l);return c===void 0?(c=a(()=>ae(d.value,s)),t.set(l,c)):P(c,a(()=>De(d.value))),!0},deleteProperty(u,l){var d=t.get(l);if(d===void 0)l in u&&(t.set(l,a(()=>ae(yt,s))),uf(i));else{if(n&&typeof l=="string"){var c=t.get("length"),f=Number(l);Number.isInteger(f)&&f<c.v&&P(c,f)}P(d,yt),uf(i)}return!0},get(u,l,d){if(l===cr)return r;var c=t.get(l),f=l in u;if(c===void 0&&(!f||Zr(u,l)?.writable)&&(c=a(()=>ae(De(f?u[l]:yt),s)),t.set(l,c)),c!==void 0){var p=h(c);return p===yt?void 0:p}return Reflect.get(u,l,d)},getOwnPropertyDescriptor(u,l){var d=Reflect.getOwnPropertyDescriptor(u,l);if(d&&"value"in d){var c=t.get(l);c&&(d.value=h(c))}else if(d===void 0){var f=t.get(l),p=f?.v;if(f!==void 0&&p!==yt)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return d},has(u,l){if(l===cr)return!0;var d=t.get(l),c=d!==void 0&&d.v!==yt||Reflect.has(u,l);if(d!==void 0||we!==null&&(!c||Zr(u,l)?.writable)){d===void 0&&(d=a(()=>ae(c?De(u[l]):yt,s)),t.set(l,d));var f=h(d);if(f===yt)return!1}return c},set(u,l,d,c){var f=t.get(l),p=l in u;if(n&&l==="length")for(var m=d;m<f.v;m+=1){var g=t.get(m+"");g!==void 0?P(g,yt):m in u&&(g=a(()=>ae(yt,s)),t.set(m+"",g))}f===void 0?(!p||Zr(u,l)?.writable)&&(f=a(()=>ae(void 0,s)),P(f,a(()=>De(d))),t.set(l,f)):(p=f.v!==yt,P(f,a(()=>De(d))));var _=Reflect.getOwnPropertyDescriptor(u,l);if(_?.set&&_.set.call(c,d),!p){if(n&&typeof l=="string"){var v=t.get("length"),k=Number(l);Number.isInteger(k)&&k>=v.v&&P(v,k+1)}uf(i)}return!0},ownKeys(u){h(i);var l=Reflect.ownKeys(u).filter(f=>{var p=t.get(f);return p===void 0||p.v!==yt});for(var[d,c]of t)c.v!==yt&&!(d in u)&&l.push(d);return l},setPrototypeOf(){cp()}})}function uf(r,e=1){P(r,r.v+e)}function js(r){try{if(r!==null&&typeof r=="object"&&cr in r)return r[cr]}catch{}return r}function lf(r,e){return Object.is(js(r),js(e))}function Oi(r){var e=2050,t=Oe!==null&&(Oe.f&2)!==0?Oe:null;we===null||t!==null&&(t.f&256)!==0?e|=256:we.f|=1048576;let n={ctx:Ge,deps:null,effects:null,equals:Yu,f:e,fn:r,reactions:null,rv:0,v:null,wv:0,parent:t??we};return re&&Cn&&(n.created=Zn("CreatedAt")),n}function ne(r){let e=Oi(r);return Ku(e),e}function ia(r){let e=Oi(r);return e.equals=qs,e}function Wu(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)nr(e[t])}}var cf=[];function kg(r){for(var e=r.parent;e!==null;){if((e.f&2)===0)return e;e=e.parent}return null}function hf(r){var e,t=we;if(Ot(kg(r)),re){let n=Zi;ff(new Set);try{cf.includes(r)&&ep(),cf.push(r),Wu(r),e=Ju(r)}finally{Ot(t),ff(n),cf.pop()}}else try{Wu(r),e=Ju(r)}finally{Ot(t)}return e}function pf(r){var e=hf(r),t=(ei||(r.f&256)!==0)&&r.deps!==null?4096:1024;ir(r,t),r.equals(e)||(r.v=e,r.wv=sa())}var Zi=new Set,Ys=new Map;function ff(r){Zi=r}function Ct(r,e){var t={f:0,v:r,reactions:null,equals:Yu,rv:0,wv:0};return re&&Cn&&(t.created=e??Zn("CreatedAt"),t.debug=null),t}function ae(r,e){let t=Ct(r,e);return Ku(t),t}function ri(r,e=!1){let t=Ct(r);return e||(t.equals=qs),Qn&&Ge!==null&&Ge.l!==null&&(Ge.l.s??=[]).push(t),t}function P(r,e,t=!1){Oe!==null&&!tn&&hn()&&(Oe.f&18)!==0&&!An?.includes(r)&&fp();let n=t?De(e):e;return Ws(r,n)}function Ws(r,e){if(!r.equals(e)){var t=r.v;if(ts?Ys.set(r,e):Ys.set(r,t),r.v=e,re&&Cn&&(r.updated=Zn("UpdatedAt"),we!=null&&(r.trace_need_increase=!0,r.trace_v??=t)),(r.f&2)!==0&&((r.f&2048)!==0&&hf(r),ir(r,(r.f&256)===0?1024:4096)),r.wv=sa(),gp(r,2048),hn()&&we!==null&&(we.f&1024)!==0&&(we.f&96)===0&&(zr===null?_p([r]):zr.push(r)),re&&Zi.size>0){let n=Array.from(Zi);for(let i of n)(i.f&1024)!==0&&ir(i,4096),Ci(i)&&Js(i);Zi.clear()}}return e}function oa(r,e=1){var t=h(r),n=e===1?t++:t--;return P(r,t),n}function gp(r,e){var t=r.reactions;if(t!==null)for(var n=hn(),i=t.length,s=0;s<i;s++){var o=t[s],a=o.f;if((a&2048)===0&&!(!n&&o===we)){if(re&&(a&262144)!==0){Zi.add(o);continue}ir(o,e),(a&1280)!==0&&((a&2)!==0?gp(o,4096):Ks(o))}}}var de=!1;function sr(r){de=r}var xe;function lt(r){if(r===null)throw Xn;return xe=r}function Et(){return lt(Wt(xe))}function q(r){if(de){if(Wt(xe)!==null)throw Xn;xe=r}}function Qs(r=1){if(de){for(var e=r,t=xe;e--;)t=Wt(t);xe=t}}function rs(){for(var r=0,e=xe;;){if(e.nodeType===8){var t=e.data;if(t===Xi){if(r===0)return e;r-=1}else(t===$i||t===Mi)&&(r+=1)}var n=Wt(e);e.remove(),e=n}}function bp(){let r=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:t,lastIndexOf:n,includes:i}=r;r.indexOf=function(s,o){let a=t.call(this,s,o);if(a===-1){for(let u=o??0;u<this.length;u+=1)if(js(this[u])===s){break}}return a},r.lastIndexOf=function(s,o){let a=n.call(this,s,o??this.length-1);if(a===-1){for(let u=0;u<=(o??this.length-1);u+=1)if(js(this[u])===s){break}}return a},r.includes=function(s,o){let a=i.call(this,s,o);if(!a){for(let u=0;u<this.length;u+=1)if(js(this[u])===s){break}}return a},Array.__svelte_cleanup=()=>{r.indexOf=t,r.lastIndexOf=n,r.includes=i}}var gf,yp,aa,wp,xp;function Qu(){if(gf===void 0){gf=window,yp=document,aa=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;wp=Zr(e,"firstChild").get,xp=Zr(e,"nextSibling").get,sf(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),sf(t)&&(t.__t=void 0),re&&(r.__svelte_meta=null,bp())}}function Tr(r=""){return document.createTextNode(r)}function Tt(r){return wp.call(r)}function Wt(r){return xp.call(r)}function K(r,e){if(!de)return Tt(r);var t=Tt(xe);if(t===null)t=xe.appendChild(Tr());else if(e&&t.nodeType!==3){var n=Tr();return t?.before(n),lt(n),n}return lt(t),t}function Te(r,e){if(!de){var t=Tt(r);return t instanceof Comment&&t.data===""?Wt(t):t}if(e&&xe?.nodeType!==3){var n=Tr();return xe?.before(n),lt(n),n}return xe}function F(r,e=1,t=!1){let n=de?xe:r;for(var i;e--;)i=n,n=Wt(n);if(!de)return n;var s=n?.nodeType;if(t&&s!==3){var o=Tr();return n===null?i?.after(o):n.before(o),lt(o),o}return lt(n),n}function ua(r){r.textContent=""}function Sp(r){we===null&&Oe===null&&np(r),Oe!==null&&(Oe.f&256)!==0&&we===null&&rp(),ts&&tp(r)}function Sg(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function ns(r,e,t,n=!0){var i=we;if(re)for(;i!==null&&(i.f&262144)!==0;)i=i.parent;var s={ctx:Ge,deps:null,nodes_start:null,nodes_end:null,f:r|2048,first:null,fn:e,last:null,next:null,parent:i,prev:null,teardown:null,transitions:null,wv:0};if(re&&(s.component_function=Br),t)try{Js(s),s.f|=32768}catch(u){throw nr(s),u}else e!==null&&Ks(s);var o=t&&s.deps===null&&s.first===null&&s.nodes_start===null&&s.teardown===null&&(s.f&1048704)===0;if(!o&&n&&(i!==null&&Sg(s,i),Oe!==null&&(Oe.f&2)!==0)){var a=Oe;(a.effects??=[]).push(s)}return s}function Er(r){let e=ns(8,null,!1);return ir(e,1024),e.teardown=r,e}function $t(r){Sp("$effect");var e=we!==null&&(we.f&32)!==0&&Ge!==null&&!Ge.m;if(re&&Yt(r,"name",{value:"$effect"}),e){var t=Ge;(t.e??=[]).push({fn:r,effect:we,reaction:Oe})}else{var n=tr(r);return n}}function yf(r){let e=ns(64,r,!0);return()=>{nr(e)}}function Ep(r){let e=ns(64,r,!0);return(t={})=>new Promise(n=>{t.outro?Gr(e,()=>{nr(e),n(void 0)}):(nr(e),n(void 0))})}function tr(r){return ns(4,r,!1)}function hr(r){return ns(8,r,!0)}function fe(r,e=[],t=Oi){let n=e.map(t),i=()=>r(...n.map(h));return re&&Yt(i,"name",{value:"{expression}"}),or(i)}function or(r,e=0){return ns(24|e,r,!0)}function Lt(r,e=!0){return ns(40,r,!0,e)}function wf(r){var e=r.teardown;if(e!==null){let t=ts,n=Oe;_f(!0),ft(null);try{e.call(null)}finally{_f(t),ft(n)}}}function xf(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){var n=t.next;(t.f&64)!==0?t.parent=null:nr(t,e),t=n}}function Tp(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&32)===0&&nr(e),e=t}}function nr(r,e=!0){var t=!1;(e||(r.f&524288)!==0)&&r.nodes_start!==null&&(kf(r.nodes_start,r.nodes_end),t=!0),xf(r,e&&!t),ca(r,0),ir(r,16384);var n=r.transitions;if(n!==null)for(let s of n)s.stop();wf(r);var i=r.parent;i!==null&&i.first!==null&&Sf(r),re&&(r.component_function=null),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=null}function kf(r,e){for(;r!==null;){var t=r===e?null:Wt(r);r.remove(),r=t}}function Sf(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function Gr(r,e){var t=[];Zu(r,t,!0),Ef(t,()=>{nr(r),e&&e()})}function Ef(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var i of r)i.out(n)}else e()}function Zu(r,e,t){if((r.f&8192)===0){if(r.f^=8192,r.transitions!==null)for(let o of r.transitions)(o.is_global||t)&&e.push(o);for(var n=r.first;n!==null;){var i=n.next,s=(n.f&65536)!==0||(n.f&32)!==0;Zu(n,e,s?t:!1),n=i}}}function Ai(r){$p(r,!0)}function $p(r,e){if((r.f&8192)!==0){r.f^=8192,(r.f&1024)===0&&(r.f^=1024),Ci(r)&&(ir(r,2048),Ks(r));for(var t=r.first;t!==null;){var n=t.next,i=(t.f&65536)!==0||(t.f&32)!==0;$p(t,i?e:!1),t=n}if(r.transitions!==null)for(let s of r.transitions)(s.is_global||e)&&s.in()}}var Eg=typeof requestIdleCallback>"u"?r=>setTimeout(r,1):requestIdleCallback,fa=[],da=[];function Mp(){var r=fa;fa=[],Jo(r)}function Op(){var r=da;da=[],Jo(r)}function $r(r){fa.length===0&&queueMicrotask(Mp),fa.push(r)}function Cp(r){da.length===0&&Eg(Op),da.push(r)}function Tf(){fa.length>0&&Mp(),da.length>0&&Op()}var Ap=new WeakSet,el=!1,ma=!1,ha=null,is=!1,ts=!1;function _f(r){ts=r}var pa=[],Of=[],Oe=null,tn=!1;function ft(r){Oe=r}var we=null;function Ot(r){we=r}var An=null;function Ku(r){Oe!==null&&Oe.f&2097152&&(An===null?An=[r]:An.push(r))}var pr=null,Ur=0,zr=null;function _p(r){zr=r}var Pp=1,rl=0,ei=!1,ea=null;function sa(){return++Pp}function Ci(r){var e=r.f;if((e&2048)!==0)return!0;if((e&4096)!==0){var t=r.deps,n=(e&256)!==0;if(t!==null){var i,s,o=(e&512)!==0,a=n&&we!==null&&!ei,u=t.length;if(o||a){var l=r,d=l.parent;for(i=0;i<u;i++)s=t[i],(o||!s?.reactions?.includes(l))&&(s.reactions??=[]).push(l);o&&(l.f^=512),a&&d!==null&&(d.f&256)===0&&(l.f^=256)}for(i=0;i<u;i++)if(s=t[i],Ci(s)&&pf(s),s.wv>r.wv)return!0}(!n||we!==null&&!ei)&&ir(r,1024)}return!1}function Tg(r,e){for(var t=e;t!==null;){if((t.f&128)!==0)try{t.fn(r);return}catch{t.f^=128}t=t.parent}throw el=!1,r}function Ip(r){return(r.f&16384)===0&&(r.parent===null||(r.parent.f&128)===0)}function Zs(r,e,t,n){if(el){if(t===null&&(el=!1),Ip(e))throw r;return}if(t!==null&&(el=!0),re&&n!==null&&r instanceof Error&&!Ap.has(r)){Ap.add(r);let s=[],o=e.fn?.name;o&&s.push(o);let a=n;for(;a!==null;){var i=a.function?.[Lr];if(i){let d=i.split("/").pop();s.push(d)}a=a.p}let u=aa?" ":" ";Yt(r,"message",{value:r.message+`
|
|
${s.map(d=>`
|
|
${u}in ${d}`).join("")}
|
|
`}),Yt(r,"component_stack",{value:s});let l=r.stack;if(l){let d=l.split(`
|
|
`),c=[];for(let f=0;f<d.length;f++){let p=d[f];p.includes("svelte/src/internal")||c.push(p)}Yt(r,"stack",{value:c.join(`
|
|
`)})}}if(Tg(r,e),Ip(e))throw r}function Np(r,e,t=!0){var n=r.reactions;if(n!==null)for(var i=0;i<n.length;i++){var s=n[i];An?.includes(r)||((s.f&2)!==0?Np(s,e,!1):e===s&&(t?ir(s,2048):(s.f&1024)!==0&&ir(s,4096),Ks(s)))}}function Ju(r){var e=pr,t=Ur,n=zr,i=Oe,s=ei,o=An,a=Ge,u=tn,l=r.f;pr=null,Ur=0,zr=null,ei=(l&256)!==0&&(tn||!is||Oe===null),Oe=(l&96)===0?r:null,An=null,ra(r.ctx),tn=!1,rl++,r.f|=2097152;try{var d=(0,r.fn)(),c=r.deps;if(pr!==null){var f;if(ca(r,Ur),c!==null&&Ur>0)for(c.length=Ur+pr.length,f=0;f<pr.length;f++)c[Ur+f]=pr[f];else r.deps=c=pr;if(!ei)for(f=Ur;f<c.length;f++)(c[f].reactions??=[]).push(r)}else c!==null&&Ur<c.length&&(ca(r,Ur),c.length=Ur);if(hn()&&zr!==null&&!tn&&c!==null&&(r.f&6146)===0)for(f=0;f<zr.length;f++)Np(zr[f],r);return i!==null&&i!==r&&(rl++,zr!==null&&(n===null?n=zr:n.push(...zr))),d}finally{pr=e,Ur=t,zr=n,Oe=i,ei=s,An=o,ra(a),tn=u,r.f^=2097152}}function $g(r,e){let t=e.reactions;if(t!==null){var n=Kh.call(t,r);if(n!==-1){var i=t.length-1;i===0?t=e.reactions=null:(t[n]=t[i],t.pop())}}t===null&&(e.f&2)!==0&&(pr===null||!pr.includes(e))&&(ir(e,4096),(e.f&768)===0&&(e.f^=512),Wu(e),ca(e,0))}function ca(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)$g(r,t[n])}function Js(r){var e=r.f;if((e&16384)===0){ir(r,1024);var t=we,n=Ge,i=is;if(we=r,is=!0,re){var s=Br;na(r.component_function)}try{(e&16)!==0?Tp(r):xf(r),wf(r);var o=Ju(r);r.teardown=typeof o=="function"?o:null,r.wv=Pp;var a=r.deps;if(re&&Cn&&(r.f&2048)!==0&&a!==null)for(let l=0;l<a.length;l++){var u=a[l];u.trace_need_increase&&(u.wv=sa(),u.trace_need_increase=void 0,u.trace_v=void 0)}re&&Of.push(r)}catch(l){Zs(l,r,t,n||r.ctx)}finally{is=i,we=t,re&&na(s)}}}function Dp(){Of=[]}function Mg(){try{ip()}catch(r){if(re&&Yt(r,"stack",{value:""}),ha!==null)if(re)try{Zs(r,ha,null,null)}catch(e){throw Dp(),e}else Zs(r,ha,null,null);else throw re&&Dp(),r}}function Mf(){var r=is;try{var e=0;for(is=!0;pa.length>0;){e++>1e3&&Mg();var t=pa,n=t.length;pa=[];for(var i=0;i<n;i++){var s=Cg(t[i]);Og(s)}Ys.clear()}}finally{ma=!1,is=r,ha=null,re&&(Of=[])}}function Og(r){var e=r.length;if(e!==0)for(var t=0;t<e;t++){var n=r[t];if((n.f&24576)===0)try{Ci(n)&&(Js(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Sf(n):n.fn=null))}catch(i){Zs(i,n,null,n.ctx)}}}function Ks(r){ma||(ma=!0,queueMicrotask(Mf));for(var e=ha=r;e.parent!==null;){e=e.parent;var t=e.f;if((t&96)!==0){if((t&1024)===0)return;e.f^=1024}}pa.push(e)}function Cg(r){for(var e=[],t=r;t!==null;){var n=t.f,i=(n&96)!==0,s=i&&(n&1024)!==0;if(!s&&(n&8192)===0){if((n&4)!==0)e.push(t);else if(i)t.f^=1024;else try{Ci(t)&&Js(t)}catch(u){Zs(u,t,null,t.ctx)}var o=t.first;if(o!==null){t=o;continue}}var a=t.parent;for(t=t.next;t===null&&a!==null;)t=a.next,a=a.parent}return e}function eo(r){var e;for(r&&(ma=!0,Mf(),e=r()),Tf();pa.length>0;)ma=!0,Mf(),Tf();return e}async function to(){await Promise.resolve(),eo()}function h(r){var e=r.f,t=(e&2)!==0;if(ea!==null&&ea.add(r),Oe!==null&&!tn){if(!An?.includes(r)){var n=Oe.deps;r.rv<rl&&(r.rv=rl,pr===null&&n!==null&&n[Ur]===r?Ur++:pr===null?pr=[r]:(!ei||!pr.includes(r))&&pr.push(r))}}else if(t&&r.deps===null&&r.effects===null){var i=r,s=i.parent;s!==null&&(s.f&256)===0&&(i.f^=256)}if(t&&(i=r,Ci(i)&&pf(i)),re&&Cn&&Zo!==null&&Oe!==null&&Zo.reaction===Oe){if(r.debug)r.debug();else if(r.created){var o=Zo.entries.get(r);o===void 0&&(o={read:[]},Zo.entries.set(r,o)),o.read.push(Zn("TracedAt"))}}return ts&&Ys.has(r)?Ys.get(r):r.v}function rt(r){var e=tn;try{return tn=!0,r()}finally{tn=e}}var Ag=-7169;function ir(r,e){r.f=r.f&Ag|e}function il(r){if(!(typeof r!="object"||!r||r instanceof EventTarget)){if(cr in r)nl(r);else if(!Array.isArray(r))for(let e in r){let t=r[e];typeof t=="object"&&t&&cr in t&&nl(t)}}}function nl(r,e=new Set){if(typeof r=="object"&&r!==null&&!(r instanceof EventTarget)&&!e.has(r)){e.add(r),r instanceof Date&&r.getTime();for(let n in r)try{nl(r[n],e)}catch{}let t=Ti(r);if(t!==Object.prototype&&t!==Array.prototype&&t!==Map.prototype&&t!==Set.prototype&&t!==Date.prototype){let n=qu(t);for(let i in n){let s=n[i].get;if(s)try{s.call(r)}catch{}}}}}var Ig=/\r/g;function Lp(r){r=r.replace(Ig,"");let e=5381,t=r.length;for(;t--;)e=(e<<5)-e^r.charCodeAt(t);return(e>>>0).toString(36)}var Dg=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var c6=[...Dg,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var Rg=["touchstart","touchmove"];function Bp(r){return Rg.includes(r)}function sl(r){return r?.replace(/\//g,"/\u200B")}var Fp=new Map;function zp(r,e){var t=Fp.get(r);t||(t=new Set,Fp.set(r,t)),t.add(e)}var Vp=!1;function ol(){Vp||(Vp=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{if(!r.defaultPrevented)for(let e of r.target.elements)e.__on_r?.()})},{capture:!0}))}function ro(r){var e=Oe,t=we;ft(null),Ot(null);try{return r()}finally{ft(e),Ot(t)}}function Cf(r,e,t,n=t){r.addEventListener(e,()=>ro(t));let i=r.__on_r;i?r.__on_r=()=>{i(),n(!0)}:r.__on_r=()=>n(!0),ol()}var Af=new Set,al=new Set;function Hp(r,e,t,n={}){function i(s){if(n.capture||no.call(e,s),!s.cancelBubble)return ro(()=>t?.call(this,s))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?$r(()=>{e.addEventListener(r,i,n)}):e.addEventListener(r,i,n),i}function Bt(r,e,t,n,i){var s={capture:n,passive:i},o=Hp(r,e,t,s);(e===document.body||e===window||e===document)&&Er(()=>{e.removeEventListener(r,o,s)})}function Ye(r){for(var e=0;e<r.length;e++)Af.add(r[e]);for(var t of al)t(r)}function no(r){var e=this,t=e.ownerDocument,n=r.type,i=r.composedPath?.()||[],s=i[0]||r.target,o=0,a=r.__root;if(a){var u=i.indexOf(a);if(u!==-1&&(e===document||e===window)){r.__root=e;return}var l=i.indexOf(e);if(l===-1)return;u<=l&&(o=u)}if(s=i[o]||r.target,s!==e){Yt(r,"currentTarget",{configurable:!0,get(){return s||t}});var d=Oe,c=we;ft(null),Ot(null);try{for(var f,p=[];s!==null;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+n];if(g!=null&&(!s.disabled||r.target===s))if(Xr(g)){var[_,...v]=g;_.apply(s,[r,...v])}else g.call(s,r)}catch(k){f?p.push(k):f=k}if(r.cancelBubble||m===e||m===null)break;s=m}if(f){for(let k of p)queueMicrotask(()=>{throw k});throw f}}finally{r.__root=e,delete r.currentTarget,ft(d),Ot(c)}}}var Pg;function Gp(){Pg=void 0}function ga(r){var e=document.createElement("template");return e.innerHTML=r,e.content}function Mr(r,e){var t=we;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function G(r,e){var t=(e&1)!==0,n=(e&2)!==0,i,s=!r.startsWith("<!>");return()=>{if(de)return Mr(xe,null),xe;i===void 0&&(i=ga(s?r:"<!>"+r),t||(i=Tt(i)));var o=n||aa?document.importNode(i,!0):i.cloneNode(!0);if(t){var a=Tt(o),u=o.lastChild;Mr(a,u)}else Mr(o,o);return o}}function If(r=""){if(!de){var e=Tr(r+"");return Mr(e,e),e}var t=xe;return t.nodeType!==3&&(t.before(t=Tr()),lt(t)),Mr(t,t),t}function It(){if(de)return Mr(xe,null),xe;var r=document.createDocumentFragment(),e=document.createComment(""),t=Tr();return r.append(e,t),Mr(e,t),r}function V(r,e){if(de){we.nodes_end=xe,Et();return}r!==null&&r.before(e)}var ul=!0;function qe(r,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(r.__t??=r.nodeValue)&&(r.__t=t,r.nodeValue=t+"")}function In(r,e){return Up(r,e)}function Rf(r,e){Qu(),e.intro=e.intro??!1;let t=e.target,n=de,i=xe;try{for(var s=Tt(t);s&&(s.nodeType!==8||s.data!==$i);)s=Wt(s);if(!s)throw Xn;sr(!0),lt(s),Et();let o=Up(r,{...e,anchor:s});if(xe===null||xe.nodeType!==8||xe.data!==Xi)throw Xn;return sr(!1),o}catch(o){if(o===Xn)return e.recover===!1&&sp(),Qu(),ua(t),sr(!1),In(r,e);throw o}finally{sr(n),lt(i),Gp()}}var io=new Map;function Up(r,{target:e,anchor:t,props:n={},events:i,context:s,intro:o=!0}){Qu();var a=new Set,u=c=>{for(var f=0;f<c.length;f++){var p=c[f];if(!a.has(p)){a.add(p);var m=Bp(p);e.addEventListener(p,no,{passive:m});var g=io.get(p);g===void 0?(document.addEventListener(p,no,{passive:m}),io.set(p,1)):io.set(p,g+1)}}};u(Wo(Af)),al.add(u);var l=void 0,d=Ep(()=>{var c=t??e.appendChild(Tr());return Lt(()=>{if(s){ve({});var f=Ge;f.c=s}i&&(n.$$events=i),de&&Mr(c,null),ul=o,l=r(c,n)||{},ul=!0,de&&(we.nodes_end=xe),s&&be()}),()=>{for(var f of a){e.removeEventListener(f,no);var p=io.get(f);--p===0?(document.removeEventListener(f,no),io.delete(f)):io.set(f,p)}al.delete(u),c!==t&&c.parentNode?.removeChild(c)}});return Df.set(l,d),l}var Df=new WeakMap;function ni(r,e){let t=Df.get(r);return t?(Df.delete(r),t(e)):(re&&void 0,Promise.resolve())}function pe(r,e,[t,n]=[0,0]){de&&t===0&&Et();var i=r,s=null,o=null,a=yt,u=t>0?65536:0,l=!1;let d=(f,p=!0)=>{l=!0,c(p,f)},c=(f,p)=>{if(a===(a=f))return;let m=!1;if(de&&n!==-1){if(t===0){let _=i.data;_===$i?n=0:_===Mi?n=1/0:(n=parseInt(_.substring(1)),n!==n&&(n=a?1/0:-1))}let g=n>t;!!a===g&&(i=rs(),lt(i),sr(!1),m=!0,n=-1)}a?(s?Ai(s):p&&(s=Lt(()=>p(i))),o&&Gr(o,()=>{o=null})):(o?Ai(o):p&&(o=Lt(()=>p(i,[t+1,n]))),s&&Gr(s,()=>{s=null})),m&&sr(!0)};or(()=>{l=!1,e(d),l||c(null,null)},u),de&&(i=xe)}function so(r,e,t){de&&Et();var n=r,i=yt,s,o=hn()?Zh:Us;or(()=>{o(i,i=e())&&(s&&Gr(s),s=Lt(()=>t(n)))}),de&&(n=xe)}var _a=null;function st(r,e){return e}function Vg(r,e,t,n){for(var i=[],s=e.length,o=0;o<s;o++)Zu(e[o].e,i,!0);var a=s>0&&i.length===0&&t!==null;if(a){var u=t.parentNode;ua(u),u.append(t),n.clear(),Ii(r,e[0].prev,e[s-1].next)}Ef(i,()=>{for(var l=0;l<s;l++){var d=e[l];a||(n.delete(d.k),Ii(r,d.prev,d.next)),nr(d.e,!a)}})}function Xe(r,e,t,n,i,s=null){var o=r,a={flags:e,items:new Map,first:null},u=(e&4)!==0;if(u){var l=r;o=de?lt(Tt(l)):l.appendChild(Tr())}de&&Et();var d=null,c=!1,f=ia(()=>{var p=t();return Xr(p)?p:p==null?[]:Wo(p)});or(()=>{var p=h(f),m=p.length;if(c&&m===0)return;c=m===0;let g=!1;if(de){var _=o.data===Mi;_!==(m===0)&&(o=rs(),lt(o),sr(!1),g=!0)}if(de){for(var v=null,k,S=0;S<m;S++){if(xe.nodeType===8&&xe.data===Xi){o=xe,g=!0,sr(!1);break}var T=p[S],E=n(T,S);k=Yp(xe,a,v,null,T,E,S,i,e,t),a.items.set(E,k),v=k}m>0&<(rs())}de||Hg(p,a,o,i,e,n,t),s!==null&&(m===0?d?Ai(d):d=Lt(()=>s(o)):d!==null&&Gr(d,()=>{d=null})),g&&sr(!0),h(f)}),de&&(o=xe)}function Hg(r,e,t,n,i,s,o){var a=(i&8)!==0,u=(i&3)!==0,l=r.length,d=e.items,c=e.first,f=c,p,m=null,g,_=[],v=[],k,S,T,E;if(a)for(E=0;E<l;E+=1)k=r[E],S=s(k,E),T=d.get(S),T!==void 0&&(T.a?.measure(),(g??=new Set).add(T));for(E=0;E<l;E+=1){if(k=r[E],S=s(k,E),T=d.get(S),T===void 0){var y=f?f.e.nodes_start:t;m=Yp(y,e,m,m===null?e.first:m.next,k,S,E,n,i,o),d.set(S,m),_=[],v=[],f=m.next;continue}if(u&&Gg(T,k,E,i),(T.e.f&8192)!==0&&(Ai(T.e),a&&(T.a?.unfix(),(g??=new Set).delete(T))),T!==f){if(p!==void 0&&p.has(T)){if(_.length<v.length){var x=v[0],M;m=x.prev;var A=_[0],N=_[_.length-1];for(M=0;M<_.length;M+=1)qp(_[M],x,t);for(M=0;M<v.length;M+=1)p.delete(v[M]);Ii(e,A.prev,N.next),Ii(e,m,A),Ii(e,N,x),f=x,m=N,E-=1,_=[],v=[]}else p.delete(T),qp(T,f,t),Ii(e,T.prev,T.next),Ii(e,T,m===null?e.first:m.next),Ii(e,m,T),m=T;continue}for(_=[],v=[];f!==null&&f.k!==S;)(f.e.f&8192)===0&&(p??=new Set).add(f),v.push(f),f=f.next;if(f===null)continue;T=f}_.push(T),m=T,f=T.next}if(f!==null||p!==void 0){for(var R=p===void 0?[]:Wo(p);f!==null;)(f.e.f&8192)===0&&R.push(f),f=f.next;var D=R.length;if(D>0){var H=(i&4)!==0&&l===0?t:null;if(a){for(E=0;E<D;E+=1)R[E].a?.measure();for(E=0;E<D;E+=1)R[E].a?.fix()}Vg(e,R,H,d)}}a&&$r(()=>{if(g!==void 0)for(T of g)T.a?.apply()}),we.first=e.first&&e.first.e,we.last=m&&m.e}function Gg(r,e,t,n){(n&1)!==0&&Ws(r.v,e),(n&2)!==0?Ws(r.i,t):r.i=t}function Yp(r,e,t,n,i,s,o,a,u,l){var d=_a,c=(u&1)!==0,f=(u&16)===0,p=c?f?ri(i):Ct(i):i,m=(u&2)===0?o:Ct(o);re&&c&&(p.debug=()=>{var _=typeof m=="number"?o:m.v;l()[_]});var g={i:m,v:p,k:s,a:null,e:null,prev:t,next:n};_a=g;try{return g.e=Lt(()=>a(r,p,m,l),de),g.e.prev=t&&t.e,g.e.next=n&&n.e,t===null?e.first=g:(t.next=g,t.e.next=g.e),n!==null&&(n.prev=g,n.e.prev=g.e),g}finally{_a=d}}function qp(r,e,t){for(var n=r.next?r.next.e.nodes_start:t,i=e?e.e.nodes_start:t,s=r.e.nodes_start;s!==n;){var o=Wt(s);i.before(s),s=o}}function Ii(r,e,t){e===null?r.first=t:(e.next=t,e.e.next=t&&t.e),t!==null&&(t.prev=e,t.e.prev=e&&e.e)}function Ug(r,e,t){if(!e||e===Lp(String(t??"")))return;let n,i=r.__svelte_meta?.loc;i?n=`near ${i.file}:${i.line}:${i.column}`:Br?.[Lr]&&(n=`in ${Br[Lr]}`),sl(n)}function Dn(r,e,t=!1,n=!1,i=!1){var s=r,o="";fe(()=>{var a=we;if(o===(o=e()??"")){de&&Et();return}if(a.nodes_start!==null&&(kf(a.nodes_start,a.nodes_end),a.nodes_start=a.nodes_end=null),o!==""){if(de){for(var u=xe.data,l=Et(),d=l;l!==null&&(l.nodeType!==8||l.data!=="");)d=l,l=Wt(l);if(l===null)throw Xn;re&&!i&&Ug(l.parentNode,u,o),Mr(xe,d),s=lt(l);return}var c=o+"";t?c=`<svg>${c}</svg>`:n&&(c=`<math>${c}</math>`);var f=ga(c);if((t||n)&&(f=Tt(f)),Mr(Tt(f),f.lastChild),t||n)for(;Tt(f);)s.before(Tt(f));else s.before(f)}})}function Or(r,e,...t){var n=r,i=St,s;or(()=>{i!==(i=e())&&(s&&(nr(s),s=null),re&&i==null&&op(),s=Lt(()=>i(n,...t)))},65536),de&&(n=xe)}function Lf(r,e,t){de&&Et();var n=r,i,s;or(()=>{i!==(i=e())&&(s&&(Gr(s),s=null),i&&(s=Lt(()=>t(n,i))))},65536),de&&(n=xe)}function ii(r,e){$r(()=>{var t=r.getRootNode(),n=t.host?t:t.head??t.ownerDocument.head;if(!n.querySelector("#"+e.hash)){let i=document.createElement("style");i.id=e.hash,i.textContent=e.code,n.appendChild(i),re&&zp(e.hash,i)}})}function ll(r,e,t){tr(()=>{var n=rt(()=>e(r,t?.())||{});if(t&&n?.update){var i=!1,s={};hr(()=>{var o=t();il(o),i&&Us(s,o)&&(s=o,n.update(o))}),i=!0}if(n?.destroy)return()=>n.destroy()})}function Wp(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var i=r.length;for(e=0;e<i;e++)r[e]&&(t=Wp(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function Jp(){for(var r,e,t=0,n="",i=arguments.length;t<i;t++)(r=arguments[t])&&(e=Wp(r))&&(n&&(n+=" "),n+=e);return n}function Jt(r){return typeof r=="object"?Jp(r):r??""}var Kp=[...`
|
|
\r\f\xA0\v\uFEFF`];function Xp(r,e,t){var n=r==null?"":""+r;if(e&&(n=n?n+" "+e:e),t){for(var i in t)if(t[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,o=0;(o=n.indexOf(i,o))>=0;){var a=o+s;(o===0||Kp.includes(n[o-1]))&&(a===n.length||Kp.includes(n[a]))?n=(o===0?"":n.substring(0,o))+n.substring(a+1):o=a}}return n===""?null:n}function Qp(r,e=!1){var t=e?" !important;":";",n="";for(var i in r){var s=r[i];s!=null&&s!==""&&(n+=" "+i+": "+s+t)}return n}function Bf(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Zp(r,e){if(e){var t="",n,i;if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,u=[];n&&u.push(...Object.keys(n).map(Bf)),i&&u.push(...Object.keys(i).map(Bf));var l=0,d=-1;let g=r.length;for(var c=0;c<g;c++){var f=r[c];if(a?f==="/"&&r[c-1]==="*"&&(a=!1):s?s===f&&(s=!1):f==="/"&&r[c+1]==="*"?a=!0:f==='"'||f==="'"?s=f:f==="("?o++:f===")"&&o--,!a&&s===!1&&o===0){if(f===":"&&d===-1)d=c;else if(f===";"||c===g-1){if(d!==-1){var p=Bf(r.substring(l,d).trim());if(!u.includes(p)){f!==";"&&c++;var m=r.substring(l,c).trim();t+=" "+m+";"}}l=c+1,d=-1}}}}return n&&(t+=Qp(n)),i&&(t+=Qp(i,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function ke(r,e,t,n,i,s){var o=r.__className;if(de||o!==t||o===void 0){var a=Xp(t,n,s);(!de||a!==r.getAttribute("class"))&&(a==null?r.removeAttribute("class"):e?r.className=a:r.setAttribute("class",a)),r.__className=t}else if(s&&i!==s)for(var u in s){var l=!!s[u];(i==null||l!==!!i[u])&&r.classList.toggle(u,l)}return s}function Ff(r,e={},t,n){for(var i in t){var s=t[i];e[i]!==s&&(t[i]==null?r.style.removeProperty(i):r.style.setProperty(i,s,n))}}function rn(r,e,t,n){var i=r.__style;if(de||i!==e){var s=Zp(e,n);(!de||s!==r.getAttribute("style"))&&(s==null?r.removeAttribute("style"):r.style.cssText=s),r.__style=e}else n&&(Array.isArray(n)?(Ff(r,t?.[0],n[0]),Ff(r,t?.[1],n[1],"important")):Ff(r,t,n));return n}var Jg=Symbol("class"),Kg=Symbol("style"),Qg=Symbol("is custom element"),Xg=Symbol("is html");function si(r){if(de){var e=!1,t=()=>{if(!e){if(e=!0,r.hasAttribute("value")){var n=r.value;Re(r,"value",null),r.value=n}if(r.hasAttribute("checked")){var i=r.checked;Re(r,"checked",null),r.checked=i}}};r.__on_r=t,Cp(t),ol()}}function Di(r,e){var t=rm(r);t.value===(t.value=e??void 0)||r.value===e&&(e!==0||r.nodeName!=="PROGRESS")||(r.value=e??"")}function Re(r,e,t,n){var i=rm(r);if(de&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName==="LINK")){n||e_(r,e,t??"");return}i[e]!==(i[e]=t)&&(e==="loading"&&(r[Xh]=t),t==null?r.removeAttribute(e):typeof t!="string"&&Zg(r).includes(e)?r[e]=t:r.setAttribute(e,t))}function rm(r){return r.__attributes??={[Qg]:r.nodeName.includes("-"),[Xg]:r.namespaceURI===hp}}var em=new Map;function Zg(r){var e=em.get(r.nodeName);if(e)return e;em.set(r.nodeName,e=[]);for(var t,n=r,i=Element.prototype;i!==n;){t=qu(n);for(var s in t)t[s].set&&e.push(s);n=Ti(n)}return e}function e_(r,e,t){re&&(e==="srcset"&&t_(r,t)||zf(r.getAttribute(e)??"",t)||(r.outerHTML.replace(r.innerHTML,r.innerHTML&&"..."),String(t),void 0))}function zf(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function tm(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function t_(r,e){var t=tm(r.srcset),n=tm(e);return n.length===t.length&&n.every(([i,s],o)=>s===t[o][1]&&(zf(t[o][0],i)||zf(i,t[o][0])))}var r_=Uu?()=>performance.now():()=>Date.now(),gn={tick:r=>(Uu?requestAnimationFrame:St)(r),now:()=>r_(),tasks:new Set};function nm(){let r=gn.now();gn.tasks.forEach(e=>{e.c(r)||(gn.tasks.delete(e),e.f())}),gn.tasks.size!==0&&gn.tick(nm)}function im(r){let e;return gn.tasks.size===0&&gn.tick(nm),{promise:new Promise(t=>{gn.tasks.add(e={c:r,f:t})}),abort(){gn.tasks.delete(e)}}}function cl(r,e){ro(()=>{r.dispatchEvent(new CustomEvent(e))})}function o_(r){if(r==="float")return"cssFloat";if(r==="offset")return"cssOffset";if(r.startsWith("--"))return r;let e=r.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function sm(r){let e={},t=r.split(";");for(let n of t){let[i,s]=n.split(":");if(!i||s===void 0)break;let o=o_(i.trim());e[o]=s.trim()}return e}var a_=r=>r;function Kt(r,e,t,n){var i=(r&1)!==0,s=(r&2)!==0,o=i&&s,a=(r&4)!==0,u=o?"both":i?"in":"out",l,d=e.inert,c=e.style.overflow,f,p;function m(){var S=Oe,T=we;ft(null),Ot(null);try{return l??=t()(e,n?.()??{},{direction:u})}finally{ft(S),Ot(T)}}var g={is_global:a,in(){if(e.inert=d,!i){p?.abort(),p?.reset?.();return}s||f?.abort(),cl(e,"introstart"),f=Vf(e,m(),p,1,()=>{cl(e,"introend"),f?.abort(),f=l=void 0,e.style.overflow=c})},out(S){if(!s){S?.(),l=void 0;return}e.inert=!0,cl(e,"outrostart"),p=Vf(e,m(),f,0,()=>{cl(e,"outroend"),S?.()})},stop:()=>{f?.abort(),p?.abort()}},_=we;if((_.transitions??=[]).push(g),i&&ul){var v=a;if(!v){for(var k=_.parent;k&&(k.f&65536)!==0;)for(;(k=k.parent)&&(k.f&16)===0;);v=!k||(k.f&32768)!==0}v&&tr(()=>{rt(()=>g.in())})}}function Vf(r,e,t,n,i){var s=n===1;if(of(e)){var o,a=!1;return $r(()=>{if(!a){var _=e({direction:s?"in":"out"});o=Vf(r,_,t,n,i)}}),{abort:()=>{a=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(t?.deactivate(),!e?.duration)return i(),{abort:St,deactivate:St,reset:St,t:()=>n};let{delay:u=0,css:l,tick:d,easing:c=a_}=e;var f=[];if(s&&t===void 0&&(d&&d(0,1),l)){var p=sm(l(0,1));f.push(p,p)}var m=()=>1-n,g=r.animate(f,{duration:u});return g.onfinish=()=>{var _=t?.t()??1-n;t?.abort();var v=n-_,k=e.duration*Math.abs(v),S=[];if(k>0){var T=!1;if(l)for(var E=Math.ceil(k/16.666666666666668),y=0;y<=E;y+=1){var x=_+v*c(y/E),M=sm(l(x,1-x));S.push(M),T||=M.overflow==="hidden"}T&&(r.style.overflow="hidden"),m=()=>{var A=g.currentTime;return _+v*c(A/k)},d&&im(()=>{if(g.playState!=="running")return!1;var A=m();return d(A,1-A),!0})}g=r.animate(S,{duration:k,fill:"forwards"}),g.onfinish=()=>{m=()=>n,d?.(n,1-n),i()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=St)},deactivate:()=>{i=St},reset:()=>{n===0&&d?.(1,0)},t:()=>m()}}function Uf(r,e,t=e){var n=hn();Cf(r,"input",i=>{re&&r.type==="checkbox"&&af();var s=i?r.defaultValue:r.value;if(s=Hf(r)?Gf(s):s,t(s),n&&s!==(s=e())){var o=r.selectionStart,a=r.selectionEnd;r.value=s??"",a!==null&&(r.selectionStart=o,r.selectionEnd=Math.min(a,r.value.length))}}),(de&&r.defaultValue!==r.value||rt(e)==null&&r.value)&&t(Hf(r)?Gf(r.value):r.value),hr(()=>{re&&r.type==="checkbox"&&af();var i=e();Hf(r)&&i===Gf(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i??"")})}function Hf(r){var e=r.type;return e==="number"||e==="range"}function Gf(r){return r===""?null:+r}function va(r,e,t){if(r.multiple)return u_(r,e);for(var n of r.options){var i=om(n);if(lf(i,e)){n.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function qf(r,e){let t=!0;tr(()=>{e&&va(r,rt(e),t),t=!1;var n=new MutationObserver(()=>{var i=r.__value;va(r,i)});return n.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{n.disconnect()}})}function u_(r,e){for(var t of r.options)t.selected=~e.indexOf(om(t))}function om(r){return"__value"in r?r.__value:r.value}var jf=class r{#e=new WeakMap;#t;#r;static entries=new WeakMap;constructor(e){this.#r=e}observe(e,t){var n=this.#e.get(e)||new Set;return n.add(t),this.#e.set(e,n),this.#n().observe(e,this.#r),()=>{var i=this.#e.get(e);i.delete(t),i.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#n(){return this.#t??(this.#t=new ResizeObserver(e=>{for(var t of e){r.entries.set(t.target,t);for(var n of this.#e.get(t.target)||[])n(t)}}))}};var l_=new jf({box:"border-box"});function dl(r,e,t){var n=l_.observe(r,()=>t(r[e]));tr(()=>(rt(()=>t(r[e])),n))}function am(r,e){return r===e||r?.[cr]===e}function _n(r={},e,t,n){return tr(()=>{var i,s;return hr(()=>{i=s,s=n?.()||[],rt(()=>{r!==t(...s)&&(e(r,...s),i&&am(t(...i),r)&&e(null,...i))})}),()=>{$r(()=>{s&&am(t(...s),r)&&e(null,...s)})}}),r}var hl=!1,PO=Symbol();function Wf(r){var e=hl;try{return hl=!1,[r(),hl]}finally{hl=e}}function lm(r){return r.ctx?.d??!1}function B(r,e,t,n){var i=(t&1)!==0,s=!Qn||(t&2)!==0,o=(t&8)!==0,a=(t&16)!==0,u=!1,l;o?[l,u]=Wf(()=>r[e]):l=r[e];var d=cr in r||Ko in r,c=o&&(Zr(r,e)?.set??(d&&e in r&&(x=>r[e]=x)))||void 0,f=n,p=!0,m=!1,g=()=>(m=!0,p&&(p=!1,a?f=rt(n):f=n),f);l===void 0&&n!==void 0&&(c&&s&&ap(e),l=g(),c&&c(l));var _;if(s)_=()=>{var x=r[e];return x===void 0?g():(p=!0,m=!1,x)};else{var v=(i?Oi:ia)(()=>r[e]);v.f|=131072,_=()=>{var x=h(v);return x!==void 0&&(f=void 0),x===void 0?f:x}}if((t&4)===0)return _;if(c){var k=r.$$legacy;return function(x,M){return arguments.length>0?((!s||!M||k||u)&&c(M?_():x),x):_()}}var S=!1,T=!1,E=ri(l),y=Oi(()=>{var x=_(),M=h(E);return S?(S=!1,T=!0,M):(T=!1,E.v=x)});return o&&h(y),i||(y.equals=qs),function(x,M){if(ea!==null&&(S=T,_(),h(E)),arguments.length>0){let A=M?h(y):s&&o?De(x):x;if(!y.equals(A)){if(S=!0,P(E,A),m&&f!==void 0&&(f=A),lm(y))return x;rt(()=>h(y))}return x}return lm(y)?y.v:h(y)}}function cm(r){return new Jf(r)}var Jf=class{#e;#t;constructor(e){var t=new Map,n=(s,o)=>{var a=ri(o);return t.set(s,a),a};let i=new Proxy({...e.props||{},$$events:{}},{get(s,o){return h(t.get(o)??n(o,Reflect.get(s,o)))},has(s,o){return o===Ko?!0:(h(t.get(o)??n(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return P(t.get(o)??n(o,a),a),Reflect.set(s,o,a)}});this.#t=(e.hydrate?Rf:In)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&eo(),this.#e=i.$$events;for(let s of Object.keys(this.#t))s==="$set"||s==="$destroy"||s==="$on"||Yt(this,s,{get(){return this.#t[s]},set(o){this.#t[s]=o},enumerable:!0});this.#t.$set=s=>{Object.assign(i,s)},this.#t.$destroy=()=>{ni(this.#t)}}$set(e){this.#t.$set(e)}$on(e,t){this.#e[e]=this.#e[e]||[];let n=(...i)=>t.call(this,...i);return this.#e[e].push(n),()=>{this.#e[e]=this.#e[e].filter(i=>i!==n)}}$destroy(){this.#t.$destroy()}};var x_;typeof HTMLElement=="function"&&(x_=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(r,e,t){super(),this.$$ctor=r,this.$$s=e,t&&this.attachShadow({mode:"open"})}addEventListener(r,e,t){if(this.$$l[r]=this.$$l[r]||[],this.$$l[r].push(e),this.$$c){let n=this.$$c.$on(r,e);this.$$l_u.set(e,n)}super.addEventListener(r,e,t)}removeEventListener(r,e,t){if(super.removeEventListener(r,e,t),this.$$c){let n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let r=function(n){return i=>{let s=document.createElement("slot");n!=="default"&&(s.name=n),V(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},t=k_(this);for(let n of this.$$s)n in t&&(n==="default"&&!this.$$d.children?(this.$$d.children=r(n),e.default=!0):e[n]=r(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Kf(i,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=cm({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=yf(()=>{hr(()=>{this.$$r=!0;for(let n of nf(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=Kf(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(let n in this.$$l)for(let i of this.$$l[n]){let s=this.$$c.$on(n,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(r,e,t){this.$$r||(r=this.$$g_p(r),this.$$d[r]=Kf(r,t,this.$$p_d,"toProp"),this.$$c?.$set({[r]:this.$$d[r]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(r){return nf(this.$$p_d).find(e=>this.$$p_d[e].attribute===r||!this.$$p_d[e].attribute&&e.toLowerCase()===r)||r}});function Kf(r,e,t,n){let i=t[r]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[r])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function k_(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}if(re){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;up(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function oi(r){Ge===null&&ta("onMount"),Qn&&Ge.l!==null?E_(Ge).m.push(r):$t(()=>{let e=rt(r);if(typeof e=="function")return e})}function fm(r){Ge===null&&ta("onDestroy"),oi(()=>()=>rt(r))}function E_(r){var e=r.l;return e.u??={a:[],b:[],m:[]}}var dm="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(dm);var T_=G("<div> </div>"),$_=G("<button><!> <!></button>");function mr(r,e){let t=B(e,"text",3,""),n=B(e,"icon",3,""),i=B(e,"tooltip",3,""),s=B(e,"size",3,null),o=B(e,"onClick",3,()=>{}),a=B(e,"class",3,"");var u=$_();let l;u.__click=function(...m){o()?.apply(this,m)};var d=K(u);{var c=m=>{var g=T_(),_=K(g,!0);q(g),fe(()=>qe(_,t())),V(m,g)};pe(d,m=>{t()&&m(c)})}var f=F(d,2);{var p=m=>{ar(m,{get icon(){return n()},get size(){return s()}})};pe(f,m=>{n()&&m(p)})}q(u),fe(m=>{l=ke(u,1,Jt(a()),null,l,m),Re(u,"aria-label",i())},[()=>({"svelcomlib-icon-text":n()})]),V(r,u)}Ye(["click"]);var M_=(r,e)=>e()(r.target.value,r.target),O_=G("<option> </option>"),C_=G("<select></select>");function vn(r,e){ve(e,!0);let t=B(e,"onChange",3,()=>{}),n=B(e,"options",19,()=>[]),i=B(e,"value",3,""),s=B(e,"disabled",3,!1),o=B(e,"class",3,"");var a=C_();a.__change=[M_,t],qf(a,i);var u;Xe(a,21,n,st,(l,d,c,f)=>{let p=()=>h(d).value,m=()=>h(d).text;var g=O_(),_={},v=K(g,!0);q(g),fe(()=>{_!==(_=p())&&(g.value=(g.__value=p())??""),qe(v,m())}),V(l,g)}),q(a),fe(()=>{ke(a,1,Jt(o()?o()+" dropdown":"dropdown")),a.disabled=s(),u!==(u=i())&&(a.value=(a.__value=i())??"",va(a,i()))}),V(r,a),be()}Ye(["change"]);var hm=require("obsidian");function ar(r,e){ve(e,!0);let t=B(e,"icon",3,""),n=B(e,"size",3,null),i=B(e,"stroke_width",3,null),s=B(e,"class",3,""),o=ae(null);$t(()=>{t().startsWith("<svg")?P(o,new DOMParser().parseFromString(t(),"text/html").body.childNodes[0],!0):P(o,(0,hm.getIcon)(t()),!0),s()&&h(o).classList.add(...s().split(" "))}),$t(()=>{h(o)&&n()&&(typeof n()=="number"?(h(o).style.width=n()+"px",h(o).style.height=n()+"px"):Array.isArray(n())?(h(o).style.width=n()[0]+"px",h(o).style.height=n()[1]+"px"):(h(o).style.width=`var(--${n()})`,h(o).style.height=`var(--${n()})`))}),$t(()=>{h(o)&&i()&&(h(o).style.strokeWidth=i()+"px")});var a=It(),u=Te(a);Dn(u,()=>h(o)?.outerHTML??""),V(r,a),be()}var A_=(r,e)=>e()(r.target.value),I_=G("<input>");function ss(r,e){ve(e,!0);let t=B(e,"type",3,"text"),n=B(e,"value",3,""),i=B(e,"placeholder",3,""),s=B(e,"onChange",3,()=>{}),o=B(e,"valid",3,!1),a=B(e,"readonly",3,!1),u=B(e,"class",3,"");var l=I_();si(l),l.__input=[A_,s];let d;fe(c=>{Re(l,"type",t()),Di(l,n()),Re(l,"placeholder",i()),l.readOnly=a(),d=ke(l,1,Jt(u()),null,d,c)},[()=>({"svelcomlib-input-success":o(),"svelcomlib-input-fail":o()===!1})]),V(r,l),be()}Ye(["input"]);var D_=(r,e,t)=>{e()(t())},R_=G('<input type="range" class="slider" data-tooltip-position="top">');function os(r,e){ve(e,!0);let t=B(e,"min",3,0),n=B(e,"max",3,100),i=B(e,"step",3,1),s=B(e,"value",7,0),o=B(e,"onChange",3,()=>{}),a=B(e,"getTooltip",3,l=>l.toString());var u=R_();si(u),u.__input=()=>{let l=activeDocument.body.lastChild;l.classList.contains("tooltip")&&(l.firstChild.textContent=a()(s()),l.style.width="auto")},u.__change=[D_,o,s],fe(l=>{Re(u,"min",t()),Re(u,"max",n()),Re(u,"step",i()),Re(u,"aria-label",l)},[()=>a()(s())]),Uf(u,s),V(r,u),be()}Ye(["input","change"]);var _I=G("<textarea></textarea>");Ye(["change","contextmenu"]);var P_=(r,e,t,n)=>{e()||t()(!n()),n(!n())},N_=G('<div><input type="checkbox" tabindex="0"></div>');function Ce(r,e){ve(e,!0);let t=B(e,"value",7,!1),n=B(e,"onChange",3,()=>{}),i=B(e,"disabled",3,!1);var s=N_();let o;s.__click=[P_,i,n,t];var a=K(s);q(s),fe(u=>{o=ke(s,1,"checkbox-container",null,o,u),a.disabled=i()},[()=>({"is-enabled":t()})]),V(r,s),be()}Ye(["click"]);var kI=G('<span class="setting-hotkey-icon" style="display: flex"><!></span>'),SI=G('<span class="setting-hotkey svelcomlib-icon-text"> <!></span>'),EI=G('<div class="setting-command-hotkeys"></div>');Ye(["click"]);var MI=G('<div class="svelcomlib-spinner"></div>');var L_=(r,e,t,n)=>{e((e()+1)%t().length),n()()},B_=G("<div><!> <!></div>");function Ri(r,e){ve(e,!0);let t=B(e,"states",19,()=>[]),n=B(e,"value",15,0),i=B(e,"size",3,null),s=B(e,"onClick",3,()=>{}),o=B(e,"onContextMenu",3,()=>{}),a=B(e,"class",3,"");var u=B_();u.__click=[L_,n,t,s],u.__contextmenu=function(...p){o()?.apply(this,p)};var l=K(u);{var d=p=>{ar(p,{get icon(){return t()[n()].icon},get size(){return i()}})};pe(l,p=>{t()[n()].icon&&p(d)})}var c=F(l,2);{var f=p=>{var m=If();fe(()=>qe(m,t()[n()].text)),V(p,m)};pe(c,p=>{t()[n()].text&&p(f)})}q(u),fe(()=>{ke(u,1,a()+" svelcomlib-icon-text"),Re(u,"aria-label",t()[n()].tooltip)}),V(r,u),be()}Ye(["click","contextmenu"]);var PI=G("<button><div> </div> <!></button>");Ye(["click"]);var FI=G("<div><!> <input></div>");Ye(["input"]);var F_=G('<div class="svelcomlib-virtual-list-row"><!></div>'),z_=G('<div class="svelcomlib-virtual-list-viewport"><div class="svelcomlib-virtual-list-contents"></div></div>'),V_={hash:"svelte-3kpd",code:""};function ba(r,e){ve(e,!0),ii(r,V_);let t=B(e,"height",3,"100%"),n=B(e,"itemHeight",3,void 0),i=B(e,"start",7,0),s=B(e,"end",7,0),o=De([]),a=ae(De([])),u=ae(void 0),l=ae(void 0),d=ae(0),c=ae(void 0),f=ae(0),p=ae(0),m=ae(0),g=ae(0),_=ne(()=>e.items.slice(i(),s()).map((y,x)=>({index:x+i(),data:y})));$t(()=>{h(c)&&v(e.items,h(d),n())});async function v(y,x,M){y.length<i()&&await S(y.length-1,{behavior:"auto"});let{scrollTop:N}=h(u);await to();let R=h(f)-N,D=i();for(;R<x&&D<y.length;){let j=h(a)[D-i()];j||(s(D+1),await to(),j=h(a)[D-i()]);let ee=o[D]=M||j.offsetHeight;R+=ee,D+=1}s(D);let H=y.length-s();P(m,(h(f)+R)/s()),P(p,H*h(m)),o.length=y.length}async function k(){let{scrollTop:y}=h(u);P(g,y,!0);for(let N=0;N<h(a).length;N+=1)o[i()+N]=n()||h(a)[N].offsetHeight;let x=0,M=0;for(;x<e.items.length;){let N=o[x]||h(m);if(M+N>y){i(x),P(f,M,!0);break}M+=N,x+=1}for(;x<e.items.length&&(M+=o[x]||h(m),x+=1,!(M>y+h(d))););s(x);let A=e.items.length-s();for(P(m,M/s());x<e.items.length;)o[x++]=h(m);P(p,A*h(m))}async function S(y,x){let{scrollTop:M}=h(u),A=y-i(),N=n()||h(m),R=A*N;x={left:0,top:M+R,behavior:"smooth",...x},h(u).scrollTo(x)}oi(()=>{P(a,h(l).getElementsByClassName("svelcomlib-virtual-list-row"),!0),P(c,!0)});var T=z_(),E=K(T);return Xe(E,21,()=>h(_),y=>y.index,(y,x)=>{var M=F_(),A=K(M);Or(A,()=>e.item,()=>h(x).data,()=>h(x).index),q(M),V(y,M)}),q(E),_n(E,y=>P(l,y),()=>h(l)),q(T),_n(T,y=>P(u,y),()=>h(u)),fe(()=>{rn(T,`height: ${t()??""};`),rn(E,`padding-top: ${h(f)??""}px; padding-bottom: ${h(p)??""}px; --scroll-offset: ${h(g)??""}px`)}),Bt("scroll",T,k),dl(T,"offsetHeight",y=>P(d,y)),V(r,T),be({scrollToIndex:S})}var pl=require("obsidian"),j_=G("<div></div>");function as(r,e){ve(e,!0);let t=B(e,"source",3,""),n=B(e,"class",3,""),i=ae(void 0);oi(async()=>{let o=new pl.Component;await pl.MarkdownRenderer.render(e.plugin.app,e.text,h(i),t(),o),o.load()});var s=j_();_n(s,o=>P(i,o),()=>h(i)),fe(()=>ke(s,1,Jt(n()))),V(r,s),be()}var Y_=G("<span>Empty navheader</span>"),W_=G('<div class="nav-header"><div class="nav-buttons-container"><!></div></div>');function ya(r,e){"use strict";var t=W_(),n=K(t),i=K(n);{var s=a=>{var u=It(),l=Te(u);Or(l,()=>e.container),V(a,u)},o=a=>{var u=Y_();V(a,u)};pe(i,a=>{e.container?a(s):a(o,!1)})}q(n),q(t),V(r,t)}var J_=G("<br>"),K_=G("<!> <span><!></span>",1),Q_=G('<div><div class="setting-item-info"><div class="setting-item-name"><div><!></div></div> <div class="setting-item-description"><!> <!></div></div> <div class="setting-item-control"><!></div></div> <!>',1);function le(r,e){ve(e,!0);let t=B(e,"description",3,null),n=B(e,"type",3,null),i=B(e,"depth",3,0),s=B(e,"notices",19,()=>[]),o=B(e,"class",3,""),a=ne(()=>{let x="";return i()&&(x+=" svelcomlib-"+"sub".repeat(i())+"setting"),n()==="heading"&&(x+=" svelcomlib-setting-"+"sub".repeat(i())+"heading"),x});var u=Q_(),l=Te(u);let d;var c=K(l),f=K(c),p=K(f),m=K(p);Dn(m,()=>e.name),q(p),q(f);var g=F(f,2),_=K(g);Dn(_,t);var v=F(_,2);Xe(v,17,s,st,(x,M,A)=>{var N=It(),R=Te(N);{var D=H=>{var j=K_(),ee=Te(j);{var ie=Ae=>{var Be=J_();V(Ae,Be)};pe(ee,Ae=>{(t()||A!==0)&&Ae(ie)})}var Me=F(ee,2);let Se;var ge=K(Me);Dn(ge,()=>h(M).text),q(Me),fe(Ae=>Se=ke(Me,1,"svelcomlib-notice "+(h(M).style??""),null,Se,Ae),[()=>({"svelcomlib-notice-info":h(M).type==="info","svelcomlib-notice-warning":h(M).type==="warning","svelcomlib-notice-error":h(M).type==="error"})]),V(H,j)};pe(R,H=>{h(M)&&H(D)})}V(x,N)}),q(g),q(c);var k=F(c,2),S=K(k);{var T=x=>{var M=It(),A=Te(M);Or(A,()=>e.control),V(x,M)};pe(S,x=>{e.control&&x(T)})}q(k),q(l);var E=F(l,2);{var y=x=>{var M=It(),A=Te(M);Or(A,()=>e.subcontrol),V(x,M)};pe(E,x=>{e.subcontrol&&x(y)})}fe(x=>d=ke(l,1,(o()??"")+" setting-item"+h(a),null,d,x),[()=>({"mod-dropdown":n()==="dropdown","mod-toggle":n()==="toggle","mod-slider":n()==="slider","setting-item-heading":n()==="heading"})]),V(r,u),be()}var X_=G("<!> <!>",1);function wa(r,e){"use strict";let t=B(e,"class",3,"");var n=X_(),i=Te(n);{var s=u=>{var l=It(),d=Te(l);Or(d,()=>e.header,t),V(u,l)};pe(i,u=>{e.header&&u(s)})}var o=F(i,2);{var a=u=>{var l=It(),d=Te(l);Or(d,()=>e.view,t),V(u,l)};pe(o,u=>{e.view&&u(a)})}V(r,n)}var ev=G("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);function ml(r,e){ve(e,!0);let t=B(e,"plugin",7),n={addition:{icon:"plus-circle",tooltip:"Additions"},deletion:{icon:"minus-square",tooltip:"Deletions"},substitution:{icon:"replace",tooltip:"Substitutions"},highlight:{icon:"highlighter",tooltip:"Highlights"},comment:{icon:"message-square",tooltip:"Comments"}},i={"":{icon:"star",tooltip:"Regular"},...n},s=[{value:"unchanged",text:"Regular movement"},{value:"ignore_bracket",text:"Skip brackets"},{value:"ignore_metadata",text:"Skip brackets and metadata"},{value:"ignore_completely",text:"Skip completely"}],o=[{value:"unchanged",text:"Regular movement"},{value:"stay_inside",text:"Keep cursor within range"},{value:"stay_outside",text:"Treat range as word group"}];var a=ev(),u=Te(a);le(u,{name:"Functionality",type:"heading"});var l=F(u,2);le(l,{name:"Suggestion mode",type:"heading",depth:1});var d=F(l,2);le(d,{name:"Cursor movement",type:"heading",depth:2});var c=F(d,2);Xe(c,17,()=>Object.keys(n),st,(k,S)=>{le(k,{get name(){return n[h(S)].tooltip},type:"dropdown",depth:2,control:E=>{vn(E,{get value(){return t().settings.suggestion_mode_operations.cursor_movement[h(S)]},options:s,onChange:y=>{t().settings.suggestion_mode_operations.cursor_movement[h(S)]=y,t().saveSettings()}})},$$slots:{control:!0}})});var f=F(c,2);le(f,{name:"Bracket movement",type:"heading",depth:2});var p=F(f,2);Xe(p,17,()=>Object.keys(n),st,(k,S)=>{le(k,{get name(){return n[h(S)].tooltip},type:"dropdown",depth:2,control:E=>{vn(E,{get value(){return t().settings.suggestion_mode_operations.bracket_movement[h(S)]},options:o,onChange:y=>{t().settings.suggestion_mode_operations.bracket_movement[h(S)]=y,t().saveSettings()}})},$$slots:{control:!0}})});var m=F(p,2);le(m,{name:"Suggestion mode cursor movement",description:"Determine how the cursor should move through suggestions in suggestion mode",type:"dropdown"});var g=F(m,2);le(g,{name:"Rendering",type:"heading"});var _=F(g,2);le(_,{name:"Live Preview renderer",description:"Enable custom rendering of CriticMarkup syntax in Live Preview",type:"toggle",control:S=>{Ce(S,{get value(){return t().settings.live_preview},onChange:()=>{t().settings.live_preview=!t().settings.live_preview,t().saveSettings()}})},$$slots:{control:!0}});var v=F(_,2);le(v,{name:"Reading View renderer",description:"Enable custom rendering of CriticMarkup syntax in Reading View",type:"toggle",control:S=>{Ce(S,{get value(){return t().settings.post_processor},onChange:()=>{t().settings.post_processor=!t().settings.post_processor,t().saveSettings()}})},$$slots:{control:!0}}),V(r,a),be()}var tv=G("<!> <!> <!> <!> <!> <!> <!>",1);function gl(r,e){ve(e,!0);let t=B(e,"plugin",7),n=ae(De(t().settings.comment_style)),i={inline:"Comments receive a background color and are fully visible (similar to suggestions)",icon:"Comments are displayed as icons and can be hovered over to reveal the comment",none:"Comments are not rendered in the editor, use this with the annotation gutter"};var s=tv(),o=Te(s);le(o,{name:"Editing features",type:"heading"});var a=F(o,2);le(a,{name:"Automatic tag completion",notices:[{type:"info",text:"When typing <code>{++</code>, the tag automatically gets completed with <code>++}</code>"}],type:"toggle",control:g=>{Ce(g,{get value(){return t().settings.tag_completion},onChange:()=>{t().settings.tag_completion=!t().settings.tag_completion,t().saveSettings()}})},$$slots:{control:!0}});var u=F(a,2);le(u,{name:"Remove syntax on copy",description:"When copying in the editor to the clipboard, any CriticMarkup syntax is removed",notices:[{type:"info",text:"Copying <code>my {++text++}</code> will result in <code>my text</code>"}],type:"toggle",control:g=>{Ce(g,{slot:"control",get value(){return t().settings.clipboard_remove_syntax},onChange:()=>{t().settings.clipboard_remove_syntax=!t().settings.clipboard_remove_syntax,t().saveSettings()}})},$$slots:{control:!0}});var l=F(u,2);le(l,{name:"Automatic tag correction",description:"Dangling tags and redundant whitespaces automatically get removed to prevent invalid CriticMarkup syntax",type:"toggle",control:g=>{Ce(g,{get value(){return t().settings.tag_correcter},onChange:()=>{t().settings.tag_correcter=!t().settings.tag_correcter,t().saveSettings()}})},$$slots:{control:!0}});var d=F(l,2);le(d,{name:"Show style while editing",description:"Keep the style of suggestions visible while editing",type:"toggle",control:g=>{Ce(g,{get value(){return t().settings.editor_styling},onChange:()=>{t().settings.editor_styling=!t().settings.editor_styling,t().saveSettings()}})},$$slots:{control:!0}});var c=F(d,2);le(c,{name:"Comments Rendering",type:"heading"});var f=F(c,2);let p=ne(()=>[{type:"info",text:i[h(n)]}]);le(f,{name:"Comment rendering mode",description:"Determine how comments are rendered inside the editor",get notices(){return h(p)},type:"dropdown",control:g=>{vn(g,{options:[{value:"inline",text:"Inline"},{value:"icon",text:"Icon"},{value:"none",text:"Hidden"}],get value(){return h(n)},onChange:_=>{t().settings.comment_style=_,P(n,_,!0),t().saveSettings()}})},$$slots:{control:!0}}),V(r,s),be()}var rv=G('<!> <!> <!> <!> <!> <!> <div class="cmtr-important-buttons cmtr-fail"><!></div>',1);function xa(r,e){ve(e,!0);let t=B(e,"plugin",7),n=ae(De(t().settings.default_preview_mode)),i={0:"All suggestions will be visible",1:"Preview document as if all suggestions were accepted",2:"Preview document as if all suggestions were rejected"};var s=rv(),o=Te(s);le(o,{name:"Default <i>Edit</i> Mode",type:"dropdown",notices:[{type:"info",text:"When opening a new note, this will be the default editing mode"}],control:_=>{let v=ne(()=>[{value:0 .toString(),text:"Regular Edit Mode"},{value:1 .toString(),text:"Corrected Edit Mode"},{value:2 .toString(),text:"Suggestion Mode"}]),k=ne(()=>t().settings.default_edit_mode.toString());vn(_,{get options(){return h(v)},get value(){return h(k)},onChange:S=>{let T=parseInt(S);t().settings.default_edit_mode=T,t().saveSettings()}})},$$slots:{control:!0}});var a=F(o,2);let u=ne(()=>[{type:"info",text:"When opening a new note, this will be the default editing mode"},{type:"info",text:i[h(n)]}]);le(a,{name:"Default <i>Preview</i> Mode",type:"dropdown",get notices(){return h(u)},control:_=>{let v=ne(()=>[{value:0 .toString(),text:"View all suggestions"},{value:1 .toString(),text:"Preview 'accept all'"},{value:2 .toString(),text:"Preview 'reject all'"}]),k=ne(()=>t().settings.default_preview_mode.toString());vn(_,{get options(){return h(v)},get value(){return h(k)},onChange:S=>{P(n,parseInt(S),!0),t().settings.default_preview_mode=h(n),t().saveSettings()}})},$$slots:{control:!0}});var l=F(a,2);le(l,{name:"Include Metadata Extension",type:"dropdown",notices:[{type:"info",text:"Allow inclusion of metadata for suggestions, such as authorship, time, etc."},{type:"warning",text:"Suggestion metadata is <b>not</b> part of the official CriticMarkup standard, this metadata will not get processed/rendered correctly in other editors"},{type:"error",text:"Toggling this setting results in a re-indexation of the entire vault"}],control:_=>{Ce(_,{get value(){return t().settings.enable_metadata},onChange:v=>{t().settings.enable_metadata=v,t().saveSettings()}})},$$slots:{control:!0}});var d=F(l,2);le(d,{name:"Database",type:"heading"});var c=F(d,2);le(c,{name:"Database Workers",description:"Number of workers to use for database indexing",notices:[{type:"info",text:"A higher amount of workers will increase indexing speed"}],type:"slider",control:_=>{os(_,{min:1,max:navigator.hardwareConcurrency/2,step:1,get value(){return t().settings.database_workers},onChange:v=>{t().settings.database_workers=v,t().saveSettings()}})},$$slots:{control:!0}});var f=F(c,2);le(f,{name:"Rebuild Database",notices:[{type:"info",text:"Recommended if you're encountering issues with the view after updating"},{type:"warning",text:"In large vaults, reindexing the database may take a while"}],control:_=>{mr(_,{text:"Rebuild",onClick:async()=>{await t().database.reinitializeDatabase()}})},$$slots:{control:!0}});var p=F(f,2),m=K(p);mr(m,{class:"translator-fail",text:"REPORT BUG",icon:"bug",onClick:()=>Ud(t().app,void 0,{})}),q(p),V(r,s),be()}var nv=G("<!> <!> <!> <!> <!> <!> <!> <!>",1);function _l(r,e){ve(e,!0);let t=B(e,"plugin",7);var n=nv(),i=Te(n);le(i,{name:"Editor header",type:"heading"});var s=F(i,2);le(s,{name:"Full button labels",description:"Adds labels to the buttons in the editor header",type:"toggle",control:p=>{Ce(p,{get value(){return t().settings.toolbar_show_buttons_labels},onChange:()=>{t().settings.toolbar_show_buttons_labels=!t().settings.toolbar_show_buttons_labels,t().saveSettings()}})},$$slots:{control:!0}});var o=F(s,2);le(o,{name:"Preview mode header button",description:"Adds a button to the editor's header for quickly changing preview mode",type:"toggle",control:p=>{Ce(p,{get value(){return t().settings.toolbar_preview_button},onChange:()=>{t().settings.toolbar_preview_button=!t().settings.toolbar_preview_button,t().saveSettings()}})},$$slots:{control:!0}});var a=F(o,2);le(a,{name:"Suggestion mode header button",description:"Adds a button to the editor's header for quickly toggling suggestion mode",type:"toggle",control:p=>{Ce(p,{get value(){return t().settings.toolbar_edit_button},onChange:()=>{t().settings.toolbar_edit_button=!t().settings.toolbar_edit_button,t().saveSettings()}})},$$slots:{control:!0}});var u=F(a,2);le(u,{name:"Editor status bar",type:"heading"});var l=F(u,2);le(l,{name:"Preview mode status bar toggle",description:"Adds a status bar item for quickly selecting suggestion mode",type:"toggle",control:p=>{Ce(p,{get value(){return t().settings.status_bar_preview_button},onChange:()=>{t().settings.status_bar_preview_button=!t().settings.status_bar_preview_button,t().saveSettings()}})},$$slots:{control:!0}});var d=F(l,2);le(d,{name:"Suggestion mode status bar toggle",description:"Adds a status bar item for quickly selecting suggestion mode",type:"toggle",control:p=>{Ce(p,{get value(){return t().settings.status_bar_edit_button},onChange:()=>{t().settings.status_bar_edit_button=!t().settings.status_bar_edit_button,t().saveSettings()}})},$$slots:{control:!0}});var c=F(d,2);le(c,{name:"Metadata status bar toggle",description:"Adds a status bar item for quickly toggling the inclusion of (particular) metadata",type:"toggle",control:p=>{Ce(p,{get value(){return t().settings.status_bar_metadata_button},onChange:()=>{t().settings.status_bar_metadata_button=!t().settings.status_bar_metadata_button,t().saveSettings()}})},$$slots:{control:!0}}),V(r,n),be()}var iv=G("<!> <!>",1),sv=G("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);function vl(r,e){ve(e,!0);let t=B(e,"plugin",7);var n=sv(),i=Te(n);le(i,{name:"Add Metadata",type:"toggle",control:E=>{Ce(E,{get value(){return t().settings.enable_metadata},onChange:y=>{t().settings.enable_metadata=y,t().saveSettings()}})},$$slots:{control:!0}});var s=F(i,2);le(s,{name:"Enable Authorship",description:"Enable rendering and processing of author metadata",type:"toggle",control:E=>{Ce(E,{get value(){return t().settings.enable_author_metadata},onChange:y=>{t().settings.enable_author_metadata=y,t().saveSettings()}})},$$slots:{control:!0}});var o=F(s,2);{var a=T=>{var E=iv(),y=Te(E);le(y,{name:"Add Author Metadata",description:"Author metadata will be added into new suggestions and comments",type:"toggle",depth:1,control:A=>{Ce(A,{get value(){return t().settings.add_author_metadata},onChange:N=>{t().settings.add_author_metadata=N,t().saveSettings()}})},$$slots:{control:!0}});var x=F(y,2);le(x,{name:"Name",depth:1,control:A=>{ss(A,{type:"text",onChange:N=>{t().settings.author=N,t().saveSettings()},get value(){return t().settings.author},set value(N){t().settings.author=N}})},$$slots:{control:!0}}),V(T,E)};pe(o,T=>{t().settings.enable_author_metadata&&T(a)})}var u=F(o,2);le(u,{name:"Enable Timestamp",description:"Enable rendering and processing of timestamp metadata",type:"toggle",control:E=>{Ce(E,{get value(){return t().settings.enable_timestamp_metadata},onChange:y=>{t().settings.enable_timestamp_metadata=y,t().saveSettings()}})},$$slots:{control:!0}});var l=F(u,2);{var d=T=>{le(T,{name:"Add Timestamp Metadata",description:"Timestamp metadata will be added into new suggestions and comments",depth:1,control:y=>{Ce(y,{get value(){return t().settings.add_timestamp_metadata},onChange:x=>{t().settings.add_timestamp_metadata=x,t().saveSettings()}})},$$slots:{control:!0}})};pe(l,T=>{t().settings.enable_timestamp_metadata&&T(d)})}var c=F(l,2);le(c,{name:"Enable Completed",description:"Enable rendering and processing of completed metadata",type:"toggle",control:E=>{Ce(E,{get value(){return t().settings.enable_completed_metadata},onChange:y=>{t().settings.enable_completed_metadata=y,t().saveSettings()}})},$$slots:{control:!0}});var f=F(c,2);{var p=T=>{le(T,{name:"Add Completed Metadata",description:"Completed metadata will be added into new suggestions and comments",depth:1,control:y=>{Ce(y,{get value(){return t().settings.add_completed_metadata},onChange:x=>{t().settings.add_completed_metadata=x,t().saveSettings()}})},$$slots:{control:!0}})};pe(f,T=>{t().settings.enable_completed_metadata&&T(p)})}var m=F(f,2);le(m,{name:"Enable Style",description:"Enable rendering and processing of style metadata",type:"toggle",control:E=>{Ce(E,{get value(){return t().settings.enable_style_metadata},onChange:y=>{t().settings.enable_style_metadata=y,t().saveSettings()}})},$$slots:{control:!0}});var g=F(m,2);{var _=T=>{le(T,{name:"Add Style Metadata",description:"Style metadata will be added into new suggestions and comments",depth:1,control:y=>{Ce(y,{get value(){return t().settings.add_style_metadata},onChange:x=>{t().settings.add_style_metadata=x,t().saveSettings()}})},$$slots:{control:!0}})};pe(g,T=>{t().settings.enable_style_metadata&&T(_)})}var v=F(g,2);le(v,{name:"Enable Color",description:"Enable rendering and processing of color metadata",type:"toggle",control:E=>{Ce(E,{get value(){return t().settings.enable_color_metadata},onChange:y=>{t().settings.enable_color_metadata=y,t().saveSettings()}})},$$slots:{control:!0}});var k=F(v,2);{var S=T=>{le(T,{name:"Add Color Metadata",description:"Color metadata will be added into new suggestions and comments",depth:1,control:y=>{Ce(y,{get value(){return t().settings.add_color_metadata},onChange:x=>{t().settings.add_color_metadata=x,t().saveSettings()}})},$$slots:{control:!0}})};pe(k,T=>{t().settings.enable_color_metadata&&T(S)})}V(r,n),be()}var ov=G("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);function bl(r,e){ve(e,!0);let t=B(e,"plugin",7);var n=ov(),i=Te(n);le(i,{name:"Diff gutter",type:"heading"});var s=F(i,2);le(s,{name:"Enable diff gutter",description:"Display a gutter in the editor for showing changes from suggestions",notices:[{type:"info",text:"Clicking on the gutter reveals a menu for accepting/rejecting all changes within the block"}],type:"toggle",control:k=>{Ce(k,{slot:"control",get value(){return t().settings.diff_gutter},onChange:()=>{t().settings.diff_gutter=!t().settings.diff_gutter,t().saveSettings()}})},$$slots:{control:!0}});var o=F(s,2);le(o,{name:"Hide when empty",description:"When enabled, the gutter will not take up any space when there are no changes in the current note",notices:[{type:"info",text:"When enabled, switching between different notes may cause content to shift"}],type:"toggle",depth:1,control:k=>{Ce(k,{slot:"control",get value(){return t().settings.diff_gutter_hide_empty},onChange:()=>{t().settings.diff_gutter_hide_empty=!t().settings.diff_gutter_hide_empty,t().saveSettings()}})},$$slots:{control:!0}});var a=F(o,2);le(a,{name:"Annotation gutter",type:"heading"});var u=F(a,2);le(u,{name:"Enable annotation gutter",description:"Display a gutter in the editor for annotations",type:"toggle",control:k=>{Ce(k,{get value(){return t().settings.annotation_gutter},onChange:()=>{t().settings.annotation_gutter=!t().settings.annotation_gutter,t().saveSettings()}})},$$slots:{control:!0}});var l=F(u,2);le(l,{name:"Included annotations",description:"Determine which annotations should be shown by default",notices:[{type:"info",text:"This setting only applies after reloading the app"}],type:"subheading",depth:1});var d=F(l,2);Xe(d,17,()=>Object.keys(qi).filter(v=>isNaN(Number(v))),st,(v,k)=>{let S=ne(()=>h(k).toLowerCase().replace(/\b\w/g,T=>T.toUpperCase()));le(v,{get name(){return h(S)},type:"toggle",depth:2,control:E=>{let y=ne(()=>(t().settings.annotation_gutter_included_types&qi[h(k)])!==0);Ce(E,{get value(){return h(y)},onChange:()=>{t().settings.annotation_gutter_included_types^=qi[h(k)],t().saveSettings()}})},$$slots:{control:!0}})});var c=F(d,2);le(c,{name:"Focus annotation on selection",description:"When selecting an annotation in the editor, the corresponding annotation in the gutter will be focused",type:"toggle",depth:1,control:k=>{Ce(k,{get value(){return t().settings.annotation_gutter_focus_on_click},onChange:()=>{t().settings.annotation_gutter_focus_on_click=!t().settings.annotation_gutter_focus_on_click,t().saveSettings()}})},$$slots:{control:!0}});var f=F(c,2);le(f,{name:"Width",description:"The width of the gutter in pixels",type:"slider",depth:1,control:k=>{os(k,{min:100,max:500,step:50,get value(){return t().settings.annotation_gutter_width},onChange:S=>{t().settings.annotation_gutter_width=S,t().saveSettings()}})},$$slots:{control:!0}});var p=F(f,2);le(p,{name:"Show resize handle",description:"Display a handle bar within the editor for quickly resizing the gutter",type:"toggle",depth:1,control:k=>{Ce(k,{get value(){return t().settings.annotation_gutter_resize_handle},onChange:()=>{t().settings.annotation_gutter_resize_handle=!t().settings.annotation_gutter_resize_handle,t().saveSettings()}})},$$slots:{control:!0}});var m=F(p,2);le(m,{name:"Default fold state",description:"Determine whether the gutter is shown by default",notices:[{type:"info",text:"This setting only applies after reloading the app"}],type:"toggle",depth:1,control:k=>{Ce(k,{get value(){return t().settings.annotation_gutter_default_fold_state},onChange:()=>{t().settings.annotation_gutter_default_fold_state=!t().settings.annotation_gutter_default_fold_state,t().saveSettings()}})},$$slots:{control:!0}});var g=F(m,2);le(g,{name:"Show fold button",description:"Display a button within the editor for (un)folding the gutter",type:"toggle",depth:1,control:k=>{Ce(k,{get value(){return t().settings.annotation_gutter_fold_button},onChange:()=>{t().settings.annotation_gutter_fold_button=!t().settings.annotation_gutter_fold_button,t().saveSettings()}})},$$slots:{control:!0}});var _=F(g,2);le(_,{name:"Hide when empty",description:"When enabled, the gutter will not take up any space when there are no annotations in the current note",notices:[{type:"info",text:"When enabled, switching between different notes may cause content to shift"}],type:"toggle",depth:1,control:k=>{Ce(k,{get value(){return t().settings.annotation_gutter_hide_empty},onChange:()=>{t().settings.annotation_gutter_hide_empty=!t().settings.annotation_gutter_hide_empty,t().saveSettings()}})},$$slots:{control:!0}}),V(r,n),be()}var av=r=>r;function uv(r){let e=r-1;return e*e*e+1}function Pi(r,{delay:e=0,duration:t=400,easing:n=av}={}){let i=+getComputedStyle(r).opacity;return{delay:e,duration:t,easing:n,css:s=>`opacity: ${s*i}`}}var Qf=!1;function Xf(r,{delay:e=0,duration:t=400,easing:n=uv,axis:i="y"}={}){let s=getComputedStyle(r);re&&!Qf&&/(contents|inline|table)/.test(s.display)&&(Qf=!0,Promise.resolve().then(()=>Qf=!1),s.display,void 0);let o=+s.opacity,a=i==="y"?"height":"width",u=parseFloat(s[a]),l=i==="y"?["top","bottom"]:["left","right"],d=l.map(v=>`${v[0].toUpperCase()}${v.slice(1)}`),c=parseFloat(s[`padding${d[0]}`]),f=parseFloat(s[`padding${d[1]}`]),p=parseFloat(s[`margin${d[0]}`]),m=parseFloat(s[`margin${d[1]}`]),g=parseFloat(s[`border${d[0]}Width`]),_=parseFloat(s[`border${d[1]}Width`]);return{delay:e,duration:t,easing:n,css:v=>`overflow: hidden;opacity: ${Math.min(v*20,1)*o};${a}: ${v*u}px;padding-${l[0]}: ${v*c}px;padding-${l[1]}: ${v*f}px;margin-${l[0]}: ${v*p}px;margin-${l[1]}: ${v*m}px;border-${l[0]}-width: ${v*g}px;border-${l[1]}-width: ${v*_}px;min-${a}: 0`}}var lv=(r,e,t,n)=>{if(r.key==="Tab"){if(r.metaKey||r.ctrlKey)return!0;r.shiftKey?e(((h(t)-1)%n.length+n.length)%n.length):e((h(t)+1)%n.length),r.preventDefault()}},cv=G('<div><div style="display: flex"><!></div> <div> </div></div>'),fv=G("<div><!></div>"),dv=G('<div><nav class="cmtr-settings-navigation-bar" tabindex="0"></nav> <!></div>');function ka(r,e){ve(e,!0);let t=B(e,"plugin",7),n=[{id:"general",name:"General",icon:"settings"},{id:"editor",name:"Editor",icon:"pencil"},{id:"interface",name:"Interface",icon:"layout-panel-top"},{id:"gutter",name:"Gutters",icon:"sidebar-open"},{id:"metadata",name:"Metadata",icon:"tags"},{id:"advanced",name:"Advanced",icon:"shield-alert"}],i=ae(De(n.findIndex(c=>c.id===t().settings_tab))),s=ne(()=>n[h(i)].id),o=ne(()=>{switch(h(s)){case"general":return xa;case"editor":return gl;case"gutter":return bl;case"advanced":return ml;case"interface":return _l;case"metadata":return vl;default:return xa}});async function a(c){P(i,c,!0),P(s,n[c].id,!0),t().settings_tab=h(s)}var u=dv(),l=K(u);l.__keydown=[lv,a,i,n],Xe(l,21,()=>n,st,(c,f,p)=>{let m=()=>h(f).id,g=()=>h(f).name,_=()=>h(f).icon;var v=cv();let k;v.__click=()=>{a(p)};var S=K(v),T=K(S);ar(T,{get icon(){return _()}}),q(S);var E=F(S,2);let y;var x=K(E,!0);q(E),q(v),fe((M,A)=>{k=ke(v,1,"cmtr-settings-navigation-item",null,k,M),Re(v,"aria-label",`${g()} settings`),y=ke(E,1,"cmtr-settings-navigation-item-text",null,y,A),qe(x,g())},[()=>({"cmtr-settings-navigation-selected-item":h(i)===p}),()=>({"cmtr-settings-navigation-selected-item-text":h(i)!==p})]),V(c,v)}),q(l);var d=F(l,2);so(d,()=>h(s),c=>{var f=fv(),p=K(f);Lf(p,()=>h(o),(m,g)=>{g(m,{get plugin(){return t()}})}),q(f),Kt(1,f,()=>Xf,()=>({duration:400,delay:400})),Kt(2,f,()=>Xf,()=>({duration:400})),V(c,f)}),q(u),V(r,u),be()}Ye(["keydown","click"]);var Rn=require("obsidian"),mm=require("@codemirror/state");function yl(r,e,t){let n=new Rn.Menu,i=new Set(t.map(a=>a.range.type)),s=t.length>20,o=t.length>1;if(i.has("comment")||i.has("highlight")?i.size===1&&i.has("comment")?n.addItem(a=>{a.setTitle(o?"Remove selected comment threads":"Remove comment thread").setIcon("message-square-off").setSection("close-annotation").setWarning(s).onClick(async()=>fn(r,t,dn.bind(null,(u,l)=>"")))}):n.addItem(a=>{a.setTitle(o?"Remove selected threads":"Remove thread").setIcon("trash").setSection("close-annotation").setWarning(s).onClick(async()=>fn(r,t,dn.bind(null,(u,l)=>"")))}):(n.addItem(a=>{a.setTitle(o?"Apply selected changes":"Apply change").setIcon("check").setSection("close-annotation").setWarning(s).onClick(async()=>fn(r,t,dn.bind(null,(u,l)=>u.accept())))}),n.addItem(a=>{a.setTitle(o?"Reject selected changes":"Reject change").setIcon("cross").setSection("close-annotation").setWarning(s).onClick(async()=>fn(r,t,dn.bind(null,(u,l)=>u.reject())))})),!o){let{range:a,path:u}=t[0];n.addItem(l=>{l.setTitle("Add reply").setIcon("reply").setSection("comment-handling").onClick(async d=>{let c=r.app.vault.getAbstractFileByPath(u);if(c&&c instanceof Rn.TFile){let f=r.app.workspace.getLeaf(!1);await f.openLinkText(u,""),f.view instanceof Rn.MarkdownView&&(zs(f.view.editor,a),Kr(f.view.editor.cm,a,!1))}})}),a.type==="comment"&&(n.addItem(l=>{l.setTitle("Edit comment").setIcon("pencil").setSection("comment-handling").onClick(async()=>{let d=r.app.vault.getAbstractFileByPath(u);if(d&&d instanceof Rn.TFile){let c=r.app.workspace.getLeaf(!1);if(await c.openLinkText(u,""),c.view instanceof Rn.MarkdownView){let{editor:f}=c.view;zs(f,a),f.cm.dispatch(f.cm.state.update({selection:mm.EditorSelection.cursor(a.full_range_back),annotations:[Mn.of({from:a.full_range_back,to:a.full_range_back,index:a.reply_depth})]}))}}})}),n.addItem(l=>{l.setTitle("Remove comment").setIcon("cross").setSection("comment-handling").onClick(async()=>fn(r,t,dn.bind(null,(d,c)=>""),!1))}))}return n.addItem(a=>{a.setTitle(o?"Open in new tabs":"Open in new tab").setIcon("file-plus").setSection("open-annotation").onClick(async u=>{let l=Ru(t);for(let[d,c]of Object.entries(l).slice(0,10)){let f=r.app.vault.getAbstractFileByPath(d);if(f&&f instanceof Rn.TFile){let p=r.app.workspace.getLeaf(u.metaKey||u.ctrlKey||!0);await p.openLinkText(d,""),p.view instanceof Rn.MarkdownView&&zs(p.view.editor,c[0])}}})}),n.showAtMouseEvent(e),n}var RR=require("obsidian");var hv=G("<!> <!>",1),pv=G('<div style="position: relative"><div class="cmtr-view-suggestion-buttons"><!> <div class="cmtr-view-suggestion-button-sep"></div> <!> <!></div></div>');function wl(r,e){ve(e,!0);let t=B(e,"menu_open",15,!1);var n=pv(),i=K(n),s=K(i);{var o=d=>{var c=It(),f=Te(c);{var p=g=>{mr(g,{icon:"message-square-off",tooltip:"Delete comment thread",onClick:()=>fn(e.plugin,[e.entry],dn.bind(null,(_,v)=>_.accept()))})},m=g=>{mr(g,{icon:"cross",tooltip:"Delete comment",onClick:()=>fn(e.plugin,[e.entry],dn.bind(null,(_,v)=>_.accept()))})};pe(f,g=>{e.entry.range.replies.length?g(p):g(m,!1)})}V(d,c)},a=(d,c)=>{{var f=p=>{var m=hv(),g=Te(m);let _=ne(()=>"Accept change"+(e.entry.range.replies.length?" (and delete thread)":""));mr(g,{icon:"check",get tooltip(){return h(_)},onClick:()=>fn(e.plugin,[e.entry],dn.bind(null,(S,T)=>S.accept()))});var v=F(g,2);let k=ne(()=>"Reject change"+(e.entry.range.replies.length?" (and delete thread)":""));mr(v,{icon:"cross",get tooltip(){return h(k)},onClick:()=>fn(e.plugin,[e.entry],dn.bind(null,(S,T)=>S.reject()))}),V(p,m)};pe(d,p=>{e.entry.range.type!=="highlight"&&p(f)},c)}};pe(s,d=>{e.entry.range.type==="comment"?d(o):d(a,!1)})}var u=F(s,4);mr(u,{icon:"eye",tooltip:"View in note",onClick:async()=>{await Du(e.plugin,e.entry)}});var l=F(u,2);mr(l,{icon:"more-vertical",tooltip:"More options",onClick:d=>{t(!0),e.moreOptionsMenu(e.plugin,d,[e.entry]).onHide(()=>{t(!1)})}}),q(i),q(n),V(r,n),be()}var mv=(r,e,t)=>{e.onClick(r,e.row,e.index),P(t,!0)},gv=(r,e)=>{e.onDblClick(r,e.row,e.index)},_v=(r,e,t)=>{yl(e.plugin,r,e.selected_ranges.length?e.selected_ranges:[{path:e.row.path,range:e.row.range.thread[h(t)]??e.row.range}])},vv=G('<p class="cmtr-view-range-empty">This range is empty</p>'),bv=G("<!> <!>",1),yv=G('<div class="cmtr-view-range-text"><!></div>'),wv=G('<div><!> <!> <div class="cmtr-view-range-reply-text"><!></div></div>'),xv=G('<div><!> <div class="cmtr-view-range-top"><!> <div><span class="cmtr-view-range-title"> </span> <!></div></div> <!> <!></div>');function Zf(r,e){ve(e,!0);let t=B(e,"menu_open",15,!1),n=ae(!1),i=ae(null),s=ae(null);function o(E){t()||(P(i,E,!0),P(s,h(i),!0))}let a=ne(()=>e.selected_ranges.some(E=>E.path===e.row.path&&E.range.from===e.row.range.from));var u=xv();let l;u.__click=[mv,e,n],u.__dblclick=[gv,e],u.__contextmenu=[_v,e,i];var d=K(u);{var c=E=>{wl(E,{get plugin(){return e.plugin},get entry(){return e.row},moreOptionsMenu:yl,get menu_open(){return t()},set menu_open(y){t(y)}})};pe(d,E=>{(!t()&&h(i)===0||t()&&h(s)===0)&&E(c)})}var f=F(d,2),p=K(f);ar(p,{size:24,get icon(){return bd[e.row.range.type]}});var m=F(p,2),g=K(m),_=K(g,!0);q(g);var v=F(g,2);Dn(v,()=>yi(e.row.range,"","icon").outerHTML),q(m),q(f);var k=F(f,2);so(k,()=>e.row.range.text,E=>{var y=yv(),x=K(y);{var M=N=>{var R=vv();V(N,R)},A=N=>{var R=bv();let D=ne(()=>e.row.range.unwrap_parts());var H=Te(R);as(H,{get plugin(){return e.plugin},get text(){return h(D)[0]},get source(){return e.row.path},get class(){return e.row.range.fields.style}});var j=F(H,2);{var ee=ie=>{as(ie,{get plugin(){return e.plugin},get text(){return h(D)[1]},get source(){return e.row.path}})};pe(j,ie=>{e.row.range.type==="substitution"&&ie(ee)})}V(N,R)};pe(x,N=>{e.row.range.empty()?N(M):N(A,!1)})}q(y),Bt("mouseenter",y,()=>{o(0)}),V(E,y)});var S=F(k,2);{var T=E=>{var y=It(),x=Te(y);Xe(x,17,()=>e.row.range.replies,st,(M,A,N)=>{var R=It(),D=Te(R);so(D,()=>h(A).text,H=>{var j=wv();let ee;var ie=K(j);{var Me=ye=>{let Ue=ne(()=>({path:e.row.path,range:h(A)}));wl(ye,{get plugin(){return e.plugin},get entry(){return h(Ue)},moreOptionsMenu:yl,get menu_open(){return t()},set menu_open(tt){t(tt)}})};pe(ie,ye=>{(!t()&&h(i)===N+1||t()&&h(s)===N+1)&&ye(Me)})}var Se=F(ie,2);Dn(Se,()=>yi(h(A),"cmtr-view-range-reply-top").outerHTML);var ge=F(Se,2),Ae=K(ge);let Be=ne(()=>h(A).unwrap());as(Ae,{get plugin(){return e.plugin},get text(){return h(Be)},get source(){return e.row.path},get class(){return h(A).fields.style}}),q(ge),q(j),fe(ye=>ee=ke(j,1,"cmtr-view-range-reply",null,ee,ye),[()=>({"cmtr-view-range-reply-hovered":h(i)===N+1})]),Bt("mouseenter",j,()=>{o(N+1)}),V(H,j)}),V(M,R)}),V(E,y)};pe(S,E=>{e.row.range.replies.length&&E(T)})}q(u),fe(E=>{Re(u,"tabindex",e.index),l=ke(u,1,"cmtr-view-range",null,l,E),qe(_,e.row.path)},[()=>({"cmtr-view-range-completed":e.row.range.fields.done,"cmtr-view-range-selected":h(a)})]),Bt("mouseenter",u,()=>{o(0)}),Bt("mouseleave",u,()=>{o(null)}),Bt("blur",u,()=>{P(n,!1)}),V(r,u),be()}Ye(["click","dblclick","contextmenu"]);var Nn=require("obsidian");var e0=require("obsidian");var gm={days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],todayBtn:"Today",clearBtn:"Clear",okBtn:"Ok",cancelBtn:"Cancel",timeView:"Show time view",backToDate:"Back to calendar view"};var _m={theme:"sdt-calendar-colors",format:"yyyy-mm-dd",formatType:"standard",displayFormat:null,displayFormatType:null,minuteIncrement:1,weekStart:1,inputClasses:"",todayBtnClasses:"sdt-action-btn sdt-today-btn",clearBtnClasses:"sdt-action-btn sdt-clear-btn",hourOnly:!1,todayBtn:!0,clearBtn:!0,clearToggle:!0,autocommit:!0,i18n:gm};var vm=!1,dt=class r extends Date{#e=Ct(super.getTime());#t=new Map;#r=Oe;constructor(...e){super(...e),vm||this.#n()}#n(){vm=!0;var e=r.prototype,t=Date.prototype,n=Object.getOwnPropertyNames(t);for(let i of n)(i.startsWith("get")||i.startsWith("to")||i==="valueOf")&&(e[i]=function(...s){if(s.length>0)return h(this.#e),t[i].apply(this,s);var o=this.#t.get(i);if(o===void 0){let a=Oe;ft(this.#r),o=ne(()=>(h(this.#e),t[i].apply(this,s))),this.#t.set(i,o),ft(a)}return h(o)}),i.startsWith("set")&&(e[i]=function(...s){var o=t[i].apply(this,s);return P(this.#e,t.getTime.call(this)),o})}};function ai(r){P(r,r.v+1)}var bm=Symbol(),xl=class extends URLSearchParams{#e=Ct(0);#t=ym();#r=!1;#n(){if(!this.#t||this.#r)return;this.#r=!0;let e=this.toString();this.#t.search=e&&`?${e}`,this.#r=!1}[bm](e){if(!this.#r){this.#r=!0;for(let t of[...super.keys()])super.delete(t);for(let[t,n]of e)super.append(t,n);ai(this.#e),this.#r=!1}}append(e,t){super.append(e,t),this.#n(),ai(this.#e)}delete(e,t){var n=super.has(e,t);super.delete(e,t),n&&(this.#n(),ai(this.#e))}get(e){return h(this.#e),super.get(e)}getAll(e){return h(this.#e),super.getAll(e)}has(e,t){return h(this.#e),super.has(e,t)}keys(){return h(this.#e),super.keys()}set(e,t){var n=super.getAll(e).join("");super.set(e,t),n!==super.getAll(e).join("")&&(this.#n(),ai(this.#e))}sort(){super.sort(),this.#n(),ai(this.#e)}toString(){return h(this.#e),super.toString()}values(){return h(this.#e),super.values()}entries(){return h(this.#e),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return h(this.#e),super.size}};var kv=null;function ym(){return kv}function us(r,e,t,n){if(r instanceof Date)return r;let i=n==="php"?{date:"Y-m-d",datetime:"Y-m-d H:i",datetime_s:"Y-m-d H:i:s"}:{date:"yyyy-mm-dd",datetime:"yyyy-mm-dd hh:ii",datetime_s:"yyyy-mm-dd hh:ii:ss"},s,o;/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(r)?s=Ni.parseFormat(i.date,n):/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(r)?s=Ni.parseFormat(i.datetime,n):/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(r)?s=Ni.parseFormat(i.datetime_s,n):(/^([01]*\d|2[0-3])([0-5]\d)(?:[ ]([ap][m]|[AP][M]))?$/.test(r)&&(o=r.match(/^([01]*\d|2[0-3])([0-5]\d)(?:[ ]([ap][m]|[AP][M]))?$/)?.slice(1).filter(_=>_)),s=Ni.parseFormat(e,n));let a=o||r&&r.toString().match(Ni.nonpunctuation)||[];r=new Date,r.setHours(0,0,0,0);let u={},{setters_order:l,setters_map:d}=Ni.setters(n),c,f;if(a.length!==s.parts.length&&s.parts.includes("S")){let _=a[s.parts.indexOf("S")-1].match(/(\d+)([a-zA-Z]+)/)?.slice(1,3);a.splice(s.parts.indexOf("S")-1,1,..._)}if(a.length===s.parts.length){for(var p=0,m=s.parts.length;p<m;p++){if(c=parseInt(a[p],10),f=s.parts[p],isNaN(c))if(n==="standard")switch(f){case"MM":c=t.months.indexOf(a[p])+1;break;case"M":c=t.monthsShort.indexOf(a[p])+1;break;case"p":case"P":c=t.meridiem.indexOf(a[p].toLowerCase());break}else switch(f){case"D":c=t.daysShort.indexOf(a[p])+1;break;case"l":c=t.days.indexOf(a[p])+1;break;case"F":c=t.months.indexOf(a[p])+1;break;case"M":c=t.monthsShort.indexOf(a[p])+1;break;case"a":case"A":c=t.meridiem.indexOf(a[p].toLowerCase());break}u[f]=c}for(var p=0,g;p<l.length;p++)g=l[p],g in u&&!isNaN(u[g])&&d[`${g}`]&&d[`${g}`](r,u[g])}return r}function oo(r,e,t,n){if(r===null)return"";let i=r.getDate(),s;if(n==="standard")s={t:r.getTime(),yy:r.getFullYear().toString().substring(2),yyyy:r.getFullYear(),m:r.getMonth()+1,M:t.monthsShort[r.getMonth()],MM:t.months[r.getMonth()],d:i,D:t.daysShort[r.getDay()],DD:t.days[r.getDay()],S:i%10&&i%10<4&&(i<10||i>14)?t.suffix[i%10-1]:t.suffix[t.suffix.length-1],p:t.meridiem.length===2?t.meridiem[r.getHours()<12?0:1]:"",h:r.getHours(),ii:(r.getMinutes()<10?"0":"")+r.getMinutes(),ss:(r.getUTCSeconds()<10?"0":"")+r.getUTCSeconds()},t.meridiem.length===2?s.H=s.h%12===0?12:s.h%12:s.H=s.h,s.HH=(s.H<10?"0":"")+s.H,s.P=s.p.toUpperCase(),s.hh=(s.h<10?"0":"")+s.h,s.i=s.ii,s.s=s.ss,s.dd=(s.d<10?"0":"")+s.d,s.mm=(s.m<10?"0":"")+s.m;else if(n==="php")s={y:r.getFullYear().toString().substring(2),Y:r.getFullYear(),F:t.months[r.getMonth()],M:t.monthsShort[r.getMonth()],n:r.getMonth()+1,t:ed(r.getFullYear(),r.getMonth()),j:r.getDate(),l:t.days[r.getDay()],D:t.daysShort[r.getDay()],w:r.getDay(),N:r.getDay()===0?7:r.getDay(),S:i%10&&i%10<4&&(i<10||i>14)?t.suffix[i%10-1]:t.suffix[t.suffix.length-1],a:t.meridiem.length===2?t.meridiem[r.getHours()<12?0:1]:"",g:r.getHours()%12===0?12:r.getHours()%12,G:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),U:Math.floor(r.getTime()/1e3)},s.m=(s.n<10?"0":"")+s.n,s.d=(s.j<10?"0":"")+s.j,s.A=s.a.toString().toUpperCase(),s.h=(s.g<10?"0":"")+s.g,s.H=(s.G<10?"0":"")+s.G,s.i=(s.i<10?"0":"")+s.i,s.s=(s.s<10?"0":"")+s.s;else throw new Error("Invalid format type.");let o=[],a=Ni.parseFormat(e,n);for(var u=0,l=a.parts?.length||0;u<l;u++)a.separators.length&&o.push(a.separators.shift()),o.push(s[a.parts[u]]);return a.separators.length&&o.push(a.separators.shift()),o.join("")}function ed(r,e){return[31,r%4===0&&r%100!==0||r%400===0?29:28,31,30,31,30,31,31,30,31,30,31][e]}var Ni={validParts:function(r){if(r==="standard")return/t|hh?|HH?|p|P|z|ii?|ss?|dd?|DD?|S|mm?|MM?|yy(?:yy)?/g;if(r==="php")return/[dDjlNwzFmMnStyYaABgGhHisU]/g;throw new Error("Invalid format type.")},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(r,e){var t=r.replace(this.validParts(e),"\0").split("\0"),n=r.match(this.validParts(e))||[];return!t||!t.length||!n||n.length,{separators:t,parts:n}},setters:function(r){let e,t={};return r==="standard"?(e=["yyyy","yy","m","mm","M","MM","d","dd","D","DD","hh","h","HH","H","ii","i","ss","s","S","p","P","t"],t={hh:(n,i)=>n.setHours(i),h:(n,i)=>n.setHours(i),HH:(n,i)=>n.setHours(i===12?0:i),H:(n,i)=>n.setHours(i===12?0:i),i:(n,i)=>n.setMinutes(i),s:(n,i)=>n.setSeconds(i),yyyy:(n,i)=>n.setFullYear(i),yy:(n,i)=>n.setFullYear((i<50?2e3:1900)+i),m:(n,i)=>{for(i-=1;i<0;)i+=12;for(i%=12,n.setMonth(i);n.getMonth()!==i;){if(isNaN(n.getMonth()))return n;n.setDate(n.getDate()-1)}return n},d:(n,i)=>n.setDate(i),p:(n,i)=>n.setHours(i===1&&n.getHours()<12?n.getHours()+12:n.getHours()),t:(n,i)=>n.setTime(i),mm:()=>{},M:()=>{},MM:()=>{},ii:()=>{},ss:()=>{},dd:()=>{},D:()=>{},DD:()=>{},P:()=>{}},t.mm=t.M=t.MM=t.m,t.ii=t.i,t.ss=t.s,t.dd=t.D=t.DD=t.d,t.P=t.p):(e=["Y","yy","m","M","F","n","d","D","j","l","N","S","H","G","h","g","i","s","p","P","U"],t={H:(n,i)=>n.setHours(i),G:(n,i)=>n.setHours(i),h:(n,i)=>n.setHours(i===12?0:i),g:(n,i)=>n.setHours(i===12?0:i),i:(n,i)=>n.setMinutes(i),s:(n,i)=>n.setSeconds(i),Y:(n,i)=>n.setFullYear(i),yy:(n,i)=>n.setFullYear((i<50?2e3:1900)+i),m:(n,i)=>{for(i-=1;i<0;)i+=12;for(i%=12,n.setMonth(i);n.getMonth()!==i;){if(isNaN(n.getMonth()))return n;n.setDate(n.getDate()-1)}return n},n:(n,i)=>n.setMonth(i-1),d:(n,i)=>n.setDate(i),a:(n,i)=>n.setHours(i===1?n.getHours()+12:n.getHours()),U:(n,i)=>n.setTime(i*1e3)},t.F=t.M=t.m,t.D=t.j=t.l=t.N=t.d,t.A=t.a),{setters_order:e,setters_map:t}}};function wm(r,e,t,n,i){if(t===0){let y=10,x=20,M=-1,A=[],N=[],R=r.getFullYear()-r.getFullYear()%10;R-=R%20?12:10,R%10&&(y=12,x=22);for(let H=0;H<32;H++)N.push(R+H),N.length===4&&(A.push(N),N=[]);let D=[];return e[0]||(e[0]=new Date),e[0].getFullYear()>=R&&D.push(e[0].getFullYear()%R),{years:A,todayMark:M,nextFrom:x,prevTo:y,selectionMark:D}}if(t===1){let y=[],x=[],M=12,A=24,N=r.toISOString().split("T")[0].substring(0,8),R=new Date(N+"01 00:00:00"),D=R.getFullYear()-1;R.setFullYear(D);let H=0;for(let ee=0;ee<3;ee++){for(let ie=0;ie<12;ie++)R.setMonth(ie),x.push(n.monthsShort[ie%12]),x.length===4&&(y.push(x),x=[]);R.setFullYear(R.getFullYear()+1)}let j=[];return e[0]||(e[0]=new Date),e[0].getFullYear()-D>=0&&e[0].getFullYear()-D<=2&&j.push(e[0].getMonth()+(e[0].getFullYear()-D||0)*12),{months:y,todayMark:H,nextFrom:A,prevTo:M,selectionMark:j}}let s=r||new Date,o=s.getFullYear(),a=s.getMonth(),u=s.getDate(),l=s.getHours(),d=new Date,c=new Date(o,a-1,28,0,0,0,0),f=ed(c.getFullYear(),c.getMonth());c.setDate(f),c.setDate(f-(c.getDay()-i+7)%7);let p=new Date(c);p.setDate(p.getDate()+42);let m=p.valueOf(),g=[],_=[],v=-1,k=[],S=0,T=42,E=0;for(;c.valueOf()<m;)E++,_.push(new Date(c)),c.getFullYear()<o||c.getFullYear()===o&&c.getMonth()<a?S=E:T===42&&(c.getFullYear()>o||c.getFullYear()===o&&c.getMonth()>a)&&(T=E-1),c.setDate(c.getDate()+1),c.getFullYear()===d.getFullYear()&&c.getMonth()===d.getMonth()&&c.getDate()===d.getDate()&&(v=E),k.length!==e.length&&e.map(y=>{c.getFullYear()===y.getFullYear()&&c.getMonth()===y.getMonth()&&c.getDate()===y.getDate()&&k.push(E)}),_.length===7&&(g.push(_),_=[]);return{grid:g,days:g,todayMark:v,prevTo:S,nextFrom:T,selectionMark:k}}function xm(r){let e=r-1;return e*e*e+1}function km(r,{duration:e=400,start:t=0,end:n=1,opacity:i=0}){let s=getComputedStyle(r),o=+s.opacity,a=s.transform==="none"?"":s.transform,u=1-t,l=o*(1-i);return n=n||1,{delay:0,duration:e,easing:xm,css:(d,c)=>`
|
|
transform: ${a} scale(${n!==1?t+n*c:1-u*c});
|
|
opacity: ${o-l*c};
|
|
`}}function Ev(r,e,t,n,i,s,o,a){if(P(e,-1),P(t,!0),h(n)&&oa(n,-1),h(n)===0){let u=Math.floor(h(i).getFullYear()/10)*10%20===0;P(s,u?o:a,!0)}}function Tv(r,e){e.onswitch?.("time")}var $v=G('<button type="button" class="std-btn std-btn-header icon-btn sdt-time-icon svelte-s6uyff"><svg class="sdt-svg svelte-s6uyff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zm.5 4.75a.75.75 0 00-1.5 0v3.5a.75.75 0 00.471.696l2.5 1a.75.75 0 00.557-1.392L8.5 7.742V4.75z"></path></svg></button>'),Mv=(r,e)=>e(-1),Ov=(r,e)=>e(1),Cv=(r,e,t)=>{e(h(t))},Av=G('<td><button type="button"> </button></td>'),Iv=G('<tr class="sdt-cal-td svelte-s6uyff"></tr>'),Dv=G('<table class="sdt-table svelte-s6uyff" style="max-height: 221px; height: 221px"><tbody></tbody></table>'),Rv=(r,e,t)=>{e(h(t))},Pv=G('<td><button type="button"> </button></td>'),Nv=G('<tr class="sdt-cal-td svelte-s6uyff"></tr>'),Lv=G('<table class="sdt-table svelte-s6uyff"><tbody></tbody></table>'),Bv=G('<th class="sdt-cal-th svelte-s6uyff"> </th>'),Fv=(r,e,t)=>{e(h(t))},zv=G('<td><button type="button"> </button></td>'),Vv=G("<tr></tr>"),Hv=G('<table class="sdt-table sdt-table-height svelte-s6uyff"><tbody><tr class="sdt-cal-td svelte-s6uyff"></tr><!></tbody></table>'),Gv=G('<div class="sdt-thead-nav svelte-s6uyff"><button type="button" class="std-btn std-btn-header sdt-toggle-btn svelte-s6uyff"> </button> <!> <button type="button" class="std-btn std-btn-header icon-btn svelte-s6uyff"><svg class="sdt-svg svelte-s6uyff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="24" height="24"><path d="M4.427 9.573l3.396-3.396a.25.25 0 01.354 0l3.396 3.396a.25.25 0 01-.177.427H4.604a.25.25 0 01-.177-.427z"></path></svg></button> <button type="button" class="std-btn std-btn-header icon-btn svelte-s6uyff"><svg class="sdt-svg svelte-s6uyff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="24" height="24"><path d="M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z"></path></svg></button> <div class="sdt-nav-btns svelte-s6uyff"></div></div> <div><!> <!> <!></div>',1),Uv={hash:"svelte-s6uyff",code:`td.svelte-s6uyff,th.svelte-s6uyff {padding:0;border-width:0;}.sdt-cal-td.svelte-s6uyff {padding:0;font-size:90%;text-align:center;
|
|
/* background-color: var(--sdt-bg-main, #fff); */}.sdt-cal-th.svelte-s6uyff {text-align:center;height:24px;}.sdt-calendar.svelte-s6uyff {height:221px;overflow:hidden;}.sdt-calendar.is-grid.svelte-s6uyff {display:grid;}.sdt-calendar.is-grid.svelte-s6uyff .sdt-table:where(.svelte-s6uyff) {grid-column:1/2;grid-row:1/2;}.sdt-table.svelte-s6uyff {width:100%;border-collapse:collapse;margin:0;background-color:var(--sdt-table-bg, transparent);}.sdt-table-height.svelte-s6uyff {height:222px;}.animate-transition.svelte-s6uyff {will-change:transform;transition:transform .3s ease;}.not-current.svelte-s6uyff {opacity:0.3;}.not-current.svelte-s6uyff:hover {opacity:0.55;}.std-btn.svelte-s6uyff {margin:0;border:0;background:transparent;text-align:center;width:100%;border-radius:4px;cursor:pointer;padding:0.3rem;box-sizing:border-box;color:var(--sdt-color, initial);}.sdt-btn-day.svelte-s6uyff {max-height:32px;height:32px;}.std-btn[disabled].svelte-s6uyff {cursor:not-allowed;opacity:0.5;color:var(--sdt-table-disabled-date, #b22222);background-color:var(--sdt-table-disabled-date-bg, var(--sdt-bg-main, #fff));}.std-btn-header.svelte-s6uyff {width:auto;font-weight:bold;padding:0.375em 0.5em;color:var(--sdt-header-color, var(--sdt-color, initial));}.std-btn-header.icon-btn.svelte-s6uyff:first-of-type {padding-left:0.375em;padding-right:0.375em;}.std-btn-header.icon-btn.svelte-s6uyff {padding-left:0.25em;padding-right:0.25em;}.std-btn.svelte-s6uyff:hover {background-color:var(--sdt-table-data-bg-hover, #eee);}.is-selected.in-range.svelte-s6uyff .std-btn:where(.svelte-s6uyff) {border-radius:4px 0 0 4px}.in-range.svelte-s6uyff .std-btn:where(.svelte-s6uyff),
|
|
.in-range-hover.svelte-s6uyff:not(.is-selected) .std-btn:where(.svelte-s6uyff) {background-color:color-mix(in srgb, transparent 75%, var(--sdt-bg-selected, #286090));border-radius:0;}
|
|
/* range selection: start */.in-range-hover.is-selected:has(+ .in-range-hover) .std-btn {border-top-right-radius:0;border-bottom-right-radius:0;}.in-range-hover.svelte-s6uyff + .in-range-hover.is-selected:where(.svelte-s6uyff) .std-btn:where(.svelte-s6uyff) {border-top-left-radius:0;border-bottom-left-radius:0;}.in-range.svelte-s6uyff:not(.is-selected) .std-btn:where(.svelte-s6uyff):hover {background-color:color-mix(in srgb, var(--sdt-table-data-bg-hover, #eee) 75%, var(--sdt-bg-selected, #286090));}
|
|
/* range selection: end */.in-range.svelte-s6uyff + .is-selected:where(.svelte-s6uyff) .std-btn:where(.svelte-s6uyff),
|
|
.is-selected.svelte-s6uyff + .is-selected:where(.svelte-s6uyff) .std-btn:where(.svelte-s6uyff) {border-top-left-radius:0;border-bottom-left-radius:0;}.is-selected.svelte-s6uyff + .is-selected:where(.svelte-s6uyff) .std-btn:where(.svelte-s6uyff) {border-left:1px solid color-mix(in srgb, white 75%, var(--sdt-table-selected-bg, var(--sdt-bg-selected, #286090)));margin-left:-1px;}.is-selected.svelte-s6uyff .std-btn:where(.svelte-s6uyff),
|
|
.is-selected.in-range.svelte-s6uyff .std-btn:where(.svelte-s6uyff) {background-color:var(--sdt-table-selected-bg, var(--sdt-bg-selected, #286090));color:var(--sdt-color-selected, var(--sdt-bg-main, #fff));opacity:0.9;}.std-btn-header.svelte-s6uyff:hover {background-color:var(--sdt-header-btn-bg-hover, #dfdfdf);}.sdt-time-icon.svelte-s6uyff {display:inline-flex;align-items:center;padding:0.375em !important;}.sdt-time-icon.svelte-s6uyff svg:where(.svelte-s6uyff) {height:1em !important;stroke:initial !important;}.sdt-tbody-lg.svelte-s6uyff {background-color:var(--sdt-bg-main, #fff);}.sdt-tbody-lg.svelte-s6uyff .std-btn:where(.svelte-s6uyff) {height:74px;}.sdt-thead-nav.svelte-s6uyff {display:flex;margin-bottom:0.25em;align-items:stretch;}.sdt-nav-btns.svelte-s6uyff {white-space:nowrap;}.sdt-toggle-btn.svelte-s6uyff {width:100%;text-align:left;}.sdt-today.svelte-s6uyff {position:relative;}.sdt-today.svelte-s6uyff:before {box-sizing:border-box;position:absolute;content:'';margin-left:4px;margin-top:4px;border-left:4px solid var(--sdt-table-today-indicator, #ccc);border-top:4px solid var(--sdt-table-today-indicator, #ccc);border-bottom:4px solid transparent;border-right:4px solid transparent;border-radius:2px;height:4px;z-index:2;}.sdt-svg.svelte-s6uyff {fill:var(--sdt-header-color, initial);}.sdt-today.svelte-s6uyff:hover:before,
|
|
.in-range.sdt-today.svelte-s6uyff:before {border-left-color:var(--sdt-bg-selected, #286090);border-top-color:var(--sdt-bg-selected, #286090);}.is-selected.sdt-today.svelte-s6uyff:before
|
|
{border-left-color:#eee;border-top-color:#eee;}`};function td(r,e){ve(e,!0),ii(r,Uv);let t=B(e,"wid",3,0),n=B(e,"dates",19,()=>[]),i=B(e,"startDate",3,null),s=B(e,"endDate",3,null),o=B(e,"weekStart",3,1),a=B(e,"initialView",3,2),u=B(e,"enableTimeToggle",3,!1),l=B(e,"isRange",3,!1),d=B(e,"hoverDate",15,null);function c(X,he){if(h(_)!==2){P(_,2,!0),P(v,1),P(m,new dt(p||new Date),!0);return}if(!p){Ae(new Date,{keyboard:!0});return}let oe=new Date(p);switch(X){case"PageDown":he=!0;case"ArrowDown":he?oe.setMonth(p.getMonth()+1):oe.setDate(p.getDate()+7),he&&oe.getMonth()===p.getMonth()&&oe.setDate(0),Ae(oe,{keyboard:!0});break;case"PageUp":he=!0;case"ArrowUp":he?oe.setMonth(p.getMonth()-1):oe.setDate(p.getDate()-7),he&&oe.getMonth()===p.getMonth()&&oe.setDate(0),Ae(oe,{keyboard:!0});break;case"ArrowLeft":he?oe.setFullYear(p.getFullYear()-1):oe.setDate(p.getDate()-1),Ae(oe,{keyboard:!0});break;case"ArrowRight":he?oe.setFullYear(p.getFullYear()+1):oe.setDate(p.getDate()+1),Ae(oe,{keyboard:!0});break}}function f(X){h(m).setTime(X.getTime()),p=new Date(X.getTime())}let p=n()[t()]||null,m=ae(De(t()===1?(()=>{if(n().length===2&&n()[1]&&(n()[0].getMonth()!=n()[1].getMonth()||n()[0].getFullYear()!=n()[1].getFullYear()))return new dt(n()[1]);let X=new Date(n()[0]||new Date);return X.setMonth(X.getMonth()+1),new dt(X)})():new dt(n()[0]?.valueOf()||new Date))),g=ne(()=>i()?new dt(i().getFullYear(),i().getMonth(),i().getDate(),0,0,0,0):null),_=ae(De(a())),v=ae(-2),k=ae(!1),S=400,T=ne(()=>h(v)<1?1.5:.5),E=ne(()=>h(v)<1?1:1.5),y=222,x=148,M=ae(y),A=ae(null),N=ne(()=>h(v)===-2?Pi:h(v)!==null?km:()=>({})),R=ne(()=>n().map(X=>(X=new Date(X),X.setHours(0,0,0,0),X.getTime()))),D=ne(()=>wm(h(m),Xo(n()),h(_),e.i18n,o())),H=ne(()=>e.i18n.daysMin.concat(...e.i18n.daysMin.slice(1)).slice(o(),7+o())),j=ne(()=>e.i18n&&ye(h(_),h(m)));function ee(X){return h(D).prevTo<=X&&X<h(D).nextFrom}function ie(X){switch(h(_)){case 2:if(h(g)&&h(g)>X||s()&&s()<=X||e.additionalDisableFn&&e.additionalDisableFn(X))return!0;break;case 1:let he=X.getFullYear(),oe=h(g)?.getFullYear(),Fe=s()?.getFullYear();if(oe&&h(g)&&(oe===he&&h(g).getMonth()>X.getMonth()||oe>he)||Fe&&s()&&(Fe===he&&s().getMonth()<X.getMonth()||Fe<he))return!0;break;case 0:if(h(g)&&h(g).getFullYear()>X.getFullYear()||s()&&s().getFullYear()<X.getFullYear())return!0;break}return!1}function Me(X,he,oe){let Fe=he===1,at=Fe?s():h(g);return at?oe===0?Fe?X.getFullYear()+he*10>at.getFullYear():X.getFullYear()+he*10<at.getFullYear():oe===1?Fe?X.getFullYear()+he>at.getFullYear():X.getFullYear()+he<at.getFullYear():Fe?X.getFullYear()*100+X.getMonth()+he>at.getFullYear()*100+at.getMonth():X.getFullYear()*100+X.getMonth()+he<at.getFullYear()*100+at.getMonth():!1}function Se(X){let he=h(_)===0?120:h(_)===1?12:1;h(m).getDate()>28&&h(m).setDate(h(m).getDate()-3),h(m).setMonth(h(m).getMonth()+X*he),P(A,null),P(M,h(_)===0?h(m).getFullYear()%20>=10?y:x:y,!0)}function ge(X){if(h(_)===2)return Se(X);if(P(A,()=>{Se(X)}),h(_)===0){P(M,h(M)===x?X===-1?h(M)-y:y+x:X===-1?h(M)-y:h(M)+x,!0);return}P(M,X===-1?h(M)-y:h(M)+y,!0)}function Ae(X,{keyboard:he}={}){switch(P(v,1),P(k,!0),h(_)){case 0:h(m).setFullYear(X),P(m,h(m),!0);break;case 1:h(m).setMonth(e.i18n.monthsShort.indexOf(X)),P(m,h(m),!0);break;case 2:if(ie(X)||e.additionalDisableFn&&e.additionalDisableFn(X))return;let oe=new Date(X.getFullYear(),X.getMonth(),X.getDate());p&&(oe.setMinutes(p.getMinutes()),oe.setHours(p.getHours())),p=oe,he&&(h(m).getFullYear()!==oe.getFullYear()||h(m).getFullYear()===oe.getFullYear()&&h(m).getMonth()!==oe.getMonth())&&(h(m).setFullYear(oe.getFullYear()),h(m).getDate()>28&&h(m).setDate(28),h(m).setMonth(oe.getMonth()),P(m,h(m),!0)),e.onupdate?.({type:"date",date:p,isKeyboard:he});break}h(_)<2&&oa(_),P(M,y)}$t(()=>{n().length===0&&(p=null)});function Be(){P(k,!1)}function ye(X,he){switch(X){case 0:let oe=h(D).years[Math.floor(h(D).prevTo/4)][h(D).prevTo%4],Fe=h(D).years[Math.floor(h(D).nextFrom/4)][h(D).nextFrom%4];return`${oe} - ${Fe}`;case 1:return he.getFullYear();case 2:return e.i18n.months[he.getMonth()]+" "+he.getFullYear()}}function Ue(X=null){return function(he){d(X?.getTime()||null),e.onhoverupdate?.(d())}}function tt(X){return h(R).length===2?X>=h(R)[0]&&X<h(R)[1]:!1}function Ve(X,he){return he&&h(R).length===1&&(X<=he&&h(R)[0]<=X||X>=he&&h(R)[0]>=X)}var $e=Gv(),Ne=Te($e),Xt=K(Ne);Xt.__click=[Ev,v,k,_,m,M,x,y];var Ke=K(Xt,!0);q(Xt);var L=F(Xt,2);{var U=X=>{var he=$v();he.__click=[Tv,e],fe(()=>{Re(he,"title",e.i18n.timeView),Re(he,"aria-label",e.i18n.timeView)}),V(X,he)};pe(L,X=>{u()&&n().length&&X(U)})}var ue=F(L,2);ue.__click=[Mv,ge];var se=F(ue,2);se.__click=[Ov,ge],Qs(2),q(Ne);var He=F(Ne,2);let Ee;var _e=K(He);{var je=X=>{var he=Dv(),oe=K(he);let Fe;Xe(oe,21,()=>h(D).years,st,(at,gr,_r)=>{var Mt=Iv();Xe(Mt,21,()=>h(gr),st,(vr,br,Ft)=>{var wt=Av();let zt=ne(()=>_r*4+Ft),Vt;var _t=K(wt);let Zt;_t.__click=[Cv,Ae,br];var yr=K(_t,!0);q(_t),q(wt),fe((kn,Ar,xt)=>{Vt=ke(wt,1,"sdt-cal-td svelte-s6uyff",null,Vt,kn),Zt=ke(_t,1,"std-btn svelte-s6uyff",null,Zt,Ar),_t.disabled=xt,qe(yr,h(br))},[()=>({"is-selected":h(D).selectionMark.includes(h(zt))}),()=>({"not-current":!ee(h(zt))}),()=>ie(new Date(h(br),h(m).getMonth(),h(m).getDate()))]),V(vr,wt)}),q(Mt),V(at,Mt)}),q(oe),q(he),fe(at=>{Fe=ke(oe,1,"sdt-tbody-lg svelte-s6uyff",null,Fe,at),rn(oe,`transform: translateY(-${h(M)}px); color: red`)},[()=>({"animate-transition":!!h(A)})]),Bt("outroend",oe,Be),Bt("transitionend",oe,()=>h(A)&&h(A)()),Kt(1,oe,()=>h(N),()=>({duration:S,start:h(T),opacity:1})),Kt(2,oe,()=>h(N),()=>({duration:S,end:h(E),start:1})),V(X,he)};pe(_e,X=>{h(_)===0&&X(je)})}var ot=F(_e,2);{var We=X=>{var he=Lv(),oe=K(he);let Fe;Xe(oe,21,()=>h(D).months,st,(at,gr,_r)=>{var Mt=Nv();Xe(Mt,21,()=>h(gr),st,(vr,br,Ft)=>{var wt=Pv();let zt=ne(()=>_r*4+Ft),Vt;var _t=K(wt);let Zt;_t.__click=[Rv,Ae,br];var yr=K(_t,!0);q(_t),q(wt),fe((kn,Ar,xt)=>{Vt=ke(wt,1,"sdt-cal-td svelte-s6uyff",null,Vt,kn),Zt=ke(_t,1,"std-btn svelte-s6uyff",null,Zt,Ar),_t.disabled=xt,qe(yr,h(br))},[()=>({"is-selected":h(zt)===h(D).selectionMark[0]}),()=>({"not-current":!ee(h(zt))}),()=>ie(new Date(h(m).getFullYear(),e.i18n.monthsShort.indexOf(h(br)),h(m).getDate()))]),V(vr,wt)}),q(Mt),V(at,Mt)}),q(oe),q(he),fe(at=>{Fe=ke(oe,1,"sdt-tbody-lg svelte-s6uyff",null,Fe,at),rn(oe,`transform: translateY(-${h(M)}px)`)},[()=>({"animate-transition":!!h(A)})]),Bt("outroend",oe,Be),Bt("transitionend",oe,()=>h(A)&&h(A)()),Kt(1,oe,()=>h(N),()=>({duration:S,start:h(T),opacity:1})),Kt(2,oe,()=>h(N),()=>({duration:S,end:h(E),start:1})),V(X,he)};pe(ot,X=>{h(_)===1&&X(We)})}var Le=F(ot,2);{var pt=X=>{var he=Hv(),oe=K(he),Fe=K(oe);Xe(Fe,21,()=>h(H),st,(gr,_r)=>{var Mt=Bv(),vr=K(Mt,!0);q(Mt),fe(()=>qe(vr,h(_r))),V(gr,Mt)}),q(Fe);var at=F(Fe);Xe(at,17,()=>h(D).days,st,(gr,_r,Mt)=>{var vr=Vv();Xe(vr,21,()=>h(_r),st,(br,Ft,wt)=>{var zt=zv();let Vt=ne(()=>Mt*7+wt),_t=ne(()=>h(Ft).getTime()),Zt;var yr=ne(()=>Ue(h(Ft)));zt.__mouseover=function(...on){h(yr)?.apply(this,on)};var kn=ne(Ue);zt.__mouseout=function(...on){h(kn)?.apply(this,on)};var Ar=K(zt);Ar.__click=[Fv,Ae,Ft];let xt;var Bi=K(Ar,!0);q(Ar),q(zt),fe((on,Fi,ms,mo)=>{Zt=ke(zt,1,"sdt-cal-td svelte-s6uyff",null,Zt,on),xt=ke(Ar,1,"std-btn sdt-btn-day svelte-s6uyff",null,xt,Fi),Ar.disabled=ms,qe(Bi,mo)},[()=>({"sdt-today":h(Vt)===h(D).todayMark,"in-range":tt(h(_t)),"is-selected":h(R).includes(h(_t)),"in-range-hover":l()&&Ve(h(_t),d())}),()=>({"not-current":!ee(Mt*7+wt)}),()=>(h(g)||s()||e.additionalDisableFn)&&ie(h(Ft)),()=>h(Ft).getDate()]),V(br,zt)}),q(vr),V(gr,vr)}),q(oe),q(he),Bt("outroend",oe,Be),Kt(1,oe,()=>h(N),()=>({duration:S,start:.5,opacity:1})),Kt(2,oe,()=>h(N),()=>({duration:S,start:Math.abs(h(v))})),V(X,he)};pe(Le,X=>{h(_)===2&&X(pt)})}return q(He),fe((X,he,oe,Fe,at,gr,_r)=>{qe(Ke,h(j)),Re(ue,"title",X),Re(ue,"aria-label",he),ue.disabled=oe,Re(se,"title",Fe),Re(se,"aria-label",at),se.disabled=gr,Ee=ke(He,1,"sdt-calendar svelte-s6uyff",null,Ee,_r)},[()=>e.i18n.months[(h(m).getMonth()-1)%12],()=>e.i18n.months[(h(m).getMonth()-1)%12],()=>Me(h(m),-1,h(_)),()=>e.i18n.months[(h(m).getMonth()+1)%12],()=>e.i18n.months[(h(m).getMonth()+1)%12],()=>Me(h(m),1,h(_)),()=>({"is-grid":h(k)})]),V(r,$e),be({handleGridNav:c,focusDate:f})}Ye(["click","mouseover","mouseout"]);function qv(r,e,t,n,i,s){let o=parseInt(r.target.dataset.value);h(e).setHours(o),P(e,h(e),!0),t.onupdate?.({type:h(n)?"minute":"hour",date:i(h(e)),isKeyboard:r.type==="keyboard",dateIndex:s()})}function Sm(r,e){P(e,r.type==="mousedown")}function jv(r,e){e.onswitch("date")}var Yv=G('<button type="button" class="sdt-time-btn sdt-back-btn svelte-1piwi8e"><svg class="sdt-svg svelte-1piwi8e" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20"><path fill-rule="evenodd" d="M6.75 0a.75.75 0 01.75.75V3h9V.75a.75.75 0 011.5 0V3h2.75c.966 0 1.75.784 1.75 1.75v16a1.75 1.75 0 01-1.75 1.75H3.25a1.75 1.75 0 01-1.75-1.75v-16C1.5 3.784 2.284 3 3.25 3H6V.75A.75.75 0 016.75 0zm-3.5 4.5a.25.25 0 00-.25.25V8h18V4.75a.25.25 0 00-.25-.25H3.25zM21 9.5H3v11.25c0 .138.112.25.25.25h17.5a.25.25 0 00.25-.25V9.5z" class="svelte-1piwi8e"></path></svg></button>'),Wv=(r,e)=>P(e,!1),Jv=(r,e)=>P(e,!0),Kv=G('<button type="button"> </button> <span class="svelte-1piwi8e">:</span> <button type="button"> </button>',1),Qv=G('<span class="sdt-time-figure svelte-1piwi8e"> </span>'),Xv=G('<span class="svelte-1piwi8e">:</span> <span class="sdt-time-figure svelte-1piwi8e">00</span>',1),Zv=G('<span class="sdt-time-figure svelte-1piwi8e"> </span> <!>',1),eb=G('<div class="sdt-meridian svelte-1piwi8e"><button type="button" class="sdt-time-btn sdt-time-figure is-active svelte-1piwi8e"> </button></div>'),tb=(r,e)=>{r.preventDefault(),e(r)},rb=(r,e,t)=>{h(e)&&t(r)},nb=G('<button type="button"> </button>'),ib=G('<button type="button"> </button>'),sb=G('<div class="sdt-timer svelte-1piwi8e"><div class="sdt-time-head svelte-1piwi8e"><!> <!> <!></div> <div><div class="sdt-middle-dot svelte-1piwi8e"></div> <div class="sdt-hand-pointer svelte-1piwi8e"><div class="sdt-hand-circle svelte-1piwi8e"></div></div> <!> <!></div></div>'),ob={hash:"svelte-1piwi8e",code:`.sdt-timer.svelte-1piwi8e {position:relative;
|
|
/* width: 272px; */--sdt-clock-size: 220px;}.sdt-time-head.svelte-1piwi8e {position:relative;display:flex;justify-content:center;align-items:center;margin-bottom:4px;color:var(--sdt-header-color, initial);}.sdt-time-figure.svelte-1piwi8e {font-size:1.5em;font-weight:bold;padding:0 0.375em;}.sdt-time-figure.svelte-1piwi8e + .sdt-time-figure:where(.svelte-1piwi8e) {margin-left:-12px;}.sdt-clock.svelte-1piwi8e {margin:auto;position:relative;width:var(--sdt-clock-size);height:var(--sdt-clock-size);background-color:var(--sdt-clock-bg, #eeeded);border-radius:50%;transition:background-color 0.3s;overflow:hidden;}.sdt-time-btn.svelte-1piwi8e {border:0;background:transparent;text-align:center;border-radius:4px;cursor:pointer;height:38px;padding:0 0.375em;color:var(--sdt-header-color, initial);}.sdt-time-btn.svelte-1piwi8e > svg:where(.svelte-1piwi8e) {stroke:initial !important;}.sdt-svg.svelte-1piwi8e {fill:var(--sdt-header-color, initial);}.sdt-time-btn.svelte-1piwi8e:not(.is-active) {opacity:0.5;}.sdt-time-btn.svelte-1piwi8e:hover {background-color:var(--sdt-header-btn-bg-hover, #dfdfdf);}.sdt-back-btn.svelte-1piwi8e {position:absolute;top:0;left:0;padding:0.3em;opacity:1 !important;}.sdt-meridian.svelte-1piwi8e {position:absolute;top:0;right:0;display:flex;}.sdt-meridian.svelte-1piwi8e .sdt-time-btn:where(.svelte-1piwi8e) {width:56px;font-weight:bold;}.sdt-middle-dot.svelte-1piwi8e {left:50%;top:50%;width:6px;height:6px;position:absolute;transform:translate(-50%, -50%);background-color:var(--sdt-clock-selected-bg, var(--sdt-bg-selected, #286090));border-radius:50%;}.sdt-hand-pointer.svelte-1piwi8e {width:2px;height:calc(40% - 3px);bottom:50%;left:calc(50% - 1px);position:absolute;background-color:var(--sdt-clock-selected-bg, var(--sdt-bg-selected, #286090));transform-origin:center bottom 0;transition:transform 0.3s ease, height 0.15s ease;}.sdt-hand-circle.svelte-1piwi8e {left:-15px;top:-21px;position:relative;width:4px;height:4px;background-color:transparent;border:14px solid var(--sdt-clock-selected-bg, var(--sdt-bg-selected, #286090));border-radius:50%;box-sizing:content-box;}.sdt-tick.svelte-1piwi8e {position:absolute;width:30px;height:30px;border-width:0;transform:translate(-50%, -50%);text-align:center;border-radius:50%;line-height:20px;cursor:pointer;background-color:var(--sdt-clock-time-bg);transition:all 0.3s;color:var(--sdt-clock-color, inherit);}.sdt-tick.svelte-1piwi8e:hover {color:var(--sdt-clock-color-hover);background-color:var(--sdt-clock-time-bg-hover);}.sdt-tick[disabled].svelte-1piwi8e {cursor:not-allowed;color:var(--sdt-clock-disabled, #b22222);background-color:var(--sdt-clock-disabled-bg, var(--sdt-clock-bg, transparent));}.sdt-tick.outer-tick.svelte-1piwi8e {opacity:0;}.sdt-tick.is-selected.svelte-1piwi8e {
|
|
animation: svelte-1piwi8e-tick-selection 0s 0.175s ease-out forwards;}
|
|
@keyframes svelte-1piwi8e-tick-selection {
|
|
0% {
|
|
color: initial;
|
|
background-color: transparent;
|
|
}
|
|
100% {
|
|
background-color: var(--sdt-clock-selected-bg, var(--sdt-bg-selected, #286090));
|
|
color: var(--sdt-color-selected, var(--sdt-bg-main, #fff));
|
|
}
|
|
}`};function rd(r,e){ve(e,!0),ii(r,ob);let t=B(e,"wid",3,0),n=B(e,"date",27,()=>De(new dt)),i=B(e,"startDate",3,void 0),s=B(e,"endDate",3,void 0),o=B(e,"hourOnly",3,!1),a=B(e,"minuteIncrement",3,1),u=B(e,"showMeridian",3,!1),l=B(e,"hasDateComponent",3,!1);function d(){P(p,!0)}function c(L){h(p)?(L=L*5+h(S),L%5!==0&&(L=L<h(S)?L+(5-L%5):L-L%5)):L=h(v)+L,P(g,!1),ee({type:"keyboard",target:{tagName:"BUTTON",dataset:{value:L}}}),P(g,!0)}let f,p=ae(!1),m=ae(!1),g=ae(!0),_=ae(De(function(){let L=new dt;return L.setHours(0,0),L}()));x(n());let v=ne(()=>h(_)?.getHours()||0),k=ne(()=>u()?h(v)>=12:!1),S=ne(()=>h(_)?.getMinutes()||0),T=ne(()=>{let L=h(p)?h(S)*6:h(v)%12*30;return h(p)||u()||h(v)<12?`transform: rotateZ(${L}deg);`:`transform: rotateZ(${L}deg); height: calc(25% + 1px)`}),E=ne(()=>h(p)?5:1),y=ne(()=>i()&&s()&&["getFullYear","getMonth","getDate"].every(L=>s()[L]()===i()[L]()));function x(L){if(h(_)?.valueOf()!==L?.valueOf()&&L)P(_,new dt(L),!0);else if(!L)if(P(p,!1),h(_))h(_).setHours(0,0);else{let U=new dt;U.setHours(0,0),P(_,U,!0)}}function M(L){let U=!1;return i()&&i().toDateString()===L.toDateString()&&(j(L.getHours())&&(L.setHours(i().getHours()),U=!0),j(L.getMinutes(),!0)&&(L.setMinutes(i().getMinutes()),U=!0)),s()&&s().toDateString()===L.toDateString()&&(j(L.getHours())&&(L.setHours(s().getHours()),U=!0),j(L.getMinutes(),!0)&&(L.setMinutes(s().getMinutes()),U=!0)),L}function A(L,U,ue,se,He){let Ee=L/2;U=U||Ee;let _e=[0,1-.5,1-.134,1,1-.134,1-.5],je=_e.concat(_e),ot=_e.slice(3).concat(_e).concat(_e.slice(0,3)),We=[];for(let Le=0;Le<12;Le++)We.push({x:Math.abs(je[Le]*Ee+(Le<=6?1:-1)*U),y:Math.abs(ot[Le]*Ee+(Le>=9||Le<3?-1:1)*U),val:se?Le*5||ue:Le?Le+He:ue});return We}let N=ne(()=>A(h(p)?220:180,110,"00",!1,0)),R=ne(()=>A(h(p)?180:120,110,h(p)?"00":"12",h(p),12));function D(L,U){return U?h(k)&&L===12?12:L<10||L%12<10?`0${L%12}`:L%12:L<10?`0${L}`:L}function H(L,U,ue){return h(p)?U===L||ue===0&&ue===L:u()?h(k)&&U==12&&L===12||!h(k)&&U==12&&L===0?!0:U===(L?L%12:12):+U>12?(ue?h(E)*ue+12:0)===L:U==="00"||U==="12"?L===12&&parseInt(U)==12||U==="00"&&L===0:U===L}function j(L,U=!1){return typeof L=="string"&&(L=parseInt(L)),i()&&s()&&h(y)?h(p)||U?i().getHours()===h(_).getHours()&&i().getMinutes()>L||s().getHours()===h(_).getHours()&&s().getMinutes()<L:i().getHours()>L||s().getHours()<L:i()&&i().getDate()===h(_).getDate()&&i().getMonth()===h(_).getMonth()&&i().getFullYear()===h(_).getFullYear()?h(p)||U?i().getHours()===h(_).getHours()&&i().getMinutes()>L:i().getHours()>L:s()&&s().getDate()===h(_).getDate()&&s().getMonth()===h(_).getMonth()&&s().getFullYear()===h(_).getFullYear()?h(p)||U?s().getHours()===h(_).getHours()&&s().getMinutes()<L:s().getHours()<L:!1}function ee(L){if(!L.target)return;let U=0,ue=0;if(L.target.tagName==="BUTTON"){let se=parseInt(L.target.dataset.value);if(!h(p)&&h(k)&&(se+=12),h(p)&&a()!==1){if(L.isKeyboard)se=se>h(S)?h(S)+a():h(S)-a();else if(se%a()!==0){let He=se%a(),Ee=se-He,_e=Ee+a();se=_e-se<se-Ee?_e:Ee}}h(p)?h(_).setMinutes(se):h(_).setHours(se)}else if(h(p)){let se=f.getBoundingClientRect(),He=L.clientX-se.left,Ee=L.clientY-se.top,_e=110,je=110,ot=null;switch(He>_e?ot=Ee>je?2:1:ot=Ee>je?3:4,ot){case 1:U=He-_e,ue=je-Ee;break;case 2:U=He-_e,ue=Ee-je;break;case 3:U=_e-He,ue=Ee-je;break;case 4:U=_e-He,ue=je-Ee;break}let We=Math.sqrt(U*U+ue*ue),Le=90-Math.asin(U/We)*(180/Math.PI),pt=0;switch(ot){case 1:pt=90-Le;break;case 2:pt=Le+90;break;case 3:pt=270-Le;break;case 4:pt=Le+270;break}pt=Math.round(pt/6/a())*a(),pt>=60&&(pt=0),h(_).setMinutes(pt)}else return;h(m)||(e.onupdate?.({type:h(p)?"minute":"hour",date:M(h(_)),isKeyboard:L.type==="keyboard",dateIndex:t()}),L.type!=="keyboard"&&!h(p)&&!o()&&P(p,!0))}$t(()=>{x(n())});var ie=sb(),Me=K(ie),Se=K(Me);{var ge=L=>{var U=Yv();U.__click=[jv,e],fe(()=>{Re(U,"title",e.i18n.backToDate),Re(U,"aria-label",e.i18n.backToDate)}),V(L,U)};pe(Se,L=>{l()&&L(ge)})}var Ae=F(Se,2);{var Be=L=>{var U=Kv(),ue=Te(U);let se;ue.__click=[Wv,p];var He=K(ue,!0);q(ue);var Ee=F(ue,4);let _e;Ee.__click=[Jv,p];var je=K(Ee,!0);q(Ee),fe((ot,We,Le,pt)=>{se=ke(ue,1,"sdt-time-btn sdt-time-figure svelte-1piwi8e",null,se,ot),qe(He,We),_e=ke(Ee,1,"sdt-time-btn sdt-time-figure svelte-1piwi8e",null,_e,Le),qe(je,pt)},[()=>({"is-active":!h(p)}),()=>D(h(v),u()),()=>({"is-active":h(p)}),()=>D(h(S),!1)]),V(L,U)},ye=L=>{var U=Zv(),ue=Te(U),se=K(ue,!0);q(ue);var He=F(ue,2);{var Ee=je=>{var ot=Qv(),We=K(ot,!0);q(ot),fe(Le=>qe(We,Le),[()=>(h(k)?e.i18n.meridiem[1]:e.i18n.meridiem[0]).toUpperCase()]),V(je,ot)},_e=je=>{var ot=Xv();Qs(2),V(je,ot)};pe(He,je=>{u()?je(Ee):je(_e,!1)})}fe(je=>qe(se,je),[()=>D(h(v),u())]),V(L,U)};pe(Ae,L=>{o()?L(ye,!1):L(Be)})}var Ue=F(Ae,2);{var tt=L=>{var U=eb(),ue=K(U);ue.__click=[qv,_,e,p,M,t];var se=K(ue,!0);q(ue),q(U),fe(()=>{Re(ue,"data-value",h(k)?h(v)%12:h(v)+12),qe(se,h(k)?e.i18n.meridiem[1]:e.i18n.meridiem[0])}),V(L,U)};pe(Ue,L=>{u()&&L(tt)})}q(Me);var Ve=F(Me,2);let $e;Ve.__click=[tb,ee],Ve.__mousedown=[Sm,m],Ve.__mousemove=[rb,m,ee],Ve.__mouseup=[Sm,m];var Ne=F(K(Ve),2),Xt=F(Ne,2);Xe(Xt,19,()=>h(N),L=>L.val,(L,U,ue)=>{var se=nb();let He;var Ee=K(se,!0);q(se),fe((_e,je)=>{rn(se,`left:${h(U).x}px; top:${h(U).y}px;`),He=ke(se,1,"sdt-tick svelte-1piwi8e",null,He,_e),Re(se,"data-value",h(U).val),se.disabled=je,qe(Ee,h(U).val)},[()=>({"outer-tick":h(p),"is-selected":H(h(v),h(U).val,h(ue))}),()=>(i()||s())&&h(_)&&j(h(U).val,!1)]),Kt(3,se,()=>Pi,()=>({duration:200})),V(L,se)});var Ke=F(Xt,2);return Xe(Ke,17,()=>h(R),st,(L,U,ue)=>{var se=ib();let He;var Ee=K(se,!0);q(se),fe((_e,je)=>{rn(se,`left:${h(U).x}px; top:${h(U).y}px;`),He=ke(se,1,"sdt-tick svelte-1piwi8e",null,He,_e),Re(se,"data-value",h(U).val),se.disabled=je,qe(Ee,h(U).val)},[()=>({"outer-tick":u()&&!h(p),"is-selected":H(h(p)?h(S):h(v),h(U).val,ue)}),()=>(i()||s())&&h(_)&&j(h(U).val,!1)]),Kt(3,se,()=>Pi,()=>({duration:200})),V(L,se)}),q(Ve),_n(Ve,L=>f=L,()=>f),q(ie),fe(L=>{$e=ke(Ve,1,"sdt-clock svelte-1piwi8e",null,$e,L),rn(Ne,h(T))},[()=>({"is-minute-view":h(p)})]),Kt(1,ie,()=>Pi,()=>({duration:200})),V(r,ie),be({showMinuteView:d,makeTick:c})}Ye(["click","mousedown","mousemove","mouseup"]);var ao=Math.min,ui=Math.max,Ta=Math.round,$a=Math.floor,bn=r=>({x:r,y:r}),ab={left:"right",right:"left",bottom:"top",top:"bottom"},ub={start:"end",end:"start"};function nd(r,e,t){return ui(r,ao(e,t))}function Sl(r,e){return typeof r=="function"?r(e):r}function ls(r){return r.split("-")[0]}function El(r){return r.split("-")[1]}function id(r){return r==="x"?"y":"x"}function sd(r){return r==="y"?"height":"width"}function cs(r){return["top","bottom"].includes(ls(r))?"y":"x"}function od(r){return id(cs(r))}function Em(r,e,t){t===void 0&&(t=!1);let n=El(r),i=od(r),s=sd(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ea(o)),[o,Ea(o)]}function Tm(r){let e=Ea(r);return[kl(r),e,kl(e)]}function kl(r){return r.replace(/start|end/g,e=>ub[e])}function lb(r,e,t){let n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(r){case"top":case"bottom":return t?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function $m(r,e,t,n){let i=El(r),s=lb(ls(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(kl)))),s}function Ea(r){return r.replace(/left|right|bottom|top/g,e=>ab[e])}function cb(r){return{top:0,right:0,bottom:0,left:0,...r}}function Mm(r){return typeof r!="number"?cb(r):{top:r,right:r,bottom:r,left:r}}function fs(r){let{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Om(r,e,t){let{reference:n,floating:i}=r,s=cs(e),o=od(e),a=sd(o),u=ls(e),l=s==="y",d=n.x+n.width/2-i.width/2,c=n.y+n.height/2-i.height/2,f=n[a]/2-i[a]/2,p;switch(u){case"top":p={x:d,y:n.y-i.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:c};break;case"left":p={x:n.x-i.width,y:c};break;default:p={x:n.x,y:n.y}}switch(El(e)){case"start":p[o]-=f*(t&&l?-1:1);break;case"end":p[o]+=f*(t&&l?-1:1);break}return p}var Cm=async(r,e,t)=>{let{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e)),l=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:d,y:c}=Om(l,n,u),f=n,p={},m=0;for(let g=0;g<a.length;g++){let{name:_,fn:v}=a[g],{x:k,y:S,data:T,reset:E}=await v({x:d,y:c,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:r,floating:e}});d=k??d,c=S??c,p={...p,[_]:{...p[_],...T}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(l=E.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):E.rects),{x:d,y:c}=Om(l,f,u)),g=-1)}return{x:d,y:c,placement:f,strategy:i,middlewareData:p}};async function ad(r,e){var t;e===void 0&&(e={});let{x:n,y:i,platform:s,rects:o,elements:a,strategy:u}=r,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:c="floating",altBoundary:f=!1,padding:p=0}=Sl(e,r),m=Mm(p),_=a[f?c==="floating"?"reference":"floating":c],v=fs(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(_)))==null||t?_:_.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:u})),k=c==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),T=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},E=fs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:S,strategy:u}):k);return{top:(v.top-E.top+m.top)/T.y,bottom:(E.bottom-v.bottom+m.bottom)/T.y,left:(v.left-E.left+m.left)/T.x,right:(E.right-v.right+m.right)/T.x}}var Am=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;let{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:u,elements:l}=e,{mainAxis:d=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,..._}=Sl(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let v=ls(i),k=cs(a),S=ls(a)===a,T=await(u.isRTL==null?void 0:u.isRTL(l.floating)),E=f||(S||!g?[Ea(a)]:Tm(a)),y=m!=="none";!f&&y&&E.push(...$m(a,g,m,T));let x=[a,...E],M=await ad(e,_),A=[],N=((n=s.flip)==null?void 0:n.overflows)||[];if(d&&A.push(M[v]),c){let ee=Em(i,o,T);A.push(M[ee[0]],M[ee[1]])}if(N=[...N,{placement:i,overflows:A}],!A.every(ee=>ee<=0)){var R,D;let ee=(((R=s.flip)==null?void 0:R.index)||0)+1,ie=x[ee];if(ie){var H;let Se=c==="alignment"?k!==cs(ie):!1,ge=((H=N[0])==null?void 0:H.overflows[0])>0;if(!Se||ge)return{data:{index:ee,overflows:N},reset:{placement:ie}}}let Me=(D=N.filter(Se=>Se.overflows[0]<=0).sort((Se,ge)=>Se.overflows[1]-ge.overflows[1])[0])==null?void 0:D.placement;if(!Me)switch(p){case"bestFit":{var j;let Se=(j=N.filter(ge=>{if(y){let Ae=cs(ge.placement);return Ae===k||Ae==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(Ae=>Ae>0).reduce((Ae,Be)=>Ae+Be,0)]).sort((ge,Ae)=>ge[1]-Ae[1])[0])==null?void 0:j[0];Se&&(Me=Se);break}case"initialPlacement":Me=a;break}if(i!==Me)return{reset:{placement:Me}}}return{}}}};var Im=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:_=>{let{x:v,y:k}=_;return{x:v,y:k}}},...u}=Sl(r,e),l={x:t,y:n},d=await ad(e,u),c=cs(ls(i)),f=id(c),p=l[f],m=l[c];if(s){let _=f==="y"?"top":"left",v=f==="y"?"bottom":"right",k=p+d[_],S=p-d[v];p=nd(k,p,S)}if(o){let _=c==="y"?"top":"left",v=c==="y"?"bottom":"right",k=m+d[_],S=m-d[v];m=nd(k,m,S)}let g=a.fn({...e,[f]:p,[c]:m});return{...g,data:{x:g.x-t,y:g.y-n,enabled:{[f]:s,[c]:o}}}}}};function Tl(){return typeof window<"u"}function ds(r){return Rm(r)?(r.nodeName||"").toLowerCase():"#document"}function Cr(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function yn(r){var e;return(e=(Rm(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Rm(r){return Tl()?r instanceof Node||r instanceof Cr(r).Node:!1}function nn(r){return Tl()?r instanceof Element||r instanceof Cr(r).Element:!1}function wn(r){return Tl()?r instanceof HTMLElement||r instanceof Cr(r).HTMLElement:!1}function Dm(r){return!Tl()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Cr(r).ShadowRoot}function lo(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=sn(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!["inline","contents"].includes(i)}function Pm(r){return["table","td","th"].includes(ds(r))}function Ma(r){return[":popover-open",":modal"].some(e=>{try{return r.matches(e)}catch{return!1}})}function $l(r){let e=Ml(),t=nn(r)?sn(r):r;return["transform","translate","scale","rotate","perspective"].some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(t.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(t.contain||"").includes(n))}function Nm(r){let e=li(r);for(;wn(e)&&!hs(e);){if($l(e))return e;if(Ma(e))return null;e=li(e)}return null}function Ml(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function hs(r){return["html","body","#document"].includes(ds(r))}function sn(r){return Cr(r).getComputedStyle(r)}function Oa(r){return nn(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function li(r){if(ds(r)==="html")return r;let e=r.assignedSlot||r.parentNode||Dm(r)&&r.host||yn(r);return Dm(e)?e.host:e}function Lm(r){let e=li(r);return hs(e)?r.ownerDocument?r.ownerDocument.body:r.body:wn(e)&&lo(e)?e:Lm(e)}function uo(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=Lm(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=Cr(i);if(s){let a=Ol(o);return e.concat(o,o.visualViewport||[],lo(i)?i:[],a&&t?uo(a):[])}return e.concat(i,uo(i,[],t))}function Ol(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function zm(r){let e=sn(r),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=wn(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=Ta(t)!==s||Ta(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function ld(r){return nn(r)?r:r.contextElement}function co(r){let e=ld(r);if(!wn(e))return bn(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=zm(e),o=(s?Ta(t.width):t.width)/n,a=(s?Ta(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var fb=bn(0);function Vm(r){let e=Cr(r);return!Ml()||!e.visualViewport?fb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function db(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==Cr(r)?!1:e}function ps(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=ld(r),o=bn(1);e&&(n?nn(n)&&(o=co(n)):o=co(r));let a=db(s,t,n)?Vm(s):bn(0),u=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,d=i.width/o.x,c=i.height/o.y;if(s){let f=Cr(s),p=n&&nn(n)?Cr(n):n,m=f,g=Ol(m);for(;g&&n&&p!==m;){let _=co(g),v=g.getBoundingClientRect(),k=sn(g),S=v.left+(g.clientLeft+parseFloat(k.paddingLeft))*_.x,T=v.top+(g.clientTop+parseFloat(k.paddingTop))*_.y;u*=_.x,l*=_.y,d*=_.x,c*=_.y,u+=S,l+=T,m=Cr(g),g=Ol(m)}}return fs({width:d,height:c,x:u,y:l})}function cd(r,e){let t=Oa(r).scrollLeft;return e?e.left+t:ps(yn(r)).left+t}function Hm(r,e,t){t===void 0&&(t=!1);let n=r.getBoundingClientRect(),i=n.left+e.scrollLeft-(t?0:cd(r,n)),s=n.top+e.scrollTop;return{x:i,y:s}}function hb(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=yn(n),a=e?Ma(e.floating):!1;if(n===o||a&&s)return t;let u={scrollLeft:0,scrollTop:0},l=bn(1),d=bn(0),c=wn(n);if((c||!c&&!s)&&((ds(n)!=="body"||lo(o))&&(u=Oa(n)),wn(n))){let p=ps(n);l=co(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}let f=o&&!c&&!s?Hm(o,u,!0):bn(0);return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-u.scrollLeft*l.x+d.x+f.x,y:t.y*l.y-u.scrollTop*l.y+d.y+f.y}}function pb(r){return Array.from(r.getClientRects())}function mb(r){let e=yn(r),t=Oa(r),n=r.ownerDocument.body,i=ui(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ui(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+cd(r),a=-t.scrollTop;return sn(n).direction==="rtl"&&(o+=ui(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function gb(r,e){let t=Cr(r),n=yn(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,u=0;if(i){s=i.width,o=i.height;let l=Ml();(!l||l&&e==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}return{width:s,height:o,x:a,y:u}}function _b(r,e){let t=ps(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=wn(r)?co(r):bn(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,u=i*s.x,l=n*s.y;return{width:o,height:a,x:u,y:l}}function Bm(r,e,t){let n;if(e==="viewport")n=gb(r,t);else if(e==="document")n=mb(yn(r));else if(nn(e))n=_b(e,t);else{let i=Vm(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return fs(n)}function Gm(r,e){let t=li(r);return t===e||!nn(t)||hs(t)?!1:sn(t).position==="fixed"||Gm(t,e)}function vb(r,e){let t=e.get(r);if(t)return t;let n=uo(r,[],!1).filter(a=>nn(a)&&ds(a)!=="body"),i=null,s=sn(r).position==="fixed",o=s?li(r):r;for(;nn(o)&&!hs(o);){let a=sn(o),u=$l(o);!u&&a.position==="fixed"&&(i=null),(s?!u&&!i:!u&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||lo(o)&&!u&&Gm(r,o))?n=n.filter(d=>d!==o):i=a,o=li(o)}return e.set(r,n),n}function bb(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?Ma(e)?[]:vb(e,this._c):[].concat(t),n],a=o[0],u=o.reduce((l,d)=>{let c=Bm(e,d,i);return l.top=ui(c.top,l.top),l.right=ao(c.right,l.right),l.bottom=ao(c.bottom,l.bottom),l.left=ui(c.left,l.left),l},Bm(e,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function yb(r){let{width:e,height:t}=zm(r);return{width:e,height:t}}function wb(r,e,t){let n=wn(e),i=yn(e),s=t==="fixed",o=ps(r,!0,s,e),a={scrollLeft:0,scrollTop:0},u=bn(0);function l(){u.x=cd(i)}if(n||!n&&!s)if((ds(e)!=="body"||lo(i))&&(a=Oa(e)),n){let p=ps(e,!0,s,e);u.x=p.x+e.clientLeft,u.y=p.y+e.clientTop}else i&&l();s&&!n&&i&&l();let d=i&&!n&&!s?Hm(i,a):bn(0),c=o.left+a.scrollLeft-u.x-d.x,f=o.top+a.scrollTop-u.y-d.y;return{x:c,y:f,width:o.width,height:o.height}}function ud(r){return sn(r).position==="static"}function Fm(r,e){if(!wn(r)||sn(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return yn(r)===t&&(t=t.ownerDocument.body),t}function Um(r,e){let t=Cr(r);if(Ma(r))return t;if(!wn(r)){let i=li(r);for(;i&&!hs(i);){if(nn(i)&&!ud(i))return i;i=li(i)}return t}let n=Fm(r,e);for(;n&&Pm(n)&&ud(n);)n=Fm(n,e);return n&&hs(n)&&ud(n)&&!$l(n)?t:n||Nm(r)||t}var xb=async function(r){let e=this.getOffsetParent||Um,t=this.getDimensions,n=await t(r.floating);return{reference:wb(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function kb(r){return sn(r).direction==="rtl"}var Sb={convertOffsetParentRelativeRectToViewportRelativeRect:hb,getDocumentElement:yn,getClippingRect:bb,getOffsetParent:Um,getElementRects:xb,getClientRects:pb,getDimensions:yb,getScale:co,isElement:nn,isRTL:kb};function qm(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Eb(r,e){let t=null,n,i=yn(r);function s(){var a;clearTimeout(n),(a=t)==null||a.disconnect(),t=null}function o(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();let l=r.getBoundingClientRect(),{left:d,top:c,width:f,height:p}=l;if(a||e(),!f||!p)return;let m=$a(c),g=$a(i.clientWidth-(d+f)),_=$a(i.clientHeight-(c+p)),v=$a(d),S={rootMargin:-m+"px "+-g+"px "+-_+"px "+-v+"px",threshold:ui(0,ao(1,u))||1},T=!0;function E(y){let x=y[0].intersectionRatio;if(x!==u){if(!T)return o();x?o(!1,x):n=setTimeout(()=>{o(!1,1e-7)},1e3)}x===1&&!qm(l,r.getBoundingClientRect())&&o(),T=!1}try{t=new IntersectionObserver(E,{...S,root:i.ownerDocument})}catch{t=new IntersectionObserver(E,S)}t.observe(r)}return o(!0),s}function jm(r,e,t,n){n===void 0&&(n={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,l=ld(r),d=i||s?[...l?uo(l):[],...uo(e)]:[];d.forEach(v=>{i&&v.addEventListener("scroll",t,{passive:!0}),s&&v.addEventListener("resize",t)});let c=l&&a?Eb(l,t):null,f=-1,p=null;o&&(p=new ResizeObserver(v=>{let[k]=v;k&&k.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(e)})),t()}),l&&!u&&p.observe(l),p.observe(e));let m,g=u?ps(r):null;u&&_();function _(){let v=ps(r);g&&!qm(g,v)&&t(),g=v,m=requestAnimationFrame(_)}return t(),()=>{var v;d.forEach(k=>{i&&k.removeEventListener("scroll",t),s&&k.removeEventListener("resize",t)}),c?.(),(v=p)==null||v.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var Ym=Im,Wm=Am;var Jm=(r,e,t)=>{let n=new Map,i={platform:Sb,...t},s={...i.platform,_c:n};return Cm(r,e,{...i,platform:s})};function Km(r){let e=r.parentElement?.querySelector("input[type=text]");if(!e)return;let t=jm(e,r,()=>Jm(e,r,{placement:"bottom-start",middleware:[Ym({padding:5}),Wm()]}).then(({x:n,y:i})=>{Object.assign(r.style,{left:`${n}px`,top:`${i}px`})}));return{destroy(){t()}}}function Qm(r,e,t,n){let i=r?Array.isArray(r)?r:r.split(","):[];return i=i.map(s=>s.replace(/(:\d+):\d+(.*)/,"$1$2")),{iValues:i,iValueCombined:i.length?i.join():null,iDates:i.map(s=>us(s,e,t,n))}}function Xm(r,e){return r==="auto"?e.match(/g|hh?|ii?/i)&&e.match(/y|m|d/i)?"datetime":e.match(/g|hh?|ii?/i)?"time":"date":r}var Qt=_m,Tb=G('<span><button type="button"> </button> <button type="button"> </button></span>'),$b=G('<button type="button"> </button>'),Mb=G('<button type="button"> </button>'),Ob=G("<span><!> <!></span>"),Cb=G('<div class="sdt-btn-row svelte-yheoi9"><!> <!></div>'),Ab=G('<input type="text" tabindex="0" autocomplete="off">'),Ib=G('<input type="hidden"> <!>',1),Db=r=>r.preventDefault(),Rb=G('<div class="sdt-widget svelte-yheoi9"><!></div>'),Pb=G('<div><div class="sdt-widget-wrap svelte-yheoi9"></div> <!></div>'),Nb=G('<div><div class="sdt-input-wrap svelte-yheoi9" style="border: 3px dashed orange; position: relative"><!> <!></div> <!></div>'),Lb={hash:"svelte-yheoi9",code:`.sdt-component-wrap.svelte-yheoi9 {position:relative;display:inline-block;}.sdt-input-wrap.svelte-yheoi9 {position:relative;display:contents;}.sdt-calendar-wrap.svelte-yheoi9 {width:280px;background-color:var(--sdt-bg-main, #fff);box-shadow:var(--sdt-wrap-shadow, 0 1px 6px var(--sdt-shadow-color, #ccc));border-radius:var(--sdt-radius, 4px);padding:0.5em;color:var(--sdt-color, initial);}.sdt-calendar-wrap.is-range-wrap.svelte-yheoi9 {width:560px;}.sdt-widget-wrap.svelte-yheoi9 {display:flex;gap:0.5rem;justify-content:stretch;position:relative;}.sdt-widget.svelte-yheoi9 {flex:1;min-width:264px;}.value-dirty.svelte-yheoi9 {color:color-mix(in srgb, black 20%, white);}.sdt-calendar-wrap.is-popup.svelte-yheoi9 {position:absolute;box-shadow:0 1px 6px var(--sdt-shadow-color, #ccc);z-index:100;}.sdt-btn-row.svelte-yheoi9 {margin-top:0.5rem;display:flex;gap:0.5rem;justify-content:space-between;flex-flow:row-reverse;}.sdt-action-btn.svelte-yheoi9 {padding:0.25em 0.5em;font-size:0.875em;border-radius:0.2em;}.sdt-today-btn.svelte-yheoi9 {background-color:var(--sdt-bg-selected, #286090);color:var(--sdt-today-color, var(--sdt-bg-main, #fff));padding:0.25em 0.5em;font-size:0.875em;border-radius:0.2em;border:1px solid var(--sdt-today-bg, #286090);}.sdt-today-btn[disabled].svelte-yheoi9 {opacity:0.5;cursor:not-allowed;}.sdt-today-btn.svelte-yheoi9:focus,
|
|
.sdt-today-btn.svelte-yheoi9:active,
|
|
.sdt-today-btn.svelte-yheoi9:hover:not([disabled]) {background-color:var(--sdt-today-bg, #286090);}.sdt-clear-btn.svelte-yheoi9 {border:1px solid var(--sdt-clear-color, #dc3545);background-color:var(--sdt-clear-bg, transparent);color:var(--sdt-clear-color, #dc3545);}.sdt-clear-btn.svelte-yheoi9:focus,
|
|
.sdt-clear-btn.svelte-yheoi9:active:not([disabled]),
|
|
.sdt-clear-btn.svelte-yheoi9:hover:not([disabled]) {background-color:var(--sdt-clear-hover-bg, #dc3545);color:var(--sdt-clear-hover-color, var(--sdt-bg-main, #fff));}.sdt-widget.svelte-yheoi9 + .sdt-widget:where(.svelte-yheoi9):before {content:'';position:absolute;top:0;bottom:0;left:50%;width:1px;background-color:#eee;}
|
|
@media screen and (max-width: 560px) {.sdt-calendar-wrap.is-range-wrap.svelte-yheoi9 {width:280px;}.sdt-widget-wrap.svelte-yheoi9 {flex-wrap:wrap;}.sdt-widget.svelte-yheoi9 + .sdt-widget:where(.svelte-yheoi9):before {content:none;}
|
|
}`};function fd(r,e){ve(e,!0),ii(r,Lb);let t=(te,me)=>{let vt=()=>me?.().autocloseSupported,Ht=()=>me?.().todayBtnClasses,wr=()=>me?.().clearBtnClasses,Ir=()=>me?.().onCancel,mt=()=>me?.().onConfirm,qr=()=>me?.().onClear,Gt=()=>me?.().onToday,ci=()=>me?.().isTodayDisabled,Dr=()=>me?.().i18n,_o=()=>me?.().currentMode;var xr=It(),Ln=Te(xr);{var zi=Bn=>{var Fn=Cb(),fi=K(Fn);{var vo=w=>{var C=Tb(),I=K(C);I.__click=function(...J){Ir()?.apply(this,J)};var O=K(I,!0);q(I);var z=F(I,2);z.__click=function(...J){mt()?.apply(this,J)};var Y=K(z,!0);q(z),q(C),fe(()=>{ke(I,1,Jt(wr()),"svelte-yheoi9"),qe(O,Dr().cancelBtn),ke(z,1,Jt(Ht()),"svelte-yheoi9"),qe(Y,Dr().okBtn)}),V(w,C)};pe(fi,w=>{vt()||w(vo)})}var b=F(fi,2);{var $=w=>{var C=Ob(),I=K(C);{var O=J=>{var W=$b();W.__click=function(...ce){Gt()?.apply(this,ce)};var Z=K(W,!0);q(W),fe(()=>{ke(W,1,Jt(Ht()),"svelte-yheoi9"),W.disabled=ci(),qe(Z,Dr().todayBtn)}),V(J,W)};pe(I,J=>{R()&&_o()==="date"&&J(O)})}var z=F(I,2);{var Y=J=>{var W=Mb();W.__click=function(...ce){qr()?.apply(this,ce)};var Z=K(W,!0);q(W),fe(()=>{ke(W,1,Jt(wr()),"svelte-yheoi9"),qe(Z,Dr().clearBtn)}),V(J,W)};pe(z,J=>{D()&&J(Y)})}q(C),V(w,C)};pe(b,w=>{(R()||D())&&w($)})}q(Fn),V(Bn,Fn)};pe(Ln,Bn=>{vt(),Bn(zi)})}V(te,xr)},n=B(e,"inputId",3,""),i=B(e,"name",3,"date"),s=B(e,"disabled",3,!1),o=B(e,"placeholder",3,null),a=B(e,"required",3,!1),u=B(e,"value",15,null),l=B(e,"isRange",3,!1),d=B(e,"startDate",3,null),c=B(e,"endDate",3,null),f=B(e,"pickerOnly",3,!1),p=B(e,"startView",7,2),m=B(e,"mode",3,"auto"),g=B(e,"disableDatesFn",3,null),_=B(e,"manualInput",3,!1),v=B(e,"theme",19,()=>Qt.theme),k=B(e,"format",19,()=>Qt.format),S=B(e,"formatType",19,()=>Qt.formatType),T=B(e,"displayFormat",19,()=>Qt.displayFormat),E=B(e,"displayFormatType",19,()=>Qt.displayFormatType),y=B(e,"minuteIncrement",19,()=>Qt.minuteIncrement),x=B(e,"weekStart",19,()=>Qt.weekStart),M=B(e,"inputClasses",19,()=>Qt.inputClasses),A=B(e,"todayBtnClasses",19,()=>Qt.todayBtnClasses),N=B(e,"clearBtnClasses",19,()=>Qt.clearBtnClasses),R=B(e,"todayBtn",19,()=>Qt.todayBtn),D=B(e,"clearBtn",19,()=>Qt.clearBtn),H=B(e,"clearToggle",19,()=>Qt.clearToggle),j=B(e,"autocommit",19,()=>Qt.autocommit),ee=B(e,"hourOnly",19,()=>Qt.hourOnly),ie=B(e,"i18n",19,()=>Qt.i18n),Me=B(e,"validatorAction",3,null),Se=B(e,"ce_valueElement",7,null),ge=B(e,"ce_displayElement",7,null),Ae=B(e,"positionResolver",3,Km),Be=B(e,"actionRow",3,t);l()&&Array.isArray(u());let{iDates:ye,iValues:Ue,iValueCombined:tt}=Qm(u(),k(),ie(),S()),Ve=tt,$e=ae(De(Ue)),Ne=ae(De(ye.map(te=>new dt(te)))),Xt=ae(De(Ue)),Ke=ne(()=>h($e).length?h($e).join(","):null),L=ae(De(wt())),U=k(),ue=T(),se=ae(null),He=ne(()=>d()?us(d(),k(),ie(),S()):null),Ee=ne(()=>c()?new Date(us(c(),k(),ie(),S()).setSeconds(1)):null),_e=ne(()=>h(He)&&h(He)>new Date||h(Ee)&&h(Ee)<new Date),je=ne(()=>i().endsWith("]")?i().substring(0,i().length-1)+"_input]":i()+"_input"),ot=Xm(m(),k()),We=ae(De(ot)),Le=ae(De(ot==="time"?"time":"date")),pt=De(l()?[{ref:null},{ref:null}]:[{ref:null}]),X=ae("date"),he=ne(()=>j()&&(l()&&h(We)==="date"||!l())),oe=ae(De(f())),Fe=ae(De(f())),at=f()?()=>({}):Pi,gr=ne(()=>!!f()),_r=Me()?Me().shift():()=>{},Mt=Me()||[],vr=ne(()=>f()?()=>{}:Ae()),br=ne(()=>j()?!1:h($e).join()!==h(Xt).join()),Ft;function wt(){return h(Ne).sort((te,me)=>te.getTime()-me.getTime()).map(te=>oo(te,T()||k(),ie(),E()||S())).join(" - ")}function zt(){return l()?h($e).length===2?h($e):null:h($e)[0]||null}function Vt({type:te,date:me,isKeyboard:vt,dateIndex:Ht=0}){if(me&&!l()&&h(Ne).length&&h(Ne)[0].getFullYear()===me.getFullYear()&&h(Ne)[0].getMonth()===me.getMonth()&&h(Ne)[0].getDate()===me.getDate()&&h(We)==="date"&&!a()&&H()&&(me=null),l()){if(te==="date")P(Ne,me?(h(Ne).length===2?[new dt(me)]:h(Ne).concat(new dt(me))).map(wr=>wr.getTime()).sort().map(wr=>new dt(wr)):[],!0);else if(me&&Ht!==void 0)h(Ne)[Ht]=new dt(me);else if(te==="datetime")h(Ne)[0]=new dt(me),h(Ne)[1]=new dt(me);else throw new Error(`Unhandled event type: '${te}'`);P($e,h(Ne).map(wr=>oo(wr,k(),ie(),S())),!0)}else P(Ne,me?[new dt(me)]:[],!0),P($e,me?[oo(me,k(),ie(),S())]:[],!0);P(X,te,!0),_t(te)&&Zt(),kn(te,vt,Ht)}function _t(te){return!j()||l()&&h(We).includes("time")||l()&&(h(We)==="datetime"||h($e).length!==2)?!1:te==="minute"||te===h(We)||te==="hour"&&ee()||f()}function Zt(){Ve=h($e).join(),P(Xt,[...h($e)],!0),P(L,wt(),!0),u(zt()),Rl(!0),e.onChange?.(l()?h($e):h($e)[0]||null),e.onDateChange?.({value:l()?h($e):h($e)[0]||null,dateValue:l()?h(Ne):h(Ne)[0]||null,displayValue:h(L),valueFormat:k(),displayFormat:T(),event:h(X)})}function yr(){p(2),h(We)==="datetime"?setTimeout(()=>{f()||P(Fe,!1),P(Le,"date")},j()?300:0):f()||P(Fe,!1)}function kn(te,me,vt){if(me&&Fi!=="Enter")return;if(te==="hour"&&!ee()){pt[vt].ref.showMinuteView();return}let Ht=_t(te);if(h(We)==="datetime"&&!(te==="minute"&&!l()&&h(We)==="datetime"&&Ht)){te==="date"&&(l()&&h($e).length===2||!l())&&P(Le,"time");return}Ht&&!me&&yr()}function Ar(){let te=new Date;Vt({type:l()?"datetime":"date",dateIndex:0,date:new Date(te.getFullYear(),te.getMonth(),te.getDate(),0,0,0),isKeyboard:!1}),l()&&Vt({type:l()?"datetime":"date",dateIndex:1,date:new Date(te.getFullYear(),te.getMonth(),te.getDate(),23,59,59,999),isKeyboard:!1}),_t("date")===!1&&Zt(),h(We)==="date"&&yr()}function xt(){P(Ne,[],!0),P($e,[],!0),Ve=null,Zt()}function Bi(){let te=Array.isArray(u())?u().join():u()||null;(Ve!==te||j()===!1||l())&&Zt(),yr()}function on(){P($e,[...h(Xt)],!0),yr(),e.onCancel?.()}let Fi=null;function ms(te){if(h(Fe)||(["Backspace","Delete"].includes(te.key)&&!a()&&xt(),te.key==="Enter"&&gs()),!h(Fe)&&te.key!=="Tab"){P(Fe,te.key!=="Shift"),te.preventDefault();return}switch(Fi=te.key,te.key){case"PageDown":case"PageUp":case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":if(te.preventDefault(),l())return;h(Le)==="date"?Ft.handleGridNav(te.key,te.shiftKey):pt[0].ref.makeTick(["ArrowDown","ArrowLeft","PageDown"].includes(te.key)?-1:1);break;case"Escape":j()?xt():on();break;case"Backspace":if(_()&&!l())return;case"Delete":!a()&&xt();break;case"Enter":if(h(oe)&&te.preventDefault(),h($e).length===0){P(Fe,!1);return}if(h(Le)==="time"&&h(X)==="hour")return pt[0].ref.showMinuteView();if(h(We)==="datetime"&&h(Le)!=="time"){P(Le,"time");return}Bi();break;case"Tab":h(Fe)&&(P(Fe,!1),te.preventDefault());case"F5":break;default:!_()&&te.preventDefault()}}function mo(te){te.preventDefault(),te.stopPropagation();let me=us(te.target.value,T()||k(),ie(),E()||S());oo(me,T()||k(),ie(),E()||S())===te.target.value&&(Vt({type:"date",date:me,isKeyboard:!0}),Ft.focusDate(me))}function Ia(te){p(2),P(Le,te,!0)}let go=ae(De(_()?"text":"none"));function Da(){_()&&h(oe)&&P(go,h(go)==="text"?"none":"text",!0),!h(Fe)&&gs()}function gs(){P(oe,!0),P(Fe,!0)}function Ra(){P(oe,!1),h(he)?Bi():on(),!ge()&&e.onBlur?.()}function Rl(te){Se()&&ge()&&(Se().value=h($e).join(",")||"",ge().value=h(L),Se().dispatchEvent(new Event("input")),ge().dispatchEvent(new Event("input"))),te&&e.onInput?.(h(Ke))}function Pl(te){P(se,te,!0)}oi(()=>{ge()&&(ge().onfocus=gs,ge().onblur=Ra,ge().onclick=Da,ge().onkeydown=ms)});function Nl(te){let me=Array.isArray(te)?te.join():te||null;Ve!==me&&(P($e,te?Array.isArray(te)?te:[te]:[],!0),P(Ne,h($e).map(vt=>new dt(us(vt,k(),ie(),S()))),!0),P(Xt,h($e),!0),Ve=me)}function Pa(te,me){ue!==me&&(ue=me,P(L,wt(),!0)),U!==te&&h(Ne).length&&(U=te,P($e,h(Ne).map(vt=>oo(vt,te,ie(),S())),!0),Ve=h($e).join(),ue===null&&ue===me&&P(L,wt(),!0),m()==="auto"&&(P(We,te.match(/g|hh?|ii?/i)&&te.match(/y|m|d/i)?"datetime":te.match(/g|hh?|ii?/i)?"time":"date",!0),h(We)==="time"&&h(Le)!=="time"&&P(Le,"time")),Zt())}$t(()=>Nl(u())),$t(()=>Pa(k(),T()));var _s=Nb();let Na;var vs=K(_s);vs.__click=Da;var La=K(vs);{var Ll=te=>{var me=Ib(),vt=Te(me);si(vt);var Ht=F(vt,2);{var wr=Ir=>{var mt=Ab();si(mt);let qr;mt.__input=function(...Gt){(_()?mo:()=>{})?.apply(this,Gt)},mt.__keydown=ms,ll(mt,(Gt,ci)=>_r?.(Gt,ci),()=>Mt),fe(Gt=>{Re(mt,"id",n()),Re(mt,"name",h(je)),qr=ke(mt,1,Jt(M()),"svelte-yheoi9",qr,Gt),Di(mt,h(L)),Re(mt,"placeholder",o()),mt.disabled=s(),mt.required=a(),Re(mt,"inputmode",h(go)),mt.readOnly=h(oe)&&!_()&&!l()},[()=>({"value-dirty":h(br)})]),Bt("focus",mt,gs),Bt("blur",mt,Ra),V(Ir,mt)};pe(Ht,Ir=>{f()||Ir(wr)})}fe(()=>{Re(vt,"name",i()),Di(vt,u())}),V(te,me)};pe(La,te=>{ge()||te(Ll)})}var Bl=F(La,2);Or(Bl,()=>e.children??St),q(vs);var Fl=F(vs,2);{var zl=te=>{var me=Pb();let vt;me.__mousedown=[Db];var Ht=K(me);Xe(Ht,21,()=>pt,st,(Ir,mt,qr)=>{var Gt=Rb(),ci=K(Gt);{var Dr=xr=>{let Ln=ne(()=>h(We)?.includes("time")),zi=ne(()=>p()>2?2:p());_n(td(xr,{wid:qr,get dates(){return h(Ne)},get isRange(){return l()},get startDate(){return h(He)},get endDate(){return h(Ee)},get enableTimeToggle(){return h(Ln)},get initialView(){return h(zi)},get hoverDate(){return h(se)},get additionalDisableFn(){return g()},get i18n(){return ie()},get weekStart(){return x()},onupdate:Vt,onswitch:Ia,onhoverupdate:Pl}),Bn=>Ft=Bn,()=>Ft)},_o=xr=>{let Ln=ne(()=>h(Ne)[qr]||null),zi=ne(()=>l()&&qr===1?h(Ne)[0]:h(He)),Bn=ne(()=>h(We)!=="time"),Fn=ne(()=>k().match(S()==="php"?"a|A":"p|P")!==null);_n(rd(xr,{wid:qr,get date(){return h(Ln)},get startDate(){return h(zi)},get endDate(){return h(Ee)},get hasDateComponent(){return h(Bn)},get showMeridian(){return h(Fn)},get i18n(){return ie()},get minuteIncrement(){return y()},get hourOnly(){return ee()},onupdate:Vt,onswitch:Ia}),(fi,vo)=>vo.ref=fi,fi=>fi?.ref,()=>[h(mt)])};pe(ci,xr=>{h(Le)==="date"?xr(Dr):xr(_o,!1)})}q(Gt),V(Ir,Gt)}),q(Ht);var wr=F(Ht,2);Or(wr,Be,()=>({autocloseSupported:h(he),todayBtnClasses:A(),clearBtnClasses:N(),onCancel:on,onConfirm:Bi,onClear:xt,onToday:Ar,isTodayDisabled:h(_e),i18n:ie(),currentMode:h(Le)})),q(me),ll(me,Ir=>h(vr)?.(Ir)),fe(Ir=>vt=ke(me,1,`sdt-calendar-wrap ${v()??""}`,"svelte-yheoi9",vt,Ir),[()=>({"is-popup":!h(gr),"is-range-wrap":l()})]),Kt(3,me,()=>at,()=>({duration:200})),V(te,me)};pe(Fl,te=>{h(Fe)&&h(oe)&&te(zl)})}q(_s),fe(te=>Na=ke(_s,1,"sdt-component-wrap svelte-yheoi9",null,Na,te),[()=>({"picker-active":h(Fe)})]),V(r,_s),be()}Ye(["click","input","keydown","mousedown"]);var Zm=fd;var Bb=G('<div class="cmtr-daterange-picker"><!></div>');function dd(r,e){ve(e,!0);var t=Bb(),n=K(t);Zm(n,{pickerOnly:!0,isRange:!0,autocommit:!1,mode:"datetime",get value(){return e.value},format:"yyyy-mm-dd hh:ii:00",onBlur:()=>e.onClose(null),onChange:i=>e.onClose(i)}),q(t),V(r,t),be()}var Ca=class extends e0.Modal{constructor(t,n,i){super(t.app);this.plugin=t;this.value=n;this.callback=i;this.contentEl.parentElement.addClass("cmtr-daterange-picker-modal")}view;async onOpen(){this.view=In(dd,{target:this.contentEl,props:{value:this.value?.map(t=>new Date(t*1e3).toISOString().split("T")[0]),onClose:async t=>{this.callback(t),super.close()}}})}onClose(){this.view&&ni(this.view)}};var t0=require("obsidian"),ZN=require("@codemirror/search");var Fb=Object.values(ct);function hd(r,e,t,n,i,s,o,a,u){if(!e)return[];let l=e;n!==0&&u&&(n===1?l=e.filter(([c,f])=>c.startsWith(u.parent?.path??"")):n===2&&(l=e.filter(([c,f])=>c===u.path)));let d=l.flatMap(([c,f])=>f.data.map(p=>({path:c,range:p})));return d=d.filter(c=>c.range.type!=="comment"||!c.range.attached_comment),i!==void 0&&i!==0&&(d=d.filter(c=>c.range.full_thread.some(f=>f.type===Fb[i-1]))),s!==0&&(d=d.filter(c=>c.range.full_thread.some(f=>s===1!==f.empty()))),r.settings.enable_metadata&&(r.settings.enable_author_metadata&&o!==0&&r.settings.author&&(o===1?d=d.filter(c=>c.range.full_thread.some(f=>f.fields.author===r.settings.author)):o===2&&(d=d.filter(c=>c.range.full_thread.some(f=>f.fields.author&&f.fields.author!==r.settings.author)))),r.settings.enable_timestamp_metadata&&a&&(a[0]&&a[1]?d=d.filter(c=>c.range.full_thread.some(f=>f.fields.time&&f.fields.time>=a[0]&&f.fields.time<=a[1])):a[0]?d=d.filter(c=>c.range.full_thread.some(f=>f.fields.time&&f.fields.time>=a[0])):a[1]&&(d=d.filter(c=>c.range.full_thread.some(f=>f.fields.time&&f.fields.time<=a[1]))))),t?.length&&(d=d.filter(c=>(0,t0.prepareSimpleSearch)(t)(c.range.full_text)?.score)),d}async function zb(r,e,t,n,i){r.key==="z"&&r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey?(r.preventDefault(),await zc(e.plugin)):r.key==="a"&&r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey?(r.preventDefault(),P(t,[...h(n)],!0),P(i,0)):r.key==="Escape"&&(r.preventDefault(),P(t,[],!0),P(i,null))}async function Vb(r,e,t){P(e,[],!0),P(t,null)}var Hb=(r,e,t)=>new Ca(e.plugin,t(),n=>{t(n?.map(i=>i?window.moment(i,"YYYY-MM-DD HH:mm:ss").unix():0))}).open(),Gb=(r,e)=>{r.preventDefault();let t=new Nn.Menu;t.addItem(n=>{n.setTitle("Clear date filter").setIcon("calendar-x").onClick(()=>{e(void 0)})}),t.addItem(n=>{n.setTitle("Filter to today").setIcon("calendar-days").onClick(()=>{let i=window.moment().startOf("day").unix();e([i,i+86400])})}),t.addItem(n=>{n.setTitle("Filter to this week").setIcon("calendar-range").onClick(()=>{let i=window.moment().startOf("day").unix();e([i-window.moment().day()*86400,i+(7-window.moment().day())*86400])})}),t.addItem(n=>{n.setTitle("Filter to this month").setIcon("calendar-clock").onClick(()=>{let i=window.moment().startOf("day").unix();e([i-window.moment().date()*86400,i+(window.moment().daysInMonth()-window.moment().date())*86400])})}),t.showAtMouseEvent(r)},Ub=G('<button class="cmtr-view-action clickable-icon nav-action-button svelcomlib-icon-text" aria-label="Filter by date"><!></button>'),qb=G("<!> <!>",1),jb=G("<span> </span>"),Yb=G('<div class="cmtr-view-search search-input-container"><!></div> <div class="cmtr-view-action-container"><!> <!> <!> <!> <!></div> <div class="cmtr-view-info"><span> </span> <!></div>',1),Wb=G('<div class="cmtr-view-container" tabindex="-1"><!></div>');function Aa(r,e){ve(e,!0);let t=B(e,"range_type_filter",23,()=>0),n=B(e,"location_filter",23,()=>0),i=B(e,"content_filter",23,()=>0),s=B(e,"author_filter",23,()=>0),o=B(e,"date_filter",7,void 0),a=ae(""),u=ae(null),l=e.plugin.app.workspace.on("layout-change",()=>{P(u,e.plugin.app.workspace.getActiveFile(),!0)}),d=ae(!1),c=ae(De([])),f=ae(De([])),p=ae(null),m=[{icon:"asterisk",tooltip:"All markup",value:0},{icon:"plus-circle",tooltip:"Addition markup",value:1},{icon:"minus-square",tooltip:"Deletion markup",value:2},{icon:"replace",tooltip:"Substitution markup",value:3},{icon:"highlighter",tooltip:"Highlight markup",value:4},{icon:"message-square",tooltip:"Comment markup",value:5}],g=["suggestions","insertions","deletions","replacements","highlights","comments"],_=[{icon:"vault",tooltip:"Entire vault",value:0},{icon:"folder-closed",tooltip:"Current folder",value:1},{icon:"file",tooltip:"Current file",value:2}],v=[{icon:"maximize",tooltip:"All suggestions",value:0},{icon:"square",tooltip:"Suggestions with content",value:1},{icon:"box-select",tooltip:"Empty suggestions",value:2}],k=[{icon:"users",tooltip:"All suggestions",value:0},{icon:"user",tooltip:"Own suggestions",value:1},{icon:"user-x",tooltip:"Others' suggestions",value:2}];oi(()=>{e.plugin.database.on("database-update",A=>{P(c,A,!0)}),P(c,e.plugin.database.allEntries(),!0)}),fm(()=>{e.plugin.app.workspace.offref(l)});let S=ne(()=>hd(e.plugin,h(c),h(a),n(),t(),i(),s(),o(),h(u))),T=ne(()=>`${h(S).length} ${g[t()]} in the ${_[h(u)?n():0].tooltip.toLowerCase()}`),E=(0,Nn.debounce)(hd,500),y=(0,Nn.debounce)(()=>{e.sync_props({range_type_filter:t(),location_filter:n(),content_filter:i(),author_filter:s(),date_filter:o(),search_filter:h(a)}),e.plugin.app.workspace.requestSaveLayout()},2500);$t(()=>{t(),n(),i(),s(),o(),y()}),$t(()=>{h(S),P(f,[],!0),P(p,null)});async function x(A,N,R){if(A.stopPropagation(),A.shiftKey)h(p)?P(f,[...h(S)].slice(Math.min(h(p),R),Math.max(h(p),R)+1),!0):(P(f,[h(S)[R]],!0),P(p,R,!0));else if(A.ctrlKey||A.metaKey){P(p,R,!0);let D=h(f).length,H=h(S)[R];P(f,h(f).filter(j=>!(j.path===H.path&&j.range===H.range)),!0),h(f).length===D&&P(f,[...h(f),H],!0)}}async function M(A,N,R){A.stopPropagation(),P(f,[],!0),await Du(e.plugin,N)}wa(r,{header:R=>{ya(R,{container:H=>{var j=Yb(),ee=Te(j),ie=K(ee);ss(ie,{get value(){return h(a)},type:"text",enterkeyhint:"search",placeholder:"Search...",spellcheck:!1,onChange:Ke=>{P(a,Ke,!0),E()}}),q(ee);var Me=F(ee,2),Se=K(Me);Ri(Se,{onContextMenu:Ke=>{let L=new Nn.Menu;m.map((U,ue)=>{L.addItem(se=>{se.setTitle(U.tooltip).setIcon(U.icon).onClick(()=>{t(ue)})})}),L.showAtMouseEvent(Ke)},class:"cmtr-view-action clickable-icon nav-action-button",states:m,get value(){return t()},set value(Ke){t(Ke)}});var ge=F(Se,2);Ri(ge,{onContextMenu:Ke=>{let L=new Nn.Menu;_.map((U,ue)=>{L.addItem(se=>{se.setTitle(U.tooltip).setIcon(U.icon).onClick(()=>{n(ue)})})}),L.showAtMouseEvent(Ke)},class:"cmtr-view-action clickable-icon nav-action-button",states:_,get value(){return n()},set value(Ke){n(Ke)}});var Ae=F(ge,2);Ri(Ae,{onContextMenu:Ke=>{let L=new Nn.Menu;v.map((U,ue)=>{L.addItem(se=>{se.setTitle(U.tooltip).setIcon(U.icon).onClick(()=>{i(ue)})})}),L.showAtMouseEvent(Ke)},class:"cmtr-view-action clickable-icon nav-action-button",states:v,get value(){return i()},set value(Ke){i(Ke)}});var Be=F(Ae,2);{var ye=Ke=>{var L=qb(),U=Te(L);{var ue=Ee=>{Ri(Ee,{onContextMenu:_e=>{let je=new Nn.Menu;k.map((ot,We)=>{je.addItem(Le=>{Le.setTitle(ot.tooltip).setIcon(ot.icon).onClick(()=>{s(We)})})}),je.showAtMouseEvent(_e)},class:"cmtr-view-action clickable-icon nav-action-button",states:k,get value(){return s()},set value(_e){s(_e)}})};pe(U,Ee=>{e.plugin.settings.enable_author_metadata&&Ee(ue)})}var se=F(U,2);{var He=Ee=>{var _e=Ub();_e.__click=[Hb,e,o],_e.__contextmenu=[Gb,o];var je=K(_e);ar(je,{icon:"calendar"}),q(_e),V(Ee,_e)};pe(se,Ee=>{e.plugin.settings.enable_timestamp_metadata&&Ee(He)})}V(Ke,L)};pe(Be,Ke=>{e.plugin.settings.enable_metadata&&Ke(ye)})}var Ue=F(Be,2);mr(Ue,{class:"clickable-icon nav-action-button cmtr-view-action",icon:"more-vertical",tooltip:"More options",onClick:Ke=>{bi(!0);let L=new Nn.Menu;L.addItem(U=>{U.setTitle("Clear filters").setIcon("filter-x").setSection("filter-actions").onClick(()=>{t(0),n(0),i(0),s(0),o(void 0),P(a,"")})}),L.addItem(U=>{let ue=U.setTitle("Filter by author").setIcon("user-search").setSection("filter-actions").setSubmenu();au(ue,s(),k,se=>{s(se)})}),L.addItem(U=>{let ue=U.setTitle("Filter by type").setIcon("space").setSection("filter-actions").setSubmenu();au(ue,t(),m,se=>{t(se)})}),L.addItem(U=>{let ue=U.setTitle("Filter by location").setIcon("locate").setSection("filter-actions").setSubmenu();au(ue,n(),_,se=>{n(se)})}),L.addItem(U=>{U.setTitle("Filter by date").setIcon("calendar").setSection("filter-actions").onClick(()=>{new Ca(e.plugin,o(),ue=>{o(ue?.map(se=>se?window.moment(se,"YYYY-MM-DD HH:mm:ss").unix():0))}).open()})}),L.addItem(U=>{U.setTitle("Select all").setIcon("circle").setSection("selection-actions").onClick(async()=>{P(f,[...h(S)],!0),P(p,0)})}),L.addItem(U=>{U.setTitle("Clear selection").setIcon("circle-dashed").setSection("selection-actions").onClick(()=>{P(f,[],!0),P(p,null)})}),L.addItem(U=>{U.setTitle("Invert selection").setIcon("circle-alert").setSection("selection-actions").onClick(()=>{let ue=[...h(f)].sort((Ee,_e)=>{Ee.range.from-_e.range.from}),se=[],He=0;for(let[Ee,_e]of h(S).entries())He<ue.length&&_e.path===ue[He].path&&_e.range.from===ue[He].range.from?He++:se.push(_e);P(f,se,!0),P(p,null)})}),L.addItem(U=>{U.setTitle("Undo change").setIcon("undo").setSection("history-actions").setDisabled(!e.plugin.file_history.length).onClick(()=>{zc(e.plugin)})}),L.showAtMouseEvent(Ke)}}),q(Me);var tt=F(Me,2),Ve=K(tt),$e=K(Ve,!0);q(Ve);var Ne=F(Ve,2);{var Xt=Ke=>{var L=jb(),U=K(L);q(L),fe(()=>qe(U,`\xB7 ${h(f).length??""} selected`)),V(Ke,L)};pe(Ne,Ke=>{h(f).length&&Ke(Xt)})}q(tt),fe(()=>qe($e,h(T))),V(H,j)},$$slots:{container:!0}})},view:R=>{var D=Wb();D.__click=[Vb,f,p],D.__keydown=[zb,e,f,S,p];var H=K(D);ba(H,{get items(){return h(S)},item:(ee,ie=St,Me=St)=>{Zf(ee,{get plugin(){return e.plugin},get selected_ranges(){return h(f)},get row(){return ie()},get index(){return Me()},onClick:x,onDblClick:M,get menu_open(){return h(d)},set menu_open(Se){P(d,Se,!0)}})},$$slots:{item:!0}}),q(D),V(R,D)},$$slots:{header:!0,view:!0}}),be()}Ye(["click","contextmenu","keydown"]);var Cl=class extends r0.PluginSettingTab{plugin;view=null;constructor(e,t){super(e,t),this.plugin=t}display(){let{containerEl:e}=this;e.empty(),this.view=In(ka,{target:this.containerEl,props:{plugin:this.plugin}})}hide(){super.hide(),this.view&&ni(this.view)}};var n0=require("obsidian");var fo="commentator-annotations-view",Al=class extends n0.ItemView{constructor(e,t){super(e),this.plugin=t,this.props.plugin=t}view=null;#e=ae(De({plugin:void 0,range_type_filter:void 0,location_filter:void 0,content_filter:void 0,author_filter:void 0,date_filter:void 0}));get props(){return h(this.#e)}set props(e){P(this.#e,e,!0)}async onOpen(){this.containerEl.empty(),this.containerEl.classList.add("cmtr-view")}async onClose(){this.view&&await ni(this.view),this.containerEl.detach()}getViewType(){return fo}getDisplayText(){return"Vault suggestions and comments"}getIcon(){return"message-square"}getState(){let{plugin:e,...t}=this.props;return{...super.getState(),...t}}async setState(e,t){this.props.range_type_filter=e.range_type_filter||0,this.props.location_filter=e.location_filter||0,this.props.content_filter=e.content_filter||0,this.props.author_filter=e.author_filter||0,this.props.date_filter=e.date_filter||void 0,this.view||(this.props.plugin=this.plugin,this.view=In(Aa,{target:this.containerEl,props:{...this.props,sync_props:n=>{for(let[i,s]of Object.entries(n))this.props[i]=s}}})),await super.setState(e,t)}};var A9=require("@codemirror/state"),pd=require("obsidian");function Il(r,e,t){let n=r.findIndex(i=>i?.compartment===e);r[n]=r[n].compartment.of(t)}function i0(r,e){r.workspace.iterateAllLeaves(t=>{t.view instanceof pd.MarkdownView&&t.view.currentMode.type==="source"&&e(t.view.editor.cm)})}function ho(r,e){for(let t of r.workspace.getLeavesOfType("markdown"))t.view instanceof pd.MarkdownView&&t.view.currentMode.type==="source"&&t.view.editor.cm.dispatch({annotations:[e]})}var Dl=class extends xn.Plugin{editorExtensions=[];settings=Ls;previous_settings={};changed_settings={};previewModeHeaderButton;editModeHeaderModeButton;previewModeStatusBarButton;editModeStatusBarButton;metadataStatusBarButton;defaultEditModeExtension=[];settings_tab="general";database=new Uo(this,"commentator/cache","Commentator cache",Yd,"Vault-wide cache for Commentator plugin",()=>[],async(e,t)=>t?t.field(Pe).ranges.ranges:Fo(await this.app.vault.cachedRead(e),this.settings),this.settings.database_workers,e=>e.map(t=>Object.setPrototypeOf(t,zo[t.type].prototype)),()=>this.settings);file_history=[];postProcessor;annotation_gutter_config=void 0;loadEditorExtensions(){if(this.editorExtensions.length=0,this.editorExtensions.push(Do),this.editorExtensions.push(po.Prec.highest(wc)),this.editorExtensions.push(Bc(this.settings)),this.editorExtensions.push(po.Prec.highest(hc)),this.editorExtensions.push(Ms.of(gi(this.settings.default_edit_mode,this.settings))),this.editorExtensions.push(Pe),this.settings.annotation_gutter){let e=oh(this);this.annotation_gutter_config=e[1][1].value,this.editorExtensions.push(Tu.of(po.Prec.low(e)))}this.settings.live_preview&&this.editorExtensions.push(po.Prec.low(Sc(this.settings))),this.settings.diff_gutter&&this.editorExtensions.push(po.Prec.low(Mu.of(fh))),this.settings.tag_completion&&this.editorExtensions.push(Nc),this.settings.tag_correcter&&this.editorExtensions.push(Lc),this.editorExtensions.push(Fc(this)),this.editorExtensions.push(s0.EditorView.domEventHandlers({copy:$h.bind(null,this.settings)})),this.editorExtensions.push(Ts.of(qt.of(this.settings.default_preview_mode))),this.editorExtensions.push($s.of(kr.of(this.settings.default_edit_mode))),this.editorExtensions.push(Es.of(an.of(this.settings.annotation_gutter_included_types))),this.register(Qd((e,t)=>{this.settings.annotation_gutter&&e.editMode.annotationGutterWidth===void 0&&(e.editMode.annotationGutterWidth=t.annotationGutterWidth??this.settings.annotation_gutter_width,e.editMode.annotationGutterFolded=t.annotationGutterFolded??this.settings.annotation_gutter_default_fold_state)},(e,t)=>{if(this.settings.annotation_gutter){let n=e.editMode.cm.plugin(Eu)?.gutters[0];n&&(e.editMode.annotationGutterWidth=n.width,e.editMode.annotationGutterFolded=n.folded),t.annotationGutterFolded=e.editMode.annotationGutterFolded,t.annotationGutterWidth=e.editMode.annotationGutterWidth}},e=>{this.annotation_gutter_config!==void 0&&(this.annotation_gutter_config.width=e.editMode.annotationGutterWidth,this.annotation_gutter_config.foldState=e.editMode.annotationGutterFolded)}))}async updateEditorExtension(){Object.keys(this.changed_settings).some(e=>Wd.has(e))?(this.loadEditorExtensions(),this.app.workspace.updateOptions(),this.settings.post_processor&&rf(this.app)):Object.keys(this.changed_settings).some(e=>Jd.has(e))&&i0(this.app,e=>{e.dispatch(e.state.update({effects:Os.of(!0)}))})}async onload(){this.registerView(fo,e=>new Al(e,this)),await this.migrateSettings(await this.loadData()),this.defaultEditModeExtension=gi(this.settings.default_edit_mode,this.settings),this.addSettingTab(new Cl(this.app,this)),this.loadEditorExtensions(),this.registerEditorExtension(this.editorExtensions),this.app.workspace.onLayoutReady(()=>{this.previewModeHeaderButton=Yh(this,this.settings.toolbar_preview_button),this.editModeHeaderModeButton=Wh(this,this.settings.toolbar_edit_button)}),this.previewModeStatusBarButton=Uh(this,this.settings.status_bar_preview_button),this.editModeStatusBarButton=qh(this,this.settings.status_bar_edit_button),this.metadataStatusBarButton=jh(this,this.settings.status_bar_metadata_button),this.settings.post_processor&&(this.postProcessor=this.registerMarkdownPostProcessor(async(e,t)=>zu(e,t,this),-99999),Vu(this.app)),this.registerEvent(_h(this)),this.registerEvent(vh(this));for(let e of ph(this))this.addCommand(e);this.register(Xd(this,"commentator",()=>this.database.dropDatabase()))}async migrateSettings(e){let t=this.settings;if(this.settings=Object.assign({},Ls,e),this.previous_settings=Object.assign({},t,this.settings),e===null)await this.setSettings();else{let n=e?.version;try{if(n!==Ls.version){if(n||this.app.workspace.onLayoutReady(async()=>{new xn.Notice("Commentator: rebuilding database for new version",5e3),new xn.Notice("Commentator: metadata and replies features are now available, you can opt-in to these features in the settings",0)}),n.localeCompare("0.2.3",void 0,{numeric:!0})<0&&e.suggestion_gutter_hide_empty){let i=[["suggestion_gutter","diff_gutter"],["suggestion_gutter_hide_empty","diff_gutter_hide_empty"],["comment_gutter_default_fold_state","annotation_gutter_default_fold_state"],["comment_gutter_fold_button","annotation_gutter_fold_button"],["comment_gutter_resize_handle","annotation_gutter_resize_handle"],["comment_gutter_width","annotation_gutter_width"],["comment_gutter_hide_empty","annotation_gutter_hide_empty"]];for(let[s,o]of i)s in this.settings&&(this.settings[o]=this.settings[s],delete this.settings[s]);this.settings.comment_style==="block"&&(this.settings.comment_style="icon",this.settings.annotation_gutter=!0)}this.settings.version=Ls.version,await this.setSettings()}}catch{new xn.Notice("Commentator: Migration to new settings failed, using the default settings provided by the plugin",0)}}}async onExternalSettingsChange(){await this.migrateSettings(await this.loadData())}async onunload(){this.previewModeHeaderButton.detachButtons(),this.editModeHeaderModeButton.detachButtons(),xn.MarkdownPreviewRenderer.unregisterPostProcessor(this.postProcessor),this.database.unload()}async loadSettings(){this.settings=Object.assign({},Ls,await this.loadData())}async setSettings(){await this.saveData(this.settings),this.changed_settings=dh(this.settings,this.previous_settings),this.previous_settings=Object.assign({},this.settings)}async saveSettings(){await this.setSettings(),this.previewModeHeaderButton.setLabelRendering(this.changed_settings.toolbar_show_buttons_labels),this.editModeHeaderModeButton.setLabelRendering(this.changed_settings.toolbar_show_buttons_labels),this.previewModeHeaderButton.setRendering(this.changed_settings.toolbar_preview_button),this.editModeHeaderModeButton.setRendering(this.changed_settings.toolbar_edit_button),this.previewModeStatusBarButton.setRendering(this.changed_settings.status_bar_preview_button),this.editModeStatusBarButton.setRendering(this.changed_settings.status_bar_edit_button),this.metadataStatusBarButton.setRendering(this.changed_settings.status_bar_metadata_button),this.changed_settings.post_processor!==void 0&&(this.changed_settings.post_processor?this.postProcessor=this.registerMarkdownPostProcessor((e,t)=>zu(e,t,this),-99999):xn.MarkdownPreviewRenderer.unregisterPostProcessor(this.postProcessor),Vu(this.app)),this.changed_settings.annotation_gutter_width!==void 0&&ho(this.app,wu.of(this.settings.annotation_gutter_width)),this.changed_settings.annotation_gutter_hide_empty!==void 0&&ho(this.app,xu.of(this.settings.annotation_gutter_hide_empty)),this.changed_settings.diff_gutter_hide_empty!==void 0&&ho(this.app,$u.of(this.settings.diff_gutter_hide_empty)),this.changed_settings.annotation_gutter_fold_button!==void 0&&ho(this.app,ku.of(this.settings.annotation_gutter_fold_button)),this.changed_settings.annotation_gutter_resize_handle!==void 0&&ho(this.app,Su.of(this.settings.annotation_gutter_resize_handle)),this.changed_settings.default_preview_mode!==void 0&&Il(this.editorExtensions,Ts,qt.of(this.settings.default_preview_mode)),this.changed_settings.default_edit_mode!==void 0&&(Il(this.editorExtensions,Ms,gi(this.settings.default_edit_mode,this.settings)),Il(this.editorExtensions,$s,kr.of(this.settings.default_edit_mode))),await this.updateEditorExtension(),Object.keys(this.changed_settings).some(e=>Kd.has(e))&&await this.database.reinitializeDatabase()}async setSetting(e,t){this.settings[e]=t,await this.saveSettings()}async activateView(){this.app.workspace.detachLeavesOfType(fo),await this.app.workspace.getRightLeaf(!1).setViewState({type:fo,active:!0}),await this.app.workspace.revealLeaf(this.app.workspace.getLeavesOfType(fo)[0])}setEditMode(e,t){e&&e.editor&&(e.editor.cm.dispatch(e.editor.cm.state.update({effects:[Ms.reconfigure(gi(t,this.settings)),$s.reconfigure(kr.of(t))]})),this.editModeStatusBarButton.updateButton(t),this.editModeHeaderModeButton.updateButton(e,t))}setPreviewMode(e,t){e&&e instanceof xn.MarkdownView&&(e.editor&&e.editor.cm.dispatch(e.editor.cm.state.update({effects:[Ts.reconfigure(qt.of(t))]})),e.previewMode&&e.previewMode.rerender(!0),this.previewModeStatusBarButton.updateButton(t),this.previewModeHeaderButton.updateButton(e,t))}};
|
|
/*! Bundled license information:
|
|
|
|
localforage/dist/localforage.js:
|
|
(*!
|
|
localForage -- Offline Storage, Improved
|
|
Version 1.10.0
|
|
https://localforage.github.io/localForage
|
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
*)
|
|
*/
|