@discoveryjs/discovery
Version:
Frontend framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
5 lines (4 loc) • 612 kB
JavaScript
var vw=Object.create;var Fl=Object.defineProperty;var bw=Object.getOwnPropertyDescriptor;var ww=Object.getOwnPropertyNames;var xw=Object.getPrototypeOf,kw=Object.prototype.hasOwnProperty;var bt=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Me=(n,e)=>{for(var i in e)Fl(n,i,{get:e[i],enumerable:!0})},Cw=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of ww(e))!kw.call(n,l)&&l!==i&&Fl(n,l,{get:()=>e[l],enumerable:!(o=bw(e,l))||o.enumerable});return n};var cn=(n,e,i)=>(i=n!=null?vw(xw(n)):{},Cw(e||!n||!n.__esModule?Fl(i,"default",{value:n,enumerable:!0}):i,n));var Dn=bt((oc,sc)=>{(function(n,e){typeof oc=="object"&&typeof sc<"u"?sc.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self,n.CodeMirror=e())})(oc,function(){"use strict";var n=navigator.userAgent,e=navigator.platform,i=/gecko\/\d/i.test(n),o=/MSIE \d/.test(n),l=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(n),c=/Edge\/(\d+)/.exec(n),f=o||l||c,d=f&&(o?document.documentMode||6:+(c||l)[1]),g=!c&&/WebKit\//.test(n),m=g&&/Qt\/\d+\.\d+/.test(n),v=!c&&/Chrome\//.test(n),x=/Opera\//.test(n),D=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(n),A=/PhantomJS/.test(n),L=D&&(/Mobile\/\w+/.test(n)||navigator.maxTouchPoints>2),P=/Android/.test(n),S=L||P||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(n),k=L||/Mac/.test(e),M=/\bCrOS\b/.test(n),F=/win/i.test(e),N=x&&n.match(/Version\/(\d*\.\d*)/);N&&(N=Number(N[1])),N&&N>=15&&(x=!1,g=!0);var B=k&&(m||x&&(N==null||N<12.11)),R=i||f&&d>=9;function $(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var _=function(t,r){var a=t.className,s=$(r).exec(a);if(s){var u=a.slice(s.index+s[0].length);t.className=a.slice(0,s.index)+(u?s[1]+u:"")}};function te(t){for(var r=t.childNodes.length;r>0;--r)t.removeChild(t.firstChild);return t}function z(t,r){return te(t).appendChild(r)}function V(t,r,a,s){var u=document.createElement(t);if(a&&(u.className=a),s&&(u.style.cssText=s),typeof r=="string")u.appendChild(document.createTextNode(r));else if(r)for(var p=0;p<r.length;++p)u.appendChild(r[p]);return u}function E(t,r,a,s){var u=V(t,r,a,s);return u.setAttribute("role","presentation"),u}var Y;document.createRange?Y=function(t,r,a,s){var u=document.createRange();return u.setEnd(s||t,a),u.setStart(t,r),u}:Y=function(t,r,a){var s=document.body.createTextRange();try{s.moveToElementText(t.parentNode)}catch{return s}return s.collapse(!0),s.moveEnd("character",a),s.moveStart("character",r),s};function U(t,r){if(r.nodeType==3&&(r=r.parentNode),t.contains)return t.contains(r);do if(r.nodeType==11&&(r=r.host),r==t)return!0;while(r=r.parentNode)}function le(){var t;try{t=document.activeElement}catch{t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function Ce(t,r){var a=t.className;$(r).test(a)||(t.className+=(a?" ":"")+r)}function Oe(t,r){for(var a=t.split(" "),s=0;s<a.length;s++)a[s]&&!$(a[s]).test(r)&&(r+=" "+a[s]);return r}var He=function(t){t.select()};L?He=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:f&&(He=function(t){try{t.select()}catch{}});function it(t){var r=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,r)}}function $e(t,r,a){r||(r={});for(var s in t)t.hasOwnProperty(s)&&(a!==!1||!r.hasOwnProperty(s))&&(r[s]=t[s]);return r}function Ye(t,r,a,s,u){r==null&&(r=t.search(/[^\s\u00a0]/),r==-1&&(r=t.length));for(var p=s||0,h=u||0;;){var y=t.indexOf(" ",p);if(y<0||y>=r)return h+(r-p);h+=y-p,h+=a-h%a,p=y+1}}var Ie=function(){this.id=null,this.f=null,this.time=0,this.handler=it(this.onTimeout,this)};Ie.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},Ie.prototype.set=function(t,r){this.f=r;var a=+new Date+t;(!this.id||a<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=a)};function ge(t,r){for(var a=0;a<t.length;++a)if(t[a]==r)return a;return-1}var we=50,K={toString:function(){return"CodeMirror.Pass"}},se={scroll:!1},oe={origin:"*mouse"},ae={origin:"+move"};function Ee(t,r,a){for(var s=0,u=0;;){var p=t.indexOf(" ",s);p==-1&&(p=t.length);var h=p-s;if(p==t.length||u+h>=r)return s+Math.min(h,r-u);if(u+=p-s,u+=a-u%a,s=p+1,u>=r)return s}}var De=[""];function Ae(t){for(;De.length<=t;)De.push(be(De)+" ");return De[t]}function be(t){return t[t.length-1]}function Fe(t,r){for(var a=[],s=0;s<t.length;s++)a[s]=r(t[s],s);return a}function Ge(t,r,a){for(var s=0,u=a(r);s<t.length&&a(t[s])<=u;)s++;t.splice(s,0,r)}function ht(){}function ot(t,r){var a;return Object.create?a=Object.create(t):(ht.prototype=t,a=new ht),r&&$e(r,a),a}var rr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ze(t){return/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||rr.test(t))}function G(t,r){return r?r.source.indexOf("\\w")>-1&&ze(t)?!0:r.test(t):ze(t)}function ie(t){for(var r in t)if(t.hasOwnProperty(r)&&t[r])return!1;return!0}var J=/[\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 Le(t){return t.charCodeAt(0)>=768&&J.test(t)}function wt(t,r,a){for(;(a<0?r>0:r<t.length)&&Le(t.charAt(r));)r+=a;return r}function gn(t,r,a){for(var s=r>a?-1:1;;){if(r==a)return r;var u=(r+a)/2,p=s<0?Math.ceil(u):Math.floor(u);if(p==r)return t(p)?r:a;t(p)?a=p:r=p+s}}function Ra(t,r,a,s){if(!t)return s(r,a,"ltr",0);for(var u=!1,p=0;p<t.length;++p){var h=t[p];(h.from<a&&h.to>r||r==a&&h.to==r)&&(s(Math.max(h.from,r),Math.min(h.to,a),h.level==1?"rtl":"ltr",p),u=!0)}u||s(r,a,"ltr")}var _t=null;function Qe(t,r,a){var s;_t=null;for(var u=0;u<t.length;++u){var p=t[u];if(p.from<r&&p.to>r)return u;p.to==r&&(p.from!=p.to&&a=="before"?s=u:_t=u),p.from==r&&(p.from!=p.to&&a!="before"?s=u:_t=u)}return s??_t}var ir=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function a(w){return w<=247?t.charAt(w):1424<=w&&w<=1524?"R":1536<=w&&w<=1785?r.charAt(w-1536):1774<=w&&w<=2220?"r":8192<=w&&w<=8203?"w":w==8204?"b":"L"}var s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,u=/[stwN]/,p=/[LRr]/,h=/[Lb1n]/,y=/[1n]/;function b(w,O,I){this.level=w,this.from=O,this.to=I}return function(w,O){var I=O=="ltr"?"L":"R";if(w.length==0||O=="ltr"&&!s.test(w))return!1;for(var q=w.length,H=[],Q=0;Q<q;++Q)H.push(a(w.charCodeAt(Q)));for(var Z=0,re=I;Z<q;++Z){var ue=H[Z];ue=="m"?H[Z]=re:re=ue}for(var fe=0,ce=I;fe<q;++fe){var pe=H[fe];pe=="1"&&ce=="r"?H[fe]="n":p.test(pe)&&(ce=pe,pe=="r"&&(H[fe]="R"))}for(var ye=1,me=H[0];ye<q-1;++ye){var Te=H[ye];Te=="+"&&me=="1"&&H[ye+1]=="1"?H[ye]="1":Te==","&&me==H[ye+1]&&(me=="1"||me=="n")&&(H[ye]=me),me=Te}for(var qe=0;qe<q;++qe){var ut=H[qe];if(ut==",")H[qe]="N";else if(ut=="%"){var Ke=void 0;for(Ke=qe+1;Ke<q&&H[Ke]=="%";++Ke);for(var Rt=qe&&H[qe-1]=="!"||Ke<q&&H[Ke]=="1"?"1":"N",Mt=qe;Mt<Ke;++Mt)H[Mt]=Rt;qe=Ke-1}}for(var tt=0,Lt=I;tt<q;++tt){var dt=H[tt];Lt=="L"&&dt=="1"?H[tt]="L":p.test(dt)&&(Lt=dt)}for(var rt=0;rt<q;++rt)if(u.test(H[rt])){var nt=void 0;for(nt=rt+1;nt<q&&u.test(H[nt]);++nt);for(var Xe=(rt?H[rt-1]:I)=="L",Ft=(nt<q?H[nt]:I)=="L",ei=Xe==Ft?Xe?"L":"R":I,Kn=rt;Kn<nt;++Kn)H[Kn]=ei;rt=nt-1}for(var vt=[],Cn,ct=0;ct<q;)if(h.test(H[ct])){var Ml=ct;for(++ct;ct<q&&h.test(H[ct]);++ct);vt.push(new b(0,Ml,ct))}else{var Pn=ct,gr=vt.length,mr=O=="rtl"?1:0;for(++ct;ct<q&&H[ct]!="L";++ct);for(var kt=Pn;kt<ct;)if(y.test(H[kt])){Pn<kt&&(vt.splice(gr,0,new b(1,Pn,kt)),gr+=mr);var ti=kt;for(++kt;kt<ct&&y.test(H[kt]);++kt);vt.splice(gr,0,new b(2,ti,kt)),gr+=mr,Pn=kt}else++kt;Pn<ct&&vt.splice(gr,0,new b(1,Pn,ct))}return O=="ltr"&&(vt[0].level==1&&(Cn=w.match(/^\s+/))&&(vt[0].from=Cn[0].length,vt.unshift(new b(0,0,Cn[0].length))),be(vt).level==1&&(Cn=w.match(/\s+$/))&&(be(vt).to-=Cn[0].length,vt.push(new b(0,q-Cn[0].length,q)))),O=="rtl"?vt.reverse():vt}}();function Bt(t,r){var a=t.order;return a==null&&(a=t.order=ir(t.text,r)),a}var An=[],ve=function(t,r,a){if(t.addEventListener)t.addEventListener(r,a,!1);else if(t.attachEvent)t.attachEvent("on"+r,a);else{var s=t._handlers||(t._handlers={});s[r]=(s[r]||An).concat(a)}};function Fr(t,r){return t._handlers&&t._handlers[r]||An}function At(t,r,a){if(t.removeEventListener)t.removeEventListener(r,a,!1);else if(t.detachEvent)t.detachEvent("on"+r,a);else{var s=t._handlers,u=s&&s[r];if(u){var p=ge(u,a);p>-1&&(s[r]=u.slice(0,p).concat(u.slice(p+1)))}}}function xe(t,r){var a=Fr(t,r);if(a.length)for(var s=Array.prototype.slice.call(arguments,2),u=0;u<a.length;++u)a[u].apply(null,s)}function et(t,r,a){return typeof r=="string"&&(r={type:r,preventDefault:function(){this.defaultPrevented=!0}}),xe(t,a||r.type,t,r),Wt(r)||r.codemirrorIgnore}function Pr(t){var r=t._handlers&&t._handlers.cursorActivity;if(r)for(var a=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),s=0;s<r.length;++s)ge(a,r[s])==-1&&a.push(r[s])}function ft(t,r){return Fr(t,r).length>0}function mn(t){t.prototype.on=function(r,a){ve(this,r,a)},t.prototype.off=function(r,a){At(this,r,a)}}function gt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Or(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Wt(t){return t.defaultPrevented!=null?t.defaultPrevented:t.returnValue==!1}function or(t){gt(t),Or(t)}function Rn(t){return t.target||t.srcElement}function Go(t){var r=t.which;return r==null&&(t.button&1?r=1:t.button&2?r=3:t.button&4&&(r=2)),k&&t.ctrlKey&&r==1&&(r=3),r}var Fi=function(){if(f&&d<9)return!1;var t=V("div");return"draggable"in t||"dragDrop"in t}(),St;function Ko(t){if(St==null){var r=V("span","\u200B");z(t,V("span",[r,document.createTextNode("x")])),t.firstChild.offsetHeight!=0&&(St=r.offsetWidth<=1&&r.offsetHeight>2&&!(f&&d<8))}var a=St?V("span","\u200B"):V("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return a.setAttribute("cm-text",""),a}var Pi;function yn(t){if(Pi!=null)return Pi;var r=z(t,document.createTextNode("A\u062EA")),a=Y(r,0,1).getBoundingClientRect(),s=Y(r,1,2).getBoundingClientRect();return te(t),!a||a.left==a.right?!1:Pi=s.right-a.right<3}var Oi=`
b`.split(/\n/).length!=3?function(t){for(var r=0,a=[],s=t.length;r<=s;){var u=t.indexOf(`
`,r);u==-1&&(u=t.length);var p=t.slice(r,t.charAt(u-1)=="\r"?u-1:u),h=p.indexOf("\r");h!=-1?(a.push(p.slice(0,h)),r+=h+1):(a.push(p),r=u+1)}return a}:function(t){return t.split(/\r\n?|\n/)},Yo=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch{return!1}}:function(t){var r;try{r=t.ownerDocument.selection.createRange()}catch{}return!r||r.parentElement()!=t?!1:r.compareEndPoints("StartToEnd",r)!=0},Qo=function(){var t=V("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),typeof t.oncopy=="function")}(),Ni=null;function Hn(t){if(Ni!=null)return Ni;var r=z(t,V("span","x")),a=r.getBoundingClientRect(),s=Y(r,0,1).getBoundingClientRect();return Ni=Math.abs(a.left-s.left)>1}var Xt={},Vt={};function Jo(t,r){arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),Xt[t]=r}function Sn(t,r){Vt[t]=r}function Nr(t){if(typeof t=="string"&&Vt.hasOwnProperty(t))t=Vt[t];else if(t&&typeof t.name=="string"&&Vt.hasOwnProperty(t.name)){var r=Vt[t.name];typeof r=="string"&&(r={name:r}),t=ot(r,t),t.name=r.name}else{if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Nr("application/xml");if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Nr("application/json")}return typeof t=="string"?{name:t}:t||{name:"null"}}function Br(t,r){r=Nr(r);var a=Xt[r.name];if(!a)return Br(t,"text/plain");var s=a(t,r);if(rn.hasOwnProperty(r.name)){var u=rn[r.name];for(var p in u)u.hasOwnProperty(p)&&(s.hasOwnProperty(p)&&(s["_"+p]=s[p]),s[p]=u[p])}if(s.name=r.name,r.helperType&&(s.helperType=r.helperType),r.modeProps)for(var h in r.modeProps)s[h]=r.modeProps[h];return s}var rn={};function on(t,r){var a=rn.hasOwnProperty(t)?rn[t]:rn[t]={};$e(r,a)}function $t(t,r){if(r===!0)return r;if(t.copyState)return t.copyState(r);var a={};for(var s in r){var u=r[s];u instanceof Array&&(u=u.concat([])),a[s]=u}return a}function Bi(t,r){for(var a;t.innerMode&&(a=t.innerMode(r),!(!a||a.mode==t));)r=a.state,t=a.mode;return a||{mode:t,state:r}}function Ii(t,r,a){return t.startState?t.startState(r,a):!0}var Je=function(t,r,a){this.pos=this.start=0,this.string=t,this.tabSize=r||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=a};Je.prototype.eol=function(){return this.pos>=this.string.length},Je.prototype.sol=function(){return this.pos==this.lineStart},Je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Je.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Je.prototype.eat=function(t){var r=this.string.charAt(this.pos),a;if(typeof t=="string"?a=r==t:a=r&&(t.test?t.test(r):t(r)),a)return++this.pos,r},Je.prototype.eatWhile=function(t){for(var r=this.pos;this.eat(t););return this.pos>r},Je.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Je.prototype.skipToEnd=function(){this.pos=this.string.length},Je.prototype.skipTo=function(t){var r=this.string.indexOf(t,this.pos);if(r>-1)return this.pos=r,!0},Je.prototype.backUp=function(t){this.pos-=t},Je.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ye(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Ye(this.string,this.lineStart,this.tabSize):0)},Je.prototype.indentation=function(){return Ye(this.string,null,this.tabSize)-(this.lineStart?Ye(this.string,this.lineStart,this.tabSize):0)},Je.prototype.match=function(t,r,a){if(typeof t=="string"){var s=function(h){return a?h.toLowerCase():h},u=this.string.substr(this.pos,t.length);if(s(u)==s(t))return r!==!1&&(this.pos+=t.length),!0}else{var p=this.string.slice(this.pos).match(t);return p&&p.index>0?null:(p&&r!==!1&&(this.pos+=p[0].length),p)}},Je.prototype.current=function(){return this.string.slice(this.start,this.pos)},Je.prototype.hideFirstChars=function(t,r){this.lineStart+=t;try{return r()}finally{this.lineStart-=t}},Je.prototype.lookAhead=function(t){var r=this.lineOracle;return r&&r.lookAhead(t)},Je.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};function he(t,r){if(r-=t.first,r<0||r>=t.size)throw new Error("There is no line "+(r+t.first)+" in the document.");for(var a=t;!a.lines;)for(var s=0;;++s){var u=a.children[s],p=u.chunkSize();if(r<p){a=u;break}r-=p}return a.lines[r]}function vn(t,r,a){var s=[],u=r.line;return t.iter(r.line,a.line+1,function(p){var h=p.text;u==a.line&&(h=h.slice(0,a.ch)),u==r.line&&(h=h.slice(r.ch)),s.push(h),++u}),s}function ji(t,r,a){var s=[];return t.iter(r,a,function(u){s.push(u.text)}),s}function It(t,r){var a=r-t.height;if(a)for(var s=t;s;s=s.parent)s.height+=a}function Ne(t){if(t.parent==null)return null;for(var r=t.parent,a=ge(r.lines,t),s=r.parent;s;r=s,s=s.parent)for(var u=0;s.children[u]!=r;++u)a+=s.children[u].chunkSize();return a+r.first}function bn(t,r){var a=t.first;e:do{for(var s=0;s<t.children.length;++s){var u=t.children[s],p=u.height;if(r<p){t=u;continue e}r-=p,a+=u.chunkSize()}return a}while(!t.lines);for(var h=0;h<t.lines.length;++h){var y=t.lines[h],b=y.height;if(r<b)break;r-=b}return a+h}function sr(t,r){return r>=t.first&&r<t.first+t.size}function Ri(t,r){return String(t.lineNumberFormatter(r+t.firstLineNumber))}function ee(t,r,a){if(a===void 0&&(a=null),!(this instanceof ee))return new ee(t,r,a);this.line=t,this.ch=r,this.sticky=a}function C(t,r){return t.line-r.line||t.ch-r.ch}function j(t,r){return t.sticky==r.sticky&&C(t,r)==0}function X(t){return ee(t.line,t.ch)}function ne(t,r){return C(t,r)<0?r:t}function ke(t,r){return C(t,r)<0?t:r}function Pe(t,r){return Math.max(t.first,Math.min(r,t.first+t.size-1))}function de(t,r){if(r.line<t.first)return ee(t.first,0);var a=t.first+t.size-1;return r.line>a?ee(a,he(t,a).text.length):mt(r,he(t,r.line).text.length)}function mt(t,r){var a=t.ch;return a==null||a>r?ee(t.line,r):a<0?ee(t.line,0):t}function Ut(t,r){for(var a=[],s=0;s<r.length;s++)a[s]=de(t,r[s]);return a}var Ir=function(t,r){this.state=t,this.lookAhead=r},wn=function(t,r,a,s){this.state=r,this.doc=t,this.line=a,this.maxLookAhead=s||0,this.baseTokens=null,this.baseTokenPos=1};wn.prototype.lookAhead=function(t){var r=this.doc.getLine(this.line+t);return r!=null&&t>this.maxLookAhead&&(this.maxLookAhead=t),r},wn.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var r=this.baseTokens[this.baseTokenPos+1];return{type:r&&r.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},wn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},wn.fromSaved=function(t,r,a){return r instanceof Ir?new wn(t,$t(t.mode,r.state),a,r.lookAhead):new wn(t,$t(t.mode,r),a)},wn.prototype.save=function(t){var r=t!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ir(r,this.maxLookAhead):r};function $c(t,r,a,s){var u=[t.state.modeGen],p={};Jc(t,r.text,t.doc.mode,a,function(w,O){return u.push(w,O)},p,s);for(var h=a.state,y=function(w){a.baseTokens=u;var O=t.state.overlays[w],I=1,q=0;a.state=!0,Jc(t,r.text,O.mode,a,function(H,Q){for(var Z=I;q<H;){var re=u[I];re>H&&u.splice(I,1,H,u[I+1],re),I+=2,q=Math.min(H,re)}if(Q)if(O.opaque)u.splice(Z,I-Z,H,"overlay "+Q),I=Z+2;else for(;Z<I;Z+=2){var ue=u[Z+1];u[Z+1]=(ue?ue+" ":"")+"overlay "+Q}},p),a.state=h,a.baseTokens=null,a.baseTokenPos=1},b=0;b<t.state.overlays.length;++b)y(b);return{styles:u,classes:p.bgClass||p.textClass?p:null}}function Uc(t,r,a){if(!r.styles||r.styles[0]!=t.state.modeGen){var s=Hi(t,Ne(r)),u=r.text.length>t.options.maxHighlightLength&&$t(t.doc.mode,s.state),p=$c(t,r,s);u&&(s.state=u),r.stateAfter=s.save(!u),r.styles=p.styles,p.classes?r.styleClasses=p.classes:r.styleClasses&&(r.styleClasses=null),a===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return r.styles}function Hi(t,r,a){var s=t.doc,u=t.display;if(!s.mode.startState)return new wn(s,!0,r);var p=wv(t,r,a),h=p>s.first&&he(s,p-1).stateAfter,y=h?wn.fromSaved(s,h,p):new wn(s,Ii(s.mode),p);return s.iter(p,r,function(b){Ha(t,b.text,y);var w=y.line;b.stateAfter=w==r-1||w%5==0||w>=u.viewFrom&&w<u.viewTo?y.save():null,y.nextLine()}),a&&(s.modeFrontier=y.line),y}function Ha(t,r,a,s){var u=t.doc.mode,p=new Je(r,t.options.tabSize,a);for(p.start=p.pos=s||0,r==""&&Gc(u,a.state);!p.eol();)za(u,p,a.state),p.start=p.pos}function Gc(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var a=Bi(t,r);if(a.mode.blankLine)return a.mode.blankLine(a.state)}}function za(t,r,a,s){for(var u=0;u<10;u++){s&&(s[0]=Bi(t,a).mode);var p=t.token(r,a);if(r.pos>r.start)return p}throw new Error("Mode "+t.name+" failed to advance stream.")}var Kc=function(t,r,a){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=r||null,this.state=a};function Yc(t,r,a,s){var u=t.doc,p=u.mode,h;r=de(u,r);var y=he(u,r.line),b=Hi(t,r.line,a),w=new Je(y.text,t.options.tabSize,b),O;for(s&&(O=[]);(s||w.pos<r.ch)&&!w.eol();)w.start=w.pos,h=za(p,w,b.state),s&&O.push(new Kc(w,h,$t(u.mode,b.state)));return s?O:new Kc(w,h,b.state)}function Qc(t,r){if(t)for(;;){var a=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!a)break;t=t.slice(0,a.index)+t.slice(a.index+a[0].length);var s=a[1]?"bgClass":"textClass";r[s]==null?r[s]=a[2]:new RegExp("(?:^|\\s)"+a[2]+"(?:$|\\s)").test(r[s])||(r[s]+=" "+a[2])}return t}function Jc(t,r,a,s,u,p,h){var y=a.flattenSpans;y==null&&(y=t.options.flattenSpans);var b=0,w=null,O=new Je(r,t.options.tabSize,s),I,q=t.options.addModeClass&&[null];for(r==""&&Qc(Gc(a,s.state),p);!O.eol();){if(O.pos>t.options.maxHighlightLength?(y=!1,h&&Ha(t,r,s,O.pos),O.pos=r.length,I=null):I=Qc(za(a,O,s.state,q),p),q){var H=q[0].name;H&&(I="m-"+(I?H+" "+I:H))}if(!y||w!=I){for(;b<O.start;)b=Math.min(O.start,b+5e3),u(b,w);w=I}O.start=O.pos}for(;b<O.pos;){var Q=Math.min(O.pos,b+5e3);u(Q,w),b=Q}}function wv(t,r,a){for(var s,u,p=t.doc,h=a?-1:r-(t.doc.mode.innerMode?1e3:100),y=r;y>h;--y){if(y<=p.first)return p.first;var b=he(p,y-1),w=b.stateAfter;if(w&&(!a||y+(w instanceof Ir?w.lookAhead:0)<=p.modeFrontier))return y;var O=Ye(b.text,null,t.options.tabSize);(u==null||s>O)&&(u=y-1,s=O)}return u}function xv(t,r){if(t.modeFrontier=Math.min(t.modeFrontier,r),!(t.highlightFrontier<r-10)){for(var a=t.first,s=r-1;s>a;s--){var u=he(t,s).stateAfter;if(u&&(!(u instanceof Ir)||s+u.lookAhead<r)){a=s+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,a)}}var Xc=!1,En=!1;function kv(){Xc=!0}function Cv(){En=!0}function Xo(t,r,a){this.marker=t,this.from=r,this.to=a}function zi(t,r){if(t)for(var a=0;a<t.length;++a){var s=t[a];if(s.marker==r)return s}}function Dv(t,r){for(var a,s=0;s<t.length;++s)t[s]!=r&&(a||(a=[])).push(t[s]);return a}function Av(t,r,a){var s=a&&window.WeakSet&&(a.markedSpans||(a.markedSpans=new WeakSet));s&&s.has(t.markedSpans)?t.markedSpans.push(r):(t.markedSpans=t.markedSpans?t.markedSpans.concat([r]):[r],s&&s.add(t.markedSpans)),r.marker.attachLine(t)}function Sv(t,r,a){var s;if(t)for(var u=0;u<t.length;++u){var p=t[u],h=p.marker,y=p.from==null||(h.inclusiveLeft?p.from<=r:p.from<r);if(y||p.from==r&&h.type=="bookmark"&&(!a||!p.marker.insertLeft)){var b=p.to==null||(h.inclusiveRight?p.to>=r:p.to>r);(s||(s=[])).push(new Xo(h,p.from,b?null:p.to))}}return s}function Ev(t,r,a){var s;if(t)for(var u=0;u<t.length;++u){var p=t[u],h=p.marker,y=p.to==null||(h.inclusiveRight?p.to>=r:p.to>r);if(y||p.from==r&&h.type=="bookmark"&&(!a||p.marker.insertLeft)){var b=p.from==null||(h.inclusiveLeft?p.from<=r:p.from<r);(s||(s=[])).push(new Xo(h,b?null:p.from-r,p.to==null?null:p.to-r))}}return s}function qa(t,r){if(r.full)return null;var a=sr(t,r.from.line)&&he(t,r.from.line).markedSpans,s=sr(t,r.to.line)&&he(t,r.to.line).markedSpans;if(!a&&!s)return null;var u=r.from.ch,p=r.to.ch,h=C(r.from,r.to)==0,y=Sv(a,u,h),b=Ev(s,p,h),w=r.text.length==1,O=be(r.text).length+(w?u:0);if(y)for(var I=0;I<y.length;++I){var q=y[I];if(q.to==null){var H=zi(b,q.marker);H?w&&(q.to=H.to==null?null:H.to+O):q.to=u}}if(b)for(var Q=0;Q<b.length;++Q){var Z=b[Q];if(Z.to!=null&&(Z.to+=O),Z.from==null){var re=zi(y,Z.marker);re||(Z.from=O,w&&(y||(y=[])).push(Z))}else Z.from+=O,w&&(y||(y=[])).push(Z)}y&&(y=Zc(y)),b&&b!=y&&(b=Zc(b));var ue=[y];if(!w){var fe=r.text.length-2,ce;if(fe>0&&y)for(var pe=0;pe<y.length;++pe)y[pe].to==null&&(ce||(ce=[])).push(new Xo(y[pe].marker,null,null));for(var ye=0;ye<fe;++ye)ue.push(ce);ue.push(b)}return ue}function Zc(t){for(var r=0;r<t.length;++r){var a=t[r];a.from!=null&&a.from==a.to&&a.marker.clearWhenEmpty!==!1&&t.splice(r--,1)}return t.length?t:null}function Tv(t,r,a){var s=null;if(t.iter(r.line,a.line+1,function(H){if(H.markedSpans)for(var Q=0;Q<H.markedSpans.length;++Q){var Z=H.markedSpans[Q].marker;Z.readOnly&&(!s||ge(s,Z)==-1)&&(s||(s=[])).push(Z)}}),!s)return null;for(var u=[{from:r,to:a}],p=0;p<s.length;++p)for(var h=s[p],y=h.find(0),b=0;b<u.length;++b){var w=u[b];if(!(C(w.to,y.from)<0||C(w.from,y.to)>0)){var O=[b,1],I=C(w.from,y.from),q=C(w.to,y.to);(I<0||!h.inclusiveLeft&&!I)&&O.push({from:w.from,to:y.from}),(q>0||!h.inclusiveRight&&!q)&&O.push({from:y.to,to:w.to}),u.splice.apply(u,O),b+=O.length-3}}return u}function ef(t){var r=t.markedSpans;if(r){for(var a=0;a<r.length;++a)r[a].marker.detachLine(t);t.markedSpans=null}}function tf(t,r){if(r){for(var a=0;a<r.length;++a)r[a].marker.attachLine(t);t.markedSpans=r}}function Zo(t){return t.inclusiveLeft?-1:0}function es(t){return t.inclusiveRight?1:0}function _a(t,r){var a=t.lines.length-r.lines.length;if(a!=0)return a;var s=t.find(),u=r.find(),p=C(s.from,u.from)||Zo(t)-Zo(r);if(p)return-p;var h=C(s.to,u.to)||es(t)-es(r);return h||r.id-t.id}function nf(t,r){var a=En&&t.markedSpans,s;if(a)for(var u=void 0,p=0;p<a.length;++p)u=a[p],u.marker.collapsed&&(r?u.from:u.to)==null&&(!s||_a(s,u.marker)<0)&&(s=u.marker);return s}function rf(t){return nf(t,!0)}function ts(t){return nf(t,!1)}function Mv(t,r){var a=En&&t.markedSpans,s;if(a)for(var u=0;u<a.length;++u){var p=a[u];p.marker.collapsed&&(p.from==null||p.from<r)&&(p.to==null||p.to>r)&&(!s||_a(s,p.marker)<0)&&(s=p.marker)}return s}function of(t,r,a,s,u){var p=he(t,r),h=En&&p.markedSpans;if(h)for(var y=0;y<h.length;++y){var b=h[y];if(b.marker.collapsed){var w=b.marker.find(0),O=C(w.from,a)||Zo(b.marker)-Zo(u),I=C(w.to,s)||es(b.marker)-es(u);if(!(O>=0&&I<=0||O<=0&&I>=0)&&(O<=0&&(b.marker.inclusiveRight&&u.inclusiveLeft?C(w.to,a)>=0:C(w.to,a)>0)||O>=0&&(b.marker.inclusiveRight&&u.inclusiveLeft?C(w.from,s)<=0:C(w.from,s)<0)))return!0}}}function sn(t){for(var r;r=rf(t);)t=r.find(-1,!0).line;return t}function Lv(t){for(var r;r=ts(t);)t=r.find(1,!0).line;return t}function Fv(t){for(var r,a;r=ts(t);)t=r.find(1,!0).line,(a||(a=[])).push(t);return a}function Wa(t,r){var a=he(t,r),s=sn(a);return a==s?r:Ne(s)}function sf(t,r){if(r>t.lastLine())return r;var a=he(t,r),s;if(!zn(t,a))return r;for(;s=ts(a);)a=s.find(1,!0).line;return Ne(a)+1}function zn(t,r){var a=En&&r.markedSpans;if(a){for(var s=void 0,u=0;u<a.length;++u)if(s=a[u],!!s.marker.collapsed){if(s.from==null)return!0;if(!s.marker.widgetNode&&s.from==0&&s.marker.inclusiveLeft&&Va(t,r,s))return!0}}}function Va(t,r,a){if(a.to==null){var s=a.marker.find(1,!0);return Va(t,s.line,zi(s.line.markedSpans,a.marker))}if(a.marker.inclusiveRight&&a.to==r.text.length)return!0;for(var u=void 0,p=0;p<r.markedSpans.length;++p)if(u=r.markedSpans[p],u.marker.collapsed&&!u.marker.widgetNode&&u.from==a.to&&(u.to==null||u.to!=a.from)&&(u.marker.inclusiveLeft||a.marker.inclusiveRight)&&Va(t,r,u))return!0}function Tn(t){t=sn(t);for(var r=0,a=t.parent,s=0;s<a.lines.length;++s){var u=a.lines[s];if(u==t)break;r+=u.height}for(var p=a.parent;p;a=p,p=a.parent)for(var h=0;h<p.children.length;++h){var y=p.children[h];if(y==a)break;r+=y.height}return r}function ns(t){if(t.height==0)return 0;for(var r=t.text.length,a,s=t;a=rf(s);){var u=a.find(0,!0);s=u.from.line,r+=u.from.ch-u.to.ch}for(s=t;a=ts(s);){var p=a.find(0,!0);r-=s.text.length-p.from.ch,s=p.to.line,r+=s.text.length-p.to.ch}return r}function $a(t){var r=t.display,a=t.doc;r.maxLine=he(a,a.first),r.maxLineLength=ns(r.maxLine),r.maxLineChanged=!0,a.iter(function(s){var u=ns(s);u>r.maxLineLength&&(r.maxLineLength=u,r.maxLine=s)})}var jr=function(t,r,a){this.text=t,tf(this,r),this.height=a?a(this):1};jr.prototype.lineNo=function(){return Ne(this)},mn(jr);function Pv(t,r,a,s){t.text=r,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),t.order!=null&&(t.order=null),ef(t),tf(t,a);var u=s?s(t):1;u!=t.height&&It(t,u)}function Ov(t){t.parent=null,ef(t)}var Nv={},Bv={};function af(t,r){if(!t||/^\s*$/.test(t))return null;var a=r.addModeClass?Bv:Nv;return a[t]||(a[t]=t.replace(/\S+/g,"cm-$&"))}function lf(t,r){var a=E("span",null,null,g?"padding-right: .1px":null),s={pre:E("pre",[a],"CodeMirror-line"),content:a,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};r.measure={};for(var u=0;u<=(r.rest?r.rest.length:0);u++){var p=u?r.rest[u-1]:r.line,h=void 0;s.pos=0,s.addToken=jv,yn(t.display.measure)&&(h=Bt(p,t.doc.direction))&&(s.addToken=Hv(s.addToken,h)),s.map=[];var y=r!=t.display.externalMeasured&&Ne(p);zv(p,s,Uc(t,p,y)),p.styleClasses&&(p.styleClasses.bgClass&&(s.bgClass=Oe(p.styleClasses.bgClass,s.bgClass||"")),p.styleClasses.textClass&&(s.textClass=Oe(p.styleClasses.textClass,s.textClass||""))),s.map.length==0&&s.map.push(0,0,s.content.appendChild(Ko(t.display.measure))),u==0?(r.measure.map=s.map,r.measure.cache={}):((r.measure.maps||(r.measure.maps=[])).push(s.map),(r.measure.caches||(r.measure.caches=[])).push({}))}if(g){var b=s.content.lastChild;(/\bcm-tab\b/.test(b.className)||b.querySelector&&b.querySelector(".cm-tab"))&&(s.content.className="cm-tab-wrap-hack")}return xe(t,"renderLine",t,r.line,s.pre),s.pre.className&&(s.textClass=Oe(s.pre.className,s.textClass||"")),s}function Iv(t){var r=V("span","\u2022","cm-invalidchar");return r.title="\\u"+t.charCodeAt(0).toString(16),r.setAttribute("aria-label",r.title),r}function jv(t,r,a,s,u,p,h){if(r){var y=t.splitSpaces?Rv(r,t.trailingSpace):r,b=t.cm.state.specialChars,w=!1,O;if(!b.test(r))t.col+=r.length,O=document.createTextNode(y),t.map.push(t.pos,t.pos+r.length,O),f&&d<9&&(w=!0),t.pos+=r.length;else{O=document.createDocumentFragment();for(var I=0;;){b.lastIndex=I;var q=b.exec(r),H=q?q.index-I:r.length-I;if(H){var Q=document.createTextNode(y.slice(I,I+H));f&&d<9?O.appendChild(V("span",[Q])):O.appendChild(Q),t.map.push(t.pos,t.pos+H,Q),t.col+=H,t.pos+=H}if(!q)break;I+=H+1;var Z=void 0;if(q[0]==" "){var re=t.cm.options.tabSize,ue=re-t.col%re;Z=O.appendChild(V("span",Ae(ue),"cm-tab")),Z.setAttribute("role","presentation"),Z.setAttribute("cm-text"," "),t.col+=ue}else q[0]=="\r"||q[0]==`
`?(Z=O.appendChild(V("span",q[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Z.setAttribute("cm-text",q[0]),t.col+=1):(Z=t.cm.options.specialCharPlaceholder(q[0]),Z.setAttribute("cm-text",q[0]),f&&d<9?O.appendChild(V("span",[Z])):O.appendChild(Z),t.col+=1);t.map.push(t.pos,t.pos+1,Z),t.pos++}}if(t.trailingSpace=y.charCodeAt(r.length-1)==32,a||s||u||w||p||h){var fe=a||"";s&&(fe+=s),u&&(fe+=u);var ce=V("span",[O],fe,p);if(h)for(var pe in h)h.hasOwnProperty(pe)&&pe!="style"&&pe!="class"&&ce.setAttribute(pe,h[pe]);return t.content.appendChild(ce)}t.content.appendChild(O)}}function Rv(t,r){if(t.length>1&&!/ /.test(t))return t;for(var a=r,s="",u=0;u<t.length;u++){var p=t.charAt(u);p==" "&&a&&(u==t.length-1||t.charCodeAt(u+1)==32)&&(p="\xA0"),s+=p,a=p==" "}return s}function Hv(t,r){return function(a,s,u,p,h,y,b){u=u?u+" cm-force-border":"cm-force-border";for(var w=a.pos,O=w+s.length;;){for(var I=void 0,q=0;q<r.length&&(I=r[q],!(I.to>w&&I.from<=w));q++);if(I.to>=O)return t(a,s,u,p,h,y,b);t(a,s.slice(0,I.to-w),u,p,null,y,b),p=null,s=s.slice(I.to-w),w=I.to}}}function uf(t,r,a,s){var u=!s&&a.widgetNode;u&&t.map.push(t.pos,t.pos+r,u),!s&&t.cm.display.input.needsContentAttribute&&(u||(u=t.content.appendChild(document.createElement("span"))),u.setAttribute("cm-marker",a.id)),u&&(t.cm.display.input.setUneditable(u),t.content.appendChild(u)),t.pos+=r,t.trailingSpace=!1}function zv(t,r,a){var s=t.markedSpans,u=t.text,p=0;if(!s){for(var h=1;h<a.length;h+=2)r.addToken(r,u.slice(p,p=a[h]),af(a[h+1],r.cm.options));return}for(var y=u.length,b=0,w=1,O="",I,q,H=0,Q,Z,re,ue,fe;;){if(H==b){Q=Z=re=q="",fe=null,ue=null,H=1/0;for(var ce=[],pe=void 0,ye=0;ye<s.length;++ye){var me=s[ye],Te=me.marker;if(Te.type=="bookmark"&&me.from==b&&Te.widgetNode)ce.push(Te);else if(me.from<=b&&(me.to==null||me.to>b||Te.collapsed&&me.to==b&&me.from==b)){if(me.to!=null&&me.to!=b&&H>me.to&&(H=me.to,Z=""),Te.className&&(Q+=" "+Te.className),Te.css&&(q=(q?q+";":"")+Te.css),Te.startStyle&&me.from==b&&(re+=" "+Te.startStyle),Te.endStyle&&me.to==H&&(pe||(pe=[])).push(Te.endStyle,me.to),Te.title&&((fe||(fe={})).title=Te.title),Te.attributes)for(var qe in Te.attributes)(fe||(fe={}))[qe]=Te.attributes[qe];Te.collapsed&&(!ue||_a(ue.marker,Te)<0)&&(ue=me)}else me.from>b&&H>me.from&&(H=me.from)}if(pe)for(var ut=0;ut<pe.length;ut+=2)pe[ut+1]==H&&(Z+=" "+pe[ut]);if(!ue||ue.from==b)for(var Ke=0;Ke<ce.length;++Ke)uf(r,0,ce[Ke]);if(ue&&(ue.from||0)==b){if(uf(r,(ue.to==null?y+1:ue.to)-b,ue.marker,ue.from==null),ue.to==null)return;ue.to==b&&(ue=!1)}}if(b>=y)break;for(var Rt=Math.min(y,H);;){if(O){var Mt=b+O.length;if(!ue){var tt=Mt>Rt?O.slice(0,Rt-b):O;r.addToken(r,tt,I?I+Q:Q,re,b+tt.length==H?Z:"",q,fe)}if(Mt>=Rt){O=O.slice(Rt-b),b=Rt;break}b=Mt,re=""}O=u.slice(p,p=a[w++]),I=af(a[w++],r.cm.options)}}}function cf(t,r,a){this.line=r,this.rest=Fv(r),this.size=this.rest?Ne(be(this.rest))-a+1:1,this.node=this.text=null,this.hidden=zn(t,r)}function rs(t,r,a){for(var s=[],u,p=r;p<a;p=u){var h=new cf(t.doc,he(t.doc,p),p);u=p+h.size,s.push(h)}return s}var Rr=null;function qv(t){Rr?Rr.ops.push(t):t.ownsGroup=Rr={ops:[t],delayedCallbacks:[]}}function _v(t){var r=t.delayedCallbacks,a=0;do{for(;a<r.length;a++)r[a].call(null);for(var s=0;s<t.ops.length;s++){var u=t.ops[s];if(u.cursorActivityHandlers)for(;u.cursorActivityCalled<u.cursorActivityHandlers.length;)u.cursorActivityHandlers[u.cursorActivityCalled++].call(null,u.cm)}}while(a<r.length)}function Wv(t,r){var a=t.ownsGroup;if(a)try{_v(a)}finally{Rr=null,r(a)}}var qi=null;function st(t,r){var a=Fr(t,r);if(a.length){var s=Array.prototype.slice.call(arguments,2),u;Rr?u=Rr.delayedCallbacks:qi?u=qi:(u=qi=[],setTimeout(Vv,0));for(var p=function(y){u.push(function(){return a[y].apply(null,s)})},h=0;h<a.length;++h)p(h)}}function Vv(){var t=qi;qi=null;for(var r=0;r<t.length;++r)t[r]()}function ff(t,r,a,s){for(var u=0;u<r.changes.length;u++){var p=r.changes[u];p=="text"?Uv(t,r):p=="gutter"?pf(t,r,a,s):p=="class"?Ua(t,r):p=="widget"&&Gv(t,r,s)}r.changes=null}function _i(t){return t.node==t.text&&(t.node=V("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),f&&d<8&&(t.node.style.zIndex=2)),t.node}function $v(t,r){var a=r.bgClass?r.bgClass+" "+(r.line.bgClass||""):r.line.bgClass;if(a&&(a+=" CodeMirror-linebackground"),r.background)a?r.background.className=a:(r.background.parentNode.removeChild(r.background),r.background=null);else if(a){var s=_i(r);r.background=s.insertBefore(V("div",null,a),s.firstChild),t.display.input.setUneditable(r.background)}}function df(t,r){var a=t.display.externalMeasured;return a&&a.line==r.line?(t.display.externalMeasured=null,r.measure=a.measure,a.built):lf(t,r)}function Uv(t,r){var a=r.text.className,s=df(t,r);r.text==r.node&&(r.node=s.pre),r.text.parentNode.replaceChild(s.pre,r.text),r.text=s.pre,s.bgClass!=r.bgClass||s.textClass!=r.textClass?(r.bgClass=s.bgClass,r.textClass=s.textClass,Ua(t,r)):a&&(r.text.className=a)}function Ua(t,r){$v(t,r),r.line.wrapClass?_i(r).className=r.line.wrapClass:r.node!=r.text&&(r.node.className="");var a=r.textClass?r.textClass+" "+(r.line.textClass||""):r.line.textClass;r.text.className=a||""}function pf(t,r,a,s){if(r.gutter&&(r.node.removeChild(r.gutter),r.gutter=null),r.gutterBackground&&(r.node.removeChild(r.gutterBackground),r.gutterBackground=null),r.line.gutterClass){var u=_i(r);r.gutterBackground=V("div",null,"CodeMirror-gutter-background "+r.line.gutterClass,"left: "+(t.options.fixedGutter?s.fixedPos:-s.gutterTotalWidth)+"px; width: "+s.gutterTotalWidth+"px"),t.display.input.setUneditable(r.gutterBackground),u.insertBefore(r.gutterBackground,r.text)}var p=r.line.gutterMarkers;if(t.options.lineNumbers||p){var h=_i(r),y=r.gutter=V("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?s.fixedPos:-s.gutterTotalWidth)+"px");if(y.setAttribute("aria-hidden","true"),t.display.input.setUneditable(y),h.insertBefore(y,r.text),r.line.gutterClass&&(y.className+=" "+r.line.gutterClass),t.options.lineNumbers&&(!p||!p["CodeMirror-linenumbers"])&&(r.lineNumber=y.appendChild(V("div",Ri(t.options,a),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+s.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),p)for(var b=0;b<t.display.gutterSpecs.length;++b){var w=t.display.gutterSpecs[b].className,O=p.hasOwnProperty(w)&&p[w];O&&y.appendChild(V("div",[O],"CodeMirror-gutter-elt","left: "+s.gutterLeft[w]+"px; width: "+s.gutterWidth[w]+"px"))}}}function Gv(t,r,a){r.alignable&&(r.alignable=null);for(var s=$("CodeMirror-linewidget"),u=r.node.firstChild,p=void 0;u;u=p)p=u.nextSibling,s.test(u.className)&&r.node.removeChild(u);hf(t,r,a)}function Kv(t,r,a,s){var u=df(t,r);return r.text=r.node=u.pre,u.bgClass&&(r.bgClass=u.bgClass),u.textClass&&(r.textClass=u.textClass),Ua(t,r),pf(t,r,a,s),hf(t,r,s),r.node}function hf(t,r,a){if(gf(t,r.line,r,a,!0),r.rest)for(var s=0;s<r.rest.length;s++)gf(t,r.rest[s],r,a,!1)}function gf(t,r,a,s,u){if(r.widgets)for(var p=_i(a),h=0,y=r.widgets;h<y.length;++h){var b=y[h],w=V("div",[b.node],"CodeMirror-linewidget"+(b.className?" "+b.className:""));b.handleMouseEvents||w.setAttribute("cm-ignore-events","true"),Yv(b,w,a,s),t.display.input.setUneditable(w),u&&b.above?p.insertBefore(w,a.gutter||a.text):p.appendChild(w),st(b,"redraw")}}function Yv(t,r,a,s){if(t.noHScroll){(a.alignable||(a.alignable=[])).push(r);var u=s.wrapperWidth;r.style.left=s.fixedPos+"px",t.coverGutter||(u-=s.gutterTotalWidth,r.style.paddingLeft=s.gutterTotalWidth+"px"),r.style.width=u+"px"}t.coverGutter&&(r.style.zIndex=5,r.style.position="relative",t.noHScroll||(r.style.marginLeft=-s.gutterTotalWidth+"px"))}function Wi(t){if(t.height!=null)return t.height;var r=t.doc.cm;if(!r)return 0;if(!U(document.body,t.node)){var a="position: relative;";t.coverGutter&&(a+="margin-left: -"+r.display.gutters.offsetWidth+"px;"),t.noHScroll&&(a+="width: "+r.display.wrapper.clientWidth+"px;"),z(r.display.measure,V("div",[t.node],null,a))}return t.height=t.node.parentNode.offsetHeight}function Mn(t,r){for(var a=Rn(r);a!=t.wrapper;a=a.parentNode)if(!a||a.nodeType==1&&a.getAttribute("cm-ignore-events")=="true"||a.parentNode==t.sizer&&a!=t.mover)return!0}function is(t){return t.lineSpace.offsetTop}function Ga(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function mf(t){if(t.cachedPaddingH)return t.cachedPaddingH;var r=z(t.measure,V("pre","x","CodeMirror-line-like")),a=window.getComputedStyle?window.getComputedStyle(r):r.currentStyle,s={left:parseInt(a.paddingLeft),right:parseInt(a.paddingRight)};return!isNaN(s.left)&&!isNaN(s.right)&&(t.cachedPaddingH=s),s}function xn(t){return we-t.display.nativeBarWidth}function ar(t){return t.display.scroller.clientWidth-xn(t)-t.display.barWidth}function Ka(t){return t.display.scroller.clientHeight-xn(t)-t.display.barHeight}function Qv(t,r,a){var s=t.options.lineWrapping,u=s&&ar(t);if(!r.measure.heights||s&&r.measure.width!=u){var p=r.measure.heights=[];if(s){r.measure.width=u;for(var h=r.text.firstChild.getClientRects(),y=0;y<h.length-1;y++){var b=h[y],w=h[y+1];Math.abs(b.bottom-w.bottom)>2&&p.push((b.bottom+w.top)/2-a.top)}}p.push(a.bottom-a.top)}}function yf(t,r,a){if(t.line==r)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var s=0;s<t.rest.length;s++)if(t.rest[s]==r)return{map:t.measure.maps[s],cache:t.measure.caches[s]};for(var u=0;u<t.rest.length;u++)if(Ne(t.rest[u])>a)return{map:t.measure.maps[u],cache:t.measure.caches[u],before:!0}}}function Jv(t,r){r=sn(r);var a=Ne(r),s=t.display.externalMeasured=new cf(t.doc,r,a);s.lineN=a;var u=s.built=lf(t,s);return s.text=u.pre,z(t.display.lineMeasure,u.pre),s}function vf(t,r,a,s){return kn(t,Hr(t,r),a,s)}function Ya(t,r){if(r>=t.display.viewFrom&&r<t.display.viewTo)return t.display.view[cr(t,r)];var a=t.display.externalMeasured;if(a&&r>=a.lineN&&r<a.lineN+a.size)return a}function Hr(t,r){var a=Ne(r),s=Ya(t,a);s&&!s.text?s=null:s&&s.changes&&(ff(t,s,a,el(t)),t.curOp.forceUpdate=!0),s||(s=Jv(t,r));var u=yf(s,r,a);return{line:r,view:s,rect:null,map:u.map,cache:u.cache,before:u.before,hasHeights:!1}}function kn(t,r,a,s,u){r.before&&(a=-1);var p=a+(s||""),h;return r.cache.hasOwnProperty(p)?h=r.cache[p]:(r.rect||(r.rect=r.view.text.getBoundingClientRect()),r.hasHeights||(Qv(t,r.view,r.rect),r.hasHeights=!0),h=Zv(t,r,a,s),h.bogus||(r.cache[p]=h)),{left:h.left,right:h.right,top:u?h.rtop:h.top,bottom:u?h.rbottom:h.bottom}}var bf={left:0,right:0,top:0,bottom:0};function wf(t,r,a){for(var s,u,p,h,y,b,w=0;w<t.length;w+=3)if(y=t[w],b=t[w+1],r<y?(u=0,p=1,h="left"):r<b?(u=r-y,p=u+1):(w==t.length-3||r==b&&t[w+3]>r)&&(p=b-y,u=p-1,r>=b&&(h="right")),u!=null){if(s=t[w+2],y==b&&a==(s.insertLeft?"left":"right")&&(h=a),a=="left"&&u==0)for(;w&&t[w-2]==t[w-3]&&t[w-1].insertLeft;)s=t[(w-=3)+2],h="left";if(a=="right"&&u==b-y)for(;w<t.length-3&&t[w+3]==t[w+4]&&!t[w+5].insertLeft;)s=t[(w+=3)+2],h="right";break}return{node:s,start:u,end:p,collapse:h,coverStart:y,coverEnd:b}}function Xv(t,r){var a=bf;if(r=="left")for(var s=0;s<t.length&&(a=t[s]).left==a.right;s++);else for(var u=t.length-1;u>=0&&(a=t[u]).left==a.right;u--);return a}function Zv(t,r,a,s){var u=wf(r.map,a,s),p=u.node,h=u.start,y=u.end,b=u.collapse,w;if(p.nodeType==3){for(var O=0;O<4;O++){for(;h&&Le(r.line.text.charAt(u.coverStart+h));)--h;for(;u.coverStart+y<u.coverEnd&&Le(r.line.text.charAt(u.coverStart+y));)++y;if(f&&d<9&&h==0&&y==u.coverEnd-u.coverStart?w=p.parentNode.getBoundingClientRect():w=Xv(Y(p,h,y).getClientRects(),s),w.left||w.right||h==0)break;y=h,h=h-1,b="right"}f&&d<11&&(w=eb(t.display.measure,w))}else{h>0&&(b=s="right");var I;t.options.lineWrapping&&(I=p.getClientRects()).length>1?w=I[s=="right"?I.length-1:0]:w=p.getBoundingClientRect()}if(f&&d<9&&!h&&(!w||!w.left&&!w.right)){var q=p.parentNode.getClientRects()[0];q?w={left:q.left,right:q.left+qr(t.display),top:q.top,bottom:q.bottom}:w=bf}for(var H=w.top-r.rect.top,Q=w.bottom-r.rect.top,Z=(H+Q)/2,re=r.view.measure.heights,ue=0;ue<re.length-1&&!(Z<re[ue]);ue++);var fe=ue?re[ue-1]:0,ce=re[ue],pe={left:(b=="right"?w.right:w.left)-r.rect.left,right:(b=="left"?w.left:w.right)-r.rect.left,top:fe,bottom:ce};return!w.left&&!w.right&&(pe.bogus=!0),t.options.singleCursorHeightPerLine||(pe.rtop=H,pe.rbottom=Q),pe}function eb(t,r){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Hn(t))return r;var a=screen.logicalXDPI/screen.deviceXDPI,s=screen.logicalYDPI/screen.deviceYDPI;return{left:r.left*a,right:r.right*a,top:r.top*s,bottom:r.bottom*s}}function xf(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var r=0;r<t.rest.length;r++)t.measure.caches[r]={}}function kf(t){t.display.externalMeasure=null,te(t.display.lineMeasure);for(var r=0;r<t.display.view.length;r++)xf(t.display.view[r])}function Vi(t){kf(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Cf(){return v&&P?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Df(){return v&&P?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Qa(t){var r=sn(t),a=r.widgets,s=0;if(a)for(var u=0;u<a.length;++u)a[u].above&&(s+=Wi(a[u]));return s}function os(t,r,a,s,u){if(!u){var p=Qa(r);a.top+=p,a.bottom+=p}if(s=="line")return a;s||(s="local");var h=Tn(r);if(s=="local"?h+=is(t.display):h-=t.display.viewOffset,s=="page"||s=="window"){var y=t.display.lineSpace.getBoundingClientRect();h+=y.top+(s=="window"?0:Df());var b=y.left+(s=="window"?0:Cf());a.left+=b,a.right+=b}return a.top+=h,a.bottom+=h,a}function Af(t,r,a){if(a=="div")return r;var s=r.left,u=r.top;if(a=="page")s-=Cf(),u-=Df();else if(a=="local"||!a){var p=t.display.sizer.getBoundingClientRect();s+=p.left,u+=p.top}var h=t.display.lineSpace.getBoundingClientRect();return{left:s-h.left,top:u-h.top}}function ss(t,r,a,s,u){return s||(s=he(t.doc,r.line)),os(t,s,vf(t,s,r.ch,u),a)}function an(t,r,a,s,u,p){s=s||he(t.doc,r.line),u||(u=Hr(t,s));function h(Q,Z){var re=kn(t,u,Q,Z?"right":"left",p);return Z?re.left=re.right:re.right=re.left,os(t,s,re,a)}var y=Bt(s,t.doc.direction),b=r.ch,w=r.sticky;if(b>=s.text.length?(b=s.text.length,w="before"):b<=0&&(b=0,w="after"),!y)return h(w=="before"?b-1:b,w=="before");function O(Q,Z,re){var ue=y[Z],fe=ue.level==1;return h(re?Q-1:Q,fe!=re)}var I=Qe(y,b,w),q=_t,H=O(b,I,w=="before");return q!=null&&(H.other=O(b,q,w!="before")),H}function Sf(t,r){var a=0;r=de(t.doc,r),t.options.lineWrapping||(a=qr(t.display)*r.ch);var s=he(t.doc,r.line),u=Tn(s)+is(t.display);return{left:a,right:a,top:u,bottom:u+s.height}}function Ja(t,r,a,s,u){var p=ee(t,r,a);return p.xRel=u,s&&(p.outside=s),p}function Xa(t,r,a){var s=t.doc;if(a+=t.display.viewOffset,a<0)return Ja(s.first,0,null,-1,-1);var u=bn(s,a),p=s.first+s.size-1;if(u>p)return Ja(s.first+s.size-1,he(s,p).text.length,null,1,1);r<0&&(r=0);for(var h=he(s,u);;){var y=tb(t,h,u,r,a),b=Mv(h,y.ch+(y.xRel>0||y.outside>0?1:0));if(!b)return y;var w=b.find(1);if(w.line==u)return w;h=he(s,u=w.line)}}function Ef(t,r,a,s){s-=Qa(r);var u=r.text.length,p=gn(function(h){return kn(t,a,h-1).bottom<=s},u,0);return u=gn(function(h){return kn(t,a,h).top>s},p,u),{begin:p,end:u}}function Tf(t,r,a,s){a||(a=Hr(t,r));var u=os(t,r,kn(t,a,s),"line").top;return Ef(t,r,a,u)}function Za(t,r,a,s){return t.bottom<=a?!1:t.top>a?!0:(s?t.left:t.right)>r}function tb(t,r,a,s,u){u-=Tn(r);var p=Hr(t,r),h=Qa(r),y=0,b=r.text.length,w=!0,O=Bt(r,t.doc.direction);if(O){var I=(t.options.lineWrapping?rb:nb)(t,r,a,p,O,s,u);w=I.level!=1,y=w?I.from:I.to-1,b=w?I.to:I.from-1}var q=null,H=null,Q=gn(function(ye){var me=kn(t,p,ye);return me.top+=h,me.bottom+=h,Za(me,s,u,!1)?(me.top<=u&&me.left<=s&&(q=ye,H=me),!0):!1},y,b),Z,re,ue=!1;if(H){var fe=s-H.left<H.right-s,ce=fe==w;Q=q+(ce?0:1),re=ce?"after":"before",Z=fe?H.left:H.right}else{!w&&(Q==b||Q==y)&&Q++,re=Q==0?"after":Q==r.text.length?"before":kn(t,p,Q-(w?1:0)).bottom+h<=u==w?"after":"before";var pe=an(t,ee(a,Q,re),"line",r,p);Z=pe.left,ue=u<pe.top?-1:u>=pe.bottom?1:0}return Q=wt(r.text,Q,1),Ja(a,Q,re,ue,s-Z)}function nb(t,r,a,s,u,p,h){var y=gn(function(I){var q=u[I],H=q.level!=1;return Za(an(t,ee(a,H?q.to:q.from,H?"before":"after"),"line",r,s),p,h,!0)},0,u.length-1),b=u[y];if(y>0){var w=b.level!=1,O=an(t,ee(a,w?b.from:b.to,w?"after":"before"),"line",r,s);Za(O,p,h,!0)&&O.top>h&&(b=u[y-1])}return b}function rb(t,r,a,s,u,p,h){var y=Ef(t,r,s,h),b=y.begin,w=y.end;/\s/.test(r.text.charAt(w-1))&&w--;for(var O=null,I=null,q=0;q<u.length;q++){var H=u[q];if(!(H.from>=w||H.to<=b)){var Q=H.level!=1,Z=kn(t,s,Q?Math.min(w,H.to)-1:Math.max(b,H.from)).right,re=Z<p?p-Z+1e9:Z-p;(!O||I>re)&&(O=H,I=re)}}return O||(O=u[u.length-1]),O.from<b&&(O={from:b,to:O.to,level:O.level}),O.to>w&&(O={from:O.from,to:w,level:O.level}),O}var lr;function zr(t){if(t.cachedTextHeight!=null)return t.cachedTextHeight;if(lr==null){lr=V("pre",null,"CodeMirror-line-like");for(var r=0;r<49;++r)lr.appendChild(document.createTextNode("x")),lr.appendChild(V("br"));lr.appendChild(document.createTextNode("x"))}z(t.measure,lr);var a=lr.offsetHeight/50;return a>3&&(t.cachedTextHeight=a),te(t.measure),a||1}function qr(t){if(t.cachedCharWidth!=null)return t.cachedCharWidth;var r=V("span","xxxxxxxxxx"),a=V("pre",[r],"CodeMirror-line-like");z(t.measure,a);var s=r.getBoundingClientRect(),u=(s.right-s.left)/10;return u>2&&(t.cachedCharWidth=u),u||10}function el(t){for(var r=t.display,a={},s={},u=r.gutters.clientLeft,p=r.gutters.firstChild,h=0;p;p=p.nextSibling,++h){var y=t.display.gutterSpecs[h].className;a[y]=p.offsetLeft+p.clientLeft+u,s[y]=p.clientWidth}return{fixedPos:tl(r),gutterTotalWidth:r.gutters.offsetWidth,gutterLeft:a,gutterWidth:s,wrapperWidth:r.wrapper.clientWidth}}function tl(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Mf(t){var r=zr(t.display),a=t.options.lineWrapping,s=a&&Math.max(5,t.display.scroller.clientWidth/qr(t.display)-3);return function(u){if(zn(t.doc,u))return 0;var p=0;if(u.widgets)for(var h=0;h<u.widgets.length;h++)u.widgets[h].height&&(p+=u.widgets[h].height);return a?p+(Math.ceil(u.text.length/s)||1)*r:p+r}}function nl(t){var r=t.doc,a=Mf(t);r.iter(function(s){var u=a(s);u!=s.height&&It(s,u)})}function ur(t,r,a,s){var u=t.display;if(!a&&Rn(r).getAttribute("cm-not-content")=="true")return null;var p,h,y=u.lineSpace.getBoundingClientRect();try{p=r.clientX-y.left,h=r.clientY-y.top}catch{return null}var b=Xa(t,p,h),w;if(s&&b.xRel>0&&(w=he(t.doc,b.line).text).length==b.ch){var O=Ye(w,w.length,t.options.tabSize)-w.length;b=ee(b.line,Math.max(0,Math.round((p-mf(t.