cdtexteditor.min.js 283 KB

123
  1. /*! cdtexteditor 2021-04-07 */
  2. "use strict";var Typo;!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){var e=navigator.userAgent,t=navigator.platform,d=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),w=n||r||i,v=w&&(n?document.documentMode||6:+(i||r)[1]),p=!i&&/WebKit\//.test(e),r=p&&/Qt\/\d+\.\d+/.test(e),o=!i&&/Chrome\//.test(e),f=/Opera\//.test(e),u=/Apple Computer/.test(navigator.vendor),a=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),s=u&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),l=/Android/.test(e),h=s||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),g=s||/Mac/.test(t),m=/\bCrOS\b/.test(e),b=/win/i.test(t),e=f&&e.match(/Version\/(\d*\.\d*)/);(e=e&&Number(e[1]))&&15<=e&&(p=!(f=!1));var y=g&&(r||f&&(null==e||e<12.11)),k=d||w&&9<=v;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x=function(e,t){var n=e.className,r=_(t).exec(n);r&&(t=n.slice(r.index+r[0].length),e.className=n.slice(0,r.index)+(t?r[1]+t:""))};function C(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function S(e,t){return C(e).appendChild(t)}function T(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.length;++o)i.appendChild(t[o]);return i}function L(e,t,n,r){r=T(e,t,n,r);return r.setAttribute("role","presentation"),r}function M(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if((t=11==t.nodeType?t.host:t)==e)return!0}while(t=t.parentNode)}function A(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function E(e,t){var n=e.className;_(t).test(n)||(e.className+=(n?" ":"")+t)}function D(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!_(n[r]).test(t)&&(t+=" "+n[r]);return t}var P=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r},F=function(e){e.select()};function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,n){for(var r in t=t||{},e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function z(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var s=e.indexOf("\t",o);if(s<0||t<=s)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}s?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:w&&(F=function(e){try{e.select()}catch(e){}});var H=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};function j(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}H.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},H.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)};var W=50,I={toString:function(){return"CodeMirror.Pass"}},R={scroll:!1},B={origin:"*mouse"},U={origin:"+move"};function q(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r),a=(o=-1==o?e.length:o)-r;if(o==e.length||t<=i+a)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,t<=(i+=n-i%n))return r}}var $=[""];function G(e){for(;$.length<=e;)$.push(V($)+" ");return $[e]}function V(e){return e[e.length-1]}function K(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function X(){}function Y(e,t){e=Object.create?Object.create(e):(X.prototype=e,new X);return t&&N(t,e),e}var Z=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Q(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||Z.test(e))}function J(e,t){return t?!!(-1<t.source.indexOf("\\w")&&Q(e))||t.test(e):Q(e)}function ee(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return;return 1}var te=/[\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 ne(e){return 768<=e.charCodeAt(0)&&te.test(e)}function re(e,t,n){for(;(n<0?0<t:t<e.length)&&ne(e.charAt(t));)t+=n;return t}function ie(e,t,n){for(var r=n<t?-1:1;;){if(t==n)return t;var i=(t+n)/2,i=r<0?Math.ceil(i):Math.floor(i);if(i==t)return e(i)?t:n;e(i)?n=i:t=i+r}}var oe=null;function ae(e,t,n){var r;oe=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:oe=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:oe=i)}return null!=r?r:oe}var se,le,ce,ue,he,de,pe,fe=(se="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",le="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",ce=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,ue=/[stwN]/,he=/[LRr]/,de=/[Lb1n]/,pe=/[1n]/,function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!ce.test(e))return!1;for(var r,i=e.length,o=[],a=0;a<i;++a)o.push((r=e.charCodeAt(a))<=247?se.charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?le.charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var s=0,l=n;s<i;++s){var c=o[s];"m"==c?o[s]=l:l=c}for(var u=0,h=n;u<i;++u){var d=o[u];"1"==d&&"r"==h?o[u]="n":he.test(d)&&"r"==(h=d)&&(o[u]="R")}for(var p=1,f=o[0];p<i-1;++p){var g=o[p];"+"==g&&"1"==f&&"1"==o[p+1]?o[p]="1":","!=g||f!=o[p+1]||"1"!=f&&"n"!=f||(o[p]=f),f=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){for(var b=void 0,b=m+1;b<i&&"%"==o[b];++b);for(var y=m&&"!"==o[m-1]||b<i&&"1"==o[b]?"1":"N",w=m;w<b;++w)o[w]=y;m=b-1}}for(var k=0,_=n;k<i;++k){var x=o[k];"L"==_&&"1"==x?o[k]="L":he.test(x)&&(_=x)}for(var C=0;C<i;++C)if(ue.test(o[C])){for(var S=void 0,S=C+1;S<i&&ue.test(o[S]);++S);for(var L="L"==(C?o[C-1]:n),T=L==("L"==(S<i?o[S]:n))?L?"L":"R":n,M=C;M<S;++M)o[M]=T;C=S-1}for(var A,E=[],D=0;D<i;)if(de.test(o[D])){var P=D;for(++D;D<i&&de.test(o[D]);++D);E.push(new ge(0,P,D))}else{var F=D,O=E.length,N="rtl"==t?1:0;for(++D;D<i&&"L"!=o[D];++D);for(var z=F;z<D;)if(pe.test(o[z])){F<z&&(E.splice(O,0,new ge(1,F,z)),O+=N);var H=z;for(++z;z<D&&pe.test(o[z]);++z);E.splice(O,0,new ge(2,H,z)),O+=N,F=z}else++z;F<D&&E.splice(O,0,new ge(1,F,D))}return"ltr"==t&&(1==E[0].level&&(A=e.match(/^\s+/))&&(E[0].from=A[0].length,E.unshift(new ge(0,0,A[0].length))),1==V(E).level&&(A=e.match(/\s+$/))&&(V(E).to-=A[0].length,E.push(new ge(0,i-A[0].length,i)))),"rtl"==t?E.reverse():E});function ge(e,t,n){this.level=e,this.from=t,this.to=n}function me(e,t){var n=e.order;return n=null==n?e.order=fe(e.text,t):n}var ve=[],be=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):(e=e._handlers||(e._handlers={}))[t]=(e[t]||ve).concat(n)};function ye(e,t){return e._handlers&&e._handlers[t]||ve}function we(e,t,n){var r;e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):!(e=(r=e._handlers)&&r[t])||-1<(n=j(e,n))&&(r[t]=e.slice(0,n).concat(e.slice(n+1)))}function ke(e,t){var n=ye(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function _e(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ke(e,n||t.type,e,t),Me(t)||t.codemirrorIgnore}function xe(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==j(n,t[r])&&n.push(t[r])}function Ce(e,t){return 0<ye(e,t).length}function Se(e){e.prototype.on=function(e,t){be(this,e,t)},e.prototype.off=function(e,t){we(this,e,t)}}function Le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Te(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Me(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ae(e){Le(e),Te(e)}function Ee(e){return e.target||e.srcElement}function De(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),t=g&&e.ctrlKey&&1==t?3:t}var Pe,Fe,Oe=function(){if(w&&v<9)return!1;var e=T("div");return"draggable"in e||"dragDrop"in e}();var Ne=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),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ze=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)},He="oncopy"in(r=T("div"))||(r.setAttribute("oncopy","return;"),"function"==typeof r.oncopy),je=null;var We={},Ie={};function Re(e){if("string"==typeof e&&Ie.hasOwnProperty(e))e=Ie[e];else if(e&&"string"==typeof e.name&&Ie.hasOwnProperty(e.name)){var t=Ie[e.name];(e=Y(t="string"==typeof t?{name:t}:t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Re("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Re("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Be(e,t){t=Re(t);var n=We[t.name];if(!n)return Be(e,"text/plain");var r=n(e,t);if(Ue.hasOwnProperty(t.name)){var i,o=Ue[t.name];for(i in o)o.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=o[i])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var Ue={};function qe(e,t){N(t,Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={})}function $e(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n,r={};for(n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ge(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 Ve(e,t,n){return!e.startState||e.startState(t,n)}var Ke=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};function Xe(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<o){n=i;break}t-=o}return n.lines[t]}function Ye(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){e=e.text;i==n.line&&(e=e.slice(0,n.ch)),i==t.line&&(e=e.slice(t.ch)),r.push(e),++i}),r}function Ze(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Qe(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Je(e){if(null==e.parent)return null;for(var t=e.parent,n=j(t.lines,e),r=t.parent;r;r=(t=r).parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function et(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var s=e.lines[a].height;if(t<s)break;t-=s}return n+a}function tt(e,t){return t>=e.first&&t<e.first+e.size}function nt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function rt(e,t,n){if(void 0===n&&(n=null),!(this instanceof rt))return new rt(e,t,n);this.line=e,this.ch=t,this.sticky=n}function it(e,t){return e.line-t.line||e.ch-t.ch}function ot(e,t){return e.sticky==t.sticky&&0==it(e,t)}function at(e){return rt(e.line,e.ch)}function st(e,t){return it(e,t)<0?t:e}function lt(e,t){return it(e,t)<0?e:t}function ct(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ut(e,t){if(t.line<e.first)return rt(e.first,0);var n=e.first+e.size-1;return t.line>n?rt(n,Xe(e,n).text.length):(e=Xe(e,(n=t).line).text.length,null==(t=n.ch)||e<t?rt(n.line,e):t<0?rt(n.line,0):n)}function ht(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ut(e,t[r]);return n}Ke.prototype.eol=function(){return this.pos>=this.string.length},Ke.prototype.sol=function(){return this.pos==this.lineStart},Ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ke.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ke.prototype.eat=function(e){var t=this.string.charAt(this.pos),e="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(e)return++this.pos,t},Ke.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ke.prototype.skipToEnd=function(){this.pos=this.string.length},Ke.prototype.skipTo=function(e){e=this.string.indexOf(e,this.pos);if(-1<e)return this.pos=e,!0},Ke.prototype.backUp=function(e){this.pos-=e},Ke.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ke.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ke.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&0<r.index?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},Ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ke.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ke.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var dt=function(e,t){this.state=e,this.lookAhead=t},pt=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 ft(t,n,r,e){var l=[t.state.modeGen],i={};xt(t,n.text,t.doc.mode,r,function(e,t){return l.push(e,t)},i,e);for(var c=r.state,o=0;o<t.state.overlays.length;++o)!function(e){r.baseTokens=l;var o=t.state.overlays[e],a=1,s=0;r.state=!0,xt(t,n.text,o.mode,r,function(e,t){for(var n=a;s<e;){var r=l[a];e<r&&l.splice(a,1,e,l[a+1],r),a+=2,s=Math.min(e,r)}if(t)if(o.opaque)l.splice(n,a-n,e,"overlay "+t),a=n+2;else for(;n<a;n+=2){var i=l[n+1];l[n+1]=(i?i+" ":"")+"overlay "+t}},i),r.state=c,r.baseTokens=null,r.baseTokenPos=1}(o);return{styles:l,classes:i.bgClass||i.textClass?i:null}}function gt(e,t,n){var r,i,o;return t.styles&&t.styles[0]==e.state.modeGen||(r=mt(e,Je(t)),i=t.text.length>e.options.maxHighlightLength&&$e(e.doc.mode,r.state),o=ft(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))),t.styles}function mt(n,r,e){var t=n.doc,i=n.display;if(!t.mode.startState)return new pt(t,!0,r);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;a<s;--s){if(s<=o.first)return o.first;var l=Xe(o,s-1),c=l.stateAfter;if(c&&(!n||s+(c instanceof dt?c.lookAhead:0)<=o.modeFrontier))return s;l=z(l.text,null,e.options.tabSize);(null==i||l<r)&&(i=s-1,r=l)}return i}(n,r,e),a=o>t.first&&Xe(t,o-1).stateAfter,s=a?pt.fromSaved(t,a,o):new pt(t,Ve(t.mode),o);return t.iter(o,r,function(e){vt(n,e.text,s);var t=s.line;e.stateAfter=t==r-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function vt(e,t,n,r){var i=e.doc.mode,o=new Ke(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&bt(i,n.state);!o.eol();)yt(i,o,n.state),o.start=o.pos}function bt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){t=Ge(e,t);return t.mode.blankLine?t.mode.blankLine(t.state):void 0}}function yt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ge(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}pt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},pt.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}},pt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},pt.fromSaved=function(e,t,n){return t instanceof dt?new pt(e,$e(e.mode,t.state),n,t.lookAhead):new pt(e,$e(e.mode,t),n)},pt.prototype.save=function(e){e=!1!==e?$e(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new dt(e,this.maxLookAhead):e};var wt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function kt(e,t,n,r){var i,o,a=e.doc,s=a.mode,l=Xe(a,(t=ut(a,t)).line),c=mt(e,t.line,n),u=new Ke(l.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=yt(s,u,c.state),r&&o.push(new wt(u,i,$e(a.mode,c.state)));return r?o:new wt(u,i,c.state)}function _t(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function xt(e,t,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var l=0,c=null,u=new Ke(t,e.options.tabSize,r),h=e.options.addModeClass&&[null];for(""==t&&_t(bt(n,r.state),o);!u.eol();){var d,p=u.pos>e.options.maxHighlightLength?(s=!1,a&&vt(e,t,r,u.pos),u.pos=t.length,null):_t(yt(n,u,r.state,h),o);if(!h||(d=h[0].name)&&(p="m-"+(p?d+" "+p:d)),!s||c!=p){for(;l<u.start;)i(l=Math.min(u.start,l+5e3),c);c=p}u.start=u.pos}for(;l<u.pos;){var f=Math.min(u.pos,l+5e3);i(f,c),l=f}}var Ct=!1,St=!1;function Lt(e,t,n){this.marker=e,this.from=t,this.to=n}function Tt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Mt(e,t){if(t.full)return null;var n=tt(e,t.from.line)&&Xe(e,t.from.line).markedSpans,r=tt(e,t.to.line)&&Xe(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,e=0==it(t.from,t.to),a=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],s=a.marker;!(null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t))&&(a.from!=t||"bookmark"!=s.type||n&&a.marker.insertLeft)||(o=null==a.to||(s.inclusiveRight?a.to>=t:a.to>t),(r=r||[]).push(new Lt(s,a.from,o?null:a.to)))}return r}(n,i,e),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],s=a.marker;!(null==a.to||(s.inclusiveRight?a.to>=t:a.to>t))&&(a.from!=t||"bookmark"!=s.type||n&&!a.marker.insertLeft)||(o=null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t),(r=r||[]).push(new Lt(s,o?null:a.from-t,null==a.to?null:a.to-t)))}return r}(r,o,e),l=1==t.text.length,c=V(t.text).length+(l?i:0);if(a)for(var u=0;u<a.length;++u){var h,d=a[u];null==d.to&&((h=Tt(s,d.marker))?l&&(d.to=null==h.to?null:h.to+c):d.to=i)}if(s)for(var p=0;p<s.length;++p){var f=s[p];null!=f.to&&(f.to+=c),null==f.from?Tt(a,f.marker)||(f.from=c,l&&(a=a||[]).push(f)):(f.from+=c,l&&(a=a||[]).push(f))}a=a&&At(a),s&&s!=a&&(s=At(s));var g=[a];if(!l){var m,v=t.text.length-2;if(0<v&&a)for(var b=0;b<a.length;++b)null==a[b].to&&(m=m||[]).push(new Lt(a[b].marker,null,null));for(var y=0;y<v;++y)g.push(m);g.push(s)}return g}function At(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Et(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Dt(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Pt(e){return e.inclusiveLeft?-1:0}function Ft(e){return e.inclusiveRight?1:0}function Ot(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),n=it(r.from,i.from)||Pt(e)-Pt(t);if(n)return-n;i=it(r.to,i.to)||Ft(e)-Ft(t);return i||t.id-e.id}function Nt(e,t){var n,r=St&&e.markedSpans;if(r)for(var i,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ot(n,i.marker)<0)&&(n=i.marker);return n}function zt(e){return Nt(e,!0)}function Ht(e){return Nt(e,!1)}function jt(e,t,n,r,i){var t=Xe(e,t),o=St&&t.markedSpans;if(o)for(var a=0;a<o.length;++a){var s=o[a];if(s.marker.collapsed){var l=s.marker.find(0),c=it(l.from,n)||Pt(s.marker)-Pt(i),u=it(l.to,r)||Ft(s.marker)-Ft(i);if(!(0<=c&&u<=0||c<=0&&0<=u)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=it(l.to,n):0<it(l.to,n))||0<=c&&(s.marker.inclusiveRight&&i.inclusiveLeft?it(l.from,r)<=0:it(l.from,r)<0)))return 1}}}function Wt(e){for(var t;t=zt(e);)e=t.find(-1,!0).line;return e}function It(e,t){var n=Xe(e,t),e=Wt(n);return n==e?t:Je(e)}function Rt(e,t){if(t>e.lastLine())return t;var n,r=Xe(e,t);if(!Bt(e,r))return t;for(;n=Ht(r);)r=n.find(1,!0).line;return Je(r)+1}function Bt(e,t){var n=St&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&function e(t,n,r){if(null==r.to){var i=r.marker.find(1,!0);return e(t,i.line,Tt(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==n.text.length)return!0;for(var o=void 0,a=0;a<n.markedSpans.length;++a)if((o=n.markedSpans[a]).marker.collapsed&&!o.marker.widgetNode&&o.from==r.to&&(null==o.to||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&e(t,n,o))return!0}(e,t,r))return!0}}function Ut(e){for(var t=0,n=(e=Wt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var s=o.children[a];if(s==n)break;t+=s.height}return t}function qt(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=zt(r);){var i=t.find(0,!0),r=i.from.line;n+=i.from.ch-i.to.ch}for(r=e;t=Ht(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function $t(e){var n=e.display,e=e.doc;n.maxLine=Xe(e,e.first),n.maxLineLength=qt(n.maxLine),n.maxLineChanged=!0,e.iter(function(e){var t=qt(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var Gt=function(e,t,n){this.text=e,Dt(this,t),this.height=n?n(this):1};Gt.prototype.lineNo=function(){return Je(this)},Se(Gt);var Vt={},Kt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;t=t.addModeClass?Kt:Vt;return t[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function Yt(e,t){var n=L("span",null,null,p?"padding-right: .1px":null),r={pre:L("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Qt,function(e){if(null!=Fe)return Fe;var t=S(e,document.createTextNode("AخA")),n=P(t,0,1).getBoundingClientRect(),t=P(t,1,2).getBoundingClientRect();return C(e),n&&n.left!=n.right&&(Fe=t.right-n.right<3)}(e.display.measure)&&(a=me(o,e.doc.direction))&&(r.addToken=function(h,d){return function(e,t,n,r,i,o,a){n=n?n+" cm-force-border":"cm-force-border";for(var s=e.pos,l=s+t.length;;){for(var c=void 0,u=0;u<d.length&&!((c=d[u]).to>s&&c.from<=s);u++);if(c.to>=l)return h(e,t,n,r,i,o,a);h(e,t.slice(0,c.to-s),n,r,null,o,a),r=null,t=t.slice(c.to-s),s=c.to}}}(r.addToken,a)),r.map=[],function(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,c,u,h,d,p=i.length,f=0,g=1,m="",v=0;;){if(v==f){l=c=u=s="",h=d=null,v=1/0;for(var b=[],y=void 0,w=0;w<r.length;++w){var k=r[w],_=k.marker;if("bookmark"==_.type&&k.from==f&&_.widgetNode)b.push(_);else if(k.from<=f&&(null==k.to||k.to>f||_.collapsed&&k.to==f&&k.from==f)){if(null!=k.to&&k.to!=f&&v>k.to&&(v=k.to,c=""),_.className&&(l+=" "+_.className),_.css&&(s=(s?s+";":"")+_.css),_.startStyle&&k.from==f&&(u+=" "+_.startStyle),_.endStyle&&k.to==v&&(y=y||[]).push(_.endStyle,k.to),_.title&&((d=d||{}).title=_.title),_.attributes)for(var x in _.attributes)(d=d||{})[x]=_.attributes[x];_.collapsed&&(!h||Ot(h.marker,_)<0)&&(h=k)}else k.from>f&&v>k.from&&(v=k.from)}if(y)for(var C=0;C<y.length;C+=2)y[C+1]==v&&(c+=" "+y[C]);if(!h||h.from==f)for(var S=0;S<b.length;++S)Jt(t,0,b[S]);if(h&&(h.from||0)==f){if(Jt(t,(null==h.to?p+1:h.to)-f,h.marker,null==h.from),null==h.to)return;h.to==f&&(h=!1)}}if(p<=f)break;for(var L=Math.min(p,v);;){if(m){var T,M=f+m.length;if(h||(T=L<M?m.slice(0,L-f):m,t.addToken(t,T,a?a+l:l,u,f+T.length==v?c:"",s,d)),L<=M){m=m.slice(L-f),f=L;break}f=M,u=""}m=i.slice(o,o=n[g++]),a=Xt(n[g++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),Xt(n[A+1],t.cm.options))}(o,r,gt(e,o,t!=e.display.externalMeasured&&Je(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=D(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=D(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(function(e){null==Pe&&(t=T("span","​"),S(e,T("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Pe=t.offsetWidth<=1&&2<t.offsetHeight&&!(w&&v<8)));var t=Pe?T("span","​"):T("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return t.setAttribute("cm-text",""),t}(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return p&&(n=r.content.lastChild,(/\bcm-tab\b/.test(n.className)||n.querySelector&&n.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")),ke(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=D(r.pre.className,r.textClass||"")),r}function Zt(e){var t=T("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,n,r,i,o,a){if(t){var s=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),h=0;;){l.lastIndex=h;var d=l.exec(t),p=d?d.index-h:t.length-h;if(p&&(f=document.createTextNode(s.slice(h,h+p)),w&&v<9?u.appendChild(T("span",[f])):u.appendChild(f),e.map.push(e.pos,e.pos+p,f),e.col+=p,e.pos+=p),!d)break;h+=1+p;var f=void 0;"\t"==d[0]?(p=(p=e.cm.options.tabSize)-e.col%p,(f=u.appendChild(T("span",G(p),"cm-tab"))).setAttribute("role","presentation"),f.setAttribute("cm-text","\t"),e.col+=p):("\r"==d[0]||"\n"==d[0]?(f=u.appendChild(T("span","\r"==d[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",d[0]):((f=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),w&&v<9?u.appendChild(T("span",[f])):u.appendChild(f)),e.col+=1),e.map.push(e.pos,e.pos+1,f),e.pos++}else e.col+=t.length,u=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,u),w&&v<9&&(c=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||c||o||a){n=n||"";r&&(n+=r),i&&(n+=i);var g=T("span",[u],n,o);if(a)for(var m in a)a.hasOwnProperty(m)&&"style"!=m&&"class"!=m&&g.setAttribute(m,a[m]);return e.content.appendChild(g)}e.content.appendChild(u)}}function Jt(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"))).setAttribute("cm-marker",n.id),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function en(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=Ht(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n}(t),this.size=this.rest?Je(V(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Bt(e,t)}function tn(e,t,n){for(var r=[],i=t;i<n;i=a){var o=new en(e.doc,Xe(e.doc,i),i),a=i+o.size;r.push(o)}return r}var nn=null;function rn(e,t){e=e.ownsGroup;if(e)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(e)}finally{nn=null,t(e)}}var on=null;function an(e,t){var n=ye(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);nn?r=nn.delayedCallbacks:on?r=on:(r=on=[],setTimeout(sn,0));for(var o=0;o<n.length;++o)!function(e){r.push(function(){return n[e].apply(null,i)})}(o)}}function sn(){var e=on;on=null;for(var t=0;t<e.length;++t)e[t]()}function ln(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?function(e,t){var n=t.text.className,r=un(e,t);t.text==t.node&&(t.node=r.pre);t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,hn(e,t)):n&&(t.text.className=n)}(e,t):"gutter"==o?dn(e,t,n,r):"class"==o?hn(e,t):"widget"==o&&function(e,t,n){t.alignable&&(t.alignable=null);for(var r=_("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);pn(e,t,n)}(e,t,r)}t.changes=null}function cn(e){return e.node==e.text&&(e.node=T("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),w&&v<8&&(e.node.style.zIndex=2)),e.node}function un(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Yt(e,t)}function hn(e,t){var n,r;n=e,(r=(i=t).bgClass?i.bgClass+" "+(i.line.bgClass||""):i.line.bgClass)&&(r+=" CodeMirror-linebackground"),i.background?r?i.background.className=r:(i.background.parentNode.removeChild(i.background),i.background=null):r&&(e=cn(i),i.background=e.insertBefore(T("div",null,r),e.firstChild),n.display.input.setUneditable(i.background)),t.line.wrapClass?cn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function dn(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=cn(t),t.gutterBackground=T("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text));var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=cn(t),a=t.gutter=T("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(T("div",nt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s<e.display.gutterSpecs.length;++s){var l=e.display.gutterSpecs[s].className,c=i.hasOwnProperty(l)&&i[l];c&&a.appendChild(T("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function pn(e,t,n){if(fn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)fn(e,t.rest[r],t,n,!1)}function fn(e,t,n,r,i){if(t.widgets)for(var o=cn(n),a=0,s=t.widgets;a<s.length;++a){var l=s[a],c=T("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),function(e,t,n,r){e.noHScroll&&((n.alignable||(n.alignable=[])).push(t),n=r.wrapperWidth,t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px");e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}(l,c,n,r),e.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),an(l,"redraw")}}function gn(e){if(null!=e.height)return e.height;var t,n=e.doc.cm;return n?(M(document.body,e.node)||(t="position: relative;",e.coverGutter&&(t+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+n.display.wrapper.clientWidth+"px;"),S(n.display.measure,T("div",[e.node],null,t))),e.height=e.node.parentNode.offsetHeight):0}function mn(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return 1}function vn(e){return e.lineSpace.offsetTop}function bn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function yn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=S(e.measure,T("pre","x","CodeMirror-line-like")),t=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,t={left:parseInt(t.paddingLeft),right:parseInt(t.paddingRight)};return isNaN(t.left)||isNaN(t.right)||(e.cachedPaddingH=t),t}function wn(e){return W-e.display.nativeBarWidth}function kn(e){return e.display.scroller.clientWidth-wn(e)-e.display.barWidth}function _n(e){return e.display.scroller.clientHeight-wn(e)-e.display.barHeight}function xn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Je(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Cn(e,t,n,r){return Tn(e,Ln(e,t),n,r)}function Sn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[er(e,t)];e=e.display.externalMeasured;return e&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function Ln(e,t){var n,r,i=Je(t),o=Sn(e,i);o&&!o.text?o=null:o&&o.changes&&(ln(e,o,i,Xn(e)),e.curOp.forceUpdate=!0),o||(n=e,e=Je(r=Wt(r=t)),(r=n.display.externalMeasured=new en(n.doc,r,e)).lineN=e,e=r.built=Yt(n,r),r.text=e.pre,S(n.display.lineMeasure,e.pre),o=r);i=xn(o,t,i);return{line:t,view:o,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Tn(e,t,n,r,i){var o,a=(n=t.before?-1:n)+(r||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,n){var r=e.options.lineWrapping,e=r&&kn(e);if(!t.measure.heights||r&&t.measure.width!=e){var i=t.measure.heights=[];if(r){t.measure.width=e;for(var o=t.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var s=o[a],l=o[a+1];2<Math.abs(s.bottom-l.bottom)&&i.push((s.bottom+l.top)/2-n.top)}}i.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=En(t.map,n,r),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;s&&ne(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+l));)++l;if((i=w&&v<9&&0==s&&l==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():function(e,t){var n=An;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;0<=i&&(n=e[i]).left==n.right;i--);return n}(P(a,s,l).getClientRects(),r)).left||i.right||0==s)break;l=s,s-=1,c="right"}w&&v<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=je)return je;var e=(t=S(e,T("span","x"))).getBoundingClientRect(),t=P(t,0,1).getBoundingClientRect();return je=1<Math.abs(e.left-t.left)}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,e=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*e,bottom:t.bottom*e}}(e.display.measure,i))}else 0<s&&(c=r="right"),i=e.options.lineWrapping&&1<(g=a.getClientRects()).length?g["right"==r?g.length-1:0]:a.getBoundingClientRect();!(w&&v<9)||s||i&&(i.left||i.right)||(m=a.parentNode.getClientRects()[0],i=m?{left:m.left,right:m.left+Kn(e.display),top:m.top,bottom:m.bottom}:An);for(var h=i.top-t.rect.top,n=i.bottom-t.rect.top,d=(h+n)/2,p=t.view.measure.heights,f=0;f<p.length-1&&!(d<p[f]);f++);var g=f?p[f-1]:0,m=p[f],m={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:g,bottom:m};i.left||i.right||(m.bogus=!0);e.options.singleCursorHeightPerLine||(m.rtop=h,m.rbottom=n);return m}(e,t,n,r)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Mn,An={left:0,right:0,top:0,bottom:0};function En(e,t,n){for(var r,i,o,a,s,l,c=0;c<e.length;c+=3)if(s=e[c],l=e[c+1],t<s?(i=0,o=1,a="left"):t<l?o=(i=t-s)+1:(c==e.length-3||t==l&&e[c+3]>t)&&(i=(o=l-s)-1,l<=t&&(a="right")),null!=i){if(r=e[c+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==l-s)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)r=e[(c+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:s,coverEnd:l}}function Dn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Pn(e){e.display.externalMeasure=null,C(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Dn(e.display.view[t])}function Fn(e){Pn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function On(){return o&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Nn(){return o&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function zn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=gn(e.widgets[n]));return t}function Hn(e,t,n,r,i){if(i||(i=zn(t),n.top+=i,n.bottom+=i),"line"==r)return n;r=r||"local";t=Ut(t);return"local"==r?t+=vn(e.display):t-=e.display.viewOffset,"page"!=r&&"window"!=r||(t+=(e=e.display.lineSpace.getBoundingClientRect()).top+("window"==r?0:Nn()),r=e.left+("window"==r?0:On()),n.left+=r,n.right+=r),n.top+=t,n.bottom+=t,n}function jn(e,t,n){if("div"==n)return t;var r=t.left,t=t.top;"page"==n?(r-=On(),t-=Nn()):"local"!=n&&n||(r+=(n=e.display.sizer.getBoundingClientRect()).left,t+=n.top);e=e.display.lineSpace.getBoundingClientRect();return{left:r-e.left,top:t-e.top}}function Wn(e,t,n,r,i){return Hn(e,r=r||Xe(e.doc,t.line),Cn(e,r,t.ch,i),n)}function In(n,e,r,i,o,a){function s(e,t){e=Tn(n,o,e,t?"right":"left",a);return t?e.left=e.right:e.right=e.left,Hn(n,i,e,r)}i=i||Xe(n.doc,e.line),o=o||Ln(n,i);var l=me(i,n.doc.direction),t=e.ch,c=e.sticky;if(t>=i.text.length?(t=i.text.length,c="before"):t<=0&&(t=0,c="after"),!l)return s("before"==c?t-1:t,"before"==c);function u(e,t,n){return s(n?e-1:e,1==l[t].level!=n)}var h=ae(l,t,c),e=oe,h=u(t,h,"before"==c);return null!=e&&(h.other=u(t,e,"before"!=c)),h}function Rn(e,t){var n=0;t=ut(e.doc,t),e.options.lineWrapping||(n=Kn(e.display)*t.ch);t=Xe(e.doc,t.line),e=Ut(t)+vn(e.display);return{left:n,right:n,top:e,bottom:e+t.height}}function Bn(e,t,n,r,i){n=rt(e,t,n);return n.xRel=i,r&&(n.outside=r),n}function Un(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Bn(r.first,0,null,-1,-1);var i=et(r,n),o=r.first+r.size-1;if(o<i)return Bn(r.first+r.size-1,Xe(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=Xe(r,i);;){var s=function(n,e,t,r,i){i-=Ut(e);var o=Ln(n,e),a=zn(e),s=0,l=e.text.length,c=!0,u=me(e,n.doc.direction);u&&(p=(n.options.lineWrapping?function(e,t,n,r,i,o,a){var a=qn(e,t,r,a),s=a.begin,l=a.end;/\s/.test(t.text.charAt(l-1))&&l--;for(var c=null,u=null,h=0;h<i.length;h++){var d,p=i[h];p.from>=l||p.to<=s||(d=1!=p.level,d=Tn(e,r,d?Math.min(l,p.to)-1:Math.max(s,p.from)).right,d=d<o?o-d+1e9:d-o,(!c||d<u)&&(c=p,u=d))}c=c||i[i.length-1];c.from<s&&(c={from:s,to:c.to,level:c.level});c.to>l&&(c={from:c.from,to:l,level:c.level});return c}:function(n,r,i,o,a,s,l){var e=ie(function(e){var t=a[e],e=1!=t.level;return Gn(In(n,rt(i,e?t.to:t.from,e?"before":"after"),"line",r,o),s,l,!0)},0,a.length-1),t=a[e];{var c;0<e&&(c=1!=t.level,Gn(c=In(n,rt(i,c?t.from:t.to,c?"after":"before"),"line",r,o),s,l,!0)&&c.top>l&&(t=a[e-1]))}return t})(n,e,t,o,u,r,i),c=1!=p.level,s=c?p.from:p.to-1,l=c?p.to:p.from-1);var h=null,d=null,u=ie(function(e){var t=Tn(n,o,e);return t.top+=a,t.bottom+=a,Gn(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(h=e,d=t),1)},s,l),p=!1;{var f,g;d?(f=r-d.left<d.right-r,u=h+((g=f==c)?0:1),g=g?"after":"before",f=f?d.left:d.right):(c||u!=l&&u!=s||u++,g=0==u||u!=e.text.length&&Tn(n,o,u-(c?1:0)).bottom+a<=i==c?"after":"before",c=In(n,rt(t,u,g),"line",e,o),f=c.left,p=i<c.top?-1:i>=c.bottom?1:0)}return u=re(e.text,u,1),Bn(t,u,g,p,r-f)}(e,a,i,t,n),l=function(e,t){var n,r=St&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Ot(n,o.marker)<0)&&(n=o.marker)}return n}(a,s.ch+(0<s.xRel||0<s.outside?1:0));if(!l)return s;l=l.find(1);if(l.line==i)return l;a=Xe(r,i=l.line)}}function qn(t,e,n,r){r-=zn(e);var i=e.text.length,e=ie(function(e){return Tn(t,n,e-1).bottom<=r},i,0);return{begin:e,end:i=ie(function(e){return Tn(t,n,e).top>r},e,i)}}function $n(e,t,n,r){return qn(e,t,n=n||Ln(e,t),Hn(e,t,Tn(e,n,r),"line").top)}function Gn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Vn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Mn){Mn=T("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mn.appendChild(document.createTextNode("x")),Mn.appendChild(T("br"));Mn.appendChild(document.createTextNode("x"))}S(e.measure,Mn);var n=Mn.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),C(e.measure),n||1}function Kn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=T("span","xxxxxxxxxx"),n=T("pre",[t],"CodeMirror-line-like");S(e.measure,n);t=t.getBoundingClientRect(),t=(t.right-t.left)/10;return 2<t&&(e.cachedCharWidth=t),t||10}function Xn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Yn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Yn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Zn(r){var i=Vn(r.display),o=r.options.lineWrapping,a=o&&Math.max(5,r.display.scroller.clientWidth/Kn(r.display)-3);return function(e){if(Bt(r.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;n++)e.widgets[n].height&&(t+=e.widgets[n].height);return o?t+(Math.ceil(e.text.length/a)||1)*i:t+i}}function Qn(e){var t=e.doc,n=Zn(e);t.iter(function(e){var t=n(e);t!=e.height&&Qe(e,t)})}function Jn(e,t,n,r){var i=e.display;if(!n&&"true"==Ee(t).getAttribute("cm-not-content"))return null;var o,i=i.lineSpace.getBoundingClientRect();try{o=t.clientX-i.left,s=t.clientY-i.top}catch(e){return null}var a,s=Un(e,o,s);return r&&0<s.xRel&&(a=Xe(e.doc,s.line).text).length==s.ch&&(a=z(a,a.length,e.options.tabSize)-a.length,s=rt(s.line,Math.max(0,Math.round((o-yn(e.display).left)/Kn(e.display))-a))),s}function er(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function tr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size);var i,o,a=e.display;(r=r||0)&&n<a.viewTo&&(null==a.updateLineNumbers||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo?St&&It(e.doc,t)<a.viewTo&&rr(e):n<=a.viewFrom?St&&Rt(e.doc,n+r)>a.viewFrom?rr(e):(a.viewFrom+=r,a.viewTo+=r):t<=a.viewFrom&&n>=a.viewTo?rr(e):t<=a.viewFrom?(i=ir(e,n,n+r,1))?(a.view=a.view.slice(i.index),a.viewFrom=i.lineN,a.viewTo+=r):rr(e):n>=a.viewTo?(o=ir(e,t,t,-1))?(a.view=a.view.slice(0,o.index),a.viewTo=o.lineN):rr(e):(i=ir(e,t,t,-1),o=ir(e,n,n+r,1),i&&o?(a.view=a.view.slice(0,i.index).concat(tn(e,i.lineN,o.lineN)).concat(a.view.slice(o.index)),a.viewTo+=r):rr(e));e=a.externalMeasured;e&&(n<e.lineN?e.lineN+=r:t<e.lineN+e.size&&(a.externalMeasured=null))}function nr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo||(null==(t=r.view[er(e,t)]).node||-1==j(t=t.changes||(t.changes=[]),n)&&t.push(n))}function rr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ir(e,t,n,r){var i,o=er(e,t),a=e.display.view;if(!St||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,l=0;l<o;l++)s+=a[l].size;if(s!=t){if(0<r){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;It(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function or(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function ar(e){e.display.input.showSelection(e.display.input.prepareSelection())}function sr(e,t){void 0===t&&(t=!0);for(var n,r,i=e.doc,o={},a=o.cursors=document.createDocumentFragment(),s=o.selection=document.createDocumentFragment(),l=0;l<i.sel.ranges.length;l++)!t&&l==i.sel.primIndex||((n=i.sel.ranges[l]).from().line>=e.display.viewTo||n.to().line<e.display.viewFrom||(((r=n.empty())||e.options.showCursorWhenSelecting)&&lr(e,n.head,a),r||function(i,e,t){var n=i.display,o=i.doc,a=document.createDocumentFragment(),r=yn(i.display),x=r.left,C=Math.max(n.sizerWidth,kn(i)-n.sizer.offsetLeft)-r.right,S="ltr"==o.direction;function L(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),a.appendChild(T("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?C-e:n)+"px;\n height: "+(r-t)+"px"))}function s(n,g,m){var v,b,r=Xe(o,n),y=r.text.length;function w(e,t){return Wn(i,rt(n,e),"div",r,t)}function k(e,t,n){e=$n(i,r,null,e),t="ltr"==t==("after"==n)?"left":"right";return w("after"==n?e.begin:e.end-(/\s/.test(r.text.charAt(e.end-1))?2:1),t)[t]}var _=me(r,o.direction);return function(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(_,g||0,null==m?y:m,function(e,t,n,r){var i,o,a,s,l="ltr"==n,c=w(e,l?"left":"right"),u=w(t-1,l?"right":"left"),h=null==g&&0==e,d=null==m&&t==y,p=0==r,f=!_||r==_.length-1;u.top-c.top<=3?(i=(S?h:d)&&p?x:(l?c:u).left,r=(S?d:h)&&f?C:(l?u:c).right,L(i,c.top,r-i,c.bottom)):(n=l?(o=S&&h&&p?x:c.left,a=S?C:k(e,n,"before"),s=S?x:k(t,n,"after"),S&&d&&f?C:u.right):(o=S?k(e,n,"before"):x,a=!S&&h&&p?C:c.right,s=!S&&d&&f?x:u.left,S?k(t,n,"after"):C),L(o,c.top,a-o,c.bottom),c.bottom<u.top&&L(x,c.bottom,null,u.top),L(s,u.top,n-s,u.bottom)),(!v||cr(c,v)<0)&&(v=c),cr(u,v)<0&&(v=u),(!b||cr(c,b)<0)&&(b=c),cr(u,b)<0&&(b=u)}),{start:v,end:b}}var l=e.from(),n=e.to();l.line==n.line?s(l.line,l.ch,n.ch):(r=Xe(o,l.line),e=Xe(o,n.line),e=Wt(r)==Wt(e),r=s(l.line,l.ch,e?r.text.length+1:null).end,n=s(n.line,e?0:null,n.ch).start,e&&(r.top<n.top-2?(L(r.right,r.top,null,r.bottom),L(x,n.top,n.left,n.bottom)):L(r.right,r.top,n.left-r.right,r.bottom)),r.bottom<n.top&&L(x,r.bottom,null,n.top));t.appendChild(a)}(e,n,s)));return o}function lr(e,t,n){var r=In(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),t=n.appendChild(T("div"," ","CodeMirror-cursor"));t.style.left=r.left+"px",t.style.top=r.top+"px",t.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other&&((n=n.appendChild(T("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))).style.display="",n.style.left=r.other.left+"px",n.style.top=r.other.top+"px",n.style.height=.85*(r.other.bottom-r.other.top)+"px")}function cr(e,t){return e.top-t.top||e.left-t.left}function ur(e){var t,n;e.state.focused&&(t=e.display,clearInterval(t.blinker),n=!0,t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||fr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function hr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||pr(e))}function dr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&fr(e))},100)}function pr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(ke(e,"focus",e,t),e.state.focused=!0,E(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),p&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ur(e))}function fr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ke(e,"blur",e,t),e.state.focused=!1,x(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function gr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i,o=t.view[r],a=e.options.lineWrapping,s=void 0,l=0;if(!o.hidden){w&&v<8?(s=(i=o.node.offsetTop+o.node.offsetHeight)-n,n=i):(s=(c=o.node.getBoundingClientRect()).bottom-c.top,!a&&o.text.firstChild&&(l=o.text.firstChild.getBoundingClientRect().right-c.left-1));var c=o.line.height-s;if((.005<c||c<-.005)&&(Qe(o.line,s),mr(o.line),o.rest))for(var u=0;u<o.rest.length;u++)mr(o.rest[u]);l>e.display.sizerWidth&&((l=Math.ceil(l/Kn(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=l,e.display.maxLine=o.line,e.display.maxLineChanged=!0))}}}function mr(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function vr(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop,r=Math.floor(r-vn(e)),i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=et(t,r),r=et(t,i);return n&&n.ensure&&(i=n.ensure.from.line,n=n.ensure.to.line,i<o?r=et(t,Ut(Xe(t,o=i))+e.wrapper.clientHeight):Math.min(n,t.lastLine())>=r&&(o=et(t,Ut(Xe(t,n))-e.wrapper.clientHeight),r=n)),{from:o,to:Math.max(r,o+1)}}function br(e,t){var n=e.display,r=Vn(e.display);t.top<0&&(t.top=0);var i=(e.curOp&&null!=e.curOp.scrollTop?e.curOp:n.scroller).scrollTop,o=_n(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+bn(n),l=t.top<r,r=t.bottom>s-r;t.top<i?a.scrollTop=l?0:t.top:t.bottom>i+o&&((c=Math.min(t.top,(r?s:t.bottom)-o))!=i&&(a.scrollTop=c));var i=e.options.fixedGutter?0:n.gutters.offsetWidth,c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-i,e=kn(e)-n.gutters.offsetWidth,n=t.right-t.left>e;return n&&(t.right=t.left+e),t.left<10?a.scrollLeft=0:t.left<c?a.scrollLeft=Math.max(0,t.left+i-(n?0:10)):t.right>e+c-3&&(a.scrollLeft=t.right+(n?0:10)-e),a}function yr(e,t){null!=t&&(_r(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc:e.curOp).scrollTop+t)}function wr(e){_r(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function kr(e,t,n){null==t&&null==n||_r(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function _r(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,xr(e,Rn(e,t.from),Rn(e,t.to),t.margin))}function xr(e,t,n,r){r=br(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});kr(e,r.scrollLeft,r.scrollTop)}function Cr(e,t){Math.abs(e.doc.scrollTop-t)<2||(d||qr(e,{top:t}),Sr(e,t,!0),d&&qr(e),Wr(e,100))}function Sr(e,t,n){t=Math.max(0,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 Lr(e,t,n,r){t=Math.max(0,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,Vr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Tr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+bn(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+wn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}e=function(e,t,n){this.cm=n;var r=this.vert=T("div",[T("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=T("div",[T("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),be(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),be(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,w&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};e.prototype.update=function(e){var t,n=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",t=e.viewHeight-(n?i:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px",t=e.viewWidth-e.barLeft-(r?i:0),this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+t)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0<e.clientHeight&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:n?i:0}},e.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},e.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},e.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=g&&!a?"12px":"18px",this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},e.prototype.enableZeroWidthBar=function(n,r,i){n.style.pointerEvents="auto",r.set(1e3,function e(){var t=n.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=n?n.style.pointerEvents="none":r.set(1e3,e)})},e.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};r=function(){};function Mr(e,t){t=t||Tr(e);var n=e.display.barWidth,r=e.display.barHeight;Ar(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&gr(e),Ar(e,Tr(e)),n=e.display.barWidth,r=e.display.barHeight}function Ar(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=""}r.prototype.update=function(){return{bottom:0,right:0}},r.prototype.setScrollLeft=function(){},r.prototype.setScrollTop=function(){},r.prototype.clear=function(){};var Er={native:e,null:r};function Dr(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&x(n.display.wrapper,n.display.scrollbars.addClass)),n.display.scrollbars=new Er[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),be(e,"mousedown",function(){n.state.focused&&setTimeout(function(){return n.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){("horizontal"==t?Lr:Cr)(n,e)},n),n.display.scrollbars.addClass&&E(n.display.wrapper,n.display.scrollbars.addClass)}var Pr=0;function Fr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Pr},e=e.curOp,nn?nn.ops.push(e):e.ownsGroup=nn={ops:[e],delayedCallbacks:[]}}function Or(e){e=e.curOp;e&&rn(e,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,n=0;n<t.length;n++)!function(e){var t=e.cm,n=t.display;(function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=wn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=wn(e)+"px",t.scrollbarsClipped=!0)})(t),e.updateMaxLine&&$t(t);e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Rr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}(t[n]);for(var r=0;r<t.length;r++)!function(e){e.updatedDisplay=e.mustUpdate&&Br(e.cm,e.update)}(t[r]);for(var i=0;i<t.length;i++)!function(e){var t=e.cm,n=t.display;e.updatedDisplay&&gr(t);e.barMeasure=Tr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Cn(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+wn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-kn(t)));(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}(t[i]);for(var o=0;o<t.length;o++)!function(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Lr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==A();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n);!e.updatedDisplay&&e.startHeight==t.doc.height||Mr(t,e.barMeasure);e.updatedDisplay&&Gr(t,e.barMeasure);e.selectionChanged&&ur(t);t.state.focused&&e.updateInput&&t.display.input.reset(e.typing);n&&hr(e.cm)}(t[o]);for(var a=0;a<t.length;a++)!function(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&Ur(t,e.update);null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null);null!=e.scrollTop&&Sr(t,e.scrollTop,e.forceScroll);null!=e.scrollLeft&&Lr(t,e.scrollLeft,!0,!0);{var i;e.scrollToPos&&(i=function(e,t,n,r){null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?rt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?rt(t.line,t.ch+1,"before"):t);for(var i=0;i<5;i++){var o,a=!1,s=In(e,t),l=n&&n!=t?In(e,n):s,c=br(e,o={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),s=e.doc.scrollTop,l=e.doc.scrollLeft;if(null!=c.scrollTop&&(Cr(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-s)&&(a=!0)),null!=c.scrollLeft&&(Lr(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-l)&&(a=!0)),!a)break}return o}(t,ut(r,e.scrollToPos.from),ut(r,e.scrollToPos.to),e.scrollToPos.margin),function(e,t){var n,r,i;_e(e,"scrollCursorIntoView")||(r=(n=e.display).sizer.getBoundingClientRect(),i=null,t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null==i||c||(t=T("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-vn(e.display))+"px;\n height: "+(t.bottom-t.top+wn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),e.display.lineSpace.appendChild(t),t.scrollIntoView(i),e.display.lineSpace.removeChild(t)))}(t,i))}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||ke(o[s],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&ke(a[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop);e.changeObjs&&ke(t,"changes",t,e.changeObjs);e.update&&e.update.finish()}(t[a])}(e)})}function Nr(e,t){if(e.curOp)return t();Fr(e);try{return t()}finally{Or(e)}}function zr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Fr(e);try{return t.apply(e,arguments)}finally{Or(e)}}}function Hr(e){return function(){if(this.curOp)return e.apply(this,arguments);Fr(this);try{return e.apply(this,arguments)}finally{Or(this)}}}function jr(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Fr(e);try{return t.apply(this,arguments)}finally{Or(e)}}}function Wr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(Ir,e))}function Ir(a){var s,l,c,u=a.doc;u.highlightFrontier>=a.display.viewTo||(s=+new Date+a.options.workTime,l=mt(a,u.highlightFrontier),c=[],u.iter(l.line,Math.min(u.first+u.size,a.display.viewTo+500),function(e){if(l.line>=a.display.viewFrom){var t=e.styles,n=e.text.length>a.options.maxHighlightLength?$e(u.mode,l.state):null,r=ft(a,e,l,!0);n&&(l.state=n),e.styles=r.styles;n=e.styleClasses,r=r.classes;r?e.styleClasses=r:n&&(e.styleClasses=null);for(var i=!t||t.length!=e.styles.length||n!=r&&(!n||!r||n.bgClass!=r.bgClass||n.textClass!=r.textClass),o=0;!i&&o<t.length;++o)i=t[o]!=e.styles[o];i&&c.push(l.line),e.stateAfter=l.save(),l.nextLine()}else e.text.length<=a.options.maxHighlightLength&&vt(a,e.text,l),e.stateAfter=l.line%5==0?l.save():null,l.nextLine();if(+new Date>s)return Wr(a,a.options.workDelay),!0}),u.highlightFrontier=l.line,u.modeFrontier=Math.max(u.modeFrontier,l.line),c.length&&Nr(a,function(){for(var e=0;e<c.length;e++)nr(a,c[e],"text")}))}var Rr=function(e,t,n){var r=e.display;this.viewport=t,this.visible=vr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=kn(e),this.force=n,this.dims=Xn(e),this.events=[]};function Br(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return rr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==or(e))return!1;Kr(e)&&(rr(e),t.dims=Xn(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),St&&(o=It(e.doc,o),a=Rt(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;r=o,i=a,0==(a=(o=e).display).view.length||r>=a.viewTo||i<=a.viewFrom?(a.view=tn(o,r,i),a.viewFrom=r):(a.viewFrom>r?a.view=tn(o,r,a.viewFrom).concat(a.view):a.viewFrom<r&&(a.view=a.view.slice(er(o,r))),a.viewFrom=r,a.viewTo<i?a.view=a.view.concat(tn(o,a.viewTo,i)):a.viewTo>i&&(a.view=a.view.slice(0,er(o,i)))),a.viewTo=i,n.viewOffset=Ut(Xe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";o=or(e);if(!s&&0==o&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;a=function(e){if(e.hasFocus())return null;var t=A();if(!t||!M(e.display.lineDiv,t))return null;var n={activeElt:t};return!window.getSelection||(t=window.getSelection()).anchorNode&&t.extend&&M(e.display.lineDiv,t.anchorNode)&&(n.anchorNode=t.anchorNode,n.anchorOffset=t.anchorOffset,n.focusNode=t.focusNode,n.focusOffset=t.focusOffset),n}(e);return 4<o&&(n.lineDiv.style.display="none"),function(n,e,t){var r=n.display,i=n.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var t=e.nextSibling;return p&&g&&n.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var l=r.view,c=r.viewFrom,u=0;u<l.length;u++){var h=l[u];if(!h.hidden)if(h.node&&h.node.parentNode==o){for(;a!=h.node;)a=s(a);var d=i&&null!=e&&e<=c&&h.lineNumber;h.changes&&(-1<j(h.changes,"gutter")&&(d=!1),ln(n,h,c,t)),d&&(C(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(nt(n.options,c)))),a=h.node.nextSibling}else{d=function(e,t,n,r){var i=un(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),hn(e,t),dn(e,t,n,r),pn(e,t,r),t.node}(n,h,c,t);o.insertBefore(d,a)}c+=h.size}for(;a;)a=s(a)}(e,n.updateLineNumbers,t.dims),4<o&&(n.lineDiv.style.display=""),n.renderedView=n.view,(i=a)&&i.activeElt&&i.activeElt!=A()&&(i.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(i.activeElt.nodeName)&&i.anchorNode&&M(document.body,i.anchorNode)&&M(document.body,i.focusNode)&&(o=window.getSelection(),(a=document.createRange()).setEnd(i.anchorNode,i.anchorOffset),a.collapse(!1),o.removeAllRanges(),o.addRange(a),o.extend(i.focusNode,i.focusOffset))),C(n.cursorDiv),C(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Wr(e,400)),!(n.updateLineNumbers=null)}function Ur(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=kn(e))r&&(t.visible=vr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+bn(e.display)-_n(e),n.top)}),t.visible=vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Br(e,t))break;gr(e);var i=Tr(e);ar(e),Mr(e,i),Gr(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 qr(e,t){var n=new Rr(e,t);Br(e,n)&&(gr(e),Ur(e,n),t=Tr(e),ar(e),Mr(e,t),Gr(e,t),n.finish())}function $r(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Gr(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+wn(e)+"px"}function Vr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Yn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Kr(e){if(e.options.lineNumbers){var t=e.doc,n=nt(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(T("div",[T("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),t=i.firstChild.offsetWidth,i=i.offsetWidth-t;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(t,r.lineGutter.offsetWidth-i)+1,r.lineNumWidth=r.lineNumInnerWidth+i,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",$r(e.display),1}}}function Xr(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Yr(e){var t=e.gutters,n=e.gutterSpecs;C(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,i=t.appendChild(T("div",null,"CodeMirror-gutter "+o));a&&(i.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=i).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",$r(e)}function Zr(e){Yr(e.display),tr(e),Vr(e)}function Qr(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=T("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=T("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=L("div",null,"CodeMirror-code"),i.selectionDiv=T("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=T("div",null,"CodeMirror-cursors"),i.measure=T("div",null,"CodeMirror-measure"),i.lineMeasure=T("div",null,"CodeMirror-measure"),i.lineSpace=L("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=L("div",[i.lineSpace],"CodeMirror-lines");i.mover=T("div",[o],null,"position: relative"),i.sizer=T("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=T("div",null,null,"position: absolute; height: "+W+"px; width: 1px;"),i.gutters=T("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=T("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=T("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),w&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),p||d&&h||(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,i.gutterSpecs=Xr(r.gutters,r.lineNumbers),Yr(i),n.init(i)}Rr.prototype.signal=function(e,t){Ce(e,t)&&this.events.push(arguments)},Rr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ke.apply(null,this.events[e])};var Jr=0,ei=null;function ti(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function ni(e){e=ti(e);return e.x*=ei,e.y*=ei,e}function ri(e,t){var n=ti(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&g&&p)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var h=0;h<u.length;h++)if(u[h].node==c){e.display.currentWheelTarget=c;break e}if(r&&!d&&!f&&null!=ei)return i&&l&&Cr(e,Math.max(0,a.scrollTop+i*ei)),Lr(e,Math.max(0,a.scrollLeft+r*ei)),(!i||i&&l)&&Le(t),void(o.wheelStartX=null);i&&null!=ei&&(s=(n=e.doc.scrollTop)+o.wrapper.clientHeight,(l=i*ei)<0?n=Math.max(0,n+l-50):s=Math.min(e.doc.height,s+l+50),qr(e,{top:n,bottom:s})),Jr<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){var e,t;null!=o.wheelStartX&&(t=a.scrollLeft-o.wheelStartX,t=(e=a.scrollTop-o.wheelStartY)&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX,o.wheelStartX=o.wheelStartY=null,t&&(ei=(ei*Jr+t)/(Jr+1),++Jr))},200)):(o.wheelDX+=r,o.wheelDY+=i))}}w?ei=-.53:d?ei=15:o?ei=-.7:u&&(ei=-1/3);var ii=function(e,t){this.ranges=e,this.primIndex=t};ii.prototype.primary=function(){return this.ranges[this.primIndex]},ii.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!ot(n.anchor,r.anchor)||!ot(n.head,r.head))return!1}return!0},ii.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new oi(at(this.ranges[t].anchor),at(this.ranges[t].head));return new ii(e,this.primIndex)},ii.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ii.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(0<=it(t,r.from())&&it(e,r.to())<=0)return n}return-1};var oi=function(e,t){this.anchor=e,this.head=t};function ai(e,t,n){var r=e&&e.options.selectionsMayTouch,e=t[n];t.sort(function(e,t){return it(e.from(),t.from())}),n=j(t,e);for(var i=1;i<t.length;i++){var o,a=t[i],s=t[i-1],l=it(s.to(),a.from());(r&&!a.empty()?0<l:0<=l)&&(o=lt(s.from(),a.from()),l=st(s.to(),a.to()),s=s.empty()?a.from()==a.head:s.from()==s.head,i<=n&&--n,t.splice(--i,2,new oi(s?l:o,s?o:l)))}return new ii(t,n)}function si(e,t){return new ii([new oi(e,t||e)],0)}function li(e){return e.text?rt(e.from.line+e.text.length-1,V(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function ci(e,t){if(it(e,t.from)<0)return e;if(it(e,t.to)<=0)return li(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+=li(t).ch-t.to.ch),rt(n,r)}function ui(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new oi(ci(i.anchor,t),ci(i.head,t)))}return ai(e.cm,n,e.sel.primIndex)}function hi(e,t,n){return e.line==t.line?rt(n.line,e.ch-t.ch+n.ch):rt(n.line+(e.line-t.line),e.ch)}function di(e){e.doc.mode=Be(e.options,e.doc.modeOption),pi(e)}function pi(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Wr(e,100),e.state.modeGen++,e.curOp&&tr(e)}function fi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==V(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function gi(e,o,t,a){function i(e){return t?t[e]:null}function n(e,t,n){var r,i;r=t,i=n,t=a,(n=e).text=r,n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null),null!=n.order&&(n.order=null),Et(n),Dt(n,i),(t=t?t(n):1)!=n.height&&Qe(n,t),an(e,"change",e,o)}function r(e,t){for(var n=[],r=e;r<t;++r)n.push(new Gt(u[r],i(r),a));return n}var s,l=o.from,c=o.to,u=o.text,h=Xe(e,l.line),d=Xe(e,c.line),p=V(u),f=i(u.length-1),g=c.line-l.line;o.full?(e.insert(0,r(0,u.length)),e.remove(u.length,e.size-u.length)):fi(e,o)?(s=r(0,u.length-1),n(d,d.text,f),g&&e.remove(l.line,g),s.length&&e.insert(l.line,s)):h==d?1==u.length?n(h,h.text.slice(0,l.ch)+p+h.text.slice(c.ch),f):((s=r(1,u.length-1)).push(new Gt(p+h.text.slice(c.ch),f,a)),n(h,h.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,s)):1==u.length?(n(h,h.text.slice(0,l.ch)+u[0]+d.text.slice(c.ch),i(0)),e.remove(l.line+1,g)):(n(h,h.text.slice(0,l.ch)+u[0],i(0)),n(d,p+d.text.slice(c.ch),f),f=r(1,u.length-1),1<g&&e.remove(l.line+1,g-1),e.insert(l.line+1,f)),an(e,"change",e,o)}function mi(e,s,l){!function e(t,n,r){if(t.linked)for(var i=0;i<t.linked.length;++i){var o,a=t.linked[i];a.doc!=n&&(o=r&&a.sharedHist,l&&!o||(s(a.doc,o),e(a.doc,t,o)))}}(e,null,!0)}function vi(e,t){if(t.cm)throw new Error("This document is already in use.");Qn((e.doc=t).cm=e),di(e),bi(e),e.options.lineWrapping||$t(e),e.options.mode=t.modeOption,tr(e)}function bi(e){("rtl"==e.doc.direction?E:x)(e.display.lineDiv,"CodeMirror-rtl")}function yi(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function wi(e,t){var n={from:at(t.from),to:li(t),text:Ye(e,t.from,t.to)};return Si(e,n,t.from.line,t.to.line+1),mi(e,function(e){return Si(e,n,t.from.line,t.to.line+1),0},!0),n}function ki(e){for(;e.length;){if(!V(e).ranges)break;e.pop()}}function _i(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(l=i).lastOp==r?(ki(l.done),V(l.done)):l.done.length&&!V(l.done).ranges?V(l.done):1<l.done.length&&!l.done[l.done.length-2].ranges?(l.done.pop(),V(l.done)):void 0))a=V(o.changes),0==it(t.from,t.to)&&0==it(t.from,a.to)?a.to=li(t):o.changes.push(wi(e,t));else{var l=V(i.done);for(l&&l.ranges||Ci(e.sel,i.done),o={changes:[wi(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=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||ke(e,"historyAdded")}function xi(e,t,n,r){var i,o,a,s=e.history,l=r&&r.origin;n==s.lastSelOp||l&&s.lastSelOrigin==l&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==l||(i=e,o=l,a=V(s.done),e=t,"*"==(o=o.charAt(0))||"+"==o&&a.ranges.length==e.ranges.length&&a.somethingSelected()==e.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?s.done[s.done.length-1]=t:Ci(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=l,s.lastSelOp=n,r&&!1!==r.clearRedo&&ki(s.undone)}function Ci(e,t){var n=V(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Si(t,n,e,r){var i=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,r),function(e){e.markedSpans&&((i=i||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Li(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(function(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t=t||e.slice(0,n):t&&t.push(e[n]);return t?t.length?t:null:e}(n[i]));return r}function Ti(e,t){var n=Li(e,t),r=Mt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue e;o.push(l)}else a&&(n[i]=a)}return n}function Mi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?ii.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var c,u=a[l];if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&-1<j(t,Number(c[1]))&&(V(s)[h]=u[h],delete u[h])}}}return r}function Ai(e,t,n,r){if(r){r=e.anchor;return n&&((e=it(t,r)<0)!=it(n,r)<0?(r=t,t=n):e!=it(t,n)<0&&(t=n)),new oi(r,t)}return new oi(n||t,t)}function Ei(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ni(e,new ii([Ai(e.sel.primary(),t,n,i)],0),r)}function Di(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Ai(e.sel.ranges[o],t[o],null,i);Ni(e,ai(e.cm,r,e.sel.primIndex),n)}function Pi(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Ni(e,ai(e.cm,i,e.sel.primIndex),r)}function Fi(e,t,n,r){Ni(e,si(t,n),r)}function Oi(e,t,n){var r=e.history.done,i=V(r);i&&i.ranges?zi(e,r[r.length-1]=t,n):Ni(e,t,n)}function Ni(e,t,n){zi(e,t,n),xi(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function zi(e,t,n){var r,i;(Ce(e,"beforeSelectionChange")||e.cm&&Ce(e.cm,"beforeSelectionChange"))&&(r=e,i=n,i={ranges:(o=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new oi(ut(r,e[t].anchor),ut(r,e[t].head))},origin:i&&i.origin},ke(r,"beforeSelectionChange",r,i),r.cm&&ke(r.cm,"beforeSelectionChange",r.cm,i),t=i.ranges!=o.ranges?ai(r.cm,i.ranges,i.ranges.length-1):o);var o=n&&n.bias||(it(t.primary().head,e.sel.primary().head)<0?-1:1);Hi(e,Wi(e,t,o,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||wr(e.cm)}function Hi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),an(e,"cursorActivity",e))}function ji(e){Hi(e,Wi(e,e.sel,null,!1))}function Wi(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],l=Ri(e,a.anchor,s&&s.anchor,n,r),s=Ri(e,a.head,s&&s.head,n,r);!i&&l==a.anchor&&s==a.head||((i=i||t.ranges.slice(0,o))[o]=new oi(l,s))}return i?ai(e.cm,i,t.primIndex):t}function Ii(e,t,n,r,i){var o=Xe(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(c?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(u?s.to>=t.ch:s.to>t.ch))){if(i&&(ke(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(l.atomic){if(n){var h=l.find(r<0?1:-1),s=void 0;if((h=(r<0?u:c)?Bi(e,h,-r,h&&h.line==t.line?o:null):h)&&h.line==t.line&&(s=it(h,n))&&(r<0?s<0:0<s))return Ii(e,h,t,r,i)}l=l.find(r<0?-1:1);return(l=(r<0?c:u)?Bi(e,l,r,l.line==t.line?o:null):l)?Ii(e,l,t,r,i):null}}}return t}function Ri(e,t,n,r,i){r=r||1,r=Ii(e,t,n,r,i)||!i&&Ii(e,t,n,r,!0)||Ii(e,t,n,-r,i)||!i&&Ii(e,t,n,-r,!0);return r||(e.cantEdit=!0,rt(e.first,0))}function Bi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?ut(e,rt(t.line-1)):null:0<n&&t.ch==(r||Xe(e,t.line)).text.length?t.line<e.first+e.size-1?rt(t.line+1,0):null:new rt(t.line,t.ch+n)}function Ui(e){e.setSelection(rt(e.firstLine(),0),rt(e.lastLine()),R)}function qi(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,n,r){e&&(o.from=ut(i,e)),t&&(o.to=ut(i,t)),n&&(o.text=n),void 0!==r&&(o.origin=r)}),ke(i,"beforeChange",i,o),i.cm&&ke(i.cm,"beforeChange",i.cm,o),o.canceled?(i.cm&&(i.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function $i(e,t,n){if(e.cm){if(!e.cm.curOp)return zr(e.cm,$i)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ce(e,"beforeChange")||e.cm&&Ce(e.cm,"beforeChange"))||(t=qi(e,t,!0))){var r=Ct&&!n&&function(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=j(r,n)||(r=r||[]).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var c,u,h,d=i[l];it(d.to,s.from)<0||0<it(d.from,s.to)||(c=[l,1],u=it(d.from,s.from),h=it(d.to,s.to),(u<0||!a.inclusiveLeft&&!u)&&c.push({from:d.from,to:s.from}),(0<h||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:d.to}),i.splice.apply(i,c),l+=c.length-3)}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;0<=i;--i)Gi(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Gi(e,t)}}function Gi(e,n){var t,r;1==n.text.length&&""==n.text[0]&&0==it(n.from,n.to)||(t=ui(e,n),_i(e,n,t,e.cm?e.cm.curOp.id:NaN),Xi(e,n,t,Mt(e,n)),r=[],mi(e,function(e,t){t||-1!=j(r,e.history)||(Ji(e.history,n),r.push(e.history)),Xi(e,n,null,Mt(e,n))}))}function Vi(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,n=i.history,r=i.sel,s="undo"==o?n.done:n.undone,l="undo"==o?n.undone:n.done,c=0;c<s.length&&(a=s[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=s.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(a=s.pop()).ranges){if(t)return void s.push(a);break}if(Ci(a,l),e&&!a.equals(i.sel))return void Ni(i,a,{clearRedo:!1});r=a}var u=[];Ci(r,l),l.push({changes:u,generation:n.generation}),n.generation=a.generation||++n.maxGeneration;for(var h=Ce(i,"beforeChange")||i.cm&&Ce(i.cm,"beforeChange"),d=a.changes.length-1;0<=d;--d){var p=function(e){var n=a.changes[e];if(n.origin=o,h&&!qi(i,n,!1))return s.length=0,{};u.push(wi(i,n));var t=e?ui(i,n):V(s);Xi(i,n,t,Ti(i,n)),!e&&i.cm&&i.cm.scrollIntoView({from:n.from,to:li(n)});var r=[];mi(i,function(e,t){t||-1!=j(r,e.history)||(Ji(e.history,n),r.push(e.history)),Xi(e,n,null,Ti(e,n))})}(d);if(p)return p.v}}}}function Ki(e,t){if(0!=t&&(e.first+=t,e.sel=new ii(K(e.sel.ranges,function(e){return new oi(rt(e.anchor.line+t,e.anchor.ch),rt(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)nr(e.cm,r,"gutter")}}function Xi(e,t,n,r){if(e.cm&&!e.cm.curOp)return zr(e.cm,Xi)(e,t,n,r);var i;t.to.line<e.first?Ki(e,t.text.length-1-(t.to.line-t.from.line)):t.from.line>e.lastLine()||(t.from.line<e.first&&(Ki(e,i=t.text.length-1-(e.first-t.from.line)),t={from:rt(e.first,0),to:rt(t.to.line+i,t.to.ch),text:[V(t.text)],origin:t.origin}),i=e.lastLine(),(t=t.to.line>i?{from:t.from,to:rt(i,Xe(e,i).text.length),text:[t.text[0]],origin:t.origin}:t).removed=Ye(e,t.from,t.to),n=n||ui(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=Je(Wt(Xe(r,o.line))),r.iter(l,a.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<r.sel.contains(t.from,t.to)&&xe(e);gi(r,t,n,Zn(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,function(e){var t=qt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;n<r;r--){var i=Xe(e,r).stateAfter;if(i&&(!(i instanceof dt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}})(r,o.line),Wr(e,400);l=t.text.length-(a.line-o.line)-1;t.full?tr(e):o.line!=a.line||1!=t.text.length||fi(e.doc,t)?tr(e,o.line,a.line+1,l):nr(e,o.line,"text");r=Ce(e,"changes"),l=Ce(e,"change");(l||r)&&(t={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin},l&&an(e,"change",e,t),r&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(t));e.display.selForContextMenu=null}(e.cm,t,r):gi(e,t,r),zi(e,n,R),e.cantEdit&&Ri(e,rt(e.firstLine(),0))&&(e.cantEdit=!1))}function Yi(e,t,n,r,i){var o;it(r=r||n,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),$i(e,{from:n,to:r,text:t,origin:i})}function Zi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qi(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)Zi(o.ranges[s].anchor,t,n,r),Zi(o.ranges[s].head,t,n,r)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=rt(c.from.line+r,c.from.ch),c.to=rt(c.to.line+r,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function Ji(e,t){var n=t.from.line,r=t.to.line,t=t.text.length-(r-n)-1;Qi(e.done,n,r,t),Qi(e.undone,n,r,t)}function eo(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Xe(e,ct(e,t)):i=Je(t),null==i?null:(r(o,i)&&e.cm&&nr(e.cm,i,n),o)}function to(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function no(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}oi.prototype.from=function(){return lt(this.anchor,this.head)},oi.prototype.to=function(){return st(this.anchor,this.head)},oi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},to.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n,r=e,i=e+t;r<i;++r){var o=this.lines[r];this.height-=o.height,(n=o).parent=null,Et(n),an(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},no.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n,r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e),s=i.height;if(i.removeInner(e,a),this.height-=s-i.height,o==a&&(this.children.splice(r--,1),i.parent=null),0==(t-=a))break;e=0}else e-=o}this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof to))&&(this.collapse(n=[]),this.children=[new to(n)],this.children[0].parent=this)},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&50<i.lines.length){for(var a=i.lines.length%25+25,s=a;s<i.lines.length;){var l=new to(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t,n=new no(e.children.splice(e.children.length-5,5))}while(e.parent?(e.size-=n.size,e.height-=n.height,t=j(e.parent.children,e),e.parent.children.splice(t+1,0,n)):(((t=new no(e.children)).parent=e).children=[t,n],e=t),n.parent=e.parent,10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};function ro(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t}function io(e,t,n){Ut(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&yr(e,n)}ro.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Je(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=gn(this);Qe(n,Math.max(0,n.height-o)),e&&(Nr(e,function(){io(e,n,-o),nr(e,r,"widget")}),an(e,"lineWidgetCleared",e,this,r))}},ro.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=gn(this)-t;i&&(Bt(this.doc,r)||Qe(r,r.height+i),n&&Nr(n,function(){n.curOp.forceUpdate=!0,io(n,r,i),an(n,"lineWidgetChanged",n,e,Je(r))}))},Se(ro);var oo=0,ao=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++oo};function so(t,n,r,e,i){if(e&&e.shared)return function(e,n,r,i,o){(i=N(i)).shared=!1;var a=[so(e,n,r,i,o)],s=a[0],l=i.widgetNode;return mi(e,function(e){l&&(i.widgetNode=l.cloneNode(!0)),a.push(so(e,ut(e,n),ut(e,r),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=V(a)}),new lo(a,s)}(t,n,r,e,i);if(t.cm&&!t.cm.curOp)return zr(t.cm,so)(t,n,r,e,i);var o=new ao(t,i),i=it(n,r);if(e&&N(e,o,!1),0<i||0==i&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=L("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(jt(t,n.line,n,r,o)||n.line!=r.line&&jt(t,r.line,n,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");St=!0}o.addToHistory&&_i(t,{from:n,to:r,origin:"markText"},t.sel,NaN);var a,s=n.line,l=t.cm;if(t.iter(s,r.line+1,function(e){var t;l&&o.collapsed&&!l.options.lineWrapping&&Wt(e)==l.display.maxLine&&(a=!0),o.collapsed&&s!=n.line&&Qe(e,0),t=e,e=new Lt(o,s==n.line?n.ch:null,s==r.line?r.ch:null),t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t),++s}),o.collapsed&&t.iter(n.line,r.line+1,function(e){Bt(t,e)&&Qe(e,0)}),o.clearOnEnter&&be(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Ct=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++oo,o.atomic=!0),l){if(a&&(l.curOp.updateMaxLine=!0),o.collapsed)tr(l,n.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=n.line;c<=r.line;c++)nr(l,c,"text");o.atomic&&ji(l.doc),an(l,"markerAdded",l,o)}return o}ao.prototype.clear=function(){if(!this.explicitlyCleared){var e,t=this.doc.cm,n=t&&!t.curOp;n&&Fr(t),!Ce(this,"clear")||(e=this.find())&&an(this,"clear",e.from,e.to);for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=Tt(a.markedSpans,this);t&&!this.collapsed?nr(t,Je(a),"text"):t&&(null!=s.to&&(i=Je(a)),null!=s.from&&(r=Je(a))),a.markedSpans=function(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n=n||[]).push(e[r]);return n}(a.markedSpans,s),null==s.from&&this.collapsed&&!Bt(this.doc,a)&&t&&Qe(a,Vn(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Wt(this.lines[l]),u=qt(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&tr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&ji(t.doc)),t&&an(t,"markerCleared",t,this,r,i),n&&Or(t),this.parent&&this.parent.clear()}},ao.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Tt(o.markedSpans,this);if(null!=a.from&&(n=rt(t?o:Je(o),a.from),-1==e))return n;if(null!=a.to&&(r=rt(t?o:Je(o),a.to),1==e))return r}return n&&{from:n,to:r}},ao.prototype.changed=function(){var n=this,r=this.find(-1,!0),i=this,o=this.doc.cm;r&&o&&Nr(o,function(){var e=r.line,t=Je(r.line),t=Sn(o,t);t&&(Dn(t),o.curOp.selectionChanged=o.curOp.forceUpdate=!0),o.curOp.updateMaxLine=!0,Bt(i.doc,e)||null==i.height||(t=i.height,i.height=null,(t=gn(i)-t)&&Qe(e,e.height+t)),an(o,"markerChanged",o,n)})},ao.prototype.attachLine=function(e){var t;!this.lines.length&&this.doc.cm&&((t=this.doc.cm.curOp).maybeHiddenMarkers&&-1!=j(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)),this.lines.push(e)},ao.prototype.detachLine=function(e){this.lines.splice(j(this.lines,e),1),!this.lines.length&&this.doc.cm&&((e=this.doc.cm.curOp).maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)},Se(ao);var lo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function co(e){return e.findMarks(rt(e.first,0),e.clipPos(rt(e.lastLine())),function(e){return e.parent})}function uo(o){for(var e=0;e<o.length;e++)!function(e){var t=o[e],n=[t.primary.doc];mi(t.primary.doc,function(e){return n.push(e)});for(var r=0;r<t.markers.length;r++){var i=t.markers[r];-1==j(n,i.doc)&&(i.parent=null,t.markers.splice(r--,1))}}(e)}lo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();an(this,"clear")}},lo.prototype.find=function(e,t){return this.primary.find(e,t)},Se(lo);var ho=0,po=function(e,t,n,r,i){if(!(this instanceof po))return new po(e,t,n,r,i);null==n&&(n=0),no.call(this,[new to([new Gt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1;n=rt(this.modeFrontier=this.highlightFrontier=n,0);this.sel=si(n),this.history=new yi(null),this.id=++ho,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),gi(this,{from:n,to:n,text:e}),Ni(this,si(n),R)};po.prototype=Y(no.prototype,{constructor:po,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ze(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:jr(function(e){var t=rt(this.first,0),n=this.first+this.size-1;$i(this,{from:t,to:rt(n,Xe(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&kr(this.cm,0,0),Ni(this,si(t),R)}),replaceRange:function(e,t,n,r){Yi(this,e,t=ut(this,t),n=n?ut(this,n):t,r)},getRange:function(e,t,n){t=Ye(this,ut(this,e),ut(this,t));return!1===n?t:t.join(n||this.lineSeparator())},getLine:function(e){e=this.getLineHandle(e);return e&&e.text},getLineHandle:function(e){if(tt(this,e))return Xe(this,e)},getLineNumber:Je,getLineHandleVisualStart:function(e){return Wt(e="number"==typeof e?Xe(this,e):e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ut(this,e)},getCursor:function(e){var t=this.sel.primary(),t=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from();return t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:jr(function(e,t,n){Fi(this,ut(this,"number"==typeof e?rt(e,t||0):e),null,n)}),setSelection:jr(function(e,t,n){Fi(this,ut(this,e),ut(this,t||e),n)}),extendSelection:jr(function(e,t,n){Ei(this,ut(this,e),t&&ut(this,t),n)}),extendSelections:jr(function(e,t){Di(this,ht(this,e),t)}),extendSelectionsBy:jr(function(e,t){Di(this,ht(this,K(this.sel.ranges,e)),t)}),setSelections:jr(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new oi(ut(this,e[i].anchor),ut(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ni(this,ai(this.cm,r,t),n)}}),addSelection:jr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new oi(ut(this,e),ut(this,t||e))),Ni(this,ai(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n=0;n<t.length;n++)var r=Ye(this,t[n].from(),t[n].to()),i=i?i.concat(r):r;return!1===e?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Ye(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:jr(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var t=t&&"end"!=t&&function(e,t,n){for(var r=[],i=c=rt(e.first,0),o=0;o<t.length;o++){var a=t[o],s=hi(a.from,c,i),l=hi(li(a),c,i),c=a.to,i=l;"around"==n?(a=it((a=e.sel.ranges[o]).head,a.anchor)<0,r[o]=new oi(a?l:s,a?s:l)):r[o]=new oi(s,s)}return new ii(r,e.sel.primIndex)}(this,r,t),s=r.length-1;0<=s;s--)$i(this,r[s]);t?Oi(this,t):this.cm&&wr(this.cm)}),undo:jr(function(){Vi(this,"undo")}),redo:jr(function(){Vi(this,"redo")}),undoSelection:jr(function(){Vi(this,"undo",!0)}),redoSelection:jr(function(){Vi(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.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var t=this;this.history=new yi(this.history),mi(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Mi(this.history.done),undone:Mi(this.history.undone)}},setHistory:function(e){var t=this.history=new yi(this.history);t.done=Mi(e.done.slice(0),null,!0),t.undone=Mi(e.undone.slice(0),null,!0)},setGutterMarker:jr(function(e,n,r){return eo(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=r)&&ee(t)&&(e.gutterMarkers=null),1})}),clearGutter:jr(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&eo(n,e,"gutter",function(){return e.gutterMarkers[t]=null,ee(e.gutterMarkers)&&(e.gutterMarkers=null),1})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!tt(this,e))return null;if(!(e=Xe(this,t=e)))return null}else if(null==(t=Je(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:jr(function(e,n,r){return eo(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(_(r).test(e[t]))return;e[t]+=" "+r}else e[t]=r;return 1})}),removeLineClass:jr(function(e,o,a){return eo(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",n=e[t];if(n){if(null==a)e[t]=null;else{var r=n.match(_(a));if(!r)return;var i=r.index+r[0].length;e[t]=n.slice(0,r.index)+(r.index&&i!=n.length?" ":"")+n.slice(i)||null}return 1}})}),addLineWidget:jr(function(e,t,n){return e=e,i=new ro(r=this,t,n),(o=r.cm)&&i.noHScroll&&(o.display.alignWidgets=!0),eo(r,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);return null==i.insertAt?t.push(i):t.splice(Math.min(t.length,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!Bt(r,e)&&(t=Ut(e)<r.scrollTop,Qe(e,e.height+gn(i)),t&&yr(o,i.height),o.curOp.forceUpdate=!0),1}),o&&an(o,"lineWidgetAdded",o,i,"number"==typeof e?e:Je(e)),i;var r,i,o}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return so(this,ut(this,e),ut(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){t={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return so(this,e=ut(this,e),e,t,"bookmark")},findMarksAt:function(e){var t=[],n=Xe(this,(e=ut(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,a){i=ut(this,i),o=ut(this,o);var s=[],l=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;n++){var r=t[n];null!=r.to&&l==i.line&&i.ch>=r.to||null==r.from&&l!=i.line||null!=r.from&&l==o.line&&r.from>=o.ch||a&&!a(r.marker)||s.push(r.marker.parent||r.marker)}++l}),s},getAllMarks:function(){var r=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;++n)null!=t[n].from&&r.push(t[n].marker)}),r},posFromIndex:function(t){var n,r=this.first,i=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+i;if(t<e)return n=t,!0;t-=e,++r}),ut(this,rt(r,n))},indexFromPos:function(e){var t=(e=ut(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new po(Ze(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){var t=this.first,n=this.first+this.size;null!=(e=e||{}).from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);t=new po(Ze(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(t.history=this.history),(this.linked||(this.linked=[])).push({doc:t,sharedHist:e.sharedHist}),t.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),i=e.clipPos(i.to);it(o,i)&&(i=so(e,o,i,r.primary,r.primary.type),r.markers.push(i),i.parent=r)}}(t,co(this)),t},unlinkDoc:function(e){if(e instanceof ua&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),uo(co(this));break}var n;e.history==this.history&&(n=[e.id],mi(e,function(e){return n.push(e.id)},!0),e.history=new yi(null),e.history.done=Mi(this.history.done,n),e.history.undone=Mi(this.history.undone,n))},iterLinkedDocs:function(e){mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ne(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:jr(function(e){var t;(e="rtl"!=e?"ltr":e)!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Nr(t=this.cm,function(){bi(t),tr(t)}))})}),po.prototype.eachLine=po.prototype.iter;var fo=0;function go(e){var r=this;if(mo(r),!_e(r,e)&&!mn(r.display,e)){Le(e),w&&(fo=+new Date);var t=Jn(r,e,!0),n=e.dataTransfer.files;if(t&&!r.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,s=function(){++a==i&&zr(r,function(){var e={from:t=ut(r.doc,t),to:t,text:r.doc.splitLines(o.filter(function(e){return null!=e}).join(r.doc.lineSeparator())),origin:"paste"};$i(r.doc,e),Oi(r.doc,si(ut(r.doc,t),ut(r.doc,li(e))))})()},l=0;l<n.length;l++)!function(e,t){var n;r.options.allowDropFileTypes&&-1==j(r.options.allowDropFileTypes,e.type)?s():((n=new FileReader).onerror=s,n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),s()},n.readAsText(e))}(n[l],l);else{if(r.state.draggingText&&-1<r.doc.sel.contains(t))return r.state.draggingText(e),void setTimeout(function(){return r.display.input.focus()},20);try{var c,u=e.dataTransfer.getData("Text");if(u){if(r.state.draggingText&&!r.state.draggingText.copy&&(c=r.listSelections()),zi(r.doc,si(t,t)),c)for(var h=0;h<c.length;++h)Yi(r.doc,"",c[h].anchor,c[h].head,"drag");r.replaceSelection(u,"around","paste"),r.display.input.focus()}}catch(e){}}}}function mo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function vo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<e.length;r++){var i=e[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var e=0;e<n.length;e++)t(n[e])})}}var bo=!1;function yo(){var e;bo||(be(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,vo(wo)},100))}),be(window,"blur",function(){return vo(fr)}),bo=!0)}function wo(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ko={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},_o=0;_o<10;_o++)ko[_o+48]=ko[_o+96]=String(_o);for(var xo=65;xo<=90;xo++)ko[xo]=String.fromCharCode(xo);for(var Co=1;Co<=12;Co++)ko[Co+111]=ko[Co+63235]="F"+Co;var So={};function Lo(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),e=r?"Shift-"+e:e}function To(e){var t,n,r={};for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if(!/^(name|fallthrough|(de|at)tach)$/.test(t))if("..."!=i){for(var o=K(t.split(" "),Lo),a=0;a<o.length;a++){var s=void 0,l=void 0,s=a==o.length-1?(l=o.join(" "),i):(l=o.slice(0,a+1).join(" "),"..."),c=r[l];if(c){if(c!=s)throw new Error("Inconsistent bindings for "+l)}else r[l]=s}delete e[t]}else delete e[t]}for(n in r)e[n]=r[n];return e}function Mo(e,t,n,r){var i=(t=Po(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Mo(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=Mo(e,t.fallthrough[o],n,r);if(a)return a}}}function Ao(e){e="string"==typeof e?e:ko[e.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Eo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),e=!n&&t.shiftKey&&"Shift"!=r?"Shift-"+e:e}function Do(e,t){if(f&&34==e.keyCode&&e.char)return!1;var n=ko[e.keyCode];return null!=n&&!e.altGraphKey&&Eo(n=3==e.keyCode&&e.code?e.code:n,e,t)}function Po(e){return"string"==typeof e?So[e]:e}function Fo(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&it(o.from,V(r).to)<=0;){var a=r.pop();if(it(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Nr(t,function(){for(var e=r.length-1;0<=e;e--)Yi(t.doc,"",r[e].from,r[e].to,"+delete");wr(t)})}function Oo(e,t,n){n=re(e.text,t+n,n);return n<0||n>e.text.length?null:n}function No(e,t,n){e=Oo(e,t.ch,n);return null==e?null:new rt(t.line,e,n<0?"after":"before")}function zo(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=me(n,t.doc.direction);if(o){var a,s,l,e=i<0?V(o):o[0],o=i<0==(1==e.level)?"after":"before";return 0<e.level||"rtl"==t.doc.direction?(a=Ln(t,n),s=i<0?n.text.length-1:0,l=Tn(t,a,s).top,s=ie(function(e){return Tn(t,a,e).top==l},i<0==(1==e.level)?e.from:e.to-1,s),"before"==o&&(s=Oo(n,s,1))):s=i<0?e.to:e.from,new rt(r,s,o)}}return new rt(r,i<0?n.text.length:0,i<0?"before":"after")}function Ho(t,n,s,e){var l=me(n,t.doc.direction);if(!l)return No(n,s,e);s.ch>=n.text.length?(s.ch=n.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var r=ae(l,s.ch,s.sticky),i=l[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return No(n,s,e);function c(e,t){return Oo(n,e instanceof rt?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||Ln(t,n),$n(t,n,a,e)):{begin:0,end:n.text.length}}var a,u=o("before"==s.sticky?c(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var h=1==i.level==e<0,d=c(s,h?1:-1);if(null!=d&&(h?d<=i.to&&d<=u.end:d>=i.from&&d>=u.begin))return new rt(s.line,d,h?"before":"after")}h=function(e,t,n){for(var r=function(e,t){return t?new rt(s.line,c(e,1),"before"):new rt(s.line,e,"after")};0<=e&&e<l.length;e+=t){var i=l[e],o=0<t==(1!=i.level),a=o?n.begin:c(n.end,-1);if(i.from<=a&&a<i.to)return r(a,o);if(a=o?i.from:c(i.to,-1),n.begin<=a&&a<n.end)return r(a,o)}},r=h(r+e,e,u);if(r)return r;u=0<e?u.end:c(u.begin,-1);return null==u||0<e&&u==n.text.length||!(r=h(0<e?0:l.length-1,e,o(u)))?null:r}So.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"},So.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"},So.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"},So.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"]},So.default=g?So.macDefault:So.pcDefault;var jo={selectAll:Ui,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),R)},killLine:function(n){return Fo(n,function(e){if(e.empty()){var t=Xe(n.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:rt(e.head.line+1,0)}:{from:e.head,to:rt(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Fo(t,function(e){return{from:rt(e.from().line,0),to:ut(t.doc,rt(e.to().line+1,0))}})},delLineLeft:function(e){return Fo(e,function(e){return{from:rt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return Fo(n,function(e){var t=n.charCoords(e.head,"div").top+5;return{from:n.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Fo(n,function(e){var t=n.charCoords(e.head,"div").top+5,t=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:t}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(rt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(rt(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Wo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Io(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var n=Xe(e.doc,t),r=function(e){for(var t;t=Ht(e);)e=t.find(1,!0).line;return e}(n);r!=n&&(t=Je(r));return zo(!0,e,n,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div")},U)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:e},"div")},U)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,t=n.coordsChar({left:0,top:t},"div");return t.ch<n.getLine(t.line).search(/\S/)?Io(n,e.head):t},U)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),o=z(e.getLine(o.line),o.ch,r);t.push(G(r-o%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return Nr(a,function(){for(var e,t,n,r=a.listSelections(),i=[],o=0;o<r.length;o++)r[o].empty()&&(e=r[o].head,(t=Xe(a.doc,e.line).text)&&(0<(e=e.ch==t.length?new rt(e.line,e.ch-1):e).ch?(e=new rt(e.line,e.ch+1),a.replaceRange(t.charAt(e.ch-1)+t.charAt(e.ch-2),rt(e.line,e.ch-2),e,"+transpose")):e.line>a.doc.first&&((n=Xe(a.doc,e.line-1).text)&&(e=new rt(e.line,1),a.replaceRange(t.charAt(0)+a.doc.lineSeparator()+n.charAt(n.length-1),rt(e.line-1,n.length-1),e,"+transpose")))),i.push(new oi(e,e)));a.setSelections(i)})},newlineAndIndent:function(r){return Nr(r,function(){for(var e=(t=r.listSelections()).length-1;0<=e;e--)r.replaceRange(r.doc.lineSeparator(),t[e].anchor,t[e].head,"+input");for(var t=r.listSelections(),n=0;n<t.length;n++)r.indentLine(t[n].from().line,null,!0);wr(r)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Wo(e,t){var n=Xe(e.doc,t),r=Wt(n);return zo(!0,e,r,t=r!=n?Je(r):t,1)}function Io(e,t){var n=Wo(e,t.line),r=Xe(e.doc,n.line),e=me(r,e.doc.direction);if(e&&0!=e[0].level)return n;r=Math.max(n.ch,r.text.search(/\S/)),t=t.line==n.line&&t.ch<=r&&t.ch;return rt(n.line,t?0:r,n.sticky)}function Ro(e,t,n){if("string"==typeof t&&!(t=jo[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=I}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var Bo=new H;function Uo(e,t,n,r){var i=e.state.keySeq;if(i){if(Ao(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),qo(e,i+" "+t,n,r))return!0}return qo(e,t,n,r)}function qo(e,t,n,r){r=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Mo(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Mo(t,e.options.extraKeys,n,e)||Mo(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==r&&(e.state.keySeq=t),"handled"==r&&an(e,"keyHandled",e,t,n),"handled"!=r&&"multi"!=r||(Le(n),ur(e)),!!r}function $o(t,e){var n=Do(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?Uo(t,"Shift-"+n,e,function(e){return Ro(t,e,!0)})||Uo(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Ro(t,e)}):Uo(t,n,e,function(e){return Ro(t,e)}))}var Go=null;function Vo(e){var t,n,r,i=this;function o(e){18!=e.keyCode&&e.altKey||(x(r,"CodeMirror-crosshair"),we(document,"keyup",o),we(document,"mouseover",o))}e.target&&e.target!=i.display.input.getField()||(i.curOp.focus=A(),_e(i,e)||(w&&v<11&&27==e.keyCode&&(e.returnValue=!1),t=e.keyCode,i.display.shift=16==t||e.shiftKey,n=$o(i,e),f&&(Go=n?t:null,!n&&88==t&&!He&&(g?e.metaKey:e.ctrlKey)&&i.replaceSelection("",null,"cut")),d&&!g&&!n&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t||/\bCodeMirror-crosshair\b/.test(i.display.lineDiv.className)||(E(r=i.display.lineDiv,"CodeMirror-crosshair"),be(document,"keyup",o),be(document,"mouseover",o))))}function Ko(e){16==e.keyCode&&(this.doc.sel.shift=!1),_e(this,e)}function Xo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||mn(t.display,e)||_e(t,e)||e.ctrlKey&&!e.altKey||g&&e.metaKey)){var n,r=e.keyCode,i=e.charCode;if(f&&r==Go)return Go=null,void Le(e);f&&(!e.which||e.which<10)&&$o(t,e)||"\b"!=(i=String.fromCharCode(null==i?r:i))&&(Uo(n=t,"'"+i+"'",e,function(e){return Ro(n,e,!0)})||t.display.input.onKeyPress(e))}}var Yo,Zo,Qo=function(e,t,n){this.time=e,this.pos=t,this.button=n};function Jo(e){var t,n,r,i,o,a=this,s=a.display;_e(a,e)||s.activeTouch&&s.input.supportsTouch()||(s.input.ensurePolled(),s.shift=e.shiftKey,mn(s,e)?p||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100)):na(a,e)||(t=Jn(a,e),n=De(e),i=t?(r=t,i=n,o=+new Date,Zo&&Zo.compare(o,r,i)?(Yo=Zo=null,"triple"):Yo&&Yo.compare(o,r,i)?(Zo=new Qo(o,r,i),Yo=null,"double"):(Yo=new Qo(o,r,i),Zo=null,"single")):"single",window.focus(),1==n&&a.state.selectingText&&a.state.selectingText(e),t&&function(n,e,r,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return Uo(n,Eo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if(!(e="string"==typeof e?jo[e]:e))return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,r)!=I}finally{n.state.suppressEdits=!1}return t})}(a,n,t,i,e)||(1==n?t?function(e,t,n,r){w?setTimeout(O(hr,e),0):e.curOp.focus=A();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};null==i.unit&&(r=m?n.shiftKey&&n.metaKey:n.altKey,i.unit=r?"rectangle":"single"==t?"char":"double"==t?"word":"line");null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||n.shiftKey);null==i.addNew&&(i.addNew=g?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(g?n.altKey:n.ctrlKey));return i}(e,n,r),a=e.doc.sel;(e.options.dragDrop&&Oe&&!e.isReadOnly()&&"single"==n&&-1<(i=a.contains(t))&&(it((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<it(i.to(),t)||t.xRel<0)?function(t,n,r,i){var o=t.display,a=!1,s=zr(t,function(e){p&&(o.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:dr(t)),we(o.wrapper.ownerDocument,"mouseup",s),we(o.wrapper.ownerDocument,"mousemove",l),we(o.scroller,"dragstart",c),we(o.scroller,"drop",s),a||(Le(e),i.addNew||Ei(t.doc,r,null,null,i.extend),p&&!u||w&&9==v?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),l=function(e){a=a||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},c=function(){return a=!0};p&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,be(o.wrapper.ownerDocument,"mouseup",s),be(o.wrapper.ownerDocument,"mousemove",l),be(o.scroller,"dragstart",c),be(o.scroller,"drop",s),t.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}:function(d,e,p,f){w&&dr(d);var a=d.display,g=d.doc;Le(e);var m,v,b=g.sel,t=b.ranges;f.addNew&&!f.extend?(v=g.sel.contains(p),m=-1<v?t[v]:new oi(p,p)):(m=g.sel.primary(),v=g.sel.primIndex);"rectangle"==f.unit?(f.addNew||(m=new oi(p,p)),p=Jn(d,e,!0,!0),v=-1):(e=ea(d,p,f.unit),m=f.extend?Ai(m,e.anchor,e.head,f.extend):e);f.addNew?-1==v?(v=t.length,Ni(g,ai(d,t.concat([m]),v),{scroll:!1,origin:"*mouse"})):1<t.length&&t[v].empty()&&"char"==f.unit&&!f.extend?(Ni(g,ai(d,t.slice(0,v).concat(t.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),b=g.sel):Pi(g,v,m,B):(Ni(g,new ii([m],v=0),B),b=g.sel);var y=p;function s(e){if(0!=it(y,e))if(y=e,"rectangle"==f.unit){for(var t=[],n=d.options.tabSize,r=z(Xe(g,p.line).text,p.ch,n),i=z(Xe(g,e.line).text,e.ch,n),o=Math.min(r,i),a=Math.max(r,i),s=Math.min(p.line,e.line),l=Math.min(d.lastLine(),Math.max(p.line,e.line));s<=l;s++){var c=Xe(g,s).text,u=q(c,o,n);o==a?t.push(new oi(rt(s,u),rt(s,u))):c.length>u&&t.push(new oi(rt(s,u),rt(s,q(c,a,n))))}t.length||t.push(new oi(p,p)),Ni(g,ai(d,b.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),d.scrollIntoView(e)}else{var h,r=m,i=ea(d,e,f.unit),e=r.anchor,e=0<it(i.anchor,e)?(h=i.head,lt(r.from(),i.anchor)):(h=i.anchor,st(r.to(),i.head)),i=b.ranges.slice(0);i[v]=function(e,t){var n=t.anchor,r=t.head,i=Xe(e.doc,n.line);if(0==it(n,r)&&n.sticky==r.sticky)return t;var o=me(i);if(!o)return t;var a=ae(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;i=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==i||i==o.length)return t;l=r.line!=n.line?0<(r.line-n.line)*("ltr"==e.doc.direction?1:-1):(e=ae(o,r.ch,r.sticky),l=e-a||(r.ch-n.ch)*(1==s.level?-1:1),e==i-1||e==i?l<0:0<l);var i=o[i+(l?-1:0)],l=l==(1==i.level),i=l?i.from:i.to,l=l?"after":"before";return n.ch==i&&n.sticky==l?t:new oi(new rt(n.line,i,l),r)}(d,new oi(ut(g,e),h)),Ni(g,ai(d,i,v),B)}}var l=a.wrapper.getBoundingClientRect(),c=0;function n(e){d.state.selectingText=!1,c=1/0,e&&(Le(e),a.input.focus()),we(a.wrapper.ownerDocument,"mousemove",r),we(a.wrapper.ownerDocument,"mouseup",i),g.history.lastSelOrigin=null}var r=zr(d,function(e){(0!==e.buttons&&De(e)?function e(t){var n,r,i=++c,o=Jn(d,t,!0,"rectangle"==f.unit);o&&(0!=it(o,y)?(d.curOp.focus=A(),s(o),n=vr(a,g),(o.line>=n.to||o.line<n.from)&&setTimeout(zr(d,function(){c==i&&e(t)}),150)):(r=t.clientY<l.top?-20:t.clientY>l.bottom?20:0)&&setTimeout(zr(d,function(){c==i&&(a.scroller.scrollTop+=r,e(t))}),50))}:n)(e)}),i=zr(d,n);d.state.selectingText=i,be(a.wrapper.ownerDocument,"mousemove",r),be(a.wrapper.ownerDocument,"mouseup",i)})(e,r,t,o)}(a,t,i,e):Ee(e)==s.scroller&&Le(e):2==n?(t&&Ei(a.doc,t),setTimeout(function(){return s.input.focus()},20)):3==n&&(k?a.display.input.onContextMenu(e):dr(a)))))}function ea(e,t,n){if("char"==n)return new oi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new oi(rt(t.line,0),ut(e.doc,rt(t.line+1,0)));t=n(e,t);return new oi(t.from,t.to)}function ta(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(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Le(t);var a=e.display,r=a.lineDiv.getBoundingClientRect();if(o>r.bottom||!Ce(e,n))return Me(t);o-=r.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var l=a.gutters.childNodes[s];if(l&&l.getBoundingClientRect().right>=i)return ke(e,n,e,et(e.doc,o),e.display.gutterSpecs[s].className,t),Me(t)}}function na(e,t){return ta(e,t,"gutterClick",!0)}function ra(e,t){var n,r;mn(e.display,t)||(r=t,Ce(n=e,"gutterContextMenu")&&ta(n,r,"gutterContextMenu",!1))||_e(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}function ia(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Fn(e)}Qo.prototype.compare=function(e,t,n){return this.time+400>e&&0==it(t,this.pos)&&n==this.button};var oa={toString:function(){return"CodeMirror.Init"}},aa={},sa={};function la(e,t,n){!t!=!(n&&n!=oa)&&(n=e.display.dragFunctions,(t=t?be:we)(e.display.scroller,"dragstart",n.start),t(e.display.scroller,"dragenter",n.enter),t(e.display.scroller,"dragover",n.over),t(e.display.scroller,"dragleave",n.leave),t(e.display.scroller,"drop",n.drop))}function ca(e){e.options.lineWrapping?(E(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(x(e.display.wrapper,"CodeMirror-wrap"),$t(e)),Qn(e),tr(e),Fn(e),setTimeout(function(){return Mr(e)},100)}function ua(e,t){var n=this;if(!(this instanceof ua))return new ua(e,t);this.options=t=t?N(t):{},N(aa,t,!1);var r=t.value;"string"==typeof r?r=new po(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i,o=new ua.inputStyles[t.inputStyle](this),o=this.display=new Qr(e,r,o,t);for(i in ia(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Dr(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 H,keySeq:null,specialChars:null},t.autofocus&&!h&&o.input.focus(),w&&v<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(r){var i=r.display;be(i.scroller,"mousedown",zr(r,Jo)),be(i.scroller,"dblclick",w&&v<11?zr(r,function(e){var t;_e(r,e)||(!(t=Jn(r,e))||na(r,e)||mn(r.display,e)||(Le(e),t=r.findWordAt(t),Ei(r.doc,t.anchor,t.head)))}):function(e){return _e(r,e)||Le(e)});be(i.scroller,"contextmenu",function(e){return ra(r,e)}),be(i.input.getField(),"contextmenu",function(e){i.scroller.contains(e.target)||ra(r,e)});var n,o={end:0};function a(){i.activeTouch&&(n=setTimeout(function(){return i.activeTouch=null},1e3),(o=i.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return 1;var n=t.left-e.left,e=t.top-e.top;return 400<n*n+e*e}be(i.scroller,"touchstart",function(e){var t;_e(r,e)||function(e){if(1==e.touches.length){e=e.touches[0];return e.radiusX<=1&&e.radiusY<=1}}(e)||na(r,e)||(i.input.ensurePolled(),clearTimeout(n),t=+new Date,i.activeTouch={start:t,moved:!1,prev:t-o.end<=300?o:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY))}),be(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),be(i.scroller,"touchend",function(e){var t,n=i.activeTouch;n&&!mn(i,e)&&null!=n.left&&!n.moved&&new Date-n.start<300&&(t=r.coordsChar(i.activeTouch,"page"),t=!n.prev||s(n,n.prev)?new oi(t,t):!n.prev.prev||s(n,n.prev.prev)?r.findWordAt(t):new oi(rt(t.line,0),ut(r.doc,rt(t.line+1,0))),r.setSelection(t.anchor,t.head),r.focus(),Le(e)),a()}),be(i.scroller,"touchcancel",a),be(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Cr(r,i.scroller.scrollTop),Lr(r,i.scroller.scrollLeft,!0),ke(r,"scroll",r))}),be(i.scroller,"mousewheel",function(e){return ri(r,e)}),be(i.scroller,"DOMMouseScroll",function(e){return ri(r,e)}),be(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(e){_e(r,e)||Ae(e)},over:function(e){var t,n;_e(r,e)||((n=Jn(t=r,n=e))&&(lr(t,n,n=document.createDocumentFragment()),t.display.dragCursor||(t.display.dragCursor=T("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),S(t.display.dragCursor,n)),Ae(e))},start:function(e){var t,n;t=r,n=e,w&&(!t.state.draggingText||+new Date-fo<100)?Ae(n):_e(t,n)||mn(t.display,n)||(n.dataTransfer.setData("Text",t.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!u&&((e=T("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),n.dataTransfer.setDragImage(e,0,0),f&&e.parentNode.removeChild(e)))},drop:zr(r,go),leave:function(e){_e(r,e)||mo(r)}};var e=i.input.getField();be(e,"keyup",function(e){return Ko.call(r,e)}),be(e,"keydown",zr(r,Vo)),be(e,"keypress",zr(r,Xo)),be(e,"focus",function(e){return pr(r,e)}),be(e,"blur",function(e){return fr(r,e)})}(this),yo(),Fr(this),this.curOp.forceUpdate=!0,vi(this,r),t.autofocus&&!h||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&pr(n)},20):fr(this),sa)sa.hasOwnProperty(i)&&sa[i](this,t[i],oa);Kr(this),t.finishInit&&t.finishInit(this);for(var a=0;a<ha.length;++a)ha[a](this);Or(this),p&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}ua.defaults=aa,ua.optionHandlers=sa;var ha=[];function da(e,t,n,r){var i,o=e.doc;"smart"==(n=null==n?"add":n)&&(o.mode.indent?i=mt(e,t).state:n="prev");var a=e.options.tabSize,s=Xe(o,t),l=z(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==I||150<u)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?z(Xe(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n);var u=Math.max(0,u),h="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(u/a);p;--p)d+=a,h+="\t";if(d<u&&(h+=G(u-d)),h!=c)return Yi(o,h,rt(t,0),rt(t,c.length),"+input"),!(s.stateAfter=null);for(var f=0;f<o.sel.ranges.length;f++){var g=o.sel.ranges[f];if(g.head.line==t&&g.head.ch<c.length){g=rt(t,c.length);Pi(o,f,new oi(g,g));break}}}ua.defineInitHook=function(e){return ha.push(e)};var pa=null;function fa(e){pa=e}function ga(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r=r||o.sel;var a=+new Date-200,s="paste"==i||e.state.pasteIncoming>a,l=Ne(t),c=null;if(s&&1<r.ranges.length)if(pa&&pa.text.join("\n")==t){if(r.ranges.length%pa.text.length==0)for(var c=[],u=0;u<pa.text.length;u++)c.push(o.splitLines(pa.text[u]))}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(c=K(l,function(e){return[e]}));for(var h=e.curOp.updateInput,d=r.ranges.length-1;0<=d;d--){var p=r.ranges[d],f=p.from(),g=p.to();p.empty()&&(n&&0<n?f=rt(f.line,f.ch-n):e.state.overwrite&&!s?g=rt(g.line,Math.min(Xe(o,g.line).text.length,g.ch+V(l).length)):s&&pa&&pa.lineWise&&pa.text.join("\n")==l.join("\n")&&(f=g=rt(f.line,0)));g={from:f,to:g,text:c?c[d%c.length]:l,origin:i||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};$i(e.doc,g),an(e,"inputRead",e,g)}t&&!s&&va(e,t),wr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ma(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");return n&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Nr(t,function(){return ga(t,n,0,null,"paste")}),1)}function va(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;0<=r;r--){var i=n.ranges[r];if(!(100<i.head.ch||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(-1<t.indexOf(o.electricChars.charAt(s))){a=da(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=da(e,i.head.line,"smart"));a&&an(e,"electricInput",e,i.head.line)}}}function ba(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,i={anchor:rt(i,0),head:rt(i+1,0)};n.push(i),t.push(e.getRange(i.anchor,i.head))}return{text:t,ranges:n}}function ya(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function wa(){var e=T("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=T("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return p?e.style.width="1000px":e.setAttribute("wrap","off"),s&&(e.style.border="1px solid black"),ya(e),t}function ka(r,i,o,a,s){var e=i,t=o,l=Xe(r,i.line),c=s&&"rtl"==r.direction?-o:o;function n(e){var t,n;if(null==(t="codepoint"==a?(t=l.text.charCodeAt(i.ch+(0<o?0:-1)),isNaN(t)?null:new rt(i.line,Math.max(0,Math.min(l.text.length,i.ch+o*((0<o?55296<=t&&t<56320:56320<=t&&t<57343)?2:1))),-o)):s?Ho(r.cm,l,i,o):No(l,i,o))){if(e||(n=i.line+c)<r.first||n>=r.first+r.size||(i=new rt(n,i.ch,i.sticky),!(l=Xe(r,n))))return;i=zo(s,r.cm,l,i.line,c)}else i=t;return 1}if("char"==a||"codepoint"==a)n();else if("column"==a)n(!0);else if("word"==a||"group"==a)for(var u=null,h="group"==a,d=r.cm&&r.cm.getHelper(i,"wordChars"),p=!0;!(o<0)||n(!p);p=!1){var f=l.text.charAt(i.ch)||"\n",f=J(f,d)?"w":h&&"\n"==f?"n":!h||/\s/.test(f)?null:"p";if(!h||p||f||(f="s"),u&&u!=f){o<0&&(o=1,n(),i.sticky="after");break}if(f&&(u=f),0<o&&!n(!p))break}t=Ri(r,i,e,t,!0);return ot(e,t)&&(t.hitSide=!0),t}function _a(e,t,n,r){var i,o,a,s=e.doc,l=t.left;for("page"==r?(i=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(i-.5*Vn(e.display),3),o=(0<n?t.bottom:t.top)+n*i):"line"==r&&(o=0<n?t.bottom+3:t.top-3);(a=Un(e,l,o)).outside;){if(n<0?o<=0:o>=s.height){a.hitSide=!0;break}o+=5*n}return a}e=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new H,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function xa(e,t){var n=Sn(e,t.line);if(!n||n.hidden)return null;var r=Xe(e.doc,t.line),n=xn(n,r,t.line),r=me(r,e.doc.direction),e="left";r&&(e=ae(r,t.ch)%2?"right":"left");e=En(n.map,t.ch,e);return e.offset="right"==e.collapse?e.end:e.start,e}function Ca(e,t){return t&&(e.bad=!0),e}function Sa(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ca(e.clipPos(rt(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<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return function(c,e,t){var n=c.text.firstChild,r=!1;if(!e||!M(n,e))return Ca(rt(Je(c.line),0),!0);if(e==n&&(r=!0,e=n.childNodes[t],t=0,!e)){var i=c.rest?V(c.rest):c.line;return Ca(rt(Je(i),i.text.length),r)}var i=3==e.nodeType?e:null,o=e;i||1!=e.childNodes.length||3!=e.firstChild.nodeType||(i=e.firstChild,t=t&&i.nodeValue.length);for(;o.parentNode!=n;)o=o.parentNode;var u=c.measure,h=u.maps;function a(e,t,n){for(var r=-1;r<(h?h.length:0);r++)for(var i=r<0?u.map:h[r],o=0;o<i.length;o+=3){var a=i[o+2];if(a==e||a==t){var s=Je(r<0?c.line:c.rest[r]),l=i[o]+n;return rt(s,l=n<0||a!=e?i[o+(n?1:0)]:l)}}}var s=a(i,o,t);if(s)return Ca(s,r);for(var l=o.nextSibling,d=i?i.nodeValue.length-t:0;l;l=l.nextSibling){if(s=a(l,l.firstChild,0))return Ca(rt(s.line,s.ch-d),r);d+=l.textContent.length}for(var p=o.previousSibling,f=t;p;p=p.previousSibling){if(s=a(p,p.firstChild,-1))return Ca(rt(s.line,s.ch+f),r);f+=p.textContent.length}}(o,t,n)}}e.prototype.init=function(e){var t=this,o=this,a=o.cm,s=o.div=e.lineDiv;function l(e){for(var t=e.target;t;t=t.parentNode){if(t==s)return 1;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}}function n(e){if(l(e)&&!_e(a,e)){if(a.somethingSelected())fa({lineWise:!1,text:a.getSelections()}),"cut"==e.type&&a.replaceSelection("",null,"cut");else{if(!a.options.lineWiseCopyCut)return;var t=ba(a);fa({lineWise:!0,text:t.text}),"cut"==e.type&&a.operation(function(){a.setSelections(t.ranges,0,R),a.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=pa.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var r=wa(),e=r.firstChild;a.display.lineSpace.insertBefore(r,a.display.lineSpace.firstChild),e.value=pa.text.join("\n");var i=document.activeElement;F(e),setTimeout(function(){a.display.lineSpace.removeChild(r),i.focus(),i==s&&o.showPrimarySelection()},50)}}s.contentEditable=!0,ya(s,a.options.spellcheck,a.options.autocorrect,a.options.autocapitalize),be(s,"paste",function(e){!l(e)||_e(a,e)||ma(e,a)||v<=11&&setTimeout(zr(a,function(){return t.updateFromDOM()}),20)}),be(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),be(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),be(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),be(s,"touchstart",function(){return o.forceCompositionEnd()}),be(s,"input",function(){t.composing||t.readFromDOMSoon()}),be(s,"copy",n),be(s,"cut",n)},e.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},e.prototype.prepareSelection=function(){var e=sr(this.cm,!1);return e.focus=document.activeElement==this.div,e},e.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},e.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},e.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Sa(t,e.anchorNode,e.anchorOffset),n=Sa(t,e.focusNode,e.focusOffset);if(!o||o.bad||!n||n.bad||0!=it(lt(o,n),r)||0!=it(st(o,n),i)){n=t.display.view,r=r.line>=t.display.viewFrom&&xa(t,r)||{node:n[0].measure.map[2],offset:0},i=i.line<t.display.viewTo&&xa(t,i);if(i||(i={node:(s=(s=n[n.length-1].measure).maps?s.maps[s.maps.length-1]:s.map)[s.length-1],offset:s[s.length-2]-s[s.length-3]}),r&&i){var a,s=e.rangeCount&&e.getRangeAt(0);try{a=P(r.node,r.offset,i.offset,i.node)}catch(e){}a&&(!d&&t.state.focused?(e.collapse(r.node,r.offset),a.collapsed||(e.removeAllRanges(),e.addRange(a))):(e.removeAllRanges(),e.addRange(a)),s&&null==e.anchorNode?e.addRange(s):d&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},e.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},e.prototype.showMultipleSelections=function(e){S(this.cm.display.cursorDiv,e.cursors),S(this.cm.display.selectionDiv,e.selection)},e.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},e.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;e=e.getRangeAt(0).commonAncestorContainer;return M(this.div,e)},e.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},e.prototype.blur=function(){this.div.blur()},e.prototype.getField=function(){return this.div},e.prototype.supportsTouch=function(){return!0},e.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Nr(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},e.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},e.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e,t,n=this.getSelection(),r=this.cm;if(l&&o&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(n.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();this.composing||(this.rememberSelection(),e=Sa(r,n.anchorNode,n.anchorOffset),t=Sa(r,n.focusNode,n.focusOffset),e&&t&&Nr(r,function(){Ni(r.doc,si(e,t),R),(e.bad||t.bad)&&(r.curOp.selectionChanged=!0)}))}},e.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t=this.cm,n=t.display,r=t.doc.sel.primary(),i=r.from(),r=r.to();if(0==i.ch&&i.line>t.firstLine()&&(i=rt(i.line-1,Xe(t.doc,i.line-1).length)),r.ch==Xe(t.doc,r.line).text.length&&r.line<t.lastLine()&&(r=rt(r.line+1,0)),i.line<n.viewFrom||r.line>n.viewTo-1)return!1;var o,a=i.line==n.viewFrom||0==(a=er(t,i.line))?(e=Je(n.view[0].line),n.view[0].node):(e=Je(n.view[a].line),n.view[a-1].node.nextSibling),r=er(t,r.line),r=r==n.view.length-1?(o=n.viewTo-1,n.lineDiv.lastChild):(o=Je(n.view[r+1].line)-1,n.view[r+1].node.previousSibling);if(!a)return!1;for(var s=t.doc.splitLines(function(a,e,t,s,l){var n="",c=!1,u=a.doc.lineSeparator(),h=!1;function d(){c&&(n+=u,h&&(n+=u),c=h=!1)}function p(e){e&&(d(),n+=e)}for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)p(n);else if(n=t.getAttribute("cm-marker"))(n=a.findMarks(rt(s,0),rt(l+1,0),(o=+n,function(e){return e.id==o}))).length&&(r=n[0].find(0))&&p(Ye(a.doc,r.from,r.to).join(u));else if("false"!=t.getAttribute("contenteditable")){var r=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(/^br$/i.test(t.nodeName)||0!=t.textContent.length){r&&d();for(var i=0;i<t.childNodes.length;i++)e(t.childNodes[i]);/^(pre|p)$/i.test(t.nodeName)&&(h=!0),r&&(c=!0)}}}else 3==t.nodeType&&p(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var o}(e),e!=t;)e=e.nextSibling,h=!1;return n}(t,a,r,e,o)),l=Ye(t.doc,rt(e,0),rt(o,Xe(t.doc,o).text.length));1<s.length&&1<l.length;)if(V(s)==V(l))s.pop(),l.pop(),o--;else{if(s[0]!=l[0])break;s.shift(),l.shift(),e++}for(var c=0,u=0,h=s[0],d=l[0],p=Math.min(h.length,d.length);c<p&&h.charCodeAt(c)==d.charCodeAt(c);)++c;for(var f=V(s),g=V(l),m=Math.min(f.length-(1==s.length?c:0),g.length-(1==l.length?c:0));u<m&&f.charCodeAt(f.length-u-1)==g.charCodeAt(g.length-u-1);)++u;if(1==s.length&&1==l.length&&e==i.line)for(;c&&c>i.ch&&f.charCodeAt(f.length-u-1)==g.charCodeAt(g.length-u-1);)c--,u++;s[s.length-1]=f.slice(0,f.length-u).replace(/^\u200b+/,""),s[0]=s[0].slice(c).replace(/\u200b+$/,"");a=rt(e,c),r=rt(o,l.length?V(l).length-u:0);return 1<s.length||s[0]||it(a,r)?(Yi(t.doc,s,a,r,"+input"),!0):void 0},e.prototype.ensurePolled=function(){this.forceCompositionEnd()},e.prototype.reset=function(){this.forceCompositionEnd()},e.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},e.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))},e.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Nr(this.cm,function(){return tr(e.cm)})},e.prototype.setUneditable=function(e){e.contentEditable="false"},e.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||zr(this.cm,ga)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},e.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},e.prototype.onContextMenu=function(){},e.prototype.resetPosition=function(){},e.prototype.needsContentAttribute=!0;var La,Ta,Ma,Aa,Ea,r=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};function Da(e,t,r,n){La.defaults[e]=t,r&&(Ta[e]=n?function(e,t,n){n!=oa&&r(e,t,n)}:r)}r.prototype.init=function(n){var e=this,r=this,i=this.cm;this.createField(n);var o=this.textarea;function t(e){if(!_e(i,e)){if(i.somethingSelected())fa({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ba(i);fa({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,R):(r.prevInput="",o.value=t.text.join("\n"),F(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),s&&(o.style.width="0px"),be(o,"input",function(){w&&9<=v&&e.hasSelection&&(e.hasSelection=null),r.poll()}),be(o,"paste",function(e){_e(i,e)||ma(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())}),be(o,"cut",t),be(o,"copy",t),be(n.scroller,"paste",function(e){if(!mn(n,e)&&!_e(i,e)){if(!o.dispatchEvent)return i.state.pasteIncoming=+new Date,void r.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,o.dispatchEvent(t)}}),be(n.lineSpace,"selectstart",function(e){mn(n,e)||Le(e)}),be(o,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),be(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},r.prototype.createField=function(e){this.wrapper=wa(),this.textarea=this.wrapper.firstChild},r.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},r.prototype.prepareSelection=function(){var e,t=this.cm,n=t.display,r=t.doc,i=sr(t);return t.options.moveInputWithCursor&&(e=In(t,r.sel.primary().head,"div"),t=n.wrapper.getBoundingClientRect(),r=n.lineDiv.getBoundingClientRect(),i.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,e.top+r.top-t.top)),i.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,e.left+r.left-t.left))),i},r.prototype.showSelection=function(e){var t=this.cm.display;S(t.cursorDiv,e.cursors),S(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},r.prototype.reset=function(e){var t,n;this.contextMenuPending||this.composing||((t=this.cm).somethingSelected()?(this.prevInput="",n=t.getSelection(),this.textarea.value=n,t.state.focused&&F(this.textarea),w&&9<=v&&(this.hasSelection=n)):e||(this.prevInput=this.textarea.value="",w&&9<=v&&(this.hasSelection=null)))},r.prototype.getField=function(){return this.textarea},r.prototype.supportsTouch=function(){return!1},r.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!h||A()!=this.textarea))try{this.textarea.focus()}catch(e){}},r.prototype.blur=function(){this.textarea.blur()},r.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},r.prototype.receivedFocus=function(){this.slowPoll()},r.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},r.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,function e(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))})},r.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ze(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(w&&9<=v&&this.hasSelection===i||g&&/[\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 a=0,s=Math.min(r.length,i.length);a<s&&r.charCodeAt(a)==i.charCodeAt(a);)++a;return Nr(t,function(){ga(t,i.slice(a),r.length-a,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?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},r.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},r.prototype.onKeyPress=function(){w&&9<=v&&(this.hasSelection=null),this.fastPoll()},r.prototype.onContextMenu=function(e){var n=this,r=n.cm,i=r.display,o=n.textarea;n.contextMenuPending&&n.contextMenuPending();var a,s,t,l,c=Jn(r,e),u=i.scroller.scrollTop;function h(){var e,t;null!=o.selectionStart&&(t="​"+((e=r.somethingSelected())?o.value:""),o.value="⇚",o.value=t,n.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=r.doc.sel)}function d(){var e,t;n.contextMenuPending==d&&(n.contextMenuPending=!1,n.wrapper.style.cssText=s,o.style.cssText=a,w&&v<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=o.selectionStart&&((!w||w&&v<9)&&h(),e=0,t=function(){i.selForContextMenu==r.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==n.prevInput?zr(r,Ui)(r):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())},i.detectingSelectAll=setTimeout(t,200)))}c&&!f&&(r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(c)&&zr(r,Ni)(r.doc,si(c),R),a=o.style.cssText,s=n.wrapper.style.cssText,c=n.wrapper.offsetParent.getBoundingClientRect(),n.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(w?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",p&&(t=window.scrollY),i.input.focus(),p&&window.scrollTo(null,t),i.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=d,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),w&&9<=v&&h(),k?(Ae(e),l=function(){we(window,"mouseup",l),setTimeout(d,20)},be(window,"mouseup",l)):setTimeout(d,50))},r.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},r.prototype.setUneditable=function(){},r.prototype.needsContentAttribute=!1,Ta=(La=ua).optionHandlers,La.defineOption=Da,La.Init=oa,Da("value","",function(e,t){return e.setValue(t)},!0),Da("mode",null,function(e,t){e.doc.modeOption=t,di(e)},!0),Da("indentUnit",2,di,!0),Da("indentWithTabs",!1),Da("smartIndent",!0),Da("tabSize",4,function(e){pi(e),Fn(e),tr(e)},!0),Da("lineSeparator",null,function(e,r){if(e.doc.lineSep=r){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(r,t);if(-1==n)break;t=n+r.length,i.push(rt(o,n))}o++});for(var t=i.length-1;0<=t;t--)Yi(e.doc,r,i[t],rt(i[t].line,i[t].ch+r.length))}}),Da("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=oa&&e.refresh()}),Da("specialCharPlaceholder",Zt,function(e){return e.refresh()},!0),Da("electricChars",!0),Da("inputStyle",h?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Da("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),Da("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),Da("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),Da("rtlMoveVisually",!b),Da("wholeLineUpdateBefore",!0),Da("theme","default",function(e){ia(e),Zr(e)},!0),Da("keyMap","default",function(e,t,n){t=Po(t),n=n!=oa&&Po(n);n&&n.detach&&n.detach(e,t),t.attach&&t.attach(e,n||null)}),Da("extraKeys",null),Da("configureMouse",null),Da("lineWrapping",!1,ca,!0),Da("gutters",[],function(e,t){e.display.gutterSpecs=Xr(t,e.options.lineNumbers),Zr(e)},!0),Da("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Yn(e.display)+"px":"0",e.refresh()},!0),Da("coverGutterNextToScrollbar",!1,function(e){return Mr(e)},!0),Da("scrollbarStyle","native",function(e){Dr(e),Mr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Da("lineNumbers",!1,function(e,t){e.display.gutterSpecs=Xr(e.options.gutters,t),Zr(e)},!0),Da("firstLineNumber",1,Zr,!0),Da("lineNumberFormatter",function(e){return e},Zr,!0),Da("showCursorWhenSelecting",!1,ar,!0),Da("resetSelectionOnContextMenu",!0),Da("lineWiseCopyCut",!0),Da("pasteLinesPerSelection",!0),Da("selectionsMayTouch",!1),Da("readOnly",!1,function(e,t){"nocursor"==t&&(fr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),Da("screenReaderLabel",null,function(e,t){e.display.input.screenReaderLabelChanged(t=""===t?null:t)}),Da("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Da("dragDrop",!0,la),Da("allowDropFileTypes",null),Da("cursorBlinkRate",530),Da("cursorScrollMargin",0),Da("cursorHeight",1,ar,!0),Da("singleCursorHeightPerLine",!0,ar,!0),Da("workTime",100),Da("workDelay",100),Da("flattenSpans",!0,pi,!0),Da("addModeClass",!1,pi,!0),Da("pollInterval",100),Da("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),Da("historyEventDelay",1250),Da("viewportMargin",10,function(e){return e.refresh()},!0),Da("maxHighlightLength",1e4,pi,!0),Da("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Da("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),Da("autofocus",null),Da("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),Da("phrases",null),Aa=(Ma=ua).optionHandlers,Ea=Ma.helpers={},Ma.prototype={constructor:Ma,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,Aa.hasOwnProperty(e)&&zr(this,Aa[e])(this,t,r),ke(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"](Po(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Hr(function(e,t){var n=e.token?e:Ma.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}(this.state.overlays,{mode:n,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Hr(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void tr(this)}}),indentLine:Hr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),tt(this.doc,e)&&da(this,e,t,n)}),indentSelection:Hr(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(da(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&wr(this));else{for(var o=i.from(),a=i.to(),i=Math.max(n,o.line),n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1,s=i;s<n;++s)da(this,s,e);i=this.doc.sel.ranges;0==o.ch&&t.length==i.length&&0<i[r].from().ch&&Pi(this.doc,r,new oi(o,i[r].to()),R)}}}),getTokenAt:function(e,t){return kt(this,e,t)},getLineTokens:function(e,t){return kt(this,rt(e),t,!0)},getTokenTypeAt:function(e){e=ut(this.doc,e);var t,n=gt(this,Xe(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=1+a}}e=t?t.indexOf("overlay "):-1;return e<0?t:0==e?null:t.slice(0,e-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Ma.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!Ea.hasOwnProperty(t))return n;var r=Ea[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=r[i[t][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var s=0;s<r._global.length;s++){var l=r._global[s];l.pred(i,this)&&-1==j(n,l.val)&&n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;return mt(this,(e=ct(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary(),n=null==e?n.head:"object"==typeof e?ut(this.doc,e):e?n.from():n.to();return In(this,n,t||"page")},charCoords:function(e,t){return Wn(this,ut(this.doc,e),t||"page")},coordsChar:function(e,t){return Un(this,(e=jn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=jn(this,{top:e,left:0},t||"page").top,et(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1,e="number"==typeof e?(r=this.doc.first+this.doc.size-1,e<this.doc.first?e=this.doc.first:r<e&&(e=r,i=!0),Xe(this.doc,e)):e;return Hn(this,e,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Ut(e):0)},defaultTextHeight:function(){return Vn(this.display)},defaultCharWidth:function(){return Kn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,s=this.display,l=(e=In(this,ut(this.doc,e))).bottom,c=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r?l=e.top:"above"!=r&&"near"!=r||(o=Math.max(s.wrapper.clientHeight,this.doc.height),a=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),("above"==r||e.bottom+t.offsetHeight>o)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(l=e.bottom),c+t.offsetWidth>a&&(c=a-t.offsetWidth)),t.style.top=l+"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&&(n=this,t={left:c,top:l,right:c+t.offsetWidth,bottom:l+t.offsetHeight},null!=(t=br(n,t)).scrollTop&&Cr(n,t.scrollTop),null!=t.scrollLeft&&Lr(n,t.scrollLeft))},triggerOnKeyDown:Hr(Vo),triggerOnKeyPress:Hr(Xo),triggerOnKeyUp:Ko,triggerOnMouseDown:Hr(Jo),execCommand:function(e){if(jo.hasOwnProperty(e))return jo[e].call(null,this)},triggerElectric:Hr(function(e){va(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=ut(this.doc,e),a=0;a<t&&!(o=ka(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:Hr(function(t,n){var r=this;this.extendSelectionsBy(function(e){return r.display.shift||r.doc.extend||e.empty()?ka(r.doc,e.head,t,n,r.options.rtlMoveVisually):t<0?e.from():e.to()},U)}),deleteH:Hr(function(n,r){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Fo(this,function(e){var t=ka(i,e.head,n,r,!1);return n<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=ut(this.doc,e),s=0;s<t;++s){var l=In(this,a,"div");if(null==o?o=l.left:l.left=o,(a=_a(this,l,i,n)).hitSide)break}return a},moveV:Hr(function(r,i){var o=this,a=this.doc,s=[],l=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(l)return r<0?e.from():e.to();var t=In(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var n=_a(o,t,r,i);return"page"==i&&e==a.sel.primary()&&yr(o,Wn(o,n,"div").top-t.top),n},U),s.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=Xe(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=t.length||!n?++r:--n;for(var o=t.charAt(n),a=J(o,i)?function(e){return J(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!J(e)};0<n&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new oi(rt(e.line,n),rt(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||(((this.state.overwrite=!this.state.overwrite)?E:x)(this.display.cursorDiv,"CodeMirror-overwrite"),ke(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==A()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Hr(function(e,t){kr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-wn(this)-this.display.barHeight,width:e.scrollWidth-wn(this)-this.display.barWidth,clientHeight:_n(this),clientWidth:kn(this)}},scrollIntoView:Hr(function(e,t){var n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:rt(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?(n=e,_r(t=this),t.curOp.scrollToPos=n):xr(this,e.from,e.to,e.margin)}),setSize:Hr(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var r=this;null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Pn(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){nr(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,ke(this,"refresh",this)}),operation:function(e){return Nr(this,e)},startOperation:function(){return Fr(this)},endOperation:function(){return Or(this)},refresh:Hr(function(){var e=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,Fn(this),kr(this,this.doc.scrollLeft,this.doc.scrollTop),$r(this.display),(null==e||.5<Math.abs(e-Vn(this.display))||this.options.lineWrapping)&&Qn(this),ke(this,"refresh",this)}),swapDoc:Hr(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),vi(this,e),Fn(this),this.display.input.reset(),kr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,an(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},Se(Ma),Ma.registerHelper=function(e,t,n){Ea.hasOwnProperty(e)||(Ea[e]=Ma[e]={_global:[]}),Ea[e][t]=n},Ma.registerGlobalHelper=function(e,t,n,r){Ma.registerHelper(e,t,r),Ea[e]._global.push({pred:n,val:r})};var Pa,Fa,Oa="iter insert remove copy getEditor constructor".split(" ");for(Pa in po.prototype)po.prototype.hasOwnProperty(Pa)&&j(Oa,Pa)<0&&(ua.prototype[Pa]=function(e){return function(){return e.apply(this.doc,arguments)}}(po.prototype[Pa]));return Se(po),ua.inputStyles={textarea:r,contenteditable:e},ua.defineMode=function(e){ua.defaults.mode||"null"==e||(ua.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),We[e]=t}.apply(this,arguments)},ua.defineMIME=function(e,t){Ie[e]=t},ua.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ua.defineMIME("text/plain","null"),ua.defineExtension=function(e,t){ua.prototype[e]=t},ua.defineDocExtension=function(e,t){po.prototype[e]=t},ua.fromTextArea=function(t,n){var e;function r(){t.value=s.getValue()}if((n=n?N(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus&&(e=A(),n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body),t.form&&(be(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var i=t.form,o=i.submit;try{var a=i.submit=function(){r(),i.submit=o,i.submit(),i.submit=a}}catch(e){}}n.finishInit=function(e){e.save=r,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,r(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(we(t.form,"submit",r),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=o))}},t.style.display="none";var s=ua(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s},(Fa=ua).off=we,Fa.on=be,Fa.wheelEventPixels=ni,Fa.Doc=po,Fa.splitLines=Ne,Fa.countColumn=z,Fa.findColumn=q,Fa.isWordChar=Q,Fa.Pass=I,Fa.signal=ke,Fa.Line=Gt,Fa.changeEnd=li,Fa.scrollbarModel=Er,Fa.Pos=rt,Fa.cmpPos=it,Fa.modes=We,Fa.mimeModes=Ie,Fa.resolveMode=Re,Fa.getMode=Be,Fa.modeExtensions=Ue,Fa.extendMode=qe,Fa.copyState=$e,Fa.startState=Ve,Fa.innerMode=Ge,Fa.commands=jo,Fa.keyMap=So,Fa.keyName=Do,Fa.isModifierKey=Ao,Fa.lookupKey=Mo,Fa.normalizeKeyMap=To,Fa.StringStream=Ke,Fa.SharedTextMarker=lo,Fa.TextMarker=ao,Fa.LineWidget=ro,Fa.e_preventDefault=Le,Fa.e_stopPropagation=Te,Fa.e_stop=Ae,Fa.addClass=E,Fa.contains=M,Fa.rmClass=x,Fa.keyNames=ko,ua.version="5.60.0",ua}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(P){P.defineMode("markdown",function(h,d){var p=P.getMode(h,"text/html"),i="null"==p.name;void 0===d.highlightFormatting&&(d.highlightFormatting=!1),void 0===d.maxBlockquoteDepth&&(d.maxBlockquoteDepth=0),void 0===d.taskLists&&(d.taskLists=!1),void 0===d.strikethrough&&(d.strikethrough=!1),void 0===d.emoji&&(d.emoji=!1),void 0===d.fencedCodeBlockHighlighting&&(d.fencedCodeBlockHighlighting=!0),void 0===d.fencedCodeBlockDefaultMode&&(d.fencedCodeBlockDefaultMode="text/plain"),void 0===d.xml&&(d.xml=!0),void 0===d.tokenTypeOverrides&&(d.tokenTypeOverrides={});var e,f={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(e in f)f.hasOwnProperty(e)&&d.tokenTypeOverrides[e]&&(f[e]=d.tokenTypeOverrides[e]);var g=/^([*\-_])(?:\s*\1){2,}\s*$/,m=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,b=d.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,y=/^ {0,3}(?:\={1,}|-{2,})\s*$/,n=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,k=/^\s*\[[^\]]+?\]:.*$/,_=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function x(e,t,n){return(t.f=t.inline=n)(e,t)}function C(e,t,n){return(t.f=t.block=n)(e,t)}function r(e){var t,n;return e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f!=S||(n=!(n=i)?"xml"==(t=P.innerMode(p,e.htmlState)).mode.name&&null===t.state.tagStart&&!t.state.context&&t.state.tokenize.isInText:n)&&(e.f=M,e.block=o,e.htmlState=null),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function o(e,t){var n=e.column()===t.indentation,r=!(u=t.prevLine.stream)||!/\S/.test(u.string),i=t.indentedCode,o=t.prevLine.hr,a=!1!==t.list,s=(t.listStack[t.listStack.length-1]||0)+3;t.indentedCode=!1;var l=t.indentation;if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,a)){for(t.list=null;l<t.listStack[t.listStack.length-1];)t.listStack.pop(),t.listStack.length?t.indentation=t.listStack[t.listStack.length-1]:t.list=!1;!1!==t.list&&(t.indentationDiff=l-t.listStack[t.listStack.length-1])}var c=!(r||o||t.prevLine.header||a&&i||t.prevLine.fencedCodeEnd),u=(!1===t.list||o||r)&&t.indentation<=s&&e.match(g),o=null;if(4<=t.indentationDiff&&(i||t.prevLine.fencedCodeEnd||t.prevLine.header||r))return e.skipToEnd(),t.indentedCode=!0,f.code;if(e.eatSpace())return null;if(n&&t.indentation<=s&&(o=e.match(b))&&o[1].length<=6)return t.quote=0,t.header=o[1].length,t.thisLine.header=!0,d.highlightFormatting&&(t.formatting="header"),t.f=t.inline,T(t);if(t.indentation<=s&&e.eat(">"))return t.quote=n?1:t.quote+1,d.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),T(t);if(!u&&!t.setext&&n&&t.indentation<=s&&(o=e.match(m))){r=o[1]?"ol":"ul";return t.indentation=l+e.current().length,t.list=!0,t.quote=0,t.listStack.push(t.indentation),t.em=!1,t.strong=!1,t.code=!1,t.strikethrough=!1,d.taskLists&&e.match(v,!1)&&(t.taskList=!0),t.f=t.inline,d.highlightFormatting&&(t.formatting=["list","list-"+r]),T(t)}return n&&t.indentation<=s&&(o=e.match(w,!0))?(t.quote=0,t.fencedEndRE=new RegExp(o[1]+"+ *$"),t.localMode=d.fencedCodeBlockHighlighting&&(n=o[2]||d.fencedCodeBlockDefaultMode,!P.findModeByName||(s=P.findModeByName(n))&&(n=s.mime||s.mimes[0]),"null"==(n=P.getMode(h,n)).name?null:n),t.localMode&&(t.localState=P.startState(t.localMode)),t.f=t.block=L,d.highlightFormatting&&(t.formatting="code-block"),t.code=-1,T(t)):t.setext||!(c&&a||t.quote||!1!==t.list||t.code||u||k.test(e.string))&&(o=e.lookAhead(1))&&(o=o.match(y))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),d.highlightFormatting&&(t.formatting="header")):(t.header="="==o[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,T(t)):u?(e.skipToEnd(),t.hr=!0,t.thisLine.hr=!0,f.hr):"["===e.peek()?x(e,t,D):x(e,t,t.inline)}function S(e,t){var n,r=p.token(e,t.htmlState);return i||("xml"==(n=P.innerMode(p,t.htmlState)).mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText||t.md_inside&&-1<e.current().indexOf(">"))&&(t.f=M,t.block=o,t.htmlState=null),r}function L(e,t){var n,r=t.listStack[t.listStack.length-1]||0,i=t.indentation<r;return t.fencedEndRE&&t.indentation<=r+3&&(i||e.match(t.fencedEndRE))?(d.highlightFormatting&&(t.formatting="code-block"),i||(n=T(t)),t.localMode=t.localState=null,t.block=o,t.f=M,t.fencedEndRE=null,t.code=0,t.thisLine.fencedCodeEnd=!0,i?C(e,t,t.block):n):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),f.code)}function T(e){var t,n=[];if(e.formatting){n.push(f.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)n.push(f.formatting+"-"+e.formatting[r]),"header"===e.formatting[r]&&n.push(f.formatting+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&(!d.maxBlockquoteDepth||d.maxBlockquoteDepth>=e.quote?n.push(f.formatting+"-"+e.formatting[r]+"-"+e.quote):n.push("error"))}return e.taskOpen?n.push("meta"):e.taskClosed?n.push("property"):(e.linkHref?n.push(f.linkHref,"url"):(e.strong&&n.push(f.strong),e.em&&n.push(f.em),e.strikethrough&&n.push(f.strikethrough),e.emoji&&n.push(f.emoji),e.linkText&&n.push(f.linkText),e.code&&n.push(f.code),e.image&&n.push(f.image),e.imageAltText&&n.push(f.imageAltText,"link"),e.imageMarker&&n.push(f.imageMarker)),e.header&&n.push(f.header,f.header+"-"+e.header),e.quote&&(n.push(f.quote),!d.maxBlockquoteDepth||d.maxBlockquoteDepth>=e.quote?n.push(f.quote+"-"+e.quote):n.push(f.quote+"-"+d.maxBlockquoteDepth)),!1!==e.list&&((t=(e.listStack.length-1)%3)?1==t?n.push(f.list2):n.push(f.list3):n.push(f.list1)),e.trailingSpaceNewLine?n.push("trailing-space-new-line"):e.trailingSpace&&n.push("trailing-space-"+(e.trailingSpace%2?"a":"b"))),n.length?n.join(" "):null}function t(e,t){if(e.match(n,!0))return T(t)}function M(e,t){var n=t.text(e,t);if(void 0!==n)return n;if(t.list)return t.list=null,T(t);if(t.taskList)return" "===e.match(v,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,d.highlightFormatting&&(t.formatting="task"),t.taskList=!1,T(t);if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))return d.highlightFormatting&&(t.formatting="header"),T(t);var r=e.next();if(t.linkTitle){t.linkTitle=!1;n=((n="("===r?")":r)+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");if(e.match(new RegExp("^\\s*(?:[^"+n+"\\\\]+|\\\\\\\\|\\\\.)"+n),!0))return f.linkHref}if("`"===r){var i=t.formatting;d.highlightFormatting&&(t.formatting="code"),e.eatWhile("`");var o=e.current().length;if(0!=t.code||t.quote&&1!=o){if(o!=t.code)return t.formatting=i,T(t);var a=T(t);return t.code=0,a}return t.code=o,T(t)}if(t.code)return T(t);if("\\"===r&&(e.next(),d.highlightFormatting)){var s=T(t),l=f.formatting+"-escape";return s?s+" "+l:l}if("!"===r&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.imageMarker=!0,t.image=!0,d.highlightFormatting&&(t.formatting="image"),T(t);if("["===r&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return t.imageMarker=!1,t.imageAltText=!0,d.highlightFormatting&&(t.formatting="image"),T(t);if("]"===r&&t.imageAltText){d.highlightFormatting&&(t.formatting="image");s=T(t);return t.imageAltText=!1,t.image=!1,t.inline=t.f=E,s}if("["===r&&!t.image)return t.linkText&&e.match(/^.*?\]/)||(t.linkText=!0,d.highlightFormatting&&(t.formatting="link")),T(t);if("]"===r&&t.linkText){d.highlightFormatting&&(t.formatting="link");s=T(t);return t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?E:M,s}if("<"===r&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=A,d.highlightFormatting&&(t.formatting="link"),(s=T(t))?s+=" ":s="",s+f.linkInline;if("<"===r&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=A,d.highlightFormatting&&(t.formatting="link"),(s=T(t))?s+=" ":s="",s+f.linkEmail;if(d.xml&&"<"===r&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var c=e.string.indexOf(">",e.pos);return-1!=c&&(h=e.string.substring(e.start,c),/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(h)&&(t.md_inside=!0)),e.backUp(1),t.htmlState=P.startState(p),C(e,t,S)}if(d.xml&&"<"===r&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===r||"_"===r){for(var u=1,i=1==e.pos?" ":e.string.charAt(e.pos-2);u<3&&e.eat(r);)u++;var o=e.peek()||" ",l=!/\s/.test(o)&&(!_.test(o)||/\s/.test(i)||_.test(i)),s=!/\s/.test(i)&&(!_.test(i)||/\s/.test(o)||_.test(o)),c=null,h=null;if(u%2&&(t.em||!l||"*"!==r&&s&&!_.test(i)?t.em!=r||!s||"*"!==r&&l&&!_.test(o)||(c=!1):c=!0),1<u&&(t.strong||!l||"*"!==r&&s&&!_.test(i)?t.strong!=r||!s||"*"!==r&&l&&!_.test(o)||(h=!1):h=!0),null!=h||null!=c){d.highlightFormatting&&(t.formatting=null==c?"strong":null==h?"em":"strong em"),!0===c&&(t.em=r),!0===h&&(t.strong=r);a=T(t);return!1===c&&(t.em=!1),!1===h&&(t.strong=!1),a}}else if(" "===r&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return T(t);e.backUp(1)}if(d.strikethrough)if("~"===r&&e.eatWhile(r)){if(t.strikethrough){d.highlightFormatting&&(t.formatting="strikethrough");a=T(t);return t.strikethrough=!1,a}if(e.match(/^[^\s]/,!1))return t.strikethrough=!0,d.highlightFormatting&&(t.formatting="strikethrough"),T(t)}else if(" "===r&&e.match("~~",!0)){if(" "===e.peek())return T(t);e.backUp(2)}if(d.emoji&&":"===r&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){t.emoji=!0,d.highlightFormatting&&(t.formatting="emoji");a=T(t);return t.emoji=!1,a}return" "===r&&(e.match(/^ +$/,!1)?t.trailingSpace++:t.trailingSpace&&(t.trailingSpaceNewLine=!0)),T(t)}function A(e,t){if(">"!==e.next())return e.match(/^[^>]+/,!0),f.linkInline;t.f=t.inline=M,d.highlightFormatting&&(t.formatting="link");t=T(t);return t?t+=" ":t="",t+f.linkInline}function E(e,t){if(e.eatSpace())return null;var n,e=e.next();return"("===e||"["===e?(t.f=t.inline=(n="("===e?")":"]",function(e,t){if(e.next()!==n)return e.match(a[n]),t.linkHref=!0,T(t);t.f=t.inline=M,d.highlightFormatting&&(t.formatting="link-string");e=T(t);return t.linkHref=!1,e}),d.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,T(t)):"error"}var a={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function D(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=s,e.next(),d.highlightFormatting&&(t.formatting="link"),t.linkText=!0,T(t)):x(e,t,M)}function s(e,t){if(e.match("]:",!0)){t.f=t.inline=l,d.highlightFormatting&&(t.formatting="link");var n=T(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),f.linkText}function l(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),t.f=t.inline=M,f.linkHref+" url")}var c={startState:function(){return{f:o,prevLine:{stream:null},thisLine:{stream:null},block:o,htmlState:null,indentation:0,inline:M,text:t,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&P.copyState(p,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?P.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return r(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=S)){var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentation=n,t.indentationDiff=null,0<n)return null}}return t.f(e,t)},innerMode:function(e){return e.block==S?{state:e.htmlState,mode:p}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:c}},indent:function(e,t,n){return e.block==S&&p.indent?p.indent(e.htmlState,t,n):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,t,n):P.Pass},blankLine:r,getType:T,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return c},"xml"),P.defineMIME("text/markdown","markdown"),P.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(T){var M="CodeMirror-hint-active";function r(e,t){var n;this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity&&e.on("cursorActivity",(n=this).activityFunc=function(){n.cursorActivity()})}T.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var r={hint:t};if(n)for(var i in n)r[i]=n[i];return e.showHint(r)},T.defineExtension("showHint",function(e){e=function(e,t,n){var r=e.options.hintOptions,i={};for(o in a)i[o]=a[o];if(r)for(var o in r)void 0!==r[o]&&(i[o]=r[o]);if(n)for(var o in n)void 0!==n[o]&&(i[o]=n[o]);i.hint.resolve&&(i.hint=i.hint.resolve(e,t));return i}(this,this.getCursor("start"),e);var t=this.listSelections();if(!(1<t.length)){if(this.somethingSelected()){if(!e.hint.supportsSelection)return;for(var n=0;n<t.length;n++)if(t[n].head.line!=t[n].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();e=this.state.completionActive=new r(this,e);e.options.hint&&(T.signal(this,"startCompletion",this),e.update(!0))}}),T.defineExtension("closeHint",function(){this.state.completionActive&&this.state.completionActive.close()});var i=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},o=window.cancelAnimationFrame||clearTimeout;function A(e){return"string"==typeof e?e:e.text}function E(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function n(i,e){this.completion=i,this.data=e,this.picked=!1;var n=this,o=i.cm,a=o.getInputField().ownerDocument,s=a.defaultView||a.parentWindow,l=this.hints=a.createElement("ul"),t=i.cm.options.theme;l.className="CodeMirror-hints "+t,this.selectedHint=e.selectedHint||0;for(var r=e.list,c=0;c<r.length;++c){var u=l.appendChild(a.createElement("li")),h=r[c],d="CodeMirror-hint"+(c!=this.selectedHint?"":" "+M);null!=h.className&&(d=h.className+" "+d),u.className=d,h.render?h.render(u,e,h):u.appendChild(a.createTextNode(h.displayText||A(h))),u.hintId=c}var p=i.options.container||a.body,f=o.cursorCoords(i.options.alignWithWord?e.from:null),g=f.left,m=f.bottom,v=!0,b=0,y=0;p!==a.body&&(w=(x=-1!==["absolute","relative","fixed"].indexOf(s.getComputedStyle(p).position)?p:p.offsetParent).getBoundingClientRect(),_=a.body.getBoundingClientRect(),b=w.left-_.left-x.scrollLeft,y=w.top-_.top-x.scrollTop),l.style.left=g-b+"px",l.style.top=m-y+"px";var t=s.innerWidth||Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),w=s.innerHeight||Math.max(a.body.offsetHeight,a.documentElement.offsetHeight);p.appendChild(l);var k,_=i.options.moveOnOverlap?l.getBoundingClientRect():new DOMRect,x=!!i.options.paddingForScrollbar&&l.scrollHeight>l.clientHeight+1;setTimeout(function(){k=o.getScrollInfo()}),0<_.bottom-w&&(p=_.bottom-_.top,0<f.top-(f.bottom-_.top)-p?(l.style.top=(m=f.top-p-y)+"px",v=!1):w<p&&(l.style.height=w-5+"px",l.style.top=(m=f.bottom-_.top-y)+"px",S=o.getCursor(),e.from.ch!=S.ch&&(f=o.cursorCoords(S),l.style.left=(g=f.left-b)+"px",_=l.getBoundingClientRect())));var C,S=_.right-t;if(x&&(S+=o.display.nativeBarWidth),0<S&&(_.right-_.left>t&&(l.style.width=t-5+"px",S-=_.right-_.left-t),l.style.left=(g=f.left-S-b)+"px"),x)for(var L=l.firstChild;L;L=L.nextSibling)L.style.paddingRight=o.display.nativeBarWidth+"px";o.addKeyMap(this.keyMap=function(e,r){var i={Up:function(){r.moveFocus(-1)},Down:function(){r.moveFocus(1)},PageUp:function(){r.moveFocus(1-r.menuSize(),!0)},PageDown:function(){r.moveFocus(r.menuSize()-1,!0)},Home:function(){r.setFocus(0)},End:function(){r.setFocus(r.length-1)},Enter:r.pick,Tab:r.pick,Esc:r.close};/Mac/.test(navigator.platform)&&(i["Ctrl-P"]=function(){r.moveFocus(-1)},i["Ctrl-N"]=function(){r.moveFocus(1)});var t=e.options.customKeys,o=t?{}:i;function n(e,t){var n="string"!=typeof t?function(e){return t(e,r)}:i.hasOwnProperty(t)?i[t]:t;o[e]=n}if(t)for(var a in t)t.hasOwnProperty(a)&&n(a,t[a]);var s=e.options.extraKeys;if(s)for(var a in s)s.hasOwnProperty(a)&&n(a,s[a]);return o}(i,{moveFocus:function(e,t){n.changeActive(n.selectedHint+e,t)},setFocus:function(e){n.changeActive(e)},menuSize:function(){return n.screenAmount()},length:r.length,close:function(){i.close()},pick:function(){n.pick()},data:e})),i.options.closeOnUnfocus&&(o.on("blur",this.onBlur=function(){C=setTimeout(function(){i.close()},100)}),o.on("focus",this.onFocus=function(){clearTimeout(C)})),o.on("scroll",this.onScroll=function(){var e=o.getScrollInfo(),t=o.getWrapperElement().getBoundingClientRect(),n=m+k.top-e.top,r=n-(s.pageYOffset||(a.documentElement||a.body).scrollTop);if(v||(r+=l.offsetHeight),r<=t.top||r>=t.bottom)return i.close();l.style.top=n+"px",l.style.left=g+k.left-e.left+"px"}),T.on(l,"dblclick",function(e){e=E(l,e.target||e.srcElement);e&&null!=e.hintId&&(n.changeActive(e.hintId),n.pick())}),T.on(l,"click",function(e){e=E(l,e.target||e.srcElement);e&&null!=e.hintId&&(n.changeActive(e.hintId),i.options.completeOnSingleClick&&n.pick())}),T.on(l,"mousedown",function(){setTimeout(function(){o.focus()},20)});x=this.getSelectedHintRange();return 0===x.from&&0===x.to||this.scrollToActive(),T.signal(e,"select",r[this.selectedHint],l.childNodes[this.selectedHint]),!0}function s(e,t,n,r){e.async?e(t,r,n):(n=e(t,n))&&n.then?n.then(r):r(n)}r.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&T.signal(this.data,"close"),this.widget&&this.widget.close(),T.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(e,t){var n=e.list[t],r=this;this.cm.operation(function(){n.hint?n.hint(r.cm,e,n):r.cm.replaceRange(A(n),n.from||e.from,n.to||e.to,"complete"),T.signal(e,"pick",n),r.cm.scrollIntoView()}),this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(o(this.debounce),this.debounce=0);var e=this.startPos;this.data&&(e=this.data.from);var t,n=this.cm.getCursor(),r=this.cm.getLine(n.line);n.line!=this.startPos.line||r.length-n.ch!=this.startLen-this.startPos.ch||n.ch<e.ch||this.cm.somethingSelected()||!n.ch||this.options.closeCharacters.test(r.charAt(n.ch-1))?this.close():((t=this).debounce=i(function(){t.update()}),this.widget&&this.widget.disable())},update:function(t){var n,r;null!=this.tick&&(r=++(n=this).tick,s(this.options.hint,this.cm,this.options,function(e){n.tick==r&&n.finishUpdate(e,t)}))},finishUpdate:function(e,t){this.data&&T.signal(this.data,"update");t=this.widget&&this.widget.picked||t&&this.options.completeSingle;this.widget&&this.widget.close(),(this.data=e)&&e.list.length&&(t&&1==e.list.length?this.pick(e,0):(this.widget=new n(this,e),T.signal(e,"shown")))}},n.prototype={close:function(){var e;this.completion.widget==this&&(this.completion.widget=null,this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap),e=this.completion.cm,this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll))},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var e=this;this.keyMap={Enter:function(){e.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(e,t){e>=this.data.list.length?e=t?this.data.list.length-1:0:e<0&&(e=t?0:this.data.list.length-1),this.selectedHint!=e&&((t=this.hints.childNodes[this.selectedHint])&&(t.className=t.className.replace(" "+M,"")),(t=this.hints.childNodes[this.selectedHint=e]).className+=" "+M,this.scrollToActive(),T.signal(this.data,"select",this.data.list[this.selectedHint],t))},scrollToActive:function(){var e=this.getSelectedHintRange(),t=this.hints.childNodes[e.from],n=this.hints.childNodes[e.to],e=this.hints.firstChild;t.offsetTop<this.hints.scrollTop?this.hints.scrollTop=t.offsetTop-e.offsetTop:n.offsetTop+n.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+e.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var e=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-e),to:Math.min(this.data.list.length-1,this.selectedHint+e)}}},T.registerHelper("hint","auto",{resolve:function(e,t){var n,a=e.getHelpers(t,"hint");if(a.length){t=function(e,r,i){var o=function(e,t){if(!e.somethingSelected())return t;for(var n=[],r=0;r<t.length;r++)t[r].supportsSelection&&n.push(t[r]);return n}(e,a);!function t(n){if(n==o.length)return r(null);s(o[n],e,i,function(e){e&&0<e.list.length?r(e):t(n+1)})}(0)};return t.async=!0,t.supportsSelection=!0,t}return(n=e.getHelper(e.getCursor(),"hintWords"))?function(e){return T.hint.fromList(e,{words:n})}:T.hint.anyword?function(e,t){return T.hint.anyword(e,t)}:function(){}}}),T.registerHelper("hint","fromList",function(e,t){var n,r=e.getCursor(),i=e.getTokenAt(r),o=T.Pos(r.line,i.start),e=r;i.start<r.ch&&/\w/.test(i.string.charAt(r.ch-i.start-1))?n=i.string.substr(0,r.ch-i.start):(n="",o=r);for(var a=[],s=0;s<t.words.length;s++){var l=t.words[s];l.slice(0,n.length)==n&&a.push(l)}if(a.length)return{list:a,from:o,to:e}}),T.commands.autocomplete=T.showHint;var a={hint:T.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};T.defineOption("hintOptions",null)}),function(){function r(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}var b={},n={},h={},d=r(!0),p="vanilla",f={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:r(!0),allOn:function(){var e,t=r(!0),n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=!0);return n}()};function g(e,t){var n=t?"Error in "+t+" extension->":"Error in unnamed extension",r={valid:!0,error:""};b.helper.isArray(e)||(e=[e]);for(var i=0;i<e.length;++i){var o=n+" sub-extension "+i+": ",a=e[i];if("object"!=typeof a)return r.valid=!1,r.error=o+"must be an object, but "+typeof a+" given",r;if(!b.helper.isString(a.type))return r.valid=!1,r.error=o+'property "type" must be a string, but '+typeof a.type+" given",r;var s=a.type=a.type.toLowerCase();if("lang"!==(s="html"===(s="language"===s?a.type="lang":s)?a.type="output":s)&&"output"!==s&&"listener"!==s)return r.valid=!1,r.error=o+"type "+s+' is not recognized. Valid values: "lang/language", "output/html" or "listener"',r;if("listener"===s){if(b.helper.isUndefined(a.listeners))return r.valid=!1,r.error=o+'. Extensions of type "listener" must have a property called "listeners"',r}else if(b.helper.isUndefined(a.filter)&&b.helper.isUndefined(a.regex))return r.valid=!1,r.error=o+s+' extensions must define either a "regex" property or a "filter" method',r;if(a.listeners){if("object"!=typeof a.listeners)return r.valid=!1,r.error=o+'"listeners" property must be an object but '+typeof a.listeners+" given",r;for(var l in a.listeners)if(a.listeners.hasOwnProperty(l)&&"function"!=typeof a.listeners[l])return r.valid=!1,r.error=o+'"listeners" property must be an hash of [event name]: [callback]. listeners.'+l+" must be a function but "+typeof a.listeners[l]+" given",r}if(a.filter){if("function"!=typeof a.filter)return r.valid=!1,r.error=o+'"filter" must be a function, but '+typeof a.filter+" given",r}else if(a.regex){if(b.helper.isString(a.regex)&&(a.regex=new RegExp(a.regex,"g")),!(a.regex instanceof RegExp))return r.valid=!1,r.error=o+'"regex" property must either be a string or a RegExp object, but '+typeof a.regex+" given",r;if(b.helper.isUndefined(a.replace))return r.valid=!1,r.error=o+'"regex" extensions must implement a replace string or function',r}}return r}function i(e,t){return"¨E"+t.charCodeAt(0)+"E"}b.helper={},b.extensions={},b.setOption=function(e,t){return d[e]=t,this},b.getOption=function(e){return d[e]},b.getOptions=function(){return d},b.resetOptions=function(){d=r(!0)},b.setFlavor=function(e){if(!f.hasOwnProperty(e))throw Error(e+" flavor was not found");b.resetOptions();var t,n=f[e];for(t in p=e,n)n.hasOwnProperty(t)&&(d[t]=n[t])},b.getFlavor=function(){return p},b.getFlavorOptions=function(e){if(f.hasOwnProperty(e))return f[e]},b.getDefaultOptions=r,b.subParser=function(e,t){if(b.helper.isString(e)){if(void 0===t){if(n.hasOwnProperty(e))return n[e];throw Error("SubParser named "+e+" not registered!")}n[e]=t}},b.extension=function(e,t){if(!b.helper.isString(e))throw Error("Extension 'name' must be a string");if(e=b.helper.stdExtName(e),b.helper.isUndefined(t)){if(!h.hasOwnProperty(e))throw Error("Extension named "+e+" is not registered!");return h[e]}"function"==typeof t&&(t=t());var n=g(t=!b.helper.isArray(t)?[t]:t,e);if(!n.valid)throw Error(n.error);h[e]=t},b.getAllExtensions=function(){return h},b.removeExtension=function(e){delete h[e]},b.resetExtensions=function(){h={}},b.validateExtension=function(e){e=g(e,null);return!!e.valid||(console.warn(e.error),!1)},b.hasOwnProperty("helper")||(b.helper={}),b.helper.isString=function(e){return"string"==typeof e||e instanceof String},b.helper.isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)},b.helper.isArray=function(e){return Array.isArray(e)},b.helper.isUndefined=function(e){return void 0===e},b.helper.forEach=function(e,t){if(b.helper.isUndefined(e))throw new Error("obj param is required");if(b.helper.isUndefined(t))throw new Error("callback param is required");if(!b.helper.isFunction(t))throw new Error("callback param must be a function/closure");if("function"==typeof e.forEach)e.forEach(t);else if(b.helper.isArray(e))for(var n=0;n<e.length;n++)t(e[n],n,e);else{if("object"!=typeof e)throw new Error("obj does not seem to be an array or an iterable object");for(var r in e)e.hasOwnProperty(r)&&t(e[r],r,e)}},b.helper.stdExtName=function(e){return e.replace(/[_?*+\/\\.^-]/g,"").replace(/\s/g,"").toLowerCase()},b.helper.escapeCharactersCallback=i,b.helper.escapeCharacters=function(e,t,n){t="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(t="\\\\"+t);t=new RegExp(t,"g");return e=e.replace(t,i)},b.helper.unescapeHTMLEntities=function(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")};function u(e,t,n,r){var i,o,a,s,l=-1<(r=r||"").indexOf("g"),c=new RegExp(t+"|"+n,"g"+r.replace(/g/g,"")),u=new RegExp(t,r.replace(/g/g,"")),h=[];do{for(i=0;a=c.exec(e);)if(u.test(a[0]))i++||(s=(o=c.lastIndex)-a[0].length);else if(i&&!--i){var d=a.index+a[0].length,d={left:{start:s,end:o},match:{start:o,end:a.index},right:{start:a.index,end:d},wholeMatch:{start:s,end:d}};if(h.push(d),!l)return h}}while(i&&(c.lastIndex=o));return h}b.helper.matchRecursiveRegExp=function(e,t,n,r){for(var i=u(e,t,n,r),o=[],a=0;a<i.length;++a)o.push([e.slice(i[a].wholeMatch.start,i[a].wholeMatch.end),e.slice(i[a].match.start,i[a].match.end),e.slice(i[a].left.start,i[a].left.end),e.slice(i[a].right.start,i[a].right.end)]);return o},b.helper.replaceRecursiveRegExp=function(e,t,n,r,i){var o;b.helper.isFunction(t)||(o=t,t=function(){return o});var a=u(e,n,r,i),i=e,s=a.length;if(0<s){var l=[];0!==a[0].wholeMatch.start&&l.push(e.slice(0,a[0].wholeMatch.start));for(var c=0;c<s;++c)l.push(t(e.slice(a[c].wholeMatch.start,a[c].wholeMatch.end),e.slice(a[c].match.start,a[c].match.end),e.slice(a[c].left.start,a[c].left.end),e.slice(a[c].right.start,a[c].right.end))),c<s-1&&l.push(e.slice(a[c].wholeMatch.end,a[c+1].wholeMatch.start));a[s-1].wholeMatch.end<e.length&&l.push(e.slice(a[s-1].wholeMatch.end)),i=l.join("")}return i},b.helper.regexIndexOf=function(e,t,n){if(!b.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if(t instanceof RegExp==!1)throw"InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";t=e.substring(n||0).search(t);return 0<=t?t+(n||0):t},b.helper.splitAtIndex=function(e,t){if(!b.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},b.helper.encodeEmailAddress=function(e){var n=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e=e.replace(/./g,function(e){var t;return e="@"===e?n[Math.floor(2*Math.random())](e):.9<(t=Math.random())?n[2](e):.45<t?n[1](e):n[0](e)})},b.helper.padEnd=function(e,t,n){return t>>=0,n=String(n||" "),e.length>t?String(e):((t-=e.length)>n.length&&(n+=n.repeat(t/n.length)),String(e)+n.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),b.helper.regexes={asteriskDashAndColon:/([*_:~])/g},b.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️&zwj;♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴&zwj;♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱&zwj;♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇&zwj;♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷&zwj;♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨&zwj;❤️&zwj;👨",couple_with_heart_woman_woman:"👩&zwj;❤️&zwj;👩",couplekiss_man_man:"👨&zwj;❤️&zwj;💋&zwj;👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩&zwj;❤️&zwj;💋&zwj;👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯&zwj;♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁&zwj;🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨&zwj;👦",family_man_boy_boy:"👨&zwj;👦&zwj;👦",family_man_girl:"👨&zwj;👧",family_man_girl_boy:"👨&zwj;👧&zwj;👦",family_man_girl_girl:"👨&zwj;👧&zwj;👧",family_man_man_boy:"👨&zwj;👨&zwj;👦",family_man_man_boy_boy:"👨&zwj;👨&zwj;👦&zwj;👦",family_man_man_girl:"👨&zwj;👨&zwj;👧",family_man_man_girl_boy:"👨&zwj;👨&zwj;👧&zwj;👦",family_man_man_girl_girl:"👨&zwj;👨&zwj;👧&zwj;👧",family_man_woman_boy_boy:"👨&zwj;👩&zwj;👦&zwj;👦",family_man_woman_girl:"👨&zwj;👩&zwj;👧",family_man_woman_girl_boy:"👨&zwj;👩&zwj;👧&zwj;👦",family_man_woman_girl_girl:"👨&zwj;👩&zwj;👧&zwj;👧",family_woman_boy:"👩&zwj;👦",family_woman_boy_boy:"👩&zwj;👦&zwj;👦",family_woman_girl:"👩&zwj;👧",family_woman_girl_boy:"👩&zwj;👧&zwj;👦",family_woman_girl_girl:"👩&zwj;👧&zwj;👧",family_woman_woman_boy:"👩&zwj;👩&zwj;👦",family_woman_woman_boy_boy:"👩&zwj;👩&zwj;👦&zwj;👦",family_woman_woman_girl:"👩&zwj;👩&zwj;👧",family_woman_woman_girl_boy:"👩&zwj;👩&zwj;👧&zwj;👦",family_woman_woman_girl_girl:"👩&zwj;👩&zwj;👧&zwj;👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️&zwj;♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍&zwj;♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️&zwj;♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂&zwj;♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇&zwj;♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨&zwj;🎨",man_astronaut:"👨&zwj;🚀",man_cartwheeling:"🤸&zwj;♂️",man_cook:"👨&zwj;🍳",man_dancing:"🕺",man_facepalming:"🤦&zwj;♂️",man_factory_worker:"👨&zwj;🏭",man_farmer:"👨&zwj;🌾",man_firefighter:"👨&zwj;🚒",man_health_worker:"👨&zwj;⚕️",man_in_tuxedo:"🤵",man_judge:"👨&zwj;⚖️",man_juggling:"🤹&zwj;♂️",man_mechanic:"👨&zwj;🔧",man_office_worker:"👨&zwj;💼",man_pilot:"👨&zwj;✈️",man_playing_handball:"🤾&zwj;♂️",man_playing_water_polo:"🤽&zwj;♂️",man_scientist:"👨&zwj;🔬",man_shrugging:"🤷&zwj;♂️",man_singer:"👨&zwj;🎤",man_student:"👨&zwj;🎓",man_teacher:"👨&zwj;🏫",man_technologist:"👨&zwj;💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆&zwj;♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼&zwj;♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵&zwj;♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅&zwj;♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆&zwj;♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮&zwj;♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎&zwj;♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️&zwj;🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋&zwj;♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣&zwj;♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃&zwj;♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄&zwj;♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊&zwj;♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁&zwj;♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶&zwj;♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️&zwj;♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩&zwj;🎨",woman_astronaut:"👩&zwj;🚀",woman_cartwheeling:"🤸&zwj;♀️",woman_cook:"👩&zwj;🍳",woman_facepalming:"🤦&zwj;♀️",woman_factory_worker:"👩&zwj;🏭",woman_farmer:"👩&zwj;🌾",woman_firefighter:"👩&zwj;🚒",woman_health_worker:"👩&zwj;⚕️",woman_judge:"👩&zwj;⚖️",woman_juggling:"🤹&zwj;♀️",woman_mechanic:"👩&zwj;🔧",woman_office_worker:"👩&zwj;💼",woman_pilot:"👩&zwj;✈️",woman_playing_handball:"🤾&zwj;♀️",woman_playing_water_polo:"🤽&zwj;♀️",woman_scientist:"👩&zwj;🔬",woman_shrugging:"🤷&zwj;♀️",woman_singer:"👩&zwj;🎤",woman_student:"👩&zwj;🎓",woman_teacher:"👩&zwj;🏫",woman_technologist:"👩&zwj;💻",woman_with_turban:"👳&zwj;♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼&zwj;♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',showdown:"<span style=\"font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;\">S</span>"},b.Converter=function(n){var i={},o=[],a=[],s={},r=p,l={parsed:{},raw:"",format:""};function c(e,t){if(t=t||null,b.helper.isString(e)){if(e=b.helper.stdExtName(e),b.extensions[t=e])return console.warn("DEPRECATION WARNING: "+e+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),void function(e,t){"function"==typeof e&&(e=e(new b.Converter));b.helper.isArray(e)||(e=[e]);t=g(e,t);if(!t.valid)throw Error(t.error);for(var n=0;n<e.length;++n)switch(e[n].type){case"lang":o.push(e[n]);break;case"output":a.push(e[n]);break;default:throw Error("Extension loader error: Type unrecognized!!!")}}(b.extensions[e],e);if(b.helper.isUndefined(h[e]))throw Error('Extension "'+e+'" could not be loaded. It was either not found or is not a valid extension.');e=h[e]}"function"==typeof e&&(e=e());t=g(e=!b.helper.isArray(e)?[e]:e,t);if(!t.valid)throw Error(t.error);for(var n=0;n<e.length;++n){switch(e[n].type){case"lang":o.push(e[n]);break;case"output":a.push(e[n])}if(e[n].hasOwnProperty("listeners"))for(var r in e[n].listeners)e[n].listeners.hasOwnProperty(r)&&u(r,e[n].listeners[r])}}function u(e,t){if(!b.helper.isString(e))throw Error("Invalid argument in converter.listen() method: name must be a string, but "+typeof e+" given");if("function"!=typeof t)throw Error("Invalid argument in converter.listen() method: callback must be a function, but "+typeof t+" given");s.hasOwnProperty(e)||(s[e]=[]),s[e].push(t)}!function(){for(var e in n=n||{},d)d.hasOwnProperty(e)&&(i[e]=d[e]);{if("object"!=typeof n)throw Error("Converter expects the passed parameter to be an object, but "+typeof n+" was passed instead.");for(var t in n)n.hasOwnProperty(t)&&(i[t]=n[t])}i.extensions&&b.helper.forEach(i.extensions,c)}(),this._dispatch=function(e,t,n,r){if(s.hasOwnProperty(e))for(var i=0;i<s[e].length;++i){var o=s[e][i](e,t,this,n,r);o&&void 0!==o&&(t=o)}return t},this.listen=function(e,t){return u(e,t),this},this.makeHtml=function(t){if(!t)return t;var e,n,r={gHtmlBlocks:[],gHtmlMdBlocks:[],gHtmlSpans:[],gUrls:{},gTitles:{},gDimensions:{},gListLevel:0,hashLinkCounts:{},langExtensions:o,outputModifiers:a,converter:this,ghCodeBlocks:[],metadata:{parsed:{},raw:"",format:""}};return t=(t=(t=(t=(t=t.replace(/¨/g,"¨T")).replace(/\$/g,"¨D")).replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/\u00A0/g,"&nbsp;"),i.smartIndentationFix&&(n=(e=t).match(/^\s*/)[0].length,n=new RegExp("^\\s{0,"+n+"}","gm"),t=e.replace(n,"")),t="\n\n"+t+"\n\n",t=(t=b.subParser("detab")(t,i,r)).replace(/^[ \t]+$/gm,""),b.helper.forEach(o,function(e){t=b.subParser("runExtension")(e,t,i,r)}),t=b.subParser("metadata")(t,i,r),t=b.subParser("hashPreCodeTags")(t,i,r),t=b.subParser("githubCodeBlocks")(t,i,r),t=b.subParser("hashHTMLBlocks")(t,i,r),t=b.subParser("hashCodeTags")(t,i,r),t=b.subParser("stripLinkDefinitions")(t,i,r),t=b.subParser("blockGamut")(t,i,r),t=b.subParser("unhashHTMLSpans")(t,i,r),t=(t=(t=b.subParser("unescapeSpecialChars")(t,i,r)).replace(/¨D/g,"$$")).replace(/¨T/g,"¨"),t=b.subParser("completeHTMLDocument")(t,i,r),b.helper.forEach(a,function(e){t=b.subParser("runExtension")(e,t,i,r)}),l=r.metadata,t},this.makeMarkdown=this.makeMd=function(e,t){if(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/>[ \t]+</,">¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}t=t.createElement("div");t.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),n=[],r=0;r<t.length;++r)if(1===t[r].childElementCount&&"code"===t[r].firstChild.tagName.toLowerCase()){var i=t[r].firstChild.innerHTML.trim(),o=t[r].firstChild.getAttribute("data-language")||"";if(""===o)for(var a=t[r].firstChild.className.split(" "),s=0;s<a.length;++s){var l=a[s].match(/^language-(.+)$/);if(null!==l){o=l[1];break}}i=b.helper.unescapeHTMLEntities(i),n.push(i),t[r].outerHTML='<precode language="'+o+'" precodenum="'+r.toString()+'"></precode>'}else n.push(t[r].innerHTML),t[r].innerHTML="",t[r].setAttribute("prenum",r.toString());return n}(t)};!function e(t){for(var n=0;n<t.childNodes.length;++n){var r=t.childNodes[n];3===r.nodeType?/\S/.test(r.nodeValue)?(r.nodeValue=r.nodeValue.split("\n").join(" "),r.nodeValue=r.nodeValue.replace(/(\s)+/g,"$1")):(t.removeChild(r),--n):1===r.nodeType&&e(r)}}(t);for(var r=t.childNodes,i="",o=0;o<r.length;o++)i+=b.subParser("makeMarkdown.node")(r[o],n);return i},this.setOption=function(e,t){i[e]=t},this.getOption=function(e){return i[e]},this.getOptions=function(){return i},this.addExtension=function(e,t){c(e,t=t||null)},this.useExtension=function(e){c(e)},this.setFlavor=function(e){if(!f.hasOwnProperty(e))throw Error(e+" flavor was not found");var t,n=f[e];for(t in r=e,n)n.hasOwnProperty(t)&&(i[t]=n[t])},this.getFlavor=function(){return r},this.removeExtension=function(e){b.helper.isArray(e)||(e=[e]);for(var t=0;t<e.length;++t){for(var n=e[t],r=0;r<o.length;++r)o[r]===n&&o[r].splice(r,1);for(;0<a.length;++r)a[0]===n&&a[0].splice(r,1)}},this.getAllExtensions=function(){return{language:o,output:a}},this.getMetadata=function(e){return e?l.raw:l.parsed},this.getMetadataFormat=function(){return l.format},this._setMetadataPair=function(e,t){l.parsed[e]=t},this._setMetadataFormat=function(e){l.format=e},this._setMetadataRaw=function(e){l.raw=e}},b.subParser("anchors",function(e,s,l){function t(e,t,n,r,i,o,a){if(b.helper.isUndefined(a)&&(a=""),n=n.toLowerCase(),-1<e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m))r="";else if(!r){if(r="#"+(n=n||t.toLowerCase().replace(/ ?\n/g," ")),b.helper.isUndefined(l.gUrls[n]))return e;r=l.gUrls[n],b.helper.isUndefined(l.gTitles[n])||(a=l.gTitles[n])}return n='<a href="'+(r=r.replace(b.helper.regexes.asteriskDashAndColon,b.helper.escapeCharactersCallback))+'"',""!==a&&null!==a&&(n+=' title="'+(a=(a=a.replace(/"/g,"&quot;")).replace(b.helper.regexes.asteriskDashAndColon,b.helper.escapeCharactersCallback))+'"'),s.openLinksInNewWindow&&!/^#/.test(r)&&(n+=' rel="noopener noreferrer" target="¨E95Eblank"'),n+=">"+t+"</a>"}return e=(e=(e=(e=(e=l.converter._dispatch("anchors.before",e,s,l)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,t)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,t)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,t)).replace(/\[([^\[\]]+)]()()()()()/g,t),s.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,t,n,r,i){if("\\"===n)return t+r;if(!b.helper.isString(s.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");n="";return t+'<a href="'+s.ghMentionsLink.replace(/\{u}/g,i)+'"'+(n=s.openLinksInNewWindow?' rel="noopener noreferrer" target="¨E95Eblank"':n)+">"+r+"</a>"})),e=l.converter._dispatch("anchors.after",e,s,l)});function o(u){return function(e,t,n,r,i,o,a){var s=n=n.replace(b.helper.regexes.asteriskDashAndColon,b.helper.escapeCharactersCallback),l="",c="",t=t||"",a=a||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),u.excludeTrailingPunctuationFromURLs&&o&&(l=o),t+'<a href="'+n+'"'+(c=u.openLinksInNewWindow?' rel="noopener noreferrer" target="¨E95Eblank"':c)+">"+s+"</a>"+l+a}}function a(i,o){return function(e,t,n){var r="mailto:";return t=t||"",n=b.subParser("unescapeSpecialChars")(n,i,o),i.encodeEmails?(r=b.helper.encodeEmailAddress(r+n),n=b.helper.encodeEmailAddress(n)):r+=n,t+'<a href="'+r+'">'+n+"</a>"}}var s=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,l=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,c=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,m=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,v=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi;b.subParser("autoLinks",function(e,t,n){return e=(e=(e=n.converter._dispatch("autoLinks.before",e,t,n)).replace(c,o(t))).replace(v,a(t,n)),e=n.converter._dispatch("autoLinks.after",e,t,n)}),b.subParser("simplifiedAutoLinks",function(e,t,n){return t.simplifiedAutoLink?(e=n.converter._dispatch("simplifiedAutoLinks.before",e,t,n),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(l,o(t)):e.replace(s,o(t))).replace(m,a(t,n)),e=n.converter._dispatch("simplifiedAutoLinks.after",e,t,n)):e}),b.subParser("blockGamut",function(e,t,n){return e=n.converter._dispatch("blockGamut.before",e,t,n),e=b.subParser("blockQuotes")(e,t,n),e=b.subParser("headers")(e,t,n),e=b.subParser("horizontalRule")(e,t,n),e=b.subParser("lists")(e,t,n),e=b.subParser("codeBlocks")(e,t,n),e=b.subParser("tables")(e,t,n),e=b.subParser("hashHTMLBlocks")(e,t,n),e=b.subParser("paragraphs")(e,t,n),e=n.converter._dispatch("blockGamut.after",e,t,n)}),b.subParser("blockQuotes",function(e,t,n){e=n.converter._dispatch("blockQuotes.before",e,t,n);var r=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(r=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=(e+="\n\n").replace(r,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=b.subParser("githubCodeBlocks")(e,t,n),e=(e=(e=b.subParser("blockGamut")(e,t,n)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){return t=(t=t.replace(/^ /gm,"¨0")).replace(/¨0/g,"")}),b.subParser("hashBlock")("<blockquote>\n"+e+"\n</blockquote>",t,n)}),e=n.converter._dispatch("blockQuotes.after",e,t,n)}),b.subParser("codeBlocks",function(e,i,o){e=o.converter._dispatch("codeBlocks.before",e,i,o);return e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,t,n){var r=t,t=n,n="\n",r=b.subParser("outdent")(r,i,o);return r=b.subParser("encodeCode")(r,i,o),r="<pre><code>"+(r=(r=(r=b.subParser("detab")(r,i,o)).replace(/^\n+/g,"")).replace(/\n+$/g,""))+(n=i.omitExtraWLInCodeBlocks?"":n)+"</code></pre>",b.subParser("hashBlock")(r,i,o)+t})).replace(/¨0/,""),e=o.converter._dispatch("codeBlocks.after",e,i,o)}),b.subParser("codeSpans",function(e,i,o){return e=(e=void 0===(e=o.converter._dispatch("codeSpans.before",e,i,o))?"":e).replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,r){return r=(r=r.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),r=t+"<code>"+(r=b.subParser("encodeCode")(r,i,o))+"</code>",r=b.subParser("hashHTMLSpans")(r,i,o)}),e=o.converter._dispatch("codeSpans.after",e,i,o)}),b.subParser("completeHTMLDocument",function(e,t,n){if(!t.completeHTMLDocument)return e;e=n.converter._dispatch("completeHTMLDocument.before",e,t,n);var r,i="html",o="<!DOCTYPE HTML>\n",a="",s='<meta charset="utf-8">\n',l="",c="";for(r in void 0!==n.metadata.parsed.doctype&&(o="<!DOCTYPE "+n.metadata.parsed.doctype+">\n","html"!==(i=n.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==i||(s='<meta charset="utf-8">')),n.metadata.parsed)if(n.metadata.parsed.hasOwnProperty(r))switch(r.toLowerCase()){case"doctype":break;case"title":a="<title>"+n.metadata.parsed.title+"</title>\n";break;case"charset":s="html"===i||"html5"===i?'<meta charset="'+n.metadata.parsed.charset+'">\n':'<meta name="charset" content="'+n.metadata.parsed.charset+'">\n';break;case"language":case"lang":l=' lang="'+n.metadata.parsed[r]+'"',c+='<meta name="'+r+'" content="'+n.metadata.parsed[r]+'">\n';break;default:c+='<meta name="'+r+'" content="'+n.metadata.parsed[r]+'">\n'}return e=o+"<html"+l+">\n<head>\n"+a+s+c+"</head>\n<body>\n"+e.trim()+"\n</body>\n</html>",e=n.converter._dispatch("completeHTMLDocument.after",e,t,n)}),b.subParser("detab",function(e,t,n){return e=(e=(e=(e=(e=(e=n.converter._dispatch("detab.before",e,t,n)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var n=t,r=4-n.length%4,i=0;i<r;i++)n+=" ";return n})).replace(/¨A/g," ")).replace(/¨B/g,""),e=n.converter._dispatch("detab.after",e,t,n)}),b.subParser("ellipsis",function(e,t,n){return e=(e=n.converter._dispatch("ellipsis.before",e,t,n)).replace(/\.\.\./g,"…"),e=n.converter._dispatch("ellipsis.after",e,t,n)}),b.subParser("emoji",function(e,t,n){if(!t.emoji)return e;return e=(e=n.converter._dispatch("emoji.before",e,t,n)).replace(/:([\S]+?):/g,function(e,t){return b.helper.emojis.hasOwnProperty(t)?b.helper.emojis[t]:e}),e=n.converter._dispatch("emoji.after",e,t,n)}),b.subParser("encodeAmpsAndAngles",function(e,t,n){return e=(e=(e=(e=(e=n.converter._dispatch("encodeAmpsAndAngles.before",e,t,n)).replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;")).replace(/<(?![a-z\/?$!])/gi,"&lt;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),e=n.converter._dispatch("encodeAmpsAndAngles.after",e,t,n)}),b.subParser("encodeBackslashEscapes",function(e,t,n){return e=(e=(e=n.converter._dispatch("encodeBackslashEscapes.before",e,t,n)).replace(/\\(\\)/g,b.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,b.helper.escapeCharactersCallback),e=n.converter._dispatch("encodeBackslashEscapes.after",e,t,n)}),b.subParser("encodeCode",function(e,t,n){return e=(e=n.converter._dispatch("encodeCode.before",e,t,n)).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/([*_{}\[\]\\=~-])/g,b.helper.escapeCharactersCallback),e=n.converter._dispatch("encodeCode.after",e,t,n)}),b.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,n){return e=(e=(e=n.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,n)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,b.helper.escapeCharactersCallback)})).replace(/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,b.helper.escapeCharactersCallback)}),e=n.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,n)}),b.subParser("githubCodeBlocks",function(e,o,a){return o.ghCodeBlocks?(e=a.converter._dispatch("githubCodeBlocks.before",e,o,a),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,t,n,r){var i=o.omitExtraWLInCodeBlocks?"":"\n";return r=b.subParser("encodeCode")(r,o,a),r="<pre><code"+(n?' class="'+n+" language-"+n+'"':"")+">"+(r=(r=(r=b.subParser("detab")(r,o,a)).replace(/^\n+/g,"")).replace(/\n+$/g,""))+i+"</code></pre>",r=b.subParser("hashBlock")(r,o,a),"\n\n¨G"+(a.ghCodeBlocks.push({text:e,codeblock:r})-1)+"G\n\n"})).replace(/¨0/,""),a.converter._dispatch("githubCodeBlocks.after",e,o,a)):e}),b.subParser("hashBlock",function(e,t,n){return e=(e=n.converter._dispatch("hashBlock.before",e,t,n)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(n.gHtmlBlocks.push(e)-1)+"K\n\n",e=n.converter._dispatch("hashBlock.after",e,t,n)}),b.subParser("hashCodeTags",function(e,i,o){e=o.converter._dispatch("hashCodeTags.before",e,i,o);return e=b.helper.replaceRecursiveRegExp(e,function(e,t,n,r){r=n+b.subParser("encodeCode")(t,i,o)+r;return"¨C"+(o.gHtmlSpans.push(r)-1)+"C"},"<code\\b[^>]*>","</code>","gim"),e=o.converter._dispatch("hashCodeTags.after",e,i,o)}),b.subParser("hashElement",function(e,t,n){return function(e,t){return t=(t=(t=t.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),t="\n\n¨K"+(n.gHtmlBlocks.push(t)-1)+"K\n\n"}}),b.subParser("hashHTMLBlocks",function(e,t,i){e=i.converter._dispatch("hashHTMLBlocks.before",e,t,i);function n(e,t,n,r){return-1!==n.search(/\bmarkdown\b/)&&(e=n+i.converter.makeHtml(t)+r),"\n\n¨K"+(i.gHtmlBlocks.push(e)-1)+"K\n\n"}var r=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"];t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"&lt;"+t+"&gt;"}));for(var o=0;o<r.length;++o)for(var a=new RegExp("^ {0,3}(<"+r[o]+"\\b[^>]*>)","im"),s="<"+r[o]+"\\b[^>]*>",l="</"+r[o]+">";-1!==(u=b.helper.regexIndexOf(e,a));){var c=b.helper.splitAtIndex(e,u),u=b.helper.replaceRecursiveRegExp(c[1],n,s,l,"im");if(u===c[1])break;e=c[0].concat(u)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,b.subParser("hashElement")(e,t,i)),e=(e=b.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(i.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,b.subParser("hashElement")(e,t,i)),e=i.converter._dispatch("hashHTMLBlocks.after",e,t,i)}),b.subParser("hashHTMLSpans",function(e,t,n){function r(e){return"¨C"+(n.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=n.converter._dispatch("hashHTMLSpans.before",e,t,n)).replace(/<[^>]+?\/>/gi,r)).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,r)).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,r)).replace(/<[^>]+?>/gi,r),e=n.converter._dispatch("hashHTMLSpans.after",e,t,n)}),b.subParser("unhashHTMLSpans",function(e,t,n){e=n.converter._dispatch("unhashHTMLSpans.before",e,t,n);for(var r=0;r<n.gHtmlSpans.length;++r){for(var i=n.gHtmlSpans[r],o=0;/¨C(\d+)C/.test(i);){var a=RegExp.$1,i=i.replace("¨C"+a+"C",n.gHtmlSpans[a]);if(10===o){console.error("maximum nesting of 10 spans reached!!!");break}++o}e=e.replace("¨C"+r+"C",i)}return e=n.converter._dispatch("unhashHTMLSpans.after",e,t,n)}),b.subParser("hashPreCodeTags",function(e,i,o){e=o.converter._dispatch("hashPreCodeTags.before",e,i,o);return e=b.helper.replaceRecursiveRegExp(e,function(e,t,n,r){r=n+b.subParser("encodeCode")(t,i,o)+r;return"\n\n¨G"+(o.ghCodeBlocks.push({text:e,codeblock:r})-1)+"G\n\n"},"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),e=o.converter._dispatch("hashPreCodeTags.after",e,i,o)}),b.subParser("headers",function(e,i,o){e=o.converter._dispatch("headers.before",e,i,o);var a=isNaN(parseInt(i.headerLevelStart))?1:parseInt(i.headerLevelStart),t=i.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,n=i.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(t,function(e,t){var n=b.subParser("spanGamut")(t,i,o),t=i.noHeaderId?"":' id="'+s(t)+'"',n="<h"+a+t+">"+n+"</h"+a+">";return b.subParser("hashBlock")(n,i,o)})).replace(n,function(e,t){var n=b.subParser("spanGamut")(t,i,o),r=i.noHeaderId?"":' id="'+s(t)+'"',t=a+1,t="<h"+t+r+">"+n+"</h"+t+">";return b.subParser("hashBlock")(t,i,o)});n=i.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;function s(e){var t;return!i.customizedHeaderId||(t=e.match(/\{([^{]+?)}\s*$/))&&t[1]&&(e=t[1]),t=e,e=b.helper.isString(i.prefixHeaderId)?i.prefixHeaderId:!0===i.prefixHeaderId?"section-":"",i.rawPrefixHeaderId||(t=e+t),t=(i.ghCompatibleHeaderId?t.replace(/ /g,"-").replace(/&amp;/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,""):i.rawHeaderId?t.replace(/ /g,"-").replace(/&amp;/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-"):t.replace(/[^\w]/g,"")).toLowerCase(),i.rawPrefixHeaderId&&(t=e+t),o.hashLinkCounts[t]?t=t+"-"+o.hashLinkCounts[t]++:o.hashLinkCounts[t]=1,t}return e=e.replace(n,function(e,t,n){var r=n;i.customizedHeaderId&&(r=n.replace(/\s?\{([^{]+?)}\s*$/,""));r=b.subParser("spanGamut")(r,i,o),n=i.noHeaderId?"":' id="'+s(n)+'"',t=a-1+t.length,t="<h"+t+n+">"+r+"</h"+t+">";return b.subParser("hashBlock")(t,i,o)}),e=o.converter._dispatch("headers.after",e,i,o)}),b.subParser("horizontalRule",function(e,t,n){e=n.converter._dispatch("horizontalRule.before",e,t,n);var r=b.subParser("hashBlock")("<hr />",t,n);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,r)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,r)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,r),e=n.converter._dispatch("horizontalRule.after",e,t,n)}),b.subParser("images",function(e,t,h){function l(e,t,n,r,i,o,a,s){var l=h.gUrls,c=h.gTitles,u=h.gDimensions;if(n=n.toLowerCase(),s=s||"",-1<e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m))r="";else if(""===r||null===r){if(r="#"+(n=""===n||null===n?t.toLowerCase().replace(/ ?\n/g," "):n),b.helper.isUndefined(l[n]))return e;r=l[n],b.helper.isUndefined(c[n])||(s=c[n]),b.helper.isUndefined(u[n])||(i=u[n].width,o=u[n].height)}t=t.replace(/"/g,"&quot;").replace(b.helper.regexes.asteriskDashAndColon,b.helper.escapeCharactersCallback);t='<img src="'+(r=r.replace(b.helper.regexes.asteriskDashAndColon,b.helper.escapeCharactersCallback))+'" alt="'+t+'"';return s&&b.helper.isString(s)&&(t+=' title="'+(s=s.replace(/"/g,"&quot;").replace(b.helper.regexes.asteriskDashAndColon,b.helper.escapeCharactersCallback))+'"'),i&&o&&(t+=' width="'+(i="*"===i?"auto":i)+'"',t+=' height="'+(o="*"===o?"auto":o)+'"'),t+=" />"}return e=(e=(e=(e=(e=(e=h.converter._dispatch("images.before",e,t,h)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,l)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,n,r,i,o,a,s){return l(e,t,n,r=r.replace(/\s/g,""),i,o,0,s)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,l)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,l)).replace(/!\[([^\[\]]+)]()()()()()/g,l),e=h.converter._dispatch("images.after",e,t,h)}),b.subParser("italicsAndBold",function(e,t,n){return e=n.converter._dispatch("italicsAndBold.before",e,t,n),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return"<strong><em>"+t+"</em></strong>"})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return"<strong>"+t+"</strong>"})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return"<em>"+t+"</em>"}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?"<strong><em>"+t+"</em></strong>":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?"<strong>"+t+"</strong>":e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?"<em>"+t+"</em>":e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,n){return t+"<strong><em>"+n+"</em></strong>"})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,n){return t+"<strong>"+n+"</strong>"})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,n){return t+"<em>"+n+"</em>"}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?"<strong><em>"+t+"</em></strong>":e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?"<strong>"+t+"</strong>":e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?"<em>"+t+"</em>":e}),e=n.converter._dispatch("italicsAndBold.after",e,t,n)}),b.subParser("lists",function(e,h,c){function d(e,t){c.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var n=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,l=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return h.disableForced4SpacesIndentedSublists&&(n=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(n,function(e,t,n,r,i,o,a){a=a&&""!==a.trim();var s=b.subParser("outdent")(i,h,c),i="";return o&&h.tasklists&&(i=' class="task-list-item" style="list-style-type: none;"',s=s.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return a&&(e+=" checked"),e+=">"})),s=s.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),s="<li"+i+">"+(s=(s=t||-1<s.search(/\n{2,}/)?(s=b.subParser("githubCodeBlocks")(s,h,c),b.subParser("blockGamut")(s,h,c)):(s=(s=b.subParser("lists")(s,h,c)).replace(/\n$/,""),s=(s=b.subParser("hashHTMLBlocks")(s,h,c)).replace(/\n\n+/g,"\n\n"),(l?b.subParser("paragraphs"):b.subParser("spanGamut"))(s,h,c))).replace("¨A",""))+"</li>\n"})).replace(/¨0/g,""),c.gListLevel--,e=t?e.replace(/\s+$/,""):e}function p(e,t){if("ol"===t){e=e.match(/^ *(\d+)\./);if(e&&"1"!==e[1])return' start="'+e[1]+'"'}return""}function i(i,o,a){var e,s=h.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,l=h.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,c="ul"===o?s:l,u="";return-1!==i.search(c)?function e(t){var n=t.search(c),r=p(i,o);-1!==n?(u+="\n\n<"+o+r+">\n"+d(t.slice(0,n),!!a)+"</"+o+">\n",c="ul"===(o="ul"===o?"ol":"ul")?s:l,e(t.slice(n))):u+="\n\n<"+o+r+">\n"+d(t,!!a)+"</"+o+">\n"}(i):(e=p(i,o),u="\n\n<"+o+e+">\n"+d(i,!!a)+"</"+o+">\n"),u}return e=c.converter._dispatch("lists.before",e,h,c),e+="¨0",e=(e=c.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,n){return i(t,-1<n.search(/[*+-]/g)?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,n,r){return i(n,-1<r.search(/[*+-]/g)?"ul":"ol",!1)})).replace(/¨0/,""),e=c.converter._dispatch("lists.after",e,h,c)}),b.subParser("metadata",function(e,t,r){return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,n){return i(n),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,n){return t&&(r.metadata.format=t),i(n),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e;function i(e){(e=(e=(r.metadata.raw=e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,n){return r.metadata.parsed[t]=n,""})}}),b.subParser("outdent",function(e,t,n){return e=(e=(e=n.converter._dispatch("outdent.before",e,t,n)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),e=n.converter._dispatch("outdent.after",e,t,n)}),b.subParser("paragraphs",function(e,t,n){for(var r=(e=(e=(e=n.converter._dispatch("paragraphs.before",e,t,n)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),i=[],o=r.length,a=0;a<o;a++){var s=r[a];0<=s.search(/¨(K|G)(\d+)\1/g)?i.push(s):0<=s.search(/\S/)&&(s=(s=b.subParser("spanGamut")(s,t,n)).replace(/^([ \t]*)/g,"<p>"),s+="</p>",i.push(s))}for(o=i.length,a=0;a<o;a++){for(var l="",c=i[a],u=!1;/¨(K|G)(\d+)\1/.test(c);){var h=RegExp.$1,d=RegExp.$2;l=(l="K"===h?n.gHtmlBlocks[d]:u?b.subParser("encodeCode")(n.ghCodeBlocks[d].text,t,n):n.ghCodeBlocks[d].codeblock).replace(/\$/g,"$$$$"),c=c.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,l),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(c)&&(u=!0)}i[a]=c}return e=(e=(e=i.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),n.converter._dispatch("paragraphs.after",e,t,n)}),b.subParser("runExtension",function(e,t,n,r){return e.filter?t=e.filter(t,r.converter,n):e.regex&&((n=e.regex)instanceof RegExp||(n=new RegExp(n,"g")),t=t.replace(n,e.replace)),t}),b.subParser("spanGamut",function(e,t,n){return e=n.converter._dispatch("spanGamut.before",e,t,n),e=b.subParser("codeSpans")(e,t,n),e=b.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,n),e=b.subParser("encodeBackslashEscapes")(e,t,n),e=b.subParser("images")(e,t,n),e=b.subParser("anchors")(e,t,n),e=b.subParser("autoLinks")(e,t,n),e=b.subParser("simplifiedAutoLinks")(e,t,n),e=b.subParser("emoji")(e,t,n),e=b.subParser("underline")(e,t,n),e=b.subParser("italicsAndBold")(e,t,n),e=b.subParser("strikethrough")(e,t,n),e=b.subParser("ellipsis")(e,t,n),e=b.subParser("hashHTMLSpans")(e,t,n),e=b.subParser("encodeAmpsAndAngles")(e,t,n),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"<br />\n")):e=e.replace(/ +\n/g,"<br />\n"),e=n.converter._dispatch("spanGamut.after",e,t,n)}),b.subParser("strikethrough",function(e,n,r){return n.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,n,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,t){return t=t,"<del>"+(t=n.simplifiedAutoLink?b.subParser("simplifiedAutoLinks")(t,n,r):t)+"</del>"}),e=r.converter._dispatch("strikethrough.after",e,n,r)),e}),b.subParser("stripLinkDefinitions",function(e,s,l){function t(e,t,n,r,i,o,a){return t=t.toLowerCase(),n.match(/^data:.+?\/.+?;base64,/)?l.gUrls[t]=n.replace(/\s/g,""):l.gUrls[t]=b.subParser("encodeAmpsAndAngles")(n,s,l),o?o+a:(a&&(l.gTitles[t]=a.replace(/"|'/g,"&quot;")),s.parseImgDimensions&&r&&i&&(l.gDimensions[t]={width:r,height:i}),"")}return e=(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,t)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,t)).replace(/¨0/,"")}),b.subParser("tables",function(e,m,v){if(!m.tables)return e;function t(e){for(var t=e.split("\n"),n=0;n<t.length;++n)/^ {0,3}\|/.test(t[n])&&(t[n]=t[n].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(t[n])&&(t[n]=t[n].replace(/\|[ \t]*$/,"")),t[n]=b.subParser("codeSpans")(t[n],m,v);var r,i,o,a,s,l=t[0].split("|").map(function(e){return e.trim()}),c=t[1].split("|").map(function(e){return e.trim()}),u=[],h=[],d=[],p=[];for(t.shift(),t.shift(),n=0;n<t.length;++n)""!==t[n].trim()&&u.push(t[n].split("|").map(function(e){return e.trim()}));if(l.length<c.length)return e;for(n=0;n<c.length;++n)d.push((r=c[n],/^:[ \t]*--*$/.test(r)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(r)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(r)?' style="text-align:center;"':""));for(n=0;n<l.length;++n)b.helper.isUndefined(d[n])&&(d[n]=""),h.push((i=l[n],o=d[n],a=void 0,a="",i=i.trim(),"<th"+(a=m.tablesHeaderId||m.tableHeaderId?' id="'+i.replace(/ /g,"_").toLowerCase()+'"':a)+o+">"+(i=b.subParser("spanGamut")(i,m,v))+"</th>\n"));for(n=0;n<u.length;++n){for(var f=[],g=0;g<h.length;++g)b.helper.isUndefined(u[n][g]),f.push((s=u[n][g],"<td"+d[g]+">"+b.subParser("spanGamut")(s,m,v)+"</td>\n"));p.push(f)}return function(e,t){for(var n="<table>\n<thead>\n<tr>\n",r=e.length,i=0;i<r;++i)n+=e[i];for(n+="</tr>\n</thead>\n<tbody>\n",i=0;i<t.length;++i){n+="<tr>\n";for(var o=0;o<r;++o)n+=t[i][o];n+="</tr>\n"}return n+="</tbody>\n</table>\n"}(h,p)}return e=(e=(e=(e=v.converter._dispatch("tables.before",e,m,v)).replace(/\\(\|)/g,b.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,t)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,t),e=v.converter._dispatch("tables.after",e,m,v)}),b.subParser("underline",function(e,t,n){return t.underline?(e=n.converter._dispatch("underline.before",e,t,n),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return"<u>"+t+"</u>"})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return"<u>"+t+"</u>"}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e})).replace(/(_)/g,b.helper.escapeCharactersCallback),e=n.converter._dispatch("underline.after",e,t,n)):e}),b.subParser("unescapeSpecialChars",function(e,t,n){return e=(e=n.converter._dispatch("unescapeSpecialChars.before",e,t,n)).replace(/¨E(\d+)E/g,function(e,t){t=parseInt(t);return String.fromCharCode(t)}),e=n.converter._dispatch("unescapeSpecialChars.after",e,t,n)}),b.subParser("makeMarkdown.blockquote",function(e,t){var n="";if(e.hasChildNodes())for(var r=e.childNodes,i=r.length,o=0;o<i;++o){var a=b.subParser("makeMarkdown.node")(r[o],t);""!==a&&(n+=a)}return n="> "+(n=n.trim()).split("\n").join("\n> ")}),b.subParser("makeMarkdown.codeBlock",function(e,t){var n=e.getAttribute("language"),e=e.getAttribute("precodenum");return"```"+n+"\n"+t.preList[e]+"\n```"}),b.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),b.subParser("makeMarkdown.emphasis",function(e,t){var n="";if(e.hasChildNodes()){n+="*";for(var r=e.childNodes,i=r.length,o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t);n+="*"}return n}),b.subParser("makeMarkdown.header",function(e,t,n){var n=new Array(n+1).join("#"),r="";if(e.hasChildNodes())for(var r=n+" ",i=e.childNodes,o=i.length,a=0;a<o;++a)r+=b.subParser("makeMarkdown.node")(i[a],t);return r}),b.subParser("makeMarkdown.hr",function(){return"---"}),b.subParser("makeMarkdown.image",function(e){var t="";return e.hasAttribute("src")&&(t+="!["+e.getAttribute("alt")+"](",t+="<"+e.getAttribute("src")+">",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),b.subParser("makeMarkdown.links",function(e,t){var n="";if(e.hasChildNodes()&&e.hasAttribute("href")){for(var r=e.childNodes,i=r.length,n="[",o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t);n+="](",n+="<"+e.getAttribute("href")+">",e.hasAttribute("title")&&(n+=' "'+e.getAttribute("title")+'"'),n+=")"}return n}),b.subParser("makeMarkdown.list",function(e,t,n){var r="";if(!e.hasChildNodes())return"";for(var i=e.childNodes,o=i.length,a=e.getAttribute("start")||1,s=0;s<o;++s)void 0!==i[s].tagName&&"li"===i[s].tagName.toLowerCase()&&(r+=("ol"===n?a.toString()+". ":"- ")+b.subParser("makeMarkdown.listItem")(i[s],t),++a);return(r+="\n\x3c!-- --\x3e\n").trim()}),b.subParser("makeMarkdown.listItem",function(e,t){for(var n="",r=e.childNodes,i=r.length,o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t);return/\n$/.test(n)?n=n.split("\n").join("\n ").replace(/^ {4}$/gm,"").replace(/\n\n+/g,"\n\n"):n+="\n",n}),b.subParser("makeMarkdown.node",function(e,t,n){n=n||!1;var r="";if(3===e.nodeType)return b.subParser("makeMarkdown.txt")(e,t);if(8===e.nodeType)return"\x3c!--"+e.data+"--\x3e\n\n";if(1!==e.nodeType)return"";switch(e.tagName.toLowerCase()){case"h1":n||(r=b.subParser("makeMarkdown.header")(e,t,1)+"\n\n");break;case"h2":n||(r=b.subParser("makeMarkdown.header")(e,t,2)+"\n\n");break;case"h3":n||(r=b.subParser("makeMarkdown.header")(e,t,3)+"\n\n");break;case"h4":n||(r=b.subParser("makeMarkdown.header")(e,t,4)+"\n\n");break;case"h5":n||(r=b.subParser("makeMarkdown.header")(e,t,5)+"\n\n");break;case"h6":n||(r=b.subParser("makeMarkdown.header")(e,t,6)+"\n\n");break;case"p":n||(r=b.subParser("makeMarkdown.paragraph")(e,t)+"\n\n");break;case"blockquote":n||(r=b.subParser("makeMarkdown.blockquote")(e,t)+"\n\n");break;case"hr":n||(r=b.subParser("makeMarkdown.hr")(e,t)+"\n\n");break;case"ol":n||(r=b.subParser("makeMarkdown.list")(e,t,"ol")+"\n\n");break;case"ul":n||(r=b.subParser("makeMarkdown.list")(e,t,"ul")+"\n\n");break;case"precode":n||(r=b.subParser("makeMarkdown.codeBlock")(e,t)+"\n\n");break;case"pre":n||(r=b.subParser("makeMarkdown.pre")(e,t)+"\n\n");break;case"table":n||(r=b.subParser("makeMarkdown.table")(e,t)+"\n\n");break;case"code":r=b.subParser("makeMarkdown.codeSpan")(e,t);break;case"em":case"i":r=b.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":r=b.subParser("makeMarkdown.strong")(e,t);break;case"del":r=b.subParser("makeMarkdown.strikethrough")(e,t);break;case"a":r=b.subParser("makeMarkdown.links")(e,t);break;case"img":r=b.subParser("makeMarkdown.image")(e,t);break;default:r=e.outerHTML+"\n\n"}return r}),b.subParser("makeMarkdown.paragraph",function(e,t){var n="";if(e.hasChildNodes())for(var r=e.childNodes,i=r.length,o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t);return n=n.trim()}),b.subParser("makeMarkdown.pre",function(e,t){e=e.getAttribute("prenum");return"<pre>"+t.preList[e]+"</pre>"}),b.subParser("makeMarkdown.strikethrough",function(e,t){var n="";if(e.hasChildNodes()){n+="~~";for(var r=e.childNodes,i=r.length,o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t);n+="~~"}return n}),b.subParser("makeMarkdown.strong",function(e,t){var n="";if(e.hasChildNodes()){n+="**";for(var r=e.childNodes,i=r.length,o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t);n+="**"}return n}),b.subParser("makeMarkdown.table",function(e,t){for(var n="",r=[[],[]],i=e.querySelectorAll("thead>tr>th"),o=e.querySelectorAll("tbody>tr"),a=0;a<i.length;++a){var s=b.subParser("makeMarkdown.tableCell")(i[a],t),l="---";if(i[a].hasAttribute("style"))switch(i[a].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":l=":---";break;case"text-align:right;":l="---:";break;case"text-align:center;":l=":---:"}r[0][a]=s.trim(),r[1][a]=l}for(a=0;a<o.length;++a)for(var c=r.push([])-1,u=o[a].getElementsByTagName("td"),h=0;h<i.length;++h){var d=" ";void 0!==u[h]&&(d=b.subParser("makeMarkdown.tableCell")(u[h],t)),r[c].push(d)}var p=3;for(a=0;a<r.length;++a)for(h=0;h<r[a].length;++h){var f=r[a][h].length;p<f&&(p=f)}for(a=0;a<r.length;++a){for(h=0;h<r[a].length;++h)1===a?":"===r[a][h].slice(-1)?r[a][h]=b.helper.padEnd(r[a][h].slice(-1),p-1,"-")+":":r[a][h]=b.helper.padEnd(r[a][h],p,"-"):r[a][h]=b.helper.padEnd(r[a][h],p);n+="| "+r[a].join(" | ")+" |\n"}return n.trim()}),b.subParser("makeMarkdown.tableCell",function(e,t){var n="";if(!e.hasChildNodes())return"";for(var r=e.childNodes,i=r.length,o=0;o<i;++o)n+=b.subParser("makeMarkdown.node")(r[o],t,!0);return n.trim()}),b.subParser("makeMarkdown.txt",function(e){e=e.nodeValue;return e=(e=e.replace(/ +/g," ")).replace(/¨NBSP;/g," "),e=(e=(e=(e=(e=(e=(e=(e=(e=b.helper.unescapeHTMLEntities(e)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")});"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof module&&module.exports?module.exports=b:this.showdown=b}.call(this),(Typo=function(e,i,o,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable={},this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var t,s,l,c,u,h=this;function n(e,t){e=h._readFile(e,null,a.asyncLoad);a.asyncLoad?e.then(function(e){t(e)}):t(e)}function r(e){i=e,o&&p()}function d(e){o=e,i&&p()}function p(){for(h.rules=h._parseAFF(i),h.compoundRuleCodes={},s=0,c=h.compoundRules.length;s<c;s++){var e=h.compoundRules[s];for(l=0,u=e.length;l<u;l++)h.compoundRuleCodes[e[l]]=[]}for(s in"ONLYINCOMPOUND"in h.flags&&(h.compoundRuleCodes[h.flags.ONLYINCOMPOUND]=[]),h.dictionaryTable=h._parseDIC(o),h.compoundRuleCodes)0===h.compoundRuleCodes[s].length&&delete h.compoundRuleCodes[s];for(s=0,c=h.compoundRules.length;s<c;s++){var t=h.compoundRules[s],n="";for(l=0,u=t.length;l<u;l++){var r=t[l];r in h.compoundRuleCodes?n+="("+h.compoundRuleCodes[r].join("|")+")":n+=r}h.compoundRules[s]=new RegExp(n,"i")}h.loaded=!0,a.asyncLoad&&a.loadedCallback&&a.loadedCallback(h)}return e&&(h.dictionary=e,i&&o?p():"undefined"!=typeof window&&"chrome"in window&&"extension"in window.chrome&&"getURL"in window.chrome.extension?(t=a.dictionaryPath||"typo/dictionaries",i||n(chrome.extension.getURL(t+"/"+e+"/"+e+".aff"),r),o||n(chrome.extension.getURL(t+"/"+e+"/"+e+".dic"),d)):(t=a.dictionaryPath||("undefined"!=typeof __dirname?__dirname+"/dictionaries":"./dictionaries"),i||n(t+"/"+e+"/"+e+".aff",r),o||n(t+"/"+e+"/"+e+".dic",d))),this}).prototype={load:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);return this},_readFile:function(e,t,n){if(t=t||"utf8","undefined"!=typeof XMLHttpRequest){var r=new XMLHttpRequest;return r.open("GET",e,n),n&&(i=new Promise(function(e,t){r.onload=function(){200===r.status?e(r.responseText):t(r.statusText)},r.onerror=function(){t(r.statusText)}})),r.overrideMimeType&&r.overrideMimeType("text/plain; charset="+t),r.send(null),n?i:r.responseText}if("undefined"!=typeof require){var i=require("fs");try{if(i.existsSync(e))return i.readFileSync(e,t);console.log("Path "+e+" does not exist.")}catch(e){return console.log(e),""}}},_parseAFF:function(e){for(var t={},n=(e=this._removeAffixComments(e)).split(/\r?\n/),r=0,i=n.length;r<i;r++){var o,a=(o=n[r]).split(/\s+/),s=a[0];if("PFX"==s||"SFX"==s){for(var l,c=a[1],u=a[2],h=[],d=r+1,p=r+1+(l=parseInt(a[3],10));d<p;d++){var f,g=(f=n[d].split(/\s+/))[2],m=f[3].split("/"),v=m[0];"0"===v&&(v="");var b=this.parseRuleCodes(m[1]),y=f[4],m={};m.add=v,0<b.length&&(m.continuationClasses=b),"."!==y&&(m.match="SFX"===s?new RegExp(y+"$"):new RegExp("^"+y)),"0"!=g&&(m.remove="SFX"===s?new RegExp(g+"$"):g),h.push(m)}t[c]={type:s,combineable:"Y"==u,entries:h},r+=l}else if("COMPOUNDRULE"===s){for(p=(d=r+1)+(l=parseInt(a[1],10));d<p;d++)f=(o=n[d]).split(/\s+/),this.compoundRules.push(f[1]);r+=l}else"REP"===s?3===(f=o.split(/\s+/)).length&&this.replacementTable.push([f[1],f[2]]):this.flags[s]=a[1]}return t},_removeAffixComments:function(e){return e=(e=(e=(e=e.replace(/^\s*#.*$/gm,"")).replace(/^\s\s*/m,"").replace(/\s\s*$/m,"")).replace(/\n{2,}/g,"\n")).replace(/^\s\s*/,"").replace(/\s\s*$/,"")},_parseDIC:function(e){var t=(e=this._removeDicComments(e)).split(/\r?\n/),n={};function r(e,t){n.hasOwnProperty(e)||(n[e]=null),0<t.length&&(null===n[e]&&(n[e]=[]),n[e].push(t))}for(var i=1,o=t.length;i<o;i++){var a=t[i];if(a){var a=a.split("/",2),s=a[0];if(1<a.length){var l=this.parseRuleCodes(a[1]);"NEEDAFFIX"in this.flags&&-1!=l.indexOf(this.flags.NEEDAFFIX)||r(s,l);for(var c=0,u=l.length;c<u;c++){var h=l[c],d=this.rules[h];if(d)for(var p=this._applyRule(s,d),f=0,g=p.length;f<g;f++){var m=p[f];if(r(m,[]),d.combineable)for(var v=c+1;v<u;v++){var b=l[v],b=this.rules[b];if(b&&b.combineable&&d.type!=b.type)for(var y=this._applyRule(m,b),w=0,k=y.length;w<k;w++)r(y[w],[])}}h in this.compoundRuleCodes&&this.compoundRuleCodes[h].push(s)}}else r(s.trim(),[])}}return n},_removeDicComments:function(e){return e=e.replace(/^\t.*$/gm,"")},parseRuleCodes:function(e){if(e){if(!("FLAG"in this.flags))return e.split("");if("long"!==this.flags.FLAG)return"num"===this.flags.FLAG?e.split(","):void 0;for(var t=[],n=0,r=e.length;n<r;n+=2)t.push(e.substr(n,2));return t}return[]},_applyRule:function(e,t){for(var n=t.entries,r=[],i=0,o=n.length;i<o;i++){var a=n[i];if(!a.match||e.match(a.match)){var s=e;if(a.remove&&(s=s.replace(a.remove,"")),"SFX"===t.type?s+=a.add:s=a.add+s,r.push(s),"continuationClasses"in a)for(var l=0,c=a.continuationClasses.length;l<c;l++){var u=this.rules[a.continuationClasses[l]];u&&(r=r.concat(this._applyRule(s,u)))}}}return r},check:function(e){if(!this.loaded)throw"Dictionary not loaded.";e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(e))return!0;if(e.toUpperCase()===e){var t=e[0]+e.substring(1).toLowerCase();if(this.hasFlag(t,"KEEPCASE"))return!1;if(this.checkExact(t))return!0}t=e.toLowerCase();if(t!==e){if(this.hasFlag(t,"KEEPCASE"))return!1;if(this.checkExact(t))return!0}return!1},checkExact:function(e){if(!this.loaded)throw"Dictionary not loaded.";var t,n,r=this.dictionaryTable[e];if(void 0===r){if("COMPOUNDMIN"in this.flags&&e.length>=this.flags.COMPOUNDMIN)for(t=0,n=this.compoundRules.length;t<n;t++)if(e.match(this.compoundRules[t]))return!0}else{if(null===r)return!0;if("object"==typeof r)for(t=0,n=r.length;t<n;t++)if(!this.hasFlag(e,"ONLYINCOMPOUND",r[t]))return!0}return!1},hasFlag:function(e,t,n){if(!this.loaded)throw"Dictionary not loaded.";return!!(t in this.flags&&(n=void 0===n?Array.prototype.concat.apply([],this.dictionaryTable[e]):n)&&-1!==n.indexOf(this.flags[t]))},alphabet:"",suggest:function(e,c){if(!this.loaded)throw"Dictionary not loaded.";if(c=c||5,this.memoized.hasOwnProperty(e)){var t=this.memoized[e].limit;if(c<=t||this.memoized[e].suggestions.length<t)return this.memoized[e].suggestions.slice(0,c)}if(this.check(e))return[];for(var n=0,r=this.replacementTable.length;n<r;n++){var i=this.replacementTable[n];if(-1!==e.indexOf(i[0])){i=e.replace(i[0],i[1]);if(this.check(i))return[i]}}var u=this;function h(e,t){var n,r,i,o,a,s,l={};for(s in"string"==typeof e&&(s=e,(e={})[s]=!0),e)for(n=0,i=s.length+1;n<i;n++){var c=[s.substring(0,n),s.substring(n)];if(c[1]&&(a=c[0]+c[1].substring(1),t&&!u.check(a)||(a in l?l[a]+=1:l[a]=1)),1<c[1].length&&c[1][1]!==c[1][0]&&(a=c[0]+c[1][1]+c[1][0]+c[1].substring(2),t&&!u.check(a)||(a in l?l[a]+=1:l[a]=1)),c[1])for(r=0,o=u.alphabet.length;r<o;r++)u.alphabet[r]!=c[1].substring(0,1)&&(a=c[0]+u.alphabet[r]+c[1].substring(1),t&&!u.check(a)||(a in l?l[a]+=1:l[a]=1));if(c[1])for(r=0,o=u.alphabet.length;r<o;r++)a=c[0]+u.alphabet[r]+c[1],t&&!u.check(a)||(a in l?l[a]+=1:l[a]=1)}return l}return u.alphabet="abcdefghijklmnopqrstuvwxyz",this.memoized[e]={suggestions:function(e){var t,n=h(e),r=h(n,!0);for(t in n)u.check(t)&&(t in r?r[t]+=n[t]:r[t]=n[t]);var i=[];for(l in r)r.hasOwnProperty(l)&&i.push([l,r[l]]);i.sort(function(e,t){var n=e[1],r=t[1];return n<r?-1:r<n?1:t[0].localeCompare(e[0])}).reverse();var o=[],a="lowercase";e.toUpperCase()===e?a="uppercase":e.substr(0,1).toUpperCase()+e.substr(1).toLowerCase()===e&&(a="capitalized");for(var s=c,l=0;l<Math.min(s,i.length);l++)"uppercase"===a?i[l][0]=i[l][0].toUpperCase():"capitalized"===a&&(i[l][0]=i[l][0].substr(0,1).toUpperCase()+i[l][0].substr(1)),u.hasFlag(i[l][0],"NOSUGGEST")||-1!=o.indexOf(i[l][0])?s++:o.push(i[l][0]);return o}(e),limit:c},this.memoized[e].suggestions}},"undefined"!=typeof module&&(module.exports=Typo);let CDTE_DICTIONARIES=[],CDTE_PREDICTIVE_PHRASES=[],CDTE_EDITORS=[],CDTE_test=!1;class CDTextEditor{constructor(h){if(0,void 0!==h){this.id=getEditorId(),this.workbench=document.getElementById(h),this.workbench.setAttribute("class","CDTextEditor_workbench"),this.workbenchWidth=this.workbench.offsetWidth-2,this.workbenchHeight=this.workbench.offsetHeight-48,this.viewer=document.createElement("div"),this.viewer.setAttribute("class","CDTextViewer");let e=document.createElement("textarea");e.setAttribute("class","CDTextEditor"),this.fileInput=document.createElement("input"),this.fileInput.setAttribute("type","file"),this.fileInput.setAttribute("class","CDTextEditor_inputfile"),this.fileInput.setAttribute("id","CDTextEditor_inputfile_"+this.id),this.fileInput.addEventListener("change",()=>getFileContents(this.fileInput.files,this.editor));let t=document.createElement("div");t.setAttribute("class","CDTextEditor_header"),t.setAttribute("id","CDTextEditor_header_"+this.id);let n=document.createElement("div");n.setAttribute("class","logo"),n.setAttribute("title","CDTextEditor v0.1");let r=document.createElement("label");r.setAttribute("for","CDTextEditor_inputfile_"+this.id),r.setAttribute("class","CDTextEditor_button"),r.innerHTML="Load";let i=document.createElement("div");i.setAttribute("class","CDTextEditor_button"),i.innerHTML="Save raw",i.onclick=function(){this.save_raw()}.bind(this);let o=document.createElement("div");o.setAttribute("class","CDTextEditor_button"),o.innerHTML="Save as HTML",o.onclick=function(){this.save_html()}.bind(this),this.buttonPreview=document.createElement("div"),this.buttonPreview.setAttribute("class","CDTextEditor_button"),this.buttonPreview.innerHTML="+ Preview",this.buttonPreview.onclick=function(){"block"!==this.viewer.style.display?(this.preview(),this.buttonPreview.innerHTML="- Preview"):(this.viewer.style.display="none",this.initSize(),this.buttonPreview.innerHTML="+ Preview")}.bind(this);let a=document.createElement("div");a.setAttribute("class","CDTextEditor_button"),a.innerHTML="&rtrif; Spellcheck",a.onclick=function(){"block"!==this.spellcheckMenu.style.display?(this.spellcheckMenu.style.display="block",a.innerHTML="&dtrif; Spellcheck"):(this.spellcheckMenu.style.display="none",a.innerHTML="&rtrif; Spellcheck"),this.spellcheckMenu.style.top=a.offsetTop+30+"px",this.spellcheckMenu.style.left=a.offsetLeft+1+"px",this.spellcheckMenu.style.width=a.offsetWidth-2+"px"}.bind(this),this.spellcheckMenu=document.createElement("div"),this.spellcheckMenu.setAttribute("class","CDTextEditor_spellcheck_menu");let s=document.createElement("div");s.setAttribute("class","CDTextEditor_autopreview_block"),this.autopreviewCheckbox=document.createElement("input"),this.autopreviewCheckbox.setAttribute("type","checkbox"),this.autopreviewCheckbox.setAttribute("class","CDTextEditor_autopreview_checkbox"),this.autopreviewCheckbox.setAttribute("id","CDTextEditor_autopreview_checkbox_"+this.id);let l=document.createElement("label");l.setAttribute("for","CDTextEditor_autopreview_checkbox_"+this.id),l.innerHTML="Autopreview",s.appendChild(this.autopreviewCheckbox),s.appendChild(l),t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t.appendChild(this.buttonPreview),t.appendChild(a),t.appendChild(s);let c=document.createElement("div");c.setAttribute("class","CDTextEditor_footer"),this.spellcheckStatus=document.createElement("div"),this.spellcheckStatus.setAttribute("class","CDTextEditor_footer_spellcheck"),this.spellcheckStatus.innerHTML="Spell check not enabled.",c.appendChild(this.spellcheckStatus);let u=document.createElement("div");u.setAttribute("class","CDTextEditor_wrapper"),u.appendChild(e),u.appendChild(this.viewer),this.workbench.appendChild(this.fileInput),this.workbench.appendChild(t),this.workbench.appendChild(u),this.workbench.appendChild(c),this.workbench.appendChild(this.spellcheckMenu),this.editor=CodeMirror.fromTextArea(e),this.editor.setOption("lineNumbers",!0),this.editor.setSize(this.workbenchWidth+"px",this.workbenchHeight+"px"),this.editor.getWrapperElement().style.display="block",this.editor.getWrapperElement().style.float="left",this.autopreview=!1,this.isflex=!1,this.spellcheck=[],this.editor.on("change",function(){this.autopreview&&this.preview()}.bind(this)),this.autopreviewCheckbox.onclick=function(){this.autopreview||this.preview(),this.autopreview=!this.autopreview}.bind(this),CDTE_EDITORS[this.id]=this}}setup(e){return this.asyncSetup(e),this}async asyncSetup(e){for(var t in e)this.optionsSwitch(t,e[t]),await timeout(500)}optionsSwitch(e,t){switch(e){case"maxSize":return this.maxSize(t.w,t.h);case"fill":return this.fill(t);case"draggable":return!0===t?this.draggable():this;case"resizable":return!0===t?this.resizable():this;case"flex":return!0===t?this.flex():this;case"spellchecking":return this.spellCheck(t.url,t.loc);case"predictive":return this.predictive(t);case"readOnly":return!0===t?this.readOnly():this;case"autoPreview":return!0===t?this.autoPreview():this}return this}maxSize(e,t){return this.workbench.style.maxWidth=e+"px",this.workbench.style.maxHeight=t+"px",this}fill(e){return this.editor.setValue(e),this}showViewer(){"block"!==this.viewer.style.display&&(this.viewer.style.display="block",this.initSize(),this.buttonPreview.innerHTML="- Preview")}hideViewer(){"block"===this.viewer.style.display&&(this.viewer.style.display="none",this.initSize(),this.buttonPreview.innerHTML="+ Preview")}initSize(){let e=0;"block"===this.viewer.style.display&&(e=this.workbenchWidth/2-1,this.viewer.style.height=this.workbenchHeight+"px"),this.viewer.style.width=e+"px",this.editor.setSize(this.workbenchWidth-e-1+"px",this.workbenchHeight+"px")}flexResize(){this.viewer.offsetWidth<.05*this.workbenchWidth&&this.hideViewer();var e=this.viewer.offsetWidth;this.viewer.style.left="0",this.viewer.style.maxWidth=.75*this.workbenchWidth+"px",this.editor.setSize(this.workbenchWidth-e-1+"px",this.workbenchHeight+"px")}resize(){var e;this.workbenchWidth=this.workbench.offsetWidth-2,this.workbenchHeight=this.workbench.offsetHeight-48,this.isflex?(e=this.viewer.offsetWidth,this.viewer.style.height=this.workbenchHeight+"px",this.editor.setSize(this.workbenchWidth-e+"px",this.workbenchHeight+"px")):this.initSize()}val(){return this.editor.getValue()}htmlval(){return markdown2html(this.val())}preview(){this.showViewer(),this.viewer.innerHTML=this.htmlval(),this.isflex&&$(this.viewer).resizable({handles:"w",resize:function(){this.flexResize()}.bind(this)})}draggable(){return jqueryRun(function(){$(this.workbench).draggable({start:function(){$(this.workbench).css("z-index",9999)}.bind(this),cursor:"crosshair",handle:"#CDTextEditor_header_"+this.id})}.bind(this)),this}resizable(){return jqueryRun(function(){$(this.workbench).resizable({resize:function(){this.resize()}.bind(this)})}.bind(this)),this}flex(){return jqueryRun(function(){this.isflex=!0}.bind(this)),this}autoPreview(){return this.autopreview=!0,this.autopreviewCheckbox.setAttribute("checked","checked"),this.buttonPreview.innerHTML="- Preview",this.preview(),this}spellCheck(e,t){this.spellcheckStatus.innerHTML="<span style='color: #de9e00;'>Loading dictionaries for ["+t+"]...</span>";let n=[],r=[],i=[];return t.forEach(function(t){if(t in CDTE_DICTIONARIES)return n.push(CDTE_DICTIONARIES[t]),void this.spellcheck.push({loc:t,enabled:!0});i.push(loadTypo(e,t).then(function(e){n.push(e),CDTE_DICTIONARIES[t]=e,this.spellcheck.push({loc:t,enabled:!0})}.bind(this)).catch(()=>r.push(t)))}.bind(this)),0===i.length?(this.spellCheckOverlay(n),0<r.length&&0==n.length?this.spellcheckStatus.innerHTML="<span style='color: #990000;'>Failed to load dictionaries for ["+r+"].</span>":0<r.length&&0<n.length?this.spellcheckStatus.innerHTML="<span style='color: #de9e00;'>Failed to load dictionaries for ["+r+"].</span>":this.spellcheckStatus.innerHTML="<span style='color: #009900;'>Dictionaries for ["+t+"] loaded!</span>",this.updateSpellCheckMenu()):Promise.all(i).then(function(){this.spellCheckOverlay(n),0<r.length&&0==n.length?this.spellcheckStatus.innerHTML="<span style='color: #990000;'>Failed to load dictionaries for ["+r+"].</span>":0<r.length&&0<n.length?this.spellcheckStatus.innerHTML="<span style='color: #de9e00;'>Failed to load dictionaries for ["+r+"].</span>":this.spellcheckStatus.innerHTML="<span style='color: #009900;'>Dictionaries for ["+t+"] loaded!</span>",this.updateSpellCheckMenu()}.bind(this)),this}updateSpellCheckMenu(){for(var r of this.spellcheck){const i=r.loc;r=r.enabled;let e=document.createElement("div");e.setAttribute("class","CDTextEditor_spellcheck_menu_option");let t=document.createElement("input");t.setAttribute("id","CDTextEditor_"+this.id+"_spellcheck_menu_option_"+i),t.setAttribute("type","checkbox"),r&&t.setAttribute("checked","checked"),t.onclick=function(){this.switchSpellCheckOption(i)}.bind(this);let n=document.createElement("label");n.setAttribute("for","CDTextEditor_"+this.id+"_spellcheck_menu_option_"+i),n.innerHTML=i,e.appendChild(t),e.appendChild(n),this.spellcheckMenu.appendChild(e)}}switchSpellCheckOption(t){for(let e=0;e<this.spellcheck.length;e++)this.spellcheck[e].loc===t&&(this.spellcheck[e].enabled=!this.spellcheck[e].enabled)}getSpellCheckOption(e){for(var t of this.spellcheck)if(t.loc===e)return t.enabled;return!1}spellCheckOverlay(a){var s;0!==a.length&&(s="!'\"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ",this.editor.spellcheckOverlay={token:function(e){var t,n=e.peek(),r="";if(s.includes(n)||""===n||""===n)return e.next(),null;for(;(n=e.peek())&&!s.includes(n);)r+=n,e.next();if(!/[a-z]/i.test(r))return null;let i=!0,o=!1;for(t of a)this.getSpellCheckOption(t.dictionary)&&(o=!0,t.check(r)&&(i=!1));return o&&i?"spell-error":void 0}.bind(this)},this.editor.addOverlay(this.editor.spellcheckOverlay))}predictive(t){var e;return t in CDTE_PREDICTIVE_PHRASES?(e=CDTE_PREDICTIVE_PHRASES[t],this.bindPredictiveDictionary(e)):loadPredictiveDictionary(t).then(function(e){e=formPredictiveDictionary(e);CDTE_PREDICTIVE_PHRASES[t]=e,this.bindPredictiveDictionary(e)}.bind(this)),this}bindPredictiveDictionary(r){this.editor.on("change",function(){var e=this.editor.findWordAt(this.editor.getDoc().getCursor());let t="";t=this.editor.getDoc().getRange(e.anchor,e.head),t=t.toLowerCase().trim();t.length;let n;'"'+t+'"'in r?(n=r['"'+t+'"'],e={hint:function(){return{from:{line:this.editor.getDoc().getCursor().line,ch:this.editor.getDoc().getCursor().ch+1},to:this.editor.getDoc().getCursor(),list:n}}.bind(this),completeSingle:!1},this.editor.showHint(e)):this.editor.showHint(null)}.bind(this))}readOnly(){return this.editor.setOption("readOnly",!0),this}save_raw(){var e=this.val(),t=new Blob([e],{type:"text/plain"}),e=document.createElement("a");e.download="MarkdownFile.md",null!=window.webkitURL?e.href=window.webkitURL.createObjectURL(t):(e.href=window.URL.createObjectURL(t),e.onclick=destroyClickedElement,e.style.display="none",document.body.appendChild(e)),e.click()}save_html(){var e="<html><head><title>FormattedMarkdownFile</title></head><body>"+this.htmlval()+"</body></html>",t=new Blob([e],{type:"text/plain"}),e=document.createElement("a");e.download="FormattedMarkdownFile.html",null!=window.webkitURL?e.href=window.webkitURL.createObjectURL(t):(e.href=window.URL.createObjectURL(t),e.onclick=destroyClickedElement,e.style.display="none",document.body.appendChild(e)),e.click()}static create(e){return CDTextEditor.asyncCreate(e),CDTE_EDITORS}static async asyncCreate(e){for(var t of e)new CDTextEditor(t.id).setup(t.options),await timeout(500)}}async function jqueryRun(e){await loadJQuery(),await loadJQueryUI(),e()}function loadJQuery(){return new Promise(t=>{if(window.jQuery)t();else{let e=document.createElement("script");e.onload=function(){console.warn("jQuery not found. \n Loaded from: https://code.jquery.com/jquery-3.6.0.js"),t()},e.src="https://code.jquery.com/jquery-3.6.0.js",document.head.insertBefore(e,document.head.getElementsByTagName("script")[0])}})}function loadJQueryUI(){return new Promise(t=>{if(window.jQuery.ui)t();else{let e=document.createElement("script");e.onload=function(){let e=document.createElement("link");e.onload=function(){console.warn("jQuery-UI not found. \n Loaded from: https://code.jquery.com/ui/1.12.0/jquery-ui.min.js \n Theme: https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css"),t()},e.rel="stylesheet",e.href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css",document.head.insertBefore(e,document.head.getElementsByTagName("link")[0])},e.src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js",document.head.insertBefore(e,document.head.getElementsByTagName("script")[1])}})}function markdown2html(t){{let e=new showdown.Converter;return e.makeHtml(t)}}function loadTypo(e,o){const t=e+o+".aff",a=e+o+".dic";return new Promise(function(n,r){let i=new XMLHttpRequest;i.open("GET",t,!0),i.onreadystatechange=function(e){if(4===i.readyState)if(200===i.status){let t=new XMLHttpRequest;t.open("GET",a,!0),t.onreadystatechange=function(e){4===t.readyState&&(200===t.status?n(new Typo(o,i.responseText,t.responseText,{platform:"any"})):r())},t.send(null)}else r()},i.send(null)})}function getFileContents(t,r){if(0!=t.length){t=t[0];let e=new FileReader;e.onload=e=>{const t=e.target.result,n=t.split(/\r\n|\n/);r.setValue(n.join("\n"))},e.onerror=e=>alert(e.target.error.name),e.readAsText(t)}}function loadPredictiveDictionary(e){return new Promise(function(t,n){let r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(e){4===r.readyState&&(200===r.status?t(r.responseText):n())},r.send(null)})}function formPredictiveDictionary(e){var t;let n=[];for(t of e.split(/\r?\n/))if(0!==t.length){let e=t.toLowerCase().trim().split(/\s+/);var r=e[0];e[0]="",'"'+r+'"'in n||(n['"'+r+'"']=[]),n['"'+r+'"'].push(e.join(" "))}return n}function getEditorId(){var e=Math.ceil(1e6),t=Math.floor(9999999);return Math.floor(Math.random()*(t-e))+e}function timeout(t){return new Promise(e=>setTimeout(e,t))}