UNPKG

@discoveryjs/discovery

Version:

Frontend framework for rapid data (JSON) analysis, shareable serverless reports and dashboards

5 lines (4 loc) 654 kB
var Ex=Object.create;var Yl=Object.defineProperty;var Lx=Object.getOwnPropertyDescriptor;var Mx=Object.getOwnPropertyNames;var Fx=Object.getPrototypeOf,Px=Object.prototype.hasOwnProperty;var xt=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),xe=(n,e)=>{for(var r in e)Yl(n,r,{get:e[r],enumerable:!0})},Ox=(n,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Mx(e))!Px.call(n,l)&&l!==r&&Yl(n,l,{get:()=>e[l],enumerable:!(o=Lx(e,l))||o.enumerable});return n};var fn=(n,e,r)=>(r=n!=null?Ex(Fx(n)):{},Ox(e||!n||!n.__esModule?Yl(r,"default",{value:n,enumerable:!0}):r,n));var Cn=xt((Ic,jc)=>{(function(n,e){typeof Ic=="object"&&typeof jc<"u"?jc.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self,n.CodeMirror=e())})(Ic,function(){"use strict";var n=navigator.userAgent,e=navigator.platform,r=/gecko\/\d/i.test(n),o=/MSIE \d/.test(n),l=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(n),u=/Edge\/(\d+)/.exec(n),f=o||l||u,d=f&&(o?document.documentMode||6:+(u||l)[1]),h=!u&&/WebKit\//.test(n),g=h&&/Qt\/\d+\.\d+/.test(n),y=!u&&/Chrome\/(\d+)/.exec(n),w=y&&+y[1],x=/Opera\//.test(n),E=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(n),F=/PhantomJS/.test(n),L=E&&(/Mobile\/\w+/.test(n)||navigator.maxTouchPoints>2),D=/Android/.test(n),C=L||D||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(n),M=L||/Mac/.test(e),P=/\bCrOS\b/.test(n),O=/win/i.test(e),N=x&&n.match(/Version\/(\d*\.\d*)/);N&&(N=Number(N[1])),N&&N>=15&&(x=!1,h=!0);var j=M&&(g||x&&(N==null||N<12.11)),_=r||f&&d>=9;function V(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var te=function(t,i){var a=t.className,s=V(i).exec(a);if(s){var c=a.slice(s.index+s[0].length);t.className=a.slice(0,s.index)+(c?s[1]+c:"")}};function z(t){for(var i=t.childNodes.length;i>0;--i)t.removeChild(t.firstChild);return t}function Z(t,i){return z(t).appendChild(i)}function A(t,i,a,s){var c=document.createElement(t);if(a&&(c.className=a),s&&(c.style.cssText=s),typeof i=="string")c.appendChild(document.createTextNode(i));else if(i)for(var p=0;p<i.length;++p)c.appendChild(i[p]);return c}function Y(t,i,a,s){var c=A(t,i,a,s);return c.setAttribute("role","presentation"),c}var $;document.createRange?$=function(t,i,a,s){var c=document.createRange();return c.setEnd(s||t,a),c.setStart(t,i),c}:$=function(t,i,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",i),s};function ce(t,i){if(i.nodeType==3&&(i=i.parentNode),t.contains)return t.contains(i);do if(i.nodeType==11&&(i=i.host),i==t)return!0;while(i=i.parentNode)}function ke(t){var i=t.ownerDocument||t,a;try{a=t.activeElement}catch{a=i.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function Me(t,i){var a=t.className;V(i).test(a)||(t.className+=(a?" ":"")+i)}function Ve(t,i){for(var a=t.split(" "),s=0;s<a.length;s++)a[s]&&!V(a[s]).test(i)&&(i+=" "+a[s]);return i}var et=function(t){t.select()};L?et=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:f&&(et=function(t){try{t.select()}catch{}});function Ke(t){return t.display.wrapper.ownerDocument}function gt(t){return Be(t.display.wrapper)}function Be(t){return t.getRootNode?t.getRootNode():t.ownerDocument}function Ce(t){return Ke(t).defaultView}function ve(t){var i=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,i)}}function G(t,i,a){i||(i={});for(var s in t)t.hasOwnProperty(s)&&(a!==!1||!i.hasOwnProperty(s))&&(i[s]=t[s]);return i}function ae(t,i,a,s,c){i==null&&(i=t.search(/[^\s\u00a0]/),i==-1&&(i=t.length));for(var p=s||0,m=c||0;;){var v=t.indexOf(" ",p);if(v<0||v>=i)return m+(i-p);m+=v-p,m+=a-m%a,p=v+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=ve(this.onTimeout,this)};ne.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},ne.prototype.set=function(t,i){this.f=i;var a=+new Date+t;(!this.id||a<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=a)};function re(t,i){for(var a=0;a<t.length;++a)if(t[a]==i)return a;return-1}var Te=50,Ae={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},We={origin:"*mouse"},Ee={origin:"+move"};function $e(t,i,a){for(var s=0,c=0;;){var p=t.indexOf(" ",s);p==-1&&(p=t.length);var m=p-s;if(p==t.length||c+m>=i)return s+Math.min(m,i-c);if(c+=p-s,c+=a-c%a,s=p+1,c>=i)return s}}var st=[""];function it(t){for(;st.length<=t;)st.push(Fe(st)+" ");return st[t]}function Fe(t){return t[t.length-1]}function je(t,i){for(var a=[],s=0;s<t.length;s++)a[s]=i(t[s],s);return a}function U(t,i,a){for(var s=0,c=a(i);s<t.length&&a(t[s])<=c;)s++;t.splice(s,0,i)}function se(){}function J(t,i){var a;return Object.create?a=Object.create(t):(se.prototype=t,a=new se),i&&G(i,a),a}var Pe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function mt(t){return/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Pe.test(t))}function An(t,i){return i?i.source.indexOf("\\w")>-1&&mt(t)?!0:i.test(t):mt(t)}function ts(t){for(var i in t)if(t.hasOwnProperty(i)&&t[i])return!1;return!0}var Sn=/[\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 tt(t){return t.charCodeAt(0)>=768&&Sn.test(t)}function jn(t,i,a){for(;(a<0?i>0:i<t.length)&&tt(t.charAt(i));)i+=a;return i}function yn(t,i,a){for(var s=i>a?-1:1;;){if(i==a)return i;var c=(i+a)/2,p=s<0?Math.ceil(c):Math.floor(c);if(p==i)return t(p)?i:a;t(p)?a=p:i=p+s}}function Hn(t,i,a,s){if(!t)return s(i,a,"ltr",0);for(var c=!1,p=0;p<t.length;++p){var m=t[p];(m.from<a&&m.to>i||i==a&&m.to==i)&&(s(Math.max(m.from,i),Math.min(m.to,a),m.level==1?"rtl":"ltr",p),c=!0)}c||s(i,a,"ltr")}var lr=null;function zn(t,i,a){var s;lr=null;for(var c=0;c<t.length;++c){var p=t[c];if(p.from<i&&p.to>i)return c;p.to==i&&(p.from!=p.to&&a=="before"?s=c:lr=c),p.from==i&&(p.from!=p.to&&a!="before"?s=c:lr=c)}return s??lr}var el=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function a(k){return k<=247?t.charAt(k):1424<=k&&k<=1524?"R":1536<=k&&k<=1785?i.charAt(k-1536):1774<=k&&k<=2220?"r":8192<=k&&k<=8203?"w":k==8204?"b":"L"}var s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,c=/[stwN]/,p=/[LRr]/,m=/[Lb1n]/,v=/[1n]/;function b(k,B,I){this.level=k,this.from=B,this.to=I}return function(k,B){var I=B=="ltr"?"L":"R";if(k.length==0||B=="ltr"&&!s.test(k))return!1;for(var q=k.length,H=[],Q=0;Q<q;++Q)H.push(a(k.charCodeAt(Q)));for(var ee=0,oe=I;ee<q;++ee){var le=H[ee];le=="m"?H[ee]=oe:oe=le}for(var de=0,ue=I;de<q;++de){var pe=H[de];pe=="1"&&ue=="r"?H[de]="n":p.test(pe)&&(ue=pe,pe=="r"&&(H[de]="R"))}for(var ye=1,ge=H[0];ye<q-1;++ye){var Se=H[ye];Se=="+"&&ge=="1"&&H[ye+1]=="1"?H[ye]="1":Se==","&&ge==H[ye+1]&&(ge=="1"||ge=="n")&&(H[ye]=ge),ge=Se}for(var He=0;He<q;++He){var ft=H[He];if(ft==",")H[He]="N";else if(ft=="%"){var Ge=void 0;for(Ge=He+1;Ge<q&&H[Ge]=="%";++Ge);for(var Ht=He&&H[He-1]=="!"||Ge<q&&H[Ge]=="1"?"1":"N",Mt=He;Mt<Ge;++Mt)H[Mt]=Ht;He=Ge-1}}for(var nt=0,Ft=I;nt<q;++nt){var pt=H[nt];Ft=="L"&&pt=="1"?H[nt]="L":p.test(pt)&&(Ft=pt)}for(var ot=0;ot<q;++ot)if(c.test(H[ot])){var rt=void 0;for(rt=ot+1;rt<q&&c.test(H[rt]);++rt);for(var Xe=(ot?H[ot-1]:I)=="L",Pt=(rt<q?H[rt]:I)=="L",li=Xe==Pt?Xe?"L":"R":I,Zn=ot;Zn<rt;++Zn)H[Zn]=li;ot=rt-1}for(var wt=[],kn,dt=0;dt<q;)if(m.test(H[dt])){var Kl=dt;for(++dt;dt<q&&m.test(H[dt]);++dt);wt.push(new b(0,Kl,dt))}else{var Nn=dt,vr=wt.length,br=B=="rtl"?1:0;for(++dt;dt<q&&H[dt]!="L";++dt);for(var Ct=Nn;Ct<dt;)if(v.test(H[Ct])){Nn<Ct&&(wt.splice(vr,0,new b(1,Nn,Ct)),vr+=br);var ui=Ct;for(++Ct;Ct<dt&&v.test(H[Ct]);++Ct);wt.splice(vr,0,new b(2,ui,Ct)),vr+=br,Nn=Ct}else++Ct;Nn<dt&&wt.splice(vr,0,new b(1,Nn,dt))}return B=="ltr"&&(wt[0].level==1&&(kn=k.match(/^\s+/))&&(wt[0].from=kn[0].length,wt.unshift(new b(0,0,kn[0].length))),Fe(wt).level==1&&(kn=k.match(/\s+$/))&&(Fe(wt).to-=kn[0].length,wt.push(new b(0,q-kn[0].length,q)))),B=="rtl"?wt.reverse():wt}}();function Le(t,i){var a=t.order;return a==null&&(a=t.order=el(t.text,i)),a}var ns=[],me=function(t,i,a){if(t.addEventListener)t.addEventListener(i,a,!1);else if(t.attachEvent)t.attachEvent("on"+i,a);else{var s=t._handlers||(t._handlers={});s[i]=(s[i]||ns).concat(a)}};function Tn(t,i){return t._handlers&&t._handlers[i]||ns}function yt(t,i,a){if(t.removeEventListener)t.removeEventListener(i,a,!1);else if(t.detachEvent)t.detachEvent("on"+i,a);else{var s=t._handlers,c=s&&s[i];if(c){var p=re(c,a);p>-1&&(s[i]=c.slice(0,p).concat(c.slice(p+1)))}}}function Qe(t,i){var a=Tn(t,i);if(a.length)for(var s=Array.prototype.slice.call(arguments,2),c=0;c<a.length;++c)a[c].apply(null,s)}function Ye(t,i,a){return typeof i=="string"&&(i={type:i,preventDefault:function(){this.defaultPrevented=!0}}),Qe(t,a||i.type,t,i),St(i)||i.codemirrorIgnore}function Qt(t){var i=t._handlers&&t._handlers.cursorActivity;if(i)for(var a=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),s=0;s<i.length;++s)re(a,i[s])==-1&&a.push(i[s])}function It(t,i){return Tn(t,i).length>0}function tn(t){t.prototype.on=function(i,a){me(this,i,a)},t.prototype.off=function(i,a){yt(this,i,a)}}function vt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Ir(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function St(t){return t.defaultPrevented!=null?t.defaultPrevented:t.returnValue==!1}function qn(t){vt(t),Ir(t)}function Hi(t){return t.target||t.srcElement}function nn(t){var i=t.which;return i==null&&(t.button&1?i=1:t.button&2?i=3:t.button&4&&(i=2)),M&&t.ctrlKey&&i==1&&(i=3),i}var tl=function(){if(f&&d<9)return!1;var t=A("div");return"draggable"in t||"dragDrop"in t}(),jr;function rs(t){if(jr==null){var i=A("span","\u200B");Z(t,A("span",[i,document.createTextNode("x")])),t.firstChild.offsetHeight!=0&&(jr=i.offsetWidth<=1&&i.offsetHeight>2&&!(f&&d<8))}var a=jr?A("span","\u200B"):A("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return a.setAttribute("cm-text",""),a}var zi;function _n(t){if(zi!=null)return zi;var i=Z(t,document.createTextNode("A\u062EA")),a=$(i,0,1).getBoundingClientRect(),s=$(i,1,2).getBoundingClientRect();return z(t),!a||a.left==a.right?!1:zi=s.right-a.right<3}var Yt=` b`.split(/\n/).length!=3?function(t){for(var i=0,a=[],s=t.length;i<=s;){var c=t.indexOf(` `,i);c==-1&&(c=t.length);var p=t.slice(i,t.charAt(c-1)=="\r"?c-1:c),m=p.indexOf("\r");m!=-1?(a.push(p.slice(0,m)),i+=m+1):(a.push(p),i=c+1)}return a}:function(t){return t.split(/\r\n?|\n/)},Vn=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch{return!1}}:function(t){var i;try{i=t.ownerDocument.selection.createRange()}catch{}return!i||i.parentElement()!=t?!1:i.compareEndPoints("StartToEnd",i)!=0},is=function(){var t=A("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),typeof t.oncopy=="function")}(),rn=null;function nl(t){if(rn!=null)return rn;var i=Z(t,A("span","x")),a=i.getBoundingClientRect(),s=$(i,0,1).getBoundingClientRect();return rn=Math.abs(a.left-s.left)>1}var Hr={},on={};function sn(t,i){arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2)),Hr[t]=i}function ur(t,i){on[t]=i}function zr(t){if(typeof t=="string"&&on.hasOwnProperty(t))t=on[t];else if(t&&typeof t.name=="string"&&on.hasOwnProperty(t.name)){var i=on[t.name];typeof i=="string"&&(i={name:i}),t=J(i,t),t.name=i.name}else{if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return zr("application/xml");if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return zr("application/json")}return typeof t=="string"?{name:t}:t||{name:"null"}}function qr(t,i){i=zr(i);var a=Hr[i.name];if(!a)return qr(t,"text/plain");var s=a(t,i);if(Wn.hasOwnProperty(i.name)){var c=Wn[i.name];for(var p in c)c.hasOwnProperty(p)&&(s.hasOwnProperty(p)&&(s["_"+p]=s[p]),s[p]=c[p])}if(s.name=i.name,i.helperType&&(s.helperType=i.helperType),i.modeProps)for(var m in i.modeProps)s[m]=i.modeProps[m];return s}var Wn={};function _r(t,i){var a=Wn.hasOwnProperty(t)?Wn[t]:Wn[t]={};G(i,a)}function vn(t,i){if(i===!0)return i;if(t.copyState)return t.copyState(i);var a={};for(var s in i){var c=i[s];c instanceof Array&&(c=c.concat([])),a[s]=c}return a}function qi(t,i){for(var a;t.innerMode&&(a=t.innerMode(i),!(!a||a.mode==t));)i=a.state,t=a.mode;return a||{mode:t,state:i}}function Vr(t,i,a){return t.startState?t.startState(i,a):!0}var Je=function(t,i,a){this.pos=this.start=0,this.string=t,this.tabSize=i||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 i=this.string.charAt(this.pos),a;if(typeof t=="string"?a=i==t:a=i&&(t.test?t.test(i):t(i)),a)return++this.pos,i},Je.prototype.eatWhile=function(t){for(var i=this.pos;this.eat(t););return this.pos>i},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 i=this.string.indexOf(t,this.pos);if(i>-1)return this.pos=i,!0},Je.prototype.backUp=function(t){this.pos-=t},Je.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ae(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ae(this.string,this.lineStart,this.tabSize):0)},Je.prototype.indentation=function(){return ae(this.string,null,this.tabSize)-(this.lineStart?ae(this.string,this.lineStart,this.tabSize):0)},Je.prototype.match=function(t,i,a){if(typeof t=="string"){var s=function(m){return a?m.toLowerCase():m},c=this.string.substr(this.pos,t.length);if(s(c)==s(t))return i!==!1&&(this.pos+=t.length),!0}else{var p=this.string.slice(this.pos).match(t);return p&&p.index>0?null:(p&&i!==!1&&(this.pos+=p[0].length),p)}},Je.prototype.current=function(){return this.string.slice(this.start,this.pos)},Je.prototype.hideFirstChars=function(t,i){this.lineStart+=t;try{return i()}finally{this.lineStart-=t}},Je.prototype.lookAhead=function(t){var i=this.lineOracle;return i&&i.lookAhead(t)},Je.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};function he(t,i){if(i-=t.first,i<0||i>=t.size)throw new Error("There is no line "+(i+t.first)+" in the document.");for(var a=t;!a.lines;)for(var s=0;;++s){var c=a.children[s],p=c.chunkSize();if(i<p){a=c;break}i-=p}return a.lines[i]}function En(t,i,a){var s=[],c=i.line;return t.iter(i.line,a.line+1,function(p){var m=p.text;c==a.line&&(m=m.slice(0,a.ch)),c==i.line&&(m=m.slice(i.ch)),s.push(m),++c}),s}function _i(t,i,a){var s=[];return t.iter(i,a,function(c){s.push(c.text)}),s}function Wt(t,i){var a=i-t.height;if(a)for(var s=t;s;s=s.parent)s.height+=a}function S(t){if(t.parent==null)return null;for(var i=t.parent,a=re(i.lines,t),s=i.parent;s;i=s,s=s.parent)for(var c=0;s.children[c]!=i;++c)a+=s.children[c].chunkSize();return a+i.first}function R(t,i){var a=t.first;e:do{for(var s=0;s<t.children.length;++s){var c=t.children[s],p=c.height;if(i<p){t=c;continue e}i-=p,a+=c.chunkSize()}return a}while(!t.lines);for(var m=0;m<t.lines.length;++m){var v=t.lines[m],b=v.height;if(i<b)break;i-=b}return a+m}function X(t,i){return i>=t.first&&i<t.first+t.size}function ie(t,i){return String(t.lineNumberFormatter(i+t.firstLineNumber))}function K(t,i,a){if(a===void 0&&(a=null),!(this instanceof K))return new K(t,i,a);this.line=t,this.ch=i,this.sticky=a}function fe(t,i){return t.line-i.line||t.ch-i.ch}function Oe(t,i){return t.sticky==i.sticky&&fe(t,i)==0}function at(t){return K(t.line,t.ch)}function Tt(t,i){return fe(t,i)<0?i:t}function Wr(t,i){return fe(t,i)<0?t:i}function Af(t,i){return Math.max(t.first,Math.min(i,t.first+t.size-1))}function De(t,i){if(i.line<t.first)return K(t.first,0);var a=t.first+t.size-1;return i.line>a?K(a,he(t,a).text.length):Lb(i,he(t,i.line).text.length)}function Lb(t,i){var a=t.ch;return a==null||a>i?K(t.line,i):a<0?K(t.line,0):t}function Sf(t,i){for(var a=[],s=0;s<i.length;s++)a[s]=De(t,i[s]);return a}var os=function(t,i){this.state=t,this.lookAhead=i},bn=function(t,i,a,s){this.state=i,this.doc=t,this.line=a,this.maxLookAhead=s||0,this.baseTokens=null,this.baseTokenPos=1};bn.prototype.lookAhead=function(t){var i=this.doc.getLine(this.line+t);return i!=null&&t>this.maxLookAhead&&(this.maxLookAhead=t),i},bn.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var i=this.baseTokens[this.baseTokenPos+1];return{type:i&&i.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},bn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},bn.fromSaved=function(t,i,a){return i instanceof os?new bn(t,vn(t.mode,i.state),a,i.lookAhead):new bn(t,vn(t.mode,i),a)},bn.prototype.save=function(t){var i=t!==!1?vn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new os(i,this.maxLookAhead):i};function Tf(t,i,a,s){var c=[t.state.modeGen],p={};Of(t,i.text,t.doc.mode,a,function(k,B){return c.push(k,B)},p,s);for(var m=a.state,v=function(k){a.baseTokens=c;var B=t.state.overlays[k],I=1,q=0;a.state=!0,Of(t,i.text,B.mode,a,function(H,Q){for(var ee=I;q<H;){var oe=c[I];oe>H&&c.splice(I,1,H,c[I+1],oe),I+=2,q=Math.min(H,oe)}if(Q)if(B.opaque)c.splice(ee,I-ee,H,"overlay "+Q),I=ee+2;else for(;ee<I;ee+=2){var le=c[ee+1];c[ee+1]=(le?le+" ":"")+"overlay "+Q}},p),a.state=m,a.baseTokens=null,a.baseTokenPos=1},b=0;b<t.state.overlays.length;++b)v(b);return{styles:c,classes:p.bgClass||p.textClass?p:null}}function Ef(t,i,a){if(!i.styles||i.styles[0]!=t.state.modeGen){var s=Vi(t,S(i)),c=i.text.length>t.options.maxHighlightLength&&vn(t.doc.mode,s.state),p=Tf(t,i,s);c&&(s.state=c),i.stateAfter=s.save(!c),i.styles=p.styles,p.classes?i.styleClasses=p.classes:i.styleClasses&&(i.styleClasses=null),a===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return i.styles}function Vi(t,i,a){var s=t.doc,c=t.display;if(!s.mode.startState)return new bn(s,!0,i);var p=Mb(t,i,a),m=p>s.first&&he(s,p-1).stateAfter,v=m?bn.fromSaved(s,m,p):new bn(s,Vr(s.mode),p);return s.iter(p,i,function(b){rl(t,b.text,v);var k=v.line;b.stateAfter=k==i-1||k%5==0||k>=c.viewFrom&&k<c.viewTo?v.save():null,v.nextLine()}),a&&(s.modeFrontier=v.line),v}function rl(t,i,a,s){var c=t.doc.mode,p=new Je(i,t.options.tabSize,a);for(p.start=p.pos=s||0,i==""&&Lf(c,a.state);!p.eol();)il(c,p,a.state),p.start=p.pos}function Lf(t,i){if(t.blankLine)return t.blankLine(i);if(t.innerMode){var a=qi(t,i);if(a.mode.blankLine)return a.mode.blankLine(a.state)}}function il(t,i,a,s){for(var c=0;c<10;c++){s&&(s[0]=qi(t,a).mode);var p=t.token(i,a);if(i.pos>i.start)return p}throw new Error("Mode "+t.name+" failed to advance stream.")}var Mf=function(t,i,a){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=i||null,this.state=a};function Ff(t,i,a,s){var c=t.doc,p=c.mode,m;i=De(c,i);var v=he(c,i.line),b=Vi(t,i.line,a),k=new Je(v.text,t.options.tabSize,b),B;for(s&&(B=[]);(s||k.pos<i.ch)&&!k.eol();)k.start=k.pos,m=il(p,k,b.state),s&&B.push(new Mf(k,m,vn(c.mode,b.state)));return s?B:new Mf(k,m,b.state)}function Pf(t,i){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";i[s]==null?i[s]=a[2]:new RegExp("(?:^|\\s)"+a[2]+"(?:$|\\s)").test(i[s])||(i[s]+=" "+a[2])}return t}function Of(t,i,a,s,c,p,m){var v=a.flattenSpans;v==null&&(v=t.options.flattenSpans);var b=0,k=null,B=new Je(i,t.options.tabSize,s),I,q=t.options.addModeClass&&[null];for(i==""&&Pf(Lf(a,s.state),p);!B.eol();){if(B.pos>t.options.maxHighlightLength?(v=!1,m&&rl(t,i,s,B.pos),B.pos=i.length,I=null):I=Pf(il(a,B,s.state,q),p),q){var H=q[0].name;H&&(I="m-"+(I?H+" "+I:H))}if(!v||k!=I){for(;b<B.start;)b=Math.min(B.start,b+5e3),c(b,k);k=I}B.start=B.pos}for(;b<B.pos;){var Q=Math.min(B.pos,b+5e3);c(Q,k),b=Q}}function Mb(t,i,a){for(var s,c,p=t.doc,m=a?-1:i-(t.doc.mode.innerMode?1e3:100),v=i;v>m;--v){if(v<=p.first)return p.first;var b=he(p,v-1),k=b.stateAfter;if(k&&(!a||v+(k instanceof os?k.lookAhead:0)<=p.modeFrontier))return v;var B=ae(b.text,null,t.options.tabSize);(c==null||s>B)&&(c=v-1,s=B)}return c}function Fb(t,i){if(t.modeFrontier=Math.min(t.modeFrontier,i),!(t.highlightFrontier<i-10)){for(var a=t.first,s=i-1;s>a;s--){var c=he(t,s).stateAfter;if(c&&(!(c instanceof os)||s+c.lookAhead<i)){a=s+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,a)}}var Nf=!1,Ln=!1;function Pb(){Nf=!0}function Ob(){Ln=!0}function ss(t,i,a){this.marker=t,this.from=i,this.to=a}function Wi(t,i){if(t)for(var a=0;a<t.length;++a){var s=t[a];if(s.marker==i)return s}}function Nb(t,i){for(var a,s=0;s<t.length;++s)t[s]!=i&&(a||(a=[])).push(t[s]);return a}function Bb(t,i,a){var s=a&&window.WeakSet&&(a.markedSpans||(a.markedSpans=new WeakSet));s&&t.markedSpans&&s.has(t.markedSpans)?t.markedSpans.push(i):(t.markedSpans=t.markedSpans?t.markedSpans.concat([i]):[i],s&&s.add(t.markedSpans)),i.marker.attachLine(t)}function Rb(t,i,a){var s;if(t)for(var c=0;c<t.length;++c){var p=t[c],m=p.marker,v=p.from==null||(m.inclusiveLeft?p.from<=i:p.from<i);if(v||p.from==i&&m.type=="bookmark"&&(!a||!p.marker.insertLeft)){var b=p.to==null||(m.inclusiveRight?p.to>=i:p.to>i);(s||(s=[])).push(new ss(m,p.from,b?null:p.to))}}return s}function Ib(t,i,a){var s;if(t)for(var c=0;c<t.length;++c){var p=t[c],m=p.marker,v=p.to==null||(m.inclusiveRight?p.to>=i:p.to>i);if(v||p.from==i&&m.type=="bookmark"&&(!a||p.marker.insertLeft)){var b=p.from==null||(m.inclusiveLeft?p.from<=i:p.from<i);(s||(s=[])).push(new ss(m,b?null:p.from-i,p.to==null?null:p.to-i))}}return s}function ol(t,i){if(i.full)return null;var a=X(t,i.from.line)&&he(t,i.from.line).markedSpans,s=X(t,i.to.line)&&he(t,i.to.line).markedSpans;if(!a&&!s)return null;var c=i.from.ch,p=i.to.ch,m=fe(i.from,i.to)==0,v=Rb(a,c,m),b=Ib(s,p,m),k=i.text.length==1,B=Fe(i.text).length+(k?c:0);if(v)for(var I=0;I<v.length;++I){var q=v[I];if(q.to==null){var H=Wi(b,q.marker);H?k&&(q.to=H.to==null?null:H.to+B):q.to=c}}if(b)for(var Q=0;Q<b.length;++Q){var ee=b[Q];if(ee.to!=null&&(ee.to+=B),ee.from==null){var oe=Wi(v,ee.marker);oe||(ee.from=B,k&&(v||(v=[])).push(ee))}else ee.from+=B,k&&(v||(v=[])).push(ee)}v&&(v=Bf(v)),b&&b!=v&&(b=Bf(b));var le=[v];if(!k){var de=i.text.length-2,ue;if(de>0&&v)for(var pe=0;pe<v.length;++pe)v[pe].to==null&&(ue||(ue=[])).push(new ss(v[pe].marker,null,null));for(var ye=0;ye<de;++ye)le.push(ue);le.push(b)}return le}function Bf(t){for(var i=0;i<t.length;++i){var a=t[i];a.from!=null&&a.from==a.to&&a.marker.clearWhenEmpty!==!1&&t.splice(i--,1)}return t.length?t:null}function jb(t,i,a){var s=null;if(t.iter(i.line,a.line+1,function(H){if(H.markedSpans)for(var Q=0;Q<H.markedSpans.length;++Q){var ee=H.markedSpans[Q].marker;ee.readOnly&&(!s||re(s,ee)==-1)&&(s||(s=[])).push(ee)}}),!s)return null;for(var c=[{from:i,to:a}],p=0;p<s.length;++p)for(var m=s[p],v=m.find(0),b=0;b<c.length;++b){var k=c[b];if(!(fe(k.to,v.from)<0||fe(k.from,v.to)>0)){var B=[b,1],I=fe(k.from,v.from),q=fe(k.to,v.to);(I<0||!m.inclusiveLeft&&!I)&&B.push({from:k.from,to:v.from}),(q>0||!m.inclusiveRight&&!q)&&B.push({from:v.to,to:k.to}),c.splice.apply(c,B),b+=B.length-3}}return c}function Rf(t){var i=t.markedSpans;if(i){for(var a=0;a<i.length;++a)i[a].marker.detachLine(t);t.markedSpans=null}}function If(t,i){if(i){for(var a=0;a<i.length;++a)i[a].marker.attachLine(t);t.markedSpans=i}}function as(t){return t.inclusiveLeft?-1:0}function ls(t){return t.inclusiveRight?1:0}function sl(t,i){var a=t.lines.length-i.lines.length;if(a!=0)return a;var s=t.find(),c=i.find(),p=fe(s.from,c.from)||as(t)-as(i);if(p)return-p;var m=fe(s.to,c.to)||ls(t)-ls(i);return m||i.id-t.id}function jf(t,i){var a=Ln&&t.markedSpans,s;if(a)for(var c=void 0,p=0;p<a.length;++p)c=a[p],c.marker.collapsed&&(i?c.from:c.to)==null&&(!s||sl(s,c.marker)<0)&&(s=c.marker);return s}function Hf(t){return jf(t,!0)}function us(t){return jf(t,!1)}function Hb(t,i){var a=Ln&&t.markedSpans,s;if(a)for(var c=0;c<a.length;++c){var p=a[c];p.marker.collapsed&&(p.from==null||p.from<i)&&(p.to==null||p.to>i)&&(!s||sl(s,p.marker)<0)&&(s=p.marker)}return s}function zf(t,i,a,s,c){var p=he(t,i),m=Ln&&p.markedSpans;if(m)for(var v=0;v<m.length;++v){var b=m[v];if(b.marker.collapsed){var k=b.marker.find(0),B=fe(k.from,a)||as(b.marker)-as(c),I=fe(k.to,s)||ls(b.marker)-ls(c);if(!(B>=0&&I<=0||B<=0&&I>=0)&&(B<=0&&(b.marker.inclusiveRight&&c.inclusiveLeft?fe(k.to,a)>=0:fe(k.to,a)>0)||B>=0&&(b.marker.inclusiveRight&&c.inclusiveLeft?fe(k.from,s)<=0:fe(k.from,s)<0)))return!0}}}function an(t){for(var i;i=Hf(t);)t=i.find(-1,!0).line;return t}function zb(t){for(var i;i=us(t);)t=i.find(1,!0).line;return t}function qb(t){for(var i,a;i=us(t);)t=i.find(1,!0).line,(a||(a=[])).push(t);return a}function al(t,i){var a=he(t,i),s=an(a);return a==s?i:S(s)}function qf(t,i){if(i>t.lastLine())return i;var a=he(t,i),s;if(!$n(t,a))return i;for(;s=us(a);)a=s.find(1,!0).line;return S(a)+1}function $n(t,i){var a=Ln&&i.markedSpans;if(a){for(var s=void 0,c=0;c<a.length;++c)if(s=a[c],!!s.marker.collapsed){if(s.from==null)return!0;if(!s.marker.widgetNode&&s.from==0&&s.marker.inclusiveLeft&&ll(t,i,s))return!0}}}function ll(t,i,a){if(a.to==null){var s=a.marker.find(1,!0);return ll(t,s.line,Wi(s.line.markedSpans,a.marker))}if(a.marker.inclusiveRight&&a.to==i.text.length)return!0;for(var c=void 0,p=0;p<i.markedSpans.length;++p)if(c=i.markedSpans[p],c.marker.collapsed&&!c.marker.widgetNode&&c.from==a.to&&(c.to==null||c.to!=a.from)&&(c.marker.inclusiveLeft||a.marker.inclusiveRight)&&ll(t,i,c))return!0}function Mn(t){t=an(t);for(var i=0,a=t.parent,s=0;s<a.lines.length;++s){var c=a.lines[s];if(c==t)break;i+=c.height}for(var p=a.parent;p;a=p,p=a.parent)for(var m=0;m<p.children.length;++m){var v=p.children[m];if(v==a)break;i+=v.height}return i}function cs(t){if(t.height==0)return 0;for(var i=t.text.length,a,s=t;a=Hf(s);){var c=a.find(0,!0);s=c.from.line,i+=c.from.ch-c.to.ch}for(s=t;a=us(s);){var p=a.find(0,!0);i-=s.text.length-p.from.ch,s=p.to.line,i+=s.text.length-p.to.ch}return i}function ul(t){var i=t.display,a=t.doc;i.maxLine=he(a,a.first),i.maxLineLength=cs(i.maxLine),i.maxLineChanged=!0,a.iter(function(s){var c=cs(s);c>i.maxLineLength&&(i.maxLineLength=c,i.maxLine=s)})}var $r=function(t,i,a){this.text=t,If(this,i),this.height=a?a(this):1};$r.prototype.lineNo=function(){return S(this)},tn($r);function _b(t,i,a,s){t.text=i,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),t.order!=null&&(t.order=null),Rf(t),If(t,a);var c=s?s(t):1;c!=t.height&&Wt(t,c)}function Vb(t){t.parent=null,Rf(t)}var Wb={},$b={};function _f(t,i){if(!t||/^\s*$/.test(t))return null;var a=i.addModeClass?$b:Wb;return a[t]||(a[t]=t.replace(/\S+/g,"cm-$&"))}function Vf(t,i){var a=Y("span",null,null,h?"padding-right: .1px":null),s={pre:Y("pre",[a],"CodeMirror-line"),content:a,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};i.measure={};for(var c=0;c<=(i.rest?i.rest.length:0);c++){var p=c?i.rest[c-1]:i.line,m=void 0;s.pos=0,s.addToken=Gb,_n(t.display.measure)&&(m=Le(p,t.doc.direction))&&(s.addToken=Qb(s.addToken,m)),s.map=[];var v=i!=t.display.externalMeasured&&S(p);Yb(p,s,Ef(t,p,v)),p.styleClasses&&(p.styleClasses.bgClass&&(s.bgClass=Ve(p.styleClasses.bgClass,s.bgClass||"")),p.styleClasses.textClass&&(s.textClass=Ve(p.styleClasses.textClass,s.textClass||""))),s.map.length==0&&s.map.push(0,0,s.content.appendChild(rs(t.display.measure))),c==0?(i.measure.map=s.map,i.measure.cache={}):((i.measure.maps||(i.measure.maps=[])).push(s.map),(i.measure.caches||(i.measure.caches=[])).push({}))}if(h){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 Qe(t,"renderLine",t,i.line,s.pre),s.pre.className&&(s.textClass=Ve(s.pre.className,s.textClass||"")),s}function Ub(t){var i=A("span","\u2022","cm-invalidchar");return i.title="\\u"+t.charCodeAt(0).toString(16),i.setAttribute("aria-label",i.title),i}function Gb(t,i,a,s,c,p,m){if(i){var v=t.splitSpaces?Kb(i,t.trailingSpace):i,b=t.cm.state.specialChars,k=!1,B;if(!b.test(i))t.col+=i.length,B=document.createTextNode(v),t.map.push(t.pos,t.pos+i.length,B),f&&d<9&&(k=!0),t.pos+=i.length;else{B=document.createDocumentFragment();for(var I=0;;){b.lastIndex=I;var q=b.exec(i),H=q?q.index-I:i.length-I;if(H){var Q=document.createTextNode(v.slice(I,I+H));f&&d<9?B.appendChild(A("span",[Q])):B.appendChild(Q),t.map.push(t.pos,t.pos+H,Q),t.col+=H,t.pos+=H}if(!q)break;I+=H+1;var ee=void 0;if(q[0]==" "){var oe=t.cm.options.tabSize,le=oe-t.col%oe;ee=B.appendChild(A("span",it(le),"cm-tab")),ee.setAttribute("role","presentation"),ee.setAttribute("cm-text"," "),t.col+=le}else q[0]=="\r"||q[0]==` `?(ee=B.appendChild(A("span",q[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ee.setAttribute("cm-text",q[0]),t.col+=1):(ee=t.cm.options.specialCharPlaceholder(q[0]),ee.setAttribute("cm-text",q[0]),f&&d<9?B.appendChild(A("span",[ee])):B.appendChild(ee),t.col+=1);t.map.push(t.pos,t.pos+1,ee),t.pos++}}if(t.trailingSpace=v.charCodeAt(i.length-1)==32,a||s||c||k||p||m){var de=a||"";s&&(de+=s),c&&(de+=c);var ue=A("span",[B],de,p);if(m)for(var pe in m)m.hasOwnProperty(pe)&&pe!="style"&&pe!="class"&&ue.setAttribute(pe,m[pe]);return t.content.appendChild(ue)}t.content.appendChild(B)}}function Kb(t,i){if(t.length>1&&!/ /.test(t))return t;for(var a=i,s="",c=0;c<t.length;c++){var p=t.charAt(c);p==" "&&a&&(c==t.length-1||t.charCodeAt(c+1)==32)&&(p="\xA0"),s+=p,a=p==" "}return s}function Qb(t,i){return function(a,s,c,p,m,v,b){c=c?c+" cm-force-border":"cm-force-border";for(var k=a.pos,B=k+s.length;;){for(var I=void 0,q=0;q<i.length&&(I=i[q],!(I.to>k&&I.from<=k));q++);if(I.to>=B)return t(a,s,c,p,m,v,b);t(a,s.slice(0,I.to-k),c,p,null,v,b),p=null,s=s.slice(I.to-k),k=I.to}}}function Wf(t,i,a,s){var c=!s&&a.widgetNode;c&&t.map.push(t.pos,t.pos+i,c),!s&&t.cm.display.input.needsContentAttribute&&(c||(c=t.content.appendChild(document.createElement("span"))),c.setAttribute("cm-marker",a.id)),c&&(t.cm.display.input.setUneditable(c),t.content.appendChild(c)),t.pos+=i,t.trailingSpace=!1}function Yb(t,i,a){var s=t.markedSpans,c=t.text,p=0;if(!s){for(var m=1;m<a.length;m+=2)i.addToken(i,c.slice(p,p=a[m]),_f(a[m+1],i.cm.options));return}for(var v=c.length,b=0,k=1,B="",I,q,H=0,Q,ee,oe,le,de;;){if(H==b){Q=ee=oe=q="",de=null,le=null,H=1/0;for(var ue=[],pe=void 0,ye=0;ye<s.length;++ye){var ge=s[ye],Se=ge.marker;if(Se.type=="bookmark"&&ge.from==b&&Se.widgetNode)ue.push(Se);else if(ge.from<=b&&(ge.to==null||ge.to>b||Se.collapsed&&ge.to==b&&ge.from==b)){if(ge.to!=null&&ge.to!=b&&H>ge.to&&(H=ge.to,ee=""),Se.className&&(Q+=" "+Se.className),Se.css&&(q=(q?q+";":"")+Se.css),Se.startStyle&&ge.from==b&&(oe+=" "+Se.startStyle),Se.endStyle&&ge.to==H&&(pe||(pe=[])).push(Se.endStyle,ge.to),Se.title&&((de||(de={})).title=Se.title),Se.attributes)for(var He in Se.attributes)(de||(de={}))[He]=Se.attributes[He];Se.collapsed&&(!le||sl(le.marker,Se)<0)&&(le=ge)}else ge.from>b&&H>ge.from&&(H=ge.from)}if(pe)for(var ft=0;ft<pe.length;ft+=2)pe[ft+1]==H&&(ee+=" "+pe[ft]);if(!le||le.from==b)for(var Ge=0;Ge<ue.length;++Ge)Wf(i,0,ue[Ge]);if(le&&(le.from||0)==b){if(Wf(i,(le.to==null?v+1:le.to)-b,le.marker,le.from==null),le.to==null)return;le.to==b&&(le=!1)}}if(b>=v)break;for(var Ht=Math.min(v,H);;){if(B){var Mt=b+B.length;if(!le){var nt=Mt>Ht?B.slice(0,Ht-b):B;i.addToken(i,nt,I?I+Q:Q,oe,b+nt.length==H?ee:"",q,de)}if(Mt>=Ht){B=B.slice(Ht-b),b=Ht;break}b=Mt,oe=""}B=c.slice(p,p=a[k++]),I=_f(a[k++],i.cm.options)}}}function $f(t,i,a){this.line=i,this.rest=qb(i),this.size=this.rest?S(Fe(this.rest))-a+1:1,this.node=this.text=null,this.hidden=$n(t,i)}function fs(t,i,a){for(var s=[],c,p=i;p<a;p=c){var m=new $f(t.doc,he(t.doc,p),p);c=p+m.size,s.push(m)}return s}var Ur=null;function Jb(t){Ur?Ur.ops.push(t):t.ownsGroup=Ur={ops:[t],delayedCallbacks:[]}}function Xb(t){var i=t.delayedCallbacks,a=0;do{for(;a<i.length;a++)i[a].call(null);for(var s=0;s<t.ops.length;s++){var c=t.ops[s];if(c.cursorActivityHandlers)for(;c.cursorActivityCalled<c.cursorActivityHandlers.length;)c.cursorActivityHandlers[c.cursorActivityCalled++].call(null,c.cm)}}while(a<i.length)}function Zb(t,i){var a=t.ownsGroup;if(a)try{Xb(a)}finally{Ur=null,i(a)}}var $i=null;function lt(t,i){var a=Tn(t,i);if(a.length){var s=Array.prototype.slice.call(arguments,2),c;Ur?c=Ur.delayedCallbacks:$i?c=$i:(c=$i=[],setTimeout(ew,0));for(var p=function(v){c.push(function(){return a[v].apply(null,s)})},m=0;m<a.length;++m)p(m)}}function ew(){var t=$i;$i=null;for(var i=0;i<t.length;++i)t[i]()}function Uf(t,i,a,s){for(var c=0;c<i.changes.length;c++){var p=i.changes[c];p=="text"?nw(t,i):p=="gutter"?Kf(t,i,a,s):p=="class"?cl(t,i):p=="widget"&&rw(t,i,s)}i.changes=null}function Ui(t){return t.node==t.text&&(t.node=A("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 tw(t,i){var a=i.bgClass?i.bgClass+" "+(i.line.bgClass||""):i.line.bgClass;if(a&&(a+=" CodeMirror-linebackground"),i.background)a?i.background.className=a:(i.background.parentNode.removeChild(i.background),i.background=null);else if(a){var s=Ui(i);i.background=s.insertBefore(A("div",null,a),s.firstChild),t.display.input.setUneditable(i.background)}}function Gf(t,i){var a=t.display.externalMeasured;return a&&a.line==i.line?(t.display.externalMeasured=null,i.measure=a.measure,a.built):Vf(t,i)}function nw(t,i){var a=i.text.className,s=Gf(t,i);i.text==i.node&&(i.node=s.pre),i.text.parentNode.replaceChild(s.pre,i.text),i.text=s.pre,s.bgClass!=i.bgClass||s.textClass!=i.textClass?(i.bgClass=s.bgClass,i.textClass=s.textClass,cl(t,i)):a&&(i.text.className=a)}function cl(t,i){tw(t,i),i.line.wrapClass?Ui(i).className=i.line.wrapClass:i.node!=i.text&&(i.node.className="");var a=i.textClass?i.textClass+" "+(i.line.textClass||""):i.line.textClass;i.text.className=a||""}function Kf(t,i,a,s){if(i.gutter&&(i.node.removeChild(i.gutter),i.gutter=null),i.gutterBackground&&(i.node.removeChild(i.gutterBackground),i.gutterBackground=null),i.line.gutterClass){var c=Ui(i);i.gutterBackground=A("div",null,"CodeMirror-gutter-background "+i.line.gutterClass,"left: "+(t.options.fixedGutter?s.fixedPos:-s.gutterTotalWidth)+"px; width: "+s.gutterTotalWidth+"px"),t.display.input.setUneditable(i.gutterBackground),c.insertBefore(i.gutterBackground,i.text)}var p=i.line.gutterMarkers;if(t.options.lineNumbers||p){var m=Ui(i),v=i.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?s.fixedPos:-s.gutterTotalWidth)+"px");if(v.setAttribute("aria-hidden","true"),t.display.input.setUneditable(v),m.insertBefore(v,i.text),i.line.gutterClass&&(v.className+=" "+i.line.gutterClass),t.options.lineNumbers&&(!p||!p["CodeMirror-linenumbers"])&&(i.lineNumber=v.appendChild(A("div",ie(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 k=t.display.gutterSpecs[b].className,B=p.hasOwnProperty(k)&&p[k];B&&v.appendChild(A("div",[B],"CodeMirror-gutter-elt","left: "+s.gutterLeft[k]+"px; width: "+s.gutterWidth[k]+"px"))}}}function rw(t,i,a){i.alignable&&(i.alignable=null);for(var s=V("CodeMirror-linewidget"),c=i.node.firstChild,p=void 0;c;c=p)p=c.nextSibling,s.test(c.className)&&i.node.removeChild(c);Qf(t,i,a)}function iw(t,i,a,s){var c=Gf(t,i);return i.text=i.node=c.pre,c.bgClass&&(i.bgClass=c.bgClass),c.textClass&&(i.textClass=c.textClass),cl(t,i),Kf(t,i,a,s),Qf(t,i,s),i.node}function Qf(t,i,a){if(Yf(t,i.line,i,a,!0),i.rest)for(var s=0;s<i.rest.length;s++)Yf(t,i.rest[s],i,a,!1)}function Yf(t,i,a,s,c){if(i.widgets)for(var p=Ui(a),m=0,v=i.widgets;m<v.length;++m){var b=v[m],k=A("div",[b.node],"CodeMirror-linewidget"+(b.className?" "+b.className:""));b.handleMouseEvents||k.setAttribute("cm-ignore-events","true"),ow(b,k,a,s),t.display.input.setUneditable(k),c&&b.above?p.insertBefore(k,a.gutter||a.text):p.appendChild(k),lt(b,"redraw")}}function ow(t,i,a,s){if(t.noHScroll){(a.alignable||(a.alignable=[])).push(i);var c=s.wrapperWidth;i.style.left=s.fixedPos+"px",t.coverGutter||(c-=s.gutterTotalWidth,i.style.paddingLeft=s.gutterTotalWidth+"px"),i.style.width=c+"px"}t.coverGutter&&(i.style.zIndex=5,i.style.position="relative",t.noHScroll||(i.style.marginLeft=-s.gutterTotalWidth+"px"))}function Gi(t){if(t.height!=null)return t.height;var i=t.doc.cm;if(!i)return 0;if(!ce(document.body,t.node)){var a="position: relative;";t.coverGutter&&(a+="margin-left: -"+i.display.gutters.offsetWidth+"px;"),t.noHScroll&&(a+="width: "+i.display.wrapper.clientWidth+"px;"),Z(i.display.measure,A("div",[t.node],null,a))}return t.height=t.node.parentNode.offsetHeight}function Fn(t,i){for(var a=Hi(i);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 ds(t){return t.lineSpace.offsetTop}function fl(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Jf(t){if(t.cachedPaddingH)return t.cachedPaddingH;var i=Z(t.measure,A("pre","x","CodeMirror-line-like")),a=window.getComputedStyle?window.getComputedStyle(i):i.currentStyle,s={left:parseInt(a.paddingLeft),right:parseInt(a.paddingRight)};return!isNaN(s.left)&&!isNaN(s.right)&&(t.cachedPaddingH=s),s}function wn(t){return Te-t.display.nativeBarWidth}function cr(t){return t.display.scroller.clientWidth-wn(t)-t.display.barWidth}function dl(t){return t.display.scroller.clientHeight-wn(t)-t.display.barHeight}function sw(t,i,a){var s=t.options.lineWrapping,c=s&&cr(t);if(!i.measure.heights||s&&i.measure.width!=c){var p=i.measure.heights=[];if(s){i.measure.width=c;for(var m=i.text.firstChild.getClientRects(),v=0;v<m.length-1;v++){var b=m[v],k=m[v+1];Math.abs(b.bottom-k.bottom)>2&&p.push((b.bottom+k.top)/2-a.top)}}p.push(a.bottom-a.top)}}function Xf(t,i,a){if(t.line==i)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]==i)return{map:t.measure.maps[s],cache:t.measure.caches[s]};for(var c=0;c<t.rest.length;c++)if(S(t.rest[c])>a)return{map:t.measure.maps[c],cache:t.measure.caches[c],before:!0}}}function aw(t,i){i=an(i);var a=S(i),s=t.display.externalMeasured=new $f(t.doc,i,a);s.lineN=a;var c=s.built=Vf(t,s);return s.text=c.pre,Z(t.display.lineMeasure,c.pre),s}function Zf(t,i,a,s){return xn(t,Gr(t,i),a,s)}function pl(t,i){if(i>=t.display.viewFrom&&i<t.display.viewTo)return t.display.view[pr(t,i)];var a=t.display.externalMeasured;if(a&&i>=a.lineN&&i<a.lineN+a.size)return a}function Gr(t,i){var a=S(i),s=pl(t,a);s&&!s.text?s=null:s&&s.changes&&(Uf(t,s,a,vl(t)),t.curOp.forceUpdate=!0),s||(s=aw(t,i));var c=Xf(s,i,a);return{line:i,view:s,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function xn(t,i,a,s,c){i.before&&(a=-1);var p=a+(s||""),m;return i.cache.hasOwnProperty(p)?m=i.cache[p]:(i.rect||(i.rect=i.view.text.getBoundingClientRect()),i.hasHeights||(sw(t,i.view,i.rect),i.hasHeights=!0),m=uw(t,i,a,s),m.bogus||(i.cache[p]=m)),{left:m.left,right:m.right,top:c?m.rtop:m.top,bottom:c?m.rbottom:m.bottom}}var ed={left:0,right:0,top:0,bottom:0};function td(t,i,a){for(var s,c,p,m,v,b,k=0;k<t.length;k+=3)if(v=t[k],b=t[k+1],i<v?(c=0,p=1,m="left"):i<b?(c=i-v,p=c+1):(k==t.length-3||i==b&&t[k+3]>i)&&(p=b-v,c=p-1,i>=b&&(m="right")),c!=null){if(s=t[k+2],v==b&&a==(s.insertLeft?"left":"right")&&(m=a),a=="left"&&c==0)for(;k&&t[k-2]==t[k-3]&&t[k-1].insertLeft;)s=t[(k-=3)+2],m="left";if(a=="right"&&c==b-v)for(;k<t.length-3&&t[k+3]==t[k+4]&&!t[k+5].insertLeft;)s=t[(k+=3)+2],m="right";break}return{node:s,start:c,end:p,collapse:m,coverStart:v,coverEnd:b}}function lw(t,i){var a=ed;if(i=="left")for(var s=0;s<t.length&&(a=t[s]).left==a.right;s++);else for(var c=t.length-1;c>=0&&(a=t[c]).left==a.right;c--);return a}function uw(t,i,a,s){var c=td(i.map,a,s),p=c.node,m=c.start,v=c.end,b=c.collapse,k;if(p.nodeType==3){for(var B=0;B<4;B++){for(;m&&tt(i.line.text.charAt(c.coverStart+m));)--m;for(;c.coverStart+v<c.coverEnd&&tt(i.line.text.charAt(c.coverStart+v));)++v;if(f&&d<9&&m==0&&v==c.coverEnd-c.coverStart?k=p.parentNode.getBoundingClientRect():k=lw($(p,m,v).getClientRects(),s),k.left||k.right||m==0)break;v=m,m=m-1,b="right"}f&&d<11&&(k=cw(t.display.measure,k))}else{m>0&&(b=s="right");var I;t.options.lineWrapping&&(I=p.getClientRects()).length>1?k=I[s=="right"?I.length-1:0]:k=p.getBoundingClientRect()}if(f&&d<9&&!m&&(!k||!k.left&&!k.right)){var q=p.parentNode.getClientRects()[0];q?k={left:q.left,right:q.left+Qr(t.display),top:q.top,bottom:q.bottom}:k=ed}for(var H=k.top-i.rect.top,Q=k.bottom-i.rect.top,ee=(H+Q)/2,oe=i.view.measure.heights,le=0;le<oe.length-1&&!(ee<oe[le]);le++);var de=le?oe[le-1]:0,ue=oe[le],pe={left:(b=="right"?k.right:k.left)-i.rect.left,right:(b=="left"?k.left:k.right)-i.rect.left,top:de,bottom:ue};return!k.left&&!k.right&&(pe.bogus=!0),t.options.singleCursorHeightPerLine||(pe.rtop=H,pe.rbottom=Q),pe}function cw(t,i){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!nl(t))return i;var a=screen.logicalXDPI/screen.deviceXDPI,s=screen.logicalYDPI/screen.deviceYDPI;return{left:i.left*a,right:i.right*a,top:i.top*s,bottom:i.bottom*s}}function nd(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var i=0;i<t.rest.length;i++)t.measure.caches[i]={}}function rd(t){t.display.externalMeasure=null,z(t.display.lineMeasure);for(var i=0;i<t.display.view.length;i++)nd(t.display.view[i])}function Ki(t){rd(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function id(t){return y&&D?-(t.body.getBoundingClientRect().left-parseInt(getComputedStyle(t.body).marginLeft)):t.defaultView.pageXOffset||(t.documentElement||t.body).scrollLeft}function od(t){return y&&D?-(t.body.getBoundingClientRect().top-parseInt(getComputedStyle(t.body).marginTop)):t.defaultView.pageYOffset||(t.documentElement||t.body).scrollTop}function hl(t){var i=an(t),a=i.widgets,s=0;if(a)for(var c=0;c<a.length;++c)a[c].above&&(s+=Gi(a[c]));return s}function ps(t,i,a,s,c){if(!c){var p=hl(i);a.top+=p,a.bottom+=p}if(s=="line")return a;s||(s="local");var m=Mn(i);if(s=="local"?m+=ds(t.display):m-=t.display.viewOffset,s=="page"||s=="window"){var v=t.display.lineSpace.getBoundingClientRect();m+=v.top+(s=="window"?0:od(Ke(t)));var b=v.left+(s=="window"?0:id(Ke(t)));a.left+=b,a.right+=b}return a.top+=m,a.bottom+=m,a}function sd(t,i,a){if(a=="div")return i;var s=i.left,c=i.top;if(a=="page")s-=id(Ke(t)),c-=od(Ke(t));else if(a=="local"||!a){var p=t.display.sizer.getBoundingClientRect();s+=p.left,c+=p.top}var m=t.display.lineSpace.getBoundingClientRect();return{left:s-m.left,top:c-m.top}}function hs(t,i,a,s,c){return s||(s=he(t.doc,i.line)),ps(t,s,Zf(t,s,i.ch,c),a)}function ln(t,i,a,s,c,p){s=s||he(t.doc,i.line),c||(c=Gr(t,s));function m(Q,ee){var oe=xn(t,c,Q,ee?"right":"left",p);return ee?oe.left=oe.right:oe.right=oe.left,ps(t,s,oe,a)}var v=Le(s,t.doc.direction),b=i.ch,k=i.sticky;if(b>=s.text.length?(b=s.text.length,k="before"):b<=0&&(b=0,k="after"),!v)return m(k=="before"?b-1:b,k=="before");function B(Q,ee,oe){var le=v[ee],de=le.level==1;return m(oe?Q-1:Q,de!=oe)}var I=zn(v,b,k),q=lr,H=B(b,I,k=="before");return q!=null&&(H.other=B(b,q,k!="before")),H}function ad(t,i){var a=0;i=De(t.doc,i),t.options.lineWrapping||(a=Qr(t.display)*i.ch);var s=he(t.doc,i.line),c=Mn(s)+ds(t.display);return{left:a,right:a,top:c,bottom:c+s.height}}function gl(t,i,a,s,c){var p=K(t,i,a);return p.xRel=c,s&&(p.outside=s),p}function ml(t,i,a){var s=t.doc;if(a+=t.display.viewOffset,a<0)return gl(s.first,0,null,-1,-1);var c=R(s,a),p=s.first+s.size-1;if(c>p)return gl(s.first+s.size-1,he(s,p).text.length,null,1,1);i<0&&(i=0);for(var m=he(s,c);;){var v=fw(t,m,c,i,a),b=Hb(m,v.ch+(v.xRel>0||v.outside>0?1:0));if(!b)return v;var k=b.find(1);if(k.line==c)return k;m=he(s,c=k.line)}}function ld(t,i,a,s){s-=hl(i);var c=i.text.length,p=yn(function(m){return xn(t,a,m-1).bottom<=s},c,0);return c=yn(function(m){return xn(t,a,m).top>s},p,c),{begin:p,end:c}}function ud(t,i,a,s){a||(a=Gr(t,i));var c=ps(t,i,xn(t,a,s),"line").top;return ld(t,i,a,c)}function yl(t,i,a,s){return t.bottom<=a?!1:t.top>a?!0:(s?t.left:t.right)>i}function fw(t,i,a,s,c){c-=Mn(i);var p=Gr(t,i),m=hl(i),v=0,b=i.text.length,k=!0,B=Le(i,t.doc.direction);if(B){var I=(t.options.lineWrapping?pw:dw)(t,i,a,p,B,s,c);k=I.level!=1,v=k?I.from:I.to-1,b=k?I.to:I.from-1}var q=null,H=null,Q=yn(function(ye){var ge=xn(t,p,ye);return ge.top+=m,ge.bottom+=m,yl(ge,s,c,!1)?(ge.top<=c&&ge.left<=s&&(q=ye,H=ge),!0):!1},v,b),ee,oe,le=!1;if(H){var de=s-H.left<H.right-s,ue=de==k;Q=q+(ue?0:1),oe=ue?"after":"before",ee=de?H.left:H.right}else{!k&&(Q==b||Q==v)&&Q++,oe=Q==0?"after":Q==i.text.length?"before":xn(t,p,Q-(k?1:0)).bottom+m<=c==k?"after":"before";var pe=ln(t,K(a,Q,oe),"line",i,p);ee=pe.left,le=c<pe.top?-1:c>=pe.bottom?1:0}return Q=jn(i.text,Q,1),gl(a,Q,oe,le,s-ee)}function dw(t,i,a,s,c,p,m){var v=yn(function(I){var q=c[I],H=q.level!=1;return yl(ln(t,K(a,H?q.to:q.from,H?"before":"after"),"line",i,s),p,m,!0)},0,c.length-1),b=c[v];if(v>0){var k=b.level!=1,B=ln(t,K(a,k?b.from:b.to,k?"after":"before"),"line",i,s);yl(B,p,m,!0)&&B.top>m&&(b=c[v-1])}return b}function pw(t,i,a,s,c,p,m){var v=ld(t,i,s,m),b=v.begin,k=v.end;/\s/.test(i.text.charAt(k-1))&&k--;for(var B=null,I=null,q=0;q<c.length;q++){var H=c[q];if(!(H.from>=k||H.to<=b)){var Q=H.level!=1,ee=xn(t,s,Q?Math.min(k,H.to)-1:Math.max(b,H.from)).right,oe=ee<p?p-ee+1e9:ee-p;(!B||I>oe)&&(B=H,I=oe)}}return B||(B=c[c.length-1]),B.from<b&&(B={from:b,to:B.to,level:B.level}),B.to>k&&(B={from:B.from,to:k,level:B.level}),B}var fr;function Kr(t){if(t.cachedTextHeight!=null)return t.cachedTextHeight;if(fr==null){fr=A("pre",null,"CodeMirror-line-like");for(var i=0;i<49;++i)fr.appendChild(document.createTextNode("x")),fr.appendChild(A("br"));fr.appendChild(document.createTextNode("x"))}Z(t.measure,fr);var a=fr.offsetHeight/50;return a>3&&(t.cachedTextHeight=a),z(t.measure),a||1}function Qr(t){if(t.cachedCharWidth!=null)return t.cachedCharWidth;var i=A("span","xxxxxxxxxx"),a=A("pre",[i],"CodeMirror-line-like");Z(t.measure,a);var s=i.getBoundingClientRect(),c=(s.right-s.left)/10;return c>2&&(t.cachedCharWidth=c),c||10}function vl(t){for(var i=t.display,a={},s={},c=i.gutters.clientLeft,p=i.gutters.firstChild,m=0;p;p=p.nextSibling,++m){var v=t.display.gutterSpecs[m].className;a[v]=p.offsetLeft+p.clientLeft+c,s[v]=p.clientWidth}return{fixedPos:bl(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:a,gutterWidth:s,wrapperWidth:i.wrapper.clientWidth}}function bl(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function cd(t){var i=Kr(t.display),a=t.options.lineWrapping,s=a&&Math.max(5,t.display.scroller.clientWidth/Qr(t.display)-3);return function(c){if($n(t.doc,c))return 0;var p=0;if(c.widgets)for(var m=0;m<c.widgets.length;m++)c.widgets[m].height&&(p+=c.widgets[m].height);return a?p+(Math.ceil(c.text.length/s)||1)*i:p+i}}function wl(t){var i=t.doc,a=cd(t);i.iter(function(s){var c=a(s);c!=s.height&&Wt(s,c)})}function dr(t,i,a,s){var c=t.display;if(!a&&Hi(i).getAttribute("cm-not-content")=="true")return null