UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

5 lines (4 loc) 174 kB
import{d as fu}from"./chunk-RTRJ3KFH.js";var hu=fu((An,On)=>{(function(Y,mt){typeof An=="object"&&typeof On<"u"?On.exports=mt():typeof define=="function"&&define.amd?define(mt):(Y=Y||self,Y.CodeMirror=mt())})(An,function(){"use strict";var Y=navigator.userAgent,mt=navigator.platform,We=/gecko\/\d/i.test(Y),Wn=/MSIE \d/.test(Y),Hn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Y),Mr=/Edge\/(\d+)/.exec(Y),A=Wn||Hn||Mr,E=A&&(Wn?document.documentMode||6:+(Mr||Hn)[1]),ie=!Mr&&/WebKit\//.test(Y),Yo=ie&&/Qt\/\d+\.\d+/.test(Y),ze=!Mr&&/Chrome\/(\d+)/.exec(Y),Fn=ze&&+ze[1],Ce=/Opera\//.test(Y),Dr=/Apple Computer/.test(navigator.vendor),qo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Y),Zo=/PhantomJS/.test(Y),_t=Dr&&(/Mobile\/\w+/.test(Y)||navigator.maxTouchPoints>2),Nr=/Android/.test(Y),Xt=_t||Nr||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Y),ye=_t||/Mac/.test(mt),Qo=/\bCrOS\b/.test(Y),Jo=/win/i.test(mt),$e=Ce&&Y.match(/Version\/(\d*\.\d*)/);$e&&($e=Number($e[1])),$e&&$e>=15&&(Ce=!1,ie=!0);var Pn=ye&&(Yo||Ce&&($e==null||$e<12.11)),pi=We||A&&E>=9;function bt(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var et=function(e,t){var i=e.className,r=bt(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function Ge(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function pe(e,t){return Ge(e).appendChild(t)}function k(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var l=0;l<t.length;++l)n.appendChild(t[l]);return n}function xt(e,t,i,r){var n=k(e,t,i,r);return n.setAttribute("role","presentation"),n}var tt;document.createRange?tt=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:tt=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function Ue(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function me(e){var t=e.ownerDocument||e,i;try{i=e.activeElement}catch{i=t.body||null}for(;i&&i.shadowRoot&&i.shadowRoot.activeElement;)i=i.shadowRoot.activeElement;return i}function rt(e,t){var i=e.className;bt(t).test(i)||(e.className+=(i?" ":"")+t)}function vi(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!bt(i[r]).test(t)&&(t+=" "+i[r]);return t}var Yt=function(e){e.select()};_t?Yt=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:A&&(Yt=function(e){try{e.select()}catch{}});function qt(e){return e.display.wrapper.ownerDocument}function Ct(e){return it(e.display.wrapper)}function it(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function Ar(e){return qt(e).defaultView}function gi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function nt(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function be(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var l=r||0,o=n||0;;){var a=e.indexOf(" ",l);if(a<0||a>=t)return o+(t-l);o+=a-l,o+=i-o%i,l=a+1}}var Ke=function(){this.id=null,this.f=null,this.time=0,this.handler=gi(this.onTimeout,this)};Ke.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ke.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ee(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var En=50,Or={toString:function(){return"CodeMirror.Pass"}},Te={scroll:!1},yi={origin:"*mouse"},Zt={origin:"+move"};function mi(e,t,i){for(var r=0,n=0;;){var l=e.indexOf(" ",r);l==-1&&(l=e.length);var o=l-r;if(l==e.length||n+o>=t)return r+Math.min(o,t-n);if(n+=l-r,n+=i-n%i,r=l+1,n>=t)return r}}var Wr=[""];function bi(e){for(;Wr.length<=e;)Wr.push(W(Wr)+" ");return Wr[e]}function W(e){return e[e.length-1]}function Hr(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function jo(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function In(){}function Rn(e,t){var i;return Object.create?i=Object.create(e):(In.prototype=e,i=new In),t&&nt(t,i),i}var Vo=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function xi(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Vo.test(e))}function Fr(e,t){return t?t.source.indexOf("\\w")>-1&&xi(e)?!0:t.test(e):xi(e)}function Bn(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var $o=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ci(e){return e.charCodeAt(0)>=768&&$o.test(e)}function zn(e,t,i){for(;(i<0?t>0:t<e.length)&&Ci(e.charAt(t));)t+=i;return t}function Qt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,l=r<0?Math.ceil(n):Math.floor(n);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function ea(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,l=0;l<e.length;++l){var o=e[l];(o.from<i&&o.to>t||t==i&&o.to==t)&&(r(Math.max(o.from,t),Math.min(o.to,i),o.level==1?"rtl":"ltr",l),n=!0)}n||r(t,i,"ltr")}var Jt=null;function jt(e,t,i){var r;Jt=null;for(var n=0;n<e.length;++n){var l=e[n];if(l.from<t&&l.to>t)return n;l.to==t&&(l.from!=l.to&&i=="before"?r=n:Jt=n),l.from==t&&(l.from!=l.to&&i!="before"?r=n:Jt=n)}return r??Jt}var ta=(function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,l=/[LRr]/,o=/[Lb1n]/,a=/[1n]/;function s(u,f,h){this.level=u,this.from=f,this.to=h}return function(u,f){var h=f=="ltr"?"L":"R";if(u.length==0||f=="ltr"&&!r.test(u))return!1;for(var d=u.length,c=[],p=0;p<d;++p)c.push(i(u.charCodeAt(p)));for(var v=0,y=h;v<d;++v){var m=c[v];m=="m"?c[v]=y:y=m}for(var x=0,b=h;x<d;++x){var C=c[x];C=="1"&&b=="r"?c[x]="n":l.test(C)&&(b=C,C=="r"&&(c[x]="R"))}for(var L=1,S=c[0];L<d-1;++L){var N=c[L];N=="+"&&S=="1"&&c[L+1]=="1"?c[L]="1":N==","&&S==c[L+1]&&(S=="1"||S=="n")&&(c[L]=S),S=N}for(var P=0;P<d;++P){var j=c[P];if(j==",")c[P]="N";else if(j=="%"){var R=void 0;for(R=P+1;R<d&&c[R]=="%";++R);for(var de=P&&c[P-1]=="!"||R<d&&c[R]=="1"?"1":"N",ue=P;ue<R;++ue)c[ue]=de;P=R-1}}for(var K=0,fe=h;K<d;++K){var $=c[K];fe=="L"&&$=="1"?c[K]="L":l.test($)&&(fe=$)}for(var X=0;X<d;++X)if(n.test(c[X])){var _=void 0;for(_=X+1;_<d&&n.test(c[_]);++_);for(var B=(X?c[X-1]:h)=="L",he=(_<d?c[_]:h)=="L",Ut=B==he?B?"L":"R":h,Ve=X;Ve<_;++Ve)c[Ve]=Ut;X=_-1}for(var re=[],Oe,V=0;V<d;)if(o.test(c[V])){var Dn=V;for(++V;V<d&&o.test(c[V]);++V);re.push(new s(0,Dn,V))}else{var Be=V,gt=re.length,yt=f=="rtl"?1:0;for(++V;V<d&&c[V]!="L";++V);for(var le=Be;le<V;)if(a.test(c[le])){Be<le&&(re.splice(gt,0,new s(1,Be,le)),gt+=yt);var Kt=le;for(++le;le<V&&a.test(c[le]);++le);re.splice(gt,0,new s(2,Kt,le)),gt+=yt,Be=le}else++le;Be<V&&re.splice(gt,0,new s(1,Be,V))}return f=="ltr"&&(re[0].level==1&&(Oe=u.match(/^\s+/))&&(re[0].from=Oe[0].length,re.unshift(new s(0,0,Oe[0].length))),W(re).level==1&&(Oe=u.match(/\s+$/))&&(W(re).to-=Oe[0].length,re.push(new s(0,d-Oe[0].length,d)))),f=="rtl"?re.reverse():re}})();function He(e,t){var i=e.order;return i==null&&(i=e.order=ta(e.text,t)),i}var Gn=[],T=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Gn).concat(i)}};function wi(e,t){return e._handlers&&e._handlers[t]||Gn}function ve(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var l=ee(n,i);l>-1&&(r[t]=n.slice(0,l).concat(n.slice(l+1)))}}}function G(e,t){var i=wi(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function q(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),G(e,i||t.type,e,t),Si(t)||t.codemirrorIgnore}function Un(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ee(i,t[r])==-1&&i.push(t[r])}function xe(e,t){return wi(e,t).length>0}function wt(e){e.prototype.on=function(t,i){T(this,t,i)},e.prototype.off=function(t,i){ve(this,t,i)}}function oe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Kn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Si(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Vt(e){oe(e),Kn(e)}function Li(e){return e.target||e.srcElement}function _n(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ye&&e.ctrlKey&&t==1&&(t=3),t}var ra=(function(){if(A&&E<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e})(),ki;function ia(e){if(ki==null){var t=k("span","\u200B");pe(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ki=t.offsetWidth<=1&&t.offsetHeight>2&&!(A&&E<8))}var i=ki?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ti;function na(e){if(Ti!=null)return Ti;var t=pe(e,document.createTextNode("A\u062EA")),i=tt(t,0,1).getBoundingClientRect(),r=tt(t,1,2).getBoundingClientRect();return Ge(e),!i||i.left==i.right?!1:Ti=r.right-i.right<3}var Mi=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` `,t);n==-1&&(n=e.length);var l=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),o=l.indexOf("\r");o!=-1?(i.push(l.slice(0,o)),t+=o+1):(i.push(l),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},la=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},oa=(function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")})(),Di=null;function aa(e){if(Di!=null)return Di;var t=pe(e,k("span","x")),i=t.getBoundingClientRect(),r=tt(t,0,1).getBoundingClientRect();return Di=Math.abs(i.left-r.left)>1}var Ni={},St={};function sa(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ni[e]=t}function ua(e,t){St[e]=t}function Pr(e){if(typeof e=="string"&&St.hasOwnProperty(e))e=St[e];else if(e&&typeof e.name=="string"&&St.hasOwnProperty(e.name)){var t=St[e.name];typeof t=="string"&&(t={name:t}),e=Rn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Pr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Pr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ai(e,t){t=Pr(t);var i=Ni[t.name];if(!i)return Ai(e,"text/plain");var r=i(e,t);if(Lt.hasOwnProperty(t.name)){var n=Lt[t.name];for(var l in n)n.hasOwnProperty(l)&&(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=n[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)r[o]=t.modeProps[o];return r}var Lt={};function fa(e,t){var i=Lt.hasOwnProperty(e)?Lt[e]:Lt[e]={};nt(t,i)}function lt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Oi(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Xn(e,t,i){return e.startState?e.startState(t,i):!0}var U=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};U.prototype.eol=function(){return this.pos>=this.string.length},U.prototype.sol=function(){return this.pos==this.lineStart},U.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},U.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},U.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},U.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},U.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},U.prototype.skipToEnd=function(){this.pos=this.string.length},U.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},U.prototype.backUp=function(e){this.pos-=e},U.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=be(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?be(this.string,this.lineStart,this.tabSize):0)},U.prototype.indentation=function(){return be(this.string,null,this.tabSize)-(this.lineStart?be(this.string,this.lineStart,this.tabSize):0)},U.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(o){return i?o.toLowerCase():o},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var l=this.string.slice(this.pos).match(e);return l&&l.index>0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},U.prototype.current=function(){return this.string.slice(this.start,this.pos)},U.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},U.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},U.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function w(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],l=n.chunkSize();if(t<l){i=n;break}t-=l}return i.lines[t]}function ot(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(l){var o=l.text;n==i.line&&(o=o.slice(0,i.ch)),n==t.line&&(o=o.slice(t.ch)),r.push(o),++n}),r}function Wi(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function Me(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function H(e){if(e.parent==null)return null;for(var t=e.parent,i=ee(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;r.children[n]!=t;++n)i+=r.children[n].chunkSize();return i+t.first}function at(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],l=n.height;if(t<l){e=n;continue e}t-=l,i+=n.chunkSize()}return i}while(!e.lines);for(var o=0;o<e.lines.length;++o){var a=e.lines[o],s=a.height;if(t<s)break;t-=s}return i+o}function $t(e,t){return t>=e.first&&t<e.first+e.size}function Hi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function g(e,t,i){if(i===void 0&&(i=null),!(this instanceof g))return new g(e,t,i);this.line=e,this.ch=t,this.sticky=i}function M(e,t){return e.line-t.line||e.ch-t.ch}function Fi(e,t){return e.sticky==t.sticky&&M(e,t)==0}function Pi(e){return g(e.line,e.ch)}function Er(e,t){return M(e,t)<0?t:e}function Ir(e,t){return M(e,t)<0?e:t}function Yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function D(e,t){if(t.line<e.first)return g(e.first,0);var i=e.first+e.size-1;return t.line>i?g(i,w(e,i).text.length):ha(t,w(e,t.line).text.length)}function ha(e,t){var i=e.ch;return i==null||i>t?g(e.line,t):i<0?g(e.line,0):e}function qn(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=D(e,t[r]);return i}var Rr=function(e,t){this.state=e,this.lookAhead=t},De=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};De.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},De.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},De.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},De.fromSaved=function(e,t,i){return t instanceof Rr?new De(e,lt(e.mode,t.state),i,t.lookAhead):new De(e,lt(e.mode,t),i)},De.prototype.save=function(e){var t=e!==!1?lt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Rr(t,this.maxLookAhead):t};function Zn(e,t,i,r){var n=[e.state.modeGen],l={};el(e,t.text,e.doc.mode,i,function(u,f){return n.push(u,f)},l,r);for(var o=i.state,a=function(u){i.baseTokens=n;var f=e.state.overlays[u],h=1,d=0;i.state=!0,el(e,t.text,f.mode,i,function(c,p){for(var v=h;d<c;){var y=n[h];y>c&&n.splice(h,1,c,n[h+1],y),h+=2,d=Math.min(c,y)}if(p)if(f.opaque)n.splice(v,h-v,c,"overlay "+p),h=v+2;else for(;v<h;v+=2){var m=n[v+1];n[v+1]=(m?m+" ":"")+"overlay "+p}},l),i.state=o,i.baseTokens=null,i.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)a(s);return{styles:n,classes:l.bgClass||l.textClass?l:null}}function Qn(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=er(e,H(t)),n=t.text.length>e.options.maxHighlightLength&&lt(e.doc.mode,r.state),l=Zn(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function er(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new De(r,!0,t);var l=ca(e,t,i),o=l>r.first&&w(r,l-1).stateAfter,a=o?De.fromSaved(r,o,l):new De(r,Xn(r.mode),l);return r.iter(l,t,function(s){Ei(e,s.text,a);var u=a.line;s.stateAfter=u==t-1||u%5==0||u>=n.viewFrom&&u<n.viewTo?a.save():null,a.nextLine()}),i&&(r.modeFrontier=a.line),a}function Ei(e,t,i,r){var n=e.doc.mode,l=new U(t,e.options.tabSize,i);for(l.start=l.pos=r||0,t==""&&Jn(n,i.state);!l.eol();)Ii(n,l,i.state),l.start=l.pos}function Jn(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=Oi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function Ii(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Oi(e,i).mode);var l=e.token(t,i);if(t.pos>t.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var jn=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vn(e,t,i,r){var n=e.doc,l=n.mode,o;t=D(n,t);var a=w(n,t.line),s=er(e,t.line,i),u=new U(a.text,e.options.tabSize,s),f;for(r&&(f=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,o=Ii(l,u,s.state),r&&f.push(new jn(u,o,lt(n.mode,s.state)));return r?f:new jn(u,o,s.state)}function $n(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function el(e,t,i,r,n,l,o){var a=i.flattenSpans;a==null&&(a=e.options.flattenSpans);var s=0,u=null,f=new U(t,e.options.tabSize,r),h,d=e.options.addModeClass&&[null];for(t==""&&$n(Jn(i,r.state),l);!f.eol();){if(f.pos>e.options.maxHighlightLength?(a=!1,o&&Ei(e,t,r,f.pos),f.pos=t.length,h=null):h=$n(Ii(i,f,r.state,d),l),d){var c=d[0].name;c&&(h="m-"+(h?c+" "+h:c))}if(!a||u!=h){for(;s<f.start;)s=Math.min(f.start,s+5e3),n(s,u);u=h}f.start=f.pos}for(;s<f.pos;){var p=Math.min(f.pos,s+5e3);n(p,u),s=p}}function ca(e,t,i){for(var r,n,l=e.doc,o=i?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>o;--a){if(a<=l.first)return l.first;var s=w(l,a-1),u=s.stateAfter;if(u&&(!i||a+(u instanceof Rr?u.lookAhead:0)<=l.modeFrontier))return a;var f=be(s.text,null,e.options.tabSize);(n==null||r>f)&&(n=a-1,r=f)}return n}function da(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,r=t-1;r>i;r--){var n=w(e,r).stateAfter;if(n&&(!(n instanceof Rr)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var tl=!1,Fe=!1;function pa(){tl=!0}function va(){Fe=!0}function Br(e,t,i){this.marker=e,this.from=t,this.to=i}function tr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ga(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ya(e,t,i){var r=i&&window.WeakSet&&(i.markedSpans||(i.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function ma(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var l=e[n],o=l.marker,a=l.from==null||(o.inclusiveLeft?l.from<=t:l.from<t);if(a||l.from==t&&o.type=="bookmark"&&(!i||!l.marker.insertLeft)){var s=l.to==null||(o.inclusiveRight?l.to>=t:l.to>t);(r||(r=[])).push(new Br(o,l.from,s?null:l.to))}}return r}function ba(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var l=e[n],o=l.marker,a=l.to==null||(o.inclusiveRight?l.to>=t:l.to>t);if(a||l.from==t&&o.type=="bookmark"&&(!i||l.marker.insertLeft)){var s=l.from==null||(o.inclusiveLeft?l.from<=t:l.from<t);(r||(r=[])).push(new Br(o,s?null:l.from-t,l.to==null?null:l.to-t))}}return r}function Ri(e,t){if(t.full)return null;var i=$t(e,t.from.line)&&w(e,t.from.line).markedSpans,r=$t(e,t.to.line)&&w(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,l=t.to.ch,o=M(t.from,t.to)==0,a=ma(i,n,o),s=ba(r,l,o),u=t.text.length==1,f=W(t.text).length+(u?n:0);if(a)for(var h=0;h<a.length;++h){var d=a[h];if(d.to==null){var c=tr(s,d.marker);c?u&&(d.to=c.to==null?null:c.to+f):d.to=n}}if(s)for(var p=0;p<s.length;++p){var v=s[p];if(v.to!=null&&(v.to+=f),v.from==null){var y=tr(a,v.marker);y||(v.from=f,u&&(a||(a=[])).push(v))}else v.from+=f,u&&(a||(a=[])).push(v)}a&&(a=rl(a)),s&&s!=a&&(s=rl(s));var m=[a];if(!u){var x=t.text.length-2,b;if(x>0&&a)for(var C=0;C<a.length;++C)a[C].to==null&&(b||(b=[])).push(new Br(a[C].marker,null,null));for(var L=0;L<x;++L)m.push(b);m.push(s)}return m}function rl(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function xa(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(c){if(c.markedSpans)for(var p=0;p<c.markedSpans.length;++p){var v=c.markedSpans[p].marker;v.readOnly&&(!r||ee(r,v)==-1)&&(r||(r=[])).push(v)}}),!r)return null;for(var n=[{from:t,to:i}],l=0;l<r.length;++l)for(var o=r[l],a=o.find(0),s=0;s<n.length;++s){var u=n[s];if(!(M(u.to,a.from)<0||M(u.from,a.to)>0)){var f=[s,1],h=M(u.from,a.from),d=M(u.to,a.to);(h<0||!o.inclusiveLeft&&!h)&&f.push({from:u.from,to:a.from}),(d>0||!o.inclusiveRight&&!d)&&f.push({from:a.to,to:u.to}),n.splice.apply(n,f),s+=f.length-3}}return n}function il(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function nl(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function zr(e){return e.inclusiveLeft?-1:0}function Gr(e){return e.inclusiveRight?1:0}function Bi(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),l=M(r.from,n.from)||zr(e)-zr(t);if(l)return-l;var o=M(r.to,n.to)||Gr(e)-Gr(t);return o||t.id-e.id}function ll(e,t){var i=Fe&&e.markedSpans,r;if(i)for(var n=void 0,l=0;l<i.length;++l)n=i[l],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||Bi(r,n.marker)<0)&&(r=n.marker);return r}function ol(e){return ll(e,!0)}function Ur(e){return ll(e,!1)}function Ca(e,t){var i=Fe&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var l=i[n];l.marker.collapsed&&(l.from==null||l.from<t)&&(l.to==null||l.to>t)&&(!r||Bi(r,l.marker)<0)&&(r=l.marker)}return r}function al(e,t,i,r,n){var l=w(e,t),o=Fe&&l.markedSpans;if(o)for(var a=0;a<o.length;++a){var s=o[a];if(s.marker.collapsed){var u=s.marker.find(0),f=M(u.from,i)||zr(s.marker)-zr(n),h=M(u.to,r)||Gr(s.marker)-Gr(n);if(!(f>=0&&h<=0||f<=0&&h>=0)&&(f<=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?M(u.to,i)>=0:M(u.to,i)>0)||f>=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?M(u.from,r)<=0:M(u.from,r)<0)))return!0}}}function we(e){for(var t;t=ol(e);)e=t.find(-1,!0).line;return e}function wa(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function Sa(e){for(var t,i;t=Ur(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function zi(e,t){var i=w(e,t),r=we(i);return i==r?t:H(r)}function sl(e,t){if(t>e.lastLine())return t;var i=w(e,t),r;if(!_e(e,i))return t;for(;r=Ur(i);)i=r.find(1,!0).line;return H(i)+1}function _e(e,t){var i=Fe&&t.markedSpans;if(i){for(var r=void 0,n=0;n<i.length;++n)if(r=i[n],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Gi(e,t,r))return!0}}}function Gi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Gi(e,r.line,tr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,l=0;l<t.markedSpans.length;++l)if(n=t.markedSpans[l],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Gi(e,t,n))return!0}function Pe(e){e=we(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var l=i.parent;l;i=l,l=i.parent)for(var o=0;o<l.children.length;++o){var a=l.children[o];if(a==i)break;t+=a.height}return t}function Kr(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=ol(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ur(r);){var l=i.find(0,!0);t-=r.text.length-l.from.ch,r=l.to.line,t+=r.text.length-l.to.ch}return t}function Ui(e){var t=e.display,i=e.doc;t.maxLine=w(i,i.first),t.maxLineLength=Kr(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Kr(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var kt=function(e,t,i){this.text=e,nl(this,t),this.height=i?i(this):1};kt.prototype.lineNo=function(){return H(this)},wt(kt);function La(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),il(e),nl(e,i);var n=r?r(e):1;n!=e.height&&Me(e,n)}function ka(e){e.parent=null,il(e)}var Ta={},Ma={};function ul(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ma:Ta;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function fl(e,t){var i=xt("span",null,null,ie?"padding-right: .1px":null),r={pre:xt("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var l=n?t.rest[n-1]:t.line,o=void 0;r.pos=0,r.addToken=Na,na(e.display.measure)&&(o=He(l,e.doc.direction))&&(r.addToken=Oa(r.addToken,o)),r.map=[];var a=t!=e.display.externalMeasured&&H(l);Wa(l,r,Qn(e,l,a)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=vi(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=vi(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ia(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(ie){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return G(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=vi(r.pre.className,r.textClass||"")),r}function Da(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Na(e,t,i,r,n,l,o){if(t){var a=e.splitSpaces?Aa(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,f;if(!s.test(t))e.col+=t.length,f=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,f),A&&E<9&&(u=!0),e.pos+=t.length;else{f=document.createDocumentFragment();for(var h=0;;){s.lastIndex=h;var d=s.exec(t),c=d?d.index-h:t.length-h;if(c){var p=document.createTextNode(a.slice(h,h+c));A&&E<9?f.appendChild(k("span",[p])):f.appendChild(p),e.map.push(e.pos,e.pos+c,p),e.col+=c,e.pos+=c}if(!d)break;h+=c+1;var v=void 0;if(d[0]==" "){var y=e.cm.options.tabSize,m=y-e.col%y;v=f.appendChild(k("span",bi(m),"cm-tab")),v.setAttribute("role","presentation"),v.setAttribute("cm-text"," "),e.col+=m}else d[0]=="\r"||d[0]==` `?(v=f.appendChild(k("span",d[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),v.setAttribute("cm-text",d[0]),e.col+=1):(v=e.cm.options.specialCharPlaceholder(d[0]),v.setAttribute("cm-text",d[0]),A&&E<9?f.appendChild(k("span",[v])):f.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}if(e.trailingSpace=a.charCodeAt(t.length-1)==32,i||r||n||u||l||o){var x=i||"";r&&(x+=r),n&&(x+=n);var b=k("span",[f],x,l);if(o)for(var C in o)o.hasOwnProperty(C)&&C!="style"&&C!="class"&&b.setAttribute(C,o[C]);return e.content.appendChild(b)}e.content.appendChild(f)}}function Aa(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var l=e.charAt(n);l==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(l="\xA0"),r+=l,i=l==" "}return r}function Oa(e,t){return function(i,r,n,l,o,a,s){n=n?n+" cm-force-border":"cm-force-border";for(var u=i.pos,f=u+r.length;;){for(var h=void 0,d=0;d<t.length&&(h=t[d],!(h.to>u&&h.from<=u));d++);if(h.to>=f)return e(i,r,n,l,o,a,s);e(i,r.slice(0,h.to-u),n,l,null,a,s),l=null,r=r.slice(h.to-u),u=h.to}}}function hl(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Wa(e,t,i){var r=e.markedSpans,n=e.text,l=0;if(!r){for(var o=1;o<i.length;o+=2)t.addToken(t,n.slice(l,l=i[o]),ul(i[o+1],t.cm.options));return}for(var a=n.length,s=0,u=1,f="",h,d,c=0,p,v,y,m,x;;){if(c==s){p=v=y=d="",x=null,m=null,c=1/0;for(var b=[],C=void 0,L=0;L<r.length;++L){var S=r[L],N=S.marker;if(N.type=="bookmark"&&S.from==s&&N.widgetNode)b.push(N);else if(S.from<=s&&(S.to==null||S.to>s||N.collapsed&&S.to==s&&S.from==s)){if(S.to!=null&&S.to!=s&&c>S.to&&(c=S.to,v=""),N.className&&(p+=" "+N.className),N.css&&(d=(d?d+";":"")+N.css),N.startStyle&&S.from==s&&(y+=" "+N.startStyle),N.endStyle&&S.to==c&&(C||(C=[])).push(N.endStyle,S.to),N.title&&((x||(x={})).title=N.title),N.attributes)for(var P in N.attributes)(x||(x={}))[P]=N.attributes[P];N.collapsed&&(!m||Bi(m.marker,N)<0)&&(m=S)}else S.from>s&&c>S.from&&(c=S.from)}if(C)for(var j=0;j<C.length;j+=2)C[j+1]==c&&(v+=" "+C[j]);if(!m||m.from==s)for(var R=0;R<b.length;++R)hl(t,0,b[R]);if(m&&(m.from||0)==s){if(hl(t,(m.to==null?a+1:m.to)-s,m.marker,m.from==null),m.to==null)return;m.to==s&&(m=!1)}}if(s>=a)break;for(var de=Math.min(a,c);;){if(f){var ue=s+f.length;if(!m){var K=ue>de?f.slice(0,de-s):f;t.addToken(t,K,h?h+p:p,y,s+K.length==c?v:"",d,x)}if(ue>=de){f=f.slice(de-s),s=de;break}s=ue,y=""}f=n.slice(l,l=i[u++]),h=ul(i[u++],t.cm.options)}}}function cl(e,t,i){this.line=t,this.rest=Sa(t),this.size=this.rest?H(W(this.rest))-i+1:1,this.node=this.text=null,this.hidden=_e(e,t)}function _r(e,t,i){for(var r=[],n,l=t;l<i;l=n){var o=new cl(e.doc,w(e.doc,l),l);n=l+o.size,r.push(o)}return r}var Tt=null;function Ha(e){Tt?Tt.ops.push(e):e.ownsGroup=Tt={ops:[e],delayedCallbacks:[]}}function Fa(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Pa(e,t){var i=e.ownsGroup;if(i)try{Fa(i)}finally{Tt=null,t(i)}}var rr=null;function Z(e,t){var i=wi(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),n;Tt?n=Tt.delayedCallbacks:rr?n=rr:(n=rr=[],setTimeout(Ea,0));for(var l=function(a){n.push(function(){return i[a].apply(null,r)})},o=0;o<i.length;++o)l(o)}}function Ea(){var e=rr;rr=null;for(var t=0;t<e.length;++t)e[t]()}function dl(e,t,i,r){for(var n=0;n<t.changes.length;n++){var l=t.changes[n];l=="text"?Ra(e,t):l=="gutter"?vl(e,t,i,r):l=="class"?Ki(e,t):l=="widget"&&Ba(e,t,r)}t.changes=null}function ir(e){return e.node==e.text&&(e.node=k("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),A&&E<8&&(e.node.style.zIndex=2)),e.node}function Ia(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=ir(t);t.background=r.insertBefore(k("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function pl(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):fl(e,t)}function Ra(e,t){var i=t.text.className,r=pl(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Ki(e,t)):i&&(t.text.className=i)}function Ki(e,t){Ia(e,t),t.line.wrapClass?ir(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function vl(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=ir(t);t.gutterBackground=k("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var o=ir(t),a=t.gutter=k("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!l||!l["CodeMirror-linenumbers"])&&(t.lineNumber=a.appendChild(k("div",Hi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var s=0;s<e.display.gutterSpecs.length;++s){var u=e.display.gutterSpecs[s].className,f=l.hasOwnProperty(u)&&l[u];f&&a.appendChild(k("div",[f],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Ba(e,t,i){t.alignable&&(t.alignable=null);for(var r=bt("CodeMirror-linewidget"),n=t.node.firstChild,l=void 0;n;n=l)l=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);gl(e,t,i)}function za(e,t,i,r){var n=pl(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),Ki(e,t),vl(e,t,i,r),gl(e,t,r),t.node}function gl(e,t,i){if(yl(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)yl(e,t.rest[r],t,i,!1)}function yl(e,t,i,r,n){if(t.widgets)for(var l=ir(i),o=0,a=t.widgets;o<a.length;++o){var s=a[o],u=k("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),Ga(s,u,i,r),e.display.input.setUneditable(u),n&&s.above?l.insertBefore(u,i.gutter||i.text):l.appendChild(u),Z(s,"redraw")}}function Ga(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function nr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ue(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),pe(t.display.measure,k("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Ee(e,t){for(var i=Li(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Xr(e){return e.lineSpace.offsetTop}function _i(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ml(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=pe(e.measure,k("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ne(e){return En-e.display.nativeBarWidth}function st(e){return e.display.scroller.clientWidth-Ne(e)-e.display.barWidth}function Xi(e){return e.display.scroller.clientHeight-Ne(e)-e.display.barHeight}function Ua(e,t,i){var r=e.options.lineWrapping,n=r&&st(e);if(!t.measure.heights||r&&t.measure.width!=n){var l=t.measure.heights=[];if(r){t.measure.width=n;for(var o=t.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var s=o[a],u=o[a+1];Math.abs(s.bottom-u.bottom)>2&&l.push((s.bottom+u.top)/2-i.top)}}l.push(i.bottom-i.top)}}function bl(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(H(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ka(e,t){t=we(t);var i=H(t),r=e.display.externalMeasured=new cl(e.doc,t,i);r.lineN=i;var n=r.built=fl(e,r);return r.text=n.pre,pe(e.display.lineMeasure,n.pre),r}function xl(e,t,i,r){return Ae(e,Mt(e,t),i,r)}function Yi(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ht(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Mt(e,t){var i=H(t),r=Yi(e,i);r&&!r.text?r=null:r&&r.changes&&(dl(e,r,i,ji(e)),e.curOp.forceUpdate=!0),r||(r=Ka(e,t));var n=bl(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Ae(e,t,i,r,n){t.before&&(i=-1);var l=i+(r||""),o;return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ua(e,t.view,t.rect),t.hasHeights=!0),o=Xa(e,t,i,r),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:n?o.rtop:o.top,bottom:n?o.rbottom:o.bottom}}var Cl={left:0,right:0,top:0,bottom:0};function wl(e,t,i){for(var r,n,l,o,a,s,u=0;u<e.length;u+=3)if(a=e[u],s=e[u+1],t<a?(n=0,l=1,o="left"):t<s?(n=t-a,l=n+1):(u==e.length-3||t==s&&e[u+3]>t)&&(l=s-a,n=l-1,t>=s&&(o="right")),n!=null){if(r=e[u+2],a==s&&i==(r.insertLeft?"left":"right")&&(o=i),i=="left"&&n==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],o="left";if(i=="right"&&n==s-a)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],o="right";break}return{node:r,start:n,end:l,collapse:o,coverStart:a,coverEnd:s}}function _a(e,t){var i=Cl;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var n=e.length-1;n>=0&&(i=e[n]).left==i.right;n--);return i}function Xa(e,t,i,r){var n=wl(t.map,i,r),l=n.node,o=n.start,a=n.end,s=n.collapse,u;if(l.nodeType==3){for(var f=0;f<4;f++){for(;o&&Ci(t.line.text.charAt(n.coverStart+o));)--o;for(;n.coverStart+a<n.coverEnd&&Ci(t.line.text.charAt(n.coverStart+a));)++a;if(A&&E<9&&o==0&&a==n.coverEnd-n.coverStart?u=l.parentNode.getBoundingClientRect():u=_a(tt(l,o,a).getClientRects(),r),u.left||u.right||o==0)break;a=o,o=o-1,s="right"}A&&E<11&&(u=Ya(e.display.measure,u))}else{o>0&&(s=r="right");var h;e.options.lineWrapping&&(h=l.getClientRects()).length>1?u=h[r=="right"?h.length-1:0]:u=l.getBoundingClientRect()}if(A&&E<9&&!o&&(!u||!u.left&&!u.right)){var d=l.parentNode.getClientRects()[0];d?u={left:d.left,right:d.left+Nt(e.display),top:d.top,bottom:d.bottom}:u=Cl}for(var c=u.top-t.rect.top,p=u.bottom-t.rect.top,v=(c+p)/2,y=t.view.measure.heights,m=0;m<y.length-1&&!(v<y[m]);m++);var x=m?y[m-1]:0,b=y[m],C={left:(s=="right"?u.right:u.left)-t.rect.left,right:(s=="left"?u.left:u.right)-t.rect.left,top:x,bottom:b};return!u.left&&!u.right&&(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=c,C.rbottom=p),C}function Ya(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!aa(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function Sl(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Ll(e){e.display.externalMeasure=null,Ge(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Sl(e.display.view[t])}function lr(e){Ll(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function kl(e){return ze&&Nr?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Tl(e){return ze&&Nr?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function qi(e){var t=we(e),i=t.widgets,r=0;if(i)for(var n=0;n<i.length;++n)i[n].above&&(r+=nr(i[n]));return r}function Yr(e,t,i,r,n){if(!n){var l=qi(t);i.top+=l,i.bottom+=l}if(r=="line")return i;r||(r="local");var o=Pe(t);if(r=="local"?o+=Xr(e.display):o-=e.display.viewOffset,r=="page"||r=="window"){var a=e.display.lineSpace.getBoundingClientRect();o+=a.top+(r=="window"?0:Tl(qt(e)));var s=a.left+(r=="window"?0:kl(qt(e)));i.left+=s,i.right+=s}return i.top+=o,i.bottom+=o,i}function Ml(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=kl(qt(e)),n-=Tl(qt(e));else if(i=="local"||!i){var l=e.display.sizer.getBoundingClientRect();r+=l.left,n+=l.top}var o=e.display.lineSpace.getBoundingClientRect();return{left:r-o.left,top:n-o.top}}function qr(e,t,i,r,n){return r||(r=w(e.doc,t.line)),Yr(e,r,xl(e,r,t.ch,n),i)}function Se(e,t,i,r,n,l){r=r||w(e.doc,t.line),n||(n=Mt(e,r));function o(p,v){var y=Ae(e,n,p,v?"right":"left",l);return v?y.left=y.right:y.right=y.left,Yr(e,r,y,i)}var a=He(r,e.doc.direction),s=t.ch,u=t.sticky;if(s>=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return o(u=="before"?s-1:s,u=="before");function f(p,v,y){var m=a[v],x=m.level==1;return o(y?p-1:p,x!=y)}var h=jt(a,s,u),d=Jt,c=f(s,h,u=="before");return d!=null&&(c.other=f(s,d,u!="before")),c}function Dl(e,t){var i=0;t=D(e.doc,t),e.options.lineWrapping||(i=Nt(e.display)*t.ch);var r=w(e.doc,t.line),n=Pe(r)+Xr(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Zi(e,t,i,r,n){var l=g(e,t,i);return l.xRel=n,r&&(l.outside=r),l}function Qi(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Zi(r.first,0,null,-1,-1);var n=at(r,i),l=r.first+r.size-1;if(n>l)return Zi(r.first+r.size-1,w(r,l).text.length,null,1,1);t<0&&(t=0);for(var o=w(r,n);;){var a=qa(e,o,n,t,i),s=Ca(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==n)return u;o=w(r,n=u.line)}}function Nl(e,t,i,r){r-=qi(t);var n=t.text.length,l=Qt(function(o){return Ae(e,i,o-1).bottom<=r},n,0);return n=Qt(function(o){return Ae(e,i,o).top>r},l,n),{begin:l,end:n}}function Al(e,t,i,r){i||(i=Mt(e,t));var n=Yr(e,t,Ae(e,i,r),"line").top;return Nl(e,t,i,n)}function Ji(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function qa(e,t,i,r,n){n-=Pe(t);var l=Mt(e,t),o=qi(t),a=0,s=t.text.length,u=!0,f=He(t,e.doc.direction);if(f){var h=(e.options.lineWrapping?Qa:Za)(e,t,i,l,f,r,n);u=h.level!=1,a=u?h.from:h.to-1,s=u?h.to:h.from-1}var d=null,c=null,p=Qt(function(L){var S=Ae(e,l,L);return S.top+=o,S.bottom+=o,Ji(S,r,n,!1)?(S.top<=n&&S.left<=r&&(d=L,c=S),!0):!1},a,s),v,y,m=!1;if(c){var x=r-c.left<c.right-r,b=x==u;p=d+(b?0:1),y=b?"after":"before",v=x?c.left:c.right}else{!u&&(p==s||p==a)&&p++,y=p==0?"after":p==t.text.length?"before":Ae(e,l,p-(u?1:0)).bottom+o<=n==u?"after":"before";var C=Se(e,g(i,p,y),"line",t,l);v=C.left,m=n<C.top?-1:n>=C.bottom?1:0}return p=zn(t.text,p,1),Zi(i,p,y,m,r-v)}function Za(e,t,i,r,n,l,o){var a=Qt(function(h){var d=n[h],c=d.level!=1;return Ji(Se(e,g(i,c?d.to:d.from,c?"before":"after"),"line",t,r),l,o,!0)},0,n.length-1),s=n[a];if(a>0){var u=s.level!=1,f=Se(e,g(i,u?s.from:s.to,u?"after":"before"),"line",t,r);Ji(f,l,o,!0)&&f.top>o&&(s=n[a-1])}return s}function Qa(e,t,i,r,n,l,o){var a=Nl(e,t,r,o),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var f=null,h=null,d=0;d<n.length;d++){var c=n[d];if(!(c.from>=u||c.to<=s)){var p=c.level!=1,v=Ae(e,r,p?Math.min(u,c.to)-1:Math.max(s,c.from)).right,y=v<l?l-v+1e9:v-l;(!f||h>y)&&(f=c,h=y)}}return f||(f=n[n.length-1]),f.from<s&&(f={from:s,to:f.to,level:f.level}),f.to>u&&(f={from:f.from,to:u,level:f.level}),f}var ut;function Dt(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ut==null){ut=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ut.appendChild(document.createTextNode("x")),ut.appendChild(k("br"));ut.appendChild(document.createTextNode("x"))}pe(e.measure,ut);var i=ut.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),Ge(e.measure),i||1}function Nt(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");pe(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ji(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,l=t.gutters.firstChild,o=0;l;l=l.nextSibling,++o){var a=e.display.gutterSpecs[o].className;i[a]=l.offsetLeft+l.clientLeft+n,r[a]=l.clientWidth}return{fixedPos:Vi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Vi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ol(e){var t=Dt(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Nt(e.display)-3);return function(n){if(_e(e.doc,n))return 0;var l=0;if(n.widgets)for(var o=0;o<n.widgets.length;o++)n.widgets[o].height&&(l+=n.widgets[o].height);return i?l+(Math.ceil(n.text.length/r)||1)*t:l+t}}function $i(e){var t=e.doc,i=Ol(e);t.iter(function(r){var n=i(r);n!=r.height&&Me(r,n)})}function ft(e,t,i,r){var n=e.display;if(!i&&Li(t).getAttribute("cm-not-content")=="true")return null;var l,o,a=n.lineSpace.getBoundingClientRect();try{l=t.clientX-a.left,o=t.clientY-a.top}catch{return null}var s=Qi(e,l,o),u;if(r&&s.xRel>0&&(u=w(e.doc,s.line).text).length==s.ch){var f=be(u,u.length,e.options.tabSize)-u.length;s=g(s.line,Math.max(0,Math.round((l-ml(e.display).left)/Nt(e.display))-f))}return s}function ht(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function ae(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Fe&&zi(e.doc,t)<n.viewTo&&Ye(e);else if(i<=n.viewFrom)Fe&&sl(e.doc,i+r)>n.viewFrom?Ye(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ye(e);else if(t<=n.viewFrom){var l=Zr(e,i