!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t){CodeMirror=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=r||i||o,a=l&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),u=s&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),x=/win/i.test(t),w=f&&e.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(f=!1,s=!0);var C=y&&(u||f&&(null==w||w<12.11)),k=n||l&&a>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L,T=function(e,t){var n=e.className,r=S(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return M(e).appendChild(t)}function O(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(e){}});var R=function(){this.id=null};function B(e,t){for(var n=0;n=t)return r+Math.min(l,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var $=[""];function Y(e){for(;$.length<=e;)$.push(_($)+" ");return $[e]}function _(e){return e[e.length-1]}function q(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\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 ie(e){return e.charCodeAt(0)>=768&&re.test(e)}function oe(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function ae(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?ge(n,ae(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?ge(e.line,t):n<0?ge(e.line,0):e}(t,ae(e,t.line).text.length)}function ke(e,t){for(var n=[],r=0;r=t:o.to>t);(r||(r=[])).push(new Te(l,o.from,s?null:o.to))}}return r}(n,i,l),s=function(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from0&&a)for(var x=0;x=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?me(u.to,n)>=0:me(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?me(u.from,r)<=0:me(u.from,r)<0)))return!0}}}function Be(e){for(var t;t=Ie(e);)e=t.find(-1,!0).line;return e}function je(e,t){var n=ae(e,t),r=Be(n);return n==r?t:fe(r)}function Ve(e,t){if(t>e.lastLine())return t;var n,r=ae(e,t);if(!Ge(e,r))return t;for(;n=ze(r);)r=n.find(1,!0).line;return fe(r)+1}function Ge(e,t){var n=Le&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}var Ye=null;function _e(e,t,n){var r;Ye=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:Ye=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Ye=i)}return null!=r?r:Ye}var qe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,l=/[1n]/;function a(e,t,n){this.level=e,this.from=t,this.to=n}return function(s,u){var c,f="ltr"==u?"L":"R";if(0==s.length||"ltr"==u&&!n.test(s))return!1;for(var h=s.length,d=[],p=0;p-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function nt(e,t){var n=et(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function lt(e){e.prototype.on=function(e,t){Je(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function at(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function st(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ut(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ct(e){at(e),st(e)}function ft(e){return e.target||e.srcElement}function ht(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var dt,pt,gt=function(){if(l&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function mt(e){if(null==dt){var t=O("span","​");A(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(dt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8))}var n=dt?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function vt(e){if(null!=pt)return pt;var t=A(e,document.createTextNode("AخA")),n=L(t,0,1).getBoundingClientRect(),r=L(t,1,2).getBoundingClientRect();return M(e),!(!n||n.left==n.right)&&(pt=r.right-n.right<3)}var yt,bt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},xt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},wt="oncopy"in(yt=O("div"))||(yt.setAttribute("oncopy","return;"),"function"==typeof yt.oncopy),Ct=null,kt={},St={};function Lt(e){if("string"==typeof e&&St.hasOwnProperty(e))e=St[e];else if(e&&"string"==typeof e.name&&St.hasOwnProperty(e.name)){var t=St[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Lt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Lt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Tt(e,t){t=Lt(t);var n=kt[t.name];if(!n)return Tt(e,"text/plain");var r=n(e,t);if(Mt.hasOwnProperty(t.name)){var i=Mt[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var Mt={};function At(e,t){var n=Mt.hasOwnProperty(e)?Mt[e]:Mt[e]={};I(t,n)}function Ot(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Nt(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Wt(e,t,n){return!e.startState||e.startState(t,n)}var Dt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Dt.prototype.eol=function(){return this.pos>=this.string.length},Dt.prototype.sol=function(){return this.pos==this.lineStart},Dt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Dt.prototype.next=function(){if(this.post},Dt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Dt.prototype.skipToEnd=function(){this.pos=this.string.length},Dt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Dt.prototype.backUp=function(e){this.pos-=e},Dt.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},Dt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Dt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Dt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Dt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Ht=function(e,t){this.state=e,this.lookAhead=t},Et=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function Pt(e,t,n,r){var i=[e.state.modeGen],o={};Ut(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var l=n.state,a=function(r){n.baseTokens=i;var a=e.state.overlays[r],s=1,u=0;n.state=!0,Ut(e,t.text,a.mode,n,function(e,t){for(var n=s;ue&&i.splice(s,1,e,i[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&Ot(e.doc.mode,r.state),o=Pt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function It(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Et(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=ae(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof Ht?u.lookAhead:0)<=o.modeFrontier))return a;var c=z(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=a-1,r=c)}return i}(e,t,n),l=o>r.first&&ae(r,o-1).stateAfter,a=l?Et.fromSaved(r,l,o):new Et(r,Wt(r.mode),o);return r.iter(o,t,function(n){zt(e,n.text,a);var r=a.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Et.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Et.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Et.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Et.fromSaved=function(e,t,n){return t instanceof Ht?new Et(e,Ot(e.mode,t.state),n,t.lookAhead):new Et(e,Ot(e.mode,t),n)},Et.prototype.save=function(e){var t=!1!==e?Ot(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ht(t,this.maxLookAhead):t};var jt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Vt(e,t,n,r){var i,o=e.doc,l=o.mode;t=Ce(o,t);var a,s=ae(o,t.line),u=It(e,t.line,n),c=new Dt(s.text,e.options.tabSize,u);for(r&&(a=[]);(r||c.pose.options.maxHighlightLength?(a=!1,l&&zt(e,t,r,f.pos),f.pos=t.length,s=null):s=Gt(Bt(n,f,r.state,h),o),h){var d=h[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!a||c!=s){for(;u1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iu&&f.from<=u);h++);if(f.to>=c)return e(n,r,i,o,l,a,s);e(n,r.slice(0,f.to-u),i,o,null,a,s),o=null,r=r.slice(f.to-u),u=f.to}}}function en(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function tn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,a,s,u,c,f,h,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=u=c=f=a="",h=null,v=1/0;for(var y=[],b=void 0,x=0;xp||C.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,u=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&w.from==p&&(c+=" "+C.startStyle),C.endStyle&&w.to==v&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!f&&(f=C.title),C.collapsed&&(!h||Pe(h.marker,C)<0)&&(h=w)):w.from>p&&v>w.from&&(v=w.from)}if(b)for(var k=0;k=d)break;for(var L=Math.min(d,v);;){if(m){var T=p+m.length;if(!h){var M=T>L?m.slice(0,L-p):m;t.addToken(t,M,l?l+s:s,c,p+M.length==v?u:"",f,a)}if(T>=L){m=m.slice(L-p),p=L;break}p=T,c=""}m=i.slice(o,o=n[g++]),l=_t(n[g++],t.cm.options)}}else for(var A=1;An)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function On(e,t,n,r){return Dn(e,Wn(e,t),n,r)}function Nn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Pn(t.map,n,r),s=o.node,u=o.start,c=o.end,f=o.collapse;if(3==s.nodeType){for(var h=0;h<4;h++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var d;u>0&&(f=r="right"),i=e.options.lineWrapping&&(d=s.getClientRects()).length>1?d["right"==r?d.length-1:0]:s.getBoundingClientRect()}if(l&&a<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+tr(e.display),top:p.top,bottom:p.bottom}:En}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;bt)&&(i=(o=s-a)-1,t>=s&&(l="right")),null!=i){if(r=e[u+2],a==s&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],l="left";if("right"==n&&i==s-a)for(;u=0&&(n=e[i]).left==n.right;i--);return n}function In(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return l("before"==u?s-1:s,"before"==u);function c(e,t,n){var r=a[t],i=1==r.level;return l(n?e-1:e,i!=n)}var f=_e(a,s,u),h=Ye,d=c(s,f,"before"==u);return null!=h&&(d.other=c(s,h,"before"!=u)),d}function $n(e,t){var n=0;t=Ce(e.doc,t),e.options.lineWrapping||(n=tr(e.display)*t.ch);var r=ae(e.doc,t.line),i=Ke(r)+Cn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Yn(e,t,n,r,i){var o=ge(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function _n(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Yn(r.first,0,null,!0,-1);var i=he(r,n),o=r.first+r.size-1;if(i>o)return Yn(r.first+r.size-1,ae(r,o).text.length,null,!0,1);t<0&&(t=0);for(var l=ae(r,i);;){var a=Jn(e,l,i,t,n),s=ze(l),u=s&&s.find(0,!0);if(!s||!(a.ch>u.from.ch||a.ch==u.from.ch&&a.xRel>0))return a;i=fe(l=u.to.line)}}function qn(e,t,n,r){r-=Vn(t);var i=t.text.length,o=le(function(t){return Dn(e,n,t-1).bottom<=r},i,0);return i=le(function(t){return Dn(e,n,t).top>r},o,i),{begin:o,end:i}}function Zn(e,t,n,r){n||(n=Wn(e,t));var i=Gn(e,t,Dn(e,n,r),"line").top;return qn(e,t,n,i)}function Qn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Jn(e,t,n,r,i){i-=Ke(t);var o=Wn(e,t),l=Vn(t),a=0,s=t.text.length,u=!0,c=Ze(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?function(e,t,n,r,i,o,l){var a=qn(e,t,r,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,h=0;h=u||d.to<=s)){var p=1!=d.level,g=Dn(e,r,p?Math.min(u,d.to)-1:Math.max(s,d.from)).right,m=gm)&&(c=d,f=m)}}return c||(c=i[i.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}:function(e,t,n,r,i,o,l){var a=le(function(a){var s=i[a],u=1!=s.level;return Qn(Xn(e,ge(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,l,!0)},0,i.length-1),s=i[a];if(a>0){var u=1!=s.level,c=Xn(e,ge(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Qn(c,o,l,!0)&&c.top>l&&(s=i[a-1])}return s})(e,t,n,o,c,r,i);u=1!=f.level,a=u?f.from:f.to-1,s=u?f.to:f.from-1}var h,d,p=null,g=null,m=le(function(t){var n=Dn(e,o,t);return n.top+=l,n.bottom+=l,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,g=n),!0)},a,s),v=!1;if(g){var y=r-g.left=x.bottom}return m=oe(t.text,m,1),Yn(n,m,d,v,r-h)}function er(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Hn){Hn=O("pre");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(O("br"));Hn.appendChild(document.createTextNode("x"))}A(e.measure,Hn);var n=Hn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),M(e.measure),n||1}function tr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),n=O("pre",[t]);A(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function nr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)n[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[l]]=o.clientWidth;return{fixedPos:rr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function rr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ir(e){var t=er(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/tr(e.display)-3);return function(i){if(Ge(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r=e.display.viewTo||a.to().linet||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(g,n||0,null==r?h:r,function(e,t,i,f){var m="ltr"==i,v=d(e,m?"left":"right"),y=d(t-1,m?"right":"left"),b=null==n&&0==e,x=null==r&&t==h,w=0==f,C=!g||f==g.length-1;if(y.top-v.top<=3){var k=(u?b:x)&&w,S=(u?x:b)&&C,L=k?a:(m?v:y).left,T=S?s:(m?y:v).right;c(L,v.top,T-L,v.bottom)}else{var M,A,O,N;m?(M=u&&b&&w?a:v.left,A=u?s:p(e,i,"before"),O=u?a:p(t,i,"after"),N=u&&x&&C?s:y.right):(M=u?p(e,i,"before"):a,A=!u&&b&&w?s:v.right,O=!u&&x&&C?a:y.left,N=u?p(t,i,"after"):s),c(M,v.top,A-M,v.bottom),v.bottom0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function pr(e){e.state.focused||(e.display.input.focus(),mr(e))}function gr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vr(e))},100)}function mr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(nt(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),dr(e))}function vr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(nt(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||c<-.005)&&(ce(i.line,o),br(i.line),i.rest))for(var f=0;f=l&&(o=he(t,Ke(ae(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function wr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=rr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;lo&&(t.bottom=t.top+o);var a=e.doc.height+kn(n),s=t.topa-r;if(t.topi+o){var c=Math.min(t.top,(u?a:t.bottom)-o);c!=i&&(l.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,h=Tn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),d=t.right-t.left>h;return d&&(t.right=t.left+h),t.left<10?l.scrollLeft=0:t.lefth+f-3&&(l.scrollLeft=t.right+(d?0:10)-h),l}function Sr(e,t){null!=t&&(Mr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Lr(e){Mr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Tr(e,t,n){null==t&&null==n||Mr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Mr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=$n(e,t.from),r=$n(e,t.to);Ar(e,n,r,t.margin)}}function Ar(e,t,n,r){var i=kr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Tr(e,i.scrollLeft,i.scrollTop)}function Or(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||li(e,{top:t}),Nr(e,t,!0),n&&li(e),ti(e,100))}function Nr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Wr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,wr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Dr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+kn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ln(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Hr=function(e,t,n){this.cm=n;var r=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Je(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Je(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Hr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,r)})},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Er=function(){};function Pr(e,t){t||(t=Dr(e));var n=e.display.barWidth,r=e.display.barHeight;Fr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&yr(e),Fr(e,Dr(e)),n=e.display.barWidth,r=e.display.barHeight}function Fr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Er.prototype.update=function(){return{bottom:0,right:0}},Er.prototype.setScrollLeft=function(){},Er.prototype.setScrollTop=function(){},Er.prototype.clear=function(){};var Ir={native:Hr,null:Er};function zr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ir[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Je(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?Wr(e,t):Or(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Rr=0;function Br(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Rr},t=e.curOp,on?on.ops.push(t):t.ownsGroup=on={ops:[t],delayedCallbacks:[]}}function jr(e){var t=e.curOp;!function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ri(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Gr(e){var t=e.cm,n=t.display;e.updatedDisplay&&yr(t),e.barMeasure=Dr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=On(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ln(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Tn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Ur(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft1&&(l=!0)),null!=u.scrollLeft&&(Wr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(l=!0)),!l)break}return i}(t,Ce(r,e.scrollToPos.from),Ce(r,e.scrollToPos.to),e.scrollToPos.margin);!function(e,t){if(!rt(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=O("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Cn(e.display))+"px;\n height: "+(t.bottom-t.top+Ln(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var a=0;at)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Le&&je(e.doc,t)i.viewFrom?Qr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Qr(e);else if(t<=i.viewFrom){var o=Jr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Qr(e)}else if(n>=i.viewTo){var l=Jr(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Qr(e)}else{var a=Jr(e,t,t,-1),s=Jr(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(rn(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):Qr(e)}var u=i.externalMeasured;u&&(n=i.lineN&&t=r.viewTo)){var o=r.view[ar(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==B(l,n)&&l.push(n)}}}function Qr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Jr(e,t,n,r){var i,o=ar(e,t),l=e.display.view;if(!Le||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var a=e.display.viewFrom,s=0;s0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,n+=i}for(;je(e.doc,n)!=n;){if(o==(r<0?0:l.length-1))return null;n+=r*l[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function ei(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo)){var n=+new Date+e.options.workTime,r=It(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?Ot(t.mode,r.state):null,s=Pt(e,o,r,!0);a&&(r.state=a),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!f&&hn)return ti(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Xr(e,function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==ei(e))return!1;Cr(e)&&(Qr(e),t.dims=nr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroml&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),Le&&(o=je(e.doc,o),l=Ve(e.doc,l));var a=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=rn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=rn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,ar(e,n)))),r.viewTo=n}(e,o,l),n.viewOffset=Ke(ae(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=ei(e);if(!a&&0==u&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=D();if(!t||!W(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&W(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return u>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,l=o.firstChild;function a(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,f=0;f-1&&(d=!1),un(e,h,c,n)),d&&(M(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(pe(e.options,c)))),l=h.node.nextSibling}else{var p=mn(e,h,c,n);o.insertBefore(p,l)}c+=h.size}for(;l;)l=a(l)}(e,n.updateLineNumbers,t.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=D()&&(e.activeElt.focus(),e.anchorNode&&W(document.body,e.anchorNode)&&W(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ti(e,400)),n.updateLineNumbers=null,!0}function oi(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Tn(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+kn(e.display)-Mn(e),n.top)}),t.visible=xr(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ii(e,t);r=!1){yr(e);var i=Dr(e);sr(e),Pr(e,i),si(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function li(e,t){var n=new ri(e,t);if(ii(e,n)){yr(e),oi(e,n);var r=Dr(e);sr(e),Pr(e,r),si(e,r),n.finish()}}function ai(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function si(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ln(e)+"px"}function ui(e){var t=e.display.gutters,n=e.options.gutters;M(t);for(var r=0;r-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ri.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},ri.prototype.finish=function(){for(var e=0;ea.clientWidth,c=a.scrollHeight>a.clientHeight;if(i&&u||o&&c){if(o&&y&&s)e:for(var h=t.target,d=l.view;h!=a;h=h.parentNode)for(var p=0;p=0&&me(e,r.to())<=0)return n}return-1};var vi=function(e,t){this.anchor=e,this.head=t};function yi(e,t){var n=e[t];e.sort(function(e,t){return me(e.from(),t.from())}),t=B(e,n);for(var r=1;r=0){var l=xe(o.from(),i.from()),a=be(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new vi(s?a:l,s?l:a))}}return new mi(e,t)}function bi(e,t){return new mi([new vi(e,t||e)],0)}function xi(e){return e.text?ge(e.from.line+e.text.length-1,_(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function wi(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xi(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xi(t).ch-t.to.ch),ge(n,r)}function Ci(e,t){for(var n=[],r=0;r1&&e.remove(a.line+1,p-1),e.insert(a.line+1,v)}an(e,"change",e,t)}function Ai(e,t,n){!function e(r,i,o){if(r.linked)for(var l=0;la-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Hi(e.done),_(e.done)):e.done.length&&!_(e.done).ranges?_(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),_(e.done)):void 0}(i,i.lastOp==r)))l=_(o.changes),0==me(t.from,t.to)&&0==me(t.from,l.to)?l.to=xi(t):o.changes.push(Di(e,t));else{var s=_(i.done);for(s&&s.ranges||Fi(e.sel,i.done),o={changes:[Di(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||nt(e,"historyAdded")}function Pi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,_(i.done),t))?i.done[i.done.length-1]=t:Fi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Hi(i.undone)}function Fi(e,t){var n=_(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Ii(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function zi(e){if(!e)return null;for(var t,n=0;n-1&&(_(a)[f]=u[f],delete u[f])}}}return r}function ji(e,t,n,r){if(r){var i=e.anchor;if(n){var o=me(t,i)<0;o!=me(n,i)<0?(i=t,t=n):o!=me(t,n)<0&&(t=n)}return new vi(i,t)}return new vi(n||t,t)}function Vi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),$i(e,new mi([ji(e.sel.primary(),t,n,i)],0),r)}function Gi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:a.to>t.ch))){if(i&&(nt(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!s.atomic)continue;if(n){var u=s.find(r<0?1:-1),c=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(u=eo(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=me(u,n))&&(r<0?c<0:c>0))return Qi(e,u,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=eo(e,f,r,f.line==t.line?o:null)),f?Qi(e,f,t,r,i):null}}return t}function Ji(e,t,n,r,i){var o=r||1,l=Qi(e,t,n,o,i)||!i&&Qi(e,t,n,o,!0)||Qi(e,t,n,-o,i)||!i&&Qi(e,t,n,-o,!0);return l||(e.cantEdit=!0,ge(e.first,0))}function eo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?Ce(e,ge(t.line-1)):null:n>0&&t.ch==(r||ae(e,t.line)).text.length?t.line0)){var c=[s,1],f=me(u.from,a.from),h=me(u.to,a.to);(f<0||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:a.from}),(h>0||!l.inclusiveRight&&!h)&&c.push({from:a.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)io(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else io(e,t)}}function io(e,t){if(1!=t.text.length||""!=t.text[0]||0!=me(t.from,t.to)){var n=Ci(e,t);Ei(e,t,n,e.cm?e.cm.curOp.id:NaN),ao(e,t,n,Oe(e,t));var r=[];Ai(e,function(e,n){n||-1!=B(r,e.history)||(fo(e.history,t),r.push(e.history)),ao(e,t,null,Oe(e,t))})}}function oo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,l=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u=0;--d){var p=h(d);if(p)return p.v}}}}function lo(e,t){if(0!=t&&(e.first+=t,e.sel=new mi(q(e.sel.ranges,function(e){return new vi(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){qr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:ge(o,ae(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=se(e,t.from,t.to),n||(n=Ci(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=fe(Be(ae(r,o.line))),r.iter(s,l.line+1,function(e){if(e==i.maxLine)return a=!0,!0})),r.sel.contains(t.from,t.to)>-1&&it(e),Mi(r,t,n,ir(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(e){var t=Xe(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=ae(e,r).stateAfter;if(i&&(!(i instanceof Ht)||r+i.lookAhead1||!(this.children[0]instanceof po))){var a=[];this.collapse(a),this.children=[new po(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var l=i.lines.length%25+25,a=l;a10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Re(e,t.line,t,n,o)||t.line!=n.line&&Re(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le=!0}o.addToHistory&&Ei(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,s=t.line,u=e.cm;if(e.iter(s,n.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&Be(e)==u.display.maxLine&&(a=!0),o.collapsed&&s!=t.line&&ce(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Te(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){Ge(e,t)&&ce(t,0)}),o.clearOnEnter&&Je(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Se=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)qr(u,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=n.line;c++)Zr(u,c,"text");o.atomic&&qi(u.doc),an(u,"markerAdded",u,o)}return o}bo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Br(e),ot(this,"clear")){var n=this.find();n&&an(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&qr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&qi(e.doc)),e&&an(e,"markerCleared",e,this,r,i),t&&jr(e),this.parent&&this.parent.clear()}},bo.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;s--)ro(this,r[s]);a?Xi(this,a):this.cm&&Lr(this.cm)}),undo:_r(function(){oo(this,"undo")}),redo:_r(function(){oo(this,"redo")}),undoSelection:_r(function(){oo(this,"undo",!0)}),redoSelection:_r(function(){oo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=Ce(this,e),t=Ce(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var a=0;a=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),Ce(this,ge(n,t))},indexFromPos:function(e){var t=(e=Ce(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Yi(t.doc,bi(n,n)),f)for(var h=0;h=0;t--)so(e.doc,"",r[t].from,r[t].to,"+delete");Lr(e)})}function Xo(e,t,n){var r=oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function $o(e,t,n){var r=Xo(e,t.ch,n);return null==r?null:new ge(t.line,r,n<0?"after":"before")}function Yo(e,t,n,r,i){if(e){var o=Ze(n,t.doc.direction);if(o){var l,a=i<0?_(o):o[0],s=i<0==(1==a.level),u=s?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=Wn(t,n);l=i<0?n.text.length-1:0;var f=Dn(t,c,l).top;l=le(function(e){return Dn(t,c,e).top==f},i<0==(1==a.level)?a.from:a.to-1,l),"before"==u&&(l=Xo(n,l,1))}else l=i<0?a.to:a.from;return new ge(r,l,u)}}return new ge(r,i<0?n.text.length:0,i<0?"before":"after")}Io.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Io.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Io.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Io.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Io.default=y?Io.macDefault:Io.pcDefault;var _o={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),G)},killLine:function(e){return Ko(e,function(t){if(t.empty()){var n=ae(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new ge(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=ae(e.doc,i.line-1).text;l&&(i=new ge(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ge(i.line-1,l.length-1),i,"+transpose"))}n.push(new vi(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Xr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r-1&&(me((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(me(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,u=$r(e,function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,tt(document,"mouseup",u),tt(document,"mousemove",c),tt(i.scroller,"dragstart",f),tt(i.scroller,"drop",u),o||(at(t),r.addNew||Vi(e.doc,n,null,null,r.extend),s||l&&9==a?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Je(document,"mouseup",u),Je(document,"mousemove",c),Je(i.scroller,"dragstart",f),Je(i.scroller,"drop",u),gr(e),setTimeout(function(){return i.input.focus()},20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;at(t);var l,a,s=o.sel,u=s.ranges;if(r.addNew&&!r.extend?(a=o.sel.contains(n),l=a>-1?u[a]:new vi(n,n)):(l=o.sel.primary(),a=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(l=new vi(n,n)),n=lr(e,t,!0,!0),a=-1;else{var c=fl(e,n,r.unit);l=r.extend?ji(l,c.anchor,c.head,r.extend):c}r.addNew?-1==a?(a=u.length,$i(o,yi(u.concat([l]),a),{scroll:!1,origin:"*mouse"})):u.length>1&&u[a].empty()&&"char"==r.unit&&!r.extend?($i(o,yi(u.slice(0,a).concat(u.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Ui(o,a,l,U):(a=0,$i(o,new mi([l],0),U),s=o.sel);var f=n;function h(t){if(0!=me(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],u=e.options.tabSize,c=z(ae(o,n.line).text,n.ch,u),h=z(ae(o,t.line).text,t.ch,u),d=Math.min(c,h),p=Math.max(c,h),g=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=m;g++){var v=ae(o,g).text,y=X(v,d,u);d==p?i.push(new vi(ge(g,y),ge(g,y))):v.length>y&&i.push(new vi(ge(g,y),ge(g,X(v,p,u))))}i.length||i.push(new vi(n,n)),$i(o,yi(s.ranges.slice(0,a).concat(i),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,x=l,w=fl(e,t,r.unit),C=x.anchor;me(w.anchor,C)>0?(b=w.head,C=xe(x.from(),w.anchor)):(b=w.anchor,C=be(x.to(),w.head));var k=s.ranges.slice(0);k[a]=function(e,t){var n=t.anchor,r=t.head,i=ae(e.doc,n.line);if(0==me(n,r)&&n.sticky==r.sticky)return t;var o=Ze(i);if(!o)return t;var l=_e(o,n.ch,n.sticky),a=o[l];if(a.from!=n.ch&&a.to!=n.ch)return t;var s,u=l+(a.from==n.ch==(1!=a.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=_e(o,r.ch,r.sticky),f=c-l||(r.ch-n.ch)*(1==a.level?-1:1);s=c==u-1||c==u?f<0:f>0}var h=o[u+(s?-1:0)],d=s==(1==h.level),p=d?h.from:h.to,g=d?"after":"before";return n.ch==p&&n.sticky==g?t:new vi(new ge(n.line,p,g),r)}(e,new vi(Ce(o,C),b)),$i(o,yi(k,a),U)}}var d=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,at(t),i.input.focus(),tt(document,"mousemove",m),tt(document,"mouseup",v),o.history.lastSelOrigin=null}var m=$r(e,function(t){ht(t)?function t(n){var l=++p,a=lr(e,n,!0,"rectangle"==r.unit);if(a)if(0!=me(a,f)){e.curOp.focus=D(),h(a);var s=xr(i,o);(a.line>=s.to||a.lined.bottom?20:0;u&&setTimeout($r(e,function(){p==l&&(i.scroller.scrollTop+=u,t(n))}),50)}}(t):g(t)}),v=$r(e,g);e.state.selectingText=v,Je(document,"mousemove",m),Je(document,"mouseup",v)}(e,r,t,o)}(t,r,o,e):ft(e)==n.scroller&&at(e):2==i?(r&&Vi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):3==i&&(k?pl(t,e):gr(t)))}}function fl(e,t,n){if("char"==n)return new vi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new vi(ge(t.line,0),Ce(e.doc,ge(t.line+1,0)));var r=n(e,t);return new vi(r.from,r.to)}function hl(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&at(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!ot(e,n))return ut(t);o-=a.top-l.viewOffset;for(var s=0;s=i){var c=he(e.doc,o),f=e.options.gutters[s];return nt(e,n,e,c,f,t),ut(t)}}}function dl(e,t){return hl(e,t,"gutterClick",!0)}function pl(e,t){wn(e.display,t)||function(e,t){return!!ot(e,"gutterContextMenu")&&hl(e,t,"gutterContextMenu",!1)}(e,t)||rt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function gl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Rn(e)}ul.prototype.compare=function(e,t,n){return this.time+400>e&&0==me(t,this.pos)&&n==this.button};var ml={toString:function(){return"CodeMirror.Init"}},vl={},yl={};function bl(e){ui(e),qr(e),wr(e)}function xl(e,t,n){var r=n&&n!=ml;if(!t!=!r){var i=e.display.dragFunctions,o=t?Je:tt;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function wl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),$e(e)),or(e),qr(e),Rn(e),setTimeout(function(){return Pr(e)},100)}function Cl(e,t){var r=this;if(!(this instanceof Cl))return new Cl(e,t);this.options=t=t?I(t):{},I(vl,t,!1),ci(t);var i=t.value;"string"==typeof i&&(i=new Lo(i,t.mode,null,t.lineSeparator,t.direction)),this.doc=i;var o=new Cl.inputStyles[t.inputStyle](this),u=this.display=new function(e,t,r){var i=this;this.input=r,i.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=N("div",null,"CodeMirror-code"),i.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=O("div",null,"CodeMirror-cursors"),i.measure=O("div",null,"CodeMirror-measure"),i.lineMeasure=O("div",null,"CodeMirror-measure"),i.lineSpace=N("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=N("div",[i.lineSpace],"CodeMirror-lines");i.mover=O("div",[o],null,"position: relative"),i.sizer=O("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=O("div",null,null,"position: absolute; height: "+j+"px; width: 1px;"),i.gutters=O("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=O("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=O("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),l&&a<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),s||n&&v||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,r.init(i)}(e,i,o);for(var c in u.wrapper.CodeMirror=this,ui(this),gl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),zr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new R,keySeq:null,specialChars:null},t.autofocus&&!v&&u.input.focus(),l&&a<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(e){var t=e.display;Je(t.scroller,"mousedown",$r(e,cl)),Je(t.scroller,"dblclick",l&&a<11?$r(e,function(t){if(!rt(e,t)){var n=lr(e,t);if(n&&!dl(e,t)&&!wn(e.display,t)){at(t);var r=e.findWordAt(n);Vi(e.doc,r.anchor,r.head)}}}):function(t){return rt(e,t)||at(t)}),k||Je(t.scroller,"contextmenu",function(t){return pl(e,t)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}Je(t.scroller,"touchstart",function(i){if(!rt(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!dl(e,i)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),Je(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Je(t.scroller,"touchend",function(n){var r=t.activeTouch;if(r&&!wn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var l,a=e.coordsChar(t.activeTouch,"page");l=!r.prev||o(r,r.prev)?new vi(a,a):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(a):new vi(ge(a.line,0),Ce(e.doc,ge(a.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),at(n)}i()}),Je(t.scroller,"touchcancel",i),Je(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Or(e,t.scroller.scrollTop),Wr(e,t.scroller.scrollLeft,!0),nt(e,"scroll",e))}),Je(t.scroller,"mousewheel",function(t){return gi(e,t)}),Je(t.scroller,"DOMMouseScroll",function(t){return gi(e,t)}),Je(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){rt(e,t)||ct(t)},over:function(t){rt(e,t)||(function(e,t){var n=lr(e,t);if(n){var r=document.createDocumentFragment();cr(e,n,r),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,r)}}(e,t),ct(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-To<100))ct(t);else if(!rt(e,t)&&!wn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=O("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}(e,t)},drop:$r(e,Mo),leave:function(t){rt(e,t)||Ao(e)}};var s=t.input.getField();Je(s,"keyup",function(t){return ol.call(e,t)}),Je(s,"keydown",$r(e,il)),Je(s,"keypress",$r(e,ll)),Je(s,"focus",function(t){return mr(e,t)}),Je(s,"blur",function(t){return vr(e,t)})}(this),Wo(),Br(this),this.curOp.forceUpdate=!0,Oi(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout(F(mr,this),20):vr(this),yl)yl.hasOwnProperty(c)&&yl[c](r,t[c],ml);Cr(this),t.finishInit&&t.finishInit(this);for(var d=0;d150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?z(ae(o,t-1).text,null,l):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)h+=l,f+="\t";if(h1)if(Ll&&Ll.text.join("\n")==t){if(r.ranges.length%Ll.text.length==0){u=[];for(var c=0;c=0;f--){var h=r.ranges[f],d=h.from(),p=h.to();h.empty()&&(n&&n>0?d=ge(d.line,d.ch-n):e.state.overwrite&&!a?p=ge(p.line,Math.min(ae(o,p.line).text.length,p.ch+_(s).length)):Ll&&Ll.lineWise&&Ll.text.join("\n")==t&&(d=p=ge(d.line,0))),l=e.curOp.updateInput;var g={from:d,to:p,text:u?u[f%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};ro(e.doc,g),an(e,"inputRead",e,g)}t&&!a&&Ol(e,t),Lr(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Al(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Xr(t,function(){return Ml(t,n,0,null,"paste")}),!0}function Ol(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var a=0;a-1){l=Sl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Sl(e,i.head.line,"smart"));l&&an(e,"electricInput",e,i.head.line)}}}function Nl(e){for(var t=[],n=[],r=0;r=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=_e(i,n.ch,n.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(r>0?l.to>n.ch:l.from=l.from&&h>=c.begin)){var d=f?"before":"after";return new ge(n.line,h,d)}}var p=function(e,t,r){for(var o=function(e,t){return t?new ge(n.line,s(e,1),"before"):new ge(n.line,e,"after")};e>=0&&e0==(1!=l.level),u=a?r.begin:s(r.end,-1);if(l.from<=u&&u0?c.end:s(c.begin,-1);return null==m||r>0&&m==t.text.length||!(g=p(r>0?0:i.length-1,r,u(m)))?null:g}(e.cm,a,t,n):$o(a,t,n))){if(r||((l=t.line+n)=e.first+e.size||(t=new ge(l,t.ch,t.sticky),!(a=ae(e,l)))))return!1;t=Yo(i,e.cm,a,t.line,n)}else t=o;return!0}if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var u=null,c="group"==r,f=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(n<0)||s(!h);h=!1){var d=a.text.charAt(t.ch)||"\n",p=te(d,f)?"w":c&&"\n"==d?"n":!c||/\s/.test(d)?null:"p";if(!c||h||p||(p="s"),u&&u!=p){n<0&&(n=1,s(),t.sticky="after");break}if(p&&(u=p),n>0&&!s(!h))break}var g=Ji(e,t,o,l,!0);return ve(o,g)&&(g.hitSide=!0),g}function El(e,t,n,r){var i,o,l=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*er(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=_n(e,a,i)).outside;){if(n<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*n}return o}var Pl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Fl(e,t){var n=Nn(e,t.line);if(!n||n.hidden)return null;var r=ae(e.doc,t.line),i=An(n,r,t.line),o=Ze(r,e.doc.direction),l="left";if(o){var a=_e(o,t.ch);l=a%2?"right":"left"}var s=Pn(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Il(e,t){return t&&(e.bad=!0),e}function zl(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Il(e.clipPos(ge(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&Fl(t,i)||{node:s[0].measure.map[2],offset:0},c=o.liner.firstLine()&&(l=ge(l.line-1,ae(r.doc,l.line-1).length)),a.ch==ae(r.doc,a.line).text.length&&a.linei.viewTo-1)return!1;l.line==i.viewFrom||0==(e=ar(r,l.line))?(t=fe(i.view[0].line),n=i.view[0].node):(t=fe(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,u,c=ar(r,a.line);if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=fe(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var f=r.doc.splitLines(function(e,t,n,r,i){var o="",l=!1,a=e.doc.lineSeparator();function s(){l&&(o+=a,l=!1)}function u(e){e&&(s(),o+=e)}function c(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return void u(n||t.textContent.replace(/\u200b/g,""));var o,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(ge(r,0),ge(i+1,0),(g=+f,function(e){return e.id==g}));return void(h.length&&(o=h[0].find(0))&&u(se(e.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p)$/i.test(t.nodeName);d&&s();for(var p=0;p1&&h.length>1;)if(_(f)==_(h))f.pop(),h.pop(),s--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),t++}for(var d=0,p=0,g=f[0],m=h[0],v=Math.min(g.length,m.length);dl.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var w=ge(t,d),C=ge(s,h.length?_(h).length-p:0);return f.length>1||f[0]||me(w,C)?(so(r.doc,f,w,C,"+input"),!0):void 0},Pl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Pl.prototype.reset=function(){this.forceCompositionEnd()},Pl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Pl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Pl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Xr(this.cm,function(){return qr(e.cm)})},Pl.prototype.setUneditable=function(e){e.contentEditable="false"},Pl.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||$r(this.cm,Ml)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Pl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Pl.prototype.onContextMenu=function(){},Pl.prototype.resetPosition=function(){},Pl.prototype.needsContentAttribute=!0;var Bl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};Bl.prototype.init=function(e){var t=this,n=this,r=this.cm,i=this.wrapper=Dl(),o=this.textarea=i.firstChild;function s(e){if(!rt(r,e)){if(r.somethingSelected())Tl({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Nl(r);Tl({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,G):(n.prevInput="",o.value=t.text.join("\n"),P(o))}"cut"==e.type&&(r.state.cutIncoming=!0)}}e.wrapper.insertBefore(i,e.wrapper.firstChild),g&&(o.style.width="0px"),Je(o,"input",function(){l&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Je(o,"paste",function(e){rt(r,e)||Al(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Je(o,"cut",s),Je(o,"copy",s),Je(e.scroller,"paste",function(t){wn(e,t)||rt(r,t)||(r.state.pasteIncoming=!0,n.focus())}),Je(e.lineSpace,"selectstart",function(t){wn(e,t)||at(t)}),Je(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Je(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Bl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ur(e);if(e.options.moveInputWithCursor){var i=Xn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},Bl.prototype.showSelection=function(e){var t=this.cm,n=t.display;A(n.cursorDiv,e.cursors),A(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Bl.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),l&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",l&&a>=9&&(this.hasSelection=null))}},Bl.prototype.getField=function(){return this.textarea},Bl.prototype.supportsTouch=function(){return!1},Bl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Bl.prototype.blur=function(){this.textarea.blur()},Bl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Bl.prototype.receivedFocus=function(){this.slowPoll()},Bl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Bl.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function n(){var r=t.poll();r||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))})},Bl.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||xt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(l&&a>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,u=Math.min(r.length,i.length);s1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Bl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Bl.prototype.onKeyPress=function(){l&&a>=9&&(this.hasSelection=null),this.fastPoll()},Bl.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea,o=lr(n,e),u=r.scroller.scrollTop;if(o&&!f){var c=n.options.resetSelectionOnContextMenu;c&&-1==n.doc.sel.contains(o)&&$r(n,$i)(n.doc,bi(o),G);var h=i.style.cssText,d=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var p,g=t.wrapper.getBoundingClientRect();if(i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(p=window.scrollY),r.input.focus(),s&&window.scrollTo(null,p),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=!0,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),l&&a>=9&&v(),k){ct(e);var m=function(){tt(window,"mouseup",m),setTimeout(y,20)};Je(window,"mouseup",m)}else setTimeout(y,50)}function v(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function y(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=d,i.style.cssText=h,l&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart){(!l||l&&a<9)&&v();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?$r(n,to)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Bl.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Bl.prototype.setUneditable=function(){},Bl.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=ml&&i(e,t,n)}:i)}e.defineOption=n,e.Init=ml,n("value","",function(e,t){return e.setValue(t)},!0),n("mode",null,function(e,t){e.doc.modeOption=t,Si(e)},!0),n("indentUnit",2,Si,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(e){Li(e),Rn(e),qr(e)},!0),n("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(ge(r,o))}r++});for(var i=n.length-1;i>=0;i--)so(e.doc,t,n[i],ge(n[i].line,n[i].ch+t.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ml&&e.refresh()}),n("specialCharPlaceholder",Zt,function(e){return e.refresh()},!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(e){gl(e),bl(e)},!0),n("keyMap","default",function(e,t,n){var r=Uo(t),i=n!=ml&&Uo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,wl,!0),n("gutters",[],function(e){ci(e.options),bl(e)},!0),n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rr(e.display)+"px":"0",e.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(e){return Pr(e)},!0),n("scrollbarStyle","native",function(e){zr(e),Pr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),n("lineNumbers",!1,function(e){ci(e.options),bl(e)},!0),n("firstLineNumber",1,bl,!0),n("lineNumberFormatter",function(e){return e},bl,!0),n("showCursorWhenSelecting",!1,sr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("readOnly",!1,function(e,t){"nocursor"==t&&(vr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),n("dragDrop",!0,xl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,sr,!0),n("singleCursorHeightPerLine",!0,sr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Li,!0),n("addModeClass",!1,Li,!0),n("pollInterval",100),n("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),n("historyEventDelay",1250),n("viewportMargin",10,function(e){return e.refresh()},!0),n("maxHighlightLength",1e4,Li,!0),n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),n("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),n("autofocus",null),n("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(Cl),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&$r(this,t[e])(this,n,i),nt(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Uo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Sl(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Lr(this));else{var o=i.from(),l=i.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var s=a;s0&&Ui(this.doc,r,new vi(o,u[r].to()),G)}}}),getTokenAt:function(e,t){return Vt(this,e,t)},getLineTokens:function(e,t){return Vt(this,ge(e),t,!0)},getTokenTypeAt:function(e){e=Ce(this.doc,e);var t,n=Ft(this,ae(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=r+i>>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]o&&(e=o,i=!0),r=ae(this.doc,e)}else r=e;return Gn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Ke(r):0)},defaultTextHeight:function(){return er(this.display)},defaultCharWidth:function(){return tr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,l,a,s=this.display,u=(e=Xn(this,Ce(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r)u=e.top;else if("above"==r||"near"==r){var f=Math.max(s.wrapper.clientHeight,this.doc.height),h=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(u=e.bottom),c+t.offsetWidth>h&&(c=h-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(a=kr(o,l)).scrollTop&&Or(o,a.scrollTop),null!=a.scrollLeft&&Wr(o,a.scrollLeft))},triggerOnKeyDown:Yr(il),triggerOnKeyPress:Yr(ll),triggerOnKeyUp:ol,triggerOnMouseDown:Yr(cl),execCommand:function(e){if(_o.hasOwnProperty(e))return _o[e].call(null,this)},triggerElectric:Yr(function(e){Ol(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=Ce(this.doc,e),l=0;l0&&a(n.charAt(r-1));)--r;for(;i.5)&&or(this),nt(this,"refresh",this)}),swapDoc:Yr(function(e){var t=this.doc;return t.cm=null,Oi(this,e),Rn(this),this.display.input.reset(),Tr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,an(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},lt(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(Cl);var jl="iter insert remove copy getEditor constructor".split(" ");for(var Vl in Lo.prototype)Lo.prototype.hasOwnProperty(Vl)&&B(jl,Vl)<0&&(Cl.prototype[Vl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Lo.prototype[Vl]));return lt(Lo),Cl.inputStyles={textarea:Bl,contenteditable:Pl},Cl.defineMode=function(e){Cl.defaults.mode||"null"==e||(Cl.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}.apply(this,arguments)},Cl.defineMIME=function(e,t){St[e]=t},Cl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Cl.defineMIME("text/plain","null"),Cl.defineExtension=function(e,t){Cl.prototype[e]=t},Cl.defineDocExtension=function(e,t){Lo.prototype[e]=t},Cl.fromTextArea=function(e,t){if((t=t?I(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=D();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=a.getValue()}var i;if(e.form&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var a=Cl(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a},function(e){e.off=tt,e.on=Je,e.wheelEventPixels=pi,e.Doc=Lo,e.splitLines=bt,e.countColumn=z,e.findColumn=X,e.isWordChar=ee,e.Pass=V,e.signal=nt,e.Line=Kt,e.changeEnd=xi,e.scrollbarModel=Ir,e.Pos=ge,e.cmpPos=me,e.modes=kt,e.mimeModes=St,e.resolveMode=Lt,e.getMode=Tt,e.modeExtensions=Mt,e.extendMode=At,e.copyState=Ot,e.startState=Wt,e.innerMode=Nt,e.commands=_o,e.keyMap=Io,e.keyName=Go,e.isModifierKey=jo,e.lookupKey=Bo,e.normalizeKeyMap=Ro,e.StringStream=Dt,e.SharedTextMarker=wo,e.TextMarker=bo,e.LineWidget=mo,e.e_preventDefault=at,e.e_stopPropagation=st,e.e_stop=ct,e.addClass=H,e.contains=W,e.rmClass=T,e.keyNames=Ho}(Cl),Cl.version="5.34.1",Cl}(),function(e){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),n=e.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function i(e,t,i){var l=e.getLineHandle(t.line),a=t.ch-1,s=i&&i.afterCursor;null==s&&(s=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var u=!s&&a>=0&&r[l.text.charAt(a)]||r[l.text.charAt(++a)];if(!u)return null;var c=">"==u.charAt(1)?1:-1;if(i&&i.strict&&c>0!=(a==t.ch))return null;var f=e.getTokenTypeAt(n(t.line,a+1)),h=o(e,n(t.line,a+(c>0?1:0)),c,f||null,i);return null==h?null:{from:n(t.line,a),to:h&&h.pos,match:h&&h.ch==u.charAt(0),forward:c>0}}function o(e,t,i,o,l){for(var a=l&&l.maxScanLineLength||1e4,s=l&&l.maxScanLines||1e3,u=[],c=l&&l.bracketRegex?l.bracketRegex:/[(){}[\]]/,f=i>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),h=t.line;h!=f;h+=i){var d=e.getLine(h);if(d){var p=i>0?0:d.length-1,g=i>0?d.length:-1;if(!(d.length>a))for(h==t.line&&(p=t.ch-(i<0?1:0));p!=g;p+=i){var m=d.charAt(p);if(c.test(m)&&(void 0===o||e.getTokenTypeAt(n(h,p+1))==o)){var v=r[m];if(">"==v.charAt(1)==i>0)u.push(m);else{if(!u.length)return{pos:n(h,p),ch:m};u.pop()}}}}}return h-i!=(i>0?e.lastLine():e.firstLine())&&null}function l(e,r,o){for(var l=e.state.matchBrackets.maxHighlightLineLength||1e3,a=[],s=e.listSelections(),u=0;u-1&&d>f){if(u=c.slice(0,d),/\S/.test(u)){u="";for(var h=0;h-1&&!/\S/.test(c.slice(0,d))&&(u=c.slice(0,d));null!=u&&(u+=r.blockCommentContinue)}if(null==u&&r.lineComment&&n(t)){var c=t.getLine(a.line),d=c.indexOf(r.lineComment);d>-1&&(u=c.slice(0,d),/\S/.test(u)?u=null:u+=r.lineComment+c.slice(d+r.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[l]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+insert")})}function n(e){var t=e.getOption("continueComments");return!t||"object"!=typeof t||!1!==t.continueLineComment}e.defineOption("continueComments",null,function(n,r,i){if(i&&i!=e.Init&&n.removeKeyMap("continueComment"),r){var o="Enter";"string"==typeof r?o=r:"object"==typeof r&&r.key&&(o=r.key);var l={name:"continueComment"};l[o]=t,n.addKeyMap(l)}})}(CodeMirror),function(e){"use strict";var t={},n=/[^\s\u00a0]/,r=e.Pos;function i(e){var t=e.search(n);return-1==t?0:t}function o(e,t){var n=e.getMode();return!1!==n.useInnerComments&&n.innerMode?e.getModeAt(t):n}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=t);for(var n=1/0,i=this.listSelections(),o=null,l=i.length-1;l>=0;l--){var a=i[l].from(),s=i[l].to();a.line>=n||(s.line>=n&&(s=r(n,0)),n=a.line,null==o?this.uncomment(a,s,e)?o="un":(this.lineComment(a,s,e),o="line"):"un"==o?this.uncomment(a,s,e):this.lineComment(a,s,e))}}),e.defineExtension("lineComment",function(e,l,a){a||(a=t);var s=this,u=o(s,e),c=s.getLine(e.line);if(null!=c&&(f=e,h=c,!/\bstring\b/.test(s.getTokenTypeAt(r(f.line,0)))||/^[\'\"\`]/.test(h))){var f,h,d=a.lineComment||u.lineComment;if(d){var p=Math.min(0!=l.ch||l.line==e.line?l.line+1:l.line,s.lastLine()+1),g=null==a.padding?" ":a.padding,m=a.commentBlankLines||e.line==l.line;s.operation(function(){if(a.indent){for(var t=null,o=e.line;ou.length)&&(t=u)}for(var o=e.line;of||a.operation(function(){if(0!=l.fullLines){var t=n.test(a.getLine(f));a.replaceRange(h+c,r(f)),a.replaceRange(u+h,r(e.line,0));var o=l.blockCommentLead||s.blockCommentLead;if(null!=o)for(var d=e.line+1;d<=f;++d)(d!=f||t)&&a.replaceRange(o+h,r(d,0))}else a.replaceRange(c,i),a.replaceRange(u,e)})}}else(l.lineComment||s.lineComment)&&0!=l.fullLines&&a.lineComment(e,i,l)}),e.defineExtension("uncomment",function(e,i,l){l||(l=t);var a,s=this,u=o(s,e),c=Math.min(0!=i.ch||i.line==e.line?i.line:i.line-1,s.lastLine()),f=Math.min(e.line,c),h=l.lineComment||u.lineComment,d=[],p=null==l.padding?" ":l.padding;e:if(h){for(var g=f;g<=c;++g){var m=s.getLine(g),v=m.indexOf(h);if(v>-1&&!/comment/.test(s.getTokenTypeAt(r(g,v+1)))&&(v=-1),-1==v&&n.test(m))break e;if(v>-1&&n.test(m.slice(0,v)))break e;d.push(m)}if(s.operation(function(){for(var e=f;e<=c;++e){var t=d[e-f],n=t.indexOf(h),i=n+h.length;n<0||(t.slice(i,i+p.length)==p&&(i+=p.length),a=!0,s.replaceRange("",r(e,n),r(e,i)))}}),a)return!0}var y=l.blockCommentStart||u.blockCommentStart,b=l.blockCommentEnd||u.blockCommentEnd;if(!y||!b)return!1;var x=l.blockCommentLead||u.blockCommentLead,w=s.getLine(f),C=w.indexOf(y);if(-1==C)return!1;var k=c==f?w:s.getLine(c),S=k.indexOf(b,c==f?C+y.length:0),L=r(f,C+1),T=r(c,S+1);if(-1==S||!/comment/.test(s.getTokenTypeAt(L))||!/comment/.test(s.getTokenTypeAt(T))||s.getRange(L,T,"\n").indexOf(b)>-1)return!1;var M=w.lastIndexOf(y,e.ch),A=-1==M?-1:w.slice(0,e.ch).indexOf(b,M+y.length);if(-1!=M&&-1!=A&&A+b.length!=e.ch)return!1;A=k.indexOf(b,i.ch);var O=k.slice(i.ch).lastIndexOf(y,A-i.ch);return M=-1==A||-1==O?-1:i.ch+O,(-1==A||-1==M||M==i.ch)&&(s.operation(function(){s.replaceRange("",r(c,S-(p&&k.slice(S-p.length,S)==p?p.length:0)),r(c,S+b.length));var e=C+y.length;if(p&&w.slice(e,e+p.length)==p&&(e+=p.length),s.replaceRange("",r(f,C),r(f,e)),x)for(var t=f+1;t<=c;++t){var i=s.getLine(t),o=i.indexOf(x);if(-1!=o&&!n.test(i.slice(0,o))){var l=o+x.length;p&&i.slice(l,l+p.length)==p&&(l+=p.length),s.replaceRange("",r(t,o),r(t,l))}}}),!0)})}(CodeMirror),function(e){"use strict";e.defineMode("javascript",function(t,n){var r,i,o=t.indentUnit,l=n.statementIndent,a=n.jsonld,s=n.json||a,u=n.typescript,c=n.wordCharacters||/[\w$\xa1-\uffff]/,f=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("keyword d"),o=e("operator"),l={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:e("new"),delete:r,void:r,throw:r,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:l,false:l,null:l,undefined:l,NaN:l,Infinity:l,this:e("this"),class:e("class"),super:e("atom"),yield:r,export:e("export"),import:e("import"),extends:r,await:r}}(),h=/[+\-*&%=<>!?|~^@]/,d=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e,t,n){return r=e,i=n,t}function g(e,t){var n,r=e.next();if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){var r,i=!1;if(a&&"@"==e.peek()&&e.match(d))return t.tokenize=g,p("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=n||i);)i=!i&&"\\"==r;return i||(t.tokenize=g),p("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return p("number","number");if("."==r&&e.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return p(r);if("="==r&&e.eat(">"))return p("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),p("number","number");if("0"==r&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),p("number","number");if("0"==r&&e.eat(/b/i))return e.eatWhile(/[01]/i),p("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),p("number","number");if("/"==r)return e.eat("*")?(t.tokenize=m,m(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment")):je(e,t,1)?(function(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),p("regexp","string-2")):(e.eat("="),p("operator","operator",e.current()));if("`"==r)return t.tokenize=v,v(e,t);if("#"==r)return e.skipToEnd(),p("error","error");if(h.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),p("operator","operator",e.current());if(c.test(r)){e.eatWhile(c);var i=e.current();if("."!=t.lastType){if(f.propertyIsEnumerable(i)){var o=f[i];return p(o.type,o.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\(\w]/,!1))return p("async","keyword",i)}return p("variable","variable",i)}}function m(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=g;break}r="*"==n}return p("comment","comment")}function v(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=g;break}r=!r&&"\\"==n}return p("quasi","string-2",e.current())}var y="([{}])";function b(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){if(u){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var i=0,o=!1,l=n-1;l>=0;--l){var a=e.string.charAt(l),s=y.indexOf(a);if(s>=0&&s<3){if(!i){++l;break}if(0==--i){"("==a&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(c.test(a))o=!0;else{if(/["'\/]/.test(a))return;if(o&&!i){++l;break}}}o&&!i&&(t.fatArrowAt=l)}}var x={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function w(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function C(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}var k={state:null,column:null,marked:null,cc:null};function S(){for(var e=arguments.length-1;e>=0;e--)k.cc.push(arguments[e])}function L(){return S.apply(null,arguments),!0}function T(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=k.state;if(k.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function M(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}var A={name:"this",next:{name:"arguments"}};function O(){k.state.context={prev:k.state.context,vars:k.state.localVars},k.state.localVars=A}function N(){k.state.localVars=k.state.context.vars,k.state.context=k.state.context.prev}function W(e,t){var n=function(){var n=k.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new w(r,k.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function D(){var e=k.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function H(e){return function t(n){return n==e?L():";"==e?S():L(t)}}function E(e,t){return"var"==e?L(W("vardef",t.length),de,H(";"),D):"keyword a"==e?L(W("form"),I,E,D):"keyword b"==e?L(W("form"),E,D):"keyword d"==e?k.stream.match(/^\s*$/,!1)?L():L(W("stat"),R,H(";"),D):"debugger"==e?L(H(";")):"{"==e?L(W("}"),te,D):";"==e?L():"if"==e?("else"==k.state.lexical.info&&k.state.cc[k.state.cc.length-1]==D&&k.state.cc.pop()(),L(W("form"),I,E,D,ye)):"function"==e?L(Se):"for"==e?L(W("form"),be,E,D):"class"==e||u&&"interface"==t?(k.marked="keyword",L(W("form"),Me,D)):"variable"==e?u&&"declare"==t?(k.marked="keyword",L(E)):u&&("module"==t||"enum"==t||"type"==t)&&k.stream.match(/^\s*\w/,!1)?(k.marked="keyword","enum"==t?L(Re):"type"==t?L(oe,H("operator"),oe,H(";")):L(W("form"),pe,H("{"),W("}"),te,D,D)):u&&"namespace"==t?(k.marked="keyword",L(W("form"),P,te,D)):L(W("stat"),Y):"switch"==e?L(W("form"),I,H("{"),W("}","switch"),te,D,D):"case"==e?L(P,H(":")):"default"==e?L(H(":")):"catch"==e?L(W("form"),O,H("("),Le,H(")"),E,D,N):"export"==e?L(W("stat"),We,D):"import"==e?L(W("stat"),He,D):"async"==e?L(E):"@"==t?L(P,E):S(W("stat"),P,H(";"),D)}function P(e,t){return z(e,t,!1)}function F(e,t){return z(e,t,!0)}function I(e){return"("!=e?S():L(W(")"),P,H(")"),D)}function z(e,t,n){if(k.state.fatArrowAt==k.stream.start){var r=n?K:U;if("("==e)return L(O,W(")"),J(Le,")"),D,H("=>"),r,N);if("variable"==e)return S(O,pe,H("=>"),r,N)}var i=n?j:B;return x.hasOwnProperty(e)?L(i):"function"==e?L(Se,i):"class"==e||u&&"interface"==t?(k.marked="keyword",L(W("form"),Te,D)):"keyword c"==e||"async"==e?L(n?F:P):"("==e?L(W(")"),R,H(")"),D,i):"operator"==e||"spread"==e?L(n?F:P):"["==e?L(W("]"),ze,D,i):"{"==e?ee(q,"}",null,i):"quasi"==e?S(V,i):"new"==e?L(function(e){return function(t){return"."==t?L(e?$:X):"variable"==t&&u?L(ce,e?j:B):S(e?F:P)}}(n)):"import"==e?L(P):L()}function R(e){return e.match(/[;\}\)\],]/)?S():S(P)}function B(e,t){return","==e?L(P):j(e,t,!1)}function j(e,t,n){var r=0==n?B:j,i=0==n?P:F;return"=>"==e?L(O,n?K:U,N):"operator"==e?/\+\+|--/.test(t)||u&&"!"==t?L(r):u&&"<"==t&&k.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?L(W(">"),J(oe,">"),D,r):"?"==t?L(P,H(":"),i):L(i):"quasi"==e?S(V,r):";"!=e?"("==e?ee(F,")","call",r):"."==e?L(_,r):"["==e?L(W("]"),R,H("]"),D,r):u&&"as"==t?(k.marked="keyword",L(oe,r)):"regexp"==e?(k.state.lastType=k.marked="operator",k.stream.backUp(k.stream.pos-k.stream.start-1),L(i)):void 0:void 0}function V(e,t){return"quasi"!=e?S():"${"!=t.slice(t.length-2)?L(V):L(P,G)}function G(e){if("}"==e)return k.marked="string-2",k.state.tokenize=v,L(V)}function U(e){return b(k.stream,k.state),S("{"==e?E:P)}function K(e){return b(k.stream,k.state),S("{"==e?E:F)}function X(e,t){if("target"==t)return k.marked="keyword",L(B)}function $(e,t){if("target"==t)return k.marked="keyword",L(j)}function Y(e){return":"==e?L(D,E):S(B,H(";"),D)}function _(e){if("variable"==e)return k.marked="property",L()}function q(e,t){if("async"==e)return k.marked="property",L(q);if("variable"==e||"keyword"==k.style){return k.marked="property","get"==t||"set"==t?L(Z):(u&&k.state.fatArrowAt==k.stream.start&&(n=k.stream.match(/^\s*:\s*/,!1))&&(k.state.fatArrowAt=k.stream.pos+n[0].length),L(Q));var n}else{if("number"==e||"string"==e)return k.marked=a?"property":k.style+" property",L(Q);if("jsonld-keyword"==e)return L(Q);if(u&&M(t))return k.marked="keyword",L(q);if("["==e)return L(P,ne,H("]"),Q);if("spread"==e)return L(F,Q);if("*"==t)return k.marked="keyword",L(q);if(":"==e)return S(Q)}}function Z(e){return"variable"!=e?S(Q):(k.marked="property",L(Se))}function Q(e){return":"==e?L(F):"("==e?S(Se):void 0}function J(e,t,n){function r(i,o){if(n?n.indexOf(i)>-1:","==i){var l=k.state.lexical;return"call"==l.info&&(l.pos=(l.pos||0)+1),L(function(n,r){return n==t||r==t?S():S(e)},r)}return i==t||o==t?L():L(H(t))}return function(n,i){return n==t||i==t?L():S(e,r)}}function ee(e,t,n){for(var r=3;r"==e)return L(oe)}function ae(e,t){return"variable"==e||"keyword"==k.style?(k.marked="property",L(ae)):"?"==t?L(ae):":"==e?L(oe):"["==e?L(P,ne,H("]"),ae):void 0}function se(e){return"variable"==e?L(se):":"==e?L(oe):void 0}function ue(e,t){return"<"==t?L(W(">"),J(oe,">"),D,ue):"|"==t||"."==e||"&"==t?L(oe):"["==e?L(H("]"),ue):"extends"==t||"implements"==t?(k.marked="keyword",L(oe)):void 0}function ce(e,t){if("<"==t)return L(W(">"),J(oe,">"),D,ue)}function fe(){return S(oe,he)}function he(e,t){if("="==t)return L(oe)}function de(e,t){return"enum"==t?(k.marked="keyword",L(Re)):S(pe,ne,me,ve)}function pe(e,t){return u&&M(t)?(k.marked="keyword",L(pe)):"variable"==e?(T(t),L()):"spread"==e?L(pe):"["==e?ee(pe,"]"):"{"==e?ee(ge,"}"):void 0}function ge(e,t){return"variable"!=e||k.stream.match(/^\s*:/,!1)?("variable"==e&&(k.marked="property"),"spread"==e?L(pe):"}"==e?S():L(H(":"),pe,me)):(T(t),L(me))}function me(e,t){if("="==t)return L(F)}function ve(e){if(","==e)return L(de)}function ye(e,t){if("keyword b"==e&&"else"==t)return L(W("form","else"),E,D)}function be(e,t){return"await"==t?L(be):"("==e?L(W(")"),xe,H(")"),D):void 0}function xe(e){return"var"==e?L(de,H(";"),Ce):";"==e?L(Ce):"variable"==e?L(we):S(P,H(";"),Ce)}function we(e,t){return"in"==t||"of"==t?(k.marked="keyword",L(P)):L(B,Ce)}function Ce(e,t){return";"==e?L(ke):"in"==t||"of"==t?(k.marked="keyword",L(P)):S(P,H(";"),ke)}function ke(e){")"!=e&&L(P)}function Se(e,t){return"*"==t?(k.marked="keyword",L(Se)):"variable"==e?(T(t),L(Se)):"("==e?L(O,W(")"),J(Le,")"),D,re,E,N):u&&"<"==t?L(W(">"),J(fe,">"),D,Se):void 0}function Le(e,t){return"@"==t&&L(P,Le),"spread"==e?L(Le):u&&M(t)?(k.marked="keyword",L(Le)):S(pe,ne,me)}function Te(e,t){return"variable"==e?Me(e,t):Ae(e,t)}function Me(e,t){if("variable"==e)return T(t),L(Ae)}function Ae(e,t){return"<"==t?L(W(">"),J(fe,">"),D,Ae):"extends"==t||"implements"==t||u&&","==e?("implements"==t&&(k.marked="keyword"),L(u?oe:P,Ae)):"{"==e?L(W("}"),Oe,D):void 0}function Oe(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||u&&M(t))&&k.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(k.marked="keyword",L(Oe)):"variable"==e||"keyword"==k.style?(k.marked="property",L(u?Ne:Se,Oe)):"["==e?L(P,ne,H("]"),u?Ne:Se,Oe):"*"==t?(k.marked="keyword",L(Oe)):";"==e?L(Oe):"}"==e?L():"@"==t?L(P,Oe):void 0}function Ne(e,t){return"?"==t?L(Ne):":"==e?L(oe,me):"="==t?L(F):S(Se)}function We(e,t){return"*"==t?(k.marked="keyword",L(Ie,H(";"))):"default"==t?(k.marked="keyword",L(P,H(";"))):"{"==e?L(J(De,"}"),Ie,H(";")):S(E)}function De(e,t){return"as"==t?(k.marked="keyword",L(H("variable"))):"variable"==e?S(F,De):void 0}function He(e){return"string"==e?L():"("==e?S(P):S(Ee,Pe,Ie)}function Ee(e,t){return"{"==e?ee(Ee,"}"):("variable"==e&&T(t),"*"==t&&(k.marked="keyword"),L(Fe))}function Pe(e){if(","==e)return L(Ee,Pe)}function Fe(e,t){if("as"==t)return k.marked="keyword",L(Ee)}function Ie(e,t){if("from"==t)return k.marked="keyword",L(P)}function ze(e){return"]"==e?L():S(J(F,"]"))}function Re(){return S(W("form"),pe,H("{"),W("}"),J(Be,"}"),D,D)}function Be(){return S(pe,me)}function je(e,t,n){return t.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return D.lex=!0,{startState:function(e){var t={tokenize:g,lastType:"sof",cc:[],lexical:new w((e||0)-o,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),b(e,t)),t.tokenize!=m&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==r?n:(t.lastType="operator"!=r||"++"!=i&&"--"!=i?r:"incdec",function(e,t,n,r,i){var o=e.cc;for(k.state=e,k.stream=i,k.marked=null,k.cc=o,k.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var l=o.length?o.pop():s?P:E;if(l(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return k.marked?k.marked:"variable"==n&&C(e,r)?"variable-2":t}}}(t,n,r,i,e))},indent:function(t,r){if(t.tokenize==m)return e.Pass;if(t.tokenize!=g)return 0;var i,a=r&&r.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(r))for(var u=t.cc.length-1;u>=0;--u){var c=t.cc[u];if(c==D)s=s.prev;else if(c!=ye)break}for(;("stat"==s.type||"form"==s.type)&&("}"==a||(i=t.cc[t.cc.length-1])&&(i==B||i==j)&&!/^[,\.=+\-*:?[\(]/.test(r));)s=s.prev;l&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var f=s.type,d=a==f;return"vardef"==f?s.indented+("operator"==t.lastType||","==t.lastType?s.info+1:0):"form"==f&&"{"==a?s.indented:"form"==f?s.indented+o:"stat"==f?s.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||h.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,r)?l||o:0):"switch"!=s.info||d||0==n.doubleIndentSwitch?s.align?s.column+(d?0:1):s.indented+(d?0:o):s.indented+(/^(?:case|default)\b/.test(r)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:a,jsonMode:s,expressionAllowed:je,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=P&&t!=F||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}(CodeMirror)}]);