UNPKG

@getontime/cli

Version:

Time keeping for live events

2 lines 327 kB
System.register(["./jsx-runtime-legacy-DMkDNnVj.js"],function(t,e){var i,n,s,r,o,l,a,h,c,u,d,f,p,g,m,O,v,w,y,b,k,x,S,A,C,M,P,T,Q,R,D,$,E,B,j,N,I,W,L,z,X,V,F,_,H,Y,q,G,U,K,Z,J,tt,et,it,nt,st,rt,ot,lt,at,ht,ct,ut,dt,ft,pt,gt,mt,Ot,vt,wt,yt,bt,kt,xt,St,At,Ct,Mt,Pt,Tt,Qt,Rt,Dt,$t,Et,Bt,jt,Nt,It,Wt,Lt,zt,Xt,Vt,Ft,_t,Ht,Yt,qt,Gt,Ut,Kt,Zt,Jt,te,ee,ie,ne,se,re,oe,le,ae,he,ce,ue,de,fe,pe,ge,me,Oe,ve,we,ye,be,ke,xe,Se,Ae,Ce,Me,Pe,Te,Qe,Re,De,$e,Ee,Be,je,Ne,Ie,We,Le,ze,Xe,Ve,Fe,_e,He,Ye,qe,Ge,Ue,Ke,Ze,Je,ti,ei,ii,ni,si,ri,oi,li,ai,hi,ci,ui,di,fi,pi,gi,mi,Oi,vi,wi,yi,bi,ki,xi,Si,Ai,Ci,Mi,Pi,Ti,Qi,Ri,Di,$i,Ei,Bi,ji,Ni,Ii,Wi,Li,zi,Xi,Vi,Fi,_i,Hi,Yi,qi,Gi,Ui,Ki,Zi,Ji,tn,en,nn,sn,rn,on,ln,an,hn,cn,un,dn,fn,pn,gn,mn,On,vn,wn,yn,bn,kn,xn,Sn,An,Cn,Mn,Pn,Tn,Qn,Rn,Dn,$n,En,Bn,jn,Nn,In,Wn,Ln,zn,Xn,Vn,Fn,_n,Hn,Yn,qn,Gn,Un,Kn,Zn,Jn,ts,es,is,ns,ss,rs,os,ls,as,hs,cs,us,ds,fs,ps,gs,ms,Os,vs,ws,ys,bs,ks,xs,Ss,As,Cs,Ms,Ps,Ts,Qs,Rs,Ds,$s,Es,Bs,js,Ns,Is,Ws,Ls,zs,Xs,Vs,Fs,_s,Hs,Ys,qs,Gs,Us,Ks,Zs,Js,tr,er,ir,nr,sr,rr,or,lr,ar,hr,cr,ur,dr,fr,pr,gr,mr,Or,vr,wr,yr,br,kr,xr,Sr,Ar,Cr,Mr,Pr,Tr,Qr,Rr,Dr,$r,Er,Br,jr,Nr,Ir,Wr,Lr,zr,Xr,Vr,Fr,_r,Hr,Yr,qr,Gr,Ur,Kr,Zr,Jr,to,eo,io,no,so,ro,oo,lo,ao,ho,co,uo,fo,po,go,mo,Oo,vo,wo,yo,bo,ko,xo,So,Ao,Co,Mo,Po,To,Qo,Ro,Do,$o,Eo,Bo,jo,No,Io,Wo,Lo,zo,Xo,Vo,Fo,_o,Ho,Yo,qo,Go,Uo,Ko,Zo,Jo,tl,el,il,nl,sl;function rl(t){if(t<768)return!1;for(let e=0,i=o.length;;){let n=e+i>>1;if(t<o[n])i=n;else{if(!(t>=l[n]))return!0;e=n+1}if(e==i)return!1}}function ol(t){return t>=127462&&t<=127487}function ll(t,e,i=!0,n=!0){return(i?al:hl)(t,e,n)}function al(t,e,i){if(e==t.length)return e;e&&ul(t.charCodeAt(e))&&dl(t.charCodeAt(e-1))&&e--;let n=cl(t,e);for(e+=fl(n);e<t.length;){let s=cl(t,e);if(n==a||s==a||i&&rl(s))e+=fl(s),n=s;else{if(!ol(s))break;{let i=0,n=e-2;for(;n>=0&&ol(cl(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function hl(t,e,i){for(;e>0;){let n=al(t,e-2,i);if(n<e)return n;e--}return 0}function cl(t,e){let i=t.charCodeAt(e);if(!dl(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return ul(n)?n-56320+(i-55296<<10)+65536:i}function ul(t){return t>=56320&&t<57344}function dl(t){return t>=55296&&t<56320}function fl(t){return t<65536?1:2}function pl(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r<t.length&&s<=n;r++){let l=t[r],a=s+l.length;a>=i&&(a>n&&(l=l.slice(0,n-s)),s<i&&(l=l.slice(i-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function gl(t,e,i){return pl(t,[""],e,i)}function ml(t,e,i){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,i))]}function Ol(t,e,i=!0,n=!0){return ll(t,e,i,n)}function vl(t,e,i,n=!1){if(0==e&&i<=0)return;let s=t.length-2;s>=0&&i<=0&&i==t[s+1]?t[s]+=e:s>=0&&0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function wl(t,e,i){if(0==i.length)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<n;)t.push(h.empty);t.push(i)}}function yl(t,e,i){let n=t.inserted;for(let s=0,r=0,o=0;o<t.sections.length;){let l=t.sections[o++],a=t.sections[o++];if(a<0)s+=l,r+=l;else{let c=s,u=r,d=h.empty;for(;c+=l,u+=a,a&&n&&(d=d.append(n[o-2>>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(s,c,r,u,d),s=c,r=u}}}function bl(t,e,i,n=!1){let s=[],r=n?[]:null,o=new y(t),l=new y(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);vl(s,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||a==o.i||0==o.off&&(l.len<o.len||l.len==o.len&&!i))){let t=l.len;for(vl(s,l.ins,-1);t;){let e=Math.min(o.len,t);o.ins>=0&&a<o.i&&o.len<=e&&(vl(s,0,o.ins),r&&wl(r,s,o.text),a=o.i),o.forward(e),t-=e}l.next()}else{if(!(o.ins>=0)){if(o.done&&l.done)return r?w.createSet(s,r):v.create(s);throw new Error("Mismatched change set lengths")}{let t=0,e=o.len;for(;e;)if(-1==l.ins){let i=Math.min(e,l.len);t+=i,e-=i,l.forward(i)}else{if(!(0==l.ins&&l.len<e))break;e-=l.len,l.next()}vl(s,t,a<o.i?o.ins:0),r&&a<o.i&&wl(r,s,o.text),a=o.i,o.forward(o.len-e)}}}}function kl(t,e,i=!1){let n=[],s=i?[]:null,r=new y(t),o=new y(e);for(let l=!1;;){if(r.done&&o.done)return s?w.createSet(n,s):v.create(n);if(0==r.ins)vl(n,r.len,0,l),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");{let t=Math.min(r.len2,o.len),e=n.length;if(-1==r.ins){let e=-1==o.ins?-1:o.off?0:o.ins;vl(n,t,e,l),s&&e&&wl(s,n,o.text)}else-1==o.ins?(vl(n,r.off?0:r.len,t,l),s&&wl(s,n,r.textBit(t))):(vl(n,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&wl(s,n,o.text));l=(r.ins>t||o.ins>=0&&o.len>t)&&(l||n.length>e),r.forward2(t),o.forward(t)}}else vl(n,0,o.ins,l),s&&wl(s,n,o.text),o.next()}}function xl(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}function Sl(t,e){return t==e||t.length==e.length&&t.every((t,i)=>t===e[i])}function Al(t,e,i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],e[n]))return!1;return!0}function Cl(t,e){let i=!1;for(let n of e)1&Tl(t,n)&&(i=!0);return i}function Ml(t,e,i){let n=i.map(e=>t[e.id]),s=i.map(t=>t.type),r=n.filter(t=>!(1&t)),o=t[e.id]>>1;function l(t){let i=[];for(let e=0;e<n.length;e++){let r=Ql(t,n[e]);if(2==s[e])for(let t of r)i.push(t);else i.push(r)}return e.combine(i)}return{create(t){for(let e of n)Tl(t,e);return t.values[o]=l(t),1},update(t,i){if(!Cl(t,r))return 0;let n=l(t);return e.compare(n,t.values[o])?0:(t.values[o]=n,1)},reconfigure(t,s){let r=Cl(t,n),a=s.config.facets[e.id],h=s.facet(e);if(a&&!r&&Sl(i,a))return t.values[o]=h,0;let c=l(t);return e.compare(c,h)?(t.values[o]=h,0):(t.values[o]=c,1)}}}function Pl(t){return e=>new Q(e,t)}function Tl(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let s=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|s}function Ql(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}function Rl(t,e){let i=[];for(let n=0,s=0;;){let r,o;if(n<t.length&&(s==e.length||e[s]>=t[n]))r=t[n++],o=t[n++];else{if(!(s<e.length))return i;r=e[s++],o=e[s++]}!i.length||i[i.length-1]<r?i.push(r,o):i[i.length-1]<o&&(i[i.length-1]=o)}}function Dl(t,e,i){var n;let s,r,o;return i?(s=e.changes,r=w.empty(e.changes.length),o=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),r=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):null===(n=t.selection)||void 0===n?void 0:n.map(s),effects:F.mapEffects(t.effects,s).concat(F.mapEffects(e.effects,r)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function $l(t,e,i){let n=e.selection,s=Bl(e.annotations);return e.userEvent&&(s=s.concat(_.userEvent.of(e.userEvent))),{changes:e.changes instanceof w?e.changes:w.of(e.changes||[],i,t.facet(j)),selection:n&&(n instanceof k?n:k.single(n.anchor,n.head)),effects:Bl(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function El(t,e,i){let n=$l(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(i=!1);for(let r=1;r<e.length;r++){!1===e[r].filter&&(i=!1);let s=!!e[r].sequential;n=Dl(n,$l(t,e[r],s?n.changes.newLength:t.doc.length),s)}let s=_.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return function(t){let e=t.startState,i=e.facet(W),n=t;for(let s=i.length-1;s>=0;s--){let r=i[s](t);r&&Object.keys(r).length&&(n=Dl(n,$l(e,r,t.changes.newLength),!0))}return n==t?t:_.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let s of e.facet(N)){let e=s(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:Rl(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=w.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=_.create(e,n,t.selection&&t.selection.map(s),F.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(I);for(let s=n.length-1;s>=0;s--){let i=n[s](t);t=i instanceof _?i:Array.isArray(i)&&1==i.length&&i[0]instanceof _?i[0]:El(e,Bl(i),!1)}return t}(s):s)}function Bl(t){return null==t?H:Array.isArray(t)?t:[t]}function jl(t){return e=>{if(!/\S/.test(e))return Y.Space;if(function(t){if(G)return G.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||q.test(i)))return!0}return!1}(e))return Y.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return Y.Word;return Y.Other}}function Nl(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}function Il(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}function Wl(t,e,i){let n=new Map;for(let r of t)for(let t=0;t<r.chunk.length;t++)r.chunk[t].maxPoint<=0&&n.set(r.chunk[t],r.chunkPos[t]);let s=new Set;for(let r of e)for(let t=0;t<r.chunk.length;t++){let e=n.get(r.chunk[t]);null==e||(i?i.mapPos(e):e)!=r.chunkPos[t]||(null==i?void 0:i.touchesRange(e,e+r.chunk[t].length))||s.add(r.chunk[t])}return s}function Ll(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let s=t[n];if(n+1<t.length&&s.compare(t[n+1])>=0&&(s=t[n+1],n++),i.compare(s)<0)break;t[n]=i,t[e]=s,e=n}}function zl(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,l=n,a=n-e,h=!!r.boundChange;for(let c=!1;;){let e=t.to+a-i.to,n=e||t.endSide-i.endSide,s=n<0?t.to+a:i.to,u=Math.min(s,o);if(t.point||i.point?(t.point&&i.point&&Nl(t.point,i.point)&&Xl(t.activeForPoint(t.to),i.activeForPoint(i.to))||r.comparePoint(l,u,t.point,i.point),c=!1):(c&&r.boundChange(l),u>l&&!Xl(t.active,i.active)&&r.compareRange(l,u,t.active,i.active),h&&u<o&&(e||t.openEnd(s)!=i.openEnd(s))&&(c=!0)),s>o)break;l=s,n<=0&&t.next(),n>=0&&i.next()}}function Xl(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!Nl(t[i],e[i]))return!1;return!0}function Vl(t,e){for(let i=e,n=t.length-1;i<n;i++)t[i]=t[i+1];t.pop()}function Fl(t,e,i){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=i}function _l(t,e){let i=-1,n=1e9;for(let s=0;s<e.length;s++)(e[s]-n||t[s].endSide-t[i].endSide)<0&&(i=s,n=e[s]);return i}function Hl(t,e,i=t.length){let n=0;for(let s=0;s<i&&s<t.length;)9==t.charCodeAt(s)?(n+=e-n%e,s++):(n++,s=Ol(t,s));return n}function Yl(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}function ql(t,e,i){if(t==e)return!0;t||(t=Pt),e||(e=Pt);let n=Object.keys(t),s=Object.keys(e);if(n.length-(i&&n.indexOf(i)>-1?1:0)!=s.length-(i&&s.indexOf(i)>-1?1:0))return!1;for(let r of n)if(r!=i&&(-1==s.indexOf(r)||t[r]!==e[r]))return!1;return!0}function Gl(t,e,i){let n=!1;if(e)for(let s in e)i&&s in i||(n=!0,"style"==s?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(n=!0,"style"==s?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return n}function Ul(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let n=t.attributes[i];e[n.name]=n.value}return e}function Kl(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function Zl(t,e,i,n=0){let s=i.length-1;s>=0&&i[s]+n>=t?i[s]=Math.max(i[s],e):i.push(t,e)}function Jl(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ta(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function ea(t,e){if(!e.anchorNode)return!1;try{return ta(t,e.anchorNode)}catch(i){return!1}}function ia(t){return 3==t.nodeType?fa(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function na(t,e,i,n){return!!i&&(oa(t,e,i,n,-1)||oa(t,e,i,n,1))}function sa(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function ra(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function oa(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:la(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=sa(t)+(s<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(s<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=s<0?la(t):0}}}function la(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function aa(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function ha(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ca(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function ua(t,e=!0){let i=t.ownerDocument,n=null,s=null;for(let r=t.parentNode;r&&r!=i.body&&(e&&!n||!s);)if(1==r.nodeType)!s&&r.scrollHeight>r.clientHeight&&(s=r),e&&!n&&r.scrollWidth>r.clientWidth&&(n=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:n,y:s}}function da(t){if(t.setActive)return t.setActive();if(Nt)return t.focus(Nt);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Nt?{get preventScroll(){return Nt={preventScroll:!0},!0}}:void 0),!Nt){Nt=!1;for(let t=0;t<e.length;){let i=e[t++],n=e[t++],s=e[t++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=s&&(i.scrollLeft=s)}}}function fa(t,e,i=e){let n=It||(It=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function pa(t,e,i,n){let s={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=n);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,t.dispatchEvent(r);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,t.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function ga(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function ma(t,e){for(let i=t,n=e;;){if(3==i.nodeType&&n>0)return{node:i,offset:n};if(1==i.nodeType&&n>0){if("false"==i.contentEditable)return null;i=i.childNodes[n-1],n=la(i)}else{if(!i.parentNode||ra(i))return null;n=sa(i),i=i.parentNode}}}function Oa(t,e){for(let i=t,n=e;;){if(3==i.nodeType&&n<i.nodeValue.length)return{node:i,offset:n};if(1==i.nodeType&&n<i.childNodes.length){if("false"==i.contentEditable)return null;i=i.childNodes[n],n=0}else{if(!i.parentNode||ra(i))return null;n=sa(i)+1,i=i.parentNode}}}function va(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}function wa(t){return t<=247?Vt[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Ft[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}function ya(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],s=e[i];if(n.from!=s.from||n.to!=s.to||n.direction!=s.direction||!ya(n.inner,s.inner))return!1}return!0}function ba(t,e,i,n,s,r,o){let l=n%2?2:1;if(n%2==s%2)for(let a=e,h=0;a<i;){let e=!0,c=!1;if(h==r.length||a<r[h].from){let t=Gt[a];t!=l&&(e=!1,c=16==t)}let u=e||1!=l?null:[],d=e?n:n+1,f=a;t:for(;;)if(h<r.length&&f==r[h].from){if(c)break t;let p=r[h];if(!e)for(let t=p.to,e=h+1;;){if(t==i)break t;if(!(e<r.length&&r[e].from==t)){if(Gt[t]==l)break t;break}t=r[e++].to}h++,u?u.push(p):(p.from>a&&o.push(new qt(a,p.from,d)),ka(t,p.direction==zt!=!(d%2)?n+1:n,s,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==i||(e?Gt[f]!=l:Gt[f]==l))break;f++}u?ba(t,a,f,n+1,s,u,o):a<f&&o.push(new qt(a,f,d)),a=f}else for(let a=i,h=r.length;a>e;){let i=!0,c=!1;if(!h||a>r[h-1].to){let t=Gt[a-1];t!=l&&(i=!1,c=16==t)}let u=i||1!=l?null:[],d=i?n:n+1,f=a;t:for(;;)if(h&&f==r[h-1].to){if(c)break t;let p=r[--h];if(!i)for(let t=p.from,i=h;;){if(t==e)break t;if(!i||r[i-1].to!=t){if(Gt[t-1]==l)break t;break}t=r[--i].from}u?u.push(p):(p.to<a&&o.push(new qt(p.to,a,d)),ka(t,p.direction==zt!=!(d%2)?n+1:n,s,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==e||(i?Gt[f-1]!=l:Gt[f-1]==l))break;f--}u?ba(t,f,a,n+1,s,u,o):f<a&&o.push(new qt(f,a,d)),a=f}}function ka(t,e,i,n,s,r,o){let l=e%2?2:1;!function(t,e,i,n,s){for(let r=0;r<=n.length;r++){let o=r?n[r-1].to:e,l=r<n.length?n[r].from:i,a=r?256:s;for(let e=o,i=a,n=a;e<l;e++){let s=wa(t.charCodeAt(e));512==s?s=i:8==s&&4==n&&(s=16),Gt[e]=4==s?2:s,7&s&&(n=s),i=s}for(let t=o,e=a,n=a;t<l;t++){let s=Gt[t];if(128==s)t<l-1&&e==Gt[t+1]&&24&e?s=Gt[t]=e:Gt[t]=256;else if(64==s){let s=t+1;for(;s<l&&64==Gt[s];)s++;let r=t&&8==e||s<i&&8==Gt[s]?1==n?1:8:256;for(let e=t;e<s;e++)Gt[e]=r;t=s-1}else 8==s&&1==n&&(Gt[t]=1);e=s,7&s&&(n=s)}}}(t,s,r,n,l),function(t,e,i,n,s){let r=1==s?2:1;for(let o=0,l=0,a=0;o<=n.length;o++){let h=o?n[o-1].to:e,c=o<n.length?n[o].from:i;for(let e,i,n,o=h;o<c;o++)if(i=_t[e=t.charCodeAt(o)])if(i<0){for(let t=l-3;t>=0;t-=3)if(Ht[t+1]==-i){let e=Ht[t+2],i=2&e?s:4&e?1&e?r:s:0;i&&(Gt[o]=Gt[Ht[t]]=i),l=t;break}}else{if(189==Ht.length)break;Ht[l++]=o,Ht[l++]=e,Ht[l++]=a}else if(2==(n=Gt[o])||1==n){let t=n==s;a=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Ht[e+2];if(2&i)break;if(t)Ht[e+2]|=2;else{if(4&i)break;Ht[e+2]|=4}}}}}(t,s,r,n,l),function(t,e,i,n){for(let s=0,r=n;s<=i.length;s++){let o=s?i[s-1].to:t,l=s<i.length?i[s].from:e;for(let a=o;a<l;){let o=Gt[a];if(256==o){let o=a+1;for(;;)if(o==l){if(s==i.length)break;o=i[s++].to,l=s<i.length?i[s].from:e}else{if(256!=Gt[o])break;o++}let h=1==r,c=h==(1==(o<e?Gt[o]:n))?h?1:2:n;for(let e=o,n=s,r=n?i[n-1].to:t;e>a;)e==r&&(e=i[--n].from,r=n?i[n-1].to:t),Gt[--e]=c;a=o}else r=o,a++}}}(s,r,n,l),ba(t,s,r,e,i,n,o)}function xa(t){return[new qt(0,t,0)]}function Sa(t,e,i,n,s){var r;let o=n.head-t.from,l=qt.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc),a=e[l],h=a.side(s,i);if(o==h){let t=l+=s?1:-1;if(t<0||t>=e.length)return null;a=e[l=t],o=a.side(!s,i),h=a.side(s,i)}let c=Ol(t.text,o,a.forward(s,i));(c<a.from||c>a.to)&&(c=h),Ut=t.text.slice(Math.min(o,c),Math.max(o,c));let u=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return u&&c==h&&u.level+(s?0:1)<a.level?k.cursor(u.side(!s,i)+t.from,u.forward(s,i)?1:-1,u.level):k.cursor(c+t.from,a.forward(s,i)?-1:1,a.level)}function Aa(t,e,i){for(let n=e;n<i;n++){let e=wa(t.charCodeAt(n));if(1==e)return zt;if(2==e||4==e)return Xt}return zt}function Ca(t,e,i){let n=t.facet(te);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}function Ma(t,e){let i=t.state.facet(xe);if(!i.length)return i;let n=i.map(e=>e instanceof Function?e(t):e),s=[];return tt.spans(n,e.from,e.to,{point(){},span(t,i,n,r){let o=t-e.from,l=i-e.from,a=s;for(let s=n.length-1;s>=0;s--,r--){let t,i=n[s].spec.bidiIsolate;if(null==i&&(i=Aa(e.text,o,l)),r>0&&a.length&&(t=a[a.length-1]).to==o&&t.direction==i)t.to=l,a=t.inner;else{let t={from:o,to:l,direction:i,inner:[]};a.push(t),a=t.inner}}}}),s}function Pa(t){let e=0,i=0,n=0,s=0;for(let r of t.state.facet(Se)){let o=r(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(s=Math.max(s,o.bottom)))}return{left:e,right:i,top:n,bottom:s}}function Ta(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}function Qa(t,e){let i=t.coordsIn(0,1),n=e.coordsIn(0,1);return i&&n&&n.top<i.bottom}function Ra(t,e){let i=t=>{for(let n of t.children)if((e?n.isText():n.length)||i(n))return!0;return!1};return i(t)}function Da(t){let e=Te.get(t);return e&&e.setDOM(t.cloneNode()),t}function $a(t,e){let i=null==e?void 0:e.get(t);if(1!=i){null==i&&t.destroy();for(let i of t.children)$a(i,e)}}function Ea(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=ma(i.focusNode,i.focusOffset),s=Oa(i.focusNode,i.focusOffset),r=n||s;if(s&&n&&s.node!=n.node){let e=Te.get(s.node);if(!e||e.isText()&&e.text!=s.node.nodeValue)r=s;else if(t.docView.lastCompositionAfterCursor){let t=Te.get(n.node);!t||t.isText()&&t.text!=n.node.nodeValue||(r=s)}}if(t.docView.lastCompositionAfterCursor=r!=n,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function Ba(t,e,i,n,s){let r=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;r+=Math.floor((s-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+function(t,e,i,n){for(let s=0,r=0;;){if(r>=e)return s;if(s==t.length)break;r+=9==t.charCodeAt(s)?i-r%i:1,s=Ol(t,s)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function ja(t,e,i,n){let s=function(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let t;for(let s of n.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;t&&(s.type!=Qt.Text||t.type==s.type&&!(i<0?s.from<e:s.to>e))||(t=s)}}return t||n}return n}(t,e.head,e.assoc||-1),r=n&&s.type==Qt.Text&&(t.lineWrapping||s.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head):null;if(r){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(s.from),o=t.posAtCoords({x:i==(n==Lt.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return k.cursor(o,i?-1:1)}return k.cursor(i?s.to:s.from,i?-1:1)}function Na(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let l=e,a=null;;){let e=Sa(s,r,o,l,i),h=Ut;if(!e){if(s.number==(i?t.state.doc.lines:1))return l;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=t.visualLineSide(s,!i)}if(a){if(!a(h))return l}else{if(!n)return e;a=n(h)}l=e}}function Ia(t,e,i){for(;;){let n=0;for(let s of t)s.between(e-1,e+1,(t,s,r)=>{if(e>t&&e<s){let r=n||i||(e-t<s-e?-1:1);e=r<0?t:s,n=r}});if(!n)return e}}function Wa(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let s=e.ranges[n],r=null;if(s.empty){let e=Ia(t,s.from,0);e!=s.from&&(r=k.cursor(e,-1))}else{let e=Ia(t,s.from,-1),i=Ia(t,s.to,1);e==s.from&&i==s.to||(r=k.range(s.from==s.anchor?e:i,s.from==s.head?e:i))}r&&(i||(i=e.ranges.slice()),i[n]=r)}return i?k.create(i,e.mainIndex):e}function La(t,e,i){let n=Ia(t.state.facet(ke).map(e=>e(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:k.cursor(n,n<i.from?1:-1)}function za(t,e,i,n){let s,r=t.contentDOM.getBoundingClientRect(),o=r.top+t.viewState.paddingTop,{x:l,y:a}=e,h=a-o;for(;;){if(h<0)return new Ze(0,1);if(h>t.viewState.docHeight)return new Ze(t.state.doc.length,-1);if(s=t.elementAtHeight(h),null==n)break;if(s.type==Qt.Text){if(n<0?s.to<t.viewport.from:s.from>t.viewport.to)break;let e=t.docView.coordsAt(n<0?s.from:s.to,n>0?-1:1);if(e&&(n<0?e.top<=h+o:e.bottom>=h+o))break}let e=t.viewState.heightOracle.textHeight/2;h=n>0?s.bottom+e:s.top-e}if(t.viewport.from>=s.to||t.viewport.to<=s.from){if(i)return null;if(s.type==Qt.Text){let e=Ba(t,r,s,l,a);return new Ze(e,e==s.from?1:-1)}}if(s.type!=Qt.Text)return h<(s.top+s.bottom)/2?new Ze(s.from,1):new Ze(s.to,-1);let c=t.docView.lineAt(s.from,2);return c&&c.length==s.length||(c=t.docView.lineAt(s.from,-2)),new Je(t,l,a,t.textDirectionAt(s.from)).scanTile(c,s.from)}function Xa(t,e,i){for(;;){if(!e||i<la(e))return!1;if(e==t)return!0;i=sa(e)+1,e=e.parentNode}}function Va(t,e){let i;for(;t!=e&&t;t=t.nextSibling){let e=Te.get(t);if(!(null==e?void 0:e.isWidget()))return!1;e&&(i||(i=[])).push(e)}if(i)for(let n of i){let t=n.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}function Fa(t,e,i,n){if(t.isComposite()){let s=-1,r=-1,o=-1,l=-1;for(let a=0,h=n,c=n;a<t.children.length;a++){let n=t.children[a],u=h+n.length;if(h<e&&u>i)return Fa(n,e,i,h);if(u>=e&&-1==s&&(s=a,r=h),h>i&&n.dom.parentNode==t.dom){o=a,l=c;break}c=u,h=u+n.breakAfter}return{from:r,to:l<0?n+t.length:l,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function _a(t,e){let i,{newSel:n}=e,{state:s}=t,r=s.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:t,to:n}=e.bounds,l=r.from,a=null;(8===o||Mt.android&&e.text.length<n-t)&&(l=r.to,a="end");let c,u,d=s.doc.sliceString(t,n,ti);!r.empty&&r.from>=t&&r.to<=n&&(e.typeOver||d!=e.text)&&d.slice(0,r.from-t)==e.text.slice(0,r.from-t)&&d.slice(r.to-t)==e.text.slice(c=e.text.length-(d.length-(r.to-t)))?i={from:r.from,to:r.to,insert:h.of(e.text.slice(r.from-t,c).split(ti))}:(u=Ya(d,e.text,l-t,a))&&(Mt.chrome&&13==o&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==ti+ti&&u.toB--,i={from:t+u.from,to:t+u.toA,insert:h.of(e.text.slice(u.from,u.toB).split(ti))})}else n&&(!t.hasFocus&&s.facet(de)||qa(n,r))&&(n=null);if(!i&&!n)return!1;if((Mt.mac||Mt.android)&&i&&i.from==i.to&&i.from==r.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(n&&2==i.insert.length&&(n=k.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:h.of([i.insert.toString().replace("."," ")])}):s.doc.lineAt(r.from).to<r.to&&t.docView.lineHasWidget(r.to)&&t.inputState.insertingTextAt>Date.now()-50?i={from:r.from,to:r.to,insert:s.toText(t.inputState.insertingText)}:Mt.chrome&&i&&i.from==i.to&&i.from==r.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(n&&(n=k.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:h.of([" "])}),i)return Ha(t,i,n,o);if(n&&!qa(n,r)){let e=!1,i="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),i=t.inputState.lastSelectionOrigin,"select.pointer"==i&&(n=Wa(s.facet(ke).map(e=>e(t)),n))),t.dispatch({selection:n,scrollIntoView:e,userEvent:i}),!0}return!1}function Ha(t,e,i,n=-1){if(Mt.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Mt.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&" "==t.state.sliceDoc(e.from,s.from))&&1==e.insert.length&&2==e.insert.lines&&pa(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&0==e.insert.length||8==n&&e.insert.length<e.to-e.from&&e.to>s.head)&&pa(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&0==e.insert.length&&pa(t.contentDOM,"Delete",46)))return!0;let r,o=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l=()=>r||(r=function(t,e,i){let n,s=t.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.from<r.from||e.from>r.to){let i=e.from<r.from?-1:1,n=i<0?r.from:r.to,l=Ia(s.facet(ke).map(e=>e(t)),n,i);e.from==l&&(o=l)}if(o>-1)n={changes:e,selection:k.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=r.from<e.from?s.sliceDoc(r.from,e.from):"",o=r.to>e.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=s.changes(e),l=i&&i.main.to<=o.newLength?i.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let a,h=t.state.sliceDoc(e.from,e.to),c=i&&Ea(t,i.main.head);if(c){let t=e.insert.length-(e.to-e.from);a={from:c.from,to:c.to-t}}else a=t.state.doc.lineAt(r.head);let u=r.to-e.to;n=s.changeByRange(i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:l||i.map(o)};let n=i.to-u,c=n-h.length;if(t.state.sliceDoc(c,n)!=h||n>=a.from&&c<=a.to)return{range:i};let d=s.changes({from:c,to:n,insert:e.insert}),f=i.to-r.to;return{changes:d,range:l?k.range(Math.max(0,l.anchor+f),Math.max(0,l.head+f)):i.map(d)}})}else n={changes:o,selection:l&&s.selection.replaceRange(l)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:l,scrollIntoView:!0})}(t,e,i));return t.state.facet(ie).some(i=>i(t,e.from,e.to,o,l))||t.dispatch(l()),!0}function Ya(t,e,i,n){let s=Math.min(t.length,e.length),r=0;for(;r<s&&t.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==s&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;return"end"==n&&(i-=o+Math.max(0,r-Math.min(o,l))-r),o<r&&t.length<e.length?(r-=i<=r&&i>=o?r-i:0,l=r+(l-o),o=r):l<r&&(r-=i<=r&&i>=l?r-i:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}function qa(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}function Ga(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(s){Ca(i.state,s)}}}function Ua(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let n of t){let t=n.spec,e=t&&t.plugin.domEventHandlers,s=t&&t.plugin.domEventObservers;if(e)for(let r in e){let t=e[r];t&&i(r).handlers.push(Ga(n.value,t))}if(s)for(let r in s){let t=s[r];t&&i(r).observers.push(Ga(n.value,t))}}for(let n in hi)i(n).handlers.push(hi[n]);for(let n in ci)i(n).observers.push(ci[n]);return e}function Ka(t){return.7*Math.max(0,t)+8}function Za(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function Ja(t,e){e=Za(t.state,se,e);let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=mi&&n.selection.ranges.every(t=>t.empty)&&mi==r.toString()){let t=-1;i=n.changeByRange(i=>{let l=n.doc.lineAt(i.from);if(l.from==t)return{range:i};t=l.from;let a=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:l.from,insert:a},range:k.cursor(i.from+a.length)}})}else i=o?n.changeByRange(t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:k.cursor(t.from+e.length)}}):n.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function th(t,e,i,n){if(1==n)return k.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),s=t.doc.lineAt(e),r=e-s.from;if(0==s.length)return k.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,l=r;i<0?o=Ol(s.text,r,!1):l=Ol(s.text,r);let a=n(s.text.slice(o,l));for(;o>0;){let t=Ol(s.text,o,!1);if(n(s.text.slice(t,o))!=a)break;o=t}for(;l<s.length;){let t=Ol(s.text,l);if(n(s.text.slice(l,t))!=a)break;l=t}return k.range(o+s.from,l+s.from)}(t.state,e,i);{let n=t.docView.lineAt(e,i),s=t.state.doc.lineAt(n?n.posAtEnd:e),r=n?n.posAtStart:s.from,o=n?n.posAtEnd:s.to;return o<t.state.doc.length&&o==s.to&&o++,k.range(r,o)}}function eh(t){if(!di)return t.detail;let e=fi,i=gi;return fi=t,gi=Date.now(),pi=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(pi+1)%3:1}function ih(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=eh(e),s=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),s=s.map(t.changes))},get(e,r,o){let l,a=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),h=th(t,a.pos,a.assoc,n);if(i.pos!=a.pos&&!r){let e=th(t,i.pos,i.assoc,n),s=Math.min(e.from,h.from),r=Math.max(e.to,h.to);h=s<h.from?k.range(s,r,h.assoc):k.range(r,s,h.assoc)}return r?s.replaceRange(s.main.extend(h.from,h.to,h.assoc)):o&&1==n&&s.ranges.length>1&&(l=function(t,e){for(let i=0;i<t.ranges.length;i++){let{from:n,to:s}=t.ranges[i];if(n<=e&&s>=e)return k.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(s,a.pos))?l:o?s.addRange(h):k.create([h])}}}function nh(t,e,i,n){if(!(i=Za(t.state,se,i)))return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=t.inputState,o=n&&r&&function(t,e){let i=t.state.facet(Zt);return i.length?i[0](e):Mt.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:r.from,to:r.to}:null,l={from:s,insert:i},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}function sh(t,e){let i=[];for(let n of t.facet(ne)){let s=n(t,e);s&&i.push(s)}return i.length?t.update({effects:i,annotations:Oi.of(!0)}):null}function rh(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=sh(t.state,e);i?t.dispatch(i):t.update([])}},10)}function oh(){yi=!1}function lh(t,e){return t==e?t:(t.constructor!=e.constructor&&(yi=!0),e)}function ah(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Qi&&(n=t[e+1])instanceof Qi&&t.splice(e-1,3,new Qi(i.length+1+n.length))}function hh(t,e){let i=t.getBoundingClientRect(),n=t.ownerDocument,s=n.defaultView||window,r=Math.max(0,i.left),o=Math.min(s.innerWidth,i.right),l=Math.max(0,i.top),a=Math.min(s.innerHeight,i.bottom);for(let h=t.parentNode;h&&h!=n.body;)if(1==h.nodeType){let e=h,i=window.getComputedStyle(e);if((e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)&&"visible"!=i.overflow){let i=e.getBoundingClientRect();r=Math.max(r,i.left),o=Math.min(o,i.right),l=Math.max(l,i.top),a=Math.min(h==t.parentNode?s.innerHeight:a,i.bottom)}h="absolute"==i.position||"fixed"==i.position?e.offsetParent:e.parentNode}else{if(11!=h.nodeType)break;h=h.host}return{left:r-i.left,right:Math.max(r,o)-i.left,top:l-(i.top+e),bottom:Math.max(l,a)-(i.top+e)}}function ch(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}function uh({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let s=0;;s++){let{from:t,to:i}=e[s],r=i-t;if(n<=r)return t+n;n-=r}}function dh(t,e){let i=0;for(let{from:n,to:s}of t.ranges){if(e<=s){i+=e-n;break}i+=s-n}return i/t.total}function fh(t){let e=t.facet(we).filter(t=>"function"!=typeof t),i=t.facet(be).filter(t=>"function"!=typeof t);return i.length&&e.push(tt.join(i)),e}function ph(t,e){if(1==e.scale)return t;let i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new xi(t.from,t.length,i,n-i,Array.isArray(t._content)?t._content.map(t=>ph(t,e)):t._content)}function gh(t,e,i){return new at(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]}):t+" "+e})}function mh(t,e,i){for(;e;){let n=Te.get(e);if(n&&n.parent==t)return n;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}function Oh(t,e){let i=e.startContainer,n=e.startOffset,s=e.endContainer,r=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return na(o.node,o.offset,s,r)&&([i,n,s,r]=[s,r,i,n]),{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}}function vh(t,e,i){for(let n=t.state.facet(e),s=n.length-1;s>=0;s--){let e=n[s],r="function"==typeof e?e(t):e;r&&Yl(r,i)}return i}function wh(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}function yh(t){let e=t.facet(sn),i=rn.get(e);return i||rn.set(e,i=function(t,e=en){let i=Object.create(null),n=Object.create(null),s=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},r=(t,n,r,o,l)=>{var a,h;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map(t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,l=i[i.length-1];"Space"==l&&(l=" ");for(let a=0;a<i.length-1;++a){const t=i[a];if(/^(cmd|meta|m)$/i.test(t))o=!0;else if(/^a(lt)?$/i.test(t))n=!0;else if(/^(c|ctrl|control)$/i.test(t))s=!0;else if(/^s(hift)?$/i.test(t))r=!0;else{if(!/^mod$/i.test(t))throw new Error("Unrecognized modifier name: "+t);"mac"==e?o=!0:s=!0}}return n&&(l="Alt-"+l),s&&(l="Ctrl-"+l),o&&(l="Meta-"+l),r&&(l="Shift-"+l),l}(t,e));for(let e=1;e<u.length;e++){let i=u.slice(0,e).join(" ");s(i,!0),c[i]||(c[i]={preventDefault:!0,stopPropagation:!1,run:[e=>{let n=on={view:e,prefix:i,scope:t};return setTimeout(()=>{on==n&&(on=null)},ln),!0}]})}let d=u.join(" ");s(d,!1);let f=c[d]||(c[d]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(a=c._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});r&&f.run.push(r),o&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let o of t){let t=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:n}=o;for(let e in t)t[e].run.push(t=>n(t,an))}let n=o[e]||o.key;if(n)for(let e of t)r(e,n,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(e,"Shift-"+n,o.shift,o.preventDefault,o.stopPropagation)}return i}(e.reduce((t,e)=>t.concat(e),[]))),i}function bh(t,e,i,n){an=e;let s=function(t){var e=!(ft&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||pt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?dt:ut)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),r=function(t){return t<65536?1:2}(function(t,e){let i=t.charCodeAt(e);if(!((n=i)>=55296&&n<56320&&e+1!=t.length))return i;var n;let s=t.charCodeAt(e+1);return function(t){return t>=56320&&t<57344}(s)?s-56320+(i-55296<<10)+65536:i}(s,0))==s.length&&" "!=s,o="",l=!1,a=!1,h=!1;on&&on.view==i&&on.scope==n&&(o=on.prefix+" ",li.indexOf(e.keyCode)<0&&(a=!0,on=null));let c,u,d=new Set,f=t=>{if(t){for(let e of t.run)if(!d.has(e)&&(d.add(e),e(i)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),a=!0)}return!1},p=t[n];return p&&(f(p[o+wh(s,e,!r)])?l=!0:!r||!(e.altKey||e.metaKey||e.ctrlKey)||Mt.windows&&e.ctrlKey&&e.altKey||Mt.mac&&e.altKey&&!e.ctrlKey&&!e.metaKey||!(c=ut[e.keyCode])||c==s?r&&e.shiftKey&&f(p[o+wh(s,e,!0)])&&(l=!0):(f(p[o+wh(c,e,!0)])||e.shiftKey&&(u=dt[e.keyCode])!=s&&u!=c&&f(p[o+wh(u,e,!1)]))&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&h&&e.stopPropagation(),an=null,l}function kh(t,e,i,n){switch(t){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function xh(t,e,i,n){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let e=!n&&t instanceof An&&t.index<0?null:t.parent;if(!e)return t;t=e}let r=n?0:yn.IgnoreOverlays;if(n)for(let o=t,l=o.parent;l;o=l,l=o.parent)o instanceof An&&o.index<0&&(null===(s=l.enter(e,i,r))||void 0===s?void 0:s.from)!=o.from&&(t=l);for(;;){let n=t.enter(e,i,r);if(!n)return t;t=n}}function Sh(t,e,i,n){let s=t.cursor(),r=[];if(!s.firstChild())return r;if(null!=i)for(let o=!1;!o;)if(o=s.type.is(i),!s.nextSibling())return r;for(;;){if(null!=n&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return null==n?r:[]}}function Ah(t,e,i=e.length-1){for(let n=t;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}function Ch(t){if(!t.length)return null;let e=0,i=t[0];for(let r=1;r<t.length;r++){let n=t[r];(n.from>i.from||n.to<i.to)&&(i=n,e=r)}let n=i instanceof An&&i.index<0?null:i.parent,s=t.slice();return n?s[e]=n:s.splice(e,1),new Pn(s,i)}function Mh(t){return t.children.some(t=>t instanceof xn||!t.type.isAnonymous||Mh(t))}function Ph(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=cn,reused:r=[],minRepeatType:o=n.types.length}=t,l=Array.isArray(i)?new kn(i,i.length):i,a=n.types,h=0,c=0;function u(t,e,i,m,O,v){let{id:w,start:y,end:b,size:k}=l,x=c,S=h;if(k<0){if(l.next(),-1==k){let e=r[w];return i.push(e),void m.push(y-t)}if(-3==k)return void(h=w);if(-4==k)return void(c=w);throw new RangeError(`Unrecognized record size: ${k}`)}let A,C,M=a[w],P=y-t;if(b-y<=s&&(C=function(t,e){let i=l.fork(),n=0,r=0,a=0,h=i.end-s,c={size:0,start:0,skip:0};t:for(let s=i.pos-t;i.pos>s;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=r,c.skip=a,a+=4,n+=4,i.next();continue}let l=i.pos-t;if(t<0||l<s||i.start<h)break;let u=i.id>=o?4:0,d=i.start;for(i.next();i.pos>l;){if(i.size<0){if(-3!=i.size&&-4!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,a+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=a),c.size>4?c:void 0}(l.pos-e,O))){let e=new Uint16Array(C.size-C.skip),i=l.pos-C.size,s=e.length;for(;l.pos>i;)s=g(C.start,e,s);A=new xn(e,b-C.start,n),P=C.start-t}else{let t=l.pos-k;l.next();let e=[],i=[],n=w>=o?w:-1,r=0,a=b;for(;l.pos>t;)n>=0&&l.id==n&&l.size>=0?(l.end<=a-s&&(f(e,i,y,r,l.end,a,n,x,S),r=e.length,a=l.end),l.next()):v>2500?d(y,t,e,i):u(y,t,e,i,n,v+1);if(n>=0&&r>0&&r<e.length&&f(e,i,y,r,y,a,n,x,S),e.reverse(),i.reverse(),n>-1&&r>0){let t=function(t,e){return(i,n,s)=>{let r,o,l=0,a=i.length-1;if(a>=0&&(r=i[a])instanceof bn){if(!a&&r.type==t&&r.length==s)return r;(o=r.prop(fn.lookAhead))&&(l=n[a]+r.length+o)}return p(t,i,n,s,l,e)}}(M,S);A=Qh(M,e,i,0,e.length,0,b-y,t,t)}else A=p(M,e,i,b-y,x-b,S)}i.push(A),m.push(P)}function d(t,e,i,r){let o=[],a=0,h=-1;for(;l.pos>e;){let{id:t,start:e,end:i,size:n}=l;if(n>4)l.next();else{if(h>-1&&e<h)break;h<0&&(h=i-s),o.push(t,e,i),a++,l.next()}}if(a){let e=new Uint16Array(4*a),s=o[o.length-2];for(let t=o.length-3,i=0;t>=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-s,e[i++]=o[t+2]-s,e[i++]=i;i.push(new xn(e,o[2]-s,n)),r.push(s-t)}}function f(t,e,i,s,r,o,l,a,h){let c=[],u=[];for(;t.length>s;)c.push(t.pop()),u.push(e.pop()+i-r);t.push(p(n.types[l],c,u,o-r,a-o,h)),e.push(r-i)}function p(t,e,i,n,s,r,o){if(r){let t=[fn.contextHash,r];o=o?[t].concat(o):[t]}if(s>25){let t=[fn.lookAhead,s];o=o?[t].concat(o):[t]}return new bn(t,e,i,n,o)}function g(t,e,i){let{id:n,start:s,end:r,size:a}=l;if(l.next(),a>=0&&n<o){let o=i;if(a>4){let n=l.pos-(a-4);for(;l.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==a?h=n:-4==a&&(c=n);return i}let m=[],O=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,m,O,-1,0);let v=null!==(e=t.length)&&void 0!==e?e:m.length?O[0]+m[0].length:0;return new bn(a[t.topID],m.reverse(),O.reverse(),v)}function Th(t,e){if(!t.isAnonymous||e instanceof xn||e.type!=t)return 1;let i=Qn.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bn)){i=1;break}i+=Th(t,n)}Qn.set(e,i)}return i}function Qh(t,e,i,n,s,r,o,l,a){let h=0;for(let f=n;f<s;f++)h+=Th(t,e[f]);let c=Math.ceil(1.5*h/8),u=[],d=[];return function e(i,n,s,o,l){for(let h=s;h<o;){let s=h,f=n[h],p=Th(t,i[h]);for(h++;h<o;h++){let e=Th(t,i[h]);if(p+e>=c)break;p+=e}if(h==s+1){if(p>c){let t=i[s];e(t.children,t.positions,0,t.children.length,n[s]+l);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(Qh(t,i,n,s,h,f,e,null,a))}d.push(f+l-r)}}(e,i,n,s,0),(l||a)(u,d,o)}function Rh(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],s=2,r=t;for(let e=0;;){if("..."==r&&e>0&&e+3==t.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);r=t.slice(e)}let o=i.length-1,l=i[o];if(!l)throw new RangeError("Invalid path: "+t);e[l]=new Ln(n,s,o>0?i.slice(0,o):null).sort(e[l])}}return Wn.add(e)}function Dh(t,e){let i=Object.create(null);for(let r of t)if(Array.isArray(r.tag))for(let t of r.tag)i[t.id]=r.class;else i[r.tag.id]=r.class;let{scope:n,all:s=null}=e||{};return{style:t=>{let e=s;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function $h(t,e,i,n=0,s=t.length){let r=new zn(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}function Eh(t,e,i){let n=t.facet(ms),s=Bh(t).topNode;if(!n||n.allowsNesting)for(let r=s;r;r=r.enter(e,i,yn.ExcludeBuffers|yn.EnterBracketed))r.type.isTop&&(s=r);return s}function Bh(t){let e=t.field(ls.state,!1);return e?e.tree:bn.empty}function jh(t,e,i){return Dn.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}function Nh(t){let e=t.facet(ws);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ih(t,e){let i="",n=t.tabSize,s=t.facet(ws)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let r=0;r<e;r++)i+=s;return i}function Wh(t,e){t instanceof U&&(t=new ys(t));for(let n of t.state.facet(vs)){let i=n(t,e);if(void 0!==i)return i}let i=Bh(t.state);return i.length>=e?function(t,e,i){let n=e.resolveStack(i),s=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(s!=n.node){let t=[];for(let e=s;e&&!(e.from<n.node.from||e.to>n.node.to||e.from==n.node.from&&e.type==n.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return Lh(n,t,i)}(t,i,e):null}function Lh(t,e,i){for(let n=t;n;n=n.next){let t=zh(n.node);if(t)return t(ks.create(e,i,n))}return 0}function zh(t){let e=t.type.prop(bs);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(fn.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>function(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,l=n&&r.slice(o,o+n.length)==n||s==t.pos+o,a=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,r=t.state.doc.lineAt(i.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let l=i.to;;){let t=e.childAfter(l);if(!t||t==n)return null;if(!t.type.isSkipped){if(t.from>=o)return null;let e=/^ */.exec(r.text.slice(i.to-r.from))[0].length;return{from:i.from,to:i.to+e}}l=t.to}}(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*i)}(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Xh:null}function Xh(){return 0}function Vh(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function Fh({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function _h(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}function Hh(t){let e=t.facet(As);return e.length?e:t.facet(Cs)}function Yh(t,e){let i,n=[Ps];return t instanceof Ss&&(t.module&&n.push(Ki.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(Cs.of(t)):i?n.push(As.computeN([Ki.darkTheme],e=>e.facet(Ki.darkTheme)==("dark"==i)?[t]:[])):n.push(As.of(t)),n}function qh(t,e,i){let n=t.prop(e<0?fn.openedBy:fn.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function Gh(t){let e=t.type.prop(Rs);return e?e(t.node):t}function Uh(t,e,i,n={}){let s=n.maxScanDistance||Ts,r=n.brackets||Qs,o=Bh(t),l=o.resolveInner(e,i);for(let a=l;a;a=a.parent){let t=qh(a.type,i,r);if(t&&a.from<a.to){let n=Gh(a);if(n&&(i>0?e>=n.from&&e<n.to:e>n.from&&e<=n.to))return Kh(0,0,i,a,n,t,r)}}return function(t,e,i,n,s,r,o){if(i<0?!e:e==t.doc.length)return null;let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let d=0;!c.next().done&&d<=r;){let t=c.value;i<0&&(d+=t.length);let r=e+d*i;for(let e=i>0?0:t.length-1,l=i>0?t.length:-1;e!=l;e+=i){let l=o.indexOf(t[e]);if(!(l<0||n.resolveInner(r+e,1).type!=s))if(l%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:r+e,to:r+e+1},matched:l>>1==a>>1};u--}}i>0&&(d+=t.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,l.type,s,r)}function Kh(t,e,i,n,s,r,o){let l=n.parent,a={from:s.from,to:s.to},h=0,c=null==l?void 0:l.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&r.indexOf(c.type.name)>-1&&c.from<c.to){let t=Gh(c);return{start:a,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(qh(c.type,i,o))h++;else if(qh(c.type,-i,o)){if(0==h){let t=Gh(c);return{start:a,end:t&&t.from<t.to?{from:t.from,to:t.to}:void 0,matched:!1}}h--}}}while(i<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function Zh(t,e){Es.indexOf(t)>-1||(Es.push(t),console.warn(e))}function Jh(t,e){let i=[];for(let l of e.split(" ")){let e=[];for(let i of l.split(".")){let n=t[i]||ns[i];n?"function"==typeof n?e.length?e=e.map(n):Zh(i,`Modifier ${i} used at start of tag`):e.length?Zh(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:Zh(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+i.map(t=>t.id),r=Bs[s];if(r)return r.id;let o=Bs[s]=mn.define({id:$s.length,name:n,props:[Rh({[n]:i})]});return $s.push(o),o.id}function tc(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=t(e,i);return!!s&&(n(i.update(s)),!0)}}function ec(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}function ic(t,e,i=e.selection.ranges){let n=i.map(t=>ec(e,t.from).block);if(!n.every(t=>t))return null;let s=i.map((t,i)=>function(t,{open:e,close:i},n,s){let r,o,l=t.sliceDoc(n-zs,n),a=t.sliceDoc(s,s+zs),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-e.length,u)==e&&a.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*zs?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+zs),o=t.sliceDoc(s-zs,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to));if(2!=t&&!s.every(t=>t))return{changes:e.changes(i.map((t,e)=>s[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}]))};if(1!=t&&s.some(t=>t)){let t=[];for(let e,i=0;i<s.length;i++)if(e=s[i]){let s=n[i],{open:r,close:o}=e;t.push({from:r.pos-s.open.length,to:r.pos+r.margin},{from:o.pos-o.margin,to:o.pos+s.close.length})}return{changes:t}}return null}function nc(t,e,i=e.selection.ranges){let n=[],s=-1;t:for(let{from:r,to:o}of i){let t,i=n.length,l=1e9;for(let a=r;a<=o;){let i=e.doc.lineAt(a);if(null==t&&(t=ec(e,i.from).line,!t))continue t;if(i.from>s&&(r==o||o>i.from)){s=i.from;let e=/^\s*/.exec(i.text)[0].length,r=e==i.length,o=i.text.slice(e,e+t.length)==t?e:-1;e<i.text.length&&e<l&&(l=e),n.push({line:i,comment:o,token:t,indent:e,empty:r,single:!1})}a=i.to+1}if(l<1e9)for(let e=i;e<n.length;e++)n[e].indent<n[e].line.text.length&&(n[e].indent=l);n.length==i+1&&(n[i].single=!0)}if(2!=t&&n.some(t=>t.comment<0&&(!t.empty||t.single))){let t=[];for(let{line:e,token:s,indent:r,empty:o,single:l}of n)!l&&o||t.push({from:e.from+r,insert:s+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some(t=>t.comment>=0)){let t=[];for(let{line:e,comment:i,token:s}of n)if(i>=0){let n=e.from+i,r=n+s.length;" "==e.text[r-e.from]&&r++,t.push({from:n,to:r})}return{changes:t}}return null}function sc(t,e,i,n){let s=e+1>i+20?e-i-1:0,r=t.slice(s,e);return r.push(n),r}function rc(t,e){return t.length?e.length?t.concat(e):t:e}function oc(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function lc(t,e){if(!t.length)return t;let i=t.length,n=_s;for(;i;){let s=ac(t[i-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let e=t.slice(0,i);return e[i-1]=s,e}e=s.mapped,i--,n=s.selectionsAfter}return n.length?[Fs.selection(n)]:_s}function ac(t,e,i){let n=rc(t.selectionsAfter.length?t.selectionsAfter.map(t=>t.map(e)):_s,i);if(!t.changes)return Fs.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Fs(s,F.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}function hc(t,e){return k.create(t.ranges.map(e),t.mainIndex)}function cc(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function uc({state:t,dispatch:e},i){let n=hc(t.selection,i);return!n.eq(t.selection,!0)&&(e(cc(t,n)),!0)}function dc(t,e){return k.cursor(e?t.to:t.from)}function fc(t,e){return uc(t,i=>i.empty?t.moveByChar(i,e):dc(i,e))}function pc(t){return t.textDirectionAt(t.state.selection.main.head)==Lt.LTR}function gc(t,e){return uc(t,i=>i.empty?t.moveByGroup(i,e):dc(i,e))}function mc(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Oc(t,e,i){let n,s,r=Bh(t).resolveInner(e.head),o=i?fn.closedBy:fn.openedBy;for(let l=e.head;;){let e=i?r.childAfter(l):r.childBefore(l);if(!e)break;mc(t,e,o)?r=e:l=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Uh(t,r.from,1):Uh(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,k.cursor(s,i?-1:1)}function vc(t,e){return uc(t,i=>{if(!i.empty)return dc(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}function wc(t){let e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,s=0;if(i){for(let e of t.state.facet(Ki.scrollMargins)){let i=e(t);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(s=Math.max(null==i?void 0:i.bottom,s))}e=t.scrollDOM.clientHeight-n-s}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:s,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)}}function yc(t,e){let i,n=wc(t),{state:s}=t,r=hc(s.selection,i=>i.empty?t.moveVertically(i,e,n.height):dc(i,e));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,a=o.bottom-n.marginBottom;e&&e.top>l&&e.bottom<a&&(i=Ki.scrollIntoView(r.main.head,{y:"start",yMargin:e.top-l}))}return t.dispatch(cc(s,r),{effects:i}),!0}function bc(t,e,i){let n=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,i);if(s.head==e.head&&s.head!=(i?n.to:n.from)&&(s=t.moveToLineBoundary(e,i,!1)),!i&&s.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(s=k.cursor(n.from+i))}return s}function kc(t,e){let i=hc(t.state.selection,t=>{let i=e(t);return k.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(t.state.selection)&&(t.dispatch(cc(t.state,i)),!0)}function xc(t,e){return kc(t,i=>t.moveByChar(i,e))}function Sc(t,e){return kc(t,i=>t.moveByGroup(i,e))}function Ac(t,e){return kc(t,i=>t.moveVertically(i,e))}function Cc(t,e){return kc(t,i=>t.moveVertically(i,e,wc(t).height))}function Mc(t,e){let{state:i}=t,n=i.selection,s=i.selection.ranges.slice();for(let r of i.selection.ranges){let n=i.doc.lineAt(r.head);if(e?n.to<t.state.doc.length:n.from>0)for(let i=r;;){let r=t.moveVertically(i,e);if(r.head<n.from||r.head>n.to){s.some(t=>t.head==r.head)||s.push(r);break}if(r.head==i.head)break;i=r}}return s.length!=n.ranges.length&&(t.dispatch(cc(i,k.create(s,s.length-1))),!0)}function Pc(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,s=n.changeByRange(n=>{let{from:s,to:r}=n;if(s==r){let o=e(n);o<s?(i="delete.backward",o=Tc(t,o,!1)):o>s&&(i="delete.forward",o=Tc(t,o,!0)),s=Math.min(s,o),r=Math.max(r,o)}else s=Tc(t,s,!1),r=Tc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:k.cursor(s,s<n.head?-1:1)}});return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ki.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Tc(t,e,i){if(t instanceof Ki)for(let n of t.state.facet(Ki.atomicRanges).map(e=>e(t)))n.between(e,e,(t,n)=>{t<e&&n>e&&(e=i?n:t)});return e}function Qc(t){let e=[],i=-1;for(let n of t.selection.ranges){let s=t.doc.lineAt(n.from),r=t.doc.lineAt(n.to);if(n.empty||n.to!=r.from||(r=t.doc.lineAt(n.to-1)),i>=s.number){let t=e[e.length-1];t.to=r.to,t.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});i=r.number+1}return e}function Rc(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let r of Qc(t)){if(i?r.to==t.doc.length:0==r.from)continue;let e=t.doc.lineAt(i?r.to+1:r.from-1),o=e.length+1;if(i){n.push({from:r.to,to:e.to},{from:r.from,insert:e.text+t.lineBreak});for(let e of r.ranges)s.push(k.range(Math.min(t.doc.length,e.anchor+o),Math.min(t.doc.length,e.head+o)))}else{n.push({from:e.from,to:r.from},{from:r.to,insert:t.lineBreak+e.text});for(let t of r.ranges)s.push(k.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:k.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Dc(t,e,i){if(t.readOnly)return!1;let n=[];for(let r of Qc(t))i?n.push({from:r.from,insert:t.doc.slice(r.from,r.to)+t.lineBreak}):n.push({from:r.to,insert:t.lineBreak+t.doc.slice(r.from,r.to)});let s=t.changes(n);return e(t.update({changes:s,selection:t.selection.map(s,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}function $c(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:n,to:s}=i,r=e.doc.lineAt(n),o=!t&&n==s&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Bh(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(fn.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}(e,n);t&&(n=s=(s<=r.to?r:e.doc.lineAt(s)).to);let l=new ys(e,{simulateBreak:n,simulateDoubleBreak:!!o}),a=Wh(l,n);for(null==a&&(a=Hl(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));s<r.to&&/\s/.test(r.text[s-r.from]);)s++;o?({from:n,to:s}=o):n>r.from&&n<r.from+100&&!/\S/.test(r.text.slice(0,n))&&(n=r.from);let c=["",Ih(e,a)];return o&&c.push(Ih(e,l.lineIndent(r.from,-1))),{changes:{from:n,to:s,insert:h.of(c)},range:k.cursor(n+1+c[1].length)}});return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ec(t,e){let i=-1;return t.changeByRange(n=>{let s=[];for(let o=n.from;o<=n.to;){let r=t.doc.lineAt(o);r.number>i&&(n.empty||n.to>r.from)&&(e(r,s,n),i=r.number),o=r.to+1}let r=t.changes(s);return{changes:s,range:k.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}function Bc(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n<t.length;){let r=0;for(;;){let e=t.charCodeAt(n++),i=!1;if(126==e){r=65535;break}e>=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}function jc(t,e,i,n,s,r){let o=0,l=1<<n,{dialect:a}=i.p.parser;t:for(;0!=(l&t[o]);){let i=t[o+1];for(let u=o+3;u<i;u+=2)if((t[u+1]&l)>0){let i=t[u];if(a.allows(i)&&(-1==e.token.value||e.token.value==i||Ic(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3])){for(;h<c;){let s=h+c>>1,r=i+s+(s<<1),l=t[r],a=t[r+1]||65536;if(n<l)c=s;else{if(!(n>=a)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function Nc(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function Ic(t,e,i,n){let s=Nc(i,n,e);return s<0||Nc(i,n,t)<s}function Wc(t,e,i){let n=t.cursor(yn.IncludeAnonymous);for(n.moveTo(e);;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.to<e:n.from>e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}function Lc(t,e){for(let i=0;i<e.length;i++){let n=e[i];if(n.pos==t.pos&&n.sameState(t))return void(e[i].score<t.score&&(e[i]=t))}e.push(t)}function zc(t,e){return t[e]|t[e+1]<<16}function Xc(t){if(t.external){let e=t.extend?1:0;return(i,n)=>t.external(i,n)<<1|e}return t.get}function Vc(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Fc(t){return t>=48&&t<=57}function _c(t){return Fc(t)||t>=97&&t<=102||t>=65&&t<=70}function Hc(){if(!jo&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())),i.has(n)||(e.push(n),i.add(n)));jo=e.sort().map(t=>({type:"property",label:t,apply:t+": "}))}return jo||[]}function Yc(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function qc(t,e,i){if(e.to-e.from>4096){let n=Vo.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(yn.IncludeAnonymous);if(o.firstChild())do{for(let e of qc(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return Vo.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate(e=>{var r;if(i(e)&&e.matchContext(Fo)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}}),n}}function Gc(){return Gc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Gc.apply(null,arguments)}function Uc({onChange:t,value:e}){const i=(0,tl.useRef)(null),n=(0,tl.useRef)(null),s=(0,tl.useRef)(t);return(0,tl.useEffect)(()=>{s.current=t},[t]),(0,tl.useEffect)(()=>{if(n.current)return;const t=i.current;if(!t)return;const r=Ki.updateListener.of(t=>{t.docChanged&&(t.transactions.some(t=>t.annotation(sl))||s.current(t.state.doc.toString()))}),o=new Ki({state:U.create({doc:e,extensions:[...nl,r]}),parent:t});return n.current=o,()=>{o.destroy(),n.current=null}},[]),(0,tl.useEffect)(()=>{const t=n.current;t&&t.state.doc.toString()!==e&&(t.hasFocus||t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},annotations:sl.of(!0)}))},[e]),(0,il.jsx)("div",{className:el.editor,ref:i})}return{setters:[function(t){i=t.a,n=t.n,s=t.t}],execute:function(){(r=document.createElement("style")).textContent="._blink_6nvhc_1{animation:1s step-start infinite _blink_6nvhc_1}@keyframes _blink_6nvhc_1{0%{opacity:1}50%{opacity:.2}}._fourtyfive_6nvhc_13{transform:rotate(45deg)}._editor_6nvhc_17{width:100%;height:100%}._editor_6nvhc_17 .cm-editor{height:100%}._editor_6nvhc_17 .cm-scroller{height:100%;overflow:auto}\n/*$vite$:1*/",document.head.appendChild(r),function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};t.SENTRY_RELEASE={id:"f14ad0099eab1969fdd065b56af5fdd3cf530de6"};var e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d1ec883b-368c-4ed7-baa2-2c71bb3043a4",t._sentryDebugIdIdentifier="sentry-dbid-d1ec883b-368c-4ed7-baa2-2c71bb3043a4")}catch(t){}}(),o=[],l=[],(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let e=0,i=0;e<t.length;e++)(e%2?l:o).push(i+=t[e])})(),a=8205,h=class t{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=ml(this,t,e);let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),u.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=ml(this,t,e);let i=[];return this.decompose(t,e,i,0),u.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new d(this),s=new d(t);for(let r=e,o=e;;){if(n.next(r),s.next(r),r=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(t=1){return new d(this,t)}iterRange(t,e=this.length){return new f(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new p(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new c(e):u.from(c.split(e,[])):t.empty}},c=class t extends h{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.text[s],o=n+r.length;if((e?i:o)>=t)return new g(n,o,i,r);n=o+1,i++}}decompose(e,i,n,s){let r=e<=0&&i>=this.length?this:new t(gl(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(1&s){let e=n.pop(),i=pl(r.text,e.text.slice(),0,r.length);if(i.length<=32)n.push(new t(i,e.length+r.length));else{let e=i.length>>1;n.push(new t(i.slice(0,e)),new t(i.slice(e)))}}else n.push(r)}replace(e,i,n){if(!(n instanceof t))return super.replace(e,i,n);[e,i]=ml(this,e,i);let s=pl(this.text,pl(n.text,gl(this.text,0,e)),i),r=this.length+n.length-(i-e);return s.length<=32?new t(s,r):u.from(t.split(s,[]),r)}sliceString(t,e=this.length,i="\n"){[t,e]=ml(this,t,e);let n="";for(let s=0,r=0;s<=e&&r<this.text.length;r++){let o=this.text[r],l=s+o.length;s>t&&r&&(n+=i),t<l&&e>s&&(n+=o.slice(Math.max(0,t-s),e-s)),s=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(e,i){let n=[],s=-1;for(let r of e)n.push(r),s+=r.length+1,32==n.length&&(i.push(new t(n,s)),n=[],s=-1);return s>-1&&i.push(new t(n,s)),i}},u=class t extends h{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,l=i+r.lines-1;if((e?l:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(t<=l&&e>=r){let s=n&((r<=t?1:0)|(l>=e?2:0));r>=t&&l<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=l+1}}replace(e,i,n){if([e,i]=ml(this,e,i),n.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&i<=l){let a=o.replace(e-r,i-r,n),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let r=this.children.slice();return r[s]=a,new t(r,this.length-(i-e)+n.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,i,n)}sliceString(t,e=this.length,i="\n"){[t,e]=ml(this,t,e);let n="";for(let s=0,r=0;s<this.children.length&&r<=e;s++){let o=this.children[s],l=r+o.length;r>t&&s&&(n+=i),t<l&&e>r&&(n+=o.sliceString(t-r,e-r,i)),r=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(e,i){if(!(e instanceof t))return 0;let n=0,[s,r,o,l]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=i,r+=i){if(s==o||r==l)return n;let t=this.children[s],a=e.children[r];if(t!=a)return n+t.scanIdentical(a,i);n+=t.length+1}}static from(e,i=e.reduce((t,e)=>t+e.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let t=[];for(let i of e)i.flatten(t);return new c(t,i)}let s=Math.max(32,n>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,u=[];function d(e){let i;if(e.lines>r&&e instanceof t)for(let t of e.children)d(t);else e.lines>o&&(a>o||!a)?(f(),l.push(e)):e instanceof c&&a&&(i=u[u.length-1])instanceof c&&e.lines+i.lines<=32?(a+=e.lines,h+=e.length+1,u[u.length-1]=new c(i.text.concat(e.text),i.length+1+e.length)):(a+e.lines>s&&f(),a+=e.lines,h+=e.length+1,u.push(e))}function f(){0!=a&&(l.push(1==u.length?u[0]:t.from(u,h)),h=-1,a=u.length=0)}for(let t of e)d(t);return f(),1==l.length?l[0]:new t(l,i)}},h.empty=new c([""],0),d=class{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof c?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],r=s>>1,o=n instanceof c?n.text.length:n.children.length;if(r==(e>0?o:0)){if(0==i)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(e>0?0:1)){if(this.offsets[i]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(n instanceof c){let s=n.text[r+(e<0?-1:0)];if(this.offsets[i]+=e,s.length>Math.max(0,t))return this.value=0==t?s:e>0?s.slice(t):s.slice(0,s.length-t),this;t-=s.length}else{let s=n.children[r+(e<0?-1:0)];t>s.length?(t-=s.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(s),this.offsets.push(e>0?1:(s instanceof c?s.text.length:s.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},f=class{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new d(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}},p=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}},"undefined"!=typeof Symbol&&(h.prototype[Symbol.iterator]=function(){return this.iter()},d.prototype[Symbol.iterator]=f.prototype[Symbol.iterator]=p.prototype[Symbol.iterator]=function(){return this}),g=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},m=/\r\n?|\n/,O=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(O||(O={})),v=class t{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,n=0;e<this.sections.length;){let s=this.sections[e++],r=this.sections[e++];r<0?(t(i,n,s),n+=s):n+=r,i+=s}}iterChangedRanges(t,e=!1){yl(this,t,e)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new t(e)}composeDesc(t){return this.empty?t:t.empty?this:kl(this,t)}mapDesc(t,e=!1){return t.empty?this:bl(this,t,e)}mapPos(t,e=-1,i=O.Simple){let n=0,s=0;for(let r=0;r<this.sections.length;){let o=this.sections[r++],l=this.sections[r++],a=n+o;if(l<0){if(a>t)return s+(t-n);s+=o}else{if(i!=O.Simple&&a>=t&&(i==O.TrackDel&&n<t&&a>t||i==O.TrackBefore&&n<t||i==O.TrackAfter&&a>t))return null;if(a>t||a==t&&e<0&&!o)return t==n||e<0?s:s+l;s+=l}n=a}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let i=0,n=0;i<this.sections.length&&n<=e;){let s=n+this.sections[i++];if(this.sections[i++]>=0&&n<=e&&s>=t)return!(n<t&&s>e)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];t+=(t?" ":"")+i+(n>=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>"number"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},w=class t extends v{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return yl(this,(e,i,n,s,r)=>t=t.replace(n,n+(i-e),r),!1),t}mapDesc(t,e=!1){return bl(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let t=0,s=0;t<i.length;t+=2){let r=i[t],o=i[t+1];if(o>=0){i[t]=o,i[t+1]=r;let l=t>>1;for(;n.length<l;)n.push(h.empty);n.push(r?e.slice(s,s+r):h.empty)}s+=r}return new t(i,n)}compose(t){return this.empty?t:t.empty?this:kl(this,t,!0)}map(t,e=!1){return t.empty?this:bl(this,t,e,!0)}iterChanges(t,e=!1){yl(this,t,e)}get desc(){return v.create(this.sections)}filter(e){let i=[],n=[],s=[],r=new y(this);t:for(let t=0,o=0;;){let l=t==e.length?1e9:e[t++];for(;o<l||o==l&&0==r.len;){if(r.done)break t;let t=Math.min(r.len,l-o);vl(s,t,-1);let e=-1==r.ins?-1:0==r.off?r.ins:0;vl(i,t,e),e>0&&wl(n,i,r.text),r.forward(t),o+=t}let a=e[t++];for(;o<a;){if(r.done)break t;let t=Math.min(r.len,a-o);vl(i,t,-1),vl(s,t,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(t),o+=t}}return{changes:new t(i,n),filtered:v.create(s)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],n=this.sections[e+1];n<0?t.push(i):0==n?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,l=null;function a(e=!1){if(!e&&!s.length)return;o<i&&vl(s,i-o,-1);let n=new t(s,r);l=l?l.compose(n.map(l)):n,s=[],r=[],o=0}return function e(c){if(Array.isArray(c))for(let t of c)e(t);else if(c instanceof t){if(c.length!=i)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${i})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:t,to:e=t,insert:l}=c;if(t>e||t<0||e>i)throw new RangeError(`Invalid change range ${t} to ${e} (in doc of length ${i})`);let u=l?"string"==typeof l?h.of(l.split(n||m)):l:h.empty,d=u.length;if(t==e&&0==d)return;t<o&&a(),t>o&&vl(s,t-o,-1),vl(s,e-t,d),wl(r,s,u),o=e}}(e),a(!l),l}static empty(e){return new t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let t=0;t<e.length;t++){let s=e[t];if("number"==typeof s)i.push(s,-1);else{if(!Array.isArray(s)||"number"!=typeof s[0]||s.some((t,e)=>e&&"string"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)i.push(s[0],0);else{for(;n.length<t;)n.push(h.empty);n[t]=h.of(s.slice(1)),i.push(s[0],n[t].length)}}}return new t(i,n)}static createSet(e,i){return new t(e,i)}},y=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?h.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?h.empty:e[i].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},b=class t{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let t=7&this.flags;return 7==t?null:t}get goalColumn(){let t=this.flags>>6;return 16777215==t?void 0:t}map(e,i=-1){let n,s;return this.empty?n=s=e.mapPos(this.from,i):(n=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new t(n,s,this.flags)}extend(t,e=t,i=0){if(t<=this.anchor&&e>=this.anchor)return k.range(t,e,void 0,void 0,i);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return k.range(this.anchor,n,void 0,void 0,i)}eq(t,e=!1){return!(this.anchor!=t.anchor||this.head!=t.head||this.goalColumn!=t.goalColumn||e&&this.empty&&this.assoc!=t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return k.range(t.anchor,t.head)}static create(e,i,n){return new t(e,i,n)}},k=class t{constructor(t,e){this.ranges=t,this.mainIndex=e}map(e,i=-1){return e.empty?this:t.create(this.ranges.map(t=>t.map(e,i)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(t.ranges[i],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new t([this.main],0)}addRange(e,i=!0){return t.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,t.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map(t=>b.fromJSON(t)),e.main)}static single(e,i=e){return new t([t.range(e,i)],0)}static create(e,i=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=n:r.from<n)return t.normalized(e.slice(),i);n=r.to}return new t(e,i)}static cursor(t,e=0,i,n){return b.create(t,t,(0==e?0:e<0?8:16)|(null==i?7:Math.min(6,i))|(null!=n?n:16777215)<<6)}static range(t,e,i,n,s){let r=(null!=i?i:16777215)<<6|(null==n?7:Math.min(6,n));return s||t==e||(s=e<t?1:-1),e<t?b.create(e,t,48|r):b.create(t,e,(s?s<0?8:16:0)|r)}static normalized(e,i=0){let n=e[i];e.sort((t,e)=>t.from-e.from),i=e.indexOf(n);for(let s=1;s<e.length;s++){let n=e[s],r=e[s-1];if(n.empty?n.from<=r.to:n.from<r.to){let o=r.from,l=Math.max(n.to,r.to);s<=i&&i--,e.splice(--s,2,n.anchor>n.head?t.range(l,o):t.range(o,l))}}return new t(e,i)}},x=0,S=class t{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=x++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}get reader(){return this}static define(e={}){return new t(e.combine||(t=>t),e.compareInput||((t,e)=>t===e),e.compare||(e.combine?(t,e)=>t===e:Sl),!!e.static,e.enables)}of(t){return new A([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new A(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new A(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],i=>e(i.field(t)))}},A=class{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=x++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let c of this.dependencies)"doc"==c?l=!0:"selection"==c?a=!0:1&(null!==(e=t[c.id])&&void 0!==e?e:1)||h.push(t[c.id]);return{create:t=>(t.values[r]=i(t),1),update(t,e){if(l&&e.docChanged||a&&(e.docChanged||e.selection)||Cl(t,h)){let e=i(t);if(o?!Al(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let l,a=e.config.address[s];if(null!=a){let s=Ql(e,a);if(this.dependencies.every(i=>i instanceof S?e.facet(i)===t.facet(i):!(i instanceof M)||e.field(i,!1)==t.field(i,!1))||(o?Al(l=i(t),s,n):n(l=i(t),s)))return t.values[r]=s,0}else l=i(t);return t.values[r]=l,1}}}},C=S.define({static:!0}),M=class t{constructor(t,e,i,n,s){this.id=t,this.createF=e,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let i=new t(x++,e.create,e.update,e.compare||((t,e)=>t===e),e);return e.provide&&(i.provides=e.provide(i)),i}create(t){let e=t.facet(C).find(t=>t.field==this);return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],s=this.updateF(n,i);return this.compareF(n,s)?0:(t.values[e]=s,1)},reconfigure:(t,i)=>{let n,s=t.facet(C),r=i.facet(C);return(n=s.find(t=>t.field==this))&&n!=r.find(t=>t.field==this)?(t.values[e]=n.create(t),1):null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}}init(t){return[this,C.of({field:this,create:t})]}get extension(){return this}},T={highest:Pl((P={lowest:4,low:3,default:2,high:1,highest:0}).highest),high:Pl(P.high),default:Pl(P.default),low:Pl(P.low),lowest:Pl(P.lowest)},Q=class{constructor(t,e){this.inner=t,this.prec=e}},R=class t{of(t){return new D(this,t)}reconfigure(e){return t.reconfigure.of({compartment:this,extension:e})}get(t){return t.config.compartments.get(this)}},D=class{constructor(t,e){this.compartment=t,this.inner=e}},$=class t{constructor(t,e,i,n,s,r){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}static resolve(e,i,n){let s=[],r=Object.create(null),o=new Map;for(let t of function(t,e,i){let n=[[],[],[],[],[]],s=new Map;return function t(r,o){let l=s.get(r);if(null!=l){if(l<=o)return;let t=n[l].indexOf(r);t>-1&&n[l].splice(t,1),r instanceof D&&i.delete(r.compartment)}if(s.set(r,o),Array.isArray(r))for(let e of r)t(e,o);else if(r instanceof D){if(i.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(r.compartment)||r.inner;i.set(r.compartment,n),t(n,o)}else if(r instanceof Q)t(r.inner,r.prec);else if(r instanceof M)n[o].push(r),r.provides&&t(r.provides,o);else if(r instanceof A)n[o].push(r),r.facet.extensions&&t(r.facet.extensions,P.default);else{let e=r.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,P.default),n.reduce((t,e)=>t.concat(e))}(e,i,o))t instanceof M?s.push(t):(r[t.facet.id]||(r[t.facet.id]=[])).push(t);let l=Object.create(null),a=[],h=[];for(let t of s)l[t.id]=h.length<<1,h.push(e=>t.slot(e));let c=null==n?void 0:n.config.facets;for(let t in r){let e=r[t],i=e[0].facet,s=c&&c[t]||[];if(e.every(t=>0==t.type))if(l[i.id]=a.length<<1|1,Sl(s,e))a.push(n.facet(i));else{let t=i.combine(e.map(t=>t.value));a.push(n&&i.compare(t,n.facet(i))?n.facet(i):t)}else{for(let t of e)0==t.type?(l[t.id]=a.length<<1|1,a.push(t.value)):(l[t.id]=h.length<<1,h.push(e=>t.dynamicSlot(e)));l[i.id]=h.length<<1,h.push(t=>Ml(t,i,e))}}return new t(e,o,h.map(t=>t(l)),l,a,r)}},E=S.define(),B=S.define({combine:t=>t.some(t=>t),static:!0}),j=S.define({combine:t=>t.length?t[0]:void 0,static:!0}),N=S.define(),I=S.define(),W=S.define(),L=S.define({combine:t=>!!t.length&&t[0]}),z=class{constructor(t,e){this.type=t,this.value=e}static define(){return new X}},X=class{of(t){return new z(this,t)}},V=class{constructor(t){this.map=t}of(t){return new F(this,t)}},(F=class t{constructor(t,e){this.type=t,this.value=e}map(e){let i=this.type.map(this.value,e);return void 0===i?void 0:i==this.value?this:new t(this.type,i)}is(t){return this.type==t}static define(t={}){return new V(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}).reconfigure=F.define(),F.appendConfig=F.define(),_=class t{constructor(e,i,n,s,r,o){this.startState=e,this.changes=i,this.selection=n,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xl(n,i.newLength),r.some(e=>e.type==t.time)||(this.annotations=r.concat(t.time.of(Date.now())))}static create(e,i,n,s,r,o){return new t(e,i,n,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(t.userEvent);return!(!i||!(i==e||i.length>e.length&&i.slice(0,e.length)==e&&"."==i[e.length]))}},_.time=z.define(),_.userEvent=z.define(),_.addToHistory=z.define(),_.remote=z.define(),H=[],Y=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Y||(Y={})),q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{G=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(It){}for(U=class t{constructor(t,e,i,n,s,r){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Tl(this,o<<1);this.computeSlot=null}field(t,e=!0){let i=this.config.address[t.id];if(null!=i)return Tl(this,i),Ql(this,i);if(e)throw new RangeError("Field is not present in this state")}update(...t){return El(this,t,!0)}applyTransaction(e){let i,n=this.config,{base:s,compartments:r}=n;for(let t of e.effects)t.is(R.reconfigure)?(n&&(r=new Map,n.compartments.forEach((t,e)=>r.set(e,t)),n=null),r.set(t.value.compartment,t.value.extension)):t.is(F.reconfigure)?(n=null,s=t.value):t.is(F.appendConfig)&&(n=null,s=Bl(s).concat(t.value));n?i=e.startState.values.slice():(n=$.resolve(s,r,this),i=new t(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(t,e)=>e.reconfigure(t,this),null).values);let o=e.startState.facet(B)?e.newSelection:e.newSelection.asSingle();new t(n,e.newDoc,o,i,(t,i)=>i.update(t,e),e)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:k.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),s=[i.range],r=Bl(i.effects);for(let o=1;o<e.ranges.length;o++){let i=t(e.ranges[o]),l=this.changes(i.changes),a=l.map(n);for(let t=0;t<o;t++)s[t]=s[t].map(a);let h=n.mapDesc(l,!0);s.push(i.range.map(h)),n=n.compose(a),r=F.mapEffects(r,a).concat(F.mapEffects(Bl(i.effects),h))}return{changes:n,selection:k.create(s,e.mainIndex),effects:r}}changes(e=[]){return e instanceof w?e:w.of(e,this.doc.length,this.facet(t.lineSeparator))}toText(e){return h.of(e.split(this.facet(t.lineSeparator)||m))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return null==e?t.default:(Tl(this,e),Ql(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let n=t[i];n instanceof M&&null!=this.config.address[n.id]&&(e[i]=n.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(e,i={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let i=n[t],r=e[t];s.push(i.init(t=>i.spec.fromJSON(r,t)))}return t.create({doc:e.doc,selection:k.fromJSON(e.selection),extensions:i.extensions?s.concat([i.extensions]):s})}static create(e={}){let i=$.resolve(e.extensions||[],new Map),n=e.doc instanceof h?e.doc:h.of((e.doc||"").split(i.staticFacet(t.lineSeparator)||m)),s=e.selection?e.selection instanceof k?e.selection:k.single(e.selection.anchor,e.selection.head):k.single(0);return xl(s,n.length),i.staticFacet(B)||(s=s.asSingle()),new t(i,n,s,i.dynamicSlots.map(()=>null),(t,e)=>e.create(t),null)}get tabSize(){return this.facet(t.tabSize)}get lineBreak(){return this.facet(t.lineSeparator)||"\n"}get readOnly(){return this.facet(L)}phrase(e,...i){for(let n of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(t,e)=>{if("$"==e)return"$";let n=+(e||1);return!n||n>i.length?t:i[n-1]})),e}languageDataAt(t,e,i=-1){let n=[];for(let s of this.facet(E))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){let e=this.languageDataAt("wordChars",t);return jl(e.length?e[0]:"")}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),r=t-i,o=t-i;for(;r>0;){let t=Ol(e,r,!1);if(s(e.slice(t,r))!=Y.Word)break;r=t}for(;o<n;){let t=Ol(e,o);if(s(e.slice(o,t))!=Y.Word)break;o=t}return r==o?null:k.range(r+i,o+i)}},U.allowMultipleSelections=B,U.tabSize=S.define({combine:t=>t.length?t[0]:4}),U.lineSeparator=j,U.readOnly=L,U.phrases=S.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(i=>t[i]==e[i])}}),U.languageData=E,U.changeFilter=N,U.transactionFilter=I,U.transactionExtender=W,R.reconfigure=F.define(),(K=class{eq(t){return this==t}range(t,e=t){return Z.create(t,e,this)}}).prototype.startSide=K.prototype.endSide=0,K.prototype.point=!1,K.prototype.mapMode=O.TrackDel,Z=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}},J=class t{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let s=i?this.to:this.from;for(let r=n,o=s.length;;){if(r==o)return r;let n=r+o>>1,l=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return l>=0?r:o;l>=0?o=n:r=n+1}}between(t,e,i,n){for(let s=this.findIndex(e,-1e9,!0),r=this.findIndex(i,1e9,!1,s);s<r;s++)if(!1===n(this.from[s]+t,this.to[s]+t,this.value[s]))return!1}map(e,i){let n=[],s=[],r=[],o=-1,l=-1;for(let t=0;t<this.value.length;t++){let a,h,c=this.value[t],u=this.from[t]+e,d=this.to[t]+e;if(u==d){let t=i.mapPos(u,c.startSide,c.mapMode);if(null==t)continue;if(a=h=t,c.startSide!=c.endSide&&(h=i.mapPos(u,c.endSide),h<a))continue}else if(a=i.mapPos(u,c.startSide),h=i.mapPos(d,c.endSide),a>h||a==h&&c.startSide>0&&c.endSide<=0)continue;(h-a||c.endSide-c.startSide)<0||(o<0&&(o=a),c.point&&(l=Math.max(l,h-a)),n.push(c),s.push(a-o),r.push(h-o))}return{mapped:n.length?new t(s,r,n,l):null,pos:o}}},tt=class t{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(e,i,n,s){return new t(e,i,n,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(e){let{add:i=[],sort:n=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(0==i.length&&!o)return this;if(n&&(i=i.slice().sort(Il)),this.isEmpty)return i.length?t.of(i):this;let l=new it(this,null,-1).goto(0),a=0,h=[],c=new et;for(;l.value||a<i.length;)if(a<i.length&&(l.from-i[a].from||l.startSide-i[a].value.startSide)>=0){let t=i[a++];c.addInner(t.from,t.to,t.value)||h.push(t)}else 1==l.rangeIndex&&l.chunkIndex<this.chunk.length&&(a==i.length||this.chunkEnd(l.chunkIndex)<i[a].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||r<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(Z.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?t.empty:this.nextLayer.update({add:h,filter:o,filterFrom:s,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],s=-1;for(let t=0;t<this.chunk.length;t++){let r=this.chunkPos[t],o=this.chunk[t],l=e.touchesRange(r,r+o.length);if(!1===l)s=Math.max(s,o.maxPoint),i.push(o),n.push(e.mapPos(r));else if(!0===l){let{mapped:t,pos:l}=o.map(r,e);t&&(s=Math.max(s,t.maxPoint),i.push(t),n.push(l))}}let r=this.nextLayer.map(e);return 0==i.length?r:new t(n,i,r||t.empty,s)}between(t,e,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],r=this.chunk[n];if(e>=s&&t<=s+r.length&&!1===r.between(s,t-s,e-s,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return nt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return nt.from(t).goto(e)}static compare(t,e,i,n,s=-1){let r=t.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s),o=e.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s),l=Wl(r,o,i),a=new st(r,l,s),h=new st(o,l,s);i.iterGaps((t,e,i)=>zl(a,t,h,e,i,n)),i.empty&&0==i.length&&zl(a,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let s=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0),r=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0);if(s.length!=r.length)return!1;if(!s.length)return!0;let o=Wl(s,r),l=new st(s,o,0).goto(i),a=new st(r,o,0).goto(i);for(;;){if(l.to!=a.to||!Xl(l.active,a.active)||l.point&&(!a.point||!Nl(l.point,a.point)))return!1;if(l.to>n)return!0;l.next(),a.next()}}static spans(t,e,i,n,s=-1){let r=new st(t,null,s).goto(e),o=e,l=r.openStart;for(;;){let t=Math.min(r.to,i);if(r.point){let i=r.activeForPoint(r.to),s=r.pointFrom<e?i.length+1:r.point.startSide<0?i.length:Math.min(i.length,l);n.point(o,t,r.point,i,s,r.pointRank),l=Math.min(r.openEnd(t),i.length)}else t>o&&(n.span(o,t,r.active,l),l=r.openEnd(t));if(r.to>i)return l+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new et;for(let n of t instanceof Z?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let n=t[i];if(Il(e,n)>0)return t.slice().sort(Il);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}static join(e){if(!e.length)return t.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let s=e[n];s!=t.empty;s=s.nextLayer)i=new t(s.chunkPos,s.chunk,i,Math.max(s.maxPoint,i.maxPoint));return i}},tt.empty=new tt([],[],null,-1),tt.empty.nextLayer=tt.empty,et=class t{finishChunk(t){this.chunks.push(new J(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,i,n){this.addInner(e,i,n)||(this.nextLayer||(this.nextLayer=new t)).add(e,i,n)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(tt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}},it=class{constructor(t,e,i,n=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){let e=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(e)||this.layer.chunkEnd(this.chunkIndex)<t||e.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex];if(this.from=t+e.from[this.rangeIndex],this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}},nt=class t{constructor(t){this.heap=t}static from(e,i=null,n=-1){let s=[];for(let t=0;t<e.length;t++)for(let r=e[t];!r.isEmpty;r=r.nextLayer)r.maxPoint>=n&&s.push(new it(r,i,n,t));return 1==s.length?s[0]:new t(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)Ll(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)Ll(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Ll(this.heap,0)}}},st=class{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=nt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Vl(this.active,t),Vl(this.activeTo,t),Vl(this.activeRank,t),this.minActive=_l(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:s}=this.cursor;for(;e<this.activeRank.length&&(s-this.activeRank[e]||n-this.activeTo[e])>0;)e++;Fl(this.active,e,i),Fl(this.activeTo,e,n),Fl(this.activeRank,e,s),t&&Fl(t,e,this.cursor.from),this.minActive=_l(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Vl(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=t,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=t.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(i),this.cursor.next()}}}if(i){this.openStart=0;for(let e=i.length-1;e>=0&&i[e]<t;e--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}},rt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),ot="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),lt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},at=class{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,e,r,o){let l=[],a=/^@(\w+)\b/.exec(t[0]),h=a&&"keyframes"==a[1];if(a&&null==e)return r.push(t[0]+";");for(let i in e){let o=e[i];if(/&/.test(i))s(i.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((t,e)=>t.concat(e)),o,r);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,l,h)}else null!=o&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,t=>"-"+t.toLowerCase())+": "+o+";")}(l.length||h)&&r.push((!i||a||o?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let r in t)s(n(r),t[r],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=lt[rt]||1;return lt[rt]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[ot],s=i&&i.nonce;n?s&&n.setNonce(s):n=new ct(t,s),n.mount(Array.isArray(e)?e:[e],t)}},ht=new Map,ct=class{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=ht.get(i);if(e)return t[ot]=e;this.sheet=new n.CSSStyleSheet,ht.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[ot]=this}mount(t,e){let i=this.sheet,n=0,s=0;for(let r=0;r<t.length;r++){let e=t[r],o=this.modules.indexOf(e);if(o<s&&o>-1&&(this.modules.splice(o,1),s--,o=-1),-1==o){if(this.modules.splice(s++,0,e),i)for(let t=0;t<e.rules.length;t++)i.insertRule(e.rules[t],n++)}else{for(;s<o;)n+=this.modules[s++].rules.length;n+=e.rules.length,s++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t;let i=e.head||e;this.styleTag.parentNode!=i&&i.insertBefore(this.styleTag,i.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}},ut={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},dt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ft="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),pt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),e=0;e<10;e++)ut[48+e]=ut[96+e]=String(e);for(var e=1;e<=24;e++)ut[e+111]="F"+e;for(e=65;e<=90;e++)ut[e]=String.fromCharCode(e+32),dt[e]=String.fromCharCode(e);for(gt in ut)dt.hasOwnProperty(gt)||(dt[gt]=ut[gt]);mt="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Ot="undefined"!=typeof document?document:{documentElement:{style:{}}},vt=/Edge\/(\d+)/.exec(mt.userAgent),wt=/MSIE \d/.test(mt.userAgent),yt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mt.userAgent),kt=!(bt=!!(wt||yt||vt))&&/gecko\/(\d+)/i.test(mt.userAgent),xt=!bt&&/Chrome\/(\d+)/.exec(mt.userAgent),St="webkitFontSmoothing"in Ot.documentElement.style,At=!bt&&/Apple Computer/.test(mt.vendor),Ct=At&&(/Mobile\/\w+/.test(mt.userAgent)||mt.maxTouchPoints>2),Mt={mac:Ct||/Mac/.test(mt.platform),windows:/Win/.test(mt.platform),linux:/Linux|X11/.test(mt.platform),ie:bt,ie_version:wt?Ot.documentMode||6:yt?+yt[1]:vt?+vt[1]:0,gecko:kt,gecko_version:kt?+(/Firefox\/(\d+)/.exec(mt.userAgent)||[0,0])[1]:0,chrome:!!xt,chrome_version:xt?+xt[1]:0,ios:Ct,android:/Android\b/.test(mt.userAgent),webkit:St,webkit_version:St?+(/\bAppleWebKit\/(\d+)/.exec(mt.userAgent)||[0,0])[1]:0,safari:At,safari_version:At?+(/\bVersion\/(\d+(\.\d+)?)/.exec(mt.userAgent)||[0,0])[1]:0,tabSize:null!=Ot.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Pt=Object.create(null),Tt=class{eq(t){return!1}updateDOM(t,e,i){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},Qt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Qt||(Qt={})),(Rt=class extends K{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Dt(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Et(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:s,end:r}=Kl(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new Et(t,e,i,n,t.widget||null,!0)}static line(t){return new $t(t)}static set(t,e=!1){return tt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}).none=tt.empty,(Dt=class t extends Rt{constructor(t){let{start:e,end:i}=Kl(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?Yl(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Pt}eq(e){return this==e||e instanceof t&&this.tagName==e.tagName&&ql(this.attrs,e.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}).prototype.point=!1,($t=class t extends Rt{constructor(t){super(-2e8,-2e8,null,t)}eq(e){return e instanceof t&&this.spec.class==e.spec.class&&ql(this.spec.attributes,e.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}).prototype.mapMode=O.TrackBefore,$t.prototype.point=!0,(Et=class t extends Rt{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?O.TrackBefore:O.TrackAfter:O.TrackDel}get type(){return this.startSide!=this.endSide?Qt.WidgetRange:this.startSide<=0?Qt.WidgetBefore:Qt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof t&&(i=this.widget,n=e.widget,i==n||!!(i&&n&&i.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var i,n}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}).prototype.point=!0,(Bt=class t extends K{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(e){return e==this||e instanceof t&&this.tagName==e.tagName&&ql(this.attributes,e.attributes)}static create(e){return new t(e.tagName,e.attributes||Pt)}static set(t,e=!1){return tt.of(t,e)}}).prototype.startSide=Bt.prototype.endSide=-1,jt=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?la(e):0),i,Math.min(t.focusOffset,i?la(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}},Nt=null,Mt.safari&&Mt.safari_version>=26&&(Nt=!1),Wt=class t{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(e,i){return new t(e.parentNode,sa(e),i)}static after(e,i){return new t(e.parentNode,sa(e)+1,i)}},Lt=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Lt||(Lt={})),zt=Lt.LTR,Xt=Lt.RTL,Vt=va("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Ft=va("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),_t=Object.create(null),Ht=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);_t[e]=i,_t[i]=-e}Yt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,qt=class{get dir(){return this.level%2?Xt:zt}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,n){let s=-1;for(let r=0;r<t.length;r++){let o=t[r];if(o.from<=e&&o.to>=e){if(o.level==i)return r;(s<0||(0!=n?n<0?o.from<e:o.to>e:t[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}},Gt=[],Ut="",Kt=S.define(),Zt=S.define(),Jt=S.define(),te=S.define(),ee=S.define(),ie=S.define(),ne=S.define(),se=S.define(),re=S.define(),oe=S.define({combine:t=>t.some(t=>t)}),le=S.define({combine:t=>t.some(t=>t)}),ae=S.define(),he=class t{constructor(t,e="nearest",i="nearest",n=5,s=5,r=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=s,this.isSnapshot=r}map(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new t(k.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},ce=F.define({map:(t,e)=>t.map(e)}),ue=F.define(),de=S.define({combine:t=>!t.length||t[0]}),fe=0,pe=S.define({combine:t=>t.filter((e,i)=>{for(let n=0;n<i;n++)if(t[n].plugin==e.plugin)return!1;return!0})}),ge=class t{constructor(t,e,i,n,s){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(pe.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(pe.of({plugin:this,arg:t}))}static define(e,i){const{eventHandlers:n,eventObservers:s,provide:r,decorations:o}=i||{};return new t(fe++,e,n,s,t=>{let e=[];return o&&e.push(we.of(e=>{let i=e.plugin(t);return i?o(i):Rt.none})),r&&e.push(r(t)),e})}static fromClass(e,i){return t.define((t,i)=>new e(t,i),i)}},me=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(Ca(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(It){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){Ca(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(i){Ca(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},Oe=S.define(),ve=S.define(),we=S.define(),ye=S.define(),be=S.define(),ke=S.define(),xe=S.define(),Se=S.define(),Ae=S.define(),Ce=class t{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(e,i){if(0==i.length)return e;let n=[];for(let s=0,r=0,o=0;;){let l=s<e.length?e[s].fromB:1e9,a=r<i.length?i[r]:1e9,h=Math.min(l,a);if(1e9==h)break;let c=h+o,u=h,d=c;for(;;)if(r<i.length&&i[r]<=u){let t=i[r+1];r+=2,u=Math.max(u,t);for(let i=s;i<e.length&&e[i].fromB<=u;i++)o=e[i].toA-e[i].toB;d=Math.max(d,t+o)}else{if(!(s<e.length&&e[s].fromB<=u))break;{let t=e[s++];u=Math.max(u,t.toB),d=Math.max(d,t.toA),o=t.toA-t.toB}}n.push(new t(c,d,h,u))}return n}},Me=class t{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=w.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((t,e,i,s)=>n.push(new Ce(t,e,i,s))),this.changedRanges=n}static create(e,i,n){return new t(e,i,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}},Pe=[],Te=class{constructor(t,e,i=0){this.dom=t,this.length=e,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return Pe}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,4&this.flags){this.flags&=-5;let t=this.domAttrs;t&&function(t,e){for(let i=t.attributes.length-1;i>=0;i--){let n=t.attributes[i].name;null==e[n]&&t.removeAttribute(n)}for(let i in e){let n=e[i];"style"==i?t.style.cssText=n:t.getAttribute(i)!=n&&t.setAttribute(i,n)}}(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let i=e;for(let n of this.children){if(n==t)return i;i+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let i=sa(this.dom),n=this.length?t>0:e>0;return new Wt(this.parent.dom,i+(n?1:0),0==t||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof Re)return t;return null}static get(t){return t.cmTile}},Qe=class extends Te{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(2&this.flags)return;super.sync(t);let e,i=this.dom,n=null,s=(null==t?void 0:t.node)==i?t:null,r=0;for(let o of this.children){if(o.sync(t),r+=o.length+o.breakAfter,e=n?n.nextSibling:i.firstChild,s&&e!=o.dom&&(s.written=!0),o.dom.parentNode==i)for(;e&&e!=o.dom;)e=Ta(e);else i.insertBefore(o.dom,e);n=o.dom}for(e=n?n.nextSibling:i.firstChild,s&&e&&(s.written=!0);e;)e=Ta(e);this.length=r}},Re=class extends Qe{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=Te.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],i=this,n=0,s=0;;)if(n==i.children.length){if(!e.length)return;i=i.parent,i.breakAfter&&s++,n=e.pop()}else{let r=i.children[n++];if(r instanceof De)e.push(n),i=r,n=0;else{let e=s+r.length,i=t(r,s);if(void 0!==i)return i;s=e+r.breakAfter}}}resolveBlock(t,e){let i,n,s=-1,r=-1;if(this.blockTiles((o,l)=>{let a=l+o.length;if(t>=l&&t<=a){if(o.isWidget()&&e>=-1&&e<=1){if(32&o.flags)return!0;16&o.flags&&(i=void 0)}(l<t||t==a&&(e<-1?o.length:o.covers(1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,s=t-l),(a>t||t==l&&(e>1?o.length:o.covers(-1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=t-l)}}),!i&&!n)throw new Error("No tile at position "+t);return i&&e<0||!n?{tile:i,offset:s}:{tile:n,offset:r}}},De=class t extends Qe{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return!!this.children.length&&(t<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,i){let n=new t(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}},$e=class t extends Qe{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(e,i,n){let s=new t(i||document.createElement("div"),e);return i&&n||(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(l,a){for(let h=0,c=0;h<l.children.length&&c<=a;h++){let u=l.children[h],d=c+u.length;d>=a&&(u.isComposite()?t(u,a-c):(!r||r.isHidden&&(e>0||i&&Qa(r,u)))&&(d>a||32&u.flags)?(r=u,o=a-c):(c<a||16&u.flags&&!u.isHidden)&&(n=u,s=a-c)),c=d}}(this,t);let l=(e<0?n:r)||n||r;return l?{tile:l,offset:l==n?s:o}:null}coordsIn(t,e){let i=this.resolveInline(t,e,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),e):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=ia(e);return i[i.length-1]||null}(this)}domIn(t,e){let i=this.resolveInline(t,e);if(i){let{tile:t,offset:n}=i;if(this.dom.contains(t.dom))return t.isText()?new Wt(t.dom,Math.min(t.dom.nodeValue.length,n)):t.domPosFor(n,16&t.flags?1:32&t.flags?-1:e);let s=i.tile.parent,r=!1;for(let e of s.children){if(r)return new Wt(e.dom,0);e==i.tile&&(r=!0)}}return new Wt(this.dom,0)}},Ee=class t extends Qe{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(e,i){let n=new t(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}},Be=class t extends Te{constructor(t,e){super(t,e.length),this.text=e}sync(t){2&this.flags||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e){let i=this.dom.nodeValue.length;t>i&&(t=i);let n=t,s=t,r=0;0==t&&e<0||t==i&&e>=0?Mt.chrome||Mt.gecko||(t?(n--,r=1):s<i&&(s++,r=-1)):e<0?n--:s<i&&s++;let o=fa(this.dom,n,s).getClientRects();if(!o.length)return null;let l=o[(r?r<0:e>=0)?0:o.length-1];return Mt.safari&&!r&&0==l.width&&(l=Array.prototype.find.call(o,t=>t.width)||l),r?aa(l,r<0):l||null}static of(e,i){let n=new t(i||document.createTextNode(e),e);return i||(n.flags|=2),n}},je=class t extends Te{constructor(t,e,i,n){super(t,e,n),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return!(48&this.flags)&&(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,i){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;if(i)return aa(this.dom.getBoundingClientRect(),this.length?0==t:e<=0);{let e=this.dom.getClientRects(),i=null;if(!e.length)return null;let n=!!(16&this.flags)||!(32&this.flags)&&t>0;for(let s=n?e.length-1:0;i=e[s],!(t>0?0==s:s==e.length-1||i.top<i.bottom);s+=n?-1:1);return aa(i,!n)}}get overrideDOMText(){if(!this.length)return h.empty;let{root:t}=this;if(!t)return h.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,i,n,s,r){return r||(r=e.toDOM(i),e.editable||(r.contentEditable="false")),new t(r,n,e,s)}},Ne=class extends Te{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return h.empty}coordsIn(t){return this.dom.getBoundingClientRect()}},Ie=class{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,i){let{tile:n,index:s,beforeBreak:r,parents:o}=this;for(;t||e>0;)if(n.isComposite())if(r){if(!t)break;i&&i.break(),t--,r=!1}else if(s==n.children.length){if(!t&&!o.length)break;i&&i.leave(n),r=!!n.breakAfter,({tile:n,index:s}=o.pop()),s++}else{let l=n.children[s],a=l.breakAfter;!(e>0?l.length<=t:l.length<t)||i&&!1===i.skip(l,0,l.length)&&l.isComposite?(o.push({tile:n,index:s}),n=l,s=0,i&&l.isComposite()&&i.enter(l)):(r=!!a,s++,t-=l.length)}else if(s==n.length)r=!!n.breakAfter,({tile:n,index:s}=o.pop()),s++;else{if(!t)break;{let e=Math.min(t,n.length-s);i&&i.skip(n,s,s+e),t-=e,s+=e}}return this.tile=n,this.index=s,this.beforeBreak=r,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},We=class{constructor(t,e,i,n){this.from=t,this.to=e,this.wrapper=i,this.rank=n}},Le=class{constructor(t,e,i){this.cache=t,this.root=e,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,i,n){var s;this.flushBuffer();let r=this.ensureMarks(e,i),o=r.lastChild;o&&o.isText()&&!(8&o.flags)&&o.length+t.length<512?(this.cache.reused.set(o,2),(r.children[r.children.length-1]=new Be(o.dom,o.text+t)).parent=r):r.append(n||Be.of(t,null===(s=this.cache.find(Be))||void 0===s?void 0:s.dom)),this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let i=this.curLine;i.dom!=e.line.dom&&(i.setDOM(this.cache.reused.has(e.line)?Da(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let n=i;for(let o=e.marks.length-1;o>=0;o--){let t=e.marks[o],i=n.lastChild;if(i instanceof Ee&&i.mark.eq(t.mark))i.dom!=t.dom&&i.setDOM(Da(t.dom)),n=i;else{if(this.cache.reused.get(t)){let e=Te.get(t.dom);e&&e.setDOM(Da(t.dom))}let e=Ee.of(t.mark,t.dom);n.append(e),n=e}this.cache.reused.set(t,2)}let s=Te.get(t.text);s&&this.cache.reused.set(s,2);let r=new Be(t.text,t.text.nodeValue);r.flags|=8,n.append(r)}addInlineWidget(t,e,i){let n=this.afterWidget&&48&t.flags&&(48&this.afterWidget.flags)==(48&t.flags);n||this.flushBuffer();let s=this.ensureMarks(e,i);n||16&t.flags||s.append(this.getBuffer(1)),s.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,i){this.flushBuffer(),this.ensureMarks(e,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){(this.afterWidget||this.lastBlock).length+=t,this.pos+=t}addLineStart(t,e){var i;t||(t=_e);let n=$e.start(t,e||(null===(i=this.cache.find($e))||void 0===i?void 0:i.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var i;let n=this.curLine;for(let s=t.length-1;s>=0;s--){let r,o=t[s];if(e>0&&(r=n.lastChild)&&r instanceof Ee&&r.mark.eq(o))n=r,e--;else{let t=Ee.of(o,null===(i=this.cache.find(Ee,t=>t.mark.eq(o)))||void 0===i?void 0:i.dom);n.append(t),n=t,e=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;t&&Ra(this.curLine,!1)&&("BR"==t.dom.nodeName||!t.isWidget()||Mt.ios&&Ra(this.curLine,!0))||this.curLine.append(this.cache.findWidget(Ye,0,32)||new je(Ye.toDOM(),0,Ye,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=new We(t.from,t.to,t.value,t.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-e.rank||this.wrappers[i-1].to-e.to)<0;)i--;this.wrappers.splice(i,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let i of this.wrappers){let n=e.lastChild;if(i.from<this.pos&&n instanceof De&&n.wrapper.eq(i.wrapper))e=n;else{let n=De.of(i.wrapper,null===(t=this.cache.find(De,t=>t.wrapper.eq(i.wrapper)))||void 0===t?void 0:t.dom);e.append(n),e=n}}return e}blockPosCovered(){let t=this.lastBlock;return null!=t&&!t.breakAfter&&(!t.isWidget()||(160&t.flags)>0)}getBuffer(t){let e=2|(t<0?16:32),i=this.cache.find(Ne,void 0,1);return i&&(i.flags=e),i||new Ne(e)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},ze=class{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skipCount);if(this.skipCount=0,n)throw new Error("Ran out of text content when drawing inline views");this.text=e;let s=this.textOff=Math.min(t,e.length);return i?null:e.slice(0,s)}let e=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,e);return this.textOff=e,i}},Xe=[je,$e,Be,Ee,Ne,De,Re];for(let t=0;t<Xe.length;t++)Xe[t].bucket=t;Ve=class{constructor(t){this.view=t,this.buckets=Xe.map(()=>[]),this.index=Xe.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,i=this.buckets[e];i.length<6?i.push(t):i[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,i=2){let n=t.bucket,s=this.buckets[n],r=this.index[n];for(let o=s.length-1;o>=0;o--){let t=(o+r)%s.length,l=s[t];if((!e||e(l))&&!this.reused.has(l))return s.splice(t,1),t<r&&this.index[n]--,this.reused.set(l,i),l}return null}findWidget(t,e,i){let n=this.buckets[0];if(n.length)for(let s=0,r=0;;s++){if(s==n.length){if(r)return null;r=1,s=0}let o=n[s];if(!this.reused.has(o)&&(0==r?o.widget.compare(t):o.widget.constructor==t.constructor&&t.updateDOM(o.dom,this.view,o.widget)))return n.splice(s,1),s<this.index[0]&&this.index[0]--,o.widget==t&&o.length==e&&(497&o.flags)==i?(this.reused.set(o,1),o):(this.reused.set(o,2),new je(o.dom,e,t,-498&o.flags|i))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}},Fe=class{constructor(t,e,i,n,s){this.view=t,this.decorations=n,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new Ve(t),this.text=new ze(t.state.doc),this.builder=new Le(this.cache,new Re(t,t.contentDOM),tt.iter(i)),this.cache.reused.set(e,2),this.old=new Ie(e),this.reuseWalker={skip:(t,e,i)=>{if(this.cache.add(t),t.isComposite())return!1},enter:t=>this.cache.add(t),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let n=0,s=0,r=0;;){let o=r<t.length?t[r++]:null,l=o?o.fromA:this.old.root.length;if(l>n){let t=l-n;this.preserve(t,!r,!o),n=l,s+=t}if(!o)break;e&&o.fromA<=e.range.fromA&&o.toA>=e.range.toA?(this.forward(o.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(s,e.range.fromB),this.cache.clear(),this.builder.addComposition(e,i),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,o.toA),this.emit(e.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(s,o.toB)),s=o.toB,n=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,i){let n=function(t){let e=[];for(let i=t.parents.length;i>1;i--){let n=i==t.parents.length?t.tile:t.parents[i].tile;n instanceof Ee&&e.push(n.mark)}return e}(this.old),s=this.openMarks;this.old.advance(t,i?1:-1,{skip:(t,e,i)=>{if(t.isWidget())if(this.openWidget)this.builder.continueWidget(i-e);else{let r=i>0||e<t.length?je.of(t.widget,this.view,i-e,496&t.flags,this.cache.maybeReuse(t)):this.cache.reuse(t);256&r.flags?(r.flags&=-2,this.builder.addBlockWidget(r)):(this.builder.ensureLine(null),this.builder.addInlineWidget(r,n,s),s=n.length)}else if(t.isText())this.builder.ensureLine(null),e||i!=t.length||this.cache.reused.has(t)?(this.cache.add(t),this.builder.addText(t.text.slice(e,i),n,s)):this.builder.addText(t.text,n,s,this.cache.reuse(t)),s=n.length;else if(t.isLine())t.flags&=-2,this.cache.reused.set(t,1),this.builder.addLine(t);else if(t instanceof Ne)this.cache.add(t);else{if(!(t instanceof Ee))return!1;this.builder.ensureLine(null),this.builder.addMark(t,n,s),this.cache.reused.set(t,1),s=n.length}this.openWidget=!1},enter:t=>{t.isLine()?this.builder.addLineStart(t.attrs,this.cache.maybeReuse(t)):(this.cache.add(t),t instanceof Ee&&n.unshift(t.mark)),this.openWidget=!1},leave:t=>{t.isLine()?n.length&&(n.length=s=0):t instanceof Ee&&(n.shift(),s=Math.min(s,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let i=null,n=this.builder,s=0,r=tt.spans(this.decorations,t,e,{point:(t,e,r,o,l,a)=>{if(r instanceof Et){if(this.disallowBlockEffectsFor[a]){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.view.state.doc.lineAt(t).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=o.length,l>o.length)n.continueWidget(e-t);else{let s=r.widget||(r.block?He.block:He.inline),a=function(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}(r),h=this.cache.findWidget(s,e-t,a)||je.of(s,this.view,e-t,a);r.block?(r.startSide>0&&n.addLineStartIfNotCovered(i),n.addBlockWidget(h)):(n.ensureLine(i),n.addInlineWidget(h,o,l))}i=null}else i=function(t,e){let i=e.spec.attributes,n=e.spec.class;return i||n?(t||(t={class:"cm-line"}),i&&Yl(i,t),n&&(t.class+=" "+n),t):t}(i,r);e>t&&this.text.skip(e-t)},span:(t,e,s,r)=>{for(let o=t;o<e;){let l=this.text.next(Math.min(512,e-o));null==l?(n.addLineStartIfNotCovered(i),n.addBreak(),o++):(n.ensureLine(i),n.addText(l,s,o==t?r:s.length),o+=l.length),i=null}}});n.addLineStartIfNotCovered(i),this.openWidget=r>s,this.openMarks=r}forward(t,e,i=1){e-t<=10?this.old.advance(e-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let e=[],i=null;for(let n=t.parentNode;;n=n.parentNode){let t=Te.get(n);if(n==this.view.contentDOM)break;t instanceof Ee?e.push(t):(null==t?void 0:t.isLine())?i=t:t instanceof De||("DIV"!=n.nodeName||i||n==this.view.contentDOM?i||e.push(Ee.of(new Dt({tagName:n.nodeName.toLowerCase(),attributes:Ul(n)}),n)):i=new $e(n,_e))}return{line:i,marks:e}}},_e={class:"cm-line"},(He=class extends Tt{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}).inline=new He("span"),He.block=new He("div"),Ye=new class extends Tt{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},qe=class{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Rt.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Re(t,t.contentDOM),this.updateInner([new Ce(0,0,0,t.state.doc.length)],null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:t,toA:e})=>e<this.minWidthFrom||t>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges((t,n)=>{t<e.to&&n>e.from&&(i=!0)}),i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let s=n>-1?function(t,e,i){let n=Ea(t,i);if(!n)return null;let{node:s,from:r,to:o}=n,l=s.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc;return{range:new Ce(a.mapPos(r),a.mapPos(o),r,o),text:s}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:e,to:n}=this.hasComposition;i=new Ce(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Mt.ie||Mt.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let r=this.decorations,o=this.blockWrappers;this.updateDeco();let l=function(t,e,i){let n=new Ge;return tt.compare(t,e,i,n),n.changes}(r,this.decorations,t.changes);l.length&&(i=Ce.extendWithRanges(i,l));let a=function(t,e,i){let n=new Ue;return tt.compare(t,e,i,n),n.changes}(o,this.blockWrappers,t.changes);return a.length&&(i=Ce.extendWithRanges(i,a)),s&&!i.some(t=>t.fromA<=s.range.fromA&&t.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),!(2&this.tile.flags&&0==i.length||(this.updateInner(i,s),t.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(e||t.length){let i=this.tile,n=new Fe(this.view,i,this.blockWrappers,this.decorations,this.dynamicDecorationMap);e&&Te.get(e.text)&&n.cache.reused.set(Te.get(e.text),2),this.tile=n.run(t,e),$a(i,n.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=Mt.chrome||Mt.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),!n||!n.written&&i.selectionRange.focusNode==n.node&&this.tile.dom.contains(n.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Ke&&n.push(s.dom);i.updateGaps(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let t of e.effects)t.is(ue)&&(this.editContextFormatting=t.value)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:i}=this.tile,n=this.view.root.activeElement,s=n==i,r=!s&&!(this.view.state.facet(de)||i.tabIndex>-1)&&ea(i,this.view.observer.selectionRange)&&!(n&&i.contains(n));if(!(s||e||r))return;let o=this.forceSelection;this.forceSelection=!1;let l,a,h=this.view.state.selection.main;if(h.empty?a=l=this.inlineDOMNearPos(h.anchor,h.assoc||1):(a=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),l=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),Mt.gecko&&h.empty&&!this.hasComposition&&1==(c=l).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null)),l=a=new Wt(t,0),o=!0}var c;let u=this.view.observer.selectionRange;!o&&u.focusNode&&(na(l.node,l.offset,u.anchorNode,u.anchorOffset)&&na(a.node,a.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,h))||(this.view.observer.ignore(()=>{Mt.android&&Mt.chrome&&i.contains(u.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(u.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let t=Jl(this.view.root);if(t)if(h.empty){if(Mt.gecko){let t=(e=l.node,s=l.offset,1!=e.nodeType?0:(s&&"false"==e.childNodes[s-1].contentEditable?1:0)|(s<e.childNodes.length&&"false"==e.childNodes[s].contentEditable?2:0));if(t&&3!=t){let e=(1==t?ma:Oa)(l.node,l.offset);e&&(l=new Wt(e.node,e.offset))}}t.collapse(l.node,l.offset),null!=h.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=h.bidiLevel)}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(a.node,a.offset)}catch(It){}}else{let e=document.createRange();h.anchor>h.head&&([l,a]=[a,l]),e.setEnd(a.node,a.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}var e,s;r&&this.view.root.activeElement==i&&(i.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new Wt(u.anchorNode,u.anchorOffset),this.impreciseHead=a.precise?null:new Wt(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&na(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Jl(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=this.lineAt(e.head,e.assoc);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc,e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,s)}posFromDOM(t,e){let i=this.tile.nearest(t);if(!i)return 2&this.tile.dom.compareDocumentPosition(t)?0:this.view.state.doc.length;let n=i.posAtStart;if(!i.isComposite())return i.isText()?t==i.dom?n+e:n+(e?i.length:0):n;{let s;if(t==i.dom)s=i.dom.childNodes[e];else{let n=0==la(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==i.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}s=n<0?t:t.nextSibling}if(s==i.dom.firstChild)return n;for(;s&&!Te.get(s);)s=s.nextSibling;if(!s)return n+i.length;for(let t=0,e=n;;t++){let n=i.children[t];if(n.dom==s)return e;e+=n.length+n.breakAfter}}}domAtPos(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.domPosFor(t,e):i.domIn(n,e)}inlineDOMNearPos(t,e){let i,n,s=-1,r=!1,o=-1,l=!1;return this.tile.blockTiles((e,a)=>{if(e.isWidget()){if(32&e.flags&&a>=t)return!0;16&e.flags&&(r=!0)}else{let h=a+e.length;if(a<=t&&(i=e,s=t-a,r=h<t),h>=t&&!n&&(n=e,o=t-a,l=a>t),a>t&&n)return!0}}),i||n?(r&&n?i=null:l&&i&&(n=null),i&&e<0||!n?i.domIn(s,e):n.domIn(o,e)):this.domAtPos(t,e)}coordsAt(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.widget instanceof Ke?null:i.coordsInWidget(n,e,!0):i.coordsIn(n,e)}lineAt(t,e){let{tile:i}=this.tile.resolveBlock(t,e);return i.isLine()?i:null}coordsForChar(t){let{tile:e,offset:i}=this.tile.resolveBlock(t,1);return e.isLine()?function t(e,i){if(e.isComposite())for(let n of e.children){if(n.length>=i){let e=t(n,i);if(e)return e}if((i-=n.length)<0)break}else if(e.isText()&&i<e.length){let t=Ol(e.text,i);if(t==i)return null;let n=fa(e.dom,i,t).getClientRects();for(let e=0;e<n.length;e++){let t=n[e];if(e==n.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(e,i):null}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,s=this.view.contentDOM.clientWidth,r=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Lt.LTR,a=0,h=(t,c,u)=>{for(let d=0;d<t.children.length&&!(c>n);d++){let n=t.children[d],f=c+n.length,p=n.dom.getBoundingClientRect(),{height:g}=p;if(u&&!d&&(a+=p.top-u.top),n instanceof De)f>i&&h(n,c,p);else if(c>=i&&(a>0&&e.push(-a),e.push(g+a),a=0,r)){let t=n.dom.lastChild,e=t?ia(t):[];if(e.length){let t=e[e.length-1],i=l?t.right-p.left:p.right-t.left;i>o&&(o=i,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}u&&d==t.children.length-1&&(a+=u.bottom-p.bottom),c=f+n.breakAfter}};return h(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return"rtl"==getComputedStyle(e.dom).direction?Lt.RTL:Lt.LTR}measureTextSize(){let t=this.tile.blockTiles(t=>{if(t.isLine()&&t.children.length&&t.length<=20){let e,i=0;for(let n of t.children){if(!n.isText()||/[^ -~]/.test(n.text))return;let t=ia(n.dom);if(1!=t.length)return;i+=t[0].width,e=t[0].height}if(i)return{lineHeight:t.dom.getBoundingClientRect().height,charWidth:i/t.length,textHeight:e}}});if(t)return t;let e,i,n,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.style.position="absolute",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(s);let t=ia(s.firstChild)[0];e=s.getBoundingClientRect().height,i=t&&t.width?t.width/27:7,n=t&&t.height?t.height:e,s.remove()}),{lineHeight:e,charWidth:i,textHeight:n}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],r=s?s.from-1:this.view.state.doc.length;if(r>i){let n=(e.lineBlockAt(r).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(Rt.replace({widget:new Ke(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return Rt.set(t)}updateDeco(){let t=1,e=this.view.state.facet(we).map(e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e),i=!1,n=this.view.state.facet(be).map((t,e)=>{let n="function"==typeof t;return n&&(i=!0),n?t(this.view):t});for(n.length&&(this.dynamicDecorationMap[t++]=i,e.push(tt.join(n))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(ye).map(t=>"function"==typeof t?t(this.view):t)}scrollIntoView(t){var e;if(t.isSnapshot){let e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}for(let c of this.view.state.facet(ae))try{if(c(this.view,t.range,t))return!0}catch(h){Ca(this.view.state,h,"scroll handler")}let i,{range:n}=t,s=this.coordsAt(n.head,null!==(e=n.assoc)&&void 0!==e?e:n.empty?0:n.head>n.anchor?-1:1);if(!s)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(s={left:Math.min(s.left,i.left),top:Math.min(s.top,i.top),right:Math.max(s.right,i.right),bottom:Math.max(s.bottom,i.bottom)});let r=Pa(this.view),o={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(function(t,e,i,n,s,r,o,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,d=c==a.body,f=1,p=1;if(d)t=ha(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:f,scaleY:p}=ca(c,e)),t={left:e.left,right:e.left+c.clientWidth*f,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==s)e.top<t.top?(m=e.top-(t.top+o),i>0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,i<0&&e.top-m<t.top&&(m=e.top-(t.top+o)));else{let n=e.bottom-e.top,r=t.bottom-t.top;m=("center"==s&&n<=r?e.top+n/2-r/2:"start"==s||"center"==s&&i<0?e.top-o:e.bottom-r+o)-t.top}if("nearest"==n?e.left<t.left?(g=e.left-(t.left+r),i>0&&e.right>t.right+g&&(g=e.right-t.right+r)):e.right>t.right&&(g=e.right-t.right+r,i<0&&e.left<t.left+g&&(g=e.left-(t.left+r))):g=("center"==n?e.left+(e.right-e.left)/2-(t.right-t.left)/2:"start"==n==l?e.left-r:e.right-(t.right-t.left)+r)-t.left,g||m)if(d)h.scrollBy(g,m);else{let t=0,i=0;if(m){let t=c.scrollTop;c.scrollTop+=m/p,i=(c.scrollTop-t)*p}if(g){let e=c.scrollLeft;c.scrollLeft+=g/f,t=(c.scrollLeft-e)*f}e={left:e.left-t,top:e.top-i,right:e.right-t,bottom:e.bottom-i},t&&Math.abs(t-g)<1&&(n="nearest"),i&&Math.abs(i-m)<1&&(s="nearest")}if(d)break;(e.top<t.top||e.bottom>t.bottom||e.left<t.left||e.right>t.right)&&(e={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)}),c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,a),-a),this.view.textDirection==Lt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let t=this.view.docView.lineAt(n.head,1);t&&t.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let e=t=>t.isWidget()||t.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){$a(this.tile)}},Ge=class{constructor(){this.changes=[]}compareRange(t,e){Zl(t,e,this.changes)}comparePoint(t,e){Zl(t,e,this.changes)}boundChange(t){Zl(t,t,this.changes)}},Ue=class{constructor(){this.changes=[]}compareRange(t,e){Zl(t,e,this.changes)}comparePoint(){}boundChange(t){Zl(t,t,this.changes)}},Ke=class extends Tt{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},Ze=class{constructor(t,e){this.pos=t,this.assoc=e}},Je=class{constructor(t,e,i,n){this.view=t,this.x=e,this.y=i,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,e){let{line:i,spans:n}=this.bidiSpansAt(t);return n[qt.find(n,t-i.from,-1,e)].level==this.baseDir}dirAt(t,e){let{line:i,spans:n}=this.bidiSpansAt(t);return n[qt.find(n,t-i.from,-1,e)].dir}bidiIn(t,e){let{spans:i,line:n}=this.bidiSpansAt(t);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<e)}scan(t,e){let i,n,s,r=0,o=t.length-1,l=new Set,a=this.bidiIn(t[0],t[o]),h=-1,c=1e9;t:for(;r<o;){let u=o-r,d=r+o>>1;e:if(l.has(d)){let t=r+Math.floor(Math.random()*u);for(let e=0;e<u;e++){if(!l.has(t)){d=t;break e}t++,t==o&&(t=r)}break t}l.add(d);let f=e(d);if(f)for(let e=0;e<f.length;e++){let l=f[e],u=0;if(!(0==l.width&&f.length>1)){if(l.bottom<this.y)(!i||i.bottom<l.bottom)&&(i=l),u=1;else if(l.top>this.y)(!n||n.top>l.top)&&(n=l),u=-1;else{let t=l.left>this.x?this.x-l.left:l.right<this.x?this.x-l.right:0,e=Math.abs(t);e<c&&(h=d,c=e,s=l),t&&(u=t<0==(this.baseDir==Lt.LTR)?-1:1)}-1!=u||a&&!this.baseDirAt(t[d],1)?1!=u||a&&!this.baseDirAt(t[d+1],-1)||(r=d+1):o=d}}}if(!s){let s=i&&(!n||this.y-i.bottom<n.top-this.y)?i:n;return this.y=(s.top+s.bottom)/2,this.scan(t,e)}let u=(a?this.dirAt(t[h],1):this.baseDir)==Lt.LTR;return{i:h,after:this.x>(s.left+s.right)/2==u}}scanText(t,e){let i=[];for(let s=0;s<t.length;s=Ol(t.text,s))i.push(e+s);i.push(e+t.length);let n=this.scan(i,n=>{let s=i[n]-e,r=i[n+1]-e;return fa(t.dom,s,r).getClientRects()});return n.after?new Ze(i[n.i+1],-1):new Ze(i[n.i],1)}scanTile(t,e){if(!t.length)return new Ze(e,1);if(1==t.children.length){let i=t.children[0];if(i.isText())return this.scanText(i,e);if(i.isComposite())return this.scanTile(i,e)}let i=[e];for(let o=0,l=e;o<t.children.length;o++)i.push(l+=t.children[o].length);let n=this.scan(i,e=>{let i=t.children[e];return 48&i.flags?null:(1==i.dom.nodeType?i.dom:fa(i.dom,0,i.length)).getClientRects()}),s=t.children[n.i],r=i[n.i];return s.isText()?this.scanText(s,r):s.isComposite()?this.scanTile(s,r):n.after?new Ze(i[n.i+1],-1):new Ze(r,1)}},ti="￿",ei=class{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineSeparator=e.state.facet(U.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=ti}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let s=Te.get(n),r=n.nextSibling;if(r==e){(null==s?void 0:s.breakAfter)&&!r&&i!=this.view.contentDOM&&this.lineBreak();break}let o=Te.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:ra(n))||ra(r)&&("BR"!=n.nodeName||(null==s?void 0:s.isWidget()))&&this.text.length>t)&&!Va(r,e)&&this.lineBreak(),n=r}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s,r=-1,o=1;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(s=n.exec(e))&&(r=s.index,o=s[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=r+o}}readNode(t){let e=Te.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Xa(t,i.node,i.offset)?e:0))}},ii=class{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}},ni=class{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:s,impreciseAnchor:r}=t.docView,o=t.state.selection;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=Fa(t.docView.tile,e,i,0))){let e=s||r?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}=t.observer.selectionRange;return i&&(e.push(new ii(i,n)),s==i&&r==n||e.push(new ii(s,r))),e}(t),i=new ei(e,t);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?k.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=s&&s.node==e.focusNode&&s.offset==e.focusOffset||!ta(t.contentDOM,e.focusNode)?o.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!ta(t.contentDOM,e.anchorNode)?o.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),l=t.viewport;if((Mt.ios||Mt.chrome)&&o.main.empty&&i!=n&&(l.from>0||l.to<t.state.doc.length)){let e=Math.min(i,n),s=Math.max(i,n),r=l.from-e,o=l.to-s;0!=r&&1!=r&&0!=e||0!=o&&-1!=o&&s!=t.state.doc.length||(i=0,n=t.state.doc.length)}if(t.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(k.range(n,i));else if(t.lineWrapping&&n==i&&(!o.main.empty||o.main.head!=i)&&t.inputState.lastTouchTime>Date.now()-100){let e=t.coordsAtPos(i,-1),n=0;e&&(n=t.inputState.lastTouchY<=e.bottom?-1:1),this.newSel=k.create([k.cursor(i,n)])}else this.newSel=k.single(n,i)}}},si=class{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Mt.safari&&t.contentDOM.addEventListener("input",()=>null),Mt.gecko&&function(t){vi.has(t)||(vi.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=Te.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t)))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Ua(t),i=this.handlers,n=this.view.contentDOM;for(let s in e)if("scroll"!=s){let t=!e[s].handlers.length,r=i[s];r&&t!=!r.handlers.length&&(n.removeEventListener(s,this.handleEvent),r=null),r||n.addEventListener(s,this.handleEvent,{passive:t})}for(let s in i)"scroll"==s||e[s]||n.removeEventListener(s,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&li.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Mt.android&&Mt.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!Mt.ios||t.synthetic||t.altKey||t.metaKey||t.shiftKey||!((e=ri.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||oi.indexOf(t.key)>-1&&t.ctrlKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,pa(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!(!/^key/.test(t.type)||t.synthetic)&&(this.composing>0||!!(Mt.safari&&!Mt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}},ri=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],oi="dthko",li=[16,17,18,20,91,92,224,225],ai=class{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=ua(t.contentDOM),this.atoms=t.state.facet(ke).map(e=>e(t));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(U.allowMultipleSelections)&&function(t,e){let i=t.state.facet(Kt);return i.length?i[0](e):Mt.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=Jl(t.root);if(!n||0==n.rangeCount)return!0;let s=n.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let t=s[r];if(t.left<=e.clientX&&t.right>=e.clientX&&t.top<=e.clientY&&t.bottom>=e.clientY)return!0}return!1}(t,e)||1!=eh(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(e=this.startEvent,i=t,Math.max(Math.abs(e.clientX-i.clientX),Math.abs(e.clientY-i.clientY))<10))return;var e,i;this.select(this.lastEvent=t);let n=0,s=0,r=0,o=0,l=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let h=Pa(this.view);t.clientX-h.left<=r+6?n=-Ka(r-t.clientX):t.clientX+h.right>=l-6&&(n=Ka(t.clientX-l)),t.clientY-h.top<=o+6?s=-Ka(o-t.clientY):t.clientY+h.bottom>=a-6&&(s=Ka(t.clientY-a)),this.setScrollSpeed(n,s)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),!1===this.dragging&&this.select(this.lastEvent)}select(t){let{view:e}=this,i=Wa(this.atoms,this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}},hi=Object.create(null),ci=Object.create(null),ui=Mt.ie&&Mt.ie_version<15||Mt.ios&&Mt.webkit_version<604,ci.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},ci.wheel=ci.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()},hi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),ci.touchstart=(t,e)=>{let i=t.inputState,n=e.targetTouches[0];i.lastTouchTime=Date.now(),n&&(i.lastTouchX=n.clientX,i.lastTouchY=n.clientY),i.setSelectionOrigin("select.pointer")},ci.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},hi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(Jt))if(i=n(t,e),i)break;if(i||0!=e.button||(i=ih(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new ai(t,e,i,n)),n&&t.observer.ignore(()=>{da(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),!1===s.dragging}else t.inputState.setSelectionOrigin("select.pointer");return!1},di=Mt.ie&&Mt.ie_version<=11,fi=null,pi=0,gi=0,hi.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let n=t.docView.tile.nearest(e.target);if(n&&n.isWidget()){let t=n.posAtStart,e=t+n.length;(t>=i.to||e<=i.from)&&(i=k.range(t,e))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Za(t.state,re,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1},hi.dragend=t=>(t.inputState.draggedContent=null,!1),hi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),s=0,r=()=>{++s==i.length&&nh(t,e,n.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let t=0;t<i.length;t++){let e=new FileReader;e.onerror=r,e.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),r()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return nh(t,e,i,!0),!0}return!1},hi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=ui?null:e.clipboardData;return i?(Ja(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),Ja(t,i.value)},50)}(t),!1)},mi=null,hi.copy=hi.cut=(t,e)=>{if(!ea(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:s}=function(t){let e=[],i=[],n=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),i.push(s));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let r=t.doc.lineAt(n);r.number>s&&(e.push(r.text),i.push({from:r.from,to:Math.min(t.doc.length,r.to+1)})),s=r.number}n=!0}return{text:Za(t,re,e.join(t.lineBreak)),ranges:i,linewise:n}}(t.state);if(!i&&!s)return!1;mi=s?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=ui?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}(t,i),!1)},Oi=z.define(),ci.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),rh(t)},ci.blur=t=>{t.observer.clearSelectionRange(),rh(t)},ci.compositionstart=ci.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},ci.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Mt.chrome&&Mt.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},ci.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},hi.beforeinput=(t,e)=>{var i,n;if("insertText"!=e.inputType&&"insertCompositionText"!=e.inputType||(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),"insertReplacementText"==e.inputType&&t.observer.editContext){let n=null===(i=e.dataTransfer)||void 0===i?void 0:i.getData("text/plain"),s=e.getTargetRanges();if(n&&s.length){let e=s[0];return Ha(t,{from:t.posAtDOM(e.startContainer,e.startOffset),to:t.posAtDOM(e.endContainer,e.endOffset),insert:t.state.toText(n)},null),!0}}let s;if(Mt.chrome&&Mt.android&&(s=ri.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let e=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout(()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Mt.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Mt.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(()=>ci.compositionend(t,e),20),!1},vi=new Set,wi=["pre-wrap","normal","pre-line","break-spaces"],yi=!1,bi=class{constructor(t){this.lineWrapping=t,this.doc=h.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return wi.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let n=t[i];n<0?i++:this.heightSamples[Math.floor(10*n)]||(e=!0,this.heightSamples[Math.floor(10*n)]=!0)}return e}refresh(t,e,i,n,s,r){let o=wi.indexOf(t)>-1,l=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=o||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=s,l){this.heightSamples={};for(let t=0;t<r.length;t++){let e=r[t];e<0?t++:this.heightSamples[Math.floor(10*e)]=!0}}return l}},ki=class{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}},xi=class t{constructor(t,e,i,n,s){this.from=t,this.length=e,this.top=i,this.height=n,this._content=s}get type(){return"number"==typeof this._content?Qt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Et?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new t(this.from,this.length+e.length,this.top,this.height+e.height,i)}},Si=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Si||(Si={})),Ai=.001,Ci=class t{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(2&this.flags)>0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Ai&&(yi=!0),this.height=t)}replace(e,i,n){return t.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let s=this,r=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:h,toB:c}=n[o],u=s.lineAt(l,Si.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=a?u:s.lineAt(a,Si.ByPosNoHeight,i,0,0);for(c+=d.to-a,a=d.to;o>0&&u.from<=n[o-1].toA;)l=n[o-1].fromA,h=n[o-1].fromB,o--,l<u.from&&(u=s.lineAt(l,Si.ByPosNoHeight,i,0,0));h+=u.from-l,l=u.from;let f=Di.build(i.setDoc(r),t,h,c);s=lh(s,s.replace(l,a,f))}return s.updateHeight(i,0)}static empty(){return new Ti(0,0,0)}static of(e){if(1==e.length)return e[0];let i=0,n=e.length,s=0,r=0;for(;;)if(i==n)if(s>2*r){let t=e[i-1];t.break?e.splice(--i,1,t.left,null,t.right):e.splice(--i,1,t.left,t.right),n+=1+t.break,s-=t.size}else{if(!(r>2*s))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(s<r){let t=e[i++];t&&(s+=t.size)}else{let t=e[--n];t&&(r+=t.size)}let o=0;return null==e[i-1]?(o=1,i--):null==e[i]&&(o=1,n++),new Ri(t.of(e.slice(0,i)),o,t.of(e.slice(n)))}},Ci.prototype.size=1,Mi=Rt.replace({}),Pi=class extends Ci{constructor(t,e,i){super(t,e),this.deco=i,this.spaceAbove=0}mainBlock(t,e){return new xi(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,e,i,n){return this.spaceAbove&&t<i+this.spaceAbove?new xi(n,0,i,this.spaceAbove,Mi):this.mainBlock(i,n)}lineAt(t,e,i,n,s){let r=this.mainBlock(n,s);return this.spaceAbove?this.blockAt(0,i,n,s).join(r):r}forEachLine(t,e,i,n,s,r){t<=s+this.length&&e>=s&&r(this.lineAt(0,Si.ByPos,i,n,s))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ti=class t extends Pi{constructor(t,e,i){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,e){return new xi(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,i,n){let s=n[0];return 1==n.length&&(s instanceof t||s instanceof Qi&&4&s.flags)&&Math.abs(this.length-s.length)<10?(s instanceof Qi?s=new t(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Ci.of(n)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setMeasuredHeight(n):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},Qi=class t extends Ci{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*r);i=e/r,this.length>r+1&&(o=(this.height-e)/(this.length-r-1))}else i=this.height/r;return{firstLine:n,lastLine:s,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:s,lastLine:r,perLine:o,perChar:l}=this.heightMetrics(e,n);if(e.lineWrapping){let s=n+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),r=e.doc.lineAt(s),a=o+r.length*l,h=Math.max(i,t-a/2);return new xi(r.from,r.length,h,a,0)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:l,length:a}=e.doc.line(s+n);return new xi(l,a,i+o*n,o,0)}}lineAt(t,e,i,n,s){if(e==Si.ByHeight)return this.blockAt(t,i,n,s);if(e==Si.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new xi(e,n-e,0,0,0)}let{firstLine:r,perLine:o,perChar:l}=this.heightMetrics(i,s),a=i.doc.lineAt(t),h=o+a.length*l,c=a.number-r,u=n+o*c+l*(a.from-s-c);return new xi(a.from,a.length,Math.max(n,Math.min(u,n+this.height-h)),h,0)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s);for(let h=t,c=n;h<=e;){let e=i.doc.lineAt(h);if(h==t){let i=e.number-o;c+=l*i+a*(t-s-i)}let n=l+a*e.length;r(new xi(e.from,e.length,c,n,0)),c+=n,h=e.to+1}}replace(e,i,n){let s=this.length-i;if(s>0){let e=n[n.length-1];e instanceof t?n[n.length-1]=new t(e.length+s):n.push(null,new t(s-1))}if(e>0){let i=n[0];i instanceof t?n[0]=new t(e+i.length):n.unshift(new t(e-1),null)}return Ci.of(n)}decomposeLeft(e,i){i.push(new t(e-1),null)}decomposeRight(e,i){i.push(null,new t(this.length-e-1))}updateHeight(e,i=0,n=!1,s){let r=i+this.length;if(s&&s.from<=i+this.length&&s.more){let n=[],o=Math.max(i,s.from),l=-1;for(s.from>i&&n.push(new t(s.from-i-1).updateHeight(e,i));o<=r&&s.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=s.heights[s.index++],r=0;i<0&&(r=-i,i=s.heights[s.index++]),-1==l?l=i:Math.abs(i-l)>=Ai&&(l=-2);let a=new Ti(t,i,r);a.outdated=!1,n.push(a),o+=t+1}o<=r&&n.push(null,new t(r-o).updateHeight(e,o));let a=Ci.of(n);return(l<0||Math.abs(a.height-this.height)>=Ai||Math.abs(l-this.heightMetrics(e,i).perLine)>=Ai)&&(yi=!0),lh(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Ri=class extends Ci{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let s=i+this.left.height;return t<s?this.left.blockAt(t,e,i,n):this.right.blockAt(t,e,s,n+this.left.length+this.break)}lineAt(t,e,i,n,s){let r=n+this.left.height,o=s+this.left.length+this.break,l=e==Si.ByHeight?t<r:t<o,a=l?this.left.lineAt(t,e,i,n,s):this.right.lineAt(t,e,i,r,o);if(this.break||(l?a.to<o:a.from>o))return a;let h=e==Si.ByPosNoHeight?Si.ByPosNoHeight:Si.ByPos;return l?a.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(a)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,l=s+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,i,n,s,r),e>=l&&this.right.forEachLine(t,e,i,o,l,r);else{let a=this.lineAt(l,Si.ByPos,i,n,s);t<a.from&&this.left.forEachLine(t,a.from-1,i,n,s,r),a.to>=t&&a.from<=e&&r(a),e>a.to&&this.right.forEachLine(a.to+1,e,i,o,l,r)}}replace(t,e,i){let n=this.left.length+this.break;if(e<n)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let s=[];t>0&&this.decomposeLeft(t,s);let r=s.length;for(let o of i)s.push(o);if(t>0&&ah(s,r-1),e<this.length){let t=s.length;this.decomposeRight(e,s),ah(s,t)}return Ci.of(s)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<n&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?Ci.of(this.break?[t,null,e]:[t,e]):(this.left=lh(this.left,t),this.right=lh(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:s,right:r}=this,o=e+s.length+this.break,l=null;return n&&n.from<=e+s.length&&n.more?l=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?l=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),l?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}},Di=class t{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Ti?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Ti(t-this.pos,-1,0)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let r=e-t;i.block?this.addBlock(new Pi(r,n,i)):(r||s||n>=5)&&this.addLineDeco(n,s,r)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new Ti(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let i=new Qi(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ti)return t;let e=new Ti(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Ti||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ti(0,-1,0));let i=t;for(let n of this.nodes)n instanceof Ti&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(e,i,n,s){let r=new t(n,e);return tt.spans(i,n,s,r,0),r.finish(n)}},$i=class{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,n){(t<e||i&&i.heightRelevant||n&&n.heightRelevant)&&Zl(t,e,this.changes,5)}},Ei=class{constructor(t,e,i,n){this.from=t,this.to=e,this.size=i,this.displaySize=n}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],s=e[i];if(n.from!=s.from||n.to!=s.to||n.size!=s.size)return!1}return!0}draw(t,e){return Rt.replace({widget:new Bi(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}},Bi=class extends Tt{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}},ji=class{constructor(t,e){this.view=t,this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ii,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Lt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1,this.heightOracle=new bi(e.facet(ve).some(t=>"function"!=typeof t&&"cm-lineWrapping"==t.class)),this.stateDeco=fh(e),this.heightMap=Ci.empty().applyChanges(this.stateDeco,h.empty,this.heightOracle.setDoc(e.doc),[new Ce(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Rt.set(this.lineGaps.map(t=>t.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some(({from:t,to:e})=>n>=t&&n<=e)){let{from:e,to:i}=this.lineBlockAt(n);t.push(new Ni(e,i))}}return this.viewports=t.sort((t,e)=>t.from-e.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ii:new Wi(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(ph(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=fh(this.state);let n=t.changedRanges,s=Ce.extendWithRanges(n,function(t,e,i){let n=new $i;return tt.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:w.empty(this.state.doc.length))),r=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);oh(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=r||yi)&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=r);let l=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let a=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(a||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(le)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,e=t.contentDOM,i=window.getComputedStyle(e),n=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?Lt.RTL:Lt.LTR;let r=this.heightOracle.mustRefreshForWrapping(s)||"refresh"===this.mustMeasureContent,o=e.getBoundingClientRect(),l=r||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let a=0,c=0;if(o.width&&o.height){let{scaleX:t,scaleY:i}=ca(e,o);(t>.005&&Math.abs(this.scaleX-t)>.005||i>.005&&Math.abs(this.scaleY-i)>.005)&&(this.scaleX=t,this.scaleY=i,a|=16,r=l=!0)}let u=(parseInt(i.paddingTop)||0)*this.scaleY,d=(parseInt(i.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,a|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=16);let f=ua(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=ga(this.scrollParent||t.win);let g=(this.printing?ch:hh)(e,this.paddingTop),m=g.top-this.pixelViewport.top,O=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}(t.dom))return 0;let w=o.width;if(this.contentDOMWidth==w&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=t.scrollDOM.clientHeight,a|=16),l){let e=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(e)&&(r=!0),r||n.lineWrapping&&Math.abs(w-this.contentDOMWidth)>n.charWidth){let{lineHeight:i,charWidth:o,textHeight:l}=t.docView.measureTextSize();r=i>0&&n.refresh(s,i,o,l,Math.max(5,w/o),e),r&&(t.docView.minWidth=0,a|=16)}m>0&&O>0?c=Math.max(m,O):m<0&&O<0&&(c=Math.min(m,O)),oh();for(let i of this.viewports){let s=i.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(i);this.heightMap=(r?Ci.empty().applyChanges(this.stateDeco,h.empty,this.heightOracle,[new Ce(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,r,new ki(i.from,s))}yi&&(a|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(2&a&&(a|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),a|=this.updateForViewport()),(2&a||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(r?[]:this.lineGaps,t)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:r,visibleBottom:o}=this,l=new Ni(n.lineAt(r-1e3*i,Si.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Si.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(t<l.from||t>l.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Si.ByPos,s,0,0);i="center"==e.y?(o.top+o.bottom)/2-r/2:"start"==e.y||"nearest"==e.y&&t<l.from?o.top:o.bottom-r,l=new Ni(n.lineAt(i-500,Si.ByHeight,s,0,0).from,n.lineAt(i+r+500,Si.ByHeight,s,0,0).to)}}return l}mapViewport(t,e){let i=e.mapPos(t.from,-1),n=e.mapPos(t.to,1);return new Ni(this.heightMap.lineAt(i,Si.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,Si.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(t,Si.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(e,Si.ByPos,this.heightOracle,0,0),{visibleTop:r,visibleBottom:o}=this;return(0==t||n<=r-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||s>=o+Math.max(10,Math.min(i,250)))&&n>r-2e3&&s<o+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let n of t)e.touchesRange(n.from,n.to)||i.push(new Ei(e.mapPos(n.from),e.mapPos(n.to),n.size,n.displaySize));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,s=n>>1,r=n<<1;if(this.defaultTextDirection!=Lt.LTR&&!i)return[];let o=[],l=(n,r,a,h)=>{if(r-n<s)return;let c=this.state.selection.main,u=[c.from];c.empty||u.push(c.to);for(let t of u)if(t>n&&t<r)return l(n,t-10,a,h),void l(t+10,r,a,h);let d=function(t,e){for(let i of t)if(e(i))return i}(t,t=>t.from>=a.from&&t.to<=a.to&&Math.abs(t.from-n)<s&&Math.abs(t.to-r)<s&&!u.some(e=>t.from<e&&t.to>e));if(!d){if(r<a.to&&e&&i&&e.visibleRanges.some(t=>t.from<=r&&t.to>=r)){let t=e.moveToLineBoundary(k.cursor(r),!1,!0).head;t>n&&(r=t)}let t=this.gapSize(a,n,r,h);d=new Ei(n,r,t,i||t<2e6?t:2e6)}o.push(d)},a=e=>{if(e.length<r||e.type!=Qt.Text)return;let s=function(t,e,i){let n=[],s=t,r=0;return tt.spans(i,t,e,{span(){},point(t,e){t>s&&(n.push({from:s,to:t}),r+=t-s),s=e}},20),s<e&&(n.push({from:s,to:e}),r+=e-s),{total:r,ranges:n}}(e.from,e.to,this.stateDeco);if(s.total<r)return;let o,a,h=this.scrollTarget?this.scrollTarget.range.head:null;if(i){let t,i,r=n/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=h){let n=dh(s,h),o=((this.visibleBottom-this.visibleTop)/2+r)/e.height;t=n-o,i=n+o}else t=(this.visibleTop-e.top-r)/e.height,i=(this.visibleBottom-e.top+r)/e.height;o=uh(s,t),a=uh(s,i)}else{let i=s.total*this.heightOracle.charWidth,r=n*this.heightOracle.charWidth,l=0;if(i>2e6)for(let n of t)n.from>=e.from&&n.from<e.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let c,u,d=this.pixelViewport.left+l,f=this.pixelViewport.right+l;if(null!=h){let t=dh(s,h),e=((f-d)/2+r)/i;c=t-e,u=t+e}else c=(d-r)/i,u=(f+r)/i;o=uh(s,c),a=uh(s,u)}o>e.from&&l(e.from,o,e,s),a<e.to&&l(a,e.to,e,s)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(a):a(h);return o}gapSize(t,e,i,n){let s=dh(n,i)-dh(n,e);return this.heightOracle.lineWrapping?t.height*s:n.total*this.heightOracle.charWidth*s}updateLineGaps(t){Ei.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Rt.set(t.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];tt.spans(e,this.viewport.from,this.viewport.to,{span(t,e){i.push({from:t,to:e})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let s=0;s<i.length&&!(8&n);s++){let e=this.visibleRanges[s],r=i[s];e.from==r.from&&e.to==r.to||(n|=4,t&&t.mapPos(e.from,-1)==r.from&&t.mapPos(e.to,1)==r.to||(n|=8))}return this.visibleRanges=i,n}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||ph(this.heightMap.lineAt(t,Si.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||ph(this.heightMap.lineAt(this.scaler.fromDOM(t),Si.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return ph(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ni=class{constructor(t,e){this.from=t,this.to=e}},Ii={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}},Wi=class t{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map(({from:i,to:s})=>{let r=e.lineAt(i,Si.ByPos,t,0,0).top,o=e.lineAt(s,Si.ByPos,t,0,0).bottom;return n+=o-r,{from:i,to:s,top:r,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let o of this.viewports)o.domTop=r+(o.top-s)*this.scale,r=o.domBottom=o.domTop+(o.bottom-o.top),s=o.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let s=e<this.viewports.length?this.viewports[e]:null;if(!s||t<s.top)return n+(t-i)*this.scale;if(t<=s.bottom)return s.domTop+(t-s.top);i=s.bottom,n=s.domBottom}}fromDOM(t){for(let e=0,i=0,n=0;;e++){let s=e<this.viewports.length?this.viewports[e]:null;if(!s||t<s.domTop)return i+(t-n)/this.scale;if(t<=s.domBottom)return s.top+(t-s.domTop);i=s.bottom,n=s.domBottom}}eq(e){return e instanceof t&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to)}},Li=S.define({combine:t=>t.join(" ")}),zi=S.define({combine:t=>t.indexOf(!0)>-1}),Hi=gh("."+(Xi=at.newName()),{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},_i={"&light":"."+(Vi=at.newName()),"&dark":"."+(Fi=at.newName())}),Yi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},qi=Mt.ie&&Mt.ie_version<=11,Gi=class{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new jt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let t of e)this.queue.push(t);(Mt.ie&&Mt.ie_version<=11||Mt.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!Mt.android||!1===t.constructor.EDIT_CONTEXT||Mt.chrome&&Mt.chrome_version<126||(this.editContext=new Ui(t),t.state.facet(de)&&(t.contentDOM.editContext=this.editContext.editContext)),qi&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){("change"!=t.type&&t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(de)?i.root.activeElement!=this.dom:!ea(this.dom,n))return;let s=n.anchorNode&&i.docView.tile.nearest(n.anchorNode);s&&s.isWidget()&&s.widget.ignoreEvent(t)?e||(this.selectionChanged=!1):(Mt.ie&&Mt.ie_version<=11||Mt.android&&Mt.chrome)&&!i.state.selection.main.empty&&n.focusNode&&na(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Jl(t.root);if(!e)return!1;let i=Mt.safari&&11==t.root.nodeType&&t.root.activeElement==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Oh(t,i)}let i=null;function n(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),i?Oh(t,i):null}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let n=ea(this.dom,i);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,la(i));;)if(n){if(1!=i.nodeType)return!1;let t=i.childNodes[n-1];"false"==t.contentEditable?n--:(i=t,n=la(i))}else{if(i==t)return!0;n=sa(i),i=i.parentNode}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),n&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(1==i.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);for(let t of this.scrollTargets=e)t.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Yi),qi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),qi&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let t=()=>{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&pa(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(i=this.delayedAndroidKey)||void 0===i?void 0:i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let s of t){let t=this.readMutation(s);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&ea(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ni(this.view,t,e,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=_a(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!qa(this.view.state.selection,e.newSel.main))&&this.view.update([]),n}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty("attributes"==t.type),"childList"==t.type){let i=mh(e,t.previousSibling||t.target.previousSibling,-1),n=mh(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(de)!=t.state.facet(de)&&(t.view.contentDOM.editContext=t.state.facet(de)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}},Ui=class{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let n=t.state.selection.main,{anchor:s,head:r}=n,o=this.toEditorPos(i.updateRangeStart),l=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:o,drifted:!1});let a=l-o>i.text.length;o==this.from&&s<this.from?o=s:l==this.to&&s>this.to&&(l=s);let c=Ya(t.state.sliceDoc(o,l),i.text,(a?n.from:n.to)-o,a?"end":null);if(!c){let e=k.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));return void(qa(e,n)||t.dispatch({selection:e,userEvent:"select"}))}let u={from:c.from+o,to:c.toA+o,insert:h.of(i.text.slice(c.from,c.toB).split("\n"))};if((Mt.mac||Mt.android)&&u.from==r-1&&/^\. ?$/.test(i.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(u={from:o,to:l,insert:h.of([i.text.replace("."," ")])}),this.pendingContextChange=u,!t.state.readOnly){let e=this.to-this.from+(u.to-u.from+u.insert.length);Ha(t,u,k.single(this.toEditorPos(i.selectionStart,e),this.toEditorPos(i.selectionEnd,e)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),u.from<u.to&&!u.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(e.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],s=null;for(let e=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);e<r;e++){let i=t.coordsForChar(e);s=i&&new DOMRect(i.left,i.top,i.right-i.left,i.bottom-i.top)||s||new DOMRect,n.push(s)}e.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=e=>{let i=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,n=t.underlineThickness;if(!/none/i.test(e)&&!/none/i.test(n)){let s=this.toEditorPos(t.rangeStart),r=this.toEditorPos(t.rangeEnd);if(s<r){let t=`text-decoration: underline ${/^[a-z]/.test(e)?e+" ":"Dashed"==e?"dashed ":"Squiggle"==e?"wavy ":""}${/thin/i.test(n)?1:2}px`;i.push(Rt.mark({attributes:{style:t}}).range(s,r))}}}t.dispatch({effects:ue.of(Rt.set(i))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let i in this.handlers)e.addEventListener(i,this.handlers[i]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=Jl(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,n=this.pendingContextChange;return t.changes.iterChanges((s,r,o,l,a)=>{if(i)return;let h=a.length-(r-s);if(n&&r>=n.to){if(n.from==s&&n.to==r&&n.insert.eq(a))return n=this.pendingContextChange=null,e+=h,void(this.to+=h);n=null,this.revertPending(t.state)}if(s+=e,(r+=e)<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||r>this.to||this.to-this.from+a.length>3e4)return void(i=!0);this.editContext.updateText(this.toContextPos(s),this.toContextPos(r),a.toString()),this.to+=h}e+=h}),n&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(t=>!t.isUserEvent("input.type")&&t.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state):(this.pendingContextChange=null,this.reset(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),n=this.toContextPos(e.head);this.editContext.selectionStart==i&&this.editContext.selectionEnd==n||this.editContext.updateSelection(i,n)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>3e4)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}},Ki=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(t=>t.forEach(t=>i(t,this)))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new ji(this,t.state||U.create(t)),t.scrollTo&&t.scrollTo.is(ce)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(pe).map(t=>new me(t));for(let n of this.plugins)n.update(this);this.observer=new Gi(this),this.inputState=new si(this),this.inputState.ensureHandlers(this.plugins),this.docView=new qe(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(e=document.fonts)||void 0===e?void 0:e.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let e=1==t.length&&t[0]instanceof _?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,n=!1,s=this.state;for(let d of t){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed)return void(this.viewState.state=s);let r=this.hasFocus,o=0,l=null;t.some(t=>t.annotation(Oi))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,l=sh(s,r),l||(o=1));let a=this.observer.delayedAndroidKey,h=null;if(a?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(U.phrases)!=this.state.facet(U.phrases))return this.setState(s);e=Me.create(this,s,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new he(t.empty?t:k.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ce)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=tn.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Ae)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(e.startState.facet(Li)!=e.state.facet(Li)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty)for(let d of this.state.facet(ee))try{d(e)}catch(u){Ca(this.state,u,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!_a(this,h)&&a.force&&pa(this.contentDOM,a.key,a.keyCode)})}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new ji(this,t),this.plugins=t.facet(pe).map(t=>new me(t)),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new qe(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(pe),i=t.state.facet(pe);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new me(s));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(t){Ca(this.state,t,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:r}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(r<0)if(ga(i||this.win))s=-1,r=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);s=t.from,r=t.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&l||([this.measureRequests,a]=[a,this.measureRequests]);let h=a.map(t=>{try{return t.read(this)}catch(e){return Ca(this.state,e),Ji}}),c=Me.create(this,this.state,[]),u=!1;c.flags|=l,e?e.flags|=l:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let t=0;t<a.length;t++)if(h[t]!=Ji)try{let e=a[t];e.write&&e.write(h[t],this)}catch(o){Ca(this.state,o)}if(u&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,r=-1;continue}{let t=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-r)/this.scaleY;if((t>1||t<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n+=t,i?i.scrollTop+=t:this.win.scrollBy(0,t),r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ee))l(e)}get themeClasses(){return Xi+" "+(this.state.facet(zi)?Fi:Vi)+" "+this.state.facet(Li)}updateAttrs(){let t=vh(this,Oe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(de)?"true":"false",class:"cm-content",style:`${Mt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),vh(this,ve,e);let i=this.observer.ignore(()=>{let i=Gl(this.contentDOM,this.contentAttrs,e),n=Gl(this.dom,this.editorAttrs,t);return i||n});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(e){let i=!0;for(let n of e)for(let e of n.effects)e.is(t.announce)&&(i&&(this.announceDOM.textContent=""),i=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(Ae);let e=this.state.facet(t.cspNonce);at.mount(this.root,this.styleModules.concat(Hi).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key)return void(this.measureRequests[e]=t);this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(void 0===e||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(e=>e.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return La(this,t,Na(this,t,e,i))}moveByGroup(t,e){return La(this,t,Na(this,t,e,e=>function(t,e,i){let n=t.state.charCategorizer(e),s=n(i);return t=>{let e=n(t);return s==Y.Space&&(s=e),s==e}}(this,t.head,e)))}visualLineSide(t,e){let i=this.bidiSpans(t),n=this.textDirectionAt(t.from),s=i[e?i.length-1:0];return k.cursor(s.side(e,n)+t.from,s.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,i=!0){return ja(this,t,e,i)}moveVertically(t,e,i){return La(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return k.cursor(s,e.assoc);let o,l=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||((e.empty?i:e.head==e.from)?1:-1)),c=t.documentTop;if(h)null==l&&(l=h.left-a.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==l&&(l=Math.min(a.right-a.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=a.left+l,d=t.viewState.heightOracle.textHeight>>1,f=null!=n?n:d;for(let p=0;;p+=d){let e=o+(f+p)*r,n=za(t,{x:u,y:e},!1,r);if(i?e>a.bottom:e<a.top)return k.cursor(n.pos,n.assoc);let s=t.coordsAtPos(n.pos,n.assoc),h=s?(s.top+s.bottom)/2:0;if(!s||(i?h>o:h<o))return k.cursor(n.pos,n.assoc,void 0,l)}}(this,t,e,i))}domAtPos(t,e=1){return this.docView.domAtPos(t,e)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){this.readMeasured();let i=za(this,t,e);return i&&i.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),za(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n);return aa(i,s[qt.find(s,t-n.from,-1,e)].dir==Lt.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(oe)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Zi)return xa(t.length);let e,i=this.textDirectionAt(t.from);for(let s of this.bidiCache)if(s.from==t.from&&s.dir==i&&(s.fresh||ya(s.isolates,e=Ma(this,t))))return s.order;e||(e=Ma(this,t));let n=function(t,e,i){if(!t)return[new qt(0,0,e==Xt?1:0)];if(e==zt&&!i.length&&!Yt.test(t))return xa(t.length);if(i.length)for(;t.length>Gt.length;)Gt[Gt.length]=256;let n=[],s=e==zt?0:1;return ka(t,s,s,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new tn(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Mt.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{da(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return ce.of(new he("number"==typeof t?k.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return ce.of(new he(k.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return ge.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ge.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=at.newName(),n=[Li.of(i),Ae.of(gh(`.${i}`,t))];return e&&e.dark&&n.push(zi.of(!0)),n}static baseTheme(t){return T.lowest(Ae.of(gh("."+Xi,t,_i)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Te.get(i)||Te.get(t);return(null===(e=null==n?void 0:n.root)||void 0===e?void 0:e.view)||null}},Ki.styleModule=Ae,Ki.inputHandler=ie,Ki.clipboardInputFilter=se,Ki.clipboardOutputFilter=re,Ki.scrollHandler=ae,Ki.focusChangeEffect=ne,Ki.perLineTextDirection=oe,Ki.exceptionSink=te,Ki.updateListener=ee,Ki.editable=de,Ki.mouseSelectionStyle=Jt,Ki.dragMovesSelection=Zt,Ki.clickAddsSelectionRange=Kt,Ki.decorations=we,Ki.blockWrappers=ye,Ki.outerDecorations=be,Ki.atomicRanges=ke,Ki.bidiIsolatedRanges=xe,Ki.scrollMargins=Se,Ki.darkTheme=zi,Ki.cspNonce=S.define({combine:t=>t.length?t[0]:""}),Ki.contentAttributes=ve,Ki.editorAttributes=Oe,Ki.lineWrapping=Ki.contentAttributes.of({class:"cm-lineWrapping"}),Ki.announce=F.define(),Zi=4096,Ji={},tn=class t{constructor(t,e,i,n,s,r){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=s,this.order=r}static update(e,i){if(i.empty&&!e.some(t=>t.fresh))return e;let n=[],s=e.length?e[e.length-1].dir:Lt.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir!=s||i.touchesRange(o.from,o.to)||n.push(new t(i.mapPos(o.from,1),i.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}},en=Mt.mac?"mac":Mt.windows?"win":Mt.linux?"linux":"key",nn=T.default(Ki.domEventHandlers({keydown:(t,e)=>bh(yh(e.state),t,e,"editor")})),sn=S.define({enables:nn}),rn=new WeakMap,on=null,ln=4e3,an=null,(hn=class extends K{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}).prototype.elementClass="",hn.prototype.toDOM=void 0,hn.prototype.mapMode=O.TrackBefore,hn.prototype.startSide=hn.prototype.endSide=-1,hn.prototype.point=!0,cn=1024,un=0,dn=class{constructor(t,e){this.from=t,this.to=e}},(fn=class{constructor(t={}){this.id=un++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=mn.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}).closedBy=new fn({deserialize:t=>t.split(" ")}),fn.openedBy=new fn({deserialize:t=>t.split(" ")}),fn.group=new fn({deserialize:t=>t.split(" ")}),fn.isolate=new fn({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),fn.contextHash=new fn({perNode:!0}),fn.lookAhead=new fn({perNode:!0}),fn.mounted=new fn({perNode:!0}),pn=class{constructor(t,e,i,n=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=n}static get(t){return t&&t.props&&t.props[fn.mounted.id]}},gn=Object.create(null),mn=class t{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(e){let i=e.props&&e.props.length?Object.create(null):gn,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),s=new t(e.name||"",i,e.id,n);if(e.props)for(let t of e.props)if(Array.isArray(t)||(t=t(s)),t){if(t[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[t[0].id]=t[1]}return s}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(fn.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(fn.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}},mn.none=new mn("",Object.create(null),0,8),On=class t{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let t of this.types){let n=null;for(let i of e){let e=i(t);if(e){n||(n=Object.assign({},t.props));let i=e[1],s=e[0];s.combine&&s.id in n&&(i=s.combine(n[s.id],i)),n[s.id]=i}}i.push(n?new mn(t.name,n,t.id,t.flags):t)}return new t(i)}},vn=new WeakMap,wn=new WeakMap,function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"}(yn||(yn={})),(bn=class t{constructor(t,e,i,n,s){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[t,e]of s)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=pn.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let t=i.toString();t&&(e&&(e+=","),e+=t)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new Tn(this.topNode,t)}cursorAt(t,e=0,i=0){let n=new Tn(vn.get(this)||this.topNode);return n.moveTo(t,e),vn.set(this,n._tree),n}get topNode(){return new An(this,0,0,null)}resolve(t,e=0){let i=xh(vn.get(this)||this.topNode,t,e,!1);return vn.set(this,i),i}resolveInner(t,e=0){let i=xh(wn.get(this)||this.topNode,t,e,!0);return wn.set(this,i),i}resolveStack(t,e=0){return function(t,e,i){let n=t.resolveInner(e,i),s=null;for(let r=n instanceof An?n:n.context.parent;r;r=r.parent)if(r.index<0){let t=r.parent;(s||(s=[n])).push(t.resolve(e,i)),r=t}else{let t=pn.get(r.tree);if(t&&t.overlay&&t.overlay[0].from<=e&&t.overlay[t.overlay.length-1].to>=e){let o=new An(t.tree,t.overlay[0].from+r.from,-1,r);(s||(s=[n])).push(xh(o,e,i,!1))}}return s?Ch(s):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:s=this.length}=t,r=t.mode||0,o=(r&yn.IncludeAnonymous)>0;for(let l=this.cursor(r|yn.IncludeAnonymous);;){let t=!1;if(l.from<=s&&l.to>=n&&(!o&&l.type.isAnonymous||!1!==e(l))){if(l.firstChild())continue;t=!0}for(;t&&i&&(o||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;t=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(e={}){return this.children.length<=8?this:Qh(mn.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,n)=>new t(this.type,e,i,n,this.propValues),e.makeTree||((e,i,n)=>new t(mn.none,e,i,n)))}static build(t){return Ph(t)}}).empty=new bn(mn.none,[],[],0),kn=class t{constructor(t,e){this.buffer=t,this.index=e}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 t(this.buffer,this.index)}},xn=class t{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return mn.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],n=this.set.types[e],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),i==(t+=4))return s;let r=[];for(;t<i;)r.push(this.childString(t)),t=this.buffer[t+3];return s+"("+r.join(",")+")"}findChild(t,e,i,n,s){let{buffer:r}=this,o=-1;for(let l=t;l!=e&&!(kh(s,n,r[l+1],r[l+2])&&(o=l,i>0));l=r[l+3]);return o}slice(e,i,n){let s=this.buffer,r=new Uint16Array(i-e),o=0;for(let t=e,l=0;t<i;){r[l++]=s[t++],r[l++]=s[t++]-n;let i=r[l++]=s[t++]-n;r[l++]=s[t++]-e,o=Math.max(o,i)}return new t(r,o,this.set)}},Sn=class{cursor(t=0){return new Tn(this,t)}getChild(t,e=null,i=null){let n=Sh(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Sh(this,t,e,i)}resolve(t,e=0){return xh(this,t,e,!1)}resolveInner(t,e=0){return xh(this,t,e,!0)}matchContext(t){return Ah(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let t=e.lastChild;if(!t||t.to!=e.to)break;t.type.isError&&t.from==t.to?(i=e,e=t.prevSibling):e=t}return i}get node(){return this}get next(){return this.parent}},An=class t extends Sn{constructor(t,e,i,n){super(),this._tree=t,this.from=e,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,i,n,s,r=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=i>0?l.length:-1;e!=h;e+=i){let h,c=l[e],u=a[e]+o.from;if(r&yn.EnterBracketed&&c instanceof bn&&(h=pn.get(c))&&!h.overlay&&h.bracketed&&n>=u&&n<=u+c.length||kh(s,n,u,u+c.length))if(c instanceof xn){if(r&yn.ExcludeBuffers)continue;let t=c.findChild(0,c.buffer.length,i,n-u,s);if(t>-1)return new Mn(new Cn(o,c,e,u),null,t)}else if(r&yn.IncludeAnonymous||!c.type.isAnonymous||Mh(c)){let l;if(!(r&yn.IgnoreMounts)&&(l=pn.get(c))&&!l.overlay)return new t(l.tree,u,e,o);let a=new t(c,u,e,o);return r&yn.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(i<0?c.children.length-1:0,i,n,s,r)}}if(r&yn.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+i:i<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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(e,i,n=0){let s;if(!(n&yn.IgnoreOverlays)&&(s=pn.get(this._tree))&&s.overlay){let r=e-this.from,o=n&yn.EnterBracketed&&s.bracketed;for(let{from:e,to:n}of s.overlay)if((i>0||o?e<=r:e<r)&&(i<0||o?n>=r:n>r))return new t(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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()}},Cn=class{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}},Mn=class t extends Sn{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(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(e,i,n){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,i-this.context.start,n);return r<0?null:new t(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(e,i,n=0){if(n&yn.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return r<0?null:new t(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let r=i.buffer[this.index+1];t.push(i.slice(n,s,r)),e.push(0)}return new bn(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}},Pn=class{constructor(t,e){this.heads=t,this.node=e}get next(){return Ch(this.heads)}},Tn=class{get name(){return this.type.name}constructor(t,e=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=e&~yn.EnterBracketed,t instanceof An)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof An?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&yn.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&yn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&yn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(n.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;({index:e,_parent:i}=i))if(e>-1)for(let n=e+t,s=t<0?-1:i._tree.children.length;n!=s;n+=t){let t=i._tree.children[n];if(this.mode&yn.IncludeAnonymous||t instanceof xn||!t.type.isAnonymous||Mh(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let n=this.index,s=this.stack.length;s>=0;){for(let r=t;r;r=r._parent)if(r.index==n){if(n==this.index)return r;e=r,i=s+1;break t}n=this.stack[--s]}for(let n=i;n<this.stack.length;n++)e=new Mn(this.buffer,e,this.stack[n]);return this.bufferNode=new Mn(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let n=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&e&&e(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(t){if(!this.buffer)return Ah(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let n=t.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return Ah(this._tree,t,n);let r=i[e.buffer[this.stack[s]]];if(!r.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}},Qn=new WeakMap,Rn=class{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Mn?this.setBuffer(t.context.buffer,t.index,e):t instanceof An&&this.map.set(t.tree,e)}get(t){return t instanceof Mn?this.getBuffer(t.context.buffer,t.index):t instanceof An?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},Dn=class t{constructor(t,e,i,n,s=!1,r=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,i=[],n=!1){let s=[new t(0,e.length,e,0,!1,n)];for(let t of i)t.to>e.length&&s.push(t);return s}static applyChanges(e,i,n=128){if(!i.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<i.length?i[l]:null,u=c?c.fromA:1e9;if(u-a>=n)for(;o&&o.from<u;){let i=o;if(a>=i.from||u<=i.to||h){let e=Math.max(i.from,a)-h,n=Math.min(i.to,u)-h;i=e>=n?null:new t(e,n,i.tree,i.offset+h,l>0,!!c)}if(i&&s.push(i),o.to>u)break;o=r<e.length?e[r++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return s}},$n=class{startParse(t,e,i){return"string"==typeof t&&(t=new En(t)),i=i?i.length?i.map(t=>new dn(t.from,t.to)):[new dn(0,0)]:[new dn(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}},En=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}},new fn({perNode:!0}),Bn=0,jn=class t{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=Bn++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(e,i){let n="string"==typeof e?e:"?";if(e instanceof t&&(i=e),null==i?void 0:i.base)throw new Error("Can not derive from a modified tag");let s=new t(n,[],null,[]);if(s.set.push(s),i)for(let t of i.set)s.set.push(t);return s}static defineModifier(t){let e=new In(t);return t=>t.modified.indexOf(e)>-1?t:In.get(t.base||t,t.modified.concat(e).sort((t,e)=>t.id-e.id))}},Nn=0,In=class t{constructor(t){this.name=t,this.instances=[],this.id=Nn++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(t=>{return t.base==e&&(n=i,s=t.modified,n.length==s.length&&n.every((t,e)=>t==s[e]));var n,s});if(n)return n;let s=[],r=new jn(e.name,s,e,i);for(let t of i)t.instances.push(r);let o=function(t){let e=[[]];for(let i=0;i<t.length;i++)for(let n=0,s=e.length;n<s;n++)e.push(e[n].concat(t[i]));return e.sort((t,e)=>e.length-t.length)}(i);for(let l of e.set)if(!l.modified.length)for(let e of o)s.push(t.get(l,e));return r}},Wn=new fn({combine(t,e){let i,n,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),i&&i.mode==s.mode&&!s.context&&!i.context)continue;let r=new Ln(s.tags,s.mode,s.context);i?i.next=r:n=r,i=r}return n}}),Ln=class{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}},Ln.empty=new Ln([],2,null),zn=class{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,s){let{type:r,from:o,to:l}=t;if(o>=i||l<=e)return;r.isTop&&(s=this.highlighters.filter(t=>!t.scope||t.scope(r)));let a=n,h=function(t){let e=t.type.prop(Wn);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Ln.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(s,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,o),a),h.opaque)return;let u=t.tree&&t.tree.prop(fn.mounted);if(u&&u.overlay){let r=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter(t=>!t.scope||t.scope(u.tree.type)),c=t.firstChild();for(let d=0,f=o;;d++){let p=d<u.overlay.length?u.overlay[d]:null,g=p?p.from+o:l,m=Math.max(e,f),O=Math.min(i,g);if(m<O&&c)for(;t.from<O&&(this.highlightRange(t,m,O,n,s),this.startSpan(Math.min(O,t.to),a),!(t.to>=g)&&t.nextSibling()););if(!p||g>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),"",h),this.startSpan(Math.min(i,f),a))}c&&t.parent()}else if(t.firstChild()){u&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),a)}}while(t.nextSibling());t.parent()}}},Xn=jn.define,Vn=Xn(),Fn=Xn(),_n=Xn(Fn),Hn=Xn(Fn),Yn=Xn(),qn=Xn(Yn),Gn=Xn(Yn),Un=Xn(),Kn=Xn(Un),Zn=Xn(),Jn=Xn(),ts=Xn(),es=Xn(ts),is=Xn(),ns={comment:Vn,lineComment:Xn(Vn),blockComment:Xn(Vn),docComment:Xn(Vn),name:Fn,variableName:Xn(Fn),typeName:_n,tagName:Xn(_n),propertyName:Hn,attributeName:Xn(Hn),className:Xn(Fn),labelName:Xn(Fn),namespace:Xn(Fn),macroName:Xn(Fn),literal:Yn,string:qn,docString:Xn(qn),character:Xn(qn),attributeValue:Xn(qn),number:Gn,integer:Xn(Gn),float:Xn(Gn),bool:Xn(Yn),regexp:Xn(Yn),escape:Xn(Yn),color:Xn(Yn),url:Xn(Yn),keyword:Zn,self:Xn(Zn),null:Xn(Zn),atom:Xn(Zn),unit:Xn(Zn),modifier:Xn(Zn),operatorKeyword:Xn(Zn),controlKeyword:Xn(Zn),definitionKeyword:Xn(Zn),moduleKeyword:Xn(Zn),operator:Jn,derefOperator:Xn(Jn),arithmeticOperator:Xn(Jn),logicOperator:Xn(Jn),bitwiseOperator:Xn(Jn),compareOperator:Xn(Jn),updateOperator:Xn(Jn),definitionOperator:Xn(Jn),typeOperator:Xn(Jn),controlOperator:Xn(Jn),punctuation:ts,separator:Xn(ts),bracket:es,angleBracket:Xn(es),squareBracket:Xn(es),paren:Xn(es),brace:Xn(es),content:Un,heading:Kn,heading1:Xn(Kn),heading2:Xn(Kn),heading3:Xn(Kn),heading4:Xn(Kn),heading5:Xn(Kn),heading6:Xn(Kn),contentSeparator:Xn(Un),list:Xn(Un),quote:Xn(Un),emphasis:Xn(Un),strong:Xn(Un),link:Xn(Un),monospace:Xn(Un),strikethrough:Xn(Un),inserted:Xn(),deleted:Xn(),changed:Xn(),invalid:Xn(),meta:is,documentMeta:Xn(is),annotation:Xn(is),processingInstruction:Xn(is),definition:jn.defineModifier("definition"),constant:jn.defineModifier("constant"),function:jn.defineModifier("function"),standard:jn.defineModifier("standard"),local:jn.defineModifier("local"),special:jn.defineModifier("special")};for(let t in ns){let e=ns[t];e instanceof jn&&(e.name=t)}Dh([{tag:ns.link,class:"tok-link"},{tag:ns.heading,class:"tok-heading"},{tag:ns.emphasis,class:"tok-emphasis"},{tag:ns.strong,class:"tok-strong"},{tag:ns.keyword,class:"tok-keyword"},{tag:ns.atom,class:"tok-atom"},{tag:ns.bool,class:"tok-bool"},{tag:ns.url,class:"tok-url"},{tag:ns.labelName,class:"tok-labelName"},{tag:ns.inserted,class:"tok-inserted"},{tag:ns.deleted,class:"tok-deleted"},{tag:ns.literal,class:"tok-literal"},{tag:ns.string,class:"tok-string"},{tag:ns.number,class:"tok-number"},{tag:[ns.regexp,ns.escape,ns.special(ns.string)],class:"tok-string2"},{tag:ns.variableName,class:"tok-variableName"},{tag:ns.local(ns.variableName),class:"tok-variableName tok-local"},{tag:ns.definition(ns.variableName),class:"tok-variableName tok-definition"},{tag:ns.special(ns.variableName),class:"tok-variableName2"},{tag:ns.definition(ns.propertyName),class:"tok-propertyName tok-definition"},{tag:ns.typeName,class:"tok-typeName"},{tag:ns.namespace,class:"tok-namespace"},{tag:ns.className,class:"tok-className"},{tag:ns.macroName,class:"tok-macroName"},{tag:ns.propertyName,class:"tok-propertyName"},{tag:ns.operator,class:"tok-operator"},{tag:ns.comment,class:"tok-comment"},{tag:ns.meta,class:"tok-meta"},{tag:ns.invalid,class:"tok-invalid"},{tag:ns.punctuation,class:"tok-punctuation"}]),rs=new fn,os=new fn,ls=class{constructor(t,e,i=[],n=""){this.data=t,this.name=n,U.prototype.hasOwnProperty("tree")||Object.defineProperty(U.prototype,"tree",{get(){return Bh(this)}}),this.parser=e,this.extension=[ms.of(this),U.languageData.of((t,e,i)=>{let n=Eh(t,e,i),s=n.type.prop(rs);if(!s)return[];let r=t.facet(s),o=n.type.prop(os);if(o){let s=n.resolve(e-n.from,i);for(let e of o)if(e.test(s,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(r)}}return r})].concat(i)}isActiveAt(t,e,i=-1){return Eh(t,e,i).type.prop(rs)==this.data}findRegions(t){let e=t.facet(ms);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(rs)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(fn.mounted);if(s){if(s.tree.prop(rs)==this.data){if(s.overlay)for(let t of s.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(s.overlay){let t=i.length;if(n(s.tree,s.overlay[0].from+e),i.length>t)return}}for(let i=0;i<t.children.length;i++){let s=t.children[i];s instanceof bn&&n(s,t.positions[i]+e)}};return n(Bh(t),0),i}get allowsNesting(){return!0}},ls.setState=F.define(),as=class t extends ls{constructor(t,e,i){super(t,e,[],i),this.parser=e}static define(e){let i=(n=e.languageData,S.define({combine:n?t=>t.concat(n):void 0}));var n;return new t(i,e.parser.configure({props:[rs.add(t=>t.isTop?i:void 0)]}),e.name)}configure(e,i){return new t(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}},hs=class{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}},cs=null,us=class t{constructor(t,e,i=[],n,s,r,o,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,i,n){return new t(e,i,[],bn.empty,0,n,[],null)}startParse(){return this.parser.startParse(new hs(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bn.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(Dn.addTree(n,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(i=this.parse.stoppedAt)&&void 0!==i?i:this.state.doc.length,this.tree=n,this.parse=null,!(this.treeLen<(null!=e?e:this.state.doc.length)))return!0;this.parse=this.startParse()}if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Dn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=cs;cs=this;try{return t()}finally{cs=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=jh(t,e.from,e.to);return t}changes(e,i){let{fragments:n,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,i,n,s)=>t.push({fromA:e,toA:i,fromB:n,toB:s})),n=Dn.applyChanges(n,t),s=bn.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let t of this.skipped){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);i<n&&l.push({from:i,to:n})}}}return new t(this.parser,i,n,s,r,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:e,to:n}=this.skipped[i];e<t.to&&n>t.from&&(this.fragments=jh(this.fragments,e,n),this.skipped.splice(i--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends $n{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=cs;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=r,new bn(mn.none,[],[],r-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return cs}},ds=class t{constructor(t){this.context=t,this.tree=t.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,n)||i.takeTree(),new t(i)}static init(e){let i=Math.min(3e3,e.doc.length),n=us.create(e.facet(ms).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new t(n)}},ls.state=M.define({create:ds.init,update(t,e){for(let i of e.effects)if(i.is(ls.setState))return i.value;return e.startState.facet(ms)!=e.state.facet(ms)?ds.init(e.state):t.apply(e)}}),fs=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)},"undefined"!=typeof requestIdleCallback&&(fs=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)}),ps="undefined"!=typeof navigator&&(null===(ss=navigator.scheduling)||void 0===ss?void 0:ss.isInputPending)?()=>navigator.scheduling.isInputPending():null,gs=ge.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(ls.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(ls.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=fs(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,s=i.field(ls.state);if(s.tree==s.context.tree&&s.context.isDone(n+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,t&&!ps?Math.max(25,t.timeRemaining()-5):1e9),o=s.context.treeLen<n&&i.doc.length>n+1e3,l=s.context.work(()=>ps&&ps()||Date.now()>r,n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ls.setState.of(new ds(s.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ca(this.view.state,t)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ms=S.define({combine:t=>t.length?t[0]:null,enables:t=>[ls.state,gs,Ki.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]}),Os=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}},vs=S.define(),ws=S.define({combine:t=>{if(!t.length)return"  ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}}),ys=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=Nh(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return null!=n&&n>=i.from&&n<=i.to?s&&n==t?{text:"",from:t}:(e<0?n<t:n<=t)?{text:i.text.slice(n-i.from),from:n}:{text:i.text.slice(0,n-i.from),from:i.from}:i}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:i,from:n}=this.lineAt(t,e);return i.slice(t-n,Math.min(i.length,t+100-n))}column(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.countColumn(i,t-n),r=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return r>-1&&(s+=r-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,e=t.length){return Hl(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let t=s(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},bs=new fn,ks=class t extends ys{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.context=i}get node(){return this.context.node}static create(e,i,n){return new t(e,i,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(e.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Vh(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return Lh(this.context.next,this.base,this.pos)}},xs=new fn,Ss=class t{constructor(t,e){let i;function n(t){let e=at.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof ls?t=>t.prop(rs)==r.data:r?t=>t==r:void 0,this.style=Dh(t.map(t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))})),{all:s}).style,this.module=i?new at(i):null,this.themeType=e.themeType}static define(e,i){return new t(e,i||{})}},As=S.define(),Cs=S.define({combine:t=>t.length?[t[0]]:null}),Ms=class{constructor(t){this.markCache=Object.create(null),this.tree=Bh(t.state),this.decorations=this.buildDeco(t,Hh(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Bh(t.state),i=Hh(t.state),n=i!=Hh(t.startState),{viewport:s}=t.view,r=t.changes.mapPos(this.decoratedTo,1);e.length<s.to&&!n&&e.type==this.tree.type&&r>=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=r):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return Rt.none;let i=new et;for(let{from:n,to:s}of t.visibleRanges)$h(this.tree,e,(t,e,n)=>{i.add(t,e,this.markCache[n]||(this.markCache[n]=Rt.mark({class:n})))},n,s);return i.finish()}},Ps=T.high(ge.fromClass(Ms,{decorations:t=>t.decorations})),ns.meta,ns.link,ns.heading,ns.emphasis,ns.strong,ns.strikethrough,ns.keyword,ns.atom,ns.bool,ns.url,ns.contentSeparator,ns.labelName,ns.literal,ns.inserted,ns.string,ns.deleted,ns.regexp,ns.escape,ns.string,ns.variableName,ns.variableName,ns.typeName,ns.namespace,ns.className,ns.variableName,ns.macroName,ns.propertyName,ns.comment,ns.invalid,Ts=1e4,Qs="()[]{}",Rs=new fn,Ds=Object.create(null),$s=[mn.none],Es=[],Bs=Object.create(null),js=Object.create(null);for(let[t,i]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])js[t]=Jh(Ds,i);Lt.RTL,Lt.LTR,Ns=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=ec(t.state,i.from);return n.line?Is(t):!!n.block&&Ls(t)},Is=tc(nc,0),Ws=tc(ic,0),Ls=tc((t,e)=>ic(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),s=i.to<=n.to?n:t.doc.lineAt(i.to);s.from>n.from&&s.from==i.to&&(s=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}(e)),0),zs=50,Xs=z.define(),Vs=S.define(),Fs=class t{constructor(t,e,i,n,s){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(t=>t.toJSON())}}static fromJSON(e){return new t(e.changes&&w.fromJSON(e.changes),[],e.mapped&&v.fromJSON(e.mapped),e.startSelection&&k.fromJSON(e.startSelection),e.selectionsAfter.map(k.fromJSON))}static fromTransaction(e,i){let n=_s;for(let t of e.startState.facet(Vs)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),n,void 0,i||e.startState.selection,_s)}static selection(e){return new t(void 0,_s,void 0,void 0,e)}},_s=[],Hs=200,Ys=/^(input\.type|delete)($|\.)/,qs=class t{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,i,n,s,r){let o=this.done,l=o[o.length-1];return o=l&&l.changes&&!l.changes.empty&&e.changes&&(!n||Ys.test(n))&&(!l.selectionsAfter.length&&i-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,function(t,e){let i=[],n=!1;return t.iterChangedRanges((t,e)=>i.push(t,e)),e.iterChangedRanges((t,e,s,r)=>{for(let o=0;o<i.length;){let t=i[o++],e=i[o++];r>=t&&s<=e&&(n=!0)}}),n}(l.changes,e.changes))||"input.type.compose"==n)?sc(o,o.length-1,s.minDepth,new Fs(e.changes.compose(l.changes),rc(F.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,_s)):sc(o,o.length,s.minDepth,e),new t(o,_s,i,n)}addSelection(e,i,n,s){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:_s;return r.length>0&&i-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(o=r[r.length-1],l=e,o.ranges.length==l.ranges.length&&0===o.ranges.filter((t,e)=>t.empty!=l.ranges[e].empty).length)?this:new t(function(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Hs));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),sc(t,t.length-1,1e9,i.setSelAfter(n)))}return[Fs.selection([e])]}(this.done,e),this.undone,i,n);var o,l}addMapping(e){return new t(lc(this.done,e),lc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1],r=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):e.selection);if(i&&s.selectionsAfter.length)return e.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Xs.of({side:t,rest:oc(n),selection:r}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?_s:n.slice(0,n.length-1);return s.mapped&&(i=lc(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Xs.of({side:t,rest:i,selection:r}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}},qs.empty=new qs(_s,_s),Gs=t=>fc(t,!pc(t)),Us=t=>fc(t,pc(t)),Ks=t=>gc(t,!pc(t)),Zs=t=>gc(t,pc(t)),"undefined"!=typeof Intl&&Intl.Segmenter,Js=t=>uc(t,e=>Oc(t.state,e,!pc(t))),tr=t=>uc(t,e=>Oc(t.state,e,pc(t))),er=t=>vc(t,!1),ir=t=>vc(t,!0),nr=t=>yc(t,!1),sr=t=>yc(t,!0),rr=t=>uc(t,e=>bc(t,e,!0)),or=t=>uc(t,e=>bc(t,e,!1)),lr=t=>uc(t,e=>bc(t,e,!pc(t))),ar=t=>uc(t,e=>bc(t,e,pc(t))),hr=t=>uc(t,e=>k.cursor(t.lineBlockAt(e.head).from,1)),cr=t=>uc(t,e=>k.cursor(t.lineBlockAt(e.head).to,-1)),ur=({state:t,dispatch:e})=>function(t,e,i){let n=!1,s=hc(t.selection,e=>{let s=Uh(t,e.head,-1)||Uh(t,e.head,1)||e.head>0&&Uh(t,e.head-1,1)||e.head<t.doc.length&&Uh(t,e.head+1,-1);if(!s||!s.end)return e;n=!0;let r=s.start.from==e.head?s.end.to:s.end.from;return i?k.range(e.anchor,r):k.cursor(r)});return!!n&&(e(cc(t,s)),!0)}(t,e,!1),dr=t=>xc(t,!pc(t)),fr=t=>xc(t,pc(t)),pr=t=>Sc(t,!pc(t)),gr=t=>Sc(t,pc(t)),mr=t=>kc(t,e=>Oc(t.state,e,!pc(t))),Or=t=>kc(t,e=>Oc(t.state,e,pc(t))),vr=t=>Ac(t,!1),wr=t=>Ac(t,!0),yr=t=>Cc(t,!1),br=t=>Cc(t,!0),kr=t=>kc(t,e=>bc(t,e,!0)),xr=t=>kc(t,e=>bc(t,e,!1)),Sr=t=>kc(t,e=>bc(t,e,!pc(t))),Ar=t=>kc(t,e=>bc(t,e,pc(t))),Cr=t=>kc(t,e=>k.cursor(t.lineBlockAt(e.head).from)),Mr=t=>kc(t,e=>k.cursor(t.lineBlockAt(e.head).to)),Pr=({state:t,dispatch:e})=>(e(cc(t,{anchor:0})),!0),Tr=({state:t,dispatch:e})=>(e(cc(t,{anchor:t.doc.length})),!0),Qr=({state:t,dispatch:e})=>(e(cc(t,{anchor:t.selection.main.anchor,head:0})),!0),Rr=({state:t,dispatch:e})=>(e(cc(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Dr=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),$r=({state:t,dispatch:e})=>{let i=Qc(t).map(({from:e,to:i})=>k.range(e,Math.min(i+1,t.doc.length)));return e(t.update({selection:k.create(i),userEvent:"select"})),!0},Er=({state:t,dispatch:e})=>{let i=hc(t.selection,e=>{let i=Bh(t),n=i.resolveStack(e.from,1);if(e.empty){let t=i.resolveStack(e.from,-1);t.node.from>=n.node.from&&t.node.to<=n.node.to&&(n=t)}for(let t=n;t;t=t.next){let{node:i}=t;if((i.from<e.from&&i.to>=e.to||i.to>e.to&&i.from<=e.from)&&t.next)return k.range(i.to,i.from)}return e});return!i.eq(t.selection)&&(e(cc(t,i)),!0)},Br=t=>Mc(t,!1),jr=t=>Mc(t,!0),Nr=({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=k.create([i.main]):i.main.empty||(n=k.create([k.cursor(i.main.head)])),!!n&&(e(cc(t,n)),!0)},Ir=(t,e,i)=>Pc(t,n=>{let s,r,o=n.from,{state:l}=t,a=l.doc.lineAt(o);if(i&&!e&&o>a.from&&o<a.from+200&&!/[^ \t]/.test(s=a.text.slice(0,o-a.from))){if("\t"==s[s.length-1])return o-1;let t=Hl(s,l.tabSize)%Nh(l)||Nh(l);for(let e=0;e<t&&" "==s[s.length-1-e];e++)o--;r=o}else r=Ol(a.text,o-a.from,e,e)+a.from,r==o&&a.number!=(e?l.doc.lines:1)?r+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(r-a.from,o-a.from))&&(r=Ol(a.text,r-a.from,!1,!1)+a.from);return r}),Wr=t=>Ir(t,!1,!0),Lr=t=>Ir(t,!0,!1),zr=(t,e)=>Pc(t,i=>{let n=i.head,{state:s}=t,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let t=null;;){if(n==(e?r.to:r.from)){n==i.head&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let l=Ol(r.text,n-r.from,e)+r.from,a=r.text.slice(Math.min(n,l)-r.from,Math.max(n,l)-r.from),h=o(a);if(null!=t&&h!=t)break;" "==a&&n==i.head||(t=h),n=l}return n}),Xr=t=>zr(t,!1),Vr=t=>zr(t,!0),Fr=t=>Pc(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),_r=t=>Pc(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),Hr=t=>Pc(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),Yr=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:h.of(["",""])},range:k.cursor(t.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},qr=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),s=i==n.from?i-1:Ol(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:Ol(n.text,i-n.from,!0)+n.from;return{changes:{from:s,to:r,insert:t.doc.slice(i,r).append(t.doc.slice(s,i))},range:k.cursor(r)}});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)},Gr=({state:t,dispatch:e})=>Rc(t,e,!1),Ur=({state:t,dispatch:e})=>Rc(t,e,!0),Kr=({state:t,dispatch:e})=>Dc(t,e,!1),Zr=({state:t,dispatch:e})=>Dc(t,e,!0),Jr=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Qc(e).map(({from:t,to:i})=>(t>0?t--:i<e.doc.length&&i++,{from:t,to:i}))),n=hc(e.selection,e=>{let i;if(t.lineWrapping){let n=t.lineBlockAt(e.head),s=t.coordsAtPos(e.head,e.assoc||1);s&&(i=n.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,i)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},to=$c(!1),io=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Ec(t,(e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Hl(n,t.tabSize),r=0,o=Ih(t,Math.max(0,s-Nh(t)));for(;r<n.length&&r<o.length&&n.charCodeAt(r)==o.charCodeAt(r);)r++;i.push({from:e.from+r,to:e.from+n.length,insert:o.slice(r)})}),{userEvent:"delete.dedent"})),!0),no=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Js,shift:mr},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:tr,shift:Or},{key:"Alt-ArrowUp",run:Gr},{key:"Shift-Alt-ArrowUp",run:Kr},{key:"Alt-ArrowDown",run:Ur},{key:"Shift-Alt-ArrowDown",run:Zr},{key:"Mod-Alt-ArrowUp",run:Br},{key:"Mod-Alt-ArrowDown",run:jr},{key:"Escape",run:Nr},{key:"Mod-Enter",run:$c(!0)},{key:"Alt-l",mac:"Ctrl-l",run:$r},{key:"Mod-i",run:Er,preventDefault:!0},{key:"Mod-[",run:io},{key:"Mod-]",run:eo=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Ec(t,(e,i)=>{i.push({from:e.from,insert:t.facet(ws)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ys(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Ec(t,(e,s,r)=>{let o=Wh(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Ih(t,o);(l!=a||r.from<e.from+l.length)&&(i[e.from]=o,s.push({from:e.from,to:e.from+l.length,insert:a}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:Jr},{key:"Shift-Mod-\\",run:ur},{key:"Mod-/",run:Ns},{key:"Alt-A",run:Ws},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:Gs,shift:dr,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ks,shift:pr,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:lr,shift:Sr,preventDefault:!0},{key:"ArrowRight",run:Us,shift:fr,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Zs,shift:gr,preventDefault:!0},{mac:"Cmd-ArrowRight",run:ar,shift:Ar,preventDefault:!0},{key:"ArrowUp",run:er,shift:vr,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Pr,shift:Qr},{mac:"Ctrl-ArrowUp",run:nr,shift:yr},{key:"ArrowDown",run:ir,shift:wr,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Tr,shift:Rr},{mac:"Ctrl-ArrowDown",run:sr,shift:br},{key:"PageUp",run:nr,shift:yr},{key:"PageDown",run:sr,shift:br},{key:"Home",run:or,shift:xr,preventDefault:!0},{key:"Mod-Home",run:Pr,shift:Qr},{key:"End",run:rr,shift:kr,preventDefault:!0},{key:"Mod-End",run:Tr,shift:Rr},{key:"Enter",run:to,shift:to},{key:"Mod-a",run:Dr},{key:"Backspace",run:Wr,shift:Wr,preventDefault:!0},{key:"Delete",run:Lr,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xr,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Vr,preventDefault:!0},{mac:"Mod-Backspace",run:_r,preventDefault:!0},{mac:"Mod-Delete",run:Hr,preventDefault:!0}].concat([{key:"Ctrl-b",run:Gs,shift:dr,preventDefault:!0},{key:"Ctrl-f",run:Us,shift:fr},{key:"Ctrl-p",run:er,shift:vr},{key:"Ctrl-n",run:ir,shift:wr},{key:"Ctrl-a",run:hr,shift:Cr},{key:"Ctrl-e",run:cr,shift:Mr},{key:"Ctrl-d",run:Lr},{key:"Ctrl-h",run:Wr},{key:"Ctrl-k",run:Fr},{key:"Ctrl-Alt-h",run:Xr},{key:"Ctrl-o",run:Yr},{key:"Ctrl-t",run:qr},{key:"Ctrl-v",run:sr}].map(t=>({mac:t.key,run:t.run,shift:t.shift})))),so={key:"Tab",run:eo,shift:io},ro=class t{constructor(t,e,i,n,s,r,o,l,a,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=l,this.curContext=a,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,n=0){let s=e.parser.context;return new t(e,[],i,n,n,0,[],0,s?new oo(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),o=s.dynamicPrecedence(n);if(o&&(this.score+=o),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,r?8:4,!0),void this.reduceContext(n,this.reducePos);let l=this.stack.length-3*(i-1)-(262144&t?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-a;h>=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=h));let c=l?this.stack[l-1]:0,u=this.bufferBase+this.buffer.length-c;if(n<s.minRepeatTerm||131072&t){let t=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,a,t,u+4,!0)}if(262144&t)this.state=this.stack[l];else{let t=this.stack[l-3];this.state=s.getGoto(t,n,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let t=this,n=this.buffer.length;if(0==n&&t.parent&&(n=t.bufferBase-t.parent.bufferBase,t=t.parent),n>0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&(0!=this.buffer[s-4]||this.buffer[s-1]<0)){let t=!1;for(let e=s;e>0&&this.buffer[e-2]>i;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4)}this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i,n){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=n,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,n,4);else{let s=t,{parser:r}=this.p;this.pos=n;let o=r.stateFlag(s,1);!o&&(n>i||e<=r.maxNode)&&(this.reducePos=n),this.pushState(s,o?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=r.maxNode&&this.buffer.push(e,i,n,4)}}apply(t,e,i,n){65536&t?this.reduce(t):this.shift(t,e,i,n)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let n=e.buffer.slice(i),s=e.bufferBase+i;for(;e&&s==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,s,this.curContext,this.lookAhead,e)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new lo(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(!(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s<e.length;s+=2)(n=e[s+1])!=this.state&&this.p.parser.hasAction(n,t)&&i.push(e[s],n);if(this.stack.length<120)for(let t=0;i.length<8&&t<e.length;t+=2){let n=e[t+1];i.some((t,e)=>1&e&&t==n)||i.push(e[t],n)}e=i}let i=[];for(let n=0;n<e.length&&i.length<4;n+=2){let t=e[n+1];if(t==this.state)continue;let s=this.split();s.pushState(t,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(e[n],this.pos),s.reducePos=this.pos,s.score-=200,i.push(s)}return i}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if(!(65536&e))return!1;if(!t.validAction(this.state,e)){let i=e>>19,n=65535&e,s=this.stack.length-3*i;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],i=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,e=>{if(393216&e);else if(65536&e){let i=(e>>19)-s;if(i>1){let n=65535&e,s=this.stack.length-3*i;if(s>=0&&t.getGoto(this.stack[s],n,!1)>=0)return i<<19|65536|n}}else{let t=i(e,s+1);if(null!=t)return t}})};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(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||-3!=this.buffer[t])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||-4!=this.buffer[t])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new oo(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return!(t<=this.lookAhead||(this.emitLookAhead(),this.lookAhead=t,0))}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},oo=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},lo=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1),this.state=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0)}},ao=class t{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new t(e,i,i-e.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.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,0==this.index&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}},co=new(ho=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}),uo=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=co,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;s<i.from;){if(!n)return null;let t=this.ranges[--n];s-=i.from-t.to,i=t}for(;e<0?s>i.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n<this.chunk.length)e=this.pos+t,i=this.chunk.charCodeAt(n);else{let n=this.resolveOffset(t,1);if(null==n)return-1;if(e=n,e>=this.chunk2Pos&&e<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(e-this.chunk2Pos);else{let t=this.rangeIndex,n=this.range;for(;n.to<=e;)n=this.ranges[++t];this.chunk2=this.input.chunk(this.chunk2Pos=e),e+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=i}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos);this.chunk=this.pos+t.length>this.range.to?t.slice(0,this.range.to-this.pos):t,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(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,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(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=co,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}},fo=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;jc(this.data,t,e,this.id,i.data,i.tokenPrecTable)}},fo.prototype.contextual=fo.prototype.fallback=fo.prototype.extend=!1,(po=class{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Bc(t):t}token(t,e){let i=t.pos,n=0;for(;;){let i=t.next<0,s=t.resolveOffset(1,1);if(jc(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(null==this.elseToken)return;if(i||n++,null==s)break;t.reset(s,t.token)}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}).prototype.contextual=fo.prototype.fallback=fo.prototype.extend=!1,go=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}},mo="undefined"!=typeof process&&/\bparse\b/.test({}.LOG),Oo=null,vo=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Wc(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Wc(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let i=this.trees[e],n=this.index[e];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[n],r=this.start[e]+i.positions[n];if(r>t)return this.nextStart=r,null;if(s instanceof bn){if(r==t){if(r<this.safeFrom)return null;let t=r+s.length;if(t<=this.safeTo){let e=s.prop(fn.lookAhead);if(!e||t+e<this.fragment.to)return s}}this.index[e]++,r+s.length>=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}},wo=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new ho)}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,l=0;for(let a=0;a<s.length;a++){if(!(1<<a&r))continue;let n=s[a],h=this.tokens[a];if((!i||n.fallback)&&((n.contextual||h.start!=t.pos||h.mask!=r||h.context!=o)&&(this.updateCachedToken(h,n,t),h.mask=r,h.context=o),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),0!=h.value)){let s=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!n.extend&&(i=h,e>s))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),i||t.pos!=this.stream.end||(i=new ho,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new ho,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n<e.specialized.length;n++)if(e.specialized[n]==t.value){let s=e.specializers[n](this.stream.read(t.start,t.end),i);if(s>=0&&i.p.parser.dialect.allows(s>>1)){1&s?t.extended=s>>1:t.value=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let s=0;s<n;s+=3)if(this.actions[s]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=i,n}addActions(t,e,i,n){let{state:s}=t,{parser:r}=t.p,{data:o}=r;for(let l=0;l<2;l++)for(let t=r.stateSlot(s,l?2:1);;t+=3){if(65535==o[t]){if(1!=o[t+1]){0==n&&2==o[t+1]&&(n=this.putAction(zc(o,t+2),e,i,n));break}t=zc(o,t+2)}o[t]==e&&(n=this.putAction(zc(o,t+1),e,i,n))}return n}},yo=class{constructor(t,e,i,n){this.parser=t,this.input=e,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 uo(e,n),this.tokens=new wo(t,this.stream),this.topTerm=t.top[1];let{from:s}=n[0];this.stacks=[ro.start(this,t.top[0],s)],this.fragments=i.length&&this.stream.end-s>4*t.bufferLength?new vo(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<i.length;r++){let o=i[r];for(;;){if(this.tokens.mainToken=null,o.pos>n)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i)}return e}(t);if(e)return mo&&console.log("Finish with "+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw mo&&t&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&t){let i=null!=this.stoppedAt&&t[0].pos>this.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return mo&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort((t,e)=>e.score-t.score);s.length>t;)s.pop();s.some(t=>t.reducePos>n)&&this.recovering--}else if(s.length>1){t:for(let t=0;t<s.length-1;t++){let e=s[t];for(let i=t+1;i<s.length;i++){let n=s[i];if(e.sameState(n)||e.buffer.length>500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&(s.sort((t,e)=>e.score-t.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(null!=this.stoppedAt&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,i){let n=t.pos,{parser:s}=this,r=mo?this.stackID(t)+" -> ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(fn.contextHash)||0)==i))return t.useNode(o,n),mo&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bn)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof bn&&0==o.positions[0]))break;o=l}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),mo&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let a=0;a<l.length;){let o=l[a++],h=l[a++],c=l[a++],u=a==l.length||!i,d=u?t:t.split(),f=this.tokens.mainToken;if(d.apply(o,h,f?f.start:d.pos,c),mo&&console.log(r+this.stackID(d)+` (via ${65536&o?`reduce of ${s.getName(65535&o)}`:"shift"} for ${s.getName(h)} @ ${n}${d==t?"":", split"})`),u)return!0;d.pos>n?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Lc(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r<t.length;r++){let o=t[r],l=e[r<<1],a=e[1+(r<<1)],h=mo?this.stackID(o)+" -> ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),mo&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;t<10&&c.forceReduce()&&(mo&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,i));t++)mo&&(u=this.stackID(c)+" -> ");for(let t of o.recoverByInsert(l))mo&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),mo&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Lc(o,i)):(!n||n.score<c.score)&&(n=c)}return n}stackToTree(t){return t.close(),bn.build({buffer:ao.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Oo||(Oo=new WeakMap)).get(t);return e||Oo.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}},bo=class{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||0==this.disabled[t]}},ko=class t extends $n{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let o=0;o<t.repeatNodeCount;o++)e.push("");let i=Object.keys(t.topRules).map(e=>t.topRules[e][1]),n=[];for(let o=0;o<e.length;o++)n.push([]);function s(t,e,i){n[t].push([e,e.deserialize(String(i))])}if(t.nodeProps)for(let o of t.nodeProps){let t=o[0];"string"==typeof t&&(t=fn[t]);for(let e=1;e<o.length;){let i=o[e++];if(i>=0)s(i,t,o[e++]);else{let n=o[e+-i];for(let r=-i;r>0;r--)s(o[e++],t,n);e++}}}this.nodeSet=new On(e.map((e,s)=>mn.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=cn;let r=Bc(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;o<this.specializerSpecs.length;o++)this.specialized[o]=this.specializerSpecs[o].term;this.specializers=this.specializerSpecs.map(Xc),this.states=Bc(t.states,Uint32Array),this.data=Bc(t.stateData),this.goto=Bc(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(t=>"number"==typeof t?new fo(r,t):t),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new yo(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s<i;s++)if(n[s]==t)return o;if(r)return-1}}hasAction(t,e){let i=this.data;for(let n=0;n<2;n++)for(let s,r=this.stateSlot(t,n?2:1);;r+=3){if(65535==(s=i[r])){if(1!=i[r+1]){if(2==i[r+1])return zc(i,r+2);break}s=i[r=zc(i,r+2)]}if(s==e||0==s)return zc(i,r+1)}return 0}stateSlot(t,e){return this.states[6*t+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,t=>t==e||null)}allActions(t,e){let i=this.stateSlot(t,4),n=i?e(i):void 0;for(let s=this.stateSlot(t,1);null==n;s+=3){if(65535==this.data[s]){if(1!=this.data[s+1])break;s=zc(this.data,s+2)}n=e(zc(this.data,s+1))}return n}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=zc(this.data,i+2)}if(!(1&this.data[i+2])){let t=this.data[i+1];e.some((e,i)=>1&i&&e==t)||e.push(this.data[i],t)}}return e}configure(e){let i=Object.assign(Object.create(t.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=t}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(t=>{let i=e.tokenizers.find(e=>e.from==t);return i?i.to:t})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((t,n)=>{let s=e.specializers.find(e=>e.from==t.external);if(!s)return t;let r=Object.assign(Object.assign({},t),{external:s.to});return i.specializers[n]=Xc(r),r})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),null!=e.bufferLength&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map(()=>!1);if(t)for(let s of t.split(" ")){let t=e.indexOf(s);t>=0&&(i[t]=!0)}let n=null;for(let s=0;s<e.length;s++)if(!i[s])for(let t,i=this.dialects[e[s]];65535!=(t=this.data[i++]);)(n||(n=new Uint8Array(this.maxTerm+1)))[t]=1;return new bo(t,i,n)}static deserialize(e){return new t(e)}},xo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],So=(t,e,i)=>(n,s)=>{for(let r=!1,o=0,l=0;;l++){let{next:a}=n;if(Vc(a)||45==a||95==a||r&&Fc(a))!r&&(45!=a||l>0)&&(r=!0),o===l&&45==a&&o++,n.advance();else{if(92!=a||10==n.peek(1)){r&&n.acceptToken(2==o&&s.canShift(2)?e:40==a?i:t);break}if(n.advance(),_c(n.next)){do{n.advance()}while(_c(n.next));32==n.next&&n.advance()}else n.next>-1&&n.advance();r=!0}}},Ao=new go(So(136,2,137),{contextual:!0}),Co=new go(So(138,3,4),{contextual:!0}),Mo=new go(t=>{if(xo.includes(t.peek(-1))){let{next:e}=t;(Vc(e)||95==e||35==e||46==e||42==e||91==e||58==e&&Vc(t.peek(1))||45==e||38==e)&&t.acceptToken(135)}}),Po=new go(t=>{if(!xo.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),Vc(e)){do{t.advance()}while(Vc(t.next)||Fc(t.next));t.acceptToken(1)}}}),To=Rh({"AtKeyword import charset namespace keyframes media supports font-feature-values":ns.definitionKeyword,"from to selector scope MatchFlag":ns.keyword,NamespaceName:ns.namespace,KeyframeName:ns.labelName,KeyframeRangeName:ns.operatorKeyword,TagName:ns.tagName,ClassName:ns.className,PseudoClassName:ns.constant(ns.className),IdName:ns.labelName,"FeatureName PropertyName":ns.propertyName,AttributeName:ns.attributeName,NumberLiteral:ns.number,KeywordQuery:ns.keyword,UnaryQueryOp:ns.operatorKeyword,"CallTag ValueName FontName":ns.atom,VariableName:ns.variableName,Callee:ns.operatorKeyword,Unit:ns.unit,"UniversalSelector NestingSelector":ns.definitionOperator,"MatchOp CompareOp":ns.compareOperator,"ChildOp SiblingOp, LogicOp":ns.logicOperator,BinOp:ns.arithmeticOperator,Important:ns.modifier,Comment:ns.blockComment,ColorLiteral:ns.color,"ParenthesizedContent StringLiteral":ns.string,":":ns.punctuation,"PseudoOp #":ns.derefOperator,"; , |":ns.separator,"( )":ns.paren,"[ ]":ns.squareBracket,"{ }":ns.brace}),Qo={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},Ro={__proto__:null,or:104,and:104,not:112,only:112,layer:186},Do={__proto__:null,selector:118,layer:182},$o={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},Eo={__proto__:null,to:223},Bo=ko.deserialize({version:14,states:"IpQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FdO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#DtO'dQdO'#DvO'oQdO'#D}O'oQdO'#EQOOQP'#Fd'#FdO)OQhO'#EsOOQS'#Fc'#FcOOQS'#Ev'#EvQYQdOOO)VQdO'#EWO*cQhO'#E^O)VQdO'#E`O*jQdO'#EbO*uQdO'#EeO)zQhO'#EkO*}QdO'#EmO+YQdO'#EpO+_QaO'#CfO+fQ`O'#ETO+kQ`O'#FnO+vQdO'#FnQOQ`OOP,QO&jO'#CaPOOO)CAR)CAROOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,]QdO,59YO'_QdO,5:`O'dQdO,5:bO'oQdO,5:iO'oQdO,5:kO'oQdO,5:lO'oQdO'#E}O,hQ`O,58}O,pQdO'#ESOOQS,58},58}OOQP'#Cq'#CqOOQO'#Dr'#DrOOQP,59Y,59YO,wQ`O,59YO,|Q`O,59YOOQP'#Du'#DuOOQP,5:`,5:`O-RQpO'#DwO-^QdO'#DxO-cQ`O'#DxO-hQpO,5:bO.RQaO,5:iO.iQaO,5:lOOQW'#D^'#D^O/eQhO'#DgO/xQhO,5;_O)zQhO'#DeO0VQ`O'#DkO0[QhO'#DnOOQW'#Fj'#FjOOQS,5;_,5;_O0aQ`O'#DhOOQS-E8t-E8tOOQ['#Cv'#CvO0fQdO'#CwO0|QdO'#C}O1dQdO'#DQO1zQ!pO'#DSO4TQ!jO,5:rOOQO'#DX'#DXO,|Q`O'#DWO4eQ!nO'#FgO6hQ`O'#DYO6mQ`O'#DoOOQ['#Fg'#FgO6rQhO'#FqO7QQ`O,5:xO7VQ!bO,5:zOOQS'#Ed'#EdO7_Q`O,5:|O7dQdO,5:|OOQO'#Eg'#EgO7lQ`O,5;PO7qQhO,5;VO'oQdO'#DjOOQS,5;X,5;XO0aQ`O,5;XO7yQdO,5;XOOQS'#FU'#FUO8RQdO'#ErO7QQ`O,5;[O8ZQdO,5:oO8kQdO'#FPO8xQ`O,5<YO8xQ`O,5<YPOOO'#Eu'#EuP9TO&jO,58{POOO,58{,58{OOQP1G.m1G.mOOQP1G.q1G.qOOQP1G.t1G.tO,wQ`O1G.tO,|Q`O1G.tOOQP1G/z1G/zO9`QpO1G/|O9hQaO1G0TO:OQaO1G0VO:fQaO1G0WO:|QaO,5;iOOQO-E8{-E8{OOQS1G.i1G.iO;WQ`O,5:nO;]QdO'#DsO;dQdO'#CuOOQO'#Dz'#DzOOQO,5:d,5:dO-^QdO,5:dOOQP1G/|1G/|O)VQdO1G/|O;kQ!jO'#D^O;yQ!bO,59yO<RQhO,5:ROOQO'#Fk'#FkO;|Q!bO,59}O<ZQhO'#FVO)zQhO,59{O)zQhO'#FVO=OQhO1G0yOOQS1G0y1G0yO=YQhO,5:PO>QQhO'#DlOOQW,5:V,5:VOOQW,5:Y,5:YOOQW,5:S,5:SO>[Q!fO'#FhOOQS'#Fh'#FhOOQS'#Ex'#ExO?lQdO,59cOOQ[,59c,59cO@SQdO,59iOOQ[,59i,59iO@jQdO,59lOOQ[,59l,59lOOQ[,59n,59nO)VQdO,59pOAQQhO'#EYOOQW'#EY'#EYOAlQ`O1G0^O4^QhO1G0^OOQ[,59r,59rO)zQhO'#D[OOQ[,59t,59tOAqQ#tO,5:ZOA|QhO'#FROBZQ`O,5<]OOQS1G0d1G0dOOQS1G0f1G0fOOQS1G0h1G0hOBfQ`O1G0hOBkQdO'#EhOOQS1G0k1G0kOOQS1G0q1G0qOBvQaO,5:UO7QQ`O1G0sOOQS1G0s1G0sO0aQ`O1G0sOOQS-E9S-E9SOOQS1G0v1G0vOB}Q!fO1G0ZOCeQ`O'#EVOOQO1G0Z1G0ZOOQO,5;k,5;kOCjQdO,5;kOOQO-E8}-E8}OCwQ`O1G1tPOOO-E8s-E8sPOOO1G.g1G.gOOQP7+$`7+$`OOQP7+%h7+%hO)VQdO7+%hOOQS1G0Y1G0YODSQaO'#FmOD^Q`O,5:_ODcQ!fO'#EwOEaQdO'#FfOEkQ`O,59aOOQO1G0O1G0OOEpQ!bO7+%hO)VQdO1G/eOE{QhO1G/iOOQW1G/m1G/mOOQW1G/g1G/gOF^QhO,5;qOOQW-E9T-E9TOOQS7+&e7+&eOGRQhO'#D^OGaQhO'#FlOGlQ`O'#FlOGqQ`O,5:WOOQS-E8v-E8vOOQ[1G.}1G.}OOQ[1G/T1G/TOOQ[1G/W1G/WOOQ[1G/[1G/[OGvQdO,5:tOOQS7+%x7+%xOG{Q`O7+%xOHQQhO'#D]OHYQ`O,59vO)zQhO,59vOOQ[1G/u1G/uOHbQ`O1G/uOHgQhO,5;mOOQO-E9P-E9POOQS7+&S7+&SOHuQbO'#DSOOQO'#Ej'#EjOITQ`O'#EiOOQO'#Ei'#EiOI`Q`O'#FSOIhQdO,5;SOOQS,5;S,5;SOOQ[1G/p1G/pOOQS7+&_7+&_O7QQ`O7+&_OIsQ!fO'#FOO)VQdO'#FOOJzQdO7+%uOOQO7+%u7+%uOOQO,5:q,5:qOOQO1G1V1G1VOK_Q!bO<<ISOKjQdO'#E|OKtQ`O,5<XOOQP1G/y1G/yOOQS-E8u-E8uOK|QdO'#E{OLWQ`O,5<QOOQ]1G.{1G.{OOQP<<IS<<ISOL`Q`O<<ISOLeQdO7+%POOQO'#D`'#D`OLlQ!bO7+%TOLtQhO'#EzOMRQ`O,5<WO)VQdO,5<WOOQW1G/r1G/rOOQO'#E['#E[OMZQ`O1G0`OOQS<<Id<<IdO)VQdO,59wOMzQhO1G/bOOQ[1G/b1G/bONRQ`O1G/bOOQW-E8w-E8wOOQ[7+%a7+%aOOQO,5;T,5;TOBnQdO'#FTOI`Q`O,5;nOOQS,5;n,5;nOOQS-E9Q-E9QOOQS1G0n1G0nOOQS<<Iy<<IyONZQ!fO,5;jOOQS-E8|-E8|OOQO<<Ia<<IaOOQPAN>nAN>nO! bQ`OAN>nO! gQaO,5;hOOQO-E8z-E8zO! qQdO,5;gOOQO-E8y-E8yOOQW<<Hk<<HkOOQW<<Ho<<HoO! {QhO<<HoO!!^QhO,5;fO!!iQ`O,5;fOOQO-E8x-E8xO!!nQdO1G1rOGvQdO'#FQO!!xQ`O7+%zOOQW7+%z7+%zO!#QQ!bO1G/cOOQ[7+$|7+$|O!#]QhO7+$|P!#dQ`O'#EyOOQO,5;o,5;oOOQO-E9R-E9ROOQS1G1Y1G1YOOQPG24YG24YO!#iQ`OAN>ZO)VQdO1G1QO!#nQ`O7+'^OOQO,5;l,5;lOOQO-E9O-E9OOOQW<<If<<IfOOQ[<<Hh<<HhPOQW,5;e,5;eOOQWG23uG23uO!#vQdO7+&l",stateData:"!$Z~O$QOS$RQQ~OWVO^_O`WOcYOdYOl`OmZOp[O!r]O!u^O!{dO#ReO#TfO#VgO#YhO#`iO#bjO#ekO#|RO$XTO~OQmOWVO^_O`WOcYOdYOl`OmZOp[O!r]O!u^O!{dO#ReO#TfO#VgO#YhO#`iO#bjO#ekO#|lO$XTO~O#z$bP~P!jO$RqO~O`YXcYXdYXmYXpYXsYX!aYX!rYX!uYX#{YX$X[X~OgYX~P$ZO#|sO~O$XuO~O$XuO`$WXc$WXd$WXm$WXp$WXs$WX!a$WX!r$WX!u$WX#{$WXg$WX~O#|vO~O`xOcyOdyOmzOp{O!r|O!u!OO#{}O~Os!RO!a!PO~P&^Of!XO#|!TO#}!UO~O#|!YO~OW!^O#|![O$X!]O~OWVO^_O`WOcYOdYOmZOp[O!r]O!u^O#|RO$XTO~OS!fOc!gOd!gOh!cOs!RO!Y!eO!]!jO$O!bO~On!iO~P(dOQ!tOh!mOp!nOs!oOu!wOw!wO}!uO!d!vO#|!lO#}!rO$]!pO~OS!fOc!gOd!gOh!cO!Y!eO!]!jO$O!bO~Os$eP~P)zOw!|O!d!vO#|!{O~Ow#OO#|#OO~Oh#ROs!RO#c#TO~O#|#VO~Oc!xX~P$ZOc#YO~On#ZO#z$bXr$bX~O#z$bXr$bX~P!jO$S#^O$T#^O$U#`O~Of#eO#|!TO#}!UO~Os!RO!a!PO~Or$bP~P!jOh#oO~Oh#pO~Oo!kX!o!kX$X!mX~O#|#qO~O$X#sO~Oo#tO!o#uO~O`xOcyOdyOmzOp{O~Os!qa!a!qa!r!qa!u!qa#{!qag!qa~P-pOs!ta!a!ta!r!ta!u!ta#{!tag!ta~P-pOS!fOc!gOd!gOh!cO!Y!eO!]!jO~OR#yOu#yOw#yO$O#vO$]!pO~P/POn$PO!U#|O!a#}O~P(dOh$RO~O$O$TO~Oh#RO~O`$WOc$WOg$ZOl$WOm$WOn$WO~P)VO`$WOc$WOl$WOm$WOn$WOo$]O~P)VO`$WOc$WOl$WOm$WOn$WOr$_O~P)VOP$`OSvXcvXdvXhvXnvXyvX!YvX!]vX!}vX#PvX$OvX!WvXQvX`vXgvXlvXmvXpvXsvXuvXwvX}vX!dvX#|vX#}vX$]vXovXrvX!avX#zvX$dvX!pvX~Oy$aO!}$bO#P$cOn$eP~P)zOh#pOS$ZXc$ZXd$ZXn$ZXy$ZX!Y$ZX!]$ZX!}$ZX#P$ZX$O$ZXQ$ZX`$ZXg$ZXl$ZXm$ZXp$ZXs$ZXu$ZXw$ZX}$ZX!d$ZX#|$ZX#}$ZX$]$ZXo$ZXr$ZX!a$ZX#z$ZX$d$ZX!p$ZX~Oh$gO~Oh$iO~O!U#|O!a$jOs$eXn$eX~Os!RO~On$mOy$aO~On$nO~Ow$oO!d!vO~Os$pO~Os!RO!U#|O~Os!RO#c$vO~O#|#VOs#fX~O$d$zOn!wa#z!war!wa~P)VOn#sX#z#sXr#sX~P!jOn#ZO#z$bar$ba~O$S#^O$T#^O$U%RO~Oo%TO!o%UO~Os!qi!a!qi!r!qi!u!qi#{!qig!qi~P-pOs!si!a!si!r!si!u!si#{!sig!si~P-pOs!ti!a!ti!r!ti!u!ti#{!tig!ti~P-pOs#qa!a#qa~P&^Or%VO~Og$aP~P'oOg$YP~P)VOc!SXg!QX!U!QX!W!SX~Oc%_O!W%`O~Og%aO!U#|O~O!U#|OS#yXc#yXd#yXh#yXn#yXs#yX!Y#yX!]#yX!a#yX$O#yX~On%eO!a#}O~P(dO!U#|OS!Xac!Xad!Xah!Xan!Xas!Xa!Y!Xa!]!Xa!a!Xa$O!Xag!Xa~O$O%fOg$`P~P/POy$aOQ$[X`$[Xc$[Xg$[Xh$[Xl$[Xm$[Xn$[Xp$[Xs$[Xu$[Xw$[X}$[X!d$[X#|$[X#}$[X$]$[Xo$[Xr$[X~O`$WOc$WOg%kOl$WOm$WOn$WO~P)VO`$WOc$WOl$WOm$WOn$WOo%lO~P)VO`$WOc$WOl$WOm$WOn$WOr%mO~P)VOh%oOS!|Xc!|Xd!|Xn!|X!Y!|X!]!|X$O!|X~On%pO~Og%uOw%vO!e%vO~Os#uX!a#uXn#uX~P)zO!a$jOs$ean$ea~On%yO~Or&QO#|%{O$]%zO~Og&RO~P&^Oy$aO!a&VO$d$zOn!wi#z!wir!wi~P)VO$c&YO~On#sa#z#sar#sa~P!jOn#ZO#z$bir$bi~O!a&]Og$aX~P&^Og&_O~Oy$aOQ#kXg#kXh#kXp#kXs#kXu#kXw#kX}#kX!a#kX!d#kX#|#kX#}#kX$]#kX~O!a&aOg$YX~P)VOg&cO~Oo&dOy$aO!p&eO~OR#yOu#yOw#yO$O&gO$]!pO~O!U#|OS#yac#yad#yah#yan#yas#ya!Y#ya!]#ya!a#ya$O#ya~Oc!SXg!QX!U!QX!a!QX~O!U#|O!a&iOg$`X~Oc&kO~Og&lO~O#|&mO~On&oO~Oc&pO!U#|O~Og&rOn&qO~Og&uO~O!U#|Os#ua!a#uan#ua~OP$`OsvX!avXgvX~O$]%zOs#]X!a#]X~Os!RO!a&wO~Or&{O#|%{O$]%zO~Oy$aOQ#rXh#rXn#rXp#rXs#rXu#rXw#rX}#rX!a#rX!d#rX#z#rX#|#rX#}#rX$]#rX$d#rXr#rX~O!a&VO$d$zOn!wq#z!wqr!wq~P)VOo'QOy$aO!p'RO~Og#pX!a#pX~P'oO!a&]Og$aa~Og#oX!a#oX~P)VO!a&aOg$Ya~Oo'QO~Og'WO~P)VOg'XO!W'YO~O$O%fOg#nX!a#nX~P/PO!a&iOg$`a~O`'_Og'aO~OS#mac#mad#mah#ma!Y#ma!]#ma$O#ma~Og'cO~PMcOg'cOn'dO~Oy$aOQ#rah#ran#rap#ras#rau#raw#ra}#ra!a#ra!d#ra#z#ra#|#ra#}#ra$]#ra$d#rar#ra~Oo'iO~Og#pa!a#pa~P&^Og#oa!a#oa~P)VOR#yOu#yOw#yO$O&gO$]%zO~O!U#|Og#na!a#na~Oc'kO~O!a&iOg$`i~P)VO`'_Og'oO~Oy$aOg!Pin!Pi~Og'pO~PMcOn'qO~Og'rO~O!a&iOg$`q~Og#nq!a#nq~P)VO$Q!e$R$]`$]y!u~",goto:"4h$fPPPPP$gP$jP$s%V$s%i%{P$sP&R$sPP&XPPP&_&i&iPPPPP&iPP&iP'VP&iP&i(Q&iP(n(q(w(w)Z(wP(wP(wP(w(wP)j(w)vP(w)yPP*m*s$s*y$s+P+P+V+ZPP$sP$s$sP+a,],j,q$jP,zP,}P$jP$jP$jP-T$jP-W-Z-^-e$jP$jPP$jP-j$jP-m-s.S.j.x/O/Y/`/f/l/r/|0S0Y0`0f0lPPPPPPPPPPP0r0{P1q1t2vP3O3x4R4U4XPP4_RrQ_aOPco!R#Z$}q_OP]^co|}!O!P!R#R#Z#o$}&]qSOP]^co|}!O!P!R#R#Z#o$}&]qUOP]^co|}!O!P!R#R#Z#o$}&]QtTR#auQwWR#bxQ!VYR#cyQ#c!XS$f!s!tR%S#e!V!wdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k's!U!wdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k'sU#y!c%`'YU%}$p&P&wR&v%|!V!sdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k'sR$h!uQ%s$gR&s%tq!h`ei!c!d!e!q#|#}$O$R$e$g$j%t&iQ#w!cQ%h$RQ&h%`Q'[&iR'j'YQ#UjQ$U!jQ$t#TR&T$vR$S!f!U!wdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k'sQ!|gR$o!}Q!WYR#dyQ#c!WR%S#dQ!ZZR#fzQ!_[R#g{T!^[{Q#r!]R%]#sQ!SXQ!i`Q#SjQ#m!QQ$P!dQ$l!yQ$r#QQ$u#UQ$x#XQ%e$OQ&S$tQ&y&OQ&|&TR'h&xSnP!RQ#]oQ$|#ZR&Z$}ZmPo!R#Z$}Q${#YQ&X$yR'P&WR$e!qQ&n%oR'm'_R!}gR#PhR$q#PS&O$p&PR'f&wV%|$p&P&wR#XkQ#_qR%Q#_QcOSoP!RU!kco$}R$}#ZQ%Z#pY&`%Z&f'U'^'sQ&f%_Q'U&aQ'^&kR's'kQ$Y!mQ$[!nQ$^!oV%j$Y$[$^Q%t$gR&t%tQ&j%gS']&j'lR'l'^Q&b%ZR'V&bQ&^%WR'T&^Q!QXR#l!QQ&W$yR'O&WQ#[nS%O#[%PR%P#]Q'`&nR'n'`Q$k!xR%x$kQ&P$pR&z&PQ&x&OR'g&xQ#WkR$w#WQ$O!dR%d$O_bOPco!R#Z$}^XOPco!R#Z$}Q!`]Q!a^Q#h|Q#i}Q#j!OQ#k!PQ$s#RQ%W#oR'S&]R%[#pQ!qdQ!zf[$V!m!n!o$Y$[$^Q$y#Yd%Y#p%Z%_&a&f&k'U'^'k'sQ%^#uQ%n$aS&U$y&WQ&[%UQ&}&VR'b&p]$X!m!n!o$Y$[$^Q!d`U!xe!q$eQ#QiQ#x!cS#{!d$OQ$Q!eQ%b#|Q%c#}Q%g$RS%r$g%tQ%w$jR'Z&iQ#z!cQ&h%`R'j'YR%i$RR%X#oQpPR#n!RQ!yeQ$d!qR%q$e",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles",maxTerm:159,nodeProps:[["isolate",-2,5,39,""],["openedBy",23,"(",31,"[",34,"{"],["closedBy",24,")",32,"]",35,"}"]],propSources:[To],skippedNodes:[0,5,117],repeatNodeCount:17,tokenData:"K`~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu2Xuv%Zvw3Rwx3dxy5Ryz5dz{5i{|6S|}:u}!O;W!O!P;u!P!Q<^!Q![=V![!]>Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!e`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$Q~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$Q~!e`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%jj)jS$dYOy%jz;'S%j;'S;=`%{<%lO%j~)yWOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d<%lO)v~*hOw~~*kRO;'S)v;'S;=`*t;=`O)v~*wXOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d;=`<%l)v<%lO)v~+gP;=`<%l)vj+oYmYOy%jz!Q%j!Q![,_![!c%j!c!i,_!i#T%j#T#Z,_#Z;'S%j;'S;=`%{<%lO%jj,dY!e`Oy%jz!Q%j!Q![-S![!c%j!c!i-S!i#T%j#T#Z-S#Z;'S%j;'S;=`%{<%lO%jj-XY!e`Oy%jz!Q%j!Q![-w![!c%j!c!i-w!i#T%j#T#Z-w#Z;'S%j;'S;=`%{<%lO%jj.OYuY!e`Oy%jz!Q%j!Q![.n![!c%j!c!i.n!i#T%j#T#Z.n#Z;'S%j;'S;=`%{<%lO%jj.uYuY!e`Oy%jz!Q%j!Q![/e![!c%j!c!i/e!i#T%j#T#Z/e#Z;'S%j;'S;=`%{<%lO%jj/jY!e`Oy%jz!Q%j!Q![0Y![!c%j!c!i0Y!i#T%j#T#Z0Y#Z;'S%j;'S;=`%{<%lO%jj0aYuY!e`Oy%jz!Q%j!Q![1P![!c%j!c!i1P!i#T%j#T#Z1P#Z;'S%j;'S;=`%{<%lO%jj1UY!e`Oy%jz!Q%j!Q![1t![!c%j!c!i1t!i#T%j#T#Z1t#Z;'S%j;'S;=`%{<%lO%jj1{SuY!e`Oy%jz;'S%j;'S;=`%{<%lO%jd2[UOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jd2uS!oS!e`Oy%jz;'S%j;'S;=`%{<%lO%jb3WS^QOy%jz;'S%j;'S;=`%{<%lO%j~3gWOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{<%lO3d~4SRO;'S3d;'S;=`4];=`O3d~4`XOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{;=`<%l3d<%lO3d~5OP;=`<%l3dj5WShYOy%jz;'S%j;'S;=`%{<%lO%j~5iOg~n5pUWQyWOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jj6ZWyW!uQOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj6xU!e`Oy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%jj7cY!e`$]YOy%jz!Q%j!Q![7[![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj8WY!e`Oy%jz{%j{|8v|}%j}!O8v!O!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj8{U!e`Oy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj9fU!e`$]YOy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj:P[!e`$]YOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj:zS!aYOy%jz;'S%j;'S;=`%{<%lO%jj;]WyWOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj;zU`YOy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%j~<cTyWOy%jz{<r{;'S%j;'S;=`%{<%lO%j~<yS!e`$R~Oy%jz;'S%j;'S;=`%{<%lO%jj=[[$]YOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj>VUcYOy%jz![%j![!]>i!];'S%j;'S;=`%{<%lO%jj>pSdY!e`Oy%jz;'S%j;'S;=`%{<%lO%jj?RSnYOy%jz;'S%j;'S;=`%{<%lO%jh?dU!WWOy%jz!_%j!_!`?v!`;'S%j;'S;=`%{<%lO%jh?}S!WW!e`Oy%jz;'S%j;'S;=`%{<%lO%jl@bS!WW!oSOy%jz;'S%j;'S;=`%{<%lO%jj@uV!rQ!WWOy%jz!_%j!_!`?v!`!aA[!a;'S%j;'S;=`%{<%lO%jbAcS!rQ!e`Oy%jz;'S%j;'S;=`%{<%lO%jjArYOy%jz}%j}!OBb!O!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjBgW!e`Oy%jz!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!e`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!pWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!pWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!e`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!e`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!e`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!e`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!e`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!e`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!e`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$cQ!e`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$XUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU!uQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[Mo,Po,Ao,Co,1,2,3,4,new po("m~RRYZ[z{a~~g~aO$T~~dP!P!Qg~lO$U~~",28,142)],topRules:{StyleSheet:[0,6],Styles:[1,116]},dynamicPrecedences:{84:1},specialized:[{term:137,get:t=>Qo[t]||-1},{term:138,get:t=>Ro[t]||-1},{term:4,get:t=>Do[t]||-1},{term:28,get:t=>$o[t]||-1},{term:136,get:t=>Eo[t]||-1}],tokenPrec:2256}),jo=null,No=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),Io=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),Wo=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),Lo=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),zo=/^(\w[\w-]*|-\w[\w-]*|)$/,Xo=/^-(-[\w-]*)?$/,Vo=new Rn,Fo=["Declaration"],_o=t=>e=>{let{state:i,pos:n}=e,s=Bh(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:Hc(),validFor:zo};if("ValueName"==s.name)return{from:s.from,options:Io,validFor:zo};if("PseudoClassName"==s.name)return{from:s.from,options:No,validFor:zo};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:qc(i.doc,Yc(s),t),validFor:Xo};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:Hc(),validFor:zo};return{from:s.from,options:Wo,validFor:zo}}if("AtKeyword"==s.name)return{from:s.from,options:Lo,validFor:zo};if(!e.explicit)return null;let o=s.resolve(n),l=o.childBefore(n);return l&&":"==l.name&&"PseudoClassSelector"==o.name?{from:n,options:No,validFor:zo}:l&&":"==l.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:Io,validFor:zo}:"Block"==o.name||"Styles"==o.name?{from:n,options:Hc(),validFor:zo}:null},Ho=_o(t=>"VariableName"==t.name),Yo=as.define({name:"css",parser:Bo.configure({props:[bs.add({Declaration:Fh()}),xs.add({"Block KeyframeList":_h})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}}),qo=t=>{var e=t.theme,i=t.settings,n=void 0===i?{}:i,s=t.styles,r=void 0===s?[]:s,o={".cm-gutters":{}},l={};n.background&&(l.backgroundColor=n.background),n.backgroundImage&&(l.backgroundImage=n.backgroundImage),n.foreground&&(l.color=n.foreground),n.fontSize&&(l.fontSize=n.fontSize),(n.background||n.foreground)&&(o["&"]=l),n.fontFamily&&(o["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(o[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(o[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(o[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(o[".cm-content"]={caretColor:n.caret},o[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var a={};return n.gutterActiveForeground&&(a.color=n.gutterActiveForeground),n.lineHighlight&&(o[".cm-activeLine"]={backgroundColor:n.lineHighlight},a.backgroundColor=n.lineHighlight),o[".cm-activeLineGutter"]=a,n.selection&&(o["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(o["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch}),[Ki.theme(o,{dark:"dark"===e}),Yh(Ss.define(r))]},Go={background:"#ffffff",foreground:"#383a42",caret:"#000",selection:"#add6ff",selectionMatch:"#a8ac94",lineHighlight:"#99999926",gutterBackground:"#fff",gutterForeground:"#237893",gutterActiveForeground:"#0b216f",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},Uo=[{tag:[ns.keyword,ns.operatorKeyword,ns.modifier,ns.color,ns.constant(ns.name),ns.standard(ns.name),ns.standard(ns.tagName),ns.special(ns.brace),ns.atom,ns.bool,ns.special(ns.variableName)],color:"#0000ff"},{tag:[ns.moduleKeyword,ns.controlKeyword],color:"#af00db"},{tag:[ns.name,ns.deleted,ns.character,ns.macroName,ns.propertyName,ns.variableName,ns.labelName,ns.definition(ns.name)],color:"#0070c1"},{tag:ns.heading,fontWeight:"bold",color:"#0070c1"},{tag:[ns.typeName,ns.className,ns.tagName,ns.number,ns.changed,ns.annotation,ns.self,ns.namespace],color:"#267f99"},{tag:[ns.function(ns.variableName),ns.function(ns.propertyName)],color:"#795e26"},{tag:[ns.number],color:"#098658"},{tag:[ns.operator,ns.punctuation,ns.separator,ns.url,ns.escape,ns.regexp],color:"#383a42"},{tag:[ns.regexp],color:"#af00db"},{tag:[ns.special(ns.string),ns.processingInstruction,ns.string,ns.inserted],color:"#a31515"},{tag:[ns.angleBracket],color:"#383a42"},{tag:ns.strong,fontWeight:"bold"},{tag:ns.emphasis,fontStyle:"italic"},{tag:ns.strikethrough,textDecoration:"line-through"},{tag:[ns.meta,ns.comment],color:"#008000"},{tag:ns.link,color:"#4078f2",textDecoration:"underline"},{tag:ns.invalid,color:"#e45649"}],function(t){var e=t||{},i=e.theme,n=void 0===i?"light":i,s=e.settings,r=void 0===s?{}:s,o=e.styles,l=void 0===o?[]:o;qo({theme:n,settings:Gc({},Go,r),styles:[...Uo,...l]})}(),Ko={background:"#1e1e1e",foreground:"#9cdcfe",caret:"#c6c6c6",selection:"#6199ff2f",selectionMatch:"#72a1ff59",lineHighlight:"#ffffff0f",gutterBackground:"#1e1e1e",gutterForeground:"#838383",gutterActiveForeground:"#fff",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},Zo=[{tag:[ns.keyword,ns.operatorKeyword,ns.modifier,ns.color,ns.constant(ns.name),ns.standard(ns.name),ns.standard(ns.tagName),ns.special(ns.brace),ns.atom,ns.bool,ns.special(ns.variableName)],color:"#569cd6"},{tag:[ns.controlKeyword,ns.moduleKeyword],color:"#c586c0"},{tag:[ns.name,ns.deleted,ns.character,ns.macroName,ns.propertyName,ns.variableName,ns.labelName,ns.definition(ns.name)],color:"#9cdcfe"},{tag:ns.heading,fontWeight:"bold",color:"#9cdcfe"},{tag:[ns.typeName,ns.className,ns.tagName,ns.number,ns.changed,ns.annotation,ns.self,ns.namespace],color:"#4ec9b0"},{tag:[ns.function(ns.variableName),ns.function(ns.propertyName)],color:"#dcdcaa"},{tag:[ns.number],color:"#b5cea8"},{tag:[ns.operator,ns.punctuation,ns.separator,ns.url,ns.escape,ns.regexp],color:"#d4d4d4"},{tag:[ns.regexp],color:"#d16969"},{tag:[ns.special(ns.string),ns.processingInstruction,ns.string,ns.inserted],color:"#ce9178"},{tag:[ns.angleBracket],color:"#808080"},{tag:ns.strong,fontWeight:"bold"},{tag:ns.emphasis,fontStyle:"italic"},{tag:ns.strikethrough,textDecoration:"line-through"},{tag:[ns.meta,ns.comment],color:"#6a9955"},{tag:ns.link,color:"#6a9955",textDecoration:"underline"},{tag:ns.invalid,color:"#ff0000"}],Jo=function(t){var e=t||{},i=e.theme,n=void 0===i?"dark":i,s=e.settings,r=void 0===s?{}:s,o=e.styles,l=void 0===o?[]:o;return qo({theme:n,settings:Gc({},Ko,r),styles:[...Zo,...l]})}(),tl=i(n(),1),el={blink:"_blink_6nvhc_1",fourtyfive:"_fourtyfive_6nvhc_13",editor:"_editor_6nvhc_17"},il=s(),nl=[sn.of([so,...no]),new Os(Yo,Yo.data.of({autocomplete:Ho})),Jo],sl=z.define(),t("default",(0,tl.memo)(Uc))}}});
//# sourceMappingURL=StyleEditor-legacy-BZti4570.js.map